nhanh-pure-function 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Math/index.d.ts +34 -0
- package/dist/User/index.d.ts +12 -3
- package/dist/Utility/index.d.ts +11 -7
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +484 -442
- package/package.json +1 -1
package/dist/Math/index.d.ts
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
import { Point } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* 将经纬度转换为平面坐标
|
|
4
|
+
* @param lng 经度
|
|
5
|
+
* @param lat 纬度
|
|
6
|
+
* @returns 平面坐标 [x, y](米)
|
|
7
|
+
*/
|
|
8
|
+
export declare function _LngLatToPlane(lng: number, lat: number): [number, number];
|
|
9
|
+
/**
|
|
10
|
+
* 将平面坐标转换为经纬度
|
|
11
|
+
* @param x 平面坐标 X 值(米)
|
|
12
|
+
* @param y 平面坐标 Y 值(米)
|
|
13
|
+
* @returns 经纬度 [lng, lat](度)
|
|
14
|
+
*/
|
|
15
|
+
export declare function _PlaneToLngLat(x: number, y: number): [number, number];
|
|
16
|
+
/**
|
|
17
|
+
* 计算点到线段的距离
|
|
18
|
+
* @param point 点击位置
|
|
19
|
+
* @param lineStart 线段起点
|
|
20
|
+
* @param lineEnd 线段终点
|
|
21
|
+
* @returns 点到线段的距离
|
|
22
|
+
*/
|
|
23
|
+
export declare function _PointToLineDistance(point: [number, number], lineStart: [number, number], lineEnd: [number, number]): number;
|
|
24
|
+
/**
|
|
25
|
+
* 检查单个二维数组参数是否合法,要求数组元素为有限数字
|
|
26
|
+
* @param arr - 待检查的数组
|
|
27
|
+
* @returns 如果参数合法返回 true,否则返回 false
|
|
28
|
+
*/
|
|
29
|
+
export declare function _IsSingleArrayValid(arr: any): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 检查数组中的每个元素是否都为合法的二维数组
|
|
32
|
+
* @param arr - 待检查的数组
|
|
33
|
+
* @returns 如果所有元素都合法返回 true,否则返回 false
|
|
34
|
+
*/
|
|
35
|
+
export declare function _AreAllArraysValid(arr: any): boolean;
|
|
2
36
|
/**
|
|
3
37
|
* 转为百分比字符串
|
|
4
38
|
* @param value 分子
|
package/dist/User/index.d.ts
CHANGED
|
@@ -48,17 +48,17 @@ export declare class _LocalDrag {
|
|
|
48
48
|
mouseup(): void;
|
|
49
49
|
}
|
|
50
50
|
/** 进入全屏模式 */
|
|
51
|
-
export declare function _EnterFullscreen(content
|
|
51
|
+
export declare function _EnterFullscreen(content?: HTMLElement): Promise<void>;
|
|
52
52
|
/** 退出全屏模式 */
|
|
53
53
|
export declare function _ExitFullscreen(): Promise<void>;
|
|
54
54
|
/** 判断是否处于全屏模式 */
|
|
55
|
-
export declare function _IsFullscreen():
|
|
55
|
+
export declare function _IsFullscreen(content?: HTMLElement): boolean;
|
|
56
56
|
/**
|
|
57
57
|
* 返回一个用于切换全屏模式的函数
|
|
58
58
|
* @param {HTMLElement} content - 需要进入全屏的元素
|
|
59
59
|
* 该函数通过检查不同浏览器的特定方法来实现全屏切换
|
|
60
60
|
*/
|
|
61
|
-
export declare function _Fullscreen(content
|
|
61
|
+
export declare function _Fullscreen(content?: HTMLElement): () => void;
|
|
62
62
|
/**
|
|
63
63
|
* 单位转换 12** -> **px
|
|
64
64
|
* @param {string} width
|
|
@@ -81,3 +81,12 @@ export declare function _CalculateCanvasSize(aspectRatio: number, target: Elemen
|
|
|
81
81
|
* @returns 一个Promise对象,包含加载的图片对象及其宽高比
|
|
82
82
|
*/
|
|
83
83
|
export declare function _LoadImage(src: string, timeout?: number): Promise<[HTMLImageElement, number]>;
|
|
84
|
+
/**
|
|
85
|
+
* 暂停执行指定毫秒数的操作
|
|
86
|
+
* 此函数通过 busy-wait(忙等待)的方式实现,它会持续执行一些无用的操作以消耗时间
|
|
87
|
+
* 这种方法虽然简单,但会占用CPU资源,因此不推荐在实际应用中使用
|
|
88
|
+
*
|
|
89
|
+
* @param ms 暂停的毫秒数
|
|
90
|
+
* @returns 实际暂停的毫秒数
|
|
91
|
+
*/
|
|
92
|
+
export declare function _Sleep(ms: number): number;
|
package/dist/Utility/index.d.ts
CHANGED
|
@@ -256,11 +256,10 @@ export declare function _Clone<T>(val: T): T | undefined;
|
|
|
256
256
|
*/
|
|
257
257
|
export declare class _KeyedWindowManager {
|
|
258
258
|
private static keys;
|
|
259
|
-
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
constructor();
|
|
259
|
+
/** 请使用静态方法 */
|
|
260
|
+
private constructor();
|
|
261
|
+
/** 添加已有窗口 */
|
|
262
|
+
static add(key: string, win: Window): void;
|
|
264
263
|
/**
|
|
265
264
|
* 根据键打开或聚焦窗口
|
|
266
265
|
* @param key 窗口的唯一键
|
|
@@ -302,5 +301,10 @@ export declare class _KeyedWindowManager {
|
|
|
302
301
|
* @returns 成功时返回图像的URL,失败时返回null
|
|
303
302
|
*/
|
|
304
303
|
export declare function _Danger_ConvertDataToImageUrl(data: string | ArrayBuffer | Uint8Array | File, mimeType?: string): string | null;
|
|
305
|
-
/**
|
|
306
|
-
|
|
304
|
+
/**
|
|
305
|
+
* 函数装饰器,用于测量并记录另一个函数的执行时间
|
|
306
|
+
* @param func 要测量执行时间的函数
|
|
307
|
+
* @param level 耗时与颜色对应的数组,用于在控制台中着色显示
|
|
308
|
+
* @param maxHistory 保留的最大历史记录数,默认为30
|
|
309
|
+
*/
|
|
310
|
+
export declare function _TimeConsumption(func: Function, level: [number, string][], maxHistory?: number): (...args: any[]) => any;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".nhanh-pure-function{--nhanh: 2233}.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
|
-
"use strict";var oe=Object.defineProperty;var V=n=>{throw TypeError(n)};var re=(n,t,e)=>t in n?oe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var y=(n,t,e)=>re(n,typeof t!="symbol"?t+"":t,e),Z=(n,t,e)=>t.has(n)||V("Cannot "+e);var c=(n,t,e)=>(Z(n,t,"read from private field"),e?e.call(n):t.get(n)),d=(n,t,e)=>t.has(n)?V("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),m=(n,t,e,o)=>(Z(n,t,"write to private field"),o?o.call(n,e):t.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie={".mp3":"audio/mpeg",".mp4":"video/mp4",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".wav":"audio/wav",".flac":"audio/flac",".opus":"audio/opus",".webm":"video/webm",".avi":"video/x-msvideo",".mov":"video/quicktime",".wmv":"video/x-ms-wmv",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".bmp":"image/bmp",".tiff":"image/tiff",".ico":"image/vnd.microsoft.icon",".svg":"image/svg+xml",".webp":"image/webp",".heif":"image/heif",".heic":"image/heic",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".ts":"application/typescript",".csv":"text/csv",".tsv":"text/tab-separated-values",".txt":"text/plain",".md":"text/markdown",".rtf":"application/rtf",".pdf":"application/pdf",".zip":"application/zip",".rar":"application/x-rar-compressed",".tar":"application/x-tar",".gz":"application/gzip",".7z":"application/x-7z-compressed",".exe":"application/x-msdownload",".apk":"application/vnd.android.package-archive",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".odt":"application/vnd.oasis.opendocument.text",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odp":"application/vnd.oasis.opendocument.presentation",".jsonld":"application/ld+json",".yaml":"application/x-yaml",".yml":"application/x-yaml",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".map":"application/json"},H={image:[".jpg",".jpeg",".png",".gif",".bmp",".webp",".tiff",".svg",".heif",".heic",".ico",".raw",".jfif",".avif",".png8",".indd",".eps",".ai"],ppt:[".ppt",".pptx",".odp"],word:[".doc",".docx",".odt",".rtf"],excel:[".xls",".xlsx",".ods",".csv",".tsv"],pdf:[".pdf"],text:[".txt",".csv",".md",".json",".yaml",".yml",".log",".ini",".rtf"],audio:[".mp3",".wav",".ogg",".flac",".aac",".wma",".m4a",".alac",".ape",".opus",".amr",".ra",".mid",".midi",".aiff",".pcm",".au",".wavpack",".spx"],video:[".mp4",".avi",".mkv",".mov",".wmv",".flv",".webm",".mpg",".mpeg",".3gp",".vob",".ogv",".m4v",".ts",".rm",".rmvb",".m2ts",".divx",".xvid",".swf",".f4v"],archive:[".zip",".rar",".tar",".gz",".bz2",".xz",".7z",".tar.gz",".tar.bz2",".tar.xz",".tar.lz",".tar.lzma",".cab",".iso",".dmg",".tgz",".apk",".gz2",".tar.zst"],code:[".js",".ts",".py",".java",".cpp",".c",".html",".css",".scss",".less",".sass",".php",".rb",".go",".swift",".rs",".kt",".scala",".lua",".pl",".m",".h",".xml",".json",".yaml",".yml",".toml",".vue",".ejs",".handlebars",".jinja",".dart"],font:[".woff",".woff2",".ttf",".otf",".eot",".svg",".ttc",".fnt",".fon",".otc"],database:[".sql",".sqlite",".db",".mdb",".accdb",".jsonld",".xml",".csv"],markup:[".html",".htm",".xhtml",".xml",".json",".yaml",".yml"],configuration:[".ini",".conf",".cfg",".env",".properties",".json",".toml"],logs:[".log",".err",".trace",".out"],script:[".bash",".sh",".zsh",".bat",".ps1",".vbs",".cmd",".sed",".awk",".php"]},J=["","万","亿","兆","京","垓","秭","穰","沟","涧","正","载","极"];function se(n){return n!=null}function ce(n){return!(n===null||typeof n!="object"||Array.isArray(n))}function ae(n){if(typeof n!="function")return console.error("非函数:",n);const t=function(e){e.didTimeout||e.timeRemaining()<=0?requestIdleCallback(t):n()};requestIdleCallback(t)}function le(n,t){const e=+new Date;return new Promise((o,r)=>{const i=()=>{if(+new Date-e>=t)return r("超时");if(n())return o("完成");requestIdleCallback(i)};i()})}function ue(n,t,e=","){const o=new RegExp(`(^|${e})${t}(${e}|$)`,"g");return n.replace(o,function(r,i,s){return i===s?e:""})}function me(n){return n.charAt(0).toUpperCase()+n.slice(1)}function N(n,t,e=[],o=+new Date){if(o<+new Date-50){console.error("_MergeObjects 合并异常:疑似死循环");return}const r=W(n),i=W(t);if(r!=i)return t;if(r=="object"||r=="array"){if(e.some(([s,a])=>s==n&&a==t))return n;if(e.push([n,t]),r=="object"){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const a=t[s],u=n[s],l=N(u,a,e,o);n[s]=l}return n}else if(r=="array")return t.forEach((s,a)=>{const u=s,l=n[a],f=N(l,u,e,o);n[a]=f}),n}else return t}function de(n,t="YYYY-MM-DD hh:mm:ss",e=!0){const o=new Date(n);if(isNaN(o.getTime()))return console.error("Invalid date"),"";const r={YYYY:i=>i.getFullYear(),MM:i=>i.getMonth()+1,DD:i=>i.getDate(),hh:i=>i.getHours(),mm:i=>i.getMinutes(),ss:i=>i.getSeconds(),ms:i=>i.getMilliseconds()};return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g,i=>{const s=r[i](o);return e?String(s).padStart(2,"0"):String(s)})}function fe(n){return new Promise((t,e)=>{fetch(n).then(o=>t(o.text())).catch(o=>{console.error("Error fetching :",o),e(o)})})}function q(n,t="file"){if(!n||(n=String(n).trim(),n===""))return t;const e=n.split("/");return e[e.length-1].split("?")[0]}function he(n,t){return new Promise((e,o)=>{try{t=t||q(n,"downloaded_file"),fetch(n).then(r=>(r.ok||o(`文件下载失败,状态码: ${r.status}`),r.blob())).then(r=>{const i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=decodeURIComponent(t),document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i),e(r)}).catch(o)}catch(r){o(r)}})}function pe(n,t=10){let e=0,o=t;function r(){if(o>0)o--,requestAnimationFrame(r);else{const s=(+new Date-e)/t,a=1e3/s;n(Number(a.toFixed(2)),Number(s.toFixed(2)))}}requestAnimationFrame(()=>{e=+new Date,r()})}function ge(n,t){return n=n.replace(/([^a-zA-Z][a-z])/g,e=>e.toUpperCase()),t?n.replace(/[^a-zA-Z]+/g,""):n}function we(n,t,e){if(!e){let s=t.replace(/^[^.]+./,"");s=s==t?"text/plain":"application/"+s,e={type:s}}const o=new Blob(n,e),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function xe(n=""){return n+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function K(n,t){let e;return function(...o){clearTimeout(e),e=setTimeout(()=>{n(...o),e=void 0},t)}}function ve(n,t){let e=-1/0;return function(...o){const r=performance.now();if(r-e>t){e=r;try{n(...o)}catch(i){console.error("Throttled function execution failed:",i)}}}}function W(n){return Array.isArray(n)?"array":n===null?"null":typeof n}function be(n){const t=()=>Promise.resolve(),e=a=>(console.error(a),Promise.reject(a));function o(){return navigator.clipboard.writeText(n).then(t).catch(e)}function r(){const a=document.createElement("div");a.innerText=n,document.body.appendChild(a);const u=document.createRange();u.selectNodeContents(a);const l=window.getSelection();let f=!1;return l&&(l.removeAllRanges(),l.addRange(u),f=document.execCommand("copy")),document.body.removeChild(a),f?Promise.resolve():Promise.reject()}function i(){const a=document.createElement("textarea");a.value=n,document.body.appendChild(a),a.select(),a.setSelectionRange(0,n.length);let u=!1;return document.activeElement===a&&(u=document.execCommand("Copy",!0)),document.body.removeChild(a),u?Promise.resolve():Promise.reject()}function s(){return r().then(t).catch(()=>{i().then(t).catch(()=>e("复制方式尽皆失效"))})}return navigator.clipboard?o().catch(s):s()}function ye(n,t){const e=t.split(".");return e.reduce((o,r,i)=>(r in o||(i===e.length-1?o[r]=void 0:o[r]={}),o[r]),n)}function Ce(n,t){const e=t.split(".");return e.reduce((o,r,i)=>o.hasOwnProperty(r)?o[r]:o[r]=i==e.length-1?void 0:{},n)}function _e(n,t,e){const o=t.split(".");return o.reduce((r,i,s)=>(s===o.length-1&&(r[i]=e),r[i]),n)}function Ee(n){return new Promise((t,e)=>{if(typeof n!="string"||n.trim()===""||!n.includes("://")){e(new Error("Invalid URL: Must be a non-empty string"));return}try{new XMLHttpRequest().open("HEAD",n,!0)}catch(i){e(new Error(`Invalid URL format: ${i.message}`));return}const o=new XMLHttpRequest;o.open("HEAD",n,!0);const r=i=>{e(new Error(`Request failed: ${i.type}`))};o.onreadystatechange=function(){o.readyState===XMLHttpRequest.DONE&&(o.status===0?e(new Error("Network error or CORS blocked")):o.status>=200&&o.status<300?t(!0):e(new Error(`HTTP Error: ${o.status}`)))},o.onerror=r,o.onabort=r,o.ontimeout=r;try{o.send()}catch(i){e(new Error(`Request send failed: ${i.message}`))}})}function Fe(n){return["https:","wss:","ftps:","sftp:","smpts:","smtp+tls:","imap+tls:","pop3+tls:","rdp:","vpn:"].some(e=>n.startsWith(e))}const E=class E{constructor(){if(new.target===E)throw new Error("请直接使用静态方法,而不是实例化此类")}static check(t,e){if(!t||typeof t!="string")return console.error("Invalid URL provided"),e?!1:"unknown";const o=q(t).toLowerCase();if(e){if(!H.hasOwnProperty(e))return console.error(`Unknown file type: ${e}`),"unknown";const r=H[e];return E._checkExtension(o,r)}return E._detectFileType(o)}static parseAddresses(t){return!t||typeof t!="string"?(console.error("Invalid URL provided"),[]):t.split(",").map(e=>{const o=q(e),r=this.check(e);return{url:e,name:o,type:r}})}static matchesMimeType(t,e){if(!e)return!0;if(typeof t!="string"||typeof e!="string")return!1;const o=E._normalizeType(t),r=e.split(",").map(a=>E._normalizeType(a.trim())),[i,s="*"]=o.split("/");return r.some(a=>{const[u,l="*"]=a.split("/");return(u==="*"||i==="*"||u===i)&&(l==="*"||s==="*"||l===s)})}static _normalizeType(t){return t.startsWith(".")&&!t.includes("/")?ie[t.toLowerCase()]||t:t.includes("/")?t:`${t}/*`}static _checkExtension(t,e){return e.some(o=>t.endsWith(o))}static _detectFileType(t){for(const[e,o]of E.cachedEntries)if(o.some(r=>t.endsWith(r)))return e;return"unknown"}};y(E,"cachedEntries",Object.entries(H));let X=E;function Te(n){return n.map((t,e)=>n.slice(e).concat(n.slice(0,e)))}function Me(n){const t=window.structuredClone,e=o=>o===null||typeof o!="object"?o:N(Array.isArray(o)?[]:{},o);try{return t?t(n):e(n)}catch(o){return console.error("structuredClone error:",o),t&&e(n)}}const $=class ${constructor(){if(new.target===$)throw new Error("请直接使用静态方法,而不是实例化此类")}static open(t,e,o,r){const i=this.keys.get(t);if(i&&!i.closed)return i.focus(),i;{const s=window.open(e,o,r);if(s)return this.keys.set(t,s),s;console.error("window.open failed: 可能是浏览器阻止了弹出窗口"),this.keys.delete(t)}}static isOpen(t){const e=this.keys.get(t);return e!=null&&e.closed&&this.keys.delete(t),this.keys.has(t)}static getWindow(t){if(this.isOpen(t))return this.keys.get(t)}static close(t){const e=this.keys.get(t);e&&(e.close(),this.keys.delete(t))}static closeAll(){this.keys.forEach((t,e)=>t.close()),this.keys.clear()}};y($,"keys",new Map);let G=$;function Le(n,t="image/png"){try{let e,o=t;if(n instanceof File)return URL.createObjectURL(n);if(typeof n=="string"){let i=n;const s=i.match(/^data:([^;]*)(;base64)?,(.*)$/i);if(s){if(!s[2])throw new Error("无效的数据 URL:缺少 base64 编码声明");if(o=s[1]||o,i=s[3],!i)throw new Error("数据 URL 包含空有效负载")}i=i.replace(/[^A-Za-z0-9+/=]/g,"");const a=atob(i);e=new Uint8Array(a.length);for(let u=0;u<a.length;u++)e[u]=a.charCodeAt(u)}else if(n instanceof ArrayBuffer)e=new Uint8Array(n);else if(n instanceof Uint8Array)e=n;else throw new Error("不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array");const r=new Blob([e],{type:o});return URL.createObjectURL(r)}catch(e){return console.error("数据到 ImageURL 的转换失败:",e.message,e.stack||"没有可用的堆栈跟踪"),null}}function je(n,t){if(typeof n!="function")throw new Error("The first argument must be a function.");if(!Array.isArray(t))throw new Error("The second argument must be an array.");let e=[],o=100,r=0;const i=(s,a)=>{for(const[u,l]of a)if(s>=u)return l;return"black"};return function(...s){const a=performance.now(),u=n(...s),l=performance.now()-a;e.push(l),e.length>o&&e.shift(),r=e.reduce((T,B)=>T+B,0)/e.length||0;const f=i(l,t),p=i(r,t);return console.log(`%c单次耗时:${l.toFixed(2)}ms
|
|
3
|
-
%c平均耗时(${e.length}次):${r.toFixed(2)}ms`,`color: ${f}; padding: 2px 0;`,`color: ${p}; padding: 2px 0;`),u}}function Re(n){const t=K(n,100);let e=0,o=0;return function(r){const i=r.target;if(!i||!(i instanceof HTMLElement))return;const{scrollTop:s,scrollHeight:a,clientHeight:u,scrollLeft:l,scrollWidth:f,clientWidth:p}=i;function T(){if(e==s)return;const Y=e>s;if(e=s,Y)return;a-s-u<=1&&t("vertical")}function B(){if(o==l)return;const Y=o>l;if(o=l,Y)return;f-l-p<=1&&t("horizontal")}T(),B()}}function Pe(n,t,e){const{isClickAllowed:o,uiLibrary:r=["naiveUI","ElementPlus","Element"]}=e||{},i=function(u){const l=[];for(const f in u)Object.hasOwnProperty.call(u,f)&&r.includes(f)&&l.push(...u[f]);return l}({naiveUI:[".v-binder-follower-container",".n-image-preview-container",".n-modal-container"],ElementPlus:[".el-popper"],Element:[".el-popper"]});function s(){t(),document.removeEventListener("mousedown",a)}function a(u){if(o){const p=o(u);if(p)return;if(p===!1)return s()}const l=u.target;if(!(l instanceof HTMLElement)||!(l!=null&&l.closest("body")))return;n.concat(i).some(p=>!!(l!=null&&l.closest(p)))||s()}requestAnimationFrame(()=>document.addEventListener("mousedown",a))}var w,M,L,D,U,C,_,F,I;class ke{constructor(){d(this,w);d(this,M,!1);d(this,L,{});d(this,D,0);d(this,U,0);d(this,C,0);d(this,_,0);d(this,F);d(this,I)}init(t,e){m(this,w,t),m(this,F,e==null?void 0:e.limit),m(this,I,e==null?void 0:e.dragDom),m(this,L,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!c(this,w))return console.error("No DOM");c(this,w)[e]("mousedown",c(this,L).mousedown),document[e]("mousemove",c(this,L).mousemove),document[e]("mouseup",c(this,L).mouseup)}alterLocation(){if(!c(this,w))return console.error("No DOM");c(this,F)&&(m(this,C,Math.min(c(this,C),c(this,F).max.top)),m(this,C,Math.max(c(this,C),c(this,F).min.top)),m(this,_,Math.min(c(this,_),c(this,F).max.left)),m(this,_,Math.max(c(this,_),c(this,F).min.left))),c(this,w).style.setProperty("--top",c(this,C)+"px"),c(this,w).style.setProperty("--left",c(this,_)+"px")}mousedown(t){if(!c(this,w))return console.error("No DOM");if(c(this,I)&&t.target!=c(this,I))return;document.body.classList.add("no-select"),m(this,M,!0);const e=c(this,w).getBoundingClientRect(),{pageX:o,pageY:r}=t;m(this,D,o),m(this,U,r),m(this,C,e.y),m(this,_,e.x)}mousemove(t){const{pageX:e,pageY:o}=t;c(this,M)&&(m(this,C,c(this,C)+(o-c(this,U))),m(this,_,c(this,_)+(e-c(this,D))),m(this,D,e),m(this,U,o),this.alterLocation())}mouseup(){c(this,M)&&(m(this,M,!1),document.body.classList.remove("no-select"))}}w=new WeakMap,M=new WeakMap,L=new WeakMap,D=new WeakMap,U=new WeakMap,C=new WeakMap,_=new WeakMap,F=new WeakMap,I=new WeakMap;var x,j,R,O,S,v,b,g,z,A;class De{constructor(){d(this,x);d(this,j,!1);d(this,R,{});d(this,O,0);d(this,S,0);d(this,v,0);d(this,b,0);d(this,g);d(this,z);d(this,A)}init(t,e={}){m(this,x,t),m(this,g,e.limit),m(this,z,e.update_move),m(this,A,e.update_up),m(this,R,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!c(this,x))return console.error("No DOM");c(this,x)[e]("mousedown",c(this,R).mousedown),document[e]("mousemove",c(this,R).mousemove),document[e]("mouseup",c(this,R).mouseup)}updateValue(){const t={top:c(this,v),left:c(this,b),percentage:{top:0,left:0}};if(c(this,g)){const e=o=>c(this,g)?(t[o]-c(this,g).min[o])/(c(this,g).max[o]-c(this,g).min[o]):0;t.percentage={top:e("top")||0,left:e("left")||0}}return t}alterLocation(){if(!c(this,x))return console.error("No DOM");c(this,g)&&(m(this,v,Math.min(c(this,v),c(this,g).max.top)),m(this,v,Math.max(c(this,v),c(this,g).min.top)),m(this,b,Math.min(c(this,b),c(this,g).max.left)),m(this,b,Math.max(c(this,b),c(this,g).min.left))),c(this,z)&&c(this,z).call(this,this.updateValue()),c(this,x).style.setProperty("--top",c(this,v)+"px"),c(this,x).style.setProperty("--left",c(this,b)+"px")}mousedown(t){if(!c(this,x))return console.error("No DOM");document.body.classList.add("no-select"),m(this,j,!0);const e=c(this,x).getBoundingClientRect();m(this,S,e.y),m(this,O,e.x);const{pageX:o,pageY:r}=t;m(this,v,r-c(this,S)),m(this,b,o-c(this,O)),this.alterLocation()}mousemove(t){const{pageX:e,pageY:o}=t;c(this,j)&&(m(this,v,o-c(this,S)),m(this,b,e-c(this,O)),this.alterLocation())}mouseup(){c(this,j)&&(m(this,j,!1),document.body.classList.remove("no-select"),c(this,A)&&c(this,A).call(this,this.updateValue()))}}x=new WeakMap,j=new WeakMap,R=new WeakMap,O=new WeakMap,S=new WeakMap,v=new WeakMap,b=new WeakMap,g=new WeakMap,z=new WeakMap,A=new WeakMap;function Q(n){const t=n;if(n){if(n.requestFullscreen)return n.requestFullscreen();if(t.mozRequestFullScreen)return t.mozRequestFullScreen();if(t.webkitRequestFullscreen)return t.webkitRequestFullscreen();if(t.msRequestFullscreen)return t.msRequestFullscreen()}else return Promise.reject("No DOM");return Promise.reject("No Fullscreen API")}function ee(){const n=document;return document.exitFullscreen?document.exitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.msExitFullscreen?n.msExitFullscreen():Promise.reject("No ExitFullscreen API")}function te(){const n=document;return document.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement}function Ue(n){return function(){te()?ee():Q(n)}}function Ie(n,t){if(typeof n=="number")return n;if(/px/.test(n))return Number(n.replace(/px/,""))||0;const e=document.createElement("div");e.style.width=n,t=t||document.body,t.appendChild(e);const o=e.getBoundingClientRect().width;return t.removeChild(e),o}function Oe(n,t){if(!n)return;let e,o;if(typeof t=="string"){const i=document.querySelector(t);if(!i)return;const s=i.getBoundingClientRect();e=s.width,o=s.height}else if(Array.isArray(t))e=t[0],o=t[1];else{const i=t.getBoundingClientRect();e=i.width,o=i.height}const r=e/o;return r>n?[n*o,o]:r<n?[e,e/n]:[e,o]}function Se(n,t=5e3){return new Promise((e,o)=>{const r=new Image;r.src=n;const i=setTimeout(()=>{o(new Error("图片加载超时")),r.onload=null,r.onerror=null},t);r.onload=()=>{clearTimeout(i);const s=r.naturalWidth,a=r.naturalHeight,u=s/a;e([r,u])},r.onerror=()=>{clearTimeout(i),o(new Error("图片加载失败"))},r.crossOrigin="Anonymous"})}function ze(n,t,e=2){return!Number.isFinite(n)||!Number.isFinite(t)||!Number.isFinite(e)?(console.error("所有参数必须是有限的数字"),""):t===0?(console.error("分母不能为零"),""):e<0?(console.error("小数位数不能为负数"),""):(n/t*100).toFixed(e)+"%"}function Ae(n,t,e){return Math.abs(n-t)<=e}function Ne(n,t=500){let e,o=!0;function r(i){if(!o)return;e||(e=i);let s=Math.min((i-e)/t,1);n(s),i-e<t&&requestAnimationFrame(r)}return requestAnimationFrame(r),()=>o=!1}function qe(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function $e(n,t){const e={join:!0,suffix:"",decimalPlaces:2},{join:o,suffix:r,decimalPlaces:i}={...e,...t||{}},s=Number(n);if(isNaN(s))return o?`0${r}`:[0,r];const a=Math.abs(s),u=s>=0,l=Math.max(0,Math.floor(Math.log10(a)/4)),f=Math.pow(1e4,l),p=a/f,T=(u?1:-1)*parseFloat(p.toFixed(Math.max(0,i)));return o?`${T}${J[l]}${r}`:[T,J[l]+r]}function Be(n,t){let e=!1;const{x:o,y:r}=n,i=t.length;for(let s=0,a=i-1;s<i;a=s++){const u=t[s].x,l=t[s].y,f=t[a].x,p=t[a].y;l>r!=p>r&&o<(f-u)*(r-l)/(p-l)+u&&(e=!e)}return e}function Ye(n){const t=["B","KB","MB","GB","TB","PB"];let e=0;for(;n>1024;)n/=1024,e++;return`${Math.round(n*100)/100} ${t[e]}`}function He(n,t,e,o){return Math.sqrt(Math.pow(e-n,2)+Math.pow(o-t,2))}function We(n,t,e,o){const r=(n+e)/2,i=(t+o)/2;return{x:r,y:i}}class k{constructor(t,e){y(this,"resolve");y(this,"reject");this.resolve=t,this.reject=e}run(t){var e,o;return t instanceof Promise?t.then(r=>{var i;return(i=this.resolve)==null||i.call(this),r}).catch(r=>{var i;return(i=this.reject)==null||i.call(this),Promise.reject(r)}):t?(e=this.resolve)==null||e.call(this):(o=this.reject)==null||o.call(this),t}}class Xe extends k{constructor(t){super(),this.resolve=t}warning(...t){const e=()=>{var o,r;return(r=(o=P.tips).warning)==null?void 0:r.call(o,...t)};return new k(this.resolve,e)}error(...t){const e=()=>{var o,r;return(r=(o=P.tips).error)==null?void 0:r.call(o,...t)};return new k(this.resolve,e)}}class Ge extends k{constructor(t){super(),this.reject=t}info(...t){const e=()=>{var o,r;return(r=(o=P.tips).info)==null?void 0:r.call(o,...t)};return new k(e,this.reject)}success(...t){const e=()=>{var o,r;return(r=(o=P.tips).success)==null?void 0:r.call(o,...t)};return new k(e,this.reject)}}const h=class h{constructor(){if(new.target===h)throw new Error("请直接使用静态方法,而不是实例化此类")}static register(t,e){if(typeof e!="function")return console.error("TipHandler must be a function");h.tips[t]=e}static resolveTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new Xe(o)}}static rejectTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new Ge(o)}}};y(h,"tips",{info:void 0,success:void 0,warning:void 0,error:void 0}),y(h,"info",h.resolveTip("info")),y(h,"success",h.resolveTip("success")),y(h,"warning",h.rejectTip("warning")),y(h,"error",h.rejectTip("error"));let P=h;exports._CalculateCanvasSize=Oe;exports._CalculateDistance2D=He;exports._CapitalizeFirstLetter=me;exports._CheckConnectionWithXHR=Ee;exports._Clone=Me;exports._CloseOnOutsideClick=Pe;exports._ConvertToCamelCase=ge;exports._ConvertToPercentage=ze;exports._CopyToClipboard=be;exports._CreateAndDownloadFile=we;exports._Danger_ConvertDataToImageUrl=Le;exports._DataType=W;exports._Debounce=K;exports._DownloadFile=he;exports._Drag=ke;exports._EnterFullscreen=Q;exports._ExcludeSubstring=ue;exports._ExecuteWhenIdle=ae;exports._ExitFullscreen=ee;exports._FileTypeChecker=X;exports._FormatFileSize=Ye;exports._FormatNumber=qe;exports._FormatNumberWithUnit=$e;exports._Fullscreen=Ue;exports._GenerateUUID=xe;exports._GetFrameRate=pe;exports._GetHrefName=q;exports._GetMidpoint=We;exports._GetOtherSizeInPixels=Ie;exports._GetTargetByPath=Ce;exports._InitTargetByPath=ye;exports._IsFullscreen=te;exports._IsObject=ce;exports._IsPointInPolygon=Be;exports._IsSecureContext=Fe;exports._IsWithinErrorMargin=Ae;exports._KeyedWindowManager=G;exports._LoadImage=Se;exports._LocalDrag=De;exports._MergeObjects=N;exports._NotNull=se;exports._ReadFile=fe;exports._RotateList=Te;exports._Schedule=Ne;exports._ScrollEndListener=Re;exports._Throttle=ve;exports._TimeConsumption=je;exports._TimeTransition=de;exports._Tip=P;exports._UpdateTargetByPath=_e;exports._WaitForCondition=le;
|
|
2
|
+
"use strict";var ie=Object.defineProperty;var V=n=>{throw TypeError(n)};var se=(n,t,e)=>t in n?ie(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var y=(n,t,e)=>se(n,typeof t!="symbol"?t+"":t,e),Z=(n,t,e)=>t.has(n)||V("Cannot "+e);var c=(n,t,e)=>(Z(n,t,"read from private field"),e?e.call(n):t.get(n)),f=(n,t,e)=>t.has(n)?V("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),m=(n,t,e,o)=>(Z(n,t,"write to private field"),o?o.call(n,e):t.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ce={".mp3":"audio/mpeg",".mp4":"video/mp4",".m4a":"audio/mp4",".aac":"audio/aac",".ogg":"audio/ogg",".wav":"audio/wav",".flac":"audio/flac",".opus":"audio/opus",".webm":"video/webm",".avi":"video/x-msvideo",".mov":"video/quicktime",".wmv":"video/x-ms-wmv",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".bmp":"image/bmp",".tiff":"image/tiff",".ico":"image/vnd.microsoft.icon",".svg":"image/svg+xml",".webp":"image/webp",".heif":"image/heif",".heic":"image/heic",".json":"application/json",".xml":"application/xml",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".ts":"application/typescript",".csv":"text/csv",".tsv":"text/tab-separated-values",".txt":"text/plain",".md":"text/markdown",".rtf":"application/rtf",".pdf":"application/pdf",".zip":"application/zip",".rar":"application/x-rar-compressed",".tar":"application/x-tar",".gz":"application/gzip",".7z":"application/x-7z-compressed",".exe":"application/x-msdownload",".apk":"application/vnd.android.package-archive",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".odt":"application/vnd.oasis.opendocument.text",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odp":"application/vnd.oasis.opendocument.presentation",".jsonld":"application/ld+json",".yaml":"application/x-yaml",".yml":"application/x-yaml",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject",".map":"application/json"},H={image:[".jpg",".jpeg",".png",".gif",".bmp",".webp",".tiff",".svg",".heif",".heic",".ico",".raw",".jfif",".avif",".png8",".indd",".eps",".ai"],ppt:[".ppt",".pptx",".odp"],word:[".doc",".docx",".odt",".rtf"],excel:[".xls",".xlsx",".ods",".csv",".tsv"],pdf:[".pdf"],text:[".txt",".csv",".md",".json",".yaml",".yml",".log",".ini",".rtf"],audio:[".mp3",".wav",".ogg",".flac",".aac",".wma",".m4a",".alac",".ape",".opus",".amr",".ra",".mid",".midi",".aiff",".pcm",".au",".wavpack",".spx"],video:[".mp4",".avi",".mkv",".mov",".wmv",".flv",".webm",".mpg",".mpeg",".3gp",".vob",".ogv",".m4v",".ts",".rm",".rmvb",".m2ts",".divx",".xvid",".swf",".f4v"],archive:[".zip",".rar",".tar",".gz",".bz2",".xz",".7z",".tar.gz",".tar.bz2",".tar.xz",".tar.lz",".tar.lzma",".cab",".iso",".dmg",".tgz",".apk",".gz2",".tar.zst"],code:[".js",".ts",".py",".java",".cpp",".c",".html",".css",".scss",".less",".sass",".php",".rb",".go",".swift",".rs",".kt",".scala",".lua",".pl",".m",".h",".xml",".json",".yaml",".yml",".toml",".vue",".ejs",".handlebars",".jinja",".dart"],font:[".woff",".woff2",".ttf",".otf",".eot",".svg",".ttc",".fnt",".fon",".otc"],database:[".sql",".sqlite",".db",".mdb",".accdb",".jsonld",".xml",".csv"],markup:[".html",".htm",".xhtml",".xml",".json",".yaml",".yml"],configuration:[".ini",".conf",".cfg",".env",".properties",".json",".toml"],logs:[".log",".err",".trace",".out"],script:[".bash",".sh",".zsh",".bat",".ps1",".vbs",".cmd",".sed",".awk",".php"]},K=["","万","亿","兆","京","垓","秭","穰","沟","涧","正","载","极"];function ae(n){return n!=null}function le(n){return!(n===null||typeof n!="object"||Array.isArray(n))}function ue(n){if(typeof n!="function")return console.error("非函数:",n);const t=function(e){e.didTimeout||e.timeRemaining()<=0?requestIdleCallback(t):n()};requestIdleCallback(t)}function me(n,t){const e=+new Date;return new Promise((o,r)=>{const i=()=>{if(+new Date-e>=t)return r("超时");if(n())return o("完成");requestIdleCallback(i)};i()})}function de(n,t,e=","){const o=new RegExp(`(^|${e})${t}(${e}|$)`,"g");return n.replace(o,function(r,i,s){return i===s?e:""})}function fe(n){return n.charAt(0).toUpperCase()+n.slice(1)}function N(n,t,e=[],o=+new Date){if(o<+new Date-50){console.error("_MergeObjects 合并异常:疑似死循环");return}const r=X(n),i=X(t);if(r!=i)return t;if(r=="object"||r=="array"){if(e.some(([s,a])=>s==n&&a==t))return n;if(e.push([n,t]),r=="object"){for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){const a=t[s],l=n[s],u=N(l,a,e,o);n[s]=u}return n}else if(r=="array")return t.forEach((s,a)=>{const l=s,u=n[a],d=N(u,l,e,o);n[a]=d}),n}else return t}function he(n,t="YYYY-MM-DD hh:mm:ss",e=!0){const o=new Date(n);if(isNaN(o.getTime()))return console.error("Invalid date"),"";const r={YYYY:i=>i.getFullYear(),MM:i=>i.getMonth()+1,DD:i=>i.getDate(),hh:i=>i.getHours(),mm:i=>i.getMinutes(),ss:i=>i.getSeconds(),ms:i=>i.getMilliseconds()};return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g,i=>{const s=r[i](o);return e?String(s).padStart(2,"0"):String(s)})}function pe(n){return new Promise((t,e)=>{fetch(n).then(o=>t(o.text())).catch(o=>{console.error("Error fetching :",o),e(o)})})}function q(n,t="file"){if(!n||(n=String(n).trim(),n===""))return t;const e=n.split("/");return e[e.length-1].split("?")[0]}function ge(n,t){return new Promise((e,o)=>{try{t=t||q(n,"downloaded_file"),fetch(n).then(r=>(r.ok||o(`文件下载失败,状态码: ${r.status}`),r.blob())).then(r=>{const i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=decodeURIComponent(t),document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i),e(r)}).catch(o)}catch(r){o(r)}})}function we(n,t=10){let e=0,o=t;function r(){if(o>0)o--,requestAnimationFrame(r);else{const s=(+new Date-e)/t,a=1e3/s;n(Number(a.toFixed(2)),Number(s.toFixed(2)))}}requestAnimationFrame(()=>{e=+new Date,r()})}function xe(n,t){return n=n.replace(/([^a-zA-Z][a-z])/g,e=>e.toUpperCase()),t?n.replace(/[^a-zA-Z]+/g,""):n}function ve(n,t,e){if(!e){let s=t.replace(/^[^.]+./,"");s=s==t?"text/plain":"application/"+s,e={type:s}}const o=new Blob(n,e),r=URL.createObjectURL(o),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function be(n=""){return n+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function J(n,t){let e;return function(...o){clearTimeout(e),e=setTimeout(()=>{n(...o),e=void 0},t)}}function ye(n,t){let e=-1/0;return function(...o){const r=performance.now();if(r-e>t){e=r;try{n(...o)}catch(i){console.error("Throttled function execution failed:",i)}}}}function X(n){return Array.isArray(n)?"array":n===null?"null":typeof n}function _e(n){const t=()=>Promise.resolve(),e=a=>(console.error(a),Promise.reject(a));function o(){return navigator.clipboard.writeText(n).then(t).catch(e)}function r(){const a=document.createElement("div");a.innerText=n,document.body.appendChild(a);const l=document.createRange();l.selectNodeContents(a);const u=window.getSelection();let d=!1;return u&&(u.removeAllRanges(),u.addRange(l),d=document.execCommand("copy")),document.body.removeChild(a),d?Promise.resolve():Promise.reject()}function i(){const a=document.createElement("textarea");a.value=n,document.body.appendChild(a),a.select(),a.setSelectionRange(0,n.length);let l=!1;return document.activeElement===a&&(l=document.execCommand("Copy",!0)),document.body.removeChild(a),l?Promise.resolve():Promise.reject()}function s(){return r().then(t).catch(()=>{i().then(t).catch(()=>e("复制方式尽皆失效"))})}return navigator.clipboard?o().catch(s):s()}function Ce(n,t){const e=t.split(".");return e.reduce((o,r,i)=>(r in o||(i===e.length-1?o[r]=void 0:o[r]={}),o[r]),n)}function Ee(n,t){const e=t.split(".");return e.reduce((o,r,i)=>o.hasOwnProperty(r)?o[r]:o[r]=i==e.length-1?void 0:{},n)}function Me(n,t,e){const o=t.split(".");return o.reduce((r,i,s)=>(s===o.length-1&&(r[i]=e),r[i]),n)}function Fe(n){return new Promise((t,e)=>{if(typeof n!="string"||n.trim()===""||!n.includes("://")){e(new Error("Invalid URL: Must be a non-empty string"));return}try{new XMLHttpRequest().open("HEAD",n,!0)}catch(i){e(new Error(`Invalid URL format: ${i.message}`));return}const o=new XMLHttpRequest;o.open("HEAD",n,!0);const r=i=>{e(new Error(`Request failed: ${i.type}`))};o.onreadystatechange=function(){o.readyState===XMLHttpRequest.DONE&&(o.status===0?e(new Error("Network error or CORS blocked")):o.status>=200&&o.status<300?t(!0):e(new Error(`HTTP Error: ${o.status}`)))},o.onerror=r,o.onabort=r,o.ontimeout=r;try{o.send()}catch(i){e(new Error(`Request send failed: ${i.message}`))}})}function Te(n){return["https:","wss:","ftps:","sftp:","smpts:","smtp+tls:","imap+tls:","pop3+tls:","rdp:","vpn:"].some(e=>n.startsWith(e))}const E=class E{constructor(){if(new.target===E)throw new Error("请直接使用静态方法,而不是实例化此类")}static check(t,e){if(!t||typeof t!="string")return console.error("Invalid URL provided"),e?!1:"unknown";const o=q(t).toLowerCase();if(e){if(!H.hasOwnProperty(e))return console.error(`Unknown file type: ${e}`),"unknown";const r=H[e];return E._checkExtension(o,r)}return E._detectFileType(o)}static parseAddresses(t){return!t||typeof t!="string"?(console.error("Invalid URL provided"),[]):t.split(",").map(e=>{const o=q(e),r=this.check(e);return{url:e,name:o,type:r}})}static matchesMimeType(t,e){if(!e)return!0;if(typeof t!="string"||typeof e!="string")return!1;const o=E._normalizeType(t),r=e.split(",").map(a=>E._normalizeType(a.trim())),[i,s="*"]=o.split("/");return r.some(a=>{const[l,u="*"]=a.split("/");return(l==="*"||i==="*"||l===i)&&(u==="*"||s==="*"||u===s)})}static _normalizeType(t){return t.startsWith(".")&&!t.includes("/")?ce[t.toLowerCase()]||t:t.includes("/")?t:`${t}/*`}static _checkExtension(t,e){return e.some(o=>t.endsWith(o))}static _detectFileType(t){for(const[e,o]of E.cachedEntries)if(o.some(r=>t.endsWith(r)))return e;return"unknown"}};y(E,"cachedEntries",Object.entries(H));let G=E;function Le(n){return n.map((t,e)=>n.slice(e).concat(n.slice(0,e)))}function Pe(n){const t=window.structuredClone,e=o=>o===null||typeof o!="object"?o:N(Array.isArray(o)?[]:{},o);try{return t?t(n):e(n)}catch(o){return console.error("structuredClone error:",o),t&&e(n)}}class Q{constructor(){}static add(t,e){this.keys.set(t,e)}static open(t,e,o,r){const i=this.keys.get(t);if(i&&!i.closed)return i.focus(),i;{const s=window.open(e,o,r);if(s)return this.keys.set(t,s),s;console.error("window.open failed: 可能是浏览器阻止了弹出窗口"),this.keys.delete(t)}}static isOpen(t){const e=this.keys.get(t);return e!=null&&e.closed&&this.keys.delete(t),this.keys.has(t)}static getWindow(t){if(this.isOpen(t))return this.keys.get(t)}static close(t){const e=this.keys.get(t);e&&(e.close(),this.keys.delete(t))}static closeAll(){this.keys.forEach((t,e)=>t.close()),this.keys.clear()}}y(Q,"keys",new Map);function Re(n,t="image/png"){try{let e,o=t;if(n instanceof File)return URL.createObjectURL(n);if(typeof n=="string"){let i=n;const s=i.match(/^data:([^;]*)(;base64)?,(.*)$/i);if(s){if(!s[2])throw new Error("无效的数据 URL:缺少 base64 编码声明");if(o=s[1]||o,i=s[3],!i)throw new Error("数据 URL 包含空有效负载")}i=i.replace(/[^A-Za-z0-9+/=]/g,"");const a=atob(i);e=new Uint8Array(a.length);for(let l=0;l<a.length;l++)e[l]=a.charCodeAt(l)}else if(n instanceof ArrayBuffer)e=new Uint8Array(n);else if(n instanceof Uint8Array)e=n;else throw new Error("不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array");const r=new Blob([e],{type:o});return URL.createObjectURL(r)}catch(e){return console.error("数据到 ImageURL 的转换失败:",e.message,e.stack||"没有可用的堆栈跟踪"),null}}function Ie(n,t,e=30){if(typeof n!="function")throw new Error("The first argument must be a function.");if(!Array.isArray(t))throw new Error("The second argument must be an array.");let o=[],r=0;const i=(s,a)=>{for(const[l,u]of a)if(s>=l)return u;return"black"};return function(...s){const a=performance.now(),l=n(...s),u=performance.now()-a;o.push(u),o.length>e&&o.shift(),r=o.reduce((F,W)=>F+W,0)/o.length||0;const d=i(u,t),p=i(r,t);return console.log(`%c单次耗时:${u.toFixed(2)}ms
|
|
3
|
+
%c平均耗时(${o.length}次):${r.toFixed(2)}ms`,`color: ${d}; padding: 2px 0;`,`color: ${p}; padding: 2px 0;`),l}}function je(n){const t=J(n,100);let e=0,o=0;return function(r){const i=r.target;if(!i||!(i instanceof Element))return;const{scrollTop:s,scrollHeight:a,clientHeight:l,scrollLeft:u,scrollWidth:d,clientWidth:p}=i;function F(){if(e==s)return;const Y=e>s;if(e=s,Y)return;a-s-l<=1&&t("vertical")}function W(){if(o==u)return;const Y=o>u;if(o=u,Y)return;d-u-p<=1&&t("horizontal")}F(),W()}}function De(n,t,e){const{isClickAllowed:o,uiLibrary:r=["naiveUI","ElementPlus","Element"]}=e||{},i=function(l){const u=[];for(const d in l)Object.hasOwnProperty.call(l,d)&&r.includes(d)&&u.push(...l[d]);return u}({naiveUI:[".v-binder-follower-container",".n-image-preview-container",".n-modal-container"],ElementPlus:[".el-popper"],Element:[".el-popper"]});function s(){t(),document.removeEventListener("mousedown",a)}function a(l){if(o){const p=o(l);if(p)return;if(p===!1)return s()}const u=l.target;if(!(u instanceof Element)||!u.isConnected)return;n.concat(i).some(p=>!!(u!=null&&u.closest(p)))||s()}requestAnimationFrame(()=>document.addEventListener("mousedown",a))}var w,T,L,D,k,_,C,M,A;class ke{constructor(){f(this,w);f(this,T,!1);f(this,L,{});f(this,D,0);f(this,k,0);f(this,_,0);f(this,C,0);f(this,M);f(this,A)}init(t,e){m(this,w,t),m(this,M,e==null?void 0:e.limit),m(this,A,e==null?void 0:e.dragDom),m(this,L,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!c(this,w))return console.error("No DOM");c(this,w)[e]("mousedown",c(this,L).mousedown),document[e]("mousemove",c(this,L).mousemove),document[e]("mouseup",c(this,L).mouseup)}alterLocation(){if(!c(this,w))return console.error("No DOM");c(this,M)&&(m(this,_,Math.min(c(this,_),c(this,M).max.top)),m(this,_,Math.max(c(this,_),c(this,M).min.top)),m(this,C,Math.min(c(this,C),c(this,M).max.left)),m(this,C,Math.max(c(this,C),c(this,M).min.left))),c(this,w).style.setProperty("--top",c(this,_)+"px"),c(this,w).style.setProperty("--left",c(this,C)+"px")}mousedown(t){if(!c(this,w))return console.error("No DOM");if(c(this,A)&&t.target!=c(this,A))return;document.body.classList.add("no-select"),m(this,T,!0);const e=c(this,w).getBoundingClientRect(),{pageX:o,pageY:r}=t;m(this,D,o),m(this,k,r),m(this,_,e.y),m(this,C,e.x)}mousemove(t){const{pageX:e,pageY:o}=t;c(this,T)&&(m(this,_,c(this,_)+(o-c(this,k))),m(this,C,c(this,C)+(e-c(this,D))),m(this,D,e),m(this,k,o),this.alterLocation())}mouseup(){c(this,T)&&(m(this,T,!1),document.body.classList.remove("no-select"))}}w=new WeakMap,T=new WeakMap,L=new WeakMap,D=new WeakMap,k=new WeakMap,_=new WeakMap,C=new WeakMap,M=new WeakMap,A=new WeakMap;var x,P,R,S,U,v,b,g,O,z;class Ae{constructor(){f(this,x);f(this,P,!1);f(this,R,{});f(this,S,0);f(this,U,0);f(this,v,0);f(this,b,0);f(this,g);f(this,O);f(this,z)}init(t,e={}){m(this,x,t),m(this,g,e.limit),m(this,O,e.update_move),m(this,z,e.update_up),m(this,R,{mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this)}),this.bindOrUnbindEvent("bind")}finish(){this.bindOrUnbindEvent("unbind")}bindOrUnbindEvent(t){const e=t==="bind"?"addEventListener":"removeEventListener";if(!c(this,x))return console.error("No DOM");c(this,x)[e]("mousedown",c(this,R).mousedown),document[e]("mousemove",c(this,R).mousemove),document[e]("mouseup",c(this,R).mouseup)}updateValue(){const t={top:c(this,v),left:c(this,b),percentage:{top:0,left:0}};if(c(this,g)){const e=o=>c(this,g)?(t[o]-c(this,g).min[o])/(c(this,g).max[o]-c(this,g).min[o]):0;t.percentage={top:e("top")||0,left:e("left")||0}}return t}alterLocation(){if(!c(this,x))return console.error("No DOM");c(this,g)&&(m(this,v,Math.min(c(this,v),c(this,g).max.top)),m(this,v,Math.max(c(this,v),c(this,g).min.top)),m(this,b,Math.min(c(this,b),c(this,g).max.left)),m(this,b,Math.max(c(this,b),c(this,g).min.left))),c(this,O)&&c(this,O).call(this,this.updateValue()),c(this,x).style.setProperty("--top",c(this,v)+"px"),c(this,x).style.setProperty("--left",c(this,b)+"px")}mousedown(t){if(!c(this,x))return console.error("No DOM");document.body.classList.add("no-select"),m(this,P,!0);const e=c(this,x).getBoundingClientRect();m(this,U,e.y),m(this,S,e.x);const{pageX:o,pageY:r}=t;m(this,v,r-c(this,U)),m(this,b,o-c(this,S)),this.alterLocation()}mousemove(t){const{pageX:e,pageY:o}=t;c(this,P)&&(m(this,v,o-c(this,U)),m(this,b,e-c(this,S)),this.alterLocation())}mouseup(){c(this,P)&&(m(this,P,!1),document.body.classList.remove("no-select"),c(this,z)&&c(this,z).call(this,this.updateValue()))}}x=new WeakMap,P=new WeakMap,R=new WeakMap,S=new WeakMap,U=new WeakMap,v=new WeakMap,b=new WeakMap,g=new WeakMap,O=new WeakMap,z=new WeakMap;function ee(n){const t=n||document.documentElement;if(n){if(n.requestFullscreen)return n.requestFullscreen();if(t.mozRequestFullScreen)return t.mozRequestFullScreen();if(t.webkitRequestFullscreen)return t.webkitRequestFullscreen();if(t.msRequestFullscreen)return t.msRequestFullscreen()}else return Promise.reject("No DOM");return Promise.reject("No Fullscreen API")}function te(){const n=document;return document.exitFullscreen?document.exitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.msExitFullscreen?n.msExitFullscreen():Promise.reject("No ExitFullscreen API")}function ne(n){n=n||document.documentElement;const t=document,e=document.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;return n==e}function Se(n){return function(){ne(n)?te():ee(n)}}function Ue(n,t){if(typeof n=="number")return n;if(/px/.test(n))return Number(n.replace(/px/,""))||0;const e=document.createElement("div");e.style.width=n,t=t||document.body,t.appendChild(e);const o=e.getBoundingClientRect().width;return t.removeChild(e),o}function Oe(n,t){if(!n)return;let e,o;if(typeof t=="string"){const i=document.querySelector(t);if(!i)return;const s=i.getBoundingClientRect();e=s.width,o=s.height}else if(Array.isArray(t))e=t[0],o=t[1];else{const i=t.getBoundingClientRect();e=i.width,o=i.height}const r=e/o;return r>n?[n*o,o]:r<n?[e,e/n]:[e,o]}function ze(n,t=5e3){return new Promise((e,o)=>{const r=new Image;r.src=n;const i=setTimeout(()=>{o(new Error("图片加载超时")),r.onload=null,r.onerror=null},t);r.onload=()=>{clearTimeout(i);const s=r.naturalWidth,a=r.naturalHeight,l=s/a;e([r,l])},r.onerror=()=>{clearTimeout(i),o(new Error("图片加载失败"))},r.crossOrigin="Anonymous"})}function Ne(n){const t=Date.now();let e=performance.now();for(;Date.now()-t<n;){e=Math.sin(e)*1e6,(e>1e6||e<-1e6)&&(e=0);try{const o=e.toString().substring(0,8);history.replaceState(null,"",`#${o}`)}catch{}}return Date.now()-t}const qe=Math.PI/2,$=Math.PI/180,B=6378137,$e=85.05112878;function Be(n,t){const e=Math.max(Math.min(n,180),-180),o=Math.max(Math.min(t,$e),-85.05112878),r=e*$*B,i=o*$,s=Math.log(Math.tan(Math.PI/4+i/2))*B;return[r,s]}function We(n,t){const e=n/B/$,o=(2*Math.atan(Math.exp(t/B))-qe)/$;return[e,o]}function Ye(n,t,e){const[o,r]=n,[i,s]=t,[a,l]=e,u=(a-i)**2+(l-s)**2;if(u===0)return Math.sqrt((o-i)**2+(r-s)**2);let d=((o-i)*(a-i)+(r-s)*(l-s))/u;return d=Math.max(0,Math.min(1,d)),Math.sqrt((o-(i+d*(a-i)))**2+(r-(s+d*(l-s)))**2)}function oe(n){return Array.isArray(n)&&typeof n[0]=="number"&&typeof n[1]=="number"&&isFinite(n[0])&&isFinite(n[1])}function He(n){return Array.isArray(n)&&n.every(t=>oe(t))}function Xe(n,t,e=2){return!Number.isFinite(n)||!Number.isFinite(t)||!Number.isFinite(e)?(console.error("所有参数必须是有限的数字"),""):t===0?(console.error("分母不能为零"),""):e<0?(console.error("小数位数不能为负数"),""):(n/t*100).toFixed(e)+"%"}function Ge(n,t,e){return Math.abs(n-t)<=e}function Ve(n,t=500){let e,o=!0;function r(i){if(!o)return;e||(e=i);let s=Math.min((i-e)/t,1);n(s),i-e<t&&requestAnimationFrame(r)}return requestAnimationFrame(r),()=>o=!1}function Ze(n){const e=n.toString().split("."),o=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,",");return e.length>1?o+"."+e[1]:o}function Ke(n,t){const e={join:!0,suffix:"",decimalPlaces:2},{join:o,suffix:r,decimalPlaces:i}={...e,...t||{}},s=Number(n);if(isNaN(s))return o?`0${r}`:[0,r];const a=Math.abs(s),l=s>=0,u=Math.max(0,Math.floor(Math.log10(a)/4)),d=Math.pow(1e4,u),p=a/d,F=(l?1:-1)*parseFloat(p.toFixed(Math.max(0,i)));return o?`${F}${K[u]}${r}`:[F,K[u]+r]}function Je(n,t){let e=!1;const{x:o,y:r}=n,i=t.length;for(let s=0,a=i-1;s<i;a=s++){const l=t[s].x,u=t[s].y,d=t[a].x,p=t[a].y;u>r!=p>r&&o<(d-l)*(r-u)/(p-u)+l&&(e=!e)}return e}function Qe(n){const t=["B","KB","MB","GB","TB","PB"];let e=0;for(;n>1024;)n/=1024,e++;return`${Math.round(n*100)/100} ${t[e]}`}function et(n,t,e,o){return Math.sqrt(Math.pow(e-n,2)+Math.pow(o-t,2))}function tt(n,t,e,o){const r=(n+e)/2,i=(t+o)/2;return{x:r,y:i}}class j{constructor(t,e){y(this,"resolve");y(this,"reject");this.resolve=t,this.reject=e}run(t){var e,o;return t instanceof Promise?t.then(r=>{var i;return(i=this.resolve)==null||i.call(this),r}).catch(r=>{var i;return(i=this.reject)==null||i.call(this),Promise.reject(r)}):t?(e=this.resolve)==null||e.call(this):(o=this.reject)==null||o.call(this),t}}class nt extends j{constructor(t){super(),this.resolve=t}warning(...t){const e=()=>{var o,r;return(r=(o=I.tips).warning)==null?void 0:r.call(o,...t)};return new j(this.resolve,e)}error(...t){const e=()=>{var o,r;return(r=(o=I.tips).error)==null?void 0:r.call(o,...t)};return new j(this.resolve,e)}}class ot extends j{constructor(t){super(),this.reject=t}info(...t){const e=()=>{var o,r;return(r=(o=I.tips).info)==null?void 0:r.call(o,...t)};return new j(e,this.reject)}success(...t){const e=()=>{var o,r;return(r=(o=I.tips).success)==null?void 0:r.call(o,...t)};return new j(e,this.reject)}}const h=class h{constructor(){if(new.target===h)throw new Error("请直接使用静态方法,而不是实例化此类")}static register(t,e){if(typeof e!="function")return console.error("TipHandler must be a function");h.tips[t]=e}static resolveTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new nt(o)}}static rejectTip(t){return function(...e){const o=()=>{var r,i;return(i=(r=h.tips)[t])==null?void 0:i.call(r,...e)};return new ot(o)}}};y(h,"tips",{info:void 0,success:void 0,warning:void 0,error:void 0}),y(h,"info",h.resolveTip("info")),y(h,"success",h.resolveTip("success")),y(h,"warning",h.rejectTip("warning")),y(h,"error",h.rejectTip("error"));let I=h;exports._AreAllArraysValid=He;exports._CalculateCanvasSize=Oe;exports._CalculateDistance2D=et;exports._CapitalizeFirstLetter=fe;exports._CheckConnectionWithXHR=Fe;exports._Clone=Pe;exports._CloseOnOutsideClick=De;exports._ConvertToCamelCase=xe;exports._ConvertToPercentage=Xe;exports._CopyToClipboard=_e;exports._CreateAndDownloadFile=ve;exports._Danger_ConvertDataToImageUrl=Re;exports._DataType=X;exports._Debounce=J;exports._DownloadFile=ge;exports._Drag=ke;exports._EnterFullscreen=ee;exports._ExcludeSubstring=de;exports._ExecuteWhenIdle=ue;exports._ExitFullscreen=te;exports._FileTypeChecker=G;exports._FormatFileSize=Qe;exports._FormatNumber=Ze;exports._FormatNumberWithUnit=Ke;exports._Fullscreen=Se;exports._GenerateUUID=be;exports._GetFrameRate=we;exports._GetHrefName=q;exports._GetMidpoint=tt;exports._GetOtherSizeInPixels=Ue;exports._GetTargetByPath=Ee;exports._InitTargetByPath=Ce;exports._IsFullscreen=ne;exports._IsObject=le;exports._IsPointInPolygon=Je;exports._IsSecureContext=Te;exports._IsSingleArrayValid=oe;exports._IsWithinErrorMargin=Ge;exports._KeyedWindowManager=Q;exports._LngLatToPlane=Be;exports._LoadImage=ze;exports._LocalDrag=Ae;exports._MergeObjects=N;exports._NotNull=ae;exports._PlaneToLngLat=We;exports._PointToLineDistance=Ye;exports._ReadFile=pe;exports._RotateList=Le;exports._Schedule=Ve;exports._ScrollEndListener=je;exports._Sleep=Ne;exports._Throttle=ye;exports._TimeConsumption=Ie;exports._TimeTransition=he;exports._Tip=I;exports._UpdateTargetByPath=Me;exports._WaitForCondition=me;
|