nhanh-pure-function 2.0.4 → 2.0.5
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 +9 -1
- package/dist/Utility/index.d.ts +3 -1
- package/dist/index.cjs.js +2 -1
- package/dist/index.es.js +223 -188
- package/package.json +1 -1
package/dist/Math/index.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export declare function _IsWithinErrorMargin(value: number, target: number, erro
|
|
|
19
19
|
* 进度
|
|
20
20
|
* @param {(schedule)=>void} callback callback( 进度百分比 )
|
|
21
21
|
* @param {Number} TIME 总时长
|
|
22
|
+
* @returns {Function} 停止函数
|
|
22
23
|
*/
|
|
23
|
-
export declare function _Schedule(callback: (schedule: number) => void, TIME?: number):
|
|
24
|
+
export declare function _Schedule(callback: (schedule: number) => void, TIME?: number): () => boolean;
|
|
24
25
|
/**
|
|
25
26
|
* 格式化数字,给数字加上千位分隔符。
|
|
26
27
|
* @param {number} number - 要格式化的数字。
|
|
@@ -58,3 +59,10 @@ export declare function _IsPointInPolygon(point: Point, polygon: Point[]): boole
|
|
|
58
59
|
* @returns string
|
|
59
60
|
*/
|
|
60
61
|
export declare function _FormatFileSize(size: number): string;
|
|
62
|
+
/** 计算平面直角坐标系中两点的距离 */
|
|
63
|
+
export declare function _CalculateDistance2D(x1: number, y1: number, x2: number, y2: number): number;
|
|
64
|
+
/** 获取两点的中点 */
|
|
65
|
+
export declare function _GetMidpoint(x1: number, y1: number, x2: number, y2: number): {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
package/dist/Utility/index.d.ts
CHANGED
|
@@ -250,7 +250,7 @@ export declare function _RotateList<T>(list: T[]): T[][];
|
|
|
250
250
|
* @param {any} val - 需要克隆的值
|
|
251
251
|
* @returns {any} - 克隆后的值
|
|
252
252
|
*/
|
|
253
|
-
export declare function _Clone<T>(val: T): T |
|
|
253
|
+
export declare function _Clone<T>(val: T): T | undefined;
|
|
254
254
|
/**
|
|
255
255
|
* 管理通过键值对打开的窗口
|
|
256
256
|
*/
|
|
@@ -302,3 +302,5 @@ export declare class _KeyedWindowManager {
|
|
|
302
302
|
* @returns 成功时返回图像的URL,失败时返回null
|
|
303
303
|
*/
|
|
304
304
|
export declare function _Danger_ConvertDataToImageUrl(data: string | ArrayBuffer | Uint8Array | File, mimeType?: string): string | null;
|
|
305
|
+
/** 时间消耗 */
|
|
306
|
+
export declare function _TimeConsumption(func: Function, level: [number, string][]): (...args: any[]) => any;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +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 G=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),V=(n,t,e)=>t.has(n)||G("Cannot "+e);var s=(n,t,e)=>(V(n,t,"read from private field"),e?e.call(n):t.get(n)),d=(n,t,e)=>t.has(n)?G("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e),l=(n,t,e,o)=>(V(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"},Y={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"]},Z=["","万","亿","兆","京","垓","秭","穰","沟","涧","正","载","极"];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,c){return i===c?e:""})}function me(n){return n.charAt(0).toUpperCase()+n.slice(1)}function A(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(([c,a])=>c==n&&a==t))return n;if(e.push([n,t]),r=="object"){for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const a=t[c],m=n[c],u=A(m,a,e,o);n[c]=u}return n}else if(r=="array")return t.forEach((c,a)=>{const m=c,u=n[a],f=A(u,m,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 c=r[i](o);return e?String(c).padStart(2,"0"):String(c)})}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),c=document.createElement("a");c.href=i,c.download=decodeURIComponent(t),document.body.appendChild(c),c.click(),document.body.removeChild(c),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 c=(+new Date-e)/t,a=1e3/c;n(Number(a.toFixed(2)),Number(c.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 c=t.replace(/^[^.]+./,"");c=c==t?"text/plain":"application/"+c,e={type:c}}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 J(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 m=document.createRange();m.selectNodeContents(a);const u=window.getSelection();let f=!1;return u&&(u.removeAllRanges(),u.addRange(m),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 m=!1;return document.activeElement===a&&(m=document.execCommand("Copy",!0)),document.body.removeChild(a),m?Promise.resolve():Promise.reject()}function c(){return r().then(t).catch(()=>{i().then(t).catch(()=>e("复制方式尽皆失效"))})}return navigator.clipboard?o().catch(c):c()}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 _e(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 Ce(n,t,e){const o=t.split(".");return o.reduce((r,i,c)=>(c===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(!Y.hasOwnProperty(e))return console.error(`Unknown file type: ${e}`),"unknown";const r=Y[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,c="*"]=o.split("/");return r.some(a=>{const[m,u="*"]=a.split("/");return(m==="*"||i==="*"||m===i)&&(u==="*"||c==="*"||u===c)})}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(Y));let H=E;function Te(n){return n.map((t,e)=>n.slice(e).concat(n.slice(0,e)))}function Le(n){const t=window.structuredClone,e=o=>o===null||typeof o!="object"?o:A(Array.isArray(o)?[]:{},o);try{return t?t(n):e(n)}catch(o){return console.error("structuredClone error:",o),t&&e(n)}}const B=class B{constructor(){if(new.target===B)throw new Error("请直接使用静态方法,而不是实例化此类")}static open(t,e,o,r){const i=this.keys.get(t);if(i&&!i.closed)return i.focus(),i;{const c=window.open(e,o,r);if(c)return this.keys.set(t,c),c;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(B,"keys",new Map);let X=B;function Me(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 c=i.match(/^data:([^;]*)(;base64)?,(.*)$/i);if(c){if(!c[2])throw new Error("无效的数据 URL:缺少 base64 编码声明");if(o=c[1]||o,i=c[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 m=0;m<a.length;m++)e[m]=a.charCodeAt(m)}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){const t=J(n,100);let e=0,o=0;return function(r){const i=r.target;if(!i||!(i instanceof HTMLElement))return;const{scrollTop:c,scrollHeight:a,clientHeight:m,scrollLeft:u,scrollWidth:f,clientWidth:g}=i;function N(){if(e==c)return;const $=e>c;if(e=c,$)return;a-c-m<=1&&t("vertical")}function te(){if(o==u)return;const $=o>u;if(o=u,$)return;f-u-g<=1&&t("horizontal")}N(),te()}}function Re(n,t,e){const{isClickAllowed:o,uiLibrary:r=["naiveUI","ElementPlus","Element"]}=e||{},i=function(m){const u=[];for(const f in m)Object.hasOwnProperty.call(m,f)&&r.includes(f)&&u.push(...m[f]);return u}({naiveUI:[".v-binder-follower-container",".n-image-preview-container",".n-modal-container"],ElementPlus:[".el-popper"],Element:[".el-popper"]});function c(){t(),document.removeEventListener("mousedown",a)}function a(m){if(o){const g=o(m);if(g)return;if(g===!1)return c()}const u=m.target;if(!(u instanceof HTMLElement)||!(u!=null&&u.closest("body")))return;n.concat(i).some(g=>!!(u!=null&&u.closest(g)))||c()}requestAnimationFrame(()=>document.addEventListener("mousedown",a))}var w,T,L,k,U,_,C,F,I;class Pe{constructor(){d(this,w);d(this,T,!1);d(this,L,{});d(this,k,0);d(this,U,0);d(this,_,0);d(this,C,0);d(this,F);d(this,I)}init(t,e){l(this,w,t),l(this,F,e==null?void 0:e.limit),l(this,I,e==null?void 0:e.dragDom),l(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(!s(this,w))return console.error("No DOM");s(this,w)[e]("mousedown",s(this,L).mousedown),document[e]("mousemove",s(this,L).mousemove),document[e]("mouseup",s(this,L).mouseup)}alterLocation(){if(!s(this,w))return console.error("No DOM");s(this,F)&&(l(this,_,Math.min(s(this,_),s(this,F).max.top)),l(this,_,Math.max(s(this,_),s(this,F).min.top)),l(this,C,Math.min(s(this,C),s(this,F).max.left)),l(this,C,Math.max(s(this,C),s(this,F).min.left))),s(this,w).style.setProperty("--top",s(this,_)+"px"),s(this,w).style.setProperty("--left",s(this,C)+"px")}mousedown(t){if(!s(this,w))return console.error("No DOM");if(s(this,I)&&t.target!=s(this,I))return;document.body.classList.add("no-select"),l(this,T,!0);const e=s(this,w).getBoundingClientRect(),{pageX:o,pageY:r}=t;l(this,k,o),l(this,U,r),l(this,_,e.y),l(this,C,e.x)}mousemove(t){const{pageX:e,pageY:o}=t;s(this,T)&&(l(this,_,s(this,_)+(o-s(this,U))),l(this,C,s(this,C)+(e-s(this,k))),l(this,k,e),l(this,U,o),this.alterLocation())}mouseup(){s(this,T)&&(l(this,T,!1),document.body.classList.remove("no-select"))}}w=new WeakMap,T=new WeakMap,L=new WeakMap,k=new WeakMap,U=new WeakMap,_=new WeakMap,C=new WeakMap,F=new WeakMap,I=new WeakMap;var x,M,j,D,O,v,b,p,S,z;class ke{constructor(){d(this,x);d(this,M,!1);d(this,j,{});d(this,D,0);d(this,O,0);d(this,v,0);d(this,b,0);d(this,p);d(this,S);d(this,z)}init(t,e={}){l(this,x,t),l(this,p,e.limit),l(this,S,e.update_move),l(this,z,e.update_up),l(this,j,{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(!s(this,x))return console.error("No DOM");s(this,x)[e]("mousedown",s(this,j).mousedown),document[e]("mousemove",s(this,j).mousemove),document[e]("mouseup",s(this,j).mouseup)}updateValue(){const t={top:s(this,v),left:s(this,b),percentage:{top:0,left:0}};if(s(this,p)){const e=o=>s(this,p)?(t[o]-s(this,p).min[o])/(s(this,p).max[o]-s(this,p).min[o]):0;t.percentage={top:e("top")||0,left:e("left")||0}}return t}alterLocation(){if(!s(this,x))return console.error("No DOM");s(this,p)&&(l(this,v,Math.min(s(this,v),s(this,p).max.top)),l(this,v,Math.max(s(this,v),s(this,p).min.top)),l(this,b,Math.min(s(this,b),s(this,p).max.left)),l(this,b,Math.max(s(this,b),s(this,p).min.left))),s(this,S)&&s(this,S).call(this,this.updateValue()),s(this,x).style.setProperty("--top",s(this,v)+"px"),s(this,x).style.setProperty("--left",s(this,b)+"px")}mousedown(t){if(!s(this,x))return console.error("No DOM");document.body.classList.add("no-select"),l(this,M,!0);const e=s(this,x).getBoundingClientRect();l(this,O,e.y),l(this,D,e.x);const{pageX:o,pageY:r}=t;l(this,v,r-s(this,O)),l(this,b,o-s(this,D)),this.alterLocation()}mousemove(t){const{pageX:e,pageY:o}=t;s(this,M)&&(l(this,v,o-s(this,O)),l(this,b,e-s(this,D)),this.alterLocation())}mouseup(){s(this,M)&&(l(this,M,!1),document.body.classList.remove("no-select"),s(this,z)&&s(this,z).call(this,this.updateValue()))}}x=new WeakMap,M=new WeakMap,j=new WeakMap,D=new WeakMap,O=new WeakMap,v=new WeakMap,b=new WeakMap,p=new WeakMap,S=new WeakMap,z=new WeakMap;function K(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 Q(){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 ee(){const n=document;return document.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement}function Ue(n){return function(){ee()?Q():K(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 De(n,t){if(!n)return;let e,o;if(typeof t=="string"){const i=document.querySelector(t);if(!i)return;const c=i.getBoundingClientRect();e=c.width,o=c.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 Oe(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 c=r.naturalWidth,a=r.naturalHeight,m=c/a;e([r,m])},r.onerror=()=>{clearTimeout(i),o(new Error("图片加载失败"))},r.crossOrigin="Anonymous"})}function Se(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 ze(n,t,e){return Math.abs(n-t)<=e}function Ne(n,t=500){let e;function o(r){e||(e=r);let i=Math.min((r-e)/t,1);n(i),r-e<t&&requestAnimationFrame(o)}requestAnimationFrame(o)}function Ae(n){return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function qe(n,t){const e={join:!0,suffix:"",decimalPlaces:2},{join:o,suffix:r,decimalPlaces:i}={...e,...t||{}},c=Number(n);if(isNaN(c))return o?`0${r}`:[0,r];const a=Math.abs(c),m=c>=0,u=Math.max(0,Math.floor(Math.log10(a)/4)),f=Math.pow(1e4,u),g=a/f,N=(m?1:-1)*parseFloat(g.toFixed(Math.max(0,i)));return o?`${N}${Z[u]}${r}`:[N,Z[u]+r]}function Be(n,t){let e=!1;const{x:o,y:r}=n,i=t.length;for(let c=0,a=i-1;c<i;a=c++){const m=t[c].x,u=t[c].y,f=t[a].x,g=t[a].y;u>r!=g>r&&o<(f-m)*(r-u)/(g-u)+m&&(e=!e)}return e}function $e(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]}`}class P{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 Ye extends P{constructor(t){super(),this.resolve=t}warning(...t){const e=()=>{var o,r;return(r=(o=R.tips).warning)==null?void 0:r.call(o,...t)};return new P(this.resolve,e)}error(...t){const e=()=>{var o,r;return(r=(o=R.tips).error)==null?void 0:r.call(o,...t)};return new P(this.resolve,e)}}class We extends P{constructor(t){super(),this.reject=t}info(...t){const e=()=>{var o,r;return(r=(o=R.tips).info)==null?void 0:r.call(o,...t)};return new P(e,this.reject)}success(...t){const e=()=>{var o,r;return(r=(o=R.tips).success)==null?void 0:r.call(o,...t)};return new P(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 Ye(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 We(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 R=h;exports._CalculateCanvasSize=De;exports._CapitalizeFirstLetter=me;exports._CheckConnectionWithXHR=Ee;exports._Clone=Le;exports._CloseOnOutsideClick=Re;exports._ConvertToCamelCase=ge;exports._ConvertToPercentage=Se;exports._CopyToClipboard=be;exports._CreateAndDownloadFile=we;exports._Danger_ConvertDataToImageUrl=Me;exports._DataType=W;exports._Debounce=J;exports._DownloadFile=he;exports._Drag=Pe;exports._EnterFullscreen=K;exports._ExcludeSubstring=ue;exports._ExecuteWhenIdle=ae;exports._ExitFullscreen=Q;exports._FileTypeChecker=H;exports._FormatFileSize=$e;exports._FormatNumber=Ae;exports._FormatNumberWithUnit=qe;exports._Fullscreen=Ue;exports._GenerateUUID=xe;exports._GetFrameRate=pe;exports._GetHrefName=q;exports._GetOtherSizeInPixels=Ie;exports._GetTargetByPath=_e;exports._InitTargetByPath=ye;exports._IsFullscreen=ee;exports._IsObject=ce;exports._IsPointInPolygon=Be;exports._IsSecureContext=Fe;exports._IsWithinErrorMargin=ze;exports._KeyedWindowManager=X;exports._LoadImage=Oe;exports._LocalDrag=ke;exports._MergeObjects=A;exports._NotNull=se;exports._ReadFile=fe;exports._RotateList=Te;exports._Schedule=Ne;exports._ScrollEndListener=je;exports._Throttle=ve;exports._TimeTransition=de;exports._Tip=R;exports._UpdateTargetByPath=Ce;exports._WaitForCondition=le;
|
|
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;
|
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
2
|
var K = Object.defineProperty;
|
|
3
|
-
var
|
|
3
|
+
var X = (n) => {
|
|
4
4
|
throw TypeError(n);
|
|
5
5
|
};
|
|
6
6
|
var ee = (n, t, e) => t in n ? K(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
7
|
-
var y = (n, t, e) => ee(n, typeof t != "symbol" ? t + "" : t, e),
|
|
8
|
-
var
|
|
7
|
+
var y = (n, t, e) => ee(n, typeof t != "symbol" ? t + "" : t, e), W = (n, t, e) => t.has(n) || X("Cannot " + e);
|
|
8
|
+
var c = (n, t, e) => (W(n, t, "read from private field"), e ? e.call(n) : t.get(n)), d = (n, t, e) => t.has(n) ? X("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), m = (n, t, e, o) => (W(n, t, "write to private field"), o ? o.call(n, e) : t.set(n, e), e);
|
|
9
9
|
const te = {
|
|
10
10
|
/* 常见扩展名映射 */
|
|
11
11
|
".mp3": "audio/mpeg",
|
|
@@ -70,7 +70,7 @@ const te = {
|
|
|
70
70
|
".eot": "application/vnd.ms-fontobject",
|
|
71
71
|
".map": "application/json"
|
|
72
72
|
// 可根据需要继续扩展
|
|
73
|
-
},
|
|
73
|
+
}, Y = {
|
|
74
74
|
image: [
|
|
75
75
|
".jpg",
|
|
76
76
|
".jpeg",
|
|
@@ -250,7 +250,7 @@ const te = {
|
|
|
250
250
|
".awk",
|
|
251
251
|
".php"
|
|
252
252
|
]
|
|
253
|
-
},
|
|
253
|
+
}, G = [
|
|
254
254
|
"",
|
|
255
255
|
"万",
|
|
256
256
|
"亿",
|
|
@@ -295,32 +295,32 @@ function fe(n, t, e = ",") {
|
|
|
295
295
|
`(^|${e})${t}(${e}|$)`,
|
|
296
296
|
"g"
|
|
297
297
|
);
|
|
298
|
-
return n.replace(o, function(r, i,
|
|
299
|
-
return i ===
|
|
298
|
+
return n.replace(o, function(r, i, s) {
|
|
299
|
+
return i === s ? e : "";
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
function he(n) {
|
|
303
303
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function B(n, t, e = [], o = +/* @__PURE__ */ new Date()) {
|
|
306
306
|
if (o < +/* @__PURE__ */ new Date() - 50) {
|
|
307
307
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
|
-
const r =
|
|
310
|
+
const r = V(n), i = V(t);
|
|
311
311
|
if (r != i) return t;
|
|
312
312
|
if (r == "object" || r == "array") {
|
|
313
|
-
if (e.some(([
|
|
313
|
+
if (e.some(([s, a]) => s == n && a == t)) return n;
|
|
314
314
|
if (e.push([n, t]), r == "object") {
|
|
315
|
-
for (const
|
|
316
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
317
|
-
const a = t[
|
|
318
|
-
n[
|
|
315
|
+
for (const s in t)
|
|
316
|
+
if (Object.prototype.hasOwnProperty.call(t, s)) {
|
|
317
|
+
const a = t[s], u = n[s], l = B(u, a, e, o);
|
|
318
|
+
n[s] = l;
|
|
319
319
|
}
|
|
320
320
|
return n;
|
|
321
321
|
} else if (r == "array")
|
|
322
|
-
return t.forEach((
|
|
323
|
-
const
|
|
322
|
+
return t.forEach((s, a) => {
|
|
323
|
+
const u = s, l = n[a], f = B(l, u, e, o);
|
|
324
324
|
n[a] = f;
|
|
325
325
|
}), n;
|
|
326
326
|
} else return t;
|
|
@@ -340,8 +340,8 @@ function pe(n, t = "YYYY-MM-DD hh:mm:ss", e = !0) {
|
|
|
340
340
|
ms: (i) => i.getMilliseconds()
|
|
341
341
|
};
|
|
342
342
|
return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (i) => {
|
|
343
|
-
const
|
|
344
|
-
return e ? String(
|
|
343
|
+
const s = r[i](o);
|
|
344
|
+
return e ? String(s).padStart(2, "0") : String(s);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
347
|
function ge(n) {
|
|
@@ -351,7 +351,7 @@ function ge(n) {
|
|
|
351
351
|
});
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function H(n, t = "file") {
|
|
355
355
|
if (!n || (n = String(n).trim(), n === "")) return t;
|
|
356
356
|
const e = n.split("/");
|
|
357
357
|
return e[e.length - 1].split("?")[0];
|
|
@@ -359,9 +359,9 @@ function B(n, t = "file") {
|
|
|
359
359
|
function we(n, t) {
|
|
360
360
|
return new Promise((e, o) => {
|
|
361
361
|
try {
|
|
362
|
-
t = t ||
|
|
363
|
-
const i = URL.createObjectURL(r),
|
|
364
|
-
|
|
362
|
+
t = t || H(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
|
|
363
|
+
const i = URL.createObjectURL(r), s = document.createElement("a");
|
|
364
|
+
s.href = i, s.download = decodeURIComponent(t), document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(i), e(r);
|
|
365
365
|
}).catch(o);
|
|
366
366
|
} catch (r) {
|
|
367
367
|
o(r);
|
|
@@ -374,8 +374,8 @@ function xe(n, t = 10) {
|
|
|
374
374
|
if (o > 0)
|
|
375
375
|
o--, requestAnimationFrame(r);
|
|
376
376
|
else {
|
|
377
|
-
const
|
|
378
|
-
n(Number(a.toFixed(2)), Number(
|
|
377
|
+
const s = (+/* @__PURE__ */ new Date() - e) / t, a = 1e3 / s;
|
|
378
|
+
n(Number(a.toFixed(2)), Number(s.toFixed(2)));
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
requestAnimationFrame(() => {
|
|
@@ -387,8 +387,8 @@ function ve(n, t) {
|
|
|
387
387
|
}
|
|
388
388
|
function be(n, t, e) {
|
|
389
389
|
if (!e) {
|
|
390
|
-
let
|
|
391
|
-
|
|
390
|
+
let s = t.replace(/^[^.]+./, "");
|
|
391
|
+
s = s == t ? "text/plain" : "application/" + s, e = { type: s };
|
|
392
392
|
}
|
|
393
393
|
const o = new Blob(n, e), r = URL.createObjectURL(o), i = document.createElement("a");
|
|
394
394
|
i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
|
|
@@ -421,7 +421,7 @@ function Ee(n, t) {
|
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function V(n) {
|
|
425
425
|
return Array.isArray(n) ? "array" : n === null ? "null" : typeof n;
|
|
426
426
|
}
|
|
427
427
|
function Ce(n) {
|
|
@@ -432,38 +432,38 @@ function Ce(n) {
|
|
|
432
432
|
function r() {
|
|
433
433
|
const a = document.createElement("div");
|
|
434
434
|
a.innerText = n, document.body.appendChild(a);
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
const
|
|
435
|
+
const u = document.createRange();
|
|
436
|
+
u.selectNodeContents(a);
|
|
437
|
+
const l = window.getSelection();
|
|
438
438
|
let f = !1;
|
|
439
|
-
return
|
|
439
|
+
return l && (l.removeAllRanges(), l.addRange(u), f = document.execCommand("copy")), document.body.removeChild(a), f ? Promise.resolve() : Promise.reject();
|
|
440
440
|
}
|
|
441
441
|
function i() {
|
|
442
442
|
const a = document.createElement("textarea");
|
|
443
443
|
a.value = n, document.body.appendChild(a), a.select(), a.setSelectionRange(0, n.length);
|
|
444
|
-
let
|
|
445
|
-
return document.activeElement === a && (
|
|
444
|
+
let u = !1;
|
|
445
|
+
return document.activeElement === a && (u = document.execCommand("Copy", !0)), document.body.removeChild(a), u ? Promise.resolve() : Promise.reject();
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function s() {
|
|
448
448
|
return r().then(t).catch(() => {
|
|
449
449
|
i().then(t).catch(() => e("复制方式尽皆失效"));
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
return navigator.clipboard ? o().catch(
|
|
452
|
+
return navigator.clipboard ? o().catch(s) : s();
|
|
453
453
|
}
|
|
454
454
|
function Fe(n, t) {
|
|
455
455
|
const e = t.split(".");
|
|
456
456
|
return e.reduce((o, r, i) => (r in o || (i === e.length - 1 ? o[r] = void 0 : o[r] = {}), o[r]), n);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Me(n, t) {
|
|
459
459
|
const e = t.split(".");
|
|
460
460
|
return e.reduce((o, r, i) => o.hasOwnProperty(r) ? o[r] : o[r] = i == e.length - 1 ? void 0 : {}, n);
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function Te(n, t, e) {
|
|
463
463
|
const o = t.split(".");
|
|
464
|
-
return o.reduce((r, i,
|
|
464
|
+
return o.reduce((r, i, s) => (s === o.length - 1 && (r[i] = e), r[i]), n);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function Le(n) {
|
|
467
467
|
return new Promise((t, e) => {
|
|
468
468
|
if (typeof n != "string" || n.trim() === "" || !n.includes("://")) {
|
|
469
469
|
e(new Error("Invalid URL: Must be a non-empty string"));
|
|
@@ -490,7 +490,7 @@ function Me(n) {
|
|
|
490
490
|
}
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function je(n) {
|
|
494
494
|
return [
|
|
495
495
|
"https:",
|
|
496
496
|
// HTTPS协议,用于安全地浏览网页
|
|
@@ -522,11 +522,11 @@ const F = class F {
|
|
|
522
522
|
static check(t, e) {
|
|
523
523
|
if (!t || typeof t != "string")
|
|
524
524
|
return console.error("Invalid URL provided"), e ? !1 : "unknown";
|
|
525
|
-
const o =
|
|
525
|
+
const o = H(t).toLowerCase();
|
|
526
526
|
if (e) {
|
|
527
|
-
if (
|
|
527
|
+
if (!Y.hasOwnProperty(e))
|
|
528
528
|
return console.error(`Unknown file type: ${e}`), "unknown";
|
|
529
|
-
const r =
|
|
529
|
+
const r = Y[e];
|
|
530
530
|
return F._checkExtension(o, r);
|
|
531
531
|
}
|
|
532
532
|
return F._detectFileType(o);
|
|
@@ -541,7 +541,7 @@ const F = class F {
|
|
|
541
541
|
*/
|
|
542
542
|
static parseAddresses(t) {
|
|
543
543
|
return !t || typeof t != "string" ? (console.error("Invalid URL provided"), []) : t.split(",").map((e) => {
|
|
544
|
-
const o =
|
|
544
|
+
const o = H(e), r = this.check(e);
|
|
545
545
|
return { url: e, name: o, type: r };
|
|
546
546
|
});
|
|
547
547
|
}
|
|
@@ -554,10 +554,10 @@ const F = class F {
|
|
|
554
554
|
static matchesMimeType(t, e) {
|
|
555
555
|
if (!e) return !0;
|
|
556
556
|
if (typeof t != "string" || typeof e != "string") return !1;
|
|
557
|
-
const o = F._normalizeType(t), r = e.split(",").map((a) => F._normalizeType(a.trim())), [i,
|
|
557
|
+
const o = F._normalizeType(t), r = e.split(",").map((a) => F._normalizeType(a.trim())), [i, s = "*"] = o.split("/");
|
|
558
558
|
return r.some((a) => {
|
|
559
|
-
const [
|
|
560
|
-
return (
|
|
559
|
+
const [u, l = "*"] = a.split("/");
|
|
560
|
+
return (u === "*" || i === "*" || u === i) && (l === "*" || s === "*" || l === s);
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
/**
|
|
@@ -593,13 +593,13 @@ const F = class F {
|
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
// 缓存文件扩展名的条目,以提高性能
|
|
596
|
-
y(F, "cachedEntries", Object.entries(
|
|
597
|
-
let
|
|
598
|
-
function
|
|
596
|
+
y(F, "cachedEntries", Object.entries(Y));
|
|
597
|
+
let Z = F;
|
|
598
|
+
function Re(n) {
|
|
599
599
|
return n.map((t, e) => n.slice(e).concat(n.slice(0, e)));
|
|
600
600
|
}
|
|
601
601
|
function ke(n) {
|
|
602
|
-
const t = window.structuredClone, e = (o) => o === null || typeof o != "object" ? o :
|
|
602
|
+
const t = window.structuredClone, e = (o) => o === null || typeof o != "object" ? o : B(Array.isArray(o) ? [] : {}, o);
|
|
603
603
|
try {
|
|
604
604
|
return t ? t(n) : e(n);
|
|
605
605
|
} catch (o) {
|
|
@@ -628,9 +628,9 @@ const N = class N {
|
|
|
628
628
|
if (i && !i.closed)
|
|
629
629
|
return i.focus(), i;
|
|
630
630
|
{
|
|
631
|
-
const
|
|
632
|
-
if (
|
|
633
|
-
return this.keys.set(t,
|
|
631
|
+
const s = window.open(e, o, r);
|
|
632
|
+
if (s)
|
|
633
|
+
return this.keys.set(t, s), s;
|
|
634
634
|
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(t);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
@@ -668,7 +668,7 @@ const N = class N {
|
|
|
668
668
|
};
|
|
669
669
|
// 存储键与对应窗口的Map
|
|
670
670
|
y(N, "keys", /* @__PURE__ */ new Map());
|
|
671
|
-
let
|
|
671
|
+
let J = N;
|
|
672
672
|
function Ue(n, t = "image/png") {
|
|
673
673
|
try {
|
|
674
674
|
let e, o = t;
|
|
@@ -676,18 +676,18 @@ function Ue(n, t = "image/png") {
|
|
|
676
676
|
return URL.createObjectURL(n);
|
|
677
677
|
if (typeof n == "string") {
|
|
678
678
|
let i = n;
|
|
679
|
-
const
|
|
680
|
-
if (
|
|
681
|
-
if (!
|
|
679
|
+
const s = i.match(/^data:([^;]*)(;base64)?,(.*)$/i);
|
|
680
|
+
if (s) {
|
|
681
|
+
if (!s[2])
|
|
682
682
|
throw new Error("无效的数据 URL:缺少 base64 编码声明");
|
|
683
|
-
if (o =
|
|
683
|
+
if (o = s[1] || o, i = s[3], !i)
|
|
684
684
|
throw new Error("数据 URL 包含空有效负载");
|
|
685
685
|
}
|
|
686
686
|
i = i.replace(/[^A-Za-z0-9+/=]/g, "");
|
|
687
687
|
const a = atob(i);
|
|
688
688
|
e = new Uint8Array(a.length);
|
|
689
|
-
for (let
|
|
690
|
-
e[
|
|
689
|
+
for (let u = 0; u < a.length; u++)
|
|
690
|
+
e[u] = a.charCodeAt(u);
|
|
691
691
|
} else if (n instanceof ArrayBuffer)
|
|
692
692
|
e = new Uint8Array(n);
|
|
693
693
|
else if (n instanceof Uint8Array)
|
|
@@ -706,41 +706,65 @@ function Ue(n, t = "image/png") {
|
|
|
706
706
|
), null;
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
function Pe(n) {
|
|
709
|
+
function Pe(n, t) {
|
|
710
|
+
if (typeof n != "function")
|
|
711
|
+
throw new Error("The first argument must be a function.");
|
|
712
|
+
if (!Array.isArray(t))
|
|
713
|
+
throw new Error("The second argument must be an array.");
|
|
714
|
+
let e = [], o = 100, r = 0;
|
|
715
|
+
const i = (s, a) => {
|
|
716
|
+
for (const [u, l] of a)
|
|
717
|
+
if (s >= u)
|
|
718
|
+
return l;
|
|
719
|
+
return "black";
|
|
720
|
+
};
|
|
721
|
+
return function(...s) {
|
|
722
|
+
const a = performance.now(), u = n(...s), l = performance.now() - a;
|
|
723
|
+
e.push(l), e.length > o && e.shift(), r = e.reduce((T, q) => T + q, 0) / e.length || 0;
|
|
724
|
+
const f = i(l, t), p = i(r, t);
|
|
725
|
+
return console.log(
|
|
726
|
+
`%c单次耗时:${l.toFixed(2)}ms
|
|
727
|
+
%c平均耗时(${e.length}次):${r.toFixed(2)}ms`,
|
|
728
|
+
`color: ${f}; padding: 2px 0;`,
|
|
729
|
+
`color: ${p}; padding: 2px 0;`
|
|
730
|
+
), u;
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function De(n) {
|
|
710
734
|
const t = ne(n, 100);
|
|
711
735
|
let e = 0, o = 0;
|
|
712
736
|
return function(r) {
|
|
713
737
|
const i = r.target;
|
|
714
738
|
if (!i || !(i instanceof HTMLElement)) return;
|
|
715
739
|
const {
|
|
716
|
-
scrollTop:
|
|
740
|
+
scrollTop: s,
|
|
717
741
|
scrollHeight: a,
|
|
718
|
-
clientHeight:
|
|
719
|
-
scrollLeft:
|
|
742
|
+
clientHeight: u,
|
|
743
|
+
scrollLeft: l,
|
|
720
744
|
scrollWidth: f,
|
|
721
|
-
clientWidth:
|
|
745
|
+
clientWidth: p
|
|
722
746
|
} = i;
|
|
723
|
-
function
|
|
724
|
-
if (e ==
|
|
725
|
-
const
|
|
726
|
-
if (e =
|
|
727
|
-
a -
|
|
747
|
+
function T() {
|
|
748
|
+
if (e == s) return;
|
|
749
|
+
const $ = e > s;
|
|
750
|
+
if (e = s, $) return;
|
|
751
|
+
a - s - u <= 1 && t("vertical");
|
|
728
752
|
}
|
|
729
|
-
function
|
|
730
|
-
if (o ==
|
|
731
|
-
const
|
|
732
|
-
if (o =
|
|
733
|
-
f -
|
|
753
|
+
function q() {
|
|
754
|
+
if (o == l) return;
|
|
755
|
+
const $ = o > l;
|
|
756
|
+
if (o = l, $) return;
|
|
757
|
+
f - l - p <= 1 && t("horizontal");
|
|
734
758
|
}
|
|
735
|
-
|
|
759
|
+
T(), q();
|
|
736
760
|
};
|
|
737
761
|
}
|
|
738
|
-
function
|
|
739
|
-
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = e || {}, i = function(
|
|
740
|
-
const
|
|
741
|
-
for (const f in
|
|
742
|
-
Object.hasOwnProperty.call(
|
|
743
|
-
return
|
|
762
|
+
function _e(n, t, e) {
|
|
763
|
+
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = e || {}, i = function(u) {
|
|
764
|
+
const l = [];
|
|
765
|
+
for (const f in u)
|
|
766
|
+
Object.hasOwnProperty.call(u, f) && r.includes(f) && l.push(...u[f]);
|
|
767
|
+
return l;
|
|
744
768
|
}({
|
|
745
769
|
naiveUI: [
|
|
746
770
|
".v-binder-follower-container",
|
|
@@ -750,38 +774,38 @@ function ze(n, t, e) {
|
|
|
750
774
|
ElementPlus: [".el-popper"],
|
|
751
775
|
Element: [".el-popper"]
|
|
752
776
|
});
|
|
753
|
-
function
|
|
777
|
+
function s() {
|
|
754
778
|
t(), document.removeEventListener("mousedown", a);
|
|
755
779
|
}
|
|
756
|
-
function a(
|
|
780
|
+
function a(u) {
|
|
757
781
|
if (o) {
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
if (
|
|
782
|
+
const p = o(u);
|
|
783
|
+
if (p) return;
|
|
784
|
+
if (p === !1) return s();
|
|
761
785
|
}
|
|
762
|
-
const
|
|
763
|
-
if (!(
|
|
764
|
-
n.concat(i).some((
|
|
786
|
+
const l = u.target;
|
|
787
|
+
if (!(l instanceof HTMLElement) || !(l != null && l.closest("body"))) return;
|
|
788
|
+
n.concat(i).some((p) => !!(l != null && l.closest(p))) || s();
|
|
765
789
|
}
|
|
766
790
|
requestAnimationFrame(
|
|
767
791
|
() => document.addEventListener("mousedown", a)
|
|
768
792
|
);
|
|
769
793
|
}
|
|
770
|
-
var w,
|
|
771
|
-
class
|
|
794
|
+
var w, L, j, P, D, E, C, M, _;
|
|
795
|
+
class ze {
|
|
772
796
|
constructor() {
|
|
773
797
|
d(this, w);
|
|
774
|
-
d(this,
|
|
775
|
-
d(this,
|
|
776
|
-
d(this, U, 0);
|
|
798
|
+
d(this, L, !1);
|
|
799
|
+
d(this, j, {});
|
|
777
800
|
d(this, P, 0);
|
|
801
|
+
d(this, D, 0);
|
|
778
802
|
d(this, E, 0);
|
|
779
803
|
d(this, C, 0);
|
|
780
|
-
d(this,
|
|
781
|
-
d(this,
|
|
804
|
+
d(this, M);
|
|
805
|
+
d(this, _);
|
|
782
806
|
}
|
|
783
807
|
init(t, e) {
|
|
784
|
-
|
|
808
|
+
m(this, w, t), m(this, M, e == null ? void 0 : e.limit), m(this, _, e == null ? void 0 : e.dragDom), m(this, j, {
|
|
785
809
|
mousedown: this.mousedown.bind(this),
|
|
786
810
|
mousemove: this.mousemove.bind(this),
|
|
787
811
|
mouseup: this.mouseup.bind(this)
|
|
@@ -792,45 +816,45 @@ class De {
|
|
|
792
816
|
}
|
|
793
817
|
bindOrUnbindEvent(t) {
|
|
794
818
|
const e = t === "bind" ? "addEventListener" : "removeEventListener";
|
|
795
|
-
if (!
|
|
796
|
-
|
|
819
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
820
|
+
c(this, w)[e]("mousedown", c(this, j).mousedown), document[e]("mousemove", c(this, j).mousemove), document[e]("mouseup", c(this, j).mouseup);
|
|
797
821
|
}
|
|
798
822
|
alterLocation() {
|
|
799
|
-
if (!
|
|
800
|
-
|
|
823
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
824
|
+
c(this, M) && (m(this, E, Math.min(c(this, E), c(this, M).max.top)), m(this, E, Math.max(c(this, E), 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, E) + "px"), c(this, w).style.setProperty("--left", c(this, C) + "px");
|
|
801
825
|
}
|
|
802
826
|
mousedown(t) {
|
|
803
|
-
if (!
|
|
804
|
-
if (
|
|
805
|
-
document.body.classList.add("no-select"),
|
|
806
|
-
const e =
|
|
807
|
-
|
|
827
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
828
|
+
if (c(this, _) && t.target != c(this, _)) return;
|
|
829
|
+
document.body.classList.add("no-select"), m(this, L, !0);
|
|
830
|
+
const e = c(this, w).getBoundingClientRect(), { pageX: o, pageY: r } = t;
|
|
831
|
+
m(this, P, o), m(this, D, r), m(this, E, e.y), m(this, C, e.x);
|
|
808
832
|
}
|
|
809
833
|
mousemove(t) {
|
|
810
834
|
const { pageX: e, pageY: o } = t;
|
|
811
|
-
|
|
835
|
+
c(this, L) && (m(this, E, c(this, E) + (o - c(this, D))), m(this, C, c(this, C) + (e - c(this, P))), m(this, P, e), m(this, D, o), this.alterLocation());
|
|
812
836
|
}
|
|
813
837
|
mouseup() {
|
|
814
|
-
|
|
838
|
+
c(this, L) && (m(this, L, !1), document.body.classList.remove("no-select"));
|
|
815
839
|
}
|
|
816
840
|
}
|
|
817
|
-
w = new WeakMap(),
|
|
818
|
-
var x, R,
|
|
841
|
+
w = new WeakMap(), L = new WeakMap(), j = new WeakMap(), P = new WeakMap(), D = new WeakMap(), E = new WeakMap(), C = new WeakMap(), M = new WeakMap(), _ = new WeakMap();
|
|
842
|
+
var x, R, k, z, I, v, b, g, O, A;
|
|
819
843
|
class Ie {
|
|
820
844
|
constructor() {
|
|
821
845
|
d(this, x);
|
|
822
846
|
d(this, R, !1);
|
|
823
|
-
d(this,
|
|
824
|
-
d(this,
|
|
847
|
+
d(this, k, {});
|
|
848
|
+
d(this, z, 0);
|
|
825
849
|
d(this, I, 0);
|
|
826
850
|
d(this, v, 0);
|
|
827
851
|
d(this, b, 0);
|
|
828
|
-
d(this,
|
|
852
|
+
d(this, g);
|
|
829
853
|
d(this, O);
|
|
830
|
-
d(this,
|
|
854
|
+
d(this, A);
|
|
831
855
|
}
|
|
832
856
|
init(t, e = {}) {
|
|
833
|
-
|
|
857
|
+
m(this, x, t), m(this, g, e.limit), m(this, O, e.update_move), m(this, A, e.update_up), m(this, k, {
|
|
834
858
|
mousedown: this.mousedown.bind(this),
|
|
835
859
|
mousemove: this.mousemove.bind(this),
|
|
836
860
|
mouseup: this.mouseup.bind(this)
|
|
@@ -841,17 +865,17 @@ class Ie {
|
|
|
841
865
|
}
|
|
842
866
|
bindOrUnbindEvent(t) {
|
|
843
867
|
const e = t === "bind" ? "addEventListener" : "removeEventListener";
|
|
844
|
-
if (!
|
|
845
|
-
|
|
868
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
869
|
+
c(this, x)[e]("mousedown", c(this, k).mousedown), document[e]("mousemove", c(this, k).mousemove), document[e]("mouseup", c(this, k).mouseup);
|
|
846
870
|
}
|
|
847
871
|
updateValue() {
|
|
848
872
|
const t = {
|
|
849
|
-
top:
|
|
850
|
-
left:
|
|
873
|
+
top: c(this, v),
|
|
874
|
+
left: c(this, b),
|
|
851
875
|
percentage: { top: 0, left: 0 }
|
|
852
876
|
};
|
|
853
|
-
if (
|
|
854
|
-
const e = (o) =>
|
|
877
|
+
if (c(this, g)) {
|
|
878
|
+
const e = (o) => c(this, g) ? (t[o] - c(this, g).min[o]) / (c(this, g).max[o] - c(this, g).min[o]) : 0;
|
|
855
879
|
t.percentage = {
|
|
856
880
|
top: e("top") || 0,
|
|
857
881
|
left: e("left") || 0
|
|
@@ -860,26 +884,26 @@ class Ie {
|
|
|
860
884
|
return t;
|
|
861
885
|
}
|
|
862
886
|
alterLocation() {
|
|
863
|
-
if (!
|
|
864
|
-
|
|
887
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
888
|
+
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");
|
|
865
889
|
}
|
|
866
890
|
mousedown(t) {
|
|
867
|
-
if (!
|
|
868
|
-
document.body.classList.add("no-select"),
|
|
869
|
-
const e =
|
|
870
|
-
|
|
891
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
892
|
+
document.body.classList.add("no-select"), m(this, R, !0);
|
|
893
|
+
const e = c(this, x).getBoundingClientRect();
|
|
894
|
+
m(this, I, e.y), m(this, z, e.x);
|
|
871
895
|
const { pageX: o, pageY: r } = t;
|
|
872
|
-
|
|
896
|
+
m(this, v, r - c(this, I)), m(this, b, o - c(this, z)), this.alterLocation();
|
|
873
897
|
}
|
|
874
898
|
mousemove(t) {
|
|
875
899
|
const { pageX: e, pageY: o } = t;
|
|
876
|
-
|
|
900
|
+
c(this, R) && (m(this, v, o - c(this, I)), m(this, b, e - c(this, z)), this.alterLocation());
|
|
877
901
|
}
|
|
878
902
|
mouseup() {
|
|
879
|
-
|
|
903
|
+
c(this, R) && (m(this, R, !1), document.body.classList.remove("no-select"), c(this, A) && c(this, A).call(this, this.updateValue()));
|
|
880
904
|
}
|
|
881
905
|
}
|
|
882
|
-
x = new WeakMap(), R = new WeakMap(),
|
|
906
|
+
x = new WeakMap(), R = new WeakMap(), k = new WeakMap(), z = new WeakMap(), I = new WeakMap(), v = new WeakMap(), b = new WeakMap(), g = new WeakMap(), O = new WeakMap(), A = new WeakMap();
|
|
883
907
|
function oe(n) {
|
|
884
908
|
const t = n;
|
|
885
909
|
if (n) {
|
|
@@ -907,7 +931,7 @@ function Oe(n) {
|
|
|
907
931
|
ie() ? re() : oe(n);
|
|
908
932
|
};
|
|
909
933
|
}
|
|
910
|
-
function
|
|
934
|
+
function Ae(n, t) {
|
|
911
935
|
if (typeof n == "number") return n;
|
|
912
936
|
if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
|
|
913
937
|
const e = document.createElement("div");
|
|
@@ -921,8 +945,8 @@ function Se(n, t) {
|
|
|
921
945
|
if (typeof t == "string") {
|
|
922
946
|
const i = document.querySelector(t);
|
|
923
947
|
if (!i) return;
|
|
924
|
-
const
|
|
925
|
-
e =
|
|
948
|
+
const s = i.getBoundingClientRect();
|
|
949
|
+
e = s.width, o = s.height;
|
|
926
950
|
} else if (Array.isArray(t))
|
|
927
951
|
e = t[0], o = t[1];
|
|
928
952
|
else {
|
|
@@ -932,7 +956,7 @@ function Se(n, t) {
|
|
|
932
956
|
const r = e / o;
|
|
933
957
|
return r > n ? [n * o, o] : r < n ? [e, e / n] : [e, o];
|
|
934
958
|
}
|
|
935
|
-
function
|
|
959
|
+
function Ne(n, t = 5e3) {
|
|
936
960
|
return new Promise((e, o) => {
|
|
937
961
|
const r = new Image();
|
|
938
962
|
r.src = n;
|
|
@@ -941,32 +965,33 @@ function Ae(n, t = 5e3) {
|
|
|
941
965
|
}, t);
|
|
942
966
|
r.onload = () => {
|
|
943
967
|
clearTimeout(i);
|
|
944
|
-
const
|
|
945
|
-
e([r,
|
|
968
|
+
const s = r.naturalWidth, a = r.naturalHeight, u = s / a;
|
|
969
|
+
e([r, u]);
|
|
946
970
|
}, r.onerror = () => {
|
|
947
971
|
clearTimeout(i), o(new Error("图片加载失败"));
|
|
948
972
|
}, r.crossOrigin = "Anonymous";
|
|
949
973
|
});
|
|
950
974
|
}
|
|
951
|
-
function
|
|
975
|
+
function qe(n, t, e = 2) {
|
|
952
976
|
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) + "%";
|
|
953
977
|
}
|
|
954
|
-
function
|
|
978
|
+
function $e(n, t, e) {
|
|
955
979
|
return Math.abs(n - t) <= e;
|
|
956
980
|
}
|
|
957
|
-
function
|
|
958
|
-
let e;
|
|
959
|
-
function
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
981
|
+
function Ye(n, t = 500) {
|
|
982
|
+
let e, o = !0;
|
|
983
|
+
function r(i) {
|
|
984
|
+
if (!o) return;
|
|
985
|
+
e || (e = i);
|
|
986
|
+
let s = Math.min((i - e) / t, 1);
|
|
987
|
+
n(s), i - e < t && requestAnimationFrame(r);
|
|
963
988
|
}
|
|
964
|
-
requestAnimationFrame(o
|
|
989
|
+
return requestAnimationFrame(r), () => o = !1;
|
|
965
990
|
}
|
|
966
|
-
function
|
|
991
|
+
function Be(n) {
|
|
967
992
|
return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
968
993
|
}
|
|
969
|
-
function
|
|
994
|
+
function He(n, t) {
|
|
970
995
|
const e = {
|
|
971
996
|
join: !0,
|
|
972
997
|
suffix: "",
|
|
@@ -974,28 +999,35 @@ function Be(n, t) {
|
|
|
974
999
|
}, { join: o, suffix: r, decimalPlaces: i } = {
|
|
975
1000
|
...e,
|
|
976
1001
|
...t || {}
|
|
977
|
-
},
|
|
978
|
-
if (isNaN(
|
|
979
|
-
const a = Math.abs(
|
|
980
|
-
return o ? `${
|
|
1002
|
+
}, s = Number(n);
|
|
1003
|
+
if (isNaN(s)) return o ? `0${r}` : [0, r];
|
|
1004
|
+
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)));
|
|
1005
|
+
return o ? `${T}${G[l]}${r}` : [T, G[l] + r];
|
|
981
1006
|
}
|
|
982
|
-
function
|
|
1007
|
+
function Xe(n, t) {
|
|
983
1008
|
let e = !1;
|
|
984
1009
|
const { x: o, y: r } = n, i = t.length;
|
|
985
|
-
for (let
|
|
986
|
-
const
|
|
987
|
-
|
|
1010
|
+
for (let s = 0, a = i - 1; s < i; a = s++) {
|
|
1011
|
+
const u = t[s].x, l = t[s].y, f = t[a].x, p = t[a].y;
|
|
1012
|
+
l > r != p > r && o < (f - u) * (r - l) / (p - l) + u && (e = !e);
|
|
988
1013
|
}
|
|
989
1014
|
return e;
|
|
990
1015
|
}
|
|
991
|
-
function
|
|
1016
|
+
function We(n) {
|
|
992
1017
|
const t = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
993
1018
|
let e = 0;
|
|
994
1019
|
for (; n > 1024; )
|
|
995
1020
|
n /= 1024, e++;
|
|
996
1021
|
return `${Math.round(n * 100) / 100} ${t[e]}`;
|
|
997
1022
|
}
|
|
998
|
-
|
|
1023
|
+
function Ge(n, t, e, o) {
|
|
1024
|
+
return Math.sqrt(Math.pow(e - n, 2) + Math.pow(o - t, 2));
|
|
1025
|
+
}
|
|
1026
|
+
function Ve(n, t, e, o) {
|
|
1027
|
+
const r = (n + e) / 2, i = (t + o) / 2;
|
|
1028
|
+
return { x: r, y: i };
|
|
1029
|
+
}
|
|
1030
|
+
class U {
|
|
999
1031
|
constructor(t, e) {
|
|
1000
1032
|
y(this, "resolve");
|
|
1001
1033
|
y(this, "reject");
|
|
@@ -1012,7 +1044,7 @@ class k {
|
|
|
1012
1044
|
}) : t ? (e = this.resolve) == null || e.call(this) : (o = this.reject) == null || o.call(this), t;
|
|
1013
1045
|
}
|
|
1014
1046
|
}
|
|
1015
|
-
class se extends
|
|
1047
|
+
class se extends U {
|
|
1016
1048
|
constructor(t) {
|
|
1017
1049
|
super(), this.resolve = t;
|
|
1018
1050
|
}
|
|
@@ -1021,17 +1053,17 @@ class se extends k {
|
|
|
1021
1053
|
var o, r;
|
|
1022
1054
|
return (r = (o = S.tips).warning) == null ? void 0 : r.call(o, ...t);
|
|
1023
1055
|
};
|
|
1024
|
-
return new
|
|
1056
|
+
return new U(this.resolve, e);
|
|
1025
1057
|
}
|
|
1026
1058
|
error(...t) {
|
|
1027
1059
|
const e = () => {
|
|
1028
1060
|
var o, r;
|
|
1029
1061
|
return (r = (o = S.tips).error) == null ? void 0 : r.call(o, ...t);
|
|
1030
1062
|
};
|
|
1031
|
-
return new
|
|
1063
|
+
return new U(this.resolve, e);
|
|
1032
1064
|
}
|
|
1033
1065
|
}
|
|
1034
|
-
class ce extends
|
|
1066
|
+
class ce extends U {
|
|
1035
1067
|
constructor(t) {
|
|
1036
1068
|
super(), this.reject = t;
|
|
1037
1069
|
}
|
|
@@ -1040,14 +1072,14 @@ class ce extends k {
|
|
|
1040
1072
|
var o, r;
|
|
1041
1073
|
return (r = (o = S.tips).info) == null ? void 0 : r.call(o, ...t);
|
|
1042
1074
|
};
|
|
1043
|
-
return new
|
|
1075
|
+
return new U(e, this.reject);
|
|
1044
1076
|
}
|
|
1045
1077
|
success(...t) {
|
|
1046
1078
|
const e = () => {
|
|
1047
1079
|
var o, r;
|
|
1048
1080
|
return (r = (o = S.tips).success) == null ? void 0 : r.call(o, ...t);
|
|
1049
1081
|
};
|
|
1050
|
-
return new
|
|
1082
|
+
return new U(e, this.reject);
|
|
1051
1083
|
}
|
|
1052
1084
|
}
|
|
1053
1085
|
const h = class h {
|
|
@@ -1092,51 +1124,54 @@ y(h, "tips", {
|
|
|
1092
1124
|
let S = h;
|
|
1093
1125
|
export {
|
|
1094
1126
|
Se as _CalculateCanvasSize,
|
|
1127
|
+
Ge as _CalculateDistance2D,
|
|
1095
1128
|
he as _CapitalizeFirstLetter,
|
|
1096
|
-
|
|
1129
|
+
Le as _CheckConnectionWithXHR,
|
|
1097
1130
|
ke as _Clone,
|
|
1098
|
-
|
|
1131
|
+
_e as _CloseOnOutsideClick,
|
|
1099
1132
|
ve as _ConvertToCamelCase,
|
|
1100
|
-
|
|
1133
|
+
qe as _ConvertToPercentage,
|
|
1101
1134
|
Ce as _CopyToClipboard,
|
|
1102
1135
|
be as _CreateAndDownloadFile,
|
|
1103
1136
|
Ue as _Danger_ConvertDataToImageUrl,
|
|
1104
|
-
|
|
1137
|
+
V as _DataType,
|
|
1105
1138
|
ne as _Debounce,
|
|
1106
1139
|
we as _DownloadFile,
|
|
1107
|
-
|
|
1140
|
+
ze as _Drag,
|
|
1108
1141
|
oe as _EnterFullscreen,
|
|
1109
1142
|
fe as _ExcludeSubstring,
|
|
1110
1143
|
me as _ExecuteWhenIdle,
|
|
1111
1144
|
re as _ExitFullscreen,
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1145
|
+
Z as _FileTypeChecker,
|
|
1146
|
+
We as _FormatFileSize,
|
|
1147
|
+
Be as _FormatNumber,
|
|
1148
|
+
He as _FormatNumberWithUnit,
|
|
1116
1149
|
Oe as _Fullscreen,
|
|
1117
1150
|
ye as _GenerateUUID,
|
|
1118
1151
|
xe as _GetFrameRate,
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1152
|
+
H as _GetHrefName,
|
|
1153
|
+
Ve as _GetMidpoint,
|
|
1154
|
+
Ae as _GetOtherSizeInPixels,
|
|
1155
|
+
Me as _GetTargetByPath,
|
|
1122
1156
|
Fe as _InitTargetByPath,
|
|
1123
1157
|
ie as _IsFullscreen,
|
|
1124
1158
|
ue as _IsObject,
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1159
|
+
Xe as _IsPointInPolygon,
|
|
1160
|
+
je as _IsSecureContext,
|
|
1161
|
+
$e as _IsWithinErrorMargin,
|
|
1162
|
+
J as _KeyedWindowManager,
|
|
1163
|
+
Ne as _LoadImage,
|
|
1130
1164
|
Ie as _LocalDrag,
|
|
1131
|
-
|
|
1165
|
+
B as _MergeObjects,
|
|
1132
1166
|
le as _NotNull,
|
|
1133
1167
|
ge as _ReadFile,
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1168
|
+
Re as _RotateList,
|
|
1169
|
+
Ye as _Schedule,
|
|
1170
|
+
De as _ScrollEndListener,
|
|
1137
1171
|
Ee as _Throttle,
|
|
1172
|
+
Pe as _TimeConsumption,
|
|
1138
1173
|
pe as _TimeTransition,
|
|
1139
1174
|
S as _Tip,
|
|
1140
|
-
|
|
1175
|
+
Te as _UpdateTargetByPath,
|
|
1141
1176
|
de as _WaitForCondition
|
|
1142
1177
|
};
|