lingee-ui 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/button/index.css +1 -1
  2. package/dist/button/index.js +1 -1
  3. package/dist/button/index.mjs +1 -1
  4. package/dist/{chunk-7I26V66U.js → chunk-3IO42CRF.js} +1 -1
  5. package/dist/chunk-3RAHZU2C.js +1 -0
  6. package/dist/{chunk-LAIK6VBD.mjs → chunk-4OLAOR2B.mjs} +1 -1
  7. package/dist/chunk-6OF5LIF4.mjs +1 -0
  8. package/dist/chunk-A2VQ5WK4.js +1 -0
  9. package/dist/{chunk-22TFFOQL.js → chunk-CW6SU5IY.js} +1 -1
  10. package/dist/{chunk-HOX3ZANF.mjs → chunk-H44VO62M.mjs} +1 -1
  11. package/dist/chunk-KSRZSPQR.js +1 -0
  12. package/dist/{chunk-ZX6JEZS3.mjs → chunk-L6IXM6OV.mjs} +1 -1
  13. package/dist/{chunk-T4CPHENK.js → chunk-O6LSVS7F.js} +1 -1
  14. package/dist/{chunk-Q5MDN5PA.js → chunk-QRQE2XPJ.js} +1 -1
  15. package/dist/{chunk-YPES54ON.mjs → chunk-TL3WZ5RY.mjs} +1 -1
  16. package/dist/chunk-X2JJ6KOR.mjs +1 -0
  17. package/dist/chunk-XQRQYJIE.mjs +1 -0
  18. package/dist/index.css +1 -1
  19. package/dist/index.d.mts +75 -3
  20. package/dist/index.d.ts +75 -3
  21. package/dist/index.js +2 -2
  22. package/dist/index.mjs +2 -2
  23. package/dist/input/index.css +1 -1
  24. package/dist/input/index.d.mts +6 -0
  25. package/dist/input/index.d.ts +6 -0
  26. package/dist/input/index.js +1 -1
  27. package/dist/input/index.mjs +1 -1
  28. package/dist/popover/index.css +1 -1
  29. package/dist/popover/index.d.mts +15 -0
  30. package/dist/popover/index.d.ts +15 -0
  31. package/dist/popover/index.js +1 -1
  32. package/dist/popover/index.mjs +1 -1
  33. package/dist/switch/index.css +1 -1
  34. package/dist/switch/index.js +1 -1
  35. package/dist/switch/index.mjs +1 -1
  36. package/dist/tabs/index.css +1 -1
  37. package/dist/tabs/index.js +1 -1
  38. package/dist/tabs/index.mjs +1 -1
  39. package/dist/toast/index.js +1 -1
  40. package/dist/toast/index.mjs +1 -1
  41. package/dist/tree/index.js +1 -1
  42. package/dist/tree/index.mjs +1 -1
  43. package/package.json +2 -1
  44. package/skill/AGENTS-SNIPPET.md +3 -2
  45. package/skill/SKILL.md +6 -5
  46. package/skill/VERSION.json +5 -5
  47. package/skill/references/components/dropdown.md +4 -0
  48. package/skill/references/components/infinite-scroll.md +74 -0
  49. package/skill/references/components/input.md +1 -0
  50. package/skill/references/components/popover.md +1 -0
  51. package/skill/references/components/tooltip.md +0 -1
  52. package/skill/references/icons.md +5 -2
  53. package/skill/references/setup.md +1 -1
  54. package/skill/references/tokens.md +1 -1
  55. package/dist/chunk-CB2FRG23.js +0 -1
  56. package/dist/chunk-CGHN44HV.mjs +0 -1
  57. package/dist/chunk-ITHSP4P3.js +0 -1
  58. package/dist/chunk-URZBMGD4.js +0 -1
  59. package/dist/chunk-VDUTBGPN.mjs +0 -1
  60. package/dist/chunk-YNDT7LQA.mjs +0 -1
