ddan-js 2.10.9 → 2.10.10
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/bin/ddan-js.js +1 -1
- package/bin/ddan-js.mjs +1 -1
- package/package.json +1 -1
package/bin/ddan-js.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("crypto"),require("zlib"),require("net"),require("socks"),require("child_process"),require("fs")):"function"==typeof define&&define.amd?define(["exports","crypto","zlib","net","socks","child_process","fs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ddan=e.ddan||{},e.crypto$1,e.zlib,e.net,e.socks,e.child_process,e.fs)}(this,(function(e,t,r,n,s,i,o){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),l=a(r),u=a(n),f=a(o);const h="0123456789",d="abcdefghijklmnopqrstuvwxyz",p="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var g={keyNumber:h,keyLower:d,keyUpper:p,keyChars:h+d+p};const y=(e=0,t=0)=>{const r=g.keyChars.split(""),n=[];let s;if(t=t||r.length,e)for(s=0;s<e;s++)n[s]=r[0|Math.random()*t];else{let e;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",s=0;s<36;s++)n[s]||(e=0|16*Math.random(),n[s]=r[19==s?3&e|8:e])}return n.join("")};class m{__map;__tagList;__eventId="";constructor(){this.__map=new Map,this.__tagList=[],this.__eventId=y()}clear(){return this.__map.clear(),this}on(e,t,r=""){if(!e||!t)return this;let n=this.__map.get(e);return n||(n=new Set,this.__map.set(e,n)),n.add(t),r&&this.__tagList.push({name:e,listener:t,tag:r}),this}emit(e,...t){if(!e)return this;const r=this.__map.get(e);if(!r)return this;return[...r].forEach((e=>e&&e(...t))),this}off(e,t){if(!e||!t)return this;this.__tagList=this.__tagList.filter((r=>r.name!==e||r.listener!==t));const r=this.__map.get(e);return r?(r.delete(t),r.size<=0&&this.__map.delete(e),this):this}remove(e){return e?(this.__tagList=this.__tagList.filter((t=>t.name!==e)),this.__map.delete(e),this):this}removeByTag(e){if(!e)return this;return this.__tagList.filter((t=>t.tag===e)).forEach((e=>{this.off(e.name,e.listener)})),this.__tagList=this.__tagList.filter((t=>t.tag!==e)),this}once(e,t){const r=(...n)=>{t(...n),this.off(e,r)};return this.on(e,r),this}has(e){return this.__map.has(e)}}class b{timestamp=0;_key="";_value;constructor(e,t){this._key=e,this._value=t,this.updateAt()}get key(){return this._key}get value(){return this._value}set(e){this._value=e,this.updateAt()}updateAt(){this.timestamp=Date.now()}clear(){this.set(void 0)}}const w="object"==typeof global&&null!==global&&global.Object===Object&&global,_="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,v="object"==typeof self&&null!==self&&self.Object===Object&&self,x=_||w||v||Function("return this")(),A=x.Symbol,{toString:S,hasOwnProperty:k,propertyIsEnumerable:C}=Object.prototype,$=A?A.toStringTag:void 0;function j(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$&&$ in Object(e)?function(e){const t=k.call(e,$),r=e[$];let n=!1;try{e[$]=void 0,n=!0}catch(e){}const s=S.call(e);return n&&(t?e[$]=r:delete e[$]),s}(e):S.call(e)}var O={getTag:j,getType:function(e){return(j(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:S,hasOwnProperty:k,propertyIsEnumerable:C};const E="object"==typeof e&&null!==e&&!e.nodeType&&e,P=E&&"object"==typeof module&&null!==module&&!module.nodeType&&module,T=P&&P.exports===E&&w.process,q=(()=>{try{const e=P&&P.require&&P.require("util").types;return e||T&&T.binding&&T.binding("util")}catch(e){}})();var B="[object Function]",L="[object GeneratorFunction]",R="[object AsyncFunction]",F=9007199254740991;const U=/^(?:0|[1-9]\d*)$/,D=x?.Buffer?.isBuffer,I=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,M=q&&q.isTypedArray;function K(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function z(e){return null!=e&&"object"==typeof e}const N=Array.isArray;function H(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=F}(e.length)&&!W(e)}function V(e){return z(e)&&H(e)}function W(e){var t=K(e)?O.getTag(e):"";return t===B||t===L||t===R}function Z(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function Y(e){return V(e)&&O.hasOwnProperty.call(e,"callee")&&(!O.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==O.toString.call(e))}const J="undefined"!=typeof window&&void 0!==window.document,Q="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,G=M?e=>M(e):e=>z(e)&&I.test(O.getTag(e)),X="function"==typeof D?D:()=>!1;var ee={is:function(e,t){return O.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===O.getTag(e)},isString:function(e){return"string"==typeof e||!N(e)&&z(e)&&"[object String]"==O.getTag(e)},isObject:K,isObjectLike:z,isPlainObject:function(e){if(!z(e)||"[object Object]"!=O.getTag(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},isSymbol:function(e){return"symbol"==typeof e||z(e)&&"[object Symbol]"===O.getTag(e)},isFunction:W,isArray:N,isArrayLikeObject:V,isIndex:function(e,t){return!!(t=null==t?F:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:H,isPrototype:Z,isArguments:Y,isPromise:function(e){return"[object Promise]"===(K(e)?O.getTag(e):"")},isBrowser:J,isNode:Q,isBlobOrBuffer:e=>e instanceof Blob||e instanceof ArrayBuffer,isUint8Array:e=>e instanceof Uint8Array,isArrayBuffer:e=>e instanceof ArrayBuffer,isEmpty:e=>{if(null==e)return!0;if(H(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||X(e)||G(e)||Y(e)))return!e.length;const t=O.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(Z(e))return!Object.keys(e).length;for(const t in e)if(O.hasOwnProperty.call(e,t))return!1;return!0}};const te=NaN,re=/^\s+|\s+$/g,ne=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,ie=/^0o[0-7]+$/i,oe=parseInt,ae=1/0,ce=17976931348623157e292;function le(e){if("number"==typeof e)return e;if(ee.isSymbol(e))return te;if(ee.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=ee.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(re,"");const t=se.test(e);return t||ie.test(e)?oe(e.slice(2),t?2:8):ne.test(e)?te:+e}function ue(e){return e?(e=le(e))===ae||e===-ae?(e<0?-1:1)*ce:e==e?e:0:0===e?e:0}var fe={toNumber:le,toFinite:ue,toInteger:function(e){var t=ue(e),r=t%1;return t==t?r?t-r:t:0}};const he="Expected a function",de=Math.max,pe=Math.min;function ge(e,t=300,r={}){let n,s,i,o,a,c,l=0,u=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(he);function d(t){const r=n,i=s;return n=s=void 0,l=t,o=e.apply(i,r),o}function p(e){const r=e-c;return void 0===c||r>=t||r<0||f&&e-l>=i}function g(){const e=Date.now();if(p(e))return y(e);a=setTimeout(g,function(e){const r=t-(e-c);return f?pe(r,i-(e-l)):r}(e))}function y(e){return a=void 0,h&&n?d(e):(n=s=void 0,o)}function m(...e){const r=Date.now(),i=p(r);if(n=e,s=this,c=r,i){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),u?d(e):o}(c);if(f)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=fe.toNumber(t)||0,ee.isObject(r)&&(u=!!r.leading,f="maxWait"in r,i=f?de(fe.toNumber(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h),m.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=c=s=a=void 0},m.flush=function(){return void 0===a?o:y(Date.now())},m.pending=function(){return void 0!==a},m}class ye{__list=[];constructor(e){this.push(e)}push(e){return e&&this.__list.push(e),this}clear(){return this.__list=[],this}_exec(e,t){let r;if(ee.isFunction(e))r=e(t);else{if(ee.isPromise(e))return e.then((e=>({...t,...e})));r=e}return ee.isPromise(r)?r:Promise.resolve({...r,...t})}run(e){try{return this.__list.reduce(((e,t)=>e.then((e=>this._exec(t,e)))),Promise.resolve(e)).then((e=>[void 0,e])).catch((e=>[e,void 0]))}catch(e){return Promise.reject([e,void 0])}}}async function me(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const be=(e,t)=>{try{let r;return r=ee.isFunction(e)?e():e,me(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},we=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var _e={to:me,go:(e,t)=>be(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:be,toError:we,timeout:(e,t=0,r="timeout")=>{if(t<=0)return be(e);let n;function s(){n&&clearTimeout(n)}const i=new Promise((e=>{s(),n=setTimeout((()=>e([we(r||"timeout"),void 0])),t)}));return Promise.race([be(e,s),i])}};class ve{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var xe={singleton:function(){class e{static __instance__;constructor(){}static get Instance(){return e.__instance__||(e.__instance__=new this),e.__instance__}static get I(){return this.Instance}}return e},getset:function(e){const t=new ve;return void 0!==e&&t.set(e),t}};class Ae{_func;_callback;constructor(e,t){this._func=e,this._callback=t}async run(){return _e.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class Se{__list=[];__count=0;__max=1;constructor(e=1){this.__count=0,this.__max=e>0?e:1,this.clear()}push(e,t){const r=new Ae(e,t);return this.__list.push(r),this._step(),this}clear(){return this.__list=[],this.__count=0,this}_step(){if(this.__list.length<=0)return;if(this.__count>=this.__max)return;const e=this.__list.shift();e?(this.__count+=1,e?.run().finally((()=>{try{this.__count>0&&(this.__count-=1),this._step()}catch(e){console.error("[ddan] pipepine step finally",e)}}))):this._step()}async whenAll(){for(;;){if(this.__count<=0)break;await _e.delay(100),this._step()}return this.clear()}}class ke extends(xe.singleton()){__lockedMap=new Map;pipeline=new Se;constructor(){super()}lock(e,t){if(!e||!t)return;const r=_e.safeRun(t);return this.__lockedMap.set(e,r),r}unlock(e){e&&this.__lockedMap.has(e)&&this.__lockedMap.delete(e)}async exec(e,t){if(!e||!t)return _e.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return _e.safeRun(e);const s=await n;return this.unlock(t),s}}var Ce={toUtf8:e=>{if(!e)return"";const t=e.replace(/\r\n/g,"\n");let r="";for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r+=String.fromCharCode(n):n>127&&n<2048?(r+=String.fromCharCode(n>>6|192),r+=String.fromCharCode(63&n|128)):(r+=String.fromCharCode(n>>12|224),r+=String.fromCharCode(n>>6&63|128),r+=String.fromCharCode(63&n|128))}return r},fromUtf8:e=>{let t="",r=0;if(!e)return"";let n=0,s=0,i=0;for(;r<e.length;)n=e.charCodeAt(r),n<128?(t+=String.fromCharCode(n),r++):n>191&&n<224?(s=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&s),r+=2):(s=e.charCodeAt(r+1),i=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3);return t},toUtf8Bytes:e=>{if(!e)return new Uint8Array;const t=e.replace(/\r\n/g,"\n"),r=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r.push(n):n<2048?(r.push(n>>6|192),r.push(63&n|128)):(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128))}return new Uint8Array(r)},fromUtf8Bytes:e=>{let t="",r=0;if(!e||e.length<=0)return"";for(;r<e.length;){let n=e[r];if(n<128)t+=String.fromCharCode(n),r++;else if(n>191&&n<224){const s=e[r+1];t+=String.fromCharCode((31&n)<<6|63&s),r+=2}else{const s=e[r+1],i=e[r+2];t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3}}return t}};const $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var je={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=Ce.toUtf8(e);l<e.length;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+$e.charAt(s)+$e.charAt(i)+$e.charAt(o)+$e.charAt(a);return c},fromBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=$e.indexOf(e.charAt(l++)),i=$e.indexOf(e.charAt(l++)),o=$e.indexOf(e.charAt(l++)),a=$e.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c+=String.fromCharCode(t),64!=o&&(c+=String.fromCharCode(r)),64!=a&&(c+=String.fromCharCode(n));return c=Ce.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",l=0;if(!e||!ee.isArrayLike(e)||!ee.isUint8Array(e))return"";for(;l<e.length;)t=e[l++],r=e[l++],n=e[l++],s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+$e.charAt(s)+$e.charAt(i)+$e.charAt(o)+$e.charAt(a);return c},base64ToBytes:(e="")=>{let t,r,n,s,i,o,a,c=[],l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=$e.indexOf(e.charAt(l++)),i=$e.indexOf(e.charAt(l++)),o=$e.indexOf(e.charAt(l++)),a=$e.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c.push(t),64!=o&&c.push(r),64!=a&&c.push(n);return new Uint8Array(c)}};function Oe(e){return Math.floor(Math.random()*e)}function Ee(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Pe=180/Math.PI;var Te={random:Oe,randomRange:function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},lerp:function(e,t,r){return e*(1-r)+t*r},randoms:function(e,t=1,r=!1){const n=[];for(;;){if(n.length>=t)break;if(!r&&n.length>=e)break;const s=Oe(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:Ee,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=Ee(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Pe},degree2radian:function(e){return e/Pe},calcDataSize:function(e){const t={gb:0,mb:0,kb:0,b:0,total:e,desc:""},r=[{name:"gb",divisor:1<<30},{name:"mb",divisor:1<<20},{name:"kb",divisor:1024},{name:"b",divisor:1}];for(const n of r){const r=Math.floor(e/n.divisor);t[n.name]=r,e-=r*n.divisor}return t.gb>0?t.desc=(t.gb+t.mb/1024).toFixed(2)+"GB":t.mb>0?t.desc=(t.mb+t.kb/1024).toFixed(2)+"MB":t.kb>0?t.desc=(t.kb+t.b/1024).toFixed(2)+"KB":t.desc=t.b+"B",t}};var qe={bytes2str:e=>{if(!e||!ee.isArrayLike(e))return"";return e.reduce(((e,t)=>e+String.fromCharCode(t)),"")},str2bytes:(e="")=>{const t=e,r=new Uint8Array(t.length);for(let e=0,n=t.length;e<n;e++)r[e]=t.charCodeAt(e);return r},str2hex:e=>{let t="";for(let r=0;r<e.length;r++)t+=e.charCodeAt(r).toString(16).padStart(2,"0");return t},hex2str:e=>{let t="";for(let r=0;r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},concatBytes:(...e)=>{const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r},uint32ToBytes:e=>{const t=new Uint8Array(8);return t[0]=e[0]>>>24&255,t[1]=e[0]>>>16&255,t[2]=e[0]>>>8&255,t[3]=255&e[0],t[4]=e[1]>>>24&255,t[5]=e[1]>>>16&255,t[6]=e[1]>>>8&255,t[7]=255&e[1],t},bytesToUint32:e=>{const t=new Uint32Array(2);return t[0]=e[0]<<24|e[1]<<16|e[2]<<8|e[3],t[1]=e[4]<<24|e[5]<<16|e[6]<<8|e[7],t},hex2bytes:e=>{let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++)t[r]=parseInt(e.substr(2*r,2),16);return t},bytes2hex:e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""),toUint32:e=>{const t=Math.ceil(e.length/4),r=new Uint32Array(t);for(let n=0;n<t;n++)r[n]=e.charCodeAt(4*n)<<24|e.charCodeAt(4*n+1)<<16|e.charCodeAt(4*n+2)<<8|e.charCodeAt(4*n+3);return r},fromUint32:e=>{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]>>>24&255,e[r]>>>16&255,e[r]>>>8&255,255&e[r]);return t.replace(/\0+$/,"")},flatten:function e(t,r=!1,n=[]){for(let s=0;s<t.length;s+=1){const i=t[s];r&&Array.isArray(i)?e(i,r,n):n.push(i)}return n}};var Be={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return qe.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};function Le(e,t){return e<<t|e>>>32-t}function Re(e,t){let r,n,s,i,o;return s=2147483648&e,i=2147483648&t,r=1073741824&e,n=1073741824&t,o=(1073741823&e)+(1073741823&t),r&n?2147483648^o^s^i:r|n?1073741824&o?3221225472^o^s^i:1073741824^o^s^i:o^s^i}function Fe(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return e&t|~e&r}(t,r,n),s),o)),Re(Le(e,i),t)}function Ue(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return e&r|t&~r}(t,r,n),s),o)),Re(Le(e,i),t)}function De(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return e^t^r}(t,r,n),s),o)),Re(Le(e,i),t)}function Ie(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return t^(e|~r)}(t,r,n),s),o)),Re(Le(e,i),t)}function Me(e){let t,r,n="",s="";for(r=0;r<=3;r++)t=e>>>8*r&255,s="0"+t.toString(16),n+=s.substr(s.length-2,2);return n}function Ke(e){let t,r,n,s,i,o,a,c,l,u=[];for(u=function(e){let t;const r=e.length,n=r+8,s=16*((n-n%64)/64+1),i=Array(s-1).fill(0);let o=0,a=0;for(;a<r;)t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|e[a]<<o,a++;return t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|128<<o,i[s-2]=r<<3,i[s-1]=r>>>29,i}(e),o=1732584193,a=4023233417,c=2562383102,l=271733878,t=0;t<u.length;t+=16)r=o,n=a,s=c,i=l,o=Fe(o,a,c,l,u[t+0],7,3614090360),l=Fe(l,o,a,c,u[t+1],12,3905402710),c=Fe(c,l,o,a,u[t+2],17,606105819),a=Fe(a,c,l,o,u[t+3],22,3250441966),o=Fe(o,a,c,l,u[t+4],7,4118548399),l=Fe(l,o,a,c,u[t+5],12,1200080426),c=Fe(c,l,o,a,u[t+6],17,2821735955),a=Fe(a,c,l,o,u[t+7],22,4249261313),o=Fe(o,a,c,l,u[t+8],7,1770035416),l=Fe(l,o,a,c,u[t+9],12,2336552879),c=Fe(c,l,o,a,u[t+10],17,4294925233),a=Fe(a,c,l,o,u[t+11],22,2304563134),o=Fe(o,a,c,l,u[t+12],7,1804603682),l=Fe(l,o,a,c,u[t+13],12,4254626195),c=Fe(c,l,o,a,u[t+14],17,2792965006),a=Fe(a,c,l,o,u[t+15],22,1236535329),o=Ue(o,a,c,l,u[t+1],5,4129170786),l=Ue(l,o,a,c,u[t+6],9,3225465664),c=Ue(c,l,o,a,u[t+11],14,643717713),a=Ue(a,c,l,o,u[t+0],20,3921069994),o=Ue(o,a,c,l,u[t+5],5,3593408605),l=Ue(l,o,a,c,u[t+10],9,38016083),c=Ue(c,l,o,a,u[t+15],14,3634488961),a=Ue(a,c,l,o,u[t+4],20,3889429448),o=Ue(o,a,c,l,u[t+9],5,568446438),l=Ue(l,o,a,c,u[t+14],9,3275163606),c=Ue(c,l,o,a,u[t+3],14,4107603335),a=Ue(a,c,l,o,u[t+8],20,1163531501),o=Ue(o,a,c,l,u[t+13],5,2850285829),l=Ue(l,o,a,c,u[t+2],9,4243563512),c=Ue(c,l,o,a,u[t+7],14,1735328473),a=Ue(a,c,l,o,u[t+12],20,2368359562),o=De(o,a,c,l,u[t+5],4,4294588738),l=De(l,o,a,c,u[t+8],11,2272392833),c=De(c,l,o,a,u[t+11],16,1839030562),a=De(a,c,l,o,u[t+14],23,4259657740),o=De(o,a,c,l,u[t+1],4,2763975236),l=De(l,o,a,c,u[t+4],11,1272893353),c=De(c,l,o,a,u[t+7],16,4139469664),a=De(a,c,l,o,u[t+10],23,3200236656),o=De(o,a,c,l,u[t+13],4,681279174),l=De(l,o,a,c,u[t+0],11,3936430074),c=De(c,l,o,a,u[t+3],16,3572445317),a=De(a,c,l,o,u[t+6],23,76029189),o=De(o,a,c,l,u[t+9],4,3654602809),l=De(l,o,a,c,u[t+12],11,3873151461),c=De(c,l,o,a,u[t+15],16,530742520),a=De(a,c,l,o,u[t+2],23,3299628645),o=Ie(o,a,c,l,u[t+0],6,4096336452),l=Ie(l,o,a,c,u[t+7],10,1126891415),c=Ie(c,l,o,a,u[t+14],15,2878612391),a=Ie(a,c,l,o,u[t+5],21,4237533241),o=Ie(o,a,c,l,u[t+12],6,1700485571),l=Ie(l,o,a,c,u[t+3],10,2399980690),c=Ie(c,l,o,a,u[t+10],15,4293915773),a=Ie(a,c,l,o,u[t+1],21,2240044497),o=Ie(o,a,c,l,u[t+8],6,1873313359),l=Ie(l,o,a,c,u[t+15],10,4264355552),c=Ie(c,l,o,a,u[t+6],15,2734768916),a=Ie(a,c,l,o,u[t+13],21,1309151649),o=Ie(o,a,c,l,u[t+4],6,4149444226),l=Ie(l,o,a,c,u[t+11],10,3174756917),c=Ie(c,l,o,a,u[t+2],15,718787259),a=Ie(a,c,l,o,u[t+9],21,3951481745),o=Re(o,r),a=Re(a,n),c=Re(c,s),l=Re(l,i);return Me(o)+Me(a)+Me(c)+Me(l)}const ze=e=>{if("string"!=typeof e&&!(e instanceof Uint8Array))return"";return Ke("string"==typeof e?Ce.toUtf8Bytes(e):e)};var Ne={md5:ze,md5Base64:e=>{const t=ze(e);if(!t)return"";const r=qe.hex2bytes(t);return je.bytesToBase64(r)}};const He=(e,t=!1)=>{const r=new Uint8Array(e);return t?je.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Ve={...qe,...Be,...Ce,...je,...Ne,str2ab:(e="",t=!1)=>{if(t)return je.base64ToBytes(e).buffer;{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0,n=e.length;t<n;t++)r[t]=e.charCodeAt(t);return t}},ab2str:He,utf8ToBase64:e=>ee.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>ee.isBrowser?atob(e):Buffer.from(e,"base64").toString("utf-8"),getRandomBytes:e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=Te.random(256);return t},textEncode:e=>Ce.toUtf8Bytes(e),textDecode:e=>Ce.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+je.toBase64(e):ee.isArrayBuffer(e)?`data:${t};base64,`+He(e,!0):"":""};const We=e=>{try{const t=Ve.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},Ze=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Ye={RSAPublicKey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApiLWsPmoaiGdr02AmPYS\n4/VgxyJNNJSK2VICirXl4P8qAP3b/6GIs7Hwnsmmuj7gledJ0XiZodFjDNgQEZEG\nj4K9KX8NixcrJwnTQV5UebiERdj+64ihwqPVWo9dIOj43ZPJ8f4dritJv5tnQaBb\nb9zTkU3Ofzk1g8RU00Ith6quOGZcU2IWC4OQ+5YiZvzrCBKEvjFwK2OvGq43tI51\nGaZdI9H09jisypqefsMvv6esjEQQOtl+WGlI5fof7KZUt3dppvuDI4CYgeXIoKKL\n9T9qDl8F9aNSs3XHx32YyA7L1FraFD6PjqRjueIFp2emsXQcIMeMqqgVyV+4qb+0\nuwIDAQAB",RSAPrivateKey:"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmItaw+ahqIZ2v\nTYCY9hLj9WDHIk00lIrZUgKKteXg/yoA/dv/oYizsfCeyaa6PuCV50nReJmh0WMM\n2BARkQaPgr0pfw2LFysnCdNBXlR5uIRF2P7riKHCo9Vaj10g6Pjdk8nx/h2uK0m/\nm2dBoFtv3NORTc5/OTWDxFTTQi2Hqq44ZlxTYhYLg5D7liJm/OsIEoS+MXArY68a\nrje0jnUZpl0j0fT2OKzKmp5+wy+/p6yMRBA62X5YaUjl+h/splS3d2mm+4MjgJiB\n5cigoov1P2oOXwX1o1KzdcfHfZjIDsvUWtoUPo+OpGO54gWnZ6axdBwgx4yqqBXJ\nX7ipv7S7AgMBAAECggEAE1kuWLkSsJ2OoDpt9iJ+a7cJmNd5V1zPWOTwr9fkWFJP\nQYNPKlPVOFxKUivY84rcHAkuMyuQ9OQOXZISOQGDWpZW0mzeFmtR1r+Rr2S9gNmI\n6huOAL9OW306HUxiA7GuPhv2omy+Zyjac2q1WVLEI2B78Um2+WEfxuNIH7xu0gRR\nz/wluevMBQlv6hSeMESP6e9s2kB+FuM4bL7+1sexwS1TudKbHybujaiB8un9E2V3\nC9BkE6yf00Rhvii6Q4E4w3PFQfcBEFnjOD0S2Watx8GIbYjlYvtquy8Yj7OtyZB6\nw5sxyaYhKVVnkpGAbOgaCj94ABYF47VuwXr45I4PzQKBgQDp6svzD+QKlARjcWgO\nrH7UEpFX6m49G6Ib4c63xEg9+GesTgfDxoYxtXDKsC7I8OwMrmffJGbyfjaAvzmg\nicM3Y7kF6UPO9+q2mBRsyhoJSNONTeUVyoFSc+QDsVgndlTZIjqC5XLrONGaSPLJ\n7jJzqKhp3NQcpO8+xY0d7Efm1QKBgQC10fCNuF1LUTYgsWvvGxTiCCAIBurZmHU+\nGMb2Okfoco/P+QNl1jEba91AC7FudW3g/lRn0vTnDajlNoz2/CKunrTKN4/9lEBI\ntiwEOvhc5FtapRifSfrrNwFqPM+LijvOkcteWVhAUWCEP1eLmpnXGqfmZxnTaaVe\n5DyDgyAVTwKBgQDhEawfOQEANJ9sV2f6BnsZ7quuXcCoR3hZP5G5O8EO735BSesq\nsk/YcG4QeCjr6vQU15LWH552YH5srpHyJ9uP5gHW8DTwZZaPDhFJA8S9fjcfVP3B\nU9HO1fdknjTl83N8YPTPkZpbPZZfzyTcqrYclwFEqtfkn8YbLdW0Hu6n6QKBgDEv\njvS3uD1ExfDILlurptWSvx+Mx4F/1c+roj8/+u3t9+uaAIpPDE/PuTW3NBOens/r\n3WeM0QWkU1lWjYHPKY61jlDaARDnRxCkf3nRfhibCf+Wg/erar6wzagwtTCZf55d\nIHfwkYgsu4BrJkK02wMuydbxczIW9U6bTaeCFG7PAoGAN3oHYzTEBwZ7ZKv11QiQ\nEp/HeHBvD8fH/e1uVyBel4Co7NO5pV2s8qjS8+3+jxumKLNXCirjqwHo03YCdzxi\ncy4GFDsukHmDQ7FF9VC4QV0fJ0F7jGYE9nNZ+K9qwS5KrihOSBPxj0HptrF6TSOw\nBTSwr0byL3TC0m0StkSNKpo=",generateKeys:async e=>{try{const t=await e.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!0,["encrypt","decrypt"]),r=await window.crypto.subtle.exportKey("spki",t.publicKey),n=We(r),s=Ze(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=We(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:Ze(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:Ze,format_pem_content:We,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Ve.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),i=[];for(let t=0;t<n.length;t+=190){let r=n.slice(t,t+190),o=await e.encrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(o))}const o=Ve.concatBytes(...i);return Ve.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Ve.base64ToBytes(t),s=await e.importKey("pkcs8",Ve.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["decrypt"]),i=[],o=256;for(let t=0;t<n.length;t+=o){let r=n.slice(t,t+o),a=await e.decrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(a))}const a=Ve.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const Je=()=>c.default.webcrypto.subtle;var Qe={generateKeys:()=>Ye.generateKeys(Je()),encrypt:async(e,t)=>Ye.encrypt(Je(),e,t),decrypt:async(e,t)=>Ye.decrypt(Je(),e,t),encode:async e=>Ye.encrypt(Je(),e,Ye.RSAPublicKey),decode:async e=>Ye.decrypt(Je(),e,Ye.RSAPrivateKey)};const Ge="undefined"!=typeof window?window.crypto.subtle:{};var Xe={generateKeys:()=>Ye.generateKeys(Ge),encrypt:async(e,t)=>Ye.encrypt(Ge,e,t),decrypt:async(e,t)=>Ye.decrypt(Ge,e,t),encode:async e=>Ye.encrypt(Ge,e,Ye.RSAPublicKey),decode:async e=>Ye.decrypt(Ge,e,Ye.RSAPrivateKey)};const et=2654435769,tt=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+et>>>0,e[0]=e[0]+((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,e[1]=e[1]+((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0;return e},rt=(e,t)=>{let r=3337565984;for(let n=0;n<32;n++)e[1]=e[1]-((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0,e[0]=e[0]-((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,r=r-et>>>0;return e},nt=e=>{const t=Ve.str2bytes(e),r=new Uint32Array(4);return r[0]=t[0]<<24|t[1]<<16|t[2]<<8|t[3],r[1]=t[4]<<24|t[5]<<16|t[6]<<8|t[7],r[2]=t[8]<<24|t[9]<<16|t[10]<<8|t[11],r[3]=t[12]<<24|t[13]<<16|t[14]<<8|t[15],r},st=(e,t)=>{const r=Ve.pkcs7Padding(e,8),n=nt(t),s=[];for(let e=0;e<r.length;e+=8){const t=Ve.bytesToUint32(r.slice(e,e+8)),i=tt(t,n);s.push(Ve.uint32ToBytes(i))}return Ve.concatBytes(...s)},it=(e,t)=>{const r=nt(t),n=[];for(let t=0;t<e.length;t+=8){const s=Ve.bytesToUint32(e.slice(t,t+8)),i=rt(s,r);n.push(Ve.uint32ToBytes(i))}const s=Ve.concatBytes(...n);return Ve.pkcs7Unpadding(s)};var ot={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:tt,decrypt:rt,toTeaKey:nt,encode:(e,t)=>{const r=Ve.textEncode(e),n=st(r,t);return Ve.bytesToBase64(n)},decode:(e,t)=>{const r=Ve.base64ToBytes(e),n=it(r,t);return Ve.textDecode(n.buffer)},encodeBytes:st,decodeBytes:it};function at(e,t,r){const{length:n}=e;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){let n=null==e?0:e.length;if(!n)return[];(t=null==t?0:t)<0&&(t=-t>n?0:n+t),(r=(r=void 0===r?n:r)>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;let s=-1;const i=new Array(n);for(;++s<n;)i[s]=e[s+t];return i}(e,t,r)}const ct=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function lt(e){return ct.test(e)}const ut="\\ud800-\\udfff",ft=`[${ut}]`,ht="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",dt="\\ud83c[\\udffb-\\udfff]",pt=`[^${ut}]`,gt="(?:\\ud83c[\\udde6-\\uddff]){2}",yt="[\\ud800-\\udbff][\\udc00-\\udfff]",mt=`${`(?:${ht}|${dt})`}?`,bt="[\\ufe0e\\ufe0f]?",wt=bt+mt+`(?:\\u200d(?:${[pt,gt,yt].join("|")})${bt+mt})*`,_t=`(?:${[`${pt}${ht}?`,ht,gt,yt,ft].join("|")})`,vt=RegExp(`${dt}(?=${dt})|${_t+wt}`,"g");function xt(e){return lt(e)?function(e){return e.match(vt)||[]}(e):function(e){return e.split("")}(e)}function At(e){return t=>{if(!t)return"";const r=lt(t)?xt(t):void 0,n=r?r[0]:t[0],s=r?at(r,1).join(""):t.slice(1);return n[e]()+s}}const St="\\ud800-\\udfff",kt="\\u2700-\\u27bf",Ct="a-z\\xdf-\\xf6\\xf8-\\xff",$t="A-Z\\xc0-\\xd6\\xd8-\\xde",jt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ot="['’]",Et=`[${jt}]`,Pt=`[${kt}]`,Tt=`[${Ct}]`,qt=`[^${St}${jt+"\\d"+kt+Ct+$t}]`,Bt="(?:\\ud83c[\\udde6-\\uddff]){2}",Lt="[\\ud800-\\udbff][\\udc00-\\udfff]",Rt=`[${$t}]`,Ft=`(?:${Tt}|${qt})`,Ut=`(?:${Rt}|${qt})`,Dt=`(?:${Ot}(?:d|ll|m|re|s|t|ve))?`,It=`(?:${Ot}(?:D|LL|M|RE|S|T|VE))?`,Mt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Kt="[\\ufe0e\\ufe0f]?",zt=Kt+Mt+`(?:\\u200d(?:${[`[^${St}]`,Bt,Lt].join("|")})${Kt+Mt})*`,Nt=`(?:${[Pt,Bt,Lt].join("|")})${zt}`,Ht=RegExp([`${Rt}?${Tt}+${Dt}(?=${[Et,Rt,"$"].join("|")})`,`${Ut}+${It}(?=${[Et,Rt+Ft,"$"].join("|")})`,`${Rt}?${Ft}+${Dt}`,`${Rt}+${It}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Nt].join("|"),"g");const Vt=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/),Wt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Zt(e,t){if(void 0===t){const t=Vt(e)?function(e){return e.match(Ht)}(e):function(e){return e.match(Wt)}(e);return t||[]}return e.match(t)||[]}function Yt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Yt(e)))}`;if(ee.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Jt=At("toUpperCase"),Qt=At("toLowerCase");var Gt={toString:Yt,startCase:e=>Zt(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Jt(t)),""),snakeCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Jt(t):t))),""),upperCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Jt,lowerCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Qt,splitOnFirst:(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===e||""===t)return[];const r=e.indexOf(t);return-1===r?[]:[e.slice(0,r),e.slice(r+t.length)]},parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{let n=e;return e&&"string"==typeof e?(t&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?n=Number(e):!r||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(n="true"===e.toLowerCase()),n):n},replace:(e,t)=>{if(!e)return e;if(!t)return e;let r=e;return((Array.isArray(t)?t:[t])||[]).forEach((e=>{e.key&&e.value&&(r=r.replace(new RegExp(e.key,e.flag||""),e.value))})),r},jsonFormat:e=>{try{if(!e)return"";const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(t){return e}},toLines:(e,t="\n")=>e?e.split(t).map((e=>e.trim())).filter((e=>!!e)):[]};var Xt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":ot.encode(t,Ve.hex2str(ot.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=ot.decode(e,Ve.hex2str(ot.TEAKey));return Gt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return ee.isBrowser?await Xe.encode(t):await Qe.encode(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=ee.isBrowser?await Xe.decode(e):await Qe.decode(e);return Gt.jsonFormat(t)}catch(e){return""}}};const er=(e,t,r)=>e*(1-r)+t*r,tr=(e,t,r)=>e===t?0:(r-e)/(t-e),rr=(e,t,r)=>({x:er(e.x,t.x,r),y:er(e.y,t.y,r)}),nr=(e,t,r,n)=>{const s=rr(e,t,n),i=rr(t,r,n);return rr(s,i,n)},sr=(e,t)=>{if(1===e.length)return e[0];const r=[];for(let n=0;n<e.length-1;n++)r.push({x:(1-t)*e[n].x+t*e[n+1].x,y:(1-t)*e[n].y+t*e[n+1].y});return sr(r,t)},ir=(e,t)=>{if(0===t||t===e)return 1;let r=1;for(let n=1;n<=t;n++)r=r*(e-n+1)/n;return r};var or={bezier1:rr,bezier2:nr,bezier3:(e,t,r,n,s)=>{const i=nr(e,t,r,s),o=nr(t,r,n,s);return rr(i,o,s)},bezier:sr,bezierCurve:(e,t)=>{const r=e.length-1;let n=0,s=0;for(let i=0;i<=r;i++){const o=ir(r,i)*Math.pow(1-t,r-i)*Math.pow(t,i);n+=o*e[i].x,s+=o*e[i].y}return{x:n,y:s}},lerp:er,lerpAverage:(e,t,r="")=>{if(e.length<=0)return 0;if(1===e.length)return e[0].x;if(2===e.length)return er(e[0].y,e[1].y,.5);const n=[],s=e.slice().sort(((e,t)=>e.x-t.x)),i=s.length,o=s[0].x,a=s[i-1].x;for(let e=o;e<=a;e+=t){let t=0;for(let n=0;n<i-1;n++){const i=s[n],o=s[n+1];if(e>=i.x&&e<=o.x){if("lerp"===r){const r=tr(i.x,o.x,e);t=rr(i,o,r).y}else t=i.y;break}}e>s[i-1].x&&(t=s[i-1].y),n.push(t)}return n.reduce(((e,t)=>e+t),0)/n.length},proportion:tr};var ar={..._e,...Xt,...or,sleep:_e.delay,run:async function(e,t=0){if(t<=0)return _e.safeRun(e);const r=t>0?Date.now():0,n=await _e.safeRun(e),s=Date.now()-r;return s<t&&await _e.delay(t-s),n},exec:(e,t="")=>ke.I.exec(e,t),debounce:ge,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return ee.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),ge(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new ye(e),mutex:function(e){var t=null;return async function(...r){if((t=this||t||{}).__ddMutex)return!1;t.__ddMutex=!0;try{e&&await Promise.resolve(e.apply(this,r))}catch(e){console.log(e)}finally{t.__ddMutex=!1}}},polling:async function(e={}){const{func:t,interval:r=100,times:n=1e3}=e;let s=n;const i=r<1?100:r;do{if(!t)break;const[e,r]=await _e.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await _e.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>ke.I.pipeline.push(e,t),pipeline:(e=1)=>new Se(e),safeTask:(e,t)=>new Ae(e,t)};const cr=e=>{if(!e)return e;if("object"!=typeof e)return e;const t=Array.isArray(e)?[]:{};for(const r in e)e.hasOwnProperty(r)&&(t[r]=cr(e[r]));return t};const lr=(e,t,r={})=>{const n=e||{},{ignoreUndefined:s=!0,cover:i=!1}=r;if(!t)return n;for(const o in t){if(!t.hasOwnProperty(o))continue;const a=t[o];"object"!=typeof a||"object"!=typeof e[o]||i?s&&void 0===a||r.ignoreNull&&null===a||r.ignoreZero&&0===a||r.ignoreEmptyArray&&Array.isArray(a)&&a.length<=0||r.ignoreEmptyString&&"string"==typeof a&&""===a.trim()||(n[o]=a):n[o]=ur(e[o],a,r)}return n},ur=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?lr(e,t,r):lr({...e},t,r),n},fr=(e,t,r={})=>lr({...e},t,{cover:!0,...r}),hr=(e,t,r,n,s=!1)=>{if(!e||!t||!r)return;let i=e[t];null!==i&&"object"==typeof i&&s&&Object.keys(i).forEach((e=>{hr(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&hr(e,t,r,n,s)},get:()=>i})};var dr={copy:(e,t={})=>{if(void 0===e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0}=t;if((!n||n.length<=0)&&!s)return r;const o={};for(const e in r){if(!r.hasOwnProperty(e))continue;const a=s?i&&e.startsWith("_")?e:Gt.camelCase(e):e;if(n.length>0&&!n.includes(e)&&!n.includes(a))continue;const c=r[e];t.ignoreNull&&null===c||(t.ignoreZero&&0===c||t.ignoreEmptyArray&&Array.isArray(c)&&c.length<=0||t.ignoreEmptyString&&"string"==typeof c&&""===c.trim()||(o[a]=c))}return o},clone:cr,merge:ur,isEmpty:e=>0!==e&&(!e||"object"==typeof e&&(Array.isArray(e)?!e.length:Object.keys(e).length<=0)),parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{if(!e&&"object"!=typeof e)return e;for(const[n,s]of Object.entries(e))if("object"==typeof s&&null!==s)for(const[e,n]of Object.entries(s))s[e]=Gt.parseValue(n,{number:t,boolean:r});else e[n]=Gt.parseValue(s,{number:t,boolean:r});return e},cloneClass:function(e){return e?"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e)):e},combine:fr,combines:(e,t={})=>{let r={};if(!e||e.length<=0)return r;const{ignoreUndefined:n=!0,ignoreNull:s=!0,ignoreZero:i=!0,ignoreEmptyArray:o=!0,ignoreEmptyString:a=!0,cover:c=!0}=t;return e.forEach((e=>r=fr(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:hr,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};const pr=function(e,{sep:t="&",eq:r="=",max:n=1e3,multiple:s=!0,uri:i=!0,parseNumber:o=!1,parseBoolean:a=!1}={}){t=t||"&",r=r||"=";const c={};if("string"!=typeof e||0===e.length)return c;const l=/\+/g,u=n||1e3;let f=(e=e.split(t)).length;u>0&&f>u&&(f=u);for(let t=0;t<f;++t){let n,o,a,u,f=e[t].replace(l,"%20"),h=f.indexOf(r);h>=0?(n=f.substr(0,h),o=f.substr(h+1)):(n=f,o=""),a=i?decodeURIComponent(n):n,u=i?decodeURIComponent(o):o,O.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(u):c[a]=[c[a],u]:c[a]=u}return dr.parseValue(c,{number:o,boolean:a}),c},gr=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},yr=function(e,t=!0){return t?encodeURIComponent(e):e},mr=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},br=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,wr=e=>{const t=(e||"").replace(/\\/g,"/").split("?")[0],r=t.match(/[\/]?([\w\_\-]+)[.]?[\w]*[?]?$/),n=r?r[1]:"",s=t.lastIndexOf("/")+1,i=t.substring(s),o=i.lastIndexOf("."),a=i.substring(0,o)||"",c=o>=0?i.substring(o):"";return{route:t.substring(0,s)||"",page:n,name:i,withoutExtension:a,extname:c}},_r=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(br);if(!r||r.length<4)return t;const n=r[3]||"",s=e.split("?");return t.url=s[0],t.origin=r[0],t.protocol=`${r[1]}:`,t.host=`${r[2]}${n?":"+n:""}`,t.port=n,t.query=s.length>1?s[1]:"",t},vr=(e,t)=>{if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var xr={parse:pr,stringify:function(e,{sep:t="&",eq:r="=",name:n=null,uri:s=!0,cleanZero:i=!1,cleanNull:o=!1,cleanWhitespace:a=!1}={}){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(n){const c=yr(gr(n),s)+r,l=e[n];return Array.isArray(l)?l.map((function(e){return c+yr(gr(e),s)})).join(t):mr(l,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+yr(gr(l),s)})).filter(Boolean).join(t):n?yr(gr(n),s)+r+yr(gr(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=_r(e),{origin:r="",url:n="",query:s=""}=t,i=wr(n),o=pr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:wr,parseHost:_r,join:(...e)=>{const t=[];let r=!1;return e.forEach((e=>{const n=e.trim();if(""===n)return;if(/^(\w+):\/\//.test(n))return t.length=0,t.push(n),void(r=!0);n.split("/").forEach((e=>{"."!==e&&""!==e&&(".."===e?t.length>0&&".."!==t[t.length-1]?t.pop():r||t.push(".."):t.push(e))}))})),t.join("/")},shExpMatch:vr,isLocalIpAddress:e=>!!e&&!!(vr(e,"127.0.0.1")||vr(e,"localhost")||vr(e,"192.168.*.*")),parseFileUrl:e=>{const t={href:e,file:"",url:"",protocol:"",host:"",query:"",params:{}};if(!e)return t;let r=e?e.replace(/\\/g,"/"):"";r.startsWith("file://")&&!r.startsWith("file:///")?r="file:///"+r.slice(7):r.startsWith("file:/")&&!r.startsWith("file:///")&&(r="file:///"+r.slice(6));const n=r.match(/^file:\/\/(?:([^\/\\]+))?(\/.*)?$/);if(!n||n.length<3)return t;t.protocol="file:";const s=n[1]||"",i=n[2]||"";t.host=s;const o=i.split("?");return t.url=t.protocol+`//${t.host}`+o[0],t.file=o[0],t.query=o.length>1?o[1]:"",t.params=pr(t.query,{multiple:!0,uri:!1}),t}};class Ar{_loopTimer;_event=new m;started=!1;interval=0;constructor(e=0){this.interval=e||500}start(){return this.started||(this.stop(),this._loopTimer=setInterval((()=>{this._handleLoop()}),this.interval),this.started=!0),this}stop(){return this._loopTimer?(clearInterval(this._loopTimer),this._loopTimer=0,this.started=!1,this):this}restart(){return this.stop(),this.start(),this}on(e){return this._event.on("frame",e),this}off(e){return e?(this._event.off("frame",e),this):this}_handleLoop(){this._event.emit("frame")}}var Sr={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class kr{date;timestamp=0;yyyy=0;yy="";M=0;MM="";d=0;dd="";h=0;hh="";m=0;mm="";s=0;ss="";S=0;SS="";SSS="";constructor(e){if(!e)return;const t="string"==typeof e||"number"==typeof e?new Date(e):e;t&&(this.date=t,this.timestamp=t.getTime(),this.toDate())}toDate(){return this.date?(this.yyyy=this.date.getFullYear(),this.yy=`${this.yyyy}`.substr(2),this.M=this.date.getMonth()+1,this.MM=(this.M<10?"0":"")+this.M,this.d=this.date.getDate(),this.dd=(this.d<10?"0":"")+this.d,this.h=this.date.getHours(),this.hh=(this.h<10?"0":"")+this.h,this.m=this.date.getMinutes(),this.mm=(this.m<10?"0":"")+this.m,this.s=this.date.getSeconds(),this.ss=(this.s<10?"0":"")+this.s,this.S=this.date.getMilliseconds(),this.SS=(this.S<10?"0":"")+this.S,this.SSS=this.S.toString().padStart(3,"0"),this):this}toCountdown(e=""){const t={countdown:0,timestamp:0,seconds:0,d:0,dd:"",h:0,hh:"",m:0,mm:"",s:0,ss:"",S:0,SS:"",SSS:"",desc:""};if(!this.timestamp)return t;t.timestamp=this.timestamp,t.countdown=Math.max(t.timestamp-Date.now(),0),t.seconds=Math.floor(t.countdown/Sr.oneSecond);let r=t.countdown;t.d=Math.floor(r/Sr.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=Sr.oneDay,t.h=Math.floor(r/Sr.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=Sr.oneHour,t.m=Math.floor(r/Sr.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=Sr.oneMinute,t.s=Math.floor(r/Sr.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=Sr.oneSecond,t.S=r,t.SS=(t.S<10?"0":"")+t.S,t.SSS=t.S.toString().padStart(3,"0");let n=e;return n||(n=t.countdown>Sr.oneHour?"hh:mm:ss":t.countdown>Sr.oneMinute?"mm:ss":"ss"),t.desc=n.replace(/\bdd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>t[e])),t}add(e=0){return e?(this.timestamp=this.timestamp+e,this.date=new Date(this.timestamp),this.toDate(),this):this}format(e="yyyy-MM-dd hh:mm:ss"){return e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>this[e]))}static get timezoneOffset(){return(new Date).getTimezoneOffset()/60}static getLocalTime(e=0){const t=new Date,r=t.getTime(),n=6e4*t.getTimezoneOffset();return new Date(r+n+36e5*e)}}const Cr=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?$r(r).format(t):""},$r=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new kr(t||0)};function jr({year:e=0,month:t=0,date:r=0,hour:n=0,minute:s=0,second:i=0}){const o=`${e||"yyyy"}/${t||"MM"}/${r||"dd"} ${n}:${s}:${i}`;return new Date(Cr(Date.now(),o)).getTime()}var Or={...Sr,now:function(){return $r(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:jr,todayZero:()=>jr({}),format:Cr,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return $r(r).toCountdown(t)},dtime:$r,loopFrame:(e=500)=>new Ar(e),getTimezoneOffset:()=>kr.timezoneOffset,getLocalTime:kr.getLocalTime};const Er=e=>je.toBase64(e);var Pr={encode:Er,decode:e=>je.fromBase64(e),encodeByOss:e=>Er(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var Tr={...g,base64:Pr,tea:ot,uuid:y,guid:(e,t=!1,r="")=>{const n=y(e||32);return t?Or.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=g.keyChars;let r="";const n=t.length;for(let s=0;s<e;s++)r+=t.charAt(Math.floor(Math.random()*n));return r}};const qr=(e,t,r=8)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(r<=0)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const n=Object.prototype.toString.call(e);if(n!==Object.prototype.toString.call(t))return!1;switch(n){case"[object Array]":return Br(e,t,r);case"[object Map]":return Lr(e,t,r);case"[object Set]":return Rr(e,t,r);case"[object Object]":return Fr(e,t,r);default:return Ur(e,t,n)}},Br=(e,t,r=1/0)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qr(e[n],t[n],r-1))return!1;return!0},Lr=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const[n,s]of e)if(!t.has(n)||!qr(s,t.get(n),r-1))return!1;return!0},Rr=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const n of e)if(![...t].some((e=>qr(n,e,r-1))))return!1;return!0},Fr=(e,t,r=1/0)=>{const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!s.includes(i)||!qr(e[i],t[i],r-1))return!1;const i=Object.getOwnPropertySymbols(e),o=Object.getOwnPropertySymbols(t);if(i.length!==o.length)return!1;for(const n of i)if(!o.includes(n)||!qr(Reflect.get(e,n),Reflect.get(t,n),r-1))return!1;return!0},Ur=(e,t,r)=>{switch(r){case"[object RegExp]":return String(e)===String(t);case"[object Date]":return e.getTime()===t.getTime();case"[object ArrayBuffer]":return Dr(e,t);default:return e===t}},Dr=(e,t)=>{if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0};var Ir={isEqual:qr,isEqualArray:Br,isEqualObject:Fr,isEqualValue:Ur,isEqualAB:Dr,isEqualDeep:(e,t)=>qr(e,t,1/0)};const Mr=(e,t=new WeakMap)=>{if(null===e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(Array.isArray(e)){r=[],t.set(e,r);for(const n of e)r.push(Mr(n,t))}else if(e instanceof Date)r=new Date(e);else if(e instanceof RegExp)r=new RegExp(e.source,e.flags);else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,s]of e.entries())r.set(Mr(n,t),Mr(s,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e.values())r.add(Mr(n,t))}else if("object"==typeof e){r={},t.set(e,r);for(const[n,s]of Object.entries(e))r[n]=Mr(s,t)}return r};var Kr={copy:(e,t={})=>{if(null==e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r||null===r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0,...o}=t,a={},c=[{condition:o.ignoreNull,test:e=>null===e},{condition:o.ignoreZero,test:e=>0===e},{condition:o.ignoreEmptyArray,test:e=>Array.isArray(e)&&0===e.length},{condition:o.ignoreEmptyString,test:e=>"string"==typeof e&&""===e.trim()}].filter((e=>e.condition));for(const[e,t]of Object.entries(r)){const r=!s||i&&e.startsWith("_")?e:Gt.camelCase(e);n.length>0&&!n.includes(e)&&!n.includes(r)||(c.some((e=>e.test(t)))||(a[r]=t))}return a},clone:Mr,cloneClass:function(e){return null==e||"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}};const zr=(e,t)=>{if(e===t)return!0;if(!e||!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var Nr={shExpMatch:zr,shExpMatchs:(e,t)=>{if(!e||!t)return!1;let r=[];if(Array.isArray(t))r=t;else{if("string"!=typeof t)return!1;r=[t]}for(const t of r){if("*"===t)return!0;if(zr(e,t))return!0}return!1}};const Hr="[object Object]",Vr="[object Array]",Wr=O.getTag,Zr=e=>{if(Wr(e)!==Hr)return e;const t={};for(const r in e)if(/\w+\.\w+/g.test(r)&&!r.includes("[")){const n=r.split(".");let s=t;for(let e=0;e<n.length-1;e++){const t=n[e];Wr(s[t])!==Hr&&(s[t]={}),s=s[t]}s[n[n.length-1]]=e[r]}else t[r]=e[r];return t},Yr=(e,t,r=!1)=>{if(e===t)return;const n=Wr(e);if(n===Wr(t))if(n===Vr&&e.length>=t.length)for(let r=0;r<t.length;r++)Yr(e[r],t[r]);else if(n===Hr&&Object.keys(e).length>=Object.keys(t).length)for(const n in t)r||void 0!==e[n]?Yr(e[n],t[n]):e[n]=null},Jr=(e,t)=>Yr(e,t,!0),Qr=(e,t,r={},n="",s=!1)=>{if(e===t)return r;const i=Wr(e),o=Wr(t);if(i===Vr&&o===i&&e.length>=t.length){for(let s=0;s<e.length;s++)Qr(e[s],t[s],r,`${n}[${s}]`,!1);return r}if(i===Hr&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Wr(s),c=Wr(o);if(s!==o)if(a===Vr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Qr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`,!1);else if(a===Hr&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Qr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`,!1);else null!==s&&(r[`${n?n+".":""}${i}`]=s)}return r}return r[n]=e,r};const Gr={...{...Ir,...Kr,...Nr,...{flattenPath:Zr,normalizeStructure:Jr,diffPath:(e,t)=>{const r=Zr(e),n=Zr(t);return Jr(r,n),Qr(r,n)}}},...Ve,...Tr,...ar,...Gt,...Te,...xe,qs:xr};var Xr={gbkLength:function(e){let t=0;if(!e)return 0;for(let r=0;r<e.length;r++)e.charCodeAt(r)>127||94===e.charCodeAt(r)?t+=2:t++;return t},gbkCut:function(e,t){if(!e||t<=0)return"";let r=0,n=0;for(let s=0;s<e.length&&(e.charCodeAt(s)>127||94===e.charCodeAt(s)?r+=2:r++,!(r>t));s++)n=s;return e.substr(0,n+1)}};function en(e){return e!=e}function tn(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}(t,(function(t){return e[t]}))}var rn,nn,sn=(rn=Object.keys,nn=Object,function(e){return rn(nn(e))}),on=Math.max;function an(e,t){var r=ee.isArray(e)||ee.isArguments(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,s=!!n;for(var i in e)!t&&!O.hasOwnProperty.call(e,i)||s&&("length"==i||ee.isIndex(i,n))||r.push(i);return r}var cn={...ee,...O,...dr,...xe,includes:function(e,t,r,n){e=ee.isArrayLike(e)?e:function(e){return e?tn(e,function(e){return ee.isArrayLike(e)?an(e):function(e){if(!ee.isPrototype(e))return sn(e);var t=[];for(var r in Object(e))O.hasOwnProperty.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}(e)):[]}(e),r=r&&!n?fe.toInteger(r):0;var s=e.length;return r<0&&(r=on(s+r,0)),ee.isString(e)?r<=s&&e.indexOf(t,r)>-1:!!s&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}(e,en,r);for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}(e,t,r)>-1},forof:(e,t)=>{if(!e)return;let r;if(ee.isObject(e)&&(r=ee.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var ln={...{groupBy:function(e,t){return e.reduce(((e,r)=>((e[r[t]]=e[r[t]]||[]).push(r),e)),{})},first:function(e){if(!e)return;return e.length<=0?void 0:e[0]},last:function(e){if(!e)return;const t=e.length;return t<=0?void 0:e[t-1]},toList:function(e){return Array.isArray(e)?e:e?[e]:[]}},stepAction:function(e,t,r=100){if(!ee.isFunction(t))return;if(!ee.isArray(e)||e.length<=0)return;let n=0;for(;e.length>n;){let s=r+n,i=e.slice(n,s);t&&t(i),n=s}},skip:function(e,t){if(!ee.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!ee.isArray(e)||e.length<=0)return[];const n=r||0;if(n>=e.length)return[];const s=t+n;return e.slice(n,e.length<s?e.length:s)||[]},distinct:function(e){return!ee.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return Te.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!ee.isObject(e))return;const s=e[t];(ee.isString(s)&&""!==s||ee.isNumber(s))&&(n[s]=e[r])})),n):n}};const un=/%[sdj%]/g;let fn=()=>{};function hn(e){if(!e||!e.length)return null;const t={};return e.forEach((e=>{const r=e.field;t[r]=t[r]||[],t[r].push(e)})),t}function dn(e,...t){let r=0;const n=t.length;if("function"==typeof e)return e.apply(null,t);if("string"==typeof e){return e.replace(un,(e=>{if("%%"===e)return"%";if(r>=n)return e;switch(e){case"%s":return String(t[r++]);case"%d":return Number(t[r++]);case"%j":try{return JSON.stringify(t[r++])}catch(e){return"[Circular]"}break;default:return e}}))}return e}function pn(e,t){return null==e||(!("array"!==t||!Array.isArray(e)||e.length)||!(!function(e){return"string"===e||"url"===e||"hex"===e||"email"===e||"date"===e||"pattern"===e}(t)||"string"!=typeof e||e))}function gn(e,t,r){let n=0;const s=e.length;!function i(o){if(o&&o.length)return void r(o);const a=n;n+=1,a<s?t(e[a],i):r([])}([])}"undefined"!=typeof process&&process.env&&"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&"undefined"!=typeof document&&(fn=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class yn extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function mn(e,t,r,n,s){if(t.first){const t=new Promise(((t,i)=>{const o=function(e){const t=[];return Object.keys(e).forEach((r=>{t.push(...e[r]||[])})),t}(e);gn(o,r,(e=>(n(e),e.length?i(new yn(e,hn(e))):t(s))))}));return t.catch((e=>e)),t}const i=!0===t.firstFields?Object.keys(e):t.firstFields||[],o=Object.keys(e),a=o.length;let c=0;const l=[],u=new Promise(((t,u)=>{const f=e=>{if(l.push.apply(l,e),c++,c===a)return n(l),l.length?u(new yn(l,hn(l))):t(s)};o.length||(n(l),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?gn(n,r,f):function(e,t,r){const n=[];let s=0;const i=e.length;function o(e){n.push(...e||[]),s++,s===i&&r(n)}e.forEach((e=>{t(e,o)}))}(n,r,f)}))}));return u.catch((e=>e)),u}function bn(e,t){return r=>{let n;return n=e.fullFields?function(e,t){let r=e;for(let e=0;e<t.length;e++){if(null==r)return r;r=r[t[e]]}return r}(t,e.fullFields):t[r.field||e.fullField],(s=r)&&void 0!==s.message?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField};var s}}function wn(e,t){if(t)for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];"object"==typeof n&&"object"==typeof e[r]?e[r]={...e[r],...n}:e[r]=n}return e}const _n=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!pn(t,i||e.type)||n.push(dn(s.messages.required,e.fullField))};let vn;const xn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,An=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,Sn={integer:e=>Sn.number(e)&&parseInt(e,10)===e,float:e=>Sn.number(e)&&!Sn.integer(e),array:e=>Array.isArray(e),regexp(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:e=>"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear&&!isNaN(e.getTime()),number:e=>!isNaN(e)&&"number"==typeof e,object:e=>"object"==typeof e&&!Sn.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(xn),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(vn)return vn;const e="[a-fA-F\\d:]",t=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${e})|(?<=${e})(?=\\s|$))`:"",r="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",n="[a-fA-F\\d]{1,4}",s=`\n(?:\n(?:${n}:){7}(?:${n}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${n}:){6}(?:${r}|:${n}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${n}:){5}(?::${r}|(?::${n}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${n}:){4}(?:(?::${n}){0,1}:${r}|(?::${n}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${n}:){3}(?:(?::${n}){0,2}:${r}|(?::${n}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${n}:){2}(?:(?::${n}){0,3}:${r}|(?::${n}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${n}:){1}(?:(?::${n}){0,4}:${r}|(?::${n}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${n}){0,5}:${r}|(?::${n}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),i=new RegExp(`(?:^${r}$)|(?:^${s}$)`),o=new RegExp(`^${r}$`),a=new RegExp(`^${s}$`),c=e=>e&&e.exact?i:new RegExp(`(?:${t(e)}${r}${t(e)})|(?:${t(e)}${s}${t(e)})`,"g");c.v4=e=>e&&e.exact?o:new RegExp(`${t(e)}${r}${t(e)}`,"g"),c.v6=e=>e&&e.exact?a:new RegExp(`${t(e)}${s}${t(e)}`,"g");const l=c.v4().source,u=c.v6().source;return vn=new RegExp(`(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${l}|${u}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s"]*)?$)`,"i"),vn})()),hex:e=>"string"==typeof e&&!!e.match(An)},kn="enum";var Cn={required:_n,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(dn(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void _n(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?Sn[i](t)||n.push(dn(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(dn(s.messages.types[i],e.fullField,e.type))},range:(e,t,r,n,s)=>{const i="number"==typeof e.len,o="number"==typeof e.min,a="number"==typeof e.max,c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;let l=t,u="";const f="number"==typeof t,h="string"==typeof t,d=Array.isArray(t);if(f?u="number":h?u="string":d&&(u="array"),!u)return!1;d&&(l=t.length),h&&(l=t.replace(c,"_").length),i?l!==e.len&&n.push(dn(s.messages[u].len,e.fullField,e.len)):o&&!a&&l<e.min?n.push(dn(s.messages[u].min,e.fullField,e.min)):a&&!o&&l>e.max?n.push(dn(s.messages[u].max,e.fullField,e.max)):o&&a&&(l<e.min||l>e.max)&&n.push(dn(s.messages[u].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[kn]=Array.isArray(e[kn])?e[kn]:[],-1===e[kn].indexOf(t)&&n.push(dn(s.messages[kn],e.fullField,e[kn].join(", ")))},pattern:(e,t,r,n,s)=>{if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||n.push(dn(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(dn(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const $n=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t,i)&&!e.required)return r();Cn.required(e,t,n,o,s,i),pn(t,i)||Cn.type(e,t,n,o,s)}r(o)};var jn={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(pn(t,"string")&&!e.required)return r();Cn.required(e,t,n,i,s,"string"),pn(t,"string")||(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s),Cn.pattern(e,t,n,i,s),!0===e.whitespace&&Cn.whitespace(e,t,n,i,s))}r(i)},method:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.type(e,t,n,i,s)}r(i)},number:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(""===t&&(t=void 0),pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},boolean:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.type(e,t,n,i,s)}r(i)},regexp:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),pn(t)||Cn.type(e,t,n,i,s)}r(i)},integer:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},float:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},array:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(null==t&&!e.required)return r();Cn.required(e,t,n,i,s,"array"),null!=t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},object:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.type(e,t,n,i,s)}r(i)},enum:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.enum(e,t,n,i,s)}r(i)},pattern:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t,"string")&&!e.required)return r();Cn.required(e,t,n,i,s),pn(t,"string")||Cn.pattern(e,t,n,i,s)}r(i)},date:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t,"date")&&!e.required)return r();if(Cn.required(e,t,n,i,s),!pn(t,"date")){let r;r=t instanceof Date?t:new Date(t),Cn.type(e,r,n,i,s),r&&Cn.range(e,r.getTime(),n,i,s)}}r(i)},url:$n,hex:$n,email:$n,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;Cn.required(e,t,n,i,s,o),r(i)},any:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s)}r(i)}};function On(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone(){const e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}const En=On();class Pn{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");jn[e]=t};static warning=fn;static messages=En;static validators=jn;rules={};_messages=En;constructor(e){this.define(e)}define(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");this.rules={},Object.keys(e).forEach((t=>{const r=e[t];this.rules[t]=Array.isArray(r)?r:[r]}))}messages(e){return e&&(this._messages=wn(On(),e)),this._messages}validate(e,t={},r=(()=>{})){let n=e,s=t,i=r;if("function"==typeof s&&(i=s,s={}),!this.rules||0===Object.keys(this.rules).length)return i&&i(null,n),Promise.resolve(n);if(s.messages){let e=this.messages();e===En&&(e=On()),wn(e,s.messages),s.messages=e}else s.messages=this.messages();const o={};(s.keys||Object.keys(this.rules)).forEach((t=>{const r=this.rules[t];let s=n[t];r.forEach((r=>{let i=r;"function"==typeof i.transform&&(n===e&&(n={...n}),s=n[t]=i.transform(s)),i="function"==typeof i?{validator:i}:{...i},i.validator=this.getValidationMethod(i),i.validator&&(i.field=t,i.fullField=i.fullField||t,i.type=this.getType(i),o[t]=o[t]||[],o[t].push({rule:i,value:s,source:n,field:t}))}))}));const a={};return mn(o,s,((e,t)=>{const r=e.rule;let i,o=!("object"!==r.type&&"array"!==r.type||"object"!=typeof r.fields&&"object"!=typeof r.defaultField);function c(e,t){return{...t,fullField:`${r.fullField}.${e}`,fullFields:r.fullFields?[...r.fullFields,e]:[e]}}function l(i=[]){let l=Array.isArray(i)?i:[i];!0===s.suppressWarning&&l.length&&Pn.warning("async-validator:",l),l.length&&void 0!==r.message&&(l=[].concat(r.message));let u=l.map(bn(r,n));if(s.first&&u.length)return a[r.field]=1,t(u);if(o){if(r.required&&!e.value)return void 0!==r.message?u=[].concat(r.message).map(bn(r,n)):s.error&&(u=[s.error(r,dn(s.messages.required,r.field))]),t(u);let i={};r.defaultField&&Object.keys(e.value).map((e=>{i[e]=r.defaultField})),i={...i,...e.rule.fields};const o={};Object.keys(i).forEach((e=>{const t=i[e],r=Array.isArray(t)?t:[t];o[e]=r.map(c.bind(null,e))}));const a=new Pn(o);a.messages(s.messages),e.rule.options&&(e.rule.options.messages=s.messages,e.rule.options.error=s.error),a.validate(e.value,e.rule.options||s,(e=>{const r=[];u&&u.length&&r.push(...u),e&&e.length&&r.push(...e),t(r.length?r:null)}))}else t(u)}if(o=o&&(r.required||!r.required&&e.value),r.field=e.field,r.asyncValidator)i=r.asyncValidator(r,e.value,l,e.source,s);else if(r.validator){try{i=r.validator(r,e.value,l,e.source,s)}catch(e){console.error?.(e),s.suppressValidatorError||setTimeout((()=>{throw e}),0),l(e.message)}!0===i?l():!1===i?l("function"==typeof r.message?r.message(r.fullField||r.field):r.message||`${r.fullField||r.field} fails`):i instanceof Array?l(i):i instanceof Error&&l(i.message)}i&&i.then&&i.then((()=>l()),(e=>l(e)))}),(e=>{!function(e){let t=[],r={};for(let r=0;r<e.length;r++)s=e[r],Array.isArray(s)?t=t.concat(...s):t.push(s);var s;t.length?(r=hn(t),i(t,r)):i(null,n)}(e)}),n)}getType(e){if(void 0===e.type&&e.pattern instanceof RegExp&&(e.type="pattern"),"function"!=typeof e.validator&&e.type&&!jn.hasOwnProperty(e.type))throw new Error(dn("Unknown rule type %s",e.type));return e.type||"string"}getValidationMethod(e){if("function"==typeof e.validator)return e.validator;const t=Object.keys(e),r=t.indexOf("message");return-1!==r&&t.splice(r,1),1===t.length&&"required"===t[0]?jn.required:jn[this.getType(e)]||void 0}}function Tn(e){return new Pn(e)}var qn={validateId:function(e){return!!e&&(!(e.length<6)&&!!/^[A-Za-z0-9_-]+$/.test(e))},validatePhone:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)},validator:Tn,validate:function(e,t,r={},n=(()=>{})){return ar.run(Tn(e).validate(t,r,n))},isChinese:function(e){return!!e&&!!/^[\u4E00-\u9FA5]+$/.test(e)},isNumber:function(e){return!!e&&!!/^[0-9]+$/.test(e)},isFloat:function(e){return!!e&&!!/^(\-|\+)?\d+(\.\d+)?$/.test(e)},isPhoneNumber:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)}};const Bn={gbk:Xr,math:Te,list:ln,string:Gt,time:Or,obj:dr,rule:qn,regex:{pattern:{num:"0-9",zh:"一-龥",en:"A-Za-z"},regex:(e,t)=>new RegExp(e,t),entire:{chinese:/^[\u4E00-\u9FA5]+$/,real:/^(\-|\+)?\d+(\.\d+)?$/,cssReal:/^(\-|\+)?\d*(\.)?\d+$/,id:/^[A-Za-z0-9]+$/,yyyyMMdd:/^(\d{4})-?(\d{2})-?(\d{2})$/}},...Ve,...Tr,...cn,Event:m},Ln="[object Object]",Rn="[object Array]",Fn=e=>Object.prototype.toString.call(e),Un=(e,t,r=!1)=>{if(e===t)return;const n=Fn(e);if(n===Fn(t))if(n===Rn&&e.length>=t.length)for(let r=0;r<t.length;r++)Un(e[r],t[r]);else if(n===Ln&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?Un(e[n],t[n]):e[n]=null},Dn=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=Fn(e),o=Fn(t);if(i===Rn&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)Dn(e[s],t[s],r,`${n}[${s}]`);else if(i===Ln&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Fn(s),c=Fn(o);if(s!==o)if(a===Rn&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Dn(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===Ln&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Dn(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class In{list=[];constructor(){this.invoke=this.invoke.bind(this)}use(e){this.list=this.list.concat(e)}invoke(e){return this.list.reduce(((e,t)=>e.then((e=>t(e)))),Promise.resolve(e)).catch((e=>"REFETCH"===e.sig?Promise.resolve(e.result):Promise.reject(e)))}}class Mn{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new In,response:new In};constructor(e){const{reqConfig:t={},requestEncrypt:r,responseDecrypt:n,handleError:s,api:i}=e;this.reqConfig=t,this.handleEncrypt=r,this.handleDecrypt=n,this.handleError=s,this.handleRequest=i}static blockId="blockid";static requestLock={};lockR(e,t){Mn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete Mn.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}_fetch(e,t){let r=e;return t&&this.handleEncrypt&&(r=this.handleEncrypt(e)),new Promise(((e,n)=>{this.handleRequest({...r,success:r=>{let n=r;t&&this.handleDecrypt&&(n=this.handleDecrypt(r)),e(n)},fail:e=>{n(e)}})}))}async request(e,t){const r=dr.copy(this.reqConfig[e]),{config:n,...s}=await this.interceptors.request.invoke({url:r.url,data:t||{},header:{"content-type":"application/json"},method:r.method?r.method:"POST",responseType:"text",config:r});let i;try{if("block"===n.model)this.lockR(Mn.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await Mn.requestLock[Mn.blockId].request;else if(Mn.requestLock[Mn.blockId]&&Mn.requestLock[Mn.blockId].lock&&await Mn.requestLock[Mn.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),Mn.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await Mn.requestLock[e].request,this.unlockR(e)}else i=await this._fetch(s,n.hasEncrypt)}catch(e){this.handleError&&this.handleError(e)}return this.interceptors.response.invoke({res:i,config:r,reqId:this.getIdFromReq(s),refetch:()=>({sig:"REFETCH",result:this.request(e,t||{})})})}}const Kn=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var zn={diff:function(e,t){const r={};return(e=>{if(Fn(e)===Ln)for(let t in e)if(/\w+\.\w+/g.test(t)&&-1===t.indexOf("[")){const r=t.split(".");let n=e,s=r.length;for(let e=0;e<s-1;e++){const t=r[e];Fn(n[t])!==Ln&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),Un(e,t,!0),Dn(e,t,r,"",!0),r},promixify:Kn,run:(e,t={})=>e?ar.run(Kn(e)(t)):ar.run(e),formatList:(e,t,r)=>(e||[]).reduce(((e,n,s)=>({...e,[`${r}[${t+s}]`]:n})),{}),ruleValidator:(e,t)=>!!t&&(!Array.isArray(t)||!(t.length<=0)&&t.every((e=>!!e))),Http:Mn,setWatcher:e=>{let t=e.data,r=e.watch;Object.keys(r).forEach((n=>{let s=t,i=n.split(".");for(let e=0;e<i.length-1;e++)s=s[i[e]];let o=i[i.length-1],a=r[n].handler||r[n],c=r[n].deep;dr.observe(s,o,a,e,c)}))}};const Nn=e=>{if(!e)return"";if(!cn.isObject(e))return"";let t="";return cn.forof(e,((e,r)=>{r&&(t+=`${Gt.kebabCase(e)}:${r};`)})),t},Hn=["display","position","top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","fontSize","textAlign","fontFamily","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius","background","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","color","overflow","opacity","flexDirection","justifyContent","alignItems","flexWrap","alignContent","alignSelf","flex","flexBasis","flexFlow","flexShrink","pointerEvents"],Vn=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],Wn=(e,t="px")=>e&&t?"0"===e?e:qn.isFloat(e.toString())?`${e}${t}`:e:e;var Zn={stringify:Nn,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=xr.parse(e,{sep:";",eq:":",uri:!1}),s={};return cn.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:Gt.camelCase(e):e;qn.isFloat(n)||n.length>=2&&n.startsWith(".")&&qn.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:Wn,style:(e,t="px")=>{if(!e)return"";const r=cn.copy(e,{fields:Hn});cn.forof(r,((e,n)=>{(Vn.includes(e)||Vn.includes(Gt.camelCase(e)))&&(r[e]=Wn(n,t))}));return Nn(r)},commonFields:Hn};const Yn=(e,t="",r=!1)=>{try{if(!e)return;const n=xr.parseUrl(e),s=t||n.name;if(!t||!r||!n.origin||n.origin===window.location.origin)((e,t)=>{try{const r=document.createElement("a");r.style.display="none",r.href=e,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(t){console.error(`[ddan] _downloadUrl ${e}`,t)}})(e,s);else{const t=n.params;t.t=Date.now();const r=`${n.url}?${xr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){Jn(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},Jn=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;Yn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},Qn=e=>{try{const t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.style.opacity="0",t.value=e??"",t.select();const r=document.execCommand("copy");return document.body.removeChild(t),r}catch(e){return console.error("[ddan] copyText",e),!1}},Gn=(e,t="denied")=>new Promise((r=>{const n=navigator?.permissions;if(!n||!n.query)return r(t);const s={name:e};n.query(s).then((e=>r(e.state))).catch((()=>r(t)))})),Xn=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e,es=(e,t)=>{if(!e||!t)return[];const r=[];let n;for(;null!==(n=t.exec(e));)r.push(n[1]);return r},ts=(e,t="application/javascript")=>{const r=new Blob([e],{type:t});return URL.createObjectURL(r)};var rs={dataURLtoFile:(e,t)=>{let r=e.split(","),n=r[0].match(/:(.*?);/)[1],s=window.atob(r[1]),i=s.length,o=new Uint8Array(i);for(;i--;)o[i]=s.charCodeAt(i);return new File([o],t,{type:n})},dataURLtoBlob:e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=window.atob(t[1]),s=n.length,i=new Uint8Array(s);for(;s--;)i[s]=n.charCodeAt(s);return new Blob([i],{type:r})},blobToFile:(e,t)=>(e.lastModifiedDate=new Date,e.name=t,e),readAsDataURL:(e,t)=>{var r=new FileReader;r.readAsDataURL(e),r.onloadend=function(e){t&&t(e.target?.result)}},downloadUrl:Yn,download:(e,t="")=>{e&&("string"!=typeof e?Jn(e,t):Yn(e,t))},downloadFile:Jn,downloadImage:e=>{try{if(!e)return;const t=e.match(/\/(\w+.\w+)$/)[1],r=new Image;r.onload=()=>{let e=document.createElement("canvas");e.width=r.width,e.height=r.height;let n=e.getContext("2d");n&&n.drawImage(r,0,0,r.width,r.height);let s=e.toDataURL();Yn(s,t)},r.src=e,r.setAttribute("crossOrigin","Anonymous")}catch(e){console.error("[ddan] downloadImage",e)}return Promise.resolve()},watermark:(e,{width:t=400,height:r=300,angle:n=0,fillStyle:s="rgba(0, 0, 0, 0.2)",font:i="16px Arial",textAlign:o="left",textBaseline:a="middle"}={})=>{try{if(!e)return"";const c=document.createElement("canvas");c.width=t,c.height=r;const l=c.getContext("2d");return l?(n&&l.rotate(n*Math.PI/180),s&&(l.fillStyle=s),i&&(l.font=i),o&&(l.textAlign=o),a&&(l.textBaseline=a),l.fillText(e,c.width/10,c.height/2),`url(${c.toDataURL()})`):""}catch(e){return console.error("[ddan] watermark",e),""}},copyText:(e,t=!1)=>new Promise((r=>{!t&&navigator.clipboard?Gn("clipboard-write").then((t=>{Xn(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(Qn(e)))):r(Qn(e))})).catch((()=>{r(Qn(e))})):r(Qn(e))})),queryPermission:Gn,isAllowed:Xn,legacyCopy:Qn,takeHtmlLinks:e=>{if(!e)return[];const t=[];return[/<script[^>]+src="([^"]+)"/g,/<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"/g,/<link[^>]+rel="icon"[^>]+href="([^"]+)"/g].forEach((r=>{const n=es(e,r);t.push(n)})),[].concat(...t)},takeHtml:es,toBlobUrl:ts,workerURL:e=>ts(`(${e.toString()})()`,"text/javascript")};const ns=new class{__defStyle="vertical-align: middle; mask-position: 50% 50%; mask-repeat: no-repeat; mask-size: 100%; -webkit-mask-position: 50% 50%; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100%; background-color: currentColor;";__map={back:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M609.408 149.376L277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"/></svg>',right:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"/></svg>',home:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13 19.8h3.8v-7h3.303L12 4.697 3.897 12.8H7.2v7H11V17h2v2.8zm5 .2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-6H3.414a1 1 0 0 1-.707-1.707l8.586-8.586a1 1 0 0 1 1.414 0l8.586 8.586A1 1 0 0 1 20.586 14H18v6z" fill-rule="evenodd" fill-opacity=".9"/></svg>',close:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M764.288 214.592L512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"/></svg>',close_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M466.752 512l-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',close_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"/></svg>',warning:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M928.99 755.83L574.6 203.25c-12.89-20.16-36.76-32.58-62.6-32.58s-49.71 12.43-62.6 32.58L95.01 755.83c-12.91 20.12-12.9 44.91.01 65.03 12.92 20.12 36.78 32.51 62.59 32.49h708.78c25.82.01 49.68-12.37 62.59-32.49 12.91-20.12 12.92-44.91.01-65.03zM554.67 768h-85.33v-85.33h85.33V768zm0-426.67v298.66h-85.33V341.32l85.33.01z" fill="currentColor"/></svg>',play:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M512 1024A512 512 0 1 1 512 0a512 512 0 0 1 0 1024zm3.008-92.992a416 416 0 1 0 0-832 416 416 0 0 0 0 832zM383.232 287.616l384 224.896-384 223.104v-448z" fill="currentColor"/></svg>',lock:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32H224zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96z"/><path fill="currentColor" d="M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32zm192-160v-64a192 192 0 1 0-384 0v64h384zM512 64a256 256 0 0 1 256 256v128H256V320A256 256 0 0 1 512 64z"/></svg>',lock_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M467.2 713.92v115.968a44.8 44.8 0 0 0 89.6 0V713.92c26.752-14.72 44.8-42.304 44.8-73.92 0-47.104-40.128-85.312-89.6-85.312-49.472 0-89.6 38.208-89.6 85.312 0 31.616 18.048 59.136 44.8 73.92zM64 384h896v640H64V384zm268.8 0h358.4V256c0-94.272-80.256-170.688-179.2-170.688-98.944 0-179.2 76.416-179.2 170.688v128zM512 0c148.48 0 268.8 114.56 268.8 256v128H243.2V256C243.2 114.56 363.52 0 512 0z" fill="currentColor"/></svg>',plus:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"/></svg>',plus_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M352 480h320a32 32 0 1 1 0 64H352a32 32 0 0 1 0-64z"/><path fill="currentColor" d="M480 672V352a32 32 0 1 1 64 0v320a32 32 0 0 1-64 0z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',plus_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0v147.2z"/></svg>',star:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 747.84l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"/></svg>',star_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M283.84 867.84L512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"/></svg>',share:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M679.872 348.8l-301.76 188.608a127.808 127.808 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"/></svg>',love:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M171.712 571.648l.352.32 287.904 252.8a64 64 0 0 0 82.912 1.344l296.832-244.544a215.584 215.584 0 1 0-301.824-300.576L512 316.672l-25.888-35.616a215.584 215.584 0 1 0-314.4 290.624zM32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512l-295.36 243.392a128 128 0 0 1-165.888-2.592L129.984 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>',love_fill:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512L562.592 892.8a96 96 0 0 1-124.416-1.952L130.016 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>'};getBase64=e=>{const t=this.getSVG(e);return t?.url||""};getSVG=e=>{if(!e)return;const t=this.__map[e];if(!t)return;return{url:this.toBase64(t),escape:this.toEscape(t)}};toBase64=e=>{if(!e)return"";const t=this._tiny(e);return`data:image/svg+xml;base64,${Pr.encode(t)}`};_tiny=e=>e?e.replace(/<!--(.*)-->/g,"").replace(/[\r\n]/g," ").replace(/"/g,"'"):"";toEscape=e=>{if(!e)return"";return`data:image/svg+xml,${this._tiny(e).replace(/%/g,"%25").replace(/&/g,"%26").replace(/#/g,"%23").replace(/{/g,"%7B").replace(/}/g,"%7D").replace(/</g,"%3C").replace(/>/g,"%3E")}`};getStyle(e,t={}){if(!e)return"";const r=this.__map[e];return r?this.toStyle(r,t):""}toStyle(e,t={}){if(!e)return"";const r=this.toBase64(e);return r?this.getStyleByUrl(r,t):""}getStyleByUrl(e,t={}){if(!e)return"";const{key:r="mask-image",gradientValue:n="radial-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5))",gradient:s=!1,defStyle:i=this.__defStyle}=t,o=s&&n?`${n}, url("${e}")`:`url("${e}")`;return`${r}:${o};-webkit-${r}:${o};${i}`}},ss={mini:zn,css:Zn,qs:xr,icon:ns,html:rs},is=({url:e,options:t})=>{const r={"Content-Type":"application/json; charset=utf-8",...t.headers||{}};return t.headers=r,new Promise(((r,n)=>{fetch(e,t).then((e=>{r(e.json())})).catch((e=>{n(e)}))}))};function os(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function as(e){const{url:t="",host:r,options:n}=e,s=e;if(t.startsWith("http://")||t.startsWith("https://")||(s.url=(r||"")+t),"GET"===n.method.toUpperCase()&&n.body){const e=JSON.parse(n.body);if(cn.isPlainObject(e)){const r=xr.stringify(e),n=-1===t.indexOf("?")?"?":"&";s.url=`${s.url||""}${n}${r}`,delete s.options.body}}return n&&n.plugins&&delete s.options?.plugins,n&&n.model&&delete s.options?.model,s}class cs{host="";reqConfig={};handleError;interceptors={request:new In,response:new In};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(as),this.interceptors.response.use(e.handleResponse||os),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){cs.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete cs.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}async fetch(e,t){const r=cn.copy(this.reqConfig[e])||{},n={host:this.host,url:r.url||"",options:{...r||{},body:JSON.stringify({...t||{}})}};try{const s=await this.interceptors.request.invoke(n);let i;if(delete s.options.plugins,"block"===r.model)this.lockR(cs.blockId,(()=>is(s))),i=await cs.requestLock[cs.blockId].request;else if(cs.requestLock[cs.blockId]&&cs.requestLock[cs.blockId].lock&&await cs.requestLock[cs.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),cs.requestLock[e]||this.lockR(e,(()=>is(s))),i=await cs.requestLock[e].request,this.unlockR(e)}else i=await is(s);return this.interceptors.response.invoke({response:i,config:r,refetch:()=>({sig:"REFETCH",result:this.fetch(e,t)})})}catch(e){return this.handleError&&this.handleError(e),Promise.reject(e)}}}var ls={getDataURL:(e,t)=>{const r={contentType:"",dataUrl:""};return _e.to(fetch(e,{cache:t}).then((e=>(r.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(r.dataUrl=`data:${r.contentType};base64,`+Ve.ab2str(e,!0),r))))},getArrayBuffer:async(e,t)=>_e.to(fetch(e,{cache:t}).then((e=>e.arrayBuffer()))),getJson:async(e,t)=>_e.to(fetch(e,{cache:t}).then((e=>e.json()))),download:(e,t={})=>new Promise((r=>fetch(e).then((async e=>{if(!e.ok||200!==e.status)throw new Error(e.statusText);const n=+(e.headers.get("content-length")||""),s=e.body?.getReader();let i=0;const o=[];for(;;){const{done:e,value:r}=await s.read();if(e)break;o.push(r),i+=r.length;const a=Te.float(100*i/n,{digits:2});t?.progress&&t?.progress(a,i,n)}const a=new Uint8Array(i);let c=0;for(const e of o)a.set(e,c),c+=e.length;t?.success&&t?.success(a),r(a)})).catch((e=>{t?.fail&&t?.fail(e),r(void 0)})))),getText:async(e,t)=>_e.to(fetch(e,{cache:t}).then((e=>e.text()))),cache:async(e,t="no-cache")=>_e.to(fetch(e,{cache:t}).then((()=>!0)))};class us{publicKey="";privateKey="";iv="";__privateCryptoKey;__sharedSecret;__curve;__keyFormat;__subtle;constructor(e="P-256",t="raw"){this.__curve=e,this.__keyFormat=t||"raw","undefined"!=typeof window?this.__subtle=window.crypto.subtle:this.__subtle={}}async generateKeys(){const e=await this.__subtle.generateKey({name:"ECDH",namedCurve:this.__curve},!0,["deriveKey","deriveBits"]);return this.__privateCryptoKey=e.privateKey,this.publicKey=await this.exportKey(e.publicKey),this.privateKey=await this.exportKey(e.privateKey,"pkcs8"),this}async exportKey(e,t="raw"){const r=await this.__subtle.exportKey(t||this.__keyFormat,e);return Ve.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Ve.base64ToBytes(e);return await this.__subtle.importKey(t||this.__keyFormat||"raw",n,{name:"ECDH",namedCurve:this.__curve},!0,r)}async setPrivateKey(e){if(!e)return!1;const t=await this.importKey(e,"pkcs8",["deriveKey","deriveBits"]);return this.privateKey=await this.exportKey(t,"pkcs8"),this.__privateCryptoKey=t,!0}async deriveSharedSecret(e,t){if(!this.__privateCryptoKey)return!1;const r=await this.importKey(e),n=await this.__subtle.deriveKey({name:"ECDH",public:r},this.__privateCryptoKey,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return this.__sharedSecret=n,this.iv=t||"",!0}async encode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Ve.base64ToBytes(r),s=Ve.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Ve.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Ve.base64ToBytes(r):Ve.getRandomBytes(12),s=Ve.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Ve.concatBytes(new Uint8Array(i),n);return Ve.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Ve.base64ToBytes(e),s=Ve.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Ve.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Ve.base64ToBytes(e);if(t.length<12)return"";const r=t.slice(t.length-12),n=t.slice(0,t.length-12),s=await this.__subtle.decrypt({name:"AES-GCM",iv:r},this.__sharedSecret,n);return Ve.textDecode(s)}}const fs={fetch:ls,Http:cs,css:Zn,qs:xr,icon:ns,html:rs,rsa:Xe,...{Ecdh:us}};var hs={brotliCompress:function(e,t=l.default.constants.BROTLI_DEFAULT_QUALITY){try{if(!e)return"";const r=Ve.toUtf8Bytes(e);return l.default.brotliCompressSync(r,{params:{[l.default.constants.BROTLI_PARAM_QUALITY]:t}}).toString("base64")}catch(t){return e||""}},brotliDecompress:function(e){try{if(!e)return"";const t=Ve.base64ToBytes(e);return l.default.brotliDecompressSync(t).toString("utf-8")}catch(t){return e||""}}};var ds={child_exec:e=>new Promise((t=>{if(!e)return t([null,""]);i.exec(e,((e,r)=>{t(e?[e||"error",""]:[null,r||""])}))}))};const ps=()=>{try{return"win32"===process.platform?gs():"darwin"===process.platform?ys():void 0}catch(e){return}},gs=async()=>{do{let e,t;if([e,t]=await ds.child_exec('reg query "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"'),e)break;const r=t.split("\n").find((e=>e.includes("ProxyEnable")));if(!(r&&r.trim().endsWith("1")))break;const n=t.split("\n").find((e=>e.includes("ProxyServer"))),s=n?n.split(" ").filter(Boolean).pop():"";if(!s)break;const i=s.split(":");if(i.length<=1)break;const o=i[0],a=+(i[1]||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},ys=async()=>{do{let e,t;if([e,t]=await ds.child_exec('networksetup -getwebproxy "Wi-Fi"'),e)break;const r=t.split("\n"),n=r.find((e=>e.includes("Enabled")));if(!(n&&n.includes("Yes")))break;const s=r.find((e=>e.includes("Server"))),i=r.find((e=>e.includes("Port"))),o=s?s.split(":")[1]?.trim():null,a=+((i?i.split(":")[1]?.trim():null)||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},ms=(e,t=["*"],r="DIRECT",n=[])=>{const s=e||r||"DIRECT",i=r||"DIRECT",o=`\n function FindProxyForURL(url, host) {\n if (host === "127.0.0.1" || host === "localhost") {\n return "DIRECT";\n }\n\n if (isInNet(host, "10.0.0.0", "255.0.0.0") ||\n isInNet(host, "172.16.0.0", "255.240.0.0") ||\n isInNet(host, "192.168.0.0", "255.255.0.0")) {\n return "DIRECT";\n }\n\n var _rules = ${JSON.stringify(t)};\n var _proxy = "${s}";\n var _default = "${i}";\n var _directs = ${JSON.stringify(n)};\n\n for (var i = 0; i < _rules.length; i++) {\n if (shExpMatch(host, _rules[i])) {\n return _proxy;\n }\n }\n\n for (var j = 0; j < _directs.length; j++) {\n if (shExpMatch(host, _directs[i])) {\n return "DIRECT";\n }\n }\n\n return _default;\n }\n `;return Ve.toDataUrl(o,"application/x-ns-proxy-autoconfig")},bs=(e,t,r)=>{if(!e||!t)return"";const{type:n="ALL",direct:s=!1}=r||{};let i="";switch(n?n.toUpperCase():""){case"ALL":i=`SOCKS5 ${e}:${t};PROXY ${e}:${t}`;break;case"PROXY":i=`PROXY ${e}:${t}`;break;case"SOCKS5":i=`SOCKS5 ${e}:${t}`}if(!i&&!s)return"";const o=[];return i&&o.push(i),s&&o.push("DIRECT"),o.join(";")};var ws={getSystemProxy:ps,toPacScript:ms,toPacProxy:bs,pacScript:async(e,t,r)=>{const{type:n="SOCKS5",rules:s=["*"],useSystem:i}=r||{},o=bs(e,t,{type:n});if(!o)return"";let a;if(i){const e=await ps();e&&(a=bs(e?.ipaddress||"",e?.port||0,{direct:!0}))}return ms(o,s||[],a)},getPacScript:async e=>{const{type:t="SOCKS5",rules:r=["*"],useSystem:n,address:s="",port:i=0,directs:o=[]}=e||{},a=bs(s,i,{type:t});let c;if(n){const e=await ps();e&&(c=bs(e?.ipaddress||"",e?.port||0,{direct:!0}))}return ms(a,r||[],c,o)}};const _s=(e,t)=>new Promise(((r,n)=>{f.default.readdir(e,(async(s,i)=>{if(s)return n(s);r(vs(e,i,t))}))})),vs=async(e,t,r)=>{for(let n of t){const t=`${e}\\${n}`;f.default.lstatSync(t).isDirectory()?await _s(`${t}`,r):r&&await r(t)}};var xs={...{readDirectory:_s,readFiles:vs},...hs,...ds,...ws,Ecdh:class{publicKey="";privateKey="";sharedSecret;iv="";__curve;__algorithm;__ecdh;constructor(e="prime256v1",t="aes-256-gcm"){this.__curve=e,this.__algorithm=t,this.generateKeys()}generateKeys(){const e=c.default.createECDH("prime256v1");e.generateKeys(),this.publicKey=e.getPublicKey("base64"),this.privateKey=e.getPrivateKey("base64"),this.__ecdh=e}setPrivateKey(e){return!!e&&(!!this.__ecdh&&(this.__ecdh.setPrivateKey(e,"base64"),this.publicKey=this.__ecdh.getPublicKey("base64"),!0))}setSharedSecret(e){return!!e&&(this.sharedSecret=e,!0)}deriveSharedSecret(e,t){return!!e&&(this.sharedSecret=this.__ecdh.computeSecret(e,"base64").toString("base64"),this.iv=t||"",!0)}encode(e,t){if(!this.sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Ve.base64ToBytes(r),s=c.default.createCipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),n),i=Buffer.concat([new Uint8Array(s.update(e,"utf8")),new Uint8Array(s.final())]),o=s.getAuthTag();return Buffer.concat([new Uint8Array(i),new Uint8Array(o)]).toString("base64")}encodeiv(e,t){if(!this.sharedSecret)return"";const r=t||this.iv,n=r?Ve.base64ToBytes(r):Ve.getRandomBytes(12),s=c.default.createCipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),n),i=Buffer.concat([new Uint8Array(s.update(e,"utf8")),new Uint8Array(s.final())]),o=s.getAuthTag();return Buffer.concat([new Uint8Array(i),new Uint8Array(o),n]).toString("base64")}decode(e,t){if(!e||!this.sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=c.default.createDecipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),Ve.base64ToBytes(r)),s=Ve.base64ToBytes(e),i=s.slice(s.length-16);n.setAuthTag(i);const o=s.slice(0,s.length-16);return Buffer.concat([new Uint8Array(n.update(o)),new Uint8Array(n.final())]).toString("utf-8")}decodeiv(e){if(!e||!this.sharedSecret)return"";const t=Ve.base64ToBytes(e);if(t.length<28)return"";const r=t.slice(t.length-12),n=t.slice(t.length-28,t.length-12),s=c.default.createDecipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),r);s.setAuthTag(n);const i=t.slice(0,t.length-28);return Buffer.concat([new Uint8Array(s.update(i)),new Uint8Array(s.final())]).toString("utf-8")}},EcdhWeb:class extends us{constructor(e="P-256",t="raw"){super(e,t),this.__subtle=c.default.webcrypto.subtle}},Socks5:class{upstreamProxy;server=null;clientSockets=new Set;systemProxy=null;useSystemProxy=!1;__debug=!1;__uuid;__port=0;__event;__pipeline;__logger;__totalReceived=0;__totalSent=0;__rules=[];constructor(e,t=!1,r){this.__event=new m,this.upstreamProxy=this.filterProxyConfigs(e),this._updateRules(),this.__debug=t,this.__uuid=y(),this.__pipeline=new Se(1),this.__logger=r||console}get id(){return this.__uuid}get port(){return this.__port}get url(){return this.__port?`socks5://127.0.0.1:${this.__port}`:""}get totalReceived(){return this.__totalReceived}get totalSent(){return this.__totalSent}get rules(){return this.__rules}validateProxyConfig(e){const{ipaddress:t,port:r,userId:n,password:s}=e||{};return t&&"string"==typeof t?r&&"number"==typeof r?n&&"string"==typeof n?s&&"string"==typeof s?"":"无效的上游代理密码":"无效的上游代理用户名":"无效的上游代理端口":"无效的上游代理 IP 地址"}filterProxyConfigs(e){let t=[];t=e&&Array.isArray(e)?e:[e];const r=[];for(const e of t)this.validateProxyConfig(e)||r.push(e);return r}async start(e=8838){if(this.upstreamProxy.length<=0)return 0;if(this.server)return this.__debug&&console.info("[socks5] server is already running"),this.__port;const t=await this.findAvailablePort(e);return t?(this.__port=t,this.server=u.default.createServer((e=>this.handleSocksConnection(e))),this.server.listen(t,(()=>{this.__debug&&this.__logger?.info(`[socks5] server is running on port ${t}`)})),this.server.on("error",(e=>{this.__logger?.error("[socks5] server error:",e),this.close()})),t):0}setUpstreamProxy(e){if(!e)return!1;const t=this.filterProxyConfigs(e);return!(!t||t.length<=0)&&(this.upstreamProxy=t,this._updateRules(),!0)}setSystemProxy(e,t){this.useSystemProxy=e,e&&t&&t.ipaddress&&t.port&&(this.systemProxy=t)}async findAvailablePort(e,t=200){let r=e,n=0;for(;n<t;)try{return await new Promise(((e,t)=>{const n=u.default.createServer();n.unref(),n.on("error",t),n.listen(r,(()=>{n.close((()=>e()))}))})),r}catch{n++,r++}return this.__debug&&this.__logger?.warn("[socks5] findAvailablePort failed"),0}async handleSocksConnection(e){let t="";try{if(!e)return;this.clientSockets.add(e),e.on("close",(()=>{this.clientSockets.delete(e),e?.destroy()})),await this.performHandshake(e);const r=await this.parseClientRequest(e),n=r.addr;t=`${n}:${r.port}`,this.__debug&&this.__logger?.info("[socks5] connection",t);const s=this.findProxyConfig(n);if(s){const n=await this.connectToUpstreamProxy(r,s);this.__logger?.info(`[socks5] connection upstream ${t}, use ${s.ipaddress}:${s.port}`),this.setupDataForwarding(e,n,"upstream")}else if(this.useSystemProxy&&this.systemProxy&&!xr.isLocalIpAddress(n)){const n=await this.connectToSystemProxy(r);this.__debug&&console.info("[socks5] connection system",t),this.setupDataForwarding(e,n,"system")}else{this.__debug&&console.info("[socks5] connection local",t);const n=await this.connectToLocal(r);this.setupDataForwarding(e,n,"local")}}catch(r){this.__debug&&this.__logger?.error("[socks5] connection failed:",r),e.end(new Uint8Array([5,1])),this._emit("error",r,t)}}performHandshake(e){return new Promise(((t,r)=>{e.once("data",(n=>{if(5!==n[0])return r(new Error("Unsupported SOCKS version"));e.write(new Uint8Array([5,0])),t()}))}))}parseClientRequest(e){return new Promise(((t,r)=>{e.once("data",(e=>{let n,s;if(1!==e[1])return r(new Error("Unsupported command"));if(1===e[3])n=e.slice(4,8).join("."),s=e.readUInt16BE(8);else{if(3!==e[3])return r(new Error("Unsupported address type"));{const t=e[4];n=e.slice(5,5+t).toString(),s=e.readUInt16BE(5+t)}}t({addr:n,port:s})}))}))}async connectToUpstreamProxy(e,t){const r={proxy:{ipaddress:t.ipaddress,port:t.port,type:5,userId:t.userId,password:t.password},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(r)}catch(e){throw new Error("Failed to connect to upstream proxy: "+e)}}async connectToSystemProxy(e){const t={proxy:{...this.systemProxy,type:5},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(t)}catch(e){throw new Error("Failed to connect to system proxy: "+e)}}async connectToProxy(e){const{socket:t}=await s.SocksClient.createConnection(e);return t}async connectToLocal(e){return new Promise(((t,r)=>{const n=u.default.createConnection(e.port,e.addr,(()=>{t(n)}));n.on("error",(e=>{r(e)}))}))}setupDataForwarding(e,t,r="local"){e.write(new Uint8Array([5,0,0,1,0,0,0,0,0,0])),e.pipe(t),t.pipe(e);const n=`${t.localAddress}:${t.localPort}`;this.__debug&&console.info(`[socks5] setupDataForwarding ${n}`),"upstream"===r&&(t.on("data",(e=>{this.__totalSent+=e.length})),e.on("data",(e=>{this.__totalReceived+=e.length}))),e.on("close",(()=>{this.__debug&&console.info("[socks5] client socket close",n),t.end()})),t.on("close",(()=>{this.__debug&&console.info("[socks5] target socket close",n),e.end()})),e.on("error",(e=>{this.__debug&&console.error("[socks5] client socket error:",e?.message),t.end()})),t.on("error",(t=>{this.__debug&&console.error("[socks5] target socket error:",t?.message),e.end()}))}findProxyConfig(e){if(!xr.isLocalIpAddress(e))for(const t of this.upstreamProxy)if(this.isAllowedDomain(e,t.rules||[]))return t}isAllowedDomain(e,t){if(xr.isLocalIpAddress(e))return!1;if(!t||!Array.isArray(t))return!1;for(const r of t){if("*"===r)return!0;if(xr.shExpMatch(e,r))return!0}return!1}close(){try{if(!this.server)return;this.__debug&&this.__logger?.info("[socks5] closing SOCKS5 proxy server..."),this.server.close((e=>{e&&this.__debug&&this.__logger?.error("[socks5] closing the server failed:",e)})),this.clientSockets.forEach((e=>e?.destroy())),this.clientSockets.clear(),this.server=null,this.__port=0}catch(e){this.__debug&&this.__logger?.error("[socks5] close error:",e)}}on(e,t){e&&t&&(this.__event.off(e,t),this.__event.on(e,t))}off(e,t){e&&this.__event.off(e,t)}resetStatistics(){this.__totalReceived=0,this.__totalSent=0}_emit(e,...t){try{if(!e)return;this.__event.emit(e,...t)}catch(e){}}_updateRules(){this.upstreamProxy&&(this.__rules=ln.distinct(this.upstreamProxy.reduce(((e,t)=>e.concat(t?.rules||[])),[])))}},rsa:Qe};const As={...xs};var Ss={ossImage:(e,t={})=>{if(!e)return e;const r=xr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=ln.toList(t.domain||""),n=e.match(/^http[s]?:\/\/([\w.]+)[\w\W]+/)[1]||"";if(!n||!r.includes(n))return e}const n=[];return t.webp&&!r.endsWith(".gif")&&n.push("format,webp"),t.resize&&n.push(`resize,s_${t.resize}`),t.interlace&&(n.push("interlace,1"),!n.every((e=>!e.startsWith("format")))||r.endsWith(".gif")||r.endsWith(".jpg")||n.push("format,jpg")),n.length<=0?e:`${r}?x-oss-process=image/${n.join("/")}`},ossSnapshot:(e,t={})=>{if(!e)return e;const r=xr.parseUrl(e).url,n=["snapshot"],{m:s="fast",f:i="jpg"}=t;return(t.t||0===t.t)&&n.push(`t_${t.t}`),t.w&&n.push(`w_${t.w}`),t.h&&n.push(`h_${t.h}`),s&&n.push(`m_${s}`),i&&n.push(`f_${i}`),t.ar&&n.push(`ar_${t.ar}`),`${r}?x-oss-process=video/${n.join(",")}`},ossBase64:e=>je.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const ks={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},Cs=e=>(...t)=>{const r=console[e];ks.overrode?r(...t):$s(r,e,...t)},$s=(e,t,...r)=>{const n=Or.format(new Date,ks.format),s=ks.tag?`[${t}]`:"";s&&n?e.apply(console,[`${n} ${s}`,...r]):n?e.apply(console,[`${n}`,...r]):s?e.apply(console,[`${s}`,...r]):e.apply(console,[...r])};var js={override:()=>{if(ks.overrode)return;ks.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{$s(t,e,...r)}}))},log:Cs("log"),info:Cs("info"),warn:Cs("warn"),error:Cs("error"),config:({tag:e=ks.tag,format:t=ks.format}={})=>{ks.tag=e,ks.format=t}};class Os{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=ar.debounce((e=>{if(this.key&&this.storage)try{const{setItem:t,setStorageSync:r}=this.storage;if(r)return r(this.key,e);if(t)return t(this.key,JSON.stringify(e))}catch(e){console.error("persit save ",e)}}));read(){if(this.key&&this.storage)try{const{getItem:e,getStorageSync:t}=this.storage;if(t)return t(this.key);if(e){const t=e(this.key);return JSON.parse(t)}}catch(e){return void console.error("persit read ",e)}}handleSave(e,t){if(!this.fields.includes(t)||!e)return;const r=dr.copy(e,{fields:this.fields});this.save(r)}}class Es extends m{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!ee.isFunction(n))return;const[,s]=await ar.run(n({...r,commit:r.commit.bind(r),query:r.query.bind(r),dispatch:r.dispatch.bind(r)},t));return s}async query(e){const t=Reflect.get(this,e);let r;if(null!=t&&""!==t)r=dr.copy(t);else{const[,t]=await ar.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){ee.isObject(t)&&(t=dr.copy(t)),this[e]=t}}const Ps=(e,t)=>{const r=Object.assign(new Es,e||{});r.__persist=new Os(t||r.persist);const n=r.__persist.read(),s=n?Object.assign(r,n):r;return new Proxy(s,{get:(e,t,r)=>{const n=Reflect.get(e.getters,t);return ee.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(ee.isFunction(s)&&!s(e,r))return!0;const i=Reflect.set(e,t,r,n);return i&&(e.emit(t.toString(),r),e?.__persist?.handleSave(e,t.toString())),i},has:(e,t)=>Reflect.has(e,t)})};class Ts{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=xr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=xr.stringify(s,{uri:!1});this.list.push(`${e}?${i}`)}_parseHost(e){e&&!this.host&&/^http[s]?:\/\/([\w.]+)/.test(e)&&(this.host=e.replace(/^http[s]?:\/\/([\w.]+)[\w\W]+/,"$1"))}image(e,t={}){if(!e||!e.includes(this.host))return;if(this.list.length<=0)return;const r={g:"nw",...t},n=e.replace(/^http[s]?:\/\/[\w.]+\/([\w-.,_/?%&=]+)$/,"$1"),s=Tr.base64.encodeByOss(n),i=xr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=Tr.base64.encodeByOss(e),i=xr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}class qs{__list=[];constructor(){this.clear()}add(e){const t=ar.run(e);return this.__list.push(t),this}clear(){return this.__list=[],this}wait(){const e=this.__list;return this.clear(),Promise.allSettled(e)}}const Bs=new class{state=Ps(new Es);frame=new Ar;cache=new Map;cacheTime=new Map;setCache=(e,t)=>null!=t&&(!!e&&(this.cache.set(e,t),this.cacheTime.set(e,Date.now()),!0));hasCache=e=>{if(!e)return!1;this.cache.has(e)};getCache=e=>{if(e)return this.cache.get(e)};getCacheTime=e=>e&&this.cacheTime.get(e)||0;removeCache=e=>{e&&(this.cache.delete(e),this.cacheTime.delete(e))};cacheId=e=>`_${e}_cache_`;timesRecord=(e,t={})=>{if(!e)return;const{mode:r="running",cycle:n="day"}=t||{},s=this.cacheId(r),i=this.getCache(s)||{},o=Date.now(),a=i[e],c={time:o,count:1,cycle:n};return a&&("day"!==n||Or.isToday(a.time||0))&&(c.count=1+(a.count||0)),i[e]=c,this.setCache(s,i),i};timesValid=(e,t={})=>{if(!e)return!1;const{max:r=1,interval:n=0,mode:s="running",cycle:i="day"}=t||{},o=this.cacheId(s);let a=this.getCache(o);if(!a)return!0;const c=a[e];if(!c)return!0;if("day"===i&&!Or.isToday(c.time||0))return!0;if(r<=(c.count||0))return!1;return!(Date.now()-(c.time||0)<n)};timesClean=(e="running")=>{const t=this.cacheId(e),r=this.getCache(t);if(!r)return;const n=cn.copy(r);cn.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||Or.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new qs};class Ls{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=y(),this.start=Date.now(),this.timeStartDesc=Or.format(this.start,"hh:mm:ss.SSS")}get time(){return this.flag?this.end:this.start}get timeDesc(){return this.flag?this.timeEndDesc:this.timeStartDesc}done=(e=Date.now())=>{this.start&&(this.end=e,this.cost=this.end-this.start,this.timeEndDesc=Or.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const Rs=new class{__map=new Map;__trackList=[];opened=!0;clear(){return this.__map.clear(),this.__trackList=[],this}add(e,{desc:t="",type:r=""}={}){if(!e||!this.opened)return"";const n=new Ls;return n.name=e,n.type=r,n.desc=t,this.__trackList.push(n),n.id}done(e){if(!e||!this.opened)return;const t=this.__trackList.find((t=>t.id===e));if(!t||t.isDone)return;t.done();const r=dr.cloneClass(t);r.id=this._endId(e),r.flag=1,r.desc=`${t.desc} | end`,this.__trackList.push(r)}getTrack(e){return this.__trackList.find((t=>t.id===e))}getLine(e){if(!e||e.endsWith("-end"))return[];const t=this.__trackList.findIndex((t=>t.id===e));if(t<0)return[];const r=this._endId(e),n=this.__trackList.findIndex((e=>e.id===r)),s=n<0?this.__trackList.length-t:n-t+1;return ln.take(this.__trackList,s,t)}getList(e,t=""){if(!e)return[];const r=this.__trackList.filter((t=>t.name===e));if(r.length<=0)return[];if(!t)return r;const n=this._endId(t);return this.__trackList.filter((e=>e.id===t||e.id===n))}get list(){return this.__trackList}get size(){return this.__trackList.length}_endId=e=>`${e}-end`;report(e){const t=this.list;if(!t||t.length<=0)return;const r=t[0].time;t.forEach((t=>e&&e(t,r)))}},Fs={cdn:Ss,watermark:(e,t)=>new Ts(e,t)},Us={Store:Es,storeRef:Ps,Persist:Os,persistConfig:(e,t,r)=>({key:e,fields:t,storage:r})},Ds=Bs,Is=Rs,Ms=js;e.Event=m,e.KValue=b,e.Mapping=class{_map=new Map;constructor(){this._map.clear()}get keys(){return Array.from(this._map.keys())}get values(){return Array.from(this._map.values())}get(e){if(!e)return;const t=this._map.get(e);return t?t.value:void 0}getKV(e){if(e)return this._map.get(e)}set(e,t){if(!e)return;const r=this._map.get(e);r?(r.set(t),this.clean()):this._map.set(e,new b(e,t))}delete(e,t){if(!e)return;const r=this._map.get(e);t&&t(r?.value),this._map.delete(e)}clear(){this._map.clear()}clean(e=100,t){try{if(this._map.size<=e)return;if(this.keys.filter((e=>{if(!this._map.has(e))return!1;const t=this._map.get(e);return!t||!t.value})).forEach((e=>{this._map.delete(e)})),this._map.size<=e)return;const r=this.values.sort(((e,t)=>e.timestamp-t.timestamp)),n=r.length-e;if(n<=0)return;r.splice(0,n).forEach((e=>{this.delete(e.key,t)}))}catch(e){console.log("mapping clean",e)}}},e.dCdn=Fs,e.dHook=Gr,e.dJoker=Ds,e.dLogger=Ms,e.dMini=ss,e.dNode=As,e.dStore=Us,e.dTracker=Is,e.dUtil=Bn,e.dWeb=fs,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("crypto"),require("zlib"),require("net"),require("socks"),require("child_process"),require("fs")):"function"==typeof define&&define.amd?define(["exports","crypto","zlib","net","socks","child_process","fs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ddan=e.ddan||{},e.crypto$1,e.zlib,e.net,e.socks,e.child_process,e.fs)}(this,(function(e,t,r,n,s,i,o){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(t),l=a(r),u=a(n),f=a(o);const h="0123456789",d="abcdefghijklmnopqrstuvwxyz",p="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var g={keyNumber:h,keyLower:d,keyUpper:p,keyChars:h+d+p};const y=(e=0,t=0)=>{const r=g.keyChars.split(""),n=[];let s;if(t=t||r.length,e)for(s=0;s<e;s++)n[s]=r[0|Math.random()*t];else{let e;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",s=0;s<36;s++)n[s]||(e=0|16*Math.random(),n[s]=r[19==s?3&e|8:e])}return n.join("")};class m{__map;__tagList;__eventId="";constructor(){this.__map=new Map,this.__tagList=[],this.__eventId=y()}clear(){return this.__map.clear(),this}on(e,t,r=""){if(!e||!t)return this;let n=this.__map.get(e);return n||(n=new Set,this.__map.set(e,n)),n.add(t),r&&this.__tagList.push({name:e,listener:t,tag:r}),this}emit(e,...t){if(!e)return this;const r=this.__map.get(e);if(!r)return this;return[...r].forEach((e=>e&&e(...t))),this}off(e,t){if(!e||!t)return this;this.__tagList=this.__tagList.filter((r=>r.name!==e||r.listener!==t));const r=this.__map.get(e);return r?(r.delete(t),r.size<=0&&this.__map.delete(e),this):this}remove(e){return e?(this.__tagList=this.__tagList.filter((t=>t.name!==e)),this.__map.delete(e),this):this}removeByTag(e){if(!e)return this;return this.__tagList.filter((t=>t.tag===e)).forEach((e=>{this.off(e.name,e.listener)})),this.__tagList=this.__tagList.filter((t=>t.tag!==e)),this}once(e,t){const r=(...n)=>{t(...n),this.off(e,r)};return this.on(e,r),this}has(e){return this.__map.has(e)}}class b{timestamp=0;_key="";_value;constructor(e,t){this._key=e,this._value=t,this.updateAt()}get key(){return this._key}get value(){return this._value}set(e){this._value=e,this.updateAt()}updateAt(){this.timestamp=Date.now()}clear(){this.set(void 0)}}const w="object"==typeof global&&null!==global&&global.Object===Object&&global,_="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,v="object"==typeof self&&null!==self&&self.Object===Object&&self,x=_||w||v||Function("return this")(),A=x.Symbol,{toString:S,hasOwnProperty:k,propertyIsEnumerable:C}=Object.prototype,$=A?A.toStringTag:void 0;function j(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":$&&$ in Object(e)?function(e){const t=k.call(e,$),r=e[$];let n=!1;try{e[$]=void 0,n=!0}catch(e){}const s=S.call(e);return n&&(t?e[$]=r:delete e[$]),s}(e):S.call(e)}var O={getTag:j,getType:function(e){return(j(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:S,hasOwnProperty:k,propertyIsEnumerable:C};const E="object"==typeof e&&null!==e&&!e.nodeType&&e,P=E&&"object"==typeof module&&null!==module&&!module.nodeType&&module,T=P&&P.exports===E&&w.process,q=(()=>{try{const e=P&&P.require&&P.require("util").types;return e||T&&T.binding&&T.binding("util")}catch(e){}})();var B="[object Function]",L="[object GeneratorFunction]",R="[object AsyncFunction]",F=9007199254740991;const U=/^(?:0|[1-9]\d*)$/,D=x?.Buffer?.isBuffer,I=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,M=q&&q.isTypedArray;function K(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function z(e){return null!=e&&"object"==typeof e}const N=Array.isArray;function H(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=F}(e.length)&&!W(e)}function V(e){return z(e)&&H(e)}function W(e){var t=K(e)?O.getTag(e):"";return t===B||t===L||t===R}function Z(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function Y(e){return V(e)&&O.hasOwnProperty.call(e,"callee")&&(!O.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==O.toString.call(e))}const J="undefined"!=typeof window&&void 0!==window.document,Q="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,G=M?e=>M(e):e=>z(e)&&I.test(O.getTag(e)),X="function"==typeof D?D:()=>!1;var ee={is:function(e,t){return O.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===O.getTag(e)},isString:function(e){return"string"==typeof e||!N(e)&&z(e)&&"[object String]"==O.getTag(e)},isObject:K,isObjectLike:z,isPlainObject:function(e){if(!z(e)||"[object Object]"!=O.getTag(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},isSymbol:function(e){return"symbol"==typeof e||z(e)&&"[object Symbol]"===O.getTag(e)},isFunction:W,isArray:N,isArrayLikeObject:V,isIndex:function(e,t){return!!(t=null==t?F:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:H,isPrototype:Z,isArguments:Y,isPromise:function(e){return"[object Promise]"===(K(e)?O.getTag(e):"")},isBrowser:J,isNode:Q,isBlobOrBuffer:e=>e instanceof Blob||e instanceof ArrayBuffer,isUint8Array:e=>e instanceof Uint8Array,isArrayBuffer:e=>e instanceof ArrayBuffer,isEmpty:e=>{if(null==e)return!0;if(H(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||X(e)||G(e)||Y(e)))return!e.length;const t=O.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(Z(e))return!Object.keys(e).length;for(const t in e)if(O.hasOwnProperty.call(e,t))return!1;return!0}};const te=NaN,re=/^\s+|\s+$/g,ne=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,ie=/^0o[0-7]+$/i,oe=parseInt,ae=1/0,ce=17976931348623157e292;function le(e){if("number"==typeof e)return e;if(ee.isSymbol(e))return te;if(ee.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=ee.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(re,"");const t=se.test(e);return t||ie.test(e)?oe(e.slice(2),t?2:8):ne.test(e)?te:+e}function ue(e){return e?(e=le(e))===ae||e===-ae?(e<0?-1:1)*ce:e==e?e:0:0===e?e:0}var fe={toNumber:le,toFinite:ue,toInteger:function(e){var t=ue(e),r=t%1;return t==t?r?t-r:t:0}};const he="Expected a function",de=Math.max,pe=Math.min;function ge(e,t=300,r={}){let n,s,i,o,a,c,l=0,u=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(he);function d(t){const r=n,i=s;return n=s=void 0,l=t,o=e.apply(i,r),o}function p(e){const r=e-c;return void 0===c||r>=t||r<0||f&&e-l>=i}function g(){const e=Date.now();if(p(e))return y(e);a=setTimeout(g,function(e){const r=t-(e-c);return f?pe(r,i-(e-l)):r}(e))}function y(e){return a=void 0,h&&n?d(e):(n=s=void 0,o)}function m(...e){const r=Date.now(),i=p(r);if(n=e,s=this,c=r,i){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),u?d(e):o}(c);if(f)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=fe.toNumber(t)||0,ee.isObject(r)&&(u=!!r.leading,f="maxWait"in r,i=f?de(fe.toNumber(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h),m.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=c=s=a=void 0},m.flush=function(){return void 0===a?o:y(Date.now())},m.pending=function(){return void 0!==a},m}class ye{__list=[];constructor(e){this.push(e)}push(e){return e&&this.__list.push(e),this}clear(){return this.__list=[],this}_exec(e,t){let r;if(ee.isFunction(e))r=e(t);else{if(ee.isPromise(e))return e.then((e=>({...t,...e})));r=e}return ee.isPromise(r)?r:Promise.resolve({...r,...t})}run(e){try{return this.__list.reduce(((e,t)=>e.then((e=>this._exec(t,e)))),Promise.resolve(e)).then((e=>[void 0,e])).catch((e=>[e,void 0]))}catch(e){return Promise.reject([e,void 0])}}}async function me(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const be=(e,t)=>{try{let r;return r=ee.isFunction(e)?e():e,me(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},we=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var _e={to:me,go:(e,t)=>be(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:be,toError:we,timeout:(e,t=0,r="timeout")=>{if(t<=0)return be(e);let n;function s(){n&&clearTimeout(n)}const i=new Promise((e=>{s(),n=setTimeout((()=>e([we(r||"timeout"),void 0])),t)}));return Promise.race([be(e,s),i])}};class ve{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var xe={singleton:function(){class e{static __instance__;constructor(){}static get Instance(){return e.__instance__||(e.__instance__=new this),e.__instance__}static get I(){return this.Instance}}return e},getset:function(e){const t=new ve;return void 0!==e&&t.set(e),t}};class Ae{_func;_callback;constructor(e,t){this._func=e,this._callback=t}async run(){return _e.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class Se{__list=[];__count=0;__max=1;constructor(e=1){this.__count=0,this.__max=e>0?e:1,this.clear()}push(e,t){const r=new Ae(e,t);return this.__list.push(r),this._step(),this}clear(){return this.__list=[],this.__count=0,this}_step(){if(this.__list.length<=0)return;if(this.__count>=this.__max)return;const e=this.__list.shift();e?(this.__count+=1,e?.run().finally((()=>{try{this.__count>0&&(this.__count-=1),this._step()}catch(e){console.error("[ddan] pipepine step finally",e)}}))):this._step()}async whenAll(){for(;;){if(this.__count<=0)break;await _e.delay(100),this._step()}return this.clear()}}class ke extends(xe.singleton()){__lockedMap=new Map;pipeline=new Se;constructor(){super()}lock(e,t){if(!e||!t)return;const r=_e.safeRun(t);return this.__lockedMap.set(e,r),r}unlock(e){e&&this.__lockedMap.has(e)&&this.__lockedMap.delete(e)}async exec(e,t){if(!e||!t)return _e.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return _e.safeRun(e);const s=await n;return this.unlock(t),s}}var Ce={toUtf8:e=>{if(!e)return"";const t=e.replace(/\r\n/g,"\n");let r="";for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r+=String.fromCharCode(n):n>127&&n<2048?(r+=String.fromCharCode(n>>6|192),r+=String.fromCharCode(63&n|128)):(r+=String.fromCharCode(n>>12|224),r+=String.fromCharCode(n>>6&63|128),r+=String.fromCharCode(63&n|128))}return r},fromUtf8:e=>{let t="",r=0;if(!e)return"";let n=0,s=0,i=0;for(;r<e.length;)n=e.charCodeAt(r),n<128?(t+=String.fromCharCode(n),r++):n>191&&n<224?(s=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&s),r+=2):(s=e.charCodeAt(r+1),i=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3);return t},toUtf8Bytes:e=>{if(!e)return new Uint8Array;const t=e.replace(/\r\n/g,"\n"),r=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r.push(n):n<2048?(r.push(n>>6|192),r.push(63&n|128)):(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128))}return new Uint8Array(r)},fromUtf8Bytes:e=>{let t="",r=0;if(!e||e.length<=0)return"";for(;r<e.length;){let n=e[r];if(n<128)t+=String.fromCharCode(n),r++;else if(n>191&&n<224){const s=e[r+1];t+=String.fromCharCode((31&n)<<6|63&s),r+=2}else{const s=e[r+1],i=e[r+2];t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3}}return t}};const $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var je={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=Ce.toUtf8(e);l<e.length;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+$e.charAt(s)+$e.charAt(i)+$e.charAt(o)+$e.charAt(a);return c},fromBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=$e.indexOf(e.charAt(l++)),i=$e.indexOf(e.charAt(l++)),o=$e.indexOf(e.charAt(l++)),a=$e.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c+=String.fromCharCode(t),64!=o&&(c+=String.fromCharCode(r)),64!=a&&(c+=String.fromCharCode(n));return c=Ce.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",l=0;if(!e||!ee.isArrayLike(e)||!ee.isUint8Array(e))return"";for(;l<e.length;)t=e[l++],r=e[l++],n=e[l++],s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+$e.charAt(s)+$e.charAt(i)+$e.charAt(o)+$e.charAt(a);return c},base64ToBytes:(e="")=>{let t,r,n,s,i,o,a,c=[],l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=$e.indexOf(e.charAt(l++)),i=$e.indexOf(e.charAt(l++)),o=$e.indexOf(e.charAt(l++)),a=$e.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c.push(t),64!=o&&c.push(r),64!=a&&c.push(n);return new Uint8Array(c)}};function Oe(e){return Math.floor(Math.random()*e)}function Ee(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Pe=180/Math.PI;var Te={random:Oe,randomRange:function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},lerp:function(e,t,r){return e*(1-r)+t*r},randoms:function(e,t=1,r=!1){const n=[];for(;;){if(n.length>=t)break;if(!r&&n.length>=e)break;const s=Oe(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:Ee,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=Ee(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Pe},degree2radian:function(e){return e/Pe},calcDataSize:function(e){const t={gb:0,mb:0,kb:0,b:0,total:e,desc:""},r=[{name:"gb",divisor:1<<30},{name:"mb",divisor:1<<20},{name:"kb",divisor:1024},{name:"b",divisor:1}];for(const n of r){const r=Math.floor(e/n.divisor);t[n.name]=r,e-=r*n.divisor}return t.gb>0?t.desc=(t.gb+t.mb/1024).toFixed(2)+"GB":t.mb>0?t.desc=(t.mb+t.kb/1024).toFixed(2)+"MB":t.kb>0?t.desc=(t.kb+t.b/1024).toFixed(2)+"KB":t.desc=t.b+"B",t}};var qe={bytes2str:e=>{if(!e||!ee.isArrayLike(e))return"";return e.reduce(((e,t)=>e+String.fromCharCode(t)),"")},str2bytes:(e="")=>{const t=e,r=new Uint8Array(t.length);for(let e=0,n=t.length;e<n;e++)r[e]=t.charCodeAt(e);return r},str2hex:e=>{let t="";for(let r=0;r<e.length;r++)t+=e.charCodeAt(r).toString(16).padStart(2,"0");return t},hex2str:e=>{let t="";for(let r=0;r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},concatBytes:(...e)=>{const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r},uint32ToBytes:e=>{const t=new Uint8Array(8);return t[0]=e[0]>>>24&255,t[1]=e[0]>>>16&255,t[2]=e[0]>>>8&255,t[3]=255&e[0],t[4]=e[1]>>>24&255,t[5]=e[1]>>>16&255,t[6]=e[1]>>>8&255,t[7]=255&e[1],t},bytesToUint32:e=>{const t=new Uint32Array(2);return t[0]=e[0]<<24|e[1]<<16|e[2]<<8|e[3],t[1]=e[4]<<24|e[5]<<16|e[6]<<8|e[7],t},hex2bytes:e=>{let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++)t[r]=parseInt(e.substr(2*r,2),16);return t},bytes2hex:e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""),toUint32:e=>{const t=Math.ceil(e.length/4),r=new Uint32Array(t);for(let n=0;n<t;n++)r[n]=e.charCodeAt(4*n)<<24|e.charCodeAt(4*n+1)<<16|e.charCodeAt(4*n+2)<<8|e.charCodeAt(4*n+3);return r},fromUint32:e=>{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]>>>24&255,e[r]>>>16&255,e[r]>>>8&255,255&e[r]);return t.replace(/\0+$/,"")},flatten:function e(t,r=!1,n=[]){for(let s=0;s<t.length;s+=1){const i=t[s];r&&Array.isArray(i)?e(i,r,n):n.push(i)}return n}};var Be={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return qe.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};function Le(e,t){return e<<t|e>>>32-t}function Re(e,t){let r,n,s,i,o;return s=2147483648&e,i=2147483648&t,r=1073741824&e,n=1073741824&t,o=(1073741823&e)+(1073741823&t),r&n?2147483648^o^s^i:r|n?1073741824&o?3221225472^o^s^i:1073741824^o^s^i:o^s^i}function Fe(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return e&t|~e&r}(t,r,n),s),o)),Re(Le(e,i),t)}function Ue(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return e&r|t&~r}(t,r,n),s),o)),Re(Le(e,i),t)}function De(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return e^t^r}(t,r,n),s),o)),Re(Le(e,i),t)}function Ie(e,t,r,n,s,i,o){return e=Re(e,Re(Re(function(e,t,r){return t^(e|~r)}(t,r,n),s),o)),Re(Le(e,i),t)}function Me(e){let t,r,n="",s="";for(r=0;r<=3;r++)t=e>>>8*r&255,s="0"+t.toString(16),n+=s.substr(s.length-2,2);return n}function Ke(e){let t,r,n,s,i,o,a,c,l,u=[];for(u=function(e){let t;const r=e.length,n=r+8,s=16*((n-n%64)/64+1),i=Array(s-1).fill(0);let o=0,a=0;for(;a<r;)t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|e[a]<<o,a++;return t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|128<<o,i[s-2]=r<<3,i[s-1]=r>>>29,i}(e),o=1732584193,a=4023233417,c=2562383102,l=271733878,t=0;t<u.length;t+=16)r=o,n=a,s=c,i=l,o=Fe(o,a,c,l,u[t+0],7,3614090360),l=Fe(l,o,a,c,u[t+1],12,3905402710),c=Fe(c,l,o,a,u[t+2],17,606105819),a=Fe(a,c,l,o,u[t+3],22,3250441966),o=Fe(o,a,c,l,u[t+4],7,4118548399),l=Fe(l,o,a,c,u[t+5],12,1200080426),c=Fe(c,l,o,a,u[t+6],17,2821735955),a=Fe(a,c,l,o,u[t+7],22,4249261313),o=Fe(o,a,c,l,u[t+8],7,1770035416),l=Fe(l,o,a,c,u[t+9],12,2336552879),c=Fe(c,l,o,a,u[t+10],17,4294925233),a=Fe(a,c,l,o,u[t+11],22,2304563134),o=Fe(o,a,c,l,u[t+12],7,1804603682),l=Fe(l,o,a,c,u[t+13],12,4254626195),c=Fe(c,l,o,a,u[t+14],17,2792965006),a=Fe(a,c,l,o,u[t+15],22,1236535329),o=Ue(o,a,c,l,u[t+1],5,4129170786),l=Ue(l,o,a,c,u[t+6],9,3225465664),c=Ue(c,l,o,a,u[t+11],14,643717713),a=Ue(a,c,l,o,u[t+0],20,3921069994),o=Ue(o,a,c,l,u[t+5],5,3593408605),l=Ue(l,o,a,c,u[t+10],9,38016083),c=Ue(c,l,o,a,u[t+15],14,3634488961),a=Ue(a,c,l,o,u[t+4],20,3889429448),o=Ue(o,a,c,l,u[t+9],5,568446438),l=Ue(l,o,a,c,u[t+14],9,3275163606),c=Ue(c,l,o,a,u[t+3],14,4107603335),a=Ue(a,c,l,o,u[t+8],20,1163531501),o=Ue(o,a,c,l,u[t+13],5,2850285829),l=Ue(l,o,a,c,u[t+2],9,4243563512),c=Ue(c,l,o,a,u[t+7],14,1735328473),a=Ue(a,c,l,o,u[t+12],20,2368359562),o=De(o,a,c,l,u[t+5],4,4294588738),l=De(l,o,a,c,u[t+8],11,2272392833),c=De(c,l,o,a,u[t+11],16,1839030562),a=De(a,c,l,o,u[t+14],23,4259657740),o=De(o,a,c,l,u[t+1],4,2763975236),l=De(l,o,a,c,u[t+4],11,1272893353),c=De(c,l,o,a,u[t+7],16,4139469664),a=De(a,c,l,o,u[t+10],23,3200236656),o=De(o,a,c,l,u[t+13],4,681279174),l=De(l,o,a,c,u[t+0],11,3936430074),c=De(c,l,o,a,u[t+3],16,3572445317),a=De(a,c,l,o,u[t+6],23,76029189),o=De(o,a,c,l,u[t+9],4,3654602809),l=De(l,o,a,c,u[t+12],11,3873151461),c=De(c,l,o,a,u[t+15],16,530742520),a=De(a,c,l,o,u[t+2],23,3299628645),o=Ie(o,a,c,l,u[t+0],6,4096336452),l=Ie(l,o,a,c,u[t+7],10,1126891415),c=Ie(c,l,o,a,u[t+14],15,2878612391),a=Ie(a,c,l,o,u[t+5],21,4237533241),o=Ie(o,a,c,l,u[t+12],6,1700485571),l=Ie(l,o,a,c,u[t+3],10,2399980690),c=Ie(c,l,o,a,u[t+10],15,4293915773),a=Ie(a,c,l,o,u[t+1],21,2240044497),o=Ie(o,a,c,l,u[t+8],6,1873313359),l=Ie(l,o,a,c,u[t+15],10,4264355552),c=Ie(c,l,o,a,u[t+6],15,2734768916),a=Ie(a,c,l,o,u[t+13],21,1309151649),o=Ie(o,a,c,l,u[t+4],6,4149444226),l=Ie(l,o,a,c,u[t+11],10,3174756917),c=Ie(c,l,o,a,u[t+2],15,718787259),a=Ie(a,c,l,o,u[t+9],21,3951481745),o=Re(o,r),a=Re(a,n),c=Re(c,s),l=Re(l,i);return Me(o)+Me(a)+Me(c)+Me(l)}const ze=e=>{if("string"!=typeof e&&!(e instanceof Uint8Array))return"";return Ke("string"==typeof e?Ce.toUtf8Bytes(e):e)};var Ne={md5:ze,md5Base64:e=>{const t=ze(e);if(!t)return"";const r=qe.hex2bytes(t);return je.bytesToBase64(r)}};const He=(e,t=!1)=>{const r=new Uint8Array(e);return t?je.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Ve={...qe,...Be,...Ce,...je,...Ne,str2ab:(e="",t=!1)=>{if(t)return je.base64ToBytes(e).buffer;{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0,n=e.length;t<n;t++)r[t]=e.charCodeAt(t);return t}},ab2str:He,utf8ToBase64:e=>ee.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>ee.isBrowser?atob(e):Buffer.from(e,"base64").toString("utf-8"),getRandomBytes:e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=Te.random(256);return t},textEncode:e=>Ce.toUtf8Bytes(e),textDecode:e=>Ce.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+je.toBase64(e):ee.isArrayBuffer(e)?`data:${t};base64,`+He(e,!0):"":""};const We=e=>{try{const t=Ve.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},Ze=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Ye={RSAPublicKey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApiLWsPmoaiGdr02AmPYS\n4/VgxyJNNJSK2VICirXl4P8qAP3b/6GIs7Hwnsmmuj7gledJ0XiZodFjDNgQEZEG\nj4K9KX8NixcrJwnTQV5UebiERdj+64ihwqPVWo9dIOj43ZPJ8f4dritJv5tnQaBb\nb9zTkU3Ofzk1g8RU00Ith6quOGZcU2IWC4OQ+5YiZvzrCBKEvjFwK2OvGq43tI51\nGaZdI9H09jisypqefsMvv6esjEQQOtl+WGlI5fof7KZUt3dppvuDI4CYgeXIoKKL\n9T9qDl8F9aNSs3XHx32YyA7L1FraFD6PjqRjueIFp2emsXQcIMeMqqgVyV+4qb+0\nuwIDAQAB",RSAPrivateKey:"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmItaw+ahqIZ2v\nTYCY9hLj9WDHIk00lIrZUgKKteXg/yoA/dv/oYizsfCeyaa6PuCV50nReJmh0WMM\n2BARkQaPgr0pfw2LFysnCdNBXlR5uIRF2P7riKHCo9Vaj10g6Pjdk8nx/h2uK0m/\nm2dBoFtv3NORTc5/OTWDxFTTQi2Hqq44ZlxTYhYLg5D7liJm/OsIEoS+MXArY68a\nrje0jnUZpl0j0fT2OKzKmp5+wy+/p6yMRBA62X5YaUjl+h/splS3d2mm+4MjgJiB\n5cigoov1P2oOXwX1o1KzdcfHfZjIDsvUWtoUPo+OpGO54gWnZ6axdBwgx4yqqBXJ\nX7ipv7S7AgMBAAECggEAE1kuWLkSsJ2OoDpt9iJ+a7cJmNd5V1zPWOTwr9fkWFJP\nQYNPKlPVOFxKUivY84rcHAkuMyuQ9OQOXZISOQGDWpZW0mzeFmtR1r+Rr2S9gNmI\n6huOAL9OW306HUxiA7GuPhv2omy+Zyjac2q1WVLEI2B78Um2+WEfxuNIH7xu0gRR\nz/wluevMBQlv6hSeMESP6e9s2kB+FuM4bL7+1sexwS1TudKbHybujaiB8un9E2V3\nC9BkE6yf00Rhvii6Q4E4w3PFQfcBEFnjOD0S2Watx8GIbYjlYvtquy8Yj7OtyZB6\nw5sxyaYhKVVnkpGAbOgaCj94ABYF47VuwXr45I4PzQKBgQDp6svzD+QKlARjcWgO\nrH7UEpFX6m49G6Ib4c63xEg9+GesTgfDxoYxtXDKsC7I8OwMrmffJGbyfjaAvzmg\nicM3Y7kF6UPO9+q2mBRsyhoJSNONTeUVyoFSc+QDsVgndlTZIjqC5XLrONGaSPLJ\n7jJzqKhp3NQcpO8+xY0d7Efm1QKBgQC10fCNuF1LUTYgsWvvGxTiCCAIBurZmHU+\nGMb2Okfoco/P+QNl1jEba91AC7FudW3g/lRn0vTnDajlNoz2/CKunrTKN4/9lEBI\ntiwEOvhc5FtapRifSfrrNwFqPM+LijvOkcteWVhAUWCEP1eLmpnXGqfmZxnTaaVe\n5DyDgyAVTwKBgQDhEawfOQEANJ9sV2f6BnsZ7quuXcCoR3hZP5G5O8EO735BSesq\nsk/YcG4QeCjr6vQU15LWH552YH5srpHyJ9uP5gHW8DTwZZaPDhFJA8S9fjcfVP3B\nU9HO1fdknjTl83N8YPTPkZpbPZZfzyTcqrYclwFEqtfkn8YbLdW0Hu6n6QKBgDEv\njvS3uD1ExfDILlurptWSvx+Mx4F/1c+roj8/+u3t9+uaAIpPDE/PuTW3NBOens/r\n3WeM0QWkU1lWjYHPKY61jlDaARDnRxCkf3nRfhibCf+Wg/erar6wzagwtTCZf55d\nIHfwkYgsu4BrJkK02wMuydbxczIW9U6bTaeCFG7PAoGAN3oHYzTEBwZ7ZKv11QiQ\nEp/HeHBvD8fH/e1uVyBel4Co7NO5pV2s8qjS8+3+jxumKLNXCirjqwHo03YCdzxi\ncy4GFDsukHmDQ7FF9VC4QV0fJ0F7jGYE9nNZ+K9qwS5KrihOSBPxj0HptrF6TSOw\nBTSwr0byL3TC0m0StkSNKpo=",generateKeys:async e=>{try{const t=await e.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!0,["encrypt","decrypt"]),r=await window.crypto.subtle.exportKey("spki",t.publicKey),n=We(r),s=Ze(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=We(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:Ze(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:Ze,format_pem_content:We,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Ve.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),i=[];for(let t=0;t<n.length;t+=190){let r=n.slice(t,t+190),o=await e.encrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(o))}const o=Ve.concatBytes(...i);return Ve.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Ve.base64ToBytes(t),s=await e.importKey("pkcs8",Ve.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["decrypt"]),i=[],o=256;for(let t=0;t<n.length;t+=o){let r=n.slice(t,t+o),a=await e.decrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(a))}const a=Ve.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const Je=()=>c.default.webcrypto.subtle;var Qe={generateKeys:()=>Ye.generateKeys(Je()),encrypt:async(e,t)=>Ye.encrypt(Je(),e,t),decrypt:async(e,t)=>Ye.decrypt(Je(),e,t),encode:async e=>Ye.encrypt(Je(),e,Ye.RSAPublicKey),decode:async e=>Ye.decrypt(Je(),e,Ye.RSAPrivateKey)};const Ge="undefined"!=typeof window?window.crypto.subtle:{};var Xe={generateKeys:()=>Ye.generateKeys(Ge),encrypt:async(e,t)=>Ye.encrypt(Ge,e,t),decrypt:async(e,t)=>Ye.decrypt(Ge,e,t),encode:async e=>Ye.encrypt(Ge,e,Ye.RSAPublicKey),decode:async e=>Ye.decrypt(Ge,e,Ye.RSAPrivateKey)};const et=2654435769,tt=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+et>>>0,e[0]=e[0]+((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,e[1]=e[1]+((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0;return e},rt=(e,t)=>{let r=3337565984;for(let n=0;n<32;n++)e[1]=e[1]-((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0,e[0]=e[0]-((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,r=r-et>>>0;return e},nt=e=>{const t=Ve.str2bytes(e),r=new Uint32Array(4);return r[0]=t[0]<<24|t[1]<<16|t[2]<<8|t[3],r[1]=t[4]<<24|t[5]<<16|t[6]<<8|t[7],r[2]=t[8]<<24|t[9]<<16|t[10]<<8|t[11],r[3]=t[12]<<24|t[13]<<16|t[14]<<8|t[15],r},st=(e,t)=>{const r=Ve.pkcs7Padding(e,8),n=nt(t),s=[];for(let e=0;e<r.length;e+=8){const t=Ve.bytesToUint32(r.slice(e,e+8)),i=tt(t,n);s.push(Ve.uint32ToBytes(i))}return Ve.concatBytes(...s)},it=(e,t)=>{const r=nt(t),n=[];for(let t=0;t<e.length;t+=8){const s=Ve.bytesToUint32(e.slice(t,t+8)),i=rt(s,r);n.push(Ve.uint32ToBytes(i))}const s=Ve.concatBytes(...n);return Ve.pkcs7Unpadding(s)};var ot={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:tt,decrypt:rt,toTeaKey:nt,encode:(e,t)=>{const r=Ve.textEncode(e),n=st(r,t);return Ve.bytesToBase64(n)},decode:(e,t)=>{const r=Ve.base64ToBytes(e),n=it(r,t);return Ve.textDecode(n.buffer)},encodeBytes:st,decodeBytes:it};function at(e,t,r){const{length:n}=e;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){let n=null==e?0:e.length;if(!n)return[];(t=null==t?0:t)<0&&(t=-t>n?0:n+t),(r=(r=void 0===r?n:r)>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;let s=-1;const i=new Array(n);for(;++s<n;)i[s]=e[s+t];return i}(e,t,r)}const ct=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function lt(e){return ct.test(e)}const ut="\\ud800-\\udfff",ft=`[${ut}]`,ht="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",dt="\\ud83c[\\udffb-\\udfff]",pt=`[^${ut}]`,gt="(?:\\ud83c[\\udde6-\\uddff]){2}",yt="[\\ud800-\\udbff][\\udc00-\\udfff]",mt=`${`(?:${ht}|${dt})`}?`,bt="[\\ufe0e\\ufe0f]?",wt=bt+mt+`(?:\\u200d(?:${[pt,gt,yt].join("|")})${bt+mt})*`,_t=`(?:${[`${pt}${ht}?`,ht,gt,yt,ft].join("|")})`,vt=RegExp(`${dt}(?=${dt})|${_t+wt}`,"g");function xt(e){return lt(e)?function(e){return e.match(vt)||[]}(e):function(e){return e.split("")}(e)}function At(e){return t=>{if(!t)return"";const r=lt(t)?xt(t):void 0,n=r?r[0]:t[0],s=r?at(r,1).join(""):t.slice(1);return n[e]()+s}}const St="\\ud800-\\udfff",kt="\\u2700-\\u27bf",Ct="a-z\\xdf-\\xf6\\xf8-\\xff",$t="A-Z\\xc0-\\xd6\\xd8-\\xde",jt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ot="['’]",Et=`[${jt}]`,Pt=`[${kt}]`,Tt=`[${Ct}]`,qt=`[^${St}${jt+"\\d"+kt+Ct+$t}]`,Bt="(?:\\ud83c[\\udde6-\\uddff]){2}",Lt="[\\ud800-\\udbff][\\udc00-\\udfff]",Rt=`[${$t}]`,Ft=`(?:${Tt}|${qt})`,Ut=`(?:${Rt}|${qt})`,Dt=`(?:${Ot}(?:d|ll|m|re|s|t|ve))?`,It=`(?:${Ot}(?:D|LL|M|RE|S|T|VE))?`,Mt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Kt="[\\ufe0e\\ufe0f]?",zt=Kt+Mt+`(?:\\u200d(?:${[`[^${St}]`,Bt,Lt].join("|")})${Kt+Mt})*`,Nt=`(?:${[Pt,Bt,Lt].join("|")})${zt}`,Ht=RegExp([`${Rt}?${Tt}+${Dt}(?=${[Et,Rt,"$"].join("|")})`,`${Ut}+${It}(?=${[Et,Rt+Ft,"$"].join("|")})`,`${Rt}?${Ft}+${Dt}`,`${Rt}+${It}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Nt].join("|"),"g");const Vt=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/),Wt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Zt(e,t){if(void 0===t){const t=Vt(e)?function(e){return e.match(Ht)}(e):function(e){return e.match(Wt)}(e);return t||[]}return e.match(t)||[]}function Yt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Yt(e)))}`;if(ee.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Jt=At("toUpperCase"),Qt=At("toLowerCase");var Gt={toString:Yt,startCase:e=>Zt(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Jt(t)),""),snakeCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Jt(t):t))),""),upperCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Jt,lowerCase:e=>Zt(Yt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Qt,splitOnFirst:(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===e||""===t)return[];const r=e.indexOf(t);return-1===r?[]:[e.slice(0,r),e.slice(r+t.length)]},parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{let n=e;return e&&"string"==typeof e?(t&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?n=Number(e):!r||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(n="true"===e.toLowerCase()),n):n},replace:(e,t)=>{if(!e)return e;if(!t)return e;let r=e;return((Array.isArray(t)?t:[t])||[]).forEach((e=>{e.key&&e.value&&(r=r.replace(new RegExp(e.key,e.flag||""),e.value))})),r},jsonFormat:e=>{try{if(!e)return"";const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(t){return e}},toLines:(e,t="\n")=>e?e.split(t).map((e=>e.trim())).filter((e=>!!e)):[]};var Xt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":ot.encode(t,Ve.hex2str(ot.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=ot.decode(e,Ve.hex2str(ot.TEAKey));return Gt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return ee.isBrowser?await Xe.encode(t):await Qe.encode(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=ee.isBrowser?await Xe.decode(e):await Qe.decode(e);return Gt.jsonFormat(t)}catch(e){return""}}};const er=(e,t,r)=>e*(1-r)+t*r,tr=(e,t,r)=>e===t?0:(r-e)/(t-e),rr=(e,t,r)=>({x:er(e.x,t.x,r),y:er(e.y,t.y,r)}),nr=(e,t,r,n)=>{const s=rr(e,t,n),i=rr(t,r,n);return rr(s,i,n)},sr=(e,t)=>{if(1===e.length)return e[0];const r=[];for(let n=0;n<e.length-1;n++)r.push({x:(1-t)*e[n].x+t*e[n+1].x,y:(1-t)*e[n].y+t*e[n+1].y});return sr(r,t)},ir=(e,t)=>{if(0===t||t===e)return 1;let r=1;for(let n=1;n<=t;n++)r=r*(e-n+1)/n;return r};var or={bezier1:rr,bezier2:nr,bezier3:(e,t,r,n,s)=>{const i=nr(e,t,r,s),o=nr(t,r,n,s);return rr(i,o,s)},bezier:sr,bezierCurve:(e,t)=>{const r=e.length-1;let n=0,s=0;for(let i=0;i<=r;i++){const o=ir(r,i)*Math.pow(1-t,r-i)*Math.pow(t,i);n+=o*e[i].x,s+=o*e[i].y}return{x:n,y:s}},lerp:er,lerpAverage:(e,t,r="")=>{if(e.length<=0)return 0;if(1===e.length)return e[0].x;if(2===e.length)return er(e[0].y,e[1].y,.5);const n=[],s=e.slice().sort(((e,t)=>e.x-t.x)),i=s.length,o=s[0].x,a=s[i-1].x;for(let e=o;e<=a;e+=t){let t=0;for(let n=0;n<i-1;n++){const i=s[n],o=s[n+1];if(e>=i.x&&e<=o.x){if("lerp"===r){const r=tr(i.x,o.x,e);t=rr(i,o,r).y}else t=i.y;break}}e>s[i-1].x&&(t=s[i-1].y),n.push(t)}return n.reduce(((e,t)=>e+t),0)/n.length},proportion:tr};var ar={..._e,...Xt,...or,sleep:_e.delay,run:async function(e,t=0){if(t<=0)return _e.safeRun(e);const r=t>0?Date.now():0,n=await _e.safeRun(e),s=Date.now()-r;return s<t&&await _e.delay(t-s),n},exec:(e,t="")=>ke.I.exec(e,t),debounce:ge,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return ee.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),ge(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new ye(e),mutex:function(e){var t=null;return async function(...r){if((t=this||t||{}).__ddMutex)return!1;t.__ddMutex=!0;try{e&&await Promise.resolve(e.apply(this,r))}catch(e){console.log(e)}finally{t.__ddMutex=!1}}},polling:async function(e={}){const{func:t,interval:r=100,times:n=1e3}=e;let s=n;const i=r<1?100:r;do{if(!t)break;const[e,r]=await _e.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await _e.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>ke.I.pipeline.push(e,t),pipeline:(e=1)=>new Se(e),safeTask:(e,t)=>new Ae(e,t)};const cr=e=>{if(!e)return e;if("object"!=typeof e)return e;const t=Array.isArray(e)?[]:{};for(const r in e)e.hasOwnProperty(r)&&(t[r]=cr(e[r]));return t};const lr=(e,t,r={})=>{const n=e||{},{ignoreUndefined:s=!0,cover:i=!1}=r;if(!t)return n;for(const o in t){if(!t.hasOwnProperty(o))continue;const a=t[o];"object"!=typeof a||"object"!=typeof e[o]||i?s&&void 0===a||r.ignoreNull&&null===a||r.ignoreZero&&0===a||r.ignoreEmptyArray&&Array.isArray(a)&&a.length<=0||r.ignoreEmptyString&&"string"==typeof a&&""===a.trim()||(n[o]=a):n[o]=ur(e[o],a,r)}return n},ur=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?lr(e,t,r):lr({...e},t,r),n},fr=(e,t,r={})=>lr({...e},t,{cover:!0,...r}),hr=(e,t,r,n,s=!1)=>{if(!e||!t||!r)return;let i=e[t];null!==i&&"object"==typeof i&&s&&Object.keys(i).forEach((e=>{hr(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&hr(e,t,r,n,s)},get:()=>i})};var dr={copy:(e,t={})=>{if(void 0===e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0}=t;if((!n||n.length<=0)&&!s)return r;const o={};for(const e in r){if(!r.hasOwnProperty(e))continue;const a=s?i&&e.startsWith("_")?e:Gt.camelCase(e):e;if(n.length>0&&!n.includes(e)&&!n.includes(a))continue;const c=r[e];t.ignoreNull&&null===c||(t.ignoreZero&&0===c||t.ignoreEmptyArray&&Array.isArray(c)&&c.length<=0||t.ignoreEmptyString&&"string"==typeof c&&""===c.trim()||(o[a]=c))}return o},clone:cr,merge:ur,isEmpty:e=>0!==e&&(!e||"object"==typeof e&&(Array.isArray(e)?!e.length:Object.keys(e).length<=0)),parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{if(!e&&"object"!=typeof e)return e;for(const[n,s]of Object.entries(e))if("object"==typeof s&&null!==s)for(const[e,n]of Object.entries(s))s[e]=Gt.parseValue(n,{number:t,boolean:r});else e[n]=Gt.parseValue(s,{number:t,boolean:r});return e},cloneClass:function(e){return e?"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e)):e},combine:fr,combines:(e,t={})=>{let r={};if(!e||e.length<=0)return r;const{ignoreUndefined:n=!0,ignoreNull:s=!0,ignoreZero:i=!0,ignoreEmptyArray:o=!0,ignoreEmptyString:a=!0,cover:c=!0}=t;return e.forEach((e=>r=fr(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:hr,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};const pr=function(e,{sep:t="&",eq:r="=",max:n=1e3,multiple:s=!0,uri:i=!0,parseNumber:o=!1,parseBoolean:a=!1}={}){t=t||"&",r=r||"=";const c={};if("string"!=typeof e||0===e.length)return c;const l=/\+/g,u=n||1e3;let f=(e=e.split(t)).length;u>0&&f>u&&(f=u);for(let t=0;t<f;++t){let n,o,a,u,f=e[t].replace(l,"%20"),h=f.indexOf(r);h>=0?(n=f.substr(0,h),o=f.substr(h+1)):(n=f,o=""),a=i?decodeURIComponent(n):n,u=i?decodeURIComponent(o):o,O.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(u):c[a]=[c[a],u]:c[a]=u}return dr.parseValue(c,{number:o,boolean:a}),c},gr=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},yr=function(e,t=!0){return t?encodeURIComponent(e):e},mr=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},br=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,wr=e=>{const t=(e||"").replace(/\\/g,"/").split("?")[0],r=t.match(/[\/]?([\w\_\-]+)[.]?[\w]*[?]?$/),n=r?r[1]:"",s=t.lastIndexOf("/")+1,i=t.substring(s),o=i.lastIndexOf("."),a=i.substring(0,o)||"",c=o>=0?i.substring(o):"";return{route:t.substring(0,s)||"",page:n,name:i,withoutExtension:a,extname:c}},_r=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(br);if(!r||r.length<4)return t;const n=r[3]||"",s=e.split("?");return t.url=s[0],t.origin=r[0],t.protocol=`${r[1]}:`,t.host=`${r[2]}${n?":"+n:""}`,t.port=n,t.query=s.length>1?s[1]:"",t},vr=(e,t)=>{if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var xr={parse:pr,stringify:function(e,{sep:t="&",eq:r="=",name:n=null,uri:s=!0,cleanZero:i=!1,cleanNull:o=!1,cleanWhitespace:a=!1}={}){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(n){const c=yr(gr(n),s)+r,l=e[n];return Array.isArray(l)?l.map((function(e){return c+yr(gr(e),s)})).join(t):mr(l,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+yr(gr(l),s)})).filter(Boolean).join(t):n?yr(gr(n),s)+r+yr(gr(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=_r(e),{origin:r="",url:n="",query:s=""}=t,i=wr(n),o=pr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:wr,parseHost:_r,join:(...e)=>{const t=[];let r=!1;return e.forEach((e=>{const n=e.trim();if(""===n)return;if(/^(\w+):\/\//.test(n))return t.length=0,t.push(n),void(r=!0);n.split("/").forEach((e=>{"."!==e&&""!==e&&(".."===e?t.length>0&&".."!==t[t.length-1]?t.pop():r||t.push(".."):t.push(e))}))})),t.join("/")},shExpMatch:vr,isLocalIpAddress:e=>!!e&&!!(vr(e,"127.0.0.1")||vr(e,"localhost")||vr(e,"192.168.*.*")),parseFileUrl:e=>{const t={href:e,file:"",url:"",protocol:"",host:"",query:"",params:{}};if(!e)return t;let r=e?e.replace(/\\/g,"/"):"";r.startsWith("file://")&&!r.startsWith("file:///")?r="file:///"+r.slice(7):r.startsWith("file:/")&&!r.startsWith("file:///")&&(r="file:///"+r.slice(6));const n=r.match(/^file:\/\/(?:([^\/\\]+))?(\/.*)?$/);if(!n||n.length<3)return t;t.protocol="file:";const s=n[1]||"",i=n[2]||"";t.host=s;const o=i.split("?");return t.url=t.protocol+`//${t.host}`+o[0],t.file=o[0],t.query=o.length>1?o[1]:"",t.params=pr(t.query,{multiple:!0,uri:!1}),t}};class Ar{_loopTimer;_event=new m;started=!1;interval=0;constructor(e=0){this.interval=e||500}start(){return this.started||(this.stop(),this._loopTimer=setInterval((()=>{this._handleLoop()}),this.interval),this.started=!0),this}stop(){return this._loopTimer?(clearInterval(this._loopTimer),this._loopTimer=0,this.started=!1,this):this}restart(){return this.stop(),this.start(),this}on(e){return this._event.on("frame",e),this}off(e){return e?(this._event.off("frame",e),this):this}_handleLoop(){this._event.emit("frame")}}var Sr={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class kr{date;timestamp=0;yyyy=0;yy="";M=0;MM="";d=0;dd="";h=0;hh="";m=0;mm="";s=0;ss="";S=0;SS="";SSS="";constructor(e){if(!e)return;const t="string"==typeof e||"number"==typeof e?new Date(e):e;t&&(this.date=t,this.timestamp=t.getTime(),this.toDate())}toDate(){return this.date?(this.yyyy=this.date.getFullYear(),this.yy=`${this.yyyy}`.substr(2),this.M=this.date.getMonth()+1,this.MM=(this.M<10?"0":"")+this.M,this.d=this.date.getDate(),this.dd=(this.d<10?"0":"")+this.d,this.h=this.date.getHours(),this.hh=(this.h<10?"0":"")+this.h,this.m=this.date.getMinutes(),this.mm=(this.m<10?"0":"")+this.m,this.s=this.date.getSeconds(),this.ss=(this.s<10?"0":"")+this.s,this.S=this.date.getMilliseconds(),this.SS=(this.S<10?"0":"")+this.S,this.SSS=this.S.toString().padStart(3,"0"),this):this}toCountdown(e=""){const t={countdown:0,timestamp:0,seconds:0,d:0,dd:"",h:0,hh:"",m:0,mm:"",s:0,ss:"",S:0,SS:"",SSS:"",desc:""};if(!this.timestamp)return t;t.timestamp=this.timestamp,t.countdown=Math.max(t.timestamp-Date.now(),0),t.seconds=Math.floor(t.countdown/Sr.oneSecond);let r=t.countdown;t.d=Math.floor(r/Sr.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=Sr.oneDay,t.h=Math.floor(r/Sr.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=Sr.oneHour,t.m=Math.floor(r/Sr.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=Sr.oneMinute,t.s=Math.floor(r/Sr.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=Sr.oneSecond,t.S=r,t.SS=(t.S<10?"0":"")+t.S,t.SSS=t.S.toString().padStart(3,"0");let n=e;return n||(n=t.countdown>Sr.oneHour?"hh:mm:ss":t.countdown>Sr.oneMinute?"mm:ss":"ss"),t.desc=n.replace(/\bdd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>t[e])),t}add(e=0){return e?(this.timestamp=this.timestamp+e,this.date=new Date(this.timestamp),this.toDate(),this):this}format(e="yyyy-MM-dd hh:mm:ss"){return e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>this[e]))}static get timezoneOffset(){return(new Date).getTimezoneOffset()/60}static getLocalTime(e=0){const t=new Date,r=t.getTime(),n=6e4*t.getTimezoneOffset();return new Date(r+n+36e5*e)}}const Cr=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?$r(r).format(t):""},$r=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new kr(t||0)};function jr({year:e=0,month:t=0,date:r=0,hour:n=0,minute:s=0,second:i=0}){const o=`${e||"yyyy"}/${t||"MM"}/${r||"dd"} ${n}:${s}:${i}`;return new Date(Cr(Date.now(),o)).getTime()}var Or={...Sr,now:function(){return $r(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:jr,todayZero:()=>jr({}),format:Cr,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return $r(r).toCountdown(t)},dtime:$r,loopFrame:(e=500)=>new Ar(e),getTimezoneOffset:()=>kr.timezoneOffset,getLocalTime:kr.getLocalTime};const Er=e=>je.toBase64(e);var Pr={encode:Er,decode:e=>je.fromBase64(e),encodeByOss:e=>Er(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var Tr={...g,base64:Pr,tea:ot,uuid:y,guid:(e,t=!1,r="")=>{const n=y(e||32);return t?Or.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=g.keyChars;let r="";const n=t.length;for(let s=0;s<e;s++)r+=t.charAt(Math.floor(Math.random()*n));return r}};const qr=(e,t,r=8)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(r<=0)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const n=Object.prototype.toString.call(e);if(n!==Object.prototype.toString.call(t))return!1;switch(n){case"[object Array]":return Br(e,t,r);case"[object Map]":return Lr(e,t,r);case"[object Set]":return Rr(e,t,r);case"[object Object]":return Fr(e,t,r);default:return Ur(e,t,n)}},Br=(e,t,r=1/0)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!qr(e[n],t[n],r-1))return!1;return!0},Lr=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const[n,s]of e)if(!t.has(n)||!qr(s,t.get(n),r-1))return!1;return!0},Rr=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const n of e)if(![...t].some((e=>qr(n,e,r-1))))return!1;return!0},Fr=(e,t,r=1/0)=>{const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!s.includes(i)||!qr(e[i],t[i],r-1))return!1;const i=Object.getOwnPropertySymbols(e),o=Object.getOwnPropertySymbols(t);if(i.length!==o.length)return!1;for(const n of i)if(!o.includes(n)||!qr(Reflect.get(e,n),Reflect.get(t,n),r-1))return!1;return!0},Ur=(e,t,r)=>{switch(r){case"[object RegExp]":return String(e)===String(t);case"[object Date]":return e.getTime()===t.getTime();case"[object ArrayBuffer]":return Dr(e,t);default:return e===t}},Dr=(e,t)=>{if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0};var Ir={isEqual:qr,isEqualArray:Br,isEqualObject:Fr,isEqualValue:Ur,isEqualAB:Dr,isEqualDeep:(e,t)=>qr(e,t,1/0)};const Mr=(e,t=new WeakMap)=>{if(null===e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(Array.isArray(e)){r=[],t.set(e,r);for(const n of e)r.push(Mr(n,t))}else if(e instanceof Date)r=new Date(e);else if(e instanceof RegExp)r=new RegExp(e.source,e.flags);else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,s]of e.entries())r.set(Mr(n,t),Mr(s,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e.values())r.add(Mr(n,t))}else if("object"==typeof e){r={},t.set(e,r);for(const[n,s]of Object.entries(e))r[n]=Mr(s,t)}return r};var Kr={copy:(e,t={})=>{if(null==e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r||null===r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0,...o}=t,a={},c=[{condition:o.ignoreNull,test:e=>null===e},{condition:o.ignoreZero,test:e=>0===e},{condition:o.ignoreEmptyArray,test:e=>Array.isArray(e)&&0===e.length},{condition:o.ignoreEmptyString,test:e=>"string"==typeof e&&""===e.trim()}].filter((e=>e.condition));for(const[e,t]of Object.entries(r)){const r=!s||i&&e.startsWith("_")?e:Gt.camelCase(e);n.length>0&&!n.includes(e)&&!n.includes(r)||(c.some((e=>e.test(t)))||(a[r]=t))}return a},clone:Mr,cloneClass:function(e){return null==e||"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}};const zr=(e,t)=>{if(e===t)return!0;if(!e||!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var Nr={shExpMatch:zr,shExpMatchs:(e,t)=>{if(!e||!t)return!1;let r=[];if(Array.isArray(t))r=t;else{if("string"!=typeof t)return!1;r=[t]}for(const t of r){if("*"===t)return!0;if(zr(e,t))return!0}return!1}};const Hr="[object Object]",Vr="[object Array]",Wr=O.getTag,Zr=e=>{if(Wr(e)!==Hr)return e;const t={};for(const r in e)if(/\w+\.\w+/g.test(r)&&!r.includes("[")){const n=r.split(".");let s=t;for(let e=0;e<n.length-1;e++){const t=n[e];Wr(s[t])!==Hr&&(s[t]={}),s=s[t]}s[n[n.length-1]]=e[r]}else t[r]=e[r];return t},Yr=(e,t,r=!1)=>{if(e===t)return;const n=Wr(e);if(n===Wr(t))if(n===Vr&&e.length>=t.length)for(let r=0;r<t.length;r++)Yr(e[r],t[r]);else if(n===Hr&&Object.keys(e).length>=Object.keys(t).length)for(const n in t)r||void 0!==e[n]?Yr(e[n],t[n]):e[n]=null},Jr=(e,t)=>Yr(e,t,!0),Qr=(e,t,r={},n="",s=!1)=>{if(e===t)return r;const i=Wr(e),o=Wr(t);if(i===Vr&&o===i&&e.length>=t.length){for(let s=0;s<e.length;s++)Qr(e[s],t[s],r,`${n}[${s}]`,!1);return r}if(i===Hr&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Wr(s),c=Wr(o);if(s!==o)if(a===Vr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Qr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`,!1);else if(a===Hr&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Qr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`,!1);else null!==s&&(r[`${n?n+".":""}${i}`]=s)}return r}return r[n]=e,r};const Gr={...{...Ir,...Kr,...Nr,...{flattenPath:Zr,normalizeStructure:Jr,diffPath:(e,t)=>{const r=Zr(e),n=Zr(t);return Jr(r,n),Qr(r,n)}}},...Ve,...Tr,...ar,...Gt,...Te,...xe,qs:xr};var Xr={gbkLength:function(e){let t=0;if(!e)return 0;for(let r=0;r<e.length;r++)e.charCodeAt(r)>127||94===e.charCodeAt(r)?t+=2:t++;return t},gbkCut:function(e,t){if(!e||t<=0)return"";let r=0,n=0;for(let s=0;s<e.length&&(e.charCodeAt(s)>127||94===e.charCodeAt(s)?r+=2:r++,!(r>t));s++)n=s;return e.substr(0,n+1)}};function en(e){return e!=e}function tn(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}(t,(function(t){return e[t]}))}var rn,nn,sn=(rn=Object.keys,nn=Object,function(e){return rn(nn(e))}),on=Math.max;function an(e,t){var r=ee.isArray(e)||ee.isArguments(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,s=!!n;for(var i in e)!t&&!O.hasOwnProperty.call(e,i)||s&&("length"==i||ee.isIndex(i,n))||r.push(i);return r}var cn={...ee,...O,...dr,...xe,includes:function(e,t,r,n){e=ee.isArrayLike(e)?e:function(e){return e?tn(e,function(e){return ee.isArrayLike(e)?an(e):function(e){if(!ee.isPrototype(e))return sn(e);var t=[];for(var r in Object(e))O.hasOwnProperty.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}(e)):[]}(e),r=r&&!n?fe.toInteger(r):0;var s=e.length;return r<0&&(r=on(s+r,0)),ee.isString(e)?r<=s&&e.indexOf(t,r)>-1:!!s&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}(e,en,r);for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}(e,t,r)>-1},forof:(e,t)=>{if(!e)return;let r;if(ee.isObject(e)&&(r=ee.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var ln={...{groupBy:function(e,t){return e.reduce(((e,r)=>((e[r[t]]=e[r[t]]||[]).push(r),e)),{})},first:function(e){if(!e)return;return e.length<=0?void 0:e[0]},last:function(e){if(!e)return;const t=e.length;return t<=0?void 0:e[t-1]},toList:function(e){return Array.isArray(e)?e:e?[e]:[]}},stepAction:function(e,t,r=100){if(!ee.isFunction(t))return;if(!ee.isArray(e)||e.length<=0)return;let n=0;for(;e.length>n;){let s=r+n,i=e.slice(n,s);t&&t(i),n=s}},skip:function(e,t){if(!ee.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!ee.isArray(e)||e.length<=0)return[];const n=r||0;if(n>=e.length)return[];const s=t+n;return e.slice(n,e.length<s?e.length:s)||[]},distinct:function(e){return!ee.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return Te.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!ee.isObject(e))return;const s=e[t];(ee.isString(s)&&""!==s||ee.isNumber(s))&&(n[s]=e[r])})),n):n}};const un=/%[sdj%]/g;let fn=()=>{};function hn(e){if(!e||!e.length)return null;const t={};return e.forEach((e=>{const r=e.field;t[r]=t[r]||[],t[r].push(e)})),t}function dn(e,...t){let r=0;const n=t.length;if("function"==typeof e)return e.apply(null,t);if("string"==typeof e){return e.replace(un,(e=>{if("%%"===e)return"%";if(r>=n)return e;switch(e){case"%s":return String(t[r++]);case"%d":return Number(t[r++]);case"%j":try{return JSON.stringify(t[r++])}catch(e){return"[Circular]"}break;default:return e}}))}return e}function pn(e,t){return null==e||(!("array"!==t||!Array.isArray(e)||e.length)||!(!function(e){return"string"===e||"url"===e||"hex"===e||"email"===e||"date"===e||"pattern"===e}(t)||"string"!=typeof e||e))}function gn(e,t,r){let n=0;const s=e.length;!function i(o){if(o&&o.length)return void r(o);const a=n;n+=1,a<s?t(e[a],i):r([])}([])}"undefined"!=typeof process&&process.env&&"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&"undefined"!=typeof document&&(fn=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class yn extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function mn(e,t,r,n,s){if(t.first){const t=new Promise(((t,i)=>{const o=function(e){const t=[];return Object.keys(e).forEach((r=>{t.push(...e[r]||[])})),t}(e);gn(o,r,(e=>(n(e),e.length?i(new yn(e,hn(e))):t(s))))}));return t.catch((e=>e)),t}const i=!0===t.firstFields?Object.keys(e):t.firstFields||[],o=Object.keys(e),a=o.length;let c=0;const l=[],u=new Promise(((t,u)=>{const f=e=>{if(l.push.apply(l,e),c++,c===a)return n(l),l.length?u(new yn(l,hn(l))):t(s)};o.length||(n(l),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?gn(n,r,f):function(e,t,r){const n=[];let s=0;const i=e.length;function o(e){n.push(...e||[]),s++,s===i&&r(n)}e.forEach((e=>{t(e,o)}))}(n,r,f)}))}));return u.catch((e=>e)),u}function bn(e,t){return r=>{let n;return n=e.fullFields?function(e,t){let r=e;for(let e=0;e<t.length;e++){if(null==r)return r;r=r[t[e]]}return r}(t,e.fullFields):t[r.field||e.fullField],(s=r)&&void 0!==s.message?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField};var s}}function wn(e,t){if(t)for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];"object"==typeof n&&"object"==typeof e[r]?e[r]={...e[r],...n}:e[r]=n}return e}const _n=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!pn(t,i||e.type)||n.push(dn(s.messages.required,e.fullField))};let vn;const xn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,An=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,Sn={integer:e=>Sn.number(e)&&parseInt(e,10)===e,float:e=>Sn.number(e)&&!Sn.integer(e),array:e=>Array.isArray(e),regexp(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:e=>"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear&&!isNaN(e.getTime()),number:e=>!isNaN(e)&&"number"==typeof e,object:e=>"object"==typeof e&&!Sn.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(xn),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(vn)return vn;const e="[a-fA-F\\d:]",t=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${e})|(?<=${e})(?=\\s|$))`:"",r="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",n="[a-fA-F\\d]{1,4}",s=`\n(?:\n(?:${n}:){7}(?:${n}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${n}:){6}(?:${r}|:${n}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${n}:){5}(?::${r}|(?::${n}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${n}:){4}(?:(?::${n}){0,1}:${r}|(?::${n}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${n}:){3}(?:(?::${n}){0,2}:${r}|(?::${n}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${n}:){2}(?:(?::${n}){0,3}:${r}|(?::${n}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${n}:){1}(?:(?::${n}){0,4}:${r}|(?::${n}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${n}){0,5}:${r}|(?::${n}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),i=new RegExp(`(?:^${r}$)|(?:^${s}$)`),o=new RegExp(`^${r}$`),a=new RegExp(`^${s}$`),c=e=>e&&e.exact?i:new RegExp(`(?:${t(e)}${r}${t(e)})|(?:${t(e)}${s}${t(e)})`,"g");c.v4=e=>e&&e.exact?o:new RegExp(`${t(e)}${r}${t(e)}`,"g"),c.v6=e=>e&&e.exact?a:new RegExp(`${t(e)}${s}${t(e)}`,"g");const l=c.v4().source,u=c.v6().source;return vn=new RegExp(`(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${l}|${u}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s"]*)?$)`,"i"),vn})()),hex:e=>"string"==typeof e&&!!e.match(An)},kn="enum";var Cn={required:_n,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(dn(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void _n(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?Sn[i](t)||n.push(dn(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(dn(s.messages.types[i],e.fullField,e.type))},range:(e,t,r,n,s)=>{const i="number"==typeof e.len,o="number"==typeof e.min,a="number"==typeof e.max,c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;let l=t,u="";const f="number"==typeof t,h="string"==typeof t,d=Array.isArray(t);if(f?u="number":h?u="string":d&&(u="array"),!u)return!1;d&&(l=t.length),h&&(l=t.replace(c,"_").length),i?l!==e.len&&n.push(dn(s.messages[u].len,e.fullField,e.len)):o&&!a&&l<e.min?n.push(dn(s.messages[u].min,e.fullField,e.min)):a&&!o&&l>e.max?n.push(dn(s.messages[u].max,e.fullField,e.max)):o&&a&&(l<e.min||l>e.max)&&n.push(dn(s.messages[u].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[kn]=Array.isArray(e[kn])?e[kn]:[],-1===e[kn].indexOf(t)&&n.push(dn(s.messages[kn],e.fullField,e[kn].join(", ")))},pattern:(e,t,r,n,s)=>{if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||n.push(dn(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(dn(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const $n=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t,i)&&!e.required)return r();Cn.required(e,t,n,o,s,i),pn(t,i)||Cn.type(e,t,n,o,s)}r(o)};var jn={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(pn(t,"string")&&!e.required)return r();Cn.required(e,t,n,i,s,"string"),pn(t,"string")||(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s),Cn.pattern(e,t,n,i,s),!0===e.whitespace&&Cn.whitespace(e,t,n,i,s))}r(i)},method:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.type(e,t,n,i,s)}r(i)},number:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(""===t&&(t=void 0),pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},boolean:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.type(e,t,n,i,s)}r(i)},regexp:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),pn(t)||Cn.type(e,t,n,i,s)}r(i)},integer:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},float:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},array:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(null==t&&!e.required)return r();Cn.required(e,t,n,i,s,"array"),null!=t&&(Cn.type(e,t,n,i,s),Cn.range(e,t,n,i,s))}r(i)},object:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.type(e,t,n,i,s)}r(i)},enum:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s),void 0!==t&&Cn.enum(e,t,n,i,s)}r(i)},pattern:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t,"string")&&!e.required)return r();Cn.required(e,t,n,i,s),pn(t,"string")||Cn.pattern(e,t,n,i,s)}r(i)},date:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t,"date")&&!e.required)return r();if(Cn.required(e,t,n,i,s),!pn(t,"date")){let r;r=t instanceof Date?t:new Date(t),Cn.type(e,r,n,i,s),r&&Cn.range(e,r.getTime(),n,i,s)}}r(i)},url:$n,hex:$n,email:$n,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;Cn.required(e,t,n,i,s,o),r(i)},any:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(pn(t)&&!e.required)return r();Cn.required(e,t,n,i,s)}r(i)}};function On(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone(){const e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}const En=On();class Pn{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");jn[e]=t};static warning=fn;static messages=En;static validators=jn;rules={};_messages=En;constructor(e){this.define(e)}define(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");this.rules={},Object.keys(e).forEach((t=>{const r=e[t];this.rules[t]=Array.isArray(r)?r:[r]}))}messages(e){return e&&(this._messages=wn(On(),e)),this._messages}validate(e,t={},r=(()=>{})){let n=e,s=t,i=r;if("function"==typeof s&&(i=s,s={}),!this.rules||0===Object.keys(this.rules).length)return i&&i(null,n),Promise.resolve(n);if(s.messages){let e=this.messages();e===En&&(e=On()),wn(e,s.messages),s.messages=e}else s.messages=this.messages();const o={};(s.keys||Object.keys(this.rules)).forEach((t=>{const r=this.rules[t];let s=n[t];r.forEach((r=>{let i=r;"function"==typeof i.transform&&(n===e&&(n={...n}),s=n[t]=i.transform(s)),i="function"==typeof i?{validator:i}:{...i},i.validator=this.getValidationMethod(i),i.validator&&(i.field=t,i.fullField=i.fullField||t,i.type=this.getType(i),o[t]=o[t]||[],o[t].push({rule:i,value:s,source:n,field:t}))}))}));const a={};return mn(o,s,((e,t)=>{const r=e.rule;let i,o=!("object"!==r.type&&"array"!==r.type||"object"!=typeof r.fields&&"object"!=typeof r.defaultField);function c(e,t){return{...t,fullField:`${r.fullField}.${e}`,fullFields:r.fullFields?[...r.fullFields,e]:[e]}}function l(i=[]){let l=Array.isArray(i)?i:[i];!0===s.suppressWarning&&l.length&&Pn.warning("async-validator:",l),l.length&&void 0!==r.message&&(l=[].concat(r.message));let u=l.map(bn(r,n));if(s.first&&u.length)return a[r.field]=1,t(u);if(o){if(r.required&&!e.value)return void 0!==r.message?u=[].concat(r.message).map(bn(r,n)):s.error&&(u=[s.error(r,dn(s.messages.required,r.field))]),t(u);let i={};r.defaultField&&Object.keys(e.value).map((e=>{i[e]=r.defaultField})),i={...i,...e.rule.fields};const o={};Object.keys(i).forEach((e=>{const t=i[e],r=Array.isArray(t)?t:[t];o[e]=r.map(c.bind(null,e))}));const a=new Pn(o);a.messages(s.messages),e.rule.options&&(e.rule.options.messages=s.messages,e.rule.options.error=s.error),a.validate(e.value,e.rule.options||s,(e=>{const r=[];u&&u.length&&r.push(...u),e&&e.length&&r.push(...e),t(r.length?r:null)}))}else t(u)}if(o=o&&(r.required||!r.required&&e.value),r.field=e.field,r.asyncValidator)i=r.asyncValidator(r,e.value,l,e.source,s);else if(r.validator){try{i=r.validator(r,e.value,l,e.source,s)}catch(e){console.error?.(e),s.suppressValidatorError||setTimeout((()=>{throw e}),0),l(e.message)}!0===i?l():!1===i?l("function"==typeof r.message?r.message(r.fullField||r.field):r.message||`${r.fullField||r.field} fails`):i instanceof Array?l(i):i instanceof Error&&l(i.message)}i&&i.then&&i.then((()=>l()),(e=>l(e)))}),(e=>{!function(e){let t=[],r={};for(let r=0;r<e.length;r++)s=e[r],Array.isArray(s)?t=t.concat(...s):t.push(s);var s;t.length?(r=hn(t),i(t,r)):i(null,n)}(e)}),n)}getType(e){if(void 0===e.type&&e.pattern instanceof RegExp&&(e.type="pattern"),"function"!=typeof e.validator&&e.type&&!jn.hasOwnProperty(e.type))throw new Error(dn("Unknown rule type %s",e.type));return e.type||"string"}getValidationMethod(e){if("function"==typeof e.validator)return e.validator;const t=Object.keys(e),r=t.indexOf("message");return-1!==r&&t.splice(r,1),1===t.length&&"required"===t[0]?jn.required:jn[this.getType(e)]||void 0}}function Tn(e){return new Pn(e)}var qn={validateId:function(e){return!!e&&(!(e.length<6)&&!!/^[A-Za-z0-9_-]+$/.test(e))},validatePhone:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)},validator:Tn,validate:function(e,t,r={},n=(()=>{})){return ar.run(Tn(e).validate(t,r,n))},isChinese:function(e){return!!e&&!!/^[\u4E00-\u9FA5]+$/.test(e)},isNumber:function(e){return!!e&&!!/^[0-9]+$/.test(e)},isFloat:function(e){return!!e&&!!/^(\-|\+)?\d+(\.\d+)?$/.test(e)},isPhoneNumber:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)}};const Bn={gbk:Xr,math:Te,list:ln,string:Gt,time:Or,obj:dr,rule:qn,regex:{pattern:{num:"0-9",zh:"一-龥",en:"A-Za-z"},regex:(e,t)=>new RegExp(e,t),entire:{chinese:/^[\u4E00-\u9FA5]+$/,real:/^(\-|\+)?\d+(\.\d+)?$/,cssReal:/^(\-|\+)?\d*(\.)?\d+$/,id:/^[A-Za-z0-9]+$/,yyyyMMdd:/^(\d{4})-?(\d{2})-?(\d{2})$/}},...Ve,...Tr,...cn,Event:m},Ln="[object Object]",Rn="[object Array]",Fn=e=>Object.prototype.toString.call(e),Un=(e,t,r=!1)=>{if(e===t)return;const n=Fn(e);if(n===Fn(t))if(n===Rn&&e.length>=t.length)for(let r=0;r<t.length;r++)Un(e[r],t[r]);else if(n===Ln&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?Un(e[n],t[n]):e[n]=null},Dn=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=Fn(e),o=Fn(t);if(i===Rn&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)Dn(e[s],t[s],r,`${n}[${s}]`);else if(i===Ln&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Fn(s),c=Fn(o);if(s!==o)if(a===Rn&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Dn(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===Ln&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Dn(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class In{list=[];constructor(){this.invoke=this.invoke.bind(this)}use(e){this.list=this.list.concat(e)}invoke(e){return this.list.reduce(((e,t)=>e.then((e=>t(e)))),Promise.resolve(e)).catch((e=>"REFETCH"===e.sig?Promise.resolve(e.result):Promise.reject(e)))}}class Mn{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new In,response:new In};constructor(e){const{reqConfig:t={},requestEncrypt:r,responseDecrypt:n,handleError:s,api:i}=e;this.reqConfig=t,this.handleEncrypt=r,this.handleDecrypt=n,this.handleError=s,this.handleRequest=i}static blockId="blockid";static requestLock={};lockR(e,t){Mn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete Mn.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}_fetch(e,t){let r=e;return t&&this.handleEncrypt&&(r=this.handleEncrypt(e)),new Promise(((e,n)=>{this.handleRequest({...r,success:r=>{let n=r;t&&this.handleDecrypt&&(n=this.handleDecrypt(r)),e(n)},fail:e=>{n(e)}})}))}async request(e,t){const r=dr.copy(this.reqConfig[e]),{config:n,...s}=await this.interceptors.request.invoke({url:r.url,data:t||{},header:{"content-type":"application/json"},method:r.method?r.method:"POST",responseType:"text",config:r});let i;try{if("block"===n.model)this.lockR(Mn.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await Mn.requestLock[Mn.blockId].request;else if(Mn.requestLock[Mn.blockId]&&Mn.requestLock[Mn.blockId].lock&&await Mn.requestLock[Mn.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),Mn.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await Mn.requestLock[e].request,this.unlockR(e)}else i=await this._fetch(s,n.hasEncrypt)}catch(e){this.handleError&&this.handleError(e)}return this.interceptors.response.invoke({res:i,config:r,reqId:this.getIdFromReq(s),refetch:()=>({sig:"REFETCH",result:this.request(e,t||{})})})}}const Kn=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var zn={diff:function(e,t){const r={};return(e=>{if(Fn(e)===Ln)for(let t in e)if(/\w+\.\w+/g.test(t)&&-1===t.indexOf("[")){const r=t.split(".");let n=e,s=r.length;for(let e=0;e<s-1;e++){const t=r[e];Fn(n[t])!==Ln&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),Un(e,t,!0),Dn(e,t,r,"",!0),r},promixify:Kn,run:(e,t={})=>e?ar.run(Kn(e)(t)):ar.run(e),formatList:(e,t,r)=>(e||[]).reduce(((e,n,s)=>({...e,[`${r}[${t+s}]`]:n})),{}),ruleValidator:(e,t)=>!!t&&(!Array.isArray(t)||!(t.length<=0)&&t.every((e=>!!e))),Http:Mn,setWatcher:e=>{let t=e.data,r=e.watch;Object.keys(r).forEach((n=>{let s=t,i=n.split(".");for(let e=0;e<i.length-1;e++)s=s[i[e]];let o=i[i.length-1],a=r[n].handler||r[n],c=r[n].deep;dr.observe(s,o,a,e,c)}))}};const Nn=e=>{if(!e)return"";if(!cn.isObject(e))return"";let t="";return cn.forof(e,((e,r)=>{r&&(t+=`${Gt.kebabCase(e)}:${r};`)})),t},Hn=["display","position","top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","fontSize","textAlign","fontFamily","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius","background","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","color","overflow","opacity","flexDirection","justifyContent","alignItems","flexWrap","alignContent","alignSelf","flex","flexBasis","flexFlow","flexShrink","pointerEvents"],Vn=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],Wn=(e,t="px")=>e&&t?"0"===e?e:qn.isFloat(e.toString())?`${e}${t}`:e:e;var Zn={stringify:Nn,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=xr.parse(e,{sep:";",eq:":",uri:!1}),s={};return cn.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:Gt.camelCase(e):e;qn.isFloat(n)||n.length>=2&&n.startsWith(".")&&qn.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:Wn,style:(e,t="px")=>{if(!e)return"";const r=cn.copy(e,{fields:Hn});cn.forof(r,((e,n)=>{(Vn.includes(e)||Vn.includes(Gt.camelCase(e)))&&(r[e]=Wn(n,t))}));return Nn(r)},commonFields:Hn};const Yn=(e,t="",r=!1)=>{try{if(!e)return;const n=xr.parseUrl(e),s=t||n.name;if(!t||!r||!n.origin||n.origin===window.location.origin)((e,t)=>{try{const r=document.createElement("a");r.style.display="none",r.href=e,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(t){console.error(`[ddan] _downloadUrl ${e}`,t)}})(e,s);else{const t=n.params;t.t=Date.now();const r=`${n.url}?${xr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){Jn(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},Jn=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;Yn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},Qn=e=>{try{const t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.style.opacity="0",t.value=e??"",t.select();const r=document.execCommand("copy");return document.body.removeChild(t),r}catch(e){return console.error("[ddan] copyText",e),!1}},Gn=(e,t="denied")=>new Promise((r=>{const n=navigator?.permissions;if(!n||!n.query)return r(t);const s={name:e};n.query(s).then((e=>r(e.state))).catch((()=>r(t)))})),Xn=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e,es=(e,t)=>{if(!e||!t)return[];const r=[];let n;for(;null!==(n=t.exec(e));)r.push(n[1]);return r},ts=(e,t="application/javascript")=>{const r=new Blob([e],{type:t});return URL.createObjectURL(r)};var rs={dataURLtoFile:(e,t)=>{let r=e.split(","),n=r[0].match(/:(.*?);/)[1],s=window.atob(r[1]),i=s.length,o=new Uint8Array(i);for(;i--;)o[i]=s.charCodeAt(i);return new File([o],t,{type:n})},dataURLtoBlob:e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=window.atob(t[1]),s=n.length,i=new Uint8Array(s);for(;s--;)i[s]=n.charCodeAt(s);return new Blob([i],{type:r})},blobToFile:(e,t)=>(e.lastModifiedDate=new Date,e.name=t,e),readAsDataURL:(e,t)=>{var r=new FileReader;r.readAsDataURL(e),r.onloadend=function(e){t&&t(e.target?.result)}},downloadUrl:Yn,download:(e,t="")=>{e&&("string"!=typeof e?Jn(e,t):Yn(e,t))},downloadFile:Jn,downloadImage:e=>{try{if(!e)return;const t=e.match(/\/(\w+.\w+)$/)[1],r=new Image;r.onload=()=>{let e=document.createElement("canvas");e.width=r.width,e.height=r.height;let n=e.getContext("2d");n&&n.drawImage(r,0,0,r.width,r.height);let s=e.toDataURL();Yn(s,t)},r.src=e,r.setAttribute("crossOrigin","Anonymous")}catch(e){console.error("[ddan] downloadImage",e)}return Promise.resolve()},watermark:(e,{width:t=400,height:r=300,angle:n=0,fillStyle:s="rgba(0, 0, 0, 0.2)",font:i="16px Arial",textAlign:o="left",textBaseline:a="middle"}={})=>{try{if(!e)return"";const c=document.createElement("canvas");c.width=t,c.height=r;const l=c.getContext("2d");return l?(n&&l.rotate(n*Math.PI/180),s&&(l.fillStyle=s),i&&(l.font=i),o&&(l.textAlign=o),a&&(l.textBaseline=a),l.fillText(e,c.width/10,c.height/2),`url(${c.toDataURL()})`):""}catch(e){return console.error("[ddan] watermark",e),""}},copyText:(e,t=!1)=>new Promise((r=>{!t&&navigator.clipboard?Gn("clipboard-write").then((t=>{Xn(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(Qn(e)))):r(Qn(e))})).catch((()=>{r(Qn(e))})):r(Qn(e))})),queryPermission:Gn,isAllowed:Xn,legacyCopy:Qn,takeHtmlLinks:e=>{if(!e)return[];const t=[];return[/<script[^>]+src="([^"]+)"/g,/<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"/g,/<link[^>]+rel="icon"[^>]+href="([^"]+)"/g].forEach((r=>{const n=es(e,r);t.push(n)})),[].concat(...t)},takeHtml:es,toBlobUrl:ts,workerURL:e=>ts(`(${e.toString()})()`,"text/javascript")};const ns=new class{__defStyle="vertical-align: middle; mask-position: 50% 50%; mask-repeat: no-repeat; mask-size: 100%; -webkit-mask-position: 50% 50%; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100%; background-color: currentColor;";__map={back:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M609.408 149.376L277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"/></svg>',right:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"/></svg>',home:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13 19.8h3.8v-7h3.303L12 4.697 3.897 12.8H7.2v7H11V17h2v2.8zm5 .2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-6H3.414a1 1 0 0 1-.707-1.707l8.586-8.586a1 1 0 0 1 1.414 0l8.586 8.586A1 1 0 0 1 20.586 14H18v6z" fill-rule="evenodd" fill-opacity=".9"/></svg>',close:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M764.288 214.592L512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"/></svg>',close_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M466.752 512l-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',close_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"/></svg>',warning:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M928.99 755.83L574.6 203.25c-12.89-20.16-36.76-32.58-62.6-32.58s-49.71 12.43-62.6 32.58L95.01 755.83c-12.91 20.12-12.9 44.91.01 65.03 12.92 20.12 36.78 32.51 62.59 32.49h708.78c25.82.01 49.68-12.37 62.59-32.49 12.91-20.12 12.92-44.91.01-65.03zM554.67 768h-85.33v-85.33h85.33V768zm0-426.67v298.66h-85.33V341.32l85.33.01z" fill="currentColor"/></svg>',play:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M512 1024A512 512 0 1 1 512 0a512 512 0 0 1 0 1024zm3.008-92.992a416 416 0 1 0 0-832 416 416 0 0 0 0 832zM383.232 287.616l384 224.896-384 223.104v-448z" fill="currentColor"/></svg>',lock:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32H224zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96z"/><path fill="currentColor" d="M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32zm192-160v-64a192 192 0 1 0-384 0v64h384zM512 64a256 256 0 0 1 256 256v128H256V320A256 256 0 0 1 512 64z"/></svg>',lock_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M467.2 713.92v115.968a44.8 44.8 0 0 0 89.6 0V713.92c26.752-14.72 44.8-42.304 44.8-73.92 0-47.104-40.128-85.312-89.6-85.312-49.472 0-89.6 38.208-89.6 85.312 0 31.616 18.048 59.136 44.8 73.92zM64 384h896v640H64V384zm268.8 0h358.4V256c0-94.272-80.256-170.688-179.2-170.688-98.944 0-179.2 76.416-179.2 170.688v128zM512 0c148.48 0 268.8 114.56 268.8 256v128H243.2V256C243.2 114.56 363.52 0 512 0z" fill="currentColor"/></svg>',plus:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"/></svg>',plus_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M352 480h320a32 32 0 1 1 0 64H352a32 32 0 0 1 0-64z"/><path fill="currentColor" d="M480 672V352a32 32 0 1 1 64 0v320a32 32 0 0 1-64 0z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',plus_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0v147.2z"/></svg>',star:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 747.84l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"/></svg>',star_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M283.84 867.84L512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"/></svg>',share:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M679.872 348.8l-301.76 188.608a127.808 127.808 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"/></svg>',love:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M171.712 571.648l.352.32 287.904 252.8a64 64 0 0 0 82.912 1.344l296.832-244.544a215.584 215.584 0 1 0-301.824-300.576L512 316.672l-25.888-35.616a215.584 215.584 0 1 0-314.4 290.624zM32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512l-295.36 243.392a128 128 0 0 1-165.888-2.592L129.984 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>',love_fill:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512L562.592 892.8a96 96 0 0 1-124.416-1.952L130.016 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>'};getBase64=e=>{const t=this.getSVG(e);return t?.url||""};getSVG=e=>{if(!e)return;const t=this.__map[e];if(!t)return;return{url:this.toBase64(t),escape:this.toEscape(t)}};toBase64=e=>{if(!e)return"";const t=this._tiny(e);return`data:image/svg+xml;base64,${Pr.encode(t)}`};_tiny=e=>e?e.replace(/<!--(.*)-->/g,"").replace(/[\r\n]/g," ").replace(/"/g,"'"):"";toEscape=e=>{if(!e)return"";return`data:image/svg+xml,${this._tiny(e).replace(/%/g,"%25").replace(/&/g,"%26").replace(/#/g,"%23").replace(/{/g,"%7B").replace(/}/g,"%7D").replace(/</g,"%3C").replace(/>/g,"%3E")}`};getStyle(e,t={}){if(!e)return"";const r=this.__map[e];return r?this.toStyle(r,t):""}toStyle(e,t={}){if(!e)return"";const r=this.toBase64(e);return r?this.getStyleByUrl(r,t):""}getStyleByUrl(e,t={}){if(!e)return"";const{key:r="mask-image",gradientValue:n="radial-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5))",gradient:s=!1,defStyle:i=this.__defStyle}=t,o=s&&n?`${n}, url("${e}")`:`url("${e}")`;return`${r}:${o};-webkit-${r}:${o};${i}`}},ss={mini:zn,css:Zn,qs:xr,icon:ns,html:rs},is=({url:e,options:t})=>{const r={"Content-Type":"application/json; charset=utf-8",...t.headers||{}};return t.headers=r,new Promise(((r,n)=>{fetch(e,t).then((e=>{r(e.json())})).catch((e=>{n(e)}))}))};function os(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function as(e){const{url:t="",host:r,options:n}=e,s=e;if(t.startsWith("http://")||t.startsWith("https://")||(s.url=(r||"")+t),"GET"===n.method.toUpperCase()&&n.body){const e=JSON.parse(n.body);if(cn.isPlainObject(e)){const r=xr.stringify(e),n=-1===t.indexOf("?")?"?":"&";s.url=`${s.url||""}${n}${r}`,delete s.options.body}}return n&&n.plugins&&delete s.options?.plugins,n&&n.model&&delete s.options?.model,s}class cs{host="";reqConfig={};handleError;interceptors={request:new In,response:new In};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(as),this.interceptors.response.use(e.handleResponse||os),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){cs.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete cs.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}async fetch(e,t){const r=cn.copy(this.reqConfig[e])||{},n={host:this.host,url:r.url||"",options:{...r||{},body:JSON.stringify({...t||{}})}};try{const s=await this.interceptors.request.invoke(n);let i;if(delete s.options.plugins,"block"===r.model)this.lockR(cs.blockId,(()=>is(s))),i=await cs.requestLock[cs.blockId].request;else if(cs.requestLock[cs.blockId]&&cs.requestLock[cs.blockId].lock&&await cs.requestLock[cs.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),cs.requestLock[e]||this.lockR(e,(()=>is(s))),i=await cs.requestLock[e].request,this.unlockR(e)}else i=await is(s);return this.interceptors.response.invoke({response:i,config:r,refetch:()=>({sig:"REFETCH",result:this.fetch(e,t)})})}catch(e){return this.handleError&&this.handleError(e),Promise.reject(e)}}}var ls={getDataURL:(e,t)=>{const r={contentType:"",dataUrl:""};return _e.to(fetch(e,{cache:t}).then((e=>(r.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(r.dataUrl=`data:${r.contentType};base64,`+Ve.ab2str(e,!0),r))))},getArrayBuffer:async(e,t)=>_e.to(fetch(e,{cache:t}).then((e=>e.arrayBuffer()))),getJson:async(e,t)=>_e.to(fetch(e,{cache:t}).then((e=>e.json()))),download:(e,t={})=>new Promise((r=>fetch(e).then((async e=>{if(!e.ok||200!==e.status)throw new Error(e.statusText);const n=+(e.headers.get("content-length")||""),s=e.body?.getReader();let i=0;const o=[];for(;;){const{done:e,value:r}=await s.read();if(e)break;o.push(r),i+=r.length;const a=Te.float(100*i/n,{digits:2});t?.progress&&t?.progress(a,i,n)}const a=new Uint8Array(i);let c=0;for(const e of o)a.set(e,c),c+=e.length;t?.success&&t?.success(a),r(a)})).catch((e=>{t?.fail&&t?.fail(e),r(void 0)})))),getText:async(e,t)=>_e.to(fetch(e,{cache:t}).then((e=>e.text()))),cache:async(e,t="no-cache")=>_e.to(fetch(e,{cache:t}).then((()=>!0)))};class us{publicKey="";privateKey="";iv="";__privateCryptoKey;__sharedSecret;__curve;__keyFormat;__subtle;constructor(e="P-256",t="raw"){this.__curve=e,this.__keyFormat=t||"raw","undefined"!=typeof window?this.__subtle=window.crypto.subtle:this.__subtle={}}async generateKeys(){const e=await this.__subtle.generateKey({name:"ECDH",namedCurve:this.__curve},!0,["deriveKey","deriveBits"]);return this.__privateCryptoKey=e.privateKey,this.publicKey=await this.exportKey(e.publicKey),this.privateKey=await this.exportKey(e.privateKey,"pkcs8"),this}async exportKey(e,t="raw"){const r=await this.__subtle.exportKey(t||this.__keyFormat,e);return Ve.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Ve.base64ToBytes(e);return await this.__subtle.importKey(t||this.__keyFormat||"raw",n,{name:"ECDH",namedCurve:this.__curve},!0,r)}async setPrivateKey(e){if(!e)return!1;const t=await this.importKey(e,"pkcs8",["deriveKey","deriveBits"]);return this.privateKey=await this.exportKey(t,"pkcs8"),this.__privateCryptoKey=t,!0}async deriveSharedSecret(e,t){if(!this.__privateCryptoKey)return!1;const r=await this.importKey(e),n=await this.__subtle.deriveKey({name:"ECDH",public:r},this.__privateCryptoKey,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return this.__sharedSecret=n,this.iv=t||"",!0}async encode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Ve.base64ToBytes(r),s=Ve.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Ve.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Ve.base64ToBytes(r):Ve.getRandomBytes(12),s=Ve.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Ve.concatBytes(new Uint8Array(i),n);return Ve.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Ve.base64ToBytes(e),s=Ve.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Ve.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Ve.base64ToBytes(e);if(t.length<12)return"";const r=t.slice(t.length-12),n=t.slice(0,t.length-12),s=await this.__subtle.decrypt({name:"AES-GCM",iv:r},this.__sharedSecret,n);return Ve.textDecode(s)}}const fs={fetch:ls,Http:cs,css:Zn,qs:xr,icon:ns,html:rs,rsa:Xe,...{Ecdh:us}};var hs={brotliCompress:function(e,t=l.default.constants.BROTLI_DEFAULT_QUALITY){try{if(!e)return"";const r=Ve.toUtf8Bytes(e);return l.default.brotliCompressSync(r,{params:{[l.default.constants.BROTLI_PARAM_QUALITY]:t}}).toString("base64")}catch(t){return e||""}},brotliDecompress:function(e){try{if(!e)return"";const t=Ve.base64ToBytes(e);return l.default.brotliDecompressSync(t).toString("utf-8")}catch(t){return e||""}}};var ds={child_exec:e=>new Promise((t=>{if(!e)return t([null,""]);i.exec(e,((e,r)=>{t(e?[e||"error",""]:[null,r||""])}))}))};const ps=()=>{try{return"win32"===process.platform?gs():"darwin"===process.platform?ys():void 0}catch(e){return}},gs=async()=>{do{let e,t;if([e,t]=await ds.child_exec('reg query "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"'),e)break;const r=t.split("\n").find((e=>e.includes("ProxyEnable")));if(!(r&&r.trim().endsWith("1")))break;const n=t.split("\n").find((e=>e.includes("ProxyServer"))),s=n?n.split(" ").filter(Boolean).pop():"";if(!s)break;const i=s.split(":");if(i.length<=1)break;const o=i[0],a=+(i[1]||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},ys=async()=>{do{let e,t;if([e,t]=await ds.child_exec('networksetup -getwebproxy "Wi-Fi"'),e)break;const r=t.split("\n"),n=r.find((e=>e.includes("Enabled")));if(!(n&&n.includes("Yes")))break;const s=r.find((e=>e.includes("Server"))),i=r.find((e=>e.includes("Port"))),o=s?s.split(":")[1]?.trim():null,a=+((i?i.split(":")[1]?.trim():null)||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},ms=(e,t=["*"],r="DIRECT",n=[])=>{const s=e||r||"DIRECT",i=r||"DIRECT",o=`\n function FindProxyForURL(url, host) {\n if (host === "127.0.0.1" || host === "localhost") {\n return "DIRECT";\n }\n\n if (isInNet(host, "10.0.0.0", "255.0.0.0") ||\n isInNet(host, "172.16.0.0", "255.240.0.0") ||\n isInNet(host, "192.168.0.0", "255.255.0.0")) {\n return "DIRECT";\n }\n\n var _rules = ${JSON.stringify(t)};\n var _proxy = "${s}";\n var _default = "${i}";\n var _directs = ${JSON.stringify(n)};\n\n for (var i = 0; i < _rules.length; i++) {\n if (shExpMatch(host, _rules[i])) {\n return _proxy;\n }\n }\n\n for (var j = 0; j < _directs.length; j++) {\n if (shExpMatch(host, _directs[j])) {\n return "DIRECT";\n }\n }\n\n return _default;\n }\n `;return Ve.toDataUrl(o,"application/x-ns-proxy-autoconfig")},bs=(e,t,r)=>{if(!e||!t)return"";const{type:n="ALL",direct:s=!1}=r||{};let i="";switch(n?n.toUpperCase():""){case"ALL":i=`SOCKS5 ${e}:${t};PROXY ${e}:${t}`;break;case"PROXY":i=`PROXY ${e}:${t}`;break;case"SOCKS5":i=`SOCKS5 ${e}:${t}`}if(!i&&!s)return"";const o=[];return i&&o.push(i),s&&o.push("DIRECT"),o.join(";")};var ws={getSystemProxy:ps,toPacScript:ms,toPacProxy:bs,pacScript:async(e,t,r)=>{const{type:n="SOCKS5",rules:s=["*"],useSystem:i}=r||{},o=bs(e,t,{type:n});if(!o)return"";let a;if(i){const e=await ps();e&&(a=bs(e?.ipaddress||"",e?.port||0,{direct:!0}))}return ms(o,s||[],a)},getPacScript:async e=>{const{type:t="SOCKS5",rules:r=["*"],useSystem:n,address:s="",port:i=0,directs:o=[]}=e||{},a=bs(s,i,{type:t});let c;if(n){const e=await ps();e&&(c=bs(e?.ipaddress||"",e?.port||0,{direct:!0}))}return ms(a,r||[],c,o)}};const _s=(e,t)=>new Promise(((r,n)=>{f.default.readdir(e,(async(s,i)=>{if(s)return n(s);r(vs(e,i,t))}))})),vs=async(e,t,r)=>{for(let n of t){const t=`${e}\\${n}`;f.default.lstatSync(t).isDirectory()?await _s(`${t}`,r):r&&await r(t)}};var xs={...{readDirectory:_s,readFiles:vs},...hs,...ds,...ws,Ecdh:class{publicKey="";privateKey="";sharedSecret;iv="";__curve;__algorithm;__ecdh;constructor(e="prime256v1",t="aes-256-gcm"){this.__curve=e,this.__algorithm=t,this.generateKeys()}generateKeys(){const e=c.default.createECDH("prime256v1");e.generateKeys(),this.publicKey=e.getPublicKey("base64"),this.privateKey=e.getPrivateKey("base64"),this.__ecdh=e}setPrivateKey(e){return!!e&&(!!this.__ecdh&&(this.__ecdh.setPrivateKey(e,"base64"),this.publicKey=this.__ecdh.getPublicKey("base64"),!0))}setSharedSecret(e){return!!e&&(this.sharedSecret=e,!0)}deriveSharedSecret(e,t){return!!e&&(this.sharedSecret=this.__ecdh.computeSecret(e,"base64").toString("base64"),this.iv=t||"",!0)}encode(e,t){if(!this.sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Ve.base64ToBytes(r),s=c.default.createCipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),n),i=Buffer.concat([new Uint8Array(s.update(e,"utf8")),new Uint8Array(s.final())]),o=s.getAuthTag();return Buffer.concat([new Uint8Array(i),new Uint8Array(o)]).toString("base64")}encodeiv(e,t){if(!this.sharedSecret)return"";const r=t||this.iv,n=r?Ve.base64ToBytes(r):Ve.getRandomBytes(12),s=c.default.createCipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),n),i=Buffer.concat([new Uint8Array(s.update(e,"utf8")),new Uint8Array(s.final())]),o=s.getAuthTag();return Buffer.concat([new Uint8Array(i),new Uint8Array(o),n]).toString("base64")}decode(e,t){if(!e||!this.sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=c.default.createDecipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),Ve.base64ToBytes(r)),s=Ve.base64ToBytes(e),i=s.slice(s.length-16);n.setAuthTag(i);const o=s.slice(0,s.length-16);return Buffer.concat([new Uint8Array(n.update(o)),new Uint8Array(n.final())]).toString("utf-8")}decodeiv(e){if(!e||!this.sharedSecret)return"";const t=Ve.base64ToBytes(e);if(t.length<28)return"";const r=t.slice(t.length-12),n=t.slice(t.length-28,t.length-12),s=c.default.createDecipheriv("aes-256-gcm",Ve.base64ToBytes(this.sharedSecret),r);s.setAuthTag(n);const i=t.slice(0,t.length-28);return Buffer.concat([new Uint8Array(s.update(i)),new Uint8Array(s.final())]).toString("utf-8")}},EcdhWeb:class extends us{constructor(e="P-256",t="raw"){super(e,t),this.__subtle=c.default.webcrypto.subtle}},Socks5:class{upstreamProxy;server=null;clientSockets=new Set;systemProxy=null;useSystemProxy=!1;__debug=!1;__uuid;__port=0;__event;__pipeline;__logger;__totalReceived=0;__totalSent=0;__rules=[];constructor(e,t=!1,r){this.__event=new m,this.upstreamProxy=this.filterProxyConfigs(e),this._updateRules(),this.__debug=t,this.__uuid=y(),this.__pipeline=new Se(1),this.__logger=r||console}get id(){return this.__uuid}get port(){return this.__port}get url(){return this.__port?`socks5://127.0.0.1:${this.__port}`:""}get totalReceived(){return this.__totalReceived}get totalSent(){return this.__totalSent}get rules(){return this.__rules}validateProxyConfig(e){const{ipaddress:t,port:r,userId:n,password:s}=e||{};return t&&"string"==typeof t?r&&"number"==typeof r?n&&"string"==typeof n?s&&"string"==typeof s?"":"无效的上游代理密码":"无效的上游代理用户名":"无效的上游代理端口":"无效的上游代理 IP 地址"}filterProxyConfigs(e){let t=[];t=e&&Array.isArray(e)?e:[e];const r=[];for(const e of t)this.validateProxyConfig(e)||r.push(e);return r}async start(e=8838){if(this.upstreamProxy.length<=0)return 0;if(this.server)return this.__debug&&console.info("[socks5] server is already running"),this.__port;const t=await this.findAvailablePort(e);return t?(this.__port=t,this.server=u.default.createServer((e=>this.handleSocksConnection(e))),this.server.listen(t,(()=>{this.__debug&&this.__logger?.info(`[socks5] server is running on port ${t}`)})),this.server.on("error",(e=>{this.__logger?.error("[socks5] server error:",e),this.close()})),t):0}setUpstreamProxy(e){if(!e)return!1;const t=this.filterProxyConfigs(e);return!(!t||t.length<=0)&&(this.upstreamProxy=t,this._updateRules(),!0)}setSystemProxy(e,t){this.useSystemProxy=e,e&&t&&t.ipaddress&&t.port&&(this.systemProxy=t)}async findAvailablePort(e,t=200){let r=e,n=0;for(;n<t;)try{return await new Promise(((e,t)=>{const n=u.default.createServer();n.unref(),n.on("error",t),n.listen(r,(()=>{n.close((()=>e()))}))})),r}catch{n++,r++}return this.__debug&&this.__logger?.warn("[socks5] findAvailablePort failed"),0}async handleSocksConnection(e){let t="";try{if(!e)return;this.clientSockets.add(e),e.on("close",(()=>{this.clientSockets.delete(e),e?.destroy()})),await this.performHandshake(e);const r=await this.parseClientRequest(e),n=r.addr;t=`${n}:${r.port}`,this.__debug&&this.__logger?.info("[socks5] connection",t);const s=this.findProxyConfig(n);if(s){const n=await this.connectToUpstreamProxy(r,s);this.__logger?.info(`[socks5] connection upstream ${t}, use ${s.ipaddress}:${s.port}`),this.setupDataForwarding(e,n,"upstream")}else if(this.useSystemProxy&&this.systemProxy&&!xr.isLocalIpAddress(n)){const n=await this.connectToSystemProxy(r);this.__debug&&console.info("[socks5] connection system",t),this.setupDataForwarding(e,n,"system")}else{this.__debug&&console.info("[socks5] connection local",t);const n=await this.connectToLocal(r);this.setupDataForwarding(e,n,"local")}}catch(r){this.__debug&&this.__logger?.error("[socks5] connection failed:",r),e.end(new Uint8Array([5,1])),this._emit("error",r,t)}}performHandshake(e){return new Promise(((t,r)=>{e.once("data",(n=>{if(5!==n[0])return r(new Error("Unsupported SOCKS version"));e.write(new Uint8Array([5,0])),t()}))}))}parseClientRequest(e){return new Promise(((t,r)=>{e.once("data",(e=>{let n,s;if(1!==e[1])return r(new Error("Unsupported command"));if(1===e[3])n=e.slice(4,8).join("."),s=e.readUInt16BE(8);else{if(3!==e[3])return r(new Error("Unsupported address type"));{const t=e[4];n=e.slice(5,5+t).toString(),s=e.readUInt16BE(5+t)}}t({addr:n,port:s})}))}))}async connectToUpstreamProxy(e,t){const r={proxy:{ipaddress:t.ipaddress,port:t.port,type:5,userId:t.userId,password:t.password},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(r)}catch(e){throw new Error("Failed to connect to upstream proxy: "+e)}}async connectToSystemProxy(e){const t={proxy:{...this.systemProxy,type:5},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(t)}catch(e){throw new Error("Failed to connect to system proxy: "+e)}}async connectToProxy(e){const{socket:t}=await s.SocksClient.createConnection(e);return t}async connectToLocal(e){return new Promise(((t,r)=>{const n=u.default.createConnection(e.port,e.addr,(()=>{t(n)}));n.on("error",(e=>{r(e)}))}))}setupDataForwarding(e,t,r="local"){e.write(new Uint8Array([5,0,0,1,0,0,0,0,0,0])),e.pipe(t),t.pipe(e);const n=`${t.localAddress}:${t.localPort}`;this.__debug&&console.info(`[socks5] setupDataForwarding ${n}`),"upstream"===r&&(t.on("data",(e=>{this.__totalSent+=e.length})),e.on("data",(e=>{this.__totalReceived+=e.length}))),e.on("close",(()=>{this.__debug&&console.info("[socks5] client socket close",n),t.end()})),t.on("close",(()=>{this.__debug&&console.info("[socks5] target socket close",n),e.end()})),e.on("error",(e=>{this.__debug&&console.error("[socks5] client socket error:",e?.message),t.end()})),t.on("error",(t=>{this.__debug&&console.error("[socks5] target socket error:",t?.message),e.end()}))}findProxyConfig(e){if(!xr.isLocalIpAddress(e))for(const t of this.upstreamProxy)if(this.isAllowedDomain(e,t.rules||[]))return t}isAllowedDomain(e,t){if(xr.isLocalIpAddress(e))return!1;if(!t||!Array.isArray(t))return!1;for(const r of t){if("*"===r)return!0;if(xr.shExpMatch(e,r))return!0}return!1}close(){try{if(!this.server)return;this.__debug&&this.__logger?.info("[socks5] closing SOCKS5 proxy server..."),this.server.close((e=>{e&&this.__debug&&this.__logger?.error("[socks5] closing the server failed:",e)})),this.clientSockets.forEach((e=>e?.destroy())),this.clientSockets.clear(),this.server=null,this.__port=0}catch(e){this.__debug&&this.__logger?.error("[socks5] close error:",e)}}on(e,t){e&&t&&(this.__event.off(e,t),this.__event.on(e,t))}off(e,t){e&&this.__event.off(e,t)}resetStatistics(){this.__totalReceived=0,this.__totalSent=0}_emit(e,...t){try{if(!e)return;this.__event.emit(e,...t)}catch(e){}}_updateRules(){this.upstreamProxy&&(this.__rules=ln.distinct(this.upstreamProxy.reduce(((e,t)=>e.concat(t?.rules||[])),[])))}},rsa:Qe};const As={...xs};var Ss={ossImage:(e,t={})=>{if(!e)return e;const r=xr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=ln.toList(t.domain||""),n=e.match(/^http[s]?:\/\/([\w.]+)[\w\W]+/)[1]||"";if(!n||!r.includes(n))return e}const n=[];return t.webp&&!r.endsWith(".gif")&&n.push("format,webp"),t.resize&&n.push(`resize,s_${t.resize}`),t.interlace&&(n.push("interlace,1"),!n.every((e=>!e.startsWith("format")))||r.endsWith(".gif")||r.endsWith(".jpg")||n.push("format,jpg")),n.length<=0?e:`${r}?x-oss-process=image/${n.join("/")}`},ossSnapshot:(e,t={})=>{if(!e)return e;const r=xr.parseUrl(e).url,n=["snapshot"],{m:s="fast",f:i="jpg"}=t;return(t.t||0===t.t)&&n.push(`t_${t.t}`),t.w&&n.push(`w_${t.w}`),t.h&&n.push(`h_${t.h}`),s&&n.push(`m_${s}`),i&&n.push(`f_${i}`),t.ar&&n.push(`ar_${t.ar}`),`${r}?x-oss-process=video/${n.join(",")}`},ossBase64:e=>je.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const ks={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},Cs=e=>(...t)=>{const r=console[e];ks.overrode?r(...t):$s(r,e,...t)},$s=(e,t,...r)=>{const n=Or.format(new Date,ks.format),s=ks.tag?`[${t}]`:"";s&&n?e.apply(console,[`${n} ${s}`,...r]):n?e.apply(console,[`${n}`,...r]):s?e.apply(console,[`${s}`,...r]):e.apply(console,[...r])};var js={override:()=>{if(ks.overrode)return;ks.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{$s(t,e,...r)}}))},log:Cs("log"),info:Cs("info"),warn:Cs("warn"),error:Cs("error"),config:({tag:e=ks.tag,format:t=ks.format}={})=>{ks.tag=e,ks.format=t}};class Os{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=ar.debounce((e=>{if(this.key&&this.storage)try{const{setItem:t,setStorageSync:r}=this.storage;if(r)return r(this.key,e);if(t)return t(this.key,JSON.stringify(e))}catch(e){console.error("persit save ",e)}}));read(){if(this.key&&this.storage)try{const{getItem:e,getStorageSync:t}=this.storage;if(t)return t(this.key);if(e){const t=e(this.key);return JSON.parse(t)}}catch(e){return void console.error("persit read ",e)}}handleSave(e,t){if(!this.fields.includes(t)||!e)return;const r=dr.copy(e,{fields:this.fields});this.save(r)}}class Es extends m{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!ee.isFunction(n))return;const[,s]=await ar.run(n({...r,commit:r.commit.bind(r),query:r.query.bind(r),dispatch:r.dispatch.bind(r)},t));return s}async query(e){const t=Reflect.get(this,e);let r;if(null!=t&&""!==t)r=dr.copy(t);else{const[,t]=await ar.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){ee.isObject(t)&&(t=dr.copy(t)),this[e]=t}}const Ps=(e,t)=>{const r=Object.assign(new Es,e||{});r.__persist=new Os(t||r.persist);const n=r.__persist.read(),s=n?Object.assign(r,n):r;return new Proxy(s,{get:(e,t,r)=>{const n=Reflect.get(e.getters,t);return ee.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(ee.isFunction(s)&&!s(e,r))return!0;const i=Reflect.set(e,t,r,n);return i&&(e.emit(t.toString(),r),e?.__persist?.handleSave(e,t.toString())),i},has:(e,t)=>Reflect.has(e,t)})};class Ts{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=xr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=xr.stringify(s,{uri:!1});this.list.push(`${e}?${i}`)}_parseHost(e){e&&!this.host&&/^http[s]?:\/\/([\w.]+)/.test(e)&&(this.host=e.replace(/^http[s]?:\/\/([\w.]+)[\w\W]+/,"$1"))}image(e,t={}){if(!e||!e.includes(this.host))return;if(this.list.length<=0)return;const r={g:"nw",...t},n=e.replace(/^http[s]?:\/\/[\w.]+\/([\w-.,_/?%&=]+)$/,"$1"),s=Tr.base64.encodeByOss(n),i=xr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=Tr.base64.encodeByOss(e),i=xr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}class qs{__list=[];constructor(){this.clear()}add(e){const t=ar.run(e);return this.__list.push(t),this}clear(){return this.__list=[],this}wait(){const e=this.__list;return this.clear(),Promise.allSettled(e)}}const Bs=new class{state=Ps(new Es);frame=new Ar;cache=new Map;cacheTime=new Map;setCache=(e,t)=>null!=t&&(!!e&&(this.cache.set(e,t),this.cacheTime.set(e,Date.now()),!0));hasCache=e=>{if(!e)return!1;this.cache.has(e)};getCache=e=>{if(e)return this.cache.get(e)};getCacheTime=e=>e&&this.cacheTime.get(e)||0;removeCache=e=>{e&&(this.cache.delete(e),this.cacheTime.delete(e))};cacheId=e=>`_${e}_cache_`;timesRecord=(e,t={})=>{if(!e)return;const{mode:r="running",cycle:n="day"}=t||{},s=this.cacheId(r),i=this.getCache(s)||{},o=Date.now(),a=i[e],c={time:o,count:1,cycle:n};return a&&("day"!==n||Or.isToday(a.time||0))&&(c.count=1+(a.count||0)),i[e]=c,this.setCache(s,i),i};timesValid=(e,t={})=>{if(!e)return!1;const{max:r=1,interval:n=0,mode:s="running",cycle:i="day"}=t||{},o=this.cacheId(s);let a=this.getCache(o);if(!a)return!0;const c=a[e];if(!c)return!0;if("day"===i&&!Or.isToday(c.time||0))return!0;if(r<=(c.count||0))return!1;return!(Date.now()-(c.time||0)<n)};timesClean=(e="running")=>{const t=this.cacheId(e),r=this.getCache(t);if(!r)return;const n=cn.copy(r);cn.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||Or.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new qs};class Ls{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=y(),this.start=Date.now(),this.timeStartDesc=Or.format(this.start,"hh:mm:ss.SSS")}get time(){return this.flag?this.end:this.start}get timeDesc(){return this.flag?this.timeEndDesc:this.timeStartDesc}done=(e=Date.now())=>{this.start&&(this.end=e,this.cost=this.end-this.start,this.timeEndDesc=Or.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const Rs=new class{__map=new Map;__trackList=[];opened=!0;clear(){return this.__map.clear(),this.__trackList=[],this}add(e,{desc:t="",type:r=""}={}){if(!e||!this.opened)return"";const n=new Ls;return n.name=e,n.type=r,n.desc=t,this.__trackList.push(n),n.id}done(e){if(!e||!this.opened)return;const t=this.__trackList.find((t=>t.id===e));if(!t||t.isDone)return;t.done();const r=dr.cloneClass(t);r.id=this._endId(e),r.flag=1,r.desc=`${t.desc} | end`,this.__trackList.push(r)}getTrack(e){return this.__trackList.find((t=>t.id===e))}getLine(e){if(!e||e.endsWith("-end"))return[];const t=this.__trackList.findIndex((t=>t.id===e));if(t<0)return[];const r=this._endId(e),n=this.__trackList.findIndex((e=>e.id===r)),s=n<0?this.__trackList.length-t:n-t+1;return ln.take(this.__trackList,s,t)}getList(e,t=""){if(!e)return[];const r=this.__trackList.filter((t=>t.name===e));if(r.length<=0)return[];if(!t)return r;const n=this._endId(t);return this.__trackList.filter((e=>e.id===t||e.id===n))}get list(){return this.__trackList}get size(){return this.__trackList.length}_endId=e=>`${e}-end`;report(e){const t=this.list;if(!t||t.length<=0)return;const r=t[0].time;t.forEach((t=>e&&e(t,r)))}},Fs={cdn:Ss,watermark:(e,t)=>new Ts(e,t)},Us={Store:Es,storeRef:Ps,Persist:Os,persistConfig:(e,t,r)=>({key:e,fields:t,storage:r})},Ds=Bs,Is=Rs,Ms=js;e.Event=m,e.KValue=b,e.Mapping=class{_map=new Map;constructor(){this._map.clear()}get keys(){return Array.from(this._map.keys())}get values(){return Array.from(this._map.values())}get(e){if(!e)return;const t=this._map.get(e);return t?t.value:void 0}getKV(e){if(e)return this._map.get(e)}set(e,t){if(!e)return;const r=this._map.get(e);r?(r.set(t),this.clean()):this._map.set(e,new b(e,t))}delete(e,t){if(!e)return;const r=this._map.get(e);t&&t(r?.value),this._map.delete(e)}clear(){this._map.clear()}clean(e=100,t){try{if(this._map.size<=e)return;if(this.keys.filter((e=>{if(!this._map.has(e))return!1;const t=this._map.get(e);return!t||!t.value})).forEach((e=>{this._map.delete(e)})),this._map.size<=e)return;const r=this.values.sort(((e,t)=>e.timestamp-t.timestamp)),n=r.length-e;if(n<=0)return;r.splice(0,n).forEach((e=>{this.delete(e.key,t)}))}catch(e){console.log("mapping clean",e)}}},e.dCdn=Fs,e.dHook=Gr,e.dJoker=Ds,e.dLogger=Ms,e.dMini=ss,e.dNode=As,e.dStore=Us,e.dTracker=Is,e.dUtil=Bn,e.dWeb=fs,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/bin/ddan-js.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"crypto";import t from"zlib";import r from"net";import{SocksClient as n}from"socks";import{exec as s}from"child_process";import i from"fs";const o="0123456789",a="abcdefghijklmnopqrstuvwxyz",c="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var l={keyNumber:o,keyLower:a,keyUpper:c,keyChars:o+a+c};const u=(e=0,t=0)=>{const r=l.keyChars.split(""),n=[];let s;if(t=t||r.length,e)for(s=0;s<e;s++)n[s]=r[0|Math.random()*t];else{let e;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",s=0;s<36;s++)n[s]||(e=0|16*Math.random(),n[s]=r[19==s?3&e|8:e])}return n.join("")};class f{__map;__tagList;__eventId="";constructor(){this.__map=new Map,this.__tagList=[],this.__eventId=u()}clear(){return this.__map.clear(),this}on(e,t,r=""){if(!e||!t)return this;let n=this.__map.get(e);return n||(n=new Set,this.__map.set(e,n)),n.add(t),r&&this.__tagList.push({name:e,listener:t,tag:r}),this}emit(e,...t){if(!e)return this;const r=this.__map.get(e);if(!r)return this;return[...r].forEach((e=>e&&e(...t))),this}off(e,t){if(!e||!t)return this;this.__tagList=this.__tagList.filter((r=>r.name!==e||r.listener!==t));const r=this.__map.get(e);return r?(r.delete(t),r.size<=0&&this.__map.delete(e),this):this}remove(e){return e?(this.__tagList=this.__tagList.filter((t=>t.name!==e)),this.__map.delete(e),this):this}removeByTag(e){if(!e)return this;return this.__tagList.filter((t=>t.tag===e)).forEach((e=>{this.off(e.name,e.listener)})),this.__tagList=this.__tagList.filter((t=>t.tag!==e)),this}once(e,t){const r=(...n)=>{t(...n),this.off(e,r)};return this.on(e,r),this}has(e){return this.__map.has(e)}}class h{timestamp=0;_key="";_value;constructor(e,t){this._key=e,this._value=t,this.updateAt()}get key(){return this._key}get value(){return this._value}set(e){this._value=e,this.updateAt()}updateAt(){this.timestamp=Date.now()}clear(){this.set(void 0)}}class d{_map=new Map;constructor(){this._map.clear()}get keys(){return Array.from(this._map.keys())}get values(){return Array.from(this._map.values())}get(e){if(!e)return;const t=this._map.get(e);return t?t.value:void 0}getKV(e){if(e)return this._map.get(e)}set(e,t){if(!e)return;const r=this._map.get(e);r?(r.set(t),this.clean()):this._map.set(e,new h(e,t))}delete(e,t){if(!e)return;const r=this._map.get(e);t&&t(r?.value),this._map.delete(e)}clear(){this._map.clear()}clean(e=100,t){try{if(this._map.size<=e)return;if(this.keys.filter((e=>{if(!this._map.has(e))return!1;const t=this._map.get(e);return!t||!t.value})).forEach((e=>{this._map.delete(e)})),this._map.size<=e)return;const r=this.values.sort(((e,t)=>e.timestamp-t.timestamp)),n=r.length-e;if(n<=0)return;r.splice(0,n).forEach((e=>{this.delete(e.key,t)}))}catch(e){console.log("mapping clean",e)}}}const p="object"==typeof global&&null!==global&&global.Object===Object&&global,g="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,y="object"==typeof self&&null!==self&&self.Object===Object&&self,m=g||p||y||Function("return this")(),b=m.Symbol,{toString:w,hasOwnProperty:_,propertyIsEnumerable:v}=Object.prototype,x=b?b.toStringTag:void 0;function A(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":x&&x in Object(e)?function(e){const t=_.call(e,x),r=e[x];let n=!1;try{e[x]=void 0,n=!0}catch(e){}const s=w.call(e);return n&&(t?e[x]=r:delete e[x]),s}(e):w.call(e)}var S={getTag:A,getType:function(e){return(A(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:w,hasOwnProperty:_,propertyIsEnumerable:v};const k="object"==typeof exports&&null!==exports&&!exports.nodeType&&exports,C=k&&"object"==typeof module&&null!==module&&!module.nodeType&&module,$=C&&C.exports===k&&p.process,O=(()=>{try{const e=C&&C.require&&C.require("util").types;return e||$&&$.binding&&$.binding("util")}catch(e){}})();var j="[object Function]",E="[object GeneratorFunction]",P="[object AsyncFunction]",T=9007199254740991;const q=/^(?:0|[1-9]\d*)$/,B=m?.Buffer?.isBuffer,L=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,R=O&&O.isTypedArray;function F(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function U(e){return null!=e&&"object"==typeof e}const D=Array.isArray;function I(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=T}(e.length)&&!K(e)}function M(e){return U(e)&&I(e)}function K(e){var t=F(e)?S.getTag(e):"";return t===j||t===E||t===P}function z(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function N(e){return M(e)&&S.hasOwnProperty.call(e,"callee")&&(!S.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==S.toString.call(e))}const H="undefined"!=typeof window&&void 0!==window.document,V="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,W=R?e=>R(e):e=>U(e)&&L.test(S.getTag(e)),Z="function"==typeof B?B:()=>!1;var Y={is:function(e,t){return S.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===S.getTag(e)},isString:function(e){return"string"==typeof e||!D(e)&&U(e)&&"[object String]"==S.getTag(e)},isObject:F,isObjectLike:U,isPlainObject:function(e){if(!U(e)||"[object Object]"!=S.getTag(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},isSymbol:function(e){return"symbol"==typeof e||U(e)&&"[object Symbol]"===S.getTag(e)},isFunction:K,isArray:D,isArrayLikeObject:M,isIndex:function(e,t){return!!(t=null==t?T:t)&&("number"==typeof e||q.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:I,isPrototype:z,isArguments:N,isPromise:function(e){return"[object Promise]"===(F(e)?S.getTag(e):"")},isBrowser:H,isNode:V,isBlobOrBuffer:e=>e instanceof Blob||e instanceof ArrayBuffer,isUint8Array:e=>e instanceof Uint8Array,isArrayBuffer:e=>e instanceof ArrayBuffer,isEmpty:e=>{if(null==e)return!0;if(I(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||Z(e)||W(e)||N(e)))return!e.length;const t=S.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(z(e))return!Object.keys(e).length;for(const t in e)if(S.hasOwnProperty.call(e,t))return!1;return!0}};const J=NaN,Q=/^\s+|\s+$/g,G=/^[-+]0x[0-9a-f]+$/i,X=/^0b[01]+$/i,ee=/^0o[0-7]+$/i,te=parseInt,re=1/0,ne=17976931348623157e292;function se(e){if("number"==typeof e)return e;if(Y.isSymbol(e))return J;if(Y.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=Y.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Q,"");const t=X.test(e);return t||ee.test(e)?te(e.slice(2),t?2:8):G.test(e)?J:+e}function ie(e){return e?(e=se(e))===re||e===-re?(e<0?-1:1)*ne:e==e?e:0:0===e?e:0}var oe={toNumber:se,toFinite:ie,toInteger:function(e){var t=ie(e),r=t%1;return t==t?r?t-r:t:0}};const ae="Expected a function",ce=Math.max,le=Math.min;function ue(e,t=300,r={}){let n,s,i,o,a,c,l=0,u=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(ae);function d(t){const r=n,i=s;return n=s=void 0,l=t,o=e.apply(i,r),o}function p(e){const r=e-c;return void 0===c||r>=t||r<0||f&&e-l>=i}function g(){const e=Date.now();if(p(e))return y(e);a=setTimeout(g,function(e){const r=t-(e-c);return f?le(r,i-(e-l)):r}(e))}function y(e){return a=void 0,h&&n?d(e):(n=s=void 0,o)}function m(...e){const r=Date.now(),i=p(r);if(n=e,s=this,c=r,i){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),u?d(e):o}(c);if(f)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=oe.toNumber(t)||0,Y.isObject(r)&&(u=!!r.leading,f="maxWait"in r,i=f?ce(oe.toNumber(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h),m.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=c=s=a=void 0},m.flush=function(){return void 0===a?o:y(Date.now())},m.pending=function(){return void 0!==a},m}class fe{__list=[];constructor(e){this.push(e)}push(e){return e&&this.__list.push(e),this}clear(){return this.__list=[],this}_exec(e,t){let r;if(Y.isFunction(e))r=e(t);else{if(Y.isPromise(e))return e.then((e=>({...t,...e})));r=e}return Y.isPromise(r)?r:Promise.resolve({...r,...t})}run(e){try{return this.__list.reduce(((e,t)=>e.then((e=>this._exec(t,e)))),Promise.resolve(e)).then((e=>[void 0,e])).catch((e=>[e,void 0]))}catch(e){return Promise.reject([e,void 0])}}}async function he(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const de=(e,t)=>{try{let r;return r=Y.isFunction(e)?e():e,he(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},pe=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var ge={to:he,go:(e,t)=>de(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:de,toError:pe,timeout:(e,t=0,r="timeout")=>{if(t<=0)return de(e);let n;function s(){n&&clearTimeout(n)}const i=new Promise((e=>{s(),n=setTimeout((()=>e([pe(r||"timeout"),void 0])),t)}));return Promise.race([de(e,s),i])}};class ye{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var me={singleton:function(){class e{static __instance__;constructor(){}static get Instance(){return e.__instance__||(e.__instance__=new this),e.__instance__}static get I(){return this.Instance}}return e},getset:function(e){const t=new ye;return void 0!==e&&t.set(e),t}};class be{_func;_callback;constructor(e,t){this._func=e,this._callback=t}async run(){return ge.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class we{__list=[];__count=0;__max=1;constructor(e=1){this.__count=0,this.__max=e>0?e:1,this.clear()}push(e,t){const r=new be(e,t);return this.__list.push(r),this._step(),this}clear(){return this.__list=[],this.__count=0,this}_step(){if(this.__list.length<=0)return;if(this.__count>=this.__max)return;const e=this.__list.shift();e?(this.__count+=1,e?.run().finally((()=>{try{this.__count>0&&(this.__count-=1),this._step()}catch(e){console.error("[ddan] pipepine step finally",e)}}))):this._step()}async whenAll(){for(;;){if(this.__count<=0)break;await ge.delay(100),this._step()}return this.clear()}}class _e extends(me.singleton()){__lockedMap=new Map;pipeline=new we;constructor(){super()}lock(e,t){if(!e||!t)return;const r=ge.safeRun(t);return this.__lockedMap.set(e,r),r}unlock(e){e&&this.__lockedMap.has(e)&&this.__lockedMap.delete(e)}async exec(e,t){if(!e||!t)return ge.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return ge.safeRun(e);const s=await n;return this.unlock(t),s}}var ve={toUtf8:e=>{if(!e)return"";const t=e.replace(/\r\n/g,"\n");let r="";for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r+=String.fromCharCode(n):n>127&&n<2048?(r+=String.fromCharCode(n>>6|192),r+=String.fromCharCode(63&n|128)):(r+=String.fromCharCode(n>>12|224),r+=String.fromCharCode(n>>6&63|128),r+=String.fromCharCode(63&n|128))}return r},fromUtf8:e=>{let t="",r=0;if(!e)return"";let n=0,s=0,i=0;for(;r<e.length;)n=e.charCodeAt(r),n<128?(t+=String.fromCharCode(n),r++):n>191&&n<224?(s=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&s),r+=2):(s=e.charCodeAt(r+1),i=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3);return t},toUtf8Bytes:e=>{if(!e)return new Uint8Array;const t=e.replace(/\r\n/g,"\n"),r=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r.push(n):n<2048?(r.push(n>>6|192),r.push(63&n|128)):(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128))}return new Uint8Array(r)},fromUtf8Bytes:e=>{let t="",r=0;if(!e||e.length<=0)return"";for(;r<e.length;){let n=e[r];if(n<128)t+=String.fromCharCode(n),r++;else if(n>191&&n<224){const s=e[r+1];t+=String.fromCharCode((31&n)<<6|63&s),r+=2}else{const s=e[r+1],i=e[r+2];t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3}}return t}};const xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Ae={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=ve.toUtf8(e);l<e.length;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+xe.charAt(s)+xe.charAt(i)+xe.charAt(o)+xe.charAt(a);return c},fromBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=xe.indexOf(e.charAt(l++)),i=xe.indexOf(e.charAt(l++)),o=xe.indexOf(e.charAt(l++)),a=xe.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c+=String.fromCharCode(t),64!=o&&(c+=String.fromCharCode(r)),64!=a&&(c+=String.fromCharCode(n));return c=ve.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",l=0;if(!e||!Y.isArrayLike(e)||!Y.isUint8Array(e))return"";for(;l<e.length;)t=e[l++],r=e[l++],n=e[l++],s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+xe.charAt(s)+xe.charAt(i)+xe.charAt(o)+xe.charAt(a);return c},base64ToBytes:(e="")=>{let t,r,n,s,i,o,a,c=[],l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=xe.indexOf(e.charAt(l++)),i=xe.indexOf(e.charAt(l++)),o=xe.indexOf(e.charAt(l++)),a=xe.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c.push(t),64!=o&&c.push(r),64!=a&&c.push(n);return new Uint8Array(c)}};function Se(e){return Math.floor(Math.random()*e)}function ke(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Ce=180/Math.PI;var $e={random:Se,randomRange:function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},lerp:function(e,t,r){return e*(1-r)+t*r},randoms:function(e,t=1,r=!1){const n=[];for(;;){if(n.length>=t)break;if(!r&&n.length>=e)break;const s=Se(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:ke,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=ke(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Ce},degree2radian:function(e){return e/Ce},calcDataSize:function(e){const t={gb:0,mb:0,kb:0,b:0,total:e,desc:""},r=[{name:"gb",divisor:1<<30},{name:"mb",divisor:1<<20},{name:"kb",divisor:1024},{name:"b",divisor:1}];for(const n of r){const r=Math.floor(e/n.divisor);t[n.name]=r,e-=r*n.divisor}return t.gb>0?t.desc=(t.gb+t.mb/1024).toFixed(2)+"GB":t.mb>0?t.desc=(t.mb+t.kb/1024).toFixed(2)+"MB":t.kb>0?t.desc=(t.kb+t.b/1024).toFixed(2)+"KB":t.desc=t.b+"B",t}};var Oe={bytes2str:e=>{if(!e||!Y.isArrayLike(e))return"";return e.reduce(((e,t)=>e+String.fromCharCode(t)),"")},str2bytes:(e="")=>{const t=e,r=new Uint8Array(t.length);for(let e=0,n=t.length;e<n;e++)r[e]=t.charCodeAt(e);return r},str2hex:e=>{let t="";for(let r=0;r<e.length;r++)t+=e.charCodeAt(r).toString(16).padStart(2,"0");return t},hex2str:e=>{let t="";for(let r=0;r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},concatBytes:(...e)=>{const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r},uint32ToBytes:e=>{const t=new Uint8Array(8);return t[0]=e[0]>>>24&255,t[1]=e[0]>>>16&255,t[2]=e[0]>>>8&255,t[3]=255&e[0],t[4]=e[1]>>>24&255,t[5]=e[1]>>>16&255,t[6]=e[1]>>>8&255,t[7]=255&e[1],t},bytesToUint32:e=>{const t=new Uint32Array(2);return t[0]=e[0]<<24|e[1]<<16|e[2]<<8|e[3],t[1]=e[4]<<24|e[5]<<16|e[6]<<8|e[7],t},hex2bytes:e=>{let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++)t[r]=parseInt(e.substr(2*r,2),16);return t},bytes2hex:e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""),toUint32:e=>{const t=Math.ceil(e.length/4),r=new Uint32Array(t);for(let n=0;n<t;n++)r[n]=e.charCodeAt(4*n)<<24|e.charCodeAt(4*n+1)<<16|e.charCodeAt(4*n+2)<<8|e.charCodeAt(4*n+3);return r},fromUint32:e=>{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]>>>24&255,e[r]>>>16&255,e[r]>>>8&255,255&e[r]);return t.replace(/\0+$/,"")},flatten:function e(t,r=!1,n=[]){for(let s=0;s<t.length;s+=1){const i=t[s];r&&Array.isArray(i)?e(i,r,n):n.push(i)}return n}};var je={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return Oe.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};function Ee(e,t){return e<<t|e>>>32-t}function Pe(e,t){let r,n,s,i,o;return s=2147483648&e,i=2147483648&t,r=1073741824&e,n=1073741824&t,o=(1073741823&e)+(1073741823&t),r&n?2147483648^o^s^i:r|n?1073741824&o?3221225472^o^s^i:1073741824^o^s^i:o^s^i}function Te(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return e&t|~e&r}(t,r,n),s),o)),Pe(Ee(e,i),t)}function qe(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return e&r|t&~r}(t,r,n),s),o)),Pe(Ee(e,i),t)}function Be(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return e^t^r}(t,r,n),s),o)),Pe(Ee(e,i),t)}function Le(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return t^(e|~r)}(t,r,n),s),o)),Pe(Ee(e,i),t)}function Re(e){let t,r,n="",s="";for(r=0;r<=3;r++)t=e>>>8*r&255,s="0"+t.toString(16),n+=s.substr(s.length-2,2);return n}function Fe(e){let t,r,n,s,i,o,a,c,l,u=[];for(u=function(e){let t;const r=e.length,n=r+8,s=16*((n-n%64)/64+1),i=Array(s-1).fill(0);let o=0,a=0;for(;a<r;)t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|e[a]<<o,a++;return t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|128<<o,i[s-2]=r<<3,i[s-1]=r>>>29,i}(e),o=1732584193,a=4023233417,c=2562383102,l=271733878,t=0;t<u.length;t+=16)r=o,n=a,s=c,i=l,o=Te(o,a,c,l,u[t+0],7,3614090360),l=Te(l,o,a,c,u[t+1],12,3905402710),c=Te(c,l,o,a,u[t+2],17,606105819),a=Te(a,c,l,o,u[t+3],22,3250441966),o=Te(o,a,c,l,u[t+4],7,4118548399),l=Te(l,o,a,c,u[t+5],12,1200080426),c=Te(c,l,o,a,u[t+6],17,2821735955),a=Te(a,c,l,o,u[t+7],22,4249261313),o=Te(o,a,c,l,u[t+8],7,1770035416),l=Te(l,o,a,c,u[t+9],12,2336552879),c=Te(c,l,o,a,u[t+10],17,4294925233),a=Te(a,c,l,o,u[t+11],22,2304563134),o=Te(o,a,c,l,u[t+12],7,1804603682),l=Te(l,o,a,c,u[t+13],12,4254626195),c=Te(c,l,o,a,u[t+14],17,2792965006),a=Te(a,c,l,o,u[t+15],22,1236535329),o=qe(o,a,c,l,u[t+1],5,4129170786),l=qe(l,o,a,c,u[t+6],9,3225465664),c=qe(c,l,o,a,u[t+11],14,643717713),a=qe(a,c,l,o,u[t+0],20,3921069994),o=qe(o,a,c,l,u[t+5],5,3593408605),l=qe(l,o,a,c,u[t+10],9,38016083),c=qe(c,l,o,a,u[t+15],14,3634488961),a=qe(a,c,l,o,u[t+4],20,3889429448),o=qe(o,a,c,l,u[t+9],5,568446438),l=qe(l,o,a,c,u[t+14],9,3275163606),c=qe(c,l,o,a,u[t+3],14,4107603335),a=qe(a,c,l,o,u[t+8],20,1163531501),o=qe(o,a,c,l,u[t+13],5,2850285829),l=qe(l,o,a,c,u[t+2],9,4243563512),c=qe(c,l,o,a,u[t+7],14,1735328473),a=qe(a,c,l,o,u[t+12],20,2368359562),o=Be(o,a,c,l,u[t+5],4,4294588738),l=Be(l,o,a,c,u[t+8],11,2272392833),c=Be(c,l,o,a,u[t+11],16,1839030562),a=Be(a,c,l,o,u[t+14],23,4259657740),o=Be(o,a,c,l,u[t+1],4,2763975236),l=Be(l,o,a,c,u[t+4],11,1272893353),c=Be(c,l,o,a,u[t+7],16,4139469664),a=Be(a,c,l,o,u[t+10],23,3200236656),o=Be(o,a,c,l,u[t+13],4,681279174),l=Be(l,o,a,c,u[t+0],11,3936430074),c=Be(c,l,o,a,u[t+3],16,3572445317),a=Be(a,c,l,o,u[t+6],23,76029189),o=Be(o,a,c,l,u[t+9],4,3654602809),l=Be(l,o,a,c,u[t+12],11,3873151461),c=Be(c,l,o,a,u[t+15],16,530742520),a=Be(a,c,l,o,u[t+2],23,3299628645),o=Le(o,a,c,l,u[t+0],6,4096336452),l=Le(l,o,a,c,u[t+7],10,1126891415),c=Le(c,l,o,a,u[t+14],15,2878612391),a=Le(a,c,l,o,u[t+5],21,4237533241),o=Le(o,a,c,l,u[t+12],6,1700485571),l=Le(l,o,a,c,u[t+3],10,2399980690),c=Le(c,l,o,a,u[t+10],15,4293915773),a=Le(a,c,l,o,u[t+1],21,2240044497),o=Le(o,a,c,l,u[t+8],6,1873313359),l=Le(l,o,a,c,u[t+15],10,4264355552),c=Le(c,l,o,a,u[t+6],15,2734768916),a=Le(a,c,l,o,u[t+13],21,1309151649),o=Le(o,a,c,l,u[t+4],6,4149444226),l=Le(l,o,a,c,u[t+11],10,3174756917),c=Le(c,l,o,a,u[t+2],15,718787259),a=Le(a,c,l,o,u[t+9],21,3951481745),o=Pe(o,r),a=Pe(a,n),c=Pe(c,s),l=Pe(l,i);return Re(o)+Re(a)+Re(c)+Re(l)}const Ue=e=>{if("string"!=typeof e&&!(e instanceof Uint8Array))return"";return Fe("string"==typeof e?ve.toUtf8Bytes(e):e)};var De={md5:Ue,md5Base64:e=>{const t=Ue(e);if(!t)return"";const r=Oe.hex2bytes(t);return Ae.bytesToBase64(r)}};const Ie=(e,t=!1)=>{const r=new Uint8Array(e);return t?Ae.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Me={...Oe,...je,...ve,...Ae,...De,str2ab:(e="",t=!1)=>{if(t)return Ae.base64ToBytes(e).buffer;{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0,n=e.length;t<n;t++)r[t]=e.charCodeAt(t);return t}},ab2str:Ie,utf8ToBase64:e=>Y.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>Y.isBrowser?atob(e):Buffer.from(e,"base64").toString("utf-8"),getRandomBytes:e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=$e.random(256);return t},textEncode:e=>ve.toUtf8Bytes(e),textDecode:e=>ve.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+Ae.toBase64(e):Y.isArrayBuffer(e)?`data:${t};base64,`+Ie(e,!0):"":""};const Ke=e=>{try{const t=Me.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},ze=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Ne={RSAPublicKey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApiLWsPmoaiGdr02AmPYS\n4/VgxyJNNJSK2VICirXl4P8qAP3b/6GIs7Hwnsmmuj7gledJ0XiZodFjDNgQEZEG\nj4K9KX8NixcrJwnTQV5UebiERdj+64ihwqPVWo9dIOj43ZPJ8f4dritJv5tnQaBb\nb9zTkU3Ofzk1g8RU00Ith6quOGZcU2IWC4OQ+5YiZvzrCBKEvjFwK2OvGq43tI51\nGaZdI9H09jisypqefsMvv6esjEQQOtl+WGlI5fof7KZUt3dppvuDI4CYgeXIoKKL\n9T9qDl8F9aNSs3XHx32YyA7L1FraFD6PjqRjueIFp2emsXQcIMeMqqgVyV+4qb+0\nuwIDAQAB",RSAPrivateKey:"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmItaw+ahqIZ2v\nTYCY9hLj9WDHIk00lIrZUgKKteXg/yoA/dv/oYizsfCeyaa6PuCV50nReJmh0WMM\n2BARkQaPgr0pfw2LFysnCdNBXlR5uIRF2P7riKHCo9Vaj10g6Pjdk8nx/h2uK0m/\nm2dBoFtv3NORTc5/OTWDxFTTQi2Hqq44ZlxTYhYLg5D7liJm/OsIEoS+MXArY68a\nrje0jnUZpl0j0fT2OKzKmp5+wy+/p6yMRBA62X5YaUjl+h/splS3d2mm+4MjgJiB\n5cigoov1P2oOXwX1o1KzdcfHfZjIDsvUWtoUPo+OpGO54gWnZ6axdBwgx4yqqBXJ\nX7ipv7S7AgMBAAECggEAE1kuWLkSsJ2OoDpt9iJ+a7cJmNd5V1zPWOTwr9fkWFJP\nQYNPKlPVOFxKUivY84rcHAkuMyuQ9OQOXZISOQGDWpZW0mzeFmtR1r+Rr2S9gNmI\n6huOAL9OW306HUxiA7GuPhv2omy+Zyjac2q1WVLEI2B78Um2+WEfxuNIH7xu0gRR\nz/wluevMBQlv6hSeMESP6e9s2kB+FuM4bL7+1sexwS1TudKbHybujaiB8un9E2V3\nC9BkE6yf00Rhvii6Q4E4w3PFQfcBEFnjOD0S2Watx8GIbYjlYvtquy8Yj7OtyZB6\nw5sxyaYhKVVnkpGAbOgaCj94ABYF47VuwXr45I4PzQKBgQDp6svzD+QKlARjcWgO\nrH7UEpFX6m49G6Ib4c63xEg9+GesTgfDxoYxtXDKsC7I8OwMrmffJGbyfjaAvzmg\nicM3Y7kF6UPO9+q2mBRsyhoJSNONTeUVyoFSc+QDsVgndlTZIjqC5XLrONGaSPLJ\n7jJzqKhp3NQcpO8+xY0d7Efm1QKBgQC10fCNuF1LUTYgsWvvGxTiCCAIBurZmHU+\nGMb2Okfoco/P+QNl1jEba91AC7FudW3g/lRn0vTnDajlNoz2/CKunrTKN4/9lEBI\ntiwEOvhc5FtapRifSfrrNwFqPM+LijvOkcteWVhAUWCEP1eLmpnXGqfmZxnTaaVe\n5DyDgyAVTwKBgQDhEawfOQEANJ9sV2f6BnsZ7quuXcCoR3hZP5G5O8EO735BSesq\nsk/YcG4QeCjr6vQU15LWH552YH5srpHyJ9uP5gHW8DTwZZaPDhFJA8S9fjcfVP3B\nU9HO1fdknjTl83N8YPTPkZpbPZZfzyTcqrYclwFEqtfkn8YbLdW0Hu6n6QKBgDEv\njvS3uD1ExfDILlurptWSvx+Mx4F/1c+roj8/+u3t9+uaAIpPDE/PuTW3NBOens/r\n3WeM0QWkU1lWjYHPKY61jlDaARDnRxCkf3nRfhibCf+Wg/erar6wzagwtTCZf55d\nIHfwkYgsu4BrJkK02wMuydbxczIW9U6bTaeCFG7PAoGAN3oHYzTEBwZ7ZKv11QiQ\nEp/HeHBvD8fH/e1uVyBel4Co7NO5pV2s8qjS8+3+jxumKLNXCirjqwHo03YCdzxi\ncy4GFDsukHmDQ7FF9VC4QV0fJ0F7jGYE9nNZ+K9qwS5KrihOSBPxj0HptrF6TSOw\nBTSwr0byL3TC0m0StkSNKpo=",generateKeys:async e=>{try{const t=await e.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!0,["encrypt","decrypt"]),r=await window.crypto.subtle.exportKey("spki",t.publicKey),n=Ke(r),s=ze(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=Ke(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:ze(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:ze,format_pem_content:Ke,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Me.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),i=[];for(let t=0;t<n.length;t+=190){let r=n.slice(t,t+190),o=await e.encrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(o))}const o=Me.concatBytes(...i);return Me.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Me.base64ToBytes(t),s=await e.importKey("pkcs8",Me.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["decrypt"]),i=[],o=256;for(let t=0;t<n.length;t+=o){let r=n.slice(t,t+o),a=await e.decrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(a))}const a=Me.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const He=()=>e.webcrypto.subtle;var Ve={generateKeys:()=>Ne.generateKeys(He()),encrypt:async(e,t)=>Ne.encrypt(He(),e,t),decrypt:async(e,t)=>Ne.decrypt(He(),e,t),encode:async e=>Ne.encrypt(He(),e,Ne.RSAPublicKey),decode:async e=>Ne.decrypt(He(),e,Ne.RSAPrivateKey)};const We="undefined"!=typeof window?window.crypto.subtle:{};var Ze={generateKeys:()=>Ne.generateKeys(We),encrypt:async(e,t)=>Ne.encrypt(We,e,t),decrypt:async(e,t)=>Ne.decrypt(We,e,t),encode:async e=>Ne.encrypt(We,e,Ne.RSAPublicKey),decode:async e=>Ne.decrypt(We,e,Ne.RSAPrivateKey)};const Ye=2654435769,Je=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+Ye>>>0,e[0]=e[0]+((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,e[1]=e[1]+((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0;return e},Qe=(e,t)=>{let r=3337565984;for(let n=0;n<32;n++)e[1]=e[1]-((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0,e[0]=e[0]-((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,r=r-Ye>>>0;return e},Ge=e=>{const t=Me.str2bytes(e),r=new Uint32Array(4);return r[0]=t[0]<<24|t[1]<<16|t[2]<<8|t[3],r[1]=t[4]<<24|t[5]<<16|t[6]<<8|t[7],r[2]=t[8]<<24|t[9]<<16|t[10]<<8|t[11],r[3]=t[12]<<24|t[13]<<16|t[14]<<8|t[15],r},Xe=(e,t)=>{const r=Me.pkcs7Padding(e,8),n=Ge(t),s=[];for(let e=0;e<r.length;e+=8){const t=Me.bytesToUint32(r.slice(e,e+8)),i=Je(t,n);s.push(Me.uint32ToBytes(i))}return Me.concatBytes(...s)},et=(e,t)=>{const r=Ge(t),n=[];for(let t=0;t<e.length;t+=8){const s=Me.bytesToUint32(e.slice(t,t+8)),i=Qe(s,r);n.push(Me.uint32ToBytes(i))}const s=Me.concatBytes(...n);return Me.pkcs7Unpadding(s)};var tt={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:Je,decrypt:Qe,toTeaKey:Ge,encode:(e,t)=>{const r=Me.textEncode(e),n=Xe(r,t);return Me.bytesToBase64(n)},decode:(e,t)=>{const r=Me.base64ToBytes(e),n=et(r,t);return Me.textDecode(n.buffer)},encodeBytes:Xe,decodeBytes:et};function rt(e,t,r){const{length:n}=e;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){let n=null==e?0:e.length;if(!n)return[];(t=null==t?0:t)<0&&(t=-t>n?0:n+t),(r=(r=void 0===r?n:r)>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;let s=-1;const i=new Array(n);for(;++s<n;)i[s]=e[s+t];return i}(e,t,r)}const nt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function st(e){return nt.test(e)}const it="\\ud800-\\udfff",ot=`[${it}]`,at="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",ct="\\ud83c[\\udffb-\\udfff]",lt=`[^${it}]`,ut="(?:\\ud83c[\\udde6-\\uddff]){2}",ft="[\\ud800-\\udbff][\\udc00-\\udfff]",ht=`${`(?:${at}|${ct})`}?`,dt="[\\ufe0e\\ufe0f]?",pt=dt+ht+`(?:\\u200d(?:${[lt,ut,ft].join("|")})${dt+ht})*`,gt=`(?:${[`${lt}${at}?`,at,ut,ft,ot].join("|")})`,yt=RegExp(`${ct}(?=${ct})|${gt+pt}`,"g");function mt(e){return st(e)?function(e){return e.match(yt)||[]}(e):function(e){return e.split("")}(e)}function bt(e){return t=>{if(!t)return"";const r=st(t)?mt(t):void 0,n=r?r[0]:t[0],s=r?rt(r,1).join(""):t.slice(1);return n[e]()+s}}const wt="\\ud800-\\udfff",_t="\\u2700-\\u27bf",vt="a-z\\xdf-\\xf6\\xf8-\\xff",xt="A-Z\\xc0-\\xd6\\xd8-\\xde",At="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",St="['’]",kt=`[${At}]`,Ct=`[${_t}]`,$t=`[${vt}]`,Ot=`[^${wt}${At+"\\d"+_t+vt+xt}]`,jt="(?:\\ud83c[\\udde6-\\uddff]){2}",Et="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt=`[${xt}]`,Tt=`(?:${$t}|${Ot})`,qt=`(?:${Pt}|${Ot})`,Bt=`(?:${St}(?:d|ll|m|re|s|t|ve))?`,Lt=`(?:${St}(?:D|LL|M|RE|S|T|VE))?`,Rt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Ft="[\\ufe0e\\ufe0f]?",Ut=Ft+Rt+`(?:\\u200d(?:${[`[^${wt}]`,jt,Et].join("|")})${Ft+Rt})*`,Dt=`(?:${[Ct,jt,Et].join("|")})${Ut}`,It=RegExp([`${Pt}?${$t}+${Bt}(?=${[kt,Pt,"$"].join("|")})`,`${qt}+${Lt}(?=${[kt,Pt+Tt,"$"].join("|")})`,`${Pt}?${Tt}+${Bt}`,`${Pt}+${Lt}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Dt].join("|"),"g");const Mt=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/),Kt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function zt(e,t){if(void 0===t){const t=Mt(e)?function(e){return e.match(It)}(e):function(e){return e.match(Kt)}(e);return t||[]}return e.match(t)||[]}function Nt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Nt(e)))}`;if(Y.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Ht=bt("toUpperCase"),Vt=bt("toLowerCase");var Wt={toString:Nt,startCase:e=>zt(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Ht(t)),""),snakeCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Ht(t):t))),""),upperCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Ht,lowerCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Vt,splitOnFirst:(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===e||""===t)return[];const r=e.indexOf(t);return-1===r?[]:[e.slice(0,r),e.slice(r+t.length)]},parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{let n=e;return e&&"string"==typeof e?(t&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?n=Number(e):!r||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(n="true"===e.toLowerCase()),n):n},replace:(e,t)=>{if(!e)return e;if(!t)return e;let r=e;return((Array.isArray(t)?t:[t])||[]).forEach((e=>{e.key&&e.value&&(r=r.replace(new RegExp(e.key,e.flag||""),e.value))})),r},jsonFormat:e=>{try{if(!e)return"";const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(t){return e}},toLines:(e,t="\n")=>e?e.split(t).map((e=>e.trim())).filter((e=>!!e)):[]};var Zt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":tt.encode(t,Me.hex2str(tt.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=tt.decode(e,Me.hex2str(tt.TEAKey));return Wt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return Y.isBrowser?await Ze.encode(t):await Ve.encode(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=Y.isBrowser?await Ze.decode(e):await Ve.decode(e);return Wt.jsonFormat(t)}catch(e){return""}}};const Yt=(e,t,r)=>e*(1-r)+t*r,Jt=(e,t,r)=>e===t?0:(r-e)/(t-e),Qt=(e,t,r)=>({x:Yt(e.x,t.x,r),y:Yt(e.y,t.y,r)}),Gt=(e,t,r,n)=>{const s=Qt(e,t,n),i=Qt(t,r,n);return Qt(s,i,n)},Xt=(e,t)=>{if(1===e.length)return e[0];const r=[];for(let n=0;n<e.length-1;n++)r.push({x:(1-t)*e[n].x+t*e[n+1].x,y:(1-t)*e[n].y+t*e[n+1].y});return Xt(r,t)},er=(e,t)=>{if(0===t||t===e)return 1;let r=1;for(let n=1;n<=t;n++)r=r*(e-n+1)/n;return r};var tr={bezier1:Qt,bezier2:Gt,bezier3:(e,t,r,n,s)=>{const i=Gt(e,t,r,s),o=Gt(t,r,n,s);return Qt(i,o,s)},bezier:Xt,bezierCurve:(e,t)=>{const r=e.length-1;let n=0,s=0;for(let i=0;i<=r;i++){const o=er(r,i)*Math.pow(1-t,r-i)*Math.pow(t,i);n+=o*e[i].x,s+=o*e[i].y}return{x:n,y:s}},lerp:Yt,lerpAverage:(e,t,r="")=>{if(e.length<=0)return 0;if(1===e.length)return e[0].x;if(2===e.length)return Yt(e[0].y,e[1].y,.5);const n=[],s=e.slice().sort(((e,t)=>e.x-t.x)),i=s.length,o=s[0].x,a=s[i-1].x;for(let e=o;e<=a;e+=t){let t=0;for(let n=0;n<i-1;n++){const i=s[n],o=s[n+1];if(e>=i.x&&e<=o.x){if("lerp"===r){const r=Jt(i.x,o.x,e);t=Qt(i,o,r).y}else t=i.y;break}}e>s[i-1].x&&(t=s[i-1].y),n.push(t)}return n.reduce(((e,t)=>e+t),0)/n.length},proportion:Jt};var rr={...ge,...Zt,...tr,sleep:ge.delay,run:async function(e,t=0){if(t<=0)return ge.safeRun(e);const r=t>0?Date.now():0,n=await ge.safeRun(e),s=Date.now()-r;return s<t&&await ge.delay(t-s),n},exec:(e,t="")=>_e.I.exec(e,t),debounce:ue,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Y.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),ue(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new fe(e),mutex:function(e){var t=null;return async function(...r){if((t=this||t||{}).__ddMutex)return!1;t.__ddMutex=!0;try{e&&await Promise.resolve(e.apply(this,r))}catch(e){console.log(e)}finally{t.__ddMutex=!1}}},polling:async function(e={}){const{func:t,interval:r=100,times:n=1e3}=e;let s=n;const i=r<1?100:r;do{if(!t)break;const[e,r]=await ge.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await ge.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>_e.I.pipeline.push(e,t),pipeline:(e=1)=>new we(e),safeTask:(e,t)=>new be(e,t)};const nr=e=>{if(!e)return e;if("object"!=typeof e)return e;const t=Array.isArray(e)?[]:{};for(const r in e)e.hasOwnProperty(r)&&(t[r]=nr(e[r]));return t};const sr=(e,t,r={})=>{const n=e||{},{ignoreUndefined:s=!0,cover:i=!1}=r;if(!t)return n;for(const o in t){if(!t.hasOwnProperty(o))continue;const a=t[o];"object"!=typeof a||"object"!=typeof e[o]||i?s&&void 0===a||r.ignoreNull&&null===a||r.ignoreZero&&0===a||r.ignoreEmptyArray&&Array.isArray(a)&&a.length<=0||r.ignoreEmptyString&&"string"==typeof a&&""===a.trim()||(n[o]=a):n[o]=ir(e[o],a,r)}return n},ir=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?sr(e,t,r):sr({...e},t,r),n},or=(e,t,r={})=>sr({...e},t,{cover:!0,...r}),ar=(e,t,r,n,s=!1)=>{if(!e||!t||!r)return;let i=e[t];null!==i&&"object"==typeof i&&s&&Object.keys(i).forEach((e=>{ar(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&ar(e,t,r,n,s)},get:()=>i})};var cr={copy:(e,t={})=>{if(void 0===e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0}=t;if((!n||n.length<=0)&&!s)return r;const o={};for(const e in r){if(!r.hasOwnProperty(e))continue;const a=s?i&&e.startsWith("_")?e:Wt.camelCase(e):e;if(n.length>0&&!n.includes(e)&&!n.includes(a))continue;const c=r[e];t.ignoreNull&&null===c||(t.ignoreZero&&0===c||t.ignoreEmptyArray&&Array.isArray(c)&&c.length<=0||t.ignoreEmptyString&&"string"==typeof c&&""===c.trim()||(o[a]=c))}return o},clone:nr,merge:ir,isEmpty:e=>0!==e&&(!e||"object"==typeof e&&(Array.isArray(e)?!e.length:Object.keys(e).length<=0)),parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{if(!e&&"object"!=typeof e)return e;for(const[n,s]of Object.entries(e))if("object"==typeof s&&null!==s)for(const[e,n]of Object.entries(s))s[e]=Wt.parseValue(n,{number:t,boolean:r});else e[n]=Wt.parseValue(s,{number:t,boolean:r});return e},cloneClass:function(e){return e?"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e)):e},combine:or,combines:(e,t={})=>{let r={};if(!e||e.length<=0)return r;const{ignoreUndefined:n=!0,ignoreNull:s=!0,ignoreZero:i=!0,ignoreEmptyArray:o=!0,ignoreEmptyString:a=!0,cover:c=!0}=t;return e.forEach((e=>r=or(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:ar,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};const lr=function(e,{sep:t="&",eq:r="=",max:n=1e3,multiple:s=!0,uri:i=!0,parseNumber:o=!1,parseBoolean:a=!1}={}){t=t||"&",r=r||"=";const c={};if("string"!=typeof e||0===e.length)return c;const l=/\+/g,u=n||1e3;let f=(e=e.split(t)).length;u>0&&f>u&&(f=u);for(let t=0;t<f;++t){let n,o,a,u,f=e[t].replace(l,"%20"),h=f.indexOf(r);h>=0?(n=f.substr(0,h),o=f.substr(h+1)):(n=f,o=""),a=i?decodeURIComponent(n):n,u=i?decodeURIComponent(o):o,S.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(u):c[a]=[c[a],u]:c[a]=u}return cr.parseValue(c,{number:o,boolean:a}),c},ur=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},fr=function(e,t=!0){return t?encodeURIComponent(e):e},hr=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},dr=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,pr=e=>{const t=(e||"").replace(/\\/g,"/").split("?")[0],r=t.match(/[\/]?([\w\_\-]+)[.]?[\w]*[?]?$/),n=r?r[1]:"",s=t.lastIndexOf("/")+1,i=t.substring(s),o=i.lastIndexOf("."),a=i.substring(0,o)||"",c=o>=0?i.substring(o):"";return{route:t.substring(0,s)||"",page:n,name:i,withoutExtension:a,extname:c}},gr=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(dr);if(!r||r.length<4)return t;const n=r[3]||"",s=e.split("?");return t.url=s[0],t.origin=r[0],t.protocol=`${r[1]}:`,t.host=`${r[2]}${n?":"+n:""}`,t.port=n,t.query=s.length>1?s[1]:"",t},yr=(e,t)=>{if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var mr={parse:lr,stringify:function(e,{sep:t="&",eq:r="=",name:n=null,uri:s=!0,cleanZero:i=!1,cleanNull:o=!1,cleanWhitespace:a=!1}={}){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(n){const c=fr(ur(n),s)+r,l=e[n];return Array.isArray(l)?l.map((function(e){return c+fr(ur(e),s)})).join(t):hr(l,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+fr(ur(l),s)})).filter(Boolean).join(t):n?fr(ur(n),s)+r+fr(ur(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=gr(e),{origin:r="",url:n="",query:s=""}=t,i=pr(n),o=lr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:pr,parseHost:gr,join:(...e)=>{const t=[];let r=!1;return e.forEach((e=>{const n=e.trim();if(""===n)return;if(/^(\w+):\/\//.test(n))return t.length=0,t.push(n),void(r=!0);n.split("/").forEach((e=>{"."!==e&&""!==e&&(".."===e?t.length>0&&".."!==t[t.length-1]?t.pop():r||t.push(".."):t.push(e))}))})),t.join("/")},shExpMatch:yr,isLocalIpAddress:e=>!!e&&!!(yr(e,"127.0.0.1")||yr(e,"localhost")||yr(e,"192.168.*.*")),parseFileUrl:e=>{const t={href:e,file:"",url:"",protocol:"",host:"",query:"",params:{}};if(!e)return t;let r=e?e.replace(/\\/g,"/"):"";r.startsWith("file://")&&!r.startsWith("file:///")?r="file:///"+r.slice(7):r.startsWith("file:/")&&!r.startsWith("file:///")&&(r="file:///"+r.slice(6));const n=r.match(/^file:\/\/(?:([^\/\\]+))?(\/.*)?$/);if(!n||n.length<3)return t;t.protocol="file:";const s=n[1]||"",i=n[2]||"";t.host=s;const o=i.split("?");return t.url=t.protocol+`//${t.host}`+o[0],t.file=o[0],t.query=o.length>1?o[1]:"",t.params=lr(t.query,{multiple:!0,uri:!1}),t}};class br{_loopTimer;_event=new f;started=!1;interval=0;constructor(e=0){this.interval=e||500}start(){return this.started||(this.stop(),this._loopTimer=setInterval((()=>{this._handleLoop()}),this.interval),this.started=!0),this}stop(){return this._loopTimer?(clearInterval(this._loopTimer),this._loopTimer=0,this.started=!1,this):this}restart(){return this.stop(),this.start(),this}on(e){return this._event.on("frame",e),this}off(e){return e?(this._event.off("frame",e),this):this}_handleLoop(){this._event.emit("frame")}}var wr={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class _r{date;timestamp=0;yyyy=0;yy="";M=0;MM="";d=0;dd="";h=0;hh="";m=0;mm="";s=0;ss="";S=0;SS="";SSS="";constructor(e){if(!e)return;const t="string"==typeof e||"number"==typeof e?new Date(e):e;t&&(this.date=t,this.timestamp=t.getTime(),this.toDate())}toDate(){return this.date?(this.yyyy=this.date.getFullYear(),this.yy=`${this.yyyy}`.substr(2),this.M=this.date.getMonth()+1,this.MM=(this.M<10?"0":"")+this.M,this.d=this.date.getDate(),this.dd=(this.d<10?"0":"")+this.d,this.h=this.date.getHours(),this.hh=(this.h<10?"0":"")+this.h,this.m=this.date.getMinutes(),this.mm=(this.m<10?"0":"")+this.m,this.s=this.date.getSeconds(),this.ss=(this.s<10?"0":"")+this.s,this.S=this.date.getMilliseconds(),this.SS=(this.S<10?"0":"")+this.S,this.SSS=this.S.toString().padStart(3,"0"),this):this}toCountdown(e=""){const t={countdown:0,timestamp:0,seconds:0,d:0,dd:"",h:0,hh:"",m:0,mm:"",s:0,ss:"",S:0,SS:"",SSS:"",desc:""};if(!this.timestamp)return t;t.timestamp=this.timestamp,t.countdown=Math.max(t.timestamp-Date.now(),0),t.seconds=Math.floor(t.countdown/wr.oneSecond);let r=t.countdown;t.d=Math.floor(r/wr.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=wr.oneDay,t.h=Math.floor(r/wr.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=wr.oneHour,t.m=Math.floor(r/wr.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=wr.oneMinute,t.s=Math.floor(r/wr.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=wr.oneSecond,t.S=r,t.SS=(t.S<10?"0":"")+t.S,t.SSS=t.S.toString().padStart(3,"0");let n=e;return n||(n=t.countdown>wr.oneHour?"hh:mm:ss":t.countdown>wr.oneMinute?"mm:ss":"ss"),t.desc=n.replace(/\bdd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>t[e])),t}add(e=0){return e?(this.timestamp=this.timestamp+e,this.date=new Date(this.timestamp),this.toDate(),this):this}format(e="yyyy-MM-dd hh:mm:ss"){return e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>this[e]))}static get timezoneOffset(){return(new Date).getTimezoneOffset()/60}static getLocalTime(e=0){const t=new Date,r=t.getTime(),n=6e4*t.getTimezoneOffset();return new Date(r+n+36e5*e)}}const vr=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?xr(r).format(t):""},xr=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new _r(t||0)};function Ar({year:e=0,month:t=0,date:r=0,hour:n=0,minute:s=0,second:i=0}){const o=`${e||"yyyy"}/${t||"MM"}/${r||"dd"} ${n}:${s}:${i}`;return new Date(vr(Date.now(),o)).getTime()}var Sr={...wr,now:function(){return xr(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:Ar,todayZero:()=>Ar({}),format:vr,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return xr(r).toCountdown(t)},dtime:xr,loopFrame:(e=500)=>new br(e),getTimezoneOffset:()=>_r.timezoneOffset,getLocalTime:_r.getLocalTime};const kr=e=>Ae.toBase64(e);var Cr={encode:kr,decode:e=>Ae.fromBase64(e),encodeByOss:e=>kr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var $r={...l,base64:Cr,tea:tt,uuid:u,guid:(e,t=!1,r="")=>{const n=u(e||32);return t?Sr.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=l.keyChars;let r="";const n=t.length;for(let s=0;s<e;s++)r+=t.charAt(Math.floor(Math.random()*n));return r}};const Or=(e,t,r=8)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(r<=0)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const n=Object.prototype.toString.call(e);if(n!==Object.prototype.toString.call(t))return!1;switch(n){case"[object Array]":return jr(e,t,r);case"[object Map]":return Er(e,t,r);case"[object Set]":return Pr(e,t,r);case"[object Object]":return Tr(e,t,r);default:return qr(e,t,n)}},jr=(e,t,r=1/0)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Or(e[n],t[n],r-1))return!1;return!0},Er=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const[n,s]of e)if(!t.has(n)||!Or(s,t.get(n),r-1))return!1;return!0},Pr=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const n of e)if(![...t].some((e=>Or(n,e,r-1))))return!1;return!0},Tr=(e,t,r=1/0)=>{const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!s.includes(i)||!Or(e[i],t[i],r-1))return!1;const i=Object.getOwnPropertySymbols(e),o=Object.getOwnPropertySymbols(t);if(i.length!==o.length)return!1;for(const n of i)if(!o.includes(n)||!Or(Reflect.get(e,n),Reflect.get(t,n),r-1))return!1;return!0},qr=(e,t,r)=>{switch(r){case"[object RegExp]":return String(e)===String(t);case"[object Date]":return e.getTime()===t.getTime();case"[object ArrayBuffer]":return Br(e,t);default:return e===t}},Br=(e,t)=>{if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0};var Lr={isEqual:Or,isEqualArray:jr,isEqualObject:Tr,isEqualValue:qr,isEqualAB:Br,isEqualDeep:(e,t)=>Or(e,t,1/0)};const Rr=(e,t=new WeakMap)=>{if(null===e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(Array.isArray(e)){r=[],t.set(e,r);for(const n of e)r.push(Rr(n,t))}else if(e instanceof Date)r=new Date(e);else if(e instanceof RegExp)r=new RegExp(e.source,e.flags);else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,s]of e.entries())r.set(Rr(n,t),Rr(s,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e.values())r.add(Rr(n,t))}else if("object"==typeof e){r={},t.set(e,r);for(const[n,s]of Object.entries(e))r[n]=Rr(s,t)}return r};var Fr={copy:(e,t={})=>{if(null==e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r||null===r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0,...o}=t,a={},c=[{condition:o.ignoreNull,test:e=>null===e},{condition:o.ignoreZero,test:e=>0===e},{condition:o.ignoreEmptyArray,test:e=>Array.isArray(e)&&0===e.length},{condition:o.ignoreEmptyString,test:e=>"string"==typeof e&&""===e.trim()}].filter((e=>e.condition));for(const[e,t]of Object.entries(r)){const r=!s||i&&e.startsWith("_")?e:Wt.camelCase(e);n.length>0&&!n.includes(e)&&!n.includes(r)||(c.some((e=>e.test(t)))||(a[r]=t))}return a},clone:Rr,cloneClass:function(e){return null==e||"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}};const Ur=(e,t)=>{if(e===t)return!0;if(!e||!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var Dr={shExpMatch:Ur,shExpMatchs:(e,t)=>{if(!e||!t)return!1;let r=[];if(Array.isArray(t))r=t;else{if("string"!=typeof t)return!1;r=[t]}for(const t of r){if("*"===t)return!0;if(Ur(e,t))return!0}return!1}};const Ir="[object Object]",Mr="[object Array]",Kr=S.getTag,zr=e=>{if(Kr(e)!==Ir)return e;const t={};for(const r in e)if(/\w+\.\w+/g.test(r)&&!r.includes("[")){const n=r.split(".");let s=t;for(let e=0;e<n.length-1;e++){const t=n[e];Kr(s[t])!==Ir&&(s[t]={}),s=s[t]}s[n[n.length-1]]=e[r]}else t[r]=e[r];return t},Nr=(e,t,r=!1)=>{if(e===t)return;const n=Kr(e);if(n===Kr(t))if(n===Mr&&e.length>=t.length)for(let r=0;r<t.length;r++)Nr(e[r],t[r]);else if(n===Ir&&Object.keys(e).length>=Object.keys(t).length)for(const n in t)r||void 0!==e[n]?Nr(e[n],t[n]):e[n]=null},Hr=(e,t)=>Nr(e,t,!0),Vr=(e,t,r={},n="",s=!1)=>{if(e===t)return r;const i=Kr(e),o=Kr(t);if(i===Mr&&o===i&&e.length>=t.length){for(let s=0;s<e.length;s++)Vr(e[s],t[s],r,`${n}[${s}]`,!1);return r}if(i===Ir&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Kr(s),c=Kr(o);if(s!==o)if(a===Mr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Vr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`,!1);else if(a===Ir&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Vr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`,!1);else null!==s&&(r[`${n?n+".":""}${i}`]=s)}return r}return r[n]=e,r};const Wr={...{...Lr,...Fr,...Dr,...{flattenPath:zr,normalizeStructure:Hr,diffPath:(e,t)=>{const r=zr(e),n=zr(t);return Hr(r,n),Vr(r,n)}}},...Me,...$r,...rr,...Wt,...$e,...me,qs:mr};var Zr={gbkLength:function(e){let t=0;if(!e)return 0;for(let r=0;r<e.length;r++)e.charCodeAt(r)>127||94===e.charCodeAt(r)?t+=2:t++;return t},gbkCut:function(e,t){if(!e||t<=0)return"";let r=0,n=0;for(let s=0;s<e.length&&(e.charCodeAt(s)>127||94===e.charCodeAt(s)?r+=2:r++,!(r>t));s++)n=s;return e.substr(0,n+1)}};function Yr(e){return e!=e}function Jr(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}(t,(function(t){return e[t]}))}var Qr,Gr,Xr=(Qr=Object.keys,Gr=Object,function(e){return Qr(Gr(e))}),en=Math.max;function tn(e,t){var r=Y.isArray(e)||Y.isArguments(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,s=!!n;for(var i in e)!t&&!S.hasOwnProperty.call(e,i)||s&&("length"==i||Y.isIndex(i,n))||r.push(i);return r}var rn={...Y,...S,...cr,...me,includes:function(e,t,r,n){e=Y.isArrayLike(e)?e:function(e){return e?Jr(e,function(e){return Y.isArrayLike(e)?tn(e):function(e){if(!Y.isPrototype(e))return Xr(e);var t=[];for(var r in Object(e))S.hasOwnProperty.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}(e)):[]}(e),r=r&&!n?oe.toInteger(r):0;var s=e.length;return r<0&&(r=en(s+r,0)),Y.isString(e)?r<=s&&e.indexOf(t,r)>-1:!!s&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}(e,Yr,r);for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}(e,t,r)>-1},forof:(e,t)=>{if(!e)return;let r;if(Y.isObject(e)&&(r=Y.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var nn={...{groupBy:function(e,t){return e.reduce(((e,r)=>((e[r[t]]=e[r[t]]||[]).push(r),e)),{})},first:function(e){if(!e)return;return e.length<=0?void 0:e[0]},last:function(e){if(!e)return;const t=e.length;return t<=0?void 0:e[t-1]},toList:function(e){return Array.isArray(e)?e:e?[e]:[]}},stepAction:function(e,t,r=100){if(!Y.isFunction(t))return;if(!Y.isArray(e)||e.length<=0)return;let n=0;for(;e.length>n;){let s=r+n,i=e.slice(n,s);t&&t(i),n=s}},skip:function(e,t){if(!Y.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!Y.isArray(e)||e.length<=0)return[];const n=r||0;if(n>=e.length)return[];const s=t+n;return e.slice(n,e.length<s?e.length:s)||[]},distinct:function(e){return!Y.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return $e.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!Y.isObject(e))return;const s=e[t];(Y.isString(s)&&""!==s||Y.isNumber(s))&&(n[s]=e[r])})),n):n}};const sn=/%[sdj%]/g;let on=()=>{};function an(e){if(!e||!e.length)return null;const t={};return e.forEach((e=>{const r=e.field;t[r]=t[r]||[],t[r].push(e)})),t}function cn(e,...t){let r=0;const n=t.length;if("function"==typeof e)return e.apply(null,t);if("string"==typeof e){return e.replace(sn,(e=>{if("%%"===e)return"%";if(r>=n)return e;switch(e){case"%s":return String(t[r++]);case"%d":return Number(t[r++]);case"%j":try{return JSON.stringify(t[r++])}catch(e){return"[Circular]"}break;default:return e}}))}return e}function ln(e,t){return null==e||(!("array"!==t||!Array.isArray(e)||e.length)||!(!function(e){return"string"===e||"url"===e||"hex"===e||"email"===e||"date"===e||"pattern"===e}(t)||"string"!=typeof e||e))}function un(e,t,r){let n=0;const s=e.length;!function i(o){if(o&&o.length)return void r(o);const a=n;n+=1,a<s?t(e[a],i):r([])}([])}"undefined"!=typeof process&&process.env&&"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&"undefined"!=typeof document&&(on=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class fn extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function hn(e,t,r,n,s){if(t.first){const t=new Promise(((t,i)=>{const o=function(e){const t=[];return Object.keys(e).forEach((r=>{t.push(...e[r]||[])})),t}(e);un(o,r,(e=>(n(e),e.length?i(new fn(e,an(e))):t(s))))}));return t.catch((e=>e)),t}const i=!0===t.firstFields?Object.keys(e):t.firstFields||[],o=Object.keys(e),a=o.length;let c=0;const l=[],u=new Promise(((t,u)=>{const f=e=>{if(l.push.apply(l,e),c++,c===a)return n(l),l.length?u(new fn(l,an(l))):t(s)};o.length||(n(l),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?un(n,r,f):function(e,t,r){const n=[];let s=0;const i=e.length;function o(e){n.push(...e||[]),s++,s===i&&r(n)}e.forEach((e=>{t(e,o)}))}(n,r,f)}))}));return u.catch((e=>e)),u}function dn(e,t){return r=>{let n;return n=e.fullFields?function(e,t){let r=e;for(let e=0;e<t.length;e++){if(null==r)return r;r=r[t[e]]}return r}(t,e.fullFields):t[r.field||e.fullField],(s=r)&&void 0!==s.message?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField};var s}}function pn(e,t){if(t)for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];"object"==typeof n&&"object"==typeof e[r]?e[r]={...e[r],...n}:e[r]=n}return e}const gn=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!ln(t,i||e.type)||n.push(cn(s.messages.required,e.fullField))};let yn;const mn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,bn=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,wn={integer:e=>wn.number(e)&&parseInt(e,10)===e,float:e=>wn.number(e)&&!wn.integer(e),array:e=>Array.isArray(e),regexp(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:e=>"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear&&!isNaN(e.getTime()),number:e=>!isNaN(e)&&"number"==typeof e,object:e=>"object"==typeof e&&!wn.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(mn),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(yn)return yn;const e="[a-fA-F\\d:]",t=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${e})|(?<=${e})(?=\\s|$))`:"",r="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",n="[a-fA-F\\d]{1,4}",s=`\n(?:\n(?:${n}:){7}(?:${n}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${n}:){6}(?:${r}|:${n}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${n}:){5}(?::${r}|(?::${n}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${n}:){4}(?:(?::${n}){0,1}:${r}|(?::${n}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${n}:){3}(?:(?::${n}){0,2}:${r}|(?::${n}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${n}:){2}(?:(?::${n}){0,3}:${r}|(?::${n}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${n}:){1}(?:(?::${n}){0,4}:${r}|(?::${n}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${n}){0,5}:${r}|(?::${n}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),i=new RegExp(`(?:^${r}$)|(?:^${s}$)`),o=new RegExp(`^${r}$`),a=new RegExp(`^${s}$`),c=e=>e&&e.exact?i:new RegExp(`(?:${t(e)}${r}${t(e)})|(?:${t(e)}${s}${t(e)})`,"g");c.v4=e=>e&&e.exact?o:new RegExp(`${t(e)}${r}${t(e)}`,"g"),c.v6=e=>e&&e.exact?a:new RegExp(`${t(e)}${s}${t(e)}`,"g");const l=c.v4().source,u=c.v6().source;return yn=new RegExp(`(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${l}|${u}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s"]*)?$)`,"i"),yn})()),hex:e=>"string"==typeof e&&!!e.match(bn)},_n="enum";var vn={required:gn,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(cn(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void gn(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?wn[i](t)||n.push(cn(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(cn(s.messages.types[i],e.fullField,e.type))},range:(e,t,r,n,s)=>{const i="number"==typeof e.len,o="number"==typeof e.min,a="number"==typeof e.max,c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;let l=t,u="";const f="number"==typeof t,h="string"==typeof t,d=Array.isArray(t);if(f?u="number":h?u="string":d&&(u="array"),!u)return!1;d&&(l=t.length),h&&(l=t.replace(c,"_").length),i?l!==e.len&&n.push(cn(s.messages[u].len,e.fullField,e.len)):o&&!a&&l<e.min?n.push(cn(s.messages[u].min,e.fullField,e.min)):a&&!o&&l>e.max?n.push(cn(s.messages[u].max,e.fullField,e.max)):o&&a&&(l<e.min||l>e.max)&&n.push(cn(s.messages[u].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[_n]=Array.isArray(e[_n])?e[_n]:[],-1===e[_n].indexOf(t)&&n.push(cn(s.messages[_n],e.fullField,e[_n].join(", ")))},pattern:(e,t,r,n,s)=>{if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||n.push(cn(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(cn(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const xn=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t,i)&&!e.required)return r();vn.required(e,t,n,o,s,i),ln(t,i)||vn.type(e,t,n,o,s)}r(o)};var An={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(ln(t,"string")&&!e.required)return r();vn.required(e,t,n,i,s,"string"),ln(t,"string")||(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s),vn.pattern(e,t,n,i,s),!0===e.whitespace&&vn.whitespace(e,t,n,i,s))}r(i)},method:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.type(e,t,n,i,s)}r(i)},number:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(""===t&&(t=void 0),ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},boolean:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.type(e,t,n,i,s)}r(i)},regexp:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),ln(t)||vn.type(e,t,n,i,s)}r(i)},integer:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},float:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},array:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(null==t&&!e.required)return r();vn.required(e,t,n,i,s,"array"),null!=t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},object:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.type(e,t,n,i,s)}r(i)},enum:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.enum(e,t,n,i,s)}r(i)},pattern:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t,"string")&&!e.required)return r();vn.required(e,t,n,i,s),ln(t,"string")||vn.pattern(e,t,n,i,s)}r(i)},date:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t,"date")&&!e.required)return r();if(vn.required(e,t,n,i,s),!ln(t,"date")){let r;r=t instanceof Date?t:new Date(t),vn.type(e,r,n,i,s),r&&vn.range(e,r.getTime(),n,i,s)}}r(i)},url:xn,hex:xn,email:xn,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;vn.required(e,t,n,i,s,o),r(i)},any:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s)}r(i)}};function Sn(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone(){const e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}const kn=Sn();class Cn{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");An[e]=t};static warning=on;static messages=kn;static validators=An;rules={};_messages=kn;constructor(e){this.define(e)}define(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");this.rules={},Object.keys(e).forEach((t=>{const r=e[t];this.rules[t]=Array.isArray(r)?r:[r]}))}messages(e){return e&&(this._messages=pn(Sn(),e)),this._messages}validate(e,t={},r=(()=>{})){let n=e,s=t,i=r;if("function"==typeof s&&(i=s,s={}),!this.rules||0===Object.keys(this.rules).length)return i&&i(null,n),Promise.resolve(n);if(s.messages){let e=this.messages();e===kn&&(e=Sn()),pn(e,s.messages),s.messages=e}else s.messages=this.messages();const o={};(s.keys||Object.keys(this.rules)).forEach((t=>{const r=this.rules[t];let s=n[t];r.forEach((r=>{let i=r;"function"==typeof i.transform&&(n===e&&(n={...n}),s=n[t]=i.transform(s)),i="function"==typeof i?{validator:i}:{...i},i.validator=this.getValidationMethod(i),i.validator&&(i.field=t,i.fullField=i.fullField||t,i.type=this.getType(i),o[t]=o[t]||[],o[t].push({rule:i,value:s,source:n,field:t}))}))}));const a={};return hn(o,s,((e,t)=>{const r=e.rule;let i,o=!("object"!==r.type&&"array"!==r.type||"object"!=typeof r.fields&&"object"!=typeof r.defaultField);function c(e,t){return{...t,fullField:`${r.fullField}.${e}`,fullFields:r.fullFields?[...r.fullFields,e]:[e]}}function l(i=[]){let l=Array.isArray(i)?i:[i];!0===s.suppressWarning&&l.length&&Cn.warning("async-validator:",l),l.length&&void 0!==r.message&&(l=[].concat(r.message));let u=l.map(dn(r,n));if(s.first&&u.length)return a[r.field]=1,t(u);if(o){if(r.required&&!e.value)return void 0!==r.message?u=[].concat(r.message).map(dn(r,n)):s.error&&(u=[s.error(r,cn(s.messages.required,r.field))]),t(u);let i={};r.defaultField&&Object.keys(e.value).map((e=>{i[e]=r.defaultField})),i={...i,...e.rule.fields};const o={};Object.keys(i).forEach((e=>{const t=i[e],r=Array.isArray(t)?t:[t];o[e]=r.map(c.bind(null,e))}));const a=new Cn(o);a.messages(s.messages),e.rule.options&&(e.rule.options.messages=s.messages,e.rule.options.error=s.error),a.validate(e.value,e.rule.options||s,(e=>{const r=[];u&&u.length&&r.push(...u),e&&e.length&&r.push(...e),t(r.length?r:null)}))}else t(u)}if(o=o&&(r.required||!r.required&&e.value),r.field=e.field,r.asyncValidator)i=r.asyncValidator(r,e.value,l,e.source,s);else if(r.validator){try{i=r.validator(r,e.value,l,e.source,s)}catch(e){console.error?.(e),s.suppressValidatorError||setTimeout((()=>{throw e}),0),l(e.message)}!0===i?l():!1===i?l("function"==typeof r.message?r.message(r.fullField||r.field):r.message||`${r.fullField||r.field} fails`):i instanceof Array?l(i):i instanceof Error&&l(i.message)}i&&i.then&&i.then((()=>l()),(e=>l(e)))}),(e=>{!function(e){let t=[],r={};for(let r=0;r<e.length;r++)s=e[r],Array.isArray(s)?t=t.concat(...s):t.push(s);var s;t.length?(r=an(t),i(t,r)):i(null,n)}(e)}),n)}getType(e){if(void 0===e.type&&e.pattern instanceof RegExp&&(e.type="pattern"),"function"!=typeof e.validator&&e.type&&!An.hasOwnProperty(e.type))throw new Error(cn("Unknown rule type %s",e.type));return e.type||"string"}getValidationMethod(e){if("function"==typeof e.validator)return e.validator;const t=Object.keys(e),r=t.indexOf("message");return-1!==r&&t.splice(r,1),1===t.length&&"required"===t[0]?An.required:An[this.getType(e)]||void 0}}function $n(e){return new Cn(e)}var On={validateId:function(e){return!!e&&(!(e.length<6)&&!!/^[A-Za-z0-9_-]+$/.test(e))},validatePhone:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)},validator:$n,validate:function(e,t,r={},n=(()=>{})){return rr.run($n(e).validate(t,r,n))},isChinese:function(e){return!!e&&!!/^[\u4E00-\u9FA5]+$/.test(e)},isNumber:function(e){return!!e&&!!/^[0-9]+$/.test(e)},isFloat:function(e){return!!e&&!!/^(\-|\+)?\d+(\.\d+)?$/.test(e)},isPhoneNumber:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)}};const jn={gbk:Zr,math:$e,list:nn,string:Wt,time:Sr,obj:cr,rule:On,regex:{pattern:{num:"0-9",zh:"一-龥",en:"A-Za-z"},regex:(e,t)=>new RegExp(e,t),entire:{chinese:/^[\u4E00-\u9FA5]+$/,real:/^(\-|\+)?\d+(\.\d+)?$/,cssReal:/^(\-|\+)?\d*(\.)?\d+$/,id:/^[A-Za-z0-9]+$/,yyyyMMdd:/^(\d{4})-?(\d{2})-?(\d{2})$/}},...Me,...$r,...rn,Event:f},En="[object Object]",Pn="[object Array]",Tn=e=>Object.prototype.toString.call(e),qn=(e,t,r=!1)=>{if(e===t)return;const n=Tn(e);if(n===Tn(t))if(n===Pn&&e.length>=t.length)for(let r=0;r<t.length;r++)qn(e[r],t[r]);else if(n===En&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?qn(e[n],t[n]):e[n]=null},Bn=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=Tn(e),o=Tn(t);if(i===Pn&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)Bn(e[s],t[s],r,`${n}[${s}]`);else if(i===En&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Tn(s),c=Tn(o);if(s!==o)if(a===Pn&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Bn(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===En&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Bn(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class Ln{list=[];constructor(){this.invoke=this.invoke.bind(this)}use(e){this.list=this.list.concat(e)}invoke(e){return this.list.reduce(((e,t)=>e.then((e=>t(e)))),Promise.resolve(e)).catch((e=>"REFETCH"===e.sig?Promise.resolve(e.result):Promise.reject(e)))}}class Rn{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new Ln,response:new Ln};constructor(e){const{reqConfig:t={},requestEncrypt:r,responseDecrypt:n,handleError:s,api:i}=e;this.reqConfig=t,this.handleEncrypt=r,this.handleDecrypt=n,this.handleError=s,this.handleRequest=i}static blockId="blockid";static requestLock={};lockR(e,t){Rn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete Rn.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}_fetch(e,t){let r=e;return t&&this.handleEncrypt&&(r=this.handleEncrypt(e)),new Promise(((e,n)=>{this.handleRequest({...r,success:r=>{let n=r;t&&this.handleDecrypt&&(n=this.handleDecrypt(r)),e(n)},fail:e=>{n(e)}})}))}async request(e,t){const r=cr.copy(this.reqConfig[e]),{config:n,...s}=await this.interceptors.request.invoke({url:r.url,data:t||{},header:{"content-type":"application/json"},method:r.method?r.method:"POST",responseType:"text",config:r});let i;try{if("block"===n.model)this.lockR(Rn.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await Rn.requestLock[Rn.blockId].request;else if(Rn.requestLock[Rn.blockId]&&Rn.requestLock[Rn.blockId].lock&&await Rn.requestLock[Rn.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),Rn.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await Rn.requestLock[e].request,this.unlockR(e)}else i=await this._fetch(s,n.hasEncrypt)}catch(e){this.handleError&&this.handleError(e)}return this.interceptors.response.invoke({res:i,config:r,reqId:this.getIdFromReq(s),refetch:()=>({sig:"REFETCH",result:this.request(e,t||{})})})}}const Fn=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var Un={diff:function(e,t){const r={};return(e=>{if(Tn(e)===En)for(let t in e)if(/\w+\.\w+/g.test(t)&&-1===t.indexOf("[")){const r=t.split(".");let n=e,s=r.length;for(let e=0;e<s-1;e++){const t=r[e];Tn(n[t])!==En&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),qn(e,t,!0),Bn(e,t,r,"",!0),r},promixify:Fn,run:(e,t={})=>e?rr.run(Fn(e)(t)):rr.run(e),formatList:(e,t,r)=>(e||[]).reduce(((e,n,s)=>({...e,[`${r}[${t+s}]`]:n})),{}),ruleValidator:(e,t)=>!!t&&(!Array.isArray(t)||!(t.length<=0)&&t.every((e=>!!e))),Http:Rn,setWatcher:e=>{let t=e.data,r=e.watch;Object.keys(r).forEach((n=>{let s=t,i=n.split(".");for(let e=0;e<i.length-1;e++)s=s[i[e]];let o=i[i.length-1],a=r[n].handler||r[n],c=r[n].deep;cr.observe(s,o,a,e,c)}))}};const Dn=e=>{if(!e)return"";if(!rn.isObject(e))return"";let t="";return rn.forof(e,((e,r)=>{r&&(t+=`${Wt.kebabCase(e)}:${r};`)})),t},In=["display","position","top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","fontSize","textAlign","fontFamily","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius","background","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","color","overflow","opacity","flexDirection","justifyContent","alignItems","flexWrap","alignContent","alignSelf","flex","flexBasis","flexFlow","flexShrink","pointerEvents"],Mn=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],Kn=(e,t="px")=>e&&t?"0"===e?e:On.isFloat(e.toString())?`${e}${t}`:e:e;var zn={stringify:Dn,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=mr.parse(e,{sep:";",eq:":",uri:!1}),s={};return rn.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:Wt.camelCase(e):e;On.isFloat(n)||n.length>=2&&n.startsWith(".")&&On.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:Kn,style:(e,t="px")=>{if(!e)return"";const r=rn.copy(e,{fields:In});rn.forof(r,((e,n)=>{(Mn.includes(e)||Mn.includes(Wt.camelCase(e)))&&(r[e]=Kn(n,t))}));return Dn(r)},commonFields:In};const Nn=(e,t="",r=!1)=>{try{if(!e)return;const n=mr.parseUrl(e),s=t||n.name;if(!t||!r||!n.origin||n.origin===window.location.origin)((e,t)=>{try{const r=document.createElement("a");r.style.display="none",r.href=e,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(t){console.error(`[ddan] _downloadUrl ${e}`,t)}})(e,s);else{const t=n.params;t.t=Date.now();const r=`${n.url}?${mr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){Hn(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},Hn=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;Nn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},Vn=e=>{try{const t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.style.opacity="0",t.value=e??"",t.select();const r=document.execCommand("copy");return document.body.removeChild(t),r}catch(e){return console.error("[ddan] copyText",e),!1}},Wn=(e,t="denied")=>new Promise((r=>{const n=navigator?.permissions;if(!n||!n.query)return r(t);const s={name:e};n.query(s).then((e=>r(e.state))).catch((()=>r(t)))})),Zn=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e,Yn=(e,t)=>{if(!e||!t)return[];const r=[];let n;for(;null!==(n=t.exec(e));)r.push(n[1]);return r},Jn=(e,t="application/javascript")=>{const r=new Blob([e],{type:t});return URL.createObjectURL(r)};var Qn={dataURLtoFile:(e,t)=>{let r=e.split(","),n=r[0].match(/:(.*?);/)[1],s=window.atob(r[1]),i=s.length,o=new Uint8Array(i);for(;i--;)o[i]=s.charCodeAt(i);return new File([o],t,{type:n})},dataURLtoBlob:e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=window.atob(t[1]),s=n.length,i=new Uint8Array(s);for(;s--;)i[s]=n.charCodeAt(s);return new Blob([i],{type:r})},blobToFile:(e,t)=>(e.lastModifiedDate=new Date,e.name=t,e),readAsDataURL:(e,t)=>{var r=new FileReader;r.readAsDataURL(e),r.onloadend=function(e){t&&t(e.target?.result)}},downloadUrl:Nn,download:(e,t="")=>{e&&("string"!=typeof e?Hn(e,t):Nn(e,t))},downloadFile:Hn,downloadImage:e=>{try{if(!e)return;const t=e.match(/\/(\w+.\w+)$/)[1],r=new Image;r.onload=()=>{let e=document.createElement("canvas");e.width=r.width,e.height=r.height;let n=e.getContext("2d");n&&n.drawImage(r,0,0,r.width,r.height);let s=e.toDataURL();Nn(s,t)},r.src=e,r.setAttribute("crossOrigin","Anonymous")}catch(e){console.error("[ddan] downloadImage",e)}return Promise.resolve()},watermark:(e,{width:t=400,height:r=300,angle:n=0,fillStyle:s="rgba(0, 0, 0, 0.2)",font:i="16px Arial",textAlign:o="left",textBaseline:a="middle"}={})=>{try{if(!e)return"";const c=document.createElement("canvas");c.width=t,c.height=r;const l=c.getContext("2d");return l?(n&&l.rotate(n*Math.PI/180),s&&(l.fillStyle=s),i&&(l.font=i),o&&(l.textAlign=o),a&&(l.textBaseline=a),l.fillText(e,c.width/10,c.height/2),`url(${c.toDataURL()})`):""}catch(e){return console.error("[ddan] watermark",e),""}},copyText:(e,t=!1)=>new Promise((r=>{!t&&navigator.clipboard?Wn("clipboard-write").then((t=>{Zn(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(Vn(e)))):r(Vn(e))})).catch((()=>{r(Vn(e))})):r(Vn(e))})),queryPermission:Wn,isAllowed:Zn,legacyCopy:Vn,takeHtmlLinks:e=>{if(!e)return[];const t=[];return[/<script[^>]+src="([^"]+)"/g,/<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"/g,/<link[^>]+rel="icon"[^>]+href="([^"]+)"/g].forEach((r=>{const n=Yn(e,r);t.push(n)})),[].concat(...t)},takeHtml:Yn,toBlobUrl:Jn,workerURL:e=>Jn(`(${e.toString()})()`,"text/javascript")};const Gn=new class{__defStyle="vertical-align: middle; mask-position: 50% 50%; mask-repeat: no-repeat; mask-size: 100%; -webkit-mask-position: 50% 50%; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100%; background-color: currentColor;";__map={back:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M609.408 149.376L277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"/></svg>',right:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"/></svg>',home:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13 19.8h3.8v-7h3.303L12 4.697 3.897 12.8H7.2v7H11V17h2v2.8zm5 .2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-6H3.414a1 1 0 0 1-.707-1.707l8.586-8.586a1 1 0 0 1 1.414 0l8.586 8.586A1 1 0 0 1 20.586 14H18v6z" fill-rule="evenodd" fill-opacity=".9"/></svg>',close:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M764.288 214.592L512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"/></svg>',close_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M466.752 512l-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',close_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"/></svg>',warning:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M928.99 755.83L574.6 203.25c-12.89-20.16-36.76-32.58-62.6-32.58s-49.71 12.43-62.6 32.58L95.01 755.83c-12.91 20.12-12.9 44.91.01 65.03 12.92 20.12 36.78 32.51 62.59 32.49h708.78c25.82.01 49.68-12.37 62.59-32.49 12.91-20.12 12.92-44.91.01-65.03zM554.67 768h-85.33v-85.33h85.33V768zm0-426.67v298.66h-85.33V341.32l85.33.01z" fill="currentColor"/></svg>',play:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M512 1024A512 512 0 1 1 512 0a512 512 0 0 1 0 1024zm3.008-92.992a416 416 0 1 0 0-832 416 416 0 0 0 0 832zM383.232 287.616l384 224.896-384 223.104v-448z" fill="currentColor"/></svg>',lock:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32H224zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96z"/><path fill="currentColor" d="M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32zm192-160v-64a192 192 0 1 0-384 0v64h384zM512 64a256 256 0 0 1 256 256v128H256V320A256 256 0 0 1 512 64z"/></svg>',lock_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M467.2 713.92v115.968a44.8 44.8 0 0 0 89.6 0V713.92c26.752-14.72 44.8-42.304 44.8-73.92 0-47.104-40.128-85.312-89.6-85.312-49.472 0-89.6 38.208-89.6 85.312 0 31.616 18.048 59.136 44.8 73.92zM64 384h896v640H64V384zm268.8 0h358.4V256c0-94.272-80.256-170.688-179.2-170.688-98.944 0-179.2 76.416-179.2 170.688v128zM512 0c148.48 0 268.8 114.56 268.8 256v128H243.2V256C243.2 114.56 363.52 0 512 0z" fill="currentColor"/></svg>',plus:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"/></svg>',plus_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M352 480h320a32 32 0 1 1 0 64H352a32 32 0 0 1 0-64z"/><path fill="currentColor" d="M480 672V352a32 32 0 1 1 64 0v320a32 32 0 0 1-64 0z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',plus_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0v147.2z"/></svg>',star:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 747.84l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"/></svg>',star_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M283.84 867.84L512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"/></svg>',share:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M679.872 348.8l-301.76 188.608a127.808 127.808 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"/></svg>',love:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M171.712 571.648l.352.32 287.904 252.8a64 64 0 0 0 82.912 1.344l296.832-244.544a215.584 215.584 0 1 0-301.824-300.576L512 316.672l-25.888-35.616a215.584 215.584 0 1 0-314.4 290.624zM32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512l-295.36 243.392a128 128 0 0 1-165.888-2.592L129.984 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>',love_fill:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512L562.592 892.8a96 96 0 0 1-124.416-1.952L130.016 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>'};getBase64=e=>{const t=this.getSVG(e);return t?.url||""};getSVG=e=>{if(!e)return;const t=this.__map[e];if(!t)return;return{url:this.toBase64(t),escape:this.toEscape(t)}};toBase64=e=>{if(!e)return"";const t=this._tiny(e);return`data:image/svg+xml;base64,${Cr.encode(t)}`};_tiny=e=>e?e.replace(/<!--(.*)-->/g,"").replace(/[\r\n]/g," ").replace(/"/g,"'"):"";toEscape=e=>{if(!e)return"";return`data:image/svg+xml,${this._tiny(e).replace(/%/g,"%25").replace(/&/g,"%26").replace(/#/g,"%23").replace(/{/g,"%7B").replace(/}/g,"%7D").replace(/</g,"%3C").replace(/>/g,"%3E")}`};getStyle(e,t={}){if(!e)return"";const r=this.__map[e];return r?this.toStyle(r,t):""}toStyle(e,t={}){if(!e)return"";const r=this.toBase64(e);return r?this.getStyleByUrl(r,t):""}getStyleByUrl(e,t={}){if(!e)return"";const{key:r="mask-image",gradientValue:n="radial-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5))",gradient:s=!1,defStyle:i=this.__defStyle}=t,o=s&&n?`${n}, url("${e}")`:`url("${e}")`;return`${r}:${o};-webkit-${r}:${o};${i}`}},Xn={mini:Un,css:zn,qs:mr,icon:Gn,html:Qn},es=({url:e,options:t})=>{const r={"Content-Type":"application/json; charset=utf-8",...t.headers||{}};return t.headers=r,new Promise(((r,n)=>{fetch(e,t).then((e=>{r(e.json())})).catch((e=>{n(e)}))}))};function ts(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function rs(e){const{url:t="",host:r,options:n}=e,s=e;if(t.startsWith("http://")||t.startsWith("https://")||(s.url=(r||"")+t),"GET"===n.method.toUpperCase()&&n.body){const e=JSON.parse(n.body);if(rn.isPlainObject(e)){const r=mr.stringify(e),n=-1===t.indexOf("?")?"?":"&";s.url=`${s.url||""}${n}${r}`,delete s.options.body}}return n&&n.plugins&&delete s.options?.plugins,n&&n.model&&delete s.options?.model,s}class ns{host="";reqConfig={};handleError;interceptors={request:new Ln,response:new Ln};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(rs),this.interceptors.response.use(e.handleResponse||ts),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){ns.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete ns.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}async fetch(e,t){const r=rn.copy(this.reqConfig[e])||{},n={host:this.host,url:r.url||"",options:{...r||{},body:JSON.stringify({...t||{}})}};try{const s=await this.interceptors.request.invoke(n);let i;if(delete s.options.plugins,"block"===r.model)this.lockR(ns.blockId,(()=>es(s))),i=await ns.requestLock[ns.blockId].request;else if(ns.requestLock[ns.blockId]&&ns.requestLock[ns.blockId].lock&&await ns.requestLock[ns.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),ns.requestLock[e]||this.lockR(e,(()=>es(s))),i=await ns.requestLock[e].request,this.unlockR(e)}else i=await es(s);return this.interceptors.response.invoke({response:i,config:r,refetch:()=>({sig:"REFETCH",result:this.fetch(e,t)})})}catch(e){return this.handleError&&this.handleError(e),Promise.reject(e)}}}var ss={getDataURL:(e,t)=>{const r={contentType:"",dataUrl:""};return ge.to(fetch(e,{cache:t}).then((e=>(r.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(r.dataUrl=`data:${r.contentType};base64,`+Me.ab2str(e,!0),r))))},getArrayBuffer:async(e,t)=>ge.to(fetch(e,{cache:t}).then((e=>e.arrayBuffer()))),getJson:async(e,t)=>ge.to(fetch(e,{cache:t}).then((e=>e.json()))),download:(e,t={})=>new Promise((r=>fetch(e).then((async e=>{if(!e.ok||200!==e.status)throw new Error(e.statusText);const n=+(e.headers.get("content-length")||""),s=e.body?.getReader();let i=0;const o=[];for(;;){const{done:e,value:r}=await s.read();if(e)break;o.push(r),i+=r.length;const a=$e.float(100*i/n,{digits:2});t?.progress&&t?.progress(a,i,n)}const a=new Uint8Array(i);let c=0;for(const e of o)a.set(e,c),c+=e.length;t?.success&&t?.success(a),r(a)})).catch((e=>{t?.fail&&t?.fail(e),r(void 0)})))),getText:async(e,t)=>ge.to(fetch(e,{cache:t}).then((e=>e.text()))),cache:async(e,t="no-cache")=>ge.to(fetch(e,{cache:t}).then((()=>!0)))};class is{publicKey="";privateKey="";iv="";__privateCryptoKey;__sharedSecret;__curve;__keyFormat;__subtle;constructor(e="P-256",t="raw"){this.__curve=e,this.__keyFormat=t||"raw","undefined"!=typeof window?this.__subtle=window.crypto.subtle:this.__subtle={}}async generateKeys(){const e=await this.__subtle.generateKey({name:"ECDH",namedCurve:this.__curve},!0,["deriveKey","deriveBits"]);return this.__privateCryptoKey=e.privateKey,this.publicKey=await this.exportKey(e.publicKey),this.privateKey=await this.exportKey(e.privateKey,"pkcs8"),this}async exportKey(e,t="raw"){const r=await this.__subtle.exportKey(t||this.__keyFormat,e);return Me.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Me.base64ToBytes(e);return await this.__subtle.importKey(t||this.__keyFormat||"raw",n,{name:"ECDH",namedCurve:this.__curve},!0,r)}async setPrivateKey(e){if(!e)return!1;const t=await this.importKey(e,"pkcs8",["deriveKey","deriveBits"]);return this.privateKey=await this.exportKey(t,"pkcs8"),this.__privateCryptoKey=t,!0}async deriveSharedSecret(e,t){if(!this.__privateCryptoKey)return!1;const r=await this.importKey(e),n=await this.__subtle.deriveKey({name:"ECDH",public:r},this.__privateCryptoKey,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return this.__sharedSecret=n,this.iv=t||"",!0}async encode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Me.base64ToBytes(r),s=Me.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Me.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Me.base64ToBytes(r):Me.getRandomBytes(12),s=Me.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Me.concatBytes(new Uint8Array(i),n);return Me.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Me.base64ToBytes(e),s=Me.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Me.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Me.base64ToBytes(e);if(t.length<12)return"";const r=t.slice(t.length-12),n=t.slice(0,t.length-12),s=await this.__subtle.decrypt({name:"AES-GCM",iv:r},this.__sharedSecret,n);return Me.textDecode(s)}}const os={fetch:ss,Http:ns,css:zn,qs:mr,icon:Gn,html:Qn,rsa:Ze,...{Ecdh:is}};var as={brotliCompress:function(e,r=t.constants.BROTLI_DEFAULT_QUALITY){try{if(!e)return"";const n=Me.toUtf8Bytes(e);return t.brotliCompressSync(n,{params:{[t.constants.BROTLI_PARAM_QUALITY]:r}}).toString("base64")}catch(t){return e||""}},brotliDecompress:function(e){try{if(!e)return"";const r=Me.base64ToBytes(e);return t.brotliDecompressSync(r).toString("utf-8")}catch(t){return e||""}}};var cs={child_exec:e=>new Promise((t=>{if(!e)return t([null,""]);s(e,((e,r)=>{t(e?[e||"error",""]:[null,r||""])}))}))};const ls=()=>{try{return"win32"===process.platform?us():"darwin"===process.platform?fs():void 0}catch(e){return}},us=async()=>{do{let e,t;if([e,t]=await cs.child_exec('reg query "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"'),e)break;const r=t.split("\n").find((e=>e.includes("ProxyEnable")));if(!(r&&r.trim().endsWith("1")))break;const n=t.split("\n").find((e=>e.includes("ProxyServer"))),s=n?n.split(" ").filter(Boolean).pop():"";if(!s)break;const i=s.split(":");if(i.length<=1)break;const o=i[0],a=+(i[1]||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},fs=async()=>{do{let e,t;if([e,t]=await cs.child_exec('networksetup -getwebproxy "Wi-Fi"'),e)break;const r=t.split("\n"),n=r.find((e=>e.includes("Enabled")));if(!(n&&n.includes("Yes")))break;const s=r.find((e=>e.includes("Server"))),i=r.find((e=>e.includes("Port"))),o=s?s.split(":")[1]?.trim():null,a=+((i?i.split(":")[1]?.trim():null)||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},hs=(e,t=["*"],r="DIRECT",n=[])=>{const s=e||r||"DIRECT",i=r||"DIRECT",o=`\n function FindProxyForURL(url, host) {\n if (host === "127.0.0.1" || host === "localhost") {\n return "DIRECT";\n }\n\n if (isInNet(host, "10.0.0.0", "255.0.0.0") ||\n isInNet(host, "172.16.0.0", "255.240.0.0") ||\n isInNet(host, "192.168.0.0", "255.255.0.0")) {\n return "DIRECT";\n }\n\n var _rules = ${JSON.stringify(t)};\n var _proxy = "${s}";\n var _default = "${i}";\n var _directs = ${JSON.stringify(n)};\n\n for (var i = 0; i < _rules.length; i++) {\n if (shExpMatch(host, _rules[i])) {\n return _proxy;\n }\n }\n\n for (var j = 0; j < _directs.length; j++) {\n if (shExpMatch(host, _directs[i])) {\n return "DIRECT";\n }\n }\n\n return _default;\n }\n `;return Me.toDataUrl(o,"application/x-ns-proxy-autoconfig")},ds=(e,t,r)=>{if(!e||!t)return"";const{type:n="ALL",direct:s=!1}=r||{};let i="";switch(n?n.toUpperCase():""){case"ALL":i=`SOCKS5 ${e}:${t};PROXY ${e}:${t}`;break;case"PROXY":i=`PROXY ${e}:${t}`;break;case"SOCKS5":i=`SOCKS5 ${e}:${t}`}if(!i&&!s)return"";const o=[];return i&&o.push(i),s&&o.push("DIRECT"),o.join(";")};var ps={getSystemProxy:ls,toPacScript:hs,toPacProxy:ds,pacScript:async(e,t,r)=>{const{type:n="SOCKS5",rules:s=["*"],useSystem:i}=r||{},o=ds(e,t,{type:n});if(!o)return"";let a;if(i){const e=await ls();e&&(a=ds(e?.ipaddress||"",e?.port||0,{direct:!0}))}return hs(o,s||[],a)},getPacScript:async e=>{const{type:t="SOCKS5",rules:r=["*"],useSystem:n,address:s="",port:i=0,directs:o=[]}=e||{},a=ds(s,i,{type:t});let c;if(n){const e=await ls();e&&(c=ds(e?.ipaddress||"",e?.port||0,{direct:!0}))}return hs(a,r||[],c,o)}};const gs=(e,t)=>new Promise(((r,n)=>{i.readdir(e,(async(s,i)=>{if(s)return n(s);r(ys(e,i,t))}))})),ys=async(e,t,r)=>{for(let n of t){const t=`${e}\\${n}`;i.lstatSync(t).isDirectory()?await gs(`${t}`,r):r&&await r(t)}};var ms={...{readDirectory:gs,readFiles:ys},...as,...cs,...ps,Ecdh:class{publicKey="";privateKey="";sharedSecret;iv="";__curve;__algorithm;__ecdh;constructor(e="prime256v1",t="aes-256-gcm"){this.__curve=e,this.__algorithm=t,this.generateKeys()}generateKeys(){const t=e.createECDH("prime256v1");t.generateKeys(),this.publicKey=t.getPublicKey("base64"),this.privateKey=t.getPrivateKey("base64"),this.__ecdh=t}setPrivateKey(e){return!!e&&(!!this.__ecdh&&(this.__ecdh.setPrivateKey(e,"base64"),this.publicKey=this.__ecdh.getPublicKey("base64"),!0))}setSharedSecret(e){return!!e&&(this.sharedSecret=e,!0)}deriveSharedSecret(e,t){return!!e&&(this.sharedSecret=this.__ecdh.computeSecret(e,"base64").toString("base64"),this.iv=t||"",!0)}encode(t,r){if(!this.sharedSecret)return"";const n=r||this.iv;if(!n)return"";const s=Me.base64ToBytes(n),i=e.createCipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),s),o=Buffer.concat([new Uint8Array(i.update(t,"utf8")),new Uint8Array(i.final())]),a=i.getAuthTag();return Buffer.concat([new Uint8Array(o),new Uint8Array(a)]).toString("base64")}encodeiv(t,r){if(!this.sharedSecret)return"";const n=r||this.iv,s=n?Me.base64ToBytes(n):Me.getRandomBytes(12),i=e.createCipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),s),o=Buffer.concat([new Uint8Array(i.update(t,"utf8")),new Uint8Array(i.final())]),a=i.getAuthTag();return Buffer.concat([new Uint8Array(o),new Uint8Array(a),s]).toString("base64")}decode(t,r){if(!t||!this.sharedSecret)return"";const n=r||this.iv;if(!n)return"";const s=e.createDecipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),Me.base64ToBytes(n)),i=Me.base64ToBytes(t),o=i.slice(i.length-16);s.setAuthTag(o);const a=i.slice(0,i.length-16);return Buffer.concat([new Uint8Array(s.update(a)),new Uint8Array(s.final())]).toString("utf-8")}decodeiv(t){if(!t||!this.sharedSecret)return"";const r=Me.base64ToBytes(t);if(r.length<28)return"";const n=r.slice(r.length-12),s=r.slice(r.length-28,r.length-12),i=e.createDecipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),n);i.setAuthTag(s);const o=r.slice(0,r.length-28);return Buffer.concat([new Uint8Array(i.update(o)),new Uint8Array(i.final())]).toString("utf-8")}},EcdhWeb:class extends is{constructor(t="P-256",r="raw"){super(t,r),this.__subtle=e.webcrypto.subtle}},Socks5:class{upstreamProxy;server=null;clientSockets=new Set;systemProxy=null;useSystemProxy=!1;__debug=!1;__uuid;__port=0;__event;__pipeline;__logger;__totalReceived=0;__totalSent=0;__rules=[];constructor(e,t=!1,r){this.__event=new f,this.upstreamProxy=this.filterProxyConfigs(e),this._updateRules(),this.__debug=t,this.__uuid=u(),this.__pipeline=new we(1),this.__logger=r||console}get id(){return this.__uuid}get port(){return this.__port}get url(){return this.__port?`socks5://127.0.0.1:${this.__port}`:""}get totalReceived(){return this.__totalReceived}get totalSent(){return this.__totalSent}get rules(){return this.__rules}validateProxyConfig(e){const{ipaddress:t,port:r,userId:n,password:s}=e||{};return t&&"string"==typeof t?r&&"number"==typeof r?n&&"string"==typeof n?s&&"string"==typeof s?"":"无效的上游代理密码":"无效的上游代理用户名":"无效的上游代理端口":"无效的上游代理 IP 地址"}filterProxyConfigs(e){let t=[];t=e&&Array.isArray(e)?e:[e];const r=[];for(const e of t)this.validateProxyConfig(e)||r.push(e);return r}async start(e=8838){if(this.upstreamProxy.length<=0)return 0;if(this.server)return this.__debug&&console.info("[socks5] server is already running"),this.__port;const t=await this.findAvailablePort(e);return t?(this.__port=t,this.server=r.createServer((e=>this.handleSocksConnection(e))),this.server.listen(t,(()=>{this.__debug&&this.__logger?.info(`[socks5] server is running on port ${t}`)})),this.server.on("error",(e=>{this.__logger?.error("[socks5] server error:",e),this.close()})),t):0}setUpstreamProxy(e){if(!e)return!1;const t=this.filterProxyConfigs(e);return!(!t||t.length<=0)&&(this.upstreamProxy=t,this._updateRules(),!0)}setSystemProxy(e,t){this.useSystemProxy=e,e&&t&&t.ipaddress&&t.port&&(this.systemProxy=t)}async findAvailablePort(e,t=200){let n=e,s=0;for(;s<t;)try{return await new Promise(((e,t)=>{const s=r.createServer();s.unref(),s.on("error",t),s.listen(n,(()=>{s.close((()=>e()))}))})),n}catch{s++,n++}return this.__debug&&this.__logger?.warn("[socks5] findAvailablePort failed"),0}async handleSocksConnection(e){let t="";try{if(!e)return;this.clientSockets.add(e),e.on("close",(()=>{this.clientSockets.delete(e),e?.destroy()})),await this.performHandshake(e);const r=await this.parseClientRequest(e),n=r.addr;t=`${n}:${r.port}`,this.__debug&&this.__logger?.info("[socks5] connection",t);const s=this.findProxyConfig(n);if(s){const n=await this.connectToUpstreamProxy(r,s);this.__logger?.info(`[socks5] connection upstream ${t}, use ${s.ipaddress}:${s.port}`),this.setupDataForwarding(e,n,"upstream")}else if(this.useSystemProxy&&this.systemProxy&&!mr.isLocalIpAddress(n)){const n=await this.connectToSystemProxy(r);this.__debug&&console.info("[socks5] connection system",t),this.setupDataForwarding(e,n,"system")}else{this.__debug&&console.info("[socks5] connection local",t);const n=await this.connectToLocal(r);this.setupDataForwarding(e,n,"local")}}catch(r){this.__debug&&this.__logger?.error("[socks5] connection failed:",r),e.end(new Uint8Array([5,1])),this._emit("error",r,t)}}performHandshake(e){return new Promise(((t,r)=>{e.once("data",(n=>{if(5!==n[0])return r(new Error("Unsupported SOCKS version"));e.write(new Uint8Array([5,0])),t()}))}))}parseClientRequest(e){return new Promise(((t,r)=>{e.once("data",(e=>{let n,s;if(1!==e[1])return r(new Error("Unsupported command"));if(1===e[3])n=e.slice(4,8).join("."),s=e.readUInt16BE(8);else{if(3!==e[3])return r(new Error("Unsupported address type"));{const t=e[4];n=e.slice(5,5+t).toString(),s=e.readUInt16BE(5+t)}}t({addr:n,port:s})}))}))}async connectToUpstreamProxy(e,t){const r={proxy:{ipaddress:t.ipaddress,port:t.port,type:5,userId:t.userId,password:t.password},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(r)}catch(e){throw new Error("Failed to connect to upstream proxy: "+e)}}async connectToSystemProxy(e){const t={proxy:{...this.systemProxy,type:5},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(t)}catch(e){throw new Error("Failed to connect to system proxy: "+e)}}async connectToProxy(e){const{socket:t}=await n.createConnection(e);return t}async connectToLocal(e){return new Promise(((t,n)=>{const s=r.createConnection(e.port,e.addr,(()=>{t(s)}));s.on("error",(e=>{n(e)}))}))}setupDataForwarding(e,t,r="local"){e.write(new Uint8Array([5,0,0,1,0,0,0,0,0,0])),e.pipe(t),t.pipe(e);const n=`${t.localAddress}:${t.localPort}`;this.__debug&&console.info(`[socks5] setupDataForwarding ${n}`),"upstream"===r&&(t.on("data",(e=>{this.__totalSent+=e.length})),e.on("data",(e=>{this.__totalReceived+=e.length}))),e.on("close",(()=>{this.__debug&&console.info("[socks5] client socket close",n),t.end()})),t.on("close",(()=>{this.__debug&&console.info("[socks5] target socket close",n),e.end()})),e.on("error",(e=>{this.__debug&&console.error("[socks5] client socket error:",e?.message),t.end()})),t.on("error",(t=>{this.__debug&&console.error("[socks5] target socket error:",t?.message),e.end()}))}findProxyConfig(e){if(!mr.isLocalIpAddress(e))for(const t of this.upstreamProxy)if(this.isAllowedDomain(e,t.rules||[]))return t}isAllowedDomain(e,t){if(mr.isLocalIpAddress(e))return!1;if(!t||!Array.isArray(t))return!1;for(const r of t){if("*"===r)return!0;if(mr.shExpMatch(e,r))return!0}return!1}close(){try{if(!this.server)return;this.__debug&&this.__logger?.info("[socks5] closing SOCKS5 proxy server..."),this.server.close((e=>{e&&this.__debug&&this.__logger?.error("[socks5] closing the server failed:",e)})),this.clientSockets.forEach((e=>e?.destroy())),this.clientSockets.clear(),this.server=null,this.__port=0}catch(e){this.__debug&&this.__logger?.error("[socks5] close error:",e)}}on(e,t){e&&t&&(this.__event.off(e,t),this.__event.on(e,t))}off(e,t){e&&this.__event.off(e,t)}resetStatistics(){this.__totalReceived=0,this.__totalSent=0}_emit(e,...t){try{if(!e)return;this.__event.emit(e,...t)}catch(e){}}_updateRules(){this.upstreamProxy&&(this.__rules=nn.distinct(this.upstreamProxy.reduce(((e,t)=>e.concat(t?.rules||[])),[])))}},rsa:Ve};const bs={...ms};var ws={ossImage:(e,t={})=>{if(!e)return e;const r=mr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=nn.toList(t.domain||""),n=e.match(/^http[s]?:\/\/([\w.]+)[\w\W]+/)[1]||"";if(!n||!r.includes(n))return e}const n=[];return t.webp&&!r.endsWith(".gif")&&n.push("format,webp"),t.resize&&n.push(`resize,s_${t.resize}`),t.interlace&&(n.push("interlace,1"),!n.every((e=>!e.startsWith("format")))||r.endsWith(".gif")||r.endsWith(".jpg")||n.push("format,jpg")),n.length<=0?e:`${r}?x-oss-process=image/${n.join("/")}`},ossSnapshot:(e,t={})=>{if(!e)return e;const r=mr.parseUrl(e).url,n=["snapshot"],{m:s="fast",f:i="jpg"}=t;return(t.t||0===t.t)&&n.push(`t_${t.t}`),t.w&&n.push(`w_${t.w}`),t.h&&n.push(`h_${t.h}`),s&&n.push(`m_${s}`),i&&n.push(`f_${i}`),t.ar&&n.push(`ar_${t.ar}`),`${r}?x-oss-process=video/${n.join(",")}`},ossBase64:e=>Ae.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const _s={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},vs=e=>(...t)=>{const r=console[e];_s.overrode?r(...t):xs(r,e,...t)},xs=(e,t,...r)=>{const n=Sr.format(new Date,_s.format),s=_s.tag?`[${t}]`:"";s&&n?e.apply(console,[`${n} ${s}`,...r]):n?e.apply(console,[`${n}`,...r]):s?e.apply(console,[`${s}`,...r]):e.apply(console,[...r])};var As={override:()=>{if(_s.overrode)return;_s.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{xs(t,e,...r)}}))},log:vs("log"),info:vs("info"),warn:vs("warn"),error:vs("error"),config:({tag:e=_s.tag,format:t=_s.format}={})=>{_s.tag=e,_s.format=t}};class Ss{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=rr.debounce((e=>{if(this.key&&this.storage)try{const{setItem:t,setStorageSync:r}=this.storage;if(r)return r(this.key,e);if(t)return t(this.key,JSON.stringify(e))}catch(e){console.error("persit save ",e)}}));read(){if(this.key&&this.storage)try{const{getItem:e,getStorageSync:t}=this.storage;if(t)return t(this.key);if(e){const t=e(this.key);return JSON.parse(t)}}catch(e){return void console.error("persit read ",e)}}handleSave(e,t){if(!this.fields.includes(t)||!e)return;const r=cr.copy(e,{fields:this.fields});this.save(r)}}class ks extends f{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!Y.isFunction(n))return;const[,s]=await rr.run(n({...r,commit:r.commit.bind(r),query:r.query.bind(r),dispatch:r.dispatch.bind(r)},t));return s}async query(e){const t=Reflect.get(this,e);let r;if(null!=t&&""!==t)r=cr.copy(t);else{const[,t]=await rr.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){Y.isObject(t)&&(t=cr.copy(t)),this[e]=t}}const Cs=(e,t)=>{const r=Object.assign(new ks,e||{});r.__persist=new Ss(t||r.persist);const n=r.__persist.read(),s=n?Object.assign(r,n):r;return new Proxy(s,{get:(e,t,r)=>{const n=Reflect.get(e.getters,t);return Y.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(Y.isFunction(s)&&!s(e,r))return!0;const i=Reflect.set(e,t,r,n);return i&&(e.emit(t.toString(),r),e?.__persist?.handleSave(e,t.toString())),i},has:(e,t)=>Reflect.has(e,t)})};class $s{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=mr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=mr.stringify(s,{uri:!1});this.list.push(`${e}?${i}`)}_parseHost(e){e&&!this.host&&/^http[s]?:\/\/([\w.]+)/.test(e)&&(this.host=e.replace(/^http[s]?:\/\/([\w.]+)[\w\W]+/,"$1"))}image(e,t={}){if(!e||!e.includes(this.host))return;if(this.list.length<=0)return;const r={g:"nw",...t},n=e.replace(/^http[s]?:\/\/[\w.]+\/([\w-.,_/?%&=]+)$/,"$1"),s=$r.base64.encodeByOss(n),i=mr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=$r.base64.encodeByOss(e),i=mr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}class Os{__list=[];constructor(){this.clear()}add(e){const t=rr.run(e);return this.__list.push(t),this}clear(){return this.__list=[],this}wait(){const e=this.__list;return this.clear(),Promise.allSettled(e)}}const js=new class{state=Cs(new ks);frame=new br;cache=new Map;cacheTime=new Map;setCache=(e,t)=>null!=t&&(!!e&&(this.cache.set(e,t),this.cacheTime.set(e,Date.now()),!0));hasCache=e=>{if(!e)return!1;this.cache.has(e)};getCache=e=>{if(e)return this.cache.get(e)};getCacheTime=e=>e&&this.cacheTime.get(e)||0;removeCache=e=>{e&&(this.cache.delete(e),this.cacheTime.delete(e))};cacheId=e=>`_${e}_cache_`;timesRecord=(e,t={})=>{if(!e)return;const{mode:r="running",cycle:n="day"}=t||{},s=this.cacheId(r),i=this.getCache(s)||{},o=Date.now(),a=i[e],c={time:o,count:1,cycle:n};return a&&("day"!==n||Sr.isToday(a.time||0))&&(c.count=1+(a.count||0)),i[e]=c,this.setCache(s,i),i};timesValid=(e,t={})=>{if(!e)return!1;const{max:r=1,interval:n=0,mode:s="running",cycle:i="day"}=t||{},o=this.cacheId(s);let a=this.getCache(o);if(!a)return!0;const c=a[e];if(!c)return!0;if("day"===i&&!Sr.isToday(c.time||0))return!0;if(r<=(c.count||0))return!1;return!(Date.now()-(c.time||0)<n)};timesClean=(e="running")=>{const t=this.cacheId(e),r=this.getCache(t);if(!r)return;const n=rn.copy(r);rn.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||Sr.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new Os};class Es{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=u(),this.start=Date.now(),this.timeStartDesc=Sr.format(this.start,"hh:mm:ss.SSS")}get time(){return this.flag?this.end:this.start}get timeDesc(){return this.flag?this.timeEndDesc:this.timeStartDesc}done=(e=Date.now())=>{this.start&&(this.end=e,this.cost=this.end-this.start,this.timeEndDesc=Sr.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const Ps=new class{__map=new Map;__trackList=[];opened=!0;clear(){return this.__map.clear(),this.__trackList=[],this}add(e,{desc:t="",type:r=""}={}){if(!e||!this.opened)return"";const n=new Es;return n.name=e,n.type=r,n.desc=t,this.__trackList.push(n),n.id}done(e){if(!e||!this.opened)return;const t=this.__trackList.find((t=>t.id===e));if(!t||t.isDone)return;t.done();const r=cr.cloneClass(t);r.id=this._endId(e),r.flag=1,r.desc=`${t.desc} | end`,this.__trackList.push(r)}getTrack(e){return this.__trackList.find((t=>t.id===e))}getLine(e){if(!e||e.endsWith("-end"))return[];const t=this.__trackList.findIndex((t=>t.id===e));if(t<0)return[];const r=this._endId(e),n=this.__trackList.findIndex((e=>e.id===r)),s=n<0?this.__trackList.length-t:n-t+1;return nn.take(this.__trackList,s,t)}getList(e,t=""){if(!e)return[];const r=this.__trackList.filter((t=>t.name===e));if(r.length<=0)return[];if(!t)return r;const n=this._endId(t);return this.__trackList.filter((e=>e.id===t||e.id===n))}get list(){return this.__trackList}get size(){return this.__trackList.length}_endId=e=>`${e}-end`;report(e){const t=this.list;if(!t||t.length<=0)return;const r=t[0].time;t.forEach((t=>e&&e(t,r)))}},Ts={cdn:ws,watermark:(e,t)=>new $s(e,t)},qs={Store:ks,storeRef:Cs,Persist:Ss,persistConfig:(e,t,r)=>({key:e,fields:t,storage:r})},Bs=js,Ls=Ps,Rs=As;export{f as Event,h as KValue,d as Mapping,Ts as dCdn,Wr as dHook,Bs as dJoker,Rs as dLogger,Xn as dMini,bs as dNode,qs as dStore,Ls as dTracker,jn as dUtil,os as dWeb};
|
|
1
|
+
import e from"crypto";import t from"zlib";import r from"net";import{SocksClient as n}from"socks";import{exec as s}from"child_process";import i from"fs";const o="0123456789",a="abcdefghijklmnopqrstuvwxyz",c="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var l={keyNumber:o,keyLower:a,keyUpper:c,keyChars:o+a+c};const u=(e=0,t=0)=>{const r=l.keyChars.split(""),n=[];let s;if(t=t||r.length,e)for(s=0;s<e;s++)n[s]=r[0|Math.random()*t];else{let e;for(n[8]=n[13]=n[18]=n[23]="-",n[14]="4",s=0;s<36;s++)n[s]||(e=0|16*Math.random(),n[s]=r[19==s?3&e|8:e])}return n.join("")};class f{__map;__tagList;__eventId="";constructor(){this.__map=new Map,this.__tagList=[],this.__eventId=u()}clear(){return this.__map.clear(),this}on(e,t,r=""){if(!e||!t)return this;let n=this.__map.get(e);return n||(n=new Set,this.__map.set(e,n)),n.add(t),r&&this.__tagList.push({name:e,listener:t,tag:r}),this}emit(e,...t){if(!e)return this;const r=this.__map.get(e);if(!r)return this;return[...r].forEach((e=>e&&e(...t))),this}off(e,t){if(!e||!t)return this;this.__tagList=this.__tagList.filter((r=>r.name!==e||r.listener!==t));const r=this.__map.get(e);return r?(r.delete(t),r.size<=0&&this.__map.delete(e),this):this}remove(e){return e?(this.__tagList=this.__tagList.filter((t=>t.name!==e)),this.__map.delete(e),this):this}removeByTag(e){if(!e)return this;return this.__tagList.filter((t=>t.tag===e)).forEach((e=>{this.off(e.name,e.listener)})),this.__tagList=this.__tagList.filter((t=>t.tag!==e)),this}once(e,t){const r=(...n)=>{t(...n),this.off(e,r)};return this.on(e,r),this}has(e){return this.__map.has(e)}}class h{timestamp=0;_key="";_value;constructor(e,t){this._key=e,this._value=t,this.updateAt()}get key(){return this._key}get value(){return this._value}set(e){this._value=e,this.updateAt()}updateAt(){this.timestamp=Date.now()}clear(){this.set(void 0)}}class d{_map=new Map;constructor(){this._map.clear()}get keys(){return Array.from(this._map.keys())}get values(){return Array.from(this._map.values())}get(e){if(!e)return;const t=this._map.get(e);return t?t.value:void 0}getKV(e){if(e)return this._map.get(e)}set(e,t){if(!e)return;const r=this._map.get(e);r?(r.set(t),this.clean()):this._map.set(e,new h(e,t))}delete(e,t){if(!e)return;const r=this._map.get(e);t&&t(r?.value),this._map.delete(e)}clear(){this._map.clear()}clean(e=100,t){try{if(this._map.size<=e)return;if(this.keys.filter((e=>{if(!this._map.has(e))return!1;const t=this._map.get(e);return!t||!t.value})).forEach((e=>{this._map.delete(e)})),this._map.size<=e)return;const r=this.values.sort(((e,t)=>e.timestamp-t.timestamp)),n=r.length-e;if(n<=0)return;r.splice(0,n).forEach((e=>{this.delete(e.key,t)}))}catch(e){console.log("mapping clean",e)}}}const p="object"==typeof global&&null!==global&&global.Object===Object&&global,g="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,y="object"==typeof self&&null!==self&&self.Object===Object&&self,m=g||p||y||Function("return this")(),b=m.Symbol,{toString:w,hasOwnProperty:_,propertyIsEnumerable:v}=Object.prototype,x=b?b.toStringTag:void 0;function A(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":x&&x in Object(e)?function(e){const t=_.call(e,x),r=e[x];let n=!1;try{e[x]=void 0,n=!0}catch(e){}const s=w.call(e);return n&&(t?e[x]=r:delete e[x]),s}(e):w.call(e)}var S={getTag:A,getType:function(e){return(A(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:w,hasOwnProperty:_,propertyIsEnumerable:v};const k="object"==typeof exports&&null!==exports&&!exports.nodeType&&exports,C=k&&"object"==typeof module&&null!==module&&!module.nodeType&&module,$=C&&C.exports===k&&p.process,j=(()=>{try{const e=C&&C.require&&C.require("util").types;return e||$&&$.binding&&$.binding("util")}catch(e){}})();var O="[object Function]",E="[object GeneratorFunction]",P="[object AsyncFunction]",T=9007199254740991;const q=/^(?:0|[1-9]\d*)$/,B=m?.Buffer?.isBuffer,L=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,R=j&&j.isTypedArray;function F(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function U(e){return null!=e&&"object"==typeof e}const D=Array.isArray;function I(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=T}(e.length)&&!K(e)}function M(e){return U(e)&&I(e)}function K(e){var t=F(e)?S.getTag(e):"";return t===O||t===E||t===P}function z(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function N(e){return M(e)&&S.hasOwnProperty.call(e,"callee")&&(!S.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==S.toString.call(e))}const H="undefined"!=typeof window&&void 0!==window.document,V="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,W=R?e=>R(e):e=>U(e)&&L.test(S.getTag(e)),Z="function"==typeof B?B:()=>!1;var Y={is:function(e,t){return S.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===S.getTag(e)},isString:function(e){return"string"==typeof e||!D(e)&&U(e)&&"[object String]"==S.getTag(e)},isObject:F,isObjectLike:U,isPlainObject:function(e){if(!U(e)||"[object Object]"!=S.getTag(e))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},isSymbol:function(e){return"symbol"==typeof e||U(e)&&"[object Symbol]"===S.getTag(e)},isFunction:K,isArray:D,isArrayLikeObject:M,isIndex:function(e,t){return!!(t=null==t?T:t)&&("number"==typeof e||q.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:I,isPrototype:z,isArguments:N,isPromise:function(e){return"[object Promise]"===(F(e)?S.getTag(e):"")},isBrowser:H,isNode:V,isBlobOrBuffer:e=>e instanceof Blob||e instanceof ArrayBuffer,isUint8Array:e=>e instanceof Uint8Array,isArrayBuffer:e=>e instanceof ArrayBuffer,isEmpty:e=>{if(null==e)return!0;if(I(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||Z(e)||W(e)||N(e)))return!e.length;const t=S.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(z(e))return!Object.keys(e).length;for(const t in e)if(S.hasOwnProperty.call(e,t))return!1;return!0}};const J=NaN,Q=/^\s+|\s+$/g,G=/^[-+]0x[0-9a-f]+$/i,X=/^0b[01]+$/i,ee=/^0o[0-7]+$/i,te=parseInt,re=1/0,ne=17976931348623157e292;function se(e){if("number"==typeof e)return e;if(Y.isSymbol(e))return J;if(Y.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=Y.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Q,"");const t=X.test(e);return t||ee.test(e)?te(e.slice(2),t?2:8):G.test(e)?J:+e}function ie(e){return e?(e=se(e))===re||e===-re?(e<0?-1:1)*ne:e==e?e:0:0===e?e:0}var oe={toNumber:se,toFinite:ie,toInteger:function(e){var t=ie(e),r=t%1;return t==t?r?t-r:t:0}};const ae="Expected a function",ce=Math.max,le=Math.min;function ue(e,t=300,r={}){let n,s,i,o,a,c,l=0,u=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(ae);function d(t){const r=n,i=s;return n=s=void 0,l=t,o=e.apply(i,r),o}function p(e){const r=e-c;return void 0===c||r>=t||r<0||f&&e-l>=i}function g(){const e=Date.now();if(p(e))return y(e);a=setTimeout(g,function(e){const r=t-(e-c);return f?le(r,i-(e-l)):r}(e))}function y(e){return a=void 0,h&&n?d(e):(n=s=void 0,o)}function m(...e){const r=Date.now(),i=p(r);if(n=e,s=this,c=r,i){if(void 0===a)return function(e){return l=e,a=setTimeout(g,t),u?d(e):o}(c);if(f)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=oe.toNumber(t)||0,Y.isObject(r)&&(u=!!r.leading,f="maxWait"in r,i=f?ce(oe.toNumber(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h),m.cancel=function(){void 0!==a&&clearTimeout(a),l=0,n=c=s=a=void 0},m.flush=function(){return void 0===a?o:y(Date.now())},m.pending=function(){return void 0!==a},m}class fe{__list=[];constructor(e){this.push(e)}push(e){return e&&this.__list.push(e),this}clear(){return this.__list=[],this}_exec(e,t){let r;if(Y.isFunction(e))r=e(t);else{if(Y.isPromise(e))return e.then((e=>({...t,...e})));r=e}return Y.isPromise(r)?r:Promise.resolve({...r,...t})}run(e){try{return this.__list.reduce(((e,t)=>e.then((e=>this._exec(t,e)))),Promise.resolve(e)).then((e=>[void 0,e])).catch((e=>[e,void 0]))}catch(e){return Promise.reject([e,void 0])}}}async function he(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const de=(e,t)=>{try{let r;return r=Y.isFunction(e)?e():e,he(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},pe=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var ge={to:he,go:(e,t)=>de(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:de,toError:pe,timeout:(e,t=0,r="timeout")=>{if(t<=0)return de(e);let n;function s(){n&&clearTimeout(n)}const i=new Promise((e=>{s(),n=setTimeout((()=>e([pe(r||"timeout"),void 0])),t)}));return Promise.race([de(e,s),i])}};class ye{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var me={singleton:function(){class e{static __instance__;constructor(){}static get Instance(){return e.__instance__||(e.__instance__=new this),e.__instance__}static get I(){return this.Instance}}return e},getset:function(e){const t=new ye;return void 0!==e&&t.set(e),t}};class be{_func;_callback;constructor(e,t){this._func=e,this._callback=t}async run(){return ge.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class we{__list=[];__count=0;__max=1;constructor(e=1){this.__count=0,this.__max=e>0?e:1,this.clear()}push(e,t){const r=new be(e,t);return this.__list.push(r),this._step(),this}clear(){return this.__list=[],this.__count=0,this}_step(){if(this.__list.length<=0)return;if(this.__count>=this.__max)return;const e=this.__list.shift();e?(this.__count+=1,e?.run().finally((()=>{try{this.__count>0&&(this.__count-=1),this._step()}catch(e){console.error("[ddan] pipepine step finally",e)}}))):this._step()}async whenAll(){for(;;){if(this.__count<=0)break;await ge.delay(100),this._step()}return this.clear()}}class _e extends(me.singleton()){__lockedMap=new Map;pipeline=new we;constructor(){super()}lock(e,t){if(!e||!t)return;const r=ge.safeRun(t);return this.__lockedMap.set(e,r),r}unlock(e){e&&this.__lockedMap.has(e)&&this.__lockedMap.delete(e)}async exec(e,t){if(!e||!t)return ge.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return ge.safeRun(e);const s=await n;return this.unlock(t),s}}var ve={toUtf8:e=>{if(!e)return"";const t=e.replace(/\r\n/g,"\n");let r="";for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r+=String.fromCharCode(n):n>127&&n<2048?(r+=String.fromCharCode(n>>6|192),r+=String.fromCharCode(63&n|128)):(r+=String.fromCharCode(n>>12|224),r+=String.fromCharCode(n>>6&63|128),r+=String.fromCharCode(63&n|128))}return r},fromUtf8:e=>{let t="",r=0;if(!e)return"";let n=0,s=0,i=0;for(;r<e.length;)n=e.charCodeAt(r),n<128?(t+=String.fromCharCode(n),r++):n>191&&n<224?(s=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&s),r+=2):(s=e.charCodeAt(r+1),i=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3);return t},toUtf8Bytes:e=>{if(!e)return new Uint8Array;const t=e.replace(/\r\n/g,"\n"),r=[];for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);n<128?r.push(n):n<2048?(r.push(n>>6|192),r.push(63&n|128)):(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128))}return new Uint8Array(r)},fromUtf8Bytes:e=>{let t="",r=0;if(!e||e.length<=0)return"";for(;r<e.length;){let n=e[r];if(n<128)t+=String.fromCharCode(n),r++;else if(n>191&&n<224){const s=e[r+1];t+=String.fromCharCode((31&n)<<6|63&s),r+=2}else{const s=e[r+1],i=e[r+2];t+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),r+=3}}return t}};const xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Ae={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=ve.toUtf8(e);l<e.length;)t=e.charCodeAt(l++),r=e.charCodeAt(l++),n=e.charCodeAt(l++),s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+xe.charAt(s)+xe.charAt(i)+xe.charAt(o)+xe.charAt(a);return c},fromBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=xe.indexOf(e.charAt(l++)),i=xe.indexOf(e.charAt(l++)),o=xe.indexOf(e.charAt(l++)),a=xe.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c+=String.fromCharCode(t),64!=o&&(c+=String.fromCharCode(r)),64!=a&&(c+=String.fromCharCode(n));return c=ve.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",l=0;if(!e||!Y.isArrayLike(e)||!Y.isUint8Array(e))return"";for(;l<e.length;)t=e[l++],r=e[l++],n=e[l++],s=t>>2,i=(3&t)<<4|r>>4,o=(15&r)<<2|n>>6,a=63&n,isNaN(r)?o=a=64:isNaN(n)&&(a=64),c=c+xe.charAt(s)+xe.charAt(i)+xe.charAt(o)+xe.charAt(a);return c},base64ToBytes:(e="")=>{let t,r,n,s,i,o,a,c=[],l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");l<e.length;)s=xe.indexOf(e.charAt(l++)),i=xe.indexOf(e.charAt(l++)),o=xe.indexOf(e.charAt(l++)),a=xe.indexOf(e.charAt(l++)),t=s<<2|i>>4,r=(15&i)<<4|o>>2,n=(3&o)<<6|a,c.push(t),64!=o&&c.push(r),64!=a&&c.push(n);return new Uint8Array(c)}};function Se(e){return Math.floor(Math.random()*e)}function ke(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Ce=180/Math.PI;var $e={random:Se,randomRange:function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},lerp:function(e,t,r){return e*(1-r)+t*r},randoms:function(e,t=1,r=!1){const n=[];for(;;){if(n.length>=t)break;if(!r&&n.length>=e)break;const s=Se(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:ke,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=ke(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Ce},degree2radian:function(e){return e/Ce},calcDataSize:function(e){const t={gb:0,mb:0,kb:0,b:0,total:e,desc:""},r=[{name:"gb",divisor:1<<30},{name:"mb",divisor:1<<20},{name:"kb",divisor:1024},{name:"b",divisor:1}];for(const n of r){const r=Math.floor(e/n.divisor);t[n.name]=r,e-=r*n.divisor}return t.gb>0?t.desc=(t.gb+t.mb/1024).toFixed(2)+"GB":t.mb>0?t.desc=(t.mb+t.kb/1024).toFixed(2)+"MB":t.kb>0?t.desc=(t.kb+t.b/1024).toFixed(2)+"KB":t.desc=t.b+"B",t}};var je={bytes2str:e=>{if(!e||!Y.isArrayLike(e))return"";return e.reduce(((e,t)=>e+String.fromCharCode(t)),"")},str2bytes:(e="")=>{const t=e,r=new Uint8Array(t.length);for(let e=0,n=t.length;e<n;e++)r[e]=t.charCodeAt(e);return r},str2hex:e=>{let t="";for(let r=0;r<e.length;r++)t+=e.charCodeAt(r).toString(16).padStart(2,"0");return t},hex2str:e=>{let t="";for(let r=0;r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},concatBytes:(...e)=>{const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r},uint32ToBytes:e=>{const t=new Uint8Array(8);return t[0]=e[0]>>>24&255,t[1]=e[0]>>>16&255,t[2]=e[0]>>>8&255,t[3]=255&e[0],t[4]=e[1]>>>24&255,t[5]=e[1]>>>16&255,t[6]=e[1]>>>8&255,t[7]=255&e[1],t},bytesToUint32:e=>{const t=new Uint32Array(2);return t[0]=e[0]<<24|e[1]<<16|e[2]<<8|e[3],t[1]=e[4]<<24|e[5]<<16|e[6]<<8|e[7],t},hex2bytes:e=>{let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++)t[r]=parseInt(e.substr(2*r,2),16);return t},bytes2hex:e=>Array.from(e).map((e=>e.toString(16).padStart(2,"0"))).join(""),toUint32:e=>{const t=Math.ceil(e.length/4),r=new Uint32Array(t);for(let n=0;n<t;n++)r[n]=e.charCodeAt(4*n)<<24|e.charCodeAt(4*n+1)<<16|e.charCodeAt(4*n+2)<<8|e.charCodeAt(4*n+3);return r},fromUint32:e=>{let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]>>>24&255,e[r]>>>16&255,e[r]>>>8&255,255&e[r]);return t.replace(/\0+$/,"")},flatten:function e(t,r=!1,n=[]){for(let s=0;s<t.length;s+=1){const i=t[s];r&&Array.isArray(i)?e(i,r,n):n.push(i)}return n}};var Oe={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return je.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};function Ee(e,t){return e<<t|e>>>32-t}function Pe(e,t){let r,n,s,i,o;return s=2147483648&e,i=2147483648&t,r=1073741824&e,n=1073741824&t,o=(1073741823&e)+(1073741823&t),r&n?2147483648^o^s^i:r|n?1073741824&o?3221225472^o^s^i:1073741824^o^s^i:o^s^i}function Te(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return e&t|~e&r}(t,r,n),s),o)),Pe(Ee(e,i),t)}function qe(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return e&r|t&~r}(t,r,n),s),o)),Pe(Ee(e,i),t)}function Be(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return e^t^r}(t,r,n),s),o)),Pe(Ee(e,i),t)}function Le(e,t,r,n,s,i,o){return e=Pe(e,Pe(Pe(function(e,t,r){return t^(e|~r)}(t,r,n),s),o)),Pe(Ee(e,i),t)}function Re(e){let t,r,n="",s="";for(r=0;r<=3;r++)t=e>>>8*r&255,s="0"+t.toString(16),n+=s.substr(s.length-2,2);return n}function Fe(e){let t,r,n,s,i,o,a,c,l,u=[];for(u=function(e){let t;const r=e.length,n=r+8,s=16*((n-n%64)/64+1),i=Array(s-1).fill(0);let o=0,a=0;for(;a<r;)t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|e[a]<<o,a++;return t=(a-a%4)/4,o=a%4*8,i[t]=i[t]|128<<o,i[s-2]=r<<3,i[s-1]=r>>>29,i}(e),o=1732584193,a=4023233417,c=2562383102,l=271733878,t=0;t<u.length;t+=16)r=o,n=a,s=c,i=l,o=Te(o,a,c,l,u[t+0],7,3614090360),l=Te(l,o,a,c,u[t+1],12,3905402710),c=Te(c,l,o,a,u[t+2],17,606105819),a=Te(a,c,l,o,u[t+3],22,3250441966),o=Te(o,a,c,l,u[t+4],7,4118548399),l=Te(l,o,a,c,u[t+5],12,1200080426),c=Te(c,l,o,a,u[t+6],17,2821735955),a=Te(a,c,l,o,u[t+7],22,4249261313),o=Te(o,a,c,l,u[t+8],7,1770035416),l=Te(l,o,a,c,u[t+9],12,2336552879),c=Te(c,l,o,a,u[t+10],17,4294925233),a=Te(a,c,l,o,u[t+11],22,2304563134),o=Te(o,a,c,l,u[t+12],7,1804603682),l=Te(l,o,a,c,u[t+13],12,4254626195),c=Te(c,l,o,a,u[t+14],17,2792965006),a=Te(a,c,l,o,u[t+15],22,1236535329),o=qe(o,a,c,l,u[t+1],5,4129170786),l=qe(l,o,a,c,u[t+6],9,3225465664),c=qe(c,l,o,a,u[t+11],14,643717713),a=qe(a,c,l,o,u[t+0],20,3921069994),o=qe(o,a,c,l,u[t+5],5,3593408605),l=qe(l,o,a,c,u[t+10],9,38016083),c=qe(c,l,o,a,u[t+15],14,3634488961),a=qe(a,c,l,o,u[t+4],20,3889429448),o=qe(o,a,c,l,u[t+9],5,568446438),l=qe(l,o,a,c,u[t+14],9,3275163606),c=qe(c,l,o,a,u[t+3],14,4107603335),a=qe(a,c,l,o,u[t+8],20,1163531501),o=qe(o,a,c,l,u[t+13],5,2850285829),l=qe(l,o,a,c,u[t+2],9,4243563512),c=qe(c,l,o,a,u[t+7],14,1735328473),a=qe(a,c,l,o,u[t+12],20,2368359562),o=Be(o,a,c,l,u[t+5],4,4294588738),l=Be(l,o,a,c,u[t+8],11,2272392833),c=Be(c,l,o,a,u[t+11],16,1839030562),a=Be(a,c,l,o,u[t+14],23,4259657740),o=Be(o,a,c,l,u[t+1],4,2763975236),l=Be(l,o,a,c,u[t+4],11,1272893353),c=Be(c,l,o,a,u[t+7],16,4139469664),a=Be(a,c,l,o,u[t+10],23,3200236656),o=Be(o,a,c,l,u[t+13],4,681279174),l=Be(l,o,a,c,u[t+0],11,3936430074),c=Be(c,l,o,a,u[t+3],16,3572445317),a=Be(a,c,l,o,u[t+6],23,76029189),o=Be(o,a,c,l,u[t+9],4,3654602809),l=Be(l,o,a,c,u[t+12],11,3873151461),c=Be(c,l,o,a,u[t+15],16,530742520),a=Be(a,c,l,o,u[t+2],23,3299628645),o=Le(o,a,c,l,u[t+0],6,4096336452),l=Le(l,o,a,c,u[t+7],10,1126891415),c=Le(c,l,o,a,u[t+14],15,2878612391),a=Le(a,c,l,o,u[t+5],21,4237533241),o=Le(o,a,c,l,u[t+12],6,1700485571),l=Le(l,o,a,c,u[t+3],10,2399980690),c=Le(c,l,o,a,u[t+10],15,4293915773),a=Le(a,c,l,o,u[t+1],21,2240044497),o=Le(o,a,c,l,u[t+8],6,1873313359),l=Le(l,o,a,c,u[t+15],10,4264355552),c=Le(c,l,o,a,u[t+6],15,2734768916),a=Le(a,c,l,o,u[t+13],21,1309151649),o=Le(o,a,c,l,u[t+4],6,4149444226),l=Le(l,o,a,c,u[t+11],10,3174756917),c=Le(c,l,o,a,u[t+2],15,718787259),a=Le(a,c,l,o,u[t+9],21,3951481745),o=Pe(o,r),a=Pe(a,n),c=Pe(c,s),l=Pe(l,i);return Re(o)+Re(a)+Re(c)+Re(l)}const Ue=e=>{if("string"!=typeof e&&!(e instanceof Uint8Array))return"";return Fe("string"==typeof e?ve.toUtf8Bytes(e):e)};var De={md5:Ue,md5Base64:e=>{const t=Ue(e);if(!t)return"";const r=je.hex2bytes(t);return Ae.bytesToBase64(r)}};const Ie=(e,t=!1)=>{const r=new Uint8Array(e);return t?Ae.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Me={...je,...Oe,...ve,...Ae,...De,str2ab:(e="",t=!1)=>{if(t)return Ae.base64ToBytes(e).buffer;{const t=new ArrayBuffer(e.length),r=new Uint8Array(t);for(let t=0,n=e.length;t<n;t++)r[t]=e.charCodeAt(t);return t}},ab2str:Ie,utf8ToBase64:e=>Y.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>Y.isBrowser?atob(e):Buffer.from(e,"base64").toString("utf-8"),getRandomBytes:e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=$e.random(256);return t},textEncode:e=>ve.toUtf8Bytes(e),textDecode:e=>ve.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+Ae.toBase64(e):Y.isArrayBuffer(e)?`data:${t};base64,`+Ie(e,!0):"":""};const Ke=e=>{try{const t=Me.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},ze=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Ne={RSAPublicKey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApiLWsPmoaiGdr02AmPYS\n4/VgxyJNNJSK2VICirXl4P8qAP3b/6GIs7Hwnsmmuj7gledJ0XiZodFjDNgQEZEG\nj4K9KX8NixcrJwnTQV5UebiERdj+64ihwqPVWo9dIOj43ZPJ8f4dritJv5tnQaBb\nb9zTkU3Ofzk1g8RU00Ith6quOGZcU2IWC4OQ+5YiZvzrCBKEvjFwK2OvGq43tI51\nGaZdI9H09jisypqefsMvv6esjEQQOtl+WGlI5fof7KZUt3dppvuDI4CYgeXIoKKL\n9T9qDl8F9aNSs3XHx32YyA7L1FraFD6PjqRjueIFp2emsXQcIMeMqqgVyV+4qb+0\nuwIDAQAB",RSAPrivateKey:"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmItaw+ahqIZ2v\nTYCY9hLj9WDHIk00lIrZUgKKteXg/yoA/dv/oYizsfCeyaa6PuCV50nReJmh0WMM\n2BARkQaPgr0pfw2LFysnCdNBXlR5uIRF2P7riKHCo9Vaj10g6Pjdk8nx/h2uK0m/\nm2dBoFtv3NORTc5/OTWDxFTTQi2Hqq44ZlxTYhYLg5D7liJm/OsIEoS+MXArY68a\nrje0jnUZpl0j0fT2OKzKmp5+wy+/p6yMRBA62X5YaUjl+h/splS3d2mm+4MjgJiB\n5cigoov1P2oOXwX1o1KzdcfHfZjIDsvUWtoUPo+OpGO54gWnZ6axdBwgx4yqqBXJ\nX7ipv7S7AgMBAAECggEAE1kuWLkSsJ2OoDpt9iJ+a7cJmNd5V1zPWOTwr9fkWFJP\nQYNPKlPVOFxKUivY84rcHAkuMyuQ9OQOXZISOQGDWpZW0mzeFmtR1r+Rr2S9gNmI\n6huOAL9OW306HUxiA7GuPhv2omy+Zyjac2q1WVLEI2B78Um2+WEfxuNIH7xu0gRR\nz/wluevMBQlv6hSeMESP6e9s2kB+FuM4bL7+1sexwS1TudKbHybujaiB8un9E2V3\nC9BkE6yf00Rhvii6Q4E4w3PFQfcBEFnjOD0S2Watx8GIbYjlYvtquy8Yj7OtyZB6\nw5sxyaYhKVVnkpGAbOgaCj94ABYF47VuwXr45I4PzQKBgQDp6svzD+QKlARjcWgO\nrH7UEpFX6m49G6Ib4c63xEg9+GesTgfDxoYxtXDKsC7I8OwMrmffJGbyfjaAvzmg\nicM3Y7kF6UPO9+q2mBRsyhoJSNONTeUVyoFSc+QDsVgndlTZIjqC5XLrONGaSPLJ\n7jJzqKhp3NQcpO8+xY0d7Efm1QKBgQC10fCNuF1LUTYgsWvvGxTiCCAIBurZmHU+\nGMb2Okfoco/P+QNl1jEba91AC7FudW3g/lRn0vTnDajlNoz2/CKunrTKN4/9lEBI\ntiwEOvhc5FtapRifSfrrNwFqPM+LijvOkcteWVhAUWCEP1eLmpnXGqfmZxnTaaVe\n5DyDgyAVTwKBgQDhEawfOQEANJ9sV2f6BnsZ7quuXcCoR3hZP5G5O8EO735BSesq\nsk/YcG4QeCjr6vQU15LWH552YH5srpHyJ9uP5gHW8DTwZZaPDhFJA8S9fjcfVP3B\nU9HO1fdknjTl83N8YPTPkZpbPZZfzyTcqrYclwFEqtfkn8YbLdW0Hu6n6QKBgDEv\njvS3uD1ExfDILlurptWSvx+Mx4F/1c+roj8/+u3t9+uaAIpPDE/PuTW3NBOens/r\n3WeM0QWkU1lWjYHPKY61jlDaARDnRxCkf3nRfhibCf+Wg/erar6wzagwtTCZf55d\nIHfwkYgsu4BrJkK02wMuydbxczIW9U6bTaeCFG7PAoGAN3oHYzTEBwZ7ZKv11QiQ\nEp/HeHBvD8fH/e1uVyBel4Co7NO5pV2s8qjS8+3+jxumKLNXCirjqwHo03YCdzxi\ncy4GFDsukHmDQ7FF9VC4QV0fJ0F7jGYE9nNZ+K9qwS5KrihOSBPxj0HptrF6TSOw\nBTSwr0byL3TC0m0StkSNKpo=",generateKeys:async e=>{try{const t=await e.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:"SHA-256"},!0,["encrypt","decrypt"]),r=await window.crypto.subtle.exportKey("spki",t.publicKey),n=Ke(r),s=ze(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=Ke(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:ze(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:ze,format_pem_content:Ke,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Me.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),i=[];for(let t=0;t<n.length;t+=190){let r=n.slice(t,t+190),o=await e.encrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(o))}const o=Me.concatBytes(...i);return Me.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Me.base64ToBytes(t),s=await e.importKey("pkcs8",Me.str2ab(r,!0),{name:"RSA-OAEP",hash:"SHA-256"},!0,["decrypt"]),i=[],o=256;for(let t=0;t<n.length;t+=o){let r=n.slice(t,t+o),a=await e.decrypt({name:"RSA-OAEP"},s,r);i.push(new Uint8Array(a))}const a=Me.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const He=()=>e.webcrypto.subtle;var Ve={generateKeys:()=>Ne.generateKeys(He()),encrypt:async(e,t)=>Ne.encrypt(He(),e,t),decrypt:async(e,t)=>Ne.decrypt(He(),e,t),encode:async e=>Ne.encrypt(He(),e,Ne.RSAPublicKey),decode:async e=>Ne.decrypt(He(),e,Ne.RSAPrivateKey)};const We="undefined"!=typeof window?window.crypto.subtle:{};var Ze={generateKeys:()=>Ne.generateKeys(We),encrypt:async(e,t)=>Ne.encrypt(We,e,t),decrypt:async(e,t)=>Ne.decrypt(We,e,t),encode:async e=>Ne.encrypt(We,e,Ne.RSAPublicKey),decode:async e=>Ne.decrypt(We,e,Ne.RSAPrivateKey)};const Ye=2654435769,Je=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+Ye>>>0,e[0]=e[0]+((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,e[1]=e[1]+((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0;return e},Qe=(e,t)=>{let r=3337565984;for(let n=0;n<32;n++)e[1]=e[1]-((e[0]<<4)+t[2]^e[0]+r^(e[0]>>>5)+t[3])>>>0,e[0]=e[0]-((e[1]<<4)+t[0]^e[1]+r^(e[1]>>>5)+t[1])>>>0,r=r-Ye>>>0;return e},Ge=e=>{const t=Me.str2bytes(e),r=new Uint32Array(4);return r[0]=t[0]<<24|t[1]<<16|t[2]<<8|t[3],r[1]=t[4]<<24|t[5]<<16|t[6]<<8|t[7],r[2]=t[8]<<24|t[9]<<16|t[10]<<8|t[11],r[3]=t[12]<<24|t[13]<<16|t[14]<<8|t[15],r},Xe=(e,t)=>{const r=Me.pkcs7Padding(e,8),n=Ge(t),s=[];for(let e=0;e<r.length;e+=8){const t=Me.bytesToUint32(r.slice(e,e+8)),i=Je(t,n);s.push(Me.uint32ToBytes(i))}return Me.concatBytes(...s)},et=(e,t)=>{const r=Ge(t),n=[];for(let t=0;t<e.length;t+=8){const s=Me.bytesToUint32(e.slice(t,t+8)),i=Qe(s,r);n.push(Me.uint32ToBytes(i))}const s=Me.concatBytes(...n);return Me.pkcs7Unpadding(s)};var tt={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:Je,decrypt:Qe,toTeaKey:Ge,encode:(e,t)=>{const r=Me.textEncode(e),n=Xe(r,t);return Me.bytesToBase64(n)},decode:(e,t)=>{const r=Me.base64ToBytes(e),n=et(r,t);return Me.textDecode(n.buffer)},encodeBytes:Xe,decodeBytes:et};function rt(e,t,r){const{length:n}=e;return r=void 0===r?n:r,!t&&r>=n?e:function(e,t,r){let n=null==e?0:e.length;if(!n)return[];(t=null==t?0:t)<0&&(t=-t>n?0:n+t),(r=(r=void 0===r?n:r)>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;let s=-1;const i=new Array(n);for(;++s<n;)i[s]=e[s+t];return i}(e,t,r)}const nt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function st(e){return nt.test(e)}const it="\\ud800-\\udfff",ot=`[${it}]`,at="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",ct="\\ud83c[\\udffb-\\udfff]",lt=`[^${it}]`,ut="(?:\\ud83c[\\udde6-\\uddff]){2}",ft="[\\ud800-\\udbff][\\udc00-\\udfff]",ht=`${`(?:${at}|${ct})`}?`,dt="[\\ufe0e\\ufe0f]?",pt=dt+ht+`(?:\\u200d(?:${[lt,ut,ft].join("|")})${dt+ht})*`,gt=`(?:${[`${lt}${at}?`,at,ut,ft,ot].join("|")})`,yt=RegExp(`${ct}(?=${ct})|${gt+pt}`,"g");function mt(e){return st(e)?function(e){return e.match(yt)||[]}(e):function(e){return e.split("")}(e)}function bt(e){return t=>{if(!t)return"";const r=st(t)?mt(t):void 0,n=r?r[0]:t[0],s=r?rt(r,1).join(""):t.slice(1);return n[e]()+s}}const wt="\\ud800-\\udfff",_t="\\u2700-\\u27bf",vt="a-z\\xdf-\\xf6\\xf8-\\xff",xt="A-Z\\xc0-\\xd6\\xd8-\\xde",At="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",St="['’]",kt=`[${At}]`,Ct=`[${_t}]`,$t=`[${vt}]`,jt=`[^${wt}${At+"\\d"+_t+vt+xt}]`,Ot="(?:\\ud83c[\\udde6-\\uddff]){2}",Et="[\\ud800-\\udbff][\\udc00-\\udfff]",Pt=`[${xt}]`,Tt=`(?:${$t}|${jt})`,qt=`(?:${Pt}|${jt})`,Bt=`(?:${St}(?:d|ll|m|re|s|t|ve))?`,Lt=`(?:${St}(?:D|LL|M|RE|S|T|VE))?`,Rt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Ft="[\\ufe0e\\ufe0f]?",Ut=Ft+Rt+`(?:\\u200d(?:${[`[^${wt}]`,Ot,Et].join("|")})${Ft+Rt})*`,Dt=`(?:${[Ct,Ot,Et].join("|")})${Ut}`,It=RegExp([`${Pt}?${$t}+${Bt}(?=${[kt,Pt,"$"].join("|")})`,`${qt}+${Lt}(?=${[kt,Pt+Tt,"$"].join("|")})`,`${Pt}?${Tt}+${Bt}`,`${Pt}+${Lt}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Dt].join("|"),"g");const Mt=RegExp.prototype.test.bind(/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/),Kt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function zt(e,t){if(void 0===t){const t=Mt(e)?function(e){return e.match(It)}(e):function(e){return e.match(Kt)}(e);return t||[]}return e.match(t)||[]}function Nt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Nt(e)))}`;if(Y.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Ht=bt("toUpperCase"),Vt=bt("toLowerCase");var Wt={toString:Nt,startCase:e=>zt(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Ht(t)),""),snakeCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Ht(t):t))),""),upperCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Ht,lowerCase:e=>zt(Nt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Vt,splitOnFirst:(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===e||""===t)return[];const r=e.indexOf(t);return-1===r?[]:[e.slice(0,r),e.slice(r+t.length)]},parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{let n=e;return e&&"string"==typeof e?(t&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?n=Number(e):!r||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(n="true"===e.toLowerCase()),n):n},replace:(e,t)=>{if(!e)return e;if(!t)return e;let r=e;return((Array.isArray(t)?t:[t])||[]).forEach((e=>{e.key&&e.value&&(r=r.replace(new RegExp(e.key,e.flag||""),e.value))})),r},jsonFormat:e=>{try{if(!e)return"";const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch(t){return e}},toLines:(e,t="\n")=>e?e.split(t).map((e=>e.trim())).filter((e=>!!e)):[]};var Zt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":tt.encode(t,Me.hex2str(tt.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=tt.decode(e,Me.hex2str(tt.TEAKey));return Wt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return Y.isBrowser?await Ze.encode(t):await Ve.encode(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=Y.isBrowser?await Ze.decode(e):await Ve.decode(e);return Wt.jsonFormat(t)}catch(e){return""}}};const Yt=(e,t,r)=>e*(1-r)+t*r,Jt=(e,t,r)=>e===t?0:(r-e)/(t-e),Qt=(e,t,r)=>({x:Yt(e.x,t.x,r),y:Yt(e.y,t.y,r)}),Gt=(e,t,r,n)=>{const s=Qt(e,t,n),i=Qt(t,r,n);return Qt(s,i,n)},Xt=(e,t)=>{if(1===e.length)return e[0];const r=[];for(let n=0;n<e.length-1;n++)r.push({x:(1-t)*e[n].x+t*e[n+1].x,y:(1-t)*e[n].y+t*e[n+1].y});return Xt(r,t)},er=(e,t)=>{if(0===t||t===e)return 1;let r=1;for(let n=1;n<=t;n++)r=r*(e-n+1)/n;return r};var tr={bezier1:Qt,bezier2:Gt,bezier3:(e,t,r,n,s)=>{const i=Gt(e,t,r,s),o=Gt(t,r,n,s);return Qt(i,o,s)},bezier:Xt,bezierCurve:(e,t)=>{const r=e.length-1;let n=0,s=0;for(let i=0;i<=r;i++){const o=er(r,i)*Math.pow(1-t,r-i)*Math.pow(t,i);n+=o*e[i].x,s+=o*e[i].y}return{x:n,y:s}},lerp:Yt,lerpAverage:(e,t,r="")=>{if(e.length<=0)return 0;if(1===e.length)return e[0].x;if(2===e.length)return Yt(e[0].y,e[1].y,.5);const n=[],s=e.slice().sort(((e,t)=>e.x-t.x)),i=s.length,o=s[0].x,a=s[i-1].x;for(let e=o;e<=a;e+=t){let t=0;for(let n=0;n<i-1;n++){const i=s[n],o=s[n+1];if(e>=i.x&&e<=o.x){if("lerp"===r){const r=Jt(i.x,o.x,e);t=Qt(i,o,r).y}else t=i.y;break}}e>s[i-1].x&&(t=s[i-1].y),n.push(t)}return n.reduce(((e,t)=>e+t),0)/n.length},proportion:Jt};var rr={...ge,...Zt,...tr,sleep:ge.delay,run:async function(e,t=0){if(t<=0)return ge.safeRun(e);const r=t>0?Date.now():0,n=await ge.safeRun(e),s=Date.now()-r;return s<t&&await ge.delay(t-s),n},exec:(e,t="")=>_e.I.exec(e,t),debounce:ue,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return Y.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),ue(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new fe(e),mutex:function(e){var t=null;return async function(...r){if((t=this||t||{}).__ddMutex)return!1;t.__ddMutex=!0;try{e&&await Promise.resolve(e.apply(this,r))}catch(e){console.log(e)}finally{t.__ddMutex=!1}}},polling:async function(e={}){const{func:t,interval:r=100,times:n=1e3}=e;let s=n;const i=r<1?100:r;do{if(!t)break;const[e,r]=await ge.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await ge.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>_e.I.pipeline.push(e,t),pipeline:(e=1)=>new we(e),safeTask:(e,t)=>new be(e,t)};const nr=e=>{if(!e)return e;if("object"!=typeof e)return e;const t=Array.isArray(e)?[]:{};for(const r in e)e.hasOwnProperty(r)&&(t[r]=nr(e[r]));return t};const sr=(e,t,r={})=>{const n=e||{},{ignoreUndefined:s=!0,cover:i=!1}=r;if(!t)return n;for(const o in t){if(!t.hasOwnProperty(o))continue;const a=t[o];"object"!=typeof a||"object"!=typeof e[o]||i?s&&void 0===a||r.ignoreNull&&null===a||r.ignoreZero&&0===a||r.ignoreEmptyArray&&Array.isArray(a)&&a.length<=0||r.ignoreEmptyString&&"string"==typeof a&&""===a.trim()||(n[o]=a):n[o]=ir(e[o],a,r)}return n},ir=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?sr(e,t,r):sr({...e},t,r),n},or=(e,t,r={})=>sr({...e},t,{cover:!0,...r}),ar=(e,t,r,n,s=!1)=>{if(!e||!t||!r)return;let i=e[t];null!==i&&"object"==typeof i&&s&&Object.keys(i).forEach((e=>{ar(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&ar(e,t,r,n,s)},get:()=>i})};var cr={copy:(e,t={})=>{if(void 0===e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0}=t;if((!n||n.length<=0)&&!s)return r;const o={};for(const e in r){if(!r.hasOwnProperty(e))continue;const a=s?i&&e.startsWith("_")?e:Wt.camelCase(e):e;if(n.length>0&&!n.includes(e)&&!n.includes(a))continue;const c=r[e];t.ignoreNull&&null===c||(t.ignoreZero&&0===c||t.ignoreEmptyArray&&Array.isArray(c)&&c.length<=0||t.ignoreEmptyString&&"string"==typeof c&&""===c.trim()||(o[a]=c))}return o},clone:nr,merge:ir,isEmpty:e=>0!==e&&(!e||"object"==typeof e&&(Array.isArray(e)?!e.length:Object.keys(e).length<=0)),parseValue:(e,{number:t=!1,boolean:r=!1}={})=>{if(!e&&"object"!=typeof e)return e;for(const[n,s]of Object.entries(e))if("object"==typeof s&&null!==s)for(const[e,n]of Object.entries(s))s[e]=Wt.parseValue(n,{number:t,boolean:r});else e[n]=Wt.parseValue(s,{number:t,boolean:r});return e},cloneClass:function(e){return e?"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e)):e},combine:or,combines:(e,t={})=>{let r={};if(!e||e.length<=0)return r;const{ignoreUndefined:n=!0,ignoreNull:s=!0,ignoreZero:i=!0,ignoreEmptyArray:o=!0,ignoreEmptyString:a=!0,cover:c=!0}=t;return e.forEach((e=>r=or(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:ar,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};const lr=function(e,{sep:t="&",eq:r="=",max:n=1e3,multiple:s=!0,uri:i=!0,parseNumber:o=!1,parseBoolean:a=!1}={}){t=t||"&",r=r||"=";const c={};if("string"!=typeof e||0===e.length)return c;const l=/\+/g,u=n||1e3;let f=(e=e.split(t)).length;u>0&&f>u&&(f=u);for(let t=0;t<f;++t){let n,o,a,u,f=e[t].replace(l,"%20"),h=f.indexOf(r);h>=0?(n=f.substr(0,h),o=f.substr(h+1)):(n=f,o=""),a=i?decodeURIComponent(n):n,u=i?decodeURIComponent(o):o,S.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(u):c[a]=[c[a],u]:c[a]=u}return cr.parseValue(c,{number:o,boolean:a}),c},ur=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},fr=function(e,t=!0){return t?encodeURIComponent(e):e},hr=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},dr=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,pr=e=>{const t=(e||"").replace(/\\/g,"/").split("?")[0],r=t.match(/[\/]?([\w\_\-]+)[.]?[\w]*[?]?$/),n=r?r[1]:"",s=t.lastIndexOf("/")+1,i=t.substring(s),o=i.lastIndexOf("."),a=i.substring(0,o)||"",c=o>=0?i.substring(o):"";return{route:t.substring(0,s)||"",page:n,name:i,withoutExtension:a,extname:c}},gr=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(dr);if(!r||r.length<4)return t;const n=r[3]||"",s=e.split("?");return t.url=s[0],t.origin=r[0],t.protocol=`${r[1]}:`,t.host=`${r[2]}${n?":"+n:""}`,t.port=n,t.query=s.length>1?s[1]:"",t},yr=(e,t)=>{if(e===t)return!0;if(!e)return!1;if(!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var mr={parse:lr,stringify:function(e,{sep:t="&",eq:r="=",name:n=null,uri:s=!0,cleanZero:i=!1,cleanNull:o=!1,cleanWhitespace:a=!1}={}){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map((function(n){const c=fr(ur(n),s)+r,l=e[n];return Array.isArray(l)?l.map((function(e){return c+fr(ur(e),s)})).join(t):hr(l,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+fr(ur(l),s)})).filter(Boolean).join(t):n?fr(ur(n),s)+r+fr(ur(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=gr(e),{origin:r="",url:n="",query:s=""}=t,i=pr(n),o=lr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:pr,parseHost:gr,join:(...e)=>{const t=[];let r=!1;return e.forEach((e=>{const n=e.trim();if(""===n)return;if(/^(\w+):\/\//.test(n))return t.length=0,t.push(n),void(r=!0);n.split("/").forEach((e=>{"."!==e&&""!==e&&(".."===e?t.length>0&&".."!==t[t.length-1]?t.pop():r||t.push(".."):t.push(e))}))})),t.join("/")},shExpMatch:yr,isLocalIpAddress:e=>!!e&&!!(yr(e,"127.0.0.1")||yr(e,"localhost")||yr(e,"192.168.*.*")),parseFileUrl:e=>{const t={href:e,file:"",url:"",protocol:"",host:"",query:"",params:{}};if(!e)return t;let r=e?e.replace(/\\/g,"/"):"";r.startsWith("file://")&&!r.startsWith("file:///")?r="file:///"+r.slice(7):r.startsWith("file:/")&&!r.startsWith("file:///")&&(r="file:///"+r.slice(6));const n=r.match(/^file:\/\/(?:([^\/\\]+))?(\/.*)?$/);if(!n||n.length<3)return t;t.protocol="file:";const s=n[1]||"",i=n[2]||"";t.host=s;const o=i.split("?");return t.url=t.protocol+`//${t.host}`+o[0],t.file=o[0],t.query=o.length>1?o[1]:"",t.params=lr(t.query,{multiple:!0,uri:!1}),t}};class br{_loopTimer;_event=new f;started=!1;interval=0;constructor(e=0){this.interval=e||500}start(){return this.started||(this.stop(),this._loopTimer=setInterval((()=>{this._handleLoop()}),this.interval),this.started=!0),this}stop(){return this._loopTimer?(clearInterval(this._loopTimer),this._loopTimer=0,this.started=!1,this):this}restart(){return this.stop(),this.start(),this}on(e){return this._event.on("frame",e),this}off(e){return e?(this._event.off("frame",e),this):this}_handleLoop(){this._event.emit("frame")}}var wr={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class _r{date;timestamp=0;yyyy=0;yy="";M=0;MM="";d=0;dd="";h=0;hh="";m=0;mm="";s=0;ss="";S=0;SS="";SSS="";constructor(e){if(!e)return;const t="string"==typeof e||"number"==typeof e?new Date(e):e;t&&(this.date=t,this.timestamp=t.getTime(),this.toDate())}toDate(){return this.date?(this.yyyy=this.date.getFullYear(),this.yy=`${this.yyyy}`.substr(2),this.M=this.date.getMonth()+1,this.MM=(this.M<10?"0":"")+this.M,this.d=this.date.getDate(),this.dd=(this.d<10?"0":"")+this.d,this.h=this.date.getHours(),this.hh=(this.h<10?"0":"")+this.h,this.m=this.date.getMinutes(),this.mm=(this.m<10?"0":"")+this.m,this.s=this.date.getSeconds(),this.ss=(this.s<10?"0":"")+this.s,this.S=this.date.getMilliseconds(),this.SS=(this.S<10?"0":"")+this.S,this.SSS=this.S.toString().padStart(3,"0"),this):this}toCountdown(e=""){const t={countdown:0,timestamp:0,seconds:0,d:0,dd:"",h:0,hh:"",m:0,mm:"",s:0,ss:"",S:0,SS:"",SSS:"",desc:""};if(!this.timestamp)return t;t.timestamp=this.timestamp,t.countdown=Math.max(t.timestamp-Date.now(),0),t.seconds=Math.floor(t.countdown/wr.oneSecond);let r=t.countdown;t.d=Math.floor(r/wr.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=wr.oneDay,t.h=Math.floor(r/wr.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=wr.oneHour,t.m=Math.floor(r/wr.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=wr.oneMinute,t.s=Math.floor(r/wr.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=wr.oneSecond,t.S=r,t.SS=(t.S<10?"0":"")+t.S,t.SSS=t.S.toString().padStart(3,"0");let n=e;return n||(n=t.countdown>wr.oneHour?"hh:mm:ss":t.countdown>wr.oneMinute?"mm:ss":"ss"),t.desc=n.replace(/\bdd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>t[e])),t}add(e=0){return e?(this.timestamp=this.timestamp+e,this.date=new Date(this.timestamp),this.toDate(),this):this}format(e="yyyy-MM-dd hh:mm:ss"){return e.replace(/\byyyy|yy|MM|M|dd|d|hh|h|mm|m|ss|s|SSS|SS|S\b/g,(e=>this[e]))}static get timezoneOffset(){return(new Date).getTimezoneOffset()/60}static getLocalTime(e=0){const t=new Date,r=t.getTime(),n=6e4*t.getTimezoneOffset();return new Date(r+n+36e5*e)}}const vr=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?xr(r).format(t):""},xr=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new _r(t||0)};function Ar({year:e=0,month:t=0,date:r=0,hour:n=0,minute:s=0,second:i=0}){const o=`${e||"yyyy"}/${t||"MM"}/${r||"dd"} ${n}:${s}:${i}`;return new Date(vr(Date.now(),o)).getTime()}var Sr={...wr,now:function(){return xr(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:Ar,todayZero:()=>Ar({}),format:vr,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return xr(r).toCountdown(t)},dtime:xr,loopFrame:(e=500)=>new br(e),getTimezoneOffset:()=>_r.timezoneOffset,getLocalTime:_r.getLocalTime};const kr=e=>Ae.toBase64(e);var Cr={encode:kr,decode:e=>Ae.fromBase64(e),encodeByOss:e=>kr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var $r={...l,base64:Cr,tea:tt,uuid:u,guid:(e,t=!1,r="")=>{const n=u(e||32);return t?Sr.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=l.keyChars;let r="";const n=t.length;for(let s=0;s<e;s++)r+=t.charAt(Math.floor(Math.random()*n));return r}};const jr=(e,t,r=8)=>{if(e===t)return!0;if(null==e||null==t||"object"!=typeof e||"object"!=typeof t)return!1;if(r<=0)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const n=Object.prototype.toString.call(e);if(n!==Object.prototype.toString.call(t))return!1;switch(n){case"[object Array]":return Or(e,t,r);case"[object Map]":return Er(e,t,r);case"[object Set]":return Pr(e,t,r);case"[object Object]":return Tr(e,t,r);default:return qr(e,t,n)}},Or=(e,t,r=1/0)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!jr(e[n],t[n],r-1))return!1;return!0},Er=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const[n,s]of e)if(!t.has(n)||!jr(s,t.get(n),r-1))return!1;return!0},Pr=(e,t,r=1/0)=>{if(e.size!==t.size)return!1;for(const n of e)if(![...t].some((e=>jr(n,e,r-1))))return!1;return!0},Tr=(e,t,r=1/0)=>{const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const i of n)if(!s.includes(i)||!jr(e[i],t[i],r-1))return!1;const i=Object.getOwnPropertySymbols(e),o=Object.getOwnPropertySymbols(t);if(i.length!==o.length)return!1;for(const n of i)if(!o.includes(n)||!jr(Reflect.get(e,n),Reflect.get(t,n),r-1))return!1;return!0},qr=(e,t,r)=>{switch(r){case"[object RegExp]":return String(e)===String(t);case"[object Date]":return e.getTime()===t.getTime();case"[object ArrayBuffer]":return Br(e,t);default:return e===t}},Br=(e,t)=>{if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<r.length;e++)if(r[e]!==n[e])return!1;return!0};var Lr={isEqual:jr,isEqualArray:Or,isEqualObject:Tr,isEqualValue:qr,isEqualAB:Br,isEqualDeep:(e,t)=>jr(e,t,1/0)};const Rr=(e,t=new WeakMap)=>{if(null===e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let r;if(Array.isArray(e)){r=[],t.set(e,r);for(const n of e)r.push(Rr(n,t))}else if(e instanceof Date)r=new Date(e);else if(e instanceof RegExp)r=new RegExp(e.source,e.flags);else if(e instanceof Map){r=new Map,t.set(e,r);for(const[n,s]of e.entries())r.set(Rr(n,t),Rr(s,t))}else if(e instanceof Set){r=new Set,t.set(e,r);for(const n of e.values())r.add(Rr(n,t))}else if("object"==typeof e){r={},t.set(e,r);for(const[n,s]of Object.entries(e))r[n]=Rr(s,t)}return r};var Fr={copy:(e,t={})=>{if(null==e)return;const r=JSON.parse(JSON.stringify(e));if("object"!=typeof r||null===r)return r;if(Array.isArray(r))return r;const{fields:n=[],camel:s=!1,pure:i=!0,...o}=t,a={},c=[{condition:o.ignoreNull,test:e=>null===e},{condition:o.ignoreZero,test:e=>0===e},{condition:o.ignoreEmptyArray,test:e=>Array.isArray(e)&&0===e.length},{condition:o.ignoreEmptyString,test:e=>"string"==typeof e&&""===e.trim()}].filter((e=>e.condition));for(const[e,t]of Object.entries(r)){const r=!s||i&&e.startsWith("_")?e:Wt.camelCase(e);n.length>0&&!n.includes(e)&&!n.includes(r)||(c.some((e=>e.test(t)))||(a[r]=t))}return a},clone:Rr,cloneClass:function(e){return null==e||"object"!=typeof e?e:Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}};const Ur=(e,t)=>{if(e===t)return!0;if(!e||!t)return!1;if("*"===t)return!0;const r=t.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^"+r+"$").test(e)};var Dr={shExpMatch:Ur,shExpMatchs:(e,t)=>{if(!e||!t)return!1;let r=[];if(Array.isArray(t))r=t;else{if("string"!=typeof t)return!1;r=[t]}for(const t of r){if("*"===t)return!0;if(Ur(e,t))return!0}return!1}};const Ir="[object Object]",Mr="[object Array]",Kr=S.getTag,zr=e=>{if(Kr(e)!==Ir)return e;const t={};for(const r in e)if(/\w+\.\w+/g.test(r)&&!r.includes("[")){const n=r.split(".");let s=t;for(let e=0;e<n.length-1;e++){const t=n[e];Kr(s[t])!==Ir&&(s[t]={}),s=s[t]}s[n[n.length-1]]=e[r]}else t[r]=e[r];return t},Nr=(e,t,r=!1)=>{if(e===t)return;const n=Kr(e);if(n===Kr(t))if(n===Mr&&e.length>=t.length)for(let r=0;r<t.length;r++)Nr(e[r],t[r]);else if(n===Ir&&Object.keys(e).length>=Object.keys(t).length)for(const n in t)r||void 0!==e[n]?Nr(e[n],t[n]):e[n]=null},Hr=(e,t)=>Nr(e,t,!0),Vr=(e,t,r={},n="",s=!1)=>{if(e===t)return r;const i=Kr(e),o=Kr(t);if(i===Mr&&o===i&&e.length>=t.length){for(let s=0;s<e.length;s++)Vr(e[s],t[s],r,`${n}[${s}]`,!1);return r}if(i===Ir&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Kr(s),c=Kr(o);if(s!==o)if(a===Mr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Vr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`,!1);else if(a===Ir&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Vr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`,!1);else null!==s&&(r[`${n?n+".":""}${i}`]=s)}return r}return r[n]=e,r};const Wr={...{...Lr,...Fr,...Dr,...{flattenPath:zr,normalizeStructure:Hr,diffPath:(e,t)=>{const r=zr(e),n=zr(t);return Hr(r,n),Vr(r,n)}}},...Me,...$r,...rr,...Wt,...$e,...me,qs:mr};var Zr={gbkLength:function(e){let t=0;if(!e)return 0;for(let r=0;r<e.length;r++)e.charCodeAt(r)>127||94===e.charCodeAt(r)?t+=2:t++;return t},gbkCut:function(e,t){if(!e||t<=0)return"";let r=0,n=0;for(let s=0;s<e.length&&(e.charCodeAt(s)>127||94===e.charCodeAt(s)?r+=2:r++,!(r>t));s++)n=s;return e.substr(0,n+1)}};function Yr(e){return e!=e}function Jr(e,t){return function(e,t){for(var r=-1,n=e?e.length:0,s=Array(n);++r<n;)s[r]=t(e[r],r,e);return s}(t,(function(t){return e[t]}))}var Qr,Gr,Xr=(Qr=Object.keys,Gr=Object,function(e){return Qr(Gr(e))}),en=Math.max;function tn(e,t){var r=Y.isArray(e)||Y.isArguments(e)?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],n=r.length,s=!!n;for(var i in e)!t&&!S.hasOwnProperty.call(e,i)||s&&("length"==i||Y.isIndex(i,n))||r.push(i);return r}var rn={...Y,...S,...cr,...me,includes:function(e,t,r,n){e=Y.isArrayLike(e)?e:function(e){return e?Jr(e,function(e){return Y.isArrayLike(e)?tn(e):function(e){if(!Y.isPrototype(e))return Xr(e);var t=[];for(var r in Object(e))S.hasOwnProperty.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}(e)):[]}(e),r=r&&!n?oe.toInteger(r):0;var s=e.length;return r<0&&(r=en(s+r,0)),Y.isString(e)?r<=s&&e.indexOf(t,r)>-1:!!s&&function(e,t,r){if(t!=t)return function(e,t,r,n){for(var s=e.length,i=r+(n?1:-1);n?i--:++i<s;)if(t(e[i],i,e))return i;return-1}(e,Yr,r);for(var n=r-1,s=e.length;++n<s;)if(e[n]===t)return n;return-1}(e,t,r)>-1},forof:(e,t)=>{if(!e)return;let r;if(Y.isObject(e)&&(r=Y.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var nn={...{groupBy:function(e,t){return e.reduce(((e,r)=>((e[r[t]]=e[r[t]]||[]).push(r),e)),{})},first:function(e){if(!e)return;return e.length<=0?void 0:e[0]},last:function(e){if(!e)return;const t=e.length;return t<=0?void 0:e[t-1]},toList:function(e){return Array.isArray(e)?e:e?[e]:[]}},stepAction:function(e,t,r=100){if(!Y.isFunction(t))return;if(!Y.isArray(e)||e.length<=0)return;let n=0;for(;e.length>n;){let s=r+n,i=e.slice(n,s);t&&t(i),n=s}},skip:function(e,t){if(!Y.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!Y.isArray(e)||e.length<=0)return[];const n=r||0;if(n>=e.length)return[];const s=t+n;return e.slice(n,e.length<s?e.length:s)||[]},distinct:function(e){return!Y.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return $e.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!Y.isObject(e))return;const s=e[t];(Y.isString(s)&&""!==s||Y.isNumber(s))&&(n[s]=e[r])})),n):n}};const sn=/%[sdj%]/g;let on=()=>{};function an(e){if(!e||!e.length)return null;const t={};return e.forEach((e=>{const r=e.field;t[r]=t[r]||[],t[r].push(e)})),t}function cn(e,...t){let r=0;const n=t.length;if("function"==typeof e)return e.apply(null,t);if("string"==typeof e){return e.replace(sn,(e=>{if("%%"===e)return"%";if(r>=n)return e;switch(e){case"%s":return String(t[r++]);case"%d":return Number(t[r++]);case"%j":try{return JSON.stringify(t[r++])}catch(e){return"[Circular]"}break;default:return e}}))}return e}function ln(e,t){return null==e||(!("array"!==t||!Array.isArray(e)||e.length)||!(!function(e){return"string"===e||"url"===e||"hex"===e||"email"===e||"date"===e||"pattern"===e}(t)||"string"!=typeof e||e))}function un(e,t,r){let n=0;const s=e.length;!function i(o){if(o&&o.length)return void r(o);const a=n;n+=1,a<s?t(e[a],i):r([])}([])}"undefined"!=typeof process&&process.env&&"production"!==process.env.NODE_ENV&&"undefined"!=typeof window&&"undefined"!=typeof document&&(on=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class fn extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function hn(e,t,r,n,s){if(t.first){const t=new Promise(((t,i)=>{const o=function(e){const t=[];return Object.keys(e).forEach((r=>{t.push(...e[r]||[])})),t}(e);un(o,r,(e=>(n(e),e.length?i(new fn(e,an(e))):t(s))))}));return t.catch((e=>e)),t}const i=!0===t.firstFields?Object.keys(e):t.firstFields||[],o=Object.keys(e),a=o.length;let c=0;const l=[],u=new Promise(((t,u)=>{const f=e=>{if(l.push.apply(l,e),c++,c===a)return n(l),l.length?u(new fn(l,an(l))):t(s)};o.length||(n(l),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?un(n,r,f):function(e,t,r){const n=[];let s=0;const i=e.length;function o(e){n.push(...e||[]),s++,s===i&&r(n)}e.forEach((e=>{t(e,o)}))}(n,r,f)}))}));return u.catch((e=>e)),u}function dn(e,t){return r=>{let n;return n=e.fullFields?function(e,t){let r=e;for(let e=0;e<t.length;e++){if(null==r)return r;r=r[t[e]]}return r}(t,e.fullFields):t[r.field||e.fullField],(s=r)&&void 0!==s.message?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField};var s}}function pn(e,t){if(t)for(const r in t)if(t.hasOwnProperty(r)){const n=t[r];"object"==typeof n&&"object"==typeof e[r]?e[r]={...e[r],...n}:e[r]=n}return e}const gn=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!ln(t,i||e.type)||n.push(cn(s.messages.required,e.fullField))};let yn;const mn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,bn=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,wn={integer:e=>wn.number(e)&&parseInt(e,10)===e,float:e=>wn.number(e)&&!wn.integer(e),array:e=>Array.isArray(e),regexp(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(e){return!1}},date:e=>"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear&&!isNaN(e.getTime()),number:e=>!isNaN(e)&&"number"==typeof e,object:e=>"object"==typeof e&&!wn.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(mn),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(yn)return yn;const e="[a-fA-F\\d:]",t=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${e})|(?<=${e})(?=\\s|$))`:"",r="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",n="[a-fA-F\\d]{1,4}",s=`\n(?:\n(?:${n}:){7}(?:${n}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${n}:){6}(?:${r}|:${n}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${n}:){5}(?::${r}|(?::${n}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${n}:){4}(?:(?::${n}){0,1}:${r}|(?::${n}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${n}:){3}(?:(?::${n}){0,2}:${r}|(?::${n}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${n}:){2}(?:(?::${n}){0,3}:${r}|(?::${n}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${n}:){1}(?:(?::${n}){0,4}:${r}|(?::${n}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${n}){0,5}:${r}|(?::${n}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),i=new RegExp(`(?:^${r}$)|(?:^${s}$)`),o=new RegExp(`^${r}$`),a=new RegExp(`^${s}$`),c=e=>e&&e.exact?i:new RegExp(`(?:${t(e)}${r}${t(e)})|(?:${t(e)}${s}${t(e)})`,"g");c.v4=e=>e&&e.exact?o:new RegExp(`${t(e)}${r}${t(e)}`,"g"),c.v6=e=>e&&e.exact?a:new RegExp(`${t(e)}${s}${t(e)}`,"g");const l=c.v4().source,u=c.v6().source;return yn=new RegExp(`(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${l}|${u}|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s"]*)?$)`,"i"),yn})()),hex:e=>"string"==typeof e&&!!e.match(bn)},_n="enum";var vn={required:gn,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(cn(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void gn(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?wn[i](t)||n.push(cn(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(cn(s.messages.types[i],e.fullField,e.type))},range:(e,t,r,n,s)=>{const i="number"==typeof e.len,o="number"==typeof e.min,a="number"==typeof e.max,c=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;let l=t,u="";const f="number"==typeof t,h="string"==typeof t,d=Array.isArray(t);if(f?u="number":h?u="string":d&&(u="array"),!u)return!1;d&&(l=t.length),h&&(l=t.replace(c,"_").length),i?l!==e.len&&n.push(cn(s.messages[u].len,e.fullField,e.len)):o&&!a&&l<e.min?n.push(cn(s.messages[u].min,e.fullField,e.min)):a&&!o&&l>e.max?n.push(cn(s.messages[u].max,e.fullField,e.max)):o&&a&&(l<e.min||l>e.max)&&n.push(cn(s.messages[u].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[_n]=Array.isArray(e[_n])?e[_n]:[],-1===e[_n].indexOf(t)&&n.push(cn(s.messages[_n],e.fullField,e[_n].join(", ")))},pattern:(e,t,r,n,s)=>{if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||n.push(cn(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(cn(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const xn=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t,i)&&!e.required)return r();vn.required(e,t,n,o,s,i),ln(t,i)||vn.type(e,t,n,o,s)}r(o)};var An={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(ln(t,"string")&&!e.required)return r();vn.required(e,t,n,i,s,"string"),ln(t,"string")||(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s),vn.pattern(e,t,n,i,s),!0===e.whitespace&&vn.whitespace(e,t,n,i,s))}r(i)},method:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.type(e,t,n,i,s)}r(i)},number:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(""===t&&(t=void 0),ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},boolean:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.type(e,t,n,i,s)}r(i)},regexp:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),ln(t)||vn.type(e,t,n,i,s)}r(i)},integer:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},float:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},array:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(null==t&&!e.required)return r();vn.required(e,t,n,i,s,"array"),null!=t&&(vn.type(e,t,n,i,s),vn.range(e,t,n,i,s))}r(i)},object:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.type(e,t,n,i,s)}r(i)},enum:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s),void 0!==t&&vn.enum(e,t,n,i,s)}r(i)},pattern:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t,"string")&&!e.required)return r();vn.required(e,t,n,i,s),ln(t,"string")||vn.pattern(e,t,n,i,s)}r(i)},date:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t,"date")&&!e.required)return r();if(vn.required(e,t,n,i,s),!ln(t,"date")){let r;r=t instanceof Date?t:new Date(t),vn.type(e,r,n,i,s),r&&vn.range(e,r.getTime(),n,i,s)}}r(i)},url:xn,hex:xn,email:xn,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;vn.required(e,t,n,i,s,o),r(i)},any:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(ln(t)&&!e.required)return r();vn.required(e,t,n,i,s)}r(i)}};function Sn(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone(){const e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}const kn=Sn();class Cn{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");An[e]=t};static warning=on;static messages=kn;static validators=An;rules={};_messages=kn;constructor(e){this.define(e)}define(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");this.rules={},Object.keys(e).forEach((t=>{const r=e[t];this.rules[t]=Array.isArray(r)?r:[r]}))}messages(e){return e&&(this._messages=pn(Sn(),e)),this._messages}validate(e,t={},r=(()=>{})){let n=e,s=t,i=r;if("function"==typeof s&&(i=s,s={}),!this.rules||0===Object.keys(this.rules).length)return i&&i(null,n),Promise.resolve(n);if(s.messages){let e=this.messages();e===kn&&(e=Sn()),pn(e,s.messages),s.messages=e}else s.messages=this.messages();const o={};(s.keys||Object.keys(this.rules)).forEach((t=>{const r=this.rules[t];let s=n[t];r.forEach((r=>{let i=r;"function"==typeof i.transform&&(n===e&&(n={...n}),s=n[t]=i.transform(s)),i="function"==typeof i?{validator:i}:{...i},i.validator=this.getValidationMethod(i),i.validator&&(i.field=t,i.fullField=i.fullField||t,i.type=this.getType(i),o[t]=o[t]||[],o[t].push({rule:i,value:s,source:n,field:t}))}))}));const a={};return hn(o,s,((e,t)=>{const r=e.rule;let i,o=!("object"!==r.type&&"array"!==r.type||"object"!=typeof r.fields&&"object"!=typeof r.defaultField);function c(e,t){return{...t,fullField:`${r.fullField}.${e}`,fullFields:r.fullFields?[...r.fullFields,e]:[e]}}function l(i=[]){let l=Array.isArray(i)?i:[i];!0===s.suppressWarning&&l.length&&Cn.warning("async-validator:",l),l.length&&void 0!==r.message&&(l=[].concat(r.message));let u=l.map(dn(r,n));if(s.first&&u.length)return a[r.field]=1,t(u);if(o){if(r.required&&!e.value)return void 0!==r.message?u=[].concat(r.message).map(dn(r,n)):s.error&&(u=[s.error(r,cn(s.messages.required,r.field))]),t(u);let i={};r.defaultField&&Object.keys(e.value).map((e=>{i[e]=r.defaultField})),i={...i,...e.rule.fields};const o={};Object.keys(i).forEach((e=>{const t=i[e],r=Array.isArray(t)?t:[t];o[e]=r.map(c.bind(null,e))}));const a=new Cn(o);a.messages(s.messages),e.rule.options&&(e.rule.options.messages=s.messages,e.rule.options.error=s.error),a.validate(e.value,e.rule.options||s,(e=>{const r=[];u&&u.length&&r.push(...u),e&&e.length&&r.push(...e),t(r.length?r:null)}))}else t(u)}if(o=o&&(r.required||!r.required&&e.value),r.field=e.field,r.asyncValidator)i=r.asyncValidator(r,e.value,l,e.source,s);else if(r.validator){try{i=r.validator(r,e.value,l,e.source,s)}catch(e){console.error?.(e),s.suppressValidatorError||setTimeout((()=>{throw e}),0),l(e.message)}!0===i?l():!1===i?l("function"==typeof r.message?r.message(r.fullField||r.field):r.message||`${r.fullField||r.field} fails`):i instanceof Array?l(i):i instanceof Error&&l(i.message)}i&&i.then&&i.then((()=>l()),(e=>l(e)))}),(e=>{!function(e){let t=[],r={};for(let r=0;r<e.length;r++)s=e[r],Array.isArray(s)?t=t.concat(...s):t.push(s);var s;t.length?(r=an(t),i(t,r)):i(null,n)}(e)}),n)}getType(e){if(void 0===e.type&&e.pattern instanceof RegExp&&(e.type="pattern"),"function"!=typeof e.validator&&e.type&&!An.hasOwnProperty(e.type))throw new Error(cn("Unknown rule type %s",e.type));return e.type||"string"}getValidationMethod(e){if("function"==typeof e.validator)return e.validator;const t=Object.keys(e),r=t.indexOf("message");return-1!==r&&t.splice(r,1),1===t.length&&"required"===t[0]?An.required:An[this.getType(e)]||void 0}}function $n(e){return new Cn(e)}var jn={validateId:function(e){return!!e&&(!(e.length<6)&&!!/^[A-Za-z0-9_-]+$/.test(e))},validatePhone:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)},validator:$n,validate:function(e,t,r={},n=(()=>{})){return rr.run($n(e).validate(t,r,n))},isChinese:function(e){return!!e&&!!/^[\u4E00-\u9FA5]+$/.test(e)},isNumber:function(e){return!!e&&!!/^[0-9]+$/.test(e)},isFloat:function(e){return!!e&&!!/^(\-|\+)?\d+(\.\d+)?$/.test(e)},isPhoneNumber:function(e){return!!e&&!!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e)}};const On={gbk:Zr,math:$e,list:nn,string:Wt,time:Sr,obj:cr,rule:jn,regex:{pattern:{num:"0-9",zh:"一-龥",en:"A-Za-z"},regex:(e,t)=>new RegExp(e,t),entire:{chinese:/^[\u4E00-\u9FA5]+$/,real:/^(\-|\+)?\d+(\.\d+)?$/,cssReal:/^(\-|\+)?\d*(\.)?\d+$/,id:/^[A-Za-z0-9]+$/,yyyyMMdd:/^(\d{4})-?(\d{2})-?(\d{2})$/}},...Me,...$r,...rn,Event:f},En="[object Object]",Pn="[object Array]",Tn=e=>Object.prototype.toString.call(e),qn=(e,t,r=!1)=>{if(e===t)return;const n=Tn(e);if(n===Tn(t))if(n===Pn&&e.length>=t.length)for(let r=0;r<t.length;r++)qn(e[r],t[r]);else if(n===En&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?qn(e[n],t[n]):e[n]=null},Bn=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=Tn(e),o=Tn(t);if(i===Pn&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)Bn(e[s],t[s],r,`${n}[${s}]`);else if(i===En&&o===i&&(s||Object.keys(e).length>=Object.keys(t).length)){const s=Object.keys(e);for(let i of s){const s=e[i],o=t[i],a=Tn(s),c=Tn(o);if(s!==o)if(a===Pn&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)Bn(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===En&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)Bn(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class Ln{list=[];constructor(){this.invoke=this.invoke.bind(this)}use(e){this.list=this.list.concat(e)}invoke(e){return this.list.reduce(((e,t)=>e.then((e=>t(e)))),Promise.resolve(e)).catch((e=>"REFETCH"===e.sig?Promise.resolve(e.result):Promise.reject(e)))}}class Rn{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new Ln,response:new Ln};constructor(e){const{reqConfig:t={},requestEncrypt:r,responseDecrypt:n,handleError:s,api:i}=e;this.reqConfig=t,this.handleEncrypt=r,this.handleDecrypt=n,this.handleError=s,this.handleRequest=i}static blockId="blockid";static requestLock={};lockR(e,t){Rn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete Rn.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}_fetch(e,t){let r=e;return t&&this.handleEncrypt&&(r=this.handleEncrypt(e)),new Promise(((e,n)=>{this.handleRequest({...r,success:r=>{let n=r;t&&this.handleDecrypt&&(n=this.handleDecrypt(r)),e(n)},fail:e=>{n(e)}})}))}async request(e,t){const r=cr.copy(this.reqConfig[e]),{config:n,...s}=await this.interceptors.request.invoke({url:r.url,data:t||{},header:{"content-type":"application/json"},method:r.method?r.method:"POST",responseType:"text",config:r});let i;try{if("block"===n.model)this.lockR(Rn.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await Rn.requestLock[Rn.blockId].request;else if(Rn.requestLock[Rn.blockId]&&Rn.requestLock[Rn.blockId].lock&&await Rn.requestLock[Rn.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),Rn.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await Rn.requestLock[e].request,this.unlockR(e)}else i=await this._fetch(s,n.hasEncrypt)}catch(e){this.handleError&&this.handleError(e)}return this.interceptors.response.invoke({res:i,config:r,reqId:this.getIdFromReq(s),refetch:()=>({sig:"REFETCH",result:this.request(e,t||{})})})}}const Fn=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var Un={diff:function(e,t){const r={};return(e=>{if(Tn(e)===En)for(let t in e)if(/\w+\.\w+/g.test(t)&&-1===t.indexOf("[")){const r=t.split(".");let n=e,s=r.length;for(let e=0;e<s-1;e++){const t=r[e];Tn(n[t])!==En&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),qn(e,t,!0),Bn(e,t,r,"",!0),r},promixify:Fn,run:(e,t={})=>e?rr.run(Fn(e)(t)):rr.run(e),formatList:(e,t,r)=>(e||[]).reduce(((e,n,s)=>({...e,[`${r}[${t+s}]`]:n})),{}),ruleValidator:(e,t)=>!!t&&(!Array.isArray(t)||!(t.length<=0)&&t.every((e=>!!e))),Http:Rn,setWatcher:e=>{let t=e.data,r=e.watch;Object.keys(r).forEach((n=>{let s=t,i=n.split(".");for(let e=0;e<i.length-1;e++)s=s[i[e]];let o=i[i.length-1],a=r[n].handler||r[n],c=r[n].deep;cr.observe(s,o,a,e,c)}))}};const Dn=e=>{if(!e)return"";if(!rn.isObject(e))return"";let t="";return rn.forof(e,((e,r)=>{r&&(t+=`${Wt.kebabCase(e)}:${r};`)})),t},In=["display","position","top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","fontSize","textAlign","fontFamily","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius","background","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","color","overflow","opacity","flexDirection","justifyContent","alignItems","flexWrap","alignContent","alignSelf","flex","flexBasis","flexFlow","flexShrink","pointerEvents"],Mn=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],Kn=(e,t="px")=>e&&t?"0"===e?e:jn.isFloat(e.toString())?`${e}${t}`:e:e;var zn={stringify:Dn,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=mr.parse(e,{sep:";",eq:":",uri:!1}),s={};return rn.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:Wt.camelCase(e):e;jn.isFloat(n)||n.length>=2&&n.startsWith(".")&&jn.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:Kn,style:(e,t="px")=>{if(!e)return"";const r=rn.copy(e,{fields:In});rn.forof(r,((e,n)=>{(Mn.includes(e)||Mn.includes(Wt.camelCase(e)))&&(r[e]=Kn(n,t))}));return Dn(r)},commonFields:In};const Nn=(e,t="",r=!1)=>{try{if(!e)return;const n=mr.parseUrl(e),s=t||n.name;if(!t||!r||!n.origin||n.origin===window.location.origin)((e,t)=>{try{const r=document.createElement("a");r.style.display="none",r.href=e,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}catch(t){console.error(`[ddan] _downloadUrl ${e}`,t)}})(e,s);else{const t=n.params;t.t=Date.now();const r=`${n.url}?${mr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){Hn(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},Hn=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;Nn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},Vn=e=>{try{const t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.style.opacity="0",t.value=e??"",t.select();const r=document.execCommand("copy");return document.body.removeChild(t),r}catch(e){return console.error("[ddan] copyText",e),!1}},Wn=(e,t="denied")=>new Promise((r=>{const n=navigator?.permissions;if(!n||!n.query)return r(t);const s={name:e};n.query(s).then((e=>r(e.state))).catch((()=>r(t)))})),Zn=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e,Yn=(e,t)=>{if(!e||!t)return[];const r=[];let n;for(;null!==(n=t.exec(e));)r.push(n[1]);return r},Jn=(e,t="application/javascript")=>{const r=new Blob([e],{type:t});return URL.createObjectURL(r)};var Qn={dataURLtoFile:(e,t)=>{let r=e.split(","),n=r[0].match(/:(.*?);/)[1],s=window.atob(r[1]),i=s.length,o=new Uint8Array(i);for(;i--;)o[i]=s.charCodeAt(i);return new File([o],t,{type:n})},dataURLtoBlob:e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=window.atob(t[1]),s=n.length,i=new Uint8Array(s);for(;s--;)i[s]=n.charCodeAt(s);return new Blob([i],{type:r})},blobToFile:(e,t)=>(e.lastModifiedDate=new Date,e.name=t,e),readAsDataURL:(e,t)=>{var r=new FileReader;r.readAsDataURL(e),r.onloadend=function(e){t&&t(e.target?.result)}},downloadUrl:Nn,download:(e,t="")=>{e&&("string"!=typeof e?Hn(e,t):Nn(e,t))},downloadFile:Hn,downloadImage:e=>{try{if(!e)return;const t=e.match(/\/(\w+.\w+)$/)[1],r=new Image;r.onload=()=>{let e=document.createElement("canvas");e.width=r.width,e.height=r.height;let n=e.getContext("2d");n&&n.drawImage(r,0,0,r.width,r.height);let s=e.toDataURL();Nn(s,t)},r.src=e,r.setAttribute("crossOrigin","Anonymous")}catch(e){console.error("[ddan] downloadImage",e)}return Promise.resolve()},watermark:(e,{width:t=400,height:r=300,angle:n=0,fillStyle:s="rgba(0, 0, 0, 0.2)",font:i="16px Arial",textAlign:o="left",textBaseline:a="middle"}={})=>{try{if(!e)return"";const c=document.createElement("canvas");c.width=t,c.height=r;const l=c.getContext("2d");return l?(n&&l.rotate(n*Math.PI/180),s&&(l.fillStyle=s),i&&(l.font=i),o&&(l.textAlign=o),a&&(l.textBaseline=a),l.fillText(e,c.width/10,c.height/2),`url(${c.toDataURL()})`):""}catch(e){return console.error("[ddan] watermark",e),""}},copyText:(e,t=!1)=>new Promise((r=>{!t&&navigator.clipboard?Wn("clipboard-write").then((t=>{Zn(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(Vn(e)))):r(Vn(e))})).catch((()=>{r(Vn(e))})):r(Vn(e))})),queryPermission:Wn,isAllowed:Zn,legacyCopy:Vn,takeHtmlLinks:e=>{if(!e)return[];const t=[];return[/<script[^>]+src="([^"]+)"/g,/<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"/g,/<link[^>]+rel="icon"[^>]+href="([^"]+)"/g].forEach((r=>{const n=Yn(e,r);t.push(n)})),[].concat(...t)},takeHtml:Yn,toBlobUrl:Jn,workerURL:e=>Jn(`(${e.toString()})()`,"text/javascript")};const Gn=new class{__defStyle="vertical-align: middle; mask-position: 50% 50%; mask-repeat: no-repeat; mask-size: 100%; -webkit-mask-position: 50% 50%; -webkit-mask-repeat: no-repeat; -webkit-mask-size: 100%; background-color: currentColor;";__map={back:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M609.408 149.376L277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"/></svg>',right:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"/></svg>',home:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M13 19.8h3.8v-7h3.303L12 4.697 3.897 12.8H7.2v7H11V17h2v2.8zm5 .2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-6H3.414a1 1 0 0 1-.707-1.707l8.586-8.586a1 1 0 0 1 1.414 0l8.586 8.586A1 1 0 0 1 20.586 14H18v6z" fill-rule="evenodd" fill-opacity=".9"/></svg>',close:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M764.288 214.592L512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"/></svg>',close_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M466.752 512l-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',close_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"/></svg>',warning:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M928.99 755.83L574.6 203.25c-12.89-20.16-36.76-32.58-62.6-32.58s-49.71 12.43-62.6 32.58L95.01 755.83c-12.91 20.12-12.9 44.91.01 65.03 12.92 20.12 36.78 32.51 62.59 32.49h708.78c25.82.01 49.68-12.37 62.59-32.49 12.91-20.12 12.92-44.91.01-65.03zM554.67 768h-85.33v-85.33h85.33V768zm0-426.67v298.66h-85.33V341.32l85.33.01z" fill="currentColor"/></svg>',play:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M512 1024A512 512 0 1 1 512 0a512 512 0 0 1 0 1024zm3.008-92.992a416 416 0 1 0 0-832 416 416 0 0 0 0 832zM383.232 287.616l384 224.896-384 223.104v-448z" fill="currentColor"/></svg>',lock:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M224 448a32 32 0 0 0-32 32v384a32 32 0 0 0 32 32h576a32 32 0 0 0 32-32V480a32 32 0 0 0-32-32H224zm0-64h576a96 96 0 0 1 96 96v384a96 96 0 0 1-96 96H224a96 96 0 0 1-96-96V480a96 96 0 0 1 96-96z"/><path fill="currentColor" d="M512 544a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V576a32 32 0 0 1 32-32zm192-160v-64a192 192 0 1 0-384 0v64h384zM512 64a256 256 0 0 1 256 256v128H256V320A256 256 0 0 1 512 64z"/></svg>',lock_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M467.2 713.92v115.968a44.8 44.8 0 0 0 89.6 0V713.92c26.752-14.72 44.8-42.304 44.8-73.92 0-47.104-40.128-85.312-89.6-85.312-49.472 0-89.6 38.208-89.6 85.312 0 31.616 18.048 59.136 44.8 73.92zM64 384h896v640H64V384zm268.8 0h358.4V256c0-94.272-80.256-170.688-179.2-170.688-98.944 0-179.2 76.416-179.2 170.688v128zM512 0c148.48 0 268.8 114.56 268.8 256v128H243.2V256C243.2 114.56 363.52 0 512 0z" fill="currentColor"/></svg>',plus:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"/></svg>',plus_circle:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M352 480h320a32 32 0 1 1 0 64H352a32 32 0 0 1 0-64z"/><path fill="currentColor" d="M480 672V352a32 32 0 1 1 64 0v320a32 32 0 0 1-64 0z"/><path fill="currentColor" d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"/></svg>',plus_circle_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0v147.2z"/></svg>',star:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M512 747.84l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"/></svg>',star_fill:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M283.84 867.84L512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"/></svg>',share:'<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M679.872 348.8l-301.76 188.608a127.808 127.808 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"/></svg>',love:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M171.712 571.648l.352.32 287.904 252.8a64 64 0 0 0 82.912 1.344l296.832-244.544a215.584 215.584 0 1 0-301.824-300.576L512 316.672l-25.888-35.616a215.584 215.584 0 1 0-314.4 290.624zM32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512l-295.36 243.392a128 128 0 0 1-165.888-2.592L129.984 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>',love_fill:'<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M32 407.584A279.584 279.584 0 0 1 512 212.64a279.584 279.584 0 0 1 480 194.944 278.144 278.144 0 0 1-113.024 224.512L562.592 892.8a96 96 0 0 1-124.416-1.952L130.016 620.16A278.976 278.976 0 0 1 32 407.584z"/></svg>'};getBase64=e=>{const t=this.getSVG(e);return t?.url||""};getSVG=e=>{if(!e)return;const t=this.__map[e];if(!t)return;return{url:this.toBase64(t),escape:this.toEscape(t)}};toBase64=e=>{if(!e)return"";const t=this._tiny(e);return`data:image/svg+xml;base64,${Cr.encode(t)}`};_tiny=e=>e?e.replace(/<!--(.*)-->/g,"").replace(/[\r\n]/g," ").replace(/"/g,"'"):"";toEscape=e=>{if(!e)return"";return`data:image/svg+xml,${this._tiny(e).replace(/%/g,"%25").replace(/&/g,"%26").replace(/#/g,"%23").replace(/{/g,"%7B").replace(/}/g,"%7D").replace(/</g,"%3C").replace(/>/g,"%3E")}`};getStyle(e,t={}){if(!e)return"";const r=this.__map[e];return r?this.toStyle(r,t):""}toStyle(e,t={}){if(!e)return"";const r=this.toBase64(e);return r?this.getStyleByUrl(r,t):""}getStyleByUrl(e,t={}){if(!e)return"";const{key:r="mask-image",gradientValue:n="radial-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5))",gradient:s=!1,defStyle:i=this.__defStyle}=t,o=s&&n?`${n}, url("${e}")`:`url("${e}")`;return`${r}:${o};-webkit-${r}:${o};${i}`}},Xn={mini:Un,css:zn,qs:mr,icon:Gn,html:Qn},es=({url:e,options:t})=>{const r={"Content-Type":"application/json; charset=utf-8",...t.headers||{}};return t.headers=r,new Promise(((r,n)=>{fetch(e,t).then((e=>{r(e.json())})).catch((e=>{n(e)}))}))};function ts(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function rs(e){const{url:t="",host:r,options:n}=e,s=e;if(t.startsWith("http://")||t.startsWith("https://")||(s.url=(r||"")+t),"GET"===n.method.toUpperCase()&&n.body){const e=JSON.parse(n.body);if(rn.isPlainObject(e)){const r=mr.stringify(e),n=-1===t.indexOf("?")?"?":"&";s.url=`${s.url||""}${n}${r}`,delete s.options.body}}return n&&n.plugins&&delete s.options?.plugins,n&&n.model&&delete s.options?.model,s}class ns{host="";reqConfig={};handleError;interceptors={request:new Ln,response:new Ln};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(rs),this.interceptors.response.use(e.handleResponse||ts),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){ns.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete ns.requestLock[e]}getIdFromReq(e){const{url:t,data:r={}}=e;return t+JSON.stringify(r)}getIdFromReqUrl(e){return e.url||""}async fetch(e,t){const r=rn.copy(this.reqConfig[e])||{},n={host:this.host,url:r.url||"",options:{...r||{},body:JSON.stringify({...t||{}})}};try{const s=await this.interceptors.request.invoke(n);let i;if(delete s.options.plugins,"block"===r.model)this.lockR(ns.blockId,(()=>es(s))),i=await ns.requestLock[ns.blockId].request;else if(ns.requestLock[ns.blockId]&&ns.requestLock[ns.blockId].lock&&await ns.requestLock[ns.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),ns.requestLock[e]||this.lockR(e,(()=>es(s))),i=await ns.requestLock[e].request,this.unlockR(e)}else i=await es(s);return this.interceptors.response.invoke({response:i,config:r,refetch:()=>({sig:"REFETCH",result:this.fetch(e,t)})})}catch(e){return this.handleError&&this.handleError(e),Promise.reject(e)}}}var ss={getDataURL:(e,t)=>{const r={contentType:"",dataUrl:""};return ge.to(fetch(e,{cache:t}).then((e=>(r.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(r.dataUrl=`data:${r.contentType};base64,`+Me.ab2str(e,!0),r))))},getArrayBuffer:async(e,t)=>ge.to(fetch(e,{cache:t}).then((e=>e.arrayBuffer()))),getJson:async(e,t)=>ge.to(fetch(e,{cache:t}).then((e=>e.json()))),download:(e,t={})=>new Promise((r=>fetch(e).then((async e=>{if(!e.ok||200!==e.status)throw new Error(e.statusText);const n=+(e.headers.get("content-length")||""),s=e.body?.getReader();let i=0;const o=[];for(;;){const{done:e,value:r}=await s.read();if(e)break;o.push(r),i+=r.length;const a=$e.float(100*i/n,{digits:2});t?.progress&&t?.progress(a,i,n)}const a=new Uint8Array(i);let c=0;for(const e of o)a.set(e,c),c+=e.length;t?.success&&t?.success(a),r(a)})).catch((e=>{t?.fail&&t?.fail(e),r(void 0)})))),getText:async(e,t)=>ge.to(fetch(e,{cache:t}).then((e=>e.text()))),cache:async(e,t="no-cache")=>ge.to(fetch(e,{cache:t}).then((()=>!0)))};class is{publicKey="";privateKey="";iv="";__privateCryptoKey;__sharedSecret;__curve;__keyFormat;__subtle;constructor(e="P-256",t="raw"){this.__curve=e,this.__keyFormat=t||"raw","undefined"!=typeof window?this.__subtle=window.crypto.subtle:this.__subtle={}}async generateKeys(){const e=await this.__subtle.generateKey({name:"ECDH",namedCurve:this.__curve},!0,["deriveKey","deriveBits"]);return this.__privateCryptoKey=e.privateKey,this.publicKey=await this.exportKey(e.publicKey),this.privateKey=await this.exportKey(e.privateKey,"pkcs8"),this}async exportKey(e,t="raw"){const r=await this.__subtle.exportKey(t||this.__keyFormat,e);return Me.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Me.base64ToBytes(e);return await this.__subtle.importKey(t||this.__keyFormat||"raw",n,{name:"ECDH",namedCurve:this.__curve},!0,r)}async setPrivateKey(e){if(!e)return!1;const t=await this.importKey(e,"pkcs8",["deriveKey","deriveBits"]);return this.privateKey=await this.exportKey(t,"pkcs8"),this.__privateCryptoKey=t,!0}async deriveSharedSecret(e,t){if(!this.__privateCryptoKey)return!1;const r=await this.importKey(e),n=await this.__subtle.deriveKey({name:"ECDH",public:r},this.__privateCryptoKey,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return this.__sharedSecret=n,this.iv=t||"",!0}async encode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Me.base64ToBytes(r),s=Me.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Me.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Me.base64ToBytes(r):Me.getRandomBytes(12),s=Me.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Me.concatBytes(new Uint8Array(i),n);return Me.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Me.base64ToBytes(e),s=Me.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Me.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Me.base64ToBytes(e);if(t.length<12)return"";const r=t.slice(t.length-12),n=t.slice(0,t.length-12),s=await this.__subtle.decrypt({name:"AES-GCM",iv:r},this.__sharedSecret,n);return Me.textDecode(s)}}const os={fetch:ss,Http:ns,css:zn,qs:mr,icon:Gn,html:Qn,rsa:Ze,...{Ecdh:is}};var as={brotliCompress:function(e,r=t.constants.BROTLI_DEFAULT_QUALITY){try{if(!e)return"";const n=Me.toUtf8Bytes(e);return t.brotliCompressSync(n,{params:{[t.constants.BROTLI_PARAM_QUALITY]:r}}).toString("base64")}catch(t){return e||""}},brotliDecompress:function(e){try{if(!e)return"";const r=Me.base64ToBytes(e);return t.brotliDecompressSync(r).toString("utf-8")}catch(t){return e||""}}};var cs={child_exec:e=>new Promise((t=>{if(!e)return t([null,""]);s(e,((e,r)=>{t(e?[e||"error",""]:[null,r||""])}))}))};const ls=()=>{try{return"win32"===process.platform?us():"darwin"===process.platform?fs():void 0}catch(e){return}},us=async()=>{do{let e,t;if([e,t]=await cs.child_exec('reg query "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"'),e)break;const r=t.split("\n").find((e=>e.includes("ProxyEnable")));if(!(r&&r.trim().endsWith("1")))break;const n=t.split("\n").find((e=>e.includes("ProxyServer"))),s=n?n.split(" ").filter(Boolean).pop():"";if(!s)break;const i=s.split(":");if(i.length<=1)break;const o=i[0],a=+(i[1]||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},fs=async()=>{do{let e,t;if([e,t]=await cs.child_exec('networksetup -getwebproxy "Wi-Fi"'),e)break;const r=t.split("\n"),n=r.find((e=>e.includes("Enabled")));if(!(n&&n.includes("Yes")))break;const s=r.find((e=>e.includes("Server"))),i=r.find((e=>e.includes("Port"))),o=s?s.split(":")[1]?.trim():null,a=+((i?i.split(":")[1]?.trim():null)||"");if(!o||!a)break;return{ipaddress:o,port:a}}while(0)},hs=(e,t=["*"],r="DIRECT",n=[])=>{const s=e||r||"DIRECT",i=r||"DIRECT",o=`\n function FindProxyForURL(url, host) {\n if (host === "127.0.0.1" || host === "localhost") {\n return "DIRECT";\n }\n\n if (isInNet(host, "10.0.0.0", "255.0.0.0") ||\n isInNet(host, "172.16.0.0", "255.240.0.0") ||\n isInNet(host, "192.168.0.0", "255.255.0.0")) {\n return "DIRECT";\n }\n\n var _rules = ${JSON.stringify(t)};\n var _proxy = "${s}";\n var _default = "${i}";\n var _directs = ${JSON.stringify(n)};\n\n for (var i = 0; i < _rules.length; i++) {\n if (shExpMatch(host, _rules[i])) {\n return _proxy;\n }\n }\n\n for (var j = 0; j < _directs.length; j++) {\n if (shExpMatch(host, _directs[j])) {\n return "DIRECT";\n }\n }\n\n return _default;\n }\n `;return Me.toDataUrl(o,"application/x-ns-proxy-autoconfig")},ds=(e,t,r)=>{if(!e||!t)return"";const{type:n="ALL",direct:s=!1}=r||{};let i="";switch(n?n.toUpperCase():""){case"ALL":i=`SOCKS5 ${e}:${t};PROXY ${e}:${t}`;break;case"PROXY":i=`PROXY ${e}:${t}`;break;case"SOCKS5":i=`SOCKS5 ${e}:${t}`}if(!i&&!s)return"";const o=[];return i&&o.push(i),s&&o.push("DIRECT"),o.join(";")};var ps={getSystemProxy:ls,toPacScript:hs,toPacProxy:ds,pacScript:async(e,t,r)=>{const{type:n="SOCKS5",rules:s=["*"],useSystem:i}=r||{},o=ds(e,t,{type:n});if(!o)return"";let a;if(i){const e=await ls();e&&(a=ds(e?.ipaddress||"",e?.port||0,{direct:!0}))}return hs(o,s||[],a)},getPacScript:async e=>{const{type:t="SOCKS5",rules:r=["*"],useSystem:n,address:s="",port:i=0,directs:o=[]}=e||{},a=ds(s,i,{type:t});let c;if(n){const e=await ls();e&&(c=ds(e?.ipaddress||"",e?.port||0,{direct:!0}))}return hs(a,r||[],c,o)}};const gs=(e,t)=>new Promise(((r,n)=>{i.readdir(e,(async(s,i)=>{if(s)return n(s);r(ys(e,i,t))}))})),ys=async(e,t,r)=>{for(let n of t){const t=`${e}\\${n}`;i.lstatSync(t).isDirectory()?await gs(`${t}`,r):r&&await r(t)}};var ms={...{readDirectory:gs,readFiles:ys},...as,...cs,...ps,Ecdh:class{publicKey="";privateKey="";sharedSecret;iv="";__curve;__algorithm;__ecdh;constructor(e="prime256v1",t="aes-256-gcm"){this.__curve=e,this.__algorithm=t,this.generateKeys()}generateKeys(){const t=e.createECDH("prime256v1");t.generateKeys(),this.publicKey=t.getPublicKey("base64"),this.privateKey=t.getPrivateKey("base64"),this.__ecdh=t}setPrivateKey(e){return!!e&&(!!this.__ecdh&&(this.__ecdh.setPrivateKey(e,"base64"),this.publicKey=this.__ecdh.getPublicKey("base64"),!0))}setSharedSecret(e){return!!e&&(this.sharedSecret=e,!0)}deriveSharedSecret(e,t){return!!e&&(this.sharedSecret=this.__ecdh.computeSecret(e,"base64").toString("base64"),this.iv=t||"",!0)}encode(t,r){if(!this.sharedSecret)return"";const n=r||this.iv;if(!n)return"";const s=Me.base64ToBytes(n),i=e.createCipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),s),o=Buffer.concat([new Uint8Array(i.update(t,"utf8")),new Uint8Array(i.final())]),a=i.getAuthTag();return Buffer.concat([new Uint8Array(o),new Uint8Array(a)]).toString("base64")}encodeiv(t,r){if(!this.sharedSecret)return"";const n=r||this.iv,s=n?Me.base64ToBytes(n):Me.getRandomBytes(12),i=e.createCipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),s),o=Buffer.concat([new Uint8Array(i.update(t,"utf8")),new Uint8Array(i.final())]),a=i.getAuthTag();return Buffer.concat([new Uint8Array(o),new Uint8Array(a),s]).toString("base64")}decode(t,r){if(!t||!this.sharedSecret)return"";const n=r||this.iv;if(!n)return"";const s=e.createDecipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),Me.base64ToBytes(n)),i=Me.base64ToBytes(t),o=i.slice(i.length-16);s.setAuthTag(o);const a=i.slice(0,i.length-16);return Buffer.concat([new Uint8Array(s.update(a)),new Uint8Array(s.final())]).toString("utf-8")}decodeiv(t){if(!t||!this.sharedSecret)return"";const r=Me.base64ToBytes(t);if(r.length<28)return"";const n=r.slice(r.length-12),s=r.slice(r.length-28,r.length-12),i=e.createDecipheriv("aes-256-gcm",Me.base64ToBytes(this.sharedSecret),n);i.setAuthTag(s);const o=r.slice(0,r.length-28);return Buffer.concat([new Uint8Array(i.update(o)),new Uint8Array(i.final())]).toString("utf-8")}},EcdhWeb:class extends is{constructor(t="P-256",r="raw"){super(t,r),this.__subtle=e.webcrypto.subtle}},Socks5:class{upstreamProxy;server=null;clientSockets=new Set;systemProxy=null;useSystemProxy=!1;__debug=!1;__uuid;__port=0;__event;__pipeline;__logger;__totalReceived=0;__totalSent=0;__rules=[];constructor(e,t=!1,r){this.__event=new f,this.upstreamProxy=this.filterProxyConfigs(e),this._updateRules(),this.__debug=t,this.__uuid=u(),this.__pipeline=new we(1),this.__logger=r||console}get id(){return this.__uuid}get port(){return this.__port}get url(){return this.__port?`socks5://127.0.0.1:${this.__port}`:""}get totalReceived(){return this.__totalReceived}get totalSent(){return this.__totalSent}get rules(){return this.__rules}validateProxyConfig(e){const{ipaddress:t,port:r,userId:n,password:s}=e||{};return t&&"string"==typeof t?r&&"number"==typeof r?n&&"string"==typeof n?s&&"string"==typeof s?"":"无效的上游代理密码":"无效的上游代理用户名":"无效的上游代理端口":"无效的上游代理 IP 地址"}filterProxyConfigs(e){let t=[];t=e&&Array.isArray(e)?e:[e];const r=[];for(const e of t)this.validateProxyConfig(e)||r.push(e);return r}async start(e=8838){if(this.upstreamProxy.length<=0)return 0;if(this.server)return this.__debug&&console.info("[socks5] server is already running"),this.__port;const t=await this.findAvailablePort(e);return t?(this.__port=t,this.server=r.createServer((e=>this.handleSocksConnection(e))),this.server.listen(t,(()=>{this.__debug&&this.__logger?.info(`[socks5] server is running on port ${t}`)})),this.server.on("error",(e=>{this.__logger?.error("[socks5] server error:",e),this.close()})),t):0}setUpstreamProxy(e){if(!e)return!1;const t=this.filterProxyConfigs(e);return!(!t||t.length<=0)&&(this.upstreamProxy=t,this._updateRules(),!0)}setSystemProxy(e,t){this.useSystemProxy=e,e&&t&&t.ipaddress&&t.port&&(this.systemProxy=t)}async findAvailablePort(e,t=200){let n=e,s=0;for(;s<t;)try{return await new Promise(((e,t)=>{const s=r.createServer();s.unref(),s.on("error",t),s.listen(n,(()=>{s.close((()=>e()))}))})),n}catch{s++,n++}return this.__debug&&this.__logger?.warn("[socks5] findAvailablePort failed"),0}async handleSocksConnection(e){let t="";try{if(!e)return;this.clientSockets.add(e),e.on("close",(()=>{this.clientSockets.delete(e),e?.destroy()})),await this.performHandshake(e);const r=await this.parseClientRequest(e),n=r.addr;t=`${n}:${r.port}`,this.__debug&&this.__logger?.info("[socks5] connection",t);const s=this.findProxyConfig(n);if(s){const n=await this.connectToUpstreamProxy(r,s);this.__logger?.info(`[socks5] connection upstream ${t}, use ${s.ipaddress}:${s.port}`),this.setupDataForwarding(e,n,"upstream")}else if(this.useSystemProxy&&this.systemProxy&&!mr.isLocalIpAddress(n)){const n=await this.connectToSystemProxy(r);this.__debug&&console.info("[socks5] connection system",t),this.setupDataForwarding(e,n,"system")}else{this.__debug&&console.info("[socks5] connection local",t);const n=await this.connectToLocal(r);this.setupDataForwarding(e,n,"local")}}catch(r){this.__debug&&this.__logger?.error("[socks5] connection failed:",r),e.end(new Uint8Array([5,1])),this._emit("error",r,t)}}performHandshake(e){return new Promise(((t,r)=>{e.once("data",(n=>{if(5!==n[0])return r(new Error("Unsupported SOCKS version"));e.write(new Uint8Array([5,0])),t()}))}))}parseClientRequest(e){return new Promise(((t,r)=>{e.once("data",(e=>{let n,s;if(1!==e[1])return r(new Error("Unsupported command"));if(1===e[3])n=e.slice(4,8).join("."),s=e.readUInt16BE(8);else{if(3!==e[3])return r(new Error("Unsupported address type"));{const t=e[4];n=e.slice(5,5+t).toString(),s=e.readUInt16BE(5+t)}}t({addr:n,port:s})}))}))}async connectToUpstreamProxy(e,t){const r={proxy:{ipaddress:t.ipaddress,port:t.port,type:5,userId:t.userId,password:t.password},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(r)}catch(e){throw new Error("Failed to connect to upstream proxy: "+e)}}async connectToSystemProxy(e){const t={proxy:{...this.systemProxy,type:5},command:"connect",destination:{host:e.addr,port:e.port}};try{return await this.connectToProxy(t)}catch(e){throw new Error("Failed to connect to system proxy: "+e)}}async connectToProxy(e){const{socket:t}=await n.createConnection(e);return t}async connectToLocal(e){return new Promise(((t,n)=>{const s=r.createConnection(e.port,e.addr,(()=>{t(s)}));s.on("error",(e=>{n(e)}))}))}setupDataForwarding(e,t,r="local"){e.write(new Uint8Array([5,0,0,1,0,0,0,0,0,0])),e.pipe(t),t.pipe(e);const n=`${t.localAddress}:${t.localPort}`;this.__debug&&console.info(`[socks5] setupDataForwarding ${n}`),"upstream"===r&&(t.on("data",(e=>{this.__totalSent+=e.length})),e.on("data",(e=>{this.__totalReceived+=e.length}))),e.on("close",(()=>{this.__debug&&console.info("[socks5] client socket close",n),t.end()})),t.on("close",(()=>{this.__debug&&console.info("[socks5] target socket close",n),e.end()})),e.on("error",(e=>{this.__debug&&console.error("[socks5] client socket error:",e?.message),t.end()})),t.on("error",(t=>{this.__debug&&console.error("[socks5] target socket error:",t?.message),e.end()}))}findProxyConfig(e){if(!mr.isLocalIpAddress(e))for(const t of this.upstreamProxy)if(this.isAllowedDomain(e,t.rules||[]))return t}isAllowedDomain(e,t){if(mr.isLocalIpAddress(e))return!1;if(!t||!Array.isArray(t))return!1;for(const r of t){if("*"===r)return!0;if(mr.shExpMatch(e,r))return!0}return!1}close(){try{if(!this.server)return;this.__debug&&this.__logger?.info("[socks5] closing SOCKS5 proxy server..."),this.server.close((e=>{e&&this.__debug&&this.__logger?.error("[socks5] closing the server failed:",e)})),this.clientSockets.forEach((e=>e?.destroy())),this.clientSockets.clear(),this.server=null,this.__port=0}catch(e){this.__debug&&this.__logger?.error("[socks5] close error:",e)}}on(e,t){e&&t&&(this.__event.off(e,t),this.__event.on(e,t))}off(e,t){e&&this.__event.off(e,t)}resetStatistics(){this.__totalReceived=0,this.__totalSent=0}_emit(e,...t){try{if(!e)return;this.__event.emit(e,...t)}catch(e){}}_updateRules(){this.upstreamProxy&&(this.__rules=nn.distinct(this.upstreamProxy.reduce(((e,t)=>e.concat(t?.rules||[])),[])))}},rsa:Ve};const bs={...ms};var ws={ossImage:(e,t={})=>{if(!e)return e;const r=mr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=nn.toList(t.domain||""),n=e.match(/^http[s]?:\/\/([\w.]+)[\w\W]+/)[1]||"";if(!n||!r.includes(n))return e}const n=[];return t.webp&&!r.endsWith(".gif")&&n.push("format,webp"),t.resize&&n.push(`resize,s_${t.resize}`),t.interlace&&(n.push("interlace,1"),!n.every((e=>!e.startsWith("format")))||r.endsWith(".gif")||r.endsWith(".jpg")||n.push("format,jpg")),n.length<=0?e:`${r}?x-oss-process=image/${n.join("/")}`},ossSnapshot:(e,t={})=>{if(!e)return e;const r=mr.parseUrl(e).url,n=["snapshot"],{m:s="fast",f:i="jpg"}=t;return(t.t||0===t.t)&&n.push(`t_${t.t}`),t.w&&n.push(`w_${t.w}`),t.h&&n.push(`h_${t.h}`),s&&n.push(`m_${s}`),i&&n.push(`f_${i}`),t.ar&&n.push(`ar_${t.ar}`),`${r}?x-oss-process=video/${n.join(",")}`},ossBase64:e=>Ae.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const _s={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},vs=e=>(...t)=>{const r=console[e];_s.overrode?r(...t):xs(r,e,...t)},xs=(e,t,...r)=>{const n=Sr.format(new Date,_s.format),s=_s.tag?`[${t}]`:"";s&&n?e.apply(console,[`${n} ${s}`,...r]):n?e.apply(console,[`${n}`,...r]):s?e.apply(console,[`${s}`,...r]):e.apply(console,[...r])};var As={override:()=>{if(_s.overrode)return;_s.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{xs(t,e,...r)}}))},log:vs("log"),info:vs("info"),warn:vs("warn"),error:vs("error"),config:({tag:e=_s.tag,format:t=_s.format}={})=>{_s.tag=e,_s.format=t}};class Ss{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=rr.debounce((e=>{if(this.key&&this.storage)try{const{setItem:t,setStorageSync:r}=this.storage;if(r)return r(this.key,e);if(t)return t(this.key,JSON.stringify(e))}catch(e){console.error("persit save ",e)}}));read(){if(this.key&&this.storage)try{const{getItem:e,getStorageSync:t}=this.storage;if(t)return t(this.key);if(e){const t=e(this.key);return JSON.parse(t)}}catch(e){return void console.error("persit read ",e)}}handleSave(e,t){if(!this.fields.includes(t)||!e)return;const r=cr.copy(e,{fields:this.fields});this.save(r)}}class ks extends f{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!Y.isFunction(n))return;const[,s]=await rr.run(n({...r,commit:r.commit.bind(r),query:r.query.bind(r),dispatch:r.dispatch.bind(r)},t));return s}async query(e){const t=Reflect.get(this,e);let r;if(null!=t&&""!==t)r=cr.copy(t);else{const[,t]=await rr.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){Y.isObject(t)&&(t=cr.copy(t)),this[e]=t}}const Cs=(e,t)=>{const r=Object.assign(new ks,e||{});r.__persist=new Ss(t||r.persist);const n=r.__persist.read(),s=n?Object.assign(r,n):r;return new Proxy(s,{get:(e,t,r)=>{const n=Reflect.get(e.getters,t);return Y.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(Y.isFunction(s)&&!s(e,r))return!0;const i=Reflect.set(e,t,r,n);return i&&(e.emit(t.toString(),r),e?.__persist?.handleSave(e,t.toString())),i},has:(e,t)=>Reflect.has(e,t)})};class $s{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=mr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=mr.stringify(s,{uri:!1});this.list.push(`${e}?${i}`)}_parseHost(e){e&&!this.host&&/^http[s]?:\/\/([\w.]+)/.test(e)&&(this.host=e.replace(/^http[s]?:\/\/([\w.]+)[\w\W]+/,"$1"))}image(e,t={}){if(!e||!e.includes(this.host))return;if(this.list.length<=0)return;const r={g:"nw",...t},n=e.replace(/^http[s]?:\/\/[\w.]+\/([\w-.,_/?%&=]+)$/,"$1"),s=$r.base64.encodeByOss(n),i=mr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=$r.base64.encodeByOss(e),i=mr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}class js{__list=[];constructor(){this.clear()}add(e){const t=rr.run(e);return this.__list.push(t),this}clear(){return this.__list=[],this}wait(){const e=this.__list;return this.clear(),Promise.allSettled(e)}}const Os=new class{state=Cs(new ks);frame=new br;cache=new Map;cacheTime=new Map;setCache=(e,t)=>null!=t&&(!!e&&(this.cache.set(e,t),this.cacheTime.set(e,Date.now()),!0));hasCache=e=>{if(!e)return!1;this.cache.has(e)};getCache=e=>{if(e)return this.cache.get(e)};getCacheTime=e=>e&&this.cacheTime.get(e)||0;removeCache=e=>{e&&(this.cache.delete(e),this.cacheTime.delete(e))};cacheId=e=>`_${e}_cache_`;timesRecord=(e,t={})=>{if(!e)return;const{mode:r="running",cycle:n="day"}=t||{},s=this.cacheId(r),i=this.getCache(s)||{},o=Date.now(),a=i[e],c={time:o,count:1,cycle:n};return a&&("day"!==n||Sr.isToday(a.time||0))&&(c.count=1+(a.count||0)),i[e]=c,this.setCache(s,i),i};timesValid=(e,t={})=>{if(!e)return!1;const{max:r=1,interval:n=0,mode:s="running",cycle:i="day"}=t||{},o=this.cacheId(s);let a=this.getCache(o);if(!a)return!0;const c=a[e];if(!c)return!0;if("day"===i&&!Sr.isToday(c.time||0))return!0;if(r<=(c.count||0))return!1;return!(Date.now()-(c.time||0)<n)};timesClean=(e="running")=>{const t=this.cacheId(e),r=this.getCache(t);if(!r)return;const n=rn.copy(r);rn.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||Sr.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new js};class Es{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=u(),this.start=Date.now(),this.timeStartDesc=Sr.format(this.start,"hh:mm:ss.SSS")}get time(){return this.flag?this.end:this.start}get timeDesc(){return this.flag?this.timeEndDesc:this.timeStartDesc}done=(e=Date.now())=>{this.start&&(this.end=e,this.cost=this.end-this.start,this.timeEndDesc=Sr.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const Ps=new class{__map=new Map;__trackList=[];opened=!0;clear(){return this.__map.clear(),this.__trackList=[],this}add(e,{desc:t="",type:r=""}={}){if(!e||!this.opened)return"";const n=new Es;return n.name=e,n.type=r,n.desc=t,this.__trackList.push(n),n.id}done(e){if(!e||!this.opened)return;const t=this.__trackList.find((t=>t.id===e));if(!t||t.isDone)return;t.done();const r=cr.cloneClass(t);r.id=this._endId(e),r.flag=1,r.desc=`${t.desc} | end`,this.__trackList.push(r)}getTrack(e){return this.__trackList.find((t=>t.id===e))}getLine(e){if(!e||e.endsWith("-end"))return[];const t=this.__trackList.findIndex((t=>t.id===e));if(t<0)return[];const r=this._endId(e),n=this.__trackList.findIndex((e=>e.id===r)),s=n<0?this.__trackList.length-t:n-t+1;return nn.take(this.__trackList,s,t)}getList(e,t=""){if(!e)return[];const r=this.__trackList.filter((t=>t.name===e));if(r.length<=0)return[];if(!t)return r;const n=this._endId(t);return this.__trackList.filter((e=>e.id===t||e.id===n))}get list(){return this.__trackList}get size(){return this.__trackList.length}_endId=e=>`${e}-end`;report(e){const t=this.list;if(!t||t.length<=0)return;const r=t[0].time;t.forEach((t=>e&&e(t,r)))}},Ts={cdn:ws,watermark:(e,t)=>new $s(e,t)},qs={Store:ks,storeRef:Cs,Persist:Ss,persistConfig:(e,t,r)=>({key:e,fields:t,storage:r})},Bs=Os,Ls=Ps,Rs=As;export{f as Event,h as KValue,d as Mapping,Ts as dCdn,Wr as dHook,Bs as dJoker,Rs as dLogger,Xn as dMini,bs as dNode,qs as dStore,Ls as dTracker,On as dUtil,os as dWeb};
|