@commentkit/comment-kit 0.7.5 → 0.7.6
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/CHANGELOG.md +14 -1
- package/README.md +1 -1
- package/dist/angular.es.js +2 -2
- package/dist/comment-kit.es.js +3 -3
- package/dist/demo.es.js +2 -2
- package/dist/headless.es.js +2 -2
- package/dist/preact.es.js +2 -2
- package/dist/qwik.qwik.mjs +2 -2
- package/dist/react.es.js +2 -2
- package/dist/shared/{annotation-toolbar-DgqxkHy8.js → annotation-toolbar-RSrb0Nku.js} +110 -109
- package/dist/shared/{attachment-refresh-DRX7dKDI.js → attachment-refresh-CSTYwRW-.js} +1 -1
- package/dist/shared/{comment-drawing-canvas-hSdcLShI.js → comment-drawing-canvas-DbuXP54N.js} +2 -2
- package/dist/shared/{comment-image-lightbox-4zroOCCG.js → comment-image-lightbox-zlIGEVA-.js} +2 -2
- package/dist/shared/{comment-images-content-D4hTya6e.js → comment-images-content-aYbJb79_.js} +13 -13
- package/dist/shared/{comment-kit-core-D068rcdY.js → comment-kit-core-B0k7XsMz.js} +378 -346
- package/dist/shared/{comment-kit-ui-BDzNt0jv.js → comment-kit-ui-BXLJcZYQ.js} +5255 -5487
- package/dist/shared/{comment-screenshot-annotator-BGnu_NgP.js → comment-screenshot-annotator-ChWwYJzO.js} +2 -2
- package/dist/shared/{comment-screenshot-overlay-BCRmojWB.js → comment-screenshot-overlay-Bufg3rHz.js} +5 -5
- package/dist/shared/{dev-export-panel-CYmUKmIV.js → dev-export-panel-DAZenvgD.js} +4 -4
- package/dist/shared/{dev-grab-BYsCpsGI.js → dev-grab-O8q25zar.js} +2 -2
- package/dist/shared/{element-selector-79Oo5pit.js → element-selector-CYkwzfEr.js} +349 -347
- package/dist/shared/input-UPtAj0M6.js +111 -0
- package/dist/shared/{mount-ui-DuHk132g.js → mount-ui-BKaWBhKq.js} +4 -4
- package/dist/shared/{pusher-3jyUauYd.js → pusher-BUaiCkDJ.js} +1 -1
- package/dist/shared/{realtime-DspH16g5.js → realtime-C0Z8dXXH.js} +2 -2
- package/dist/shared/{screenshot-BIuEaRiu.js → screenshot-B-ZfFItT.js} +1 -1
- package/dist/shared/{shadow-root-3-yGIhMs.js → shadow-root-Cd3SLHyj.js} +1 -1
- package/dist/shared/{token-session-_Pi4fOEi.js → token-session-DplW5QDx.js} +2 -2
- package/dist/shared/useLabelableId-8n0QmH8N.js +154 -0
- package/dist/shared/{websocket-manager-CvgZSo_L.js → websocket-manager-798cRDyL.js} +2 -2
- package/dist/solid.es.js +2 -2
- package/dist/svelte.es.js +2 -2
- package/dist/types/core/api-client.d.ts +2 -0
- package/dist/types/core/comment-kit-core.d.ts +4 -2
- package/dist/types/core/types.d.ts +12 -5
- package/dist/types/core/write-access.d.ts +2 -0
- package/dist/vue.es.js +2 -2
- package/docs/api-reference.md +1 -1
- package/package.json +1 -1
|
@@ -110,10 +110,10 @@ function _e(e, t) {
|
|
|
110
110
|
}
|
|
111
111
|
var ve = class {
|
|
112
112
|
constructor(e) {
|
|
113
|
-
this.projectId = null, this.channelProjectId = null, this.userEmail = null, this.authToken = null, this.authRevision = 0, this.environment = null, this.onAuthExpired = null, this.baseUrl = me(e.baseUrl), this.apiKey = e.apiKey, this.projectId = e.projectId || null, this.channelProjectId = this.projectId, this.environment = e.environment || null;
|
|
113
|
+
this.projectId = null, this.channelProjectId = null, this.userEmail = null, this.authToken = null, this.authRevision = 0, this.pendingInvite = null, this.inviteRevision = 0, this.environment = null, this.onAuthExpired = null, this.baseUrl = me(e.baseUrl), this.apiKey = e.apiKey, this.projectId = e.projectId || null, this.channelProjectId = this.projectId, this.environment = e.environment || null;
|
|
114
114
|
}
|
|
115
115
|
setProject(e, t = e) {
|
|
116
|
-
this.projectId = String(e).trim(), this.channelProjectId = String(t).trim();
|
|
116
|
+
this.projectId !== String(e).trim() && (this.pendingInvite = null, this.inviteRevision++), this.projectId = String(e).trim(), this.channelProjectId = String(t).trim();
|
|
117
117
|
}
|
|
118
118
|
setUserEmail(e) {
|
|
119
119
|
this.userEmail = e ? C(e) : null;
|
|
@@ -121,7 +121,7 @@ var ve = class {
|
|
|
121
121
|
setAuthToken(e) {
|
|
122
122
|
if (e && (a(e) || e.length > ce)) throw new E("invalid_token", "A valid auth token is required", 400);
|
|
123
123
|
let t = e?.trim() || null;
|
|
124
|
-
this.authToken = t, this.authRevision++;
|
|
124
|
+
this.authToken = t, this.pendingInvite = null, this.inviteRevision++, this.authRevision++;
|
|
125
125
|
}
|
|
126
126
|
setEnvironment(e) {
|
|
127
127
|
this.environment = e;
|
|
@@ -249,7 +249,10 @@ var ve = class {
|
|
|
249
249
|
let t = C(e);
|
|
250
250
|
return this.request("/auth/otp/request", {
|
|
251
251
|
method: "POST",
|
|
252
|
-
body: JSON.stringify({
|
|
252
|
+
body: JSON.stringify({
|
|
253
|
+
email: t,
|
|
254
|
+
...this.pendingInvite?.email === t ? { invitation_challenge: this.pendingInvite.challenge } : {}
|
|
255
|
+
})
|
|
253
256
|
});
|
|
254
257
|
}
|
|
255
258
|
async verifyOtp(e, t) {
|
|
@@ -274,13 +277,18 @@ var ve = class {
|
|
|
274
277
|
}
|
|
275
278
|
async validateInvite(e, t) {
|
|
276
279
|
let n = ge(e), r = C(t);
|
|
277
|
-
|
|
280
|
+
this.pendingInvite = null;
|
|
281
|
+
let i = ++this.inviteRevision, a = await this.request("/auth/validate-invite", {
|
|
278
282
|
method: "POST",
|
|
279
283
|
body: JSON.stringify({
|
|
280
284
|
token: n,
|
|
281
285
|
email: r
|
|
282
286
|
})
|
|
283
287
|
});
|
|
288
|
+
return i === this.inviteRevision && a.success && a.invitationChallenge && (this.pendingInvite = {
|
|
289
|
+
email: r,
|
|
290
|
+
challenge: a.invitationChallenge
|
|
291
|
+
}), a;
|
|
284
292
|
}
|
|
285
293
|
async getComments(e, t = "all", n = 1, r = 50, i, a, o) {
|
|
286
294
|
let s = this.requireProjectId(), c = new URLSearchParams();
|
|
@@ -516,19 +524,19 @@ var E = class extends Error {
|
|
|
516
524
|
isPremiumFeatureError() {
|
|
517
525
|
return this.code === 402;
|
|
518
526
|
}
|
|
519
|
-
},
|
|
520
|
-
function
|
|
521
|
-
return
|
|
527
|
+
}, D = null, xe = 0, Se = 3;
|
|
528
|
+
function Ce() {
|
|
529
|
+
return D || (D = (async () => {
|
|
522
530
|
try {
|
|
523
531
|
let e = await import("element-source");
|
|
524
532
|
return typeof e?.resolveElementInfo == "function" ? e : null;
|
|
525
533
|
} catch {
|
|
526
|
-
return
|
|
534
|
+
return xe += 1, xe < Se && (D = null), null;
|
|
527
535
|
}
|
|
528
|
-
})(),
|
|
536
|
+
})(), D);
|
|
529
537
|
}
|
|
530
|
-
async function
|
|
531
|
-
let t = await
|
|
538
|
+
async function we(e) {
|
|
539
|
+
let t = await Ce();
|
|
532
540
|
if (!t) return null;
|
|
533
541
|
try {
|
|
534
542
|
return await t.resolveElementInfo(e);
|
|
@@ -536,27 +544,27 @@ async function Te(e) {
|
|
|
536
544
|
return null;
|
|
537
545
|
}
|
|
538
546
|
}
|
|
539
|
-
var
|
|
540
|
-
function
|
|
547
|
+
var Te = 200, Ee = 500, De = 500, Oe = 2e3, ke = "application/x-commentkit-agent-context", Ae = "Address the UI feedback in this context.";
|
|
548
|
+
function je(e) {
|
|
541
549
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
542
550
|
}
|
|
543
|
-
function
|
|
544
|
-
return e === void 0 ?
|
|
551
|
+
function Me(e) {
|
|
552
|
+
return e === void 0 ? Te : !Number.isFinite(e) || e <= 0 ? 0 : Math.min(Ee, Math.floor(e));
|
|
545
553
|
}
|
|
546
|
-
function
|
|
554
|
+
function Ne(e) {
|
|
547
555
|
return {
|
|
548
556
|
id: e.id,
|
|
549
557
|
name: e.name,
|
|
550
558
|
email: e.email
|
|
551
559
|
};
|
|
552
560
|
}
|
|
553
|
-
function
|
|
561
|
+
function Pe(e, t) {
|
|
554
562
|
return e.page.path === t.path || e.page.url === t.url;
|
|
555
563
|
}
|
|
556
|
-
function
|
|
557
|
-
return !(!n.includeResolved && e.status !== "open" || n.currentPageOnly && !
|
|
564
|
+
function Fe(e, t, n, r) {
|
|
565
|
+
return !(!n.includeResolved && e.status !== "open" || n.currentPageOnly && !Pe(e, t) || r && !r.has(e.id));
|
|
558
566
|
}
|
|
559
|
-
function
|
|
567
|
+
function Ie(e) {
|
|
560
568
|
let t = e.getBoundingClientRect();
|
|
561
569
|
return {
|
|
562
570
|
top: t.top,
|
|
@@ -565,7 +573,7 @@ function Le(e) {
|
|
|
565
573
|
height: t.height
|
|
566
574
|
};
|
|
567
575
|
}
|
|
568
|
-
function
|
|
576
|
+
function Le(e, t, n) {
|
|
569
577
|
let r = n ? p(e.element ?? "", e.xpath) : null, i = {
|
|
570
578
|
...e.element ? { selector: e.element } : {},
|
|
571
579
|
...e.xpath ? { xpath: e.xpath } : {}
|
|
@@ -574,7 +582,7 @@ function Re(e, t, n) {
|
|
|
574
582
|
...i,
|
|
575
583
|
found: !1
|
|
576
584
|
};
|
|
577
|
-
let a = h(r), o = y(a.text,
|
|
585
|
+
let a = h(r), o = y(a.text, De), s = t ? y(a.html, Oe) : "", c = r.getAttribute("class"), l = r.getAttribute("role"), u = r.getAttribute("aria-label");
|
|
578
586
|
return {
|
|
579
587
|
...i,
|
|
580
588
|
found: !0,
|
|
@@ -584,28 +592,28 @@ function Re(e, t, n) {
|
|
|
584
592
|
...l ? { role: l } : {},
|
|
585
593
|
...u ? { ariaLabel: u } : {},
|
|
586
594
|
...o ? { text: o } : {},
|
|
587
|
-
rect:
|
|
595
|
+
rect: Ie(r),
|
|
588
596
|
...s ? { htmlPreview: s } : {}
|
|
589
597
|
};
|
|
590
598
|
}
|
|
591
|
-
function
|
|
599
|
+
function Re(e) {
|
|
592
600
|
return {
|
|
593
601
|
id: e.id,
|
|
594
602
|
content: e.content,
|
|
595
|
-
author:
|
|
603
|
+
author: Ne(e.author),
|
|
596
604
|
createdAt: e.createdAt,
|
|
597
605
|
isEdited: e.isEdited,
|
|
598
606
|
replyTo: e.replyTo,
|
|
599
607
|
mentions: e.mentions,
|
|
600
608
|
reactions: e.reactions,
|
|
601
|
-
attachments: e.attachments?.map(
|
|
609
|
+
attachments: e.attachments?.map(O)
|
|
602
610
|
};
|
|
603
611
|
}
|
|
604
|
-
function
|
|
612
|
+
function ze(e) {
|
|
605
613
|
return e && e.length <= 4096 && !/[?#]/.test(e) && /^https?:\/\//i.test(e) && d(e) ? e : void 0;
|
|
606
614
|
}
|
|
607
|
-
function
|
|
608
|
-
let { id: t, type: n, filename: r, mimeType: i, size: a } = e, o =
|
|
615
|
+
function O(e) {
|
|
616
|
+
let { id: t, type: n, filename: r, mimeType: i, size: a } = e, o = ze(e.url);
|
|
609
617
|
return {
|
|
610
618
|
id: t,
|
|
611
619
|
type: n,
|
|
@@ -615,22 +623,22 @@ function D(e) {
|
|
|
615
623
|
...o ? { url: o } : { inlineContentOmitted: !0 }
|
|
616
624
|
};
|
|
617
625
|
}
|
|
618
|
-
function
|
|
619
|
-
let r = e.attachments.map(
|
|
626
|
+
function Be(e, t, n) {
|
|
627
|
+
let r = e.attachments.map(O), i = r.find((e) => e.type === "screenshot" && e.url)?.url;
|
|
620
628
|
return {
|
|
621
629
|
id: e.id,
|
|
622
630
|
type: e.type,
|
|
623
631
|
status: e.status,
|
|
624
632
|
priority: e.priority,
|
|
625
633
|
content: e.content,
|
|
626
|
-
author:
|
|
634
|
+
author: Ne(e.author),
|
|
627
635
|
createdAt: e.createdAt,
|
|
628
636
|
updatedAt: e.updatedAt,
|
|
629
637
|
environment: e.environment,
|
|
630
638
|
branch: e.branch,
|
|
631
639
|
deviceInfo: e.deviceInfo,
|
|
632
640
|
description: e.description,
|
|
633
|
-
assignees: e.assignees?.map(
|
|
641
|
+
assignees: e.assignees?.map(Ne),
|
|
634
642
|
mentions: e.mentions,
|
|
635
643
|
checklist: e.checklist,
|
|
636
644
|
reactions: e.reactions,
|
|
@@ -646,13 +654,13 @@ function Ve(e, t, n) {
|
|
|
646
654
|
textSelection: e.textSelection,
|
|
647
655
|
drawingData: e.drawingData,
|
|
648
656
|
attachments: r,
|
|
649
|
-
element:
|
|
657
|
+
element: Le(e.position, t.includeHtml === !0, Pe(e, n)),
|
|
650
658
|
...i ? { screenshotUrl: i } : {},
|
|
651
659
|
repliesCount: e.repliesCount ?? e.replies.length,
|
|
652
|
-
replies: e.replies.map(
|
|
660
|
+
replies: e.replies.map(Re)
|
|
653
661
|
};
|
|
654
662
|
}
|
|
655
|
-
function
|
|
663
|
+
function Ve(e) {
|
|
656
664
|
return {
|
|
657
665
|
filePath: e.filePath,
|
|
658
666
|
lineNumber: e.lineNumber,
|
|
@@ -660,16 +668,16 @@ function He(e) {
|
|
|
660
668
|
componentName: e.componentName
|
|
661
669
|
};
|
|
662
670
|
}
|
|
663
|
-
function
|
|
671
|
+
function k(e, t = {}) {
|
|
664
672
|
let n = m(), r = {
|
|
665
673
|
url: n.url,
|
|
666
674
|
path: n.path,
|
|
667
675
|
title: n.title
|
|
668
|
-
}, i = t.commentIds?.length ? new Set(t.commentIds) : null, a =
|
|
676
|
+
}, i = t.commentIds?.length ? new Set(t.commentIds) : null, a = Me(t.maxComments), o = e.comments.filter((e) => Fe(e, r, t, i)), s = o.slice(0, a).map((e) => Be(e, t, r));
|
|
669
677
|
return {
|
|
670
678
|
version: 1,
|
|
671
679
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
672
|
-
instructions: v(t.instructions, 2e3) ||
|
|
680
|
+
instructions: v(t.instructions, 2e3) || Ae,
|
|
673
681
|
page: {
|
|
674
682
|
...r,
|
|
675
683
|
url: _(r.url),
|
|
@@ -694,15 +702,15 @@ function O(e, t = {}) {
|
|
|
694
702
|
sourceResolved: !1
|
|
695
703
|
};
|
|
696
704
|
}
|
|
697
|
-
async function
|
|
705
|
+
async function He(e) {
|
|
698
706
|
let t = !1, n = await Promise.all(e.comments.map(async (e) => {
|
|
699
707
|
if (!e.element.found) return e;
|
|
700
708
|
let n = p(e.element.selector ?? "", e.element.xpath);
|
|
701
709
|
if (!n || g(n)) return e;
|
|
702
|
-
let r = await
|
|
710
|
+
let r = await we(n);
|
|
703
711
|
if (!r || !r.source) return e;
|
|
704
712
|
t = !0;
|
|
705
|
-
let i =
|
|
713
|
+
let i = Ve(r.source), a = r.stack.map(Ve), o = r.componentName ?? void 0;
|
|
706
714
|
return {
|
|
707
715
|
...e,
|
|
708
716
|
element: {
|
|
@@ -719,8 +727,8 @@ async function Ue(e) {
|
|
|
719
727
|
sourceResolved: t
|
|
720
728
|
};
|
|
721
729
|
}
|
|
722
|
-
function
|
|
723
|
-
let t =
|
|
730
|
+
function A(e) {
|
|
731
|
+
let t = Ue(e);
|
|
724
732
|
return [
|
|
725
733
|
"# CommentKit Agent Context",
|
|
726
734
|
"",
|
|
@@ -736,7 +744,7 @@ function k(e) {
|
|
|
736
744
|
"```"
|
|
737
745
|
].join("\n");
|
|
738
746
|
}
|
|
739
|
-
function
|
|
747
|
+
function Ue(e) {
|
|
740
748
|
let t = 2e3, n = (e) => e.length > t ? `${e.slice(0, t)}… [clipped]` : e;
|
|
741
749
|
return {
|
|
742
750
|
version: e.version,
|
|
@@ -785,7 +793,7 @@ function We(e) {
|
|
|
785
793
|
width: e.width,
|
|
786
794
|
height: e.height,
|
|
787
795
|
...e.text ? { text: y(e.text, 200) } : {},
|
|
788
|
-
...e.d ? { bounds:
|
|
796
|
+
...e.d ? { bounds: We(e.d) } : {}
|
|
789
797
|
})),
|
|
790
798
|
...e.drawingData.paths.length > 12 ? { omittedPaths: e.drawingData.paths.length - 12 } : {}
|
|
791
799
|
} } : {},
|
|
@@ -794,7 +802,7 @@ function We(e) {
|
|
|
794
802
|
label: e,
|
|
795
803
|
done: t
|
|
796
804
|
})) } : {},
|
|
797
|
-
...e.attachments?.length ? { attachments: e.attachments.map(
|
|
805
|
+
...e.attachments?.length ? { attachments: e.attachments.map(O) } : {},
|
|
798
806
|
replyCount: e.repliesCount ?? e.replies.length,
|
|
799
807
|
...(e.repliesCount ?? e.replies.length) > Math.min(12, e.replies.length) ? { omittedReplies: (e.repliesCount ?? e.replies.length) - Math.min(12, e.replies.length) } : {},
|
|
800
808
|
replies: e.replies.slice(-12).map((e) => ({
|
|
@@ -806,12 +814,12 @@ function We(e) {
|
|
|
806
814
|
type: e.replyTo.type,
|
|
807
815
|
body: e.replyTo.body
|
|
808
816
|
} } : {},
|
|
809
|
-
...e.attachments?.length ? { attachments: e.attachments.map(
|
|
817
|
+
...e.attachments?.length ? { attachments: e.attachments.map(O) } : {}
|
|
810
818
|
}))
|
|
811
819
|
}))
|
|
812
820
|
};
|
|
813
821
|
}
|
|
814
|
-
function
|
|
822
|
+
function We(e) {
|
|
815
823
|
let t = [...e.matchAll(/[ML]\s*(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)/gi)];
|
|
816
824
|
if (!t.length) return null;
|
|
817
825
|
let n = t.map((e) => Number(e[1])), r = t.map((e) => Number(e[2]));
|
|
@@ -822,18 +830,18 @@ function Ge(e) {
|
|
|
822
830
|
height: Math.max(...r) - Math.min(...r)
|
|
823
831
|
};
|
|
824
832
|
}
|
|
825
|
-
function
|
|
833
|
+
function Ge(e) {
|
|
826
834
|
return {
|
|
827
835
|
version: e?.version ?? 1,
|
|
828
836
|
generatedAt: e?.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
829
837
|
commentCount: e?.comments.length ?? 0,
|
|
830
|
-
context: e ?
|
|
838
|
+
context: e ? Ue(e) : null
|
|
831
839
|
};
|
|
832
840
|
}
|
|
833
|
-
function
|
|
841
|
+
function Ke(e, t) {
|
|
834
842
|
if (typeof document > "u" || !document.body || typeof document.execCommand != "function") return !1;
|
|
835
843
|
let n = JSON.stringify(t), r = (t) => {
|
|
836
|
-
t.preventDefault(), t.clipboardData?.setData("text/plain", e), t.clipboardData?.setData("text/html", `<meta charset="utf-8"><pre><code>${
|
|
844
|
+
t.preventDefault(), t.clipboardData?.setData("text/plain", e), t.clipboardData?.setData("text/html", `<meta charset="utf-8"><pre><code>${je(e)}</code></pre>`), t.clipboardData?.setData(ke, n);
|
|
837
845
|
}, i = document.createElement("textarea");
|
|
838
846
|
i.value = e, i.setAttribute("readonly", ""), i.setAttribute("aria-hidden", "true"), i.style.position = "fixed", i.style.left = "-9999px", document.addEventListener("copy", r), document.body.appendChild(i), i.select();
|
|
839
847
|
try {
|
|
@@ -842,10 +850,10 @@ function qe(e, t) {
|
|
|
842
850
|
document.removeEventListener("copy", r), i.remove();
|
|
843
851
|
}
|
|
844
852
|
}
|
|
845
|
-
async function
|
|
853
|
+
async function qe(e, t) {
|
|
846
854
|
if (typeof navigator > "u" || typeof navigator.clipboard?.write != "function" || typeof ClipboardItem > "u") return !1;
|
|
847
855
|
try {
|
|
848
|
-
let n = new Blob([`<meta charset="utf-8"><pre><code>${
|
|
856
|
+
let n = new Blob([`<meta charset="utf-8"><pre><code>${je(e)}</code></pre>`], { type: "text/html" }), r = new Blob([e], { type: "text/plain" }), i = t.type && t.type.startsWith("image/") ? t.type : "image/png";
|
|
849
857
|
return await navigator.clipboard.write([new ClipboardItem({
|
|
850
858
|
"text/plain": r,
|
|
851
859
|
"text/html": n,
|
|
@@ -855,43 +863,45 @@ async function Je(e, t) {
|
|
|
855
863
|
return !1;
|
|
856
864
|
}
|
|
857
865
|
}
|
|
858
|
-
async function
|
|
859
|
-
return t && await
|
|
866
|
+
async function Je(e, t) {
|
|
867
|
+
return t && await qe(e, t) ? !0 : (await Ye(e), !1);
|
|
860
868
|
}
|
|
861
|
-
async function
|
|
862
|
-
if (!
|
|
869
|
+
async function Ye(e, t = null) {
|
|
870
|
+
if (!Ke(e, Ge(t))) {
|
|
863
871
|
if (typeof navigator < "u" && typeof navigator.clipboard?.writeText == "function") await navigator.clipboard.writeText(e);
|
|
864
872
|
else throw Error("Clipboard is unavailable");
|
|
865
873
|
}
|
|
866
874
|
}
|
|
867
|
-
function
|
|
875
|
+
function Xe(e, t, n = null) {
|
|
868
876
|
let r = t.projectContext, i = n ?? (r?.permissions.canWriteComments === !1 ? r.permissions.writeRestriction ?? (r.organization?.plan === "none" ? "plan_required" : "feature_disabled") : null), a = i === "plan_required", o = !i && e.features?.comments !== !1;
|
|
869
877
|
return {
|
|
870
878
|
canWrite: o,
|
|
871
879
|
canManageComments: o && (r?.permissions.canManageComments ?? !1),
|
|
880
|
+
canTriage: o ? r?.permissions.canTriage : !1,
|
|
881
|
+
canComplete: o && r?.permissions.canComplete !== !1,
|
|
872
882
|
planRequired: a,
|
|
873
883
|
message: o ? "" : a ? "This workspace is read-only. An active plan is required to add or change feedback. You can still read and export comments." : "Comment changes are disabled for this project. You can still read and export comments."
|
|
874
884
|
};
|
|
875
885
|
}
|
|
876
|
-
function
|
|
886
|
+
function j() {
|
|
877
887
|
for (let e of document.querySelectorAll("dialog:modal,[aria-modal=true]:is(dialog,[role$=dialog])")) if (e.getClientRects().length && getComputedStyle(e).visibility === "visible") return !0;
|
|
878
888
|
return !1;
|
|
879
889
|
}
|
|
880
|
-
var
|
|
881
|
-
function
|
|
890
|
+
var Ze = 100, Qe = () => {};
|
|
891
|
+
function $e(e) {
|
|
882
892
|
return typeof e == "function";
|
|
883
893
|
}
|
|
884
|
-
var
|
|
894
|
+
var et = class {
|
|
885
895
|
constructor() {
|
|
886
896
|
this.listeners = /* @__PURE__ */ new Map(), this.onceWrappers = /* @__PURE__ */ new Map();
|
|
887
897
|
}
|
|
888
898
|
on(e, t) {
|
|
889
|
-
if (
|
|
899
|
+
if (!$e(t)) return console.warn(`[CommentKit] Ignoring non-function listener for '${String(e)}'`), Qe;
|
|
890
900
|
let n = this.listeners.get(e);
|
|
891
|
-
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), !n.has(t) && n.size >=
|
|
901
|
+
return n || (n = /* @__PURE__ */ new Set(), this.listeners.set(e, n)), !n.has(t) && n.size >= Ze && console.warn(`[CommentKit] Max listeners (${Ze}) reached for '${String(e)}' - possible memory leak`), n.add(t), () => this.off(e, t);
|
|
892
902
|
}
|
|
893
903
|
off(e, t) {
|
|
894
|
-
if (
|
|
904
|
+
if (!$e(t)) return;
|
|
895
905
|
let n = this.listeners.get(e);
|
|
896
906
|
if (n) {
|
|
897
907
|
n.delete(t);
|
|
@@ -908,7 +918,7 @@ var tt = class {
|
|
|
908
918
|
}
|
|
909
919
|
}
|
|
910
920
|
once(e, t) {
|
|
911
|
-
if (
|
|
921
|
+
if (!$e(t)) return console.warn(`[CommentKit] Ignoring non-function listener for '${String(e)}'`), Qe;
|
|
912
922
|
let n = (n) => {
|
|
913
923
|
this.off(e, t), t(n);
|
|
914
924
|
}, r = this.onceWrappers.get(e);
|
|
@@ -920,7 +930,7 @@ var tt = class {
|
|
|
920
930
|
listenerCount(e) {
|
|
921
931
|
return this.listeners.get(e)?.size ?? 0;
|
|
922
932
|
}
|
|
923
|
-
},
|
|
933
|
+
}, tt = Symbol(), M = Object.freeze({
|
|
924
934
|
ID: 256,
|
|
925
935
|
CONTENT: 1e4,
|
|
926
936
|
REPLY_CONTENT: 5e3,
|
|
@@ -945,39 +955,39 @@ var tt = class {
|
|
|
945
955
|
REACTION_COUNT: 1e6,
|
|
946
956
|
PENDING_MUTATIONS: 1e3,
|
|
947
957
|
RETRY_DELAY: 3e4
|
|
948
|
-
}),
|
|
949
|
-
function
|
|
958
|
+
}), nt = "commentkit:session:", rt = 4096;
|
|
959
|
+
function it() {
|
|
950
960
|
try {
|
|
951
961
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
952
962
|
} catch {
|
|
953
963
|
return null;
|
|
954
964
|
}
|
|
955
965
|
}
|
|
956
|
-
function
|
|
957
|
-
return `${
|
|
966
|
+
function N(e) {
|
|
967
|
+
return `${nt}${e}`;
|
|
958
968
|
}
|
|
959
|
-
function
|
|
960
|
-
return o(e) && r(e.id,
|
|
969
|
+
function at(e) {
|
|
970
|
+
return o(e) && r(e.id, M.ID) && r(e.name, M.NAME) && typeof e.email == "string" && s(e.email, M.EMAIL);
|
|
961
971
|
}
|
|
962
|
-
function
|
|
963
|
-
return o(e) && r(e.token,
|
|
972
|
+
function ot(e) {
|
|
973
|
+
return o(e) && r(e.token, rt) && typeof e.email == "string" && s(e.email, M.EMAIL) && at(e.user);
|
|
964
974
|
}
|
|
965
|
-
function
|
|
975
|
+
function st(e, t) {
|
|
966
976
|
if (!e) return;
|
|
967
|
-
let n =
|
|
977
|
+
let n = it();
|
|
968
978
|
if (n) try {
|
|
969
|
-
n.setItem(
|
|
979
|
+
n.setItem(N(e), JSON.stringify(t));
|
|
970
980
|
} catch {}
|
|
971
981
|
}
|
|
972
|
-
function
|
|
982
|
+
function ct(e) {
|
|
973
983
|
if (!e) return null;
|
|
974
|
-
let t =
|
|
984
|
+
let t = it();
|
|
975
985
|
if (!t) return null;
|
|
976
986
|
try {
|
|
977
|
-
let n = t.getItem(
|
|
987
|
+
let n = t.getItem(N(e));
|
|
978
988
|
if (!n) return null;
|
|
979
989
|
let r = JSON.parse(n);
|
|
980
|
-
return
|
|
990
|
+
return ot(r) ? {
|
|
981
991
|
token: r.token.trim(),
|
|
982
992
|
email: r.email.trim(),
|
|
983
993
|
user: {
|
|
@@ -986,19 +996,19 @@ function lt(e) {
|
|
|
986
996
|
email: r.user.email.trim(),
|
|
987
997
|
...r.user.avatar ? { avatar: r.user.avatar } : {}
|
|
988
998
|
}
|
|
989
|
-
} : (t.removeItem(
|
|
999
|
+
} : (t.removeItem(N(e)), null);
|
|
990
1000
|
} catch {
|
|
991
1001
|
return null;
|
|
992
1002
|
}
|
|
993
1003
|
}
|
|
994
|
-
function
|
|
1004
|
+
function lt(e) {
|
|
995
1005
|
if (!e) return;
|
|
996
|
-
let t =
|
|
1006
|
+
let t = it();
|
|
997
1007
|
if (t) try {
|
|
998
|
-
t.removeItem(
|
|
1008
|
+
t.removeItem(N(e));
|
|
999
1009
|
} catch {}
|
|
1000
1010
|
}
|
|
1001
|
-
function
|
|
1011
|
+
function ut(e, t) {
|
|
1002
1012
|
for (let n of e.getState().pendingMutations) e.emit("offline:failed", {
|
|
1003
1013
|
id: n.id,
|
|
1004
1014
|
error: {
|
|
@@ -1008,36 +1018,36 @@ function dt(e, t) {
|
|
|
1008
1018
|
}
|
|
1009
1019
|
});
|
|
1010
1020
|
}
|
|
1011
|
-
var
|
|
1012
|
-
function
|
|
1021
|
+
var dt = M.EMAIL, ft = M.NAME, pt = M.ID, mt = 4096, ht = 6;
|
|
1022
|
+
function gt(e) {
|
|
1013
1023
|
if (typeof e != "string") return null;
|
|
1014
1024
|
let t = e.trim();
|
|
1015
|
-
return s(t,
|
|
1025
|
+
return s(t, dt) ? t : null;
|
|
1026
|
+
}
|
|
1027
|
+
function _t(e) {
|
|
1028
|
+
return !a(e) && e.trim().length === ht;
|
|
1016
1029
|
}
|
|
1017
1030
|
function vt(e) {
|
|
1018
|
-
return
|
|
1031
|
+
return o(e) && r(e.id, pt) && r(e.name, ft) && typeof e.email == "string" && gt(e.email) !== null;
|
|
1019
1032
|
}
|
|
1020
1033
|
function yt(e) {
|
|
1021
|
-
return o(e) && r(e.id,
|
|
1022
|
-
}
|
|
1023
|
-
function bt(e) {
|
|
1024
|
-
return o(e) && r(e.id, mt);
|
|
1034
|
+
return o(e) && r(e.id, pt);
|
|
1025
1035
|
}
|
|
1026
|
-
function
|
|
1036
|
+
function P(e, t, n) {
|
|
1027
1037
|
return {
|
|
1028
1038
|
error: e,
|
|
1029
1039
|
message: t,
|
|
1030
1040
|
code: n
|
|
1031
1041
|
};
|
|
1032
1042
|
}
|
|
1033
|
-
async function
|
|
1034
|
-
let r =
|
|
1043
|
+
async function bt(e, t, n = () => !0) {
|
|
1044
|
+
let r = gt(t);
|
|
1035
1045
|
if (!r) e.setState({
|
|
1036
1046
|
isLoading: !1,
|
|
1037
1047
|
otpStep: "idle",
|
|
1038
1048
|
otpEmail: null,
|
|
1039
1049
|
otpMfaChallenge: null
|
|
1040
|
-
}), e.handleError(
|
|
1050
|
+
}), e.handleError(P("invalid_email", "A valid email address is required", 400));
|
|
1041
1051
|
else try {
|
|
1042
1052
|
e.setState({
|
|
1043
1053
|
isLoading: !0,
|
|
@@ -1059,7 +1069,7 @@ async function xt(e, t, n = () => !0) {
|
|
|
1059
1069
|
otpStep: "idle",
|
|
1060
1070
|
otpEmail: null,
|
|
1061
1071
|
otpMfaChallenge: null
|
|
1062
|
-
}), e.handleError(
|
|
1072
|
+
}), e.handleError(P("otp_failed", "Failed to send OTP. Please try again.", 500)));
|
|
1063
1073
|
} catch (t) {
|
|
1064
1074
|
if (!n()) return;
|
|
1065
1075
|
e.setState({
|
|
@@ -1070,14 +1080,14 @@ async function xt(e, t, n = () => !0) {
|
|
|
1070
1080
|
}), e.handleError(t);
|
|
1071
1081
|
}
|
|
1072
1082
|
}
|
|
1073
|
-
async function
|
|
1083
|
+
async function xt(e, t, n) {
|
|
1074
1084
|
let { onAuthenticated: i, onWrongOtp: o, onSuccess: s, isCurrent: c = () => !0 } = typeof n == "function" ? { onAuthenticated: n } : n, { otpEmail: l, otpMfaChallenge: u, otpStep: d } = e.getState();
|
|
1075
1085
|
if (!l) {
|
|
1076
|
-
e.handleError(
|
|
1086
|
+
e.handleError(P("no_email", "No OTP request in progress", 400));
|
|
1077
1087
|
return;
|
|
1078
1088
|
}
|
|
1079
1089
|
let f = d === "mfa";
|
|
1080
|
-
if (!(f ? typeof t == "string" && !a(t) && t.trim().length >= 6 && t.trim().length <= 100 :
|
|
1090
|
+
if (!(f ? typeof t == "string" && !a(t) && t.trim().length >= 6 && t.trim().length <= 100 : _t(t)) || f && !u) e.setState({ isLoading: !1 }), e.handleError(P("invalid_otp", "Invalid or expired OTP code", 401));
|
|
1081
1091
|
else try {
|
|
1082
1092
|
e.setState({
|
|
1083
1093
|
isLoading: !0,
|
|
@@ -1094,8 +1104,8 @@ async function St(e, t, n) {
|
|
|
1094
1104
|
});
|
|
1095
1105
|
return;
|
|
1096
1106
|
}
|
|
1097
|
-
if (n.verified && r(n.token,
|
|
1098
|
-
if (e.apiClient.setAuthToken(n.token), e.apiClient.setUserEmail(n.user.email), e.config.persistence !== "memory" &&
|
|
1107
|
+
if (n.verified && r(n.token, mt) && vt(n.user) && yt(n.project)) {
|
|
1108
|
+
if (e.apiClient.setAuthToken(n.token), e.apiClient.setUserEmail(n.user.email), e.config.persistence !== "memory" && st(e.config.projectId, {
|
|
1099
1109
|
token: n.token,
|
|
1100
1110
|
email: n.user.email,
|
|
1101
1111
|
user: n.user
|
|
@@ -1111,13 +1121,13 @@ async function St(e, t, n) {
|
|
|
1111
1121
|
otpMfaChallenge: null
|
|
1112
1122
|
}), s?.(), e.emit("auth:otp-verified", n.user), !c() || (e.emit("auth:login", n.user), !c())) return;
|
|
1113
1123
|
await i();
|
|
1114
|
-
} else e.setState({ isLoading: !1 }), o?.(), e.handleError(
|
|
1124
|
+
} else e.setState({ isLoading: !1 }), o?.(), e.handleError(P("invalid_otp", "Invalid or expired OTP code", 401));
|
|
1115
1125
|
} catch (t) {
|
|
1116
1126
|
if (!c()) return;
|
|
1117
1127
|
e.setState({ isLoading: !1 }), e.handleError(t);
|
|
1118
1128
|
}
|
|
1119
1129
|
}
|
|
1120
|
-
function
|
|
1130
|
+
function St(e) {
|
|
1121
1131
|
e.setState({
|
|
1122
1132
|
otpStep: "idle",
|
|
1123
1133
|
otpEmail: null,
|
|
@@ -1126,12 +1136,12 @@ function Ct(e) {
|
|
|
1126
1136
|
isLoading: !1
|
|
1127
1137
|
});
|
|
1128
1138
|
}
|
|
1129
|
-
async function
|
|
1139
|
+
async function Ct(e, t = () => !0) {
|
|
1130
1140
|
let n = e.getState().otpEmail;
|
|
1131
|
-
n && await
|
|
1141
|
+
n && await bt(e, n, t);
|
|
1132
1142
|
}
|
|
1133
|
-
function
|
|
1134
|
-
|
|
1143
|
+
function wt(e, t) {
|
|
1144
|
+
ut(e, "Pending offline changes were discarded on logout"), lt(e.config.projectId), e.apiClient.setUserEmail(null), e.apiClient.setAuthToken(null), t(), e.setState({
|
|
1135
1145
|
isAuthenticated: !1,
|
|
1136
1146
|
currentUser: null,
|
|
1137
1147
|
comments: [],
|
|
@@ -1160,8 +1170,8 @@ function Tt(e, t) {
|
|
|
1160
1170
|
isLoading: !1
|
|
1161
1171
|
}), e.emit("auth:logout", void 0);
|
|
1162
1172
|
}
|
|
1163
|
-
function
|
|
1164
|
-
|
|
1173
|
+
function Tt(e) {
|
|
1174
|
+
ut(e, "Pending offline changes were discarded because the session expired"), lt(e.config.projectId), e.apiClient.setUserEmail(null), e.apiClient.setAuthToken(null), e.setState({
|
|
1165
1175
|
isAuthenticated: !1,
|
|
1166
1176
|
currentUser: null,
|
|
1167
1177
|
comments: [],
|
|
@@ -1187,35 +1197,35 @@ function Et(e) {
|
|
|
1187
1197
|
code: 401
|
|
1188
1198
|
});
|
|
1189
1199
|
}
|
|
1190
|
-
function
|
|
1200
|
+
function Et(e) {
|
|
1191
1201
|
e.setState({ isLoginModalVisible: !e.getState().isLoginModalVisible });
|
|
1192
1202
|
}
|
|
1193
|
-
async function
|
|
1203
|
+
async function Dt(e, t, n, r = () => !0) {
|
|
1194
1204
|
let i = e.config.inviteToken;
|
|
1195
1205
|
if (!i) {
|
|
1196
|
-
e.handleError(
|
|
1206
|
+
e.handleError(P("no_invite", "No invite token found", 400));
|
|
1197
1207
|
return;
|
|
1198
1208
|
}
|
|
1199
|
-
let a =
|
|
1200
|
-
if (!a) e.setState({ isLoading: !1 }), e.handleError(
|
|
1209
|
+
let a = gt(t);
|
|
1210
|
+
if (!a) e.setState({ isLoading: !1 }), e.handleError(P("invalid_email", "A valid email address is required", 400));
|
|
1201
1211
|
else try {
|
|
1202
1212
|
e.setState({
|
|
1203
1213
|
isLoading: !0,
|
|
1204
1214
|
error: null
|
|
1205
1215
|
});
|
|
1206
1216
|
let t = await e.apiClient.validateInvite(i, a);
|
|
1207
|
-
if (!r()) return;
|
|
1208
|
-
t.success ? await n(a) : (e.setState({ isLoading: !1 }), e.handleError(
|
|
1217
|
+
if (t.success && t.accessScope !== "project" && e.config.inviteToken === i && (e.config.inviteToken = void 0), !r()) return;
|
|
1218
|
+
t.success ? await n(a) : (e.setState({ isLoading: !1 }), e.handleError(P("invite_invalid", "Invite validation failed", 400)));
|
|
1209
1219
|
} catch (t) {
|
|
1210
1220
|
if (!r()) return;
|
|
1211
1221
|
e.setState({ isLoading: !1 }), e.handleError(t);
|
|
1212
1222
|
}
|
|
1213
1223
|
}
|
|
1214
|
-
function
|
|
1224
|
+
function F(e) {
|
|
1215
1225
|
return Object.freeze(e);
|
|
1216
1226
|
}
|
|
1217
|
-
var
|
|
1218
|
-
auth:
|
|
1227
|
+
var Ot = Object.freeze({
|
|
1228
|
+
auth: F([
|
|
1219
1229
|
"isAuthenticated",
|
|
1220
1230
|
"currentUser",
|
|
1221
1231
|
"project",
|
|
@@ -1225,7 +1235,7 @@ var kt = Object.freeze({
|
|
|
1225
1235
|
"otpEmail",
|
|
1226
1236
|
"otpMfaChallenge"
|
|
1227
1237
|
]),
|
|
1228
|
-
ui:
|
|
1238
|
+
ui: F([
|
|
1229
1239
|
"isOverlayVisible",
|
|
1230
1240
|
"isSidebarVisible",
|
|
1231
1241
|
"isShortcutsOverlayVisible",
|
|
@@ -1243,7 +1253,7 @@ var kt = Object.freeze({
|
|
|
1243
1253
|
"isLoading",
|
|
1244
1254
|
"error"
|
|
1245
1255
|
]),
|
|
1246
|
-
comments:
|
|
1256
|
+
comments: F([
|
|
1247
1257
|
"comments",
|
|
1248
1258
|
"pagination",
|
|
1249
1259
|
"seenThreadIds",
|
|
@@ -1251,18 +1261,18 @@ var kt = Object.freeze({
|
|
|
1251
1261
|
"commentQuery",
|
|
1252
1262
|
"loadingThreadId"
|
|
1253
1263
|
]),
|
|
1254
|
-
realtime:
|
|
1264
|
+
realtime: F([
|
|
1255
1265
|
"onlineUsers",
|
|
1256
1266
|
"connectionStatus",
|
|
1257
1267
|
"pendingMutations",
|
|
1258
1268
|
"isOnline"
|
|
1259
1269
|
])
|
|
1260
1270
|
});
|
|
1261
|
-
function
|
|
1271
|
+
function kt() {
|
|
1262
1272
|
return typeof navigator < "u" && typeof navigator.onLine == "boolean" ? navigator.onLine : !0;
|
|
1263
1273
|
}
|
|
1264
|
-
var
|
|
1265
|
-
function
|
|
1274
|
+
var At = 2e3;
|
|
1275
|
+
function jt() {
|
|
1266
1276
|
return {
|
|
1267
1277
|
isAuthenticated: !1,
|
|
1268
1278
|
isOverlayVisible: !0,
|
|
@@ -1297,59 +1307,59 @@ function Mt() {
|
|
|
1297
1307
|
otpMfaChallenge: null,
|
|
1298
1308
|
pagination: null,
|
|
1299
1309
|
pendingMutations: [],
|
|
1300
|
-
isOnline:
|
|
1310
|
+
isOnline: kt()
|
|
1301
1311
|
};
|
|
1302
1312
|
}
|
|
1303
|
-
function
|
|
1313
|
+
function I(e) {
|
|
1304
1314
|
let t = e.config.branch ?? e.getState().activeBranch;
|
|
1305
1315
|
if (!(typeof t != "string" || t.length > 255 || a(t))) return t.trim() || void 0;
|
|
1306
1316
|
}
|
|
1307
|
-
var
|
|
1317
|
+
var L = M.ID, Mt = M.CONTENT, Nt = M.REPLY_CONTENT, Pt = M.SELECTOR, Ft = M.TEXT_SELECTION, It = M.DESCRIPTION, Lt = M.ASSIGNEES, Rt = M.CHECKLIST_ITEMS, zt = M.CHECKLIST_LABEL, Bt = M.DRAWING_PATHS, Vt = M.DRAWING_PATH_DATA, Ht = M.DRAWING_TEXT, Ut = M.REACTION_COUNT, Wt = M.EMOJI, Gt = /* @__PURE__ */ new Set([
|
|
1308
1318
|
"pin",
|
|
1309
1319
|
"highlight",
|
|
1310
1320
|
"drawing"
|
|
1311
|
-
]),
|
|
1321
|
+
]), Kt = /* @__PURE__ */ new Set([
|
|
1312
1322
|
"low",
|
|
1313
1323
|
"medium",
|
|
1314
1324
|
"high",
|
|
1315
1325
|
"urgent"
|
|
1316
|
-
]),
|
|
1326
|
+
]), qt = /* @__PURE__ */ new Set([
|
|
1317
1327
|
"open",
|
|
1318
1328
|
"resolved",
|
|
1319
1329
|
"complete"
|
|
1320
|
-
]),
|
|
1330
|
+
]), Jt = /* @__PURE__ */ new Set([
|
|
1321
1331
|
"path",
|
|
1322
1332
|
"line",
|
|
1323
1333
|
"rectangle",
|
|
1324
1334
|
"circle",
|
|
1325
1335
|
"text"
|
|
1326
1336
|
]);
|
|
1327
|
-
function
|
|
1337
|
+
function R(e, t, n) {
|
|
1328
1338
|
e.handleError(new E(t, n, 400));
|
|
1329
1339
|
}
|
|
1330
|
-
function
|
|
1331
|
-
return r(e,
|
|
1340
|
+
function z(e) {
|
|
1341
|
+
return r(e, L);
|
|
1332
1342
|
}
|
|
1333
|
-
function
|
|
1343
|
+
function B(e, t = Mt) {
|
|
1334
1344
|
if (typeof e != "string") return null;
|
|
1335
1345
|
let n = e.trim();
|
|
1336
1346
|
return !n || n.length > t || c(n) ? null : n;
|
|
1337
1347
|
}
|
|
1338
|
-
function
|
|
1348
|
+
function V(e, t) {
|
|
1339
1349
|
if (e === void 0) return;
|
|
1340
1350
|
if (typeof e != "string") return null;
|
|
1341
1351
|
let n = e.trim();
|
|
1342
1352
|
return n.length > t || c(n) ? null : n;
|
|
1343
1353
|
}
|
|
1344
|
-
function
|
|
1354
|
+
function H(e) {
|
|
1345
1355
|
if (e === void 0) return;
|
|
1346
1356
|
if (typeof e != "string") return null;
|
|
1347
1357
|
let t = e.trim();
|
|
1348
|
-
return !t || t.length >
|
|
1358
|
+
return !t || t.length > Pt || c(t) ? null : t;
|
|
1349
1359
|
}
|
|
1350
|
-
function
|
|
1360
|
+
function Yt(t) {
|
|
1351
1361
|
if (!o(t) || !e(t.x) || !e(t.y)) return null;
|
|
1352
|
-
let n =
|
|
1362
|
+
let n = H(t.element), r = H(t.xpath);
|
|
1353
1363
|
return n === null || r === null ? null : {
|
|
1354
1364
|
x: t.x,
|
|
1355
1365
|
y: t.y,
|
|
@@ -1357,10 +1367,10 @@ function Xt(t) {
|
|
|
1357
1367
|
...r === void 0 ? {} : { xpath: r }
|
|
1358
1368
|
};
|
|
1359
1369
|
}
|
|
1360
|
-
function
|
|
1370
|
+
function Xt(e) {
|
|
1361
1371
|
if (!o(e)) return null;
|
|
1362
|
-
let t =
|
|
1363
|
-
return !
|
|
1372
|
+
let t = V(e.avatar, Pt), n = V(e.organizationId, L);
|
|
1373
|
+
return !z(e.id) || typeof e.name != "string" || !e.name.trim() || e.name.length > M.NAME || c(e.name) || typeof e.email != "string" || !e.email.trim() || e.email.length > M.EMAIL || /\s/.test(e.email.trim()) || c(e.email) || t === null || n === null ? null : {
|
|
1364
1374
|
id: e.id.trim(),
|
|
1365
1375
|
name: e.name.trim(),
|
|
1366
1376
|
email: e.email.trim(),
|
|
@@ -1368,25 +1378,25 @@ function Zt(e) {
|
|
|
1368
1378
|
...n === void 0 ? {} : { organizationId: n }
|
|
1369
1379
|
};
|
|
1370
1380
|
}
|
|
1371
|
-
function
|
|
1381
|
+
function Zt(e) {
|
|
1372
1382
|
if (e === void 0) return;
|
|
1373
|
-
if (!Array.isArray(e) || e.length >
|
|
1383
|
+
if (!Array.isArray(e) || e.length > Lt) return null;
|
|
1374
1384
|
let t = [];
|
|
1375
1385
|
for (let n of e) {
|
|
1376
|
-
let e =
|
|
1386
|
+
let e = Xt(n);
|
|
1377
1387
|
if (!e) return null;
|
|
1378
1388
|
t.push(e);
|
|
1379
1389
|
}
|
|
1380
1390
|
return t;
|
|
1381
1391
|
}
|
|
1382
|
-
function
|
|
1392
|
+
function Qt(e) {
|
|
1383
1393
|
if (e === void 0) return;
|
|
1384
|
-
if (!Array.isArray(e) || e.length >
|
|
1394
|
+
if (!Array.isArray(e) || e.length > Rt) return null;
|
|
1385
1395
|
let t = [];
|
|
1386
1396
|
for (let n of e) {
|
|
1387
1397
|
if (!o(n)) return null;
|
|
1388
|
-
let e =
|
|
1389
|
-
if (!
|
|
1398
|
+
let e = B(n.label);
|
|
1399
|
+
if (!z(n.id) || !e || typeof n.done != "boolean" || n.sortOrder !== void 0 && (typeof n.sortOrder != "number" || !Number.isFinite(n.sortOrder)) || e.length > zt) return null;
|
|
1390
1400
|
t.push({
|
|
1391
1401
|
id: n.id.trim(),
|
|
1392
1402
|
label: e,
|
|
@@ -1396,11 +1406,11 @@ function $t(e) {
|
|
|
1396
1406
|
}
|
|
1397
1407
|
return t;
|
|
1398
1408
|
}
|
|
1399
|
-
function
|
|
1409
|
+
function $t(e) {
|
|
1400
1410
|
if (e === void 0) return;
|
|
1401
1411
|
if (!o(e) || typeof e.text != "string") return null;
|
|
1402
|
-
let t = e.text.trim(), n =
|
|
1403
|
-
return !t || t.length >
|
|
1412
|
+
let t = e.text.trim(), n = H(e.element), r = H(e.xpath);
|
|
1413
|
+
return !t || t.length > Ft || c(t) || typeof e.startOffset != "number" || typeof e.endOffset != "number" || !Number.isInteger(e.startOffset) || !Number.isInteger(e.endOffset) || e.startOffset < 0 || e.endOffset < e.startOffset || n === null || r === null || n === void 0 || r === void 0 ? null : {
|
|
1404
1414
|
text: t,
|
|
1405
1415
|
startOffset: e.startOffset,
|
|
1406
1416
|
endOffset: e.endOffset,
|
|
@@ -1408,20 +1418,20 @@ function en(e) {
|
|
|
1408
1418
|
xpath: r
|
|
1409
1419
|
};
|
|
1410
1420
|
}
|
|
1411
|
-
function
|
|
1412
|
-
return typeof e == "string" && e.length > 0 && e.length <=
|
|
1421
|
+
function en(e) {
|
|
1422
|
+
return typeof e == "string" && e.length > 0 && e.length <= M.COLOR && t(e);
|
|
1413
1423
|
}
|
|
1414
|
-
function
|
|
1424
|
+
function U(e) {
|
|
1415
1425
|
return e === void 0 || typeof e == "number" && Number.isFinite(e);
|
|
1416
1426
|
}
|
|
1417
|
-
function
|
|
1427
|
+
function tn(e) {
|
|
1418
1428
|
if (e === void 0) return;
|
|
1419
|
-
if (!o(e) || e.type !== "svg" || !Array.isArray(e.paths) || e.paths.length >
|
|
1429
|
+
if (!o(e) || e.type !== "svg" || !Array.isArray(e.paths) || e.paths.length > Bt || !o(e.viewport) || typeof e.viewport.width != "number" || typeof e.viewport.height != "number" || !Number.isFinite(e.viewport.width) || !Number.isFinite(e.viewport.height) || e.viewport.width <= 0 || e.viewport.height <= 0) return null;
|
|
1420
1430
|
let t = [];
|
|
1421
1431
|
for (let n of e.paths) {
|
|
1422
|
-
if (!o(n) || !
|
|
1423
|
-
let e =
|
|
1424
|
-
if (!
|
|
1432
|
+
if (!o(n) || !Jt.has(String(n.type))) return null;
|
|
1433
|
+
let e = V(n.text, Ht);
|
|
1434
|
+
if (!en(n.stroke) || !en(n.fill) || typeof n.strokeWidth != "number" || !Number.isFinite(n.strokeWidth) || n.strokeWidth < 0 || n.d !== void 0 && (typeof n.d != "string" || n.d.length > Vt || c(n.d)) || !U(n.x) || !U(n.y) || !U(n.width) || !U(n.height) || e === null) return null;
|
|
1425
1435
|
t.push({
|
|
1426
1436
|
type: n.type,
|
|
1427
1437
|
stroke: n.stroke,
|
|
@@ -1444,19 +1454,19 @@ function nn(e) {
|
|
|
1444
1454
|
}
|
|
1445
1455
|
};
|
|
1446
1456
|
}
|
|
1447
|
-
function
|
|
1457
|
+
function nn(e) {
|
|
1448
1458
|
return o(e) && typeof e.browser == "string" && e.browser.length <= 255 && typeof e.os == "string" && e.os.length <= 255 && typeof e.windowSize == "string" && e.windowSize.length <= 64 && typeof e.devicePixelRatio == "number" && e.devicePixelRatio > 0 && e.devicePixelRatio <= 16 && (e.type === "desktop" || e.type === "mobile") && (e.deployment === void 0 || typeof e.deployment == "string" && e.deployment.length <= 255);
|
|
1449
1459
|
}
|
|
1450
|
-
function
|
|
1460
|
+
function rn(e) {
|
|
1451
1461
|
if (e === void 0) return;
|
|
1452
1462
|
if (!o(e)) return null;
|
|
1453
|
-
let t =
|
|
1463
|
+
let t = V(e.description, It), n = Zt(e.assignees), r = Qt(e.checklist);
|
|
1454
1464
|
if (t === null || n === null || r === null) return null;
|
|
1455
|
-
let i = Array.isArray(e.files) ? e.files.filter((e) => typeof File < "u" && e instanceof File) : void 0, a = Array.isArray(e.attachmentIds) ? e.attachmentIds.map((e) => String(e).trim()).filter((e) => e.length > 0 && e.length <=
|
|
1465
|
+
let i = Array.isArray(e.files) ? e.files.filter((e) => typeof File < "u" && e instanceof File) : void 0, a = Array.isArray(e.attachmentIds) ? e.attachmentIds.map((e) => String(e).trim()).filter((e) => e.length > 0 && e.length <= L).slice(0, 20) : void 0;
|
|
1456
1466
|
return {
|
|
1457
|
-
...Array.isArray(e.mentions) ? { mentions: e.mentions.filter((e) => o(e) &&
|
|
1467
|
+
...Array.isArray(e.mentions) ? { mentions: e.mentions.filter((e) => o(e) && z(e.userId) && typeof e.name == "string").slice(0, 100) } : {},
|
|
1458
1468
|
...typeof e.branch == "string" && e.branch.trim() && e.branch.length <= 255 && !c(e.branch) ? { branch: e.branch.trim() } : {},
|
|
1459
|
-
...
|
|
1469
|
+
...nn(e.deviceInfo) ? { deviceInfo: e.deviceInfo } : {},
|
|
1460
1470
|
...t === void 0 ? {} : { description: t },
|
|
1461
1471
|
...n === void 0 ? {} : { assignees: n },
|
|
1462
1472
|
...r === void 0 ? {} : { checklist: r },
|
|
@@ -1464,69 +1474,69 @@ function an(e) {
|
|
|
1464
1474
|
...a && a.length > 0 ? { attachmentIds: a } : {}
|
|
1465
1475
|
};
|
|
1466
1476
|
}
|
|
1467
|
-
function
|
|
1477
|
+
function an(e) {
|
|
1468
1478
|
if (!o(e)) return null;
|
|
1469
1479
|
let t = {};
|
|
1470
1480
|
if ("content" in e) {
|
|
1471
|
-
let n =
|
|
1481
|
+
let n = B(e.content);
|
|
1472
1482
|
if (!n) return null;
|
|
1473
1483
|
t.content = n;
|
|
1474
1484
|
}
|
|
1475
1485
|
if ("status" in e) {
|
|
1476
|
-
if (!
|
|
1486
|
+
if (!qt.has(e.status)) return null;
|
|
1477
1487
|
t.status = e.status;
|
|
1478
1488
|
}
|
|
1479
1489
|
if ("priority" in e) {
|
|
1480
|
-
if (!
|
|
1490
|
+
if (!Kt.has(e.priority)) return null;
|
|
1481
1491
|
t.priority = e.priority;
|
|
1482
1492
|
}
|
|
1483
1493
|
if ("description" in e) {
|
|
1484
|
-
let n =
|
|
1494
|
+
let n = V(e.description, It);
|
|
1485
1495
|
if (n === null) return null;
|
|
1486
1496
|
t.description = n;
|
|
1487
1497
|
}
|
|
1488
|
-
if (Array.isArray(e.mentions) && (t.mentions = e.mentions.filter((e) => o(e) &&
|
|
1489
|
-
let n =
|
|
1498
|
+
if (Array.isArray(e.mentions) && (t.mentions = e.mentions.filter((e) => o(e) && z(e.userId) && typeof e.name == "string").slice(0, 100)), "assignees" in e) {
|
|
1499
|
+
let n = Zt(e.assignees);
|
|
1490
1500
|
if (n === null) return null;
|
|
1491
1501
|
t.assignees = n;
|
|
1492
1502
|
}
|
|
1493
1503
|
if ("checklistPatch" in e) {
|
|
1494
1504
|
let n = e.checklistPatch;
|
|
1495
|
-
if ("checklist" in e || !o(n) || !
|
|
1505
|
+
if ("checklist" in e || !o(n) || !z(n.id) || typeof n.done != "boolean") return null;
|
|
1496
1506
|
t.checklistPatch = {
|
|
1497
1507
|
id: n.id,
|
|
1498
1508
|
done: n.done
|
|
1499
1509
|
};
|
|
1500
1510
|
}
|
|
1501
1511
|
if ("checklist" in e) {
|
|
1502
|
-
let n =
|
|
1512
|
+
let n = Qt(e.checklist);
|
|
1503
1513
|
if (n === null) return null;
|
|
1504
1514
|
t.checklist = n;
|
|
1505
1515
|
}
|
|
1506
1516
|
if ("textSelection" in e) {
|
|
1507
|
-
let n =
|
|
1517
|
+
let n = $t(e.textSelection);
|
|
1508
1518
|
if (n === null) return null;
|
|
1509
1519
|
t.textSelection = n;
|
|
1510
1520
|
}
|
|
1511
1521
|
if ("drawingData" in e) {
|
|
1512
|
-
let n =
|
|
1522
|
+
let n = tn(e.drawingData);
|
|
1513
1523
|
if (n === null) return null;
|
|
1514
1524
|
t.drawingData = n;
|
|
1515
1525
|
}
|
|
1516
1526
|
if ("attachmentIds" in e) {
|
|
1517
1527
|
let n = e.attachmentIds;
|
|
1518
1528
|
if (!Array.isArray(n)) return null;
|
|
1519
|
-
t.attachmentIds = n.map((e) => String(e).trim()).filter((e) => e.length > 0 && e.length <=
|
|
1529
|
+
t.attachmentIds = n.map((e) => String(e).trim()).filter((e) => e.length > 0 && e.length <= L).slice(0, 20);
|
|
1520
1530
|
}
|
|
1521
1531
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
1522
1532
|
}
|
|
1523
|
-
function
|
|
1533
|
+
function W(e) {
|
|
1524
1534
|
return `${e}_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
1525
1535
|
}
|
|
1526
|
-
function
|
|
1536
|
+
function G(e, t) {
|
|
1527
1537
|
return e.getState().comments.some((e) => e.id === t);
|
|
1528
1538
|
}
|
|
1529
|
-
function
|
|
1539
|
+
function K(e, t, n) {
|
|
1530
1540
|
if (e.getState().activeBranch && n.branch !== e.getState().activeBranch) {
|
|
1531
1541
|
e.setState({ comments: e.getState().comments.filter((e) => e.id !== t) });
|
|
1532
1542
|
return;
|
|
@@ -1534,7 +1544,7 @@ function G(e, t, n) {
|
|
|
1534
1544
|
let r = e.getState().comments.filter((e) => e.id !== n.id), i = r.some((e) => e.id === t);
|
|
1535
1545
|
e.setState({ comments: i ? r.map((e) => e.id === t ? n : e) : [...r, n] });
|
|
1536
1546
|
}
|
|
1537
|
-
function
|
|
1547
|
+
function on(e, t, n, r) {
|
|
1538
1548
|
e.setState({ comments: e.getState().comments.map((e) => {
|
|
1539
1549
|
if (e.id !== t) return e;
|
|
1540
1550
|
let i = e.replies.filter((e) => e.id !== r.id), a = i.some((e) => e.id === n);
|
|
@@ -1547,7 +1557,7 @@ function sn(e, t, n, r) {
|
|
|
1547
1557
|
};
|
|
1548
1558
|
}) });
|
|
1549
1559
|
}
|
|
1550
|
-
function
|
|
1560
|
+
function q(e, t) {
|
|
1551
1561
|
return !t || t === e.status ? e : {
|
|
1552
1562
|
...e,
|
|
1553
1563
|
status: t,
|
|
@@ -1555,10 +1565,10 @@ function K(e, t) {
|
|
|
1555
1565
|
...t === "complete" ? {} : { resolvedAt: void 0 }
|
|
1556
1566
|
};
|
|
1557
1567
|
}
|
|
1558
|
-
function
|
|
1568
|
+
function sn(e, t, n) {
|
|
1559
1569
|
return e.getState().comments.some((e) => e.id === t && e.replies.some((e) => e.id === n));
|
|
1560
1570
|
}
|
|
1561
|
-
async function
|
|
1571
|
+
async function cn(e) {
|
|
1562
1572
|
let t = e.getState().activeBranch, n = e.getState().commentQuery;
|
|
1563
1573
|
e.setState({ isLoading: !0 });
|
|
1564
1574
|
try {
|
|
@@ -1584,7 +1594,7 @@ async function ln(e) {
|
|
|
1584
1594
|
e.setState({ isLoading: !1 });
|
|
1585
1595
|
}
|
|
1586
1596
|
}
|
|
1587
|
-
async function
|
|
1597
|
+
async function ln(e, t) {
|
|
1588
1598
|
let n = e.getState().activeBranch, r = e.getState().pagination, i = e.getState().commentQuery;
|
|
1589
1599
|
if (r && r.hasMore && !t.current) {
|
|
1590
1600
|
t.current = !0;
|
|
@@ -1610,8 +1620,8 @@ async function un(e, t) {
|
|
|
1610
1620
|
}
|
|
1611
1621
|
}
|
|
1612
1622
|
}
|
|
1613
|
-
async function
|
|
1614
|
-
if (
|
|
1623
|
+
async function un(e, t, n) {
|
|
1624
|
+
if (z(t)) {
|
|
1615
1625
|
e.setState({ loadingThreadId: t });
|
|
1616
1626
|
try {
|
|
1617
1627
|
let r = await e.apiClient.getComment(t, {
|
|
@@ -1641,24 +1651,24 @@ async function dn(e, t, n) {
|
|
|
1641
1651
|
}
|
|
1642
1652
|
}
|
|
1643
1653
|
}
|
|
1644
|
-
async function
|
|
1654
|
+
async function dn(e, t, n, r, i, a, o = "medium", s, c, l) {
|
|
1645
1655
|
let u = e.getState().currentUser;
|
|
1646
1656
|
if (!u) return;
|
|
1647
|
-
let d =
|
|
1648
|
-
if (!
|
|
1649
|
-
|
|
1657
|
+
let d = B(i), f = Yt(a), p = $t(s), h = tn(c), g = rn(l);
|
|
1658
|
+
if (!Gt.has(r) || !d || !f || !Kt.has(o) || p === null || h === null || g === null) {
|
|
1659
|
+
R(e, "invalid_comment", "Comment data is invalid");
|
|
1650
1660
|
return;
|
|
1651
1661
|
}
|
|
1652
1662
|
let _ = `create:${r}:${d.slice(0, 50)}:${f.x}:${f.y}`;
|
|
1653
1663
|
if (n.has(_)) return;
|
|
1654
1664
|
n.add(_);
|
|
1655
1665
|
let v = m(), y = g?.files ?? [], ee = y.map((e, t) => ({
|
|
1656
|
-
id:
|
|
1666
|
+
id: W(`pending-att-${t}`),
|
|
1657
1667
|
type: e.type.startsWith("image/") ? "screenshot" : "file",
|
|
1658
1668
|
url: "",
|
|
1659
1669
|
filename: e.name,
|
|
1660
1670
|
size: e.size
|
|
1661
|
-
})), b =
|
|
1671
|
+
})), b = W("temp"), te = {
|
|
1662
1672
|
id: b,
|
|
1663
1673
|
type: r,
|
|
1664
1674
|
content: d,
|
|
@@ -1723,7 +1733,7 @@ async function fn(e, t, n, r, i, a, o = "medium", s, c, l) {
|
|
|
1723
1733
|
attachments: a.attachments ?? []
|
|
1724
1734
|
};
|
|
1725
1735
|
}
|
|
1726
|
-
|
|
1736
|
+
K(e, b, s), e.emit("comment:created", s), t.addActivity({
|
|
1727
1737
|
type: "comment_created",
|
|
1728
1738
|
threadId: s.id,
|
|
1729
1739
|
message: "created a new comment"
|
|
@@ -1755,11 +1765,11 @@ async function fn(e, t, n, r, i, a, o = "medium", s, c, l) {
|
|
|
1755
1765
|
n.delete(_);
|
|
1756
1766
|
}
|
|
1757
1767
|
}
|
|
1758
|
-
async function
|
|
1759
|
-
if (!
|
|
1760
|
-
let i =
|
|
1768
|
+
async function fn(e, t, n, r) {
|
|
1769
|
+
if (!z(n)) return;
|
|
1770
|
+
let i = an(r);
|
|
1761
1771
|
if (i === null) {
|
|
1762
|
-
|
|
1772
|
+
R(e, "invalid_comment_update", "Comment update data is invalid");
|
|
1763
1773
|
return;
|
|
1764
1774
|
}
|
|
1765
1775
|
if (i === void 0) return;
|
|
@@ -1767,7 +1777,7 @@ async function pn(e, t, n, r) {
|
|
|
1767
1777
|
if (!o) return;
|
|
1768
1778
|
let { checklistPatch: s, ...c } = i;
|
|
1769
1779
|
e.setState({ comments: a.map((e) => e.id === n ? {
|
|
1770
|
-
...
|
|
1780
|
+
...q(e, i.status),
|
|
1771
1781
|
...c,
|
|
1772
1782
|
...s ? { checklist: e.checklist?.map((e) => e.id === s.id ? {
|
|
1773
1783
|
...e,
|
|
@@ -1781,8 +1791,8 @@ async function pn(e, t, n, r) {
|
|
|
1781
1791
|
t.shouldQueueMutation(r) && t.queueMutation("updateComment", [n, i]) || (e.setState({ comments: e.getState().comments.map((e) => e.id === n ? o : e) }), e.handleError(r));
|
|
1782
1792
|
}
|
|
1783
1793
|
}
|
|
1784
|
-
async function
|
|
1785
|
-
if (!
|
|
1794
|
+
async function pn(e, t, n) {
|
|
1795
|
+
if (!z(n)) return;
|
|
1786
1796
|
let r = e.getState().comments, i = r.find((e) => e.id === n);
|
|
1787
1797
|
if (!i) return;
|
|
1788
1798
|
let a = e.getState().selectedComment;
|
|
@@ -1802,19 +1812,19 @@ async function mn(e, t, n) {
|
|
|
1802
1812
|
}
|
|
1803
1813
|
}
|
|
1804
1814
|
}
|
|
1805
|
-
async function
|
|
1815
|
+
async function mn(e, t, n, r, i) {
|
|
1806
1816
|
let a = e.getState().currentUser;
|
|
1807
|
-
if (!a || !
|
|
1808
|
-
let o =
|
|
1817
|
+
if (!a || !z(n) || !G(e, n)) return;
|
|
1818
|
+
let o = B(r, Nt);
|
|
1809
1819
|
if (!o) {
|
|
1810
|
-
|
|
1820
|
+
R(e, "invalid_reply", "Reply content is invalid");
|
|
1811
1821
|
return;
|
|
1812
1822
|
}
|
|
1813
|
-
if (i?.replyTo && (!
|
|
1814
|
-
|
|
1823
|
+
if (i?.replyTo && (!z(i.replyTo.id) || i.replyTo.id.startsWith("temp_") || !["comment", "reply"].includes(i.replyTo.type) || (i.replyTo.type === "comment" ? i.replyTo.id !== n : !sn(e, n, i.replyTo.id)))) {
|
|
1824
|
+
R(e, "invalid_reply", "Reply target must belong to this thread");
|
|
1815
1825
|
return;
|
|
1816
1826
|
}
|
|
1817
|
-
let s = e.getState().comments.find((e) => e.id === n), c = i?.replyTo?.type === "comment" ? s : s?.replies.find((e) => e.id === i?.replyTo?.id), l =
|
|
1827
|
+
let s = e.getState().comments.find((e) => e.id === n), c = i?.replyTo?.type === "comment" ? s : s?.replies.find((e) => e.id === i?.replyTo?.id), l = W("temp_reply"), u = {
|
|
1818
1828
|
...c && i?.replyTo ? { replyTo: {
|
|
1819
1829
|
...i.replyTo,
|
|
1820
1830
|
authorName: c.author.name,
|
|
@@ -1832,7 +1842,7 @@ async function hn(e, t, n, r, i) {
|
|
|
1832
1842
|
replies: [...e.replies, u]
|
|
1833
1843
|
} : e) });
|
|
1834
1844
|
try {
|
|
1835
|
-
|
|
1845
|
+
on(e, n, l, await e.apiClient.addReply(n, o, l, ...i ? [i] : []));
|
|
1836
1846
|
let t = e.getState().comments.find((e) => e.id === n);
|
|
1837
1847
|
t && e.emit("comment:updated", t);
|
|
1838
1848
|
} catch (r) {
|
|
@@ -1847,11 +1857,11 @@ async function hn(e, t, n, r, i) {
|
|
|
1847
1857
|
} : e) }), e.handleError(r));
|
|
1848
1858
|
}
|
|
1849
1859
|
}
|
|
1850
|
-
async function
|
|
1851
|
-
if (!
|
|
1852
|
-
let a =
|
|
1860
|
+
async function hn(e, t, n, r, i) {
|
|
1861
|
+
if (!z(t) || !z(n) || !sn(e, t, n)) return;
|
|
1862
|
+
let a = B(r, Nt);
|
|
1853
1863
|
if (!a) {
|
|
1854
|
-
|
|
1864
|
+
R(e, "invalid_reply", "Reply content is invalid");
|
|
1855
1865
|
return;
|
|
1856
1866
|
}
|
|
1857
1867
|
let o = e.getState().comments, s = o.find((e) => e.id === t)?.replies.find((e) => e.id === n);
|
|
@@ -1878,8 +1888,8 @@ async function gn(e, t, n, r, i) {
|
|
|
1878
1888
|
} : e) }), e.handleError(r);
|
|
1879
1889
|
}
|
|
1880
1890
|
}
|
|
1881
|
-
async function
|
|
1882
|
-
if (!
|
|
1891
|
+
async function gn(e, t, n) {
|
|
1892
|
+
if (!z(t) || !z(n) || !sn(e, t, n)) return;
|
|
1883
1893
|
let r = e.getState().comments, i = r.find((e) => e.id === t)?.replies.find((e) => e.id === n);
|
|
1884
1894
|
e.setState({ comments: r.map((e) => e.id === t ? {
|
|
1885
1895
|
...e,
|
|
@@ -1898,10 +1908,10 @@ async function _n(e, t, n) {
|
|
|
1898
1908
|
} : e) }), e.handleError(r);
|
|
1899
1909
|
}
|
|
1900
1910
|
}
|
|
1901
|
-
async function
|
|
1902
|
-
if (!
|
|
1911
|
+
async function _n(e, t, n) {
|
|
1912
|
+
if (!z(n) || !G(e, n)) return;
|
|
1903
1913
|
let r = e.getState().comments, i = r.find((e) => e.id === n);
|
|
1904
|
-
e.setState({ comments: r.map((e) => e.id === n ?
|
|
1914
|
+
e.setState({ comments: r.map((e) => e.id === n ? q(e, "resolved") : e) });
|
|
1905
1915
|
try {
|
|
1906
1916
|
let r = await e.apiClient.resolveComment(n);
|
|
1907
1917
|
e.setState({ comments: e.getState().comments.map((e) => e.id === n ? r : e) }), e.emit("comment:resolved", r), e.emit("comment:updated", r), t.addActivity({
|
|
@@ -1913,10 +1923,10 @@ async function vn(e, t, n) {
|
|
|
1913
1923
|
t.shouldQueueMutation(r) && t.queueMutation("resolveComment", [n]) || (e.setState({ comments: e.getState().comments.map((e) => e.id === n && i ? i : e) }), e.handleError(r));
|
|
1914
1924
|
}
|
|
1915
1925
|
}
|
|
1916
|
-
async function
|
|
1917
|
-
if (!
|
|
1926
|
+
async function vn(e, t, n) {
|
|
1927
|
+
if (!z(n) || !G(e, n)) return;
|
|
1918
1928
|
let r = e.getState().comments, i = r.find((e) => e.id === n);
|
|
1919
|
-
e.setState({ comments: r.map((e) => e.id === n ?
|
|
1929
|
+
e.setState({ comments: r.map((e) => e.id === n ? q(e, "open") : e) });
|
|
1920
1930
|
try {
|
|
1921
1931
|
let t = await e.apiClient.unresolveComment(n);
|
|
1922
1932
|
e.setState({ comments: e.getState().comments.map((e) => e.id === n ? t : e) }), e.emit("comment:updated", t);
|
|
@@ -1924,10 +1934,10 @@ async function yn(e, t, n) {
|
|
|
1924
1934
|
t.shouldQueueMutation(r) && t.queueMutation("unresolveComment", [n]) || (e.setState({ comments: e.getState().comments.map((e) => e.id === n && i ? i : e) }), e.handleError(r));
|
|
1925
1935
|
}
|
|
1926
1936
|
}
|
|
1927
|
-
async function
|
|
1928
|
-
if (!
|
|
1937
|
+
async function yn(e, t, n) {
|
|
1938
|
+
if (!z(n) || !G(e, n)) return;
|
|
1929
1939
|
let r = e.getState().comments, i = r.find((e) => e.id === n);
|
|
1930
|
-
e.setState({ comments: r.map((e) => e.id === n ?
|
|
1940
|
+
e.setState({ comments: r.map((e) => e.id === n ? q(e, "complete") : e) });
|
|
1931
1941
|
try {
|
|
1932
1942
|
let r = await e.apiClient.markComplete(n);
|
|
1933
1943
|
e.setState({ comments: e.getState().comments.map((e) => e.id === n ? r : e) }), e.emit("comment:completed", r), t.addActivity({
|
|
@@ -1939,15 +1949,15 @@ async function bn(e, t, n) {
|
|
|
1939
1949
|
t.shouldQueueMutation(r) && t.queueMutation("completeComment", [n]) || (e.setState({ comments: e.getState().comments.map((e) => e.id === n && i ? i : e) }), e.handleError(r));
|
|
1940
1950
|
}
|
|
1941
1951
|
}
|
|
1942
|
-
async function
|
|
1943
|
-
if (!
|
|
1952
|
+
async function bn(e, t, n, r, i) {
|
|
1953
|
+
if (!z(n) || typeof r != "string") return;
|
|
1944
1954
|
let a = r.trim();
|
|
1945
|
-
if (!a || a.length >
|
|
1955
|
+
if (!a || a.length > Wt || c(a)) return;
|
|
1946
1956
|
let o = e.getState().comments.find((e) => e.id === n);
|
|
1947
1957
|
if (!o) return;
|
|
1948
1958
|
let s = i ? o.replies.find((e) => e.id === i) : o;
|
|
1949
1959
|
if (!s) return;
|
|
1950
|
-
let l = (s.reactions ?? []).filter((e) => typeof e.emoji == "string" && e.emoji.length > 0 && e.emoji.length <=
|
|
1960
|
+
let l = (s.reactions ?? []).filter((e) => typeof e.emoji == "string" && e.emoji.length > 0 && e.emoji.length <= Wt && !c(e.emoji) && typeof e.count == "number" && Number.isInteger(e.count) && e.count >= 0 && e.count <= Ut), u = l.find((e) => e.emoji === a)?.reacted, d = [...l];
|
|
1951
1961
|
if (u) {
|
|
1952
1962
|
let e = d.findIndex((e) => e.emoji === a), t = d[e];
|
|
1953
1963
|
t.count <= 1 ? d.splice(e, 1) : d[e] = {
|
|
@@ -1959,7 +1969,7 @@ async function xn(e, t, n, r, i) {
|
|
|
1959
1969
|
let e = d.findIndex((e) => e.emoji === a), t = e === -1 ? void 0 : d[e];
|
|
1960
1970
|
t ? d[e] = {
|
|
1961
1971
|
...t,
|
|
1962
|
-
count: Math.min(t.count + 1,
|
|
1972
|
+
count: Math.min(t.count + 1, Ut),
|
|
1963
1973
|
reacted: !0
|
|
1964
1974
|
} : d.push({
|
|
1965
1975
|
emoji: a,
|
|
@@ -2004,14 +2014,14 @@ async function xn(e, t, n, r, i) {
|
|
|
2004
2014
|
} : e) }), e.handleError(r));
|
|
2005
2015
|
}
|
|
2006
2016
|
}
|
|
2007
|
-
async function
|
|
2008
|
-
if (!
|
|
2009
|
-
let a =
|
|
2017
|
+
async function xn(e, t, n, r, i) {
|
|
2018
|
+
if (!z(n) || !G(e, n)) return;
|
|
2019
|
+
let a = Yt({
|
|
2010
2020
|
x: r,
|
|
2011
2021
|
y: i
|
|
2012
2022
|
});
|
|
2013
2023
|
if (!a) {
|
|
2014
|
-
|
|
2024
|
+
R(e, "invalid_position", "Comment position is invalid");
|
|
2015
2025
|
return;
|
|
2016
2026
|
}
|
|
2017
2027
|
let o = e.getState().comments, s = o.find((e) => e.id === n);
|
|
@@ -2032,21 +2042,21 @@ async function Sn(e, t, n, r, i) {
|
|
|
2032
2042
|
} : e) }), e.handleError(r));
|
|
2033
2043
|
}
|
|
2034
2044
|
}
|
|
2035
|
-
function
|
|
2045
|
+
function Sn(e, t) {
|
|
2036
2046
|
e.setState({ selectedComment: t });
|
|
2037
2047
|
}
|
|
2038
|
-
async function
|
|
2048
|
+
async function Cn(e, t, n, r, i) {
|
|
2039
2049
|
let a = e.getState().currentUser;
|
|
2040
2050
|
if (!a) return;
|
|
2041
|
-
let o =
|
|
2051
|
+
let o = B(i), s = $t(r);
|
|
2042
2052
|
if (!o || s == null) {
|
|
2043
|
-
|
|
2053
|
+
R(e, "invalid_highlight", "Highlight data is invalid");
|
|
2044
2054
|
return;
|
|
2045
2055
|
}
|
|
2046
2056
|
let c = `highlight:${s.xpath}:${s.startOffset}:${o.slice(0, 50)}`;
|
|
2047
2057
|
if (n.has(c)) return;
|
|
2048
2058
|
n.add(c);
|
|
2049
|
-
let l = m(), u =
|
|
2059
|
+
let l = m(), u = I(e), d = u ? { branch: u } : void 0, f = W("temp"), p = {
|
|
2050
2060
|
id: f,
|
|
2051
2061
|
type: "highlight",
|
|
2052
2062
|
...u ? { branch: u } : {},
|
|
@@ -2073,7 +2083,7 @@ async function wn(e, t, n, r, i) {
|
|
|
2073
2083
|
e.setState({ comments: [...e.getState().comments, p] });
|
|
2074
2084
|
try {
|
|
2075
2085
|
let t = await e.apiClient.createHighlight(o, s, l, "medium", f, ...d ? [d] : []);
|
|
2076
|
-
|
|
2086
|
+
K(e, f, t), e.emit("comment:created", t);
|
|
2077
2087
|
} catch (n) {
|
|
2078
2088
|
t.shouldQueueMutation(n) && t.queueMutation("createHighlight", [
|
|
2079
2089
|
o,
|
|
@@ -2089,18 +2099,18 @@ async function wn(e, t, n, r, i) {
|
|
|
2089
2099
|
n.delete(c);
|
|
2090
2100
|
}
|
|
2091
2101
|
}
|
|
2092
|
-
async function
|
|
2102
|
+
async function wn(e, t, n, r, i, a) {
|
|
2093
2103
|
let o = e.getState().currentUser;
|
|
2094
2104
|
if (!o) return;
|
|
2095
|
-
let s =
|
|
2105
|
+
let s = B(a), c = Yt(i), l = tn(r);
|
|
2096
2106
|
if (!s || !c || l == null) {
|
|
2097
|
-
|
|
2107
|
+
R(e, "invalid_drawing", "Drawing comment data is invalid");
|
|
2098
2108
|
return;
|
|
2099
2109
|
}
|
|
2100
2110
|
let u = `drawing:${c.x}:${c.y}:${s.slice(0, 50)}`;
|
|
2101
2111
|
if (n.has(u)) return;
|
|
2102
2112
|
n.add(u);
|
|
2103
|
-
let d = m(), f =
|
|
2113
|
+
let d = m(), f = I(e), p = f ? { branch: f } : void 0, h = W("temp"), g = {
|
|
2104
2114
|
id: h,
|
|
2105
2115
|
type: "drawing",
|
|
2106
2116
|
...f ? { branch: f } : {},
|
|
@@ -2124,7 +2134,7 @@ async function Tn(e, t, n, r, i, a) {
|
|
|
2124
2134
|
e.setState({ comments: [...e.getState().comments, g] });
|
|
2125
2135
|
try {
|
|
2126
2136
|
let t = await e.apiClient.createDrawing(s, l, c, d, h, ...p ? [p] : []);
|
|
2127
|
-
|
|
2137
|
+
K(e, h, t), e.emit("comment:created", t);
|
|
2128
2138
|
} catch (n) {
|
|
2129
2139
|
t.shouldQueueMutation(n) && t.queueMutation("createDrawing", [
|
|
2130
2140
|
s,
|
|
@@ -2141,36 +2151,36 @@ async function Tn(e, t, n, r, i, a) {
|
|
|
2141
2151
|
n.delete(u);
|
|
2142
2152
|
}
|
|
2143
2153
|
}
|
|
2144
|
-
var
|
|
2154
|
+
var Tn = {
|
|
2145
2155
|
c: "comment",
|
|
2146
2156
|
e: "select",
|
|
2147
2157
|
d: "draw",
|
|
2148
2158
|
h: "highlight",
|
|
2149
2159
|
s: "screenshot"
|
|
2150
2160
|
};
|
|
2151
|
-
function
|
|
2161
|
+
function En(e) {
|
|
2152
2162
|
return typeof e.composedPath == "function" ? e.composedPath() : e.target ? [e.target] : [];
|
|
2153
2163
|
}
|
|
2154
|
-
function
|
|
2164
|
+
function J(e) {
|
|
2155
2165
|
return typeof Element < "u" && e instanceof Element;
|
|
2156
2166
|
}
|
|
2157
|
-
function
|
|
2158
|
-
if (!
|
|
2167
|
+
function Dn(e) {
|
|
2168
|
+
if (!J(e)) return !1;
|
|
2159
2169
|
let t = e.tagName.toLowerCase();
|
|
2160
2170
|
return t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("role") === "textbox";
|
|
2161
2171
|
}
|
|
2162
|
-
function
|
|
2172
|
+
function On(e) {
|
|
2163
2173
|
let t = e.activeElement;
|
|
2164
2174
|
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
2165
2175
|
return t;
|
|
2166
2176
|
}
|
|
2167
|
-
function
|
|
2168
|
-
return
|
|
2177
|
+
function kn(e) {
|
|
2178
|
+
return En(e).some(Dn) ? !0 : typeof document > "u" ? !1 : Dn(On(document));
|
|
2169
2179
|
}
|
|
2170
|
-
function
|
|
2171
|
-
return
|
|
2180
|
+
function An(e) {
|
|
2181
|
+
return En(e).some((e) => J(e) && (e.hasAttribute("data-commentkit") || e.hasAttribute("data-commentkit-ui") || e.hasAttribute("data-commentkit-host")));
|
|
2172
2182
|
}
|
|
2173
|
-
var
|
|
2183
|
+
var jn = [
|
|
2174
2184
|
"popover",
|
|
2175
2185
|
"dialog",
|
|
2176
2186
|
"alert-dialog",
|
|
@@ -2180,23 +2190,23 @@ var Mn = [
|
|
|
2180
2190
|
"select",
|
|
2181
2191
|
"combobox"
|
|
2182
2192
|
].map((e) => `[data-slot="${e}-content"][data-open]`).join(",");
|
|
2183
|
-
function
|
|
2184
|
-
let t =
|
|
2185
|
-
if (
|
|
2193
|
+
function Mn(e) {
|
|
2194
|
+
let t = En(e), n = t.find((e) => J(e) && e.hasAttribute("data-commentkit-host"));
|
|
2195
|
+
if (J(n)) return !!n.shadowRoot?.querySelector(jn);
|
|
2186
2196
|
if (typeof document < "u" && (t[0] === document.body || t[0] === document.documentElement)) {
|
|
2187
2197
|
let e = document.querySelectorAll("[data-commentkit-host]");
|
|
2188
|
-
return e.length === 1 && !!e[0]?.shadowRoot?.querySelector(
|
|
2198
|
+
return e.length === 1 && !!e[0]?.shadowRoot?.querySelector(jn);
|
|
2189
2199
|
}
|
|
2190
2200
|
return !1;
|
|
2191
2201
|
}
|
|
2192
|
-
function
|
|
2202
|
+
function Nn(e) {
|
|
2193
2203
|
return (e.ctrlKey || e.metaKey) && e.shiftKey && (e.key === "K" || e.key === "k" || e.code === "KeyK");
|
|
2194
2204
|
}
|
|
2195
|
-
function
|
|
2205
|
+
function Pn(e) {
|
|
2196
2206
|
let t = e.key.toLowerCase(), n = e.code.startsWith("Key") ? e.code.slice(3).toLowerCase() : "";
|
|
2197
|
-
return
|
|
2207
|
+
return Tn[t] ?? Tn[n] ?? null;
|
|
2198
2208
|
}
|
|
2199
|
-
function
|
|
2209
|
+
function Fn(e) {
|
|
2200
2210
|
e.preventDefault(), e.stopPropagation();
|
|
2201
2211
|
}
|
|
2202
2212
|
function In(e, t) {
|
|
@@ -2215,23 +2225,23 @@ function Ln(e, t) {
|
|
|
2215
2225
|
}
|
|
2216
2226
|
function Rn(e, t, n) {
|
|
2217
2227
|
if (e.defaultPrevented || e.repeat || e.isComposing) return;
|
|
2218
|
-
let r =
|
|
2219
|
-
if (
|
|
2228
|
+
let r = kn(e), i = An(e);
|
|
2229
|
+
if (Nn(e)) {
|
|
2220
2230
|
if (r) return;
|
|
2221
|
-
|
|
2231
|
+
Fn(e), Ln(t, n);
|
|
2222
2232
|
} else if (e.key === "Escape") {
|
|
2223
|
-
if (
|
|
2224
|
-
In(t, n) &&
|
|
2233
|
+
if (Mn(e) || r && !i) return;
|
|
2234
|
+
In(t, n) && Fn(e);
|
|
2225
2235
|
} else if (t.isAuthenticated && (t.isOverlayVisible || t.activeTool !== null) && !r && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
2226
2236
|
if (e.key === "?") {
|
|
2227
|
-
|
|
2237
|
+
Fn(e), n.toggleShortcutsOverlay();
|
|
2228
2238
|
return;
|
|
2229
2239
|
}
|
|
2230
|
-
let r =
|
|
2231
|
-
r && (
|
|
2240
|
+
let r = Pn(e);
|
|
2241
|
+
r && (Fn(e), n.setTool(t.activeTool === r ? null : r));
|
|
2232
2242
|
}
|
|
2233
2243
|
}
|
|
2234
|
-
var zn =
|
|
2244
|
+
var zn = M.PENDING_MUTATIONS, Bn = M.RETRY_DELAY, Y = M.ID, Vn = M.CONTENT, Hn = M.REPLY_CONTENT, Un = M.SELECTOR, Wn = M.EMOJI, Gn = /* @__PURE__ */ new Set([
|
|
2235
2245
|
"createComment",
|
|
2236
2246
|
"createHighlight",
|
|
2237
2247
|
"createDrawing",
|
|
@@ -2257,7 +2267,7 @@ function Yn(t) {
|
|
|
2257
2267
|
return o(t) && e(t.x) && e(t.y) && n(t.element, Un) && n(t.xpath, Un);
|
|
2258
2268
|
}
|
|
2259
2269
|
function Xn(e) {
|
|
2260
|
-
return typeof e == "string" && e.length <=
|
|
2270
|
+
return typeof e == "string" && e.length <= M.PAGE && !a(e);
|
|
2261
2271
|
}
|
|
2262
2272
|
function Zn(e) {
|
|
2263
2273
|
return e === void 0 || o(e) && Xn(e.url) && Xn(e.path) && Xn(e.title);
|
|
@@ -2459,7 +2469,7 @@ function Sr(e, t, n) {
|
|
|
2459
2469
|
if (t.current || e.getState().pendingMutations.length === 0) return;
|
|
2460
2470
|
let r = e.getState().pendingMutations[0];
|
|
2461
2471
|
if (!r) return;
|
|
2462
|
-
let i = er(r.retries), a = Math.min(Bn,
|
|
2472
|
+
let i = er(r.retries), a = Math.min(Bn, At * 2 ** i);
|
|
2463
2473
|
t.current = setTimeout(() => {
|
|
2464
2474
|
t.current = null, n();
|
|
2465
2475
|
}, a);
|
|
@@ -2491,7 +2501,7 @@ async function Cr(e, t, n, i) {
|
|
|
2491
2501
|
try {
|
|
2492
2502
|
await l(o);
|
|
2493
2503
|
let r = e.getState().pendingMutations.filter((e) => e.id !== o.id);
|
|
2494
|
-
e.setState({ pendingMutations: r }), e.emit("offline:completed", { id: o.id }), r.length > 0 ? X(n) : t.reconcileAfterDrain && (t.reconcileAfterDrain = !1,
|
|
2504
|
+
e.setState({ pendingMutations: r }), e.emit("offline:completed", { id: o.id }), r.length > 0 ? X(n) : t.reconcileAfterDrain && (t.reconcileAfterDrain = !1, cn(e));
|
|
2495
2505
|
} catch (r) {
|
|
2496
2506
|
let i = {
|
|
2497
2507
|
...o,
|
|
@@ -2502,7 +2512,7 @@ async function Cr(e, t, n, i) {
|
|
|
2502
2512
|
e.setState({ pendingMutations: t }), X(n);
|
|
2503
2513
|
} else {
|
|
2504
2514
|
let i = e.getState().pendingMutations.filter((e) => e.id !== o.id);
|
|
2505
|
-
e.setState({ pendingMutations: i }), Z(e, o.id, rr(r)), i.length > 0 ? (t.reconcileAfterDrain = !0, X(n)) : (t.reconcileAfterDrain = !1,
|
|
2515
|
+
e.setState({ pendingMutations: i }), Z(e, o.id, rr(r)), i.length > 0 ? (t.reconcileAfterDrain = !0, X(n)) : (t.reconcileAfterDrain = !1, cn(e));
|
|
2506
2516
|
}
|
|
2507
2517
|
} finally {
|
|
2508
2518
|
t.current = !1;
|
|
@@ -2577,7 +2587,7 @@ function Q(e, t, n, r, i = !1) {
|
|
|
2577
2587
|
reactions: o.reactions
|
|
2578
2588
|
});
|
|
2579
2589
|
}
|
|
2580
|
-
i ?
|
|
2590
|
+
i ? K(e, r, s) : e.setState({ comments: a.comments.map((e) => e.id === r ? s : e) });
|
|
2581
2591
|
}
|
|
2582
2592
|
function Er(e, t, n, r) {
|
|
2583
2593
|
e.setState({ pendingMutations: e.getState().pendingMutations.map((e) => e.type === "reactToComment" && e.args[0] === t && e.args[3] === n ? {
|
|
@@ -2634,7 +2644,7 @@ async function Dr(e, t) {
|
|
|
2634
2644
|
let [n, r, i] = t.args, a = await e.apiClient.addReply(n, r, t.tempId, ...i ? [i] : []);
|
|
2635
2645
|
if (a && t.tempId) {
|
|
2636
2646
|
let r = e.getState().comments.find((e) => e.id === n), i = e.getState().pendingMutations.some((e) => e.type === "reactToComment" && e.ownerId === t.ownerId && e.args[0] === n && e.args[3] === t.tempId), o = r?.replies.find((e) => e.id === t.tempId);
|
|
2637
|
-
|
|
2647
|
+
on(e, n, t.tempId, i && o ? {
|
|
2638
2648
|
...a,
|
|
2639
2649
|
reactions: o.reactions
|
|
2640
2650
|
} : a), Er(e, n, t.tempId, a.id);
|
|
@@ -2657,7 +2667,7 @@ async function Dr(e, t) {
|
|
|
2657
2667
|
}
|
|
2658
2668
|
var $ = null;
|
|
2659
2669
|
async function Or() {
|
|
2660
|
-
return $ || ($ = await import("./realtime-
|
|
2670
|
+
return $ || ($ = await import("./realtime-C0Z8dXXH.js"), $);
|
|
2661
2671
|
}
|
|
2662
2672
|
var kr = typeof window < "u", Ar = /* @__PURE__ */ new Set([
|
|
2663
2673
|
"list",
|
|
@@ -2672,7 +2682,7 @@ var kr = typeof window < "u", Ar = /* @__PURE__ */ new Set([
|
|
|
2672
2682
|
"screenshot",
|
|
2673
2683
|
"select",
|
|
2674
2684
|
null
|
|
2675
|
-
]), Mr = 256, Nr = "0.7.
|
|
2685
|
+
]), Mr = 256, Nr = "0.7.6";
|
|
2676
2686
|
function Pr(e) {
|
|
2677
2687
|
let t = e.trim().match(/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:[-+].*)?$/);
|
|
2678
2688
|
return t ? [
|
|
@@ -2695,7 +2705,7 @@ function Ir(e, t) {
|
|
|
2695
2705
|
}
|
|
2696
2706
|
return !1;
|
|
2697
2707
|
}
|
|
2698
|
-
var Lr = class extends
|
|
2708
|
+
var Lr = class extends et {
|
|
2699
2709
|
get isProcessingQueue() {
|
|
2700
2710
|
return this.queueGuard.current;
|
|
2701
2711
|
}
|
|
@@ -2726,7 +2736,7 @@ var Lr = class extends tt {
|
|
|
2726
2736
|
}, this.config.ui = {
|
|
2727
2737
|
...this.config.ui,
|
|
2728
2738
|
loadRemoteFonts: !1
|
|
2729
|
-
}), kr && !this.config.environment && (this.config.environment = this.detectEnvironment()), this.apiClient = this.localDemo?.client ?? new ve(this.config), this.apiClient.setOnAuthExpired(() => this.handleAuthExpired()), this.state =
|
|
2739
|
+
}), kr && !this.config.environment && (this.config.environment = this.detectEnvironment()), this.apiClient = this.localDemo?.client ?? new ve(this.config), this.apiClient.setOnAuthExpired(() => this.handleAuthExpired()), this.state = jt(), this.state.activeBranch = typeof e.branch == "string" && e.branch.trim().length <= 255 && !a(e.branch) && e.branch.trim() || null, this.requiresShortcut() && (this.state.isOverlayVisible = !1), this.screenshotProvider = e.screenshotProvider || null, this.ctx = {
|
|
2730
2740
|
getState: () => this.getInternalState(),
|
|
2731
2741
|
setState: (e) => this.setState(e),
|
|
2732
2742
|
apiClient: this.apiClient,
|
|
@@ -2764,7 +2774,7 @@ var Lr = class extends tt {
|
|
|
2764
2774
|
if (!this.localDemo || this.destroyed) return;
|
|
2765
2775
|
let e = this.localDemo.getSession().expired, t = this.getInternalState().activeBranch ?? null;
|
|
2766
2776
|
this.overlayBeforeTool = null, this.setState({
|
|
2767
|
-
...
|
|
2777
|
+
...jt(),
|
|
2768
2778
|
currentUser: e ? null : { ...this.localDemo.user },
|
|
2769
2779
|
isAuthenticated: !e,
|
|
2770
2780
|
isOverlayVisible: !e,
|
|
@@ -2809,7 +2819,7 @@ var Lr = class extends tt {
|
|
|
2809
2819
|
e?.mode === "hold" && e.key && (this.holdActivationHandler = (e) => {
|
|
2810
2820
|
if (this.destroyed || !this.matchesHoldKey(e)) return;
|
|
2811
2821
|
let t = this.getInternalState().activeTool;
|
|
2812
|
-
e.type === "keydown" && !t && !
|
|
2822
|
+
e.type === "keydown" && !t && !j() ? this.setTool("select") : e.type === "keyup" && t === "select" && this.setTool(null);
|
|
2813
2823
|
}, window.addEventListener("keydown", this.holdActivationHandler), window.addEventListener("keyup", this.holdActivationHandler), this.holdBlurHandler = () => {
|
|
2814
2824
|
this.destroyed || this.getInternalState().activeTool === "select" && this.setTool(null);
|
|
2815
2825
|
}, window.addEventListener("blur", this.holdBlurHandler)), this.toggleHandler = () => this.handleToggleRequest(), window.addEventListener("commentkit:toggle-overlay", this.toggleHandler), this.hashChangeHandler = () => this.handleDeepLink(), window.addEventListener("hashchange", this.hashChangeHandler), this.handleDeepLink(), !this.localDemo && (this.onlineHandler = () => {
|
|
@@ -2857,7 +2867,7 @@ var Lr = class extends tt {
|
|
|
2857
2867
|
};
|
|
2858
2868
|
}
|
|
2859
2869
|
let n = e.project?.sdkLatestVersion;
|
|
2860
|
-
n && Ir(n, "0.7.
|
|
2870
|
+
n && Ir(n, "0.7.6") && (console.warn(`[CommentKit] You are using v${Nr}. Update to v${n}: npm update @commentkit/comment-kit`), this.emit("sdk:outdated", {
|
|
2861
2871
|
current: Nr,
|
|
2862
2872
|
latest: n
|
|
2863
2873
|
})), this.setState({
|
|
@@ -2934,7 +2944,7 @@ var Lr = class extends tt {
|
|
|
2934
2944
|
e.activeTool !== void 0 && e.activeTool !== t.activeTool && this.emit("tool:changed", e.activeTool), e.isOverlayVisible !== void 0 && e.isOverlayVisible !== t.isOverlayVisible && this.emit("overlay:toggled", e.isOverlayVisible), e.isSidebarVisible !== void 0 && e.isSidebarVisible !== t.isSidebarVisible && this.emit("sidebar:toggled", e.isSidebarVisible), e.isLoginModalVisible !== void 0 && e.isLoginModalVisible !== t.isLoginModalVisible && this.emit("loginmodal:toggled", e.isLoginModalVisible), e.isShortcutsOverlayVisible !== void 0 && e.isShortcutsOverlayVisible !== t.isShortcutsOverlayVisible && this.emit("shortcuts:toggled", e.isShortcutsOverlayVisible), e.connectionStatus !== void 0 && e.connectionStatus !== t.connectionStatus && this.emit("connection:changed", e.connectionStatus);
|
|
2935
2945
|
let n = Object.keys(e);
|
|
2936
2946
|
for (let [e, t] of this.sliceSubscribers) {
|
|
2937
|
-
let r =
|
|
2947
|
+
let r = Ot[e];
|
|
2938
2948
|
if (n.some((e) => r.includes(e))) for (let n of t) try {
|
|
2939
2949
|
n(this.state);
|
|
2940
2950
|
} catch (t) {
|
|
@@ -2963,7 +2973,7 @@ var Lr = class extends tt {
|
|
|
2963
2973
|
return this.getWriteAccess().canWrite;
|
|
2964
2974
|
}
|
|
2965
2975
|
getWriteAccess() {
|
|
2966
|
-
return
|
|
2976
|
+
return Xe(this.config, this.getInternalState(), this.writeRestriction);
|
|
2967
2977
|
}
|
|
2968
2978
|
requireCommentWrite() {
|
|
2969
2979
|
let e = this.getWriteAccess();
|
|
@@ -2986,10 +2996,12 @@ var Lr = class extends tt {
|
|
|
2986
2996
|
};
|
|
2987
2997
|
}
|
|
2988
2998
|
async validateInvite(e) {
|
|
2989
|
-
if (
|
|
2999
|
+
if (this.destroyed || this.localDemo) return;
|
|
3000
|
+
let t = this.beginAuthRequest();
|
|
3001
|
+
return Dt(this.ctx, e, (e) => bt(this.ctx, e, t), t);
|
|
2990
3002
|
}
|
|
2991
3003
|
onSlice(e, t) {
|
|
2992
|
-
if (!
|
|
3004
|
+
if (!Ot[e] || typeof t != "function" || this.destroyed) return () => {};
|
|
2993
3005
|
let n = this.sliceSubscribers.get(e);
|
|
2994
3006
|
return n || (n = /* @__PURE__ */ new Set(), this.sliceSubscribers.set(e, n)), n.add(t), () => n.delete(t);
|
|
2995
3007
|
}
|
|
@@ -3039,12 +3051,12 @@ var Lr = class extends tt {
|
|
|
3039
3051
|
}), this.emit("error", r);
|
|
3040
3052
|
}
|
|
3041
3053
|
async restorePersistedSession() {
|
|
3042
|
-
this.config.persistence === "memory" &&
|
|
3043
|
-
let e = this.initialAuthToken === void 0 ? this.config.persistence === "memory" ? void 0 :
|
|
3054
|
+
this.config.persistence === "memory" && lt(this.config.projectId);
|
|
3055
|
+
let e = this.initialAuthToken === void 0 ? this.config.persistence === "memory" ? void 0 : ct(this.config.projectId)?.token : this.initialAuthToken;
|
|
3044
3056
|
if (this.initialAuthToken = void 0, e === void 0) return;
|
|
3045
3057
|
let t = () => !this.destroyed && this.authRequestRevision === 0;
|
|
3046
3058
|
try {
|
|
3047
|
-
let { verifyAndRestoreToken: n } = await import("./token-session-
|
|
3059
|
+
let { verifyAndRestoreToken: n } = await import("./token-session-DplW5QDx.js");
|
|
3048
3060
|
await n(this.ctx, e, t, this.config.persistence !== "memory") && await this.afterAuthenticated();
|
|
3049
3061
|
} catch {
|
|
3050
3062
|
t() && this.handleAuthExpired();
|
|
@@ -3064,7 +3076,7 @@ var Lr = class extends tt {
|
|
|
3064
3076
|
return () => !this.destroyed && e === this.authRequestRevision;
|
|
3065
3077
|
}
|
|
3066
3078
|
async login(e) {
|
|
3067
|
-
if (!(this.destroyed || this.localDemo)) return
|
|
3079
|
+
if (!(this.destroyed || this.localDemo)) return this.config.inviteToken ? this.validateInvite(e) : bt(this.ctx, e, this.beginAuthRequest());
|
|
3068
3080
|
}
|
|
3069
3081
|
async verifyOtp(e) {
|
|
3070
3082
|
if (this.destroyed || this.localDemo) return;
|
|
@@ -3079,13 +3091,13 @@ var Lr = class extends tt {
|
|
|
3079
3091
|
return;
|
|
3080
3092
|
}
|
|
3081
3093
|
let n = this.getInternalState().currentUser?.id;
|
|
3082
|
-
return
|
|
3094
|
+
return xt(this.ctx, e, {
|
|
3083
3095
|
isCurrent: this.beginAuthRequest(),
|
|
3084
3096
|
onAuthenticated: async () => {
|
|
3085
3097
|
await this.afterAuthenticated(n);
|
|
3086
3098
|
},
|
|
3087
3099
|
onSuccess: () => {
|
|
3088
|
-
this.otpFailedAttempts = 0, this.otpCooldownUntil = 0;
|
|
3100
|
+
this.config.inviteToken = void 0, this.otpFailedAttempts = 0, this.otpCooldownUntil = 0;
|
|
3089
3101
|
},
|
|
3090
3102
|
onWrongOtp: () => {
|
|
3091
3103
|
if (this.otpFailedAttempts += 1, this.otpFailedAttempts >= 3) {
|
|
@@ -3096,24 +3108,26 @@ var Lr = class extends tt {
|
|
|
3096
3108
|
});
|
|
3097
3109
|
}
|
|
3098
3110
|
cancelOtp() {
|
|
3099
|
-
this.destroyed || (this.authRequestRevision++,
|
|
3111
|
+
this.destroyed || (this.authRequestRevision++, St(this.ctx));
|
|
3100
3112
|
}
|
|
3101
3113
|
async resendOtp() {
|
|
3102
|
-
if (
|
|
3114
|
+
if (this.destroyed || this.localDemo) return;
|
|
3115
|
+
let e = this.getInternalState().otpEmail;
|
|
3116
|
+
return this.config.inviteToken && e ? this.validateInvite(e) : Ct(this.ctx, this.beginAuthRequest());
|
|
3103
3117
|
}
|
|
3104
3118
|
logout() {
|
|
3105
3119
|
this.destroyed || (this.authRequestRevision++, this.localDemo ? (this.setTool(null), this.setState({
|
|
3106
3120
|
isOverlayVisible: !1,
|
|
3107
3121
|
isSidebarVisible: !1
|
|
3108
|
-
})) : (this.sessionRevision++, this.draftUploads = /* @__PURE__ */ new WeakMap(), this.writeRestriction = null, this.setState({ projectContext: null }), this.overlayBeforeTool = null,
|
|
3122
|
+
})) : (this.sessionRevision++, this.draftUploads = /* @__PURE__ */ new WeakMap(), this.writeRestriction = null, this.setState({ projectContext: null }), this.overlayBeforeTool = null, wt(this.ctx, () => {
|
|
3109
3123
|
this.disconnectRealtime(!0);
|
|
3110
3124
|
})));
|
|
3111
3125
|
}
|
|
3112
3126
|
handleAuthExpired() {
|
|
3113
|
-
this.destroyed || (this.authRequestRevision++, this.sessionRevision++, this.draftUploads = /* @__PURE__ */ new WeakMap(), this.writeRestriction = null, this.setState({ projectContext: null }), this.overlayBeforeTool = null, this.disconnectRealtime(!0),
|
|
3127
|
+
this.destroyed || (this.authRequestRevision++, this.sessionRevision++, this.draftUploads = /* @__PURE__ */ new WeakMap(), this.writeRestriction = null, this.setState({ projectContext: null }), this.overlayBeforeTool = null, this.disconnectRealtime(!0), Tt(this.ctx));
|
|
3114
3128
|
}
|
|
3115
3129
|
toggleLoginModal() {
|
|
3116
|
-
this.destroyed || this.localDemo || (this.getInternalState().isLoginModalVisible && this.cancelOtp(),
|
|
3130
|
+
this.destroyed || this.localDemo || (this.getInternalState().isLoginModalVisible && this.cancelOtp(), Et(this.ctx));
|
|
3117
3131
|
}
|
|
3118
3132
|
requiresShortcut() {
|
|
3119
3133
|
return this.localDemo ? !0 : this.config.environment !== "development";
|
|
@@ -3204,10 +3218,10 @@ var Lr = class extends tt {
|
|
|
3204
3218
|
};
|
|
3205
3219
|
}
|
|
3206
3220
|
async loadComments() {
|
|
3207
|
-
return
|
|
3221
|
+
return cn(this.commentsRequestContext(++this.commentsFetchRevision));
|
|
3208
3222
|
}
|
|
3209
3223
|
async loadMoreComments() {
|
|
3210
|
-
this.destroyed || await
|
|
3224
|
+
this.destroyed || await ln(this.commentsRequestContext(this.commentsFetchRevision), this.loadMoreGuard);
|
|
3211
3225
|
}
|
|
3212
3226
|
async setCommentQuery(e) {
|
|
3213
3227
|
if (this.destroyed || !this.getInternalState().isAuthenticated || this.localDemo) return;
|
|
@@ -3223,7 +3237,7 @@ var Lr = class extends tt {
|
|
|
3223
3237
|
}
|
|
3224
3238
|
async loadEarlierReplies() {
|
|
3225
3239
|
let e = this.getInternalState(), t = e.comments.find((t) => t.id === e.selectedComment?.id);
|
|
3226
|
-
if (!(this.destroyed || e.loadingThreadId || !t?.repliesPagination?.nextCursor)) return
|
|
3240
|
+
if (!(this.destroyed || e.loadingThreadId || !t?.repliesPagination?.nextCursor)) return un(this.operationContext(), t.id, t.repliesPagination.nextCursor);
|
|
3227
3241
|
}
|
|
3228
3242
|
async reloadComments() {
|
|
3229
3243
|
if (!this.destroyed) return this.loadComments();
|
|
@@ -3327,45 +3341,55 @@ var Lr = class extends tt {
|
|
|
3327
3341
|
});
|
|
3328
3342
|
return;
|
|
3329
3343
|
}
|
|
3330
|
-
let s = o?.[
|
|
3331
|
-
return
|
|
3344
|
+
let s = o?.[tt];
|
|
3345
|
+
return dn(this.operationContext(s), this.operationCallbacks(s), this.activeMutations, e, t, n, r, i, a, {
|
|
3332
3346
|
...o,
|
|
3333
|
-
branch: o?.branch ??
|
|
3347
|
+
branch: o?.branch ?? I(this.ctx)
|
|
3334
3348
|
});
|
|
3335
3349
|
}
|
|
3336
3350
|
async updateComment(e, t) {
|
|
3337
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3351
|
+
if (!this.destroyed && this.requireCommentWrite()) return fn(this.operationContext(), this.operationCallbacks(), e, t);
|
|
3338
3352
|
}
|
|
3339
3353
|
async deleteComment(e) {
|
|
3340
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3354
|
+
if (!this.destroyed && this.requireCommentWrite()) return pn(this.operationContext(), this.operationCallbacks(), e);
|
|
3341
3355
|
}
|
|
3342
3356
|
async addReply(e, t, n) {
|
|
3343
3357
|
if (this.destroyed || !this.requireCommentWrite()) return;
|
|
3344
|
-
let { [
|
|
3345
|
-
return
|
|
3358
|
+
let { [tt]: r, ...i } = n ?? {};
|
|
3359
|
+
return mn(this.operationContext(r), this.operationCallbacks(r), e, t, n ? i : void 0);
|
|
3346
3360
|
}
|
|
3347
3361
|
async updateReply(e, t, n, r) {
|
|
3348
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3362
|
+
if (!this.destroyed && this.requireCommentWrite()) return hn(this.operationContext(), e, t, n, r);
|
|
3349
3363
|
}
|
|
3350
3364
|
async deleteReply(e, t) {
|
|
3351
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3365
|
+
if (!this.destroyed && this.requireCommentWrite()) return gn(this.operationContext(), e, t);
|
|
3366
|
+
}
|
|
3367
|
+
requireThreadStatus(e, t = !1) {
|
|
3368
|
+
let n = this.getInternalState();
|
|
3369
|
+
if (n.projectContext?.permissions?.accessScope !== "project") return !0;
|
|
3370
|
+
let r = n.comments.find((t) => t.id === e)?.author.id === n.currentUser?.id;
|
|
3371
|
+
return !t && r ? !0 : (this.handleError({
|
|
3372
|
+
error: "forbidden",
|
|
3373
|
+
message: t ? "Only workspace members can mark feedback complete." : "You can only resolve or reopen your own feedback.",
|
|
3374
|
+
code: 403
|
|
3375
|
+
}), !1);
|
|
3352
3376
|
}
|
|
3353
3377
|
async resolveComment(e) {
|
|
3354
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3378
|
+
if (!this.destroyed && this.requireCommentWrite() && this.requireThreadStatus(e)) return _n(this.operationContext(), this.operationCallbacks(), e);
|
|
3355
3379
|
}
|
|
3356
3380
|
async unresolveComment(e) {
|
|
3357
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3381
|
+
if (!this.destroyed && this.requireCommentWrite() && this.requireThreadStatus(e)) return vn(this.operationContext(), this.operationCallbacks(), e);
|
|
3358
3382
|
}
|
|
3359
3383
|
selectComment(e) {
|
|
3360
|
-
this.destroyed || (
|
|
3384
|
+
this.destroyed || (Sn(this.operationContext(), e), e?.detailLoaded === !1 && !this.localDemo && un(this.operationContext(), e.id));
|
|
3361
3385
|
}
|
|
3362
3386
|
async completeComment(e) {
|
|
3363
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3387
|
+
if (!this.destroyed && this.requireCommentWrite() && this.requireThreadStatus(e, !0)) return yn(this.operationContext(), this.operationCallbacks(), e);
|
|
3364
3388
|
}
|
|
3365
3389
|
async reactToComment(e, t, n) {
|
|
3366
3390
|
if (this.destroyed || !this.requireCommentWrite()) return;
|
|
3367
3391
|
let r = `${e}:${n ?? "parent"}`, i = this.sessionRevision, a = async () => {
|
|
3368
|
-
!this.destroyed && i === this.sessionRevision && this.requireCommentWrite() && await
|
|
3392
|
+
!this.destroyed && i === this.sessionRevision && this.requireCommentWrite() && await bn(this.operationContext(), this.operationCallbacks(), e, t, n);
|
|
3369
3393
|
}, o = this.reactionRequests.get(r), s = o ? o.then(a, a) : a();
|
|
3370
3394
|
this.reactionRequests.set(r, s);
|
|
3371
3395
|
try {
|
|
@@ -3375,7 +3399,7 @@ var Lr = class extends tt {
|
|
|
3375
3399
|
}
|
|
3376
3400
|
}
|
|
3377
3401
|
async updateCommentPosition(e, t, n) {
|
|
3378
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3402
|
+
if (!this.destroyed && this.requireCommentWrite()) return xn(this.operationContext(), this.operationCallbacks(), e, t, n);
|
|
3379
3403
|
}
|
|
3380
3404
|
hydrateOfflineQueue() {
|
|
3381
3405
|
if (this.config.persistence === "memory") return;
|
|
@@ -3493,10 +3517,10 @@ var Lr = class extends tt {
|
|
|
3493
3517
|
}
|
|
3494
3518
|
}
|
|
3495
3519
|
async createHighlight(e, t) {
|
|
3496
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3520
|
+
if (!this.destroyed && this.requireCommentWrite()) return Cn(this.operationContext(), this.operationCallbacks(), this.activeMutations, e, t);
|
|
3497
3521
|
}
|
|
3498
3522
|
async createDrawing(e, t, n) {
|
|
3499
|
-
if (!this.destroyed && this.requireCommentWrite()) return
|
|
3523
|
+
if (!this.destroyed && this.requireCommentWrite()) return wn(this.operationContext(), this.operationCallbacks(), this.activeMutations, e, t, n);
|
|
3500
3524
|
}
|
|
3501
3525
|
setActiveDrawing(e) {
|
|
3502
3526
|
this.destroyed || this.setState({ activeDrawing: e });
|
|
@@ -3506,12 +3530,12 @@ var Lr = class extends tt {
|
|
|
3506
3530
|
}
|
|
3507
3531
|
async captureScreenshot(e) {
|
|
3508
3532
|
if (this.destroyed) return null;
|
|
3509
|
-
let { captureScreenshot: t } = await import("./screenshot-
|
|
3533
|
+
let { captureScreenshot: t } = await import("./screenshot-B-ZfFItT.js");
|
|
3510
3534
|
return this.destroyed ? null : t(this.ctx, this.screenshotProvider, e);
|
|
3511
3535
|
}
|
|
3512
3536
|
async uploadScreenshot(e, t, n) {
|
|
3513
3537
|
if (this.destroyed || !this.requireCommentWrite()) return null;
|
|
3514
|
-
let r = this.operationContext(), { uploadScreenshot: i } = await import("./screenshot-
|
|
3538
|
+
let r = this.operationContext(), { uploadScreenshot: i } = await import("./screenshot-B-ZfFItT.js");
|
|
3515
3539
|
return this.destroyed || r.isCurrent?.() === !1 || !this.requireCommentWrite() ? null : i(r, e, t, n);
|
|
3516
3540
|
}
|
|
3517
3541
|
setActiveScreenshot(e) {
|
|
@@ -3519,14 +3543,18 @@ var Lr = class extends tt {
|
|
|
3519
3543
|
}
|
|
3520
3544
|
async uploadFiles(e, t) {
|
|
3521
3545
|
if (this.destroyed || !this.requireCommentWrite()) return [];
|
|
3522
|
-
let n = this.operationContext(), { uploadFiles: r } = await import("./screenshot-
|
|
3546
|
+
let n = this.operationContext(), { uploadFiles: r } = await import("./screenshot-B-ZfFItT.js");
|
|
3523
3547
|
return this.destroyed || n.isCurrent?.() === !1 || !this.requireCommentWrite() ? [] : r(n, e, t);
|
|
3524
3548
|
}
|
|
3549
|
+
requireAgentExport() {
|
|
3550
|
+
if (this.getInternalState().projectContext?.permissions.canExportAgentContext === !1) throw new E("forbidden", "Agent handoff is available to workspace members.", 403);
|
|
3551
|
+
}
|
|
3525
3552
|
getAgentContext(e) {
|
|
3526
|
-
return
|
|
3553
|
+
return this.requireAgentExport(), k(this.getInternalState(), e);
|
|
3527
3554
|
}
|
|
3528
3555
|
async getAgentContextAsync(e) {
|
|
3529
|
-
|
|
3556
|
+
this.requireAgentExport();
|
|
3557
|
+
let t = this.getInternalState(), n = k(t, e);
|
|
3530
3558
|
if (!this.localDemo && t.isAuthenticated) {
|
|
3531
3559
|
let r = new Set(n.comments.map((e) => e.id)), i = t.comments.filter((e) => r.has(e.id) && e.detailLoaded === !1), a = /* @__PURE__ */ new Map(), o = this.sessionRevision;
|
|
3532
3560
|
for (let e = 0; e < i.length; e += 4) {
|
|
@@ -3534,32 +3562,34 @@ var Lr = class extends tt {
|
|
|
3534
3562
|
if (this.destroyed || o !== this.sessionRevision || !this.getInternalState().isAuthenticated) throw new E("unauthorized", "Sign in again to copy feedback.", 401);
|
|
3535
3563
|
for (let e of t) a.set(e.id, e);
|
|
3536
3564
|
}
|
|
3537
|
-
a.size && (n =
|
|
3565
|
+
a.size && (n = k({
|
|
3538
3566
|
...t,
|
|
3539
3567
|
comments: t.comments.map((e) => a.get(e.id) ?? e)
|
|
3540
3568
|
}, e));
|
|
3541
3569
|
}
|
|
3542
|
-
let r = this.localDemo?.getRevision(), i = await
|
|
3543
|
-
return this.localDemo?.checkExpiry(), this.localDemo && r !== this.localDemo.getRevision() ?
|
|
3570
|
+
let r = this.localDemo?.getRevision(), i = await He(n);
|
|
3571
|
+
return this.localDemo?.checkExpiry(), this.localDemo && r !== this.localDemo.getRevision() ? k(this.getInternalState(), e) : i;
|
|
3544
3572
|
}
|
|
3545
3573
|
formatAgentContext(e) {
|
|
3546
|
-
return
|
|
3574
|
+
return A(this.getAgentContext(e));
|
|
3547
3575
|
}
|
|
3548
3576
|
async formatAgentContextAsync(e) {
|
|
3549
|
-
return
|
|
3577
|
+
return A(await this.getAgentContextAsync(e));
|
|
3550
3578
|
}
|
|
3551
3579
|
async copyAgentContext(e) {
|
|
3552
3580
|
if (this.destroyed) return "";
|
|
3553
|
-
let t = await this.getAgentContextAsync(e), n =
|
|
3554
|
-
return await
|
|
3581
|
+
let t = await this.getAgentContextAsync(e), n = A(t);
|
|
3582
|
+
return await Ye(n, t), this.emit("agent:context-copied", {
|
|
3555
3583
|
commentCount: t.comments.length,
|
|
3556
3584
|
sourceResolved: t.sourceResolved
|
|
3557
3585
|
}), n;
|
|
3558
3586
|
}
|
|
3559
3587
|
async grabElement(e, t) {
|
|
3560
3588
|
if (this.destroyed) return null;
|
|
3561
|
-
|
|
3589
|
+
this.requireAgentExport();
|
|
3590
|
+
let { grabElement: n } = await import("./dev-grab-O8q25zar.js");
|
|
3562
3591
|
if (this.destroyed) return null;
|
|
3592
|
+
this.requireAgentExport();
|
|
3563
3593
|
let r = await n(e, this.ctx, this.screenshotProvider, t);
|
|
3564
3594
|
return this.destroyed ? null : (r && this.emit("agent:element-grabbed", {
|
|
3565
3595
|
source: r.element.source?.filePath ?? null,
|
|
@@ -3568,8 +3598,10 @@ var Lr = class extends tt {
|
|
|
3568
3598
|
}
|
|
3569
3599
|
async grabElements(e, t) {
|
|
3570
3600
|
if (this.destroyed) return null;
|
|
3571
|
-
|
|
3601
|
+
this.requireAgentExport();
|
|
3602
|
+
let { grabElements: n } = await import("./dev-grab-O8q25zar.js");
|
|
3572
3603
|
if (this.destroyed) return null;
|
|
3604
|
+
this.requireAgentExport();
|
|
3573
3605
|
let r = await n(e, this.ctx, this.screenshotProvider, t);
|
|
3574
3606
|
return this.destroyed ? null : (r && this.emit("agent:elements-grabbed", { count: r.results.length }), r);
|
|
3575
3607
|
}
|
|
@@ -3582,10 +3614,10 @@ var Lr = class extends tt {
|
|
|
3582
3614
|
}
|
|
3583
3615
|
}
|
|
3584
3616
|
handleToggleRequest() {
|
|
3585
|
-
this.destroyed ||
|
|
3617
|
+
this.destroyed || j() || Ln(this.getInternalState(), this.kbdCallbacks);
|
|
3586
3618
|
}
|
|
3587
3619
|
handleKeyboardShortcuts(e) {
|
|
3588
|
-
if (!(this.destroyed ||
|
|
3620
|
+
if (!(this.destroyed || j())) {
|
|
3589
3621
|
if (e.key === "Escape") {
|
|
3590
3622
|
if (this.escapeBlockers.size > 0) return;
|
|
3591
3623
|
let t = e.composedPath()[0];
|
|
@@ -3645,4 +3677,4 @@ var Lr = class extends tt {
|
|
|
3645
3677
|
this.destroyed || (this.destroyed = !0, this.initialAuthToken = void 0, kr && (this.keyboardHandler && window.removeEventListener("keydown", this.keyboardHandler, !0), this.holdActivationHandler && (window.removeEventListener("keydown", this.holdActivationHandler), window.removeEventListener("keyup", this.holdActivationHandler)), this.holdBlurHandler && window.removeEventListener("blur", this.holdBlurHandler), this.toggleHandler && window.removeEventListener("commentkit:toggle-overlay", this.toggleHandler), this.hashChangeHandler && window.removeEventListener("hashchange", this.hashChangeHandler), this.onlineHandler && window.removeEventListener("online", this.onlineHandler), this.offlineHandler && window.removeEventListener("offline", this.offlineHandler)), this.pendingStateUpdates = null, this.flushScheduled = !1, this.activeMutations.clear(), this.offlinePersistUnsub?.(), this.offlinePersistUnsub = null, this.retryTimer &&= (clearTimeout(this.retryTimer), null), this.bootRetryTimer &&= (clearTimeout(this.bootRetryTimer), null), this.disconnectRealtime(!0), this.localDemo?.destroy(), this.sliceSubscribers.clear(), this.removeAllListeners());
|
|
3646
3678
|
}
|
|
3647
3679
|
};
|
|
3648
|
-
export { ve as _,
|
|
3680
|
+
export { ve as _, vt as a, T as b, tt as c, Xe as d, Je as f, we as g, A as h, yt as i, et as l, k as m, Nr as n, st as o, Ye as p, I as r, M as s, Lr as t, j as u, E as v, be as x, ye as y };
|