wi-chat 0.6.1 → 0.7.0

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