UNPKG

toolset.io

Version:

前端开发常用工具集。

3 lines (2 loc) 42.2 kB
const t="undefined"!=typeof window,e=t&&window?.navigator?.userAgent&&/iP(ad|hone|od)/.test(window.navigator.userAgent),n=Object.prototype.toString,r=Object.prototype.hasOwnProperty;function o(t,e){return n.call(t)===`[object ${e}]`}function a(t,e){return r.call(t,e)}function s(t){return null!=t}function i(t){return null==t}function c(t){return"number"==typeof t}function u(t){return Number.isNaN(t)}function f(t){return"string"==typeof t}function l(t){return"boolean"==typeof t}function d(t){return!0===t}function h(t){return!1===t}function g(t){return"symbol"==typeof t}function p(t){return"bigint"==typeof t}function m(t){return Array.isArray(t)}function b(t){return o(t,"Object")}function y(t){return!!t&&"function"==typeof t.then&&"function"==typeof t.catch}function w(t){return"function"==typeof t}function v(t){return o(t,"Set")}function M(t){return o(t,"Map")}function S(t){return o(t,"Date")}function k(t){return o(t,"RegExp")}function A(t){return Array.isArray(t)||"string"==typeof t?0===t.length:t instanceof Map||t instanceof Set?0===t.size:b(t)?0===Object.keys(t).length:"number"==typeof t?u(t):i(t)}function $(t){return b(t)&&0===Object.keys(t).length}function x(e,n=!1){return!(!n&&!t)&&!(!e||!("nodeType"in e))}function F(t){return s(t)&&"function"==typeof t[Symbol.iterator]}function E(){}function O(){return!0}function D(){return!1}function C(t,e=1,n=1){const r=[];for(let o=0;o<t;++o)r.push(e+o*n);return r}function N(t){return Object.prototype.toString.call(t).slice(8,-1)}function T(t=16){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";let n="";for(;t--;)n+=e.charAt(Math.floor(62*Math.random()));return n}async function I(t,e={}){if(t.length)for(const[n,r]of t)if("function"==typeof n?n():n)return"function"==typeof e.beforeMatchAny&&await e.beforeMatchAny(),await r(),"function"==typeof e.afterMatchAny&&await e.afterMatchAny(),!0;return!1}function j(t){return void 0===t}function Y(t){if("function"!=typeof t)return!1;const e=t.toString();return void 0!==t.prototype&&(t.prototype.constructor===t&&("class "===e.slice(0,6)||(Object.getOwnPropertyNames(t.prototype).length>=2||(/^function\s+\(|^function\s+anonymous\(/.test(e),!1))))}function R(t){return t||0===t}function P(t){return t===window}function B(t){return!!f(t)&&/^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(t)}function L(t){return!!f(t)&&/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(t)}class z{static set(t,e,n){const r=H(e);let o=U(t);return o||(o=Object.create(null)),!!b(o)&&(r.length>0&&(o=q(r,o,n),W(t,o)))}static get(t,e){const n=H(e),r=U(t);return n.length>0?n.reduce(((t,e)=>{if(t&&"object"==typeof t)return t[e]}),r):f(t)?r:void 0}static delete(t,e){const n=H(e),r=U(t),o=Z(n,r);z.set(t,e,o)}static clear(t){return W(t,{})}}const H=t=>{if("string"!=typeof t)return[];const e=t.match(/^\{(.+)\}$/);return e?e[1].split("."):[]},U=t=>{if("string"==typeof t)return(t=>{if("string"==typeof t)try{return JSON.parse(t)}catch(t){return}})(localStorage.getItem(t))},W=(t,e)=>{if("string"!=typeof t)return!1;if(b(e))try{return localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){return!1}return localStorage.setItem(t,String(e)),!0},q=(t,e,n)=>{if(0===t.length)return e;const[r,...o]=t,a={...e};return 0===o.length?a[r]=n:a[r]=q(o,a[r]||{},n),a},Z=(t,e)=>{if(0===t.length)return e;const[n,...r]=t,o={...e};return 0===r.length?delete o[n]:void 0!==o[n]&&(o[n]=Z(r,o[n])),o};async function K(e){if(!t)return!1;if(!e)return!1;try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.error("Modern clipboard API failed:",t),function(t){try{const e=document.createElement("textarea"),n=document.activeElement,r=document.getSelection(),o=r?.rangeCount?r.getRangeAt(0):null;e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="12pt",document.body.appendChild(e),e.select(),e.setSelectionRange(0,e.value.length);let a=!1;try{a=document.execCommand("copy")}catch(t){console.error("Fallback copy failed:",t)}return document.body.removeChild(e),o&&r&&(r.removeAllRanges(),r.addRange(o)),n?.focus(),a}catch(t){return console.error("Unexpected error in fallback copy:",t),!1}}(e)}}async function V(){if(!t)return null;try{return await navigator.clipboard.readText()}catch(t){return console.error("Modern clipboard API failed:",t),function(){try{const t=document.createElement("textarea"),e=document.activeElement;t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",t.style.fontSize="12pt",document.body.appendChild(t),t.focus();let n=!1;try{n=document.execCommand("paste")}catch(t){console.error("Fallback paste failed:",t)}const r=n?t.value:null;return document.body.removeChild(t),e?.focus(),r}catch(t){return console.error("Unexpected error in fallback paste:",t),null}}()}}const G="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",_=`[\\s|\\(]+(${G})[,|\\s]+(${G})[,|\\s]+(${G})[,|\\s]+(${G})\\s*\\)?`,J=new RegExp(`rgb${`[\\s|\\(]+(${G})[,|\\s]+(${G})[,|\\s]+(${G})\\s*\\)?`}`),Q=new RegExp(`rgba${_}`),X=new RegExp(`hsl${_}`),tt=new RegExp(`hsla${_}`),et=new RegExp(`hsv${_}`),nt=new RegExp(`hsva${_}`),rt=/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ot=/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,at=/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,st=/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,it=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"}),ct=Object.freeze(new Set(Object.keys(it)));function ut(t){return/^#[a-fA-F0-9]{3}$|#[a-fA-F0-9]{6}$/.test(t)}function ft(t){return/^rgb\((\s*\d+\s*,?){3}\)$/.test(t)}function lt(t){return/^rgba\((\s*\d+\s*,\s*){3}\s*\d(\.\d+)?\s*\)$/.test(t)}function dt(t){return!!(t=String(t).trim().toLowerCase())&&(!("transparent"!==t&&!it[t])||("transparent"===t||ct.has(t)||J.test(t)||Q.test(t)||X.test(t)||tt.test(t)||et.test(t)||nt.test(t)||rt.test(t)||ot.test(t)||at.test(t)||st.test(t)))}function ht(t){if("transparent"===(t=t.toString().trim().toLowerCase()))return{r:0,g:0,b:0,a:0,format:"name",toString:Ht};let e,n=!1;if(it[t]&&(t=it[t],n=!0),e=J.exec(t)){const{r:t,g:n,b:r}=bt(e[1],e[2],e[3]);return{r:255*t,g:255*n,b:255*r,format:"rgb",toString:Ht}}if(e=Q.exec(t)){const{r:t,g:n,b:r}=bt(e[1],e[2],e[3]);return{r:255*t,g:255*n,b:255*r,a:wt(e[4]),format:"rgba",toString:Ht}}if(e=X.exec(t)){const{h:t,s:n,l:r}=mt(e[0],e[1],e[3]);return{h:360*t,s:n,l:r,format:"hsl",toString:Ut}}if(e=tt.exec(t)){const{h:t,s:n,l:r}=mt(e[0],e[1],e[3]);return{h:360*t,s:n,l:r,a:wt(e[4]),format:"hsla",toString:Ut}}if(e=et.exec(t)){const{h:t,s:n,v:r}=yt(e[0],e[1],e[3]);return{h:360*t,s:n,v:r,format:"hsv",toString:Wt}}if(e=nt.exec(t)){const{h:t,s:n,v:r}=yt(e[0],e[1],e[3]);return{h:360*t,s:n,v:r,a:wt(e[4]),format:"hsva",toString:Wt}}return(e=rt.exec(t))?{r:parseInt(`${e[1]}${e[1]}`,16),g:parseInt(`${e[2]}${e[2]}`,16),b:parseInt(`${e[3]}${e[3]}`,16),format:n?"name":"hex3",toString:Ht}:(e=ot.exec(t))?{r:parseInt(`${e[1]}${e[1]}`,16),g:parseInt(`${e[2]}${e[2]}`,16),b:parseInt(`${e[3]}${e[3]}`,16),a:Rt(`${e[4]}${e[4]}`),format:n?"name":"hex4",toString:Ht}:(e=at.exec(t))?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),format:n?"name":"hex6",toString:Ht}:(e=st.exec(t))?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),a:Rt(e[4]),format:n?"name":"hex8",toString:Ht}:null}function gt(t){const{a:e,...n}=pt(t);delete n.format;const r=Mt(n.r,n.g,n.b),o=$t(n.r,n.g,n.b),a=xt(n.r,n.g,n.b),s=Ft(n.r,n.g,n.b,e);return{rgb:n,hsl:r,hsv:o,hex:a,alpha:e,rgba:{...n,a:e,format:"rgba"},hsla:{...r,a:e,format:"hsla"},hsva:{...o,a:e,format:"hsva"},hex8:s,gray:qt(n),origin:t}}function pt(t){let e,n={r:0,g:0,b:0},r=1;return e="string"==typeof t?ht(t):t,null!==e&&"object"==typeof e&&("l"in e?n=vt(e.h,e.s,e.l):"v"in e&&(n=At(e.h,e.s,e.v)),"a"in e&&(r=wt(e.a??1),Number.isNaN(r)&&(r=1)),n=e),{...n,a:r,format:"rgba",toString:Ht}}function mt(t,e,n){return{h:Pt(t,0,360)/360,s:Pt(Lt(e)?zt(e):e,0,1),l:Pt(Lt(n)?zt(n):n,0,1)}}function bt(t,e,n){return{r:Pt(t,0,255)/255,g:Pt(e,0,255)/255,b:Pt(n,0,255)/255}}function yt(t,e,n){return{h:Pt(t,0,360)/360,s:Pt(Lt(e)?zt(e):e,0,1),v:Pt(Lt(n)?zt(n):n,0,1)}}function wt(t){return Pt(Lt(t)?zt(t):t,0,1)}function vt(t,e,n){let r,o,a;if(({h:t,s:e,l:n}=mt(t,e,n)),0===e)r=o=a=n;else{const s=n<.5?1*(1+e):n+e-n*e,i=2*n-s;r=Bt(i,s,t+1/3),o=Bt(i,s,t),a=Bt(i,s,t-1/3)}return r*=255,o*=255,a*=255,{r:r,g:o,b:a,toString:Ht}}function Mt(t,e,n){({r:t,g:e,b:n}=bt(t,e,n));const r=Math.max(t,e,n),o=Math.min(t,e,n);let a,s;const i=(r+o)/2;if(r===o)a=s=0;else{const c=r-o;switch(s=i>.5?c/(2-r-o):c/(r+o),r){case t:a=(e-n)/c+(e<n?6:0);break;case e:a=(n-t)/c+2;break;case n:a=(t-e)/c+4;break;default:a=0}a*=60}return{h:a,s:s,l:i,toString:Ut}}function St(t,e,n){({h:t,s:e,l:n}=mt(t,e,n));const r=.5*(2*n+e*(1-Math.abs(2*n-1)));return{h:360*t,s:e=2*(r-n)/r,v:r,toString:Wt}}function kt(t,e,n){({h:t,s:e,v:n}=yt(t,e,n));const r=.5*n*(2-e);return{h:360*t,s:e=n*e/(1-Math.abs(2*r-1)),l:r,toString:Ut}}function At(t,e,n){({h:t,s:e,v:n}=yt(t,e,n)),t*=6;const r=Math.floor(t),o=t-r,a=n*(1-e),s=n*(1-o*e),i=n*(1-(1-o)*e),c=r%6;let u=[n,s,a,a,i,n][c],f=[i,n,n,s,a,a][c],l=[a,a,i,n,n,s][c];return u*=255,f*=255,l*=255,{r:u,g:f,b:l,toString:Ht}}function $t(t,e,n){({r:t,g:e,b:n}=bt(t,e,n));const r=Math.max(t,e,n),o=Math.min(t,e,n);let a;const s=r,i=r-o,c=0===r?0:i/r;if(r===o)a=0;else{switch(r){case t:a=(e-n)/i+(e<n?6:0);break;case e:a=(n-t)/i+2;break;case n:a=(t-e)/i+4;break;default:a=0}a*=60}return{h:a,s:c,v:s,toString:Wt}}function xt(t,e,n,r=!1){({r:t,g:e,b:n}=bt(t,e,n));const o=[jt(Math.round(255*t).toString(16)),jt(Math.round(255*e).toString(16)),jt(Math.round(255*n).toString(16))];return r&&Yt(o[0])&&Yt(o[1])&&Yt(o[2])?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):"#"+o.join("")}function Ft(t,e,n,r,o=!1){({r:t,g:e,b:n}=bt(t,e,n));const a=[jt(Math.round(255*t).toString(16)),jt(Math.round(255*e).toString(16)),jt(Math.round(255*n).toString(16)),jt((s=wt(r),Math.round(255*parseFloat(s)).toString(16)))];var s;return o&&Yt(a[0])&&Yt(a[1])&&Yt(a[2])&&Yt(a[3])?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):"#"+a.join("")}function Et(t,e,n=.5){if(!t&&!e)return{r:0,g:0,b:0,a:1};if(!t)return pt(e);if(!e)return pt(t);const r=pt(t),o=pt(e),a=Pt(n,0,1),s=2*a-1,i=r.a-o.a,c=((s*i==-1?s:(s+i)/(1+s*i))+1)/2,u=1-c;return{r:Math.round(r.r*c+o.r*u),g:Math.round(r.g*c+o.g*u),b:Math.round(r.b*c+o.b*u),a:Math.round(r.a*a+o.a*(1-a)),format:"rgba",toString:Ht}}function Ot(t,e){const n=pt(t);return n.a=wt(e),n}function Dt(t=!1,e="hex"){const n=Math.round(255*Math.random()),r=Math.round(255*Math.random()),o=Math.round(255*Math.random());if("hex"===e)return t?Ft(n,r,o,Math.random()):xt(n,r,o);let a;return a="hsl"===e?Mt(n,r,o):"hsv"===e?$t(n,r,o):Object.create({r:n,g:r,b:o,toString:Ht}),t&&(a.a=Math.random()),a.toString()}function Ct(t,e=!1,n="hex"){const r=Math.round(360*Math.random()),o=Math.round("hard"===t?80+20*Math.random():20+70*Math.random())/100,a=Math.round("hard"===t?40+20*Math.random():80+15*Math.random())/100;if("hsl"===n)return Ut.bind({h:r,s:o,l:a})();let s;if("hex"===n||"rgb"===n){if(s=vt(r,o,a),"hex"===n){const{r:t,g:n,b:r}=s;return e?Ft(t,n,r,Math.random()):xt(t,n,r)}}else"hsv"===n&&(s=St(r,o,a));return e&&(s.a=Math.random()),s.toString()}function Nt(t=!1,e="hex"){return Ct("hard",t,e)}function Tt(t=!1,e="hex"){return Ct("soft",t,e)}function It(t){return qt(pt(t))}function jt(t){return 1===t.length?`0${t}`:t.toString()}function Yt(t){return t.charAt(0)===t.charAt(1)}function Rt(t){return parseInt(t,16)/255}function Pt(t,e,n){return Math.max(e,Math.min(n,parseFloat(t)))}function Bt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Lt(t){return String(t).trim().includes("%")}function zt(t){const e=parseFloat(t)/100;return Number.isNaN(e)?0:e}function Ht(){return s(this.a)&&this.a>=0&&this.a<1?`rgba(${this.r}, ${this.g}, ${this.b}, ${this.a})`:`rgb(${this.r}, ${this.g}, ${this.b})`}function Ut(){const t=100*this.s+"%",e=100*this.l+"%";return s(this.a)&&this.a>=0&&this.a<1?`hsla(${this.h}, ${t}, ${e}, ${this.a})`:`hsl(${this.h}, ${t}, ${e})`}function Wt(){const t=100*this.s+"%",e=100*this.v+"%";return s(this.a)&&this.a>=0&&this.a<1?`hsva(${this.h}, ${t}, ${e}, ${this.a})`:`hsv(${this.h}, ${t}, ${e})`}function qt(t){return(.2126*t.r+.7152*t.g+.0722*t.b)/255}let Zt=0;function Kt(){return Zt++}function Vt(t){Zt=Math.round(t)}function Gt(t=0){return{getCount:()=>t++,setCount:e=>{t=e}}}function _t(t,e){return t.split("").map((t=>{const n=t.charCodeAt(0);return n>=65&&n<=90?String.fromCharCode((n-65+e+26)%26+65):n>=97&&n<=122?String.fromCharCode((n-97+e+26)%26+97):n>=48&&n<=57?String.fromCharCode((n-48+e+10)%10+48):t})).join("")}function Jt(t,e){return t.split("").map(((t,n)=>String.fromCharCode(t.charCodeAt(0)^e.charCodeAt(n%e.length)))).join("")}function Qt(t){return btoa(encodeURIComponent(t))}function Xt(t){return decodeURIComponent(atob(t))}function te(t){return t&-t}function ee(t,e=0){const n=new Array(t+1).fill(0);function r(r=t){if(r<=0)return 0;r>t&&(r=t);let o=r*e;for(;r>0;)o+=n[r],r-=te(r);return o}return{tree:n,add:function(e,r){if(r&&!(e>=t))for(e+=1;e<=t;)n[e]+=r,e+=te(e)},sum:r,get:function(t){return r(t+1)-r(t)},boundIndex:function(e){let n=0,o=t;for(;o>n;){const t=Math.floor((n+o)/2),a=r(t);if(a>e)o=t;else{if(!(a<e))return t;if(n===t)return r(n+1)<=e?n+1:n;n=t}}return n}}}class ne{date;constructor(t){if(void 0===t)this.date=new Date;else if(t instanceof Date)this.date=new Date(t.getTime());else{if("string"!=typeof t&&"number"!=typeof t)throw new Error("Invalid date input");this.date=new Date(t)}if(isNaN(this.date.getTime()))throw new Error("Invalid Date")}static create(t){return new ne(t)}day(){const t=this.date.getDay();return 0===t?7:t}format(t="YYYY-MM-DD HH:mm:ss"){const e=(t,e=2)=>t.toString().padStart(e,"0"),n={YYYY:e(this.date.getFullYear(),4),YY:e(this.date.getFullYear()%100),MM:e(this.date.getMonth()+1),DD:e(this.date.getDate()),HH:e(this.date.getHours()),mm:e(this.date.getMinutes()),ss:e(this.date.getSeconds()),SSS:e(this.date.getMilliseconds(),3)};return t.replace(/YYYY|YY|MM|DD|HH|mm|ss|SSS/g,(t=>n[t]??t))}add(t,e){const n=new Date(this.date.getTime());switch(e){case"year":n.setFullYear(n.getFullYear()+t);break;case"month":const e=n.getDate();n.setMonth(n.getMonth()+t),n.getDate()!==e&&n.setDate(0);break;case"week":n.setDate(n.getDate()+7*t);break;case"day":n.setDate(n.getDate()+t);break;case"hour":n.setHours(n.getHours()+t);break;case"minute":n.setMinutes(n.getMinutes()+t);break;case"second":n.setSeconds(n.getSeconds()+t);break;case"millisecond":n.setMilliseconds(n.getMilliseconds()+t)}return new ne(n)}subtract(t,e){return this.add(-t,e)}startOf(t){const e=new Date(this.date.getTime());switch(t){case"year":e.setMonth(0);case"month":e.setDate(1);case"day":case"week":if("week"===t){const t=this.day();e.setDate(e.getDate()-(t-1))}e.setHours(0);case"hour":e.setMinutes(0);case"minute":e.setSeconds(0);case"second":e.setMilliseconds(0)}return new ne(e)}endOf(t){const e=new Date(this.date.getTime());switch(t){case"year":e.setMonth(11);case"month":e.setDate(this.daysInMonth());case"day":case"week":if("week"===t){const t=this.day();e.setDate(e.getDate()+(7-t))}e.setHours(23);case"hour":e.setMinutes(59);case"minute":e.setSeconds(59);case"second":e.setMilliseconds(999)}return new ne(e)}diff(t,e="millisecond"){const n=t instanceof ne?t.date:new Date(t),r=this.date.getTime()-n.getTime();switch(e){case"year":return this.date.getFullYear()-n.getFullYear();case"month":return 12*(this.date.getFullYear()-n.getFullYear())+(this.date.getMonth()-n.getMonth());case"week":return Math.floor(r/6048e5);case"day":return Math.floor(r/864e5);case"hour":return Math.floor(r/36e5);case"minute":return Math.floor(r/6e4);case"second":return Math.floor(r/1e3);default:return r}}getWeekRange(t=0,e=1){if(e<1||e>7)throw new Error("weekStartsOn must be between 1 and 7");let n=this.add(7*t,"day"),r=(n.day()-e+7)%7;const o=n.subtract(r,"day").startOf("day"),a=o.add(6,"day").endOf("day");return[o,a]}getMonthRange(t=0){const e=this.add(t,"month");return[e.startOf("month"),e.endOf("month")]}getQuarterRange(t=0){const e=this.add(3*t,"month"),n=3*Math.floor(e.toDate().getMonth()/3),r=new ne(new Date(e.toDate().getFullYear(),n,1)).startOf("month"),o=r.add(2,"month").endOf("month");return[r,o]}getYearRange(t=0){const e=this.add(t,"year");return[e.startOf("year"),e.endOf("year")]}isWeekday(){return this.day()<=5}isWeekend(){return!this.isWeekday()}isSame(t,e="millisecond"){const n=t instanceof ne?t:ne.create(t);return this.startOf(e).valueOf()===n.startOf(e).valueOf()}isBefore(t){return this.date.getTime()<ne.create(t).valueOf()}isAfter(t){return this.date.getTime()>ne.create(t).valueOf()}isValid(){return!isNaN(this.date.getTime())}toDate(){return new Date(this.date.getTime())}valueOf(){return this.date.getTime()}toString(){return this.date.toISOString()}daysInMonth(){return new Date(this.date.getFullYear(),this.date.getMonth()+1,0).getDate()}}function re(t,e="YYYY-MM-DD HH:mm:ss"){return ne.create(t).format(e)}function oe(t){const[e,n]=ne.create().getWeekRange();return t?[e.format(t),n.format(t)]:[e.toString(),n.toString()]}function ae(t){const[e,n]=ne.create().getMonthRange();return t?[e.format(t),n.format(t)]:[e.toString(),n.toString()]}function se(t,e,n="YYYY-MM-DD"){const r=ne.create(t).startOf("day"),o=ne.create(e).startOf("day").diff(r,"day");return Array.from({length:o+1},((t,e)=>r.add(e,"day").format(n)))}function ie(t,e=new Date){const n=ne.create(e).diff(t,"second");if(n<60)return`${n}秒`;if(n<3600)return`${Math.floor(n/60)}分钟`;if(n<86400)return`${Math.floor(n/3600)}小时`;const r=Math.floor(n/86400);return r>=0?`${r}天`:`${Math.abs(r)}天后`}function ce(t){if(!Number.isInteger(t))return"Invalid timestamp";const e=Date.now()-t,n=Math.floor(e/1e3),r=Math.floor(n/60),o=Math.floor(r/60),a=Math.floor(o/24),s=Math.floor(a/30),i=Math.floor(s/12);return i>0?`${i}年前`:s>0?`${s}个月前`:a>0?`${a}天前`:o>0?`${o}小时前`:r>0?`${r}分钟前`:n>30?`${n}秒前`:"刚刚"}function ue(t,e={}){if(null==t||"object"!=typeof t)return t;const{cloneObject:n=E}=e,r={},o=[{parent:r,prop:"root",data:t}],a=new WeakMap,s=[],i=[];for(;o.length;){const{parent:t,prop:e,data:r}=o.pop();if(!t)continue;const c=N(r);if("Date"===c){t[e]=new Date(r);continue}if("Array"!==c){const o=n(c,r);if(null!=o){t[e]=o;continue}}const u=t[e]="Array"===c||"Set"===c||"Map"===c?[]:{};if("Set"===c||"Map"===c){let n=0;if("Set"===c){for(const t of r)a.has(t)?u[n]=a.get(t):null!==t&&"object"==typeof t?o.push({parent:u,prop:n,data:t}):u[n]=t,++n;s.push({parent:t,prop:e})}else{for(const t of r){const e=[];n=0;for(const r of t)a.has(r)?e[n]=a.get(r):null!==r&&"object"==typeof r?o.push({parent:e,prop:n,data:r}):e[n]=r,++n;u.push(e)}i.push({parent:t,prop:e})}}else for(const t of Object.keys(r)){const e=r[t];a.has(e)?u[t]=a.get(e):null!==e&&"object"==typeof e?o.push({parent:u,prop:t,data:e}):u[t]=e}a.set(r,u)}for(const{parent:t,prop:e}of s)t[e]=new Set(t[e]);for(const{parent:t,prop:e}of i)t[e]=new Map(t[e]);return r.root}Date.prototype.isBefore=function(t){return this.getTime()<t.getTime()},Date.prototype.isAfter=function(t){return this.getTime()>t.getTime()};const fe=()=>!0;function le(t,e="This object was destroyed, do not use it anywhere"){const n=()=>{throw new Error(e)};Object.keys(t).forEach((e=>{"function"==typeof t[e]?t[e]=n.bind(t):t[e]=null})),Object.getOwnPropertyNames(t.constructor.prototype).forEach((e=>{"constructor"!==e&&"function"==typeof t[e]&&(t[e]=n.bind(t))})),t.isDestroyed=fe}const de=t&&("ontouchstart"in window||("undefined"!=typeof navigator&&(navigator.maxTouchPoints||navigator.msMaxTouchPoints)||0)>0),he=de?"pointerdown":"click";function ge(t,e,n=window.Event){const{type:r,bubbles:o=!1,cancelable:a=!1,...i}=e;if(!s(r)||""===r)return!1;let c;return s(n)?c=new n(r,{bubbles:o,cancelable:a}):(c=document.createEvent("HTMLEvents"),c.initEvent(r,o,a)),Object.assign(c,i),t.dispatchEvent(c)}const pe=/^\s*[+-]?\d*\.?\d+(?:[eE][+-]?\d+)?\s*$/;function me(t,e=!1){return"number"==typeof t?!Number.isNaN(t):e?pe.test(String(t)):!Number.isNaN(parseFloat(t))||!Number.isNaN(Number(t))}function be(t){let e=parseFloat(t);return Number.isNaN(e)&&(e=Number(t)),Number.isNaN(e)?0:e}function ye(t,e){return e<=0?t.toString():`${t<0?"-":""}${String(Math.abs(Math.round(t))).padStart(e,"0")}`}function we(t){return ye(t,2)}function ve(t){const e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-+(e[1]||0);return n>0?n:0}function Me(t){return ve(t)}function Se(t,e=3,n=","){if("number"!=typeof t&&(t=parseFloat(t)),Number.isNaN(t))return"0";let[r,o]=String(t).split(".");const a=new RegExp(`(\\d+)(\\d{${e}})`);for(;a.test(r);)r=r.replace(a,`$1${n}$2`);return o=o?`.${o}`:"",`${r}${o}`}function ke(t,e){if(0===e)return Math.round(t);let n=t.toFixed(ve(t));const r=n.indexOf(".");if(-1===r)return t;const o=r+e;return n.replace(".","").split("")[o]?(n="5"===n.charAt(o+1)?n.substring(0,o+1)+"6":n.substring(0,o+2),parseFloat(Number(n).toFixed(e))):t}function Ae(t,e,n){return ke(t*e,n)}function $e(t,e){if(e<0||e>1)return Math.round(t);const n=Math.ceil(t);return t+1-e>=n?n:Math.floor(t)}function xe(t,e,n){return Math.max(e,Math.min(n,parseFloat(t)))}function Fe(t,e,n=0){if(t<=0||e<=1)return[t];n<1&&(n=1/0);const r=[];let o=0;for(;t>=e&&o<n;)r.push(t%e),t=Math.floor(t/e),++o;return r.push(t),r.reverse()}function Ee(t){if(t<0)return`${t}th`;const e=["th","st","nd","rd"];return`${t}${e[t%100]||e[t%10]||e[0]}`}const Oe=Object.freeze(["B","KB","MB","GB","TB","AUTO"]);function De(t,e="AUTO",n=!1,r){void 0===r&&("number"==typeof n?(r=n,n=!1):r=2);let o,a,s=e.toUpperCase();switch(s=Oe.includes(s)?s:"AUTO",s){case"AUTO":o=0;break;case"KB":o=1;break;case"MB":o=2;break;case"GB":o=3;break;case"TB":o=4;break;default:return t}if(o)a=t/1024**o;else for(a=t;a>1024&&!(o>4);++o)a/=1024;return a=ke(a,r),n?`${a}${"AUTO"===s?Oe[Math.min(o,4)]:s}`:a}function Ce(t,e=0){return e===t?e:(e>t&&([e,t]=[t,e]),Math.random()*(t-e)+e)}function Ne(t,e=15){return+parseFloat(Number(t).toPrecision(e))}function Te(t){const e=String(t);if(!e.includes("e"))return Number(e.replace(".",""));const n=ve(t);return n>0?Ne(Number(t)*10**n):Number(t)}function Ie(t){return(...e)=>{let n=e[0];for(let r=1,o=e.length;r<o;++r)n=t(n,e[r]);return n}}const je=Ie(((t,e)=>Te(t)*Te(e)/10**(ve(t)+ve(e)))),Ye=Ie(((t,e)=>{const n=10**Math.max(ve(t),ve(e));return(je(t,n)+je(e,n))/n})),Re=Ie(((t,e)=>{const n=10**Math.max(ve(t),ve(e));return(je(t,n)-je(e,n))/n})),Pe=Ie(((t,e)=>{const n=Te(t),r=Te(e);return je(n/r,Ne(10**(ve(e)-ve(t))))})),Be=["button","[href]:not(.disabled)","input","select","textarea","[tabindex]","[contenteditable]"].map((t=>`${t}:not(:disabled):not([disabled])`)).join(", ");function Le(t){return!!t&&1===t.nodeType}function ze(e,n){return t&&e?Array.from((r=n,Le(r)?r:document.body).querySelectorAll(e)):[];var r}function He(e){if(!t)return!1;const n=document.activeElement;return!(!Le(e)||!n)&&(e===n||Ue(n,e))}function Ue(t,e){if(!t||!e)return!1;const n=e.__transferElement;return e.contains(t)||!!n&&(n===t||n.contains(t))}function We(e){if(!(t&&Le(e)&&e.parentNode&&Ue(e,document.body)))return!0;if("none"===e.style.display)return!0;const n=e.getBoundingClientRect();return!(n&&n.width>0&&n.height>0)}function qe(t){return!We(t)}function Ze(t){return!Le(t)||t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")||t.disabled}function Ke(t,e=!1){const n=e?()=>!1:Ze;return ze(Be,t).filter((t=>qe(t)&&t.tabIndex>-1&&!n(t)))}function Ve(e){if(!t||!e)return 0;const n=getComputedStyle(e);return parseFloat(n.paddingLeft)+parseFloat(n.paddingRight)||0}function Ge(e){if(!t||!e)return 0;const n=getComputedStyle(e);return parseFloat(n.paddingTop)+parseFloat(n.paddingBottom)||0}function _e(e){if(!t||!e)return 0;const n=getComputedStyle(e);return parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0}function Je(e){if(!t||!e)return 0;const n=getComputedStyle(e);return parseFloat(n.marginTop)+parseFloat(n.marginBottom)||0}function Qe(e){if(!t||!e)return 0;const n=getComputedStyle(e);return parseFloat(n.borderLeftWidth)+parseFloat(n.borderRightWidth)||0}function Xe(e){if(!t||!e)return 0;const n=getComputedStyle(e);return parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)||0}function tn(e){if(!t||!e)return 0;const n=document.createRange();n.setStart(e,0),n.setEnd(e,e.childNodes.length);return n.getBoundingClientRect().width+Ve(e)}function en(t){return me(t,!0)?`${be(t)}px`:String(t).trim()}function nn(t){return s(t)&&!1!==t?String(t):void 0}const rn=/["'&<>]/;function on(t){const e=""+t,n=rn.exec(e);if(!n)return e;let r,o,a="",s=0;for(o=n.index;o<e.length;o++){switch(e.charCodeAt(o)){case 34:r="&quot;";break;case 38:r="&amp;";break;case 39:r="&#39;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}s!==o&&(a+=e.substring(s,o)),s=o+1,a+=r}return s!==o?a+e.substring(s,o):a}class an{events=new Map;static instance=new an;static getEvents(){return an.getInstance().events}static getEventsSize(){return an.getInstance().events.size}static getEvent(t){return an.getInstance().events.get(t)}static hasEvent(t){return an.getInstance().events.has(t)}static deleteEvent(t){return an.getInstance().events.delete(t)}static setEvent(t,e){return an.hasEvent(t)&&console.warn(`Event "${t}" is already registered. Overwriting...`),an.getInstance().events.set(t,e)}static on(t,e){return an.isFunction(e)||console.warn("The second argument to the on method must be a function"),an.setEvent(t,e)}static emit(t,...e){const n=an.getEvent(t);if(an.isFunction(n))return n(...e);console.error(`EventBus Error: Event "${t}" is not registered. Use "EventBus.on('${t}', callback)" to bind it.`)}static once(t,...e){const n=an.emit(t,...e);return an.off(t),n}static off(t){return Array.isArray(t)?t.every((t=>an.off(t))):an.getInstance().events.delete(t)}static getInstance(){return an.instance}static isFunction(t){return"function"==typeof t}}function sn(){const t=new Map;return{on(e,n){const r=t.get(e),o=r?.add(n);o||t.set(e,new Set([n]))},off(e,n){const r=t.get(e);r&&r.delete(n)},clear(e){const n=t.get(e);n&&n.clear()},clearAll(){t.clear()},emit(e,...n){const r=t.get(e);r&&r.forEach((t=>{t(...n)}))}}}class cn{static normalizeKey(t){return"number"==typeof t?`Key${String.fromCharCode(t)}`:t.toString().toLowerCase()}static isComboMatch(t,e){return(Array.isArray(e)?e:[e]).every((e=>{const n=cn.normalizeKey(e);return t.key.toLowerCase()===n||t.code.toLowerCase()===n||t.keyCode===("number"==typeof e?e:0)}))}static on(t,e,n={}){const{preventDefault:r=!1,stopPropagation:o=!1,target:a=document,event:s="keydown"}=n,i=n=>{const a=n;cn.isComboMatch(a,t)&&(r&&a.preventDefault(),o&&a.stopPropagation(),e(a))};return a.addEventListener(s,i),{unsubscribe:()=>{a.removeEventListener(s,i)}}}static once(t,e,n={}){let r=null;return r=this.on(t,(t=>{e(t),r?.unsubscribe()}),n),r}static longPress(t,e,n={}){const{threshold:r=500,interval:o=100,...a}=n;let s=null,i=null;const c=this.on(t,(t=>{s=setTimeout((()=>{e(t),i=setInterval((()=>e(t)),o)}),r)}),{...a,event:"keydown"}),u=this.on(t,(()=>{s&&clearTimeout(s),i&&clearInterval(i),s=null,i=null}),{...a,event:"keyup"});return{unsubscribe:()=>{c.unsubscribe(),u.unsubscribe(),s&&clearTimeout(s),i&&clearInterval(i)}}}}class un{static isButtonMatch(t,e){if("number"==typeof e)return t.button===e;return t.button==={left:0,middle:1,right:2}[e]}static on(t,e,n={}){const{preventDefault:r=!1,stopPropagation:o=!1,target:a=document,event:s="mousedown"}=n,i=n=>{const a=n;un.isButtonMatch(a,t)&&(r&&a.preventDefault(),o&&a.stopPropagation(),e(a))};return a.addEventListener(s,i),{unsubscribe:()=>{a.removeEventListener(s,i)}}}static once(t,e,n={}){let r=null;return r=this.on(t,(t=>{e(t),r?.unsubscribe()}),n),r}static longPress(t,e,n={}){const{threshold:r=500,interval:o=100,...a}=n;let s=null,i=null;const c=this.on(t,(t=>{s=setTimeout((()=>{e(t),i=setInterval((()=>e(t)),o)}),r)}),{...a,event:"mousedown"}),u=this.on(t,(()=>{s&&clearTimeout(s),i&&clearInterval(i),s=null,i=null}),{...a,event:"mouseup"});return{unsubscribe:()=>{c.unsubscribe(),u.unsubscribe(),s&&clearTimeout(s),i&&clearInterval(i)}}}static onClickOutside(t,e,n={}){const{preventDefault:r=!1,stopPropagation:o=!1}=n,a=n=>{const a=n;t.contains(a.target)||(r&&a.preventDefault(),o&&a.stopPropagation(),e(a))};return document.addEventListener("click",a),{unsubscribe:()=>{document.removeEventListener("click",a)}}}}function fn(t,e,n){t&&!e.has(t)&&(n(t),e.add(t))}const ln=new Set;function dn(t,e=console.info){fn(t,ln,e)}const hn=new Set;function gn(t,e=console.warn){fn(t,hn,e)}const pn=new Set;function mn(t,e=console.warn){fn(t,pn,e)}const bn=t?requestAnimationFrame:t=>{setTimeout(t,16)};function yn(t,e=16){if("function"!=typeof t)return E;const{leading:n=!0,trailing:r=!0,interval:o=("number"==typeof e?e:e.interval||16)}="object"==typeof e?e:{interval:e};if(o<=0)return vn(t);let a=0,s=null,i=null;const c=(...e)=>{a=Date.now(),t(...e)};return function(...t){const e=Date.now(),u=e-a;i=t,s&&(clearTimeout(s),s=null),u>=o&&(n&&c(...t),a=e),r&&(!n||u<o)&&(s=setTimeout((()=>{s=null,r&&i&&c(...i)}),Math.max(0,o-u)))}}function wn(t,e=100){if("function"!=typeof t)return E;const{leading:n=!1,trailing:r=!0,delay:o=("number"==typeof e?e:e.delay||100)}="object"==typeof e?e:{delay:e};if(o<=0)return vn(t);let a=null,s=null,i=!1;const c=(...e)=>{t(...e)};return function(...t){s=t,a?(clearTimeout(a),i=!0):(n&&c(...t),i=!1),a=setTimeout((()=>{a=null,r&&i&&c(...s)}),o)}}function vn(t,e={}){if("function"!=typeof t)return t;const{leading:n=!1,trailing:r=!0}=e;let o,a,s=!1,i=!1;return function(...e){if(o=e,s)i=r;else{if(s=!0,n){const e=t(...o);a=Promise.resolve(e)}else a=Promise.resolve();a=a.then((()=>r&&i?(i=!1,t(...o)):a)).finally((()=>{s=!1,a=void 0}))}return a}}function Mn(t,e={}){if("function"!=typeof t)return t;const{leading:n=!1,trailing:r=!0}=e;let o,a,s=!1,i=!1;return function(...e){if(o=e,s)i=r;else{if(s=!0,n){const e=t(...o);a=Promise.resolve(e)}else a=new Promise((e=>{bn((()=>{r&&i?(i=!1,e(t(...o))):e(void 0)}))}));a=a.finally((()=>{s=!1,a=void 0}))}return a}}const Sn=new Set,kn=new WeakMap;function An(){Sn.forEach((t=>{t(...kn.get(t))})),Sn.clear()}function $n(t,...e){if("function"!=typeof t)return t;kn.set(t,e),Sn.has(t)||(Sn.add(t),1===Sn.size&&Promise.resolve().then(An))}const xn=new Set,Fn=new WeakMap;function En(){xn.forEach((t=>{t(...Fn.get(t))})),xn.clear()}function On(t,...e){if("function"!=typeof t)return t;Fn.set(t,e),xn.has(t)||(xn.add(t),1===xn.size&&bn(En))}async function Dn(t,e,n){const r=[],o=[];for(const a of e){const s=Promise.resolve().then((()=>n(a,e)));if(r.push(s),t<=e.length){const e=s.then((()=>o.splice(o.indexOf(e),1)));o.push(e),o.length>=t&&await Promise.race(o)}}return Promise.all(r)}let Cn=null;function Nn(){if(!t)return!0;if(null===Cn){const t=document.createElement("div");t.style.display="flex",t.style.flexDirection="column",t.style.rowGap="1px",t.appendChild(document.createElement("div")),t.appendChild(document.createElement("div")),document.body.appendChild(t),Cn=1===t.scrollHeight,document.body.removeChild(t)}return Cn}let Tn=null;function In(){return!!t&&(null===Tn&&(Tn="loading"in document.createElement("img")),Tn)}function jn(t){return Array.isArray(t)?t:[t]}function Yn(t,...e){return w(t)?t(...e):t}function Rn(t){return t.replace(/[\\/]+/g,"/")}function Pn(t){return t[t.length-1]}function Bn(t,e,n=t=>t,r=!1){const o=r?new Map:{};if(!s(e))return o;const a=r?(t,e)=>o.set(t,e):(t,e)=>o[t]=e,i=w(e)?e:t=>t[e];return t.forEach((t=>{const e=i(t);s(e)&&a(e,n(t))})),o}function Ln(t,e,n=!1){let r=-1;return r=n||"function"!=typeof e?t.findIndex((t=>t===e)):t.findIndex(e),~r?t.splice(r,1)[0]:null}function zn(t,e=[]){"string"!=typeof e&&"function"!=typeof e||(e=[e]);const n=e.length,r={};for(const o of t){let t;for(let a=0;a<n;++a){const s=a===n-1,i=e[a],c="function"==typeof i?i(o):o[i];t?(t[c]||(t[c]=s?[]:{}),t=t[c]):(r[c]||(r[c]=s?[]:{}),t=r[c])}t.push(o)}return r}function Hn(t,e={}){const{keyField:n="id",childField:r="children",parentField:o="parent",rootId:a=null}=e,i=s(a)&&""!==a,c=[],u=new Map;for(let e=0,f=t.length;e<f;++e){const f=t[e],l=f[n];if(i?l!==a:s(l))if(u.has(l)?f[r]=u.get(l):(f[r]=[],u.set(l,f[r])),!f[o]||i&&f[o]===a)c.push(f);else{const t=f[o];u.has(t)||u.set(t,[]),u.get(t).push(f)}}return c}function Un(t,e={}){const{keyField:n="id",childField:r="children",parentField:o="parent",rootId:a=null,depthFirst:i=!1,injectId:c=!0,buildId:u=t=>t,filter:f=O,cascaded:l=!1,forceInject:d=!1}=e;let h=1;const g=s(a)&&""!==a,p=[],m=[...t];for(;m.length;){const t=m.shift(),e=t[r],s=Array.isArray(e)&&e.length?e:[];!c||!d&&t[n]||(t[n]=u(h++));const b=t[n];c&&o&&(g?t[o]===a:!t[o])&&(t[o]=a);const y=f(t);if(y&&p.push(t),y||!l){for(let t=0,e=s.length;t<e;++t){const e=s[t];c&&o&&(e[o]=b),!i&&m.push(e)}i&&m.unshift(...s)}}return p}function Wn(t,e,n={}){const{childField:r="children",depthFirst:o=!1}=n,a=[...t.map((t=>({item:t,depth:0,parent:null})))];for(;a.length;){const{item:t,depth:n,parent:s}=a.shift(),i=t[r];e(t,n,s),F(i)&&a[o?"unshift":"push"](...Array.from(i).map((e=>({item:e,depth:n+1,parent:t}))))}}function qn(t,e,n={}){const{childField:r="children",depthFirst:o=!1,clearChildren:a=!0}=n,s=[],i=[...t.map((t=>({item:t,depth:0,parent:null,result:s})))];for(;i.length;){const{item:t,depth:n,parent:s,result:c}=i.shift(),u=t[r],f=e(t,n,s)??{};if(a&&(f[r]=[]),c.push(f),F(u)){Array.from(u).length&&(f[r]=[],i[o?"unshift":"push"](...Array.from(u).map((e=>({item:e,depth:n+1,parent:t,result:f[r]})))))}}return s}function Zn(t,e,n={}){const{childField:r="children",leafOnly:o=!1,isLeaf:a=t=>!F(t[r])}=n,s=(t,n,i)=>t.map((t=>({...t}))).filter((t=>{const c=t[r],u=a(t),f=F(c)&&Array.from(c);if(o&&!u){if(f&&f.length){const e=s(f,n+1,t);return t[r]=e,!!e.length}return!1}const l=e(t,n,i);if(u)return l;if(!o&&l)return!0;if(f&&f.length){const e=s(f,n+1,t);return t[r]=e,!!e.length}return l}));return s(t,0,null)}const Kn=(t,e)=>Number.isNaN(Number(t)-Number(e))?String(t).localeCompare(e):t-e;function Vn(t,e){if(!t.sort||b(e)&&!e.key||!e.length)return t;const n=Array.from(t);Array.isArray(e)||(e=[e]);const r=e.map((t=>"string"==typeof t?{key:t,method:Kn,type:"asc"}:t)).map((t=>("function"!=typeof t.accessor&&(t.accessor=e=>e[t.key]),"function"!=typeof t.method&&(t.method=Kn),t.params=Array.isArray(t.params)?t.params:[],t)));return n.sort(((t,e)=>{let n=0;for(const o of r){const{method:r,type:a,accessor:s,params:i}=o,c="desc"===a,u=r(s(t,...i),s(e,...i));if(n=c?-u:u,n)break}return n})),n}function Gn(t,e,n=!0){const r=[{source:t=n?ue(t):t,target:e}];for(;r.length;){const{source:t,target:e}=r.pop();Object.keys(e).forEach((n=>{b(e[n])?(b(t[n])||(t[n]={}),r.push({source:t[n],target:e[n]})):Array.isArray(e[n])?(Array.isArray(t[n])||(t[n]=[]),r.push({source:t[n],target:e[n]})):t[n]=e[n]}))}return t}function _n(t){t=Array.from(t);let e=!1;const n=()=>{e||(t.shift()?.(),t.length&&bn(n))};return n(),()=>e=!0}const Jn=/\B([A-Z])(?=[^A-Z_-])/g;function Qn(t){return t.replace(Jn,"-$1").toLowerCase()}function Xn(t){return((t=(t=t.trim().replace(/\s+/g,"-")).replace(/-+(\w)/g,((t,e)=>e?e.toUpperCase():""))).charAt(0).toLocaleUpperCase()+t.slice(1)).replace(/[^\w]/g,"")}function tr(t){const e=Xn(t);return function(t){const e=t.match(/[A-Z]+/);return e&&e[0]===t}(e)?e.toLocaleLowerCase():e.charAt(0).toLowerCase()+e.slice(1)}function er(t,e=new WeakMap){if(null===t||"object"!=typeof t)return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const e=t.flags||(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":"");return new RegExp(t.source,e)}if(t instanceof Map){const n=new Map;return e.set(t,n),t.forEach(((t,r)=>{n.set(er(r,e),er(t,e))})),n}if(t instanceof Set){const n=new Set;return e.set(t,n),t.forEach((t=>{n.add(er(t,e))})),n}if(t instanceof ArrayBuffer)return t.slice(0);if(ArrayBuffer.isView(t)){const n=t,r=er(n.buffer,e);return new t.constructor(r,n.byteOffset,n.length)}const n=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t));e.set(t,n);const r=Object.getOwnPropertySymbols(t);for(const o of[...Object.keys(t),...r])n[o]=er(t[o],e);return n}function nr(t){let e,n,r=t.length;const o=globalThis.crypto||globalThis.msCrypto,a=t=>{if(o?.getRandomValues){const e=new Uint32Array(1);return o.getRandomValues(e),e[0]/4294967296*t}return Math.random()*t};for(;0!==r;)n=Math.floor(a(r)),r--,e=t[r],t[r]=t[n],t[n]=e;return t}function rr(t){return nr([...t])}export{he as CLICK_TYPE,ct as COLOR_NAMES,ne as DateTime,an as EventBus,rt as HEX_REG_3,ot as HEX_REG_4,at as HEX_REG_6,st as HEX_REG_8,tt as HSLA_REG,X as HSL_REG,nt as HSVA_REG,et as HSV_REG,cn as KeyboardListener,un as MouseListener,it as NAMED_COLORS,z as ObjectLocalStorage,Q as RGBA_REG,J as RGB_REG,de as USE_TOUCH,Ot as adjustAlpha,Xt as base64Decode,Qt as base64Encode,xe as boundRange,Hn as buildTree,_t as caesarCipher,Yn as callIfFunc,er as cloneDeep,Ue as contains,ee as createBITree,Gt as createCounter,sn as createEventEmitter,wn as debounce,Mn as debounceFrame,vn as debounceMinor,I as decide,ve as decimalLength,ue as deepClone,le as destroyObject,Me as digitLength,ge as dispatchEvent,Pe as divide,we as doubleDigits,jn as ensureArray,mn as errorOnce,on as escapeHtml,Zn as filterTree,Un as flatTree,De as formatByteSize,re as formatDate,ae as getCurrentMonth,oe as getCurrentWeek,se as getDateRange,Kt as getGlobalCount,Pn as getLast,tn as getRangeWidth,N as getType,Qe as getXBorder,_e as getXMargin,Ve as getXPadding,Xe as getYBorder,Je as getYMargin,Ge as getYPadding,zn as groupByProps,a as has,St as hslToHsv,vt as hslToRgb,kt as hsvToHsl,At as hsvToRgb,ie as humanizeDiff,dn as infoOnce,o as is,m as isArray,p as isBigInt,l as isBoolean,Y as isClass,t as isClient,dt as isColor,S as isDate,s as isDefined,Ze as isDisabled,x as isElement,L as isEmail,A as isEmpty,$ as isEmptyObject,R as isExist,h as isFalse,He as isFocusIn,w as isFunction,ut as isHex,We as isHidden,e as isIOS,F as isIterable,M as isMap,u as isNaN,i as isNull,c as isNumber,b as isObject,B as isPhone,y as isPromise,k as isRegExp,ft as isRgb,lt as isRgba,v as isSet,f as isString,g as isSymbol,d as isTrue,j as isUndefined,me as isValidNumber,qe as isVisible,P as isWindow,Fe as leaveNumber,Bn as listToMap,qn as mapTree,Gn as mergeObjects,Re as minus,Et as mixColor,Ae as multipleFixed,On as nextFrameOnce,$n as nextTickOnce,E as noop,wt as normalizeAlpha,mt as normalizeHsl,yt as normalizeHsv,Rn as normalizePath,bt as normalizeRgb,pe as numberRE,Ee as ordinalNumber,ye as padStartZeros,gt as parseColor,pt as parseColorToRgba,ht as parseStringColor,Ye as plus,ze as queryAll,Ke as queryTabables,bn as raf,Ce as random,Dt as randomColor,Nt as randomHardColor,Ct as randomPreferColor,Tt as randomSoftColor,T as randomString,C as range,V as readClipboard,Ln as removeArrayItem,xt as rgbToHex,Mt as rgbToHsl,$t as rgbToHsv,Ft as rgbaToHex,$e as round,Dn as runParallel,_n as runQueueFrame,Se as segmentNumber,Vt as setGlobalCount,nr as shuffle,rr as shuffled,Vn as sortByProps,Nn as supportFlexGap,In as supportImgLoading,yn as throttle,ce as timeAgo,je as times,nn as toAttrValue,tr as toCamelCase,Xn as toCapitalCase,en as toCssSize,D as toFalse,ke as toFixed,It as toGrayScale,Qn as toKebabCase,be as toNumber,Ne as toPrecision,O as toTrue,Bn as transformListToMap,Hn as transformTree,Wn as walkTree,gn as warnOnce,K as writeClipboard,Jt as xorCipher}; //# sourceMappingURL=toolset.io.js.map