dsh-workbench-vault 0.0.0-stage → 0.3.7

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