wi-chat 0.6.2 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.d.ts +12 -0
  3. package/dist/core/index.js +921 -342
  4. package/dist/core/useAnswerActions.d.ts +61 -0
  5. package/dist/core/useChat.d.ts +29 -3
  6. package/dist/core/useChatAuth.d.ts +175 -0
  7. package/dist/core/useChatRooms.d.ts +66 -0
  8. package/dist/core/useKeepAlive.d.ts +41 -0
  9. package/dist/core/useLlm.d.ts +73 -0
  10. package/dist/core/useRunningGroups.d.ts +58 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.js +119 -108
  14. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
  15. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
  16. package/dist/parser/answerCom/generic/parseGeneric.d.ts +52 -0
  17. package/dist/parser/answerCom/generic/types.d.ts +75 -0
  18. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +7 -6
  19. package/dist/parser/answerCom/outputFile/types.d.ts +15 -5
  20. package/dist/parser/answerCom/presentFiles/parsePresentFiles.d.ts +58 -0
  21. package/dist/parser/answerCom/presentFiles/types.d.ts +27 -0
  22. package/dist/parser/answerMeta.d.ts +71 -0
  23. package/dist/parser/deepThinking/parseDeepThinking.d.ts +8 -0
  24. package/dist/parser/history/history.d.ts +9 -0
  25. package/dist/parser/history/index.d.ts +1 -1
  26. package/dist/parser/index.cjs +6 -2
  27. package/dist/parser/index.d.ts +11 -2
  28. package/dist/parser/index.js +591 -366
  29. package/dist/parser/message.d.ts +9 -0
  30. package/dist/parser/runTime.d.ts +29 -0
  31. package/dist/renderers/TextAnswer-BgKGvG_o.cjs +2 -0
  32. package/dist/renderers/TextAnswer-PQwV3K7v.js +5 -0
  33. package/dist/renderers/answerCard/AnswerCard.vue.d.ts +65 -0
  34. package/dist/renderers/answerCard/AnswerToolbar.vue.d.ts +42 -0
  35. package/dist/renderers/answerConfig.d.ts +33 -0
  36. package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
  37. package/dist/renderers/index.cjs +6 -1
  38. package/dist/renderers/index.d.ts +14 -0
  39. package/dist/renderers/index.js +1485 -574
  40. package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
  41. package/dist/renderers/outputFile/OutputFileLink.vue.d.ts +19 -0
  42. package/dist/renderers/outputFile/localFile.d.ts +46 -0
  43. package/dist/renderers/outputFile/useOutputFile.d.ts +32 -3
  44. package/dist/renderers/presentFiles/PresentFiles.vue.d.ts +19 -0
  45. package/dist/renderers/recordset/RecordsetView.vue.d.ts +19 -0
  46. package/dist/renderers/sqlQuery/SqlQuery.vue.d.ts +19 -0
  47. package/dist/renderers/style.css +1 -1
  48. package/dist/renderers/text/TextAnswer.vue.d.ts +19 -0
  49. package/dist/request/api.d.ts +121 -1
  50. package/dist/request/client.d.ts +12 -0
  51. package/dist/request/index.cjs +4 -2
  52. package/dist/request/index.d.ts +6 -4
  53. package/dist/request/index.js +780 -179
  54. package/dist/request/login.d.ts +36 -0
  55. package/dist/request/ws.d.ts +11 -86
  56. package/dist/request/wsCore.d.ts +104 -0
  57. package/dist/request/wsSession.d.ts +353 -0
  58. package/dist/right-panel/RightPanelTabs.vue.d.ts +4 -0
  59. package/dist/right-panel/index.cjs +1 -1
  60. package/dist/right-panel/index.d.ts +1 -1
  61. package/dist/right-panel/index.js +598 -499
  62. package/dist/right-panel/style.css +1 -1
  63. package/dist/right-panel/types.d.ts +10 -0
  64. package/dist/tools/index.cjs +5 -5
  65. package/dist/tools/index.d.ts +2 -2
  66. package/dist/tools/index.js +323 -208
  67. package/dist/tools/markdown/index.d.ts +2 -0
  68. package/dist/tools/markdown/interactions.d.ts +39 -0
  69. package/dist/tools/markdown/sanitize.d.ts +6 -0
  70. package/dist/tools/style.css +1 -1
  71. package/dist/web-ui/attach/AttachmentCard.vue.d.ts +1 -1
  72. package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
  73. package/dist/web-ui/chat/ChatContainer.vue.d.ts +5 -5
  74. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +1 -1
  75. package/dist/web-ui/index.cjs +1 -1
  76. package/dist/web-ui/index.js +1 -1
  77. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +5 -5
  78. package/dist/web-ui/style.css +1 -1
  79. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- import { defineComponent as G, computed as y, openBlock as h, createElementBlock as v, Fragment as B, renderList as Q, createElementVNode as u, normalizeClass as le, createVNode as $, toDisplayString as R, createCommentVNode as P, withModifiers as se, ref as E, watch as V, withDirectives as ve, vModelText as Le, normalizeStyle as ge, unref as _e, createBlock as be, createTextVNode as Ce, onMounted as fe, onUnmounted as me, shallowReactive as Se, reactive as we, nextTick as Ae, resolveDynamicComponent as We, vShow as Ne } from "vue";
