dsh-workbench-storage 0.0.0-stage → 1.5.1

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/lib/client.js ADDED
@@ -0,0 +1,4780 @@
1
+ // 由 scripts/build-addon-clients.mjs 生成;请修改对应 client/client.src.cjs 后重新构建。
2
+ window.__ModuleLoader__ = window.__ModuleLoader__ || { modules: {}, load: function (m) { this.modules[m.id] = m.factory; } };
3
+ window.__ModuleLoader__.load({
4
+ id: "dsh-workbench-storage",
5
+ factory: function (require) {
6
+ var module = { exports: {} };
7
+ var exports = module.exports;
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __esm = (fn, res, err) => function __init() {
13
+ if (err) throw err[0];
14
+ try {
15
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
+ } catch (e) {
17
+ throw err = [e], e;
18
+ }
19
+ };
20
+ var __commonJS = (cb, mod) => function __require() {
21
+ try {
22
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
23
+ } catch (e) {
24
+ throw mod = 0, e;
25
+ }
26
+ };
27
+ var __export = (target, all) => {
28
+ for (var name in all)
29
+ __defProp(target, name, { get: all[name], enumerable: true });
30
+ };
31
+ var __copyProps = (to, from, except, desc) => {
32
+ if (from && typeof from === "object" || typeof from === "function") {
33
+ for (let key of __getOwnPropNames(from))
34
+ if (!__hasOwnProp.call(to, key) && key !== except)
35
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
36
+ }
37
+ return to;
38
+ };
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
+
41
+ // packages/addons/lib/markdown.cjs
42
+ var require_markdown = __commonJS({
43
+ "packages/addons/lib/markdown.cjs"(exports2, module2) {
44
+ "use strict";
45
+ var cache = /* @__PURE__ */ new Map();
46
+ var cacheChars = 0;
47
+ function node(tag, children, props) {
48
+ return { tag, children, props: props || {} };
49
+ }
50
+ function inline(text, depth) {
51
+ if ((depth || 0) > 8) return [text];
52
+ var out = [], re = /(\\[\\\x60*\[\]#!_>+-]|!?\[[^\[\]\n]+\]\([^\s)\[\]]*\)|\x60[^\x60\n]+\x60|\*\*[^*\n]+\*\*|\*[^*\n]+\*)/g, at = 0, m;
53
+ while (m = re.exec(text)) {
54
+ if (m.index > at) out.push(text.slice(at, m.index));
55
+ var s = m[0], link = /^\[([^\]]+)\]\(([^)]*)\)$/.exec(s);
56
+ if (s[0] === "\\") out.push(s.slice(1));
57
+ else if (link && /^(https?:\/\/|mailto:)[^\s\u0000-\u001f\u007f]+$/i.test(link[2]))
58
+ out.push(node("a", inline(link[1], (depth || 0) + 1), { href: link[2], target: "_blank", rel: "noopener noreferrer nofollow" }));
59
+ else if (s[0] === "[" || s[0] === "!") out.push(s);
60
+ else if (s[0] === "`") out.push(node("code", [s.slice(1, -1)]));
61
+ else if (s.slice(0, 2) === "**") out.push(node("strong", inline(s.slice(2, -2), (depth || 0) + 1)));
62
+ else out.push(node("em", inline(s.slice(1, -1), (depth || 0) + 1)));
63
+ at = re.lastIndex;
64
+ }
65
+ if (at < text.length) out.push(text.slice(at));
66
+ return out;
67
+ }
68
+ function blocks(lines, depth) {
69
+ var out = [], i = 0;
70
+ function listMatch(s) {
71
+ return /^( *)([-+*]|\d+\.) +(.+)$/.exec(s);
72
+ }
73
+ function special(s) {
74
+ return /^\s*$|^\x60\x60\x60|^#{1,6} +|^> ?|^\s*(?:---+|\*\*\*+|___+)\s*$/.test(s) || listMatch(s);
75
+ }
76
+ while (i < lines.length) {
77
+ var line = lines[i], m;
78
+ if (!line.trim()) {
79
+ i++;
80
+ continue;
81
+ }
82
+ if (/^\x60\x60\x60/.test(line)) {
83
+ var end = i + 1;
84
+ while (end < lines.length && !/^\x60\x60\x60\s*$/.test(lines[end])) end++;
85
+ if (end === lines.length) {
86
+ out.push(node("p", [lines.slice(i).join("\n")]));
87
+ break;
88
+ }
89
+ out.push(node("pre", [node("code", [lines.slice(i + 1, end).join("\n")])]));
90
+ i = end + 1;
91
+ continue;
92
+ }
93
+ if (m = /^(#{1,6}) +(.+)$/.exec(line)) {
94
+ out.push(node("h" + m[1].length, inline(m[2])));
95
+ i++;
96
+ continue;
97
+ }
98
+ if (/^\s*(?:---+|\*\*\*+|___+)\s*$/.test(line)) {
99
+ out.push(node("hr", []));
100
+ i++;
101
+ continue;
102
+ }
103
+ if (/^> ?/.test(line) && depth < 2) {
104
+ var quote = [];
105
+ while (i < lines.length && /^> ?/.test(lines[i])) quote.push(lines[i++].replace(/^> ?/, ""));
106
+ out.push(node("blockquote", blocks(quote, depth + 1)));
107
+ continue;
108
+ }
109
+ if ((m = listMatch(line)) && depth < 2) {
110
+ var base = m[1].length, ordered = /\d/.test(m[2]), items = [], start = parseInt(m[2], 10);
111
+ while (i < lines.length) {
112
+ m = listMatch(lines[i]);
113
+ if (!m || m[1].length !== base || /\d/.test(m[2]) !== ordered) break;
114
+ var children = inline(m[3]), nested = [];
115
+ i++;
116
+ while (i < lines.length && (m = listMatch(lines[i])) && m[1].length > base) nested.push(lines[i++].slice(base + 2));
117
+ if (nested.length) children = children.concat(blocks(nested, depth + 1));
118
+ items.push(node("li", children));
119
+ }
120
+ out.push(node(ordered ? "ol" : "ul", items, ordered ? { start } : {}));
121
+ continue;
122
+ }
123
+ var paragraph = [line];
124
+ i++;
125
+ while (i < lines.length && !special(lines[i])) paragraph.push(lines[i++]);
126
+ var parts = [];
127
+ paragraph.forEach(function(s, j) {
128
+ if (j) parts.push(node("br", []));
129
+ var children2 = inline(s);
130
+ for (var k = 0; k < children2.length; k++) parts.push(children2[k]);
131
+ });
132
+ out.push(node("p", parts));
133
+ }
134
+ return out;
135
+ }
136
+ function parse(text, mode) {
137
+ text = String(text == null ? "" : text);
138
+ mode = mode === "text" ? "text" : "markdown";
139
+ var key = mode + ":" + text;
140
+ if (cache.has(key)) return cache.get(key);
141
+ var ast = mode === "text" ? [text] : blocks(text.replace(/\r\n?/g, "\n").split("\n"), 0);
142
+ if (text.length <= 1e5) {
143
+ while (cache.size >= 100 || cacheChars + key.length > 1e6) {
144
+ var first = cache.keys().next().value;
145
+ cacheChars -= first.length;
146
+ cache.delete(first);
147
+ }
148
+ cache.set(key, ast);
149
+ cacheChars += key.length;
150
+ }
151
+ return ast;
152
+ }
153
+ function createBody(React, Highlight) {
154
+ var h2 = React.createElement;
155
+ return function Body(props) {
156
+ function render(items, path) {
157
+ return items.map(function(item, i) {
158
+ var key = path + "-" + i;
159
+ if (typeof item === "string") return Highlight ? h2(Highlight, { key, text: item, keyword: props.keyword }) : item;
160
+ var attrs = Object.assign({ key }, item.props);
161
+ if (item.tag === "br" || item.tag === "hr") return h2(item.tag, attrs);
162
+ return h2(item.tag, attrs, render(item.children, key));
163
+ });
164
+ }
165
+ return h2("div", { className: props.mode === "text" ? "wb-body-text" : "wb-markdown" }, render(parse(props.text, props.mode), "md"));
166
+ };
167
+ }
168
+ module2.exports = { parse, createBody };
169
+ }
170
+ });
171
+
172
+ // packages/addons/lib/body-toggle.cjs
173
+ var require_body_toggle = __commonJS({
174
+ "packages/addons/lib/body-toggle.cjs"(exports2, module2) {
175
+ module2.exports = function(React) {
176
+ var h2 = React.createElement;
177
+ return function BodyMode(props) {
178
+ var plain = props.mode === "text", t = props.t;
179
+ var label = t.bodyModeToggle.replace("{field}", props.label).replace("{current}", t[plain ? "plainText" : "markdown"]).replace("{target}", t[plain ? "markdown" : "plainText"]);
180
+ return h2("button", {
181
+ type: "button",
182
+ className: "wb-body-toggle" + (props.className ? " " + props.className : ""),
183
+ title: label,
184
+ "aria-label": label,
185
+ "aria-pressed": !plain,
186
+ onClick: function(e) {
187
+ e.stopPropagation();
188
+ props.onChange(plain ? "markdown" : "text");
189
+ }
190
+ }, h2("span", { key: props.mode, className: "wb-body-toggle-icon", "aria-hidden": true }, h2(props.Icon, { name: plain ? "pilcrow" : "code-2", size: 14 })));
191
+ };
192
+ };
193
+ }
194
+ });
195
+
196
+ // packages/addons/lib/body-copy.cjs
197
+ var require_body_copy = __commonJS({
198
+ "packages/addons/lib/body-copy.cjs"(exports2, module2) {
199
+ module2.exports = {
200
+ zh: { desc: "\u63CF\u8FF0", markdown: "Markdown \u6E32\u67D3", plainText: "\u7EAF\u6587\u672C", bodyModeToggle: "{field} \xB7 \u5F53\u524D\uFF1A{current}\uFF1B\u5207\u6362\u4E3A{target}" },
201
+ en: { desc: "Description", markdown: "Rendered Markdown", plainText: "Plain text", bodyModeToggle: "{field} \xB7 Current: {current}; switch to {target}" }
202
+ };
203
+ }
204
+ });
205
+
206
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
207
+ var toKebabCase;
208
+ var init_toKebabCase = __esm({
209
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs"() {
210
+ toKebabCase = (string) => string?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
211
+ }
212
+ });
213
+
214
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs
215
+ function toLucideIconData(iconName, iconNode, aliases = []) {
216
+ if (iconNode == null) {
217
+ throw new Error("[lucide]: iconNode is required when icon name is used");
218
+ }
219
+ return {
220
+ name: toKebabCase(iconName),
221
+ size: 24,
222
+ node: iconNode,
223
+ ...aliases.length > 0 ? { aliases } : {}
224
+ };
225
+ }
226
+ var init_toLucideIconData = __esm({
227
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs"() {
228
+ init_toKebabCase();
229
+ }
230
+ });
231
+
232
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs
233
+ var toCamelCase;
234
+ var init_toCamelCase = __esm({
235
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs"() {
236
+ toCamelCase = (string) => {
237
+ let out = "";
238
+ let upperNext = false;
239
+ for (const ch of string) {
240
+ if (ch === "-" || ch === "_" || ch <= " ") {
241
+ upperNext = out.length > 0;
242
+ continue;
243
+ }
244
+ if (out.length === 0) {
245
+ out += ch.toLowerCase();
246
+ } else {
247
+ out += upperNext ? ch.toUpperCase() : ch;
248
+ }
249
+ upperNext = false;
250
+ }
251
+ return out;
252
+ };
253
+ }
254
+ });
255
+
256
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs
257
+ var toPascalCase;
258
+ var init_toPascalCase = __esm({
259
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs"() {
260
+ init_toCamelCase();
261
+ toPascalCase = (string) => {
262
+ const camelCase = toCamelCase(string);
263
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
264
+ };
265
+ }
266
+ });
267
+
268
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
269
+ var mergeClasses;
270
+ var init_mergeClasses = __esm({
271
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs"() {
272
+ mergeClasses = (...classes) => classes.filter((className, index, array) => {
273
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
274
+ }).join(" ").trim();
275
+ }
276
+ });
277
+
278
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs
279
+ var defaultAttributes;
280
+ var init_defaultAttributes = __esm({
281
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs"() {
282
+ defaultAttributes = {
283
+ xmlns: "http://www.w3.org/2000/svg",
284
+ width: 24,
285
+ height: 24,
286
+ viewBox: "0 0 24 24",
287
+ fill: "none",
288
+ stroke: "currentColor",
289
+ "stroke-width": 2,
290
+ "stroke-linecap": "round",
291
+ "stroke-linejoin": "round"
292
+ };
293
+ }
294
+ });
295
+
296
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs
297
+ function isDefined(value) {
298
+ return value !== null && value !== void 0;
299
+ }
300
+ function buildLucideIconNode(icon, params = {}) {
301
+ const attributeNames = params.attributeNames ?? {};
302
+ const getAttributeName = (attributeName) => attributeNames[attributeName] ?? attributeName;
303
+ const viewBoxWidth = icon.size ?? icon.width ?? defaultAttributes["width"];
304
+ const viewBoxHeight = icon.size ?? icon.height ?? defaultAttributes["height"];
305
+ const aliasClassNames = icon.aliases?.filter((alias) => typeof alias === "string" && alias.trim() !== "").map((alias) => `lucide-${alias}`) ?? [];
306
+ const iconClassNames = [...icon.name ? [`lucide-${icon.name}`] : [], ...aliasClassNames];
307
+ const classNamesFromClassName = params.className?.split(" ").filter(Boolean) ?? [];
308
+ const className = params.includeDefaultClasses === false ? mergeClasses(...classNamesFromClassName) : mergeClasses("lucide", ...iconClassNames, ...classNamesFromClassName);
309
+ const calculatedStrokeWidth = params.absoluteStrokeWidth ? Number(params.strokeWidth ?? defaultAttributes["stroke-width"]) * Number(icon.size ?? icon.width ?? defaultAttributes["width"]) / Number(params.size ?? params.width ?? defaultAttributes["width"]) : params.strokeWidth ?? defaultAttributes["stroke-width"];
310
+ const attributes = {
311
+ ...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {
312
+ attrs[getAttributeName(attrName)] = value;
313
+ return attrs;
314
+ }, {}),
315
+ ..."color" in params && params.color && {
316
+ [getAttributeName("stroke")]: params.color
317
+ },
318
+ ..."size" in params && isDefined(params.size) && {
319
+ [getAttributeName("width")]: params.size,
320
+ [getAttributeName("height")]: params.size
321
+ },
322
+ ..."width" in params && isDefined(params.width) && {
323
+ [getAttributeName("width")]: params.width
324
+ },
325
+ ..."height" in params && isDefined(params.height) && {
326
+ [getAttributeName("height")]: params.height
327
+ },
328
+ [getAttributeName("stroke-width")]: calculatedStrokeWidth,
329
+ ...className && {
330
+ [getAttributeName("class")]: className
331
+ },
332
+ [getAttributeName("viewBox")]: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
333
+ ...params.hasA11yProp === false ? {
334
+ [getAttributeName("aria-hidden")]: "true"
335
+ } : {},
336
+ ..."attributes" in params && params.attributes
337
+ };
338
+ return [
339
+ "svg",
340
+ attributes,
341
+ icon.node.map((child) => {
342
+ const [name, attrs, children] = child;
343
+ const nextAttrs = params.nonScalingStroke ? { [getAttributeName("vector-effect")]: "non-scaling-stroke", ...attrs } : attrs;
344
+ return children ? [name, nextAttrs, children] : [name, nextAttrs];
345
+ })
346
+ ];
347
+ }
348
+ var init_buildLucideIconNode = __esm({
349
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs"() {
350
+ init_defaultAttributes();
351
+ init_mergeClasses();
352
+ }
353
+ });
354
+
355
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs
356
+ function buildLucideIconForReact(icon, params = {}) {
357
+ return buildLucideIconNode(icon, {
358
+ ...params,
359
+ attributeNames: {
360
+ ...params.attributeNames,
361
+ class: "className",
362
+ "stroke-width": "strokeWidth",
363
+ "stroke-linecap": "strokeLinecap",
364
+ "stroke-linejoin": "strokeLinejoin",
365
+ "vector-effect": "vectorEffect"
366
+ }
367
+ });
368
+ }
369
+ var init_buildLucideIconForReact = __esm({
370
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs"() {
371
+ init_buildLucideIconNode();
372
+ }
373
+ });
374
+
375
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs
376
+ var hasA11yProp;
377
+ var init_hasA11yProp = __esm({
378
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs"() {
379
+ hasA11yProp = (props) => {
380
+ for (const prop in props) {
381
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
382
+ return true;
383
+ }
384
+ }
385
+ return false;
386
+ };
387
+ }
388
+ });
389
+
390
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/context.mjs
391
+ var import_react, LucideContext, useLucideContext;
392
+ var init_context = __esm({
393
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/context.mjs"() {
394
+ "use strict";
395
+ "use client";
396
+ import_react = require("react");
397
+ LucideContext = (0, import_react.createContext)({});
398
+ useLucideContext = () => (0, import_react.useContext)(LucideContext);
399
+ }
400
+ });
401
+
402
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.mjs
403
+ var import_react2, Icon;
404
+ var init_Icon = __esm({
405
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.mjs"() {
406
+ "use strict";
407
+ "use client";
408
+ import_react2 = require("react");
409
+ init_mergeClasses();
410
+ init_buildLucideIconForReact();
411
+ init_hasA11yProp();
412
+ init_context();
413
+ Icon = (0, import_react2.forwardRef)(
414
+ ({
415
+ color,
416
+ size,
417
+ width,
418
+ height,
419
+ strokeWidth,
420
+ absoluteStrokeWidth,
421
+ nonScalingStroke,
422
+ className = "",
423
+ children,
424
+ iconNode = [],
425
+ icon = {
426
+ node: iconNode,
427
+ aliases: [],
428
+ size: 24
429
+ },
430
+ ...rest
431
+ }, ref) => {
432
+ const {
433
+ size: contextSize = 24,
434
+ strokeWidth: contextStrokeWidth = 2,
435
+ absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
436
+ nonScalingStroke: contextNonScalingStroke = false,
437
+ color: contextColor = "currentColor",
438
+ className: contextClass = ""
439
+ } = useLucideContext() ?? {};
440
+ const hasAccessibleProp = Boolean(children) || hasA11yProp(rest);
441
+ const [name, svgAttributes, builtIconNode = []] = buildLucideIconForReact(icon, {
442
+ color: color ?? contextColor,
443
+ width: width ?? size ?? contextSize,
444
+ height: height ?? size ?? contextSize,
445
+ strokeWidth: strokeWidth ?? contextStrokeWidth,
446
+ absoluteStrokeWidth: absoluteStrokeWidth ?? contextAbsoluteStrokeWidth,
447
+ nonScalingStroke: nonScalingStroke ?? contextNonScalingStroke,
448
+ className: mergeClasses(contextClass, className),
449
+ hasA11yProp: hasAccessibleProp,
450
+ attributes: rest
451
+ });
452
+ return (0, import_react2.createElement)(
453
+ name,
454
+ {
455
+ ref,
456
+ ...svgAttributes
457
+ },
458
+ [
459
+ ...builtIconNode.map(([tag, attrs]) => (0, import_react2.createElement)(tag, attrs)),
460
+ ...Array.isArray(children) ? children : [children]
461
+ ]
462
+ );
463
+ }
464
+ );
465
+ }
466
+ });
467
+
468
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs
469
+ function createLucideIcon(iconDataOrName, iconNode = [], aliases = []) {
470
+ const iconData = typeof iconDataOrName === "string" ? toLucideIconData(iconDataOrName, iconNode, aliases) : iconDataOrName;
471
+ const Component = (0, import_react3.forwardRef)(
472
+ ({ className, ...props }, ref) => (0, import_react3.createElement)(Icon, {
473
+ ref,
474
+ icon: iconData,
475
+ className,
476
+ ...props
477
+ })
478
+ );
479
+ if (iconData.name) {
480
+ Component.displayName = toPascalCase(iconData.name);
481
+ }
482
+ return Component;
483
+ }
484
+ var import_react3;
485
+ var init_createLucideIcon = __esm({
486
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.mjs"() {
487
+ import_react3 = require("react");
488
+ init_toLucideIconData();
489
+ init_toPascalCase();
490
+ init_Icon();
491
+ }
492
+ });
493
+
494
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-xml.mjs
495
+ var code_xml_exports = {};
496
+ __export(code_xml_exports, {
497
+ __iconData: () => __iconData,
498
+ default: () => CodeXml
499
+ });
500
+ var __iconData, CodeXml;
501
+ var init_code_xml = __esm({
502
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-xml.mjs"() {
503
+ init_createLucideIcon();
504
+ __iconData = {
505
+ name: "code-xml",
506
+ size: 24,
507
+ node: [
508
+ ["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
509
+ ["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
510
+ ["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
511
+ ],
512
+ aliases: ["code-2"]
513
+ };
514
+ __iconData.node;
515
+ CodeXml = createLucideIcon(__iconData);
516
+ }
517
+ });
518
+
519
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-2.mjs
520
+ var code_2_exports = {};
521
+ __export(code_2_exports, {
522
+ default: () => CodeXml
523
+ });
524
+ var init_code_2 = __esm({
525
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/code-2.mjs"() {
526
+ init_code_xml();
527
+ }
528
+ });
529
+
530
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/pilcrow.mjs
531
+ var pilcrow_exports = {};
532
+ __export(pilcrow_exports, {
533
+ __iconData: () => __iconData2,
534
+ default: () => Pilcrow
535
+ });
536
+ var __iconData2, Pilcrow;
537
+ var init_pilcrow = __esm({
538
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/pilcrow.mjs"() {
539
+ init_createLucideIcon();
540
+ __iconData2 = {
541
+ name: "pilcrow",
542
+ size: 24,
543
+ node: [
544
+ ["path", { d: "M13 4v16", key: "8vvj80" }],
545
+ ["path", { d: "M17 4v16", key: "7dpous" }],
546
+ ["path", { d: "M19 4H9.5a4.5 4.5 0 0 0 0 9H13", key: "sh4n9v" }]
547
+ ]
548
+ };
549
+ __iconData2.node;
550
+ Pilcrow = createLucideIcon(__iconData2);
551
+ }
552
+ });
553
+
554
+ // packages/addons/lib/body-styles.cjs
555
+ var require_body_styles = __commonJS({
556
+ "packages/addons/lib/body-styles.cjs"(exports2, module2) {
557
+ module2.exports = `
558
+ .wb-body-label{float:left;position:relative;z-index:1;margin:1px 6px 0 0;padding:1px 4px;border-radius:4px;font-size:11px;font-weight:600;letter-spacing:.06em;line-height:1.6;color:#234783;background:color-mix(in srgb,#5b7fd6 8%,#fff);white-space:nowrap}
559
+ .wb-body-label.wb-review-label{color:#154d43;background:color-mix(in srgb,var(--wbt-accent,#11a89b) 8%,#fff)}
560
+ .wb-markdown{white-space:normal;min-width:0;overflow-wrap:anywhere}.wb-markdown:after{content:'';display:table;clear:both}
561
+ .wb-markdown p{margin:0 0 6px;white-space:pre-wrap}.wb-markdown>:last-child{margin-bottom:0}
562
+ .wb-markdown h1,.wb-markdown h2,.wb-markdown h3,.wb-markdown h4,.wb-markdown h5,.wb-markdown h6{margin:6px 0;font-weight:650;line-height:1.6}
563
+ .wb-markdown>:first-child{margin-top:0}.wb-markdown h1{font-size:16px}.wb-markdown h2{font-size:15px}.wb-markdown h3{font-size:14px}.wb-markdown h4,.wb-markdown h5,.wb-markdown h6{font-size:13px}
564
+ .wb-markdown ul,.wb-markdown ol{margin:4px 0;padding-left:24px;display:flow-root}.wb-markdown li{margin:1px 0}
565
+ .wb-markdown blockquote{border-left:2px solid currentColor;padding-left:9px;margin:4px 0;display:flow-root}
566
+ .wb-markdown pre{white-space:pre-wrap;overflow-wrap:anywhere;padding:8px;border-radius:6px;background:color-mix(in srgb,currentColor 7%,transparent);display:flow-root;margin:5px 0}
567
+ .wb-markdown code,.wb-body-text{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.wb-markdown code{background:color-mix(in srgb,currentColor 7%,transparent);border-radius:3px;padding:1px 3px}.wb-markdown pre code{padding:0;background:none}
568
+ .wb-markdown a{color:inherit;text-decoration:underline}.wb-markdown hr{border:0;border-top:1px solid currentColor;opacity:.3;clear:both}
569
+ .wb-body-text{white-space:pre-wrap;overflow-wrap:anywhere}.wb-body-text:after{content:'';display:table;clear:both}
570
+ .wb-body-section{min-width:0;overflow-anchor:none}
571
+ .wb-body-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px;padding-left:12px;min-height:24px}
572
+ .wb-body-heading .wb-body-label{float:none;margin:0;padding:0;border-radius:0;background:none;color:inherit;font-size:11.5px;font-weight:600;letter-spacing:.06em;opacity:.72}
573
+ .wb-body-toggle{display:inline-flex;align-items:center;justify-content:center;flex:none;width:24px;height:24px;border:0;background:transparent;color:inherit;padding:0;border-radius:4px;cursor:pointer;opacity:.7}
574
+ .wb-body-toggle:hover{opacity:1;background:color-mix(in srgb,currentColor 5%,transparent)}
575
+ .wb-body-toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#2563eb);outline-offset:2px}
576
+ .wb-body-toggle-icon{display:flex;animation:wb-body-icon-in 140ms ease-out}
577
+ @keyframes wb-body-icon-in{from{opacity:0}to{opacity:1}}
578
+ @media(prefers-reduced-motion:reduce){.wb-body-toggle-icon{animation:none}}
579
+ .wbt-item.closed:has(.wb-body-label){opacity:1}
580
+ `;
581
+ }
582
+ });
583
+
584
+ // packages/addons/lib/body-id.cjs
585
+ var require_body_id = __commonJS({
586
+ "packages/addons/lib/body-id.cjs"(exports2, module2) {
587
+ var nextId = 0;
588
+ module2.exports = function useBodyId(React) {
589
+ return typeof React.useId === "function" ? React.useId() : React.useState("wb-body-" + ++nextId)[0];
590
+ };
591
+ }
592
+ });
593
+
594
+ // packages/addons/lib/description.cjs
595
+ var require_description = __commonJS({
596
+ "packages/addons/lib/description.cjs"(exports2, module2) {
597
+ var React = require("react");
598
+ var h2 = React.createElement;
599
+ var Body = require_markdown().createBody(React);
600
+ var BodyMode = require_body_toggle()(React);
601
+ var copy = require_body_copy();
602
+ var Code = (init_code_2(), __toCommonJS(code_2_exports)).default;
603
+ var Pilcrow2 = (init_pilcrow(), __toCommonJS(pilcrow_exports)).default;
604
+ function BodyIcon(props) {
605
+ return h2(props.name === "pilcrow" ? Pilcrow2 : Code, { size: props.size, "aria-hidden": true, focusable: false });
606
+ }
607
+ var css = require_body_styles() + `
608
+ .wb-desc{margin-top:4px;font-size:12.5px;line-height:1.6;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;max-width:100%;min-width:0;box-sizing:border-box;padding:6px 10px;border-radius:0 8px 8px 0;border-left:2px solid color-mix(in oklab,#5b7fd6 34%,transparent);background:color-mix(in oklab,#5b7fd6 7%,transparent);color:inherit}
609
+ .wb-description{margin-top:10px}.wb-description>.wb-desc{margin-top:0}
610
+ .wb-desc-text{display:block}.wb-desc-clamped{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
611
+ .wb-desc-toggle{display:block;border:1px solid transparent;background:transparent;color:inherit;font:inherit;font-size:12px;min-width:32px;min-height:32px;padding:3px 6px;border-radius:6px;cursor:pointer;white-space:normal}
612
+ .wb-desc-toggle:hover{background:color-mix(in oklab,currentColor 8%,transparent)}.wb-desc-toggle:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#2563eb);outline-offset:2px}
613
+ `;
614
+ function Description(props) {
615
+ var mode = React.useState(props.bodyMode === "text" ? "text" : "markdown");
616
+ var labelId = require_body_id()(React) + "-desc", t = copy[props.lang === "en" ? "en" : "zh"];
617
+ var text = props.text == null ? "" : String(props.text);
618
+ var expanded = React.useState(false), overflow = React.useState(false), ref = React.useRef(null);
619
+ React.useEffect(function() {
620
+ expanded[1](false);
621
+ }, [text]);
622
+ React.useEffect(function() {
623
+ var node = ref.current;
624
+ if (!node) return;
625
+ function measure() {
626
+ if (!expanded[0]) overflow[1](node.scrollHeight > node.clientHeight + 1);
627
+ }
628
+ measure();
629
+ var observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : null;
630
+ if (observer) observer.observe(node);
631
+ return function() {
632
+ if (observer) observer.disconnect();
633
+ };
634
+ }, [text, expanded[0], mode[0]]);
635
+ if (!text.trim()) return null;
636
+ return h2(
637
+ "section",
638
+ { className: "wb-body-section wb-description", "aria-labelledby": labelId },
639
+ h2(
640
+ "div",
641
+ { className: "wb-body-heading" },
642
+ h2("span", { id: labelId, className: "wb-body-label" }, t.desc),
643
+ h2(BodyMode, { label: t.desc, mode: mode[0], onChange: mode[1], t, Icon: props.Icon || BodyIcon })
644
+ ),
645
+ h2(
646
+ "div",
647
+ { className: "wb-desc" },
648
+ h2(
649
+ "div",
650
+ { ref, className: "wb-desc-text" + (expanded[0] ? "" : " wb-desc-clamped") },
651
+ h2(Body, { text, mode: mode[0] })
652
+ ),
653
+ overflow[0] || expanded[0] ? h2("button", {
654
+ type: "button",
655
+ className: "wb-desc-toggle",
656
+ "aria-expanded": expanded[0],
657
+ onClick: function() {
658
+ expanded[1](!expanded[0]);
659
+ }
660
+ }, props.lang === "en" ? expanded[0] ? "Collapse" : "Expand" : expanded[0] ? "\u6536\u8D77" : "\u5C55\u5F00") : null
661
+ )
662
+ );
663
+ }
664
+ module2.exports = { css, Description };
665
+ }
666
+ });
667
+
668
+ // packages/addons/lib/visual-tokens.cjs
669
+ var require_visual_tokens = __commonJS({
670
+ "packages/addons/lib/visual-tokens.cjs"(exports2, module2) {
671
+ module2.exports = `
672
+ :where(.wbt-root,.wbi-root,.wbi-cfg,.wbt-data,.wbs-data,.wbg-data,.wbi-data,.wb-desc){--wb-radius-sm:8px;--wb-radius-card:12px;--wb-space-sm:8px;--wb-space-md:14px;--wb-border:var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent));--wb-description-bg:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 7%,transparent);--wb-description-line:color-mix(in oklab,var(--dsw-alias-brand-primary,#5b7fd6) 34%,transparent);--wb-motion:140ms;--wb-btn-bg:transparent;--wb-btn-hover-bg:color-mix(in oklab,currentColor 6%,transparent);--wb-btn-active-bg:color-mix(in oklab,currentColor 11%,transparent);--wb-btn-primary-bg:var(--dsw-alias-brand-primary,#2563eb);--wb-btn-primary-fg:var(--dsw-alias-label-primary-inverted,#fff);--wb-btn-danger-fg:var(--dsw-alias-state-error-primary,#b91c1c);--wb-btn-size-sm:32px;--wb-btn-focus:2px solid var(--dsw-alias-brand-primary,#2563eb);--wb-btn-focus-offset:2px}
673
+ .wb-desc{background:var(--wb-description-bg);border-left-color:var(--wb-description-line);border-radius:0 var(--wb-radius-sm) var(--wb-radius-sm) 0}
674
+ `;
675
+ }
676
+ });
677
+
678
+ // packages/addons/storage/client/ui/styles.cjs
679
+ var require_styles = __commonJS({
680
+ "packages/addons/storage/client/ui/styles.cjs"(exports2, module2) {
681
+ module2.exports = require_description().css + require_visual_tokens() + `
682
+ .wbi-root{--line:var(--wb-line,var(--dsw-alias-border-l2,#d9dfe6));--surface:var(--wb-surface,var(--dsw-alias-bg-layer-1,#fff));--muted:var(--dsw-alias-label-secondary,#64748b);--accent:var(--dsw-alias-brand-primary,#2563eb);font-size:13px;color:inherit;min-width:0;container-type:inline-size;container-name:storage}
683
+ .wbi-root *{box-sizing:border-box}.wbi-root h2{font-size:18px;margin:0}.wbi-root h3{font-size:15px;margin:0}.wbi-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.wbi-grow{flex:1;min-width:0}.wbi-muted{color:var(--muted);font-size:12px}.wbi-root input,.wbi-root textarea,.wbi-root select{background:var(--surface);color:inherit;border:1px solid var(--line);border-radius:8px;padding:8px 10px;font:inherit;max-width:100%}.wbi-root textarea{resize:vertical;min-height:80px}.wbi-root :focus-visible{outline:2px solid var(--accent);outline-offset:2px}
684
+ .wbi-btn,.wbi-image,.wbi-root .wb-desc-toggle{border:none;background:var(--wb-btn-bg);color:inherit;min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm);border-radius:8px;padding:7px 12px;cursor:pointer;font:inherit}
685
+ .wbi-btn:enabled:hover,.wbi-image:enabled:hover,.wbi-root .wb-desc-toggle:enabled:hover{background:var(--wb-btn-hover-bg)}
686
+ .wbi-btn:enabled:active,.wbi-image:enabled:active,.wbi-root .wb-desc-toggle:enabled:active{background:var(--wb-btn-active-bg)}
687
+ .wbi-btn:disabled{opacity:.45;cursor:default}
688
+ .wbi-btn.wbi-primary{background:var(--wb-btn-primary-bg);color:var(--dsw-alias-label-primary-inverted,#fff)}
689
+ .wbi-btn.wbi-primary:enabled:hover{background:color-mix(in oklab,var(--wb-btn-primary-bg) 92%,black)}
690
+ .wbi-btn.wbi-primary:enabled:active{background:color-mix(in oklab,var(--wb-btn-primary-bg) 84%,black)}
691
+ .wbi-btn.wbi-danger:enabled:hover{color:var(--wb-btn-danger-fg)}
692
+ .wbi-btn:focus-visible,.wbi-image:focus-visible,.wbi-root .wb-desc-toggle:focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}
693
+ .wbi-toolbar{margin:18px 0;display:flex;gap:10px;align-items:center;flex-wrap:wrap}.wbi-toolbar input[type=search]{min-width:220px;flex:1}.wbi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr));gap:14px}.wbi-card{padding:14px;border:1px solid var(--line);border-radius:10px;background:var(--surface);min-width:0;height:100%;display:flex;flex-direction:column;gap:8px;transition:transform .14s ease,border-color .14s ease}.wbi-card h3{font-size:14px;font-weight:650;line-height:1.4;overflow-wrap:anywhere;min-width:0;flex:1}.wbi-stock{display:inline-flex;align-items:center;gap:5px;font-size:18px;font-weight:650;overflow-wrap:anywhere;max-width:100%;font-variant-numeric:tabular-nums}.wbi-card p{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.wbi-tags{display:flex;gap:6px;flex-wrap:wrap}.wbi-chip{display:inline-flex;align-items:center;gap:5px;padding:4px 8px;border-radius:20px;font-size:12px}.wbi-images{display:flex;gap:8px;flex-wrap:wrap;align-items:center;min-width:0}.wbi-image{border-radius:8px;overflow:hidden;padding:0;background:transparent;flex-shrink:0;cursor:pointer}.wbi-image img{display:block;width:80px;aspect-ratio:4/3;height:auto;object-fit:cover}.wbi-empty{padding:50px 20px;text-align:center;color:var(--muted);border:1px dashed var(--line);border-radius:12px}.wbi-error{padding:12px;margin:10px 0;border:1px solid #ef4444;border-radius:8px;color:var(--dsw-alias-state-error-primary,#b91c1c)}.wbi-pager{margin:20px 0;display:flex;gap:10px;align-items:center;justify-content:flex-end;flex-wrap:wrap}
694
+ .wbi-mask{position:fixed;inset:0;background:#0007;z-index:10000;display:flex;align-items:center;justify-content:center;padding:20px}.wbi-modal{background:var(--surface);color:inherit;border-radius:14px;padding:22px;width:640px;max-width:100%;max-height:90vh;overflow:auto;box-shadow:0 20px 70px #0004}.wbi-form{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:20px}.wbi-field{display:flex;flex-direction:column;gap:6px;min-width:0}.wbi-wide{grid-column:1/-1}.wbi-formfoot{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.wbi-tagoptions{display:flex;gap:8px;flex-wrap:wrap;max-height:160px;overflow:auto;margin-top:8px}.wbi-tagoptions label{display:flex;gap:5px;align-items:center}.wbi-preview{display:block;max-width:100%;max-height:65vh;margin:16px auto;object-fit:contain}.wbi-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:14px;margin:18px 0}.wbi-kpis strong{display:block;font-size:28px;margin-top:8px}.wbi-bar{height:7px;border-radius:4px;background:var(--accent);margin:8px 0 12px}.wbi-notice{padding:10px 0;color:var(--muted)}
695
+ @media(max-width:600px){.wbi-form{grid-template-columns:1fr}.wbi-wide{grid-column:auto}.wbi-mask{padding:8px}.wbi-modal{padding:16px}.wbi-toolbar input[type=search]{min-width:0;width:100%}}
696
+
697
+ .wbi-cardhead{display:flex;align-items:baseline;gap:8px;min-width:0;flex-wrap:wrap}.wbi-metazone{display:flex;flex-direction:column;gap:3px;min-width:0;overflow-wrap:anywhere}.wbi-meta{display:flex;gap:2px 10px;flex-wrap:wrap;font-size:11.5px;color:var(--muted);font-variant-numeric:tabular-nums}
698
+ .wbi-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:4px;margin-top:auto;padding-top:6px;min-width:0}.wbi-btn-sm{padding:3px 9px;font-size:12px;min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}.wbi-chip{min-height:32px;max-width:100%;overflow-wrap:anywhere;text-align:left}.wbi-stock small{font-weight:400}.wbi-more{font-variant-numeric:tabular-nums}
699
+ .wbi-card:hover,.wbi-card:focus-within{border-color:color-mix(in oklab,var(--accent) 40%,var(--line))}.wbi-card:hover{transform:translateY(-2px)}.wbi-card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
700
+ .wbi-selectable{cursor:pointer;position:relative;padding-top:42px}.wbi-root input.wbi-check{position:absolute;left:14px;top:14px;margin:0;padding:0;accent-color:var(--accent)}.wbi-card.wbi-selected{border-color:var(--accent);background:color-mix(in srgb,var(--accent) 9%,var(--surface))}.wbi-selbar{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:900;display:flex;gap:8px;align-items:center;background:var(--surface);border:1px solid var(--line);box-shadow:0 10px 34px #0004;border-radius:12px;padding:8px 11px;max-width:94vw;flex-wrap:wrap}.wbi-bulk-actions{display:flex;gap:8px}.wbi-root:has(.wbi-selbar){padding-bottom:84px}
701
+ @container storage (min-width:1280px){.wbi-grid{grid-template-columns:repeat(5,minmax(0,1fr))}}
702
+ @media(prefers-reduced-motion:reduce){.wbi-card{transition:none}.wbi-card:hover{transform:none}}
703
+ .wbi-root{--line:var(--wb-border)}.wbi-svg{display:inline-block;vertical-align:middle;flex:none}.wbi-root h2,.wbi-root h3,.wbi-inline{display:inline-flex;align-items:center;gap:var(--wb-space-sm)}.wbi-metazone .wbi-inline{margin-right:10px}
704
+ .wbi-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border-radius:var(--wb-radius-sm);transition:background var(--wb-motion),color var(--wb-motion)}.wbi-card{border-radius:var(--wb-radius-card);padding:var(--wb-space-md);gap:var(--wb-space-sm)}.wbi-grid{gap:var(--wb-space-md)}.wbi-icon-only{width:32px;height:32px;min-width:32px;padding:0}.wbi-empty .wbi-svg{display:block;margin:0 auto 14px}.wbi-image{position:relative;min-width:80px;min-height:60px}.wbi-image>.wbi-svg{position:absolute;inset:0;margin:auto}.wbi-image img{position:relative}
705
+ .wbi-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.wbi-skeleton{margin:18px 0}.wbi-sk{height:16px;border-radius:var(--wb-radius-sm);background:color-mix(in oklab,currentColor 9%,transparent);animation:wbi-pulse 1.4s ease-in-out infinite}.wbi-sk:nth-child(2){height:48px}.wbi-sk:last-child{width:60%}@keyframes wbi-pulse{50%{opacity:.45}}
706
+ .wbi-cfg-group{border-radius:var(--wb-radius-card)!important}.wbi-cfg{gap:var(--wb-space-md)!important}.wbi-cfg-head h2{display:flex;gap:var(--wb-space-sm);align-items:center}
707
+ @container storage (max-width:480px){.wbi-toolbar{gap:8px}.wbi-toolbar input[type=search]{flex-basis:100%;min-width:0}.wbi-toolbar select{flex:1;min-width:0}.wbi-root>.wbi-row>.wbi-icon-text .wbi-btn-label,.wbi-toolbar>.wbi-icon-text .wbi-btn-label,.wbi-cfg-head>.wbi-icon-text .wbi-btn-label{display:none}.wbi-root>.wbi-row>.wbi-icon-text,.wbi-toolbar>.wbi-icon-text,.wbi-cfg-head>.wbi-icon-text{width:32px;height:32px;padding:0}}
708
+ @media(prefers-reduced-motion:reduce){.wbi-root *,.wbi-root *::after{transition:none!important;animation:none!important}.wbi-card:hover{transform:none}}
709
+ `;
710
+ }
711
+ });
712
+
713
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/box.mjs
714
+ var box_exports = {};
715
+ __export(box_exports, {
716
+ __iconData: () => __iconData3,
717
+ default: () => Box
718
+ });
719
+ var __iconData3, Box;
720
+ var init_box = __esm({
721
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/box.mjs"() {
722
+ init_createLucideIcon();
723
+ __iconData3 = {
724
+ name: "box",
725
+ size: 24,
726
+ node: [
727
+ [
728
+ "path",
729
+ {
730
+ d: "M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",
731
+ key: "hh9hay"
732
+ }
733
+ ],
734
+ ["path", { d: "m3.3 7 8.7 5 8.7-5", key: "g66t2b" }],
735
+ ["path", { d: "M12 22V12", key: "d0xqtd" }]
736
+ ]
737
+ };
738
+ __iconData3.node;
739
+ Box = createLucideIcon(__iconData3);
740
+ }
741
+ });
742
+
743
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/plus.mjs
744
+ var plus_exports = {};
745
+ __export(plus_exports, {
746
+ __iconData: () => __iconData4,
747
+ default: () => Plus
748
+ });
749
+ var __iconData4, Plus;
750
+ var init_plus = __esm({
751
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/plus.mjs"() {
752
+ init_createLucideIcon();
753
+ __iconData4 = {
754
+ name: "plus",
755
+ size: 24,
756
+ node: [
757
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
758
+ ["path", { d: "M12 5v14", key: "s699le" }]
759
+ ]
760
+ };
761
+ __iconData4.node;
762
+ Plus = createLucideIcon(__iconData4);
763
+ }
764
+ });
765
+
766
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/search.mjs
767
+ var search_exports = {};
768
+ __export(search_exports, {
769
+ __iconData: () => __iconData5,
770
+ default: () => Search
771
+ });
772
+ var __iconData5, Search;
773
+ var init_search = __esm({
774
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/search.mjs"() {
775
+ init_createLucideIcon();
776
+ __iconData5 = {
777
+ name: "search",
778
+ size: 24,
779
+ node: [
780
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
781
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
782
+ ]
783
+ };
784
+ __iconData5.node;
785
+ Search = createLucideIcon(__iconData5);
786
+ }
787
+ });
788
+
789
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.mjs
790
+ var refresh_cw_exports = {};
791
+ __export(refresh_cw_exports, {
792
+ __iconData: () => __iconData6,
793
+ default: () => RefreshCw
794
+ });
795
+ var __iconData6, RefreshCw;
796
+ var init_refresh_cw = __esm({
797
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.mjs"() {
798
+ init_createLucideIcon();
799
+ __iconData6 = {
800
+ name: "refresh-cw",
801
+ size: 24,
802
+ node: [
803
+ ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
804
+ ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
805
+ ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
806
+ ["path", { d: "M8 16H3v5", key: "1cv678" }]
807
+ ]
808
+ };
809
+ __iconData6.node;
810
+ RefreshCw = createLucideIcon(__iconData6);
811
+ }
812
+ });
813
+
814
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/pencil.mjs
815
+ var pencil_exports = {};
816
+ __export(pencil_exports, {
817
+ __iconData: () => __iconData7,
818
+ default: () => Pencil
819
+ });
820
+ var __iconData7, Pencil;
821
+ var init_pencil = __esm({
822
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/pencil.mjs"() {
823
+ init_createLucideIcon();
824
+ __iconData7 = {
825
+ name: "pencil",
826
+ size: 24,
827
+ node: [
828
+ [
829
+ "path",
830
+ {
831
+ d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
832
+ key: "1a8usu"
833
+ }
834
+ ],
835
+ ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
836
+ ]
837
+ };
838
+ __iconData7.node;
839
+ Pencil = createLucideIcon(__iconData7);
840
+ }
841
+ });
842
+
843
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/trash.mjs
844
+ var __iconData8, Trash;
845
+ var init_trash = __esm({
846
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/trash.mjs"() {
847
+ init_createLucideIcon();
848
+ __iconData8 = {
849
+ name: "trash",
850
+ size: 24,
851
+ node: [
852
+ ["path", { d: "M10 11v6", key: "nco0om" }],
853
+ ["path", { d: "M14 11v6", key: "outv1u" }],
854
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
855
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
856
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
857
+ ],
858
+ aliases: ["trash-2"]
859
+ };
860
+ __iconData8.node;
861
+ Trash = createLucideIcon(__iconData8);
862
+ }
863
+ });
864
+
865
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/trash-2.mjs
866
+ var trash_2_exports = {};
867
+ __export(trash_2_exports, {
868
+ default: () => Trash
869
+ });
870
+ var init_trash_2 = __esm({
871
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/trash-2.mjs"() {
872
+ init_trash();
873
+ }
874
+ });
875
+
876
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up-down.mjs
877
+ var arrow_up_down_exports = {};
878
+ __export(arrow_up_down_exports, {
879
+ __iconData: () => __iconData9,
880
+ default: () => ArrowUpDown
881
+ });
882
+ var __iconData9, ArrowUpDown;
883
+ var init_arrow_up_down = __esm({
884
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up-down.mjs"() {
885
+ init_createLucideIcon();
886
+ __iconData9 = {
887
+ name: "arrow-up-down",
888
+ size: 24,
889
+ node: [
890
+ ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
891
+ ["path", { d: "M17 20V4", key: "1ejh1v" }],
892
+ ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
893
+ ["path", { d: "M7 4v16", key: "1glfcx" }]
894
+ ]
895
+ };
896
+ __iconData9.node;
897
+ ArrowUpDown = createLucideIcon(__iconData9);
898
+ }
899
+ });
900
+
901
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/image.mjs
902
+ var image_exports = {};
903
+ __export(image_exports, {
904
+ __iconData: () => __iconData10,
905
+ default: () => Image
906
+ });
907
+ var __iconData10, Image;
908
+ var init_image = __esm({
909
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/image.mjs"() {
910
+ init_createLucideIcon();
911
+ __iconData10 = {
912
+ name: "image",
913
+ size: 24,
914
+ node: [
915
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
916
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
917
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
918
+ ]
919
+ };
920
+ __iconData10.node;
921
+ Image = createLucideIcon(__iconData10);
922
+ }
923
+ });
924
+
925
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/clock.mjs
926
+ var clock_exports = {};
927
+ __export(clock_exports, {
928
+ __iconData: () => __iconData11,
929
+ default: () => Clock
930
+ });
931
+ var __iconData11, Clock;
932
+ var init_clock = __esm({
933
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/clock.mjs"() {
934
+ init_createLucideIcon();
935
+ __iconData11 = {
936
+ name: "clock",
937
+ size: 24,
938
+ node: [
939
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
940
+ ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
941
+ ]
942
+ };
943
+ __iconData11.node;
944
+ Clock = createLucideIcon(__iconData11);
945
+ }
946
+ });
947
+
948
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/tag.mjs
949
+ var tag_exports = {};
950
+ __export(tag_exports, {
951
+ __iconData: () => __iconData12,
952
+ default: () => Tag
953
+ });
954
+ var __iconData12, Tag;
955
+ var init_tag = __esm({
956
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/tag.mjs"() {
957
+ init_createLucideIcon();
958
+ __iconData12 = {
959
+ name: "tag",
960
+ size: 24,
961
+ node: [
962
+ [
963
+ "path",
964
+ {
965
+ d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
966
+ key: "vktsd0"
967
+ }
968
+ ],
969
+ ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
970
+ ]
971
+ };
972
+ __iconData12.node;
973
+ Tag = createLucideIcon(__iconData12);
974
+ }
975
+ });
976
+
977
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/package.mjs
978
+ var package_exports = {};
979
+ __export(package_exports, {
980
+ __iconData: () => __iconData13,
981
+ default: () => Package
982
+ });
983
+ var __iconData13, Package;
984
+ var init_package = __esm({
985
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/package.mjs"() {
986
+ init_createLucideIcon();
987
+ __iconData13 = {
988
+ name: "package",
989
+ size: 24,
990
+ node: [
991
+ [
992
+ "path",
993
+ {
994
+ d: "M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",
995
+ key: "1a0edw"
996
+ }
997
+ ],
998
+ ["path", { d: "M12 22V12", key: "d0xqtd" }],
999
+ ["polyline", { points: "3.29 7 12 12 20.71 7", key: "ousv84" }],
1000
+ ["path", { d: "m7.5 4.27 9 5.15", key: "1c824w" }]
1001
+ ]
1002
+ };
1003
+ __iconData13.node;
1004
+ Package = createLucideIcon(__iconData13);
1005
+ }
1006
+ });
1007
+
1008
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chart-column.mjs
1009
+ var chart_column_exports = {};
1010
+ __export(chart_column_exports, {
1011
+ __iconData: () => __iconData14,
1012
+ default: () => ChartColumn
1013
+ });
1014
+ var __iconData14, ChartColumn;
1015
+ var init_chart_column = __esm({
1016
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/chart-column.mjs"() {
1017
+ init_createLucideIcon();
1018
+ __iconData14 = {
1019
+ name: "chart-column",
1020
+ size: 24,
1021
+ node: [
1022
+ ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
1023
+ ["path", { d: "M18 17V9", key: "2bz60n" }],
1024
+ ["path", { d: "M13 17V5", key: "1frdt8" }],
1025
+ ["path", { d: "M8 17v-3", key: "17ska0" }]
1026
+ ],
1027
+ aliases: ["bar-chart-3"]
1028
+ };
1029
+ __iconData14.node;
1030
+ ChartColumn = createLucideIcon(__iconData14);
1031
+ }
1032
+ });
1033
+
1034
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs
1035
+ var list_exports = {};
1036
+ __export(list_exports, {
1037
+ __iconData: () => __iconData15,
1038
+ default: () => List
1039
+ });
1040
+ var __iconData15, List;
1041
+ var init_list = __esm({
1042
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/list.mjs"() {
1043
+ init_createLucideIcon();
1044
+ __iconData15 = {
1045
+ name: "list",
1046
+ size: 24,
1047
+ node: [
1048
+ ["path", { d: "M3 5h.01", key: "18ugdj" }],
1049
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
1050
+ ["path", { d: "M3 19h.01", key: "noohij" }],
1051
+ ["path", { d: "M8 5h13", key: "1pao27" }],
1052
+ ["path", { d: "M8 12h13", key: "1za7za" }],
1053
+ ["path", { d: "M8 19h13", key: "m83p4d" }]
1054
+ ]
1055
+ };
1056
+ __iconData15.node;
1057
+ List = createLucideIcon(__iconData15);
1058
+ }
1059
+ });
1060
+
1061
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings.mjs
1062
+ var settings_exports = {};
1063
+ __export(settings_exports, {
1064
+ __iconData: () => __iconData16,
1065
+ default: () => Settings
1066
+ });
1067
+ var __iconData16, Settings;
1068
+ var init_settings = __esm({
1069
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings.mjs"() {
1070
+ init_createLucideIcon();
1071
+ __iconData16 = {
1072
+ name: "settings",
1073
+ size: 24,
1074
+ node: [
1075
+ [
1076
+ "path",
1077
+ {
1078
+ d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
1079
+ key: "1i5ecw"
1080
+ }
1081
+ ],
1082
+ ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
1083
+ ]
1084
+ };
1085
+ __iconData16.node;
1086
+ Settings = createLucideIcon(__iconData16);
1087
+ }
1088
+ });
1089
+
1090
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs
1091
+ var database_exports = {};
1092
+ __export(database_exports, {
1093
+ __iconData: () => __iconData17,
1094
+ default: () => Database
1095
+ });
1096
+ var __iconData17, Database;
1097
+ var init_database = __esm({
1098
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/database.mjs"() {
1099
+ init_createLucideIcon();
1100
+ __iconData17 = {
1101
+ name: "database",
1102
+ size: 24,
1103
+ node: [
1104
+ ["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
1105
+ ["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
1106
+ ["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
1107
+ ]
1108
+ };
1109
+ __iconData17.node;
1110
+ Database = createLucideIcon(__iconData17);
1111
+ }
1112
+ });
1113
+
1114
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.mjs
1115
+ var download_exports = {};
1116
+ __export(download_exports, {
1117
+ __iconData: () => __iconData18,
1118
+ default: () => Download
1119
+ });
1120
+ var __iconData18, Download;
1121
+ var init_download = __esm({
1122
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.mjs"() {
1123
+ init_createLucideIcon();
1124
+ __iconData18 = {
1125
+ name: "download",
1126
+ size: 24,
1127
+ node: [
1128
+ ["path", { d: "M12 15V3", key: "m9g1x1" }],
1129
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
1130
+ ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
1131
+ ]
1132
+ };
1133
+ __iconData18.node;
1134
+ Download = createLucideIcon(__iconData18);
1135
+ }
1136
+ });
1137
+
1138
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/package-open.mjs
1139
+ var package_open_exports = {};
1140
+ __export(package_open_exports, {
1141
+ __iconData: () => __iconData19,
1142
+ default: () => PackageOpen
1143
+ });
1144
+ var __iconData19, PackageOpen;
1145
+ var init_package_open = __esm({
1146
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/package-open.mjs"() {
1147
+ init_createLucideIcon();
1148
+ __iconData19 = {
1149
+ name: "package-open",
1150
+ size: 24,
1151
+ node: [
1152
+ ["path", { d: "M12 22v-9", key: "x3hkom" }],
1153
+ [
1154
+ "path",
1155
+ {
1156
+ d: "M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",
1157
+ key: "2ntwy6"
1158
+ }
1159
+ ],
1160
+ [
1161
+ "path",
1162
+ {
1163
+ d: "M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",
1164
+ key: "1pmm1c"
1165
+ }
1166
+ ],
1167
+ [
1168
+ "path",
1169
+ {
1170
+ d: "M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",
1171
+ key: "12ttoo"
1172
+ }
1173
+ ]
1174
+ ]
1175
+ };
1176
+ __iconData19.node;
1177
+ PackageOpen = createLucideIcon(__iconData19);
1178
+ }
1179
+ });
1180
+
1181
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/factory.mjs
1182
+ var factory_exports = {};
1183
+ __export(factory_exports, {
1184
+ __iconData: () => __iconData20,
1185
+ default: () => Factory
1186
+ });
1187
+ var __iconData20, Factory;
1188
+ var init_factory = __esm({
1189
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/factory.mjs"() {
1190
+ init_createLucideIcon();
1191
+ __iconData20 = {
1192
+ name: "factory",
1193
+ size: 24,
1194
+ node: [
1195
+ ["path", { d: "M12 16h.01", key: "1drbdi" }],
1196
+ ["path", { d: "M16 16h.01", key: "1f9h7w" }],
1197
+ [
1198
+ "path",
1199
+ {
1200
+ d: "M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z",
1201
+ key: "1iv0i2"
1202
+ }
1203
+ ],
1204
+ ["path", { d: "M8 16h.01", key: "18s6g9" }]
1205
+ ]
1206
+ };
1207
+ __iconData20.node;
1208
+ Factory = createLucideIcon(__iconData20);
1209
+ }
1210
+ });
1211
+
1212
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ruler.mjs
1213
+ var ruler_exports = {};
1214
+ __export(ruler_exports, {
1215
+ __iconData: () => __iconData21,
1216
+ default: () => Ruler
1217
+ });
1218
+ var __iconData21, Ruler;
1219
+ var init_ruler = __esm({
1220
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ruler.mjs"() {
1221
+ init_createLucideIcon();
1222
+ __iconData21 = {
1223
+ name: "ruler",
1224
+ size: 24,
1225
+ node: [
1226
+ [
1227
+ "path",
1228
+ {
1229
+ d: "M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",
1230
+ key: "icamh8"
1231
+ }
1232
+ ],
1233
+ ["path", { d: "m14.5 12.5 2-2", key: "inckbg" }],
1234
+ ["path", { d: "m11.5 9.5 2-2", key: "fmmyf7" }],
1235
+ ["path", { d: "m8.5 6.5 2-2", key: "vc6u1g" }],
1236
+ ["path", { d: "m17.5 15.5 2-2", key: "wo5hmg" }]
1237
+ ]
1238
+ };
1239
+ __iconData21.node;
1240
+ Ruler = createLucideIcon(__iconData21);
1241
+ }
1242
+ });
1243
+
1244
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/map-pin.mjs
1245
+ var map_pin_exports = {};
1246
+ __export(map_pin_exports, {
1247
+ __iconData: () => __iconData22,
1248
+ default: () => MapPin
1249
+ });
1250
+ var __iconData22, MapPin;
1251
+ var init_map_pin = __esm({
1252
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/map-pin.mjs"() {
1253
+ init_createLucideIcon();
1254
+ __iconData22 = {
1255
+ name: "map-pin",
1256
+ size: 24,
1257
+ node: [
1258
+ [
1259
+ "path",
1260
+ {
1261
+ d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",
1262
+ key: "1r0f0z"
1263
+ }
1264
+ ],
1265
+ ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }]
1266
+ ]
1267
+ };
1268
+ __iconData22.node;
1269
+ MapPin = createLucideIcon(__iconData22);
1270
+ }
1271
+ });
1272
+
1273
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-check-big.mjs
1274
+ var __iconData23, SquareCheckBig;
1275
+ var init_square_check_big = __esm({
1276
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-check-big.mjs"() {
1277
+ init_createLucideIcon();
1278
+ __iconData23 = {
1279
+ name: "square-check-big",
1280
+ size: 24,
1281
+ node: [
1282
+ [
1283
+ "path",
1284
+ { d: "M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344", key: "2acyp4" }
1285
+ ],
1286
+ ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
1287
+ ],
1288
+ aliases: ["check-square"]
1289
+ };
1290
+ __iconData23.node;
1291
+ SquareCheckBig = createLucideIcon(__iconData23);
1292
+ }
1293
+ });
1294
+
1295
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/check-square.mjs
1296
+ var check_square_exports = {};
1297
+ __export(check_square_exports, {
1298
+ default: () => SquareCheckBig
1299
+ });
1300
+ var init_check_square = __esm({
1301
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/check-square.mjs"() {
1302
+ init_square_check_big();
1303
+ }
1304
+ });
1305
+
1306
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/x.mjs
1307
+ var x_exports = {};
1308
+ __export(x_exports, {
1309
+ __iconData: () => __iconData24,
1310
+ default: () => X
1311
+ });
1312
+ var __iconData24, X;
1313
+ var init_x = __esm({
1314
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/x.mjs"() {
1315
+ init_createLucideIcon();
1316
+ __iconData24 = {
1317
+ name: "x",
1318
+ size: 24,
1319
+ node: [
1320
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1321
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1322
+ ]
1323
+ };
1324
+ __iconData24.node;
1325
+ X = createLucideIcon(__iconData24);
1326
+ }
1327
+ });
1328
+
1329
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/table.mjs
1330
+ var table_exports = {};
1331
+ __export(table_exports, {
1332
+ __iconData: () => __iconData25,
1333
+ default: () => Table
1334
+ });
1335
+ var __iconData25, Table;
1336
+ var init_table = __esm({
1337
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/table.mjs"() {
1338
+ init_createLucideIcon();
1339
+ __iconData25 = {
1340
+ name: "table",
1341
+ size: 24,
1342
+ node: [
1343
+ ["path", { d: "M12 3v18", key: "108xh3" }],
1344
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
1345
+ ["path", { d: "M3 9h18", key: "1pudct" }],
1346
+ ["path", { d: "M3 15h18", key: "5xshup" }]
1347
+ ]
1348
+ };
1349
+ __iconData25.node;
1350
+ Table = createLucideIcon(__iconData25);
1351
+ }
1352
+ });
1353
+
1354
+ // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/rotate-ccw.mjs
1355
+ var rotate_ccw_exports = {};
1356
+ __export(rotate_ccw_exports, {
1357
+ __iconData: () => __iconData26,
1358
+ default: () => RotateCcw
1359
+ });
1360
+ var __iconData26, RotateCcw;
1361
+ var init_rotate_ccw = __esm({
1362
+ "node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/rotate-ccw.mjs"() {
1363
+ init_createLucideIcon();
1364
+ __iconData26 = {
1365
+ name: "rotate-ccw",
1366
+ size: 24,
1367
+ node: [
1368
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
1369
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
1370
+ ]
1371
+ };
1372
+ __iconData26.node;
1373
+ RotateCcw = createLucideIcon(__iconData26);
1374
+ }
1375
+ });
1376
+
1377
+ // packages/addons/storage/client/ui/icons.cjs
1378
+ var require_icons = __commonJS({
1379
+ "packages/addons/storage/client/ui/icons.cjs"(exports2, module2) {
1380
+ var React = require("react");
1381
+ var ICONS = {
1382
+ box: (init_box(), __toCommonJS(box_exports)).default,
1383
+ plus: (init_plus(), __toCommonJS(plus_exports)).default,
1384
+ search: (init_search(), __toCommonJS(search_exports)).default,
1385
+ refresh: (init_refresh_cw(), __toCommonJS(refresh_cw_exports)).default,
1386
+ pencil: (init_pencil(), __toCommonJS(pencil_exports)).default,
1387
+ trash: (init_trash_2(), __toCommonJS(trash_2_exports)).default,
1388
+ sort: (init_arrow_up_down(), __toCommonJS(arrow_up_down_exports)).default,
1389
+ image: (init_image(), __toCommonJS(image_exports)).default,
1390
+ clock: (init_clock(), __toCommonJS(clock_exports)).default,
1391
+ tag: (init_tag(), __toCommonJS(tag_exports)).default,
1392
+ stock: (init_package(), __toCommonJS(package_exports)).default,
1393
+ chart: (init_chart_column(), __toCommonJS(chart_column_exports)).default,
1394
+ list: (init_list(), __toCommonJS(list_exports)).default,
1395
+ settings: (init_settings(), __toCommonJS(settings_exports)).default,
1396
+ database: (init_database(), __toCommonJS(database_exports)).default,
1397
+ "code-2": (init_code_xml(), __toCommonJS(code_xml_exports)).default,
1398
+ download: (init_download(), __toCommonJS(download_exports)).default,
1399
+ empty: (init_package_open(), __toCommonJS(package_open_exports)).default,
1400
+ brand: (init_factory(), __toCommonJS(factory_exports)).default,
1401
+ unit: (init_ruler(), __toCommonJS(ruler_exports)).default,
1402
+ location: (init_map_pin(), __toCommonJS(map_pin_exports)).default,
1403
+ check: (init_check_square(), __toCommonJS(check_square_exports)).default,
1404
+ close: (init_x(), __toCommonJS(x_exports)).default,
1405
+ table: (init_table(), __toCommonJS(table_exports)).default,
1406
+ reset: (init_rotate_ccw(), __toCommonJS(rotate_ccw_exports)).default
1407
+ };
1408
+ function Icon3(props) {
1409
+ var size = props.name === "empty" && props.size === 48 ? 48 : [11, 14, 16].includes(props.size) ? props.size : 14;
1410
+ return React.createElement(ICONS[props.name] || ICONS.box, {
1411
+ size,
1412
+ strokeWidth: 2,
1413
+ "aria-hidden": true,
1414
+ focusable: false,
1415
+ className: "wbi-svg"
1416
+ });
1417
+ }
1418
+ module2.exports = { ICONS, Icon: Icon3 };
1419
+ }
1420
+ });
1421
+
1422
+ // packages/addons/storage/client/ui/ui.cjs
1423
+ var require_ui = __commonJS({
1424
+ "packages/addons/storage/client/ui/ui.cjs"(exports2, module2) {
1425
+ var React = require("react");
1426
+ var h2 = React.createElement;
1427
+ var Icon3 = require_icons().Icon;
1428
+ function call(api, name, args) {
1429
+ return api.call(name, args || {}).then(function(r) {
1430
+ if (!r || r.ok !== true) throw new Error(r && r.error || "\u8BF7\u6C42\u5931\u8D25");
1431
+ return r.result;
1432
+ });
1433
+ }
1434
+ function tr(lang, zh, en) {
1435
+ return lang === "en" ? en : zh;
1436
+ }
1437
+ function Button(props) {
1438
+ var attrs = Object.assign({ type: "button", className: "wbi-btn" }, props);
1439
+ delete attrs.icon;
1440
+ delete attrs.iconOnly;
1441
+ if (props.icon) {
1442
+ attrs["aria-label"] = props["aria-label"] || props.children;
1443
+ attrs.title = props.title || attrs["aria-label"];
1444
+ attrs.className += props.iconOnly ? " wbi-icon-only" : " wbi-icon-text";
1445
+ }
1446
+ return h2(
1447
+ "button",
1448
+ attrs,
1449
+ props.icon ? h2(Icon3, { name: props.icon }) : null,
1450
+ props.iconOnly ? null : props.icon ? h2("span", { className: "wbi-btn-label" }, props.children) : props.children
1451
+ );
1452
+ }
1453
+ function Skeleton(props) {
1454
+ var label = props.label || tr(props.lang, "\u8BFB\u53D6\u4E2D\u2026", "Loading\u2026");
1455
+ return h2(
1456
+ "div",
1457
+ { className: "wbi-root wbi-grid wbi-skeleton", role: "status", "aria-label": label, "aria-busy": true },
1458
+ h2("span", { className: "wbi-sr" }, label),
1459
+ [0, 1, 2].map(function(i) {
1460
+ return h2(
1461
+ "div",
1462
+ { key: i, className: "wbi-card wbi-skeleton-card", "aria-hidden": true },
1463
+ h2("div", { className: "wbi-sk" }),
1464
+ h2("div", { className: "wbi-sk" }),
1465
+ h2("div", { className: "wbi-sk" })
1466
+ );
1467
+ })
1468
+ );
1469
+ }
1470
+ function ErrorBox(props) {
1471
+ return props.error ? h2("div", { className: "wbi-error", role: "alert" }, String(props.error.message || props.error)) : null;
1472
+ }
1473
+ function safeImage(url) {
1474
+ try {
1475
+ var u = new URL(url);
1476
+ return /^(https?:)$/.test(u.protocol) && !u.username && !u.password ? u.href : "";
1477
+ } catch (_) {
1478
+ return "";
1479
+ }
1480
+ }
1481
+ function Modal(props) {
1482
+ var ref = React.useRef(null);
1483
+ React.useEffect(function() {
1484
+ var previous = document.activeElement;
1485
+ if (ref.current) ref.current.focus();
1486
+ return function() {
1487
+ if (previous && previous.isConnected) previous.focus();
1488
+ };
1489
+ }, []);
1490
+ function key(e) {
1491
+ if (e.key === "Escape") {
1492
+ e.preventDefault();
1493
+ e.stopPropagation();
1494
+ if (props.onClose) props.onClose();
1495
+ return;
1496
+ }
1497
+ if (e.key !== "Tab") return;
1498
+ var els = ref.current.querySelectorAll(
1499
+ "button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href]"
1500
+ );
1501
+ if (!els.length) {
1502
+ e.preventDefault();
1503
+ return;
1504
+ }
1505
+ var first = els[0], last = els[els.length - 1];
1506
+ if (e.shiftKey && (document.activeElement === first || document.activeElement === ref.current)) {
1507
+ e.preventDefault();
1508
+ last.focus();
1509
+ }
1510
+ if (!e.shiftKey && document.activeElement === last) {
1511
+ e.preventDefault();
1512
+ first.focus();
1513
+ }
1514
+ }
1515
+ return h2(
1516
+ "div",
1517
+ {
1518
+ className: "wbi-mask",
1519
+ onMouseDown: function(e) {
1520
+ if (e.target === e.currentTarget && props.onClose) props.onClose();
1521
+ }
1522
+ },
1523
+ h2(
1524
+ "section",
1525
+ {
1526
+ className: "wbi-modal",
1527
+ role: "dialog",
1528
+ "aria-modal": true,
1529
+ "aria-label": props.title,
1530
+ ref,
1531
+ tabIndex: -1,
1532
+ onKeyDown: key
1533
+ },
1534
+ h2(
1535
+ "header",
1536
+ { className: "wbi-row" },
1537
+ h2("h2", null, props.title),
1538
+ h2("span", { className: "wbi-grow" }),
1539
+ h2(Button, { icon: "close", iconOnly: true, onClick: props.onClose, disabled: !props.onClose, "aria-label": "\u5173\u95ED / Close" }, "\xD7")
1540
+ ),
1541
+ props.children
1542
+ )
1543
+ );
1544
+ }
1545
+ module2.exports = { Icon: Icon3, Skeleton, h: h2, call, tr, Button, ErrorBox, Modal, safeImage };
1546
+ }
1547
+ });
1548
+
1549
+ // packages/addons/storage/client/views/stats.cjs
1550
+ var require_stats = __commonJS({
1551
+ "packages/addons/storage/client/views/stats.cjs"(exports2, module2) {
1552
+ var React = require("react");
1553
+ var ui = require_ui();
1554
+ var h2 = ui.h;
1555
+ var tr = ui.tr;
1556
+ function Stats(props) {
1557
+ var data = React.useState(null), error = React.useState(null), tick = React.useState(0), busy = React.useState(false), lang = props.lang;
1558
+ React.useEffect(
1559
+ function() {
1560
+ var active = true;
1561
+ busy[1](true);
1562
+ error[1](null);
1563
+ ui.call(props.api, "storage.stats").then(function(r) {
1564
+ if (active) data[1](r);
1565
+ }).catch(function(e) {
1566
+ if (active) error[1](e);
1567
+ }).finally(function() {
1568
+ if (active) busy[1](false);
1569
+ });
1570
+ return function() {
1571
+ active = false;
1572
+ };
1573
+ },
1574
+ [props.api, tick[0]]
1575
+ );
1576
+ var s = data[0];
1577
+ return h2(
1578
+ "div",
1579
+ { className: "wbi-root" },
1580
+ h2(
1581
+ "div",
1582
+ { className: "wbi-row" },
1583
+ h2("h2", null, h2(ui.Icon, { name: "chart", size: 16 }), tr(lang, "\u7EDF\u8BA1", "Statistics")),
1584
+ h2("span", { className: "wbi-grow" }),
1585
+ h2(
1586
+ ui.Button,
1587
+ {
1588
+ icon: "refresh",
1589
+ disabled: busy[0],
1590
+ onClick: function() {
1591
+ tick[1](tick[0] + 1);
1592
+ }
1593
+ },
1594
+ tr(lang, "\u5237\u65B0", "Refresh")
1595
+ )
1596
+ ),
1597
+ h2(ui.ErrorBox, { error: error[0] }),
1598
+ busy[0] ? h2(ui.Skeleton, { lang }) : null,
1599
+ s ? h2(
1600
+ React.Fragment,
1601
+ null,
1602
+ h2(
1603
+ "div",
1604
+ { className: "wbi-kpis" },
1605
+ [
1606
+ ["total", "\u7269\u54C1\u8BB0\u5F55", "Items"],
1607
+ ["tagged", "\u5DF2\u5173\u8054\u6807\u7B7E", "Tagged"],
1608
+ ["withImages", "\u9644\u6709\u56FE\u7247", "With images"]
1609
+ ].map(function(k) {
1610
+ return h2(
1611
+ "div",
1612
+ { className: "wbi-card", key: k[0] },
1613
+ h2("span", { className: "wbi-muted wbi-inline" }, h2(ui.Icon, { name: k[0] === "total" ? "stock" : k[0] === "tagged" ? "tag" : "image" }), tr(lang, k[1], k[2])),
1614
+ h2("strong", null, s[k[0]] === null ? "\u2014" : s[k[0]])
1615
+ );
1616
+ })
1617
+ ),
1618
+ h2(
1619
+ "p",
1620
+ { className: "wbi-notice" },
1621
+ tr(
1622
+ lang,
1623
+ "\u5E93\u5B58\u4EE5\u6587\u5B57\u8BB0\u5F55\uFF0C\u4E0D\u5BF9\u4E0D\u540C\u5355\u4F4D\u6216\u8303\u56F4\u6570\u91CF\u8FDB\u884C\u6C42\u548C\u3002",
1624
+ "Stock is stored as text; mixed units and ranges are not summed."
1625
+ )
1626
+ ),
1627
+ h2(
1628
+ "div",
1629
+ { className: "wbi-card" },
1630
+ h2("h3", null, h2(ui.Icon, { name: "clock" }), tr(lang, "\u6700\u8FD1\u66F4\u65B0", "Recently updated")),
1631
+ (s.recent || []).map(function(item) {
1632
+ return h2(
1633
+ "div",
1634
+ { key: item.id, className: "wbi-row" },
1635
+ h2("span", null, item.name),
1636
+ h2("span", { className: "wbi-grow" }),
1637
+ h2("span", { className: "wbi-muted" }, (item.stock || "\u2014") + " " + (item.unit || ""))
1638
+ );
1639
+ }),
1640
+ !s.total ? h2(
1641
+ "span",
1642
+ { className: "wbi-empty" },
1643
+ h2(ui.Icon, { name: "empty", size: 48 }),
1644
+ tr(lang, "\u8FD8\u6CA1\u6709\u7269\u54C1\uFF0C\u524D\u5F80\u8BB0\u5F55\u9875\u6DFB\u52A0", "No items yet. Add one in Records.")
1645
+ ) : null
1646
+ )
1647
+ ) : null
1648
+ );
1649
+ }
1650
+ module2.exports = { Stats };
1651
+ }
1652
+ });
1653
+
1654
+ // packages/addons/storage/client/modals/editor.cjs
1655
+ var require_editor = __commonJS({
1656
+ "packages/addons/storage/client/modals/editor.cjs"(exports2, module2) {
1657
+ var React = require("react");
1658
+ var ui = require_ui();
1659
+ var h2 = ui.h;
1660
+ var tr = ui.tr;
1661
+ function Editor(props) {
1662
+ var item = props.item || {}, lang = props.lang;
1663
+ var state = React.useState(function() {
1664
+ return {
1665
+ name: item.name || "",
1666
+ brand: item.brand || "",
1667
+ unit: item.unit || "",
1668
+ stock: item.stock || "",
1669
+ location: item.location || "",
1670
+ remark: item.remark || "",
1671
+ images: (item.imgList || []).join("\n"),
1672
+ tagIds: (item.tagIds || (item.tags || []).map(function(t) {
1673
+ return t.id;
1674
+ })).slice()
1675
+ };
1676
+ });
1677
+ var form = state[0], setForm = state[1];
1678
+ var err = React.useState(null), busy = React.useState(false), query = React.useState(""), options = React.useState(item.tags || []);
1679
+ var selected = React.useState(item.tags || []);
1680
+ React.useEffect(
1681
+ function() {
1682
+ if (!props.tagsEnabled) return;
1683
+ var active = true;
1684
+ var timer = setTimeout(function() {
1685
+ ui.call(props.api, "storageTags.search", { text: query[0], pageSize: 50 }).then(function(r) {
1686
+ if (active) options[1](r.records || []);
1687
+ }).catch(function(e) {
1688
+ if (active) err[1](e);
1689
+ });
1690
+ }, 200);
1691
+ return function() {
1692
+ active = false;
1693
+ clearTimeout(timer);
1694
+ };
1695
+ },
1696
+ [query[0], props.tagsEnabled, props.api]
1697
+ );
1698
+ function update(k, v) {
1699
+ setForm(function(f) {
1700
+ return Object.assign({}, f, { [k]: v });
1701
+ });
1702
+ }
1703
+ function field(k, zh, en, wide, textarea) {
1704
+ return h2(
1705
+ "label",
1706
+ { className: "wbi-field" + (wide ? " wbi-wide" : "") },
1707
+ h2("span", null, tr(lang, zh, en)),
1708
+ h2(textarea ? "textarea" : "input", {
1709
+ name: k,
1710
+ value: form[k],
1711
+ required: k === "name",
1712
+ disabled: busy[0],
1713
+ onChange: function(e) {
1714
+ update(k, e.target.value);
1715
+ }
1716
+ })
1717
+ );
1718
+ }
1719
+ function save(e) {
1720
+ e.preventDefault();
1721
+ if (busy[0]) return;
1722
+ var images = form.images.split(/\r?\n/).map(function(s) {
1723
+ return s.trim();
1724
+ }).filter(Boolean);
1725
+ if (images.some(function(s) {
1726
+ return !ui.safeImage(s);
1727
+ })) {
1728
+ err[1](tr(lang, "\u56FE\u7247\u5730\u5740\u5FC5\u987B\u662F\u5B8C\u6574\u7684 HTTP(S) URL", "Images must use full HTTP(S) URLs"));
1729
+ return;
1730
+ }
1731
+ if (!form.name.trim()) {
1732
+ err[1](tr(lang, "\u8BF7\u586B\u5199\u7269\u54C1\u540D\u79F0", "Enter an item name"));
1733
+ return;
1734
+ }
1735
+ var args = {
1736
+ name: form.name.trim(),
1737
+ brand: form.brand,
1738
+ unit: form.unit,
1739
+ stock: form.stock,
1740
+ location: form.location,
1741
+ remark: form.remark,
1742
+ imgList: images
1743
+ };
1744
+ if (item.id) args.id = item.id;
1745
+ if (props.tagsEnabled) args.tagIds = form.tagIds;
1746
+ busy[1](true);
1747
+ err[1](null);
1748
+ ui.call(props.api, item.id ? "storage.update" : "storage.create", args).then(function() {
1749
+ props.onSaved();
1750
+ }).catch(err[1]).finally(function() {
1751
+ busy[1](false);
1752
+ });
1753
+ }
1754
+ var candidates = /* @__PURE__ */ new Map();
1755
+ selected[0].concat(options[0]).forEach(function(t) {
1756
+ candidates.set(t.id, t);
1757
+ });
1758
+ return h2(
1759
+ ui.Modal,
1760
+ {
1761
+ title: item.id ? tr(lang, "\u7F16\u8F91\u7269\u54C1", "Edit item") : tr(lang, "\u65B0\u589E\u7269\u54C1", "New item"),
1762
+ onClose: busy[0] ? null : props.onClose
1763
+ },
1764
+ h2(ui.ErrorBox, { error: err[0] }),
1765
+ h2(
1766
+ "form",
1767
+ { onSubmit: save },
1768
+ h2(
1769
+ "div",
1770
+ { className: "wbi-form" },
1771
+ field("name", "\u540D\u79F0 *", "Name *", true),
1772
+ field("brand", "\u54C1\u724C", "Brand"),
1773
+ field("unit", "\u5355\u4F4D", "Unit"),
1774
+ field("stock", "\u5E93\u5B58\uFF08\u53EF\u586B\u5199 1~2 \u7B49\u6587\u5B57\uFF09", "Stock (text such as 1\u20132)", true),
1775
+ field("location", "\u5B58\u653E\u4F4D\u7F6E", "Location"),
1776
+ field("remark", "\u5907\u6CE8", "Notes", true, true),
1777
+ field("images", "\u56FE\u7247 URL\uFF08\u6BCF\u884C\u4E00\u4E2A\uFF09", "Image URLs (one per line)", true, true),
1778
+ h2(
1779
+ "div",
1780
+ { className: "wbi-field wbi-wide" },
1781
+ h2("span", null, tr(lang, "\u6807\u7B7E", "Tags")),
1782
+ props.tagsEnabled ? h2(
1783
+ React.Fragment,
1784
+ null,
1785
+ h2("input", {
1786
+ type: "search",
1787
+ placeholder: tr(lang, "\u641C\u7D22\u5DF2\u6709\u6807\u7B7E", "Search existing tags"),
1788
+ "aria-label": tr(lang, "\u641C\u7D22\u5DF2\u6709\u6807\u7B7E", "Search existing tags"),
1789
+ value: query[0],
1790
+ disabled: busy[0],
1791
+ onChange: function(e) {
1792
+ query[1](e.target.value);
1793
+ }
1794
+ }),
1795
+ h2(
1796
+ "div",
1797
+ { className: "wbi-tagoptions" },
1798
+ Array.from(candidates.values()).map(function(t) {
1799
+ return h2(
1800
+ "label",
1801
+ { key: t.id },
1802
+ h2("input", {
1803
+ type: "checkbox",
1804
+ checked: form.tagIds.includes(t.id),
1805
+ disabled: busy[0],
1806
+ onChange: function(e) {
1807
+ var checked = e.target.checked;
1808
+ update(
1809
+ "tagIds",
1810
+ checked ? form.tagIds.concat(t.id) : form.tagIds.filter(function(id) {
1811
+ return id !== t.id;
1812
+ })
1813
+ );
1814
+ selected[1](function(tags) {
1815
+ return checked ? tags.filter(function(x) {
1816
+ return x.id !== t.id;
1817
+ }).concat(t) : tags.filter(function(x) {
1818
+ return x.id !== t.id;
1819
+ });
1820
+ });
1821
+ }
1822
+ }),
1823
+ t.name
1824
+ );
1825
+ })
1826
+ ),
1827
+ !candidates.size ? h2(
1828
+ "span",
1829
+ { className: "wbi-muted" },
1830
+ tr(lang, "\u6682\u65E0\u6807\u7B7E\uFF0C\u53EF\u5728\u6807\u7B7E\u63D2\u4EF6\u4E2D\u521B\u5EFA", "No tags. Create them in the Tags plugin.")
1831
+ ) : null
1832
+ ) : h2(
1833
+ "span",
1834
+ { className: "wbi-muted" },
1835
+ tr(lang, "\u6807\u7B7E\u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u4FDD\u5B58\u65F6\u4FDD\u7559\u539F\u6709\u5173\u8054", "Tags unavailable; existing links are preserved.")
1836
+ )
1837
+ )
1838
+ ),
1839
+ h2(
1840
+ "div",
1841
+ { className: "wbi-formfoot" },
1842
+ h2(ui.Button, { onClick: props.onClose, disabled: busy[0] }, tr(lang, "\u53D6\u6D88", "Cancel")),
1843
+ h2(
1844
+ ui.Button,
1845
+ { type: "submit", disabled: busy[0], className: "wbi-btn wbi-primary" },
1846
+ busy[0] ? tr(lang, "\u4FDD\u5B58\u4E2D\u2026", "Saving\u2026") : tr(lang, "\u4FDD\u5B58", "Save")
1847
+ )
1848
+ )
1849
+ )
1850
+ );
1851
+ }
1852
+ module2.exports = { Editor };
1853
+ }
1854
+ });
1855
+
1856
+ // packages/addons/storage/client/item/card.cjs
1857
+ var require_card = __commonJS({
1858
+ "packages/addons/storage/client/item/card.cjs"(exports2, module2) {
1859
+ var React = require("react");
1860
+ var ui = require_ui();
1861
+ var h2 = ui.h;
1862
+ var tr = ui.tr;
1863
+ var Description = require_description().Description;
1864
+ function StorageCard(props) {
1865
+ var item = props.item, lang = props.lang, gallery = React.useState(false);
1866
+ var images = (item.imgList || []).filter(ui.safeImage), tags = item.tags || [];
1867
+ var shown = gallery[0] ? images : images.slice(0, 1);
1868
+ var hasStock = item.stock != null && item.stock !== "";
1869
+ var meta = [
1870
+ item.brand && tr(lang, "\u54C1\u724C\uFF1A", "Brand: ") + item.brand,
1871
+ item.unit && tr(lang, "\u5355\u4F4D\uFF1A", "Unit: ") + item.unit,
1872
+ item.location && tr(lang, "\u4F4D\u7F6E\uFF1A", "Location: ") + item.location
1873
+ ].filter(Boolean);
1874
+ return h2(
1875
+ "article",
1876
+ {
1877
+ className: "wbi-card" + (props.selectionMode ? " wbi-selectable" : "") + (props.checked ? " wbi-selected" : ""),
1878
+ onClickCapture: props.selectionMode ? function(e) {
1879
+ if (e.target.type === "checkbox") return;
1880
+ e.preventDefault();
1881
+ e.stopPropagation();
1882
+ if (!props.busy) props.onCheck(item.id, e.shiftKey);
1883
+ } : void 0
1884
+ },
1885
+ props.selectionMode ? h2("input", {
1886
+ type: "checkbox",
1887
+ className: "wbi-check",
1888
+ checked: !!props.checked,
1889
+ disabled: props.busy,
1890
+ "aria-label": tr(lang, "\u9009\u62E9 ", "Select ") + item.name,
1891
+ onClick: function(e) {
1892
+ e.stopPropagation();
1893
+ props.onCheck(item.id, e.shiftKey);
1894
+ },
1895
+ onChange: function() {
1896
+ }
1897
+ }) : null,
1898
+ h2(
1899
+ "div",
1900
+ { className: "wbi-cardhead" },
1901
+ h2("h3", null, item.name),
1902
+ h2(
1903
+ "span",
1904
+ { className: "wbi-stock" },
1905
+ h2(ui.Icon, { name: "stock", size: 16 }),
1906
+ h2("span", null, hasStock ? item.stock : "\u2014"),
1907
+ hasStock && item.unit ? h2("small", { className: "wbi-muted" }, item.unit) : null
1908
+ )
1909
+ ),
1910
+ tags.length ? h2("div", { className: "wbi-tags" }, tags.map(function(t) {
1911
+ return h2(ui.Button, {
1912
+ icon: "tag",
1913
+ key: t.id,
1914
+ className: "wbi-btn wbi-chip",
1915
+ disabled: !props.caps,
1916
+ title: tr(lang, "\u6309\u6B64\u6807\u7B7E\u7B5B\u9009", "Filter by this tag"),
1917
+ onClick: function() {
1918
+ props.onTag(t);
1919
+ }
1920
+ }, t.name);
1921
+ })) : null,
1922
+ meta.length || item.createTime || item.updateTime ? h2(
1923
+ "div",
1924
+ { className: "wbi-metazone" },
1925
+ meta.length ? h2(
1926
+ "div",
1927
+ { className: "wbi-muted" },
1928
+ item.brand ? h2("span", { className: "wbi-inline" }, h2(ui.Icon, { name: "brand", size: 11 }), meta[0]) : null,
1929
+ item.unit ? h2("span", { className: "wbi-inline" }, h2(ui.Icon, { name: "unit", size: 11 }), tr(lang, "\u5355\u4F4D\uFF1A", "Unit: ") + item.unit) : null,
1930
+ item.location ? h2("span", { className: "wbi-inline" }, h2(ui.Icon, { name: "location", size: 11 }), tr(lang, "\u4F4D\u7F6E\uFF1A", "Location: ") + item.location) : null
1931
+ ) : null,
1932
+ item.createTime || item.updateTime ? h2(
1933
+ "div",
1934
+ { className: "wbi-meta" },
1935
+ item.createTime ? h2("span", null, tr(lang, "\u521B\u5EFA ", "Created ") + props.date(item.createTime)) : null,
1936
+ item.updateTime ? h2("span", null, tr(lang, "\u66F4\u65B0 ", "Updated ") + props.date(item.updateTime)) : null
1937
+ ) : null
1938
+ ) : null,
1939
+ h2(Description, { text: item.remark, lang, bodyMode: props.bodyMode }),
1940
+ images.length ? h2("div", { className: "wbi-images" }, shown.map(function(url, i) {
1941
+ return h2(
1942
+ "button",
1943
+ {
1944
+ key: i,
1945
+ type: "button",
1946
+ className: "wbi-image",
1947
+ "aria-label": tr(lang, "\u9884\u89C8\u56FE\u7247 ", "Preview image ") + (i + 1),
1948
+ title: tr(lang, "\u9884\u89C8\u56FE\u7247 ", "Preview image ") + (i + 1),
1949
+ onClick: function() {
1950
+ props.onPreview({ url, name: item.name });
1951
+ }
1952
+ },
1953
+ h2(ui.Icon, { name: "image" }),
1954
+ h2("img", { src: url, alt: item.name + " " + (i + 1), loading: "lazy", referrerPolicy: "no-referrer" })
1955
+ );
1956
+ }), images.length > 1 ? h2(ui.Button, {
1957
+ className: "wbi-btn wbi-btn-sm wbi-ghost wbi-more",
1958
+ "aria-expanded": gallery[0],
1959
+ "aria-label": tr(lang, "\u5C55\u5F00\u6216\u6536\u8D77\u7269\u54C1\u56FE\u7247", "Expand or collapse item images"),
1960
+ onClick: function() {
1961
+ gallery[1](!gallery[0]);
1962
+ }
1963
+ }, gallery[0] ? tr(lang, "\u6536\u8D77", "Collapse") : "+" + (images.length - 1)) : null) : null,
1964
+ !props.selectionMode ? h2(
1965
+ "div",
1966
+ { className: "wbi-actions" },
1967
+ h2(ui.Button, {
1968
+ icon: "pencil",
1969
+ iconOnly: true,
1970
+ "aria-label": tr(lang, "\u7F16\u8F91 ", "Edit ") + item.name,
1971
+ className: "wbi-btn wbi-btn-sm wbi-ghost",
1972
+ disabled: props.busy,
1973
+ onClick: function() {
1974
+ props.onEdit(item);
1975
+ }
1976
+ }, tr(lang, "\u7F16\u8F91", "Edit")),
1977
+ h2(ui.Button, {
1978
+ icon: "trash",
1979
+ iconOnly: true,
1980
+ "aria-label": tr(lang, "\u5220\u9664 ", "Delete ") + item.name,
1981
+ className: "wbi-btn wbi-btn-sm wbi-ghost wbi-danger",
1982
+ disabled: props.busy,
1983
+ onClick: function() {
1984
+ props.onDelete(item);
1985
+ }
1986
+ }, tr(lang, "\u5220\u9664", "Delete"))
1987
+ ) : null
1988
+ );
1989
+ }
1990
+ module2.exports = { StorageCard };
1991
+ }
1992
+ });
1993
+
1994
+ // packages/addons/storage/client/ui/selection.cjs
1995
+ var require_selection = __commonJS({
1996
+ "packages/addons/storage/client/ui/selection.cjs"(exports2, module2) {
1997
+ var React = require("react");
1998
+ var ui = require_ui();
1999
+ var h2 = ui.h;
2000
+ var tr = ui.tr;
2001
+ function useSelection(scope, rows, blocked) {
2002
+ var mode = React.useState(false), state = React.useState({ scope, ids: [] }), anchor = React.useRef(null);
2003
+ var ids = state[0].scope === scope ? state[0].ids : [];
2004
+ function set(next) {
2005
+ state[1]({ scope, ids: next });
2006
+ }
2007
+ function exit() {
2008
+ mode[1](false);
2009
+ set([]);
2010
+ anchor.current = null;
2011
+ }
2012
+ React.useEffect(function() {
2013
+ set([]);
2014
+ anchor.current = null;
2015
+ }, [scope]);
2016
+ React.useEffect(function() {
2017
+ function key(e) {
2018
+ if (e.key === "Escape" && !e.defaultPrevented && !blocked) exit();
2019
+ }
2020
+ document.addEventListener("keydown", key);
2021
+ return function() {
2022
+ document.removeEventListener("keydown", key);
2023
+ };
2024
+ }, [scope, blocked]);
2025
+ return {
2026
+ mode: mode[0],
2027
+ ids,
2028
+ exit,
2029
+ enter: function() {
2030
+ set([]);
2031
+ anchor.current = null;
2032
+ mode[1](true);
2033
+ },
2034
+ all: function() {
2035
+ if (!blocked) set(rows.map(function(r) {
2036
+ return r.id;
2037
+ }));
2038
+ },
2039
+ toggle: function(id, shift) {
2040
+ if (blocked) return;
2041
+ var next = new Set(ids), add = !next.has(id), range = [id];
2042
+ if (shift && anchor.current && anchor.current.scope === scope) {
2043
+ var a = rows.findIndex(function(r) {
2044
+ return r.id === anchor.current.id;
2045
+ });
2046
+ var b = rows.findIndex(function(r) {
2047
+ return r.id === id;
2048
+ });
2049
+ if (a >= 0 && b >= 0) range = rows.slice(Math.min(a, b), Math.max(a, b) + 1).map(function(r) {
2050
+ return r.id;
2051
+ });
2052
+ }
2053
+ range.forEach(function(v) {
2054
+ if (add) next.add(v);
2055
+ else next.delete(v);
2056
+ });
2057
+ anchor.current = { scope, id };
2058
+ set(Array.from(next));
2059
+ }
2060
+ };
2061
+ }
2062
+ function SelectionBar(p) {
2063
+ return h2(
2064
+ "div",
2065
+ { className: "wbi-selbar", role: "toolbar", "aria-label": tr(p.lang, "\u6279\u91CF\u64CD\u4F5C", "Bulk actions") },
2066
+ h2("span", { role: "status" }, tr(p.lang, "\u5DF2\u9009 ", "Selected ") + p.selection.ids.length),
2067
+ h2(ui.Button, { className: "wbi-btn wbi-btn-sm", disabled: p.busy || p.loading, onClick: p.selection.all }, tr(p.lang, "\u5168\u9009\u672C\u9875", "Select page")),
2068
+ h2(ui.Button, { className: "wbi-btn wbi-btn-sm", disabled: p.busy, onClick: p.selection.exit }, tr(p.lang, "\u9000\u51FA", "Exit")),
2069
+ h2("div", { className: "wbi-bulk-actions" }, p.children)
2070
+ );
2071
+ }
2072
+ function DeleteConfirmation(p) {
2073
+ return h2(
2074
+ ui.Modal,
2075
+ { title: tr(p.lang, "\u6279\u91CF\u5220\u9664\u7269\u54C1", "Delete selected items"), onClose: p.busy ? null : p.onClose },
2076
+ h2(ui.ErrorBox, { error: p.error }),
2077
+ h2("p", null, tr(p.lang, "\u5C06\u8F6F\u5220\u9664\u4EE5\u4E0B\u7269\u54C1\u3002\u5171 ", "Soft-delete these items. Total: ") + p.items.length + tr(p.lang, " \u6761", " items")),
2078
+ h2("ul", null, p.items.slice(0, 10).map(function(item) {
2079
+ return h2("li", { key: item.id }, item.name);
2080
+ })),
2081
+ p.items.length > 10 ? h2("p", null, tr(p.lang, "\u4EC5\u5C55\u793A\u524D 10 \u6761", "Showing first 10 items")) : null,
2082
+ h2("p", { className: "wbi-muted" }, tr(p.lang, "\u6807\u7B7E\u53EF\u7528\u65F6\u540C\u65F6\u79FB\u9664\u5173\u8054\uFF0C\u4E0D\u53EF\u7528\u65F6\u4FDD\u7559\u3002", "Tag links are removed when tags are available, otherwise preserved.")),
2083
+ h2(
2084
+ "div",
2085
+ { className: "wbi-formfoot" },
2086
+ h2(ui.Button, { className: "wbi-btn wbi-btn-sm", disabled: p.busy, onClick: p.onClose }, tr(p.lang, "\u53D6\u6D88", "Cancel")),
2087
+ h2(ui.Button, { className: "wbi-btn wbi-btn-sm wbi-danger", disabled: p.busy, onClick: p.onConfirm }, p.busy ? tr(p.lang, "\u5220\u9664\u4E2D\u2026", "Deleting\u2026") : tr(p.lang, "\u786E\u8BA4\u5220\u9664", "Confirm delete"))
2088
+ )
2089
+ );
2090
+ }
2091
+ module2.exports = { useSelection, SelectionBar, DeleteConfirmation };
2092
+ }
2093
+ });
2094
+
2095
+ // packages/addons/storage/client/views/records.cjs
2096
+ var require_records = __commonJS({
2097
+ "packages/addons/storage/client/views/records.cjs"(exports2, module2) {
2098
+ var React = require("react");
2099
+ var ui = require_ui();
2100
+ var Editor = require_editor().Editor;
2101
+ var h2 = ui.h;
2102
+ var tr = ui.tr;
2103
+ var StorageCard = require_card().StorageCard;
2104
+ var selection = require_selection();
2105
+ function Records(props) {
2106
+ var api = props.api, lang = props.lang;
2107
+ var items = React.useState(null), error = React.useState(null), loading = React.useState(true), query = React.useState(""), text = React.useState(""), page = React.useState(1), size = React.useState(12), sort = React.useState("update_time"), order = React.useState("desc"), tick = React.useState(0), editing = React.useState(null), deleting = React.useState(null), preview = React.useState(null), busy = React.useState(false), caps = React.useState(false), ready = React.useState(false), confirmDelete = React.useState(true), tag = React.useState(null), bulk = React.useState(null), bulkError = React.useState(null), notice = React.useState(""), pending = React.useRef(false), bodyMode = React.useState("markdown");
2108
+ var scope = JSON.stringify([query[0], text[0], page[0], size[0], sort[0], order[0], tag[0] && tag[0].id, tick[0]]);
2109
+ var rows = items[0] && items[0].scope === scope ? items[0].records : [];
2110
+ var selected = selection.useSelection(scope, rows, busy[0] || !!bulk[0]);
2111
+ function deleteSelected() {
2112
+ if (pending.current || !bulk[0] || !bulk[0].length) return;
2113
+ pending.current = true;
2114
+ busy[1](true);
2115
+ bulkError[1](null);
2116
+ ui.call(api, "storage.bulkDelete", { ids: bulk[0].map(function(r) {
2117
+ return r.id;
2118
+ }) }).then(function(r) {
2119
+ bulk[1](null);
2120
+ selected.exit();
2121
+ notice[1](tr(lang, "\u5DF2\u5220\u9664 ", "Deleted ") + r.deleted + tr(lang, " \u6761\uFF0C\u8DF3\u8FC7 ", " items; skipped ") + r.skipped);
2122
+ refresh();
2123
+ }).catch(bulkError[1]).finally(function() {
2124
+ pending.current = false;
2125
+ busy[1](false);
2126
+ });
2127
+ }
2128
+ React.useEffect(
2129
+ function() {
2130
+ var active = true;
2131
+ Promise.all([ui.call(api, "storage.configGet"), ui.call(api, "storage.capabilities")]).then(function(r) {
2132
+ if (!active) return;
2133
+ var v = r[0].values || {};
2134
+ size[1](v["list.pageSize"] || 12);
2135
+ sort[1](v["list.sortColumn"] || "update_time");
2136
+ order[1](v["list.sortOrder"] || "desc");
2137
+ confirmDelete[1](v["ui.confirmDelete"] !== false);
2138
+ caps[1](!!r[1].tags);
2139
+ bodyMode[1](v["ui.bodyMode"] === "text" ? "text" : "markdown");
2140
+ }).catch(function(e) {
2141
+ if (active) error[1](e);
2142
+ }).finally(function() {
2143
+ if (active) ready[1](true);
2144
+ });
2145
+ return function() {
2146
+ active = false;
2147
+ };
2148
+ },
2149
+ [api]
2150
+ );
2151
+ React.useEffect(
2152
+ function() {
2153
+ var t = setTimeout(function() {
2154
+ text[1](query[0]);
2155
+ page[1](1);
2156
+ }, 250);
2157
+ return function() {
2158
+ clearTimeout(t);
2159
+ };
2160
+ },
2161
+ [query[0]]
2162
+ );
2163
+ React.useEffect(
2164
+ function() {
2165
+ if (!ready[0] || query[0] !== text[0]) return;
2166
+ var active = true;
2167
+ loading[1](true);
2168
+ error[1](null);
2169
+ var args = { text: text[0], pageNumber: page[0], pageSize: size[0], sortColumn: sort[0], sortOrder: order[0] };
2170
+ if (tag[0]) args.tagIds = [tag[0].id];
2171
+ ui.call(api, "storage.list", args).then(function(r) {
2172
+ if (!active) return;
2173
+ if (page[0] > Math.max(1, r.pages || 1)) {
2174
+ page[1](Math.max(1, r.pages || 1));
2175
+ return;
2176
+ }
2177
+ items[1](Object.assign({}, r, { scope }));
2178
+ }).catch(function(e) {
2179
+ if (active) error[1](e);
2180
+ }).finally(function() {
2181
+ if (active) loading[1](false);
2182
+ });
2183
+ return function() {
2184
+ active = false;
2185
+ };
2186
+ },
2187
+ [api, ready[0], scope]
2188
+ );
2189
+ function refresh() {
2190
+ tick[1](function(n) {
2191
+ return n + 1;
2192
+ });
2193
+ }
2194
+ function remove(item) {
2195
+ busy[1](true);
2196
+ ui.call(api, "storage.delete", { id: item.id }).then(function() {
2197
+ deleting[1](null);
2198
+ refresh();
2199
+ }).catch(error[1]).finally(function() {
2200
+ busy[1](false);
2201
+ });
2202
+ }
2203
+ function date(v) {
2204
+ return v ? String(v).replace("T", " ").slice(0, 19) : "\u2014";
2205
+ }
2206
+ var data = items[0], pages = Math.max(1, data && data.pages || 1);
2207
+ return h2(
2208
+ "div",
2209
+ { className: "wbi-root" },
2210
+ h2(
2211
+ "div",
2212
+ { className: "wbi-row" },
2213
+ h2("h2", null, h2(ui.Icon, { name: "box", size: 16 }), tr(lang, "\u50A8\u7269", "Storage")),
2214
+ h2("span", { className: "wbi-muted" }, tr(lang, "\u8BB0\u5F55\u7269\u54C1\u3001\u5E93\u5B58\u4E0E\u5B58\u653E\u5907\u6CE8", "Track items, stock and notes")),
2215
+ h2("span", { className: "wbi-grow" }),
2216
+ h2(ui.Button, {
2217
+ icon: "check",
2218
+ className: "wbi-btn wbi-btn-sm",
2219
+ disabled: busy[0] || !!bulk[0],
2220
+ onClick: selected.mode ? selected.exit : selected.enter
2221
+ }, selected.mode ? tr(lang, "\u53D6\u6D88\u9009\u62E9", "Cancel selection") : tr(lang, "\u9009\u62E9", "Select")),
2222
+ h2(
2223
+ ui.Button,
2224
+ {
2225
+ icon: "plus",
2226
+ className: "wbi-btn wbi-primary",
2227
+ disabled: selected.mode || busy[0],
2228
+ onClick: function() {
2229
+ editing[1]({});
2230
+ }
2231
+ },
2232
+ tr(lang, "\u65B0\u589E\u7269\u54C1", "New item")
2233
+ )
2234
+ ),
2235
+ h2(
2236
+ "div",
2237
+ { className: "wbi-toolbar" },
2238
+ h2("input", {
2239
+ type: "search",
2240
+ value: query[0],
2241
+ placeholder: tr(lang, "\u641C\u7D22\u540D\u79F0\u3001\u54C1\u724C\u3001\u4F4D\u7F6E\u6216\u5907\u6CE8", "Search name, brand, location or notes"),
2242
+ "aria-label": tr(lang, "\u641C\u7D22\u7269\u54C1", "Search inventory"),
2243
+ onChange: function(e) {
2244
+ query[1](e.target.value);
2245
+ }
2246
+ }),
2247
+ h2(
2248
+ "select",
2249
+ {
2250
+ "aria-label": tr(lang, "\u6392\u5E8F\u5B57\u6BB5", "Sort field"),
2251
+ value: sort[0],
2252
+ onChange: function(e) {
2253
+ sort[1](e.target.value);
2254
+ page[1](1);
2255
+ }
2256
+ },
2257
+ [
2258
+ ["update_time", "\u6700\u8FD1\u66F4\u65B0", "Updated"],
2259
+ ["create_time", "\u521B\u5EFA\u65F6\u95F4", "Created"],
2260
+ ["name", "\u540D\u79F0", "Name"],
2261
+ ["brand", "\u54C1\u724C", "Brand"],
2262
+ ["stock", "\u5E93\u5B58\u6587\u672C", "Stock text"],
2263
+ ["location", "\u4F4D\u7F6E", "Location"]
2264
+ ].map(function(o) {
2265
+ return h2("option", { key: o[0], value: o[0] }, tr(lang, o[1], o[2]));
2266
+ })
2267
+ ),
2268
+ h2(
2269
+ ui.Button,
2270
+ {
2271
+ icon: "sort",
2272
+ onClick: function() {
2273
+ order[1](order[0] === "desc" ? "asc" : "desc");
2274
+ page[1](1);
2275
+ }
2276
+ },
2277
+ order[0] === "desc" ? tr(lang, "\u964D\u5E8F \u2193", "Descending \u2193") : tr(lang, "\u5347\u5E8F \u2191", "Ascending \u2191")
2278
+ ),
2279
+ h2(ui.Button, { icon: "refresh", onClick: refresh, disabled: loading[0] }, tr(lang, "\u5237\u65B0", "Refresh"))
2280
+ ),
2281
+ tag[0] ? h2(
2282
+ "div",
2283
+ { className: "wbi-row" },
2284
+ h2("span", { className: "wbi-chip" }, tag[0].name),
2285
+ h2(
2286
+ ui.Button,
2287
+ {
2288
+ onClick: function() {
2289
+ tag[1](null);
2290
+ page[1](1);
2291
+ }
2292
+ },
2293
+ tr(lang, "\u6E05\u9664\u6807\u7B7E\u7B5B\u9009", "Clear tag filter")
2294
+ )
2295
+ ) : null,
2296
+ selected.mode ? h2("p", { className: "wbi-muted" }, tr(
2297
+ lang,
2298
+ "\u4EC5\u9009\u62E9\u5F53\u524D\u9875\uFF1B\u641C\u7D22\u3001\u7B5B\u9009\u3001\u6392\u5E8F\u3001\u7FFB\u9875\u6216\u5237\u65B0\u4F1A\u6E05\u7A7A\u9009\u62E9\u3002Shift+\u70B9\u51FB\u8FDE\u9009\uFF0CEsc\u9000\u51FA\u3002",
2299
+ "Current page only. Search, filters, sorting, paging or refresh clear selection. Shift-click selects a range; Esc exits."
2300
+ )) : null,
2301
+ notice[0] ? h2("p", { role: "status" }, notice[0]) : null,
2302
+ h2(ui.ErrorBox, { error: error[0] }),
2303
+ loading[0] ? h2(ui.Skeleton, { lang }) : null,
2304
+ !loading[0] && !error[0] && data && !data.records.length ? h2(
2305
+ "div",
2306
+ { className: "wbi-empty" },
2307
+ h2(ui.Icon, { name: "empty", size: 48 }),
2308
+ text[0] || tag[0] ? tr(lang, "\u6CA1\u6709\u5339\u914D\u7684\u7269\u54C1\uFF0C\u8BD5\u8BD5\u5176\u4ED6\u641C\u7D22\u6761\u4EF6", "No matching items. Try another filter.") : tr(lang, "\u8FD8\u6CA1\u6709\u7269\u54C1\uFF0C\u70B9\u51FB\u201C\u65B0\u589E\u7269\u54C1\u201D\u5F00\u59CB\u8BB0\u5F55", "No items yet. Add your first item.")
2309
+ ) : null,
2310
+ h2(
2311
+ "div",
2312
+ { className: "wbi-grid", "aria-busy": loading[0] },
2313
+ !loading[0] && !error[0] && data ? rows.map(function(item) {
2314
+ return h2(StorageCard, {
2315
+ key: item.id,
2316
+ item,
2317
+ lang,
2318
+ bodyMode: bodyMode[0],
2319
+ caps: caps[0],
2320
+ busy: busy[0] || !!bulk[0],
2321
+ date,
2322
+ selectionMode: selected.mode,
2323
+ checked: selected.ids.includes(item.id),
2324
+ onCheck: selected.toggle,
2325
+ onTag: function(t) {
2326
+ tag[1](t);
2327
+ page[1](1);
2328
+ },
2329
+ onPreview: preview[1],
2330
+ onEdit: editing[1],
2331
+ onDelete: function(v) {
2332
+ if (confirmDelete[0]) deleting[1](v);
2333
+ else remove(v);
2334
+ }
2335
+ });
2336
+ }) : null
2337
+ ),
2338
+ data ? h2(
2339
+ "div",
2340
+ { className: "wbi-pager" },
2341
+ h2(
2342
+ "span",
2343
+ { className: "wbi-muted" },
2344
+ data.total + tr(lang, " \u6761\u7269\u54C1 \xB7 ", " items \xB7 ") + page[0] + " / " + pages
2345
+ ),
2346
+ h2(
2347
+ ui.Button,
2348
+ {
2349
+ disabled: page[0] <= 1 || loading[0],
2350
+ onClick: function() {
2351
+ page[1](page[0] - 1);
2352
+ }
2353
+ },
2354
+ tr(lang, "\u4E0A\u4E00\u9875", "Previous")
2355
+ ),
2356
+ h2(
2357
+ ui.Button,
2358
+ {
2359
+ disabled: page[0] >= pages || loading[0],
2360
+ onClick: function() {
2361
+ page[1](page[0] + 1);
2362
+ }
2363
+ },
2364
+ tr(lang, "\u4E0B\u4E00\u9875", "Next")
2365
+ ),
2366
+ h2(
2367
+ "select",
2368
+ {
2369
+ "aria-label": tr(lang, "\u6BCF\u9875\u6761\u6570", "Page size"),
2370
+ value: size[0],
2371
+ onChange: function(e) {
2372
+ size[1](Number(e.target.value));
2373
+ page[1](1);
2374
+ }
2375
+ },
2376
+ Array.from(/* @__PURE__ */ new Set([4, 12, 24, 50, size[0]])).sort(function(a, b) {
2377
+ return a - b;
2378
+ }).map(function(n) {
2379
+ return h2("option", { key: n, value: n }, n + tr(lang, " / \u9875", " / page"));
2380
+ })
2381
+ )
2382
+ ) : null,
2383
+ selected.mode ? h2(
2384
+ selection.SelectionBar,
2385
+ { selection: selected, lang, busy: busy[0] || !!bulk[0], loading: loading[0] },
2386
+ h2(ui.Button, {
2387
+ className: "wbi-btn wbi-btn-sm wbi-danger",
2388
+ disabled: !selected.ids.length || loading[0] || busy[0] || !!bulk[0],
2389
+ onClick: function() {
2390
+ bulkError[1](null);
2391
+ bulk[1](rows.filter(function(r) {
2392
+ return selected.ids.includes(r.id);
2393
+ }).map(function(r) {
2394
+ return { id: r.id, name: r.name };
2395
+ }));
2396
+ }
2397
+ }, tr(lang, "\u5220\u9664", "Delete"))
2398
+ ) : null,
2399
+ bulk[0] ? h2(selection.DeleteConfirmation, {
2400
+ items: bulk[0],
2401
+ lang,
2402
+ busy: busy[0],
2403
+ error: bulkError[0],
2404
+ onClose: function() {
2405
+ bulk[1](null);
2406
+ },
2407
+ onConfirm: deleteSelected
2408
+ }) : null,
2409
+ editing[0] ? h2(Editor, {
2410
+ api,
2411
+ lang,
2412
+ item: editing[0],
2413
+ tagsEnabled: caps[0],
2414
+ onClose: function() {
2415
+ editing[1](null);
2416
+ },
2417
+ onSaved: function() {
2418
+ editing[1](null);
2419
+ refresh();
2420
+ }
2421
+ }) : null,
2422
+ deleting[0] ? h2(
2423
+ ui.Modal,
2424
+ {
2425
+ title: tr(lang, "\u5220\u9664\u7269\u54C1", "Delete item"),
2426
+ onClose: busy[0] ? null : function() {
2427
+ deleting[1](null);
2428
+ }
2429
+ },
2430
+ h2(ui.ErrorBox, { error: error[0] }),
2431
+ h2(
2432
+ "p",
2433
+ null,
2434
+ tr(lang, "\u786E\u8BA4\u5220\u9664\u300C", "Delete \u201C") + deleting[0].name + tr(lang, "\u300D\uFF1F\u5C06\u8F6F\u5220\u9664\u8BB0\u5F55\u5E76\u79FB\u9664\u6807\u7B7E\u5173\u8054\u3002", "\u201D? This soft-deletes the record and removes tag links.")
2435
+ ),
2436
+ h2(
2437
+ "div",
2438
+ { className: "wbi-formfoot" },
2439
+ h2(
2440
+ ui.Button,
2441
+ {
2442
+ disabled: busy[0],
2443
+ onClick: function() {
2444
+ deleting[1](null);
2445
+ }
2446
+ },
2447
+ tr(lang, "\u53D6\u6D88", "Cancel")
2448
+ ),
2449
+ h2(
2450
+ ui.Button,
2451
+ {
2452
+ disabled: busy[0],
2453
+ className: "wbi-btn wbi-danger",
2454
+ onClick: function() {
2455
+ remove(deleting[0]);
2456
+ }
2457
+ },
2458
+ busy[0] ? tr(lang, "\u5220\u9664\u4E2D\u2026", "Deleting\u2026") : tr(lang, "\u786E\u8BA4\u5220\u9664", "Confirm delete")
2459
+ )
2460
+ )
2461
+ ) : null,
2462
+ preview[0] ? h2(
2463
+ ui.Modal,
2464
+ {
2465
+ title: preview[0].name,
2466
+ onClose: function() {
2467
+ preview[1](null);
2468
+ }
2469
+ },
2470
+ h2("img", {
2471
+ className: "wbi-preview",
2472
+ src: preview[0].url,
2473
+ alt: preview[0].name,
2474
+ referrerPolicy: "no-referrer"
2475
+ }),
2476
+ h2(
2477
+ "a",
2478
+ { href: preview[0].url, target: "_blank", rel: "noopener noreferrer" },
2479
+ tr(lang, "\u6253\u5F00\u539F\u56FE", "Open original")
2480
+ )
2481
+ ) : null
2482
+ );
2483
+ }
2484
+ module2.exports = { Records, StorageCard };
2485
+ }
2486
+ });
2487
+
2488
+ // packages/addons/storage/client/ui/config-copy.cjs
2489
+ var require_config_copy = __commonJS({
2490
+ "packages/addons/storage/client/ui/config-copy.cjs"(exports2, module2) {
2491
+ var COPY = {
2492
+ zh: {
2493
+ title: "\u914D\u7F6E",
2494
+ note: "\u8FD9\u4E9B\u504F\u597D\u53EA\u4FDD\u5B58\u5728\u672C\u673A\uFF0C\u4E0D\u53C2\u4E0E\u4E91\u7AEF\u540C\u6B65",
2495
+ loading: "\u8BFB\u53D6\u914D\u7F6E\u4E2D\u2026",
2496
+ loadFail: "\u914D\u7F6E\u670D\u52A1\u672A\u5C31\u7EEA\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
2497
+ retry: "\u91CD\u8BD5",
2498
+ saveFail: "\u4FDD\u5B58\u5931\u8D25\uFF1A",
2499
+ saved: "\u5DF2\u4FDD\u5B58",
2500
+ saving: "\u4FDD\u5B58\u4E2D\u2026",
2501
+ reset: "\u6062\u590D\u9ED8\u8BA4",
2502
+ resetAll: "\u5168\u90E8\u6062\u590D\u9ED8\u8BA4",
2503
+ resetting: "\u6062\u590D\u4E2D\u2026",
2504
+ modified: "\u5DF2\u4FEE\u6539",
2505
+ defaultValue: "\u9ED8\u8BA4",
2506
+ allDefault: "\u5168\u90E8\u4F7F\u7528\u9ED8\u8BA4\u503C",
2507
+ on: "\u5F00",
2508
+ off: "\u5173",
2509
+ empty: "\u6CA1\u6709\u53EF\u914D\u7F6E\u9879",
2510
+ confirmResetAll: "\u786E\u5B9A\u628A\u5168\u90E8\u914D\u7F6E\u6062\u590D\u9ED8\u8BA4\u503C\uFF1F",
2511
+ min: "\u6700\u5C0F",
2512
+ max: "\u6700\u5927"
2513
+ },
2514
+ en: {
2515
+ title: "Config",
2516
+ note: "Preferences stay on this machine; they are not synced to the cloud",
2517
+ loading: "Loading config\u2026",
2518
+ loadFail: "Config service not ready (plugin too old?)",
2519
+ retry: "Retry",
2520
+ saveFail: "Save failed: ",
2521
+ saved: "Saved",
2522
+ saving: "Saving\u2026",
2523
+ reset: "Reset",
2524
+ resetAll: "Reset all",
2525
+ resetting: "Resetting\u2026",
2526
+ modified: "Modified",
2527
+ defaultValue: "Default",
2528
+ allDefault: "All defaults",
2529
+ on: "On",
2530
+ off: "Off",
2531
+ empty: "Nothing to configure",
2532
+ confirmResetAll: "Reset every setting to its default?",
2533
+ min: "Min",
2534
+ max: "Max"
2535
+ }
2536
+ };
2537
+ module2.exports = COPY;
2538
+ }
2539
+ });
2540
+
2541
+ // packages/addons/storage/client/views/config.cjs
2542
+ var require_config = __commonJS({
2543
+ "packages/addons/storage/client/views/config.cjs"(exports2, module2) {
2544
+ var React = require("react");
2545
+ var h2 = React.createElement;
2546
+ var ui = require_ui();
2547
+ var DOMAIN = "storage";
2548
+ var PREFIX = "wbi";
2549
+ var COPY = require_config_copy();
2550
+ var CSS = [
2551
+ ".__P__-cfg{--cfg-line:var(--wb-line,var(--dsw-alias-border-l2,color-mix(in oklab,currentColor 16%,transparent)));--cfg-surface:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));--cfg-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 62%,transparent));--cfg-faint:var(--dsw-alias-label-tertiary,color-mix(in oklab,currentColor 42%,transparent));--cfg-hover:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent));display:flex;flex-direction:column;gap:16px;width:100%;min-width:0;padding-bottom:6px;color:inherit;font-size:13.5px}",
2552
+ ".__P__-cfg-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}",
2553
+ ".__P__-cfg-headmain{min-width:0}",
2554
+ ".__P__-cfg-head h2{margin:0;font-size:17px;font-weight:660;letter-spacing:.1px}",
2555
+ ".__P__-cfg-note{font-size:12px;color:var(--cfg-muted);margin-top:5px;line-height:1.6}",
2556
+ ".__P__-cfg-status{display:inline-flex;align-items:center;gap:7px;padding:5px 11px;border:1px solid var(--cfg-line);border-radius:999px;background:var(--cfg-surface);font-size:11.5px;color:var(--cfg-muted);max-width:100%;line-height:1.4}",
2557
+ ".__P__-cfg-status::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-state-success-primary,currentColor);flex:none}",
2558
+ ".__P__-cfg-status.err{color:var(--dsw-alias-state-error-primary,inherit);border-color:color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 35%,var(--cfg-line))}",
2559
+ ".__P__-cfg-status.err::before{background:var(--dsw-alias-state-error-primary,currentColor)}",
2560
+ ".__P__-cfg-group{border:1px solid var(--cfg-line);border-radius:14px;background:var(--cfg-surface);overflow:hidden;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
2561
+ ".__P__-cfg-gtitle{display:flex;align-items:center;gap:8px;padding:12px 18px;background:color-mix(in oklab,currentColor 3%,transparent);border-bottom:1px solid var(--cfg-line);font-size:12.5px;font-weight:660;letter-spacing:.1px}",
2562
+ ".__P__-cfg-gcount{margin-left:auto;font-size:11px;font-weight:500;color:var(--cfg-muted);font-variant-numeric:tabular-nums}",
2563
+ ".__P__-cfg-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(200px,300px);gap:28px;align-items:center;padding:15px 18px;border-top:1px solid color-mix(in oklab,currentColor 7%,transparent);transition:background .12s ease}",
2564
+ ".__P__-cfg-gtitle+.__P__-cfg-row{border-top:none}",
2565
+ ".__P__-cfg-row:hover{background:var(--cfg-hover)}",
2566
+ ".__P__-cfg-label{min-width:0}",
2567
+ ".__P__-cfg-name{display:flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;line-height:1.4;flex-wrap:wrap}",
2568
+ ".__P__-cfg-hint{font-size:12px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
2569
+ ".__P__-cfg-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var(--cfg-muted);margin-top:5px;letter-spacing:.2px;word-break:break-all}",
2570
+ ".__P__-cfg-control{display:flex;align-items:center;justify-content:flex-end;gap:8px;min-width:0;flex-wrap:wrap}",
2571
+ ".__P__-cfg-select,.__P__-cfg-input{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 11px;font:inherit;font-size:13px;line-height:1.4;outline:none;min-width:132px;max-width:100%;transition:border-color .15s ease,box-shadow .15s ease}",
2572
+ ".__P__-cfg-select:hover,.__P__-cfg-input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
2573
+ ".__P__-cfg-select:focus,.__P__-cfg-input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
2574
+ ".__P__-cfg-select{min-width:152px;padding-right:10px}",
2575
+ ".__P__-cfg-input{width:132px}",
2576
+ ".__P__-cfg-switch{position:relative;display:inline-flex;align-items:center;gap:9px;cursor:pointer;font-size:12.5px;color:var(--cfg-muted);user-select:none}",
2577
+ ".__P__-cfg-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
2578
+ ".__P__-cfg-track{position:relative;width:38px;height:22px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
2579
+ ".__P__-cfg-track::after{content:'';position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
2580
+ ".__P__-cfg-switch input:checked+.__P__-cfg-track{background:var(--dsw-alias-brand-primary,currentColor)}",
2581
+ ".__P__-cfg-switch input:checked+.__P__-cfg-track::after{transform:translateX(16px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
2582
+ ".__P__-cfg-switch input:focus-visible+.__P__-cfg-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
2583
+ ".__P__-cfg-multi{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end;max-width:100%}",
2584
+ ".__P__-cfg-multi label{position:relative;display:inline-flex;align-items:center;padding:5px 11px;border:1px solid var(--cfg-line);border-radius:999px;font-size:12px;color:var(--cfg-muted);cursor:pointer;line-height:1.4;transition:color .12s ease,border-color .12s ease,background .12s ease}",
2585
+ ".__P__-cfg-multi label:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
2586
+ ".__P__-cfg-multi input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
2587
+ ".__P__-cfg-multi label:has(input:checked){color:var(--dsw-alias-label-primary,inherit);border-color:color-mix(in oklab,currentColor 40%,var(--cfg-line));background:color-mix(in oklab,currentColor 7%,transparent);font-weight:600}",
2588
+ ".__P__-cfg-multi input:focus-visible+span{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px;border-radius:4px}",
2589
+ ".__P__-cfg-chip{font-size:10.5px;line-height:1.5;padding:1px 7px;border-radius:999px;background:color-mix(in oklab,currentColor 8%,transparent);color:var(--cfg-muted);font-weight:600;white-space:nowrap}",
2590
+ ".__P__-cfg-btn{display:inline-flex;align-items:center;gap:4px;border:none;min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm);background:var(--wb-btn-bg);color:var(--cfg-muted);border-radius:8px;padding:5px 9px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease,border-color .12s ease}",
2591
+ ".__P__-cfg-btn:enabled:hover{background:var(--wb-btn-hover-bg);color:var(--dsw-alias-label-primary,inherit)}.__P__-cfg-btn:enabled:active{background:var(--wb-btn-active-bg)}",
2592
+ ".__P__-cfg-btn:focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}",
2593
+ ".__P__-cfg-btn:disabled{opacity:.45;cursor:not-allowed}",
2594
+ ".__P__-cfg-btn-outline{color:var(--dsw-alias-label-primary,inherit)}",
2595
+ ".__P__-cfg-foot{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:2px 2px 0;min-height:32px}",
2596
+ ".__P__-cfg-changed{font-size:12px;color:var(--cfg-muted)}",
2597
+ ".__P__-cfg-grow{flex:1}",
2598
+ ".__P__-cfg-loading{display:flex;flex-direction:column;gap:10px;padding:6px 2px}",
2599
+ ".__P__-cfg-sk{height:14px;border-radius:7px;background:var(--dsw-alias-bg-skeleton,color-mix(in oklab,currentColor 6%,transparent));animation:__P__-cfg-pulse 1.4s ease-in-out infinite}",
2600
+ ".__P__-cfg-sk:nth-child(3){width:72%}",
2601
+ ".__P__-cfg-sk:nth-child(4){width:48%}",
2602
+ "@keyframes __P__-cfg-pulse{0%,100%{opacity:.65}50%{opacity:1}}",
2603
+ ".__P__-cfg-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",
2604
+ ".__P__-cfg-empty{border:1px dashed var(--cfg-line);border-radius:14px;padding:40px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
2605
+ ".__P__-cfg-error{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:10px 13px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12.5px;line-height:1.5}",
2606
+ "@media (max-width:820px){.__P__-cfg-row{grid-template-columns:1fr;gap:10px;padding:13px 16px}.__P__-cfg-control{justify-content:flex-start}.__P__-cfg-multi{justify-content:flex-start}.__P__-cfg-gtitle{padding:11px 16px}}",
2607
+ "@media (prefers-reduced-motion:reduce){.__P__-cfg-track,.__P__-cfg-track::after,.__P__-cfg-sk{animation:none;transition:none}}"
2608
+ ].join("\n").split("__P__").join(PREFIX);
2609
+ function injectCss() {
2610
+ if (typeof document === "undefined") return;
2611
+ var old = document.getElementById("wb-addon-" + DOMAIN + "-config-css");
2612
+ if (old) {
2613
+ old.textContent = CSS;
2614
+ return;
2615
+ }
2616
+ var s = document.createElement("style");
2617
+ s.id = "wb-addon-" + DOMAIN + "-config-css";
2618
+ s.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
2619
+ s.textContent = CSS;
2620
+ document.head.appendChild(s);
2621
+ }
2622
+ function unwrap(r) {
2623
+ return r && r.result !== void 0 ? r.result : r;
2624
+ }
2625
+ function optionLabel(opt, lang) {
2626
+ return lang === "en" ? String(opt.en || opt.zh || opt.value) : String(opt.zh || opt.en || opt.value);
2627
+ }
2628
+ function sameValue(a, b) {
2629
+ return JSON.stringify(a) === JSON.stringify(b);
2630
+ }
2631
+ function useConfig(api, fallback) {
2632
+ var fb = fallback || {};
2633
+ var stateS = React.useState({
2634
+ ready: false,
2635
+ values: Object.assign({}, fb),
2636
+ items: [],
2637
+ groups: [],
2638
+ overrides: {},
2639
+ error: "",
2640
+ state: null
2641
+ });
2642
+ var state = stateS[0], setState = stateS[1];
2643
+ React.useEffect(
2644
+ function() {
2645
+ var alive = true;
2646
+ Promise.resolve(api.call(DOMAIN + ".configGet")).then(function(r) {
2647
+ if (!alive) return;
2648
+ var body = unwrap(r);
2649
+ if (r && r.ok === false) throw new Error(r && r.error || "load failed");
2650
+ if (!body || !body.values) throw new Error("empty config");
2651
+ setState({
2652
+ ready: true,
2653
+ values: Object.assign({}, fb, body.values),
2654
+ items: body.items || [],
2655
+ groups: body.groups || [],
2656
+ overrides: body.overrides || {},
2657
+ error: "",
2658
+ state: body
2659
+ });
2660
+ }).catch(function(e) {
2661
+ if (!alive) return;
2662
+ setState({
2663
+ ready: true,
2664
+ values: Object.assign({}, fb),
2665
+ items: [],
2666
+ groups: [],
2667
+ overrides: {},
2668
+ error: String(e && e.message || e),
2669
+ state: null
2670
+ });
2671
+ });
2672
+ return function() {
2673
+ alive = false;
2674
+ };
2675
+ },
2676
+ [api]
2677
+ );
2678
+ return state;
2679
+ }
2680
+ function ConfigView(props) {
2681
+ var api = props.api;
2682
+ var lang = props.lang === "en" ? "en" : "zh";
2683
+ var t = COPY[lang];
2684
+ var loadS = React.useState(true);
2685
+ var loading = loadS[0], setLoading = loadS[1];
2686
+ var stateS = React.useState(null);
2687
+ var state = stateS[0], setState = stateS[1];
2688
+ var errS = React.useState("");
2689
+ var err = errS[0], setErr = errS[1];
2690
+ var noticeS = React.useState({ id: "", text: "", error: false });
2691
+ var notice = noticeS[0], setNotice = noticeS[1];
2692
+ var savingS = React.useState("");
2693
+ var savingId = savingS[0], setSavingId = savingS[1];
2694
+ var draftsS = React.useState({});
2695
+ var drafts = draftsS[0], setDrafts = draftsS[1];
2696
+ var busyS = React.useState(false);
2697
+ var busy = busyS[0], setBusy = busyS[1];
2698
+ React.useEffect(function() {
2699
+ injectCss();
2700
+ }, []);
2701
+ var load = React.useCallback(
2702
+ function() {
2703
+ setLoading(true);
2704
+ return Promise.resolve(api.call(DOMAIN + ".configGet")).then(function(r) {
2705
+ var body2 = unwrap(r);
2706
+ if (r && r.ok === false) throw new Error(r && r.error || "load failed");
2707
+ setState(body2 || null);
2708
+ setErr("");
2709
+ setLoading(false);
2710
+ }).catch(function(e) {
2711
+ setErr(String(e && e.message || e));
2712
+ setLoading(false);
2713
+ });
2714
+ },
2715
+ [api]
2716
+ );
2717
+ React.useEffect(
2718
+ function() {
2719
+ load();
2720
+ },
2721
+ [load]
2722
+ );
2723
+ function setValueLocal(id, value) {
2724
+ setState(function(prev) {
2725
+ if (!prev) return prev;
2726
+ var values = Object.assign({}, prev.values);
2727
+ values[id] = value;
2728
+ var overrides = Object.assign({}, prev.overrides);
2729
+ overrides[id] = value;
2730
+ return Object.assign({}, prev, { values, overrides });
2731
+ });
2732
+ }
2733
+ function save(id, value) {
2734
+ var prevState = state;
2735
+ setSavingId(id);
2736
+ setNotice({ id, text: t.saving, error: false });
2737
+ setValueLocal(id, value);
2738
+ return Promise.resolve(
2739
+ api.call(DOMAIN + ".configSet", {
2740
+ values: (function() {
2741
+ var o = {};
2742
+ o[id] = value;
2743
+ return o;
2744
+ })()
2745
+ })
2746
+ ).then(function(r) {
2747
+ var body2 = unwrap(r);
2748
+ if (r && r.ok === false) throw new Error(r && r.error || "save failed");
2749
+ setSavingId("");
2750
+ if (body2 && body2.state) setState(body2.state);
2751
+ setNotice({ id, text: t.saved, error: false });
2752
+ }).catch(function(e) {
2753
+ setSavingId("");
2754
+ if (prevState) setState(prevState);
2755
+ setNotice({ id, text: t.saveFail + String(e && e.message || e), error: true });
2756
+ });
2757
+ }
2758
+ function resetItem(id) {
2759
+ var prevState = state;
2760
+ setBusy(true);
2761
+ setNotice({ id, text: t.resetting, error: false });
2762
+ return Promise.resolve(api.call(DOMAIN + ".configReset", { ids: [id] })).then(function(r) {
2763
+ var body2 = unwrap(r);
2764
+ if (r && r.ok === false) throw new Error(r && r.error || "reset failed");
2765
+ setBusy(false);
2766
+ if (body2 && body2.state) setState(body2.state);
2767
+ setNotice({ id, text: t.defaultValue, error: false });
2768
+ }).catch(function(e) {
2769
+ setBusy(false);
2770
+ if (prevState) setState(prevState);
2771
+ setNotice({ id, text: String(e && e.message || e), error: true });
2772
+ });
2773
+ }
2774
+ function resetAll() {
2775
+ if (typeof window !== "undefined" && window.confirm && !window.confirm(t.confirmResetAll)) return;
2776
+ var prevState = state;
2777
+ setBusy(true);
2778
+ setNotice({ id: "", text: t.resetting, error: false });
2779
+ Promise.resolve(api.call(DOMAIN + ".configReset", {})).then(function(r) {
2780
+ var body2 = unwrap(r);
2781
+ if (r && r.ok === false) throw new Error(r && r.error || "reset failed");
2782
+ setBusy(false);
2783
+ if (body2 && body2.state) setState(body2.state);
2784
+ setNotice({ id: "", text: t.allDefault, error: false });
2785
+ }).catch(function(e) {
2786
+ setBusy(false);
2787
+ if (prevState) setState(prevState);
2788
+ setNotice({ id: "", text: String(e && e.message || e), error: true });
2789
+ });
2790
+ }
2791
+ function commitDraft(item) {
2792
+ var raw = drafts[item.id];
2793
+ if (raw === void 0) return;
2794
+ var next = String(raw).trim();
2795
+ setDrafts(function(prev) {
2796
+ var copy = Object.assign({}, prev);
2797
+ delete copy[item.id];
2798
+ return copy;
2799
+ });
2800
+ if (next === "") return;
2801
+ var value = Number(next);
2802
+ if (!Number.isFinite(value)) return;
2803
+ if (sameValue(value, state.values[item.id])) return;
2804
+ save(item.id, value);
2805
+ }
2806
+ function renderControl(item) {
2807
+ var value = state.values[item.id];
2808
+ var label = lang === "en" ? item.en : item.zh;
2809
+ if (item.type === "bool") {
2810
+ return h2(
2811
+ "label",
2812
+ { className: PREFIX + "-cfg-switch" },
2813
+ h2("input", {
2814
+ type: "checkbox",
2815
+ checked: value === true,
2816
+ onChange: function(e) {
2817
+ save(item.id, e.target.checked);
2818
+ }
2819
+ }),
2820
+ h2("span", { className: PREFIX + "-cfg-track", "aria-hidden": "true" }),
2821
+ h2("span", { className: PREFIX + "-cfg-switchstate" }, value === true ? t.on : t.off)
2822
+ );
2823
+ }
2824
+ if (item.type === "enum") {
2825
+ return h2(
2826
+ "select",
2827
+ {
2828
+ className: PREFIX + "-cfg-select",
2829
+ value: String(value),
2830
+ onChange: function(e) {
2831
+ var hit = (item.options || []).filter(function(o) {
2832
+ return String(o.value) === e.target.value;
2833
+ })[0];
2834
+ if (hit) save(item.id, hit.value);
2835
+ }
2836
+ },
2837
+ (item.options || []).map(function(o) {
2838
+ return h2("option", { key: String(o.value), value: String(o.value) }, optionLabel(o, lang));
2839
+ })
2840
+ );
2841
+ }
2842
+ if (item.type === "int") {
2843
+ var draft = drafts[item.id] !== void 0 ? drafts[item.id] : String(value);
2844
+ return h2("input", {
2845
+ className: PREFIX + "-cfg-input",
2846
+ type: "number",
2847
+ value: draft,
2848
+ min: item.min,
2849
+ max: item.max,
2850
+ "aria-label": label,
2851
+ onChange: function(e) {
2852
+ var v = e.target.value;
2853
+ setDrafts(function(prev) {
2854
+ var c = Object.assign({}, prev);
2855
+ c[item.id] = v;
2856
+ return c;
2857
+ });
2858
+ },
2859
+ onBlur: function() {
2860
+ commitDraft(item);
2861
+ },
2862
+ onKeyDown: function(e) {
2863
+ if (e.key === "Enter") {
2864
+ e.preventDefault();
2865
+ commitDraft(item);
2866
+ }
2867
+ }
2868
+ });
2869
+ }
2870
+ if (item.type === "multi") {
2871
+ var picked = Array.isArray(value) ? value : [];
2872
+ return h2(
2873
+ "div",
2874
+ { className: PREFIX + "-cfg-multi" },
2875
+ (item.options || []).map(function(o) {
2876
+ var on = picked.indexOf(o.value) >= 0;
2877
+ return h2(
2878
+ "label",
2879
+ { key: String(o.value) },
2880
+ h2("input", {
2881
+ type: "checkbox",
2882
+ checked: on,
2883
+ onChange: function() {
2884
+ var next = picked.slice();
2885
+ if (on) {
2886
+ if (next.length <= 1) return;
2887
+ next = next.filter(function(x) {
2888
+ return x !== o.value;
2889
+ });
2890
+ } else next.push(o.value);
2891
+ save(item.id, next);
2892
+ }
2893
+ }),
2894
+ h2("span", null, optionLabel(o, lang))
2895
+ );
2896
+ })
2897
+ );
2898
+ }
2899
+ return h2("input", {
2900
+ className: PREFIX + "-cfg-input",
2901
+ type: "text",
2902
+ defaultValue: value === void 0 ? "" : String(value),
2903
+ onBlur: function(e) {
2904
+ if (!sameValue(e.target.value, value)) save(item.id, e.target.value);
2905
+ }
2906
+ });
2907
+ }
2908
+ var body = [];
2909
+ if (loading && !state)
2910
+ body.push(
2911
+ h2(ui.Skeleton, { key: "loading", lang })
2912
+ );
2913
+ if (!loading && err && !state) {
2914
+ body.push(
2915
+ h2(
2916
+ "div",
2917
+ { key: "err", className: PREFIX + "-cfg-error" },
2918
+ h2("span", null, t.loadFail + " " + err),
2919
+ h2("button", { type: "button", className: PREFIX + "-cfg-btn", onClick: load }, t.retry)
2920
+ )
2921
+ );
2922
+ }
2923
+ if (state) {
2924
+ var items = state.items || [];
2925
+ var groups = state.groups || [];
2926
+ var byGroup = {};
2927
+ items.forEach(function(item) {
2928
+ (byGroup[item.group] = byGroup[item.group] || []).push(item);
2929
+ });
2930
+ var order = groups.length ? groups : Object.keys(byGroup).map(function(id) {
2931
+ return { id, zh: id, en: id };
2932
+ });
2933
+ order.forEach(function(g) {
2934
+ var list = byGroup[g.id] || [];
2935
+ if (!list.length) return;
2936
+ body.push(
2937
+ h2(
2938
+ "section",
2939
+ { key: "g-" + g.id, className: PREFIX + "-cfg-group" },
2940
+ h2(
2941
+ "div",
2942
+ { className: PREFIX + "-cfg-gtitle" },
2943
+ h2(ui.Icon, { name: g.id === "list" ? "list" : "settings" }),
2944
+ h2("span", null, lang === "en" ? g.en : g.zh),
2945
+ h2("span", { className: PREFIX + "-cfg-gcount" }, list.length + (lang === "en" ? " items" : " \u9879"))
2946
+ ),
2947
+ list.map(function(item) {
2948
+ var overridden = state.overrides && state.overrides[item.id] !== void 0;
2949
+ var isSaving = savingId === item.id;
2950
+ return h2(
2951
+ "div",
2952
+ { key: item.id, className: PREFIX + "-cfg-row" },
2953
+ h2(
2954
+ "div",
2955
+ { className: PREFIX + "-cfg-label" },
2956
+ h2(
2957
+ "div",
2958
+ { className: PREFIX + "-cfg-name" },
2959
+ h2("span", null, lang === "en" ? item.en : item.zh),
2960
+ overridden ? h2("span", { className: PREFIX + "-cfg-chip" }, t.modified) : null,
2961
+ isSaving ? h2("span", { className: PREFIX + "-cfg-chip" }, t.saving) : null
2962
+ ),
2963
+ (lang === "en" ? item.hintEn : item.hintZh) ? h2("div", { className: PREFIX + "-cfg-hint" }, lang === "en" ? item.hintEn : item.hintZh) : null,
2964
+ h2("div", { className: PREFIX + "-cfg-id" }, item.id)
2965
+ ),
2966
+ h2(
2967
+ "div",
2968
+ { className: PREFIX + "-cfg-control" },
2969
+ renderControl(item),
2970
+ overridden ? h2(
2971
+ ui.Button,
2972
+ {
2973
+ icon: "reset",
2974
+ type: "button",
2975
+ className: PREFIX + "-cfg-btn",
2976
+ disabled: busy,
2977
+ onClick: function() {
2978
+ resetItem(item.id);
2979
+ },
2980
+ title: t.reset
2981
+ },
2982
+ t.reset
2983
+ ) : null
2984
+ )
2985
+ );
2986
+ })
2987
+ )
2988
+ );
2989
+ });
2990
+ if (!items.length && !loading) body.push(h2("div", { key: "empty", className: PREFIX + "-cfg-empty" }, t.empty));
2991
+ var anyOverride = Object.keys(state.overrides || {}).length > 0;
2992
+ body.push(
2993
+ h2(
2994
+ "div",
2995
+ { key: "foot", className: PREFIX + "-cfg-foot" },
2996
+ h2(
2997
+ "span",
2998
+ { className: PREFIX + "-cfg-changed" },
2999
+ anyOverride ? Object.keys(state.overrides || {}).length + (lang === "en" ? " changed" : " \u9879\u5DF2\u4FEE\u6539") : lang === "en" ? "All preferences are at their defaults" : "\u5168\u90E8\u914D\u7F6E\u5747\u4E3A\u9ED8\u8BA4\u503C"
3000
+ ),
3001
+ h2("span", { className: PREFIX + "-cfg-grow" }),
3002
+ anyOverride ? h2(
3003
+ ui.Button,
3004
+ {
3005
+ icon: "reset",
3006
+ type: "button",
3007
+ className: PREFIX + "-cfg-btn " + PREFIX + "-cfg-btn-outline",
3008
+ disabled: busy,
3009
+ onClick: resetAll
3010
+ },
3011
+ busy ? t.resetting : t.resetAll
3012
+ ) : null
3013
+ )
3014
+ );
3015
+ var warn = (state.warnings || []).filter(function(w) {
3016
+ return w && w.message;
3017
+ });
3018
+ if (warn.length) {
3019
+ body.push(
3020
+ h2(
3021
+ "div",
3022
+ { key: "warn", className: PREFIX + "-cfg-error" },
3023
+ h2(
3024
+ "span",
3025
+ null,
3026
+ warn.map(function(w) {
3027
+ return w.message;
3028
+ }).join("\uFF1B")
3029
+ )
3030
+ )
3031
+ );
3032
+ }
3033
+ }
3034
+ return h2(
3035
+ "div",
3036
+ { className: "wbi-root " + PREFIX + "-cfg" },
3037
+ h2(
3038
+ "div",
3039
+ { className: PREFIX + "-cfg-head" },
3040
+ h2(
3041
+ "div",
3042
+ { className: PREFIX + "-cfg-headmain" },
3043
+ h2("h2", null, h2(ui.Icon, { name: "settings", size: 16 }), t.title),
3044
+ h2("div", { className: PREFIX + "-cfg-note" }, h2(ui.Icon, { name: "database", size: 11 }), t.note)
3045
+ ),
3046
+ h2(ui.Button, { icon: "refresh", onClick: load, disabled: loading || busy }, ui.tr(lang, "\u5237\u65B0", "Refresh")),
3047
+ notice.text ? h2(
3048
+ "div",
3049
+ { key: "notice", className: PREFIX + "-cfg-status" + (notice.error ? " err" : ""), role: "status" },
3050
+ notice.text
3051
+ ) : null
3052
+ ),
3053
+ body
3054
+ );
3055
+ }
3056
+ module2.exports = { ConfigView, useConfig, DOMAIN };
3057
+ }
3058
+ });
3059
+
3060
+ // packages/addons/lib/data-copy.cjs
3061
+ var require_data_copy = __commonJS({
3062
+ "packages/addons/lib/data-copy.cjs"(exports2, module2) {
3063
+ "use strict";
3064
+ var COPY = {
3065
+ zh: {
3066
+ title: "\u6570\u636E",
3067
+ subtitle: "\u53EA\u8BFB\u6D4F\u89C8\u672C\u63D2\u4EF6\u8D1F\u8D23\u7684\u8868\uFF1B\u7CFB\u7EDF\u5217\u4E0E\u5DF2\u5220\u9664\u884C\u9ED8\u8BA4\u9690\u85CF",
3068
+ tables: "\u8868",
3069
+ rows: "\u884C",
3070
+ deleted: "\u5DF2\u5220\u9664",
3071
+ rowCount: "\u5171 {n} \u884C",
3072
+ deletedCount: "\u5176\u4E2D {n} \u884C\u5DF2\u5220\u9664",
3073
+ search: "\u641C\u7D22\u6240\u6709\u6587\u672C\u5217\u2026",
3074
+ pageSize: "\u6BCF\u9875",
3075
+ includeDeleted: "\u542B\u5DF2\u5220\u9664",
3076
+ showSystem: "\u7CFB\u7EDF\u5217",
3077
+ refresh: "\u5237\u65B0",
3078
+ loading: "\u8F7D\u5165\u4E2D\u2026",
3079
+ empty: "\u8FD9\u5F20\u8868\u8FD8\u6CA1\u6709\u6570\u636E",
3080
+ emptyTable: "\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u8868",
3081
+ loadFail: "\u6570\u636E\u670D\u52A1\u4E0D\u53EF\u7528\uFF08\u63D2\u4EF6\u7248\u672C\u8FC7\u65E7\uFF1F\uFF09",
3082
+ retry: "\u91CD\u8BD5",
3083
+ queryFail: "\u67E5\u8BE2\u5931\u8D25\uFF1A",
3084
+ noRows: "\u6CA1\u6709\u5339\u914D\u7684\u884C",
3085
+ prev: "\u4E0A\u4E00\u9875",
3086
+ next: "\u4E0B\u4E00\u9875",
3087
+ pageInfo: "\u7B2C {page} / {pages} \u9875",
3088
+ jump: "\u8DF3\u8F6C",
3089
+ total: "\u5171 {n} \u884C",
3090
+ copied: "\u5DF2\u590D\u5236",
3091
+ copy: "\u590D\u5236",
3092
+ close: "\u5173\u95ED",
3093
+ drawerTitle: "{column} \xB7 \u7B2C {row} \u884C",
3094
+ nullText: "NULL",
3095
+ emptyText: "\u7A7A",
3096
+ yes: "\u662F",
3097
+ no: "\u5426",
3098
+ json: "JSON",
3099
+ queryTime: "{n} ms",
3100
+ sortAsc: "\u5347\u5E8F",
3101
+ sortDesc: "\u964D\u5E8F",
3102
+ filterCol: "\u7B5B\u9009\u2026",
3103
+ filterClear: "\u6E05\u9664\u7B5B\u9009",
3104
+ index: "\u8868\u7D22\u5F15",
3105
+ indexSub: "\u5F53\u524D\u9009\u4E2D\u8868\u7684\u7D22\u5F15\uFF08\u53EA\u8BFB\uFF09\uFF1B\u884C\u6570\u4E3A\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
3106
+ idxName: "\u7D22\u5F15\u540D",
3107
+ idxColumns: "\u5217",
3108
+ idxType: "\u7C7B\u578B",
3109
+ idxSource: "\u6765\u6E90",
3110
+ idxUnique: "\u552F\u4E00",
3111
+ idxNormal: "\u666E\u901A",
3112
+ idxAuto: "\u81EA\u52A8",
3113
+ idxCreated: "\u663E\u5F0F\u521B\u5EFA",
3114
+ idxCount: "\u5171 {n} \u4E2A\u7D22\u5F15",
3115
+ idxNoExtra: "\u8BE5\u8868\u9664\u4E3B\u952E\u5916\u6CA1\u6709\u989D\u5916\u7D22\u5F15",
3116
+ idxRowsHelp: "\u6240\u5C5E\u8868\u603B\u884C\u6570\uFF08\u542B\u5DF2\u5220\u9664\u884C\uFF09\uFF0C\u4E0D\u662F\u7D22\u5F15\u6761\u76EE\u6570",
3117
+ idxTable: "\u8868",
3118
+ idxRows: "\u884C\u6570",
3119
+ idxCols: "\u5217\u6570",
3120
+ idxKey: "\u4E3B\u952E",
3121
+ idxIndexes: "\u7D22\u5F15",
3122
+ idxLastWrite: "\u6700\u8FD1\u5199\u5165",
3123
+ idxNone: "\u65E0",
3124
+ idxEmpty: "\u5F53\u524D\u8868\u6CA1\u6709\u53EF\u7528\u7684\u7D22\u5F15\u7EDF\u8BA1",
3125
+ idxTables: "\u8868",
3126
+ idxAt: "\u7EDF\u8BA1\u65F6\u95F4"
3127
+ },
3128
+ en: {
3129
+ title: "Data",
3130
+ subtitle: "Read-only view of this plugin's tables; system and deleted rows are hidden by default",
3131
+ tables: "Tables",
3132
+ rows: "rows",
3133
+ deleted: "deleted",
3134
+ rowCount: "{n} rows",
3135
+ deletedCount: "{n} deleted",
3136
+ search: "Search all text columns\u2026",
3137
+ pageSize: "Rows",
3138
+ includeDeleted: "Deleted",
3139
+ showSystem: "System",
3140
+ refresh: "Refresh",
3141
+ loading: "Loading\u2026",
3142
+ empty: "This table has no rows yet",
3143
+ emptyTable: "No tables to show",
3144
+ loadFail: "Data service unavailable (plugin too old?)",
3145
+ retry: "Retry",
3146
+ queryFail: "Query failed: ",
3147
+ noRows: "No matching rows",
3148
+ prev: "Previous",
3149
+ next: "Next",
3150
+ pageInfo: "Page {page} / {pages}",
3151
+ jump: "Jump",
3152
+ total: "{n} rows",
3153
+ copied: "Copied",
3154
+ copy: "Copy",
3155
+ close: "Close",
3156
+ drawerTitle: "{column} \xB7 row {row}",
3157
+ nullText: "NULL",
3158
+ emptyText: "empty",
3159
+ yes: "Yes",
3160
+ no: "No",
3161
+ json: "JSON",
3162
+ queryTime: "{n} ms",
3163
+ sortAsc: "ascending",
3164
+ sortDesc: "descending",
3165
+ filterCol: "Filter\u2026",
3166
+ filterClear: "Clear filter",
3167
+ index: "Table index",
3168
+ indexSub: "Indexes of the selected table (read-only); rows are the table total, not index entries",
3169
+ idxName: "Index name",
3170
+ idxColumns: "Columns",
3171
+ idxType: "Type",
3172
+ idxSource: "Source",
3173
+ idxUnique: "Unique",
3174
+ idxNormal: "Normal",
3175
+ idxAuto: "Automatic",
3176
+ idxCreated: "Explicit",
3177
+ idxCount: "{n} indexes",
3178
+ idxNoExtra: "This table has no indexes other than its primary key",
3179
+ idxRowsHelp: "Total table rows (including deleted rows), not index entries",
3180
+ idxTable: "Table",
3181
+ idxRows: "Rows",
3182
+ idxCols: "Cols",
3183
+ idxKey: "Primary key",
3184
+ idxIndexes: "Indexes",
3185
+ idxLastWrite: "Last write",
3186
+ idxNone: "\u2014",
3187
+ idxEmpty: "No index statistics available for this table",
3188
+ idxTables: "Tables",
3189
+ idxAt: "Generated"
3190
+ }
3191
+ };
3192
+ module2.exports = COPY;
3193
+ }
3194
+ });
3195
+
3196
+ // packages/addons/lib/data-style.cjs
3197
+ var require_data_style = __commonJS({
3198
+ "packages/addons/lib/data-style.cjs"(exports2, module2) {
3199
+ "use strict";
3200
+ module2.exports = function(DOMAIN, PREFIX) {
3201
+ var P = PREFIX + "-data";
3202
+ var CSS = [
3203
+ require_visual_tokens(),
3204
+ "." + P + "-search:has(.wbi-svg) input{padding-left:30px}." + P + "-search>.wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%)}",
3205
+ "." + P + "-btn{transition:background var(--wb-motion),border-color var(--wb-motion)}",
3206
+ "@media(max-width:480px){." + P + "-head>." + P + "-btn:has(.wbi-svg){width:32px;height:32px;padding:0;justify-content:center}." + P + "-head>." + P + "-btn:has(.wbi-svg) ." + P + "-btnlabel{display:none}}",
3207
+ "." + P + "{--cfg-line:var(--wb-border);--cfg-surface:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));--cfg-muted:var(--dsw-alias-label-secondary,color-mix(in oklab,currentColor 62%,transparent));--cfg-faint:var(--dsw-alias-label-tertiary,color-mix(in oklab,currentColor 42%,transparent));--cfg-hover:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent));display:grid;grid-template-columns:216px minmax(0,1fr);gap:16px;width:100%;min-width:0;color:inherit;font-size:13px;align-items:start}",
3208
+ "." + P + "-side{position:sticky;top:12px;display:flex;flex-direction:column;gap:3px;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:8px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
3209
+ "." + P + "-sidetitle{display:flex;align-items:center;justify-content:space-between;padding:6px 10px 8px;font-size:11px;font-weight:660;letter-spacing:.6px;text-transform:uppercase;color:var(--cfg-faint)}",
3210
+ "." + P + "-stab{display:flex;flex-direction:column;gap:3px;align-items:stretch;border:1px solid transparent;background:transparent;border-radius:9px;padding:8px 10px;font:inherit;color:inherit;text-align:left;cursor:pointer;position:relative;transition:background .12s ease,border-color .12s ease}",
3211
+ "." + P + "-stab:hover{background:var(--cfg-hover)}",
3212
+ "." + P + "-stab:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
3213
+ "." + P + "-stab.on{background:color-mix(in oklab,currentColor 6%,transparent);border-color:var(--cfg-line)}",
3214
+ "." + P + "-stab.on::before{content:'';position:absolute;left:-1px;top:9px;bottom:9px;width:2px;border-radius:2px;background:var(--dsw-alias-brand-primary,currentColor)}",
3215
+ "." + P + "-stabname{display:flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;line-height:1.4;min-width:0}",
3216
+ "." + P + "-stabname span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
3217
+ "." + P + "-sidetable{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10.5px;color:var(--cfg-muted);margin-top:3px;letter-spacing:.2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
3218
+ "." + P + "-sidecount{margin-left:auto;font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 8%,transparent);border-radius:999px;padding:1px 7px;flex:none}",
3219
+ "." + P + "-main{display:flex;flex-direction:column;gap:10px;min-width:0;border:1px solid var(--cfg-line);border-radius:var(--wb-radius-card);background:var(--cfg-surface);padding:14px 16px 12px;box-shadow:0 1px 2px color-mix(in oklab,currentColor 3%,transparent)}",
3220
+ "." + P + "-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}",
3221
+ "." + P + "-headmain{min-width:0;flex:1}",
3222
+ "." + P + "-head h2{margin:0;font-size:16px;font-weight:660;letter-spacing:.1px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
3223
+ "." + P + "-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;font-weight:500;color:var(--cfg-muted);background:color-mix(in oklab,currentColor 6%,transparent);border-radius:6px;padding:2px 6px}",
3224
+ "." + P + "-sub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55;margin-top:4px}",
3225
+ "." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:2px 0 4px}",
3226
+ "." + P + "-search{position:relative;flex:1;min-width:180px;max-width:340px}",
3227
+ "." + P + "-search input{width:100%;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:8px 11px;font:inherit;font-size:12.5px;outline:none;transition:border-color .15s ease,box-shadow .15s ease}",
3228
+ "." + P + "-search input:hover{border-color:color-mix(in oklab,currentColor 28%,var(--cfg-line))}",
3229
+ "." + P + "-search input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
3230
+ "." + P + "-select{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 10px;font:inherit;font-size:12px;outline:none}",
3231
+ "." + P + "-select:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
3232
+ "." + P + "-switch{position:relative;display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:12px;color:var(--cfg-muted);user-select:none;padding:4px 2px}",
3233
+ "." + P + "-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
3234
+ "." + P + "-track{position:relative;width:34px;height:20px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
3235
+ "." + P + "-track::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
3236
+ "." + P + "-switch input:checked+." + P + "-track{background:var(--dsw-alias-brand-primary,currentColor)}",
3237
+ "." + P + "-switch input:checked+." + P + "-track::after{transform:translateX(14px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
3238
+ "." + P + "-switch input:focus-visible+." + P + "-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
3239
+ "." + P + "-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--cfg-line);background:transparent;color:var(--cfg-muted);border-radius:8px;padding:6px 10px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}",
3240
+ "." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
3241
+ "." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
3242
+ "." + P + "-btn:disabled{opacity:.45;cursor:not-allowed}",
3243
+ "." + P + "-btn[aria-busy='true']{opacity:.6}",
3244
+ "." + P + "-tablewrap{overflow:auto;max-height:calc(100vh - 300px);border:1px solid var(--cfg-line);border-radius:11px;background:var(--dsw-alias-bg-base,transparent)}",
3245
+ "." + P + "-table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;font-size:12.5px}",
3246
+ "." + P + "-table th{position:sticky;top:0;z-index:2;background:var(--cfg-surface);border-bottom:1px solid var(--cfg-line);padding:0;text-align:left;font-weight:600;white-space:nowrap}",
3247
+ "." + P + "-thbtn{display:flex;align-items:baseline;gap:6px;width:100%;border:0;background:transparent;color:inherit;font:inherit;font-size:11.5px;font-weight:660;letter-spacing:.2px;padding:9px 12px;cursor:pointer;text-align:left;white-space:nowrap}",
3248
+ "." + P + "-thbtn:hover{background:var(--cfg-hover)}",
3249
+ "." + P + "-thbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:-2px}",
3250
+ "." + P + "-coltype{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:9.5px;font-weight:500;color:var(--cfg-faint);letter-spacing:.3px}",
3251
+ "." + P + "-sortmark{color:var(--dsw-alias-brand-primary,currentColor);font-size:10px}",
3252
+ "." + P + "-rownum{position:sticky;left:0;z-index:1;background:var(--cfg-surface);color:var(--cfg-faint);text-align:right;font-variant-numeric:tabular-nums;font-size:10.5px;padding:0 8px;width:1%;white-space:nowrap;border-right:1px solid color-mix(in oklab,currentColor 7%,transparent)}",
3253
+ "." + P + "-table thead ." + P + "-rownum{z-index:3}",
3254
+ "." + P + "-cell{padding:7px 12px;border-bottom:1px solid color-mix(in oklab,currentColor 6%,transparent);max-width:340px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:default;vertical-align:top}",
3255
+ "." + P + "-table tbody tr:hover ." + P + "-cell{background:var(--cfg-hover)}",
3256
+ "." + P + "-table tbody tr:nth-child(even) ." + P + "-cell,." + P + "-table tbody tr:nth-child(even) ." + P + "-rownum{background:color-mix(in oklab,currentColor 2.5%,transparent)}",
3257
+ "." + P + "-cell.num{text-align:right;font-variant-numeric:tabular-nums}",
3258
+ "." + P + "-cell.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
3259
+ "." + P + "-cell.null{color:var(--cfg-faint);font-style:italic}",
3260
+ "." + P + "-cell.json .v{color:var(--dsw-alias-brand-primary,inherit)}",
3261
+ "." + P + "-tr.deleted ." + P + "-cell,." + P + "-tr.deleted ." + P + "-rownum{opacity:.55}",
3262
+ "." + P + "-tr.deleted ." + P + "-cell .v{text-decoration:line-through;text-decoration-color:color-mix(in oklab,currentColor 35%,transparent)}",
3263
+ "." + P + "-delbadge{display:inline-block;margin-left:6px;font-size:9.5px;line-height:1.5;padding:0 5px;border-radius:999px;background:color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 14%,transparent);color:var(--dsw-alias-state-error-primary,inherit);vertical-align:middle}",
3264
+ "." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
3265
+ "." + P + "-grow{flex:1}",
3266
+ "." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
3267
+ "." + P + "-jump{width:56px;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:7px;padding:4px 7px;font:inherit;font-size:11.5px;text-align:right;outline:none}",
3268
+ "." + P + "-jump:focus{border-color:var(--dsw-alias-brand-primary,currentColor)}",
3269
+ "." + P + "-empty{border:1px dashed var(--cfg-line);border-radius:11px;padding:44px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
3270
+ "." + P + "-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:9px 12px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12px;line-height:1.5}",
3271
+ "." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
3272
+ "." + P + "-sk{height:26px;border-radius:4px;background:var(--dsw-alias-bg-skeleton,color-mix(in oklab,currentColor 6%,transparent));animation:" + PREFIX + "-data-pulse 1.4s ease-in-out infinite}",
3273
+ "@keyframes " + PREFIX + "-data-pulse{0%,100%{opacity:.6}50%{opacity:1}}",
3274
+ "." + P + "-toast{position:fixed;left:50%;bottom:26px;transform:translateX(-50%);z-index:40;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border:1px solid var(--cfg-line);border-radius:999px;padding:7px 14px;font-size:12px;color:var(--dsw-alias-label-primary,inherit);box-shadow:0 6px 24px color-mix(in oklab,currentColor 18%,transparent)}",
3275
+ "." + P + "-mask{position:fixed;inset:0;z-index:30;background:color-mix(in oklab,currentColor 26%,transparent)}",
3276
+ "." + P + "-drawer{position:fixed;top:0;right:0;bottom:0;z-index:31;width:min(520px,92vw);display:flex;flex-direction:column;gap:12px;background:var(--dsw-alias-bg-layer-1,var(--cfg-surface));border-left:1px solid var(--cfg-line);box-shadow:-8px 0 28px color-mix(in oklab,currentColor 16%,transparent);padding:18px 20px}",
3277
+ "." + P + "-drawer h3{margin:0;font-size:14px;font-weight:660;display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
3278
+ "." + P + "-drawer pre{margin:0;flex:1;overflow:auto;border:1px solid var(--cfg-line);border-radius:10px;background:var(--dsw-alias-bg-base,transparent);padding:12px 14px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;line-height:1.65;white-space:pre-wrap;word-break:break-word}",
3279
+ "." + P + "-drawerfoot{display:flex;gap:8px;justify-content:flex-end}",
3280
+ "." + P + "-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}",
3281
+ "@media (max-width:900px){." + P + "{grid-template-columns:minmax(0,1fr)}." + P + "-side{position:static;flex-direction:row;flex-wrap:wrap;gap:6px;padding:6px}." + P + "-sidetitle{display:none}." + P + "-stab{padding:6px 10px;flex:none}." + P + "-sidecount{display:none}." + P + "-tablewrap{max-height:calc(100vh - 260px)}}",
3282
+ "@media (prefers-reduced-motion:reduce){." + P + " *,." + P + "-track,." + P + "-track::after,." + P + "-sk,." + P + "-drawer{transition:none;animation:none}}",
3283
+ "." + P + "-idxsub{font-size:11.5px;color:var(--cfg-muted);line-height:1.55}",
3284
+ "." + P + "-idxsum{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--cfg-muted)}",
3285
+ "." + P + "-idxsum b{font-weight:660;color:var(--dsw-alias-label-primary,inherit);font-variant-numeric:tabular-nums}",
3286
+ "." + P + "-idxtable{width:100%;table-layout:fixed}." + P + "-idxtable ." + P + "-cell{white-space:normal;overflow-wrap:anywhere;max-width:none}." + P + "-idxtable th:first-child{width:30%}." + P + "-idxtable th:nth-child(2){width:28%}",
3287
+ "." + P + "-idxtags{display:flex;flex-wrap:wrap;gap:4px;max-width:280px}",
3288
+ "." + P + "-idxchip{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:10px;line-height:1.6;border-radius:999px;padding:0 7px;background:color-mix(in oklab,currentColor 7%,transparent);color:var(--cfg-muted);white-space:nowrap}",
3289
+ "." + P + "-idxchip.u{background:color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 15%,transparent);color:var(--dsw-alias-brand-primary,inherit)}",
3290
+ "." + P + "-idxnone{color:var(--cfg-faint)}",
3291
+ "." + P + "-frow th{padding:0 8px 6px;border-bottom:1px solid var(--cfg-line)}",
3292
+ "." + P + "-fcell{position:relative;display:block;min-width:96px}",
3293
+ "." + P + "-finput{width:100%;box-sizing:border-box;border:1px solid transparent;border-radius:6px;background:color-mix(in oklab,currentColor 4%,transparent);color:inherit;font:inherit;font-size:11.5px;padding:3px 18px 3px 6px;min-width:0}",
3294
+ "." + P + "-finput:hover{background:color-mix(in oklab,currentColor 7%,transparent)}",
3295
+ "." + P + "-finput:focus{outline:none;border-color:var(--dsw-alias-brand-primary,currentColor);background:var(--cfg-surface)}",
3296
+ "." + P + "-fclear{position:absolute;right:2px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:var(--cfg-muted);cursor:pointer;font-size:13px;line-height:1;padding:2px 4px;border-radius:4px}",
3297
+ "." + P + "-fclear:hover{color:inherit;background:var(--cfg-hover)}",
3298
+ "." + P + "-emptycell{padding:22px 12px;text-align:center;color:var(--cfg-muted)}",
3299
+ "." + P + " *{box-sizing:border-box}",
3300
+ "." + P + "-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cfg-line);padding-bottom:9px}",
3301
+ "." + P + "-tabs [aria-selected=true]{background:var(--cfg-hover);color:inherit;font-weight:660}",
3302
+ "." + P + "-images{display:flex;gap:5px;align-items:center}",
3303
+ "." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
3304
+ "." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
3305
+ "." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
3306
+ ].join("\n");
3307
+ if (DOMAIN === "storage") {
3308
+ var buttons = "." + P + " :is(button)";
3309
+ CSS += buttons + "{border:none;background:var(--wb-btn-bg);min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}" + buttons + ":enabled:hover{background:var(--wb-btn-hover-bg)}" + buttons + ":enabled:active{background:var(--wb-btn-active-bg)}" + buttons + ":disabled{background:var(--wb-btn-bg);color:var(--cfg-muted)}" + buttons + ":focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}." + P + "-fcell:has(button) input{padding-right:34px}";
3310
+ }
3311
+ function injectCss() {
3312
+ if (typeof document === "undefined") return;
3313
+ var old = document.getElementById("wb-addon-" + DOMAIN + "-data-css");
3314
+ if (old) {
3315
+ old.textContent = CSS;
3316
+ return;
3317
+ }
3318
+ var style2 = document.createElement("style");
3319
+ style2.id = "wb-addon-" + DOMAIN + "-data-css";
3320
+ style2.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
3321
+ style2.textContent = CSS;
3322
+ document.head.appendChild(style2);
3323
+ }
3324
+ return injectCss;
3325
+ };
3326
+ }
3327
+ });
3328
+
3329
+ // packages/addons/lib/data-view.cjs
3330
+ var require_data_view = __commonJS({
3331
+ "packages/addons/lib/data-view.cjs"(exports2, module2) {
3332
+ "use strict";
3333
+ var React = require("react");
3334
+ var h2 = React.createElement;
3335
+ var COPY = require_data_copy();
3336
+ module2.exports = function createDataView(options) {
3337
+ var DOMAIN = options.domain;
3338
+ function icon(name) {
3339
+ return options.Icon ? h2(options.Icon, { name }) : null;
3340
+ }
3341
+ var P = options.prefix + "-data";
3342
+ var configView = { useConfig: options.useConfig };
3343
+ var columnHooks = options.columns || {};
3344
+ var injectCss = require_data_style()(DOMAIN, options.prefix);
3345
+ var CFG_FALLBACK = {
3346
+ "data.pageSize": 50,
3347
+ "data.showSystemColumns": false,
3348
+ "data.includeDeleted": false
3349
+ };
3350
+ var PAGE_SIZES = [10, 25, 50, 100, 200];
3351
+ function unwrap(r) {
3352
+ return r && r.result !== void 0 ? r.result : r;
3353
+ }
3354
+ function fmt(template, vars) {
3355
+ return String(template).replace(/\{(\w+)\}/g, function(m, key) {
3356
+ return vars[key] === void 0 ? m : String(vars[key]);
3357
+ });
3358
+ }
3359
+ function pad2(n) {
3360
+ return n < 10 ? "0" + n : String(n);
3361
+ }
3362
+ function timeText(ms) {
3363
+ var d = new Date(Number(ms));
3364
+ if (!Number.isFinite(d.getTime())) return String(ms);
3365
+ return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes());
3366
+ }
3367
+ function looksJson(value) {
3368
+ var text = String(value).trim();
3369
+ if (!text || text[0] !== "{" && text[0] !== "[") return false;
3370
+ try {
3371
+ JSON.parse(text);
3372
+ return true;
3373
+ } catch (e) {
3374
+ return false;
3375
+ }
3376
+ }
3377
+ function rawText(value, col) {
3378
+ if (value === null || value === void 0) return "";
3379
+ return String(value);
3380
+ }
3381
+ function DataView(props) {
3382
+ var api = props.api;
3383
+ var lang = props.lang === "en" ? "en" : "zh";
3384
+ var t = Object.assign({}, COPY[lang], { indexSub: fmt(COPY[lang].indexSub, { tables: options.tables.join(" / "), domain: DOMAIN }) });
3385
+ var cfgWrap = configView.useConfig(api, CFG_FALLBACK);
3386
+ var cfg = cfgWrap.values;
3387
+ var tablesS = React.useState(null);
3388
+ var tables = tablesS[0], setTables = tablesS[1];
3389
+ var activeS = React.useState("");
3390
+ var active = activeS[0], setActive = activeS[1];
3391
+ var dataS = React.useState(null);
3392
+ var data = dataS[0], setData = dataS[1];
3393
+ var loadingS = React.useState(false);
3394
+ var loadingRows = loadingS[0], setLoadingRows = loadingS[1];
3395
+ var loadingTablesS = React.useState(true);
3396
+ var loadingTables = loadingTablesS[0], setLoadingTables = loadingTablesS[1];
3397
+ var errorS = React.useState("");
3398
+ var error = errorS[0], setError = errorS[1];
3399
+ var pageS = React.useState(1);
3400
+ var page = pageS[0], setPage = pageS[1];
3401
+ var sizeS = React.useState(0);
3402
+ var pageSize = sizeS[0], setPageSize = sizeS[1];
3403
+ var sortS = React.useState("");
3404
+ var sort = sortS[0], setSort = sortS[1];
3405
+ var orderS = React.useState("desc");
3406
+ var order = orderS[0], setOrder = orderS[1];
3407
+ var searchDraftS = React.useState("");
3408
+ var searchDraft = searchDraftS[0], setSearchDraft = searchDraftS[1];
3409
+ var searchS = React.useState("");
3410
+ var search = searchS[0], setSearch = searchS[1];
3411
+ var filterDraftS = React.useState({});
3412
+ var filterDraft = filterDraftS[0], setFilterDraft = filterDraftS[1];
3413
+ var filtersS = React.useState({});
3414
+ var filters = filtersS[0], setFilters = filtersS[1];
3415
+ var includeDeletedS = React.useState(null);
3416
+ var includeDeletedRaw = includeDeletedS[0], setIncludeDeleted = includeDeletedS[1];
3417
+ var showSystemS = React.useState(null);
3418
+ var showSystemRaw = showSystemS[0], setShowSystem = showSystemS[1];
3419
+ var drawerS = React.useState(null);
3420
+ var drawer = drawerS[0], setDrawer = drawerS[1];
3421
+ var toastS = React.useState("");
3422
+ var toast = toastS[0], setToast = toastS[1];
3423
+ var filtersKey = JSON.stringify(filters);
3424
+ var reqRef = React.useRef(0);
3425
+ var toastTimer = React.useRef(null);
3426
+ var refreshS = React.useState(0);
3427
+ function refresh() {
3428
+ loadTables();
3429
+ refreshS[1](function(n) {
3430
+ return n + 1;
3431
+ });
3432
+ }
3433
+ var indexReqRef = React.useRef(0);
3434
+ var indexS = React.useState(null);
3435
+ var index = indexS[0], setIndex = indexS[1];
3436
+ var indexBusyS = React.useState(false);
3437
+ var indexBusy = indexBusyS[0], setIndexBusy = indexBusyS[1];
3438
+ var cfgSize = Number(cfg["data.pageSize"]) || 50;
3439
+ var size = pageSize || (PAGE_SIZES.indexOf(cfgSize) >= 0 ? cfgSize : 50);
3440
+ var includeDeleted = includeDeletedRaw === null ? cfg["data.includeDeleted"] === true : includeDeletedRaw;
3441
+ var showSystem = showSystemRaw === null ? cfg["data.showSystemColumns"] === true : showSystemRaw;
3442
+ function say(text) {
3443
+ setToast(text);
3444
+ if (toastTimer.current) clearTimeout(toastTimer.current);
3445
+ toastTimer.current = setTimeout(function() {
3446
+ setToast("");
3447
+ }, 1600);
3448
+ }
3449
+ function loadTables() {
3450
+ setLoadingTables(true);
3451
+ Promise.resolve(api.call(DOMAIN + ".dataTables")).then(function(r) {
3452
+ if (r && r.ok === false) throw new Error(r && r.error || t.loadFail);
3453
+ var body = unwrap(r);
3454
+ if (!body || !Array.isArray(body.tables)) throw new Error(t.loadFail);
3455
+ setTables(body.tables);
3456
+ setError("");
3457
+ if (!active && body.tables.length) setActive(body.tables[0].name);
3458
+ }).catch(function(e) {
3459
+ setError(String(e && e.message || e) || t.loadFail);
3460
+ }).then(function() {
3461
+ setLoadingTables(false);
3462
+ });
3463
+ }
3464
+ React.useEffect(function() {
3465
+ injectCss();
3466
+ loadTables();
3467
+ return function() {
3468
+ indexReqRef.current++;
3469
+ if (toastTimer.current) clearTimeout(toastTimer.current);
3470
+ };
3471
+ }, []);
3472
+ function selectTable(name) {
3473
+ if (name === active) return;
3474
+ reqRef.current++;
3475
+ setActive(name);
3476
+ setData(null);
3477
+ setDrawer(null);
3478
+ setError("");
3479
+ setLoadingRows(true);
3480
+ setPage(1);
3481
+ setSort("");
3482
+ setOrder("desc");
3483
+ setSearch("");
3484
+ setSearchDraft("");
3485
+ setFilterDraft({});
3486
+ setFilters({});
3487
+ }
3488
+ React.useEffect(function() {
3489
+ if (searchDraft === search) return void 0;
3490
+ var timer = setTimeout(function() {
3491
+ setSearch(searchDraft);
3492
+ setPage(1);
3493
+ }, 280);
3494
+ return function() {
3495
+ clearTimeout(timer);
3496
+ };
3497
+ }, [searchDraft]);
3498
+ React.useEffect(function() {
3499
+ if (JSON.stringify(filterDraft) === JSON.stringify(filters)) return void 0;
3500
+ var timer = setTimeout(function() {
3501
+ setFilters(filterDraft);
3502
+ setPage(1);
3503
+ }, 280);
3504
+ return function() {
3505
+ clearTimeout(timer);
3506
+ };
3507
+ }, [filterDraft]);
3508
+ React.useEffect(function() {
3509
+ if (!active || !cfgWrap.ready || index) return void 0;
3510
+ var req = ++reqRef.current;
3511
+ setLoadingRows(true);
3512
+ var args = { table: active, page, pageSize: size, order, includeDeleted };
3513
+ if (sort) args.sort = sort;
3514
+ if (search) args.search = search;
3515
+ if (Object.keys(filters).length) args.filters = filters;
3516
+ Promise.resolve(api.call(DOMAIN + ".dataQuery", args)).then(function(r) {
3517
+ if (req !== reqRef.current) return;
3518
+ if (r && r.ok === false) throw new Error(r && r.error || t.queryFail);
3519
+ var body = unwrap(r);
3520
+ if (!body) throw new Error(t.queryFail);
3521
+ setData(body);
3522
+ setError("");
3523
+ if (body.page !== page) setPage(body.page);
3524
+ }).catch(function(e) {
3525
+ if (req !== reqRef.current) return;
3526
+ setError(String(e && e.message || e) || t.queryFail);
3527
+ }).then(function() {
3528
+ if (req === reqRef.current) setLoadingRows(false);
3529
+ });
3530
+ return function() {
3531
+ reqRef.current++;
3532
+ };
3533
+ }, [active, page, size, sort, order, search, includeDeleted, cfgWrap.ready, filtersKey, refreshS[0], !!index]);
3534
+ React.useEffect(function() {
3535
+ if (!drawer) return void 0;
3536
+ function onKey(e) {
3537
+ if (e.key === "Escape") setDrawer(null);
3538
+ }
3539
+ document.addEventListener("keydown", onKey);
3540
+ return function() {
3541
+ document.removeEventListener("keydown", onKey);
3542
+ };
3543
+ }, [drawer]);
3544
+ var current = null;
3545
+ if (tables) {
3546
+ for (var i = 0; i < tables.length; i++) if (tables[i].name === active) current = tables[i];
3547
+ }
3548
+ function leaveIndex() {
3549
+ indexReqRef.current++;
3550
+ setIndex(null);
3551
+ setIndexBusy(false);
3552
+ setError("");
3553
+ }
3554
+ function loadIndex() {
3555
+ reqRef.current++;
3556
+ setError("");
3557
+ var req = ++indexReqRef.current;
3558
+ setIndex([]);
3559
+ setIndexBusy(true);
3560
+ Promise.resolve(api.call(DOMAIN + ".dataTables", { stats: true })).then(function(r) {
3561
+ if (req !== indexReqRef.current) return;
3562
+ if (r && r.ok === false) throw new Error(r.error || t.loadFail);
3563
+ var payload = unwrap(r) || {};
3564
+ var rows = (payload.tables || []).map(function(tb) {
3565
+ return { table: tb, stats: tb.stats || null };
3566
+ });
3567
+ setIndex(rows);
3568
+ setError("");
3569
+ setIndexBusy(false);
3570
+ }).catch(function(e) {
3571
+ if (req !== indexReqRef.current) return;
3572
+ setError(String(e.message || e));
3573
+ setIndex([]);
3574
+ setIndexBusy(false);
3575
+ });
3576
+ }
3577
+ function renderIndex() {
3578
+ var row = (index || []).filter(function(r) {
3579
+ return r.table.name === active;
3580
+ })[0];
3581
+ var tb = row ? row.table : current;
3582
+ var st = row && row.stats;
3583
+ var indexes = st ? st.indexes || [] : [];
3584
+ var hasExtra = indexes.some(function(ix) {
3585
+ return ix.origin !== "pk";
3586
+ });
3587
+ var count = st && st.rows !== void 0 ? st.rows : tb && tb.count;
3588
+ return h2(
3589
+ "div",
3590
+ { className: P + "-idx" },
3591
+ h2(
3592
+ "div",
3593
+ { className: P + "-head" },
3594
+ h2(
3595
+ "div",
3596
+ { className: P + "-headmain" },
3597
+ h2("h2", null, icon("database"), tableLabel(tb), h2("span", { className: P + "-code" }, active)),
3598
+ h2("div", { className: P + "-idxsub" }, t.indexSub)
3599
+ ),
3600
+ h2("button", {
3601
+ type: "button",
3602
+ className: P + "-btn",
3603
+ "aria-label": t.refresh,
3604
+ title: t.refresh,
3605
+ "aria-busy": indexBusy ? "true" : "false",
3606
+ onClick: function() {
3607
+ loadIndex();
3608
+ }
3609
+ }, icon("refresh"), h2("span", { className: P + "-btnlabel" }, t.refresh))
3610
+ ),
3611
+ st ? h2(
3612
+ "div",
3613
+ { className: P + "-idxsum" },
3614
+ h2("span", null, t.idxRows, " ", h2("b", null, String(count))),
3615
+ h2("span", null, t.idxCols, " ", h2("b", null, String(st.columnCount === void 0 ? (tb.columns || []).length : st.columnCount))),
3616
+ h2("span", null, fmt(t.idxCount, { n: indexes.length }))
3617
+ ) : null,
3618
+ indexBusy ? options.Skeleton ? h2(options.Skeleton, { lang, label: t.loading }) : h2("div", { className: P + "-empty", role: "status", "aria-busy": "true" }, t.loading) : !st ? h2("div", { className: P + "-empty" }, t.idxEmpty) : !hasExtra ? h2("div", { className: P + "-empty" }, t.idxNoExtra) : h2(
3619
+ "div",
3620
+ { className: P + "-tablewrap" },
3621
+ h2(
3622
+ "table",
3623
+ { className: P + "-table " + P + "-idxtable" },
3624
+ h2("thead", null, h2(
3625
+ "tr",
3626
+ null,
3627
+ [t.idxName, t.idxColumns, t.idxType, t.idxSource, t.idxRows].map(function(label) {
3628
+ return h2("th", { scope: "col", key: label }, h2("span", { className: P + "-thbtn" }, label));
3629
+ })
3630
+ )),
3631
+ h2("tbody", null, indexes.map(function(ix) {
3632
+ return h2(
3633
+ "tr",
3634
+ { className: P + "-tr", key: ix.name },
3635
+ h2("td", { className: P + "-cell mono" }, ix.name),
3636
+ h2("td", { className: P + "-cell mono" }, (ix.columns || []).join(", ") || t.idxNone),
3637
+ h2("td", { className: P + "-cell" }, ix.origin === "pk" ? t.idxKey : ix.unique ? t.idxUnique : t.idxNormal),
3638
+ h2("td", { className: P + "-cell" }, /^sqlite_autoindex_/.test(ix.name) ? t.idxAuto : t.idxCreated),
3639
+ h2("td", { className: P + "-cell num", title: t.idxRowsHelp }, String(count))
3640
+ );
3641
+ }))
3642
+ )
3643
+ )
3644
+ );
3645
+ }
3646
+ function tableLabel(tb) {
3647
+ if (!tb || !tb.label) return "";
3648
+ return lang === "en" ? tb.label.en || tb.label.zh : tb.label.zh || tb.label.en;
3649
+ }
3650
+ function colLabel(col) {
3651
+ if (!col.label) return col.name;
3652
+ return lang === "en" ? col.label.en || col.label.zh : col.label.zh || col.label.en;
3653
+ }
3654
+ function visibleColumns() {
3655
+ var cols = data && data.columns ? data.columns.map(function(col) {
3656
+ var hook = columnHooks[col.name];
3657
+ return hook && hook.kind ? Object.assign({}, col, { kind: hook.kind, type: hook.type || col.type }) : col;
3658
+ }) : [];
3659
+ return cols.filter(function(c) {
3660
+ return showSystem || !c.system;
3661
+ });
3662
+ }
3663
+ function toggleSort(name) {
3664
+ if (sort !== name) {
3665
+ setSort(name);
3666
+ setOrder("desc");
3667
+ return;
3668
+ }
3669
+ if (order === "desc") {
3670
+ setOrder("asc");
3671
+ return;
3672
+ }
3673
+ setSort("");
3674
+ setOrder("desc");
3675
+ }
3676
+ function ariaSort(name) {
3677
+ if (sort !== name) return "none";
3678
+ return order === "asc" ? "ascending" : "descending";
3679
+ }
3680
+ function copyCell(value) {
3681
+ var text = value === null || value === void 0 ? "" : String(value);
3682
+ try {
3683
+ if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text);
3684
+ else {
3685
+ var ta = document.createElement("textarea");
3686
+ ta.value = text;
3687
+ ta.style.position = "fixed";
3688
+ ta.style.opacity = "0";
3689
+ document.body.appendChild(ta);
3690
+ ta.select();
3691
+ document.execCommand("copy");
3692
+ document.body.removeChild(ta);
3693
+ }
3694
+ say(t.copied);
3695
+ } catch (e) {
3696
+ }
3697
+ }
3698
+ function cellText(col, value) {
3699
+ if (value === null || value === void 0) return null;
3700
+ if (col.kind === "bool") return value ? t.yes : t.no;
3701
+ if (col.kind === "timestamp") return timeText(value);
3702
+ return String(value);
3703
+ }
3704
+ function cellClass(col, value) {
3705
+ var cls = P + "-cell";
3706
+ if (value === null || value === void 0) return cls + " null";
3707
+ if (col.kind === "number") return cls + " num";
3708
+ if (col.kind === "id" || col.kind === "path") return cls + " mono";
3709
+ if (col.kind === "text" && looksJson(value)) return cls + " json";
3710
+ return cls;
3711
+ }
3712
+ function cellTitle(col, value) {
3713
+ if (value === null || value === void 0) return t.nullText;
3714
+ if (col.kind === "timestamp") return String(value);
3715
+ if (col.kind === "bool") return value ? "1" : "0";
3716
+ return String(value);
3717
+ }
3718
+ function renderCell(row, col) {
3719
+ var value = row[col.name];
3720
+ var hook = columnHooks[col.name];
3721
+ function openDetail() {
3722
+ setDrawer({ column: colLabel(col), name: col.name, row: (data.page - 1) * data.pageSize + row.__i + 1, value });
3723
+ }
3724
+ var text = cellText(col, value);
3725
+ var content;
3726
+ if (text === null) content = h2("span", { className: "v" }, t.nullText);
3727
+ else if (text === "") content = h2("span", { className: "v" }, '""');
3728
+ else content = h2("span", { className: "v" }, text);
3729
+ if (hook && hook.render) content = hook.render({ value, row, col, lang, prefix: P, openDetail });
3730
+ return h2("td", {
3731
+ key: col.name,
3732
+ className: cellClass(col, value),
3733
+ title: cellTitle(col, value),
3734
+ onClick: function() {
3735
+ copyCell(value);
3736
+ },
3737
+ onDoubleClick: openDetail
3738
+ }, content);
3739
+ }
3740
+ function activeFilterCount() {
3741
+ var n = 0;
3742
+ for (var k in filters) if (Object.prototype.hasOwnProperty.call(filters, k)) n++;
3743
+ return n;
3744
+ }
3745
+ function filterCell(col) {
3746
+ var val = filterDraft[col.name] === void 0 ? "" : filterDraft[col.name];
3747
+ return h2(
3748
+ "th",
3749
+ { key: col.name, scope: "col", className: P + "-fth" },
3750
+ h2(
3751
+ "span",
3752
+ { className: P + "-fcell" },
3753
+ h2("input", {
3754
+ className: P + "-finput",
3755
+ type: "search",
3756
+ value: val,
3757
+ placeholder: t.filterCol,
3758
+ "aria-label": t.filterCol + " " + colLabel(col),
3759
+ title: colLabel(col) + " \xB7 " + t.filterCol,
3760
+ onChange: function(e) {
3761
+ var v = e.target.value;
3762
+ setFilterDraft(function(prev) {
3763
+ var next = Object.assign({}, prev);
3764
+ if (v) next[col.name] = v;
3765
+ else delete next[col.name];
3766
+ return next;
3767
+ });
3768
+ }
3769
+ }),
3770
+ val ? h2("button", {
3771
+ type: "button",
3772
+ className: P + "-fclear",
3773
+ title: t.filterClear,
3774
+ "aria-label": t.filterClear + " " + colLabel(col),
3775
+ onClick: function() {
3776
+ setFilterDraft(function(prev) {
3777
+ var next = Object.assign({}, prev);
3778
+ delete next[col.name];
3779
+ return next;
3780
+ });
3781
+ }
3782
+ }, "\xD7") : null
3783
+ )
3784
+ );
3785
+ }
3786
+ function renderRows() {
3787
+ if (loadingRows && !data && options.Skeleton) return h2(options.Skeleton, { lang, label: t.loading });
3788
+ if (loadingRows && !data) {
3789
+ return h2(
3790
+ "div",
3791
+ { className: P + "-skwrap", "aria-busy": "true" },
3792
+ h2("span", { className: P + "-sr" }, t.loading),
3793
+ [0, 1, 2, 3, 4, 5, 6, 7].map(function(i2) {
3794
+ return h2("div", { key: i2, className: P + "-sk" });
3795
+ })
3796
+ );
3797
+ }
3798
+ if (error) {
3799
+ return h2(
3800
+ "div",
3801
+ { className: P + "-err", role: "alert" },
3802
+ h2("span", null, t.queryFail + error),
3803
+ h2("button", { type: "button", className: P + "-btn", onClick: refresh }, t.retry)
3804
+ );
3805
+ }
3806
+ if (!data) return h2("div", { className: P + "-empty" }, t.empty);
3807
+ var cols = visibleColumns();
3808
+ var rows = data.rows || [];
3809
+ var narrowing = !!search || activeFilterCount() > 0;
3810
+ return h2(
3811
+ "div",
3812
+ { className: P + "-tablewrap" },
3813
+ h2(
3814
+ "table",
3815
+ { className: P + "-table" },
3816
+ h2(
3817
+ "thead",
3818
+ null,
3819
+ h2(
3820
+ "tr",
3821
+ null,
3822
+ h2("th", { className: P + "-rownum", scope: "col" }, "#"),
3823
+ cols.map(function(col) {
3824
+ return h2(
3825
+ "th",
3826
+ { key: col.name, scope: "col", "aria-sort": ariaSort(col.name) },
3827
+ h2(
3828
+ "button",
3829
+ {
3830
+ type: "button",
3831
+ className: P + "-thbtn",
3832
+ title: colLabel(col) + " \xB7 " + col.type,
3833
+ onClick: function() {
3834
+ toggleSort(col.name);
3835
+ }
3836
+ },
3837
+ h2("span", null, colLabel(col)),
3838
+ h2("span", { className: P + "-coltype" }, String(col.type || "").toLowerCase()),
3839
+ sort === col.name ? h2("span", { className: P + "-sortmark", "aria-hidden": "true" }, order === "asc" ? "\u25B2" : "\u25BC") : null
3840
+ )
3841
+ );
3842
+ })
3843
+ ),
3844
+ h2(
3845
+ "tr",
3846
+ { className: P + "-frow" },
3847
+ h2("th", { className: P + "-rownum", scope: "col" }, ""),
3848
+ cols.map(filterCell)
3849
+ )
3850
+ ),
3851
+ h2("tbody", null, rows.length ? rows.map(function(row, idx) {
3852
+ row.__i = idx;
3853
+ var deleted = row.deleted_at !== null && row.deleted_at !== void 0;
3854
+ return h2(
3855
+ "tr",
3856
+ { key: row.id || idx, className: P + "-tr" + (deleted ? " deleted" : "") },
3857
+ h2("td", { className: P + "-rownum" }, (data.page - 1) * data.pageSize + idx + 1),
3858
+ cols.map(function(col) {
3859
+ var cell = renderCell(row, col);
3860
+ if (deleted && col.name === "id") {
3861
+ return React.cloneElement(cell, { key: col.name }, cell.props.children, h2("span", { className: P + "-delbadge" }, t.deleted));
3862
+ }
3863
+ return cell;
3864
+ })
3865
+ );
3866
+ }) : h2("tr", null, h2("td", { className: P + "-emptycell", colSpan: cols.length + 1 }, narrowing ? t.noRows : t.empty)))
3867
+ )
3868
+ );
3869
+ }
3870
+ function renderFoot() {
3871
+ var pages = data ? data.pages : 1;
3872
+ var total = data ? data.total : 0;
3873
+ return h2(
3874
+ "div",
3875
+ { className: P + "-foot" },
3876
+ h2("span", null, fmt(t.total, { n: total })),
3877
+ h2("span", { className: P + "-grow" }),
3878
+ h2("button", { type: "button", className: P + "-btn", disabled: !data || page <= 1, onClick: function() {
3879
+ setPage(Math.max(1, page - 1));
3880
+ } }, "\u2039 " + t.prev),
3881
+ h2("span", { className: P + "-pageinfo" }, fmt(t.pageInfo, { page: data ? data.page : 1, pages })),
3882
+ h2("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
3883
+ setPage(Math.min(pages, page + 1));
3884
+ } }, t.next + " \u203A"),
3885
+ h2("input", {
3886
+ className: P + "-jump",
3887
+ type: "number",
3888
+ min: 1,
3889
+ max: pages,
3890
+ "aria-label": t.jump,
3891
+ onKeyDown: function(e) {
3892
+ if (e.key === "Enter") {
3893
+ var n = Math.floor(Number(e.target.value));
3894
+ if (n >= 1) setPage(Math.min(pages, n));
3895
+ }
3896
+ }
3897
+ }),
3898
+ h2("span", null, fmt(t.queryTime, { n: data ? data.queryMs : 0 }))
3899
+ );
3900
+ }
3901
+ if (!tables && loadingTables && options.Skeleton) return h2(options.Skeleton, { lang, label: t.loading });
3902
+ if (!tables && loadingTables) {
3903
+ return h2("div", { className: P + "-skwrap", "aria-busy": "true" }, h2("span", { className: P + "-sr" }, t.loading), [0, 1, 2, 3].map(function(i2) {
3904
+ return h2("div", { key: i2, className: P + "-sk" });
3905
+ }));
3906
+ }
3907
+ if (!tables) {
3908
+ return h2("div", { className: P + "-err", role: "alert" }, h2("span", null, t.loadFail), h2("button", { type: "button", className: P + "-btn", onClick: loadTables }, t.retry));
3909
+ }
3910
+ if (!tables.length) return h2("div", { className: P + "-empty" }, t.emptyTable);
3911
+ return h2(
3912
+ "div",
3913
+ { className: P },
3914
+ h2(
3915
+ "div",
3916
+ { className: P + "-side" },
3917
+ h2("div", { className: P + "-sidetitle" }, h2("span", null, icon("table"), t.tables), h2("span", null, String(tables.length))),
3918
+ tables.map(function(tb) {
3919
+ return h2(
3920
+ "button",
3921
+ {
3922
+ key: tb.name,
3923
+ type: "button",
3924
+ className: P + "-stab" + (tb.name === active ? " on" : ""),
3925
+ "aria-pressed": tb.name === active,
3926
+ onClick: function() {
3927
+ selectTable(tb.name);
3928
+ }
3929
+ },
3930
+ h2(
3931
+ "span",
3932
+ { className: P + "-stabname" },
3933
+ h2("span", null, tableLabel(tb)),
3934
+ h2("span", { className: P + "-sidecount" }, String(tb.count))
3935
+ ),
3936
+ h2("span", { className: P + "-sidetable" }, tb.name)
3937
+ );
3938
+ })
3939
+ ),
3940
+ h2(
3941
+ "div",
3942
+ { className: P + "-main" },
3943
+ h2(
3944
+ "div",
3945
+ { className: P + "-tabs", role: "tablist", "aria-label": t.title },
3946
+ h2("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !index, onClick: leaveIndex }, icon("list"), lang === "en" ? "Row data" : "\u884C\u6570\u636E"),
3947
+ h2("button", { type: "button", role: "tab", className: P + "-btn", "aria-selected": !!index, onClick: loadIndex }, icon("database"), t.index)
3948
+ ),
3949
+ index && error ? h2("div", { className: P + "-err", role: "alert" }, error) : null,
3950
+ index ? renderIndex() : [
3951
+ h2(
3952
+ "div",
3953
+ { className: P + "-head" },
3954
+ h2(
3955
+ "div",
3956
+ { className: P + "-headmain" },
3957
+ h2("h2", null, icon("database"), tableLabel(current), h2("span", { className: P + "-code" }, active)),
3958
+ h2(
3959
+ "div",
3960
+ { className: P + "-sub" },
3961
+ current ? fmt(t.rowCount, { n: current.count }) : "",
3962
+ current && current.deletedCount ? " \xB7 " + fmt(t.deletedCount, { n: current.deletedCount }) : "",
3963
+ " \xB7 " + t.subtitle
3964
+ )
3965
+ ),
3966
+ h2("button", {
3967
+ type: "button",
3968
+ className: P + "-btn",
3969
+ "aria-label": t.refresh,
3970
+ title: t.refresh,
3971
+ "aria-busy": loadingRows ? "true" : "false",
3972
+ onClick: refresh
3973
+ }, icon("refresh"), h2("span", { className: P + "-btnlabel" }, t.refresh))
3974
+ ),
3975
+ h2(
3976
+ "div",
3977
+ { className: P + "-toolbar" },
3978
+ h2(
3979
+ "div",
3980
+ { className: P + "-search" },
3981
+ icon("search"),
3982
+ h2("input", {
3983
+ type: "search",
3984
+ value: searchDraft,
3985
+ placeholder: t.search,
3986
+ "aria-label": t.search,
3987
+ onChange: function(e) {
3988
+ setSearchDraft(e.target.value);
3989
+ }
3990
+ })
3991
+ ),
3992
+ h2(
3993
+ "label",
3994
+ { className: P + "-switch" },
3995
+ h2("input", { type: "checkbox", checked: includeDeleted, onChange: function(e) {
3996
+ setIncludeDeleted(e.target.checked);
3997
+ setPage(1);
3998
+ } }),
3999
+ h2("span", { className: P + "-track" }),
4000
+ h2("span", null, t.includeDeleted)
4001
+ ),
4002
+ h2(
4003
+ "label",
4004
+ { className: P + "-switch" },
4005
+ h2("input", { type: "checkbox", checked: showSystem, onChange: function(e) {
4006
+ setShowSystem(e.target.checked);
4007
+ } }),
4008
+ h2("span", { className: P + "-track" }),
4009
+ h2("span", null, t.showSystem)
4010
+ ),
4011
+ h2("span", { className: P + "-grow" }),
4012
+ h2(
4013
+ "label",
4014
+ { style: { display: "inline-flex", alignItems: "center", gap: "6px", fontSize: "11.5px", color: "var(--cfg-muted)" } },
4015
+ h2("span", null, t.pageSize),
4016
+ h2("select", {
4017
+ className: P + "-select",
4018
+ value: size,
4019
+ onChange: function(e) {
4020
+ setPageSize(Number(e.target.value));
4021
+ setPage(1);
4022
+ }
4023
+ }, PAGE_SIZES.map(function(n) {
4024
+ return h2("option", { key: n, value: n }, String(n));
4025
+ }))
4026
+ )
4027
+ ),
4028
+ renderRows(),
4029
+ renderFoot()
4030
+ ]
4031
+ ),
4032
+ drawer ? h2(
4033
+ "div",
4034
+ null,
4035
+ h2("div", { className: P + "-mask", onClick: function() {
4036
+ setDrawer(null);
4037
+ } }),
4038
+ h2(
4039
+ "aside",
4040
+ { className: P + "-drawer", role: "dialog", "aria-modal": "true", "aria-label": drawer.column },
4041
+ h2("h3", null, fmt(t.drawerTitle, { column: drawer.column, row: drawer.row }), h2("span", { className: P + "-code" }, drawer.name)),
4042
+ columnHooks[drawer.name] && columnHooks[drawer.name].detail ? columnHooks[drawer.name].detail({ value: drawer.value, lang, prefix: P }) : h2("pre", null, drawerText(drawer.value)),
4043
+ h2(
4044
+ "div",
4045
+ { className: P + "-drawerfoot" },
4046
+ h2("button", { type: "button", className: P + "-btn", onClick: function() {
4047
+ copyCell(drawer.value);
4048
+ } }, t.copy),
4049
+ h2("button", { type: "button", className: P + "-btn", onClick: function() {
4050
+ setDrawer(null);
4051
+ } }, t.close)
4052
+ )
4053
+ )
4054
+ ) : null,
4055
+ toast ? h2("div", { className: P + "-toast", role: "status" }, toast) : null
4056
+ );
4057
+ }
4058
+ function drawerText(value) {
4059
+ if (value === null || value === void 0) return "NULL";
4060
+ if (typeof value === "string" && looksJson(value)) {
4061
+ try {
4062
+ return JSON.stringify(JSON.parse(value), null, 2);
4063
+ } catch (e) {
4064
+ return value;
4065
+ }
4066
+ }
4067
+ if (typeof value === "object") {
4068
+ try {
4069
+ return JSON.stringify(value, null, 2);
4070
+ } catch (e) {
4071
+ return String(value);
4072
+ }
4073
+ }
4074
+ return String(value);
4075
+ }
4076
+ return { DataView, DOMAIN };
4077
+ };
4078
+ }
4079
+ });
4080
+
4081
+ // packages/addons/storage/client/ui/data-columns.cjs
4082
+ var require_data_columns = __commonJS({
4083
+ "packages/addons/storage/client/ui/data-columns.cjs"(exports2, module2) {
4084
+ "use strict";
4085
+ var h2 = require("react").createElement;
4086
+ var safeImage = require_ui().safeImage;
4087
+ function images(value) {
4088
+ try {
4089
+ var list = typeof value === "string" ? JSON.parse(value) : value;
4090
+ if (!Array.isArray(list) || !list.length) return [];
4091
+ var urls = list.map(function(url) {
4092
+ return typeof url === "string" ? safeImage(url) : "";
4093
+ });
4094
+ return urls.every(Boolean) ? urls : [];
4095
+ } catch (_) {
4096
+ return [];
4097
+ }
4098
+ }
4099
+ function text(value) {
4100
+ return value == null ? "NULL" : String(value);
4101
+ }
4102
+ function picture(url, index, lang) {
4103
+ return h2("img", { key: index, src: url, alt: (lang === "en" ? "Image " : "\u56FE\u7247 ") + (index + 1), loading: "lazy", referrerPolicy: "no-referrer" });
4104
+ }
4105
+ module2.exports = {
4106
+ img_list: {
4107
+ render: function(ctx) {
4108
+ var urls = images(ctx.value);
4109
+ if (!urls.length) return h2("span", { className: "v" }, text(ctx.value));
4110
+ return h2(
4111
+ "button",
4112
+ {
4113
+ type: "button",
4114
+ className: ctx.prefix + "-btn " + ctx.prefix + "-images",
4115
+ "aria-label": (ctx.lang === "en" ? "Preview images: " : "\u9884\u89C8\u56FE\u7247\uFF1A") + urls.length,
4116
+ onClick: function(e) {
4117
+ e.stopPropagation();
4118
+ ctx.openDetail();
4119
+ }
4120
+ },
4121
+ urls.slice(0, 3).map(function(url, i) {
4122
+ return picture(url, i, ctx.lang);
4123
+ }),
4124
+ urls.length > 3 ? h2("span", null, "+" + (urls.length - 3)) : null
4125
+ );
4126
+ },
4127
+ detail: function(ctx) {
4128
+ var urls = images(ctx.value);
4129
+ return urls.length ? h2("div", { className: ctx.prefix + "-gallery" }, urls.map(function(url, i) {
4130
+ return picture(url, i, ctx.lang);
4131
+ })) : h2("pre", null, text(ctx.value));
4132
+ }
4133
+ },
4134
+ stock: {
4135
+ kind: "text",
4136
+ type: "TEXT",
4137
+ render: function(ctx) {
4138
+ return h2("span", { className: "v" }, text(ctx.value));
4139
+ }
4140
+ },
4141
+ remark: {
4142
+ render: function(ctx) {
4143
+ var value = text(ctx.value);
4144
+ return h2("span", { className: "v", title: value }, value.length > 80 ? value.slice(0, 80) + "\u2026" : value);
4145
+ }
4146
+ }
4147
+ };
4148
+ }
4149
+ });
4150
+
4151
+ // packages/addons/storage/client/views/data.cjs
4152
+ var require_data = __commonJS({
4153
+ "packages/addons/storage/client/views/data.cjs"(exports2, module2) {
4154
+ "use strict";
4155
+ module2.exports = require_data_view()({
4156
+ domain: "storage",
4157
+ Icon: require_icons().Icon,
4158
+ Skeleton: require_ui().Skeleton,
4159
+ prefix: "wbi",
4160
+ tables: ["storage"],
4161
+ useConfig: require_config().useConfig,
4162
+ columns: require_data_columns()
4163
+ });
4164
+ }
4165
+ });
4166
+
4167
+ // packages/addons/lib/highlight.cjs
4168
+ var require_highlight = __commonJS({
4169
+ "packages/addons/lib/highlight.cjs"(exports2, module2) {
4170
+ "use strict";
4171
+ module2.exports = function(React) {
4172
+ var h2 = React.createElement;
4173
+ function sourceOf(keyword) {
4174
+ var pattern = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4175
+ return pattern.replace(/[a-zA-Z]/g, function(letter) {
4176
+ return "[" + letter.toLowerCase() + letter.toUpperCase() + "]";
4177
+ });
4178
+ }
4179
+ return function createHighlight(prefix) {
4180
+ var className = String(prefix || "wb") + "-hit";
4181
+ function hit(rawText, rawKeyword) {
4182
+ var text = rawText == null ? "" : String(rawText);
4183
+ var keyword = rawKeyword == null ? "" : String(rawKeyword);
4184
+ if (!keyword) return text;
4185
+ var matcher, match, end = 0, parts = [];
4186
+ try {
4187
+ matcher = new RegExp(sourceOf(keyword), "g");
4188
+ } catch (error) {
4189
+ return text;
4190
+ }
4191
+ while (match = matcher.exec(text)) {
4192
+ if (match.index > end) parts.push(text.slice(end, match.index));
4193
+ parts.push(h2("mark", { className, key: match.index }, match[0]));
4194
+ end = match.index + match[0].length;
4195
+ if (!match[0]) matcher.lastIndex += 1;
4196
+ }
4197
+ if (!parts.length) return text;
4198
+ if (end < text.length) parts.push(text.slice(end));
4199
+ return parts;
4200
+ }
4201
+ function Highlight(props) {
4202
+ return hit(props.text, props.keyword);
4203
+ }
4204
+ Highlight.hit = hit;
4205
+ return Highlight;
4206
+ };
4207
+ };
4208
+ }
4209
+ });
4210
+
4211
+ // packages/addons/lib/action-schema-style.cjs
4212
+ var require_action_schema_style = __commonJS({
4213
+ "packages/addons/lib/action-schema-style.cjs"(exports2, module2) {
4214
+ "use strict";
4215
+ module2.exports = function(PREFIX, DOMAIN) {
4216
+ var P = PREFIX + "-as";
4217
+ var CSS = [
4218
+ "." + P + "{display:flex;flex-direction:column;gap:12px;width:100%;min-width:0;font-size:13px;color:inherit}",
4219
+ "." + P + "-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
4220
+ "." + P + "-title{font-size:15px;font-weight:660;margin:0}",
4221
+ "." + P + "-badge{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--wb-border,#e3e5e9);border-radius:999px;padding:1px 8px;font-size:11px;color:var(--dsw-alias-label-secondary,currentColor);font-variant-numeric:tabular-nums}",
4222
+ "." + P + "-mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px}",
4223
+ "." + P + "-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
4224
+ "." + P + "-search{position:relative;flex:1 1 220px;min-width:0;display:flex;align-items:center}",
4225
+ "." + P + "-search input{width:100%;border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 10px 6px 30px}",
4226
+ "." + P + "-search input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
4227
+ "." + P + "-search .wbi-svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--dsw-alias-label-tertiary,inherit)}",
4228
+ "." + P + " select{border:1px solid var(--wb-border,#e3e5e9);border-radius:8px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));color:inherit;font:inherit;padding:6px 8px}",
4229
+ "." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
4230
+ "." + P + "-list{display:flex;flex-direction:column;gap:8px}",
4231
+ "." + P + "-card{border:1px solid var(--wb-border,#e3e5e9);border-radius:10px;padding:10px 12px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));display:flex;flex-direction:column;gap:8px;min-width:0}",
4232
+ "." + P + "-cardhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
4233
+ "." + P + "-cardhead code{font-weight:640}",
4234
+ "." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
4235
+ // 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
4236
+ "." + P + " mark." + P + "-hit{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#4f6ef7) 22%,transparent);color:inherit;border-radius:2px;padding:0;font:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}",
4237
+ "." + P + "-table{width:100%;border-collapse:collapse;font-size:12px;table-layout:auto}",
4238
+ "." + P + "-table th{text-align:left;font-weight:620;font-size:11px;letter-spacing:.4px;text-transform:uppercase;color:var(--dsw-alias-label-tertiary,inherit);padding:4px 8px 4px 0;white-space:nowrap}",
4239
+ "." + P + "-table td{padding:4px 8px 4px 0;vertical-align:top;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);line-height:1.5}",
4240
+ "." + P + "-req{color:var(--dsw-alias-state-error-primary,#d9534f);font-weight:620}",
4241
+ "." + P + "-opt{color:var(--dsw-alias-label-tertiary,inherit)}",
4242
+ "." + P + "-none{color:var(--dsw-alias-label-tertiary,inherit);font-size:12px}",
4243
+ "." + P + "-example{position:relative;display:flex;flex-direction:column;gap:4px}",
4244
+ "." + P + "-examplehead{display:flex;align-items:center;justify-content:space-between;gap:8px}",
4245
+ "." + P + "-pre{margin:0;padding:8px 10px;border-radius:8px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);color:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11.5px;line-height:1.5;overflow:auto;max-height:280px;white-space:pre-wrap;word-break:break-word}",
4246
+ "." + P + "-copy{border:1px solid var(--wb-border,#e3e5e9);border-radius:7px;background:transparent;color:inherit;font:inherit;font-size:11.5px;padding:2px 8px;cursor:pointer}",
4247
+ "." + P + "-copy:hover{background:var(--dsw-alias-interactive-bg-hover,color-mix(in oklab,currentColor 5%,transparent))}",
4248
+ "." + P + "-copy:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
4249
+ "." + P + " details>summary{cursor:pointer;font-size:11.5px;color:var(--dsw-alias-label-secondary,inherit);width:max-content}",
4250
+ "." + P + " details>summary:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:2px}",
4251
+ "." + P + "-empty{padding:24px;text-align:center;border:1px dashed var(--wb-border,#e3e5e9);border-radius:10px;color:var(--dsw-alias-label-tertiary,inherit)}",
4252
+ "." + P + "-error{padding:12px;border:1px solid var(--dsw-alias-state-error-primary,#d9534f);border-radius:10px;color:var(--dsw-alias-state-error-primary,#d9534f);display:flex;gap:10px;align-items:center}",
4253
+ "." + P + "-toast{position:sticky;bottom:8px;align-self:flex-start;border-radius:999px;padding:3px 10px;background:var(--dsw-alias-bg-skeleton,#f2f3f5);font-size:11.5px}",
4254
+ "@media(max-width:600px){." + P + "-table thead{display:none}." + P + "-table td{display:block;border-top:0;padding:2px 0}." + P + "-table tr{display:block;border-top:1px solid color-mix(in oklab,currentColor 8%,transparent);padding:4px 0}}"
4255
+ ].join("\n");
4256
+ return function injectCss() {
4257
+ if (typeof document === "undefined") return;
4258
+ var id = "wb-addon-" + DOMAIN + "-actions-css";
4259
+ var old = document.getElementById(id);
4260
+ if (old) {
4261
+ old.textContent = CSS;
4262
+ return;
4263
+ }
4264
+ var style2 = document.createElement("style");
4265
+ style2.id = id;
4266
+ style2.setAttribute("data-wb-addon", "wb-addon-" + DOMAIN);
4267
+ style2.textContent = CSS;
4268
+ document.head.appendChild(style2);
4269
+ };
4270
+ };
4271
+ }
4272
+ });
4273
+
4274
+ // packages/addons/lib/action-schema-view.cjs
4275
+ var require_action_schema_view = __commonJS({
4276
+ "packages/addons/lib/action-schema-view.cjs"(exports2, module2) {
4277
+ "use strict";
4278
+ var React = require("react");
4279
+ var createHighlight = require_highlight()(React);
4280
+ var h2 = React.createElement;
4281
+ var COPY = {
4282
+ zh: {
4283
+ title: "Action",
4284
+ hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
4285
+ domain: "\u57DF",
4286
+ versionLabel: "\u7248\u672C",
4287
+ shell: "\u5BBF\u4E3B",
4288
+ count: function(shown, total) {
4289
+ return shown + " / " + total + " \u4E2A action";
4290
+ },
4291
+ search: "\u641C\u7D22\u540D\u79F0\u3001\u63CF\u8FF0\u3001\u53C2\u6570\uFF08\u547D\u4E2D\u5904\u9AD8\u4EAE\uFF09",
4292
+ filterReq: "\u5FC5\u586B\u7B5B\u9009",
4293
+ all: "\u5168\u90E8",
4294
+ onlyRequired: "\u542B\u5FC5\u586B\u9879",
4295
+ onlyOptional: "\u65E0\u5FC5\u586B\u9879",
4296
+ filterType: "\u53C2\u6570\u7C7B\u578B",
4297
+ allTypes: "\u5168\u90E8\u7C7B\u578B",
4298
+ colName: "\u53C2\u6570",
4299
+ colType: "\u7C7B\u578B",
4300
+ colReq: "\u5FC5\u586B",
4301
+ colExtra: "\u9ED8\u8BA4 / \u679A\u4E3E / \u7EA6\u675F",
4302
+ colDesc: "\u8BF4\u660E",
4303
+ required: "\u5FC5\u586B",
4304
+ optional: "\u53EF\u9009",
4305
+ noParams: "\u65E0\u53C2\u6570",
4306
+ paramCount: function(n) {
4307
+ return n + " \u4E2A\u53C2\u6570";
4308
+ },
4309
+ examples: "\u793A\u4F8B",
4310
+ noExamples: "\u65E0\u793A\u4F8B",
4311
+ copy: "\u590D\u5236",
4312
+ copied: "\u5DF2\u590D\u5236",
4313
+ raw: "\u539F\u59CB JSON Schema",
4314
+ loading: "\u8F7D\u5165\u4E2D\u2026",
4315
+ loadFail: "\u8BFB\u53D6 action schema \u5931\u8D25",
4316
+ retry: "\u91CD\u8BD5",
4317
+ empty: "\u6CA1\u6709\u5339\u914D\u7684 action",
4318
+ emptyRegistry: "\u8BE5\u57DF\u6CA1\u6709\u6CE8\u518C action",
4319
+ envelope: "\u9ED8\u8BA4",
4320
+ enumLabel: "\u679A\u4E3E",
4321
+ range: "\u8303\u56F4",
4322
+ length: "\u957F\u5EA6",
4323
+ pattern: "\u6B63\u5219",
4324
+ format: "\u683C\u5F0F",
4325
+ items: "\u5143\u7D20\u6570"
4326
+ },
4327
+ en: {
4328
+ title: "Actions",
4329
+ hint: "runtime registry \xB7 read-only",
4330
+ domain: "Domain",
4331
+ versionLabel: "Version",
4332
+ shell: "Host",
4333
+ count: function(shown, total) {
4334
+ return shown + " / " + total + " actions";
4335
+ },
4336
+ search: "Search name, description, params (matches highlighted)",
4337
+ filterReq: "Required",
4338
+ all: "All",
4339
+ onlyRequired: "Has required",
4340
+ onlyOptional: "No required",
4341
+ filterType: "Param type",
4342
+ allTypes: "All types",
4343
+ colName: "Param",
4344
+ colType: "Type",
4345
+ colReq: "Required",
4346
+ colExtra: "Default / enum / constraints",
4347
+ colDesc: "Description",
4348
+ required: "required",
4349
+ optional: "optional",
4350
+ noParams: "No parameters",
4351
+ paramCount: function(n) {
4352
+ return n + " params";
4353
+ },
4354
+ examples: "Examples",
4355
+ noExamples: "No examples",
4356
+ copy: "Copy",
4357
+ copied: "Copied",
4358
+ raw: "Raw JSON Schema",
4359
+ loading: "Loading\u2026",
4360
+ loadFail: "Failed to read action schema",
4361
+ retry: "Retry",
4362
+ empty: "No matching action",
4363
+ emptyRegistry: "This domain has no registered action",
4364
+ envelope: "Default",
4365
+ enumLabel: "Enum",
4366
+ range: "Range",
4367
+ length: "Length",
4368
+ pattern: "Pattern",
4369
+ format: "Format",
4370
+ items: "Items"
4371
+ }
4372
+ };
4373
+ function typeLabel(schema) {
4374
+ if (!schema || typeof schema !== "object") return "";
4375
+ if (Array.isArray(schema.type)) return schema.type.join(" | ");
4376
+ if (typeof schema.type === "string") {
4377
+ if (schema.type === "array" && schema.items) {
4378
+ var inner = typeLabel(schema.items);
4379
+ return inner ? inner + "[]" : "array";
4380
+ }
4381
+ return schema.type;
4382
+ }
4383
+ if (Array.isArray(schema.oneOf)) return schema.oneOf.map(typeLabel).filter(Boolean).join(" | ");
4384
+ if (Array.isArray(schema.anyOf)) return schema.anyOf.map(typeLabel).filter(Boolean).join(" | ");
4385
+ return "";
4386
+ }
4387
+ function typeNames(schema) {
4388
+ var label = typeLabel(schema);
4389
+ if (!label) return [];
4390
+ return label.split("|").map(function(x) {
4391
+ return x.trim().replace(/\[\]$/, "");
4392
+ }).filter(Boolean);
4393
+ }
4394
+ function scalar(value) {
4395
+ if (typeof value === "string") return JSON.stringify(value);
4396
+ return String(value);
4397
+ }
4398
+ function extraText(schema, t) {
4399
+ if (!schema || typeof schema !== "object") return "";
4400
+ var parts = [];
4401
+ if (Object.prototype.hasOwnProperty.call(schema, "default")) {
4402
+ parts.push(t.envelope + " " + scalar(schema.default));
4403
+ }
4404
+ if (Array.isArray(schema.enum)) {
4405
+ parts.push(t.enumLabel + " " + schema.enum.map(scalar).join(" / "));
4406
+ }
4407
+ if (typeof schema.minimum === "number" || typeof schema.maximum === "number") {
4408
+ var lo = typeof schema.minimum === "number" ? schema.minimum : null;
4409
+ var hi = typeof schema.maximum === "number" ? schema.maximum : null;
4410
+ if (lo !== null && hi !== null) parts.push(t.range + " \u2265" + lo + " \u4E14 \u2264" + hi);
4411
+ else if (lo !== null) parts.push(t.range + " \u2265" + lo);
4412
+ else parts.push(t.range + " \u2264" + hi);
4413
+ }
4414
+ if (typeof schema.minLength === "number" || typeof schema.maxLength === "number") {
4415
+ parts.push(t.length + " " + (schema.minLength ?? 0) + "\u2013" + (schema.maxLength ?? "\u221E"));
4416
+ }
4417
+ if (typeof schema.minItems === "number" || typeof schema.maxItems === "number") {
4418
+ parts.push(t.items + " " + (schema.minItems ?? 0) + "\u2013" + (schema.maxItems ?? "\u221E"));
4419
+ }
4420
+ if (typeof schema.pattern === "string") parts.push(t.pattern + " " + schema.pattern);
4421
+ if (typeof schema.format === "string") parts.push(t.format + " " + schema.format);
4422
+ return parts.join(" \xB7 ");
4423
+ }
4424
+ function paramRows(action) {
4425
+ var input = action && action.input && typeof action.input === "object" ? action.input : {};
4426
+ var props = input.properties && typeof input.properties === "object" ? input.properties : {};
4427
+ var required = Array.isArray(input.required) ? input.required : [];
4428
+ return Object.keys(props).map(function(key) {
4429
+ var schema = props[key] && typeof props[key] === "object" ? props[key] : {};
4430
+ return {
4431
+ name: key,
4432
+ schema,
4433
+ type: typeLabel(schema),
4434
+ types: typeNames(schema),
4435
+ required: required.indexOf(key) >= 0,
4436
+ description: typeof schema.description === "string" ? schema.description : ""
4437
+ };
4438
+ });
4439
+ }
4440
+ module2.exports = function createActionSchemaView(options) {
4441
+ var raw = String(options.domain || "");
4442
+ var DOMAIN = raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
4443
+ var prefix = options.prefix;
4444
+ var P = prefix + "-as";
4445
+ var Icon3 = options.Icon || null;
4446
+ var injectCss = require_action_schema_style()(prefix, DOMAIN);
4447
+ var Highlight = createHighlight(P);
4448
+ function icon(name, size) {
4449
+ return Icon3 ? h2(Icon3, { name, size: size || 14 }) : null;
4450
+ }
4451
+ function plainCopy(text) {
4452
+ if (typeof document === "undefined") return;
4453
+ var area = document.createElement("textarea");
4454
+ area.value = text;
4455
+ area.setAttribute("readonly", "readonly");
4456
+ area.style.position = "fixed";
4457
+ area.style.opacity = "0";
4458
+ document.body.appendChild(area);
4459
+ area.select();
4460
+ try {
4461
+ document.execCommand("copy");
4462
+ } catch (e) {
4463
+ }
4464
+ document.body.removeChild(area);
4465
+ }
4466
+ function ActionSchemaView(props) {
4467
+ var lang = props.lang === "en" ? "en" : "zh";
4468
+ var t = COPY[lang];
4469
+ var api = props.api;
4470
+ var snapState = React.useState(null);
4471
+ var snap = snapState[0], setSnap = snapState[1];
4472
+ var errState = React.useState("");
4473
+ var err = errState[0], setErr = errState[1];
4474
+ var loadingState = React.useState(true);
4475
+ var loading = loadingState[0], setLoading = loadingState[1];
4476
+ var reloadState = React.useState(0);
4477
+ var reload = reloadState[0], setReload = reloadState[1];
4478
+ var queryState = React.useState("");
4479
+ var query = queryState[0], setQuery = queryState[1];
4480
+ var reqState = React.useState("all");
4481
+ var reqMode = reqState[0], setReqMode = reqState[1];
4482
+ var typeState = React.useState("");
4483
+ var typePick = typeState[0], setTypePick = typeState[1];
4484
+ var toastState = React.useState("");
4485
+ var toast = toastState[0], setToast = toastState[1];
4486
+ React.useEffect(function() {
4487
+ injectCss();
4488
+ }, []);
4489
+ React.useEffect(function() {
4490
+ var alive = true;
4491
+ setLoading(true);
4492
+ setErr("");
4493
+ var pending;
4494
+ var actionName = DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
4495
+ if (api && typeof api.call === "function") {
4496
+ pending = Promise.resolve(api.call(actionName)).then(function(r) {
4497
+ if (r && r.ok === false) return r;
4498
+ return r && r.result || r;
4499
+ });
4500
+ } else {
4501
+ pending = Promise.reject(new Error("no call api"));
4502
+ }
4503
+ Promise.resolve(pending).then(function(r) {
4504
+ if (!alive) return;
4505
+ if (!r || r.ok === false) {
4506
+ setSnap(null);
4507
+ setErr(String(r && (r.error || r.text) || t.loadFail));
4508
+ } else {
4509
+ setSnap(r);
4510
+ }
4511
+ setLoading(false);
4512
+ }, function(e) {
4513
+ if (!alive) return;
4514
+ setSnap(null);
4515
+ setErr(String(e && e.message || e || t.loadFail));
4516
+ setLoading(false);
4517
+ });
4518
+ return function() {
4519
+ alive = false;
4520
+ };
4521
+ }, [reload]);
4522
+ function copy(text) {
4523
+ var done = function() {
4524
+ setToast(t.copied);
4525
+ };
4526
+ if (typeof navigator !== "undefined" && navigator.clipboard && typeof navigator.clipboard.writeText === "function") {
4527
+ navigator.clipboard.writeText(text).then(done, function() {
4528
+ plainCopy(text);
4529
+ done();
4530
+ });
4531
+ return;
4532
+ }
4533
+ plainCopy(text);
4534
+ done();
4535
+ }
4536
+ var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
4537
+ return a && a.domain === DOMAIN;
4538
+ }) : [];
4539
+ var info = snap && Array.isArray(snap.domains) ? snap.domains.filter(function(d) {
4540
+ return d && d.id === DOMAIN;
4541
+ })[0] || null : null;
4542
+ var typeOptions = [];
4543
+ all.forEach(function(a) {
4544
+ paramRows(a).forEach(function(row) {
4545
+ row.types.forEach(function(name) {
4546
+ if (typeOptions.indexOf(name) < 0) typeOptions.push(name);
4547
+ });
4548
+ });
4549
+ });
4550
+ typeOptions.sort();
4551
+ var kw = String(query || "").trim();
4552
+ var q = kw.toLowerCase();
4553
+ var visible = all.filter(function(a) {
4554
+ var rows = paramRows(a);
4555
+ if (q) {
4556
+ var hay = [a.name || "", a.description || ""].concat(rows.map(function(row) {
4557
+ return row.name + " " + row.type + " " + row.description;
4558
+ })).join(" ").toLowerCase();
4559
+ if (hay.indexOf(q) < 0) return false;
4560
+ }
4561
+ var hasRequired = rows.some(function(row) {
4562
+ return row.required;
4563
+ });
4564
+ if (reqMode === "required" && !hasRequired) return false;
4565
+ if (reqMode === "optional" && hasRequired) return false;
4566
+ if (typePick && !rows.some(function(row) {
4567
+ return row.types.indexOf(typePick) >= 0;
4568
+ })) return false;
4569
+ return true;
4570
+ });
4571
+ function paramRow(row) {
4572
+ var extra = extraText(row.schema, t);
4573
+ return h2(
4574
+ "tr",
4575
+ { key: row.name },
4576
+ h2("td", { className: P + "-mono" }, Highlight.hit(row.name, kw)),
4577
+ h2("td", { className: P + "-mono" }, Highlight.hit(row.type, kw)),
4578
+ h2("td", { className: row.required ? P + "-req" : P + "-opt" }, row.required ? t.required : t.optional),
4579
+ // extra(默认 / 枚举 / 约束)不在过滤 haystack 里,因此也不高亮,保持「显示即命中」口径。
4580
+ h2("td", { className: P + "-mono" }, extra),
4581
+ h2("td", null, Highlight.hit(row.description, kw))
4582
+ );
4583
+ }
4584
+ function card(action) {
4585
+ var rows = paramRows(action);
4586
+ var examples = Array.isArray(action.examples) ? action.examples : [];
4587
+ return h2(
4588
+ "div",
4589
+ { className: P + "-card", key: action.name },
4590
+ h2(
4591
+ "div",
4592
+ { className: P + "-cardhead" },
4593
+ h2("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
4594
+ h2("span", { className: P + "-badge" }, action.domain),
4595
+ h2("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
4596
+ rows.some(function(row) {
4597
+ return row.required;
4598
+ }) ? h2("span", { className: P + "-badge " + P + "-req" }, t.required) : null
4599
+ ),
4600
+ action.description ? h2("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
4601
+ rows.length ? h2(
4602
+ "table",
4603
+ { className: P + "-table" },
4604
+ h2("thead", null, h2(
4605
+ "tr",
4606
+ null,
4607
+ h2("th", null, t.colName),
4608
+ h2("th", null, t.colType),
4609
+ h2("th", null, t.colReq),
4610
+ h2("th", null, t.colExtra),
4611
+ h2("th", null, t.colDesc)
4612
+ )),
4613
+ h2("tbody", null, rows.map(paramRow))
4614
+ ) : h2("div", { className: P + "-none" }, t.noParams),
4615
+ h2(
4616
+ "div",
4617
+ { className: P + "-example" },
4618
+ h2(
4619
+ "div",
4620
+ { className: P + "-examplehead" },
4621
+ h2("span", { className: P + "-none" }, t.examples),
4622
+ examples.length ? h2("button", {
4623
+ type: "button",
4624
+ className: P + "-copy",
4625
+ "data-copy-example": action.name,
4626
+ onClick: function() {
4627
+ copy(JSON.stringify(examples.length === 1 ? examples[0] : examples, null, 2));
4628
+ }
4629
+ }, t.copy) : null
4630
+ ),
4631
+ examples.length ? examples.map(function(example, index) {
4632
+ return h2("pre", { className: P + "-pre", key: index }, JSON.stringify(example, null, 2));
4633
+ }) : h2("div", { className: P + "-none" }, t.noExamples)
4634
+ ),
4635
+ h2(
4636
+ "details",
4637
+ null,
4638
+ h2("summary", null, t.raw),
4639
+ h2("pre", { className: P + "-pre" }, JSON.stringify(action.input || {}, null, 2))
4640
+ )
4641
+ );
4642
+ }
4643
+ var body;
4644
+ if (loading) {
4645
+ body = h2("div", { className: P + "-empty", role: "status" }, t.loading);
4646
+ } else if (err) {
4647
+ body = h2(
4648
+ "div",
4649
+ { className: P + "-error", role: "alert" },
4650
+ h2("span", null, t.loadFail + "\uFF1A" + err),
4651
+ h2("button", { type: "button", className: P + "-copy", onClick: function() {
4652
+ setReload(reload + 1);
4653
+ } }, t.retry)
4654
+ );
4655
+ } else if (!all.length) {
4656
+ body = h2("div", { className: P + "-empty" }, t.emptyRegistry);
4657
+ } else if (!visible.length) {
4658
+ body = h2("div", { className: P + "-empty" }, t.empty);
4659
+ } else {
4660
+ body = h2("div", { className: P + "-list" }, visible.map(card));
4661
+ }
4662
+ return h2(
4663
+ "div",
4664
+ { className: P },
4665
+ h2(
4666
+ "div",
4667
+ { className: P + "-head" },
4668
+ h2("h3", { className: P + "-title" }, t.title),
4669
+ h2("span", { className: P + "-badge" }, t.domain + " " + DOMAIN),
4670
+ info && info.version ? h2("span", { className: P + "-badge" }, t.versionLabel + " v" + info.version) : null,
4671
+ snap && snap.shellVersion ? h2("span", { className: P + "-badge" }, t.shell + " v" + snap.shellVersion) : null,
4672
+ h2("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
4673
+ h2("span", { className: P + "-none" }, t.hint)
4674
+ ),
4675
+ snap ? h2(
4676
+ "div",
4677
+ { className: P + "-toolbar" },
4678
+ h2(
4679
+ "label",
4680
+ { className: P + "-search" },
4681
+ icon("search", 14),
4682
+ h2("input", {
4683
+ type: "search",
4684
+ value: query,
4685
+ placeholder: t.search,
4686
+ "aria-label": t.search,
4687
+ onChange: function(e) {
4688
+ setQuery(e.target.value);
4689
+ }
4690
+ })
4691
+ ),
4692
+ h2(
4693
+ "label",
4694
+ { className: P + "-none" },
4695
+ t.filterReq + " ",
4696
+ h2(
4697
+ "select",
4698
+ { value: reqMode, "aria-label": t.filterReq, onChange: function(e) {
4699
+ setReqMode(e.target.value);
4700
+ } },
4701
+ h2("option", { value: "all" }, t.all),
4702
+ h2("option", { value: "required" }, t.onlyRequired),
4703
+ h2("option", { value: "optional" }, t.onlyOptional)
4704
+ )
4705
+ ),
4706
+ h2(
4707
+ "label",
4708
+ { className: P + "-none" },
4709
+ t.filterType + " ",
4710
+ h2(
4711
+ "select",
4712
+ { value: typePick, "aria-label": t.filterType, onChange: function(e) {
4713
+ setTypePick(e.target.value);
4714
+ } },
4715
+ h2("option", { value: "" }, t.allTypes),
4716
+ typeOptions.map(function(name) {
4717
+ return h2("option", { value: name, key: name }, name);
4718
+ })
4719
+ )
4720
+ )
4721
+ ) : null,
4722
+ body,
4723
+ toast ? h2("div", { className: P + "-toast", role: "status" }, toast) : null
4724
+ );
4725
+ }
4726
+ return { ActionSchemaView, DOMAIN, typeLabel, paramRows };
4727
+ };
4728
+ }
4729
+ });
4730
+
4731
+ // packages/addons/storage/client/views/actions.cjs
4732
+ var require_actions = __commonJS({
4733
+ "packages/addons/storage/client/views/actions.cjs"(exports2, module2) {
4734
+ "use strict";
4735
+ module2.exports = require_action_schema_view()({
4736
+ domain: "storage",
4737
+ prefix: "wbi"
4738
+ });
4739
+ }
4740
+ });
4741
+
4742
+ // packages/addons/storage/client/client.src.cjs
4743
+ var host = window.__WB_HOST__;
4744
+ if (host) {
4745
+ let tabIcon2 = function(name) {
4746
+ return function StorageTabIcon() {
4747
+ return h(Icon2, { name, size: 14 });
4748
+ };
4749
+ };
4750
+ tabIcon = tabIcon2;
4751
+ styleId = "wb-addon-storage-style";
4752
+ if (!document.getElementById(styleId)) {
4753
+ style = document.createElement("style");
4754
+ style.id = styleId;
4755
+ style.textContent = require_styles();
4756
+ document.head.appendChild(style);
4757
+ }
4758
+ h = require("react").createElement, Icon2 = require_icons().Icon;
4759
+ host.registerAddon({
4760
+ id: "wb-addon-storage",
4761
+ version: "1.5.1",
4762
+ views: [
4763
+ { id: "stats", icon: tabIcon2("chart"), title: { zh: "\u7EDF\u8BA1", en: "Statistics" }, component: require_stats().Stats },
4764
+ { id: "storage", icon: tabIcon2("list"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: require_records().Records },
4765
+ { id: "config", icon: tabIcon2("settings"), title: { zh: "\u914D\u7F6E", en: "Config" }, component: require_config().ConfigView },
4766
+ { id: "data", icon: tabIcon2("database"), title: { zh: "\u6570\u636E", en: "Data" }, component: require_data().DataView },
4767
+ { id: "actions", icon: tabIcon2("code-2"), title: { zh: "Action", en: "Actions" }, component: require_actions().ActionSchemaView }
4768
+ ]
4769
+ });
4770
+ } else console.error("[wb-addon-storage] Missing workbench host");
4771
+ var styleId;
4772
+ var style;
4773
+ var h;
4774
+ var Icon2;
4775
+ var tabIcon;
4776
+ module.exports = { name: "dsh-workbench-storage", inject: [], apply: function() {
4777
+ } };
4778
+ return module.exports;
4779
+ },
4780
+ });