@@ -82,6 +82,7 @@ export default function BasicDemo() {
82
82
  | `alignOffset` | 对齐方向偏移(px) | `number` | `0` |
83
83
  | `collisionPadding` | 碰撞边界内边距(px),防止浮层贴边 | `number` | `8` |
84
84
  | `container` | 挂载容器;传 `null` 则不使用 Portal | `HTMLElement \| null` | `document.body` |
85
+ | `hideWhenDetached` | 锚点不可见时自动隐藏面板 | `boolean` | `true` |
85
86
  | `style.maxHeight` | 覆盖面板高度上限 | `number \| string` | `346` |
86
87
  | `footer` | 固定底部内容(不随列表滚动) | `ReactNode` | - |
87
88
  | `children` | 子菜单内容 | `ReactNode` | - |
@@ -113,6 +114,7 @@ export default function BasicDemo() {
113
114
  | `alignOffset` | 对齐方向偏移(px) | `number` | `0` |
114
115
  | `collisionPadding` | 碰撞边界内边距(px),防止浮层贴边 | `number` | `8` |
115
116
  | `container` | 挂载容器;传 `null` 则不使用 Portal | `HTMLElement \| null` | `document.body` |
117
+ | `hideWhenDetached` | 锚点不可见时自动隐藏面板,见下方说明 | `boolean` | `true` |
116
118
  | `onEscapeKeyDown` | Escape 按下回调,可 `preventDefault` 阻止关闭 | `(event: KeyboardEvent) => void` | - |
117
119
  | `onPointerDownOutside` | 点击外部回调,可 `preventDefault` 阻止关闭 | `(event: CustomEvent) => void` | - |
118
120
  | `onInteractOutside` | 外部交互回调(pointerDown + focus 的合集) | `(event: CustomEvent) => void` | - |
@@ -120,6 +122,8 @@ export default function BasicDemo() {
120
122
 
121
123
  打开面板时的焦点落点默认按最近一次输入方式自动判断:键盘(Enter / Space / Tab / 方向键)打开聚焦第一项,鼠标点击打开则把焦点留在菜单容器上。这样鼠标用户不会看到第一项自带 hover 态,键盘用户仍能看到焦点位置。仅在需要强制某一种行为时才传 `autoFocusFirstItem`。
122
124
 
125
+ 面板 portal 到 `document.body`,与触发器不在同一棵 DOM 子树,因此触发器被隐藏时面板不会跟着消失。触发器祖先一旦 `display: none`(keep-alive 路由切走只隐藏不卸载就属于这种),它的 `getBoundingClientRect()` 退化为全 0,定位重算后面板会跑到视口左上角。`hideWhenDetached` 默认 `true` 会在触发器不可见时给面板加 `visibility: hidden` + `pointer-events: none`,开合状态不变。子菜单的锚点是父面板里的 `DropdownSubTrigger`,父面板错位时子菜单一并跟随,因此这条对多级菜单同样有效。
126
+
123
127
  ### DropdownItem
124
128
 
125
129
  | 属性 | 说明 | 类型 | 默认值 |
@@ -0,0 +1,74 @@
1
+ # InfiniteScroll 无限滚动
2
+
3
+ 列表滚动到底部自动加载下一页,内置并发去重、首屏续拉与失败熔断
4
+
5
+ - 导入:`import { InfiniteScroll } from "lingee-ui";`
6
+ - 可用类型:`InfiniteScrollProps`, `InfiniteScrollTarget`
7
+
8
+ ## 最小示例
9
+
10
+ ```tsx
11
+ import { useState } from "react";
12
+ import { InfiniteScroll, ScrollArea } from "lingee-ui";
13
+
14
+ /** 模拟分页请求 */
15
+ function fetchPage(page: number): Promise<string[]> {
16
+ return new Promise((resolve) => {
17
+ setTimeout(() => {
18
+ resolve(Array.from({ length: 10 }, (_, i) => `Item ${page * 10 + i + 1}`));
19
+ }, 600);
20
+ });
21
+ }
22
+
23
+ const TOTAL_PAGES = 3;
24
+
25
+ export default function Basic() {
26
+ const [items, setItems] = useState<string[]>([]);
27
+ const [page, setPage] = useState(0);
28
+
29
+ const hasMore = page < TOTAL_PAGES;
30
+
31
+ const loadMore = async () => {
32
+ const next = await fetchPage(page);
33
+ setItems((prev) => [...prev, ...next]);
34
+ setPage((prev) => prev + 1);
35
+ };
36
+
37
+ return (
38
+ <ScrollArea fill style={{ height: 240 }}>
39
+ <div style={{ display: "flex", flexDirection: "column", gap: 8, padding: 12 }}>
40
+ {items.map((item) => (
41
+ <div
42
+ key={item}
43
+ style={{
44
+ padding: "8px 12px",
45
+ borderRadius: 8,
46
+ background: "var(--lg-g-bg-color-black-faint)",
47
+ color: "var(--lg-g-fg-color-black-strong)",
48
+ }}
49
+ >
50
+ {item}
51
+ </div>
52
+ ))}
53
+ <InfiniteScroll loadMore={loadMore} hasMore={hasMore} />
54
+ </div>
55
+ </ScrollArea>
56
+ );
57
+ }
58
+ ```
59
+
60
+ ## API
61
+
62
+ 继承 `HTMLAttributes<HTMLDivElement>`(不含 `children`)。
63
+
64
+ | 属性 | 说明 | 类型 | 默认值 |
65
+ |------|------|------|--------|
66
+ | loadMore | 加载下一页,必须返回 Promise。`isRetry` 为 true 表示由用户点击重试触发 | `(isRetry: boolean) => Promise<void>` | — |
67
+ | hasMore | 是否还有更多数据,为 false 时停止观测并渲染「没有更多」态 | `boolean` | — |
68
+ | threshold | 距容器底部多少像素时触发 | `number` | `80` |
69
+ | scrollTarget | 显式指定滚动容器,缺省自动查找最近可滚动祖先 | `HTMLElement \| Window \| null \| (() => HTMLElement \| Window \| null)` | — |
70
+ | loading | 加载中的自定义内容,传 `null` 则不渲染 | `ReactNode` | `Empty.Card` inline 加载态 |
71
+ | noMore | 无更多数据时的自定义内容,传 `null` 则不渲染 | `ReactNode` | `Empty.Card` inline 空态 |
72
+ | error | 加载失败时的自定义内容,函数形态可拿到重试句柄 | `ReactNode \| ((retry: () => void) => ReactNode)` | `Empty.Card` inline 错误态 + 重试 |
73
+ | className | 自定义类名 | `string` | — |
74
+ | style | 自定义行内样式 | `CSSProperties` | — |
@@ -27,6 +27,7 @@ export default function BasicDemo() {
27
27
  | `error` | 错误状态 | `boolean` | `false` |
28
28
  | `disabled` | 禁用状态 | `boolean` | `false` |
29
29
  | `collapsed` | 折叠为正方形,仅展示单个插槽;受控,展开时机由 `onClick` 自行处理 | `boolean` | `false` |
30
+ | `autoFocusOnExpand` | 折叠切换为展开时是否自动聚焦;布局驱动展开的场景传 `false` 自行控制聚焦时机 | `boolean` | `true` |
30
31
  | `onPressEnter` | 按下 Enter 键回调 | `(e: KeyboardEvent) => void` | - |
31
32
  | `placeholder` | 占位提示文字 | `string` | - |
32
33
  | `value` | 输入值(受控) | `string` | - |
@@ -49,6 +49,7 @@ export default function BasicDemo() {
49
49
  | `sideOffset` | 弹出层与触发器的间距(px) | `number` | `4` |
50
50
  | `alignOffset` | 沿对齐轴的偏移(px) | `number` | `0` |
51
51
  | `collisionPadding` | 与碰撞边界的最小距离(px) | `number` | `8` |
52
+ | `hideWhenDetached` | 锚点不可见时自动隐藏浮层,见下方说明 | `boolean` | `true` |
52
53
  | `container` | Portal 挂载容器;传 `null` 时就地渲染 | `HTMLElement \| null` | `document.body` |
53
54
  | `className` | 自定义类名;使用 `lg-popover--card` 启用标准卡片外观 | `string` | - |
54
55
  | `onEscapeKeyDown` | Escape 按下回调,可 `preventDefault` 阻止关闭 | `(event: KeyboardEvent) => void` | - |
@@ -36,7 +36,6 @@ export default function BasicDemo() {
36
36
  | `defaultOpen` | 非受控默认打开状态 | `boolean` | `false` |
37
37
  | `onOpenChange` | 开关变化回调 | `(open: boolean) => void` | - |
38
38
  | `container` | 挂载容器;传 `null` 则不使用 Portal(就地渲染) | `HTMLElement \| null` | `document.body` |
39
-
40
39
  | `children` | 触发元素 | `ReactNode` | - |
41
40
 
42
41
  :::tip
@@ -1,6 +1,6 @@
1
1
  # 图标索引
2
2
 
3
- 图标库 `1.0.20`,共 987 个图标、27 个分类。图标名为 PascalCase,直接作为 React 组件名从 `lingee-icon` 导入。
3
+ 图标库 `1.0.21`,共 990 个图标、27 个分类。图标名为 PascalCase,直接作为 React 组件名从 `lingee-icon` 导入。
4
4
 
5
5
  ```tsx
6
6
  import { Search } from "lingee-icon";
@@ -263,7 +263,7 @@ import { Search } from "lingee-icon";
263
263
  | ZoomInBold | 放大(粗体) |
264
264
  | ZoomOutBold | 缩小(粗体) |
265
265
 
266
- ## 数据类(34)
266
+ ## 数据类(37)
267
267
 
268
268
  | 图标名 | 语义/用途 |
269
269
  |--------|----------|
@@ -283,6 +283,7 @@ import { Search } from "lingee-icon";
283
283
  | DataMonitoring | 数据监控 |
284
284
  | DataOrigin | 数据源/原始数据表 |
285
285
  | DataRow | 数据行/按行拆分 |
286
+ | DateCount | 日期汇总/日期统计(日历∑) |
286
287
  | Dynamics | 动态 |
287
288
  | Fall | 下跌 |
288
289
  | GraphDown | 趋势下降 |
@@ -299,8 +300,10 @@ import { Search } from "lingee-icon";
299
300
  | RadarChart | 雷达图 |
300
301
  | Rise | 上涨 |
301
302
  | Sigma | 求和/合计/汇总(∑) |
303
+ | TextCount | 文本汇总/文本统计(T∑) |
302
304
  | Thought | 思维 |
303
305
  | UnionAll | 全量合并/并集(Union All) |
306
+ | ValueCount | 数值汇总/数值统计(#∑) |
304
307
 
305
308
  ## AI类(76)
306
309
 
@@ -1,6 +1,6 @@
1
1
  # 接入指南
2
2
 
3
- 组件库 `0.0.16` | 图标库 `1.0.20`
3
+ 组件库 `0.0.18` | 图标库 `1.0.21`
4
4
 
5
5
  ## 安装
6
6
 
@@ -1,6 +1,6 @@
1
1
  # 语义 Token 全表
2
2
 
3
- 组件库 `0.0.16`。仅列语义层(`--lg-g-*`)。
3
+ 组件库 `0.0.18`。仅列语义层(`--lg-g-*`)。
4
4
 
5
5
  亮色与暗色**变量名完全相同**,给 `<html>` 加 `data-theme="dark"` 即自动切换,业务代码只写一次。
6
6
 
@@ -1 +0,0 @@
1
- 'use strict';var chunkP427AFIE_js=require('./chunk-P427AFIE.js'),chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),ze=require('react'),sonner=require('sonner'),lingeeIcon=require('lingee-icon'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ze__default=/*#__PURE__*/_interopDefault(ze);var ce={locale:"zh-CN",Button:{},Breadcrumb:{more:"\u66F4\u591A",back:"\u8FD4\u56DE"},Select:{loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",loadFailed:"\u52A0\u8F7D\u5931\u8D25",notFound:"\u641C\u7D22\u65E0\u7ED3\u679C",clear:"\u6E05\u7A7A"},Dropdown:{clear:"\u6E05\u9664",loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",empty:"\u6682\u65E0\u6570\u636E"},Tabs:{scrollLeft:"\u5411\u5DE6\u6EDA\u52A8",scrollRight:"\u5411\u53F3\u6EDA\u52A8"},Carousel:{carousel:"\u8F6E\u64AD",prev:"\u4E0A\u4E00\u5F20",next:"\u4E0B\u4E00\u5F20",goToPage:"\u8DF3\u8F6C\u5230\u7B2C {page} \u5F20"},Form:{required:"{label}\u4E0D\u80FD\u4E3A\u7A7A",requiredNoLabel:"\u6B64\u9879\u4E0D\u80FD\u4E3A\u7A7A"},Tag:{close:"\u5173\u95ED"},Upload:{retry:"\u91CD\u65B0\u4E0A\u4F20",remove:"\u79FB\u9664\u6587\u4EF6",removeShort:"\u79FB\u9664",dragText:"\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216",clickUpload:"\u70B9\u51FB\u4E0A\u4F20"},ColorPicker:{placeholder:"\u8BF7\u9009\u62E9\u989C\u8272"},DatePicker:{placeholder:"\u5E74/\u6708/\u65E5",today:"\u4ECA\u5929",prevYear:"\u4E0A\u4E00\u5E74",nextYear:"\u4E0B\u4E00\u5E74",prevMonth:"\u4E0A\u4E00\u6708",nextMonth:"\u4E0B\u4E00\u6708",prevDecade:"\u4E0A\u4E00\u7EC4\u5E74\u4EFD",nextDecade:"\u4E0B\u4E00\u7EC4\u5E74\u4EFD",months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],yearFormat:"{year}\u5E74",monthFormat:"{month}\u6708"},RangePicker:{startPlaceholder:"\u5E74/\u6708/\u65E5",endPlaceholder:"\u5E74/\u6708/\u65E5"},TimePicker:{now:"\u73B0\u5728",confirm:"\u786E\u5B9A",placeholder:"\u65F6:\u5206",placeholderFull:"\u65F6:\u5206:\u79D2"},Table:{loading:"\u52A0\u8F7D\u4E2D",empty:"\u6682\u65E0\u6570\u636E",loadError:"\u52A0\u8F7D\u5931\u8D25"},Tree:{empty:"\u6682\u65E0\u6570\u636E"},Pagination:{total:"\u5171 {total} \u6761",prevPage:"\u4E0A\u4E00\u9875",nextPage:"\u4E0B\u4E00\u9875",itemsPerPage:"{size}\u6761/\u9875",jumpTo:"\u8DF3\u81F3",page:"\u9875"},Dialog:{close:"\u5173\u95ED"},Drawer:{close:"\u5173\u95ED"},Input:{clear:"\u6E05\u7A7A",expand:"\u5C55\u5F00\u8F93\u5165\u6846"},Alert:{close:"\u5173\u95ED"},Toast:{close:"\u5173\u95ED\u6D88\u606F"},Spin:{loading:"\u52A0\u8F7D\u4E2D"},Empty:{retry:"\u91CD\u8BD5"},Sidebar:{expand:"\u5C55\u5F00",collapse:"\u6536\u8D77",loading:"\u52A0\u8F7D\u4E2D",empty:"\u6682\u65E0\u6570\u636E",loadError:"\u52A0\u8F7D\u5931\u8D25"}},v=ce;var _=new Map,F=0;function A(){return F+=1,{id:F}}function z(e,o,t){_.set(e.id,{site:o,depth:t});}function Y(e){_.delete(e.id);}function pe(){let e;for(let o of _.values())(!e||o.depth>=e.depth)&&(e=o);return e?.site}function E(){return pe()==="lingee"}var U={dialog:{}},h=ze.createContext(U),D=new Map,B=0;function G(){return B+=1,{id:B}}function q(e,o,t){D.set(e.id,{config:o,depth:t});}function j(e){D.delete(e.id);}function ge(){let e;for(let o of D.values())(!e||o.depth>=e.depth)&&(e=o);return e?.config??U}function me(){return ze.useContext(h)}var Te={locale:"en-US",Button:{},Breadcrumb:{more:"More",back:"Back"},Select:{loading:"Loading",loadError:"Failed to load, please retry",loadFailed:"Failed to load",notFound:"No results found",clear:"Clear"},Dropdown:{clear:"Clear",loading:"Loading",loadError:"Failed to load, please retry",empty:"No data"},Tabs:{scrollLeft:"Scroll left",scrollRight:"Scroll right"},Carousel:{carousel:"Carousel",prev:"Previous slide",next:"Next slide",goToPage:"Go to slide {page}"},Form:{required:"{label} is required",requiredNoLabel:"This field is required"},Tag:{close:"Close"},Upload:{retry:"Retry upload",remove:"Remove file",removeShort:"Remove",dragText:"Drag files here, or ",clickUpload:"click to upload"},ColorPicker:{placeholder:"Select a color"},DatePicker:{placeholder:"YYYY/MM/DD",today:"Today",prevYear:"Previous year",nextYear:"Next year",prevMonth:"Previous month",nextMonth:"Next month",prevDecade:"Previous decade",nextDecade:"Next decade",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yearFormat:"{year}",monthFormat:"{month}"},RangePicker:{startPlaceholder:"Start date",endPlaceholder:"End date"},TimePicker:{now:"Now",confirm:"OK",placeholder:"HH:mm",placeholderFull:"HH:mm:ss"},Table:{loading:"Loading",empty:"No data",loadError:"Failed to load"},Tree:{empty:"No data"},Pagination:{total:"{total} items",prevPage:"Previous page",nextPage:"Next page",itemsPerPage:"{size} / page",jumpTo:"Go to",page:""},Dialog:{close:"Close"},Drawer:{close:"Close"},Input:{clear:"Clear",expand:"Expand input"},Alert:{close:"Close"},Toast:{close:"Close message"},Spin:{loading:"Loading"},Empty:{retry:"Retry"},Sidebar:{expand:"Expand",collapse:"Collapse",loading:"Loading",empty:"No data",loadError:"Failed to load"}},xe=Te;var V=ze.createContext(v),Z=ze.createContext(void 0),X=ze.createContext(-1);function ve({locale:e=v,site:o,dialog:t,children:n}){let r=ze.useContext(X)+1,a=ze.useContext(h),i=t?.zIndex,s=a.dialog.zIndex,l=ze.useMemo(()=>({dialog:{zIndex:i??s}}),[i,s]),c=ze.useRef();c.current||(c.current=A());let p=c.current,g=ze.useRef();g.current||(g.current=G());let m=g.current;z(p,o,r),q(m,l,r),ze.useEffect(()=>()=>{Y(p),j(m);},[m,p]);let d=jsxRuntime.jsx(X.Provider,{value:r,children:jsxRuntime.jsx(h.Provider,{value:l,children:jsxRuntime.jsx(Z.Provider,{value:o,children:jsxRuntime.jsxs(V.Provider,{value:e,children:[n,r===0&&jsxRuntime.jsx(J,{})]})})})});return r===0?jsxRuntime.jsx(chunkP427AFIE_js.c,{children:d}):d}ve.displayName="LingeeProvider";function he(){return ze.useContext(V)}function W(e){return he()[e]}function oo(){return ze.useContext(Z)}var _e={info:jsxRuntime.jsx(lingeeIcon.ExclamationCircleFill,{size:20}),success:jsxRuntime.jsx(lingeeIcon.CheckCircleFill,{size:20}),warning:jsxRuntime.jsx(lingeeIcon.ExclamationCircleFill1,{size:20}),error:jsxRuntime.jsx(lingeeIcon.XCircleFill,{size:20})};function $({type:e,content:o,icon:t,closable:n,className:r,onClose:a}){let i=W("Toast"),s=()=>{if(t===null)return null;let l=t!==void 0?t:_e[e];return jsxRuntime.jsx("span",{className:"lg-toast__icon",children:l})};return jsxRuntime.jsxs("div",{className:chunkDCDWEVW4_js.a("lg-toast",`lg-toast--${e}`,r),children:[s(),jsxRuntime.jsx("span",{className:"lg-toast__content",children:o}),n&&jsxRuntime.jsx("button",{className:"lg-toast__close",onClick:a,"aria-label":i.close,type:"button",children:jsxRuntime.jsx(lingeeIcon.XLg,{size:16})})]})}var ee="lingee-web-bridge",oe="1.0.0",De="host",Ne="iframe",Re="lingee-web-bridge:host-toast-show",He="lingee-web-bridge:host-toast-dismiss",Ie="lingee-web-bridge:host-toast-probe",Me="lingee-web-bridge:host-toast-ready";function te(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=Date.now();return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{let t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(o==="x"?t:t&3|8).toString(16)})}function Oe(e,o){return {_protocol:ee,_version:oe,_source:e,_nonce:te(),_traceId:"",payload:o}}function Fe(e,o){if(typeof e!="object"||e===null)return false;let t=e;return t._protocol===ee&&t._version===oe&&t._source===o&&typeof t._nonce=="string"&&"payload"in t}function y(){return typeof window<"u"&&window.parent!==window}var C=false,f=new Map,Q=false;function Ae(e){if(!Fe(e,De))return false;let o=e.payload;return !!o&&typeof o=="object"&&o.type===Me}function R(e){window.parent.postMessage(Oe(Ne,e),"*");}function w(){Q||!y()||(Q=true,window.addEventListener("message",e=>{e.source===window.parent&&Ae(e.data)&&(C=true);}),window.addEventListener("pagehide",()=>{!C||f.size===0||k();}),R({type:Ie}));}function H(){return w(),C}function ne(e){if(w(),!C||!e.content)return null;let o=te();R({type:Re,toastId:o,content:e.content.slice(0,500),level:e.level,duration:e.duration,key:e.key});let t=e.duration??3e3,n=t>0?window.setTimeout(()=>f.delete(o),t+500):void 0;return f.set(o,n),o}function k(e){if(w(),!!C){if(e){let o=f.get(e);o!==void 0&&window.clearTimeout(o),f.delete(e);}else f.forEach(o=>{o!==void 0&&window.clearTimeout(o);}),f.clear();R({type:He,toastId:e});}}w();function I(){if(!(typeof window>"u"))return window.lingeeBridge}function re(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e)}function ie(e,o={}){return !(!(y()?H():E()&&typeof I()?.showToast=="function")||re(e.content)===void 0||e.icon!==void 0||e.className!==void 0||e.closable||o.getContainer!==void 0||o.top!==void 0||o.maxCount!==void 0)}function ae(e,o,t,n={}){let r=re(o.content);if(r===void 0)return null;let a={level:e,content:r,duration:t,key:o.key};if(y()){let d=ne(a);return d?(n.onAccepted?.(),{dismiss:()=>k(d)}):null}let i=I(),s=i?.showToast;if(!s)return null;let l=null,c=null,p=false,g=false,m=()=>{p||g||c||(c=n.onFallback?.()??null);};return Promise.resolve().then(()=>s(a)).then(d=>{if(!d?.ok||!d.toastId){m();return}if(g=true,l=d.toastId,p){i?.dismissToast?.(l);return}n.onAccepted?.();}).catch(d=>{console.error("[lingee-ui] showToast failed:",d),m();}),{dismiss:()=>{if(!p){if(p=true,c){c(),c=null;return}l&&i?.dismissToast?.(l);}}}}function se(){if(y())return H()?(k(),true):false;let e=I();return !E()||typeof e?.dismissToast!="function"?false:(e.dismissToast().catch(o=>{console.error("[lingee-ui] dismissToast failed:",o);}),true)}var T={};function J(){let e=T.top??16;return jsxRuntime.jsx(sonner.Toaster,{position:"top-center",offset:e,gap:8,closeButton:false,toastOptions:{unstyled:true,className:"lg-toast-wrapper"},style:{"--width":"560px"}})}function Be(e){let o=e[0];return typeof o=="object"&&o!==null&&!ze__default.default.isValidElement(o)?o:{content:o,duration:e[1],onClose:e[2]}}function le(e,o,t,n=()=>o.onClose?.()){let r=t===0?1/0:t,a=false,i=()=>{a||(a=true,n());},s=sonner.toast.custom(l=>jsxRuntime.jsx($,{type:e,content:o.content,icon:o.icon,closable:o.closable,className:o.className,onClose:()=>sonner.toast.dismiss(l)}),{...o.key!==void 0&&{id:o.key},duration:r,onAutoClose:i,onDismiss:i});return ()=>{sonner.toast.dismiss(s),i();}}var L=new Set;function Ue(e,o){let t=o.duration!==void 0?o.duration<0?T.duration??3e3:o.duration:T.duration??3e3;if(ie(o,T)){let n=false,r,a=()=>{},i=()=>{n||(n=true,r!==void 0&&clearTimeout(r),L.delete(a),o.onClose?.());},s=ae(e,o,t,{onAccepted:()=>{t>0&&!n&&(r=setTimeout(i,t));},onFallback:()=>le(e,{...o,onClose:void 0},t,i)});if(s)return a=()=>{n||(s.dismiss(),i());},L.add(a),a}return le(e,o,t)}function S(e){return (...o)=>{let t=Be(o);return Ue(e,t)}}var ko={info:S("info"),success:S("success"),warning:S("warning"),error:S("error"),destroy:()=>{Array.from(L).forEach(e=>e()),L.clear(),se(),sonner.toast.dismiss();},config:e=>{T={...T,...e};}};exports.a=E;exports.b=J;exports.c=ko;exports.d=v;exports.e=ge;exports.f=me;exports.g=xe;exports.h=ve;exports.i=he;exports.j=W;exports.k=oo;
@@ -1 +0,0 @@
1
- import {j}from'./chunk-YNDT7LQA.mjs';import {a}from'./chunk-DN2VKVCV.mjs';import G,{useState,useRef,useCallback,useEffect}from'react';import {XCircleFill}from'lingee-icon';import {jsxs,jsx}from'react/jsx-runtime';var U=G.forwardRef(({className:l,style:o,size:a$1="md",shape:M="default",prefix:d,suffix:s,allowClear:T=false,error:C=false,disabled:r=false,collapsed:t=false,value:g,defaultValue:L,onChange:c,onFocus:_,onBlur:f,onPressEnter:v,onKeyDown:h,onClick:b,...H},S)=>{let m=j("Input"),[N,x]=useState(false),[D,y]=useState(L?.toString()??""),e=useRef(null),F=Y(S,e),u=g!==void 0,w=u?g?.toString()??"":D,O=useCallback(n=>{u||y(n.target.value),c?.(n);},[u,c]),P=useCallback(()=>{if(r)return;u||y("");let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(e.current&&n){n.call(e.current,"");let A=new Event("input",{bubbles:true});e.current.dispatchEvent(A);}e.current?.focus();},[r,u]),V=useCallback(n=>{x(true),_?.(n);},[_]),j$1=useCallback(n=>{x(false),f?.(n);},[f]),B=useCallback(n=>{n.key==="Enter"&&v?.(n),h?.(n);},[v,h]),K=T&&w.length>0&&!r&&!t,W=!!s&&!(t&&d),k=useRef(t);useEffect(()=>{let n=k.current;k.current=t,n!==t&&(t?e.current===document.activeElement&&e.current?.blur():r||e.current?.focus());},[t,r]);let X=useCallback(n=>{t||e.current?.focus(),b?.(n);},[t,b]),$=a("lg-input",`lg-input--${a$1}`,M==="round"&&"lg-input--round",N&&!t&&"lg-input--focused",C&&"lg-input--error",r&&"lg-input--disabled",t&&"lg-input--collapsed",l),q=t?{...o,width:void 0,minWidth:void 0,maxWidth:void 0}:o;return jsxs("div",{className:$,style:q,onClick:X,role:t?"button":void 0,tabIndex:t&&!r?0:void 0,"aria-expanded":t?false:void 0,"aria-label":t?m.expand:void 0,children:[d&&jsx("span",{className:"lg-input__prefix",children:d}),jsx("input",{ref:F,className:"lg-input__inner",disabled:r,value:w,onChange:O,onFocus:V,onBlur:j$1,onKeyDown:B,tabIndex:t?-1:void 0,"aria-hidden":t||void 0,...H}),K&&jsx("span",{className:"lg-input__clear",onMouseDown:n=>n.preventDefault(),onClick:P,role:"button","aria-label":m.clear,children:jsx(XCircleFill,{})}),W&&jsx("span",{className:"lg-input__suffix",children:s})]})});U.displayName="Input";function Y(...l){return useCallback(o=>{l.forEach(a=>{a&&(typeof a=="function"?a(o):a.current=o);});},l)}export{U as a};
@@ -1 +0,0 @@
1
- 'use strict';var chunkCB2FRG23_js=require('./chunk-CB2FRG23.js'),chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),G=require('react'),lingeeIcon=require('lingee-icon'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var G__default=/*#__PURE__*/_interopDefault(G);var U=G__default.default.forwardRef(({className:l,style:o,size:a="md",shape:M="default",prefix:d,suffix:s,allowClear:T=false,error:C=false,disabled:r=false,collapsed:t=false,value:g,defaultValue:L,onChange:c,onFocus:_,onBlur:f,onPressEnter:v,onKeyDown:h,onClick:b,...H},S)=>{let m=chunkCB2FRG23_js.j("Input"),[N,x]=G.useState(false),[D,y]=G.useState(L?.toString()??""),e=G.useRef(null),F=Y(S,e),u=g!==void 0,w=u?g?.toString()??"":D,O=G.useCallback(n=>{u||y(n.target.value),c?.(n);},[u,c]),P=G.useCallback(()=>{if(r)return;u||y("");let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set;if(e.current&&n){n.call(e.current,"");let A=new Event("input",{bubbles:true});e.current.dispatchEvent(A);}e.current?.focus();},[r,u]),V=G.useCallback(n=>{x(true),_?.(n);},[_]),j=G.useCallback(n=>{x(false),f?.(n);},[f]),B=G.useCallback(n=>{n.key==="Enter"&&v?.(n),h?.(n);},[v,h]),K=T&&w.length>0&&!r&&!t,W=!!s&&!(t&&d),k=G.useRef(t);G.useEffect(()=>{let n=k.current;k.current=t,n!==t&&(t?e.current===document.activeElement&&e.current?.blur():r||e.current?.focus());},[t,r]);let X=G.useCallback(n=>{t||e.current?.focus(),b?.(n);},[t,b]),$=chunkDCDWEVW4_js.a("lg-input",`lg-input--${a}`,M==="round"&&"lg-input--round",N&&!t&&"lg-input--focused",C&&"lg-input--error",r&&"lg-input--disabled",t&&"lg-input--collapsed",l),q=t?{...o,width:void 0,minWidth:void 0,maxWidth:void 0}:o;return jsxRuntime.jsxs("div",{className:$,style:q,onClick:X,role:t?"button":void 0,tabIndex:t&&!r?0:void 0,"aria-expanded":t?false:void 0,"aria-label":t?m.expand:void 0,children:[d&&jsxRuntime.jsx("span",{className:"lg-input__prefix",children:d}),jsxRuntime.jsx("input",{ref:F,className:"lg-input__inner",disabled:r,value:w,onChange:O,onFocus:V,onBlur:j,onKeyDown:B,tabIndex:t?-1:void 0,"aria-hidden":t||void 0,...H}),K&&jsxRuntime.jsx("span",{className:"lg-input__clear",onMouseDown:n=>n.preventDefault(),onClick:P,role:"button","aria-label":m.clear,children:jsxRuntime.jsx(lingeeIcon.XCircleFill,{})}),W&&jsxRuntime.jsx("span",{className:"lg-input__suffix",children:s})]})});U.displayName="Input";function Y(...l){return G.useCallback(o=>{l.forEach(a=>{a&&(typeof a=="function"?a(o):a.current=o);});},l)}exports.a=U;
@@ -1 +0,0 @@
1
- 'use strict';var chunkDCDWEVW4_js=require('./chunk-DCDWEVW4.js'),o=require('react'),a=require('@radix-ui/react-popover'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var o__default=/*#__PURE__*/_interopDefault(o);var a__namespace=/*#__PURE__*/_interopNamespace(a);var A="data-lg-modality",H=false;function w(r){document.documentElement.setAttribute(A,r);}function F(){return typeof document>"u"?false:document.documentElement.getAttribute(A)==="keyboard"}function L(){H||typeof document>"u"||(H=true,document.documentElement.hasAttribute(A)||w("keyboard"),document.addEventListener("pointerdown",()=>w("pointer"),true),document.addEventListener("keydown",r=>{(r.key==="Enter"||r.key===" "||r.key==="Tab"||r.key.startsWith("Arrow"))&&w("keyboard");},true));}var E=o__default.default.createContext(null);function M(r,t,n,i,s){let d=o__default.default.useRef(),u=o__default.default.useRef(i);u.current=i;let f=o__default.default.useRef(s);f.current=s;let p=o__default.default.useCallback(()=>{clearTimeout(d.current),d.current=void 0;},[]);return o__default.default.useEffect(()=>p,[r,t,n,p]),o__default.default.useMemo(()=>{if(!r)return null;let l=(e,P)=>{p(),d.current=setTimeout(()=>{d.current=void 0,u.current(e);},P);};return {onPointerEnter:()=>l(true,t),onPointerLeave:()=>l(false,n),onTriggerClick:e=>{p(),f.current(e);}}},[r,t,n,p])}function B({children:r,open:t,defaultOpen:n,onOpenChange:i,modal:s=false,trigger:d="click",mouseEnterDelay:u=100,mouseLeaveDelay:f=100}){o__default.default.useEffect(()=>{L();},[]);let[p,l]=o__default.default.useState(n??false),e=t!==void 0,P=e?t:p,b=o__default.default.useRef(false),y=o__default.default.useRef(false),h=o__default.default.useCallback(c=>{if(b.current){b.current=false;return}e||l(c),i?.(c);},[e,i]),x=o__default.default.useCallback(c=>{y.current=c,h(c);},[h]),k=o__default.default.useCallback(c=>{b.current=c==="mouse",c==="fallback"&&(y.current=false);},[]),C=M(d==="hover",u,f,x,k),R=o__default.default.useMemo(()=>C?{...C,shouldPreventAutoFocus:()=>y.current}:null,[C]),g=jsxRuntime.jsx(a__namespace.Root,{open:P,onOpenChange:h,modal:s,children:r});return jsxRuntime.jsx(E.Provider,{value:R,children:g})}B.displayName="Popover";var O=o__default.default.forwardRef(({children:r,asChild:t=true,onPointerEnter:n,onPointerLeave:i,onPointerDown:s,onClick:d,...u},f)=>{let p=o__default.default.useContext(E),l=o__default.default.useRef(null);return jsxRuntime.jsx(a__namespace.Trigger,{ref:f,asChild:t,onPointerEnter:e=>{n?.(e),(!e.pointerType||e.pointerType==="mouse")&&p?.onPointerEnter();},onPointerLeave:e=>{i?.(e),(!e.pointerType||e.pointerType==="mouse")&&p?.onPointerLeave();},onPointerDown:e=>{l.current=e.pointerType,s?.(e);},onClick:e=>{if(d?.(e),e.defaultPrevented){l.current=null;return}let P=e.detail>0&&l.current==="mouse"?"mouse":"fallback";p?.onTriggerClick(P),l.current=null;},...u,children:r})});O.displayName="PopoverTrigger";var _=o__default.default.forwardRef(({children:r,asChild:t=true,...n},i)=>jsxRuntime.jsx(a__namespace.Anchor,{ref:i,asChild:t,...n,children:r}));_.displayName="PopoverAnchor";var N=o__default.default.forwardRef(({children:r,className:t,side:n="bottom",align:i="center",sideOffset:s=4,alignOffset:d=0,container:u,collisionPadding:f=8,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:e,onInteractOutside:P,onOpenAutoFocus:b,onCloseAutoFocus:y,onPointerEnter:h,onPointerLeave:x,style:k,...C},R)=>{let g=o__default.default.useContext(E),c=jsxRuntime.jsx(a__namespace.Content,{ref:R,className:chunkDCDWEVW4_js.a("lg-popover",g&&"lg-popover--hover-bridge",t),style:g?{"--_popover-bridge-size":`${s+2}px`,...k}:k,onPointerEnter:v=>{h?.(v),(!v.pointerType||v.pointerType==="mouse")&&g?.onPointerEnter();},onPointerLeave:v=>{x?.(v),(!v.pointerType||v.pointerType==="mouse")&&g?.onPointerLeave();},side:n,align:i,sideOffset:s,alignOffset:d,collisionPadding:f,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:e,onInteractOutside:P,onOpenAutoFocus:b??(g?v=>{g.shouldPreventAutoFocus()&&v.preventDefault();}:void 0),onCloseAutoFocus:y,...C,children:r});return u===null?c:jsxRuntime.jsx(a__namespace.Portal,{container:u,children:c})});N.displayName="PopoverContent";var S=o__default.default.forwardRef(({className:r,width:t=10,height:n=5,...i},s)=>jsxRuntime.jsx(a__namespace.Arrow,{ref:s,className:chunkDCDWEVW4_js.a("lg-popover__arrow",r),width:t,height:n,...i}));S.displayName="PopoverArrow";var z=o__default.default.forwardRef(({children:r,asChild:t=true,...n},i)=>jsxRuntime.jsx(a__namespace.Close,{ref:i,asChild:t,...n,children:r}));z.displayName="PopoverClose";exports.a=F;exports.b=L;exports.c=B;exports.d=O;exports.e=_;exports.f=N;exports.g=S;exports.h=z;
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-DN2VKVCV.mjs';import o from'react';import*as a from'@radix-ui/react-popover';import {jsx}from'react/jsx-runtime';var A="data-lg-modality",H=false;function w(r){document.documentElement.setAttribute(A,r);}function F(){return typeof document>"u"?false:document.documentElement.getAttribute(A)==="keyboard"}function L(){H||typeof document>"u"||(H=true,document.documentElement.hasAttribute(A)||w("keyboard"),document.addEventListener("pointerdown",()=>w("pointer"),true),document.addEventListener("keydown",r=>{(r.key==="Enter"||r.key===" "||r.key==="Tab"||r.key.startsWith("Arrow"))&&w("keyboard");},true));}var E=o.createContext(null);function M(r,t,n,i,s){let d=o.useRef(),u=o.useRef(i);u.current=i;let f=o.useRef(s);f.current=s;let p=o.useCallback(()=>{clearTimeout(d.current),d.current=void 0;},[]);return o.useEffect(()=>p,[r,t,n,p]),o.useMemo(()=>{if(!r)return null;let l=(e,P)=>{p(),d.current=setTimeout(()=>{d.current=void 0,u.current(e);},P);};return {onPointerEnter:()=>l(true,t),onPointerLeave:()=>l(false,n),onTriggerClick:e=>{p(),f.current(e);}}},[r,t,n,p])}function B({children:r,open:t,defaultOpen:n,onOpenChange:i,modal:s=false,trigger:d="click",mouseEnterDelay:u=100,mouseLeaveDelay:f=100}){o.useEffect(()=>{L();},[]);let[p,l]=o.useState(n??false),e=t!==void 0,P=e?t:p,b=o.useRef(false),y=o.useRef(false),h=o.useCallback(c=>{if(b.current){b.current=false;return}e||l(c),i?.(c);},[e,i]),x=o.useCallback(c=>{y.current=c,h(c);},[h]),k=o.useCallback(c=>{b.current=c==="mouse",c==="fallback"&&(y.current=false);},[]),C=M(d==="hover",u,f,x,k),R=o.useMemo(()=>C?{...C,shouldPreventAutoFocus:()=>y.current}:null,[C]),g=jsx(a.Root,{open:P,onOpenChange:h,modal:s,children:r});return jsx(E.Provider,{value:R,children:g})}B.displayName="Popover";var O=o.forwardRef(({children:r,asChild:t=true,onPointerEnter:n,onPointerLeave:i,onPointerDown:s,onClick:d,...u},f)=>{let p=o.useContext(E),l=o.useRef(null);return jsx(a.Trigger,{ref:f,asChild:t,onPointerEnter:e=>{n?.(e),(!e.pointerType||e.pointerType==="mouse")&&p?.onPointerEnter();},onPointerLeave:e=>{i?.(e),(!e.pointerType||e.pointerType==="mouse")&&p?.onPointerLeave();},onPointerDown:e=>{l.current=e.pointerType,s?.(e);},onClick:e=>{if(d?.(e),e.defaultPrevented){l.current=null;return}let P=e.detail>0&&l.current==="mouse"?"mouse":"fallback";p?.onTriggerClick(P),l.current=null;},...u,children:r})});O.displayName="PopoverTrigger";var _=o.forwardRef(({children:r,asChild:t=true,...n},i)=>jsx(a.Anchor,{ref:i,asChild:t,...n,children:r}));_.displayName="PopoverAnchor";var N=o.forwardRef(({children:r,className:t,side:n="bottom",align:i="center",sideOffset:s=4,alignOffset:d=0,container:u,collisionPadding:f=8,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:e,onInteractOutside:P,onOpenAutoFocus:b,onCloseAutoFocus:y,onPointerEnter:h,onPointerLeave:x,style:k,...C},R)=>{let g=o.useContext(E),c=jsx(a.Content,{ref:R,className:a$1("lg-popover",g&&"lg-popover--hover-bridge",t),style:g?{"--_popover-bridge-size":`${s+2}px`,...k}:k,onPointerEnter:v=>{h?.(v),(!v.pointerType||v.pointerType==="mouse")&&g?.onPointerEnter();},onPointerLeave:v=>{x?.(v),(!v.pointerType||v.pointerType==="mouse")&&g?.onPointerLeave();},side:n,align:i,sideOffset:s,alignOffset:d,collisionPadding:f,onEscapeKeyDown:p,onPointerDownOutside:l,onFocusOutside:e,onInteractOutside:P,onOpenAutoFocus:b??(g?v=>{g.shouldPreventAutoFocus()&&v.preventDefault();}:void 0),onCloseAutoFocus:y,...C,children:r});return u===null?c:jsx(a.Portal,{container:u,children:c})});N.displayName="PopoverContent";var S=o.forwardRef(({className:r,width:t=10,height:n=5,...i},s)=>jsx(a.Arrow,{ref:s,className:a$1("lg-popover__arrow",r),width:t,height:n,...i}));S.displayName="PopoverArrow";var z=o.forwardRef(({children:r,asChild:t=true,...n},i)=>jsx(a.Close,{ref:i,asChild:t,...n,children:r}));z.displayName="PopoverClose";export{F as a,L as b,B as c,O as d,_ as e,N as f,S as g,z as h};
@@ -1 +0,0 @@
1
- import {c}from'./chunk-KXUUVDLA.mjs';import {a}from'./chunk-DN2VKVCV.mjs';import ze,{createContext,useContext,useMemo,useRef,useEffect}from'react';import {Toaster,toast}from'sonner';import {XCircleFill,ExclamationCircleFill1,CheckCircleFill,ExclamationCircleFill,XLg}from'lingee-icon';import {jsx,jsxs}from'react/jsx-runtime';var ce={locale:"zh-CN",Button:{},Breadcrumb:{more:"\u66F4\u591A",back:"\u8FD4\u56DE"},Select:{loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",loadFailed:"\u52A0\u8F7D\u5931\u8D25",notFound:"\u641C\u7D22\u65E0\u7ED3\u679C",clear:"\u6E05\u7A7A"},Dropdown:{clear:"\u6E05\u9664",loading:"\u52A0\u8F7D\u4E2D",loadError:"\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",empty:"\u6682\u65E0\u6570\u636E"},Tabs:{scrollLeft:"\u5411\u5DE6\u6EDA\u52A8",scrollRight:"\u5411\u53F3\u6EDA\u52A8"},Carousel:{carousel:"\u8F6E\u64AD",prev:"\u4E0A\u4E00\u5F20",next:"\u4E0B\u4E00\u5F20",goToPage:"\u8DF3\u8F6C\u5230\u7B2C {page} \u5F20"},Form:{required:"{label}\u4E0D\u80FD\u4E3A\u7A7A",requiredNoLabel:"\u6B64\u9879\u4E0D\u80FD\u4E3A\u7A7A"},Tag:{close:"\u5173\u95ED"},Upload:{retry:"\u91CD\u65B0\u4E0A\u4F20",remove:"\u79FB\u9664\u6587\u4EF6",removeShort:"\u79FB\u9664",dragText:"\u62D6\u62FD\u6587\u4EF6\u5230\u6B64\u5904\uFF0C\u6216",clickUpload:"\u70B9\u51FB\u4E0A\u4F20"},ColorPicker:{placeholder:"\u8BF7\u9009\u62E9\u989C\u8272"},DatePicker:{placeholder:"\u5E74/\u6708/\u65E5",today:"\u4ECA\u5929",prevYear:"\u4E0A\u4E00\u5E74",nextYear:"\u4E0B\u4E00\u5E74",prevMonth:"\u4E0A\u4E00\u6708",nextMonth:"\u4E0B\u4E00\u6708",prevDecade:"\u4E0A\u4E00\u7EC4\u5E74\u4EFD",nextDecade:"\u4E0B\u4E00\u7EC4\u5E74\u4EFD",months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],yearFormat:"{year}\u5E74",monthFormat:"{month}\u6708"},RangePicker:{startPlaceholder:"\u5E74/\u6708/\u65E5",endPlaceholder:"\u5E74/\u6708/\u65E5"},TimePicker:{now:"\u73B0\u5728",confirm:"\u786E\u5B9A",placeholder:"\u65F6:\u5206",placeholderFull:"\u65F6:\u5206:\u79D2"},Table:{loading:"\u52A0\u8F7D\u4E2D",empty:"\u6682\u65E0\u6570\u636E",loadError:"\u52A0\u8F7D\u5931\u8D25"},Tree:{empty:"\u6682\u65E0\u6570\u636E"},Pagination:{total:"\u5171 {total} \u6761",prevPage:"\u4E0A\u4E00\u9875",nextPage:"\u4E0B\u4E00\u9875",itemsPerPage:"{size}\u6761/\u9875",jumpTo:"\u8DF3\u81F3",page:"\u9875"},Dialog:{close:"\u5173\u95ED"},Drawer:{close:"\u5173\u95ED"},Input:{clear:"\u6E05\u7A7A",expand:"\u5C55\u5F00\u8F93\u5165\u6846"},Alert:{close:"\u5173\u95ED"},Toast:{close:"\u5173\u95ED\u6D88\u606F"},Spin:{loading:"\u52A0\u8F7D\u4E2D"},Empty:{retry:"\u91CD\u8BD5"},Sidebar:{expand:"\u5C55\u5F00",collapse:"\u6536\u8D77",loading:"\u52A0\u8F7D\u4E2D",empty:"\u6682\u65E0\u6570\u636E",loadError:"\u52A0\u8F7D\u5931\u8D25"}},v=ce;var _=new Map,F=0;function A(){return F+=1,{id:F}}function z(e,o,t){_.set(e.id,{site:o,depth:t});}function Y(e){_.delete(e.id);}function pe(){let e;for(let o of _.values())(!e||o.depth>=e.depth)&&(e=o);return e?.site}function E(){return pe()==="lingee"}var U={dialog:{}},h=createContext(U),D=new Map,B=0;function G(){return B+=1,{id:B}}function q(e,o,t){D.set(e.id,{config:o,depth:t});}function j(e){D.delete(e.id);}function ge(){let e;for(let o of D.values())(!e||o.depth>=e.depth)&&(e=o);return e?.config??U}function me(){return useContext(h)}var Te={locale:"en-US",Button:{},Breadcrumb:{more:"More",back:"Back"},Select:{loading:"Loading",loadError:"Failed to load, please retry",loadFailed:"Failed to load",notFound:"No results found",clear:"Clear"},Dropdown:{clear:"Clear",loading:"Loading",loadError:"Failed to load, please retry",empty:"No data"},Tabs:{scrollLeft:"Scroll left",scrollRight:"Scroll right"},Carousel:{carousel:"Carousel",prev:"Previous slide",next:"Next slide",goToPage:"Go to slide {page}"},Form:{required:"{label} is required",requiredNoLabel:"This field is required"},Tag:{close:"Close"},Upload:{retry:"Retry upload",remove:"Remove file",removeShort:"Remove",dragText:"Drag files here, or ",clickUpload:"click to upload"},ColorPicker:{placeholder:"Select a color"},DatePicker:{placeholder:"YYYY/MM/DD",today:"Today",prevYear:"Previous year",nextYear:"Next year",prevMonth:"Previous month",nextMonth:"Next month",prevDecade:"Previous decade",nextDecade:"Next decade",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yearFormat:"{year}",monthFormat:"{month}"},RangePicker:{startPlaceholder:"Start date",endPlaceholder:"End date"},TimePicker:{now:"Now",confirm:"OK",placeholder:"HH:mm",placeholderFull:"HH:mm:ss"},Table:{loading:"Loading",empty:"No data",loadError:"Failed to load"},Tree:{empty:"No data"},Pagination:{total:"{total} items",prevPage:"Previous page",nextPage:"Next page",itemsPerPage:"{size} / page",jumpTo:"Go to",page:""},Dialog:{close:"Close"},Drawer:{close:"Close"},Input:{clear:"Clear",expand:"Expand input"},Alert:{close:"Close"},Toast:{close:"Close message"},Spin:{loading:"Loading"},Empty:{retry:"Retry"},Sidebar:{expand:"Expand",collapse:"Collapse",loading:"Loading",empty:"No data",loadError:"Failed to load"}},xe=Te;var V=createContext(v),Z=createContext(void 0),X=createContext(-1);function ve({locale:e=v,site:o,dialog:t,children:n}){let r=useContext(X)+1,a=useContext(h),i=t?.zIndex,s=a.dialog.zIndex,l=useMemo(()=>({dialog:{zIndex:i??s}}),[i,s]),c$1=useRef();c$1.current||(c$1.current=A());let p=c$1.current,g=useRef();g.current||(g.current=G());let m=g.current;z(p,o,r),q(m,l,r),useEffect(()=>()=>{Y(p),j(m);},[m,p]);let d=jsx(X.Provider,{value:r,children:jsx(h.Provider,{value:l,children:jsx(Z.Provider,{value:o,children:jsxs(V.Provider,{value:e,children:[n,r===0&&jsx(J,{})]})})})});return r===0?jsx(c,{children:d}):d}ve.displayName="LingeeProvider";function he(){return useContext(V)}function W(e){return he()[e]}function oo(){return useContext(Z)}var _e={info:jsx(ExclamationCircleFill,{size:20}),success:jsx(CheckCircleFill,{size:20}),warning:jsx(ExclamationCircleFill1,{size:20}),error:jsx(XCircleFill,{size:20})};function $({type:e,content:o,icon:t,closable:n,className:r,onClose:a$1}){let i=W("Toast"),s=()=>{if(t===null)return null;let l=t!==void 0?t:_e[e];return jsx("span",{className:"lg-toast__icon",children:l})};return jsxs("div",{className:a("lg-toast",`lg-toast--${e}`,r),children:[s(),jsx("span",{className:"lg-toast__content",children:o}),n&&jsx("button",{className:"lg-toast__close",onClick:a$1,"aria-label":i.close,type:"button",children:jsx(XLg,{size:16})})]})}var ee="lingee-web-bridge",oe="1.0.0",De="host",Ne="iframe",Re="lingee-web-bridge:host-toast-show",He="lingee-web-bridge:host-toast-dismiss",Ie="lingee-web-bridge:host-toast-probe",Me="lingee-web-bridge:host-toast-ready";function te(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=Date.now();return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{let t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(o==="x"?t:t&3|8).toString(16)})}function Oe(e,o){return {_protocol:ee,_version:oe,_source:e,_nonce:te(),_traceId:"",payload:o}}function Fe(e,o){if(typeof e!="object"||e===null)return false;let t=e;return t._protocol===ee&&t._version===oe&&t._source===o&&typeof t._nonce=="string"&&"payload"in t}function y(){return typeof window<"u"&&window.parent!==window}var C=false,f=new Map,Q=false;function Ae(e){if(!Fe(e,De))return false;let o=e.payload;return !!o&&typeof o=="object"&&o.type===Me}function R(e){window.parent.postMessage(Oe(Ne,e),"*");}function w(){Q||!y()||(Q=true,window.addEventListener("message",e=>{e.source===window.parent&&Ae(e.data)&&(C=true);}),window.addEventListener("pagehide",()=>{!C||f.size===0||k();}),R({type:Ie}));}function H(){return w(),C}function ne(e){if(w(),!C||!e.content)return null;let o=te();R({type:Re,toastId:o,content:e.content.slice(0,500),level:e.level,duration:e.duration,key:e.key});let t=e.duration??3e3,n=t>0?window.setTimeout(()=>f.delete(o),t+500):void 0;return f.set(o,n),o}function k(e){if(w(),!!C){if(e){let o=f.get(e);o!==void 0&&window.clearTimeout(o),f.delete(e);}else f.forEach(o=>{o!==void 0&&window.clearTimeout(o);}),f.clear();R({type:He,toastId:e});}}w();function I(){if(!(typeof window>"u"))return window.lingeeBridge}function re(e){if(typeof e=="string")return e;if(typeof e=="number")return String(e)}function ie(e,o={}){return !(!(y()?H():E()&&typeof I()?.showToast=="function")||re(e.content)===void 0||e.icon!==void 0||e.className!==void 0||e.closable||o.getContainer!==void 0||o.top!==void 0||o.maxCount!==void 0)}function ae(e,o,t,n={}){let r=re(o.content);if(r===void 0)return null;let a={level:e,content:r,duration:t,key:o.key};if(y()){let d=ne(a);return d?(n.onAccepted?.(),{dismiss:()=>k(d)}):null}let i=I(),s=i?.showToast;if(!s)return null;let l=null,c=null,p=false,g=false,m=()=>{p||g||c||(c=n.onFallback?.()??null);};return Promise.resolve().then(()=>s(a)).then(d=>{if(!d?.ok||!d.toastId){m();return}if(g=true,l=d.toastId,p){i?.dismissToast?.(l);return}n.onAccepted?.();}).catch(d=>{console.error("[lingee-ui] showToast failed:",d),m();}),{dismiss:()=>{if(!p){if(p=true,c){c(),c=null;return}l&&i?.dismissToast?.(l);}}}}function se(){if(y())return H()?(k(),true):false;let e=I();return !E()||typeof e?.dismissToast!="function"?false:(e.dismissToast().catch(o=>{console.error("[lingee-ui] dismissToast failed:",o);}),true)}var T={};function J(){let e=T.top??16;return jsx(Toaster,{position:"top-center",offset:e,gap:8,closeButton:false,toastOptions:{unstyled:true,className:"lg-toast-wrapper"},style:{"--width":"560px"}})}function Be(e){let o=e[0];return typeof o=="object"&&o!==null&&!ze.isValidElement(o)?o:{content:o,duration:e[1],onClose:e[2]}}function le(e,o,t,n=()=>o.onClose?.()){let r=t===0?1/0:t,a=false,i=()=>{a||(a=true,n());},s=toast.custom(l=>jsx($,{type:e,content:o.content,icon:o.icon,closable:o.closable,className:o.className,onClose:()=>toast.dismiss(l)}),{...o.key!==void 0&&{id:o.key},duration:r,onAutoClose:i,onDismiss:i});return ()=>{toast.dismiss(s),i();}}var L=new Set;function Ue(e,o){let t=o.duration!==void 0?o.duration<0?T.duration??3e3:o.duration:T.duration??3e3;if(ie(o,T)){let n=false,r,a=()=>{},i=()=>{n||(n=true,r!==void 0&&clearTimeout(r),L.delete(a),o.onClose?.());},s=ae(e,o,t,{onAccepted:()=>{t>0&&!n&&(r=setTimeout(i,t));},onFallback:()=>le(e,{...o,onClose:void 0},t,i)});if(s)return a=()=>{n||(s.dismiss(),i());},L.add(a),a}return le(e,o,t)}function S(e){return (...o)=>{let t=Be(o);return Ue(e,t)}}var ko={info:S("info"),success:S("success"),warning:S("warning"),error:S("error"),destroy:()=>{Array.from(L).forEach(e=>e()),L.clear(),se(),toast.dismiss();},config:e=>{T={...T,...e};}};export{E as a,J as b,ko as c,v as d,ge as e,me as f,xe as g,ve as h,he as i,W as j,oo as k};