2
- const pe = {
1
+ import { defineComponent as K, computed as $, openBlock as h, createElementBlock as f, Fragment as G, renderList as X, ref as P, reactive as ce, onBeforeUnmount as We, createElementVNode as b, withModifiers as Q, normalizeClass as ue, createVNode as z, toDisplayString as W, createCommentVNode as D, createBlock as de, Teleport as De, normalizeStyle as pe, nextTick as _e, watch as q, withDirectives as we, vModelText as Ne, unref as ye, createTextVNode as Oe, onMounted as Te, onUnmounted as ke, shallowReactive as Ue, resolveDynamicComponent as Be, vShow as Ve } from "vue";
2
+ const fe = {
3
3
  /** 地球:网页标签页与推荐站点缺省图标 */
4
4
  globe: [
5
5
  "M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18",
@@ -47,15 +47,15 @@ const pe = {
47
47
  maximize: ["M4 9V4h5", "M20 9V4h-5", "M4 15v5h5", "M20 15v5h-5"],
48
48
  /** 还原(四角向内) */
49
49
  restore: ["M9 4v5H4", "M15 4v5h5", "M9 20v-5H4", "M15 20v-5h5"]
50
- }, Oe = ["width", "height"], Ue = ["d"], De = /* @__PURE__ */ G({
50
+ }, Fe = ["width", "height"], Ge = ["d"], He = /* @__PURE__ */ K({
51
51
  __name: "RightPanelIcon",
52
52
  props: {
53
53
  name: { default: "globe" },
54
54
  size: { default: 16 }
55
55
  },
56
56
  setup(t) {
57
- const e = t, n = y(() => pe[e.name] ?? pe.globe);
58
- return (d, o) => (h(), v("svg", {
57
+ const e = t, n = $(() => fe[e.name] ?? fe.globe);
58
+ return (s, i) => (h(), f("svg", {
59
59
  class: "wi-right-panel__icon",
60
60
  width: t.size,
61
61
  height: t.size,
@@ -67,207 +67,296 @@ const pe = {
67
67
  "stroke-linejoin": "round",
68
68
  "aria-hidden": "true"
69
69
  }, [
70
- (h(!0), v(B, null, Q(n.value, (l, g) => (h(), v("path", {
71
- key: g,
72
- d: l
73
- }, null, 8, Ue))), 128))
74
- ], 8, Oe));
70
+ (h(!0), f(G, null, X(n.value, (o, m) => (h(), f("path", {
71
+ key: m,
72
+ d: o
73
+ }, null, 8, Ge))), 128))
74
+ ], 8, Fe));
75
75
  }
76
- }), F = (t, e) => {
76
+ }), j = (t, e) => {
77
77
  const n = t.__vccOpts || t;
78
- for (const [d, o] of e)
79
- n[d] = o;
78
+ for (const [s, i] of e)
79
+ n[s] = i;
80
80
  return n;
81
- }, I = /* @__PURE__ */ F(De, [["__scopeId", "data-v-5a35fd97"]]), Be = { class: "wi-right-panel__tabs" }, Ge = { class: "wi-right-panel__tabs-list" }, Fe = ["title", "onClick"], He = { class: "wi-right-panel__tab-title" }, Ke = {
81
+ }, S = /* @__PURE__ */ j(He, [["__scopeId", "data-v-5a35fd97"]]), Ke = { class: "wi-right-panel__tabs-list" }, je = ["title", "onClick", "onContextmenu"], Xe = { class: "wi-right-panel__tab-title" }, qe = {
82
82
  key: 0,
83
83
  class: "wi-right-panel__tab-loading"
84
- }, Ve = ["onClick"], je = ["title"], Xe = /* @__PURE__ */ G({
84
+ }, Je = ["onClick"], Ye = ["title"], Qe = ["disabled", "aria-disabled", "onClick"], Ze = /* @__PURE__ */ K({
85
85
  __name: "RightPanelTabs",
86
86
  props: {
87
87
  tabs: {},
88
88
  activeId: {},
89
89
  maximized: { type: Boolean }
90
90
  },
91
- emits: ["select", "close", "add", "toggle-maximize", "collapse"],
91
+ emits: ["select", "close", "close-left", "close-right", "add", "toggle-maximize", "collapse"],
92
92
  setup(t, { emit: e }) {
93
- const n = e;
94
- return (d, o) => (h(), v("div", Be, [
95
- u("div", Ge, [
96
- (h(!0), v(B, null, Q(t.tabs, (l) => (h(), v("button", {
97
- key: l.id,
93
+ const n = t, s = e, i = ["--wi-chat-border", "--wi-chat-text", "--wi-chat-text-secondary"], o = P(null), m = P(null), v = ce({ visible: !1, x: 0, y: 0, tabId: "", themeVars: {} }), x = () => {
94
+ if (!o.value) return {};
95
+ const g = getComputedStyle(o.value);
96
+ return i.reduce((u, d) => {
97
+ const R = g.getPropertyValue(d).trim();
98
+ return R && (u[d] = R), u;
99
+ }, {});
100
+ }, M = () => {
101
+ var g;
102
+ return Array.from(((g = m.value) == null ? void 0 : g.querySelectorAll('[role="menuitem"]:not(:disabled)')) ?? []);
103
+ }, k = (g) => {
104
+ const u = M();
105
+ if (!u.length) return;
106
+ const d = u.indexOf(document.activeElement), R = d < 0 ? g > 0 ? 0 : u.length - 1 : (d + g + u.length) % u.length;
107
+ u[R].focus();
108
+ }, A = $(() => {
109
+ const g = n.tabs.findIndex((u) => u.id === v.tabId);
110
+ return [
111
+ { key: "close", label: "关闭当前标签页", disabled: g < 0 },
112
+ { key: "close-left", label: "关闭左侧标签页", disabled: g <= 0 },
113
+ { key: "close-right", label: "关闭右侧标签页", disabled: g < 0 || g >= n.tabs.length - 1 }
114
+ ];
115
+ }), w = () => {
116
+ v.visible && (v.visible = !1, document.removeEventListener("mousedown", T, !0), document.removeEventListener("keydown", N, !0), window.removeEventListener("blur", w), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0));
117
+ }, T = (g) => {
118
+ var u;
119
+ (u = m.value) != null && u.contains(g.target) || w();
120
+ }, N = (g) => {
121
+ var u, d;
122
+ switch (g.key) {
123
+ case "Escape":
124
+ g.preventDefault(), g.stopPropagation(), w();
125
+ break;
126
+ case "ArrowDown":
127
+ g.preventDefault(), k(1);
128
+ break;
129
+ case "ArrowUp":
130
+ g.preventDefault(), k(-1);
131
+ break;
132
+ case "Home":
133
+ g.preventDefault(), (u = M()[0]) == null || u.focus();
134
+ break;
135
+ case "End": {
136
+ g.preventDefault();
137
+ const R = M();
138
+ (d = R[R.length - 1]) == null || d.focus();
139
+ break;
140
+ }
141
+ case "Tab":
142
+ w();
143
+ break;
144
+ }
145
+ }, O = async (g, u) => {
146
+ var R, F;
147
+ w(), v.tabId = u, v.x = g.clientX, v.y = g.clientY, v.themeVars = x(), v.visible = !0, document.addEventListener("mousedown", T, !0), document.addEventListener("keydown", N, !0), window.addEventListener("blur", w), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), await _e();
148
+ const d = (R = m.value) == null ? void 0 : R.getBoundingClientRect();
149
+ d && (v.x = Math.max(4, Math.min(v.x, window.innerWidth - d.width - 4)), v.y = Math.max(4, Math.min(v.y, window.innerHeight - d.height - 4)), (F = M()[0]) == null || F.focus());
150
+ }, V = (g) => {
151
+ const u = v.tabId;
152
+ w(), s(g === "close" ? "close" : g === "close-left" ? "close-left" : "close-right", u);
153
+ };
154
+ return We(w), (g, u) => (h(), f("div", {
155
+ ref_key: "rootRef",
156
+ ref: o,
157
+ class: "wi-right-panel__tabs"
158
+ }, [
159
+ b("div", Ke, [
160
+ (h(!0), f(G, null, X(t.tabs, (d) => (h(), f("button", {
161
+ key: d.id,
98
162
  type: "button",
99
- class: le(["wi-right-panel__tab", { "is-active": l.id === t.activeId }]),
100
- title: l.title,
101
- onClick: (g) => n("select", l.id)
163
+ class: ue(["wi-right-panel__tab", { "is-active": d.id === t.activeId }]),
164
+ title: d.title,
165
+ onClick: (R) => s("select", d.id),
166
+ onContextmenu: Q((R) => O(R, d.id), ["prevent"])
102
167
  }, [
103
- $(I, {
104
- name: l.icon || "globe",
168
+ z(S, {
169
+ name: d.icon || "globe",
105
170
  size: 14
106
171
  }, null, 8, ["name"]),
107
- u("span", He, R(l.title), 1),
108
- l.loading ? (h(), v("span", Ke)) : P("", !0),
109
- u("span", {
172
+ b("span", Xe, W(d.title), 1),
173
+ d.loading ? (h(), f("span", qe)) : D("", !0),
174
+ b("span", {
110
175
  class: "wi-right-panel__tab-close",
111
176
  title: "关闭标签页",
112
- onClick: se((g) => n("close", l.id), ["stop"])
177
+ onClick: Q((R) => s("close", d.id), ["stop"])
113
178
  }, [
114
- $(I, {
179
+ z(S, {
115
180
  name: "close",
116
181
  size: 12
117
182
  })
118
- ], 8, Ve)
119
- ], 10, Fe))), 128))
183
+ ], 8, Je)
184
+ ], 42, je))), 128))
120
185
  ]),
121
- u("button", {
186
+ b("button", {
122
187
  type: "button",
123
188
  class: "wi-right-panel__tab-action",
124
189
  title: "新建标签页 Ctrl+Shift+B",
125
- onClick: o[0] || (o[0] = (l) => n("add"))
190
+ onClick: u[0] || (u[0] = (d) => s("add"))
126
191
  }, [
127
- $(I, {
192
+ z(S, {
128
193
  name: "plus",
129
194
  size: 15
130
195
  })
131
196
  ]),
132
- u("button", {
197
+ b("button", {
133
198
  type: "button",
134
199
  class: "wi-right-panel__tab-action wi-right-panel__tab-action--maximize",
135
200
  title: t.maximized ? "还原面板" : "最大化面板",
136
- onClick: o[1] || (o[1] = (l) => n("toggle-maximize"))
201
+ onClick: u[1] || (u[1] = (d) => s("toggle-maximize"))
137
202
  }, [
138
- $(I, {
203
+ z(S, {
139
204
  name: t.maximized ? "restore" : "maximize",
140
205
  size: 15
141
206
  }, null, 8, ["name"])
142
- ], 8, je),
143
- u("button", {
207
+ ], 8, Ye),
208
+ b("button", {
144
209
  type: "button",
145
210
  class: "wi-right-panel__tab-action wi-right-panel__tab-action--collapse",
146
211
  title: "收起侧边栏",
147
- onClick: o[2] || (o[2] = (l) => n("collapse"))
212
+ onClick: u[2] || (u[2] = (d) => s("collapse"))
148
213
  }, [
149
- $(I, {
214
+ z(S, {
150
215
  name: "sidebar",
151
216
  size: 15
152
217
  })
153
- ])
154
- ]));
218
+ ]),
219
+ (h(), de(De, { to: "body" }, [
220
+ v.visible ? (h(), f("div", {
221
+ key: 0,
222
+ ref_key: "menuRef",
223
+ ref: m,
224
+ class: "wi-right-panel__tab-menu",
225
+ role: "menu",
226
+ "aria-label": "标签页操作",
227
+ style: pe({ ...v.themeVars, left: `${v.x}px`, top: `${v.y}px` }),
228
+ onContextmenu: u[3] || (u[3] = Q(() => {
229
+ }, ["prevent"]))
230
+ }, [
231
+ (h(!0), f(G, null, X(A.value, (d) => (h(), f("button", {
232
+ key: d.key,
233
+ type: "button",
234
+ role: "menuitem",
235
+ tabindex: "-1",
236
+ class: "wi-right-panel__tab-menu-item",
237
+ disabled: d.disabled,
238
+ "aria-disabled": d.disabled,
239
+ onClick: (R) => V(d.key)
240
+ }, W(d.label), 9, Qe))), 128))
241
+ ], 36)) : D("", !0)
242
+ ]))
243
+ ], 512));
155
244
  }
156
- }), qe = /* @__PURE__ */ F(Xe, [["__scopeId", "data-v-0f712f34"]]), ye = () => typeof window > "u" ? {} : window, Te = () => {
245
+ }), et = /* @__PURE__ */ j(Ze, [["__scopeId", "data-v-03671384"]]), xe = () => typeof window > "u" ? {} : window, Me = () => {
157
246
  var e;
158
- const t = ye();
247
+ const t = xe();
159
248
  return !!((e = t.electronApp) != null && e.isElectron) || !!t.wiElectron || !!t.wiChatDesktop;
160
- }, Je = { class: "wi-right-panel__toolbar" }, Qe = ["disabled"], Ye = ["disabled"], Ze = {
249
+ }, tt = { class: "wi-right-panel__toolbar" }, nt = ["disabled"], at = ["disabled"], it = {
161
250
  key: 0,
162
251
  class: "wi-right-panel__address-loading"
163
- }, et = ["disabled"], tt = /* @__PURE__ */ G({
252
+ }, ot = ["disabled"], st = /* @__PURE__ */ K({
164
253
  __name: "BrowserToolbar",
165
254
  props: {
166
255
  tab: {},
167
256
  panel: {}
168
257
  },
169
258
  setup(t) {
170
- const e = t, n = y(() => e.panel.canGoBack.value), d = y(() => e.panel.canGoForward.value), o = E(""), l = E();
171
- V(
259
+ const e = t, n = $(() => e.panel.canGoBack.value), s = $(() => e.panel.canGoForward.value), i = P(""), o = P();
260
+ q(
172
261
  () => e.tab.url,
173
- (f) => {
174
- o.value = f ?? "";
262
+ (x) => {
263
+ i.value = x ?? "";
175
264
  },
176
265
  { immediate: !0 }
177
266
  );
178
- const g = () => {
179
- const f = o.value.trim();
180
- f && e.panel.navigate(f);
181
- }, T = () => {
182
- const f = e.tab.url;
183
- !f || typeof window > "u" || window.open(f, "_blank", "noopener,noreferrer");
267
+ const m = () => {
268
+ const x = i.value.trim();
269
+ x && e.panel.navigate(x);
270
+ }, v = () => {
271
+ const x = e.tab.url;
272
+ !x || typeof window > "u" || window.open(x, "_blank", "noopener,noreferrer");
184
273
  };
185
- return (f, w) => (h(), v("div", Je, [
186
- u("button", {
274
+ return (x, M) => (h(), f("div", tt, [
275
+ b("button", {
187
276
  type: "button",
188
277
  class: "wi-right-panel__tool",
189
278
  disabled: !n.value,
190
279
  title: "后退",
191
- onClick: w[0] || (w[0] = (m) => t.panel.goBack())
280
+ onClick: M[0] || (M[0] = (k) => t.panel.goBack())
192
281
  }, [
193
- $(I, {
282
+ z(S, {
194
283
  name: "arrow-left",
195
284
  size: 15
196
285
  })
197
- ], 8, Qe),
198
- u("button", {
286
+ ], 8, nt),
287
+ b("button", {
199
288
  type: "button",
200
289
  class: "wi-right-panel__tool",
201
- disabled: !d.value,
290
+ disabled: !s.value,
202
291
  title: "前进",
203
- onClick: w[1] || (w[1] = (m) => t.panel.goForward())
292
+ onClick: M[1] || (M[1] = (k) => t.panel.goForward())
204
293
  }, [
205
- $(I, {
294
+ z(S, {
206
295
  name: "arrow-right",
207
296
  size: 15
208
297
  })
209
- ], 8, Ye),
210
- u("button", {
298
+ ], 8, at),
299
+ b("button", {
211
300
  type: "button",
212
301
  class: "wi-right-panel__tool",
213
302
  title: "刷新",
214
- onClick: w[2] || (w[2] = (m) => t.panel.reload())
303
+ onClick: M[2] || (M[2] = (k) => t.panel.reload())
215
304
  }, [
216
- $(I, {
305
+ z(S, {
217
306
  name: "reload",
218
307
  size: 15
219
308
  })
220
309
  ]),
221
- u("form", {
310
+ b("form", {
222
311
  class: "wi-right-panel__address",
223
- onSubmit: se(g, ["prevent"])
312
+ onSubmit: Q(m, ["prevent"])
224
313
  }, [
225
- $(I, {
314
+ z(S, {
226
315
  class: "wi-right-panel__address-icon",
227
316
  name: "search",
228
317
  size: 13
229
318
  }),
230
- ve(u("input", {
319
+ we(b("input", {
231
320
  ref_key: "inputRef",
232
- ref: l,
233
- "onUpdate:modelValue": w[3] || (w[3] = (m) => o.value = m),
321
+ ref: o,
322
+ "onUpdate:modelValue": M[3] || (M[3] = (k) => i.value = k),
234
323
  class: "wi-right-panel__address-input",
235
324
  type: "text",
236
325
  placeholder: "搜索或输入网址",
237
326
  spellcheck: "false",
238
327
  autocomplete: "off"
239
328
  }, null, 512), [
240
- [Le, o.value]
329
+ [Ne, i.value]
241
330
  ]),
242
- t.tab.loading ? (h(), v("span", Ze)) : P("", !0)
331
+ t.tab.loading ? (h(), f("span", it)) : D("", !0)
243
332
  ], 32),
244
- u("button", {
333
+ b("button", {
245
334
  type: "button",
246
335
  class: "wi-right-panel__tool",
247
336
  disabled: !t.tab.url,
248
337
  title: "在新窗口打开",
249
- onClick: T
338
+ onClick: v
250
339
  }, [
251
- $(I, {
340
+ z(S, {
252
341
  name: "external",
253
342
  size: 15
254
343
  })
255
- ], 8, et)
344
+ ], 8, ot)
256
345
  ]));
257
346
  }
258
- }), ke = /* @__PURE__ */ F(tt, [["__scopeId", "data-v-89af1cad"]]), nt = {
347
+ }), Ee = /* @__PURE__ */ j(st, [["__scopeId", "data-v-89af1cad"]]), lt = {
259
348
  key: 0,
260
349
  class: "wi-right-panel__section"
261
- }, at = {
350
+ }, rt = {
262
351
  key: 0,
263
352
  class: "wi-right-panel__section-title"
264
- }, it = ["title", "onClick"], ot = { class: "wi-right-panel__tool-card-label" }, lt = {
353
+ }, ct = ["title", "onClick"], ut = { class: "wi-right-panel__tool-card-label" }, dt = {
265
354
  key: 0,
266
355
  class: "wi-right-panel__tool-card-tag"
267
- }, st = {
356
+ }, pt = {
268
357
  key: 1,
269
358
  class: "wi-right-panel__tool-card-shortcut"
270
- }, rt = /* @__PURE__ */ G({
359
+ }, ht = /* @__PURE__ */ K({
271
360
  __name: "RightPanelToolList",
272
361
  props: {
273
362
  tools: {},
@@ -276,33 +365,33 @@ const pe = {
276
365
  },
277
366
  emits: ["tool-click"],
278
367
  setup(t, { emit: e }) {
279
- const n = e, d = (o) => {
280
- n("tool-click", o);
368
+ const n = e, s = (i) => {
369
+ n("tool-click", i);
281
370
  };
282
- return (o, l) => t.tools.length ? (h(), v("section", nt, [
283
- t.title ? (h(), v("h4", at, R(t.title), 1)) : P("", !0),
284
- u("div", {
371
+ return (i, o) => t.tools.length ? (h(), f("section", lt, [
372
+ t.title ? (h(), f("h4", rt, W(t.title), 1)) : D("", !0),
373
+ b("div", {
285
374
  class: "wi-right-panel__tools",
286
- style: ge({ gridTemplateColumns: `repeat(${t.columns}, minmax(0, 1fr))` })
375
+ style: pe({ gridTemplateColumns: `repeat(${t.columns}, minmax(0, 1fr))` })
287
376
  }, [
288
- (h(!0), v(B, null, Q(t.tools, (g) => (h(), v("button", {
289
- key: g.key,
377
+ (h(!0), f(G, null, X(t.tools, (m) => (h(), f("button", {
378
+ key: m.key,
290
379
  type: "button",
291
- class: le(["wi-right-panel__tool-card", { "is-disabled": g.disabled }]),
292
- title: g.description ?? g.label,
293
- onClick: (T) => d(g)
380
+ class: ue(["wi-right-panel__tool-card", { "is-disabled": m.disabled }]),
381
+ title: m.description ?? m.label,
382
+ onClick: (v) => s(m)
294
383
  }, [
295
- $(I, {
296
- name: g.icon,
384
+ z(S, {
385
+ name: m.icon,
297
386
  size: 16
298
387
  }, null, 8, ["name"]),
299
- u("span", ot, R(g.label), 1),
300
- g.disabled ? (h(), v("span", lt, "即将支持")) : g.shortcut ? (h(), v("span", st, R(g.shortcut), 1)) : P("", !0)
301
- ], 10, it))), 128))
388
+ b("span", ut, W(m.label), 1),
389
+ m.disabled ? (h(), f("span", dt, "即将支持")) : m.shortcut ? (h(), f("span", pt, W(m.shortcut), 1)) : D("", !0)
390
+ ], 10, ct))), 128))
302
391
  ], 4)
303
- ])) : P("", !0);
392
+ ])) : D("", !0);
304
393
  }
305
- }), ct = /* @__PURE__ */ F(rt, [["__scopeId", "data-v-edb8e61a"]]), dt = [], ut = [
394
+ }), vt = /* @__PURE__ */ j(ht, [["__scopeId", "data-v-edb8e61a"]]), bt = [], gt = [
306
395
  {
307
396
  title: "地图 Demo · OpenLayers",
308
397
  url: "https://openlayers.org/",
@@ -313,10 +402,10 @@ const pe = {
313
402
  url: "http://127.0.0.1:8890",
314
403
  description: "本机开发服务"
315
404
  }
316
- ], pt = { class: "wi-right-panel__newtab" }, ht = { class: "wi-right-panel__newtab-body" }, vt = { class: "wi-right-panel__hero" }, gt = { class: "wi-right-panel__hero-title" }, _t = { class: "wi-right-panel__hero-desc" }, bt = {
405
+ ], ft = { class: "wi-right-panel__newtab" }, mt = { class: "wi-right-panel__newtab-body" }, _t = { class: "wi-right-panel__hero" }, wt = { class: "wi-right-panel__hero-title" }, yt = { class: "wi-right-panel__hero-desc" }, Tt = {
317
406
  key: 0,
318
407
  class: "wi-right-panel__section"
319
- }, ft = { class: "wi-right-panel__recommendations" }, mt = ["title", "onClick"], wt = { class: "wi-right-panel__recommendation-icon" }, yt = { class: "wi-right-panel__recommendation-title" }, Tt = /* @__PURE__ */ G({
408
+ }, kt = { class: "wi-right-panel__recommendations" }, xt = ["title", "onClick"], Mt = { class: "wi-right-panel__recommendation-icon" }, Et = { class: "wi-right-panel__recommendation-title" }, It = /* @__PURE__ */ K({
320
409
  __name: "NewTabPanel",
321
410
  props: {
322
411
  tab: {},
@@ -324,71 +413,71 @@ const pe = {
324
413
  },
325
414
  emits: ["tool-click"],
326
415
  setup(t, { emit: e }) {
327
- const n = t, d = e, o = y(() => n.panel.options.tools ?? dt), l = y(() => n.panel.options.recommendations ?? ut), g = Te() ? "在这里打开网页或终端,与对话并行使用;每个标签页都会各自保留页面状态。" : "在这里打开网页,与对话并行使用;每个标签页都会各自保留页面状态。", T = (m) => {
328
- d("tool-click", m);
329
- }, f = (m) => {
330
- n.panel.navigate(m.url, m.title);
331
- }, w = (m) => m.trim().charAt(0).toUpperCase() || "·";
332
- return (m, z) => (h(), v("div", pt, [
333
- $(ke, {
416
+ const n = t, s = e, i = $(() => n.panel.options.tools ?? bt), o = $(() => n.panel.options.recommendations ?? gt), m = Me() ? "在这里打开网页或终端,与对话并行使用;每个标签页都会各自保留页面状态。" : "在这里打开网页,与对话并行使用;每个标签页都会各自保留页面状态。", v = (k) => {
417
+ s("tool-click", k);
418
+ }, x = (k) => {
419
+ n.panel.navigate(k.url, k.title);
420
+ }, M = (k) => k.trim().charAt(0).toUpperCase() || "·";
421
+ return (k, A) => (h(), f("div", ft, [
422
+ z(Ee, {
334
423
  tab: t.tab,
335
424
  panel: t.panel
336
425
  }, null, 8, ["tab", "panel"]),
337
- u("div", ht, [
338
- u("section", vt, [
339
- u("h3", gt, R(t.panel.options.newTabTitle), 1),
340
- u("p", _t, R(_e(g)), 1)
426
+ b("div", mt, [
427
+ b("section", _t, [
428
+ b("h3", wt, W(t.panel.options.newTabTitle), 1),
429
+ b("p", yt, W(ye(m)), 1)
341
430
  ]),
342
- $(ct, {
343
- tools: o.value,
344
- onToolClick: T
431
+ z(vt, {
432
+ tools: i.value,
433
+ onToolClick: v
345
434
  }, null, 8, ["tools"]),
346
- l.value.length ? (h(), v("section", bt, [
347
- z[0] || (z[0] = u("h4", { class: "wi-right-panel__section-title" }, "推荐", -1)),
348
- u("div", ft, [
349
- (h(!0), v(B, null, Q(l.value, (M) => (h(), v("button", {
350
- key: M.url,
435
+ o.value.length ? (h(), f("section", Tt, [
436
+ A[0] || (A[0] = b("h4", { class: "wi-right-panel__section-title" }, "推荐", -1)),
437
+ b("div", kt, [
438
+ (h(!0), f(G, null, X(o.value, (w) => (h(), f("button", {
439
+ key: w.url,
351
440
  type: "button",
352
441
  class: "wi-right-panel__recommendation",
353
- title: M.description ?? M.url,
354
- onClick: (b) => f(M)
442
+ title: w.description ?? w.url,
443
+ onClick: (T) => x(w)
355
444
  }, [
356
- u("span", wt, [
357
- M.icon ? (h(), be(I, {
445
+ b("span", Mt, [
446
+ w.icon ? (h(), de(S, {
358
447
  key: 0,
359
- name: M.icon,
448
+ name: w.icon,
360
449
  size: 17
361
- }, null, 8, ["name"])) : (h(), v(B, { key: 1 }, [
362
- Ce(R(w(M.title)), 1)
450
+ }, null, 8, ["name"])) : (h(), f(G, { key: 1 }, [
451
+ Oe(W(M(w.title)), 1)
363
452
  ], 64))
364
453
  ]),
365
- u("span", yt, R(M.title), 1)
366
- ], 8, mt))), 128))
454
+ b("span", Et, W(w.title), 1)
455
+ ], 8, xt))), 128))
367
456
  ])
368
- ])) : P("", !0)
457
+ ])) : D("", !0)
369
458
  ])
370
459
  ]));
371
460
  }
372
- }), kt = /* @__PURE__ */ F(Tt, [["__scopeId", "data-v-1d433f71"]]), Mt = {
461
+ }), $t = /* @__PURE__ */ j(It, [["__scopeId", "data-v-1d433f71"]]), Rt = {
373
462
  type: "newtab",
374
463
  defaultTitle: "新建标签页",
375
464
  icon: "newtab",
376
- component: kt
377
- }, $t = "persist:wi-right-panel", xt = () => {
378
- var n, d, o;
465
+ component: $t
466
+ }, Lt = "persist:wi-right-panel", zt = () => {
467
+ var n, s, i;
379
468
  if (typeof window > "u" || typeof document > "u") return !1;
380
- const t = ye();
381
- return !!((n = t.electronApp) != null && n.isElectron) || !!t.wiElectron ? ((d = t.wiElectron) == null ? void 0 : d.rightPanelWebviewEnabled) === !0 || ((o = t.electronApp) == null ? void 0 : o.rightPanelWebviewEnabled) === !0 : !1;
382
- }, It = (t) => t || (xt() ? "webview" : "iframe"), Et = (t, e = $t) => {
469
+ const t = xe();
470
+ return !!((n = t.electronApp) != null && n.isElectron) || !!t.wiElectron ? ((s = t.wiElectron) == null ? void 0 : s.rightPanelWebviewEnabled) === !0 || ((i = t.electronApp) == null ? void 0 : i.rightPanelWebviewEnabled) === !0 : !1;
471
+ }, Ct = (t) => t || (zt() ? "webview" : "iframe"), Pt = (t, e = Lt) => {
383
472
  const n = document.createElement("webview");
384
- return n.className = "wi-right-panel__webview", n.style.display = "flex", n.style.width = "100%", n.style.height = "100%", n.style.background = "#fff", n.setAttribute("partition", e), t && n.setAttribute("src", t), n;
385
- }, Rt = { class: "wi-right-panel__web" }, zt = {
473
+ return n.className = "wi-right-panel__webview", n.style.display = "flex", n.style.width = "100%", n.style.height = "100%", n.style.border = "0", n.style.background = "#fff", n.setAttribute("partition", e), t && n.setAttribute("src", t), n;
474
+ }, St = { class: "wi-right-panel__web" }, At = {
386
475
  key: 0,
387
476
  class: "wi-right-panel__frame-hint"
388
- }, Pt = { class: "wi-right-panel__web-body" }, Lt = ["src", "title"], Ct = {
477
+ }, Wt = { class: "wi-right-panel__web-body" }, Dt = ["src", "title"], Nt = {
389
478
  key: 2,
390
479
  class: "wi-right-panel__blocked"
391
- }, St = { class: "wi-right-panel__blocked-title" }, At = { class: "wi-right-panel__blocked-desc" }, Wt = /* @__PURE__ */ G({
480
+ }, Ot = { class: "wi-right-panel__blocked-title" }, Ut = { class: "wi-right-panel__blocked-desc" }, Bt = /* @__PURE__ */ K({
392
481
  __name: "WebPanel",
393
482
  props: {
394
483
  tab: {},
@@ -396,138 +485,138 @@ const pe = {
396
485
  runtime: {}
397
486
  },
398
487
  setup(t) {
399
- const e = t, n = It(e.runtime) === "webview", d = y(() => `${e.tab.id}-${e.tab.reloadKey ?? 0}`), o = E(!1), l = () => {
400
- o.value = !1, e.panel.reload(), n || m();
401
- }, g = () => {
402
- const i = e.tab.url;
403
- !i || typeof window > "u" || window.open(i, "_blank", "noopener,noreferrer");
404
- }, T = E(!1);
405
- let f;
406
- const w = () => {
407
- f && clearTimeout(f), f = void 0;
488
+ const e = t, n = Ct(e.runtime) === "webview", s = $(() => `${e.tab.id}-${e.tab.reloadKey ?? 0}`), i = P(!1), o = () => {
489
+ i.value = !1, e.panel.reload(), n || k();
490
+ }, m = () => {
491
+ const p = e.tab.url;
492
+ !p || typeof window > "u" || window.open(p, "_blank", "noopener,noreferrer");
493
+ }, v = P(!1);
494
+ let x;
495
+ const M = () => {
496
+ x && clearTimeout(x), x = void 0;
408
497
  };
409
- function m() {
410
- w(), T.value = !1, o.value = !1, f = setTimeout(() => {
411
- T.value || (o.value = !0);
498
+ function k() {
499
+ M(), v.value = !1, i.value = !1, x = setTimeout(() => {
500
+ v.value || (i.value = !0);
412
501
  }, 8e3);
413
502
  }
414
- const z = (i) => {
415
- var s, k;
416
- T.value = !0, o.value = !1, w(), e.panel.updateTab(e.tab.id, { loading: !1 });
503
+ const A = (p) => {
504
+ var E, _;
505
+ v.value = !0, i.value = !1, M(), e.panel.updateTab(e.tab.id, { loading: !1 });
417
506
  try {
418
- const D = (k = (s = i.target.contentDocument) == null ? void 0 : s.title) == null ? void 0 : k.trim();
419
- D && e.panel.updateTab(e.tab.id, { title: D });
507
+ const L = (_ = (E = p.target.contentDocument) == null ? void 0 : E.title) == null ? void 0 : _.trim();
508
+ L && e.panel.updateTab(e.tab.id, { title: L });
420
509
  } catch {
421
510
  }
422
511
  };
423
- V(
512
+ q(
424
513
  () => e.tab.url,
425
- (i) => {
426
- !i || n || (e.panel.updateTab(e.tab.id, { loading: !0 }), m());
514
+ (p) => {
515
+ !p || n || (e.panel.updateTab(e.tab.id, { loading: !0 }), k());
427
516
  }
428
517
  );
429
- const M = E();
430
- let b = null;
431
- const C = E(e.tab.url ?? "");
432
- let S = "";
433
- const W = (i) => {
434
- if (i) {
435
- if (!b) {
436
- S = i;
518
+ const w = P();
519
+ let T = null;
520
+ const N = P(e.tab.url ?? "");
521
+ let O = "";
522
+ const V = (p) => {
523
+ if (p) {
524
+ if (!T) {
525
+ O = p;
437
526
  return;
438
527
  }
439
- i !== C.value && (C.value = i, e.panel.updateTab(e.tab.id, { loading: !0 }), b.setAttribute("src", i));
528
+ p !== N.value && (N.value = p, e.panel.updateTab(e.tab.id, { loading: !0 }), T.setAttribute("src", p));
440
529
  }
441
- }, H = () => {
442
- o.value = !1, e.panel.updateTab(e.tab.id, { loading: !0 });
443
- }, X = () => {
530
+ }, g = () => {
531
+ i.value = !1, e.panel.updateTab(e.tab.id, { loading: !0 });
532
+ }, u = () => {
444
533
  e.panel.updateTab(e.tab.id, { loading: !1 });
445
- }, N = (i) => {
446
- const s = i;
447
- s.isMainFrame === !1 || !s.url || s.url === "about:blank" || (C.value = s.url, e.panel.recordNavigation(s.url, void 0, e.tab.id));
448
- }, O = (i) => {
449
- const s = i;
450
- s.title && e.panel.updateTab(e.tab.id, { title: s.title });
451
- }, q = (i) => {
452
- const s = i;
453
- s.isMainFrame === !1 || !s.errorCode || s.errorCode === -3 || (o.value = !0, e.panel.updateTab(e.tab.id, { loading: !1 }));
534
+ }, d = (p) => {
535
+ const E = p;
536
+ E.isMainFrame === !1 || !E.url || E.url === "about:blank" || (N.value = E.url, e.panel.recordNavigation(E.url, void 0, e.tab.id));
537
+ }, R = (p) => {
538
+ const E = p;
539
+ E.title && e.panel.updateTab(e.tab.id, { title: E.title });
540
+ }, F = (p) => {
541
+ const E = p;
542
+ E.isMainFrame === !1 || !E.errorCode || E.errorCode === -3 || (i.value = !0, e.panel.updateTab(e.tab.id, { loading: !1 }));
454
543
  }, U = () => {
455
- if (!b) return;
456
- const i = typeof b.getURL == "function" ? b.getURL() : b.getAttribute("src") || "";
457
- if (i && (C.value = i), e.panel.updateTab(e.tab.id, { loading: !1 }), S) {
458
- const s = S;
459
- S = "", W(s);
544
+ if (!T) return;
545
+ const p = typeof T.getURL == "function" ? T.getURL() : T.getAttribute("src") || "";
546
+ if (p && (N.value = p), e.panel.updateTab(e.tab.id, { loading: !1 }), O) {
547
+ const E = O;
548
+ O = "", V(E);
460
549
  }
461
- }, K = () => {
462
- if (!n || !M.value) return;
463
- const i = Et(e.tab.url ?? "");
464
- b = i, i.addEventListener("did-start-loading", H), i.addEventListener("did-stop-loading", X), i.addEventListener("did-navigate", N), i.addEventListener("did-navigate-in-page", N), i.addEventListener("page-title-updated", O), i.addEventListener("did-fail-load", q), i.addEventListener("dom-ready", U), M.value.replaceChildren(i);
550
+ }, Y = () => {
551
+ if (!n || !w.value) return;
552
+ const p = Pt(e.tab.url ?? "");
553
+ T = p, p.addEventListener("did-start-loading", g), p.addEventListener("did-stop-loading", u), p.addEventListener("did-navigate", d), p.addEventListener("did-navigate-in-page", d), p.addEventListener("page-title-updated", R), p.addEventListener("did-fail-load", F), p.addEventListener("dom-ready", U), w.value.replaceChildren(p);
465
554
  };
466
- return V(
555
+ return q(
467
556
  () => e.tab.url,
468
- (i) => {
469
- !i || !n || W(i);
557
+ (p) => {
558
+ !p || !n || V(p);
470
559
  }
471
- ), fe(() => {
472
- n ? K() : m();
473
- }), me(() => {
474
- w(), b && (b.remove(), b = null);
475
- }), (i, s) => (h(), v("div", Rt, [
476
- $(ke, {
560
+ ), Te(() => {
561
+ n ? Y() : k();
562
+ }), ke(() => {
563
+ M(), T && (T.remove(), T = null);
564
+ }), (p, E) => (h(), f("div", St, [
565
+ z(Ee, {
477
566
  tab: t.tab,
478
567
  panel: t.panel
479
568
  }, null, 8, ["tab", "panel"]),
480
- n ? P("", !0) : (h(), v("div", zt, [
481
- $(I, {
569
+ n ? D("", !0) : (h(), f("div", At, [
570
+ z(S, {
482
571
  name: "alert",
483
572
  size: 12
484
573
  }),
485
- s[0] || (s[0] = u("span", null, "部分网站禁止被内嵌;若页面空白或显示禁止图标,请点右上角在新窗口打开。", -1))
574
+ E[0] || (E[0] = b("span", null, "部分网站禁止被内嵌;若页面空白或显示禁止图标,请点右上角在新窗口打开。", -1))
486
575
  ])),
487
- u("div", Pt, [
488
- n ? (h(), v("div", {
576
+ b("div", Wt, [
577
+ n ? (h(), f("div", {
489
578
  key: 0,
490
579
  ref_key: "webviewHostRef",
491
- ref: M,
580
+ ref: w,
492
581
  class: "wi-right-panel__webview-host"
493
- }, null, 512)) : t.tab.url ? (h(), v("iframe", {
494
- key: d.value,
582
+ }, null, 512)) : t.tab.url ? (h(), f("iframe", {
583
+ key: s.value,
495
584
  class: "wi-right-panel__iframe",
496
585
  src: t.tab.url,
497
586
  title: t.tab.title,
498
587
  referrerpolicy: "no-referrer",
499
- onLoad: z
500
- }, null, 40, Lt)) : P("", !0),
501
- o.value ? (h(), v("div", Ct, [
502
- $(I, {
588
+ onLoad: A
589
+ }, null, 40, Dt)) : D("", !0),
590
+ i.value ? (h(), f("div", Nt, [
591
+ z(S, {
503
592
  name: "alert",
504
593
  size: 30
505
594
  }),
506
- u("p", St, R(n ? "页面加载失败" : "该页面可能不允许被嵌入"), 1),
507
- u("p", At, R(n ? "请检查网络或地址是否正确,也可以在新窗口打开。" : "部分网站会通过 X-Frame-Options / CSP 禁止在 iframe 中打开,可在新窗口访问。"), 1),
508
- u("div", { class: "wi-right-panel__blocked-actions" }, [
509
- u("button", {
595
+ b("p", Ot, W(n ? "页面加载失败" : "该页面可能不允许被嵌入"), 1),
596
+ b("p", Ut, W(n ? "请检查网络或地址是否正确,也可以在新窗口打开。" : "部分网站会通过 X-Frame-Options / CSP 禁止在 iframe 中打开,可在新窗口访问。"), 1),
597
+ b("div", { class: "wi-right-panel__blocked-actions" }, [
598
+ b("button", {
510
599
  type: "button",
511
600
  class: "wi-right-panel__ghost-button",
512
- onClick: l
601
+ onClick: o
513
602
  }, "重试"),
514
- u("button", {
603
+ b("button", {
515
604
  type: "button",
516
605
  class: "wi-right-panel__primary-button",
517
- onClick: g
606
+ onClick: m
518
607
  }, "在新窗口打开")
519
608
  ])
520
- ])) : P("", !0)
609
+ ])) : D("", !0)
521
610
  ])
522
611
  ]));
523
612
  }
524
- }), Nt = /* @__PURE__ */ F(Wt, [["__scopeId", "data-v-4ee42504"]]), Ot = {
613
+ }), Vt = /* @__PURE__ */ j(Bt, [["__scopeId", "data-v-4ee42504"]]), Ft = {
525
614
  type: "web",
526
615
  defaultTitle: "网页",
527
616
  icon: "globe",
528
- component: Nt
529
- }, Me = [Mt, Ot], $e = (t = []) => {
530
- const e = Se(/* @__PURE__ */ new Map());
617
+ component: Vt
618
+ }, Ie = [Rt, Ft], $e = (t = []) => {
619
+ const e = Ue(/* @__PURE__ */ new Map());
531
620
  return t.forEach((n) => e.set(n.type, n)), {
532
621
  register(n) {
533
622
  return e.set(n.type, n), () => {
@@ -541,21 +630,21 @@ const pe = {
541
630
  return Array.from(e.values());
542
631
  }
543
632
  };
544
- }, re = $e(Me), sn = (t, e = re) => e.register(t), rn = (t, e = re) => e.get(t), xe = "https://www.bing.com/search?q={q}", Ut = Math.random().toString(36).slice(2, 8), Dt = {
633
+ }, he = $e(Ie), pn = (t, e = he) => e.register(t), hn = (t, e = he) => e.get(t), Re = "https://www.bing.com/search?q={q}", Gt = Math.random().toString(36).slice(2, 8), Ht = {
545
634
  initialWidth: 480,
546
635
  minWidth: 360,
547
636
  maxWidth: 900,
548
637
  maxTabs: 10,
549
- searchUrlTemplate: xe,
638
+ searchUrlTemplate: Re,
550
639
  defaultTabType: "newtab",
551
640
  newTabTitle: "新建标签页"
552
- }, Z = (t) => {
641
+ }, ne = (t) => {
553
642
  try {
554
643
  return new URL(t).host || t;
555
644
  } catch {
556
645
  return t;
557
646
  }
558
- }, ae = (t, e = xe) => {
647
+ }, se = (t, e = Re) => {
559
648
  const n = (t ?? "").trim();
560
649
  if (!n || /^(javascript|data|vbscript|file|about):/i.test(n)) return "";
561
650
  if (/^https?:\/\//i.test(n)) return n;
@@ -566,146 +655,153 @@ const pe = {
566
655
  if (/^([\w-]+\.)+[a-z]{2,}(:\d+)?(\/.*)?$/i.test(n)) return `https://${n}`;
567
656
  }
568
657
  return e.replace("{q}", encodeURIComponent(n));
569
- }, Bt = (t = {}) => {
570
- const e = we({
571
- ...Dt,
658
+ }, Kt = (t = {}) => {
659
+ const e = ce({
660
+ ...Ht,
572
661
  ...Object.fromEntries(Object.entries(t).filter(([a, r]) => a !== "registry" && r !== void 0))
573
- }), n = t.registry ?? $e(Me), d = E(!1), o = E([]), l = E(""), g = E(!1), T = E(!1);
574
- let f = 0;
575
- const w = () => `right-panel-${++f}-${Ut}`, m = () => typeof window > "u" ? e.maxWidth : Math.min(e.maxWidth, Math.max(e.minWidth, window.innerWidth * 0.7)), z = (a) => {
576
- const r = m();
662
+ }), n = t.registry ?? $e(Ie), s = P(!1), i = P([]), o = P(""), m = P(!1), v = P(!1);
663
+ let x = 0;
664
+ const M = () => `right-panel-${++x}-${Gt}`, k = () => typeof window > "u" ? e.maxWidth : Math.min(e.maxWidth, Math.max(e.minWidth, window.innerWidth * 0.7)), A = (a) => {
665
+ const r = k();
577
666
  return Math.round(Math.min(Math.max(a, e.minWidth), r));
578
- }, M = E(z(t.initialWidth ?? e.initialWidth)), b = y(() => o.value.find((a) => a.id === l.value) ?? null), C = y(() => {
667
+ }, w = P(A(t.initialWidth ?? e.initialWidth)), T = $(() => i.value.find((a) => a.id === o.value) ?? null), N = $(() => {
579
668
  var a;
580
- return (((a = b.value) == null ? void 0 : a.historyIndex) ?? -1) > 0;
581
- }), S = y(() => {
582
- const a = b.value;
669
+ return (((a = T.value) == null ? void 0 : a.historyIndex) ?? -1) > 0;
670
+ }), O = $(() => {
671
+ const a = T.value;
583
672
  return !!a && a.historyIndex >= 0 && a.historyIndex < a.history.length - 1;
584
- }), W = () => {
585
- d.value = !0;
586
- }, H = () => {
587
- d.value = !1, g.value = !1;
588
- }, X = () => {
589
- d.value = !d.value, d.value || (g.value = !1);
590
- }, N = (a) => {
591
- g.value = a, a && (d.value = !0);
592
- }, O = () => N(!g.value), q = (a) => {
593
- M.value = z(a);
673
+ }), V = () => {
674
+ s.value = !0;
675
+ }, g = () => {
676
+ s.value = !1, m.value = !1;
677
+ }, u = () => {
678
+ s.value = !s.value, s.value || (m.value = !1);
679
+ }, d = (a) => {
680
+ m.value = a, a && (s.value = !0);
681
+ }, R = () => d(!m.value), F = (a) => {
682
+ w.value = A(a);
594
683
  }, U = (a) => {
595
- var ue;
596
- const r = typeof a == "string" ? { type: a } : a ?? {}, _ = r.type ?? e.defaultTabType, c = n.get(_);
597
- if (c != null && c.singleton) {
598
- const ne = o.value.find((Pe) => Pe.type === _);
599
- if (ne)
600
- return l.value = ne.id, d.value = !0, ne;
684
+ var ge;
685
+ const r = typeof a == "string" ? { type: a } : a ?? {}, y = r.type ?? e.defaultTabType, l = n.get(y);
686
+ if (l != null && l.singleton) {
687
+ const oe = i.value.find((Ae) => Ae.type === y);
688
+ if (oe)
689
+ return o.value = oe.id, s.value = !0, oe;
601
690
  }
602
- if (o.value.length >= e.maxTabs) return null;
603
- const p = ((ue = c == null ? void 0 : c.createTab) == null ? void 0 : ue.call(c, r)) ?? {}, x = r.url ?? p.url ?? "", Y = w(), te = {
604
- ...p,
605
- id: Y,
606
- type: _,
607
- title: r.title ?? p.title ?? (c == null ? void 0 : c.defaultTitle) ?? _,
608
- icon: r.icon ?? p.icon ?? (c == null ? void 0 : c.icon) ?? (_ === "newtab" ? "newtab" : "globe"),
609
- url: x || void 0,
691
+ if (i.value.length >= e.maxTabs) return null;
692
+ const c = ((ge = l == null ? void 0 : l.createTab) == null ? void 0 : ge.call(l, r)) ?? {}, C = r.url ?? c.url ?? "", te = M(), ie = {
693
+ ...c,
694
+ id: te,
695
+ type: y,
696
+ title: r.title ?? c.title ?? (l == null ? void 0 : l.defaultTitle) ?? y,
697
+ icon: r.icon ?? c.icon ?? (l == null ? void 0 : l.icon) ?? (y === "newtab" ? "newtab" : "globe"),
698
+ url: C || void 0,
610
699
  // 调用方传入的 data 优先于面板定义 createTab 的默认 data
611
- data: r.data ?? p.data,
612
- history: x ? [x] : [],
613
- historyIndex: x ? 0 : -1,
700
+ data: r.data ?? c.data,
701
+ history: C ? [C] : [],
702
+ historyIndex: C ? 0 : -1,
614
703
  loading: !1,
615
704
  reloadKey: 0
616
705
  };
617
- return x && !r.title && !p.title && (te.title = Z(x)), o.value.push(te), r.activate !== !1 && (l.value = Y), d.value = !0, te;
618
- }, K = (a, r) => {
619
- const _ = ae(a, e.searchUrlTemplate);
620
- return _ ? U({ type: "web", url: _, title: r }) : null;
621
- }, i = (a) => !!a && (a.type === "web" || a.type === "newtab"), s = (a, r) => {
622
- const _ = ae(a, e.searchUrlTemplate);
623
- if (!_) return;
624
- const c = b.value;
625
- if (!i(c)) {
626
- U({ type: "web", url: _, title: r });
706
+ return C && !r.title && !c.title && (ie.title = ne(C)), i.value.push(ie), r.activate !== !1 && (o.value = te), s.value = !0, ie;
707
+ }, Y = (a, r) => {
708
+ const y = se(a, e.searchUrlTemplate);
709
+ return y ? U({ type: "web", url: y, title: r }) : null;
710
+ }, p = (a) => !!a && (a.type === "web" || a.type === "newtab"), E = (a, r) => {
711
+ const y = se(a, e.searchUrlTemplate);
712
+ if (!y) return;
713
+ const l = T.value;
714
+ if (!p(l)) {
715
+ U({ type: "web", url: y, title: r });
627
716
  return;
628
717
  }
629
- if (c.url === _) {
630
- c.reloadKey = (c.reloadKey ?? 0) + 1, c.loading = !0;
718
+ if (l.url === y) {
719
+ l.reloadKey = (l.reloadKey ?? 0) + 1, l.loading = !0;
631
720
  return;
632
721
  }
633
- const p = c.history.slice(0, c.historyIndex + 1);
634
- p.push(_), c.type = "web", c.icon = "globe", c.url = _, c.title = r ?? Z(_), c.history = p, c.historyIndex = p.length - 1, c.loading = !0;
635
- }, k = (a) => {
636
- s(a);
637
- }, A = (a) => {
638
- const r = o.value.findIndex((c) => c.id === a);
722
+ const c = l.history.slice(0, l.historyIndex + 1);
723
+ c.push(y), l.type = "web", l.icon = "globe", l.url = y, l.title = r ?? ne(y), l.history = c, l.historyIndex = c.length - 1, l.loading = !0;
724
+ }, _ = (a) => {
725
+ E(a);
726
+ }, I = (a) => {
727
+ const r = i.value.findIndex((l) => l.id === a);
639
728
  if (r < 0) return;
640
- if (o.value.splice(r, 1), !o.value.length) {
641
- l.value = "", H();
729
+ if (i.value.splice(r, 1), !i.value.length) {
730
+ o.value = "", g();
642
731
  return;
643
732
  }
644
- if (l.value !== a) return;
645
- const _ = o.value[r] ?? o.value[r - 1] ?? null;
646
- l.value = (_ == null ? void 0 : _.id) ?? "";
647
- }, D = (a) => {
648
- o.value.some((r) => r.id === a) && (l.value = a);
649
- }, ee = (a, r) => {
650
- const _ = o.value.find((c) => c.id === a);
651
- _ && Object.assign(_, r);
652
- }, ze = (a, r, _) => {
653
- const c = ae(a, e.searchUrlTemplate);
654
- if (!c) return;
655
- const p = _ ? o.value.find((Y) => Y.id === _) : b.value;
656
- if (!p || p.type !== "web" && p.type !== "newtab") return;
657
- if (p.url === c) {
658
- r && (p.title = r);
733
+ if (o.value !== a) return;
734
+ const y = i.value[r] ?? i.value[r - 1] ?? null;
735
+ o.value = (y == null ? void 0 : y.id) ?? "";
736
+ }, L = (a, r) => {
737
+ const y = i.value.findIndex((c) => c.id === a);
738
+ if (y < 0) return;
739
+ const l = r === "left" ? i.value.slice(y) : i.value.slice(0, y + 1);
740
+ l.length !== i.value.length && (i.value = l, l.some((c) => c.id === o.value) || (o.value = a));
741
+ }, H = (a) => L(a, "left"), ee = (a) => L(a, "right"), ae = (a) => {
742
+ i.value.some((r) => r.id === a) && (o.value = a);
743
+ }, Pe = (a, r) => {
744
+ const y = i.value.find((l) => l.id === a);
745
+ y && Object.assign(y, r);
746
+ }, Se = (a, r, y) => {
747
+ const l = se(a, e.searchUrlTemplate);
748
+ if (!l) return;
749
+ const c = y ? i.value.find((te) => te.id === y) : T.value;
750
+ if (!c || c.type !== "web" && c.type !== "newtab") return;
751
+ if (c.url === l) {
752
+ r && (c.title = r);
659
753
  return;
660
754
  }
661
- const x = p.history.slice(0, p.historyIndex + 1);
662
- x.push(c), p.type === "newtab" && (p.type = "web", p.icon = "globe"), p.url = c, p.title = r ?? Z(c), p.history = x, p.historyIndex = x.length - 1;
663
- }, de = (a) => {
664
- const r = b.value;
665
- !r || a < 0 || a >= r.history.length || (r.historyIndex = a, r.url = r.history[a], r.title = Z(r.url), r.loading = !0);
755
+ const C = c.history.slice(0, c.historyIndex + 1);
756
+ C.push(l), c.type === "newtab" && (c.type = "web", c.icon = "globe"), c.url = l, c.title = r ?? ne(l), c.history = C, c.historyIndex = C.length - 1;
757
+ }, be = (a) => {
758
+ const r = T.value;
759
+ !r || a < 0 || a >= r.history.length || (r.historyIndex = a, r.url = r.history[a], r.title = ne(r.url), r.loading = !0);
666
760
  };
667
761
  return {
668
- isOpen: d,
669
- width: M,
670
- maximized: g,
671
- tabs: o,
672
- activeTabId: l,
673
- activeTab: b,
674
- canGoBack: C,
675
- canGoForward: S,
676
- isRestoring: T,
762
+ isOpen: s,
763
+ width: w,
764
+ maximized: m,
765
+ tabs: i,
766
+ activeTabId: o,
767
+ activeTab: T,
768
+ canGoBack: N,
769
+ canGoForward: O,
770
+ isRestoring: v,
677
771
  options: e,
678
772
  registry: n,
679
- open: W,
680
- close: H,
681
- toggle: X,
682
- setMaximized: N,
683
- toggleMaximized: O,
684
- setWidth: q,
773
+ open: V,
774
+ close: g,
775
+ toggle: u,
776
+ setMaximized: d,
777
+ toggleMaximized: R,
778
+ setWidth: F,
685
779
  addTab: U,
686
- openInNewTab: K,
687
- openInActiveTab: k,
688
- closeTab: A,
689
- activateTab: D,
690
- updateTab: ee,
691
- navigate: s,
692
- recordNavigation: ze,
780
+ openInNewTab: Y,
781
+ openInActiveTab: _,
782
+ closeTab: I,
783
+ closeTabsToLeft: H,
784
+ closeTabsToRight: ee,
785
+ activateTab: ae,
786
+ updateTab: Pe,
787
+ navigate: E,
788
+ recordNavigation: Se,
693
789
  goBack: () => {
694
- const a = b.value;
695
- a && de(a.historyIndex - 1);
790
+ const a = T.value;
791
+ a && be(a.historyIndex - 1);
696
792
  },
697
793
  goForward: () => {
698
- const a = b.value;
699
- a && de(a.historyIndex + 1);
794
+ const a = T.value;
795
+ a && be(a.historyIndex + 1);
700
796
  },
701
797
  reload: () => {
702
- const a = b.value;
798
+ const a = T.value;
703
799
  a && (a.reloadKey = (a.reloadKey ?? 0) + 1, a.loading = !0);
704
800
  },
705
801
  reset: () => {
706
- o.value = [], l.value = "", d.value = !1, g.value = !1, M.value = z(e.initialWidth);
802
+ i.value = [], o.value = "", s.value = !1, m.value = !1, w.value = A(e.initialWidth);
707
803
  },
708
- snapshot: () => o.value.map((a) => ({
804
+ snapshot: () => i.value.map((a) => ({
709
805
  id: a.id,
710
806
  type: a.type,
711
807
  title: a.title,
@@ -716,44 +812,44 @@ const pe = {
716
812
  data: a.data ? { ...a.data } : void 0
717
813
  })),
718
814
  restore: (a, r) => {
719
- var c;
720
- T.value = !0, o.value = (a ?? []).map((p) => {
721
- var x;
815
+ var l;
816
+ v.value = !0, i.value = (a ?? []).map((c) => {
817
+ var C;
722
818
  return {
723
- ...p,
724
- history: [...p.history ?? []],
725
- historyIndex: Math.min(Math.max(p.historyIndex ?? -1, -1), (((x = p.history) == null ? void 0 : x.length) ?? 0) - 1),
726
- data: p.data ? { ...p.data } : void 0,
819
+ ...c,
820
+ history: [...c.history ?? []],
821
+ historyIndex: Math.min(Math.max(c.historyIndex ?? -1, -1), (((C = c.history) == null ? void 0 : C.length) ?? 0) - 1),
822
+ data: c.data ? { ...c.data } : void 0,
727
823
  loading: !1,
728
824
  reloadKey: 0
729
825
  };
730
- }), o.value.forEach((p) => {
731
- const x = /^right-panel-(\d+)(?:-|$)/.exec(p.id);
732
- x && (f = Math.max(f, Number(x[1])));
826
+ }), i.value.forEach((c) => {
827
+ const C = /^right-panel-(\d+)(?:-|$)/.exec(c.id);
828
+ C && (x = Math.max(x, Number(C[1])));
733
829
  });
734
- const _ = r && o.value.some((p) => p.id === r) ? r : ((c = o.value[0]) == null ? void 0 : c.id) ?? "";
735
- l.value = _, Ae(() => {
736
- T.value = !1;
830
+ const y = r && i.value.some((c) => c.id === r) ? r : ((l = i.value[0]) == null ? void 0 : l.id) ?? "";
831
+ o.value = y, _e(() => {
832
+ v.value = !1;
737
833
  });
738
834
  }
739
835
  };
740
836
  };
741
- let ie;
742
- const j = () => (ie || (ie = Bt({ registry: re })), ie), cn = (t) => {
743
- const e = j();
837
+ let le;
838
+ const J = () => (le || (le = Kt({ registry: he })), le), vn = (t) => {
839
+ const e = J();
744
840
  Object.assign(e.options, t), typeof t.initialWidth == "number" && e.setWidth(t.initialWidth);
745
- }, dn = () => {
746
- j().reset();
747
- }, Gt = { class: "wi-right-panel__body" }, Ft = {
841
+ }, bn = () => {
842
+ J().reset();
843
+ }, jt = { class: "wi-right-panel__body" }, Xt = {
748
844
  key: 1,
749
845
  class: "wi-right-panel__unknown"
750
- }, Ht = { class: "wi-right-panel__unknown-title" }, Kt = {
846
+ }, qt = { class: "wi-right-panel__unknown-title" }, Jt = {
751
847
  key: 1,
752
848
  class: "wi-right-panel__lazy"
753
- }, Vt = { class: "wi-right-panel__lazy-title" }, jt = {
849
+ }, Yt = { class: "wi-right-panel__lazy-title" }, Qt = {
754
850
  key: 0,
755
851
  class: "wi-right-panel__empty"
756
- }, Xt = { class: "wi-right-panel__empty-icon" }, qt = { class: "wi-right-panel__empty-desc" }, Jt = /* @__PURE__ */ G({
852
+ }, Zt = { class: "wi-right-panel__empty-icon" }, en = { class: "wi-right-panel__empty-desc" }, tn = /* @__PURE__ */ K({
757
853
  __name: "RightPanel",
758
854
  props: {
759
855
  panel: {},
@@ -761,106 +857,108 @@ const j = () => (ie || (ie = Bt({ registry: re })), ie), cn = (t) => {
761
857
  },
762
858
  emits: ["tool-click"],
763
859
  setup(t, { expose: e, emit: n }) {
764
- const d = t, o = n, l = y(() => d.panel ?? j()), g = Te() ? "在这里打开网页或终端,与对话并行使用。" : "在这里打开网页,与对话并行使用。", T = y(() => l.value.isOpen.value), f = y(() => l.value.width.value), w = y(() => l.value.maximized.value), m = y(() => l.value.tabs.value), z = y(() => l.value.activeTabId.value), M = y(() => m.value.map((i) => ({ tab: i, definition: l.value.registry.get(i.type) }))), b = we(/* @__PURE__ */ new Set());
765
- V(
766
- z,
767
- (i) => {
768
- i && b.add(i);
860
+ const s = t, i = n, o = $(() => s.panel ?? J()), m = Me() ? "在这里打开网页或终端,与对话并行使用。" : "在这里打开网页,与对话并行使用。", v = $(() => o.value.isOpen.value), x = $(() => o.value.width.value), M = $(() => o.value.maximized.value), k = $(() => o.value.tabs.value), A = $(() => o.value.activeTabId.value), w = $(() => k.value.map((_) => ({ tab: _, definition: o.value.registry.get(_.type) }))), T = ce(/* @__PURE__ */ new Set());
861
+ q(
862
+ A,
863
+ (_) => {
864
+ _ && T.add(_);
769
865
  },
770
866
  { immediate: !0 }
771
- ), V(
772
- () => m.value.map((i) => i.id).join("|"),
867
+ ), q(
868
+ () => k.value.map((_) => _.id).join("|"),
773
869
  () => {
774
- const i = new Set(m.value.map((s) => s.id));
775
- Array.from(b).forEach((s) => {
776
- i.has(s) || b.delete(s);
870
+ const _ = new Set(k.value.map((I) => I.id));
871
+ Array.from(T).forEach((I) => {
872
+ _.has(I) || T.delete(I);
777
873
  });
778
874
  }
779
875
  );
780
- const C = (i) => l.value.activateTab(i), S = (i) => l.value.closeTab(i), W = () => l.value.addTab(), H = () => l.value.close(), X = () => l.value.toggleMaximized(), N = (i) => o("tool-click", i), O = E(!1), q = (i) => {
876
+ const N = (_) => o.value.activateTab(_), O = (_) => o.value.closeTab(_), V = (_) => o.value.closeTabsToLeft(_), g = (_) => o.value.closeTabsToRight(_), u = () => o.value.addTab(), d = () => o.value.close(), R = () => o.value.toggleMaximized(), F = (_) => i("tool-click", _), U = P(!1), Y = (_) => {
781
877
  if (typeof window > "u") return;
782
- O.value = !0;
783
- const s = i.clientX, k = f.value, A = (ee) => {
784
- l.value.setWidth(k + (s - ee.clientX));
785
- }, D = () => {
786
- O.value = !1, window.removeEventListener("pointermove", A), window.removeEventListener("pointerup", D);
878
+ U.value = !0;
879
+ const I = _.clientX, L = x.value, H = (ae) => {
880
+ o.value.setWidth(L + (I - ae.clientX));
881
+ }, ee = () => {
882
+ U.value = !1, window.removeEventListener("pointermove", H), window.removeEventListener("pointerup", ee);
787
883
  };
788
- window.addEventListener("pointermove", A), window.addEventListener("pointerup", D);
789
- }, U = () => l.value.setWidth(l.value.options.initialWidth), K = (i) => {
790
- if (!d.enableShortcut || !(i.ctrlKey || i.metaKey) || !i.shiftKey || i.key.toLowerCase() !== "b") return;
791
- const s = i.target, k = s == null ? void 0 : s.tagName;
792
- k === "INPUT" || k === "TEXTAREA" || s != null && s.isContentEditable || (i.preventDefault(), l.value.addTab());
884
+ window.addEventListener("pointermove", H), window.addEventListener("pointerup", ee);
885
+ }, p = () => o.value.setWidth(o.value.options.initialWidth), E = (_) => {
886
+ if (!s.enableShortcut || !(_.ctrlKey || _.metaKey) || !_.shiftKey || _.key.toLowerCase() !== "b") return;
887
+ const I = _.target, L = I == null ? void 0 : I.tagName;
888
+ L === "INPUT" || L === "TEXTAREA" || I != null && I.isContentEditable || (_.preventDefault(), o.value.addTab());
793
889
  };
794
- return fe(() => window.addEventListener("keydown", K)), me(() => window.removeEventListener("keydown", K)), e({ panel: l }), (i, s) => T.value ? (h(), v("aside", {
890
+ return Te(() => window.addEventListener("keydown", E)), ke(() => window.removeEventListener("keydown", E)), e({ panel: o }), (_, I) => v.value ? (h(), f("aside", {
795
891
  key: 0,
796
- class: le(["wi-right-panel", { "is-resizing": O.value, "is-maximized": w.value }]),
797
- style: ge(w.value ? void 0 : { width: `${f.value}px` })
892
+ class: ue(["wi-right-panel", { "is-resizing": U.value, "is-maximized": M.value }]),
893
+ style: pe(M.value ? void 0 : { width: `${x.value}px` })
798
894
  }, [
799
- w.value ? P("", !0) : (h(), v("span", {
895
+ M.value ? D("", !0) : (h(), f("span", {
800
896
  key: 0,
801
897
  class: "wi-right-panel__resizer",
802
898
  title: "拖拽调整宽度,双击恢复默认",
803
- onPointerdown: se(q, ["stop", "prevent"]),
804
- onDblclick: U
899
+ onPointerdown: Q(Y, ["stop", "prevent"]),
900
+ onDblclick: p
805
901
  }, null, 32)),
806
- $(qe, {
807
- tabs: m.value,
808
- "active-id": z.value,
809
- maximized: w.value,
810
- onSelect: C,
811
- onClose: S,
812
- onAdd: W,
813
- onCollapse: H,
814
- onToggleMaximize: X
902
+ z(et, {
903
+ tabs: k.value,
904
+ "active-id": A.value,
905
+ maximized: M.value,
906
+ onSelect: N,
907
+ onClose: O,
908
+ onCloseLeft: V,
909
+ onCloseRight: g,
910
+ onAdd: u,
911
+ onCollapse: d,
912
+ onToggleMaximize: R
815
913
  }, null, 8, ["tabs", "active-id", "maximized"]),
816
- u("div", Gt, [
817
- (h(!0), v(B, null, Q(M.value, (k) => {
818
- var A;
819
- return ve((h(), v("div", {
820
- key: k.tab.id,
914
+ b("div", jt, [
915
+ (h(!0), f(G, null, X(w.value, (L) => {
916
+ var H;
917
+ return we((h(), f("div", {
918
+ key: L.tab.id,
821
919
  class: "wi-right-panel__view"
822
920
  }, [
823
- b.has(k.tab.id) ? (h(), v(B, { key: 0 }, [
824
- k.definition ? (h(), be(We((A = k.definition) == null ? void 0 : A.component), {
825
- key: `${k.tab.id}-${k.tab.reloadKey ?? 0}`,
826
- tab: k.tab,
827
- panel: l.value,
828
- onToolClick: N
829
- }, null, 40, ["tab", "panel"])) : (h(), v("div", Ft, [
830
- u("p", Ht, "未注册的面板类型:" + R(k.tab.type), 1),
831
- s[0] || (s[0] = u("p", { class: "wi-right-panel__unknown-desc" }, "请先通过 registerRightPanel 注册该类型的面板组件。", -1))
921
+ T.has(L.tab.id) ? (h(), f(G, { key: 0 }, [
922
+ L.definition ? (h(), de(Be((H = L.definition) == null ? void 0 : H.component), {
923
+ key: `${L.tab.id}-${L.tab.reloadKey ?? 0}`,
924
+ tab: L.tab,
925
+ panel: o.value,
926
+ onToolClick: F
927
+ }, null, 40, ["tab", "panel"])) : (h(), f("div", Xt, [
928
+ b("p", qt, "未注册的面板类型:" + W(L.tab.type), 1),
929
+ I[0] || (I[0] = b("p", { class: "wi-right-panel__unknown-desc" }, "请先通过 registerRightPanel 注册该类型的面板组件。", -1))
832
930
  ]))
833
- ], 64)) : (h(), v("div", Kt, [
834
- u("p", Vt, R(k.tab.title), 1),
835
- s[1] || (s[1] = u("p", { class: "wi-right-panel__lazy-desc" }, "点击标签页加载内容", -1))
931
+ ], 64)) : (h(), f("div", Jt, [
932
+ b("p", Yt, W(L.tab.title), 1),
933
+ I[1] || (I[1] = b("p", { class: "wi-right-panel__lazy-desc" }, "点击标签页加载内容", -1))
836
934
  ]))
837
935
  ])), [
838
- [Ne, k.tab.id === z.value]
936
+ [Ve, L.tab.id === A.value]
839
937
  ]);
840
938
  }), 128)),
841
- m.value.length ? P("", !0) : (h(), v("div", jt, [
842
- u("span", Xt, [
843
- $(I, {
939
+ k.value.length ? D("", !0) : (h(), f("div", Qt, [
940
+ b("span", Zt, [
941
+ z(S, {
844
942
  name: "newtab",
845
943
  size: 30
846
944
  })
847
945
  ]),
848
- s[2] || (s[2] = u("p", { class: "wi-right-panel__empty-title" }, "还没有打开任何标签页", -1)),
849
- u("p", qt, R(_e(g)), 1),
850
- u("button", {
946
+ I[2] || (I[2] = b("p", { class: "wi-right-panel__empty-title" }, "还没有打开任何标签页", -1)),
947
+ b("p", en, W(ye(m)), 1),
948
+ b("button", {
851
949
  type: "button",
852
950
  class: "wi-right-panel__empty-button",
853
- onClick: W
951
+ onClick: u
854
952
  }, "新建标签页")
855
953
  ]))
856
954
  ])
857
- ], 6)) : P("", !0);
955
+ ], 6)) : D("", !0);
858
956
  }
859
- }), un = /* @__PURE__ */ F(Jt, [["__scopeId", "data-v-752ff3da"]]), oe = "wi-chat:right-panel-scope:", Qt = () => ({
957
+ }), gn = /* @__PURE__ */ j(tn, [["__scopeId", "data-v-161bae49"]]), re = "wi-chat:right-panel-scope:", nn = () => ({
860
958
  load(t) {
861
959
  if (typeof localStorage > "u") return null;
862
960
  try {
863
- const e = localStorage.getItem(oe + t);
961
+ const e = localStorage.getItem(re + t);
864
962
  if (!e) return null;
865
963
  const n = JSON.parse(e);
866
964
  return Array.isArray(n == null ? void 0 : n.tabs) ? n : null;
@@ -871,68 +969,68 @@ const j = () => (ie || (ie = Bt({ registry: re })), ie), cn = (t) => {
871
969
  save(t, e) {
872
970
  if (!(typeof localStorage > "u"))
873
971
  try {
874
- localStorage.setItem(oe + t, JSON.stringify(e));
972
+ localStorage.setItem(re + t, JSON.stringify(e));
875
973
  } catch {
876
974
  }
877
975
  },
878
976
  clear(t) {
879
977
  if (!(typeof localStorage > "u"))
880
978
  try {
881
- localStorage.removeItem(oe + t);
979
+ localStorage.removeItem(re + t);
882
980
  } catch {
883
981
  }
884
982
  }
885
- }), J = E("");
886
- let L = Qt(), ce = !0, he = !1;
887
- const Ie = /* @__PURE__ */ new Set(), pn = (t = {}) => {
888
- "storage" in t && (L = t.storage ?? null), typeof t.persist == "boolean" && (ce = t.persist);
889
- }, hn = () => J.value, Ee = (t) => {
890
- const e = J.value;
891
- if (!ce || !L || !e) return;
983
+ }), Z = P("");
984
+ let B = nn(), ve = !0, me = !1;
985
+ const Le = /* @__PURE__ */ new Set(), fn = (t = {}) => {
986
+ "storage" in t && (B = t.storage ?? null), typeof t.persist == "boolean" && (ve = t.persist);
987
+ }, mn = () => Z.value, ze = (t) => {
988
+ const e = Z.value;
989
+ if (!ve || !B || !e) return;
892
990
  const n = t.snapshot();
893
- !n.length && !Ie.has(e) || L.save(e, {
991
+ !n.length && !Le.has(e) || B.save(e, {
894
992
  scopeId: e,
895
993
  tabs: n,
896
994
  activeTabId: t.activeTabId.value,
897
995
  savedAt: Date.now()
898
996
  });
899
- }, Yt = (t) => {
900
- he || (he = !0, V([t.tabs, t.activeTabId], () => Ee(t), { deep: !0, flush: "post" }));
901
- }, vn = (t, e = j()) => {
902
- Yt(e);
997
+ }, an = (t) => {
998
+ me || (me = !0, q([t.tabs, t.activeTabId], () => ze(t), { deep: !0, flush: "post" }));
999
+ }, _n = (t, e = J()) => {
1000
+ an(e);
903
1001
  const n = String(t ?? "").trim();
904
- if (n === J.value) return;
905
- if (Ee(e), J.value = n, !n) {
1002
+ if (n === Z.value) return;
1003
+ if (ze(e), Z.value = n, !n) {
906
1004
  e.restore([]);
907
1005
  return;
908
1006
  }
909
- const d = ce && L ? L.load(n) : null;
910
- Ie.add(n), e.restore((d == null ? void 0 : d.tabs) ?? [], d == null ? void 0 : d.activeTabId);
911
- }, gn = (t = J.value) => {
912
- !t || !(L != null && L.clear) || L.clear(t);
913
- }, Re = (t, e) => ({
1007
+ const s = ve && B ? B.load(n) : null;
1008
+ Le.add(n), e.restore((s == null ? void 0 : s.tabs) ?? [], s == null ? void 0 : s.activeTabId);
1009
+ }, wn = (t = Z.value) => {
1010
+ !t || !(B != null && B.clear) || B.clear(t);
1011
+ }, Ce = (t, e) => ({
914
1012
  id: t.id,
915
1013
  type: t.type,
916
1014
  title: t.title,
917
1015
  icon: t.icon,
918
1016
  url: t.url,
919
1017
  active: t.id === e
920
- }), _n = (t = {}) => {
921
- const e = t.panel ?? j(), n = y(() => {
922
- const T = e.activeTabId.value;
923
- return e.tabs.value.map((f) => Re(f, T));
924
- }), d = y(() => n.value.length > 0), o = y(() => n.value.length), l = y(() => e.activeTabId.value), g = y(() => e.isOpen.value);
1018
+ }), yn = (t = {}) => {
1019
+ const e = t.panel ?? J(), n = $(() => {
1020
+ const v = e.activeTabId.value;
1021
+ return e.tabs.value.map((x) => Ce(x, v));
1022
+ }), s = $(() => n.value.length > 0), i = $(() => n.value.length), o = $(() => e.activeTabId.value), m = $(() => e.isOpen.value);
925
1023
  return {
926
1024
  tabs: n,
927
- hasTabs: d,
928
- tabCount: o,
929
- activeTabId: l,
930
- isOpen: g,
931
- activateTab(T) {
932
- e.activateTab(T), e.open();
1025
+ hasTabs: s,
1026
+ tabCount: i,
1027
+ activeTabId: o,
1028
+ isOpen: m,
1029
+ activateTab(v) {
1030
+ e.activateTab(v), e.open();
933
1031
  },
934
- addTab(T) {
935
- e.addTab(T);
1032
+ addTab(v) {
1033
+ e.addTab(v);
936
1034
  },
937
1035
  open() {
938
1036
  e.open();
@@ -941,45 +1039,46 @@ const Ie = /* @__PURE__ */ new Set(), pn = (t = {}) => {
941
1039
  e.toggle();
942
1040
  }
943
1041
  };
944
- }, bn = (t = j()) => {
1042
+ }, Tn = (t = J()) => {
945
1043
  const e = t.activeTabId.value;
946
- return t.tabs.value.map((n) => Re(n, e));
1044
+ return t.tabs.value.map((n) => Ce(n, e));
947
1045
  };
948
1046
  export {
949
- Me as BUILTIN_RIGHT_PANELS,
950
- ke as BrowserToolbar,
951
- ut as DEFAULT_NEW_TAB_RECOMMENDATIONS,
952
- dt as DEFAULT_NEW_TAB_TOOLS,
953
- xe as DEFAULT_SEARCH_URL_TEMPLATE,
954
- pe as RIGHT_PANEL_ICONS,
955
- oe as RIGHT_PANEL_SCOPE_STORAGE_PREFIX,
956
- un as RightPanel,
957
- I as RightPanelIcon,
958
- qe as RightPanelTabs,
959
- ct as RightPanelToolList,
960
- $t as WEBVIEW_PARTITION,
961
- xt as canUseWebview,
962
- gn as clearRightPanelScope,
963
- cn as configureRightPanel,
964
- pn as configureRightPanelScope,
965
- Qt as createLocalStorageRightPanelScopeStorage,
966
- Bt as createRightPanel,
1047
+ Ie as BUILTIN_RIGHT_PANELS,
1048
+ Ee as BrowserToolbar,
1049
+ gt as DEFAULT_NEW_TAB_RECOMMENDATIONS,
1050
+ bt as DEFAULT_NEW_TAB_TOOLS,
1051
+ Re as DEFAULT_SEARCH_URL_TEMPLATE,
1052
+ fe as RIGHT_PANEL_ICONS,
1053
+ re as RIGHT_PANEL_SCOPE_STORAGE_PREFIX,
1054
+ gn as RightPanel,
1055
+ S as RightPanelIcon,
1056
+ et as RightPanelTabs,
1057
+ vt as RightPanelToolList,
1058
+ Lt as WEBVIEW_PARTITION,
1059
+ zt as canUseWebview,
1060
+ wn as clearRightPanelScope,
1061
+ vn as configureRightPanel,
1062
+ fn as configureRightPanelScope,
1063
+ nn as createLocalStorageRightPanelScopeStorage,
1064
+ Kt as createRightPanel,
967
1065
  $e as createRightPanelRegistry,
968
- re as defaultRightPanelRegistry,
969
- rn as getRightPanelDefinition,
970
- hn as getRightPanelScope,
971
- Te as isDesktopRuntime,
972
- bn as listRightPanelTabs,
973
- Mt as newTabPanelDefinition,
974
- ye as readElectronBridge,
975
- sn as registerRightPanel,
976
- dn as resetRightPanel,
977
- Z as resolveRightPanelTitle,
978
- ae as resolveRightPanelUrl,
979
- It as resolveWebRuntime,
980
- vn as setRightPanelScope,
981
- j as useRightPanel,
982
- _n as useRightPanelTabs,
983
- Ot as webPanelDefinition
1066
+ Pt as createWebviewElement,
1067
+ he as defaultRightPanelRegistry,
1068
+ hn as getRightPanelDefinition,
1069
+ mn as getRightPanelScope,
1070
+ Me as isDesktopRuntime,
1071
+ Tn as listRightPanelTabs,
1072
+ Rt as newTabPanelDefinition,
1073
+ xe as readElectronBridge,
1074
+ pn as registerRightPanel,
1075
+ bn as resetRightPanel,
1076
+ ne as resolveRightPanelTitle,
1077
+ se as resolveRightPanelUrl,
1078
+ Ct as resolveWebRuntime,
1079
+ _n as setRightPanelScope,
1080
+ J as useRightPanel,
1081
+ yn as useRightPanelTabs,
1082
+ Ft as webPanelDefinition
984
1083
  };
985
1084
  //# sourceMappingURL=index.js.map