hocmai-feedback-widget 0.2.0 → 0.2.2
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/README.md +132 -97
- package/dist/capture/device-detection.d.ts +13 -0
- package/dist/capture/fonts.d.ts +4 -0
- package/dist/capture/index.d.ts +14 -0
- package/dist/capture/mathjax-fonts.d.ts +5 -0
- package/dist/capture/types.d.ts +25 -0
- package/dist/ckeditor.mjs +113 -0
- package/dist/ckeditor.mjs.map +1 -0
- package/dist/components/CkEditor.d.ts +14 -0
- package/dist/components/FeedbackWidget.d.ts +11 -0
- package/dist/context/FeedbackContext.d.ts +5 -0
- package/dist/hocmai-feedback-widget.mjs +7544 -0
- package/dist/hocmai-feedback-widget.mjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/package.json +32 -28
- package/src/App.tsx +143 -58
- package/src/capture/device-detection.ts +52 -0
- package/src/capture/fonts.ts +34 -0
- package/src/capture/index.ts +362 -0
- package/src/capture/mathjax-fonts.ts +143 -0
- package/src/capture/types.ts +34 -0
- package/src/ckeditor.d.ts +14 -0
- package/src/components/CkEditor.tsx +130 -0
- package/src/components/CropOverlay.tsx +29 -47
- package/src/components/FeedbackWidget.tsx +96 -90
- package/src/context/FeedbackContext.tsx +11 -4
- package/src/index.ts +9 -0
- package/src/main.tsx +7 -8
- package/src/utils/device.ts +14 -14
- package/dist/support-feedback-lib.es.js +0 -3867
- package/dist/support-feedback-lib.umd.js +0 -84
- package/dist/utils/screenshot/background-renderer.d.ts +0 -3
- package/dist/utils/screenshot/canvas-renderer.d.ts +0 -9
- package/dist/utils/screenshot/cleanup.d.ts +0 -3
- package/dist/utils/screenshot/device-detection.d.ts +0 -2
- package/dist/utils/screenshot/element-collector.d.ts +0 -10
- package/dist/utils/screenshot/image-renderer.d.ts +0 -21
- package/dist/utils/screenshot/performance.d.ts +0 -3
- package/dist/utils/screenshot/svg-renderer.d.ts +0 -24
- package/dist/utils/screenshot/text-renderer.d.ts +0 -23
- package/dist/utils/screenshot/types.d.ts +0 -35
- package/dist/utils/screenshot.d.ts +0 -9
- package/dist/vite.svg +0 -1
- package/src/App.css +0 -42
- package/src/assets/react.svg +0 -1
- package/src/index.css +0 -68
- package/src/utils/screenshot/background-renderer.ts +0 -54
- package/src/utils/screenshot/canvas-renderer.ts +0 -217
- package/src/utils/screenshot/cleanup.ts +0 -32
- package/src/utils/screenshot/device-detection.ts +0 -38
- package/src/utils/screenshot/element-collector.ts +0 -83
- package/src/utils/screenshot/image-renderer.ts +0 -148
- package/src/utils/screenshot/performance.ts +0 -57
- package/src/utils/screenshot/svg-renderer.ts +0 -126
- package/src/utils/screenshot/text-renderer.ts +0 -212
- package/src/utils/screenshot/types.ts +0 -40
- package/src/utils/screenshot.ts +0 -68
|
@@ -1,3867 +0,0 @@
|
|
|
1
|
-
import { jsxs as A, jsx as C, Fragment as Ae } from "react/jsx-runtime";
|
|
2
|
-
import Mt, { forwardRef as rn, createElement as gt, useState as F, useEffect as Ot, createContext as Un, useContext as zn } from "react";
|
|
3
|
-
var Bn = "2.0.7", Pn = 500, Dt = "user-agent", we = "", Ft = "?", O = {
|
|
4
|
-
FUNCTION: "function",
|
|
5
|
-
OBJECT: "object",
|
|
6
|
-
STRING: "string",
|
|
7
|
-
UNDEFINED: "undefined"
|
|
8
|
-
}, P = "browser", Z = "cpu", G = "device", V = "engine", $ = "os", be = "result", f = "name", c = "type", h = "vendor", g = "version", U = "architecture", Ne = "major", u = "model", Ve = "console", E = "mobile", R = "tablet", D = "smarttv", j = "wearable", Pe = "xr", Re = "embedded", he = "inapp", xt = "brands", ce = "formFactors", vt = "fullVersionList", ye = "platform", St = "platformVersion", Je = "bitness", se = "sec-ch-ua", Hn = se + "-full-version-list", $n = se + "-arch", Wn = se + "-" + Je, qn = se + "-form-factors", Vn = se + "-" + E, jn = se + "-" + u, on = se + "-" + ye, Gn = on + "-version", sn = [xt, vt, E, u, ye, St, U, ce, Je], He = "Amazon", ge = "Apple", _t = "ASUS", Lt = "BlackBerry", le = "Google", Ut = "Huawei", ot = "Lenovo", zt = "Honor", $e = "LG", st = "Microsoft", at = "Motorola", Bt = "Nvidia", Pt = "OnePlus", lt = "OPPO", Se = "Samsung", Ht = "Sharp", Ce = "Sony", ct = "Xiaomi", dt = "Zebra", $t = "Chrome", Wt = "Chromium", ne = "Chromecast", je = "Edge", ke = "Firefox", Ee = "Opera", ut = "Facebook", qt = "Sogou", pe = "Mobile ", Te = " Browser", pt = "Windows", Xn = typeof window !== O.UNDEFINED, B = Xn && window.navigator ? window.navigator : void 0, de = B && B.userAgentData ? B.userAgentData : void 0, Yn = function(e, t) {
|
|
9
|
-
var n = {}, i = t;
|
|
10
|
-
if (!Ge(t)) {
|
|
11
|
-
i = {};
|
|
12
|
-
for (var a in t)
|
|
13
|
-
for (var o in t[a])
|
|
14
|
-
i[o] = t[a][o].concat(i[o] ? i[o] : []);
|
|
15
|
-
}
|
|
16
|
-
for (var r in e)
|
|
17
|
-
n[r] = i[r] && i[r].length % 2 === 0 ? i[r].concat(e[r]) : e[r];
|
|
18
|
-
return n;
|
|
19
|
-
}, Qe = function(e) {
|
|
20
|
-
for (var t = {}, n = 0; n < e.length; n++)
|
|
21
|
-
t[e[n].toUpperCase()] = e[n];
|
|
22
|
-
return t;
|
|
23
|
-
}, mt = function(e, t) {
|
|
24
|
-
if (typeof e === O.OBJECT && e.length > 0) {
|
|
25
|
-
for (var n in e)
|
|
26
|
-
if (ie(t) == ie(e[n])) return !0;
|
|
27
|
-
return !1;
|
|
28
|
-
}
|
|
29
|
-
return Fe(e) ? ie(t) == ie(e) : !1;
|
|
30
|
-
}, Ge = function(e, t) {
|
|
31
|
-
for (var n in e)
|
|
32
|
-
return /^(browser|cpu|device|engine|os)$/.test(n) || (t ? Ge(e[n]) : !1);
|
|
33
|
-
}, Fe = function(e) {
|
|
34
|
-
return typeof e === O.STRING;
|
|
35
|
-
}, ft = function(e) {
|
|
36
|
-
if (e) {
|
|
37
|
-
for (var t = [], n = xe(/\\?\"/g, e).split(","), i = 0; i < n.length; i++)
|
|
38
|
-
if (n[i].indexOf(";") > -1) {
|
|
39
|
-
var a = Xe(n[i]).split(";v=");
|
|
40
|
-
t[i] = { brand: a[0], version: a[1] };
|
|
41
|
-
} else
|
|
42
|
-
t[i] = Xe(n[i]);
|
|
43
|
-
return t;
|
|
44
|
-
}
|
|
45
|
-
}, ie = function(e) {
|
|
46
|
-
return Fe(e) ? e.toLowerCase() : e;
|
|
47
|
-
}, wt = function(e) {
|
|
48
|
-
return Fe(e) ? xe(/[^\d\.]/g, e).split(".")[0] : void 0;
|
|
49
|
-
}, K = function(e) {
|
|
50
|
-
for (var t in e)
|
|
51
|
-
if (e.hasOwnProperty(t)) {
|
|
52
|
-
var n = e[t];
|
|
53
|
-
typeof n == O.OBJECT && n.length == 2 ? this[n[0]] = n[1] : this[n] = void 0;
|
|
54
|
-
}
|
|
55
|
-
return this;
|
|
56
|
-
}, xe = function(e, t) {
|
|
57
|
-
return Fe(t) ? t.replace(e, we) : t;
|
|
58
|
-
}, Ie = function(e) {
|
|
59
|
-
return xe(/\\?\"/g, e);
|
|
60
|
-
}, Xe = function(e, t) {
|
|
61
|
-
return e = xe(/^\s\s*/, String(e)), typeof t === O.UNDEFINED ? e : e.substring(0, t);
|
|
62
|
-
}, bt = function(e, t) {
|
|
63
|
-
if (!(!e || !t))
|
|
64
|
-
for (var n = 0, i, a, o, r, s, d; n < t.length && !s; ) {
|
|
65
|
-
var p = t[n], l = t[n + 1];
|
|
66
|
-
for (i = a = 0; i < p.length && !s && p[i]; )
|
|
67
|
-
if (s = p[i++].exec(e), s)
|
|
68
|
-
for (o = 0; o < l.length; o++)
|
|
69
|
-
d = s[++a], r = l[o], typeof r === O.OBJECT && r.length > 0 ? r.length === 2 ? typeof r[1] == O.FUNCTION ? this[r[0]] = r[1].call(this, d) : this[r[0]] = r[1] : r.length >= 3 && (typeof r[1] === O.FUNCTION && !(r[1].exec && r[1].test) ? r.length > 3 ? this[r[0]] = d ? r[1].apply(this, r.slice(2)) : void 0 : this[r[0]] = d ? r[1].call(this, d, r[2]) : void 0 : r.length == 3 ? this[r[0]] = d ? d.replace(r[1], r[2]) : void 0 : r.length == 4 ? this[r[0]] = d ? r[3].call(this, d.replace(r[1], r[2])) : void 0 : r.length > 4 && (this[r[0]] = d ? r[3].apply(this, [d.replace(r[1], r[2])].concat(r.slice(4))) : void 0)) : this[r] = d || void 0;
|
|
70
|
-
n += 2;
|
|
71
|
-
}
|
|
72
|
-
}, q = function(e, t) {
|
|
73
|
-
for (var n in t)
|
|
74
|
-
if (typeof t[n] === O.OBJECT && t[n].length > 0) {
|
|
75
|
-
for (var i = 0; i < t[n].length; i++)
|
|
76
|
-
if (mt(t[n][i], e))
|
|
77
|
-
return n === Ft ? void 0 : n;
|
|
78
|
-
} else if (mt(t[n], e))
|
|
79
|
-
return n === Ft ? void 0 : n;
|
|
80
|
-
return t.hasOwnProperty("*") ? t["*"] : e;
|
|
81
|
-
}, Vt = {
|
|
82
|
-
ME: "4.90",
|
|
83
|
-
"NT 3.51": "3.51",
|
|
84
|
-
"NT 4.0": "4.0",
|
|
85
|
-
2e3: ["5.0", "5.01"],
|
|
86
|
-
XP: ["5.1", "5.2"],
|
|
87
|
-
Vista: "6.0",
|
|
88
|
-
7: "6.1",
|
|
89
|
-
8: "6.2",
|
|
90
|
-
"8.1": "6.3",
|
|
91
|
-
10: ["6.4", "10.0"],
|
|
92
|
-
NT: ""
|
|
93
|
-
}, jt = {
|
|
94
|
-
embedded: "Automotive",
|
|
95
|
-
mobile: "Mobile",
|
|
96
|
-
tablet: ["Tablet", "EInk"],
|
|
97
|
-
smarttv: "TV",
|
|
98
|
-
wearable: "Watch",
|
|
99
|
-
xr: ["VR", "XR"],
|
|
100
|
-
"?": ["Desktop", "Unknown"],
|
|
101
|
-
"*": void 0
|
|
102
|
-
}, Jn = {
|
|
103
|
-
Chrome: "Google Chrome",
|
|
104
|
-
Edge: "Microsoft Edge",
|
|
105
|
-
"Edge WebView2": "Microsoft Edge WebView2",
|
|
106
|
-
"Chrome WebView": "Android WebView",
|
|
107
|
-
"Chrome Headless": "HeadlessChrome",
|
|
108
|
-
"Huawei Browser": "HuaweiBrowser",
|
|
109
|
-
"MIUI Browser": "Miui Browser",
|
|
110
|
-
"Opera Mobi": "OperaMobile",
|
|
111
|
-
Yandex: "YaBrowser"
|
|
112
|
-
}, Gt = {
|
|
113
|
-
browser: [
|
|
114
|
-
[
|
|
115
|
-
// Most common regardless engine
|
|
116
|
-
/\b(?:crmo|crios)\/([\w\.]+)/i
|
|
117
|
-
// Chrome for Android/iOS
|
|
118
|
-
],
|
|
119
|
-
[g, [f, pe + "Chrome"]],
|
|
120
|
-
[
|
|
121
|
-
/webview.+edge\/([\w\.]+)/i
|
|
122
|
-
// Microsoft Edge
|
|
123
|
-
],
|
|
124
|
-
[g, [f, je + " WebView"]],
|
|
125
|
-
[
|
|
126
|
-
/edg(?:e|ios|a)?\/([\w\.]+)/i
|
|
127
|
-
],
|
|
128
|
-
[g, [f, "Edge"]],
|
|
129
|
-
[
|
|
130
|
-
// Presto based
|
|
131
|
-
/(opera mini)\/([-\w\.]+)/i,
|
|
132
|
-
// Opera Mini
|
|
133
|
-
/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,
|
|
134
|
-
// Opera Mobi/Tablet
|
|
135
|
-
/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i
|
|
136
|
-
// Opera
|
|
137
|
-
],
|
|
138
|
-
[f, g],
|
|
139
|
-
[
|
|
140
|
-
/opios[\/ ]+([\w\.]+)/i
|
|
141
|
-
// Opera mini on iphone >= 8.0
|
|
142
|
-
],
|
|
143
|
-
[g, [f, Ee + " Mini"]],
|
|
144
|
-
[
|
|
145
|
-
/\bop(?:rg)?x\/([\w\.]+)/i
|
|
146
|
-
// Opera GX
|
|
147
|
-
],
|
|
148
|
-
[g, [f, Ee + " GX"]],
|
|
149
|
-
[
|
|
150
|
-
/\bopr\/([\w\.]+)/i
|
|
151
|
-
// Opera Webkit
|
|
152
|
-
],
|
|
153
|
-
[g, [f, Ee]],
|
|
154
|
-
[
|
|
155
|
-
// Mixed
|
|
156
|
-
/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i
|
|
157
|
-
// Baidu
|
|
158
|
-
],
|
|
159
|
-
[g, [f, "Baidu"]],
|
|
160
|
-
[
|
|
161
|
-
/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i
|
|
162
|
-
// Maxthon
|
|
163
|
-
],
|
|
164
|
-
[g, [f, "Maxthon"]],
|
|
165
|
-
[
|
|
166
|
-
/(kindle)\/([\w\.]+)/i,
|
|
167
|
-
// Kindle
|
|
168
|
-
/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,
|
|
169
|
-
// Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir
|
|
170
|
-
// Trident based
|
|
171
|
-
/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,
|
|
172
|
-
// Avant/IEMobile/SlimBrowser/SlimBoat/Slimjet
|
|
173
|
-
/(?:ms|\()(ie) ([\w\.]+)/i,
|
|
174
|
-
// Internet Explorer
|
|
175
|
-
// Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon/LG Browser/Otter/qutebrowser/Dooble/Palemoon
|
|
176
|
-
/(atlas|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser|palemoon)\/([-\w\.]+)/i,
|
|
177
|
-
// Atlas/Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon
|
|
178
|
-
/(heytap|ovi|115|surf|qwant)browser\/([\d\.]+)/i,
|
|
179
|
-
// HeyTap/Ovi/115/Surf
|
|
180
|
-
/(qwant)(?:ios|mobile)\/([\d\.]+)/i,
|
|
181
|
-
// Qwant
|
|
182
|
-
/(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i
|
|
183
|
-
// Ecosia/Weibo
|
|
184
|
-
],
|
|
185
|
-
[f, g],
|
|
186
|
-
[
|
|
187
|
-
/quark(?:pc)?\/([-\w\.]+)/i
|
|
188
|
-
// Quark
|
|
189
|
-
],
|
|
190
|
-
[g, [f, "Quark"]],
|
|
191
|
-
[
|
|
192
|
-
/\bddg\/([\w\.]+)/i
|
|
193
|
-
// DuckDuckGo
|
|
194
|
-
],
|
|
195
|
-
[g, [f, "DuckDuckGo"]],
|
|
196
|
-
[
|
|
197
|
-
/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i
|
|
198
|
-
// UCBrowser
|
|
199
|
-
],
|
|
200
|
-
[g, [f, "UCBrowser"]],
|
|
201
|
-
[
|
|
202
|
-
/microm.+\bqbcore\/([\w\.]+)/i,
|
|
203
|
-
// WeChat Desktop for Windows Built-in Browser
|
|
204
|
-
/\bqbcore\/([\w\.]+).+microm/i,
|
|
205
|
-
/micromessenger\/([\w\.]+)/i
|
|
206
|
-
// WeChat
|
|
207
|
-
],
|
|
208
|
-
[g, [f, "WeChat"]],
|
|
209
|
-
[
|
|
210
|
-
/konqueror\/([\w\.]+)/i
|
|
211
|
-
// Konqueror
|
|
212
|
-
],
|
|
213
|
-
[g, [f, "Konqueror"]],
|
|
214
|
-
[
|
|
215
|
-
/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i
|
|
216
|
-
// IE11
|
|
217
|
-
],
|
|
218
|
-
[g, [f, "IE"]],
|
|
219
|
-
[
|
|
220
|
-
/ya(?:search)?browser\/([\w\.]+)/i
|
|
221
|
-
// Yandex
|
|
222
|
-
],
|
|
223
|
-
[g, [f, "Yandex"]],
|
|
224
|
-
[
|
|
225
|
-
/slbrowser\/([\w\.]+)/i
|
|
226
|
-
// Smart Lenovo Browser
|
|
227
|
-
],
|
|
228
|
-
[g, [f, "Smart " + ot + Te]],
|
|
229
|
-
[
|
|
230
|
-
/(avast|avg)\/([\w\.]+)/i
|
|
231
|
-
// Avast/AVG Secure Browser
|
|
232
|
-
],
|
|
233
|
-
[[f, /(.+)/, "$1 Secure" + Te], g],
|
|
234
|
-
[
|
|
235
|
-
/\bfocus\/([\w\.]+)/i
|
|
236
|
-
// Firefox Focus
|
|
237
|
-
],
|
|
238
|
-
[g, [f, ke + " Focus"]],
|
|
239
|
-
[
|
|
240
|
-
/\bopt\/([\w\.]+)/i
|
|
241
|
-
// Opera Touch
|
|
242
|
-
],
|
|
243
|
-
[g, [f, Ee + " Touch"]],
|
|
244
|
-
[
|
|
245
|
-
/coc_coc\w+\/([\w\.]+)/i
|
|
246
|
-
// Coc Coc Browser
|
|
247
|
-
],
|
|
248
|
-
[g, [f, "Coc Coc"]],
|
|
249
|
-
[
|
|
250
|
-
/dolfin\/([\w\.]+)/i
|
|
251
|
-
// Dolphin
|
|
252
|
-
],
|
|
253
|
-
[g, [f, "Dolphin"]],
|
|
254
|
-
[
|
|
255
|
-
/coast\/([\w\.]+)/i
|
|
256
|
-
// Opera Coast
|
|
257
|
-
],
|
|
258
|
-
[g, [f, Ee + " Coast"]],
|
|
259
|
-
[
|
|
260
|
-
/miuibrowser\/([\w\.]+)/i
|
|
261
|
-
// MIUI Browser
|
|
262
|
-
],
|
|
263
|
-
[g, [f, "MIUI" + Te]],
|
|
264
|
-
[
|
|
265
|
-
/fxios\/([\w\.-]+)/i
|
|
266
|
-
// Firefox for iOS
|
|
267
|
-
],
|
|
268
|
-
[g, [f, pe + ke]],
|
|
269
|
-
[
|
|
270
|
-
/\bqihoobrowser\/?([\w\.]*)/i
|
|
271
|
-
// 360
|
|
272
|
-
],
|
|
273
|
-
[g, [f, "360"]],
|
|
274
|
-
[
|
|
275
|
-
/\b(qq)\/([\w\.]+)/i
|
|
276
|
-
// QQ
|
|
277
|
-
],
|
|
278
|
-
[[f, /(.+)/, "$1Browser"], g],
|
|
279
|
-
[
|
|
280
|
-
/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i
|
|
281
|
-
],
|
|
282
|
-
[[f, /(.+)/, "$1" + Te], g],
|
|
283
|
-
[
|
|
284
|
-
// Oculus/Sailfish/HuaweiBrowser/VivoBrowser/PicoBrowser
|
|
285
|
-
/samsungbrowser\/([\w\.]+)/i
|
|
286
|
-
// Samsung Internet
|
|
287
|
-
],
|
|
288
|
-
[g, [f, Se + " Internet"]],
|
|
289
|
-
[
|
|
290
|
-
/metasr[\/ ]?([\d\.]+)/i
|
|
291
|
-
// Sogou Explorer
|
|
292
|
-
],
|
|
293
|
-
[g, [f, qt + " Explorer"]],
|
|
294
|
-
[
|
|
295
|
-
/(sogou)mo\w+\/([\d\.]+)/i
|
|
296
|
-
// Sogou Mobile
|
|
297
|
-
],
|
|
298
|
-
[[f, qt + " Mobile"], g],
|
|
299
|
-
[
|
|
300
|
-
/(electron)\/([\w\.]+) safari/i,
|
|
301
|
-
// Electron-based App
|
|
302
|
-
/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,
|
|
303
|
-
// Tesla
|
|
304
|
-
/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i
|
|
305
|
-
// QQ/2345
|
|
306
|
-
],
|
|
307
|
-
[f, g],
|
|
308
|
-
[
|
|
309
|
-
/(lbbrowser|rekonq|steam(?= (clie|tenf|gameo)))/i
|
|
310
|
-
// LieBao Browser/Rekonq/Steam
|
|
311
|
-
],
|
|
312
|
-
[f],
|
|
313
|
-
[
|
|
314
|
-
/ome\/([\w\.]+) \w* ?(iron) saf/i,
|
|
315
|
-
// Iron
|
|
316
|
-
/ome\/([\w\.]+).+qihu (360)[es]e/i
|
|
317
|
-
// 360
|
|
318
|
-
],
|
|
319
|
-
[g, f],
|
|
320
|
-
[
|
|
321
|
-
// WebView
|
|
322
|
-
/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i
|
|
323
|
-
// Facebook App for iOS & Android
|
|
324
|
-
],
|
|
325
|
-
[[f, ut], g, [c, he]],
|
|
326
|
-
[
|
|
327
|
-
/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,
|
|
328
|
-
// Kakao App
|
|
329
|
-
/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,
|
|
330
|
-
// Naver InApp
|
|
331
|
-
/(daum)apps[\/ ]([\w\.]+)/i,
|
|
332
|
-
// Daum App
|
|
333
|
-
/safari (line)\/([\w\.]+)/i,
|
|
334
|
-
// Line App for iOS
|
|
335
|
-
/\b(line)\/([\w\.]+)\/iab/i,
|
|
336
|
-
// Line App for Android
|
|
337
|
-
/(alipay)client\/([\w\.]+)/i,
|
|
338
|
-
// Alipay
|
|
339
|
-
/(twitter)(?:and| f.+e\/([\w\.]+))/i,
|
|
340
|
-
// Twitter
|
|
341
|
-
/(bing)(?:web|sapphire)\/([\w\.]+)/i,
|
|
342
|
-
// Bing
|
|
343
|
-
/(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i
|
|
344
|
-
// Instagram/Snapchat/Klarna
|
|
345
|
-
],
|
|
346
|
-
[f, g, [c, he]],
|
|
347
|
-
[
|
|
348
|
-
/\bgsa\/([\w\.]+) .*safari\//i
|
|
349
|
-
// Google Search Appliance on iOS
|
|
350
|
-
],
|
|
351
|
-
[g, [f, "GSA"], [c, he]],
|
|
352
|
-
[
|
|
353
|
-
/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i
|
|
354
|
-
// TikTok
|
|
355
|
-
],
|
|
356
|
-
[g, [f, "TikTok"], [c, he]],
|
|
357
|
-
[
|
|
358
|
-
/\[(linkedin)app\]/i
|
|
359
|
-
// LinkedIn App for iOS & Android
|
|
360
|
-
],
|
|
361
|
-
[f, [c, he]],
|
|
362
|
-
[
|
|
363
|
-
/(zalo(?:app)?)[\/\sa-z]*([\w\.-]+)/i
|
|
364
|
-
// Zalo
|
|
365
|
-
],
|
|
366
|
-
[[f, /(.+)/, "Zalo"], g, [c, he]],
|
|
367
|
-
[
|
|
368
|
-
/(chromium)[\/ ]([-\w\.]+)/i
|
|
369
|
-
// Chromium
|
|
370
|
-
],
|
|
371
|
-
[f, g],
|
|
372
|
-
[
|
|
373
|
-
/headlesschrome(?:\/([\w\.]+)| )/i
|
|
374
|
-
// Chrome Headless
|
|
375
|
-
],
|
|
376
|
-
[g, [f, $t + " Headless"]],
|
|
377
|
-
[
|
|
378
|
-
/wv\).+chrome\/([\w\.]+).+edgw\//i
|
|
379
|
-
// Edge WebView2
|
|
380
|
-
],
|
|
381
|
-
[g, [f, je + " WebView2"]],
|
|
382
|
-
[
|
|
383
|
-
/ wv\).+(chrome)\/([\w\.]+)/i
|
|
384
|
-
// Chrome WebView
|
|
385
|
-
],
|
|
386
|
-
[[f, $t + " WebView"], g],
|
|
387
|
-
[
|
|
388
|
-
/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i
|
|
389
|
-
// Android Browser
|
|
390
|
-
],
|
|
391
|
-
[g, [f, "Android" + Te]],
|
|
392
|
-
[
|
|
393
|
-
/chrome\/([\w\.]+) mobile/i
|
|
394
|
-
// Chrome Mobile
|
|
395
|
-
],
|
|
396
|
-
[g, [f, pe + "Chrome"]],
|
|
397
|
-
[
|
|
398
|
-
/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i
|
|
399
|
-
// Chrome/OmniWeb/Arora/Tizen/Nokia
|
|
400
|
-
],
|
|
401
|
-
[f, g],
|
|
402
|
-
[
|
|
403
|
-
/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i
|
|
404
|
-
// Safari Mobile
|
|
405
|
-
],
|
|
406
|
-
[g, [f, pe + "Safari"]],
|
|
407
|
-
[
|
|
408
|
-
/iphone .*mobile(?:\/\w+ | ?)safari/i
|
|
409
|
-
],
|
|
410
|
-
[[f, pe + "Safari"]],
|
|
411
|
-
[
|
|
412
|
-
/version\/([\w\.\,]+) .*(safari)/i
|
|
413
|
-
// Safari
|
|
414
|
-
],
|
|
415
|
-
[g, f],
|
|
416
|
-
[
|
|
417
|
-
/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i
|
|
418
|
-
// Safari < 3.0
|
|
419
|
-
],
|
|
420
|
-
[f, [g, "1"]],
|
|
421
|
-
[
|
|
422
|
-
/(webkit|khtml)\/([\w\.]+)/i
|
|
423
|
-
],
|
|
424
|
-
[f, g],
|
|
425
|
-
[
|
|
426
|
-
// Gecko based
|
|
427
|
-
/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i
|
|
428
|
-
// Firefox Mobile
|
|
429
|
-
],
|
|
430
|
-
[[f, pe + ke], g],
|
|
431
|
-
[
|
|
432
|
-
/(navigator|netscape\d?)\/([-\w\.]+)/i
|
|
433
|
-
// Netscape
|
|
434
|
-
],
|
|
435
|
-
[[f, "Netscape"], g],
|
|
436
|
-
[
|
|
437
|
-
/(wolvic|librewolf)\/([\w\.]+)/i
|
|
438
|
-
// Wolvic/LibreWolf
|
|
439
|
-
],
|
|
440
|
-
[f, g],
|
|
441
|
-
[
|
|
442
|
-
/mobile vr; rv:([\w\.]+)\).+firefox/i
|
|
443
|
-
// Firefox Reality
|
|
444
|
-
],
|
|
445
|
-
[g, [f, ke + " Reality"]],
|
|
446
|
-
[
|
|
447
|
-
/ekiohf.+(flow)\/([\w\.]+)/i,
|
|
448
|
-
// Flow
|
|
449
|
-
/(swiftfox)/i,
|
|
450
|
-
// Swiftfox
|
|
451
|
-
/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,
|
|
452
|
-
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
|
|
453
|
-
/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|basilisk|waterfox)\/([-\w\.]+)$/i,
|
|
454
|
-
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
|
455
|
-
/(firefox)\/([\w\.]+)/i,
|
|
456
|
-
// Other Firefox-based
|
|
457
|
-
/(mozilla)\/([\w\.]+(?= .+rv\:.+gecko\/\d+)|[0-4][\w\.]+(?!.+compatible))/i,
|
|
458
|
-
// Mozilla
|
|
459
|
-
// Other
|
|
460
|
-
/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,
|
|
461
|
-
// Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser/Ladybird
|
|
462
|
-
/\b(links) \(([\w\.]+)/i
|
|
463
|
-
// Links
|
|
464
|
-
],
|
|
465
|
-
[f, [g, /_/g, "."]],
|
|
466
|
-
[
|
|
467
|
-
/(cobalt)\/([\w\.]+)/i
|
|
468
|
-
// Cobalt
|
|
469
|
-
],
|
|
470
|
-
[f, [g, /[^\d\.]+./, we]]
|
|
471
|
-
],
|
|
472
|
-
cpu: [
|
|
473
|
-
[
|
|
474
|
-
/\b((amd|x|x86[-_]?|wow|win)64)\b/i
|
|
475
|
-
// AMD64 (x64)
|
|
476
|
-
],
|
|
477
|
-
[[U, "amd64"]],
|
|
478
|
-
[
|
|
479
|
-
/(ia32(?=;))/i,
|
|
480
|
-
// IA32 (quicktime)
|
|
481
|
-
/\b((i[346]|x)86)(pc)?\b/i
|
|
482
|
-
// IA32 (x86)
|
|
483
|
-
],
|
|
484
|
-
[[U, "ia32"]],
|
|
485
|
-
[
|
|
486
|
-
/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i
|
|
487
|
-
// ARM64
|
|
488
|
-
],
|
|
489
|
-
[[U, "arm64"]],
|
|
490
|
-
[
|
|
491
|
-
/\b(arm(v[67])?ht?n?[fl]p?)\b/i
|
|
492
|
-
// ARMHF
|
|
493
|
-
],
|
|
494
|
-
[[U, "armhf"]],
|
|
495
|
-
[
|
|
496
|
-
// PocketPC mistakenly identified as PowerPC
|
|
497
|
-
/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i
|
|
498
|
-
],
|
|
499
|
-
[[U, "arm"]],
|
|
500
|
-
[
|
|
501
|
-
/ sun4\w[;\)]/i
|
|
502
|
-
// SPARC
|
|
503
|
-
],
|
|
504
|
-
[[U, "sparc"]],
|
|
505
|
-
[
|
|
506
|
-
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC
|
|
507
|
-
/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i,
|
|
508
|
-
/((ppc|powerpc)(64)?)( mac|;|\))/i,
|
|
509
|
-
// PowerPC
|
|
510
|
-
/(?:osf1|[freopnt]{3,4}bsd) (alpha)/i
|
|
511
|
-
// Alpha
|
|
512
|
-
],
|
|
513
|
-
[[U, /ower/, we, ie]],
|
|
514
|
-
[
|
|
515
|
-
/mc680.0/i
|
|
516
|
-
],
|
|
517
|
-
[[U, "68k"]],
|
|
518
|
-
[
|
|
519
|
-
/winnt.+\[axp/i
|
|
520
|
-
],
|
|
521
|
-
[[U, "alpha"]]
|
|
522
|
-
],
|
|
523
|
-
device: [
|
|
524
|
-
[
|
|
525
|
-
//////////////////////////
|
|
526
|
-
// MOBILES & TABLETS
|
|
527
|
-
/////////////////////////
|
|
528
|
-
// Samsung
|
|
529
|
-
/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i
|
|
530
|
-
],
|
|
531
|
-
[u, [h, Se], [c, R]],
|
|
532
|
-
[
|
|
533
|
-
/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,
|
|
534
|
-
/samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i,
|
|
535
|
-
/sec-(sgh\w+)/i
|
|
536
|
-
],
|
|
537
|
-
[u, [h, Se], [c, E]],
|
|
538
|
-
[
|
|
539
|
-
// Apple
|
|
540
|
-
/(?:\/|\()(ip(?:hone|od)[\w, ]*)[\/\);]/i
|
|
541
|
-
// iPod/iPhone
|
|
542
|
-
],
|
|
543
|
-
[u, [h, ge], [c, E]],
|
|
544
|
-
[
|
|
545
|
-
/\b(?:ios|apple\w+)\/.+[\(\/](ipad)/i,
|
|
546
|
-
// iPad
|
|
547
|
-
/\b(ipad)[\d,]*[;\] ].+(mac |i(pad)?)os/i
|
|
548
|
-
],
|
|
549
|
-
[u, [h, ge], [c, R]],
|
|
550
|
-
[
|
|
551
|
-
/(macintosh);/i
|
|
552
|
-
],
|
|
553
|
-
[u, [h, ge]],
|
|
554
|
-
[
|
|
555
|
-
// Sharp
|
|
556
|
-
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
|
|
557
|
-
],
|
|
558
|
-
[u, [h, Ht], [c, E]],
|
|
559
|
-
[
|
|
560
|
-
// Honor
|
|
561
|
-
/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i
|
|
562
|
-
],
|
|
563
|
-
[u, [h, zt], [c, R]],
|
|
564
|
-
[
|
|
565
|
-
/honor([-\w ]+)[;\)]/i
|
|
566
|
-
],
|
|
567
|
-
[u, [h, zt], [c, E]],
|
|
568
|
-
[
|
|
569
|
-
// Huawei
|
|
570
|
-
/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i
|
|
571
|
-
],
|
|
572
|
-
[u, [h, Ut], [c, R]],
|
|
573
|
-
[
|
|
574
|
-
/(?:huawei) ?([-\w ]+)[;\)]/i,
|
|
575
|
-
/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][\dc][adnt]?)\b(?!.+d\/s)/i
|
|
576
|
-
],
|
|
577
|
-
[u, [h, Ut], [c, E]],
|
|
578
|
-
[
|
|
579
|
-
// Xiaomi
|
|
580
|
-
/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,
|
|
581
|
-
/\b(?:xiao)?((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i
|
|
582
|
-
// Mi Pad tablets
|
|
583
|
-
],
|
|
584
|
-
[[u, /_/g, " "], [h, ct], [c, R]],
|
|
585
|
-
[
|
|
586
|
-
/\b; (\w+) build\/hm\1/i,
|
|
587
|
-
// Xiaomi Hongmi 'numeric' models
|
|
588
|
-
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,
|
|
589
|
-
// Xiaomi Hongmi
|
|
590
|
-
// Xiaomi Redmi / POCO / Black Shark / Qin
|
|
591
|
-
/oid[^\)]+; (redmi[\-_ ]?(?:note|k)?[\w_ ]+|m?[12]\d[01]\d\w{3,6}|poco[\w ]+|(shark )?\w{3}-[ah]0|qin ?[1-3](s\+|ultra| pro)?)( bui|; wv|\))/i,
|
|
592
|
-
// Xiaomi Mi
|
|
593
|
-
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note|max|cc)?[_ ]?(?:\d{0,2}\w?)[_ ]?(?:plus|se|lite|pro)?( 5g|lte)?)(?: bui|\))/i,
|
|
594
|
-
/ ([\w ]+) miui\/v?\d/i
|
|
595
|
-
],
|
|
596
|
-
[[u, /_/g, " "], [h, ct], [c, E]],
|
|
597
|
-
[
|
|
598
|
-
// OnePlus
|
|
599
|
-
/droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i,
|
|
600
|
-
/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i
|
|
601
|
-
],
|
|
602
|
-
[u, [h, Pt], [c, E]],
|
|
603
|
-
[
|
|
604
|
-
// OPPO
|
|
605
|
-
/; (\w+) bui.+ oppo/i,
|
|
606
|
-
/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i
|
|
607
|
-
],
|
|
608
|
-
[u, [h, lt], [c, E]],
|
|
609
|
-
[
|
|
610
|
-
/\b(opd2(\d{3}a?))(?: bui|\))/i
|
|
611
|
-
],
|
|
612
|
-
[u, [h, q, { OnePlus: ["203", "304", "403", "404", "413", "415"], "*": lt }], [c, R]],
|
|
613
|
-
[
|
|
614
|
-
// BLU
|
|
615
|
-
/(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i
|
|
616
|
-
// Vivo series
|
|
617
|
-
],
|
|
618
|
-
[u, [h, "BLU"], [c, E]],
|
|
619
|
-
[
|
|
620
|
-
// Vivo
|
|
621
|
-
/; vivo (\w+)(?: bui|\))/i,
|
|
622
|
-
/\b(v[12]\d{3}\w?[at])(?: bui|;)/i
|
|
623
|
-
],
|
|
624
|
-
[u, [h, "Vivo"], [c, E]],
|
|
625
|
-
[
|
|
626
|
-
// Realme
|
|
627
|
-
/\b(rmx[1-3]\d{3})(?: bui|;|\))/i
|
|
628
|
-
],
|
|
629
|
-
[u, [h, "Realme"], [c, E]],
|
|
630
|
-
[
|
|
631
|
-
// Lenovo
|
|
632
|
-
/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,
|
|
633
|
-
/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i
|
|
634
|
-
],
|
|
635
|
-
[u, [h, ot], [c, R]],
|
|
636
|
-
[
|
|
637
|
-
/lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i
|
|
638
|
-
],
|
|
639
|
-
[u, [h, ot], [c, E]],
|
|
640
|
-
[
|
|
641
|
-
// Motorola
|
|
642
|
-
/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,
|
|
643
|
-
/\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i,
|
|
644
|
-
/((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i
|
|
645
|
-
],
|
|
646
|
-
[u, [h, at], [c, E]],
|
|
647
|
-
[
|
|
648
|
-
/\b(mz60\d|xoom[2 ]{0,2}) build\//i
|
|
649
|
-
],
|
|
650
|
-
[u, [h, at], [c, R]],
|
|
651
|
-
[
|
|
652
|
-
// LG
|
|
653
|
-
/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i
|
|
654
|
-
],
|
|
655
|
-
[u, [h, $e], [c, R]],
|
|
656
|
-
[
|
|
657
|
-
/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,
|
|
658
|
-
/\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i,
|
|
659
|
-
/\blg-?([\d\w]+) bui/i
|
|
660
|
-
],
|
|
661
|
-
[u, [h, $e], [c, E]],
|
|
662
|
-
[
|
|
663
|
-
// Nokia
|
|
664
|
-
/(nokia) (t[12][01])/i
|
|
665
|
-
],
|
|
666
|
-
[h, u, [c, R]],
|
|
667
|
-
[
|
|
668
|
-
/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,
|
|
669
|
-
/nokia[-_ ]?(([-\w\. ]*?))( bui|\)|;|\/)/i
|
|
670
|
-
],
|
|
671
|
-
[[u, /_/g, " "], [c, E], [h, "Nokia"]],
|
|
672
|
-
[
|
|
673
|
-
// Google
|
|
674
|
-
/(pixel (c|tablet))\b/i
|
|
675
|
-
// Google Pixel C/Tablet
|
|
676
|
-
],
|
|
677
|
-
[u, [h, le], [c, R]],
|
|
678
|
-
[
|
|
679
|
-
// Google Pixel
|
|
680
|
-
/droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i
|
|
681
|
-
],
|
|
682
|
-
[u, [h, le], [c, E]],
|
|
683
|
-
[
|
|
684
|
-
/(google) (pixelbook( go)?)/i
|
|
685
|
-
],
|
|
686
|
-
[h, u],
|
|
687
|
-
[
|
|
688
|
-
// Sony
|
|
689
|
-
/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i
|
|
690
|
-
],
|
|
691
|
-
[u, [h, Ce], [c, E]],
|
|
692
|
-
[
|
|
693
|
-
/sony tablet [ps]/i,
|
|
694
|
-
/\b(?:sony)?sgp\w+(?: bui|\))/i
|
|
695
|
-
],
|
|
696
|
-
[[u, "Xperia Tablet"], [h, Ce], [c, R]],
|
|
697
|
-
[
|
|
698
|
-
// Amazon
|
|
699
|
-
/(alexa)webm/i,
|
|
700
|
-
/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,
|
|
701
|
-
// Kindle Fire without Silk / Echo Show
|
|
702
|
-
/(kf[a-z]+)( bui|\)).+silk\//i
|
|
703
|
-
// Kindle Fire HD
|
|
704
|
-
],
|
|
705
|
-
[u, [h, He], [c, R]],
|
|
706
|
-
[
|
|
707
|
-
/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i
|
|
708
|
-
// Fire Phone
|
|
709
|
-
],
|
|
710
|
-
[[u, /(.+)/g, "Fire Phone $1"], [h, He], [c, E]],
|
|
711
|
-
[
|
|
712
|
-
// BlackBerry
|
|
713
|
-
/(playbook);[-\w\),; ]+(rim)/i
|
|
714
|
-
// BlackBerry PlayBook
|
|
715
|
-
],
|
|
716
|
-
[u, h, [c, R]],
|
|
717
|
-
[
|
|
718
|
-
/\b((?:bb[a-f]|st[hv])100-\d)/i,
|
|
719
|
-
/(?:blackberry|\(bb10;) (\w+)/i
|
|
720
|
-
],
|
|
721
|
-
[u, [h, Lt], [c, E]],
|
|
722
|
-
[
|
|
723
|
-
// Asus
|
|
724
|
-
/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i
|
|
725
|
-
],
|
|
726
|
-
[u, [h, _t], [c, R]],
|
|
727
|
-
[
|
|
728
|
-
/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i
|
|
729
|
-
],
|
|
730
|
-
[u, [h, _t], [c, E]],
|
|
731
|
-
[
|
|
732
|
-
// HTC
|
|
733
|
-
/(nexus 9)/i
|
|
734
|
-
// HTC Nexus 9
|
|
735
|
-
],
|
|
736
|
-
[u, [h, "HTC"], [c, R]],
|
|
737
|
-
[
|
|
738
|
-
/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,
|
|
739
|
-
// HTC
|
|
740
|
-
// ZTE
|
|
741
|
-
/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,
|
|
742
|
-
/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i
|
|
743
|
-
// Alcatel/GeeksPhone/Nexian/Panasonic/Sony
|
|
744
|
-
],
|
|
745
|
-
[h, [u, /_/g, " "], [c, E]],
|
|
746
|
-
[
|
|
747
|
-
// TCL
|
|
748
|
-
/tcl (xess p17aa)/i,
|
|
749
|
-
/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i
|
|
750
|
-
],
|
|
751
|
-
[u, [h, "TCL"], [c, R]],
|
|
752
|
-
[
|
|
753
|
-
/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i
|
|
754
|
-
],
|
|
755
|
-
[u, [h, "TCL"], [c, E]],
|
|
756
|
-
[
|
|
757
|
-
// itel
|
|
758
|
-
/(itel) ((\w+))/i
|
|
759
|
-
],
|
|
760
|
-
[[h, ie], u, [c, q, { tablet: ["p10001l", "w7001"], "*": "mobile" }]],
|
|
761
|
-
[
|
|
762
|
-
// Acer
|
|
763
|
-
/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i
|
|
764
|
-
],
|
|
765
|
-
[u, [h, "Acer"], [c, R]],
|
|
766
|
-
[
|
|
767
|
-
// Meizu
|
|
768
|
-
/droid.+; (m[1-5] note) bui/i,
|
|
769
|
-
/\bmz-([-\w]{2,})/i
|
|
770
|
-
],
|
|
771
|
-
[u, [h, "Meizu"], [c, E]],
|
|
772
|
-
[
|
|
773
|
-
// Ulefone
|
|
774
|
-
/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i
|
|
775
|
-
],
|
|
776
|
-
[u, [h, "Ulefone"], [c, E]],
|
|
777
|
-
[
|
|
778
|
-
// Energizer
|
|
779
|
-
/; (energy ?\w+)(?: bui|\))/i,
|
|
780
|
-
/; energizer ([\w ]+)(?: bui|\))/i
|
|
781
|
-
],
|
|
782
|
-
[u, [h, "Energizer"], [c, E]],
|
|
783
|
-
[
|
|
784
|
-
// Cat
|
|
785
|
-
/; cat (b35);/i,
|
|
786
|
-
/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i
|
|
787
|
-
],
|
|
788
|
-
[u, [h, "Cat"], [c, E]],
|
|
789
|
-
[
|
|
790
|
-
// Smartfren
|
|
791
|
-
/((?:new )?andromax[\w- ]+)(?: bui|\))/i
|
|
792
|
-
],
|
|
793
|
-
[u, [h, "Smartfren"], [c, E]],
|
|
794
|
-
[
|
|
795
|
-
// Nothing
|
|
796
|
-
/droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i
|
|
797
|
-
],
|
|
798
|
-
[u, [h, "Nothing"], [c, E]],
|
|
799
|
-
[
|
|
800
|
-
// Archos
|
|
801
|
-
/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,
|
|
802
|
-
/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i
|
|
803
|
-
],
|
|
804
|
-
[u, [h, "Archos"], [c, R]],
|
|
805
|
-
[
|
|
806
|
-
/archos ([\w ]+)( b|\))/i,
|
|
807
|
-
/; (ac[3-6]\d\w{2,8})( b|\))/i
|
|
808
|
-
],
|
|
809
|
-
[u, [h, "Archos"], [c, E]],
|
|
810
|
-
[
|
|
811
|
-
// HMD
|
|
812
|
-
/; (n159v)/i
|
|
813
|
-
],
|
|
814
|
-
[u, [h, "HMD"], [c, E]],
|
|
815
|
-
[
|
|
816
|
-
// MIXED
|
|
817
|
-
/(imo) (tab \w+)/i,
|
|
818
|
-
// IMO
|
|
819
|
-
/(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i
|
|
820
|
-
// Infinix XPad / Tecno
|
|
821
|
-
],
|
|
822
|
-
[h, u, [c, R]],
|
|
823
|
-
[
|
|
824
|
-
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i,
|
|
825
|
-
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Tecno/Micromax/Advan
|
|
826
|
-
// BLU/HMD/IMO/Infinix/Lava/OnePlus/TCL/Wiko
|
|
827
|
-
/; (blu|hmd|imo|infinix|lava|oneplus|tcl|wiko)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i,
|
|
828
|
-
/(hp) ([\w ]+\w)/i,
|
|
829
|
-
// HP iPAQ
|
|
830
|
-
/(microsoft); (lumia[\w ]+)/i,
|
|
831
|
-
// Microsoft Lumia
|
|
832
|
-
/(oppo) ?([\w ]+) bui/i,
|
|
833
|
-
// OPPO
|
|
834
|
-
/(hisense) ([ehv][\w ]+)\)/i,
|
|
835
|
-
// Hisense
|
|
836
|
-
/droid[^;]+; (philips)[_ ]([sv-x][\d]{3,4}[xz]?)/i
|
|
837
|
-
// Philips
|
|
838
|
-
],
|
|
839
|
-
[h, u, [c, E]],
|
|
840
|
-
[
|
|
841
|
-
/(kobo)\s(ereader|touch)/i,
|
|
842
|
-
// Kobo
|
|
843
|
-
/(hp).+(touchpad(?!.+tablet)|tablet)/i,
|
|
844
|
-
// HP TouchPad
|
|
845
|
-
/(kindle)\/([\w\.]+)/i
|
|
846
|
-
// Kindle
|
|
847
|
-
],
|
|
848
|
-
[h, u, [c, R]],
|
|
849
|
-
[
|
|
850
|
-
/(surface duo)/i
|
|
851
|
-
// Surface Duo
|
|
852
|
-
],
|
|
853
|
-
[u, [h, st], [c, R]],
|
|
854
|
-
[
|
|
855
|
-
/droid [\d\.]+; (fp\du?)(?: b|\))/i
|
|
856
|
-
// Fairphone
|
|
857
|
-
],
|
|
858
|
-
[u, [h, "Fairphone"], [c, E]],
|
|
859
|
-
[
|
|
860
|
-
/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i
|
|
861
|
-
// Nvidia Tablets
|
|
862
|
-
],
|
|
863
|
-
[u, [h, Bt], [c, R]],
|
|
864
|
-
[
|
|
865
|
-
/(sprint) (\w+)/i
|
|
866
|
-
// Sprint Phones
|
|
867
|
-
],
|
|
868
|
-
[h, u, [c, E]],
|
|
869
|
-
[
|
|
870
|
-
/(kin\.[onetw]{3})/i
|
|
871
|
-
// Microsoft Kin
|
|
872
|
-
],
|
|
873
|
-
[[u, /\./g, " "], [h, st], [c, E]],
|
|
874
|
-
[
|
|
875
|
-
/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i
|
|
876
|
-
// Zebra
|
|
877
|
-
],
|
|
878
|
-
[u, [h, dt], [c, R]],
|
|
879
|
-
[
|
|
880
|
-
/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i
|
|
881
|
-
],
|
|
882
|
-
[u, [h, dt], [c, E]],
|
|
883
|
-
[
|
|
884
|
-
///////////////////
|
|
885
|
-
// SMARTTVS
|
|
886
|
-
///////////////////
|
|
887
|
-
/(philips)[\w ]+tv/i,
|
|
888
|
-
// Philips
|
|
889
|
-
/smart-tv.+(samsung)/i
|
|
890
|
-
// Samsung
|
|
891
|
-
],
|
|
892
|
-
[h, [c, D]],
|
|
893
|
-
[
|
|
894
|
-
/hbbtv.+maple;(\d+)/i
|
|
895
|
-
],
|
|
896
|
-
[[u, /^/, "SmartTV"], [h, Se], [c, D]],
|
|
897
|
-
[
|
|
898
|
-
/(vizio)(?: |.+model\/)(\w+-\w+)/i,
|
|
899
|
-
// Vizio
|
|
900
|
-
/tcast.+(lg)e?. ([-\w]+)/i
|
|
901
|
-
// LG SmartTV
|
|
902
|
-
],
|
|
903
|
-
[h, u, [c, D]],
|
|
904
|
-
[
|
|
905
|
-
/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i
|
|
906
|
-
],
|
|
907
|
-
[[h, $e], [c, D]],
|
|
908
|
-
[
|
|
909
|
-
/(apple) ?tv/i
|
|
910
|
-
// Apple TV
|
|
911
|
-
],
|
|
912
|
-
[h, [u, ge + " TV"], [c, D]],
|
|
913
|
-
[
|
|
914
|
-
/crkey.*devicetype\/chromecast/i
|
|
915
|
-
// Google Chromecast Third Generation
|
|
916
|
-
],
|
|
917
|
-
[[u, ne + " Third Generation"], [h, le], [c, D]],
|
|
918
|
-
[
|
|
919
|
-
/crkey.*devicetype\/([^/]*)/i
|
|
920
|
-
// Google Chromecast with specific device type
|
|
921
|
-
],
|
|
922
|
-
[[u, /^/, "Chromecast "], [h, le], [c, D]],
|
|
923
|
-
[
|
|
924
|
-
/fuchsia.*crkey/i
|
|
925
|
-
// Google Chromecast Nest Hub
|
|
926
|
-
],
|
|
927
|
-
[[u, ne + " Nest Hub"], [h, le], [c, D]],
|
|
928
|
-
[
|
|
929
|
-
/crkey/i
|
|
930
|
-
// Google Chromecast, Linux-based or unknown
|
|
931
|
-
],
|
|
932
|
-
[[u, ne], [h, le], [c, D]],
|
|
933
|
-
[
|
|
934
|
-
/(portaltv)/i
|
|
935
|
-
// Facebook Portal TV
|
|
936
|
-
],
|
|
937
|
-
[u, [h, ut], [c, D]],
|
|
938
|
-
[
|
|
939
|
-
/droid.+aft(\w+)( bui|\))/i
|
|
940
|
-
// Fire TV
|
|
941
|
-
],
|
|
942
|
-
[u, [h, He], [c, D]],
|
|
943
|
-
[
|
|
944
|
-
/(shield \w+ tv)/i
|
|
945
|
-
// Nvidia Shield TV
|
|
946
|
-
],
|
|
947
|
-
[u, [h, Bt], [c, D]],
|
|
948
|
-
[
|
|
949
|
-
/\(dtv[\);].+(aquos)/i,
|
|
950
|
-
/(aquos-tv[\w ]+)\)/i
|
|
951
|
-
// Sharp
|
|
952
|
-
],
|
|
953
|
-
[u, [h, Ht], [c, D]],
|
|
954
|
-
[
|
|
955
|
-
/(bravia[\w ]+)( bui|\))/i
|
|
956
|
-
// Sony
|
|
957
|
-
],
|
|
958
|
-
[u, [h, Ce], [c, D]],
|
|
959
|
-
[
|
|
960
|
-
/(mi(tv|box)-?\w+) bui/i
|
|
961
|
-
// Xiaomi
|
|
962
|
-
],
|
|
963
|
-
[u, [h, ct], [c, D]],
|
|
964
|
-
[
|
|
965
|
-
/Hbbtv.*(technisat) (.*);/i
|
|
966
|
-
// TechniSAT
|
|
967
|
-
],
|
|
968
|
-
[h, u, [c, D]],
|
|
969
|
-
[
|
|
970
|
-
/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,
|
|
971
|
-
// Roku
|
|
972
|
-
/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i
|
|
973
|
-
// HbbTV devices
|
|
974
|
-
],
|
|
975
|
-
[[h, /.+\/(\w+)/, "$1", q, { LG: "lge" }], [u, Xe], [c, D]],
|
|
976
|
-
[
|
|
977
|
-
///////////////////
|
|
978
|
-
// CONSOLES
|
|
979
|
-
///////////////////
|
|
980
|
-
/(playstation \w+)/i
|
|
981
|
-
// Playstation
|
|
982
|
-
],
|
|
983
|
-
[u, [h, Ce], [c, Ve]],
|
|
984
|
-
[
|
|
985
|
-
/\b(xbox(?: one)?(?!; xbox))[\); ]/i
|
|
986
|
-
// Microsoft Xbox
|
|
987
|
-
],
|
|
988
|
-
[u, [h, st], [c, Ve]],
|
|
989
|
-
[
|
|
990
|
-
/(ouya)/i,
|
|
991
|
-
// Ouya
|
|
992
|
-
/(nintendo) (\w+)/i,
|
|
993
|
-
// Nintendo
|
|
994
|
-
/(retroid) (pocket ([^\)]+))/i,
|
|
995
|
-
// Retroid Pocket
|
|
996
|
-
/(valve).+(steam deck)/i,
|
|
997
|
-
/droid.+; ((shield|rgcube|gr0006))( bui|\))/i
|
|
998
|
-
// Nvidia Portable/Anbernic/Logitech
|
|
999
|
-
],
|
|
1000
|
-
[[h, q, { Nvidia: "Shield", Anbernic: "RGCUBE", Logitech: "GR0006" }], u, [c, Ve]],
|
|
1001
|
-
[
|
|
1002
|
-
///////////////////
|
|
1003
|
-
// WEARABLES
|
|
1004
|
-
///////////////////
|
|
1005
|
-
/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i
|
|
1006
|
-
// Samsung Galaxy Watch
|
|
1007
|
-
],
|
|
1008
|
-
[u, [h, Se], [c, j]],
|
|
1009
|
-
[
|
|
1010
|
-
/((pebble))app/i,
|
|
1011
|
-
// Pebble
|
|
1012
|
-
/(asus|google|lg|oppo|xiaomi) ((pixel |zen)?watch[\w ]*)( bui|\))/i
|
|
1013
|
-
// Asus ZenWatch / LG Watch / Pixel Watch / Xiaomi Watch
|
|
1014
|
-
],
|
|
1015
|
-
[h, u, [c, j]],
|
|
1016
|
-
[
|
|
1017
|
-
/(ow(?:19|20)?we?[1-3]{1,3})/i
|
|
1018
|
-
// Oppo Watch
|
|
1019
|
-
],
|
|
1020
|
-
[u, [h, lt], [c, j]],
|
|
1021
|
-
[
|
|
1022
|
-
/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i
|
|
1023
|
-
// Apple Watch
|
|
1024
|
-
],
|
|
1025
|
-
[u, [h, ge], [c, j]],
|
|
1026
|
-
[
|
|
1027
|
-
/(opwwe\d{3})/i
|
|
1028
|
-
// OnePlus Watch
|
|
1029
|
-
],
|
|
1030
|
-
[u, [h, Pt], [c, j]],
|
|
1031
|
-
[
|
|
1032
|
-
/(moto 360)/i
|
|
1033
|
-
// Motorola 360
|
|
1034
|
-
],
|
|
1035
|
-
[u, [h, at], [c, j]],
|
|
1036
|
-
[
|
|
1037
|
-
/(smartwatch 3)/i
|
|
1038
|
-
// Sony SmartWatch
|
|
1039
|
-
],
|
|
1040
|
-
[u, [h, Ce], [c, j]],
|
|
1041
|
-
[
|
|
1042
|
-
/(g watch r)/i
|
|
1043
|
-
// LG G Watch R
|
|
1044
|
-
],
|
|
1045
|
-
[u, [h, $e], [c, j]],
|
|
1046
|
-
[
|
|
1047
|
-
/droid.+; (wt63?0{2,3})\)/i
|
|
1048
|
-
],
|
|
1049
|
-
[u, [h, dt], [c, j]],
|
|
1050
|
-
[
|
|
1051
|
-
///////////////////
|
|
1052
|
-
// XR
|
|
1053
|
-
///////////////////
|
|
1054
|
-
/droid.+; (glass) \d/i
|
|
1055
|
-
// Google Glass
|
|
1056
|
-
],
|
|
1057
|
-
[u, [h, le], [c, Pe]],
|
|
1058
|
-
[
|
|
1059
|
-
/(pico) ([\w ]+) os\d/i
|
|
1060
|
-
// Pico
|
|
1061
|
-
],
|
|
1062
|
-
[h, u, [c, Pe]],
|
|
1063
|
-
[
|
|
1064
|
-
/(quest( \d| pro)?s?).+vr/i
|
|
1065
|
-
// Meta Quest
|
|
1066
|
-
],
|
|
1067
|
-
[u, [h, ut], [c, Pe]],
|
|
1068
|
-
[
|
|
1069
|
-
/mobile vr; rv.+firefox/i
|
|
1070
|
-
// Unidentifiable VR device using Firefox Reality / Wolvic
|
|
1071
|
-
],
|
|
1072
|
-
[[c, Pe]],
|
|
1073
|
-
[
|
|
1074
|
-
///////////////////
|
|
1075
|
-
// EMBEDDED
|
|
1076
|
-
///////////////////
|
|
1077
|
-
/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i
|
|
1078
|
-
// Tesla
|
|
1079
|
-
],
|
|
1080
|
-
[h, [c, Re]],
|
|
1081
|
-
[
|
|
1082
|
-
/(aeobc)\b/i
|
|
1083
|
-
// Echo Dot
|
|
1084
|
-
],
|
|
1085
|
-
[u, [h, He], [c, Re]],
|
|
1086
|
-
[
|
|
1087
|
-
/(homepod).+mac os/i
|
|
1088
|
-
// Apple HomePod
|
|
1089
|
-
],
|
|
1090
|
-
[u, [h, ge], [c, Re]],
|
|
1091
|
-
[
|
|
1092
|
-
/windows iot/i
|
|
1093
|
-
// Unidentifiable embedded device using Windows IoT
|
|
1094
|
-
],
|
|
1095
|
-
[[c, Re]],
|
|
1096
|
-
[
|
|
1097
|
-
////////////////////
|
|
1098
|
-
// MIXED (GENERIC)
|
|
1099
|
-
///////////////////
|
|
1100
|
-
/droid.+; ([\w- ]+) (4k|android|smart|google)[- ]?tv/i
|
|
1101
|
-
// Unidentifiable SmartTV
|
|
1102
|
-
],
|
|
1103
|
-
[u, [c, D]],
|
|
1104
|
-
[
|
|
1105
|
-
/\b((4k|android|smart|opera)[- ]?tv|tv; rv:|large screen[\w ]+safari)\b/i
|
|
1106
|
-
],
|
|
1107
|
-
[[c, D]],
|
|
1108
|
-
[
|
|
1109
|
-
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew|; hmsc).+?(mobile|vr|\d) safari/i
|
|
1110
|
-
],
|
|
1111
|
-
[u, [c, q, { mobile: "Mobile", xr: "VR", "*": R }]],
|
|
1112
|
-
[
|
|
1113
|
-
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i
|
|
1114
|
-
// Unidentifiable Tablet
|
|
1115
|
-
],
|
|
1116
|
-
[[c, R]],
|
|
1117
|
-
[
|
|
1118
|
-
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i
|
|
1119
|
-
// Unidentifiable Mobile
|
|
1120
|
-
],
|
|
1121
|
-
[[c, E]],
|
|
1122
|
-
[
|
|
1123
|
-
/droid .+?; ([\w\. -]+)( bui|\))/i
|
|
1124
|
-
// Generic Android Device
|
|
1125
|
-
],
|
|
1126
|
-
[u, [h, "Generic"]]
|
|
1127
|
-
],
|
|
1128
|
-
engine: [
|
|
1129
|
-
[
|
|
1130
|
-
/windows.+ edge\/([\w\.]+)/i
|
|
1131
|
-
// EdgeHTML
|
|
1132
|
-
],
|
|
1133
|
-
[g, [f, je + "HTML"]],
|
|
1134
|
-
[
|
|
1135
|
-
/(arkweb)\/([\w\.]+)/i
|
|
1136
|
-
// ArkWeb
|
|
1137
|
-
],
|
|
1138
|
-
[f, g],
|
|
1139
|
-
[
|
|
1140
|
-
/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i
|
|
1141
|
-
// Blink
|
|
1142
|
-
],
|
|
1143
|
-
[g, [f, "Blink"]],
|
|
1144
|
-
[
|
|
1145
|
-
/(presto)\/([\w\.]+)/i,
|
|
1146
|
-
// Presto
|
|
1147
|
-
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,
|
|
1148
|
-
// WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna/Servo
|
|
1149
|
-
/ekioh(flow)\/([\w\.]+)/i,
|
|
1150
|
-
// Flow
|
|
1151
|
-
/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,
|
|
1152
|
-
// KHTML/Tasman/Links
|
|
1153
|
-
/(icab)[\/ ]([23]\.[\d\.]+)/i,
|
|
1154
|
-
// iCab
|
|
1155
|
-
/\b(libweb)/i
|
|
1156
|
-
// LibWeb
|
|
1157
|
-
],
|
|
1158
|
-
[f, g],
|
|
1159
|
-
[
|
|
1160
|
-
/ladybird\//i
|
|
1161
|
-
],
|
|
1162
|
-
[[f, "LibWeb"]],
|
|
1163
|
-
[
|
|
1164
|
-
/rv\:([\w\.]{1,9})\b.+(gecko)/i
|
|
1165
|
-
// Gecko
|
|
1166
|
-
],
|
|
1167
|
-
[g, f]
|
|
1168
|
-
],
|
|
1169
|
-
os: [
|
|
1170
|
-
[
|
|
1171
|
-
// Windows
|
|
1172
|
-
/(windows nt) (6\.[23]); arm/i
|
|
1173
|
-
// Windows RT
|
|
1174
|
-
],
|
|
1175
|
-
[[f, /N/, "R"], [g, q, Vt]],
|
|
1176
|
-
[
|
|
1177
|
-
/(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i,
|
|
1178
|
-
// Windows IoT/Mobile/Phone
|
|
1179
|
-
// Windows NT/3.1/95/98/ME/2000/XP/Vista/7/8/8.1/10/11
|
|
1180
|
-
/(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i
|
|
1181
|
-
],
|
|
1182
|
-
[f, g],
|
|
1183
|
-
[
|
|
1184
|
-
/windows nt ?([\d\.\)]*)(?!.+xbox)/i,
|
|
1185
|
-
/\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i
|
|
1186
|
-
],
|
|
1187
|
-
[[g, /(;|\))/g, "", q, Vt], [f, pt]],
|
|
1188
|
-
[
|
|
1189
|
-
/(windows ce)\/?([\d\.]*)/i
|
|
1190
|
-
// Windows CE
|
|
1191
|
-
],
|
|
1192
|
-
[f, g],
|
|
1193
|
-
[
|
|
1194
|
-
// iOS/macOS
|
|
1195
|
-
/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,
|
|
1196
|
-
// iOS
|
|
1197
|
-
/(?:ios;fbsv|ios(?=.+ip(?:ad|hone)|.+apple ?tv)|ip(?:ad|hone)(?: |.+i(?:pad)?)os|apple ?tv.+ios)[\/ ]([\w\.]+)/i,
|
|
1198
|
-
/\btvos ?([\w\.]+)/i,
|
|
1199
|
-
/cfnetwork\/.+darwin/i
|
|
1200
|
-
],
|
|
1201
|
-
[[g, /_/g, "."], [f, "iOS"]],
|
|
1202
|
-
[
|
|
1203
|
-
/(mac os x) ?([\w\. ]*)/i,
|
|
1204
|
-
/(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i
|
|
1205
|
-
// Mac OS
|
|
1206
|
-
],
|
|
1207
|
-
[[f, "macOS"], [g, /_/g, "."]],
|
|
1208
|
-
[
|
|
1209
|
-
// Google Chromecast
|
|
1210
|
-
/android ([\d\.]+).*crkey/i
|
|
1211
|
-
// Google Chromecast, Android-based
|
|
1212
|
-
],
|
|
1213
|
-
[g, [f, ne + " Android"]],
|
|
1214
|
-
[
|
|
1215
|
-
/fuchsia.*crkey\/([\d\.]+)/i
|
|
1216
|
-
// Google Chromecast, Fuchsia-based
|
|
1217
|
-
],
|
|
1218
|
-
[g, [f, ne + " Fuchsia"]],
|
|
1219
|
-
[
|
|
1220
|
-
/crkey\/([\d\.]+).*devicetype\/smartspeaker/i
|
|
1221
|
-
// Google Chromecast, Linux-based Smart Speaker
|
|
1222
|
-
],
|
|
1223
|
-
[g, [f, ne + " SmartSpeaker"]],
|
|
1224
|
-
[
|
|
1225
|
-
/linux.*crkey\/([\d\.]+)/i
|
|
1226
|
-
// Google Chromecast, Legacy Linux-based
|
|
1227
|
-
],
|
|
1228
|
-
[g, [f, ne + " Linux"]],
|
|
1229
|
-
[
|
|
1230
|
-
/crkey\/([\d\.]+)/i
|
|
1231
|
-
// Google Chromecast, unknown
|
|
1232
|
-
],
|
|
1233
|
-
[g, [f, ne]],
|
|
1234
|
-
[
|
|
1235
|
-
// Mobile OSes
|
|
1236
|
-
/droid ([\w\.]+)\b.+(android[- ]x86)/i
|
|
1237
|
-
// Android-x86
|
|
1238
|
-
],
|
|
1239
|
-
[g, f],
|
|
1240
|
-
[
|
|
1241
|
-
/(ubuntu) ([\w\.]+) like android/i
|
|
1242
|
-
// Ubuntu Touch
|
|
1243
|
-
],
|
|
1244
|
-
[[f, /(.+)/, "$1 Touch"], g],
|
|
1245
|
-
[
|
|
1246
|
-
/(harmonyos)[\/ ]?([\d\.]*)/i,
|
|
1247
|
-
// HarmonyOS
|
|
1248
|
-
// Android/Blackberry/WebOS/QNX/Bada/RIM/KaiOS/Maemo/MeeGo/S40/Sailfish OS/OpenHarmony/Tizen
|
|
1249
|
-
/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i
|
|
1250
|
-
],
|
|
1251
|
-
[f, g],
|
|
1252
|
-
[
|
|
1253
|
-
/\(bb(10);/i
|
|
1254
|
-
// BlackBerry 10
|
|
1255
|
-
],
|
|
1256
|
-
[g, [f, Lt]],
|
|
1257
|
-
[
|
|
1258
|
-
/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i
|
|
1259
|
-
// Symbian
|
|
1260
|
-
],
|
|
1261
|
-
[g, [f, "Symbian"]],
|
|
1262
|
-
[
|
|
1263
|
-
/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i
|
|
1264
|
-
// Firefox OS
|
|
1265
|
-
],
|
|
1266
|
-
[g, [f, ke + " OS"]],
|
|
1267
|
-
[
|
|
1268
|
-
/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i,
|
|
1269
|
-
// WebOS
|
|
1270
|
-
/webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i
|
|
1271
|
-
],
|
|
1272
|
-
[g, [f, "webOS"]],
|
|
1273
|
-
[
|
|
1274
|
-
/web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i
|
|
1275
|
-
// https://webostv.developer.lge.com/develop/specifications/web-api-and-web-engine
|
|
1276
|
-
],
|
|
1277
|
-
[[g, q, { 25: "120", 24: "108", 23: "94", 22: "87", 6: "79", 5: "68", 4: "53", 3: "38", 2: "538", 1: "537", "*": "TV" }], [f, "webOS"]],
|
|
1278
|
-
[
|
|
1279
|
-
/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i
|
|
1280
|
-
// watchOS
|
|
1281
|
-
],
|
|
1282
|
-
[g, [f, "watchOS"]],
|
|
1283
|
-
[
|
|
1284
|
-
// Google ChromeOS
|
|
1285
|
-
/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i
|
|
1286
|
-
// Chromium OS
|
|
1287
|
-
],
|
|
1288
|
-
[[f, "Chrome OS"], g],
|
|
1289
|
-
[
|
|
1290
|
-
// Smart TVs
|
|
1291
|
-
/panasonic;(viera)/i,
|
|
1292
|
-
// Panasonic Viera
|
|
1293
|
-
/(netrange)mmh/i,
|
|
1294
|
-
// Netrange
|
|
1295
|
-
/(nettv)\/(\d+\.[\w\.]+)/i,
|
|
1296
|
-
// NetTV
|
|
1297
|
-
// Console
|
|
1298
|
-
/(nintendo|playstation) (\w+)/i,
|
|
1299
|
-
// Nintendo/Playstation
|
|
1300
|
-
/(xbox); +xbox ([^\);]+)/i,
|
|
1301
|
-
// Microsoft Xbox (360, One, X, S, Series X, Series S)
|
|
1302
|
-
/(pico) .+os([\w\.]+)/i,
|
|
1303
|
-
// Pico
|
|
1304
|
-
// Other
|
|
1305
|
-
/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,
|
|
1306
|
-
// Joli/Palm
|
|
1307
|
-
/linux.+(mint)[\/\(\) ]?([\w\.]*)/i,
|
|
1308
|
-
// Mint
|
|
1309
|
-
/(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i,
|
|
1310
|
-
// Mageia/VectorLinux/Fuchsia/ArcaOS/Arch
|
|
1311
|
-
/([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,
|
|
1312
|
-
// Ubuntu/Debian/SUSE/Gentoo/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire/Knoppix
|
|
1313
|
-
/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,
|
|
1314
|
-
// Solaris
|
|
1315
|
-
/\b(aix)[; ]([1-9\.]{0,4})/i,
|
|
1316
|
-
// AIX
|
|
1317
|
-
/(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i,
|
|
1318
|
-
// Hurd/Linux/MorphOS
|
|
1319
|
-
/(gnu) ?([\w\.]*)/i,
|
|
1320
|
-
// GNU
|
|
1321
|
-
/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,
|
|
1322
|
-
// FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly
|
|
1323
|
-
/(haiku) ?(r\d)?/i
|
|
1324
|
-
// Haiku
|
|
1325
|
-
],
|
|
1326
|
-
[f, g],
|
|
1327
|
-
[
|
|
1328
|
-
/(sunos) ?([\d\.]*)/i
|
|
1329
|
-
// Solaris
|
|
1330
|
-
],
|
|
1331
|
-
[[f, "Solaris"], g],
|
|
1332
|
-
[
|
|
1333
|
-
/\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i,
|
|
1334
|
-
// BeOS/OS2/AmigaOS/OpenVMS/HP-UX/SerenityOS
|
|
1335
|
-
/(unix) ?([\w\.]*)/i
|
|
1336
|
-
// UNIX
|
|
1337
|
-
],
|
|
1338
|
-
[f, g]
|
|
1339
|
-
]
|
|
1340
|
-
}, We = (function() {
|
|
1341
|
-
var e = { init: {}, isIgnore: {}, isIgnoreRgx: {}, toString: {} };
|
|
1342
|
-
return K.call(e.init, [
|
|
1343
|
-
[P, [f, g, Ne, c]],
|
|
1344
|
-
[Z, [U]],
|
|
1345
|
-
[G, [c, u, h]],
|
|
1346
|
-
[V, [f, g]],
|
|
1347
|
-
[$, [f, g]]
|
|
1348
|
-
]), K.call(e.isIgnore, [
|
|
1349
|
-
[P, [g, Ne]],
|
|
1350
|
-
[V, [g]],
|
|
1351
|
-
[$, [g]]
|
|
1352
|
-
]), K.call(e.isIgnoreRgx, [
|
|
1353
|
-
[P, / ?browser$/i],
|
|
1354
|
-
[$, / ?os$/i]
|
|
1355
|
-
]), K.call(e.toString, [
|
|
1356
|
-
[P, [f, g]],
|
|
1357
|
-
[Z, [U]],
|
|
1358
|
-
[G, [h, u]],
|
|
1359
|
-
[V, [f, g]],
|
|
1360
|
-
[$, [f, g]]
|
|
1361
|
-
]), e;
|
|
1362
|
-
})(), Qn = function(e, t) {
|
|
1363
|
-
var n = We.init[t], i = We.isIgnore[t] || 0, a = We.isIgnoreRgx[t] || 0, o = We.toString[t] || 0;
|
|
1364
|
-
function r() {
|
|
1365
|
-
K.call(this, n);
|
|
1366
|
-
}
|
|
1367
|
-
return r.prototype.getItem = function() {
|
|
1368
|
-
return e;
|
|
1369
|
-
}, r.prototype.withClientHints = function() {
|
|
1370
|
-
return de ? de.getHighEntropyValues(sn).then(function(s) {
|
|
1371
|
-
return e.setCH(new an(s, !1)).parseCH().get();
|
|
1372
|
-
}) : e.parseCH().get();
|
|
1373
|
-
}, r.prototype.withFeatureCheck = function() {
|
|
1374
|
-
return e.detectFeature().get();
|
|
1375
|
-
}, t != be && (r.prototype.is = function(s) {
|
|
1376
|
-
var d = !1;
|
|
1377
|
-
for (var p in this)
|
|
1378
|
-
if (this.hasOwnProperty(p) && !mt(i, p) && ie(a ? xe(a, this[p]) : this[p]) == ie(a ? xe(a, s) : s)) {
|
|
1379
|
-
if (d = !0, s != O.UNDEFINED) break;
|
|
1380
|
-
} else if (s == O.UNDEFINED && d) {
|
|
1381
|
-
d = !d;
|
|
1382
|
-
break;
|
|
1383
|
-
}
|
|
1384
|
-
return d;
|
|
1385
|
-
}, r.prototype.toString = function() {
|
|
1386
|
-
var s = we;
|
|
1387
|
-
for (var d in o)
|
|
1388
|
-
typeof this[o[d]] !== O.UNDEFINED && (s += (s ? " " : we) + this[o[d]]);
|
|
1389
|
-
return s || O.UNDEFINED;
|
|
1390
|
-
}), r.prototype.then = function(s) {
|
|
1391
|
-
var d = this, p = function() {
|
|
1392
|
-
for (var m in d)
|
|
1393
|
-
d.hasOwnProperty(m) && (this[m] = d[m]);
|
|
1394
|
-
};
|
|
1395
|
-
p.prototype = {
|
|
1396
|
-
is: r.prototype.is,
|
|
1397
|
-
toString: r.prototype.toString,
|
|
1398
|
-
withClientHints: r.prototype.withClientHints,
|
|
1399
|
-
withFeatureCheck: r.prototype.withFeatureCheck
|
|
1400
|
-
};
|
|
1401
|
-
var l = new p();
|
|
1402
|
-
return s(l), l;
|
|
1403
|
-
}, new r();
|
|
1404
|
-
};
|
|
1405
|
-
function an(e, t) {
|
|
1406
|
-
if (e = e || {}, K.call(this, sn), t)
|
|
1407
|
-
K.call(this, [
|
|
1408
|
-
[xt, ft(e[se])],
|
|
1409
|
-
[vt, ft(e[Hn])],
|
|
1410
|
-
[E, /\?1/.test(e[Vn])],
|
|
1411
|
-
[u, Ie(e[jn])],
|
|
1412
|
-
[ye, Ie(e[on])],
|
|
1413
|
-
[St, Ie(e[Gn])],
|
|
1414
|
-
[U, Ie(e[$n])],
|
|
1415
|
-
[ce, ft(e[qn])],
|
|
1416
|
-
[Je, Ie(e[Wn])]
|
|
1417
|
-
]);
|
|
1418
|
-
else
|
|
1419
|
-
for (var n in e)
|
|
1420
|
-
this.hasOwnProperty(n) && typeof e[n] !== O.UNDEFINED && (this[n] = e[n]);
|
|
1421
|
-
}
|
|
1422
|
-
function re(e, t, n, i) {
|
|
1423
|
-
return K.call(this, [
|
|
1424
|
-
["itemType", e],
|
|
1425
|
-
["ua", t],
|
|
1426
|
-
["uaCH", i],
|
|
1427
|
-
["rgxMap", n],
|
|
1428
|
-
["data", Qn(this, e)]
|
|
1429
|
-
]), this;
|
|
1430
|
-
}
|
|
1431
|
-
re.prototype.get = function(e) {
|
|
1432
|
-
return e ? this.data.hasOwnProperty(e) ? this.data[e] : void 0 : this.data;
|
|
1433
|
-
};
|
|
1434
|
-
re.prototype.set = function(e, t) {
|
|
1435
|
-
return this.data[e] = t, this;
|
|
1436
|
-
};
|
|
1437
|
-
re.prototype.setCH = function(e) {
|
|
1438
|
-
return this.uaCH = e, this;
|
|
1439
|
-
};
|
|
1440
|
-
re.prototype.detectFeature = function() {
|
|
1441
|
-
if (B && B.userAgent == this.ua)
|
|
1442
|
-
switch (this.itemType) {
|
|
1443
|
-
case P:
|
|
1444
|
-
B.brave && typeof B.brave.isBrave == O.FUNCTION && this.set(f, "Brave");
|
|
1445
|
-
break;
|
|
1446
|
-
case G:
|
|
1447
|
-
!this.get(c) && de && de[E] && this.set(c, E), this.get(u) == "Macintosh" && B && typeof B.standalone !== O.UNDEFINED && B.maxTouchPoints && B.maxTouchPoints > 2 && this.set(u, "iPad").set(c, R);
|
|
1448
|
-
break;
|
|
1449
|
-
case $:
|
|
1450
|
-
!this.get(f) && de && de[ye] && this.set(f, de[ye]);
|
|
1451
|
-
break;
|
|
1452
|
-
case be:
|
|
1453
|
-
var e = this.data, t = function(n) {
|
|
1454
|
-
return e[n].getItem().detectFeature().get();
|
|
1455
|
-
};
|
|
1456
|
-
this.set(P, t(P)).set(Z, t(Z)).set(G, t(G)).set(V, t(V)).set($, t($));
|
|
1457
|
-
}
|
|
1458
|
-
return this;
|
|
1459
|
-
};
|
|
1460
|
-
re.prototype.parseUA = function() {
|
|
1461
|
-
switch (this.itemType != be && bt.call(this.data, this.ua, this.rgxMap), this.itemType) {
|
|
1462
|
-
case P:
|
|
1463
|
-
this.set(Ne, wt(this.get(g)));
|
|
1464
|
-
break;
|
|
1465
|
-
case $:
|
|
1466
|
-
if (this.get(f) == "iOS" && this.get(g) == "18.6") {
|
|
1467
|
-
var e = /\) Version\/([\d\.]+)/.exec(this.ua);
|
|
1468
|
-
e && parseInt(e[1].substring(0, 2), 10) >= 26 && this.set(g, e[1]);
|
|
1469
|
-
}
|
|
1470
|
-
break;
|
|
1471
|
-
}
|
|
1472
|
-
return this;
|
|
1473
|
-
};
|
|
1474
|
-
re.prototype.parseCH = function() {
|
|
1475
|
-
var e = this.uaCH, t = this.rgxMap;
|
|
1476
|
-
switch (this.itemType) {
|
|
1477
|
-
case P:
|
|
1478
|
-
case V:
|
|
1479
|
-
var n = e[vt] || e[xt], i;
|
|
1480
|
-
if (n)
|
|
1481
|
-
for (var a = 0; a < n.length; a++) {
|
|
1482
|
-
var o = n[a].brand || n[a], r = n[a].version;
|
|
1483
|
-
this.itemType == P && !/not.a.brand/i.test(o) && (!i || /Chrom/.test(i) && o != Wt || i == je && /WebView2/.test(o)) && (o = q(o, Jn), i = this.get(f), i && !/Chrom/.test(i) && /Chrom/.test(o) || this.set(f, o).set(g, r).set(Ne, wt(r)), i = o), this.itemType == V && o == Wt && this.set(g, r);
|
|
1484
|
-
}
|
|
1485
|
-
break;
|
|
1486
|
-
case Z:
|
|
1487
|
-
var s = e[U];
|
|
1488
|
-
s && (s && e[Je] == "64" && (s += "64"), bt.call(this.data, s + ";", t));
|
|
1489
|
-
break;
|
|
1490
|
-
case G:
|
|
1491
|
-
if (e[E] && this.set(c, E), e[u] && (this.set(u, e[u]), !this.get(c) || !this.get(h))) {
|
|
1492
|
-
var d = {};
|
|
1493
|
-
bt.call(d, "droid 9; " + e[u] + ")", t), !this.get(c) && d.type && this.set(c, d.type), !this.get(h) && d.vendor && this.set(h, d.vendor);
|
|
1494
|
-
}
|
|
1495
|
-
if (e[ce]) {
|
|
1496
|
-
var p;
|
|
1497
|
-
if (typeof e[ce] != "string")
|
|
1498
|
-
for (var l = 0; !p && l < e[ce].length; )
|
|
1499
|
-
p = q(e[ce][l++], jt);
|
|
1500
|
-
else
|
|
1501
|
-
p = q(e[ce], jt);
|
|
1502
|
-
this.set(c, p);
|
|
1503
|
-
}
|
|
1504
|
-
break;
|
|
1505
|
-
case $:
|
|
1506
|
-
var m = e[ye];
|
|
1507
|
-
if (m) {
|
|
1508
|
-
var b = e[St];
|
|
1509
|
-
m == pt && (b = parseInt(wt(b), 10) >= 13 ? "11" : "10"), this.set(f, m).set(g, b);
|
|
1510
|
-
}
|
|
1511
|
-
this.get(f) == pt && e[u] == "Xbox" && this.set(f, "Xbox").set(g, void 0);
|
|
1512
|
-
break;
|
|
1513
|
-
case be:
|
|
1514
|
-
var v = this.data, S = function(w) {
|
|
1515
|
-
return v[w].getItem().setCH(e).parseCH().get();
|
|
1516
|
-
};
|
|
1517
|
-
this.set(P, S(P)).set(Z, S(Z)).set(G, S(G)).set(V, S(V)).set($, S($));
|
|
1518
|
-
}
|
|
1519
|
-
return this;
|
|
1520
|
-
};
|
|
1521
|
-
function ee(e, t, n) {
|
|
1522
|
-
if (typeof e === O.OBJECT ? (Ge(e, !0) ? (typeof t === O.OBJECT && (n = t), t = e) : (n = e, t = void 0), e = void 0) : typeof e === O.STRING && !Ge(t, !0) && (n = t, t = void 0), n)
|
|
1523
|
-
if (typeof n.append === O.FUNCTION) {
|
|
1524
|
-
var i = {};
|
|
1525
|
-
n.forEach(function(l, m) {
|
|
1526
|
-
i[String(m).toLowerCase()] = l;
|
|
1527
|
-
}), n = i;
|
|
1528
|
-
} else {
|
|
1529
|
-
var a = {};
|
|
1530
|
-
for (var o in n)
|
|
1531
|
-
n.hasOwnProperty(o) && (a[String(o).toLowerCase()] = n[o]);
|
|
1532
|
-
n = a;
|
|
1533
|
-
}
|
|
1534
|
-
if (!(this instanceof ee))
|
|
1535
|
-
return new ee(e, t, n).getResult();
|
|
1536
|
-
var r = typeof e === O.STRING ? e : (
|
|
1537
|
-
// Passed user-agent string
|
|
1538
|
-
n && n[Dt] ? n[Dt] : (
|
|
1539
|
-
// User-Agent from passed headers
|
|
1540
|
-
B && B.userAgent ? B.userAgent : (
|
|
1541
|
-
// navigator.userAgent
|
|
1542
|
-
we
|
|
1543
|
-
)
|
|
1544
|
-
)
|
|
1545
|
-
), s = new an(n, !0), d = t ? Yn(Gt, t) : Gt, p = function(l) {
|
|
1546
|
-
return l == be ? function() {
|
|
1547
|
-
return new re(l, r, d, s).set("ua", r).set(P, this.getBrowser()).set(Z, this.getCPU()).set(G, this.getDevice()).set(V, this.getEngine()).set($, this.getOS()).get();
|
|
1548
|
-
} : function() {
|
|
1549
|
-
return new re(l, r, d[l], s).parseUA().get();
|
|
1550
|
-
};
|
|
1551
|
-
};
|
|
1552
|
-
return K.call(this, [
|
|
1553
|
-
["getBrowser", p(P)],
|
|
1554
|
-
["getCPU", p(Z)],
|
|
1555
|
-
["getDevice", p(G)],
|
|
1556
|
-
["getEngine", p(V)],
|
|
1557
|
-
["getOS", p($)],
|
|
1558
|
-
["getResult", p(be)],
|
|
1559
|
-
["getUA", function() {
|
|
1560
|
-
return r;
|
|
1561
|
-
}],
|
|
1562
|
-
["setUA", function(l) {
|
|
1563
|
-
return Fe(l) && (r = Xe(l, Pn)), this;
|
|
1564
|
-
}]
|
|
1565
|
-
]).setUA(r), this;
|
|
1566
|
-
}
|
|
1567
|
-
ee.VERSION = Bn;
|
|
1568
|
-
ee.BROWSER = Qe([f, g, Ne, c]);
|
|
1569
|
-
ee.CPU = Qe([U]);
|
|
1570
|
-
ee.DEVICE = Qe([u, h, c, Ve, E, D, R, j, Re]);
|
|
1571
|
-
ee.ENGINE = ee.OS = Qe([f, g]);
|
|
1572
|
-
const Kn = () => {
|
|
1573
|
-
const t = new ee().getResult();
|
|
1574
|
-
return {
|
|
1575
|
-
os: t.os.name || "unknown",
|
|
1576
|
-
osVersion: t.os.version || "unknown",
|
|
1577
|
-
browser: t.browser.name || "unknown",
|
|
1578
|
-
browserVersion: t.browser.version || "unknown",
|
|
1579
|
-
deviceType: t.device.type || "desktop"
|
|
1580
|
-
// Default to desktop if empty (common for desktop browsers)
|
|
1581
|
-
};
|
|
1582
|
-
};
|
|
1583
|
-
function Zn() {
|
|
1584
|
-
const e = navigator.userAgent.toLowerCase(), t = /iphone|ipod|android.*mobile/.test(e), n = /ipad|android(?!.*mobile)/.test(e), a = (navigator.deviceMemory || 4) < 4;
|
|
1585
|
-
return t ? {
|
|
1586
|
-
maxCanvasSize: 4096,
|
|
1587
|
-
recommendedScale: a ? 0.8 : 1,
|
|
1588
|
-
recommendedQuality: a ? 0.7 : 0.8,
|
|
1589
|
-
chunkSize: 30,
|
|
1590
|
-
yieldInterval: 16,
|
|
1591
|
-
// ~60fps
|
|
1592
|
-
maxTimeout: 5e3
|
|
1593
|
-
} : n ? {
|
|
1594
|
-
maxCanvasSize: 8192,
|
|
1595
|
-
recommendedScale: 1,
|
|
1596
|
-
recommendedQuality: 0.85,
|
|
1597
|
-
chunkSize: 50,
|
|
1598
|
-
yieldInterval: 16,
|
|
1599
|
-
maxTimeout: 4e3
|
|
1600
|
-
} : {
|
|
1601
|
-
maxCanvasSize: 16384,
|
|
1602
|
-
recommendedScale: 1,
|
|
1603
|
-
recommendedQuality: 0.9,
|
|
1604
|
-
chunkSize: 100,
|
|
1605
|
-
yieldInterval: 8,
|
|
1606
|
-
maxTimeout: 3e3
|
|
1607
|
-
};
|
|
1608
|
-
}
|
|
1609
|
-
function ei() {
|
|
1610
|
-
return {
|
|
1611
|
-
objectUrls: [],
|
|
1612
|
-
tempCanvases: []
|
|
1613
|
-
};
|
|
1614
|
-
}
|
|
1615
|
-
function ti(e) {
|
|
1616
|
-
e.objectUrls.forEach((t) => {
|
|
1617
|
-
try {
|
|
1618
|
-
URL.revokeObjectURL(t);
|
|
1619
|
-
} catch {
|
|
1620
|
-
console.warn("[Screenshot] Failed to revoke URL:", t);
|
|
1621
|
-
}
|
|
1622
|
-
}), e.tempCanvases.forEach((t) => {
|
|
1623
|
-
const n = t.getContext("2d");
|
|
1624
|
-
n && n.clearRect(0, 0, t.width, t.height), t.width = 0, t.height = 0;
|
|
1625
|
-
}), e.objectUrls.length = 0, e.tempCanvases.length = 0;
|
|
1626
|
-
}
|
|
1627
|
-
function ni(e, t) {
|
|
1628
|
-
const n = e ? e.x : 0, i = e ? e.y : 0, a = e ? e.width : window.innerWidth, o = e ? e.height : window.innerHeight;
|
|
1629
|
-
return {
|
|
1630
|
-
left: n - t,
|
|
1631
|
-
top: i - t,
|
|
1632
|
-
right: n + a + t,
|
|
1633
|
-
bottom: i + o + t
|
|
1634
|
-
};
|
|
1635
|
-
}
|
|
1636
|
-
function ii(e, t) {
|
|
1637
|
-
const n = e.getBoundingClientRect();
|
|
1638
|
-
return !(n.bottom < t.top || n.top > t.bottom || n.right < t.left || n.left > t.right || n.width === 0 || n.height === 0);
|
|
1639
|
-
}
|
|
1640
|
-
function ri(e) {
|
|
1641
|
-
return Array.from(document.body.getElementsByTagName("*")).filter((n) => {
|
|
1642
|
-
if (!(n instanceof HTMLElement)) return !1;
|
|
1643
|
-
const i = n.tagName;
|
|
1644
|
-
return ["SCRIPT", "STYLE", "LINK", "IFRAME", "NOSCRIPT"].includes(i) ? !1 : i === "HTML" || i === "BODY" ? !0 : ii(n, e);
|
|
1645
|
-
});
|
|
1646
|
-
}
|
|
1647
|
-
function oi(e) {
|
|
1648
|
-
const t = e.getElementsByTagName("*"), n = e.getElementsByTagName("img"), i = e.getElementsByTagName("svg"), a = t.length, o = n.length, r = i.length, s = a > 1e3 || o > 50 || r > 10;
|
|
1649
|
-
return { nodeCount: a, imageCount: o, svgCount: r, isComplex: s };
|
|
1650
|
-
}
|
|
1651
|
-
function qe() {
|
|
1652
|
-
return new Promise((e) => {
|
|
1653
|
-
"scheduler" in window && "yield" in window.scheduler ? window.scheduler.yield().then(e) : setTimeout(e, 0);
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
function si(e, t, n) {
|
|
1657
|
-
return new Promise((i, a) => {
|
|
1658
|
-
const o = setTimeout(() => {
|
|
1659
|
-
a(new Error("Image load timeout"));
|
|
1660
|
-
}, n);
|
|
1661
|
-
e.onload = () => {
|
|
1662
|
-
clearTimeout(o), i();
|
|
1663
|
-
}, e.onerror = () => {
|
|
1664
|
-
clearTimeout(o), a(new Error("Image load error"));
|
|
1665
|
-
}, e.src = t;
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
|
-
async function ai(e, t) {
|
|
1669
|
-
const n = e.getBoundingClientRect(), i = window.getComputedStyle(e), a = n.left, o = n.top, r = n.width, s = n.height, d = i.backgroundColor;
|
|
1670
|
-
d && d !== "transparent" && d !== "rgba(0, 0, 0, 0)" && (t.fillStyle = d, t.fillRect(a, o, r, s));
|
|
1671
|
-
const p = parseFloat(i.borderWidth) || 0;
|
|
1672
|
-
if (p > 0) {
|
|
1673
|
-
const l = i.borderColor;
|
|
1674
|
-
l && l !== "transparent" && (t.strokeStyle = l, t.lineWidth = p, t.strokeRect(a, o, r, s));
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
async function li(e, t) {
|
|
1678
|
-
for (const n of e)
|
|
1679
|
-
n instanceof HTMLElement && await ai(n, t);
|
|
1680
|
-
}
|
|
1681
|
-
async function ci(e, t, n, i, a, o) {
|
|
1682
|
-
try {
|
|
1683
|
-
const r = new Image();
|
|
1684
|
-
return r.crossOrigin = "anonymous", await si(r, e.src, 3e3), t.drawImage(r, n, i, a, o), { success: !0, method: "canvas" };
|
|
1685
|
-
} catch (r) {
|
|
1686
|
-
return {
|
|
1687
|
-
success: !1,
|
|
1688
|
-
error: r instanceof Error ? r.message : "Canvas render failed"
|
|
1689
|
-
};
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
function di(e, t, n, i, a) {
|
|
1693
|
-
return e.fillStyle = "#f0f0f0", e.fillRect(t, n, i, a), e.strokeStyle = "#ccc", e.lineWidth = 1, e.strokeRect(t, n, i, a), e.fillStyle = "#999", e.font = "12px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Image", t + i / 2, n + a / 2), { success: !0, method: "placeholder" };
|
|
1694
|
-
}
|
|
1695
|
-
function ui(e, t) {
|
|
1696
|
-
return e < 5 || t < 5;
|
|
1697
|
-
}
|
|
1698
|
-
async function fi(e, t) {
|
|
1699
|
-
const n = e.getBoundingClientRect(), i = n.left, a = n.top, o = n.width, r = n.height;
|
|
1700
|
-
if (ui(o, r))
|
|
1701
|
-
return { success: !0, method: "skip" };
|
|
1702
|
-
const s = await ci(e, t, i, a, o, r);
|
|
1703
|
-
return s.success ? s : di(t, i, a, o, r);
|
|
1704
|
-
}
|
|
1705
|
-
async function hi(e, t, n) {
|
|
1706
|
-
for (let i = 0; i < e.length; i++)
|
|
1707
|
-
await fi(e[i], t), n && n(i + 1, e.length);
|
|
1708
|
-
}
|
|
1709
|
-
function gi(e) {
|
|
1710
|
-
const t = [];
|
|
1711
|
-
for (const n of e)
|
|
1712
|
-
n instanceof HTMLImageElement && n.src && t.push(n);
|
|
1713
|
-
return t;
|
|
1714
|
-
}
|
|
1715
|
-
function pi(e) {
|
|
1716
|
-
let n = new XMLSerializer().serializeToString(e);
|
|
1717
|
-
return n.includes("xmlns=") || (n = n.replace(
|
|
1718
|
-
"<svg",
|
|
1719
|
-
'<svg xmlns="http://www.w3.org/2000/svg"'
|
|
1720
|
-
)), n;
|
|
1721
|
-
}
|
|
1722
|
-
async function mi(e, t) {
|
|
1723
|
-
try {
|
|
1724
|
-
const n = e.getBoundingClientRect(), i = n.left, a = n.top, o = n.width, r = n.height;
|
|
1725
|
-
if (o < 1 || r < 1)
|
|
1726
|
-
return { success: !0 };
|
|
1727
|
-
const s = pi(e), d = new Blob([s], { type: "image/svg+xml;charset=utf-8" }), p = URL.createObjectURL(d);
|
|
1728
|
-
try {
|
|
1729
|
-
const l = new Image();
|
|
1730
|
-
return await new Promise((m, b) => {
|
|
1731
|
-
l.onload = () => m(), l.onerror = () => b(new Error("SVG image load failed")), l.src = p;
|
|
1732
|
-
}), t.drawImage(l, i, a, o, r), { success: !0 };
|
|
1733
|
-
} finally {
|
|
1734
|
-
URL.revokeObjectURL(p);
|
|
1735
|
-
}
|
|
1736
|
-
} catch (n) {
|
|
1737
|
-
return {
|
|
1738
|
-
success: !1,
|
|
1739
|
-
error: n instanceof Error ? n.message : "SVG render failed"
|
|
1740
|
-
};
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
async function wi(e, t, n) {
|
|
1744
|
-
for (let i = 0; i < e.length; i++)
|
|
1745
|
-
await mi(e[i], t), n && n(i + 1, e.length);
|
|
1746
|
-
}
|
|
1747
|
-
function bi(e) {
|
|
1748
|
-
return e.classList.contains("MathJax") || e.classList.contains("MathJax_Display") || e.classList.contains("MJX-TeXAtom-ORD") || e.hasAttribute("data-mathml");
|
|
1749
|
-
}
|
|
1750
|
-
function yi(e) {
|
|
1751
|
-
const t = [];
|
|
1752
|
-
for (const n of e)
|
|
1753
|
-
n instanceof SVGElement && t.push(n);
|
|
1754
|
-
return t;
|
|
1755
|
-
}
|
|
1756
|
-
function xi(e) {
|
|
1757
|
-
return e.filter((t) => bi(t));
|
|
1758
|
-
}
|
|
1759
|
-
async function vi(e, t) {
|
|
1760
|
-
try {
|
|
1761
|
-
const n = e.getBoundingClientRect(), i = n.left, a = n.top, o = n.width, r = n.height;
|
|
1762
|
-
if (o < 1 || r < 1)
|
|
1763
|
-
return { success: !0 };
|
|
1764
|
-
const s = window.getComputedStyle(e), d = e.cloneNode(!0), p = [
|
|
1765
|
-
"color",
|
|
1766
|
-
"font-family",
|
|
1767
|
-
"font-size",
|
|
1768
|
-
"font-weight",
|
|
1769
|
-
"font-style",
|
|
1770
|
-
"line-height",
|
|
1771
|
-
"text-align",
|
|
1772
|
-
"text-decoration",
|
|
1773
|
-
"text-transform",
|
|
1774
|
-
"letter-spacing",
|
|
1775
|
-
"word-spacing",
|
|
1776
|
-
"white-space",
|
|
1777
|
-
"padding",
|
|
1778
|
-
"margin",
|
|
1779
|
-
"display",
|
|
1780
|
-
"flex-direction",
|
|
1781
|
-
"align-items",
|
|
1782
|
-
"justify-content"
|
|
1783
|
-
];
|
|
1784
|
-
let l = "";
|
|
1785
|
-
p.forEach((S) => {
|
|
1786
|
-
const w = s.getPropertyValue(S);
|
|
1787
|
-
w && (l += `${S}: ${w}; `);
|
|
1788
|
-
}), d.setAttribute("style", l);
|
|
1789
|
-
const m = `
|
|
1790
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${r}">
|
|
1791
|
-
<foreignObject width="100%" height="100%">
|
|
1792
|
-
<div xmlns="http://www.w3.org/1999/xhtml" style="width: ${o}px; height: ${r}px; overflow: hidden;">
|
|
1793
|
-
${d.outerHTML}
|
|
1794
|
-
</div>
|
|
1795
|
-
</foreignObject>
|
|
1796
|
-
</svg>
|
|
1797
|
-
`, b = new Blob([m], { type: "image/svg+xml;charset=utf-8" }), v = URL.createObjectURL(b);
|
|
1798
|
-
try {
|
|
1799
|
-
const S = new Image();
|
|
1800
|
-
return await new Promise((w, k) => {
|
|
1801
|
-
const y = setTimeout(() => {
|
|
1802
|
-
k(new Error("Text element render timeout"));
|
|
1803
|
-
}, 1e3);
|
|
1804
|
-
S.onload = () => {
|
|
1805
|
-
clearTimeout(y), w();
|
|
1806
|
-
}, S.onerror = () => {
|
|
1807
|
-
clearTimeout(y), k(new Error("Text element image load failed"));
|
|
1808
|
-
}, S.src = v;
|
|
1809
|
-
}), t.drawImage(S, i, a, o, r), { success: !0 };
|
|
1810
|
-
} finally {
|
|
1811
|
-
URL.revokeObjectURL(v);
|
|
1812
|
-
}
|
|
1813
|
-
} catch (n) {
|
|
1814
|
-
return console.warn("[TextRenderer] Failed to render text element:", n), {
|
|
1815
|
-
success: !1,
|
|
1816
|
-
error: n instanceof Error ? n.message : "Text render failed"
|
|
1817
|
-
};
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
function Si(e) {
|
|
1821
|
-
const t = window.getComputedStyle(e);
|
|
1822
|
-
if (t.display === "none" || t.visibility === "hidden")
|
|
1823
|
-
return !1;
|
|
1824
|
-
const n = e.textContent?.trim();
|
|
1825
|
-
return !(!n || n.length === 0);
|
|
1826
|
-
}
|
|
1827
|
-
function Ci(e) {
|
|
1828
|
-
const t = [];
|
|
1829
|
-
for (const n of e) {
|
|
1830
|
-
if (!(n instanceof HTMLElement)) continue;
|
|
1831
|
-
const i = n.tagName;
|
|
1832
|
-
if (["IMG", "SVG", "CANVAS", "VIDEO", "IFRAME", "SCRIPT", "STYLE", "NOSCRIPT"].includes(i))
|
|
1833
|
-
continue;
|
|
1834
|
-
[
|
|
1835
|
-
"P",
|
|
1836
|
-
"SPAN",
|
|
1837
|
-
"DIV",
|
|
1838
|
-
"A",
|
|
1839
|
-
"BUTTON",
|
|
1840
|
-
"LABEL",
|
|
1841
|
-
"LI",
|
|
1842
|
-
"H1",
|
|
1843
|
-
"H2",
|
|
1844
|
-
"H3",
|
|
1845
|
-
"H4",
|
|
1846
|
-
"H5",
|
|
1847
|
-
"H6",
|
|
1848
|
-
"TD",
|
|
1849
|
-
"TH",
|
|
1850
|
-
"STRONG",
|
|
1851
|
-
"EM",
|
|
1852
|
-
"B",
|
|
1853
|
-
"I",
|
|
1854
|
-
"U",
|
|
1855
|
-
"CODE",
|
|
1856
|
-
"PRE",
|
|
1857
|
-
"BLOCKQUOTE"
|
|
1858
|
-
].includes(i) && Si(n) && (Array.from(n.children).some((r) => {
|
|
1859
|
-
const s = r.tagName;
|
|
1860
|
-
return ["DIV", "P", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "TABLE"].includes(s);
|
|
1861
|
-
}) || t.push(n));
|
|
1862
|
-
}
|
|
1863
|
-
return t;
|
|
1864
|
-
}
|
|
1865
|
-
async function ki(e, t, n) {
|
|
1866
|
-
const i = Ci(e);
|
|
1867
|
-
console.log("[TextRenderer] Rendering", i.length, "text elements");
|
|
1868
|
-
for (let a = 0; a < i.length; a++) {
|
|
1869
|
-
const o = await vi(i[a], t);
|
|
1870
|
-
o.success || console.warn("[TextRenderer] Failed to render element:", i[a], o.error);
|
|
1871
|
-
}
|
|
1872
|
-
}
|
|
1873
|
-
async function Ei(e, t, n) {
|
|
1874
|
-
const i = ei();
|
|
1875
|
-
try {
|
|
1876
|
-
const a = Zn(), o = t.quality ?? a.recommendedQuality, r = t.scale ?? a.recommendedScale, s = t.includeMathJax ?? !0;
|
|
1877
|
-
n?.({
|
|
1878
|
-
phase: "analyzing",
|
|
1879
|
-
progress: 10,
|
|
1880
|
-
message: "Analyzing DOM structure..."
|
|
1881
|
-
});
|
|
1882
|
-
const d = document.documentElement, p = oi(d);
|
|
1883
|
-
console.log("[Canvas] DOM complexity:", p);
|
|
1884
|
-
let l = o;
|
|
1885
|
-
p.isComplex && (l = Math.max(0.6, o - 0.1), console.log("[Canvas] Complex DOM detected, reducing quality to", l));
|
|
1886
|
-
const m = e ? e.x : 0, b = e ? e.y : 0, v = e ? e.width : window.innerWidth, S = e ? e.height : window.innerHeight;
|
|
1887
|
-
let w = r;
|
|
1888
|
-
(v * w > a.maxCanvasSize || S * w > a.maxCanvasSize) && (console.warn("[Canvas] Size exceeds device limits, reducing scale"), w = Math.min(
|
|
1889
|
-
a.maxCanvasSize / v,
|
|
1890
|
-
a.maxCanvasSize / S,
|
|
1891
|
-
w
|
|
1892
|
-
));
|
|
1893
|
-
const k = document.createElement("canvas");
|
|
1894
|
-
k.width = v * w, k.height = S * w, i.tempCanvases.push(k);
|
|
1895
|
-
const y = k.getContext("2d", {
|
|
1896
|
-
alpha: !1,
|
|
1897
|
-
willReadFrequently: !1
|
|
1898
|
-
});
|
|
1899
|
-
if (!y)
|
|
1900
|
-
throw new Error("Failed to get canvas context");
|
|
1901
|
-
y.scale(w, w), y.fillStyle = "#ffffff", y.fillRect(0, 0, v, S), n?.({
|
|
1902
|
-
phase: "analyzing",
|
|
1903
|
-
progress: 20,
|
|
1904
|
-
message: "Collecting visible elements..."
|
|
1905
|
-
});
|
|
1906
|
-
const I = ni(
|
|
1907
|
-
e,
|
|
1908
|
-
a.maxCanvasSize > 8192 ? 500 : 300
|
|
1909
|
-
// Buffer based on device
|
|
1910
|
-
), T = ri(I);
|
|
1911
|
-
console.log("[Canvas] Visible elements:", T.length);
|
|
1912
|
-
const M = gi(T), L = yi(T), H = s ? xi(T) : [];
|
|
1913
|
-
console.log("[Canvas] Images:", M.length, "SVGs:", L.length, "MathJax:", H.length), n?.({
|
|
1914
|
-
phase: "rendering",
|
|
1915
|
-
progress: 30,
|
|
1916
|
-
message: "Rendering backgrounds..."
|
|
1917
|
-
}), y.translate(-m, -b), await li(T, y), await qe(), n?.({
|
|
1918
|
-
phase: "rendering",
|
|
1919
|
-
progress: 50,
|
|
1920
|
-
message: `Rendering ${M.length} images...`
|
|
1921
|
-
}), await hi(M, y, (_, W) => {
|
|
1922
|
-
const te = 50 + Math.round(_ / W * 30);
|
|
1923
|
-
n?.({
|
|
1924
|
-
phase: "rendering",
|
|
1925
|
-
progress: te,
|
|
1926
|
-
message: `Rendering images (${_}/${W})...`
|
|
1927
|
-
});
|
|
1928
|
-
}), await qe(), n?.({
|
|
1929
|
-
phase: "rendering",
|
|
1930
|
-
progress: 80,
|
|
1931
|
-
message: `Rendering ${L.length} SVG elements...`
|
|
1932
|
-
}), await wi(L, y, (_, W) => {
|
|
1933
|
-
const te = 80 + Math.round(_ / W * 10);
|
|
1934
|
-
n?.({
|
|
1935
|
-
phase: "rendering",
|
|
1936
|
-
progress: te,
|
|
1937
|
-
message: `Rendering SVG (${_}/${W})...`
|
|
1938
|
-
});
|
|
1939
|
-
}), await qe(), n?.({
|
|
1940
|
-
phase: "rendering",
|
|
1941
|
-
progress: 90,
|
|
1942
|
-
message: "Rendering text content..."
|
|
1943
|
-
}), await ki(T, y, (_, W) => {
|
|
1944
|
-
const te = 90 + Math.round(_ / W * 5);
|
|
1945
|
-
n?.({
|
|
1946
|
-
phase: "rendering",
|
|
1947
|
-
progress: te,
|
|
1948
|
-
message: `Rendering text (${_}/${W})...`
|
|
1949
|
-
});
|
|
1950
|
-
}), await qe(), n?.({
|
|
1951
|
-
phase: "exporting",
|
|
1952
|
-
progress: 95,
|
|
1953
|
-
message: "Exporting canvas to image..."
|
|
1954
|
-
});
|
|
1955
|
-
const Y = k.toDataURL("image/png", l);
|
|
1956
|
-
return n?.({
|
|
1957
|
-
phase: "exporting",
|
|
1958
|
-
progress: 100,
|
|
1959
|
-
message: "Capture complete"
|
|
1960
|
-
}), console.log("[Canvas] Capture successful"), Y;
|
|
1961
|
-
} catch (a) {
|
|
1962
|
-
return console.error("[Canvas] Capture failed:", a), null;
|
|
1963
|
-
} finally {
|
|
1964
|
-
ti(i);
|
|
1965
|
-
}
|
|
1966
|
-
}
|
|
1967
|
-
function Ti(e, t) {
|
|
1968
|
-
return e[13] = 1, e[14] = t >> 8, e[15] = t & 255, e[16] = t >> 8, e[17] = t & 255, e;
|
|
1969
|
-
}
|
|
1970
|
-
const ln = 112, cn = 72, dn = 89, un = 115;
|
|
1971
|
-
let ht;
|
|
1972
|
-
function Ii() {
|
|
1973
|
-
const e = new Int32Array(256);
|
|
1974
|
-
for (let t = 0; t < 256; t++) {
|
|
1975
|
-
let n = t;
|
|
1976
|
-
for (let i = 0; i < 8; i++)
|
|
1977
|
-
n = n & 1 ? 3988292384 ^ n >>> 1 : n >>> 1;
|
|
1978
|
-
e[t] = n;
|
|
1979
|
-
}
|
|
1980
|
-
return e;
|
|
1981
|
-
}
|
|
1982
|
-
function Ai(e) {
|
|
1983
|
-
let t = -1;
|
|
1984
|
-
ht || (ht = Ii());
|
|
1985
|
-
for (let n = 0; n < e.length; n++)
|
|
1986
|
-
t = ht[(t ^ e[n]) & 255] ^ t >>> 8;
|
|
1987
|
-
return t ^ -1;
|
|
1988
|
-
}
|
|
1989
|
-
function Ri(e) {
|
|
1990
|
-
const t = e.length - 1;
|
|
1991
|
-
for (let n = t; n >= 4; n--)
|
|
1992
|
-
if (e[n - 4] === 9 && e[n - 3] === ln && e[n - 2] === cn && e[n - 1] === dn && e[n] === un)
|
|
1993
|
-
return n - 3;
|
|
1994
|
-
return 0;
|
|
1995
|
-
}
|
|
1996
|
-
function Ni(e, t, n = !1) {
|
|
1997
|
-
const i = new Uint8Array(13);
|
|
1998
|
-
t *= 39.3701, i[0] = ln, i[1] = cn, i[2] = dn, i[3] = un, i[4] = t >>> 24, i[5] = t >>> 16, i[6] = t >>> 8, i[7] = t & 255, i[8] = i[4], i[9] = i[5], i[10] = i[6], i[11] = i[7], i[12] = 1;
|
|
1999
|
-
const a = Ai(i), o = new Uint8Array(4);
|
|
2000
|
-
if (o[0] = a >>> 24, o[1] = a >>> 16, o[2] = a >>> 8, o[3] = a & 255, n) {
|
|
2001
|
-
const r = Ri(e);
|
|
2002
|
-
return e.set(i, r), e.set(o, r + 13), e;
|
|
2003
|
-
} else {
|
|
2004
|
-
const r = new Uint8Array(4);
|
|
2005
|
-
r[0] = 0, r[1] = 0, r[2] = 0, r[3] = 9;
|
|
2006
|
-
const s = new Uint8Array(54);
|
|
2007
|
-
return s.set(e, 0), s.set(r, 33), s.set(i, 37), s.set(o, 50), s;
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
const Mi = "AAlwSFlz", Oi = "AAAJcEhZ", Di = "AAAACXBI";
|
|
2011
|
-
function Fi(e) {
|
|
2012
|
-
let t = e.indexOf(Mi);
|
|
2013
|
-
return t === -1 && (t = e.indexOf(Oi)), t === -1 && (t = e.indexOf(Di)), t;
|
|
2014
|
-
}
|
|
2015
|
-
const fn = "[modern-screenshot]", oe = typeof window < "u", _i = oe && "Worker" in window, Li = oe && "atob" in window, Ui = oe && "btoa" in window, Ct = oe ? window.navigator?.userAgent : "", hn = Ct.includes("Chrome"), Ye = Ct.includes("AppleWebKit") && !hn, kt = Ct.includes("Firefox"), zi = (e) => e && "__CONTEXT__" in e, Bi = (e) => e.constructor.name === "CSSFontFaceRule", Pi = (e) => e.constructor.name === "CSSImportRule", X = (e) => e.nodeType === 1, _e = (e) => typeof e.className == "object", gn = (e) => e.tagName === "image", Hi = (e) => e.tagName === "use", Me = (e) => X(e) && typeof e.style < "u" && !_e(e), $i = (e) => e.nodeType === 8, Wi = (e) => e.nodeType === 3, ve = (e) => e.tagName === "IMG", Ke = (e) => e.tagName === "VIDEO", qi = (e) => e.tagName === "CANVAS", Vi = (e) => e.tagName === "TEXTAREA", ji = (e) => e.tagName === "INPUT", Gi = (e) => e.tagName === "STYLE", Xi = (e) => e.tagName === "SCRIPT", Yi = (e) => e.tagName === "SELECT", Ji = (e) => e.tagName === "SLOT", Qi = (e) => e.tagName === "IFRAME", Ki = (...e) => console.warn(fn, ...e);
|
|
2016
|
-
function Zi(e) {
|
|
2017
|
-
const t = e?.createElement?.("canvas");
|
|
2018
|
-
return t && (t.height = t.width = 1), !!t && "toDataURL" in t && !!t.toDataURL("image/webp").includes("image/webp");
|
|
2019
|
-
}
|
|
2020
|
-
const yt = (e) => e.startsWith("data:");
|
|
2021
|
-
function pn(e, t) {
|
|
2022
|
-
if (e.match(/^[a-z]+:\/\//i))
|
|
2023
|
-
return e;
|
|
2024
|
-
if (oe && e.match(/^\/\//))
|
|
2025
|
-
return window.location.protocol + e;
|
|
2026
|
-
if (e.match(/^[a-z]+:/i) || !oe)
|
|
2027
|
-
return e;
|
|
2028
|
-
const n = Ze().implementation.createHTMLDocument(), i = n.createElement("base"), a = n.createElement("a");
|
|
2029
|
-
return n.head.appendChild(i), n.body.appendChild(a), t && (i.href = t), a.href = e, a.href;
|
|
2030
|
-
}
|
|
2031
|
-
function Ze(e) {
|
|
2032
|
-
return (e && X(e) ? e?.ownerDocument : e) ?? window.document;
|
|
2033
|
-
}
|
|
2034
|
-
const et = "http://www.w3.org/2000/svg";
|
|
2035
|
-
function er(e, t, n) {
|
|
2036
|
-
const i = Ze(n).createElementNS(et, "svg");
|
|
2037
|
-
return i.setAttributeNS(null, "width", e.toString()), i.setAttributeNS(null, "height", t.toString()), i.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), i;
|
|
2038
|
-
}
|
|
2039
|
-
function tr(e, t) {
|
|
2040
|
-
let n = new XMLSerializer().serializeToString(e);
|
|
2041
|
-
return t && (n = n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
|
|
2042
|
-
}
|
|
2043
|
-
function nr(e, t) {
|
|
2044
|
-
return new Promise((n, i) => {
|
|
2045
|
-
const a = new FileReader();
|
|
2046
|
-
a.onload = () => n(a.result), a.onerror = () => i(a.error), a.onabort = () => i(new Error(`Failed read blob to ${t}`)), a.readAsDataURL(e);
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2049
|
-
const ir = (e) => nr(e, "dataUrl");
|
|
2050
|
-
function me(e, t) {
|
|
2051
|
-
const n = Ze(t).createElement("img");
|
|
2052
|
-
return n.decoding = "sync", n.loading = "eager", n.src = e, n;
|
|
2053
|
-
}
|
|
2054
|
-
function Oe(e, t) {
|
|
2055
|
-
return new Promise((n) => {
|
|
2056
|
-
const { timeout: i, ownerDocument: a, onError: o, onWarn: r } = t ?? {}, s = typeof e == "string" ? me(e, Ze(a)) : e;
|
|
2057
|
-
let d = null, p = null;
|
|
2058
|
-
function l() {
|
|
2059
|
-
n(s), d && clearTimeout(d), p?.();
|
|
2060
|
-
}
|
|
2061
|
-
if (i && (d = setTimeout(l, i)), Ke(s)) {
|
|
2062
|
-
const m = s.currentSrc || s.src;
|
|
2063
|
-
if (!m)
|
|
2064
|
-
return s.poster ? Oe(s.poster, t).then(n) : l();
|
|
2065
|
-
if (s.readyState >= 2)
|
|
2066
|
-
return l();
|
|
2067
|
-
const b = l, v = (S) => {
|
|
2068
|
-
r?.(
|
|
2069
|
-
"Failed video load",
|
|
2070
|
-
m,
|
|
2071
|
-
S
|
|
2072
|
-
), o?.(S), l();
|
|
2073
|
-
};
|
|
2074
|
-
p = () => {
|
|
2075
|
-
s.removeEventListener("loadeddata", b), s.removeEventListener("error", v);
|
|
2076
|
-
}, s.addEventListener("loadeddata", b, { once: !0 }), s.addEventListener("error", v, { once: !0 });
|
|
2077
|
-
} else {
|
|
2078
|
-
const m = gn(s) ? s.href.baseVal : s.currentSrc || s.src;
|
|
2079
|
-
if (!m)
|
|
2080
|
-
return l();
|
|
2081
|
-
const b = async () => {
|
|
2082
|
-
if (ve(s) && "decode" in s)
|
|
2083
|
-
try {
|
|
2084
|
-
await s.decode();
|
|
2085
|
-
} catch (S) {
|
|
2086
|
-
r?.(
|
|
2087
|
-
"Failed to decode image, trying to render anyway",
|
|
2088
|
-
s.dataset.originalSrc || m,
|
|
2089
|
-
S
|
|
2090
|
-
);
|
|
2091
|
-
}
|
|
2092
|
-
l();
|
|
2093
|
-
}, v = (S) => {
|
|
2094
|
-
r?.(
|
|
2095
|
-
"Failed image load",
|
|
2096
|
-
s.dataset.originalSrc || m,
|
|
2097
|
-
S
|
|
2098
|
-
), l();
|
|
2099
|
-
};
|
|
2100
|
-
if (ve(s) && s.complete)
|
|
2101
|
-
return b();
|
|
2102
|
-
p = () => {
|
|
2103
|
-
s.removeEventListener("load", b), s.removeEventListener("error", v);
|
|
2104
|
-
}, s.addEventListener("load", b, { once: !0 }), s.addEventListener("error", v, { once: !0 });
|
|
2105
|
-
}
|
|
2106
|
-
});
|
|
2107
|
-
}
|
|
2108
|
-
async function rr(e, t) {
|
|
2109
|
-
Me(e) && (ve(e) || Ke(e) ? await Oe(e, t) : await Promise.all(
|
|
2110
|
-
["img", "video"].flatMap((n) => Array.from(e.querySelectorAll(n)).map((i) => Oe(i, t)))
|
|
2111
|
-
));
|
|
2112
|
-
}
|
|
2113
|
-
const mn = /* @__PURE__ */ (function() {
|
|
2114
|
-
let t = 0;
|
|
2115
|
-
const n = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
|
|
2116
|
-
return () => (t += 1, `u${n()}${t}`);
|
|
2117
|
-
})();
|
|
2118
|
-
function wn(e) {
|
|
2119
|
-
return e?.split(",").map((t) => t.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
|
|
2120
|
-
}
|
|
2121
|
-
let Xt = 0;
|
|
2122
|
-
function or(e) {
|
|
2123
|
-
const t = `${fn}[#${Xt}]`;
|
|
2124
|
-
return Xt++, {
|
|
2125
|
-
// eslint-disable-next-line no-console
|
|
2126
|
-
time: (n) => e && console.time(`${t} ${n}`),
|
|
2127
|
-
// eslint-disable-next-line no-console
|
|
2128
|
-
timeEnd: (n) => e && console.timeEnd(`${t} ${n}`),
|
|
2129
|
-
warn: (...n) => e && Ki(...n)
|
|
2130
|
-
};
|
|
2131
|
-
}
|
|
2132
|
-
function sr(e) {
|
|
2133
|
-
return {
|
|
2134
|
-
cache: e ? "no-cache" : "force-cache"
|
|
2135
|
-
};
|
|
2136
|
-
}
|
|
2137
|
-
async function tt(e, t) {
|
|
2138
|
-
return zi(e) ? e : ar(e, { ...t, autoDestruct: !0 });
|
|
2139
|
-
}
|
|
2140
|
-
async function ar(e, t) {
|
|
2141
|
-
const { scale: n = 1, workerUrl: i, workerNumber: a = 1 } = t || {}, o = !!t?.debug, r = t?.features ?? !0, s = e.ownerDocument ?? (oe ? window.document : void 0), d = e.ownerDocument?.defaultView ?? (oe ? window : void 0), p = /* @__PURE__ */ new Map(), l = {
|
|
2142
|
-
// Options
|
|
2143
|
-
width: 0,
|
|
2144
|
-
height: 0,
|
|
2145
|
-
quality: 1,
|
|
2146
|
-
type: "image/png",
|
|
2147
|
-
scale: n,
|
|
2148
|
-
backgroundColor: null,
|
|
2149
|
-
style: null,
|
|
2150
|
-
filter: null,
|
|
2151
|
-
maximumCanvasSize: 0,
|
|
2152
|
-
timeout: 3e4,
|
|
2153
|
-
progress: null,
|
|
2154
|
-
debug: o,
|
|
2155
|
-
fetch: {
|
|
2156
|
-
requestInit: sr(t?.fetch?.bypassingCache),
|
|
2157
|
-
placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
2158
|
-
bypassingCache: !1,
|
|
2159
|
-
...t?.fetch
|
|
2160
|
-
},
|
|
2161
|
-
fetchFn: null,
|
|
2162
|
-
font: {},
|
|
2163
|
-
drawImageInterval: 100,
|
|
2164
|
-
workerUrl: null,
|
|
2165
|
-
workerNumber: a,
|
|
2166
|
-
onCloneEachNode: null,
|
|
2167
|
-
onCloneNode: null,
|
|
2168
|
-
onEmbedNode: null,
|
|
2169
|
-
onCreateForeignObjectSvg: null,
|
|
2170
|
-
includeStyleProperties: null,
|
|
2171
|
-
autoDestruct: !1,
|
|
2172
|
-
...t,
|
|
2173
|
-
// InternalContext
|
|
2174
|
-
__CONTEXT__: !0,
|
|
2175
|
-
log: or(o),
|
|
2176
|
-
node: e,
|
|
2177
|
-
ownerDocument: s,
|
|
2178
|
-
ownerWindow: d,
|
|
2179
|
-
dpi: n === 1 ? null : 96 * n,
|
|
2180
|
-
svgStyleElement: bn(s),
|
|
2181
|
-
svgDefsElement: s?.createElementNS(et, "defs"),
|
|
2182
|
-
svgStyles: /* @__PURE__ */ new Map(),
|
|
2183
|
-
defaultComputedStyles: /* @__PURE__ */ new Map(),
|
|
2184
|
-
workers: [
|
|
2185
|
-
...Array.from({
|
|
2186
|
-
length: _i && i && a ? a : 0
|
|
2187
|
-
})
|
|
2188
|
-
].map(() => {
|
|
2189
|
-
try {
|
|
2190
|
-
const v = new Worker(i);
|
|
2191
|
-
return v.onmessage = async (S) => {
|
|
2192
|
-
const { url: w, result: k } = S.data;
|
|
2193
|
-
k ? p.get(w)?.resolve?.(k) : p.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`));
|
|
2194
|
-
}, v.onmessageerror = (S) => {
|
|
2195
|
-
const { url: w } = S.data;
|
|
2196
|
-
p.get(w)?.reject?.(new Error(`Error receiving message from worker: ${w}`));
|
|
2197
|
-
}, v;
|
|
2198
|
-
} catch (v) {
|
|
2199
|
-
return l.log.warn("Failed to new Worker", v), null;
|
|
2200
|
-
}
|
|
2201
|
-
}).filter(Boolean),
|
|
2202
|
-
fontFamilies: /* @__PURE__ */ new Map(),
|
|
2203
|
-
fontCssTexts: /* @__PURE__ */ new Map(),
|
|
2204
|
-
acceptOfImage: `${[
|
|
2205
|
-
Zi(s) && "image/webp",
|
|
2206
|
-
"image/svg+xml",
|
|
2207
|
-
"image/*",
|
|
2208
|
-
"*/*"
|
|
2209
|
-
].filter(Boolean).join(",")};q=0.8`,
|
|
2210
|
-
requests: p,
|
|
2211
|
-
drawImageCount: 0,
|
|
2212
|
-
tasks: [],
|
|
2213
|
-
features: r,
|
|
2214
|
-
isEnable: (v) => v === "restoreScrollPosition" ? typeof r == "boolean" ? !1 : r[v] ?? !1 : typeof r == "boolean" ? r : r[v] ?? !0,
|
|
2215
|
-
shadowRoots: []
|
|
2216
|
-
};
|
|
2217
|
-
l.log.time("wait until load"), await rr(e, { timeout: l.timeout, onWarn: l.log.warn }), l.log.timeEnd("wait until load");
|
|
2218
|
-
const { width: m, height: b } = lr(e, l);
|
|
2219
|
-
return l.width = m, l.height = b, l;
|
|
2220
|
-
}
|
|
2221
|
-
function bn(e) {
|
|
2222
|
-
if (!e)
|
|
2223
|
-
return;
|
|
2224
|
-
const t = e.createElement("style"), n = t.ownerDocument.createTextNode(`
|
|
2225
|
-
.______background-clip--text {
|
|
2226
|
-
background-clip: text;
|
|
2227
|
-
-webkit-background-clip: text;
|
|
2228
|
-
}
|
|
2229
|
-
`);
|
|
2230
|
-
return t.appendChild(n), t;
|
|
2231
|
-
}
|
|
2232
|
-
function lr(e, t) {
|
|
2233
|
-
let { width: n, height: i } = t;
|
|
2234
|
-
if (X(e) && (!n || !i)) {
|
|
2235
|
-
const a = e.getBoundingClientRect();
|
|
2236
|
-
n = n || a.width || Number(e.getAttribute("width")) || 0, i = i || a.height || Number(e.getAttribute("height")) || 0;
|
|
2237
|
-
}
|
|
2238
|
-
return { width: n, height: i };
|
|
2239
|
-
}
|
|
2240
|
-
async function cr(e, t) {
|
|
2241
|
-
const {
|
|
2242
|
-
log: n,
|
|
2243
|
-
timeout: i,
|
|
2244
|
-
drawImageCount: a,
|
|
2245
|
-
drawImageInterval: o
|
|
2246
|
-
} = t;
|
|
2247
|
-
n.time("image to canvas");
|
|
2248
|
-
const r = await Oe(e, { timeout: i, onWarn: t.log.warn }), { canvas: s, context2d: d } = dr(e.ownerDocument, t), p = () => {
|
|
2249
|
-
try {
|
|
2250
|
-
d?.drawImage(r, 0, 0, s.width, s.height);
|
|
2251
|
-
} catch (l) {
|
|
2252
|
-
t.log.warn("Failed to drawImage", l);
|
|
2253
|
-
}
|
|
2254
|
-
};
|
|
2255
|
-
if (p(), t.isEnable("fixSvgXmlDecode"))
|
|
2256
|
-
for (let l = 0; l < a; l++)
|
|
2257
|
-
await new Promise((m) => {
|
|
2258
|
-
setTimeout(() => {
|
|
2259
|
-
d?.clearRect(0, 0, s.width, s.height), p(), m();
|
|
2260
|
-
}, l + o);
|
|
2261
|
-
});
|
|
2262
|
-
return t.drawImageCount = 0, n.timeEnd("image to canvas"), s;
|
|
2263
|
-
}
|
|
2264
|
-
function dr(e, t) {
|
|
2265
|
-
const { width: n, height: i, scale: a, backgroundColor: o, maximumCanvasSize: r } = t, s = e.createElement("canvas");
|
|
2266
|
-
s.width = Math.floor(n * a), s.height = Math.floor(i * a), s.style.width = `${n}px`, s.style.height = `${i}px`, r && (s.width > r || s.height > r) && (s.width > r && s.height > r ? s.width > s.height ? (s.height *= r / s.width, s.width = r) : (s.width *= r / s.height, s.height = r) : s.width > r ? (s.height *= r / s.width, s.width = r) : (s.width *= r / s.height, s.height = r));
|
|
2267
|
-
const d = s.getContext("2d");
|
|
2268
|
-
return d && o && (d.fillStyle = o, d.fillRect(0, 0, s.width, s.height)), { canvas: s, context2d: d };
|
|
2269
|
-
}
|
|
2270
|
-
function yn(e, t) {
|
|
2271
|
-
if (e.ownerDocument)
|
|
2272
|
-
try {
|
|
2273
|
-
const o = e.toDataURL();
|
|
2274
|
-
if (o !== "data:,")
|
|
2275
|
-
return me(o, e.ownerDocument);
|
|
2276
|
-
} catch (o) {
|
|
2277
|
-
t.log.warn("Failed to clone canvas", o);
|
|
2278
|
-
}
|
|
2279
|
-
const n = e.cloneNode(!1), i = e.getContext("2d"), a = n.getContext("2d");
|
|
2280
|
-
try {
|
|
2281
|
-
return i && a && a.putImageData(
|
|
2282
|
-
i.getImageData(0, 0, e.width, e.height),
|
|
2283
|
-
0,
|
|
2284
|
-
0
|
|
2285
|
-
), n;
|
|
2286
|
-
} catch (o) {
|
|
2287
|
-
t.log.warn("Failed to clone canvas", o);
|
|
2288
|
-
}
|
|
2289
|
-
return n;
|
|
2290
|
-
}
|
|
2291
|
-
function ur(e, t) {
|
|
2292
|
-
try {
|
|
2293
|
-
if (e?.contentDocument?.body)
|
|
2294
|
-
return Et(e.contentDocument.body, t);
|
|
2295
|
-
} catch (n) {
|
|
2296
|
-
t.log.warn("Failed to clone iframe", n);
|
|
2297
|
-
}
|
|
2298
|
-
return e.cloneNode(!1);
|
|
2299
|
-
}
|
|
2300
|
-
function fr(e) {
|
|
2301
|
-
const t = e.cloneNode(!1);
|
|
2302
|
-
return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
|
|
2303
|
-
}
|
|
2304
|
-
async function hr(e, t) {
|
|
2305
|
-
if (e.ownerDocument && !e.currentSrc && e.poster)
|
|
2306
|
-
return me(e.poster, e.ownerDocument);
|
|
2307
|
-
const n = e.cloneNode(!1);
|
|
2308
|
-
n.crossOrigin = "anonymous", e.currentSrc && e.currentSrc !== e.src && (n.src = e.currentSrc);
|
|
2309
|
-
const i = n.ownerDocument;
|
|
2310
|
-
if (i) {
|
|
2311
|
-
let a = !0;
|
|
2312
|
-
if (await Oe(n, { onError: () => a = !1, onWarn: t.log.warn }), !a)
|
|
2313
|
-
return e.poster ? me(e.poster, e.ownerDocument) : n;
|
|
2314
|
-
n.currentTime = e.currentTime, await new Promise((r) => {
|
|
2315
|
-
n.addEventListener("seeked", r, { once: !0 });
|
|
2316
|
-
});
|
|
2317
|
-
const o = i.createElement("canvas");
|
|
2318
|
-
o.width = e.offsetWidth, o.height = e.offsetHeight;
|
|
2319
|
-
try {
|
|
2320
|
-
const r = o.getContext("2d");
|
|
2321
|
-
r && r.drawImage(n, 0, 0, o.width, o.height);
|
|
2322
|
-
} catch (r) {
|
|
2323
|
-
return t.log.warn("Failed to clone video", r), e.poster ? me(e.poster, e.ownerDocument) : n;
|
|
2324
|
-
}
|
|
2325
|
-
return yn(o, t);
|
|
2326
|
-
}
|
|
2327
|
-
return n;
|
|
2328
|
-
}
|
|
2329
|
-
function gr(e, t) {
|
|
2330
|
-
return qi(e) ? yn(e, t) : Qi(e) ? ur(e, t) : ve(e) ? fr(e) : Ke(e) ? hr(e, t) : e.cloneNode(!1);
|
|
2331
|
-
}
|
|
2332
|
-
function pr(e) {
|
|
2333
|
-
let t = e.sandbox;
|
|
2334
|
-
if (!t) {
|
|
2335
|
-
const { ownerDocument: n } = e;
|
|
2336
|
-
try {
|
|
2337
|
-
n && (t = n.createElement("iframe"), t.id = `__SANDBOX__${mn()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", n.body.appendChild(t), t.srcdoc = '<!DOCTYPE html><meta charset="UTF-8"><title></title><body>', e.sandbox = t);
|
|
2338
|
-
} catch (i) {
|
|
2339
|
-
e.log.warn("Failed to getSandBox", i);
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
return t;
|
|
2343
|
-
}
|
|
2344
|
-
const mr = [
|
|
2345
|
-
"width",
|
|
2346
|
-
"height",
|
|
2347
|
-
"-webkit-text-fill-color"
|
|
2348
|
-
], wr = [
|
|
2349
|
-
"stroke",
|
|
2350
|
-
"fill"
|
|
2351
|
-
];
|
|
2352
|
-
function xn(e, t, n) {
|
|
2353
|
-
const { defaultComputedStyles: i } = n, a = e.nodeName.toLowerCase(), o = _e(e) && a !== "svg", r = o ? wr.map((w) => [w, e.getAttribute(w)]).filter(([, w]) => w !== null) : [], s = [
|
|
2354
|
-
o && "svg",
|
|
2355
|
-
a,
|
|
2356
|
-
r.map((w, k) => `${w}=${k}`).join(","),
|
|
2357
|
-
t
|
|
2358
|
-
].filter(Boolean).join(":");
|
|
2359
|
-
if (i.has(s))
|
|
2360
|
-
return i.get(s);
|
|
2361
|
-
const p = pr(n)?.contentWindow;
|
|
2362
|
-
if (!p)
|
|
2363
|
-
return /* @__PURE__ */ new Map();
|
|
2364
|
-
const l = p?.document;
|
|
2365
|
-
let m, b;
|
|
2366
|
-
o ? (m = l.createElementNS(et, "svg"), b = m.ownerDocument.createElementNS(m.namespaceURI, a), r.forEach(([w, k]) => {
|
|
2367
|
-
b.setAttributeNS(null, w, k);
|
|
2368
|
-
}), m.appendChild(b)) : m = b = l.createElement(a), b.textContent = " ", l.body.appendChild(m);
|
|
2369
|
-
const v = p.getComputedStyle(b, t), S = /* @__PURE__ */ new Map();
|
|
2370
|
-
for (let w = v.length, k = 0; k < w; k++) {
|
|
2371
|
-
const y = v.item(k);
|
|
2372
|
-
mr.includes(y) || S.set(y, v.getPropertyValue(y));
|
|
2373
|
-
}
|
|
2374
|
-
return l.body.removeChild(m), i.set(s, S), S;
|
|
2375
|
-
}
|
|
2376
|
-
function vn(e, t, n) {
|
|
2377
|
-
const i = /* @__PURE__ */ new Map(), a = [], o = /* @__PURE__ */ new Map();
|
|
2378
|
-
if (n)
|
|
2379
|
-
for (const s of n)
|
|
2380
|
-
r(s);
|
|
2381
|
-
else
|
|
2382
|
-
for (let s = e.length, d = 0; d < s; d++) {
|
|
2383
|
-
const p = e.item(d);
|
|
2384
|
-
r(p);
|
|
2385
|
-
}
|
|
2386
|
-
for (let s = a.length, d = 0; d < s; d++)
|
|
2387
|
-
o.get(a[d])?.forEach((p, l) => i.set(l, p));
|
|
2388
|
-
function r(s) {
|
|
2389
|
-
const d = e.getPropertyValue(s), p = e.getPropertyPriority(s), l = s.lastIndexOf("-"), m = l > -1 ? s.substring(0, l) : void 0;
|
|
2390
|
-
if (m) {
|
|
2391
|
-
let b = o.get(m);
|
|
2392
|
-
b || (b = /* @__PURE__ */ new Map(), o.set(m, b)), b.set(s, [d, p]);
|
|
2393
|
-
}
|
|
2394
|
-
t.get(s) === d && !p || (m ? a.push(m) : i.set(s, [d, p]));
|
|
2395
|
-
}
|
|
2396
|
-
return i;
|
|
2397
|
-
}
|
|
2398
|
-
function br(e, t, n, i) {
|
|
2399
|
-
const { ownerWindow: a, includeStyleProperties: o, currentParentNodeStyle: r } = i, s = t.style, d = a.getComputedStyle(e), p = xn(e, null, i);
|
|
2400
|
-
r?.forEach((m, b) => {
|
|
2401
|
-
p.delete(b);
|
|
2402
|
-
});
|
|
2403
|
-
const l = vn(d, p, o);
|
|
2404
|
-
l.delete("transition-property"), l.delete("all"), l.delete("d"), l.delete("content"), n && (l.delete("margin-top"), l.delete("margin-right"), l.delete("margin-bottom"), l.delete("margin-left"), l.delete("margin-block-start"), l.delete("margin-block-end"), l.delete("margin-inline-start"), l.delete("margin-inline-end"), l.set("box-sizing", ["border-box", ""])), l.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text"), hn && (l.has("font-kerning") || l.set("font-kerning", ["normal", ""]), (l.get("overflow-x")?.[0] === "hidden" || l.get("overflow-y")?.[0] === "hidden") && l.get("text-overflow")?.[0] === "ellipsis" && e.scrollWidth === e.clientWidth && l.set("text-overflow", ["clip", ""]));
|
|
2405
|
-
for (let m = s.length, b = 0; b < m; b++)
|
|
2406
|
-
s.removeProperty(s.item(b));
|
|
2407
|
-
return l.forEach(([m, b], v) => {
|
|
2408
|
-
s.setProperty(v, m, b);
|
|
2409
|
-
}), l;
|
|
2410
|
-
}
|
|
2411
|
-
function yr(e, t) {
|
|
2412
|
-
(Vi(e) || ji(e) || Yi(e)) && t.setAttribute("value", e.value);
|
|
2413
|
-
}
|
|
2414
|
-
const xr = [
|
|
2415
|
-
"::before",
|
|
2416
|
-
"::after"
|
|
2417
|
-
// '::placeholder', TODO
|
|
2418
|
-
], vr = [
|
|
2419
|
-
"::-webkit-scrollbar",
|
|
2420
|
-
"::-webkit-scrollbar-button",
|
|
2421
|
-
// '::-webkit-scrollbar:horizontal', TODO
|
|
2422
|
-
"::-webkit-scrollbar-thumb",
|
|
2423
|
-
"::-webkit-scrollbar-track",
|
|
2424
|
-
"::-webkit-scrollbar-track-piece",
|
|
2425
|
-
// '::-webkit-scrollbar:vertical', TODO
|
|
2426
|
-
"::-webkit-scrollbar-corner",
|
|
2427
|
-
"::-webkit-resizer"
|
|
2428
|
-
];
|
|
2429
|
-
function Sr(e, t, n, i, a) {
|
|
2430
|
-
const { ownerWindow: o, svgStyleElement: r, svgStyles: s, currentNodeStyle: d } = i;
|
|
2431
|
-
if (!r || !o)
|
|
2432
|
-
return;
|
|
2433
|
-
function p(l) {
|
|
2434
|
-
const m = o.getComputedStyle(e, l);
|
|
2435
|
-
let b = m.getPropertyValue("content");
|
|
2436
|
-
if (!b || b === "none")
|
|
2437
|
-
return;
|
|
2438
|
-
a?.(b), b = b.replace(/(')|(")|(counter\(.+\))/g, "");
|
|
2439
|
-
const v = [mn()], S = xn(e, l, i);
|
|
2440
|
-
d?.forEach((T, M) => {
|
|
2441
|
-
S.delete(M);
|
|
2442
|
-
});
|
|
2443
|
-
const w = vn(m, S, i.includeStyleProperties);
|
|
2444
|
-
w.delete("content"), w.delete("-webkit-locale"), w.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text");
|
|
2445
|
-
const k = [
|
|
2446
|
-
`content: '${b}';`
|
|
2447
|
-
];
|
|
2448
|
-
if (w.forEach(([T, M], L) => {
|
|
2449
|
-
k.push(`${L}: ${T}${M ? " !important" : ""};`);
|
|
2450
|
-
}), k.length === 1)
|
|
2451
|
-
return;
|
|
2452
|
-
try {
|
|
2453
|
-
t.className = [t.className, ...v].join(" ");
|
|
2454
|
-
} catch (T) {
|
|
2455
|
-
i.log.warn("Failed to copyPseudoClass", T);
|
|
2456
|
-
return;
|
|
2457
|
-
}
|
|
2458
|
-
const y = k.join(`
|
|
2459
|
-
`);
|
|
2460
|
-
let I = s.get(y);
|
|
2461
|
-
I || (I = [], s.set(y, I)), I.push(`.${v[0]}${l}`);
|
|
2462
|
-
}
|
|
2463
|
-
xr.forEach(p), n && vr.forEach(p);
|
|
2464
|
-
}
|
|
2465
|
-
const Yt = /* @__PURE__ */ new Set([
|
|
2466
|
-
"symbol"
|
|
2467
|
-
// test/fixtures/svg.symbol.html
|
|
2468
|
-
]);
|
|
2469
|
-
async function Jt(e, t, n, i, a) {
|
|
2470
|
-
if (X(n) && (Gi(n) || Xi(n)) || i.filter && !i.filter(n))
|
|
2471
|
-
return;
|
|
2472
|
-
Yt.has(t.nodeName) || Yt.has(n.nodeName) ? i.currentParentNodeStyle = void 0 : i.currentParentNodeStyle = i.currentNodeStyle;
|
|
2473
|
-
const o = await Et(n, i, !1, a);
|
|
2474
|
-
i.isEnable("restoreScrollPosition") && Cr(e, o), t.appendChild(o);
|
|
2475
|
-
}
|
|
2476
|
-
async function Qt(e, t, n, i) {
|
|
2477
|
-
let a = e.firstChild;
|
|
2478
|
-
X(e) && e.shadowRoot && (a = e.shadowRoot?.firstChild, n.shadowRoots.push(e.shadowRoot));
|
|
2479
|
-
for (let o = a; o; o = o.nextSibling)
|
|
2480
|
-
if (!$i(o))
|
|
2481
|
-
if (X(o) && Ji(o) && typeof o.assignedNodes == "function") {
|
|
2482
|
-
const r = o.assignedNodes();
|
|
2483
|
-
for (let s = 0; s < r.length; s++)
|
|
2484
|
-
await Jt(e, t, r[s], n, i);
|
|
2485
|
-
} else
|
|
2486
|
-
await Jt(e, t, o, n, i);
|
|
2487
|
-
}
|
|
2488
|
-
function Cr(e, t) {
|
|
2489
|
-
if (!Me(e) || !Me(t))
|
|
2490
|
-
return;
|
|
2491
|
-
const { scrollTop: n, scrollLeft: i } = e;
|
|
2492
|
-
if (!n && !i)
|
|
2493
|
-
return;
|
|
2494
|
-
const { transform: a } = t.style, o = new DOMMatrix(a), { a: r, b: s, c: d, d: p } = o;
|
|
2495
|
-
o.a = 1, o.b = 0, o.c = 0, o.d = 1, o.translateSelf(-i, -n), o.a = r, o.b = s, o.c = d, o.d = p, t.style.transform = o.toString();
|
|
2496
|
-
}
|
|
2497
|
-
function kr(e, t) {
|
|
2498
|
-
const { backgroundColor: n, width: i, height: a, style: o } = t, r = e.style;
|
|
2499
|
-
if (n && r.setProperty("background-color", n, "important"), i && r.setProperty("width", `${i}px`, "important"), a && r.setProperty("height", `${a}px`, "important"), o)
|
|
2500
|
-
for (const s in o) r[s] = o[s];
|
|
2501
|
-
}
|
|
2502
|
-
const Er = /^[\w-:]+$/;
|
|
2503
|
-
async function Et(e, t, n = !1, i) {
|
|
2504
|
-
const { ownerDocument: a, ownerWindow: o, fontFamilies: r, onCloneEachNode: s } = t;
|
|
2505
|
-
if (a && Wi(e))
|
|
2506
|
-
return i && /\S/.test(e.data) && i(e.data), a.createTextNode(e.data);
|
|
2507
|
-
if (a && o && X(e) && (Me(e) || _e(e))) {
|
|
2508
|
-
const p = await gr(e, t);
|
|
2509
|
-
if (t.isEnable("removeAbnormalAttributes")) {
|
|
2510
|
-
const w = p.getAttributeNames();
|
|
2511
|
-
for (let k = w.length, y = 0; y < k; y++) {
|
|
2512
|
-
const I = w[y];
|
|
2513
|
-
Er.test(I) || p.removeAttribute(I);
|
|
2514
|
-
}
|
|
2515
|
-
}
|
|
2516
|
-
const l = t.currentNodeStyle = br(e, p, n, t);
|
|
2517
|
-
n && kr(p, t);
|
|
2518
|
-
let m = !1;
|
|
2519
|
-
if (t.isEnable("copyScrollbar")) {
|
|
2520
|
-
const w = [
|
|
2521
|
-
l.get("overflow-x")?.[0],
|
|
2522
|
-
l.get("overflow-y")?.[0]
|
|
2523
|
-
];
|
|
2524
|
-
m = w.includes("scroll") || (w.includes("auto") || w.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
|
|
2525
|
-
}
|
|
2526
|
-
const b = l.get("text-transform")?.[0], v = wn(l.get("font-family")?.[0]), S = v ? (w) => {
|
|
2527
|
-
b === "uppercase" ? w = w.toUpperCase() : b === "lowercase" ? w = w.toLowerCase() : b === "capitalize" && (w = w[0].toUpperCase() + w.substring(1)), v.forEach((k) => {
|
|
2528
|
-
let y = r.get(k);
|
|
2529
|
-
y || r.set(k, y = /* @__PURE__ */ new Set()), w.split("").forEach((I) => y.add(I));
|
|
2530
|
-
});
|
|
2531
|
-
} : void 0;
|
|
2532
|
-
return Sr(
|
|
2533
|
-
e,
|
|
2534
|
-
p,
|
|
2535
|
-
m,
|
|
2536
|
-
t,
|
|
2537
|
-
S
|
|
2538
|
-
), yr(e, p), Ke(e) || await Qt(
|
|
2539
|
-
e,
|
|
2540
|
-
p,
|
|
2541
|
-
t,
|
|
2542
|
-
S
|
|
2543
|
-
), await s?.(p), p;
|
|
2544
|
-
}
|
|
2545
|
-
const d = e.cloneNode(!1);
|
|
2546
|
-
return await Qt(e, d, t), await s?.(d), d;
|
|
2547
|
-
}
|
|
2548
|
-
function Tr(e) {
|
|
2549
|
-
if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
|
|
2550
|
-
try {
|
|
2551
|
-
e.sandbox.remove();
|
|
2552
|
-
} catch (t) {
|
|
2553
|
-
e.log.warn("Failed to destroyContext", t);
|
|
2554
|
-
}
|
|
2555
|
-
e.sandbox = void 0;
|
|
2556
|
-
}
|
|
2557
|
-
e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
|
|
2558
|
-
}
|
|
2559
|
-
function Ir(e) {
|
|
2560
|
-
const { url: t, timeout: n, responseType: i, ...a } = e, o = new AbortController(), r = n ? setTimeout(() => o.abort(), n) : void 0;
|
|
2561
|
-
return fetch(t, { signal: o.signal, ...a }).then((s) => {
|
|
2562
|
-
if (!s.ok)
|
|
2563
|
-
throw new Error("Failed fetch, not 2xx response", { cause: s });
|
|
2564
|
-
switch (i) {
|
|
2565
|
-
case "arrayBuffer":
|
|
2566
|
-
return s.arrayBuffer();
|
|
2567
|
-
case "dataUrl":
|
|
2568
|
-
return s.blob().then(ir);
|
|
2569
|
-
default:
|
|
2570
|
-
return s.text();
|
|
2571
|
-
}
|
|
2572
|
-
}).finally(() => clearTimeout(r));
|
|
2573
|
-
}
|
|
2574
|
-
function De(e, t) {
|
|
2575
|
-
const { url: n, requestType: i = "text", responseType: a = "text", imageDom: o } = t;
|
|
2576
|
-
let r = n;
|
|
2577
|
-
const {
|
|
2578
|
-
timeout: s,
|
|
2579
|
-
acceptOfImage: d,
|
|
2580
|
-
requests: p,
|
|
2581
|
-
fetchFn: l,
|
|
2582
|
-
fetch: {
|
|
2583
|
-
requestInit: m,
|
|
2584
|
-
bypassingCache: b,
|
|
2585
|
-
placeholderImage: v
|
|
2586
|
-
},
|
|
2587
|
-
font: S,
|
|
2588
|
-
workers: w,
|
|
2589
|
-
fontFamilies: k
|
|
2590
|
-
} = e;
|
|
2591
|
-
i === "image" && (Ye || kt) && e.drawImageCount++;
|
|
2592
|
-
let y = p.get(n);
|
|
2593
|
-
if (!y) {
|
|
2594
|
-
b && b instanceof RegExp && b.test(r) && (r += (/\?/.test(r) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
2595
|
-
const I = i.startsWith("font") && S && S.minify, T = /* @__PURE__ */ new Set();
|
|
2596
|
-
I && i.split(";")[1].split(",").forEach((Y) => {
|
|
2597
|
-
k.has(Y) && k.get(Y).forEach((_) => T.add(_));
|
|
2598
|
-
});
|
|
2599
|
-
const M = I && T.size, L = {
|
|
2600
|
-
url: r,
|
|
2601
|
-
timeout: s,
|
|
2602
|
-
responseType: M ? "arrayBuffer" : a,
|
|
2603
|
-
headers: i === "image" ? { accept: d } : void 0,
|
|
2604
|
-
...m
|
|
2605
|
-
};
|
|
2606
|
-
y = {
|
|
2607
|
-
type: i,
|
|
2608
|
-
resolve: void 0,
|
|
2609
|
-
reject: void 0,
|
|
2610
|
-
response: null
|
|
2611
|
-
}, y.response = (async () => {
|
|
2612
|
-
if (l && i === "image") {
|
|
2613
|
-
const H = await l(n);
|
|
2614
|
-
if (H)
|
|
2615
|
-
return H;
|
|
2616
|
-
}
|
|
2617
|
-
return !Ye && n.startsWith("http") && w.length ? new Promise((H, Y) => {
|
|
2618
|
-
w[p.size & w.length - 1].postMessage({ rawUrl: n, ...L }), y.resolve = H, y.reject = Y;
|
|
2619
|
-
}) : Ir(L);
|
|
2620
|
-
})().catch((H) => {
|
|
2621
|
-
if (p.delete(n), i === "image" && v)
|
|
2622
|
-
return e.log.warn("Failed to fetch image base64, trying to use placeholder image", r), typeof v == "string" ? v : v(o);
|
|
2623
|
-
throw H;
|
|
2624
|
-
}), p.set(n, y);
|
|
2625
|
-
}
|
|
2626
|
-
return y.response;
|
|
2627
|
-
}
|
|
2628
|
-
async function Sn(e, t, n, i) {
|
|
2629
|
-
if (!Cn(e))
|
|
2630
|
-
return e;
|
|
2631
|
-
for (const [a, o] of Ar(e, t))
|
|
2632
|
-
try {
|
|
2633
|
-
const r = await De(
|
|
2634
|
-
n,
|
|
2635
|
-
{
|
|
2636
|
-
url: o,
|
|
2637
|
-
requestType: i ? "image" : "text",
|
|
2638
|
-
responseType: "dataUrl"
|
|
2639
|
-
}
|
|
2640
|
-
);
|
|
2641
|
-
e = e.replace(Rr(a), `$1${r}$3`);
|
|
2642
|
-
} catch (r) {
|
|
2643
|
-
n.log.warn("Failed to fetch css data url", a, r);
|
|
2644
|
-
}
|
|
2645
|
-
return e;
|
|
2646
|
-
}
|
|
2647
|
-
function Cn(e) {
|
|
2648
|
-
return /url\((['"]?)([^'"]+?)\1\)/.test(e);
|
|
2649
|
-
}
|
|
2650
|
-
const kn = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
2651
|
-
function Ar(e, t) {
|
|
2652
|
-
const n = [];
|
|
2653
|
-
return e.replace(kn, (i, a, o) => (n.push([o, pn(o, t)]), i)), n.filter(([i]) => !yt(i));
|
|
2654
|
-
}
|
|
2655
|
-
function Rr(e) {
|
|
2656
|
-
const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
2657
|
-
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
2658
|
-
}
|
|
2659
|
-
const Nr = [
|
|
2660
|
-
"background-image",
|
|
2661
|
-
"border-image-source",
|
|
2662
|
-
"-webkit-border-image",
|
|
2663
|
-
"-webkit-mask-image",
|
|
2664
|
-
"list-style-image"
|
|
2665
|
-
];
|
|
2666
|
-
function Mr(e, t) {
|
|
2667
|
-
return Nr.map((n) => {
|
|
2668
|
-
const i = e.getPropertyValue(n);
|
|
2669
|
-
return !i || i === "none" ? null : ((Ye || kt) && t.drawImageCount++, Sn(i, null, t, !0).then((a) => {
|
|
2670
|
-
!a || i === a || e.setProperty(
|
|
2671
|
-
n,
|
|
2672
|
-
a,
|
|
2673
|
-
e.getPropertyPriority(n)
|
|
2674
|
-
);
|
|
2675
|
-
}));
|
|
2676
|
-
}).filter(Boolean);
|
|
2677
|
-
}
|
|
2678
|
-
function Or(e, t) {
|
|
2679
|
-
if (ve(e)) {
|
|
2680
|
-
const n = e.currentSrc || e.src;
|
|
2681
|
-
if (!yt(n))
|
|
2682
|
-
return [
|
|
2683
|
-
De(t, {
|
|
2684
|
-
url: n,
|
|
2685
|
-
imageDom: e,
|
|
2686
|
-
requestType: "image",
|
|
2687
|
-
responseType: "dataUrl"
|
|
2688
|
-
}).then((i) => {
|
|
2689
|
-
i && (e.srcset = "", e.dataset.originalSrc = n, e.src = i || "");
|
|
2690
|
-
})
|
|
2691
|
-
];
|
|
2692
|
-
(Ye || kt) && t.drawImageCount++;
|
|
2693
|
-
} else if (_e(e) && !yt(e.href.baseVal)) {
|
|
2694
|
-
const n = e.href.baseVal;
|
|
2695
|
-
return [
|
|
2696
|
-
De(t, {
|
|
2697
|
-
url: n,
|
|
2698
|
-
imageDom: e,
|
|
2699
|
-
requestType: "image",
|
|
2700
|
-
responseType: "dataUrl"
|
|
2701
|
-
}).then((i) => {
|
|
2702
|
-
i && (e.dataset.originalSrc = n, e.href.baseVal = i || "");
|
|
2703
|
-
})
|
|
2704
|
-
];
|
|
2705
|
-
}
|
|
2706
|
-
return [];
|
|
2707
|
-
}
|
|
2708
|
-
function Dr(e, t) {
|
|
2709
|
-
const { ownerDocument: n, svgDefsElement: i } = t, a = e.getAttribute("href") ?? e.getAttribute("xlink:href");
|
|
2710
|
-
if (!a)
|
|
2711
|
-
return [];
|
|
2712
|
-
const [o, r] = a.split("#");
|
|
2713
|
-
if (r) {
|
|
2714
|
-
const s = `#${r}`, d = t.shadowRoots.reduce(
|
|
2715
|
-
(p, l) => p ?? l.querySelector(`svg ${s}`),
|
|
2716
|
-
n?.querySelector(`svg ${s}`)
|
|
2717
|
-
);
|
|
2718
|
-
if (o && e.setAttribute("href", s), i?.querySelector(s))
|
|
2719
|
-
return [];
|
|
2720
|
-
if (d)
|
|
2721
|
-
return i?.appendChild(d.cloneNode(!0)), [];
|
|
2722
|
-
if (o)
|
|
2723
|
-
return [
|
|
2724
|
-
De(t, {
|
|
2725
|
-
url: o,
|
|
2726
|
-
responseType: "text"
|
|
2727
|
-
}).then((p) => {
|
|
2728
|
-
i?.insertAdjacentHTML("beforeend", p);
|
|
2729
|
-
})
|
|
2730
|
-
];
|
|
2731
|
-
}
|
|
2732
|
-
return [];
|
|
2733
|
-
}
|
|
2734
|
-
function En(e, t) {
|
|
2735
|
-
const { tasks: n } = t;
|
|
2736
|
-
X(e) && ((ve(e) || gn(e)) && n.push(...Or(e, t)), Hi(e) && n.push(...Dr(e, t))), Me(e) && n.push(...Mr(e.style, t)), e.childNodes.forEach((i) => {
|
|
2737
|
-
En(i, t);
|
|
2738
|
-
});
|
|
2739
|
-
}
|
|
2740
|
-
async function Fr(e, t) {
|
|
2741
|
-
const {
|
|
2742
|
-
ownerDocument: n,
|
|
2743
|
-
svgStyleElement: i,
|
|
2744
|
-
fontFamilies: a,
|
|
2745
|
-
fontCssTexts: o,
|
|
2746
|
-
tasks: r,
|
|
2747
|
-
font: s
|
|
2748
|
-
} = t;
|
|
2749
|
-
if (!(!n || !i || !a.size))
|
|
2750
|
-
if (s && s.cssText) {
|
|
2751
|
-
const d = Zt(s.cssText, t);
|
|
2752
|
-
i.appendChild(n.createTextNode(`${d}
|
|
2753
|
-
`));
|
|
2754
|
-
} else {
|
|
2755
|
-
const d = Array.from(n.styleSheets).filter((l) => {
|
|
2756
|
-
try {
|
|
2757
|
-
return "cssRules" in l && !!l.cssRules.length;
|
|
2758
|
-
} catch (m) {
|
|
2759
|
-
return t.log.warn(`Error while reading CSS rules from ${l.href}`, m), !1;
|
|
2760
|
-
}
|
|
2761
|
-
});
|
|
2762
|
-
await Promise.all(
|
|
2763
|
-
d.flatMap((l) => Array.from(l.cssRules).map(async (m, b) => {
|
|
2764
|
-
if (Pi(m)) {
|
|
2765
|
-
let v = b + 1;
|
|
2766
|
-
const S = m.href;
|
|
2767
|
-
let w = "";
|
|
2768
|
-
try {
|
|
2769
|
-
w = await De(t, {
|
|
2770
|
-
url: S,
|
|
2771
|
-
requestType: "text",
|
|
2772
|
-
responseType: "text"
|
|
2773
|
-
});
|
|
2774
|
-
} catch (y) {
|
|
2775
|
-
t.log.warn(`Error fetch remote css import from ${S}`, y);
|
|
2776
|
-
}
|
|
2777
|
-
const k = w.replace(
|
|
2778
|
-
kn,
|
|
2779
|
-
(y, I, T) => y.replace(T, pn(T, S))
|
|
2780
|
-
);
|
|
2781
|
-
for (const y of Lr(k))
|
|
2782
|
-
try {
|
|
2783
|
-
l.insertRule(
|
|
2784
|
-
y,
|
|
2785
|
-
y.startsWith("@import") ? v += 1 : l.cssRules.length
|
|
2786
|
-
);
|
|
2787
|
-
} catch (I) {
|
|
2788
|
-
t.log.warn("Error inserting rule from remote css import", { rule: y, error: I });
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
}))
|
|
2792
|
-
), d.flatMap((l) => Array.from(l.cssRules)).filter((l) => Bi(l) && Cn(l.style.getPropertyValue("src")) && wn(l.style.getPropertyValue("font-family"))?.some((m) => a.has(m))).forEach((l) => {
|
|
2793
|
-
const m = l, b = o.get(m.cssText);
|
|
2794
|
-
b ? i.appendChild(n.createTextNode(`${b}
|
|
2795
|
-
`)) : r.push(
|
|
2796
|
-
Sn(
|
|
2797
|
-
m.cssText,
|
|
2798
|
-
m.parentStyleSheet ? m.parentStyleSheet.href : null,
|
|
2799
|
-
t
|
|
2800
|
-
).then((v) => {
|
|
2801
|
-
v = Zt(v, t), o.set(m.cssText, v), i.appendChild(n.createTextNode(`${v}
|
|
2802
|
-
`));
|
|
2803
|
-
})
|
|
2804
|
-
);
|
|
2805
|
-
});
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
const _r = /(\/\*[\s\S]*?\*\/)/g, Kt = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
|
|
2809
|
-
function Lr(e) {
|
|
2810
|
-
if (e == null)
|
|
2811
|
-
return [];
|
|
2812
|
-
const t = [];
|
|
2813
|
-
let n = e.replace(_r, "");
|
|
2814
|
-
for (; ; ) {
|
|
2815
|
-
const o = Kt.exec(n);
|
|
2816
|
-
if (!o)
|
|
2817
|
-
break;
|
|
2818
|
-
t.push(o[0]);
|
|
2819
|
-
}
|
|
2820
|
-
n = n.replace(Kt, "");
|
|
2821
|
-
const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = new RegExp(
|
|
2822
|
-
// eslint-disable-next-line
|
|
2823
|
-
"((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",
|
|
2824
|
-
"gi"
|
|
2825
|
-
);
|
|
2826
|
-
for (; ; ) {
|
|
2827
|
-
let o = i.exec(n);
|
|
2828
|
-
if (o)
|
|
2829
|
-
a.lastIndex = i.lastIndex;
|
|
2830
|
-
else if (o = a.exec(n), o)
|
|
2831
|
-
i.lastIndex = a.lastIndex;
|
|
2832
|
-
else
|
|
2833
|
-
break;
|
|
2834
|
-
t.push(o[0]);
|
|
2835
|
-
}
|
|
2836
|
-
return t;
|
|
2837
|
-
}
|
|
2838
|
-
const Ur = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, zr = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
2839
|
-
function Zt(e, t) {
|
|
2840
|
-
const { font: n } = t, i = n ? n?.preferredFormat : void 0;
|
|
2841
|
-
return i ? e.replace(zr, (a) => {
|
|
2842
|
-
for (; ; ) {
|
|
2843
|
-
const [o, , r] = Ur.exec(a) || [];
|
|
2844
|
-
if (!r)
|
|
2845
|
-
return "";
|
|
2846
|
-
if (r === i)
|
|
2847
|
-
return `src: ${o};`;
|
|
2848
|
-
}
|
|
2849
|
-
}) : e;
|
|
2850
|
-
}
|
|
2851
|
-
async function Br(e, t) {
|
|
2852
|
-
const n = await tt(e, t);
|
|
2853
|
-
if (X(n.node) && _e(n.node))
|
|
2854
|
-
return n.node;
|
|
2855
|
-
const {
|
|
2856
|
-
ownerDocument: i,
|
|
2857
|
-
log: a,
|
|
2858
|
-
tasks: o,
|
|
2859
|
-
svgStyleElement: r,
|
|
2860
|
-
svgDefsElement: s,
|
|
2861
|
-
svgStyles: d,
|
|
2862
|
-
font: p,
|
|
2863
|
-
progress: l,
|
|
2864
|
-
autoDestruct: m,
|
|
2865
|
-
onCloneNode: b,
|
|
2866
|
-
onEmbedNode: v,
|
|
2867
|
-
onCreateForeignObjectSvg: S
|
|
2868
|
-
} = n;
|
|
2869
|
-
a.time("clone node");
|
|
2870
|
-
const w = await Et(n.node, n, !0);
|
|
2871
|
-
if (r && i) {
|
|
2872
|
-
let M = "";
|
|
2873
|
-
d.forEach((L, H) => {
|
|
2874
|
-
M += `${L.join(`,
|
|
2875
|
-
`)} {
|
|
2876
|
-
${H}
|
|
2877
|
-
}
|
|
2878
|
-
`;
|
|
2879
|
-
}), r.appendChild(i.createTextNode(M));
|
|
2880
|
-
}
|
|
2881
|
-
a.timeEnd("clone node"), await b?.(w), p !== !1 && X(w) && (a.time("embed web font"), await Fr(w, n), a.timeEnd("embed web font")), a.time("embed node"), En(w, n);
|
|
2882
|
-
const k = o.length;
|
|
2883
|
-
let y = 0;
|
|
2884
|
-
const I = async () => {
|
|
2885
|
-
for (; ; ) {
|
|
2886
|
-
const M = o.pop();
|
|
2887
|
-
if (!M)
|
|
2888
|
-
break;
|
|
2889
|
-
try {
|
|
2890
|
-
await M;
|
|
2891
|
-
} catch (L) {
|
|
2892
|
-
n.log.warn("Failed to run task", L);
|
|
2893
|
-
}
|
|
2894
|
-
l?.(++y, k);
|
|
2895
|
-
}
|
|
2896
|
-
};
|
|
2897
|
-
l?.(y, k), await Promise.all([...Array.from({ length: 4 })].map(I)), a.timeEnd("embed node"), await v?.(w);
|
|
2898
|
-
const T = Pr(w, n);
|
|
2899
|
-
return s && T.insertBefore(s, T.children[0]), r && T.insertBefore(r, T.children[0]), m && Tr(n), await S?.(T), T;
|
|
2900
|
-
}
|
|
2901
|
-
function Pr(e, t) {
|
|
2902
|
-
const { width: n, height: i } = t, a = er(n, i, e.ownerDocument), o = a.ownerDocument.createElementNS(a.namespaceURI, "foreignObject");
|
|
2903
|
-
return o.setAttributeNS(null, "x", "0%"), o.setAttributeNS(null, "y", "0%"), o.setAttributeNS(null, "width", "100%"), o.setAttributeNS(null, "height", "100%"), o.append(e), a.appendChild(o), a;
|
|
2904
|
-
}
|
|
2905
|
-
async function Hr(e, t) {
|
|
2906
|
-
const n = await tt(e, t), i = await Br(n), a = tr(i, n.isEnable("removeControlCharacter"));
|
|
2907
|
-
n.autoDestruct || (n.svgStyleElement = bn(n.ownerDocument), n.svgDefsElement = n.ownerDocument?.createElementNS(et, "defs"), n.svgStyles.clear());
|
|
2908
|
-
const o = me(a, i.ownerDocument);
|
|
2909
|
-
return await cr(o, n);
|
|
2910
|
-
}
|
|
2911
|
-
async function $r(e, t) {
|
|
2912
|
-
const n = await tt(e, t), { log: i, quality: a, type: o, dpi: r } = n, s = await Hr(n);
|
|
2913
|
-
i.time("canvas to data url");
|
|
2914
|
-
let d = s.toDataURL(o, a);
|
|
2915
|
-
if (["image/png", "image/jpeg"].includes(o) && r && Li && Ui) {
|
|
2916
|
-
const [p, l] = d.split(",");
|
|
2917
|
-
let m = 0, b = !1;
|
|
2918
|
-
if (o === "image/png") {
|
|
2919
|
-
const T = Fi(l);
|
|
2920
|
-
T >= 0 ? (m = Math.ceil((T + 28) / 3) * 4, b = !0) : m = 33 / 3 * 4;
|
|
2921
|
-
} else o === "image/jpeg" && (m = 18 / 3 * 4);
|
|
2922
|
-
const v = l.substring(0, m), S = l.substring(m), w = window.atob(v), k = new Uint8Array(w.length);
|
|
2923
|
-
for (let T = 0; T < k.length; T++)
|
|
2924
|
-
k[T] = w.charCodeAt(T);
|
|
2925
|
-
const y = o === "image/png" ? Ni(k, r, b) : Ti(k, r), I = window.btoa(String.fromCharCode(...y));
|
|
2926
|
-
d = [p, ",", I, S].join("");
|
|
2927
|
-
}
|
|
2928
|
-
return i.timeEnd("canvas to data url"), d;
|
|
2929
|
-
}
|
|
2930
|
-
async function Wr(e, t) {
|
|
2931
|
-
return $r(
|
|
2932
|
-
await tt(e, { ...t, type: "image/png" })
|
|
2933
|
-
);
|
|
2934
|
-
}
|
|
2935
|
-
const qr = async (e, t) => {
|
|
2936
|
-
console.log("[Screenshot] Starting capture with 3-tier fallback strategy");
|
|
2937
|
-
try {
|
|
2938
|
-
console.log("[Screenshot] Tier 1: Attempting canvas-based capture...");
|
|
2939
|
-
const n = await Ei(e, {}, t);
|
|
2940
|
-
if (n)
|
|
2941
|
-
return console.log("[Screenshot] Tier 1 successful - canvas-based capture"), n;
|
|
2942
|
-
console.warn("[Screenshot] Tier 1 failed, falling back to Tier 2");
|
|
2943
|
-
} catch (n) {
|
|
2944
|
-
console.warn("[Screenshot] Tier 1 error:", n);
|
|
2945
|
-
}
|
|
2946
|
-
try {
|
|
2947
|
-
console.log("[Screenshot] Tier 2: Attempting modern-screenshot...");
|
|
2948
|
-
const n = document.documentElement, i = e ? e.x : 0, a = e ? e.y : 0, o = e ? e.width : window.innerWidth, r = e ? e.height : window.innerHeight, s = window.scrollX, d = window.scrollY, p = s + i, l = d + a, m = await Wr(n, {
|
|
2949
|
-
quality: 0.9,
|
|
2950
|
-
width: o,
|
|
2951
|
-
height: r,
|
|
2952
|
-
style: {
|
|
2953
|
-
transform: `translate(${-p}px, ${-l}px)`
|
|
2954
|
-
}
|
|
2955
|
-
});
|
|
2956
|
-
return console.log("[Screenshot] Tier 2 successful - modern-screenshot"), m;
|
|
2957
|
-
} catch (n) {
|
|
2958
|
-
console.error("[Screenshot] Tier 2 failed:", n);
|
|
2959
|
-
}
|
|
2960
|
-
return console.error("[Screenshot] All capture methods failed"), null;
|
|
2961
|
-
};
|
|
2962
|
-
const Vr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), jr = (e) => e.replace(
|
|
2963
|
-
/^([A-Z])|[\s-_]+(\w)/g,
|
|
2964
|
-
(t, n, i) => i ? i.toUpperCase() : n.toLowerCase()
|
|
2965
|
-
), en = (e) => {
|
|
2966
|
-
const t = jr(e);
|
|
2967
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2968
|
-
}, Tn = (...e) => e.filter((t, n, i) => !!t && t.trim() !== "" && i.indexOf(t) === n).join(" ").trim(), Gr = (e) => {
|
|
2969
|
-
for (const t in e)
|
|
2970
|
-
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
2971
|
-
return !0;
|
|
2972
|
-
};
|
|
2973
|
-
var Xr = {
|
|
2974
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2975
|
-
width: 24,
|
|
2976
|
-
height: 24,
|
|
2977
|
-
viewBox: "0 0 24 24",
|
|
2978
|
-
fill: "none",
|
|
2979
|
-
stroke: "currentColor",
|
|
2980
|
-
strokeWidth: 2,
|
|
2981
|
-
strokeLinecap: "round",
|
|
2982
|
-
strokeLinejoin: "round"
|
|
2983
|
-
};
|
|
2984
|
-
const Yr = rn(
|
|
2985
|
-
({
|
|
2986
|
-
color: e = "currentColor",
|
|
2987
|
-
size: t = 24,
|
|
2988
|
-
strokeWidth: n = 2,
|
|
2989
|
-
absoluteStrokeWidth: i,
|
|
2990
|
-
className: a = "",
|
|
2991
|
-
children: o,
|
|
2992
|
-
iconNode: r,
|
|
2993
|
-
...s
|
|
2994
|
-
}, d) => gt(
|
|
2995
|
-
"svg",
|
|
2996
|
-
{
|
|
2997
|
-
ref: d,
|
|
2998
|
-
...Xr,
|
|
2999
|
-
width: t,
|
|
3000
|
-
height: t,
|
|
3001
|
-
stroke: e,
|
|
3002
|
-
strokeWidth: i ? Number(n) * 24 / Number(t) : n,
|
|
3003
|
-
className: Tn("lucide", a),
|
|
3004
|
-
...!o && !Gr(s) && { "aria-hidden": "true" },
|
|
3005
|
-
...s
|
|
3006
|
-
},
|
|
3007
|
-
[
|
|
3008
|
-
...r.map(([p, l]) => gt(p, l)),
|
|
3009
|
-
...Array.isArray(o) ? o : [o]
|
|
3010
|
-
]
|
|
3011
|
-
)
|
|
3012
|
-
);
|
|
3013
|
-
const ae = (e, t) => {
|
|
3014
|
-
const n = rn(
|
|
3015
|
-
({ className: i, ...a }, o) => gt(Yr, {
|
|
3016
|
-
ref: o,
|
|
3017
|
-
iconNode: t,
|
|
3018
|
-
className: Tn(
|
|
3019
|
-
`lucide-${Vr(en(e))}`,
|
|
3020
|
-
`lucide-${e}`,
|
|
3021
|
-
i
|
|
3022
|
-
),
|
|
3023
|
-
...a
|
|
3024
|
-
})
|
|
3025
|
-
);
|
|
3026
|
-
return n.displayName = en(e), n;
|
|
3027
|
-
};
|
|
3028
|
-
const Jr = [
|
|
3029
|
-
["path", { d: "M6 2v14a2 2 0 0 0 2 2h14", key: "ron5a4" }],
|
|
3030
|
-
["path", { d: "M18 22V8a2 2 0 0 0-2-2H2", key: "7s9ehn" }]
|
|
3031
|
-
], Qr = ae("crop", Jr);
|
|
3032
|
-
const Kr = [
|
|
3033
|
-
["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
|
|
3034
|
-
["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
|
|
3035
|
-
["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
|
|
3036
|
-
["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
|
|
3037
|
-
], tn = ae("hash", Kr);
|
|
3038
|
-
const Zr = [
|
|
3039
|
-
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
3040
|
-
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
3041
|
-
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
3042
|
-
], eo = ae("image", Zr);
|
|
3043
|
-
const to = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], no = ae("loader-circle", to);
|
|
3044
|
-
const io = [
|
|
3045
|
-
[
|
|
3046
|
-
"path",
|
|
3047
|
-
{
|
|
3048
|
-
d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
|
|
3049
|
-
key: "18887p"
|
|
3050
|
-
}
|
|
3051
|
-
],
|
|
3052
|
-
["path", { d: "M12 8v6", key: "1ib9pf" }],
|
|
3053
|
-
["path", { d: "M9 11h6", key: "1fldmi" }]
|
|
3054
|
-
], ro = ae("message-square-plus", io);
|
|
3055
|
-
const oo = [
|
|
3056
|
-
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
3057
|
-
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
3058
|
-
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
3059
|
-
], so = ae("monitor", oo);
|
|
3060
|
-
const ao = [
|
|
3061
|
-
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
3062
|
-
["path", { d: "M15 12H3", key: "6jk70r" }],
|
|
3063
|
-
["path", { d: "M17 19H3", key: "z6ezky" }]
|
|
3064
|
-
], lo = ae("text-align-start", ao);
|
|
3065
|
-
const co = [
|
|
3066
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
3067
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
3068
|
-
], nn = ae("x", co), uo = ({ onConfirm: e, onCancel: t }) => {
|
|
3069
|
-
const [n, i] = F(!1), [a, o] = F({ x: 0, y: 0 }), [r, s] = F({ x: 0, y: 0 }), [d, p] = F(!1);
|
|
3070
|
-
Ot(() => (d ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
3071
|
-
document.body.style.overflow = "";
|
|
3072
|
-
}), [d]);
|
|
3073
|
-
const l = (y) => {
|
|
3074
|
-
i(!0), o({ x: y.clientX, y: y.clientY }), s({ x: y.clientX, y: y.clientY });
|
|
3075
|
-
}, m = (y) => {
|
|
3076
|
-
n && s({ x: y.clientX, y: y.clientY });
|
|
3077
|
-
}, b = () => {
|
|
3078
|
-
k();
|
|
3079
|
-
}, v = (y) => {
|
|
3080
|
-
if (y.touches.length === 1) {
|
|
3081
|
-
i(!0);
|
|
3082
|
-
const I = y.touches[0];
|
|
3083
|
-
o({ x: I.clientX, y: I.clientY }), s({ x: I.clientX, y: I.clientY }), p(!0);
|
|
3084
|
-
}
|
|
3085
|
-
}, S = (y) => {
|
|
3086
|
-
if (n && y.touches.length === 1) {
|
|
3087
|
-
const I = y.touches[0];
|
|
3088
|
-
s({ x: I.clientX, y: I.clientY });
|
|
3089
|
-
}
|
|
3090
|
-
}, w = () => {
|
|
3091
|
-
k(), p(!1);
|
|
3092
|
-
}, k = () => {
|
|
3093
|
-
if (n) {
|
|
3094
|
-
i(!1);
|
|
3095
|
-
const y = Math.min(a.x, r.x), I = Math.min(a.y, r.y), T = Math.abs(r.x - a.x), M = Math.abs(r.y - a.y);
|
|
3096
|
-
T > 10 && M > 10 && e({
|
|
3097
|
-
x: y,
|
|
3098
|
-
y: I,
|
|
3099
|
-
width: T,
|
|
3100
|
-
height: M
|
|
3101
|
-
});
|
|
3102
|
-
}
|
|
3103
|
-
};
|
|
3104
|
-
return Ot(() => {
|
|
3105
|
-
const y = (I) => {
|
|
3106
|
-
I.key === "Escape" && t();
|
|
3107
|
-
};
|
|
3108
|
-
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
3109
|
-
}, [t]), /* @__PURE__ */ A(
|
|
3110
|
-
"div",
|
|
3111
|
-
{
|
|
3112
|
-
style: {
|
|
3113
|
-
position: "fixed",
|
|
3114
|
-
inset: 0,
|
|
3115
|
-
zIndex: 99999,
|
|
3116
|
-
// Extremely high z-index
|
|
3117
|
-
cursor: "crosshair",
|
|
3118
|
-
userSelect: "none"
|
|
3119
|
-
},
|
|
3120
|
-
onMouseDown: l,
|
|
3121
|
-
onMouseMove: m,
|
|
3122
|
-
onMouseUp: b,
|
|
3123
|
-
onTouchStart: v,
|
|
3124
|
-
onTouchMove: S,
|
|
3125
|
-
onTouchEnd: w,
|
|
3126
|
-
children: [
|
|
3127
|
-
/* @__PURE__ */ C("div", { style: {
|
|
3128
|
-
position: "absolute",
|
|
3129
|
-
inset: 0,
|
|
3130
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
|
3131
|
-
} }),
|
|
3132
|
-
!n && /* @__PURE__ */ C("div", { style: {
|
|
3133
|
-
position: "absolute",
|
|
3134
|
-
top: "20px",
|
|
3135
|
-
left: "50%",
|
|
3136
|
-
transform: "translateX(-50%)",
|
|
3137
|
-
background: "rgba(0,0,0,0.8)",
|
|
3138
|
-
color: "white",
|
|
3139
|
-
padding: "8px 16px",
|
|
3140
|
-
borderRadius: "20px",
|
|
3141
|
-
pointerEvents: "none",
|
|
3142
|
-
fontSize: "14px"
|
|
3143
|
-
}, children: "Kéo chuột hoặc chạm để chọn vùng chụp ảnh (ESC để hủy)" }),
|
|
3144
|
-
n && /* @__PURE__ */ C(
|
|
3145
|
-
"div",
|
|
3146
|
-
{
|
|
3147
|
-
style: {
|
|
3148
|
-
position: "absolute",
|
|
3149
|
-
left: Math.min(a.x, r.x),
|
|
3150
|
-
top: Math.min(a.y, r.y),
|
|
3151
|
-
width: Math.abs(r.x - a.x),
|
|
3152
|
-
height: Math.abs(r.y - a.y),
|
|
3153
|
-
border: "2px solid #fff",
|
|
3154
|
-
backgroundColor: "rgba(255, 255, 255, 0.1)",
|
|
3155
|
-
boxShadow: "0 0 0 9999px rgba(0, 0, 0, 0.5)"
|
|
3156
|
-
// Clever trick to dim outside
|
|
3157
|
-
}
|
|
3158
|
-
}
|
|
3159
|
-
)
|
|
3160
|
-
]
|
|
3161
|
-
}
|
|
3162
|
-
);
|
|
3163
|
-
}, fo = ({
|
|
3164
|
-
questionId: e,
|
|
3165
|
-
contextData: t,
|
|
3166
|
-
onSubmit: n,
|
|
3167
|
-
themeColor: i = "#3b82f6",
|
|
3168
|
-
triggerComponent: a,
|
|
3169
|
-
isOpen: o,
|
|
3170
|
-
onOpen: r,
|
|
3171
|
-
onClose: s,
|
|
3172
|
-
isEnableCaptureFull: d = !0,
|
|
3173
|
-
isEnableCaptureElement: p = !0
|
|
3174
|
-
}) => {
|
|
3175
|
-
const [l, m] = F(!1), [b, v] = F(""), [S, w] = F(e), [k, y] = F(t?.questionIdChild || ""), [I, T] = F([]), [M, L] = F(null), [H, Y] = F(!1), [_, W] = F(!1), [te, Le] = F(!1), [J, ue] = F(null), [z, fe] = F({}), [Tt, Ue] = F("incorrect_content"), [An, nt] = F(!1), It = Mt.useRef(null), it = o !== void 0 ? o : l, Rn = it && !An;
|
|
3176
|
-
Mt.useEffect(() => {
|
|
3177
|
-
it && (fe({}), w(e), y(t?.questionIdChild || ""), T([]), v(""), Ue("incorrect_content"));
|
|
3178
|
-
}, [it, e, t]);
|
|
3179
|
-
const Nn = () => {
|
|
3180
|
-
if (I.length >= 3) {
|
|
3181
|
-
alert("Bạn chỉ có thể chụp tối đa 3 ảnh.");
|
|
3182
|
-
return;
|
|
3183
|
-
}
|
|
3184
|
-
It.current?.click();
|
|
3185
|
-
}, Mn = (x) => {
|
|
3186
|
-
const N = x.target.files?.[0];
|
|
3187
|
-
if (!N) return;
|
|
3188
|
-
if (!N.type.startsWith("image/")) {
|
|
3189
|
-
alert("Vui lòng chọn file ảnh.");
|
|
3190
|
-
return;
|
|
3191
|
-
}
|
|
3192
|
-
if (N.size > 5 * 1024 * 1024) {
|
|
3193
|
-
alert("Ảnh quá lớn. Vui lòng chọn ảnh dưới 5MB.");
|
|
3194
|
-
return;
|
|
3195
|
-
}
|
|
3196
|
-
const Q = new FileReader();
|
|
3197
|
-
Q.onload = (ze) => {
|
|
3198
|
-
const Be = ze.target?.result;
|
|
3199
|
-
Be && T((Nt) => [...Nt, Be]);
|
|
3200
|
-
}, Q.readAsDataURL(N), x.target.value = "";
|
|
3201
|
-
}, On = () => {
|
|
3202
|
-
T([]), v(""), w(e), y(t?.questionIdChild || ""), Ue("incorrect_content"), fe({}), o === void 0 && m(!0);
|
|
3203
|
-
}, At = async (x) => {
|
|
3204
|
-
if (console.log("click capture", performance.now()), I.length >= 3) {
|
|
3205
|
-
alert("Bạn chỉ có thể chụp tối đa 3 ảnh.");
|
|
3206
|
-
return;
|
|
3207
|
-
}
|
|
3208
|
-
if (nt(!0), x === "crop") {
|
|
3209
|
-
setTimeout(() => Le(!0), 150);
|
|
3210
|
-
return;
|
|
3211
|
-
}
|
|
3212
|
-
setTimeout(async () => {
|
|
3213
|
-
await Rt();
|
|
3214
|
-
}, 150);
|
|
3215
|
-
}, Rt = async (x) => {
|
|
3216
|
-
console.log("performCapture start", performance.now()), Y(!0);
|
|
3217
|
-
try {
|
|
3218
|
-
const N = await qr(x);
|
|
3219
|
-
console.log("performCapture end", performance.now()), N ? T((Q) => [...Q, N]) : alert("Không thể chụp ảnh màn hình. Vui lòng thử lại.");
|
|
3220
|
-
} catch (N) {
|
|
3221
|
-
console.error(N);
|
|
3222
|
-
} finally {
|
|
3223
|
-
Y(!1), nt(!1);
|
|
3224
|
-
}
|
|
3225
|
-
}, Dn = (x) => {
|
|
3226
|
-
Le(!1), Rt(x);
|
|
3227
|
-
}, Fn = () => {
|
|
3228
|
-
Le(!1), nt(!1);
|
|
3229
|
-
}, _n = (x) => {
|
|
3230
|
-
T((N) => N.filter((Q, ze) => ze !== x));
|
|
3231
|
-
}, rt = () => {
|
|
3232
|
-
s && s(), m(!1), T([]), Le(!1), L(null), v(""), fe({}), Ue("incorrect_content");
|
|
3233
|
-
}, Ln = async () => {
|
|
3234
|
-
const x = {};
|
|
3235
|
-
if (S ? isNaN(Number(S)) && (x.questionId = "ID câu hỏi phải là số") : x.questionId = "Vui lòng nhập ID câu hỏi", k && isNaN(Number(k)) && (x.questionIdChild = "ID câu hỏi con phải là số"), b.trim() || (x.description = "Vui lòng nhập mô tả lỗi"), Object.keys(x).length > 0) {
|
|
3236
|
-
fe(x);
|
|
3237
|
-
return;
|
|
3238
|
-
}
|
|
3239
|
-
W(!0);
|
|
3240
|
-
try {
|
|
3241
|
-
const N = Kn(), Q = await Promise.all(
|
|
3242
|
-
I.map(async (Be) => (await (await fetch("https://lcms.icanwork.vn/api/upload-to-s3/upload-image-error-to-s3", {
|
|
3243
|
-
method: "POST",
|
|
3244
|
-
headers: {
|
|
3245
|
-
"Content-Type": "application/json"
|
|
3246
|
-
},
|
|
3247
|
-
body: JSON.stringify({
|
|
3248
|
-
base64: Be
|
|
3249
|
-
})
|
|
3250
|
-
})).json()).file_url)
|
|
3251
|
-
);
|
|
3252
|
-
await n({
|
|
3253
|
-
idQuestion: S,
|
|
3254
|
-
idChildQuestion: k,
|
|
3255
|
-
errorType: Tt,
|
|
3256
|
-
errorDescription: b,
|
|
3257
|
-
listImage: Q,
|
|
3258
|
-
deviceInfo: N,
|
|
3259
|
-
contextData: t
|
|
3260
|
-
}), rt();
|
|
3261
|
-
} catch (N) {
|
|
3262
|
-
console.error("Submit feedback failed", N);
|
|
3263
|
-
} finally {
|
|
3264
|
-
W(!1);
|
|
3265
|
-
}
|
|
3266
|
-
};
|
|
3267
|
-
return /* @__PURE__ */ A(Ae, { children: [
|
|
3268
|
-
/* @__PURE__ */ C("style", { id: "feedback-widget-styles", children: `
|
|
3269
|
-
@keyframes fb-fade-in {
|
|
3270
|
-
from { opacity: 0; transform: translateY(10px); }
|
|
3271
|
-
to { opacity: 1; transform: translateY(0); }
|
|
3272
|
-
}
|
|
3273
|
-
@keyframes fb-spin {
|
|
3274
|
-
from { transform: rotate(0deg); }
|
|
3275
|
-
to { transform: rotate(360deg); }
|
|
3276
|
-
}
|
|
3277
|
-
.fb-widget-modal {
|
|
3278
|
-
animation: fb-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
3279
|
-
position: fixed;
|
|
3280
|
-
bottom: 80px;
|
|
3281
|
-
right: 24px;
|
|
3282
|
-
z-index: 9999;
|
|
3283
|
-
background: white;
|
|
3284
|
-
padding: 16px;
|
|
3285
|
-
border-radius: 12px;
|
|
3286
|
-
width: 280px;
|
|
3287
|
-
max-width: 90vw;
|
|
3288
|
-
max-height: 80vh;
|
|
3289
|
-
overflow-y: auto;
|
|
3290
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
3291
|
-
border: 1px solid #f3f4f6;
|
|
3292
|
-
display: flex;
|
|
3293
|
-
flex-direction: column;
|
|
3294
|
-
gap: 12px;
|
|
3295
|
-
text-align: left;
|
|
3296
|
-
box-sizing: border-box;
|
|
3297
|
-
}
|
|
3298
|
-
@media (max-width: 640px) {
|
|
3299
|
-
.fb-widget-modal {
|
|
3300
|
-
bottom: 70px !important;
|
|
3301
|
-
right: 5% !important;
|
|
3302
|
-
width: 90% !important;
|
|
3303
|
-
max-height: 70vh !important;
|
|
3304
|
-
}
|
|
3305
|
-
.fb-widget-trigger {
|
|
3306
|
-
bottom: 20px !important;
|
|
3307
|
-
right: 20px !important;
|
|
3308
|
-
}
|
|
3309
|
-
/* Prevent iOS zoom on inputs */
|
|
3310
|
-
input, select, textarea {
|
|
3311
|
-
font-size: 16px !important;
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
@media (max-width: 820px) {
|
|
3315
|
-
.fb-btn-crop {
|
|
3316
|
-
display: none !important;
|
|
3317
|
-
}
|
|
3318
|
-
/* Enforce 16px font on all mobile/tablet inputs to prevent zoom */
|
|
3319
|
-
.fb-widget-modal input,
|
|
3320
|
-
.fb-widget-modal select,
|
|
3321
|
-
.fb-widget-modal textarea {
|
|
3322
|
-
font-size: 16px !important;
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
@media (min-width: 768px) {
|
|
3326
|
-
.fb-btn-upload {
|
|
3327
|
-
|
|
3328
|
-
}
|
|
3329
|
-
}
|
|
3330
|
-
` }),
|
|
3331
|
-
te && /* @__PURE__ */ C(uo, { onConfirm: Dn, onCancel: Fn }),
|
|
3332
|
-
M && /* @__PURE__ */ C(
|
|
3333
|
-
"div",
|
|
3334
|
-
{
|
|
3335
|
-
style: {
|
|
3336
|
-
position: "fixed",
|
|
3337
|
-
inset: 0,
|
|
3338
|
-
backgroundColor: "rgba(0,0,0,0.8)",
|
|
3339
|
-
zIndex: 1e4,
|
|
3340
|
-
display: "flex",
|
|
3341
|
-
alignItems: "center",
|
|
3342
|
-
justifyContent: "center",
|
|
3343
|
-
cursor: "zoom-out",
|
|
3344
|
-
animation: "fb-fade-in 0.2s ease-out",
|
|
3345
|
-
backdropFilter: "blur(4px)"
|
|
3346
|
-
},
|
|
3347
|
-
onClick: () => L(null),
|
|
3348
|
-
children: /* @__PURE__ */ C(
|
|
3349
|
-
"img",
|
|
3350
|
-
{
|
|
3351
|
-
src: M,
|
|
3352
|
-
alt: "Zoomed",
|
|
3353
|
-
draggable: !1,
|
|
3354
|
-
onContextMenu: (x) => x.preventDefault(),
|
|
3355
|
-
style: {
|
|
3356
|
-
maxWidth: "90vw",
|
|
3357
|
-
maxHeight: "90vh",
|
|
3358
|
-
objectFit: "contain",
|
|
3359
|
-
borderRadius: "8px",
|
|
3360
|
-
boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1)",
|
|
3361
|
-
backgroundColor: "white",
|
|
3362
|
-
userSelect: "none",
|
|
3363
|
-
WebkitUserSelect: "none"
|
|
3364
|
-
}
|
|
3365
|
-
}
|
|
3366
|
-
)
|
|
3367
|
-
}
|
|
3368
|
-
),
|
|
3369
|
-
/* @__PURE__ */ C("div", { onClick: () => {
|
|
3370
|
-
o === void 0 ? On() : r && r();
|
|
3371
|
-
}, style: { cursor: "pointer", display: "inline-block" }, children: a || /* @__PURE__ */ C(
|
|
3372
|
-
"button",
|
|
3373
|
-
{
|
|
3374
|
-
className: "fb-widget-trigger",
|
|
3375
|
-
style: {
|
|
3376
|
-
position: "fixed",
|
|
3377
|
-
bottom: "24px",
|
|
3378
|
-
right: "24px",
|
|
3379
|
-
backgroundColor: i,
|
|
3380
|
-
color: "white",
|
|
3381
|
-
border: "none",
|
|
3382
|
-
borderRadius: "50%",
|
|
3383
|
-
width: "48px",
|
|
3384
|
-
height: "48px",
|
|
3385
|
-
display: "flex",
|
|
3386
|
-
alignItems: "center",
|
|
3387
|
-
justifyContent: "center",
|
|
3388
|
-
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
3389
|
-
cursor: "pointer",
|
|
3390
|
-
zIndex: 9990,
|
|
3391
|
-
transition: "transform 0.2s"
|
|
3392
|
-
},
|
|
3393
|
-
title: "Báo lỗi",
|
|
3394
|
-
onMouseEnter: (x) => x.currentTarget.style.transform = "scale(1.1)",
|
|
3395
|
-
onMouseLeave: (x) => x.currentTarget.style.transform = "scale(1)",
|
|
3396
|
-
children: /* @__PURE__ */ C(ro, { size: 24 })
|
|
3397
|
-
}
|
|
3398
|
-
) }),
|
|
3399
|
-
H && /* @__PURE__ */ C("div", { style: { position: "fixed", top: 20, right: 20, background: "rgba(0,0,0,0.8)", color: "white", padding: "8px 12px", borderRadius: "8px", zIndex: 1e4, fontWeight: 500, backdropFilter: "blur(4px)", fontSize: "0.8rem" }, children: "Đang chụp..." }),
|
|
3400
|
-
Rn && !te && !M && /* @__PURE__ */ A("div", { className: "fb-widget-modal", children: [
|
|
3401
|
-
/* @__PURE__ */ A("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3402
|
-
/* @__PURE__ */ C("h2", { style: { margin: 0, fontSize: "1rem", fontWeight: 700, color: "#111827" }, children: "Báo lỗi" }),
|
|
3403
|
-
/* @__PURE__ */ C(
|
|
3404
|
-
"button",
|
|
3405
|
-
{
|
|
3406
|
-
onClick: rt,
|
|
3407
|
-
style: {
|
|
3408
|
-
background: "transparent",
|
|
3409
|
-
border: "none",
|
|
3410
|
-
cursor: "pointer",
|
|
3411
|
-
color: "#6b7280",
|
|
3412
|
-
padding: "4px",
|
|
3413
|
-
display: "flex",
|
|
3414
|
-
alignItems: "center",
|
|
3415
|
-
justifyContent: "center",
|
|
3416
|
-
borderRadius: "50%",
|
|
3417
|
-
transition: "background-color 0.2s"
|
|
3418
|
-
},
|
|
3419
|
-
onMouseEnter: (x) => x.currentTarget.style.backgroundColor = "#f3f4f6",
|
|
3420
|
-
onMouseLeave: (x) => x.currentTarget.style.backgroundColor = "transparent",
|
|
3421
|
-
children: /* @__PURE__ */ C(nn, { size: 18 })
|
|
3422
|
-
}
|
|
3423
|
-
)
|
|
3424
|
-
] }),
|
|
3425
|
-
/* @__PURE__ */ A("div", { style: { display: "flex", flexDirection: "column", gap: "10px" }, children: [
|
|
3426
|
-
/* @__PURE__ */ A("div", { children: [
|
|
3427
|
-
/* @__PURE__ */ A("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
|
|
3428
|
-
"ID Câu hỏi ",
|
|
3429
|
-
t?.questionIdChild ? "bài đọc" : "",
|
|
3430
|
-
" ",
|
|
3431
|
-
/* @__PURE__ */ C("span", { style: { color: "#ef4444" }, children: "*" })
|
|
3432
|
-
] }),
|
|
3433
|
-
/* @__PURE__ */ A("div", { style: {
|
|
3434
|
-
position: "relative",
|
|
3435
|
-
display: "flex",
|
|
3436
|
-
alignItems: "center",
|
|
3437
|
-
transition: "all 0.2s"
|
|
3438
|
-
}, children: [
|
|
3439
|
-
/* @__PURE__ */ C(tn, { size: 12, style: {
|
|
3440
|
-
position: "absolute",
|
|
3441
|
-
left: "10px",
|
|
3442
|
-
color: J === "id" ? i : z.questionId ? "#ef4444" : "#9ca3af",
|
|
3443
|
-
transition: "color 0.2s",
|
|
3444
|
-
pointerEvents: "none"
|
|
3445
|
-
} }),
|
|
3446
|
-
/* @__PURE__ */ C(
|
|
3447
|
-
"input",
|
|
3448
|
-
{
|
|
3449
|
-
type: "text",
|
|
3450
|
-
value: S,
|
|
3451
|
-
onFocus: () => ue("id"),
|
|
3452
|
-
onBlur: () => ue(null),
|
|
3453
|
-
onChange: (x) => {
|
|
3454
|
-
w(x.target.value), z.questionId && fe((N) => ({ ...N, questionId: void 0 }));
|
|
3455
|
-
},
|
|
3456
|
-
disabled: !!e,
|
|
3457
|
-
placeholder: "Nhập ID (ví dụ: 101)",
|
|
3458
|
-
style: {
|
|
3459
|
-
width: "100%",
|
|
3460
|
-
padding: "6px 10px 6px 28px",
|
|
3461
|
-
borderRadius: "6px",
|
|
3462
|
-
border: `1px solid ${z.questionId ? "#ef4444" : J === "id" ? i : "#e5e7eb"}`,
|
|
3463
|
-
boxShadow: J === "id" ? `0 0 0 2px ${i}20` : "none",
|
|
3464
|
-
outline: "none",
|
|
3465
|
-
fontSize: "0.85rem",
|
|
3466
|
-
color: "#1f2937",
|
|
3467
|
-
transition: "all 0.2s",
|
|
3468
|
-
backgroundColor: "#f9fafb"
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
)
|
|
3472
|
-
] }),
|
|
3473
|
-
z.questionId && /* @__PURE__ */ C("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: z.questionId })
|
|
3474
|
-
] }),
|
|
3475
|
-
t?.questionIdChild ? /* @__PURE__ */ A("div", { children: [
|
|
3476
|
-
/* @__PURE__ */ C("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: "ID Câu hỏi" }),
|
|
3477
|
-
/* @__PURE__ */ A("div", { style: {
|
|
3478
|
-
position: "relative",
|
|
3479
|
-
display: "flex",
|
|
3480
|
-
alignItems: "center",
|
|
3481
|
-
transition: "all 0.2s"
|
|
3482
|
-
}, children: [
|
|
3483
|
-
/* @__PURE__ */ C(tn, { size: 12, style: {
|
|
3484
|
-
position: "absolute",
|
|
3485
|
-
left: "10px",
|
|
3486
|
-
color: J === "idChild" ? i : z.questionIdChild ? "#ef4444" : "#9ca3af",
|
|
3487
|
-
transition: "color 0.2s",
|
|
3488
|
-
pointerEvents: "none"
|
|
3489
|
-
} }),
|
|
3490
|
-
/* @__PURE__ */ C(
|
|
3491
|
-
"input",
|
|
3492
|
-
{
|
|
3493
|
-
type: "text",
|
|
3494
|
-
value: k,
|
|
3495
|
-
onFocus: () => ue("idChild"),
|
|
3496
|
-
onBlur: () => ue(null),
|
|
3497
|
-
onChange: (x) => {
|
|
3498
|
-
y(x.target.value);
|
|
3499
|
-
},
|
|
3500
|
-
placeholder: "Nhập ID (ví dụ: 101)",
|
|
3501
|
-
disabled: !!t?.questionIdChild,
|
|
3502
|
-
style: {
|
|
3503
|
-
width: "100%",
|
|
3504
|
-
padding: "6px 10px 6px 28px",
|
|
3505
|
-
borderRadius: "6px",
|
|
3506
|
-
border: `1px solid ${z.questionIdChild ? "#ef4444" : J === "idChild" ? i : "#e5e7eb"}`,
|
|
3507
|
-
boxShadow: J === "idChild" ? `0 0 0 2px ${i}20` : "none",
|
|
3508
|
-
outline: "none",
|
|
3509
|
-
fontSize: "0.85rem",
|
|
3510
|
-
color: "#1f2937",
|
|
3511
|
-
transition: "all 0.2s",
|
|
3512
|
-
backgroundColor: "#f9fafb"
|
|
3513
|
-
}
|
|
3514
|
-
}
|
|
3515
|
-
)
|
|
3516
|
-
] }),
|
|
3517
|
-
z.questionIdChild && /* @__PURE__ */ C("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: z.questionIdChild })
|
|
3518
|
-
] }) : /* @__PURE__ */ C(Ae, {}),
|
|
3519
|
-
/* @__PURE__ */ A("div", { children: [
|
|
3520
|
-
/* @__PURE__ */ A("label", { style: { display: "block", marginBottom: "2px", fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
|
|
3521
|
-
"Loại lỗi ",
|
|
3522
|
-
/* @__PURE__ */ C("span", { style: { color: "#ef4444" }, children: "*" })
|
|
3523
|
-
] }),
|
|
3524
|
-
/* @__PURE__ */ A(
|
|
3525
|
-
"select",
|
|
3526
|
-
{
|
|
3527
|
-
value: Tt,
|
|
3528
|
-
onChange: (x) => Ue(x.target.value),
|
|
3529
|
-
style: {
|
|
3530
|
-
width: "100%",
|
|
3531
|
-
padding: "6px 10px",
|
|
3532
|
-
borderRadius: "6px",
|
|
3533
|
-
border: "1px solid #e5e7eb",
|
|
3534
|
-
backgroundColor: "#f9fafb",
|
|
3535
|
-
fontSize: "0.85rem",
|
|
3536
|
-
color: "#1f2937",
|
|
3537
|
-
outline: "none",
|
|
3538
|
-
cursor: "pointer",
|
|
3539
|
-
appearance: "none",
|
|
3540
|
-
backgroundImage: `url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e")`,
|
|
3541
|
-
backgroundRepeat: "no-repeat",
|
|
3542
|
-
backgroundPosition: "right 10px center",
|
|
3543
|
-
backgroundSize: "14px"
|
|
3544
|
-
},
|
|
3545
|
-
children: [
|
|
3546
|
-
/* @__PURE__ */ C("option", { value: "incorrect_content", children: "Lỗi nội dung" }),
|
|
3547
|
-
/* @__PURE__ */ C("option", { value: "display_error", children: "Lỗi hiển thị" }),
|
|
3548
|
-
/* @__PURE__ */ C("option", { value: "missing_data", children: "Thiếu thông tin" }),
|
|
3549
|
-
/* @__PURE__ */ C("option", { value: "technical_issue", children: "Lỗi kỹ thuật" }),
|
|
3550
|
-
/* @__PURE__ */ C("option", { value: "other", children: "Khác" })
|
|
3551
|
-
]
|
|
3552
|
-
}
|
|
3553
|
-
)
|
|
3554
|
-
] }),
|
|
3555
|
-
/* @__PURE__ */ A("div", { children: [
|
|
3556
|
-
/* @__PURE__ */ A("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "2px" }, children: [
|
|
3557
|
-
/* @__PURE__ */ A("label", { style: { fontSize: "0.8rem", fontWeight: 600, color: "#374151" }, children: [
|
|
3558
|
-
"Mô tả lỗi ",
|
|
3559
|
-
/* @__PURE__ */ C("span", { style: { color: "#ef4444" }, children: "*" })
|
|
3560
|
-
] }),
|
|
3561
|
-
/* @__PURE__ */ A("span", { style: { fontSize: "0.7rem", color: "#9ca3af" }, children: [
|
|
3562
|
-
b.length,
|
|
3563
|
-
"/1000"
|
|
3564
|
-
] })
|
|
3565
|
-
] }),
|
|
3566
|
-
/* @__PURE__ */ A("div", { style: { position: "relative" }, children: [
|
|
3567
|
-
/* @__PURE__ */ C("div", { style: {
|
|
3568
|
-
position: "absolute",
|
|
3569
|
-
left: "10px",
|
|
3570
|
-
top: "8px",
|
|
3571
|
-
pointerEvents: "none"
|
|
3572
|
-
}, children: /* @__PURE__ */ C(lo, { size: 12, style: {
|
|
3573
|
-
color: J === "desc" ? i : z.description ? "#ef4444" : "#9ca3af",
|
|
3574
|
-
transition: "color 0.2s"
|
|
3575
|
-
} }) }),
|
|
3576
|
-
/* @__PURE__ */ C(
|
|
3577
|
-
"textarea",
|
|
3578
|
-
{
|
|
3579
|
-
value: b,
|
|
3580
|
-
onFocus: () => ue("desc"),
|
|
3581
|
-
onBlur: () => ue(null),
|
|
3582
|
-
onChange: (x) => {
|
|
3583
|
-
v(x.target.value), z.description && fe((N) => ({ ...N, description: void 0 }));
|
|
3584
|
-
},
|
|
3585
|
-
maxLength: 1e3,
|
|
3586
|
-
placeholder: "Mô tả chi tiết...",
|
|
3587
|
-
style: {
|
|
3588
|
-
width: "100%",
|
|
3589
|
-
minHeight: "80px",
|
|
3590
|
-
padding: "6px 10px 6px 28px",
|
|
3591
|
-
borderRadius: "6px",
|
|
3592
|
-
border: `1px solid ${z.description ? "#ef4444" : J === "desc" ? i : "#e5e7eb"}`,
|
|
3593
|
-
boxShadow: J === "desc" ? `0 0 0 2px ${i}20` : "none",
|
|
3594
|
-
outline: "none",
|
|
3595
|
-
fontSize: "0.85rem",
|
|
3596
|
-
color: "#1f2937",
|
|
3597
|
-
resize: "vertical",
|
|
3598
|
-
boxSizing: "border-box",
|
|
3599
|
-
transition: "all 0.2s",
|
|
3600
|
-
backgroundColor: "#f9fafb",
|
|
3601
|
-
lineHeight: "1.4",
|
|
3602
|
-
fontFamily: "inherit"
|
|
3603
|
-
}
|
|
3604
|
-
}
|
|
3605
|
-
)
|
|
3606
|
-
] }),
|
|
3607
|
-
z.description && /* @__PURE__ */ C("span", { style: { display: "block", marginTop: "2px", fontSize: "0.7rem", color: "#ef4444" }, children: z.description })
|
|
3608
|
-
] })
|
|
3609
|
-
] }),
|
|
3610
|
-
/* @__PURE__ */ A("div", { style: { marginBottom: "2px" }, children: [
|
|
3611
|
-
/* @__PURE__ */ C("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "6px" }, children: /* @__PURE__ */ A("label", { style: { fontWeight: 600, fontSize: "0.8rem", color: "#374151" }, children: [
|
|
3612
|
-
"Ảnh chụp (",
|
|
3613
|
-
I.length,
|
|
3614
|
-
"/3)"
|
|
3615
|
-
] }) }),
|
|
3616
|
-
I.length > 0 && /* @__PURE__ */ C("div", { style: { display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: "6px", marginBottom: "8px" }, children: I.map((x, N) => /* @__PURE__ */ A("div", { style: {
|
|
3617
|
-
position: "relative",
|
|
3618
|
-
aspectRatio: "16/9",
|
|
3619
|
-
border: "1px solid #e5e7eb",
|
|
3620
|
-
borderRadius: "6px",
|
|
3621
|
-
overflow: "hidden",
|
|
3622
|
-
boxShadow: "0 1px 2px rgba(0,0,0,0.05)"
|
|
3623
|
-
}, children: [
|
|
3624
|
-
/* @__PURE__ */ C(
|
|
3625
|
-
"img",
|
|
3626
|
-
{
|
|
3627
|
-
src: x,
|
|
3628
|
-
alt: `Screenshot ${N + 1}`,
|
|
3629
|
-
draggable: !1,
|
|
3630
|
-
onContextMenu: (Q) => Q.preventDefault(),
|
|
3631
|
-
style: {
|
|
3632
|
-
width: "100%",
|
|
3633
|
-
height: "100%",
|
|
3634
|
-
objectFit: "cover",
|
|
3635
|
-
cursor: "zoom-in",
|
|
3636
|
-
transition: "transform 0.2s",
|
|
3637
|
-
userSelect: "none",
|
|
3638
|
-
WebkitUserSelect: "none"
|
|
3639
|
-
},
|
|
3640
|
-
onClick: () => L(x)
|
|
3641
|
-
}
|
|
3642
|
-
),
|
|
3643
|
-
/* @__PURE__ */ C(
|
|
3644
|
-
"button",
|
|
3645
|
-
{
|
|
3646
|
-
onClick: () => _n(N),
|
|
3647
|
-
title: "Xóa ảnh",
|
|
3648
|
-
style: {
|
|
3649
|
-
position: "absolute",
|
|
3650
|
-
top: "2px",
|
|
3651
|
-
right: "2px",
|
|
3652
|
-
background: "rgba(239, 68, 68, 0.9)",
|
|
3653
|
-
color: "white",
|
|
3654
|
-
border: "none",
|
|
3655
|
-
borderRadius: "50%",
|
|
3656
|
-
width: "16px",
|
|
3657
|
-
height: "16px",
|
|
3658
|
-
display: "flex",
|
|
3659
|
-
alignItems: "center",
|
|
3660
|
-
justifyContent: "center",
|
|
3661
|
-
cursor: "pointer",
|
|
3662
|
-
padding: 0,
|
|
3663
|
-
boxShadow: "0 1px 2px rgba(0,0,0,0.2)"
|
|
3664
|
-
},
|
|
3665
|
-
children: /* @__PURE__ */ C(nn, { size: 10 })
|
|
3666
|
-
}
|
|
3667
|
-
)
|
|
3668
|
-
] }, N)) }),
|
|
3669
|
-
/* @__PURE__ */ A("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
3670
|
-
/* @__PURE__ */ C(
|
|
3671
|
-
"input",
|
|
3672
|
-
{
|
|
3673
|
-
type: "file",
|
|
3674
|
-
ref: It,
|
|
3675
|
-
style: { display: "none" },
|
|
3676
|
-
accept: "image/*",
|
|
3677
|
-
onChange: Mn
|
|
3678
|
-
}
|
|
3679
|
-
),
|
|
3680
|
-
d ? /* @__PURE__ */ A(
|
|
3681
|
-
"button",
|
|
3682
|
-
{
|
|
3683
|
-
onClick: () => At("full"),
|
|
3684
|
-
style: {
|
|
3685
|
-
flex: 1,
|
|
3686
|
-
padding: "12px",
|
|
3687
|
-
textAlign: "center",
|
|
3688
|
-
background: "white",
|
|
3689
|
-
border: "1px dashed #d1d5db",
|
|
3690
|
-
borderRadius: "8px",
|
|
3691
|
-
color: "#4b5563",
|
|
3692
|
-
cursor: "pointer",
|
|
3693
|
-
display: "flex",
|
|
3694
|
-
flexDirection: "column",
|
|
3695
|
-
alignItems: "center",
|
|
3696
|
-
gap: "4px",
|
|
3697
|
-
transition: "all 0.2s",
|
|
3698
|
-
minWidth: "60px"
|
|
3699
|
-
// Prevent squishing
|
|
3700
|
-
},
|
|
3701
|
-
onMouseOver: (x) => {
|
|
3702
|
-
x.currentTarget.style.borderColor = i, x.currentTarget.style.color = i, x.currentTarget.style.backgroundColor = "#f9fafb";
|
|
3703
|
-
},
|
|
3704
|
-
onMouseOut: (x) => {
|
|
3705
|
-
x.currentTarget.style.borderColor = "#d1d5db", x.currentTarget.style.color = "#4b5563", x.currentTarget.style.backgroundColor = "white";
|
|
3706
|
-
},
|
|
3707
|
-
children: [
|
|
3708
|
-
/* @__PURE__ */ C(so, { size: 18 }),
|
|
3709
|
-
/* @__PURE__ */ C("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Toàn màn hình" })
|
|
3710
|
-
]
|
|
3711
|
-
}
|
|
3712
|
-
) : /* @__PURE__ */ C(Ae, {}),
|
|
3713
|
-
p ? /* @__PURE__ */ A(
|
|
3714
|
-
"button",
|
|
3715
|
-
{
|
|
3716
|
-
onClick: () => At("crop"),
|
|
3717
|
-
className: "fb-btn-crop",
|
|
3718
|
-
style: {
|
|
3719
|
-
flex: 1,
|
|
3720
|
-
padding: "12px",
|
|
3721
|
-
textAlign: "center",
|
|
3722
|
-
background: "white",
|
|
3723
|
-
border: "1px dashed #d1d5db",
|
|
3724
|
-
borderRadius: "8px",
|
|
3725
|
-
color: "#4b5563",
|
|
3726
|
-
cursor: "pointer",
|
|
3727
|
-
display: "flex",
|
|
3728
|
-
flexDirection: "column",
|
|
3729
|
-
alignItems: "center",
|
|
3730
|
-
gap: "4px",
|
|
3731
|
-
transition: "all 0.2s",
|
|
3732
|
-
minWidth: "60px"
|
|
3733
|
-
},
|
|
3734
|
-
onMouseOver: (x) => {
|
|
3735
|
-
x.currentTarget.style.borderColor = i, x.currentTarget.style.color = i, x.currentTarget.style.backgroundColor = "#f9fafb";
|
|
3736
|
-
},
|
|
3737
|
-
onMouseOut: (x) => {
|
|
3738
|
-
x.currentTarget.style.borderColor = "#d1d5db", x.currentTarget.style.color = "#4b5563", x.currentTarget.style.backgroundColor = "white";
|
|
3739
|
-
},
|
|
3740
|
-
children: [
|
|
3741
|
-
/* @__PURE__ */ C(Qr, { size: 18 }),
|
|
3742
|
-
/* @__PURE__ */ C("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Chọn vùng" })
|
|
3743
|
-
]
|
|
3744
|
-
}
|
|
3745
|
-
) : /* @__PURE__ */ C(Ae, {}),
|
|
3746
|
-
/* @__PURE__ */ A(
|
|
3747
|
-
"button",
|
|
3748
|
-
{
|
|
3749
|
-
onClick: Nn,
|
|
3750
|
-
className: "fb-btn-upload",
|
|
3751
|
-
style: {
|
|
3752
|
-
flex: 1,
|
|
3753
|
-
padding: "12px",
|
|
3754
|
-
textAlign: "center",
|
|
3755
|
-
background: "white",
|
|
3756
|
-
border: "1px dashed #d1d5db",
|
|
3757
|
-
borderRadius: "8px",
|
|
3758
|
-
color: "#4b5563",
|
|
3759
|
-
cursor: "pointer",
|
|
3760
|
-
display: "flex",
|
|
3761
|
-
flexDirection: "column",
|
|
3762
|
-
alignItems: "center",
|
|
3763
|
-
gap: "4px",
|
|
3764
|
-
transition: "all 0.2s",
|
|
3765
|
-
minWidth: "60px"
|
|
3766
|
-
},
|
|
3767
|
-
onMouseOver: (x) => {
|
|
3768
|
-
x.currentTarget.style.borderColor = i, x.currentTarget.style.color = i, x.currentTarget.style.backgroundColor = "#f9fafb";
|
|
3769
|
-
},
|
|
3770
|
-
onMouseOut: (x) => {
|
|
3771
|
-
x.currentTarget.style.borderColor = "#d1d5db", x.currentTarget.style.color = "#4b5563", x.currentTarget.style.backgroundColor = "white";
|
|
3772
|
-
},
|
|
3773
|
-
children: [
|
|
3774
|
-
/* @__PURE__ */ C(eo, { size: 18 }),
|
|
3775
|
-
/* @__PURE__ */ C("span", { style: { fontSize: "0.8rem", fontWeight: 500 }, children: "Chọn ảnh" })
|
|
3776
|
-
]
|
|
3777
|
-
}
|
|
3778
|
-
)
|
|
3779
|
-
] })
|
|
3780
|
-
] }),
|
|
3781
|
-
/* @__PURE__ */ A("div", { style: { display: "flex", justifyContent: "flex-end", gap: "8px", marginTop: "auto", paddingTop: "8px", borderTop: "1px solid #f3f4f6" }, children: [
|
|
3782
|
-
/* @__PURE__ */ C(
|
|
3783
|
-
"button",
|
|
3784
|
-
{
|
|
3785
|
-
onClick: rt,
|
|
3786
|
-
disabled: _,
|
|
3787
|
-
style: {
|
|
3788
|
-
padding: "8px 16px",
|
|
3789
|
-
borderRadius: "8px",
|
|
3790
|
-
border: "1px solid #d1d5db",
|
|
3791
|
-
background: "white",
|
|
3792
|
-
cursor: "pointer",
|
|
3793
|
-
color: "#374151",
|
|
3794
|
-
fontWeight: 500,
|
|
3795
|
-
fontSize: "0.85rem",
|
|
3796
|
-
transition: "background-color 0.2s"
|
|
3797
|
-
},
|
|
3798
|
-
onMouseEnter: (x) => x.currentTarget.style.background = "#f9fafb",
|
|
3799
|
-
onMouseLeave: (x) => x.currentTarget.style.background = "white",
|
|
3800
|
-
children: "Hủy bỏ"
|
|
3801
|
-
}
|
|
3802
|
-
),
|
|
3803
|
-
/* @__PURE__ */ C(
|
|
3804
|
-
"button",
|
|
3805
|
-
{
|
|
3806
|
-
onClick: Ln,
|
|
3807
|
-
disabled: _,
|
|
3808
|
-
style: {
|
|
3809
|
-
padding: "8px 16px",
|
|
3810
|
-
borderRadius: "8px",
|
|
3811
|
-
border: "none",
|
|
3812
|
-
background: i,
|
|
3813
|
-
color: "white",
|
|
3814
|
-
cursor: _ ? "not-allowed" : "pointer",
|
|
3815
|
-
fontWeight: 600,
|
|
3816
|
-
fontSize: "0.85rem",
|
|
3817
|
-
opacity: _ ? 0.7 : 1,
|
|
3818
|
-
boxShadow: "0 2px 4px -1px rgba(0, 0, 0, 0.1)",
|
|
3819
|
-
transition: "transform 0.1s, opacity 0.2s"
|
|
3820
|
-
},
|
|
3821
|
-
onMouseDown: (x) => !_ && (x.currentTarget.style.transform = "scale(0.98)"),
|
|
3822
|
-
onMouseUp: (x) => !_ && (x.currentTarget.style.transform = "scale(1)"),
|
|
3823
|
-
children: _ ? /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
3824
|
-
/* @__PURE__ */ C(no, { size: 16, style: { animation: "fb-spin 1s linear infinite" } }),
|
|
3825
|
-
/* @__PURE__ */ C("span", { children: "Đang gửi..." })
|
|
3826
|
-
] }) : "Gửi báo lỗi"
|
|
3827
|
-
}
|
|
3828
|
-
)
|
|
3829
|
-
] })
|
|
3830
|
-
] })
|
|
3831
|
-
] });
|
|
3832
|
-
}, In = Un(void 0), wo = () => {
|
|
3833
|
-
const e = zn(In);
|
|
3834
|
-
if (!e)
|
|
3835
|
-
throw new Error("useFeedback must be used within a FeedbackProvider");
|
|
3836
|
-
return e;
|
|
3837
|
-
}, bo = ({
|
|
3838
|
-
children: e,
|
|
3839
|
-
onSubmit: t,
|
|
3840
|
-
themeColor: n
|
|
3841
|
-
}) => {
|
|
3842
|
-
const [i, a] = F(!1), [o, r] = F(null), [s, d] = F(void 0), p = (m, b) => {
|
|
3843
|
-
r(m), d(b), a(!0);
|
|
3844
|
-
}, l = () => {
|
|
3845
|
-
a(!1);
|
|
3846
|
-
};
|
|
3847
|
-
return /* @__PURE__ */ A(In.Provider, { value: { openFeedback: p, closeFeedback: l, isOpen: i, activeQuestionId: o }, children: [
|
|
3848
|
-
e,
|
|
3849
|
-
o && /* @__PURE__ */ C(
|
|
3850
|
-
fo,
|
|
3851
|
-
{
|
|
3852
|
-
questionId: o,
|
|
3853
|
-
contextData: s,
|
|
3854
|
-
onSubmit: t,
|
|
3855
|
-
themeColor: n,
|
|
3856
|
-
isOpen: i,
|
|
3857
|
-
onClose: l,
|
|
3858
|
-
triggerComponent: /* @__PURE__ */ C(Ae, {})
|
|
3859
|
-
}
|
|
3860
|
-
)
|
|
3861
|
-
] });
|
|
3862
|
-
};
|
|
3863
|
-
export {
|
|
3864
|
-
bo as FeedbackProvider,
|
|
3865
|
-
fo as FeedbackWidget,
|
|
3866
|
-
wo as useFeedback
|
|
3867
|
-
};
|