nhanh-pure-function 3.0.5 → 3.0.6-beta.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/dist/index.es.js DELETED
@@ -1,1501 +0,0 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
2
- var at = Object.defineProperty;
3
- var et = (n) => {
4
- throw TypeError(n);
5
- };
6
- var lt = (n, e, t) => e in n ? at(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
7
- var C = (n, e, t) => lt(n, typeof e != "symbol" ? e + "" : e, t), nt = (n, e, t) => e.has(n) || et("Cannot " + t);
8
- var u = (n, e, t) => (nt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), f = (n, e, t) => e.has(n) ? et("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), m = (n, e, t, i) => (nt(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t);
9
- const ut = {
10
- ".mp3": "audio/mpeg",
11
- ".mp4": "video/mp4",
12
- ".m4a": "audio/mp4",
13
- ".aac": "audio/aac",
14
- ".ogg": "audio/ogg",
15
- ".wav": "audio/wav",
16
- ".flac": "audio/flac",
17
- ".opus": "audio/opus",
18
- ".webm": "video/webm",
19
- ".avi": "video/x-msvideo",
20
- ".mov": "video/quicktime",
21
- ".wmv": "video/x-ms-wmv",
22
- ".png": "image/png",
23
- ".jpg": "image/jpeg",
24
- ".jpeg": "image/jpeg",
25
- ".gif": "image/gif",
26
- ".bmp": "image/bmp",
27
- ".tiff": "image/tiff",
28
- ".ico": "image/vnd.microsoft.icon",
29
- ".svg": "image/svg+xml",
30
- ".webp": "image/webp",
31
- ".heif": "image/heif",
32
- ".heic": "image/heic",
33
- ".json": "application/json",
34
- ".xml": "application/xml",
35
- ".html": "text/html",
36
- ".htm": "text/html",
37
- ".css": "text/css",
38
- ".js": "application/javascript",
39
- ".ts": "application/typescript",
40
- ".csv": "text/csv",
41
- ".tsv": "text/tab-separated-values",
42
- ".txt": "text/plain",
43
- ".md": "text/markdown",
44
- ".rtf": "application/rtf",
45
- ".pdf": "application/pdf",
46
- ".zip": "application/zip",
47
- ".rar": "application/x-rar-compressed",
48
- ".tar": "application/x-tar",
49
- ".gz": "application/gzip",
50
- ".7z": "application/x-7z-compressed",
51
- ".exe": "application/x-msdownload",
52
- ".apk": "application/vnd.android.package-archive",
53
- ".doc": "application/msword",
54
- ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
55
- ".xls": "application/vnd.ms-excel",
56
- ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
57
- ".ppt": "application/vnd.ms-powerpoint",
58
- ".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
59
- ".odt": "application/vnd.oasis.opendocument.text",
60
- ".ods": "application/vnd.oasis.opendocument.spreadsheet",
61
- ".odp": "application/vnd.oasis.opendocument.presentation",
62
- ".jsonld": "application/ld+json",
63
- ".yaml": "application/x-yaml",
64
- ".yml": "application/x-yaml",
65
- ".woff": "font/woff",
66
- ".woff2": "font/woff2",
67
- ".ttf": "font/ttf",
68
- ".otf": "font/otf",
69
- ".eot": "application/vnd.ms-fontobject",
70
- ".map": "application/json"
71
- }, Q = {
72
- image: [
73
- ".jpg",
74
- ".jpeg",
75
- ".png",
76
- ".gif",
77
- ".bmp",
78
- ".webp",
79
- ".tiff",
80
- ".svg",
81
- ".heif",
82
- ".heic",
83
- ".ico",
84
- ".raw",
85
- ".jfif",
86
- ".avif",
87
- ".png8",
88
- ".indd",
89
- ".eps",
90
- ".ai"
91
- ],
92
- ppt: [".ppt", ".pptx", ".odp"],
93
- word: [".doc", ".docx", ".odt", ".rtf"],
94
- excel: [".xls", ".xlsx", ".ods", ".csv", ".tsv"],
95
- pdf: [".pdf"],
96
- text: [
97
- ".txt",
98
- ".csv",
99
- ".md",
100
- ".json",
101
- ".yaml",
102
- ".yml",
103
- ".log",
104
- ".ini",
105
- ".rtf"
106
- ],
107
- audio: [
108
- ".mp3",
109
- ".wav",
110
- ".ogg",
111
- ".flac",
112
- ".aac",
113
- ".wma",
114
- ".m4a",
115
- ".alac",
116
- ".ape",
117
- ".opus",
118
- ".amr",
119
- ".ra",
120
- ".mid",
121
- ".midi",
122
- ".aiff",
123
- ".pcm",
124
- ".au",
125
- ".wavpack",
126
- ".spx"
127
- ],
128
- video: [
129
- ".mp4",
130
- ".avi",
131
- ".mkv",
132
- ".mov",
133
- ".wmv",
134
- ".flv",
135
- ".webm",
136
- ".mpg",
137
- ".mpeg",
138
- ".3gp",
139
- ".vob",
140
- ".ogv",
141
- ".m4v",
142
- ".ts",
143
- ".rm",
144
- ".rmvb",
145
- ".m2ts",
146
- ".divx",
147
- ".xvid",
148
- ".swf",
149
- ".f4v"
150
- ],
151
- archive: [
152
- ".zip",
153
- ".rar",
154
- ".tar",
155
- ".gz",
156
- ".bz2",
157
- ".xz",
158
- ".7z",
159
- ".tar.gz",
160
- ".tar.bz2",
161
- ".tar.xz",
162
- ".tar.lz",
163
- ".tar.lzma",
164
- ".cab",
165
- ".iso",
166
- ".dmg",
167
- ".tgz",
168
- ".apk",
169
- ".gz2",
170
- ".tar.zst"
171
- ],
172
- code: [
173
- ".js",
174
- ".ts",
175
- ".py",
176
- ".java",
177
- ".cpp",
178
- ".c",
179
- ".html",
180
- ".css",
181
- ".scss",
182
- ".less",
183
- ".sass",
184
- ".php",
185
- ".rb",
186
- ".go",
187
- ".swift",
188
- ".rs",
189
- ".kt",
190
- ".scala",
191
- ".lua",
192
- ".pl",
193
- ".m",
194
- ".h",
195
- ".xml",
196
- ".json",
197
- ".yaml",
198
- ".yml",
199
- ".toml",
200
- ".vue",
201
- ".ejs",
202
- ".handlebars",
203
- ".jinja",
204
- ".dart"
205
- ],
206
- font: [
207
- ".woff",
208
- ".woff2",
209
- ".ttf",
210
- ".otf",
211
- ".eot",
212
- ".svg",
213
- ".ttc",
214
- ".fnt",
215
- ".fon",
216
- ".otc"
217
- ],
218
- database: [
219
- ".sql",
220
- ".sqlite",
221
- ".db",
222
- ".mdb",
223
- ".accdb",
224
- ".jsonld",
225
- ".xml",
226
- ".csv"
227
- ],
228
- markup: [".html", ".htm", ".xhtml", ".xml", ".json", ".yaml", ".yml"],
229
- configuration: [
230
- ".ini",
231
- ".conf",
232
- ".cfg",
233
- ".env",
234
- ".properties",
235
- ".json",
236
- ".toml"
237
- ],
238
- logs: [".log", ".err", ".trace", ".out"],
239
- script: [
240
- ".bash",
241
- ".sh",
242
- ".zsh",
243
- ".bat",
244
- ".ps1",
245
- ".vbs",
246
- ".cmd",
247
- ".sed",
248
- ".awk",
249
- ".php"
250
- ]
251
- }, it = [
252
- "",
253
- "万",
254
- "亿",
255
- "兆",
256
- "京",
257
- "垓",
258
- "秭",
259
- "穰",
260
- "沟",
261
- "涧",
262
- "正",
263
- "载",
264
- "极"
265
- ], _t = ["_self", "_blank", "_parent", "_top"], st = {
266
- // 北美标准尺寸 (毫米)
267
- Letter: { width: 215.9, height: 279.4 },
268
- // 8.5 × 11 英寸
269
- Legal: { width: 215.9, height: 355.6 },
270
- // 8.5 × 14 英寸
271
- Tabloid: { width: 279.4, height: 431.8 },
272
- // 11 × 17 英寸
273
- Ledger: { width: 431.8, height: 279.4 },
274
- // 17 × 11 英寸
275
- Executive: { width: 184.2, height: 266.7 },
276
- // 7.25 × 10.5 英寸
277
- // 其他常见尺寸
278
- Folio: { width: 215.9, height: 330.2 },
279
- // 8.5 × 13 英寸
280
- Quarto: { width: 215, height: 275 },
281
- // 8.46 × 10.83 英寸
282
- "Government-Letter": { width: 203.2, height: 266.7 },
283
- // 8 × 10.5 英寸
284
- // ISO A系列 (毫米)
285
- A0: { width: 841, height: 1189 },
286
- A1: { width: 594, height: 841 },
287
- A2: { width: 420, height: 594 },
288
- A3: { width: 297, height: 420 },
289
- A4: { width: 210, height: 297 },
290
- A5: { width: 148, height: 210 },
291
- A6: { width: 105, height: 148 },
292
- A7: { width: 74, height: 105 },
293
- A8: { width: 52, height: 74 },
294
- A9: { width: 37, height: 52 },
295
- A10: { width: 26, height: 37 },
296
- // ISO B系列 (毫米)
297
- B0: { width: 1e3, height: 1414 },
298
- B1: { width: 707, height: 1e3 },
299
- B2: { width: 500, height: 707 },
300
- B3: { width: 353, height: 500 },
301
- B4: { width: 250, height: 353 },
302
- B5: { width: 176, height: 250 },
303
- B6: { width: 125, height: 176 },
304
- B7: { width: 88, height: 125 },
305
- B8: { width: 62, height: 88 },
306
- B9: { width: 44, height: 62 },
307
- B10: { width: 31, height: 44 },
308
- // ISO C系列 (信封尺寸,毫米)
309
- C0: { width: 917, height: 1297 },
310
- C1: { width: 648, height: 917 },
311
- C2: { width: 458, height: 648 },
312
- C3: { width: 324, height: 458 },
313
- C4: { width: 229, height: 324 },
314
- C5: { width: 162, height: 229 },
315
- C6: { width: 114, height: 162 },
316
- C7: { width: 81, height: 114 },
317
- C8: { width: 57, height: 81 }
318
- }, Et = Object.keys(st).map(
319
- (n) => ({
320
- value: n,
321
- label: n
322
- })
323
- );
324
- function Mt(n, e = 500) {
325
- let t, i = !0;
326
- function o(r) {
327
- if (!i) return;
328
- t || (t = r);
329
- let c = Math.min((r - t) / e, 1);
330
- n(c), r - t < e && requestAnimationFrame(o);
331
- }
332
- return requestAnimationFrame(o), () => i = !1;
333
- }
334
- function Ct(n, e, t, i, o = 2) {
335
- let r = n, c = !1, s = 1, a = n, l = e, h = t;
336
- const d = () => {
337
- const v = (l - a) / h;
338
- return Number(v.toFixed(o));
339
- };
340
- let p = d();
341
- const y = (v) => Math.min(Math.max(v, a), l), w = (v) => Number(v.toFixed(o)), P = (v, H, G) => {
342
- const I = [];
343
- return v >= H && I.push("最小值必须小于最大值"), G <= 0 ? I.push("分段数必须为正数") : d() == 0 && I.push("数值精度过低,致使动画步长为 0"), I;
344
- }, k = (v, H, G) => {
345
- const I = P(v, H, G);
346
- return I.length > 0 ? (console.error(`参数更新失败: ${I.join("; ")}`), !1) : (a = v, l = H, h = G, p = d(), r = y(r), !0);
347
- }, W = () => {
348
- c && (s = r >= l ? -1 : r <= a ? 1 : s, r = y(r + p * s), i(w(r)), requestAnimationFrame(W));
349
- };
350
- return {
351
- /** 启动/继续动画 */
352
- play(v = r) {
353
- if (r = y(v), P(a, l, h).length)
354
- return console.error("配置参数错误", this.getParams());
355
- c || (c = !0, W());
356
- },
357
- /** 暂停动画 */
358
- pause() {
359
- c = !1;
360
- },
361
- /** 获取当前值 */
362
- getCurrent: () => w(r),
363
- /** 是否正在运行 */
364
- isPlaying: () => c,
365
- /** 更新参数(不中断动画) */
366
- updateParams: k,
367
- /** 获取当前参数 */
368
- getParams: () => ({ min: a, max: l, steps: h, precision: o, stepSize: p })
369
- };
370
- }
371
- function Ft(n, e, t, i, o = 2) {
372
- if (t <= 0) return console.error("动画步数 必须为正数");
373
- const r = (d) => Number(d.toFixed(o)), c = e - n, s = r(Math.abs(c) / t);
374
- if (s === 0) return console.error("数值精度过低,致使动画步长为 0");
375
- const a = Math.sign(c);
376
- let l = n;
377
- const h = () => {
378
- l = r(l + s * a), (a > 0 ? l < e : l > e) ? (i(l), requestAnimationFrame(h)) : i(e);
379
- };
380
- h();
381
- }
382
- function Lt(n, e = "image/png") {
383
- try {
384
- let t, i = e;
385
- if (n instanceof File)
386
- return URL.createObjectURL(n);
387
- if (typeof n == "string") {
388
- let r = n;
389
- const c = r.match(/^data:([^;]*)(;base64)?,(.*)$/i);
390
- if (c) {
391
- if (!c[2])
392
- return console.error("无效的数据 URL:缺少 base64 编码声明");
393
- if (i = c[1] || i, r = c[3], !r)
394
- return console.error("数据 URL 包含空有效负载");
395
- }
396
- r = r.replace(/[^A-Za-z0-9+/=]/g, "");
397
- const s = atob(r);
398
- t = new Uint8Array(s.length);
399
- for (let a = 0; a < s.length; a++)
400
- t[a] = s.charCodeAt(a);
401
- } else if (n instanceof ArrayBuffer)
402
- t = new Uint8Array(n);
403
- else if (n instanceof Uint8Array)
404
- t = n;
405
- else
406
- return console.error(
407
- "不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array"
408
- );
409
- const o = new Blob([t], { type: i });
410
- return URL.createObjectURL(o);
411
- } catch (t) {
412
- return console.error(
413
- "数据到 ImageURL 的转换失败:",
414
- t.message,
415
- t.stack || "没有可用的堆栈跟踪"
416
- ), null;
417
- }
418
- }
419
- function Pt(n, e = 10) {
420
- let t = 0, i = e;
421
- function o() {
422
- if (i > 0)
423
- i--, requestAnimationFrame(o);
424
- else {
425
- const c = (+/* @__PURE__ */ new Date() - t) / e, s = 1e3 / c;
426
- n(Number(s.toFixed(2)), Number(c.toFixed(2)));
427
- }
428
- }
429
- requestAnimationFrame(() => {
430
- t = +/* @__PURE__ */ new Date(), o();
431
- });
432
- }
433
- function Tt(n) {
434
- const e = () => Promise.resolve(), t = (s) => (console.error(s), Promise.reject(s));
435
- function i() {
436
- return navigator.clipboard.writeText(n).then(e).catch(t);
437
- }
438
- function o() {
439
- const s = document.createElement("div");
440
- s.innerText = n, document.body.appendChild(s);
441
- const a = document.createRange();
442
- a.selectNodeContents(s);
443
- const l = window.getSelection();
444
- let h = !1;
445
- return l && (l.removeAllRanges(), l.addRange(a), h = document.execCommand("copy")), document.body.removeChild(s), h ? Promise.resolve() : Promise.reject();
446
- }
447
- function r() {
448
- const s = document.createElement("textarea");
449
- s.value = n, document.body.appendChild(s), s.select(), s.setSelectionRange(0, n.length);
450
- let a = !1;
451
- return document.activeElement === s && (a = document.execCommand("Copy", !0)), document.body.removeChild(s), a ? Promise.resolve() : Promise.reject();
452
- }
453
- function c() {
454
- return o().then(e).catch(() => {
455
- r().then(e).catch(() => t("复制方式尽皆失效"));
456
- });
457
- }
458
- return navigator.clipboard ? i().catch(c) : c();
459
- }
460
- class ht {
461
- /** 请使用静态方法 */
462
- constructor() {
463
- }
464
- /** 添加已有窗口 */
465
- static add(e, t) {
466
- this.keys.set(e, t);
467
- }
468
- /**
469
- * 根据键打开或聚焦窗口
470
- * @param key 窗口的唯一键
471
- * @param url 要打开的URL
472
- * @param target 窗口的目标
473
- * @param windowFeatures 新窗口的特性
474
- * @returns 返回已打开或新打开的窗口
475
- */
476
- static open(e, t, i, o) {
477
- const r = this.keys.get(e);
478
- if (r && !r.closed)
479
- return r.focus(), r;
480
- {
481
- const c = window.open(t, i, o);
482
- if (c)
483
- return this.keys.set(e, c), c;
484
- console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(e);
485
- }
486
- }
487
- /**
488
- * 检查指定键的窗口是否打开
489
- * @param key 窗口的唯一键
490
- * @returns 如果窗口打开则返回true,否则返回false
491
- */
492
- static isOpen(e) {
493
- const t = this.keys.get(e);
494
- return t != null && t.closed && this.keys.delete(e), this.keys.has(e);
495
- }
496
- /**
497
- * 获取与指定键关联的窗口
498
- * @param key 窗口的唯一键
499
- * @returns 返回对应的窗口,如果窗口已关闭则返回undefined
500
- */
501
- static getWindow(e) {
502
- if (this.isOpen(e)) return this.keys.get(e);
503
- }
504
- /**
505
- * 关闭与指定键关联的窗口
506
- * @param key 窗口的唯一键
507
- */
508
- static close(e) {
509
- const t = this.keys.get(e);
510
- t && (t.close(), this.keys.delete(e));
511
- }
512
- /**
513
- * 关闭所有打开的窗口并清空Map
514
- */
515
- static closeAll() {
516
- this.keys.forEach((e, t) => e.close()), this.keys.clear();
517
- }
518
- }
519
- // 存储键与对应窗口的Map
520
- C(ht, "keys", /* @__PURE__ */ new Map());
521
- function At(n, e) {
522
- const t = st[n];
523
- if (!t) throw new Error(`未知纸张类型: ${n}`);
524
- const { width: i, height: o } = t, r = (w) => w / 25.4, s = typeof window < "u" ? window.devicePixelRatio * 96 : 300, a = (w) => Math.round(r(w) * s), l = a(i), h = a(o), d = a(e), p = Math.max(0, l - 2 * d), y = Math.max(0, h - 2 * d);
525
- return {
526
- /** 内容宽度(像素) */
527
- contentWidth: p,
528
- /** 内容高度(像素) */
529
- contentHeight: y,
530
- /** 边距(像素) */
531
- paddingPx: d,
532
- /** 纸张宽度(像素) */
533
- paperWidthPx: l,
534
- /** 纸张高度(像素) */
535
- paperHeightPx: h
536
- };
537
- }
538
- function It(n) {
539
- return n.charAt(0).toUpperCase() + n.slice(1);
540
- }
541
- function Rt(n, e, t = 2) {
542
- return !Number.isFinite(n) || !Number.isFinite(e) || !Number.isFinite(t) ? (console.error("所有参数必须是有限的数字"), "") : e === 0 ? (console.error("分母不能为零"), "") : t < 0 ? (console.error("小数位数不能为负数"), "") : (n / e * 100).toFixed(t) + "%";
543
- }
544
- function St(n) {
545
- const t = n.toString().split("."), i = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
546
- return t.length > 1 ? i + "." + t[1] : i;
547
- }
548
- function jt(n, e) {
549
- const t = {
550
- join: !0,
551
- suffix: "",
552
- decimalPlaces: 2
553
- }, { join: i, suffix: o, decimalPlaces: r } = {
554
- ...t,
555
- ...e || {}
556
- }, c = Number(n);
557
- if (isNaN(c)) return i ? `0${o}` : [0, o];
558
- const s = Math.abs(c), a = c >= 0, l = Math.max(0, Math.floor(Math.log10(s) / 4)), h = Math.pow(1e4, l), d = s / h, p = (a ? 1 : -1) * parseFloat(d.toFixed(Math.max(0, r)));
559
- return i ? `${p}${it[l]}${o}` : [p, it[l] + o];
560
- }
561
- function Ut(n) {
562
- const e = ["B", "KB", "MB", "GB", "TB", "PB"];
563
- let t = 0;
564
- for (; n > 1024; )
565
- n /= 1024, t++;
566
- return `${Math.round(n * 100) / 100} ${e[t]}`;
567
- }
568
- function kt(n, e = "YYYY-MM-DD hh:mm:ss", t = !0) {
569
- const i = new Date(n);
570
- if (isNaN(i.getTime()))
571
- return console.error("Invalid date"), "";
572
- const o = {
573
- YYYY: (r) => r.getFullYear(),
574
- MM: (r) => r.getMonth() + 1,
575
- // Adjust for 0-based month
576
- DD: (r) => r.getDate(),
577
- hh: (r) => r.getHours(),
578
- mm: (r) => r.getMinutes(),
579
- ss: (r) => r.getSeconds(),
580
- ms: (r) => r.getMilliseconds()
581
- };
582
- return e.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (r) => {
583
- const c = o[r](i);
584
- return t ? String(c).padStart(2, "0") : String(c);
585
- });
586
- }
587
- function J(n, e = "file") {
588
- if (!n || (n = String(n).trim(), n === "")) return e;
589
- const t = n.split("/");
590
- return t[t.length - 1].split("?")[0];
591
- }
592
- function Ot(n, e) {
593
- return n = n.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), e ? n.replace(/[^a-zA-Z]+/g, "") : n;
594
- }
595
- function Dt(n, e, t = ",") {
596
- const i = new RegExp(
597
- `(^|${t})${e}(${t}|$)`,
598
- "g"
599
- );
600
- return n.replace(i, function(o, r, c) {
601
- return r === c ? t : "";
602
- });
603
- }
604
- function zt(n) {
605
- return !(n === null || typeof n != "object" || Array.isArray(n));
606
- }
607
- function mt(n, e = 2) {
608
- if (Array.isArray(n) && n.length >= e) {
609
- for (let i = 0; i < n.length; i++)
610
- if (typeof n[i] != "number" || !Number.isFinite(n[i])) return !1;
611
- } else return !1;
612
- return !0;
613
- }
614
- function Nt(n, e = 1, t = 2) {
615
- if (Array.isArray(n) && n.length >= e) {
616
- for (let o = 0; o < n.length; o++)
617
- if (!mt(n[o], t)) return !1;
618
- } else return !1;
619
- return !0;
620
- }
621
- function Bt(n, e, t) {
622
- return Math.abs(n - e) <= t;
623
- }
624
- function qt(n, e) {
625
- let t = !1;
626
- const { x: i, y: o } = n, r = e.length;
627
- for (let c = 0, s = r - 1; c < r; s = c++) {
628
- const a = e[c].x, l = e[c].y, h = e[s].x, d = e[s].y;
629
- l > o != d > o && i < (h - a) * (o - l) / (d - l) + a && (t = !t);
630
- }
631
- return t;
632
- }
633
- function $t(n, e, t, i) {
634
- const o = Math.min(n[0], e[0]), r = Math.max(n[0], e[0]), c = Math.min(n[1], e[1]), s = Math.max(n[1], e[1]), a = [
635
- [o, c],
636
- // 左上
637
- [r, c],
638
- // 右上
639
- [r, s],
640
- // 右下
641
- [o, s]
642
- // 左下
643
- ], l = i[1] - t[1], h = t[0] - i[0], d = i[0] * t[1] - t[0] * i[1];
644
- if (l === 0 && h === 0) {
645
- const [P, k] = t;
646
- return P >= o && P <= r && k >= c && k <= s;
647
- }
648
- const p = 1e-10;
649
- let y = !1, w = !1;
650
- for (const [P, k] of a) {
651
- const W = l * P + h * k + d;
652
- if (Math.abs(W) < p || (W > p ? y = !0 : w = !0, y && w))
653
- return !0;
654
- }
655
- return y && w;
656
- }
657
- function tt(n) {
658
- return Object.prototype.toString.call(n).slice(8, -1).toLowerCase();
659
- }
660
- function Yt(n) {
661
- return [
662
- "https:",
663
- // HTTPS协议,用于安全地浏览网页
664
- "wss:",
665
- // WebSocket Secure协议,用于安全的WebSocket通信
666
- "ftps:",
667
- // FTP Secure协议,用于安全的文件传输
668
- "sftp:",
669
- // SSH File Transfer Protocol,通过SSH安全地传输文件
670
- "smpts:",
671
- // Secure SMTP协议,用于安全地发送邮件
672
- "smtp+tls:",
673
- // SMTP协议结合STARTTLS扩展,用于升级到安全连接
674
- "imap+tls:",
675
- // IMAP协议结合STARTTLS扩展,用于安全地访问邮件
676
- "pop3+tls:",
677
- // POP3协议结合STARTTLS扩展,用于安全地接收邮件
678
- "rdp:",
679
- // Remote Desktop Protocol,用于安全的远程桌面连接
680
- "vpn:"
681
- // VPN协议,用于创建安全的网络连接
682
- ].some((t) => n.startsWith(t));
683
- }
684
- function Xt(n) {
685
- return new Promise((e, t) => {
686
- if (typeof n != "string" || n.trim() === "" || !n.includes("://")) {
687
- t(new Error("Invalid URL: Must be a non-empty string"));
688
- return;
689
- }
690
- try {
691
- new XMLHttpRequest().open("HEAD", n, !0);
692
- } catch (r) {
693
- t(new Error(`Invalid URL format: ${r.message}`));
694
- return;
695
- }
696
- const i = new XMLHttpRequest();
697
- i.open("HEAD", n, !0);
698
- const o = (r) => {
699
- t(new Error(`Request failed: ${r.type}`));
700
- };
701
- i.onreadystatechange = function() {
702
- i.readyState === XMLHttpRequest.DONE && (i.status === 0 ? t(new Error("Network error or CORS blocked")) : i.status >= 200 && i.status < 300 ? e(!0) : t(new Error(`HTTP Error: ${i.status}`)));
703
- }, i.onerror = o, i.onabort = o, i.ontimeout = o;
704
- try {
705
- i.send();
706
- } catch (r) {
707
- t(new Error(`Request send failed: ${r.message}`));
708
- }
709
- });
710
- }
711
- const T = class T {
712
- constructor() {
713
- if (new.target === T)
714
- throw new Error("请直接使用静态方法,而不是实例化此类");
715
- }
716
- static check(e, t) {
717
- if (!e || typeof e != "string")
718
- return console.error("Invalid URL provided"), t ? !1 : "unknown";
719
- const i = J(e).toLowerCase();
720
- if (t) {
721
- if (!Q.hasOwnProperty(t))
722
- return console.error(`Unknown file type: ${t}`), "unknown";
723
- const o = Q[t];
724
- return T._checkExtension(i, o);
725
- }
726
- return T._detectFileType(i);
727
- }
728
- /**
729
- * 静态方法,用于解析地址信息
730
- * 该方法接受一个URL字符串,将其解析为一个包含地址详情的对象数组
731
- * 主要用于批量处理以逗号分隔的URL列表,为每个URL生成相应的名称和类型
732
- *
733
- * @param {string} url - 以逗号分隔的URL字符串,每个URL代表一个资源的位置
734
- * @returns {Array} - 包含每个URL及其相关信息(名称和类型)的对象数组
735
- */
736
- static parseAddresses(e) {
737
- return !e || typeof e != "string" ? (console.error("Invalid URL provided"), []) : e.split(",").map((t) => {
738
- const i = J(t), o = this.check(t);
739
- return { url: t, name: i, type: o };
740
- });
741
- }
742
- /**
743
- * 检查 MIME 类型是否与指定的模式匹配
744
- * @param {string} type - 要检查的 MIME 类型(如 "image/png")
745
- * @param {string} [accept] - 可接受的 MIME 类型模式(如 "image/*, text/plain")
746
- * @returns {boolean} - 如果类型匹配,则返回 true,否则返回 false
747
- */
748
- static matchesMimeType(e, t) {
749
- if (!t) return !0;
750
- if (typeof e != "string" || typeof t != "string") return !1;
751
- const i = T._normalizeType(e), o = t.split(",").map((s) => T._normalizeType(s.trim())), [r, c = "*"] = i.split("/");
752
- return o.some((s) => {
753
- const [a, l = "*"] = s.split("/");
754
- return (a === "*" || r === "*" || a === r) && (l === "*" || c === "*" || l === c);
755
- });
756
- }
757
- /**
758
- * 类型标准化函数
759
- * 该函数旨在将文件类型或MIME类型字符串转换为标准格式
760
- * 主要处理三种情况:带扩展名的字符串、简写格式的类型以及已标准格式的类型
761
- *
762
- * @param {string} type - 文件类型或MIME类型字符串
763
- * @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
764
- */
765
- static _normalizeType(e) {
766
- return e.startsWith(".") && !e.includes("/") ? ut[e.toLowerCase()] || e : e.includes("/") ? e : `${e}/*`;
767
- }
768
- /**
769
- * 检查URL是否具有任何指定的文件扩展名
770
- * @param {string} url - 文件的URL
771
- * @param {string[]} validExtensions - 有效文件扩展名的数组
772
- * @returns {boolean} - 如果URL具有任何指定的文件扩展名,则返回true,否则返回false
773
- */
774
- static _checkExtension(e, t) {
775
- return t.some((i) => e.endsWith(i));
776
- }
777
- /**
778
- * 检测文件URL的类型
779
- * @param {string} url - 文件的URL
780
- * @returns {string} - 如果URL与任何已知类型匹配,则返回文件类型,否则返回"unknown"
781
- */
782
- static _detectFileType(e) {
783
- for (const [t, i] of T.cachedEntries)
784
- if (i.some((o) => e.endsWith(o)))
785
- return t;
786
- return "unknown";
787
- }
788
- };
789
- // 缓存文件扩展名的条目,以提高性能
790
- C(T, "cachedEntries", Object.entries(Q));
791
- let rt = T;
792
- function Wt(n) {
793
- if (typeof n != "function")
794
- return console.error("非函数:", n);
795
- const e = function(t) {
796
- t.didTimeout || t.timeRemaining() <= 0 ? requestIdleCallback(e) : n();
797
- };
798
- requestIdleCallback(e);
799
- }
800
- function Ht(n, e) {
801
- const t = +/* @__PURE__ */ new Date();
802
- return new Promise((i, o) => {
803
- const r = () => {
804
- if (+/* @__PURE__ */ new Date() - t >= e) return o("超时");
805
- if (n()) return i("完成");
806
- requestIdleCallback(r);
807
- };
808
- r();
809
- });
810
- }
811
- function ot(n, e, t = [], i = +/* @__PURE__ */ new Date()) {
812
- if (i < +/* @__PURE__ */ new Date() - 50) {
813
- console.error("_MergeObjects 合并异常:疑似死循环");
814
- return;
815
- }
816
- const o = tt(n), r = tt(e);
817
- if (o != r) return e;
818
- if (o == "object" || o == "array") {
819
- if (t.some(([c, s]) => c == n && s == e)) return n;
820
- if (t.push([n, e]), o == "object") {
821
- for (const c in e)
822
- if (Object.prototype.hasOwnProperty.call(e, c)) {
823
- const s = e[c], a = n[c], l = ot(
824
- a,
825
- s,
826
- t,
827
- i
828
- );
829
- n[c] = l;
830
- }
831
- return n;
832
- } else if (o == "array")
833
- return e.forEach((c, s) => {
834
- const a = c, l = n[s], h = ot(
835
- l,
836
- a,
837
- t,
838
- i
839
- );
840
- n[s] = h;
841
- }), n;
842
- } else return e;
843
- }
844
- function Gt(n = "") {
845
- return n + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
846
- const t = Math.random() * 16 | 0;
847
- return (e === "x" ? t : t & 3 | 8).toString(16);
848
- });
849
- }
850
- function dt(n, e) {
851
- let t;
852
- return function(...i) {
853
- clearTimeout(t), t = setTimeout(() => {
854
- n(...i), t = void 0;
855
- }, e);
856
- };
857
- }
858
- function Vt(n, e) {
859
- let t = -1 / 0;
860
- return function(...i) {
861
- const o = performance.now();
862
- if (o - t > e) {
863
- t = o;
864
- try {
865
- n(...i);
866
- } catch (r) {
867
- console.error("Throttled function execution failed:", r);
868
- }
869
- }
870
- };
871
- }
872
- function Zt(n, e, t) {
873
- if (!n || !e) return n;
874
- const i = e.split(".");
875
- return i.reduce((o, r, c) => o.hasOwnProperty(r) ? o[r] : c === i.length - 1 ? o[r] = t : o[r] = {}, n);
876
- }
877
- function Kt(n, e) {
878
- if (!n || !e) return n;
879
- const t = e.split(".");
880
- return t.reduce((i, o, r) => i.hasOwnProperty(o) ? i[o] : r == t.length - 1 ? void 0 : {}, n);
881
- }
882
- function Qt(n, e, t) {
883
- if (!n || !e) return n;
884
- const i = e.split(".");
885
- return i.reduce((o, r, c) => (c === i.length - 1 && (o[r] = t), o.hasOwnProperty(r) ? o[r] : o[r] = {}), n);
886
- }
887
- function Jt(n) {
888
- return n.map((e, t) => n.slice(t).concat(n.slice(0, t)));
889
- }
890
- function te(n) {
891
- const e = window.structuredClone, t = (i, o = /* @__PURE__ */ new WeakMap()) => {
892
- const r = i;
893
- if (r === null || typeof r != "object")
894
- return r;
895
- if (o.has(r))
896
- return o.get(r);
897
- switch (tt(r)) {
898
- case "array": {
899
- const s = [];
900
- o.set(r, s);
901
- for (const a of r)
902
- s.push(t(a, o));
903
- return s;
904
- }
905
- case "object": {
906
- if (r === null) return r;
907
- const s = {};
908
- o.set(r, s);
909
- for (const a in r)
910
- Object.prototype.hasOwnProperty.call(r, a) && (s[a] = t(r[a], o));
911
- return s;
912
- }
913
- case "date": {
914
- const s = new Date(r.getTime());
915
- return o.set(r, s), s;
916
- }
917
- case "regexp": {
918
- const s = r, a = new RegExp(s.source, s.flags);
919
- return a.lastIndex = s.lastIndex, o.set(r, a), a;
920
- }
921
- case "map": {
922
- const s = /* @__PURE__ */ new Map();
923
- return o.set(r, s), r.forEach((a, l) => {
924
- s.set(
925
- t(l, o),
926
- t(a, o)
927
- );
928
- }), s;
929
- }
930
- case "set": {
931
- const s = /* @__PURE__ */ new Set();
932
- return o.set(r, s), r.forEach((a) => {
933
- s.add(t(a, o));
934
- }), s;
935
- }
936
- // 处理其他可克隆对象类型
937
- case "arraybuffer":
938
- case "dataview":
939
- case "int8array":
940
- case "uint8array":
941
- case "uint8clampedarray":
942
- case "int16array":
943
- case "uint16array":
944
- case "int32array":
945
- case "uint32array":
946
- case "float32array":
947
- case "float64array":
948
- case "bigint64array":
949
- case "biguint64array": {
950
- const s = r, a = s.constructor, l = s.buffer.slice(
951
- s.byteOffset,
952
- s.byteOffset + s.byteLength
953
- ), h = new a(
954
- l,
955
- s.byteOffset,
956
- s.byteLength / s.BYTES_PER_ELEMENT
957
- );
958
- return o.set(r, h), h;
959
- }
960
- // 处理特殊对象类型
961
- case "error": {
962
- const s = r, a = new s.constructor(s.message);
963
- return a.stack = s.stack, a.name = s.name, o.set(r, a), a;
964
- }
965
- // 处理不可克隆对象(直接返回原值)
966
- case "function":
967
- case "promise":
968
- case "weakmap":
969
- case "weakset":
970
- default:
971
- return r;
972
- }
973
- };
974
- try {
975
- return e ? e(n) : t(n);
976
- } catch (i) {
977
- return console.error("structuredClone error:", i), e && t(n);
978
- }
979
- }
980
- function ee(n, e, t = 30) {
981
- if (typeof n != "function")
982
- return console.error("第一个参数必须是一个函数。");
983
- if (!Array.isArray(e))
984
- return console.error("第二个参数必须是一个数组。");
985
- let i = [], o = 0;
986
- const r = (c, s) => {
987
- for (const [a, l] of s)
988
- if (c >= a)
989
- return l;
990
- return "black";
991
- };
992
- return function(...c) {
993
- const s = performance.now(), a = n(...c), l = performance.now() - s;
994
- i.push(l), i.length > t && i.shift(), o = i.reduce((p, y) => p + y, 0) / i.length || 0;
995
- const h = r(l, e), d = r(o, e);
996
- return console.log(
997
- `%c单次耗时:${l.toFixed(2)}ms
998
- %c平均耗时(${i.length}次):${o.toFixed(2)}ms`,
999
- `color: ${h}; padding: 2px 0;`,
1000
- `color: ${d}; padding: 2px 0;`
1001
- ), a;
1002
- };
1003
- }
1004
- function ne(n) {
1005
- const e = Date.now();
1006
- let t = performance.now();
1007
- for (; Date.now() - e < n; ) {
1008
- t = Math.sin(t) * 1e6, (t > 1e6 || t < -1e6) && (t = 0);
1009
- try {
1010
- const i = t.toString().substring(0, 8);
1011
- history.replaceState(null, "", `#${i}`);
1012
- } catch {
1013
- }
1014
- }
1015
- return Date.now() - e;
1016
- }
1017
- function ie(n) {
1018
- const e = dt(n, 100);
1019
- let t = 0, i = 0;
1020
- return function(o) {
1021
- const r = o.target;
1022
- if (!r || !(r instanceof Element)) return;
1023
- const {
1024
- scrollTop: c,
1025
- scrollHeight: s,
1026
- clientHeight: a,
1027
- scrollLeft: l,
1028
- scrollWidth: h,
1029
- clientWidth: d
1030
- } = r;
1031
- function p() {
1032
- if (t == c) return;
1033
- const w = t > c;
1034
- if (t = c, w) return;
1035
- s - c - a <= 1 && e("vertical");
1036
- }
1037
- function y() {
1038
- if (i == l) return;
1039
- const w = i > l;
1040
- if (i = l, w) return;
1041
- h - l - d <= 1 && e("horizontal");
1042
- }
1043
- p(), y();
1044
- };
1045
- }
1046
- function re(n, e, t) {
1047
- const { isClickAllowed: i, uiLibrary: o = ["naiveUI", "ElementPlus", "Element"] } = t || {}, r = function(a) {
1048
- const l = [];
1049
- for (const h in a)
1050
- Object.hasOwnProperty.call(a, h) && o.includes(h) && l.push(...a[h]);
1051
- return l;
1052
- }({
1053
- naiveUI: [
1054
- ".v-binder-follower-container",
1055
- ".n-image-preview-container",
1056
- ".n-modal-container"
1057
- ],
1058
- ElementPlus: [".el-popper"],
1059
- Element: [".el-popper"]
1060
- });
1061
- function c() {
1062
- e(), document.removeEventListener("mousedown", s);
1063
- }
1064
- function s(a) {
1065
- if (i) {
1066
- const d = i(a);
1067
- if (d) return;
1068
- if (d === !1) return c();
1069
- }
1070
- const l = a.target;
1071
- if (!(l instanceof Element) || !l.isConnected) return;
1072
- n.concat(r).some((d) => !!(l != null && l.closest(d))) || c();
1073
- }
1074
- requestAnimationFrame(
1075
- () => document.addEventListener("mousedown", s)
1076
- );
1077
- }
1078
- var b, R, S, D, z, F, L, A, N;
1079
- class oe {
1080
- constructor() {
1081
- f(this, b);
1082
- f(this, R, !1);
1083
- f(this, S, {});
1084
- f(this, D, 0);
1085
- f(this, z, 0);
1086
- f(this, F, 0);
1087
- f(this, L, 0);
1088
- f(this, A);
1089
- f(this, N);
1090
- }
1091
- init(e, t) {
1092
- m(this, b, e), m(this, A, t == null ? void 0 : t.limit), m(this, N, t == null ? void 0 : t.dragDom), m(this, S, {
1093
- mousedown: this.mousedown.bind(this),
1094
- mousemove: this.mousemove.bind(this),
1095
- mouseup: this.mouseup.bind(this)
1096
- }), this.bindOrUnbindEvent("bind");
1097
- }
1098
- finish() {
1099
- this.bindOrUnbindEvent("unbind");
1100
- }
1101
- bindOrUnbindEvent(e) {
1102
- const t = e === "bind" ? "addEventListener" : "removeEventListener";
1103
- if (!u(this, b)) return console.error("No DOM");
1104
- u(this, b)[t]("mousedown", u(this, S).mousedown), document[t]("mousemove", u(this, S).mousemove), document[t]("mouseup", u(this, S).mouseup);
1105
- }
1106
- alterLocation() {
1107
- if (!u(this, b)) return console.error("No DOM");
1108
- u(this, A) && (m(this, F, Math.min(u(this, F), u(this, A).max.top)), m(this, F, Math.max(u(this, F), u(this, A).min.top)), m(this, L, Math.min(u(this, L), u(this, A).max.left)), m(this, L, Math.max(u(this, L), u(this, A).min.left))), u(this, b).style.setProperty("--top", u(this, F) + "px"), u(this, b).style.setProperty("--left", u(this, L) + "px");
1109
- }
1110
- mousedown(e) {
1111
- if (!u(this, b)) return console.error("No DOM");
1112
- if (u(this, N) && e.target != u(this, N)) return;
1113
- document.body.classList.add("no-select"), m(this, R, !0);
1114
- const t = u(this, b).getBoundingClientRect(), { pageX: i, pageY: o } = e;
1115
- m(this, D, i), m(this, z, o), m(this, F, t.y), m(this, L, t.x);
1116
- }
1117
- mousemove(e) {
1118
- const { pageX: t, pageY: i } = e;
1119
- u(this, R) && (m(this, F, u(this, F) + (i - u(this, z))), m(this, L, u(this, L) + (t - u(this, D))), m(this, D, t), m(this, z, i), this.alterLocation());
1120
- }
1121
- mouseup() {
1122
- u(this, R) && (m(this, R, !1), document.body.classList.remove("no-select"));
1123
- }
1124
- }
1125
- b = new WeakMap(), R = new WeakMap(), S = new WeakMap(), D = new WeakMap(), z = new WeakMap(), F = new WeakMap(), L = new WeakMap(), A = new WeakMap(), N = new WeakMap();
1126
- var _, j, U, B, q, E, M, x, $, Y;
1127
- class se {
1128
- constructor() {
1129
- f(this, _);
1130
- f(this, j, !1);
1131
- f(this, U, {});
1132
- f(this, B, 0);
1133
- f(this, q, 0);
1134
- f(this, E, 0);
1135
- f(this, M, 0);
1136
- f(this, x);
1137
- f(this, $);
1138
- f(this, Y);
1139
- }
1140
- init(e, t = {}) {
1141
- m(this, _, e), m(this, x, t.limit), m(this, $, t.update_move), m(this, Y, t.update_up), m(this, U, {
1142
- mousedown: this.mousedown.bind(this),
1143
- mousemove: this.mousemove.bind(this),
1144
- mouseup: this.mouseup.bind(this)
1145
- }), this.bindOrUnbindEvent("bind");
1146
- }
1147
- finish() {
1148
- this.bindOrUnbindEvent("unbind");
1149
- }
1150
- bindOrUnbindEvent(e) {
1151
- const t = e === "bind" ? "addEventListener" : "removeEventListener";
1152
- if (!u(this, _)) return console.error("No DOM");
1153
- u(this, _)[t]("mousedown", u(this, U).mousedown), document[t]("mousemove", u(this, U).mousemove), document[t]("mouseup", u(this, U).mouseup);
1154
- }
1155
- updateValue() {
1156
- const e = {
1157
- top: u(this, E),
1158
- left: u(this, M),
1159
- percentage: { top: 0, left: 0 }
1160
- };
1161
- if (u(this, x)) {
1162
- const t = (i) => u(this, x) ? (e[i] - u(this, x).min[i]) / (u(this, x).max[i] - u(this, x).min[i]) : 0;
1163
- e.percentage = {
1164
- top: t("top") || 0,
1165
- left: t("left") || 0
1166
- };
1167
- }
1168
- return e;
1169
- }
1170
- alterLocation() {
1171
- if (!u(this, _)) return console.error("No DOM");
1172
- u(this, x) && (m(this, E, Math.min(u(this, E), u(this, x).max.top)), m(this, E, Math.max(u(this, E), u(this, x).min.top)), m(this, M, Math.min(u(this, M), u(this, x).max.left)), m(this, M, Math.max(u(this, M), u(this, x).min.left))), u(this, $) && u(this, $).call(this, this.updateValue()), u(this, _).style.setProperty("--top", u(this, E) + "px"), u(this, _).style.setProperty("--left", u(this, M) + "px");
1173
- }
1174
- mousedown(e) {
1175
- if (!u(this, _)) return console.error("No DOM");
1176
- document.body.classList.add("no-select"), m(this, j, !0);
1177
- const t = u(this, _).getBoundingClientRect();
1178
- m(this, q, t.y), m(this, B, t.x);
1179
- const { pageX: i, pageY: o } = e;
1180
- m(this, E, o - u(this, q)), m(this, M, i - u(this, B)), this.alterLocation();
1181
- }
1182
- mousemove(e) {
1183
- const { pageX: t, pageY: i } = e;
1184
- u(this, j) && (m(this, E, i - u(this, q)), m(this, M, t - u(this, B)), this.alterLocation());
1185
- }
1186
- mouseup() {
1187
- u(this, j) && (m(this, j, !1), document.body.classList.remove("no-select"), u(this, Y) && u(this, Y).call(this, this.updateValue()));
1188
- }
1189
- }
1190
- _ = new WeakMap(), j = new WeakMap(), U = new WeakMap(), B = new WeakMap(), q = new WeakMap(), E = new WeakMap(), M = new WeakMap(), x = new WeakMap(), $ = new WeakMap(), Y = new WeakMap();
1191
- function K(n) {
1192
- if (typeof n == "string") {
1193
- const e = document.querySelector(n);
1194
- if (!e) throw new Error(`Element "${n}" not found`);
1195
- return e;
1196
- } else
1197
- return n || document.documentElement;
1198
- }
1199
- function ft(n) {
1200
- const e = K(n);
1201
- return e.requestFullscreen ? e.requestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen() : e.msRequestFullscreen ? e.msRequestFullscreen() : Promise.reject("No Fullscreen API");
1202
- }
1203
- function pt() {
1204
- const n = document;
1205
- return document.exitFullscreen ? document.exitFullscreen() : n.mozCancelFullScreen ? n.mozCancelFullScreen() : n.webkitExitFullscreen ? n.webkitExitFullscreen() : n.msExitFullscreen ? n.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
1206
- }
1207
- function ct(n) {
1208
- const e = K(n), t = document, i = document.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement;
1209
- return e == i || !n && window.innerWidth == screen.width && window.innerHeight == screen.height;
1210
- }
1211
- function ce(n) {
1212
- return n = K(n), function() {
1213
- ct(n) ? pt() : ft(n);
1214
- };
1215
- }
1216
- function ae(n, e) {
1217
- const t = K(e), i = () => {
1218
- n(ct(t));
1219
- };
1220
- return document.addEventListener("fullscreenchange", i), document.addEventListener("webkitfullscreenchange", i), document.addEventListener("mozfullscreenchange", i), document.addEventListener("MSFullscreenChange", i), i(), () => {
1221
- document.removeEventListener("fullscreenchange", i), document.removeEventListener("webkitfullscreenchange", i), document.removeEventListener("mozfullscreenchange", i), document.removeEventListener("MSFullscreenChange", i);
1222
- };
1223
- }
1224
- function le(n, e) {
1225
- if (typeof n == "number") return n;
1226
- if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
1227
- const t = document.createElement("div");
1228
- t.style.width = n, e = e || document.body, e.appendChild(t);
1229
- const i = t.getBoundingClientRect().width;
1230
- return e.removeChild(t), i;
1231
- }
1232
- function ue(n, e) {
1233
- if (!n) return;
1234
- let t, i;
1235
- if (typeof e == "string") {
1236
- const r = document.querySelector(e);
1237
- if (!r) return;
1238
- const c = r.getBoundingClientRect();
1239
- t = c.width, i = c.height;
1240
- } else if (Array.isArray(e))
1241
- t = e[0], i = e[1];
1242
- else {
1243
- const r = e.getBoundingClientRect();
1244
- t = r.width, i = r.height;
1245
- }
1246
- const o = t / i;
1247
- return o > n ? [n * i, i] : o < n ? [t, t / n] : [t, i];
1248
- }
1249
- function he(n, e = 5e3) {
1250
- return new Promise((t, i) => {
1251
- const o = new Image();
1252
- o.src = n;
1253
- const r = setTimeout(() => {
1254
- i(new Error("图片加载超时")), o.onload = null, o.onerror = null;
1255
- }, e);
1256
- o.onload = () => {
1257
- clearTimeout(r);
1258
- const c = o.naturalWidth, s = o.naturalHeight, a = c / s;
1259
- t([o, a]);
1260
- }, o.onerror = () => {
1261
- clearTimeout(r), i(new Error("图片加载失败"));
1262
- }, o.crossOrigin = "Anonymous";
1263
- });
1264
- }
1265
- function me(n) {
1266
- return new Promise((e, t) => {
1267
- fetch(n).then((i) => e(i.text())).catch((i) => {
1268
- console.error("Error fetching :", i), t(i);
1269
- });
1270
- });
1271
- }
1272
- function gt(n, e) {
1273
- return new Promise((t, i) => {
1274
- try {
1275
- e = e || J(n, "downloaded_file"), fetch(n).then((o) => (o.ok || i(`文件下载失败,状态码: ${o.status}`), o.blob())).then((o) => {
1276
- const r = URL.createObjectURL(o), c = document.createElement("a");
1277
- c.href = r, c.download = decodeURIComponent(e), document.body.appendChild(c), c.click(), document.body.removeChild(c), URL.revokeObjectURL(r), t(o);
1278
- }).catch(i);
1279
- } catch (o) {
1280
- i(o);
1281
- }
1282
- });
1283
- }
1284
- function de(n, e, t) {
1285
- if (!t) {
1286
- let r = e.replace(/^[^.]+./, "");
1287
- r = r == e ? "text/plain" : "application/" + r, t = { type: r };
1288
- }
1289
- const i = new Blob(n, t), o = URL.createObjectURL(i);
1290
- gt(o, e);
1291
- }
1292
- const wt = Math.PI / 2, V = Math.PI / 180, Z = 6378137, xt = 85.05112878;
1293
- function fe(n, e) {
1294
- const t = Math.max(Math.min(n, 180), -180), i = Math.max(Math.min(e, xt), -85.05112878), o = t * V * Z, r = i * V, c = Math.log(Math.tan(Math.PI / 4 + r / 2)) * Z;
1295
- return [o, c];
1296
- }
1297
- function pe(n, e) {
1298
- const t = n / Z / V, i = (2 * Math.atan(Math.exp(e / Z)) - wt) / V;
1299
- return [t, i];
1300
- }
1301
- function ge(n, e, t) {
1302
- const [i, o] = n, [r, c] = e, [s, a] = t, l = (s - r) ** 2 + (a - c) ** 2;
1303
- if (l === 0) return Math.sqrt((i - r) ** 2 + (o - c) ** 2);
1304
- let h = ((i - r) * (s - r) + (o - c) * (a - c)) / l;
1305
- return h = Math.max(0, Math.min(1, h)), Math.sqrt(
1306
- (i - (r + h * (s - r))) ** 2 + (o - (c + h * (a - c))) ** 2
1307
- );
1308
- }
1309
- function we(n, e, t, i, o, r = 1, c = 1) {
1310
- const s = n + t * Math.cos(i) * r, a = e + t * Math.sin(i) * c, l = n + t * Math.cos(o) * r, h = e + t * Math.sin(o) * c;
1311
- return [
1312
- [s, a],
1313
- [l, h]
1314
- ];
1315
- }
1316
- function xe(n, e, t, i) {
1317
- return Math.hypot(Math.abs(t - n), Math.abs(i - e));
1318
- }
1319
- function ye(n, e, t, i) {
1320
- const o = (n + t) / 2, r = (e + i) / 2;
1321
- return { x: o, y: r };
1322
- }
1323
- function ve(n, e, t, i) {
1324
- const [o, r] = n, [c, s] = e;
1325
- let a = 1 / 0;
1326
- if (c !== 0) {
1327
- const l = c > 0 ? (t - o) / c : -o / c;
1328
- l > 0 && (a = Math.min(a, l));
1329
- }
1330
- if (s !== 0) {
1331
- const l = s > 0 ? (i - r) / s : -r / s;
1332
- l > 0 && (a = Math.min(a, l));
1333
- }
1334
- return a === 1 / 0 ? n : [o + c * a, r + s * a];
1335
- }
1336
- class O {
1337
- constructor(e, t) {
1338
- C(this, "resolve");
1339
- C(this, "reject");
1340
- this.resolve = e, this.reject = t;
1341
- }
1342
- run(e) {
1343
- var t, i;
1344
- return e instanceof Promise ? e.then((o) => {
1345
- var r;
1346
- return (r = this.resolve) == null || r.call(this), o;
1347
- }).catch((o) => {
1348
- var r;
1349
- return (r = this.reject) == null || r.call(this), Promise.reject(o);
1350
- }) : e ? (t = this.resolve) == null || t.call(this) : (i = this.reject) == null || i.call(this), e;
1351
- }
1352
- }
1353
- class yt extends O {
1354
- constructor(e) {
1355
- super(), this.resolve = e;
1356
- }
1357
- warning(...e) {
1358
- const t = () => {
1359
- var i, o;
1360
- return (o = (i = X.tips).warning) == null ? void 0 : o.call(i, ...e);
1361
- };
1362
- return new O(this.resolve, t);
1363
- }
1364
- error(...e) {
1365
- const t = () => {
1366
- var i, o;
1367
- return (o = (i = X.tips).error) == null ? void 0 : o.call(i, ...e);
1368
- };
1369
- return new O(this.resolve, t);
1370
- }
1371
- }
1372
- class vt extends O {
1373
- constructor(e) {
1374
- super(), this.reject = e;
1375
- }
1376
- info(...e) {
1377
- const t = () => {
1378
- var i, o;
1379
- return (o = (i = X.tips).info) == null ? void 0 : o.call(i, ...e);
1380
- };
1381
- return new O(t, this.reject);
1382
- }
1383
- success(...e) {
1384
- const t = () => {
1385
- var i, o;
1386
- return (o = (i = X.tips).success) == null ? void 0 : o.call(i, ...e);
1387
- };
1388
- return new O(t, this.reject);
1389
- }
1390
- }
1391
- const g = class g {
1392
- /**
1393
- * 构造函数
1394
- * @throws 如果尝试实例化该类,则抛出错误,因为应该使用静态方法
1395
- */
1396
- constructor() {
1397
- if (new.target === g)
1398
- throw new Error("请直接使用静态方法,而不是实例化此类");
1399
- }
1400
- static register(e, t) {
1401
- if (typeof t != "function")
1402
- return console.error("TipHandler must be a function");
1403
- g.tips[e] = t;
1404
- }
1405
- static resolveTip(e) {
1406
- return function(...t) {
1407
- const i = () => {
1408
- var o, r;
1409
- return (r = (o = g.tips)[e]) == null ? void 0 : r.call(o, ...t);
1410
- };
1411
- return new yt(i);
1412
- };
1413
- }
1414
- static rejectTip(e) {
1415
- return function(...t) {
1416
- const i = () => {
1417
- var o, r;
1418
- return (r = (o = g.tips)[e]) == null ? void 0 : r.call(o, ...t);
1419
- };
1420
- return new vt(i);
1421
- };
1422
- }
1423
- };
1424
- C(g, "tips", {
1425
- info: void 0,
1426
- success: void 0,
1427
- warning: void 0,
1428
- error: void 0
1429
- }), C(g, "info", g.resolveTip("info")), C(g, "success", g.resolveTip("success")), C(g, "warning", g.rejectTip("warning")), C(g, "error", g.rejectTip("error"));
1430
- let X = g;
1431
- export {
1432
- ut as EXTENSION_TO_MIME,
1433
- Q as FILE_EXTENSIONS,
1434
- st as PAPER_SIZE_DEFINITIONS,
1435
- Et as PAPER_SIZE_OPTIONS,
1436
- it as UNIT_LABELS,
1437
- _t as WINDOW_TARGET,
1438
- Ct as _Animate_CreateOscillator,
1439
- Ft as _Animate_NumericTransition,
1440
- Mt as _Animate_Schedule,
1441
- Lt as _Blob_ConvertDataToImageUrl,
1442
- At as _Browser_CalculatePrintableArea,
1443
- Tt as _Browser_CopyToClipboard,
1444
- Pt as _Browser_GetFrameRate,
1445
- ht as _Browser_KeyedWindowManager,
1446
- ue as _Element_CalculateCanvasSize,
1447
- re as _Element_CloseOnOutsideClick,
1448
- oe as _Element_Drag,
1449
- ft as _Element_EnterFullscreen,
1450
- pt as _Element_ExitFullscreen,
1451
- ce as _Element_Fullscreen,
1452
- ae as _Element_FullscreenObserver,
1453
- le as _Element_GetOtherSizeInPixels,
1454
- ct as _Element_IsFullscreen,
1455
- he as _Element_LoadImage,
1456
- se as _Element_LocalDrag,
1457
- ie as _Element_ScrollEndListener,
1458
- de as _File_CreateAndDownload,
1459
- gt as _File_Download,
1460
- me as _File_Read,
1461
- Ot as _Format_CamelCase,
1462
- It as _Format_CapitalizeFirstLetter,
1463
- Dt as _Format_ExcludeSubstring,
1464
- Ut as _Format_FileSize,
1465
- J as _Format_HrefName,
1466
- St as _Format_NumberWithCommas,
1467
- jt as _Format_NumberWithUnit,
1468
- Rt as _Format_Percentage,
1469
- kt as _Format_Timestamp,
1470
- xe as _Math_CalculateDistance2D,
1471
- we as _Math_GetArcPoints,
1472
- ve as _Math_GetBoundaryIntersection,
1473
- ye as _Math_GetMidpoint,
1474
- fe as _Math_LngLatToPlane,
1475
- pe as _Math_PlaneToLngLat,
1476
- ge as _Math_PointToLineDistance,
1477
- X as _Tip,
1478
- te as _Utility_Clone,
1479
- dt as _Utility_Debounce,
1480
- Wt as _Utility_ExecuteWhenIdle,
1481
- Gt as _Utility_GenerateUUID,
1482
- Kt as _Utility_GetTargetByPath,
1483
- Zt as _Utility_InitTargetByPath,
1484
- ot as _Utility_MergeObjects,
1485
- Jt as _Utility_RotateList,
1486
- Qt as _Utility_SetTargetByPath,
1487
- ne as _Utility_Sleep,
1488
- Vt as _Utility_Throttle,
1489
- ee as _Utility_TimeConsumption,
1490
- Ht as _Utility_WaitForCondition,
1491
- Xt as _Valid_CheckConnectionWithXHR,
1492
- tt as _Valid_DataType,
1493
- $t as _Valid_DoesInfiniteLineIntersectRectangle,
1494
- rt as _Valid_FileTypeChecker,
1495
- Nt as _Valid_Is2DNumberArray,
1496
- Bt as _Valid_IsInMargin,
1497
- mt as _Valid_IsNumberArray,
1498
- zt as _Valid_IsObject,
1499
- qt as _Valid_IsPointInPolygon,
1500
- Yt as _Valid_IsSecureContext
1501
- };