@freecallai/pro 0.0.10 → 0.0.12

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js} +1470 -1455
  3. package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-FGgCcubh.js} +1 -1
  4. package/dist/{KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js → KnowledgeArea.vue_vue_type_script_setup_true_lang-JH_F4CFe.js} +523 -519
  5. package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-CHmdyhjh.js} +1 -1
  6. package/dist/agent-prompt-editor/index.js +304 -293
  7. package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
  8. package/dist/{choice-BqjECVyx.js → choice-CUCsR2dN.js} +1 -1
  9. package/dist/edition-info/index.js +1 -1
  10. package/dist/{guard-BmLOamCj.js → guard-DgExtfXo.js} +199 -185
  11. package/dist/{index-7x1OTv0m.js → index-B2CCZeff.js} +4 -4
  12. package/dist/{index-BDinNJn_.js → index-BwZXmefJ.js} +1 -1
  13. package/dist/{index-6VSUucFX.js → index-C54ce9Tn.js} +1 -1
  14. package/dist/index-CMl5mgFR.js +5 -0
  15. package/dist/index-CbmRr3rH.js +949 -0
  16. package/dist/index-Cs38tTe4.js +5 -0
  17. package/dist/{index-CCwmXuSJ.js → index-DIMONp3g.js} +1 -1
  18. package/dist/{index-CN2knQcE.js → index-DaGfiqBX.js} +1 -1
  19. package/dist/{index-gS1h8iW8.js → index-DqJvaPTD.js} +1 -1
  20. package/dist/{index-0BXLYaKG.js → index-dnsGFj0F.js} +2 -2
  21. package/dist/{index-B1rTu0jX.js → index-pdr6mUf0.js} +1 -1
  22. package/dist/index.js +7 -7
  23. package/dist/{inline-CRGzAti7.js → inline-BpwAryXp.js} +1 -1
  24. package/dist/{knowledge-DNDouB-s.js → knowledge-DIzYk2iM.js} +1 -1
  25. package/dist/media-extensions-YYbGuUQa.js +341 -0
  26. package/dist/{media-migration-D1KoHKoP.js → media-migration-Bnfn27i9.js} +1 -1
  27. package/dist/media-policy-tG5OHWSj.js +215 -0
  28. package/dist/{media-upload-C5N6YWHu.js → media-upload-_xeZtn3i.js} +1 -1
  29. package/dist/{model-BVh9EZ9G.js → model-DlAjlPai.js} +1 -1
  30. package/dist/navigation/index.js +1 -1
  31. package/dist/rich-text/index.js +6 -6
  32. package/dist/rich-text/legacy-converter/index.js +357 -355
  33. package/dist/style.css +1 -1
  34. package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +4 -0
  35. package/dist/types/navigation/FkpNavigation.vue.d.ts +12 -3
  36. package/dist/types/navigation/NavigationGroup.vue.d.ts +1 -0
  37. package/dist/types/navigation/NavigationNodes.vue.d.ts +9 -2
  38. package/dist/types/navigation/{use-navigation-tree.d.ts → hooks/use-navigation-tree.d.ts} +1 -1
  39. package/dist/types/navigation/hooks/use-submenu-indicator.d.ts +10 -0
  40. package/dist/types/navigation/index.d.ts +1 -1
  41. package/dist/types/navigation/types.d.ts +11 -0
  42. package/dist/types/rich-text/FkpRichText.vue.d.ts +2 -0
  43. package/dist/types/rich-text/model/qianniu-video.d.ts +2 -0
  44. package/dist/types/rich-text/public/types.d.ts +2 -2
  45. package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
  46. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +1 -0
  47. package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +11 -2
  48. package/package.json +4 -4
  49. package/dist/index-CAczgwau.js +0 -5
  50. package/dist/index-Ck8RYpuE.js +0 -816
  51. package/dist/index-faGbB8v6.js +0 -5
  52. package/dist/media-extensions-wlcCEdtg.js +0 -324
  53. package/dist/media-policy-D3-Qglzz.js +0 -158
@@ -0,0 +1,5 @@
1
+ import { c as e } from "./media-upload-_xeZtn3i.js";
2
+ const a = e("video");
3
+ export {
4
+ a as default
5
+ };
@@ -1,5 +1,5 @@
1
1
  import { b as a } from "./operations-D8pn-_iW.js";
