@templatical/editor 0.14.0 → 0.15.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.
- package/dist/{AiChatSidebar-J8iO_sX7.js → AiChatSidebar-BIKvYREk.js} +57 -56
- package/dist/{AiFeatureMenu-F2diEDgV.js → AiFeatureMenu-QbD82crt.js} +20 -20
- package/dist/{BlockIssueBadge-a-qlByxF.js → BlockIssueBadge-B3xVgMTh.js} +11 -11
- package/dist/{CloudEditor-CDjtwb4i.js → CloudEditor-DptuSf7A.js} +470 -468
- package/dist/{CollaboratorBar-B_EnJLtW.js → CollaboratorBar-DrA_K69w.js} +20 -20
- package/dist/{CommentsSidebar-DaP9BA_r.js → CommentsSidebar-D_tSGvTX.js} +154 -153
- package/dist/CountdownBlock-apiYUhkQ.js +92 -0
- package/dist/CountdownToolbar-CS0axcjz.js +210 -0
- package/dist/{DesignReferenceSidebar-BHRlTqlT.js → DesignReferenceSidebar-DWYK9nTk.js} +58 -57
- package/dist/{IssuesPanel-u7ee3Wrl.js → IssuesPanel-CR1MPaDE.js} +40 -40
- package/dist/{LoadingTrack-CV3ID80N.js → LoadingTrack-DsecR8Rw.js} +1 -1
- package/dist/MergeTagSuggestion-CH2SUxBo.js +1327 -0
- package/dist/{ModuleBrowserModal-DOsdaS6s.js → ModuleBrowserModal-D45rBj5C.js} +60 -59
- package/dist/{ModulePreviewCanvas-Cx4MOJ0X.js → ModulePreviewCanvas-BiQ6B2-l.js} +29 -29
- package/dist/{NumberWithSuffix-D2mW_DhT.js → NumberWithSuffix-CrA6quxx.js} +143 -142
- package/dist/{ParagraphEditor-DMzkVnST.js → ParagraphEditor-1NaUJpZO.js} +247 -246
- package/dist/{RichTextEditorContent-CRCxCwKf.js → RichTextEditorContent-BqLHIZY7.js} +45 -44
- package/dist/{SaveModuleDialog-DuEKgumL.js → SaveModuleDialog-B0sPOTgO.js} +38 -37
- package/dist/{SnapshotHistory-CVgiNJtE.js → SnapshotHistory-DslVzmSb.js} +34 -33
- package/dist/{TemplateScoringPanel-lm0_9nYi.js → TemplateScoringPanel-CZ62rGHz.js} +83 -82
- package/dist/{TestEmailModal-WBMdiW5S.js → TestEmailModal-DWGniJVu.js} +22 -21
- package/dist/{TitleEditor-eyT0h-Sa.js → TitleEditor-D4t_gZZJ.js} +44 -44
- package/dist/{TplModal-tjQ7OB0g.js → TplModal-Br2VG6cn.js} +14 -13
- package/dist/{blockTypeIcons-DdB3uTKD.js → blockTypeIcons-CXhCS5WV.js} +2 -2
- package/dist/bundle-stats.json +8 -8
- package/dist/cdn/chunks/{AiFeatureMenu-D7rB2SBs.js → AiFeatureMenu-3Slo_LGA.js} +5 -5
- package/dist/cdn/chunks/{AiFeatureMenu-D7rB2SBs.js.map → AiFeatureMenu-3Slo_LGA.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-DHOe0pgx.js → BlockIssueBadge-BxwEiiF3.js} +3 -3
- package/dist/cdn/chunks/{BlockIssueBadge-DHOe0pgx.js.map → BlockIssueBadge-BxwEiiF3.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-DNed_Ym0.js → CloudEditor-DFIFWD9G.js} +89 -89
- package/dist/cdn/chunks/{CloudEditor-DNed_Ym0.js.map → CloudEditor-DFIFWD9G.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-sj_9Lee3.js → CollaboratorBar-Cu3vuN66.js} +4 -4
- package/dist/cdn/chunks/{CollaboratorBar-sj_9Lee3.js.map → CollaboratorBar-Cu3vuN66.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-C1Ikjpn4.js → CountdownBlock-BEVAJQtQ.js} +3 -3
- package/dist/cdn/chunks/{CountdownBlock-C1Ikjpn4.js.map → CountdownBlock-BEVAJQtQ.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-j1G_X8rB.js → CountdownToolbar-CI2sQZv5.js} +4 -4
- package/dist/cdn/chunks/{CountdownToolbar-j1G_X8rB.js.map → CountdownToolbar-CI2sQZv5.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-CTOf3PsH.js → IssuesPanel-BdeDoTcn.js} +4 -4
- package/dist/cdn/chunks/{IssuesPanel-CTOf3PsH.js.map → IssuesPanel-BdeDoTcn.js.map} +1 -1
- package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js +213 -0
- package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js.map +1 -0
- package/dist/cdn/chunks/{ModuleBrowserModal-DCh88-rr.js → ModuleBrowserModal-Dz-I5zfj.js} +6 -6
- package/dist/cdn/chunks/{ModuleBrowserModal-DCh88-rr.js.map → ModuleBrowserModal-Dz-I5zfj.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-DJqvTKmg.js → ModulePreviewCanvas-BfinyuAN.js} +3 -3
- package/dist/cdn/chunks/{ModulePreviewCanvas-DJqvTKmg.js.map → ModulePreviewCanvas-BfinyuAN.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-Bu45XWSl.js → NumberWithSuffix-CDjEa08X.js} +6 -6
- package/dist/cdn/chunks/{NumberWithSuffix-Bu45XWSl.js.map → NumberWithSuffix-CDjEa08X.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-DwZqLJp2.js → ParagraphEditor-B3fG0vge.js} +22 -22
- package/dist/cdn/chunks/{ParagraphEditor-DwZqLJp2.js.map → ParagraphEditor-B3fG0vge.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-CIuZ-2DV.js → RichTextEditorContent-C6YPCp9j.js} +4 -4
- package/dist/cdn/chunks/{RichTextEditorContent-CIuZ-2DV.js.map → RichTextEditorContent-C6YPCp9j.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-Bep0X2s_.js → SaveModuleDialog-C6UIIVAM.js} +3 -3
- package/dist/cdn/chunks/{SaveModuleDialog-Bep0X2s_.js.map → SaveModuleDialog-C6UIIVAM.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-DO1-h3RY.js → TitleEditor-BiZbLYF1.js} +10 -10
- package/dist/cdn/chunks/{TitleEditor-DO1-h3RY.js.map → TitleEditor-BiZbLYF1.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-8o24HVJu.js → blockTypeIcons-BernVG06.js} +3 -3
- package/dist/cdn/chunks/{blockTypeIcons-8o24HVJu.js.map → blockTypeIcons-BernVG06.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-kPCz_3zM.js → draggable-kG-D5Xsm.js} +6 -6
- package/dist/cdn/chunks/draggable-kG-D5Xsm.js.map +1 -0
- package/dist/cdn/chunks/extensions-Drp8UDc6.js +421 -0
- package/dist/cdn/chunks/extensions-Drp8UDc6.js.map +1 -0
- package/dist/cdn/chunks/{features-CkTMVylx.js → features-Dpczf9Su.js} +884 -835
- package/dist/cdn/chunks/features-Dpczf9Su.js.map +1 -0
- package/dist/cdn/chunks/{icons-9zjCuoJx.js → icons-CuxnJiGQ.js} +26 -26
- package/dist/cdn/chunks/{icons-9zjCuoJx.js.map → icons-CuxnJiGQ.js.map} +1 -1
- package/dist/cdn/chunks/{liquid.browser-DKKBzRQu.js → liquid.browser-BJOEu6Cg.js} +693 -678
- package/dist/cdn/chunks/liquid.browser-BJOEu6Cg.js.map +1 -0
- package/dist/cdn/chunks/{media-library-DMRIPx4g.js → media-library-CiYl_BO7.js} +33 -33
- package/dist/cdn/chunks/{media-library-DMRIPx4g.js.map → media-library-CiYl_BO7.js.map} +1 -1
- package/dist/cdn/chunks/{pusher-CdEqyLwF.js → pusher-CIwiKF8H.js} +4 -4
- package/dist/cdn/chunks/{pusher-CdEqyLwF.js.map → pusher-CIwiKF8H.js.map} +1 -1
- package/dist/cdn/chunks/{quality-CyeUgs_c.js → quality-CNjGxBG0.js} +112 -112
- package/dist/cdn/chunks/{quality-CyeUgs_c.js.map → quality-CNjGxBG0.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-BIKUEKDD.js → renderer-CFkg8h-K.js} +20 -20
- package/dist/cdn/chunks/renderer-CFkg8h-K.js.map +1 -0
- package/dist/cdn/chunks/{src-pDy_imWG.js → src-DRpKu4Dy.js} +5 -5
- package/dist/cdn/chunks/{src-pDy_imWG.js.map → src-DRpKu4Dy.js.map} +1 -1
- package/dist/cdn/chunks/{styles-D4Bd3SCx.js → styles-B7wryV0l.js} +1484 -1344
- package/dist/cdn/chunks/styles-B7wryV0l.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-BlLFFU3M.js → tiptap-DF9PEiqH.js} +6859 -6823
- package/dist/cdn/chunks/tiptap-DF9PEiqH.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +35 -35
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-CYJwFmjy.js → check-rl7ok6uJ.js} +1 -1
- package/dist/{chevron-down-C5l-DzAA.js → chevron-down-BKe__NOD.js} +1 -1
- package/dist/{circle-alert-wf5HUFZY.js → circle-alert-C8xmpMsK.js} +1 -1
- package/dist/{clock-Bj0bQw-K.js → clock-BW4JuDCN.js} +1 -1
- package/dist/{cloud-CoFDm9YA.js → cloud-BQusL53H.js} +208 -208
- package/dist/createLucideIcon-Dx-EjR9r.js +43 -0
- package/dist/{dist-CLpPNKy9.js → dist-B5Sov3sS.js} +7 -7
- package/dist/dist-BEWiuOMi.js +251 -0
- package/dist/{dist-CrQZ_af9.js → dist-BFmE-7hB.js} +2 -2
- package/dist/{dist-U5vfDdYI.js → dist-BMoa33wT.js} +2 -2
- package/dist/{dist-BctFrpeA.js → dist-BibU4HNl.js} +74 -65
- package/dist/{dist-Dd3ibRZm.js → dist-BsCGIDSt.js} +103 -102
- package/dist/dist-CNLKj9wa.js +5 -0
- package/dist/{dist-BX3gGwL8.js → dist-CNXDNYQn.js} +728 -694
- package/dist/{dist-Bn703mnA.js → dist-COG3IdPK.js} +3 -3
- package/dist/{dist-B7w6xTU6.js → dist-CQZxDvFw.js} +3 -3
- package/dist/{dist-34OcyoK1.js → dist-CRsjOQM-.js} +2 -2
- package/dist/dist-CTT6WYJ6.js +134 -0
- package/dist/dist-Cqa6aeAJ.js +5 -0
- package/dist/{dist-ChMninLH.js → dist-SXJJ2v41.js} +2 -2
- package/dist/{dist-CyjyYg52.js → dist-itdjZraK.js} +28 -23
- package/dist/extensions-DwaZAqm6.js +423 -0
- package/dist/{image-up-x8-WXfsx.js → image-up-BwBCmQ4P.js} +1 -1
- package/dist/{info-RS_fGcGi.js → info-TCn7uWR5.js} +1 -1
- package/dist/{keys-DgYXDafq.js → keys-Cv8-8GsD.js} +1 -1
- package/dist/{liquid.browser-CVjP5Mex.js → liquid.browser-DZLtv26k.js} +692 -677
- package/dist/{list-checks-Bf7XdDyv.js → list-checks-CSrOWNgq.js} +1 -1
- package/dist/{loader-circle-CLZ0_FvW.js → loader-circle-BLmicnPG.js} +1 -1
- package/dist/{message-circle-B-1bN9ab.js → message-circle-C9hHMQCI.js} +1 -1
- package/dist/{refresh-cw-CWKWqJYG.js → refresh-cw-D1JQ1LNa.js} +1 -1
- package/dist/runtime-dom.esm-bundler-BzuoCyNp.js +523 -0
- package/dist/{scan-line-BtK5dEai.js → scan-line-DgijVq9y.js} +1 -1
- package/dist/{send-Cn1IUdzh.js → send-DjPdq69F.js} +1 -1
- package/dist/{shield-check-CrvMk4Ea.js → shield-check-Bqluu8FS.js} +1 -1
- package/dist/{sparkles-CgfjwvnG.js → sparkles-M4azPVSP.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/styles-D7fQ7f_1.js +4164 -0
- package/dist/templatical-editor.js +127 -126
- package/dist/{text-align-start-C3r_Rnvy.js → text-align-start-CMya5pCQ.js} +11 -11
- package/dist/{trash-2-CjERg4x9.js → trash-2-C-81rkLS.js} +1 -1
- package/dist/{triangle-alert-Chkny574.js → triangle-alert-BuRWnynk.js} +1 -1
- package/dist/{upload-e5kDRkPb.js → upload-CWBIoLd4.js} +1 -1
- package/dist/{useAliveFlag-cUQj9rmB.js → useAliveFlag-CECL_OUb.js} +1 -1
- package/dist/{useCloudI18n-CYJKqXtI.js → useCloudI18n-AKCy98qD.js} +2 -2
- package/dist/{useEditorCore-8JxXDOA4.js → useEditorCore-vcWLdnjN.js} +1406 -1364
- package/dist/{useI18n-BWqM8i78.js → useI18n-C-TDeJBt.js} +2 -2
- package/dist/{useMergeTag-NHC4ylza.js → useMergeTag-DSrBY0-2.js} +5 -5
- package/dist/usePopoverRoot-DKUDnr55.js +8 -0
- package/dist/{vue.runtime.esm-bundler-BPa483TZ.js → vue.runtime.esm-bundler-l0XAqiyv.js} +626 -1147
- package/dist/{x-DiPIbccg.js → x-CQSvXnGR.js} +1 -1
- package/package.json +26 -26
- package/dist/CountdownBlock-DtAokAVw.js +0 -92
- package/dist/CountdownToolbar-Dtqgwy0g.js +0 -210
- package/dist/cdn/chunks/draggable-kPCz_3zM.js.map +0 -1
- package/dist/cdn/chunks/extensions-iwBXnEwq.js +0 -605
- package/dist/cdn/chunks/extensions-iwBXnEwq.js.map +0 -1
- package/dist/cdn/chunks/features-CkTMVylx.js.map +0 -1
- package/dist/cdn/chunks/liquid.browser-DKKBzRQu.js.map +0 -1
- package/dist/cdn/chunks/renderer-BIKUEKDD.js.map +0 -1
- package/dist/cdn/chunks/styles-D4Bd3SCx.js.map +0 -1
- package/dist/cdn/chunks/tiptap-BlLFFU3M.js.map +0 -1
- package/dist/createLucideIcon-Bad2kKE0.js +0 -43
- package/dist/dist-CADDCv0o.js +0 -5
- package/dist/dist-CGvz7vkq.js +0 -5
- package/dist/dist-DuCzdgDA.js +0 -382
- package/dist/extensions-J439b7y7.js +0 -1720
- package/dist/styles-BUwDOWd3.js +0 -4022
- package/dist/usePopoverRoot-B1sdY4es.js +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as o, i as s } from "./dist-
|
|
1
|
+
import { I as e, J as t, K as n, Y as r, q as i, s as a } from "./vue.runtime.esm-bundler-l0XAqiyv.js";
|
|
2
|
+
import { d as o, i as s } from "./dist-BibU4HNl.js";
|
|
3
3
|
//#region ../core/dist/cloud/index.js
|
|
4
4
|
var c = class e {
|
|
5
5
|
static DEFAULT_BASE_URL = "https://templatical.com";
|
|
@@ -52,7 +52,7 @@ var c = class e {
|
|
|
52
52
|
return this.accessToken && !this.isTokenExpiringSoon() ? this.accessToken : this.refreshToken();
|
|
53
53
|
}
|
|
54
54
|
isTokenExpiringSoon() {
|
|
55
|
-
return this.expiresAt
|
|
55
|
+
return !this.expiresAt || this.expiresAt.getTime() - Date.now() < e.REFRESH_THRESHOLD_MS;
|
|
56
56
|
}
|
|
57
57
|
async refreshToken() {
|
|
58
58
|
if (this.refreshPromise) return this.refreshPromise;
|
|
@@ -434,10 +434,10 @@ function b(e, t) {
|
|
|
434
434
|
function x(e) {
|
|
435
435
|
return e === "1" ? 1 : e === "3" ? 3 : 2;
|
|
436
436
|
}
|
|
437
|
-
function S(
|
|
438
|
-
let n = new _(
|
|
437
|
+
function S(e) {
|
|
438
|
+
let n = new _(e.authManager), r = i({
|
|
439
439
|
template: null,
|
|
440
|
-
content: o(
|
|
440
|
+
content: o(e.defaultFontFamily, e.templateDefaults),
|
|
441
441
|
selectedBlockId: null,
|
|
442
442
|
viewport: "desktop",
|
|
443
443
|
darkMode: !1,
|
|
@@ -446,13 +446,13 @@ function S(t) {
|
|
|
446
446
|
isSaving: !1,
|
|
447
447
|
isLoading: !1,
|
|
448
448
|
uiTheme: "auto"
|
|
449
|
-
}), c =
|
|
450
|
-
get: () =>
|
|
449
|
+
}), c = a({
|
|
450
|
+
get: () => r.content,
|
|
451
451
|
set: (e) => {
|
|
452
|
-
|
|
452
|
+
r.content = e, r.isDirty = !0;
|
|
453
453
|
}
|
|
454
|
-
}), l =
|
|
455
|
-
let e = /* @__PURE__ */ new Set(), t =
|
|
454
|
+
}), l = a(() => r.selectedBlockId ? d(r.content.blocks, r.selectedBlockId) : null), u = a(() => {
|
|
455
|
+
let e = /* @__PURE__ */ new Set(), t = r.template?.content?.blocks;
|
|
456
456
|
if (!t) return e;
|
|
457
457
|
for (let n of t) if (e.add(n.id), n.type === "section") for (let t of n.children) for (let n of t) e.add(n.id);
|
|
458
458
|
return e;
|
|
@@ -482,121 +482,121 @@ function S(t) {
|
|
|
482
482
|
}
|
|
483
483
|
return null;
|
|
484
484
|
}
|
|
485
|
-
function p(
|
|
486
|
-
return
|
|
485
|
+
function p(t) {
|
|
486
|
+
return e.lockedBlocks?.value.has(t) ?? !1;
|
|
487
487
|
}
|
|
488
488
|
function m(e, t = !0) {
|
|
489
|
-
|
|
489
|
+
r.content = e, t && (r.isDirty = !0);
|
|
490
490
|
}
|
|
491
491
|
function h(e) {
|
|
492
|
-
e && p(e) || (
|
|
492
|
+
e && p(e) || (r.selectedBlockId = e);
|
|
493
493
|
}
|
|
494
494
|
function g(e) {
|
|
495
|
-
|
|
495
|
+
r.viewport = e;
|
|
496
496
|
}
|
|
497
497
|
function v(e) {
|
|
498
|
-
|
|
498
|
+
r.darkMode = e;
|
|
499
499
|
}
|
|
500
500
|
function y(e) {
|
|
501
|
-
|
|
501
|
+
r.uiTheme = e;
|
|
502
502
|
}
|
|
503
503
|
function b(e) {
|
|
504
|
-
|
|
504
|
+
r.previewMode = e, e && (r.selectedBlockId = null);
|
|
505
505
|
}
|
|
506
506
|
function S(e, t) {
|
|
507
507
|
if (p(e)) return;
|
|
508
|
-
let n = d(
|
|
509
|
-
n && (Object.assign(n, t),
|
|
508
|
+
let n = d(r.content.blocks, e);
|
|
509
|
+
n && (Object.assign(n, t), r.isDirty = !0);
|
|
510
510
|
}
|
|
511
511
|
function C(e) {
|
|
512
|
-
|
|
513
|
-
...
|
|
512
|
+
r.content.settings = {
|
|
513
|
+
...r.content.settings,
|
|
514
514
|
...e
|
|
515
|
-
},
|
|
515
|
+
}, r.isDirty = !0;
|
|
516
516
|
}
|
|
517
|
-
function w(e, t, n = 0,
|
|
517
|
+
function w(e, t, n = 0, i) {
|
|
518
518
|
if (t) {
|
|
519
|
-
let
|
|
520
|
-
if (
|
|
521
|
-
|
|
522
|
-
let t =
|
|
523
|
-
|
|
519
|
+
let a = d(r.content.blocks, t);
|
|
520
|
+
if (a && a.type === "section") {
|
|
521
|
+
a.children[n] = a.children[n] || [];
|
|
522
|
+
let t = a.children[n];
|
|
523
|
+
i !== void 0 && i < t.length ? t.splice(i, 0, e) : t.push(e);
|
|
524
524
|
}
|
|
525
|
-
} else
|
|
526
|
-
|
|
525
|
+
} else i !== void 0 && i < r.content.blocks.length ? r.content.blocks.splice(i, 0, e) : r.content.blocks.push(e);
|
|
526
|
+
r.isDirty = !0;
|
|
527
527
|
}
|
|
528
528
|
function T(e) {
|
|
529
529
|
if (p(e)) return;
|
|
530
|
-
let t = f(
|
|
530
|
+
let t = f(r.content.blocks, e);
|
|
531
531
|
if (t) {
|
|
532
532
|
let n = t.blocks.findIndex((t) => t.id === e);
|
|
533
|
-
n !== -1 && (t.blocks.splice(n, 1),
|
|
533
|
+
n !== -1 && (t.blocks.splice(n, 1), r.selectedBlockId === e && (r.selectedBlockId = null), r.isDirty = !0);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
function E(e, t, n,
|
|
537
|
-
let
|
|
538
|
-
if (!
|
|
539
|
-
let o =
|
|
536
|
+
function E(e, t, n, i = 0) {
|
|
537
|
+
let a = f(r.content.blocks, e);
|
|
538
|
+
if (!a) return;
|
|
539
|
+
let o = a.blocks.findIndex((t) => t.id === e);
|
|
540
540
|
if (o === -1) return;
|
|
541
541
|
let s;
|
|
542
542
|
if (n) {
|
|
543
|
-
let e = d(
|
|
544
|
-
if (!e || e.type !== "section" ||
|
|
545
|
-
e.children[
|
|
546
|
-
} else s =
|
|
547
|
-
let [c] =
|
|
548
|
-
s.splice(t, 0, c),
|
|
549
|
-
}
|
|
550
|
-
async function D(
|
|
551
|
-
|
|
543
|
+
let e = d(r.content.blocks, n);
|
|
544
|
+
if (!e || e.type !== "section" || i < 0 || i >= x(e.columns)) return;
|
|
545
|
+
e.children[i] = e.children[i] || [], s = e.children[i];
|
|
546
|
+
} else s = r.content.blocks;
|
|
547
|
+
let [c] = a.blocks.splice(o, 1);
|
|
548
|
+
s.splice(t, 0, c), r.isDirty = !0;
|
|
549
|
+
}
|
|
550
|
+
async function D(t) {
|
|
551
|
+
r.isLoading = !0;
|
|
552
552
|
try {
|
|
553
|
-
|
|
554
|
-
let
|
|
555
|
-
return
|
|
556
|
-
} catch (
|
|
557
|
-
throw
|
|
553
|
+
t && (r.content = t);
|
|
554
|
+
let e = await n.createTemplate(r.content);
|
|
555
|
+
return r.template = e, r.isDirty = !1, e;
|
|
556
|
+
} catch (t) {
|
|
557
|
+
throw e.onError?.(t), t;
|
|
558
558
|
} finally {
|
|
559
|
-
|
|
559
|
+
r.isLoading = !1;
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
async function O(
|
|
563
|
-
|
|
562
|
+
async function O(t) {
|
|
563
|
+
r.isLoading = !0;
|
|
564
564
|
try {
|
|
565
|
-
let
|
|
566
|
-
return
|
|
567
|
-
} catch (
|
|
568
|
-
throw
|
|
565
|
+
let e = await n.getTemplate(t);
|
|
566
|
+
return r.template = e, r.content = e.content, r.isDirty = !1, e;
|
|
567
|
+
} catch (t) {
|
|
568
|
+
throw e.onError?.(t), t;
|
|
569
569
|
} finally {
|
|
570
|
-
|
|
570
|
+
r.isLoading = !1;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
async function k() {
|
|
574
|
-
if (!
|
|
575
|
-
|
|
574
|
+
if (!r.template?.id) throw new s("No template loaded. Call create() or load() before saving.");
|
|
575
|
+
r.isSaving = !0;
|
|
576
576
|
try {
|
|
577
|
-
let e = await n.updateTemplate(
|
|
578
|
-
return
|
|
579
|
-
} catch (
|
|
580
|
-
throw
|
|
577
|
+
let e = await n.updateTemplate(r.template.id, r.content);
|
|
578
|
+
return r.template = e, r.isDirty = !1, e;
|
|
579
|
+
} catch (t) {
|
|
580
|
+
throw e.onError?.(t), t;
|
|
581
581
|
} finally {
|
|
582
|
-
|
|
582
|
+
r.isSaving = !1;
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
async function A() {
|
|
586
|
-
if (
|
|
587
|
-
await n.createSnapshot(
|
|
588
|
-
} catch (
|
|
589
|
-
throw
|
|
586
|
+
if (r.template?.id) try {
|
|
587
|
+
await n.createSnapshot(r.template.id, r.content);
|
|
588
|
+
} catch (t) {
|
|
589
|
+
throw e.onError?.(t), t;
|
|
590
590
|
}
|
|
591
591
|
}
|
|
592
592
|
function j() {
|
|
593
|
-
return
|
|
593
|
+
return r.template?.id !== void 0;
|
|
594
594
|
}
|
|
595
595
|
function M() {
|
|
596
|
-
|
|
596
|
+
r.isDirty = !0;
|
|
597
597
|
}
|
|
598
598
|
function N(e) {
|
|
599
|
-
let t = f(
|
|
599
|
+
let t = f(r.content.blocks, e);
|
|
600
600
|
if (!t) return null;
|
|
601
601
|
let n = t.blocks.findIndex((t) => t.id === e);
|
|
602
602
|
return n === -1 ? null : {
|
|
@@ -606,7 +606,7 @@ function S(t) {
|
|
|
606
606
|
};
|
|
607
607
|
}
|
|
608
608
|
return {
|
|
609
|
-
state: r
|
|
609
|
+
state: t(r),
|
|
610
610
|
content: c,
|
|
611
611
|
selectedBlock: l,
|
|
612
612
|
savedBlockIds: u,
|
|
@@ -636,7 +636,7 @@ function w() {
|
|
|
636
636
|
return `msg_${Date.now()}_${++C}`;
|
|
637
637
|
}
|
|
638
638
|
function T(e) {
|
|
639
|
-
let { authManager: t, getTemplateId:
|
|
639
|
+
let { authManager: t, getTemplateId: n, onApply: i, onError: a } = e, o = r([]), s = r(!1), c = r(!1), u = r(null), d = r(null), f = r(null), p = r(null), m = r(null), h = r(null), _ = r(!1), v = r([]), y = r(!1);
|
|
640
640
|
function b(e, t) {
|
|
641
641
|
let n = o.value.findIndex((t) => t.id === e);
|
|
642
642
|
if (n === -1) return;
|
|
@@ -651,7 +651,7 @@ function T(e) {
|
|
|
651
651
|
];
|
|
652
652
|
}
|
|
653
653
|
async function x() {
|
|
654
|
-
let e =
|
|
654
|
+
let e = n();
|
|
655
655
|
if (e) {
|
|
656
656
|
c.value = !0;
|
|
657
657
|
try {
|
|
@@ -676,16 +676,16 @@ function T(e) {
|
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
async function S(e,
|
|
680
|
-
let i =
|
|
679
|
+
async function S(e, r) {
|
|
680
|
+
let i = n();
|
|
681
681
|
if (i) {
|
|
682
682
|
y.value = !0;
|
|
683
683
|
try {
|
|
684
|
-
let
|
|
684
|
+
let n = l(g["ai.suggestions"], {
|
|
685
685
|
project: t.projectId,
|
|
686
686
|
tenant: t.tenantSlug,
|
|
687
687
|
template: i
|
|
688
|
-
}), a = await t.authenticatedFetch(
|
|
688
|
+
}), a = await t.authenticatedFetch(n, {
|
|
689
689
|
method: "POST",
|
|
690
690
|
headers: {
|
|
691
691
|
"Content-Type": "application/json",
|
|
@@ -693,7 +693,7 @@ function T(e) {
|
|
|
693
693
|
},
|
|
694
694
|
body: JSON.stringify({
|
|
695
695
|
current_content: e,
|
|
696
|
-
merge_tags:
|
|
696
|
+
merge_tags: r.map((e) => ({
|
|
697
697
|
label: e.label,
|
|
698
698
|
value: e.value
|
|
699
699
|
}))
|
|
@@ -725,8 +725,8 @@ function T(e) {
|
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
async function C(e,
|
|
729
|
-
let y =
|
|
728
|
+
async function C(e, r, c) {
|
|
729
|
+
let y = n();
|
|
730
730
|
if (!y) throw Error("Template must be saved before using AI generation");
|
|
731
731
|
s.value = !0, u.value = null, d.value = null, v.value = [];
|
|
732
732
|
let x = w();
|
|
@@ -744,11 +744,11 @@ function T(e) {
|
|
|
744
744
|
timestamp: Date.now()
|
|
745
745
|
}];
|
|
746
746
|
try {
|
|
747
|
-
let
|
|
747
|
+
let n = l(g["ai.generate"], {
|
|
748
748
|
project: t.projectId,
|
|
749
749
|
tenant: t.tenantSlug,
|
|
750
750
|
template: y
|
|
751
|
-
}), a = await t.authenticatedFetch(
|
|
751
|
+
}), a = await t.authenticatedFetch(n, {
|
|
752
752
|
method: "POST",
|
|
753
753
|
headers: {
|
|
754
754
|
"Content-Type": "application/json",
|
|
@@ -756,7 +756,7 @@ function T(e) {
|
|
|
756
756
|
},
|
|
757
757
|
body: JSON.stringify({
|
|
758
758
|
prompt: e,
|
|
759
|
-
current_content:
|
|
759
|
+
current_content: r,
|
|
760
760
|
merge_tags: c.map((e) => ({
|
|
761
761
|
label: e.label,
|
|
762
762
|
value: e.value
|
|
@@ -776,19 +776,19 @@ function T(e) {
|
|
|
776
776
|
let { done: e, value: t } = await s.read();
|
|
777
777
|
if (e) break;
|
|
778
778
|
v += d.decode(t, { stream: !0 });
|
|
779
|
-
let
|
|
780
|
-
v =
|
|
781
|
-
for (let e of
|
|
779
|
+
let n = v.split("\n");
|
|
780
|
+
v = n.pop() ?? "";
|
|
781
|
+
for (let e of n) {
|
|
782
782
|
if (!e.startsWith("data: ")) continue;
|
|
783
|
-
let t = e.slice(6),
|
|
783
|
+
let t = e.slice(6), n;
|
|
784
784
|
try {
|
|
785
|
-
|
|
785
|
+
n = JSON.parse(t);
|
|
786
786
|
} catch {
|
|
787
787
|
continue;
|
|
788
788
|
}
|
|
789
|
-
if (
|
|
790
|
-
else if (
|
|
791
|
-
else
|
|
789
|
+
if (n.type === "text") b(S, { content: (o.value.find((e) => e.id === S)?.content ?? "") + n.text });
|
|
790
|
+
else if (n.type === "error") throw Error(n.message || "Failed to generate template");
|
|
791
|
+
else n.type === "done" && (n.conversation_id && (f.value = n.conversation_id), b(S, { content: n.text }), x = n.content ?? null, x ? (m.value = r, h.value = x, p.value = S, _.value = !1, i?.(x)) : u.value = "ai_apply_failed");
|
|
792
792
|
}
|
|
793
793
|
}
|
|
794
794
|
} finally {
|
|
@@ -827,25 +827,25 @@ function T(e) {
|
|
|
827
827
|
}
|
|
828
828
|
function E(e) {
|
|
829
829
|
function t(t) {
|
|
830
|
-
return e
|
|
830
|
+
return e !== !1 && e?.[t] !== !1;
|
|
831
831
|
}
|
|
832
832
|
return {
|
|
833
833
|
isFeatureEnabled: t,
|
|
834
|
-
hasAnyMenuFeature:
|
|
834
|
+
hasAnyMenuFeature: a(() => t("chat") || t("scoring") || t("designToTemplate"))
|
|
835
835
|
};
|
|
836
836
|
}
|
|
837
837
|
function D(e) {
|
|
838
|
-
let { authManager: t, getTemplateId:
|
|
839
|
-
async function d(e,
|
|
840
|
-
let s =
|
|
838
|
+
let { authManager: t, getTemplateId: n } = e, i = r(!1), a = r(null), o = r(null), s = r(null), c = r(""), u = r(null);
|
|
839
|
+
async function d(e, r) {
|
|
840
|
+
let s = n();
|
|
841
841
|
if (!s) return null;
|
|
842
842
|
i.value = !0, o.value = null, a.value = null;
|
|
843
843
|
try {
|
|
844
|
-
let
|
|
844
|
+
let n = l(g["ai.score"], {
|
|
845
845
|
project: t.projectId,
|
|
846
846
|
tenant: t.tenantSlug,
|
|
847
847
|
template: s
|
|
848
|
-
}), i = await t.authenticatedFetch(
|
|
848
|
+
}), i = await t.authenticatedFetch(n, {
|
|
849
849
|
method: "POST",
|
|
850
850
|
headers: {
|
|
851
851
|
"Content-Type": "application/json",
|
|
@@ -853,7 +853,7 @@ function D(e) {
|
|
|
853
853
|
},
|
|
854
854
|
body: JSON.stringify({
|
|
855
855
|
current_content: e,
|
|
856
|
-
merge_tags:
|
|
856
|
+
merge_tags: r.map((e) => ({
|
|
857
857
|
label: e.label,
|
|
858
858
|
value: e.value
|
|
859
859
|
}))
|
|
@@ -893,16 +893,16 @@ function D(e) {
|
|
|
893
893
|
i.value = !1;
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
|
-
async function f(e,
|
|
897
|
-
let a =
|
|
896
|
+
async function f(e, r, i) {
|
|
897
|
+
let a = n();
|
|
898
898
|
if (!a) return null;
|
|
899
|
-
s.value =
|
|
899
|
+
s.value = r.id, c.value = "", u.value = null;
|
|
900
900
|
try {
|
|
901
|
-
let
|
|
901
|
+
let n = l(g["ai.fixFinding"], {
|
|
902
902
|
project: t.projectId,
|
|
903
903
|
tenant: t.tenantSlug,
|
|
904
904
|
template: a
|
|
905
|
-
}), o = await t.authenticatedFetch(
|
|
905
|
+
}), o = await t.authenticatedFetch(n, {
|
|
906
906
|
method: "POST",
|
|
907
907
|
headers: {
|
|
908
908
|
"Content-Type": "application/json",
|
|
@@ -911,10 +911,10 @@ function D(e) {
|
|
|
911
911
|
body: JSON.stringify({
|
|
912
912
|
content: e,
|
|
913
913
|
finding: {
|
|
914
|
-
id:
|
|
915
|
-
message:
|
|
916
|
-
suggestion:
|
|
917
|
-
category:
|
|
914
|
+
id: r.id,
|
|
915
|
+
message: r.message,
|
|
916
|
+
suggestion: r.suggestion,
|
|
917
|
+
category: r.category
|
|
918
918
|
},
|
|
919
919
|
merge_tags: i.map((e) => ({
|
|
920
920
|
label: e.label,
|
|
@@ -978,22 +978,22 @@ function D(e) {
|
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
980
|
function O(e) {
|
|
981
|
-
let { authManager: t, getTemplateId:
|
|
981
|
+
let { authManager: t, getTemplateId: n, onApply: i, onError: a } = e, o = r(!1), s = r(null);
|
|
982
982
|
async function c(e) {
|
|
983
|
-
let
|
|
984
|
-
if (!
|
|
983
|
+
let r = n();
|
|
984
|
+
if (!r) throw Error("Template must be saved before using design reference");
|
|
985
985
|
o.value = !0, s.value = null;
|
|
986
986
|
try {
|
|
987
|
-
let
|
|
988
|
-
e.prompt &&
|
|
987
|
+
let n = new FormData();
|
|
988
|
+
e.prompt && n.append("prompt", e.prompt), e.imageUpload && n.append("image_upload", e.imageUpload), e.pdfUpload && n.append("pdf_upload", e.pdfUpload);
|
|
989
989
|
let a = l(g["ai.generateFromDesign"], {
|
|
990
990
|
project: t.projectId,
|
|
991
991
|
tenant: t.tenantSlug,
|
|
992
|
-
template:
|
|
992
|
+
template: r
|
|
993
993
|
}), o = await t.authenticatedFetch(a, {
|
|
994
994
|
method: "POST",
|
|
995
995
|
headers: { Accept: "text/event-stream" },
|
|
996
|
-
body:
|
|
996
|
+
body: n
|
|
997
997
|
});
|
|
998
998
|
if (!o.ok) {
|
|
999
999
|
let e = await o.json().catch(() => null);
|
|
@@ -1039,11 +1039,11 @@ function O(e) {
|
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
1041
|
function k(e) {
|
|
1042
|
-
let { authManager: t, getTemplateId:
|
|
1042
|
+
let { authManager: t, getTemplateId: n, getSocketId: i, onComment: o, onError: s, hasCommentingFeature: c } = e, l = new _(t), u = r([]), d = r(!1), f = r(!1), p = a(() => (c?.() ?? !1) && t.userConfig !== null), m = a(() => {
|
|
1043
1043
|
let e = 0;
|
|
1044
1044
|
for (let t of u.value) e += 1 + (t.replies?.length ?? 0);
|
|
1045
1045
|
return e;
|
|
1046
|
-
}), h =
|
|
1046
|
+
}), h = a(() => u.value.filter((e) => !e.resolved_at).length), g = a(() => {
|
|
1047
1047
|
let e = /* @__PURE__ */ new Map();
|
|
1048
1048
|
for (let t of u.value) t.block_id && e.set(t.block_id, (e.get(t.block_id) ?? 0) + 1 + (t.replies?.length ?? 0));
|
|
1049
1049
|
return e;
|
|
@@ -1058,7 +1058,7 @@ function k(e) {
|
|
|
1058
1058
|
};
|
|
1059
1059
|
}
|
|
1060
1060
|
function y() {
|
|
1061
|
-
let e =
|
|
1061
|
+
let e = i?.();
|
|
1062
1062
|
if (e) return { "X-Socket-ID": e };
|
|
1063
1063
|
}
|
|
1064
1064
|
function b(e, t) {
|
|
@@ -1075,7 +1075,7 @@ function k(e) {
|
|
|
1075
1075
|
return null;
|
|
1076
1076
|
}
|
|
1077
1077
|
async function S() {
|
|
1078
|
-
let e =
|
|
1078
|
+
let e = n();
|
|
1079
1079
|
if (e) {
|
|
1080
1080
|
d.value = !0;
|
|
1081
1081
|
try {
|
|
@@ -1088,22 +1088,22 @@ function k(e) {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
|
-
async function C(e, t,
|
|
1092
|
-
let i =
|
|
1091
|
+
async function C(e, t, r) {
|
|
1092
|
+
let i = n();
|
|
1093
1093
|
if (!i) return null;
|
|
1094
1094
|
f.value = !0;
|
|
1095
1095
|
try {
|
|
1096
|
-
let
|
|
1096
|
+
let n = await l.createComment(i, {
|
|
1097
1097
|
body: e,
|
|
1098
1098
|
block_id: t,
|
|
1099
|
-
parent_id:
|
|
1099
|
+
parent_id: r,
|
|
1100
1100
|
...v()
|
|
1101
1101
|
}, y());
|
|
1102
|
-
if (
|
|
1103
|
-
let e = x(
|
|
1104
|
-
e && (e.replies = [...e.replies ?? [],
|
|
1105
|
-
} else u.value = [...u.value,
|
|
1106
|
-
return b("created",
|
|
1102
|
+
if (r) {
|
|
1103
|
+
let e = x(r);
|
|
1104
|
+
e && (e.replies = [...e.replies ?? [], n]);
|
|
1105
|
+
} else u.value = [...u.value, n];
|
|
1106
|
+
return b("created", n), n;
|
|
1107
1107
|
} catch (e) {
|
|
1108
1108
|
let t = e instanceof Error ? e : Error("Failed to create comment", { cause: e });
|
|
1109
1109
|
return s?.(t), null;
|
|
@@ -1112,15 +1112,15 @@ function k(e) {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
async function w(e, t) {
|
|
1115
|
-
let
|
|
1116
|
-
if (!
|
|
1115
|
+
let r = n();
|
|
1116
|
+
if (!r) return null;
|
|
1117
1117
|
f.value = !0;
|
|
1118
1118
|
try {
|
|
1119
|
-
let
|
|
1119
|
+
let n = await l.updateComment(r, e, {
|
|
1120
1120
|
body: t,
|
|
1121
1121
|
...v()
|
|
1122
1122
|
}, y());
|
|
1123
|
-
return A(e,
|
|
1123
|
+
return A(e, n), b("updated", n), n;
|
|
1124
1124
|
} catch (e) {
|
|
1125
1125
|
let t = e instanceof Error ? e : Error("Failed to update comment", { cause: e });
|
|
1126
1126
|
return s?.(t), null;
|
|
@@ -1129,18 +1129,18 @@ function k(e) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
1131
|
async function T(e) {
|
|
1132
|
-
let t =
|
|
1132
|
+
let t = n();
|
|
1133
1133
|
if (!t) return !1;
|
|
1134
|
-
let
|
|
1135
|
-
if (!
|
|
1134
|
+
let r = x(e);
|
|
1135
|
+
if (!r) return !1;
|
|
1136
1136
|
let i = {
|
|
1137
|
-
...
|
|
1138
|
-
replies: [...
|
|
1137
|
+
...r,
|
|
1138
|
+
replies: [...r.replies ?? []]
|
|
1139
1139
|
};
|
|
1140
1140
|
f.value = !0;
|
|
1141
1141
|
try {
|
|
1142
|
-
if (await l.deleteComment(t, e, v(), y()),
|
|
1143
|
-
let t = x(
|
|
1142
|
+
if (await l.deleteComment(t, e, v(), y()), r.parent_id) {
|
|
1143
|
+
let t = x(r.parent_id);
|
|
1144
1144
|
t && (t.replies = (t.replies ?? []).filter((t) => t.id !== e));
|
|
1145
1145
|
} else u.value = u.value.filter((t) => t.id !== e);
|
|
1146
1146
|
return b("deleted", i), !0;
|
|
@@ -1152,7 +1152,7 @@ function k(e) {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
async function E(e) {
|
|
1155
|
-
let t =
|
|
1155
|
+
let t = n();
|
|
1156
1156
|
if (!t) return null;
|
|
1157
1157
|
f.value = !0;
|
|
1158
1158
|
try {
|
|
@@ -1236,14 +1236,14 @@ function k(e) {
|
|
|
1236
1236
|
applyRemoteDelete: k
|
|
1237
1237
|
};
|
|
1238
1238
|
}
|
|
1239
|
-
function A(
|
|
1240
|
-
let { comments:
|
|
1241
|
-
|
|
1239
|
+
function A(t) {
|
|
1240
|
+
let { comments: r, channel: i } = t;
|
|
1241
|
+
e(i, (e, t) => {
|
|
1242
1242
|
t && t.unbind("comment-broadcast"), e && e.bind("comment-broadcast", (e) => {
|
|
1243
|
-
j(
|
|
1243
|
+
j(r, e);
|
|
1244
1244
|
});
|
|
1245
|
-
}),
|
|
1246
|
-
|
|
1245
|
+
}), n(() => {
|
|
1246
|
+
i.value?.unbind("comment-broadcast");
|
|
1247
1247
|
});
|
|
1248
1248
|
}
|
|
1249
1249
|
function j(e, t) {
|
|
@@ -1286,8 +1286,8 @@ var P = [
|
|
|
1286
1286
|
"#6366f1",
|
|
1287
1287
|
"#14b8a6"
|
|
1288
1288
|
];
|
|
1289
|
-
function F(
|
|
1290
|
-
let { authManager:
|
|
1289
|
+
function F(t) {
|
|
1290
|
+
let { authManager: i, editor: o, channel: s } = t, c = r([]), l = r(/* @__PURE__ */ new Map()), u = 0, d = !1, f = a(() => i.userConfig?.id ?? "");
|
|
1291
1291
|
function p() {
|
|
1292
1292
|
let e = P[u % P.length];
|
|
1293
1293
|
return u++, e;
|
|
@@ -1348,41 +1348,41 @@ function F(e) {
|
|
|
1348
1348
|
function S(e) {
|
|
1349
1349
|
s.value && s.value.trigger("client-block_unlocked", { blockId: e });
|
|
1350
1350
|
}
|
|
1351
|
-
return
|
|
1351
|
+
return e(() => o.state.selectedBlockId, (e, t) => {
|
|
1352
1352
|
d || (t && S(t), e && x(e));
|
|
1353
|
-
}),
|
|
1354
|
-
if (n && N(n), !
|
|
1353
|
+
}), e(s, (e, n) => {
|
|
1354
|
+
if (n && N(n), !e) {
|
|
1355
1355
|
c.value = [], l.value = /* @__PURE__ */ new Map(), u = 0;
|
|
1356
1356
|
return;
|
|
1357
1357
|
}
|
|
1358
|
-
let r =
|
|
1358
|
+
let r = e.members;
|
|
1359
1359
|
r && r.each((e) => {
|
|
1360
1360
|
m(e.info);
|
|
1361
|
-
}),
|
|
1362
|
-
let n = m(
|
|
1363
|
-
n &&
|
|
1364
|
-
}),
|
|
1365
|
-
let n = c.value.find((
|
|
1366
|
-
h(
|
|
1367
|
-
}),
|
|
1368
|
-
g(
|
|
1369
|
-
let n = c.value.find((
|
|
1370
|
-
n &&
|
|
1371
|
-
blockId:
|
|
1361
|
+
}), e.bind("pusher:member_added", (e) => {
|
|
1362
|
+
let n = m(e.info);
|
|
1363
|
+
n && t.onCollaboratorJoined?.(n);
|
|
1364
|
+
}), e.bind("pusher:member_removed", (e) => {
|
|
1365
|
+
let n = c.value.find((t) => t.id === e.id);
|
|
1366
|
+
h(e.id), n && t.onCollaboratorLeft?.(n);
|
|
1367
|
+
}), e.bind("client-block_locked", (e) => {
|
|
1368
|
+
g(e);
|
|
1369
|
+
let n = c.value.find((t) => t.id === e.userId);
|
|
1370
|
+
n && t.onBlockLocked?.({
|
|
1371
|
+
blockId: e.blockId,
|
|
1372
1372
|
collaborator: n
|
|
1373
1373
|
});
|
|
1374
|
-
}),
|
|
1375
|
-
let n = l.value.get(
|
|
1376
|
-
_(
|
|
1377
|
-
blockId:
|
|
1374
|
+
}), e.bind("client-block_unlocked", (e) => {
|
|
1375
|
+
let n = l.value.get(e.blockId);
|
|
1376
|
+
_(e), n && t.onBlockUnlocked?.({
|
|
1377
|
+
blockId: e.blockId,
|
|
1378
1378
|
collaborator: n
|
|
1379
1379
|
});
|
|
1380
|
-
}),
|
|
1380
|
+
}), e.bind("client-operation", (e) => {
|
|
1381
1381
|
v(e);
|
|
1382
|
-
}),
|
|
1382
|
+
}), e.bind("mcp-operation", (e) => {
|
|
1383
1383
|
v(e);
|
|
1384
1384
|
});
|
|
1385
|
-
}),
|
|
1385
|
+
}), n(() => {
|
|
1386
1386
|
s.value && N(s.value);
|
|
1387
1387
|
}), {
|
|
1388
1388
|
collaborators: c,
|
|
@@ -1445,19 +1445,19 @@ function I(e, t) {
|
|
|
1445
1445
|
};
|
|
1446
1446
|
}
|
|
1447
1447
|
function L(e) {
|
|
1448
|
-
let { authManager: t, onError:
|
|
1449
|
-
async function c(e,
|
|
1448
|
+
let { authManager: t, onError: n } = e, i = r(null), a = r(!1), o = null, s = null;
|
|
1449
|
+
async function c(e, r) {
|
|
1450
1450
|
if (o) return;
|
|
1451
1451
|
o = new y({
|
|
1452
1452
|
authManager: t,
|
|
1453
|
-
config:
|
|
1454
|
-
onError:
|
|
1453
|
+
config: r,
|
|
1454
|
+
onError: n
|
|
1455
1455
|
}), await o.connect(), s = `presence-template.${e}`;
|
|
1456
1456
|
let c = o.subscribePresence(s);
|
|
1457
1457
|
c.bind("pusher:subscription_succeeded", () => {
|
|
1458
1458
|
a.value = !0, i.value = c;
|
|
1459
1459
|
}), c.bind("pusher:subscription_error", (e) => {
|
|
1460
|
-
a.value = !1, i.value = null,
|
|
1460
|
+
a.value = !1, i.value = null, n?.(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to subscribe to template channel"));
|
|
1461
1461
|
});
|
|
1462
1462
|
}
|
|
1463
1463
|
function l() {
|
|
@@ -1475,45 +1475,45 @@ function L(e) {
|
|
|
1475
1475
|
};
|
|
1476
1476
|
}
|
|
1477
1477
|
function R(e) {
|
|
1478
|
-
let t = new _(e.authManager),
|
|
1479
|
-
async function a(
|
|
1478
|
+
let t = new _(e.authManager), n = r([]), i = r(!1);
|
|
1479
|
+
async function a(r) {
|
|
1480
1480
|
i.value = !0;
|
|
1481
1481
|
try {
|
|
1482
|
-
|
|
1482
|
+
n.value = await t.listModules(r);
|
|
1483
1483
|
} catch (t) {
|
|
1484
1484
|
throw e.onError?.(t), t;
|
|
1485
1485
|
} finally {
|
|
1486
1486
|
i.value = !1;
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
async function o(
|
|
1489
|
+
async function o(r, i) {
|
|
1490
1490
|
try {
|
|
1491
1491
|
let e = await t.createModule({
|
|
1492
|
-
name:
|
|
1492
|
+
name: r,
|
|
1493
1493
|
content: i
|
|
1494
1494
|
});
|
|
1495
|
-
return
|
|
1495
|
+
return n.value = [e, ...n.value], e;
|
|
1496
1496
|
} catch (t) {
|
|
1497
1497
|
throw e.onError?.(t), t;
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
async function s(
|
|
1500
|
+
async function s(r, i) {
|
|
1501
1501
|
try {
|
|
1502
|
-
let e = await t.updateModule(
|
|
1503
|
-
return
|
|
1502
|
+
let e = await t.updateModule(r, i);
|
|
1503
|
+
return n.value = n.value.map((t) => t.id === r ? e : t), e;
|
|
1504
1504
|
} catch (t) {
|
|
1505
1505
|
throw e.onError?.(t), t;
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
|
-
async function c(
|
|
1508
|
+
async function c(r) {
|
|
1509
1509
|
try {
|
|
1510
|
-
await t.deleteModule(
|
|
1510
|
+
await t.deleteModule(r), n.value = n.value.filter((e) => e.id !== r);
|
|
1511
1511
|
} catch (t) {
|
|
1512
1512
|
throw e.onError?.(t), t;
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
return {
|
|
1516
|
-
modules:
|
|
1516
|
+
modules: n,
|
|
1517
1517
|
isLoading: i,
|
|
1518
1518
|
loadModules: a,
|
|
1519
1519
|
createModule: o,
|
|
@@ -1522,11 +1522,11 @@ function R(e) {
|
|
|
1522
1522
|
};
|
|
1523
1523
|
}
|
|
1524
1524
|
function z(e) {
|
|
1525
|
-
let t = new _(e.authManager),
|
|
1525
|
+
let t = new _(e.authManager), n = r([]), i = r(!1), a = r(!1);
|
|
1526
1526
|
async function o() {
|
|
1527
1527
|
i.value = !0;
|
|
1528
1528
|
try {
|
|
1529
|
-
|
|
1529
|
+
n.value = await t.getSnapshots(e.templateId);
|
|
1530
1530
|
} catch (t) {
|
|
1531
1531
|
throw e.onError?.(t), t;
|
|
1532
1532
|
} finally {
|
|
@@ -1545,22 +1545,22 @@ function z(e) {
|
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
1547
|
return {
|
|
1548
|
-
snapshots:
|
|
1548
|
+
snapshots: n,
|
|
1549
1549
|
isLoading: i,
|
|
1550
1550
|
isRestoring: a,
|
|
1551
1551
|
loadSnapshots: o,
|
|
1552
1552
|
restoreSnapshot: s
|
|
1553
1553
|
};
|
|
1554
1554
|
}
|
|
1555
|
-
function B(
|
|
1556
|
-
let { authManager:
|
|
1557
|
-
l &&
|
|
1558
|
-
e && (m.value =
|
|
1555
|
+
function B(t) {
|
|
1556
|
+
let { authManager: n, getTemplateId: i, save: o, exportHtml: s, onError: c, isAuthReady: l, onBeforeTestEmail: u } = t, d = new _(n), f = r(!1), p = r(null), m = r(null);
|
|
1557
|
+
l && e(l, (e) => {
|
|
1558
|
+
e && (m.value = n.testEmailConfig);
|
|
1559
1559
|
}, { immediate: !0 });
|
|
1560
|
-
let h =
|
|
1560
|
+
let h = a(() => m.value !== null), g = a(() => m.value?.allowedEmails ?? []);
|
|
1561
1561
|
async function v(e) {
|
|
1562
1562
|
if (!m.value) throw Error("Test email is not enabled for this project");
|
|
1563
|
-
let t =
|
|
1563
|
+
let t = i();
|
|
1564
1564
|
if (!t) throw Error("Template must be saved before sending a test email");
|
|
1565
1565
|
f.value = !0, p.value = null;
|
|
1566
1566
|
try {
|
|
@@ -1613,24 +1613,24 @@ function V(e) {
|
|
|
1613
1613
|
};
|
|
1614
1614
|
}
|
|
1615
1615
|
function H(e) {
|
|
1616
|
-
let { authManager: t, onError:
|
|
1616
|
+
let { authManager: t, onError: n } = e, i = r(null), o = r(!1), s = new _(t), c = a(() => i.value?.features ?? null);
|
|
1617
1617
|
function l(e) {
|
|
1618
|
-
return
|
|
1618
|
+
return i.value?.features[e] ?? !1;
|
|
1619
1619
|
}
|
|
1620
1620
|
async function u() {
|
|
1621
1621
|
if (!o.value) {
|
|
1622
1622
|
o.value = !0;
|
|
1623
1623
|
try {
|
|
1624
|
-
|
|
1624
|
+
i.value = await s.fetchConfig();
|
|
1625
1625
|
} catch (e) {
|
|
1626
|
-
|
|
1626
|
+
n?.(e instanceof Error ? e : Error("Failed to fetch config", { cause: e }));
|
|
1627
1627
|
} finally {
|
|
1628
1628
|
o.value = !1;
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
1632
|
return {
|
|
1633
|
-
config:
|
|
1633
|
+
config: i,
|
|
1634
1634
|
isLoading: o,
|
|
1635
1635
|
hasFeature: l,
|
|
1636
1636
|
features: c,
|
|
@@ -1738,9 +1738,9 @@ async function q(e = {}) {
|
|
|
1738
1738
|
overall: t.api.ok && t.auth.ok
|
|
1739
1739
|
};
|
|
1740
1740
|
}
|
|
1741
|
-
function J(
|
|
1742
|
-
let { editor: n, channel: r, onOperation: i } =
|
|
1743
|
-
|
|
1741
|
+
function J(t) {
|
|
1742
|
+
let { editor: n, channel: r, onOperation: i } = t;
|
|
1743
|
+
e(r, (e, t) => {
|
|
1744
1744
|
t && t.unbind("mcp-operation"), e && e.bind("mcp-operation", (e) => {
|
|
1745
1745
|
b(n, e), i?.(e);
|
|
1746
1746
|
});
|