@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +286 -0
  2. package/LICENSE +21 -0
  3. package/README.md +295 -0
  4. package/THIRD_PARTY_NOTICES.md +22 -0
  5. package/dist/business.cjs +26 -0
  6. package/dist/business.d.cts +10311 -0
  7. package/dist/business.d.ts +10311 -0
  8. package/dist/business.js +26 -0
  9. package/dist/format-BUpOzeCo.d.cts +8 -0
  10. package/dist/format-BUpOzeCo.d.ts +8 -0
  11. package/dist/hooks.cjs +8 -0
  12. package/dist/hooks.d.cts +1148 -0
  13. package/dist/hooks.d.ts +1148 -0
  14. package/dist/hooks.js +8 -0
  15. package/dist/index.cjs +6 -0
  16. package/dist/index.d.cts +5616 -0
  17. package/dist/index.d.ts +5616 -0
  18. package/dist/index.js +6 -0
  19. package/dist/lib.cjs +42 -0
  20. package/dist/lib.d.cts +804 -0
  21. package/dist/lib.d.ts +804 -0
  22. package/dist/lib.js +42 -0
  23. package/dist/message-KJli9tvf.d.cts +71 -0
  24. package/dist/message-KJli9tvf.d.ts +71 -0
  25. package/dist/message-provider-BI-P3CNq.d.cts +11 -0
  26. package/dist/message-provider-BI-P3CNq.d.ts +11 -0
  27. package/dist/next.cjs +6 -0
  28. package/dist/next.d.cts +103 -0
  29. package/dist/next.d.ts +103 -0
  30. package/dist/next.js +6 -0
  31. package/dist/theme-toggle-JL_jZE-w.d.cts +81 -0
  32. package/dist/theme-toggle-JL_jZE-w.d.ts +81 -0
  33. package/dist/time-picker-H1AaecnE.d.cts +452 -0
  34. package/dist/time-picker-H1AaecnE.d.ts +452 -0
  35. package/dist/ui/icons.cjs +6 -0
  36. package/dist/ui/icons.d.cts +3 -0
  37. package/dist/ui/icons.d.ts +3 -0
  38. package/dist/ui/icons.js +6 -0
  39. package/dist/ui-icons.cjs +6 -0
  40. package/dist/ui-icons.d.cts +205 -0
  41. package/dist/ui-icons.d.ts +205 -0
  42. package/dist/ui-icons.js +6 -0
  43. package/dist/ui.cjs +6 -0
  44. package/dist/ui.d.cts +39 -0
  45. package/dist/ui.d.ts +39 -0
  46. package/dist/ui.js +6 -0
  47. package/package.json +265 -0
  48. package/styles.css +1300 -0
  49. package/styles.css.d.ts +11 -0
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Chaos UI - Enterprise React Component Library
3
+ * Copyright (c) 2026 qxyfoods
4
+ * MIT License
5
+ */
6
+ "use strict";"use client";var xC=Object.create;var Kc=Object.defineProperty;var vC=Object.getOwnPropertyDescriptor;var hC=Object.getOwnPropertyNames;var yC=Object.getPrototypeOf,NC=Object.prototype.hasOwnProperty;var CC=(e,t,a)=>t in e?Kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var kC=(e,t)=>{for(var a in t)Kc(e,a,{get:t[a],enumerable:!0})},nb=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of hC(t))!NC.call(e,o)&&o!==a&&Kc(e,o,{get:()=>t[o],enumerable:!(r=vC(t,o))||r.enumerable});return e};var M=(e,t,a)=>(a=e!=null?xC(yC(e)):{},nb(t||!e||!e.__esModule?Kc(a,"default",{value:e,enumerable:!0}):a,e)),wC=e=>nb(Kc({},"__esModule",{value:!0}),e);var ed=(e,t,a)=>CC(e,typeof t!="symbol"?t+"":t,a);var dD={};kC(dD,{AccountBalance:()=>_T,ActivityFeed:()=>_C,AddressColumn:()=>Ff,AddressPanel:()=>p0,AddressPicker:()=>vS,AdvancedSearch:()=>qC,AnnouncementBanner:()=>KC,AnnouncementCard:()=>LR,ApplicationForm:()=>XT,ApprovalActionBar:()=>QP,ApprovalFlow:()=>KP,ApprovalTimeline:()=>YC,ArApAgingTable:()=>iI,AreaChart:()=>M0,AsyncTaskCenter:()=>ZC,AsyncTaskTrigger:()=>FR,AttachmentList:()=>wR,AttachmentPreview:()=>PR,AttachmentUploader:()=>CR,AttendanceCalendar:()=>Z2,AudienceSegmentBuilder:()=>tk,AuditLog:()=>vv,AuditSidebar:()=>nk,AuditTrailDiff:()=>O2,AuthGuard:()=>sk,AuthLayout:()=>ry,AvatarGroup:()=>fk,BOMTreeEditor:()=>M2,BackTop:()=>VC,BadgeDelta:()=>yT,BarChart:()=>gp,BarList:()=>fT,BarListCard:()=>B0,BatchGenealogyTree:()=>eC,BatchPrintDialog:()=>xR,BatchSelector:()=>wS,BillFooter:()=>bk,BillHeader:()=>xk,BillPage:()=>yk,BillPrintTemplate:()=>uR,BillStatusBar:()=>Nk,BillTimeline:()=>XP,BillTodoList:()=>VP,BizStatusTag:()=>Ck,BrowseDialog:()=>s2,BudgetAllocator:()=>L0,BudgetOverview:()=>HT,BudgetPacingCard:()=>Tk,BulkActionsToolbar:()=>Rk,BulkImportWizard:()=>Ik,CATEGORY_LABELS:()=>S0,CalendarView:()=>oT,Callout:()=>hT,CampaignCalendar:()=>Lk,CampaignCard:()=>zk,CampaignStatusTag:()=>bm,CategoryBar:()=>xT,ChannelPicker:()=>Ek,ChartCard:()=>CT,ChartContainer:()=>Vk,ChartSuite:()=>ZP,ChartTooltip:()=>Ok,ChatAgentStatus:()=>F1,ChatArtifactPanel:()=>$1,ChatBranch:()=>U1,ChatCardMessage:()=>P1,ChatCodeBlock:()=>a1,ChatCommandMenu:()=>M1,ChatContextPanel:()=>z1,ChatConversation:()=>V1,ChatConversationSearch:()=>O1,ChatFeedback:()=>H1,ChatHeader:()=>XR,ChatImageGallery:()=>T1,ChatInputToolbar:()=>I1,ChatMarkdownRenderer:()=>Lm,ChatMentionPicker:()=>D1,ChatMessageActions:()=>JR,ChatMessageBubble:()=>Bf,ChatMessageGroup:()=>YR,ChatMessageInput:()=>_1,ChatModelSwitcher:()=>A1,ChatSharedLink:()=>W1,ChatShell:()=>KR,ChatSidebar:()=>QR,ChatStreamingText:()=>B1,ChatSuggestReplies:()=>L1,ChatThinkingBlock:()=>e1,ChatToolCallBlock:()=>t1,ChatVoiceMessage:()=>S1,CheckoutBar:()=>rR,Chip:()=>_k,CityBrowse:()=>zT,CodeBlock:()=>Gk,CodeEditor:()=>xm,ColorBoard:()=>qy,ColorTag:()=>hf,Combobox:()=>AC,CommandPalette:()=>Qk,CommissionCalculator:()=>KI,CompanyBrowse:()=>LT,CompanyPicker:()=>A0,ComplianceChecklist:()=>sD,ConfirmDialog:()=>jv,ConfirmDialogContainer:()=>Jk,ContractTemplate:()=>n2,CookieBanner:()=>Zk,CostCenterPicker:()=>F0,CouponCard:()=>oR,CreativePreview:()=>rw,CronEditor:()=>Qy,CrudPage:()=>Xv,CrudToolbar:()=>tw,Customer360Card:()=>yI,CustomerBrowse:()=>PT,CustomerPicker:()=>H0,DashboardCanvas:()=>gT,DashboardDesigner:()=>JS,DashboardGrid:()=>O0,DataTable:()=>lw,DateRangePicker:()=>cw,DeltaBar:()=>bT,DepartmentPicker:()=>_0,DialogFormBody:()=>Zh,DictSelect:()=>fw,DiffViewer:()=>uw,DiffViewerTable:()=>bS,DistributorPicker:()=>G0,DockPanel:()=>GR,DonutCard:()=>wT,DonutChart:()=>j0,DynamicFormBuilder:()=>WP,EditToolbar:()=>uk,EditableTreeTable:()=>pS,EmployeePicker:()=>Q0,EmptyState:()=>gd,EquipmentCard:()=>DS,ErrorBoundary:()=>of,ErrorPage:()=>J0,ExpenseLineEditor:()=>bw,ExperimentSummary:()=>xw,ExportButton:()=>vw,Fab:()=>$C,FabSpeedDial:()=>HC,FeatureTour:()=>UR,FeeTypeBrowse:()=>DT,FieldMask:()=>yw,FileCard:()=>Rf,FileUploadManager:()=>Nw,FilterBar:()=>af,FilterBuilder:()=>gm,FlowTracker:()=>qP,Forbidden:()=>Cw,FormDesigner:()=>q1,FormDesignerRuntime:()=>j1,FormStack:()=>ey,FormWizard:()=>lf,FormulaEditor:()=>WS,FullPageLoader:()=>Vw,FunnelChart:()=>eT,GanttChart:()=>tT,GanttChartPro:()=>S2,Gauge:()=>kw,GaugeChart:()=>tN,GlobalLoadingContext:()=>Qg,GlobalLoadingProvider:()=>ck,HeatmapCalendar:()=>Tw,HeatmapChart:()=>lT,I18nFormField:()=>lD,ImMessage:()=>aN,ImageGallery:()=>TR,ImportDialog:()=>gk,ImportErrorTable:()=>bR,ImportMappingWizard:()=>H2,InlineEdit:()=>Rw,InlineSparkline:()=>k0,InventoryAlertList:()=>HS,InventorySnapshot:()=>UT,InviteLink:()=>nR,InvoiceManager:()=>aR,InvoiceSummary:()=>WT,IotSensorGrid:()=>rD,JournalEntryEditor:()=>D2,JsonEditor:()=>Sw,JsonViewer:()=>Dw,KPICard:()=>Lw,KanbanBoard:()=>uf,KanbanColumn:()=>oN,LabelDesigner:()=>ZI,LabeledField:()=>sf,LanguageSwitcher:()=>Ew,LeadPipelineBoard:()=>dI,LeaveRequestForm:()=>Q2,LineChart:()=>bp,LineEditor:()=>ym,LoadingPage:()=>Fw,MaintenanceLog:()=>LS,MapChart:()=>dT,MapMarkerCluster:()=>cT,MapTrack:()=>mT,MapView:()=>pT,MarkdownEditor:()=>Gy,MarketingActivityForm:()=>jT,MasterDetailLayout:()=>ay,MasterEditTemplate:()=>EP,MasterListTemplate:()=>FP,MediaRecorder:()=>zS,MeetingRoomBooking:()=>Y2,MessageList:()=>nN,MetricTrend:()=>Uw,MobileActionSheet:()=>Z1,MobileAuthLayout:()=>Ww,MobileButton:()=>_w,MobileCamera:()=>tS,MobileCard:()=>qw,MobileCardSkeleton:()=>lP,MobileDashboardLayout:()=>Gw,MobileDataTable:()=>jw,MobileDetailSkeleton:()=>dP,MobileDialog:()=>Kw,MobileEmptyState:()=>Qw,MobileFilterBuilder:()=>Xw,MobileForm:()=>Yw,MobileFormField:()=>Jw,MobileFormWizard:()=>Zw,MobileGeolocation:()=>oS,MobileInfiniteScroll:()=>nS,MobileInput:()=>eP,MobileKPICard:()=>aP,MobileKanban:()=>tP,MobileListItem:()=>iS,MobileListItemSkeleton:()=>iP,MobileNavigation:()=>rP,MobilePageHeader:()=>ff,MobilePageShell:()=>J1,MobilePicker:()=>eS,MobileQrCodeScanner:()=>aS,MobileSelect:()=>nP,MobileSheet:()=>sP,MobileSignature:()=>rS,MobileTabBar:()=>sS,MobileTabs:()=>mP,MobileTextarea:()=>uP,MultiCurrencyInput:()=>$2,MultiSelect:()=>pP,NotificationCenter:()=>bP,NotificationRuleBuilder:()=>q2,OaBridge:()=>YP,OeeDashboard:()=>II,OperationLog:()=>HP,OrderLineEditor:()=>xP,OrgChart:()=>Oy,OverviewPage:()=>sN,PDFViewer:()=>Uy,PageHeader:()=>gf,PasteUpload:()=>SR,PaymentMethodSelector:()=>iR,PaymentResult:()=>lR,PaymentSchedule:()=>mR,PerformanceRankTable:()=>AR,PermissionButton:()=>iN,PermissionMatrix:()=>vP,PermissionWrapper:()=>yv,PhotoAudit:()=>$P,PieChart:()=>xp,PivotTable:()=>hP,PolicyLineEditor:()=>KT,PoolTrackerTable:()=>ER,PreferencePanel:()=>WR,PriceAdjustBrowse:()=>IT,PrintButton:()=>pk,PrintService:()=>NR,PrintTemplateBuilder:()=>hR,ProductBrowse:()=>TT,ProductCategoryPicker:()=>cN,PromotionRuleCard:()=>mN,PromotionRuleEditor:()=>uN,PromptDialog:()=>yP,PullToRefresh:()=>oP,PurchaseOrderEditor:()=>jN,QualityInspectionForm:()=>ES,QuickEntryGrid:()=>BR,QuotationLineEditor:()=>pI,RadarChart:()=>hp,RadialChart:()=>pN,RadialProgress:()=>ww,Rating:()=>MC,RebutNodeSelect:()=>GP,ReconciliationLineEditor:()=>qT,ReconciliationSummary:()=>YT,RedPacket:()=>_S,RegionPicker:()=>bN,RemoteSelect:()=>eh,ReportBuilder:()=>KS,ResourceSchedule:()=>sT,ResponsivePreview:()=>CP,RichTextEditor:()=>Hy,RoleAssignment:()=>kP,RuleEditor:()=>Y1,SPCControlChart:()=>wI,STATUS_CONFIG:()=>_m,SalesOrderBrowse:()=>RT,SalesTargetEditor:()=>GT,SankeyChart:()=>xN,SavedFilters:()=>wP,ScatterChart:()=>yp,SealStampRegistry:()=>OI,SearchTable:()=>Zu,SegmentedControl:()=>cm,SerialNumberManager:()=>UP,SettlementStatusTag:()=>ZT,ShiftCalendar:()=>RS,ShippingWayBrowse:()=>MT,SignActionButton:()=>eR,SkuPicker:()=>hN,SocialShare:()=>TP,SparkChart:()=>yN,Sparkline:()=>Ch,SqlEditor:()=>Uh,StatCard:()=>RP,StatCardRow:()=>SP,StatCardWithDelta:()=>NN,StatCardWithSparkline:()=>kT,StatusBadge:()=>Xh,StatusTag:()=>IP,StockTransferDialog:()=>aI,SubformTabs:()=>CN,SupplierScorecard:()=>E2,SwipeActions:()=>cP,TabCrudPage:()=>kN,TabPin:()=>jR,TargetProgress:()=>VT,TaskHistory:()=>OR,TaskListTable:()=>MR,TaskProgress:()=>VR,TaxDetailTable:()=>AT,TemplateDownload:()=>fR,TerritoryMap:()=>YI,ThemeToggle:()=>PN,TimePicker:()=>sv,TimelineView:()=>iT,TodoListTable:()=>TN,Tour:()=>LC,Tracking:()=>NT,Transfer:()=>Qu,TreeCrudPage:()=>SN,TreeTable:()=>dS,TreemapChart:()=>DN,UTMBuilder:()=>BP,UnitConverter:()=>VS,UserMenu:()=>DP,VehicleBooking:()=>qI,VersionHistory:()=>LP,WarehouseBrowse:()=>BT,WarehousePicker:()=>BN,WaterfallChart:()=>LN,Watermark:()=>zC,WorkOrderCard:()=>EI,WorkflowDesigner:()=>K1,WorkflowPreview:()=>X1,WriteoffBrowse:()=>ST,WriteoffFlow:()=>$T,brandColors:()=>$k,builtInCategories:()=>w0,colorConfig:()=>vf,computeResult:()=>Vf,convertValue:()=>P0,defaultChannelOptions:()=>zv,defaultColors:()=>Fk,defaultStatusMap:()=>Rv,formatCurrency:()=>ze,formatDate:()=>Mt,formatDateTime:()=>ri,formatNumber:()=>Q,formatPercent:()=>da,formatRelativeTime:()=>qi,formatResult:()=>T0,formatTimeInput:()=>iv,message:()=>yf,safeEvaluate:()=>R0,setDictFetcher:()=>gw,statusColors:()=>Hk,statusConfig:()=>_h,useConfirm:()=>Yk,useGlobalLoading:()=>mk,variantConfig:()=>_g,withPermission:()=>dk});module.exports=wC(dD);var lv=M(require("react"),1);var sb=require("clsx"),ib=require("tailwind-merge");function l(...e){return(0,ib.twMerge)((0,sb.clsx)(e))}var P=M(require("lucide-react"),1),Vo=P.AlertCircleIcon,ir=P.AlertTriangleIcon;var Os=P.ArrowDownIcon,ts=P.ArrowDownRightIcon,cl=P.ArrowLeftIcon;var co=P.ArrowRightIcon,su=P.ArrowUpDownIcon,Li=P.ArrowUpIcon,as=P.ArrowUpRightIcon,lb=P.BadgeDollarSignIcon,td=P.BarChart3Icon;var Mn=P.BellIcon;var sg=P.BookmarkCheckIcon,iu=P.BookmarkIcon,ml=P.Building2Icon,ig=P.BuildingIcon;var db=P.CalendarDaysIcon,mn=P.CalendarIcon,ft=P.CheckCircle2Icon,zi=P.CheckCircleIcon,G=P.CheckIcon,fe=P.ChevronDownIcon,$t=P.ChevronLeftIcon,ke=P.ChevronRightIcon,ul=P.ChevronUpIcon;var cb=P.ClipboardListIcon,Te=P.ClockIcon,mb=P.Columns3Icon,ub=P.CookieIcon,za=P.CopyIcon,pb=P.CreditCardIcon,lu=P.DollarSignIcon,mo=P.DownloadIcon,du=P.EditIcon;var Cs=P.EyeIcon,gb=P.EyeOffIcon;var Us=P.FileIcon,cu=P.FileSpreadsheetIcon,Pa=P.FileTextIcon;var mu=P.FolderIcon;var uu=P.GridIcon,Ws=P.GripVerticalIcon;var fb=P.HomeIcon,Wr=P.ImageIcon;var bb=P.InboxIcon,ad=P.InfoIcon;var pu=P.LanguagesIcon,xb=P.LayoutDashboardIcon,vb=P.LifeBuoyIcon,tc=P.LinkIcon,ac=P.ListIcon;var Oo=P.Loader2Icon,gu=P.LockIcon;var rc=P.MailIcon,fu=P.MaximizeIcon,bu=P.MegaphoneIcon,xu=P.MenuIcon,pl=P.MessageSquareIcon;var un=P.MinusIcon,Qc=P.MonitorIcon,Xc=P.MoonIcon,lg=P.MoreHorizontalIcon,hb=P.MousePointerClickIcon;var yb=P.PackageCheckIcon,pn=P.PackageIcon;var gl=P.PencilIcon,vu=P.PinIcon;var Re=P.PlusIcon,_s=P.PrinterIcon,Nb=P.QrCodeIcon,hu=P.RadioTowerIcon,zr=P.RefreshCwIcon,Cb=P.RotateCcwIcon;var te=P.SearchIcon,yu=P.SearchXIcon,qs=P.SendIcon,kb=P.ServerCrashIcon;var Ai=P.SettingsIcon,wb=P.ShieldAlertIcon;var rd=P.SmartphoneIcon;var oc=P.StarIcon,Yc=P.SunIcon,Nu=P.TableIcon,nc=P.TagIcon,Le=P.Trash2Icon,od=P.TrashIcon,rs=P.TrendingDownIcon,os=P.TrendingUpIcon;var Cu=P.TrophyIcon,ku=P.TruckIcon;var Gs=P.UploadIcon;var Ei=P.UserIcon,fl=P.UsersIcon,Pb=P.WifiOffIcon,wu=P.WrenchIcon,ns=P.XCircleIcon,ee=P.XIcon,Tb=P.ActivityIcon,Rb=P.AwardIcon,Pu=P.BanknoteIcon;var Jc=P.CalculatorIcon,Tu=P.CameraIcon,Bn=P.CircleIcon;var Ru=P.ExternalLinkIcon;var Sb=P.FilePlusIcon,Ib=P.FlagIcon,Db=P.FolderOpenIcon;var nd=P.LayoutGridIcon;var Mb=P.Link2Icon;var ss=P.MapPinIcon;var Bb=P.MedalIcon,Lb=P.MoreVerticalIcon,bl=P.PaperclipIcon,Su=P.PauseIcon;var Iu=P.PlayIcon,gn=P.ReceiptIcon;var xl=P.SaveIcon;var Zc=P.SignatureIcon;var Du=P.TargetIcon,zb=P.WalletIcon,Mu=P.ZapIcon,Ab=P.CarIcon,Eb=P.GlobeIcon,Fb=P.LayersIcon,Bu=P.BrainIcon;var sd=P.CodeIcon,$b=P.MicIcon,Lu=P.SparklesIcon;var Hb=P.ThumbsDownIcon,Vb=P.ThumbsUpIcon;var sc=P.BoldIcon,ic=P.ItalicIcon,zu=P.ListOrderedIcon,Au=P.QuoteIcon,lc=P.UndoIcon,dc=P.RedoIcon,Eu=P.Heading1Icon,Fu=P.Heading2Icon,Ob=P.StrikethroughIcon,Ub=P.ZoomInIcon,Wb=P.ZoomOutIcon,_b=P.PipetteIcon;var bD=require("react"),dg=require("react-i18next"),js=require("@base-ui/react/dialog");var pD=require("react"),qb=require("@base-ui/react/button"),Gb=require("class-variance-authority");var vl=require("react/jsx-runtime"),Fi=(0,Gb.cva)("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(0,vl.jsx)(qb.Button,{"data-slot":"button",className:l(Fi({variant:t,size:a,className:e})),...i,children:c?(0,vl.jsxs)(vl.Fragment,{children:[r!=null&&(0,vl.jsx)("span",{"data-icon":"inline-start",className:"shrink-0",children:r}),n,o!=null&&(0,vl.jsx)("span",{"data-icon":"inline-end",className:"shrink-0",children:o})]}):n})}var Ar=require("react/jsx-runtime");function Ye({...e}){return(0,Ar.jsx)(js.Dialog.Root,{"data-slot":"dialog",...e})}function em({...e}){return(0,Ar.jsx)(js.Dialog.Trigger,{"data-slot":"dialog-trigger",...e})}function jb({...e}){return(0,Ar.jsx)(js.Dialog.Portal,{"data-slot":"dialog-portal",...e})}function Kb({className:e,...t}){return(0,Ar.jsx)(js.Dialog.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 Je({className:e,children:t,showCloseButton:a=!0,...r}){let{t:o}=(0,dg.useTranslation)("ui");return(0,Ar.jsxs)(jb,{children:[(0,Ar.jsx)(Kb,{}),(0,Ar.jsxs)(js.Dialog.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&&(0,Ar.jsxs)(js.Dialog.Close,{"data-slot":"dialog-close",render:(0,Ar.jsx)(C,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[(0,Ar.jsx)(ee,{}),(0,Ar.jsx)("span",{className:"sr-only",children:o("dialog.close")})]})]})]})}function nt({className:e,...t}){return(0,Ar.jsx)("div",{"data-slot":"dialog-header",className:l("flex flex-col gap-2",e),...t})}function bt({className:e,showCloseButton:t=!1,children:a,...r}){let{t:o}=(0,dg.useTranslation)("ui");return(0,Ar.jsxs)("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&&(0,Ar.jsx)(js.Dialog.Close,{render:(0,Ar.jsx)(C,{variant:"outline"}),children:o("dialog.closeButton")})]})}function Ze({className:e,...t}){return(0,Ar.jsx)(js.Dialog.Title,{"data-slot":"dialog-title",className:l("font-heading text-base leading-none font-medium",e),...t})}function Dt({className:e,...t}){return(0,Ar.jsx)(js.Dialog.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 tm({className:e,...t}){return(0,Ar.jsx)("div",{"data-slot":"dialog-body",className:l("flex flex-col gap-3 py-4",e),...t})}var ND=require("react"),$u=require("@base-ui/react/avatar");var Hu=require("react/jsx-runtime");function Uo({className:e,size:t="default",fontSize:a,...r}){return(0,Hu.jsx)($u.Avatar.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 is({className:e,...t}){return(0,Hu.jsx)($u.Avatar.Image,{"data-slot":"avatar-image",className:l("aspect-square size-full rounded-full object-cover",e),...t})}function Wo({className:e,...t}){return(0,Hu.jsx)($u.Avatar.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})}var Qb=require("@base-ui/react/merge-props"),Xb=require("@base-ui/react/use-render"),Yb=require("class-variance-authority");var Jb=(0,Yb.cva)("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 L({className:e,variant:t="default",render:a,...r}){return(0,Xb.useRender)({defaultTagName:"span",props:(0,Qb.mergeProps)({className:l(Jb({variant:t}),e)},r),render:a,state:{slot:"badge",variant:t}})}var TD=require("react"),Zb=require("react-i18next"),ex=require("@base-ui/react/merge-props"),tx=require("@base-ui/react/use-render");var hl=require("react/jsx-runtime");function cg({className:e,...t}){let{t:a}=(0,Zb.useTranslation)("ui");return(0,hl.jsx)("nav",{"aria-label":a("breadcrumb.navLabel"),"data-slot":"breadcrumb",className:l(e),...t})}function mg({className:e,...t}){return(0,hl.jsx)("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 ug({className:e,...t}){return(0,hl.jsx)("li",{"data-slot":"breadcrumb-item",className:l("inline-flex items-center gap-1",e),...t})}function pg({className:e,render:t,...a}){return(0,tx.useRender)({defaultTagName:"a",props:(0,ex.mergeProps)({className:l("cursor-pointer transition-colors hover:text-foreground",e)},a),render:t,state:{slot:"breadcrumb-link"}})}function gg({className:e,...t}){return(0,hl.jsx)("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l("text-foreground font-normal",e),...t})}function fg({children:e,className:t,...a}){return(0,hl.jsx)("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:l("[&>svg]:size-3.5",t),...a,children:e??(0,hl.jsx)(ke,{})})}var DD=require("react"),ax=require("@base-ui/react/input");var rx=require("react/jsx-runtime");function T({className:e,type:t,...a}){return(0,rx.jsx)(ax.Input,{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})}var Vu=M(require("react"),1),am=require("react-day-picker");var Ks=require("react/jsx-runtime");function bg({className:e,classNames:t,showOutsideDays:a=!0,captionLayout:r="label",buttonVariant:o="ghost",locale:n,formatters:i,components:c,...s}){let d=(0,am.getDefaultClassNames)();return(0,Ks.jsx)(am.DayPicker,{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(Fi({variant:o}),"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",d.button_previous),button_next:l(Fi({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})=>(0,Ks.jsx)("div",{"data-slot":"calendar",ref:u,className:l(m),...p}),Chevron:({className:m,orientation:u,...p})=>u==="left"?(0,Ks.jsx)($t,{className:l("size-4",m),...p}):u==="right"?(0,Ks.jsx)(ke,{className:l("size-4",m),...p}):(0,Ks.jsx)(fe,{className:l("size-4",m),...p}),DayButton:({...m})=>(0,Ks.jsx)(ox,{...n!==void 0?{locale:n}:{},...m}),WeekNumber:({children:m,...u})=>(0,Ks.jsx)("td",{...u,children:(0,Ks.jsx)("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:m})}),...c},...s})}function ox({className:e,day:t,modifiers:a,locale:r,...o}){let n=(0,am.getDefaultClassNames)(),i=Vu.useRef(null);return Vu.useEffect(()=>{a.focused&&i.current?.focus()},[a.focused]),(0,Ks.jsx)(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})}var FD=require("react");var $i=require("react/jsx-runtime");function re({className:e,size:t="default",flush:a,...r}){return(0,$i.jsx)("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 he({className:e,...t}){return(0,$i.jsx)("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 ve({className:e,size:t,...a}){return(0,$i.jsx)("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 uo({className:e,...t}){return(0,$i.jsx)("div",{"data-slot":"card-description",className:l("text-muted-foreground text-sm",e),...t})}function xg({className:e,...t}){return(0,$i.jsx)("div",{"data-slot":"card-action",className:l("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function oe({className:e,flush:t,...a}){return(0,$i.jsx)("div",{"data-slot":"card-content",className:l(t?"":"px-(--card-spacing)","group-data-[flush]/card:px-0",e),...a})}function Ln({className:e,...t}){return(0,$i.jsx)("div",{"data-slot":"card-footer",className:l("bg-muted/50 flex items-center rounded-b-xl border-t p-(--card-spacing)",e),...t})}var vg=require("@base-ui/react/checkbox");var Ou=require("react/jsx-runtime");function po({className:e,...t}){return(0,Ou.jsx)(vg.Checkbox.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:(0,Ou.jsx)(vg.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:(0,Ou.jsx)(G,{})})})}var hg=require("@base-ui/react/collapsible"),Cg=require("react/jsx-runtime");function yg({...e}){return(0,Cg.jsx)(hg.Collapsible.Root,{"data-slot":"collapsible",...e})}function Ng({...e}){return(0,Cg.jsx)(hg.Collapsible.Panel,{"data-slot":"collapsible-content",...e})}var _D=require("react"),cc=require("@base-ui/react/popover");var mc=require("react/jsx-runtime");function st({...e}){return(0,mc.jsx)(cc.Popover.Root,{"data-slot":"popover",...e})}function it({...e}){return(0,mc.jsx)(cc.Popover.Trigger,{"data-slot":"popover-trigger",...e})}function lt({className:e,align:t="center",alignOffset:a=0,side:r="bottom",sideOffset:o=4,...n}){return(0,mc.jsx)(cc.Popover.Portal,{children:(0,mc.jsx)(cc.Popover.Positioner,{align:t,alignOffset:a,side:r,sideOffset:o,className:"isolate z-50",children:(0,mc.jsx)(cc.Popover.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})})})}var jD=require("react");var nx=require("react/jsx-runtime");function Ta({className:e,...t}){return(0,nx.jsx)("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})}var uc=require("@base-ui/react/scroll-area");var yl=require("react/jsx-runtime");function Qa({className:e,children:t,...a}){return(0,yl.jsxs)(uc.ScrollArea.Root,{"data-slot":"scroll-area",className:l("relative",e),...a,children:[(0,yl.jsx)(uc.ScrollArea.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}),(0,yl.jsx)(sx,{}),(0,yl.jsx)(uc.ScrollArea.Corner,{})]})}function sx({className:e,orientation:t="vertical",...a}){return(0,yl.jsx)(uc.ScrollArea.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:(0,yl.jsx)(uc.ScrollArea.Thumb,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}var JD=require("react"),ix=require("class-variance-authority");var dx=require("react/jsx-runtime"),lx=(0,ix.cva)("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 kg({className:e,size:t,variant:a,pulse:r,...o}){return(0,dx.jsx)("span",{"data-slot":"dot",className:l(lx({size:t,variant:a,pulse:r}),e),...o})}var tM=require("react"),Nl=require("vaul");var zn=require("react/jsx-runtime");function wg({...e}){return(0,zn.jsx)(Nl.Drawer.Root,{"data-slot":"drawer",...e})}function cx({...e}){return(0,zn.jsx)(Nl.Drawer.Portal,{"data-slot":"drawer-portal",...e})}function Pg({...e}){return(0,zn.jsx)(Nl.Drawer.Close,{"data-slot":"drawer-close",...e})}function mx({className:e,...t}){return(0,zn.jsx)(Nl.Drawer.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 Tg({className:e,children:t,...a}){return(0,zn.jsxs)(cx,{"data-slot":"drawer-portal",children:[(0,zn.jsx)(mx,{}),(0,zn.jsxs)(Nl.Drawer.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:[(0,zn.jsx)("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 Rg({className:e,...t}){return(0,zn.jsx)("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 Sg({className:e,...t}){return(0,zn.jsx)(Nl.Drawer.Title,{"data-slot":"drawer-title",className:l("font-heading text-foreground text-base font-medium",e),...t})}function Ig({className:e,...t}){return(0,zn.jsx)(Nl.Drawer.Description,{"data-slot":"drawer-description",className:l("text-muted-foreground text-sm",e),...t})}var oM=require("react"),Qs=require("@base-ui/react/menu");var ks=require("react/jsx-runtime");function Co({...e}){return(0,ks.jsx)(Qs.Menu.Root,{"data-slot":"dropdown-menu",...e})}function ko({...e}){return(0,ks.jsx)(Qs.Menu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function wo({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:r=4,className:o,...n}){return(0,ks.jsx)(Qs.Menu.Portal,{children:(0,ks.jsx)(Qs.Menu.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:r,children:(0,ks.jsx)(Qs.Menu.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 Xs({...e}){return(0,ks.jsx)(Qs.Menu.Group,{"data-slot":"dropdown-menu-group",...e})}function Cl({className:e,inset:t,...a}){return(0,ks.jsx)(Qs.Menu.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 Er({className:e,inset:t,variant:a="default",...r}){return(0,ks.jsx)(Qs.Menu.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 Ys({className:e,...t}){return(0,ks.jsx)(Qs.Menu.Separator,{"data-slot":"dropdown-menu-separator",className:l("bg-border -mx-1 my-1 h-px",e),...t})}var ux=require("react-dropzone");var Hi=require("react/jsx-runtime");function rm({onDrop:e,accept:t,maxFiles:a=5,maxSize:r,disabled:o,className:n}){let{getRootProps:i,getInputProps:c,isDragActive:s}=(0,ux.useDropzone)({...e!==void 0?{onDrop:e}:{},...t!==void 0?{accept:t}:{},maxFiles:a,...r!==void 0?{maxSize:r}:{},...o!==void 0?{disabled:o}:{}});return(0,Hi.jsxs)("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:[(0,Hi.jsx)("input",{...c()}),(0,Hi.jsx)(Gs,{className:l("mb-2 size-8",s?"text-primary":"text-muted-foreground")}),s?(0,Hi.jsx)("p",{className:"text-primary text-sm font-medium",children:"Drop files here..."}):(0,Hi.jsxs)("div",{className:"space-y-1",children:[(0,Hi.jsx)("p",{className:"text-sm font-medium",children:"Drag & drop files here, or click to select"}),(0,Hi.jsxs)("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)`]})]})]})}var kl=M(require("react"),1),gx=require("@radix-ui/react-slot"),pc=require("react-hook-form");var cM=require("react");var px=require("react/jsx-runtime");function we({className:e,...t}){return(0,px.jsx)("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})}var Js=require("react/jsx-runtime"),fx=pc.FormProvider,bx=kl.createContext({});function xx({...e}){return(0,Js.jsx)(bx.Provider,{value:{name:e.name},children:(0,Js.jsx)(pc.Controller,{...e})})}var vx=kl.createContext({});function Dg(){let e=kl.useContext(bx),t=kl.useContext(vx),{getFieldState:a,formState:r}=(0,pc.useFormContext)(),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 hx({className:e,...t}){let a=kl.useId();return(0,Js.jsx)(vx.Provider,{value:{id:a},children:(0,Js.jsx)("div",{"data-slot":"form-item",className:l("group/form-item space-y-1.5",e),...t})})}function yx({className:e,required:t,...a}){let{error:r,formItemId:o}=Dg();return(0,Js.jsxs)(we,{"data-slot":"form-label","data-error":!!r,className:l(r&&"text-destructive",e),htmlFor:o,...a,children:[a.children,t&&(0,Js.jsx)("span",{className:"text-destructive",children:"*"})]})}function Nx({...e}){let{error:t,formItemId:a,formDescriptionId:r,formMessageId:o}=Dg();return(0,Js.jsx)(gx.Slot,{"data-slot":"form-control",id:a,"aria-describedby":t?`${r} ${o}`:r,"aria-invalid":!!t,...e})}function Cx({className:e,...t}){let{error:a,formMessageId:r}=Dg(),o=a?String(a?.message??""):t.children;return o?(0,Js.jsx)("p",{"data-slot":"form-message",id:r,className:l("text-destructive text-xs font-medium",e),...t,children:o}):null}var Mg=require("@base-ui/react/switch");var Bg=require("react/jsx-runtime");function ws({className:e,size:t="default",...a}){return(0,Bg.jsx)(Mg.Switch.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:(0,Bg.jsx)(Mg.Switch.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"})})}var vM=require("react"),fn=require("@base-ui/react/select");var vr=require("react/jsx-runtime"),Ge=fn.Select.Root;function je({className:e,...t}){return(0,vr.jsx)(fn.Select.Value,{"data-slot":"select-value",className:l("flex flex-1 text-left",e),...t})}function Ke({className:e,size:t="default",children:a,...r}){return(0,vr.jsxs)(fn.Select.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,(0,vr.jsx)(fn.Select.Icon,{render:(0,vr.jsx)(fe,{className:"text-muted-foreground pointer-events-none size-4"})})]})}function Qe({className:e,children:t,side:a="bottom",sideOffset:r=4,align:o="center",alignOffset:n=0,alignItemWithTrigger:i=!0,...c}){return(0,vr.jsx)(fn.Select.Portal,{children:(0,vr.jsx)(fn.Select.Positioner,{side:a,sideOffset:r,align:o,alignOffset:n,alignItemWithTrigger:i,className:"isolate z-50",children:(0,vr.jsxs)(fn.Select.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:[(0,vr.jsx)(kx,{}),(0,vr.jsx)(fn.Select.List,{children:t}),(0,vr.jsx)(wx,{})]})})})}function De({className:e,children:t,...a}){return(0,vr.jsxs)(fn.Select.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:[(0,vr.jsx)(fn.Select.ItemText,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),(0,vr.jsx)(fn.Select.ItemIndicator,{render:(0,vr.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:(0,vr.jsx)(G,{className:"pointer-events-none"})})]})}function kx({className:e,...t}){return(0,vr.jsx)(fn.Select.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:(0,vr.jsx)(ul,{})})}function wx({className:e,...t}){return(0,vr.jsx)(fn.Select.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:(0,vr.jsx)(fe,{})})}var CM=require("react"),Px=require("class-variance-authority");var Lg=require("react/jsx-runtime"),Tx=(0,Px.cva)("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 wl({className:e,size:t,...a}){return(0,Lg.jsx)("kbd",{"data-slot":"kbd",className:l(Tx({size:t}),e),...a})}function Uu({className:e,...t}){return(0,Lg.jsx)("div",{"data-slot":"kbd-group",className:l("inline-flex items-center gap-1",e),...t})}var PM=require("react");var Rx=require("class-variance-authority"),Vi=require("react/jsx-runtime"),Sx=(0,Rx.cva)("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 zg({className:e,size:t,padding:a,center:r,children:o,...n}){return(0,Vi.jsx)("div",{"data-slot":"page-container",className:l(Sx({size:t,padding:a,center:r,className:e})),...n,children:o})}function Ag({className:e,title:t,description:a,actions:r,breadcrumb:o,...n}){return(0,Vi.jsxs)("div",{"data-slot":"page-header",className:l("space-y-2",e),...n,children:[o,(0,Vi.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Vi.jsxs)("div",{className:"space-y-1",children:[(0,Vi.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:t}),a&&(0,Vi.jsx)("p",{className:"text-muted-foreground",children:a})]}),r&&(0,Vi.jsx)("div",{className:"flex items-center gap-2",children:r})]})]})}var Wu=require("@base-ui/react/progress");var id=require("react/jsx-runtime");function Po({className:e,children:t,value:a,...r}){return(0,id.jsxs)(Wu.Progress.Root,{value:a,"data-slot":"progress",className:l("flex flex-wrap gap-3",e),...r,children:[t,(0,id.jsx)(Ix,{children:(0,id.jsx)(gc,{})})]})}function Ix({className:e,...t}){return(0,id.jsx)(Wu.Progress.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 gc({className:e,...t}){return(0,id.jsx)(Wu.Progress.Indicator,{"data-slot":"progress-indicator",className:l("bg-primary h-full transition-all",e),...t})}var Eg=require("@base-ui/react/radio"),Dx=require("@base-ui/react/radio-group");var om=require("react/jsx-runtime");function Mx({className:e,...t}){return(0,om.jsx)(Dx.RadioGroup,{"data-slot":"radio-group",className:l("grid w-full gap-2",e),...t})}function Fg({className:e,...t}){return(0,om.jsx)(Eg.Radio.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:(0,om.jsx)(Eg.Radio.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:(0,om.jsx)("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}var Bx=require("@base-ui/react/separator");var Lx=require("react/jsx-runtime");function dt({className:e,orientation:t="horizontal",...a}){return(0,Lx.jsx)(Bx.Separator,{"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})}var zM=require("react"),Zs=require("@base-ui/react/dialog");var Qr=require("react/jsx-runtime");function ld({...e}){return(0,Qr.jsx)(Zs.Dialog.Root,{"data-slot":"sheet",...e})}function $g({...e}){return(0,Qr.jsx)(Zs.Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function Hg({...e}){return(0,Qr.jsx)(Zs.Dialog.Close,{"data-slot":"sheet-close",...e})}function PC({...e}){return(0,Qr.jsx)(Zs.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function TC({className:e,...t}){return(0,Qr.jsx)(Zs.Dialog.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 dd({className:e,children:t,side:a="right",showCloseButton:r=!0,...o}){return(0,Qr.jsxs)(PC,{children:[(0,Qr.jsx)(TC,{}),(0,Qr.jsxs)(Zs.Dialog.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&&(0,Qr.jsxs)(Zs.Dialog.Close,{"data-slot":"sheet-close",render:(0,Qr.jsx)(C,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,Qr.jsx)(ee,{}),(0,Qr.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function cd({className:e,...t}){return(0,Qr.jsx)("div",{"data-slot":"sheet-header",className:l("flex flex-col gap-0.5 p-4",e),...t})}function Vg({className:e,...t}){return(0,Qr.jsx)("div",{"data-slot":"sheet-footer",className:l("mt-auto flex flex-col gap-2 p-4",e),...t})}function md({className:e,...t}){return(0,Qr.jsx)(Zs.Dialog.Title,{"data-slot":"sheet-title",className:l("font-heading text-foreground text-base font-medium",e),...t})}function nm({className:e,...t}){return(0,Qr.jsx)(Zs.Dialog.Description,{"data-slot":"sheet-description",className:l("text-muted-foreground text-sm",e),...t})}var zx=require("react/jsx-runtime");function la({className:e,...t}){return(0,zx.jsx)("div",{"data-slot":"skeleton",className:l("bg-muted animate-pulse rounded-md",e),...t})}var fc=M(require("react"),1);var _r=require("react/jsx-runtime");function sm({className:e,activeStep:t=0,orientation:a="horizontal",children:r}){let o=fc.Children.toArray(r).filter(fc.isValidElement);return(0,_r.jsx)("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 fc.cloneElement(n,{index:i,active:i===t,completed:i<t,last:c,orientation:a})})})}function Pl({className:e,index:t=0,active:a,completed:r,last:o,orientation:n,children:i}){return(0,_r.jsx)("div",{className:l("flex items-center",n==="horizontal"?o?"shrink-0":"min-w-0 flex-1":"flex-col items-start",e),children:n==="horizontal"?(0,_r.jsxs)(_r.Fragment,{children:[(0,_r.jsxs)("div",{className:"flex shrink-0 flex-col items-center gap-1",children:[(0,_r.jsx)("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?(0,_r.jsx)(G,{className:"size-4"}):t+1}),i&&(0,_r.jsx)("span",{className:l("text-xs font-medium whitespace-nowrap",a?"text-primary":"text-muted-foreground"),children:i})]}),!o&&(0,_r.jsx)("div",{className:l("mx-2 mt-4 h-0.5 min-w-4 flex-1 self-start",r?"bg-primary":"bg-muted-foreground/30")})]}):(0,_r.jsxs)(_r.Fragment,{children:[(0,_r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_r.jsx)("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?(0,_r.jsx)(G,{className:"size-4"}):t+1}),i&&(0,_r.jsx)("span",{className:l("text-xs font-medium whitespace-nowrap",a?"text-primary":"text-muted-foreground"),children:i})]}),!o&&(0,_r.jsx)("div",{className:l("ml-3.5 h-8 w-0.5",r?"bg-primary":"bg-muted-foreground/30")})]})})}var _M=require("react");var ei=require("react/jsx-runtime");function at({className:e,...t}){return(0,ei.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,ei.jsx)("table",{"data-slot":"table",className:l("w-full caption-bottom text-sm",e),...t})})}function rt({className:e,...t}){return(0,ei.jsx)("thead",{"data-slot":"table-header",className:l("[&_tr]:border-b",e),...t})}function Oe({className:e,...t}){return(0,ei.jsx)("tbody",{"data-slot":"table-body",className:l("[&_tr:last-child]:border-0",e),...t})}function Oi({className:e,...t}){return(0,ei.jsx)("tfoot",{"data-slot":"table-footer",className:l("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function K({className:e,...t}){return(0,ei.jsx)("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 F({className:e,...t}){return(0,ei.jsx)("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(0,ei.jsx)("td",{"data-slot":"table-cell",className:l("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function Og({className:e,...t}){return(0,ei.jsx)("caption",{"data-slot":"table-caption",className:l("text-muted-foreground mt-4 text-sm",e),...t})}var im=require("@base-ui/react/tabs"),Ax=require("class-variance-authority");var lm=require("react/jsx-runtime");function _o({className:e,orientation:t="horizontal",...a}){return(0,lm.jsx)(im.Tabs.Root,{"data-slot":"tabs","data-orientation":t,className:l("group/tabs flex gap-2 data-horizontal:flex-col",e),...a})}var Ex=(0,Ax.cva)("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 qo({className:e,variant:t="default",...a}){return(0,lm.jsx)(im.Tabs.List,{"data-slot":"tabs-list","data-variant":t,className:l(Ex({variant:t}),e),...a})}function Xr({className:e,...t}){return(0,lm.jsx)(im.Tabs.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 An({className:e,...t}){return(0,lm.jsx)(im.Tabs.Panel,{"data-slot":"tabs-content",className:l("flex-1 text-sm outline-none",e),...t})}var QM=require("react"),Fx=require("class-variance-authority");var Yr=require("react/jsx-runtime");function ud({className:e,...t}){return(0,Yr.jsx)("div",{"data-slot":"timeline",className:l("flex flex-col",e),...t})}var $x=(0,Fx.cva)("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 pd({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(0,Yr.jsxs)("div",{className:l("relative flex gap-4",e),...s,children:[(0,Yr.jsxs)("div",{className:"flex flex-col items-center self-stretch",children:[(0,Yr.jsx)(bc,{variant:d,children:t?(0,Yr.jsx)(t,{className:"size-4"}):null}),(0,Yr.jsx)(xc,{})]}),(0,Yr.jsxs)(vc,{className:"pb-8 last:pb-0",children:[a!==void 0?(0,Yr.jsx)(Hx,{children:a}):null,r!==void 0?(0,Yr.jsx)(Vx,{children:r}):null,o!==void 0?(0,Yr.jsx)(Ox,{children:o}):null,c]})]})}function bc({className:e,variant:t,children:a,...r}){return(0,Yr.jsx)("div",{className:l($x({variant:t}),e),...r,children:a})}function xc({className:e,...t}){return(0,Yr.jsx)("div",{className:l("bg-border mx-auto w-px flex-1",e),...t})}function vc({className:e,...t}){return(0,Yr.jsx)("div",{className:l("flex-1 pt-1",e),...t})}function Hx({className:e,...t}){return(0,Yr.jsx)("h3",{className:l("text-sm leading-none font-semibold",e),...t})}function Vx({className:e,...t}){return(0,Yr.jsx)("p",{className:l("text-muted-foreground mt-1 text-sm",e),...t})}function Ox({className:e,...t}){return(0,Yr.jsx)("time",{className:l("text-muted-foreground mt-1 text-xs",e),...t})}var RC=require("@base-ui/react/toggle"),Ux=require("class-variance-authority");var SC=require("react/jsx-runtime"),Wx=(0,Ux.cva)("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"}});var qu=M(require("react"),1),_x=require("@base-ui/react/toggle"),qx=require("@base-ui/react/toggle-group"),ZM=require("class-variance-authority");var _u=require("react/jsx-runtime"),Gx=qu.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function jx({className:e,variant:t,size:a,spacing:r=2,orientation:o="horizontal",children:n,...i}){return(0,_u.jsx)(qx.ToggleGroup,{"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:(0,_u.jsx)(Gx.Provider,{value:{variant:t,size:a,spacing:r,orientation:o},children:n})})}function Kx({className:e,children:t,variant:a="default",size:r="default",...o}){let n=qu.useContext(Gx);return(0,_u.jsx)(_x.Toggle,{"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",Wx({variant:n.variant||a,size:n.size||r}),e),...o,children:t})}var r5=require("react");var ti=require("react/jsx-runtime"),Qx={xs:"size-3",sm:"size-4",md:"size-5",lg:"size-7",xl:"size-9"},IC={xs:"border",sm:"border-2",md:"border-2",lg:"border-[3px]",xl:"border-4"},Ug={primary:"text-primary",secondary:"text-secondary-foreground",muted:"text-muted-foreground",destructive:"text-destructive",current:"text-current"};function Xx({className:e,size:t="md",variant:a="circle",color:r="primary",label:o="Loading",...n}){return a==="dots"?(0,ti.jsxs)("span",{role:"status","aria-label":o,"data-slot":"spinner","data-variant":"dots",className:l("inline-flex items-center gap-1",Ug[r],e),...n,children:[[0,1,2].map(i=>(0,ti.jsx)("span",{className:l("animate-bounce rounded-full bg-current",Qx[t]),style:{animationDelay:`${i*150}ms`,animationDuration:"1s"}},i)),(0,ti.jsx)("span",{className:"sr-only",children:o})]}):a==="bars"?(0,ti.jsxs)("span",{role:"status","aria-label":o,"data-slot":"spinner","data-variant":"bars",className:l("inline-flex items-end gap-0.5",Ug[r],e),...n,children:[[0,1,2,3].map(i=>(0,ti.jsx)("span",{className:"animate-pulse bg-current",style:{width:"3px",height:"100%",animationDelay:`${i*100}ms`,animationDuration:"1s"}},i)),(0,ti.jsx)("span",{className:"sr-only",children:o})]}):(0,ti.jsx)("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",Qx[t],IC[t],Ug[r],e),...n,children:(0,ti.jsx)("span",{className:"sr-only",children:o})})}var dm=M(require("react"),1);var Gu=require("lucide-react"),Ui=require("react/jsx-runtime");function Wi({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]=dm.useState(a),[b,g]=dm.useState(""),y=t!==void 0,k=y?t:N;dm.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 E=Math.pow(10,i);return Math.round(I*E)/E}return I},S=I=>{if(I===null||isNaN(I)){y||h(null),u?.(x?void 0:null);return}let E=R(w(I));y||h(E),u?.(E)},A=I=>{let E=I.target.value;if(g(E),E===""){S(null);return}let _=p?p(E):parseFloat(E);isNaN(_)||S(_)},z=I=>{if(s||d)return;let E=Number.isFinite(r)?r:0,_=k??E,X=I==="up"?_+n:_-n;S(X)},U=I=>{s||d||(I.key==="ArrowUp"?(I.preventDefault(),z("up")):I.key==="ArrowDown"&&(I.preventDefault(),z("down")),v.onKeyDown?.(I))},B=I=>{b!==""&&k!==null&&g(f?f(k):String(k)),v.onBlur?.(I)},O=m==="sm"?"h-7 text-sm":m==="lg"?"h-9 text-base":"h-8 text-sm";return(0,Ui.jsxs)("div",{"data-slot":"input-number",className:l("relative inline-flex w-full items-center",s&&"opacity-50",e),children:[(0,Ui.jsx)("input",{type:"text",inputMode:"decimal",disabled:s,readOnly:d,value:b,onChange:A,onKeyDown:U,onBlur:B,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",O,c&&"pr-7"),...v}),c&&!d&&(0,Ui.jsxs)("div",{className:"absolute right-0 top-0 flex h-full flex-col",children:[(0,Ui.jsx)("button",{type:"button",tabIndex:-1,disabled:s||k!==null&&k>=o,onClick:()=>z("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:(0,Ui.jsx)(Gu.ChevronUp,{className:"size-3"})}),(0,Ui.jsx)("button",{type:"button",tabIndex:-1,disabled:s||k!==null&&k<=r,onClick:()=>z("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:(0,Ui.jsx)(Gu.ChevronDown,{className:"size-3"})})]})]})}var Wg=M(require("react"),1);var hc=require("react/jsx-runtime"),DC={sm:"size-3.5",default:"size-5",lg:"size-7"};function MC({value:e,defaultValue:t,onChange:a,max:r=5,size:o="default",readonly:n,allowHalf:i,className:c,iconClassName:s,...d}){let[m,u]=Wg.useState(t??0),p=e!==void 0,f=p?e:m,[x,v]=Wg.useState(null),N=x??f,h=b=>{n||(p||u(b),a?.(b))};return(0,hc.jsx)("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(0,hc.jsxs)("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&&(0,hc.jsx)("span",{className:"absolute inset-y-0 left-0 w-1/2",onClick:R=>{R.stopPropagation(),h(y-.5)}}),(0,hc.jsx)(oc,{className:l(DC[o],"transition-colors",k||w?"fill-yellow-400 text-yellow-400":"text-muted-foreground/40 fill-transparent",s)})]},g)})})}var m5=require("react"),Jx=require("react-i18next");var Tl=require("react/jsx-runtime"),_g={default:{icon:bb},search:{icon:te},error:{icon:ir},network:{icon:Pb}},Yx={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 gd({variant:e="default",icon:t,title:a,description:r,action:o,className:n,centered:i,fullPage:c,texts:s}){let d=!s,{t:m}=(0,Jx.useTranslation)("data"),u=_g[e]??_g.default,p=t??u.icon,f=Yx[e]??Yx.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(0,Tl.jsxs)("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:[(0,Tl.jsx)("div",{className:"bg-muted flex size-12 items-center justify-center rounded-full",children:(0,Tl.jsx)(p,{className:"text-muted-foreground size-6"})}),(0,Tl.jsx)("h3",{className:"mt-4 text-lg font-semibold",children:x}),(0,Tl.jsx)("p",{className:"text-muted-foreground mt-1 max-w-sm text-sm",children:v}),o&&(0,Tl.jsx)("div",{className:"mt-4",children:o})]})}var f5=require("react");var ju=require("react/jsx-runtime"),BC={sm:"h-7 px-2 text-xs",default:"h-8 px-3 text-sm",lg:"h-9 px-4 text-sm"};function cm({options:e,value:t,defaultValue:a,onChange:r,size:o="default",disabled:n,className:i,orientation:c="horizontal"}){return(0,ju.jsx)(jx,{"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=>(0,ju.jsxs)(Kx,{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",BC[o]),children:[s.icon,s.label]},s.value))})}var Rl=M(require("react"),1);var Zx=require("react-i18next");var Aa=require("react/jsx-runtime");function LC({steps:e,open:t,onOpenChange:a,onComplete:r,onSkip:o,storageKey:n,className:i}){let{t:c}=(0,Zx.useTranslation)("tour"),[s,d]=Rl.useState(()=>{if(typeof window>"u"||!n)return!0;try{return localStorage.getItem(n)!=="1"}catch{return!0}}),[m,u]=Rl.useState(0),[p,f]=Rl.useState(null),x=t??s,v=Rl.useCallback(w=>{t===void 0&&d(w),a?.(w)},[t,a]);Rl.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 A=new ResizeObserver(S);return A.observe(R),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{A.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(0,Aa.jsxs)(Aa.Fragment,{children:[(0,Aa.jsx)("div",{"aria-hidden":!0,className:"fixed inset-0 z-[9998] bg-black/40 transition-opacity",onClick:()=>N(!0)}),(0,Aa.jsx)("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}}),(0,Aa.jsxs)(re,{"data-slot":"tour",className:l("shadow-xl",i),style:k,children:[(0,Aa.jsx)(he,{className:"pb-2",children:(0,Aa.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Aa.jsxs)("div",{children:[(0,Aa.jsxs)(uo,{children:[m+1," / ",e.length]}),(0,Aa.jsx)(ve,{className:"text-base",children:h.title})]}),(0,Aa.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>N(!0),"aria-label":c("tour.close"),children:(0,Aa.jsx)(ee,{})})]})}),h.description&&(0,Aa.jsx)(oe,{className:"text-muted-foreground text-sm",children:h.description}),(0,Aa.jsxs)(Ln,{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,Aa.jsx)(C,{variant:"ghost",size:"sm",onClick:()=>N(!0),children:c("tour.skip")}),(0,Aa.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-1",children:[(0,Aa.jsxs)(C,{variant:"outline",size:"sm",disabled:m===0,onClick:()=>u(w=>Math.max(0,w-1)),children:[(0,Aa.jsx)($t,{}),c("tour.previous")]}),m<e.length-1?(0,Aa.jsxs)(C,{size:"sm",onClick:()=>u(w=>w+1),children:[c("tour.next"),(0,Aa.jsx)(ke,{})]}):(0,Aa.jsx)(C,{size:"sm",onClick:()=>N(!1),children:c("tour.complete")})]})]})]})]})}var Ku=M(require("react"),1),ev=require("react-i18next");var _i=require("react/jsx-runtime");function zC({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}=(0,ev.useTranslation)("data"),u=e??m("watermark.default"),[p,f]=Ku.useState([]),[x,v]=r;return Ku.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?(0,_i.jsx)("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)=>(0,_i.jsx)("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?(0,_i.jsx)("img",{src:t,alt:"",style:{opacity:s,maxHeight:"60%"}}):(0,_i.jsx)("span",{className:"font-medium whitespace-nowrap select-none",style:{color:d,fontSize:o,opacity:s},children:u})},h))}):(0,_i.jsx)("div",{"data-slot":"watermark","aria-hidden":!0,className:l("pointer-events-none absolute inset-0 overflow-hidden",n),style:{zIndex:c},children:(0,_i.jsx)("div",{className:"absolute inset-0 grid place-items-center",style:{transform:`rotate(${a}deg)`},children:t?(0,_i.jsx)("img",{src:t,alt:"",style:{opacity:s,maxWidth:"60%"}}):(0,_i.jsx)("span",{className:"font-medium whitespace-nowrap select-none",style:{color:d,fontSize:o,opacity:s},children:u})})})}var ai=M(require("react"),1);var tv=require("react-i18next");var Ra=require("react/jsx-runtime");function AC({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}=(0,tv.useTranslation)("ui"),[f,x]=ai.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(0,Ra.jsxs)(st,{open:f,onOpenChange:x,"data-slot":"combobox",children:[(0,Ra.jsxs)(it,{render:(0,Ra.jsx)(C,{variant:"outline",role:"combobox",disabled:i,"aria-expanded":f,className:l("w-[200px] justify-between font-normal",!b&&"text-muted-foreground",c)}),children:[(0,Ra.jsx)("span",{className:"truncate",children:b?.label??v}),(0,Ra.jsxs)("div",{className:"flex items-center gap-1",children:[d&&b&&(0,Ra.jsx)("span",{role:"button","aria-label":p("combobox.clear"),onClick:g=>{g.stopPropagation(),a?.(void 0)},className:"hover:bg-muted rounded p-0.5",children:(0,Ra.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,Ra.jsx)(fe,{className:"size-4 opacity-50"})]})]}),f&&(0,Ra.jsx)(lt,{align:s,className:"w-[var(--anchor-width)] p-0",children:(0,Ra.jsx)(EC,{options:e,value:t,onChange:a,onClose:()=>x(!1),searchPlaceholder:N,searchable:m,emptyText:h,...u?{renderOption:u}:{}})})]})}function EC({options:e,value:t,onChange:a,onClose:r,searchPlaceholder:o,searchable:n,emptyText:i,renderOption:c}){let[s,d]=ai.useState(""),m=ai.useRef(null);ai.useEffect(()=>{m.current?.focus()},[]);let u=ai.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=ai.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(0,Ra.jsxs)(Ra.Fragment,{children:[n&&(0,Ra.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,Ra.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Ra.jsx)(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"})]}),(0,Ra.jsxs)("div",{className:"max-h-64 overflow-y-auto p-1",children:[p.length===0&&(0,Ra.jsx)("div",{className:"text-muted-foreground px-2 py-6 text-center text-sm",children:i}),p.map(([f,x])=>(0,Ra.jsxs)("div",{children:[f&&(0,Ra.jsx)("div",{className:"text-muted-foreground px-2 py-1 text-xs font-medium",children:f}),x.map(v=>{let N=v.value===t;return(0,Ra.jsxs)(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:[(0,Ra.jsx)("span",{className:"flex-1 truncate",children:c?c(v):v.label}),N&&(0,Ra.jsx)(G,{className:"size-4 shrink-0"})]},v.value)})]},f||"_default"))]})]})}var mm=M(require("react"),1),qg=require("react-i18next");var ls=require("react/jsx-runtime"),FC={"bottom-right":"right-4","bottom-left":"left-4","bottom-center":"left-1/2 -translate-x-1/2"};function $C({icon:e,label:t,position:a="bottom-right",offset:r=4,className:o,...n}){return(0,ls.jsxs)(C,{"data-slot":"fab",size:t?"default":"icon-lg",className:l("fixed bottom-4 z-40 rounded-full shadow-lg",FC[a],o),style:{bottom:`calc(${r} * 0.25rem + 1rem)`},...n,children:[e,t&&(0,ls.jsx)("span",{children:t})]})}function HC({icon:e,actions:t,position:a="bottom-right"}){let{t:r}=(0,qg.useTranslation)("navigation"),[o,n]=mm.useState(!1);return(0,ls.jsxs)("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&&(0,ls.jsx)("div",{className:"flex flex-col-reverse items-end gap-2",children:t.map((i,c)=>(0,ls.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ls.jsx)("span",{className:"bg-foreground/90 text-background rounded-md px-2 py-1 text-xs shadow-md",children:i.label}),(0,ls.jsx)(C,{size:"icon",variant:"secondary",onClick:()=>{i.onClick?.(),n(!1)},className:"rounded-full shadow-md",children:i.icon})]},c))}),(0,ls.jsx)(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 VC({threshold:e=400,target:t,className:a}){let{t:r}=(0,qg.useTranslation)("navigation"),[o,n]=mm.useState(!1);mm.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?(0,ls.jsx)(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:(0,ls.jsx)(ul,{})}):null}var Sl=M(require("react"),1),Gg=require("react-i18next");var qt=require("react/jsx-runtime"),OC=(e,t)=>t.label.toLowerCase().includes(e.toLowerCase());function Qu({dataSource:e,targetKeys:t=[],onChange:a,titles:r,searchable:o=!0,filterOption:n=OC,render:i,disabled:c,className:s,oneWay:d=!1}){let{t:m}=(0,Gg.useTranslation)("transfer"),u=r??[m("transfer.sourceTitle"),m("transfer.targetTitle")],[p,f]=Sl.useState([]),[x,v]=Sl.useState([]),[N,h]=Sl.useState(""),[b,g]=Sl.useState(""),y=Sl.useMemo(()=>e.filter(_=>!t.includes(_.key)),[e,t]),k=Sl.useMemo(()=>e.filter(_=>t.includes(_.key)),[e,t]),w=y.filter(_=>n(N,_)),R=k.filter(_=>n(b,_)),S=()=>{if(c)return;let _=Array.from(new Set([...t,...p]));a?.(_),f([])},A=()=>{if(c)return;let _=t.filter(X=>!x.includes(X));a?.(_),v([])},z=_=>{c||(a?.(Array.from(new Set([...t,_]))),f(X=>X.filter(Fe=>Fe!==_)))},U=_=>{c||d||(a?.(t.filter(X=>X!==_)),v(X=>X.filter(Fe=>Fe!==_)))},B=_=>{f(X=>X.includes(_)?X.filter(Fe=>Fe!==_):[...X,_])},O=_=>{f(_?w.map(X=>X.key):[])},I=_=>{v(X=>X.includes(_)?X.filter(Fe=>Fe!==_):[...X,_])},E=_=>{v(_?R.map(X=>X.key):[])};return(0,qt.jsxs)("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:[(0,qt.jsx)(av,{title:u[0],items:w,selected:p,onToggle:B,onToggleAll:O,searchable:o,searchValue:N,onSearchChange:h,...i?{render:i}:{},...c!==void 0?{disabled:c}:{},onMoveItem:z}),(0,qt.jsxs)("div",{className:"flex flex-row items-center justify-center gap-2 sm:flex-col",children:[(0,qt.jsx)(C,{variant:"outline",size:"icon",onClick:S,disabled:p.length===0||c,"aria-label":m("transfer.moveToTarget"),children:(0,qt.jsx)(ke,{className:"rotate-90 sm:rotate-0"})}),!d&&(0,qt.jsx)(C,{variant:"outline",size:"icon",onClick:A,disabled:x.length===0||c,"aria-label":m("transfer.moveToSource"),children:(0,qt.jsx)($t,{className:"rotate-90 sm:rotate-0"})})]}),(0,qt.jsx)(av,{title:u[1],items:R,selected:x,onToggle:I,onToggleAll:E,searchable:o,searchValue:b,onSearchChange:g,...i?{render:i}:{},...c!==void 0?{disabled:c}:{},...d?{}:{onMoveItem:U}})]})}function av({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}=(0,Gg.useTranslation)("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(0,qt.jsxs)("div",{className:"flex h-72 w-full min-w-0 flex-col rounded-md border",children:[(0,qt.jsxs)("div",{className:"flex items-center justify-between border-b px-3 py-2 text-sm font-medium",children:[(0,qt.jsx)("span",{children:e}),(0,qt.jsxs)("span",{className:"text-muted-foreground text-xs",children:[a.length,"/",t.length]})]}),n&&(0,qt.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,qt.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,qt.jsx)(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"})]}),(0,qt.jsxs)("div",{className:"flex items-center border-b px-3 py-1.5",children:[(0,qt.jsxs)(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&&(0,qt.jsx)(G,{className:"size-3"}),!p&&f&&(0,qt.jsx)("span",{className:"bg-primary-foreground block h-0.5 w-2"})]}),(0,qt.jsx)("span",{className:"text-muted-foreground ml-2 text-xs",children:u("transfer.selectAll")})]}),(0,qt.jsx)("div",{className:"flex-1 overflow-y-auto p-1",children:t.length===0?(0,qt.jsx)("div",{className:"text-muted-foreground px-2 py-6 text-center text-sm",children:u("transfer.noData")}):t.map(v=>(0,qt.jsxs)("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:[(0,qt.jsx)(po,{checked:a.includes(v.key),onCheckedChange:()=>r(v.key),disabled:v.disabled||d}),(0,qt.jsx)("div",{className:"min-w-0 flex-1 truncate",children:s?s(v):(0,qt.jsxs)(qt.Fragment,{children:[(0,qt.jsx)("div",{className:"truncate",children:v.label}),v.description&&(0,qt.jsx)("div",{className:"text-muted-foreground truncate text-xs",children:v.description})]})})]},v.key))})]})}var jg=M(require("react"),1);var UC="zh-CN";function Il(){return UC}function Mt(e,t={dateStyle:"medium"},a=Il()){let r=e instanceof Date?e:new Date(e);return Number.isNaN(r.getTime())?"-":new Intl.DateTimeFormat(a,t).format(r)}function um(e,t={timeStyle:"short"},a=Il()){let r=e instanceof Date?e:new Date(e);return Number.isNaN(r.getTime())?"-":new Intl.DateTimeFormat(a,t).format(r)}function ri(e,t=Il()){return Mt(e,{dateStyle:"medium",timeStyle:"short"},t)}function qi(e,t=Il()){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=Il()){return new Intl.NumberFormat(a,t).format(e)}function Xu(e,t=Il()){return new Intl.NumberFormat(t,{notation:"compact",maximumFractionDigits:1}).format(e)}function da(e,t=1,a=Il()){return new Intl.NumberFormat(a,{style:"percent",minimumFractionDigits:t,maximumFractionDigits:t}).format(e)}function ze(e,t="CNY",a=Il()){return new Intl.NumberFormat(a,{style:"currency",currency:t}).format(e)}var rv=["B","KB","MB","GB","TB","PB"];function Yu(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)),rv.length-1);return`${(e/Math.pow(1024,a)).toFixed(a===0?0:t)} ${rv[a]}`}function ov(e,t=50,a="\u2026"){return e.length<=t?e:e.slice(0,t-a.length)+a}function ds(e){return e?e.trim().split(/\s+/).slice(0,2).map(a=>a[0]?.toUpperCase()??"").join(""):"?"}var hr=require("react/jsx-runtime");function pm(e){return e.toString().padStart(2,"0")}function nv(e,t){let a=e>=12?"PM":"AM";return`${e%12||12}:${pm(t)} ${a}`}function WC(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 sv({value:e,onChange:t,step:a=1,format:r="24h",disabled:o,placeholder:n="\u9009\u62E9\u65F6\u95F4",className:i}){let c=e?WC(e):null,s=jg.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=jg.useMemo(()=>{let u=[];for(let p=0;p<60;p+=a)u.push(p);return u},[a]),m=(u,p)=>{let f=r==="12h"?nv(u,p):`${pm(u)}:${pm(p)}`;t?.(f)};return(0,hr.jsx)("div",{"data-slot":"time-picker",children:(0,hr.jsxs)(st,{children:[(0,hr.jsxs)(it,{render:(0,hr.jsx)(C,{variant:"outline",disabled:o,className:l("w-[160px] justify-start text-left font-normal",!e&&"text-muted-foreground",i)}),children:[(0,hr.jsx)(Te,{}),e??(0,hr.jsx)("span",{children:n})]}),(0,hr.jsx)(lt,{className:"w-auto p-3",align:"start",children:(0,hr.jsxs)("div",{className:"flex items-center gap-2",children:[(0,hr.jsxs)(Ge,{value:c?String(c.h):void 0,onValueChange:u=>{let p=c?.m??0;m(Number(u),p)},children:[(0,hr.jsx)(Ke,{className:"w-[88px]","aria-label":"\u5C0F\u65F6",children:(0,hr.jsx)(je,{placeholder:"\u65F6"})}),(0,hr.jsx)(Qe,{className:"max-h-64",children:s.map(u=>(0,hr.jsx)(De,{value:String(u),children:r==="12h"?u===12?12:u:pm(u)},u))})]}),(0,hr.jsx)("span",{children:":"}),(0,hr.jsxs)(Ge,{value:c?String(c.m):void 0,onValueChange:u=>{let p=c?.h??0;m(p,Number(u))},children:[(0,hr.jsx)(Ke,{className:"w-[88px]","aria-label":"\u5206\u949F",children:(0,hr.jsx)(je,{placeholder:"\u5206"})}),(0,hr.jsx)(Qe,{className:"max-h-64",children:d.map(u=>(0,hr.jsx)(De,{value:String(u),children:pm(u)},u))})]})]})})]})})}function iv(e,t,a="24h"){return a==="12h"?nv(e,t):um(new Date(2e3,0,1,e,t),{timeStyle:"short"})}var Jr=require("react/jsx-runtime");function _C({items:e=[],onLoadMore:t,hasMore:a,className:r}){let o=lv.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:(0,Jr.jsxs)("div",{className:"mb-6",children:[(0,Jr.jsx)("h4",{className:"text-muted-foreground mb-3 text-xs font-semibold tracking-wider uppercase",children:i}),(0,Jr.jsx)(ud,{children:c.map((s,d)=>(0,Jr.jsxs)(pd,{children:[(0,Jr.jsx)(bc,{variant:s.variant??"default",children:s.avatarFallback?(0,Jr.jsx)(Uo,{className:"size-6",children:(0,Jr.jsx)(Wo,{className:"text-[0.6rem]",children:s.avatarFallback})}):null}),(0,Jr.jsx)(xc,{}),(0,Jr.jsxs)(vc,{children:[(0,Jr.jsxs)("p",{className:"text-sm",children:[(0,Jr.jsx)("span",{className:"font-medium",children:s.user})," ",(0,Jr.jsx)("span",{className:"text-muted-foreground",children:s.action})]}),(0,Jr.jsx)("time",{className:"text-muted-foreground text-xs",children:new Date(s.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]},d))})]});return(0,Jr.jsxs)("div",{"data-slot":"activity-feed",className:l(r),children:[n("Today",o.today??[]),n("Yesterday",o.yesterday??[]),n("Earlier",o.earlier??[]),a&&(0,Jr.jsx)(C,{variant:"outline",size:"sm",onClick:t,className:"mt-2 w-full",children:"Load more"}),e.length===0&&(0,Jr.jsx)("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"No activity yet."})]})}var dv=M(require("react"),1);var cv=require("react-i18next");var Sa=require("react/jsx-runtime");function qC({fields:e,savedSearches:t=[],defaultValues:a={},onSearch:r,onSaveSearch:o,className:n,...i}){let{t:c}=(0,cv.useTranslation)("data"),[s,d]=dv.useState(a),m=(u,p)=>{d(f=>({...f,[u]:p}))};return(0,Sa.jsxs)("form",{"data-slot":"advanced-search",className:l("space-y-4 rounded-lg border p-4",n),onSubmit:u=>{u.preventDefault(),r?.(s)},...i,children:[(0,Sa.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row",children:[(0,Sa.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,Sa.jsx)(we,{htmlFor:"advanced-search-query",children:c("advancedSearch.label")}),(0,Sa.jsxs)("div",{className:"relative",children:[(0,Sa.jsx)(te,{className:"text-muted-foreground absolute top-1/2 left-2 size-4 -translate-y-1/2"}),(0,Sa.jsx)(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=>(0,Sa.jsxs)("div",{className:"min-w-40 space-y-1.5",children:[(0,Sa.jsx)(we,{children:u.label}),(0,Sa.jsxs)(Ge,{value:s[u.key]??"",onValueChange:p=>{p&&m(u.key,p)},children:[(0,Sa.jsx)(Ke,{children:(0,Sa.jsx)(je,{placeholder:c("advancedSearch.any")})}),(0,Sa.jsx)(Qe,{children:u.options.map(p=>(0,Sa.jsx)(De,{value:p.value,children:p.label},p.value))})]})]},u.key))]}),t.length>0&&(0,Sa.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,Sa.jsx)("span",{className:"text-muted-foreground text-xs",children:c("advancedSearch.saved")}),t.map(u=>(0,Sa.jsx)(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:(0,Sa.jsx)(L,{variant:"outline",children:u.label})},u.id))]}),(0,Sa.jsxs)("div",{className:"flex justify-end gap-2",children:[o&&(0,Sa.jsxs)(C,{type:"button",variant:"outline",onClick:()=>o(s),children:[(0,Sa.jsx)(oc,{}),c("advancedSearch.saveFilter")]}),(0,Sa.jsxs)(C,{type:"submit",children:[(0,Sa.jsx)(te,{}),c("advancedSearch.label")]})]})]})}var mv=M(require("react"),1);var cs=require("react/jsx-runtime"),GC={info:ad,warning:Mn,critical:ir},jC={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 KC({announcements:e,maxVisible:t=3,className:a,onDismiss:r,onViewAll:o}){let[n,i]=mv.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(0,cs.jsxs)("div",{"data-slot":"announcement-banner",className:l("flex flex-col gap-1.5",a),children:[d.map(u=>{let p=GC[u.priority];return(0,cs.jsxs)("div",{className:l("relative flex items-start gap-2.5 rounded-lg border px-3 py-2.5 text-sm",jC[u.priority]),children:[(0,cs.jsx)(p,{className:"mt-0.5 size-4 shrink-0"}),(0,cs.jsxs)("div",{className:"min-w-0 flex-1",children:[u.link?(0,cs.jsx)("a",{href:u.link,className:"font-medium underline underline-offset-2 hover:no-underline",children:u.title}):(0,cs.jsx)("span",{className:"font-medium",children:u.title}),u.content&&(0,cs.jsx)("p",{className:"mt-0.5 opacity-80",children:u.content})]}),u.dismissible!==!1&&(0,cs.jsx)(C,{variant:"ghost",size:"icon-xs",className:"size-5 shrink-0 opacity-60 hover:opacity-100",onClick:()=>c(u.id),children:(0,cs.jsx)(ee,{className:"size-3"})})]},u.id)}),m>0&&o&&(0,cs.jsxs)(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"]})]})}var uv=require("react-i18next");var fd=require("react/jsx-runtime"),QC={approved:G,pending:Te,rejected:ee,skipped:Te},XC={approved:"success",pending:"info",rejected:"destructive",skipped:"default"};function YC({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}=(0,uv.useTranslation)("transfer"),c=n?i:s=>s;return(0,fd.jsx)(ud,{"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(0,fd.jsx)(pd,{icon:QC[s.status],title:(0,fd.jsxs)("span",{className:"inline-flex items-center gap-2",children:[s.title,(0,fd.jsx)(L,{variant:"outline",children:d})]}),description:(0,fd.jsxs)("span",{children:[s.approver,s.note?` \xB7 ${s.note}`:""]}),time:s.time,variant:XC[s.status]},s.id)})})}var pv=M(require("react"),1);var kt=require("react/jsx-runtime"),JC={pending:{label:"\u7B49\u5F85\u4E2D",variant:"outline",icon:Te},running:{label:"\u6267\u884C\u4E2D",variant:"default",icon:zr},completed:{label:"\u5DF2\u5B8C\u6210",variant:"secondary",icon:zi},failed:{label:"\u5931\u8D25",variant:"destructive",icon:Vo}};function ZC({open:e,onOpenChange:t,tasks:a,onCancelTask:r,onRetryTask:o,onDownloadResult:n,className:i}){let[c,s]=pv.useState(null);return(0,kt.jsx)(wg,{"data-slot":"async-task-center",open:e,onOpenChange:t,direction:"right",children:(0,kt.jsxs)(Tg,{className:l("w-[400px] max-w-[90vw]",i),children:[(0,kt.jsx)(Rg,{className:"border-b",children:(0,kt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,kt.jsxs)("div",{children:[(0,kt.jsx)(Sg,{children:"\u4EFB\u52A1\u4E2D\u5FC3"}),(0,kt.jsxs)(Ig,{children:[a.length," \u4E2A\u4EFB\u52A1"]})]}),(0,kt.jsx)(Pg,{asChild:!0,children:(0,kt.jsx)(C,{variant:"ghost",size:"icon-sm",children:(0,kt.jsx)(ee,{className:"size-4"})})})]})}),a.length===0?(0,kt.jsxs)("div",{className:"text-muted-foreground flex flex-col items-center justify-center py-16",children:[(0,kt.jsx)(zi,{className:"mb-3 size-12"}),(0,kt.jsx)("p",{className:"text-sm",children:"\u6682\u65E0\u4EFB\u52A1"})]}):(0,kt.jsx)(Qa,{className:"h-[calc(100vh-8rem)]",children:(0,kt.jsx)("div",{className:"divide-y",children:a.map(d=>{let m=JC[d.status],u=m.icon,p=c===d.id;return(0,kt.jsx)("div",{className:"px-4 py-3",children:(0,kt.jsxs)("div",{className:"flex cursor-pointer items-start gap-3",onClick:()=>s(p?null:d.id),children:[(0,kt.jsx)(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")}),(0,kt.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,kt.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,kt.jsx)("p",{className:"truncate text-sm font-medium",children:d.title}),(0,kt.jsx)(L,{variant:m.variant,className:"shrink-0 text-[10px]",children:m.label})]}),(0,kt.jsxs)("p",{className:"text-muted-foreground text-xs",children:[d.type," \xB7 ",d.createdAt.toLocaleTimeString()]}),(d.status==="running"||d.status==="pending")&&(0,kt.jsxs)("div",{className:"mt-2",children:[(0,kt.jsx)(Po,{value:d.progress,className:"h-1.5"}),(0,kt.jsx)("p",{className:"text-muted-foreground mt-1 text-[10px]",children:d.message||`${d.progress}%`})]}),p&&(0,kt.jsxs)("div",{className:"mt-2 flex gap-1.5",children:[(d.status==="pending"||d.status==="running")&&r&&(0,kt.jsx)(C,{size:"sm",variant:"outline",onClick:f=>{f.stopPropagation(),r(d.id)},children:"\u53D6\u6D88"}),d.status==="failed"&&o&&(0,kt.jsx)(C,{size:"sm",onClick:f=>{f.stopPropagation(),o(d.id)},children:"\u91CD\u8BD5"}),d.status==="completed"&&n&&(0,kt.jsxs)(C,{size:"sm",variant:"outline",onClick:f=>{f.stopPropagation(),n(d.id)},children:[(0,kt.jsx)(mo,{className:"mr-1 size-3"}),"\u4E0B\u8F7D\u7ED3\u679C"]})]}),d.status==="failed"&&d.errorMsg&&p&&(0,kt.jsx)("p",{className:"bg-destructive/10 text-destructive mt-1.5 rounded px-2 py-1 text-xs",children:d.errorMsg})]}),(0,kt.jsx)(fe,{className:l("text-muted-foreground mt-1 size-4 shrink-0 transition-transform",p&&"rotate-180")})]})},d.id)})})})]})})}var fv=M(require("react"),1);var Kg=M(require("react"),1),gv=require("react-i18next");var ea=require("react/jsx-runtime"),ek=[{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 gm({fields:e,onChange:t,className:a}){let{t:r}=(0,gv.useTranslation)("data"),[o,n]=Kg.useState([]),[i,c]=Kg.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(0,ea.jsxs)("div",{"data-slot":"filter-builder",className:l("space-y-3",a),children:[(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsx)("span",{className:"text-sm font-medium",children:r("filterBuilder.where")}),(0,ea.jsxs)(Ge,{value:i,onValueChange:p=>{p&&(c(p),t?.({logic:p,filters:o}))},children:[(0,ea.jsx)(Ke,{className:"h-7 w-20",children:(0,ea.jsx)(je,{})}),(0,ea.jsxs)(Qe,{children:[(0,ea.jsx)(De,{value:"AND",children:"AND"}),(0,ea.jsx)(De,{value:"OR",children:"OR"})]})]}),(0,ea.jsxs)(C,{variant:"outline",size:"sm",onClick:d,children:[(0,ea.jsx)(Re,{className:"size-3 mr-1"}),r("filterBuilder.addFilter")]})]}),o.length===0&&(0,ea.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:r("filterBuilder.empty")}),o.map((p,f)=>(0,ea.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ea.jsxs)(Ge,{value:p.field,onValueChange:x=>x&&u(f,"field",x),children:[(0,ea.jsx)(Ke,{className:"h-8 w-40",children:(0,ea.jsx)(je,{})}),(0,ea.jsx)(Qe,{children:e.map(x=>(0,ea.jsx)(De,{value:x.key,children:x.label},x.key))})]}),(0,ea.jsxs)(Ge,{value:p.operator,onValueChange:x=>x&&u(f,"operator",x),children:[(0,ea.jsx)(Ke,{className:"h-8 w-36",children:(0,ea.jsx)(je,{})}),(0,ea.jsx)(Qe,{children:ek.map(x=>(0,ea.jsx)(De,{value:x.value,children:r(x.labelKey)},x.value))})]}),(0,ea.jsx)(T,{className:"h-8 flex-1",placeholder:r("filterBuilder.valuePlaceholder"),value:p.value,onChange:x=>u(f,"value",x.target.value)}),(0,ea.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>m(f),children:(0,ea.jsx)(Le,{className:"size-4 text-destructive"})})]},f)),o.length>0&&(0,ea.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ea.jsx)(L,{variant:"outline",children:r("filterBuilder.activeCount",{count:o.length})}),r("filterBuilder.active")]})]})}var bn=require("react/jsx-runtime");function tk({fields:e,segments:t,selectedSegmentKeys:a=[],onSegmentsChange:r,onFiltersChange:o,estimatedSize:n,className:i}){let[c,s]=fv.useState(a),d=r?a:c,m=u=>{s(u),r?.(u)};return(0,bn.jsxs)(re,{"data-slot":"audience-segment-builder",className:l("overflow-hidden",i),children:[(0,bn.jsxs)(he,{children:[(0,bn.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,bn.jsx)(fl,{className:"size-4"}),"Audience segment"]}),(0,bn.jsx)(uo,{children:"Combine reusable segments with rule-based filters."})]}),(0,bn.jsxs)(oe,{className:"space-y-5",children:[(0,bn.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,bn.jsxs)(L,{variant:"secondary",children:[d.length," saved segments"]}),n!==void 0&&(0,bn.jsxs)(L,{variant:"outline",children:[n.toLocaleString()," estimated users"]})]}),(0,bn.jsx)(Qu,{dataSource:t,targetKeys:d,onChange:m,titles:["Available","Included"],className:"min-w-0"}),(0,bn.jsx)("div",{className:"rounded-lg border p-4",children:(0,bn.jsx)(gm,{fields:e,...o?{onChange:o}:{}})})]})]})}var bv=M(require("react"),1);var xv=require("react-i18next");var lr=require("react/jsx-runtime"),ak={success:"default",warning:"secondary",error:"destructive",info:"outline"};function rk(e){return e.split(/\s+/).map(t=>t[0]).join("").slice(0,2).toUpperCase()}function vv({entries:e,emptyText:t,className:a,...r}){let{t:o}=(0,xv.useTranslation)("data"),n=t??o("auditLog.emptyText"),[i,c]=bv.useState({});return e.length===0?(0,lr.jsx)("div",{"data-slot":"audit-log",className:l("text-muted-foreground rounded-lg border p-6 text-center text-sm",a),...r,children:n}):(0,lr.jsx)("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(0,lr.jsx)("div",{className:"p-4",children:(0,lr.jsxs)("div",{className:"flex items-start gap-3",children:[(0,lr.jsx)(Uo,{className:"size-8",children:(0,lr.jsx)(Wo,{children:rk(s.actor.name)})}),(0,lr.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,lr.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,lr.jsx)("p",{className:"text-sm font-medium",children:s.actor.name}),s.status&&(0,lr.jsx)(L,{variant:ak[s.status],children:s.status})]}),s.actor.description&&(0,lr.jsx)("p",{className:"text-muted-foreground text-xs",children:s.actor.description}),(0,lr.jsxs)("p",{className:"mt-1 text-sm",children:[(0,lr.jsx)("span",{className:"text-muted-foreground",children:s.action})," ",(0,lr.jsx)("span",{className:"font-medium",children:s.target})]}),m&&d&&(0,lr.jsx)("div",{className:"bg-muted/50 text-muted-foreground mt-3 rounded-md p-3 text-xs",children:s.details})]}),(0,lr.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,lr.jsx)("time",{className:"text-muted-foreground text-xs",children:s.timestamp}),m&&(0,lr.jsx)(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?(0,lr.jsx)(fe,{}):(0,lr.jsx)(ke,{})})]})]})},s.id)})})}var Ia=require("react/jsx-runtime"),ok={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 nk({title:e="\u64CD\u4F5C\u65E5\u5FD7",entries:t,loading:a=!1,className:r}){return a?(0,Ia.jsxs)("div",{"data-slot":"audit-sidebar",className:l("p-4",r),children:[(0,Ia.jsx)("h4",{className:"mb-3 text-sm font-semibold",children:e}),(0,Ia.jsx)("div",{className:"space-y-3",children:Array.from({length:5}).map((o,n)=>(0,Ia.jsxs)("div",{className:"animate-pulse space-y-1.5",children:[(0,Ia.jsx)("div",{className:"bg-muted h-3 w-1/2 rounded"}),(0,Ia.jsx)("div",{className:"bg-muted h-2.5 w-2/3 rounded"})]},n))})]}):(0,Ia.jsxs)("div",{"data-slot":"audit-sidebar",className:l("flex h-full flex-col",r),children:[(0,Ia.jsxs)("h4",{className:"shrink-0 border-b px-4 py-3 text-sm font-semibold",children:[e,(0,Ia.jsxs)("span",{className:"text-muted-foreground ml-1.5 text-xs font-normal",children:["(",t.length,")"]})]}),(0,Ia.jsx)(Qa,{className:"flex-1",children:t.length===0?(0,Ia.jsx)("p",{className:"text-muted-foreground p-4 text-sm",children:"\u6682\u65E0\u64CD\u4F5C\u8BB0\u5F55"}):(0,Ia.jsx)("div",{className:"divide-y",children:t.map(o=>(0,Ia.jsxs)("div",{className:"p-3 text-sm",children:[(0,Ia.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Ia.jsx)("p",{className:"truncate font-medium",children:o.action}),o.status&&(0,Ia.jsx)(L,{className:l("shrink-0 px-1 py-0 text-[10px]",ok[o.status]),children:o.status})]}),(0,Ia.jsxs)("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&&(0,Ia.jsxs)("div",{className:"bg-muted/50 mt-1.5 rounded px-2 py-1 text-xs",children:[(0,Ia.jsxs)("span",{className:"text-muted-foreground",children:[o.field,":"]})," ",(0,Ia.jsx)("span",{className:"text-muted-foreground/60 line-through",children:o.oldValue}),(0,Ia.jsx)("span",{className:"text-muted-foreground mx-1",children:"\u2192"}),(0,Ia.jsx)("span",{className:"font-medium",children:o.newValue})]}),o.details&&(0,Ia.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:o.details})]},o.id))})})]})}var tL=require("react"),bd=require("react/jsx-runtime");function sk({permission:e,mode:t="hide",check:a,fallback:r=null,children:o}){return(a?a(e):!0)?(0,bd.jsx)(bd.Fragment,{children:o}):t==="disable"?(0,bd.jsx)("div",{className:"pointer-events-none opacity-50","aria-disabled":"true",children:o}):(0,bd.jsx)(bd.Fragment,{children:r})}var oL=require("react");var fm=M(require("react"),1),lk=require("react/jsx-runtime"),ik=fm.createContext({permissions:[],hasPermission:()=>!0,hasAny:()=>!0,hasAll:()=>!0});function hv(){return fm.useContext(ik)}var Gi=require("react/jsx-runtime");function yv({code:e,mode:t="hide",check:a,fallback:r=null,children:o}){let{hasPermission:n}=hv();return(a?a(e):n(e))?(0,Gi.jsx)(Gi.Fragment,{children:o}):t==="disable"?(0,Gi.jsx)("div",{className:"pointer-events-none opacity-50","aria-disabled":"true",children:o}):(0,Gi.jsx)(Gi.Fragment,{children:r})}function dk(e,t){return a=>{let r=o=>(0,Gi.jsx)(yv,{code:e,fallback:t,children:(0,Gi.jsx)(a,{...o})});return r.displayName=`withPermission(${a.displayName??a.name})`,r}}var ms=M(require("react"),1);var xd=require("react/jsx-runtime"),Qg=ms.createContext({visible:!1,show:()=>{},hide:()=>{}});function ck({children:e,defaultTip:t,zIndex:a=9999}){let[r,o]=ms.useState(!1),[n,i]=ms.useState(t),c=ms.useCallback(m=>{i(m??t),o(!0)},[t]),s=ms.useCallback(()=>{o(!1)},[]),d=ms.useMemo(()=>({visible:r,show:c,hide:s}),[r,c,s]);return(0,xd.jsxs)(Qg.Provider,{value:d,children:[e,r&&(0,xd.jsx)("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:(0,xd.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,xd.jsx)(Xx,{size:"xl"}),n&&(0,xd.jsx)("p",{className:"text-muted-foreground text-sm",children:n})]})})]})}function mk(){return ms.useContext(Qg)}var dL=require("react");var Ps=require("react/jsx-runtime");function uk({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(0,Ps.jsxs)("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&&(0,Ps.jsxs)(Ps.Fragment,{children:[(0,Ps.jsx)("div",{className:"flex items-center gap-2",children:d}),(0,Ps.jsx)(dt,{orientation:"vertical",className:"h-5"})]}),m&&r&&(0,Ps.jsx)(C,{variant:"destructive",size:"sm",onClick:r,disabled:o,children:s}),a&&(0,Ps.jsx)(C,{variant:"outline",size:"sm",onClick:a,disabled:o,children:c}),t&&(0,Ps.jsx)(C,{size:"sm",onClick:t,disabled:o||n,children:o?"...":i})]})}var Xg=require("react/jsx-runtime");function pk({onPrint:e,label:t="Print",variant:a="outline",size:r="sm",icon:o,children:n,...i}){return(0,Xg.jsx)(C,{"data-slot":"print-button",variant:a,size:r,icon:o??(0,Xg.jsx)(_s,{}),onClick:()=>{e?e():typeof window<"u"&&window.print()},...i,children:n??t})}var Yg=M(require("react"),1);var To=require("react/jsx-runtime");function gk({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]=Yg.useState(null),[m,u]=Yg.useState(!1),p=async()=>{if(!(!s||!a)){u(!0);try{await a(s),t?.(!1),d(null)}finally{u(!1)}}};return(0,To.jsx)(Ye,{open:e,onOpenChange:t,children:(0,To.jsxs)(Je,{"data-slot":"import-dialog",className:"sm:max-w-[480px]",children:[(0,To.jsxs)(nt,{children:[(0,To.jsx)(Ze,{children:n}),(0,To.jsx)(Dt,{children:"Upload a file to import data. Please use the template for correct formatting."})]}),(0,To.jsxs)(tm,{children:[r&&(0,To.jsxs)("a",{href:r,download:!0,className:"text-primary mb-3 inline-flex items-center gap-1.5 text-sm hover:underline",children:[(0,To.jsx)(mo,{className:"size-3.5"}),c]}),(0,To.jsx)(rm,{...o?{accept:{"*/*":[o]}}:{},onDrop:f=>d(f[0]??null)}),s&&(0,To.jsxs)("div",{className:"text-muted-foreground mt-2 text-sm",children:["Selected: ",s.name]})]}),(0,To.jsxs)(bt,{children:[(0,To.jsx)(C,{variant:"outline",onClick:()=>t?.(!1),disabled:m,children:"Cancel"}),(0,To.jsx)(C,{onClick:p,disabled:!s||m,icon:(0,To.jsx)(Gs,{}),children:m?"Importing...":i})]})]})})}var CL=require("react"),kv=require("react-i18next");var vd=require("react/jsx-runtime"),Nv={sm:"size-6 text-[0.6rem]",default:"size-8 text-xs",lg:"size-10 text-sm",xl:"size-12 text-base"},Cv={sm:"ring-1",default:"ring-2",lg:"ring-2",xl:"ring-2"};function fk({users:e,max:t=4,size:a="default",showOverflow:r=!0,onOverflowClick:o,className:n,...i}){let{t:c}=(0,kv.useTranslation)("transfer"),s=e.slice(0,t),d=e.length-t;return(0,vd.jsxs)("div",{"data-slot":"avatar-group",className:l("flex -space-x-2",n),...i,children:[s.map((m,u)=>(0,vd.jsxs)(Uo,{className:l(Nv[a],Cv[a],"border-background border"),title:m.name,children:[m.src&&(0,vd.jsx)(is,{src:m.src,alt:m.name}),(0,vd.jsx)(Wo,{children:ds(m.name)})]},`${m.name}-${u}`)),d>0&&r&&(0,vd.jsxs)(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",Nv[a],Cv[a]),"aria-label":c("avatarGroup.viewAll",{count:e.length}),children:["+",d]})]})}var RL=require("react");var Ea=require("react/jsx-runtime");function bk({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"&&(0,Ea.jsxs)(Ea.Fragment,{children:[t&&(0,Ea.jsx)(C,{variant:"outline",onClick:t,disabled:d,children:"\u5B58\u8349\u7A3F"}),a&&(0,Ea.jsx)(C,{onClick:a,disabled:d,children:"\u63D0\u4EA4"}),r&&(0,Ea.jsx)(C,{variant:"ghost",onClick:r,disabled:d,children:"\u53D6\u6D88"})]}),f=e==="pending"&&(0,Ea.jsxs)(Ea.Fragment,{children:[o&&(0,Ea.jsx)(C,{onClick:o,disabled:d,children:"\u5BA1\u6279\u901A\u8FC7"}),n&&(0,Ea.jsx)(C,{variant:"outline",onClick:n,disabled:d,children:"\u9A73\u56DE"}),i&&(0,Ea.jsx)(C,{variant:"ghost",onClick:i,disabled:d,children:"\u64A4\u56DE"})]}),x=e==="approved"&&(0,Ea.jsxs)(Ea.Fragment,{children:[c&&(0,Ea.jsx)(C,{variant:"outline",onClick:c,disabled:d,children:"\u6253\u5370"}),s&&(0,Ea.jsx)(C,{variant:"outline",className:"text-destructive",onClick:s,disabled:d,children:"\u4F5C\u5E9F"})]}),v=e==="rejected"&&(0,Ea.jsxs)(Ea.Fragment,{children:[a&&(0,Ea.jsx)(C,{onClick:a,disabled:d,children:"\u4FEE\u6539\u91CD\u63D0"}),s&&(0,Ea.jsx)(C,{variant:"outline",className:"text-destructive",onClick:s,disabled:d,children:"\u4F5C\u5E9F"})]});return(0,Ea.jsxs)("div",{"data-slot":"bill-footer",className:l("bg-background flex items-center justify-between border-t px-6 py-3",u),children:[(0,Ea.jsx)("div",{className:"flex items-center gap-2",children:m}),(0,Ea.jsxs)("div",{className:"flex items-center gap-2",children:[p,f,x,v]})]})}var ML=require("react");var En=require("react/jsx-runtime");function xk({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(0,En.jsx)(re,{"data-slot":"bill-header",className:n,children:(0,En.jsxs)(oe,{className:"pt-6",children:[(t||a)&&(0,En.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(0,En.jsx)("h3",{className:"text-foreground text-sm font-semibold",children:t}),a&&(0,En.jsx)("div",{children:a})]}),(0,En.jsxs)("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)=>(0,En.jsxs)("div",{className:l("min-w-0",s.span&&s.span>1&&`col-span-${s.span}`),children:[(0,En.jsx)("dt",{className:"text-muted-foreground mb-1 text-xs font-medium",children:s.label}),(0,En.jsx)("dd",{className:"text-foreground text-sm break-words",children:o?(0,En.jsx)("span",{className:"bg-muted inline-block h-4 w-24 animate-pulse rounded"}):s.value})]},d)),i.length===0&&!o&&(0,En.jsx)("p",{className:"text-muted-foreground col-span-full text-sm",children:"\u6682\u65E0\u5355\u636E\u4FE1\u606F"})]})]})})}var AL=require("react");var yr=require("react/jsx-runtime"),vk={draft:"\u8349\u7A3F",pending:"\u5BA1\u6279\u4E2D",approved:"\u5DF2\u901A\u8FC7",rejected:"\u5DF2\u9A73\u56DE"},hk={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 yk({title:e,subtitle:t,status:a,onBack:r,actions:o,loading:n=!1,className:i,children:c}){return(0,yr.jsxs)("div",{"data-slot":"bill-page",className:l("flex h-full flex-col",i),children:[(0,yr.jsxs)("div",{className:"flex items-center justify-between border-b px-6 py-3",children:[(0,yr.jsxs)("div",{className:"flex items-center gap-3",children:[r&&(0,yr.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:r,children:(0,yr.jsx)("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,yr.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),(0,yr.jsxs)("div",{children:[n?(0,yr.jsx)(la,{className:"h-6 w-48"}):(0,yr.jsx)("h1",{className:"text-lg font-semibold",children:e}),n?(0,yr.jsx)(la,{className:"mt-1 h-4 w-32"}):t?(0,yr.jsx)("p",{className:"text-muted-foreground text-sm",children:t}):null]}),a&&!n&&(0,yr.jsx)("span",{className:l("ml-2 inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium",hk[a]),children:vk[a]})]}),o&&!n?(0,yr.jsx)("div",{className:"flex items-center gap-2",children:o}):n?(0,yr.jsx)(la,{className:"h-8 w-64"}):null]}),(0,yr.jsx)("div",{className:"flex-1 overflow-auto p-6",children:n?(0,yr.jsxs)("div",{className:"space-y-4",children:[(0,yr.jsx)(la,{className:"h-8 w-1/3"}),(0,yr.jsx)(la,{className:"h-32 w-full"}),(0,yr.jsx)(la,{className:"h-32 w-full"})]}):c})]})}var Tv=M(require("react"),1);var go=require("react/jsx-runtime"),wv={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"},Pv={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 Nk({steps:e,direction:t="horizontal",className:a}){return t==="vertical"?(0,go.jsx)("div",{"data-slot":"bill-status-bar",className:l("flex flex-col",a),children:e.map((r,o)=>(0,go.jsxs)("div",{className:"flex gap-3",children:[(0,go.jsxs)("div",{className:"flex flex-col items-center",children:[(0,go.jsx)("div",{className:l("size-3 rounded-full border-2",wv[r.status])}),o<e.length-1&&(0,go.jsx)("div",{className:l("my-1 w-0.5 flex-1",r.status==="completed"?"bg-green-500":"bg-gray-200 dark:bg-gray-700")})]}),(0,go.jsxs)("div",{className:"pb-6",children:[(0,go.jsx)("p",{className:l("text-sm leading-none",Pv[r.status]),children:r.label}),r.description&&(0,go.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:r.description})]})]},o))}):(0,go.jsx)("div",{"data-slot":"bill-status-bar",className:l("flex items-center",a),children:e.map((r,o)=>(0,go.jsxs)(Tv.Fragment,{children:[(0,go.jsxs)("div",{className:"flex items-center gap-2",children:[(0,go.jsx)("div",{className:l("size-3 shrink-0 rounded-full border-2",wv[r.status])}),(0,go.jsx)("div",{className:"min-w-0",children:(0,go.jsx)("p",{className:l("truncate text-sm",Pv[r.status]),children:r.label})})]}),o<e.length-1&&(0,go.jsx)("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))})}var UL=require("react");var Jg=require("react/jsx-runtime"),Rv={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 Ck({status:e,label:t,statusMap:a,className:r}){let n={...Rv,...a}[e];return n?(0,Jg.jsx)("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,Jg.jsx)("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})}var dr=require("react/jsx-runtime"),kk={"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 yc(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 kk[e]??e}var wk={under:"budgetPacing.status.under","on-track":"budgetPacing.status.onTrack",over:"budgetPacing.status.over",exhausted:"budgetPacing.status.exhausted"},Pk={under:"text-info","on-track":"text-success",over:"text-warning",exhausted:"text-destructive"};function Ju(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,maximumFractionDigits:0}).format(e)}function Tk({title:e,budget:t,spent:a,currency:r="USD",status:o,forecast:n,className:i,texts:c}){let s=e??yc("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(0,dr.jsxs)(re,{"data-slot":"budget-pacing-card",className:i,children:[(0,dr.jsxs)(he,{children:[(0,dr.jsx)(ve,{children:s}),(0,dr.jsx)(uo,{className:l("font-medium",Pk[u]),children:yc(wk[u],c)})]}),(0,dr.jsxs)(oe,{className:"space-y-4",children:[(0,dr.jsxs)("div",{className:"flex items-end justify-between gap-4",children:[(0,dr.jsxs)("div",{children:[(0,dr.jsx)("div",{className:"text-2xl font-semibold tabular-nums",children:Ju(a,r)}),(0,dr.jsxs)("div",{className:"text-muted-foreground text-xs",children:[yc("budgetPacing.spentOf",c)," ",Ju(t,r)]})]}),(0,dr.jsxs)("div",{className:"text-right text-sm",children:[(0,dr.jsxs)("div",{className:"font-medium tabular-nums",children:[d,"%"]}),(0,dr.jsx)("div",{className:"text-muted-foreground text-xs",children:yc("budgetPacing.used",c)})]})]}),(0,dr.jsx)(Po,{value:d}),(0,dr.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[(0,dr.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,dr.jsx)("div",{className:"text-muted-foreground text-xs",children:yc("budgetPacing.remaining",c)}),(0,dr.jsx)("div",{className:"font-medium tabular-nums",children:Ju(m,r)})]}),(0,dr.jsxs)("div",{className:"rounded-lg border p-3",children:[(0,dr.jsx)("div",{className:"text-muted-foreground text-xs",children:yc("budgetPacing.forecast",c)}),(0,dr.jsx)("div",{className:"font-medium tabular-nums",children:Ju(n??a,r)})]})]})]})]})}var QL=require("react");var Sv=require("react-i18next");var Ts=require("react/jsx-runtime");function Rk({count:e,selectedCount:t,onClear:a,actions:r=[],label:o,className:n,...i}){let{t:c}=(0,Sv.useTranslation)("navigation"),s=o??c("bulkActionsToolbar.label");return t===0?null:(0,Ts.jsxs)("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:[(0,Ts.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,Ts.jsx)("span",{className:"font-medium",children:s}),(0,Ts.jsxs)("span",{className:"bg-primary/10 text-primary rounded-full px-2 py-0.5 text-xs",children:[t," / ",e]})]}),(0,Ts.jsx)("div",{className:"bg-border mx-2 h-4 w-px"}),(0,Ts.jsx)("div",{className:"flex flex-1 flex-wrap items-center gap-1",children:r.map((d,m)=>(0,Ts.jsxs)(C,{size:"sm",variant:d.variant??"outline",onClick:d.onClick,disabled:d.disabled,children:[d.icon,d.label]},m))}),a&&(0,Ts.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":c("bulkActionsToolbar.clear"),children:(0,Ts.jsx)(ee,{})})]})}var Iv=require("react-i18next"),ez=require("react");var vt=require("react/jsx-runtime"),Sk={upload:0,mapping:1,validation:2,complete:3};function Ik({step:e="upload",filename:t,progress:a=0,mappings:r=[],validationRows:o=[],importedCount:n,onUpload:i,onContinue:c,className:s,...d}){let{t:m}=(0,Iv.useTranslation)("upload");return(0,vt.jsxs)("div",{"data-slot":"bulk-import-wizard",className:l("space-y-6 rounded-lg border p-6",s),...d,children:[(0,vt.jsxs)(sm,{activeStep:Sk[e],children:[(0,vt.jsx)(Pl,{children:m("bulkImportWizard.upload")}),(0,vt.jsx)(Pl,{children:m("bulkImportWizard.mapFields")}),(0,vt.jsx)(Pl,{children:m("bulkImportWizard.validate")}),(0,vt.jsx)(Pl,{children:m("bulkImportWizard.complete")})]}),e==="upload"&&(0,vt.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed p-8 text-center",children:[(0,vt.jsx)(Gs,{className:"text-muted-foreground size-8"}),(0,vt.jsxs)("div",{children:[(0,vt.jsx)("p",{className:"text-sm font-medium",children:m("bulkImportWizard.uploadTitle")}),(0,vt.jsx)("p",{className:"text-muted-foreground text-xs",children:m("bulkImportWizard.uploadDescription")})]}),(0,vt.jsx)(C,{type:"button",onClick:i,children:m("bulkImportWizard.selectFile")})]}),e==="mapping"&&(0,vt.jsxs)("div",{className:"space-y-3",children:[(0,vt.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,vt.jsx)(cu,{className:"text-muted-foreground size-4"}),(0,vt.jsx)("span",{children:t??"audience-import.csv"})]}),(0,vt.jsx)("div",{className:"grid gap-2",children:r.map(u=>(0,vt.jsxs)("div",{className:"flex items-center justify-between rounded-md border p-3 text-sm",children:[(0,vt.jsx)("span",{children:u.source}),(0,vt.jsx)("span",{className:"text-muted-foreground",children:m("bulkImportWizard.mapsTo")}),(0,vt.jsx)(L,{variant:"outline",children:u.target})]},`${u.source}-${u.target}`))})]}),e==="validation"&&(0,vt.jsxs)("div",{className:"space-y-3",children:[(0,vt.jsx)(Po,{value:a}),(0,vt.jsx)("div",{className:"divide-y rounded-lg border",children:o.map(u=>(0,vt.jsxs)("div",{className:"flex items-center justify-between gap-3 p-3 text-sm",children:[(0,vt.jsxs)("span",{children:["Row ",u.row]}),(0,vt.jsx)("span",{className:"text-muted-foreground flex-1",children:u.message}),(0,vt.jsx)(L,{variant:u.status==="error"?"destructive":u.status==="warning"?"secondary":"default",children:u.status})]},`${u.row}-${u.message}`))})]}),e==="complete"&&(0,vt.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 rounded-lg border p-8 text-center",children:[(0,vt.jsx)(ft,{className:"text-success size-10"}),(0,vt.jsxs)("div",{children:[(0,vt.jsx)("p",{className:"text-sm font-medium",children:m("bulkImportWizard.importComplete")}),(0,vt.jsx)("p",{className:"text-muted-foreground text-xs",children:m("bulkImportWizard.recordsImported",{count:n??0})})]})]}),e!=="complete"&&(0,vt.jsx)("div",{className:"flex justify-end",children:(0,vt.jsx)(C,{type:"button",onClick:c,children:m("bulkImportWizard.continue")})})]})}var Dv=require("react/jsx-runtime"),Dk={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 bm({status:e,size:t="default",label:a,className:r}){let o=Dk[e];return(0,Dv.jsx)(L,{"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})}var Zr=require("react/jsx-runtime");function Mk(e){return e instanceof Date?e:new Date(e)}function Bk(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Lk({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(0,Zr.jsxs)("div",{"data-slot":"campaign-calendar",className:l("overflow-hidden rounded-lg border",a),children:[(0,Zr.jsx)("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=>(0,Zr.jsx)("div",{className:"px-3 py-2 text-center",children:c},c))}),(0,Zr.jsx)("div",{className:"grid grid-cols-7",children:i.map((c,s)=>{let d=c?t.filter(m=>Bk(Mk(m.date),c)):[];return(0,Zr.jsx)("div",{className:"min-h-28 border-r border-b p-2 last:border-r-0",children:c&&(0,Zr.jsxs)(Zr.Fragment,{children:[(0,Zr.jsx)("div",{className:"mb-2 text-xs font-medium tabular-nums",children:c.getDate()}),(0,Zr.jsxs)("div",{className:"space-y-1",children:[d.slice(0,3).map(m=>(0,Zr.jsxs)("div",{className:"bg-muted/60 rounded-md p-1.5",children:[(0,Zr.jsx)("div",{className:"truncate text-xs font-medium",children:m.name}),(0,Zr.jsxs)("div",{className:"mt-1 flex items-center gap-1",children:[(0,Zr.jsx)(bm,{status:m.status,size:"sm"}),m.channel&&(0,Zr.jsx)("span",{className:"text-muted-foreground truncate text-[0.65rem]",children:m.channel})]})]},m.id)),d.length>3&&(0,Zr.jsxs)("div",{className:"text-muted-foreground text-[0.65rem]",children:["+",d.length-3," more"]})]})]})},c?.toISOString()??`empty-${s}`)})})]})}var Bv=require("react-i18next");var fa=require("react/jsx-runtime");function Mv(e,t){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,maximumFractionDigits:0}).format(e)}function zk({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}=(0,Bv.useTranslation)("marketing"),p=n?Math.min(Math.round(i/n*100),100):void 0;return(0,fa.jsxs)(re,{"data-slot":"campaign-card",className:m,children:[(0,fa.jsxs)(he,{children:[(0,fa.jsx)(ve,{children:e}),t&&(0,fa.jsx)(uo,{children:t}),(0,fa.jsx)(xg,{children:(0,fa.jsx)(bm,{status:a})})]}),(0,fa.jsxs)(oe,{className:"space-y-4",children:[(0,fa.jsxs)("div",{className:"text-muted-foreground flex flex-wrap gap-3 text-xs",children:[(0,fa.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,fa.jsx)(hu,{className:"size-3.5"}),r.join(", ")]}),o&&(0,fa.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,fa.jsx)(db,{className:"size-3.5"}),o]}),n!==void 0&&(0,fa.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,fa.jsx)(lu,{className:"size-3.5"}),Mv(n,c)]})]}),p!==void 0&&(0,fa.jsxs)("div",{className:"space-y-1.5",children:[(0,fa.jsxs)("div",{className:"text-muted-foreground flex justify-between text-xs",children:[(0,fa.jsxs)("span",{children:[Mv(i,c)," ",u("campaignCard.spent")]}),(0,fa.jsxs)("span",{children:[p,"%"]})]}),(0,fa.jsx)(Po,{value:p})]}),s.length>0&&(0,fa.jsx)("div",{className:"grid gap-2 sm:grid-cols-3",children:s.map(f=>(0,fa.jsxs)("div",{className:l("rounded-lg border p-3"),children:[(0,fa.jsx)("div",{className:"text-muted-foreground text-xs",children:f.label}),(0,fa.jsx)("div",{className:"text-lg font-semibold tabular-nums",children:f.value}),f.helper&&(0,fa.jsx)("div",{className:"text-muted-foreground text-xs",children:f.helper})]},f.label))})]}),d&&(0,fa.jsx)(Ln,{className:"justify-end gap-2",children:d})]})}var Zg=M(require("react"),1);var Lv=require("react-i18next");var Dl=require("react/jsx-runtime"),zv=[{value:"email",label:"",description:""},{value:"sms",label:"",description:""},{value:"push",label:"",description:""},{value:"social",label:"",description:""},{value:"ads",label:"",description:""},{value:"offline",label:"",description:""}],Ak={email:rc,sms:pl,push:rd,social:bu,ads:lb,offline:hu};function Ek({value:e,onChange:t,options:a,multiple:r=!1,disabled:o,className:n}){let{t:i}=(0,Lv.useTranslation)("marketing"),c=Zg.useMemo(()=>(a??zv).map(u=>({...u,label:i(`channelPicker.${u.value}.label`),description:i(`channelPicker.${u.value}.description`)})),[a,i]),s=Zg.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(0,Dl.jsx)("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=Ak[m.value],p=s.includes(m.value);return(0,Dl.jsxs)(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:[(0,Dl.jsx)(u,{className:"size-4 shrink-0"}),(0,Dl.jsxs)("span",{className:"min-w-0",children:[(0,Dl.jsx)("span",{className:"block truncate text-sm font-medium",children:m.label}),m.description&&(0,Dl.jsx)("span",{className:"block truncate text-xs opacity-75",children:m.description})]})]},m.value)})})}var wz=require("react"),Ro=require("recharts");var oi=require("react/jsx-runtime"),Fk=["var(--chart-1)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"],$k=["var(--brand-500)","var(--brand-600)","var(--brand-400)","var(--brand-700)","var(--brand-300)"],Hk=["var(--primary)","var(--success)","var(--warning)","var(--info)","var(--destructive)"];function Vk({children:e,className:t}){return(0,oi.jsx)("div",{className:l("h-[350px] w-full min-w-0",t),"data-slot":"chart-container",children:(0,oi.jsx)(Ro.ResponsiveContainer,{width:"100%",height:"100%",children:e})})}function Ok({active:e,payload:t,label:a,formatter:r}){return!e||!t?.length?null:(0,oi.jsxs)("div",{className:"bg-popover rounded-lg border p-2 text-sm shadow-md",children:[(0,oi.jsx)("p",{className:"mb-1 font-medium",children:a}),t.map((o,n)=>(0,oi.jsxs)("div",{className:"flex items-center gap-2",children:[(0,oi.jsx)("div",{className:"size-2 rounded-full",style:{backgroundColor:o.color}}),(0,oi.jsxs)("span",{className:"text-muted-foreground",children:[o.name,":"]}),(0,oi.jsx)("span",{className:"font-medium",children:r?r(o.value):String(o.value??"")})]},n))]})}var Rz=require("react");var Av=require("react-i18next");var hd=require("react/jsx-runtime"),Uk={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"},Wk={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 _k({variant:e="default",size:t="default",removable:a,onRemove:r,icon:o,className:n,children:i,...c}){let{t:s}=(0,Av.useTranslation)("ui");return(0,hd.jsxs)("span",{"data-slot":"chip","data-variant":e,className:l("inline-flex items-center rounded-full font-medium transition-colors",Uk[e],Wk[t],n),...c,children:[o&&(0,hd.jsx)("span",{className:"-ml-0.5 inline-flex",children:o}),(0,hd.jsx)("span",{className:"truncate",children:i}),a&&(0,hd.jsx)(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:(0,hd.jsx)(ee,{className:"size-3"})})]})}var Ev=M(require("react"),1);var Fv=require("react-i18next");var ji=M(require("react"),1);function us(){let[e,t]=ji.useState(!1),a=ji.useRef(null),r=ji.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=ji.useCallback(()=>{a.current&&clearTimeout(a.current),t(!1)},[]);return ji.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),[e,r,o]}var So=require("react/jsx-runtime");function qk(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((0,So.jsx)("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 Gk({code:e,language:t,filename:a,showLineNumbers:r=!0,showCopy:o=!0,highlightLines:n=[],maxHeight:i=480,className:c,...s}){let{t:d}=(0,Fv.useTranslation)("data"),[m,u]=us(),p=e.split(`
7
+ `),f=Ev.useMemo(()=>qk(e,t??""),[e,t]);return(0,So.jsxs)("div",{"data-slot":"code-block",className:l("group relative overflow-hidden rounded-md border bg-zinc-950 text-zinc-100",c),...s,children:[a&&(0,So.jsxs)("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:[(0,So.jsx)("span",{className:"font-mono",children:a}),t&&(0,So.jsx)("span",{className:"text-[0.65rem] uppercase",children:t})]}),o&&(0,So.jsx)(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?(0,So.jsx)(G,{className:"text-zinc-100"}):(0,So.jsx)(za,{className:"text-zinc-100"})}),(0,So.jsx)("pre",{className:"overflow-auto p-3 font-mono text-xs leading-relaxed",style:{maxHeight:i},children:(0,So.jsx)("code",{children:r?(0,So.jsx)("div",{className:"w-full",children:p.map((x,v)=>(0,So.jsxs)("div",{className:l("flex",n.includes(v+1)&&"bg-zinc-800/60"),children:[(0,So.jsx)("span",{className:"w-8 shrink-0 pr-4 text-right text-zinc-600 select-none",children:v+1}),(0,So.jsx)("span",{className:"flex-1 whitespace-pre",children:p[v]||" "})]},v))}):f})})]})}var $v=M(require("react"),1),Hv=M(require("@uiw/react-codemirror"),1),ef=require("@codemirror/lang-javascript"),ps=require("@codemirror/lang-sql"),Vv=require("@codemirror/lang-json"),Ov=require("@codemirror/lang-css"),Uv=require("@codemirror/lang-html"),Wv=require("@codemirror/theme-one-dark"),_v=require("react-i18next");var yd=require("react/jsx-runtime");function jk(e,t){switch(e){case"javascript":return[(0,ef.javascript)({jsx:!1,typescript:!1})];case"typescript":return[(0,ef.javascript)({jsx:!1,typescript:!0})];case"json":return[(0,Vv.json)()];case"sql":{let a=t??"standard";return a==="mysql"?[(0,ps.sql)({dialect:ps.MySQL})]:a==="postgresql"?[(0,ps.sql)({dialect:ps.PostgreSQL})]:[(0,ps.sql)({})]}case"mysql":return[(0,ps.sql)({dialect:ps.MySQL})];case"postgresql":return[(0,ps.sql)({dialect:ps.PostgreSQL})];case"css":return[(0,Ov.css)()];case"html":return[(0,Uv.html)()];default:return[]}}function xm({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}=(0,_v.useTranslation)("data"),[x,v]=us(),N=$v.useMemo(()=>jk(a,r),[a,r]),h={minHeight:c||void 0,maxHeight:s};return(0,yd.jsxs)("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&&(0,yd.jsx)(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?(0,yd.jsx)(G,{className:"text-zinc-100"}):(0,yd.jsx)(za,{className:"text-zinc-100"})}),(0,yd.jsx)(Hv.default,{value:e,extensions:N,theme:Wv.oneDark,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}:{}})]})}var Ml=M(require("react"),1),qv=require("react-i18next"),Nd=require("cmdk");var ca=require("react/jsx-runtime"),Kk=e=>e.flatMap(t=>t.items);function Qk({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}=(0,qv.useTranslation)("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]=Ml.useState(!1),x=e??p,v=Ml.useCallback(h=>{e===void 0&&f(h),t?.(h)},[e,t]);Ml.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=Ml.useMemo(()=>Kk(a),[a]);return(0,ca.jsxs)(Ye,{open:x,onOpenChange:v,children:[n&&(0,ca.jsx)(em,{render:n}),(0,ca.jsxs)(Je,{showCloseButton:!1,"data-slot":"command-palette",className:"max-w-xl gap-0 overflow-hidden p-0 sm:max-w-xl",children:[(0,ca.jsx)(Ze,{className:"sr-only",children:d("commandPalette.srTitle")}),(0,ca.jsxs)(Nd.Command,{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:[(0,ca.jsxs)("div",{className:"flex items-center gap-2 border-b px-3",children:[(0,ca.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,ca.jsx)(Nd.Command.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&&(0,ca.jsx)(Uu,{className:"ml-auto",children:Xk(i)})]}),(0,ca.jsxs)(Nd.Command.List,{className:"max-h-80 overflow-y-auto p-1",children:[(0,ca.jsx)(Nd.Command.Empty,{className:"text-muted-foreground px-3 py-8 text-center text-sm",children:u}),a.map(h=>(0,ca.jsx)(Nd.Command.Group,{heading:h.label,children:h.items.map(b=>(0,ca.jsxs)(Nd.Command.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,(0,ca.jsxs)("div",{className:"flex-1 truncate",children:[(0,ca.jsx)("div",{className:"truncate",children:b.label}),b.description&&(0,ca.jsx)("div",{className:"text-muted-foreground truncate text-xs",children:b.description})]}),b.shortcut&&(0,ca.jsx)(Uu,{children:b.shortcut.split("+").map((g,y)=>(0,ca.jsx)(wl,{size:"sm",children:g.trim()},y))})]},b.id))},h.id))]}),N.length>0&&(0,ca.jsxs)("div",{className:"text-muted-foreground flex items-center justify-between border-t px-3 py-2 text-[0.65rem]",children:[(0,ca.jsx)("span",{children:d("commandPalette.totalItems",{count:N.length})}),(0,ca.jsxs)("span",{className:"flex items-center gap-1",children:[(0,ca.jsx)(wl,{size:"sm",children:"\u2191"}),(0,ca.jsx)(wl,{size:"sm",children:"\u2193"}),d("commandPalette.navigate"),(0,ca.jsx)(wl,{size:"sm",children:"\u21B5"}),d("commandPalette.select"),(0,ca.jsx)(wl,{size:"sm",children:"Esc"}),d("commandPalette.close")]})]})]})]})]})}function Xk(e){return e.split("+").map((t,a)=>(0,ca.jsx)(wl,{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))}var Nc=M(require("react"),1);var Gv=require("react-i18next");var Go=require("react/jsx-runtime");function jv({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}=(0,Gv.useTranslation)("navigation"),[u,p]=Nc.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(0,Go.jsx)(Ye,{open:e,onOpenChange:t,children:(0,Go.jsxs)(Je,{"data-slot":"confirm-dialog",showCloseButton:!1,className:"sm:max-w-sm",children:[(0,Go.jsx)(nt,{children:(0,Go.jsxs)("div",{className:"flex items-start gap-3",children:[(0,Go.jsx)("div",{className:"bg-muted flex size-9 shrink-0 items-center justify-center rounded-full",children:d??(0,Go.jsx)(ir,{className:"size-4"})}),(0,Go.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,Go.jsx)(Ze,{children:f}),(0,Go.jsx)(Dt,{children:x})]})]})}),(0,Go.jsxs)(bt,{children:[(0,Go.jsx)(C,{variant:"outline",onClick:()=>t?.(!1),disabled:b,children:N}),(0,Go.jsx)(C,{variant:i==="destructive"?"destructive":"default",onClick:h,disabled:b,children:v})]})]})})}function Yk(){let[e,t]=Nc.useState({open:!1,options:{}}),a=Nc.useCallback(o=>new Promise(n=>{t({open:!0,options:o,resolve:n})}),[]),r=Nc.useCallback(o=>{e.resolve?.(o),t(n=>{let{resolve:i,...c}=n;return{...c,open:!1}})},[e]);return[a,r]}function Jk({state:e,onClose:t}){return(0,Go.jsx)(jv,{open:e.open,onOpenChange:a=>{a||t(!1)},onConfirm:()=>t(!0),...e.options})}var Kv=M(require("react"),1);var Qv=require("react-i18next");var Io=require("react/jsx-runtime");function Zk({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}=(0,Qv.useTranslation)("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]=Kv.useState(()=>{if(typeof window>"u"||m===void 0)return!0;try{return localStorage.getItem(m)===null}catch{return!0}}),k=e??g,w=U=>{try{localStorage.setItem(m,U)}catch{}},R=()=>{w("accepted"),t?.(),e===void 0&&y(!1)},S=()=>{w("rejected"),a?.(),e===void 0&&y(!1)},A=()=>{w("dismissed"),r?.(),e===void 0&&y(!1)},z={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?(0,Io.jsxs)("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",z[u],p),children:[(0,Io.jsx)(ub,{className:"text-muted-foreground size-5 shrink-0"}),(0,Io.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,Io.jsx)("p",{className:"text-sm font-medium",children:x}),(0,Io.jsxs)("p",{className:"text-muted-foreground text-xs",children:[v,d&&(0,Io.jsxs)(Io.Fragment,{children:[" ",(0,Io.jsx)("a",{href:d,className:"text-primary hover:underline",children:b})]})]})]}),(0,Io.jsxs)("div",{className:"flex items-center gap-2 sm:flex-row",children:[(0,Io.jsx)(C,{variant:"outline",size:"sm",onClick:S,children:h}),(0,Io.jsx)(C,{size:"sm",onClick:R,children:N}),(0,Io.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:A,"aria-label":f("cookieBanner.close"),children:(0,Io.jsx)(ee,{})})]})]}):null}var vm=M(require("react"),1);var tf=M(require("react"),1);var jo=require("react/jsx-runtime");function af({fields:e,onSearch:t,onReset:a,layout:r="inline",collapsible:o=!0,loading:n=!1,className:i}){let[c,s]=tf.useState(()=>{let g={};for(let y of e)y.defaultValue!==void 0&&(g[y.key]=y.defaultValue);return g}),[d,m]=tf.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?(0,jo.jsxs)("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:[(0,jo.jsx)("option",{value:"",children:g.placeholder||g.label}),g.options.map(y=>(0,jo.jsx)("option",{value:y.value,children:y.label},y.value))]}):(0,jo.jsx)(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=(0,jo.jsxs)("div",{"data-slot":"filter-bar",className:l("flex flex-wrap items-end gap-3",i),onKeyDown:x,children:[v.map(g=>(0,jo.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,jo.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:g.label}),h(g)]},g.key)),(0,jo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,jo.jsx)(C,{size:"sm",onClick:p,disabled:n,children:"\u67E5\u8BE2"}),(0,jo.jsx)(C,{size:"sm",variant:"outline",onClick:f,disabled:n,children:"\u91CD\u7F6E"}),o&&N>0&&(0,jo.jsx)(C,{size:"sm",variant:"ghost",onClick:()=>m(!d),children:d?"\u6536\u8D77":`\u5C55\u5F00 (${N})`})]})]});return r==="card"?(0,jo.jsx)(re,{"data-slot":"filter-bar",children:(0,jo.jsx)(oe,{className:"pt-4",children:b})}):b}var i4=require("react");var cr=require("react/jsx-runtime");function Zu({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(0,cr.jsxs)("div",{"data-slot":"search-table",className:l("space-y-2",c),children:[(0,cr.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,cr.jsxs)(at,{children:[(0,cr.jsx)(rt,{children:(0,cr.jsx)(K,{children:e.map(m=>(0,cr.jsx)(F,{className:s[m.align||"left"],style:{width:m.width,minWidth:m.width},children:m.title},m.key))})}),(0,cr.jsx)(Oe,{children:r?Array.from({length:5}).map((m,u)=>(0,cr.jsx)(K,{children:e.map((p,f)=>(0,cr.jsx)(D,{children:(0,cr.jsx)(la,{className:"h-4 w-full"})},f))},u)):t.length===0?(0,cr.jsx)(K,{children:(0,cr.jsx)(D,{colSpan:e.length,className:"py-12 text-center text-muted-foreground",children:n})}):t.map((m,u)=>{let p=i?.(m,u);return(0,cr.jsx)(K,{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(0,cr.jsx)(D,{className:l(s[f.align||"left"],f.ellipsis&&"truncate max-w-0"),children:v},f.key)})},String(m[a]||u))})})]})}),o&&(0,cr.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,cr.jsxs)("span",{children:["\u5171 ",o.total," \u6761"]}),(0,cr.jsxs)("div",{className:"flex items-center gap-1",children:[(0,cr.jsx)(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=>(0,cr.jsx)(C,{variant:m===o.current?"default":"outline",size:"sm",onClick:()=>o.onChange(m,o.pageSize),children:m},m)),(0,cr.jsx)(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"})]})]})]})}var Bt=require("react/jsx-runtime");function ew({open:e,onOpenChange:t,title:a,fields:r,record:o,onSubmit:n}){let i=vm.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]=vm.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?(0,Bt.jsxs)("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:[(0,Bt.jsx)("option",{value:"",children:u.placeholder||`\u8BF7\u9009\u62E9${u.label}`}),u.options.map(f=>(0,Bt.jsx)("option",{value:f.value,children:f.label},f.value))]}):u.type==="textarea"?(0,Bt.jsx)("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"?(0,Bt.jsx)("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)}):(0,Bt.jsx)("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(0,Bt.jsx)(Ye,{open:e,onOpenChange:t,children:(0,Bt.jsxs)(Je,{className:"sm:max-w-[560px]",children:[(0,Bt.jsx)(nt,{children:(0,Bt.jsx)(Ze,{children:a})}),(0,Bt.jsx)("div",{className:"grid gap-4 py-2",children:r.map(u=>(0,Bt.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,Bt.jsxs)("label",{className:"text-sm font-medium",children:[u.label,u.required&&(0,Bt.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),m(u)]},u.key))}),(0,Bt.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,Bt.jsx)(C,{variant:"outline",onClick:()=>t?.(!1),children:"\u53D6\u6D88"}),(0,Bt.jsx)(C,{onClick:()=>n?.(c),children:"\u786E\u5B9A"})]})]})})}function Xv({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=vm.useMemo(()=>!h&&!b&&!v?a:[...a,{key:"_operations",title:"\u64CD\u4F5C",width:120,align:"center",render:(w,R)=>(0,Bt.jsxs)("div",{className:"flex items-center justify-center gap-1",children:[(b||v)&&(0,Bt.jsx)(C,{variant:"ghost",size:"sm",onClick:()=>{v?v(R):m?.(!0)},children:"\u7F16\u8F91"}),h&&(0,Bt.jsx)(C,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>h(R),children:"\u5220\u9664"})]})}],[a,h,b,v,m]);return(0,Bt.jsxs)(zg,{"data-slot":"crud-page",className:g,children:[(0,Bt.jsx)(Ag,{title:e}),(0,Bt.jsx)("div",{className:"mb-4",children:(0,Bt.jsx)(af,{fields:t,onSearch:N})}),(p||f||x)&&(0,Bt.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,Bt.jsxs)(Bt.Fragment,{children:[f&&(0,Bt.jsx)(C,{variant:"outline",size:"sm",onClick:f,children:"\u5237\u65B0"}),x&&(0,Bt.jsx)(C,{size:"sm",onClick:x,children:"\u65B0\u589E"})]}),p]}),(0,Bt.jsx)(Zu,{columns:y,dataSource:r,rowKey:o,loading:n,pagination:i}),c&&(0,Bt.jsx)(ew,{open:d,onOpenChange:m,title:s,fields:c,record:u,onSubmit:b},u?`edit-${String(u[o]??"")}`:`new-${d?"1":"0"}`)]})}var h4=require("react");var eo=require("react/jsx-runtime");function tw({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:Re,onClick:()=>{}},{key:"delete",label:"\u5220\u9664",icon:od,onClick:()=>{},danger:!0},{key:"refresh",label:"\u5237\u65B0",icon:zr,onClick:()=>{}}];return(0,eo.jsxs)("div",{"data-slot":"crud-toolbar",className:l("flex flex-wrap items-center gap-2",m),children:[c>0&&s?(0,eo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eo.jsxs)("span",{className:"text-muted-foreground text-sm",children:["\u5DF2\u9009 ",c," \u9879"]}),(0,eo.jsx)(C,{size:"sm",variant:"default",children:s})]}):u.map(p=>(0,eo.jsxs)(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&&(0,eo.jsx)(p.icon,{className:"mr-1.5 size-3.5"}),p.label]},p.key)),n&&(0,eo.jsxs)("div",{className:"relative max-w-xs flex-1",children:[(0,eo.jsx)(te,{className:"text-muted-foreground absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),(0,eo.jsx)(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&&(0,eo.jsxs)(Co,{children:[(0,eo.jsx)(ko,{children:(0,eo.jsx)("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:(0,eo.jsx)(lg,{className:"size-4"})})}),(0,eo.jsx)(wo,{align:"end",children:i.map(p=>(0,eo.jsxs)(Er,{onClick:p.onClick,disabled:p.disabled,className:l(p.danger&&"text-destructive"),children:[p.icon&&(0,eo.jsx)(p.icon,{className:"mr-2 size-4"}),p.label]},p.key))})]})]})}var $e=require("react/jsx-runtime"),aw={email:rc,push:Mn,social:pl,ad:Wr};function rw({mode:e,viewport:t="desktop",title:a,eyebrow:r,body:o,imageUrl:n,cta:i,from:c="Chaos Marketing",className:s}){let d=aw[e];return(0,$e.jsxs)(re,{"data-slot":"creative-preview",className:s,children:[(0,$e.jsx)(he,{children:(0,$e.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,$e.jsx)(d,{className:"size-4"}),"Creative preview",(0,$e.jsx)(L,{variant:"outline",children:e}),(0,$e.jsx)(L,{variant:"secondary",children:t})]})}),(0,$e.jsx)(oe,{children:(0,$e.jsxs)(_o,{defaultValue:t,children:[(0,$e.jsxs)(qo,{children:[(0,$e.jsx)(Xr,{value:"desktop",children:"Desktop"}),(0,$e.jsxs)(Xr,{value:"mobile",children:[(0,$e.jsx)(rd,{}),"Mobile"]})]}),["desktop","mobile"].map(m=>(0,$e.jsx)(An,{value:m,children:(0,$e.jsxs)("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"&&(0,$e.jsx)(ow,{from:c,title:a,...o!==void 0?{body:o}:{},...n!==void 0?{imageUrl:n}:{},...i!==void 0?{cta:i}:{}}),e==="push"&&(0,$e.jsx)(nw,{title:a,...o!==void 0?{body:o}:{}}),e==="social"&&(0,$e.jsx)(sw,{from:c,title:a,...o!==void 0?{body:o}:{},...n!==void 0?{imageUrl:n}:{}}),e==="ad"&&(0,$e.jsx)(iw,{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 rf({imageUrl:e}){return e?(0,$e.jsx)("img",{src:e,alt:"",className:"aspect-video w-full rounded-lg object-cover"}):(0,$e.jsx)("div",{className:"bg-muted text-muted-foreground flex aspect-video w-full items-center justify-center rounded-lg",children:(0,$e.jsx)(Wr,{className:"size-8"})})}function ow({from:e,title:t,body:a,imageUrl:r,cta:o}){return(0,$e.jsxs)("div",{className:"space-y-4",children:[(0,$e.jsxs)("div",{className:"text-muted-foreground border-b pb-3 text-xs",children:["From: ",e]}),(0,$e.jsx)(rf,{...r!==void 0?{imageUrl:r}:{}}),(0,$e.jsxs)("div",{children:[(0,$e.jsx)("h3",{className:"text-xl font-semibold",children:t}),a&&(0,$e.jsx)("p",{className:"text-muted-foreground mt-2 text-sm",children:a})]}),o&&(0,$e.jsx)("div",{className:"bg-primary text-primary-foreground inline-flex rounded-md px-3 py-2 text-sm",children:o})]})}function nw({title:e,body:t}){return(0,$e.jsxs)("div",{className:"bg-muted/30 rounded-xl border p-3",children:[(0,$e.jsx)("div",{className:"text-sm font-medium",children:e}),t&&(0,$e.jsx)("div",{className:"text-muted-foreground mt-1 text-sm",children:t})]})}function sw({from:e,title:t,body:a,imageUrl:r}){return(0,$e.jsxs)("div",{className:"space-y-3",children:[(0,$e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,$e.jsx)("span",{className:"bg-primary/15 size-8 rounded-full"}),e]}),(0,$e.jsxs)("div",{children:[(0,$e.jsx)("div",{className:"font-medium",children:t}),a&&(0,$e.jsx)("p",{className:"text-muted-foreground mt-1 text-sm",children:a})]}),(0,$e.jsx)(rf,{...r!==void 0?{imageUrl:r}:{}})]})}function iw({eyebrow:e,title:t,body:a,imageUrl:r,cta:o}){return(0,$e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-[1fr_1.2fr]",children:[(0,$e.jsx)(rf,{...r!==void 0?{imageUrl:r}:{}}),(0,$e.jsxs)("div",{className:"flex flex-col justify-center",children:[e&&(0,$e.jsx)("div",{className:"text-muted-foreground text-xs font-medium uppercase",children:e}),(0,$e.jsx)("h3",{className:"mt-1 text-xl font-semibold",children:t}),a&&(0,$e.jsx)("p",{className:"text-muted-foreground mt-2 text-sm",children:a}),o&&(0,$e.jsx)("div",{className:"bg-primary text-primary-foreground mt-4 inline-flex w-fit rounded-md px-3 py-2 text-sm",children:o})]})]})}var Cd=M(require("react"),1),Ki=require("@tanstack/react-table");var Cc=require("lucide-react"),ba=require("react/jsx-runtime");function lw({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]=Cd.useState([]),[u,p]=Cd.useState({}),f=Cd.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=(0,Ki.useReactTable)({data:t,columns:f,state:{sorting:d},onSortingChange:m,getCoreRowModel:(0,Ki.getCoreRowModel)(),...i?{getSortedRowModel:(0,Ki.getSortedRowModel)()}:{},enableSorting:i}),v=n==="sm"?"px-2 py-1.5":n==="lg"?"px-4 py-3":"px-3 py-2";return(0,ba.jsx)("div",{"data-slot":"data-table",className:l("overflow-x-auto rounded-lg border border-border",s),children:(0,ba.jsxs)(at,{children:[(0,ba.jsx)(rt,{children:x.getHeaderGroups().map(N=>(0,ba.jsxs)(K,{className:"bg-muted/30",children:[c&&(0,ba.jsx)(F,{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(0,ba.jsx)(F,{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:(0,ba.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Ki.flexRender)(h.column.columnDef.header,h.getContext()),g&&(y==="asc"?(0,ba.jsx)(Cc.ArrowUp,{className:"size-3"}):y==="desc"?(0,ba.jsx)(Cc.ArrowDown,{className:"size-3"}):(0,ba.jsx)(Cc.ArrowUpDown,{className:"size-3 opacity-40"}))]})},h.id)})]},N.id))}),(0,ba.jsx)(Oe,{children:r?Array.from({length:5}).map((N,h)=>(0,ba.jsxs)(K,{children:[c&&(0,ba.jsx)(D,{className:v,children:(0,ba.jsx)(la,{className:"size-4"})}),e.map(b=>(0,ba.jsx)(D,{className:v,children:(0,ba.jsx)(la,{className:"h-4 w-full"})},b.key))]},`skeleton-${h}`)):x.getRowModel().rows.length===0?(0,ba.jsx)(K,{children:(0,ba.jsx)(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(0,ba.jsxs)(Cd.Fragment,{children:[(0,ba.jsxs)(K,{children:[c&&(0,ba.jsx)(D,{className:l(v,"w-10"),children:(0,ba.jsx)("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(0,ba.jsx)(D,{className:l(v,k?.align==="center"&&"text-center",k?.align==="right"&&"text-right"),children:(0,Ki.flexRender)(y.column.columnDef.cell,y.getContext())},y.id)})]}),c&&g&&(0,ba.jsx)(K,{children:(0,ba.jsx)(D,{colSpan:e.length+1,className:"bg-muted/20 px-8 py-4",children:c.rowExpand(N.original)})})]},b)})})]})})}var hm=M(require("react"),1);var Yv=require("react-i18next");var Fn=require("react/jsx-runtime");function dw(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 cw({value:e,onChange:t,placeholder:a,numberOfMonths:r=2,disabled:o,align:n="start",className:i,presets:c=!0}){let{t:s}=(0,Yv.useTranslation)("transfer"),[d,m]=hm.useState(!1),u=a??s("dateRangePicker.placeholder"),p=hm.useMemo(()=>dw(s),[s]),f=hm.useMemo(()=>e?.from?e.to?e.from.getTime()===e.to.getTime()?Mt(e.from,{dateStyle:"medium"}):`${Mt(e.from,{dateStyle:"medium"})} - ${Mt(e.to,{dateStyle:"medium"})}`:Mt(e.from,{dateStyle:"medium"}):u,[e,u]);return(0,Fn.jsxs)(st,{open:d,onOpenChange:m,children:[(0,Fn.jsxs)(it,{render:(0,Fn.jsx)(C,{variant:"outline",disabled:o,className:l("w-[300px] justify-start text-left font-normal",!e?.from&&"text-muted-foreground",i)}),children:[(0,Fn.jsx)(mn,{}),(0,Fn.jsx)("span",{className:"truncate",children:f}),(0,Fn.jsx)(fe,{className:"ml-auto size-4 opacity-50"})]}),(0,Fn.jsx)(lt,{align:n,className:"w-auto p-0",children:(0,Fn.jsxs)("div",{className:"flex",children:[c&&(0,Fn.jsx)("div",{className:"flex w-[140px] flex-col gap-1 border-r p-3",children:p.map(x=>(0,Fn.jsx)(C,{variant:"ghost",size:"sm",className:"justify-start",onClick:()=>{t?.(x.getRange()),m(!1)},children:x.label},x.label))}),(0,Fn.jsx)(bg,{mode:"range",selected:e,...t?{onSelect:t}:{onSelect:()=>{}},numberOfMonths:r,autoFocus:!0,required:!1})]})})]})}var V4=require("react");var xn=require("react/jsx-runtime"),mw={added:"default",removed:"destructive",changed:"secondary",unchanged:"outline"};function uw({items:e,beforeLabel:t="Before",afterLabel:a="After",className:r,...o}){return(0,xn.jsxs)("div",{"data-slot":"diff-viewer",className:l("overflow-hidden rounded-lg border",r),...o,children:[(0,xn.jsxs)("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:[(0,xn.jsx)("span",{children:"Field"}),(0,xn.jsx)("span",{children:t}),(0,xn.jsx)("span",{children:a}),(0,xn.jsx)("span",{children:"Change"})]}),(0,xn.jsx)("div",{className:"divide-y",children:e.map(n=>{let i=n.type??"changed";return(0,xn.jsxs)("div",{className:"grid grid-cols-[minmax(140px,0.7fr)_1fr_1fr_auto] gap-3 px-4 py-3 text-sm",children:[(0,xn.jsx)("span",{className:"font-medium",children:n.label??n.field}),(0,xn.jsx)("span",{className:l(i==="removed"&&"text-destructive line-through"),children:n.before??"-"}),(0,xn.jsx)("span",{className:l(i==="added"&&"text-success",i==="changed"&&"font-medium"),children:n.after??"-"}),(0,xn.jsx)(L,{variant:mw[i],children:i})]},n.field)})})]})}var kc=M(require("react"),1);var gs=require("react/jsx-runtime"),Jv=new Map,pw=1800*1e3,Zv=null;function gw(e){Zv=e}function fw({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=Jv.get(t);if(g&&Date.now()-g.timestamp<pw){f(g.data);return}let y=m??Zv;if(!y){h("No dict fetcher configured");return}let k=!1;return v(!0),h(null),y(t).then(w=>{k||(Jv.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?(0,gs.jsx)("div",{className:l("flex items-center",e),...u,children:(0,gs.jsx)(la,{className:l("w-full",b)})}):N?(0,gs.jsx)("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}):(0,gs.jsx)("div",{"data-slot":"dict-select",className:l("w-full",e),...u,children:(0,gs.jsxs)(Ge,{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:[(0,gs.jsx)(Ke,{className:l(b,"w-full"),children:(0,gs.jsx)(je,{placeholder:n})}),(0,gs.jsxs)(Qe,{children:[i&&r!==void 0&&(0,gs.jsx)(De,{value:"",children:"\u2014"}),p.map(g=>(0,gs.jsx)(De,{value:String(g.value),disabled:g.disabled,children:g.label},String(g.value)))]})]})})}var Rs=M(require("react"),1);var vn=require("react/jsx-runtime");function eh({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]=Rs.useState(!1),[v,N]=Rs.useState(""),[h,b]=Rs.useState(o),[g,y]=Rs.useState(!1),[k,w]=Rs.useState(null),R=Rs.useRef(new Map);Rs.useEffect(()=>{if(!f)return;if(v.length<d){b(o);return}if(i&&R.current.has(v)){b(R.current.get(v));return}let B=setTimeout(()=>{let O=!1;return y(!0),w(null),t(v).then(I=>{O||(i&&R.current.set(v,I),b(I))}).catch(I=>{O||w(I instanceof Error?I.message:"\u67E5\u8BE2\u5931\u8D25")}).finally(()=>{O||y(!1)}),()=>{O=!0}},n);return()=>clearTimeout(B)},[v,f,t,n,i,d,o]);let S=Rs.useRef(void 0),A=h.find(B=>String(B.value)===String(a)),z=A??S.current;A&&(S.current=A);let U=u==="sm"?"sm":"default";return(0,vn.jsx)("div",{"data-slot":"remote-select",className:l("w-full",e),...p,children:(0,vn.jsxs)(Ge,{value:a!==void 0?String(a):void 0,onValueChange:B=>{if(B!=null){let O=h.find(I=>String(I.value)===String(B));O&&(S.current=O),r?.(B)}},open:f,onOpenChange:x,children:[(0,vn.jsx)(Ke,{size:U,className:"w-full",children:(0,vn.jsx)(je,{placeholder:s,children:z?.label??s})}),(0,vn.jsxs)(Qe,{className:"min-w-[var(--anchor-width)]",children:[(0,vn.jsx)("div",{className:"p-2",onClick:B=>B.stopPropagation(),children:(0,vn.jsx)(T,{value:v,onChange:B=>N(B.target.value),placeholder:c,className:"h-8",autoFocus:!0})}),k&&(0,vn.jsx)("div",{className:"px-3 py-2 text-xs text-destructive",children:k}),g?(0,vn.jsx)("div",{className:"p-2",children:(0,vn.jsx)(la,{className:"h-6 w-full"})}):h.length===0?(0,vn.jsx)("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(B=>(0,vn.jsx)(De,{value:String(B.value),disabled:B.disabled,children:B.label},String(B.value)))]})]})})}var th=M(require("react"),1);var Qi=require("react/jsx-runtime"),of=class extends th.Component{constructor(){super(...arguments);ed(this,"state",{hasError:!1,error:null});ed(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||(0,Qi.jsxs)("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:[(0,Qi.jsx)(ir,{className:"size-8 text-destructive"}),(0,Qi.jsxs)("div",{className:"space-y-1",children:[(0,Qi.jsx)("h3",{className:"text-sm font-semibold",children:"\u7EC4\u4EF6\u51FA\u9519\u4E86"}),(0,Qi.jsx)("p",{className:"text-xs text-muted-foreground",children:this.state.error?.message??"\u53D1\u751F\u672A\u77E5\u9519\u8BEF"})]}),(0,Qi.jsxs)(C,{size:"sm",variant:"outline",onClick:this.reset,children:[(0,Qi.jsx)(zr,{}),"\u91CD\u8BD5"]})]})}return this.props.children}};var ep=M(require("react"),1);var oA=require("react");var Xt=require("react/jsx-runtime");function ym({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(0,Xt.jsx)("div",{className:l("space-y-2",m),children:Array.from({length:3}).map((h,b)=>(0,Xt.jsx)("div",{className:"flex gap-3",children:e.map((g,y)=>(0,Xt.jsx)("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(0,Xt.jsxs)("div",{"data-slot":"line-editor",className:l("space-y-2",m),children:[(0,Xt.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,Xt.jsxs)(at,{children:[(0,Xt.jsx)(rt,{children:(0,Xt.jsxs)(K,{children:[(0,Xt.jsx)(F,{className:"w-10 text-center",children:"#"}),e.map(h=>(0,Xt.jsx)(F,{className:v[h.align||"left"],style:{width:h.width,minWidth:h.width},children:h.title},h.key)),!s&&(0,Xt.jsx)(F,{className:"w-16 text-center",children:"\u64CD\u4F5C"})]})}),(0,Xt.jsx)(Oe,{children:t.length===0?(0,Xt.jsx)(K,{children:(0,Xt.jsx)(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)=>(0,Xt.jsxs)(K,{children:[(0,Xt.jsx)(D,{className:"text-center text-sm text-muted-foreground",children:b+1}),e.map(g=>(0,Xt.jsx)(D,{className:v[g.align||"left"],children:N(g,h[g.key],h,b)},g.key)),!s&&(0,Xt.jsx)(D,{className:"text-center",children:(0,Xt.jsx)(C,{variant:"ghost",size:"icon-sm",disabled:t.length<=r,onClick:()=>f(b),className:"text-muted-foreground hover:text-destructive",children:(0,Xt.jsx)("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Xt.jsx)("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&&(0,Xt.jsx)(Oe,{children:(0,Xt.jsxs)(K,{className:"border-t-2 bg-muted/50 font-medium",children:[(0,Xt.jsx)(D,{className:"text-center",children:"\u5408\u8BA1"}),e.map(h=>(0,Xt.jsx)(D,{className:v[h.align||"left"],children:c.includes(h.key)?Number(x[h.key]||0).toLocaleString():""},h.key)),!s&&(0,Xt.jsx)(D,{})]})})]})}),!s&&(0,Xt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Xt.jsx)(C,{variant:"outline",size:"sm",disabled:t.length>=o,onClick:p,children:"\u6DFB\u52A0\u884C"}),i]}),i&&s&&(0,Xt.jsx)("div",{children:i})]})}var $n=require("react/jsx-runtime");function bw({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]=ep.useState(a),f=m?t:u,x=ep.useMemo(()=>[...o.length>0?[{key:"category",title:"Category",width:150,editable:!n,renderEditor:(b,g,y,k)=>(0,$n.jsxs)("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:[(0,$n.jsx)("option",{value:"",children:"Select category"}),o.map(w=>(0,$n.jsx)("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)=>(0,$n.jsx)(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)=>(0,$n.jsx)(Wi,{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)=>(0,$n.jsx)(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=(0,$n.jsxs)("td",{colSpan:x.length+1,className:"px-3 py-2 text-right",children:[(0,$n.jsxs)("span",{className:"mr-6 text-muted-foreground",children:[f.length," items"]}),(0,$n.jsxs)("span",{className:"text-base font-semibold",children:["Total: ",s,N.toFixed(2)]})]});return(0,$n.jsx)("div",{"data-slot":"expense-line-editor",className:l("w-full",e),...d,children:(0,$n.jsx)(ym,{columns:x,data:f,onChange:v,readOnly:n,minRows:i,maxRows:c,footer:h,emptyText:"No expense items added"})})}var ah=require("react-i18next");var ha=require("react/jsx-runtime");function xw({name:e,status:t="running",hypothesis:a,variants:r,primaryMetric:o,className:n}){let{t:i}=(0,ah.useTranslation)("marketing"),c=o??i("experimentSummary.primaryMetric");return(0,ha.jsxs)(re,{"data-slot":"experiment-summary",className:n,children:[(0,ha.jsxs)(he,{children:[(0,ha.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,ha.jsx)(Cu,{className:"size-4"}),e,(0,ha.jsx)(L,{variant:"secondary",children:i(`experimentSummary.status.${t}`)})]}),a&&(0,ha.jsx)(uo,{children:a})]}),(0,ha.jsxs)(oe,{className:"space-y-3",children:[(0,ha.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:c}),(0,ha.jsx)("div",{className:"overflow-hidden rounded-lg border",children:(0,ha.jsxs)("table",{className:"w-full text-sm",children:[(0,ha.jsx)("thead",{className:"bg-muted/30 text-xs text-muted-foreground",children:(0,ha.jsxs)("tr",{children:[(0,ha.jsx)("th",{className:"px-3 py-2 text-left font-medium",children:i("experimentSummary.variant")}),(0,ha.jsx)("th",{className:"px-3 py-2 text-right font-medium",children:i("experimentSummary.sample")}),(0,ha.jsx)("th",{className:"px-3 py-2 text-right font-medium",children:i("experimentSummary.rate")}),(0,ha.jsx)("th",{className:"px-3 py-2 text-right font-medium",children:i("experimentSummary.lift")})]})}),(0,ha.jsx)("tbody",{children:r.map(s=>(0,ha.jsxs)("tr",{className:l("border-t",s.winner&&"bg-success/10"),children:[(0,ha.jsx)("td",{className:"px-3 py-2 font-medium",children:(0,ha.jsxs)("span",{className:"inline-flex items-center gap-2",children:[s.name,s.winner&&(0,ha.jsx)(L,{className:"bg-success text-success-foreground",children:i("experimentSummary.winner")})]})}),(0,ha.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:(s.sampleSize??0).toLocaleString()}),(0,ha.jsxs)("td",{className:"px-3 py-2 text-right tabular-nums",children:[(s.conversionRate??0).toFixed(2),"%"]}),(0,ha.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:s.lift===void 0?"-":`${s.lift>0?"+":""}${s.lift.toFixed(1)}%`})]},s.id))})]})})]})]})}var oh=M(require("react"),1);var nh=require("react-i18next");var sh=require("sonner"),Ko=require("react/jsx-runtime");function rh(e){if(e==null)return"";let t=String(e);return/[",\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function nf(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 vw({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}=(0,nh.useTranslation)("upload"),m=c??d("exportButton.label"),u=oh.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=>rh(w.header)).join(","),y=e.map(w=>b.map(R=>rh(R.format?R.format(w[R.key]):w[R.key])).join(",")),k="\uFEFF"+[g,...y].join(`
8
+ `);nf(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
+ `);nf(new Blob([y],{type:"application/vnd.ms-excel"}),`${t}.xls`)},json:()=>{let b=JSON.stringify(e,null,2);nf(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){sh.toast.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?(0,Ko.jsxs)(C,{"data-slot":"export-button",variant:i,size:n,className:o,onClick:()=>{N[b](),s?.(b,e)},children:[(0,Ko.jsx)(mo,{}),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(0,Ko.jsxs)(Co,{"data-slot":"export-button",children:[(0,Ko.jsxs)(ko,{render:(0,Ko.jsx)(C,{variant:i,size:n,className:l(o)}),children:[(0,Ko.jsx)(mo,{}),m]}),(0,Ko.jsx)(wo,{align:"end",children:a.map(b=>(0,Ko.jsxs)(Er,{onClick:()=>{N[b](),s?.(b,e)},children:[b==="csv"&&(0,Ko.jsx)(Pa,{}),b==="xlsx"&&(0,Ko.jsx)(cu,{}),b==="json"&&(0,Ko.jsx)(Pa,{}),b==="pdf"&&(0,Ko.jsx)(Pa,{}),b==="print"&&(0,Ko.jsx)(_s,{}),h[b]]},b))})]})}var ih=M(require("react"),1);var Xi=require("react/jsx-runtime"),hw={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 yw({value:e,mask:t="phone",canView:a=!1,className:r}){let[o,n]=ih.useState(!1),[,i]=us(),c=typeof t=="function"?t:hw[t],s=a||o?e:c(e);return(0,Xi.jsxs)("span",{"data-slot":"field-mask",className:l("inline-flex items-center gap-1.5 font-mono text-sm",r),children:[(0,Xi.jsx)("span",{className:"select-none",children:s}),!a&&(0,Xi.jsx)(C,{variant:"ghost",size:"icon-xs",className:"size-5",onClick:()=>n(!o),title:o?"\u9690\u85CF":"\u67E5\u770B",children:o?(0,Xi.jsx)(gb,{className:"size-3"}):(0,Xi.jsx)(Cs,{className:"size-3"})}),(0,Xi.jsx)(C,{variant:"ghost",size:"icon-xs",className:"size-5",onClick:()=>i(e),title:"\u590D\u5236",children:(0,Xi.jsx)(za,{className:"size-3"})})]})}var lh=M(require("react"),1);var Xe=require("react/jsx-runtime");function Nw({files:e=[],onFilesChange:t,accept:a,maxFiles:r=10,maxSize:o,className:n}){let[i,c]=lh.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(0,Xe.jsxs)("div",{"data-slot":"file-upload-manager",className:l("space-y-4",n),children:[(0,Xe.jsx)(rm,{onDrop:s,...a!==void 0?{accept:a}:{},maxFiles:r,...o!==void 0?{maxSize:o}:{}}),e.length>0&&(0,Xe.jsxs)("div",{className:"space-y-3",children:[(0,Xe.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Xe.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Xe.jsxs)("span",{className:"text-sm font-medium",children:[e.length," file(s)"]}),(0,Xe.jsxs)(L,{variant:"secondary",children:[(e.reduce((p,f)=>p+(f.size||0),0)/1024).toFixed(1)," ","KB"]})]}),(0,Xe.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Xe.jsx)(C,{variant:i==="list"?"secondary":"ghost",size:"icon-xs",onClick:()=>c("list"),children:(0,Xe.jsx)(ac,{className:"size-3.5"})}),(0,Xe.jsx)(C,{variant:i==="grid"?"secondary":"ghost",size:"icon-xs",onClick:()=>c("grid"),children:(0,Xe.jsx)(uu,{className:"size-3.5"})}),(0,Xe.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:m,children:(0,Xe.jsx)(Le,{className:"size-3.5 text-destructive"})})]})]}),i==="list"?(0,Xe.jsx)("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(0,Xe.jsxs)("div",{className:l("group flex items-center gap-3 rounded-lg border px-3 py-2",N&&"bg-success/5"),children:[(0,Xe.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Xe.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Xe.jsx)("span",{className:"text-sm font-medium truncate",children:p.name}),(0,Xe.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[(p.size/1024).toFixed(1)," KB"]}),v&&x!==null&&(0,Xe.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums",children:[x,"%"]}),N&&(0,Xe.jsx)(L,{variant:"secondary",className:"shrink-0 text-[0.65rem] px-1.5 py-0",children:"Done"})]}),v&&x!==null&&(0,Xe.jsx)(Po,{value:x,className:"mt-1.5 h-1.5"})]}),(0,Xe.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>d(f),className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,Xe.jsx)(Le,{className:"size-3.5"})})]},f)})}):(0,Xe.jsx)("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(0,Xe.jsxs)("div",{className:l("group relative rounded-lg border overflow-hidden",N&&"border-success/30"),children:[p.type?.startsWith("image/")?(0,Xe.jsx)("div",{className:"aspect-square bg-muted flex items-center justify-center text-xs text-muted-foreground",children:"Image"}):(0,Xe.jsx)("div",{className:"aspect-square bg-muted flex items-center justify-center",children:(0,Xe.jsx)("span",{className:"text-xs text-muted-foreground uppercase font-medium",children:p.name?.split(".").pop()||"File"})}),v&&x!==null&&(0,Xe.jsxs)("div",{className:"absolute inset-x-0 bottom-0 bg-background/80 backdrop-blur-sm px-2 py-1.5",children:[(0,Xe.jsx)("div",{className:"flex items-center justify-between text-xs mb-1",children:(0,Xe.jsxs)("span",{className:"tabular-nums",children:[x,"%"]})}),(0,Xe.jsx)(Po,{value:x,className:"h-1.5"})]}),N&&(0,Xe.jsx)("div",{className:"absolute top-1 right-1",children:(0,Xe.jsx)(L,{variant:"secondary",className:"text-[0.6rem] px-1 py-0",children:"Done"})}),(0,Xe.jsxs)("div",{className:"p-2",children:[(0,Xe.jsx)("p",{className:"text-xs truncate font-medium",children:p.name}),(0,Xe.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(p.size/1024).toFixed(1)," KB"]})]}),(0,Xe.jsx)(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:(0,Xe.jsx)(Le,{className:"size-3"})})]},f)})})]})]})}var ni=require("react/jsx-runtime");function Cw({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(0,ni.jsxs)("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:[(0,ni.jsx)("div",{className:"mb-4 flex size-16 items-center justify-center rounded-full bg-muted",children:(0,ni.jsx)(gu,{className:"size-8 text-muted-foreground"})}),(0,ni.jsx)("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:e}),(0,ni.jsx)("p",{className:"mb-6 max-w-sm text-sm text-muted-foreground",children:t}),r&&(0,ni.jsxs)("p",{className:"mb-4 text-xs text-muted-foreground",children:["\u6743\u9650\u7801: ",(0,ni.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:r})]}),a&&(0,ni.jsx)(C,{variant:"outline",onClick:a,children:"\u7533\u8BF7\u6743\u9650"})]})}var FA=require("react");var kd=require("react/jsx-runtime");function sf({label:e,description:t,error:a,required:r,children:o,className:n}){return(0,kd.jsxs)("div",{"data-slot":"form-field",className:l("space-y-1.5",n),children:[e&&(0,kd.jsxs)(we,{children:[e,r&&(0,kd.jsx)("span",{className:"text-destructive",children:"*"})]}),o,t&&!a&&(0,kd.jsx)("p",{className:"text-xs text-muted-foreground",children:t}),a&&(0,kd.jsx)("p",{className:"text-xs text-destructive",children:a})]})}var tp=M(require("react"),1),dh=require("react-i18next");var qr=require("react/jsx-runtime");function lf({steps:e,onComplete:t,className:a}){let{t:r}=(0,dh.useTranslation)("navigation"),[o,n]=tp.useState(0),[i,c]=tp.useState({}),[s,d]=tp.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(0,qr.jsxs)("div",{"data-slot":"form-wizard",className:l("space-y-6",a),children:[(0,qr.jsx)(sm,{activeStep:o,children:e.map(h=>(0,qr.jsx)(Pl,{children:h.title},h.title))}),(0,qr.jsxs)("div",{className:"min-h-[200px] rounded-lg border p-6",children:[(0,qr.jsx)("h3",{className:"text-lg font-semibold mb-1",children:m.title}),m.description&&(0,qr.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:m.description}),m.render({formData:i,updateField:N,errors:s})]}),(0,qr.jsxs)("div",{className:"flex justify-between",children:[(0,qr.jsxs)(C,{variant:"outline",onClick:v,disabled:u,children:[(0,qr.jsx)($t,{className:"size-4 mr-1"}),r("formWizard.back")]}),(0,qr.jsx)(C,{onClick:x,children:p?(0,qr.jsxs)(qr.Fragment,{children:[(0,qr.jsx)(G,{className:"size-4 mr-1"})," ",r("formWizard.submit")]}):(0,qr.jsxs)(qr.Fragment,{children:[r("formWizard.next")," ",(0,qr.jsx)(ke,{className:"size-4 ml-1"})]})})]})]})}var qA=require("react");var hn=require("react/jsx-runtime"),ch={default:"stroke-primary",success:"stroke-success",warning:"stroke-warning",destructive:"stroke-destructive"};function kw({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=O=>{let I=O*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,A=g-N>180?1:0,z=`M ${k.x} ${k.y} A ${f} ${f} 0 ${S} 1 ${w.x} ${w.y}`,U=`M ${k.x} ${k.y} A ${f} ${f} 0 ${A} 1 ${R.x} ${R.y}`,B=c?c(u):`${Math.round(p*100)}%`;return(0,hn.jsxs)("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:[(0,hn.jsxs)("svg",{width:r,height:r,className:"-rotate-90",children:[(0,hn.jsx)("path",{d:z,fill:"none",className:"stroke-muted",strokeWidth:o,strokeLinecap:"round"}),(0,hn.jsx)("path",{d:U,fill:"none",className:l(ch[s],"transition-all duration-500"),strokeWidth:o,strokeLinecap:"round"})]}),(0,hn.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[i&&(0,hn.jsx)("div",{className:"text-2xl font-semibold tabular-nums",children:B}),n&&(0,hn.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:n})]})]})}function ww({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(0,hn.jsxs)("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:[(0,hn.jsxs)("svg",{width:t,height:t,className:"-rotate-90",children:[(0,hn.jsx)("circle",{cx:t/2,cy:t/2,r:s,fill:"none",className:"stroke-muted",strokeWidth:a}),(0,hn.jsx)("circle",{cx:t/2,cy:t/2,r:s,fill:"none",className:l("transition-all duration-500",ch[o]),strokeWidth:a,strokeDasharray:d,strokeDashoffset:m,strokeLinecap:"round"})]}),r&&(0,hn.jsxs)("div",{className:"absolute inset-0 flex items-center justify-center text-[0.65rem] font-medium tabular-nums",children:[Math.round(c),"%"]})]})}var wc=M(require("react"),1),uh=require("react-i18next");var Qo=require("react/jsx-runtime");function df(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function mh(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function Pw(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=df(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 Tw({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}=(0,uh.useTranslation)("chart"),[u]=wc.useState(()=>Date.now()),p=mh(t??new Date(u-365*24*60*60*1e3)),f=mh(a??new Date(u)),x=wc.useMemo(()=>{let R=new Map;for(let S of e)R.set(df(S.date instanceof Date?S.date:new Date(S.date)),S.value);return R},[e]),v=wc.useMemo(()=>Pw(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=wc.useMemo(()=>{let R=[],S=-1;return v.forEach(A=>{let z=A.date.getMonth();z!==S&&A.day===r&&(R.push({x:A.week*(o+n),label:m("heatmapCalendar.monthLabel",{count:A.date.getMonth()+1})}),S=z)}),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(0,Qo.jsxs)("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:[(0,Qo.jsxs)("div",{className:"flex",style:{gap:n},children:[(0,Qo.jsx)("div",{className:"flex flex-col text-[0.6rem] text-muted-foreground",style:{gap:n,paddingTop:o+n+4},children:w.map((R,S)=>(0,Qo.jsx)("div",{style:{height:o,lineHeight:`${o}px`},children:R},S))}),(0,Qo.jsxs)("div",{className:"flex-1",children:[(0,Qo.jsx)("div",{className:"relative mb-1 h-4 text-[0.6rem] text-muted-foreground",children:k.map((R,S)=>(0,Qo.jsx)("span",{className:"absolute",style:{left:R.x},children:R.label},S))}),(0,Qo.jsx)("div",{className:"grid",style:{gridTemplateColumns:`repeat(${h}, ${o}px)`,gridAutoRows:o,gap:n},children:v.map(R=>{let S=b(R.value);return(0,Qo.jsx)("div",{className:"rounded-sm",style:{width:o,height:o,backgroundColor:y(S)},title:`${df(R.date)}: ${R.value}`},`${R.week}-${R.day}`)})})]})]}),s&&(0,Qo.jsxs)("div",{className:"mt-2 flex items-center justify-end gap-1 text-[0.6rem] text-muted-foreground",children:[(0,Qo.jsx)("span",{children:m("heatmapCalendar.less")}),Array.from({length:i}).map((R,S)=>(0,Qo.jsx)("span",{className:"inline-block rounded-sm",style:{width:o,height:o,backgroundColor:y(S)}},S)),(0,Qo.jsx)("span",{children:m("heatmapCalendar.more")})]})]})}var Nm=M(require("react"),1);var Xo=require("react/jsx-runtime");function Rw({value:e,placeholder:t="Empty",multiline:a,disabled:r,validate:o,onSave:n,renderValue:i,className:c,...s}){let[d,m]=Nm.useState(!1),[u,p]=Nm.useState(e),[f,x]=Nm.useState(),[v,N]=Nm.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(0,Xo.jsxs)("div",{"data-slot":"inline-edit",className:l("group/inline-edit inline-flex items-center gap-2",c),...s,children:[(0,Xo.jsx)(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:(0,Xo.jsx)("span",{className:"text-muted-foreground",children:t})}),!r&&(0,Xo.jsx)(C,{type:"button",size:"icon-xs",variant:"ghost",className:"opacity-0 group-hover/inline-edit:opacity-100",onClick:g,"aria-label":"Edit value",children:(0,Xo.jsx)(gl,{})})]})}let b=a?Ta:T;return(0,Xo.jsxs)("div",{"data-slot":"inline-edit",className:l("space-y-1.5",c),...s,children:[(0,Xo.jsxs)("div",{className:"flex items-start gap-2",children:[(0,Xo.jsx)(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)}}),(0,Xo.jsx)(C,{type:"button",size:"icon-sm",onClick:h,disabled:v,"aria-label":"Save value",children:(0,Xo.jsx)(G,{})}),(0,Xo.jsx)(C,{type:"button",size:"icon-sm",variant:"outline",onClick:()=>m(!1),disabled:v,"aria-label":"Cancel editing",children:(0,Xo.jsx)(ee,{})})]}),f&&(0,Xo.jsx)("p",{className:"text-xs text-destructive",children:f})]})}var ap=M(require("react"),1);var cf=require("react/jsx-runtime");function ph(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function Sw({value:e,onChange:t,placeholder:a,readOnly:r,minHeight:o=200,maxHeight:n,autoFormat:i,className:c,onFocus:s,onBlur:d}){let m=ap.useMemo(()=>i?ph(e):e,[i,e]),u=ap.useCallback(p=>{t?.(i?ph(p):p)},[t,i]);return(0,cf.jsx)("div",{"data-slot":"json-editor",className:l("relative",c),children:(0,cf.jsx)(xm,{value:m,onChange:u,language:"json",placeholder:a??'{ "key": "value" }',readOnly:r,minHeight:o,maxHeight:n,onFocus:s,onBlur:d})})}var rp=M(require("react"),1);var gh=require("react-i18next");var ot=require("react/jsx-runtime");function Iw(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yi({name:e}){return(0,ot.jsxs)("span",{className:"text-primary",children:['"',e,'": ']})}function mf({value:e,keyName:t,depth:a=0,defaultCollapsedDepth:r=3,isLast:o=!0}){let[n,i]=rp.useState(a<r);if(e===null)return(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsx)("span",{className:"text-muted-foreground",children:"null"}),!o&&" "]});if(typeof e=="string")return(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsxs)("span",{className:"text-success",children:['"',e,'"']}),!o&&" "]});if(typeof e=="number")return(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsx)("span",{className:"text-info",children:String(e)}),!o&&" "]});if(typeof e=="boolean")return(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsx)("span",{className:"text-warning",children:String(e)}),!o&&" "]});if(Array.isArray(e))return e.length===0?(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsx)("span",{className:"text-muted-foreground",children:"[]"}),!o&&" "]}):(0,ot.jsxs)("div",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsxs)(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&&(0,ot.jsx)("div",{className:"ml-4 border-l pl-3",children:e.map((c,s)=>(0,ot.jsx)("div",{children:(0,ot.jsx)(mf,{value:c,keyName:String(s),depth:a+1,defaultCollapsedDepth:r,isLast:s===e.length-1})},s))})]});if(Iw(e)){let c=Object.keys(e);return c.length===0?(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsx)("span",{className:"text-muted-foreground",children:"{}"}),!o&&" "]}):(0,ot.jsxs)("div",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),(0,ot.jsxs)(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&&(0,ot.jsx)("div",{className:"ml-4 border-l pl-3",children:c.map((s,d)=>(0,ot.jsx)("div",{children:(0,ot.jsx)(mf,{value:e[s],keyName:s,depth:a+1,defaultCollapsedDepth:r,isLast:d===c.length-1})},s))})]})}return(0,ot.jsxs)("span",{children:[t!==void 0&&(0,ot.jsx)(Yi,{name:t}),String(e),!o&&" "]})}function Dw({data:e,defaultCollapsedDepth:t=3,className:a,rootClassName:r,showCopy:o=!0,indentSize:n=2}){let{t:i}=(0,gh.useTranslation)("data"),[c,s]=us(),d=rp.useMemo(()=>JSON.stringify(e,null,n),[e,n]);return(0,ot.jsxs)("div",{className:l("group relative",r),children:[o&&(0,ot.jsx)(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?(0,ot.jsx)(G,{}):(0,ot.jsx)(za,{})}),(0,ot.jsx)("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:(0,ot.jsx)(mf,{value:e,defaultCollapsedDepth:t})})]})}var fh=M(require("react"),1),si=require("@dnd-kit/core"),Bl=require("@dnd-kit/sortable"),bh=require("@dnd-kit/utilities");var xa=require("react/jsx-runtime");function uf({columns:e,onColumnsChange:t,renderCard:a,className:r}){let o=(0,si.useSensors)((0,si.useSensor)(si.PointerSensor,{activationConstraint:{distance:5}}));return(0,xa.jsx)(si.DndContext,{"data-slot":"kanban-board",sensors:o,collisionDetection:si.closestCorners,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=(0,Bl.arrayMove)(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:(0,xa.jsx)("div",{className:l("flex gap-4 overflow-x-auto pb-4",r),children:e.map(i=>(0,xa.jsx)(Mw,{column:i,...a?{renderCard:a}:{}},i.id))})})}function Mw({column:e,renderCard:t}){let[a,r]=fh.useState(!1);return(0,xa.jsxs)("div",{className:"flex w-72 shrink-0 flex-col rounded-lg border bg-muted/30",children:[(0,xa.jsxs)("div",{className:"flex items-center justify-between p-3",children:[(0,xa.jsxs)("div",{className:"flex items-center gap-2",children:[(0,xa.jsx)("h3",{className:"text-sm font-semibold",children:e.title}),(0,xa.jsx)(L,{variant:"secondary",className:"h-5 px-1.5 text-xs",children:e.items.length})]}),(0,xa.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>r(!a),children:(0,xa.jsx)(fe,{className:l("size-4 transition-transform",a&&"-rotate-90")})})]}),(0,xa.jsx)(yg,{open:!a,children:(0,xa.jsx)(Ng,{children:(0,xa.jsx)(Bl.SortableContext,{items:e.items.map(o=>o.id),strategy:Bl.verticalListSortingStrategy,children:(0,xa.jsx)("div",{className:"flex flex-col gap-2 p-2 pt-0 min-h-[40px]",children:e.items.map(o=>(0,xa.jsx)(Bw,{item:o,columnId:e.id,...t?{renderCard:t}:{}},o.id))})})})})]})}function Bw({item:e,columnId:t,renderCard:a}){let{attributes:r,listeners:o,setNodeRef:n,transform:i,transition:c,isDragging:s}=(0,Bl.useSortable)({id:e.id,data:{columnId:t,type:"card"}}),d={transform:bh.CSS.Transform.toString(i),transition:c,opacity:s?.5:1};return(0,xa.jsx)("div",{ref:n,style:d,className:l("rounded-md border bg-background p-3 text-sm shadow-xs",s&&"shadow-md"),children:(0,xa.jsxs)("div",{className:"flex items-start gap-2",children:[(0,xa.jsx)(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:(0,xa.jsx)(Ws,{className:"size-3.5"})}),(0,xa.jsx)("div",{className:"flex-1 min-w-0",children:a?a(e):(0,xa.jsxs)(xa.Fragment,{children:[(0,xa.jsx)("p",{className:"font-medium truncate",children:e.title}),e.description&&(0,xa.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description})]})})]})})}var gE=require("react"),Pc=require("recharts");var ya=require("react/jsx-runtime");function Lw({title:e,value:t,change:a,changeLabel:r,changeType:o="neutral",sparkline:n,target:i,targetLabel:c,icon:s,className:d}){let m={positive:Li,negative:Os,neutral:un},u={positive:"text-success",negative:"text-destructive",neutral:"text-muted-foreground"},p=m[o]??Li;return(0,ya.jsxs)(re,{"data-slot":"kpi-card",className:l(d),children:[(0,ya.jsxs)(he,{className:"flex flex-row items-center justify-between pb-2",children:[(0,ya.jsx)(ve,{className:"text-sm font-medium text-muted-foreground",children:e}),s&&(0,ya.jsx)(s,{className:"size-4 text-muted-foreground"})]}),(0,ya.jsxs)(oe,{children:[(0,ya.jsx)("div",{className:"text-2xl font-bold",children:t}),a!==void 0&&(0,ya.jsxs)("div",{className:l("flex items-center gap-1 mt-1 text-xs",u[o]),children:[(0,ya.jsx)(p,{className:"size-3"}),(0,ya.jsx)("span",{className:"font-medium",children:a}),r&&(0,ya.jsx)("span",{className:"text-muted-foreground",children:r})]}),n&&n.length>0&&(0,ya.jsx)("div",{className:"h-10 mt-3",children:(0,ya.jsx)(Pc.ResponsiveContainer,{width:"100%",height:"100%",children:(0,ya.jsxs)(Pc.AreaChart,{data:n,children:[(0,ya.jsx)("defs",{children:(0,ya.jsxs)("linearGradient",{id:"sparkFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,ya.jsx)("stop",{offset:"0%",stopColor:"hsl(var(--primary))",stopOpacity:.3}),(0,ya.jsx)("stop",{offset:"100%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),(0,ya.jsx)(Pc.Area,{type:"monotone",dataKey:"value",stroke:"hsl(var(--primary))",fill:"url(#sparkFill)",strokeWidth:1.5,dot:!1})]})})}),i!==void 0&&(0,ya.jsxs)("div",{className:"mt-3",children:[(0,ya.jsxs)("div",{className:"flex justify-between text-xs mb-1",children:[(0,ya.jsx)("span",{className:"text-muted-foreground",children:c??"Progress"}),(0,ya.jsxs)("span",{className:"font-medium",children:[i,"%"]})]}),(0,ya.jsx)("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:(0,ya.jsx)("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:i+"%"}})})]})]})]})}var vh=require("react");var hh=require("react-i18next");var wd=require("react"),Aw=require("react/jsx-runtime");var zw=(0,wd.createContext)(null);function xh(){let e=(0,wd.useContext)(zw);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}var Do=require("react/jsx-runtime");function Ew({value:e,onChange:t,options:a,className:r,align:o="end"}){let{t:n}=(0,hh.useTranslation)("language"),{locale:i,setLocale:c}=xh(),s=(0,vh.useMemo)(()=>[{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(0,Do.jsxs)(Co,{"data-slot":"language-switcher",children:[(0,Do.jsxs)(ko,{render:(0,Do.jsx)(C,{variant:"ghost",size:"sm",className:l("gap-1.5",r),"aria-label":n("languageSwitcher.switchLanguage")}),children:[(0,Do.jsx)(pu,{}),(0,Do.jsx)("span",{className:"text-xs",children:p?.nativeLabel??p?.code})]}),(0,Do.jsxs)(wo,{align:o,className:"w-56",children:[(0,Do.jsxs)(Xs,{children:[(0,Do.jsx)(Cl,{children:n("languageSwitcher.selectLanguage")}),(0,Do.jsx)(Ys,{})]}),d.map(f=>(0,Do.jsxs)(Er,{onClick:()=>u(f.code),className:"justify-between",children:[(0,Do.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,Do.jsx)("span",{className:"text-sm",children:f.nativeLabel??f.label}),f.nativeLabel&&f.nativeLabel!==f.label&&(0,Do.jsx)("span",{className:"text-xs text-muted-foreground",children:f.label})]}),f.code===m&&(0,Do.jsx)(G,{className:"size-4"})]},f.code))]})]})}var TE=require("react");var yh=require("react-i18next");var Nr=require("react/jsx-runtime");function Fw({title:e,description:t,icon:a,variant:r="spinner",className:o,...n}){let{t:i}=(0,yh.useTranslation)("transfer"),c=e??i("loadingPage.title");return(0,Nr.jsxs)("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"?(0,Nr.jsx)(Oo,{className:"size-8 animate-spin text-muted-foreground"}):null),r==="dots"&&(0,Nr.jsx)($w,{}),r==="pulse"&&(0,Nr.jsx)(Hw,{}),(0,Nr.jsxs)("div",{className:"space-y-1",children:[(0,Nr.jsx)("p",{className:"text-sm font-medium",children:c}),t&&(0,Nr.jsx)("p",{className:"text-xs text-muted-foreground",children:t})]})]})}function $w(){return(0,Nr.jsx)("div",{className:"flex items-center gap-1.5",children:[0,1,2].map(e=>(0,Nr.jsx)("span",{className:"size-2 animate-bounce rounded-full bg-muted-foreground",style:{animationDelay:`${e*.16}s`}},e))})}function Hw(){return(0,Nr.jsxs)("div",{className:"relative size-10",children:[(0,Nr.jsx)("span",{className:"absolute inset-0 animate-ping rounded-full bg-primary/30"}),(0,Nr.jsx)("span",{className:"absolute inset-2 rounded-full bg-primary"})]})}function Vw({show:e=!0,children:t}){return e?(0,Nr.jsxs)("div",{className:"relative min-h-screen",children:[t&&(0,Nr.jsx)("div",{className:"pointer-events-none opacity-50",children:t}),(0,Nr.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:(0,Nr.jsx)(Oo,{className:"size-8 animate-spin text-primary"})})]}):(0,Nr.jsx)(Nr.Fragment,{children:t})}var DE=require("react");var Nh=require("react-i18next");var Da=require("react/jsx-runtime");function Ch({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(0,Da.jsxs)("svg",{viewBox:`0 0 ${t} ${a}`,width:t,height:a,className:l("overflow-visible",o),"aria-hidden":!0,children:[i&&(0,Da.jsx)("polygon",{points:p,className:"fill-current opacity-20"}),(0,Da.jsx)("polyline",{points:u,fill:"none",stroke:n,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",className:"text-current"})]})}var Ow={number:e=>Q(e),percent:e=>da(e),compact:e=>Q(e,{notation:"compact"}),currency:e=>Q(e,{style:"currency",currency:"CNY"})};function Uw({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}=(0,Nh.useTranslation)("chart"),f=o??p("metricTrend.changeLabel"),x=typeof t=="number"?Ow[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(0,Da.jsx)(re,{"data-slot":"metric-trend",className:l("overflow-hidden",m),...u,children:(0,Da.jsxs)(oe,{className:"flex flex-col gap-2 p-4",children:[(0,Da.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,Da.jsxs)("span",{className:"flex items-center gap-1.5",children:[s,e]}),r!==void 0&&r!==0&&(0,Da.jsxs)("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"&&(0,Da.jsx)(Li,{className:"size-3"}),N==="down"&&(0,Da.jsx)(Os,{className:"size-3"}),N==="flat"&&(0,Da.jsx)(un,{className:"size-3"}),da(Math.abs(v),1)]})]}),(0,Da.jsxs)("div",{className:"flex items-end justify-between gap-2",children:[(0,Da.jsx)("div",{className:"flex items-baseline gap-1",children:d?(0,Da.jsx)("div",{className:"h-7 w-20 animate-pulse rounded bg-muted"}):(0,Da.jsxs)(Da.Fragment,{children:[(0,Da.jsx)("span",{className:"text-2xl font-semibold tabular-nums tracking-tight",children:x}),a&&(0,Da.jsx)("span",{className:"text-xs text-muted-foreground",children:a})]})}),i.length>0&&(0,Da.jsx)("div",{className:l(b==="success"&&"text-success",b==="destructive"&&"text-destructive",b==="default"&&"text-muted-foreground"),children:(0,Da.jsx)(Ch,{data:i})})]}),r!==void 0&&(0,Da.jsxs)("p",{className:"text-[0.65rem] text-muted-foreground",children:[(0,Da.jsx)(kg,{variant:b==="destructive"?"destructive":b==="success"?"success":"default",className:"mr-1 inline-block align-middle"}),f]})]})})}var FE=require("react");var pf=require("react/jsx-runtime");function Ww({children:e,className:t}){return(0,pf.jsx)("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:(0,pf.jsx)("div",{className:"w-full max-w-md",children:e})})}var VE=require("react");var kh=require("react/jsx-runtime");function _w({className:e,fullWidth:t=!0,...a}){return(0,kh.jsx)(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})}var _E=require("react");var Ll=require("react/jsx-runtime");function qw({title:e,description:t,children:a,actions:r,className:o}){return(0,Ll.jsxs)(re,{className:l("w-full",o),children:[(e||t)&&(0,Ll.jsxs)(he,{className:"p-4 pb-2",children:[e&&(0,Ll.jsx)(ve,{className:"text-lg",children:e}),t&&(0,Ll.jsx)(uo,{className:"text-sm",children:t})]}),(0,Ll.jsx)(oe,{className:l("p-4",!(e||t)&&"pt-4"),children:a}),r&&(0,Ll.jsx)(Ln,{className:"p-4 pt-2 border-t",children:r})]})}var rF=require("react");var YE=require("react");var wh=M(require("react"),1);var Mo=require("react/jsx-runtime");function gf({title:e,description:t,breadcrumbItems:a,actions:r,primaryAction:o,secondaryActions:n,className:i}){let c=r??(o||n?.length?(0,Mo.jsxs)("div",{className:"flex items-center gap-2",children:[n,o]}):void 0);return(0,Mo.jsxs)("div",{"data-slot":"page-header",className:l("space-y-2",i),children:[a&&a.length>0&&(0,Mo.jsx)(cg,{children:(0,Mo.jsx)(mg,{children:a.map((s,d)=>{let m=d===a.length-1;return(0,Mo.jsxs)(wh.Fragment,{children:[(0,Mo.jsx)(ug,{children:m||!s.href?(0,Mo.jsx)(gg,{children:s.label}):(0,Mo.jsx)(pg,{href:s.href,children:s.label})}),!m&&(0,Mo.jsx)(fg,{})]},d)})})}),(0,Mo.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,Mo.jsxs)("div",{className:"space-y-1",children:[(0,Mo.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:e}),t&&(0,Mo.jsx)("p",{className:"text-muted-foreground",children:t})]}),c&&(0,Mo.jsx)("div",{className:"flex items-center gap-2",children:c})]})]})}var Ji=require("react/jsx-runtime");function ff({onBack:e,onMenu:t,className:a,...r}){return(0,Ji.jsxs)("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&&(0,Ji.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:e,className:"shrink-0",children:(0,Ji.jsx)(cl,{className:"size-5"})}),(0,Ji.jsx)("div",{className:"flex-1 min-w-0",children:(0,Ji.jsx)(gf,{...r})}),t&&(0,Ji.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:t,className:"shrink-0",children:(0,Ji.jsx)(xu,{className:"size-5"})})]})}var Cm=require("react/jsx-runtime");function Gw({children:e,title:t,description:a,actions:r,onBack:o,onMenu:n,className:i}){return(0,Cm.jsxs)("div",{className:l("min-h-screen bg-background",i),children:[t&&(0,Cm.jsx)(ff,{title:t,...a!==void 0?{description:a}:{},...r!==void 0?{actions:r}:{},...o!==void 0?{onBack:o}:{},...n!==void 0?{onMenu:n}:{}}),(0,Cm.jsx)("main",{className:"p-4 md:p-6",children:e})]})}var iF=require("react");var Ss=require("react/jsx-runtime");function jw({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?(0,Ss.jsx)("div",{className:l("space-y-2",r),children:t.map((i,c)=>(0,Ss.jsx)(re,{className:l("cursor-pointer transition-colors hover:bg-muted/50",a&&"active:bg-muted"),onClick:()=>a?.(i),children:(0,Ss.jsxs)(oe,{className:"p-3",children:[(0,Ss.jsx)("div",{className:"flex items-center justify-between",children:(0,Ss.jsx)("div",{className:"font-medium text-sm",children:o.render?o.render(i):String(i[o.key]??"")})}),(0,Ss.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:n.map(s=>(0,Ss.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Ss.jsxs)("span",{className:"font-medium",children:[s.header,":"]}),(0,Ss.jsx)("span",{children:s.render?s.render(i):String(i[s.key]??"")})]},s.key))})]})},c))}):null}var mF=require("react");var ii=require("react/jsx-runtime");function Kw({children:e,title:t,description:a,trigger:r,actions:o,open:n,onOpenChange:i,className:c}){return(0,ii.jsxs)(Ye,{open:n,onOpenChange:i,children:[r&&(0,ii.jsx)(em,{render:r}),(0,ii.jsxs)(Je,{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:[(0,ii.jsxs)(nt,{className:"p-4 sm:p-0 sm:mb-4 border-b sm:border-0",children:[t&&(0,ii.jsx)(Ze,{children:t}),a&&(0,ii.jsx)(Dt,{children:a})]}),(0,ii.jsx)("div",{className:"flex-1 overflow-auto p-4 sm:p-0",children:e}),o&&(0,ii.jsx)(bt,{className:"p-4 sm:p-0 sm:mt-4 border-t sm:border-0",children:o})]})]})}var fF=require("react");var Ph=require("react/jsx-runtime");function Qw({className:e,...t}){return(0,Ph.jsx)(gd,{className:l("py-8",e),...t})}var Th=require("react/jsx-runtime");function Xw({className:e,...t}){return(0,Th.jsx)(gm,{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})}var CF=require("react");var Rh=require("react/jsx-runtime");function Yw({children:e,onSubmit:t,className:a}){return(0,Rh.jsx)("form",{onSubmit:t,className:l("space-y-4 p-4","md:p-0 md:space-y-6",a),children:e})}var PF=require("react");var Sh=require("react/jsx-runtime");function Jw({className:e,...t}){return(0,Sh.jsx)(sf,{className:l("space-y-2",e),...t})}var IF=require("react");var Ih=require("react/jsx-runtime");function Zw({steps:e,onComplete:t,className:a}){return(0,Ih.jsx)(lf,{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)})}var LF=require("react");var Dh=require("react/jsx-runtime");function eP({className:e,...t}){return(0,Dh.jsx)(T,{className:l("h-12 px-4 text-base","md:h-8 md:px-2.5 md:text-sm",e),...t})}var FF=require("react");var Mh=require("react/jsx-runtime");function tP({className:e,...t}){return(0,Mh.jsx)(uf,{className:l("[&>div]:w-64","md:[&>div]:w-72",e),...t})}var OF=require("react");var Is=require("react/jsx-runtime");function aP({title:e,value:t,change:a,changeType:r="neutral",icon:o,className:n}){let i={positive:Li,negative:Os,neutral:un},c={positive:"text-success",negative:"text-destructive",neutral:"text-muted-foreground"},s=i[r];return(0,Is.jsxs)(re,{className:l(n),children:[(0,Is.jsxs)(he,{className:"flex flex-row items-center justify-between pb-2",children:[(0,Is.jsx)(ve,{className:"text-sm font-medium text-muted-foreground",children:e}),o&&(0,Is.jsx)(o,{className:"size-4 text-muted-foreground"})]}),(0,Is.jsxs)(oe,{children:[(0,Is.jsx)("div",{className:"text-2xl font-bold",children:t}),a&&(0,Is.jsxs)("div",{className:l("flex items-center gap-1 mt-1 text-xs",c[r]),children:[(0,Is.jsx)(s,{className:"size-3"}),(0,Is.jsx)("span",{className:"font-medium",children:a})]})]})]})}var GF=require("react");var Zi=require("react/jsx-runtime");function rP({items:e,className:t}){return(0,Zi.jsx)(Qa,{className:l("w-full",t),children:(0,Zi.jsx)("div",{className:"flex gap-2 p-2",children:e.map((a,r)=>a.href?(0,Zi.jsxs)(C,{variant:a.active?"default":"outline",size:"sm",className:"shrink-0",onClick:a.onClick,render:(0,Zi.jsx)("a",{href:a.href}),children:[a.icon&&(0,Zi.jsx)(a.icon,{className:"size-4 mr-1"}),a.label]},r):(0,Zi.jsxs)(C,{variant:a.active?"default":"outline",size:"sm",className:"shrink-0",onClick:a.onClick,children:[a.icon&&(0,Zi.jsx)(a.icon,{className:"size-4 mr-1"}),a.label]},r))})})}var zl=M(require("react"),1);var Bh=require("react-i18next");var Pd=require("react/jsx-runtime");function oP({onRefresh:e,threshold:t=60,disabled:a,className:r,refreshingText:o,pullText:n,releaseText:i,children:c,...s}){let{t:d}=(0,Bh.useTranslation)("mobile"),m=o??d("pullToRefresh.refreshing"),u=n??d("pullToRefresh.pull"),p=i??d("pullToRefresh.release"),[f,x]=zl.useState(0),[v,N]=zl.useState(!1),h=zl.useRef(0),b=zl.useRef(0),g=zl.useRef(!1),y=zl.useRef(null),k=z=>{if(a||v)return;let U=y.current;if(!U||U.scrollTop>0)return;let B=z.touches[0];B&&(h.current=B.clientY,g.current=!0)},w=z=>{if(!g.current||a||v)return;let U=z.touches[0];if(!U)return;let B=U.clientY-h.current;if(B>0){z.cancelable&&z.preventDefault();let O=Math.min(B*.5,t*1.5);b.current=O,x(O)}},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",A=v?m:S==="release"?p:u;return(0,Pd.jsxs)("div",{ref:y,"data-slot":"pull-to-refresh",onTouchStart:k,onTouchMove:w,onTouchEnd:R,className:l("relative overflow-y-auto",r),...s,children:[(0,Pd.jsxs)("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:[(0,Pd.jsx)(Os,{className:l("size-4 transition-transform",S==="release"&&"rotate-180",v&&"animate-spin")}),(0,Pd.jsx)("span",{children:A})]}),(0,Pd.jsx)("div",{style:{transform:`translateY(${f}px)`,transition:g.current?"none":"transform 0.2s"},children:c})]})}var Td=require("react/jsx-runtime");function nP({options:e,value:t,onValueChange:a,placeholder:r,disabled:o,className:n}){return(0,Td.jsxs)(Ge,{value:t,onValueChange:i=>{i!==null&&a?.(i)},disabled:o,children:[(0,Td.jsx)(Ke,{className:l("h-12 px-4 text-base w-full","md:h-8 md:px-2.5 md:text-sm",n),children:(0,Td.jsx)(je,{placeholder:r})}),(0,Td.jsx)(Qe,{children:e.map(i=>(0,Td.jsx)(De,{value:i.value,children:i.label},i.value))})]})}var r$=require("react");var li=require("react/jsx-runtime");function sP({children:e,title:t,description:a,trigger:r,actions:o,side:n="bottom",open:i,onOpenChange:c,className:s}){return(0,li.jsxs)(ld,{open:i,onOpenChange:c,children:[r&&(0,li.jsx)($g,{render:r}),(0,li.jsxs)(dd,{side:n,className:l("h-[80vh]","sm:h-auto sm:max-h-[90vh]",s),children:[(0,li.jsxs)(cd,{className:"p-4 border-b",children:[t&&(0,li.jsx)(md,{children:t}),a&&(0,li.jsx)(nm,{children:a})]}),(0,li.jsx)("div",{className:"flex-1 overflow-auto p-4",children:e}),o&&(0,li.jsx)(Vg,{className:"p-4 border-t",children:o})]})]})}var ma=require("react/jsx-runtime");function iP({className:e,...t}){return(0,ma.jsxs)("div",{className:l("flex items-center gap-3 border-b p-3",e),...t,children:[(0,ma.jsx)("div",{className:"size-10 shrink-0 animate-pulse rounded-full bg-muted"}),(0,ma.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,ma.jsx)("div",{className:"h-3 w-2/3 animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]}),(0,ma.jsx)("div",{className:"size-6 animate-pulse rounded bg-muted"})]})}function lP({className:e,...t}){return(0,ma.jsxs)("div",{className:l("space-y-3 rounded-lg border p-4",e),...t,children:[(0,ma.jsx)("div",{className:"h-4 w-1/3 animate-pulse rounded bg-muted"}),(0,ma.jsxs)("div",{className:"space-y-2",children:[(0,ma.jsx)("div",{className:"h-3 w-full animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-3 w-5/6 animate-pulse rounded bg-muted"})]}),(0,ma.jsxs)("div",{className:"flex justify-between",children:[(0,ma.jsx)("div",{className:"h-8 w-16 animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-8 w-16 animate-pulse rounded bg-muted"})]})]})}function dP({className:e,...t}){return(0,ma.jsxs)("div",{className:l("space-y-4 p-4",e),...t,children:[(0,ma.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ma.jsx)("div",{className:"size-12 animate-pulse rounded-full bg-muted"}),(0,ma.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,ma.jsx)("div",{className:"h-4 w-1/2 animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-3 w-1/4 animate-pulse rounded bg-muted"})]})]}),(0,ma.jsx)("div",{className:"aspect-video animate-pulse rounded bg-muted"}),(0,ma.jsxs)("div",{className:"space-y-2",children:[(0,ma.jsx)("div",{className:"h-3 w-full animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-3 w-11/12 animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-3 w-4/5 animate-pulse rounded bg-muted"}),(0,ma.jsx)("div",{className:"h-3 w-3/4 animate-pulse rounded bg-muted"})]})]})}var op=M(require("react"),1);var Tc=require("react/jsx-runtime");function cP({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]=op.useState(null),[f,x]=op.useState(0),[v,N]=op.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,A=R.clientY-u.y;v||N(Math.abs(S)>Math.abs(A)?"x":"y"),v==="x"||!v&&Math.abs(S)>Math.abs(A)?x(S):(v==="y"||!v&&Math.abs(A)>Math.abs(S))&&x(A)},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(0,Tc.jsxs)("div",{"data-slot":"swipe-actions",onTouchStart:h,onTouchMove:b,onTouchEnd:g,className:l("relative overflow-hidden",s),...m,children:[k&&(0,Tc.jsx)("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:(0,Tc.jsxs)("span",{className:"flex items-center gap-1.5",children:[y.icon,y.label]})}),(0,Tc.jsx)("div",{className:"relative bg-background transition-transform",style:{transform:`translateX(${f}px)`,transition:u?"none":"transform 0.2s"},children:d})]})}var m$=require("react");var Rd=require("react/jsx-runtime");function mP({tabs:e,defaultValue:t,className:a}){return(0,Rd.jsxs)(_o,{defaultValue:t||e[0]?.value,className:l("w-full",a),children:[(0,Rd.jsx)(Qa,{className:"w-full border-b",children:(0,Rd.jsx)(qo,{className:"w-full justify-start rounded-none border-0 bg-transparent p-0 h-auto",children:e.map(r=>(0,Rd.jsx)(Xr,{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=>(0,Rd.jsx)(An,{value:r.value,className:"p-4 mt-0",children:r.content},r.value))]})}var b$=require("react");var Lh=require("react/jsx-runtime");function uP({className:e,...t}){return(0,Lh.jsx)(Ta,{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})}var di=M(require("react"),1);var zh=require("react-i18next");var wt=require("react/jsx-runtime");function pP({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}=(0,zh.useTranslation)("ui"),[p,f]=di.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(0,wt.jsxs)(st,{"data-slot":"multi-select",open:p,onOpenChange:f,children:[(0,wt.jsxs)(it,{render:(0,wt.jsx)(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:[(0,wt.jsx)("div",{className:"flex flex-1 flex-wrap items-center gap-1 overflow-hidden",children:t.length===0?(0,wt.jsx)("span",{children:x}):(0,wt.jsxs)(wt.Fragment,{children:[b.map(y=>{let k=e.find(w=>w.value===y);return(0,wt.jsxs)(L,{variant:"secondary",className:"h-5 gap-0.5 pr-0.5 text-xs",children:[(0,wt.jsx)("span",{className:"max-w-[80px] truncate",children:k?.label??y}),(0,wt.jsx)("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:(0,wt.jsx)(ee,{className:"size-2.5"})})]},y)}),g>0&&(0,wt.jsxs)(L,{variant:"secondary",className:"h-5 text-xs",children:["+",g]})]})}),(0,wt.jsxs)("div",{className:"flex items-center gap-1",children:[m&&t.length>0&&(0,wt.jsx)("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:(0,wt.jsx)(ee,{className:"size-3"})}),(0,wt.jsx)(fe,{className:"size-4 opacity-50"})]})]}),p&&(0,wt.jsx)(lt,{className:"w-[var(--anchor-width)] p-0",align:"start",children:(0,wt.jsx)(gP,{options:e,value:t,onToggle:h,searchPlaceholder:v,emptyText:N})})]})}function gP({options:e,value:t,onToggle:a,searchPlaceholder:r,emptyText:o}){let[n,i]=di.useState(""),c=di.useRef(null);di.useEffect(()=>{c.current?.focus()},[]);let s=di.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=di.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(0,wt.jsxs)(wt.Fragment,{children:[(0,wt.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,wt.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,wt.jsx)(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"})]}),(0,wt.jsxs)("div",{className:"max-h-64 overflow-y-auto p-1",children:[d.length===0&&(0,wt.jsx)("div",{className:"text-muted-foreground px-2 py-6 text-center text-sm",children:o}),d.map(([m,u])=>(0,wt.jsxs)("div",{children:[m&&(0,wt.jsx)("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(0,wt.jsxs)(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:[(0,wt.jsx)("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&&(0,wt.jsx)(G,{className:"size-3"})}),(0,wt.jsxs)("span",{className:"flex-1 truncate",children:[p.label,p.description&&(0,wt.jsx)("span",{className:"text-muted-foreground ml-2 text-xs",children:p.description})]})]},p.value)})]},m||"_default"))]})]})}var Ah=require("react-i18next");var Yt=require("react/jsx-runtime"),fP={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 bP({notifications:e,onMarkRead:t,onMarkAllRead:a,onClear:r,onItemClick:o,align:n="end",className:i,emptyText:c="\u6682\u65E0\u901A\u77E5"}){let{t:s}=(0,Ah.useTranslation)("notification"),d=e.filter(u=>!u.read).length,m=c==="\u6682\u65E0\u901A\u77E5"?s("notificationCenter.emptyText"):c;return(0,Yt.jsxs)(st,{"data-slot":"notification-center",children:[(0,Yt.jsxs)(it,{render:(0,Yt.jsx)(C,{variant:"ghost",size:"icon",className:l("relative",i),"aria-label":s("notificationCenter.ariaLabel",{unreadText:d>0?s("notificationCenter.ariaLabelUnread",{count:d}):""})}),children:[(0,Yt.jsx)(Mn,{}),d>0&&(0,Yt.jsx)(L,{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})]}),(0,Yt.jsxs)(lt,{align:n,className:"w-80 p-0",children:[(0,Yt.jsxs)("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[(0,Yt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Yt.jsx)("span",{className:"text-sm font-semibold",children:s("notificationCenter.title")}),d>0&&(0,Yt.jsx)(L,{variant:"secondary",className:"text-[0.65rem]",children:s("notificationCenter.unreadCount",{count:d})})]}),(0,Yt.jsxs)("div",{className:"flex items-center gap-1",children:[a&&d>0&&(0,Yt.jsx)(C,{size:"sm",variant:"ghost",onClick:a,className:"h-7 px-2 text-xs",children:s("notificationCenter.markAllRead")}),r&&e.length>0&&(0,Yt.jsx)(C,{size:"sm",variant:"ghost",onClick:r,className:"h-7 px-2 text-xs","aria-label":s("notificationCenter.clear"),children:(0,Yt.jsx)(ee,{})})]})]}),(0,Yt.jsx)(Qa,{className:"max-h-80",children:e.length===0?(0,Yt.jsx)("div",{className:"py-4",children:(0,Yt.jsx)(gd,{variant:"default",title:m,description:s("notificationCenter.emptyDescription"),className:"py-6"})}):(0,Yt.jsx)("ul",{className:"flex flex-col",children:e.map(u=>(0,Yt.jsxs)("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:[(0,Yt.jsx)("div",{className:l("mt-0.5 size-2 shrink-0 rounded-full",u.read?"bg-transparent":fP[u.type??"info"])}),(0,Yt.jsxs)("div",{className:"flex-1 space-y-0.5",children:[(0,Yt.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,Yt.jsx)("p",{className:"text-sm font-medium leading-tight",children:u.title}),!u.read&&(0,Yt.jsx)("span",{role:"button","aria-label":s("notificationCenter.markRead"),onClick:p=>{p.stopPropagation(),t?.(u.id)},className:"opacity-0 group-hover:opacity-100",children:(0,Yt.jsx)(G,{className:"size-3.5 text-muted-foreground hover:text-foreground"})})]}),u.description&&(0,Yt.jsx)("p",{className:"text-xs text-muted-foreground",children:u.description}),(0,Yt.jsxs)("div",{className:"flex items-center justify-between pt-0.5",children:[(0,Yt.jsx)("span",{className:"text-[0.65rem] text-muted-foreground",children:qi(u.timestamp)}),u.action&&(0,Yt.jsx)("button",{type:"button",onClick:p=>{p.stopPropagation(),u.action?.onClick()},className:"text-[0.65rem] text-primary hover:underline",children:u.action.label})]})]})]},u.id))})})]})]})}var Eh=M(require("react"),1);var Hn=require("react/jsx-runtime");function xP({className:e,data:t,onChange:a,skuOptions:r=[],onSkuSearch:o,readOnly:n=!1,minRows:i=1,maxRows:c,currency:s="\xA5",...d}){let m=Eh.useMemo(()=>[{key:"sku",title:"SKU",width:200,editable:!n,renderEditor:(v,N,h,b)=>(0,Hn.jsxs)("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:[(0,Hn.jsx)("option",{value:"",children:"Select SKU"}),r.map(g=>(0,Hn.jsxs)("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)=>(0,Hn.jsx)(Wi,{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)=>(0,Hn.jsx)(Wi,{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)=>(0,Hn.jsx)(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=(0,Hn.jsxs)("td",{colSpan:m.length+1,className:"px-3 py-2 text-right",children:[(0,Hn.jsxs)("span",{className:"mr-6 text-muted-foreground",children:[t.length," lines \xB7 ",f," items"]}),(0,Hn.jsxs)("span",{className:"text-base font-semibold",children:["Total: ",s,p.toFixed(2)]})]});return(0,Hn.jsx)("div",{"data-slot":"order-line-editor",className:l("w-full",e),...d,children:(0,Hn.jsx)(ym,{columns:m,data:t,onChange:u,readOnly:n,minRows:i,maxRows:c,footer:x,emptyText:"No items added"})})}var O$=require("react"),Fh=require("react-i18next");var Gr=require("react/jsx-runtime");function vP({roles:e,resources:t,value:a,onChange:r,readOnly:o,className:n,...i}){let{t:c}=(0,Fh.useTranslation)("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(0,Gr.jsx)("div",{"data-slot":"permission-matrix",className:l("overflow-x-auto rounded-lg border",n),...i,children:(0,Gr.jsxs)(at,{children:[(0,Gr.jsx)(rt,{children:(0,Gr.jsxs)(K,{children:[(0,Gr.jsx)(F,{className:"min-w-48",children:c("permissionMatrix.resource")}),e.map(d=>(0,Gr.jsx)(F,{className:"min-w-40 text-center",children:d.label},d.id))]})}),(0,Gr.jsx)(Oe,{children:t.map(d=>(0,Gr.jsxs)(K,{children:[(0,Gr.jsx)(D,{children:(0,Gr.jsxs)("div",{children:[(0,Gr.jsx)("p",{className:"text-sm font-medium",children:d.label}),d.description&&(0,Gr.jsx)("p",{className:"text-xs text-muted-foreground",children:d.description})]})}),e.map(m=>(0,Gr.jsx)(D,{className:"align-top",children:(0,Gr.jsx)("div",{className:"flex flex-col gap-2",children:d.permissions.map(u=>(0,Gr.jsxs)("label",{className:"flex items-center justify-center gap-2 text-xs",children:[(0,Gr.jsx)(po,{checked:(a[m.id]?.[d.id]??[]).includes(u),disabled:o,onCheckedChange:()=>s(m.id,d.id,u)}),(0,Gr.jsx)("span",{children:u})]},u))})},m.id))]},d.id))})]})})}var Rc=M(require("react"),1),$h=require("react-i18next");var Na=require("react/jsx-runtime");function np(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 hP({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}=(0,$h.useTranslation)("data"),[u,p]=Rc.useState(""),f=Rc.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=Rc.useMemo(()=>{let y=new Set,k=new Set;for(let A of f)y.add(String(A[t])),k.add(String(A[a]));let w=Array.from(y).sort(),R=Array.from(k).sort(),S=new Map;for(let A of f){let z=`${A[t]}|${A[a]}`,U=S.get(z)??[],B=A[r];U.push(typeof B=="number"?B:Number(B)||0),S.set(z,U)}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 np(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 np(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 np(k,o)}),g=Rc.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 np(y,o)},[x,o]);return(0,Na.jsxs)(re,{"data-slot":"pivot-table",className:l("overflow-hidden",n),children:[(0,Na.jsxs)(he,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,Na.jsxs)(ve,{className:"text-sm font-medium",children:[String(t)," \xD7 ",String(a)," \xB7 ",o]}),(0,Na.jsx)(T,{value:u,onChange:y=>p(y.target.value),placeholder:m("pivotTable.searchPlaceholder"),className:"h-7 w-48"})]}),(0,Na.jsx)(oe,{className:"p-0",children:(0,Na.jsx)(Qa,{children:(0,Na.jsxs)(at,{className:"w-full text-sm",children:[(0,Na.jsx)(rt,{children:(0,Na.jsxs)(K,{className:"border-b bg-muted/30",children:[(0,Na.jsxs)(F,{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=>(0,Na.jsx)(F,{className:"px-3 py-2 text-right font-medium",children:y},y)),c&&(0,Na.jsx)(F,{className:"bg-muted/50 px-3 py-2 text-right font-medium",children:m("pivotTable.total")})]})}),(0,Na.jsx)(Oe,{children:x.rows.length===0?(0,Na.jsx)(K,{children:(0,Na.jsx)(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)=>(0,Na.jsxs)(K,{className:"border-b last:border-0 hover:bg-muted/20",children:[(0,Na.jsx)(D,{className:"sticky left-0 z-10 bg-background px-3 py-2 font-medium",children:y}),x.cols.map(w=>(0,Na.jsx)(D,{className:"px-3 py-2 text-right tabular-nums",children:v(N(y,w))},w)),c&&(0,Na.jsx)(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&&(0,Na.jsx)(Oi,{children:(0,Na.jsxs)(K,{className:"bg-muted/30 font-semibold",children:[(0,Na.jsx)(D,{className:"sticky left-0 z-10 bg-muted/30 px-3 py-2",children:m("pivotTable.total")}),b.map((y,k)=>(0,Na.jsx)(D,{className:"px-3 py-2 text-right tabular-nums",children:v(y)},k)),c&&(0,Na.jsx)(D,{className:"bg-muted/50 px-3 py-2 text-right tabular-nums",children:v(g)})]})})]})})})]})}var sp=M(require("react"),1),bf=require("react-i18next");var Yo=require("react/jsx-runtime");function yP({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}=(0,bf.useTranslation)("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(0,Yo.jsx)(Ye,{"data-slot":"prompt-dialog",open:e,onOpenChange:t,children:e&&(0,Yo.jsx)(NP,{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 NP({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}=(0,bf.useTranslation)("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]=sp.useState(o??""),[h,b]=sp.useState(!1),[g,y]=sp.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(0,Yo.jsxs)(Je,{showCloseButton:!1,className:"sm:max-w-sm",children:[(0,Yo.jsxs)(nt,{children:[(0,Yo.jsx)(Ze,{children:p}),t&&(0,Yo.jsx)(Dt,{children:t})]}),(0,Yo.jsxs)("div",{className:"flex flex-col gap-1.5",children:[a&&(0,Yo.jsx)(we,{children:a}),(0,Yo.jsx)(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&&(0,Yo.jsx)("p",{className:"text-xs text-destructive",children:g})]}),(0,Yo.jsxs)(bt,{children:[(0,Yo.jsx)(C,{variant:"outline",onClick:m,disabled:h,children:x}),(0,Yo.jsx)(C,{onClick:k,disabled:h,children:f})]})]})}var J$=require("react"),Hh=require("react-i18next");var Sc=require("react/jsx-runtime");function CP({children:e,device:t="desktop",showFrame:a=!0,showLabel:r=!0,className:o}){let{t:n}=(0,Hh.useTranslation)("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(0,Sc.jsxs)("div",{"data-slot":"responsive-preview",className:l("flex flex-col items-center gap-2",o),children:[r&&(0,Sc.jsxs)("div",{className:"text-xs text-muted-foreground font-medium",children:[c.label," (",c.width," \xD7 ",c.height,")"]}),(0,Sc.jsx)("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:(0,Sc.jsx)("div",{className:"w-full h-full overflow-auto",children:e})})]})}var t6=require("react"),Vh=require("react-i18next");var Jo=require("react/jsx-runtime");function kP({principals:e,roles:t,value:a,onChange:r,readOnly:o,className:n,...i}){let{t:c}=(0,Vh.useTranslation)("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(0,Jo.jsx)("div",{"data-slot":"role-assignment",className:l("space-y-3",n),...i,children:e.map(d=>(0,Jo.jsxs)("div",{className:"rounded-lg border p-4",children:[(0,Jo.jsxs)("div",{className:"mb-3 flex items-start justify-between gap-3",children:[(0,Jo.jsxs)("div",{children:[(0,Jo.jsx)("p",{className:"text-sm font-medium",children:d.name}),d.description&&(0,Jo.jsx)("p",{className:"text-xs text-muted-foreground",children:d.description})]}),(0,Jo.jsxs)(L,{variant:"outline",children:[(a[d.id]??[]).length," ",c("roleAssignment.roles")]})]}),(0,Jo.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:t.map(m=>(0,Jo.jsxs)("label",{className:"flex items-start gap-2 rounded-md border p-3",children:[(0,Jo.jsx)(po,{checked:(a[d.id]??[]).includes(m.id),disabled:o,onCheckedChange:()=>s(d.id,m.id)}),(0,Jo.jsxs)("span",{children:[(0,Jo.jsx)("span",{className:"block text-sm font-medium",children:m.label}),m.description&&(0,Jo.jsx)("span",{className:"block text-xs text-muted-foreground",children:m.description})]})]},m.id))})]},d.id))})}var xf=M(require("react"),1),Oh=require("react-i18next");var Pt=require("react/jsx-runtime");function wP({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}=(0,Oh.useTranslation)("data"),d=c==="\u5DF2\u4FDD\u5B58\u7684\u7B5B\u9009"?s("savedFilters.label"):c,[m,u]=xf.useState(""),[p,f]=xf.useState(!1),x=()=>{m.trim()&&(r?.(m.trim()),u(""),f(!1))};return(0,Pt.jsxs)("div",{"data-slot":"saved-filters",className:l("flex items-center gap-2",i),children:[(0,Pt.jsxs)(Co,{children:[(0,Pt.jsxs)(ko,{render:(0,Pt.jsx)(C,{variant:"outline",size:"sm"}),children:[(0,Pt.jsx)(iu,{}),d,(0,Pt.jsx)(fe,{className:"size-3.5 opacity-50"})]}),(0,Pt.jsx)(wo,{align:"start",className:"w-64",children:(0,Pt.jsxs)(Xs,{children:[(0,Pt.jsx)(Cl,{children:d}),(0,Pt.jsx)(Ys,{}),e.length===0?(0,Pt.jsx)("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:s("savedFilters.empty")}):e.map(v=>(0,Pt.jsxs)(Er,{onClick:()=>a?.(v.id),className:"flex items-center justify-between",children:[(0,Pt.jsxs)("span",{className:"flex items-center gap-2",children:[v.isPinned?(0,Pt.jsx)(sg,{className:"size-3.5 text-primary"}):(0,Pt.jsx)(iu,{className:"size-3.5"}),(0,Pt.jsx)("span",{className:"truncate",children:v.name})]}),(0,Pt.jsxs)("div",{className:"flex items-center gap-1",children:[v.id===t&&(0,Pt.jsx)("span",{className:"rounded bg-primary/10 px-1 text-[0.65rem] text-primary",children:s("savedFilters.apply")}),n&&(0,Pt.jsx)(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:(0,Pt.jsx)(iu,{className:"size-3"})}),o&&(0,Pt.jsx)(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:(0,Pt.jsx)(od,{className:"size-3"})})]})]},v.id))]})})]}),r&&(0,Pt.jsxs)(Co,{open:p,onOpenChange:f,children:[(0,Pt.jsxs)(ko,{render:(0,Pt.jsx)(C,{variant:"ghost",size:"sm"}),children:[(0,Pt.jsx)(sg,{}),s("savedFilters.saveCurrent")]}),(0,Pt.jsxs)(wo,{align:"start",className:"w-64 p-3",children:[(0,Pt.jsxs)(Xs,{children:[(0,Pt.jsx)(Cl,{children:s("savedFilters.nameAndSave")}),(0,Pt.jsx)(Ys,{})]}),(0,Pt.jsxs)("div",{className:"flex flex-col gap-2 p-1",children:[(0,Pt.jsx)(T,{value:m,onChange:v=>u(v.target.value),placeholder:s("savedFilters.namePlaceholder"),autoFocus:!0,onKeyDown:v=>{v.key==="Enter"&&x()}}),(0,Pt.jsx)(C,{size:"sm",onClick:x,disabled:!m.trim(),children:s("savedFilters.save")})]})]})]})]})}var km=require("react/jsx-runtime"),PP={wechat:{label:"WeChat",color:"#07C160"},weibo:{label:"Weibo",color:"#E6162D"},qq:{label:"QQ",color:"#12B7F5"},link:{label:"Copy Link",color:"#6B7280"}};function TP({url:e=typeof window<"u"?window.location.href:"",title:t,platforms:a=["wechat","weibo","qq","link"],className:r}){let[o,n]=us(),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(0,km.jsx)("div",{"data-slot":"social-share",className:l("flex items-center gap-2",r),children:a.map(c=>{let s=PP[c];return(0,km.jsx)(C,{variant:"outline",size:"sm",onClick:()=>i(c),style:{borderColor:s.color,color:s.color},children:c==="link"&&o?(0,km.jsx)(G,{}):(0,km.jsx)("span",{children:s.label})},c)})})}var Wh=require("react/jsx-runtime");function Uh({value:e,onChange:t,dialect:a="standard",placeholder:r,readOnly:o,minHeight:n=200,maxHeight:i,className:c,onFocus:s,onBlur:d}){return(0,Wh.jsx)(xm,{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})}var Ds=require("react/jsx-runtime");function RP({title:e,value:t,change:a,changeType:r="neutral",icon:o,className:n}){let i=r==="positive"?os:r==="negative"?rs:un;return(0,Ds.jsxs)(re,{"data-slot":"stat-card",className:l(n),children:[(0,Ds.jsxs)(he,{className:"flex-row items-center justify-between space-y-0 pb-2",children:[(0,Ds.jsx)(ve,{className:"text-sm font-medium text-muted-foreground",children:e}),o&&(0,Ds.jsx)(o,{className:"size-4 text-muted-foreground"})]}),(0,Ds.jsxs)(oe,{children:[(0,Ds.jsx)("div",{className:"text-2xl font-bold",children:t}),a&&(0,Ds.jsxs)("div",{className:"mt-1 flex items-center gap-1 text-xs",children:[(0,Ds.jsx)(i,{className:l("size-3.5",r==="positive"&&"text-success",r==="negative"&&"text-destructive",r==="neutral"&&"text-muted-foreground")}),(0,Ds.jsx)("span",{className:l(r==="positive"&&"text-success",r==="negative"&&"text-destructive",r==="neutral"&&"text-muted-foreground"),children:a})]})]})]})}var k6=require("react");var Vn=require("react/jsx-runtime");function SP({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(0,Vn.jsx)("div",{"data-slot":"stat-card-row",className:l("grid gap-4",r,a),children:e.map((n,i)=>(0,Vn.jsx)(re,{className:l(n.onClick&&"cursor-pointer hover:shadow-md transition-shadow"),onClick:n.onClick,children:(0,Vn.jsx)(oe,{className:"pt-6",children:(0,Vn.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Vn.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Vn.jsx)("p",{className:"text-sm font-medium text-muted-foreground truncate",children:n.title}),(0,Vn.jsx)("p",{className:"mt-2 text-2xl font-bold tabular-nums",children:n.value}),n.description&&(0,Vn.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:n.description}),n.trend&&(0,Vn.jsxs)("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&&(0,Vn.jsx)("div",{className:"mt-2",children:n.sparkline})]}),n.icon&&(0,Vn.jsx)("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))})}var qh=require("react/jsx-runtime"),_h={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 IP({status:e,size:t="default",label:a}){let r=e.toLowerCase(),o=_h[r]??{label:e,className:"bg-muted text-muted-foreground"};return(0,qh.jsx)(L,{"data-slot":"status-tag",className:l(o.className,t==="sm"&&"h-4 px-1.5 text-[0.65rem]"),children:a??o.label})}var B6=require("react");var Ht=require("react/jsx-runtime");function DP({user:e,actions:t=[],showProfile:a=!0,showSettings:r=!0,onProfile:o,onSettings:n,onSignOut:i,align:c="end",className:s}){return(0,Ht.jsxs)(Co,{children:[(0,Ht.jsx)(ko,{render:(0,Ht.jsx)(C,{variant:"ghost",size:"icon",className:l("rounded-full",s),"aria-label":`Open menu for ${e.name}`}),children:(0,Ht.jsxs)(Uo,{className:"size-8",children:[e.avatar&&(0,Ht.jsx)(is,{src:e.avatar,alt:e.name}),(0,Ht.jsx)(Wo,{className:"text-xs",children:ds(e.name)})]})}),(0,Ht.jsxs)(wo,{align:c,className:"w-56",children:[(0,Ht.jsxs)(Xs,{children:[(0,Ht.jsx)(Cl,{className:"font-normal",children:(0,Ht.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,Ht.jsx)("p",{className:"text-sm leading-none font-medium",children:e.name}),e.email&&(0,Ht.jsx)("p",{className:"text-muted-foreground text-xs leading-none",children:e.email}),e.role&&(0,Ht.jsx)("p",{className:"text-muted-foreground mt-1 text-xs leading-none",children:e.role})]})}),(0,Ht.jsx)(Ys,{})]}),a&&(0,Ht.jsxs)(Xs,{children:[(0,Ht.jsx)(Er,{onClick:o,children:(0,Ht.jsx)("span",{children:"\u4E2A\u4EBA\u8D44\u6599"})}),r&&(0,Ht.jsx)(Er,{onClick:n,children:(0,Ht.jsx)("span",{children:"\u8D26\u6237\u8BBE\u7F6E"})})]}),t.length>0&&(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(Ys,{}),(0,Ht.jsx)(Xs,{children:t.map((d,m)=>(0,Ht.jsxs)(Er,{onClick:d.onClick,disabled:d.disabled,variant:d.destructive?"destructive":"default",children:[d.icon,(0,Ht.jsx)("span",{children:d.label})]},`${d.label}-${m}`))})]}),i&&(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(Ys,{}),(0,Ht.jsx)(Er,{onClick:i,variant:"destructive",children:(0,Ht.jsx)("span",{children:"\u9000\u51FA\u767B\u5F55"})})]})]})]})}var jh=M(require("react"),1);var Kh=require("react-i18next");var Fa=require("react/jsx-runtime"),MP={url:"https://example.com/landing",source:"newsletter",medium:"email",campaign:"spring_launch",content:"",term:""};function Gh(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 BP({value:e,onChange:t,className:a}){let{t:r}=(0,Kh.useTranslation)("marketing"),[o,n]=jh.useState({...MP,...e}),i=Gh(o),c=(d,m)=>{let u={...o,[d]:m};n(u),t?.(u,Gh(u))},s=async()=>{!i||typeof navigator>"u"||!navigator.clipboard||await navigator.clipboard.writeText(i)};return(0,Fa.jsxs)(re,{"data-slot":"utm-builder",className:a,children:[(0,Fa.jsxs)(he,{children:[(0,Fa.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,Fa.jsx)(tc,{className:"size-4"}),r("utmBuilder.title")]}),(0,Fa.jsx)(uo,{children:r("utmBuilder.description")})]}),(0,Fa.jsxs)(oe,{className:"space-y-4",children:[(0,Fa.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,Fa.jsx)(Ic,{label:r("utmBuilder.url"),value:o.url,onChange:d=>c("url",d),className:"md:col-span-2"}),(0,Fa.jsx)(Ic,{label:r("utmBuilder.source"),value:o.source,onChange:d=>c("source",d)}),(0,Fa.jsx)(Ic,{label:r("utmBuilder.medium"),value:o.medium,onChange:d=>c("medium",d)}),(0,Fa.jsx)(Ic,{label:r("utmBuilder.campaign"),value:o.campaign,onChange:d=>c("campaign",d)}),(0,Fa.jsx)(Ic,{label:r("utmBuilder.content"),value:o.content??"",onChange:d=>c("content",d)}),(0,Fa.jsx)(Ic,{label:r("utmBuilder.term"),value:o.term??"",onChange:d=>c("term",d)})]}),(0,Fa.jsxs)("div",{className:"bg-muted/30 rounded-lg border p-3",children:[(0,Fa.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,Fa.jsx)("span",{className:"text-muted-foreground text-xs font-medium",children:r("utmBuilder.resultUrl")}),(0,Fa.jsx)(C,{size:"icon-xs",variant:"ghost","aria-label":r("utmBuilder.copyUrl"),disabled:!i,onClick:s,children:(0,Fa.jsx)(za,{})})]}),(0,Fa.jsx)("p",{className:l("text-xs break-all",!i&&"text-destructive"),children:i||r("utmBuilder.invalidUrl")})]})]})]})}function Ic({label:e,value:t,onChange:a,className:r}){let o=`utm-${e.toLowerCase()}`;return(0,Fa.jsxs)("div",{className:l("space-y-1.5",r),children:[(0,Fa.jsx)(we,{htmlFor:o,children:e}),(0,Fa.jsx)(T,{id:o,value:t,onChange:n=>a(n.target.value)})]})}var G6=require("react");var Qh=require("react-i18next");var to=require("react/jsx-runtime");function LP({versions:e,onRestore:t,className:a,...r}){let{t:o}=(0,Qh.useTranslation)("data");return(0,to.jsx)("div",{"data-slot":"version-history",className:l("space-y-3",a),...r,children:e.map((n,i)=>(0,to.jsxs)("div",{className:"relative rounded-lg border p-4",children:[i<e.length-1&&(0,to.jsx)("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"}),(0,to.jsxs)("div",{className:"flex items-start gap-3",children:[(0,to.jsx)("span",{className:"border-background bg-primary relative z-10 mt-1 size-3 rounded-full border-2"}),(0,to.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,to.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,to.jsx)("p",{className:"text-sm font-medium",children:n.title}),(0,to.jsx)(L,{variant:n.current?"default":"outline",children:n.version}),n.current&&(0,to.jsx)(L,{variant:"secondary",children:o("versionHistory.current")})]}),(0,to.jsxs)("p",{className:"text-muted-foreground mt-1 text-xs",children:[n.author," \xB7 ",n.timestamp]}),n.description&&(0,to.jsx)("p",{className:"mt-2 text-sm",children:n.description}),n.changes&&(0,to.jsx)("ul",{className:"text-muted-foreground mt-2 list-disc space-y-1 pl-4 text-xs",children:n.changes.map(c=>(0,to.jsx)("li",{children:c},c))})]}),!n.current&&t&&(0,to.jsxs)(C,{size:"sm",variant:"outline",onClick:()=>t(n),children:[(0,to.jsx)(Cb,{}),o("versionHistory.restore")]})]})]},n.id))})}var J6=require("react");var ip=require("react/jsx-runtime"),vf={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"}},zP={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 hf({className:e,color:t,size:a="md",dot:r=!1,colorConfig:o,children:n,...i}){let s={...vf,...o}[t]??vf.default;return(0,ip.jsxs)("span",{"data-slot":"color-tag",className:l("inline-flex items-center rounded-md border font-medium",s.bg,s.text,s.border,zP[a],e),...i,children:[r&&(0,ip.jsx)("span",{className:l("size-1.5 rounded-full",s.text),"aria-hidden":"true"}),n]})}var tH=require("react");var Yh=require("react/jsx-runtime"),AP={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 Xh({value:e,preset:t,mapping:a,label:r,size:o="md",dot:n=!1,className:i}){let s={...t?AP[t]:{},...a??{}},d=String(e),m=s[d],u=r??m?.[0]??e,p=m?.[1]??"default";return(0,Yh.jsx)(hf,{color:p,size:o,dot:n,className:i,children:u})}var ci=require("sonner");function Dc(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 Jh={duration:3,maxCount:5,placement:"top-right",richColors:!0,expand:!1},yf=Object.assign((e,t)=>(0,ci.toast)(e,Dc(t)),{success:(e,t)=>ci.toast.success(e,Dc(t)),error:(e,t)=>ci.toast.error(e,Dc(t)),warning:(e,t)=>ci.toast.warning(e,Dc(t)),info:(e,t)=>ci.toast.info(e,Dc(t)),loading:(e,t)=>{let a=Dc({...t,duration:t?.duration??0});return ci.toast.loading(e,a)},promise:(e,t)=>ci.toast.promise(e,{loading:t.loading??"Loading...",success:t.success,error:t.error}),destroy:e=>{e!==void 0?ci.toast.dismiss(e):ci.toast.dismiss()},config:e=>{Jh={...Jh,...e}}});function lp(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}var hH=require("react");var Nf=require("react/jsx-runtime");function Zh({className:e,gap:t=3,...a}){let r=typeof t=="number"?`${t*.25}rem`:t;return(0,Nf.jsx)("div",{"data-slot":"dialog-form-body",className:l("flex flex-col py-4",e),style:{gap:r},...a})}function ey({className:e,gap:t=4,direction:a="vertical",...r}){let o=typeof t=="number"?`${t*.25}rem`:t;return(0,Nf.jsx)("div",{"data-slot":"form-stack",className:l("flex",a==="vertical"?"flex-col":"flex-row flex-wrap",e),style:{gap:o},...r})}var dp=M(require("react"),1);var yn=require("react/jsx-runtime"),ty={sm:"gap-2",md:"gap-4",lg:"gap-6"};function ay({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]=dp.useState(c),x=i!==void 0,v=x?i:p,N=dp.useCallback(y=>{x||f(y),s?.(y)},[x,s]),h={maxWidth:r},b={width:"100%",maxWidth:r};if(!n)return(0,yn.jsxs)("div",{"data-slot":"master-detail-layout",className:l("flex flex-col md:flex-row",ty[o],e),...u,children:[(0,yn.jsx)("aside",{className:"w-full shrink-0 md:overflow-y-auto md:border-r",style:h,children:(0,yn.jsx)("div",{style:b,children:t})}),(0,yn.jsx)("div",{className:"min-w-0 flex-1",children:a})]});let g=d??(0,yn.jsx)("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:(0,yn.jsx)(xu,{className:"size-4"})});return(0,yn.jsxs)("div",{"data-slot":"master-detail-layout",className:l("flex flex-col md:flex-row",ty[o],e),...u,children:[(0,yn.jsx)("div",{className:m?"":"md:hidden",children:g}),(0,yn.jsx)("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:(0,yn.jsx)("div",{style:b,children:t})}),v&&(0,yn.jsx)("button",{type:"button","aria-label":"Close master",tabIndex:-1,onClick:()=>N(!1),className:"fixed inset-0 z-40 bg-black/30 md:hidden"}),(0,yn.jsx)("div",{className:"min-w-0 flex-1",children:a})]})}var PH=require("react");var fs=require("react/jsx-runtime");function ry({variant:e="centered",brand:t,brandClassName:a,formMaxWidth:r="420px",className:o,children:n,...i}){return e==="split"||t?(0,fs.jsxs)("div",{"data-slot":"auth-layout","data-variant":"split",className:l("flex min-h-svh bg-background",o),...i,children:[(0,fs.jsx)("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??(0,fs.jsxs)("div",{className:"flex flex-col items-center gap-4 p-8 text-center",children:[(0,fs.jsx)("div",{className:"flex size-16 items-center justify-center rounded-2xl bg-primary text-primary-foreground text-2xl font-bold",children:"C"}),(0,fs.jsx)("div",{className:"text-xl font-semibold",children:"Chaos UI"}),(0,fs.jsx)("div",{className:"max-w-sm text-sm text-muted-foreground",children:"Enterprise management platform"})]})}),(0,fs.jsx)("div",{className:"flex flex-1 items-center justify-center p-4 lg:p-8",children:(0,fs.jsx)("div",{className:"w-full",style:{maxWidth:r},children:n})})]}):(0,fs.jsx)("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:(0,fs.jsx)("div",{className:"w-full",style:{maxWidth:r},children:n})})}var SH=require("react");var On=require("react/jsx-runtime");function EP({title:e="\u7F16\u8F91",onBack:t,onSave:a,onCancel:r,loading:o=!1,children:n,className:i}){return(0,On.jsxs)("div",{"data-slot":"master-edit-template",className:l("flex flex-col gap-4",i),role:"region","aria-label":`\u7F16\u8F91\u9875 ${e}`,children:[(0,On.jsxs)("div",{className:"flex items-center gap-3",children:[t&&(0,On.jsx)(C,{type:"button",variant:"outline",size:"icon","aria-label":"\u8FD4\u56DE",onClick:t,children:(0,On.jsx)(cl,{})}),(0,On.jsx)("h2",{className:"text-lg font-semibold",children:e})]}),(0,On.jsx)("div",{className:"flex-1 rounded-lg border bg-card p-4",children:n}),(0,On.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t pt-3",children:[r&&(0,On.jsx)(C,{type:"button",variant:"outline",onClick:r,disabled:o,icon:(0,On.jsx)(ee,{}),children:"\u53D6\u6D88"}),a&&(0,On.jsx)(C,{type:"button",onClick:a,disabled:o,icon:(0,On.jsx)(xl,{}),"aria-busy":o,children:o?"\u4FDD\u5B58\u4E2D":"\u4FDD\u5B58"})]})]})}var oy=M(require("react"),1);var bs=require("react/jsx-runtime");function FP({title:e="\u5217\u8868",onCreate:t,onSearch:a,searchPlaceholder:r="\u641C\u7D22...",children:o,className:n}){let[i,c]=oy.useState(""),s=d=>{d.preventDefault(),a?.(i)};return(0,bs.jsxs)("div",{"data-slot":"master-list-template",className:l("flex flex-col gap-4",n),role:"region","aria-label":`\u5217\u8868\u9875 ${e}`,children:[(0,bs.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,bs.jsx)("h2",{className:"text-lg font-semibold",children:e}),a&&(0,bs.jsxs)("form",{role:"search",onSubmit:s,className:"relative ml-auto",children:[(0,bs.jsx)(te,{className:"pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,bs.jsx)("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&&(0,bs.jsx)(C,{type:"button",onClick:t,icon:(0,bs.jsx)(Re,{}),children:"\u65B0\u589E"})]}),(0,bs.jsx)("div",{className:"flex-1 rounded-lg border bg-card",children:o??(0,bs.jsx)("p",{className:"p-8 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6570\u636E"})})]})}var cp=M(require("react"),1);var Jt=require("react/jsx-runtime");function $P({photos:e=[],onApprove:t,onReject:a,className:r}){let[o,n]=cp.useState(0),[i,c]=cp.useState(""),[s,d]=cp.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(0,Jt.jsxs)(re,{"data-slot":"photo-audit",className:l("w-full",r),onKeyDown:x,tabIndex:0,role:"group","aria-label":"\u7167\u7247\u5BA1\u6838",children:[(0,Jt.jsx)(he,{children:(0,Jt.jsxs)(ve,{className:"flex items-center justify-between",children:[(0,Jt.jsx)("span",{children:"\u7167\u7247\u5BA1\u6838"}),(0,Jt.jsx)("span",{className:"text-sm font-normal text-muted-foreground tabular-nums",children:e.length>0?`${u+1} / ${e.length}`:"0 / 0"})]})}),(0,Jt.jsxs)(oe,{className:"flex flex-col gap-4",children:[m?(0,Jt.jsxs)("figure",{className:"overflow-hidden rounded-lg border bg-muted",children:[(0,Jt.jsx)("img",{src:m.src,alt:m.alt??`\u7167\u7247 ${u+1}`,className:"h-64 w-full object-cover",loading:"lazy"}),(0,Jt.jsxs)("figcaption",{className:"flex items-center justify-between px-3 py-2 text-sm",children:[(0,Jt.jsx)("span",{className:"truncate text-muted-foreground",children:m.alt??`\u7167\u7247 ${u+1}`}),s[u]?.status==="approved"&&(0,Jt.jsxs)("span",{className:"inline-flex items-center gap-1 text-emerald-600",children:[(0,Jt.jsx)(G,{})," \u5DF2\u901A\u8FC7"]}),s[u]?.status==="rejected"&&(0,Jt.jsxs)("span",{className:"inline-flex items-center gap-1 text-destructive",children:[(0,Jt.jsx)(ee,{})," \u5DF2\u9A73\u56DE"]})]})]}):(0,Jt.jsxs)("div",{className:"flex h-64 flex-col items-center justify-center gap-2 rounded-lg border border-dashed text-muted-foreground",children:[(0,Jt.jsx)(Wr,{className:"size-8"}),(0,Jt.jsx)("span",{className:"text-sm",children:"\u6682\u65E0\u5F85\u5BA1\u6838\u7167\u7247"})]}),m&&(0,Jt.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,Jt.jsx)(Ta,{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}),(0,Jt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Jt.jsxs)(C,{type:"button",variant:"outline",onClick:p,children:[(0,Jt.jsx)(G,{})," \u901A\u8FC7"]}),(0,Jt.jsxs)(C,{type:"button",variant:"destructive",onClick:f,children:[(0,Jt.jsx)(ee,{})," \u9A73\u56DE"]}),(0,Jt.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,Jt.jsx)(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:(0,Jt.jsx)($t,{})}),(0,Jt.jsx)(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:(0,Jt.jsx)(ke,{})})]})]})]})]})]})}var Nn=require("react/jsx-runtime");function HP({logs:e,className:t}){return(0,Nn.jsxs)("ol",{"data-slot":"operation-log",className:l("flex flex-col gap-3",t),role:"list",children:[e.map(a=>(0,Nn.jsxs)("li",{className:"relative flex gap-3 pl-5",children:[(0,Nn.jsx)("span",{"aria-hidden":"true",className:"absolute left-0 top-1.5 size-2 rounded-full bg-primary ring-2 ring-primary/20"}),(0,Nn.jsxs)("div",{className:"flex-1",children:[(0,Nn.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-0.5",children:[(0,Nn.jsx)("span",{className:"text-sm font-medium",children:a.action}),(0,Nn.jsx)("time",{className:"text-xs text-muted-foreground tabular-nums",dateTime:a.timestamp,children:ri(a.timestamp)})]}),(0,Nn.jsxs)("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Nn.jsx)(Ei,{className:"size-3"}),(0,Nn.jsx)("span",{children:a.operator})]}),a.detail?(0,Nn.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a.detail}):null]})]},a.id)),e.length===0?(0,Nn.jsx)("li",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u64CD\u4F5C\u65E5\u5FD7"}):null]})}var mi=require("react/jsx-runtime");function VP({items:e,onItemClick:t,className:a}){return(0,mi.jsx)("ul",{"data-slot":"bill-todo-list",className:l("flex flex-col gap-1",a),children:e.map(r=>(0,mi.jsx)("li",{children:(0,mi.jsxs)("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:[(0,mi.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:r.type}),(0,mi.jsx)("span",{className:"flex-1 truncate",children:r.title}),r.deadline&&(0,mi.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,mi.jsx)(Te,{className:"size-3"}),Mt(r.deadline)]}),(0,mi.jsx)(ke,{className:"size-4 text-muted-foreground"})]})},r.id))})}var mp=M(require("react"),1);var Gt=require("react/jsx-runtime");function OP(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 UP({rules:e=[],onChange:t,className:a}){let[r,o]=mp.useState(e);mp.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(0,Gt.jsxs)(re,{"data-slot":"serial-number-manager",className:l("w-full",a),children:[(0,Gt.jsx)(he,{children:(0,Gt.jsxs)(ve,{className:"flex items-center justify-between",children:[(0,Gt.jsx)("span",{children:"\u7F16\u53F7\u89C4\u5219\u7BA1\u7406"}),(0,Gt.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:c,children:[(0,Gt.jsx)(Re,{})," \u65B0\u589E\u89C4\u5219"]})]})}),(0,Gt.jsx)(oe,{className:"flex flex-col gap-3",children:r.length===0?(0,Gt.jsx)("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"}):(0,Gt.jsx)("ul",{role:"list",className:"flex flex-col gap-3",children:r.map((m,u)=>(0,Gt.jsxs)("li",{className:"flex flex-col gap-3 rounded-lg border bg-muted/30 p-3",children:[(0,Gt.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,Gt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Gt.jsx)(we,{htmlFor:`prefix-${u}`,children:"\u524D\u7F00"}),(0,Gt.jsx)(T,{id:`prefix-${u}`,value:m.prefix,onChange:p=>i(u,{prefix:p.target.value}),placeholder:"BILL"})]}),(0,Gt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Gt.jsx)(we,{htmlFor:`date-${u}`,children:"\u65E5\u671F\u683C\u5F0F"}),(0,Gt.jsx)(T,{id:`date-${u}`,value:m.dateFormat,onChange:p=>i(u,{dateFormat:p.target.value}),placeholder:"yyyyMMdd"})]}),(0,Gt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Gt.jsx)(we,{htmlFor:`fill-${u}`,children:"\u8865\u96F6\u4F4D\u6570"}),(0,Gt.jsx)(T,{id:`fill-${u}`,type:"number",min:0,value:m.zeroFill,onChange:p=>i(u,{zeroFill:Math.max(0,Number(p.target.value)||0)})})]}),(0,Gt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Gt.jsx)(we,{htmlFor:`sep-${u}`,children:"\u5206\u9694\u7B26"}),(0,Gt.jsx)(T,{id:`sep-${u}`,value:m.separator,onChange:p=>i(u,{separator:p.target.value}),placeholder:"-"})]})]}),(0,Gt.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,Gt.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u793A\u4F8B\uFF1A"}),(0,Gt.jsx)("code",{className:"flex-1 truncate rounded bg-card px-2 py-1 text-xs font-mono",children:OP(m)}),(0,Gt.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"\u590D\u5236\u89C4\u5219",onClick:()=>d(u),children:(0,Gt.jsx)(za,{})}),(0,Gt.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"\u5220\u9664\u89C4\u5219",onClick:()=>s(u),children:(0,Gt.jsx)(Le,{})})]})]},u))})})]})}var Mc=M(require("react"),1);var Cr=require("react/jsx-runtime");function WP({schema:e,value:t,onChange:a,className:r}){let o=Mc.useRef(t??{});Mc.useEffect(()=>{t&&(o.current=t)},[t]);let n=Mc.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(0,Cr.jsx)("form",{"data-slot":"dynamic-form-builder",className:l("flex flex-col gap-4",r),onSubmit:c=>c.preventDefault(),children:e.length===0?(0,Cr.jsx)("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=(0,Cr.jsxs)(we,{htmlFor:s,children:[c.label,c.required?(0,Cr.jsx)("span",{className:"ml-0.5 text-destructive",children:"*"}):null]});if(c.type==="select"){let p=i(c.options);return(0,Cr.jsxs)("div",{className:"flex flex-col gap-1.5",children:[m,(0,Cr.jsxs)(Ge,{value:typeof d=="string"?d:void 0,onValueChange:f=>n(c.name,f??""),children:[(0,Cr.jsx)(Ke,{id:s,children:(0,Cr.jsx)(je,{placeholder:"\u8BF7\u9009\u62E9"})}),(0,Cr.jsx)(Qe,{children:p.map(f=>(0,Cr.jsx)(De,{value:f.value,children:f.label},f.value))})]})]},c.name)}if(c.type==="textarea")return(0,Cr.jsxs)("div",{className:"flex flex-col gap-1.5",children:[m,(0,Cr.jsx)(Ta,{id:s,value:typeof d=="string"?d:"",onChange:p=>n(c.name,p.target.value)})]},c.name);if(c.type==="checkbox")return(0,Cr.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Cr.jsx)(po,{id:s,checked:d===!0,onCheckedChange:p=>n(c.name,p===!0)}),(0,Cr.jsx)(we,{htmlFor:s,children:c.label})]},c.name);if(c.type==="switch")return(0,Cr.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[m,(0,Cr.jsx)(ws,{checked:d===!0,onCheckedChange:p=>n(c.name,p)})]},c.name);let u=c.type==="number"||c.type==="date"?c.type:"text";return(0,Cr.jsxs)("div",{className:"flex flex-col gap-1.5",children:[m,(0,Cr.jsx)(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)})})}var Fr=require("react/jsx-runtime");function _P({status:e}){switch(e){case"done":return(0,Fr.jsx)("span",{className:"flex size-6 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,Fr.jsx)(G,{className:"size-3.5"})});case"active":return(0,Fr.jsx)("span",{className:"flex size-6 items-center justify-center rounded-full bg-primary text-primary-foreground",children:(0,Fr.jsx)(Oo,{className:"size-3.5 animate-spin"})});case"rejected":return(0,Fr.jsx)("span",{className:"flex size-6 items-center justify-center rounded-full bg-destructive text-white",children:(0,Fr.jsx)(ee,{className:"size-3.5"})});default:return(0,Fr.jsx)("span",{className:"flex size-6 items-center justify-center rounded-full border border-border bg-background text-muted-foreground",children:(0,Fr.jsx)(Te,{className:"size-3.5"})})}}function qP({steps:e,className:t}){return(0,Fr.jsx)("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(0,Fr.jsxs)("li",{className:"flex gap-3",children:[(0,Fr.jsxs)("div",{className:"flex flex-col items-center",children:[(0,Fr.jsx)(_P,{status:a.status}),o?null:(0,Fr.jsx)("span",{"aria-hidden":"true",className:l("my-1 w-px flex-1",n?"bg-destructive/30":"bg-border")})]}),(0,Fr.jsxs)("div",{className:"flex-1 pb-4",children:[(0,Fr.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,Fr.jsx)("span",{className:"text-sm font-medium",children:a.name}),a.time?(0,Fr.jsx)("time",{className:"text-xs text-muted-foreground tabular-nums",children:a.time}):null]}),a.operator?(0,Fr.jsxs)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["\u64CD\u4F5C\u4EBA\uFF1A",a.operator]}):null]})]},a.id)})})}var Cf=M(require("react"),1);var Xa=require("react/jsx-runtime");function GP({nodes:e=[],onSelect:t,className:a}){let[r,o]=Cf.useState(""),[n,i]=Cf.useState(null),c=e.filter(d=>d.name.toLowerCase().includes(r.trim().toLowerCase())),s=()=>{n&&t?.(n)};return(0,Xa.jsxs)("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:[(0,Xa.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Xa.jsx)("h3",{className:"text-sm font-semibold",children:"\u9009\u62E9\u9A73\u56DE\u8282\u70B9"}),(0,Xa.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:["\u5171 ",e.length," \u4E2A\u8282\u70B9"]})]}),(0,Xa.jsxs)("div",{className:"relative",children:[(0,Xa.jsx)(te,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,Xa.jsx)("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&&(0,Xa.jsx)("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:(0,Xa.jsx)(ee,{className:"size-4"})})]}),(0,Xa.jsx)(dt,{}),(0,Xa.jsx)(Qa,{className:"max-h-64",children:c.length>0?(0,Xa.jsx)("ul",{role:"list",className:"flex flex-col gap-1",children:c.map(d=>{let m=d.id===n;return(0,Xa.jsx)("li",{children:(0,Xa.jsxs)("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:[(0,Xa.jsx)(ft,{className:l("size-4 shrink-0",m?"text-primary":"text-muted-foreground/40")}),(0,Xa.jsx)("span",{className:"flex-1 truncate",children:d.name}),m&&(0,Xa.jsx)(co,{className:"size-4 text-primary"})]})},d.id)})}):(0,Xa.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u65E0\u5339\u914D\u8282\u70B9"})}),(0,Xa.jsx)(dt,{}),(0,Xa.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,Xa.jsx)(C,{type:"button",variant:"default",onClick:s,disabled:!n,children:"\u786E\u8BA4\u9A73\u56DE"})})]})}var up=M(require("react"),1);var Ms=require("react/jsx-runtime"),jP={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 KP({nodes:e,edges:t,className:a}){let r=up.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(0,Ms.jsx)("div",{"data-slot":"approval-flow",className:l("flex flex-wrap items-center gap-2",a),children:r.map((o,n)=>(0,Ms.jsxs)(up.Fragment,{children:[(0,Ms.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border bg-card px-3 py-2 text-sm",children:[(0,Ms.jsx)("span",{className:l("flex size-5 items-center justify-center rounded-full text-xs",jP[o.status??"pending"]??"bg-muted"),children:o.status==="approved"?(0,Ms.jsx)(G,{className:"size-3"}):o.status==="rejected"?(0,Ms.jsx)(ee,{className:"size-3"}):(0,Ms.jsx)(Te,{className:"size-3"})}),(0,Ms.jsx)("span",{className:"font-medium",children:o.name})]}),n<r.length-1&&(0,Ms.jsx)(ke,{className:"size-4 text-muted-foreground"})]},o.id))})}var ui=require("react/jsx-runtime");function QP({onApprove:e,onReject:t,onTransfer:a,status:r,loading:o,className:n}){return(0,ui.jsxs)("div",{"data-slot":"approval-action-bar",className:l("flex items-center gap-2 rounded-lg border bg-card p-3",n),children:[r&&(0,ui.jsxs)("span",{className:"mr-auto text-sm text-muted-foreground",children:["\u5F53\u524D\u72B6\u6001\uFF1A",r]}),a&&(0,ui.jsxs)(C,{variant:"outline",onClick:a,disabled:o,children:[(0,ui.jsx)(qs,{className:"size-4"}),"\u8F6C\u4EA4"]}),t&&(0,ui.jsxs)(C,{variant:"destructive",onClick:t,disabled:o,children:[(0,ui.jsx)(ee,{className:"size-4"}),"\u9A73\u56DE"]}),e&&(0,ui.jsxs)(C,{onClick:e,disabled:o,children:[(0,ui.jsx)(G,{className:"size-4"}),"\u901A\u8FC7"]})]})}var pi=require("react/jsx-runtime");function XP({events:e,className:t}){return(0,pi.jsx)("ol",{"data-slot":"bill-timeline",className:l("flex flex-col gap-3",t),children:e.map(a=>(0,pi.jsxs)("li",{className:"relative flex gap-3 pl-4",children:[(0,pi.jsx)("span",{className:"absolute left-0 top-1.5 size-2 rounded-full bg-primary"}),(0,pi.jsx)("span",{className:"absolute left-[3px] top-4 h-full w-px bg-border"}),(0,pi.jsxs)("div",{children:[(0,pi.jsx)("div",{className:"text-sm font-medium",children:a.title}),a.description&&(0,pi.jsx)("div",{className:"text-xs text-muted-foreground",children:a.description}),(0,pi.jsx)("div",{className:"mt-0.5 text-xs text-muted-foreground",children:ri(a.timestamp)})]})]},a.id))})}var kf=M(require("react"),1);var fo=require("react/jsx-runtime");function YP({billId:e,billType:t,onSubmit:a,className:r}){let[o,n]=kf.useState("idle"),[i,c]=kf.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(0,fo.jsxs)("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:[(0,fo.jsxs)("div",{className:"flex items-center gap-3",children:[(0,fo.jsx)("span",{className:"flex size-9 items-center justify-center rounded-lg bg-muted",children:(0,fo.jsx)(ml,{className:"size-5 text-muted-foreground"})}),(0,fo.jsxs)("div",{className:"flex flex-col",children:[(0,fo.jsx)("span",{className:"text-sm font-medium",children:"\u63D0\u4EA4\u81F3 OA \u7CFB\u7EDF"}),(0,fo.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t," \xB7 ",e]})]}),(0,fo.jsx)(co,{className:"ml-auto size-4 text-muted-foreground"})]}),(0,fo.jsxs)("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"?(0,fo.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-emerald-50 px-3 py-2 text-sm text-emerald-700",role:"status",children:[(0,fo.jsx)(ft,{className:"size-4"}),"\u5DF2\u63D0\u4EA4\u81F3 OA \u7CFB\u7EDF\uFF0C\u5355\u636E ",e," \u8FDB\u5165\u5BA1\u6279\u6D41\u7A0B"]}):o==="error"?(0,fo.jsxs)("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,(0,fo.jsx)("div",{className:"flex justify-end",children:(0,fo.jsx)(C,{type:"button",onClick:s,disabled:o==="submitting"||o==="done",icon:(0,fo.jsx)(qs,{}),"aria-busy":o==="submitting",children:o==="submitting"?"\u63D0\u4EA4\u4E2D":o==="done"?"\u5DF2\u63D0\u4EA4":"\u63D0\u4EA4\u81F3 OA"})})]})}var wf=M(require("react"),1);var Zo=require("react/jsx-runtime"),JP=[{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}],pp=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"];function gp({data:e=JP,orientation:t="vertical",height:a=200,className:r}){let o=Math.max(1,...e.map(s=>s.value));if(t==="horizontal")return(0,Zo.jsx)("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)=>(0,Zo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Zo.jsx)("span",{className:"w-16 shrink-0 truncate text-muted-foreground",children:s.label}),(0,Zo.jsx)("div",{className:"h-5 flex-1 overflow-hidden rounded bg-muted",role:"presentation",children:(0,Zo.jsx)("div",{className:"h-full rounded",style:{width:`${s.value/o*100}%`,backgroundColor:s.color??pp[d%pp.length]},children:(0,Zo.jsx)("span",{className:"sr-only",children:Q(s.value)})})}),(0,Zo.jsx)("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(0,Zo.jsx)("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:(0,Zo.jsx)("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(0,Zo.jsxs)("g",{children:[(0,Zo.jsx)("rect",{x:u,y:a-16-m,width:n,height:m,rx:4,fill:s.color??pp[d%pp.length],children:(0,Zo.jsxs)("title",{children:[s.label,": ",Q(s.value)]})}),(0,Zo.jsx)("text",{x:u+n/2,y:a-4,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:s.label})]},s.label)})})})}var Cn=require("react/jsx-runtime"),fp=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6"];function bp({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(0,Cn.jsxs)("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:[(0,Cn.jsx)("svg",{viewBox:`0 0 320 ${a}`,width:"100%",height:a,preserveAspectRatio:"none",role:"presentation",children:e.map((f,x)=>{let v=f.color??fp[x%fp.length],h=`M ${f.values.map((b,g)=>`${8+g*u},${p(b)}`).join(" L ")}`;return(0,Cn.jsxs)("g",{children:[(0,Cn.jsx)("path",{d:h,fill:"none",stroke:v,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),f.values.map((b,g)=>(0,Cn.jsx)("circle",{cx:8+g*u,cy:p(b),r:2.5,fill:v,children:(0,Cn.jsxs)("title",{children:[f.name," ",t[g]??g,": ",Q(b)]})},g))]},f.name)})}),(0,Cn.jsxs)("ul",{className:"mt-1 flex flex-wrap items-center justify-between gap-2 text-[10px]",children:[(0,Cn.jsx)("li",{className:"flex gap-3",role:"list",children:e.map((f,x)=>(0,Cn.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Cn.jsx)("span",{className:"inline-block size-2 rounded-sm",style:{backgroundColor:f.color??fp[x%fp.length]},"aria-hidden":"true"}),f.name]},f.name))}),(0,Cn.jsx)("li",{className:"flex justify-between text-muted-foreground",role:"list",style:{flex:1},children:t.slice(0,m).map((f,x)=>(0,Cn.jsx)("span",{children:f},x))})]})]})}var Bs=require("react/jsx-runtime"),ny=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4"];function sy(e,t,a,r){let o=r*Math.PI/180;return{x:e+a*Math.cos(o),y:t+a*Math.sin(o)}}function xp({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=sy(o,n,i,f),h=sy(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??ny[m%ny.length]}});return(0,Bs.jsxs)("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:[(0,Bs.jsx)("svg",{viewBox:"0 0 100 100",width:t,height:t,role:"presentation",children:s.map(d=>(0,Bs.jsx)("path",{d:d.path,fill:d.color,children:(0,Bs.jsxs)("title",{children:[d.label,": ",Q(d.value)]})},d.label))}),(0,Bs.jsx)("ul",{className:"flex flex-col gap-1.5 text-sm",role:"list",children:s.map(d=>(0,Bs.jsxs)("li",{className:"flex items-center gap-2",children:[(0,Bs.jsx)("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:d.color},"aria-hidden":"true"}),(0,Bs.jsx)("span",{className:"text-muted-foreground",children:d.label}),(0,Bs.jsx)("span",{className:"ml-auto tabular-nums",children:Q(d.value)})]},d.label))})]})}var kn=require("react/jsx-runtime"),vp=["#3b82f6","#10b981","#f59e0b","#ef4444"];function hp({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(0,kn.jsxs)("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:[(0,kn.jsxs)("svg",{viewBox:"0 0 200 200",width:"100%",role:"presentation",children:[m.map((u,p)=>(0,kn.jsx)("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(0,kn.jsx)("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??vp[p%vp.length];return(0,kn.jsxs)("g",{children:[(0,kn.jsx)("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(0,kn.jsx)("circle",{cx:100+80*h*Math.cos(N),cy:100+80*h*Math.sin(N),r:2,fill:f,children:(0,kn.jsxs)("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(0,kn.jsx)("text",{x,y:v,textAnchor:"middle",dominantBaseline:"middle",className:"fill-muted-foreground text-[9px]",children:u},p)})]}),(0,kn.jsx)("ul",{className:"mt-1 flex flex-wrap justify-center gap-3 text-[10px]",role:"list",children:t.map((u,p)=>(0,kn.jsxs)("li",{className:"flex items-center gap-1",children:[(0,kn.jsx)("span",{className:"inline-block size-2 rounded-sm",style:{backgroundColor:u.color??vp[p%vp.length]},"aria-hidden":"true"}),u.name]},u.name))})]})}var gi=require("react/jsx-runtime"),iy=["#3b82f6","#10b981","#f59e0b","#ef4444"];function yp({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(0,gi.jsx)("div",{"data-slot":"scatter-chart",className:l("w-full",o),role:"img","aria-label":`\u6563\u70B9\u56FE\uFF0C\u5171 ${e.length} \u4E2A\u70B9`,children:(0,gi.jsxs)("svg",{viewBox:`0 0 320 ${r}`,width:"100%",height:r,role:"presentation",children:[(0,gi.jsx)("line",{x1:28,y1:r-28,x2:292,y2:r-28,className:"stroke-muted-foreground/30",strokeWidth:.5}),(0,gi.jsx)("line",{x1:28,y1:28,x2:28,y2:r-28,className:"stroke-muted-foreground/30",strokeWidth:.5}),e.map((h,b)=>(0,gi.jsx)("circle",{cx:v(h.x),cy:N(h.y),r:4,fill:h.color??iy[b%iy.length],children:(0,gi.jsxs)("title",{children:[h.label?`${h.label}: `:"","(",Q(h.x),", ",Q(h.y),")"]})},b)),(0,gi.jsx)("text",{x:292,y:r-28+16,textAnchor:"end",className:"fill-muted-foreground text-[9px]",children:t}),(0,gi.jsx)("text",{x:24,y:28,textAnchor:"end",dominantBaseline:"hanging",className:"fill-muted-foreground text-[9px]",children:a})]})})}var fi=require("react/jsx-runtime");function Sd(e){return typeof e=="number"&&Number.isFinite(e)?e:typeof e=="string"?Number(e):0}function Np(e){return typeof e=="string"?e:e==null?"":String(e)}function ZP({type:e,data:t,xField:a="x",yField:r="y",series:o,height:n=200,className:i}){let c=t,s=wf.useMemo(()=>{let u=new Map;for(let p of c){let f=o?Np(p[o]):"\u9ED8\u8BA4",x=u.get(f);x?x.push(p):u.set(f,[p])}return Array.from(u.entries())},[c,o]),d=wf.useMemo(()=>s[0]?.[1].map(u=>Np(u[a]))??[],[s,a]),m;if(e==="pie"){let u=c.map(p=>({label:Np(p[a]),value:Sd(p[r])}));m=(0,fi.jsx)(xp,{data:u})}else if(e==="scatter"){let u=c.map(p=>({x:Sd(p[a]),y:Sd(p[r])}));m=(0,fi.jsx)(yp,{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=>Sd(v[r]))}));m=(0,fi.jsx)(hp,{axes:u,series:p})}else if(e==="line"){let u=s.map(([p,f])=>({name:p,values:f.map(x=>Sd(x[r]))}));m=(0,fi.jsx)(bp,{series:u,labels:d,height:n})}else{let u=c.map(p=>({label:Np(p[a]),value:Sd(p[r])}));m=(0,fi.jsx)(gp,{data:u,height:n})}return(0,fi.jsxs)("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?(0,fi.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6570\u636E"}):m,(0,fi.jsxs)("p",{className:"sr-only",children:[e," \u56FE\uFF0C",c.length," \u6761\u8BB0\u5F55\uFF0C\u6700\u5927\u503C"," ",Q(Math.max(0,...c.map(u=>Sd(u[r]))))]})]})}var bi=require("react/jsx-runtime"),ly=["#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef"];function eT({data:e,height:t=44,className:a}){let r=e[0]?.value??0,o=e.length;return(0,bi.jsx)("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:(0,bi.jsx)("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(0,bi.jsxs)("li",{className:"flex items-center gap-2 py-0.5",style:{minHeight:t},children:[(0,bi.jsx)("span",{className:"w-20 shrink-0 truncate text-sm text-muted-foreground",children:n.label}),(0,bi.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,bi.jsx)("div",{className:"flex items-center justify-center rounded text-xs font-medium text-white",style:{width:`${c}%`,height:t-8,backgroundColor:n.color??ly[i%ly.length]},children:(0,bi.jsx)("span",{className:"truncate px-2 tabular-nums",children:Q(n.value)})})}),(0,bi.jsx)("span",{className:"w-14 shrink-0 text-right text-xs tabular-nums text-muted-foreground",children:da(s)})]},n.label)})})})}var Tf=M(require("react"),1);var xs=require("react/jsx-runtime");function Pf(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function tT({tasks:e,className:t}){let a=Tf.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,Pf(d,new Date(s))+1);return{min:c,span:m,start:d}},[e]),r=28,o=Tf.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(0,xs.jsxs)("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:[(0,xs.jsxs)("div",{role:"row",className:"flex border-b pb-1",style:{minWidth:96+a.span*r},children:[(0,xs.jsx)("span",{role:"cell",className:"w-24 shrink-0 text-xs text-muted-foreground",children:"\u4EFB\u52A1"}),o.map(n=>(0,xs.jsx)("span",{role:"columnheader",className:"shrink-0 text-center text-[10px] text-muted-foreground",style:{width:r},children:n.label},n.idx))]}),e.length===0?(0,xs.jsx)("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,Pf(a.start,i)),s=Math.max(1,Pf(new Date(n.start),new Date(n.end))+1),d=Math.min(100,Math.max(0,n.progress??0));return(0,xs.jsxs)("div",{role:"row",className:"flex items-center border-b py-1",children:[(0,xs.jsx)("span",{role:"cell",className:"w-24 shrink-0 truncate text-xs",title:n.name,children:n.name}),(0,xs.jsx)("div",{className:"relative flex-1",style:{height:18},children:(0,xs.jsx)("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:`${Mt(n.start)} \u2192 ${Mt(n.end)}`,children:(0,xs.jsx)("div",{className:"h-full bg-primary",style:{width:`${d}%`}})})})]},n.id)})]})}var wm=M(require("react"),1);var $r=require("react/jsx-runtime"),aT=["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"];function dy(e){return e<10?`0${e}`:`${e}`}function cy(e){return`${e.getFullYear()}-${dy(e.getMonth()+1)}-${dy(e.getDate())}`}function rT(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 oT({events:e,onDateSelect:t,className:a}){let r=new Date,[o,n]=wm.useState(new Date(r.getFullYear(),r.getMonth(),1)),[i,c]=wm.useState(null),s=o.getFullYear(),d=o.getMonth(),m=new Date(s,d,1).getDay(),u=new Date(s,d+1,0).getDate(),p=wm.useMemo(()=>rT(e),[e]),f=cy(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:cy(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(0,$r.jsxs)("div",{"data-slot":"calendar-view",className:l("w-full rounded-lg border bg-card p-3 text-sm",a),children:[(0,$r.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,$r.jsx)("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:(0,$r.jsx)($t,{className:"size-4"})}),(0,$r.jsx)("span",{className:"font-medium","aria-live":"polite",children:b}),(0,$r.jsx)("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:(0,$r.jsx)(ke,{className:"size-4"})})]}),(0,$r.jsx)("div",{className:"grid grid-cols-7 gap-1 text-center text-xs text-muted-foreground",role:"row",children:aT.map(g=>(0,$r.jsx)("span",{role:"columnheader",className:"py-1",children:g},g))}),(0,$r.jsx)("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(0,$r.jsx)("span",{role:"gridcell","aria-hidden":"true"},y);let k=g.iso,w=p.get(k)??[],R=k===f,S=k===i;return(0,$r.jsxs)("button",{type:"button",role:"gridcell",tabIndex:0,"aria-label":`${k}${w.length?`\uFF0C${w.length}\u4E2A\u4E8B\u4EF6`:""}`,"aria-pressed":S,onKeyDown:A=>h(A,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&&(0,$r.jsx)("span",{className:"mt-0.5 flex gap-0.5","aria-hidden":"true",children:w.slice(0,3).map(A=>(0,$r.jsx)("span",{className:"size-1.5 rounded-full",style:{backgroundColor:A.color??"currentColor"}},A.id))})]},y)})}),i&&(0,$r.jsxs)("ul",{className:"mt-3 border-t pt-2",role:"list","aria-live":"polite",children:[(p.get(i)??[]).length===0&&(0,$r.jsxs)("li",{className:"text-xs text-muted-foreground",children:[i," \u65E0\u4E8B\u4EF6"]}),p.get(i)?.map(g=>(0,$r.jsxs)("li",{className:"flex items-center gap-1.5 py-0.5 text-xs",children:[(0,$r.jsx)("span",{className:"size-2 rounded-sm",style:{backgroundColor:g.color??"#3b82f6"},"aria-hidden":"true"}),g.title]},g.id))]})]})}var py=M(require("react"),1);var ao=require("react/jsx-runtime"),Pm=Array.from({length:12},(e,t)=>t+8);function my(e){let t=new Date(e);return Number.isNaN(t.getTime())?NaN:t.getHours()*60+t.getMinutes()}var gy=480,nT=1200,uy=nT-gy;function sT({resources:e=[],bookings:t=[],className:a}){let r=py.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(0,ao.jsx)("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:(0,ao.jsxs)("table",{className:"w-full min-w-[640px] border-collapse text-sm",children:[(0,ao.jsx)("thead",{children:(0,ao.jsxs)("tr",{children:[(0,ao.jsx)("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"}),Pm.map(o=>(0,ao.jsxs)("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))]})}),(0,ao.jsx)("tbody",{children:e.length===0?(0,ao.jsx)("tr",{children:(0,ao.jsx)("td",{colSpan:Pm.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(0,ao.jsxs)("tr",{className:"border-b last:border-b-0",children:[(0,ao.jsx)("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}),(0,ao.jsx)("td",{colSpan:Pm.length,className:"relative h-12 p-0",children:(0,ao.jsxs)("div",{className:"relative h-full w-full",children:[Pm.map((i,c)=>(0,ao.jsx)("div",{className:"absolute top-0 bottom-0 border-r border-border/40",style:{left:`${c/Pm.length*100}%`}},c)),n.map((i,c)=>{let s=my(i.start),d=my(i.end);if(Number.isNaN(s)||Number.isNaN(d)||d<=s)return null;let m=(s-gy)/uy*100,u=(d-s)/uy*100;return(0,ao.jsx)("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 ${um(i.start)} - ${um(i.end)}`,children:(0,ao.jsx)("span",{className:"truncate",children:i.title})},`${i.resourceId}-${c}`)})]})})]},o.id)})})]})})}var Un=require("react/jsx-runtime");function iT({events:e=[],className:t}){return(0,Un.jsx)("ol",{"data-slot":"timeline-view",className:l("flex flex-col",t),role:"list",children:e.length===0?(0,Un.jsxs)("li",{className:"flex items-center gap-3 py-6 text-sm text-muted-foreground",children:[(0,Un.jsx)(Te,{className:"size-4"}),"\u6682\u65E0\u4E8B\u4EF6"]}):e.map((a,r)=>{let o=r===e.length-1;return(0,Un.jsxs)("li",{className:"relative flex gap-3 pb-6 last:pb-0",children:[!o&&(0,Un.jsx)("span",{className:"absolute left-[7px] top-4 bottom-0 w-px bg-border","aria-hidden":"true"}),(0,Un.jsx)("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"}),(0,Un.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Un.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,Un.jsx)("time",{dateTime:a.date,className:"shrink-0 text-xs font-medium text-primary tabular-nums",children:Mt(a.date)}),(0,Un.jsx)("h4",{className:"truncate text-sm font-medium",children:a.title})]}),a.description&&(0,Un.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a.description})]})]},a.id)})})}var Cp=M(require("react"),1);var Wn=require("react/jsx-runtime");function lT({data:e,className:t}){let a=Cp.useMemo(()=>{let s=[];for(let d of e)s.includes(d.x)||s.push(d.x);return s},[e]),r=Cp.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=Cp.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(0,Wn.jsx)("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:(0,Wn.jsxs)("table",{className:"w-full border-separate border-spacing-1 text-xs",children:[(0,Wn.jsx)("thead",{children:(0,Wn.jsxs)("tr",{children:[(0,Wn.jsx)("th",{scope:"col",className:"w-16"}),a.map(s=>(0,Wn.jsx)("th",{scope:"col",className:"px-1 text-center text-muted-foreground",children:s},s))]})}),(0,Wn.jsx)("tbody",{children:r.map(s=>(0,Wn.jsxs)("tr",{children:[(0,Wn.jsx)("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(0,Wn.jsx)("td",{className:"p-0",children:(0,Wn.jsx)("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))})]})})}var Bo=require("react/jsx-runtime");function dT({region:e,data:t,className:a}){let r=Math.max(1,...t.map(o=>o.value));return(0,Bo.jsxs)("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:[(0,Bo.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Bo.jsx)("span",{className:"font-medium",children:e}),(0,Bo.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u6807\u8BB0 ",t.length]})]}),(0,Bo.jsx)("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(0,Bo.jsxs)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2",style:{left:`${d}%`,top:`${m}%`},children:[(0,Bo.jsx)(ss,{className:"text-primary",style:{width:u,height:u},"aria-hidden":"true"}),(0,Bo.jsx)("span",{className:"absolute left-1/2 top-full -translate-x-1/2 whitespace-nowrap text-[10px] text-muted-foreground",children:o.name}),(0,Bo.jsxs)("span",{className:"sr-only",children:[o.name,": ",Q(o.value)]})]},o.name)})}),(0,Bo.jsx)("ul",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs",role:"list",children:t.map(o=>(0,Bo.jsxs)("li",{className:"flex items-center gap-1",children:[(0,Bo.jsx)("span",{className:"size-2 rounded-sm bg-primary","aria-hidden":"true"}),(0,Bo.jsx)("span",{className:"text-muted-foreground",children:o.name}),(0,Bo.jsx)("span",{className:"tabular-nums",children:Q(o.value)})]},o.name))})]})}var Tm=M(require("react"),1);var fy=require("react/jsx-runtime");function cT({map:e,markers:t=[],cluster:a=!0,className:r}){let o=Tm.useRef(null),n=Tm.useRef([]);return Tm.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]),(0,fy.jsx)("div",{"data-slot":"map-marker-cluster",className:l("hidden",r),"aria-hidden":!0})}var el=M(require("react"),1);var by=require("react/jsx-runtime");function mT({map:e,points:t=[],playing:a=!1,speed:r=10,color:o="#1677FF",onStart:n,onEnd:i,className:c}){let s=el.useRef(null),d=el.useRef(null),m=el.useRef(0),u=el.useRef(null);return el.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]),el.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]),el.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)},[]),(0,by.jsx)("div",{"data-slot":"map-track",className:l("hidden",c),"aria-hidden":!0})}var El=M(require("react"),1),xy=require("react-i18next");var Al=require("react/jsx-runtime"),kp=null;function uT(e,t="2.0"){return kp||(kp=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)}),kp)}function pT({amapKey:e,center:t=[116.397428,39.90923],zoom:a=12,height:r=400,className:o,onReady:n,onClick:i}){let{t:c}=(0,xy.useTranslation)("map"),s=El.useRef(null),d=El.useRef(null),[m,u]=El.useState(!0),[p,f]=El.useState(null),x=e||typeof process<"u"&&process.env.AMAP_KEY||"";return El.useEffect(()=>{if(!x){f(c("loading")),u(!1);return}let v=!1;return uT(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]),(0,Al.jsxs)("div",{"data-slot":"map-view",className:l("relative overflow-hidden rounded-lg border bg-muted",o),style:{height:r},children:[m&&(0,Al.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-muted/80",children:(0,Al.jsx)("span",{className:"text-sm text-muted-foreground",children:c("loading")})}),p&&(0,Al.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-muted/80",children:(0,Al.jsx)("span",{className:"text-sm text-destructive",children:p})}),(0,Al.jsx)("div",{ref:s,className:"size-full"})]})}var Pp=M(require("react"),1);var bo=require("react/jsx-runtime"),Rm=12,wp=48;function gT({widgets:e,onChange:t,className:a}){let[r,o]=Pp.useState(e);Pp.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*wp,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(Rm-x.w,x.x+u)),N=Math.max(0,x.y+p);return{...x,x:v,y:N}});o(f),t?.(f)};return(0,bo.jsxs)("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:[(0,bo.jsx)("div",{className:"pointer-events-none absolute inset-2 grid gap-1",style:{gridTemplateColumns:`repeat(${Rm}, 1fr)`,gridTemplateRows:`repeat(${i}, ${wp}px)`},"aria-hidden":"true",children:Array.from({length:Rm*i}).map((m,u)=>(0,bo.jsx)("div",{className:"rounded-sm bg-background/40"},u))}),r.map(m=>(0,bo.jsxs)("div",{"data-widget-id":m.id,className:"absolute rounded-lg border bg-card p-3 shadow-sm",style:{left:`calc(${m.x/Rm*100}% + 0.5rem)`,top:`${m.y*wp+8}px`,width:`calc(${m.w/Rm*100}% - 1rem)`,height:`${m.h*wp-4}px`},children:[(0,bo.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,bo.jsx)("span",{className:"truncate text-sm font-medium",children:m.title}),(0,bo.jsxs)("div",{className:"flex items-center gap-1",children:[(0,bo.jsx)(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`\u5DE6\u79FB ${m.title}`,onClick:()=>d(m.id,-1,0),children:(0,bo.jsx)(nd,{className:"size-3 -scale-x-100"})}),(0,bo.jsx)(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`\u53F3\u79FB ${m.title}`,onClick:()=>d(m.id,1,0),children:(0,bo.jsx)(nd,{className:"size-3"})}),(0,bo.jsx)(C,{type:"button",variant:"ghost",size:"icon-xs","aria-label":`\u79FB\u9664 ${m.title}`,onClick:()=>s(m.id),children:(0,bo.jsx)(Le,{className:"size-3"})})]})]}),(0,bo.jsxs)("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&&(0,bo.jsx)("p",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"\u753B\u5E03\u4E3A\u7A7A\uFF0C\u8BF7\u6DFB\u52A0 widget"})]})}var Fl=require("react/jsx-runtime");function fT({data:e,className:t}){let a=Math.max(1,...e.map(r=>r.value));return(0,Fl.jsx)("div",{"data-slot":"bar-list",className:l("flex flex-col gap-2",t),children:e.map(r=>(0,Fl.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,Fl.jsx)("span",{className:"w-28 shrink-0 truncate text-muted-foreground",children:r.label}),(0,Fl.jsx)("div",{className:"h-4 flex-1 overflow-hidden rounded bg-muted",children:(0,Fl.jsx)("div",{className:"h-full rounded",style:{width:`${r.value/a*100}%`,backgroundColor:r.color??"hsl(var(--primary))"}})}),(0,Fl.jsx)("span",{className:"w-12 shrink-0 text-right tabular-nums",children:r.value})]},r.label))})}var $l=require("react/jsx-runtime");function bT({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(0,$l.jsxs)("div",{"data-slot":"delta-bar",className:l("flex flex-col gap-1",r),children:[a?(0,$l.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,$l.jsx)("span",{className:"text-muted-foreground",children:a}),(0,$l.jsxs)("span",{className:l("font-medium tabular-nums",o?"text-emerald-600":"text-red-600"),children:[o?"+":"\u2212",da(Math.abs(e)/100)]})]}):null,(0,$l.jsx)("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:(0,$l.jsx)("div",{className:l("absolute inset-y-0 left-0 rounded-full",o?"bg-emerald-500":"bg-red-500"),style:{width:`${i}%`}})})]})}var Hl=require("react/jsx-runtime");function xT({data:e,className:t}){let a=Math.max(1,...e.map(r=>r.value));return(0,Hl.jsx)("div",{"data-slot":"category-bar",className:l("flex flex-col gap-2",t),children:e.map(r=>(0,Hl.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,Hl.jsx)("span",{className:"w-28 shrink-0 truncate text-muted-foreground",children:r.label}),(0,Hl.jsx)("div",{className:"h-4 flex-1 overflow-hidden rounded bg-muted",children:(0,Hl.jsx)("div",{className:"h-full rounded",style:{width:`${r.value/a*100}%`,backgroundColor:r.color??"hsl(var(--primary))"}})}),(0,Hl.jsx)("span",{className:"w-12 shrink-0 text-right tabular-nums",children:r.value})]},r.label))})}var F8=require("react");var Id=require("react/jsx-runtime"),vT={default:{wrap:"bg-muted/50 text-foreground",icon:"text-muted-foreground",Icon:ad,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:ad,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:ft,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:ir,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:ns,label:"\u9519\u8BEF"}};function hT({title:e,children:t,variant:a="default",className:r}){let o=vT[a],n=o.Icon;return(0,Id.jsxs)("div",{"data-slot":"callout",role:"note",className:l("flex gap-3 rounded-lg border p-3 text-sm",o.wrap,r),children:[(0,Id.jsx)(n,{className:l("mt-0.5 size-5 shrink-0",o.icon),"aria-hidden":"true"}),(0,Id.jsxs)("div",{className:"min-w-0 flex-1",children:[e?(0,Id.jsx)("p",{className:"font-semibold leading-snug",children:e}):null,(0,Id.jsx)("div",{className:l(e?"mt-0.5":"","text-sm leading-snug"),children:t})]})]})}var Tp=require("react/jsx-runtime");function yT({value:e,suffix:t="%",prefix:a,className:r}){let o=e>0?"up":e<0?"down":"flat",n=o==="up"?as:o==="down"?ts:un;return(0,Tp.jsxs)("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:[(0,Tp.jsx)(n,{className:"size-3"}),a,Math.abs(e),t]})}var _n=require("react/jsx-runtime");function NT({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(0,_n.jsxs)("div",{"data-slot":"tracking",className:l("inline-flex items-center gap-3",r),role:"group","aria-label":`${a} \u8FFD\u8E2A`,children:[(0,_n.jsxs)("svg",{viewBox:"0 0 80 80",className:"size-16 -rotate-90","aria-hidden":"true",children:[(0,_n.jsx)("circle",{cx:"40",cy:"40",r:c,fill:"none",stroke:"currentColor",strokeWidth:"8",className:"text-muted"}),(0,_n.jsx)("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"})]}),(0,_n.jsxs)("div",{className:"flex flex-col",children:[(0,_n.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),(0,_n.jsxs)("span",{className:"text-lg font-semibold tabular-nums",children:[Q(t),(0,_n.jsxs)("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["/ ",Q(e)]})]}),(0,_n.jsxs)("span",{className:l("inline-flex items-center gap-1 text-xs font-medium tabular-nums",i?"text-emerald-600":"text-muted-foreground"),children:[i?(0,_n.jsx)(os,{}):(0,_n.jsx)(rs,{}),da(o)]})]})]})}var K8=require("react");var Vl=require("react/jsx-runtime");function CT({title:e,description:t,children:a,footer:r,className:o}){return(0,Vl.jsxs)(re,{"data-slot":"chart-card",className:l("w-full",o),children:[(0,Vl.jsxs)(he,{children:[(0,Vl.jsx)(ve,{children:e}),t?(0,Vl.jsx)(uo,{children:t}):null]}),(0,Vl.jsx)(oe,{children:a}),r?(0,Vl.jsx)(Ln,{children:r}):null]})}var vs=require("react/jsx-runtime");function kT({label:e,value:t,trend:a,sparklineData:r=[],className:o}){let n=a!==void 0,i=(a??0)>=0,c=n?i?os:rs: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(0,vs.jsxs)("div",{"data-slot":"stat-card-with-sparkline",className:l("flex flex-col gap-2 rounded-lg border bg-card p-4",o),children:[(0,vs.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,vs.jsxs)("div",{className:"min-w-0",children:[(0,vs.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e}),(0,vs.jsx)("p",{className:"mt-0.5 text-xl font-semibold tabular-nums",children:y})]}),n&&c?(0,vs.jsxs)("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:[(0,vs.jsx)(c,{className:"size-3.5","aria-hidden":"true"}),da(Math.abs(a)/100)]}):null]}),(0,vs.jsxs)("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:[(0,vs.jsx)("path",{d:b,fill:g,fillOpacity:.15,stroke:"none"}),(0,vs.jsx)("path",{d:h,fill:"none",stroke:g,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"})]})]})}var qn=require("react/jsx-runtime");function wT({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(0,qn.jsxs)("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:[(0,qn.jsxs)("div",{className:"relative size-32 shrink-0",children:[(0,qn.jsx)("svg",{viewBox:"0 0 100 100",className:"size-32 -rotate-90",role:"presentation",children:e.map(c=>{let s=c.value/r,d=(0,qn.jsx)("circle",{cx:"50",cy:"50",r:o,fill:"none",stroke:c.color,strokeWidth:"12",strokeDasharray:`${s*n} ${n}`,strokeDashoffset:-i*n,children:(0,qn.jsxs)("title",{children:[c.label,": ",Q(c.value)]})},c.label);return i+=s,d})}),t?(0,qn.jsx)("span",{className:"absolute inset-0 flex items-center justify-center text-sm font-medium tabular-nums",children:t}):null]}),(0,qn.jsx)("ul",{className:"flex flex-1 flex-col gap-1.5 text-sm",role:"list",children:e.map(c=>(0,qn.jsxs)("li",{className:"flex items-center gap-2",children:[(0,qn.jsx)("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:c.color},"aria-hidden":"true"}),(0,qn.jsx)("span",{className:"text-muted-foreground",children:c.label}),(0,qn.jsx)("span",{className:"ml-auto tabular-nums",children:Q(c.value)})]},c.label))})]})}var Dd=M(require("react"),1),vy=require("react-i18next");var mr=require("react/jsx-runtime");function PT({open:e,onOpenChange:t,onSelect:a,multiple:r=!1,items:o=[],title:n,searchPlaceholder:i,emptyText:c,className:s}){let{t:d}=(0,vy.useTranslation)("ui"),[m,u]=Dd.useState(""),[p,f]=Dd.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=Dd.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]);Dd.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(0,mr.jsx)(Ye,{open:e,onOpenChange:t,children:(0,mr.jsxs)(Je,{"data-slot":"customer-browse",className:l("sm:max-w-md",s),children:[(0,mr.jsxs)(nt,{children:[(0,mr.jsx)(Ze,{children:x}),(0,mr.jsx)(Dt,{children:d("customerBrowse.description",{defaultValue:r?"\u53EF\u591A\u9009\u5BA2\u6237":"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u5BA2\u6237"})})]}),(0,mr.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,mr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,mr.jsx)(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"})]}),(0,mr.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[h.length===0&&(0,mr.jsx)("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(0,mr.jsx)("li",{children:(0,mr.jsxs)("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:[(0,mr.jsx)(fl,{className:"size-4 shrink-0 opacity-50"}),(0,mr.jsxs)("span",{className:"flex-1 truncate",children:[y.name,y.contact&&(0,mr.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",y.contact]})]}),y.phone&&(0,mr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:y.phone}),k&&(0,mr.jsx)(G,{className:"size-4 shrink-0"})]})},y.id)})]}),(0,mr.jsxs)(bt,{children:[(0,mr.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:d("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,mr.jsx)(C,{type:"button",disabled:p.length===0,onClick:g,children:d("customerBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Md=M(require("react"),1),hy=require("react-i18next");var Ya=require("react/jsx-runtime");function TT({open:e,onOpenChange:t,onSelect:a,multiple:r=!1,items:o=[],title:n,searchPlaceholder:i,emptyText:c,className:s}){let{t:d}=(0,hy.useTranslation)("ui"),[m,u]=Md.useState(""),[p,f]=Md.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=Md.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]);Md.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(0,Ya.jsx)(Ye,{open:e,onOpenChange:t,children:(0,Ya.jsxs)(Je,{"data-slot":"product-browse",className:l("sm:max-w-lg",s),children:[(0,Ya.jsxs)(nt,{children:[(0,Ya.jsx)(Ze,{children:x}),(0,Ya.jsx)(Dt,{children:d("productBrowse.description",{defaultValue:r?"\u53EF\u591A\u9009\u5546\u54C1":"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u5546\u54C1"})})]}),(0,Ya.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,Ya.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Ya.jsx)(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"})]}),(0,Ya.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[h.length===0&&(0,Ya.jsx)("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(0,Ya.jsx)("li",{children:(0,Ya.jsxs)("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:[(0,Ya.jsx)(pn,{className:"size-4 shrink-0 opacity-50"}),(0,Ya.jsxs)("span",{className:"flex-1 truncate",children:[g.name,g.spec&&(0,Ya.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",g.spec]})]}),g.unit&&(0,Ya.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.unit}),g.price!=null&&(0,Ya.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:ze(g.price)}),y&&(0,Ya.jsx)(G,{className:"size-4 shrink-0"})]})},g.id)})]}),(0,Ya.jsxs)(bt,{children:[(0,Ya.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:d("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,Ya.jsx)(C,{type:"button",disabled:p.length===0,onClick:()=>t(!1),children:d("productBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Bd=M(require("react"),1),yy=require("react-i18next");var Ja=require("react/jsx-runtime");function RT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,yy.useTranslation)("ui"),[d,m]=Bd.useState(""),[u,p]=Bd.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=Bd.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]);Bd.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(0,Ja.jsx)(Ye,{open:e,onOpenChange:t,children:(0,Ja.jsxs)(Je,{"data-slot":"sales-order-browse",className:l("sm:max-w-lg",c),children:[(0,Ja.jsxs)(nt,{children:[(0,Ja.jsx)(Ze,{children:f}),(0,Ja.jsx)(Dt,{children:s("salesOrderBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u9500\u552E\u8BA2\u5355"})})]}),(0,Ja.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,Ja.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Ja.jsx)(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"})]}),(0,Ja.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,Ja.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,Ja.jsx)("li",{children:(0,Ja.jsxs)("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:[(0,Ja.jsx)(gn,{className:"size-4 shrink-0 opacity-50"}),(0,Ja.jsxs)("span",{className:"flex-1 truncate",children:[b.no??b.id,b.customer&&(0,Ja.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",b.customer]})]}),b.date&&(0,Ja.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:Mt(b.date)}),b.amount!=null&&(0,Ja.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:ze(b.amount)}),g&&(0,Ja.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,Ja.jsxs)(bt,{children:[(0,Ja.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,Ja.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("salesOrderBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Ld=M(require("react"),1),Ny=require("react-i18next");var Za=require("react/jsx-runtime");function ST({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,Ny.useTranslation)("ui"),[d,m]=Ld.useState(""),[u,p]=Ld.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=Ld.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]);Ld.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(0,Za.jsx)(Ye,{open:e,onOpenChange:t,children:(0,Za.jsxs)(Je,{"data-slot":"writeoff-browse",className:l("sm:max-w-md",c),children:[(0,Za.jsxs)(nt,{children:[(0,Za.jsx)(Ze,{children:f}),(0,Za.jsx)(Dt,{children:s("writeoffBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u6838\u9500\u5355"})})]}),(0,Za.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,Za.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Za.jsx)(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"})]}),(0,Za.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,Za.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,Za.jsx)("li",{children:(0,Za.jsxs)("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:[(0,Za.jsx)(gn,{className:"size-4 shrink-0 opacity-50"}),(0,Za.jsxs)("span",{className:"flex-1 truncate",children:[b.no??b.id,b.counterparty&&(0,Za.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",b.counterparty]})]}),b.date&&(0,Za.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:Mt(b.date)}),b.amount!=null&&(0,Za.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:ze(b.amount)}),g&&(0,Za.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,Za.jsxs)(bt,{children:[(0,Za.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,Za.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("writeoffBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var zd=M(require("react"),1),Cy=require("react-i18next");var er=require("react/jsx-runtime");function IT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,Cy.useTranslation)("ui"),[d,m]=zd.useState(""),[u,p]=zd.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=zd.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]);zd.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(0,er.jsx)(Ye,{open:e,onOpenChange:t,children:(0,er.jsxs)(Je,{"data-slot":"price-adjust-browse",className:l("sm:max-w-md",c),children:[(0,er.jsxs)(nt,{children:[(0,er.jsx)(Ze,{children:f}),(0,er.jsx)(Dt,{children:s("priceAdjustBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u8C03\u4EF7\u5355"})})]}),(0,er.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,er.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,er.jsx)(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"})]}),(0,er.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,er.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,er.jsx)("li",{children:(0,er.jsxs)("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:[(0,er.jsx)(gn,{className:"size-4 shrink-0 opacity-50"}),(0,er.jsxs)("span",{className:"flex-1 truncate",children:[b.no??b.id,b.product&&(0,er.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",b.product]})]}),b.date&&(0,er.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:Mt(b.date)}),b.status&&(0,er.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.status}),g&&(0,er.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,er.jsxs)(bt,{children:[(0,er.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,er.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("priceAdjustBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Ad=M(require("react"),1),ky=require("react-i18next");var kr=require("react/jsx-runtime");function DT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,ky.useTranslation)("ui"),[d,m]=Ad.useState(""),[u,p]=Ad.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=Ad.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]);Ad.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(0,kr.jsx)(Ye,{open:e,onOpenChange:t,children:(0,kr.jsxs)(Je,{"data-slot":"fee-type-browse",className:l("sm:max-w-md",c),children:[(0,kr.jsxs)(nt,{children:[(0,kr.jsx)(Ze,{children:f}),(0,kr.jsx)(Dt,{children:s("feeTypeBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u8D39\u7528\u7C7B\u578B"})})]}),(0,kr.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,kr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,kr.jsx)(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"})]}),(0,kr.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,kr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,kr.jsx)("li",{children:(0,kr.jsxs)("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:[(0,kr.jsx)(gn,{className:"size-4 shrink-0 opacity-50"}),(0,kr.jsx)("span",{className:"flex-1 truncate",children:b.name}),b.direction&&(0,kr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.direction==="expense"?"\u652F\u51FA":"\u6536\u5165"}),g&&(0,kr.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,kr.jsxs)(bt,{children:[(0,kr.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,kr.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("feeTypeBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Ed=M(require("react"),1),wy=require("react-i18next");var ur=require("react/jsx-runtime");function MT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,wy.useTranslation)("ui"),[d,m]=Ed.useState(""),[u,p]=Ed.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=Ed.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]);Ed.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(0,ur.jsx)(Ye,{open:e,onOpenChange:t,children:(0,ur.jsxs)(Je,{"data-slot":"shipping-way-browse",className:l("sm:max-w-md",c),children:[(0,ur.jsxs)(nt,{children:[(0,ur.jsx)(Ze,{children:f}),(0,ur.jsx)(Dt,{children:s("shippingWayBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u8FD0\u8F93\u65B9\u5F0F"})})]}),(0,ur.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,ur.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,ur.jsx)(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"})]}),(0,ur.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,ur.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,ur.jsx)("li",{children:(0,ur.jsxs)("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:[(0,ur.jsx)(ku,{className:"size-4 shrink-0 opacity-50"}),(0,ur.jsx)("span",{className:"flex-1 truncate",children:b.name}),b.code&&(0,ur.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.code}),b.carrier&&(0,ur.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.carrier}),g&&(0,ur.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,ur.jsxs)(bt,{children:[(0,ur.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,ur.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("shippingWayBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Fd=M(require("react"),1),Py=require("react-i18next");var pr=require("react/jsx-runtime");function BT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,Py.useTranslation)("ui"),[d,m]=Fd.useState(""),[u,p]=Fd.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=Fd.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]);Fd.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(0,pr.jsx)(Ye,{open:e,onOpenChange:t,children:(0,pr.jsxs)(Je,{"data-slot":"warehouse-browse",className:l("sm:max-w-md",c),children:[(0,pr.jsxs)(nt,{children:[(0,pr.jsx)(Ze,{children:f}),(0,pr.jsx)(Dt,{children:s("warehouseBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u4ED3\u5E93"})})]}),(0,pr.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,pr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,pr.jsx)(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"})]}),(0,pr.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,pr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,pr.jsx)("li",{children:(0,pr.jsxs)("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:[(0,pr.jsx)(pn,{className:"size-4 shrink-0 opacity-50"}),(0,pr.jsx)("span",{className:"flex-1 truncate",children:b.name}),b.code&&(0,pr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.code}),b.manager&&(0,pr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.manager}),g&&(0,pr.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,pr.jsxs)(bt,{children:[(0,pr.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,pr.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("warehouseBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var $d=M(require("react"),1),Ty=require("react-i18next");var wr=require("react/jsx-runtime");function LT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,Ty.useTranslation)("ui"),[d,m]=$d.useState(""),[u,p]=$d.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=$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.taxNo?.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(0,wr.jsx)(Ye,{open:e,onOpenChange:t,children:(0,wr.jsxs)(Je,{"data-slot":"company-browse",className:l("sm:max-w-md",c),children:[(0,wr.jsxs)(nt,{children:[(0,wr.jsx)(Ze,{children:f}),(0,wr.jsx)(Dt,{children:s("companyBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u516C\u53F8"})})]}),(0,wr.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,wr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,wr.jsx)(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"})]}),(0,wr.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,wr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.id===u;return(0,wr.jsx)("li",{children:(0,wr.jsxs)("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:[(0,wr.jsx)(ml,{className:"size-4 shrink-0 opacity-50"}),(0,wr.jsx)("span",{className:"flex-1 truncate",children:b.name}),b.code&&(0,wr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.code}),g&&(0,wr.jsx)(G,{className:"size-4 shrink-0"})]})},b.id)})]}),(0,wr.jsxs)(bt,{children:[(0,wr.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,wr.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("companyBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var Hd=M(require("react"),1),Ry=require("react-i18next");var Pr=require("react/jsx-runtime");function zT({open:e,onOpenChange:t,onSelect:a,items:r=[],title:o,searchPlaceholder:n,emptyText:i,className:c}){let{t:s}=(0,Ry.useTranslation)("ui"),[d,m]=Hd.useState(""),[u,p]=Hd.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=Hd.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]);Hd.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(0,Pr.jsx)(Ye,{open:e,onOpenChange:t,children:(0,Pr.jsxs)(Je,{"data-slot":"city-browse",className:l("sm:max-w-md",c),showCloseButton:!0,children:[(0,Pr.jsxs)(nt,{children:[(0,Pr.jsx)(Ze,{children:f}),(0,Pr.jsx)(Dt,{children:s("cityBrowse.description",{defaultValue:"\u4ECE\u5217\u8868\u4E2D\u9009\u62E9\u4E00\u4E2A\u57CE\u5E02"})})]}),(0,Pr.jsxs)("div",{className:"flex items-center gap-2 border-b pb-2",children:[(0,Pr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Pr.jsx)(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"})]}),(0,Pr.jsxs)("ul",{role:"list",className:"max-h-72 overflow-y-auto py-1",children:[N.length===0&&(0,Pr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:v}),N.map(b=>{let g=b.code===u;return(0,Pr.jsx)("li",{children:(0,Pr.jsxs)("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:[(0,Pr.jsx)(ss,{className:"size-4 shrink-0 opacity-50"}),(0,Pr.jsx)("span",{className:"flex-1 truncate",children:b.name}),b.province&&(0,Pr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:b.province}),g&&(0,Pr.jsx)(G,{className:"size-4 shrink-0"})]})},b.code)})]}),(0,Pr.jsxs)(bt,{children:[(0,Pr.jsx)(C,{variant:"outline",type:"button",onClick:()=>t(!1),children:s("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,Pr.jsx)(C,{type:"button",disabled:u==null,onClick:h,children:s("cityBrowse.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}var jt=require("react/jsx-runtime");function AT({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(0,jt.jsxs)("section",{"data-slot":"tax-detail-table",className:l("flex flex-col gap-3",t),"aria-labelledby":"tax-detail-table-title",children:[(0,jt.jsxs)("h3",{id:"tax-detail-table-title",className:"flex items-center gap-1.5 text-sm font-medium",children:[(0,jt.jsx)(Jc,{className:"size-4 text-primary","aria-hidden":"true"}),(0,jt.jsx)("span",{children:"\u7A0E\u52A1\u660E\u7EC6"})]}),(0,jt.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,jt.jsxs)("table",{className:"w-full text-sm",children:[(0,jt.jsxs)("caption",{className:"sr-only",children:["\u7A0E\u52A1\u660E\u7EC6\uFF0C\u5408\u8BA1\u7A0E\u989D ",ze(r)]}),(0,jt.jsx)("thead",{className:"bg-muted/50",children:(0,jt.jsxs)("tr",{children:[(0,jt.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u9879\u76EE"}),(0,jt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u91D1\u989D"}),(0,jt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u7A0E\u7387"}),(0,jt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u7A0E\u989D"}),(0,jt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u4EF7\u7A0E\u5408\u8BA1"})]})}),(0,jt.jsxs)("tbody",{children:[e.map(n=>(0,jt.jsxs)("tr",{className:"border-t",children:[(0,jt.jsx)("td",{className:"px-3 py-2 font-medium",children:n.name}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:ze(n.amount)}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:da(n.taxRate)}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:ze(n.taxAmount)}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums font-medium",children:ze(n.amount+n.taxAmount)})]},n.id)),e.length===0?(0,jt.jsx)("tr",{children:(0,jt.jsx)("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u7A0E\u52A1\u660E\u7EC6"})}):null]}),e.length>0?(0,jt.jsx)("tfoot",{className:"border-t bg-muted/30 font-semibold",children:(0,jt.jsxs)("tr",{children:[(0,jt.jsx)("td",{className:"px-3 py-2",children:"\u5408\u8BA1"}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:ze(a)}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"\u2014"}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:ze(r)}),(0,jt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:ze(o)})]})}):null]})})]})}var hU=require("react");var $a=require("react/jsx-runtime"),ET={done:{label:"\u5DF2\u5B8C\u6210",icon:(0,$a.jsx)(ft,{className:"size-4"}),tone:"text-emerald-600"},doing:{label:"\u8FDB\u884C\u4E2D",icon:(0,$a.jsx)(Te,{className:"size-4"}),tone:"text-primary"},pending:{label:"\u5F85\u5904\u7406",icon:(0,$a.jsx)(Bn,{className:"size-4"}),tone:"text-muted-foreground"},rejected:{label:"\u5DF2\u9A73\u56DE",icon:(0,$a.jsx)(ee,{className:"size-4"}),tone:"text-destructive"}};function FT(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 $T({steps:e=[],className:t}){return e.length===0?(0,$a.jsxs)("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:[(0,$a.jsx)(Bn,{className:"size-4"}),"\u6682\u65E0\u6838\u9500\u6B65\u9AA4"]}):(0,$a.jsx)("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=FT(a.status),n=ET[o],i=r===e.length-1,c=o==="done";return(0,$a.jsxs)("li",{className:"relative flex gap-3 pb-4 last:pb-0",children:[!i&&(0,$a.jsx)("span",{className:l("absolute left-[15px] top-8 bottom-0 w-0.5",c?"bg-emerald-500":"bg-border"),"aria-hidden":"true"}),(0,$a.jsx)("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}),(0,$a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1 pt-1",children:[(0,$a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,$a.jsx)("span",{className:"text-sm font-medium",children:a.name}),(0,$a.jsx)(L,{variant:o==="done"?"default":o==="rejected"?"destructive":"secondary",className:l(o==="doing"&&"border-primary text-primary"),children:n.label}),a.amount!==void 0&&(0,$a.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:ze(a.amount)})]}),(0,$a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground tabular-nums",children:[(0,$a.jsxs)("span",{children:["\u6B65\u9AA4 ",r+1," / ",e.length]}),!i&&(0,$a.jsxs)($a.Fragment,{children:[(0,$a.jsx)(co,{className:"size-3","aria-hidden":"true"}),(0,$a.jsx)("span",{children:e[r+1]?.name})]})]})]})]},a.id)})})}var Ha=require("react/jsx-runtime");function HT({total:e,used:t,remaining:a,categories:r,currency:o="CNY",className:n}){let i=e>0?Math.round(t/e*100):0;return(0,Ha.jsxs)("div",{"data-slot":"budget-overview",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",n),children:[(0,Ha.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,Ha.jsx)("span",{className:"text-sm font-medium",children:"\u9884\u7B97\u603B\u89C8"}),(0,Ha.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u5DF2\u7528 ",i,"%"]})]}),(0,Ha.jsx)("div",{className:"h-2 overflow-hidden rounded bg-muted",children:(0,Ha.jsx)("div",{className:l("h-full rounded",i>90?"bg-red-500":i>70?"bg-yellow-500":"bg-emerald-500"),style:{width:`${i}%`}})}),(0,Ha.jsxs)("div",{className:"grid grid-cols-3 gap-2 text-sm",children:[(0,Ha.jsxs)("div",{children:[(0,Ha.jsx)("div",{className:"text-xs text-muted-foreground",children:"\u603B\u9884\u7B97"}),(0,Ha.jsx)("div",{className:"font-medium",children:ze(e,o)})]}),(0,Ha.jsxs)("div",{children:[(0,Ha.jsx)("div",{className:"text-xs text-muted-foreground",children:"\u5DF2\u7528"}),(0,Ha.jsx)("div",{className:"font-medium",children:ze(t,o)})]}),(0,Ha.jsxs)("div",{children:[(0,Ha.jsx)("div",{className:"text-xs text-muted-foreground",children:"\u5269\u4F59"}),(0,Ha.jsx)("div",{className:"font-medium",children:ze(a,o)})]})]}),(0,Ha.jsx)("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(0,Ha.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ha.jsx)("span",{className:"w-24 truncate text-muted-foreground",children:c.name}),(0,Ha.jsx)("div",{className:"h-1.5 flex-1 overflow-hidden rounded bg-muted",children:(0,Ha.jsx)("div",{className:"h-full rounded bg-primary",style:{width:`${s}%`}})}),(0,Ha.jsx)("span",{className:"w-20 text-right tabular-nums",children:ze(c.actual,o)})]},c.name)})})]})}var Tr=require("react/jsx-runtime");function VT({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(0,Tr.jsxs)(re,{"data-slot":"target-progress",className:l("w-full",r),children:[(0,Tr.jsx)(he,{children:(0,Tr.jsxs)(ve,{className:"flex items-center justify-between",children:[(0,Tr.jsxs)("span",{className:"flex items-center gap-2",children:[(0,Tr.jsx)(Du,{className:"size-4 text-primary"}),"\u76EE\u6807\u8FDB\u5EA6"]}),a&&(0,Tr.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:a})]})}),(0,Tr.jsxs)(oe,{className:"flex flex-col gap-4",children:[(0,Tr.jsxs)("div",{className:"flex items-end justify-between",children:[(0,Tr.jsxs)("div",{children:[(0,Tr.jsx)("p",{className:"text-xs text-muted-foreground",children:"\u5B9E\u9645 / \u76EE\u6807"}),(0,Tr.jsxs)("p",{className:"text-2xl font-semibold tabular-nums",children:[Q(t),(0,Tr.jsxs)("span",{className:"ml-1 text-sm font-normal text-muted-foreground",children:["/ ",Q(e)]})]})]}),(0,Tr.jsxs)("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"?(0,Tr.jsx)(os,{}):(0,Tr.jsx)(rs,{}),da(o)]})]}),(0,Tr.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,Tr.jsx)("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:(0,Tr.jsx)("div",{className:l("h-full rounded-full transition-all",i?"bg-emerald-500":"bg-primary"),style:{width:`${n*100}%`}})}),(0,Tr.jsx)("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`})]})]})]})}var Va=require("react/jsx-runtime"),OT={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 UT({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(0,Va.jsxs)("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:[(0,Va.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Va.jsx)("span",{className:"text-sm font-medium",children:"\u5E93\u5B58\u5FEB\u7167"}),(0,Va.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u5171 ",e.length," \u9879"]})]}),(0,Va.jsxs)("div",{className:"grid grid-cols-3 gap-2 text-center text-xs",children:[(0,Va.jsxs)("div",{className:"rounded-md bg-emerald-50 py-1.5",children:[(0,Va.jsx)("div",{className:"text-muted-foreground",children:"\u6B63\u5E38"}),(0,Va.jsx)("div",{className:"font-semibold text-emerald-600",children:a})]}),(0,Va.jsxs)("div",{className:"rounded-md bg-yellow-50 py-1.5",children:[(0,Va.jsx)("div",{className:"text-muted-foreground",children:"\u504F\u4F4E"}),(0,Va.jsx)("div",{className:"font-semibold text-yellow-600",children:r})]}),(0,Va.jsxs)("div",{className:"rounded-md bg-red-50 py-1.5",children:[(0,Va.jsx)("div",{className:"text-muted-foreground",children:"\u7F3A\u8D27"}),(0,Va.jsx)("div",{className:"font-semibold text-destructive",children:o})]})]}),(0,Va.jsx)("ul",{className:"flex flex-col divide-y",role:"list",children:e.map(n=>{let i=OT[n.status],c=n.status==="out"?pn:yb;return(0,Va.jsxs)("li",{className:"flex items-center gap-3 py-2 text-sm",children:[(0,Va.jsx)(c,{className:l("size-4 shrink-0",i.tone)}),(0,Va.jsx)("span",{className:"flex-1 truncate",children:n.name}),(0,Va.jsxs)("span",{className:l("flex items-center gap-1 text-xs",i.tone),children:[(0,Va.jsx)("span",{className:l("size-1.5 rounded-full",i.dot)}),i.label]}),(0,Va.jsx)("span",{className:"w-16 text-right tabular-nums text-muted-foreground",children:n.status==="out"?"-":Q(n.qty)})]},n.id)})}),e.length===0&&(0,Va.jsx)("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5E93\u5B58\u6570\u636E"})]})}var Lo=require("react/jsx-runtime");function WT({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:gn,tone:"text-foreground"},{label:"\u5DF2\u5F00\u5177",value:Q(t),icon:ft,tone:"text-emerald-600"},{label:"\u5F85\u5F00\u5177",value:Q(a),icon:Te,tone:"text-yellow-600"}];return(0,Lo.jsxs)("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:[(0,Lo.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,Lo.jsx)("span",{className:"text-sm font-medium",children:"\u53D1\u7968\u6C47\u603B"}),(0,Lo.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u5F00\u5177\u7387 ",n,"%"]})]}),(0,Lo.jsx)("div",{className:"h-2 overflow-hidden rounded bg-muted",children:(0,Lo.jsx)("div",{className:"h-full rounded bg-emerald-500",style:{width:`${n}%`}})}),(0,Lo.jsx)("div",{className:"grid grid-cols-3 gap-3",children:i.map(c=>(0,Lo.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Lo.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,Lo.jsx)(c.icon,{className:l("size-3",c.tone)}),c.label]}),(0,Lo.jsx)("span",{className:l("text-xl font-semibold tabular-nums",c.tone),children:c.value})]},c.label))}),(0,Lo.jsxs)("div",{className:"flex items-center justify-between border-t pt-3 text-sm",children:[(0,Lo.jsx)("span",{className:"text-muted-foreground",children:"\u91D1\u989D\u5408\u8BA1"}),(0,Lo.jsx)("span",{className:"font-semibold tabular-nums",children:ze(r)})]})]})}var Ol=require("react/jsx-runtime");function _T({balance:e,currency:t="CNY",label:a="\u8D26\u6237\u4F59\u989D",trend:r,className:o}){let n=(r??0)>=0;return(0,Ol.jsxs)("div",{"data-slot":"account-balance",className:l("flex flex-col gap-1 rounded-lg border bg-card p-4",o),children:[(0,Ol.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),(0,Ol.jsx)("span",{className:"text-2xl font-semibold tabular-nums",children:ze(e,t)}),r!==void 0&&(0,Ol.jsxs)("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?(0,Ol.jsx)(as,{className:"size-3.5"}):(0,Ol.jsx)(ts,{className:"size-3.5"}),Math.abs(r),"%"]})]})}var Rp=M(require("react"),1);var gr=require("react/jsx-runtime");function qT({rows:e,onChange:t,className:a}){let[r,o]=Rp.useState(e);Rp.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(0,gr.jsx)("div",{"data-slot":"reconciliation-line-editor",className:l("w-full overflow-x-auto",a),children:(0,gr.jsxs)("table",{className:"w-full border-collapse text-sm",children:[(0,gr.jsx)("thead",{children:(0,gr.jsxs)("tr",{className:"border-b border-border bg-muted/40 text-left",children:[(0,gr.jsx)("th",{scope:"col",className:"px-3 py-2 font-medium",children:"\u7ECF\u9500\u5546"}),(0,gr.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u8BA2\u5355\u91D1\u989D"}),(0,gr.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u6263\u51CF"}),(0,gr.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u51C0\u989D"})]})}),(0,gr.jsx)("tbody",{children:r.length===0?(0,gr.jsx)("tr",{children:(0,gr.jsx)("td",{colSpan:4,className:"px-3 py-4 text-center text-muted-foreground",children:"\u6682\u65E0\u5BF9\u8D26\u660E\u7EC6"})}):r.map(c=>(0,gr.jsxs)("tr",{"data-slot":"reconciliation-line-editor-row",className:"border-b border-border last:border-0",children:[(0,gr.jsx)("td",{className:"px-3 py-2",children:c.distributor}),(0,gr.jsxs)("td",{className:"px-3 py-2 text-right",children:[(0,gr.jsx)("label",{htmlFor:`order-${c.id}`,className:"sr-only",children:"\u8BA2\u5355\u91D1\u989D"}),(0,gr.jsx)("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"})]}),(0,gr.jsxs)("td",{className:"px-3 py-2 text-right",children:[(0,gr.jsx)("label",{htmlFor:`deduction-${c.id}`,className:"sr-only",children:"\u6263\u51CF"}),(0,gr.jsx)("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"})]}),(0,gr.jsx)("td",{className:"px-3 py-2 text-right tabular-nums","data-slot":"reconciliation-line-editor-net",children:ze(c.netAmount)})]},c.id))})]})})}var Sp=M(require("react"),1);var ut=require("react/jsx-runtime");function GT({rows:e,onChange:t,className:a}){let[r,o]=Sp.useState(e);Sp.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(0,ut.jsxs)("div",{"data-slot":"sales-target-editor",className:l("flex flex-col gap-3",a),children:[(0,ut.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ut.jsx)(Du,{className:"size-5 text-muted-foreground","aria-hidden":!0}),(0,ut.jsx)("h3",{className:"text-base font-medium",children:"\u9500\u552E\u76EE\u6807"})]}),(0,ut.jsx)("div",{className:"overflow-x-auto",children:(0,ut.jsxs)("table",{className:"w-full border-collapse text-sm",children:[(0,ut.jsx)("thead",{children:(0,ut.jsxs)("tr",{className:"border-b text-left text-muted-foreground",children:[(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u5E74\u5EA6"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u533A\u57DF"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q1"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q2"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q3"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"Q4"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u5E74\u5EA6\u5408\u8BA1"}),(0,ut.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u64CD\u4F5C"})]})}),(0,ut.jsx)("tbody",{children:r.length===0?(0,ut.jsx)("tr",{children:(0,ut.jsx)("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(0,ut.jsxs)("tr",{className:"border-b last:border-0",children:[(0,ut.jsx)("td",{className:"px-2 py-1.5 tabular-nums",children:m.year}),(0,ut.jsx)("td",{className:"px-2 py-1.5",children:(0,ut.jsx)(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=>(0,ut.jsx)("td",{className:"px-2 py-1.5",children:(0,ut.jsx)(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)),(0,ut.jsx)("td",{className:"px-2 py-1.5",children:(0,ut.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ut.jsx)(Po,{value:u,"aria-label":`\u5E74\u5EA6\u5408\u8BA1 ${m.id}`,children:(0,ut.jsx)(gc,{style:{width:`${u}%`}})}),(0,ut.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground",children:Q(m.annual)})]})}),(0,ut.jsx)("td",{className:"px-2 py-1.5",children:(0,ut.jsx)(C,{type:"button",variant:"ghost",size:"sm","aria-label":`\u5220\u9664 ${m.id}`,onClick:()=>c(m.id),children:(0,ut.jsx)(Le,{className:"size-4","aria-hidden":!0})})})]},m.id)})})]})}),(0,ut.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ut.jsxs)(we,{className:"text-muted-foreground",children:["\u5171 ",r.length," \u6761"]}),(0,ut.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:s,children:[(0,ut.jsx)(Re,{className:"size-4","aria-hidden":!0}),"\u65B0\u589E\u76EE\u6807"]})]})]})}var Ul=M(require("react"),1);var ct=require("react/jsx-runtime");function jT({initial:e,onSubmit:t,className:a}){let[r,o]=Ul.useState(typeof e?.name=="string"?e.name:""),[n,i]=Ul.useState(typeof e?.type=="string"?e.type:"discount"),[c,s]=Ul.useState(typeof e?.budget=="number"?e.budget:0),[d,m]=Ul.useState(typeof e?.start=="string"?e.start:""),[u,p]=Ul.useState(typeof e?.end=="string"?e.end:""),[f,x]=Ul.useState(e?.enabled===!0),[v,N]=Ul.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(0,ct.jsxs)("form",{"data-slot":"marketing-activity-form",className:l("flex flex-col gap-4",a),onSubmit:h,children:[(0,ct.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ct.jsx)(bu,{className:"size-5 text-muted-foreground","aria-hidden":!0}),(0,ct.jsx)("h3",{className:"text-base font-medium",children:"\u8425\u9500\u6D3B\u52A8"})]}),(0,ct.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ct.jsx)(we,{htmlFor:"maf-name",children:"\u6D3B\u52A8\u540D\u79F0"}),(0,ct.jsx)(T,{id:"maf-name",value:r,onChange:b=>o(b.target.value),placeholder:"\u8BF7\u8F93\u5165\u6D3B\u52A8\u540D\u79F0"})]}),(0,ct.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ct.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ct.jsx)(we,{htmlFor:"maf-type",children:"\u6D3B\u52A8\u7C7B\u578B"}),(0,ct.jsxs)(Ge,{value:n,onValueChange:b=>i(b??"discount"),children:[(0,ct.jsx)(Ke,{id:"maf-type",children:(0,ct.jsx)(je,{placeholder:"\u8BF7\u9009\u62E9"})}),(0,ct.jsxs)(Qe,{children:[(0,ct.jsx)(De,{value:"discount",children:"\u6EE1\u51CF\u4F18\u60E0"}),(0,ct.jsx)(De,{value:"coupon",children:"\u9886\u5238"}),(0,ct.jsx)(De,{value:"gift",children:"\u8D60\u54C1"}),(0,ct.jsx)(De,{value:"flash",children:"\u9650\u65F6\u79D2\u6740"})]})]})]}),(0,ct.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ct.jsx)(we,{htmlFor:"maf-budget",children:"\u9884\u7B97\uFF08\u5143\uFF09"}),(0,ct.jsx)(T,{id:"maf-budget",type:"number",value:Number.isFinite(c)?c:0,onChange:b=>s(b.target.valueAsNumber)}),(0,ct.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:ze(c)})]})]}),(0,ct.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,ct.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ct.jsx)(we,{htmlFor:"maf-start",children:"\u5F00\u59CB\u65E5\u671F"}),(0,ct.jsx)(T,{id:"maf-start",type:"date",value:d,onChange:b=>m(b.target.value)})]}),(0,ct.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ct.jsx)(we,{htmlFor:"maf-end",children:"\u7ED3\u675F\u65E5\u671F"}),(0,ct.jsx)(T,{id:"maf-end",type:"date",value:u,onChange:b=>p(b.target.value)})]})]}),(0,ct.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ct.jsx)(we,{htmlFor:"maf-enabled",children:"\u7ACB\u5373\u542F\u7528"}),(0,ct.jsx)(ws,{id:"maf-enabled",checked:f,onCheckedChange:x})]}),(0,ct.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ct.jsx)(we,{htmlFor:"maf-note",children:"\u5907\u6CE8"}),(0,ct.jsx)(Ta,{id:"maf-note",value:v,onChange:b=>N(b.target.value),placeholder:"\u53EF\u9009\u7684\u6D3B\u52A8\u8BF4\u660E"})]}),(0,ct.jsx)("div",{className:"flex justify-end gap-2",children:(0,ct.jsxs)(C,{type:"submit",children:[(0,ct.jsx)(qs,{className:"size-4","aria-hidden":!0}),"\u63D0\u4EA4"]})})]})}var Ip=M(require("react"),1);var pt=require("react/jsx-runtime");function KT({rows:e,onChange:t,className:a}){let[r,o]=Ip.useState(e);Ip.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(0,pt.jsxs)("div",{"data-slot":"policy-line-editor",className:l("flex flex-col gap-3",a),children:[(0,pt.jsxs)("table",{className:"w-full border-collapse text-sm",children:[(0,pt.jsx)("thead",{children:(0,pt.jsxs)("tr",{className:"border-b text-left text-muted-foreground",children:[(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u653F\u7B56\u540D\u79F0"}),(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u7C7B\u578B"}),(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u6761\u4EF6"}),(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u5956\u52B1"}),(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u989D\u5EA6"}),(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u4F7F\u7528\u91CF"}),(0,pt.jsx)("th",{scope:"col",className:"px-2 py-1.5 font-medium",children:"\u64CD\u4F5C"})]})}),(0,pt.jsx)("tbody",{children:r.length===0?(0,pt.jsx)("tr",{children:(0,pt.jsx)("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(0,pt.jsxs)("tr",{className:"border-b last:border-0",children:[(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsx)(T,{"aria-label":`\u653F\u7B56\u540D\u79F0 ${d.id}`,value:d.name,onChange:u=>i(d.id,"name",u.target.value)})}),(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsx)(T,{"aria-label":`\u7C7B\u578B ${d.id}`,value:d.type,onChange:u=>i(d.id,"type",u.target.value)})}),(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsx)(T,{"aria-label":`\u6761\u4EF6 ${d.id}`,value:d.condition,onChange:u=>i(d.id,"condition",u.target.value)})}),(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsx)(T,{"aria-label":`\u5956\u52B1 ${d.id}`,value:d.reward,onChange:u=>i(d.id,"reward",u.target.value)})}),(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsx)(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)})}),(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,pt.jsx)(Po,{value:m,"aria-label":`\u4F7F\u7528\u8FDB\u5EA6 ${d.id}`,children:(0,pt.jsx)(gc,{style:{width:`${m}%`}})}),(0,pt.jsxs)("span",{className:"text-xs tabular-nums text-muted-foreground",children:[d.used," / ",d.quota]})]})}),(0,pt.jsx)("td",{className:"px-2 py-1.5",children:(0,pt.jsx)(C,{type:"button",variant:"ghost",size:"sm","aria-label":`\u5220\u9664\u653F\u7B56 ${d.id}`,onClick:()=>c(d.id),children:(0,pt.jsx)(Le,{className:"size-4","aria-hidden":!0})})})]},d.id)})})]}),(0,pt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pt.jsxs)(we,{className:"text-muted-foreground",children:["\u5171 ",r.length," \u6761"]}),(0,pt.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:s,children:[(0,pt.jsx)(Re,{className:"size-4","aria-hidden":!0}),"\u65B0\u589E\u653F\u7B56"]})]})]})}var Sy=M(require("react"),1);var tl=require("react/jsx-runtime"),QT={open:"\u5F00\u6237",close:"\u9500\u6237",change:"\u53D8\u66F4"};function XT({type:e,onSubmit:t,className:a}){let[r,o]=Sy.useState("");return(0,tl.jsxs)("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:[(0,tl.jsxs)("div",{className:"text-sm font-medium",children:[QT[e],"\u7533\u8BF7"]}),(0,tl.jsxs)("label",{className:"text-sm",children:[(0,tl.jsx)("span",{className:"mb-1 block text-muted-foreground",children:"\u7533\u8BF7\u4E8B\u7531"}),(0,tl.jsx)(Ta,{value:r,onChange:n=>o(n.target.value),placeholder:"\u8BF7\u8F93\u5165\u7533\u8BF7\u4E8B\u7531",required:!0})]}),(0,tl.jsx)("div",{className:"flex justify-end",children:(0,tl.jsx)(C,{type:"submit",children:"\u63D0\u4EA4\u7533\u8BF7"})})]})}var ta=require("react/jsx-runtime");function YT({totalAmount:e,matchedAmount:t,unmatchedAmount:a,matchedCount:r,unmatchedCount:o,className:n}){let i=e>0?t/e:0,c=r+o;return(0,ta.jsxs)(re,{"data-slot":"reconciliation-summary",className:l("w-full",n),children:[(0,ta.jsx)(he,{children:(0,ta.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,ta.jsx)(Pu,{className:"size-4 text-primary"}),"\u5BF9\u8D26\u6C47\u603B"]})}),(0,ta.jsxs)(oe,{className:"flex flex-col gap-4",children:[(0,ta.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-4",children:[(0,ta.jsx)("p",{className:"text-xs text-muted-foreground",children:"\u5BF9\u8D26\u603B\u989D"}),(0,ta.jsx)("p",{className:"text-2xl font-semibold tabular-nums",children:ze(e)})]}),(0,ta.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ta.jsxs)("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:[(0,ta.jsx)(ft,{className:"mt-0.5 size-4 text-emerald-600"}),(0,ta.jsxs)("div",{className:"min-w-0",children:[(0,ta.jsx)("p",{className:"text-xs text-muted-foreground",children:"\u5DF2\u5339\u914D"}),(0,ta.jsx)("p",{className:"text-sm font-semibold tabular-nums",children:ze(t)}),(0,ta.jsxs)("p",{className:"text-xs text-muted-foreground tabular-nums",children:[r," \u7B14"]})]})]}),(0,ta.jsxs)("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:[(0,ta.jsx)(ir,{className:"mt-0.5 size-4 text-amber-600"}),(0,ta.jsxs)("div",{className:"min-w-0",children:[(0,ta.jsx)("p",{className:"text-xs text-muted-foreground",children:"\u672A\u5339\u914D"}),(0,ta.jsx)("p",{className:"text-sm font-semibold tabular-nums",children:ze(a)}),(0,ta.jsxs)("p",{className:"text-xs text-muted-foreground tabular-nums",children:[o," \u7B14"]})]})]})]}),(0,ta.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,ta.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,ta.jsx)("span",{className:"text-muted-foreground",children:"\u5339\u914D\u7387"}),(0,ta.jsxs)("span",{className:"font-medium tabular-nums",children:[(i*100).toFixed(1),"%"]})]}),(0,ta.jsx)("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:(0,ta.jsx)("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${Math.min(100,i*100)}%`}})}),(0,ta.jsxs)("p",{className:"text-xs text-muted-foreground tabular-nums",children:["\u5171 ",c," \u7B14 \xB7 \u5DF2\u5339\u914D ",r," \xB7 \u672A\u5339\u914D ",o]})]})]})]})}var SW=require("react");var Vd=require("react/jsx-runtime"),JT={unsettled:{label:"\u672A\u7ED3\u7B97",icon:(0,Vd.jsx)(Bn,{}),className:"bg-muted text-muted-foreground"},partial:{label:"\u90E8\u5206\u7ED3\u7B97",icon:(0,Vd.jsx)(Te,{}),className:"bg-amber-100 text-amber-700 dark:bg-amber-950/40 dark:text-amber-400"},settled:{label:"\u5DF2\u7ED3\u7B97",icon:(0,Vd.jsx)(ft,{}),className:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400"},overdue:{label:"\u903E\u671F",icon:(0,Vd.jsx)(ir,{}),className:"bg-destructive/10 text-destructive"}};function ZT({status:e,className:t}){let a=JT[e];return(0,Vd.jsxs)("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]})}var BW=require("react");var Sm=require("react/jsx-runtime");function eR({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(0,Sm.jsx)("span",{"data-slot":"sign-action-button",className:l("inline-flex",r),children:(0,Sm.jsx)(C,{type:"button",variant:t?"secondary":"default",onClick:t?void 0:e,onKeyDown:n,disabled:t,"aria-label":o,"aria-pressed":t,icon:t?(0,Sm.jsx)(G,{}):(0,Sm.jsx)(Zc,{}),children:o})})}var Iy=M(require("react"),1);var en=require("react/jsx-runtime"),tR={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 aR({invoices:e,onIssue:t,className:a}){let[r,o]=Iy.useState(null),n=async c=>{o(c);try{await t?.(c)}finally{o(null)}},i=e.reduce((c,s)=>c+s.amount,0);return(0,en.jsxs)("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:[(0,en.jsxs)("div",{className:"flex items-center justify-between",children:[(0,en.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,en.jsx)(gn,{className:"size-4"}),"\u53D1\u7968\u7BA1\u7406"]}),(0,en.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u5171 ",e.length," \u5F20 \xB7 \u5408\u8BA1 ",ze(i)]})]}),(0,en.jsx)("ul",{className:"flex flex-col divide-y",role:"list",children:e.map(c=>{let s=tR[c.status]??{label:c.status,tone:"bg-muted text-muted-foreground"},d=c.status==="pending"||c.status==="draft";return(0,en.jsxs)("li",{className:"flex items-center gap-3 py-2 text-sm",children:[(0,en.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:c.number}),(0,en.jsx)("span",{className:l("rounded px-1.5 py-0.5 text-xs",s.tone),children:s.label}),(0,en.jsx)("span",{className:"ml-auto font-medium tabular-nums",children:ze(c.amount)}),d&&(0,en.jsxs)(C,{type:"button",variant:"outline",size:"sm",disabled:r===c.id,onClick:()=>n(c.id),"aria-label":`\u5F00\u5177\u53D1\u7968 ${c.number}`,children:[(0,en.jsx)(qs,{className:"size-3"}),r===c.id?"\u5F00\u5177\u4E2D":"\u5F00\u5177"]})]},c.id)})}),e.length===0&&(0,en.jsx)("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u53D1\u7968"})]})}var Od=require("react/jsx-runtime");function rR({total:e,currency:t="\xA5",payLabel:a="Pay Now",isLoading:r,onPay:o,className:n}){return(0,Od.jsxs)("div",{"data-slot":"checkout-bar",className:l("bg-background sticky bottom-0 flex items-center justify-between border-t p-4",n),children:[(0,Od.jsxs)("div",{className:"flex items-baseline gap-0.5",children:[(0,Od.jsx)("span",{className:"text-muted-foreground text-xs",children:"Total"}),(0,Od.jsxs)("span",{className:"text-xl font-bold",children:[t," ",e]})]}),(0,Od.jsx)(C,{size:"lg",onClick:o,disabled:r,children:r?"Processing...":a})]})}var Ls=require("react/jsx-runtime");function oR({value:e,description:t,expiresAt:a,used:r,onUse:o,className:n}){return(0,Ls.jsxs)("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:[(0,Ls.jsx)("div",{className:"border-border absolute inset-y-0 left-24 w-px border-l border-dashed"}),(0,Ls.jsxs)("div",{className:"flex w-24 shrink-0 flex-col items-center justify-center",children:[(0,Ls.jsx)("span",{className:"text-primary text-xl font-bold",children:e}),a&&(0,Ls.jsxs)("span",{className:"text-muted-foreground mt-0.5 text-[0.65rem]",children:["Until ",a]})]}),(0,Ls.jsxs)("div",{className:"flex flex-1 flex-col gap-1 pl-4",children:[t&&(0,Ls.jsx)("p",{className:"text-sm",children:t}),r&&(0,Ls.jsx)("span",{className:"text-muted-foreground text-xs",children:"Used"})]}),!r&&o&&(0,Ls.jsx)(C,{variant:"outline",size:"sm",onClick:o,children:"Use"})]})}var al=require("react/jsx-runtime");function nR({url:e,description:t,className:a}){let[r,o]=us();return(0,al.jsxs)("div",{"data-slot":"invite-link",className:l("bg-card flex flex-col gap-2 rounded-lg border p-4",a),children:[t&&(0,al.jsx)("p",{className:"text-muted-foreground text-sm",children:t}),(0,al.jsxs)("div",{className:"flex gap-2",children:[(0,al.jsx)(T,{value:e,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,al.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>o(e),className:"shrink-0",children:[r?(0,al.jsx)(G,{className:"text-success"}):(0,al.jsx)(za,{}),r?"Copied":"Copy"]})]})]})}var e9=require("react");var zs=require("react/jsx-runtime"),sR=[{id:"card",label:"Card",icon:(0,zs.jsx)(pb,{})},{id:"wechat",label:"WeChat",icon:(0,zs.jsx)(rd,{})},{id:"alipay",label:"Alipay",icon:(0,zs.jsx)(rd,{})},{id:"transfer",label:"Bank Transfer",icon:(0,zs.jsx)(Pu,{})}];function iR({value:e,onChange:t,className:a}){return(0,zs.jsxs)("div",{"data-slot":"payment-method-selector",className:l("grid gap-2",a),children:[(0,zs.jsx)(we,{className:"text-sm font-medium",children:"Payment Method"}),(0,zs.jsx)("div",{className:"grid grid-cols-2 gap-2",children:sR.map(r=>(0,zs.jsxs)("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,(0,zs.jsx)("span",{children:r.label})]},r.id))})]})}var Gn=require("react/jsx-runtime");function lR({status:e,orderId:t,amount:a,primaryLabel:r,onPrimary:o,secondaryLabel:n,onSecondary:i,className:c}){let s=e==="success";return(0,Gn.jsxs)("div",{"data-slot":"payment-result",className:l("flex flex-col items-center justify-center gap-4 p-8 text-center",c),children:[(0,Gn.jsx)("div",{className:l("flex size-16 items-center justify-center rounded-full",s?"bg-success/20":"bg-destructive/20"),children:s?(0,Gn.jsx)(G,{className:"text-success size-8"}):(0,Gn.jsx)("span",{className:"text-destructive text-3xl font-bold",children:"!"})}),(0,Gn.jsx)("h2",{className:"text-xl font-semibold",children:s?"Payment Successful":"Payment Failed"}),(0,Gn.jsxs)("div",{className:"text-muted-foreground space-y-1 text-sm",children:[t&&(0,Gn.jsxs)("p",{children:["Order: ",t]}),a&&(0,Gn.jsxs)("p",{children:["Amount: ",a]})]}),(0,Gn.jsxs)("div",{className:"mt-2 flex gap-3",children:[n&&(0,Gn.jsx)(C,{variant:"outline",onClick:i,children:n}),r&&(0,Gn.jsx)(C,{onClick:o,children:r})]})]})}var d9=require("react");var Hr=require("react/jsx-runtime"),dR={label:"\u5F85\u4ED8\u6B3E",tone:"text-muted-foreground",icon:Te},cR={paid:{label:"\u5DF2\u4ED8\u6B3E",tone:"text-emerald-600",icon:ft},pending:{label:"\u5F85\u4ED8\u6B3E",tone:"text-yellow-600",icon:Te},overdue:{label:"\u5DF2\u903E\u671F",tone:"text-destructive",icon:mn},default:{label:"\u5F85\u4ED8\u6B3E",tone:"text-muted-foreground",icon:Te}};function mR({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=>cR[i]??dR;return(0,Hr.jsxs)("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:[(0,Hr.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,Hr.jsx)("span",{className:"text-sm font-medium",children:"\u4ED8\u6B3E\u8BA1\u5212"}),(0,Hr.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u5DF2\u4ED8 ",o,"%"]})]}),(0,Hr.jsx)("div",{className:"h-2 overflow-hidden rounded bg-muted",children:(0,Hr.jsx)("div",{className:"h-full rounded bg-emerald-500",style:{width:`${o}%`}})}),(0,Hr.jsx)("ol",{className:"flex flex-col",role:"list",children:e.map((i,c)=>{let s=n(i.status),d=s.icon;return(0,Hr.jsxs)("li",{className:"flex gap-3 pb-4 last:pb-0",children:[(0,Hr.jsxs)("div",{className:"flex flex-col items-center",children:[(0,Hr.jsx)("span",{className:l("flex size-7 items-center justify-center rounded-full border-2 bg-card",s.tone),children:(0,Hr.jsx)(d,{className:"size-3.5"})}),c<e.length-1&&(0,Hr.jsx)("span",{className:"mt-1 w-px flex-1 bg-border","aria-hidden":"true"})]}),(0,Hr.jsxs)("div",{className:"flex flex-1 flex-col gap-0.5 pt-0.5",children:[(0,Hr.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Hr.jsx)("span",{className:"text-sm font-medium",children:Mt(i.date)}),(0,Hr.jsx)("span",{className:"text-sm font-medium tabular-nums",children:ze(i.amount)})]}),(0,Hr.jsx)("span",{className:l("text-xs",s.tone),children:s.label})]})]},i.id)})}),e.length===0&&(0,Hr.jsx)("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u4ED8\u6B3E\u8BA1\u5212"})]})}var tn=require("react/jsx-runtime");function uR({title:e,fields:t,lines:a,className:r}){return(0,tn.jsxs)("div",{"data-slot":"bill-print-template",className:l("rounded-lg border bg-white p-6 text-black print:shadow-none",r),children:[(0,tn.jsx)("h2",{className:"text-center text-lg font-bold",children:e}),(0,tn.jsx)("dl",{className:"mt-4 grid grid-cols-2 gap-x-6 gap-y-1 text-sm",children:t.map(o=>(0,tn.jsxs)("div",{className:"flex",children:[(0,tn.jsxs)("dt",{className:"text-muted-foreground",children:[o.label,"\uFF1A"]}),(0,tn.jsx)("dd",{className:"font-medium",children:o.value})]},o.label))}),a&&a.length>0&&(()=>{let o=a[0];return o?(0,tn.jsxs)("table",{className:"mt-4 w-full border-collapse text-sm",children:[(0,tn.jsx)("thead",{children:(0,tn.jsx)("tr",{children:Object.keys(o).map(n=>(0,tn.jsx)("th",{className:"border bg-muted/40 px-2 py-1 text-left",children:n},n))})}),(0,tn.jsx)("tbody",{children:a.map((n,i)=>(0,tn.jsx)("tr",{children:Object.values(n).map((c,s)=>(0,tn.jsx)("td",{className:"border px-2 py-1",children:c},s))},i))})]}):null})()]})}var an=require("react/jsx-runtime"),pR={docx:(0,an.jsx)(Pa,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),xlsx:(0,an.jsx)(Sb,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),pdf:(0,an.jsx)(Pa,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),csv:(0,an.jsx)(Us,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),other:(0,an.jsx)(Us,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})},gR={docx:"Word",xlsx:"Excel",pdf:"PDF",csv:"CSV",other:"\u6587\u4EF6"};function fR({templates:e,onDownload:t,emptyLabel:a="\u6682\u65E0\u53EF\u7528\u6A21\u677F",className:r}){return e.length===0?(0,an.jsx)("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}):(0,an.jsx)("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=>(0,an.jsxs)("li",{"data-slot":"template-download-item",className:"flex items-center gap-3 p-2.5",children:[pR[o.type],(0,an.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,an.jsx)("p",{className:"truncate text-sm font-medium",children:o.name}),(0,an.jsx)("p",{className:"text-xs text-muted-foreground",children:gR[o.type]})]}),(0,an.jsxs)("a",{"data-slot":"template-download-link",href:o.url,download:o.name,className:l(Fi({variant:"outline",size:"sm"})),onClick:()=>t?.(o),children:[(0,an.jsx)(mo,{className:"size-4","aria-hidden":!0}),"\u4E0B\u8F7D"]})]},o.id))})}var va=require("react/jsx-runtime");function bR({errors:e,onExport:t,className:a}){let r=e.length;return(0,va.jsxs)("section",{"data-slot":"import-error-table",className:l("flex flex-col gap-3",a),"aria-labelledby":"import-error-table-title",children:[(0,va.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,va.jsxs)("h3",{id:"import-error-table-title",className:"flex items-center gap-1.5 text-sm font-medium",children:[(0,va.jsx)(ir,{className:"size-4 text-destructive","aria-hidden":"true"}),(0,va.jsx)("span",{children:"\u5BFC\u5165\u9519\u8BEF"}),(0,va.jsx)("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?(0,va.jsxs)("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:[(0,va.jsx)(mo,{className:"size-3.5","aria-hidden":"true"}),(0,va.jsx)("span",{children:"\u5BFC\u51FA\u9519\u8BEF"})]}):null]}),r===0?(0,va.jsx)("p",{className:"rounded-md border border-dashed p-4 text-center text-sm text-muted-foreground",children:"\u6CA1\u6709\u5BFC\u5165\u9519\u8BEF"}):(0,va.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,va.jsxs)("table",{className:"w-full text-sm",children:[(0,va.jsxs)("caption",{className:"sr-only",children:["\u5BFC\u5165\u9519\u8BEF\u660E\u7EC6\uFF0C\u5171 ",r," \u6761"]}),(0,va.jsx)("thead",{className:"bg-muted/50",children:(0,va.jsxs)("tr",{children:[(0,va.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u884C\u53F7"}),(0,va.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u5B57\u6BB5"}),(0,va.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u9519\u8BEF\u503C"}),(0,va.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u9519\u8BEF\u539F\u56E0"})]})}),(0,va.jsx)("tbody",{children:e.map((o,n)=>(0,va.jsxs)("tr",{className:"border-t",children:[(0,va.jsx)("td",{className:"px-3 py-2 tabular-nums text-muted-foreground",children:o.row}),(0,va.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:o.field??"\u2014"}),(0,va.jsx)("td",{className:"max-w-[12rem] truncate px-3 py-2 font-mono text-xs",children:o.value??"\u2014"}),(0,va.jsx)("td",{className:"px-3 py-2 text-destructive",children:o.message})]},`${o.row}-${n}`))})]})})]})}var Dy=M(require("react"),1);var hs=require("react/jsx-runtime");function xR({open:e,onOpenChange:t,items:a,onPrint:r,className:o}){let[n,i]=Dy.useState(new Set),c=s=>i(d=>{let m=new Set(d);return m.has(s)?m.delete(s):m.add(s),m});return(0,hs.jsx)(Ye,{open:e,onOpenChange:t,children:(0,hs.jsxs)(Je,{className:l("max-w-md",o),"data-slot":"batch-print-dialog",children:[(0,hs.jsx)(nt,{children:(0,hs.jsx)(Ze,{children:"\u6279\u91CF\u6253\u5370"})}),(0,hs.jsx)("div",{className:"flex flex-col gap-2",children:a.map(s=>(0,hs.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,hs.jsx)(po,{checked:n.has(s.id),onCheckedChange:()=>c(s.id)}),s.title]},s.id))}),(0,hs.jsx)(bt,{children:(0,hs.jsxs)(C,{onClick:()=>r?.(Array.from(n)),disabled:n.size===0,children:[(0,hs.jsx)(_s,{className:"size-4"}),"\u6253\u5370 ",n.size||""," \u9879"]})})]})})}var Dp=M(require("react"),1);var tr=require("react/jsx-runtime"),vR={title:"",fields:[]};function hR({template:e,onChange:t,className:a}){let r=Dp.useMemo(()=>e&&e.title!==void 0&&Array.isArray(e.fields)?e:vR,[e]),o=Dp.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(0,tr.jsxs)("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:[(0,tr.jsxs)("div",{className:"flex items-center gap-2",children:[(0,tr.jsx)(Pa,{className:"size-5 text-muted-foreground"}),(0,tr.jsx)("h3",{className:"text-sm font-semibold",children:"\u6253\u5370\u6A21\u677F\u6784\u5EFA\u5668"})]}),(0,tr.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,tr.jsx)("label",{htmlFor:"print-template-title",className:"text-xs font-medium text-muted-foreground",children:"\u6A21\u677F\u6807\u9898"}),(0,tr.jsx)(T,{id:"print-template-title",type:"text",value:r.title,placeholder:"\u8BF7\u8F93\u5165\u6A21\u677F\u6807\u9898",onChange:n})]}),(0,tr.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,tr.jsxs)("div",{className:"flex items-center justify-between",children:[(0,tr.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"\u5B57\u6BB5\u5217\u8868"}),(0,tr.jsx)(C,{type:"button",variant:"outline",size:"sm",icon:(0,tr.jsx)(Re,{}),onClick:s,children:"\u6DFB\u52A0\u5B57\u6BB5"})]}),r.fields.length===0?(0,tr.jsx)("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"}):(0,tr.jsx)("ol",{role:"list",className:"flex flex-col gap-2",children:r.fields.map((m,u)=>(0,tr.jsxs)("li",{"data-slot":"print-template-field",className:"flex items-center gap-2 rounded-md border bg-background p-2",children:[(0,tr.jsx)(Ws,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,tr.jsx)("span",{className:"w-5 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:u+1}),(0,tr.jsx)(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)}),(0,tr.jsx)(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)}),(0,tr.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`\u5220\u9664\u5B57\u6BB5 ${u+1}`,onClick:()=>d(u),children:(0,tr.jsx)(Le,{})})]},u))})]})]})}var L9=require("react");var Oa=require("react/jsx-runtime"),yR={pending:{label:"\u5F85\u6253\u5370",variant:"secondary",icon:(0,Oa.jsx)(Te,{})},printing:{label:"\u6253\u5370\u4E2D",variant:"default",icon:(0,Oa.jsx)(_s,{})},done:{label:"\u5DF2\u5B8C\u6210",variant:"outline",icon:(0,Oa.jsx)(ft,{})},error:{label:"\u5931\u8D25",variant:"destructive",icon:(0,Oa.jsx)(ir,{})}};function NR({jobs:e=[],onPrint:t,onRefresh:a,className:r}){let o=e.filter(n=>n.status==="pending"||n.status==="printing").length;return(0,Oa.jsxs)("div",{"data-slot":"print-service",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4 text-card-foreground",r),children:[(0,Oa.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,Oa.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Oa.jsx)(_s,{className:"size-5 text-muted-foreground"}),(0,Oa.jsx)("h3",{className:"text-sm font-semibold",children:"\u6253\u5370\u670D\u52A1"}),o>0&&(0,Oa.jsxs)(L,{variant:"default",children:[o," \u9879\u5F85\u5904\u7406"]})]}),(0,Oa.jsx)(C,{type:"button",variant:"outline",size:"sm",icon:(0,Oa.jsx)(zr,{}),onClick:a,children:"\u5237\u65B0"})]}),e.length===0?(0,Oa.jsx)("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"}):(0,Oa.jsx)("ul",{role:"list",className:"flex flex-col divide-y divide-border",children:e.map(n=>{let i=yR[n.status];return(0,Oa.jsxs)("li",{"data-slot":"print-service-job",className:"flex items-center gap-3 py-2.5",children:[(0,Oa.jsx)(Pa,{className:"size-4 shrink-0 text-muted-foreground"}),(0,Oa.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Oa.jsx)("p",{className:"truncate text-sm font-medium",children:n.title}),n.pages!=null&&(0,Oa.jsxs)("p",{className:"text-xs text-muted-foreground",children:[n.pages," \u9875"]})]}),(0,Oa.jsxs)(L,{variant:i.variant,children:[i.icon,i.label]}),(0,Oa.jsx)(C,{type:"button",variant:"ghost",size:"sm",icon:(0,Oa.jsx)(_s,{}),onClick:()=>t?.(n),disabled:n.status==="done",children:"\u6253\u5370"})]},n.id)})})]})}var Mp=M(require("react"),1);var Bc=require("react/jsx-runtime");function CR({accept:e,maxSize:t,onUpload:a,className:r}){let o=Mp.useRef(null),[n,i]=Mp.useState(!1),c=s=>{if(!s)return;let d=Array.from(s),m=t?d.filter(u=>u.size<=t):d;a?.(m)};return(0,Bc.jsxs)("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:[(0,Bc.jsx)(Gs,{className:"size-6"}),(0,Bc.jsxs)("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`:""]}),(0,Bc.jsx)("input",{ref:o,type:"file",accept:e,multiple:!0,className:"hidden",onChange:s=>c(s.target.files)})]})}var O9=require("react");var zo=require("react/jsx-runtime");function kR(e){return e.startsWith("image/")?(0,zo.jsx)(Wr,{}):e==="application/pdf"||e==="text/plain"||e.startsWith("text/")?(0,zo.jsx)(Pa,{}):(0,zo.jsx)(Us,{})}function Rf({name:e,size:t,type:a,url:r,onRemove:o,className:n}){return(0,zo.jsxs)("div",{"data-slot":"file-card",className:l("flex items-center gap-3 rounded-lg border bg-card p-3 text-sm",n),children:[(0,zo.jsx)("span",{"aria-hidden":"true",className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:kR(a)}),(0,zo.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,zo.jsx)("span",{className:"truncate font-medium",title:e,children:e}),(0,zo.jsx)("span",{className:"text-xs text-muted-foreground",children:Yu(t)})]}),(0,zo.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[r!==void 0&&(0,zo.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`\u4E0B\u8F7D ${e}`,render:(0,zo.jsx)("a",{href:r,download:e}),children:(0,zo.jsx)(mo,{})}),o!==void 0&&(0,zo.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`\u79FB\u9664 ${e}`,onClick:o,children:(0,zo.jsx)(ee,{})})]})]})}var Bp=require("react/jsx-runtime");function wR({attachments:e,onRemove:t,className:a}){return e.length===0?(0,Bp.jsx)("div",{"data-slot":"attachment-list",className:l("text-sm text-muted-foreground",a),children:"\u6682\u65E0\u9644\u4EF6"}):(0,Bp.jsx)("div",{"data-slot":"attachment-list",className:l("flex flex-col gap-2",a),children:e.map(r=>(0,Bp.jsx)(Rf,{name:r.name,size:r.size,type:r.type,...r.url!==void 0?{url:r.url}:{},...t?{onRemove:()=>t(r.id)}:{}},r.id))})}var Ud=require("react/jsx-runtime");function PR({url:e,type:t,name:a,className:r}){return(0,Ud.jsx)("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/")?(0,Ud.jsx)("img",{src:e,alt:a??"\u9644\u4EF6",className:"max-h-80 object-contain"}):(0,Ud.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:"flex flex-col items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[(0,Ud.jsx)(Us,{className:"size-10"}),(0,Ud.jsx)("span",{className:"underline",children:a??"\u6253\u5F00\u9644\u4EF6"})]})})}var Wd=M(require("react"),1);var jr=require("react/jsx-runtime");function TR({images:e,className:t}){let[a,r]=Wd.useState(0),[o,n]=Wd.useState(!1),i=e.length,c=i===0?0:Math.min(a,i-1),s=i===0?null:e[c],d=Wd.useCallback(f=>{i!==0&&r((f%i+i)%i)},[i]),m=Wd.useCallback(()=>d(c-1),[d,c]),u=Wd.useCallback(()=>d(c+1),[d,c]),p=(f,x)=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),r(x))};return i===0?(0,jr.jsxs)("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:[(0,jr.jsx)(Wr,{className:"size-6","aria-hidden":"true"}),(0,jr.jsx)("span",{children:"\u6682\u65E0\u56FE\u7247"})]}):(0,jr.jsxs)("div",{"data-slot":"image-gallery",className:l("flex flex-col gap-3",t),children:[(0,jr.jsxs)("div",{className:l("group relative flex items-center justify-center overflow-hidden rounded-lg border bg-muted",o?"h-[32rem]":"h-64"),children:[(0,jr.jsx)("img",{src:s.src,alt:s.alt??`\u56FE\u7247 ${c+1}`,className:"h-full w-full object-contain"}),(0,jr.jsx)(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:(0,jr.jsx)($t,{})}),(0,jr.jsx)(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:(0,jr.jsx)(ke,{})}),(0,jr.jsx)(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:(0,jr.jsx)(fu,{})}),(0,jr.jsxs)("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&&(0,jr.jsx)("ul",{role:"list",className:"flex gap-2 overflow-x-auto pb-1",children:e.map((f,x)=>{let v=x===c;return(0,jr.jsx)("li",{className:"shrink-0",children:(0,jr.jsx)("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:(0,jr.jsx)("img",{src:f.src,alt:`\u7F29\u7565\u56FE ${x+1}`,className:"h-full w-full object-cover"})})},`${f.src}-${x}`)})})]})}var Im=M(require("react"),1);var ys=require("react/jsx-runtime");function RR(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 SR({onPaste:e,children:t,className:a}){let[r,o]=Im.useState(null),n=Im.useCallback(c=>{let s=c.nativeEvent,d=RR(s);d.length!==0&&(c.preventDefault(),o(d.length),e?.(d))},[e]),i=Im.useCallback(c=>{(c.ctrlKey||c.metaKey)&&(c.key==="v"||c.key)},[]);return(0,ys.jsxs)("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??(0,ys.jsxs)(ys.Fragment,{children:[(0,ys.jsx)("span",{"aria-hidden":"true",className:"flex size-9 items-center justify-center rounded-md bg-muted text-foreground",children:(0,ys.jsx)(cb,{})}),(0,ys.jsx)("p",{className:"font-medium text-foreground",children:"\u7C98\u8D34\u6587\u4EF6\u4EE5\u4E0A\u4F20"}),(0,ys.jsxs)("p",{className:"flex items-center gap-1 text-xs",children:[(0,ys.jsx)(Gs,{"aria-hidden":"true",className:"size-3.5"}),"\u6309 Ctrl/Cmd + V \u7C98\u8D34\u56FE\u7247\u6216\u6587\u4EF6"]})]}),r!==null&&(0,ys.jsxs)("p",{role:"status",className:"mt-1 text-xs text-primary",children:["\u5DF2\u6355\u83B7 ",r," \u4E2A\u6587\u4EF6"]})]})}var Ua=require("react/jsx-runtime");function IR(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 DR(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 MR({tasks:e,className:t}){return(0,Ua.jsx)("div",{"data-slot":"task-list-table",className:l("overflow-x-auto rounded-lg ring-1 ring-border",t),children:(0,Ua.jsxs)("table",{className:"w-full text-sm",children:[(0,Ua.jsx)("thead",{className:"bg-muted/50 text-muted-foreground",children:(0,Ua.jsxs)("tr",{children:[(0,Ua.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u6807\u9898"}),(0,Ua.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u72B6\u6001"}),(0,Ua.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4F18\u5148\u7EA7"}),(0,Ua.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u8D1F\u8D23\u4EBA"}),(0,Ua.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u622A\u6B62\u65E5\u671F"})]})}),(0,Ua.jsxs)("tbody",{className:"divide-y divide-border",children:[e.map(a=>(0,Ua.jsxs)("tr",{className:"hover:bg-muted/30",children:[(0,Ua.jsx)("td",{className:"px-3 py-2 font-medium",children:a.title}),(0,Ua.jsx)("td",{className:"px-3 py-2",children:(0,Ua.jsx)("span",{className:l("inline-flex rounded px-1.5 py-0.5 text-xs font-medium",DR(a.status)),children:a.status})}),(0,Ua.jsx)("td",{className:"px-3 py-2",children:(0,Ua.jsx)("span",{className:l("inline-flex rounded px-1.5 py-0.5 text-xs font-medium",IR(a.priority)),children:a.priority})}),(0,Ua.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:a.assignee??"\u2014"}),(0,Ua.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:a.deadline?(0,Ua.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,Ua.jsx)(Te,{className:"size-3"}),Mt(a.deadline)]}):"\u2014"})]},a.id)),e.length===0?(0,Ua.jsx)("tr",{children:(0,Ua.jsx)("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u4EFB\u52A1"})}):null]})]})})}var c_=require("react");var rl=require("react/jsx-runtime");function BR({entries:e=[],className:t}){return(0,rl.jsx)("nav",{"data-slot":"quick-entry-grid",className:l("w-full",t),"aria-label":"\u5FEB\u6377\u5165\u53E3",children:(0,rl.jsx)("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=>(0,rl.jsx)("li",{children:(0,rl.jsxs)("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:[(0,rl.jsx)("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??(0,rl.jsx)(uu,{className:"size-5"})}),(0,rl.jsx)("span",{className:"text-sm font-medium text-foreground",children:a.label})]})},a.id))})})}var _d=require("react/jsx-runtime");function LR({title:e,content:t,date:a,pinned:r,className:o}){return(0,_d.jsxs)("div",{"data-slot":"announcement-card",className:l("relative rounded-lg border bg-card p-4",r&&"border-primary/40",o),children:[r&&(0,_d.jsx)(vu,{className:"absolute right-3 top-3 size-4 text-primary","aria-label":"\u7F6E\u9876"}),(0,_d.jsx)("div",{className:"font-medium",children:e}),(0,_d.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:t}),a&&(0,_d.jsx)("div",{className:"mt-2 text-xs text-muted-foreground",children:Mt(a)})]})}var v_=require("react");var Ma=require("react/jsx-runtime"),zR={1:Cu,2:Bb,3:Rb};function AR({rows:e,className:t}){return(0,Ma.jsxs)("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:[(0,Ma.jsxs)("table",{className:"w-full text-sm",children:[(0,Ma.jsx)("caption",{className:"sr-only",children:"\u4E1A\u7EE9\u6392\u540D"}),(0,Ma.jsx)("thead",{className:"border-b bg-muted/50 text-xs text-muted-foreground",children:(0,Ma.jsxs)("tr",{children:[(0,Ma.jsx)("th",{scope:"col",className:"px-4 py-2 text-left font-medium",children:"\u6392\u540D"}),(0,Ma.jsx)("th",{scope:"col",className:"px-4 py-2 text-left font-medium",children:"\u59D3\u540D"}),(0,Ma.jsx)("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"\u4E1A\u7EE9"}),(0,Ma.jsx)("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"\u73AF\u6BD4"})]})}),(0,Ma.jsx)("tbody",{className:"divide-y",children:e.map(a=>{let r=(a.growth??0)>=0,o=r?as:ts,n=zR[a.rank];return(0,Ma.jsxs)("tr",{className:"hover:bg-muted/30",children:[(0,Ma.jsx)("td",{className:"px-4 py-2.5",children:(0,Ma.jsxs)("span",{className:"flex items-center gap-1.5",children:[n?(0,Ma.jsx)(n,{className:l("size-4",a.rank===1?"text-yellow-500":a.rank===2?"text-slate-400":"text-amber-700")}):(0,Ma.jsx)("span",{className:"flex size-5 items-center justify-center rounded-full bg-muted text-xs tabular-nums",children:a.rank}),(0,Ma.jsx)("span",{className:"tabular-nums",children:a.rank})]})}),(0,Ma.jsx)("td",{className:"px-4 py-2.5 font-medium",children:a.name}),(0,Ma.jsx)("td",{className:"px-4 py-2.5 text-right tabular-nums",children:ze(a.amount)}),(0,Ma.jsx)("td",{className:"px-4 py-2.5 text-right",children:a.growth!==void 0?(0,Ma.jsxs)("span",{className:l("inline-flex items-center gap-0.5 text-xs font-medium tabular-nums",r?"text-emerald-600":"text-destructive"),children:[(0,Ma.jsx)(o,{className:"size-3"}),da(a.growth)]}):(0,Ma.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})})]},a.id)})})]}),e.length===0&&(0,Ma.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6392\u540D\u6570\u636E"})]})}var Nt=require("react/jsx-runtime");function ER({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(0,Nt.jsxs)("section",{"data-slot":"pool-tracker-table",className:l("flex flex-col gap-3",t),"aria-labelledby":"pool-tracker-table-title",children:[(0,Nt.jsxs)("h3",{id:"pool-tracker-table-title",className:"flex items-center gap-1.5 text-sm font-medium",children:[(0,Nt.jsx)(zb,{className:"size-4 text-primary","aria-hidden":"true"}),(0,Nt.jsx)("span",{children:"\u8D44\u91D1\u6C60\u8DDF\u8E2A"})]}),(0,Nt.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,Nt.jsxs)("table",{className:"w-full text-sm",children:[(0,Nt.jsxs)("caption",{className:"sr-only",children:["\u8D44\u91D1\u6C60\u4F7F\u7528\u60C5\u51B5\uFF0C\u5408\u8BA1\u603B\u989D ",Q(a)]}),(0,Nt.jsx)("thead",{className:"bg-muted/50",children:(0,Nt.jsxs)("tr",{children:[(0,Nt.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u8D44\u91D1\u6C60"}),(0,Nt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u603B\u989D"}),(0,Nt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u5DF2\u7528"}),(0,Nt.jsx)("th",{scope:"col",className:"px-3 py-2 text-right font-medium",children:"\u53EF\u7528"}),(0,Nt.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4F7F\u7528\u7387"})]})}),(0,Nt.jsxs)("tbody",{children:[e.map(n=>{let i=n.total>0?Math.min(100,n.used/n.total*100):0,c=i>=80;return(0,Nt.jsxs)("tr",{className:"border-t",children:[(0,Nt.jsx)("td",{className:"px-3 py-2 font-medium",children:n.name}),(0,Nt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:Q(n.total)}),(0,Nt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:Q(n.used)}),(0,Nt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:Q(n.available)}),(0,Nt.jsx)("td",{className:"px-3 py-2",children:(0,Nt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Nt.jsx)("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:(0,Nt.jsx)("div",{className:l("h-full rounded",c?"bg-destructive":"bg-primary"),style:{width:`${i}%`}})}),(0,Nt.jsxs)("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?(0,Nt.jsx)("tr",{children:(0,Nt.jsx)("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u8D44\u91D1\u6C60"})}):null]}),e.length>0?(0,Nt.jsx)("tfoot",{className:"border-t bg-muted/30 font-medium",children:(0,Nt.jsxs)("tr",{children:[(0,Nt.jsx)("td",{className:"px-3 py-2",children:"\u5408\u8BA1"}),(0,Nt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:Q(a)}),(0,Nt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:Q(r)}),(0,Nt.jsx)("td",{className:"px-3 py-2 text-right tabular-nums",children:Q(o)}),(0,Nt.jsx)("td",{className:"px-3 py-2"})]})}):null]})})]})}var Lp=M(require("react"),1);var Dm=require("react/jsx-runtime");function FR({taskType:e,params:t,onComplete:a,children:r,className:o}){let[n,i]=Lp.useState(!1),c=Lp.useCallback(()=>{i(!0),Promise.resolve(a?.({taskType:e,params:t})).finally(()=>i(!1))},[e,t,a]);return(0,Dm.jsx)("div",{"data-slot":"async-task-trigger",className:l("inline-flex items-center gap-2",o),children:(0,Dm.jsxs)(C,{onClick:c,disabled:n,children:[(0,Dm.jsx)(zr,{className:l("size-4",n&&"animate-spin")}),r??"\u6267\u884C\u4EFB\u52A1"]})})}var M_=require("react");var xo=require("react/jsx-runtime"),$R={running:(0,xo.jsx)(Oo,{className:"size-4 animate-spin text-primary"}),success:(0,xo.jsx)(ft,{className:"size-4 text-emerald-500"}),done:(0,xo.jsx)(ft,{className:"size-4 text-emerald-500"}),failed:(0,xo.jsx)(ns,{className:"size-4 text-destructive"}),error:(0,xo.jsx)(ns,{className:"size-4 text-destructive"}),pending:(0,xo.jsx)(Te,{className:"size-4 text-muted-foreground"})};function HR(e){let t=e.toLowerCase();return t==="success"||t==="done"||t==="failed"||t==="error"}function VR({percent:e,status:t,message:a,className:r}){let o=Math.max(0,Math.min(100,e)),n=$R[t.toLowerCase()],i=HR(t);return(0,xo.jsxs)("div",{"data-slot":"task-progress",className:l("flex flex-col gap-1.5",r),role:"status","aria-live":"polite",children:[(0,xo.jsxs)("div",{className:"flex items-center justify-between gap-2 text-sm",children:[(0,xo.jsxs)("span",{className:"flex items-center gap-1.5 font-medium",children:[n??(0,xo.jsx)(Te,{className:"size-4 text-muted-foreground"}),(0,xo.jsx)("span",{children:t})]}),(0,xo.jsxs)("span",{className:"tabular-nums text-muted-foreground",children:[o.toFixed(0),"%"]})]}),(0,xo.jsx)("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:(0,xo.jsx)("div",{className:l("h-full rounded-full transition-all",i&&t.toLowerCase()!=="success"&&t.toLowerCase()!=="done"?"bg-destructive":"bg-primary"),style:{width:`${o}%`}})}),a?(0,xo.jsx)("p",{className:"text-xs text-muted-foreground",children:a}):null]})}var Rr=require("react/jsx-runtime");function OR({tasks:e,className:t}){return(0,Rr.jsx)("div",{"data-slot":"task-history",className:l("overflow-x-auto rounded-lg ring-1 ring-border",t),children:(0,Rr.jsxs)("table",{className:"w-full text-sm",children:[(0,Rr.jsx)("thead",{className:"bg-muted/50 text-muted-foreground",children:(0,Rr.jsxs)("tr",{children:[(0,Rr.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4EFB\u52A1ID"}),(0,Rr.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u7C7B\u578B"}),(0,Rr.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u72B6\u6001"}),(0,Rr.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u5F00\u59CB\u65F6\u95F4"}),(0,Rr.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u7ED3\u675F\u65F6\u95F4"})]})}),(0,Rr.jsxs)("tbody",{className:"divide-y divide-border",children:[e.map(a=>(0,Rr.jsxs)("tr",{className:"hover:bg-muted/30",children:[(0,Rr.jsx)("td",{className:"px-3 py-2 tabular-nums",children:a.id}),(0,Rr.jsx)("td",{className:"px-3 py-2",children:a.type}),(0,Rr.jsx)("td",{className:"px-3 py-2",children:(0,Rr.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:a.status})}),(0,Rr.jsx)("td",{className:"px-3 py-2 text-muted-foreground tabular-nums",children:ri(a.startTime)}),(0,Rr.jsx)("td",{className:"px-3 py-2 text-muted-foreground tabular-nums",children:a.endTime?ri(a.endTime):"\u2014"})]},a.id)),e.length===0?(0,Rr.jsx)("tr",{children:(0,Rr.jsx)("td",{colSpan:5,className:"px-3 py-6 text-center text-muted-foreground",children:"\u6682\u65E0\u5386\u53F2\u4EFB\u52A1"})}):null]})]})})}var xi=M(require("react"),1);var Wa=require("react/jsx-runtime");function UR({steps:e,open:t,onClose:a,className:r}){let[o,n]=xi.useState(0),i=xi.useRef(null);xi.useEffect(()=>{t&&n(0)},[t]),xi.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=xi.useCallback(()=>{n(f=>Math.min(f+1,e.length-1))},[e.length]),u=xi.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:(0,Wa.jsx)("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:(0,Wa.jsxs)("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:[(0,Wa.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,Wa.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Wa.jsx)(hb,{className:"size-5 text-primary"}),(0,Wa.jsx)("h2",{className:"font-heading text-base font-medium",children:s.title})]}),(0,Wa.jsx)("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:(0,Wa.jsx)(ee,{className:"size-4"})})]}),(0,Wa.jsx)("p",{className:"mt-3 text-muted-foreground",children:s.content}),(0,Wa.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground",children:["\u76EE\u6807\uFF1A",(0,Wa.jsx)("code",{className:"rounded bg-muted px-1 py-0.5",children:s.target})]}),(0,Wa.jsxs)("div",{className:"mt-5 flex items-center justify-between",children:[(0,Wa.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:["\u7B2C ",c+1," / ",e.length," \u6B65"]}),(0,Wa.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Wa.jsxs)("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:[(0,Wa.jsx)($t,{className:"size-4"}),"\u4E0A\u4E00\u6B65"]}),d?(0,Wa.jsxs)("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:[(0,Wa.jsx)(G,{className:"size-4"}),"\u5B8C\u6210"]}):(0,Wa.jsxs)("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",(0,Wa.jsx)(ke,{className:"size-4"})]})]})]}),(0,Wa.jsx)("div",{className:"mt-4 flex items-center justify-center gap-1.5","aria-hidden":"true",children:e.map((f,x)=>(0,Wa.jsx)("span",{className:l("h-1.5 rounded-full transition-all",x===c?"w-4 bg-primary":"w-1.5 bg-muted")},f.target+x))})]})})}var Lc=M(require("react"),1);var Ct=require("react/jsx-runtime");function zp({icon:e,label:t,description:a,checked:r,onChange:o}){return(0,Ct.jsxs)("li",{className:"flex items-center gap-3 py-3",children:[(0,Ct.jsx)("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground",children:e}),(0,Ct.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Ct.jsx)("p",{className:"text-sm font-medium",children:t}),(0,Ct.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:a})]}),(0,Ct.jsx)(ws,{checked:r,onCheckedChange:o,"aria-label":`${t} \u5F00\u5173`})]})}function WR({open:e,onOpenChange:t,className:a}){let[r,o]=Lc.useState("system"),[n,i]=Lc.useState(!0),[c,s]=Lc.useState(!0),[d,m]=Lc.useState(!1),[u,p]=Lc.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(0,Ct.jsx)(ld,{"data-slot":"preference-panel",open:e,onOpenChange:t,children:(0,Ct.jsxs)(dd,{side:"right",className:l("w-full sm:max-w-sm",a),children:[(0,Ct.jsxs)(cd,{children:[(0,Ct.jsx)(md,{children:"\u504F\u597D\u8BBE\u7F6E"}),(0,Ct.jsx)(nm,{children:"\u8C03\u6574\u754C\u9762\u4E3B\u9898\u3001\u901A\u77E5\u4E0E\u663E\u793A\u504F\u597D\u3002"})]}),(0,Ct.jsxs)("div",{className:"flex items-center justify-between px-1 py-3",children:[(0,Ct.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Ct.jsx)("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground",children:r==="light"?(0,Ct.jsx)(Yc,{}):r==="dark"?(0,Ct.jsx)(Xc,{}):(0,Ct.jsx)(Qc,{})}),(0,Ct.jsxs)("div",{children:[(0,Ct.jsx)("p",{className:"text-sm font-medium",children:"\u4E3B\u9898\u6A21\u5F0F"}),(0,Ct.jsx)("p",{className:"text-xs text-muted-foreground",children:f[r]})]})]}),(0,Ct.jsx)(C,{type:"button",variant:"outline",size:"sm",onClick:x,children:"\u5207\u6362"})]}),(0,Ct.jsx)(dt,{}),(0,Ct.jsxs)("ul",{className:"flex flex-col px-1",role:"list",children:[(0,Ct.jsx)(zp,{icon:(0,Ct.jsx)(Mn,{}),label:"\u8D26\u5355\u5230\u671F\u63D0\u9192",description:"\u8D26\u5355\u5373\u5C06\u5230\u671F\u65F6\u63A8\u9001\u901A\u77E5",checked:n,onChange:i}),(0,Ct.jsx)(zp,{icon:(0,Ct.jsx)(Mn,{}),label:"\u5BA1\u6279\u7ED3\u679C\u901A\u77E5",description:"\u5BA1\u6279\u901A\u8FC7 / \u9A73\u56DE\u65F6\u901A\u77E5",checked:c,onChange:s}),(0,Ct.jsx)(zp,{icon:(0,Ct.jsx)(Qc,{}),label:"\u7D27\u51D1\u6A21\u5F0F",description:"\u538B\u7F29\u8868\u683C\u884C\u9AD8\u4EE5\u663E\u793A\u66F4\u591A\u6570\u636E",checked:d,onChange:m}),(0,Ct.jsx)(zp,{icon:(0,Ct.jsx)(pu,{}),label:"\u81EA\u52A8\u4FDD\u5B58\u8349\u7A3F",description:"\u7F16\u8F91\u8868\u5355\u65F6\u81EA\u52A8\u4FDD\u5B58\u8349\u7A3F",checked:u,onChange:p})]}),(0,Ct.jsx)("div",{className:"mt-auto flex items-center justify-end gap-2 border-t pt-4",children:(0,Ct.jsx)(Hg,{render:(0,Ct.jsx)(C,{type:"button",variant:"outline",children:"\u5173\u95ED"})})})]})})}var q_=require("react");var Wl=require("react/jsx-runtime"),_R={left:"flex-row",right:"flex-row-reverse",bottom:"flex-col"},qR={left:"w-64",right:"w-64",bottom:"h-48"};function GR({side:e,collapsed:t=!1,onToggle:a,children:r,className:o}){let n=e==="bottom",i=e==="left"?$t:e==="right"?ke:ul,c=t?`\u5C55\u5F00${e==="bottom"?"\u4E0B\u65B9":"\u4FA7\u680F"}\u9762\u677F`:`\u6298\u53E0${e==="bottom"?"\u4E0B\u65B9":"\u4FA7\u680F"}\u9762\u677F`;return(0,Wl.jsxs)("div",{"data-slot":"dock-panel",className:l("flex items-stretch",_R[e],o),children:[(0,Wl.jsx)("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:(0,Wl.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":c,onClick:a,children:(0,Wl.jsx)(i,{className:l("size-4 transition-transform",t&&"rotate-180")})})}),(0,Wl.jsx)("div",{className:l("overflow-hidden border-muted bg-card transition-all",n?"border-t":"border-l",qR[e],t?n?"h-0":"w-0":""),role:"region","aria-label":"\u505C\u9760\u9762\u677F\u5185\u5BB9","aria-hidden":t,children:(0,Wl.jsx)("div",{className:l("h-full overflow-auto p-3",n?"":"w-64"),children:t?null:r})})]})}var X_=require("react");var zc=require("react/jsx-runtime");function jR({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(0,zc.jsxs)("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:[(0,zc.jsx)("span",{className:"max-w-[10rem] truncate",title:t,children:t}),(0,zc.jsx)("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:(0,zc.jsx)(vu,{className:l("size-3.5",a&&"fill-current")})})]})}var Sf=M(require("react"),1);var ro=require("react/jsx-runtime");function KR({sidebar:e,header:t,children:a,detailPanel:r,className:o}){let[n,i]=Sf.useState(!0),[c,s]=Sf.useState(!0);return(0,ro.jsxs)("div",{"data-slot":"chat-shell",className:l("flex h-full w-full overflow-hidden bg-background",o),children:[e?(0,ro.jsx)("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:(0,ro.jsx)("div",{className:l("h-full overflow-hidden",!n&&"hidden"),children:e})}):null,(0,ro.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ro.jsxs)("div",{"data-slot":"chat-shell-topbar",className:"flex h-12 shrink-0 items-center gap-1 border-b border-border px-2",children:[e?(0,ro.jsx)("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?(0,ro.jsx)($t,{className:"size-4","aria-hidden":!0}):(0,ro.jsx)(ke,{className:"size-4","aria-hidden":!0})}):null,(0,ro.jsx)("div",{className:"min-w-0 flex-1",children:t}),r?(0,ro.jsx)("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?(0,ro.jsx)(ke,{className:"size-4","aria-hidden":!0}):(0,ro.jsx)($t,{className:"size-4","aria-hidden":!0})}):null]}),(0,ro.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,ro.jsx)("main",{"data-slot":"chat-shell-main",className:"min-w-0 flex-1 overflow-y-auto",children:a}),r?(0,ro.jsx)("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:(0,ro.jsx)("div",{className:l("h-full",!c&&"hidden"),children:r})}):null]})]})]})}var My=M(require("react"),1);var ar=require("react/jsx-runtime");function QR({conversations:e,activeId:t,onSelect:a,className:r}){let o=My.useCallback(n=>i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),a?.(n))},[a]);return(0,ar.jsxs)("div",{"data-slot":"chat-sidebar",className:l("flex h-full flex-col bg-background",r),children:[(0,ar.jsxs)("div",{className:"flex items-center gap-2 border-b border-border p-2",children:[(0,ar.jsxs)(C,{type:"button",variant:"default",size:"sm",className:"flex-1",children:[(0,ar.jsx)(Re,{className:"size-4","aria-hidden":!0}),"New chat"]}),(0,ar.jsx)(C,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Search conversations",children:(0,ar.jsx)(te,{className:"size-4","aria-hidden":!0})})]}),(0,ar.jsx)("nav",{className:"min-h-0 flex-1 overflow-y-auto","aria-label":"Conversation list",children:e.length===0?(0,ar.jsx)("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No conversations yet"}):(0,ar.jsx)("ul",{role:"list",className:"flex flex-col gap-0.5 p-1",children:e.map(n=>{let i=n.id===t;return(0,ar.jsx)("li",{children:(0,ar.jsxs)("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:[(0,ar.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium","aria-hidden":!0,children:ds(n.title)}),(0,ar.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ar.jsxs)("span",{className:"flex items-center justify-between gap-1",children:[(0,ar.jsx)("span",{className:"truncate font-medium",children:n.title}),n.time?(0,ar.jsx)("span",{className:"shrink-0 text-[0.65rem] text-muted-foreground",children:n.time}):null]}),n.lastMessage?(0,ar.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:n.lastMessage}):null]}),n.unread&&n.unread>0?(0,ar.jsx)(L,{variant:"default",className:"shrink-0","aria-label":`${n.unread} unread`,children:n.unread}):null]})},n.id)})})}),(0,ar.jsxs)("div",{className:"flex items-center gap-2 border-t border-border p-2 text-xs text-muted-foreground",children:[(0,ar.jsx)(pl,{className:"size-3.5","aria-hidden":!0}),(0,ar.jsxs)("span",{children:[e.length," conversations"]})]})]})}var d7=require("react");var vo=require("react/jsx-runtime");function XR({title:e,subtitle:t,status:a,actions:r,className:o}){return(0,vo.jsxs)("header",{"data-slot":"chat-header",className:l("flex h-full w-full items-center gap-2 px-2",o),children:[(0,vo.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,vo.jsx)("h2",{className:"truncate text-sm font-semibold",title:e,children:e}),t?(0,vo.jsx)("p",{className:"truncate text-xs text-muted-foreground",title:t,children:t}):null]}),a?(0,vo.jsx)("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,(0,vo.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:r??(0,vo.jsxs)(vo.Fragment,{children:[(0,vo.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Refresh conversation",children:(0,vo.jsx)(zr,{className:"size-4","aria-hidden":!0})}),(0,vo.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Conversation settings",children:(0,vo.jsx)(Ai,{className:"size-4","aria-hidden":!0})}),(0,vo.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"More options",children:(0,vo.jsx)(Lb,{className:"size-4","aria-hidden":!0})})]})})]})}var g7=require("react");var rn=require("react/jsx-runtime");function YR({sender:e,avatar:t,messages:a,className:r}){let o=[...a].reverse().find(n=>n.time!==void 0);return(0,rn.jsxs)("div",{"data-slot":"chat-message-group",className:l("flex gap-2",r),"aria-label":`Messages from ${e}`,children:[(0,rn.jsx)(Uo,{size:"sm",className:"mt-0.5",children:t??(0,rn.jsxs)(rn.Fragment,{children:[(0,rn.jsx)(is,{alt:e}),(0,rn.jsx)(Wo,{children:ds(e)})]})}),(0,rn.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,rn.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,rn.jsx)("span",{className:"text-xs font-semibold text-foreground",children:e}),o?.time?(0,rn.jsx)("span",{className:"text-[0.65rem] text-muted-foreground tabular-nums",children:o.time}):null]}),(0,rn.jsx)("ul",{role:"list",className:"flex flex-col gap-1",children:a.map(n=>(0,rn.jsx)("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))})]})]})}var h7=require("react");var Mm=require("react/jsx-runtime");function JR({onReply:e,onCopy:t,onDelete:a,onRegenerate:r,className:o}){let n=[e&&{label:"Reply",Icon:du,handler:e},t&&{label:"Copy",Icon:za,handler:t},r&&{label:"Regenerate",Icon:zr,handler:r},a&&{label:"Delete",Icon:Le,handler:a}].filter(Boolean);return n.length===0?(0,Mm.jsx)("div",{"data-slot":"chat-message-actions",className:l("hidden",o),"aria-hidden":!0}):(0,Mm.jsx)("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})=>(0,Mm.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:s,"aria-label":i,children:(0,Mm.jsx)(c,{className:"size-4","aria-hidden":!0})},i))})}var By=M(require("react"),1);var vi=require("react/jsx-runtime");function ZR(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function e1({content:e,duration:t,collapsed:a=!1,className:r}){let[o,n]=By.useState(!a);return(0,vi.jsxs)("div",{"data-slot":"chat-thinking-block",className:l("rounded-lg border border-border bg-muted/30",r),children:[(0,vi.jsxs)("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:[(0,vi.jsx)(ke,{className:l("size-3.5 transition-transform",o&&"rotate-90"),"aria-hidden":!0}),(0,vi.jsx)(Bu,{className:"size-3.5 text-purple-500","aria-hidden":!0}),(0,vi.jsx)("span",{children:"Thought process"}),t!==void 0?(0,vi.jsx)("span",{className:"ml-auto tabular-nums",children:ZR(t)}):null]}),o?(0,vi.jsx)("div",{className:"border-t border-border px-3 py-2",children:(0,vi.jsx)("p",{className:"whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground",children:e})}):null]})}var zy=M(require("react"),1);var oo=require("react/jsx-runtime");function Ly(e){try{return e===void 0?"":typeof e=="string"?e:JSON.stringify(e,null,2)}catch{return String(e)}}function t1({toolName:e,toolInput:t,toolOutput:a,status:r,className:o}){let[n,i]=zy.useState(!1),c=t!==void 0?Ly(t):"",s=a!==void 0?Ly(a):"",d={calling:{Icon:Oo,label:"Calling",color:"text-blue-600 dark:text-blue-400",spin:!0},success:{Icon:ft,label:"Success",color:"text-green-600 dark:text-green-400",spin:!1},error:{Icon:ns,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(0,oo.jsxs)("div",{"data-slot":"chat-tool-call-block",className:l("rounded-lg border border-border bg-muted/30",o),children:[(0,oo.jsxs)("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?(0,oo.jsx)(ke,{className:l("size-3.5 transition-transform",n&&"rotate-90"),"aria-hidden":!0}):(0,oo.jsx)("span",{className:"size-3.5","aria-hidden":!0}),(0,oo.jsx)(m,{className:l("size-3.5",f&&"animate-spin",p),"aria-hidden":!0}),(0,oo.jsx)("span",{className:"font-mono font-medium text-foreground",children:e}),(0,oo.jsx)("span",{className:l("ml-auto",p),children:u})]}),n&&x?(0,oo.jsxs)("div",{className:"border-t border-border px-3 py-2",children:[c?(0,oo.jsxs)("div",{className:"mb-2",children:[(0,oo.jsx)("p",{className:"mb-1 text-[0.65rem] font-medium uppercase tracking-wide text-muted-foreground",children:"Input"}),(0,oo.jsx)("pre",{className:"overflow-x-auto rounded bg-muted p-2 font-mono text-[0.7rem] leading-relaxed",children:(0,oo.jsx)("code",{children:c})})]}):null,s?(0,oo.jsxs)("div",{children:[(0,oo.jsx)("p",{className:"mb-1 text-[0.65rem] font-medium uppercase tracking-wide text-muted-foreground",children:"Output"}),(0,oo.jsx)("pre",{className:"overflow-x-auto rounded bg-muted p-2 font-mono text-[0.7rem] leading-relaxed",children:(0,oo.jsx)("code",{children:s})})]}):null]}):null]})}var Bm=M(require("react"),1);var Ao=require("react/jsx-runtime");function a1({code:e,language:t,filename:a,className:r}){let[o,n]=Bm.useState(!1),i=Bm.useCallback(()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},[e]),c=Bm.useCallback(s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),i())},[i]);return(0,Ao.jsxs)("div",{"data-slot":"chat-code-block",className:l("overflow-hidden rounded-lg border border-border bg-muted/40",r),children:[(0,Ao.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-muted/60 px-3 py-1.5",children:[(0,Ao.jsx)("div",{className:"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:a?(0,Ao.jsxs)(Ao.Fragment,{children:[(0,Ao.jsx)(Pa,{className:"size-3.5 shrink-0","aria-hidden":!0}),(0,Ao.jsx)("span",{className:"truncate font-medium text-foreground",children:a})]}):(0,Ao.jsx)("span",{className:"uppercase tracking-wide",children:t??"text"})}),(0,Ao.jsxs)(C,{type:"button",variant:"ghost",size:"xs",onClick:i,onKeyDown:c,"aria-label":"Copy code",children:[o?(0,Ao.jsx)(G,{className:"size-3.5","aria-hidden":!0}):(0,Ao.jsx)(za,{className:"size-3.5","aria-hidden":!0}),o?"Copied":"Copy"]})]}),(0,Ao.jsx)("pre",{className:"overflow-x-auto p-3 text-xs leading-relaxed",children:(0,Ao.jsx)("code",{className:"font-mono",children:e})})]})}var z7=require("react");var Vr=require("react/jsx-runtime");function r1(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 qd(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((0,Vr.jsx)("strong",{children:n[2]},o++)):n[3]!==void 0?t.push((0,Vr.jsx)("em",{children:n[3]},o++)):n[4]!==void 0?t.push((0,Vr.jsx)("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((0,Vr.jsx)("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 o1({content:e,className:t}){let a=r1(e);return a.length===0?(0,Vr.jsx)("p",{className:"text-sm",children:e}):(0,Vr.jsx)("div",{className:l("flex flex-col gap-2 text-sm leading-relaxed",t),children:a.map((r,o)=>{switch(r.type){case"h1":return(0,Vr.jsx)("h1",{className:"text-lg font-semibold",children:qd(r.text)},o);case"h2":return(0,Vr.jsx)("h2",{className:"text-base font-semibold",children:qd(r.text)},o);case"h3":return(0,Vr.jsx)("h3",{className:"text-sm font-semibold",children:qd(r.text)},o);case"quote":return(0,Vr.jsx)("blockquote",{className:"border-l-2 border-border pl-3 text-muted-foreground",children:qd(r.text)},o);case"code":return(0,Vr.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-2 font-mono text-xs",children:(0,Vr.jsx)("code",{children:r.text})},o);case"ul":return(0,Vr.jsx)("ul",{className:"list-disc pl-5",children:r.text.split(`
24
+ `).map((n,i)=>(0,Vr.jsx)("li",{children:qd(n)},i))},o);case"ol":return(0,Vr.jsx)("ol",{className:"list-decimal pl-5",children:r.text.split(`
25
+ `).map((n,i)=>(0,Vr.jsx)("li",{children:qd(n)},i))},o);default:return(0,Vr.jsx)("p",{children:qd(r.text)},o)}})})}function Lm({content:e,className:t}){return(0,Vr.jsx)("div",{"data-slot":"chat-markdown-renderer",className:t,children:(0,Vr.jsx)(o1,{content:e})})}var Sr=M(require("react"),1),Ap=require("@tiptap/react"),Ay=M(require("@tiptap/starter-kit"),1),Ey=M(require("@tiptap/extension-link"),1),Fy=M(require("@tiptap/extension-image"),1),$y=M(require("@tiptap/extension-placeholder"),1);var H=require("react/jsx-runtime");function Hy({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=(0,Ap.useEditor)({extensions:[Ay.default.configure({codeBlock:{HTMLAttributes:{class:"language-*"}}}),Ey.default.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),Fy.default.configure({inline:!1,allowBase64:!0}),$y.default.configure({placeholder:a})],content:e,editable:r,onUpdate:({editor:u})=>t?.(u.getHTML()),editorProps:{attributes:{style:`min-height: ${n}px`}},immediatelyRender:!1});if(Sr.useEffect(()=>{d&&e!==d.getHTML()&&d.commands.setContent(e)},[d,e]),!d)return(0,H.jsx)("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(0,H.jsxs)("div",{"data-slot":"rich-text-editor",className:l("rounded-md border bg-background",c),...s,children:[o&&r&&(0,H.jsx)(n1,{editor:d,onUpload:i??m}),(0,H.jsx)("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:(0,H.jsx)(Ap.EditorContent,{editor:d})})]})}function n1({editor:e,onUpload:t}){let[a,r]=Sr.useState(!1),[o,n]=Sr.useState(!1),[i,c]=Sr.useState(!1),[s,d]=Sr.useState(!1),m=e.getAttributes("link").href;return(0,H.jsxs)("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:[(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleBold().run(),active:e.isActive("bold"),icon:(0,H.jsx)(sc,{}),title:"\u52A0\u7C97"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleItalic().run(),active:e.isActive("italic"),icon:(0,H.jsx)(ic,{}),title:"\u659C\u4F53"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleStrike().run(),active:e.isActive("strike"),icon:(0,H.jsx)(Ob,{}),title:"\u5220\u9664\u7EBF"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleHeading({level:1}).run(),active:e.isActive("heading",{level:1}),icon:(0,H.jsx)(Eu,{}),title:"\u6807\u98981"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),active:e.isActive("heading",{level:2}),icon:(0,H.jsx)(Fu,{}),title:"\u6807\u98982"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleBulletList().run(),active:e.isActive("bulletList"),icon:(0,H.jsx)(ac,{}),title:"\u65E0\u5E8F\u5217\u8868"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleOrderedList().run(),active:e.isActive("orderedList"),icon:(0,H.jsx)(zu,{}),title:"\u6709\u5E8F\u5217\u8868"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleBlockquote().run(),active:e.isActive("blockquote"),icon:(0,H.jsx)(Au,{}),title:"\u5F15\u7528"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().toggleCodeBlock().run(),active:e.isActive("codeBlock"),icon:(0,H.jsx)(sd,{}),title:"\u4EE3\u7801\u5757"}),(0,H.jsxs)(st,{open:a,onOpenChange:r,children:[(0,H.jsx)(it,{render:(0,H.jsx)(wn,{onClick:()=>r(!0),active:e.isActive("link"),icon:(0,H.jsx)(tc,{}),title:"\u94FE\u63A5"})}),(0,H.jsx)(lt,{className:"w-80",align:"start",children:(0,H.jsx)(s1,{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)}})})]}),(0,H.jsx)(wn,{onClick:()=>n(!0),icon:(0,H.jsx)(Wr,{}),title:"\u56FE\u7247"}),(0,H.jsx)(wn,{onClick:()=>c(!0),icon:(0,H.jsx)(bl,{}),title:"\u9644\u4EF6"}),(0,H.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:()=>n(!0),"data-image-input":!0}),(0,H.jsx)("div",{className:"mx-1 h-4 w-px bg-muted-foreground/20"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().undo().run(),icon:(0,H.jsx)(lc,{}),title:"\u64A4\u9500"}),(0,H.jsx)(wn,{onClick:()=>e.chain().focus().redo().run(),icon:(0,H.jsx)(dc,{}),title:"\u91CD\u505A"}),(0,H.jsx)(i1,{open:o,onOpenChange:n,onUpload:t,onInsert:async(u,p)=>{u&&e.chain().focus().setImage({src:u,alt:p}).run()},inserting:s,setInserting:d}),(0,H.jsx)(d1,{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 s1({currentUrl:e,onApply:t,onRemove:a}){let[r,o]=Sr.useState(""),[n,i]=Sr.useState(!1),c=!!e,s=r===""||/^https?:\/\/|mailto:|tel:|\//.test(r);return(0,H.jsxs)("div",{className:"space-y-3",children:[(0,H.jsxs)("div",{className:"space-y-1.5",children:[(0,H.jsx)(we,{htmlFor:"link-url",className:"text-xs",children:"\u94FE\u63A5\u5730\u5740"}),(0,H.jsx)(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&&(0,H.jsx)("p",{className:"text-xs text-destructive",children:"\u8BF7\u8F93\u5165\u6709\u6548\u7684 URL"})]}),(0,H.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,H.jsx)(ws,{checked:n,onCheckedChange:i}),(0,H.jsx)("span",{children:"\u5728\u65B0\u7A97\u53E3\u6253\u5F00"})]}),(0,H.jsx)(dt,{}),(0,H.jsxs)("div",{className:"flex items-center justify-between",children:[c&&(0,H.jsxs)(C,{variant:"ghost",size:"xs",onClick:a,children:[(0,H.jsx)(od,{}),"\u79FB\u9664\u94FE\u63A5"]}),(0,H.jsxs)("div",{className:"ml-auto flex gap-1",children:[c&&(0,H.jsx)(C,{variant:"ghost",size:"xs",onClick:()=>t(e??"",n),children:"\u53D6\u6D88"}),(0,H.jsx)(C,{size:"xs",disabled:!s,onClick:()=>t(r,n),children:c?"\u66F4\u65B0":"\u63D2\u5165"})]})]})]},e??"new")}function i1({open:e,onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n}){return(0,H.jsx)(Ye,{open:e,onOpenChange:t,children:e&&(0,H.jsx)(l1,{onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n})})}function l1({onOpenChange:e,onUpload:t,onInsert:a,inserting:r,setInserting:o}){let[n,i]=Sr.useState("upload"),[c,s]=Sr.useState(""),[d,m]=Sr.useState(""),[u,p]=Sr.useState(null),[f,x]=Sr.useState(""),[v,N]=Sr.useState(null),[h,b]=Sr.useState(!1),g=Sr.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(0,H.jsxs)(Je,{className:"sm:max-w-md",children:[(0,H.jsxs)(nt,{children:[(0,H.jsx)(Ze,{children:"\u63D2\u5165\u56FE\u7247"}),(0,H.jsx)(Dt,{children:"\u4ECE\u672C\u5730\u4E0A\u4F20\u6216\u4F7F\u7528\u5728\u7EBF\u56FE\u7247\u94FE\u63A5"})]}),(0,H.jsxs)("div",{className:"flex gap-1 border-b",children:[(0,H.jsx)("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"}),(0,H.jsx)("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"?(0,H.jsxs)("div",{className:"space-y-3",children:[(0,H.jsxs)("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?(0,H.jsx)("img",{src:u,alt:d,className:"max-h-full max-w-full rounded object-contain"}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Wr,{className:"size-8"}),(0,H.jsx)("span",{children:"\u70B9\u51FB\u6216\u62D6\u62FD\u56FE\u7247\u5230\u6B64\u5904"}),(0,H.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u652F\u6301 PNG / JPG / GIF / WebP \xB7 \u6700\u5927 10MB"})]}),(0,H.jsx)("input",{ref:g,type:"file",accept:"image/*",className:"hidden",onChange:w=>{let R=w.target.files?.[0];R&&y(R)}})]}),f&&!u&&r&&(0,H.jsxs)("p",{className:"text-xs text-muted-foreground",children:["\u6B63\u5728\u4E0A\u4F20 ",f,"..."]})]}):(0,H.jsxs)("div",{className:"space-y-1.5",children:[(0,H.jsx)(we,{htmlFor:"img-url",children:"\u56FE\u7247 URL"}),(0,H.jsx)(T,{id:"img-url",value:c,onChange:w=>s(w.target.value),placeholder:"https://example.com/image.png"}),c&&(0,H.jsx)("div",{className:"mt-2 flex aspect-video items-center justify-center overflow-hidden rounded-md border bg-muted/20",children:(0,H.jsx)("img",{src:c,alt:"preview",className:"max-h-full max-w-full object-contain"})})]}),(0,H.jsxs)("div",{className:"space-y-1.5",children:[(0,H.jsx)(we,{htmlFor:"img-alt",children:"\u66FF\u4EE3\u6587\u672C\uFF08Alt\uFF09"}),(0,H.jsx)(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&&(0,H.jsx)("p",{className:"text-xs text-destructive",children:v}),(0,H.jsxs)(bt,{children:[(0,H.jsx)(C,{variant:"outline",onClick:()=>e(!1),children:"\u53D6\u6D88"}),(0,H.jsx)(C,{onClick:k,disabled:r,children:r?"\u4E0A\u4F20\u4E2D...":"\u63D2\u5165"})]})]})}function d1({open:e,onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n}){return(0,H.jsx)(Ye,{open:e,onOpenChange:t,children:e&&(0,H.jsx)(c1,{onOpenChange:t,onUpload:a,onInsert:r,inserting:o,setInserting:n})})}function c1({onOpenChange:e,onUpload:t,onInsert:a,inserting:r,setInserting:o}){let[n,i]=Sr.useState([]),[c,s]=Sr.useState(!1),d=Sr.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(0,H.jsxs)(Je,{className:"sm:max-w-lg",children:[(0,H.jsxs)(nt,{children:[(0,H.jsx)(Ze,{children:"\u63D2\u5165\u9644\u4EF6"}),(0,H.jsx)(Dt,{children:"\u652F\u6301 PDF\u3001\u6587\u6863\u3001\u538B\u7F29\u5305\u7B49\u4EFB\u610F\u6587\u4EF6"})]}),(0,H.jsxs)("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:[(0,H.jsx)(bl,{className:"size-6"}),(0,H.jsx)("span",{children:"\u70B9\u51FB\u6216\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904"}),(0,H.jsx)("span",{className:"text-xs",children:"\u652F\u6301\u4EFB\u610F\u7C7B\u578B \xB7 \u5355\u4E2A\u6587\u4EF6\u6700\u5927 50MB"}),(0,H.jsx)("input",{ref:d,type:"file",multiple:!0,className:"hidden",onChange:v=>{v.target.files?.length&&m(v.target.files)}})]}),n.length>0&&(0,H.jsx)("div",{className:"max-h-60 space-y-1 overflow-y-auto rounded-md border bg-muted/20 p-2",children:n.map(v=>(0,H.jsxs)("div",{className:"flex items-center gap-2 rounded bg-background px-2 py-1.5 text-xs",children:[(0,H.jsx)(bl,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,H.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,H.jsx)("div",{className:"truncate font-medium",children:v.file.name}),(0,H.jsx)("div",{className:"text-muted-foreground",children:Yu(v.file.size)})]}),v.error?(0,H.jsx)("span",{className:"text-destructive",children:v.error}):v.url?(0,H.jsx)("a",{href:v.url,target:"_blank",rel:"noreferrer",className:"text-primary hover:underline",title:"\u9884\u89C8",children:(0,H.jsx)(Ru,{className:"size-3.5"})}):(0,H.jsx)("span",{className:"text-muted-foreground",children:"\u4E0A\u4F20\u4E2D..."}),(0,H.jsx)(C,{type:"button",variant:"ghost",size:"icon-xs",onClick:N=>{N.stopPropagation(),u(v.file)},"aria-label":"\u79FB\u9664",children:(0,H.jsx)(od,{})})]},v.file.name+v.file.size))}),(0,H.jsxs)(bt,{children:[(0,H.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:x>0?`\u5C06\u63D2\u5165 ${x} \u4E2A\u9644\u4EF6`:"\u8BF7\u6DFB\u52A0\u6587\u4EF6"}),(0,H.jsx)(C,{variant:"outline",onClick:()=>e(!1),children:"\u53D6\u6D88"}),(0,H.jsx)(C,{onClick:p,disabled:!f||x===0,children:r?"\u4E0A\u4F20\u4E2D...":"\u63D2\u5165"})]})]})}function wn({onClick:e,active:t,icon:a,title:r}){return(0,H.jsx)(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})}Hy.displayName="RichTextEditor";var Ac=M(require("react"),1),Eo=require("@xyflow/react"),K7=require("@xyflow/react/dist/style.css");var Pn=require("react/jsx-runtime");function m1({data:e}){let t=e,{name:a,title:r,avatarUrl:o,department:n}=t.orgNode;return(0,Pn.jsxs)("div",{className:"min-w-40 rounded-lg border bg-card p-3 text-center shadow-sm transition-shadow hover:shadow-md",children:[(0,Pn.jsx)(Eo.Handle,{type:"target",position:Eo.Position.Top,className:"size-2! bg-primary!"}),o?(0,Pn.jsx)("img",{src:o,alt:a,className:"mx-auto mb-1.5 size-10 rounded-full object-cover"}):(0,Pn.jsx)("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)}),(0,Pn.jsx)("div",{className:"text-sm font-medium",children:a}),(0,Pn.jsx)("div",{className:"text-xs text-muted-foreground",children:r}),n&&(0,Pn.jsx)("div",{className:"mt-1 text-xs text-muted-foreground/70",children:n}),(0,Pn.jsx)(Eo.Handle,{type:"source",position:Eo.Position.Bottom,className:"size-2! bg-primary!"})]})}var u1={org:m1};function Vy(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 Oy({nodes:e,edges:t,onNodeClick:a,className:r,...o}){let{nodes:n,edges:i}=Ac.useMemo(()=>Vy(e,t),[e,t]),[c,s,d]=(0,Eo.useNodesState)(n),[m,u,p]=(0,Eo.useEdgesState)(i);Ac.useEffect(()=>{let{nodes:x,edges:v}=Vy(e,t);s(x),u(v)},[e,t,s,u]);let f=Ac.useCallback((x,v)=>{let N=v.data.orgNode;a?.(N)},[a]);return(0,Pn.jsx)("div",{"data-slot":"org-chart",className:l("rounded-md border bg-zinc-50 dark:bg-zinc-950",r),style:{height:500},...o,children:(0,Pn.jsxs)(Eo.ReactFlow,{nodes:c,edges:m,nodeTypes:u1,onNodesChange:d,onEdgesChange:p,onNodeClick:f,fitView:!0,proOptions:{hideAttribution:!0},children:[(0,Pn.jsx)(Eo.Background,{gap:16,size:1}),(0,Pn.jsx)(Eo.Controls,{})]})})}Oy.displayName="OrgChart";var jn=M(require("react"),1),Gd=require("react-pdf"),Y7=require("react-pdf/dist/Page/AnnotationLayer.css"),J7=require("react-pdf/dist/Page/TextLayer.css");var Lt=require("react/jsx-runtime");Gd.pdfjs.GlobalWorkerOptions.workerSrc=`//unpkg.com/pdfjs-dist@${Gd.pdfjs.version}/build/pdf.worker.min.mjs`;function Uy({src:e,title:t,onLoadSuccess:a,onError:r,initialScale:o=100,className:n,...i}){let[c,s]=jn.useState(1),[d,m]=jn.useState(o),[u,p]=jn.useState(0),[f,x]=jn.useState(!0),[v,N]=jn.useState(null),h=jn.useRef(null),b=jn.useCallback(y=>{p(y.numPages),x(!1),N(null),a?.(y)},[a]),g=jn.useCallback(y=>{x(!1),N(y.message||"PDF \u52A0\u8F7D\u5931\u8D25"),r?.(y)},[r]);return jn.useEffect(()=>{s(1),m(o),x(!0),N(null),p(0)},[e,o]),(0,Lt.jsxs)("div",{"data-slot":"pdf-viewer",className:l("flex h-full flex-col rounded-md border",n),...i,children:[(0,Lt.jsxs)("div",{className:"flex items-center justify-between border-b bg-muted/30 px-3 py-1.5",children:[(0,Lt.jsxs)("div",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[(0,Lt.jsx)(Pa,{className:"size-4 shrink-0 text-muted-foreground"}),(0,Lt.jsx)("span",{className:"truncate",children:t??"\u6587\u6863"})]}),(0,Lt.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,Lt.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>s(y=>Math.max(1,y-1)),disabled:c<=1||f,"aria-label":"\u4E0A\u4E00\u9875",children:(0,Lt.jsx)($t,{})}),(0,Lt.jsx)("span",{className:"px-2 text-xs tabular-nums",children:u>0?`${c} / ${u}`:"\u2014"}),(0,Lt.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>s(y=>Math.min(u,y+1)),disabled:c>=u||f,"aria-label":"\u4E0B\u4E00\u9875",children:(0,Lt.jsx)(ke,{})}),(0,Lt.jsx)("span",{className:"mx-1 h-4 w-px bg-muted-foreground/20"}),(0,Lt.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>m(y=>Math.max(50,y-10)),disabled:f||!!v,"aria-label":"\u7F29\u5C0F",children:(0,Lt.jsx)(Wb,{})}),(0,Lt.jsxs)("span",{className:"px-1 text-xs tabular-nums",children:[d,"%"]}),(0,Lt.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>m(y=>Math.min(200,y+10)),disabled:f||!!v,"aria-label":"\u653E\u5927",children:(0,Lt.jsx)(Ub,{})}),(0,Lt.jsx)("span",{className:"mx-1 h-4 w-px bg-muted-foreground/20"}),(0,Lt.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>h.current?.requestFullscreen(),"aria-label":"\u5168\u5C4F",children:(0,Lt.jsx)(fu,{})}),(0,Lt.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>window.open(e,"_blank"),"aria-label":"\u5728\u65B0\u7A97\u53E3\u6253\u5F00",children:(0,Lt.jsx)(mo,{})})]})]}),(0,Lt.jsx)("div",{ref:h,className:"flex-1 overflow-auto bg-muted/30 p-4",role:"document","aria-label":t??"PDF \u6587\u6863",children:v?(0,Lt.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center text-muted-foreground",children:[(0,Lt.jsx)(ir,{className:"size-8 text-destructive"}),(0,Lt.jsx)("div",{className:"text-sm font-medium text-foreground",children:"PDF \u52A0\u8F7D\u5931\u8D25"}),(0,Lt.jsx)("div",{className:"text-xs",children:v})]}):(0,Lt.jsx)(Gd.Document,{file:e,onLoadSuccess:b,onLoadError:g,loading:(0,Lt.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,Lt.jsx)("div",{className:"mx-auto aspect-[1/1.414] w-full max-w-3xl animate-pulse rounded bg-muted"})}),className:"flex justify-center",children:(0,Lt.jsx)(Gd.Page,{pageNumber:c,scale:d/100,className:"shadow-md",loading:(0,Lt.jsx)("div",{className:"mx-auto aspect-[1/1.414] w-full max-w-3xl animate-pulse rounded bg-muted"})})})})]})}Uy.displayName="PDFViewer";var on=M(require("react"),1),Wy=require("react-colorful");var He=require("react/jsx-runtime"),p1=["#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#6366f1","#a855f7","#ec4899","#6b7280","#000000","#ffffff"],_y="chaos-ui-color-history",g1=12;function f1(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 b1(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 x1(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 v1(e){let t=e.trim();return t.startsWith("#")||(t=`#${t}`),t}function h1(e){return/^#?[a-f\d]{6}$/i.test(e.trim())}function y1(){try{let e=localStorage.getItem(_y);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>typeof a=="string"):[]}catch{return[]}}function N1(e){try{localStorage.setItem(_y,JSON.stringify(e))}catch{}}function qy({value:e="#3b82f6",onChange:t,format:a="hex",presets:r=p1,history:o=!0,enableEyeDropper:n=!0,enableAlpha:i=!1,showSwatches:c=!0,className:s}){let[d,m]=on.useState(!1),[u,p]=on.useState(e),[f,x]=on.useState(100),[v,N]=on.useState([]);on.useEffect(()=>{p(e)},[e]),on.useEffect(()=>{o&&d&&N(y1())},[o,d]);let h=on.useMemo(()=>f1(e),[e]),b=on.useMemo(()=>h?x1(h.r,h.g,h.b):null,[h]),g=on.useCallback(z=>{t?.(z),p(z)},[t]),y=on.useCallback(z=>{o&&N(U=>{let B=U.filter(I=>I!==z),O=[z,...B].slice(0,g1);return N1(O),O})},[o]),k=z=>{p(z);let U=v1(z);h1(U)&&g(U.toLowerCase())},w=(z,U)=>{if(!h)return;let B=Math.max(0,Math.min(255,U)),O={...h,[z]:B};g(b1(O.r,O.g,O.b))},R=async()=>{if(!(typeof window>"u"||!window.EyeDropper))try{let U=await new window.EyeDropper().open();g(U.sRGBHex),y(U.sRGBHex)}catch{}},S=z=>{g(z),y(z)},A=on.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(0,He.jsxs)(st,{open:d,onOpenChange:z=>{m(z),!z&&e&&y(e)},children:[(0,He.jsxs)(it,{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:[(0,He.jsx)("div",{className:"border-border size-5 shrink-0 rounded border",style:{backgroundColor:e}}),(0,He.jsx)("span",{className:"truncate font-mono text-xs",children:A})]}),(0,He.jsx)(lt,{className:"w-64 p-3",align:"start",children:(0,He.jsxs)("div",{className:"space-y-3",children:[(0,He.jsx)(Wy.HexColorPicker,{color:e,onChange:S,style:{width:"100%",height:140}}),i&&(0,He.jsxs)("div",{className:"space-y-1",children:[(0,He.jsxs)("div",{className:"text-muted-foreground flex items-center justify-between text-xs",children:[(0,He.jsx)("span",{children:"\u900F\u660E\u5EA6"}),(0,He.jsxs)("span",{className:"tabular-nums",children:[f,"%"]})]}),(0,He.jsx)("input",{type:"range",min:0,max:100,value:f,onChange:z=>x(Number(z.target.value)),className:"accent-primary w-full","aria-label":"\u900F\u660E\u5EA6"})]}),(0,He.jsxs)("div",{className:"space-y-1",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-xs",children:"HEX"}),(0,He.jsxs)("div",{className:"flex items-center gap-1",children:[(0,He.jsx)(T,{value:u,onChange:z=>k(z.target.value),className:"h-8 font-mono text-xs","aria-label":"HEX \u989C\u8272\u503C"}),n&&typeof window<"u"&&window.EyeDropper&&(0,He.jsx)(C,{variant:"outline",size:"icon-sm",onClick:R,"aria-label":"\u4F7F\u7528\u5438\u7BA1\u53D6\u8272",title:"\u5438\u7BA1\u53D6\u8272",children:(0,He.jsx)(_b,{})})]})]}),h&&a==="rgb"&&(0,He.jsx)("div",{className:"grid grid-cols-3 gap-1",children:["r","g","b"].map(z=>(0,He.jsxs)("div",{className:"space-y-0.5",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:z}),(0,He.jsx)(T,{type:"number",min:0,max:255,value:h[z],onChange:U=>w(z,Number(U.target.value)),className:"h-7 text-xs","aria-label":`${z} \u901A\u9053`})]},z))}),b&&a==="hsl"&&(0,He.jsxs)("div",{className:"grid grid-cols-3 gap-1",children:[(0,He.jsxs)("div",{className:"space-y-0.5",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:"H"}),(0,He.jsx)(T,{type:"number",min:0,max:360,value:b.h,readOnly:!0,className:"h-7 text-xs","aria-label":"\u8272\u76F8"})]}),(0,He.jsxs)("div",{className:"space-y-0.5",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:"S"}),(0,He.jsx)(T,{type:"number",min:0,max:100,value:b.s,readOnly:!0,className:"h-7 text-xs","aria-label":"\u9971\u548C\u5EA6"})]}),(0,He.jsxs)("div",{className:"space-y-0.5",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-[0.65rem] uppercase",children:"L"}),(0,He.jsx)(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&&(0,He.jsxs)("div",{className:"space-y-1",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-xs",children:"\u9884\u8BBE"}),(0,He.jsx)("div",{className:"flex flex-wrap gap-1",children:r.map(z=>(0,He.jsx)("button",{type:"button",role:"button","aria-label":`\u9009\u62E9\u989C\u8272 ${z}`,className:l("size-6 rounded border transition-transform hover:scale-110",e.toLowerCase()===z.toLowerCase()&&"ring-primary ring-2 ring-offset-1"),style:{backgroundColor:z},onClick:()=>S(z)},z))})]}),o&&v.length>0&&(0,He.jsxs)("div",{className:"space-y-1",children:[(0,He.jsx)("label",{className:"text-muted-foreground text-xs",children:"\u5386\u53F2"}),(0,He.jsx)("div",{className:"flex flex-wrap gap-1",children:v.map((z,U)=>(0,He.jsx)("button",{type:"button",role:"button","aria-label":`\u5386\u53F2\u989C\u8272 ${z}`,className:l("size-6 rounded border transition-transform hover:scale-110",e.toLowerCase()===z.toLowerCase()&&"ring-primary ring-2 ring-offset-1"),style:{backgroundColor:z},onClick:()=>S(z)},`${z}-${U}`))})]}),(0,He.jsxs)("div",{className:"flex items-center justify-end gap-1 border-t pt-2",children:[(0,He.jsxs)(C,{variant:"ghost",size:"xs",onClick:()=>m(!1),children:[(0,He.jsx)(ee,{}),"\u5173\u95ED"]}),(0,He.jsxs)(C,{size:"xs",onClick:()=>{y(e),m(!1)},children:[(0,He.jsx)(G,{}),"\u786E\u8BA4"]})]})]})})]})}qy.displayName="ColorBoard";var Ec=M(require("react"),1);var Ba=require("react/jsx-runtime"),C1=[{key:"bold",icon:(0,Ba.jsx)(sc,{}),title:"\u7C97\u4F53",wrap:["**","**"]},{key:"italic",icon:(0,Ba.jsx)(ic,{}),title:"\u659C\u4F53",wrap:["*","*"]},{key:"h1",icon:(0,Ba.jsx)(Eu,{}),title:"\u6807\u98981",insert:"# "},{key:"h2",icon:(0,Ba.jsx)(Fu,{}),title:"\u6807\u98982",insert:"## "},{key:"link",icon:(0,Ba.jsx)(tc,{}),title:"\u94FE\u63A5",wrap:["[","](url)"]},{key:"code",icon:(0,Ba.jsx)(sd,{}),title:"\u884C\u5185\u4EE3\u7801",wrap:["`","`"]},{key:"ul",icon:(0,Ba.jsx)(ac,{}),title:"\u65E0\u5E8F\u5217\u8868",insert:"- "},{key:"ol",icon:(0,Ba.jsx)(zu,{}),title:"\u6709\u5E8F\u5217\u8868",insert:"1. "},{key:"quote",icon:(0,Ba.jsx)(Au,{}),title:"\u5F15\u7528",insert:"> "},{key:"image",icon:(0,Ba.jsx)(Wr,{}),title:"\u56FE\u7247",insert:"![alt](url)"}];function Gy({value:e="",onChange:t,placeholder:a="\u8BF7\u8F93\u5165 Markdown...",mode:r,toolbar:o=!0,height:n=300,className:i}){let[c,s]=Ec.useState("split"),d=r??c,m=Ec.useRef(null),u=Ec.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:(0,Ba.jsx)(gl,{className:"size-3.5"})},{value:"split",label:"\u5206\u5C4F",icon:(0,Ba.jsx)(mb,{className:"size-3.5"})},{value:"preview",label:"\u9884\u89C8",icon:(0,Ba.jsx)(Cs,{className:"size-3.5"})}],f=typeof n=="number"?{height:`${n}px`}:{height:n};return(0,Ba.jsxs)("div",{"data-slot":"markdown-editor",className:l("flex flex-col rounded-md border bg-background",i),children:[o&&(0,Ba.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b p-1.5",children:[(0,Ba.jsx)("div",{className:"flex flex-wrap items-center gap-0.5",role:"toolbar","aria-label":"Markdown \u7F16\u8F91\u5DE5\u5177\u680F",children:C1.map(x=>(0,Ba.jsx)(C,{type:"button",variant:"ghost",size:"icon-xs",onClick:()=>u(x),title:x.title,"aria-label":x.title,children:x.icon},x.key))}),!r&&(0,Ba.jsx)(cm,{options:p,value:d,onChange:x=>s(x),size:"sm"})]}),(0,Ba.jsxs)("div",{className:l("flex min-h-0 flex-1",d==="split"&&"flex-row divide-x"),style:f,children:[d!=="preview"&&(0,Ba.jsx)(Ta,{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"&&(0,Ba.jsx)("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()?(0,Ba.jsx)(Lm,{content:e}):(0,Ba.jsx)("p",{className:"text-sm text-muted-foreground",children:a})})]})]})}Gy.displayName="MarkdownEditor";var jd=M(require("react"),1),Df=M(require("cronstrue"),1);var Tt=require("react/jsx-runtime"),Ep={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"}]}},zm=["minute","hour","day","month","weekday"],k1=[{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 jy(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 If(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 Ky(e){let t=e.trim().split(/\s+/);for(;t.length<5;)t.push("*");return t.slice(0,5)}function w1(e){try{return Df.default.toString(e,{locale:"zh_CN",use24HourTimeFormat:!0})}catch{try{return Df.default.toString(e)}catch{return"\u65E0\u6548\u7684 Cron \u8868\u8FBE\u5F0F"}}}function Qy({value:e="* * * * *",onChange:t,showDescription:a=!0,readOnly:r=!1,className:o}){let n=jd.useMemo(()=>Ky(e),[e]),[i,c]=jd.useState(()=>{let p={};return zm.forEach((f,x)=>{p[f]=jy(n[x]??"*",Ep[f])}),p});jd.useEffect(()=>{let p=Ky(e);c(f=>{let x={};return zm.forEach((v,N)=>{let h=f[v],b=jy(p[N]??"*",Ep[v]),g=If(h),y=If(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=zm.map(h=>If(v[h]));return t?.(N.join(" ")),v})},d=jd.useMemo(()=>w1(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(0,Tt.jsxs)("div",{"data-slot":"cron-editor",className:l("bg-background rounded-md border p-3",o),children:[(0,Tt.jsxs)("div",{className:"bg-muted/30 mb-3 flex items-center gap-2 rounded-md px-3 py-2",children:[(0,Tt.jsx)(Te,{className:"text-muted-foreground size-4 shrink-0"}),(0,Tt.jsx)("code",{className:"flex-1 font-mono text-sm font-medium",children:e})]}),(0,Tt.jsxs)("div",{className:"mb-3",children:[(0,Tt.jsx)(we,{className:"text-muted-foreground mb-1.5 text-xs",children:"\u5E38\u7528\u9884\u8BBE"}),(0,Tt.jsx)("div",{className:"flex flex-wrap gap-1",children:k1.map(p=>(0,Tt.jsx)("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))})]}),(0,Tt.jsxs)(_o,{defaultValue:"minute",children:[(0,Tt.jsx)(qo,{className:"mb-2",children:zm.map(p=>(0,Tt.jsx)(Xr,{value:p,children:Ep[p].tab},p))}),zm.map(p=>{let f=Ep[p],x=i[p];return(0,Tt.jsxs)(An,{value:p,className:"space-y-3",children:[(0,Tt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Tt.jsx)(we,{className:"text-sm font-medium",children:f.label}),(0,Tt.jsx)(cm,{options:u,value:x.mode,onChange:v=>s(p,{mode:v}),size:"sm",disabled:r})]}),x.mode==="every"&&(0,Tt.jsxs)("p",{className:"text-muted-foreground text-sm",children:["\u6BCF",f.label,"\u90FD\u6267\u884C"]}),x.mode==="step"&&(0,Tt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Tt.jsx)("span",{className:"text-muted-foreground text-sm",children:"\u6BCF"}),(0,Tt.jsx)(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`}),(0,Tt.jsxs)("span",{className:"text-muted-foreground text-sm",children:["\u4E2A",f.label,"\u6267\u884C\u4E00\u6B21"]})]}),x.mode==="specific"&&(0,Tt.jsxs)("div",{className:"space-y-1.5",children:[(0,Tt.jsxs)("p",{className:"text-muted-foreground text-xs",children:["\u9009\u62E9\u591A\u4E2A",f.label,"(\u53EF\u591A\u9009)"]}),(0,Tt.jsx)("div",{className:"flex flex-wrap gap-1",children:f.options.map(v=>{let N=x.specificValues.includes(v.value);return(0,Tt.jsx)("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"&&(0,Tt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Tt.jsx)("span",{className:"text-muted-foreground text-sm",children:"\u4ECE"}),(0,Tt.jsx)(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`}),(0,Tt.jsx)("span",{className:"text-muted-foreground text-sm",children:"\u5230"}),(0,Tt.jsx)(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`}),(0,Tt.jsxs)("span",{className:"text-muted-foreground text-sm",children:["\u6BCF",f.label,"\u6267\u884C"]})]})]},p)})]}),a&&(0,Tt.jsxs)("div",{className:"bg-primary/5 mt-3 rounded-md px-3 py-2",children:[(0,Tt.jsx)(we,{className:"text-muted-foreground mb-0.5 block text-xs",children:"\u6267\u884C\u63CF\u8FF0"}),(0,Tt.jsx)("p",{className:"text-foreground text-sm font-medium",children:d})]})]})}Qy.displayName="CronEditor";var kq=require("react");var nn=require("react/jsx-runtime");function P1({title:e,description:t,thumbnail:a,metadata:r,actions:o,className:n}){return(0,nn.jsxs)("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:[(0,nn.jsxs)("div",{className:"flex items-start gap-3 p-3",children:[a?(0,nn.jsx)("img",{src:a,alt:"",className:"size-12 shrink-0 rounded-md object-cover",loading:"lazy"}):(0,nn.jsx)("span",{className:"flex size-12 shrink-0 items-center justify-center rounded-md bg-muted","aria-hidden":!0,children:(0,nn.jsx)(Wr,{className:"size-5 text-muted-foreground"})}),(0,nn.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,nn.jsx)("h4",{className:"truncate text-sm font-semibold",title:e,children:e}),t?(0,nn.jsx)("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:t}):null]})]}),r&&r.length>0?(0,nn.jsx)("dl",{className:"grid grid-cols-2 gap-px border-t border-border bg-border",children:r.map(i=>(0,nn.jsxs)("div",{className:"bg-background px-3 py-1.5",children:[(0,nn.jsx)("dt",{className:"text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:i.label}),(0,nn.jsx)("dd",{className:"truncate text-xs font-medium text-foreground",title:i.value,children:i.value})]},i.label))}):null,o?(0,nn.jsx)("div",{className:"flex items-center justify-end gap-1 border-t border-border px-3 py-2",children:o}):null]})}var Am=require("react/jsx-runtime");function T1({images:e,className:t}){if(e.length===0)return(0,Am.jsx)("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(0,Am.jsx)("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)=>(0,Am.jsx)("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:(0,Am.jsx)("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))})}var ol=M(require("react"),1);var As=require("react/jsx-runtime");function R1(e){let t=Math.floor(e/60),a=Math.floor(e%60);return`${t}:${a.toString().padStart(2,"0")}`}function S1({duration:e,src:t,className:a}){let r=ol.useRef(null),[o,n]=ol.useState(!1),[i,c]=ol.useState(0),s=ol.useCallback(()=>{let u=r.current;if(!u){n(p=>!p);return}o?u.pause():u.play().catch(()=>n(!1))},[o]);ol.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(0,As.jsxs)("div",{"data-slot":"chat-voice-message",className:l("inline-flex items-center gap-2 rounded-2xl bg-muted px-3 py-2",a),children:[(0,As.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:s,"aria-label":o?"Pause voice message":"Play voice message",children:o?(0,As.jsx)(Su,{className:"size-4","aria-hidden":!0}):(0,As.jsx)(Iu,{className:"size-4","aria-hidden":!0})}),(0,As.jsx)($b,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,As.jsx)("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)=>(0,As.jsx)("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))}),(0,As.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:R1(e)}),t?(0,As.jsx)("audio",{ref:r,src:t,preload:"none"}):null]})}var Mf=M(require("react"),1);var _l=require("react/jsx-runtime");function I1({tools:e,onToolClick:t,className:a}){let r=Mf.useCallback(n=>()=>t?.(n),[t]),o=Mf.useCallback(n=>i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t?.(n))},[t]);return(0,_l.jsxs)("div",{"data-slot":"chat-input-toolbar",role:"toolbar","aria-label":"Input tools",className:l("flex items-center gap-1",a),children:[(0,_l.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Attach file",children:(0,_l.jsx)(bl,{className:"size-4","aria-hidden":!0})}),(0,_l.jsx)("div",{className:"mx-1 h-4 w-px shrink-0 bg-border","aria-hidden":!0}),e.map(n=>(0,_l.jsxs)(C,{type:"button",variant:"ghost",size:"sm",onClick:r(n.id),onKeyDown:o(n.id),"aria-label":n.label,children:[n.icon??null,(0,_l.jsx)("span",{children:n.label})]},n.id))]})}var Em=M(require("react"),1);var Kn=require("react/jsx-runtime");function D1({users:e,onSelect:t,className:a}){let[r,o]=Em.useState(0),n=Math.min(r,Math.max(0,e.length-1)),i=Em.useCallback(s=>t?.(s),[t]),c=Em.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(0,Kn.jsxs)("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:[(0,Kn.jsx)("p",{className:"px-2 py-1 text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:"People"}),e.length===0?(0,Kn.jsx)("p",{className:"px-2 py-2 text-center text-xs text-muted-foreground",children:"No users"}):(0,Kn.jsx)("ul",{role:"list",children:e.map((s,d)=>{let m=d===n;return(0,Kn.jsx)("li",{role:"option","aria-selected":m,children:(0,Kn.jsxs)("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:[(0,Kn.jsxs)(Uo,{size:"sm",children:[s.avatar?(0,Kn.jsx)(is,{src:s.avatar,alt:s.name}):(0,Kn.jsx)(is,{alt:s.name}),(0,Kn.jsx)(Wo,{children:ds(s.name)})]}),(0,Kn.jsx)("span",{className:"truncate",children:s.name})]})},s.id)})})]})}var Fm=M(require("react"),1);var Es=require("react/jsx-runtime");function M1({commands:e,onSelect:t,className:a}){let[r,o]=Fm.useState(0),n=Math.min(r,Math.max(0,e.length-1)),i=Fm.useCallback(s=>t?.(s),[t]),c=Fm.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(0,Es.jsxs)("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:[(0,Es.jsx)("p",{className:"px-2 py-1 text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:"Commands"}),e.length===0?(0,Es.jsx)("p",{className:"px-2 py-2 text-center text-xs text-muted-foreground",children:"No commands"}):(0,Es.jsx)("ul",{role:"list",children:e.map((s,d)=>{let m=d===n;return(0,Es.jsx)("li",{role:"option","aria-selected":m,children:(0,Es.jsxs)("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:[(0,Es.jsxs)("span",{className:"font-mono text-primary",children:["/",s.id]}),(0,Es.jsx)("span",{className:"flex-1 truncate",children:s.label}),s.description?(0,Es.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground/80",children:s.description}):null]})},s.id)})})]})}var Fp=M(require("react"),1);var $p=require("react/jsx-runtime");function B1({chunks:e,isStreaming:t=!1,speed:a=30,className:r}){let o=e.join(""),[n,i]=Fp.useState(t?0:o.length);return Fp.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]),(0,$p.jsxs)("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?(0,$p.jsx)("span",{className:"ml-0.5 inline-block h-4 w-1.5 animate-pulse bg-foreground align-middle","aria-hidden":!0}):null]})}var Xy=M(require("react"),1);var Kd=require("react/jsx-runtime");function L1({suggestions:e,onSelect:t,className:a}){let r=Xy.useCallback(o=>n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),t?.(o))},[t]);return e.length===0?(0,Kd.jsx)("div",{"data-slot":"chat-suggest-replies",className:l("hidden",a),"aria-hidden":!0}):(0,Kd.jsx)("div",{"data-slot":"chat-suggest-replies",className:l("flex flex-wrap gap-2",a),"aria-label":"Suggested replies",children:e.map(o=>(0,Kd.jsxs)("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:[(0,Kd.jsx)(Lu,{className:"size-3 shrink-0 text-primary","aria-hidden":!0}),(0,Kd.jsx)("span",{className:"max-w-[16rem] truncate",children:o})]},o))})}var Fs=require("react/jsx-runtime");function z1({context:e,className:t}){return(0,Fs.jsxs)("div",{"data-slot":"chat-context-panel",className:l("flex flex-col gap-2 p-3",t),"aria-label":"Conversation context",children:[(0,Fs.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Context"}),e.length===0?(0,Fs.jsx)("p",{className:"text-sm text-muted-foreground",children:"No context attached"}):(0,Fs.jsx)("dl",{className:"flex flex-col",children:e.map((a,r)=>(0,Fs.jsxs)("div",{children:[r>0?(0,Fs.jsx)(dt,{className:"my-2"}):null,(0,Fs.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,Fs.jsx)("dt",{className:"text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:a.label}),(0,Fs.jsx)("dd",{className:"break-words text-sm text-foreground",children:a.value})]})]},a.label))})]})}var $m=M(require("react"),1);var Or=require("react/jsx-runtime");function A1({models:e,activeId:t,onSwitch:a,className:r}){let[o,n]=$m.useState(!1),i=e.find(d=>d.id===t)??e[0],c=$m.useCallback(d=>{a?.(d),n(!1)},[a]),s=$m.useCallback(d=>{(d.key==="ArrowDown"||d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n(!0))},[]);return(0,Or.jsxs)("div",{"data-slot":"chat-model-switcher",className:l("relative",r),children:[(0,Or.jsxs)(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:[(0,Or.jsx)(Lu,{className:"size-4 text-primary","aria-hidden":!0}),(0,Or.jsx)("span",{className:"max-w-[12rem] truncate",children:i?.name??"Select model"}),(0,Or.jsx)(fe,{className:l("size-4 transition-transform",o&&"rotate-180"),"aria-hidden":!0})]}),o?(0,Or.jsxs)(Or.Fragment,{children:[(0,Or.jsx)("button",{type:"button","aria-label":"Close model menu",tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>n(!1)}),(0,Or.jsx)("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(0,Or.jsx)("li",{role:"option","aria-selected":m,children:(0,Or.jsxs)("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:[(0,Or.jsx)("span",{className:"mt-0.5 shrink-0",children:m?(0,Or.jsx)(G,{className:"size-4 text-primary","aria-hidden":!0}):(0,Or.jsx)("span",{className:"block size-4"})}),(0,Or.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,Or.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:d.name}),d.description?(0,Or.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:d.description}):null]})]})},d.id)})})]}):null]})}var tG=require("react");var Hm=require("react/jsx-runtime"),E1={idle:{label:"Idle",dot:"bg-muted-foreground",text:"text-muted-foreground",spin:!1,Icon:ft},thinking:{label:"Thinking",dot:"bg-blue-500",text:"text-blue-600 dark:text-blue-400",spin:!0,Icon:Bu},acting:{label:"Acting",dot:"bg-amber-500",text:"text-amber-600 dark:text-amber-400",spin:!0,Icon:Mu},waiting:{label:"Waiting",dot:"bg-purple-500",text:"text-purple-600 dark:text-purple-400",spin:!0,Icon:Oo},done:{label:"Done",dot:"bg-green-500",text:"text-green-600 dark:text-green-400",spin:!1,Icon:ft}};function F1({status:e,label:t,className:a}){let r=E1[e],o=t??r.label,n=r.Icon;return(0,Hm.jsxs)("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:[(0,Hm.jsx)(n,{className:l("size-3.5",r.spin&&"animate-spin"),"aria-hidden":!0}),(0,Hm.jsx)("span",{className:l("size-2 rounded-full",r.dot),"aria-hidden":!0}),o]})}var Vm=M(require("react"),1);var ho=require("react/jsx-runtime");function $1({title:e,type:t,content:a,className:r}){let[o,n]=Vm.useState(!1),i=a??"",c=Vm.useCallback(()=>{navigator.clipboard?.writeText(i).then(()=>{n(!0),window.setTimeout(()=>n(!1),1500)})},[i]),s=Vm.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(0,ho.jsxs)("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:[(0,ho.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,ho.jsx)(Pa,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,ho.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,ho.jsx)("h3",{className:"truncate text-sm font-semibold",title:e??"Untitled",children:e??"Untitled artifact"}),(0,ho.jsx)("span",{className:"text-[0.65rem] uppercase tracking-wide text-muted-foreground",children:d})]}),(0,ho.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,ho.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:c,"aria-label":"Copy artifact",children:o?(0,ho.jsx)(G,{className:"size-4 text-green-600","aria-hidden":!0}):(0,ho.jsx)(za,{className:"size-4","aria-hidden":!0})}),(0,ho.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:s,"aria-label":"Download artifact",children:(0,ho.jsx)(mo,{className:"size-4","aria-hidden":!0})})]})]}),(0,ho.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:i?(0,ho.jsx)(Lm,{content:i}):(0,ho.jsx)("p",{className:"text-sm text-muted-foreground",children:"No content generated yet."})})]})}var nl=M(require("react"),1);var Tn=require("react/jsx-runtime");function H1({onLike:e,onDislike:t,onComment:a,className:r}){let[o,n]=nl.useState(null),[i,c]=nl.useState(!1),[s,d]=nl.useState(""),m=nl.useCallback(()=>{n(x=>x==="up"?null:"up"),e?.()},[e]),u=nl.useCallback(()=>{n(x=>x==="down"?null:"down"),t?.()},[t]),p=nl.useCallback(()=>{let x=s.trim();x&&a?.(x),d(""),c(!1)},[a,s]),f=nl.useCallback(x=>{x.key==="Enter"&&(x.metaKey||x.ctrlKey)&&(x.preventDefault(),p()),x.key==="Escape"&&(c(!1),d(""))},[p]);return(0,Tn.jsxs)("div",{"data-slot":"chat-feedback",className:l("flex flex-col gap-1",r),children:[(0,Tn.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Tn.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:m,"aria-label":"Good response","aria-pressed":o==="up",children:(0,Tn.jsx)(Vb,{className:l("size-4",o==="up"&&"text-green-600"),"aria-hidden":!0})}),(0,Tn.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:u,"aria-label":"Bad response","aria-pressed":o==="down",children:(0,Tn.jsx)(Hb,{className:l("size-4",o==="down"&&"text-red-600"),"aria-hidden":!0})}),a?(0,Tn.jsx)(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(x=>!x),"aria-expanded":i,"aria-label":"Add comment",children:"Comment"}):null]}),i?(0,Tn.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Tn.jsx)("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"}),(0,Tn.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,Tn.jsx)(C,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(!1),children:"Cancel"}),(0,Tn.jsx)(C,{type:"button",size:"sm",onClick:p,disabled:s.trim().length===0,children:"Submit"})]})]}):null]})}var gG=require("react");var no=require("react/jsx-runtime");function Bf({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?(0,no.jsxs)("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:[(0,no.jsx)("span",{className:"sr-only",children:"System message"}),t,o?(0,no.jsx)("span",{className:"ml-2 tabular-nums opacity-70",children:o}):null]}):(0,no.jsxs)("div",{"data-slot":"chat-message-bubble",className:l("flex w-full gap-2",c?"flex-row-reverse":"flex-row",i),children:[(0,no.jsx)(Uo,{size:"sm",className:"mt-0.5",children:a??(0,no.jsxs)(no.Fragment,{children:[(0,no.jsx)(is,{alt:d}),(0,no.jsx)(Wo,{children:ds(d)})]})}),(0,no.jsxs)("div",{className:l("flex max-w-[80%] flex-col gap-0.5",c?"items-end":"items-start"),children:[(0,no.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,no.jsx)("span",{className:"font-medium text-foreground",children:d}),o?(0,no.jsx)("span",{className:"tabular-nums",children:o}):null,n?(0,no.jsx)("span",{"aria-label":`Status: ${n}`,children:n}):null]}),(0,no.jsx)("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})]})]})}var Hp=require("react/jsx-runtime");function V1({messages:e,className:t}){return(0,Hp.jsx)("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?(0,Hp.jsx)("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(0,Hp.jsx)(Bf,{role:r,content:a.content,...a.time!==void 0&&{time:a.time}},a.id)})})}var sn=require("react/jsx-runtime");function O1({query:e,onQueryChange:t,results:a=[],className:r}){return(0,sn.jsxs)("div",{"data-slot":"chat-conversation-search",className:l("flex flex-col gap-2",r),role:"search","aria-label":"Search conversations",children:[(0,sn.jsxs)("div",{className:"relative",children:[(0,sn.jsx)(te,{className:"text-muted-foreground absolute top-1/2 left-2 size-4 -translate-y-1/2","aria-hidden":!0}),(0,sn.jsx)(T,{type:"search",value:e,onChange:o=>t?.(o.target.value),placeholder:"Search conversations...","aria-label":"Search query",className:"pl-8"})]}),(0,sn.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.trim().length===0?(0,sn.jsx)("p",{className:"text-muted-foreground px-2 py-3 text-center text-xs",children:"Type to search"}):a.length===0?(0,sn.jsxs)("p",{className:"text-muted-foreground flex flex-col items-center gap-1 px-2 py-4 text-center text-xs",children:[(0,sn.jsx)(yu,{className:"size-5","aria-hidden":!0}),"No results for \u201C",e,"\u201D"]}):(0,sn.jsx)("ul",{role:"list",className:"flex flex-col gap-0.5",children:a.map(o=>(0,sn.jsx)("li",{children:(0,sn.jsxs)("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:[(0,sn.jsx)("span",{className:"text-foreground truncate text-sm font-medium",children:o.title}),(0,sn.jsx)("span",{className:"text-muted-foreground line-clamp-2 text-xs",children:o.snippet})]})},o.id))})})]})}var Om=M(require("react"),1);var hi=require("react/jsx-runtime");function U1({branches:e,onSelect:t,className:a}){let r=e.findIndex(m=>m.active),o=r>=0?r:0,n=Om.useCallback(m=>{let u=(o+m+e.length)%e.length,p=e[u];p&&t?.(p.id)},[e,o,t]),i=Om.useCallback(()=>n(-1),[n]),c=Om.useCallback(()=>n(1),[n]),s=Om.useCallback(m=>{m.key==="ArrowLeft"?(m.preventDefault(),n(-1)):m.key==="ArrowRight"&&(m.preventDefault(),n(1))},[n]);if(e.length===0)return(0,hi.jsx)("div",{"data-slot":"chat-branch",className:l("hidden",a),"aria-hidden":!0});let d=e[o];return(0,hi.jsxs)("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:[(0,hi.jsx)("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:(0,hi.jsx)($t,{className:"size-3.5","aria-hidden":!0})}),(0,hi.jsx)("span",{className:"font-medium text-foreground",children:d?.label??"-"}),(0,hi.jsx)("span",{className:"tabular-nums",children:`${o+1}/${e.length}`}),(0,hi.jsx)("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:(0,hi.jsx)(ke,{className:"size-3.5","aria-hidden":!0})})]})}var yi=require("react/jsx-runtime");function W1({url:e,title:t,description:a,className:r}){let o=e;try{o=new URL(e).hostname.replace(/^www\./,"")}catch{}return(0,yi.jsxs)("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:[(0,yi.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted","aria-hidden":!0,children:(0,yi.jsx)(Mb,{className:"size-4 text-muted-foreground"})}),(0,yi.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,yi.jsx)("span",{className:"truncate text-sm font-medium text-foreground",title:t??e,children:t??ov(e,48)}),a?(0,yi.jsx)("span",{className:"line-clamp-2 text-xs text-muted-foreground",children:a}):null,(0,yi.jsx)("span",{className:"truncate text-[0.65rem] text-muted-foreground/80",children:o})]}),(0,yi.jsx)(Ru,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}var Ni=M(require("react"),1);var ql=require("react/jsx-runtime");function _1({value:e,onChange:t,onSend:a,placeholder:r="Type a message...",disabled:o=!1,maxLength:n,className:i}){let[c,s]=Ni.useState(""),d=e!==void 0,m=d?e:c,u=Ni.useRef(null);Ni.useEffect(()=>{let N=u.current;N&&(N.style.height="auto",N.style.height=`${Math.min(N.scrollHeight,200)}px`)},[m]);let p=Ni.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=Ni.useCallback(()=>{o||m.trim()&&(a?.(),d||s(""))},[d,m,o,a]),x=Ni.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),f())},[f]),v=n!==void 0?n-m.length:void 0;return(0,ql.jsxs)("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:[(0,ql.jsx)("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"}),(0,ql.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-0.5",children:[v!==void 0?(0,ql.jsx)("span",{className:l("text-[0.65rem] tabular-nums",v<10&&"text-destructive"),"aria-live":"polite",children:v}):null,(0,ql.jsx)(C,{type:"button",size:"icon-sm",onClick:f,disabled:o||m.trim().length===0,"aria-label":"Send message",children:(0,ql.jsx)(qs,{className:"size-4","aria-hidden":!0})})]})]})}var Qd=M(require("react"),1);var zt=require("react/jsx-runtime"),Yy=[{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 q1({fields:e=[],onChange:t,className:a}){let[r,o]=Qd.useState(e),[n,i]=Qd.useState("");Qd.useEffect(()=>{o(e)},[e]);let c=Qd.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(0,zt.jsx)("div",{"data-slot":"form-designer",className:l("flex flex-col gap-4",a),children:(0,zt.jsxs)(re,{children:[(0,zt.jsx)(he,{children:(0,zt.jsx)(ve,{children:"\u8868\u5355\u8BBE\u8BA1\u5668"})}),(0,zt.jsxs)(oe,{className:"flex flex-col gap-4",children:[(0,zt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,zt.jsx)(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"}),(0,zt.jsxs)(C,{type:"button",onClick:s,"aria-label":"\u65B0\u589E\u5B57\u6BB5",children:[(0,zt.jsx)(Re,{}),"\u65B0\u589E"]})]}),r.length===0?(0,zt.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5B57\u6BB5\uFF0C\u8BF7\u5728\u4E0A\u65B9\u6DFB\u52A0\u3002"}):(0,zt.jsx)("ul",{role:"list",className:"flex flex-col gap-2",children:r.map((f,x)=>{let v=Yy.find(N=>N.value===f.type)?.label??f.type;return(0,zt.jsxs)("li",{className:"flex items-center gap-2 rounded-md border p-2",children:[(0,zt.jsx)(Ws,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,zt.jsxs)("div",{className:"flex flex-1 flex-col gap-2 sm:flex-row sm:items-center",children:[(0,zt.jsx)(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})}),(0,zt.jsxs)(Ge,{value:f.type,onValueChange:N=>{typeof N=="string"&&d(f.id,{type:N})},children:[(0,zt.jsx)(Ke,{"aria-label":`\u5B57\u6BB5 ${x+1} \u7C7B\u578B`,className:"sm:w-[10rem]",children:(0,zt.jsx)(je,{})}),(0,zt.jsx)(Qe,{children:Yy.map(N=>(0,zt.jsx)(De,{value:N.value,children:N.label},N.value))})]}),(0,zt.jsxs)("label",{className:"flex items-center gap-1.5 text-sm",children:[(0,zt.jsx)(po,{checked:!!f.required,onCheckedChange:N=>d(f.id,{required:N===!0}),"aria-label":`\u5B57\u6BB5 ${x+1} \u5FC5\u586B`}),(0,zt.jsx)("span",{className:"text-muted-foreground",children:"\u5FC5\u586B"})]}),(0,zt.jsx)(L,{variant:"secondary",children:v})]}),(0,zt.jsxs)("div",{className:"flex items-center gap-1",children:[(0,zt.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",disabled:x===0,onClick:()=>u(x,-1),"aria-label":`\u4E0A\u79FB\u5B57\u6BB5 ${x+1}`,children:(0,zt.jsx)(ul,{})}),(0,zt.jsx)(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:(0,zt.jsx)(fe,{})}),(0,zt.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>m(f.id),"aria-label":`\u5220\u9664\u5B57\u6BB5 ${x+1}`,children:(0,zt.jsx)(Le,{})})]})]},f.id)})}),(0,zt.jsxs)("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",r.length," \u4E2A\u5B57\u6BB5\u3002"]})]})]})})}var Vp=M(require("react"),1);var Ca=require("react/jsx-runtime");function G1(e){let t=e;return Array.isArray(t)?t:t&&typeof t=="object"&&Array.isArray(t.fields)?t.fields:[]}function j1({schema:e,value:t={},onChange:a,className:r}){let o=G1(e),[n,i]=Vp.useState(t);Vp.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(0,Ca.jsx)("div",{"data-slot":"form-designer-runtime",className:l("w-full",r),children:(0,Ca.jsxs)(re,{children:[(0,Ca.jsx)(he,{children:(0,Ca.jsx)(ve,{children:"\u8868\u5355\u586B\u5199"})}),(0,Ca.jsxs)("form",{onSubmit:s,children:[(0,Ca.jsx)(oe,{className:"flex flex-col gap-4",children:o.length===0?(0,Ca.jsx)("p",{className:"text-muted-foreground py-6 text-center text-sm",children:"\u6682\u65E0\u53EF\u586B\u5199\u7684\u5B57\u6BB5\u3002"}):(0,Ca.jsx)("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(0,Ca.jsx)(Ta,{value:m??"",placeholder:d.placeholder,"aria-label":d.label,onChange:p=>c(d.id,p.target.value)});case"number":return(0,Ca.jsx)(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(0,Ca.jsx)(po,{checked:m===!0,"aria-label":d.label,onCheckedChange:p=>c(d.id,p===!0)});case"select":return(0,Ca.jsxs)(Ge,{value:m??"",onValueChange:p=>c(d.id,p),children:[(0,Ca.jsx)(Ke,{"aria-label":d.label,children:(0,Ca.jsx)(je,{placeholder:d.placeholder??"\u8BF7\u9009\u62E9"})}),(0,Ca.jsx)(Qe,{children:(d.options??[]).map(p=>(0,Ca.jsx)(De,{value:p.value,children:p.label},p.value))})]});case"date":return(0,Ca.jsx)(T,{type:"date",value:m??"","aria-label":d.label,onChange:p=>c(d.id,p.target.value)});default:return(0,Ca.jsx)(T,{type:"text",value:m??"",placeholder:d.placeholder,"aria-label":d.label,onChange:p=>c(d.id,p.target.value)})}};return(0,Ca.jsxs)("li",{className:"flex flex-col gap-1.5",children:[(0,Ca.jsxs)(we,{htmlFor:d.id,children:[d.label,d.required?(0,Ca.jsx)("span",{className:"text-destructive ml-0.5",children:"*"}):null]}),(0,Ca.jsx)("div",{id:d.id,children:u()})]},d.id)})})}),(0,Ca.jsx)(Ln,{children:(0,Ca.jsx)(C,{type:"submit",children:"\u63D0\u4EA4"})})]})]})})}var Ci=M(require("react"),1);var Ae=require("react/jsx-runtime"),Jy=[{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 K1({nodes:e=[],edges:t=[],onChange:a,className:r}){let[o,n]=Ci.useState(e),[i,c]=Ci.useState(t),[s,d]=Ci.useState(""),[m,u]=Ci.useState("");Ci.useEffect(()=>{n(e)},[e]),Ci.useEffect(()=>{c(t)},[t]);let p=Ci.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(0,Ae.jsx)("div",{"data-slot":"workflow-designer",className:l("flex flex-col gap-4",r),children:(0,Ae.jsxs)(re,{children:[(0,Ae.jsx)(he,{children:(0,Ae.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,Ae.jsx)(Ai,{className:"size-4","aria-hidden":!0}),"\u5DE5\u4F5C\u6D41\u8BBE\u8BA1\u5668"]})}),(0,Ae.jsxs)(oe,{className:"flex flex-col gap-4",children:[o.length===0?(0,Ae.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u8282\u70B9\uFF0C\u8BF7\u65B0\u589E\u8282\u70B9\u3002"}):(0,Ae.jsx)("ul",{role:"list",className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(g=>{let y=Jy.find(k=>k.value===g.type)?.label??g.type;return(0,Ae.jsxs)("li",{className:"flex flex-col gap-2 rounded-md border p-2",children:[(0,Ae.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ae.jsx)(L,{variant:"secondary",children:y}),(0,Ae.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>v(g.id),"aria-label":`\u5220\u9664\u8282\u70B9 ${g.name}`,children:(0,Ae.jsx)(Le,{})})]}),(0,Ae.jsx)(T,{type:"text",value:g.name,"aria-label":`\u8282\u70B9 ${g.id} \u540D\u79F0`,onChange:k=>x(g.id,{name:k.target.value})}),(0,Ae.jsxs)(Ge,{value:g.type,onValueChange:k=>{typeof k=="string"&&x(g.id,{type:k})},children:[(0,Ae.jsx)(Ke,{"aria-label":`\u8282\u70B9 ${g.id} \u7C7B\u578B`,children:(0,Ae.jsx)(je,{})}),(0,Ae.jsx)(Qe,{children:Jy.map(k=>(0,Ae.jsx)(De,{value:k.value,children:k.label},k.value))})]})]},g.id)})}),(0,Ae.jsx)("div",{children:(0,Ae.jsxs)(C,{type:"button",onClick:f,children:[(0,Ae.jsx)(Re,{}),"\u65B0\u589E\u8282\u70B9"]})}),(0,Ae.jsxs)("div",{className:"rounded-md border p-2",children:[(0,Ae.jsx)("p",{className:"mb-2 text-sm font-medium",children:"\u8FDE\u7EBF"}),(0,Ae.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,Ae.jsxs)(Ge,{value:s,onValueChange:g=>{typeof g=="string"&&d(g)},children:[(0,Ae.jsx)(Ke,{"aria-label":"\u8D77\u70B9\u8282\u70B9",className:"w-[10rem]",children:(0,Ae.jsx)(je,{placeholder:"\u8D77\u70B9"})}),(0,Ae.jsx)(Qe,{children:o.map(g=>(0,Ae.jsx)(De,{value:g.id,children:g.name},g.id))})]}),(0,Ae.jsx)("span",{className:"text-muted-foreground",children:"\u2192"}),(0,Ae.jsxs)(Ge,{value:m,onValueChange:g=>{typeof g=="string"&&u(g)},children:[(0,Ae.jsx)(Ke,{"aria-label":"\u7EC8\u70B9\u8282\u70B9",className:"w-[10rem]",children:(0,Ae.jsx)(je,{placeholder:"\u7EC8\u70B9"})}),(0,Ae.jsx)(Qe,{children:o.map(g=>(0,Ae.jsx)(De,{value:g.id,children:g.name},g.id))})]}),(0,Ae.jsxs)(C,{type:"button",onClick:N,disabled:!s||!m,"aria-label":"\u65B0\u589E\u8FDE\u7EBF",children:[(0,Ae.jsx)(Re,{}),"\u8FDE\u7EBF"]})]}),i.length===0?(0,Ae.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"\u6682\u65E0\u8FDE\u7EBF\u3002"}):(0,Ae.jsx)("ul",{role:"list",className:"mt-2 flex flex-col gap-1",children:i.map((g,y)=>(0,Ae.jsxs)("li",{className:"flex items-center gap-2 text-sm",children:[(0,Ae.jsx)("span",{className:"text-foreground",children:b(g.from)}),(0,Ae.jsx)("span",{className:"text-muted-foreground",children:"\u2192"}),(0,Ae.jsx)("span",{className:"text-foreground",children:b(g.to)}),(0,Ae.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>h(y),"aria-label":`\u5220\u9664\u8FDE\u7EBF ${y+1}`,className:"ml-auto",children:(0,Ae.jsx)(Le,{})})]},`${g.from}-${g.to}-${y}`))})]}),(0,Ae.jsxs)("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",o.length," \u4E2A\u8282\u70B9\uFF0C",i.length," \u6761\u8FDE\u7EBF\u3002"]})]})]})})}var dj=require("react");var ka=require("react/jsx-runtime"),Q1={done:{label:"\u5DF2\u5B8C\u6210",icon:(0,ka.jsx)(ft,{className:"size-4 text-emerald-500","aria-hidden":!0}),tone:"border-emerald-200 bg-emerald-50"},active:{label:"\u8FDB\u884C\u4E2D",icon:(0,ka.jsx)(Te,{className:"size-4 text-blue-500","aria-hidden":!0}),tone:"border-blue-200 bg-blue-50"},pending:{label:"\u5F85\u5904\u7406",icon:(0,ka.jsx)(Bn,{className:"size-4 text-muted-foreground","aria-hidden":!0}),tone:"border-border bg-muted/30"},rejected:{label:"\u5DF2\u9A73\u56DE",icon:(0,ka.jsx)(ns,{className:"size-4 text-destructive","aria-hidden":!0}),tone:"border-destructive/30 bg-destructive/5"}};function Zy(e){return Q1[e??"pending"]??{label:e??"\u672A\u77E5",icon:(0,ka.jsx)(Bn,{className:"size-4 text-muted-foreground","aria-hidden":!0}),tone:"border-border bg-muted/30"}}function X1({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(0,ka.jsx)("div",{"data-slot":"workflow-preview",className:l("flex flex-col gap-4",a),children:(0,ka.jsxs)(re,{children:[(0,ka.jsx)(he,{children:(0,ka.jsx)(ve,{children:"\u5DE5\u4F5C\u6D41\u9884\u89C8"})}),(0,ka.jsxs)(oe,{className:"flex flex-col gap-4",children:[(0,ka.jsx)("div",{className:"flex flex-wrap gap-2 text-sm",children:Object.entries(n).map(([i,c])=>{let s=Zy(i);return(0,ka.jsxs)(L,{variant:"outline",className:"gap-1.5",children:[s.icon,s.label,"\uFF1A",c]},i)})}),e.length===0?(0,ka.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u8282\u70B9\u3002"}):(0,ka.jsx)("ol",{role:"list",className:"flex flex-col gap-2",children:e.map((i,c)=>{let s=Zy(i.status),d=r.get(i.id)??[];return(0,ka.jsxs)("li",{className:"flex flex-col gap-2",children:[(0,ka.jsxs)("div",{className:l("flex items-center gap-2 rounded-md border p-3",s.tone),children:[(0,ka.jsx)("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,(0,ka.jsx)("span",{className:"font-medium",children:i.name}),(0,ka.jsx)(L,{variant:"secondary",className:"ml-auto",children:s.label})]}),d.length>0?(0,ka.jsx)("ul",{role:"list",className:"ml-6 flex flex-col gap-1 border-l pl-4",children:d.map((m,u)=>(0,ka.jsxs)("li",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,ka.jsx)(co,{className:"size-3.5","aria-hidden":!0}),(0,ka.jsx)("span",{children:o(m)})]},`${m}-${u}`))}):null]},i.id)})}),(0,ka.jsxs)("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",e.length," \u4E2A\u8282\u70B9\uFF0C",t.length," \u6761\u8FDE\u7EBF\u3002"]})]})]})})}var Fc=M(require("react"),1);var aa=require("react/jsx-runtime"),e0=[{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"}],t0=[{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 Y1({rules:e=[],onChange:t,className:a}){let[r,o]=Fc.useState(e);Fc.useEffect(()=>{o(e)},[e]);let n=Fc.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(0,aa.jsx)("div",{"data-slot":"rule-editor",className:l("flex flex-col gap-4",a),children:(0,aa.jsxs)(re,{children:[(0,aa.jsx)(he,{children:(0,aa.jsxs)(ve,{className:"flex items-center gap-2",children:[(0,aa.jsx)(Mu,{className:"size-4","aria-hidden":!0}),"\u89C4\u5219\u7F16\u8F91\u5668"]})}),(0,aa.jsxs)(oe,{className:"flex flex-col gap-4",children:[r.length===0?(0,aa.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u89C4\u5219\uFF0C\u8BF7\u70B9\u51FB\u65B0\u589E\u3002"}):(0,aa.jsx)("ul",{role:"list",className:"flex flex-col gap-2",children:r.map((d,m)=>{let u=e0.find(f=>f.value===d.operator)?.label??d.operator,p=t0.find(f=>f.value===d.action)?.label??d.action;return(0,aa.jsxs)("li",{className:"flex flex-col gap-2 rounded-md border p-2 sm:flex-row sm:items-center",children:[(0,aa.jsxs)(L,{variant:"outline",className:"shrink-0",children:["#",m+1]}),(0,aa.jsx)(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})}),(0,aa.jsxs)(Ge,{value:d.operator,onValueChange:f=>{typeof f=="string"&&c(d.id,{operator:f})},children:[(0,aa.jsx)(Ke,{"aria-label":`\u89C4\u5219 ${m+1} \u64CD\u4F5C\u7B26`,className:"sm:w-[8rem]",children:(0,aa.jsx)(je,{children:u})}),(0,aa.jsx)(Qe,{children:e0.map(f=>(0,aa.jsx)(De,{value:f.value,children:f.label},f.value))})]}),(0,aa.jsx)(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})}),(0,aa.jsxs)(Ge,{value:d.action,onValueChange:f=>{typeof f=="string"&&c(d.id,{action:f})},children:[(0,aa.jsx)(Ke,{"aria-label":`\u89C4\u5219 ${m+1} \u52A8\u4F5C`,className:"sm:w-[8rem]",children:(0,aa.jsx)(je,{children:p})}),(0,aa.jsx)(Qe,{children:t0.map(f=>(0,aa.jsx)(De,{value:f.value,children:f.label},f.value))})]}),(0,aa.jsx)(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:(0,aa.jsx)(Le,{})})]},d.id)})}),(0,aa.jsx)("div",{children:(0,aa.jsxs)(C,{type:"button",onClick:i,children:[(0,aa.jsx)(Re,{}),"\u65B0\u589E\u89C4\u5219"]})}),(0,aa.jsxs)("p",{className:"text-xs text-muted-foreground",children:["\u5171 ",r.length," \u6761\u89C4\u5219\u3002"]})]})]})})}var kj=require("react");var sl=require("react/jsx-runtime");function J1({title:e,onBack:t,children:a,className:r}){return(0,sl.jsxs)("div",{"data-slot":"mobile-page-shell",className:l("flex h-full min-h-0 flex-col bg-background",r),children:[(0,sl.jsxs)("header",{"data-slot":"mobile-page-shell-header",className:"relative flex h-12 shrink-0 items-center gap-2 border-b px-2",children:[t?(0,sl.jsx)("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:(0,sl.jsx)($t,{className:"size-5"})}):null,(0,sl.jsx)("h1",{className:"flex-1 truncate text-center text-base font-medium",children:e??""}),t?(0,sl.jsx)("span",{className:"size-9 shrink-0","aria-hidden":"true"}):null]}),(0,sl.jsx)("main",{"data-slot":"mobile-page-shell-body",className:"min-h-0 flex-1 overflow-y-auto",children:a??null})]})}var $c=M(require("react"),1);var ki=require("react/jsx-runtime");function Z1({open:e,onOpenChange:t,actions:a,className:r}){let o=$c.useId(),n=$c.useCallback(()=>t(!1),[t]);return $c.useEffect(()=>{if(!e)return;let i=c=>{c.key==="Escape"&&n()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,n]),e?(0,ki.jsxs)("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:[(0,ki.jsx)("button",{type:"button","aria-label":"\u5173\u95ED",tabIndex:-1,onClick:n,className:"absolute inset-0 bg-black/40"}),(0,ki.jsxs)("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:[(0,ki.jsx)("ul",{role:"menu",className:"flex flex-col",children:a.map(i=>(0,ki.jsx)("li",{role:"none",children:(0,ki.jsx)("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))}),(0,ki.jsx)("div",{className:"my-1 h-px bg-border","aria-hidden":"true"}),(0,ki.jsx)("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}var Hc=M(require("react"),1);var wi=require("react/jsx-runtime");function eS({options:e,value:t,onChange:a,className:r}){let o=t??e[0]?.value,n=Hc.useId(),i=Hc.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]);Hc.useEffect(()=>{i()},[i]);let c=s=>{let d=e.findIndex(u=>u.value===o),m=e[d+s];m&&a?.(m.value)};return(0,wi.jsxs)("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:[(0,wi.jsx)("div",{className:"pointer-events-none sticky top-0 z-10 h-[calc(50%-1.25rem)] bg-gradient-to-b from-popover to-transparent"}),(0,wi.jsx)("ul",{className:"flex flex-col",children:e.map((s,d)=>{let m=s.value===o;return(0,wi.jsx)("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?(0,wi.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,wi.jsx)(G,{className:"size-4","aria-hidden":"true"}),s.label]}):s.label},s.value)})}),(0,wi.jsx)("div",{className:"pointer-events-none sticky bottom-0 z-10 h-[calc(50%-1.25rem)] bg-gradient-to-t from-popover to-transparent"}),(0,wi.jsx)("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"})]})}var Pi=M(require("react"),1);var Qn=require("react/jsx-runtime");function tS({onCapture:e,className:t}){let a=Pi.useRef(null),r=Pi.useRef(null),[o,n]=Pi.useState("idle"),i=Pi.useCallback(()=>{r.current?.getTracks().forEach(d=>d.stop()),r.current=null},[]),c=Pi.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")}},[]);Pi.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(0,Qn.jsxs)("div",{"data-slot":"mobile-camera",className:l("relative flex flex-col overflow-hidden rounded-lg bg-black",t),children:[(0,Qn.jsxs)("div",{className:"relative aspect-[3/4] w-full bg-black",children:[(0,Qn.jsx)("video",{ref:a,playsInline:!0,muted:!0,className:"h-full w-full object-cover","data-slot":"mobile-camera-video"}),o!=="live"?(0,Qn.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-center text-sm text-white/80",children:[(0,Qn.jsx)(Tu,{className:"size-8","aria-hidden":"true"}),(0,Qn.jsx)("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]}),(0,Qn.jsx)("div",{className:"flex items-center justify-center gap-4 bg-black/80 p-3",children:o==="live"?(0,Qn.jsx)("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:(0,Qn.jsx)("span",{className:"size-7 rounded-full bg-white"})}):(0,Qn.jsxs)("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:[(0,Qn.jsx)(zr,{className:"size-4","aria-hidden":"true"}),"\u91CD\u8BD5"]})})]})}var Xn=M(require("react"),1);var Fo=require("react/jsx-runtime");function aS({onScan:e,className:t}){let a=Xn.useRef(null),r=Xn.useRef(null),o=Xn.useRef(null),[n,i]=Xn.useState("idle"),[c,s]=Xn.useState(""),d=Xn.useCallback(()=>{o.current!=null&&cancelAnimationFrame(o.current),o.current=null,r.current?.getTracks().forEach(p=>p.stop()),r.current=null},[]),m=Xn.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")}},[]);Xn.useEffect(()=>(m(),d),[m,d]),Xn.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(0,Fo.jsxs)("div",{"data-slot":"mobile-qrcode-scanner",className:l("relative flex flex-col overflow-hidden rounded-lg bg-black",t),children:[(0,Fo.jsxs)("div",{className:"relative aspect-square w-full bg-black",children:[(0,Fo.jsx)("video",{ref:a,playsInline:!0,muted:!0,className:"h-full w-full object-cover","data-slot":"mobile-qrcode-scanner-video"}),n==="scanning"?(0,Fo.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,Fo.jsx)("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"?(0,Fo.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 p-4 text-center text-sm text-white/80",children:[(0,Fo.jsx)(Nb,{className:"size-8","aria-hidden":"true"}),(0,Fo.jsx)("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]}),(0,Fo.jsxs)("div",{className:"flex flex-col gap-2 bg-black/80 p-3",children:[n!=="scanning"?(0,Fo.jsx)("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,(0,Fo.jsxs)("form",{className:"flex gap-2",onSubmit:p=>{p.preventDefault(),u()},children:[(0,Fo.jsx)("label",{className:"sr-only",htmlFor:"qr-manual-input",children:"\u624B\u52A8\u8F93\u5165\u4E8C\u7EF4\u7801\u5185\u5BB9"}),(0,Fo.jsx)("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"}),(0,Fo.jsx)("button",{type:"submit",className:"shrink-0 rounded-md bg-white px-3 py-2 text-sm font-medium text-black",children:"\u786E\u8BA4"})]})]})]})}var Ti=M(require("react"),1);var Rn=require("react/jsx-runtime");function a0(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 rS({onSave:e,className:t}){let a=Ti.useRef(null),r=Ti.useRef(!1),o=Ti.useRef(null),[n,i]=Ti.useState(!1),c=Ti.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"}},[]);Ti.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=a0(x,v),i(!0))},m=x=>{let v=a.current;if(!v||!r.current||!o.current)return;let N=a0(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(0,Rn.jsxs)("div",{"data-slot":"mobile-signature",className:l("flex flex-col gap-2 text-foreground",t),children:[(0,Rn.jsxs)("div",{className:"relative h-40 w-full overflow-hidden rounded-lg border bg-background",children:[(0,Rn.jsx)("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:(0,Rn.jsxs)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 text-sm text-muted-foreground",children:[(0,Rn.jsx)(Zc,{className:"size-5","aria-hidden":"true"}),(0,Rn.jsx)("span",{children:"\u8BF7\u5728\u6B64\u5904\u7B7E\u540D"})]}),(0,Rn.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 border-b border-dashed border-border","aria-hidden":"true"})]}),(0,Rn.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,Rn.jsxs)("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:[(0,Rn.jsx)(Le,{className:"size-4","aria-hidden":"true"}),"\u6E05\u9664"]}),(0,Rn.jsxs)("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:[(0,Rn.jsx)(Zc,{className:"size-4","aria-hidden":"true"}),"\u4FDD\u5B58"]})]})]})}var Vc=M(require("react"),1);var $o=require("react/jsx-runtime");function r0(e,t){let a=t==="lat"?e>=0?"N":"S":e>=0?"E":"W";return`${Math.abs(e).toFixed(6)}\xB0 ${a}`}function oS({onLocate:e,className:t}){let[a,r]=Vc.useState("idle"),[o,n]=Vc.useState(null),[i,c]=Vc.useState(""),s=Vc.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(0,$o.jsxs)("div",{"data-slot":"mobile-geolocation",className:l("flex flex-col gap-3 rounded-lg border bg-card p-4",t),children:[(0,$o.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,$o.jsx)(ss,{className:"size-4 text-primary","aria-hidden":"true"}),(0,$o.jsx)("span",{className:"flex-1 text-muted-foreground",children:d}),(0,$o.jsxs)("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:[(0,$o.jsx)(zr,{className:l("size-3.5",a==="locating"&&"animate-spin"),"aria-hidden":"true"}),o?"\u91CD\u65B0\u5B9A\u4F4D":"\u83B7\u53D6\u5B9A\u4F4D"]})]}),o?(0,$o.jsxs)("dl",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,$o.jsxs)("div",{className:"rounded-md bg-muted/50 p-2",children:[(0,$o.jsx)("dt",{className:"text-xs text-muted-foreground",children:"\u7EAC\u5EA6"}),(0,$o.jsx)("dd",{className:"tabular-nums",children:r0(o.lat,"lat")})]}),(0,$o.jsxs)("div",{className:"rounded-md bg-muted/50 p-2",children:[(0,$o.jsx)("dt",{className:"text-xs text-muted-foreground",children:"\u7ECF\u5EA6"}),(0,$o.jsx)("dd",{className:"tabular-nums",children:r0(o.lng,"lng")})]})]}):(0,$o.jsx)("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"})]})}var Op=M(require("react"),1);var $s=require("react/jsx-runtime");function nS({onLoadMore:e,hasMore:t=!0,loading:a=!1,children:r,className:o}){let n=Op.useRef(null);return Op.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]),(0,$s.jsxs)("div",{"data-slot":"mobile-infinite-scroll",className:l("flex flex-col",o),children:[r,(0,$s.jsx)("div",{ref:n,className:"flex items-center justify-center gap-2 py-3 text-xs text-muted-foreground","aria-live":"polite",children:a?(0,$s.jsxs)($s.Fragment,{children:[(0,$s.jsx)(Oo,{className:"size-3.5 animate-spin","aria-hidden":"true"}),(0,$s.jsx)("span",{children:"\u52A0\u8F7D\u4E2D\u2026"})]}):t?(0,$s.jsx)("span",{children:"\u4E0A\u62C9\u52A0\u8F7D\u66F4\u591A"}):(0,$s.jsx)("span",{children:"\u6CA1\u6709\u66F4\u591A\u4E86"})})]})}var o0=M(require("react"),1);var Gl=require("react/jsx-runtime");function sS({tabs:e,activeId:t,onSelect:a,className:r}){let o=t??e[0]?.id,n=o0.useId();return(0,Gl.jsx)("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:(0,Gl.jsx)("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(0,Gl.jsx)("li",{role:"none",className:"min-w-0",children:(0,Gl.jsxs)("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?(0,Gl.jsx)("span",{className:"[&>svg]:size-5","aria-hidden":"true",children:i.icon}):null,(0,Gl.jsx)("span",{className:"truncate leading-none",children:i.label})]})},i.id)})})})}var Qj=require("react");var jl=require("react/jsx-runtime");function iS({title:e,subtitle:t,trailing:a,onClick:r,className:o}){let n=typeof r=="function";return(0,jl.jsxs)("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:[(0,jl.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,jl.jsx)("div",{className:"truncate font-medium",children:e}),t?(0,jl.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:t}):null]}),a?(0,jl.jsx)("div",{className:"shrink-0 text-muted-foreground",children:a}):null,n?(0,jl.jsx)(ke,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):null]})}var _a=M(require("react"),1),Oc=require("@tanstack/react-table");var Rt=require("react/jsx-runtime");function lS({checked:e,indeterminate:t,onChange:a,className:r}){let o=_a.useRef(null);return _a.useEffect(()=>{o.current&&(o.current.indeterminate=t)},[t]),(0,Rt.jsx)("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 n0(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(...n0(d,t,a,r,o+1,[...n,s]))}return i}function Lf(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(...Lf(n,t,a))}return o}function s0(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+=s0(c,t,a,r);return i}function zf(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=zf(i,t,a,r);if(c)return c}}}function i0(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]:i0(c,t,a,r,o)}:n})}function l0(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]:l0(i,t,a,r)}:n})}function dS({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=_a.useMemo(()=>o?lp(t,{idKey:a,parentKey:o,childrenKey:r}):t,[t,o,a,r]),[g,y]=_a.useState(b);_a.useEffect(()=>{y(b)},[b]);let[k,w]=_a.useState(()=>new Set(u??[])),R=_a.useMemo(()=>p?new Set(p):k,[p,k]),S=_a.useCallback(se=>{p||w(se),f?.(Array.from(se))},[p,f]),[A,z]=_a.useState(new Set),U=_a.useRef(new Set),[B,O]=_a.useState([]),I=_a.useMemo(()=>{if(B.length===0)return g;let{id:se,desc:W}=B[0];return l0(g,se,W?"desc":"asc",r)},[g,B,r]),E=_a.useMemo(()=>n0(I,a,r,R),[I,a,r,R]),_=_a.useMemo(()=>new Set(d??[]),[d]),X=_a.useMemo(()=>s!=="multiple"?null:E.map(se=>{let W=zf(I,se.key,a,r),de=W?Lf(W,a,r):[],ce=W?s0(W,a,r,R):0,ia=de.filter(ga=>_.has(ga)).length,yt=ce>0&&ia===ce,_t=ia>0&&ia<ce;return{...se,allDescendants:de,isAllChecked:yt,isIndeterminate:_t}}),[E,s,_,I,a,r,R]),Fe=_a.useMemo(()=>e.map(se=>({id:se.key,accessorKey:se.key,header:se.title,enableSorting:!!se.sortable,cell:W=>{let de=W.getValue(),ce=W.row.original,ia=W.row.index;return se.render?se.render(de,ce,ia):de??"\u2014"}})),[e]),J=(0,Oc.useReactTable)({data:I,columns:Fe,state:{sorting:B},onSortingChange:O,getCoreRowModel:(0,Oc.getCoreRowModel)(),enableSorting:!0,manualSorting:!0}),Ne=c==="sm"?"px-2 py-1.5":c==="lg"?"px-4 py-3":"px-3 py-2",V=s==="single"||s==="multiple",Ce=e.length+(V?1:0),oa=_a.useCallback(async(se,W)=>{let de=!!x,ce=W[r],ia=!Array.isArray(ce)||ce.length===0;if(de&&ia&&!U.current.has(se)&&x){z(_t=>new Set(_t).add(se));try{let _t=await x(W);U.current.add(se),y(xr=>i0(xr,se,_t,a,r));let ga=new Set(R);ga.add(se),S(ga)}finally{z(_t=>{let ga=new Set(_t);return ga.delete(se),ga})}}else{let _t=new Set(R);_t.has(se)?_t.delete(se):_t.add(se),S(_t)}},[x,r,a,R,S]),sa=_a.useCallback((se,W)=>{if(s==="none")return;if(s==="single"){let yt=_.has(se)?[]:[se];m?.(yt);return}let de=zf(I,se,a,r),ce=de?Lf(de,a,r):[];if(_.has(se)){let yt=new Set([se,...ce]),_t=Array.from(_).filter(ga=>!yt.has(ga));m?.(_t)}else{let yt=new Set(_);yt.add(se);for(let _t of ce)yt.add(_t);m?.(Array.from(yt))}},[s,_,m,I,a,r]),Ho=_a.useCallback(se=>{O(W=>{let de=W.find(ce=>ce.id===se);return de?de.desc?[]:[{id:se,desc:!0}]:[{id:se,desc:!1}]})},[]);return(0,Rt.jsx)("div",{"data-slot":"tree-table",className:l("overflow-x-auto rounded-lg border border-border",h),children:(0,Rt.jsxs)(at,{children:[v&&(0,Rt.jsx)(Og,{children:v}),(0,Rt.jsx)(rt,{children:J.getHeaderGroups().map(se=>(0,Rt.jsxs)(K,{className:"bg-muted/30",children:[V&&(0,Rt.jsx)(F,{className:l("w-10",Ne)}),se.headers.map(W=>{let de=e.find(yt=>yt.key===W.id),ce=W.column.getCanSort(),ia=W.column.getIsSorted();return(0,Rt.jsx)(F,{className:l(Ne,de?.align==="center"&&"text-center",de?.align==="right"&&"text-right",ce&&"cursor-pointer select-none",de?.fixed&&"sticky z-[2] bg-inherit",de?.fixed==="left"&&"left-0",de?.fixed==="right"&&"right-0"),style:de?.width?{width:de.width}:void 0,onClick:ce?()=>Ho(W.id):void 0,children:(0,Rt.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Oc.flexRender)(W.column.columnDef.header,W.getContext()),ce&&(ia==="asc"?(0,Rt.jsx)(Li,{className:"size-3"}):ia==="desc"?(0,Rt.jsx)(Os,{className:"size-3"}):(0,Rt.jsx)(su,{className:"size-3 opacity-40"}))]})},W.id)})]},se.id))}),(0,Rt.jsx)(Oe,{children:n?Array.from({length:5}).map((se,W)=>(0,Rt.jsxs)(K,{children:[V&&(0,Rt.jsx)(D,{className:Ne,children:(0,Rt.jsx)(la,{className:"size-4"})}),e.map(de=>(0,Rt.jsx)(D,{className:Ne,children:(0,Rt.jsx)(la,{className:"h-4 w-full"})},de.key))]},`skeleton-${W}`)):E.length===0?(0,Rt.jsx)(K,{children:(0,Rt.jsx)(D,{colSpan:Ce,className:"py-12 text-center text-muted-foreground",children:i})}):(X??E).map((se,W)=>{let de=A.has(se.key),ce=_.has(se.key),ia=X?X[W]:null;return(0,Rt.jsxs)(K,{"data-depth":se.depth,"data-selected":ce||void 0,className:l(N&&W%2===1&&"bg-muted/20",ce&&"bg-muted"),children:[V&&(0,Rt.jsx)(D,{className:l(Ne,"w-10"),children:s==="multiple"?(0,Rt.jsx)(lS,{checked:ce,indeterminate:ia?.isIndeterminate??!1,onChange:()=>sa(se.key,se.row)}):(0,Rt.jsx)("input",{type:"radio",name:"tree-table-selection","data-slot":"tree-table-radio",checked:ce,onChange:()=>sa(se.key,se.row),className:"size-4 shrink-0 cursor-pointer accent-primary"})}),e.map((yt,_t)=>{let ga=se.row[yt.key],xr=yt.render?yt.render(ga,se.row,W):ga??"\u2014";return(0,Rt.jsx)(D,{className:l(Ne,yt.align==="center"&&"text-center",yt.align==="right"&&"text-right",yt.fixed&&"sticky z-[2] bg-inherit",yt.fixed==="left"&&"left-0",yt.fixed==="right"&&"right-0"),style:yt.width?{width:yt.width}:void 0,children:_t===0?(0,Rt.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Rt.jsx)("span",{style:{paddingLeft:se.depth*24},className:"inline-flex shrink-0"}),(se.hasChildren||!!x&&!se.hasChildren)&&(0,Rt.jsx)("button",{type:"button","data-slot":"tree-table-expand",onClick:()=>oa(se.key,se.row),className:"inline-flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted","aria-label":se.isExpanded?"Collapse":"Expand",children:de?(0,Rt.jsx)(Oo,{className:"size-4 animate-spin"}):se.isExpanded?(0,Rt.jsx)(fe,{className:"size-4"}):(0,Rt.jsx)(ke,{className:"size-4"})}),!se.hasChildren&&!x&&(0,Rt.jsx)("span",{className:"inline-flex size-5 shrink-0"}),(0,Rt.jsx)("span",{className:"min-w-0",children:xr})]}):xr},yt.key)})]},se.key)})})]})})}var wa=M(require("react"),1);var mt=require("react/jsx-runtime");function d0(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(...d0(s,t,a,r,o+1))}return n}function Ef(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=Ef(i,t,a,r);c===o&&(c={...o}),c[a]=d}return c})}function Af(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 cS({value:e,onChange:t,onCommit:a,onCancel:r}){return(0,mt.jsx)(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 mS({value:e,onChange:t,onCommit:a,onCancel:r}){return(0,mt.jsx)(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 uS({value:e,onChange:t,onCommit:a,onCancel:r,options:o}){let n=wa.useRef(null);return wa.useEffect(()=>{n.current&&n.current.focus()},[]),(0,mt.jsx)("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=>(0,mt.jsx)("option",{value:String(i.value),children:i.label},String(i.value)))})}function pS({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=wa.useMemo(()=>o?lp(t,{idKey:a,parentKey:o,childrenKey:r}):t,[t,o,a,r]),[h,b]=wa.useState(()=>new Set(d??[])),g=wa.useMemo(()=>s?new Set(s):h,[s,h]),y=wa.useMemo(()=>d0(N,a,r,g),[N,a,r,g]),[k,w]=wa.useState(null),[R,S]=wa.useState(""),[A,z]=wa.useState(null),[U,B]=wa.useState(new Map),O=wa.useCallback((W,de,ce)=>{let ia=U.get(String(W));return ia?.has(de)?ia.get(de):ce[de]},[U]),I=wa.useCallback((W,de)=>U.get(String(W))?.has(de)??!1,[U]),_=wa.useMemo(()=>Af(t,a,r,U),[t,a,r,U]).length,X=wa.useCallback((W,de)=>!x||!W.editable?!1:typeof W.editable=="function"?W.editable(de):!0,[x]),Fe=wa.useCallback((W,de,ce)=>{if(!X(de,ce))return;let ia=O(W,de.key,ce);w({rowKey:W,columnKey:de.key}),S(ia??""),z(null)},[X,O]),J=wa.useCallback(W=>{if(!m)return;let de=Ef(t,a,r,W),ce=Af(t,a,r,W);m(de,ce)},[m,t,a,r]),Ne=wa.useCallback(()=>{if(!k)return;let{rowKey:W,columnKey:de}=k,ce=e.find(ga=>ga.key===de),ia=y.find(ga=>ga.key===W);if(!ce||!ia){w(null);return}if(ce.validate){let ga=ce.validate(R,ia.row);if(ga){z(ga);return}}let yt=ia.row[de],_t=String(W);B(ga=>{let xr=new Map(ga),lo=new Map(xr.get(_t)??[]);return R===yt?(lo.delete(de),lo.size===0?xr.delete(_t):xr.set(_t,lo)):(lo.set(de,R),xr.set(_t,lo)),J(xr),xr}),w(null),z(null)},[k,e,y,R,J]),V=wa.useCallback(()=>{w(null),z(null)},[]),Ce=wa.useCallback(async()=>{let W=Ef(t,a,r,U),de=Af(t,a,r,U);await u?.(W,de),B(new Map)},[U,t,a,r,u]),oa=wa.useCallback(()=>{B(new Map),w(null),z(null),p?.()},[p]),sa=wa.useCallback(W=>{b(de=>{let ce=new Set(de);return ce.has(W)?ce.delete(W):ce.add(W),ce})},[]),Ho=c==="sm"?"px-2 py-1.5":c==="lg"?"px-4 py-3":"px-3 py-2",se=(W,de,ce)=>{let ia=k?.rowKey===ce&&k?.columnKey===W.key,yt=O(ce,W.key,de),_t=I(ce,W.key);if(!ia){let xr=W.render?W.render(yt,de,y.findIndex(lo=>lo.key===ce)):yt??"\u2014";return(0,mt.jsxs)("div",{"data-slot":"editable-cell-display","data-dirty":_t||void 0,className:l("group/cell relative min-h-[1.5rem] rounded px-1 py-0.5 transition-colors",X(W,de)&&"cursor-pointer hover:bg-muted/50",_t&&"bg-warning/10"),onClick:()=>Fe(ce,W,de),role:X(W,de)?"button":void 0,tabIndex:X(W,de)?0:void 0,onKeyDown:lo=>{X(W,de)&&(lo.key==="Enter"||lo.key===" ")&&(lo.preventDefault(),Fe(ce,W,de))},children:[xr,X(W,de)&&!_t&&(0,mt.jsx)(gl,{className:"absolute right-0.5 top-0.5 size-3 text-muted-foreground opacity-0 transition-opacity group-hover/cell:opacity-100"})]})}let ga=W.editorType??"text";return(0,mt.jsxs)("div",{"data-slot":"editable-cell-editor",children:[ga==="text"&&(0,mt.jsx)(cS,{value:String(R??""),onChange:xr=>S(xr),onCommit:Ne,onCancel:V}),ga==="number"&&(0,mt.jsx)(mS,{value:R,onChange:xr=>S(xr),onCommit:Ne,onCancel:V}),ga==="select"&&(0,mt.jsx)(uS,{value:R,onChange:xr=>S(xr),onCommit:Ne,onCancel:V,options:W.editorOptions??[]}),A&&(0,mt.jsx)("p",{"data-slot":"editable-cell-error",className:"mt-0.5 text-xs text-destructive",children:A})]})};return(0,mt.jsxs)("div",{"data-slot":"editable-tree-table",className:l("overflow-x-auto rounded-lg border border-border",v),children:[f&&x&&(0,mt.jsxs)("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:[(0,mt.jsx)("span",{className:"text-sm text-muted-foreground",children:_>0?`${_} unsaved change${_>1?"s":""}`:"No changes"}),(0,mt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,mt.jsx)(C,{variant:"outline",size:"sm",onClick:oa,disabled:_===0,icon:(0,mt.jsx)(ee,{className:"size-3.5"}),children:"Cancel"}),(0,mt.jsx)(C,{size:"sm",onClick:Ce,disabled:_===0,icon:(0,mt.jsx)(G,{className:"size-3.5"}),children:"Save"})]})]}),(0,mt.jsxs)(at,{children:[(0,mt.jsx)(rt,{children:(0,mt.jsx)(K,{className:"bg-muted/30",children:e.map(W=>(0,mt.jsx)(F,{className:l(Ho,W.align==="center"&&"text-center",W.align==="right"&&"text-right",W.fixed&&"sticky z-[2] bg-inherit",W.fixed==="left"&&"left-0",W.fixed==="right"&&"right-0"),style:W.width?{width:W.width}:void 0,children:W.title},W.key))})}),(0,mt.jsx)(Oe,{children:n?Array.from({length:5}).map((W,de)=>(0,mt.jsx)(K,{children:e.map(ce=>(0,mt.jsx)(D,{className:Ho,children:(0,mt.jsx)(la,{className:"h-4 w-full"})},ce.key))},`skeleton-${de}`)):y.length===0?(0,mt.jsx)(K,{children:(0,mt.jsx)(D,{colSpan:e.length,className:"py-12 text-center text-muted-foreground",children:i})}):y.map((W,de)=>(0,mt.jsx)(K,{"data-depth":W.depth,children:e.map((ce,ia)=>{let yt=O(W.key,ce.key,W.row),_t=X(ce,W.row);return(0,mt.jsx)(D,{className:l(Ho,ce.align==="center"&&"text-center",ce.align==="right"&&"text-right",ce.fixed&&"sticky z-[2] bg-inherit",ce.fixed==="left"&&"left-0",ce.fixed==="right"&&"right-0"),style:ce.width?{width:ce.width}:void 0,children:ia===0?(0,mt.jsxs)("span",{className:"flex items-center gap-1",children:[(0,mt.jsx)("span",{style:{paddingLeft:W.depth*24},className:"inline-flex shrink-0"}),W.hasChildren&&(0,mt.jsx)("button",{type:"button","data-slot":"editable-tree-table-expand",onClick:()=>sa(W.key),className:"inline-flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted","aria-label":W.isExpanded?"Collapse":"Expand",children:W.isExpanded?(0,mt.jsx)(fe,{className:"size-4"}):(0,mt.jsx)(ke,{className:"size-4"})}),!W.hasChildren&&(0,mt.jsx)("span",{className:"inline-flex size-5 shrink-0"}),(0,mt.jsx)("span",{className:"min-w-0 flex-1",children:_t?se(ce,W.row,W.key):ce.render?ce.render(yt,W.row,de):yt??"\u2014"})]}):_t?se(ce,W.row,W.key):ce.render?ce.render(yt,W.row,de):yt??"\u2014"},ce.key)})},W.key))})]})]})}var Um=M(require("react"),1);var Vt=require("react/jsx-runtime");function gS(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 c0={added:{label:"Added",variant:"default"},removed:{label:"Removed",variant:"destructive"},changed:{label:"Changed",variant:"secondary"},unchanged:{label:"Unchanged",variant:"outline"}},fS={added:"bg-green-50 dark:bg-green-950/20",removed:"bg-red-50 dark:bg-red-950/20",changed:"",unchanged:""};function bS({before:e,after:t,rowKey:a,columns:r,viewMode:o="unified",showChangesOnly:n=!1,showSummary:i=!1,className:c}){let s=Um.useMemo(()=>r.map(N=>N.key),[r]),d=Um.useMemo(()=>gS(e,t,a,s),[e,t,a,s]),m=Um.useMemo(()=>{let N={added:0,removed:0,changed:0,unchanged:0};for(let h of d)N[h.status]++;return N},[d]),u=Um.useMemo(()=>n?d.filter(N=>N.status!=="unchanged"):d,[d,n]),p=(N,h)=>{if(!h)return(0,Vt.jsx)("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(0,Vt.jsx)("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(0,Vt.jsxs)("div",{"data-slot":"diff-cell-changed",children:[(0,Vt.jsx)("span",{children:R}),(0,Vt.jsx)("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(0,Vt.jsx)("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)=>(0,Vt.jsxs)(at,{children:[(0,Vt.jsx)(rt,{children:(0,Vt.jsxs)(K,{className:"bg-muted/30",children:[(0,Vt.jsx)(F,{className:"w-20 px-3 py-2",children:"Status"}),r.map(g=>(0,Vt.jsx)(F,{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))]})}),(0,Vt.jsx)(Oe,{children:N.length===0?(0,Vt.jsx)(K,{children:(0,Vt.jsx)(D,{colSpan:r.length+1,className:"py-12 text-center text-muted-foreground",children:"No differences found"})}):N.map(g=>(0,Vt.jsxs)(K,{"data-status":g.status,className:l(fS[g.status]),children:[(0,Vt.jsx)(D,{className:"px-3 py-2",children:(0,Vt.jsx)(L,{variant:c0[g.status].variant,className:"text-[10px]",children:c0[g.status].label})}),r.map(y=>{let k=g.changedFields.has(y.key);return(0,Vt.jsx)(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(0,Vt.jsxs)("div",{"data-slot":"diff-viewer-table",className:l("overflow-x-auto rounded-lg border border-border",c),children:[i&&(0,Vt.jsxs)("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:[(0,Vt.jsx)("span",{className:"mr-2 text-sm font-medium text-foreground",children:"Summary"}),(0,Vt.jsxs)(L,{variant:"default",className:"text-xs",children:[m.added," Added"]}),(0,Vt.jsxs)(L,{variant:"destructive",className:"text-xs",children:[m.removed," Removed"]}),(0,Vt.jsxs)(L,{variant:"secondary",className:"text-xs",children:[m.changed," Changed"]}),(0,Vt.jsxs)(L,{variant:"outline",className:"text-xs",children:[m.unchanged," Unchanged"]}),(0,Vt.jsxs)("span",{className:"ml-auto text-xs text-muted-foreground",children:[u.length," of ",d.length," rows shown"]})]}),o==="unified"?v(u,f):(0,Vt.jsxs)("div",{"data-slot":"diff-side-by-side",className:"grid grid-cols-2 divide-x divide-border",children:[(0,Vt.jsxs)("div",{"data-slot":"diff-side-before",children:[(0,Vt.jsx)("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")]}),(0,Vt.jsxs)("div",{"data-slot":"diff-side-after",children:[(0,Vt.jsx)("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")]})]})]})}var Yn=M(require("react"),1);var At=require("react/jsx-runtime"),xS=[{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 m0(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 Ff({nodes:e,selectedCode:t,onSelect:a,levelLabel:r}){let[o,n]=Yn.useState(""),i=Yn.useMemo(()=>o?e.filter(c=>c.name.toLowerCase().includes(o.toLowerCase())):e,[e,o]);return(0,At.jsxs)("div",{className:"flex min-w-[160px] flex-col border-r last:border-r-0",children:[(0,At.jsx)("div",{className:"border-b px-2 py-1.5",children:(0,At.jsxs)("div",{className:"relative",children:[(0,At.jsx)(te,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,At.jsx)(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})]})}),(0,At.jsxs)("div",{className:"max-h-64 overflow-y-auto",children:[i.length===0&&(0,At.jsx)("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(0,At.jsxs)("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:[(0,At.jsx)("span",{className:"truncate",children:c.name}),s&&(0,At.jsx)(G,{className:"size-3.5 shrink-0 text-primary"})]},c.code)})]})]})}var u0=["\u7701/\u5E02","\u5E02/\u533A","\u533A/\u53BF","\u8857\u9053"];function p0({tree:e,codes:t,level:a,onSelect:r,onLoad:o}){let n=Yn.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]=Yn.useState({}),[s,d]=Yn.useState(null),m=a===4&&t.length>=3?t[2]:void 0;Yn.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(0,At.jsxs)("div",{"data-slot":"address-picker-panel",className:"flex",children:[n.map((p,f)=>(0,At.jsx)(Ff,{nodes:p,selectedCode:t[f]??"",levelLabel:u0[f]??"\u7B2C"+(f+1)+"\u7EA7",onSelect:x=>r(f,x)},f)),a===4&&m&&(0,At.jsx)(Ff,{nodes:u??[],selectedCode:t[3]??"",levelLabel:u0[3]??"",onSelect:p=>r(3,p)}),a===4&&m&&s===m&&(0,At.jsx)("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 vS({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]=Yn.useState(!1),[p,f]=Yn.useState(e);Yn.useEffect(()=>{f(e)},[e]);let x=r??xS,v=Yn.useMemo(()=>m0(p,x),[p,x]),N=v.join(" / ")||n,h=v.length>0,b=(R,S)=>{let A=p.slice(0,R);A[R]=S.code;let z=(S.children?.length??0)>0,U=a,B=!z||A.length>=U,O=a===4&&R===2&&!z;if(f(A),B&&!O){let I=m0(A,x);t?.(A,I),u(!1)}},g=R=>{R.stopPropagation(),f([]),t?.([],[]),u(!1)},y=(0,At.jsx)(p0,{tree:x,codes:p,level:a,onSelect:b,...o?{onLoad:o}:{}}),k=(0,At.jsxs)("div",{className:"flex items-center gap-1.5 truncate",children:[(0,At.jsx)(ss,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,At.jsx)("span",{className:l("truncate",!h&&"text-muted-foreground"),children:N})]}),w=s&&h&&!i?(0,At.jsx)("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:(0,At.jsx)(ee,{className:"size-3.5 text-muted-foreground"})}):null;return c?(0,At.jsxs)(st,{open:m,onOpenChange:u,children:[(0,At.jsxs)(it,{render:(0,At.jsx)("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,(0,At.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[w,(0,At.jsx)(fe,{className:"size-4 opacity-50"})]})]}),(0,At.jsx)(lt,{align:"start",className:"w-auto p-0",children:y})]}):(0,At.jsxs)(st,{open:m,onOpenChange:u,children:[(0,At.jsxs)(it,{render:(0,At.jsx)("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,(0,At.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[w,(0,At.jsx)(fe,{className:"size-4 opacity-50"})]})]}),(0,At.jsx)(lt,{align:"start",className:"w-auto p-0",children:y})]})}var Ri=M(require("react"),1);var et=require("react/jsx-runtime"),hS={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 g0(e){let t=[],a=r=>{for(let o of r)t.push(o),o.children?.length&&a(o.children)};return a(e),t}function yS(e,t){return g0(e).filter(r=>t.includes(r.id))}function NS(e,t){if(!t)return!0;let a=t.toLowerCase();return e.batchNo.toLowerCase().includes(a)||(e.productName?.toLowerCase().includes(a)??!1)}function f0(e,t){if(!t)return e;let a=[];for(let r of e){let o=r.children?f0(r.children,t):[];(NS(r,t)||o.length>0)&&a.push({...r,children:o.length>0?o:r.children??[]})}return a}function CS({status:e}){if(!e)return null;let t=hS[e]??"";return(0,et.jsx)(L,{variant:"secondary",className:l("text-[10px]",t),children:e})}function b0({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(0,et.jsxs)("div",{children:[(0,et.jsxs)("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:[(0,et.jsx)("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?(0,et.jsx)(fe,{className:"size-3.5"}):(0,et.jsx)(ke,{className:"size-3.5"}):(0,et.jsx)("span",{className:"size-3.5"})}),o==="multiple"?(0,et.jsx)(po,{checked:u,onCheckedChange:()=>s(e),"aria-label":"Select "+e.batchNo}):(0,et.jsx)("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&&(0,et.jsx)("span",{className:"size-2 rounded-full bg-primary-foreground"})}),(0,et.jsx)("span",{className:"truncate font-medium",children:e.batchNo}),i&&e.productName&&(0,et.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.productName}),n&&e.status&&(0,et.jsx)(CS,{status:e.status})]}),i&&u&&(0,et.jsxs)("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&&(0,et.jsxs)("span",{children:["Qty: ",e.quantity]}),e.productionDate&&(0,et.jsxs)("span",{children:["Prod: ",e.productionDate]}),e.expiryDate&&(0,et.jsxs)("span",{children:["Exp: ",e.expiryDate]})]}),d&&m&&(0,et.jsx)("div",{children:e.children.map(p=>(0,et.jsx)(b0,{node:p,depth:t+1,selectedIds:a,expandedIds:r,mode:o,showStatus:n,showMetadata:i,onToggleExpand:c,onToggleSelect:s},p.id))})]})}var kS=[];function wS({data:e,value:t=kS,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]=Ri.useState(!1),x=i??p,v=c??f,[N,h]=Ri.useState(""),[b,g]=Ri.useState(t),[y,k]=Ri.useState(new Set);Ri.useEffect(()=>{g(t)},[t]);let w=Ri.useMemo(()=>f0(e,N),[e,N]);Ri.useEffect(()=>{if(N){let O=new Set(g0(e).map(I=>I.id));k(O)}},[N,e]);let R=O=>{k(I=>{let E=new Set(I);return E.has(O)?E.delete(O):E.add(O),E})},S=O=>{g(r==="single"?[O.id]:I=>I.includes(O.id)?I.filter(E=>E!==O.id):[...I,O.id])},A=()=>{let O=yS(e,b);a?.(b,O),v(!1)},z=()=>{g(t),v(!1)},U=b.length,B=(0,et.jsx)(C,{variant:"outline",disabled:m,icon:(0,et.jsx)(pn,{}),children:U>0?U+" batch"+(U>1?"es":"")+" selected":"Select Batch"});return(0,et.jsxs)(et.Fragment,{children:[(0,et.jsx)("button",{type:"button",disabled:m,className:l(m&&"pointer-events-none opacity-50"),onClick:()=>!m&&v(!0),"data-slot":"batch-selector",children:n??B}),(0,et.jsx)(Ye,{open:x,onOpenChange:v,children:x&&(0,et.jsxs)(Je,{className:l("sm:max-w-lg",u),showCloseButton:!1,children:[(0,et.jsx)(nt,{children:(0,et.jsx)(Ze,{children:o})}),(0,et.jsx)(tm,{className:"p-0",children:(0,et.jsxs)("div",{className:"flex flex-col min-h-[320px]",children:[(0,et.jsxs)("div",{className:"relative px-3 pb-2",children:[(0,et.jsx)(te,{className:"pointer-events-none absolute top-1/2 left-5 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,et.jsx)(T,{className:"h-8 pl-8 text-sm",placeholder:"Search batch or product...",value:N,onChange:O=>h(O.target.value)})]}),(0,et.jsxs)("div",{className:"max-h-72 overflow-y-auto px-1",children:[w.length===0&&(0,et.jsx)("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No batches found"}),w.map(O=>(0,et.jsx)(b0,{node:O,depth:0,selectedIds:b,expandedIds:y,mode:r,showStatus:s,showMetadata:d,onToggleExpand:R,onToggleSelect:S},O.id))]})]})}),(0,et.jsxs)(bt,{children:[(0,et.jsx)(C,{variant:"outline",onClick:z,children:"Cancel"}),(0,et.jsx)(C,{onClick:A,children:"OK"})]})]})})]})}var Sn=M(require("react"),1);var Ue=require("react/jsx-runtime"),PS=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function TS(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 $f(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 Hf(e){let t=e.getDay();return t===0||t===6}function RS({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]=Sn.useState(()=>i??n??new Date(new Date().getFullYear(),new Date().getMonth(),1)),[v,N]=Sn.useState("all"),h=i??f,b=Sn.useCallback(B=>{i||x(B),c?.(B)},[i,c]),g=Sn.useCallback(()=>{let B=new Date(h.getFullYear(),h.getMonth()-1,1);b(B)},[h,b]),y=Sn.useCallback(()=>{let B=new Date(h.getFullYear(),h.getMonth()+1,1);b(B)},[h,b]),k=Sn.useMemo(()=>{let B=t;return s?.length&&(B=B.filter(O=>s.includes(O.id))),d&&v!=="all"&&(B=B.filter(O=>O.id===v)),B},[t,s,d,v]),w=Sn.useMemo(()=>{var O,I,E;let B={};for(let _ of a)B[O=_.date]??(B[O]={}),((I=B[_.date])[E=_.employeeId]??(I[E]=[])).push(_);return B},[a]),R=Sn.useMemo(()=>{let B={};for(let O of e)B[O.id]=O;return B},[e]),S=Sn.useMemo(()=>TS(h.getFullYear(),h.getMonth()),[h]),A=h.toLocaleDateString("en-US",{month:"long",year:"numeric"}),z=Sn.useCallback((B,O,I)=>{r?.(B,O,I)},[r]),U=Sn.useCallback((B,O)=>{o?.(B,O)},[o]);return(0,Ue.jsxs)("div",{"data-slot":"shift-calendar",className:l("flex flex-col gap-3",p),children:[(0,Ue.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,Ue.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Ue.jsx)(C,{type:"button",variant:"outline",size:"icon-sm",onClick:g,"aria-label":"Previous month",children:(0,Ue.jsx)($t,{className:"size-4"})}),(0,Ue.jsx)("span",{className:"min-w-[140px] text-center text-sm font-semibold",children:A}),(0,Ue.jsx)(C,{type:"button",variant:"outline",size:"icon-sm",onClick:y,"aria-label":"Next month",children:(0,Ue.jsx)(ke,{className:"size-4"})})]}),d&&(0,Ue.jsxs)("select",{value:v,onChange:B=>N(B.target.value),className:"border-input bg-background h-8 rounded-md border px-2 text-sm","aria-label":"Filter employees",children:[(0,Ue.jsx)("option",{value:"all",children:"All employees"}),t.map(B=>(0,Ue.jsx)("option",{value:B.id,children:B.name},B.id))]})]}),(0,Ue.jsx)(Qa,{children:(0,Ue.jsxs)("table",{className:"w-full border-collapse text-xs",children:[(0,Ue.jsx)("thead",{children:(0,Ue.jsxs)("tr",{children:[(0,Ue.jsx)("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(B=>{let O=$f(B),I=Hf(B),E=B.getMonth()===h.getMonth();return(0,Ue.jsxs)("th",{className:l("border border-border p-1 text-center text-[0.65rem] font-medium",I&&"bg-muted/40",!E&&"text-muted-foreground/40"),children:[(0,Ue.jsx)("div",{children:PS[(B.getDay()+6)%7]}),(0,Ue.jsx)("div",{className:"text-[0.7rem] font-semibold",children:B.getDate()})]},O)})]})}),(0,Ue.jsxs)("tbody",{children:[k.map(B=>(0,Ue.jsxs)("tr",{children:[(0,Ue.jsx)("td",{className:"text-foreground sticky left-0 z-10 bg-background border border-border p-1.5 text-[0.7rem] font-medium",children:B.name}),S.map(O=>{let I=$f(O),E=Hf(O),_=O.getMonth()===h.getMonth(),X=w[I]?.[B.id]??[];return(0,Ue.jsx)("td",{className:l("border border-border p-0.5 align-top",E&&"bg-muted/20",!_&&"opacity-30"),children:u?(0,Ue.jsx)("div",{className:"flex flex-wrap gap-0.5 p-0.5",children:X.map((Fe,J)=>{let Ne=R[Fe.shiftTypeId];return Ne?(0,Ue.jsx)("span",{className:l("inline-block rounded px-1 py-px text-[0.6rem] leading-tight",Ne.color,Ne.textColor??"text-white"),children:Ne.label},Fe.id??`${I}-${B.id}-${J}`):null})}):(0,Ue.jsxs)(st,{children:[(0,Ue.jsx)(it,{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 ${B.name} on ${I}`,children:X.map((Fe,J)=>{let Ne=R[Fe.shiftTypeId];return Ne?(0,Ue.jsx)("span",{className:l("inline-block rounded px-1 py-px text-[0.6rem] leading-tight",Ne.color,Ne.textColor??"text-white"),onContextMenu:V=>{V.preventDefault(),V.stopPropagation(),U(I,B.id)},onClick:V=>V.stopPropagation(),title:"Right-click to remove",children:Ne.label},Fe.id??`${I}-${B.id}-${J}`):null})}),(0,Ue.jsx)(lt,{side:"bottom",align:"center",children:(0,Ue.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,Ue.jsx)("span",{className:"text-muted-foreground px-1 text-[0.65rem]",children:"Assign shift"}),e.map(Fe=>(0,Ue.jsxs)(C,{type:"button",variant:"ghost",size:"xs",className:"justify-start gap-2",onClick:()=>z(I,B.id,Fe.id),children:[(0,Ue.jsx)("span",{className:l("inline-block size-3 rounded-sm",Fe.color)}),(0,Ue.jsx)("span",{children:Fe.label}),Fe.startTime&&Fe.endTime&&(0,Ue.jsxs)("span",{className:"text-muted-foreground ml-auto text-[0.6rem]",children:[Fe.startTime,"\\u2013",Fe.endTime]})]},Fe.id))]})})]})},I)})]},B.id)),m&&(0,Ue.jsxs)("tr",{children:[(0,Ue.jsx)("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(B=>{let O=$f(B),I=Hf(B);return(0,Ue.jsx)("td",{className:l("border border-border p-0.5 text-center text-[0.6rem]",I&&"bg-muted/20"),children:(()=>{let E=0;for(let _ of k)for(let X of w[O]?.[_.id]??[]){let Fe=R[X.shiftTypeId];Fe?.hours&&(E+=Fe.hours)}return E>0?E:""})()},O)})]})]})]})}),(0,Ue.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:e.map(B=>(0,Ue.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,Ue.jsx)("span",{className:l("inline-block size-3 rounded-sm",B.color)}),(0,Ue.jsxs)("span",{className:"text-muted-foreground text-[0.7rem]",children:[B.label,B.hours?` (${B.hours}h)`:""]})]},B.id))})]})}var EK=require("react");var Ot=require("react/jsx-runtime"),SS={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"}},IS={up:os,down:rs,flat:un};function DS({name:e,model:t,status:a,metrics:r,nextMaintenance:o,location:n,actions:i,onClick:c,className:s}){let d=SS[a];return(0,Ot.jsxs)(re,{"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:[(0,Ot.jsx)(he,{children:(0,Ot.jsxs)(ve,{className:"flex items-start justify-between gap-2",children:[(0,Ot.jsxs)("div",{className:"flex flex-col",children:[(0,Ot.jsx)("span",{children:e}),t&&(0,Ot.jsx)("span",{className:"text-muted-foreground text-xs font-normal",children:t})]}),(0,Ot.jsx)("span",{className:l("inline-flex h-5 shrink-0 items-center rounded-full px-2 text-xs font-medium",d.className),children:d.label})]})}),(0,Ot.jsx)(oe,{children:(0,Ot.jsxs)("div",{className:"flex flex-col gap-3",children:[n&&(0,Ot.jsxs)("div",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[(0,Ot.jsx)(ss,{className:"size-3.5 shrink-0"}),(0,Ot.jsx)("span",{children:n})]}),r&&r.length>0&&(0,Ot.jsxs)(Ot.Fragment,{children:[(0,Ot.jsx)(dt,{}),(0,Ot.jsx)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2",children:r.map(m=>{let u=m.trend?IS[m.trend]:void 0;return(0,Ot.jsxs)("div",{className:"flex flex-col",children:[(0,Ot.jsx)("span",{className:"text-muted-foreground text-[0.65rem] leading-tight",children:m.label}),(0,Ot.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Ot.jsxs)("span",{className:"text-sm font-semibold",children:[m.value,m.unit&&(0,Ot.jsx)("span",{className:"text-muted-foreground ml-0.5 text-xs font-normal",children:m.unit})]}),u&&(0,Ot.jsx)(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&&(0,Ot.jsxs)(Ot.Fragment,{children:[(0,Ot.jsx)(dt,{}),(0,Ot.jsxs)("div",{className:"text-muted-foreground flex items-center gap-1.5 text-xs",children:[(0,Ot.jsx)(Te,{className:"size-3.5 shrink-0"}),(0,Ot.jsxs)("span",{children:["Next maintenance: ",o]})]})]})]})}),i&&i.length>0&&(0,Ot.jsx)(Ln,{className:"flex-wrap gap-2",children:i.map(m=>(0,Ot.jsxs)(C,{type:"button",variant:"outline",size:"xs",onClick:u=>{u.stopPropagation(),m.onClick?.()},children:[m.icon,m.label]},m.label))})]})}var Up=M(require("react"),1);var Zt=require("react/jsx-runtime"),x0={preventive:{label:"Preventive",variant:"info",icon:wu},corrective:{label:"Corrective",variant:"warning",icon:Ai},emergency:{label:"Emergency",variant:"destructive",icon:Vo},inspection:{label:"Inspection",variant:"success",icon:zi},calibration:{label:"Calibration",variant:"default",icon:Tb}},MS={completed:"Completed","in-progress":"In Progress",scheduled:"Scheduled"},BS=[{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 LS({entries:e,title:t,showFilter:a=!1,emptyText:r="No maintenance records.",className:o}){let[n,i]=Up.useState("all"),c=Up.useMemo(()=>n==="all"?e:e.filter(s=>s.type===n),[e,n]);return(0,Zt.jsxs)("div",{"data-slot":"maintenance-log",className:l("flex flex-col gap-4",o),children:[t&&(0,Zt.jsx)("h3",{className:"text-base font-semibold",children:t}),a&&(0,Zt.jsx)("div",{className:"flex flex-wrap gap-1",children:BS.map(s=>(0,Zt.jsx)(C,{type:"button",variant:n===s.value?"default":"outline",size:"xs",onClick:()=>i(s.value),children:s.label},s.value))}),c.length>0?(0,Zt.jsx)(ud,{children:c.map(s=>{let d=x0[s.type]??x0.inspection,m=d.icon;return(0,Zt.jsxs)(pd,{children:[(0,Zt.jsx)(bc,{variant:d.variant,children:(0,Zt.jsx)(m,{className:"size-4"})}),(0,Zt.jsx)(xc,{}),(0,Zt.jsxs)(vc,{className:"pb-6 last:pb-0",children:[(0,Zt.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,Zt.jsx)("time",{className:"text-muted-foreground text-xs",children:s.date}),(0,Zt.jsx)(L,{variant:d.variant==="destructive"?"destructive":d.variant==="default"?"default":"secondary",children:d.label}),(0,Zt.jsx)(L,{variant:s.status==="completed"?"secondary":s.status==="in-progress"?"outline":"ghost",children:MS[s.status]})]}),s.title&&(0,Zt.jsx)("h4",{className:"mt-1 text-sm font-semibold",children:s.title}),s.description&&(0,Zt.jsx)("p",{className:"text-muted-foreground mt-1 text-sm",children:s.description}),(0,Zt.jsxs)("div",{className:"text-muted-foreground mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs",children:[s.technician&&(0,Zt.jsxs)("span",{children:["Technician:"," ",(0,Zt.jsx)("span",{className:"text-foreground font-medium",children:s.technician})]}),s.duration&&(0,Zt.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Zt.jsx)(Te,{className:"size-3"}),s.duration]}),s.cost!=null&&(0,Zt.jsxs)("span",{children:["Cost:"," ",(0,Zt.jsxs)("span",{className:"text-foreground font-medium",children:["\\u00a5",s.cost.toLocaleString()]})]})]}),s.parts&&s.parts.length>0&&(0,Zt.jsxs)("div",{className:"mt-2",children:[(0,Zt.jsx)("span",{className:"text-xs font-medium",children:"Parts used:"}),(0,Zt.jsx)("ul",{className:"mt-1 flex flex-wrap gap-1",children:s.parts.map((u,p)=>(0,Zt.jsx)("li",{children:(0,Zt.jsx)(L,{variant:"outline",className:"text-[0.65rem]",children:u})},p))})]})]})]},s.id)})}):(0,Zt.jsx)("p",{className:"text-muted-foreground py-8 text-center text-sm",children:r})]})}var Jn=M(require("react"),1);var yo=require("react/jsx-runtime");function zS({onStop:e,onStart:t,mimeType:a="audio/webm",screen:r,maxDuration:o,className:n}){let[i,c]=Jn.useState(!1),[s,d]=Jn.useState(0),m=Jn.useRef(null),u=Jn.useRef([]),p=Jn.useRef(null),f=Jn.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=Jn.useCallback(()=>{m.current?.stop(),c(!1),p.current&&(clearInterval(p.current),p.current=null)},[]);Jn.useEffect(()=>{o&&s>=o&&i&&x()},[s,o,i,x]),Jn.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(0,yo.jsx)("div",{"data-slot":"media-recorder",className:l("flex items-center gap-3",n),children:i?(0,yo.jsxs)(yo.Fragment,{children:[(0,yo.jsxs)("div",{className:"flex items-center gap-2",children:[(0,yo.jsxs)("span",{className:"relative flex size-3",children:[(0,yo.jsx)("span",{className:"bg-destructive absolute inline-flex size-full animate-ping rounded-full opacity-75"}),(0,yo.jsx)("span",{className:"bg-destructive relative inline-flex size-3 rounded-full"})]}),(0,yo.jsx)("span",{className:"font-mono text-sm tabular-nums",children:v(s)})]}),o?(0,yo.jsx)("div",{className:"bg-muted h-1 flex-1 rounded",children:(0,yo.jsx)("div",{className:"bg-destructive h-1 rounded transition-all",style:{width:`${s/o*100}%`}})}):null,(0,yo.jsxs)(C,{variant:"destructive",size:"sm",onClick:x,children:[(0,yo.jsx)(Su,{className:"mr-1"}),"Stop"]})]}):(0,yo.jsxs)(C,{variant:"outline",size:"sm",onClick:f,children:[(0,yo.jsx)(Iu,{className:"mr-1"}),r?"Record Screen":"Record Audio"]})})}var Wp=M(require("react"),1),N0=require("react-hook-form");var ae=require("react/jsx-runtime");function Vf(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 v0(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 h0={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"},y0={pass:"PASS",fail:"FAIL",pending:"PENDING"};function AS(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 ES({template:e,values:t,inspector:a,onSubmit:r,readOnly:o=!1,showResult:n=!0,className:i}){let c=Wp.useMemo(()=>{let f={};for(let x of e.fields)f[x.id]=t?.[x.id]??"";return f},[e,t]),s=(0,N0.useForm)({defaultValues:c}),d=s.watch(),m=Wp.useMemo(()=>Vf(e,d),[e,d]),u=s.handleSubmit(f=>{let x=f;r?.({values:x,result:Vf(e,x),...a?{inspector:a}:{},date:new Date().toISOString()})}),p=Wp.useMemo(()=>AS(e.fields),[e.fields]);return o?(0,ae.jsxs)("div",{"data-slot":"quality-inspection-form",className:l("space-y-4",i),children:[(0,ae.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("h3",{className:"text-base font-semibold",children:e.name}),e.description&&(0,ae.jsx)("p",{className:"text-sm text-muted-foreground",children:e.description})]}),n&&(0,ae.jsx)("span",{"data-testid":"inspection-result-badge",className:l("inline-flex items-center rounded-full px-3 py-0.5 text-xs font-bold",h0[m]),children:y0[m]})]}),a&&(0,ae.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Inspector: ",(0,ae.jsx)("span",{className:"font-medium",children:a})]}),p.map((f,x)=>(0,ae.jsxs)("div",{className:"space-y-3",children:[f.name&&(0,ae.jsxs)("div",{className:"space-y-1",children:[(0,ae.jsx)("h4",{className:"text-sm font-semibold",children:f.name}),(0,ae.jsx)(dt,{})]}),(0,ae.jsx)("dl",{className:"space-y-3",children:f.fields.map(v=>{let N=t?.[v.id]??d[v.id],h=v0(v,N);return(0,ae.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,ae.jsxs)("dt",{className:"text-sm font-medium text-muted-foreground",children:[v.label,v.unit&&(0,ae.jsxs)("span",{className:"ml-1 text-xs",children:["(",v.unit,")"]})]}),(0,ae.jsx)("dd",{className:"text-sm","data-testid":`readonly-${v.id}`,children:v.type==="passfail"?(0,ae.jsx)("span",{className:"inline-flex items-center gap-1",children:N===!0||N==="pass"?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(zi,{className:"size-4 text-emerald-600"}),(0,ae.jsx)("span",{className:"text-emerald-700 dark:text-emerald-400",children:"Pass"})]}):N===!1||N==="fail"?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(ns,{className:"size-4 text-red-600"}),(0,ae.jsx)("span",{className:"text-red-700 dark:text-red-400",children:"Fail"})]}):(0,ae.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}):N!=null&&N!==""?(0,ae.jsx)("span",{className:l(h&&"font-semibold text-red-600 dark:text-red-400"),children:String(N)}):(0,ae.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},v.id)})})]},f.name??`group-${x}`))]}):(0,ae.jsx)(fx,{...s,children:(0,ae.jsxs)("form",{"data-slot":"quality-inspection-form",className:l("space-y-5",i),onSubmit:u,children:[(0,ae.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ae.jsxs)("div",{children:[(0,ae.jsx)("h3",{className:"text-base font-semibold",children:e.name}),e.description&&(0,ae.jsx)("p",{className:"text-sm text-muted-foreground",children:e.description})]}),n&&(0,ae.jsx)("span",{"data-testid":"inspection-result-badge",className:l("inline-flex items-center rounded-full px-3 py-0.5 text-xs font-bold",h0[m]),children:y0[m]})]}),a&&(0,ae.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Inspector: ",(0,ae.jsx)("span",{className:"font-medium",children:a})]}),p.map((f,x)=>(0,ae.jsxs)("div",{className:"space-y-4",children:[f.name&&(0,ae.jsxs)("div",{className:"space-y-1",children:[(0,ae.jsx)("h4",{className:"text-sm font-semibold","data-testid":`group-header-${f.name}`,children:f.name}),(0,ae.jsx)(dt,{})]}),f.fields.map(v=>(0,ae.jsx)(xx,{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=v0(v,N.value);return(0,ae.jsxs)(hx,{children:[(0,ae.jsxs)(yx,{required:!!v.required,children:[v.label,v.unit&&(0,ae.jsxs)("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",v.unit,")"]})]}),(0,ae.jsx)(Nx,{children:FS(v,N,h)}),v.type==="measurement"&&(v.specMin!=null||v.specMax!=null)&&(0,ae.jsxs)("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}`:""]}),(0,ae.jsx)(Cx,{})]})}},v.id))]},f.name??`group-${x}`)),(0,ae.jsx)(C,{type:"submit",className:"w-full",children:"Submit Inspection"})]})})}function FS(e,t,a){switch(e.type){case"measurement":return(0,ae.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ae.jsx)(Wi,{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&&(0,ae.jsx)("span",{className:"text-sm text-muted-foreground",children:e.unit})]});case"passfail":return(0,ae.jsxs)(Mx,{value:String(t.value??""),onValueChange:r=>t.onChange(r??""),className:"flex flex-row gap-4",children:[(0,ae.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ae.jsx)(Fg,{value:"pass"}),(0,ae.jsx)(zi,{className:"size-4 text-emerald-600"}),"Pass"]}),(0,ae.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,ae.jsx)(Fg,{value:"fail"}),(0,ae.jsx)(ns,{className:"size-4 text-red-600"}),"Fail"]})]});case"select":return(0,ae.jsxs)(Ge,{value:String(t.value??""),onValueChange:r=>t.onChange(r??""),children:[(0,ae.jsx)(Ke,{className:"w-full",children:(0,ae.jsx)(je,{placeholder:e.placeholder??"Select..."})}),(0,ae.jsx)(Qe,{children:(e.options??[]).map(r=>(0,ae.jsx)(De,{value:r.value,children:r.label},r.value))})]});case"text":return(0,ae.jsx)(Ta,{placeholder:e.placeholder??`Enter ${e.label.toLowerCase()}`,value:String(t.value??""),onChange:r=>t.onChange(r.target.value),onBlur:t.onBlur});case"photo":return(0,ae.jsx)("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:(0,ae.jsxs)("div",{className:"flex flex-col items-center gap-1 text-sm",children:[(0,ae.jsx)(Tu,{className:"size-5"}),(0,ae.jsx)("span",{children:"Upload Photo"})]})});default:return null}}var Kl=M(require("react"),1);var le=require("react/jsx-runtime"),$S={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"}},C0=[{key:"all",label:"All"},{key:"critical",label:"Critical"},{key:"warning",label:"Warning"},{key:"info",label:"Info"},{key:"normal",label:"Normal"}];function k0({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(0,le.jsx)("svg",{width:t,height:a,viewBox:`0 0 ${t} ${a}`,className:"text-foreground","data-testid":"sparkline",children:(0,le.jsx)("polyline",{points:s,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function HS({items:e,activeTab:t,onTabChange:a,onItemClick:r,onReorder:o,loading:n=!1,showTrend:i=!1,showTransactions:c=!1,className:s}){let[d,m]=Kl.useState("all"),[u,p]=Kl.useState(new Set),f=t??d,x=b=>{t||m(b),a?.(b)},v=Kl.useMemo(()=>f==="all"?e:e.filter(b=>b.severity===f),[e,f]),N=Kl.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?(0,le.jsxs)("div",{"data-slot":"inventory-alert-list",className:l("space-y-3",s),children:[(0,le.jsx)("div",{className:"flex gap-1 rounded-lg bg-muted/50 p-1",children:C0.map(b=>(0,le.jsx)(la,{className:"h-8 w-20"},b.key))}),(0,le.jsx)("div",{className:"space-y-2",children:Array.from({length:5}).map((b,g)=>(0,le.jsx)(la,{className:"h-12 w-full"},g))})]}):(0,le.jsxs)("div",{"data-slot":"inventory-alert-list",className:l("space-y-3",s),children:[(0,le.jsx)("div",{"data-testid":"filter-tabs",className:"flex gap-1 rounded-lg bg-muted/50 p-1",children:C0.map(b=>(0,le.jsxs)("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,(0,le.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",N[b.key]??0,")"]})]},b.key))}),v.length===0?(0,le.jsx)("div",{"data-testid":"empty-state",children:(0,le.jsx)(gd,{})}):(0,le.jsxs)(at,{children:[(0,le.jsx)(rt,{children:(0,le.jsxs)(K,{children:[c&&(0,le.jsx)(F,{className:"w-8"}),(0,le.jsx)(F,{children:"Name"}),(0,le.jsx)(F,{className:"text-right",children:"Current Qty"}),(0,le.jsx)(F,{className:"text-right",children:"Safety Stock"}),(0,le.jsx)(F,{children:"Status"}),i&&(0,le.jsx)(F,{children:"Trend"}),(0,le.jsx)(F,{children:"Warehouse"}),(0,le.jsx)(F,{className:"text-right",children:"Actions"})]})}),(0,le.jsx)(Oe,{children:v.map(b=>{let g=$S[b.severity],y=u.has(b.id);return(0,le.jsxs)(Kl.Fragment,{children:[(0,le.jsxs)(K,{className:l(g.rowBg,r&&"cursor-pointer"),onClick:()=>r?.(b),"data-testid":`row-${b.id}`,children:[c&&(0,le.jsx)(D,{children:b.recentTransactions&&b.recentTransactions.length>0&&(0,le.jsx)("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:k=>{k.stopPropagation(),h(b.id)},"data-testid":`expand-${b.id}`,children:(0,le.jsx)(fe,{className:l("size-4 transition-transform",y&&"rotate-180")})})}),(0,le.jsx)(D,{children:(0,le.jsxs)("div",{className:"flex flex-col",children:[(0,le.jsx)("span",{className:"font-medium",children:b.name}),b.code&&(0,le.jsx)("span",{className:"text-xs text-muted-foreground",children:b.code})]})}),(0,le.jsx)(D,{className:"text-right",children:(0,le.jsxs)("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}`:""]})}),(0,le.jsx)(D,{className:"text-right",children:(0,le.jsx)("span",{className:"font-mono text-muted-foreground",children:b.safetyStock??"\u2014"})}),(0,le.jsx)(D,{children:(0,le.jsx)("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&&(0,le.jsx)(D,{children:b.trend&&b.trend.length>=2?(0,le.jsx)(k0,{data:b.trend}):(0,le.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,le.jsx)(D,{children:(0,le.jsx)("span",{className:"text-sm text-muted-foreground",children:b.warehouse??"\u2014"})}),(0,le.jsx)(D,{className:"text-right",children:(b.severity==="critical"||b.severity==="warning")&&(0,le.jsx)(C,{variant:"outline",size:"xs",onClick:k=>{k.stopPropagation(),o?.(b)},children:"Reorder"})})]}),c&&y&&b.recentTransactions&&(0,le.jsx)(K,{children:(0,le.jsx)(D,{colSpan:7+(i?1:0)+(c?1:0),className:"bg-muted/30 p-3",children:(0,le.jsxs)("div",{className:"ml-8",children:[(0,le.jsx)("p",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Recent Transactions"}),(0,le.jsxs)("table",{className:"w-full text-xs",children:[(0,le.jsx)("thead",{children:(0,le.jsxs)("tr",{className:"text-muted-foreground",children:[(0,le.jsx)("th",{className:"pb-1 text-left font-medium",children:"Date"}),(0,le.jsx)("th",{className:"pb-1 text-left font-medium",children:"Type"}),(0,le.jsx)("th",{className:"pb-1 text-right font-medium",children:"Qty"}),(0,le.jsx)("th",{className:"pb-1 text-right font-medium",children:"Ref"})]})}),(0,le.jsx)("tbody",{children:b.recentTransactions.map((k,w)=>(0,le.jsxs)("tr",{className:"border-t border-border/50",children:[(0,le.jsx)("td",{className:"py-1",children:k.date}),(0,le.jsx)("td",{className:"py-1",children:(0,le.jsx)("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"})}),(0,le.jsx)("td",{className:"py-1 text-right font-mono",children:k.quantity}),(0,le.jsx)("td",{className:"py-1 text-right text-muted-foreground",children:k.reference??"\u2014"})]},w))})]})]})})})]},b.id)})})]})]})}var In=M(require("react"),1);var Kt=require("react/jsx-runtime"),w0=[{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 P0(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 T0(e){return Number.isFinite(e)?e===0?"0":Number(e.toPrecision(6)).toString():"\u2014"}function VS({categories:e,defaultCategory:t,defaultFrom:a,defaultTo:r,showSwap:o=!0,compact:n=!1,className:i}){let c=e&&e.length>0?e:w0,[s,d]=In.useState(t??c[0]?.id??""),m=In.useMemo(()=>c.find(w=>w.id===s)??c[0],[c,s]),[u,p]=In.useState(a??m.units[0]?.id??""),[f,x]=In.useState(r??m.units[1]?.id??m.units[0]?.id??""),[v,N]=In.useState(1),h=In.useRef(s);In.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=In.useMemo(()=>v==null||!b||!g?NaN:P0(v,b,g),[v,b,g]),k=In.useCallback(()=>{let w=u;p(f),x(w),isNaN(y)||N(Number(y.toPrecision(6)))},[u,f,y]);return(0,Kt.jsxs)("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?(0,Kt.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,Kt.jsx)(we,{className:"text-xs text-muted-foreground",children:"Category"}),(0,Kt.jsxs)(Ge,{value:s,onValueChange:w=>d(w??""),children:[(0,Kt.jsx)(Ke,{className:"w-full","data-testid":"category-select",children:(0,Kt.jsx)(je,{})}),(0,Kt.jsx)(Qe,{children:c.map(w=>(0,Kt.jsx)(De,{value:w.id,children:w.name},w.id))})]})]}):(0,Kt.jsx)(_o,{defaultValue:s,value:s,onValueChange:w=>w&&d(w),children:(0,Kt.jsx)(qo,{"data-testid":"category-tabs",children:c.map(w=>(0,Kt.jsx)(Xr,{value:w.id,"data-testid":`tab-${w.id}`,children:w.name},w.id))})}),(0,Kt.jsxs)("div",{className:l("flex items-end gap-3",n?"flex-col":"flex-wrap sm:flex-nowrap"),children:[(0,Kt.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,Kt.jsx)(we,{className:"text-xs text-muted-foreground",children:"From"}),(0,Kt.jsxs)(Ge,{value:u,onValueChange:w=>p(w??""),children:[(0,Kt.jsx)(Ke,{className:"w-full","data-testid":"from-unit-select",children:(0,Kt.jsx)(je,{})}),(0,Kt.jsx)(Qe,{children:m.units.map(w=>(0,Kt.jsxs)(De,{value:w.id,children:[w.abbr," - ",w.name]},w.id))})]}),(0,Kt.jsx)(Wi,{value:v,onChange:w=>N(w??null),"data-testid":"from-input",placeholder:"Enter value",className:"w-full"})]}),o&&(0,Kt.jsx)(C,{variant:"outline",size:"icon",onClick:k,"data-testid":"swap-button",className:l("shrink-0",n&&"self-center"),"aria-label":"Swap units",children:(0,Kt.jsx)(su,{className:"size-4"})}),(0,Kt.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,Kt.jsx)(we,{className:"text-xs text-muted-foreground",children:"To"}),(0,Kt.jsxs)(Ge,{value:f,onValueChange:w=>x(w??""),children:[(0,Kt.jsx)(Ke,{className:"w-full","data-testid":"to-unit-select",children:(0,Kt.jsx)(je,{})}),(0,Kt.jsx)(Qe,{children:m.units.map(w=>(0,Kt.jsxs)(De,{value:w.id,children:[w.abbr," - ",w.name]},w.id))})]}),(0,Kt.jsx)("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":T0(y)})]})]})]})}var rr=M(require("react"),1);var Et=require("react/jsx-runtime");function OS(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 Of=class{constructor(t,a){ed(this,"tokens");ed(this,"pos");ed(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 R0(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=OS(a),i=new Of(o,t).parse();return Number.isFinite(i)?i:null}catch{return null}}function US(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 WS({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=rr.useRef(null),[p,f]=rr.useState(e),[x,v]=rr.useState(!1),[N,h]=rr.useState(""),[b,g]=rr.useState("$"),[y,k]=rr.useState(0),[w,R]=rr.useState(-1);rr.useEffect(()=>{f(e)},[e]);let S=e!==void 0?e:p,A=rr.useCallback(J=>{let Ne=J.target.value;f(Ne),t?.(Ne);let V=J.target.selectionStart,Ce=Ne.slice(0,V),oa=Ce.lastIndexOf("$"),sa=Ce.lastIndexOf("@"),Ho=Math.max(oa,sa);if(Ho>=0){let se=oa>=sa?"$":"@",W=Ce.slice(Ho+1);if(!/\s/.test(W)){v(!0),h(W.toLowerCase()),g(se),R(Ho),k(0);return}}v(!1)},[t]),z=rr.useMemo(()=>{if(d)return d;if(!S.trim())return null;let J=US(S);return J||(o?o(S):null)},[S,d,o]),U=rr.useMemo(()=>!n||!S.trim()?null:R0(S,i),[n,S,i]),B=rr.useMemo(()=>{if(!n||!S.trim())return null;let J=S,Ne=Object.keys(i).sort((V,Ce)=>Ce.length-V.length);for(let V of Ne){let Ce=new RegExp(`\\$${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`,"g");J=J.replace(Ce,String(i[V]))}return J},[n,S,i]),O=rr.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=rr.useCallback(J=>{let Ne=u.current;if(!Ne){let W=S+J;f(W),t?.(W);return}let V=Ne.selectionStart,Ce=Ne.selectionEnd,oa=V;x&&w>=0&&(oa=w);let sa=S.slice(0,oa),Ho=S.slice(Ce),se=sa+J+Ho;f(se),t?.(se),v(!1),requestAnimationFrame(()=>{Ne.focus();let W=sa.length+J.length;Ne.setSelectionRange(W,W)})},[S,t,x,w]),E=rr.useCallback(J=>{I(`$${J}`)},[I]),_=rr.useCallback(J=>{let Ne=J.args.map(V=>V.name).join(", ");I(`${J.name}(${Ne})`)},[I]),X=rr.useCallback(J=>{if(b==="$"&&"type"in J&&!("args"in J))I(`$${J.name}`);else{let Ne=J,V=Ne.args.map(Ce=>Ce.name).join(", ");I(`${Ne.name}(${V})`)}},[b,I]),Fe=rr.useCallback(J=>{!x||O.length===0||(J.key==="ArrowDown"?(J.preventDefault(),k(Ne=>(Ne+1)%O.length)):J.key==="ArrowUp"?(J.preventDefault(),k(Ne=>(Ne-1+O.length)%O.length)):J.key==="Enter"?(J.preventDefault(),X(O[y])):J.key==="Escape"&&v(!1))},[x,O,y,X]);return(0,Et.jsxs)("div",{"data-slot":"formula-editor",className:l("space-y-3",m),children:[(0,Et.jsxs)("div",{className:"relative",children:[(0,Et.jsx)(Ta,{ref:u,value:S,onChange:A,onKeyDown:Fe,placeholder:c,disabled:s,"data-testid":"formula-textarea",className:l("min-h-24 font-mono text-sm",z&&"border-destructive"),"aria-invalid":!!z}),x&&O.length>0&&(0,Et.jsx)("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:O.map((J,Ne)=>{let V=Ne===y,Ce="type"in J&&!("args"in J);return(0,Et.jsxs)("button",{type:"button",className:l("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm",V?"bg-accent text-accent-foreground":"hover:bg-accent/50"),"data-testid":`autocomplete-item-${J.name}`,onMouseDown:oa=>{oa.preventDefault(),X(J)},onMouseEnter:()=>k(Ne),children:[Ce?(0,Et.jsx)(sd,{className:"size-3.5 text-muted-foreground"}):(0,Et.jsx)(Jc,{className:"size-3.5 text-muted-foreground"}),(0,Et.jsx)("span",{className:"font-mono",children:J.name}),(0,Et.jsx)("span",{className:"text-muted-foreground",children:J.label})]},J.name)})})]}),z&&(0,Et.jsxs)("div",{"data-testid":"formula-error",className:"flex items-center gap-1.5 text-sm text-destructive",children:[(0,Et.jsx)(Vo,{className:"size-3.5"}),(0,Et.jsx)("span",{children:z})]}),(a.length>0||r.length>0)&&!s&&(0,Et.jsxs)("div",{"data-testid":"insertion-toolbar",className:"space-y-2",children:[a.length>0&&(0,Et.jsxs)("div",{className:"space-y-1",children:[(0,Et.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Variables"}),(0,Et.jsx)("div",{className:"flex flex-wrap gap-1",children:a.map(J=>(0,Et.jsxs)(L,{variant:"outline",className:"cursor-pointer hover:bg-accent","data-testid":`var-badge-${J.name}`,onClick:()=>E(J.name),role:"button",tabIndex:0,children:[(0,Et.jsx)(sd,{className:"mr-1 size-3"}),J.label]},J.name))})]}),a.length>0&&r.length>0&&(0,Et.jsx)(dt,{}),r.length>0&&(0,Et.jsxs)("div",{className:"space-y-1",children:[(0,Et.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Functions"}),(0,Et.jsx)("div",{className:"flex flex-wrap gap-1",children:r.map(J=>(0,Et.jsxs)(L,{variant:"outline",className:"cursor-pointer hover:bg-accent","data-testid":`fn-badge-${J.name}`,onClick:()=>_(J),role:"button",tabIndex:0,children:[(0,Et.jsx)(Jc,{className:"mr-1 size-3"}),J.label]},J.name))})]})]}),n&&S.trim()&&(0,Et.jsx)(re,{"data-testid":"preview-panel",className:"bg-muted/30",children:(0,Et.jsxs)(oe,{className:"space-y-2 pt-4",children:[B&&(0,Et.jsxs)("div",{className:"space-y-1",children:[(0,Et.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Formula"}),(0,Et.jsx)("div",{"data-testid":"preview-formula",className:"rounded bg-background px-2 py-1 font-mono text-sm",children:B})]}),(0,Et.jsxs)("div",{className:"space-y-1",children:[(0,Et.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Result"}),(0,Et.jsx)("div",{"data-testid":"preview-result",className:l("rounded bg-background px-2 py-1 font-mono text-sm font-semibold",U===null&&"text-muted-foreground"),children:U!==null?String(U):"Cannot evaluate"})]})]})})]})}var Ql=require("react/jsx-runtime");function _S({label:e,subtitle:t,opened:a,onOpen:r,className:o}){return(0,Ql.jsxs)("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:[(0,Ql.jsx)("div",{className:"border-destructive-foreground flex h-16 w-16 items-center justify-center rounded-full border-2",children:(0,Ql.jsx)("span",{className:"text-2xl",children:"\u{1F9E7}"})}),(0,Ql.jsx)("span",{className:"text-lg font-bold",children:e}),t&&(0,Ql.jsx)("span",{className:"text-xs opacity-80",children:t}),!a&&r&&(0,Ql.jsx)(C,{variant:"secondary",size:"sm",onClick:r,className:"bg-destructive-foreground text-destructive hover:bg-destructive-foreground/90 mt-1",children:"Open"})]})}var Wm=M(require("react"),1);var j=require("react/jsx-runtime"),qS=[{type:"table",label:"Table",icon:(0,j.jsx)(Nu,{}),defaultW:6,defaultH:4,defaultConfig:{columnCount:5}},{type:"chart",label:"Chart",icon:(0,j.jsx)(td,{}),defaultW:6,defaultH:4,defaultConfig:{chartType:"bar"}},{type:"kpi",label:"KPI",icon:(0,j.jsx)(nd,{}),defaultW:3,defaultH:2,defaultConfig:{value:"0",unit:""}},{type:"text",label:"Text",icon:(0,j.jsx)(Pa,{}),defaultW:4,defaultH:2,defaultConfig:{text:""}},{type:"image",label:"Image",icon:(0,j.jsx)(Wr,{}),defaultW:4,defaultH:3,defaultConfig:{src:""}}],Uf=20;function GS(){return`w_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function jS(e,t,a){return e.length===0?{x:0,y:0}:{x:0,y:Math.max(...e.map(o=>o.y+o.h))}}function KS({widgets:e,onChange:t,definitions:a=qS,onSave:r,onPreview:o,renderPropertyEditor:n,columns:i=12,canvasHeight:c=600,readOnly:s=!1,className:d}){let[m,u]=Wm.useState([]),p=e??m,[f,x]=Wm.useState(null),[v,N]=Wm.useState([]),[h,b]=Wm.useState([]),g=p.find(I=>I.id===f)??null;function y(I){N(E=>[...E.slice(-(Uf-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 E=jS(p,I.defaultW,i),_={id:GS(),type:I.type,title:I.label,x:E.x,y:E.y,w:I.defaultW,h:I.defaultH,config:{...I.defaultConfig??{}}};y([...p,_]),x(_.id)}function R(I){s||(y(p.filter(E=>E.id!==I)),f===I&&x(null))}function S(I,E){let _=p.map(X=>X.id===I?{...X,...E}:X);k(_)}function A(I,E){let _=p.map(X=>X.id===I?{...X,config:{...X.config,...E}}:X);k(_)}function z(){if(v.length===0)return;let I=v[v.length-1];N(E=>E.slice(0,-1)),b(E=>[...E.slice(-(Uf-1)),p]),k(I)}function U(){if(h.length===0)return;let I=h[h.length-1];b(E=>E.slice(0,-1)),N(E=>[...E.slice(-(Uf-1)),p]),k(I)}let B=100/i,O=60;return(0,j.jsxs)("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:[(0,j.jsxs)("div",{"data-slot":"report-builder-toolbar",className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[!s&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(C,{size:"sm",variant:"outline",disabled:v.length===0,onClick:z,"data-testid":"undo-button",children:[(0,j.jsx)(lc,{})," Undo"]}),(0,j.jsxs)(C,{size:"sm",variant:"outline",disabled:h.length===0,onClick:U,"data-testid":"redo-button",children:[(0,j.jsx)(dc,{})," Redo"]}),(0,j.jsx)(dt,{orientation:"vertical",className:"mx-1 h-5"})]}),(0,j.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[o&&(0,j.jsxs)(C,{size:"sm",variant:"outline",onClick:()=>o(p),"data-testid":"preview-button",children:[(0,j.jsx)(Cs,{})," Preview"]}),r&&!s&&(0,j.jsxs)(C,{size:"sm",onClick:()=>r(p),"data-testid":"save-button",children:[(0,j.jsx)(xl,{})," Save"]})]})]}),(0,j.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[!s&&(0,j.jsxs)("div",{"data-slot":"report-builder-palette",className:"w-52 shrink-0 border-r border-border",children:[(0,j.jsx)("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Widgets"}),(0,j.jsx)(Qa,{className:"h-[calc(100%-2rem)]",children:(0,j.jsx)("div",{className:"flex flex-col gap-1.5 p-2",children:a.map(I=>(0,j.jsxs)("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:[(0,j.jsx)("span",{className:"text-muted-foreground [&_svg]:size-4",children:I.icon}),(0,j.jsx)("span",{children:I.label}),(0,j.jsx)(Re,{className:"ml-auto size-3.5 text-muted-foreground"})]},I.type))})})]}),(0,j.jsx)("div",{"data-slot":"report-builder-canvas",className:"flex-1 overflow-auto",children:(0,j.jsx)("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:`${B}% ${O}px`},onClick:I=>{I.target===I.currentTarget&&x(null)},children:p.map(I=>{let E=I.id===f;return(0,j.jsx)("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",E?"ring-2 ring-primary border-primary z-10":"border-border hover:border-primary/40"),style:{left:`${I.x*B}%`,top:I.y*O,width:`${I.w*B}%`,height:I.h*O},onClick:_=>{_.stopPropagation(),x(I.id)},children:(0,j.jsxs)(re,{className:"h-full border-0 ring-0",children:[(0,j.jsxs)(he,{className:"flex-row items-center gap-1 py-1.5 px-2",children:[(0,j.jsx)(Ws,{className:"size-3.5 text-muted-foreground shrink-0 cursor-grab"}),(0,j.jsx)(ve,{className:"text-xs truncate flex-1",children:I.title}),(0,j.jsx)(L,{variant:"outline",className:"text-[10px] px-1 shrink-0",children:I.type}),!s&&(0,j.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:_=>{_.stopPropagation(),R(I.id)},"data-testid":`delete-widget-${I.id}`,className:"shrink-0",children:(0,j.jsx)(Le,{className:"size-3"})})]}),(0,j.jsxs)(oe,{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs px-2 pb-2",children:[I.type==="kpi"&&(0,j.jsxs)("div",{className:"text-center",children:[(0,j.jsx)("div",{className:"text-2xl font-bold text-foreground",children:String(I.config.value??"0")}),(0,j.jsx)("div",{className:"text-[10px]",children:String(I.config.unit??"")})]}),I.type==="text"&&(0,j.jsx)("p",{className:"text-left w-full truncate",children:String(I.config.text??"Text content")}),I.type==="table"&&(0,j.jsx)("div",{className:"w-full space-y-1",children:Array.from({length:3}).map((_,X)=>(0,j.jsx)("div",{className:"h-2 rounded bg-muted"},X))}),I.type==="chart"&&(0,j.jsx)("div",{className:"flex items-end gap-1 h-10",children:[60,80,45,90,70].map((_,X)=>(0,j.jsx)("div",{className:"w-3 rounded-t bg-primary/40",style:{height:`${_}%`}},X))}),I.type==="image"&&(0,j.jsx)(Wr,{className:"size-8 text-muted-foreground/40"})]})]})},I.id)})})}),g&&!s&&(0,j.jsxs)("div",{"data-slot":"report-builder-properties",className:"w-64 shrink-0 border-l border-border overflow-y-auto",children:[(0,j.jsxs)("div",{className:"px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider flex items-center",children:["Properties",(0,j.jsx)(C,{variant:"ghost",size:"icon-xs",className:"ml-auto",onClick:()=>x(null),"data-testid":"close-properties",children:(0,j.jsx)(Le,{className:"size-3"})})]}),(0,j.jsx)(dt,{}),(0,j.jsxs)("div",{className:"space-y-3 p-3",children:[(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-title",children:"Title"}),(0,j.jsx)(T,{id:"rb-title","data-testid":"property-title",value:g.title,onChange:I=>S(g.id,{title:I.target.value})})]}),(0,j.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-x",children:"X"}),(0,j.jsx)(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))})})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-y",children:"Y"}),(0,j.jsx)(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))})})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-w",children:"W"}),(0,j.jsx)(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)))})})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-h",children:"H"}),(0,j.jsx)(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))})})]})]}),(0,j.jsx)(dt,{}),g.type==="table"&&(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-colcount",children:"Column Count"}),(0,j.jsx)(T,{id:"rb-colcount",type:"number","data-testid":"property-column-count",min:1,value:Number(g.config.columnCount??5),onChange:I=>A(g.id,{columnCount:Number(I.target.value)})})]}),g.type==="chart"&&(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-charttype",children:"Chart Type"}),(0,j.jsxs)("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=>A(g.id,{chartType:I.target.value}),children:[(0,j.jsx)("option",{value:"bar",children:"Bar"}),(0,j.jsx)("option",{value:"line",children:"Line"}),(0,j.jsx)("option",{value:"pie",children:"Pie"}),(0,j.jsx)("option",{value:"area",children:"Area"})]})]}),g.type==="text"&&(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-text",children:"Text"}),(0,j.jsx)(T,{id:"rb-text","data-testid":"property-text",value:String(g.config.text??""),onChange:I=>A(g.id,{text:I.target.value})})]}),g.type==="kpi"&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-kpi-value",children:"Value"}),(0,j.jsx)(T,{id:"rb-kpi-value","data-testid":"property-kpi-value",value:String(g.config.value??""),onChange:I=>A(g.id,{value:I.target.value})})]}),(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-kpi-unit",children:"Unit"}),(0,j.jsx)(T,{id:"rb-kpi-unit","data-testid":"property-kpi-unit",value:String(g.config.unit??""),onChange:I=>A(g.id,{unit:I.target.value})})]})]}),g.type==="image"&&(0,j.jsxs)("div",{children:[(0,j.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"rb-img-src",children:"Image URL"}),(0,j.jsx)(T,{id:"rb-img-src","data-testid":"property-image-src",value:String(g.config.src??""),onChange:I=>A(g.id,{src:I.target.value})})]}),n&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(dt,{}),n(g,I=>A(g.id,I))]})]})]})]})]})}var Xd=M(require("react"),1);var $=require("react/jsx-runtime"),QS=["kpi","chart-line","chart-bar","chart-pie","chart-donut","table","text","filter"],Wf={kpi:{label:"KPI",icon:(0,$.jsx)(nd,{}),defaultW:3,defaultH:2,defaultConfig:{value:"0",unit:""}},"chart-line":{label:"Line Chart",icon:(0,$.jsx)(td,{}),defaultW:6,defaultH:4,defaultConfig:{chartType:"line"}},"chart-bar":{label:"Bar Chart",icon:(0,$.jsx)(td,{}),defaultW:6,defaultH:4,defaultConfig:{chartType:"bar"}},"chart-pie":{label:"Pie Chart",icon:(0,$.jsx)(td,{}),defaultW:4,defaultH:4,defaultConfig:{chartType:"pie"}},"chart-donut":{label:"Donut Chart",icon:(0,$.jsx)(td,{}),defaultW:4,defaultH:4,defaultConfig:{chartType:"donut"}},table:{label:"Table",icon:(0,$.jsx)(Nu,{}),defaultW:6,defaultH:4,defaultConfig:{columnCount:5}},text:{label:"Text",icon:(0,$.jsx)(Pa,{}),defaultW:4,defaultH:2,defaultConfig:{text:""}},filter:{label:"Filter",icon:(0,$.jsx)(Ai,{}),defaultW:3,defaultH:1,defaultConfig:{filterType:"select"}}},_f=20;function XS(){return`dw_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function YS(e,t,a){return e.length===0?{x:0,y:0}:{x:0,y:Math.max(...e.map(o=>o.y+o.h))}}function JS({config:e,onChange:t,onSave:a,onPreview:r,availableWidgets:o=QS,renderWidget:n,columns:i=12,readOnly:c=!1,className:s}){let d={widgets:[],filters:[]},[m,u]=Xd.useState(d),p=e??m,f=p.widgets,[x,v]=Xd.useState(null),[N,h]=Xd.useState(!1),[b,g]=Xd.useState([]),[y,k]=Xd.useState([]),[w,R]=Xd.useState(!1),S=f.find(V=>V.id===x)??null;function A(V){g(Ce=>[...Ce.slice(-(_f-1)),p]),k([]),t?.(V),e===void 0&&u(V)}function z(V){t?.(V),e===void 0&&u(V)}function U(V){let Ce=Wf[V];if(!Ce)return;let oa=YS(f,Ce.defaultW,i),sa={id:XS(),type:V,title:Ce.label,x:oa.x,y:oa.y,w:Ce.defaultW,h:Ce.defaultH,config:{...Ce.defaultConfig}},Ho={...p,widgets:[...f,sa]};A(Ho),v(sa.id)}function B(V){let Ce={...p,widgets:f.filter(oa=>oa.id!==V)};A(Ce),x===V&&(v(null),h(!1))}function O(V,Ce){let oa={...p,widgets:f.map(sa=>sa.id===V?{...sa,...Ce}:sa)};z(oa)}function I(V,Ce){let oa={...p,widgets:f.map(sa=>sa.id===V?{...sa,config:{...sa.config,...Ce}}:sa)};z(oa)}function E(){if(b.length===0)return;let V=b[b.length-1];g(Ce=>Ce.slice(0,-1)),k(Ce=>[...Ce.slice(-(_f-1)),p]),z(V)}function _(){if(y.length===0)return;let V=y[y.length-1];k(Ce=>Ce.slice(0,-1)),g(Ce=>[...Ce.slice(-(_f-1)),p]),z(V)}function X(V){v(V),c||h(!0)}let Fe=100/i,J=60,Ne=!c&&!w;return w?(0,$.jsxs)("div",{"data-slot":"dashboard-designer","data-preview":"true",className:l("flex flex-col border border-border bg-background rounded-lg overflow-hidden",s),children:[(0,$.jsxs)("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[(0,$.jsx)("span",{className:"text-sm font-medium",children:"Preview"}),(0,$.jsx)(C,{size:"sm",variant:"outline",className:"ml-auto",onClick:()=>R(!1),"data-testid":"exit-preview-button",children:"Exit Preview"})]}),(0,$.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,$.jsx)("div",{className:"relative",style:{minHeight:400},children:f.map(V=>(0,$.jsx)("div",{"data-slot":"dashboard-designer-widget","data-widget-id":V.id,"data-widget-type":V.type,className:"absolute rounded-lg border border-border bg-card",style:{left:`${V.x*Fe}%`,top:V.y*J,width:`${V.w*Fe}%`,height:V.h*J},children:(0,$.jsxs)(re,{className:"h-full border-0 ring-0",children:[(0,$.jsx)(he,{className:"py-1.5 px-2",children:(0,$.jsx)(ve,{className:"text-xs",children:V.title})}),(0,$.jsx)(oe,{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs px-2 pb-2",children:n?n(V):(0,$.jsx)("span",{children:V.type})})]})},V.id))})})]}):(0,$.jsxs)("div",{"data-slot":"dashboard-designer",className:l("flex flex-col border border-border bg-background rounded-lg overflow-hidden",s),children:[(0,$.jsxs)("div",{"data-slot":"dashboard-designer-toolbar",className:"flex items-center gap-2 border-b border-border px-3 py-2",children:[Ne&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(C,{size:"sm",variant:"outline",disabled:b.length===0,onClick:E,"data-testid":"undo-button",children:[(0,$.jsx)(lc,{})," Undo"]}),(0,$.jsxs)(C,{size:"sm",variant:"outline",disabled:y.length===0,onClick:_,"data-testid":"redo-button",children:[(0,$.jsx)(dc,{})," Redo"]}),(0,$.jsx)(dt,{orientation:"vertical",className:"mx-1 h-5"}),(0,$.jsxs)(Co,{children:[(0,$.jsxs)(ko,{render:(0,$.jsx)(C,{size:"sm",variant:"outline","data-testid":"add-widget-button"}),children:[(0,$.jsx)(Re,{})," Add Widget ",(0,$.jsx)(fe,{className:"size-3.5"})]}),(0,$.jsx)(wo,{children:o.map(V=>{let Ce=Wf[V];return Ce?(0,$.jsxs)(Er,{"data-testid":`catalog-${V}`,onClick:()=>U(V),children:[(0,$.jsx)("span",{className:"mr-2 [&_svg]:size-4",children:Ce.icon}),Ce.label]},V):null})})]})]}),(0,$.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[r&&(0,$.jsxs)(C,{size:"sm",variant:"outline",onClick:()=>{R(!0),r(p)},"data-testid":"preview-button",children:[(0,$.jsx)(Cs,{})," Preview"]}),a&&!c&&(0,$.jsxs)(C,{size:"sm",onClick:()=>a(p),"data-testid":"save-button",children:[(0,$.jsx)(xl,{})," Save"]})]})]}),(0,$.jsx)("div",{"data-slot":"dashboard-designer-canvas",className:"flex-1 overflow-auto p-4",children:(0,$.jsxs)("div",{className:"relative",style:{minHeight:500,backgroundImage:Ne?"linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px), linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px)":void 0,backgroundSize:`${Fe}% ${J}px`},onClick:V=>{V.target===V.currentTarget&&(v(null),h(!1))},children:[f.length===0&&(0,$.jsx)("div",{className:"flex items-center justify-center h-[400px] text-muted-foreground text-sm",children:Ne?'Click "Add Widget" to get started':"No widgets configured"}),f.map(V=>{let Ce=V.id===x,oa=Wf[V.type];return(0,$.jsx)("div",{"data-slot":"dashboard-designer-widget","data-widget-id":V.id,"data-widget-type":V.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:`${V.x*Fe}%`,top:V.y*J,width:`${V.w*Fe}%`,height:V.h*J},onClick:sa=>{sa.stopPropagation(),X(V.id)},children:(0,$.jsxs)(re,{className:"h-full border-0 ring-0",children:[(0,$.jsxs)(he,{className:"flex-row items-center gap-1 py-1.5 px-2",children:[Ne&&(0,$.jsx)(Ws,{className:"size-3.5 text-muted-foreground shrink-0 cursor-grab"}),(0,$.jsx)(ve,{className:"text-xs truncate flex-1",children:V.title}),(0,$.jsx)(L,{variant:"outline",className:"text-[10px] px-1 shrink-0",children:oa?.label??V.type}),Ne&&(0,$.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:sa=>{sa.stopPropagation(),B(V.id)},"data-testid":`delete-widget-${V.id}`,className:"shrink-0",children:(0,$.jsx)(Le,{className:"size-3"})})]}),(0,$.jsx)(oe,{className:"flex-1 flex items-center justify-center text-muted-foreground text-xs px-2 pb-2",children:n?n(V):(0,$.jsx)(ZS,{type:V.type,config:V.config})})]})},V.id)})]})}),Ne&&(0,$.jsx)(ld,{open:N,onOpenChange:h,children:(0,$.jsxs)(dd,{side:"right",className:"w-80 p-0",children:[(0,$.jsx)(cd,{className:"border-b border-border",children:(0,$.jsx)(md,{children:"Widget Properties"})}),S&&(0,$.jsx)(Qa,{className:"flex-1",children:(0,$.jsxs)("div",{className:"space-y-3 p-4",children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-title",children:"Title"}),(0,$.jsx)(T,{id:"dd-title","data-testid":"property-title",value:S.title,onChange:V=>O(S.id,{title:V.target.value})})]}),(0,$.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-x",children:"X"}),(0,$.jsx)(T,{id:"dd-x",type:"number","data-testid":"property-x",min:0,max:i-S.w,value:S.x,onChange:V=>O(S.id,{x:Math.max(0,Number(V.target.value))})})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-y",children:"Y"}),(0,$.jsx)(T,{id:"dd-y",type:"number","data-testid":"property-y",min:0,value:S.y,onChange:V=>O(S.id,{y:Math.max(0,Number(V.target.value))})})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-w",children:"W"}),(0,$.jsx)(T,{id:"dd-w",type:"number","data-testid":"property-w",min:1,max:i,value:S.w,onChange:V=>O(S.id,{w:Math.min(i,Math.max(1,Number(V.target.value)))})})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-h",children:"H"}),(0,$.jsx)(T,{id:"dd-h",type:"number","data-testid":"property-h",min:1,value:S.h,onChange:V=>O(S.id,{h:Math.max(1,Number(V.target.value))})})]})]}),(0,$.jsx)(dt,{}),(S.type==="chart-line"||S.type==="chart-bar"||S.type==="chart-pie"||S.type==="chart-donut")&&(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-charttype",children:"Chart Type"}),(0,$.jsxs)("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:V=>I(S.id,{chartType:V.target.value}),children:[(0,$.jsx)("option",{value:"line",children:"Line"}),(0,$.jsx)("option",{value:"bar",children:"Bar"}),(0,$.jsx)("option",{value:"pie",children:"Pie"}),(0,$.jsx)("option",{value:"donut",children:"Donut"}),(0,$.jsx)("option",{value:"area",children:"Area"})]})]}),S.type==="kpi"&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-kpi-value",children:"Value"}),(0,$.jsx)(T,{id:"dd-kpi-value","data-testid":"property-kpi-value",value:String(S.config.value??""),onChange:V=>I(S.id,{value:V.target.value})})]}),(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-kpi-unit",children:"Unit"}),(0,$.jsx)(T,{id:"dd-kpi-unit","data-testid":"property-kpi-unit",value:String(S.config.unit??""),onChange:V=>I(S.id,{unit:V.target.value})})]})]}),S.type==="table"&&(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-colcount",children:"Column Count"}),(0,$.jsx)(T,{id:"dd-colcount",type:"number","data-testid":"property-column-count",min:1,value:Number(S.config.columnCount??5),onChange:V=>I(S.id,{columnCount:Number(V.target.value)})})]}),S.type==="text"&&(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-text",children:"Text"}),(0,$.jsx)(T,{id:"dd-text","data-testid":"property-text",value:String(S.config.text??""),onChange:V=>I(S.id,{text:V.target.value})})]}),S.type==="filter"&&(0,$.jsxs)("div",{children:[(0,$.jsx)("label",{className:"text-xs text-muted-foreground",htmlFor:"dd-filter-type",children:"Filter Type"}),(0,$.jsxs)("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:V=>I(S.id,{filterType:V.target.value}),children:[(0,$.jsx)("option",{value:"date-range",children:"Date Range"}),(0,$.jsx)("option",{value:"select",children:"Select"}),(0,$.jsx)("option",{value:"search",children:"Search"})]})]})]})})]})})]})}function ZS({type:e,config:t}){return e==="kpi"?(0,$.jsxs)("div",{className:"text-center",children:[(0,$.jsx)("div",{className:"text-2xl font-bold text-foreground",children:String(t.value??"0")}),(0,$.jsx)("div",{className:"text-[10px]",children:String(t.unit??"")})]}):e==="text"?(0,$.jsx)("p",{className:"text-left w-full truncate",children:String(t.text??"Text content")}):e==="table"?(0,$.jsx)("div",{className:"w-full space-y-1",children:Array.from({length:3}).map((a,r)=>(0,$.jsx)("div",{className:"h-2 rounded bg-muted"},r))}):e.startsWith("chart-")?(0,$.jsx)("div",{className:"flex items-end gap-1 h-10",children:[60,80,45,90,70].map((a,r)=>(0,$.jsx)("div",{className:"w-3 rounded-t bg-primary/40",style:{height:`${a}%`}},r))}):e==="filter"?(0,$.jsxs)("div",{className:"flex items-center gap-1 text-[10px]",children:[(0,$.jsx)(Ai,{className:"size-3"}),(0,$.jsx)("span",{children:String(t.filterType??"Filter")})]}):(0,$.jsx)("span",{className:"text-muted-foreground",children:e})}var Ur=M(require("react"),1);var q=require("react/jsx-runtime"),S0={party:"Party Info",financial:"Financial",date:"Dates",terms:"Terms",custom:"Custom"},_m={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"}},e2=[{label:"Sales",value:"sales"},{label:"Purchase",value:"purchase"},{label:"Service",value:"service"},{label:"Lease",value:"lease"},{label:"Other",value:"other"}],t2=[{label:"Draft",value:"draft"},{label:"Under Review",value:"review"},{label:"Signed",value:"signed"},{label:"Expired",value:"expired"},{label:"Cancelled",value:"cancelled"}],a2=/\{\{(\w+)\}\}/g;function r2(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 o2(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(a2.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((0,q.jsx)("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 n2({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]=Ur.useState(e??""),[f,x]=Ur.useState(r??{}),[v,N]=Ur.useState(s??"edit"),[h,b]=Ur.useState(!0),g=Ur.useRef(null);Ur.useEffect(()=>{e!==void 0&&p(e)},[e]),Ur.useEffect(()=>{r!==void 0&&x(r)},[r]),Ur.useEffect(()=>{s!==void 0&&N(s)},[s]);let y=e??u,k=r??f,w=s??v,R=Ur.useCallback(E=>{p(E),t?.(E)},[t]),S=Ur.useCallback(E=>{let _={...k,...E};x(_),o?.(_)},[k,o]),A=Ur.useCallback(E=>{let _=String(E);N(_),d?.(_)},[d]),z=Ur.useCallback(E=>{if(c)return;let _=g.current,X=`{{${E}}}`;if(_){let Fe=_.selectionStart??y.length,J=_.selectionEnd??Fe,Ne=y.slice(0,Fe),V=y.slice(J),Ce=Ne+X+V;R(Ce),requestAnimationFrame(()=>{_.focus();let oa=Fe+X.length;_.setSelectionRange(oa,oa)})}else R(y+X)},[c,y,R]),U=Ur.useCallback(E=>{if(c)return;let _=g.current;if(!_)return;let X=_.selectionStart??0,Fe=_.selectionEnd??0,J=y.slice(X,Fe),Ne=`${E}${J}${E}`,V=y.slice(0,X)+Ne+y.slice(Fe);R(V),requestAnimationFrame(()=>{_.focus();let Ce=X+E.length+J.length+E.length;_.setSelectionRange(Ce,Ce)})},[c,y,R]),B=Ur.useCallback(()=>{i?.({template:y,metadata:k})},[i,y,k]),O=Ur.useMemo(()=>r2(a),[a]),I=k.status?_m[k.status]:null;return(0,q.jsxs)("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:[(0,q.jsxs)("div",{className:"flex items-center justify-between",children:[(0,q.jsxs)("div",{className:"flex items-center gap-3",children:[(0,q.jsx)(Pa,{className:"text-muted-foreground size-5"}),(0,q.jsx)(ve,{className:"text-base",children:"Contract Template"}),I&&(0,q.jsx)(L,{variant:"secondary",className:l("text-xs",I.className),"data-slot":"contract-template-status",children:I.label}),k.contractNo&&(0,q.jsx)("span",{className:"text-muted-foreground font-mono text-xs",children:k.contractNo})]}),(0,q.jsxs)("div",{className:"flex items-center gap-2",children:[(0,q.jsxs)(C,{variant:"outline",size:"sm",onClick:()=>A("preview"),"aria-label":"Preview contract",children:[(0,q.jsx)(Cs,{className:"size-4"}),"Preview"]}),!c&&(0,q.jsxs)(C,{variant:"default",size:"sm",onClick:B,"aria-label":"Save contract",children:[(0,q.jsx)(xl,{className:"size-4"}),"Save"]})]})]}),(0,q.jsx)(dt,{}),(0,q.jsxs)(_o,{value:w,onValueChange:A,"data-slot":"contract-template-tabs",children:[(0,q.jsxs)(qo,{children:[(0,q.jsxs)(Xr,{value:"edit",disabled:c,children:[(0,q.jsx)(gl,{className:"size-3.5"}),"Edit"]}),(0,q.jsxs)(Xr,{value:"preview",children:[(0,q.jsx)(Cs,{className:"size-3.5"}),"Preview"]}),(0,q.jsxs)(Xr,{value:"metadata",children:[(0,q.jsx)(nc,{className:"size-3.5"}),"Metadata"]})]}),(0,q.jsx)(An,{value:"edit",className:"mt-3",children:(0,q.jsxs)("div",{className:"flex gap-3",children:[(0,q.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[(0,q.jsxs)("div",{className:"flex items-center gap-1 rounded-md border bg-muted/50 px-2 py-1",role:"toolbar","aria-label":"Text formatting",children:[(0,q.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>U("**"),"aria-label":"Bold",type:"button",children:(0,q.jsx)(sc,{className:"size-4"})}),(0,q.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>U("*"),"aria-label":"Italic",type:"button",children:(0,q.jsx)(ic,{className:"size-4"})}),(0,q.jsx)(dt,{orientation:"vertical",className:"mx-1 h-4"}),(0,q.jsxs)("span",{className:"text-muted-foreground text-xs",children:["Use ","{{fieldName}}"," for merge fields"]})]}),(0,q.jsx)(Ta,{ref:g,value:y,onChange:E=>R(E.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"})]}),(0,q.jsxs)("div",{className:l("flex flex-col border-l pl-3 transition-all",h?"w-56":"w-8"),"data-slot":"contract-template-sidebar",children:[(0,q.jsx)(C,{variant:"ghost",size:"icon-xs",onClick:()=>b(!h),"aria-label":h?"Collapse sidebar":"Expand sidebar",className:"self-end",type:"button",children:h?(0,q.jsx)(ke,{className:"size-4"}):(0,q.jsx)($t,{className:"size-4"})}),h&&(0,q.jsx)(Qa,{className:"max-h-[450px]",children:(0,q.jsxs)("div",{className:"flex flex-col gap-3 pr-2",children:[(0,q.jsx)("span",{className:"text-muted-foreground text-xs font-semibold",children:"Merge Fields"}),Array.from(O.entries()).map(([E,_])=>(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsx)("span",{className:"text-muted-foreground/80 text-xs font-medium",children:S0[E]??E}),(0,q.jsx)("div",{className:"flex flex-wrap gap-1",children:_.map(X=>(0,q.jsxs)("button",{type:"button",onClick:()=>z(X.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:X.description??X.label,"aria-label":`Insert ${X.label} field`,"data-slot":"contract-template-field-chip","data-field-name":X.name,children:[(0,q.jsx)(Re,{className:"size-3"}),X.label]},X.name))})]},E)),a.length===0&&(0,q.jsx)("span",{className:"text-muted-foreground text-xs",children:"No fields available"})]})})]})]})}),(0,q.jsx)(An,{value:"preview",className:"mt-3",children:(0,q.jsxs)(re,{children:[(0,q.jsxs)(he,{children:[(0,q.jsxs)("div",{className:"flex items-center justify-between",children:[(0,q.jsx)(ve,{className:"text-sm",children:"Document Preview"}),k.contractNo&&(0,q.jsx)("span",{className:"text-muted-foreground font-mono text-xs",children:k.contractNo})]}),k.partyA&&k.partyB&&(0,q.jsxs)("div",{className:"text-muted-foreground flex gap-4 text-xs",children:[(0,q.jsxs)("span",{className:"flex items-center gap-1",children:[(0,q.jsx)(ig,{className:"size-3"}),k.partyA]}),(0,q.jsx)("span",{children:"&"}),(0,q.jsxs)("span",{className:"flex items-center gap-1",children:[(0,q.jsx)(ig,{className:"size-3"}),k.partyB]})]})]}),(0,q.jsx)(dt,{}),(0,q.jsx)(oe,{className:"pt-4",children:y?(0,q.jsx)("div",{className:"whitespace-pre-wrap text-sm leading-relaxed","data-slot":"contract-template-preview-content",children:o2(y,n,a)}):(0,q.jsx)("p",{className:"text-muted-foreground text-sm italic",children:"No template content to preview."})})]})}),(0,q.jsx)(An,{value:"metadata",className:"mt-3",children:(0,q.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2","data-slot":"contract-template-metadata",children:[(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsx)("label",{htmlFor:"ct-contract-no",className:"text-muted-foreground text-xs font-medium",children:"Contract No"}),(0,q.jsx)(T,{id:"ct-contract-no",value:k.contractNo??"",onChange:E=>S({contractNo:E.target.value}),placeholder:"e.g. C-2025-001",disabled:c,"data-slot":"contract-template-field-contractNo"})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsx)("label",{htmlFor:"ct-contract-type",className:"text-muted-foreground text-xs font-medium",children:"Contract Type"}),(0,q.jsxs)(Ge,{value:k.contractType??"",onValueChange:E=>S({contractType:E??""}),disabled:c,children:[(0,q.jsx)(Ke,{className:"w-full",id:"ct-contract-type","data-slot":"contract-template-field-contractType",children:(0,q.jsx)(je,{placeholder:"Select type..."})}),(0,q.jsx)(Qe,{children:e2.map(E=>(0,q.jsx)(De,{value:E.value,children:E.label},E.value))})]})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsxs)("label",{htmlFor:"ct-effective-date",className:"text-muted-foreground text-xs font-medium",children:[(0,q.jsx)(mn,{className:"mr-1 inline size-3"}),"Effective Date"]}),(0,q.jsx)(T,{id:"ct-effective-date",type:"date",value:k.effectiveDate??"",onChange:E=>S({effectiveDate:E.target.value}),disabled:c,"data-slot":"contract-template-field-effectiveDate"})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsxs)("label",{htmlFor:"ct-expiry-date",className:"text-muted-foreground text-xs font-medium",children:[(0,q.jsx)(mn,{className:"mr-1 inline size-3"}),"Expiry Date"]}),(0,q.jsx)(T,{id:"ct-expiry-date",type:"date",value:k.expiryDate??"",onChange:E=>S({expiryDate:E.target.value}),disabled:c,"data-slot":"contract-template-field-expiryDate"})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsxs)("label",{htmlFor:"ct-party-a",className:"text-muted-foreground text-xs font-medium",children:[(0,q.jsx)(Ei,{className:"mr-1 inline size-3"}),"Party A"]}),(0,q.jsx)(T,{id:"ct-party-a",value:k.partyA??"",onChange:E=>S({partyA:E.target.value}),placeholder:"Company or individual name",disabled:c,"data-slot":"contract-template-field-partyA"})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsxs)("label",{htmlFor:"ct-party-b",className:"text-muted-foreground text-xs font-medium",children:[(0,q.jsx)(Ei,{className:"mr-1 inline size-3"}),"Party B"]}),(0,q.jsx)(T,{id:"ct-party-b",value:k.partyB??"",onChange:E=>S({partyB:E.target.value}),placeholder:"Company or individual name",disabled:c,"data-slot":"contract-template-field-partyB"})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsxs)("label",{htmlFor:"ct-amount",className:"text-muted-foreground text-xs font-medium",children:[(0,q.jsx)(lu,{className:"mr-1 inline size-3"}),"Amount"]}),(0,q.jsx)(T,{id:"ct-amount",type:"number",value:k.amount??"",onChange:E=>S({...E.target.value?{amount:Number(E.target.value)}:{}}),placeholder:"0.00",disabled:c,"data-slot":"contract-template-field-amount"})]}),(0,q.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,q.jsx)("label",{htmlFor:"ct-status",className:"text-muted-foreground text-xs font-medium",children:"Status"}),(0,q.jsxs)("div",{className:"flex items-center gap-2",children:[(0,q.jsxs)(Ge,{value:k.status??"",onValueChange:E=>{E&&S({status:E})},disabled:c,children:[(0,q.jsx)(Ke,{className:"w-full",id:"ct-status","data-slot":"contract-template-field-status",children:(0,q.jsx)(je,{placeholder:"Select status..."})}),(0,q.jsx)(Qe,{children:t2.map(E=>(0,q.jsx)(De,{value:E.value,children:E.label},E.value))})]}),k.status&&_m[k.status]&&(0,q.jsx)(L,{variant:"secondary",className:l("text-xs",_m[k.status].className),"data-slot":"contract-template-status-badge",children:_m[k.status].label})]})]})]})})]})]})}var Kr=M(require("react"),1),I0=require("react-i18next");var xe=require("react/jsx-runtime");function s2({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}=(0,I0.useTranslation)("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]=Kr.useState(""),[S,A]=Kr.useState(1),[z]=Kr.useState(f),[U,B]=Kr.useState([]),[O,I]=Kr.useState(0),[E,_]=Kr.useState(!1),X=Kr.useRef(new Map),[,Fe]=Kr.useState(0),J=()=>Fe(ie=>ie+1),[Ne,V]=Kr.useState([]),[Ce,oa]=Kr.useState(void 0),[sa,Ho]=Kr.useState(new Set(s?.defaultExpandedKeys??[])),se=o!==void 0;Kr.useEffect(()=>{if(se&&o){let ie=new Map;for(let ja of o)ie.set(String(ja[b]),ja);X.current=ie,J()}},[se,o,b]);let W=Kr.useRef(0);Kr.useEffect(()=>{if(!e)return;W.current+=1;let ie=W.current,ja=setTimeout(()=>{_(!0),a({keyword:w,page:S,pageSize:z,...Ce!==void 0?{categoryId:Ce}:{}}).then(Ka=>{ie===W.current&&(B(Ka.rows),I(Ka.total))}).catch(()=>{ie===W.current&&(B([]),I(0))}).finally(()=>{ie===W.current&&_(!1)})},x);return()=>clearTimeout(ja)},[e,w,S,z,Ce,a,x]),Kr.useEffect(()=>{e&&s&&s.loadTree().then(V).catch(()=>V([]))},[e,s]),Kr.useEffect(()=>{e&&(R(""),A(1),oa(void 0),se||(X.current=new Map,J()))},[e,se]);let de=ie=>{let ja=String(ie[b]),Ka=X.current;if(Ka.has(ja))Ka.delete(ja);else{if(v!=null&&Ka.size>=v)return;Ka.set(ja,ie)}J()},ce=()=>{let ie=X.current,ja=U.every(Ka=>ie.has(String(Ka[b])));for(let Ka of U){let Zl=String(Ka[b]);if(ja)ie.delete(Zl);else{if(v!=null&&ie.size>=v)break;ie.set(Zl,Ka)}}J()},ia=ie=>{X.current.delete(String(ie)),J()},yt=()=>{let ie=Array.from(X.current.values());N!=null&&ie.length<N||(i?.(ie),t(!1))},_t=()=>{t(!1)},ga=ie=>{Ho(ja=>{let Ka=new Set(ja);return Ka.has(ie)?Ka.delete(ie):Ka.add(ie),Ka})},xr=ie=>{oa(ie.id),A(1)},lo=X.current,ll=lo.size,rb=U.length>0&&U.every(ie=>lo.has(String(ie[b]))),pC=U.some(ie=>lo.has(String(ie[b]))),gC=ll>=(N??0)&&(v==null||ll<=v),ob={left:"text-left",center:"text-center",right:"text-right"};return(0,xe.jsx)(Ye,{open:e,onOpenChange:t,children:(0,xe.jsxs)(Je,{"data-slot":"browse-dialog",className:l("sm:max-w-3xl",p),showCloseButton:!0,children:[(0,xe.jsxs)(nt,{children:[(0,xe.jsx)(Ze,{children:g}),(0,xe.jsx)(Dt,{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"})})]}),(0,xe.jsxs)("div",{className:l("flex gap-0",s&&"min-h-[400px]"),children:[s&&(0,xe.jsx)("div",{className:"w-48 shrink-0 border-r pr-2 overflow-y-auto",children:(0,xe.jsxs)("ul",{className:"space-y-0.5 py-1 text-sm",children:[(0,xe.jsx)("li",{children:(0,xe.jsx)("button",{type:"button",onClick:()=>{oa(void 0),A(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"})})}),Ne.map(ie=>(0,xe.jsx)(D0,{node:ie,depth:0,expandedKeys:sa,activeCategoryId:Ce,onToggleExpand:ga,onSelect:xr},String(ie.id)))]})}),(0,xe.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 gap-3 pl-0 pl-3",children:[(0,xe.jsxs)("div",{className:"flex items-center gap-2 border rounded-lg px-2",children:[(0,xe.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,xe.jsx)(T,{value:w,onChange:ie=>{R(ie.target.value),A(1)},placeholder:y,"aria-label":y,className:"h-8 border-0 bg-transparent p-0 shadow-none focus-visible:ring-0"})]}),ll>0&&(0,xe.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,xe.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[h("browseDialog.selected",{defaultValue:`\u5DF2\u9009 ${ll} \u9879`,count:ll}),":"]}),Array.from(lo.values()).map(ie=>{let ja=String(ie[b]),Ka=typeof ie.name=="string"?ie.name:typeof ie.code=="string"?ie.code:ja;return(0,xe.jsxs)(L,{variant:"secondary",className:"gap-1 cursor-default",children:[(0,xe.jsx)("span",{className:"max-w-[120px] truncate",children:Ka}),(0,xe.jsx)("button",{type:"button",onClick:()=>ia(ja),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:(0,xe.jsx)(ee,{className:"size-2.5"})})]},ja)})]}),(0,xe.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,xe.jsxs)(at,{children:[(0,xe.jsx)(rt,{children:(0,xe.jsxs)(K,{children:[(0,xe.jsx)(F,{className:"w-10",children:(0,xe.jsx)("input",{type:"checkbox",checked:rb,ref:ie=>{ie&&(ie.indeterminate=pC&&!rb)},onChange:ce,className:"size-4 rounded-[4px] border-input cursor-pointer","aria-label":h("browseDialog.selectAll",{defaultValue:"\u5168\u9009\u5F53\u524D\u9875"})})}),r.map(ie=>(0,xe.jsx)(F,{className:ob[ie.align||"left"],style:{width:ie.width,minWidth:ie.width},children:ie.title},ie.key))]})}),(0,xe.jsx)(Oe,{children:E?Array.from({length:5}).map((ie,ja)=>(0,xe.jsxs)(K,{children:[(0,xe.jsx)(D,{children:(0,xe.jsx)(la,{className:"h-4 w-4"})}),r.map((Ka,Zl)=>(0,xe.jsx)(D,{children:(0,xe.jsx)(la,{className:"h-4 w-full"})},Zl))]},ja)):U.length===0?(0,xe.jsx)(K,{children:(0,xe.jsx)(D,{colSpan:r.length+1,className:"py-12 text-center text-muted-foreground",children:k})}):U.map((ie,ja)=>{let Ka=String(ie[b]||ja),Zl=lo.has(Ka);return(0,xe.jsxs)(K,{className:l("cursor-pointer hover:bg-muted/50",Zl&&"bg-accent/30"),onClick:()=>de(ie),children:[(0,xe.jsx)(D,{onClick:dl=>dl.stopPropagation(),children:(0,xe.jsx)("input",{type:"checkbox",checked:Zl,onChange:()=>de(ie),className:"size-4 rounded-[4px] border-input cursor-pointer","aria-label":h("browseDialog.selectItem",{defaultValue:"\u9009\u62E9\u6B64\u9879"})})}),r.map(dl=>{let fC=dl.dataIndex||dl.key,ng=ie[fC],bC=dl.render?dl.render(ng,ie,ja):ng!=null?String(ng):"-";return(0,xe.jsx)(D,{className:ob[dl.align||"left"],children:bC},dl.key)})]},Ka)})})]})}),(0,xe.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,xe.jsx)("span",{children:h("browseDialog.total",{defaultValue:`\u5171 ${O} \u6761`,count:O})}),(0,xe.jsxs)("div",{className:"flex items-center gap-1",children:[(0,xe.jsx)(C,{variant:"outline",size:"sm",disabled:S<=1,onClick:()=>A(ie=>ie-1),children:h("browseDialog.prevPage",{defaultValue:"\u4E0A\u4E00\u9875"})}),Array.from({length:Math.ceil(O/z)},(ie,ja)=>ja+1).slice(Math.max(0,S-3),Math.min(Math.ceil(O/z),S+2)).map(ie=>(0,xe.jsx)(C,{variant:ie===S?"default":"outline",size:"sm",onClick:()=>A(ie),children:ie},ie)),(0,xe.jsx)(C,{variant:"outline",size:"sm",disabled:S>=Math.ceil(O/z),onClick:()=>A(ie=>ie+1),children:h("browseDialog.nextPage",{defaultValue:"\u4E0B\u4E00\u9875"})})]})]})]})]}),(0,xe.jsxs)(bt,{children:[(0,xe.jsx)(C,{variant:"outline",type:"button",onClick:_t,children:h("dialog.closeButton",{defaultValue:"\u53D6\u6D88"})}),(0,xe.jsx)(C,{type:"button",disabled:!gC,onClick:yt,children:ll>0?h("browseDialog.confirmWithCount",{defaultValue:`\u786E\u5B9A (${ll})`,count:ll}):h("browseDialog.confirm",{defaultValue:"\u786E\u5B9A"})})]})]})})}function D0({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(0,xe.jsxs)("li",{children:[(0,xe.jsxs)("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?(0,xe.jsx)(fe,{className:"size-3.5 shrink-0 opacity-50"}):(0,xe.jsx)(ke,{className:"size-3.5 shrink-0 opacity-50"}):(0,xe.jsx)("span",{className:"w-3.5 shrink-0"}),(0,xe.jsx)("span",{className:"flex-1 truncate",children:e.label}),e.count!=null&&(0,xe.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.count})]}),i&&c&&(0,xe.jsx)("ul",{className:"space-y-0.5",children:e.children.map(d=>(0,xe.jsx)(D0,{node:d,depth:t+1,expandedKeys:a,activeCategoryId:r,onToggleExpand:o,onSelect:n},String(d.id)))})]})}var Si=require("react/jsx-runtime"),i2=[12,28,18,45,32,60,48],l2=["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u65E5"];function M0({data:e=i2,labels:t=l2,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(0,Si.jsxs)("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:[(0,Si.jsxs)("svg",{viewBox:`0 0 320 ${a}`,width:"100%",height:a,preserveAspectRatio:"none",role:"presentation",children:[(0,Si.jsx)("path",{d:x,fill:r,fillOpacity:.18,stroke:"none"}),(0,Si.jsx)("path",{d:f,fill:"none",stroke:r,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),e.map((v,N)=>(0,Si.jsx)("circle",{cx:8+N*m,cy:u(v),r:2.5,fill:r,children:(0,Si.jsxs)("title",{children:[t[N]??N,": ",Q(v)]})},N))]}),(0,Si.jsx)("ul",{className:"mt-1 flex justify-between text-[10px] text-muted-foreground",role:"list",children:t.slice(0,e.length).map((v,N)=>(0,Si.jsx)("li",{children:v},N))})]})}var Zn=require("react/jsx-runtime"),d2=[{label:"\u534E\u5317",value:86},{label:"\u534E\u4E1C",value:72},{label:"\u534E\u5357",value:54},{label:"\u897F\u90E8",value:33}];function B0({title:e="\u6392\u540D",data:t=d2,className:a}){let r=Math.max(1,...t.map(o=>o.value));return(0,Zn.jsxs)(re,{"data-slot":"bar-list-card",className:l("w-full",a),children:[(0,Zn.jsx)(he,{children:(0,Zn.jsx)(ve,{children:e})}),(0,Zn.jsx)(oe,{children:(0,Zn.jsx)("ol",{className:"flex flex-col gap-2",role:"list",children:t.map((o,n)=>(0,Zn.jsxs)("li",{className:"flex items-center gap-2 text-sm",children:[(0,Zn.jsx)("span",{className:"w-5 shrink-0 text-muted-foreground tabular-nums",children:n+1}),(0,Zn.jsx)("span",{className:"w-20 shrink-0 truncate text-muted-foreground",children:o.label}),(0,Zn.jsx)("div",{className:"h-4 flex-1 overflow-hidden rounded bg-muted",role:"presentation",children:(0,Zn.jsx)("div",{className:"h-full rounded bg-primary",style:{width:`${o.value/r*100}%`,...o.color?{backgroundColor:o.color}:{}}})}),(0,Zn.jsx)("span",{className:"w-12 shrink-0 text-right tabular-nums",children:Q(o.value)})]},o.label))})})]})}var _p=M(require("react"),1);var na=require("react/jsx-runtime");function L0({total:e=0,categories:t=[],currency:a="CNY",onChange:r,className:o}){let[n,i]=_p.useState(t);_p.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(0,na.jsxs)("div",{"data-slot":"budget-allocator",className:l("flex flex-col gap-4 rounded-lg border bg-card p-4",o),children:[(0,na.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,na.jsx)("span",{className:"text-sm font-medium",children:"\u9884\u7B97\u5206\u914D"}),(0,na.jsxs)("span",{className:"text-xs text-muted-foreground",children:["\u5DF2\u5206\u914D ",d,"%"]})]}),(0,na.jsx)("div",{className:"h-2 overflow-hidden rounded bg-muted",children:(0,na.jsx)("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)}%`}})}),(0,na.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[(0,na.jsxs)("div",{children:[(0,na.jsx)("div",{className:"text-xs text-muted-foreground",children:"\u603B\u989D"}),(0,na.jsx)("div",{className:"font-medium tabular-nums",children:ze(e,a)})]}),(0,na.jsxs)("div",{children:[(0,na.jsx)("div",{className:"text-xs text-muted-foreground",children:"\u5269\u4F59"}),(0,na.jsx)("div",{className:"font-medium tabular-nums",children:ze(s,a)})]})]}),(0,na.jsx)("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(0,na.jsxs)("li",{className:"flex flex-col gap-1.5",children:[(0,na.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,na.jsx)("span",{className:"truncate text-muted-foreground",children:u.name}),(0,na.jsx)("span",{className:l("tabular-nums",f&&"text-destructive"),children:ze(u.amount,a)})]}),(0,na.jsxs)("div",{className:"flex items-center gap-2",children:[(0,na.jsx)(C,{type:"button",variant:"outline",size:"icon-sm","aria-label":`\u51CF\u5C11 ${u.name} \u9884\u7B97`,onClick:()=>m(u.id,u.amount-1e3),children:(0,na.jsx)(un,{})}),(0,na.jsx)("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"}),(0,na.jsx)(C,{type:"button",variant:"outline",size:"icon-sm","aria-label":`\u589E\u52A0 ${u.name} \u9884\u7B97`,onClick:()=>m(u.id,u.amount+1e3),children:(0,na.jsx)(Re,{})})]}),(0,na.jsx)("div",{className:"h-1 overflow-hidden rounded bg-muted",children:(0,na.jsx)("div",{className:"h-full rounded bg-primary",style:{width:`${Math.min(100,p)}%`}})})]},u.id)})}),n.length===0&&(0,na.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5206\u914D\u7C7B\u522B"})]})}var qm=M(require("react"),1),z0=require("react-i18next");var Ir=require("react/jsx-runtime");function A0({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,z0.useTranslation)("ui"),[m,u]=qm.useState(!1),[p,f]=qm.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=qm.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(0,Ir.jsxs)(st,{open:m,onOpenChange:u,children:[(0,Ir.jsxs)(it,{render:(0,Ir.jsx)(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:[(0,Ir.jsx)(ml,{className:"size-4 shrink-0 opacity-50"}),(0,Ir.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,Ir.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,Ir.jsx)("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:(0,Ir.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,Ir.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,Ir.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,Ir.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,Ir.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Ir.jsx)(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"})]}),(0,Ir.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,Ir.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(y=>{let k=y.value===e;return(0,Ir.jsx)("li",{role:"option","aria-selected":k,children:(0,Ir.jsxs)(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:[(0,Ir.jsx)("span",{className:"flex-1 truncate",children:y.label}),k&&(0,Ir.jsx)(G,{className:"size-4 shrink-0"})]})},y.value)})]})]})]})}var Gm=M(require("react"),1),E0=require("react-i18next");var Dr=require("react/jsx-runtime");function F0({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,E0.useTranslation)("ui"),[m,u]=Gm.useState(!1),[p,f]=Gm.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=Gm.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(0,Dr.jsxs)(st,{open:m,onOpenChange:u,children:[(0,Dr.jsxs)(it,{render:(0,Dr.jsx)(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:[(0,Dr.jsx)(gn,{className:"size-4 shrink-0 opacity-50"}),(0,Dr.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,Dr.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,Dr.jsx)("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:(0,Dr.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,Dr.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,Dr.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,Dr.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,Dr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Dr.jsx)(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"})]}),(0,Dr.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,Dr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,Dr.jsx)("li",{role:"option","aria-selected":y,children:(0,Dr.jsxs)(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:[(0,Dr.jsx)("span",{className:"flex-1 truncate",children:g.label}),y&&(0,Dr.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var jm=M(require("react"),1),$0=require("react-i18next");var or=require("react/jsx-runtime");function H0({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,$0.useTranslation)("ui"),[m,u]=jm.useState(!1),[p,f]=jm.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=jm.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(0,or.jsxs)(st,{open:m,onOpenChange:u,children:[(0,or.jsxs)(it,{render:(0,or.jsx)(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:[(0,or.jsx)(fl,{className:"size-4 shrink-0 opacity-50"}),(0,or.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,or.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,or.jsx)("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:(0,or.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,or.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,or.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,or.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,or.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,or.jsx)(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"})]}),(0,or.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,or.jsx)("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(0,or.jsx)("li",{role:"option","aria-selected":k,children:(0,or.jsxs)(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:[(0,or.jsxs)("span",{className:"flex-1 truncate",children:[y.label,y.contact&&(0,or.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",y.contact]})]}),w&&(0,or.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:w}),k&&(0,or.jsx)(G,{className:"size-4 shrink-0"})]})},y.value)})]})]})]})}var Dn=require("react/jsx-runtime"),V0={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 O0({title:e="\u4EEA\u8868\u76D8",stats:t=[],columns:a=4,className:r}){return(0,Dn.jsxs)("div",{"data-slot":"dashboard-grid",className:l("flex flex-col gap-4",r),role:"region","aria-label":e,children:[(0,Dn.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Dn.jsx)("h2",{className:"text-lg font-semibold",children:e}),(0,Dn.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.length," \u9879\u6307\u6807"]})]}),(0,Dn.jsx)("div",{className:l("grid grid-cols-1 gap-4",V0[a]??V0[4]),children:t.map(o=>{let n=o.trend?o.trend==="up":(o.delta??0)>=0,i=n?os:rs,c=n?as:ts;return(0,Dn.jsxs)("div",{className:"flex flex-col gap-1 rounded-lg border bg-card p-4",children:[(0,Dn.jsx)("span",{className:"text-xs text-muted-foreground",children:o.label}),(0,Dn.jsx)("span",{className:"text-2xl font-semibold tabular-nums",children:Xu(o.value)}),o.delta!==void 0&&(0,Dn.jsxs)("span",{className:l("flex items-center gap-1 text-xs font-medium",n?"text-emerald-600":"text-destructive"),children:[(0,Dn.jsx)(c,{className:"size-3"}),da(o.delta),(0,Dn.jsx)(i,{className:"size-3 opacity-70"})]})]},o.label)})}),t.length===0&&(0,Dn.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6307\u6807\u6570\u636E"})]})}var Km=M(require("react"),1),W0=require("react-i18next");var Mr=require("react/jsx-runtime");function U0(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 _0({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,W0.useTranslation)("ui"),[m,u]=Km.useState(!1),[p,f]=Km.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=Km.useMemo(()=>{if(!p.trim())return U0(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(A=>A.value===R)?.parent}return U0(a).filter(w=>k.has(w.value)).map(w=>({...w,depth:0}))},[a,p]);return(0,Mr.jsxs)(st,{open:m,onOpenChange:u,children:[(0,Mr.jsxs)(it,{render:(0,Mr.jsx)(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:[(0,Mr.jsx)(ml,{className:"size-4 shrink-0 opacity-50"}),(0,Mr.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,Mr.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,Mr.jsx)("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:(0,Mr.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,Mr.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,Mr.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,Mr.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,Mr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Mr.jsx)(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"})]}),(0,Mr.jsxs)("ul",{role:"tree",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,Mr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,Mr.jsx)("li",{role:"treeitem","aria-selected":y,children:(0,Mr.jsxs)(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:[(0,Mr.jsx)("span",{className:"flex-1 truncate",children:g.label}),y&&(0,Mr.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var Qm=M(require("react"),1),q0=require("react-i18next");var fr=require("react/jsx-runtime");function G0({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,q0.useTranslation)("ui"),[m,u]=Qm.useState(!1),[p,f]=Qm.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=Qm.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(0,fr.jsxs)(st,{open:m,onOpenChange:u,children:[(0,fr.jsxs)(it,{render:(0,fr.jsx)(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:[(0,fr.jsx)(ku,{className:"size-4 shrink-0 opacity-50"}),(0,fr.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,fr.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,fr.jsx)("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:(0,fr.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,fr.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,fr.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,fr.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,fr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,fr.jsx)(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"})]}),(0,fr.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,fr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,fr.jsx)("li",{role:"option","aria-selected":y,children:(0,fr.jsxs)(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:[(0,fr.jsx)("span",{className:"flex-1 truncate",children:g.label}),g.region&&(0,fr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.region}),y&&(0,fr.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var es=require("react/jsx-runtime"),c2=[{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 j0({data:e=c2,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(0,es.jsxs)("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:[(0,es.jsxs)("div",{className:"relative shrink-0",style:{width:t,height:t},children:[(0,es.jsx)("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=(0,es.jsx)("circle",{cx:"50",cy:"50",r:i,fill:"none",stroke:d.color??"currentColor",strokeWidth:a,strokeDasharray:`${m*c} ${c}`,strokeDashoffset:-s*c,children:(0,es.jsxs)("title",{children:[d.label,": ",Q(d.value)]})},d.label);return s+=m,u})}),r?(0,es.jsx)("span",{className:"absolute inset-0 flex items-center justify-center text-sm font-medium tabular-nums",children:r}):null]}),(0,es.jsx)("ul",{className:"flex flex-col gap-1.5 text-sm",role:"list",children:e.map(d=>(0,es.jsxs)("li",{className:"flex items-center gap-2",children:[(0,es.jsx)("span",{className:"size-2.5 shrink-0 rounded-sm",style:{backgroundColor:d.color??"currentColor"},"aria-hidden":"true"}),(0,es.jsx)("span",{className:"text-muted-foreground",children:d.label}),(0,es.jsx)("span",{className:"ml-auto tabular-nums",children:Q(d.value)})]},d.label))})]})}var Xm=M(require("react"),1),K0=require("react-i18next");var nr=require("react/jsx-runtime");function Q0({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,K0.useTranslation)("ui"),[m,u]=Xm.useState(!1),[p,f]=Xm.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=Xm.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(0,nr.jsxs)(st,{"data-slot":"employee-picker",open:m,onOpenChange:u,children:[(0,nr.jsxs)(it,{render:(0,nr.jsx)(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:[(0,nr.jsx)(Ei,{className:"size-4 shrink-0 opacity-50"}),(0,nr.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,nr.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,nr.jsx)("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:(0,nr.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,nr.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,nr.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,nr.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,nr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,nr.jsx)(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"})]}),(0,nr.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,nr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,nr.jsx)("li",{role:"option","aria-selected":y,children:(0,nr.jsxs)(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:[(0,nr.jsxs)("span",{className:"flex-1 truncate",children:[g.label,g.code&&(0,nr.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",g.code]})]}),g.department&&(0,nr.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.department}),y&&(0,nr.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var kY=require("react"),X0=M(require("next/link"),1);var Y0=require("react-i18next");var St=require("react/jsx-runtime"),m2={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"}},u2={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:wb,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:yu,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:kb,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:wu,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 J0({status:e=404,title:t,description:a,homeHref:r="/",showHome:o=!0,showBack:n=!0,onBack:i,illustration:c,className:s}){let{t:d}=(0,Y0.useTranslation)("error"),m=m2[e],u=u2[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(0,St.jsx)("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:(0,St.jsxs)("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:[(0,St.jsxs)("section",{className:"flex min-w-0 flex-col justify-between gap-10 p-6 sm:p-8 lg:p-10",children:[(0,St.jsxs)("div",{className:"space-y-8",children:[(0,St.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,St.jsx)(L,{variant:"outline",className:"h-6 rounded-md font-mono",children:e}),(0,St.jsx)("span",{className:"text-xs font-medium uppercase text-muted-foreground",children:u.label})]}),(0,St.jsxs)("div",{className:"grid gap-6 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center",children:[(0,St.jsx)("div",{className:l("flex size-20 items-center justify-center rounded-xl ring-1 sm:size-24",u.surface),children:c??(0,St.jsx)(p,{className:l("size-10 sm:size-12",u.accent)})}),(0,St.jsxs)("div",{className:"min-w-0 space-y-3",children:[(0,St.jsx)("p",{className:l("font-mono text-5xl font-semibold leading-none sm:text-6xl",u.accent),children:e}),(0,St.jsx)("h1",{className:"text-2xl font-semibold tracking-tight text-balance sm:text-3xl",children:v}),(0,St.jsx)("p",{className:"max-w-xl text-sm leading-6 text-muted-foreground sm:text-base",children:N})]})]})]}),(0,St.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[o&&(0,St.jsxs)(X0.default,{href:r,className:Fi({size:"lg"}),children:[(0,St.jsx)(fb,{}),d("errorPage.home")]}),n&&(0,St.jsxs)(C,{size:"lg",variant:"outline",onClick:i??(()=>history.back()),children:[(0,St.jsx)(cl,{}),d("errorPage.back")]})]})]}),(0,St.jsx)("aside",{className:"border-t bg-muted/35 p-6 sm:p-8 lg:border-l lg:border-t-0",children:(0,St.jsxs)("div",{className:"flex h-full flex-col justify-between gap-8",children:[(0,St.jsxs)("div",{className:"space-y-5",children:[(0,St.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,St.jsx)(vb,{className:"size-4 text-muted-foreground"}),d("errorPage.context")]}),(0,St.jsx)(dt,{}),(0,St.jsxs)("dl",{className:"space-y-5 text-sm",children:[(0,St.jsxs)("div",{className:"space-y-1",children:[(0,St.jsx)("dt",{className:"text-xs font-medium uppercase text-muted-foreground",children:d("errorPage.impact")}),(0,St.jsx)("dd",{className:"text-foreground",children:u.impact})]}),(0,St.jsxs)("div",{className:"space-y-1",children:[(0,St.jsx)("dt",{className:"text-xs font-medium uppercase text-muted-foreground",children:d("errorPage.action")}),(0,St.jsx)("dd",{className:"leading-6 text-foreground",children:u.action})]})]})]}),(0,St.jsx)("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"})]})})]})})}var Xl=require("react/jsx-runtime");function Z0(e,t,a,r){let o=r*Math.PI/180;return{x:e+a*Math.cos(o),y:t+a*Math.sin(o)}}function eN(e,t,a,r,o){let n=Z0(e,t,a,r),i=Z0(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 tN({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(0,Xl.jsxs)("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:[(0,Xl.jsxs)("svg",{viewBox:"0 0 100 56",width:"160",role:"presentation",children:[(0,Xl.jsx)("path",{d:eN(d,m,u,180,0),fill:"none",stroke:"currentColor",strokeOpacity:.15,strokeWidth:10,strokeLinecap:"round",className:"text-muted-foreground"}),(0,Xl.jsx)("path",{d:eN(d,m,u,180,s),fill:"none",stroke:o,strokeWidth:10,strokeLinecap:"round"}),(0,Xl.jsx)("text",{x:d,y:m-4,textAnchor:"middle",className:"fill-foreground text-sm font-semibold tabular-nums",children:Q(i)})]}),r?(0,Xl.jsx)("span",{className:"mt-1 text-xs text-muted-foreground",children:r}):null]})}var ln=require("react/jsx-runtime");function aN({direction:e="received",author:t="",content:a="",timestamp:r,attachments:o=[],avatarUrl:n,className:i}){let c=e==="sent",s=r!==void 0?qi(r):"",d=t?t.trim().charAt(0).toUpperCase():"?";return(0,ln.jsxs)("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:[(0,ln.jsx)("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?(0,ln.jsx)("img",{src:n,alt:"",className:"size-8 rounded-full object-cover"}):d}),(0,ln.jsxs)("div",{className:l("flex max-w-[75%] flex-col gap-1",c?"items-end":"items-start"),children:[(0,ln.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t&&(0,ln.jsx)("span",{className:"font-medium text-foreground",children:t}),s&&(0,ln.jsx)("span",{children:s})]}),(0,ln.jsx)("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||(0,ln.jsx)("span",{className:"text-muted-foreground",children:"\uFF08\u7A7A\u6D88\u606F\uFF09"})}),o.length>0&&(0,ln.jsx)("ul",{className:"flex flex-col gap-1",children:o.map(m=>(0,ln.jsxs)("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:[(0,ln.jsx)(bl,{className:"size-3"}),(0,ln.jsx)("span",{className:"truncate",children:m.name})]},m.id))})]})]})}var FY=require("react");var No=require("react/jsx-runtime"),rN={primary:"bg-primary",emerald:"bg-emerald-500",yellow:"bg-yellow-500",red:"bg-red-500",blue:"bg-blue-500"};function oN({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(0,No.jsxs)("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:[(0,No.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,No.jsx)("span",{className:l("size-2 rounded-full",rN[t]??rN.primary),"aria-hidden":"true"}),(0,No.jsx)("span",{className:"text-sm font-medium",children:e}),(0,No.jsx)(L,{variant:"secondary",className:"ml-auto",children:a.length})]}),(0,No.jsx)("ul",{className:"flex flex-col gap-2",role:"list",children:a.map(c=>(0,No.jsx)("li",{children:(0,No.jsxs)("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:[(0,No.jsx)("span",{className:"text-sm font-medium",children:c.title}),(0,No.jsxs)("div",{className:"flex items-center gap-2",children:[c.label&&(0,No.jsx)(L,{variant:"outline",children:c.label}),c.assignee&&(0,No.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:c.assignee})]})]})},c.id))}),a.length===0&&(0,No.jsx)("p",{className:"py-3 text-center text-xs text-muted-foreground",children:"\u6682\u65E0\u5361\u7247"}),(0,No.jsxs)("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:[(0,No.jsx)(Re,{className:"size-3"}),"\u65B0\u589E\u5361\u7247"]})]})}var UY=require("react");var so=require("react/jsx-runtime"),p2={info:{icon:ad,tone:"text-blue-500"},warning:{icon:ir,tone:"text-yellow-500"},success:{icon:ft,tone:"text-emerald-500"},default:{icon:Mn,tone:"text-muted-foreground"}};function nN({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(0,so.jsxs)("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:[(0,so.jsxs)("div",{className:"flex items-center justify-between px-1",children:[(0,so.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:["\u6D88\u606F\u901A\u77E5",o>0&&(0,so.jsxs)("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&&(0,so.jsx)("button",{type:"button",onClick:a,className:"text-xs text-primary hover:underline",children:"\u5168\u90E8\u5DF2\u8BFB"})]}),(0,so.jsx)("ul",{className:"flex flex-col divide-y",role:"list",children:e.map(i=>{let c=i.type??"default",s=p2[c],d=s.icon;return(0,so.jsx)("li",{children:(0,so.jsxs)("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:[(0,so.jsx)(d,{className:l("mt-0.5 size-4 shrink-0",s.tone)}),(0,so.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,so.jsxs)("div",{className:"flex items-center gap-2",children:[!i.read&&(0,so.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-destructive","aria-hidden":"true"}),(0,so.jsx)("span",{className:l("truncate text-sm",!i.read&&"font-medium"),children:i.title}),i.time&&(0,so.jsx)("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground",children:qi(i.time)})]}),i.content&&(0,so.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:i.content})]})]})},i.id)})}),e.length===0&&(0,so.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6D88\u606F"})]})}var jY=require("react");var ua=require("react/jsx-runtime");function sN({title:e="\u603B\u89C8",subtitle:t="",kpis:a=[],activities:r=[],children:o,className:n}){return(0,ua.jsxs)("div",{"data-slot":"overview-page",className:l("flex flex-col gap-6",n),role:"region","aria-label":`${e}\u603B\u89C8`,children:[(0,ua.jsxs)("div",{className:"flex items-center gap-3",children:[(0,ua.jsx)("span",{className:"flex size-10 items-center justify-center rounded-lg bg-primary/10",children:(0,ua.jsx)(xb,{className:"size-5 text-primary"})}),(0,ua.jsxs)("div",{className:"flex flex-col",children:[(0,ua.jsx)("h1",{className:"text-xl font-semibold",children:e}),t&&(0,ua.jsx)("span",{className:"text-sm text-muted-foreground",children:t})]})]}),(0,ua.jsx)("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?as:ts;return(0,ua.jsxs)("div",{className:"flex flex-col gap-1 rounded-lg border bg-card p-4",children:[(0,ua.jsx)("span",{className:"text-xs text-muted-foreground",children:i.label}),(0,ua.jsxs)("span",{className:"text-2xl font-semibold tabular-nums",children:[Xu(i.value),i.unit&&(0,ua.jsx)("span",{className:"ml-0.5 text-sm font-normal text-muted-foreground",children:i.unit})]}),i.delta!==void 0&&(0,ua.jsxs)("span",{className:l("flex items-center gap-1 text-xs font-medium",c?"text-emerald-600":"text-destructive"),children:[(0,ua.jsx)(s,{className:"size-3"}),c?"+":"",(i.delta*100).toFixed(1),"%"]})]},i.label)})}),(0,ua.jsxs)("div",{className:"grid gap-6 lg:grid-cols-3",children:[(0,ua.jsx)("section",{"aria-label":"\u81EA\u5B9A\u4E49\u5185\u5BB9",className:"lg:col-span-2",children:o??(0,ua.jsx)("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"})}),(0,ua.jsxs)("section",{"aria-label":"\u6700\u8FD1\u6D3B\u52A8",className:"rounded-lg border bg-card p-4",children:[(0,ua.jsx)("h2",{className:"mb-3 text-sm font-medium",children:"\u6700\u8FD1\u6D3B\u52A8"}),r.length>0?(0,ua.jsx)("ol",{className:"flex flex-col gap-3",role:"list",children:r.map(i=>(0,ua.jsxs)("li",{className:"flex items-start gap-2 text-sm",children:[(0,ua.jsx)("span",{className:"mt-1.5 size-1.5 shrink-0 rounded-full bg-primary","aria-hidden":"true"}),(0,ua.jsxs)("div",{className:"flex flex-1 flex-col",children:[(0,ua.jsx)("span",{className:"text-foreground",children:i.text}),i.time&&(0,ua.jsx)("span",{className:"text-xs text-muted-foreground",children:i.time})]})]},i.id))}):(0,ua.jsx)("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u6D3B\u52A8"})]})]})]})}var JY=require("react");var Uc=require("react/jsx-runtime");function iN({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(0,Uc.jsxs)("div",{"data-slot":"permission-button",className:l("inline-flex items-center gap-1.5",c),children:[(0,Uc.jsx)(C,{type:"button",variant:n,onClick:o,disabled:d,"aria-disabled":d,icon:d?(0,Uc.jsx)(gu,{}):void 0,children:r}),!s&&a==="disable"&&(0,Uc.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u65E0\u6743\u9650"})]})}var Ym=M(require("react"),1),dN=require("react-i18next");var Br=require("react/jsx-runtime");function lN(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 cN({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,dN.useTranslation)("ui"),[m,u]=Ym.useState(!1),[p,f]=Ym.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=Ym.useMemo(()=>{if(!p.trim())return lN(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(A=>A.value===R)?.parent}return lN(a).filter(w=>k.has(w.value)).map(w=>({...w,depth:0}))},[a,p]);return(0,Br.jsxs)(st,{"data-slot":"product-category-picker",open:m,onOpenChange:u,children:[(0,Br.jsxs)(it,{render:(0,Br.jsx)(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:[(0,Br.jsx)(mu,{className:"size-4 shrink-0 opacity-50"}),(0,Br.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,Br.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,Br.jsx)("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:(0,Br.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,Br.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,Br.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,Br.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,Br.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Br.jsx)(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"})]}),(0,Br.jsxs)("ul",{role:"tree",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,Br.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,Br.jsx)("li",{role:"treeitem","aria-selected":y,children:(0,Br.jsxs)(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:[(0,Br.jsx)("span",{className:"flex-1 truncate",children:g.label}),y&&(0,Br.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var Ft=require("react/jsx-runtime");function mN({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"?da(a):t==="\u6EE1\u51CF"||t==="\u76F4\u964D"?`\u51CF ${a}`:`\u8D60 ${a}`;return(0,Ft.jsxs)(re,{"data-slot":"promotion-rule-card",className:l("w-full",m),children:[(0,Ft.jsx)(he,{children:(0,Ft.jsxs)(ve,{className:"flex items-center justify-between gap-2",children:[(0,Ft.jsxs)("span",{className:"flex items-center gap-2 truncate",children:[(0,Ft.jsx)(nc,{className:"size-4 text-primary"}),(0,Ft.jsx)("span",{className:"truncate",children:e})]}),c?(0,Ft.jsx)(L,{variant:"default",children:"\u751F\u6548\u4E2D"}):(0,Ft.jsx)(L,{variant:"secondary",children:"\u672A\u751F\u6548"})]})}),(0,Ft.jsxs)(oe,{className:"flex flex-col gap-3",children:[(0,Ft.jsxs)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",role:"list",children:[(0,Ft.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,Ft.jsx)("dt",{className:"text-muted-foreground",children:"\u7C7B\u578B"}),(0,Ft.jsx)("dd",{className:"font-medium",children:t})]}),(0,Ft.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,Ft.jsx)("dt",{className:"text-muted-foreground",children:"\u529B\u5EA6"}),(0,Ft.jsx)("dd",{className:"font-medium tabular-nums",children:u})]}),r!==void 0&&(0,Ft.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,Ft.jsx)("dt",{className:"text-muted-foreground",children:"\u95E8\u69DB"}),(0,Ft.jsxs)("dd",{className:"font-medium tabular-nums",children:["\u6EE1 ",r]})]}),(0,Ft.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,Ft.jsx)("dt",{className:"text-muted-foreground",children:"\u8303\u56F4"}),(0,Ft.jsx)("dd",{className:"font-medium",children:i})]})]}),(0,Ft.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[(0,Ft.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,Ft.jsx)(mn,{})," ",o??"\u5373\u65E5\u8D77"]}),(0,Ft.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,Ft.jsx)(Te,{})," \u81F3 ",n??"\u957F\u671F"]})]}),(0,Ft.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ft.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:s,children:[(0,Ft.jsx)(du,{})," \u7F16\u8F91"]}),(0,Ft.jsxs)(C,{type:"button",variant:"ghost",size:"sm",onClick:d,children:[(0,Ft.jsx)(za,{})," \u590D\u5236"]})]})]})]})}var qp=M(require("react"),1);var We=require("react/jsx-runtime"),g2=[{id:"rule-1",name:"\u6EE199\u51CF10",threshold:99,operator:"gte",action:"discount",amount:10}];function uN({rules:e=g2,onChange:t,className:a}){let[r,o]=qp.useState(e);qp.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(0,We.jsxs)("div",{"data-slot":"promotion-rule-editor",className:l("flex flex-col gap-4",a),children:[(0,We.jsxs)("div",{className:"flex items-center gap-2",children:[(0,We.jsx)(nc,{className:"size-5 text-muted-foreground","aria-hidden":!0}),(0,We.jsx)("h3",{className:"text-base font-medium",children:"\u4FC3\u9500\u89C4\u5219"})]}),(0,We.jsx)("ol",{className:"flex flex-col gap-3",children:r.map((m,u)=>(0,We.jsxs)("li",{className:"flex flex-col gap-3 rounded-md border p-3",children:[(0,We.jsxs)("div",{className:"flex items-center justify-between",children:[(0,We.jsxs)(L,{variant:"secondary",children:["\u89C4\u5219 ",u+1]}),(0,We.jsx)(C,{type:"button",variant:"ghost",size:"sm","aria-label":`\u5220\u9664\u89C4\u5219 ${u+1}`,onClick:()=>s(m.id),children:(0,We.jsx)(Le,{className:"size-4","aria-hidden":!0})})]}),(0,We.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,We.jsx)(we,{htmlFor:`pre-name-${m.id}`,children:"\u89C4\u5219\u540D\u79F0"}),(0,We.jsx)(T,{id:`pre-name-${m.id}`,value:m.name,placeholder:"\u5982\uFF1A\u6EE1199\u51CF30",onChange:p=>i(m.id,"name",p.target.value)})]}),(0,We.jsx)(dt,{}),(0,We.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,We.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,We.jsx)(we,{htmlFor:`pre-threshold-${m.id}`,children:"\u95E8\u69DB"}),(0,We.jsx)(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)})]}),(0,We.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,We.jsx)(we,{htmlFor:`pre-operator-${m.id}`,children:"\u6BD4\u8F83"}),(0,We.jsxs)(Ge,{value:m.operator,onValueChange:p=>i(m.id,"operator",p??"gte"),children:[(0,We.jsx)(Ke,{id:`pre-operator-${m.id}`,children:(0,We.jsx)(je,{})}),(0,We.jsxs)(Qe,{children:[(0,We.jsx)(De,{value:"gte",children:"\u2265 \u5927\u4E8E\u7B49\u4E8E"}),(0,We.jsx)(De,{value:"lte",children:"\u2264 \u5C0F\u4E8E\u7B49\u4E8E"}),(0,We.jsx)(De,{value:"eq",children:"= \u7B49\u4E8E"})]})]})]}),(0,We.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,We.jsx)(we,{htmlFor:`pre-action-${m.id}`,children:"\u5956\u52B1\u7C7B\u578B"}),(0,We.jsxs)(Ge,{value:m.action,onValueChange:p=>i(m.id,"action",p??"discount"),children:[(0,We.jsx)(Ke,{id:`pre-action-${m.id}`,children:(0,We.jsx)(je,{children:d[m.action]})}),(0,We.jsxs)(Qe,{children:[(0,We.jsx)(De,{value:"discount",children:"\u6298\u6263"}),(0,We.jsx)(De,{value:"gift",children:"\u8D60\u54C1"}),(0,We.jsx)(De,{value:"coupon",children:"\u4F18\u60E0\u5238"})]})]})]}),(0,We.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,We.jsx)(we,{htmlFor:`pre-amount-${m.id}`,children:"\u6570\u503C"}),(0,We.jsx)(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))}),(0,We.jsx)("div",{className:"flex justify-start",children:(0,We.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:c,children:[(0,We.jsx)(Re,{className:"size-4","aria-hidden":!0}),"\u65B0\u589E\u89C4\u5219"]})})]})}var Hs=require("react/jsx-runtime");function pN({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(0,Hs.jsxs)("div",{"data-slot":"radial-chart",className:l("flex flex-col items-center",n),role:"img","aria-label":`${a}: ${Q(e)} / ${Q(t)}`,children:[(0,Hs.jsxs)("div",{className:"relative",style:{width:o,height:o},children:[(0,Hs.jsxs)("svg",{viewBox:"0 0 100 100",className:"-rotate-90",width:o,height:o,role:"presentation",children:[(0,Hs.jsx)("circle",{cx:d,cy:d,r:c,fill:"none",stroke:"currentColor",strokeOpacity:.15,strokeWidth:8,className:"text-muted-foreground"}),(0,Hs.jsx)("circle",{cx:d,cy:d,r:c,fill:"none",stroke:r,strokeWidth:8,strokeLinecap:"round",strokeDasharray:`${i*s} ${s}`})]}),(0,Hs.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,Hs.jsx)("span",{className:"text-lg font-semibold tabular-nums",children:da(i)}),(0,Hs.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[Q(e),"/",Q(t)]})]})]}),(0,Hs.jsx)("span",{className:"mt-1 text-xs text-muted-foreground",children:a})]})}var Jm=M(require("react"),1),fN=require("react-i18next");var Lr=require("react/jsx-runtime");function gN(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 bN({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,fN.useTranslation)("ui"),[m,u]=Jm.useState(!1),[p,f]=Jm.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=Jm.useMemo(()=>{if(!p.trim())return gN(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(A=>A.value===R)?.parent}return gN(a).filter(w=>k.has(w.value)).map(w=>({...w,depth:0}))},[a,p]);return(0,Lr.jsxs)(st,{open:m,onOpenChange:u,children:[(0,Lr.jsxs)(it,{render:(0,Lr.jsx)(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:[(0,Lr.jsx)(ss,{className:"size-4 shrink-0 opacity-50"}),(0,Lr.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,Lr.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,Lr.jsx)("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:(0,Lr.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,Lr.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,Lr.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,Lr.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,Lr.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,Lr.jsx)(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"})]}),(0,Lr.jsxs)("ul",{role:"tree",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,Lr.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,Lr.jsx)("li",{role:"treeitem","aria-selected":y,children:(0,Lr.jsxs)(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:[(0,Lr.jsx)("span",{className:"flex-1 truncate",children:g.label}),y&&(0,Lr.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var Zm=M(require("react"),1);var Ns=require("react/jsx-runtime"),f2=[{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}],b2={\u641C\u7D22:"#3b82f6",\u5E7F\u544A:"#8b5cf6",\u76F4\u63A5:"#10b981"},x2={\u4E0B\u5355:"#3b82f6",\u6D41\u5931:"#ef4444"};function xN({flows:e=f2,className:t}){let a=Zm.useMemo(()=>{let b=[];for(let g of e)b.includes(g.source)||b.push(g.source);return b},[e]),r=Zm.useMemo(()=>{let b=[];for(let g of e)b.includes(g.target)||b.push(g.target);return b},[e]),o=Zm.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=Zm.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:b2[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:x2[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(0,Ns.jsx)("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:(0,Ns.jsxs)("svg",{viewBox:`0 0 320 ${i}`,width:"100%",role:"presentation",children:[e.map((b,g)=>{let y=u.find(O=>O.label===b.source),k=p.find(O=>O.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 A=y.y+w,z=k.y+R,U=(f+x)/2,B=`M ${f} ${A} C ${U} ${A}, ${U} ${z}, ${x} ${z} L ${x} ${z+S} C ${U} ${z+S}, ${U} ${A+S}, ${f} ${A+S} Z`;return(0,Ns.jsx)("path",{d:B,fill:y.color,fillOpacity:.25,children:(0,Ns.jsxs)("title",{children:[b.source," \u2192 ",b.target,": ",Q(b.value)]})},g)}),u.map(b=>(0,Ns.jsxs)("g",{children:[(0,Ns.jsx)("rect",{x:f-8,y:b.y,width:8,height:b.h,fill:b.color}),(0,Ns.jsx)("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=>(0,Ns.jsxs)("g",{children:[(0,Ns.jsx)("rect",{x,y:b.y,width:8,height:b.h,fill:b.color}),(0,Ns.jsx)("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}`))]})})}var eu=M(require("react"),1),vN=require("react-i18next");var qa=require("react/jsx-runtime");function hN({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,vN.useTranslation)("ui"),[m,u]=eu.useState(!1),[p,f]=eu.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=eu.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(0,qa.jsxs)(st,{open:m,onOpenChange:u,children:[(0,qa.jsxs)(it,{render:(0,qa.jsx)(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:[(0,qa.jsx)(pn,{className:"size-4 shrink-0 opacity-50"}),(0,qa.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,qa.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,qa.jsx)("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:(0,qa.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,qa.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,qa.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,qa.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,qa.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,qa.jsx)(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"})]}),(0,qa.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,qa.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,qa.jsx)("li",{role:"option","aria-selected":y,children:(0,qa.jsxs)(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:[(0,qa.jsxs)("span",{className:"flex-1 truncate",children:[g.label,g.spec&&(0,qa.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["\xB7 ",g.spec]})]}),g.unit&&(0,qa.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.unit}),g.price!=null&&(0,qa.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:ze(g.price)}),y&&(0,qa.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var Wc=require("react/jsx-runtime");function yN({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(0,Wc.jsxs)("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:[(0,Wc.jsx)("path",{d:p,fill:r,fillOpacity:.15,stroke:"none"}),(0,Wc.jsx)("path",{d:u,fill:"none",stroke:r,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(0,Wc.jsxs)("title",{children:["\u6700\u5927\u503C ",Q(n)]})]})}var Ii=require("react/jsx-runtime");function NN({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?as:ts;return(0,Ii.jsxs)("div",{"data-slot":"stat-card-with-delta",className:l("flex items-center gap-3 rounded-lg border bg-card p-4",o),children:[r?(0,Ii.jsx)("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,Ii.jsx)(r,{className:"size-5","aria-hidden":"true"})}):null,(0,Ii.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,Ii.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e}),(0,Ii.jsx)("p",{className:"mt-0.5 text-xl font-semibold tabular-nums",children:i})]}),(0,Ii.jsxs)("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:[(0,Ii.jsx)(c,{className:"size-3.5","aria-hidden":"true"}),da(Math.abs(a)/100)]})]})}var _c=M(require("react"),1);var dn=require("react/jsx-runtime"),v2=[{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 CN({tabs:e=v2,value:t,onChange:a,className:r}){let o=_c.useRef(t??{});_c.useEffect(()=>{t&&(o.current=t)},[t]);let n=_c.useCallback((i,c)=>{let s={...o.current,[i]:c};o.current=s,a?.(s)},[a]);return(0,dn.jsx)("div",{"data-slot":"subform-tabs",className:l("flex flex-col gap-3",r),children:(0,dn.jsxs)(_o,{defaultValue:e[0]?.id,children:[(0,dn.jsx)(qo,{"aria-label":"\u5B50\u8868\u5355\u5206\u533A",children:e.map(i=>(0,dn.jsx)(Xr,{value:i.id,children:i.label},i.id))}),e.map(i=>(0,dn.jsx)(An,{value:i.id,children:(0,dn.jsx)("div",{className:"flex flex-col gap-4 py-2",children:i.fields.length===0?(0,dn.jsx)("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"?(0,dn.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,dn.jsx)(we,{htmlFor:s,children:c.label}),(0,dn.jsx)(Ta,{id:s,value:typeof d=="string"?d:"",onChange:m=>n(c.name,m.target.value)})]},c.name):(0,dn.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,dn.jsx)(we,{htmlFor:s,children:c.label}),(0,dn.jsx)(T,{id:s,value:d==null?"":String(d),onChange:m=>n(c.name,m.target.value)})]},c.name)})})},i.id))]})})}var qf=M(require("react"),1);var cn=require("react/jsx-runtime");function kN({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]=qf.useState(a??e[0]?.id??"all"),p=d?t:m,[f,x]=qf.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(0,cn.jsxs)("div",{"data-slot":"tab-crud-page",className:l("flex flex-col gap-3",s),children:[(0,cn.jsx)(re,{children:(0,cn.jsxs)(oe,{className:"flex flex-wrap items-center gap-2 p-3",children:[(0,cn.jsxs)("div",{className:"relative min-w-[12rem] flex-1",children:[(0,cn.jsx)(te,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,cn.jsx)(T,{type:"search",value:v,onChange:h,placeholder:"\u641C\u7D22...","aria-label":"\u641C\u7D22",className:"pl-8"})]}),o&&(0,cn.jsxs)(C,{type:"button",onClick:o,"aria-label":"\u65B0\u5EFA",children:[(0,cn.jsx)(Re,{})," \u65B0\u5EFA"]})]})}),(0,cn.jsxs)(_o,{value:p,onValueChange:b=>N(String(b)),className:"gap-3",children:[(0,cn.jsx)(qo,{"aria-label":"CRUD \u5206\u7EC4",children:e.map(b=>(0,cn.jsx)(Xr,{value:b.id,children:b.label},b.id))}),(0,cn.jsx)(dt,{}),(0,cn.jsx)("div",{className:"min-h-0 flex-1",children:c})]})]})}var wN=require("next-themes");var io=require("react/jsx-runtime");function PN({className:e,showSystem:t=!0,align:a="end"}){let{theme:r,setTheme:o}=(0,wN.useTheme)();return(0,io.jsxs)(Co,{children:[(0,io.jsxs)(ko,{render:(0,io.jsx)(C,{variant:"ghost",size:"icon",className:l("relative",e),"aria-label":"Toggle theme"}),children:[(0,io.jsx)(Yc,{className:"size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),(0,io.jsx)(Xc,{className:"absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),(0,io.jsx)("span",{className:"sr-only",children:"Toggle theme"})]}),(0,io.jsxs)(wo,{align:a,children:[(0,io.jsxs)(Er,{onClick:()=>o("light"),children:[(0,io.jsx)(Yc,{}),"\u6D45\u8272",r==="light"&&(0,io.jsx)("span",{className:"ml-auto text-xs",children:"\u2713"})]}),t&&(0,io.jsxs)(Er,{onClick:()=>o("system"),children:[(0,io.jsx)(Qc,{}),"\u8DDF\u968F\u7CFB\u7EDF",r==="system"&&(0,io.jsx)("span",{className:"ml-auto text-xs",children:"\u2713"})]}),(0,io.jsxs)(Er,{onClick:()=>o("dark"),children:[(0,io.jsx)(Xc,{}),"\u6DF1\u8272",r==="dark"&&(0,io.jsx)("span",{className:"ml-auto text-xs",children:"\u2713"})]})]})]})}var La=require("react/jsx-runtime"),h2=[{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"}],y2={high:"\u9AD8",medium:"\u4E2D",low:"\u4F4E"},N2={high:"bg-destructive/10 text-destructive",medium:"bg-amber-500/10 text-amber-600",low:"bg-primary/10 text-primary"};function TN({items:e,onToggle:t,className:a}){let r=e??h2;return(0,La.jsx)("div",{"data-slot":"todo-list-table",className:l("overflow-x-auto rounded-md border",a),children:(0,La.jsxs)("table",{className:"w-full text-sm",children:[(0,La.jsx)("caption",{className:"sr-only",children:"\u5F85\u529E\u4E8B\u9879"}),(0,La.jsx)("thead",{className:"bg-muted/50",children:(0,La.jsxs)("tr",{children:[(0,La.jsx)("th",{scope:"col",className:"w-10 px-3 py-2 text-center font-medium",children:"\u5B8C\u6210"}),(0,La.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4E8B\u9879"}),(0,La.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u4F18\u5148\u7EA7"}),(0,La.jsx)("th",{scope:"col",className:"px-3 py-2 text-left font-medium",children:"\u622A\u6B62\u65E5\u671F"})]})}),(0,La.jsx)("tbody",{children:r.map(o=>{let n=o.completed??!1;return(0,La.jsxs)("tr",{className:"border-t",children:[(0,La.jsx)("td",{className:"px-3 py-2 text-center",children:(0,La.jsx)("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?(0,La.jsx)(G,{className:"size-3.5","aria-hidden":"true"}):(0,La.jsx)(Bn,{className:"size-3 text-transparent","aria-hidden":"true"})})}),(0,La.jsx)("td",{className:l("px-3 py-2",n?"text-muted-foreground line-through":"font-medium"),children:o.title}),(0,La.jsx)("td",{className:"px-3 py-2",children:o.priority?(0,La.jsxs)("span",{className:l("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium",N2[o.priority]),children:[(0,La.jsx)(Ib,{className:"size-3","aria-hidden":"true"}),y2[o.priority]]}):(0,La.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,La.jsx)("td",{className:"px-3 py-2 text-muted-foreground",children:o.deadline?(0,La.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,La.jsx)(Te,{className:"size-3","aria-hidden":"true"}),Mt(o.deadline)]}):"\u2014"})]},o.id)})})]})})}var Yd=M(require("react"),1);var ht=require("react/jsx-runtime");function C2(e){let t=[],a=r=>{for(let o of r)t.push(o),o.children?.length&&a(o.children)};return a(e),t}function k2(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 RN({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(0,ht.jsxs)("li",{role:"none",children:[(0,ht.jsxs)("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?(0,ht.jsx)("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?(0,ht.jsx)(fe,{className:"size-3.5"}):(0,ht.jsx)(ke,{className:"size-3.5"})}):(0,ht.jsx)("span",{className:"inline-flex size-4 shrink-0 items-center justify-center","aria-hidden":"true"}),(0,ht.jsx)("span",{className:"shrink-0 text-muted-foreground","aria-hidden":"true",children:i?c?(0,ht.jsx)(Db,{className:"size-4"}):(0,ht.jsx)(mu,{className:"size-4"}):(0,ht.jsx)(Us,{className:"size-4"})}),(0,ht.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm",children:e.label})]}),i&&c&&(0,ht.jsx)("ul",{role:"group",className:"m-0 list-none p-0",children:e.children.map(m=>(0,ht.jsx)(RN,{node:m,level:t+1,selectedId:a,expandedIds:r,onToggle:o,onSelect:n},m.id))})]})}function SN({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]=Yd.useState(a??null),f=m?t:u,[x,v]=Yd.useState(""),N=i!==void 0?i:x,[h,b]=Yd.useState(()=>{let z=new Set;for(let U of e)U.children?.length&&z.add(U.id);return z}),g=Yd.useMemo(()=>k2(e,N),[e,N]),y=Yd.useMemo(()=>C2(g),[g]),k=N.trim()?new Set(y.map(z=>z.id)):h,w=z=>{b(U=>{let B=new Set(U);return B.has(z)?B.delete(z):B.add(z),B})},R=z=>{m||p(z),r?.(z)},S=z=>{let U=z.target.value;i===void 0&&v(U),c?.(U)},A=y.find(z=>z.id===f)??null;return(0,ht.jsxs)("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:[(0,ht.jsxs)("aside",{className:"flex w-64 shrink-0 flex-col gap-2 rounded-lg border bg-card p-2","aria-label":"\u5206\u7C7B\u6811",children:[(0,ht.jsxs)("div",{className:"flex items-center gap-1",children:[o&&(0,ht.jsxs)(C,{type:"button",variant:"outline",size:"sm",onClick:o,"aria-label":"\u65B0\u589E\u5206\u7C7B",children:[(0,ht.jsx)(Re,{})," \u65B0\u589E\u5206\u7C7B"]}),n&&(0,ht.jsx)(C,{type:"button",variant:"ghost",size:"icon-sm",onClick:n,"aria-label":"\u5237\u65B0",children:(0,ht.jsx)(zr,{})})]}),(0,ht.jsxs)("div",{className:"relative",children:[(0,ht.jsx)(te,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,ht.jsx)(T,{type:"search",value:N,onChange:S,placeholder:"\u641C\u7D22\u5206\u7C7B","aria-label":"\u641C\u7D22\u5206\u7C7B",className:"pl-8 pr-8"}),N&&(0,ht.jsx)("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:(0,ht.jsx)(ee,{className:"size-4"})})]}),(0,ht.jsx)(dt,{}),(0,ht.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:g.length===0?(0,ht.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"\u6682\u65E0\u5206\u7C7B"}):(0,ht.jsx)("ul",{role:"tree","aria-label":"\u5206\u7C7B",className:"m-0 list-none p-0",children:g.map(z=>(0,ht.jsx)(RN,{node:z,level:0,selectedId:f,expandedIds:k,onToggle:w,onSelect:R},z.id))})})]}),(0,ht.jsxs)("section",{className:"flex min-w-0 flex-1 flex-col gap-2","aria-label":"CRUD \u8BE6\u60C5",children:[(0,ht.jsxs)("div",{className:"flex items-center justify-between rounded-lg border bg-card px-3 py-2",children:[(0,ht.jsx)("span",{className:"truncate text-sm font-medium",children:A?A.label:"\u672A\u9009\u62E9\u5206\u7C7B"}),(0,ht.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:["\u5171 ",y.length," \u9879"]})]}),(0,ht.jsx)("div",{className:"min-h-0 flex-1",children:s})]})]})}var Yl=require("react/jsx-runtime"),IN=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899"];function DN({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(0,Yl.jsx)("div",{"data-slot":"treemap-chart",className:l("w-full",t),role:"img","aria-label":`\u6811\u56FE\uFF0C\u5171 ${e.length} \u9879`,children:(0,Yl.jsx)("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??IN[n%IN.length];return(0,Yl.jsxs)("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:[(0,Yl.jsx)("span",{className:"truncate text-xs font-medium",children:o.name}),(0,Yl.jsx)("span",{className:"text-sm font-semibold tabular-nums",children:Q(o.value)}),(0,Yl.jsxs)("span",{className:"sr-only",children:["\u5360\u6BD4 ",(i*100).toFixed(0),"%"]})]},o.name)})})})}var tu=M(require("react"),1),MN=require("react-i18next");var br=require("react/jsx-runtime");function BN({value:e,onChange:t,options:a=[],placeholder:r,searchPlaceholder:o,emptyText:n,disabled:i=!1,clearable:c=!0,className:s}){let{t:d}=(0,MN.useTranslation)("ui"),[m,u]=tu.useState(!1),[p,f]=tu.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=tu.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(0,br.jsxs)(st,{open:m,onOpenChange:u,children:[(0,br.jsxs)(it,{render:(0,br.jsx)(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:[(0,br.jsx)(pn,{className:"size-4 shrink-0 opacity-50"}),(0,br.jsx)("span",{className:"flex-1 truncate",children:h?.label??x}),(0,br.jsxs)("span",{className:"flex items-center gap-1",children:[c&&h&&(0,br.jsx)("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:(0,br.jsx)(ee,{className:"size-3.5 opacity-60 hover:opacity-100"})}),(0,br.jsx)(fe,{className:"size-4 opacity-50"})]})]}),m&&(0,br.jsxs)(lt,{align:"start",className:"w-[var(--anchor-width)] p-0",children:[(0,br.jsxs)("div",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,br.jsx)(te,{className:"size-4 shrink-0 opacity-50"}),(0,br.jsx)(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"})]}),(0,br.jsxs)("ul",{role:"listbox",className:"max-h-64 overflow-y-auto p-1",children:[b.length===0&&(0,br.jsx)("li",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:N}),b.map(g=>{let y=g.value===e;return(0,br.jsx)("li",{role:"option","aria-selected":y,children:(0,br.jsxs)(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:[(0,br.jsx)("span",{className:"flex-1 truncate",children:g.label}),g.code&&(0,br.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:g.code}),y&&(0,br.jsx)(G,{className:"size-4 shrink-0"})]})},g.value)})]})]})]})}var Di=require("react/jsx-runtime");function LN({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(0,Di.jsx)("div",{"data-slot":"waterfall-chart",className:l("w-full",a),role:"img","aria-label":`\u7011\u5E03\u56FE\uFF0C\u5171 ${e.length} \u6B65`,children:(0,Di.jsxs)("svg",{viewBox:`0 0 320 ${t}`,width:"100%",height:t,role:"presentation",children:[(0,Di.jsx)("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(0,Di.jsxs)("g",{children:[(0,Di.jsx)("rect",{x:N,y:h,width:36,height:b,fill:y,rx:3,children:(0,Di.jsxs)("title",{children:[x.label,": ",x.absolute?Q(x.value):`${x.delta>=0?"+":""}${Q(x.delta)}`]})}),v<s.length-1&&!x.absolute?(0,Di.jsx)("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,(0,Di.jsx)("text",{x:N+36/2,y:t-4,textAnchor:"middle",className:"fill-muted-foreground text-[9px]",children:x.label})]},x.label)})]})})}var Jl=M(require("react"),1);var Ut=require("react/jsx-runtime");function Gp(e,t){return Math.round((t.getTime()-e.getTime())/864e5)}function w2(e,t){let a=new Date(e);return a.setDate(a.getDate()+t),a}function P2(e){let t=e.getDay();return t===0||t===6}function T2(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 R2(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 S2({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=Jl.useMemo(()=>{if(e.length===0){let U=new Date;return U.setHours(0,0,0,0),{start:U,span:7}}let y=e.map(U=>new Date(U.start)),k=e.map(U=>new Date(U.end)),w=Math.min(...y.map(U=>U.getTime())),R=Math.max(...k.map(U=>U.getTime())),S=new Date(w);S.setHours(0,0,0,0);let A=new Date(R);A.setHours(0,0,0,0);let z=Math.max(1,Gp(S,A)+1);return{start:S,span:z}},[e]),m=a==="day"?32:a==="week"?14:6,u=n?200:0,p=Jl.useMemo(()=>{let y=e.filter(S=>!S.parent),k=[],w=(S,A)=>{let z=e.filter(U=>U.parent===S);for(let U of z)k.push({task:U,depth:A}),w(U.id,A+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=Jl.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,Gp(d.start,R)),A=k.isMilestone?0:Math.max(1,Gp(new Date(k.start),new Date(k.end))+1);y.set(k.id,{startX:u+S*m,endX:u+(S+A)*m,y:w*i+i/2,row:w})}),y},[p,d,m,u,i]),x=Jl.useMemo(()=>{let y=new Date;return y.setHours(0,0,0,0),Gp(d.start,y)},[d]),v=Jl.useMemo(()=>{let y=[];for(let k=0;k<d.span;k++){let w=w2(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${T2(w)}`}:{},isWeekendDay:P2(w)})}return y},[d,a]),N=d.span*m,h=u+N,b=p.length*i+48,g=Jl.useId();return(0,Ut.jsx)("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:(0,Ut.jsxs)("div",{style:{minWidth:h,position:"relative"},children:[(0,Ut.jsxs)("div",{className:"sticky top-0 z-10 flex border-b border-border bg-muted/50 backdrop-blur",style:{height:48},children:[n&&(0,Ut.jsx)("div",{className:"shrink-0 border-r border-border px-3 py-2",style:{width:u},children:(0,Ut.jsx)("span",{className:"text-xs font-medium text-foreground",children:"Task"})}),(0,Ut.jsx)("div",{className:"flex",style:{width:N},children:v.map(y=>(0,Ut.jsxs)("div",{className:l("shrink-0 border-r border-border/50 text-center",y.isWeekendDay&&"bg-muted/30"),style:{width:m},children:[(0,Ut.jsxs)("div",{className:"h-6 border-b border-border/30",children:[y.monthLabel&&(0,Ut.jsx)("span",{className:"text-[10px] font-semibold text-primary",children:y.monthLabel}),y.weekLabel&&!y.monthLabel&&a!=="day"&&(0,Ut.jsx)("span",{className:"text-[8px] text-muted-foreground",children:y.weekLabel})]}),(0,Ut.jsx)("div",{className:"h-6 flex items-center justify-center",children:y.label&&(0,Ut.jsx)("span",{className:l("text-[10px]",y.isWeekendDay?"text-muted-foreground":"text-foreground"),children:y.label})})]},y.day))})]}),(0,Ut.jsxs)("div",{style:{position:"relative"},children:[o&&v.map(y=>y.weekLabel?(0,Ut.jsx)("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&&(0,Ut.jsx)("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:(0,Ut.jsx)("span",{className:"absolute -top-0 -translate-y-full rounded bg-red-500 px-1 text-[9px] text-white",children:"Today"})}),p.length===0?(0,Ut.jsx)("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)),A=y.isMilestone?16:20,z=w*i+(i-A)/2;return(0,Ut.jsxs)("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&&(0,Ut.jsxs)("div",{className:"shrink-0 truncate border-r border-border px-2 py-1",style:{width:u,paddingLeft:8+k*16},children:[(0,Ut.jsxs)("span",{className:l("text-xs",y.isMilestone&&"font-semibold",y.critical&&"text-destructive"),title:y.name,children:[y.isMilestone&&"\u25C6 ",y.name]}),y.assignee&&(0,Ut.jsxs)("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",y.assignee,")"]})]}),(0,Ut.jsx)("div",{className:"relative flex-1",style:{width:N},children:y.isMilestone?(0,Ut.jsx)("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-A/2,top:z,width:A,height:A},"aria-label":`Milestone: ${y.name}`,title:`${y.name} (${Mt(y.start)})`}):(0,Ut.jsxs)("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:z,width:Math.max(m,R.endX-R.startX),height:A},title:`${y.name}: ${Mt(y.start)} \u2192 ${Mt(y.end)} (${S}%)`,children:[(0,Ut.jsx)("div",{className:l("h-full rounded-l-md",y.critical?"bg-destructive":"bg-primary"),style:{width:`${S}%`}}),R.endX-R.startX>60&&(0,Ut.jsxs)("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&&(0,Ut.jsxs)("svg",{"data-slot":"gantt-dependencies",className:"pointer-events-none absolute left-0 top-0",width:h,height:b,style:{zIndex:5},children:[(0,Ut.jsx)("defs",{children:(0,Ut.jsx)("marker",{id:g,markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:(0,Ut.jsx)("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",A=y.lag??0,z,U;S==="FS"?(z={x:w.endX+A*m,y:w.y},U={x:R.startX,y:R.y}):S==="SS"?(z={x:w.startX+A*m,y:w.y},U={x:R.startX,y:R.y}):S==="FF"?(z={x:w.endX+A*m,y:w.y},U={x:R.endX,y:R.y}):(z={x:w.startX+A*m,y:w.y},U={x:R.endX,y:R.y});let B=R2(z,U,S),I=e.find(E=>E.id===y.from)?.critical;return(0,Ut.jsx)("path",{d:B,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}`)})]})]})]})})}var zN=M(require("react"),1);var Pe=require("react/jsx-runtime");function au(e,t="\xA5"){return e?`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`:`${t}0.00`}function I2(){return`je-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function D2({lines:e,onChange:t,accounts:a=[],readOnly:r=!1,currencySymbol:o="\xA5",voucherNo:n,showBalanceStatus:i=!0,className:c}){let s=zN.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:I2(),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(0,Pe.jsxs)("div",{"data-slot":"journal-entry-editor",className:l("space-y-3",c),children:[(n||i)&&(0,Pe.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[n&&(0,Pe.jsxs)("span",{className:"text-sm font-medium text-foreground",children:["Voucher: ",n]}),i&&(0,Pe.jsx)("div",{className:"flex items-center gap-2",children:s.balanced&&e.length>0?(0,Pe.jsxs)(L,{variant:"default",className:"gap-1 bg-green-600",children:[(0,Pe.jsx)(ft,{className:"size-3"}),"Balanced"]}):(0,Pe.jsxs)(L,{variant:"destructive",className:"gap-1",children:[(0,Pe.jsx)(Vo,{className:"size-3"}),"Unbalanced (",au(Math.abs(s.diff),o),")"]})})]}),(0,Pe.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,Pe.jsxs)(at,{children:[(0,Pe.jsx)(rt,{children:(0,Pe.jsxs)(K,{className:"bg-muted/30",children:[(0,Pe.jsx)(F,{className:"w-10 text-center",children:"#"}),(0,Pe.jsx)(F,{className:"min-w-[140px]",children:"Account Code"}),(0,Pe.jsx)(F,{className:"min-w-[160px]",children:"Account Name"}),(0,Pe.jsx)(F,{className:"min-w-[180px]",children:"Description"}),(0,Pe.jsx)(F,{className:"w-32 text-right",children:"Debit"}),(0,Pe.jsx)(F,{className:"w-32 text-right",children:"Credit"}),!r&&(0,Pe.jsx)(F,{className:"w-12 text-center",children:"Action"})]})}),(0,Pe.jsx)(Oe,{children:e.length===0?(0,Pe.jsx)(K,{children:(0,Pe.jsx)(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)=>(0,Pe.jsxs)(K,{"data-slot":"journal-entry-line",children:[(0,Pe.jsx)(D,{className:"text-center text-sm text-muted-foreground",children:f+1}),(0,Pe.jsx)(D,{children:r?(0,Pe.jsx)("span",{className:"text-sm",children:p.accountCode||"\u2014"}):a.length>0?(0,Pe.jsxs)("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:[(0,Pe.jsx)("option",{value:"",children:"Select account"}),a.map(x=>(0,Pe.jsxs)("option",{value:x.code,children:[x.code," \u2014 ",x.name]},x.code))]}):(0,Pe.jsx)(T,{className:"h-8",value:p.accountCode,onChange:x=>u(p.id,"accountCode",x.target.value),placeholder:"Account code","aria-label":"Account code"})}),(0,Pe.jsx)(D,{children:r?(0,Pe.jsx)("span",{className:"text-sm",children:p.accountName||"\u2014"}):(0,Pe.jsx)(T,{className:"h-8",value:p.accountName,onChange:x=>u(p.id,"accountName",x.target.value),placeholder:"Account name","aria-label":"Account name"})}),(0,Pe.jsx)(D,{children:r?(0,Pe.jsx)("span",{className:"text-sm",children:p.description||"\u2014"}):(0,Pe.jsx)(T,{className:"h-8",value:p.description??"",onChange:x=>u(p.id,"description",x.target.value),placeholder:"Memo","aria-label":"Description"})}),(0,Pe.jsx)(D,{className:"text-right",children:r?(0,Pe.jsx)("span",{className:l("text-sm tabular-nums",p.debit>0&&"font-medium text-foreground"),children:p.debit>0?au(p.debit,o):"\u2014"}):(0,Pe.jsx)(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"})}),(0,Pe.jsx)(D,{className:"text-right",children:r?(0,Pe.jsx)("span",{className:l("text-sm tabular-nums",p.credit>0&&"font-medium text-foreground"),children:p.credit>0?au(p.credit,o):"\u2014"}):(0,Pe.jsx)(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&&(0,Pe.jsx)(D,{className:"text-center",children:(0,Pe.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>m(p.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:(0,Pe.jsx)(Le,{className:"size-4"})})})]},p.id))}),e.length>0&&(0,Pe.jsx)(Oe,{children:(0,Pe.jsxs)(K,{className:"border-t-2 bg-muted/50 font-semibold",children:[(0,Pe.jsx)(D,{colSpan:4,className:"text-right text-sm",children:"Totals:"}),(0,Pe.jsx)(D,{className:"text-right text-sm tabular-nums text-foreground","data-slot":"journal-total-debit",children:au(s.debit,o)}),(0,Pe.jsx)(D,{className:"text-right text-sm tabular-nums text-foreground","data-slot":"journal-total-credit",children:au(s.credit,o)}),!r&&(0,Pe.jsx)(D,{})]})})]})}),!r&&(0,Pe.jsx)("div",{className:"flex items-center gap-2",children:(0,Pe.jsxs)(C,{variant:"outline",size:"sm",onClick:d,children:[(0,Pe.jsx)(Re,{className:"mr-1 size-4"}),"Add Line"]})})]})}var Jd=M(require("react"),1);var me=require("react/jsx-runtime");function jf(){return`bom-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Gf(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function Kf(e){let t=e.quantity*e.unitCost;if(!e.children||e.children.length===0)return t;let a=e.children.reduce((r,o)=>r+Kf(o),0);return t+(e.isPhantom?0:a)}function AN(e){return!e.children||e.children.length===0?0:e.children.reduce((t,a)=>t+1+AN(a),0)}function EN(e){return{...e,id:jf(),partNumber:`${e.partNumber}-COPY`,children:e.children?.map(EN)??[]}}function FN(e,t,a){return e.map(r=>r.id===t?a(r):r.children?{...r,children:FN(r.children,t,a)}:r)}function $N(e,t){return e.filter(a=>a.id!==t).map(a=>a.children?{...a,children:$N(a.children,t)}:a)}function HN(e,t,a){return e.map(r=>r.id===t?{...r,children:[...r.children??[],a]}:r.children?{...r,children:HN(r.children,t,a)}:r)}function VN(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:Kf(o),descendantCount:AN(o)}),n&&i&&r.push(...VN(o.children,t,a+1))}return r}function M2({items:e,onChange:t,readOnly:a=!1,showCostRollup:r=!0,currencySymbol:o="\xA5",className:n}){let[i,c]=Jd.useState(()=>new Set(e.filter(h=>h.children?.length).map(h=>h.id)));Jd.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=Jd.useMemo(()=>VN(e,i),[e,i]),d=Jd.useMemo(()=>e.reduce((h,b)=>h+Kf(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(FN(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:jf(),partNumber:"",partName:"",quantity:1,unit:"pcs",unitCost:0,type:"material"};t(HN(e,h,b)),c(g=>new Set(g).add(h))},f=()=>{if(!t)return;let h={id:jf(),partNumber:"",partName:"",quantity:1,unit:"pcs",unitCost:0,type:"material"};t([...e,h])},x=h=>{t&&t($N(e,h))},v=h=>{if(!t)return;let b=g=>{for(let y of g){if(y.id===h)return[...g,EN(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(0,me.jsxs)("div",{"data-slot":"bom-tree-editor",className:l("space-y-3",n),children:[(0,me.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,me.jsxs)(at,{children:[(0,me.jsx)(rt,{children:(0,me.jsxs)(K,{className:"bg-muted/30",children:[(0,me.jsx)(F,{className:"w-10"}),(0,me.jsx)(F,{className:"min-w-[120px]",children:"Part Number"}),(0,me.jsx)(F,{className:"min-w-[160px]",children:"Part Name"}),(0,me.jsx)(F,{className:"w-20 text-right",children:"Qty"}),(0,me.jsx)(F,{className:"w-16",children:"Unit"}),(0,me.jsx)(F,{className:"w-24 text-right",children:"Unit Cost"}),r&&(0,me.jsx)(F,{className:"w-28 text-right",children:"Total Cost"}),(0,me.jsx)(F,{className:"w-20",children:"Type"}),(0,me.jsx)(F,{className:"min-w-[100px]",children:"Reference"}),!a&&(0,me.jsx)(F,{className:"w-24 text-center",children:"Actions"})]})}),(0,me.jsx)(Oe,{children:s.length===0?(0,me.jsx)(K,{children:(0,me.jsx)(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(0,me.jsxs)(K,{"data-slot":"bom-tree-row","data-depth":g,className:l(g>0&&"bg-muted/5",b.isPhantom&&"opacity-70"),children:[(0,me.jsx)(D,{children:y?(0,me.jsx)("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?(0,me.jsx)(fe,{className:"size-4"}):(0,me.jsx)(ke,{className:"size-4"})}):(0,me.jsx)("span",{className:"inline-flex size-5 items-center justify-center",children:b.isPhantom?(0,me.jsx)(Fb,{className:"size-3 text-muted-foreground"}):(0,me.jsx)(pn,{className:"size-3 text-muted-foreground"})})}),(0,me.jsx)(D,{style:{paddingLeft:8+g*20},children:a?(0,me.jsx)("span",{className:"text-sm font-mono",children:b.partNumber||"\u2014"}):(0,me.jsx)(T,{className:"h-8 font-mono text-sm",value:b.partNumber,onChange:A=>u(b.id,"partNumber",A.target.value),placeholder:"P-0001","aria-label":"Part number"})}),(0,me.jsx)(D,{children:a?(0,me.jsx)("span",{className:"text-sm",children:b.partName||"\u2014"}):(0,me.jsx)(T,{className:"h-8 text-sm",value:b.partName,onChange:A=>u(b.id,"partName",A.target.value),placeholder:"Component name","aria-label":"Part name"})}),(0,me.jsx)(D,{className:"text-right",children:a?(0,me.jsx)("span",{className:"text-sm tabular-nums",children:b.quantity}):(0,me.jsx)(T,{type:"number",className:"h-8 text-right tabular-nums",value:b.quantity,onChange:A=>u(b.id,"quantity",A.target.value),"aria-label":"Quantity",min:0,step:"0.01"})}),(0,me.jsx)(D,{children:a?(0,me.jsx)("span",{className:"text-sm",children:b.unit}):(0,me.jsx)(T,{className:"h-8 text-sm",value:b.unit,onChange:A=>u(b.id,"unit",A.target.value),"aria-label":"Unit"})}),(0,me.jsx)(D,{className:"text-right",children:a?(0,me.jsx)("span",{className:"text-sm tabular-nums",children:Gf(b.unitCost,o)}):(0,me.jsx)(T,{type:"number",className:"h-8 text-right tabular-nums",value:b.unitCost,onChange:A=>u(b.id,"unitCost",A.target.value),"aria-label":"Unit cost",min:0,step:"0.01"})}),r&&(0,me.jsxs)(D,{className:"text-right text-sm font-medium tabular-nums","data-slot":"bom-total-cost",children:[Gf(w,o),R>0&&(0,me.jsxs)("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",R," sub)"]})]}),(0,me.jsx)(D,{children:(0,me.jsx)(L,{variant:N[S].variant,className:"text-[10px]",children:N[S].label})}),(0,me.jsx)(D,{children:a?(0,me.jsx)("span",{className:"text-sm",children:b.reference||"\u2014"}):(0,me.jsx)(T,{className:"h-8 text-sm",value:b.reference??"",onChange:A=>u(b.id,"reference",A.target.value),placeholder:"R1, R2","aria-label":"Reference designator"})}),!a&&(0,me.jsx)(D,{className:"text-center",children:(0,me.jsxs)("div",{className:"flex items-center justify-center gap-0.5",children:[y||b.type==="subassembly"?(0,me.jsx)(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:(0,me.jsx)(Re,{className:"size-3.5"})}):null,(0,me.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>v(b.id),className:"text-muted-foreground hover:text-foreground","aria-label":"Duplicate item",title:"Duplicate",children:(0,me.jsx)(za,{className:"size-3.5"})}),(0,me.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>x(b.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove item",title:"Remove",children:(0,me.jsx)(Le,{className:"size-3.5"})})]})})]},b.id)})}),e.length>0&&r&&(0,me.jsx)(Oe,{children:(0,me.jsxs)(K,{className:"border-t-2 bg-muted/50 font-semibold",children:[(0,me.jsx)(D,{colSpan:r?6:5,className:"text-right text-sm",children:"Grand Total:"}),(0,me.jsx)(D,{className:"text-right text-sm tabular-nums text-primary","data-slot":"bom-grand-total",children:Gf(d,o)}),(0,me.jsx)(D,{colSpan:a?2:3})]})})]})}),!a&&(0,me.jsx)("div",{className:"flex items-center gap-2",children:(0,me.jsxs)(C,{variant:"outline",size:"sm",onClick:f,children:[(0,me.jsx)(Re,{className:"mr-1 size-4"}),"Add Component"]})})]})}var jZ=require("react");var _e=require("react/jsx-runtime");function B2(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 L2(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 z2(e){return e>=90?"bg-green-500":e>=75?"bg-blue-500":e>=60?"bg-yellow-500":"bg-red-500"}function A2(e){return e==="up"?(0,_e.jsx)("span",{className:"text-green-600",children:"\u25B2"}):e==="down"?(0,_e.jsx)("span",{className:"text-red-600",children:"\u25BC"}):e==="stable"?(0,_e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):null}function E2({supplier:e,showWeightedTotal:t=!0,showTrends:a=!0,showBars:r=!0,className:o}){let n=B2(e.criteria),i=L2(n),c=e.previousScore!=null?n-e.previousScore:null;return(0,_e.jsxs)("div",{"data-slot":"supplier-scorecard",className:l("rounded-lg border border-border bg-card p-5",o),children:[(0,_e.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-4 border-b border-border pb-4",children:[(0,_e.jsxs)("div",{children:[(0,_e.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:e.name}),(0,_e.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-sm text-muted-foreground",children:[e.code&&(0,_e.jsxs)("span",{children:["Code: ",e.code]}),e.category&&(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("span",{children:"\u2022"}),(0,_e.jsx)("span",{children:e.category})]}),e.period&&(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("span",{children:"\u2022"}),(0,_e.jsx)("span",{children:e.period})]})]})]}),(0,_e.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,_e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_e.jsx)("span",{className:l("text-3xl font-bold tabular-nums",i.color),"data-slot":"supplier-overall-score",children:n.toFixed(1)}),(0,_e.jsxs)("span",{className:l("text-lg font-bold",i.color),children:["(",i.tier,")"]})]}),(0,_e.jsx)(L,{variant:"outline",className:"text-xs",children:i.label}),c!=null&&(0,_e.jsxs)("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"]})]})]}),(0,_e.jsx)("div",{className:"space-y-3",children:e.criteria.map(s=>(0,_e.jsxs)("div",{"data-slot":"supplier-criterion",children:[(0,_e.jsxs)("div",{className:"flex items-center justify-between gap-2 text-sm",children:[(0,_e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_e.jsx)("span",{className:"font-medium text-foreground",children:s.name}),(0,_e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(weight: ",s.weight,"%)"]}),a&&A2(s.trend)]}),(0,_e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_e.jsx)("div",{className:"flex",children:Array.from({length:5}).map((d,m)=>(0,_e.jsx)(oc,{className:l("size-3.5",m<Math.round(s.score/20)?"fill-yellow-400 text-yellow-400":"fill-muted text-muted")},m))}),(0,_e.jsx)("span",{className:"w-12 text-right font-medium tabular-nums text-foreground",children:s.score})]})]}),r&&(0,_e.jsx)("div",{className:"mt-1 h-2 overflow-hidden rounded-full bg-muted",children:(0,_e.jsx)("div",{className:l("h-full rounded-full transition-all",z2(s.score)),style:{width:`${s.score}%`}})}),s.comment&&(0,_e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:s.comment})]},s.id))}),t&&(0,_e.jsxs)("div",{className:"mt-4 flex items-center justify-between border-t border-border pt-3",children:[(0,_e.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Weighted Total Score"}),(0,_e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_e.jsx)("span",{className:"text-2xl font-bold tabular-nums text-primary",children:n.toFixed(1)}),(0,_e.jsx)("span",{className:"text-sm text-muted-foreground",children:"/ 100"})]})]})]})}var Qf=M(require("react"),1);var sr=require("react/jsx-runtime"),F2=[{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 ON(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function UN(e,t){return e.find(a=>a.code===t)?.symbol??t}function $2({value:e=0,onChange:t,currencies:a=F2,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=Qf.useMemo(()=>i??(r===n?1:s[r]??1),[i,r,n,s]),v=Qf.useMemo(()=>Math.round(e*x*100)/100,[e,x]),N=UN(a,r),h=UN(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(0,sr.jsxs)("div",{"data-slot":"multi-currency-input",className:l("space-y-2",f),children:[(0,sr.jsxs)("div",{className:"flex items-stretch gap-2",children:[(0,sr.jsx)("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=>(0,sr.jsxs)("option",{value:w.code,children:[w.code," (",w.symbol,")"]},w.code))}),(0,sr.jsxs)("div",{className:"relative flex-1",children:[(0,sr.jsx)("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:N}),(0,sr.jsx)(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&&(0,sr.jsxs)("div",{className:"space-y-1.5",children:[(0,sr.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,sr.jsx)("span",{className:"text-muted-foreground",children:"Exchange Rate:"}),(0,sr.jsxs)("span",{className:"text-muted-foreground",children:["1 ",r," ="]}),m&&!d?(0,sr.jsx)(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}):(0,sr.jsxs)("span",{className:"font-medium tabular-nums text-foreground",children:[h,x.toFixed(4)]}),(0,sr.jsx)("span",{className:"text-muted-foreground",children:n})]}),(0,sr.jsxs)("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:[(0,sr.jsxs)("span",{className:"text-sm tabular-nums text-muted-foreground",children:[ON(e,N)," ",r]}),(0,sr.jsx)(co,{className:"size-3.5 text-muted-foreground"}),(0,sr.jsxs)("span",{className:"text-sm font-semibold tabular-nums text-foreground",children:[ON(v,h)," ",n]})]})]}),u&&k&&(0,sr.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,sr.jsx)(L,{variant:"outline",className:"text-[10px]",children:"Same currency"}),(0,sr.jsx)("span",{children:"No conversion needed"})]})]})}var jp=M(require("react"),1);var Me=require("react/jsx-runtime");function Xf(e,t){return!e||e===t||e==="string"||e==="number"&&t==="string"||e==="date"&&t==="string"}function WN(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:Xf(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:Xf(i.detectedType,o.type)}),r.add(i.name);continue}a.push({source:"",target:o.name,autoMatched:!1,typeMatch:!0})}return a}function H2({sourceColumns:e,targetFields:t,mappings:a,onMappingsChange:r,showSamples:o=!0,onBack:n,onContinue:i,className:c}){let[s,d]=jp.useState(()=>a.length>0?a:WN(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?Xf(b.detectedType,g.type):!0}:k);r?r(y):d(y)},p=()=>{let N=WN(e,t);r?r(N):d(N)},f=jp.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(0,Me.jsxs)("div",{"data-slot":"import-mapping-wizard",className:l("space-y-4",c),children:[(0,Me.jsxs)("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-border bg-muted/30 px-4 py-2",children:[(0,Me.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Mapping Summary:"}),(0,Me.jsxs)(L,{variant:"default",className:"text-xs",children:[f.mapped,"/",f.total," mapped"]}),(0,Me.jsxs)(L,{variant:f.requiredMapped===f.required?"default":"destructive",className:"text-xs",children:[f.requiredMapped,"/",f.required," required"]}),f.typeMismatches>0&&(0,Me.jsxs)(L,{variant:"destructive",className:"text-xs",children:[f.typeMismatches," type mismatch"]}),(0,Me.jsx)(C,{variant:"outline",size:"sm",onClick:p,className:"ml-auto",children:"Auto-Match"})]}),(0,Me.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,Me.jsxs)(at,{children:[(0,Me.jsx)(rt,{children:(0,Me.jsxs)(K,{className:"bg-muted/30",children:[(0,Me.jsx)(F,{className:"min-w-[180px]",children:"Source Column"}),(0,Me.jsx)(F,{className:"w-12 text-center",children:"\u2192"}),(0,Me.jsx)(F,{className:"min-w-[180px]",children:"Target Field"}),(0,Me.jsx)(F,{className:"w-20",children:"Type"}),(0,Me.jsx)(F,{className:"w-16",children:"Required"}),(0,Me.jsx)(F,{className:"w-16",children:"Status"}),o&&(0,Me.jsx)(F,{className:"min-w-[200px]",children:"Sample Data"})]})}),(0,Me.jsx)(Oe,{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(0,Me.jsxs)(K,{"data-slot":"import-mapping-row","data-status":g?"unmapped":y?"mismatch":"mapped",children:[(0,Me.jsx)(D,{children:(0,Me.jsxs)("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:[(0,Me.jsx)("option",{value:"",children:"\u2014 Not mapped \u2014"}),e.map(k=>(0,Me.jsxs)("option",{value:k.name,disabled:v.has(k.name)&&k.name!==N.source,children:[k.name,k.detectedType?` (${k.detectedType})`:""]},k.name))]})}),(0,Me.jsx)(D,{className:"text-center",children:(0,Me.jsx)(co,{className:"mx-auto size-4 text-muted-foreground"})}),(0,Me.jsx)(D,{children:(0,Me.jsxs)("div",{className:"flex flex-col",children:[(0,Me.jsx)("span",{className:"text-sm font-medium text-foreground",children:h?.label??N.target}),(0,Me.jsx)("span",{className:"text-xs text-muted-foreground",children:N.target})]})}),(0,Me.jsx)(D,{children:(0,Me.jsx)(L,{variant:"outline",className:"text-[10px]",children:h?.type??"string"})}),(0,Me.jsx)(D,{className:"text-center",children:h?.required?(0,Me.jsx)("span",{className:"text-destructive",children:"*"}):(0,Me.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,Me.jsx)(D,{className:"text-center",children:g?h?.required?(0,Me.jsx)(Vo,{className:"mx-auto size-4 text-destructive"}):(0,Me.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):y?(0,Me.jsx)(Vo,{className:"mx-auto size-4 text-yellow-500"}):(0,Me.jsx)(ft,{className:"mx-auto size-4 text-green-600"})}),o&&(0,Me.jsx)(D,{children:b?.samples?(0,Me.jsx)("div",{className:"flex flex-col gap-0.5 text-xs text-muted-foreground",children:b.samples.slice(0,3).map((k,w)=>(0,Me.jsx)("span",{className:"truncate",children:k},w))}):(0,Me.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})})]},N.target)})})]})}),(0,Me.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Me.jsxs)(C,{variant:"outline",onClick:n,children:[(0,Me.jsx)(cl,{className:"mr-1 size-4"}),"Back"]}),(0,Me.jsxs)(C,{onClick:i,disabled:!x,children:["Continue",(0,Me.jsx)(co,{className:"ml-1 size-4"})]})]})]})}var qc=M(require("react"),1);var ye=require("react/jsx-runtime"),_N={create:{label:"Created",variant:"default"},update:{label:"Updated",variant:"secondary"},delete:{label:"Deleted",variant:"destructive"},restore:{label:"Restored",variant:"outline"}};function V2(e){return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function O2({entries:e,showFilter:t=!0,showEntity:a=!0,showUser:r=!0,showTimestamp:o=!0,showReason:n=!1,className:i}){let[c,s]=qc.useState(""),[d,m]=qc.useState("all"),u=qc.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=qc.useMemo(()=>{let f={create:0,update:0,delete:0,restore:0};for(let x of e)f[x.action]++;return f},[e]);return(0,ye.jsxs)("div",{"data-slot":"audit-trail-diff",className:l("space-y-3",i),children:[t&&(0,ye.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,ye.jsxs)("div",{className:"relative flex-1 min-w-[200px]",children:[(0,ye.jsx)(te,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,ye.jsx)(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"})]}),(0,ye.jsxs)("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:[(0,ye.jsx)("option",{value:"all",children:"All actions"}),(0,ye.jsxs)("option",{value:"create",children:["Created (",p.create,")"]}),(0,ye.jsxs)("option",{value:"update",children:["Updated (",p.update,")"]}),(0,ye.jsxs)("option",{value:"delete",children:["Deleted (",p.delete,")"]}),(0,ye.jsxs)("option",{value:"restore",children:["Restored (",p.restore,")"]})]})]}),(0,ye.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,ye.jsxs)(at,{children:[(0,ye.jsx)(rt,{children:(0,ye.jsxs)(K,{className:"bg-muted/30",children:[(0,ye.jsx)(F,{className:"w-20",children:"Action"}),a&&(0,ye.jsx)(F,{className:"min-w-[140px]",children:"Entity"}),(0,ye.jsx)(F,{className:"min-w-[120px]",children:"Field"}),(0,ye.jsx)(F,{className:"min-w-[140px]",children:"Old Value"}),(0,ye.jsx)(F,{className:"w-8 text-center",children:"\u2192"}),(0,ye.jsx)(F,{className:"min-w-[140px]",children:"New Value"}),r&&(0,ye.jsx)(F,{className:"min-w-[100px]",children:"User"}),o&&(0,ye.jsx)(F,{className:"min-w-[140px]",children:"Time"}),n&&(0,ye.jsx)(F,{className:"min-w-[120px]",children:"Reason"})]})}),(0,ye.jsx)(Oe,{children:u.length===0?(0,ye.jsx)(K,{children:(0,ye.jsx)(D,{colSpan:8+(n?1:0),className:"py-8 text-center text-muted-foreground",children:"No audit entries found"})}):u.map(f=>(0,ye.jsxs)(K,{"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:[(0,ye.jsx)(D,{children:(0,ye.jsx)(L,{variant:_N[f.action].variant,className:"text-[10px]",children:_N[f.action].label})}),a&&(0,ye.jsx)(D,{children:(0,ye.jsxs)("div",{className:"flex flex-col",children:[(0,ye.jsx)("span",{className:"text-sm font-medium text-foreground",children:f.entityType}),(0,ye.jsx)("span",{className:"text-xs text-muted-foreground",children:f.entityId})]})}),(0,ye.jsxs)(D,{children:[(0,ye.jsx)("span",{className:"text-sm text-foreground",children:f.fieldLabel??f.field}),f.section&&(0,ye.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground",children:["(",f.section,")"]})]}),(0,ye.jsx)(D,{children:f.action==="create"?(0,ye.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,ye.jsx)("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)"})}),(0,ye.jsx)(D,{className:"text-center",children:(0,ye.jsx)(co,{className:"mx-auto size-3.5 text-muted-foreground"})}),(0,ye.jsx)(D,{children:f.action==="delete"?(0,ye.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"}):(0,ye.jsx)("span",{className:l("text-sm font-medium tabular-nums text-foreground",f.action==="create"&&"text-green-600"),children:f.newValue||"(empty)"})}),r&&(0,ye.jsx)(D,{children:(0,ye.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ye.jsx)(Ei,{className:"size-3 text-muted-foreground"}),(0,ye.jsx)("span",{className:"text-sm text-foreground",children:f.user})]})}),o&&(0,ye.jsx)(D,{children:(0,ye.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ye.jsx)(Te,{className:"size-3 text-muted-foreground"}),(0,ye.jsx)("span",{className:"text-xs text-muted-foreground",children:V2(f.timestamp)})]})}),n&&(0,ye.jsx)(D,{children:(0,ye.jsx)("span",{className:"text-xs text-muted-foreground",children:f.reason||"\u2014"})})]},f.id))})]})}),(0,ye.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Showing ",u.length," of ",e.length," entries"]})]})}var fee=require("react");var ue=require("react/jsx-runtime"),U2={eq:"equals",neq:"not equals",gt:"greater than",gte:"\u2265",lt:"less than",lte:"\u2264",contains:"contains",in:"in"},qN={email:{label:"Email",icon:rc,color:"text-blue-600"},sms:{label:"SMS",icon:pl,color:"text-green-600"},inApp:{label:"In-App",icon:Mn,color:"text-purple-600"},webhook:{label:"Webhook",icon:Eb,color:"text-orange-600"}},W2=[{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"}],_2=[{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 GN(){return`nr-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function q2({rule:e,onChange:t,events:a=W2,fields:r=_2,recipientOptions:o=[],templates:n=[],readOnly:i=!1,className:c}){let s=N=>{t&&t({...e,...N})},d=()=>{s({conditions:[...e.conditions,{id:GN(),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:GN(),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(0,ue.jsxs)("div",{"data-slot":"notification-rule-builder",className:l("space-y-5 rounded-lg border border-border bg-card p-5",c),children:[(0,ue.jsxs)("div",{className:"flex items-center justify-between gap-4 border-b border-border pb-4",children:[(0,ue.jsx)("div",{className:"flex-1",children:i?(0,ue.jsx)("span",{className:"text-lg font-semibold text-foreground",children:e.name}):(0,ue.jsx)(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"})}),(0,ue.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ue.jsx)("span",{className:"text-sm text-muted-foreground",children:"Enabled"}),(0,ue.jsx)(ws,{checked:e.enabled,onCheckedChange:N=>s({enabled:N}),disabled:i,"aria-label":"Enable rule"})]})]}),(0,ue.jsxs)("div",{"data-slot":"rule-event-section",children:[(0,ue.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"When event fires:"}),(0,ue.jsx)("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=>(0,ue.jsxs)("option",{value:N.value,children:[N.group?`${N.group}: `:"",N.label]},N.value))})]}),(0,ue.jsxs)("div",{"data-slot":"rule-conditions-section",children:[(0,ue.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,ue.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Conditions (all must match):"}),!i&&(0,ue.jsxs)(C,{variant:"outline",size:"sm",onClick:d,children:[(0,ue.jsx)(Re,{className:"mr-1 size-3.5"}),"Add"]})]}),(0,ue.jsx)("div",{className:"space-y-2",children:e.conditions.length===0?(0,ue.jsx)("p",{className:"text-sm text-muted-foreground",children:"No conditions \u2014 notify on every event occurrence."}):e.conditions.map(N=>(0,ue.jsxs)("div",{"data-slot":"rule-condition",className:"flex items-center gap-2",children:[(0,ue.jsx)("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=>(0,ue.jsx)("option",{value:h.value,children:h.label},h.value))}),(0,ue.jsx)("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(U2).map(([h,b])=>(0,ue.jsx)("option",{value:h,children:b},h))}),(0,ue.jsx)(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&&(0,ue.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>m(N.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove condition",children:(0,ue.jsx)(Le,{className:"size-4"})})]},N.id))})]}),(0,ue.jsxs)("div",{"data-slot":"rule-recipients-section",children:[(0,ue.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,ue.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Notify who:"}),!i&&o.length>0&&(0,ue.jsxs)(C,{variant:"outline",size:"sm",onClick:p,children:[(0,ue.jsx)(Re,{className:"mr-1 size-3.5"}),"Add"]})]}),(0,ue.jsx)("div",{className:"space-y-2",children:e.recipients.length===0?(0,ue.jsx)("p",{className:"text-sm text-muted-foreground",children:"No recipients configured."}):e.recipients.map(N=>(0,ue.jsxs)("div",{"data-slot":"rule-recipient",className:"flex items-center gap-2",children:[(0,ue.jsxs)("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:[(0,ue.jsx)("option",{value:"user",children:"User"}),(0,ue.jsx)("option",{value:"role",children:"Role"}),(0,ue.jsx)("option",{value:"group",children:"Group"}),(0,ue.jsx)("option",{value:"field",children:"Field"})]}),(0,ue.jsx)("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=>(0,ue.jsx)("option",{value:h.value,children:h.label},h.value))}),!i&&(0,ue.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>f(N.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove recipient",children:(0,ue.jsx)(Le,{className:"size-4"})})]},N.id))})]}),(0,ue.jsxs)("div",{"data-slot":"rule-channels-section",children:[(0,ue.jsx)("label",{className:"mb-2 block text-sm font-medium text-foreground",children:"Delivery channels:"}),(0,ue.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.keys(qN).map(N=>{let h=qN[N],b=h.icon,g=e.channels.includes(N);return(0,ue.jsxs)("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:[(0,ue.jsx)(b,{className:l("size-4",g&&h.color)}),h.label]},N)})})]}),(n.length>0||e.priority)&&(0,ue.jsxs)("div",{className:"flex flex-wrap gap-4",children:[n.length>0&&(0,ue.jsxs)("div",{className:"flex-1",children:[(0,ue.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Template:"}),(0,ue.jsxs)("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:[(0,ue.jsx)("option",{value:"",children:"Default template"}),n.map(N=>(0,ue.jsx)("option",{value:N.id,children:N.name},N.id))]})]}),(0,ue.jsxs)("div",{children:[(0,ue.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Priority:"}),(0,ue.jsxs)("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:[(0,ue.jsx)("option",{value:"low",children:"Low"}),(0,ue.jsx)("option",{value:"normal",children:"Normal"}),(0,ue.jsx)("option",{value:"high",children:"High"}),(0,ue.jsx)("option",{value:"urgent",children:"Urgent"})]})]})]})]})}var Kp=M(require("react"),1);var Ve=require("react/jsx-runtime");function G2(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 j2(e){if(!e)return!1;let a=new Date(e).getDay();return a===0||a===6}function K2(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:j2(c)})}return a}function Q2({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=G2(a,r),x=n.find(w=>w.type===e),v=a?new Date(a):new Date,N=v.getFullYear(),h=v.getMonth(),b=Kp.useMemo(()=>K2(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(0,Ve.jsxs)("div",{"data-slot":"leave-request-form",className:l("space-y-5 rounded-lg border border-border bg-card p-5",p),children:[(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Leave Type"}),(0,Ve.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(w=>(0,Ve.jsx)("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&&(0,Ve.jsxs)("div",{"data-slot":"leave-balance",className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-4 py-2",children:[(0,Ve.jsx)("span",{className:"text-sm text-muted-foreground",children:"Available balance:"}),(0,Ve.jsxs)(L,{variant:k?"destructive":"default",className:"text-xs",children:[x.total-x.used," / ",x.total," ",x.unit]}),k&&f>0&&(0,Ve.jsxs)("span",{className:"text-xs text-destructive",children:["Insufficient balance for ",f," ",x.unit]})]}),(0,Ve.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Start Date"}),(0,Ve.jsxs)("div",{className:"relative",children:[(0,Ve.jsx)(mn,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,Ve.jsx)(T,{type:"date",className:"pl-8",value:a,onChange:w=>o?.(w.target.value,r),disabled:u,"aria-label":"Start date"})]})]}),(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"End Date"}),(0,Ve.jsxs)("div",{className:"relative",children:[(0,Ve.jsx)(mn,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,Ve.jsx)(T,{type:"date",className:"pl-8",value:r,onChange:w=>o?.(a,w.target.value),disabled:u,"aria-label":"End date"})]})]})]}),f>0&&(0,Ve.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,Ve.jsx)(Te,{className:"size-4 text-muted-foreground"}),(0,Ve.jsxs)("span",{className:"text-foreground",children:["Duration: ",(0,Ve.jsx)("strong",{children:f})," day",f>1?"s":""]})]}),(0,Ve.jsxs)("div",{"data-slot":"leave-calendar-preview",children:[(0,Ve.jsx)("div",{className:"mb-2 text-sm font-medium text-foreground",children:g}),(0,Ve.jsxs)("div",{className:"grid grid-cols-7 gap-1",children:[["S","M","T","W","T","F","S"].map((w,R)=>(0,Ve.jsx)("div",{className:"text-center text-[10px] font-medium text-muted-foreground",children:w},R)),b.map((w,R)=>(0,Ve.jsx)("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))]})]}),(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Reason"}),(0,Ve.jsx)("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&&(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)("label",{className:"mb-2 block text-sm font-medium text-foreground",children:"Approval Chain"}),(0,Ve.jsx)("div",{className:"flex items-center gap-2",children:i.map((w,R)=>(0,Ve.jsxs)(Kp.Fragment,{children:[(0,Ve.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-1.5",children:[(0,Ve.jsx)("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)}),(0,Ve.jsxs)("div",{children:[(0,Ve.jsx)("div",{className:"text-sm font-medium text-foreground",children:w.name}),w.title&&(0,Ve.jsx)("div",{className:"text-xs text-muted-foreground",children:w.title})]})]}),R<i.length-1&&(0,Ve.jsx)("span",{className:"text-muted-foreground",children:"\u2192"})]},w.id))})]}),!u&&(0,Ve.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-4",children:[m&&(0,Ve.jsx)(C,{variant:"outline",onClick:m,children:"Cancel"}),d&&(0,Ve.jsx)(C,{onClick:d,disabled:k&&f>0,children:"Submit Request"})]})]})}var Be=require("react/jsx-runtime"),Yf=["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 X2(e,t,a,r,o){return o.find(n=>n.roomId===e&&n.date===t&&!(n.endTime<=a||n.startTime>=r))??null}function Y2({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=X2(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(0,Be.jsxs)("div",{"data-slot":"meeting-room-booking",className:l("space-y-4 rounded-lg border border-border bg-card p-5",v),children:[(0,Be.jsxs)("div",{children:[(0,Be.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Meeting Title"}),(0,Be.jsx)(T,{value:d,onChange:k=>m?.(k.target.value),placeholder:"Quarterly Review",disabled:x,"aria-label":"Meeting title"})]}),(0,Be.jsxs)("div",{children:[(0,Be.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Date"}),(0,Be.jsx)(T,{type:"date",value:o,onChange:k=>n?.(k.target.value),disabled:x,"aria-label":"Booking date"})]}),(0,Be.jsxs)("div",{children:[(0,Be.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Select Room"}),(0,Be.jsx)("div",{className:"grid grid-cols-2 gap-2",children:e.map(k=>(0,Be.jsxs)("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:[(0,Be.jsx)("span",{className:"text-sm font-medium text-foreground",children:k.name}),(0,Be.jsxs)("div",{className:"mt-1 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,Be.jsxs)("span",{className:"flex items-center gap-1",children:[(0,Be.jsx)(fl,{className:"size-3"}),k.capacity]}),k.floor&&(0,Be.jsxs)("span",{children:["\u2022 ",k.floor]})]}),k.equipment&&k.equipment.length>0&&(0,Be.jsx)("div",{className:"mt-1 flex flex-wrap gap-1",children:k.equipment.map(w=>(0,Be.jsx)(L,{variant:"outline",className:"text-[9px]",children:w},w))})]},k.id))})]}),(0,Be.jsxs)("div",{children:[(0,Be.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Time Slot"}),(0,Be.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Be.jsx)("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:Yf.map(k=>(0,Be.jsx)("option",{value:k,children:k},k))}),(0,Be.jsx)("span",{className:"text-muted-foreground",children:"to"}),(0,Be.jsx)("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:Yf.map(k=>(0,Be.jsx)("option",{value:k,children:k},k))})]})]}),(0,Be.jsxs)("div",{children:[(0,Be.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Attendees"}),(0,Be.jsx)(T,{type:"number",min:1,value:u,onChange:k=>p?.(parseInt(k.target.value)||1),disabled:x,"aria-label":"Attendee count"}),b&&(0,Be.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-xs text-destructive",children:[(0,Be.jsx)(Vo,{className:"size-3"}),"Exceeds room capacity (",h?.capacity,")"]})]}),N&&(0,Be.jsxs)("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:[(0,Be.jsx)(Vo,{className:"mt-0.5 size-4 text-destructive"}),(0,Be.jsxs)("div",{className:"text-sm",children:[(0,Be.jsx)("p",{className:"font-medium text-destructive",children:"Time Conflict"}),(0,Be.jsxs)("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&&(0,Be.jsxs)("div",{"data-slot":"room-schedule",children:[(0,Be.jsx)("div",{className:"mb-1.5 text-sm font-medium text-foreground",children:"Today's Schedule"}),(0,Be.jsx)("div",{className:"space-y-1",children:g.map(k=>(0,Be.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,Be.jsx)(Te,{className:"size-3"}),(0,Be.jsxs)("span",{children:[k.startTime," - ",k.endTime]}),(0,Be.jsx)("span",{className:"text-foreground",children:k.title}),(0,Be.jsxs)("span",{children:["(",k.bookedBy,")"]})]},k.id))})]}),a&&o&&(0,Be.jsxs)("div",{"data-slot":"slot-grid",children:[(0,Be.jsx)("div",{className:"mb-1.5 text-sm font-medium text-foreground",children:"Availability"}),(0,Be.jsx)("div",{className:"grid grid-cols-6 gap-1",children:Yf.map(k=>(0,Be.jsx)("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&&(0,Be.jsx)(C,{className:"w-full",onClick:f,disabled:!!N||!a||!o,children:"Book Room"})]})}var Zd=M(require("react"),1);var Ga=require("react/jsx-runtime"),Qp={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 J2(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 Z2({year:e,month:t,records:a,onMonthChange:r,onDayClick:o,className:n}){let i=new Date,[c,s]=Zd.useState(e??i.getFullYear()),[d,m]=Zd.useState(t??i.getMonth()),u=Zd.useMemo(()=>{let h=new Map;for(let b of a)h.set(b.date,b);return h},[a]),p=Zd.useMemo(()=>J2(c,d),[c,d]),f=new Date(c,d,1).toLocaleString("en-US",{month:"long",year:"numeric"}),x=Zd.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(0,Ga.jsxs)("div",{"data-slot":"attendance-calendar",className:l("rounded-lg border border-border bg-card p-4",n),children:[(0,Ga.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,Ga.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:f}),(0,Ga.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Ga.jsx)("button",{type:"button",onClick:v,className:"rounded p-1 hover:bg-muted","aria-label":"Previous month",children:(0,Ga.jsx)($t,{className:"size-4"})}),(0,Ga.jsx)("button",{type:"button",onClick:N,className:"rounded p-1 hover:bg-muted","aria-label":"Next month",children:(0,Ga.jsx)(ke,{className:"size-4"})})]})]}),(0,Ga.jsx)("div",{className:"mb-3 flex flex-wrap gap-2",children:Object.keys(Qp).map(h=>x[h]===0&&h!=="weekend"?null:(0,Ga.jsxs)("div",{className:"flex items-center gap-1 text-xs",children:[(0,Ga.jsx)("span",{className:l("size-2 rounded-full",Qp[h].dot)}),(0,Ga.jsx)("span",{className:"text-muted-foreground",children:Qp[h].label}),(0,Ga.jsx)("span",{className:"font-medium text-foreground",children:x[h]})]},h))}),(0,Ga.jsxs)("div",{className:"grid grid-cols-7 gap-1",children:[["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(h=>(0,Ga.jsx)("div",{className:"text-center text-[10px] font-medium text-muted-foreground pb-1",children:h},h)),p.map((h,b)=>{if(!h.date)return(0,Ga.jsx)("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=Qp[w];return(0,Ga.jsxs)("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:[(0,Ga.jsx)("span",{className:l("text-xs font-medium",R.text),children:h.day}),g&&(0,Ga.jsxs)("div",{className:"mt-0.5 flex-1 text-[9px]",children:[g.checkIn&&(0,Ga.jsxs)("div",{className:R.text,children:["In: ",g.checkIn]}),g.checkOut&&(0,Ga.jsxs)("div",{className:R.text,children:["Out: ",g.checkOut]}),g.note&&(0,Ga.jsx)("div",{className:l("truncate",R.text),children:g.note})]})]},b)})]})]})}var Yp=M(require("react"),1);var Y=require("react/jsx-runtime");function eI(){return`po-line-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function Xp(e,t="\xA5"){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function jN({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=Yp.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:eI(),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(0,Y.jsxs)("div",{"data-slot":"purchase-order-editor",className:l("space-y-4",x),children:[(0,Y.jsx)("div",{className:"flex items-center justify-between rounded-lg border border-border bg-card p-4",children:(0,Y.jsxs)("div",{className:"flex items-center gap-3",children:[(0,Y.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Purchase Order"}),e&&(0,Y.jsx)(L,{variant:"outline",className:"font-mono text-xs",children:e}),(0,Y.jsx)(L,{variant:g[m].variant,children:g[m].label})]})}),(0,Y.jsxs)("div",{className:"grid grid-cols-2 gap-3 rounded-lg border border-border bg-card p-4 md:grid-cols-4",children:[(0,Y.jsxs)("div",{children:[(0,Y.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Vendor"}),(0,Y.jsx)(T,{value:t??"",onChange:y=>a?.(y.target.value),disabled:p,placeholder:"Vendor name","aria-label":"Vendor"})]}),(0,Y.jsxs)("div",{children:[(0,Y.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Order Date"}),(0,Y.jsx)(T,{type:"date",value:r??"",onChange:y=>i?.("orderDate",y.target.value),disabled:p,"aria-label":"Order date"})]}),(0,Y.jsxs)("div",{children:[(0,Y.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Expected Delivery"}),(0,Y.jsx)(T,{type:"date",value:o??"",onChange:y=>i?.("expectedDelivery",y.target.value),disabled:p,"aria-label":"Expected delivery"})]}),(0,Y.jsxs)("div",{children:[(0,Y.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Payment Terms"}),(0,Y.jsx)(T,{value:n??"",onChange:y=>i?.("paymentTerms",y.target.value),disabled:p,placeholder:"Net 30","aria-label":"Payment terms"})]})]}),(0,Y.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,Y.jsxs)(at,{children:[(0,Y.jsx)(rt,{children:(0,Y.jsxs)(K,{className:"bg-muted/30",children:[(0,Y.jsx)(F,{className:"min-w-[120px]",children:"Product Code"}),(0,Y.jsx)(F,{className:"min-w-[160px]",children:"Product Name"}),(0,Y.jsx)(F,{className:"w-20 text-right",children:"Qty"}),(0,Y.jsx)(F,{className:"w-16",children:"Unit"}),(0,Y.jsx)(F,{className:"w-28 text-right",children:"Unit Price"}),(0,Y.jsx)(F,{className:"w-20 text-right",children:"Tax %"}),(0,Y.jsx)(F,{className:"w-28 text-right",children:"Line Total"}),!p&&(0,Y.jsx)(F,{className:"w-12"})]})}),(0,Y.jsx)(Oe,{children:c.length===0?(0,Y.jsx)(K,{children:(0,Y.jsx)(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(0,Y.jsxs)(K,{"data-slot":"po-line-item",children:[(0,Y.jsx)(D,{children:(0,Y.jsx)(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"})}),(0,Y.jsx)(D,{children:(0,Y.jsx)(T,{className:"h-8 text-sm",value:y.productName,onChange:w=>b(y.id,"productName",w.target.value),disabled:p,"aria-label":"Product name"})}),(0,Y.jsx)(D,{children:(0,Y.jsx)(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})}),(0,Y.jsx)(D,{children:(0,Y.jsx)(T,{className:"h-8 text-sm",value:y.unit,onChange:w=>b(y.id,"unit",w.target.value),disabled:p,"aria-label":"Unit"})}),(0,Y.jsx)(D,{children:(0,Y.jsx)(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"})}),(0,Y.jsx)(D,{children:(0,Y.jsx)(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})}),(0,Y.jsx)(D,{className:"text-right text-sm font-medium tabular-nums",children:Xp(k,u)}),!p&&(0,Y.jsx)(D,{children:(0,Y.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>h(y.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:(0,Y.jsx)(Le,{className:"size-4"})})})]},y.id)})}),c.length>0&&(0,Y.jsxs)(Oe,{children:[(0,Y.jsxs)(K,{className:"border-t-2 bg-muted/50",children:[(0,Y.jsx)(D,{colSpan:5,className:"text-right text-sm font-medium",children:"Subtotal:"}),(0,Y.jsx)(D,{className:"text-right text-sm tabular-nums","data-slot":"po-subtotal",children:Xp(v.subtotal,u)}),!p&&(0,Y.jsx)(D,{})]}),(0,Y.jsxs)(K,{className:"bg-muted/50",children:[(0,Y.jsx)(D,{colSpan:5,className:"text-right text-sm font-medium",children:"Tax:"}),(0,Y.jsx)(D,{className:"text-right text-sm tabular-nums","data-slot":"po-tax",children:Xp(v.tax,u)}),!p&&(0,Y.jsx)(D,{})]}),(0,Y.jsxs)(K,{className:"bg-muted/50 font-semibold",children:[(0,Y.jsx)(D,{colSpan:5,className:"text-right text-sm",children:"Grand Total:"}),(0,Y.jsx)(D,{className:"text-right text-sm tabular-nums text-primary","data-slot":"po-total",children:Xp(v.total,u)}),!p&&(0,Y.jsx)(D,{})]})]})]})}),!p&&(0,Y.jsxs)(C,{variant:"outline",size:"sm",onClick:N,children:[(0,Y.jsx)(Re,{className:"mr-1 size-4"}),"Add Line"]}),d.length>0&&(0,Y.jsxs)("div",{"data-slot":"po-approval-flow",className:"rounded-lg border border-border bg-card p-4",children:[(0,Y.jsx)("h4",{className:"mb-3 text-sm font-medium text-foreground",children:"Approval Flow"}),(0,Y.jsx)("div",{className:"flex items-center gap-2",children:d.map((y,k)=>(0,Y.jsxs)(Yp.Fragment,{children:[(0,Y.jsxs)("div",{className:"flex flex-col items-center gap-1","data-slot":"approval-step","data-status":y.status,children:[y.status==="approved"?(0,Y.jsx)(ft,{className:"size-6 text-green-600"}):y.status==="current"?(0,Y.jsx)(Te,{className:"size-6 text-yellow-500"}):y.status==="rejected"?(0,Y.jsx)(Bn,{className:"size-6 text-red-500"}):(0,Y.jsx)(Bn,{className:"size-6 text-muted-foreground"}),(0,Y.jsx)("span",{className:"text-xs font-medium text-foreground",children:y.approver}),y.title&&(0,Y.jsx)("span",{className:"text-[10px] text-muted-foreground",children:y.title})]}),k<d.length-1&&(0,Y.jsx)("div",{className:l("h-0.5 w-8",y.status==="approved"?"bg-green-500":"bg-border")})]},y.id))})]}),!p&&f&&(0,Y.jsx)("div",{className:"flex justify-end gap-2 border-t border-border pt-4",children:(0,Y.jsx)(C,{onClick:f,children:"Submit for Approval"})})]})}var pe=require("react/jsx-runtime");function tI(){return`st-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function aI({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:tI(),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(0,pe.jsxs)("div",{"data-slot":"stock-transfer-dialog",className:l("space-y-4 rounded-lg border border-border bg-card p-5",v),children:[(0,pe.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,pe.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Stock Transfer"}),e&&(0,pe.jsx)(L,{variant:"outline",className:"font-mono",children:e})]}),(0,pe.jsxs)("div",{className:"grid grid-cols-[1fr_auto_1fr] items-end gap-3",children:[(0,pe.jsxs)("div",{children:[(0,pe.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"From Warehouse"}),(0,pe.jsxs)("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:[(0,pe.jsx)("option",{value:"",children:"Select source"}),n.map(k=>(0,pe.jsx)("option",{value:k,children:k},k))]})]}),(0,pe.jsx)(co,{className:"mb-2 size-5 text-muted-foreground"}),(0,pe.jsxs)("div",{children:[(0,pe.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"To Warehouse"}),(0,pe.jsxs)("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:[(0,pe.jsx)("option",{value:"",children:"Select destination"}),n.map(k=>(0,pe.jsx)("option",{value:k,children:k},k))]})]})]}),y&&(0,pe.jsx)("p",{className:"text-xs text-destructive",children:"Source and destination cannot be the same"}),(0,pe.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pe.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Type:"}),(0,pe.jsxs)("div",{className:"flex gap-1",children:[(0,pe.jsx)("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"}),(0,pe.jsx)("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"})]})]}),(0,pe.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,pe.jsxs)(at,{children:[(0,pe.jsx)(rt,{children:(0,pe.jsxs)(K,{className:"bg-muted/30",children:[(0,pe.jsx)(F,{className:"min-w-[120px]",children:"Product Code"}),(0,pe.jsx)(F,{className:"min-w-[160px]",children:"Product Name"}),(0,pe.jsx)(F,{className:"w-20 text-right",children:"Qty"}),(0,pe.jsx)(F,{className:"w-16",children:"Unit"}),(0,pe.jsx)(F,{className:"min-w-[120px]",children:"Batch No"}),(0,pe.jsx)(F,{className:"w-24 text-right",children:"Available"}),!x&&(0,pe.jsx)(F,{className:"w-12"})]})}),(0,pe.jsx)(Oe,{children:i.length===0?(0,pe.jsx)(K,{children:(0,pe.jsx)(D,{colSpan:x?6:7,className:"py-6 text-center text-muted-foreground",children:"No items"})}):i.map(k=>(0,pe.jsxs)(K,{"data-slot":"transfer-line",children:[(0,pe.jsx)(D,{children:(0,pe.jsx)(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"})}),(0,pe.jsx)(D,{children:(0,pe.jsx)(T,{className:"h-8 text-sm",value:k.productName,onChange:w=>b(k.id,"productName",w.target.value),disabled:x,"aria-label":"Product name"})}),(0,pe.jsx)(D,{children:(0,pe.jsx)(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})}),(0,pe.jsx)(D,{children:(0,pe.jsx)(T,{className:"h-8 text-sm",value:k.unit,onChange:w=>b(k.id,"unit",w.target.value),disabled:x,"aria-label":"Unit"})}),(0,pe.jsx)(D,{children:(0,pe.jsx)(T,{className:"h-8 text-sm",value:k.batchNo??"",onChange:w=>b(k.id,"batchNo",w.target.value),disabled:x,"aria-label":"Batch number"})}),(0,pe.jsx)(D,{className:"text-right text-sm tabular-nums text-muted-foreground",children:k.availableQty??"\u2014"}),!x&&(0,pe.jsx)(D,{children:(0,pe.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>h(k.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:(0,pe.jsx)(Le,{className:"size-4"})})})]},k.id))})]})}),(0,pe.jsxs)("div",{className:"flex items-center justify-between",children:[!x&&(0,pe.jsxs)(C,{variant:"outline",size:"sm",onClick:N,children:[(0,pe.jsx)(Re,{className:"mr-1 size-4"}),"Add Item"]}),(0,pe.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Total: ",(0,pe.jsx)("strong",{className:"text-foreground",children:g})," units"]})]}),(0,pe.jsxs)("div",{children:[(0,pe.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Remark"}),(0,pe.jsx)("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&&(0,pe.jsxs)("div",{className:"flex justify-end gap-2 border-t border-border pt-3",children:[f&&(0,pe.jsx)(C,{variant:"outline",onClick:f,children:"Cancel"}),p&&(0,pe.jsx)(C,{onClick:p,disabled:y,children:"Submit Transfer"})]})]})}var Zf=M(require("react"),1);var xt=require("react/jsx-runtime"),rI=[{label:"0-30",maxDays:31},{label:"31-60",maxDays:61},{label:"61-90",maxDays:91},{label:"90+",maxDays:1/0}];function oI(e,t){let a=new Date(e),r=new Date(t);return Math.floor((r.getTime()-a.getTime())/864e5)}function nI(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 Gc(e,t){let a=e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});return`${t}${a}`}var Jf=["text-emerald-600","text-amber-600","text-orange-600","text-destructive"],sI=["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 iI({entries:e,asOfDate:t,type:a="ar",buckets:r=rI,currencySymbol:o="\xA5",onRowClick:n,className:i}){let c=t??new Date().toISOString().slice(0,10),s=Zf.useMemo(()=>e.map(p=>{let f=Math.max(0,oI(p.dueDate,c)),x=nI(f,r);return{...p,overdueDays:f,bucketIdx:x}}),[e,c,r]),d=Zf.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(0,xt.jsxs)("div",{"data-slot":"ar-ap-aging-table",className:l("space-y-4 rounded-lg border border-border bg-card p-5",i),children:[(0,xt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,xt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,xt.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:a==="ar"?"AR Aging":"AP Aging"}),(0,xt.jsxs)(L,{variant:"outline",className:"text-xs",children:["as of ",c]})]}),(0,xt.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Total:"," ",(0,xt.jsx)("strong",{className:l("tabular-nums",m>0?"text-foreground":""),children:Gc(m,o)})]})]}),(0,xt.jsx)("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r.length}, 1fr)`},children:r.map((p,f)=>(0,xt.jsxs)("div",{"data-slot":"aging-bucket-summary",className:l("rounded-md border border-border p-3",sI[f]??"bg-muted/30"),children:[(0,xt.jsxs)("div",{className:"text-xs text-muted-foreground",children:[p.label," days"]}),(0,xt.jsx)("div",{className:l("text-lg font-bold tabular-nums",Jf[f]??"text-foreground"),children:Gc(d[f],o)})]},p.label))}),(0,xt.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,xt.jsxs)(at,{children:[(0,xt.jsx)(rt,{children:(0,xt.jsxs)(K,{className:"bg-muted/30",children:[(0,xt.jsx)(F,{className:"min-w-[120px]",children:"Party"}),(0,xt.jsx)(F,{className:"min-w-[120px]",children:"Doc No"}),(0,xt.jsx)(F,{className:"w-28",children:"Doc Date"}),(0,xt.jsx)(F,{className:"w-28",children:"Due Date"}),u.map(p=>(0,xt.jsx)(F,{className:"w-28 text-right",children:p},p)),(0,xt.jsx)(F,{className:"w-28 text-right",children:"Total"})]})}),(0,xt.jsx)(Oe,{children:s.length===0?(0,xt.jsx)(K,{children:(0,xt.jsxs)(D,{colSpan:5+r.length,className:"py-8 text-center text-muted-foreground",children:["No ",a==="ar"?"receivables":"payables"," found"]})}):s.map(p=>(0,xt.jsxs)(K,{"data-slot":"aging-row",className:l(n&&"cursor-pointer hover:bg-muted/30"),onClick:()=>n?.(p),children:[(0,xt.jsx)(D,{className:"font-medium text-foreground",children:p.partyName}),(0,xt.jsx)(D,{className:"font-mono text-xs text-muted-foreground",children:p.docNo}),(0,xt.jsx)(D,{className:"text-sm text-muted-foreground",children:p.docDate}),(0,xt.jsx)(D,{className:"text-sm text-muted-foreground",children:p.dueDate}),r.map((f,x)=>(0,xt.jsx)(D,{className:l("text-right text-sm tabular-nums",p.bucketIdx===x?l("font-semibold",Jf[x]??"text-foreground"):"text-muted-foreground"),children:p.bucketIdx===x?Gc(p.amount,o):"\u2014"},x)),(0,xt.jsx)(D,{className:"text-right text-sm font-bold tabular-nums text-foreground",children:Gc(p.amount,o)})]},p.id))}),s.length>0&&(0,xt.jsx)(Oi,{children:(0,xt.jsxs)(K,{className:"bg-muted/30 font-semibold",children:[(0,xt.jsx)(D,{colSpan:4,children:"Total"}),d.map((p,f)=>(0,xt.jsx)(D,{className:l("text-right tabular-nums",Jf[f]??"text-foreground"),children:Gc(p,o)},f)),(0,xt.jsx)(D,{className:"text-right tabular-nums text-foreground",children:Gc(m,o)})]})})]})})]})}var ru=M(require("react"),1);var Qt=require("react/jsx-runtime"),KN={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"}},lI={high:"border-l-rose-500",medium:"border-l-amber-500",low:"border-l-emerald-500"};function Jp(e,t){return`${t}${e.toLocaleString("en-US",{maximumFractionDigits:0})}`}function dI({stages:e,deals:t,onDealMove:a,onDealClick:r,currencySymbol:o="\xA5",readOnly:n=!1,className:i}){let[c,s]=ru.useState(null),[d,m]=ru.useState(null),u=ru.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(0,Qt.jsxs)("div",{"data-slot":"lead-pipeline-board",className:l("space-y-4 rounded-lg border border-border bg-card p-5",i),children:[(0,Qt.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,Qt.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Pipeline"}),(0,Qt.jsxs)("div",{className:"flex items-center gap-4 text-sm",children:[(0,Qt.jsxs)("div",{className:"text-muted-foreground",children:["Deals: ",(0,Qt.jsx)("strong",{className:"text-foreground",children:t.length})]}),(0,Qt.jsxs)("div",{className:"text-muted-foreground",children:["Total: ",(0,Qt.jsx)("strong",{className:"text-foreground tabular-nums",children:Jp(p,o)})]}),(0,Qt.jsxs)("div",{className:"text-muted-foreground",children:["Weighted: ",(0,Qt.jsx)("strong",{className:"text-foreground tabular-nums",children:Jp(f,o)})]})]})]}),(0,Qt.jsx)("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=KN[h.color??"blue"]??KN.blue,k=d===h.id;return(0,Qt.jsxs)("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:[(0,Qt.jsxs)("div",{className:l("rounded-t-lg border-b border-border px-3 py-2"),children:[(0,Qt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Qt.jsx)("span",{className:l("text-sm font-semibold",y.header),children:h.label}),(0,Qt.jsxs)("span",{className:l("rounded-full px-1.5 py-0.5 text-xs font-medium",y.badge),children:[h.probability,"%"]})]}),(0,Qt.jsxs)("div",{className:"mt-1 flex items-center justify-between text-xs text-muted-foreground",children:[(0,Qt.jsxs)("span",{children:[b.length," deals"]}),(0,Qt.jsx)("span",{className:"tabular-nums",children:Jp(g,o)})]}),(0,Qt.jsx)("div",{className:"mt-1.5 h-1 overflow-hidden rounded-full bg-muted",children:(0,Qt.jsx)("div",{className:l("h-full transition-all",y.bar),style:{width:`${h.probability}%`}})})]}),(0,Qt.jsx)("div",{className:"flex-1 space-y-2 overflow-y-auto p-2",style:{maxHeight:"400px"},children:b.length===0?(0,Qt.jsx)("div",{className:"py-4 text-center text-xs text-muted-foreground",children:"No deals"}):b.map(w=>(0,Qt.jsxs)("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",lI[w.priority??"low"],c===w.id&&"opacity-50"),children:[(0,Qt.jsx)("div",{className:"text-sm font-medium text-foreground",children:w.title}),(0,Qt.jsx)("div",{className:"mt-0.5 text-xs text-muted-foreground",children:w.customer}),(0,Qt.jsxs)("div",{className:"mt-1.5 flex items-center justify-between",children:[(0,Qt.jsx)("span",{className:"text-sm font-bold tabular-nums text-foreground",children:Jp(w.value,w.currency?"":o)}),w.owner&&(0,Qt.jsx)("span",{className:"text-xs text-muted-foreground",children:w.owner})]}),w.expectedClose&&(0,Qt.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["Close: ",w.expectedClose]})]},w.id))})]},h.id)})})]})}var ne=require("react/jsx-runtime");function cI(){return`ql-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function QN(e){return e.unitPrice*(1-e.discountPct/100)}function nu(e){return QN(e)*e.quantity}function XN(e){return e.unitCost*e.quantity}function YN(e){return nu(e)-XN(e)}function mI(e){let t=nu(e);return t===0?0:YN(e)/t*100}function uI(e){return nu(e)*((e.taxRate??0)/100)}function il(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function ou(e){return e<0?"text-destructive":e<15?"text-amber-600":"text-emerald-600"}function pI({quoteNo:e,lines:t,onLinesChange:a,currencySymbol:r="\xA5",onSubmit:o,onCancel:n,readOnly:i=!1,className:c}){let s=()=>{a?.([...t,{id:cI(),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+nu(b),0),p=t.reduce((h,b)=>h+XN(b),0),f=u-p,x=t.reduce((h,b)=>h+uI(b),0),v=u+x,N=u>0?f/u*100:0;return(0,ne.jsxs)("div",{"data-slot":"quotation-line-editor",className:l("space-y-4 rounded-lg border border-border bg-card p-5",c),children:[(0,ne.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,ne.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Quotation Editor"}),e&&(0,ne.jsx)(L,{variant:"outline",className:"font-mono",children:e})]}),(0,ne.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,ne.jsxs)(at,{children:[(0,ne.jsx)(rt,{children:(0,ne.jsxs)(K,{className:"bg-muted/30",children:[(0,ne.jsx)(F,{className:"min-w-[100px]",children:"Code"}),(0,ne.jsx)(F,{className:"min-w-[140px]",children:"Product"}),(0,ne.jsx)(F,{className:"w-20 text-right",children:"Qty"}),(0,ne.jsx)(F,{className:"w-16",children:"Unit"}),(0,ne.jsx)(F,{className:"w-24 text-right",children:"Unit Cost"}),(0,ne.jsx)(F,{className:"w-24 text-right",children:"Unit Price"}),(0,ne.jsx)(F,{className:"w-20 text-right",children:"Disc%"}),(0,ne.jsx)(F,{className:"w-24 text-right",children:"Net Price"}),(0,ne.jsx)(F,{className:"w-24 text-right",children:"Subtotal"}),(0,ne.jsx)(F,{className:"w-24 text-right",children:"Profit"}),(0,ne.jsx)(F,{className:"w-20 text-right",children:"Margin"}),(0,ne.jsx)(F,{className:"w-20 text-right",children:"Tax%"}),!i&&(0,ne.jsx)(F,{className:"w-12"})]})}),(0,ne.jsx)(Oe,{children:t.length===0?(0,ne.jsx)(K,{children:(0,ne.jsx)(D,{colSpan:i?11:12,className:"py-6 text-center text-muted-foreground",children:"No line items"})}):t.map(h=>{let b=YN(h),g=mI(h);return(0,ne.jsxs)(K,{"data-slot":"quotation-line",children:[(0,ne.jsx)(D,{children:(0,ne.jsx)(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"})}),(0,ne.jsx)(D,{children:(0,ne.jsx)(T,{className:"h-8 text-sm",value:h.productName,onChange:y=>m(h.id,"productName",y.target.value),disabled:i,"aria-label":"Product name"})}),(0,ne.jsx)(D,{children:(0,ne.jsx)(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})}),(0,ne.jsx)(D,{children:(0,ne.jsx)(T,{className:"h-8 text-sm",value:h.unit,onChange:y=>m(h.id,"unit",y.target.value),disabled:i,"aria-label":"Unit"})}),(0,ne.jsx)(D,{children:(0,ne.jsx)(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})}),(0,ne.jsx)(D,{children:(0,ne.jsx)(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})}),(0,ne.jsx)(D,{children:(0,ne.jsx)(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})}),(0,ne.jsx)(D,{className:"text-right text-sm tabular-nums text-muted-foreground",children:il(QN(h),r)}),(0,ne.jsx)(D,{className:"text-right text-sm font-medium tabular-nums text-foreground",children:il(nu(h),r)}),(0,ne.jsx)(D,{className:l("text-right text-sm tabular-nums",ou(g)),children:il(b,r)}),(0,ne.jsxs)(D,{className:l("text-right text-sm font-semibold tabular-nums",ou(g)),children:[g.toFixed(1),"%"]}),(0,ne.jsx)(D,{children:(0,ne.jsx)(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&&(0,ne.jsx)(D,{children:(0,ne.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>d(h.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove line",children:(0,ne.jsx)(Le,{className:"size-4"})})})]},h.id)})}),t.length>0&&(0,ne.jsx)(Oi,{children:(0,ne.jsxs)(K,{className:"bg-muted/30 font-semibold",children:[(0,ne.jsx)(D,{colSpan:7,children:"Total"}),(0,ne.jsx)(D,{className:"text-right text-muted-foreground",children:"\u2014"}),(0,ne.jsx)(D,{className:"text-right tabular-nums text-foreground",children:il(u,r)}),(0,ne.jsx)(D,{className:l("text-right tabular-nums",ou(N)),children:il(f,r)}),(0,ne.jsxs)(D,{className:l("text-right tabular-nums",ou(N)),children:[N.toFixed(1),"%"]}),(0,ne.jsx)(D,{className:"text-right text-muted-foreground",children:il(x,r)}),!i&&(0,ne.jsx)(D,{})]})})]})}),(0,ne.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ne.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,ne.jsxs)("div",{className:"text-muted-foreground",children:["Subtotal: ",(0,ne.jsx)("strong",{className:"text-foreground tabular-nums",children:il(u,r)})," \xB7 ","Tax: ",(0,ne.jsx)("strong",{className:"text-foreground tabular-nums",children:il(x,r)})," \xB7 ",(0,ne.jsxs)("span",{className:l("font-semibold",ou(N)),children:["Margin: ",N.toFixed(1),"%"]})]}),(0,ne.jsxs)("div",{className:"text-base font-bold text-foreground",children:["Grand Total: ",(0,ne.jsx)("span",{className:"tabular-nums",children:il(v,r)})]})]}),(0,ne.jsxs)("div",{className:"flex items-center gap-2",children:[!i&&(0,ne.jsxs)(C,{variant:"outline",size:"sm",onClick:s,children:[(0,ne.jsx)(Re,{className:"mr-1 size-4"}),"Add Line"]}),!i&&n&&(0,ne.jsx)(C,{variant:"outline",onClick:n,children:"Cancel"}),!i&&o&&(0,ne.jsx)(C,{onClick:o,children:"Save Quotation"})]})]})]})}var Se=require("react/jsx-runtime"),gI={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"}},fI={order:"\u{1F6D2}",call:"\u{1F4DE}",email:"\u2709\uFE0F",meeting:"\u{1F5D3}\uFE0F",note:"\u{1F4DD}",ticket:"\u{1F3AB}"};function bI(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 xI={up:"\u2191",down:"\u2193",flat:"\u2192"},vI={up:"text-emerald-600",down:"text-destructive",flat:"text-muted-foreground"};function hI(e,t){return`${t}${e.toLocaleString("en-US",{maximumFractionDigits:0})}`}function yI({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?gI[r]:null,f=o!=null?bI(o):null,x=o??0;return(0,Se.jsxs)("div",{"data-slot":"customer-360-card",className:l("space-y-5 rounded-xl border border-border bg-card p-5 shadow-sm",u),children:[(0,Se.jsxs)("div",{className:"flex items-start gap-4",children:[(0,Se.jsx)("div",{className:"flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-muted",children:t?(0,Se.jsx)("img",{src:t,alt:e,className:"size-full object-cover"}):(0,Se.jsx)("span",{className:"text-2xl font-bold text-primary",children:e.charAt(0)})}),(0,Se.jsxs)("div",{className:"flex-1",children:[(0,Se.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Se.jsx)("h3",{className:"text-xl font-semibold text-foreground",children:e}),p&&(0,Se.jsx)(L,{className:l("text-xs",p.className),children:p.label})]}),a&&(0,Se.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:a}),m.length>0&&(0,Se.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:m.map(v=>(0,Se.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:v},v))})]}),f&&(0,Se.jsxs)("div",{className:"flex flex-col items-center","data-slot":"health-score",children:[(0,Se.jsxs)("div",{className:"relative size-16",children:[(0,Se.jsxs)("svg",{className:"size-16 -rotate-90",viewBox:"0 0 64 64",children:[(0,Se.jsx)("circle",{cx:"32",cy:"32",r:"28",fill:"none",stroke:"currentColor",strokeWidth:"6",className:"text-muted"}),(0,Se.jsx)("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`})]}),(0,Se.jsx)("div",{className:l("absolute inset-0 flex items-center justify-center text-lg font-bold",f.text),children:x})]}),(0,Se.jsx)("span",{className:"mt-0.5 text-xs text-muted-foreground",children:"Health"})]})]}),n.length>0&&(0,Se.jsx)("div",{"data-slot":"customer-metrics",className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:n.map(v=>(0,Se.jsxs)("div",{"data-slot":"customer-metric",className:"rounded-lg border border-border bg-muted/20 p-3",children:[(0,Se.jsx)("div",{className:"text-xs text-muted-foreground",children:v.label}),(0,Se.jsx)("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:v.value}),v.trend&&v.delta&&(0,Se.jsxs)("div",{className:l("mt-0.5 flex items-center gap-1 text-xs",vI[v.trend]),children:[(0,Se.jsx)("span",{children:xI[v.trend]}),(0,Se.jsx)("span",{children:v.delta})]})]},v.label))}),s!=null&&(0,Se.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-primary/20 bg-primary/5 px-4 py-2.5",children:[(0,Se.jsx)("span",{className:"text-sm text-muted-foreground",children:"Lifetime Value"}),(0,Se.jsx)("span",{className:"text-xl font-bold tabular-nums text-primary",children:hI(s,d)})]}),(0,Se.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[i.length>0&&(0,Se.jsxs)("div",{"data-slot":"customer-contacts",children:[(0,Se.jsx)("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Key Contacts"}),(0,Se.jsx)("div",{className:"space-y-2",children:i.map(v=>(0,Se.jsxs)("div",{"data-slot":"contact-item",className:"flex items-center gap-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[(0,Se.jsx)("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)}),(0,Se.jsxs)("div",{className:"flex-1",children:[(0,Se.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,Se.jsx)("span",{className:"text-sm font-medium text-foreground",children:v.name}),v.isPrimary&&(0,Se.jsx)(L,{variant:"outline",className:"text-[10px]",children:"Primary"})]}),(0,Se.jsx)("div",{className:"text-xs text-muted-foreground",children:v.title})]}),(0,Se.jsxs)("div",{className:"text-right text-xs text-muted-foreground",children:[v.phone&&(0,Se.jsx)("div",{children:v.phone}),v.email&&(0,Se.jsx)("div",{className:"truncate",children:v.email})]})]},v.id))})]}),c.length>0&&(0,Se.jsxs)("div",{"data-slot":"customer-activities",children:[(0,Se.jsx)("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Recent Activity"}),(0,Se.jsx)("div",{className:"space-y-2",children:c.map(v=>(0,Se.jsxs)("div",{"data-slot":"activity-item",className:"flex items-start gap-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[(0,Se.jsx)("span",{className:"text-base",children:fI[v.type]??"\u2022"}),(0,Se.jsxs)("div",{className:"flex-1",children:[(0,Se.jsx)("div",{className:"text-sm font-medium text-foreground",children:v.title}),v.description&&(0,Se.jsx)("div",{className:"text-xs text-muted-foreground",children:v.description}),(0,Se.jsx)("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&&(0,Se.jsx)("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No customer data available"})]})}var eb=M(require("react"),1);var gt=require("react/jsx-runtime");function NI(e){return e.length===0?0:e.reduce((t,a)=>t+a,0)/e.length}function CI(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 kI(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 Mi(e,t){return`${e.toFixed(2)}${t??""}`}function wI({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}=eb.useMemo(()=>{let I=a??NI(v),E=n??CI(v,I);return{cl:I,sd:E}},[a,n,v]),b=r??N+3*h,g=o??N-3*h,y=eb.useMemo(()=>kI(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,A=I=>e.length<=1?p.left+f/2:p.left+I/(e.length-1)*f,z=e.map((I,E)=>`${E===0?"M":"L"} ${A(E)} ${S(I.value)}`).join(" "),U=N+2*h,B=N-2*h,O=h>0?Math.min((b-N)/(3*h),(N-g)/(3*h)):0;return(0,gt.jsxs)("div",{"data-slot":"spc-control-chart",className:l("space-y-3 rounded-lg border border-border bg-card p-5",m),children:[(0,gt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,gt.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:t}),(0,gt.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,gt.jsxs)(L,{variant:"outline",className:"text-xs",children:["CL: ",Mi(N,s)]}),(0,gt.jsxs)(L,{variant:"outline",className:"text-xs",children:["\u03C3: ",Mi(h,s)]}),(0,gt.jsxs)(L,{variant:O>=1.33?"default":"destructive",className:"text-xs",children:["Cpk: ",O.toFixed(2)]}),y.size>0&&(0,gt.jsxs)(L,{variant:"destructive",className:"text-xs","data-slot":"violation-badge",children:[y.size," violation",y.size>1?"s":""]})]})]}),(0,gt.jsx)("div",{className:"overflow-x-auto",children:(0,gt.jsxs)("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 E=p.top+x*I;return(0,gt.jsx)("line",{x1:p.left,y1:E,x2:u-p.right,y2:E,stroke:"currentColor",strokeWidth:"0.5",className:"text-border"},I)}),i&&h>0&&(0,gt.jsxs)(gt.Fragment,{children:[(0,gt.jsx)("line",{x1:p.left,y1:S(U),x2:u-p.right,y2:S(U),stroke:"currentColor",strokeWidth:"1",strokeDasharray:"6 4",className:"text-amber-500"}),(0,gt.jsxs)("text",{x:p.left-8,y:S(U)-4,textAnchor:"end",className:"fill-amber-600 text-[10px]",children:["+2\u03C3: ",Mi(U,s)]}),(0,gt.jsx)("line",{x1:p.left,y1:S(B),x2:u-p.right,y2:S(B),stroke:"currentColor",strokeWidth:"1",strokeDasharray:"6 4",className:"text-amber-500"}),(0,gt.jsxs)("text",{x:p.left-8,y:S(B)+12,textAnchor:"end",className:"fill-amber-600 text-[10px]",children:["-2\u03C3: ",Mi(B,s)]})]}),(0,gt.jsx)("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"}),(0,gt.jsxs)("text",{x:p.left-8,y:S(b)-4,textAnchor:"end",className:"fill-destructive text-[10px] font-medium",children:["UCL: ",Mi(b,s)]}),(0,gt.jsx)("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"}),(0,gt.jsxs)("text",{x:p.left-8,y:S(g)+12,textAnchor:"end",className:"fill-destructive text-[10px] font-medium",children:["LCL: ",Mi(g,s)]}),(0,gt.jsx)("line",{x1:p.left,y1:S(N),x2:u-p.right,y2:S(N),stroke:"currentColor",strokeWidth:"1.5",className:"text-primary"}),(0,gt.jsxs)("text",{x:p.left-8,y:S(N)-4,textAnchor:"end",className:"fill-primary text-[10px] font-medium",children:["CL: ",Mi(N,s)]}),(0,gt.jsx)("path",{d:z,fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-foreground/70"}),e.map((I,E)=>{let _=y.has(E);return(0,gt.jsxs)("g",{children:[(0,gt.jsx)("circle",{cx:A(E),cy:S(I.value),r:_?5:3.5,fill:_?"currentColor":"white",stroke:"currentColor",strokeWidth:"1.5",className:_?"text-destructive":"text-primary"}),_&&(0,gt.jsx)("text",{x:A(E),y:S(I.value)-10,textAnchor:"middle",className:"fill-destructive text-[10px] font-bold",children:"!"})]},E)}),e.map((I,E)=>{let _=Math.ceil(e.length/15);return E%_!==0&&E!==e.length-1?null:(0,gt.jsx)("text",{x:A(E),y:d-p.bottom+16,textAnchor:"middle",className:"fill-muted-foreground text-[10px]",children:I.label},`label-${E}`)}),c&&(0,gt.jsx)("text",{x:-(d/2),y:16,transform:"rotate(-90)",textAnchor:"middle",className:"fill-muted-foreground text-xs",children:c})]})}),(0,gt.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-xs text-muted-foreground",children:[(0,gt.jsxs)("span",{children:["n = ",e.length]}),(0,gt.jsxs)("span",{children:["Min = ",Mi(Math.min(...v),s)]}),(0,gt.jsxs)("span",{children:["Max = ",Mi(Math.max(...v),s)]}),(0,gt.jsxs)("span",{children:["Range = ",Mi(Math.max(...v)-Math.min(...v),s)]}),y.size===0?(0,gt.jsx)(L,{variant:"outline",className:"text-xs text-emerald-600",children:"Process in control"}):(0,gt.jsx)(L,{variant:"destructive",className:"text-xs",children:"Out of control \u2014 investigate"})]})]})}var qe=require("react/jsx-runtime");function PI(e){return e.availability/100*(e.performance/100)*(e.quality/100)*100}function TI(e,t){return e>=t?"text-emerald-500":e>=t*.8?"text-amber-500":"text-destructive"}function RI(e,t){return e>=t?"#10b981":e>=t*.8?"#f59e0b":"#ef4444"}function eg(e){return`${e.toFixed(1)}%`}function ec(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 SI={availability:"bg-rose-500",performance:"bg-amber-500",quality:"bg-violet-500"};function Zp({label:e,value:t,target:a,sublabel:r}){let c=2*Math.PI*55,s=c-t/100*c,d=RI(t,a);return(0,qe.jsxs)("div",{className:"flex flex-col items-center","data-slot":"oee-gauge",children:[(0,qe.jsxs)("div",{className:"relative",style:{width:120,height:120},children:[(0,qe.jsxs)("svg",{width:120,height:120,className:"-rotate-90",children:[(0,qe.jsx)("circle",{cx:120/2,cy:120/2,r:55,fill:"none",stroke:"currentColor",strokeWidth:10,className:"text-muted"}),(0,qe.jsx)("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"}})]}),(0,qe.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,qe.jsx)("span",{className:l("text-2xl font-bold",TI(t,a)),children:eg(t)}),r&&(0,qe.jsx)("span",{className:"text-[10px] text-muted-foreground",children:r})]})]}),(0,qe.jsx)("span",{className:"mt-1 text-sm font-medium text-foreground",children:e})]})}function II({equipment:e,losses:t=[],title:a="OEE Dashboard",targetOee:r=85,className:o}){let n=PI(e),i=t.reduce((c,s)=>c+s.minutes,0);return(0,qe.jsxs)("div",{"data-slot":"oee-dashboard",className:l("space-y-5 rounded-xl border border-border bg-card p-5 shadow-sm",o),children:[(0,qe.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,qe.jsxs)("div",{children:[(0,qe.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:a}),(0,qe.jsx)("p",{className:"text-sm text-muted-foreground",children:e.name})]}),(0,qe.jsxs)(L,{variant:n>=r?"default":"destructive",className:"text-sm",children:["Target: ",eg(r)]})]}),(0,qe.jsxs)("div",{className:"flex flex-wrap items-center justify-around gap-4",children:[(0,qe.jsx)(Zp,{label:"OEE",value:n,target:r,sublabel:"Overall"}),(0,qe.jsx)(Zp,{label:"Availability",value:e.availability,target:90,sublabel:`${ec(e.runTime)} / ${ec(e.plannedTime)}`}),(0,qe.jsx)(Zp,{label:"Performance",value:e.performance,target:95,sublabel:`${e.totalUnits} units`}),(0,qe.jsx)(Zp,{label:"Quality",value:e.quality,target:99,sublabel:`${e.defectUnits} defects`})]}),t.length>0&&(0,qe.jsxs)("div",{"data-slot":"oee-losses",children:[(0,qe.jsxs)("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:["Loss Breakdown ",(0,qe.jsxs)("span",{className:"text-muted-foreground",children:["(",ec(i)," total)"]})]}),(0,qe.jsx)("div",{className:"space-y-1.5",children:t.map((c,s)=>{let d=i>0?c.minutes/i*100:0;return(0,qe.jsxs)("div",{"data-slot":"loss-item",className:"flex items-center gap-2",children:[(0,qe.jsx)("span",{className:"w-32 shrink-0 text-xs text-muted-foreground",children:c.label}),(0,qe.jsxs)("div",{className:"relative h-5 flex-1 overflow-hidden rounded bg-muted",children:[(0,qe.jsx)("div",{className:l("h-full rounded transition-all",SI[c.category]??"bg-muted-foreground"),style:{width:`${d}%`}}),(0,qe.jsxs)("span",{className:"absolute inset-0 flex items-center justify-end pr-2 text-[10px] font-medium text-foreground",children:[ec(c.minutes)," (",eg(d),")"]})]})]},s)})})]}),(0,qe.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,qe.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[(0,qe.jsx)("div",{className:"text-xs text-muted-foreground",children:"Planned Time"}),(0,qe.jsx)("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:ec(e.plannedTime)})]}),(0,qe.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[(0,qe.jsx)("div",{className:"text-xs text-muted-foreground",children:"Run Time"}),(0,qe.jsx)("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:ec(e.runTime)})]}),(0,qe.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[(0,qe.jsx)("div",{className:"text-xs text-muted-foreground",children:"Downtime"}),(0,qe.jsx)("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-destructive",children:ec(e.downtime)})]}),(0,qe.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3","data-slot":"oee-metric",children:[(0,qe.jsx)("div",{className:"text-xs text-muted-foreground",children:"Defect Rate"}),(0,qe.jsx)("div",{className:"mt-0.5 text-lg font-bold tabular-nums text-foreground",children:e.totalUnits>0?eg(e.defectUnits/e.totalUnits*100):"0.0%"})]})]})]})}var hte=require("react");var tt=require("react/jsx-runtime"),tg={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"}},DI={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 JN(e){let t=1;for(let a of e.children??[])t+=JN(a);return t}function MI({node:e,onBatchClick:t,isRoot:a}){let r=tg[e.type]??tg.wip??tg.wip,o=e.status?DI[e.status]:null;return r?(0,tt.jsxs)("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:[(0,tt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,tt.jsx)("span",{className:"text-base",children:r.icon}),(0,tt.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-[10px] font-medium",r.badge),children:r.label})]}),(0,tt.jsx)("div",{className:"mt-1.5 font-mono text-sm font-bold text-foreground",children:e.batchNo}),(0,tt.jsx)("div",{className:"text-sm text-muted-foreground",children:e.product}),(0,tt.jsxs)("div",{className:"mt-1.5 space-y-0.5 text-xs text-muted-foreground",children:[(0,tt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,tt.jsx)("span",{children:"Qty:"}),(0,tt.jsxs)("span",{className:"font-medium tabular-nums text-foreground",children:[e.quantity.toLocaleString()," ",e.unit]})]}),(0,tt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,tt.jsx)("span",{children:"Date:"}),(0,tt.jsx)("span",{className:"text-foreground",children:e.date})]}),e.operator&&(0,tt.jsxs)("div",{className:"flex items-center justify-between",children:[(0,tt.jsx)("span",{children:"Operator:"}),(0,tt.jsx)("span",{className:"text-foreground",children:e.operator})]})]}),o&&(0,tt.jsx)("div",{className:"mt-1.5",children:(0,tt.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-[10px] font-medium",o.className),children:o.label})})]}):null}function ZN(e,t,a=!1){let r=e.children&&e.children.length>0;return(0,tt.jsxs)("div",{"data-slot":"tree-level",className:"flex flex-col items-center",children:[(0,tt.jsx)(MI,{node:e,...t?{onBatchClick:t}:{},isRoot:a}),r&&(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)("div",{className:"h-6 w-px bg-border"}),(0,tt.jsxs)("div",{className:"relative flex justify-center gap-6",children:[e.children.length>1&&(0,tt.jsx)("div",{className:"absolute top-0 h-px bg-border",style:{left:"12%",right:"12%"}}),e.children.map((o,n)=>(0,tt.jsxs)("div",{className:"flex flex-col items-center",children:[(0,tt.jsx)("div",{className:"h-6 w-px bg-border"}),ZN(o,t)]},`${o.batchNo}-${n}`))]})]})]})}function eC({root:e,direction:t="backward",onBatchClick:a,className:r}){let o=JN(e);return(0,tt.jsxs)("div",{"data-slot":"batch-genealogy-tree",className:l("space-y-4 rounded-lg border border-border bg-card p-5",r),children:[(0,tt.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,tt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,tt.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Batch Genealogy"}),(0,tt.jsx)(L,{variant:"outline",className:"text-xs",children:t==="backward"?"\u2191 Backward Trace":"\u2193 Forward Trace"})]}),(0,tt.jsxs)("span",{className:"text-sm text-muted-foreground",children:[o," batch",o>1?"es":""," in tree"]})]}),(0,tt.jsx)("div",{className:"overflow-x-auto py-4",children:(0,tt.jsx)("div",{className:"flex justify-center min-w-fit",children:ZN(e,a,!0)})}),(0,tt.jsx)("div",{className:"flex flex-wrap items-center gap-3 border-t border-border pt-3",children:Object.entries(tg).map(([n,i])=>(0,tt.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,tt.jsx)("span",{className:"text-sm",children:i.icon}),(0,tt.jsx)("span",{className:"text-xs text-muted-foreground",children:i.label})]},n))})]})}var Ee=require("react/jsx-runtime"),BI={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"}},LI={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"}},zI={pending:"\u25CB",running:"\u25D0",done:"\u25CF",skipped:"\u2715"},AI={pending:"text-muted-foreground",running:"text-amber-500",done:"text-emerald-500",skipped:"text-rose-500"};function EI({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=BI[r],N=LI[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(0,Ee.jsxs)("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:[(0,Ee.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Ee.jsxs)("div",{className:"flex-1",children:[(0,Ee.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Ee.jsx)("div",{className:l("size-2.5 rounded-full",v.dot)}),(0,Ee.jsx)("span",{className:"font-mono text-sm font-bold text-foreground",children:e})]}),(0,Ee.jsx)("div",{className:"mt-1 text-base font-semibold text-foreground",children:t}),a&&(0,Ee.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:a})]}),(0,Ee.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,Ee.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",v.className),children:v.label}),(0,Ee.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",N.className),children:N.label}),g&&(0,Ee.jsx)("span",{className:"text-xs font-medium text-rose-600",children:"Overdue"})]})]}),(0,Ee.jsxs)("div",{className:"mt-3","data-slot":"wo-progress",children:[(0,Ee.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,Ee.jsx)("span",{className:"text-muted-foreground",children:"Progress"}),(0,Ee.jsxs)("span",{className:"font-medium tabular-nums text-foreground",children:[c.toLocaleString()," / ",i.toLocaleString()," ",s]})]}),(0,Ee.jsx)("div",{className:"mt-1 h-2 overflow-hidden rounded-full bg-muted",children:(0,Ee.jsx)("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}%`}})}),(0,Ee.jsxs)("div",{className:"mt-0.5 flex items-center justify-between text-xs text-muted-foreground",children:[(0,Ee.jsxs)("span",{children:[h.toFixed(1),"% complete"]}),b>0&&r!=="completed"&&(0,Ee.jsxs)("span",{children:[b.toLocaleString()," ",s," remaining"]})]})]}),(0,Ee.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[(0,Ee.jsxs)("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[(0,Ee.jsx)("span",{className:"text-muted-foreground",children:"Planned Start"}),(0,Ee.jsx)("div",{className:"font-medium text-foreground",children:o})]}),(0,Ee.jsxs)("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[(0,Ee.jsx)("span",{className:"text-muted-foreground",children:"Planned End"}),(0,Ee.jsx)("div",{className:l("font-medium",g?"text-rose-600":"text-foreground"),children:n})]}),m&&(0,Ee.jsxs)("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[(0,Ee.jsx)("span",{className:"text-muted-foreground",children:"Work Center"}),(0,Ee.jsx)("div",{className:"font-medium text-foreground",children:m})]}),p&&(0,Ee.jsxs)("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[(0,Ee.jsx)("span",{className:"text-muted-foreground",children:"Supervisor"}),(0,Ee.jsx)("div",{className:"font-medium text-foreground",children:p})]})]}),u.length>0&&(0,Ee.jsxs)("div",{className:"mt-3","data-slot":"wo-operations",children:[(0,Ee.jsxs)("div",{className:"mb-1.5 flex items-center justify-between",children:[(0,Ee.jsxs)("span",{className:"text-xs font-semibold text-foreground",children:["Operations (",y,"/",u.length,")"]}),k&&(0,Ee.jsxs)("span",{className:"text-xs text-amber-600",children:["Running: ",k.name]})]}),(0,Ee.jsx)("div",{className:"space-y-1",children:u.map(w=>(0,Ee.jsxs)("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:[(0,Ee.jsx)("span",{className:l("text-sm",AI[w.status]),children:zI[w.status]}),(0,Ee.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:String(w.seq).padStart(2,"0")}),(0,Ee.jsx)("span",{className:"flex-1 text-xs font-medium text-foreground",children:w.name}),(0,Ee.jsx)("span",{className:"text-xs text-muted-foreground",children:w.workCenter}),(0,Ee.jsxs)("span",{className:"text-xs tabular-nums text-muted-foreground",children:[w.completedQty,"/",w.plannedQty]}),w.operator&&(0,Ee.jsx)("span",{className:"text-xs text-muted-foreground",children:w.operator})]},w.id))})]})]})}var Ie=require("react/jsx-runtime"),FI={official:"Official Seal",financial:"Financial Seal",contract:"Contract Seal",hr:"HR Seal",invoice:"Invoice Seal",personal:"Personal Seal"},$I={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"},HI={active:"Active",custody:"In Custody",stored:"Stored",lost:"Lost",revoked:"Revoked"},VI={active:"text-emerald-600",custody:"text-blue-600",stored:"text-muted-foreground",lost:"text-destructive",revoked:"text-destructive"},tC={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 OI({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(0,Ie.jsxs)("div",{"data-slot":"seal-stamp-registry",className:l("space-y-5 rounded-lg border border-border bg-card p-5",n),children:[(0,Ie.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,Ie.jsxs)("div",{children:[(0,Ie.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Seal & Stamp Registry"}),(0,Ie.jsxs)("p",{className:"text-sm text-muted-foreground",children:[e.length," registered \xB7 ",i," active \xB7 ",c," in custody"]})]}),!o&&r&&(0,Ie.jsx)(C,{size:"sm",onClick:r,children:"Apply for Usage"})]}),(0,Ie.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:e.map(s=>(0,Ie.jsxs)("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:[(0,Ie.jsx)("div",{className:"mb-2 flex items-center justify-center",children:s.imageUrl?(0,Ie.jsx)("img",{src:s.imageUrl,alt:s.name,className:"size-16 rounded-full border-2 border-border object-cover"}):(0,Ie.jsx)("div",{className:"flex size-16 items-center justify-center rounded-full border-2 border-dashed border-border bg-card text-2xl",children:"\u{1F50F}"})}),(0,Ie.jsxs)("div",{className:"text-center",children:[(0,Ie.jsx)("div",{className:"font-medium text-foreground",children:s.name}),(0,Ie.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:s.regNo})]}),(0,Ie.jsx)("div",{className:"mt-2 flex justify-center",children:(0,Ie.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",$I[s.type]),children:FI[s.type]})}),(0,Ie.jsxs)("div",{className:"mt-2 space-y-1 text-xs",children:[(0,Ie.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ie.jsx)("span",{className:"text-muted-foreground",children:"Custodian:"}),(0,Ie.jsx)("span",{className:"font-medium text-foreground",children:s.custodian})]}),s.department&&(0,Ie.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ie.jsx)("span",{className:"text-muted-foreground",children:"Dept:"}),(0,Ie.jsx)("span",{className:"text-foreground",children:s.department})]}),(0,Ie.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ie.jsx)("span",{className:"text-muted-foreground",children:"Used:"}),(0,Ie.jsxs)("span",{className:"text-foreground",children:[s.usageCount," times"]})]}),s.lastUsed&&(0,Ie.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ie.jsx)("span",{className:"text-muted-foreground",children:"Last:"}),(0,Ie.jsx)("span",{className:"text-foreground",children:s.lastUsed})]}),(0,Ie.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Ie.jsx)("span",{className:"text-muted-foreground",children:"Status:"}),(0,Ie.jsx)("span",{className:l("font-medium",VI[s.status]),children:HI[s.status]})]})]})]},s.id))}),t.length>0&&(0,Ie.jsxs)("div",{"data-slot":"seal-usage-log",children:[(0,Ie.jsx)("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Recent Usage Log"}),(0,Ie.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,Ie.jsxs)(at,{children:[(0,Ie.jsx)(rt,{children:(0,Ie.jsxs)(K,{className:"bg-muted/30",children:[(0,Ie.jsx)(F,{className:"min-w-[100px]",children:"Applicant"}),(0,Ie.jsx)(F,{className:"min-w-[150px]",children:"Document"}),(0,Ie.jsx)(F,{className:"w-28",children:"Date"}),(0,Ie.jsx)(F,{className:"w-28",children:"Approver"}),(0,Ie.jsx)(F,{className:"w-24",children:"Status"})]})}),(0,Ie.jsx)(Oe,{children:t.map(s=>{let d=tC[s.status]??tC.pending;return(0,Ie.jsxs)(K,{"data-slot":"usage-log-row",children:[(0,Ie.jsx)(D,{className:"font-medium text-foreground",children:s.applicant}),(0,Ie.jsx)(D,{className:"text-sm text-muted-foreground",children:s.document}),(0,Ie.jsx)(D,{className:"text-sm text-muted-foreground",children:s.date}),(0,Ie.jsx)(D,{className:"text-sm text-muted-foreground",children:s.approver}),(0,Ie.jsx)(D,{children:(0,Ie.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",d.className),children:d.label})})]},s.id)})})]})})]})]})}var Vs=M(require("react"),1);var be=require("react/jsx-runtime"),UI={sedan:"Sedan",suv:"SUV",van:"Van",bus:"Bus",truck:"Truck"},aC={available:{label:"Available",className:"text-emerald-600"},in_use:{label:"In Use",className:"text-amber-600"},maintenance:{label:"Maintenance",className:"text-destructive"}},rC={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 WI(e,t,a,r){return e<r&&a<t}function _I(e,t,a,r,o){return e.filter(n=>n.vehicleId===t&&n.id!==o&&(n.status==="approved"||n.status==="pending")&&WI(a,r,n.startTime,n.endTime))}function qI({vehicles:e,bookings:t,onSubmit:a,onCancel:r,readOnly:o=!1,className:n}){let[i,c]=Vs.useState(""),[s,d]=Vs.useState(""),[m,u]=Vs.useState(""),[p,f]=Vs.useState(""),[x,v]=Vs.useState(""),[N,h]=Vs.useState(1),[b,g]=Vs.useState(""),[y,k]=Vs.useState(""),w=Vs.useMemo(()=>!i||!p||!x?[]:_I(t,i,p,x),[t,i,p,x]),R=w.length>0,S=p&&x&&x<=p,A=!o&&i&&s&&m&&p&&x&&!R&&!S,z=()=>{A&&a?.({vehicleId:i,applicant:s,destination:m,startTime:p,endTime:x,passengers:N,...b?{driver:b}:{},...y?{purpose:y}:{}})},U=e.find(B=>B.id===i);return(0,be.jsxs)("div",{"data-slot":"vehicle-booking",className:l("space-y-4 rounded-lg border border-border bg-card p-5",n),children:[(0,be.jsxs)("div",{className:"flex items-center gap-2 border-b border-border pb-3",children:[(0,be.jsx)(Ab,{className:"size-5 text-primary"}),(0,be.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Vehicle Booking"})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Select Vehicle"}),(0,be.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:e.map(B=>{let O=i===B.id,I=aC[B.status]??aC.available;return(0,be.jsxs)("button",{type:"button","data-slot":"vehicle-option","data-active":O,disabled:o||B.status==="maintenance",onClick:()=>c(B.id),className:l("flex items-center gap-3 rounded-lg border-2 p-3 text-left transition-colors",O?"border-primary bg-primary/5":"border-border bg-background hover:bg-muted/30",B.status==="maintenance"&&"cursor-not-allowed opacity-50"),children:[(0,be.jsx)("div",{className:"flex size-10 items-center justify-center rounded-lg bg-muted text-xl",children:"\u{1F697}"}),(0,be.jsxs)("div",{className:"flex-1",children:[(0,be.jsx)("div",{className:"text-sm font-medium text-foreground",children:B.model}),(0,be.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:B.plate}),(0,be.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,be.jsx)("span",{className:"text-muted-foreground",children:UI[B.type]}),(0,be.jsx)("span",{className:"text-muted-foreground",children:"\xB7"}),(0,be.jsxs)("span",{className:"text-muted-foreground",children:[B.seats," seats"]}),(0,be.jsxs)("span",{className:l("font-medium",I.className),children:["\xB7 ",I.label]})]})]})]},B.id)})})]}),(0,be.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Applicant"}),(0,be.jsx)(T,{value:s,onChange:B=>d(B.target.value),disabled:o,"aria-label":"Applicant name"})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Destination"}),(0,be.jsx)(T,{value:m,onChange:B=>u(B.target.value),disabled:o,"aria-label":"Destination"})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Start Time"}),(0,be.jsxs)("div",{className:"relative",children:[(0,be.jsx)(Te,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,be.jsx)(T,{type:"datetime-local",className:"pl-8",value:p,onChange:B=>f(B.target.value),disabled:o,"aria-label":"Start time"})]})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"End Time"}),(0,be.jsxs)("div",{className:"relative",children:[(0,be.jsx)(Te,{className:"absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,be.jsx)(T,{type:"datetime-local",className:"pl-8",value:x,onChange:B=>v(B.target.value),disabled:o,"aria-label":"End time"})]})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Passengers"}),(0,be.jsx)(T,{type:"number",min:1,max:U?.seats??50,value:N,onChange:B=>h(parseInt(B.target.value)||1),disabled:o,"aria-label":"Passengers"})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Driver (optional)"}),(0,be.jsx)(T,{value:b,onChange:B=>g(B.target.value),disabled:o,"aria-label":"Driver"})]})]}),(0,be.jsxs)("div",{children:[(0,be.jsx)("label",{className:"mb-1 block text-xs font-medium text-muted-foreground",children:"Purpose"}),(0,be.jsx)("textarea",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",rows:2,value:y,onChange:B=>k(B.target.value),disabled:o,"aria-label":"Purpose"})]}),S&&(0,be.jsx)("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&&(0,be.jsxs)("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2","data-slot":"conflict-warning",children:[(0,be.jsxs)("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(B=>(0,be.jsxs)("div",{className:"mt-1 text-xs text-amber-600 dark:text-amber-500",children:[B.applicant,": ",B.startTime," \u2192 ",B.endTime," (",B.destination,")"]},B.id))]}),i&&(0,be.jsxs)("div",{"data-slot":"vehicle-bookings",children:[(0,be.jsx)("h4",{className:"mb-2 text-sm font-semibold text-foreground",children:"Existing Bookings"}),(0,be.jsxs)("div",{className:"space-y-1.5",children:[t.filter(B=>B.vehicleId===i&&(B.status==="approved"||B.status==="pending")).map(B=>{let O=rC[B.status]??rC.pending;return(0,be.jsxs)("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:[(0,be.jsx)(mn,{className:"size-4 text-muted-foreground"}),(0,be.jsx)("span",{className:"flex-1 text-sm text-foreground",children:B.applicant}),(0,be.jsxs)("span",{className:"text-xs text-muted-foreground",children:[B.startTime," \u2192 ",B.endTime]}),(0,be.jsx)("span",{className:l("rounded-full px-2 py-0.5 text-[10px] font-medium",O.className),children:O.label})]},B.id)}),t.filter(B=>B.vehicleId===i&&(B.status==="approved"||B.status==="pending")).length===0&&(0,be.jsx)("div",{className:"py-2 text-center text-xs text-muted-foreground",children:"No existing bookings"})]})]}),!o&&(0,be.jsxs)("div",{className:"flex justify-end gap-2 border-t border-border pt-3",children:[r&&(0,be.jsx)(C,{variant:"outline",onClick:r,children:"Cancel"}),(0,be.jsx)(C,{onClick:z,disabled:!A,children:"Submit Booking"})]})]})}var oC=M(require("react"),1);var Z=require("react/jsx-runtime");function GI(){return`cd-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}function nC(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 jI(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=nC(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 Bi(e,t){return`${t}${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function KI({tiers:e,deals:t,quota:a,quotaBonusRate:r=0,currencySymbol:o="\xA5",onDealsChange:n,className:i}){let c=()=>{n?.([...t,{id:GI(),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=oC.useMemo(()=>jI(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(0,Z.jsxs)("div",{"data-slot":"commission-calculator",className:l("space-y-4 rounded-lg border border-border bg-card p-5",i),children:[(0,Z.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,Z.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Commission Calculator"}),(0,Z.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,Z.jsxs)("span",{className:"text-muted-foreground",children:["Total Sales: ",(0,Z.jsx)("strong",{className:"text-foreground tabular-nums",children:Bi(u,o)})]}),(0,Z.jsxs)("span",{className:"text-muted-foreground",children:["Total Commission: ",(0,Z.jsx)("strong",{className:"text-primary tabular-nums",children:Bi(p,o)})]})]})]}),(0,Z.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-slot":"commission-tiers",children:[(0,Z.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Tiers:"}),e.map((f,x)=>(0,Z.jsxs)(L,{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&&(0,Z.jsxs)(L,{variant:"outline",className:"text-xs text-emerald-600",children:["Quota: ",o,a.toLocaleString()," \u2192 +",r,"% bonus"]})]}),m.size>0&&(0,Z.jsx)("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])=>(0,Z.jsxs)("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:[(0,Z.jsxs)("div",{className:"flex items-center justify-between",children:[(0,Z.jsx)("span",{className:"font-medium text-foreground",children:f}),x.quotaMet&&(0,Z.jsx)(L,{className:"text-[10px] bg-emerald-100 text-emerald-700",children:"Quota Met"})]}),(0,Z.jsxs)("div",{className:"mt-1 space-y-0.5 text-xs text-muted-foreground",children:[(0,Z.jsxs)("div",{children:["Sales: ",(0,Z.jsx)("span",{className:"font-medium tabular-nums text-foreground",children:Bi(x.totalAmount,o)})]}),(0,Z.jsxs)("div",{children:["Deals: ",(0,Z.jsx)("span",{className:"font-medium text-foreground",children:x.dealCount})]}),(0,Z.jsxs)("div",{children:["Commission: ",(0,Z.jsx)("span",{className:"font-medium tabular-nums text-foreground",children:Bi(x.totalCommission,o)})]}),x.bonus>0&&(0,Z.jsxs)("div",{children:["Bonus: ",(0,Z.jsx)("span",{className:"font-medium tabular-nums text-emerald-600",children:Bi(x.bonus,o)})]}),(0,Z.jsxs)("div",{className:"border-t border-border pt-0.5",children:["Total: ",(0,Z.jsx)("span",{className:"font-bold tabular-nums text-primary",children:Bi(x.totalCommission+x.bonus,o)})]})]})]},f))}),(0,Z.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,Z.jsxs)(at,{children:[(0,Z.jsx)(rt,{children:(0,Z.jsxs)(K,{className:"bg-muted/30",children:[(0,Z.jsx)(F,{className:"min-w-[100px]",children:"Rep"}),(0,Z.jsx)(F,{className:"min-w-[120px]",children:"Deal No"}),(0,Z.jsx)(F,{className:"min-w-[120px]",children:"Customer"}),(0,Z.jsx)(F,{className:"w-28 text-right",children:"Amount"}),(0,Z.jsx)(F,{className:"w-28",children:"Date"}),(0,Z.jsx)(F,{className:"w-20 text-right",children:"Override%"}),(0,Z.jsx)(F,{className:"w-28 text-right",children:"Commission"}),n&&(0,Z.jsx)(F,{className:"w-12"})]})}),(0,Z.jsx)(Oe,{children:t.length===0?(0,Z.jsx)(K,{children:(0,Z.jsx)(D,{colSpan:n?8:7,className:"py-6 text-center text-muted-foreground",children:"No deals"})}):t.map(f=>{let x=nC(f.amount,e),v=x*(f.overridePct??0)/100,N=x-v;return(0,Z.jsxs)(K,{"data-slot":"commission-deal",children:[(0,Z.jsx)(D,{children:n?(0,Z.jsx)(T,{className:"h-8 text-sm",value:f.rep,onChange:h=>d(f.id,"rep",h.target.value),"aria-label":"Rep name"}):(0,Z.jsx)("span",{className:"text-sm font-medium text-foreground",children:f.rep})}),(0,Z.jsx)(D,{children:n?(0,Z.jsx)(T,{className:"h-8 font-mono text-sm",value:f.dealNo,onChange:h=>d(f.id,"dealNo",h.target.value),"aria-label":"Deal number"}):(0,Z.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:f.dealNo})}),(0,Z.jsx)(D,{children:n?(0,Z.jsx)(T,{className:"h-8 text-sm",value:f.customer,onChange:h=>d(f.id,"customer",h.target.value),"aria-label":"Customer"}):(0,Z.jsx)("span",{className:"text-sm text-muted-foreground",children:f.customer})}),(0,Z.jsx)(D,{children:n?(0,Z.jsx)(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}):(0,Z.jsx)("span",{className:"text-sm tabular-nums text-foreground",children:Bi(f.amount,o)})}),(0,Z.jsx)(D,{children:n?(0,Z.jsx)(T,{type:"date",className:"h-8 text-sm",value:f.date,onChange:h=>d(f.id,"date",h.target.value),"aria-label":"Date"}):(0,Z.jsx)("span",{className:"text-sm text-muted-foreground",children:f.date})}),(0,Z.jsx)(D,{children:n?(0,Z.jsx)(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}):(0,Z.jsxs)("span",{className:"text-sm tabular-nums text-muted-foreground",children:[f.overridePct??0,"%"]})}),(0,Z.jsx)(D,{className:"text-right text-sm font-semibold tabular-nums text-primary",children:Bi(N,o)}),n&&(0,Z.jsx)(D,{children:(0,Z.jsx)(C,{variant:"ghost",size:"icon-sm",onClick:()=>s(f.id),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove deal",children:(0,Z.jsx)(Le,{className:"size-4"})})})]},f.id)})}),t.length>0&&(0,Z.jsx)(Oi,{children:(0,Z.jsxs)(K,{className:"bg-muted/30 font-semibold",children:[(0,Z.jsx)(D,{colSpan:3,children:"Grand Total"}),(0,Z.jsx)(D,{className:"text-right tabular-nums text-foreground",children:Bi(u,o)}),(0,Z.jsx)(D,{}),(0,Z.jsx)(D,{}),(0,Z.jsx)(D,{className:"text-right tabular-nums text-primary",children:Bi(p,o)}),n&&(0,Z.jsx)(D,{})]})})]})}),n&&(0,Z.jsx)("div",{className:"flex justify-start",children:(0,Z.jsxs)(C,{variant:"outline",size:"sm",onClick:c,children:[(0,Z.jsx)(Re,{className:"mr-1 size-4"}),"Add Deal"]})})]})}var ra=require("react/jsx-runtime");function sC(e,t){return t===0?0:e/t*100}function QI(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 XI(e){return e>=60?"text-white":"text-foreground"}function ag(e,t){return e>=1e6?`${t}${(e/1e6).toFixed(1)}M`:e>=1e3?`${t}${(e/1e3).toFixed(0)}K`:`${t}${e}`}function YI({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?sC(i,c):0,d=e.reduce((m,u)=>m+u.customerCount,0);return(0,ra.jsxs)("div",{"data-slot":"territory-map",className:l("space-y-4 rounded-lg border border-border bg-card p-5",n),children:[(0,ra.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,ra.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:t}),(0,ra.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,ra.jsxs)("span",{className:"text-muted-foreground",children:["Sales: ",(0,ra.jsx)("strong",{className:"text-foreground tabular-nums",children:ag(i,a)})]}),(0,ra.jsxs)("span",{className:"text-muted-foreground",children:["Target: ",(0,ra.jsx)("strong",{className:"text-foreground tabular-nums",children:ag(c,a)})]}),(0,ra.jsxs)(L,{variant:s>=100?"default":"destructive",className:"text-xs",children:[s.toFixed(1),"%"]})]})]}),(0,ra.jsx)("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${r}, 1fr)`},"data-slot":"territory-grid",children:e.map(m=>{let u=sC(m.sales,m.target),p=!m.rep;return(0,ra.jsxs)("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:[(0,ra.jsx)("div",{className:l("absolute inset-0",QI(u)),"data-slot":"territory-heat"}),(0,ra.jsxs)("div",{className:l("relative z-10",XI(u)),children:[(0,ra.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ra.jsx)("span",{className:"text-sm font-bold",children:m.name}),(0,ra.jsxs)("span",{className:"text-xs font-medium opacity-80",children:[u.toFixed(0),"%"]})]}),(0,ra.jsx)("div",{className:"mt-1 text-lg font-bold tabular-nums",children:ag(m.sales,a)}),(0,ra.jsxs)("div",{className:"text-xs opacity-80",children:["Target: ",ag(m.target,a)]}),(0,ra.jsxs)("div",{className:"mt-1.5 flex items-center justify-between text-xs",children:[(0,ra.jsxs)("span",{className:"opacity-80",children:[m.customerCount," customers"]}),m.rep?(0,ra.jsx)("span",{className:"font-medium",children:m.rep}):(0,ra.jsx)("span",{className:"italic opacity-60",children:"Unassigned"})]})]})]},m.id)})}),(0,ra.jsxs)("div",{className:"flex flex-wrap items-center gap-3 border-t border-border pt-3","data-slot":"territory-legend",children:[(0,ra.jsx)("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=>(0,ra.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ra.jsx)("span",{className:l("size-3 rounded",m.color)}),(0,ra.jsx)("span",{className:"text-xs text-muted-foreground",children:m.label})]},m.label)),(0,ra.jsxs)("span",{className:"ml-auto text-xs text-muted-foreground",children:[d," total customers \xB7 ",e.length," regions"]})]})]})}var lC=M(require("react"),1);var ge=require("react/jsx-runtime"),iC=[{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 JI(){return`lf-${Date.now()}-${Math.random().toString(36).slice(2,6)}`}var tb={text:"\u{1F4DD}",barcode:"\u25AE",qrcode:"\u25A3",line:"\u2500",image:"\u{1F5BC}\uFE0F"},rg={text:"Text",barcode:"Barcode",qrcode:"QR Code",line:"Line",image:"Image"};function ZI({fields:e,onFieldsChange:t,labelSize:a=iC[1],sizePresets:r=iC,onSizeChange:o,onPrint:n,readOnly:i=!1,className:c}){let[s,d]=lC.useState(null),m=3,u=v=>{if(i)return;let N={id:JI(),type:v,label:`${rg[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(0,ge.jsxs)("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:[(0,ge.jsxs)("div",{className:"space-y-2","data-slot":"label-palette",children:[(0,ge.jsx)("h4",{className:"text-sm font-semibold text-foreground",children:"Add Field"}),Object.keys(rg).map(v=>(0,ge.jsxs)("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:[(0,ge.jsx)("span",{className:"text-base",children:tb[v]}),(0,ge.jsx)("span",{className:"text-foreground",children:rg[v]})]},v)),(0,ge.jsxs)("div",{className:"mt-3",children:[(0,ge.jsx)("h4",{className:"text-sm font-semibold text-foreground",children:"Label Size"}),(0,ge.jsx)("div",{className:"mt-1 space-y-1",children:r.map(v=>(0,ge.jsxs)("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:[(0,ge.jsx)("span",{children:v.label}),(0,ge.jsxs)("span",{className:"text-[10px]",children:[v.width,"\xD7",v.height,"mm"]})]},v.id))})]})]}),(0,ge.jsxs)("div",{className:"flex flex-col items-center","data-slot":"label-preview-container",children:[(0,ge.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,ge.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Preview"}),(0,ge.jsxs)(L,{variant:"outline",className:"text-xs",children:[a.width,"\xD7",a.height,"mm"]})]}),(0,ge.jsxs)("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&&(0,ge.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"Add fields to design your label"}),e.map(v=>(0,ge.jsxs)("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"&&(0,ge.jsx)("span",{className:"block truncate px-0.5 text-black",style:{fontSize:(v.fontSize??8)*(m/3)},children:v.sampleValue}),v.type==="barcode"&&(0,ge.jsx)("div",{className:"flex h-full items-center justify-center bg-black text-white text-[8px] font-mono",children:v.sampleValue}),v.type==="qrcode"&&(0,ge.jsx)("div",{className:"flex h-full items-center justify-center bg-black text-white text-[8px]",children:"QR"}),v.type==="line"&&(0,ge.jsx)("div",{className:"h-px w-full bg-black",style:{marginTop:v.height*m/2}}),v.type==="image"&&(0,ge.jsx)("div",{className:"flex h-full items-center justify-center bg-muted text-xs text-muted-foreground",children:"IMG"})]},v.id))]}),n&&!i&&(0,ge.jsx)(C,{className:"mt-3",size:"sm",onClick:n,children:"Print Label"})]}),(0,ge.jsxs)("div",{className:"space-y-3","data-slot":"label-properties",children:[(0,ge.jsx)("h4",{className:"text-sm font-semibold text-foreground",children:"Properties"}),x?(0,ge.jsxs)("div",{className:"space-y-2",children:[(0,ge.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ge.jsx)("span",{className:"text-base",children:tb[x.type]}),(0,ge.jsx)("span",{className:"text-sm font-medium text-foreground",children:rg[x.type]})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Label"}),(0,ge.jsx)(T,{className:"h-8 text-sm",value:x.label,onChange:v=>f(x.id,"label",v.target.value),disabled:i,"aria-label":"Field label"})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Sample Value"}),(0,ge.jsx)(T,{className:"h-8 text-sm",value:x.sampleValue,onChange:v=>f(x.id,"sampleValue",v.target.value),disabled:i,"aria-label":"Sample value"})]}),(0,ge.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"X (mm)"}),(0,ge.jsx)(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"})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Y (mm)"}),(0,ge.jsx)(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"})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"W (mm)"}),(0,ge.jsx)(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"})]}),(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"H (mm)"}),(0,ge.jsx)(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"&&(0,ge.jsxs)("div",{children:[(0,ge.jsx)("label",{className:"mb-0.5 block text-xs text-muted-foreground",children:"Font Size (pt)"}),(0,ge.jsx)(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&&(0,ge.jsx)(C,{variant:"outline",size:"sm",className:"w-full text-destructive",onClick:()=>p(x.id),children:"Remove Field"})]}):(0,ge.jsx)("p",{className:"text-xs text-muted-foreground",children:"Select a field to edit its properties"}),e.length>0&&(0,ge.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,ge.jsxs)("h5",{className:"mb-1 text-xs font-semibold text-muted-foreground",children:["Fields (",e.length,")"]}),(0,ge.jsx)("div",{className:"space-y-1",children:e.map(v=>(0,ge.jsxs)("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:[(0,ge.jsx)("span",{children:tb[v.type]}),(0,ge.jsx)("span",{className:"truncate",children:v.label})]},v.id))})]})]})]})}var jc=M(require("react"),1);var Wt=require("react/jsx-runtime"),eD={temperature:"\u{1F321}\uFE0F",humidity:"\u{1F4A7}",pressure:"\u{1F4E1}",vibration:"\u{1F4F3}",co2:"\u2601\uFE0F",flow:"\u{1F504}",voltage:"\u26A1"};function dC(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 cC={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 tD(e){return e>=60?"text-emerald-500":e>=20?"text-amber-500":"text-destructive"}function aD(e){return e>=75?4:e>=50?3:e>=25?2:e>0?1:0}function rD({sensors:e,title:t="IoT Sensor Grid",refreshInterval:a=0,onSensorClick:r,className:o}){let[n,i]=jc.useState(0);jc.useEffect(()=>{if(a<=0)return;let s=setInterval(()=>i(d=>d+1),a);return()=>clearInterval(s)},[a]);let c=jc.useMemo(()=>{let s={online:0,warning:0,critical:0,offline:0};for(let d of e){let m=dC(d);s[m]++}return s},[e,n]);return(0,Wt.jsxs)("div",{"data-slot":"iot-sensor-grid",className:l("space-y-4 rounded-lg border border-border bg-card p-5",o),children:[(0,Wt.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,Wt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Wt.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:t}),(0,Wt.jsx)("span",{className:"size-2 rounded-full bg-emerald-500 animate-pulse","data-slot":"live-indicator"})]}),(0,Wt.jsx)("div",{className:"flex items-center gap-2",children:["online","warning","critical","offline"].map(s=>{let d=cC[s];return(0,Wt.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Wt.jsx)("span",{className:l("size-2 rounded-full",d.dot)}),(0,Wt.jsx)("span",{className:"text-xs text-muted-foreground",children:oD(s,c)})]},s)})})]}),(0,Wt.jsx)("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=dC(s),m=cC[d],u=aD(s.signalStrength??0),p=s.minThreshold!=null&&s.value<s.minThreshold||s.maxThreshold!=null&&s.value>s.maxThreshold;return(0,Wt.jsxs)("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:[(0,Wt.jsxs)("div",{className:"flex items-start justify-between",children:[(0,Wt.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Wt.jsx)("span",{className:"text-2xl",children:eD[s.type]??"\u{1F4CA}"}),(0,Wt.jsxs)("div",{children:[(0,Wt.jsx)("div",{className:"text-sm font-medium text-foreground",children:s.name}),(0,Wt.jsx)("div",{className:"text-xs text-muted-foreground",children:s.location})]})]}),(0,Wt.jsx)("span",{className:l("rounded-full px-1.5 py-0.5 text-[10px] font-medium",m.badge),children:m.label})]}),(0,Wt.jsxs)("div",{className:"mt-3 flex items-baseline gap-1",children:[(0,Wt.jsx)("span",{className:l("text-2xl font-bold tabular-nums",p?m.color:"text-foreground"),children:s.value.toFixed(1)}),(0,Wt.jsx)("span",{className:"text-sm text-muted-foreground",children:s.unit})]}),(s.minThreshold!=null||s.maxThreshold!=null)&&(0,Wt.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["Range: ",s.minThreshold??"\u2014"," ~ ",s.maxThreshold??"\u2014"," ",s.unit]}),(0,Wt.jsxs)("div",{className:"mt-3 flex items-center justify-between border-t border-border pt-2",children:[s.batteryLevel!=null&&(0,Wt.jsxs)("div",{className:"flex items-center gap-1",children:[(0,Wt.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u{1F50B}"}),(0,Wt.jsxs)("span",{className:l("text-xs font-medium",tD(s.batteryLevel)),children:[s.batteryLevel,"%"]})]}),s.signalStrength!=null&&(0,Wt.jsxs)("div",{className:"flex items-center gap-0.5","data-slot":"signal-bars",children:[[1,2,3,4].map(f=>(0,Wt.jsx)("div",{className:l("w-1 rounded-sm",f<=u?"bg-foreground":"bg-muted"),style:{height:`${4+f*2}px`}},f)),(0,Wt.jsxs)("span",{className:"ml-1 text-[10px] text-muted-foreground",children:[s.signalStrength,"%"]})]}),s.lastUpdate&&(0,Wt.jsx)("span",{className:"text-[10px] text-muted-foreground",children:s.lastUpdate})]})]},s.id)})}),e.length===0&&(0,Wt.jsx)("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No sensors deployed"})]})}function oD(e,t){return`${{online:"Online",warning:"Warning",critical:"Critical",offline:"Offline"}[e]}: ${t[e]}`}var og=M(require("react"),1);var It=require("react/jsx-runtime"),ab={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"}},nD={low:{label:"Low",className:"text-emerald-600"},medium:{label:"Medium",className:"text-amber-600"},high:{label:"High",className:"text-destructive"}},mC=["compliant","in_progress","pending","non_compliant","not_applicable"];function sD({items:e,title:t="Compliance Checklist",onItemClick:a,onStatusChange:r,readOnly:o=!1,className:n}){let i=og.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=og.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=og.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(0,It.jsxs)("div",{"data-slot":"compliance-checklist",className:l("space-y-4 rounded-lg border border-border bg-card p-5",n),children:[(0,It.jsxs)("div",{className:"flex items-center justify-between border-b border-border pb-3",children:[(0,It.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:t}),(0,It.jsx)("div",{className:"flex items-center gap-3",children:(0,It.jsxs)("div",{className:"text-right",children:[(0,It.jsx)("div",{className:"text-xs text-muted-foreground",children:"Compliance Score"}),(0,It.jsxs)("div",{className:l("text-2xl font-bold tabular-nums",d),children:[c.toFixed(0),"%"]})]})})]}),(0,It.jsx)("div",{className:"flex flex-wrap items-center gap-2","data-slot":"compliance-summary",children:mC.map(m=>{let u=ab[m];return(0,It.jsx)("div",{className:"flex items-center gap-1.5",children:(0,It.jsxs)("span",{className:l("rounded-full px-2 py-0.5 text-xs font-medium",u.className),children:[u.icon," ",u.label,": ",s[m]]})},m)})}),(0,It.jsx)("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(0,It.jsxs)("div",{"data-slot":"compliance-category",children:[(0,It.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,It.jsx)("h4",{className:"text-sm font-semibold text-foreground",children:m}),(0,It.jsxs)("span",{className:"text-xs text-muted-foreground",children:[p,"/",f," compliant"," \xB7 ",(0,It.jsxs)("span",{className:l("font-medium",x>=80?"text-emerald-600":x>=60?"text-amber-600":"text-destructive"),children:[x.toFixed(0),"%"]})]})]}),(0,It.jsx)("div",{className:"space-y-1",children:u.map(v=>{let N=ab[v.status],h=v.risk?nD[v.risk]:null;return(0,It.jsxs)("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:[(0,It.jsx)("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}),(0,It.jsxs)("div",{className:"flex-1",children:[(0,It.jsxs)("div",{className:"flex items-center gap-2",children:[(0,It.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:v.code}),h&&(0,It.jsxs)("span",{className:l("text-[10px] font-medium",h.className),children:[h.label," risk"]})]}),(0,It.jsx)("div",{className:"text-sm text-foreground",children:v.description}),(0,It.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[v.owner&&(0,It.jsxs)("span",{children:["\u{1F464} ",v.owner]}),v.dueDate&&(0,It.jsxs)("span",{children:["\u{1F4C5} ",v.dueDate]}),v.evidence&&(0,It.jsxs)("span",{children:["\u{1F4CE} ",v.evidence]})]}),v.notes&&(0,It.jsx)("div",{className:"mt-0.5 text-xs italic text-muted-foreground",children:v.notes})]}),!o&&r?(0,It.jsx)("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:mC.map(b=>(0,It.jsx)("option",{value:b,children:ab[b].label},b))}):(0,It.jsx)("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&&(0,It.jsx)("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No compliance items"})]})}var uC=M(require("react"),1);var pa=require("react/jsx-runtime");function iD(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 lD({fieldKey:e,label:t,translations:a,onTranslationChange:r,multiline:o=!1,maxLength:n,readOnly:i=!1,className:c}){let[s,d]=uC.useState(a[0]?.locale??""),m=a.find(x=>x.locale===s)??a[0],u=a.find(x=>x.isSource),p=iD(a),f=p===100?"text-emerald-600":p>=50?"text-amber-600":"text-destructive";return(0,pa.jsxs)("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:[(0,pa.jsxs)("div",{className:"flex items-center justify-between",children:[(0,pa.jsxs)("div",{className:"flex items-center gap-2",children:[t&&(0,pa.jsx)("label",{className:"text-sm font-medium text-foreground",children:t}),(0,pa.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:e})]}),(0,pa.jsxs)("div",{className:"flex items-center gap-2",children:[(0,pa.jsx)("span",{className:"text-xs text-muted-foreground",children:"Translation:"}),(0,pa.jsxs)(L,{variant:"outline",className:l("text-xs",f),children:[p.toFixed(0),"%"]})]})]}),(0,pa.jsx)("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(0,pa.jsxs)("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&&(0,pa.jsx)("span",{className:"text-sm",children:x.flag}),(0,pa.jsx)("span",{className:"font-medium",children:x.label}),x.isSource&&(0,pa.jsx)("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&&(0,pa.jsx)("span",{className:l("size-1.5 rounded-full",N?"bg-emerald-500":"bg-muted-foreground/30")})]},x.locale)})}),(0,pa.jsxs)("div",{className:"space-y-2",children:[u&&m&&!m.isSource&&(0,pa.jsxs)("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:[(0,pa.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-blue-600 dark:text-blue-400",children:[(0,pa.jsx)("span",{children:u.flag}),(0,pa.jsxs)("span",{className:"font-medium",children:["Source (",u.label,"):"]})]}),(0,pa.jsx)("div",{className:"mt-0.5 text-sm text-foreground",children:u.text||"\u2014"})]}),(0,pa.jsxs)("div",{children:[(0,pa.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,pa.jsxs)("span",{className:"text-xs text-muted-foreground",children:[m?.flag," ",m?.label,m?.isSource&&" (Source)"]}),n&&(0,pa.jsxs)("span",{className:l("text-xs tabular-nums",(m?.text.length??0)>n?"text-destructive":"text-muted-foreground"),children:[m?.text.length??0," / ",n]})]}),o?(0,pa.jsx)("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}):(0,pa.jsx)(T,{className:"text-sm",value:m?.text??"",onChange:x=>r?.(s,x.target.value),disabled:i,"aria-label":`Translation for ${m?.label}`,maxLength:n})]})]})]})}0&&(module.exports={AccountBalance,ActivityFeed,AddressColumn,AddressPanel,AddressPicker,AdvancedSearch,AnnouncementBanner,AnnouncementCard,ApplicationForm,ApprovalActionBar,ApprovalFlow,ApprovalTimeline,ArApAgingTable,AreaChart,AsyncTaskCenter,AsyncTaskTrigger,AttachmentList,AttachmentPreview,AttachmentUploader,AttendanceCalendar,AudienceSegmentBuilder,AuditLog,AuditSidebar,AuditTrailDiff,AuthGuard,AuthLayout,AvatarGroup,BOMTreeEditor,BackTop,BadgeDelta,BarChart,BarList,BarListCard,BatchGenealogyTree,BatchPrintDialog,BatchSelector,BillFooter,BillHeader,BillPage,BillPrintTemplate,BillStatusBar,BillTimeline,BillTodoList,BizStatusTag,BrowseDialog,BudgetAllocator,BudgetOverview,BudgetPacingCard,BulkActionsToolbar,BulkImportWizard,CATEGORY_LABELS,CalendarView,Callout,CampaignCalendar,CampaignCard,CampaignStatusTag,CategoryBar,ChannelPicker,ChartCard,ChartContainer,ChartSuite,ChartTooltip,ChatAgentStatus,ChatArtifactPanel,ChatBranch,ChatCardMessage,ChatCodeBlock,ChatCommandMenu,ChatContextPanel,ChatConversation,ChatConversationSearch,ChatFeedback,ChatHeader,ChatImageGallery,ChatInputToolbar,ChatMarkdownRenderer,ChatMentionPicker,ChatMessageActions,ChatMessageBubble,ChatMessageGroup,ChatMessageInput,ChatModelSwitcher,ChatSharedLink,ChatShell,ChatSidebar,ChatStreamingText,ChatSuggestReplies,ChatThinkingBlock,ChatToolCallBlock,ChatVoiceMessage,CheckoutBar,Chip,CityBrowse,CodeBlock,CodeEditor,ColorBoard,ColorTag,Combobox,CommandPalette,CommissionCalculator,CompanyBrowse,CompanyPicker,ComplianceChecklist,ConfirmDialog,ConfirmDialogContainer,ContractTemplate,CookieBanner,CostCenterPicker,CouponCard,CreativePreview,CronEditor,CrudPage,CrudToolbar,Customer360Card,CustomerBrowse,CustomerPicker,DashboardCanvas,DashboardDesigner,DashboardGrid,DataTable,DateRangePicker,DeltaBar,DepartmentPicker,DialogFormBody,DictSelect,DiffViewer,DiffViewerTable,DistributorPicker,DockPanel,DonutCard,DonutChart,DynamicFormBuilder,EditToolbar,EditableTreeTable,EmployeePicker,EmptyState,EquipmentCard,ErrorBoundary,ErrorPage,ExpenseLineEditor,ExperimentSummary,ExportButton,Fab,FabSpeedDial,FeatureTour,FeeTypeBrowse,FieldMask,FileCard,FileUploadManager,FilterBar,FilterBuilder,FlowTracker,Forbidden,FormDesigner,FormDesignerRuntime,FormStack,FormWizard,FormulaEditor,FullPageLoader,FunnelChart,GanttChart,GanttChartPro,Gauge,GaugeChart,GlobalLoadingContext,GlobalLoadingProvider,HeatmapCalendar,HeatmapChart,I18nFormField,ImMessage,ImageGallery,ImportDialog,ImportErrorTable,ImportMappingWizard,InlineEdit,InlineSparkline,InventoryAlertList,InventorySnapshot,InviteLink,InvoiceManager,InvoiceSummary,IotSensorGrid,JournalEntryEditor,JsonEditor,JsonViewer,KPICard,KanbanBoard,KanbanColumn,LabelDesigner,LabeledField,LanguageSwitcher,LeadPipelineBoard,LeaveRequestForm,LineChart,LineEditor,LoadingPage,MaintenanceLog,MapChart,MapMarkerCluster,MapTrack,MapView,MarkdownEditor,MarketingActivityForm,MasterDetailLayout,MasterEditTemplate,MasterListTemplate,MediaRecorder,MeetingRoomBooking,MessageList,MetricTrend,MobileActionSheet,MobileAuthLayout,MobileButton,MobileCamera,MobileCard,MobileCardSkeleton,MobileDashboardLayout,MobileDataTable,MobileDetailSkeleton,MobileDialog,MobileEmptyState,MobileFilterBuilder,MobileForm,MobileFormField,MobileFormWizard,MobileGeolocation,MobileInfiniteScroll,MobileInput,MobileKPICard,MobileKanban,MobileListItem,MobileListItemSkeleton,MobileNavigation,MobilePageHeader,MobilePageShell,MobilePicker,MobileQrCodeScanner,MobileSelect,MobileSheet,MobileSignature,MobileTabBar,MobileTabs,MobileTextarea,MultiCurrencyInput,MultiSelect,NotificationCenter,NotificationRuleBuilder,OaBridge,OeeDashboard,OperationLog,OrderLineEditor,OrgChart,OverviewPage,PDFViewer,PageHeader,PasteUpload,PaymentMethodSelector,PaymentResult,PaymentSchedule,PerformanceRankTable,PermissionButton,PermissionMatrix,PermissionWrapper,PhotoAudit,PieChart,PivotTable,PolicyLineEditor,PoolTrackerTable,PreferencePanel,PriceAdjustBrowse,PrintButton,PrintService,PrintTemplateBuilder,ProductBrowse,ProductCategoryPicker,PromotionRuleCard,PromotionRuleEditor,PromptDialog,PullToRefresh,PurchaseOrderEditor,QualityInspectionForm,QuickEntryGrid,QuotationLineEditor,RadarChart,RadialChart,RadialProgress,Rating,RebutNodeSelect,ReconciliationLineEditor,ReconciliationSummary,RedPacket,RegionPicker,RemoteSelect,ReportBuilder,ResourceSchedule,ResponsivePreview,RichTextEditor,RoleAssignment,RuleEditor,SPCControlChart,STATUS_CONFIG,SalesOrderBrowse,SalesTargetEditor,SankeyChart,SavedFilters,ScatterChart,SealStampRegistry,SearchTable,SegmentedControl,SerialNumberManager,SettlementStatusTag,ShiftCalendar,ShippingWayBrowse,SignActionButton,SkuPicker,SocialShare,SparkChart,Sparkline,SqlEditor,StatCard,StatCardRow,StatCardWithDelta,StatCardWithSparkline,StatusBadge,StatusTag,StockTransferDialog,SubformTabs,SupplierScorecard,SwipeActions,TabCrudPage,TabPin,TargetProgress,TaskHistory,TaskListTable,TaskProgress,TaxDetailTable,TemplateDownload,TerritoryMap,ThemeToggle,TimePicker,TimelineView,TodoListTable,Tour,Tracking,Transfer,TreeCrudPage,TreeTable,TreemapChart,UTMBuilder,UnitConverter,UserMenu,VehicleBooking,VersionHistory,WarehouseBrowse,WarehousePicker,WaterfallChart,Watermark,WorkOrderCard,WorkflowDesigner,WorkflowPreview,WriteoffBrowse,WriteoffFlow,brandColors,builtInCategories,colorConfig,computeResult,convertValue,defaultChannelOptions,defaultColors,defaultStatusMap,formatCurrency,formatDate,formatDateTime,formatNumber,formatPercent,formatRelativeTime,formatResult,formatTimeInput,message,safeEvaluate,setDictFetcher,statusColors,statusConfig,useConfirm,useGlobalLoading,variantConfig,withPermission});