2
- import { m as e } from "./inline-CRGzAti7.js";
2
+ import { m as e } from "./inline-BpwAryXp.js";
3
3
  const l = a("variable", "knowledgeInline", e);
4
4
  export {
5
5
  l as default
@@ -1,5 +1,5 @@
1
1
  import { b as i } from "./operations-D8pn-_iW.js";
2
- import { c as t } from "./choice-BqjECVyx.js";
2
+ import { c as t } from "./choice-CUCsR2dN.js";
3
3
  const a = i("attribute", "knowledgeInline", t);
4
4
  export {
5
5
  a as default
@@ -1,4 +1,4 @@
1
- import { l as n, p as l, b as d } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js";
1
+ import { l as n, p as l, b as d } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js";
2
2
  const c = {
3
3
  id: "reasoningTemplate",
4
4
  slot: "sceneAction",
@@ -1,6 +1,6 @@
1
1
  import { b as a } from "./operations-D8pn-_iW.js";
2
- import { m as i } from "./inline-CRGzAti7.js";
3
- import { p as d } from "./guard-BmLOamCj.js";
2
+ import { m as i } from "./inline-BpwAryXp.js";
3
+ import { p as d } from "./guard-DgExtfXo.js";
4
4
  const l = {
5
5
  validateInsert(n, e) {
6
6
  const { option: t } = n;
@@ -1,5 +1,5 @@
1
1
  import { b as i } from "./operations-D8pn-_iW.js";
2
- import { c as e } from "./choice-BqjECVyx.js";
2
+ import { c as e } from "./choice-CUCsR2dN.js";
3
3
  const a = i("ticket", "knowledgeInline", e);
4
4
  export {
5
5
  a as default
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { _ as t } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js";
2
- import { r as g } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js";
1
+ import { _ as t } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js";
2
+ import { r as g } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js";
3
3
  import { _ as i } from "./FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang--MPtqZY_.js";
4
4
  import { a as h } from "./types-PvYB5e85.js";
5
- import { s as u, e as w } from "./guard-BmLOamCj.js";
5
+ import { s as u, e as w } from "./guard-DgExtfXo.js";
6
6
  import { F as a } from "./index-CCATu_gD.js";
7
7
  import { _ as v, a as y, b as E, c as M } from "./index-CCATu_gD.js";
8
- import { N as s } from "./index-Ck8RYpuE.js";
9
- import { _ as P } from "./index-Ck8RYpuE.js";
8
+ import { N as s } from "./index-CbmRr3rH.js";
9
+ import { _ as P } from "./index-CbmRr3rH.js";
10
10
  import { S as n } from "./index-DnmCPdCI.js";
11
11
  import { _ as z } from "./index-DnmCPdCI.js";
12
- import { E as p } from "./index-7x1OTv0m.js";
13
- import { _ as Q } from "./index-7x1OTv0m.js";
12
+ import { E as p } from "./index-B2CCZeff.js";
13
+ import { _ as Q } from "./index-B2CCZeff.js";
14
14
  const x = {
15
15
  install(e) {
16
16
  for (const [o, r] of Object.entries({
@@ -1,4 +1,4 @@
1
- import { g as s } from "./guard-BmLOamCj.js";
1
+ import { g as s } from "./guard-DgExtfXo.js";
2
2
  const t = {
3
3
  execute(a, o) {
4
4
  const e = s(a);
@@ -1,5 +1,5 @@
1
1
  import { b as o } from "./operations-D8pn-_iW.js";
2
- import { c as e } from "./choice-BqjECVyx.js";
2
+ import { c as e } from "./choice-CUCsR2dN.js";
3
3
  const a = o("todo", "knowledgeInline", e);
4
4
  export {
5
5
  a as default
@@ -0,0 +1,341 @@
1
+ import { Node as $, mergeAttributes as B } from "@tiptap/core";
2
+ import { nodeViewProps as I, NodeViewWrapper as D, VueNodeViewRenderer as L } from "@tiptap/vue-3";
3
+ import { defineComponent as F, ref as C, watch as N, onMounted as H, onBeforeUnmount as P, openBlock as s, createBlock as p, unref as i, normalizeClass as M, withCtx as m, createElementVNode as z, createElementBlock as l, createVNode as v, createTextVNode as c, createCommentVNode as n, withModifiers as q, toDisplayString as b, Fragment as U } from "vue";
4
+ import { Button as y, ImagePreview as h, Modal as O } from "@freecallai/ui";
5
+ import { closeHistory as R } from "@tiptap/pm/history";
6
+ import g from "@freecallai/icons";
7
+ import { IconDragDotVertical as W } from "@freecallai/ui/es/icon/index.js";
8
+ const j = { class: "fk-media-surface" }, G = {
9
+ key: 0,
10
+ class: "fk-media-failed"
11
+ }, J = ["href"], K = ["draggable", "src", "alt"], Q = ["draggable", "src", "poster", "controls"], X = {
12
+ key: 5,
13
+ class: "fk-media-actions"
14
+ }, Y = {
15
+ key: 0,
16
+ "data-drag-handle": "",
17
+ class: "fk-media-handle",
18
+ title: "拖动调整位置"
19
+ }, Z = {
20
+ key: 6,
21
+ class: "fk-upload-state"
22
+ }, x = {
23
+ key: 0,
24
+ class: "fk-media-caption"
25
+ }, _ = {
26
+ key: 1,
27
+ class: "fk-error"
28
+ }, ee = ["src"], te = /* @__PURE__ */ F({
29
+ __name: "MediaView",
30
+ props: I,
31
+ setup(a) {
32
+ const r = a, o = r.extension.options.sceneStyle === !0, d = C(!1), u = C(!1), V = C(null), k = C(r.editor.isEditable);
33
+ function E(e) {
34
+ const { detail: t } = e;
35
+ (t == null ? void 0 : t.id) === r.node.attrs.id && r.node.attrs.status === "uploading" && typeof t.percent == "number" && Number.isFinite(t.percent) && (V.value = t.percent);
36
+ }
37
+ const w = () => {
38
+ k.value = r.editor.isEditable;
39
+ };
40
+ r.editor.on("update", w), r.editor.on("transaction", w);
41
+ function T() {
42
+ r.editor.isEditable && (r.editor.view.dispatch(R(r.editor.state.tr)), r.deleteNode());
43
+ }
44
+ function A() {
45
+ r.editor.view.dom.dispatchEvent(
46
+ new CustomEvent("fkp-media-retry", {
47
+ bubbles: !0,
48
+ detail: { id: r.node.attrs.id }
49
+ })
50
+ );
51
+ }
52
+ function S() {
53
+ !o || r.node.attrs.sourceType === "qianniuVideo" || u.value || !["image", "video"].includes(r.node.attrs.kind) || r.node.attrs.status !== "ready" || (d.value = !0);
54
+ }
55
+ return N(
56
+ () => r.node.attrs.src,
57
+ () => {
58
+ u.value = !1;
59
+ }
60
+ ), N(
61
+ () => r.node.attrs.status,
62
+ (e) => {
63
+ e !== "uploading" && (V.value = null);
64
+ }
65
+ ), H(() => {
66
+ r.editor.view.dom.addEventListener("fkp-media-progress", E);
67
+ }), P(() => {
68
+ r.editor.view.dom.removeEventListener("fkp-media-progress", E), r.editor.off("update", w), r.editor.off("transaction", w);
69
+ }), (e, t) => (s(), p(i(D), {
70
+ class: M(["fk-media", {
71
+ "is-selected": e.selected,
72
+ "is-scene-media": o,
73
+ "is-video": e.node.attrs.kind === "video",
74
+ "is-qianniu-video": e.node.attrs.sourceType === "qianniuVideo",
75
+ "is-error": e.node.attrs.status === "error"
76
+ }]),
77
+ "data-media-id": e.node.attrs.id,
78
+ "data-drag-handle": o && k.value ? "" : void 0,
79
+ contenteditable: "false",
80
+ onClick: S
81
+ }, {
82
+ default: m(() => [
83
+ z("div", j, [
84
+ u.value ? (s(), l("div", G, [
85
+ v(i(g), {
86
+ name: "fail",
87
+ size: 24
88
+ }),
89
+ t[8] || (t[8] = c("媒体无法加载"))
90
+ ])) : n("", !0),
91
+ e.node.attrs.sourceType === "qianniuVideo" ? (s(), l("a", {
92
+ key: 1,
93
+ class: "fk-qianniu-video-link",
94
+ href: e.node.attrs.src,
95
+ target: "_blank",
96
+ rel: "noopener noreferrer",
97
+ onClick: t[0] || (t[0] = q(() => {
98
+ }, ["stop"]))
99
+ }, b(e.node.attrs.src), 9, J)) : e.node.attrs.kind === "image" ? (s(), l("img", {
100
+ key: 2,
101
+ draggable: o ? !1 : void 0,
102
+ src: e.node.attrs.src,
103
+ alt: e.node.attrs.name,
104
+ onError: t[1] || (t[1] = (f) => u.value = !0),
105
+ onDblclick: t[2] || (t[2] = (f) => d.value = !0)
106
+ }, null, 40, K)) : (s(), l("video", {
107
+ key: 3,
108
+ draggable: o ? !1 : void 0,
109
+ src: e.node.attrs.src,
110
+ poster: e.node.attrs.poster || void 0,
111
+ controls: !o,
112
+ muted: o,
113
+ playsinline: "",
114
+ preload: "metadata",
115
+ onError: t[3] || (t[3] = (f) => u.value = !0)
116
+ }, null, 40, Q)),
117
+ o && !u.value && e.node.attrs.sourceType !== "qianniuVideo" && e.node.attrs.status === "ready" && ["image", "video"].includes(e.node.attrs.kind) ? (s(), p(i(y), {
118
+ key: 4,
119
+ class: M(["fk-media-play", { "is-image-preview": e.node.attrs.kind === "image" }]),
120
+ type: "text",
121
+ "aria-label": e.node.attrs.kind === "image" ? "查看大图" : "播放视频",
122
+ style: { "pointer-events": "none" },
123
+ onClick: t[4] || (t[4] = (f) => d.value = !0)
124
+ }, {
125
+ default: m(() => [
126
+ v(i(g), {
127
+ name: "visible",
128
+ size: 14
129
+ }),
130
+ c(b(e.node.attrs.kind === "image" ? "点击查看大图" : "点击播放视频"), 1)
131
+ ]),
132
+ _: 1
133
+ }, 8, ["class", "aria-label"])) : n("", !0),
134
+ o ? n("", !0) : (s(), l("div", X, [
135
+ k.value ? (s(), l("span", Y, [
136
+ v(i(W), { size: 15 })
137
+ ])) : n("", !0),
138
+ e.node.attrs.sourceType !== "qianniuVideo" ? (s(), p(i(y), {
139
+ key: 1,
140
+ type: "text",
141
+ size: "mini",
142
+ title: "预览媒体",
143
+ "aria-label": "预览媒体",
144
+ onClick: t[5] || (t[5] = (f) => d.value = !0)
145
+ }, {
146
+ default: m(() => [
147
+ v(i(g), {
148
+ name: "open",
149
+ size: 15
150
+ })
151
+ ]),
152
+ _: 1
153
+ })) : n("", !0),
154
+ k.value && e.node.attrs.status === "error" ? (s(), p(i(y), {
155
+ key: 2,
156
+ type: "text",
157
+ size: "mini",
158
+ title: "重试上传",
159
+ "aria-label": "重试上传",
160
+ onClick: A
161
+ }, {
162
+ default: m(() => t[9] || (t[9] = [
163
+ c("重试")
164
+ ])),
165
+ _: 1
166
+ })) : n("", !0),
167
+ k.value ? (s(), p(i(y), {
168
+ key: 3,
169
+ type: "text",
170
+ size: "mini",
171
+ title: "删除媒体",
172
+ "aria-label": "删除媒体",
173
+ onClick: T
174
+ }, {
175
+ default: m(() => [
176
+ v(i(g), {
177
+ name: "rte-del",
178
+ size: 15
179
+ })
180
+ ]),
181
+ _: 1
182
+ })) : n("", !0)
183
+ ])),
184
+ e.node.attrs.status === "uploading" ? (s(), l("div", Z, [
185
+ v(i(g), {
186
+ name: "sync",
187
+ size: 17,
188
+ class: "fk-spin"
189
+ }),
190
+ c("正在上传" + b(V.value === null ? "…" : ` ${V.value}%`), 1),
191
+ o && k.value ? (s(), p(i(y), {
192
+ key: 0,
193
+ class: "fk-media-status-action",
194
+ type: "text",
195
+ size: "mini",
196
+ "aria-label": "取消上传",
197
+ onClick: q(T, ["stop"])
198
+ }, {
199
+ default: m(() => t[10] || (t[10] = [
200
+ c("取消上传")
201
+ ])),
202
+ _: 1
203
+ })) : n("", !0)
204
+ ])) : n("", !0)
205
+ ]),
206
+ e.node.attrs.sourceType !== "qianniuVideo" ? (s(), l("div", x, [
207
+ e.node.attrs.kind === "video" ? (s(), p(i(g), {
208
+ key: 0,
209
+ name: "video2",
210
+ size: 12
211
+ })) : n("", !0),
212
+ z("span", null, b(e.node.attrs.name), 1),
213
+ e.node.attrs.status === "error" ? (s(), l("span", _, b(e.node.attrs.error), 1)) : n("", !0),
214
+ o && k.value && e.node.attrs.status === "error" ? (s(), l(U, { key: 2 }, [
215
+ v(i(y), {
216
+ class: "fk-media-status-action",
217
+ type: "text",
218
+ size: "mini",
219
+ "aria-label": "重试上传",
220
+ onClick: q(A, ["stop"])
221
+ }, {
222
+ default: m(() => t[11] || (t[11] = [
223
+ c("重试")
224
+ ])),
225
+ _: 1
226
+ }),
227
+ v(i(y), {
228
+ class: "fk-media-status-action",
229
+ type: "text",
230
+ size: "mini",
231
+ "aria-label": "移除失败媒体",
232
+ onClick: q(T, ["stop"])
233
+ }, {
234
+ default: m(() => t[12] || (t[12] = [
235
+ c("移除")
236
+ ])),
237
+ _: 1
238
+ })
239
+ ], 64)) : n("", !0)
240
+ ])) : n("", !0),
241
+ e.node.attrs.kind === "image" ? (s(), p(i(h), {
242
+ key: 1,
243
+ visible: d.value,
244
+ "onUpdate:visible": t[6] || (t[6] = (f) => d.value = f),
245
+ src: e.node.attrs.src,
246
+ "mask-closable": !0
247
+ }, null, 8, ["visible", "src"])) : (s(), p(i(O), {
248
+ key: 2,
249
+ visible: d.value,
250
+ "onUpdate:visible": t[7] || (t[7] = (f) => d.value = f),
251
+ title: e.node.attrs.name,
252
+ footer: !1,
253
+ width: "min(960px, 90vw)",
254
+ "unmount-on-close": ""
255
+ }, {
256
+ default: m(() => [
257
+ z("video", {
258
+ class: "fk-video-preview",
259
+ src: e.node.attrs.src,
260
+ controls: "",
261
+ autoplay: ""
262
+ }, null, 8, ee)
263
+ ]),
264
+ _: 1
265
+ }, 8, ["visible", "title"]))
266
+ ]),
267
+ _: 1
268
+ }, 8, ["class", "data-media-id", "data-drag-handle"]));
269
+ }
270
+ }), le = $.create({
271
+ name: "mediaBlock",
272
+ group: "block",
273
+ atom: !0,
274
+ draggable: !0,
275
+ selectable: !0,
276
+ addOptions() {
277
+ return { sceneStyle: !1 };
278
+ },
279
+ addAttributes() {
280
+ return {
281
+ id: { default: "" },
282
+ nodeVersion: { default: 0 },
283
+ assetId: { default: null },
284
+ sourceType: { default: null },
285
+ src: { default: "" },
286
+ kind: { default: "image" },
287
+ name: { default: "" },
288
+ poster: { default: null },
289
+ status: { default: "ready" },
290
+ error: { default: "" }
291
+ };
292
+ },
293
+ parseHTML() {
294
+ return [
295
+ {
296
+ tag: "figure[data-media-block]",
297
+ getAttrs: (a) => {
298
+ var r, o, d, u;
299
+ return {
300
+ id: a.getAttribute("data-id"),
301
+ kind: a.getAttribute("data-kind"),
302
+ src: ((r = a.querySelector("img,video")) == null ? void 0 : r.getAttribute("src")) || (a.getAttribute("data-source-type") === "qianniuVideo" ? (o = a.querySelector("a[href]")) == null ? void 0 : o.getAttribute("href") : null),
303
+ name: (d = a.querySelector("figcaption")) == null ? void 0 : d.textContent,
304
+ assetId: a.getAttribute("data-asset-id"),
305
+ sourceType: a.getAttribute("data-source-type"),
306
+ poster: (u = a.querySelector("video")) == null ? void 0 : u.getAttribute("poster"),
307
+ status: "ready"
308
+ };
309
+ }
310
+ }
311
+ ];
312
+ },
313
+ renderHTML({ node: a, HTMLAttributes: r }) {
314
+ return [
315
+ "figure",
316
+ B(r, {
317
+ "data-media-block": "",
318
+ "data-fkp-node": "media-block",
319
+ "data-id": a.attrs.id,
320
+ "data-kind": a.attrs.kind,
321
+ "data-asset-id": a.attrs.assetId,
322
+ "data-source-type": a.attrs.sourceType,
323
+ "data-name": a.attrs.name
324
+ }),
325
+ a.attrs.sourceType === "qianniuVideo" ? ["a", { href: a.attrs.src }, a.attrs.src] : a.attrs.kind === "video" ? [
326
+ "video",
327
+ { src: a.attrs.src, controls: "", poster: a.attrs.poster }
328
+ ] : ["img", { src: a.attrs.src, alt: a.attrs.name }],
329
+ ["figcaption", {}, a.attrs.name]
330
+ ];
331
+ },
332
+ renderText({ node: a }) {
333
+ return a.attrs.sourceType === "qianniuVideo" ? a.attrs.src : `[${a.attrs.kind === "video" ? "视频" : "图片"}:${a.attrs.name}]`;
334
+ },
335
+ addNodeView() {
336
+ return L(te);
337
+ }
338
+ });
339
+ export {
340
+ le as MediaBlock
341
+ };
@@ -1,4 +1,4 @@
1
- import { a as m, d as A } from "./guard-BmLOamCj.js";
1
+ import { a as m, d as A } from "./guard-DgExtfXo.js";
2
2
  function b(i) {
3
3
  let s = 2166136261;
4
4
  for (let a = 0; a < i.length; a++)
@@ -0,0 +1,215 @@
1
+ import { defineComponent as O, ref as v, watch as B, nextTick as N, openBlock as s, createElementBlock as $, Fragment as q, createBlock as k, unref as u, withKeys as c, withModifiers as p, normalizeStyle as H, withCtx as f, renderList as T, createTextVNode as y, toDisplayString as b, createCommentVNode as K, createElementVNode as m, createVNode as M } from "vue";
2
+ import { Menu as U, MenuItem as F, Modal as D, Input as I, Alert as L, Message as j } from "@freecallai/ui";
3
+ import { i as h, o as J } from "./guard-DgExtfXo.js";
4
+ function R(a, l) {
5
+ const o = a == null ? void 0 : a[l];
6
+ return o === void 0 ? ["local"] : Array.isArray(o) ? [
7
+ ...new Set(
8
+ o.filter(
9
+ (n) => n === "local" || n === "online" || l === "video" && n === "qianniu"
10
+ )
11
+ )
12
+ ] : [];
13
+ }
14
+ function z(a) {
15
+ const l = (o) => Array.isArray(o) ? `[${o.map((n) => l(n)).join(",")}]` : o && typeof o == "object" ? `{${Object.keys(o).filter((n) => o[n] !== void 0).sort().map(
16
+ (n) => `${JSON.stringify(n)}:${l(
17
+ o[n]
18
+ )}`
19
+ ).join(",")}}` : JSON.stringify(o) ?? "null";
20
+ return l(a);
21
+ }
22
+ function Z(a) {
23
+ return z(a);
24
+ }
25
+ const P = ["for"], Q = {
26
+ key: 0,
27
+ class: "fkp-media-url-error",
28
+ role: "alert"
29
+ }, X = { class: "fkp-qianniu-video-form" }, x = /* @__PURE__ */ O({
30
+ __name: "MediaSourceControls",
31
+ props: {
32
+ menuKind: {},
33
+ dialogKind: {},
34
+ qianniuDialog: { type: Boolean },
35
+ menuStyle: {},
36
+ sources: {}
37
+ },
38
+ emits: ["choose", "submit", "submit-qianniu", "close"],
39
+ setup(a, { emit: l }) {
40
+ const o = a, n = l, r = v(""), g = v(""), d = v(""), w = v();
41
+ B(
42
+ () => o.dialogKind,
43
+ (i) => {
44
+ r.value = "", g.value = "", d.value = "", i && N(() => {
45
+ var e;
46
+ return (e = w.value) == null ? void 0 : e.focus();
47
+ });
48
+ }
49
+ );
50
+ function S() {
51
+ const i = r.value.trim();
52
+ return h(i) ? (d.value = "", n("submit", i), !0) : (d.value = "请输入有效的 http(s) 媒体链接", !1);
53
+ }
54
+ function C() {
55
+ const i = g.value.trim(), e = r.value.trim();
56
+ return !i || !e ? (j.error(
57
+ !i && !e ? "请填写视频ID与链接" : i ? "请填写视频链接" : "请填写视频ID"
58
+ ), !1) : J(e) ? (n("submit-qianniu", { id: i, url: e }), !0) : (j.error("不支持此链接格式,请前往千牛素材中心复制"), !1);
59
+ }
60
+ function E() {
61
+ var i;
62
+ (i = w.value) == null || i.focus();
63
+ }
64
+ return (i, e) => (s(), $(q, null, [
65
+ i.menuKind ? (s(), k(u(U), {
66
+ key: 0,
67
+ class: "fkp-media-source-menu",
68
+ style: H(i.menuStyle),
69
+ role: "menu",
70
+ "aria-label": `选择${i.menuKind === "image" ? "图片" : "视频"}来源`,
71
+ onKeydown: e[1] || (e[1] = c(p((t) => n("close"), ["stop"]), ["esc"]))
72
+ }, {
73
+ default: f(() => [
74
+ (s(!0), $(q, null, T(i.sources, (t) => (s(), k(u(F), {
75
+ key: t,
76
+ role: "menuitem",
77
+ tabindex: "0",
78
+ onMousedown: e[0] || (e[0] = p(() => {
79
+ }, ["prevent"])),
80
+ onClick: (V) => n("choose", t),
81
+ onKeydown: [
82
+ c(p((V) => n("choose", t), ["prevent"]), ["enter"]),
83
+ c(p((V) => n("choose", t), ["prevent"]), ["space"])
84
+ ]
85
+ }, {
86
+ default: f(() => [
87
+ y(b(t === "qianniu" ? "千牛" : t === "online" ? "在线" : "本地") + b(i.menuKind === "image" ? "图片" : "视频"), 1)
88
+ ]),
89
+ _: 2
90
+ }, 1032, ["onClick", "onKeydown"]))), 128))
91
+ ]),
92
+ _: 1
93
+ }, 8, ["style", "aria-label"])) : K("", !0),
94
+ i.dialogKind && !i.qianniuDialog ? (s(), k(u(D), {
95
+ key: 1,
96
+ visible: !0,
97
+ title: `添加在线${i.dialogKind === "image" ? "图片" : "视频"}`,
98
+ width: 420,
99
+ "render-to-body": !1,
100
+ "on-before-ok": S,
101
+ "ok-text": "添加",
102
+ role: "dialog",
103
+ "aria-modal": "true",
104
+ "aria-label": `添加在线${i.dialogKind === "image" ? "图片" : "视频"}`,
105
+ onOpen: E,
106
+ onCancel: e[4] || (e[4] = (t) => n("close"))
107
+ }, {
108
+ default: f(() => [
109
+ m("label", {
110
+ class: "fkp-media-url-label",
111
+ for: `fkp-media-url-${i.dialogKind}`
112
+ }, b(i.dialogKind === "image" ? "图片" : "视频") + "链接", 9, P),
113
+ M(u(I), {
114
+ ref_key: "input",
115
+ ref: w,
116
+ modelValue: r.value,
117
+ "onUpdate:modelValue": e[2] || (e[2] = (t) => r.value = t),
118
+ error: !!d.value,
119
+ "input-attrs": { id: `fkp-media-url-${i.dialogKind}`, type: "url" },
120
+ placeholder: "https://example.com/media",
121
+ onInput: e[3] || (e[3] = (t) => d.value = ""),
122
+ onKeydown: c(p(S, ["prevent"]), ["enter"])
123
+ }, null, 8, ["modelValue", "error", "input-attrs", "onKeydown"]),
124
+ d.value ? (s(), $("p", Q, b(d.value), 1)) : K("", !0)
125
+ ]),
126
+ _: 1
127
+ }, 8, ["title", "aria-label"])) : K("", !0),
128
+ i.dialogKind === "video" && i.qianniuDialog ? (s(), k(u(D), {
129
+ key: 2,
130
+ visible: !0,
131
+ title: "添加视频",
132
+ width: 600,
133
+ "render-to-body": !1,
134
+ "on-before-ok": C,
135
+ "ok-text": "添加",
136
+ role: "dialog",
137
+ "aria-modal": "true",
138
+ "aria-label": "添加视频",
139
+ onCancel: e[7] || (e[7] = (t) => n("close"))
140
+ }, {
141
+ default: f(() => [
142
+ m("div", X, [
143
+ M(u(L), {
144
+ type: "info",
145
+ "show-icon": !0
146
+ }, {
147
+ default: f(() => e[8] || (e[8] = [
148
+ y("请前往千牛平台「素材中心-我的图片/视频」复制视频ID与链接")
149
+ ])),
150
+ _: 1
151
+ }),
152
+ e[9] || (e[9] = m("label", { for: "fkp-qianniu-video-id" }, [
153
+ m("span", { "aria-hidden": "true" }, "*"),
154
+ y(" 视频ID")
155
+ ], -1)),
156
+ M(u(I), {
157
+ id: "fkp-qianniu-video-id",
158
+ modelValue: g.value,
159
+ "onUpdate:modelValue": e[5] || (e[5] = (t) => g.value = t),
160
+ placeholder: "请输入视频id"
161
+ }, null, 8, ["modelValue"]),
162
+ e[10] || (e[10] = m("label", { for: "fkp-qianniu-video-url" }, [
163
+ m("span", { "aria-hidden": "true" }, "*"),
164
+ y(" 视频链接")
165
+ ], -1)),
166
+ M(u(I), {
167
+ id: "fkp-qianniu-video-url",
168
+ modelValue: r.value,
169
+ "onUpdate:modelValue": e[6] || (e[6] = (t) => r.value = t),
170
+ placeholder: "请输入视频链接"
171
+ }, null, 8, ["modelValue"])
172
+ ])
173
+ ]),
174
+ _: 1
175
+ })) : K("", !0)
176
+ ], 64));
177
+ }
178
+ });
179
+ function _() {
180
+ const a = v(null);
181
+ function l(n) {
182
+ a.value = n;
183
+ }
184
+ function o(n, r) {
185
+ (n === "image" || n === "video") && !r && (a.value = null);
186
+ }
187
+ return { suppressedMediaHint: a, suppressMediaHint: l, resumeMediaHintOnHover: o };
188
+ }
189
+ const ee = 10, ne = {
190
+ image: 5 * 1024 * 1024,
191
+ video: 100 * 1024 * 1024
192
+ }, ie = {
193
+ image: ["image/png", "image/jpeg"],
194
+ video: ["video/mp4"]
195
+ }, A = {
196
+ png: { kind: "image", mime: "image/png" },
197
+ jpg: { kind: "image", mime: "image/jpeg" },
198
+ jpeg: { kind: "image", mime: "image/jpeg" },
199
+ mp4: { kind: "video", mime: "video/mp4" }
200
+ };
201
+ function oe(a) {
202
+ const l = a.name.lastIndexOf("."), o = l < 0 ? "" : a.name.slice(l + 1).toLowerCase(), n = Object.prototype.hasOwnProperty.call(A, o) ? A[o] : void 0;
203
+ return !n || a.type && a.type.toLowerCase() !== n.mime ? null : n;
204
+ }
205
+ export {
206
+ ee as M,
207
+ x as _,
208
+ oe as a,
209
+ ne as b,
210
+ z as c,
211
+ Z as d,
212
+ ie as e,
213
+ R as m,
214
+ _ as u
215
+ };
@@ -1,4 +1,4 @@
1
- import { p as l, i as c } from "./FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js";
1
+ import { p as l, i as c } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js";
2
2
  function u(o) {
3
3
  return {
4
4
  id: o,
@@ -1,5 +1,5 @@
1
1
  import { e as k } from "./types-PvYB5e85.js";
2
- import { a as $, b as S, c as T } from "./guard-BmLOamCj.js";
2
+ import { a as $, b as S, c as T } from "./guard-DgExtfXo.js";
3
3
  const I = [
4
4
  "variable",
5
5
  "todo",
@@ -1,4 +1,4 @@
1
- import { _ as i } from "../index-Ck8RYpuE.js";
1
+ import { _ as i } from "../index-CbmRr3rH.js";
2
2
  export {
3
3
  i as FkpNavigation
4
4
  };