@insitue/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel.d.ts +13 -0
- package/dist/babel.js +36 -0
- package/dist/capture-only.d.ts +26 -0
- package/dist/capture-only.js +7 -0
- package/dist/chunk-6SMY7D6U.js +1715 -0
- package/dist/chunk-BYR4ZXVS.js +300 -0
- package/dist/chunk-LGN4LKXD.js +973 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +52 -0
- package/dist/overlay.d.ts +6 -0
- package/dist/overlay.js +7 -0
- package/package.json +86 -0
|
@@ -0,0 +1,1715 @@
|
|
|
1
|
+
// ../../node_modules/.pnpm/preact@10.29.2/node_modules/preact/dist/preact.mjs
|
|
2
|
+
var n;
|
|
3
|
+
var l;
|
|
4
|
+
var u;
|
|
5
|
+
var t;
|
|
6
|
+
var i;
|
|
7
|
+
var r;
|
|
8
|
+
var o;
|
|
9
|
+
var e;
|
|
10
|
+
var f;
|
|
11
|
+
var c;
|
|
12
|
+
var a;
|
|
13
|
+
var s;
|
|
14
|
+
var h;
|
|
15
|
+
var p;
|
|
16
|
+
var v;
|
|
17
|
+
var y;
|
|
18
|
+
var d = {};
|
|
19
|
+
var w = [];
|
|
20
|
+
var _ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
21
|
+
var g = Array.isArray;
|
|
22
|
+
function m(n2, l3) {
|
|
23
|
+
for (var u3 in l3) n2[u3] = l3[u3];
|
|
24
|
+
return n2;
|
|
25
|
+
}
|
|
26
|
+
function b(n2) {
|
|
27
|
+
n2 && n2.parentNode && n2.parentNode.removeChild(n2);
|
|
28
|
+
}
|
|
29
|
+
function k(l3, u3, t3) {
|
|
30
|
+
var i3, r3, o3, e3 = {};
|
|
31
|
+
for (o3 in u3) "key" == o3 ? i3 = u3[o3] : "ref" == o3 ? r3 = u3[o3] : e3[o3] = u3[o3];
|
|
32
|
+
if (arguments.length > 2 && (e3.children = arguments.length > 3 ? n.call(arguments, 2) : t3), "function" == typeof l3 && null != l3.defaultProps) for (o3 in l3.defaultProps) void 0 === e3[o3] && (e3[o3] = l3.defaultProps[o3]);
|
|
33
|
+
return x(l3, e3, i3, r3, null);
|
|
34
|
+
}
|
|
35
|
+
function x(n2, t3, i3, r3, o3) {
|
|
36
|
+
var e3 = { type: n2, props: t3, key: i3, ref: r3, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: null == o3 ? ++u : o3, __i: -1, __u: 0 };
|
|
37
|
+
return null == o3 && null != l.vnode && l.vnode(e3), e3;
|
|
38
|
+
}
|
|
39
|
+
function S(n2) {
|
|
40
|
+
return n2.children;
|
|
41
|
+
}
|
|
42
|
+
function C(n2, l3) {
|
|
43
|
+
this.props = n2, this.context = l3;
|
|
44
|
+
}
|
|
45
|
+
function $(n2, l3) {
|
|
46
|
+
if (null == l3) return n2.__ ? $(n2.__, n2.__i + 1) : null;
|
|
47
|
+
for (var u3; l3 < n2.__k.length; l3++) if (null != (u3 = n2.__k[l3]) && null != u3.__e) return u3.__e;
|
|
48
|
+
return "function" == typeof n2.type ? $(n2) : null;
|
|
49
|
+
}
|
|
50
|
+
function I(n2) {
|
|
51
|
+
if (n2.__P && n2.__d) {
|
|
52
|
+
var u3 = n2.__v, t3 = u3.__e, i3 = [], r3 = [], o3 = m({}, u3);
|
|
53
|
+
o3.__v = u3.__v + 1, l.vnode && l.vnode(o3), q(n2.__P, o3, u3, n2.__n, n2.__P.namespaceURI, 32 & u3.__u ? [t3] : null, i3, null == t3 ? $(u3) : t3, !!(32 & u3.__u), r3), o3.__v = u3.__v, o3.__.__k[o3.__i] = o3, D(i3, o3, r3), u3.__e = u3.__ = null, o3.__e != t3 && P(o3);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function P(n2) {
|
|
57
|
+
if (null != (n2 = n2.__) && null != n2.__c) return n2.__e = n2.__c.base = null, n2.__k.some(function(l3) {
|
|
58
|
+
if (null != l3 && null != l3.__e) return n2.__e = n2.__c.base = l3.__e;
|
|
59
|
+
}), P(n2);
|
|
60
|
+
}
|
|
61
|
+
function A(n2) {
|
|
62
|
+
(!n2.__d && (n2.__d = true) && i.push(n2) && !H.__r++ || r != l.debounceRendering) && ((r = l.debounceRendering) || o)(H);
|
|
63
|
+
}
|
|
64
|
+
function H() {
|
|
65
|
+
try {
|
|
66
|
+
for (var n2, l3 = 1; i.length; ) i.length > l3 && i.sort(e), n2 = i.shift(), l3 = i.length, I(n2);
|
|
67
|
+
} finally {
|
|
68
|
+
i.length = H.__r = 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function L(n2, l3, u3, t3, i3, r3, o3, e3, f3, c3, a3) {
|
|
72
|
+
var s3, h3, p3, v3, y3, _2, g2, m3 = t3 && t3.__k || w, b2 = l3.length;
|
|
73
|
+
for (f3 = T(u3, l3, m3, f3, b2), s3 = 0; s3 < b2; s3++) null != (p3 = u3.__k[s3]) && (h3 = -1 != p3.__i && m3[p3.__i] || d, p3.__i = s3, _2 = q(n2, p3, h3, i3, r3, o3, e3, f3, c3, a3), v3 = p3.__e, p3.ref && h3.ref != p3.ref && (h3.ref && J(h3.ref, null, p3), a3.push(p3.ref, p3.__c || v3, p3)), null == y3 && null != v3 && (y3 = v3), (g2 = !!(4 & p3.__u)) || h3.__k === p3.__k ? (f3 = j(p3, f3, n2, g2), g2 && h3.__e && (h3.__e = null)) : "function" == typeof p3.type && void 0 !== _2 ? f3 = _2 : v3 && (f3 = v3.nextSibling), p3.__u &= -7);
|
|
74
|
+
return u3.__e = y3, f3;
|
|
75
|
+
}
|
|
76
|
+
function T(n2, l3, u3, t3, i3) {
|
|
77
|
+
var r3, o3, e3, f3, c3, a3 = u3.length, s3 = a3, h3 = 0;
|
|
78
|
+
for (n2.__k = new Array(i3), r3 = 0; r3 < i3; r3++) null != (o3 = l3[r3]) && "boolean" != typeof o3 && "function" != typeof o3 ? ("string" == typeof o3 || "number" == typeof o3 || "bigint" == typeof o3 || o3.constructor == String ? o3 = n2.__k[r3] = x(null, o3, null, null, null) : g(o3) ? o3 = n2.__k[r3] = x(S, { children: o3 }, null, null, null) : void 0 === o3.constructor && o3.__b > 0 ? o3 = n2.__k[r3] = x(o3.type, o3.props, o3.key, o3.ref ? o3.ref : null, o3.__v) : n2.__k[r3] = o3, f3 = r3 + h3, o3.__ = n2, o3.__b = n2.__b + 1, e3 = null, -1 != (c3 = o3.__i = O(o3, u3, f3, s3)) && (s3--, (e3 = u3[c3]) && (e3.__u |= 2)), null == e3 || null == e3.__v ? (-1 == c3 && (i3 > a3 ? h3-- : i3 < a3 && h3++), "function" != typeof o3.type && (o3.__u |= 4)) : c3 != f3 && (c3 == f3 - 1 ? h3-- : c3 == f3 + 1 ? h3++ : (c3 > f3 ? h3-- : h3++, o3.__u |= 4))) : n2.__k[r3] = null;
|
|
79
|
+
if (s3) for (r3 = 0; r3 < a3; r3++) null != (e3 = u3[r3]) && 0 == (2 & e3.__u) && (e3.__e == t3 && (t3 = $(e3)), K(e3, e3));
|
|
80
|
+
return t3;
|
|
81
|
+
}
|
|
82
|
+
function j(n2, l3, u3, t3) {
|
|
83
|
+
var i3, r3;
|
|
84
|
+
if ("function" == typeof n2.type) {
|
|
85
|
+
for (i3 = n2.__k, r3 = 0; i3 && r3 < i3.length; r3++) i3[r3] && (i3[r3].__ = n2, l3 = j(i3[r3], l3, u3, t3));
|
|
86
|
+
return l3;
|
|
87
|
+
}
|
|
88
|
+
n2.__e != l3 && (t3 && (l3 && n2.type && !l3.parentNode && (l3 = $(n2)), u3.insertBefore(n2.__e, l3 || null)), l3 = n2.__e);
|
|
89
|
+
do {
|
|
90
|
+
l3 = l3 && l3.nextSibling;
|
|
91
|
+
} while (null != l3 && 8 == l3.nodeType);
|
|
92
|
+
return l3;
|
|
93
|
+
}
|
|
94
|
+
function O(n2, l3, u3, t3) {
|
|
95
|
+
var i3, r3, o3, e3 = n2.key, f3 = n2.type, c3 = l3[u3], a3 = null != c3 && 0 == (2 & c3.__u);
|
|
96
|
+
if (null === c3 && null == e3 || a3 && e3 == c3.key && f3 == c3.type) return u3;
|
|
97
|
+
if (t3 > (a3 ? 1 : 0)) {
|
|
98
|
+
for (i3 = u3 - 1, r3 = u3 + 1; i3 >= 0 || r3 < l3.length; ) if (null != (c3 = l3[o3 = i3 >= 0 ? i3-- : r3++]) && 0 == (2 & c3.__u) && e3 == c3.key && f3 == c3.type) return o3;
|
|
99
|
+
}
|
|
100
|
+
return -1;
|
|
101
|
+
}
|
|
102
|
+
function z(n2, l3, u3) {
|
|
103
|
+
"-" == l3[0] ? n2.setProperty(l3, null == u3 ? "" : u3) : n2[l3] = null == u3 ? "" : "number" != typeof u3 || _.test(l3) ? u3 : u3 + "px";
|
|
104
|
+
}
|
|
105
|
+
function N(n2, l3, u3, t3, i3) {
|
|
106
|
+
var r3, o3;
|
|
107
|
+
n: if ("style" == l3) if ("string" == typeof u3) n2.style.cssText = u3;
|
|
108
|
+
else {
|
|
109
|
+
if ("string" == typeof t3 && (n2.style.cssText = t3 = ""), t3) for (l3 in t3) u3 && l3 in u3 || z(n2.style, l3, "");
|
|
110
|
+
if (u3) for (l3 in u3) t3 && u3[l3] == t3[l3] || z(n2.style, l3, u3[l3]);
|
|
111
|
+
}
|
|
112
|
+
else if ("o" == l3[0] && "n" == l3[1]) r3 = l3 != (l3 = l3.replace(s, "$1")), o3 = l3.toLowerCase(), l3 = o3 in n2 || "onFocusOut" == l3 || "onFocusIn" == l3 ? o3.slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + r3] = u3, u3 ? t3 ? u3[a] = t3[a] : (u3[a] = h, n2.addEventListener(l3, r3 ? v : p, r3)) : n2.removeEventListener(l3, r3 ? v : p, r3);
|
|
113
|
+
else {
|
|
114
|
+
if ("http://www.w3.org/2000/svg" == i3) l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
115
|
+
else if ("width" != l3 && "height" != l3 && "href" != l3 && "list" != l3 && "form" != l3 && "tabIndex" != l3 && "download" != l3 && "rowSpan" != l3 && "colSpan" != l3 && "role" != l3 && "popover" != l3 && l3 in n2) try {
|
|
116
|
+
n2[l3] = null == u3 ? "" : u3;
|
|
117
|
+
break n;
|
|
118
|
+
} catch (n3) {
|
|
119
|
+
}
|
|
120
|
+
"function" == typeof u3 || (null == u3 || false === u3 && "-" != l3[4] ? n2.removeAttribute(l3) : n2.setAttribute(l3, "popover" == l3 && 1 == u3 ? "" : u3));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function V(n2) {
|
|
124
|
+
return function(u3) {
|
|
125
|
+
if (this.l) {
|
|
126
|
+
var t3 = this.l[u3.type + n2];
|
|
127
|
+
if (null == u3[c]) u3[c] = h++;
|
|
128
|
+
else if (u3[c] < t3[a]) return;
|
|
129
|
+
return t3(l.event ? l.event(u3) : u3);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function q(n2, u3, t3, i3, r3, o3, e3, f3, c3, a3) {
|
|
134
|
+
var s3, h3, p3, v3, y3, d3, _2, k3, x2, M, $2, I2, P2, A3, H2, T3 = u3.type;
|
|
135
|
+
if (void 0 !== u3.constructor) return null;
|
|
136
|
+
128 & t3.__u && (c3 = !!(32 & t3.__u), o3 = [f3 = u3.__e = t3.__e]), (s3 = l.__b) && s3(u3);
|
|
137
|
+
n: if ("function" == typeof T3) try {
|
|
138
|
+
if (k3 = u3.props, x2 = T3.prototype && T3.prototype.render, M = (s3 = T3.contextType) && i3[s3.__c], $2 = s3 ? M ? M.props.value : s3.__ : i3, t3.__c ? _2 = (h3 = u3.__c = t3.__c).__ = h3.__E : (x2 ? u3.__c = h3 = new T3(k3, $2) : (u3.__c = h3 = new C(k3, $2), h3.constructor = T3, h3.render = Q), M && M.sub(h3), h3.state || (h3.state = {}), h3.__n = i3, p3 = h3.__d = true, h3.__h = [], h3._sb = []), x2 && null == h3.__s && (h3.__s = h3.state), x2 && null != T3.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = m({}, h3.__s)), m(h3.__s, T3.getDerivedStateFromProps(k3, h3.__s))), v3 = h3.props, y3 = h3.state, h3.__v = u3, p3) x2 && null == T3.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), x2 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
|
|
139
|
+
else {
|
|
140
|
+
if (x2 && null == T3.getDerivedStateFromProps && k3 !== v3 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(k3, $2), u3.__v == t3.__v || !h3.__e && null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(k3, h3.__s, $2)) {
|
|
141
|
+
u3.__v != t3.__v && (h3.props = k3, h3.state = h3.__s, h3.__d = false), u3.__e = t3.__e, u3.__k = t3.__k, u3.__k.some(function(n3) {
|
|
142
|
+
n3 && (n3.__ = u3);
|
|
143
|
+
}), w.push.apply(h3.__h, h3._sb), h3._sb = [], h3.__h.length && e3.push(h3);
|
|
144
|
+
break n;
|
|
145
|
+
}
|
|
146
|
+
null != h3.componentWillUpdate && h3.componentWillUpdate(k3, h3.__s, $2), x2 && null != h3.componentDidUpdate && h3.__h.push(function() {
|
|
147
|
+
h3.componentDidUpdate(v3, y3, d3);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (h3.context = $2, h3.props = k3, h3.__P = n2, h3.__e = false, I2 = l.__r, P2 = 0, x2) h3.state = h3.__s, h3.__d = false, I2 && I2(u3), s3 = h3.render(h3.props, h3.state, h3.context), w.push.apply(h3.__h, h3._sb), h3._sb = [];
|
|
151
|
+
else do {
|
|
152
|
+
h3.__d = false, I2 && I2(u3), s3 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
|
|
153
|
+
} while (h3.__d && ++P2 < 25);
|
|
154
|
+
h3.state = h3.__s, null != h3.getChildContext && (i3 = m(m({}, i3), h3.getChildContext())), x2 && !p3 && null != h3.getSnapshotBeforeUpdate && (d3 = h3.getSnapshotBeforeUpdate(v3, y3)), A3 = null != s3 && s3.type === S && null == s3.key ? E(s3.props.children) : s3, f3 = L(n2, g(A3) ? A3 : [A3], u3, t3, i3, r3, o3, e3, f3, c3, a3), h3.base = u3.__e, u3.__u &= -161, h3.__h.length && e3.push(h3), _2 && (h3.__E = h3.__ = null);
|
|
155
|
+
} catch (n3) {
|
|
156
|
+
if (u3.__v = null, c3 || null != o3) if (n3.then) {
|
|
157
|
+
for (u3.__u |= c3 ? 160 : 128; f3 && 8 == f3.nodeType && f3.nextSibling; ) f3 = f3.nextSibling;
|
|
158
|
+
o3[o3.indexOf(f3)] = null, u3.__e = f3;
|
|
159
|
+
} else {
|
|
160
|
+
for (H2 = o3.length; H2--; ) b(o3[H2]);
|
|
161
|
+
B(u3);
|
|
162
|
+
}
|
|
163
|
+
else u3.__e = t3.__e, u3.__k = t3.__k, n3.then || B(u3);
|
|
164
|
+
l.__e(n3, u3, t3);
|
|
165
|
+
}
|
|
166
|
+
else null == o3 && u3.__v == t3.__v ? (u3.__k = t3.__k, u3.__e = t3.__e) : f3 = u3.__e = G(t3.__e, u3, t3, i3, r3, o3, e3, c3, a3);
|
|
167
|
+
return (s3 = l.diffed) && s3(u3), 128 & u3.__u ? void 0 : f3;
|
|
168
|
+
}
|
|
169
|
+
function B(n2) {
|
|
170
|
+
n2 && (n2.__c && (n2.__c.__e = true), n2.__k && n2.__k.some(B));
|
|
171
|
+
}
|
|
172
|
+
function D(n2, u3, t3) {
|
|
173
|
+
for (var i3 = 0; i3 < t3.length; i3++) J(t3[i3], t3[++i3], t3[++i3]);
|
|
174
|
+
l.__c && l.__c(u3, n2), n2.some(function(u4) {
|
|
175
|
+
try {
|
|
176
|
+
n2 = u4.__h, u4.__h = [], n2.some(function(n3) {
|
|
177
|
+
n3.call(u4);
|
|
178
|
+
});
|
|
179
|
+
} catch (n3) {
|
|
180
|
+
l.__e(n3, u4.__v);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function E(n2) {
|
|
185
|
+
return "object" != typeof n2 || null == n2 || n2.__b > 0 ? n2 : g(n2) ? n2.map(E) : void 0 !== n2.constructor ? null : m({}, n2);
|
|
186
|
+
}
|
|
187
|
+
function G(u3, t3, i3, r3, o3, e3, f3, c3, a3) {
|
|
188
|
+
var s3, h3, p3, v3, y3, w3, _2, m3 = i3.props || d, k3 = t3.props, x2 = t3.type;
|
|
189
|
+
if ("svg" == x2 ? o3 = "http://www.w3.org/2000/svg" : "math" == x2 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != e3) {
|
|
190
|
+
for (s3 = 0; s3 < e3.length; s3++) if ((y3 = e3[s3]) && "setAttribute" in y3 == !!x2 && (x2 ? y3.localName == x2 : 3 == y3.nodeType)) {
|
|
191
|
+
u3 = y3, e3[s3] = null;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (null == u3) {
|
|
196
|
+
if (null == x2) return document.createTextNode(k3);
|
|
197
|
+
u3 = document.createElementNS(o3, x2, k3.is && k3), c3 && (l.__m && l.__m(t3, e3), c3 = false), e3 = null;
|
|
198
|
+
}
|
|
199
|
+
if (null == x2) m3 === k3 || c3 && u3.data == k3 || (u3.data = k3);
|
|
200
|
+
else {
|
|
201
|
+
if (e3 = "textarea" == x2 && null != k3.defaultValue ? null : e3 && n.call(u3.childNodes), !c3 && null != e3) for (m3 = {}, s3 = 0; s3 < u3.attributes.length; s3++) m3[(y3 = u3.attributes[s3]).name] = y3.value;
|
|
202
|
+
for (s3 in m3) y3 = m3[s3], "dangerouslySetInnerHTML" == s3 ? p3 = y3 : "children" == s3 || s3 in k3 || "value" == s3 && "defaultValue" in k3 || "checked" == s3 && "defaultChecked" in k3 || N(u3, s3, null, y3, o3);
|
|
203
|
+
for (s3 in k3) y3 = k3[s3], "children" == s3 ? v3 = y3 : "dangerouslySetInnerHTML" == s3 ? h3 = y3 : "value" == s3 ? w3 = y3 : "checked" == s3 ? _2 = y3 : c3 && "function" != typeof y3 || m3[s3] === y3 || N(u3, s3, y3, m3[s3], o3);
|
|
204
|
+
if (h3) c3 || p3 && (h3.__html == p3.__html || h3.__html == u3.innerHTML) || (u3.innerHTML = h3.__html), t3.__k = [];
|
|
205
|
+
else if (p3 && (u3.innerHTML = ""), L("template" == t3.type ? u3.content : u3, g(v3) ? v3 : [v3], t3, i3, r3, "foreignObject" == x2 ? "http://www.w3.org/1999/xhtml" : o3, e3, f3, e3 ? e3[0] : i3.__k && $(i3, 0), c3, a3), null != e3) for (s3 = e3.length; s3--; ) b(e3[s3]);
|
|
206
|
+
c3 && "textarea" != x2 || (s3 = "value", "progress" == x2 && null == w3 ? u3.removeAttribute("value") : null != w3 && (w3 !== u3[s3] || "progress" == x2 && !w3 || "option" == x2 && w3 != m3[s3]) && N(u3, s3, w3, m3[s3], o3), s3 = "checked", null != _2 && _2 != u3[s3] && N(u3, s3, _2, m3[s3], o3));
|
|
207
|
+
}
|
|
208
|
+
return u3;
|
|
209
|
+
}
|
|
210
|
+
function J(n2, u3, t3) {
|
|
211
|
+
try {
|
|
212
|
+
if ("function" == typeof n2) {
|
|
213
|
+
var i3 = "function" == typeof n2.__u;
|
|
214
|
+
i3 && n2.__u(), i3 && null == u3 || (n2.__u = n2(u3));
|
|
215
|
+
} else n2.current = u3;
|
|
216
|
+
} catch (n3) {
|
|
217
|
+
l.__e(n3, t3);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function K(n2, u3, t3) {
|
|
221
|
+
var i3, r3;
|
|
222
|
+
if (l.unmount && l.unmount(n2), (i3 = n2.ref) && (i3.current && i3.current != n2.__e || J(i3, null, u3)), null != (i3 = n2.__c)) {
|
|
223
|
+
if (i3.componentWillUnmount) try {
|
|
224
|
+
i3.componentWillUnmount();
|
|
225
|
+
} catch (n3) {
|
|
226
|
+
l.__e(n3, u3);
|
|
227
|
+
}
|
|
228
|
+
i3.base = i3.__P = null;
|
|
229
|
+
}
|
|
230
|
+
if (i3 = n2.__k) for (r3 = 0; r3 < i3.length; r3++) i3[r3] && K(i3[r3], u3, t3 || "function" != typeof n2.type);
|
|
231
|
+
t3 || b(n2.__e), n2.__c = n2.__ = n2.__e = void 0;
|
|
232
|
+
}
|
|
233
|
+
function Q(n2, l3, u3) {
|
|
234
|
+
return this.constructor(n2, u3);
|
|
235
|
+
}
|
|
236
|
+
function R(u3, t3, i3) {
|
|
237
|
+
var r3, o3, e3, f3;
|
|
238
|
+
t3 == document && (t3 = document.documentElement), l.__ && l.__(u3, t3), o3 = (r3 = "function" == typeof i3) ? null : i3 && i3.__k || t3.__k, e3 = [], f3 = [], q(t3, u3 = (!r3 && i3 || t3).__k = k(S, null, [u3]), o3 || d, d, t3.namespaceURI, !r3 && i3 ? [i3] : o3 ? null : t3.firstChild ? n.call(t3.childNodes) : null, e3, !r3 && i3 ? i3 : o3 ? o3.__e : t3.firstChild, r3, f3), D(e3, u3, f3);
|
|
239
|
+
}
|
|
240
|
+
n = w.slice, l = { __e: function(n2, l3, u3, t3) {
|
|
241
|
+
for (var i3, r3, o3; l3 = l3.__; ) if ((i3 = l3.__c) && !i3.__) try {
|
|
242
|
+
if ((r3 = i3.constructor) && null != r3.getDerivedStateFromError && (i3.setState(r3.getDerivedStateFromError(n2)), o3 = i3.__d), null != i3.componentDidCatch && (i3.componentDidCatch(n2, t3 || {}), o3 = i3.__d), o3) return i3.__E = i3;
|
|
243
|
+
} catch (l4) {
|
|
244
|
+
n2 = l4;
|
|
245
|
+
}
|
|
246
|
+
throw n2;
|
|
247
|
+
} }, u = 0, t = function(n2) {
|
|
248
|
+
return null != n2 && void 0 === n2.constructor;
|
|
249
|
+
}, C.prototype.setState = function(n2, l3) {
|
|
250
|
+
var u3;
|
|
251
|
+
u3 = null != this.__s && this.__s != this.state ? this.__s : this.__s = m({}, this.state), "function" == typeof n2 && (n2 = n2(m({}, u3), this.props)), n2 && m(u3, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), A(this));
|
|
252
|
+
}, C.prototype.forceUpdate = function(n2) {
|
|
253
|
+
this.__v && (this.__e = true, n2 && this.__h.push(n2), A(this));
|
|
254
|
+
}, C.prototype.render = S, i = [], o = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e = function(n2, l3) {
|
|
255
|
+
return n2.__v.__b - l3.__v.__b;
|
|
256
|
+
}, H.__r = 0, f = Math.random().toString(8), c = "__d" + f, a = "__a" + f, s = /(PointerCapture)$|Capture$/i, h = 0, p = V(false), v = V(true), y = 0;
|
|
257
|
+
|
|
258
|
+
// ../../node_modules/.pnpm/preact@10.29.2/node_modules/preact/hooks/dist/hooks.mjs
|
|
259
|
+
var t2;
|
|
260
|
+
var r2;
|
|
261
|
+
var u2;
|
|
262
|
+
var i2;
|
|
263
|
+
var o2 = 0;
|
|
264
|
+
var f2 = [];
|
|
265
|
+
var c2 = l;
|
|
266
|
+
var e2 = c2.__b;
|
|
267
|
+
var a2 = c2.__r;
|
|
268
|
+
var v2 = c2.diffed;
|
|
269
|
+
var l2 = c2.__c;
|
|
270
|
+
var m2 = c2.unmount;
|
|
271
|
+
var s2 = c2.__;
|
|
272
|
+
function p2(n2, t3) {
|
|
273
|
+
c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
|
|
274
|
+
var u3 = r2.__H || (r2.__H = { __: [], __h: [] });
|
|
275
|
+
return n2 >= u3.__.length && u3.__.push({}), u3.__[n2];
|
|
276
|
+
}
|
|
277
|
+
function d2(n2) {
|
|
278
|
+
return o2 = 1, h2(D2, n2);
|
|
279
|
+
}
|
|
280
|
+
function h2(n2, u3, i3) {
|
|
281
|
+
var o3 = p2(t2++, 2);
|
|
282
|
+
if (o3.t = n2, !o3.__c && (o3.__ = [i3 ? i3(u3) : D2(void 0, u3), function(n3) {
|
|
283
|
+
var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
|
|
284
|
+
t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
|
|
285
|
+
}], o3.__c = r2, !r2.__f)) {
|
|
286
|
+
var f3 = function(n3, t3, r3) {
|
|
287
|
+
if (!o3.__c.__H) return true;
|
|
288
|
+
var u4 = o3.__c.__H.__.filter(function(n4) {
|
|
289
|
+
return n4.__c;
|
|
290
|
+
});
|
|
291
|
+
if (u4.every(function(n4) {
|
|
292
|
+
return !n4.__N;
|
|
293
|
+
})) return !c3 || c3.call(this, n3, t3, r3);
|
|
294
|
+
var i4 = o3.__c.props !== n3;
|
|
295
|
+
return u4.some(function(n4) {
|
|
296
|
+
if (n4.__N) {
|
|
297
|
+
var t4 = n4.__[0];
|
|
298
|
+
n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i4 = true);
|
|
299
|
+
}
|
|
300
|
+
}), c3 && c3.call(this, n3, t3, r3) || i4;
|
|
301
|
+
};
|
|
302
|
+
r2.__f = true;
|
|
303
|
+
var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
|
|
304
|
+
r2.componentWillUpdate = function(n3, t3, r3) {
|
|
305
|
+
if (this.__e) {
|
|
306
|
+
var u4 = c3;
|
|
307
|
+
c3 = void 0, f3(n3, t3, r3), c3 = u4;
|
|
308
|
+
}
|
|
309
|
+
e3 && e3.call(this, n3, t3, r3);
|
|
310
|
+
}, r2.shouldComponentUpdate = f3;
|
|
311
|
+
}
|
|
312
|
+
return o3.__N || o3.__;
|
|
313
|
+
}
|
|
314
|
+
function y2(n2, u3) {
|
|
315
|
+
var i3 = p2(t2++, 3);
|
|
316
|
+
!c2.__s && C2(i3.__H, u3) && (i3.__ = n2, i3.u = u3, r2.__H.__h.push(i3));
|
|
317
|
+
}
|
|
318
|
+
function A2(n2) {
|
|
319
|
+
return o2 = 5, T2(function() {
|
|
320
|
+
return { current: n2 };
|
|
321
|
+
}, []);
|
|
322
|
+
}
|
|
323
|
+
function T2(n2, r3) {
|
|
324
|
+
var u3 = p2(t2++, 7);
|
|
325
|
+
return C2(u3.__H, r3) && (u3.__ = n2(), u3.__H = r3, u3.__h = n2), u3.__;
|
|
326
|
+
}
|
|
327
|
+
function j2() {
|
|
328
|
+
for (var n2; n2 = f2.shift(); ) {
|
|
329
|
+
var t3 = n2.__H;
|
|
330
|
+
if (n2.__P && t3) try {
|
|
331
|
+
t3.__h.some(z2), t3.__h.some(B2), t3.__h = [];
|
|
332
|
+
} catch (r3) {
|
|
333
|
+
t3.__h = [], c2.__e(r3, n2.__v);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
c2.__b = function(n2) {
|
|
338
|
+
r2 = null, e2 && e2(n2);
|
|
339
|
+
}, c2.__ = function(n2, t3) {
|
|
340
|
+
n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
|
|
341
|
+
}, c2.__r = function(n2) {
|
|
342
|
+
a2 && a2(n2), t2 = 0;
|
|
343
|
+
var i3 = (r2 = n2.__c).__H;
|
|
344
|
+
i3 && (u2 === r2 ? (i3.__h = [], r2.__h = [], i3.__.some(function(n3) {
|
|
345
|
+
n3.__N && (n3.__ = n3.__N), n3.u = n3.__N = void 0;
|
|
346
|
+
})) : (i3.__h.some(z2), i3.__h.some(B2), i3.__h = [], t2 = 0)), u2 = r2;
|
|
347
|
+
}, c2.diffed = function(n2) {
|
|
348
|
+
v2 && v2(n2);
|
|
349
|
+
var t3 = n2.__c;
|
|
350
|
+
t3 && t3.__H && (t3.__H.__h.length && (1 !== f2.push(t3) && i2 === c2.requestAnimationFrame || ((i2 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.some(function(n3) {
|
|
351
|
+
n3.u && (n3.__H = n3.u), n3.u = void 0;
|
|
352
|
+
})), u2 = r2 = null;
|
|
353
|
+
}, c2.__c = function(n2, t3) {
|
|
354
|
+
t3.some(function(n3) {
|
|
355
|
+
try {
|
|
356
|
+
n3.__h.some(z2), n3.__h = n3.__h.filter(function(n4) {
|
|
357
|
+
return !n4.__ || B2(n4);
|
|
358
|
+
});
|
|
359
|
+
} catch (r3) {
|
|
360
|
+
t3.some(function(n4) {
|
|
361
|
+
n4.__h && (n4.__h = []);
|
|
362
|
+
}), t3 = [], c2.__e(r3, n3.__v);
|
|
363
|
+
}
|
|
364
|
+
}), l2 && l2(n2, t3);
|
|
365
|
+
}, c2.unmount = function(n2) {
|
|
366
|
+
m2 && m2(n2);
|
|
367
|
+
var t3, r3 = n2.__c;
|
|
368
|
+
r3 && r3.__H && (r3.__H.__.some(function(n3) {
|
|
369
|
+
try {
|
|
370
|
+
z2(n3);
|
|
371
|
+
} catch (n4) {
|
|
372
|
+
t3 = n4;
|
|
373
|
+
}
|
|
374
|
+
}), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
|
|
375
|
+
};
|
|
376
|
+
var k2 = "function" == typeof requestAnimationFrame;
|
|
377
|
+
function w2(n2) {
|
|
378
|
+
var t3, r3 = function() {
|
|
379
|
+
clearTimeout(u3), k2 && cancelAnimationFrame(t3), setTimeout(n2);
|
|
380
|
+
}, u3 = setTimeout(r3, 35);
|
|
381
|
+
k2 && (t3 = requestAnimationFrame(r3));
|
|
382
|
+
}
|
|
383
|
+
function z2(n2) {
|
|
384
|
+
var t3 = r2, u3 = n2.__c;
|
|
385
|
+
"function" == typeof u3 && (n2.__c = void 0, u3()), r2 = t3;
|
|
386
|
+
}
|
|
387
|
+
function B2(n2) {
|
|
388
|
+
var t3 = r2;
|
|
389
|
+
n2.__c = n2.__(), r2 = t3;
|
|
390
|
+
}
|
|
391
|
+
function C2(n2, t3) {
|
|
392
|
+
return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
|
|
393
|
+
return t4 !== n2[r3];
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
function D2(n2, t3) {
|
|
397
|
+
return "function" == typeof t3 ? t3(n2) : t3;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// ../capture-core/dist/index.js
|
|
401
|
+
var SKIP_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEMPLATE"]);
|
|
402
|
+
var ATTR_DENY = /^(on|data-insitu)/i;
|
|
403
|
+
var SECRETISH = /(token|secret|key|password|authorization|bearer)/i;
|
|
404
|
+
function serializeNode(el, depth = 3, maxChildren = 12) {
|
|
405
|
+
const attrs = {};
|
|
406
|
+
for (const a3 of Array.from(el.attributes)) {
|
|
407
|
+
if (ATTR_DENY.test(a3.name)) continue;
|
|
408
|
+
const v3 = SECRETISH.test(a3.name) ? "[redacted]" : a3.value;
|
|
409
|
+
attrs[a3.name] = v3.length > 300 ? v3.slice(0, 300) + "\u2026" : v3;
|
|
410
|
+
}
|
|
411
|
+
const node = {
|
|
412
|
+
tag: el.tagName.toLowerCase(),
|
|
413
|
+
attrs,
|
|
414
|
+
children: []
|
|
415
|
+
};
|
|
416
|
+
const directText = Array.from(el.childNodes).filter((n2) => n2.nodeType === Node.TEXT_NODE).map((n2) => n2.textContent ?? "").join(" ").trim();
|
|
417
|
+
if (directText) node.text = directText.slice(0, 200);
|
|
418
|
+
if (depth > 0) {
|
|
419
|
+
const kids = Array.from(el.children).filter((c3) => !SKIP_TAGS.has(c3.tagName)).slice(0, maxChildren);
|
|
420
|
+
node.children = kids.map((c3) => serializeNode(c3, depth - 1, maxChildren));
|
|
421
|
+
}
|
|
422
|
+
return node;
|
|
423
|
+
}
|
|
424
|
+
var STYLE_KEYS = [
|
|
425
|
+
"display",
|
|
426
|
+
"position",
|
|
427
|
+
"boxSizing",
|
|
428
|
+
"width",
|
|
429
|
+
"height",
|
|
430
|
+
"margin",
|
|
431
|
+
"padding",
|
|
432
|
+
"border",
|
|
433
|
+
"flexDirection",
|
|
434
|
+
"alignItems",
|
|
435
|
+
"justifyContent",
|
|
436
|
+
"gap",
|
|
437
|
+
"gridTemplateColumns",
|
|
438
|
+
"color",
|
|
439
|
+
"backgroundColor",
|
|
440
|
+
"fontFamily",
|
|
441
|
+
"fontSize",
|
|
442
|
+
"fontWeight",
|
|
443
|
+
"lineHeight",
|
|
444
|
+
"letterSpacing",
|
|
445
|
+
"textAlign",
|
|
446
|
+
"borderRadius",
|
|
447
|
+
"boxShadow",
|
|
448
|
+
"opacity",
|
|
449
|
+
"zIndex"
|
|
450
|
+
];
|
|
451
|
+
function curateComputedStyles(el) {
|
|
452
|
+
const cs = getComputedStyle(el);
|
|
453
|
+
const out = {};
|
|
454
|
+
for (const k3 of STYLE_KEYS) {
|
|
455
|
+
const v3 = cs[k3];
|
|
456
|
+
if (typeof v3 === "string" && v3 && v3 !== "normal" && v3 !== "none") {
|
|
457
|
+
out[k3] = v3;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return out;
|
|
461
|
+
}
|
|
462
|
+
function extractTailwindClasses(el) {
|
|
463
|
+
const cls = typeof el.className === "string" ? el.className : el.getAttribute("class") ?? "";
|
|
464
|
+
return cls.split(/\s+/).filter(Boolean);
|
|
465
|
+
}
|
|
466
|
+
function buildSelector(el) {
|
|
467
|
+
if (el.id && document.querySelectorAll(`#${CSS.escape(el.id)}`).length === 1) {
|
|
468
|
+
return `#${CSS.escape(el.id)}`;
|
|
469
|
+
}
|
|
470
|
+
const parts = [];
|
|
471
|
+
let cur = el;
|
|
472
|
+
while (cur && cur.nodeType === Node.ELEMENT_NODE && parts.length < 6) {
|
|
473
|
+
const tid = cur.getAttribute("data-testid");
|
|
474
|
+
if (tid) {
|
|
475
|
+
parts.unshift(`[data-testid="${CSS.escape(tid)}"]`);
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
const tag = cur.tagName.toLowerCase();
|
|
479
|
+
const parent = cur.parentElement;
|
|
480
|
+
if (!parent) {
|
|
481
|
+
parts.unshift(tag);
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
const sibs = Array.from(parent.children).filter(
|
|
485
|
+
(c3) => c3.tagName === cur.tagName
|
|
486
|
+
);
|
|
487
|
+
const idx = sibs.indexOf(cur);
|
|
488
|
+
parts.unshift(
|
|
489
|
+
sibs.length > 1 ? `${tag}:nth-of-type(${idx + 1})` : tag
|
|
490
|
+
);
|
|
491
|
+
if (cur.id) {
|
|
492
|
+
parts.unshift(`#${CSS.escape(cur.id)}`);
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
cur = parent;
|
|
496
|
+
}
|
|
497
|
+
return parts.join(" > ");
|
|
498
|
+
}
|
|
499
|
+
function breakpointFor(w3) {
|
|
500
|
+
if (w3 < 640) return "xs";
|
|
501
|
+
if (w3 < 768) return "sm";
|
|
502
|
+
if (w3 < 1024) return "md";
|
|
503
|
+
if (w3 < 1280) return "lg";
|
|
504
|
+
if (w3 < 1536) return "xl";
|
|
505
|
+
return "2xl";
|
|
506
|
+
}
|
|
507
|
+
function getFiber(el) {
|
|
508
|
+
for (const k3 of Object.keys(el)) {
|
|
509
|
+
if (k3.startsWith("__reactFiber$") || k3.startsWith("__reactInternalInstance$")) {
|
|
510
|
+
return el[k3] ?? null;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
function compName(type) {
|
|
516
|
+
if (typeof type === "function") {
|
|
517
|
+
const f3 = type;
|
|
518
|
+
return f3.displayName || f3.name || "Anonymous";
|
|
519
|
+
}
|
|
520
|
+
if (type && typeof type === "object") {
|
|
521
|
+
const o3 = type;
|
|
522
|
+
return o3.displayName || o3.render?.name || null;
|
|
523
|
+
}
|
|
524
|
+
return null;
|
|
525
|
+
}
|
|
526
|
+
function toLoc(workspaceCwdRelative) {
|
|
527
|
+
if (!workspaceCwdRelative.fileName) return null;
|
|
528
|
+
return {
|
|
529
|
+
// React gives an absolute path in dev; the companion re-roots it.
|
|
530
|
+
file: workspaceCwdRelative.fileName,
|
|
531
|
+
line: workspaceCwdRelative.lineNumber ?? 1,
|
|
532
|
+
column: workspaceCwdRelative.columnNumber ?? 1
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
function fromAttribute(el) {
|
|
536
|
+
let cur = el;
|
|
537
|
+
for (let i3 = 0; cur && i3 < 8; i3++, cur = cur.parentElement) {
|
|
538
|
+
const raw = cur.getAttribute("data-insitu-source");
|
|
539
|
+
if (raw) {
|
|
540
|
+
const m3 = /^(.*):(\d+):(\d+)$/.exec(raw);
|
|
541
|
+
if (m3) return { file: m3[1], line: Number(m3[2]), column: Number(m3[3]) };
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return null;
|
|
545
|
+
}
|
|
546
|
+
function resolveTarget(el) {
|
|
547
|
+
const selector = buildSelector(el);
|
|
548
|
+
const fiber = getFiber(el);
|
|
549
|
+
const componentStack = [];
|
|
550
|
+
if (fiber) {
|
|
551
|
+
let f3 = fiber;
|
|
552
|
+
let guard = 0;
|
|
553
|
+
while (f3 && guard++ < 60) {
|
|
554
|
+
const name = compName(f3.type);
|
|
555
|
+
if (name) {
|
|
556
|
+
const src = f3._debugSource ? toLoc(f3._debugSource) : null;
|
|
557
|
+
componentStack.push(
|
|
558
|
+
src ? { name, source: src } : { name }
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
f3 = f3._debugOwner ?? f3.return ?? null;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
let source;
|
|
565
|
+
let confidence = "selector-only";
|
|
566
|
+
const hostSrc = fiber?._debugSource ? toLoc(fiber._debugSource) : null;
|
|
567
|
+
if (hostSrc) {
|
|
568
|
+
source = hostSrc;
|
|
569
|
+
confidence = "exact";
|
|
570
|
+
} else {
|
|
571
|
+
const attrSrc = fromAttribute(el);
|
|
572
|
+
if (attrSrc) {
|
|
573
|
+
source = attrSrc;
|
|
574
|
+
confidence = "exact";
|
|
575
|
+
} else {
|
|
576
|
+
const ownerWithSrc = componentStack.find((c3) => c3.source);
|
|
577
|
+
if (ownerWithSrc?.source) {
|
|
578
|
+
source = ownerWithSrc.source;
|
|
579
|
+
confidence = "approximate";
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return source === void 0 ? { confidence, componentStack, selector } : { source, confidence, componentStack, selector };
|
|
584
|
+
}
|
|
585
|
+
var CAPTURE_SCHEMA_VERSION = 2;
|
|
586
|
+
var PROTOCOL_VERSION = 4;
|
|
587
|
+
function toIssueDraft(bundle) {
|
|
588
|
+
const t3 = bundle.target;
|
|
589
|
+
const where = t3?.source ? `\`${t3.source.file}:${t3.source.line}\` (${t3.confidence})` : t3 ? `\`${t3.selector}\` (selector-only \u2014 no source resolver)` : "(empty selection)";
|
|
590
|
+
const stack = t3?.componentStack.map((c3) => c3.name).join(" < ") || "(none)";
|
|
591
|
+
const errs = bundle.runtime.errors.length;
|
|
592
|
+
const title = `[InSitue] ${t3?.componentStack[0]?.name ?? t3?.selector ?? "selection"} on ${bundle.runtime.route ?? new URL(bundle.runtime.url).pathname}`;
|
|
593
|
+
const body = [
|
|
594
|
+
`**Where:** ${where}`,
|
|
595
|
+
`**Components:** ${stack}`,
|
|
596
|
+
`**URL:** ${bundle.runtime.url}`,
|
|
597
|
+
`**Viewport:** ${bundle.viewport.w}\xD7${bundle.viewport.h}${bundle.viewport.breakpoint ? ` (${bundle.viewport.breakpoint})` : ""}`,
|
|
598
|
+
`**Tailwind:** ${bundle.tailwindClasses.join(" ") || "\u2014"}`,
|
|
599
|
+
`**Runtime:** ${bundle.runtime.console.length} log \xB7 ${bundle.runtime.network.length} net \xB7 ${errs} err`,
|
|
600
|
+
`**Screenshot:** ${bundle.screenshot ? "attached" : bundle.screenshotUnavailable ? `unavailable \u2014 ${bundle.screenshotUnavailable}` : "\u2014"}`,
|
|
601
|
+
bundle.userNote ? `
|
|
602
|
+
> ${bundle.userNote}` : "",
|
|
603
|
+
`
|
|
604
|
+
_Captured ${bundle.createdAt} \xB7 schema v${bundle.schemaVersion}_`
|
|
605
|
+
].join("\n");
|
|
606
|
+
return { title, body, bundle };
|
|
607
|
+
}
|
|
608
|
+
var IssueTrackerSink = class {
|
|
609
|
+
constructor(deliver) {
|
|
610
|
+
this.deliver = deliver;
|
|
611
|
+
}
|
|
612
|
+
deliver;
|
|
613
|
+
kind = "issue-tracker";
|
|
614
|
+
async submit(bundle) {
|
|
615
|
+
await this.deliver(toIssueDraft(bundle));
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// src/runtime.ts
|
|
620
|
+
var CAP = 50;
|
|
621
|
+
var consoleBuf = [];
|
|
622
|
+
var networkBuf = [];
|
|
623
|
+
var errorBuf = [];
|
|
624
|
+
var installed = false;
|
|
625
|
+
function push(buf, item) {
|
|
626
|
+
buf.push(item);
|
|
627
|
+
if (buf.length > CAP) buf.shift();
|
|
628
|
+
}
|
|
629
|
+
var SECRETISH2 = /(token|secret|key|password|authorization|bearer)/i;
|
|
630
|
+
function safeArg(a3) {
|
|
631
|
+
try {
|
|
632
|
+
const s3 = typeof a3 === "string" ? a3 : JSON.stringify(a3);
|
|
633
|
+
return SECRETISH2.test(s3) ? "[redacted]" : s3.slice(0, 500);
|
|
634
|
+
} catch {
|
|
635
|
+
return String(a3).slice(0, 500);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function installRuntimeCollectors() {
|
|
639
|
+
if (installed || typeof window === "undefined") return;
|
|
640
|
+
installed = true;
|
|
641
|
+
for (const level of ["log", "info", "warn", "error", "debug"]) {
|
|
642
|
+
const orig = console[level].bind(console);
|
|
643
|
+
console[level] = (...args) => {
|
|
644
|
+
push(consoleBuf, { level, args: args.map(safeArg), ts: Date.now() });
|
|
645
|
+
orig(...args);
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
const origFetch = window.fetch?.bind(window);
|
|
649
|
+
if (origFetch) {
|
|
650
|
+
window.fetch = async (...args) => {
|
|
651
|
+
const url = typeof args[0] === "string" ? args[0] : String(args[0]);
|
|
652
|
+
const method = (args[1]?.method ?? "GET").toUpperCase();
|
|
653
|
+
try {
|
|
654
|
+
const res = await origFetch(...args);
|
|
655
|
+
if (!res.ok) {
|
|
656
|
+
push(networkBuf, {
|
|
657
|
+
url,
|
|
658
|
+
method,
|
|
659
|
+
status: res.status,
|
|
660
|
+
ok: false,
|
|
661
|
+
ts: Date.now()
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return res;
|
|
665
|
+
} catch (e3) {
|
|
666
|
+
push(networkBuf, { url, method, ok: false, ts: Date.now() });
|
|
667
|
+
throw e3;
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
window.addEventListener("error", (e3) => {
|
|
672
|
+
push(errorBuf, {
|
|
673
|
+
message: e3.message,
|
|
674
|
+
stack: e3.error?.stack,
|
|
675
|
+
ts: Date.now()
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
window.addEventListener("unhandledrejection", (e3) => {
|
|
679
|
+
push(errorBuf, {
|
|
680
|
+
message: `unhandledrejection: ${String(e3.reason)}`,
|
|
681
|
+
ts: Date.now()
|
|
682
|
+
});
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
function runtimeErrorCount() {
|
|
686
|
+
return errorBuf.length;
|
|
687
|
+
}
|
|
688
|
+
function runtimeSnapshot() {
|
|
689
|
+
return {
|
|
690
|
+
console: consoleBuf.slice(),
|
|
691
|
+
network: networkBuf.slice(),
|
|
692
|
+
errors: errorBuf.slice()
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// src/picker.ts
|
|
697
|
+
var ACCENT = "#ff6b00";
|
|
698
|
+
function isOurs(el) {
|
|
699
|
+
return !!el?.closest?.("#insitu-root, [data-insitu-layer]");
|
|
700
|
+
}
|
|
701
|
+
function beginPick(mode = "element") {
|
|
702
|
+
return new Promise((resolve) => {
|
|
703
|
+
const layer = document.createElement("div");
|
|
704
|
+
layer.setAttribute("data-insitu-layer", "");
|
|
705
|
+
Object.assign(layer.style, {
|
|
706
|
+
position: "fixed",
|
|
707
|
+
inset: "0",
|
|
708
|
+
zIndex: "2147483600",
|
|
709
|
+
cursor: "crosshair",
|
|
710
|
+
pointerEvents: mode === "rect" ? "auto" : "none",
|
|
711
|
+
background: mode === "rect" ? "rgba(0,0,0,0.04)" : "transparent"
|
|
712
|
+
});
|
|
713
|
+
const box = document.createElement("div");
|
|
714
|
+
Object.assign(box.style, {
|
|
715
|
+
position: "fixed",
|
|
716
|
+
pointerEvents: "none",
|
|
717
|
+
border: `2px solid ${ACCENT}`,
|
|
718
|
+
background: "rgba(255,107,0,0.10)",
|
|
719
|
+
borderRadius: "2px",
|
|
720
|
+
transition: "all 40ms linear",
|
|
721
|
+
display: "none",
|
|
722
|
+
zIndex: "2147483601"
|
|
723
|
+
});
|
|
724
|
+
layer.appendChild(box);
|
|
725
|
+
document.body.appendChild(layer);
|
|
726
|
+
const cleanup = () => {
|
|
727
|
+
document.removeEventListener("mousemove", onMove, true);
|
|
728
|
+
document.removeEventListener("click", onClick, true);
|
|
729
|
+
document.removeEventListener("keydown", onKey, true);
|
|
730
|
+
layer.removeEventListener("mousedown", onDown);
|
|
731
|
+
layer.remove();
|
|
732
|
+
};
|
|
733
|
+
const finish = (sel) => {
|
|
734
|
+
cleanup();
|
|
735
|
+
resolve(sel);
|
|
736
|
+
};
|
|
737
|
+
const drawTo = (r3) => {
|
|
738
|
+
box.style.display = "block";
|
|
739
|
+
box.style.left = `${r3.left}px`;
|
|
740
|
+
box.style.top = `${r3.top}px`;
|
|
741
|
+
box.style.width = `${r3.width}px`;
|
|
742
|
+
box.style.height = `${r3.height}px`;
|
|
743
|
+
};
|
|
744
|
+
const onMove = (e3) => {
|
|
745
|
+
const el = document.elementFromPoint(e3.clientX, e3.clientY);
|
|
746
|
+
if (!el || isOurs(el)) {
|
|
747
|
+
box.style.display = "none";
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
drawTo(el.getBoundingClientRect());
|
|
751
|
+
};
|
|
752
|
+
const onClick = (e3) => {
|
|
753
|
+
const el = document.elementFromPoint(e3.clientX, e3.clientY);
|
|
754
|
+
if (!el || isOurs(el)) return;
|
|
755
|
+
e3.preventDefault();
|
|
756
|
+
e3.stopPropagation();
|
|
757
|
+
finish({ mode: "element", pointerPath: [el] });
|
|
758
|
+
};
|
|
759
|
+
let startX = 0;
|
|
760
|
+
let startY = 0;
|
|
761
|
+
const onDown = (e3) => {
|
|
762
|
+
startX = e3.clientX;
|
|
763
|
+
startY = e3.clientY;
|
|
764
|
+
const onRectMove = (m3) => {
|
|
765
|
+
const x2 = Math.min(startX, m3.clientX);
|
|
766
|
+
const y3 = Math.min(startY, m3.clientY);
|
|
767
|
+
drawTo(
|
|
768
|
+
new DOMRect(x2, y3, Math.abs(m3.clientX - startX), Math.abs(m3.clientY - startY))
|
|
769
|
+
);
|
|
770
|
+
};
|
|
771
|
+
const onUp = (u3) => {
|
|
772
|
+
layer.removeEventListener("mousemove", onRectMove);
|
|
773
|
+
layer.removeEventListener("mouseup", onUp);
|
|
774
|
+
const x2 = Math.min(startX, u3.clientX);
|
|
775
|
+
const y3 = Math.min(startY, u3.clientY);
|
|
776
|
+
finish({
|
|
777
|
+
mode: "rect",
|
|
778
|
+
rect: {
|
|
779
|
+
x: x2,
|
|
780
|
+
y: y3,
|
|
781
|
+
width: Math.abs(u3.clientX - startX),
|
|
782
|
+
height: Math.abs(u3.clientY - startY)
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
layer.addEventListener("mousemove", onRectMove);
|
|
787
|
+
layer.addEventListener("mouseup", onUp);
|
|
788
|
+
};
|
|
789
|
+
const onKey = (e3) => {
|
|
790
|
+
if (e3.key === "Escape") {
|
|
791
|
+
e3.preventDefault();
|
|
792
|
+
finish(null);
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
if (mode === "rect") {
|
|
796
|
+
layer.addEventListener("mousedown", onDown);
|
|
797
|
+
} else {
|
|
798
|
+
document.addEventListener("mousemove", onMove, true);
|
|
799
|
+
document.addEventListener("click", onClick, true);
|
|
800
|
+
}
|
|
801
|
+
document.addEventListener("keydown", onKey, true);
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/util.js
|
|
806
|
+
function resolveUrl(url, baseUrl) {
|
|
807
|
+
if (url.match(/^[a-z]+:\/\//i)) {
|
|
808
|
+
return url;
|
|
809
|
+
}
|
|
810
|
+
if (url.match(/^\/\//)) {
|
|
811
|
+
return window.location.protocol + url;
|
|
812
|
+
}
|
|
813
|
+
if (url.match(/^[a-z]+:/i)) {
|
|
814
|
+
return url;
|
|
815
|
+
}
|
|
816
|
+
const doc = document.implementation.createHTMLDocument();
|
|
817
|
+
const base = doc.createElement("base");
|
|
818
|
+
const a3 = doc.createElement("a");
|
|
819
|
+
doc.head.appendChild(base);
|
|
820
|
+
doc.body.appendChild(a3);
|
|
821
|
+
if (baseUrl) {
|
|
822
|
+
base.href = baseUrl;
|
|
823
|
+
}
|
|
824
|
+
a3.href = url;
|
|
825
|
+
return a3.href;
|
|
826
|
+
}
|
|
827
|
+
var uuid = /* @__PURE__ */ (() => {
|
|
828
|
+
let counter = 0;
|
|
829
|
+
const random = () => (
|
|
830
|
+
// eslint-disable-next-line no-bitwise
|
|
831
|
+
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
|
|
832
|
+
);
|
|
833
|
+
return () => {
|
|
834
|
+
counter += 1;
|
|
835
|
+
return `u${random()}${counter}`;
|
|
836
|
+
};
|
|
837
|
+
})();
|
|
838
|
+
function toArray(arrayLike) {
|
|
839
|
+
const arr = [];
|
|
840
|
+
for (let i3 = 0, l3 = arrayLike.length; i3 < l3; i3++) {
|
|
841
|
+
arr.push(arrayLike[i3]);
|
|
842
|
+
}
|
|
843
|
+
return arr;
|
|
844
|
+
}
|
|
845
|
+
var styleProps = null;
|
|
846
|
+
function getStyleProperties(options = {}) {
|
|
847
|
+
if (styleProps) {
|
|
848
|
+
return styleProps;
|
|
849
|
+
}
|
|
850
|
+
if (options.includeStyleProperties) {
|
|
851
|
+
styleProps = options.includeStyleProperties;
|
|
852
|
+
return styleProps;
|
|
853
|
+
}
|
|
854
|
+
styleProps = toArray(window.getComputedStyle(document.documentElement));
|
|
855
|
+
return styleProps;
|
|
856
|
+
}
|
|
857
|
+
function px(node, styleProperty) {
|
|
858
|
+
const win = node.ownerDocument.defaultView || window;
|
|
859
|
+
const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
860
|
+
return val ? parseFloat(val.replace("px", "")) : 0;
|
|
861
|
+
}
|
|
862
|
+
function getNodeWidth(node) {
|
|
863
|
+
const leftBorder = px(node, "border-left-width");
|
|
864
|
+
const rightBorder = px(node, "border-right-width");
|
|
865
|
+
return node.clientWidth + leftBorder + rightBorder;
|
|
866
|
+
}
|
|
867
|
+
function getNodeHeight(node) {
|
|
868
|
+
const topBorder = px(node, "border-top-width");
|
|
869
|
+
const bottomBorder = px(node, "border-bottom-width");
|
|
870
|
+
return node.clientHeight + topBorder + bottomBorder;
|
|
871
|
+
}
|
|
872
|
+
function getImageSize(targetNode, options = {}) {
|
|
873
|
+
const width = options.width || getNodeWidth(targetNode);
|
|
874
|
+
const height = options.height || getNodeHeight(targetNode);
|
|
875
|
+
return { width, height };
|
|
876
|
+
}
|
|
877
|
+
function getPixelRatio() {
|
|
878
|
+
let ratio;
|
|
879
|
+
let FINAL_PROCESS;
|
|
880
|
+
try {
|
|
881
|
+
FINAL_PROCESS = process;
|
|
882
|
+
} catch (e3) {
|
|
883
|
+
}
|
|
884
|
+
const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
|
|
885
|
+
if (val) {
|
|
886
|
+
ratio = parseInt(val, 10);
|
|
887
|
+
if (Number.isNaN(ratio)) {
|
|
888
|
+
ratio = 1;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return ratio || window.devicePixelRatio || 1;
|
|
892
|
+
}
|
|
893
|
+
var canvasDimensionLimit = 16384;
|
|
894
|
+
function checkCanvasDimensions(canvas) {
|
|
895
|
+
if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
|
|
896
|
+
if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
|
|
897
|
+
if (canvas.width > canvas.height) {
|
|
898
|
+
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
899
|
+
canvas.width = canvasDimensionLimit;
|
|
900
|
+
} else {
|
|
901
|
+
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
902
|
+
canvas.height = canvasDimensionLimit;
|
|
903
|
+
}
|
|
904
|
+
} else if (canvas.width > canvasDimensionLimit) {
|
|
905
|
+
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
906
|
+
canvas.width = canvasDimensionLimit;
|
|
907
|
+
} else {
|
|
908
|
+
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
909
|
+
canvas.height = canvasDimensionLimit;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function createImage(url) {
|
|
914
|
+
return new Promise((resolve, reject) => {
|
|
915
|
+
const img = new Image();
|
|
916
|
+
img.onload = () => {
|
|
917
|
+
img.decode().then(() => {
|
|
918
|
+
requestAnimationFrame(() => resolve(img));
|
|
919
|
+
});
|
|
920
|
+
};
|
|
921
|
+
img.onerror = reject;
|
|
922
|
+
img.crossOrigin = "anonymous";
|
|
923
|
+
img.decoding = "async";
|
|
924
|
+
img.src = url;
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
async function svgToDataURL(svg) {
|
|
928
|
+
return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
|
|
929
|
+
}
|
|
930
|
+
async function nodeToDataURL(node, width, height) {
|
|
931
|
+
const xmlns = "http://www.w3.org/2000/svg";
|
|
932
|
+
const svg = document.createElementNS(xmlns, "svg");
|
|
933
|
+
const foreignObject = document.createElementNS(xmlns, "foreignObject");
|
|
934
|
+
svg.setAttribute("width", `${width}`);
|
|
935
|
+
svg.setAttribute("height", `${height}`);
|
|
936
|
+
svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
937
|
+
foreignObject.setAttribute("width", "100%");
|
|
938
|
+
foreignObject.setAttribute("height", "100%");
|
|
939
|
+
foreignObject.setAttribute("x", "0");
|
|
940
|
+
foreignObject.setAttribute("y", "0");
|
|
941
|
+
foreignObject.setAttribute("externalResourcesRequired", "true");
|
|
942
|
+
svg.appendChild(foreignObject);
|
|
943
|
+
foreignObject.appendChild(node);
|
|
944
|
+
return svgToDataURL(svg);
|
|
945
|
+
}
|
|
946
|
+
var isInstanceOfElement = (node, instance) => {
|
|
947
|
+
if (node instanceof instance)
|
|
948
|
+
return true;
|
|
949
|
+
const nodePrototype = Object.getPrototypeOf(node);
|
|
950
|
+
if (nodePrototype === null)
|
|
951
|
+
return false;
|
|
952
|
+
return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-pseudos.js
|
|
956
|
+
function formatCSSText(style) {
|
|
957
|
+
const content = style.getPropertyValue("content");
|
|
958
|
+
return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
|
|
959
|
+
}
|
|
960
|
+
function formatCSSProperties(style, options) {
|
|
961
|
+
return getStyleProperties(options).map((name) => {
|
|
962
|
+
const value = style.getPropertyValue(name);
|
|
963
|
+
const priority = style.getPropertyPriority(name);
|
|
964
|
+
return `${name}: ${value}${priority ? " !important" : ""};`;
|
|
965
|
+
}).join(" ");
|
|
966
|
+
}
|
|
967
|
+
function getPseudoElementStyle(className, pseudo, style, options) {
|
|
968
|
+
const selector = `.${className}:${pseudo}`;
|
|
969
|
+
const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style, options);
|
|
970
|
+
return document.createTextNode(`${selector}{${cssText}}`);
|
|
971
|
+
}
|
|
972
|
+
function clonePseudoElement(nativeNode, clonedNode, pseudo, options) {
|
|
973
|
+
const style = window.getComputedStyle(nativeNode, pseudo);
|
|
974
|
+
const content = style.getPropertyValue("content");
|
|
975
|
+
if (content === "" || content === "none") {
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
const className = uuid();
|
|
979
|
+
try {
|
|
980
|
+
clonedNode.className = `${clonedNode.className} ${className}`;
|
|
981
|
+
} catch (err) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
const styleElement = document.createElement("style");
|
|
985
|
+
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style, options));
|
|
986
|
+
clonedNode.appendChild(styleElement);
|
|
987
|
+
}
|
|
988
|
+
function clonePseudoElements(nativeNode, clonedNode, options) {
|
|
989
|
+
clonePseudoElement(nativeNode, clonedNode, ":before", options);
|
|
990
|
+
clonePseudoElement(nativeNode, clonedNode, ":after", options);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/mimes.js
|
|
994
|
+
var WOFF = "application/font-woff";
|
|
995
|
+
var JPEG = "image/jpeg";
|
|
996
|
+
var mimes = {
|
|
997
|
+
woff: WOFF,
|
|
998
|
+
woff2: WOFF,
|
|
999
|
+
ttf: "application/font-truetype",
|
|
1000
|
+
eot: "application/vnd.ms-fontobject",
|
|
1001
|
+
png: "image/png",
|
|
1002
|
+
jpg: JPEG,
|
|
1003
|
+
jpeg: JPEG,
|
|
1004
|
+
gif: "image/gif",
|
|
1005
|
+
tiff: "image/tiff",
|
|
1006
|
+
svg: "image/svg+xml",
|
|
1007
|
+
webp: "image/webp"
|
|
1008
|
+
};
|
|
1009
|
+
function getExtension(url) {
|
|
1010
|
+
const match = /\.([^./]*?)$/g.exec(url);
|
|
1011
|
+
return match ? match[1] : "";
|
|
1012
|
+
}
|
|
1013
|
+
function getMimeType(url) {
|
|
1014
|
+
const extension = getExtension(url).toLowerCase();
|
|
1015
|
+
return mimes[extension] || "";
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/dataurl.js
|
|
1019
|
+
function getContentFromDataUrl(dataURL) {
|
|
1020
|
+
return dataURL.split(/,/)[1];
|
|
1021
|
+
}
|
|
1022
|
+
function isDataUrl(url) {
|
|
1023
|
+
return url.search(/^(data:)/) !== -1;
|
|
1024
|
+
}
|
|
1025
|
+
function makeDataUrl(content, mimeType) {
|
|
1026
|
+
return `data:${mimeType};base64,${content}`;
|
|
1027
|
+
}
|
|
1028
|
+
async function fetchAsDataURL(url, init, process2) {
|
|
1029
|
+
const res = await fetch(url, init);
|
|
1030
|
+
if (res.status === 404) {
|
|
1031
|
+
throw new Error(`Resource "${res.url}" not found`);
|
|
1032
|
+
}
|
|
1033
|
+
const blob = await res.blob();
|
|
1034
|
+
return new Promise((resolve, reject) => {
|
|
1035
|
+
const reader = new FileReader();
|
|
1036
|
+
reader.onerror = reject;
|
|
1037
|
+
reader.onloadend = () => {
|
|
1038
|
+
try {
|
|
1039
|
+
resolve(process2({ res, result: reader.result }));
|
|
1040
|
+
} catch (error) {
|
|
1041
|
+
reject(error);
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
reader.readAsDataURL(blob);
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
var cache = {};
|
|
1048
|
+
function getCacheKey(url, contentType, includeQueryParams) {
|
|
1049
|
+
let key = url.replace(/\?.*/, "");
|
|
1050
|
+
if (includeQueryParams) {
|
|
1051
|
+
key = url;
|
|
1052
|
+
}
|
|
1053
|
+
if (/ttf|otf|eot|woff2?/i.test(key)) {
|
|
1054
|
+
key = key.replace(/.*\//, "");
|
|
1055
|
+
}
|
|
1056
|
+
return contentType ? `[${contentType}]${key}` : key;
|
|
1057
|
+
}
|
|
1058
|
+
async function resourceToDataURL(resourceUrl, contentType, options) {
|
|
1059
|
+
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
|
|
1060
|
+
if (cache[cacheKey] != null) {
|
|
1061
|
+
return cache[cacheKey];
|
|
1062
|
+
}
|
|
1063
|
+
if (options.cacheBust) {
|
|
1064
|
+
resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
|
|
1065
|
+
}
|
|
1066
|
+
let dataURL;
|
|
1067
|
+
try {
|
|
1068
|
+
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
|
|
1069
|
+
if (!contentType) {
|
|
1070
|
+
contentType = res.headers.get("Content-Type") || "";
|
|
1071
|
+
}
|
|
1072
|
+
return getContentFromDataUrl(result);
|
|
1073
|
+
});
|
|
1074
|
+
dataURL = makeDataUrl(content, contentType);
|
|
1075
|
+
} catch (error) {
|
|
1076
|
+
dataURL = options.imagePlaceholder || "";
|
|
1077
|
+
let msg = `Failed to fetch resource: ${resourceUrl}`;
|
|
1078
|
+
if (error) {
|
|
1079
|
+
msg = typeof error === "string" ? error : error.message;
|
|
1080
|
+
}
|
|
1081
|
+
if (msg) {
|
|
1082
|
+
console.warn(msg);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
cache[cacheKey] = dataURL;
|
|
1086
|
+
return dataURL;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-node.js
|
|
1090
|
+
async function cloneCanvasElement(canvas) {
|
|
1091
|
+
const dataURL = canvas.toDataURL();
|
|
1092
|
+
if (dataURL === "data:,") {
|
|
1093
|
+
return canvas.cloneNode(false);
|
|
1094
|
+
}
|
|
1095
|
+
return createImage(dataURL);
|
|
1096
|
+
}
|
|
1097
|
+
async function cloneVideoElement(video, options) {
|
|
1098
|
+
if (video.currentSrc) {
|
|
1099
|
+
const canvas = document.createElement("canvas");
|
|
1100
|
+
const ctx = canvas.getContext("2d");
|
|
1101
|
+
canvas.width = video.clientWidth;
|
|
1102
|
+
canvas.height = video.clientHeight;
|
|
1103
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
1104
|
+
const dataURL2 = canvas.toDataURL();
|
|
1105
|
+
return createImage(dataURL2);
|
|
1106
|
+
}
|
|
1107
|
+
const poster = video.poster;
|
|
1108
|
+
const contentType = getMimeType(poster);
|
|
1109
|
+
const dataURL = await resourceToDataURL(poster, contentType, options);
|
|
1110
|
+
return createImage(dataURL);
|
|
1111
|
+
}
|
|
1112
|
+
async function cloneIFrameElement(iframe, options) {
|
|
1113
|
+
var _a;
|
|
1114
|
+
try {
|
|
1115
|
+
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
|
|
1116
|
+
return await cloneNode(iframe.contentDocument.body, options, true);
|
|
1117
|
+
}
|
|
1118
|
+
} catch (_b) {
|
|
1119
|
+
}
|
|
1120
|
+
return iframe.cloneNode(false);
|
|
1121
|
+
}
|
|
1122
|
+
async function cloneSingleNode(node, options) {
|
|
1123
|
+
if (isInstanceOfElement(node, HTMLCanvasElement)) {
|
|
1124
|
+
return cloneCanvasElement(node);
|
|
1125
|
+
}
|
|
1126
|
+
if (isInstanceOfElement(node, HTMLVideoElement)) {
|
|
1127
|
+
return cloneVideoElement(node, options);
|
|
1128
|
+
}
|
|
1129
|
+
if (isInstanceOfElement(node, HTMLIFrameElement)) {
|
|
1130
|
+
return cloneIFrameElement(node, options);
|
|
1131
|
+
}
|
|
1132
|
+
return node.cloneNode(isSVGElement(node));
|
|
1133
|
+
}
|
|
1134
|
+
var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
|
|
1135
|
+
var isSVGElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SVG";
|
|
1136
|
+
async function cloneChildren(nativeNode, clonedNode, options) {
|
|
1137
|
+
var _a, _b;
|
|
1138
|
+
if (isSVGElement(clonedNode)) {
|
|
1139
|
+
return clonedNode;
|
|
1140
|
+
}
|
|
1141
|
+
let children = [];
|
|
1142
|
+
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
|
|
1143
|
+
children = toArray(nativeNode.assignedNodes());
|
|
1144
|
+
} else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
1145
|
+
children = toArray(nativeNode.contentDocument.body.childNodes);
|
|
1146
|
+
} else {
|
|
1147
|
+
children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
|
|
1148
|
+
}
|
|
1149
|
+
if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
|
|
1150
|
+
return clonedNode;
|
|
1151
|
+
}
|
|
1152
|
+
await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
|
|
1153
|
+
if (clonedChild) {
|
|
1154
|
+
clonedNode.appendChild(clonedChild);
|
|
1155
|
+
}
|
|
1156
|
+
}), Promise.resolve());
|
|
1157
|
+
return clonedNode;
|
|
1158
|
+
}
|
|
1159
|
+
function cloneCSSStyle(nativeNode, clonedNode, options) {
|
|
1160
|
+
const targetStyle = clonedNode.style;
|
|
1161
|
+
if (!targetStyle) {
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
const sourceStyle = window.getComputedStyle(nativeNode);
|
|
1165
|
+
if (sourceStyle.cssText) {
|
|
1166
|
+
targetStyle.cssText = sourceStyle.cssText;
|
|
1167
|
+
targetStyle.transformOrigin = sourceStyle.transformOrigin;
|
|
1168
|
+
} else {
|
|
1169
|
+
getStyleProperties(options).forEach((name) => {
|
|
1170
|
+
let value = sourceStyle.getPropertyValue(name);
|
|
1171
|
+
if (name === "font-size" && value.endsWith("px")) {
|
|
1172
|
+
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
|
|
1173
|
+
value = `${reducedFont}px`;
|
|
1174
|
+
}
|
|
1175
|
+
if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") {
|
|
1176
|
+
value = "block";
|
|
1177
|
+
}
|
|
1178
|
+
if (name === "d" && clonedNode.getAttribute("d")) {
|
|
1179
|
+
value = `path(${clonedNode.getAttribute("d")})`;
|
|
1180
|
+
}
|
|
1181
|
+
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
function cloneInputValue(nativeNode, clonedNode) {
|
|
1186
|
+
if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
|
|
1187
|
+
clonedNode.innerHTML = nativeNode.value;
|
|
1188
|
+
}
|
|
1189
|
+
if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
|
|
1190
|
+
clonedNode.setAttribute("value", nativeNode.value);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
function cloneSelectValue(nativeNode, clonedNode) {
|
|
1194
|
+
if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
|
|
1195
|
+
const clonedSelect = clonedNode;
|
|
1196
|
+
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value"));
|
|
1197
|
+
if (selectedOption) {
|
|
1198
|
+
selectedOption.setAttribute("selected", "");
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
function decorate(nativeNode, clonedNode, options) {
|
|
1203
|
+
if (isInstanceOfElement(clonedNode, Element)) {
|
|
1204
|
+
cloneCSSStyle(nativeNode, clonedNode, options);
|
|
1205
|
+
clonePseudoElements(nativeNode, clonedNode, options);
|
|
1206
|
+
cloneInputValue(nativeNode, clonedNode);
|
|
1207
|
+
cloneSelectValue(nativeNode, clonedNode);
|
|
1208
|
+
}
|
|
1209
|
+
return clonedNode;
|
|
1210
|
+
}
|
|
1211
|
+
async function ensureSVGSymbols(clone, options) {
|
|
1212
|
+
const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
|
|
1213
|
+
if (uses.length === 0) {
|
|
1214
|
+
return clone;
|
|
1215
|
+
}
|
|
1216
|
+
const processedDefs = {};
|
|
1217
|
+
for (let i3 = 0; i3 < uses.length; i3++) {
|
|
1218
|
+
const use = uses[i3];
|
|
1219
|
+
const id = use.getAttribute("xlink:href");
|
|
1220
|
+
if (id) {
|
|
1221
|
+
const exist = clone.querySelector(id);
|
|
1222
|
+
const definition = document.querySelector(id);
|
|
1223
|
+
if (!exist && definition && !processedDefs[id]) {
|
|
1224
|
+
processedDefs[id] = await cloneNode(definition, options, true);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
const nodes = Object.values(processedDefs);
|
|
1229
|
+
if (nodes.length) {
|
|
1230
|
+
const ns = "http://www.w3.org/1999/xhtml";
|
|
1231
|
+
const svg = document.createElementNS(ns, "svg");
|
|
1232
|
+
svg.setAttribute("xmlns", ns);
|
|
1233
|
+
svg.style.position = "absolute";
|
|
1234
|
+
svg.style.width = "0";
|
|
1235
|
+
svg.style.height = "0";
|
|
1236
|
+
svg.style.overflow = "hidden";
|
|
1237
|
+
svg.style.display = "none";
|
|
1238
|
+
const defs = document.createElementNS(ns, "defs");
|
|
1239
|
+
svg.appendChild(defs);
|
|
1240
|
+
for (let i3 = 0; i3 < nodes.length; i3++) {
|
|
1241
|
+
defs.appendChild(nodes[i3]);
|
|
1242
|
+
}
|
|
1243
|
+
clone.appendChild(svg);
|
|
1244
|
+
}
|
|
1245
|
+
return clone;
|
|
1246
|
+
}
|
|
1247
|
+
async function cloneNode(node, options, isRoot) {
|
|
1248
|
+
if (!isRoot && options.filter && !options.filter(node)) {
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode, options)).then((clonedNode) => ensureSVGSymbols(clonedNode, options));
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-resources.js
|
|
1255
|
+
var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
1256
|
+
var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
|
|
1257
|
+
var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
1258
|
+
function toRegex(url) {
|
|
1259
|
+
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
1260
|
+
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
|
|
1261
|
+
}
|
|
1262
|
+
function parseURLs(cssText) {
|
|
1263
|
+
const urls = [];
|
|
1264
|
+
cssText.replace(URL_REGEX, (raw, quotation, url) => {
|
|
1265
|
+
urls.push(url);
|
|
1266
|
+
return raw;
|
|
1267
|
+
});
|
|
1268
|
+
return urls.filter((url) => !isDataUrl(url));
|
|
1269
|
+
}
|
|
1270
|
+
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
|
|
1271
|
+
try {
|
|
1272
|
+
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
|
|
1273
|
+
const contentType = getMimeType(resourceURL);
|
|
1274
|
+
let dataURL;
|
|
1275
|
+
if (getContentFromUrl) {
|
|
1276
|
+
const content = await getContentFromUrl(resolvedURL);
|
|
1277
|
+
dataURL = makeDataUrl(content, contentType);
|
|
1278
|
+
} else {
|
|
1279
|
+
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
|
|
1280
|
+
}
|
|
1281
|
+
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
1282
|
+
} catch (error) {
|
|
1283
|
+
}
|
|
1284
|
+
return cssText;
|
|
1285
|
+
}
|
|
1286
|
+
function filterPreferredFontFormat(str, { preferredFontFormat }) {
|
|
1287
|
+
return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
|
|
1288
|
+
while (true) {
|
|
1289
|
+
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
|
|
1290
|
+
if (!format) {
|
|
1291
|
+
return "";
|
|
1292
|
+
}
|
|
1293
|
+
if (format === preferredFontFormat) {
|
|
1294
|
+
return `src: ${src};`;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
function shouldEmbed(url) {
|
|
1300
|
+
return url.search(URL_REGEX) !== -1;
|
|
1301
|
+
}
|
|
1302
|
+
async function embedResources(cssText, baseUrl, options) {
|
|
1303
|
+
if (!shouldEmbed(cssText)) {
|
|
1304
|
+
return cssText;
|
|
1305
|
+
}
|
|
1306
|
+
const filteredCSSText = filterPreferredFontFormat(cssText, options);
|
|
1307
|
+
const urls = parseURLs(filteredCSSText);
|
|
1308
|
+
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-images.js
|
|
1312
|
+
async function embedProp(propName, node, options) {
|
|
1313
|
+
var _a;
|
|
1314
|
+
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
|
|
1315
|
+
if (propValue) {
|
|
1316
|
+
const cssString = await embedResources(propValue, null, options);
|
|
1317
|
+
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
|
|
1318
|
+
return true;
|
|
1319
|
+
}
|
|
1320
|
+
return false;
|
|
1321
|
+
}
|
|
1322
|
+
async function embedBackground(clonedNode, options) {
|
|
1323
|
+
;
|
|
1324
|
+
await embedProp("background", clonedNode, options) || await embedProp("background-image", clonedNode, options);
|
|
1325
|
+
await embedProp("mask", clonedNode, options) || await embedProp("-webkit-mask", clonedNode, options) || await embedProp("mask-image", clonedNode, options) || await embedProp("-webkit-mask-image", clonedNode, options);
|
|
1326
|
+
}
|
|
1327
|
+
async function embedImageNode(clonedNode, options) {
|
|
1328
|
+
const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
|
|
1329
|
+
if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
|
|
1333
|
+
const dataURL = await resourceToDataURL(url, getMimeType(url), options);
|
|
1334
|
+
await new Promise((resolve, reject) => {
|
|
1335
|
+
clonedNode.onload = resolve;
|
|
1336
|
+
clonedNode.onerror = options.onImageErrorHandler ? (...attributes) => {
|
|
1337
|
+
try {
|
|
1338
|
+
resolve(options.onImageErrorHandler(...attributes));
|
|
1339
|
+
} catch (error) {
|
|
1340
|
+
reject(error);
|
|
1341
|
+
}
|
|
1342
|
+
} : reject;
|
|
1343
|
+
const image = clonedNode;
|
|
1344
|
+
if (image.decode) {
|
|
1345
|
+
image.decode = resolve;
|
|
1346
|
+
}
|
|
1347
|
+
if (image.loading === "lazy") {
|
|
1348
|
+
image.loading = "eager";
|
|
1349
|
+
}
|
|
1350
|
+
if (isImageElement) {
|
|
1351
|
+
clonedNode.srcset = "";
|
|
1352
|
+
clonedNode.src = dataURL;
|
|
1353
|
+
} else {
|
|
1354
|
+
clonedNode.href.baseVal = dataURL;
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
async function embedChildren(clonedNode, options) {
|
|
1359
|
+
const children = toArray(clonedNode.childNodes);
|
|
1360
|
+
const deferreds = children.map((child) => embedImages(child, options));
|
|
1361
|
+
await Promise.all(deferreds).then(() => clonedNode);
|
|
1362
|
+
}
|
|
1363
|
+
async function embedImages(clonedNode, options) {
|
|
1364
|
+
if (isInstanceOfElement(clonedNode, Element)) {
|
|
1365
|
+
await embedBackground(clonedNode, options);
|
|
1366
|
+
await embedImageNode(clonedNode, options);
|
|
1367
|
+
await embedChildren(clonedNode, options);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/apply-style.js
|
|
1372
|
+
function applyStyle(node, options) {
|
|
1373
|
+
const { style } = node;
|
|
1374
|
+
if (options.backgroundColor) {
|
|
1375
|
+
style.backgroundColor = options.backgroundColor;
|
|
1376
|
+
}
|
|
1377
|
+
if (options.width) {
|
|
1378
|
+
style.width = `${options.width}px`;
|
|
1379
|
+
}
|
|
1380
|
+
if (options.height) {
|
|
1381
|
+
style.height = `${options.height}px`;
|
|
1382
|
+
}
|
|
1383
|
+
const manual = options.style;
|
|
1384
|
+
if (manual != null) {
|
|
1385
|
+
Object.keys(manual).forEach((key) => {
|
|
1386
|
+
style[key] = manual[key];
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
return node;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-webfonts.js
|
|
1393
|
+
var cssFetchCache = {};
|
|
1394
|
+
async function fetchCSS(url) {
|
|
1395
|
+
let cache2 = cssFetchCache[url];
|
|
1396
|
+
if (cache2 != null) {
|
|
1397
|
+
return cache2;
|
|
1398
|
+
}
|
|
1399
|
+
const res = await fetch(url);
|
|
1400
|
+
const cssText = await res.text();
|
|
1401
|
+
cache2 = { url, cssText };
|
|
1402
|
+
cssFetchCache[url] = cache2;
|
|
1403
|
+
return cache2;
|
|
1404
|
+
}
|
|
1405
|
+
async function embedFonts(data, options) {
|
|
1406
|
+
let cssText = data.cssText;
|
|
1407
|
+
const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
|
|
1408
|
+
const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
|
|
1409
|
+
const loadFonts = fontLocs.map(async (loc) => {
|
|
1410
|
+
let url = loc.replace(regexUrl, "$1");
|
|
1411
|
+
if (!url.startsWith("https://")) {
|
|
1412
|
+
url = new URL(url, data.url).href;
|
|
1413
|
+
}
|
|
1414
|
+
return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
|
|
1415
|
+
cssText = cssText.replace(loc, `url(${result})`);
|
|
1416
|
+
return [loc, result];
|
|
1417
|
+
});
|
|
1418
|
+
});
|
|
1419
|
+
return Promise.all(loadFonts).then(() => cssText);
|
|
1420
|
+
}
|
|
1421
|
+
function parseCSS(source) {
|
|
1422
|
+
if (source == null) {
|
|
1423
|
+
return [];
|
|
1424
|
+
}
|
|
1425
|
+
const result = [];
|
|
1426
|
+
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
|
|
1427
|
+
let cssText = source.replace(commentsRegex, "");
|
|
1428
|
+
const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
1429
|
+
while (true) {
|
|
1430
|
+
const matches = keyframesRegex.exec(cssText);
|
|
1431
|
+
if (matches === null) {
|
|
1432
|
+
break;
|
|
1433
|
+
}
|
|
1434
|
+
result.push(matches[0]);
|
|
1435
|
+
}
|
|
1436
|
+
cssText = cssText.replace(keyframesRegex, "");
|
|
1437
|
+
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
|
|
1438
|
+
const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
|
|
1439
|
+
const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
|
|
1440
|
+
while (true) {
|
|
1441
|
+
let matches = importRegex.exec(cssText);
|
|
1442
|
+
if (matches === null) {
|
|
1443
|
+
matches = unifiedRegex.exec(cssText);
|
|
1444
|
+
if (matches === null) {
|
|
1445
|
+
break;
|
|
1446
|
+
} else {
|
|
1447
|
+
importRegex.lastIndex = unifiedRegex.lastIndex;
|
|
1448
|
+
}
|
|
1449
|
+
} else {
|
|
1450
|
+
unifiedRegex.lastIndex = importRegex.lastIndex;
|
|
1451
|
+
}
|
|
1452
|
+
result.push(matches[0]);
|
|
1453
|
+
}
|
|
1454
|
+
return result;
|
|
1455
|
+
}
|
|
1456
|
+
async function getCSSRules(styleSheets, options) {
|
|
1457
|
+
const ret = [];
|
|
1458
|
+
const deferreds = [];
|
|
1459
|
+
styleSheets.forEach((sheet) => {
|
|
1460
|
+
if ("cssRules" in sheet) {
|
|
1461
|
+
try {
|
|
1462
|
+
toArray(sheet.cssRules || []).forEach((item, index) => {
|
|
1463
|
+
if (item.type === CSSRule.IMPORT_RULE) {
|
|
1464
|
+
let importIndex = index + 1;
|
|
1465
|
+
const url = item.href;
|
|
1466
|
+
const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
1467
|
+
try {
|
|
1468
|
+
sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
|
|
1469
|
+
} catch (error) {
|
|
1470
|
+
console.error("Error inserting rule from remote css", {
|
|
1471
|
+
rule,
|
|
1472
|
+
error
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
})).catch((e3) => {
|
|
1476
|
+
console.error("Error loading remote css", e3.toString());
|
|
1477
|
+
});
|
|
1478
|
+
deferreds.push(deferred);
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
} catch (e3) {
|
|
1482
|
+
const inline = styleSheets.find((a3) => a3.href == null) || document.styleSheets[0];
|
|
1483
|
+
if (sheet.href != null) {
|
|
1484
|
+
deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
1485
|
+
inline.insertRule(rule, inline.cssRules.length);
|
|
1486
|
+
})).catch((err) => {
|
|
1487
|
+
console.error("Error loading remote stylesheet", err);
|
|
1488
|
+
}));
|
|
1489
|
+
}
|
|
1490
|
+
console.error("Error inlining remote css file", e3);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
return Promise.all(deferreds).then(() => {
|
|
1495
|
+
styleSheets.forEach((sheet) => {
|
|
1496
|
+
if ("cssRules" in sheet) {
|
|
1497
|
+
try {
|
|
1498
|
+
toArray(sheet.cssRules || []).forEach((item) => {
|
|
1499
|
+
ret.push(item);
|
|
1500
|
+
});
|
|
1501
|
+
} catch (e3) {
|
|
1502
|
+
console.error(`Error while reading CSS rules from ${sheet.href}`, e3);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
return ret;
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
function getWebFontRules(cssRules) {
|
|
1510
|
+
return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
|
|
1511
|
+
}
|
|
1512
|
+
async function parseWebFontRules(node, options) {
|
|
1513
|
+
if (node.ownerDocument == null) {
|
|
1514
|
+
throw new Error("Provided element is not within a Document");
|
|
1515
|
+
}
|
|
1516
|
+
const styleSheets = toArray(node.ownerDocument.styleSheets);
|
|
1517
|
+
const cssRules = await getCSSRules(styleSheets, options);
|
|
1518
|
+
return getWebFontRules(cssRules);
|
|
1519
|
+
}
|
|
1520
|
+
function normalizeFontFamily(font) {
|
|
1521
|
+
return font.trim().replace(/["']/g, "");
|
|
1522
|
+
}
|
|
1523
|
+
function getUsedFonts(node) {
|
|
1524
|
+
const fonts = /* @__PURE__ */ new Set();
|
|
1525
|
+
function traverse(node2) {
|
|
1526
|
+
const fontFamily = node2.style.fontFamily || getComputedStyle(node2).fontFamily;
|
|
1527
|
+
fontFamily.split(",").forEach((font) => {
|
|
1528
|
+
fonts.add(normalizeFontFamily(font));
|
|
1529
|
+
});
|
|
1530
|
+
Array.from(node2.children).forEach((child) => {
|
|
1531
|
+
if (child instanceof HTMLElement) {
|
|
1532
|
+
traverse(child);
|
|
1533
|
+
}
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
traverse(node);
|
|
1537
|
+
return fonts;
|
|
1538
|
+
}
|
|
1539
|
+
async function getWebFontCSS(node, options) {
|
|
1540
|
+
const rules = await parseWebFontRules(node, options);
|
|
1541
|
+
const usedFonts = getUsedFonts(node);
|
|
1542
|
+
const cssTexts = await Promise.all(rules.filter((rule) => usedFonts.has(normalizeFontFamily(rule.style.fontFamily))).map((rule) => {
|
|
1543
|
+
const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
|
|
1544
|
+
return embedResources(rule.cssText, baseUrl, options);
|
|
1545
|
+
}));
|
|
1546
|
+
return cssTexts.join("\n");
|
|
1547
|
+
}
|
|
1548
|
+
async function embedWebFonts(clonedNode, options) {
|
|
1549
|
+
const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
|
|
1550
|
+
if (cssText) {
|
|
1551
|
+
const styleNode = document.createElement("style");
|
|
1552
|
+
const sytleContent = document.createTextNode(cssText);
|
|
1553
|
+
styleNode.appendChild(sytleContent);
|
|
1554
|
+
if (clonedNode.firstChild) {
|
|
1555
|
+
clonedNode.insertBefore(styleNode, clonedNode.firstChild);
|
|
1556
|
+
} else {
|
|
1557
|
+
clonedNode.appendChild(styleNode);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
// ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/index.js
|
|
1563
|
+
async function toSvg(node, options = {}) {
|
|
1564
|
+
const { width, height } = getImageSize(node, options);
|
|
1565
|
+
const clonedNode = await cloneNode(node, options, true);
|
|
1566
|
+
await embedWebFonts(clonedNode, options);
|
|
1567
|
+
await embedImages(clonedNode, options);
|
|
1568
|
+
applyStyle(clonedNode, options);
|
|
1569
|
+
const datauri = await nodeToDataURL(clonedNode, width, height);
|
|
1570
|
+
return datauri;
|
|
1571
|
+
}
|
|
1572
|
+
async function toCanvas(node, options = {}) {
|
|
1573
|
+
const { width, height } = getImageSize(node, options);
|
|
1574
|
+
const svg = await toSvg(node, options);
|
|
1575
|
+
const img = await createImage(svg);
|
|
1576
|
+
const canvas = document.createElement("canvas");
|
|
1577
|
+
const context = canvas.getContext("2d");
|
|
1578
|
+
const ratio = options.pixelRatio || getPixelRatio();
|
|
1579
|
+
const canvasWidth = options.canvasWidth || width;
|
|
1580
|
+
const canvasHeight = options.canvasHeight || height;
|
|
1581
|
+
canvas.width = canvasWidth * ratio;
|
|
1582
|
+
canvas.height = canvasHeight * ratio;
|
|
1583
|
+
if (!options.skipAutoScale) {
|
|
1584
|
+
checkCanvasDimensions(canvas);
|
|
1585
|
+
}
|
|
1586
|
+
canvas.style.width = `${canvasWidth}`;
|
|
1587
|
+
canvas.style.height = `${canvasHeight}`;
|
|
1588
|
+
if (options.backgroundColor) {
|
|
1589
|
+
context.fillStyle = options.backgroundColor;
|
|
1590
|
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
1591
|
+
}
|
|
1592
|
+
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
1593
|
+
return canvas;
|
|
1594
|
+
}
|
|
1595
|
+
async function toPng(node, options = {}) {
|
|
1596
|
+
const canvas = await toCanvas(node, options);
|
|
1597
|
+
return canvas.toDataURL();
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
// src/capture.ts
|
|
1601
|
+
function crossOrigin(url) {
|
|
1602
|
+
if (!url || url.startsWith("data:") || url.startsWith("blob:")) {
|
|
1603
|
+
return false;
|
|
1604
|
+
}
|
|
1605
|
+
try {
|
|
1606
|
+
return new URL(url, location.href).origin !== location.origin;
|
|
1607
|
+
} catch {
|
|
1608
|
+
return false;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
function crossOriginMediaReason(root) {
|
|
1612
|
+
const els = [root, ...root.querySelectorAll("*")];
|
|
1613
|
+
for (const el of els) {
|
|
1614
|
+
if (el instanceof HTMLImageElement) {
|
|
1615
|
+
if (crossOrigin(el.currentSrc || el.src) && el.crossOrigin == null) {
|
|
1616
|
+
const host = (() => {
|
|
1617
|
+
try {
|
|
1618
|
+
return new URL(el.currentSrc || el.src).host;
|
|
1619
|
+
} catch {
|
|
1620
|
+
return "cross-origin";
|
|
1621
|
+
}
|
|
1622
|
+
})();
|
|
1623
|
+
return `cross-origin <img> (${host})`;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
const bg = getComputedStyle(el).backgroundImage;
|
|
1627
|
+
const m3 = bg && bg !== "none" ? /url\(["']?([^"')]+)["']?\)/.exec(bg) : null;
|
|
1628
|
+
if (m3 && crossOrigin(m3[1])) return "cross-origin CSS background image";
|
|
1629
|
+
if ((el instanceof HTMLVideoElement || el instanceof HTMLCanvasElement) && crossOrigin(el.src)) {
|
|
1630
|
+
return `cross-origin <${el.tagName.toLowerCase()}>`;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return null;
|
|
1634
|
+
}
|
|
1635
|
+
function elementFor(sel) {
|
|
1636
|
+
if (sel.mode === "element") return sel.pointerPath?.[0] ?? null;
|
|
1637
|
+
if (sel.rect) {
|
|
1638
|
+
const cx = sel.rect.x + sel.rect.width / 2;
|
|
1639
|
+
const cy = sel.rect.y + sel.rect.height / 2;
|
|
1640
|
+
return document.elementFromPoint(cx, cy);
|
|
1641
|
+
}
|
|
1642
|
+
return null;
|
|
1643
|
+
}
|
|
1644
|
+
async function buildBundle(sel) {
|
|
1645
|
+
const el = elementFor(sel);
|
|
1646
|
+
const rt = runtimeSnapshot();
|
|
1647
|
+
const dpr = window.devicePixelRatio || 1;
|
|
1648
|
+
let screenshot;
|
|
1649
|
+
let screenshotUnavailable;
|
|
1650
|
+
if (el instanceof HTMLElement) {
|
|
1651
|
+
const taint = crossOriginMediaReason(el);
|
|
1652
|
+
if (taint) {
|
|
1653
|
+
screenshotUnavailable = `${taint} \u2014 can't rasterise in-browser`;
|
|
1654
|
+
} else {
|
|
1655
|
+
try {
|
|
1656
|
+
const r3 = el.getBoundingClientRect();
|
|
1657
|
+
const dataUrl = await toPng(el, {
|
|
1658
|
+
pixelRatio: Math.min(dpr, 2),
|
|
1659
|
+
cacheBust: true,
|
|
1660
|
+
// Don't try to screenshot our own overlay if it overlaps.
|
|
1661
|
+
filter: (n2) => !(n2 instanceof Element && n2.closest?.("#insitu-root, [data-insitu-layer]"))
|
|
1662
|
+
});
|
|
1663
|
+
if (!dataUrl || dataUrl.length < 256) {
|
|
1664
|
+
screenshotUnavailable = "rasterise produced an empty image";
|
|
1665
|
+
} else {
|
|
1666
|
+
screenshot = {
|
|
1667
|
+
mime: "image/png",
|
|
1668
|
+
dataUrl,
|
|
1669
|
+
bounds: { x: r3.x, y: r3.y, width: r3.width, height: r3.height }
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
} catch {
|
|
1673
|
+
screenshotUnavailable = "rasterise failed";
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
return {
|
|
1678
|
+
schemaVersion: CAPTURE_SCHEMA_VERSION,
|
|
1679
|
+
id: typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `cap_${Date.now()}_${Math.random().toString(36).slice(2)}`,
|
|
1680
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1681
|
+
target: el ? resolveTarget(el) : null,
|
|
1682
|
+
domSubtree: el ? serializeNode(el) : { tag: "unknown", attrs: {}, children: [] },
|
|
1683
|
+
computedStyles: el ? curateComputedStyles(el) : {},
|
|
1684
|
+
tailwindClasses: el ? extractTailwindClasses(el) : [],
|
|
1685
|
+
...screenshot ? { screenshot } : {},
|
|
1686
|
+
...screenshotUnavailable ? { screenshotUnavailable } : {},
|
|
1687
|
+
viewport: {
|
|
1688
|
+
w: window.innerWidth,
|
|
1689
|
+
h: window.innerHeight,
|
|
1690
|
+
dpr,
|
|
1691
|
+
breakpoint: breakpointFor(window.innerWidth)
|
|
1692
|
+
},
|
|
1693
|
+
runtime: {
|
|
1694
|
+
url: location.href,
|
|
1695
|
+
route: location.pathname,
|
|
1696
|
+
console: rt.console,
|
|
1697
|
+
network: rt.network,
|
|
1698
|
+
errors: rt.errors
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
export {
|
|
1704
|
+
k,
|
|
1705
|
+
R,
|
|
1706
|
+
d2 as d,
|
|
1707
|
+
y2 as y,
|
|
1708
|
+
A2 as A,
|
|
1709
|
+
PROTOCOL_VERSION,
|
|
1710
|
+
IssueTrackerSink,
|
|
1711
|
+
installRuntimeCollectors,
|
|
1712
|
+
runtimeErrorCount,
|
|
1713
|
+
beginPick,
|
|
1714
|
+
buildBundle
|
|
1715
|
+
};
|