makethisbetter 1.28.2 → 1.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/makethisbetter.cjs +8 -8
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +210 -207
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +11 -11
- package/dist/makethisbetter.js.map +1 -1
- package/dist/makethisbetter.standalone.js +270 -267
- package/dist/makethisbetter.standalone.js.map +1 -1
- package/dist/screenshot/capture.d.ts.map +1 -1
- package/dist/widget/submission-lifecycle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/screenshot/capture.ts +1 -0
- package/src/widget/submission-lifecycle.ts +6 -0
|
@@ -9,25 +9,25 @@ function Q(e, t) {
|
|
|
9
9
|
function d(e) {
|
|
10
10
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Mt(e) {
|
|
13
13
|
return e.isComposing || e.keyCode === 229;
|
|
14
14
|
}
|
|
15
15
|
const ei = /^(script|style|noscript|template)$/i;
|
|
16
|
-
function
|
|
16
|
+
function we(e, t = 80) {
|
|
17
17
|
let i = "";
|
|
18
18
|
for (const r of Array.from(e.childNodes)) {
|
|
19
19
|
if (i.length >= t) break;
|
|
20
|
-
r.nodeType === 3 ? i += r.nodeValue ?? "" : r instanceof Element && !ei.test(r.tagName) && (i +=
|
|
20
|
+
r.nodeType === 3 ? i += r.nodeValue ?? "" : r instanceof Element && !ei.test(r.tagName) && (i += we(r, t - i.length));
|
|
21
21
|
}
|
|
22
22
|
return i;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function It(e) {
|
|
25
25
|
if (e instanceof HTMLElement) {
|
|
26
26
|
const t = e.getAttribute("aria-label");
|
|
27
27
|
if (t) return t;
|
|
28
28
|
const i = e.getAttribute("title");
|
|
29
29
|
if (i) return i;
|
|
30
|
-
const r =
|
|
30
|
+
const r = we(e).trim().slice(0, 40);
|
|
31
31
|
if (r) return r;
|
|
32
32
|
const n = e.placeholder;
|
|
33
33
|
if (n) return n;
|
|
@@ -38,7 +38,7 @@ function Mt(e) {
|
|
|
38
38
|
}
|
|
39
39
|
return e.tagName.toLowerCase();
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function ye(e) {
|
|
42
42
|
const t = [];
|
|
43
43
|
let i = e;
|
|
44
44
|
for (; i && i !== document.body && t.length < 5; ) {
|
|
@@ -111,7 +111,7 @@ j.HOST_INTERACTION_EVENTS = [
|
|
|
111
111
|
"touchcancel",
|
|
112
112
|
"click"
|
|
113
113
|
];
|
|
114
|
-
let
|
|
114
|
+
let _t = j;
|
|
115
115
|
class ii {
|
|
116
116
|
constructor(t, i, r, n, s) {
|
|
117
117
|
this.active = !1, this.preserveHostFocus = (a) => {
|
|
@@ -148,7 +148,7 @@ class ni {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
const si = 400;
|
|
151
|
-
class
|
|
151
|
+
class jt {
|
|
152
152
|
constructor(t, i, r = () => Date.now()) {
|
|
153
153
|
this.bornAt = Date.now(), this.bornAt = r(), this.onClick = () => {
|
|
154
154
|
r() - this.bornAt < si || i();
|
|
@@ -183,7 +183,7 @@ class ai {
|
|
|
183
183
|
return this.applied;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const qt = ["wheel", "touchmove"], oi = /* @__PURE__ */ new Set([
|
|
187
187
|
"ArrowUp",
|
|
188
188
|
"ArrowDown",
|
|
189
189
|
"ArrowLeft",
|
|
@@ -215,11 +215,11 @@ function hi() {
|
|
|
215
215
|
const r = i.composedPath()[0];
|
|
216
216
|
r instanceof Element && ci(r, i.key) || i.cancelable && i.preventDefault();
|
|
217
217
|
};
|
|
218
|
-
for (const i of
|
|
218
|
+
for (const i of qt)
|
|
219
219
|
window.addEventListener(i, e, { capture: !0, passive: !1 });
|
|
220
220
|
return window.addEventListener("keydown", t, { capture: !0 }), {
|
|
221
221
|
release() {
|
|
222
|
-
for (const i of
|
|
222
|
+
for (const i of qt)
|
|
223
223
|
window.removeEventListener(i, e, { capture: !0 });
|
|
224
224
|
window.removeEventListener("keydown", t, { capture: !0 });
|
|
225
225
|
}
|
|
@@ -326,7 +326,7 @@ class bi {
|
|
|
326
326
|
this.highlightEl.style.top = `${i.top - 2}px`, this.highlightEl.style.left = `${i.left - 2}px`, this.highlightEl.style.width = `${i.width + 4}px`, this.highlightEl.style.height = `${i.height + 4}px`, this.highlightEl.style.display = "block", this.showTooltip(t, i);
|
|
327
327
|
}
|
|
328
328
|
showTooltip(t, i) {
|
|
329
|
-
this.tooltipEl.textContent =
|
|
329
|
+
this.tooltipEl.textContent = It(t);
|
|
330
330
|
const r = i.top < 30;
|
|
331
331
|
this.tooltipEl.classList.toggle("below", r), this.tooltipEl.style.left = `${i.left + i.width / 2}px`, this.tooltipEl.style.top = r ? `${i.bottom + 8}px` : `${i.top - 8}px`, this.tooltipEl.style.display = "block";
|
|
332
332
|
}
|
|
@@ -371,15 +371,15 @@ function wi(e, t) {
|
|
|
371
371
|
function Y(e) {
|
|
372
372
|
let t = 0, i = 0, r = e;
|
|
373
373
|
for (; r && r !== document.body; )
|
|
374
|
-
r instanceof HTMLElement && (t += r.scrollLeft, i += r.scrollTop), r =
|
|
374
|
+
r instanceof HTMLElement && (t += r.scrollLeft, i += r.scrollTop), r = ve(r);
|
|
375
375
|
return { x: t, y: i };
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function ve(e) {
|
|
378
378
|
if (e.parentElement) return e.parentElement;
|
|
379
379
|
const t = e.getRootNode();
|
|
380
380
|
return t instanceof ShadowRoot ? t.host : null;
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Wt(e) {
|
|
383
383
|
const t = Y(e);
|
|
384
384
|
return { x: t.x + window.scrollX, y: t.y + window.scrollY };
|
|
385
385
|
}
|
|
@@ -399,7 +399,7 @@ class yi {
|
|
|
399
399
|
this.clearAll();
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
const
|
|
402
|
+
const xe = "#059669", D = {
|
|
403
403
|
color: "var(--mtb-brand-primary)",
|
|
404
404
|
width: "3.5",
|
|
405
405
|
linecap: "round",
|
|
@@ -414,7 +414,7 @@ class vi {
|
|
|
414
414
|
this.isDrawing = !0, this.currentPoints = [[t, i]], this.currentAnchor = ki(t, i), this.currentPath = this.createPath(), this.svg.appendChild(this.currentPath);
|
|
415
415
|
}
|
|
416
416
|
continueDraw(t, i) {
|
|
417
|
-
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, i]), this.currentPath.setAttribute("d",
|
|
417
|
+
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, i]), this.currentPath.setAttribute("d", wt(this.currentPoints)));
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* How far the pointer has wandered from where it went down, in pixels.
|
|
@@ -437,7 +437,7 @@ class vi {
|
|
|
437
437
|
commitStroke() {
|
|
438
438
|
return !this.isDrawing || !this.currentPath ? !1 : (this.isDrawing = !1, this.committed.push({
|
|
439
439
|
path: this.currentPath,
|
|
440
|
-
d:
|
|
440
|
+
d: wt(this.currentPoints),
|
|
441
441
|
points: this.currentPoints,
|
|
442
442
|
anchor: this.currentAnchor
|
|
443
443
|
}), this.redoStack = [], this.currentPath = null, this.currentPoints = [], !0);
|
|
@@ -475,7 +475,7 @@ class vi {
|
|
|
475
475
|
type: "draw",
|
|
476
476
|
x: r,
|
|
477
477
|
y: n,
|
|
478
|
-
drawPath: i.map(
|
|
478
|
+
drawPath: i.map(wt).join(" "),
|
|
479
479
|
captureOffsetX: t.anchor.offset.x,
|
|
480
480
|
captureOffsetY: t.anchor.offset.y
|
|
481
481
|
};
|
|
@@ -507,7 +507,7 @@ class vi {
|
|
|
507
507
|
return t.setAttribute("fill", "none"), t.setAttribute("stroke", D.color), t.setAttribute("stroke-width", D.width), t.setAttribute("stroke-linecap", D.linecap), t.setAttribute("stroke-linejoin", D.linejoin), t.setAttribute("style", `filter:${D.filter}`), t;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function wt(e) {
|
|
511
511
|
if (e.length === 0) return "";
|
|
512
512
|
const [t, i] = e[0];
|
|
513
513
|
let r = `M ${t} ${i}`;
|
|
@@ -538,23 +538,23 @@ const ut = "rr-block", W = "rr-mask", Ci = `.${ut}, .${W}`;
|
|
|
538
538
|
function mt(e) {
|
|
539
539
|
return e.closest(Ci) !== null;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Ft(e) {
|
|
542
542
|
const t = e.getAttribute("role")?.trim().split(/\s+/)[0];
|
|
543
543
|
return t && /^[a-z][a-z0-9-]*$/i.test(t) ? t : e.tagName.toLowerCase();
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ke(e) {
|
|
546
546
|
return e.tagName.toLowerCase();
|
|
547
547
|
}
|
|
548
548
|
const Ti = 10;
|
|
549
|
-
function
|
|
549
|
+
function Vt(e) {
|
|
550
550
|
return mt(e) ? {
|
|
551
|
-
name:
|
|
551
|
+
name: Ft(e),
|
|
552
552
|
text: "",
|
|
553
|
-
selector:
|
|
553
|
+
selector: ke(e)
|
|
554
554
|
} : {
|
|
555
|
-
name:
|
|
555
|
+
name: It(e),
|
|
556
556
|
text: e.textContent?.trim().slice(0, 200) ?? "",
|
|
557
|
-
selector:
|
|
557
|
+
selector: ye(e)
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
class _i {
|
|
@@ -603,7 +603,7 @@ class _i {
|
|
|
603
603
|
return;
|
|
604
604
|
}
|
|
605
605
|
if (this.drawLayer.cancelCurrentDraw(), this.touch || this.drawLayer.hasStrokes() || !t) return;
|
|
606
|
-
const i = Q(t.clientX, t.clientY), r = i ?
|
|
606
|
+
const i = Q(t.clientX, t.clientY), r = i ? Vt(i) : null, n = r?.name ?? this.messages.annotation.element, s = i?.getBoundingClientRect(), a = Wt(i), o = {
|
|
607
607
|
type: "pin",
|
|
608
608
|
x: t.clientX,
|
|
609
609
|
y: t.clientY,
|
|
@@ -646,7 +646,7 @@ class _i {
|
|
|
646
646
|
if (!t) return null;
|
|
647
647
|
const i = this.drawLayer.viewportDrift(), r = Q(t.x - i.x, t.y - i.y);
|
|
648
648
|
if (!r) return t;
|
|
649
|
-
const n = r.getBoundingClientRect(), s =
|
|
649
|
+
const n = r.getBoundingClientRect(), s = Wt(r), a = s.x - (t.captureOffsetX ?? 0), o = s.y - (t.captureOffsetY ?? 0), l = Vt(r);
|
|
650
650
|
return {
|
|
651
651
|
...t,
|
|
652
652
|
targetSelector: l.selector,
|
|
@@ -708,7 +708,7 @@ const Pi = 480;
|
|
|
708
708
|
function Ri() {
|
|
709
709
|
return window.innerWidth <= Pi;
|
|
710
710
|
}
|
|
711
|
-
class
|
|
711
|
+
class Ee {
|
|
712
712
|
constructor(t) {
|
|
713
713
|
this.el = t, this.inset = new Li();
|
|
714
714
|
}
|
|
@@ -735,8 +735,8 @@ class ke {
|
|
|
735
735
|
}
|
|
736
736
|
class Di {
|
|
737
737
|
constructor(t, i) {
|
|
738
|
-
this.onSubmit = i.onSubmit, this.submitLabel = i.messages.draw.submit, this.messages = i.messages, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(i.messages), t.append(this.el), this.sheet = new
|
|
739
|
-
|
|
738
|
+
this.onSubmit = i.onSubmit, this.submitLabel = i.messages.draw.submit, this.messages = i.messages, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(i.messages), t.append(this.el), this.sheet = new Ee(this.el), this.sheet.apply(), this.input = this.el.querySelector(".mtb-draw-input"), this.undoBtn = this.el.querySelector(".mtb-draw-undo"), this.redoBtn = this.el.querySelector(".mtb-draw-redo"), this.submitBtn = this.el.querySelector(".mtb-draw-submit"), this.undoBtn.addEventListener("click", i.onUndo), this.redoBtn.addEventListener("click", i.onRedo), this.el.querySelector(".mtb-draw-cancel").addEventListener("click", i.onCancel), this.submitBtn.addEventListener("click", () => this.submit()), i.onActivity && this.input.addEventListener("input", i.onActivity), this.input.addEventListener("keydown", (r) => {
|
|
739
|
+
Mt(r) || r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.submit());
|
|
740
740
|
}), this.input.focus({ preventScroll: !0 });
|
|
741
741
|
}
|
|
742
742
|
buildHTML(t) {
|
|
@@ -769,18 +769,18 @@ class Di {
|
|
|
769
769
|
this.sheet.release(), this.el.remove();
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
const nt = 12,
|
|
772
|
+
const nt = 12, At = 32;
|
|
773
773
|
function Mi(e) {
|
|
774
774
|
const t = window.innerWidth, i = window.innerHeight;
|
|
775
775
|
return {
|
|
776
776
|
vw: t,
|
|
777
777
|
vh: i,
|
|
778
|
-
minLeft: nt + (e === "left" ?
|
|
779
|
-
maxRight: t - nt - (e === "right" ?
|
|
778
|
+
minLeft: nt + (e === "left" ? At : 0),
|
|
779
|
+
maxRight: t - nt - (e === "right" ? At : 0)
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
782
|
function Ii(e, t) {
|
|
783
|
-
return Math.min(e, t.vw - 2 * nt -
|
|
783
|
+
return Math.min(e, t.vw - 2 * nt - At);
|
|
784
784
|
}
|
|
785
785
|
const Fi = [
|
|
786
786
|
"button:not([disabled])",
|
|
@@ -790,7 +790,7 @@ const Fi = [
|
|
|
790
790
|
"a[href]",
|
|
791
791
|
'[tabindex]:not([tabindex="-1"])'
|
|
792
792
|
].join(", ");
|
|
793
|
-
function
|
|
793
|
+
function Se(e) {
|
|
794
794
|
const t = document.activeElement instanceof HTMLElement ? document.activeElement : null, i = (r) => {
|
|
795
795
|
if (r.key !== "Tab") return;
|
|
796
796
|
const n = Array.from(e.querySelectorAll(Fi)).filter((c) => !c.hidden);
|
|
@@ -807,10 +807,10 @@ function Ee(e) {
|
|
|
807
807
|
}
|
|
808
808
|
};
|
|
809
809
|
}
|
|
810
|
-
const Hi = 320,
|
|
811
|
-
class
|
|
810
|
+
const Hi = 320, Yt = 5e3, Bi = "https://makethisbetter.dev", K = '<svg viewBox="0 0 512 512" fill="none"><defs><linearGradient id="mtb-bg" x1=".3" y1="0" x2=".7" y2="1"><stop offset="0%" stop-color="var(--mtb-chat-logo-start, #10b981)"/><stop offset="100%" stop-color="var(--mtb-chat-logo-end, #059669)"/></linearGradient></defs><rect width="512" height="512" rx="96" fill="url(#mtb-bg)"/><g transform="translate(89,89) scale(13.9)" stroke="var(--mtb-chat-logo-fg, #fff)" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"><path d="M21 2v6h-6"/><path d="M21 13a9 9 0 1 1-3-7.7L21 8"/><circle cx="12" cy="12" r="2.2" fill="var(--mtb-chat-logo-fg, #fff)" stroke="none"/></g></svg>', Ni = '<svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8.9 8l3.3-3.3-.9-.9L8 7.1 4.7 3.8l-.9.9L7.1 8l-3.3 3.3.9.9L8 8.9l3.3 3.3.9-.9z"/></svg>', Oi = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M6.2 2.6h3.6l.9 1.4H14a1 1 0 011 1v7.4a1 1 0 01-1 1H2a1 1 0 01-1-1V5a1 1 0 011-1h3.3l.9-1.4z"/><circle cx="8" cy="9" r="2.5" class="mtb-chat-icon-lens"/></svg>', zi = '<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><circle cx="8" cy="8" r="6.6"/><polygon points="6.4,5.2 11,8 6.4,10.8" class="mtb-chat-icon-lens"/></svg>', $i = '<svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="M8.1 14.6L3.8 10.3l1.5-1.5 2.8 2.8 6.6-6.6 1.5 1.5z"/></svg>';
|
|
811
|
+
class yt {
|
|
812
812
|
constructor(t, i) {
|
|
813
|
-
this.state = "idle", this.autoCloseTimer = null, this.session = null, this.clarifyAbort = null, this.streamingBubbleEl = null, this.opts = i, this.i18n = i.messages, this.el = t.el("div", "mtb-chat"), this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-modal", "true"), this.el.setAttribute("aria-label", i.targetName), this.el.innerHTML = this.buildHTML(), t.append(this.el), this.focusTrap =
|
|
813
|
+
this.state = "idle", this.autoCloseTimer = null, this.session = null, this.clarifyAbort = null, this.streamingBubbleEl = null, this.opts = i, this.i18n = i.messages, this.el = t.el("div", "mtb-chat"), this.el.setAttribute("role", "dialog"), this.el.setAttribute("aria-modal", "true"), this.el.setAttribute("aria-label", i.targetName), this.el.innerHTML = this.buildHTML(), t.append(this.el), this.focusTrap = Se(this.el), this.sheet = new Ee(this.el), this.sheet.apply() || this.positionCard(i.x, i.y, i.targetRect, i.position ?? "right"), this.messagesEl = this.el.querySelector(".mtb-chat-messages"), this.composerEl = this.el.querySelector(".mtb-chat-composer"), this.actionsEl = this.el.querySelector(".mtb-chat-actions"), this.inputEl = this.el.querySelector(".mtb-chat-input"), this.sendBtn = this.el.querySelector(".mtb-chat-send"), this.quickRepliesEl = this.el.querySelector(".mtb-chat-quick-replies"), this.bindEvents(), this.handleEscape = this.handleEscape.bind(this), window.addEventListener("keydown", this.handleEscape), this.inputEl.focus({ preventScroll: !0 });
|
|
814
814
|
}
|
|
815
815
|
handleEscape(t) {
|
|
816
816
|
if (t.key === "Escape" && (t.preventDefault(), t.stopPropagation(), this.state !== "sending")) {
|
|
@@ -858,7 +858,7 @@ class wt {
|
|
|
858
858
|
}), this.inputEl.addEventListener("input", () => {
|
|
859
859
|
this.sendBtn.disabled = !this.inputEl.value.trim(), this.opts.onActivity?.();
|
|
860
860
|
}), this.inputEl.addEventListener("keydown", (i) => {
|
|
861
|
-
if (!
|
|
861
|
+
if (!Mt(i) && i.key === "Enter" && !i.shiftKey) {
|
|
862
862
|
i.preventDefault();
|
|
863
863
|
const r = this.inputEl.value.trim();
|
|
864
864
|
r ? this.sendMessage(r) : this.state === "clarifying" && this.skipAndSend();
|
|
@@ -978,7 +978,7 @@ class wt {
|
|
|
978
978
|
s.preventDefault(), i();
|
|
979
979
|
}));
|
|
980
980
|
const n = this.opts.resolveEmailCapture?.();
|
|
981
|
-
n && !t.querySelector(".mtb-chat-email-card") ? (this.autoCloseTimer && (clearTimeout(this.autoCloseTimer), this.autoCloseTimer = null), t.classList.remove("mtb-chat-success-simple"), t.appendChild(this.buildEmailCard(n))) : !n && !this.autoCloseTimer && !t.querySelector(".mtb-chat-email-card") && (this.autoCloseTimer = setTimeout(() => this.destroy(),
|
|
981
|
+
n && !t.querySelector(".mtb-chat-email-card") ? (this.autoCloseTimer && (clearTimeout(this.autoCloseTimer), this.autoCloseTimer = null), t.classList.remove("mtb-chat-success-simple"), t.appendChild(this.buildEmailCard(n))) : !n && !this.autoCloseTimer && !t.querySelector(".mtb-chat-email-card") && (this.autoCloseTimer = setTimeout(() => this.destroy(), Yt));
|
|
982
982
|
}
|
|
983
983
|
finalizeInBackground() {
|
|
984
984
|
Promise.resolve(this.opts.onFinalize()).then(() => this.attachHandoff()).catch(() => {
|
|
@@ -1000,7 +1000,7 @@ class wt {
|
|
|
1000
1000
|
if (!c) return;
|
|
1001
1001
|
if (o.disabled = !0, a.disabled = !0, await t.onSubmit(c)) {
|
|
1002
1002
|
const m = document.createElement("div");
|
|
1003
|
-
m.className = "mtb-chat-email-note", m.textContent = i.email_saved, r.replaceChildren(m), this.autoCloseTimer = setTimeout(() => this.destroy(),
|
|
1003
|
+
m.className = "mtb-chat-email-note", m.textContent = i.email_saved, r.replaceChildren(m), this.autoCloseTimer = setTimeout(() => this.destroy(), Yt);
|
|
1004
1004
|
return;
|
|
1005
1005
|
}
|
|
1006
1006
|
a.disabled = !1, o.disabled = !1;
|
|
@@ -1086,8 +1086,8 @@ class wt {
|
|
|
1086
1086
|
positionCard(t, i, r, n) {
|
|
1087
1087
|
const s = Mi(n), { vw: a, vh: o, minLeft: l, maxRight: c } = s, h = nt, u = 8, m = Ii(Hi, s), y = (this.el.offsetHeight || 280) + 80;
|
|
1088
1088
|
let w, b;
|
|
1089
|
-
const
|
|
1090
|
-
r &&
|
|
1089
|
+
const gt = r && r.width < a * 0.6 && r.height < o * 0.6;
|
|
1090
|
+
r && gt ? (w = r.left, b = r.bottom + u, b + y > o - h && (b = r.top - y - u), b < h && (b = Math.min(r.bottom + u, o - y - h))) : (w = t + 12, b = i + 12), w + m > c && (w = c - m), w < l && (w = l), b < h && (b = h), b + y > o - h && (b = o - y - h), b < h && (b = h), this.el.style.left = `${w}px`, this.el.style.top = `${b}px`, this.el.style.maxHeight = `${o - b - h}px`;
|
|
1091
1091
|
}
|
|
1092
1092
|
submit(t) {
|
|
1093
1093
|
this.sendMessage(t);
|
|
@@ -1116,7 +1116,7 @@ class qi {
|
|
|
1116
1116
|
u.preventDefault(), n.onViewFeedback();
|
|
1117
1117
|
}), o.appendChild(h);
|
|
1118
1118
|
}
|
|
1119
|
-
this.el.appendChild(o), t.append(this.el), this.focusTrap =
|
|
1119
|
+
this.el.appendChild(o), t.append(this.el), this.focusTrap = Se(this.el), this.autoCloseTimer = setTimeout(r, Ui);
|
|
1120
1120
|
}
|
|
1121
1121
|
destroy() {
|
|
1122
1122
|
clearTimeout(this.autoCloseTimer), this.focusTrap.release(), this.el.remove(), this.focusTrap.restoreFocus();
|
|
@@ -1153,11 +1153,11 @@ function V(e) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
1155
|
function st(e, t) {
|
|
1156
|
-
if (t &&
|
|
1156
|
+
if (t && Ce(t) && e != null) return g;
|
|
1157
1157
|
if (typeof e == "string") return R(e);
|
|
1158
1158
|
if (Array.isArray(e)) return e.map((i) => st(i));
|
|
1159
1159
|
if (e && typeof e == "object") {
|
|
1160
|
-
const i =
|
|
1160
|
+
const i = Te(e);
|
|
1161
1161
|
return Object.fromEntries(
|
|
1162
1162
|
Object.entries(e).map(([n, s]) => {
|
|
1163
1163
|
const a = i && Ji.has(N(n)) && s != null ? g : st(s, n);
|
|
@@ -1167,14 +1167,14 @@ function st(e, t) {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
return e;
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function Ce(e) {
|
|
1171
1171
|
return tr.test(N(e));
|
|
1172
1172
|
}
|
|
1173
|
-
function
|
|
1173
|
+
function Te(e) {
|
|
1174
1174
|
return Object.entries(e).some(([t, i]) => {
|
|
1175
1175
|
if (typeof i != "string") return !1;
|
|
1176
1176
|
const r = N(t);
|
|
1177
|
-
return Gi.has(r) ? r === "type" ? Zi.has(N(i)) : r === "autocomplete" ? i.split(/\s+/).some((n) => Qi.has(N(n))) :
|
|
1177
|
+
return Gi.has(r) ? r === "type" ? Zi.has(N(i)) : r === "autocomplete" ? i.split(/\s+/).some((n) => Qi.has(N(n))) : Ce(i) : !1;
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
1180
|
function N(e) {
|
|
@@ -1190,8 +1190,8 @@ function er(e) {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
return i % 10 === 0;
|
|
1192
1192
|
}
|
|
1193
|
-
function
|
|
1194
|
-
return
|
|
1193
|
+
function _e(e) {
|
|
1194
|
+
return Te({
|
|
1195
1195
|
type: e.getAttribute("type"),
|
|
1196
1196
|
autocomplete: e.getAttribute("autocomplete"),
|
|
1197
1197
|
name: e.getAttribute("name"),
|
|
@@ -1201,29 +1201,29 @@ function Te(e) {
|
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
1203
|
function at(e, t) {
|
|
1204
|
-
return e && (
|
|
1204
|
+
return e && (_e(t) ? g : R(e));
|
|
1205
1205
|
}
|
|
1206
1206
|
const ir = 512;
|
|
1207
|
-
function
|
|
1207
|
+
function Ae() {
|
|
1208
1208
|
return /* @__PURE__ */ new WeakMap();
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1210
|
+
function Le(e, t) {
|
|
1211
1211
|
let i = e.parentElement;
|
|
1212
1212
|
for (; i && i !== document.body && i !== document.documentElement; ) {
|
|
1213
|
-
const r =
|
|
1213
|
+
const r = Pe(i, t);
|
|
1214
1214
|
if (r === "sensitive") return !0;
|
|
1215
1215
|
if (r === "contains-sensitive-child" || r === "too-large") return !1;
|
|
1216
1216
|
i = i.parentElement;
|
|
1217
1217
|
}
|
|
1218
1218
|
return !1;
|
|
1219
1219
|
}
|
|
1220
|
-
function
|
|
1220
|
+
function Pe(e, t) {
|
|
1221
1221
|
const i = t.get(e);
|
|
1222
1222
|
if (i) return i;
|
|
1223
1223
|
const r = e.textContent ?? "";
|
|
1224
1224
|
let n = "none";
|
|
1225
1225
|
return r.length > ir ? n = "too-large" : R(r) !== r && (n = Array.from(e.children).some((a) => {
|
|
1226
|
-
const o =
|
|
1226
|
+
const o = Pe(a, t);
|
|
1227
1227
|
return o === "sensitive" || o === "contains-sensitive-child";
|
|
1228
1228
|
}) ? "contains-sensitive-child" : "sensitive"), t.set(e, n), n;
|
|
1229
1229
|
}
|
|
@@ -1233,7 +1233,7 @@ function rr(e) {
|
|
|
1233
1233
|
i.onload = () => t(i), i.onerror = () => t(null), i.src = e;
|
|
1234
1234
|
});
|
|
1235
1235
|
}
|
|
1236
|
-
function
|
|
1236
|
+
function Re(e) {
|
|
1237
1237
|
const t = [];
|
|
1238
1238
|
let i = null;
|
|
1239
1239
|
const r = e.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g) ?? [];
|
|
@@ -1244,27 +1244,29 @@ function Pe(e) {
|
|
|
1244
1244
|
return t;
|
|
1245
1245
|
}
|
|
1246
1246
|
function nr(e, t, i) {
|
|
1247
|
-
return
|
|
1247
|
+
return Re(e).map(
|
|
1248
1248
|
(r) => r.map(([n, s], a) => `${a === 0 ? "M" : "L"} ${n + t} ${s + i}`).join(" ")
|
|
1249
1249
|
).join(" ");
|
|
1250
1250
|
}
|
|
1251
1251
|
let M = null;
|
|
1252
|
-
function
|
|
1252
|
+
function De() {
|
|
1253
1253
|
return M || (M = Promise.resolve().then(() => Ps).catch((e) => {
|
|
1254
1254
|
throw M = null, e;
|
|
1255
1255
|
}), M);
|
|
1256
1256
|
}
|
|
1257
|
-
let
|
|
1258
|
-
function
|
|
1259
|
-
return
|
|
1260
|
-
|
|
1261
|
-
})),
|
|
1257
|
+
let vt, xt = null;
|
|
1258
|
+
function Ht() {
|
|
1259
|
+
return vt !== void 0 ? Promise.resolve(vt) : (xt ?? (xt = De().then(({ getFontEmbedCSS: e }) => e(document.body)).then((e) => (vt = e, e)).catch(() => {
|
|
1260
|
+
xt = null;
|
|
1261
|
+
})), xt);
|
|
1262
1262
|
}
|
|
1263
1263
|
const sr = 200, ar = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
1264
1264
|
async function or(e, t) {
|
|
1265
1265
|
try {
|
|
1266
1266
|
if (t?.aborted) return null;
|
|
1267
|
-
const [{ toJpeg: i }, r] = await Promise.all([
|
|
1267
|
+
const [{ toJpeg: i }, r] = await Promise.all([De(), Ht()]);
|
|
1268
|
+
if (t?.aborted) return null;
|
|
1269
|
+
const n = document.body.getBoundingClientRect(), s = gi(), a = { x: window.scrollX, y: window.scrollY }, o = mr(document.body), l = await i(document.body, {
|
|
1268
1270
|
quality: 0.85,
|
|
1269
1271
|
imagePlaceholder: ar,
|
|
1270
1272
|
resourceUrlResolver: e,
|
|
@@ -1359,37 +1361,37 @@ async function ur(e, t, i, r, n) {
|
|
|
1359
1361
|
function mr(e) {
|
|
1360
1362
|
const t = [];
|
|
1361
1363
|
for (const s of br(e, `.${ut}`))
|
|
1362
|
-
|
|
1364
|
+
kt(t, s.getBoundingClientRect(), Xt(s));
|
|
1363
1365
|
for (const s of e.querySelectorAll("input, textarea, select")) {
|
|
1364
|
-
if (
|
|
1365
|
-
const a = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement ? s.value : "", o = s.closest(`.${W}`) !== null, l =
|
|
1366
|
-
!o && !l ||
|
|
1366
|
+
if (Kt(s)) continue;
|
|
1367
|
+
const a = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement ? s.value : "", o = s.closest(`.${W}`) !== null, l = _e(s) || at(a, s) !== a;
|
|
1368
|
+
!o && !l || kt(t, s.getBoundingClientRect(), Xt(s), Jt);
|
|
1367
1369
|
}
|
|
1368
|
-
const i = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), r =
|
|
1370
|
+
const i = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), r = Ae();
|
|
1369
1371
|
let n = i.nextNode();
|
|
1370
1372
|
for (; n; ) {
|
|
1371
|
-
const s = n.parentElement, a = n.textContent ?? "", o = s?.closest(`.${W}`) !== null, l = R(a) !== a ||
|
|
1372
|
-
if (s && !
|
|
1373
|
+
const s = n.parentElement, a = n.textContent ?? "", o = s?.closest(`.${W}`) !== null, l = R(a) !== a || Le(n, r);
|
|
1374
|
+
if (s && !Kt(s) && (o || l)) {
|
|
1373
1375
|
const c = Y(s), h = document.createRange();
|
|
1374
1376
|
h.selectNodeContents(n);
|
|
1375
1377
|
for (const u of Array.from(h.getClientRects()))
|
|
1376
|
-
|
|
1378
|
+
kt(t, u, c, Jt);
|
|
1377
1379
|
}
|
|
1378
1380
|
n = i.nextNode();
|
|
1379
1381
|
}
|
|
1380
1382
|
return t;
|
|
1381
1383
|
}
|
|
1382
|
-
function
|
|
1383
|
-
return Y(
|
|
1384
|
+
function Xt(e) {
|
|
1385
|
+
return Y(ve(e));
|
|
1384
1386
|
}
|
|
1385
1387
|
function br(e, t) {
|
|
1386
1388
|
const i = Array.from(e.querySelectorAll(t));
|
|
1387
1389
|
return e.matches(t) ? [e, ...i] : i;
|
|
1388
1390
|
}
|
|
1389
|
-
function
|
|
1391
|
+
function Kt(e) {
|
|
1390
1392
|
return e.closest(`#${k}`) !== null || e.closest(`.${ut}`) !== null;
|
|
1391
1393
|
}
|
|
1392
|
-
function
|
|
1394
|
+
function kt(e, t, i, r = 0) {
|
|
1393
1395
|
if (![t.left, t.top, t.width, t.height].every(Number.isFinite))
|
|
1394
1396
|
throw new Error("Invalid privacy redaction geometry");
|
|
1395
1397
|
t.width <= 0 || t.height <= 0 || e.push({
|
|
@@ -1399,9 +1401,9 @@ function xt(e, t, i, r = 0) {
|
|
|
1399
1401
|
height: t.height + r * 2
|
|
1400
1402
|
});
|
|
1401
1403
|
}
|
|
1402
|
-
function pr(e, t, i, r =
|
|
1404
|
+
function pr(e, t, i, r = xe) {
|
|
1403
1405
|
e.save(), e.lineCap = "round", e.lineJoin = "round";
|
|
1404
|
-
for (const n of
|
|
1406
|
+
for (const n of Re(t))
|
|
1405
1407
|
if (n.length !== 0) {
|
|
1406
1408
|
e.beginPath(), e.moveTo(
|
|
1407
1409
|
it(i, n[0][0]),
|
|
@@ -1416,13 +1418,13 @@ function pr(e, t, i, r = ve) {
|
|
|
1416
1418
|
}
|
|
1417
1419
|
e.restore();
|
|
1418
1420
|
}
|
|
1419
|
-
const
|
|
1421
|
+
const Gt = 16e6, Jt = 2;
|
|
1420
1422
|
function fr(e) {
|
|
1421
1423
|
const t = e.width * e.height;
|
|
1422
|
-
return !Number.isFinite(t) || t <=
|
|
1424
|
+
return !Number.isFinite(t) || t <= Gt ? 1 : Math.sqrt(Gt / t);
|
|
1423
1425
|
}
|
|
1424
1426
|
function gr(e, t, i, r) {
|
|
1425
|
-
const n = r?.primary ??
|
|
1427
|
+
const n = r?.primary ?? xe;
|
|
1426
1428
|
e.save(), e.shadowColor = "rgba(15, 23, 42, 0.68)", e.shadowOffsetY = 2, e.shadowBlur = 8, e.fillStyle = n, e.beginPath(), e.arc(t, i, 11, 0, Math.PI * 2), e.fill(), e.shadowColor = "transparent", e.lineWidth = 2, e.strokeStyle = "#ffffff", e.stroke(), e.restore();
|
|
1427
1429
|
}
|
|
1428
1430
|
function wr(e) {
|
|
@@ -1456,11 +1458,11 @@ class yr {
|
|
|
1456
1458
|
for (const i of this.listeners) i(t);
|
|
1457
1459
|
}
|
|
1458
1460
|
}
|
|
1459
|
-
const
|
|
1461
|
+
const Bt = new yr();
|
|
1460
1462
|
function vr(e) {
|
|
1461
1463
|
return !e || typeof e != "object" || !("name" in e) ? void 0 : String(e.name) || void 0;
|
|
1462
1464
|
}
|
|
1463
|
-
function
|
|
1465
|
+
function Me(e) {
|
|
1464
1466
|
const t = xr(e.name) || kr(e.message), i = Er(e);
|
|
1465
1467
|
return i ? `${t} (${i})` : t;
|
|
1466
1468
|
}
|
|
@@ -1485,10 +1487,10 @@ class Cr {
|
|
|
1485
1487
|
this.errors = [], this.unsubscribe = null;
|
|
1486
1488
|
}
|
|
1487
1489
|
start() {
|
|
1488
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1490
|
+
this.unsubscribe || (this.unsubscribe = Bt.subscribe((t) => this.record(t)));
|
|
1489
1491
|
}
|
|
1490
1492
|
record(t) {
|
|
1491
|
-
this.addError(
|
|
1493
|
+
this.addError(Me(t));
|
|
1492
1494
|
}
|
|
1493
1495
|
addError(t) {
|
|
1494
1496
|
this.errors.length >= Sr || this.errors.includes(t) || this.errors.push(t);
|
|
@@ -1502,14 +1504,14 @@ class Cr {
|
|
|
1502
1504
|
}
|
|
1503
1505
|
const tt = /* @__PURE__ */ new Set();
|
|
1504
1506
|
let O = null, z = null, $ = null, ot = null, U = null, lt = null;
|
|
1505
|
-
function
|
|
1507
|
+
function Ie(e) {
|
|
1506
1508
|
tt.add(e), Tr();
|
|
1507
1509
|
let t = !1;
|
|
1508
1510
|
return () => {
|
|
1509
1511
|
t || (t = !0, tt.delete(e), tt.size === 0 && _r());
|
|
1510
1512
|
};
|
|
1511
1513
|
}
|
|
1512
|
-
function
|
|
1514
|
+
function Et(e, t) {
|
|
1513
1515
|
const i = { type: e, fromUrl: t, toUrl: location.href };
|
|
1514
1516
|
lt = i.toUrl;
|
|
1515
1517
|
for (const r of [...tt])
|
|
@@ -1520,14 +1522,14 @@ function kt(e, t) {
|
|
|
1520
1522
|
}
|
|
1521
1523
|
function Tr() {
|
|
1522
1524
|
if ($) return;
|
|
1523
|
-
lt = location.href, U = () =>
|
|
1525
|
+
lt = location.href, U = () => Et("pop", lt ?? location.href), window.addEventListener("popstate", U), O = history.pushState, z = history.replaceState;
|
|
1524
1526
|
const e = O, t = z;
|
|
1525
1527
|
$ = function(i, r, n) {
|
|
1526
1528
|
const s = location.href;
|
|
1527
|
-
e.call(history, i, r, n),
|
|
1529
|
+
e.call(history, i, r, n), Et("push", s);
|
|
1528
1530
|
}, ot = function(i, r, n) {
|
|
1529
1531
|
const s = location.href;
|
|
1530
|
-
t.call(history, i, r, n),
|
|
1532
|
+
t.call(history, i, r, n), Et("replace", s);
|
|
1531
1533
|
}, history.pushState = $, history.replaceState = ot;
|
|
1532
1534
|
}
|
|
1533
1535
|
function _r() {
|
|
@@ -1535,17 +1537,17 @@ function _r() {
|
|
|
1535
1537
|
}
|
|
1536
1538
|
const Ar = 20;
|
|
1537
1539
|
function Lr(e) {
|
|
1538
|
-
return mt(e) ?
|
|
1540
|
+
return mt(e) ? Ft(e) : It(e);
|
|
1539
1541
|
}
|
|
1540
1542
|
function Pr(e) {
|
|
1541
|
-
return mt(e) ?
|
|
1543
|
+
return mt(e) ? ke(e) : ye(e);
|
|
1542
1544
|
}
|
|
1543
1545
|
class Rr {
|
|
1544
1546
|
constructor() {
|
|
1545
1547
|
this.breadcrumbs = [], this.active = !1, this.unsubscribeErrors = null, this.unsubscribeNavigation = null, this.lastUrl = "", this.boundClickHandler = (t) => this.handleClick(t), this.boundChangeHandler = (t) => this.handleChange(t);
|
|
1546
1548
|
}
|
|
1547
1549
|
start() {
|
|
1548
|
-
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors =
|
|
1550
|
+
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors = Bt.subscribe((t) => this.recordError(t)), this.unsubscribeNavigation = Ie(() => this.handleNavigation()));
|
|
1549
1551
|
}
|
|
1550
1552
|
stop() {
|
|
1551
1553
|
this.active && (this.active = !1, document.removeEventListener("click", this.boundClickHandler, !0), document.removeEventListener("change", this.boundChangeHandler, !0), this.unsubscribeErrors?.(), this.unsubscribeErrors = null, this.unsubscribeNavigation?.(), this.unsubscribeNavigation = null);
|
|
@@ -1574,7 +1576,7 @@ class Rr {
|
|
|
1574
1576
|
const i = t.target;
|
|
1575
1577
|
if (i && !_(i))
|
|
1576
1578
|
try {
|
|
1577
|
-
const r = i, n = mt(i) ?
|
|
1579
|
+
const r = i, n = mt(i) ? Ft(i) : r.name || r.placeholder || i.getAttribute("aria-label") || i.tagName;
|
|
1578
1580
|
this.add({
|
|
1579
1581
|
type: "ui",
|
|
1580
1582
|
category: "ui.input",
|
|
@@ -1586,7 +1588,7 @@ class Rr {
|
|
|
1586
1588
|
}
|
|
1587
1589
|
}
|
|
1588
1590
|
recordError(t) {
|
|
1589
|
-
const i =
|
|
1591
|
+
const i = Me(t);
|
|
1590
1592
|
this.add({
|
|
1591
1593
|
type: "console",
|
|
1592
1594
|
category: "console.error",
|
|
@@ -1610,21 +1612,21 @@ class Rr {
|
|
|
1610
1612
|
});
|
|
1611
1613
|
}
|
|
1612
1614
|
}
|
|
1613
|
-
const
|
|
1614
|
-
let
|
|
1615
|
+
const Fe = "mtb_frustration_state";
|
|
1616
|
+
let Lt = null;
|
|
1615
1617
|
function ct() {
|
|
1616
1618
|
try {
|
|
1617
|
-
const e = window.sessionStorage.getItem(
|
|
1618
|
-
return et(e ? JSON.parse(e) :
|
|
1619
|
+
const e = window.sessionStorage.getItem(Fe);
|
|
1620
|
+
return et(e ? JSON.parse(e) : Lt);
|
|
1619
1621
|
} catch {
|
|
1620
|
-
return et(
|
|
1622
|
+
return et(Lt);
|
|
1621
1623
|
}
|
|
1622
1624
|
}
|
|
1623
|
-
function
|
|
1625
|
+
function He(e) {
|
|
1624
1626
|
const t = et(e);
|
|
1625
|
-
|
|
1627
|
+
Lt = t;
|
|
1626
1628
|
try {
|
|
1627
|
-
window.sessionStorage.setItem(
|
|
1629
|
+
window.sessionStorage.setItem(Fe, JSON.stringify(t));
|
|
1628
1630
|
} catch {
|
|
1629
1631
|
}
|
|
1630
1632
|
}
|
|
@@ -1632,7 +1634,7 @@ function Dr() {
|
|
|
1632
1634
|
return ct().dismissedByUser;
|
|
1633
1635
|
}
|
|
1634
1636
|
function Mr() {
|
|
1635
|
-
|
|
1637
|
+
He({ ...ct(), dismissedByUser: !0 });
|
|
1636
1638
|
}
|
|
1637
1639
|
function et(e) {
|
|
1638
1640
|
const t = e ?? {};
|
|
@@ -1643,7 +1645,7 @@ function et(e) {
|
|
|
1643
1645
|
dismissedByUser: t.dismissedByUser === !0
|
|
1644
1646
|
};
|
|
1645
1647
|
}
|
|
1646
|
-
const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3,
|
|
1648
|
+
const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, St = 500, Nr = 2, Or = 3e4, zr = 2e3, $r = 1e3, Ur = 300, jr = /* @__PURE__ */ new Set([
|
|
1647
1649
|
"A",
|
|
1648
1650
|
"BUTTON",
|
|
1649
1651
|
"INPUT",
|
|
@@ -1666,7 +1668,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1666
1668
|
"listbox",
|
|
1667
1669
|
"slider",
|
|
1668
1670
|
"spinbutton"
|
|
1669
|
-
]), Wr = /* @__PURE__ */ new Set(["A", "BUTTON", "SUMMARY"]), Vr = /* @__PURE__ */ new Set(["button", "link", "tab", "menuitem"]),
|
|
1671
|
+
]), Wr = /* @__PURE__ */ new Set(["A", "BUTTON", "SUMMARY"]), Vr = /* @__PURE__ */ new Set(["button", "link", "tab", "menuitem"]), Zt = [
|
|
1670
1672
|
/\bnot found\b/,
|
|
1671
1673
|
/\bserver error\b/,
|
|
1672
1674
|
/^\s*(?:http\s*)?[45]\d{2}\s*$/,
|
|
@@ -1677,7 +1679,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1677
1679
|
this.clickHistory = [], this.unsubscribeErrors = null, this.active = !1, this.lastInteraction = null, this.cooldownUntil = 0, this.navTimestamps = [], this.unsubscribeNavigation = null, this.boundPageLeaveHandler = null, this.boundTurboNavigationHandler = null, this.lastNavigationAt = -1, this.boundSubmitHandler = null, this.boundInvalidHandler = null, this.recentSubmitForms = /* @__PURE__ */ new WeakSet(), this.recentFailedForms = /* @__PURE__ */ new WeakSet(), this.formFailureTimestamps = /* @__PURE__ */ new WeakMap(), this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.pendingTimers = /* @__PURE__ */ new Set(), this.onFrustration = t, this.boundClickHandler = (i) => this.handleClick(i);
|
|
1678
1680
|
}
|
|
1679
1681
|
start() {
|
|
1680
|
-
this.active || (this.active = !0, this.restoreState(), document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors =
|
|
1682
|
+
this.active || (this.active = !0, this.restoreState(), document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = Bt.subscribe(() => {
|
|
1681
1683
|
const t = Date.now();
|
|
1682
1684
|
if (!this.lastInteraction || t - this.lastInteraction.time > zr) return;
|
|
1683
1685
|
const i = this.lastInteraction;
|
|
@@ -1703,7 +1705,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1703
1705
|
this.pendingTimers.clear();
|
|
1704
1706
|
}
|
|
1705
1707
|
startNavigationTracking() {
|
|
1706
|
-
this.unsubscribeNavigation =
|
|
1708
|
+
this.unsubscribeNavigation = Ie((t) => this.handleNavigation(t)), this.boundPageLeaveHandler = () => this.noteNavigationStarted(), window.addEventListener("beforeunload", this.boundPageLeaveHandler), window.addEventListener("pagehide", this.boundPageLeaveHandler), this.boundTurboNavigationHandler = () => this.noteNavigationStarted(), document.addEventListener("turbo:before-visit", this.boundTurboNavigationHandler), document.addEventListener("turbo:submit-start", this.boundTurboNavigationHandler), document.addEventListener("turbo:before-fetch-request", this.boundTurboNavigationHandler);
|
|
1707
1709
|
}
|
|
1708
1710
|
stopNavigationTracking() {
|
|
1709
1711
|
this.unsubscribeNavigation?.(), this.unsubscribeNavigation = null, this.navTimestamps = [], this.boundPageLeaveHandler && (window.removeEventListener("beforeunload", this.boundPageLeaveHandler), window.removeEventListener("pagehide", this.boundPageLeaveHandler), this.boundPageLeaveHandler = null), this.boundTurboNavigationHandler && (document.removeEventListener("turbo:before-visit", this.boundTurboNavigationHandler), document.removeEventListener("turbo:submit-start", this.boundTurboNavigationHandler), document.removeEventListener("turbo:before-fetch-request", this.boundTurboNavigationHandler), this.boundTurboNavigationHandler = null), this.lastNavigationAt = -1;
|
|
@@ -1721,7 +1723,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1721
1723
|
}
|
|
1722
1724
|
persistState() {
|
|
1723
1725
|
const t = ct();
|
|
1724
|
-
|
|
1726
|
+
He({
|
|
1725
1727
|
...t,
|
|
1726
1728
|
navTimestamps: this.navTimestamps,
|
|
1727
1729
|
cooldownUntil: this.cooldownUntil,
|
|
@@ -1769,7 +1771,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1769
1771
|
const i = t.target;
|
|
1770
1772
|
i instanceof HTMLFormElement && (_(i) || (this.rememberSubmitAttempt(i), this.schedule(() => {
|
|
1771
1773
|
this.active && i.querySelector('[aria-invalid="true"], .is-invalid') && this.recordFormFailure(i);
|
|
1772
|
-
},
|
|
1774
|
+
}, St)));
|
|
1773
1775
|
}
|
|
1774
1776
|
trackFormSubmitIntent(t) {
|
|
1775
1777
|
const i = t.closest("button, input");
|
|
@@ -1783,11 +1785,11 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1783
1785
|
rememberSubmitAttempt(t) {
|
|
1784
1786
|
this.recentSubmitForms.add(t), this.schedule(() => {
|
|
1785
1787
|
this.recentSubmitForms.delete(t);
|
|
1786
|
-
},
|
|
1788
|
+
}, St);
|
|
1787
1789
|
}
|
|
1788
1790
|
recordFormFailure(t) {
|
|
1789
1791
|
if (this.recentFailedForms.has(t)) return;
|
|
1790
|
-
this.recentFailedForms.add(t), this.schedule(() => this.recentFailedForms.delete(t),
|
|
1792
|
+
this.recentFailedForms.add(t), this.schedule(() => this.recentFailedForms.delete(t), St);
|
|
1791
1793
|
const i = Date.now(), r = i - Or, n = (this.formFailureTimestamps.get(t) ?? []).filter((s) => s > r);
|
|
1792
1794
|
n.push(i), this.formFailureTimestamps.set(t, n), !(n.length < Nr) && (this.formFailureTimestamps.set(t, []), this.emitIfReady({
|
|
1793
1795
|
signal: "form_failure",
|
|
@@ -1805,7 +1807,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1805
1807
|
const t = location.href;
|
|
1806
1808
|
if (this.errorPageUrls.has(t)) return;
|
|
1807
1809
|
const i = document.title.toLowerCase();
|
|
1808
|
-
if (
|
|
1810
|
+
if (Zt.some((n) => n.test(i))) {
|
|
1809
1811
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1810
1812
|
signal: "error_page",
|
|
1811
1813
|
detail: document.title,
|
|
@@ -1818,7 +1820,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1818
1820
|
);
|
|
1819
1821
|
for (const n of r) {
|
|
1820
1822
|
const s = n.textContent ?? "";
|
|
1821
|
-
if (s.length < 200 &&
|
|
1823
|
+
if (s.length < 200 && Zt.some((a) => a.test(s.toLowerCase()))) {
|
|
1822
1824
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
1823
1825
|
signal: "error_page",
|
|
1824
1826
|
detail: s.trim().slice(0, 60),
|
|
@@ -1891,7 +1893,7 @@ const Ir = 4, Fr = 1500, Hr = 3, Br = 5e3, Et = 500, Nr = 2, Or = 3e4, zr = 2e3,
|
|
|
1891
1893
|
}
|
|
1892
1894
|
};
|
|
1893
1895
|
q.COOLDOWN_MS = 6e4;
|
|
1894
|
-
let
|
|
1896
|
+
let Pt = q;
|
|
1895
1897
|
function G(e) {
|
|
1896
1898
|
const t = e.tagName.toLowerCase(), i = e.id ? `#${e.id}` : "", r = e.className && typeof e.className == "string" ? "." + e.className.trim().split(/\s+/).slice(0, 2).join(".") : "", n = e.textContent?.trim().slice(0, 30) ?? "";
|
|
1897
1899
|
return `<${t}${i}${r}>${n ? ` "${n}"` : ""}`;
|
|
@@ -2047,16 +2049,16 @@ class Jr {
|
|
|
2047
2049
|
n = await fetch(t, i);
|
|
2048
2050
|
} catch (s) {
|
|
2049
2051
|
if (r > 0 && !i.signal?.aborted)
|
|
2050
|
-
return await
|
|
2052
|
+
return await Qt(this.retryDelayMs), this.fetchWithRetry(t, i, r - 1);
|
|
2051
2053
|
throw s;
|
|
2052
2054
|
}
|
|
2053
2055
|
if (n.ok) return n;
|
|
2054
2056
|
if (n.status >= 500 && r > 0)
|
|
2055
|
-
return await
|
|
2057
|
+
return await Qt(this.retryDelayMs), this.fetchWithRetry(t, i, r - 1);
|
|
2056
2058
|
throw new Yr(n.status);
|
|
2057
2059
|
}
|
|
2058
2060
|
}
|
|
2059
|
-
function
|
|
2061
|
+
function Qt(e) {
|
|
2060
2062
|
return e <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, e));
|
|
2061
2063
|
}
|
|
2062
2064
|
async function Zr(e, t) {
|
|
@@ -2108,47 +2110,47 @@ function tn() {
|
|
|
2108
2110
|
const e = crypto.getRandomValues(new Uint8Array(32));
|
|
2109
2111
|
return Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
2110
2112
|
}
|
|
2111
|
-
const
|
|
2112
|
-
let
|
|
2113
|
-
function
|
|
2113
|
+
const te = "mtb_anon_id", Be = "mtb_reporter_email", Ne = "mtb_board_url";
|
|
2114
|
+
let ee = null, Oe = null, ze = null;
|
|
2115
|
+
function $e() {
|
|
2114
2116
|
try {
|
|
2115
|
-
const e = window.localStorage.getItem(
|
|
2117
|
+
const e = window.localStorage.getItem(te);
|
|
2116
2118
|
if (e?.startsWith("anon_")) return e;
|
|
2117
|
-
const t =
|
|
2118
|
-
return window.localStorage.setItem(
|
|
2119
|
+
const t = ie();
|
|
2120
|
+
return window.localStorage.setItem(te, t), t;
|
|
2119
2121
|
} catch {
|
|
2120
|
-
return
|
|
2122
|
+
return ee ?? (ee = ie()), ee;
|
|
2121
2123
|
}
|
|
2122
2124
|
}
|
|
2123
|
-
function
|
|
2125
|
+
function Ue() {
|
|
2124
2126
|
try {
|
|
2125
|
-
return window.localStorage.getItem(
|
|
2127
|
+
return window.localStorage.getItem(Be) ?? void 0;
|
|
2126
2128
|
} catch {
|
|
2127
|
-
return
|
|
2129
|
+
return Oe ?? void 0;
|
|
2128
2130
|
}
|
|
2129
2131
|
}
|
|
2130
2132
|
function en(e) {
|
|
2131
|
-
|
|
2133
|
+
Oe = e;
|
|
2132
2134
|
try {
|
|
2133
|
-
window.localStorage.setItem(
|
|
2135
|
+
window.localStorage.setItem(Be, e);
|
|
2134
2136
|
} catch {
|
|
2135
2137
|
}
|
|
2136
2138
|
}
|
|
2137
2139
|
function rn() {
|
|
2138
2140
|
try {
|
|
2139
|
-
return window.localStorage.getItem(
|
|
2141
|
+
return window.localStorage.getItem(Ne) ?? void 0;
|
|
2140
2142
|
} catch {
|
|
2141
|
-
return
|
|
2143
|
+
return ze ?? void 0;
|
|
2142
2144
|
}
|
|
2143
2145
|
}
|
|
2144
2146
|
function I(e) {
|
|
2145
|
-
|
|
2147
|
+
ze = e;
|
|
2146
2148
|
try {
|
|
2147
|
-
window.localStorage.setItem(
|
|
2149
|
+
window.localStorage.setItem(Ne, e);
|
|
2148
2150
|
} catch {
|
|
2149
2151
|
}
|
|
2150
2152
|
}
|
|
2151
|
-
function
|
|
2153
|
+
function ie() {
|
|
2152
2154
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
|
|
2153
2155
|
}
|
|
2154
2156
|
const nn = {
|
|
@@ -2776,12 +2778,12 @@ const nn = {
|
|
|
2776
2778
|
fr: cn,
|
|
2777
2779
|
de: hn
|
|
2778
2780
|
};
|
|
2779
|
-
function
|
|
2781
|
+
function re(e) {
|
|
2780
2782
|
if (F[e]) return F[e];
|
|
2781
2783
|
const t = e.split("-")[0];
|
|
2782
2784
|
return F[t] ? F[t] : F.en;
|
|
2783
2785
|
}
|
|
2784
|
-
const dn = 60,
|
|
2786
|
+
const dn = 60, ne = ["value", "content"], un = Object.fromEntries([
|
|
2785
2787
|
"button",
|
|
2786
2788
|
"checkbox",
|
|
2787
2789
|
"color",
|
|
@@ -2815,44 +2817,44 @@ function pn() {
|
|
|
2815
2817
|
}
|
|
2816
2818
|
function fn(e, t) {
|
|
2817
2819
|
const i = st(e);
|
|
2818
|
-
return
|
|
2820
|
+
return Rt(i, t, Ae()), i;
|
|
2819
2821
|
}
|
|
2820
|
-
function
|
|
2822
|
+
function Rt(e, t, i) {
|
|
2821
2823
|
if (Array.isArray(e)) {
|
|
2822
|
-
e.forEach((o) =>
|
|
2824
|
+
e.forEach((o) => Rt(o, t, i));
|
|
2823
2825
|
return;
|
|
2824
2826
|
}
|
|
2825
|
-
if (!
|
|
2826
|
-
const r =
|
|
2827
|
+
if (!se(e)) return;
|
|
2828
|
+
const r = se(e.attributes) ? e.attributes : null, n = r && ne.some((o) => typeof r[o] == "string"), a = (typeof e.text == "string" || typeof e.textContent == "string" || typeof e.value == "string" || n) && typeof e.id == "number" ? t.mirror.getNode(e.id) : null;
|
|
2827
2829
|
if (a instanceof Element) {
|
|
2828
2830
|
if (typeof e.text == "string" && (e.text = at(e.text, a)), r)
|
|
2829
|
-
for (const o of
|
|
2831
|
+
for (const o of ne) {
|
|
2830
2832
|
const l = r[o];
|
|
2831
2833
|
typeof l == "string" && (r[o] = at(l, a));
|
|
2832
2834
|
}
|
|
2833
|
-
} else a?.nodeType === Node.TEXT_NODE &&
|
|
2834
|
-
Object.values(e).forEach((o) =>
|
|
2835
|
+
} else a?.nodeType === Node.TEXT_NODE && Le(a, i) && (typeof e.textContent == "string" && (e.textContent = g), typeof e.value == "string" && (e.value = g));
|
|
2836
|
+
Object.values(e).forEach((o) => Rt(o, t, i));
|
|
2835
2837
|
}
|
|
2836
|
-
function
|
|
2838
|
+
function se(e) {
|
|
2837
2839
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
2838
2840
|
}
|
|
2839
2841
|
async function gn() {
|
|
2840
2842
|
return (await import("@rrweb/record")).record;
|
|
2841
2843
|
}
|
|
2842
|
-
function
|
|
2844
|
+
function ae() {
|
|
2843
2845
|
const e = globalThis;
|
|
2844
2846
|
return e.rrwebRecord?.record ?? e.rrweb?.record;
|
|
2845
2847
|
}
|
|
2846
2848
|
function wn() {
|
|
2847
2849
|
return new Promise((e, t) => {
|
|
2848
|
-
const i =
|
|
2850
|
+
const i = ae();
|
|
2849
2851
|
if (i) {
|
|
2850
2852
|
e(i);
|
|
2851
2853
|
return;
|
|
2852
2854
|
}
|
|
2853
2855
|
const r = document.createElement("script");
|
|
2854
2856
|
r.src = mn, r.integrity = bn, r.crossOrigin = "anonymous", r.onload = () => {
|
|
2855
|
-
const n =
|
|
2857
|
+
const n = ae();
|
|
2856
2858
|
n ? e(n) : t(new Error("rrweb record global not found after script load"));
|
|
2857
2859
|
}, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
|
|
2858
2860
|
});
|
|
@@ -3040,14 +3042,14 @@ class An {
|
|
|
3040
3042
|
// Load the screenshot dependency and font CSS ahead of submit. Bitmap capture
|
|
3041
3043
|
// starts alongside Session creation; only cross-origin fallback waits for it.
|
|
3042
3044
|
warmScreenshotDeps() {
|
|
3043
|
-
this.screenshotEnabled &&
|
|
3045
|
+
this.screenshotEnabled && Ht();
|
|
3044
3046
|
}
|
|
3045
3047
|
start(t, i, r) {
|
|
3046
3048
|
const n = ++this.submissionAttempt, s = this.createSubmission(t, i, r, n);
|
|
3047
3049
|
return this.pendingSubmissionRequest = s, s;
|
|
3048
3050
|
}
|
|
3049
3051
|
async createSubmission(t, i, r, n) {
|
|
3050
|
-
if (await
|
|
3052
|
+
if (await oe(), n !== this.submissionAttempt) return null;
|
|
3051
3053
|
const s = kn(), a = Cn({
|
|
3052
3054
|
description: t,
|
|
3053
3055
|
pageContext: s,
|
|
@@ -3055,8 +3057,8 @@ class An {
|
|
|
3055
3057
|
annotation: i,
|
|
3056
3058
|
user: this.deps.user(),
|
|
3057
3059
|
recording: r,
|
|
3058
|
-
anonId:
|
|
3059
|
-
anonEmail:
|
|
3060
|
+
anonId: $e(),
|
|
3061
|
+
anonEmail: Ue(),
|
|
3060
3062
|
breadcrumbs: this.deps.breadcrumbCollector.getBreadcrumbs()
|
|
3061
3063
|
});
|
|
3062
3064
|
let o;
|
|
@@ -3070,26 +3072,27 @@ class An {
|
|
|
3070
3072
|
const h = new AbortController();
|
|
3071
3073
|
l = h, this.screenshotAbortController?.abort(), this.screenshotAbortController = h;
|
|
3072
3074
|
const m = (async () => {
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
const
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3075
|
+
if (await new Promise((ft) => setTimeout(ft, 0)), !(h.signal.aborted || n !== this.submissionAttempt))
|
|
3076
|
+
try {
|
|
3077
|
+
const y = await or(async (gt, Qe) => {
|
|
3078
|
+
const Ut = await o;
|
|
3079
|
+
if (!(h.signal.aborted || n !== this.submissionAttempt))
|
|
3080
|
+
return this.deps.apiClient.resolveScreenshotResourceUrl(
|
|
3081
|
+
Ut.id,
|
|
3082
|
+
Ut.token,
|
|
3083
|
+
gt,
|
|
3084
|
+
Qe,
|
|
3085
|
+
h.signal
|
|
3086
|
+
);
|
|
3087
|
+
}, h.signal);
|
|
3088
|
+
if (h.signal.aborted || n !== this.submissionAttempt || !y) return;
|
|
3089
|
+
const w = await lr(y, i ? [i] : [], this.deps.brandColors);
|
|
3090
|
+
if (h.signal.aborted || n !== this.submissionAttempt || !w) return;
|
|
3091
|
+
const b = await o;
|
|
3092
|
+
if (h.signal.aborted || n !== this.submissionAttempt) return;
|
|
3093
|
+
await this.deps.apiClient.uploadScreenshot(b.id, b.token, w, h.signal);
|
|
3094
|
+
} catch {
|
|
3095
|
+
}
|
|
3093
3096
|
})().finally(() => {
|
|
3094
3097
|
this.pendingScreenshotTask === m && (this.pendingScreenshotTask = null), this.screenshotAbortController === h && (this.screenshotAbortController = null);
|
|
3095
3098
|
});
|
|
@@ -3124,7 +3127,7 @@ class An {
|
|
|
3124
3127
|
if (i) return this.showFinalizeFailure({ canRetry: !0 });
|
|
3125
3128
|
throw a;
|
|
3126
3129
|
}
|
|
3127
|
-
await Promise.all([n,
|
|
3130
|
+
await Promise.all([n, oe()]), !(t !== this.submissionAttempt || this.activeSubmission !== r) && (this.activeSubmission = null, this.pendingSubmissionRequest = null, this.host.onFinalized(s, r));
|
|
3128
3131
|
}
|
|
3129
3132
|
async waitForScreenshot() {
|
|
3130
3133
|
const t = this.pendingScreenshotTask;
|
|
@@ -3155,7 +3158,7 @@ class An {
|
|
|
3155
3158
|
});
|
|
3156
3159
|
}
|
|
3157
3160
|
}
|
|
3158
|
-
function
|
|
3161
|
+
function oe() {
|
|
3159
3162
|
return new Promise((e) => requestAnimationFrame(() => setTimeout(e, 0)));
|
|
3160
3163
|
}
|
|
3161
3164
|
function bt(e) {
|
|
@@ -3216,13 +3219,13 @@ class S extends E {
|
|
|
3216
3219
|
bt(t), this.host.exitAll();
|
|
3217
3220
|
}
|
|
3218
3221
|
handleToolbarModeChange(t) {
|
|
3219
|
-
t === "record" ? this.host.transitionTo(new
|
|
3222
|
+
t === "record" ? this.host.transitionTo(new Nt(this.host)) : this.host.transitionTo(new S(this.host));
|
|
3220
3223
|
}
|
|
3221
3224
|
handleDrawStroke() {
|
|
3222
3225
|
this.host.transitionTo(new Ln(this.host, L() ? "sheet" : "bar"));
|
|
3223
3226
|
}
|
|
3224
3227
|
}
|
|
3225
|
-
class
|
|
3228
|
+
class Nt extends E {
|
|
3226
3229
|
constructor() {
|
|
3227
3230
|
super(...arguments), this.kind = "recording";
|
|
3228
3231
|
}
|
|
@@ -3249,13 +3252,13 @@ class Ln extends E {
|
|
|
3249
3252
|
bt(t), this.host.cancelDraw();
|
|
3250
3253
|
}
|
|
3251
3254
|
handleToolbarModeChange(t) {
|
|
3252
|
-
t === "record" ? this.host.transitionTo(new
|
|
3255
|
+
t === "record" ? this.host.transitionTo(new Nt(this.host)) : this.host.transitionTo(new S(this.host));
|
|
3253
3256
|
}
|
|
3254
3257
|
handleDrawStroke() {
|
|
3255
3258
|
this.surface === "bar" && this.host.refreshDrawBar();
|
|
3256
3259
|
}
|
|
3257
3260
|
}
|
|
3258
|
-
class
|
|
3261
|
+
class le extends E {
|
|
3259
3262
|
constructor(t, i) {
|
|
3260
3263
|
super(t), this.opts = i, this.kind = "popup";
|
|
3261
3264
|
}
|
|
@@ -3266,10 +3269,10 @@ class oe extends E {
|
|
|
3266
3269
|
bt(t), this.host.exitAll();
|
|
3267
3270
|
}
|
|
3268
3271
|
handleToolbarModeChange(t) {
|
|
3269
|
-
t === "record" ? this.host.transitionTo(new
|
|
3272
|
+
t === "record" ? this.host.transitionTo(new Nt(this.host)) : (this.host.dismissNotePopup(), this.host.transitionTo(new S(this.host)));
|
|
3270
3273
|
}
|
|
3271
3274
|
}
|
|
3272
|
-
class
|
|
3275
|
+
class Ct extends E {
|
|
3273
3276
|
constructor() {
|
|
3274
3277
|
super(...arguments), this.kind = "clarifying";
|
|
3275
3278
|
}
|
|
@@ -3294,33 +3297,33 @@ class Z extends E {
|
|
|
3294
3297
|
}
|
|
3295
3298
|
const Pn = /^#[0-9a-f]{6}$/i;
|
|
3296
3299
|
function Rn(e) {
|
|
3297
|
-
return e === void 0 ? void 0 : typeof e != "object" || e === null || ![e.primary, e.hover, e.active, e.onPrimary].every((i) => typeof i == "string" && Pn.test(i)) ?
|
|
3300
|
+
return e === void 0 ? void 0 : typeof e != "object" || e === null || ![e.primary, e.hover, e.active, e.onPrimary].every((i) => typeof i == "string" && Pn.test(i)) ? ce() : {
|
|
3298
3301
|
primary: e.primary.toLowerCase(),
|
|
3299
3302
|
hover: e.hover.toLowerCase(),
|
|
3300
3303
|
active: e.active.toLowerCase(),
|
|
3301
3304
|
onPrimary: e.onPrimary.toLowerCase()
|
|
3302
3305
|
};
|
|
3303
3306
|
}
|
|
3304
|
-
function
|
|
3307
|
+
function ce() {
|
|
3305
3308
|
console.warn(
|
|
3306
3309
|
"[MakeThisBetter] brandColors requires primary, hover, active, and onPrimary as six-digit hex colors."
|
|
3307
3310
|
);
|
|
3308
3311
|
}
|
|
3309
|
-
function
|
|
3312
|
+
function he() {
|
|
3310
3313
|
const { hostname: e } = window.location;
|
|
3311
3314
|
return e === "localhost" || e === "127.0.0.1" || e === "[::1]" || e.endsWith(".localhost") || e.endsWith(".local") || e.endsWith(".test");
|
|
3312
3315
|
}
|
|
3313
3316
|
class Dn {
|
|
3314
3317
|
constructor(t) {
|
|
3315
3318
|
this.tab = null, this.toolbar = null, this.session = null, this.drawBar = null, this.dim = null, this.pageOffset = new ai(), this.chatPopup = null, this.scrollLock = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.state = new J(this), this.via = "pin", this.currentAnnotation = null, this.lastPopupPos = null, this.recordingManager = null, this.touchHintShown = !1, this.lastHandoff = {}, this.handleKeydown = (i) => {
|
|
3316
|
-
i.key === "Escape" && (
|
|
3319
|
+
i.key === "Escape" && (Mt(i) || this.state.handleEscape(i));
|
|
3317
3320
|
}, this.stopRecordingIntoNote = () => {
|
|
3318
|
-
this.recordingManager && (this.recordingManager.stop(), this.via = "record", this.transitionTo(new
|
|
3321
|
+
this.recordingManager && (this.recordingManager.stop(), this.via = "record", this.transitionTo(new le(this, {
|
|
3319
3322
|
x: window.innerWidth / 2,
|
|
3320
3323
|
y: window.innerHeight / 2,
|
|
3321
3324
|
targetName: this.messages.record.timer_label
|
|
3322
3325
|
})));
|
|
3323
|
-
}, this.config = t, t.projectKey || console.warn("[MakeThisBetter] projectKey is missing. Feedback submission will be rejected."), this.brandColors = Rn(t.brandColors), this.messages =
|
|
3326
|
+
}, this.config = t, t.projectKey || console.warn("[MakeThisBetter] projectKey is missing. Feedback submission will be rejected."), this.brandColors = Rn(t.brandColors), this.messages = re(t.locale ?? document.documentElement.lang ?? "en"), this.apiClient = new Jr({
|
|
3324
3327
|
projectKey: t.projectKey,
|
|
3325
3328
|
apiUrl: t.apiUrl,
|
|
3326
3329
|
userToken: t.userToken,
|
|
@@ -3348,7 +3351,7 @@ class Dn {
|
|
|
3348
3351
|
this.consoleCollector.stop(), this.breadcrumbCollector.stop(), console.warn("[MakeThisBetter] Widget failed to start:", i);
|
|
3349
3352
|
return;
|
|
3350
3353
|
}
|
|
3351
|
-
t.frustrationDetection !== !1 && (this.frustrationDetector = new
|
|
3354
|
+
t.frustrationDetection !== !1 && (this.frustrationDetector = new Pt(() => this.handleFrustration()), this.frustrationDetector.start()), document.addEventListener("keydown", this.handleKeydown, !0);
|
|
3352
3355
|
}
|
|
3353
3356
|
/**
|
|
3354
3357
|
* The single mutation point of the mode machine: the outgoing state exits,
|
|
@@ -3359,14 +3362,14 @@ class Dn {
|
|
|
3359
3362
|
this.state = t, i.exit(), t.enter(), this.tab?.setActive(t.launcherLit);
|
|
3360
3363
|
}
|
|
3361
3364
|
buildUI() {
|
|
3362
|
-
if (this.shadow = new
|
|
3363
|
-
|
|
3365
|
+
if (this.shadow = new _t(this.config.theme ?? "auto", this.brandColors), this.config.entryMode === "api") {
|
|
3366
|
+
he() && console.warn(
|
|
3364
3367
|
'[MakeThisBetter] entryMode: "api" renders no launcher. Call MakeThisBetter.open() from your own UI.'
|
|
3365
3368
|
);
|
|
3366
3369
|
return;
|
|
3367
3370
|
}
|
|
3368
3371
|
if (L()) {
|
|
3369
|
-
|
|
3372
|
+
he() && console.warn(
|
|
3370
3373
|
"[MakeThisBetter] No launcher is rendered on touch devices. Call MakeThisBetter.open() from your own mobile UI."
|
|
3371
3374
|
);
|
|
3372
3375
|
return;
|
|
@@ -3399,7 +3402,7 @@ class Dn {
|
|
|
3399
3402
|
// the language they were opened in rather than being re-rendered underneath a
|
|
3400
3403
|
// reporter who may be mid-sentence.
|
|
3401
3404
|
setLocale(t) {
|
|
3402
|
-
this.config.locale = t, this.messages =
|
|
3405
|
+
this.config.locale = t, this.messages = re(t), this.tab?.setMessages(this.messages);
|
|
3403
3406
|
}
|
|
3404
3407
|
handleFrustration() {
|
|
3405
3408
|
!this.state.acceptsFrustrationPrompt || this.frustrationPrompt || Dr() || (this.frustrationPrompt = new ni(this.shadow, this.messages, {
|
|
@@ -3424,7 +3427,7 @@ class Dn {
|
|
|
3424
3427
|
return this.toolbar !== null;
|
|
3425
3428
|
}
|
|
3426
3429
|
mountAnnotationChrome() {
|
|
3427
|
-
|
|
3430
|
+
Ht();
|
|
3428
3431
|
const t = L();
|
|
3429
3432
|
this.toolbar = new ui(
|
|
3430
3433
|
this.shadow,
|
|
@@ -3441,7 +3444,7 @@ class Dn {
|
|
|
3441
3444
|
ensureSession() {
|
|
3442
3445
|
this.session || (this.session = new _i(this.shadow, this.messages, {
|
|
3443
3446
|
onPin: (t, i) => {
|
|
3444
|
-
this.currentAnnotation = t, this.via = "pin", this.transitionTo(new
|
|
3447
|
+
this.currentAnnotation = t, this.via = "pin", this.transitionTo(new le(this, {
|
|
3445
3448
|
x: t.x,
|
|
3446
3449
|
y: t.y,
|
|
3447
3450
|
targetName: i,
|
|
@@ -3489,7 +3492,7 @@ class Dn {
|
|
|
3489
3492
|
mountDrawSheet() {
|
|
3490
3493
|
this.engageScrollLock();
|
|
3491
3494
|
let t = !1;
|
|
3492
|
-
this.chatPopup = new
|
|
3495
|
+
this.chatPopup = new yt(this.shadow, {
|
|
3493
3496
|
targetName: this.messages.annotation.drawing,
|
|
3494
3497
|
x: window.innerWidth / 2,
|
|
3495
3498
|
y: window.innerHeight / 2,
|
|
@@ -3511,7 +3514,7 @@ class Dn {
|
|
|
3511
3514
|
onAnswer: (i, r, n) => this.apiClient.answerClarification(i, r, n),
|
|
3512
3515
|
onFinalize: () => (this.transitionTo(new Z(this)), this.lifecycle.finalize()),
|
|
3513
3516
|
onCancel: () => t ? this.exitAll() : this.cancelDraw(),
|
|
3514
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3517
|
+
onConversationOpen: () => this.transitionTo(new Ct(this)),
|
|
3515
3518
|
onActivity: () => this.lifecycle.warmScreenshotDeps(),
|
|
3516
3519
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3517
3520
|
resolveEmailCapture: () => this.buildEmailCapture()
|
|
@@ -3540,7 +3543,7 @@ class Dn {
|
|
|
3540
3543
|
this.teardownDrawBar(), this.releaseScrollLock(), this.dim?.destroy(), this.dim = null, this.mountChatAfterSubmit(r, i, n);
|
|
3541
3544
|
}
|
|
3542
3545
|
mountChatAfterSubmit(t, i, r) {
|
|
3543
|
-
this.dim = new
|
|
3546
|
+
this.dim = new jt(this.shadow, () => this.exitAll()), this.engageScrollLock(), this.chatPopup = new yt(this.shadow, {
|
|
3544
3547
|
targetName: i?.targetName ?? this.messages.annotation.drawing,
|
|
3545
3548
|
x: this.lastPopupPos?.x ?? window.innerWidth / 2,
|
|
3546
3549
|
y: this.lastPopupPos?.y ?? window.innerHeight / 2,
|
|
@@ -3554,17 +3557,17 @@ class Dn {
|
|
|
3554
3557
|
onAnswer: (n, s, a) => this.apiClient.answerClarification(n, s, a),
|
|
3555
3558
|
onFinalize: () => (this.transitionTo(new Z(this)), this.lifecycle.finalize()),
|
|
3556
3559
|
onCancel: () => this.exitAll(),
|
|
3557
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3560
|
+
onConversationOpen: () => this.transitionTo(new Ct(this)),
|
|
3558
3561
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3559
3562
|
resolveEmailCapture: () => this.buildEmailCapture()
|
|
3560
3563
|
}), this.chatPopup.submit(t);
|
|
3561
3564
|
}
|
|
3562
3565
|
mountNotePopup({ x: t, y: i, targetName: r, targetRect: n }) {
|
|
3563
|
-
this.lastPopupPos = { x: t, y: i }, this.teardownDrawBar(), this.session?.dismissInteraction(), this.chatPopup?.destroy(), this.chatPopup = null, this.dim?.destroy(), this.dim = null, this.dim = new
|
|
3566
|
+
this.lastPopupPos = { x: t, y: i }, this.teardownDrawBar(), this.session?.dismissInteraction(), this.chatPopup?.destroy(), this.chatPopup = null, this.dim?.destroy(), this.dim = null, this.dim = new jt(this.shadow, () => this.exitAll());
|
|
3564
3567
|
const s = this.recordingManager?.getRecording();
|
|
3565
3568
|
s && this.lifecycle.setScreenshotEnabled(!0);
|
|
3566
3569
|
const a = this.currentAnnotation, o = this.recordingManager?.getRecording() ?? void 0;
|
|
3567
|
-
this.chatPopup = new
|
|
3570
|
+
this.chatPopup = new yt(this.shadow, {
|
|
3568
3571
|
targetName: r,
|
|
3569
3572
|
x: t,
|
|
3570
3573
|
y: i,
|
|
@@ -3583,7 +3586,7 @@ class Dn {
|
|
|
3583
3586
|
// remains in this card as a retryable receipt state.
|
|
3584
3587
|
onFinalize: () => (this.teardownSubmittingUi(), this.transitionTo(new Z(this)), this.lifecycle.finalize()),
|
|
3585
3588
|
onCancel: () => this.exitAll(),
|
|
3586
|
-
onConversationOpen: () => this.transitionTo(new
|
|
3589
|
+
onConversationOpen: () => this.transitionTo(new Ct(this)),
|
|
3587
3590
|
onActivity: () => this.lifecycle.warmScreenshotDeps(),
|
|
3588
3591
|
resolveBoardLink: () => this.buildViewFeedbackHandler() ?? this.buildMyFeedbackHandler(),
|
|
3589
3592
|
resolveEmailCapture: () => this.buildEmailCapture(),
|
|
@@ -3611,7 +3614,7 @@ class Dn {
|
|
|
3611
3614
|
buildMyFeedbackHandler() {
|
|
3612
3615
|
if (!this.config.user && rn())
|
|
3613
3616
|
return async () => {
|
|
3614
|
-
const t = await this.apiClient.createIdentityToken(
|
|
3617
|
+
const t = await this.apiClient.createIdentityToken($e());
|
|
3615
3618
|
!t?.identity_token || !t.board_url || (I(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
|
|
3616
3619
|
};
|
|
3617
3620
|
}
|
|
@@ -3645,7 +3648,7 @@ class Dn {
|
|
|
3645
3648
|
buildEmailCapture() {
|
|
3646
3649
|
if (this.config.user) return;
|
|
3647
3650
|
const { feedbackId: t, identityToken: i } = this.lastHandoff;
|
|
3648
|
-
if (!(!t || !i) &&
|
|
3651
|
+
if (!(!t || !i) && !Ue())
|
|
3649
3652
|
return {
|
|
3650
3653
|
onSubmit: async (r) => {
|
|
3651
3654
|
const n = await this.apiClient.updateReporter(t, r, i);
|
|
@@ -3753,7 +3756,7 @@ function v(e) {
|
|
|
3753
3756
|
return t;
|
|
3754
3757
|
}
|
|
3755
3758
|
let C = null;
|
|
3756
|
-
function
|
|
3759
|
+
function je(e = {}) {
|
|
3757
3760
|
return C || (e.includeStyleProperties ? (C = e.includeStyleProperties, C) : (C = v(window.getComputedStyle(document.documentElement)), C));
|
|
3758
3761
|
}
|
|
3759
3762
|
function ht(e, t) {
|
|
@@ -3768,7 +3771,7 @@ function Nn(e) {
|
|
|
3768
3771
|
const t = ht(e, "border-top-width"), i = ht(e, "border-bottom-width");
|
|
3769
3772
|
return e.clientHeight + t + i;
|
|
3770
3773
|
}
|
|
3771
|
-
function
|
|
3774
|
+
function Ot(e, t = {}) {
|
|
3772
3775
|
const i = t.width || Bn(e), r = t.height || Nn(e);
|
|
3773
3776
|
return { width: i, height: r };
|
|
3774
3777
|
}
|
|
@@ -3825,7 +3828,7 @@ function qn(e) {
|
|
|
3825
3828
|
return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
3826
3829
|
}
|
|
3827
3830
|
function Wn(e, t) {
|
|
3828
|
-
return
|
|
3831
|
+
return je(t).map((i) => {
|
|
3829
3832
|
const r = e.getPropertyValue(i), n = e.getPropertyPriority(i);
|
|
3830
3833
|
return `${i}: ${r}${n ? " !important" : ""};`;
|
|
3831
3834
|
}).join(" ");
|
|
@@ -3834,7 +3837,7 @@ function Vn(e, t, i, r) {
|
|
|
3834
3837
|
const n = `.${e}:${t}`, s = i.cssText ? qn(i) : Wn(i, r);
|
|
3835
3838
|
return document.createTextNode(`${n}{${s}}`);
|
|
3836
3839
|
}
|
|
3837
|
-
function
|
|
3840
|
+
function de(e, t, i, r) {
|
|
3838
3841
|
const n = window.getComputedStyle(e, i), s = n.getPropertyValue("content");
|
|
3839
3842
|
if (s === "" || s === "none")
|
|
3840
3843
|
return;
|
|
@@ -3848,16 +3851,16 @@ function he(e, t, i, r) {
|
|
|
3848
3851
|
o.appendChild(Vn(a, i, n, r)), t.appendChild(o);
|
|
3849
3852
|
}
|
|
3850
3853
|
function Yn(e, t, i) {
|
|
3851
|
-
|
|
3854
|
+
de(e, t, ":before", i), de(e, t, ":after", i);
|
|
3852
3855
|
}
|
|
3853
|
-
const
|
|
3854
|
-
woff:
|
|
3855
|
-
woff2:
|
|
3856
|
+
const ue = "application/font-woff", me = "image/jpeg", Xn = {
|
|
3857
|
+
woff: ue,
|
|
3858
|
+
woff2: ue,
|
|
3856
3859
|
ttf: "application/font-truetype",
|
|
3857
3860
|
eot: "application/vnd.ms-fontobject",
|
|
3858
3861
|
png: "image/png",
|
|
3859
|
-
jpg:
|
|
3860
|
-
jpeg:
|
|
3862
|
+
jpg: me,
|
|
3863
|
+
jpeg: me,
|
|
3861
3864
|
gif: "image/gif",
|
|
3862
3865
|
tiff: "image/tiff",
|
|
3863
3866
|
svg: "image/svg+xml",
|
|
@@ -3867,20 +3870,20 @@ function Kn(e) {
|
|
|
3867
3870
|
const t = /\.([^./]*?)$/g.exec(e);
|
|
3868
3871
|
return t ? t[1] : "";
|
|
3869
3872
|
}
|
|
3870
|
-
function
|
|
3873
|
+
function zt(e) {
|
|
3871
3874
|
const t = Kn(e).toLowerCase();
|
|
3872
3875
|
return Xn[t] || "";
|
|
3873
3876
|
}
|
|
3874
3877
|
function Gn(e) {
|
|
3875
3878
|
return e.split(/,/)[1];
|
|
3876
3879
|
}
|
|
3877
|
-
function
|
|
3880
|
+
function Dt(e) {
|
|
3878
3881
|
return e.search(/^(data:)/) !== -1;
|
|
3879
3882
|
}
|
|
3880
3883
|
function Jn(e, t) {
|
|
3881
3884
|
return `data:${t};base64,${e}`;
|
|
3882
3885
|
}
|
|
3883
|
-
async function
|
|
3886
|
+
async function qe(e, t, i) {
|
|
3884
3887
|
const r = await fetch(e, t);
|
|
3885
3888
|
if (!r.ok)
|
|
3886
3889
|
throw new Error(`Resource "${r.url}" returned HTTP ${r.status}`);
|
|
@@ -3896,19 +3899,19 @@ async function je(e, t, i) {
|
|
|
3896
3899
|
}, o.readAsDataURL(n);
|
|
3897
3900
|
});
|
|
3898
3901
|
}
|
|
3899
|
-
const
|
|
3902
|
+
const Tt = {};
|
|
3900
3903
|
function Zn(e, t, i) {
|
|
3901
3904
|
let r = e.replace(/\?.*/, "");
|
|
3902
3905
|
return i && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
|
|
3903
3906
|
}
|
|
3904
|
-
async function
|
|
3907
|
+
async function $t(e, t, i) {
|
|
3905
3908
|
const r = Zn(e, t, i.includeQueryParams);
|
|
3906
|
-
if (
|
|
3907
|
-
return
|
|
3909
|
+
if (Tt[r] != null)
|
|
3910
|
+
return Tt[r];
|
|
3908
3911
|
i.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
3909
3912
|
let n;
|
|
3910
3913
|
try {
|
|
3911
|
-
const s = (o) =>
|
|
3914
|
+
const s = (o) => qe(o, i.fetchRequestInit, ({ res: l, result: c }) => (t || (t = l.headers.get("Content-Type") || ""), Gn(c)));
|
|
3912
3915
|
let a;
|
|
3913
3916
|
try {
|
|
3914
3917
|
a = await s(e);
|
|
@@ -3924,7 +3927,7 @@ async function zt(e, t, i) {
|
|
|
3924
3927
|
let a = `Failed to fetch resource: ${e}`;
|
|
3925
3928
|
s && (a = typeof s == "string" ? s : s.message), a && console.warn(a);
|
|
3926
3929
|
}
|
|
3927
|
-
return
|
|
3930
|
+
return Tt[r] = n, n;
|
|
3928
3931
|
}
|
|
3929
3932
|
async function Qn(e) {
|
|
3930
3933
|
const t = e.toDataURL();
|
|
@@ -3937,7 +3940,7 @@ async function ts(e, t) {
|
|
|
3937
3940
|
const o = s.toDataURL();
|
|
3938
3941
|
return dt(o);
|
|
3939
3942
|
}
|
|
3940
|
-
const i = e.poster, r =
|
|
3943
|
+
const i = e.poster, r = zt(i), n = await $t(i, r, t);
|
|
3941
3944
|
return dt(n);
|
|
3942
3945
|
}
|
|
3943
3946
|
async function es(e, t) {
|
|
@@ -3950,12 +3953,12 @@ async function es(e, t) {
|
|
|
3950
3953
|
return e.cloneNode(!1);
|
|
3951
3954
|
}
|
|
3952
3955
|
async function is(e, t) {
|
|
3953
|
-
return p(e, HTMLCanvasElement) ? Qn(e) : p(e, HTMLVideoElement) ? ts(e, t) : p(e, HTMLIFrameElement) ? es(e, t) : e.cloneNode(
|
|
3956
|
+
return p(e, HTMLCanvasElement) ? Qn(e) : p(e, HTMLVideoElement) ? ts(e, t) : p(e, HTMLIFrameElement) ? es(e, t) : e.cloneNode(We(e));
|
|
3954
3957
|
}
|
|
3955
|
-
const rs = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT",
|
|
3958
|
+
const rs = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", We = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
|
|
3956
3959
|
async function ns(e, t, i) {
|
|
3957
3960
|
var r, n;
|
|
3958
|
-
if (
|
|
3961
|
+
if (We(t))
|
|
3959
3962
|
return t;
|
|
3960
3963
|
let s = [];
|
|
3961
3964
|
return rs(e) && e.assignedNodes ? s = v(e.assignedNodes()) : p(e, HTMLIFrameElement) && (!((r = e.contentDocument) === null || r === void 0) && r.body) ? s = v(e.contentDocument.body.childNodes) : s = v(((n = e.shadowRoot) !== null && n !== void 0 ? n : e).childNodes), s.length === 0 || p(e, HTMLVideoElement) || await s.reduce((a, o) => a.then(() => pt(o, i)).then((l) => {
|
|
@@ -3967,7 +3970,7 @@ function ss(e, t, i) {
|
|
|
3967
3970
|
if (!r)
|
|
3968
3971
|
return;
|
|
3969
3972
|
const n = window.getComputedStyle(e);
|
|
3970
|
-
n.cssText ? (r.cssText = n.cssText, r.transformOrigin = n.transformOrigin) :
|
|
3973
|
+
n.cssText ? (r.cssText = n.cssText, r.transformOrigin = n.transformOrigin) : je(i).forEach((s) => {
|
|
3971
3974
|
let a = n.getPropertyValue(s);
|
|
3972
3975
|
s === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), p(e, HTMLIFrameElement) && s === "display" && a === "inline" && (a = "block"), s === "d" && t.getAttribute("d") && (a = `path(${t.getAttribute("d")})`), r.setProperty(s, a, n.getPropertyPriority(s));
|
|
3973
3976
|
});
|
|
@@ -4011,20 +4014,20 @@ async function cs(e, t) {
|
|
|
4011
4014
|
async function pt(e, t, i) {
|
|
4012
4015
|
return !i && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((r) => is(r, t)).then((r) => ns(e, r, t)).then((r) => ls(e, r, t)).then((r) => cs(r, t));
|
|
4013
4016
|
}
|
|
4014
|
-
const
|
|
4017
|
+
const Ve = /url\((['"]?)([^'"]+?)\1\)/g, hs = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ds = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
4015
4018
|
function us(e) {
|
|
4016
4019
|
const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
4017
4020
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
4018
4021
|
}
|
|
4019
4022
|
function ms(e) {
|
|
4020
4023
|
const t = [];
|
|
4021
|
-
return e.replace(
|
|
4024
|
+
return e.replace(Ve, (i, r, n) => (t.push(n), i)), t.filter((i) => !Dt(i));
|
|
4022
4025
|
}
|
|
4023
4026
|
async function bs(e, t, i, r, n) {
|
|
4024
4027
|
try {
|
|
4025
|
-
const s = i ? Fn(t, i) : t, a =
|
|
4028
|
+
const s = i ? Fn(t, i) : t, a = zt(t);
|
|
4026
4029
|
let o;
|
|
4027
|
-
return n || (o = await
|
|
4030
|
+
return n || (o = await $t(s, a, r)), e.replace(us(t), `$1${o}$3`);
|
|
4028
4031
|
} catch {
|
|
4029
4032
|
}
|
|
4030
4033
|
return e;
|
|
@@ -4040,11 +4043,11 @@ function ps(e, { preferredFontFormat: t }) {
|
|
|
4040
4043
|
}
|
|
4041
4044
|
}) : e;
|
|
4042
4045
|
}
|
|
4043
|
-
function
|
|
4044
|
-
return e.search(
|
|
4046
|
+
function Ye(e) {
|
|
4047
|
+
return e.search(Ve) !== -1;
|
|
4045
4048
|
}
|
|
4046
|
-
async function
|
|
4047
|
-
if (!
|
|
4049
|
+
async function Xe(e, t, i) {
|
|
4050
|
+
if (!Ye(e))
|
|
4048
4051
|
return e;
|
|
4049
4052
|
const r = ps(e, i);
|
|
4050
4053
|
return ms(r).reduce((s, a) => s.then((o) => bs(o, a, t, i)), Promise.resolve(r));
|
|
@@ -4053,7 +4056,7 @@ async function T(e, t, i) {
|
|
|
4053
4056
|
var r;
|
|
4054
4057
|
const n = (r = t.style) === null || r === void 0 ? void 0 : r.getPropertyValue(e);
|
|
4055
4058
|
if (n) {
|
|
4056
|
-
const s = await
|
|
4059
|
+
const s = await Xe(n, null, i);
|
|
4057
4060
|
return t.style.setProperty(e, s, t.style.getPropertyPriority(e)), !0;
|
|
4058
4061
|
}
|
|
4059
4062
|
return !1;
|
|
@@ -4063,9 +4066,9 @@ async function fs(e, t) {
|
|
|
4063
4066
|
}
|
|
4064
4067
|
async function gs(e, t) {
|
|
4065
4068
|
const i = p(e, HTMLImageElement);
|
|
4066
|
-
if (!(i && !
|
|
4069
|
+
if (!(i && !Dt(e.src)) && !(p(e, SVGImageElement) && !Dt(e.href.baseVal)))
|
|
4067
4070
|
return;
|
|
4068
|
-
const r = i ? e.src : e.href.baseVal, n = await
|
|
4071
|
+
const r = i ? e.src : e.href.baseVal, n = await $t(r, zt(r), t);
|
|
4069
4072
|
await new Promise((s, a) => {
|
|
4070
4073
|
e.onload = s, e.onerror = t.onImageErrorHandler ? (...l) => {
|
|
4071
4074
|
try {
|
|
@@ -4079,10 +4082,10 @@ async function gs(e, t) {
|
|
|
4079
4082
|
});
|
|
4080
4083
|
}
|
|
4081
4084
|
async function ws(e, t) {
|
|
4082
|
-
const r = v(e.childNodes).map((n) =>
|
|
4085
|
+
const r = v(e.childNodes).map((n) => Ke(n, t));
|
|
4083
4086
|
await Promise.all(r).then(() => e);
|
|
4084
4087
|
}
|
|
4085
|
-
async function
|
|
4088
|
+
async function Ke(e, t) {
|
|
4086
4089
|
p(e, Element) && (await fs(e, t), await gs(e, t), await ws(e, t));
|
|
4087
4090
|
}
|
|
4088
4091
|
function ys(e, t) {
|
|
@@ -4093,23 +4096,23 @@ function ys(e, t) {
|
|
|
4093
4096
|
i[n] = r[n];
|
|
4094
4097
|
}), e;
|
|
4095
4098
|
}
|
|
4096
|
-
const
|
|
4097
|
-
async function
|
|
4098
|
-
let t =
|
|
4099
|
+
const be = {};
|
|
4100
|
+
async function pe(e) {
|
|
4101
|
+
let t = be[e];
|
|
4099
4102
|
if (t != null)
|
|
4100
4103
|
return t;
|
|
4101
4104
|
const r = await (await fetch(e)).text();
|
|
4102
|
-
return t = { url: e, cssText: r },
|
|
4105
|
+
return t = { url: e, cssText: r }, be[e] = t, t;
|
|
4103
4106
|
}
|
|
4104
|
-
async function
|
|
4107
|
+
async function fe(e, t) {
|
|
4105
4108
|
let i = e.cssText;
|
|
4106
4109
|
const r = /url\(["']?([^"')]+)["']?\)/g, s = (i.match(/url\([^)]+\)/g) || []).map(async (a) => {
|
|
4107
4110
|
let o = a.replace(r, "$1");
|
|
4108
|
-
return o.startsWith("https://") || (o = new URL(o, e.url).href),
|
|
4111
|
+
return o.startsWith("https://") || (o = new URL(o, e.url).href), qe(o, t.fetchRequestInit, ({ result: l }) => (i = i.replace(a, `url(${l})`), [a, l]));
|
|
4109
4112
|
});
|
|
4110
4113
|
return Promise.all(s).then(() => i);
|
|
4111
4114
|
}
|
|
4112
|
-
function
|
|
4115
|
+
function ge(e) {
|
|
4113
4116
|
if (e == null)
|
|
4114
4117
|
return [];
|
|
4115
4118
|
const t = [], i = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -4143,7 +4146,7 @@ async function vs(e, t) {
|
|
|
4143
4146
|
v(n.cssRules || []).forEach((s, a) => {
|
|
4144
4147
|
if (s.type === CSSRule.IMPORT_RULE) {
|
|
4145
4148
|
let o = a + 1;
|
|
4146
|
-
const l = s.href, c =
|
|
4149
|
+
const l = s.href, c = pe(l).then((h) => fe(h, t)).then((h) => ge(h).forEach((u) => {
|
|
4147
4150
|
try {
|
|
4148
4151
|
n.insertRule(u, u.startsWith("@import") ? o += 1 : n.cssRules.length);
|
|
4149
4152
|
} catch (m) {
|
|
@@ -4160,7 +4163,7 @@ async function vs(e, t) {
|
|
|
4160
4163
|
});
|
|
4161
4164
|
} catch (s) {
|
|
4162
4165
|
const a = e.find((o) => o.href == null) || document.styleSheets[0];
|
|
4163
|
-
n.href != null && r.push(
|
|
4166
|
+
n.href != null && r.push(pe(n.href).then((o) => fe(o, t)).then((o) => ge(o).forEach((l) => {
|
|
4164
4167
|
a.insertRule(l, a.cssRules.length);
|
|
4165
4168
|
})).catch((o) => {
|
|
4166
4169
|
console.error("Error loading remote stylesheet", o);
|
|
@@ -4178,7 +4181,7 @@ async function vs(e, t) {
|
|
|
4178
4181
|
}), i));
|
|
4179
4182
|
}
|
|
4180
4183
|
function xs(e) {
|
|
4181
|
-
return e.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) =>
|
|
4184
|
+
return e.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => Ye(t.style.getPropertyValue("src")));
|
|
4182
4185
|
}
|
|
4183
4186
|
async function ks(e, t) {
|
|
4184
4187
|
if (e.ownerDocument == null)
|
|
@@ -4186,45 +4189,45 @@ async function ks(e, t) {
|
|
|
4186
4189
|
const i = v(e.ownerDocument.styleSheets), r = await vs(i, t);
|
|
4187
4190
|
return xs(r);
|
|
4188
4191
|
}
|
|
4189
|
-
function
|
|
4192
|
+
function Ge(e) {
|
|
4190
4193
|
return e.trim().replace(/["']/g, "");
|
|
4191
4194
|
}
|
|
4192
4195
|
function Es(e) {
|
|
4193
4196
|
const t = /* @__PURE__ */ new Set();
|
|
4194
4197
|
function i(r) {
|
|
4195
4198
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((s) => {
|
|
4196
|
-
t.add(
|
|
4199
|
+
t.add(Ge(s));
|
|
4197
4200
|
}), Array.from(r.children).forEach((s) => {
|
|
4198
4201
|
s instanceof HTMLElement && i(s);
|
|
4199
4202
|
});
|
|
4200
4203
|
}
|
|
4201
4204
|
return i(e), t;
|
|
4202
4205
|
}
|
|
4203
|
-
async function
|
|
4206
|
+
async function Je(e, t) {
|
|
4204
4207
|
const i = await ks(e, t), r = Es(e);
|
|
4205
|
-
return (await Promise.all(i.filter((s) => r.has(
|
|
4208
|
+
return (await Promise.all(i.filter((s) => r.has(Ge(s.style.fontFamily))).map((s) => {
|
|
4206
4209
|
const a = s.parentStyleSheet ? s.parentStyleSheet.href : null;
|
|
4207
|
-
return
|
|
4210
|
+
return Xe(s.cssText, a, t);
|
|
4208
4211
|
}))).join(`
|
|
4209
4212
|
`);
|
|
4210
4213
|
}
|
|
4211
4214
|
async function Ss(e, t) {
|
|
4212
|
-
const i = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await
|
|
4215
|
+
const i = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await Je(e, t);
|
|
4213
4216
|
if (i) {
|
|
4214
4217
|
const r = document.createElement("style"), n = document.createTextNode(i);
|
|
4215
4218
|
r.appendChild(n), e.firstChild ? e.insertBefore(r, e.firstChild) : e.appendChild(r);
|
|
4216
4219
|
}
|
|
4217
4220
|
}
|
|
4218
|
-
async function
|
|
4219
|
-
const { width: i, height: r } =
|
|
4220
|
-
return await Ss(n, t), await
|
|
4221
|
+
async function Ze(e, t = {}) {
|
|
4222
|
+
const { width: i, height: r } = Ot(e, t), n = await pt(e, t, !0);
|
|
4223
|
+
return await Ss(n, t), await Ke(n, t), ys(n, t), await jn(n, i, r);
|
|
4221
4224
|
}
|
|
4222
4225
|
async function X(e, t = {}) {
|
|
4223
|
-
const { width: i, height: r } =
|
|
4226
|
+
const { width: i, height: r } = Ot(e, t), n = await Ze(e, t), s = await dt(n), a = document.createElement("canvas"), o = a.getContext("2d"), l = t.pixelRatio || On(), c = t.canvasWidth || i, h = t.canvasHeight || r;
|
|
4224
4227
|
return a.width = c * l, a.height = h * l, t.skipAutoScale || zn(a), a.style.width = `${c}`, a.style.height = `${h}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(s, 0, 0, a.width, a.height), a;
|
|
4225
4228
|
}
|
|
4226
4229
|
async function Cs(e, t = {}) {
|
|
4227
|
-
const { width: i, height: r } =
|
|
4230
|
+
const { width: i, height: r } = Ot(e, t);
|
|
4228
4231
|
return (await X(e, t)).getContext("2d").getImageData(0, 0, i, r).data;
|
|
4229
4232
|
}
|
|
4230
4233
|
async function Ts(e, t = {}) {
|
|
@@ -4238,7 +4241,7 @@ async function As(e, t = {}) {
|
|
|
4238
4241
|
return await $n(i);
|
|
4239
4242
|
}
|
|
4240
4243
|
async function Ls(e, t = {}) {
|
|
4241
|
-
return
|
|
4244
|
+
return Je(e, t);
|
|
4242
4245
|
}
|
|
4243
4246
|
const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4244
4247
|
__proto__: null,
|
|
@@ -4248,7 +4251,7 @@ const Ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4248
4251
|
toJpeg: _s,
|
|
4249
4252
|
toPixelData: Cs,
|
|
4250
4253
|
toPng: Ts,
|
|
4251
|
-
toSvg:
|
|
4254
|
+
toSvg: Ze
|
|
4252
4255
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4253
4256
|
export {
|
|
4254
4257
|
In as MakeThisBetter
|