Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bassist/utils

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bassist/utils - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

4

lib/index.min.js
/**
* name: @bassist/utils
* version: v0.11.0
* version: v0.11.1
* description: Opinionated collection of common JavaScript / TypeScript utils by @chengpeiquan .

@@ -9,2 +9,2 @@ * author: chengpeiquan <chengpeiquan@chengpeiquan.com>

*/
(function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.Utils={}))})(this,function(o){"use strict";var Te=Object.defineProperty;var Ae=(o,s,l)=>s in o?Te(o,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[s]=l;var M=(o,s,l)=>(Ae(o,typeof s!="symbol"?s+"":s,l),l);const s={isSupported:typeof navigator>"u"?!1:Boolean(navigator.clipboard),async copy(e){if(!this.isSupported)return!1;const i=e.innerText||e.value;return await this.write(i)},async cut(e){return!this.isSupported||!await this.copy(e)?!1:(e.value="",!0)},async read(){return this.isSupported?await navigator.clipboard.readText():""},async write(e){return this.isSupported?(await navigator.clipboard.writeText(e),!0):!1}};function l(){return typeof window<"u"?navigator.userAgent.toLowerCase():""}const p=["Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.0.0; zh-CN; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.1.4.994 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.1; EML-AL00 Build/HUAWEIEML-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.143 Crosswalk/24.53.595.0 XWEB/358 MMWEBSDK/23 Mobile Safari/537.36 MicroMessenger/6.7.2.1340(0x2607023A) NetType/4G Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044207 Mobile Safari/537.36 MicroMessenger/6.7.3.1340(0x26070332) NetType/4G Language/zh_CN Process/tools","Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13","MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","Mozilla/5.0 (Linux; Android 7.1.1; MI 6 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/043807 Mobile Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 OPR/45.0.2552.812","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"],c=typeof window<"u",C=!c,A=/iPhone|phone|android|iPod|pad|iPad/i;function K(){return c?A.test(l()):!1}function v(){return c?!K():!1}const _=/Android/i.test(l()),y=/iPhone|iPod|iPad|iOS/i.test(l()),O=/uni-app|html5plus/.test(l()),H=/MicroMessenger/i.test(l()),N=/\sQQ|mqqbrowser|qzone|qqbrowser/i.test(l()),x=/mqqbrowser|qqbrowser/i.test(l()),F=/qzone\/.*_qz_([\d.]+)/i.test(l()),I=/(weibo).*weibo__([\d.]+)/i.test(l()),E=/(baiduboxapp)\/([\d.]+)/i.test(l());function X(e,{immediate:i}={immediate:!0}){c&&(i&&window.addEventListener("load",e,!1),window.addEventListener("orientationchange"in window?"orientationchange":"resize",e,!1))}function k(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function u(e){return k(e)==="object"}function f(e,i){return u(e)?Object.prototype.hasOwnProperty.call(e,i):!1}const W={};class P{constructor(i){M(this,"data");this.data={};const n=f(W,i);this.data=n?W[i].data:{},n||(W[i]=this)}get length(){return Object.keys(this.data).length}clear(){this.data={}}getItem(i){return f(this.data,i)?this.data[i]:null}setItem(i,n){this.data[i]=n}removeItem(i){f(this.data,i)&&delete this.data[i]}key(i){const n=Object.keys(this.data);return i>n.length?null:n[i]}}class b{constructor(i,n){M(this,"prefix");M(this,"storage");this.prefix=i,this.storage=c?window[n]:new P(i)}get(i){const n=this.storage.getItem(`${this.prefix}-${i}`);if(!n)return n;try{return n==="true"?!0:n==="false"?!1:n==="null"?null:n==="undefined"?void 0:JSON.parse(n)}catch{return n}}set(i,n){try{const r=k(n)==="string"?n:JSON.stringify(n);this.storage.setItem(`${this.prefix}-${i}`,r)}catch(t){console.log(t)}}remove(i){this.storage.removeItem(`${this.prefix}-${i}`)}clear(){this.list().forEach(n=>{this.remove(n)})}count(){return this.list().length}list(){if(!this.prefix)return[];const i=[],n=this.storage.length;for(let t=0;t<n;t++){const r=this.storage.key(t);r!=null&&r.startsWith(this.prefix)&&i.push(r.replace(`${this.prefix}-`,""))}return i}}class B extends b{constructor(i){super(i,"localStorage")}}class $ extends b{constructor(i){super(i,"sessionStorage")}}function L(){return c?window.matchMedia("(prefers-color-scheme: dark)").matches:!1}function z(){return c?window.matchMedia("(prefers-color-scheme: light)").matches:!1}function Q(){if(L())return"dark";if(z())return"light"}function R(e){return new Promise(i=>{setTimeout(()=>{i()},e)})}class U{constructor(i){M(this,"mime");this.mime=i}getMimeType(i){try{return i.startsWith("data")&&i.includes("base64")?i.split(",")[0].replace(/data:(.*);base64/,"$1"):this.mime.getType(i)||""}catch{return""}}getExtensionFromMimeType(i){try{return this.mime.getExtension(i)||""}catch{return""}}getExtension(i){try{const n=this.getMimeType(i);return this.getExtensionFromMimeType(n)}catch{return""}}}function V(e,i=!1){return e=e?String(e):"",e=e.replace(/[^\d]/g,""),e&&!i&&(e=parseInt(e)),String(e)}function q(e){if(e=String(e),!e)return"0.00";const i=e.split("."),n=i[0],t=i[1];return i.length===1?`${n}.00`:t.length===1?`${e}0`:Number(e).toFixed(2)}function D(e,i){return String(e).length>i?String(e).slice(0,i)+" ...":String(e)}function g([e,...i]){return e?e.toUpperCase()+i.join(""):""}function j(e){return e?e.replace(/([A-Z])/g," $1").trim().split(" ").join("-").replace(/_/g,"-").toLowerCase():""}function w([e,...i]){return e?(e.toLowerCase()+i.join("")).replace(/[-_](\w)/g,(t,r)=>r?r.toUpperCase():""):""}function Z(e){return e?g(w(e)):""}function J(e){const i=/[\\^$.*+?()[\]{}|]/g,n=RegExp(i.source);return e&&n.test(e)?e.replace(i,"\\$&"):e}function S(e){if(!Array.isArray(e)&&!u(e))return e;if(Array.isArray(e))return e.map(t=>S(t));const i=Object.keys(e).sort(),n={};return i.forEach(t=>{n[t]=S(e[t])}),n}function Y({primaryKey:e,list:i}){const n=new Map;i.forEach(r=>{const d=String(r[e]);n.has(d)||n.set(d,r)});const t=[];return n.forEach(r=>{t.push(r)}),t}function ee(e,i){if(!u)return e;const n={};for(const t in e)f(e,t)&&!i.includes(t)&&(n[t]=e[t]);return n}function ie({type:e,id:i,resource:n}){return new Promise((t,r)=>{if(!c||document.querySelector(i)){r();return}function d(a){a.addEventListener("load",t),a.addEventListener("error",r),a.addEventListener("abort",r)}switch(e){case"js":{const a=document.createElement("script");a.async=!0,a.src=n,d(a),document.head.appendChild(a);break}case"css":{const a=document.createElement("link");a.id=i,a.rel="stylesheet",a.href=n,d(a),document.head.appendChild(a);break}case"style":{const a=document.createElement("style");a.id=i,d(a),document.head.appendChild(a),a.appendChild(document.createTextNode(n));break}}})}function m(e){let i="";if(c){const{search:t}=window.location;i=t}if(typeof e=="string"&&e.startsWith("http")){const t=e.indexOf("?");i=t===-1?"":e.slice(t)}if(i.includes("#")){const t=i.indexOf("#");i=i.slice(0,t)}if(!i.length)return{};const n={};return i.slice(1).split("&").forEach(t=>{const[r,d]=t.split("=");n[r]=decodeURIComponent(d)}),n}function oe(e){const i=m(e),n={};return Object.keys(i).forEach(r=>{r!=="path"&&(n[r]=i[r])}),{path:i.path||"",params:n}}function ne(e,i){return m(i)[e]||""}function te(e){return u(e)?Object.keys(e).map(i=>`${i}=${encodeURIComponent(String(e[i]))}`).join("&"):""}function T(e=0,i=100,n="round"){return Math[n](Math.random()*(i-e)+e)}function re(e=10){const i="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let n="",t=e;const r=i.length;for(;t--;)n+=i[Math.random()*r|0];return n}function ae(){const e=T(0,1);return[!0,!1][e]}function le(e){if(!Array.isArray(e))return e;for(let i=e.length-1;i>0;i--){const n=Math.floor(Math.random()*(i+1)),t=e[i];e[i]=e[n],e[n]=t}return e}function se(){const e=T(0,p.length-1);return p[e]}function ce(e){return/^1[3456789]\d{9}$/.test(String(e))}function de(e){return/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(e)}function ue(e){return/https?:\/\/[\w-]+(\.[\w-]+){1,2}(\/[\w-]{3,6}){0,2}(\?[\w_]{4,6}=[\w_]{4,6}(&[\w_]{4,6}=[\w_]{4,6}){0,2})?/.test(e)}function fe(e){const i=/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,n=/^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;return i.test(e)||n.test(e)}function Me(e){return/^([1-9]{1})(\d{15}|\d{16}|\d{18})$/.test(e)}function he(e){return/^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/.test(e)}function pe(e){return/^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/.test(e)}function G(){try{return process.env.NODE_ENV}catch{return}}const ke=G();function h(e){try{return process.env.NODE_ENV===e}catch{return!1}}const We=h("development"),Se=h("test"),me=h("production");o.FileInfo=U,o.LocalStorage=B,o.SessionStorage=$,o.camelCase=w,o.capitalize=g,o.checkRuntimeEnv=h,o.clipboard=s,o.ellipsis=D,o.escapeRegExp=J,o.excludeFields=ee,o.extractNumber=V,o.extractQueryInfo=oe,o.formatAmount=q,o.getDataType=k,o.getPrefersColorScheme=Q,o.getQuery=ne,o.getRuntimeEnv=G,o.getUserAgent=l,o.hasKey=f,o.isAndroid=_,o.isBaidu=E,o.isBankCard=Me,o.isBrowser=c,o.isDark=L,o.isDesktop=v,o.isDevRuntime=We,o.isEmail=de,o.isIOS=y,o.isIPv4=he,o.isIPv6=pe,o.isIdCard=fe,o.isLight=z,o.isMob=ce,o.isMobile=K,o.isObject=u,o.isProdRuntime=me,o.isQQ=N,o.isQQBrowser=x,o.isQzone=F,o.isServer=C,o.isTestRuntime=Se,o.isUniApp=O,o.isUrl=ue,o.isWeibo=I,o.isWeixin=H,o.kebabCase=j,o.loadRes=ie,o.mobileDevicesRegExp=A,o.parseQuery=m,o.pascalCase=Z,o.randomBoolean=ae,o.randomNumber=T,o.randomString=re,o.randomUserAgent=se,o.runtimeEnv=ke,o.shuffle=le,o.sleep=R,o.sortKeys=S,o.stringifyQuery=te,o.unique=Y,o.userAgents=p,o.watchResize=X,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
(function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.Utils={}))})(this,function(o){"use strict";var Te=Object.defineProperty;var Ae=(o,s,l)=>s in o?Te(o,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[s]=l;var M=(o,s,l)=>(Ae(o,typeof s!="symbol"?s+"":s,l),l);const s={isSupported:typeof navigator>"u"?!1:Boolean(navigator.clipboard),async copy(e){if(!this.isSupported)return!1;const i=e.innerText||e.value;return await this.write(i)},async cut(e){return!this.isSupported||!await this.copy(e)?!1:(e.value="",!0)},async read(){return this.isSupported?await navigator.clipboard.readText():""},async write(e){return this.isSupported?(await navigator.clipboard.writeText(e),!0):!1}};function l(){return typeof window<"u"?navigator.userAgent.toLowerCase():""}const p=["Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.1.0; zh-cn; BLA-AL00 Build/HUAWEIBLA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/8.9 Mobile Safari/537.36","Mozilla/5.0 (Linux; U; Android 8.0.0; zh-CN; MHA-AL00 Build/HUAWEIMHA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.1.4.994 Mobile Safari/537.36","Mozilla/5.0 (Linux; Android 8.1; EML-AL00 Build/HUAWEIEML-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.143 Crosswalk/24.53.595.0 XWEB/358 MMWEBSDK/23 Mobile Safari/537.36 MicroMessenger/6.7.2.1340(0x2607023A) NetType/4G Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044207 Mobile Safari/537.36 MicroMessenger/6.7.3.1340(0x26070332) NetType/4G Language/zh_CN Process/tools","Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13","MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1","Mozilla/5.0 (Linux; Android 7.1.1; MI 6 Build/NMF26X; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/043807 Mobile Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043632 Safari/537.36 MicroMessenger/6.6.1.1220(0x26060135) NetType/WIFI Language/zh_CN","Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1","Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.110 Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 OPR/45.0.2552.888","Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.2.5 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.5","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 OPR/45.0.2552.812","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 5.1; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0","Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; Trident/5.0)","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0","Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36","Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7","Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"],c=typeof window<"u",C=!c,A=/iPhone|phone|android|iPod|pad|iPad/i;function K(){return c?A.test(l()):!1}function v(){return c?!K():!1}const _=/Android/i.test(l()),y=/iPhone|iPod|iPad|iOS/i.test(l()),O=/uni-app|html5plus/.test(l()),H=/MicroMessenger/i.test(l()),N=/\sQQ|mqqbrowser|qzone|qqbrowser/i.test(l()),x=/mqqbrowser|qqbrowser/i.test(l()),F=/qzone\/.*_qz_([\d.]+)/i.test(l()),I=/(weibo).*weibo__([\d.]+)/i.test(l()),E=/(baiduboxapp)\/([\d.]+)/i.test(l());function X(e,{immediate:i}={immediate:!0}){c&&(i&&window.addEventListener("load",e,!1),window.addEventListener("orientationchange"in window?"orientationchange":"resize",e,!1))}function k(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function u(e){return k(e)==="object"}function f(e,i){return u(e)?Object.prototype.hasOwnProperty.call(e,i):!1}const W={};class P{constructor(i){M(this,"data");this.data={};const n=f(W,i);this.data=n?W[i].data:{},n||(W[i]=this)}get length(){return Object.keys(this.data).length}clear(){this.data={}}getItem(i){return f(this.data,i)?this.data[i]:null}setItem(i,n){this.data[i]=n}removeItem(i){f(this.data,i)&&delete this.data[i]}key(i){const n=Object.keys(this.data);return i>n.length?null:n[i]}}class b{constructor(i,n){M(this,"prefix");M(this,"storage");this.prefix=i,this.storage=c?window[n]:new P(i)}get(i){const n=this.storage.getItem(`${this.prefix}-${i}`);if(!n)return n;try{return n==="true"?!0:n==="false"?!1:n==="null"?null:n==="undefined"?void 0:JSON.parse(n)}catch{return n}}set(i,n){try{const r=k(n)==="string"?n:JSON.stringify(n);this.storage.setItem(`${this.prefix}-${i}`,r)}catch(t){console.log(t)}}remove(i){this.storage.removeItem(`${this.prefix}-${i}`)}clear(){this.list().forEach(n=>{this.remove(n)})}count(){return this.list().length}list(){if(!this.prefix)return[];const i=[],n=this.storage.length;for(let t=0;t<n;t++){const r=this.storage.key(t);r!=null&&r.startsWith(this.prefix)&&i.push(r.replace(`${this.prefix}-`,""))}return i}}class B extends b{constructor(i){super(i,"localStorage")}}class $ extends b{constructor(i){super(i,"sessionStorage")}}function L(){return c?window.matchMedia("(prefers-color-scheme: dark)").matches:!1}function z(){return c?window.matchMedia("(prefers-color-scheme: light)").matches:!1}function Q(){if(L())return"dark";if(z())return"light"}function R(e){return new Promise(i=>{setTimeout(()=>{i()},e)})}class U{constructor(i){M(this,"mime");this.mime=i}getMimeType(i){try{return i.startsWith("data")&&i.includes("base64")?i.split(",")[0].replace(/data:(.*);base64/,"$1"):this.mime.getType(i)||""}catch{return""}}getExtensionFromMimeType(i){try{return this.mime.getExtension(i)||""}catch{return""}}getExtension(i){try{const n=this.getMimeType(i);return this.getExtensionFromMimeType(n)}catch{return""}}}function V(e,i=!1){return e=e?String(e):"",e=e.replace(/[^\d]/g,""),e&&!i&&(e=parseInt(e)),String(e)}function q(e){if(e=String(e),!e)return"0.00";const i=e.split("."),n=i[0],t=i[1];return i.length===1?`${n}.00`:t.length===1?`${e}0`:Number(e).toFixed(2)}function D(e,i){return String(e).length>i?String(e).slice(0,i)+" ...":String(e)}function g([e,...i]){return e?e.toUpperCase()+i.join(""):""}function j(e){return e?e.replace(/([A-Z])/g," $1").trim().split(" ").join("-").replace(/_/g,"-").toLowerCase():""}function w([e,...i]){return e?(e.toLowerCase()+i.join("")).replace(/[-_](\w)/g,(t,r)=>r?r.toUpperCase():""):""}function Z(e){return e?g(w(e)):""}function J(e){const i=/[\\^$.*+?()[\]{}|]/g,n=RegExp(i.source);return e&&n.test(e)?e.replace(i,"\\$&"):e}function S(e){if(!Array.isArray(e)&&!u(e))return e;if(Array.isArray(e))return e.map(t=>S(t));const i=Object.keys(e).sort(),n={};return i.forEach(t=>{n[t]=S(e[t])}),n}function Y({primaryKey:e,list:i}){const n=new Map;i.forEach(r=>{const d=String(r[e]);n.has(d)||n.set(d,r)});const t=[];return n.forEach(r=>{t.push(r)}),t}function ee(e,i){if(!u)return e;const n={};for(const t in e)f(e,t)&&!i.includes(t)&&(n[t]=e[t]);return n}function ie({type:e,id:i,resource:n}){return new Promise((t,r)=>{if(!c||document.querySelector(i)){r();return}function d(a){a.addEventListener("load",t),a.addEventListener("error",r),a.addEventListener("abort",r)}switch(e){case"js":{const a=document.createElement("script");a.id=i,a.async=!0,a.src=n,d(a),document.head.appendChild(a);break}case"css":{const a=document.createElement("link");a.id=i,a.rel="stylesheet",a.href=n,d(a),document.head.appendChild(a);break}case"style":{const a=document.createElement("style");a.id=i,d(a),document.head.appendChild(a),a.appendChild(document.createTextNode(n));break}}})}function m(e){let i="";if(c){const{search:t}=window.location;i=t}if(typeof e=="string"&&e.startsWith("http")){const t=e.indexOf("?");i=t===-1?"":e.slice(t)}if(i.includes("#")){const t=i.indexOf("#");i=i.slice(0,t)}if(!i.length)return{};const n={};return i.slice(1).split("&").forEach(t=>{const[r,d]=t.split("=");n[r]=decodeURIComponent(d)}),n}function oe(e){const i=m(e),n={};return Object.keys(i).forEach(r=>{r!=="path"&&(n[r]=i[r])}),{path:i.path||"",params:n}}function ne(e,i){return m(i)[e]||""}function te(e){return u(e)?Object.keys(e).map(i=>`${i}=${encodeURIComponent(String(e[i]))}`).join("&"):""}function T(e=0,i=100,n="round"){return Math[n](Math.random()*(i-e)+e)}function re(e=10){const i="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let n="",t=e;const r=i.length;for(;t--;)n+=i[Math.random()*r|0];return n}function ae(){const e=T(0,1);return[!0,!1][e]}function le(e){if(!Array.isArray(e))return e;for(let i=e.length-1;i>0;i--){const n=Math.floor(Math.random()*(i+1)),t=e[i];e[i]=e[n],e[n]=t}return e}function se(){const e=T(0,p.length-1);return p[e]}function ce(e){return/^1[3456789]\d{9}$/.test(String(e))}function de(e){return/^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/.test(e)}function ue(e){return/https?:\/\/[\w-]+(\.[\w-]+){1,2}(\/[\w-]{3,6}){0,2}(\?[\w_]{4,6}=[\w_]{4,6}(&[\w_]{4,6}=[\w_]{4,6}){0,2})?/.test(e)}function fe(e){const i=/^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,n=/^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;return i.test(e)||n.test(e)}function Me(e){return/^([1-9]{1})(\d{15}|\d{16}|\d{18})$/.test(e)}function he(e){return/^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/.test(e)}function pe(e){return/^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^::([\da-fA-F]{1,4}:){0,4}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){2}:([\da-fA-F]{1,4}:){0,2}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){4}:((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:$/.test(e)}function G(){try{return process.env.NODE_ENV}catch{return}}const ke=G();function h(e){try{return process.env.NODE_ENV===e}catch{return!1}}const We=h("development"),Se=h("test"),me=h("production");o.FileInfo=U,o.LocalStorage=B,o.SessionStorage=$,o.camelCase=w,o.capitalize=g,o.checkRuntimeEnv=h,o.clipboard=s,o.ellipsis=D,o.escapeRegExp=J,o.excludeFields=ee,o.extractNumber=V,o.extractQueryInfo=oe,o.formatAmount=q,o.getDataType=k,o.getPrefersColorScheme=Q,o.getQuery=ne,o.getRuntimeEnv=G,o.getUserAgent=l,o.hasKey=f,o.isAndroid=_,o.isBaidu=E,o.isBankCard=Me,o.isBrowser=c,o.isDark=L,o.isDesktop=v,o.isDevRuntime=We,o.isEmail=de,o.isIOS=y,o.isIPv4=he,o.isIPv6=pe,o.isIdCard=fe,o.isLight=z,o.isMob=ce,o.isMobile=K,o.isObject=u,o.isProdRuntime=me,o.isQQ=N,o.isQQBrowser=x,o.isQzone=F,o.isServer=C,o.isTestRuntime=Se,o.isUniApp=O,o.isUrl=ue,o.isWeibo=I,o.isWeixin=H,o.kebabCase=j,o.loadRes=ie,o.mobileDevicesRegExp=A,o.parseQuery=m,o.pascalCase=Z,o.randomBoolean=ae,o.randomNumber=T,o.randomString=re,o.randomUserAgent=se,o.runtimeEnv=ke,o.shuffle=le,o.sleep=R,o.sortKeys=S,o.stringifyQuery=te,o.unique=Y,o.userAgents=p,o.watchResize=X,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
{
"name": "@bassist/utils",
"version": "0.11.0",
"version": "0.11.1",
"description": "Opinionated collection of common JavaScript / TypeScript utils by @chengpeiquan .",

@@ -5,0 +5,0 @@ "author": "chengpeiquan <chengpeiquan@chengpeiquan.com>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc