@ug666/ui-react 0.3.0-beta.2 → 0.3.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/RELEASE_PROVENANCE.json +8 -0
- package/dist/ai/SKILL.md +242 -0
- package/dist/ai/manifest.json +815 -0
- package/dist/ai/references/components/accordion.md +41 -0
- package/dist/ai/references/components/admin-shell.md +27 -0
- package/dist/ai/references/components/alert.md +40 -0
- package/dist/ai/references/components/app-tabs.md +27 -0
- package/dist/ai/references/components/attachment-list.md +27 -0
- package/dist/ai/references/components/autocomplete.md +41 -0
- package/dist/ai/references/components/avatar-group.md +39 -0
- package/dist/ai/references/components/avatar.md +39 -0
- package/dist/ai/references/components/backtop.md +40 -0
- package/dist/ai/references/components/badge.md +43 -0
- package/dist/ai/references/components/bar-chart.md +41 -0
- package/dist/ai/references/components/breadcrumb.md +41 -0
- package/dist/ai/references/components/button.md +39 -0
- package/dist/ai/references/components/calendar.md +42 -0
- package/dist/ai/references/components/card.md +39 -0
- package/dist/ai/references/components/carousel.md +41 -0
- package/dist/ai/references/components/cascader.md +43 -0
- package/dist/ai/references/components/checkbox.md +40 -0
- package/dist/ai/references/components/collapse.md +41 -0
- package/dist/ai/references/components/color-picker.md +42 -0
- package/dist/ai/references/components/config-provider.md +39 -0
- package/dist/ai/references/components/confirm-dialog.md +27 -0
- package/dist/ai/references/components/container.md +39 -0
- package/dist/ai/references/components/context-menu.md +40 -0
- package/dist/ai/references/components/conversation-list.md +27 -0
- package/dist/ai/references/components/copy-field.md +27 -0
- package/dist/ai/references/components/data-panel.md +43 -0
- package/dist/ai/references/components/data-table-identity.md +27 -0
- package/dist/ai/references/components/data-table-toolbar.md +27 -0
- package/dist/ai/references/components/data-table.md +32 -0
- package/dist/ai/references/components/date-picker.md +42 -0
- package/dist/ai/references/components/date-range-picker.md +43 -0
- package/dist/ai/references/components/date-time-picker.md +40 -0
- package/dist/ai/references/components/descriptions.md +40 -0
- package/dist/ai/references/components/dialog.md +40 -0
- package/dist/ai/references/components/dock.md +41 -0
- package/dist/ai/references/components/donut-chart.md +41 -0
- package/dist/ai/references/components/drawer.md +41 -0
- package/dist/ai/references/components/dropdown.md +42 -0
- package/dist/ai/references/components/empty-state.md +40 -0
- package/dist/ai/references/components/fab.md +41 -0
- package/dist/ai/references/components/feature-grid.md +27 -0
- package/dist/ai/references/components/fieldset.md +41 -0
- package/dist/ai/references/components/file-input.md +41 -0
- package/dist/ai/references/components/form.md +42 -0
- package/dist/ai/references/components/gauge-chart.md +41 -0
- package/dist/ai/references/components/heatmap-chart.md +41 -0
- package/dist/ai/references/components/icon.md +39 -0
- package/dist/ai/references/components/image.md +41 -0
- package/dist/ai/references/components/index.md +171 -0
- package/dist/ai/references/components/indicator.md +41 -0
- package/dist/ai/references/components/infinite-scroll.md +42 -0
- package/dist/ai/references/components/input.md +42 -0
- package/dist/ai/references/components/join.md +40 -0
- package/dist/ai/references/components/kbd.md +40 -0
- package/dist/ai/references/components/label.md +39 -0
- package/dist/ai/references/components/landing-hero.md +27 -0
- package/dist/ai/references/components/layout.md +39 -0
- package/dist/ai/references/components/link.md +41 -0
- package/dist/ai/references/components/list.md +41 -0
- package/dist/ai/references/components/loading.md +40 -0
- package/dist/ai/references/components/message.md +27 -0
- package/dist/ai/references/components/modal.md +42 -0
- package/dist/ai/references/components/navbar.md +41 -0
- package/dist/ai/references/components/navigation-menu.md +41 -0
- package/dist/ai/references/components/notification.md +41 -0
- package/dist/ai/references/components/number-input.md +40 -0
- package/dist/ai/references/components/otp-input.md +40 -0
- package/dist/ai/references/components/page-header.md +27 -0
- package/dist/ai/references/components/pagination.md +42 -0
- package/dist/ai/references/components/popconfirm.md +42 -0
- package/dist/ai/references/components/popover.md +41 -0
- package/dist/ai/references/components/progress.md +41 -0
- package/dist/ai/references/components/prompt-composer.md +27 -0
- package/dist/ai/references/components/quick-access.md +30 -0
- package/dist/ai/references/components/radar-chart.md +41 -0
- package/dist/ai/references/components/radial-progress.md +41 -0
- package/dist/ai/references/components/radio.md +40 -0
- package/dist/ai/references/components/ranking-list.md +41 -0
- package/dist/ai/references/components/rating.md +42 -0
- package/dist/ai/references/components/result.md +40 -0
- package/dist/ai/references/components/scrollbar.md +39 -0
- package/dist/ai/references/components/select.md +41 -0
- package/dist/ai/references/components/selection-list.md +29 -0
- package/dist/ai/references/components/separator.md +39 -0
- package/dist/ai/references/components/sheet.md +40 -0
- package/dist/ai/references/components/sidebar.md +46 -0
- package/dist/ai/references/components/skeleton.md +40 -0
- package/dist/ai/references/components/slider.md +40 -0
- package/dist/ai/references/components/space.md +39 -0
- package/dist/ai/references/components/spinner.md +41 -0
- package/dist/ai/references/components/splitter.md +39 -0
- package/dist/ai/references/components/stack.md +41 -0
- package/dist/ai/references/components/stacked-bar-chart.md +41 -0
- package/dist/ai/references/components/statistic-card.md +41 -0
- package/dist/ai/references/components/statistic.md +41 -0
- package/dist/ai/references/components/steps.md +40 -0
- package/dist/ai/references/components/switch.md +40 -0
- package/dist/ai/references/components/table.md +41 -0
- package/dist/ai/references/components/tabs.md +41 -0
- package/dist/ai/references/components/tag.md +39 -0
- package/dist/ai/references/components/text.md +39 -0
- package/dist/ai/references/components/textarea.md +40 -0
- package/dist/ai/references/components/theme-configurator-dialog.md +27 -0
- package/dist/ai/references/components/theme-configurator.md +27 -0
- package/dist/ai/references/components/theme-controller.md +41 -0
- package/dist/ai/references/components/time-picker.md +42 -0
- package/dist/ai/references/components/time-range-picker.md +41 -0
- package/dist/ai/references/components/time-select.md +40 -0
- package/dist/ai/references/components/timeline.md +41 -0
- package/dist/ai/references/components/toast.md +39 -0
- package/dist/ai/references/components/tooltip.md +39 -0
- package/dist/ai/references/components/transfer.md +41 -0
- package/dist/ai/references/components/tree-select.md +45 -0
- package/dist/ai/references/components/tree-table.md +27 -0
- package/dist/ai/references/components/tree.md +43 -0
- package/dist/ai/references/components/trend-chart.md +41 -0
- package/dist/ai/references/components/upload.md +43 -0
- package/dist/ai/references/components.md +97 -0
- package/dist/ai/references/examples/data-table.md +50 -0
- package/dist/ai/references/release.md +158 -0
- package/dist/ai/ui-react.zip +0 -0
- package/dist/blocks/index.cjs +1 -1
- package/dist/blocks/index.js +1 -1
- package/dist/{chunk-ZDO5A2IZ.cjs → chunk-3A5O2NHW.cjs} +1 -1
- package/dist/chunk-3A5O2NHW.cjs.map +1 -0
- package/dist/chunk-3LSTRFSY.js +1 -0
- package/dist/chunk-3LSTRFSY.js.map +1 -0
- package/dist/{chunk-NRCPYVJW.js → chunk-AQJWS45G.js} +1 -1
- package/dist/chunk-AQJWS45G.js.map +1 -0
- package/dist/{chunk-UEJM2SLH.js → chunk-DJDACMBD.js} +1 -1
- package/dist/chunk-DJDACMBD.js.map +1 -0
- package/dist/{chunk-XVFRKGM7.cjs → chunk-EYSM2SU5.cjs} +1 -1
- package/dist/chunk-EYSM2SU5.cjs.map +1 -0
- package/dist/chunk-HCGUPREG.cjs +1 -0
- package/dist/chunk-HCGUPREG.cjs.map +1 -0
- package/dist/{chunk-J4NAYP4L.cjs → chunk-IOUGF444.cjs} +1 -1
- package/dist/{chunk-J4NAYP4L.cjs.map → chunk-IOUGF444.cjs.map} +1 -1
- package/dist/{chunk-JY5S7YLF.cjs → chunk-JJQENNZW.cjs} +1 -1
- package/dist/chunk-JJQENNZW.cjs.map +1 -0
- package/dist/{chunk-UESSLLSC.js → chunk-KNWHIFJE.js} +1 -1
- package/dist/{chunk-VDBATAZ3.js → chunk-TWOBEV2L.js} +1 -1
- package/dist/chunk-TWOBEV2L.js.map +1 -0
- package/dist/{chunk-PXVCZ6AZ.js → chunk-V4VCVCOX.js} +1 -1
- package/dist/{chunk-PXVCZ6AZ.js.map → chunk-V4VCVCOX.js.map} +1 -1
- package/dist/{chunk-UBZ2ZCEJ.cjs → chunk-YI5JDPI2.cjs} +1 -1
- package/dist/{chunk-UBZ2ZCEJ.cjs.map → chunk-YI5JDPI2.cjs.map} +1 -1
- package/dist/components/alert.d.ts +4 -5
- package/dist/components/alert.d.ts.map +1 -1
- package/dist/components/avatar.d.ts +4 -5
- package/dist/components/avatar.d.ts.map +1 -1
- package/dist/components/badge.d.ts +5 -2
- package/dist/components/badge.d.ts.map +1 -1
- package/dist/components/button.d.ts +8 -5
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/checkbox.d.ts +4 -2
- package/dist/components/checkbox.d.ts.map +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.d.ts.map +1 -1
- package/dist/components/date-time-picker.d.ts +2 -2
- package/dist/components/date-time-picker.d.ts.map +1 -1
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/drawer.d.ts.map +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/number-input.d.ts +4 -2
- package/dist/components/number-input.d.ts.map +1 -1
- package/dist/components/radio.d.ts +4 -6
- package/dist/components/radio.d.ts.map +1 -1
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/skeleton.d.ts +4 -5
- package/dist/components/skeleton.d.ts.map +1 -1
- package/dist/components/spinner.d.ts +5 -6
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/tag.d.ts +5 -2
- package/dist/components/tag.d.ts.map +1 -1
- package/dist/components/time-picker.d.ts +1 -1
- package/dist/components/time-picker.d.ts.map +1 -1
- package/dist/essentials.cjs +1 -0
- package/dist/essentials.cjs.map +1 -0
- package/dist/essentials.css +2 -0
- package/dist/essentials.d.ts +9 -0
- package/dist/essentials.d.ts.map +1 -0
- package/dist/essentials.js +1 -0
- package/dist/essentials.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/data-table-header.d.ts.map +1 -1
- package/dist/internal/date-time/date-mode-panel.d.ts.map +1 -0
- package/dist/internal/{date-time-control.d.ts → date-time/date-time-control.d.ts} +1 -1
- package/dist/internal/date-time/date-time-control.d.ts.map +1 -0
- package/dist/internal/date-time/date-time-range-control.d.ts.map +1 -0
- package/dist/internal/date-time/time-panel.d.ts.map +1 -0
- package/dist/internal/{admin-horizontal-navigation.d.ts → navigation/admin-horizontal-navigation.d.ts} +1 -1
- package/dist/internal/navigation/admin-horizontal-navigation.d.ts.map +1 -0
- package/dist/internal/navigation/sidebar-navigation.d.ts.map +1 -0
- package/dist/internal/overlay/use-floating-layout-observer.d.ts.map +1 -0
- package/dist/internal/overlay/use-overlay-focus.d.ts.map +1 -0
- package/dist/internal/overlay/use-portal-container.d.ts.map +1 -0
- package/dist/internal/overlay/use-presence.d.ts.map +1 -0
- package/dist/internal/selection/option-window.d.ts.map +1 -0
- package/dist/internal/{use-cascader-lazy.d.ts → selection/use-cascader-lazy.d.ts} +1 -1
- package/dist/internal/selection/use-cascader-lazy.d.ts.map +1 -0
- package/dist/internal/{use-transfer-remote.d.ts → selection/use-transfer-remote.d.ts} +1 -1
- package/dist/internal/selection/use-transfer-remote.d.ts.map +1 -0
- package/dist/internal/{use-tree-data.d.ts → selection/use-tree-data.d.ts} +1 -1
- package/dist/internal/selection/use-tree-data.d.ts.map +1 -0
- package/dist/patterns/data-table.d.ts.map +1 -1
- package/dist/patterns/index.cjs +1 -1
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.js +1 -1
- package/dist/patterns/index.js.map +1 -1
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +12 -4
- package/dist/chunk-JY5S7YLF.cjs.map +0 -1
- package/dist/chunk-NRCPYVJW.js.map +0 -1
- package/dist/chunk-UEJM2SLH.js.map +0 -1
- package/dist/chunk-VDBATAZ3.js.map +0 -1
- package/dist/chunk-XVFRKGM7.cjs.map +0 -1
- package/dist/chunk-ZDO5A2IZ.cjs.map +0 -1
- package/dist/internal/admin-horizontal-navigation.d.ts.map +0 -1
- package/dist/internal/date-mode-panel.d.ts.map +0 -1
- package/dist/internal/date-time-control.d.ts.map +0 -1
- package/dist/internal/date-time-range-control.d.ts.map +0 -1
- package/dist/internal/option-window.d.ts.map +0 -1
- package/dist/internal/sidebar-navigation.d.ts.map +0 -1
- package/dist/internal/time-panel.d.ts.map +0 -1
- package/dist/internal/use-cascader-lazy.d.ts.map +0 -1
- package/dist/internal/use-floating-layout-observer.d.ts.map +0 -1
- package/dist/internal/use-overlay-focus.d.ts.map +0 -1
- package/dist/internal/use-portal-container.d.ts.map +0 -1
- package/dist/internal/use-presence.d.ts.map +0 -1
- package/dist/internal/use-transfer-remote.d.ts.map +0 -1
- package/dist/internal/use-tree-data.d.ts.map +0 -1
- /package/dist/{chunk-UESSLLSC.js.map → chunk-KNWHIFJE.js.map} +0 -0
- /package/dist/internal/{date-mode-panel.d.ts → date-time/date-mode-panel.d.ts} +0 -0
- /package/dist/internal/{date-time-range-control.d.ts → date-time/date-time-range-control.d.ts} +0 -0
- /package/dist/internal/{time-panel.d.ts → date-time/time-panel.d.ts} +0 -0
- /package/dist/internal/{sidebar-navigation.d.ts → navigation/sidebar-navigation.d.ts} +0 -0
- /package/dist/internal/{use-floating-layout-observer.d.ts → overlay/use-floating-layout-observer.d.ts} +0 -0
- /package/dist/internal/{use-overlay-focus.d.ts → overlay/use-overlay-focus.d.ts} +0 -0
- /package/dist/internal/{use-portal-container.d.ts → overlay/use-portal-container.d.ts} +0 -0
- /package/dist/internal/{use-presence.d.ts → overlay/use-presence.d.ts} +0 -0
- /package/dist/internal/{option-window.d.ts → selection/option-window.d.ts} +0 -0
package/dist/patterns/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Alert as e,AlertDescription as a,AlertTitle as t,Checkbox as r,CheckboxGroup as n,EmptyState as i,Fieldset as l,FieldsetLegend as o,Modal as s,ModalBody as d,ModalCloseButton as c,ModalContent as u,ModalFooter as m,ModalHeader as g,ModalTitle as h,NavigationMenu as p,NavigationMenuContent as v,NavigationMenuItem as b,NavigationMenuLink as f,NavigationMenuTrigger as x,Pagination as w,Radio as y,RadioGroup as N,Select as C,Sidebar as k,Skeleton as S,Table as z,TableBody as T,TableCell as j,TableHead as I,TableHeader as L,TableRow as R,Tabs as A,TabsContent as D,TabsList as E,TabsTrigger as G,Textarea as V}from"../chunk-UEJM2SLH.js";import"../chunk-PZ4UH6BC.js";import{useMediaQuery as $}from"../chunk-XN7GQRSF.js";import{Input as M}from"../chunk-UESSLLSC.js";import{Button as B,cn as P,resolveControlSize as U,resolveDisabled as F,useUIConfig as W}from"../chunk-NRCPYVJW.js";import{forwardRef as O,useEffect as H,useId as _,useRef as q,useState as Q}from"react";import{filterSelectionListOptions as K,getSelectionListScope as J,groupSelectionListOptions as X,updateSelectionListScope as Y}from"@ug666/ui-core";import{ChevronDown as Z,ChevronRight as ee}from"lucide-react";import{jsx as ae,jsxs as te}from"react/jsx-runtime";var re=O(({options:e,value:a,defaultValue:t=[],onValueChange:i,searchable:s=!0,searchPlaceholder:d="搜索选项",emptyLabel:c="没有匹配项",disabled:u,size:m,name:g,form:h,layout:p="stack",collapsibleGroups:v=!1,expandedGroups:b,defaultExpandedGroups:f,onExpandedGroupsChange:x,showSelectAll:w=!0,showSummary:y=!0,showGroupCount:N=!0,className:C,...k},S)=>{const z=W(),T=_(),j=q(null),[I,L]=Q([...t]),[R,A]=Q(""),D=q({value:a,defaultValue:t});D.current={value:a,defaultValue:t};const[E,G]=Q(()=>void 0===f?[]:X(e).filter(e=>!f.includes(e.key)).map(e=>e.key)),V=a??I,$=F(u,z.disabled),O=U(m,z.size),re=K(e,s?R:""),ne=X(re),ie=J(re,V),le=X(e),oe=b??le.filter(e=>!E.includes(e.key)).map(e=>e.key),se=s&&R.trim().length>0,de=ne.every(e=>oe.includes(e.key));function changeExpanded(e){void 0===b&&G(le.filter(a=>!e.includes(a.key)).map(e=>e.key)),x?.(e)}function change(e){$||(void 0===a&&L(e),i?.(e))}return H(()=>{const e=h?document.getElementById(h):j.current?.closest("form");if(!e)return;const a=new Set;function reset(e){const t=setTimeout(()=>{a.delete(t),e.defaultPrevented||(void 0===D.current.value&&L([...D.current.defaultValue]),A(""))},0);a.add(t)}return e.addEventListener("reset",reset),()=>{e.removeEventListener("reset",reset),a.forEach(clearTimeout)}},[h]),te("div",{...k,ref:e=>{j.current=e,"function"==typeof S?S(e):S&&(S.current=e)},className:P("grid min-w-0 gap-[var(--content-gap)] text-text-primary",C),"data-ug":"selection-list","data-ug-slot":"root","data-size":O,"data-layout":p,"data-state":$?"disabled":0===re.length?"empty":"default","data-variant":"grouped",role:"group","aria-label":k["aria-label"]??"选项列表","aria-disabled":$||void 0,children:[s?ae("div",{"data-ug-slot":"search",children:ae(M,{value:R,onValueChange:A,clearable:!0,"aria-label":d,placeholder:d,size:O,disabled:$})}):null,w||y?te("div",{"data-ug-slot":"bulk",className:"flex flex-wrap items-center justify-between gap-[calc(var(--content-gap)*0.5)]",children:[w?ae(r,{checked:ie.checked,indeterminate:ie.indeterminate,size:O,disabled:$||0===ie.available,"aria-describedby":y?`${T}-summary`:void 0,onCheckedChange:e=>change(Y(V,re,e)),label:"全选当前结果"}):null,y?te("span",{id:`${T}-summary`,"data-ug-slot":"summary",className:"text-xs text-text-secondary","aria-live":"polite",children:["已选 ",new Set(V).size," 项;当前 ",ie.total," 项,",ie.available," 项可操作",ie.disabled>0?`,${ie.disabled} 项不可操作`:""]}):null]}):null,v?te("div",{"data-ug-slot":"group-actions",children:[ae(B,{type:"button",size:"default",variant:"ghost",disabled:se||0===ne.length,title:se?"清空搜索后可折叠分组":void 0,onClick:()=>changeExpanded(de?oe.filter(e=>!ne.some(a=>a.key===e)):[...new Set([...oe,...ne.map(e=>e.key)])]),children:de?"全部收起":"全部展开"}),se?ae("span",{"data-ug-slot":"search-hint",children:"搜索时展开匹配分组"}):null]}):null,te("div",{"data-ug-slot":"groups",className:"grid min-w-0 gap-[var(--content-gap)]",children:[ne.map(e=>{const a=J(e.options,V),t=!v||se||oe.includes(e.key),i=`${T}-group-${encodeURIComponent(e.key)}`;return te(l,{variant:"card",size:"sm","data-ug-slot":"group",children:[ae(o,{children:e.label}),te("div",{"data-ug-slot":"group-heading",className:"flex flex-wrap items-center justify-between gap-[calc(var(--content-gap)*0.5)]",children:[ae(r,{checked:a.checked,indeterminate:a.indeterminate,size:O,disabled:$||0===a.available,onCheckedChange:a=>change(Y(V,e.options,a)),label:`全选${e.label}`}),N?te("span",{"data-ug-slot":"group-count",className:"text-xs text-text-secondary",children:["已选 ",a.selected,"/",a.total,a.disabled>0?`,${a.disabled} 项不可操作`:""]}):null,v?ae(B,{type:"button",variant:"ghost",size:"icon",disabled:se,className:N?void 0:"ml-auto","aria-label":`${t?"收起":"展开"}${e.label}选项`,"aria-expanded":t,"aria-controls":i,title:se?"清空搜索后可折叠分组":`${t?"收起":"展开"}${e.label}选项`,onClick:()=>changeExpanded(t?oe.filter(a=>a!==e.key):[...oe,e.key]),children:ae(t?Z:ee,{size:16,"aria-hidden":"true"})}):null]}),ae("div",{id:i,"data-ug-slot":"options",hidden:!t,children:ae(n,{value:V,disabled:$,size:O,orientation:"vertical","aria-label":`${e.label}选项`,onValueChange:e=>change(e.map(String)),children:e.options.map(e=>ae(r,{value:e.id,disabled:e.disabled,"aria-label":e.label,"aria-describedby":[e.description&&`${T}-description-${encodeURIComponent(e.id)}`,e.disabled&&`${T}-locked-${encodeURIComponent(e.id)}`].filter(Boolean).join(" ")||void 0,label:te("span",{"data-ug-slot":"option-label",className:"grid min-w-0 [overflow-wrap:anywhere]",children:[te("span",{children:[e.label,e.disabled?ae("span",{id:`${T}-locked-${encodeURIComponent(e.id)}`,"data-ug-slot":"locked",className:"ml-1 text-xs text-text-secondary",children:"(不可操作)"}):null]}),e.description?ae("span",{id:`${T}-description-${encodeURIComponent(e.id)}`,"data-ug-slot":"option-description",className:"text-xs text-text-secondary",children:e.description}):null]})},e.id))})})]},e.key)}),0===re.length?ae("p",{"data-ug-slot":"empty",className:"text-sm text-text-secondary",role:"status",children:c}):null]}),g?[...new Set(V)].map(e=>ae("input",{type:"hidden",name:g,form:h,value:e,disabled:$},e)):null]})});re.displayName="SelectionList";import{useMemo as ne,useState as ie}from"react";import{ChevronDown as le,ChevronRight as oe}from"lucide-react";import{projectTreeTableRows as se,getTableStructure as de}from"@ug666/ui-core";import{useLayoutEffect as ce,useRef as ue,useState as me}from"react";import{getTableColumnFixed as ge,getTableColumnStyle as he,resolveTableFixedColumns as pe,tableColumnLength as ve,getTableStructure as be,moveTableColumn as fe,getTableSpanGrid as xe}from"@ug666/ui-core";import{observeTableColumnWidths as we}from"@ug666/ui-web";import{Database as ye,RefreshCw as Ne}from"lucide-react";import{useRef as Ce}from"react";import{getTableColumnFixed as ke,getTableColumnStyle as Se}from"@ug666/ui-core";import{ArrowDown as ze,ArrowUp as Te,ArrowUpDown as je,ChevronLeft as Ie,ChevronRight as Le}from"lucide-react";import{jsx as Re,jsxs as Ae}from"react/jsx-runtime";function DataTableHeader({headers:e,layout:a,widths:t,offset:r,selection:n,actions:i,sort:l,order:o,onSortChange:s,reorderable:d,move:c}){const u=Ce(void 0);return Re(L,{children:e.map((m,g)=>Ae(R,{children:[0===g&&null!=n&&Re(I,{rowSpan:e.length,scope:"col","data-leaf-index":0,className:"text-center","data-fixed":ke(a[0]),style:Se(a,0,t),children:n}),m.map(e=>{const{column:n,leafIndex:i,colSpan:m,rowSpan:g,siblingIds:h}=e,p=i+r,v=a.slice(p,p+m),b=ke(v[0]),f=v.every(e=>ke(e)===b),x=Se(a,"right"===b?p+m-1:p,t),w=h.indexOf(n.id),y=n.sortLabel??("string"==typeof n.header||"number"==typeof n.header?String(n.header):n.id),N=Boolean(n.children?.length);return Re(I,{scope:N?"colgroup":"col",colSpan:m,rowSpan:g,"data-leaf-index":N?void 0:p,"data-fixed":f?b:void 0,style:N?{...x,width:void 0,minWidth:void 0}:x,className:n.className,"aria-sort":!N&&n.sortable&&l===n.id?"asc"===o?"ascending":"descending":void 0,draggable:d||void 0,onDragStart:e=>{u.current=n.id,e.dataTransfer.setData("text/plain",n.id),e.dataTransfer.effectAllowed="move"},onDragEnd:()=>{u.current=void 0},onDragOver:e=>{d&&u.current&&h.includes(u.current)&&e.preventDefault()},onDrop:e=>{d&&u.current&&h.includes(u.current)&&(e.preventDefault(),c(u.current,n.id),u.current=void 0)},children:Ae("span",{"data-ug-slot":"header",className:"contents",children:[!N&&n.sortable&&s?Ae(B,{"aria-label":`按${y}排序`,style:{fontWeight:"inherit"},type:"button",size:"sm",tone:"neutral",variant:"text",onClick:()=>s(n.id,l===n.id&&"asc"===o?"desc":"asc"),children:[n.header,l!==n.id?Re(je,{"aria-hidden":!0,size:14}):Re("asc"===o?Te:ze,{"aria-hidden":!0,size:14})]}):n.header,d&&Ae("span",{"data-ug-slot":"column-reorder",children:[Re(B,{type:"button",variant:"text",size:"icon-sm","aria-label":`向左移动${y}`,disabled:0===w,onClick:()=>c(n.id,h[w-1]),children:Re(Ie,{size:14,"aria-hidden":!0})}),Re(B,{type:"button",variant:"text",size:"icon-sm","aria-label":`向右移动${y}`,disabled:w===h.length-1,onClick:()=>c(n.id,h[w+1],!0),children:Re(Le,{size:14,"aria-hidden":!0})})]})]})},n.id)}),0===g&&null!=i&&Re(I,{rowSpan:e.length,scope:"col","data-leaf-index":a.length-1,className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":ke(a.at(-1)),children:i})]},g))})}import{Fragment as De,jsx as Ee,jsxs as Ge}from"react/jsx-runtime";var Ve=["loading-a","loading-b","loading-c","loading-d","loading-e"];function DataTable({rows:n,columns:l,getRowId:o,loading:s=!1,error:d,errorTitle:c="数据加载失败",emptyTitle:u="暂无数据",emptyDescription:m="当前条件下没有可展示的记录。",selectedIds:g=new Set,onSelectionChange:h,sort:p,order:v="asc",onSortChange:b,rowActions:f,actionsLabel:x="操作",page:y=1,total:N=n.length,pageSize:k=20,onPageChange:I,pageSizeOptions:L,onPageSizeChange:A,onRetry:D,retryLabel:E="重试",scrollRegionLabel:G="数据表格",size:V="sm",bordered:$=!0,striped:M=!1,tableClassName:U,fill:F=!1,pagination:W=!0,spanMethod:O,summaryMethod:H,columnOrder:_,defaultColumnOrder:q=[],onColumnOrderChange:Q,reorderableColumns:K=!1,className:J,...X}){const[Y,Z]=me(q),ee=be(l,_??Y),ae=ee.leaves,te=xe(n.length,ae.length,(e,a)=>O?.({row:n[e],column:ae[a],rowIndex:e,columnIndex:a})),re=!s&&H?H({rows:n,columns:ae}):void 0;const ne=ue(null),[ie,le]=me({widths:[],regionWidth:1/0}),oe=ie.widths,se=ae.some(e=>"left"===ge(e)),de=[...h?[{width:"var(--control-height-lg)",fixed:se?"left":void 0}]:[],...ae,...f?[{fixed:"right"}]:[]],Ce=h?1:0,ke=pe(de,oe,ie.regionWidth,f?de.length-1:void 0),Se=JSON.stringify([ee.order,de.map(({width:e,minWidth:a,align:t,fixed:r})=>({width:e,minWidth:a,align:t,fixed:r}))]),ze=n.map(o),Te=ze.length>0&&ze.every(e=>g.has(e)),je=ze.some(e=>g.has(e))&&!Te,Ie=Math.max(Math.ceil(N/Math.max(k,1)),1),Le=[...new Set([...L??[],k])].filter(e=>Number.isSafeInteger(e)&&e>0).sort((e,a)=>e-a),Re=d?"error":s?"loading":0===n.length?"empty":"ready";return ce(()=>(f||ae.some(e=>ge(e)))&&ne.current?we(ne.current,(e,a)=>le({widths:e,regionWidth:a})):void 0,[Se,Re]),Ee("div",{ref:ne,className:P("min-w-0",!F&&"space-y-[calc(var(--content-gap)*0.75)]",J),"data-ug":"data-table","data-fill":F||void 0,"data-state":Re,"data-variant":$?"bordered":"default","data-size":V,...X,children:d?Ge("div",{className:"grid min-h-[calc(var(--control-height-lg)*3)] content-center gap-[calc(var(--content-gap)*0.75)]","data-ug-slot":"feedback",children:[Ge(e,{variant:"destructive",children:[Ee(t,{children:c}),Ee(a,{children:d})]}),D?Ee("div",{children:Ge(B,{onClick:D,size:"sm",type:"button",variant:"default",children:[Ee(Ne,{"aria-hidden":"true",size:16}),E]})}):null]}):Ge(De,{children:[Ee("div",{"data-ug-slot":"table",children:Ge(z,{bordered:$,className:P("min-w-[48rem] table-auto",U),scrollRegionLabel:G,size:V,striped:M,children:[Ee("colgroup",{children:de.map((e,a)=>Ee("col",{style:{width:ve(e.width)}},a))}),Ee(DataTableHeader,{headers:ee.headers,layout:ke,widths:oe,offset:Ce,sort:p,order:v,onSortChange:b,reorderable:K,move:function moveColumn(e,a,t=!1){const r=fe(l,ee.order,e,a,t);r.every((e,a)=>e===ee.order[a])||(void 0===_&&Z(r),Q?.(r))},selection:h?Ee("span",{className:"inline-flex","data-ug-slot":"selection",children:Ee(r,{"aria-label":"选择当前页全部记录",checked:Te,indeterminate:je,onCheckedChange:function toggleAll(e){const a=new Set(g);for(const t of ze)e?a.add(t):a.delete(t);h?.(a)}})}):void 0,actions:f?Ee("span",{"data-ug-slot":"header",children:x}):void 0}),Ge(T,{children:[s?Ve.map(e=>Ge(R,{children:[h?Ee(j,{className:"text-center","data-fixed":ge(ke[0]),style:he(ke,0,oe),children:Ee("span",{className:"inline-flex","data-ug-slot":"selection",children:Ee(S,{className:"size-[calc(var(--control-height-sm)*0.5)]",variant:"rect"})})}):null,ae.map((e,a)=>Ee(j,{className:e.className,"data-fixed":ge(ke[a+Ce]),style:he(ke,a+Ce,oe),children:Ee("span",{"data-ug-slot":"loading",children:Ee(S,{variant:"text"})})},e.id)),f?Ee(j,{className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":ge(ke[de.length-1]),children:Ee("span",{"data-ug-slot":"loading",children:Ee(S,{variant:"text"})})}):null]},e)):n.map((e,a)=>{const t=o(e),n=g.has(t);return Ge(R,{"data-state":n?"selected":"default",children:[h?Ee(j,{className:"text-center","data-fixed":ge(ke[0]),style:he(ke,0,oe),children:Ee("span",{className:"inline-flex","data-ug-slot":"selection",children:Ee(r,{"aria-label":`选择记录 ${t}`,checked:n,onCheckedChange:e=>function toggleOne(e,a){const t=new Set(g);a?t.add(e):t.delete(e),h?.(t)}(t,e)})})}):null,ae.map((t,r)=>te[a][r].rowSpan>0?Ee(j,{rowSpan:te[a][r].rowSpan,colSpan:te[a][r].colSpan,className:t.className,"data-fixed":1===te[a][r].colSpan?ge(ke[r+Ce]):void 0,style:he(ke,r+Ce,oe),children:Ee("span",{className:"contents","data-ug-slot":"cell",children:t.cell?t.cell(e):String(e[t.id]??"—")})},t.id):null),f?Ee(j,{className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":ge(ke[de.length-1]),children:Ee("div",{"data-ug-slot":"actions",children:f(e)})}):null]},t)}),s||0!==n.length?null:Ee(R,{children:Ee(j,{colSpan:ae.length+(h?1:0)+(f?1:0),children:Ee("div",{"data-ug-slot":"empty",children:Ee(i,{description:m,icon:ye,size:"sm",title:u})})})})]}),re&&n.length>0&&Ee("tfoot",{"data-ug-slot":"aggregate",children:Ge(R,{children:[h&&Ee(j,{}),ae.map((e,a)=>Ee(j,{"data-fixed":ge(ke[a+Ce]),style:he(ke,a+Ce,oe),children:re[a]},e.id)),f&&Ee(j,{"data-ug-slot":"action-column","data-fixed":ge(ke[de.length-1])})]})})]})}),W&&!s&&(N>0||L&&A)?Ge("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-[var(--content-gap)] text-sm text-text-secondary max-sm:items-stretch max-sm:flex-col","data-ug-slot":"pagination",children:[Ge("span",{"data-ug-slot":"summary",children:["共 ",N," 条,第 ",y," / ",Ie," 页"]}),Ge("div",{"data-ug-slot":"pagination-controls",children:[L&&A?Ee(C,{"aria-label":"每页条数",options:Le.map(e=>({label:`每页 ${e} 条`,value:e})),size:"sm",value:k,onValueChange:e=>{"number"==typeof e&&A(e)}}):null,I&&Ie>1?Ee(w,{onPageChange:I,page:y,totalPages:Ie,size:"sm"}):null]})]}):null]})})}import{jsx as $e,jsxs as Me}from"react/jsx-runtime";function defaultChildren(e){return e.children}function TreeTable({rows:e,columns:a,getRowId:t,getChildren:r=defaultChildren,getRowLabel:n,treeColumnId:i=de(a).leaves[0]?.id,expandedIds:l,defaultExpandedIds:o,defaultExpandAll:s=!1,onExpandedChange:d,onExpandChange:c,indent:u=16,expansionDisabled:m=!1,expansionDisabledReason:g,fill:h=!1,size:p="sm",bordered:v=!0,className:b,...f}){const[x,w]=ie(()=>o?new Set(o):void 0),y=l??x,N=ne(()=>se(e,{getRowId:t,getChildren:r,expandedIds:y,defaultExpandAll:s}),[e,t,r,y,s]),C=new Map(N.visibleRows.map(e=>[e.id,e]));function toggle(e,a){if(m)return;const r=t(e),n=new Set(y??(s?N.expandableIds:[]));a?n.add(r):n.delete(r),void 0===l&&w(n),d?.(n),c?.(e,a)}const decorate=e=>e.map(e=>e.children?.length?{...e,children:decorate(e.children)}:e.id!==i?e:{...e,cell:a=>{const r=C.get(t(a)),i=n?.(a)??`记录 ${r.id}`;return Me("div",{"data-ug-slot":"tree-cell","data-depth":r.depth,style:{paddingInlineStart:r.depth*Math.max(u,0)},children:[Me("span",{"data-ug-slot":"level",children:["层级 ",r.depth+1,","]}),r.hasChildren?$e(B,{type:"button",size:"icon-sm",variant:"ghost",tone:"neutral","aria-label":`${r.expanded?"收起":"展开"}${i}`,"aria-expanded":r.expanded,disabled:m,"aria-description":g,onClick:()=>toggle(a,!r.expanded),onKeyDown:e=>{m||("ArrowRight"!==e.key||r.expanded||(e.preventDefault(),toggle(a,!0)),"ArrowLeft"===e.key&&r.expanded&&(e.preventDefault(),toggle(a,!1)))},children:r.expanded?$e(le,{size:16,"aria-hidden":!0}):$e(oe,{size:16,"aria-hidden":!0})}):$e("span",{"data-ug-slot":"tree-spacer","aria-hidden":!0}),$e("span",{"data-ug-slot":"tree-content",title:i,children:e.cell?e.cell(a):String(a[e.id]??"—")})]})}}),k=decorate(a);return $e("div",{className:b,"data-ug":"tree-table","data-ug-slot":"root","data-fill":h||void 0,"data-size":p,"data-variant":v?"bordered":"default","data-state":f.error?"error":f.loading?"loading":N.visibleRows.length?"ready":"empty",children:$e(DataTable,{...f,rows:N.visibleRows.map(e=>e.record),columns:k,getRowId:t,pagination:!1,fill:h,size:p,bordered:v})})}import{resolveUGNavigationColors as Be,resolveUGNavigationPalette as Pe}from"@ug666/ui-core/theme";import{forwardRef as Ue,useState as Fe}from"react";import{Menu as We,PanelLeftClose as Oe,PanelLeftOpen as He}from"lucide-react";import{memo as _e,useCallback as qe,useLayoutEffect as Qe,useMemo as Ke,useRef as Je,useState as Xe}from"react";import{ChevronDown as Ye,MoreHorizontal as Ze}from"lucide-react";import{createSidebarTreeMeta as ea}from"@ug666/ui-web/sidebar";import{jsx as aa,jsxs as ta}from"react/jsx-runtime";function activeClass(e,a){return e?"indicator"===a?"bg-transparent text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-active-text)] data-[state=open]:bg-[var(--ug-navigation-hover-bg)] data-[state=open]:text-[var(--ug-navigation-active-text)] after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:bg-[var(--ug-navigation-active-text)]":"bg-[var(--ug-navigation-active-bg)] text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-active-bg)] hover:text-[var(--ug-navigation-active-text)] data-[state=open]:bg-[var(--ug-navigation-active-bg)] data-[state=open]:text-[var(--ug-navigation-active-text)]":"bg-transparent text-[var(--ug-navigation-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-text)] data-[state=open]:bg-[var(--ug-navigation-hover-bg)] data-[state=open]:text-[var(--ug-navigation-text)]"}function topItemClass(e,a,t){return P("relative flex max-w-40 items-center gap-1.5 rounded-[var(--radius-control)] px-2.5 font-medium","compact"===t?"h-8 text-xs":"h-9 text-sm",activeClass(e,a))}function moreItemClass(e,a,t){return P("relative flex shrink-0 items-center gap-1 px-2.5","compact"===t?"h-8 text-xs":"h-9 text-sm",activeClass(e,a))}var ra=_e(function DropdownItems2({items:e,level:a=0}){return aa("div",{className:P("grid min-w-52 gap-1 p-1.5",a>0&&"min-w-48 border-l border-[var(--ug-navigation-border)] pl-2"),children:e.map((e,t)=>{const r=e.icon,n=e.id??e.href??`${a}-${t}-${e.label}`;return e.children?.length?ta("div",{className:"grid gap-1",children:[ta("div",{className:"flex items-center gap-2 px-2 py-1.5 text-xs font-semibold text-[var(--ug-navigation-text)] opacity-75",children:[aa(r,{"aria-hidden":"true",size:14}),aa("span",{className:"truncate",children:e.label})]}),aa(DropdownItems2,{items:e.children,level:a+1})]},n):ta(f,{active:e.active,className:P("flex w-full items-center gap-2 px-2.5 py-2",(i=Boolean(e.active),i?"bg-[var(--ug-navigation-active-bg)] text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-active-bg)] hover:text-[var(--ug-navigation-active-text)]":"bg-transparent text-[var(--ug-navigation-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-text)]")),href:e.href,children:[aa(r,{"aria-hidden":"true",size:15}),aa("span",{className:"min-w-0 flex-1 truncate",children:e.label}),void 0!==e.badge?aa("span",{className:"text-xs opacity-70",children:e.badge}):null]},n);var i})})}),na=_e(function TopItem2({item:e,active:a,activeStyle:t,density:r}){const n=e.icon,i=topItemClass(a,t,r);return e.children?.length?ta(b,{children:[ta(x,{active:a,className:i,children:[aa(n,{"aria-hidden":"true",size:15}),aa("span",{className:"truncate",children:e.label})]}),aa(v,{className:"max-h-[min(70dvh,32rem)] overflow-y-auto overscroll-contain border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]",children:aa(ra,{items:e.children})})]}):aa(b,{children:ta(f,{active:a,className:i,href:e.href,children:[aa(n,{"aria-hidden":"true",size:15}),aa("span",{className:"truncate",children:e.label})]})})});function AdminHorizontalNavigation({items:e,activeStyle:a,density:t}){const r=Ke(()=>function normalizeItems(e){const a=1===e.length?e[0]:void 0;return a?.children?.length?a.href?[{...a,children:void 0},...a.children]:a.children:e}(e),[e]),n=Ke(()=>ea(r),[r]),[i,l]=Xe(()=>Math.min(r.length,6)),o=Je(null),s=Je(null),d=Je(null),c=Ke(()=>r.slice(0,i),[r,i]),u=Ke(()=>r.slice(i),[r,i]),m=qe(e=>Boolean(e.active||n.activeBranches.has(e)),[n]),g=Ke(()=>u.some(m),[m,u]),h=qe(()=>{const e=o.current,a=s.current;if(!e||!a||e.clientWidth<=0)return void l(Math.min(r.length,6));const t=Array.from(a.querySelectorAll('[data-ug-navigation-measure="item"]')),n=a.querySelector('[data-ug-navigation-measure="more"]'),i=Number.parseFloat(window.getComputedStyle(a).columnGap)||4,d=n?.getBoundingClientRect().width??0;let c=0,u=0;for(let a=0;a<t.length;a+=1){const r=t[a]?.getBoundingClientRect().width??0,n=a>0?i:0;if(c+n+r+(a<t.length-1?i+d:0)>e.clientWidth+.5)break;c+=n+r,u+=1}l(u)},[r]),f=qe(()=>{null===d.current&&(d.current=window.requestAnimationFrame(()=>{d.current=null,h()}))},[h]);return Qe(()=>{let e=!1;const a="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(f);return o.current&&a?.observe(o.current),f(),document.fonts?.ready.then(()=>{e||f()}),()=>{e=!0,null!==d.current&&window.cancelAnimationFrame(d.current),d.current=null,a?.disconnect()}},[t,f]),ta("div",{className:"relative min-w-0 flex-1",ref:o,children:[ta("div",{"aria-hidden":"true",className:"pointer-events-none absolute invisible flex max-w-none items-center gap-1 whitespace-nowrap","data-ug-slot":"measure",inert:!0,ref:s,children:[r.map((e,r)=>{const n=e.icon;return ta("span",{className:P(topItemClass(m(e),a,t),"max-w-none shrink-0"),"data-ug-navigation-measure":"item",children:[aa(n,{"aria-hidden":"true",size:15}),aa("span",{children:e.label}),e.children?.length?aa(Ye,{"aria-hidden":"true",size:14}):null]},e.id??e.href??`measure-${r}-${e.label}`)}),ta("span",{className:moreItemClass(!1,a,t),"data-ug-navigation-measure":"more",children:[aa(Ze,{"aria-hidden":"true",size:16}),aa("span",{children:"更多"})]})]}),ta(p,{activation:"click",tone:"inherit",className:"min-w-0 w-full overflow-visible","data-ug-context":"admin-horizontal-navigation",children:[c.map((e,r)=>aa(na,{active:m(e),activeStyle:a,density:t,item:e},e.id??e.href??`${r}-${e.label}`)),u.length?ta(b,{children:[ta(x,{active:g,className:moreItemClass(g,a,t),children:[aa(Ze,{"aria-hidden":"true",size:16}),aa("span",{children:"更多"})]}),aa(v,{className:"right-0 left-auto max-h-[min(70dvh,32rem)] overflow-y-auto overscroll-contain border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]",children:aa(ra,{items:u})})]}):null]})]})}import{Fragment as ia,jsx as la,jsxs as oa}from"react/jsx-runtime";var sa=Ue(({navItems:e,sidebarHeader:a,sidebarCollapsedHeader:t,sidebarHeaderAlign:r="start",sidebarHeaderDivider:n=!0,sidebarContextSwitcher:i,sidebarContextSwitcherVisible:l=!1,sidebarContextSwitcherDividers:o=!1,sidebarContextSwitcherPlacement:s="after-search",sidebarScrollActiveItemIntoView:d=!0,sidebarFooter:c,sidebarVariant:u="dark",navigationMode:m="sidebar",navigationPalette:g,themePreset:h="default",themeMode:p,themeAccent:v="theme",navigationColors:b,navigationActiveStyle:f,navigationDensity:x,sidebarActiveStyle:w="highlight",sidebarDensity:y="comfortable",sidebarSearchable:N=!1,sidebarSearchPlaceholder:C="搜索菜单...",sidebarSearchDividers:S=!0,sidebarCollapsible:z=!0,sidebarTogglePlacement:T="sidebar",sidebarResizable:j=!1,sidebarWidth:I,defaultSidebarWidth:L=256,sidebarMinWidth:R=208,sidebarMaxWidth:A=480,onSidebarWidthChange:D,sidebarCollapsed:E,defaultSidebarCollapsed:G=!1,onSidebarCollapsedChange:V,mobileSidebarOpen:M,onMobileSidebarOpenChange:U,topbarStart:F,topbarEnd:W,topbar:O,secondaryBar:H,topbarBordered:_=!0,secondaryBarBordered:q=!1,fluidContent:Q=!1,contentPadding:K=!0,mainClassName:J,contentClassName:X,children:Y,className:Z,...ee},ae)=>{const te=$("(prefers-color-scheme: dark)"),[re,ne]=Fe(G),[ie,le]=Fe(!1),oe=E??re,se=M??ie,de=g??("primary"===u?"light":"dark"),ce=void 0===p?de:Pe(p,te),ue=b?de:ce,me=Be(h,ue,b,v),ge=f??w,he=x??y,pe="light"===ue?"primary":"dark",ve={"--ug-navigation-bg":me.background,"--ug-navigation-text":me.text,"--ug-navigation-active-bg":me.activeBackground,"--ug-navigation-active-text":me.activeText,"--ug-navigation-hover-bg":me.hoverBackground,"--ug-navigation-border":`color-mix(in srgb, ${me.text} 18%, ${me.background})`};function setSidebarCollapsed(e){void 0===E&&ne(e),V?.(e)}function setMobileOpen(e){void 0===M&&le(e),U?.(e)}return la("div",{ref:ae,className:P("text-text-primary",Z),...ee,"data-ug":"admin-shell","data-state":se?"mobile-open":"default","data-variant":pe,"data-navigation-mode":m,"data-navigation-palette":ue,"data-sidebar-active-style":ge,"data-sidebar-density":he,"data-size":"md",children:oa("div",{className:"flex min-h-screen min-w-0",children:[la(k,{items:e,variant:pe,activeStyle:ge,density:he,colors:me,header:a,headerAlign:r,headerDivider:n,collapsedHeader:t,contextSwitcher:i,contextSwitcherVisible:l,contextSwitcherDividers:o,contextSwitcherPlacement:s,scrollActiveItemIntoView:d,footer:c,searchable:N,searchPlaceholder:C,searchDividers:S,collapsible:z&&"sidebar"===T,bottomCollapsible:z&&"bottom"===T,resizable:j,width:I,defaultWidth:L,minWidth:R,maxWidth:A,onWidthChange:D,collapsed:oe,onCollapsedChange:setSidebarCollapsed,responsive:!0,mobileOpen:se,onMobileOpenChange:setMobileOpen,className:P("shrink-0","header"===m&&"lg:hidden"),"data-ug-slot":"sidebar"}),oa("div",{className:"flex min-w-0 flex-1 flex-col",children:[oa("header",{className:P("sticky top-0 z-30 flex items-center gap-[calc(var(--content-gap)*0.75)] px-[var(--content-gap)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]",_?"border-b":"border-b-0","header"===m?"border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]":"border-border-base bg-surface-0"),style:"header"===m?ve:void 0,"data-ug-slot":"topbar",children:[la(B,{type:"button",variant:"ghost",size:"icon",className:"md:hidden","aria-label":"打开侧边栏",onClick:()=>setMobileOpen(!0),"data-ug-slot":"mobile-trigger",children:la(We,{"aria-hidden":"true",focusable:"false",size:18})}),"sidebar"===m&&z&&"topbar"===T?la(B,{type:"button",variant:"ghost",size:"icon",className:"hidden md:inline-flex","aria-label":oe?"展开侧边栏":"折叠侧边栏",onClick:()=>setSidebarCollapsed(!oe),"data-ug-slot":"desktop-sidebar-trigger",children:la(oe?He:Oe,{"aria-hidden":"true",focusable:"false",size:18})}):null,"header"===m?oa(ia,{children:[la("div",{className:"hidden shrink-0 items-center lg:flex",children:a}),la("div",{className:"hidden min-w-0 flex-1 lg:flex",children:la(AdminHorizontalNavigation,{activeStyle:ge,density:he,items:e})}),la("div",{className:"min-w-0 flex-1 lg:hidden","data-ug-slot":"topbar-start",children:F})]}):la("div",O?{className:"min-w-0 flex-1","data-ug-slot":"topbar-content",children:O}:{className:"min-w-0 flex-1","data-ug-slot":"topbar-start",children:F}),"header"!==m&&O||!W?null:la("div",{className:"flex shrink-0 items-center gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"topbar-end",children:W},"topbar-end")]}),H?la("div",{className:P("sticky top-[var(--ug-admin-shell-topbar-height)] z-20 bg-surface-1",q&&"border-b border-border-base"),"data-ug-slot":"secondary-bar",children:H}):null,la("main",{className:P("flex-1 overflow-x-clip",J),"data-ug-slot":"main",children:la("div",{className:P("mx-auto",Q?"max-w-none":"max-w-7xl",K?"px-[var(--content-gap)] py-[calc(var(--content-gap)*1.5)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]":"!p-0",X),"data-ug-context":"admin-shell","data-ug-slot":"content",children:Y})})]})]})})});sa.displayName="AdminShell";import{ChevronLeft as da,ChevronRight as ca,X as ua}from"lucide-react";import{forwardRef as ma,memo as ga,useCallback as ha,useEffect as pa,useLayoutEffect as va,useMemo as ba,useRef as fa,useState as xa}from"react";import{jsx as wa,jsxs as ya}from"react/jsx-runtime";function getScrollBehavior(e){return e.closest('[data-ug-motion="reduced"]')||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function getTabElements(e){return Array.from(e.children).filter(e=>e instanceof HTMLLIElement&&"item"===e.dataset.ugSlot)}function clearItemMotion(e){delete e.dataset.motion,e.style.removeProperty("--ug-app-tabs-motion-x")}function playItemMotion(e,a,t=0){const r=Boolean(e.dataset.motion);clearItemMotion(e),r&&e.offsetWidth,"move"===a&&e.style.setProperty("--ug-app-tabs-motion-x",`${t}px`),e.dataset.motion=a}var Na=ga(({active:e,activeItemRef:a,closable:t,closeEnabled:r,icon:n,label:i,onActivate:l,onClose:o,value:s})=>ya("li",{"data-closable":t||void 0,"data-state":e?"active":"default","data-ug-slot":"item","data-value":s,ref:e?a:void 0,children:[ya("button",{"aria-current":e?"page":void 0,"data-ug-slot":"trigger",onAuxClick:e=>{1===e.button&&t&&r&&(e.preventDefault(),o(s))},onClick:()=>l(s),title:i,type:"button",children:[n?wa("span",{"aria-hidden":"true","data-ug-slot":"icon",children:n}):null,wa("span",{"data-ug-slot":"label",children:i})]}),t&&r?wa("button",{"aria-label":`关闭页面 ${i}`,"data-ug-slot":"close",onClick:()=>o(s),type:"button",children:wa(ua,{"aria-hidden":"true",size:13})}):null]}));Na.displayName="AppTabView";var Ca=ma(({items:e,value:a,density:t="comfortable",showIcons:r=!0,closable:n=!0,bordered:i=!0,onValueChange:l,onClose:o,className:s,"aria-label":d="页面标签",...c},u)=>{const m=fa(null),g=fa(null),h=fa(null),p=fa(null),v=fa(null),b=fa(new Map),f=fa(null),x=fa(e),w=fa(l),y=fa(o),[N,C]=xa({canScrollStart:!1,canScrollEnd:!1}),k=N.canScrollStart||N.canScrollEnd,S=ba(()=>e.map(e=>`${e.value}${e.label}${n&&e.closable?"1":"0"}${r&&e.icon?"1":"0"}`).join(""),[n,e,r]);x.current=e,w.current=l,y.current=o;const z=ha(e=>{const a=x.current.find(a=>a.value===e);a&&w.current(a)},[]),T=ha(e=>{const a=x.current.find(a=>a.value===e);if(!a)return;const t=g.current,r=t?getTabElements(t).find(a=>a.dataset.value===e):null;r?.contains(document.activeElement)&&(f.current=e),y.current?.(a)},[]),j=ha(()=>{null===p.current&&(p.current=window.requestAnimationFrame(()=>{p.current=null;const e=g.current;if(!e)return;const a=Math.max(0,e.scrollWidth-e.clientWidth),t={canScrollStart:e.scrollLeft>1,canScrollEnd:e.scrollLeft<a-1};C(e=>e.canScrollStart===t.canScrollStart&&e.canScrollEnd===t.canScrollEnd?e:t)}))},[]),I=ha(e=>{const a=g.current,t=h.current;if(!a||!t)return;const r=getTabElements(a);if(t===r[0]&&a.scrollLeft>1)return void a.scrollBy({behavior:e,left:-a.scrollLeft});const n=Math.max(0,a.scrollWidth-a.clientWidth);if(t===r[r.length-1]&&a.scrollLeft<n-1)return void a.scrollBy({behavior:e,left:n-a.scrollLeft});const i=t.offsetLeft-a.scrollLeft,l=i+t.offsetWidth-a.clientWidth;i<0?a.scrollBy({behavior:e,left:i-2}):l>0&&a.scrollBy({behavior:e,left:l+2})},[]);function scrollTabs(e){const a=g.current;a&&a.scrollBy({behavior:getScrollBehavior(a),left:e*Math.max(160,.6*a.clientWidth)})}return va(()=>{const e=g.current;if(!e)return;const a=getTabElements(e),t=new Map;for(const e of a){const a=e.dataset.value;a&&t.set(a,e.offsetLeft)}const r=b.current;if(r.size>0&&"auto"!==getScrollBehavior(e))for(const e of a){const a=e.dataset.value;if(!a)continue;const n=r.get(a),i=t.get(a)??0,l=void 0===n?0:n-i;void 0!==n&&Math.abs(l)<.5||playItemMotion(e,void 0===n?"enter":"move",l)}b.current=t},[S]),va(()=>{const e=f.current;if(!e||x.current.some(a=>a.value===e))return;const a=g.current?.querySelector('[data-ug-slot="item"][data-state="active"] [data-ug-slot="trigger"]');a&&(f.current=null,a.focus({preventScroll:!0}))},[S,a]),pa(()=>{const e=m.current,a=g.current;if(!e||!a)return;j(),a.addEventListener("scroll",j,{passive:!0});const handleContainerResize=()=>{j(),null!==v.current&&window.cancelAnimationFrame(v.current),v.current=window.requestAnimationFrame(()=>{v.current=window.requestAnimationFrame(()=>{v.current=null,I("auto"),j()})})},t="undefined"==typeof ResizeObserver?null:new ResizeObserver(handleContainerResize);return t?t.observe(e):window.addEventListener("resize",handleContainerResize),()=>{a.removeEventListener("scroll",j),t?t.disconnect():window.removeEventListener("resize",handleContainerResize),null!==p.current&&(window.cancelAnimationFrame(p.current),p.current=null),null!==v.current&&(window.cancelAnimationFrame(v.current),v.current=null)}},[I,j]),pa(()=>{if(!e.some(e=>e.value===a))return;const t=g.current;t&&(I(getScrollBehavior(t)),j())},[e,I,j,a]),wa("nav",{ref:u,...c,"aria-label":d,className:P("text-text-primary",!i&&"[background-image:none]",s),"data-density":t,"data-overflow":k||void 0,"data-size":"md","data-state":k?"overflow":"default","data-ug":"app-tabs","data-variant":"browser",children:ya("div",{"data-ug-slot":"track",ref:m,children:[wa("button",{"aria-label":"向左滚动页面标签","data-ug-slot":"scroll-start","data-visible":k&&N.canScrollStart||void 0,disabled:!N.canScrollStart,onClick:()=>scrollTabs(-1),type:"button",children:wa(da,{"aria-hidden":"true",size:15})}),wa("ul",{ref:g,"aria-label":"页面标签列表","data-ug-slot":"list",onAnimationEnd:e=>{["ug-motion-app-tab-enter","ug-motion-app-tab-layout-shift"].includes(e.animationName)&&clearItemMotion(e.target)},children:e.map(e=>wa(Na,{active:e.value===a,activeItemRef:h,closable:n&&Boolean(e.closable),closeEnabled:n&&Boolean(o),icon:r?e.icon:void 0,label:e.label,onActivate:z,onClose:T,value:e.value},e.value))}),wa("button",{"aria-label":"向右滚动页面标签","data-ug-slot":"scroll-end","data-visible":k&&N.canScrollEnd||void 0,disabled:!N.canScrollEnd,onClick:()=>scrollTabs(1),type:"button",children:wa(ca,{"aria-hidden":"true",size:15})})]})})});Ca.displayName="AppTabs";import{forwardRef as ka}from"react";import{AlertTriangle as Sa,HelpCircle as za}from"lucide-react";import{jsx as Ta,jsxs as ja}from"react/jsx-runtime";var Ia=ka(({open:e,onOpenChange:a,title:t,description:r,children:n,variant:i="destructive",icon:l,cancelText:o="取消",confirmText:d="确认",loading:c=!1,disabled:p=!1,closeOnConfirm:v=!0,onCancel:b,onConfirm:f,className:x,...w},y)=>{const N=l??("destructive"===i?Sa:za);function handleCancel(){c||(b?.(),a(!1))}return Ta(s,{open:e,onClose:handleCancel,closeOnEsc:!c,closeOnOverlay:!c,children:ja(u,{ref:y,className:P("max-w-md",x),...w,"data-ug":"confirm-dialog","data-state":e?"open":"default","data-variant":i,"data-size":"md",children:[ja(g,{className:"items-start gap-[calc(var(--content-gap)*0.75)]","data-ug-slot":"header",children:[Ta("div",{className:P("flex h-[var(--control-height-md)] w-[var(--control-height-md)] shrink-0 items-center justify-center rounded-[var(--radius-control)]","destructive"===i?"bg-danger-soft text-danger-soft-fg":"bg-primary-soft text-primary-soft-fg"),"data-ug-slot":"icon",children:Ta(N,{size:20,"aria-hidden":"true"})}),ja("div",{className:"min-w-0 flex-1 space-y-[calc(var(--content-gap)*0.25)]","data-ug-slot":"content",children:[Ta(h,{className:"break-words text-base","data-ug-slot":"title",children:t}),r?Ta("p",{className:"text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:r}):null]})]}),n?Ta("div",{className:"px-[var(--content-gap)] py-[var(--content-gap)] text-sm text-text-secondary","data-ug-slot":"body",children:n}):null,ja(m,{className:"flex-col-reverse gap-[calc(var(--content-gap)*0.5)] sm:flex-row","data-ug-slot":"footer",children:[Ta(B,{type:"button",variant:"outline",disabled:c,onClick:handleCancel,"data-ug-slot":"cancel",children:o}),Ta(B,{type:"button",variant:"destructive"===i?"destructive":"default",loading:c,disabled:p,onClick:function handleConfirm(){const e=f?.();return v&&a(!1),e},"data-ug-slot":"confirm",children:d})]})]})})});Ia.displayName="ConfirmDialog";import{forwardRef as La,useEffect as Ra,useRef as Aa,useState as Da}from"react";import{Check as Ea,Copy as Ga}from"lucide-react";import{jsx as Va,jsxs as $a}from"react/jsx-runtime";var Ma=La(({value:e,label:a,displayValue:t,monospace:r=!0,disabled:n=!1,bordered:i=!0,showIcon:l=!0,showCopyText:o=!0,copyLabel:s="复制",copiedLabel:d="已复制",onCopied:c,onCopyError:u,className:m,...g},h)=>{const[p,v]=Da(!1),b=Aa(null),f=Aa({value:e,generation:0,mounted:!0});return f.current.value!==e&&(f.current.value=e,f.current.generation++),Ra(()=>(f.current.mounted=!0,()=>{f.current.mounted=!1,f.current.generation++,b.current&&clearTimeout(b.current)}),[]),Ra(()=>{v(!1),b.current&&(clearTimeout(b.current),b.current=null)},[e]),$a("div",{ref:h,className:P("space-y-[calc(var(--content-gap)*0.5)]",m),...g,"data-ug":"copy-field","data-state":n?"disabled":p?"copied":"default","data-variant":r?"monospace":"default","data-bordered":i?"true":"false","data-size":"md",children:[a?Va("div",{className:"text-xs font-medium text-text-secondary","data-ug-slot":"label",children:a}):null,$a("div",{className:P("flex min-w-0 items-stretch overflow-hidden rounded-[var(--radius-control)] bg-surface-1",i&&"border border-border-base",n&&"opacity-60"),"data-ug-slot":"field",children:[Va("div",{className:P("min-w-0 flex-1 self-center truncate px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.5)] text-sm text-text-primary",r&&"font-mono"),title:"string"==typeof t?t:e,"data-ug-slot":"value",children:t??e}),Va("div",{className:P("flex shrink-0 items-center bg-surface-2 px-[calc(var(--content-gap)*0.375)]",i&&"border-l border-border-base"),"data-ug-slot":"action",children:$a(B,{type:"button",variant:"ghost",size:"sm",disabled:n,onClick:async function handleCopy(){if(n)return;const a=e,t=++f.current.generation,isCurrent=()=>f.current.mounted&&f.current.generation===t&&f.current.value===a;v(!1),b.current&&(clearTimeout(b.current),b.current=null);try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API is not available");if(await navigator.clipboard.writeText(a),!isCurrent())return;if(v(!0),c?.(a),!isCurrent())return;b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{isCurrent()&&v(!1),b.current=null},1400)}catch(e){isCurrent()&&u?.(e)}},"aria-label":o?void 0:p?d:s,"aria-live":"polite","data-ug-slot":"button",children:[l?Va(p?Ea:Ga,{"aria-hidden":"true",focusable:"false",size:15}):null,o?p?d:s:null]})})]})]})});Ma.displayName="CopyField";import{jsx as Ba,jsxs as Pa}from"react/jsx-runtime";function DataTableIdentity({title:e,description:a,leading:t,showLeading:r=!0,showDescription:n=!0,className:i,...l}){return Pa("span",{className:P("gap-[calc(var(--content-gap)*0.5)]",i),...l,"data-size":"md","data-state":"default","data-ug":"data-table-identity","data-variant":"default",children:[r&&t?Ba("span",{"data-ug-slot":"leading",children:t}):null,Pa("span",{"data-ug-slot":"copy",children:[Ba("strong",{"data-ug-slot":"title",children:e}),n&&a?Ba("small",{className:"text-text-secondary","data-ug-slot":"description",children:a}):null]})]})}import{jsx as Ua,jsxs as Fa}from"react/jsx-runtime";function DataTableToolbar({title:e,description:a,showDescription:t=!0,bordered:r=!0,compact:n=!1,actions:i,children:l,className:o,...s}){return Fa("div",{className:P("gap-[var(--content-gap)] border-border-base",!r&&"border-b-0",n&&"py-[calc(var(--content-gap)*0.5)]",o),...s,"data-size":n?"sm":"md","data-state":"default","data-ug":"data-table-toolbar","data-variant":"default",children:[Fa("div",{"data-ug-slot":"heading",children:[Ua("strong",{"data-ug-slot":"title",children:e}),t&&a?Ua("span",{"data-ug-slot":"description",children:a}):null]}),l?Ua("div",{"data-ug-slot":"filters",children:l}):null,i?Ua("div",{className:"flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"actions",children:i}):null]})}import{forwardRef as Wa}from"react";import{jsx as Oa,jsxs as Ha}from"react/jsx-runtime";var _a=Wa(({eyebrow:e,title:a,description:t,badge:r,breadcrumb:n,actions:i,meta:l,bordered:o=!0,compact:s=!1,children:d,className:c,...u},m)=>Ha("header",{ref:m,className:P("flex min-w-0 flex-col",s?"gap-[calc(var(--content-gap)*0.875)]":"gap-[calc(var(--content-gap)*1.25)]",o&&(s?"border-b border-border-base pb-[var(--content-gap)]":"border-b border-border-base pb-[calc(var(--content-gap)*1.5)]"),c),...u,"data-ug":"page-header","data-state":"default","data-variant":o?"default":"borderless","data-size":s?"sm":"md",children:[n?Oa("div",{className:"min-w-0","data-ug-slot":"breadcrumb",children:n}):null,Ha("div",{className:"flex min-w-0 flex-col gap-[var(--content-gap)] lg:flex-row lg:items-start lg:justify-between","data-ug-slot":"body",children:[Ha("div",{className:"min-w-0 space-y-[calc(var(--content-gap)*0.75)]","data-ug-slot":"content",children:[e?Oa("div",{className:"text-xs font-semibold uppercase text-primary","data-ug-slot":"eyebrow",children:e}):null,Ha("div",{className:"flex min-w-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.625)]",children:[Oa("h1",{className:"min-w-0 break-words text-2xl font-bold leading-tight text-text-primary sm:text-3xl","data-ug-slot":"title",children:a}),r?Oa("div",{className:"shrink-0","data-ug-slot":"badge",children:r}):null]}),t?Oa("p",{className:"max-w-3xl text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:t}):null,l?Oa("div",{className:"flex min-w-0 flex-wrap items-center gap-x-[var(--content-gap)] gap-y-[calc(var(--content-gap)*0.5)] text-xs text-text-tertiary","data-ug-slot":"meta",children:l}):null]}),i?Oa("div",{className:"flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)] lg:justify-end","data-ug-slot":"actions",children:i}):null]}),d?Oa("div",{className:"min-w-0","data-ug-slot":"footer",children:d}):null]}));_a.displayName="PageHeader";import{forwardRef as qa}from"react";import{ArrowRight as Qa}from"lucide-react";import{Fragment as Ka,jsx as Ja,jsxs as Xa}from"react/jsx-runtime";var Ya={2:"md:grid-cols-2 xl:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 xl:grid-cols-4"};function QuickAccessContent({item:e,showIcon:a,showIndicator:t}){const r=e.icon,n=Boolean(a&&r);return Xa(Ka,{children:[n&&r?Ja("span",{"aria-hidden":"true",className:"flex h-[var(--control-height-lg)] w-[var(--control-height-lg)] shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-primary-soft text-primary-soft-fg","data-ug-slot":"icon",children:Ja(r,{size:20})}):null,Xa("span",{className:P("min-w-0",!n&&"col-start-1"),"data-ug-slot":"content",children:[Xa("span",{className:"flex min-w-0 flex-wrap items-center gap-x-[calc(var(--content-gap)*0.5)] gap-y-1",children:[Ja("strong",{className:"min-w-0 break-words text-sm font-semibold leading-5","data-ug-slot":"item-title",children:e.title}),e.meta?Ja("span",{className:"text-xs leading-5 text-text-tertiary","data-ug-slot":"meta",children:e.meta}):null]}),e.description?Ja("span",{className:"mt-1 block break-words text-xs leading-5 text-text-secondary","data-ug-slot":"item-description",children:e.description}):null]}),t?Ja(Qa,{"aria-hidden":"true",className:P("shrink-0 text-text-tertiary transition-[color] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] group-hover:text-primary",!n&&"col-start-2"),"data-ug-slot":"indicator",size:16}):null]})}var Za=qa(({title:e,description:a,items:t,columns:r=4,showIndicator:n=!0,showIcon:i=!0,bordered:l=!0,onSelect:o,className:s,...d},c)=>Xa("section",{ref:c,...d,className:P("min-w-0 space-y-[var(--content-gap)]",s),"data-ug":"quick-access","data-state":t.length>0?"ready":"empty","data-variant":r,"data-size":"md",children:[e||a?Xa("div",{className:"min-w-0 space-y-1","data-ug-slot":"header",children:[e?Ja("h2",{className:"text-base font-semibold leading-6 text-text-primary","data-ug-slot":"title",children:e}):null,a?Ja("p",{className:"text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:a}):null]}):null,Ja("div",{className:P("grid min-w-0 gap-[var(--content-gap)]",Ya[r]),"data-ug-slot":"grid",children:t.map(e=>{const a=e.disabled?"disabled":"interactive",t=function getItemClasses(e,a,t){return P("group grid min-h-[calc(var(--control-height-lg)*2)] min-w-0 w-full items-center gap-[var(--content-gap)]",a&&t?"grid-cols-[auto_minmax(0,1fr)_auto]":a?"grid-cols-[auto_minmax(0,1fr)]":t?"grid-cols-[minmax(0,1fr)_auto]":"grid-cols-[minmax(0,1fr)]","rounded-[var(--radius-panel)] bg-surface-1 p-[var(--content-gap)] text-left text-text-primary shadow-sm",e?"border border-border-base hover:border-border-strong":"border border-transparent","transition-[background-color,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)]","hover:bg-surface-2 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-border-base disabled:hover:bg-surface-1 disabled:hover:shadow-sm")}(l,Boolean(i&&e.icon),n);return e.href&&!e.disabled?Ja("a",{className:t,"data-state":a,"data-ug-slot":"item",href:e.href,onClick:()=>o?.(e),children:Ja(QuickAccessContent,{item:e,showIcon:i,showIndicator:n})},e.id):Ja("button",{className:t,"data-state":a,"data-ug-slot":"item",disabled:e.disabled,onClick:()=>o?.(e),type:"button",children:Ja(QuickAccessContent,{item:e,showIcon:i,showIndicator:n})},e.id)})})]}));Za.displayName="QuickAccess";import{forwardRef as et}from"react";import{Send as at,Square as tt}from"lucide-react";import{jsx as rt,jsxs as nt}from"react/jsx-runtime";var it=et(({value:e,onValueChange:a,onSubmit:t,onStop:r,onPasteFiles:n,header:i,leading:l,trailing:o,footer:s,submitting:d=!1,disabled:c=!1,submitDisabled:u=!1,allowEmpty:m=!1,submitOnEnter:g=!0,inputLabel:h="消息输入",placeholder:p,submitLabel:v="发送",stopLabel:b="停止",bordered:f=!0,showCharacterCount:x=!1,maxLength:w,shortcutHint:y,showShortcutHint:N,textareaProps:C,className:k,...S},z)=>{const T=!c&&!d&&!u&&(m||e.trim().length>0);function submit(){T&&t(e)}const j=N??Boolean(y)?y??(g?"Enter 发送 · Shift+Enter 换行":null):null,I=x||Boolean(j);return nt("div",{className:P("grid min-w-0 gap-[calc(var(--content-gap)*0.625)] rounded-[var(--radius-panel)] bg-surface-1 p-[calc(var(--content-gap)*0.75)] shadow-sm transition-[border-color,box-shadow]",f?"border border-border-strong focus-within:border-primary/70":"border border-transparent",c&&"opacity-60",k),...S,"data-ug":"prompt-composer","data-state":c?"disabled":d?"submitting":"default","data-variant":"default","data-size":"md",children:[i?rt("div",{className:"min-w-0","data-ug-slot":"header",children:i}):null,nt("div",{className:"flex min-w-0 items-end gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"body",children:[l?rt("div",{className:"flex h-[var(--control-height-md)] shrink-0 items-center","data-ug-slot":"leading",children:l}):null,rt("div",{className:"min-w-0 flex-1","data-ug-slot":"input",children:rt(V,{...C,ref:z,"aria-label":C?.["aria-label"]??h,autosize:C?.autosize??{minRows:1,maxRows:8},className:P("min-h-[var(--control-height-md)] border-transparent bg-transparent px-[calc(var(--control-padding-x-sm)*0.5)] py-[var(--ug-prompt-input-padding-y)] shadow-none focus-visible:!border-transparent focus-visible:!ring-0 focus-visible:!ring-offset-0",C?.className),disabled:c,maxLength:w??C?.maxLength,onKeyDown:function handleKeyDown(e){g&&"Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),submit()))},onPaste:function handlePaste(e){if(!n)return;const a=Array.from(e.clipboardData.files);a.length>0&&n(a,e)},onValueChange:a,placeholder:p??C?.placeholder,resize:"none",value:e})}),o?rt("div",{className:"flex h-[var(--control-height-md)] shrink-0 items-center gap-1","data-ug-slot":"trailing",children:o}):null,rt(B,d&&r?{"aria-label":b,onClick:r,size:"icon",tone:"danger",type:"button",variant:"soft","data-ug-slot":"submit",children:rt(tt,{"aria-hidden":"true",size:15})}:{"aria-label":v,disabled:!T,onClick:submit,size:"icon",tone:"primary",type:"button",variant:"solid","data-ug-slot":"submit",children:rt(at,{"aria-hidden":"true",size:16})})]}),s||I?nt("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2 text-xs text-text-tertiary","data-ug-slot":"footer",children:[s?rt("div",{className:"min-w-0 flex-1",children:s}):null,I?nt("div",{className:"ml-auto flex shrink-0 items-center gap-3 tabular-nums","data-ug-slot":"footer-meta",children:[j?rt("span",{"data-ug-slot":"shortcut-hint",children:j}):null,x?rt("span",{"data-ug-slot":"character-count",children:void 0!==w?`${e.length}/${w}`:`${e.length}`}):null]}):null]}):null]})});it.displayName="PromptComposer";import{Children as lt,forwardRef as ot,useEffect as st,useRef as dt}from"react";import{jsx as ct,jsxs as ut}from"react/jsx-runtime";var mt=ot(({messageRole:e,status:a="idle",avatar:t,header:r,footer:n,children:i,className:l,...o},s)=>ut("article",{ref:s,className:P("flex min-w-0 gap-[calc(var(--content-gap)*0.75)]","user"===e&&"justify-end",l),...o,"data-ug":"message","data-state":a,"data-variant":e,"data-size":"md",children:[t&&"user"!==e?ct("div",{className:"shrink-0","data-ug-slot":"avatar",children:t}):null,ut("div",{className:P("grid min-w-0 gap-[calc(var(--content-gap)*0.5)]","user"===e?"max-w-[min(85%,44rem)] rounded-[var(--radius-panel)] bg-surface-2 px-[var(--control-padding-x-lg)] py-[calc(var(--content-gap)*0.75)]":"w-full","error"===a&&"text-danger"),"data-ug-slot":"body",children:[r?ct("div",{className:"text-xs font-medium text-text-secondary","data-ug-slot":"header",children:r}):null,ut("div",{className:"min-w-0 break-words text-sm leading-7 text-text-primary","data-ug-slot":"content",children:[i,"streaming"===a?ct("span",{"aria-label":"正在生成",className:"ml-1 inline-block size-1.5 animate-pulse rounded-full bg-primary motion-reduce:animate-none","data-ug-slot":"streaming"}):null]}),n?ct("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-text-tertiary","data-ug-slot":"footer",children:n}):null]}),t&&"user"===e?ct("div",{className:"shrink-0","data-ug-slot":"avatar",children:t}):null]}));mt.displayName="Message";var gt=ot(({empty:e,followOutput:a=!0,followThreshold:t=80,children:r,className:n,onScroll:i,...l},o)=>{const s=dt(null),d=dt(!0),c=lt.count(r)>0;return st(()=>{const e=s.current;a&&e&&d.current&&e.scrollTo?.({top:e.scrollHeight,behavior:"auto"})},[r,a]),ct("div",{ref:function setRef(e){s.current=e,"function"==typeof o?o(e):o&&(o.current=e)},"aria-live":"polite","aria-relevant":"additions text",className:P("grid min-w-0 gap-[calc(var(--content-gap)*1.5)] overflow-y-auto overscroll-contain [min-height:0] [scrollbar-color:var(--color-border-strong)_transparent] [scrollbar-width:thin]",c?"content-start":"content-center",n),onScroll:function handleScroll(e){const a=e.currentTarget;d.current=a.scrollHeight-a.scrollTop-a.clientHeight<=Math.max(0,t),i?.(e)},role:"log",tabIndex:0,...l,"data-ug":"message-list","data-state":c?"populated":"empty","data-variant":a?"follow":"static","data-size":"md",children:c?r:ct("div",{className:"grid place-items-center text-center text-sm text-text-secondary [min-height:calc(var(--control-height-lg)*4)]","data-ug-slot":"empty",children:e})})});gt.displayName="MessageList";import{forwardRef as ht}from"react";import{CircleCheck as pt,File as vt,LoaderCircle as bt,TriangleAlert as ft,X as xt}from"lucide-react";import{jsx as wt,jsxs as yt}from"react/jsx-runtime";var Nt=ht(({items:e,onRemove:a,renderPreview:t,orientation:r="horizontal",showPreview:n=!0,showStatus:i=!0,showMeta:l=!0,bordered:o=!0,compact:s=!1,getRemoveLabel:d=e=>`移除附件:${e.name}`,empty:c,className:u,tabIndex:m,...g},h)=>0!==e.length||c?wt("ul",{ref:h,"aria-label":"附件",className:P("min-w-0 gap-[calc(var(--content-gap)*0.5)]","horizontal"===r?"flex overflow-x-auto pb-1 [scrollbar-width:thin]":"grid",u),tabIndex:m??("horizontal"===r?0:void 0),...g,"data-ug":"attachment-list","data-state":e.length>0?"populated":"empty","data-variant":r,"data-size":s?"xs":"sm",children:0===e.length?wt("li",{className:"text-sm text-text-secondary","data-ug-slot":"empty",children:c}):e.map(e=>{const c=e.mime?.startsWith("image/")&&e.previewUrl,u=e.status??"ready",m=i?e.statusLabel??{uploading:"正在上传",success:"上传完成",error:"上传失败"}[u]:void 0,g="uploading"===u?bt:"success"===u?pt:"error"===u?ft:null,h=l?e.meta:null;return yt("li",{"aria-busy":"uploading"===u||void 0,"aria-invalid":"error"===u||void 0,className:P("group flex shrink-0 items-center rounded-[var(--radius-control)] bg-surface-2","horizontal"===r?"min-w-52 max-w-72":"w-full min-w-0",o?"border border-border-base":"border border-transparent",s?"gap-1.5 p-1.5":"gap-2 p-2"),"data-state":u,"data-ug-slot":"item",children:[n?wt("div",{className:P("grid shrink-0 place-items-center overflow-hidden rounded-[var(--radius-control)] bg-surface-1 text-text-secondary",s?"size-[var(--control-height-md)]":"size-[var(--control-height-lg)]"),"data-ug-slot":"preview",children:t?t(e):c?wt("img",{alt:e.name,className:"size-full object-cover",src:e.previewUrl}):wt(vt,{"aria-hidden":"true",size:s?15:17})}):null,yt("div",{className:"min-w-0 flex-1","data-ug-slot":"content",children:[wt("p",{className:"truncate text-xs font-medium text-text-primary",title:e.name,children:e.name}),m||h?yt("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-text-tertiary","data-ug-slot":"meta",children:[m?yt("span",{className:P("inline-flex min-w-0 items-center gap-1 truncate","uploading"===u&&"text-primary","success"===u&&"text-success-soft-fg","error"===u&&"text-danger"),"data-ug-slot":"status",role:"ready"===u?void 0:"status",children:[g?wt(g,{"aria-hidden":"true",className:P("size-3.5 shrink-0","uploading"===u&&"animate-spin motion-reduce:animate-none")}):null,wt("span",{className:"truncate",children:m})]}):null,h?wt("span",{className:"min-w-0 truncate","data-ug-slot":"detail",children:h}):null]}):null]}),a?wt(B,{"aria-label":d(e),onClick:()=>a(e),size:"icon-sm",type:"button",variant:"ghost","data-ug-slot":"remove",children:wt(xt,{"aria-hidden":"true",size:13})}):null]},e.id)})}):null);Nt.displayName="AttachmentList";import{forwardRef as Ct}from"react";import{jsx as kt,jsxs as St}from"react/jsx-runtime";var zt=Ct(({items:e,activeId:a,onSelect:t,renderActions:r,empty:n="暂无会话",orientation:i="vertical",activeStyle:l="soft",showBadge:o=!0,showDescription:s=!0,listLabel:d="会话列表",className:c,tabIndex:u,...m},g)=>kt("div",{ref:g,"aria-label":d,className:P("horizontal"===i?"flex min-w-0 gap-1 overflow-x-auto pb-1 [scrollbar-width:thin]":"grid min-w-0 content-start gap-1",c),role:"list",tabIndex:u??("horizontal"===i?0:void 0),...m,"data-ug":"conversation-list","data-active-style":l,"data-state":e.length>0?"populated":"empty","data-variant":i,"data-size":"md",children:0===e.length?kt("div",{className:"px-[var(--control-padding-x-md)] py-[var(--content-gap)] text-sm text-text-secondary","data-ug-slot":"empty",children:n}):e.map(e=>{const n=e.id===a;return St("div",{className:P("group relative flex min-w-0 items-center rounded-[var(--radius-control)] transition-[background-color,color] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none","horizontal"===i&&"min-w-52 shrink-0",n?P("bg-primary-soft","bordered"===l&&"ring-1 ring-inset ring-primary/30","indicator"===l&&"before:absolute before:left-0 before:top-1/2 before:h-[calc(var(--control-height-sm)*0.6)] before:w-[3px] before:-translate-y-1/2 before:rounded-r-[var(--radius-control)] before:bg-primary before:content-['']"):"hover:bg-surface-2",e.disabled&&"opacity-50"),"data-state":e.disabled?"disabled":n?"active":"default","data-ug-slot":"item",role:"listitem",children:[St("button",{"aria-current":n?"page":void 0,className:"min-w-0 flex-1 rounded-[var(--radius-control)] px-[var(--control-padding-x-md)] py-[calc(var(--content-gap)*0.625)] text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",disabled:e.disabled,onClick:()=>t(e),type:"button","data-ug-slot":"trigger",children:[St("span",{className:"flex min-w-0 items-center gap-2",children:[kt("span",{className:P("min-w-0 flex-1 truncate text-sm text-text-primary",n?"font-semibold":"font-medium"),"data-ug-slot":"title",children:e.title}),o&&e.badge?kt("span",{className:"shrink-0","data-ug-slot":"badge",children:e.badge}):null]}),s&&e.description?kt("span",{className:P("mt-0.5 block truncate text-xs",n?"text-primary-soft-fg":"text-text-tertiary"),"data-ug-slot":"description",children:e.description}):null]}),r?kt("div",{className:"flex shrink-0 items-center gap-1 pr-2","data-ug-slot":"actions",children:r(e)}):null]},e.id)})}));zt.displayName="ConversationList";import{defaultUGThemeConfiguratorOptions as Tt,resolveUGNavigationColors as jt,resolveUGNavigationPalette as It}from"@ug666/ui-core/theme";import{Check as Lt,Monitor as Rt,Moon as At,PanelTop as Dt,Sun as Et,SwatchBook as Gt}from"lucide-react";import{forwardRef as Vt,useEffect as $t,useId as Mt,useMemo as Bt,useRef as Pt,useState as Ut}from"react";import{jsx as Ft,jsxs as Wt}from"react/jsx-runtime";var Ot=[{value:"sidebar",label:"左侧导航"},{value:"header",label:"顶部导航"}],Ht=[{value:"light",label:"浅色"},{value:"dark",label:"深色"}],_t=[{value:"highlight",label:"主题色块",description:"使用柔和主题底色突出当前菜单。"},{value:"indicator",label:"侧边标记",description:"使用淡色背景叠加左侧标记,定位更清楚。"}],qt=[{value:"comfortable",label:"舒适"},{value:"compact",label:"紧凑"}];function ModeIcon({value:e}){return"system"===e?Ft(Rt,{"aria-hidden":"true",size:16}):"light"===e?Ft(Et,{"aria-hidden":"true",size:16}):"dark"===e?Ft(At,{"aria-hidden":"true",size:16}):null}function ThemePresetPreview({selected:e,value:a}){const t="mecha"===a;return Wt("span",{"aria-hidden":"true",className:P("relative flex h-[calc(var(--control-height-lg)*1.75)] w-full overflow-hidden rounded-[calc(var(--radius-control)*0.75)] border bg-surface-0 transition-[border-color,box-shadow,transform] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)]",e?"border-primary shadow-sm ring-1 ring-primary/20":"border-border-base shadow-xs"),"data-ug-mode":"light","data-ug":"theme-preview","data-ug-theme":a,children:[e?Ft("span",{className:"absolute right-1.5 top-1.5 z-10 inline-flex h-[calc(var(--control-height-sm)*0.75)] w-[calc(var(--control-height-sm)*0.75)] items-center justify-center rounded-full bg-primary text-primary-fg shadow-sm",children:Ft(Lt,{"aria-hidden":"true",size:12,strokeWidth:3})}):null,Wt("span",{className:"flex w-[24%] flex-col gap-1 border-r border-border-base bg-text-primary p-[calc(var(--content-gap)*0.375)]",children:[Ft("span",{className:"h-[calc(var(--control-height-sm)*0.2)] w-8 rounded-full bg-primary"}),Ft("span",{className:"mt-1 h-[calc(var(--control-height-sm)*0.16)] w-full rounded-full bg-surface-3"}),Ft("span",{className:"h-[calc(var(--control-height-sm)*0.16)] w-4/5 rounded-full bg-surface-3"}),Ft("span",{className:"h-[calc(var(--control-height-sm)*0.16)] w-3/4 rounded-full bg-surface-3"}),Ft("span",{className:"mt-auto h-[calc(var(--control-height-sm)*0.16)] w-2/3 rounded-full bg-surface-3"})]}),Wt("span",{className:P("flex min-w-0 flex-1 flex-col",t?"bg-text-primary":"bg-surface-0"),children:[Ft("span",{className:P("h-[calc(var(--control-height-sm)*0.48)] border-b border-border-base",t?"bg-text-primary":"bg-surface-1")}),Wt("span",{className:"grid flex-1 grid-cols-3 gap-1.5 p-[calc(var(--content-gap)*0.375)]",children:[[0,1,2].map(e=>Ft("span",{className:P("h-[calc(var(--control-height-sm)*0.42)] rounded-[calc(var(--radius-control)*0.35)] border border-border-base",t?"bg-text-secondary":1===e?"bg-primary-soft":"bg-surface-1")},e)),Wt("span",{className:P("relative col-span-3 overflow-hidden rounded-[calc(var(--radius-control)*0.4)] border border-border-base",t?"bg-text-secondary":"bg-surface-1"),children:[Ft("span",{className:"absolute inset-x-2 bottom-2 top-2 border-b border-l border-border-base"}),Ft("svg",{className:"absolute inset-2 h-[calc(100%_-_var(--content-gap))] w-[calc(100%_-_var(--content-gap))] overflow-visible text-primary",preserveAspectRatio:"none",viewBox:"0 0 100 32",children:Ft("path",{d:"M0 25 C12 22, 16 14, 28 18 S45 27, 56 14 S74 8, 100 4",fill:"none",stroke:"currentColor",strokeWidth:"2",vectorEffect:"non-scaling-stroke"})})]})]})]})]})}function ChoiceGroup({title:e,description:a,value:t,options:r,onValueChange:n,presentation:i="compact",swatch:l,iconSet:o}){const s=Mt(),d=Mt(),c="card"===i,u="preview"===i,m=void 0!==l,g=!c&&!u&&!m;return Wt("section",{className:P("min-w-0",(g||m)&&"ug-theme-config-row"),"data-presentation":m?"swatch":i,"data-ug-slot":"group",children:[Wt("div",{className:"min-w-0",children:[Ft("h3",{id:s,className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:e}),Ft("p",{id:d,className:"ug-theme-config-description",children:a})]}),Ft(N,{"aria-describedby":d,"aria-labelledby":s,className:P("min-w-0",u&&"mt-2.5 grid grid-cols-1 gap-2.5 sm:grid-cols-3",c&&"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",m&&"flex flex-wrap items-center gap-2.5",g&&"auto-cols-[minmax(max-content,1fr)]"),"data-ug-slot":"options",onValueChange:e=>n(String(e)),orientation:"horizontal",presentation:g?"segmented":"default",size:"default",sizing:g?"fill":"content",value:t,children:r.map(e=>Ft(y,{"aria-label":m?e.label:void 0,className:"hidden",controlClassName:m?void 0:"absolute",value:e.value,variant:c||u?"card":g?"segmented":"default",labelClassName:u?"group/theme flex min-h-[0] w-full cursor-pointer flex-col items-stretch gap-1.5 rounded-[var(--radius-control)] border-0 bg-transparent p-0 text-center shadow-none hover:bg-transparent focus-within:outline-none focus-within:ring-2 focus-within:ring-ring/30 data-[state=checked]:border-0 data-[state=checked]:bg-transparent data-[state=checked]:shadow-none":c?"min-h-[calc(var(--control-height-lg)*1.5)] gap-0 rounded-[var(--radius-control)] px-[calc(var(--content-gap)*0.75)] py-[calc(var(--content-gap)*0.5)]":m?"group/swatch min-h-[0] cursor-pointer gap-0 rounded-full p-0 focus-within:outline-none":g?"min-w-max px-[calc(var(--control-padding-x-sm)*0.75)]":void 0,label:Wt("span",{className:P("flex min-w-0",c||u?"flex-col gap-1":"items-center gap-2",m&&"block"),children:[u?Ft(ThemePresetPreview,{selected:e.value===t,value:e.value}):null,Wt("span",{className:"inline-flex min-w-0 items-center gap-2",children:["mode"===o?Ft(ModeIcon,{value:e.value}):null,m?Ft("span",{"aria-hidden":"true","data-ug-swatch":"accent","data-ug-accent":e.value,children:Ft(Lt,{"aria-hidden":"true",className:e.value===t?void 0:"invisible","data-ug-swatch-check":e.value===t?"":void 0,size:13,strokeWidth:3})}):null,Ft("span",{className:P("min-w-0",c?"font-semibold text-text-primary":u?"w-full text-center font-medium text-text-primary":m?"sr-only":"truncate"),children:e.label})]}),c&&e.description?Ft("span",{className:"text-xs font-normal leading-4 text-text-secondary",children:e.description}):null]})},e.value))})]})}var Qt=[{key:"background",label:"导航背景"},{key:"text",label:"普通文字"},{key:"activeBackground",label:"选中背景"},{key:"activeText",label:"选中文字"},{key:"hoverBackground",label:"悬停背景"}];function NavigationColorInput({label:e,value:a,onValueCommit:t}){const r=Pt(null),n=Pt(t);return n.current=t,$t(()=>{const e=r.current;if(!e)return;const commitValue=()=>n.current(e.value);return e.addEventListener("change",commitValue),()=>e.removeEventListener("change",commitValue)},[]),$t(()=>{r.current&&r.current.value!==a&&(r.current.value=a)},[a]),Ft("input",{ref:r,"aria-label":e,"data-ug-slot":"color-swatch",defaultValue:a,type:"color"})}function NavigationColorGroup({customized:e,value:a,onReset:t,onValueChange:r}){return Wt("section",{className:"ug-theme-config-row min-w-0","data-presentation":"colors","data-ug":"navigation-colors","data-ug-slot":"group",children:[Wt("div",{className:"min-w-0","data-ug-slot":"group-label",children:[Ft("h3",{className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:"导航颜色"}),e?Ft(B,{onClick:t,size:"sm",tone:"neutral",variant:"ghost",children:"恢复主题配色"}):null]}),Ft("div",{"data-ug-slot":"options",children:Qt.map(e=>Wt("label",{"data-ug-slot":"color-option",children:[Ft(NavigationColorInput,{label:e.label,onValueCommit:t=>r({...a,[e.key]:t}),value:a[e.key]}),Ft("span",{"data-ug-slot":"color-label",children:e.label}),Ft("code",{"data-ug-slot":"color-value",children:a[e.key].toUpperCase()})]},e.key))})]})}function TabLabel({icon:e,children:a}){return Wt("span",{className:"gap-[calc(var(--content-gap)*0.625)]","data-ug-slot":"tab-label",children:[Ft("span",{"data-ug-slot":"tab-icon",children:e}),Ft("span",{className:"truncate",children:a})]})}var Kt=Vt(({value:e,onValueChange:a,options:t,sidebarValue:r,onSidebarValueChange:n,appearanceAddon:i,sidebarAddon:l,className:o,...s},d)=>{const[c,u]=Ut("appearance"),m=$("(prefers-color-scheme: dark)"),g=Bt(()=>({...Tt,...t}),[t]),h=r.palette??("primary"===r.variant?"light":"dark"),p=r.colors?h:It(e.mode,m),v=jt(e.preset,p,r.colors,e.accent);function updateField(t,r){a({...e,[t]:r})}function updateSidebarField(e,a){n({...r,[e]:a})}return Ft("div",{ref:d,className:P("h-full min-h-[0] min-w-0 text-text-primary",o),"data-ug":"theme-configurator","data-state":"ready","data-variant":"panel","data-size":"default",...s,children:Ft(A,{className:"h-full",onValueChange:e=>u(e),size:"md",value:c,variant:"rail",children:Wt("div",{"data-ug-slot":"configurator-layout",children:[Ft("div",{"data-ug-slot":"navigation",children:Wt(E,{"aria-label":"外观设置分类",orientation:"vertical",children:[Ft(G,{value:"appearance",children:Ft(TabLabel,{icon:Ft(Gt,{"aria-hidden":"true",size:16}),children:"主题外观"})}),Ft(G,{value:"sidebar",children:Ft(TabLabel,{icon:Ft(Dt,{"aria-hidden":"true",size:16}),children:"导航菜单"})})]})}),Wt("div",{className:"min-h-[0]","data-ug-slot":"settings",children:[Wt(D,{className:"ug-theme-config-appearance min-w-0",value:"appearance",children:[Ft(ChoiceGroup,{title:"主题风格",description:"选择整套界面的基础视觉气质。",value:e.preset,options:g.presets,presentation:"preview",onValueChange:e=>updateField("preset",e)}),Ft(ChoiceGroup,{title:"显示模式",description:"使用亮色、暗色,或自动跟随操作系统。",value:e.mode,options:g.modes,iconSet:"mode",onValueChange:e=>updateField("mode",e)}),Ft(ChoiceGroup,{title:"主题色",description:"统一按钮、链接、当前项和焦点状态。",value:e.accent,options:g.accents,swatch:"accent",onValueChange:e=>updateField("accent",e)}),Wt("section",{"data-ug-slot":"detail-section",children:[Ft("div",{"data-ug-slot":"section-heading",children:Ft("h3",{className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:"界面细节"})}),Wt("div",{"data-ug-slot":"detail-grid",children:[Ft(ChoiceGroup,{title:"界面密度",description:"控制页面留白与控件间距。",value:e.density,options:g.densities,onValueChange:e=>updateField("density",e)}),Ft(ChoiceGroup,{title:"圆角风格",description:"统一控件和面板的边角语言。",value:e.radius,options:g.radii,onValueChange:e=>updateField("radius",e)}),Ft(ChoiceGroup,{title:"阴影层级",description:"调整浮层与卡片的空间层次。",value:e.shadow,options:g.shadows,onValueChange:e=>updateField("shadow",e)}),Ft(ChoiceGroup,{title:"字体排版",description:"选择阅读性或信息密度取向。",value:e.font,options:g.fonts,onValueChange:e=>updateField("font",e)}),Ft(ChoiceGroup,{title:"文字对比",description:"调整正文和次要信息的清晰度。",value:e.contrast,options:g.contrasts,onValueChange:e=>updateField("contrast",e)}),Ft(ChoiceGroup,{title:"界面动效",description:"控制过渡反馈的强弱。",value:e.motion,options:g.motions,onValueChange:e=>updateField("motion",e)}),Ft(ChoiceGroup,{title:"页面背景",description:"选择纯净、网格或柔光背景。",value:e.background,options:g.backgrounds,onValueChange:e=>updateField("background",e)})]})]}),i?Ft("div",{"data-ug-slot":"appearance-addon",children:i}):null]}),Wt(D,{className:"min-w-0",value:"sidebar",children:[Wt("div",{className:"ug-theme-config-sidebar-grid",children:[Ft(ChoiceGroup,{title:"导航位置",description:"选择左侧栏或桌面端顶栏导航。",value:r.mode??"sidebar",options:Ot,onValueChange:e=>updateSidebarField("mode",e)}),Ft(ChoiceGroup,{title:"配色基准",description:"默认跟随显示模式;选择后作为导航颜色覆盖。",value:p,options:Ht,onValueChange:a=>n({...r,palette:a,variant:"light"===a?"primary":"dark",colors:jt(e.preset,a,void 0,e.accent)})}),Ft(NavigationColorGroup,{customized:Boolean(r.colors),value:v,onReset:()=>updateSidebarField("colors",void 0),onValueChange:e=>n({...r,palette:p,variant:"light"===p?"primary":"dark",colors:e})}),Ft(ChoiceGroup,{title:"当前菜单",description:"选择当前页面在导航中的强调方式。",value:r.activeStyle,options:_t,onValueChange:e=>updateSidebarField("activeStyle",e)}),Ft(ChoiceGroup,{title:"菜单密度",description:"调整导航菜单的行高与间距。",value:r.density,options:qt,onValueChange:e=>updateSidebarField("density",e)})]}),l?Ft("div",{"data-ug-slot":"sidebar-addon",children:l}):null]})]})]})})})});Kt.displayName="ThemeConfigurator";import{resolveUGNavigationColors as Jt,resolveUGNavigationPalette as Xt}from"@ug666/ui-core/theme";import{RotateCcw as Yt}from"lucide-react";import{jsx as Zt,jsxs as er}from"react/jsx-runtime";function DefaultThemePreview({value:e,sidebarValue:a}){const t=$("(prefers-color-scheme: dark)"),r=a.palette??("primary"===a.variant?"light":"dark"),n=a.colors?r:Xt(e.mode,t),i=Jt(e.preset,n,a.colors,e.accent),l={"--ug-preview-navigation-bg":i.background,"--ug-preview-navigation-text":i.text,"--ug-preview-navigation-active-bg":i.activeBackground,"--ug-preview-navigation-active-text":i.activeText,"--ug-preview-navigation-hover-bg":i.hoverBackground};return er("section",{"aria-label":"实时预览",className:"[--ug-theme-preview-gap:var(--content-gap)] border-border-base","data-ug":"theme-configurator-preview",children:[Zt("h3",{"data-ug-preview":"title",children:"实时预览"}),er("div",{"data-navigation-active-style":a.activeStyle,"data-navigation-density":a.density,"data-navigation-mode":a.mode??"sidebar","data-ug-accent":e.accent,"data-ug-background":e.background,"data-ug-contrast":e.contrast,"data-ug-density":e.density,"data-ug-font":e.font,"data-ug-mode":e.mode,"data-ug-motion":e.motion,"data-ug-radius":e.radius,"data-ug-shadow":e.shadow,"data-ug-preview":"frame","data-ug-surface":e.surface,"data-ug-theme":e.preset,style:l,children:[er("aside",{"data-ug-preview":"navigation",children:[Zt("strong",{"data-ug-preview":"brand",children:"UG Admin"}),Zt("div",{"data-ug-preview":"menu",children:["工作台","任务中心","数据分析","系统设置"].map((e,a)=>er("span",{"data-state":0===a?"active":"default","data-ug-preview":"menu-item",children:[Zt("i",{"aria-hidden":"true","data-ug-preview":"menu-icon"}),Zt("span",{children:e})]},e))})]}),er("div",{"data-ug-preview":"content",children:[er("header",{"data-ug-preview":"topbar",children:[Zt("strong",{"data-ug-preview":"topbar-title",children:"工作台"}),er("span",{"aria-hidden":"true","data-ug-preview":"topbar-actions",children:[Zt("i",{}),Zt("i",{}),Zt("i",{})]})]}),er("div",{"data-ug-preview":"tabs",children:[Zt("span",{"data-state":"active",children:"工作台"}),Zt("span",{children:"任务中心"}),Zt("span",{children:"报表"})]}),er("main",{"data-ug-preview":"main",children:[Zt("div",{"data-ug-preview":"stats",children:[["待办任务","12"],["团队成员","8"],["进行项目","24"]].map(([e,a])=>er("span",{"data-ug-preview":"stat",children:[Zt("small",{children:e}),Zt("strong",{children:a})]},e))}),er("div",{"data-ug-preview":"chart",children:[Zt("strong",{children:"工作概览"}),Zt("svg",{"aria-hidden":"true",preserveAspectRatio:"none",viewBox:"0 0 240 72",children:Zt("path",{d:"M0 58 C28 48, 38 24, 66 36 S102 58, 130 28 S172 42, 240 12",fill:"none",stroke:"currentColor",strokeWidth:"3",vectorEffect:"non-scaling-stroke"})})]}),Zt("div",{"data-ug-preview":"table",children:["整理发布计划","复核访问权限","更新项目进度"].map((e,a)=>er("span",{"data-ug-preview":"table-row",children:[Zt("span",{children:e}),Zt("i",{"data-state":1===a?"warning":"success",children:1===a?"待处理":"已完成"})]},e))})]})]})]})]})}function ThemeConfiguratorDialog({open:e,onOpenChange:a,onReset:t,onCancel:r,onApply:n,title:i="外观设置",preview:l,showPreview:o=!0,resetLabel:p="恢复默认",cancelLabel:v="取消",applyLabel:b,doneLabel:f,...x}){const w=b??f??"应用",y=void 0===l?Zt(DefaultThemePreview,{value:x.value,sidebarValue:x.sidebarValue}):l,N=o&&null!==y&&!1!==y;function closeAsCancel(){r?.(),a(!1)}return Zt(s,{ariaLabel:"string"==typeof i?i:"外观设置",onClose:closeAsCancel,open:e,size:"2xl",children:er(u,{"data-ug":"theme-configurator-dialog","data-state":e?"open":"closed","data-variant":N?"preview":"default","data-size":"2xl",children:[er(g,{children:[Zt(h,{children:i}),Zt(c,{})]}),Zt(d,{className:"overflow-hidden p-0",children:er("div",{"data-ug-layout":"dialog",children:[Zt("div",{className:"h-full min-h-[0] min-w-0","data-ug-slot":"panel",children:Zt(Kt,{...x})}),N?Zt("div",{"data-ug-slot":"preview",children:y}):null]})}),er(m,{className:"justify-between",children:[Zt("div",{className:"flex min-w-0 items-center gap-3",children:t?er(B,{onClick:t,type:"button",variant:"default",children:[Zt(Yt,{"aria-hidden":"true",size:16}),p]}):null}),er("div",{className:"flex shrink-0 items-center gap-2",children:[r?Zt(B,{onClick:closeAsCancel,type:"button",variant:"default",children:v}):null,Zt(B,{onClick:function closeAsApply(){n?.(),a(!1)},type:"button",variant:"primary",children:w})]})]})]})})}export{sa as AdminShell,Ca as AppTabs,Nt as AttachmentList,Ia as ConfirmDialog,zt as ConversationList,Ma as CopyField,DataTable,DataTableIdentity,DataTableToolbar,mt as Message,gt as MessageList,_a as PageHeader,it as PromptComposer,Za as QuickAccess,re as SelectionList,Kt as ThemeConfigurator,ThemeConfiguratorDialog,TreeTable,sa as UGAdminShell,Ca as UGAppTabs,Nt as UGAttachmentList,Ia as UGConfirmDialog,zt as UGConversationList,Ma as UGCopyField,DataTable as UGDataTable,DataTableIdentity as UGDataTableIdentity,DataTableToolbar as UGDataTableToolbar,mt as UGMessage,gt as UGMessageList,_a as UGPageHeader,it as UGPromptComposer,Za as UGQuickAccess,re as UGSelectionList,Kt as UGThemeConfigurator,ThemeConfiguratorDialog as UGThemeConfiguratorDialog,TreeTable as UGTreeTable};//# sourceMappingURL=index.js.map
|
|
1
|
+
"use client";import{Alert as e,AlertDescription as a,AlertTitle as t,Checkbox as r,CheckboxGroup as n,EmptyState as i,Fieldset as l,FieldsetLegend as o,Modal as s,ModalBody as d,ModalCloseButton as c,ModalContent as u,ModalFooter as m,ModalHeader as g,ModalTitle as h,NavigationMenu as p,NavigationMenuContent as v,NavigationMenuItem as b,NavigationMenuLink as f,NavigationMenuTrigger as x,Pagination as w,Radio as y,RadioGroup as N,Select as C,Sidebar as k,Skeleton as S,Table as z,TableBody as T,TableCell as j,TableHead as I,TableHeader as R,TableRow as A,Tabs as D,TabsContent as L,TabsList as E,TabsTrigger as G}from"../chunk-DJDACMBD.js";import{Textarea as $}from"../chunk-3LSTRFSY.js";import"../chunk-PZ4UH6BC.js";import{useMediaQuery as M}from"../chunk-XN7GQRSF.js";import{Input as V}from"../chunk-KNWHIFJE.js";import{Button as B,cn as P,resolveControlSize as F,resolveDisabled as W,useUIConfig as U}from"../chunk-AQJWS45G.js";import{forwardRef as O,useEffect as H,useId as _,useRef as q,useState as Q}from"react";import{filterSelectionListOptions as K,getSelectionListScope as J,groupSelectionListOptions as X,updateSelectionListScope as Y}from"@ug666/ui-core";import{ChevronDown as Z,ChevronRight as ee}from"lucide-react";import{jsx as ae,jsxs as te}from"react/jsx-runtime";var re=O(({options:e,value:a,defaultValue:t=[],onValueChange:i,searchable:s=!0,searchPlaceholder:d="搜索选项",emptyLabel:c="没有匹配项",disabled:u,size:m,name:g,form:h,layout:p="stack",collapsibleGroups:v=!1,expandedGroups:b,defaultExpandedGroups:f,onExpandedGroupsChange:x,showSelectAll:w=!0,showSummary:y=!0,showGroupCount:N=!0,className:C,...k},S)=>{const z=U(),T=_(),j=q(null),[I,R]=Q([...t]),[A,D]=Q(""),L=q({value:a,defaultValue:t});L.current={value:a,defaultValue:t};const[E,G]=Q(()=>void 0===f?[]:X(e).filter(e=>!f.includes(e.key)).map(e=>e.key)),$=a??I,M=W(u,z.disabled),O=F(m,z.size),re=K(e,s?A:""),ne=X(re),ie=J(re,$),le=X(e),oe=b??le.filter(e=>!E.includes(e.key)).map(e=>e.key),se=s&&A.trim().length>0,de=ne.every(e=>oe.includes(e.key));function changeExpanded(e){void 0===b&&G(le.filter(a=>!e.includes(a.key)).map(e=>e.key)),x?.(e)}function change(e){M||(void 0===a&&R(e),i?.(e))}return H(()=>{const e=h?document.getElementById(h):j.current?.closest("form");if(!e)return;const a=new Set;function reset(e){const t=setTimeout(()=>{a.delete(t),e.defaultPrevented||(void 0===L.current.value&&R([...L.current.defaultValue]),D(""))},0);a.add(t)}return e.addEventListener("reset",reset),()=>{e.removeEventListener("reset",reset),a.forEach(clearTimeout)}},[h]),te("div",{...k,ref:e=>{j.current=e,"function"==typeof S?S(e):S&&(S.current=e)},className:P("grid min-w-0 gap-[var(--content-gap)] text-text-primary",C),"data-ug":"selection-list","data-ug-slot":"root","data-size":O,"data-layout":p,"data-state":M?"disabled":0===re.length?"empty":"default","data-variant":"grouped",role:"group","aria-label":k["aria-label"]??"选项列表","aria-disabled":M||void 0,children:[s?ae("div",{"data-ug-slot":"search",children:ae(V,{value:A,onValueChange:D,clearable:!0,"aria-label":d,placeholder:d,size:O,disabled:M})}):null,w||y?te("div",{"data-ug-slot":"bulk",className:"flex flex-wrap items-center justify-between gap-[calc(var(--content-gap)*0.5)]",children:[w?ae(r,{checked:ie.checked,indeterminate:ie.indeterminate,size:O,disabled:M||0===ie.available,"aria-describedby":y?`${T}-summary`:void 0,onCheckedChange:e=>change(Y($,re,e)),label:"全选当前结果"}):null,y?te("span",{id:`${T}-summary`,"data-ug-slot":"summary",className:"text-xs text-text-secondary","aria-live":"polite",children:["已选 ",new Set($).size," 项;当前 ",ie.total," 项,",ie.available," 项可操作",ie.disabled>0?`,${ie.disabled} 项不可操作`:""]}):null]}):null,v?te("div",{"data-ug-slot":"group-actions",children:[ae(B,{type:"button",size:"default",variant:"ghost",disabled:se||0===ne.length,title:se?"清空搜索后可折叠分组":void 0,onClick:()=>changeExpanded(de?oe.filter(e=>!ne.some(a=>a.key===e)):[...new Set([...oe,...ne.map(e=>e.key)])]),children:de?"全部收起":"全部展开"}),se?ae("span",{"data-ug-slot":"search-hint",children:"搜索时展开匹配分组"}):null]}):null,te("div",{"data-ug-slot":"groups",className:"grid min-w-0 gap-[var(--content-gap)]",children:[ne.map(e=>{const a=J(e.options,$),t=!v||se||oe.includes(e.key),i=`${T}-group-${encodeURIComponent(e.key)}`;return te(l,{variant:"card",size:"sm","data-ug-slot":"group",children:[ae(o,{children:e.label}),te("div",{"data-ug-slot":"group-heading",className:"flex flex-wrap items-center justify-between gap-[calc(var(--content-gap)*0.5)]",children:[ae(r,{checked:a.checked,indeterminate:a.indeterminate,size:O,disabled:M||0===a.available,onCheckedChange:a=>change(Y($,e.options,a)),label:`全选${e.label}`}),N?te("span",{"data-ug-slot":"group-count",className:"text-xs text-text-secondary",children:["已选 ",a.selected,"/",a.total,a.disabled>0?`,${a.disabled} 项不可操作`:""]}):null,v?ae(B,{type:"button",variant:"ghost",size:"icon",disabled:se,className:N?void 0:"ml-auto","aria-label":`${t?"收起":"展开"}${e.label}选项`,"aria-expanded":t,"aria-controls":i,title:se?"清空搜索后可折叠分组":`${t?"收起":"展开"}${e.label}选项`,onClick:()=>changeExpanded(t?oe.filter(a=>a!==e.key):[...oe,e.key]),children:ae(t?Z:ee,{size:16,"aria-hidden":"true"})}):null]}),ae("div",{id:i,"data-ug-slot":"options",hidden:!t,children:ae(n,{value:$,disabled:M,size:O,orientation:"vertical","aria-label":`${e.label}选项`,onValueChange:e=>change(e.map(String)),children:e.options.map(e=>ae(r,{value:e.id,disabled:e.disabled,"aria-label":e.label,"aria-describedby":[e.description&&`${T}-description-${encodeURIComponent(e.id)}`,e.disabled&&`${T}-locked-${encodeURIComponent(e.id)}`].filter(Boolean).join(" ")||void 0,label:te("span",{"data-ug-slot":"option-label",className:"grid min-w-0 [overflow-wrap:anywhere]",children:[te("span",{children:[e.label,e.disabled?ae("span",{id:`${T}-locked-${encodeURIComponent(e.id)}`,"data-ug-slot":"locked",className:"ml-1 text-xs text-text-secondary",children:"(不可操作)"}):null]}),e.description?ae("span",{id:`${T}-description-${encodeURIComponent(e.id)}`,"data-ug-slot":"option-description",className:"text-xs text-text-secondary",children:e.description}):null]})},e.id))})})]},e.key)}),0===re.length?ae("p",{"data-ug-slot":"empty",className:"text-sm text-text-secondary",role:"status",children:c}):null]}),g?[...new Set($)].map(e=>ae("input",{type:"hidden",name:g,form:h,value:e,disabled:M},e)):null]})});re.displayName="SelectionList";import{useMemo as ne,useState as ie}from"react";import{ChevronDown as le,ChevronRight as oe}from"lucide-react";import{projectTreeTableRows as se,getTableStructure as de}from"@ug666/ui-core";import{useLayoutEffect as ce,useRef as ue,useState as me}from"react";import{getTableColumnFixed as ge,resolveTableFixedColumns as he,getTableStructure as pe,moveTableColumn as ve,getTableSpanGrid as be}from"@ug666/ui-core";import{getTableColumnStyle as fe,tableColumnLength as xe}from"@ug666/ui-web";import{observeTableColumnWidths as we}from"@ug666/ui-web";import{Database as ye,RefreshCw as Ne}from"lucide-react";import{useRef as Ce}from"react";import{getTableColumnFixed as ke}from"@ug666/ui-core";import{getTableColumnStyle as Se}from"@ug666/ui-web";import{ArrowDown as ze,ArrowUp as Te,ArrowUpDown as je,ChevronLeft as Ie,ChevronRight as Re}from"lucide-react";import{jsx as Ae,jsxs as De}from"react/jsx-runtime";function DataTableHeader({headers:e,layout:a,widths:t,offset:r,selection:n,actions:i,sort:l,order:o,onSortChange:s,reorderable:d,move:c}){const u=Ce(void 0);return Ae(R,{children:e.map((m,g)=>De(A,{children:[0===g&&null!=n&&Ae(I,{rowSpan:e.length,scope:"col","data-leaf-index":0,className:"text-center","data-fixed":ke(a[0]),style:Se(a,0,t),children:n}),m.map(e=>{const{column:n,leafIndex:i,colSpan:m,rowSpan:g,siblingIds:h}=e,p=i+r,v=a.slice(p,p+m),b=ke(v[0]),f=v.every(e=>ke(e)===b),x=Se(a,"right"===b?p+m-1:p,t),w=h.indexOf(n.id),y=n.sortLabel??("string"==typeof n.header||"number"==typeof n.header?String(n.header):n.id),N=Boolean(n.children?.length);return Ae(I,{scope:N?"colgroup":"col",colSpan:m,rowSpan:g,"data-leaf-index":N?void 0:p,"data-fixed":f?b:void 0,style:N?{...x,width:void 0,minWidth:void 0}:x,className:n.className,"aria-sort":!N&&n.sortable&&l===n.id?"asc"===o?"ascending":"descending":void 0,draggable:d||void 0,onDragStart:e=>{u.current=n.id,e.dataTransfer.setData("text/plain",n.id),e.dataTransfer.effectAllowed="move"},onDragEnd:()=>{u.current=void 0},onDragOver:e=>{d&&u.current&&h.includes(u.current)&&e.preventDefault()},onDrop:e=>{d&&u.current&&h.includes(u.current)&&(e.preventDefault(),c(u.current,n.id),u.current=void 0)},children:De("span",{"data-ug-slot":"header",className:"contents",children:[!N&&n.sortable&&s?De(B,{"aria-label":`按${y}排序`,style:{fontWeight:"inherit"},type:"button",size:"sm",tone:"neutral",variant:"text",onClick:()=>s(n.id,l===n.id&&"asc"===o?"desc":"asc"),children:[n.header,l!==n.id?Ae(je,{"aria-hidden":!0,size:14}):Ae("asc"===o?Te:ze,{"aria-hidden":!0,size:14})]}):n.header,d&&De("span",{"data-ug-slot":"column-reorder",children:[Ae(B,{type:"button",variant:"text",size:"icon-sm","aria-label":`向左移动${y}`,disabled:0===w,onClick:()=>c(n.id,h[w-1]),children:Ae(Ie,{size:14,"aria-hidden":!0})}),Ae(B,{type:"button",variant:"text",size:"icon-sm","aria-label":`向右移动${y}`,disabled:w===h.length-1,onClick:()=>c(n.id,h[w+1],!0),children:Ae(Re,{size:14,"aria-hidden":!0})})]})]})},n.id)}),0===g&&null!=i&&Ae(I,{rowSpan:e.length,scope:"col","data-leaf-index":a.length-1,className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":ke(a.at(-1)),children:i})]},g))})}import{Fragment as Le,jsx as Ee,jsxs as Ge}from"react/jsx-runtime";var $e=["loading-a","loading-b","loading-c","loading-d","loading-e"];function DataTable({rows:n,columns:l,getRowId:o,loading:s=!1,error:d,errorTitle:c="数据加载失败",emptyTitle:u="暂无数据",emptyDescription:m="当前条件下没有可展示的记录。",selectedIds:g=new Set,onSelectionChange:h,sort:p,order:v="asc",onSortChange:b,rowActions:f,actionsLabel:x="操作",page:y=1,total:N=n.length,pageSize:k=20,onPageChange:I,pageSizeOptions:R,onPageSizeChange:D,onRetry:L,retryLabel:E="重试",scrollRegionLabel:G="数据表格",size:$="sm",bordered:M=!0,striped:V=!1,tableClassName:F,fill:W=!1,pagination:U=!0,spanMethod:O,summaryMethod:H,columnOrder:_,defaultColumnOrder:q=[],onColumnOrderChange:Q,reorderableColumns:K=!1,className:J,...X}){const[Y,Z]=me(q),ee=pe(l,_??Y),ae=ee.leaves,te=be(n.length,ae.length,(e,a)=>O?.({row:n[e],column:ae[a],rowIndex:e,columnIndex:a})),re=!s&&H?H({rows:n,columns:ae}):void 0;const ne=ue(null),[ie,le]=me({widths:[],regionWidth:1/0}),oe=ie.widths,se=ae.some(e=>"left"===ge(e)),de=[...h?[{width:"var(--control-height-lg)",fixed:se?"left":void 0}]:[],...ae,...f?[{width:"min-content",minWidth:"min-content",fixed:"right"}]:[]],Ce=h?1:0,ke=oe.length>0&&oe.reduce((e,a)=>e+a,0)>ie.regionWidth+.5,Se=ke?de:de.map(({fixed:e,...a})=>a),ze=he(Se,oe,ie.regionWidth,ke&&f?Se.length-1:void 0),Te=JSON.stringify([ee.order,de.map(({width:e,minWidth:a,align:t,fixed:r})=>({width:e,minWidth:a,align:t,fixed:r}))]),je=n.map(o),Ie=je.length>0&&je.every(e=>g.has(e)),Re=je.some(e=>g.has(e))&&!Ie,Ae=Math.max(Math.ceil(N/Math.max(k,1)),1),De=[...new Set([...R??[],k])].filter(e=>Number.isSafeInteger(e)&&e>0).sort((e,a)=>e-a),Me=d?"error":s?"loading":0===n.length?"empty":"ready";return ce(()=>(f||ae.some(e=>ge(e)))&&ne.current?we(ne.current,(e,a)=>le({widths:e,regionWidth:a})):void 0,[Te,Me]),Ee("div",{ref:ne,className:P("min-w-0",!W&&"space-y-[calc(var(--content-gap)*0.75)]",J),"data-ug":"data-table","data-fill":W||void 0,"data-state":Me,"data-variant":M?"bordered":"default","data-size":$,...X,children:d?Ge("div",{className:"grid min-h-[calc(var(--control-height-lg)*3)] content-center gap-[calc(var(--content-gap)*0.75)]","data-ug-slot":"feedback",children:[Ge(e,{variant:"destructive",children:[Ee(t,{children:c}),Ee(a,{children:d})]}),L?Ee("div",{children:Ge(B,{onClick:L,size:"sm",type:"button",variant:"default",children:[Ee(Ne,{"aria-hidden":"true",size:16}),E]})}):null]}):Ge(Le,{children:[Ee("div",{"data-ug-slot":"table",children:Ge(z,{bordered:M,className:P("min-w-[48rem] table-auto",F),scrollRegionLabel:G,size:$,striped:V,children:[Ee("colgroup",{children:de.map((e,a)=>Ee("col",{style:{width:xe(e.width)}},a))}),Ee(DataTableHeader,{headers:ee.headers,layout:ze,widths:oe,offset:Ce,sort:p,order:v,onSortChange:b,reorderable:K,move:function moveColumn(e,a,t=!1){const r=ve(l,ee.order,e,a,t);r.every((e,a)=>e===ee.order[a])||(void 0===_&&Z(r),Q?.(r))},selection:h?Ee("span",{className:"inline-flex","data-ug-slot":"selection",children:Ee(r,{"aria-label":"选择当前页全部记录",checked:Ie,indeterminate:Re,onCheckedChange:function toggleAll(e){const a=new Set(g);for(const t of je)e?a.add(t):a.delete(t);h?.(a)}})}):void 0,actions:f?Ee("span",{"data-ug-slot":"header",children:x}):void 0}),Ge(T,{children:[s?$e.map(e=>Ge(A,{children:[h?Ee(j,{className:"text-center","data-fixed":ge(ze[0]),style:fe(ze,0,oe),children:Ee("span",{className:"inline-flex","data-ug-slot":"selection",children:Ee(S,{className:"size-[calc(var(--control-height-sm)*0.5)]",variant:"rect"})})}):null,ae.map((e,a)=>Ee(j,{className:e.className,"data-fixed":ge(ze[a+Ce]),style:fe(ze,a+Ce,oe),children:Ee("span",{"data-ug-slot":"loading",children:Ee(S,{variant:"text"})})},e.id)),f?Ee(j,{className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":ge(ze[de.length-1]),children:Ee("span",{"data-ug-slot":"loading",children:Ee(S,{variant:"text"})})}):null]},e)):n.map((e,a)=>{const t=o(e),n=g.has(t);return Ge(A,{"data-state":n?"selected":"default",children:[h?Ee(j,{className:"text-center","data-fixed":ge(ze[0]),style:fe(ze,0,oe),children:Ee("span",{className:"inline-flex","data-ug-slot":"selection",children:Ee(r,{"aria-label":`选择记录 ${t}`,checked:n,onCheckedChange:e=>function toggleOne(e,a){const t=new Set(g);a?t.add(e):t.delete(e),h?.(t)}(t,e)})})}):null,ae.map((t,r)=>te[a][r].rowSpan>0?Ee(j,{rowSpan:te[a][r].rowSpan,colSpan:te[a][r].colSpan,className:t.className,"data-fixed":1===te[a][r].colSpan?ge(ze[r+Ce]):void 0,style:fe(ze,r+Ce,oe),children:Ee("span",{className:"contents","data-ug-slot":"cell",children:t.cell?t.cell(e):String(e[t.id]??"—")})},t.id):null),f?Ee(j,{className:"whitespace-nowrap text-right","data-ug-slot":"action-column","data-fixed":ge(ze[de.length-1]),children:Ee("div",{"data-ug-slot":"actions",children:f(e)})}):null]},t)}),s||0!==n.length?null:Ee(A,{children:Ee(j,{colSpan:ae.length+(h?1:0)+(f?1:0),children:Ee("div",{"data-ug-slot":"empty",children:Ee(i,{description:m,icon:ye,size:"sm",title:u})})})})]}),re&&n.length>0&&Ee("tfoot",{"data-ug-slot":"aggregate",children:Ge(A,{children:[h&&Ee(j,{}),ae.map((e,a)=>Ee(j,{"data-fixed":ge(ze[a+Ce]),style:fe(ze,a+Ce,oe),children:re[a]},e.id)),f&&Ee(j,{"data-ug-slot":"action-column","data-fixed":ge(ze[de.length-1])})]})})]})}),U&&!s&&(N>0||R&&D)?Ge("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-[var(--content-gap)] text-sm text-text-secondary max-sm:items-stretch max-sm:flex-col","data-ug-slot":"pagination",children:[Ge("span",{"data-ug-slot":"summary",children:["共 ",N," 条,第 ",y," / ",Ae," 页"]}),Ge("div",{"data-ug-slot":"pagination-controls",children:[R&&D?Ee(C,{"aria-label":"每页条数",options:De.map(e=>({label:`每页 ${e} 条`,value:e})),size:"sm",value:k,onValueChange:e=>{"number"==typeof e&&D(e)}}):null,I&&Ae>1?Ee(w,{onPageChange:I,page:y,totalPages:Ae,size:"sm"}):null]})]}):null]})})}import{jsx as Me,jsxs as Ve}from"react/jsx-runtime";function defaultChildren(e){return e.children}function TreeTable({rows:e,columns:a,getRowId:t,getChildren:r=defaultChildren,getRowLabel:n,treeColumnId:i=de(a).leaves[0]?.id,expandedIds:l,defaultExpandedIds:o,defaultExpandAll:s=!1,onExpandedChange:d,onExpandChange:c,indent:u=16,expansionDisabled:m=!1,expansionDisabledReason:g,fill:h=!1,size:p="sm",bordered:v=!0,className:b,...f}){const[x,w]=ie(()=>o?new Set(o):void 0),y=l??x,N=ne(()=>se(e,{getRowId:t,getChildren:r,expandedIds:y,defaultExpandAll:s}),[e,t,r,y,s]),C=new Map(N.visibleRows.map(e=>[e.id,e]));function toggle(e,a){if(m)return;const r=t(e),n=new Set(y??(s?N.expandableIds:[]));a?n.add(r):n.delete(r),void 0===l&&w(n),d?.(n),c?.(e,a)}const decorate=e=>e.map(e=>e.children?.length?{...e,children:decorate(e.children)}:e.id!==i?e:{...e,cell:a=>{const r=C.get(t(a)),i=n?.(a)??`记录 ${r.id}`;return Ve("div",{"data-ug-slot":"tree-cell","data-depth":r.depth,style:{paddingInlineStart:r.depth*Math.max(u,0)},children:[Ve("span",{"data-ug-slot":"level",children:["层级 ",r.depth+1,","]}),r.hasChildren?Me(B,{type:"button",size:"icon-sm",variant:"ghost",tone:"neutral","aria-label":`${r.expanded?"收起":"展开"}${i}`,"aria-expanded":r.expanded,disabled:m,"aria-description":g,onClick:()=>toggle(a,!r.expanded),onKeyDown:e=>{m||("ArrowRight"!==e.key||r.expanded||(e.preventDefault(),toggle(a,!0)),"ArrowLeft"===e.key&&r.expanded&&(e.preventDefault(),toggle(a,!1)))},children:r.expanded?Me(le,{size:16,"aria-hidden":!0}):Me(oe,{size:16,"aria-hidden":!0})}):Me("span",{"data-ug-slot":"tree-spacer","aria-hidden":!0}),Me("span",{"data-ug-slot":"tree-content",title:i,children:e.cell?e.cell(a):String(a[e.id]??"—")})]})}}),k=decorate(a);return Me("div",{className:b,"data-ug":"tree-table","data-ug-slot":"root","data-fill":h||void 0,"data-size":p,"data-variant":v?"bordered":"default","data-state":f.error?"error":f.loading?"loading":N.visibleRows.length?"ready":"empty",children:Me(DataTable,{...f,rows:N.visibleRows.map(e=>e.record),columns:k,getRowId:t,pagination:!1,fill:h,size:p,bordered:v})})}import{resolveUGNavigationColors as Be,resolveUGNavigationPalette as Pe}from"@ug666/ui-core/theme";import{forwardRef as Fe,useState as We}from"react";import{Menu as Ue,PanelLeftClose as Oe,PanelLeftOpen as He}from"lucide-react";import{memo as _e,useCallback as qe,useLayoutEffect as Qe,useMemo as Ke,useRef as Je,useState as Xe}from"react";import{ChevronDown as Ye,MoreHorizontal as Ze}from"lucide-react";import{createSidebarTreeMeta as ea}from"@ug666/ui-web/sidebar";import{jsx as aa,jsxs as ta}from"react/jsx-runtime";function activeClass(e,a){return e?"indicator"===a?"bg-transparent text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-active-text)] data-[state=open]:bg-[var(--ug-navigation-hover-bg)] data-[state=open]:text-[var(--ug-navigation-active-text)] after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:bg-[var(--ug-navigation-active-text)]":"bg-[var(--ug-navigation-active-bg)] text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-active-bg)] hover:text-[var(--ug-navigation-active-text)] data-[state=open]:bg-[var(--ug-navigation-active-bg)] data-[state=open]:text-[var(--ug-navigation-active-text)]":"bg-transparent text-[var(--ug-navigation-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-text)] data-[state=open]:bg-[var(--ug-navigation-hover-bg)] data-[state=open]:text-[var(--ug-navigation-text)]"}function topItemClass(e,a,t){return P("relative flex max-w-40 items-center gap-1.5 rounded-[var(--radius-control)] px-2.5 font-medium","compact"===t?"h-8 text-xs":"h-9 text-sm",activeClass(e,a))}function moreItemClass(e,a,t){return P("relative flex shrink-0 items-center gap-1 px-2.5","compact"===t?"h-8 text-xs":"h-9 text-sm",activeClass(e,a))}var ra=_e(function DropdownItems2({items:e,level:a=0}){return aa("div",{className:P("grid min-w-52 gap-1 p-1.5",a>0&&"min-w-48 border-l border-[var(--ug-navigation-border)] pl-2"),children:e.map((e,t)=>{const r=e.icon,n=e.id??e.href??`${a}-${t}-${e.label}`;return e.children?.length?ta("div",{className:"grid gap-1",children:[ta("div",{className:"flex items-center gap-2 px-2 py-1.5 text-xs font-semibold text-[var(--ug-navigation-text)] opacity-75",children:[aa(r,{"aria-hidden":"true",size:14}),aa("span",{className:"truncate",children:e.label})]}),aa(DropdownItems2,{items:e.children,level:a+1})]},n):ta(f,{active:e.active,className:P("flex w-full items-center gap-2 px-2.5 py-2",(i=Boolean(e.active),i?"bg-[var(--ug-navigation-active-bg)] text-[var(--ug-navigation-active-text)] hover:bg-[var(--ug-navigation-active-bg)] hover:text-[var(--ug-navigation-active-text)]":"bg-transparent text-[var(--ug-navigation-text)] hover:bg-[var(--ug-navigation-hover-bg)] hover:text-[var(--ug-navigation-text)]")),href:e.href,children:[aa(r,{"aria-hidden":"true",size:15}),aa("span",{className:"min-w-0 flex-1 truncate",children:e.label}),void 0!==e.badge?aa("span",{className:"text-xs opacity-70",children:e.badge}):null]},n);var i})})}),na=_e(function TopItem2({item:e,active:a,activeStyle:t,density:r}){const n=e.icon,i=topItemClass(a,t,r);return e.children?.length?ta(b,{children:[ta(x,{active:a,className:i,children:[aa(n,{"aria-hidden":"true",size:15}),aa("span",{className:"truncate",children:e.label})]}),aa(v,{className:"max-h-[min(70dvh,32rem)] overflow-y-auto overscroll-contain border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]",children:aa(ra,{items:e.children})})]}):aa(b,{children:ta(f,{active:a,className:i,href:e.href,children:[aa(n,{"aria-hidden":"true",size:15}),aa("span",{className:"truncate",children:e.label})]})})});function AdminHorizontalNavigation({items:e,activeStyle:a,density:t}){const r=Ke(()=>function normalizeItems(e){const a=1===e.length?e[0]:void 0;return a?.children?.length?a.href?[{...a,children:void 0},...a.children]:a.children:e}(e),[e]),n=Ke(()=>ea(r),[r]),[i,l]=Xe(()=>Math.min(r.length,6)),o=Je(null),s=Je(null),d=Je(null),c=Ke(()=>r.slice(0,i),[r,i]),u=Ke(()=>r.slice(i),[r,i]),m=qe(e=>Boolean(e.active||n.activeBranches.has(e)),[n]),g=Ke(()=>u.some(m),[m,u]),h=qe(()=>{const e=o.current,a=s.current;if(!e||!a||e.clientWidth<=0)return void l(Math.min(r.length,6));const t=Array.from(a.querySelectorAll('[data-ug-navigation-measure="item"]')),n=a.querySelector('[data-ug-navigation-measure="more"]'),i=Number.parseFloat(window.getComputedStyle(a).columnGap)||4,d=n?.getBoundingClientRect().width??0;let c=0,u=0;for(let a=0;a<t.length;a+=1){const r=t[a]?.getBoundingClientRect().width??0,n=a>0?i:0;if(c+n+r+(a<t.length-1?i+d:0)>e.clientWidth+.5)break;c+=n+r,u+=1}l(u)},[r]),f=qe(()=>{null===d.current&&(d.current=window.requestAnimationFrame(()=>{d.current=null,h()}))},[h]);return Qe(()=>{let e=!1;const a="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(f);return o.current&&a?.observe(o.current),f(),document.fonts?.ready.then(()=>{e||f()}),()=>{e=!0,null!==d.current&&window.cancelAnimationFrame(d.current),d.current=null,a?.disconnect()}},[t,f]),ta("div",{className:"relative min-w-0 flex-1",ref:o,children:[ta("div",{"aria-hidden":"true",className:"pointer-events-none absolute invisible flex max-w-none items-center gap-1 whitespace-nowrap","data-ug-slot":"measure",inert:!0,ref:s,children:[r.map((e,r)=>{const n=e.icon;return ta("span",{className:P(topItemClass(m(e),a,t),"max-w-none shrink-0"),"data-ug-navigation-measure":"item",children:[aa(n,{"aria-hidden":"true",size:15}),aa("span",{children:e.label}),e.children?.length?aa(Ye,{"aria-hidden":"true",size:14}):null]},e.id??e.href??`measure-${r}-${e.label}`)}),ta("span",{className:moreItemClass(!1,a,t),"data-ug-navigation-measure":"more",children:[aa(Ze,{"aria-hidden":"true",size:16}),aa("span",{children:"更多"})]})]}),ta(p,{activation:"click",tone:"inherit",className:"min-w-0 w-full overflow-visible","data-ug-context":"admin-horizontal-navigation",children:[c.map((e,r)=>aa(na,{active:m(e),activeStyle:a,density:t,item:e},e.id??e.href??`${r}-${e.label}`)),u.length?ta(b,{children:[ta(x,{active:g,className:moreItemClass(g,a,t),children:[aa(Ze,{"aria-hidden":"true",size:16}),aa("span",{children:"更多"})]}),aa(v,{className:"right-0 left-auto max-h-[min(70dvh,32rem)] overflow-y-auto overscroll-contain border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]",children:aa(ra,{items:u})})]}):null]})]})}import{Fragment as ia,jsx as la,jsxs as oa}from"react/jsx-runtime";var sa=Fe(({navItems:e,sidebarHeader:a,sidebarCollapsedHeader:t,sidebarHeaderAlign:r="start",sidebarHeaderDivider:n=!0,sidebarContextSwitcher:i,sidebarContextSwitcherVisible:l=!1,sidebarContextSwitcherDividers:o=!1,sidebarContextSwitcherPlacement:s="after-search",sidebarScrollActiveItemIntoView:d=!0,sidebarFooter:c,sidebarVariant:u="dark",navigationMode:m="sidebar",navigationPalette:g,themePreset:h="default",themeMode:p,themeAccent:v="theme",navigationColors:b,navigationActiveStyle:f,navigationDensity:x,sidebarActiveStyle:w="highlight",sidebarDensity:y="comfortable",sidebarSearchable:N=!1,sidebarSearchPlaceholder:C="搜索菜单...",sidebarSearchDividers:S=!0,sidebarCollapsible:z=!0,sidebarTogglePlacement:T="sidebar",sidebarResizable:j=!1,sidebarWidth:I,defaultSidebarWidth:R=256,sidebarMinWidth:A=208,sidebarMaxWidth:D=480,onSidebarWidthChange:L,sidebarCollapsed:E,defaultSidebarCollapsed:G=!1,onSidebarCollapsedChange:$,mobileSidebarOpen:V,onMobileSidebarOpenChange:F,topbarStart:W,topbarEnd:U,topbar:O,secondaryBar:H,topbarBordered:_=!0,secondaryBarBordered:q=!1,fluidContent:Q=!1,contentPadding:K=!0,mainClassName:J,contentClassName:X,children:Y,className:Z,...ee},ae)=>{const te=M("(prefers-color-scheme: dark)"),[re,ne]=We(G),[ie,le]=We(!1),oe=E??re,se=V??ie,de=g??("primary"===u?"light":"dark"),ce=void 0===p?de:Pe(p,te),ue=b?de:ce,me=Be(h,ue,b,v),ge=f??w,he=x??y,pe="light"===ue?"primary":"dark",ve={"--ug-navigation-bg":me.background,"--ug-navigation-text":me.text,"--ug-navigation-active-bg":me.activeBackground,"--ug-navigation-active-text":me.activeText,"--ug-navigation-hover-bg":me.hoverBackground,"--ug-navigation-border":`color-mix(in srgb, ${me.text} 18%, ${me.background})`};function setSidebarCollapsed(e){void 0===E&&ne(e),$?.(e)}function setMobileOpen(e){void 0===V&&le(e),F?.(e)}return la("div",{ref:ae,className:P("text-text-primary",Z),...ee,"data-ug":"admin-shell","data-state":se?"mobile-open":"default","data-variant":pe,"data-navigation-mode":m,"data-navigation-palette":ue,"data-sidebar-active-style":ge,"data-sidebar-density":he,"data-size":"md",children:oa("div",{className:"flex min-h-screen min-w-0",children:[la(k,{items:e,variant:pe,activeStyle:ge,density:he,colors:me,header:a,headerAlign:r,headerDivider:n,collapsedHeader:t,contextSwitcher:i,contextSwitcherVisible:l,contextSwitcherDividers:o,contextSwitcherPlacement:s,scrollActiveItemIntoView:d,footer:c,searchable:N,searchPlaceholder:C,searchDividers:S,collapsible:z&&"sidebar"===T,bottomCollapsible:z&&"bottom"===T,resizable:j,width:I,defaultWidth:R,minWidth:A,maxWidth:D,onWidthChange:L,collapsed:oe,onCollapsedChange:setSidebarCollapsed,responsive:!0,mobileOpen:se,onMobileOpenChange:setMobileOpen,className:P("shrink-0","header"===m&&"lg:hidden"),"data-ug-slot":"sidebar"}),oa("div",{className:"flex min-w-0 flex-1 flex-col",children:[oa("header",{className:P("sticky top-0 z-30 flex items-center gap-[calc(var(--content-gap)*0.75)] px-[var(--content-gap)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]",_?"border-b":"border-b-0","header"===m?"border-[var(--ug-navigation-border)] bg-[var(--ug-navigation-bg)] text-[var(--ug-navigation-text)]":"border-border-base bg-surface-0"),style:"header"===m?ve:void 0,"data-ug-slot":"topbar",children:[la(B,{type:"button",variant:"ghost",size:"icon",className:"md:hidden","aria-label":"打开侧边栏",onClick:()=>setMobileOpen(!0),"data-ug-slot":"mobile-trigger",children:la(Ue,{"aria-hidden":"true",focusable:"false",size:18})}),"sidebar"===m&&z&&"topbar"===T?la(B,{type:"button",variant:"ghost",size:"icon",className:"hidden md:inline-flex","aria-label":oe?"展开侧边栏":"折叠侧边栏",onClick:()=>setSidebarCollapsed(!oe),"data-ug-slot":"desktop-sidebar-trigger",children:la(oe?He:Oe,{"aria-hidden":"true",focusable:"false",size:18})}):null,"header"===m?oa(ia,{children:[la("div",{className:"hidden shrink-0 items-center lg:flex",children:a}),la("div",{className:"hidden min-w-0 flex-1 lg:flex",children:la(AdminHorizontalNavigation,{activeStyle:ge,density:he,items:e})}),la("div",{className:"min-w-0 flex-1 lg:hidden","data-ug-slot":"topbar-start",children:W})]}):la("div",O?{className:"min-w-0 flex-1","data-ug-slot":"topbar-content",children:O}:{className:"min-w-0 flex-1","data-ug-slot":"topbar-start",children:W}),"header"!==m&&O||!U?null:la("div",{className:"flex shrink-0 items-center gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"topbar-end",children:U},"topbar-end")]}),H?la("div",{className:P("sticky top-[var(--ug-admin-shell-topbar-height)] z-20 bg-surface-1",q&&"border-b border-border-base"),"data-ug-slot":"secondary-bar",children:H}):null,la("main",{className:P("flex-1 overflow-x-clip",J),"data-ug-slot":"main",children:la("div",{className:P("mx-auto",Q?"max-w-none":"max-w-7xl",K?"px-[var(--content-gap)] py-[calc(var(--content-gap)*1.5)] sm:px-[calc(var(--content-gap)*1.25)] lg:px-[calc(var(--content-gap)*1.5)]":"!p-0",X),"data-ug-context":"admin-shell","data-ug-slot":"content",children:Y})})]})]})})});sa.displayName="AdminShell";import{ChevronLeft as da,ChevronRight as ca,X as ua}from"lucide-react";import{forwardRef as ma,memo as ga,useCallback as ha,useEffect as pa,useLayoutEffect as va,useMemo as ba,useRef as fa,useState as xa}from"react";import{jsx as wa,jsxs as ya}from"react/jsx-runtime";function getScrollBehavior(e){return e.closest('[data-ug-motion="reduced"]')||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}function getTabElements(e){return Array.from(e.children).filter(e=>e instanceof HTMLLIElement&&"item"===e.dataset.ugSlot)}function clearItemMotion(e){delete e.dataset.motion,e.style.removeProperty("--ug-app-tabs-motion-x")}function playItemMotion(e,a,t=0){const r=Boolean(e.dataset.motion);clearItemMotion(e),r&&e.offsetWidth,"move"===a&&e.style.setProperty("--ug-app-tabs-motion-x",`${t}px`),e.dataset.motion=a}var Na=ga(({active:e,activeItemRef:a,closable:t,closeEnabled:r,icon:n,label:i,onActivate:l,onClose:o,value:s})=>ya("li",{"data-closable":t||void 0,"data-state":e?"active":"default","data-ug-slot":"item","data-value":s,ref:e?a:void 0,children:[ya("button",{"aria-current":e?"page":void 0,"data-ug-slot":"trigger",onAuxClick:e=>{1===e.button&&t&&r&&(e.preventDefault(),o(s))},onClick:()=>l(s),title:i,type:"button",children:[n?wa("span",{"aria-hidden":"true","data-ug-slot":"icon",children:n}):null,wa("span",{"data-ug-slot":"label",children:i})]}),t&&r?wa("button",{"aria-label":`关闭页面 ${i}`,"data-ug-slot":"close",onClick:()=>o(s),type:"button",children:wa(ua,{"aria-hidden":"true",size:13})}):null]}));Na.displayName="AppTabView";var Ca=ma(({items:e,value:a,density:t="comfortable",showIcons:r=!0,closable:n=!0,bordered:i=!0,onValueChange:l,onClose:o,className:s,"aria-label":d="页面标签",...c},u)=>{const m=fa(null),g=fa(null),h=fa(null),p=fa(null),v=fa(null),b=fa(new Map),f=fa(null),x=fa(e),w=fa(l),y=fa(o),[N,C]=xa({canScrollStart:!1,canScrollEnd:!1}),k=N.canScrollStart||N.canScrollEnd,S=ba(()=>e.map(e=>`${e.value}${e.label}${n&&e.closable?"1":"0"}${r&&e.icon?"1":"0"}`).join(""),[n,e,r]);x.current=e,w.current=l,y.current=o;const z=ha(e=>{const a=x.current.find(a=>a.value===e);a&&w.current(a)},[]),T=ha(e=>{const a=x.current.find(a=>a.value===e);if(!a)return;const t=g.current,r=t?getTabElements(t).find(a=>a.dataset.value===e):null;r?.contains(document.activeElement)&&(f.current=e),y.current?.(a)},[]),j=ha(()=>{null===p.current&&(p.current=window.requestAnimationFrame(()=>{p.current=null;const e=g.current;if(!e)return;const a=Math.max(0,e.scrollWidth-e.clientWidth),t={canScrollStart:e.scrollLeft>1,canScrollEnd:e.scrollLeft<a-1};C(e=>e.canScrollStart===t.canScrollStart&&e.canScrollEnd===t.canScrollEnd?e:t)}))},[]),I=ha(e=>{const a=g.current,t=h.current;if(!a||!t)return;const r=getTabElements(a);if(t===r[0]&&a.scrollLeft>1)return void a.scrollBy({behavior:e,left:-a.scrollLeft});const n=Math.max(0,a.scrollWidth-a.clientWidth);if(t===r[r.length-1]&&a.scrollLeft<n-1)return void a.scrollBy({behavior:e,left:n-a.scrollLeft});const i=t.offsetLeft-a.scrollLeft,l=i+t.offsetWidth-a.clientWidth;i<0?a.scrollBy({behavior:e,left:i-2}):l>0&&a.scrollBy({behavior:e,left:l+2})},[]);function scrollTabs(e){const a=g.current;a&&a.scrollBy({behavior:getScrollBehavior(a),left:e*Math.max(160,.6*a.clientWidth)})}return va(()=>{const e=g.current;if(!e)return;const a=getTabElements(e),t=new Map;for(const e of a){const a=e.dataset.value;a&&t.set(a,e.offsetLeft)}const r=b.current;if(r.size>0&&"auto"!==getScrollBehavior(e))for(const e of a){const a=e.dataset.value;if(!a)continue;const n=r.get(a),i=t.get(a)??0,l=void 0===n?0:n-i;void 0!==n&&Math.abs(l)<.5||playItemMotion(e,void 0===n?"enter":"move",l)}b.current=t},[S]),va(()=>{const e=f.current;if(!e||x.current.some(a=>a.value===e))return;const a=g.current?.querySelector('[data-ug-slot="item"][data-state="active"] [data-ug-slot="trigger"]');a&&(f.current=null,a.focus({preventScroll:!0}))},[S,a]),pa(()=>{const e=m.current,a=g.current;if(!e||!a)return;j(),a.addEventListener("scroll",j,{passive:!0});const handleContainerResize=()=>{j(),null!==v.current&&window.cancelAnimationFrame(v.current),v.current=window.requestAnimationFrame(()=>{v.current=window.requestAnimationFrame(()=>{v.current=null,I("auto"),j()})})},t="undefined"==typeof ResizeObserver?null:new ResizeObserver(handleContainerResize);return t?t.observe(e):window.addEventListener("resize",handleContainerResize),()=>{a.removeEventListener("scroll",j),t?t.disconnect():window.removeEventListener("resize",handleContainerResize),null!==p.current&&(window.cancelAnimationFrame(p.current),p.current=null),null!==v.current&&(window.cancelAnimationFrame(v.current),v.current=null)}},[I,j]),pa(()=>{if(!e.some(e=>e.value===a))return;const t=g.current;t&&(I(getScrollBehavior(t)),j())},[e,I,j,a]),wa("nav",{ref:u,...c,"aria-label":d,className:P("text-text-primary",!i&&"[background-image:none]",s),"data-density":t,"data-overflow":k||void 0,"data-size":"md","data-state":k?"overflow":"default","data-ug":"app-tabs","data-variant":"browser",children:ya("div",{"data-ug-slot":"track",ref:m,children:[wa("button",{"aria-label":"向左滚动页面标签","data-ug-slot":"scroll-start","data-visible":k&&N.canScrollStart||void 0,disabled:!N.canScrollStart,onClick:()=>scrollTabs(-1),type:"button",children:wa(da,{"aria-hidden":"true",size:15})}),wa("ul",{ref:g,"aria-label":"页面标签列表","data-ug-slot":"list",onAnimationEnd:e=>{["ug-motion-app-tab-enter","ug-motion-app-tab-layout-shift"].includes(e.animationName)&&clearItemMotion(e.target)},children:e.map(e=>wa(Na,{active:e.value===a,activeItemRef:h,closable:n&&Boolean(e.closable),closeEnabled:n&&Boolean(o),icon:r?e.icon:void 0,label:e.label,onActivate:z,onClose:T,value:e.value},e.value))}),wa("button",{"aria-label":"向右滚动页面标签","data-ug-slot":"scroll-end","data-visible":k&&N.canScrollEnd||void 0,disabled:!N.canScrollEnd,onClick:()=>scrollTabs(1),type:"button",children:wa(ca,{"aria-hidden":"true",size:15})})]})})});Ca.displayName="AppTabs";import{forwardRef as ka}from"react";import{AlertTriangle as Sa,HelpCircle as za}from"lucide-react";import{jsx as Ta,jsxs as ja}from"react/jsx-runtime";var Ia=ka(({open:e,onOpenChange:a,title:t,description:r,children:n,variant:i="destructive",icon:l,cancelText:o="取消",confirmText:d="确认",loading:c=!1,disabled:p=!1,closeOnConfirm:v=!0,onCancel:b,onConfirm:f,className:x,...w},y)=>{const N=l??("destructive"===i?Sa:za);function handleCancel(){c||(b?.(),a(!1))}return Ta(s,{open:e,onClose:handleCancel,closeOnEsc:!c,closeOnOverlay:!c,children:ja(u,{ref:y,className:P("max-w-md",x),...w,"data-ug":"confirm-dialog","data-state":e?"open":"default","data-variant":i,"data-size":"md",children:[ja(g,{className:"items-start gap-[calc(var(--content-gap)*0.75)]","data-ug-slot":"header",children:[Ta("div",{className:P("flex h-[var(--control-height-md)] w-[var(--control-height-md)] shrink-0 items-center justify-center rounded-[var(--radius-control)]","destructive"===i?"bg-danger-soft text-danger-soft-fg":"bg-primary-soft text-primary-soft-fg"),"data-ug-slot":"icon",children:Ta(N,{size:20,"aria-hidden":"true"})}),ja("div",{className:"min-w-0 flex-1 space-y-[calc(var(--content-gap)*0.25)]","data-ug-slot":"content",children:[Ta(h,{className:"break-words text-base","data-ug-slot":"title",children:t}),r?Ta("p",{className:"text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:r}):null]})]}),n?Ta("div",{className:"px-[var(--content-gap)] py-[var(--content-gap)] text-sm text-text-secondary","data-ug-slot":"body",children:n}):null,ja(m,{className:"flex-col-reverse gap-[calc(var(--content-gap)*0.5)] sm:flex-row","data-ug-slot":"footer",children:[Ta(B,{type:"button",variant:"outline",disabled:c,onClick:handleCancel,"data-ug-slot":"cancel",children:o}),Ta(B,{type:"button",variant:"destructive"===i?"destructive":"default",loading:c,disabled:p,onClick:function handleConfirm(){const e=f?.();return v&&a(!1),e},"data-ug-slot":"confirm",children:d})]})]})})});Ia.displayName="ConfirmDialog";import{forwardRef as Ra,useEffect as Aa,useRef as Da,useState as La}from"react";import{Check as Ea,Copy as Ga}from"lucide-react";import{jsx as $a,jsxs as Ma}from"react/jsx-runtime";var Va=Ra(({value:e,label:a,displayValue:t,monospace:r=!0,disabled:n=!1,bordered:i=!0,showIcon:l=!0,showCopyText:o=!0,copyLabel:s="复制",copiedLabel:d="已复制",onCopied:c,onCopyError:u,className:m,...g},h)=>{const[p,v]=La(!1),b=Da(null),f=Da({value:e,generation:0,mounted:!0});return f.current.value!==e&&(f.current.value=e,f.current.generation++),Aa(()=>(f.current.mounted=!0,()=>{f.current.mounted=!1,f.current.generation++,b.current&&clearTimeout(b.current)}),[]),Aa(()=>{v(!1),b.current&&(clearTimeout(b.current),b.current=null)},[e]),Ma("div",{ref:h,className:P("space-y-[calc(var(--content-gap)*0.5)]",m),...g,"data-ug":"copy-field","data-state":n?"disabled":p?"copied":"default","data-variant":r?"monospace":"default","data-bordered":i?"true":"false","data-size":"md",children:[a?$a("div",{className:"text-xs font-medium text-text-secondary","data-ug-slot":"label",children:a}):null,Ma("div",{className:P("flex min-w-0 items-stretch overflow-hidden rounded-[var(--radius-control)] bg-surface-1",i&&"border border-border-base",n&&"opacity-60"),"data-ug-slot":"field",children:[$a("div",{className:P("min-w-0 flex-1 self-center truncate px-[var(--control-padding-x-sm)] py-[calc(var(--content-gap)*0.5)] text-sm text-text-primary",r&&"font-mono"),title:"string"==typeof t?t:e,"data-ug-slot":"value",children:t??e}),$a("div",{className:P("flex shrink-0 items-center bg-surface-2 px-[calc(var(--content-gap)*0.375)]",i&&"border-l border-border-base"),"data-ug-slot":"action",children:Ma(B,{type:"button",variant:"ghost",size:"sm",disabled:n,onClick:async function handleCopy(){if(n)return;const a=e,t=++f.current.generation,isCurrent=()=>f.current.mounted&&f.current.generation===t&&f.current.value===a;v(!1),b.current&&(clearTimeout(b.current),b.current=null);try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard API is not available");if(await navigator.clipboard.writeText(a),!isCurrent())return;if(v(!0),c?.(a),!isCurrent())return;b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{isCurrent()&&v(!1),b.current=null},1400)}catch(e){isCurrent()&&u?.(e)}},"aria-label":o?void 0:p?d:s,"aria-live":"polite","data-ug-slot":"button",children:[l?$a(p?Ea:Ga,{"aria-hidden":"true",focusable:"false",size:15}):null,o?p?d:s:null]})})]})]})});Va.displayName="CopyField";import{jsx as Ba,jsxs as Pa}from"react/jsx-runtime";function DataTableIdentity({title:e,description:a,leading:t,showLeading:r=!0,showDescription:n=!0,className:i,...l}){return Pa("span",{className:P("gap-[calc(var(--content-gap)*0.5)]",i),...l,"data-size":"md","data-state":"default","data-ug":"data-table-identity","data-variant":"default",children:[r&&t?Ba("span",{"data-ug-slot":"leading",children:t}):null,Pa("span",{"data-ug-slot":"copy",children:[Ba("strong",{"data-ug-slot":"title",children:e}),n&&a?Ba("small",{className:"text-text-secondary","data-ug-slot":"description",children:a}):null]})]})}import{jsx as Fa,jsxs as Wa}from"react/jsx-runtime";function DataTableToolbar({title:e,description:a,showDescription:t=!0,bordered:r=!0,compact:n=!1,actions:i,children:l,className:o,...s}){return Wa("div",{className:P("gap-[var(--content-gap)] border-border-base",!r&&"border-b-0",n&&"py-[calc(var(--content-gap)*0.5)]",o),...s,"data-size":n?"sm":"md","data-state":"default","data-ug":"data-table-toolbar","data-variant":"default",children:[Wa("div",{"data-ug-slot":"heading",children:[Fa("strong",{"data-ug-slot":"title",children:e}),t&&a?Fa("span",{"data-ug-slot":"description",children:a}):null]}),l?Fa("div",{"data-ug-slot":"filters",children:l}):null,i?Fa("div",{className:"flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"actions",children:i}):null]})}import{forwardRef as Ua}from"react";import{jsx as Oa,jsxs as Ha}from"react/jsx-runtime";var _a=Ua(({eyebrow:e,title:a,description:t,badge:r,breadcrumb:n,actions:i,meta:l,bordered:o=!0,compact:s=!1,children:d,className:c,...u},m)=>Ha("header",{ref:m,className:P("flex min-w-0 flex-col",s?"gap-[calc(var(--content-gap)*0.875)]":"gap-[calc(var(--content-gap)*1.25)]",o&&(s?"border-b border-border-base pb-[var(--content-gap)]":"border-b border-border-base pb-[calc(var(--content-gap)*1.5)]"),c),...u,"data-ug":"page-header","data-state":"default","data-variant":o?"default":"borderless","data-size":s?"sm":"md",children:[n?Oa("div",{className:"min-w-0","data-ug-slot":"breadcrumb",children:n}):null,Ha("div",{className:"flex min-w-0 flex-col gap-[var(--content-gap)] lg:flex-row lg:items-start lg:justify-between","data-ug-slot":"body",children:[Ha("div",{className:"min-w-0 space-y-[calc(var(--content-gap)*0.75)]","data-ug-slot":"content",children:[e?Oa("div",{className:"text-xs font-semibold uppercase text-primary","data-ug-slot":"eyebrow",children:e}):null,Ha("div",{className:"flex min-w-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.625)]",children:[Oa("h1",{className:"min-w-0 break-words text-2xl font-bold leading-tight text-text-primary sm:text-3xl","data-ug-slot":"title",children:a}),r?Oa("div",{className:"shrink-0","data-ug-slot":"badge",children:r}):null]}),t?Oa("p",{className:"max-w-3xl text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:t}):null,l?Oa("div",{className:"flex min-w-0 flex-wrap items-center gap-x-[var(--content-gap)] gap-y-[calc(var(--content-gap)*0.5)] text-xs text-text-tertiary","data-ug-slot":"meta",children:l}):null]}),i?Oa("div",{className:"flex shrink-0 flex-wrap items-center gap-[calc(var(--content-gap)*0.5)] lg:justify-end","data-ug-slot":"actions",children:i}):null]}),d?Oa("div",{className:"min-w-0","data-ug-slot":"footer",children:d}):null]}));_a.displayName="PageHeader";import{forwardRef as qa}from"react";import{ArrowRight as Qa}from"lucide-react";import{Fragment as Ka,jsx as Ja,jsxs as Xa}from"react/jsx-runtime";var Ya={2:"md:grid-cols-2 xl:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 xl:grid-cols-4"};function QuickAccessContent({item:e,showIcon:a,showIndicator:t}){const r=e.icon,n=Boolean(a&&r);return Xa(Ka,{children:[n&&r?Ja("span",{"aria-hidden":"true",className:"flex h-[var(--control-height-lg)] w-[var(--control-height-lg)] shrink-0 items-center justify-center rounded-[var(--radius-control)] bg-primary-soft text-primary-soft-fg","data-ug-slot":"icon",children:Ja(r,{size:20})}):null,Xa("span",{className:P("min-w-0",!n&&"col-start-1"),"data-ug-slot":"content",children:[Xa("span",{className:"flex min-w-0 flex-wrap items-center gap-x-[calc(var(--content-gap)*0.5)] gap-y-1",children:[Ja("strong",{className:"min-w-0 break-words text-sm font-semibold leading-5","data-ug-slot":"item-title",children:e.title}),e.meta?Ja("span",{className:"text-xs leading-5 text-text-tertiary","data-ug-slot":"meta",children:e.meta}):null]}),e.description?Ja("span",{className:"mt-1 block break-words text-xs leading-5 text-text-secondary","data-ug-slot":"item-description",children:e.description}):null]}),t?Ja(Qa,{"aria-hidden":"true",className:P("shrink-0 text-text-tertiary transition-[color] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] group-hover:text-primary",!n&&"col-start-2"),"data-ug-slot":"indicator",size:16}):null]})}var Za=qa(({title:e,description:a,items:t,columns:r=4,showIndicator:n=!0,showIcon:i=!0,bordered:l=!0,onSelect:o,className:s,...d},c)=>Xa("section",{ref:c,...d,className:P("min-w-0 space-y-[var(--content-gap)]",s),"data-ug":"quick-access","data-state":t.length>0?"ready":"empty","data-variant":r,"data-size":"md",children:[e||a?Xa("div",{className:"min-w-0 space-y-1","data-ug-slot":"header",children:[e?Ja("h2",{className:"text-base font-semibold leading-6 text-text-primary","data-ug-slot":"title",children:e}):null,a?Ja("p",{className:"text-sm leading-6 text-text-secondary","data-ug-slot":"description",children:a}):null]}):null,Ja("div",{className:P("grid min-w-0 gap-[var(--content-gap)]",Ya[r]),"data-ug-slot":"grid",children:t.map(e=>{const a=e.disabled?"disabled":"interactive",t=function getItemClasses(e,a,t){return P("group grid min-h-[calc(var(--control-height-lg)*2)] min-w-0 w-full items-center gap-[var(--content-gap)]",a&&t?"grid-cols-[auto_minmax(0,1fr)_auto]":a?"grid-cols-[auto_minmax(0,1fr)]":t?"grid-cols-[minmax(0,1fr)_auto]":"grid-cols-[minmax(0,1fr)]","rounded-[var(--radius-panel)] bg-surface-1 p-[var(--content-gap)] text-left text-text-primary shadow-sm",e?"border border-border-base hover:border-border-strong":"border border-transparent","transition-[background-color,border-color,box-shadow] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)]","hover:bg-surface-2 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-border-base disabled:hover:bg-surface-1 disabled:hover:shadow-sm")}(l,Boolean(i&&e.icon),n);return e.href&&!e.disabled?Ja("a",{className:t,"data-state":a,"data-ug-slot":"item",href:e.href,onClick:()=>o?.(e),children:Ja(QuickAccessContent,{item:e,showIcon:i,showIndicator:n})},e.id):Ja("button",{className:t,"data-state":a,"data-ug-slot":"item",disabled:e.disabled,onClick:()=>o?.(e),type:"button",children:Ja(QuickAccessContent,{item:e,showIcon:i,showIndicator:n})},e.id)})})]}));Za.displayName="QuickAccess";import{forwardRef as et}from"react";import{Send as at,Square as tt}from"lucide-react";import{jsx as rt,jsxs as nt}from"react/jsx-runtime";var it=et(({value:e,onValueChange:a,onSubmit:t,onStop:r,onPasteFiles:n,header:i,leading:l,trailing:o,footer:s,submitting:d=!1,disabled:c=!1,submitDisabled:u=!1,allowEmpty:m=!1,submitOnEnter:g=!0,inputLabel:h="消息输入",placeholder:p,submitLabel:v="发送",stopLabel:b="停止",bordered:f=!0,showCharacterCount:x=!1,maxLength:w,shortcutHint:y,showShortcutHint:N,textareaProps:C,className:k,...S},z)=>{const T=!c&&!d&&!u&&(m||e.trim().length>0);function submit(){T&&t(e)}const j=N??Boolean(y)?y??(g?"Enter 发送 · Shift+Enter 换行":null):null,I=x||Boolean(j);return nt("div",{className:P("grid min-w-0 gap-[calc(var(--content-gap)*0.625)] rounded-[var(--radius-panel)] bg-surface-1 p-[calc(var(--content-gap)*0.75)] shadow-sm transition-[border-color,box-shadow]",f?"border border-border-strong focus-within:border-primary/70":"border border-transparent",c&&"opacity-60",k),...S,"data-ug":"prompt-composer","data-state":c?"disabled":d?"submitting":"default","data-variant":"default","data-size":"md",children:[i?rt("div",{className:"min-w-0","data-ug-slot":"header",children:i}):null,nt("div",{className:"flex min-w-0 items-end gap-[calc(var(--content-gap)*0.5)]","data-ug-slot":"body",children:[l?rt("div",{className:"flex h-[var(--control-height-md)] shrink-0 items-center","data-ug-slot":"leading",children:l}):null,rt("div",{className:"min-w-0 flex-1","data-ug-slot":"input",children:rt($,{...C,ref:z,"aria-label":C?.["aria-label"]??h,autosize:C?.autosize??{minRows:1,maxRows:8},className:P("min-h-[var(--control-height-md)] border-transparent bg-transparent px-[calc(var(--control-padding-x-sm)*0.5)] py-[var(--ug-prompt-input-padding-y)] shadow-none focus-visible:!border-transparent focus-visible:!ring-0 focus-visible:!ring-offset-0",C?.className),disabled:c,maxLength:w??C?.maxLength,onKeyDown:function handleKeyDown(e){g&&"Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),submit()))},onPaste:function handlePaste(e){if(!n)return;const a=Array.from(e.clipboardData.files);a.length>0&&n(a,e)},onValueChange:a,placeholder:p??C?.placeholder,resize:"none",value:e})}),o?rt("div",{className:"flex h-[var(--control-height-md)] shrink-0 items-center gap-1","data-ug-slot":"trailing",children:o}):null,rt(B,d&&r?{"aria-label":b,onClick:r,size:"icon",tone:"danger",type:"button",variant:"soft","data-ug-slot":"submit",children:rt(tt,{"aria-hidden":"true",size:15})}:{"aria-label":v,disabled:!T,onClick:submit,size:"icon",tone:"primary",type:"button",variant:"solid","data-ug-slot":"submit",children:rt(at,{"aria-hidden":"true",size:16})})]}),s||I?nt("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2 text-xs text-text-tertiary","data-ug-slot":"footer",children:[s?rt("div",{className:"min-w-0 flex-1",children:s}):null,I?nt("div",{className:"ml-auto flex shrink-0 items-center gap-3 tabular-nums","data-ug-slot":"footer-meta",children:[j?rt("span",{"data-ug-slot":"shortcut-hint",children:j}):null,x?rt("span",{"data-ug-slot":"character-count",children:void 0!==w?`${e.length}/${w}`:`${e.length}`}):null]}):null]}):null]})});it.displayName="PromptComposer";import{Children as lt,forwardRef as ot,useEffect as st,useRef as dt}from"react";import{jsx as ct,jsxs as ut}from"react/jsx-runtime";var mt=ot(({messageRole:e,status:a="idle",avatar:t,header:r,footer:n,children:i,className:l,...o},s)=>ut("article",{ref:s,className:P("flex min-w-0 gap-[calc(var(--content-gap)*0.75)]","user"===e&&"justify-end",l),...o,"data-ug":"message","data-state":a,"data-variant":e,"data-size":"md",children:[t&&"user"!==e?ct("div",{className:"shrink-0","data-ug-slot":"avatar",children:t}):null,ut("div",{className:P("grid min-w-0 gap-[calc(var(--content-gap)*0.5)]","user"===e?"max-w-[min(85%,44rem)] rounded-[var(--radius-panel)] bg-surface-2 px-[var(--control-padding-x-lg)] py-[calc(var(--content-gap)*0.75)]":"w-full","error"===a&&"text-danger"),"data-ug-slot":"body",children:[r?ct("div",{className:"text-xs font-medium text-text-secondary","data-ug-slot":"header",children:r}):null,ut("div",{className:"min-w-0 break-words text-sm leading-7 text-text-primary","data-ug-slot":"content",children:[i,"streaming"===a?ct("span",{"aria-label":"正在生成",className:"ml-1 inline-block size-1.5 animate-pulse rounded-full bg-primary motion-reduce:animate-none","data-ug-slot":"streaming"}):null]}),n?ct("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-xs text-text-tertiary","data-ug-slot":"footer",children:n}):null]}),t&&"user"===e?ct("div",{className:"shrink-0","data-ug-slot":"avatar",children:t}):null]}));mt.displayName="Message";var gt=ot(({empty:e,followOutput:a=!0,followThreshold:t=80,children:r,className:n,onScroll:i,...l},o)=>{const s=dt(null),d=dt(!0),c=lt.count(r)>0;return st(()=>{const e=s.current;a&&e&&d.current&&e.scrollTo?.({top:e.scrollHeight,behavior:"auto"})},[r,a]),ct("div",{ref:function setRef(e){s.current=e,"function"==typeof o?o(e):o&&(o.current=e)},"aria-live":"polite","aria-relevant":"additions text",className:P("grid min-w-0 gap-[calc(var(--content-gap)*1.5)] overflow-y-auto overscroll-contain [min-height:0] [scrollbar-color:var(--color-border-strong)_transparent] [scrollbar-width:thin]",c?"content-start":"content-center",n),onScroll:function handleScroll(e){const a=e.currentTarget;d.current=a.scrollHeight-a.scrollTop-a.clientHeight<=Math.max(0,t),i?.(e)},role:"log",tabIndex:0,...l,"data-ug":"message-list","data-state":c?"populated":"empty","data-variant":a?"follow":"static","data-size":"md",children:c?r:ct("div",{className:"grid place-items-center text-center text-sm text-text-secondary [min-height:calc(var(--control-height-lg)*4)]","data-ug-slot":"empty",children:e})})});gt.displayName="MessageList";import{forwardRef as ht}from"react";import{CircleCheck as pt,File as vt,LoaderCircle as bt,TriangleAlert as ft,X as xt}from"lucide-react";import{jsx as wt,jsxs as yt}from"react/jsx-runtime";var Nt=ht(({items:e,onRemove:a,renderPreview:t,orientation:r="horizontal",showPreview:n=!0,showStatus:i=!0,showMeta:l=!0,bordered:o=!0,compact:s=!1,getRemoveLabel:d=e=>`移除附件:${e.name}`,empty:c,className:u,tabIndex:m,...g},h)=>0!==e.length||c?wt("ul",{ref:h,"aria-label":"附件",className:P("min-w-0 gap-[calc(var(--content-gap)*0.5)]","horizontal"===r?"flex overflow-x-auto pb-1 [scrollbar-width:thin]":"grid",u),tabIndex:m??("horizontal"===r?0:void 0),...g,"data-ug":"attachment-list","data-state":e.length>0?"populated":"empty","data-variant":r,"data-size":s?"xs":"sm",children:0===e.length?wt("li",{className:"text-sm text-text-secondary","data-ug-slot":"empty",children:c}):e.map(e=>{const c=e.mime?.startsWith("image/")&&e.previewUrl,u=e.status??"ready",m=i?e.statusLabel??{uploading:"正在上传",success:"上传完成",error:"上传失败"}[u]:void 0,g="uploading"===u?bt:"success"===u?pt:"error"===u?ft:null,h=l?e.meta:null;return yt("li",{"aria-busy":"uploading"===u||void 0,"aria-invalid":"error"===u||void 0,className:P("group flex shrink-0 items-center rounded-[var(--radius-control)] bg-surface-2","horizontal"===r?"min-w-52 max-w-72":"w-full min-w-0",o?"border border-border-base":"border border-transparent",s?"gap-1.5 p-1.5":"gap-2 p-2"),"data-state":u,"data-ug-slot":"item",children:[n?wt("div",{className:P("grid shrink-0 place-items-center overflow-hidden rounded-[var(--radius-control)] bg-surface-1 text-text-secondary",s?"size-[var(--control-height-md)]":"size-[var(--control-height-lg)]"),"data-ug-slot":"preview",children:t?t(e):c?wt("img",{alt:e.name,className:"size-full object-cover",src:e.previewUrl}):wt(vt,{"aria-hidden":"true",size:s?15:17})}):null,yt("div",{className:"min-w-0 flex-1","data-ug-slot":"content",children:[wt("p",{className:"truncate text-xs font-medium text-text-primary",title:e.name,children:e.name}),m||h?yt("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-text-tertiary","data-ug-slot":"meta",children:[m?yt("span",{className:P("inline-flex min-w-0 items-center gap-1 truncate","uploading"===u&&"text-primary","success"===u&&"text-success-soft-fg","error"===u&&"text-danger"),"data-ug-slot":"status",role:"ready"===u?void 0:"status",children:[g?wt(g,{"aria-hidden":"true",className:P("size-3.5 shrink-0","uploading"===u&&"animate-spin motion-reduce:animate-none")}):null,wt("span",{className:"truncate",children:m})]}):null,h?wt("span",{className:"min-w-0 truncate","data-ug-slot":"detail",children:h}):null]}):null]}),a?wt(B,{"aria-label":d(e),onClick:()=>a(e),size:"icon-sm",type:"button",variant:"ghost","data-ug-slot":"remove",children:wt(xt,{"aria-hidden":"true",size:13})}):null]},e.id)})}):null);Nt.displayName="AttachmentList";import{forwardRef as Ct}from"react";import{jsx as kt,jsxs as St}from"react/jsx-runtime";var zt=Ct(({items:e,activeId:a,onSelect:t,renderActions:r,empty:n="暂无会话",orientation:i="vertical",activeStyle:l="soft",showBadge:o=!0,showDescription:s=!0,listLabel:d="会话列表",className:c,tabIndex:u,...m},g)=>kt("div",{ref:g,"aria-label":d,className:P("horizontal"===i?"flex min-w-0 gap-1 overflow-x-auto pb-1 [scrollbar-width:thin]":"grid min-w-0 content-start gap-1",c),role:"list",tabIndex:u??("horizontal"===i?0:void 0),...m,"data-ug":"conversation-list","data-active-style":l,"data-state":e.length>0?"populated":"empty","data-variant":i,"data-size":"md",children:0===e.length?kt("div",{className:"px-[var(--control-padding-x-md)] py-[var(--content-gap)] text-sm text-text-secondary","data-ug-slot":"empty",children:n}):e.map(e=>{const n=e.id===a;return St("div",{className:P("group relative flex min-w-0 items-center rounded-[var(--radius-control)] transition-[background-color,color] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)] motion-reduce:transition-none","horizontal"===i&&"min-w-52 shrink-0",n?P("bg-primary-soft","bordered"===l&&"ring-1 ring-inset ring-primary/30","indicator"===l&&"before:absolute before:left-0 before:top-1/2 before:h-[calc(var(--control-height-sm)*0.6)] before:w-[3px] before:-translate-y-1/2 before:rounded-r-[var(--radius-control)] before:bg-primary before:content-['']"):"hover:bg-surface-2",e.disabled&&"opacity-50"),"data-state":e.disabled?"disabled":n?"active":"default","data-ug-slot":"item",role:"listitem",children:[St("button",{"aria-current":n?"page":void 0,className:"min-w-0 flex-1 rounded-[var(--radius-control)] px-[var(--control-padding-x-md)] py-[calc(var(--content-gap)*0.625)] text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",disabled:e.disabled,onClick:()=>t(e),type:"button","data-ug-slot":"trigger",children:[St("span",{className:"flex min-w-0 items-center gap-2",children:[kt("span",{className:P("min-w-0 flex-1 truncate text-sm text-text-primary",n?"font-semibold":"font-medium"),"data-ug-slot":"title",children:e.title}),o&&e.badge?kt("span",{className:"shrink-0","data-ug-slot":"badge",children:e.badge}):null]}),s&&e.description?kt("span",{className:P("mt-0.5 block truncate text-xs",n?"text-primary-soft-fg":"text-text-tertiary"),"data-ug-slot":"description",children:e.description}):null]}),r?kt("div",{className:"flex shrink-0 items-center gap-1 pr-2","data-ug-slot":"actions",children:r(e)}):null]},e.id)})}));zt.displayName="ConversationList";import{defaultUGThemeConfiguratorOptions as Tt,resolveUGNavigationColors as jt,resolveUGNavigationPalette as It}from"@ug666/ui-core/theme";import{Check as Rt,Monitor as At,Moon as Dt,PanelTop as Lt,Sun as Et,SwatchBook as Gt}from"lucide-react";import{forwardRef as $t,useEffect as Mt,useId as Vt,useMemo as Bt,useRef as Pt,useState as Ft}from"react";import{jsx as Wt,jsxs as Ut}from"react/jsx-runtime";var Ot=[{value:"sidebar",label:"左侧导航"},{value:"header",label:"顶部导航"}],Ht=[{value:"light",label:"浅色"},{value:"dark",label:"深色"}],_t=[{value:"highlight",label:"主题色块",description:"使用柔和主题底色突出当前菜单。"},{value:"indicator",label:"侧边标记",description:"使用淡色背景叠加左侧标记,定位更清楚。"}],qt=[{value:"comfortable",label:"舒适"},{value:"compact",label:"紧凑"}];function ModeIcon({value:e}){return"system"===e?Wt(At,{"aria-hidden":"true",size:16}):"light"===e?Wt(Et,{"aria-hidden":"true",size:16}):"dark"===e?Wt(Dt,{"aria-hidden":"true",size:16}):null}function ThemePresetPreview({selected:e,value:a}){const t="mecha"===a;return Ut("span",{"aria-hidden":"true",className:P("relative flex h-[calc(var(--control-height-lg)*1.75)] w-full overflow-hidden rounded-[calc(var(--radius-control)*0.75)] border bg-surface-0 transition-[border-color,box-shadow,transform] duration-[var(--motion-duration-state)] ease-[var(--motion-easing-state)]",e?"border-primary shadow-sm ring-1 ring-primary/20":"border-border-base shadow-xs"),"data-ug-mode":"light","data-ug":"theme-preview","data-ug-theme":a,children:[e?Wt("span",{className:"absolute right-1.5 top-1.5 z-10 inline-flex h-[calc(var(--control-height-sm)*0.75)] w-[calc(var(--control-height-sm)*0.75)] items-center justify-center rounded-full bg-primary text-primary-fg shadow-sm",children:Wt(Rt,{"aria-hidden":"true",size:12,strokeWidth:3})}):null,Ut("span",{className:"flex w-[24%] flex-col gap-1 border-r border-border-base bg-text-primary p-[calc(var(--content-gap)*0.375)]",children:[Wt("span",{className:"h-[calc(var(--control-height-sm)*0.2)] w-8 rounded-full bg-primary"}),Wt("span",{className:"mt-1 h-[calc(var(--control-height-sm)*0.16)] w-full rounded-full bg-surface-3"}),Wt("span",{className:"h-[calc(var(--control-height-sm)*0.16)] w-4/5 rounded-full bg-surface-3"}),Wt("span",{className:"h-[calc(var(--control-height-sm)*0.16)] w-3/4 rounded-full bg-surface-3"}),Wt("span",{className:"mt-auto h-[calc(var(--control-height-sm)*0.16)] w-2/3 rounded-full bg-surface-3"})]}),Ut("span",{className:P("flex min-w-0 flex-1 flex-col",t?"bg-text-primary":"bg-surface-0"),children:[Wt("span",{className:P("h-[calc(var(--control-height-sm)*0.48)] border-b border-border-base",t?"bg-text-primary":"bg-surface-1")}),Ut("span",{className:"grid flex-1 grid-cols-3 gap-1.5 p-[calc(var(--content-gap)*0.375)]",children:[[0,1,2].map(e=>Wt("span",{className:P("h-[calc(var(--control-height-sm)*0.42)] rounded-[calc(var(--radius-control)*0.35)] border border-border-base",t?"bg-text-secondary":1===e?"bg-primary-soft":"bg-surface-1")},e)),Ut("span",{className:P("relative col-span-3 overflow-hidden rounded-[calc(var(--radius-control)*0.4)] border border-border-base",t?"bg-text-secondary":"bg-surface-1"),children:[Wt("span",{className:"absolute inset-x-2 bottom-2 top-2 border-b border-l border-border-base"}),Wt("svg",{className:"absolute inset-2 h-[calc(100%_-_var(--content-gap))] w-[calc(100%_-_var(--content-gap))] overflow-visible text-primary",preserveAspectRatio:"none",viewBox:"0 0 100 32",children:Wt("path",{d:"M0 25 C12 22, 16 14, 28 18 S45 27, 56 14 S74 8, 100 4",fill:"none",stroke:"currentColor",strokeWidth:"2",vectorEffect:"non-scaling-stroke"})})]})]})]})]})}function ChoiceGroup({title:e,description:a,value:t,options:r,onValueChange:n,presentation:i="compact",swatch:l,iconSet:o}){const s=Vt(),d=Vt(),c="card"===i,u="preview"===i,m=void 0!==l,g=!c&&!u&&!m;return Ut("section",{className:P("min-w-0",(g||m)&&"ug-theme-config-row"),"data-presentation":m?"swatch":i,"data-ug-slot":"group",children:[Ut("div",{className:"min-w-0",children:[Wt("h3",{id:s,className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:e}),Wt("p",{id:d,className:"ug-theme-config-description",children:a})]}),Wt(N,{"aria-describedby":d,"aria-labelledby":s,className:P("min-w-0",u&&"mt-2.5 grid grid-cols-1 gap-2.5 sm:grid-cols-3",c&&"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-2",m&&"flex flex-wrap items-center gap-2.5",g&&"auto-cols-[minmax(max-content,1fr)]"),"data-ug-slot":"options",onValueChange:e=>n(String(e)),orientation:"horizontal",presentation:g?"segmented":"default",size:"default",sizing:g?"fill":"content",value:t,children:r.map(e=>Wt(y,{"aria-label":m?e.label:void 0,className:"hidden",controlClassName:m?void 0:"absolute",value:e.value,variant:c||u?"card":g?"segmented":"default",labelClassName:u?"group/theme flex min-h-[0] w-full cursor-pointer flex-col items-stretch gap-1.5 rounded-[var(--radius-control)] border-0 bg-transparent p-0 text-center shadow-none hover:bg-transparent focus-within:outline-none focus-within:ring-2 focus-within:ring-ring/30 data-[state=checked]:border-0 data-[state=checked]:bg-transparent data-[state=checked]:shadow-none":c?"min-h-[calc(var(--control-height-lg)*1.5)] gap-0 rounded-[var(--radius-control)] px-[calc(var(--content-gap)*0.75)] py-[calc(var(--content-gap)*0.5)]":m?"group/swatch min-h-[0] cursor-pointer gap-0 rounded-full p-0 focus-within:outline-none":g?"min-w-max px-[calc(var(--control-padding-x-sm)*0.75)]":void 0,label:Ut("span",{className:P("flex min-w-0",c||u?"flex-col gap-1":"items-center gap-2",m&&"block"),children:[u?Wt(ThemePresetPreview,{selected:e.value===t,value:e.value}):null,Ut("span",{className:"inline-flex min-w-0 items-center gap-2",children:["mode"===o?Wt(ModeIcon,{value:e.value}):null,m?Wt("span",{"aria-hidden":"true","data-ug-swatch":"accent","data-ug-accent":e.value,children:Wt(Rt,{"aria-hidden":"true",className:e.value===t?void 0:"invisible","data-ug-swatch-check":e.value===t?"":void 0,size:13,strokeWidth:3})}):null,Wt("span",{className:P("min-w-0",c?"font-semibold text-text-primary":u?"w-full text-center font-medium text-text-primary":m?"sr-only":"truncate"),children:e.label})]}),c&&e.description?Wt("span",{className:"text-xs font-normal leading-4 text-text-secondary",children:e.description}):null]})},e.value))})]})}var Qt=[{key:"background",label:"导航背景"},{key:"text",label:"普通文字"},{key:"activeBackground",label:"选中背景"},{key:"activeText",label:"选中文字"},{key:"hoverBackground",label:"悬停背景"}];function NavigationColorInput({label:e,value:a,onValueCommit:t}){const r=Pt(null),n=Pt(t);return n.current=t,Mt(()=>{const e=r.current;if(!e)return;const commitValue=()=>n.current(e.value);return e.addEventListener("change",commitValue),()=>e.removeEventListener("change",commitValue)},[]),Mt(()=>{r.current&&r.current.value!==a&&(r.current.value=a)},[a]),Wt("input",{ref:r,"aria-label":e,"data-ug-slot":"color-swatch",defaultValue:a,type:"color"})}function NavigationColorGroup({customized:e,value:a,onReset:t,onValueChange:r}){return Ut("section",{className:"ug-theme-config-row min-w-0","data-presentation":"colors","data-ug":"navigation-colors","data-ug-slot":"group",children:[Ut("div",{className:"min-w-0","data-ug-slot":"group-label",children:[Wt("h3",{className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:"导航颜色"}),e?Wt(B,{onClick:t,size:"sm",tone:"neutral",variant:"ghost",children:"恢复主题配色"}):null]}),Wt("div",{"data-ug-slot":"options",children:Qt.map(e=>Ut("label",{"data-ug-slot":"color-option",children:[Wt(NavigationColorInput,{label:e.label,onValueCommit:t=>r({...a,[e.key]:t}),value:a[e.key]}),Wt("span",{"data-ug-slot":"color-label",children:e.label}),Wt("code",{"data-ug-slot":"color-value",children:a[e.key].toUpperCase()})]},e.key))})]})}function TabLabel({icon:e,children:a}){return Ut("span",{className:"gap-[calc(var(--content-gap)*0.625)]","data-ug-slot":"tab-label",children:[Wt("span",{"data-ug-slot":"tab-icon",children:e}),Wt("span",{className:"truncate",children:a})]})}var Kt=$t(({value:e,onValueChange:a,options:t,sidebarValue:r,onSidebarValueChange:n,appearanceAddon:i,sidebarAddon:l,className:o,...s},d)=>{const[c,u]=Ft("appearance"),m=M("(prefers-color-scheme: dark)"),g=Bt(()=>({...Tt,...t}),[t]),h=r.palette??("primary"===r.variant?"light":"dark"),p=r.colors?h:It(e.mode,m),v=jt(e.preset,p,r.colors,e.accent);function updateField(t,r){a({...e,[t]:r})}function updateSidebarField(e,a){n({...r,[e]:a})}return Wt("div",{ref:d,className:P("h-full min-h-[0] min-w-0 text-text-primary",o),"data-ug":"theme-configurator","data-state":"ready","data-variant":"panel","data-size":"default",...s,children:Wt(D,{className:"h-full",onValueChange:e=>u(e),size:"md",value:c,variant:"rail",children:Ut("div",{"data-ug-slot":"configurator-layout",children:[Wt("div",{"data-ug-slot":"navigation",children:Ut(E,{"aria-label":"外观设置分类",orientation:"vertical",children:[Wt(G,{value:"appearance",children:Wt(TabLabel,{icon:Wt(Gt,{"aria-hidden":"true",size:16}),children:"主题外观"})}),Wt(G,{value:"sidebar",children:Wt(TabLabel,{icon:Wt(Lt,{"aria-hidden":"true",size:16}),children:"导航菜单"})})]})}),Ut("div",{className:"min-h-[0]","data-ug-slot":"settings",children:[Ut(L,{className:"ug-theme-config-appearance min-w-0",value:"appearance",children:[Wt(ChoiceGroup,{title:"主题风格",description:"选择整套界面的基础视觉气质。",value:e.preset,options:g.presets,presentation:"preview",onValueChange:e=>updateField("preset",e)}),Wt(ChoiceGroup,{title:"显示模式",description:"使用亮色、暗色,或自动跟随操作系统。",value:e.mode,options:g.modes,iconSet:"mode",onValueChange:e=>updateField("mode",e)}),Wt(ChoiceGroup,{title:"主题色",description:"统一按钮、链接、当前项和焦点状态。",value:e.accent,options:g.accents,swatch:"accent",onValueChange:e=>updateField("accent",e)}),Ut("section",{"data-ug-slot":"detail-section",children:[Wt("div",{"data-ug-slot":"section-heading",children:Wt("h3",{className:"m-0 text-sm font-semibold leading-5 text-text-primary",children:"界面细节"})}),Ut("div",{"data-ug-slot":"detail-grid",children:[Wt(ChoiceGroup,{title:"界面密度",description:"控制页面留白与控件间距。",value:e.density,options:g.densities,onValueChange:e=>updateField("density",e)}),Wt(ChoiceGroup,{title:"圆角风格",description:"统一控件和面板的边角语言。",value:e.radius,options:g.radii,onValueChange:e=>updateField("radius",e)}),Wt(ChoiceGroup,{title:"阴影层级",description:"调整浮层与卡片的空间层次。",value:e.shadow,options:g.shadows,onValueChange:e=>updateField("shadow",e)}),Wt(ChoiceGroup,{title:"字体排版",description:"选择阅读性或信息密度取向。",value:e.font,options:g.fonts,onValueChange:e=>updateField("font",e)}),Wt(ChoiceGroup,{title:"文字对比",description:"调整正文和次要信息的清晰度。",value:e.contrast,options:g.contrasts,onValueChange:e=>updateField("contrast",e)}),Wt(ChoiceGroup,{title:"界面动效",description:"控制过渡反馈的强弱。",value:e.motion,options:g.motions,onValueChange:e=>updateField("motion",e)}),Wt(ChoiceGroup,{title:"页面背景",description:"选择纯净、网格或柔光背景。",value:e.background,options:g.backgrounds,onValueChange:e=>updateField("background",e)})]})]}),i?Wt("div",{"data-ug-slot":"appearance-addon",children:i}):null]}),Ut(L,{className:"min-w-0",value:"sidebar",children:[Ut("div",{className:"ug-theme-config-sidebar-grid",children:[Wt(ChoiceGroup,{title:"导航位置",description:"选择左侧栏或桌面端顶栏导航。",value:r.mode??"sidebar",options:Ot,onValueChange:e=>updateSidebarField("mode",e)}),Wt(ChoiceGroup,{title:"配色基准",description:"默认跟随显示模式;选择后作为导航颜色覆盖。",value:p,options:Ht,onValueChange:a=>n({...r,palette:a,variant:"light"===a?"primary":"dark",colors:jt(e.preset,a,void 0,e.accent)})}),Wt(NavigationColorGroup,{customized:Boolean(r.colors),value:v,onReset:()=>updateSidebarField("colors",void 0),onValueChange:e=>n({...r,palette:p,variant:"light"===p?"primary":"dark",colors:e})}),Wt(ChoiceGroup,{title:"当前菜单",description:"选择当前页面在导航中的强调方式。",value:r.activeStyle,options:_t,onValueChange:e=>updateSidebarField("activeStyle",e)}),Wt(ChoiceGroup,{title:"菜单密度",description:"调整导航菜单的行高与间距。",value:r.density,options:qt,onValueChange:e=>updateSidebarField("density",e)})]}),l?Wt("div",{"data-ug-slot":"sidebar-addon",children:l}):null]})]})]})})})});Kt.displayName="ThemeConfigurator";import{resolveUGNavigationColors as Jt,resolveUGNavigationPalette as Xt}from"@ug666/ui-core/theme";import{RotateCcw as Yt}from"lucide-react";import{jsx as Zt,jsxs as er}from"react/jsx-runtime";function DefaultThemePreview({value:e,sidebarValue:a}){const t=M("(prefers-color-scheme: dark)"),r=a.palette??("primary"===a.variant?"light":"dark"),n=a.colors?r:Xt(e.mode,t),i=Jt(e.preset,n,a.colors,e.accent),l={"--ug-preview-navigation-bg":i.background,"--ug-preview-navigation-text":i.text,"--ug-preview-navigation-active-bg":i.activeBackground,"--ug-preview-navigation-active-text":i.activeText,"--ug-preview-navigation-hover-bg":i.hoverBackground};return er("section",{"aria-label":"实时预览",className:"[--ug-theme-preview-gap:var(--content-gap)] border-border-base","data-ug":"theme-configurator-preview",children:[Zt("h3",{"data-ug-preview":"title",children:"实时预览"}),er("div",{"data-navigation-active-style":a.activeStyle,"data-navigation-density":a.density,"data-navigation-mode":a.mode??"sidebar","data-ug-accent":e.accent,"data-ug-background":e.background,"data-ug-contrast":e.contrast,"data-ug-density":e.density,"data-ug-font":e.font,"data-ug-mode":e.mode,"data-ug-motion":e.motion,"data-ug-radius":e.radius,"data-ug-shadow":e.shadow,"data-ug-preview":"frame","data-ug-surface":e.surface,"data-ug-theme":e.preset,style:l,children:[er("aside",{"data-ug-preview":"navigation",children:[Zt("strong",{"data-ug-preview":"brand",children:"UG Admin"}),Zt("div",{"data-ug-preview":"menu",children:["工作台","任务中心","数据分析","系统设置"].map((e,a)=>er("span",{"data-state":0===a?"active":"default","data-ug-preview":"menu-item",children:[Zt("i",{"aria-hidden":"true","data-ug-preview":"menu-icon"}),Zt("span",{children:e})]},e))})]}),er("div",{"data-ug-preview":"content",children:[er("header",{"data-ug-preview":"topbar",children:[Zt("strong",{"data-ug-preview":"topbar-title",children:"工作台"}),er("span",{"aria-hidden":"true","data-ug-preview":"topbar-actions",children:[Zt("i",{}),Zt("i",{}),Zt("i",{})]})]}),er("div",{"data-ug-preview":"tabs",children:[Zt("span",{"data-state":"active",children:"工作台"}),Zt("span",{children:"任务中心"}),Zt("span",{children:"报表"})]}),er("main",{"data-ug-preview":"main",children:[Zt("div",{"data-ug-preview":"stats",children:[["待办任务","12"],["团队成员","8"],["进行项目","24"]].map(([e,a])=>er("span",{"data-ug-preview":"stat",children:[Zt("small",{children:e}),Zt("strong",{children:a})]},e))}),er("div",{"data-ug-preview":"chart",children:[Zt("strong",{children:"工作概览"}),Zt("svg",{"aria-hidden":"true",preserveAspectRatio:"none",viewBox:"0 0 240 72",children:Zt("path",{d:"M0 58 C28 48, 38 24, 66 36 S102 58, 130 28 S172 42, 240 12",fill:"none",stroke:"currentColor",strokeWidth:"3",vectorEffect:"non-scaling-stroke"})})]}),Zt("div",{"data-ug-preview":"table",children:["整理发布计划","复核访问权限","更新项目进度"].map((e,a)=>er("span",{"data-ug-preview":"table-row",children:[Zt("span",{children:e}),Zt("i",{"data-state":1===a?"warning":"success",children:1===a?"待处理":"已完成"})]},e))})]})]})]})]})}function ThemeConfiguratorDialog({open:e,onOpenChange:a,onReset:t,onCancel:r,onApply:n,title:i="外观设置",preview:l,showPreview:o=!0,resetLabel:p="恢复默认",cancelLabel:v="取消",applyLabel:b,doneLabel:f,...x}){const w=b??f??"应用",y=void 0===l?Zt(DefaultThemePreview,{value:x.value,sidebarValue:x.sidebarValue}):l,N=o&&null!==y&&!1!==y;function closeAsCancel(){r?.(),a(!1)}return Zt(s,{ariaLabel:"string"==typeof i?i:"外观设置",onClose:closeAsCancel,open:e,size:"2xl",children:er(u,{"data-ug":"theme-configurator-dialog","data-state":e?"open":"closed","data-variant":N?"preview":"default","data-size":"2xl",children:[er(g,{children:[Zt(h,{children:i}),Zt(c,{})]}),Zt(d,{className:"overflow-hidden p-0",children:er("div",{"data-ug-layout":"dialog",children:[Zt("div",{className:"h-full min-h-[0] min-w-0","data-ug-slot":"panel",children:Zt(Kt,{...x})}),N?Zt("div",{"data-ug-slot":"preview",children:y}):null]})}),er(m,{className:"justify-between",children:[Zt("div",{className:"flex min-w-0 items-center gap-3",children:t?er(B,{onClick:t,type:"button",variant:"default",children:[Zt(Yt,{"aria-hidden":"true",size:16}),p]}):null}),er("div",{className:"flex shrink-0 items-center gap-2",children:[r?Zt(B,{onClick:closeAsCancel,type:"button",variant:"default",children:v}):null,Zt(B,{onClick:function closeAsApply(){n?.(),a(!1)},type:"button",variant:"primary",children:w})]})]})]})})}export{sa as AdminShell,Ca as AppTabs,Nt as AttachmentList,Ia as ConfirmDialog,zt as ConversationList,Va as CopyField,DataTable,DataTableIdentity,DataTableToolbar,mt as Message,gt as MessageList,_a as PageHeader,it as PromptComposer,Za as QuickAccess,re as SelectionList,Kt as ThemeConfigurator,ThemeConfiguratorDialog,TreeTable,sa as UGAdminShell,Ca as UGAppTabs,Nt as UGAttachmentList,Ia as UGConfirmDialog,zt as UGConversationList,Va as UGCopyField,DataTable as UGDataTable,DataTableIdentity as UGDataTableIdentity,DataTableToolbar as UGDataTableToolbar,mt as UGMessage,gt as UGMessageList,_a as UGPageHeader,it as UGPromptComposer,Za as UGQuickAccess,re as UGSelectionList,Kt as UGThemeConfigurator,ThemeConfiguratorDialog as UGThemeConfiguratorDialog,TreeTable as UGTreeTable};//# sourceMappingURL=index.js.map
|