ddan-js 2.8.6 → 2.8.7
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.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/index.js +7 -4
- package/bin/lib/modules/node/socks5.js +14 -2
- package/bin/types/index.d.ts +37 -2
- package/bin/types/modules/node/socks5.d.ts +4 -1
- package/package.json +1 -1
package/bin/ddan-js.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"crypto";var t={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)}};const r="0123456789",n="abcdefghijklmnopqrstuvwxyz",s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var i={keyNumber:r,keyLower:n,keyUpper:s,keyChars:r+n+s};const o=(e=0,t=0)=>{const r=i.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 a{__map;__tagList;__eventId="";constructor(){this.__map=new Map,this.__tagList=[],this.__eventId=o()}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 c{_loopTimer;_event=new a;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 u={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class l{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/u.oneSecond);let r=t.countdown;t.d=Math.floor(r/u.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=u.oneDay,t.h=Math.floor(r/u.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=u.oneHour,t.m=Math.floor(r/u.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=u.oneMinute,t.s=Math.floor(r/u.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=u.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>u.oneHour?"hh:mm:ss":t.countdown>u.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 f=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?h(r).format(t):""},h=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new l(t||0)};function d({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(f(Date.now(),o)).getTime()}var p={...u,now:function(){return h(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:d,todayZero:()=>d({}),format:f,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return h(r).toCountdown(t)},dtime:h,loopFrame:(e=500)=>new c(e),getTimezoneOffset:()=>l.timezoneOffset,getLocalTime:l.getLocalTime};const g="object"==typeof global&&null!==global&&global.Object===Object&&global,y="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,m="object"==typeof self&&null!==self&&self.Object===Object&&self,w=y||g||m||Function("return this")(),b=w.Symbol,{toString:v,hasOwnProperty:_,propertyIsEnumerable:A}=Object.prototype,x=b?b.toStringTag:void 0;function k(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=v.call(e);return n&&(t?e[x]=r:delete e[x]),s}(e):v.call(e)}var S={getTag:k,getType:function(e){return(k(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:v,hasOwnProperty:_,propertyIsEnumerable:A};const C="object"==typeof exports&&null!==exports&&!exports.nodeType&&exports,$=C&&"object"==typeof module&&null!==module&&!module.nodeType&&module,j=$&&$.exports===C&&g.process,O=(()=>{try{const e=$&&$.require&&$.require("util").types;return e||j&&j.binding&&j.binding("util")}catch(e){}})();var E="[object Function]",q="[object GeneratorFunction]",B="[object AsyncFunction]",T=9007199254740991;const L=/^(?:0|[1-9]\d*)$/,F=w?.Buffer?.isBuffer,P=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,R=O&&O.isTypedArray;function M(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function I(e){return null!=e&&"object"==typeof e}const D=Array.isArray;function U(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=T}(e.length)&&!z(e)}function K(e){return I(e)&&U(e)}function z(e){var t=M(e)?S.getTag(e):"";return t===E||t===q||t===B}function N(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function V(e){return K(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,W="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,Z=R?e=>R(e):e=>I(e)&&P.test(S.getTag(e)),Q="function"==typeof F?F:()=>!1;var G={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)&&I(e)&&"[object String]"==S.getTag(e)},isObject:M,isObjectLike:I,isPlainObject:function(e){if(!I(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||I(e)&&"[object Symbol]"===S.getTag(e)},isFunction:z,isArray:D,isArrayLikeObject:K,isIndex:function(e,t){return!!(t=null==t?T:t)&&("number"==typeof e||L.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:U,isPrototype:N,isArguments:V,isPromise:function(e){return"[object Promise]"===(M(e)?S.getTag(e):"")},isBrowser:H,isNode:W,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(U(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||Q(e)||Z(e)||V(e)))return!e.length;const t=S.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(N(e))return!Object.keys(e).length;for(const t in e)if(S.hasOwnProperty.call(e,t))return!1;return!0}};const J=NaN,Y=/^\s+|\s+$/g,X=/^[-+]0x[0-9a-f]+$/i,ee=/^0b[01]+$/i,te=/^0o[0-7]+$/i,re=parseInt,ne=1/0,se=17976931348623157e292;function ie(e){if("number"==typeof e)return e;if(G.isSymbol(e))return J;if(G.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=G.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Y,"");const t=ee.test(e);return t||te.test(e)?re(e.slice(2),t?2:8):X.test(e)?J:+e}function oe(e){return e?(e=ie(e))===ne||e===-ne?(e<0?-1:1)*se:e==e?e:0:0===e?e:0}var ae={toNumber:ie,toFinite:oe,toInteger:function(e){var t=oe(e),r=t%1;return t==t?r?t-r:t:0}};const ce="Expected a function",ue=Math.max,le=Math.min;function fe(e,t=300,r={}){let n,s,i,o,a,c,u=0,l=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(ce);function d(t){const r=n,i=s;return n=s=void 0,u=t,o=e.apply(i,r),o}function p(e){const r=e-c;return void 0===c||r>=t||r<0||f&&e-u>=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-u)):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 u=e,a=setTimeout(g,t),l?d(e):o}(c);if(f)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=ae.toNumber(t)||0,G.isObject(r)&&(l=!!r.leading,f="maxWait"in r,i=f?ue(ae.toNumber(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h),m.cancel=function(){void 0!==a&&clearTimeout(a),u=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 he{__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(G.isFunction(e))r=e(t);else{if(G.isPromise(e))return e.then((e=>({...t,...e})));r=e}return G.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 de(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const pe=(e,t)=>{try{let r;return r=G.isFunction(e)?e():e,de(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},ge=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var ye={to:de,go:(e,t)=>pe(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:pe,toError:ge,timeout:(e,t=0,r="timeout")=>{if(t<=0)return pe(e);let n;function s(){n&&clearTimeout(n)}const i=new Promise((e=>{s(),n=setTimeout((()=>e([ge(r||"timeout"),void 0])),t)}));return Promise.race([pe(e,s),i])}};class me{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var we={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 me;return void 0!==e&&t.set(e),t}};class be{_func;_callback;constructor(e,t){this._func=e,this._callback=t}async run(){return ye.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class ve{__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 ye.delay(100),this._step()}return this.clear()}}class _e extends(we.singleton()){__lockedMap=new Map;pipeline=new ve;constructor(){super()}lock(e,t){if(!e||!t)return;const r=ye.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 ye.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return ye.safeRun(e);const s=await n;return this.unlock(t),s}}var Ae={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 ke={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",u=0;for(e=Ae.toUtf8(e);u<e.length;)t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u++),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="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)s=xe.indexOf(e.charAt(u++)),i=xe.indexOf(e.charAt(u++)),o=xe.indexOf(e.charAt(u++)),a=xe.indexOf(e.charAt(u++)),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=Ae.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",u=0;if(!e||!G.isArrayLike(e)||!G.isUint8Array(e))return"";for(;u<e.length;)t=e[u++],r=e[u++],n=e[u++],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=[],u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)s=xe.indexOf(e.charAt(u++)),i=xe.indexOf(e.charAt(u++)),o=xe.indexOf(e.charAt(u++)),a=xe.indexOf(e.charAt(u++)),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 Ce(e,t=10){return+parseFloat(Number(e).toExponential(t))}const $e=180/Math.PI;var je={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:Ce,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=Ce(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*$e},degree2radian:function(e){return e/$e},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||!G.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 Ee={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)}};const qe=(e,t=!1)=>{const r=new Uint8Array(e);return t?ke.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Be={...Oe,...Ee,...Ae,...ke,str2ab:(e="",t=!1)=>{if(t)return ke.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:qe,utf8ToBase64:e=>G.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>G.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]=je.random(256);return t},textEncode:e=>Ae.toUtf8Bytes(e),textDecode:e=>Ae.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+ke.toBase64(e):G.isArrayBuffer(e)?`data:${t};base64,`+qe(e,!0):"":""};const Te=e=>{try{const t=Be.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},Le=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Fe={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=Te(r),s=Le(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=Te(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:Le(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:Le,format_pem_content:Te,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Be.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=Be.concatBytes(...i);return Be.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Be.base64ToBytes(t),s=await e.importKey("pkcs8",Be.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=Be.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const Pe=()=>e.webcrypto.subtle;var Re=async e=>Fe.encrypt(Pe(),e,Fe.RSAPublicKey),Me=async e=>Fe.decrypt(Pe(),e,Fe.RSAPrivateKey);const Ie="undefined"!=typeof window?window.crypto.subtle:{};var De={generateKeys:()=>Fe.generateKeys(Ie),encrypt:async(e,t)=>Fe.encrypt(Ie,e,t),decrypt:async(e,t)=>Fe.decrypt(Ie,e,t),encode:async e=>Fe.encrypt(Ie,e,Fe.RSAPublicKey),decode:async e=>Fe.decrypt(Ie,e,Fe.RSAPrivateKey)};const Ue=2654435769,Ke=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+Ue>>>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},ze=(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-Ue>>>0;return e},Ne=e=>{const t=Be.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},Ve=(e,t)=>{const r=Be.pkcs7Padding(e,8),n=Ne(t),s=[];for(let e=0;e<r.length;e+=8){const t=Be.bytesToUint32(r.slice(e,e+8)),i=Ke(t,n);s.push(Be.uint32ToBytes(i))}return Be.concatBytes(...s)},He=(e,t)=>{const r=Ne(t),n=[];for(let t=0;t<e.length;t+=8){const s=Be.bytesToUint32(e.slice(t,t+8)),i=ze(s,r);n.push(Be.uint32ToBytes(i))}const s=Be.concatBytes(...n);return Be.pkcs7Unpadding(s)};var We={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:Ke,decrypt:ze,toTeaKey:Ne,encode:(e,t)=>{const r=Be.textEncode(e),n=Ve(r,t);return Be.bytesToBase64(n)},decode:(e,t)=>{const r=Be.base64ToBytes(e),n=He(r,t);return Be.textDecode(n.buffer)},encodeBytes:Ve,decodeBytes:He};function Ze(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 Qe=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function Ge(e){return Qe.test(e)}const Je="\\ud800-\\udfff",Ye=`[${Je}]`,Xe="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",et="\\ud83c[\\udffb-\\udfff]",tt=`[^${Je}]`,rt="(?:\\ud83c[\\udde6-\\uddff]){2}",nt="[\\ud800-\\udbff][\\udc00-\\udfff]",st=`${`(?:${Xe}|${et})`}?`,it="[\\ufe0e\\ufe0f]?",ot=it+st+`(?:\\u200d(?:${[tt,rt,nt].join("|")})${it+st})*`,at=`(?:${[`${tt}${Xe}?`,Xe,rt,nt,Ye].join("|")})`,ct=RegExp(`${et}(?=${et})|${at+ot}`,"g");function ut(e){return Ge(e)?function(e){return e.match(ct)||[]}(e):function(e){return e.split("")}(e)}function lt(e){return t=>{if(!t)return"";const r=Ge(t)?ut(t):void 0,n=r?r[0]:t[0],s=r?Ze(r,1).join(""):t.slice(1);return n[e]()+s}}const ft="\\ud800-\\udfff",ht="\\u2700-\\u27bf",dt="a-z\\xdf-\\xf6\\xf8-\\xff",pt="A-Z\\xc0-\\xd6\\xd8-\\xde",gt="\\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",yt="['’]",mt=`[${gt}]`,wt=`[${ht}]`,bt=`[${dt}]`,vt=`[^${ft}${gt+"\\d"+ht+dt+pt}]`,_t="(?:\\ud83c[\\udde6-\\uddff]){2}",At="[\\ud800-\\udbff][\\udc00-\\udfff]",xt=`[${pt}]`,kt=`(?:${bt}|${vt})`,St=`(?:${xt}|${vt})`,Ct=`(?:${yt}(?:d|ll|m|re|s|t|ve))?`,$t=`(?:${yt}(?:D|LL|M|RE|S|T|VE))?`,jt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Ot="[\\ufe0e\\ufe0f]?",Et=Ot+jt+`(?:\\u200d(?:${[`[^${ft}]`,_t,At].join("|")})${Ot+jt})*`,qt=`(?:${[wt,_t,At].join("|")})${Et}`,Bt=RegExp([`${xt}?${bt}+${Ct}(?=${[mt,xt,"$"].join("|")})`,`${St}+${$t}(?=${[mt,xt+kt,"$"].join("|")})`,`${xt}?${kt}+${Ct}`,`${xt}+${$t}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",qt].join("|"),"g");const Tt=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 ]/),Lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ft(e,t){if(void 0===t){const t=Tt(e)?function(e){return e.match(Bt)}(e):function(e){return e.match(Lt)}(e);return t||[]}return e.match(t)||[]}function Pt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Pt(e)))}`;if(G.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Rt=lt("toUpperCase"),Mt=lt("toLowerCase");var It={toString:Pt,startCase:e=>Ft(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Rt(t)),""),snakeCase:e=>Ft(Pt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>Ft(Pt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>Ft(Pt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Rt(t):t))),""),upperCase:e=>Ft(Pt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Rt,lowerCase:e=>Ft(Pt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Mt,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}}};var Dt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":We.encode(t,Be.hex2str(We.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=We.decode(e,Be.hex2str(We.TEAKey));return It.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return G.isBrowser?await De.encode(t):await Re(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=G.isBrowser?await De.decode(e):await Me(e);return It.jsonFormat(t)}catch(e){return""}}};var Ut={...ye,...Dt,sleep:ye.delay,run:async function(e,t=0){if(t<=0)return ye.safeRun(e);const r=t>0?Date.now():0,n=await ye.safeRun(e),s=Date.now()-r;return s<t&&await ye.delay(t-s),n},exec:(e,t="")=>_e.I.exec(e,t),debounce:fe,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return G.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),fe(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new he(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 ye.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await ye.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>_e.I.pipeline.push(e,t),pipeline:(e=1)=>new ve(e),safeTask:(e,t)=>new be(e,t)};function Kt(e){return e!=e}function zt(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 Nt,Vt,Ht=(Nt=Object.keys,Vt=Object,function(e){return Nt(Vt(e))}),Wt=Math.max;function Zt(e,t){var r=G.isArray(e)||G.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||G.isIndex(i,n))||r.push(i);return r}const Qt=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]=Qt(e[r]));return t};const Gt=(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]=Jt(e[o],a,r)}return n},Jt=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?Gt(e,t,r):Gt({...e},t,r),n},Yt=(e,t,r={})=>Gt({...e},t,{cover:!0,...r}),Xt=(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=>{Xt(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&Xt(e,t,r,n,s)},get:()=>i})};var er={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:It.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:Qt,merge:Jt,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]=It.parseValue(n,{number:t,boolean:r});else e[n]=It.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:Yt,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=Yt(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:Xt,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};var tr={...G,...S,...er,...we,includes:function(e,t,r,n){e=G.isArrayLike(e)?e:function(e){return e?zt(e,function(e){return G.isArrayLike(e)?Zt(e):function(e){if(!G.isPrototype(e))return Ht(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?ae.toInteger(r):0;var s=e.length;return r<0&&(r=Wt(s+r,0)),G.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,Kt,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(G.isObject(e)&&(r=G.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var rr={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]:[]}};var nr={...rr,stepAction:function(e,t,r=100){if(!G.isFunction(t))return;if(!G.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(!G.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!G.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!G.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return je.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!G.isObject(e))return;const s=e[t];(G.isString(s)&&""!==s||G.isNumber(s))&&(n[s]=e[r])})),n):n}};const sr="[object Object]",ir="[object Array]",or=e=>Object.prototype.toString.call(e),ar=(e,t,r=!1)=>{if(e===t)return;const n=or(e);if(n===or(t))if(n===ir&&e.length>=t.length)for(let r=0;r<t.length;r++)ar(e[r],t[r]);else if(n===sr&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?ar(e[n],t[n]):e[n]=null},cr=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=or(e),o=or(t);if(i===ir&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)cr(e[s],t[s],r,`${n}[${s}]`);else if(i===sr&&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=or(s),c=or(o);if(s!==o)if(a===ir&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)cr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===sr&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)cr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class ur{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 lr{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new ur,response:new ur};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){lr.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete lr.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=er.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(lr.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await lr.requestLock[lr.blockId].request;else if(lr.requestLock[lr.blockId]&&lr.requestLock[lr.blockId].lock&&await lr.requestLock[lr.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),lr.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await lr.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 fr=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var hr={diff:function(e,t){const r={};return(e=>{if(or(e)===sr)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];or(n[t])!==sr&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),ar(e,t,!0),cr(e,t,r,"",!0),r},promixify:fr,run:(e,t={})=>e?Ut.run(fr(e)(t)):Ut.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:lr,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;er.observe(s,o,a,e,c)}))}};const dr=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 u=/\+/g,l=n||1e3;let f=(e=e.split(t)).length;l>0&&f>l&&(f=l);for(let t=0;t<f;++t){let n,o,a,l,f=e[t].replace(u,"%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,l=i?decodeURIComponent(o):o,S.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(l):c[a]=[c[a],l]:c[a]=l}return er.parseValue(c,{number:o,boolean:a}),c},pr=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},gr=function(e,t=!0){return t?encodeURIComponent(e):e},yr=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},mr=/^(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}},br=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(mr);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 _r={parse:dr,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=gr(pr(n),s)+r,u=e[n];return Array.isArray(u)?u.map((function(e){return c+gr(pr(e),s)})).join(t):yr(u,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+gr(pr(u),s)})).filter(Boolean).join(t):n?gr(pr(n),s)+r+gr(pr(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=br(e),{origin:r="",url:n="",query:s=""}=t,i=wr(n),o=dr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:wr,parseHost:br,join:(...e)=>{let t=[];return e.forEach((e=>{const r=e.trim().replace(/^\/*(.*?)\/*$/,"$1");r.length<=0||(/^(\w+):\/\//.test(r)?t=[r]:t.push(r))})),t.join("/")},shExpMatch:vr,isLocalIpAddress:e=>!!e&&!!(vr(e,"127.0.0.1")||vr(e,"localhost")||vr(e,"192.168.*.*"))};const Ar=/%[sdj%]/g;let xr=()=>{};function kr(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 Sr(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(Ar,(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 Cr(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 $r(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&&(xr=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class jr extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function Or(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);$r(o,r,(e=>(n(e),e.length?i(new jr(e,kr(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 u=[],l=new Promise(((t,l)=>{const f=e=>{if(u.push.apply(u,e),c++,c===a)return n(u),u.length?l(new jr(u,kr(u))):t(s)};o.length||(n(u),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?$r(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 l.catch((e=>e)),l}function Er(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],function(e){return!(!e||void 0===e.message)}(r)?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField}}}function qr(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 Br=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!Cr(t,i||e.type)||n.push(Sr(s.messages.required,e.fullField))};let Tr;const Lr=/^(([^<>()\[\]\\.,;:\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,}))$/,Fr=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,Pr={integer:e=>Pr.number(e)&&parseInt(e,10)===e,float:e=>Pr.number(e)&&!Pr.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&&!Pr.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(Lr),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(Tr)return Tr;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 u=c.v4().source,l=c.v6().source;return Tr=new RegExp(`(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${u}|${l}|(?:(?:[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"),Tr})()),hex:e=>"string"==typeof e&&!!e.match(Fr)},Rr="enum";var Mr={required:Br,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(Sr(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void Br(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?Pr[i](t)||n.push(Sr(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(Sr(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 u=t,l="";const f="number"==typeof t,h="string"==typeof t,d=Array.isArray(t);if(f?l="number":h?l="string":d&&(l="array"),!l)return!1;d&&(u=t.length),h&&(u=t.replace(c,"_").length),i?u!==e.len&&n.push(Sr(s.messages[l].len,e.fullField,e.len)):o&&!a&&u<e.min?n.push(Sr(s.messages[l].min,e.fullField,e.min)):a&&!o&&u>e.max?n.push(Sr(s.messages[l].max,e.fullField,e.max)):o&&a&&(u<e.min||u>e.max)&&n.push(Sr(s.messages[l].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[Rr]=Array.isArray(e[Rr])?e[Rr]:[],-1===e[Rr].indexOf(t)&&n.push(Sr(s.messages[Rr],e.fullField,e[Rr].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(Sr(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(Sr(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const Ir=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(Cr(t,i)&&!e.required)return r();Mr.required(e,t,n,o,s,i),Cr(t,i)||Mr.type(e,t,n,o,s)}r(o)};var Dr={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(Cr(t,"string")&&!e.required)return r();Mr.required(e,t,n,i,s,"string"),Cr(t,"string")||(Mr.type(e,t,n,i,s),Mr.range(e,t,n,i,s),Mr.pattern(e,t,n,i,s),!0===e.whitespace&&Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&Mr.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),Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&(Mr.type(e,t,n,i,s),Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),Cr(t)||Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&(Mr.type(e,t,n,i,s),Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&(Mr.type(e,t,n,i,s),Mr.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();Mr.required(e,t,n,i,s,"array"),null!=t&&(Mr.type(e,t,n,i,s),Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s),void 0!==t&&Mr.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(Cr(t,"string")&&!e.required)return r();Mr.required(e,t,n,i,s),Cr(t,"string")||Mr.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(Cr(t,"date")&&!e.required)return r();if(Mr.required(e,t,n,i,s),!Cr(t,"date")){let r;r=t instanceof Date?t:new Date(t),Mr.type(e,r,n,i,s),r&&Mr.range(e,r.getTime(),n,i,s)}}r(i)},url:Ir,hex:Ir,email:Ir,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;Mr.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(Cr(t)&&!e.required)return r();Mr.required(e,t,n,i,s)}r(i)}};function Ur(){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 Kr=Ur();class zr{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");Dr[e]=t};static warning=xr;static messages=Kr;static validators=Dr;rules={};_messages=Kr;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=qr(Ur(),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===Kr&&(e=Ur()),qr(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 Or(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 u(i=[]){let u=Array.isArray(i)?i:[i];!0===s.suppressWarning&&u.length&&zr.warning("async-validator:",u),u.length&&void 0!==r.message&&(u=[].concat(r.message));let l=u.map(Er(r,n));if(s.first&&l.length)return a[r.field]=1,t(l);if(o){if(r.required&&!e.value)return void 0!==r.message?l=[].concat(r.message).map(Er(r,n)):s.error&&(l=[s.error(r,Sr(s.messages.required,r.field))]),t(l);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 zr(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=[];l&&l.length&&r.push(...l),e&&e.length&&r.push(...e),t(r.length?r:null)}))}else t(l)}if(o=o&&(r.required||!r.required&&e.value),r.field=e.field,r.asyncValidator)i=r.asyncValidator(r,e.value,u,e.source,s);else if(r.validator){try{i=r.validator(r,e.value,u,e.source,s)}catch(e){console.error?.(e),s.suppressValidatorError||setTimeout((()=>{throw e}),0),u(e.message)}!0===i?u():!1===i?u("function"==typeof r.message?r.message(r.fullField||r.field):r.message||`${r.fullField||r.field} fails`):i instanceof Array?u(i):i instanceof Error&&u(i.message)}i&&i.then&&i.then((()=>u()),(e=>u(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=kr(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&&!Dr.hasOwnProperty(e.type))throw new Error(Sr("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]?Dr.required:Dr[this.getType(e)]||void 0}}function Nr(e){return new zr(e)}var Vr={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:Nr,validate:function(e,t,r={},n=(()=>{})){return Ut.run(Nr(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)}};var Hr={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})$/}};const Wr=e=>ke.toBase64(e);var Zr={encode:Wr,decode:e=>ke.fromBase64(e),encodeByOss:e=>Wr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var Qr={...i,base64:Zr,tea:We,uuid:o,guid:(e,t=!1,r="")=>{const n=o(e||32);return t?p.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=i.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 Gr=e=>{if(!e)return"";if(!tr.isObject(e))return"";let t="";return tr.forof(e,((e,r)=>{r&&(t+=`${It.kebabCase(e)}:${r};`)})),t},Jr=["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"],Yr=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],Xr=(e,t="px")=>e&&t?"0"===e?e:Vr.isFloat(e.toString())?`${e}${t}`:e:e;var en={stringify:Gr,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=_r.parse(e,{sep:";",eq:":",uri:!1}),s={};return tr.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:It.camelCase(e):e;Vr.isFloat(n)||n.length>=2&&n.startsWith(".")&&Vr.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:Xr,style:(e,t="px")=>{if(!e)return"";const r=tr.copy(e,{fields:Jr});tr.forof(r,((e,n)=>{(Yr.includes(e)||Yr.includes(It.camelCase(e)))&&(r[e]=Xr(n,t))}));return Gr(r)},commonFields:Jr};const tn=(e,t="",r=!1)=>{try{if(!e)return;const n=_r.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}?${_r.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){rn(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},rn=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;tn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},nn=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}},sn=(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)))})),on=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e;var an={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:tn,download:(e,t="")=>{e&&("string"!=typeof e?rn(e,t):tn(e,t))},downloadFile:rn,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();tn(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 u=c.getContext("2d");return u?(n&&u.rotate(n*Math.PI/180),s&&(u.fillStyle=s),i&&(u.font=i),o&&(u.textAlign=o),a&&(u.textBaseline=a),u.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?sn("clipboard-write").then((t=>{on(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(nn(e)))):r(nn(e))})).catch((()=>{r(nn(e))})):r(nn(e))})),queryPermission:sn,isAllowed:on,legacyCopy:nn};var cn={ossImage:(e,t={})=>{if(!e)return e;const r=_r.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=nr.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=_r.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=>ke.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const un=({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 ln(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function fn(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(tr.isPlainObject(e)){const r=_r.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 hn{host="";reqConfig={};handleError;interceptors={request:new ur,response:new ur};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(fn),this.interceptors.response.use(e.handleResponse||ln),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){hn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete hn.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=tr.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(hn.blockId,(()=>un(s))),i=await hn.requestLock[hn.blockId].request;else if(hn.requestLock[hn.blockId]&&hn.requestLock[hn.blockId].lock&&await hn.requestLock[hn.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),hn.requestLock[e]||this.lockR(e,(()=>un(s))),i=await hn.requestLock[e].request,this.unlockR(e)}else i=await un(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)}}}const dn={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},pn=e=>(...t)=>{const r=console[e];dn.overrode?r(...t):gn(r,e,...t)},gn=(e,t,...r)=>{const n=p.format(new Date,dn.format),s=dn.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 yn={override:()=>{if(dn.overrode)return;dn.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{gn(t,e,...r)}}))},log:pn("log"),info:pn("info"),warn:pn("warn"),error:pn("error"),config:({tag:e=dn.tag,format:t=dn.format}={})=>{dn.tag=e,dn.format=t}};var mn={getDataURL:e=>{const t={contentType:"",dataUrl:""};return ye.to(fetch(e).then((e=>(t.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(t.dataUrl=`data:${t.contentType};base64,`+Be.ab2str(e,!0),t))))},getArrayBuffer:async e=>ye.to(fetch(e).then((e=>e.arrayBuffer()))),getJson:async e=>ye.to(fetch(e).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=je.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=>ye.to(fetch(e).then((e=>e.text())))};const wn=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,${Zr.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}`}},bn=(e,t,r)=>({key:e,fields:t,storage:r});class vn{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=Ut.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=er.copy(e,{fields:this.fields});this.save(r)}}class _n extends a{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!G.isFunction(n))return;const[,s]=await Ut.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=er.copy(t);else{const[,t]=await Ut.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){G.isObject(t)&&(t=er.copy(t)),this[e]=t}}const An=(e,t)=>{const r=Object.assign(new _n,e||{});r.__persist=new vn(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 G.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(G.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 xn{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=_r.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=_r.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=Qr.base64.encodeByOss(n),i=_r.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=Qr.base64.encodeByOss(e),i=_r.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}const kn=(e,t)=>new xn(e,t);class Sn{__list=[];constructor(){this.clear()}add(e){const t=Ut.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 Cn=new class{state=An(new _n);frame=new c;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||p.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&&!p.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=tr.copy(r);tr.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||p.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new Sn};class $n{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=o(),this.start=Date.now(),this.timeStartDesc=p.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=p.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const jn=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 $n;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=er.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 nr.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)))}};var On={Ecdh:class{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 Be.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Be.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=Be.base64ToBytes(r),s=Be.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Be.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Be.base64ToBytes(r):Be.getRandomBytes(12),s=Be.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Be.concatBytes(new Uint8Array(i),n);return Be.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Be.base64ToBytes(e),s=Be.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Be.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Be.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 Be.textDecode(s)}}};class En{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 qn{_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 En(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)}}}let Bn;if("undefined"!=typeof window){Bn={...require("./modules/node")}}else Bn={};const Tn={gbk:t,math:je,list:nr,string:It,time:p,obj:er,rule:Vr,regex:Hr,...Be,...Qr,...tr,Event:a},Ln=tr.singleton,Fn={...Be,...Qr,...Ut,...It,...je,qs:_r,singleton:Ln},Pn={mini:hr,css:en,qs:_r,icon:wn,html:an},Rn={cdn:cn,watermark:kn},Mn={Store:_n,storeRef:An,Persist:vn,persistConfig:bn},In=Cn,Dn=jn,Un=yn,Kn={fetch:mn,Http:hn,css:en,qs:_r,icon:wn,html:an,rsa:De,...On};var zn={gbk:t,time:p,hook:Ut,math:je,util:tr,list:nr,string:It,obj:er,crypto:Qr,mini:hr,qs:_r,css:en,cdn:cn,html:an,icon:wn,rule:Vr,regex:Hr,convert:Be,KValue:En,Mapping:qn,Event:a,Http:hn,Store:_n,storeRef:An,Persist:vn,persistConfig:bn,watermark:kn,joker:Cn,tracker:jn,logger:yn,fetch:mn,rsa:De};export{a as Event,En as KValue,qn as Mapping,Rn as dCdn,Fn as dHook,In as dJoker,Un as dLogger,Pn as dMini,Bn as dNode,Mn as dStore,Dn as dTracker,Tn as dUtil,Kn as dWeb,zn as default};
|
|
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";var o={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)}};const a="0123456789",c="abcdefghijklmnopqrstuvwxyz",l="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var u={keyNumber:a,keyLower:c,keyUpper:l,keyChars:a+c+l};const h=(e=0,t=0)=>{const r=u.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=h()}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 d{_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 p={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class g{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/p.oneSecond);let r=t.countdown;t.d=Math.floor(r/p.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=p.oneDay,t.h=Math.floor(r/p.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=p.oneHour,t.m=Math.floor(r/p.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=p.oneMinute,t.s=Math.floor(r/p.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=p.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>p.oneHour?"hh:mm:ss":t.countdown>p.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 y=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?m(r).format(t):""},m=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new g(t||0)};function w({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(y(Date.now(),o)).getTime()}var b={...p,now:function(){return m(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:w,todayZero:()=>w({}),format:y,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return m(r).toCountdown(t)},dtime:m,loopFrame:(e=500)=>new d(e),getTimezoneOffset:()=>g.timezoneOffset,getLocalTime:g.getLocalTime};const _="object"==typeof global&&null!==global&&global.Object===Object&&global,v="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,x="object"==typeof self&&null!==self&&self.Object===Object&&self,A=v||_||x||Function("return this")(),S=A.Symbol,{toString:k,hasOwnProperty:C,propertyIsEnumerable:$}=Object.prototype,O=S?S.toStringTag:void 0;function E(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":O&&O in Object(e)?function(e){const t=C.call(e,O),r=e[O];let n=!1;try{e[O]=void 0,n=!0}catch(e){}const s=k.call(e);return n&&(t?e[O]=r:delete e[O]),s}(e):k.call(e)}var j={getTag:E,getType:function(e){return(E(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:k,hasOwnProperty:C,propertyIsEnumerable:$};const P="object"==typeof exports&&null!==exports&&!exports.nodeType&&exports,T=P&&"object"==typeof module&&null!==module&&!module.nodeType&&module,q=T&&T.exports===P&&_.process,B=(()=>{try{const e=T&&T.require&&T.require("util").types;return e||q&&q.binding&&q.binding("util")}catch(e){}})();var L="[object Function]",F="[object GeneratorFunction]",R="[object AsyncFunction]",I=9007199254740991;const U=/^(?:0|[1-9]\d*)$/,D=A?.Buffer?.isBuffer,M=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,K=B&&B.isTypedArray;function z(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function N(e){return null!=e&&"object"==typeof e}const H=Array.isArray;function V(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=I}(e.length)&&!Z(e)}function W(e){return N(e)&&V(e)}function Z(e){var t=z(e)?j.getTag(e):"";return t===L||t===F||t===R}function Y(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function Q(e){return W(e)&&j.hasOwnProperty.call(e,"callee")&&(!j.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==j.toString.call(e))}const G="undefined"!=typeof window&&void 0!==window.document,J="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,X=K?e=>K(e):e=>N(e)&&M.test(j.getTag(e)),ee="function"==typeof D?D:()=>!1;var te={is:function(e,t){return j.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===j.getTag(e)},isString:function(e){return"string"==typeof e||!H(e)&&N(e)&&"[object String]"==j.getTag(e)},isObject:z,isObjectLike:N,isPlainObject:function(e){if(!N(e)||"[object Object]"!=j.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||N(e)&&"[object Symbol]"===j.getTag(e)},isFunction:Z,isArray:H,isArrayLikeObject:W,isIndex:function(e,t){return!!(t=null==t?I:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:V,isPrototype:Y,isArguments:Q,isPromise:function(e){return"[object Promise]"===(z(e)?j.getTag(e):"")},isBrowser:G,isNode:J,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(V(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||ee(e)||X(e)||Q(e)))return!e.length;const t=j.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(Y(e))return!Object.keys(e).length;for(const t in e)if(j.hasOwnProperty.call(e,t))return!1;return!0}};const re=NaN,ne=/^\s+|\s+$/g,se=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,oe=/^0o[0-7]+$/i,ae=parseInt,ce=1/0,le=17976931348623157e292;function ue(e){if("number"==typeof e)return e;if(te.isSymbol(e))return re;if(te.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=te.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(ne,"");const t=ie.test(e);return t||oe.test(e)?ae(e.slice(2),t?2:8):se.test(e)?re:+e}function he(e){return e?(e=ue(e))===ce||e===-ce?(e<0?-1:1)*le:e==e?e:0:0===e?e:0}var fe={toNumber:ue,toFinite:he,toInteger:function(e){var t=he(e),r=t%1;return t==t?r?t-r:t:0}};const de="Expected a function",pe=Math.max,ge=Math.min;function ye(e,t=300,r={}){let n,s,i,o,a,c,l=0,u=!1,h=!1,f=!0;if("function"!=typeof e)throw new TypeError(de);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||h&&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 h?ge(r,i-(e-l)):r}(e))}function y(e){return a=void 0,f&&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(h)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=fe.toNumber(t)||0,te.isObject(r)&&(u=!!r.leading,h="maxWait"in r,i=h?pe(fe.toNumber(r.maxWait)||0,t):i,f="trailing"in r?!!r.trailing:f),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 me{__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(te.isFunction(e))r=e(t);else{if(te.isPromise(e))return e.then((e=>({...t,...e})));r=e}return te.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 we(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=te.isFunction(e)?e():e,we(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},_e=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var ve={to:we,go:(e,t)=>be(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:be,toError:_e,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([_e(r||"timeout"),void 0])),t)}));return Promise.race([be(e,s),i])}};class xe{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var Ae={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 xe;return void 0!==e&&t.set(e),t}};class Se{_func;_callback;constructor(e,t){this._func=e,this._callback=t}async run(){return ve.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class ke{__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 Se(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 ve.delay(100),this._step()}return this.clear()}}class Ce extends(Ae.singleton()){__lockedMap=new Map;pipeline=new ke;constructor(){super()}lock(e,t){if(!e||!t)return;const r=ve.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 ve.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return ve.safeRun(e);const s=await n;return this.unlock(t),s}}var $e={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 Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Ee={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=$e.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+Oe.charAt(s)+Oe.charAt(i)+Oe.charAt(o)+Oe.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=Oe.indexOf(e.charAt(l++)),i=Oe.indexOf(e.charAt(l++)),o=Oe.indexOf(e.charAt(l++)),a=Oe.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=$e.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",l=0;if(!e||!te.isArrayLike(e)||!te.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+Oe.charAt(s)+Oe.charAt(i)+Oe.charAt(o)+Oe.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=Oe.indexOf(e.charAt(l++)),i=Oe.indexOf(e.charAt(l++)),o=Oe.indexOf(e.charAt(l++)),a=Oe.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 je(e){return Math.floor(Math.random()*e)}function Pe(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Te=180/Math.PI;var qe={random:je,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=je(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:Pe,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=Pe(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Te},degree2radian:function(e){return e/Te},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 Be={bytes2str:e=>{if(!e||!te.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 Le={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return Be.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};const Fe=(e,t=!1)=>{const r=new Uint8Array(e);return t?Ee.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Re={...Be,...Le,...$e,...Ee,str2ab:(e="",t=!1)=>{if(t)return Ee.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:Fe,utf8ToBase64:e=>te.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>te.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]=qe.random(256);return t},textEncode:e=>$e.toUtf8Bytes(e),textDecode:e=>$e.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+Ee.toBase64(e):te.isArrayBuffer(e)?`data:${t};base64,`+Fe(e,!0):"":""};const Ie=e=>{try{const t=Re.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},Ue=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var De={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=Ie(r),s=Ue(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=Ie(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:Ue(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:Ue,format_pem_content:Ie,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Re.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=Re.concatBytes(...i);return Re.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Re.base64ToBytes(t),s=await e.importKey("pkcs8",Re.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=Re.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const Me=()=>e.webcrypto.subtle;var Ke={generateKeys:()=>De.generateKeys(Me()),encrypt:async(e,t)=>De.encrypt(Me(),e,t),decrypt:async(e,t)=>De.decrypt(Me(),e,t),encode:async e=>De.encrypt(Me(),e,De.RSAPublicKey),decode:async e=>De.decrypt(Me(),e,De.RSAPrivateKey)};const ze="undefined"!=typeof window?window.crypto.subtle:{};var Ne={generateKeys:()=>De.generateKeys(ze),encrypt:async(e,t)=>De.encrypt(ze,e,t),decrypt:async(e,t)=>De.decrypt(ze,e,t),encode:async e=>De.encrypt(ze,e,De.RSAPublicKey),decode:async e=>De.decrypt(ze,e,De.RSAPrivateKey)};const He=2654435769,Ve=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+He>>>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},We=(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-He>>>0;return e},Ze=e=>{const t=Re.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},Ye=(e,t)=>{const r=Re.pkcs7Padding(e,8),n=Ze(t),s=[];for(let e=0;e<r.length;e+=8){const t=Re.bytesToUint32(r.slice(e,e+8)),i=Ve(t,n);s.push(Re.uint32ToBytes(i))}return Re.concatBytes(...s)},Qe=(e,t)=>{const r=Ze(t),n=[];for(let t=0;t<e.length;t+=8){const s=Re.bytesToUint32(e.slice(t,t+8)),i=We(s,r);n.push(Re.uint32ToBytes(i))}const s=Re.concatBytes(...n);return Re.pkcs7Unpadding(s)};var Ge={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:Ve,decrypt:We,toTeaKey:Ze,encode:(e,t)=>{const r=Re.textEncode(e),n=Ye(r,t);return Re.bytesToBase64(n)},decode:(e,t)=>{const r=Re.base64ToBytes(e),n=Qe(r,t);return Re.textDecode(n.buffer)},encodeBytes:Ye,decodeBytes:Qe};function Je(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 Xe=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function et(e){return Xe.test(e)}const tt="\\ud800-\\udfff",rt=`[${tt}]`,nt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",st="\\ud83c[\\udffb-\\udfff]",it=`[^${tt}]`,ot="(?:\\ud83c[\\udde6-\\uddff]){2}",at="[\\ud800-\\udbff][\\udc00-\\udfff]",ct=`${`(?:${nt}|${st})`}?`,lt="[\\ufe0e\\ufe0f]?",ut=lt+ct+`(?:\\u200d(?:${[it,ot,at].join("|")})${lt+ct})*`,ht=`(?:${[`${it}${nt}?`,nt,ot,at,rt].join("|")})`,ft=RegExp(`${st}(?=${st})|${ht+ut}`,"g");function dt(e){return et(e)?function(e){return e.match(ft)||[]}(e):function(e){return e.split("")}(e)}function pt(e){return t=>{if(!t)return"";const r=et(t)?dt(t):void 0,n=r?r[0]:t[0],s=r?Je(r,1).join(""):t.slice(1);return n[e]()+s}}const gt="\\ud800-\\udfff",yt="\\u2700-\\u27bf",mt="a-z\\xdf-\\xf6\\xf8-\\xff",wt="A-Z\\xc0-\\xd6\\xd8-\\xde",bt="\\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",_t="['’]",vt=`[${bt}]`,xt=`[${yt}]`,At=`[${mt}]`,St=`[^${gt}${bt+"\\d"+yt+mt+wt}]`,kt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ct="[\\ud800-\\udbff][\\udc00-\\udfff]",$t=`[${wt}]`,Ot=`(?:${At}|${St})`,Et=`(?:${$t}|${St})`,jt=`(?:${_t}(?:d|ll|m|re|s|t|ve))?`,Pt=`(?:${_t}(?:D|LL|M|RE|S|T|VE))?`,Tt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",qt="[\\ufe0e\\ufe0f]?",Bt=qt+Tt+`(?:\\u200d(?:${[`[^${gt}]`,kt,Ct].join("|")})${qt+Tt})*`,Lt=`(?:${[xt,kt,Ct].join("|")})${Bt}`,Ft=RegExp([`${$t}?${At}+${jt}(?=${[vt,$t,"$"].join("|")})`,`${Et}+${Pt}(?=${[vt,$t+Ot,"$"].join("|")})`,`${$t}?${Ot}+${jt}`,`${$t}+${Pt}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Lt].join("|"),"g");const Rt=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 ]/),It=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ut(e,t){if(void 0===t){const t=Rt(e)?function(e){return e.match(Ft)}(e):function(e){return e.match(It)}(e);return t||[]}return e.match(t)||[]}function Dt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Dt(e)))}`;if(te.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Mt=pt("toUpperCase"),Kt=pt("toLowerCase");var zt={toString:Dt,startCase:e=>Ut(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Mt(t)),""),snakeCase:e=>Ut(Dt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>Ut(Dt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>Ut(Dt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Mt(t):t))),""),upperCase:e=>Ut(Dt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Mt,lowerCase:e=>Ut(Dt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Kt,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}}};var Nt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":Ge.encode(t,Re.hex2str(Ge.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=Ge.decode(e,Re.hex2str(Ge.TEAKey));return zt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return te.isBrowser?await Ne.encode(t):await Ke.encode(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=te.isBrowser?await Ne.decode(e):await Ke.decode(e);return zt.jsonFormat(t)}catch(e){return""}}};var Ht={...ve,...Nt,sleep:ve.delay,run:async function(e,t=0){if(t<=0)return ve.safeRun(e);const r=t>0?Date.now():0,n=await ve.safeRun(e),s=Date.now()-r;return s<t&&await ve.delay(t-s),n},exec:(e,t="")=>Ce.I.exec(e,t),debounce:ye,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return te.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),ye(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new me(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 ve.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await ve.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>Ce.I.pipeline.push(e,t),pipeline:(e=1)=>new ke(e),safeTask:(e,t)=>new Se(e,t)};function Vt(e){return e!=e}function Wt(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 Zt,Yt,Qt=(Zt=Object.keys,Yt=Object,function(e){return Zt(Yt(e))}),Gt=Math.max;function Jt(e,t){var r=te.isArray(e)||te.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&&!j.hasOwnProperty.call(e,i)||s&&("length"==i||te.isIndex(i,n))||r.push(i);return r}const Xt=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]=Xt(e[r]));return t};const er=(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]=tr(e[o],a,r)}return n},tr=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?er(e,t,r):er({...e},t,r),n},rr=(e,t,r={})=>er({...e},t,{cover:!0,...r}),nr=(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=>{nr(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&nr(e,t,r,n,s)},get:()=>i})};var sr={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:zt.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:Xt,merge:tr,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]=zt.parseValue(n,{number:t,boolean:r});else e[n]=zt.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:rr,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=rr(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:nr,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};var ir={...te,...j,...sr,...Ae,includes:function(e,t,r,n){e=te.isArrayLike(e)?e:function(e){return e?Wt(e,function(e){return te.isArrayLike(e)?Jt(e):function(e){if(!te.isPrototype(e))return Qt(e);var t=[];for(var r in Object(e))j.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=Gt(s+r,0)),te.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,Vt,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(te.isObject(e)&&(r=te.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var or={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]:[]}};var ar={...or,stepAction:function(e,t,r=100){if(!te.isFunction(t))return;if(!te.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(!te.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!te.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!te.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return qe.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!te.isObject(e))return;const s=e[t];(te.isString(s)&&""!==s||te.isNumber(s))&&(n[s]=e[r])})),n):n}};const cr="[object Object]",lr="[object Array]",ur=e=>Object.prototype.toString.call(e),hr=(e,t,r=!1)=>{if(e===t)return;const n=ur(e);if(n===ur(t))if(n===lr&&e.length>=t.length)for(let r=0;r<t.length;r++)hr(e[r],t[r]);else if(n===cr&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?hr(e[n],t[n]):e[n]=null},fr=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=ur(e),o=ur(t);if(i===lr&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)fr(e[s],t[s],r,`${n}[${s}]`);else if(i===cr&&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=ur(s),c=ur(o);if(s!==o)if(a===lr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)fr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===cr&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)fr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class dr{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 pr{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new dr,response:new dr};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){pr.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete pr.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=sr.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(pr.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await pr.requestLock[pr.blockId].request;else if(pr.requestLock[pr.blockId]&&pr.requestLock[pr.blockId].lock&&await pr.requestLock[pr.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),pr.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await pr.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 gr=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var yr={diff:function(e,t){const r={};return(e=>{if(ur(e)===cr)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];ur(n[t])!==cr&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),hr(e,t,!0),fr(e,t,r,"",!0),r},promixify:gr,run:(e,t={})=>e?Ht.run(gr(e)(t)):Ht.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:pr,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;sr.observe(s,o,a,e,c)}))}};const mr=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 h=(e=e.split(t)).length;u>0&&h>u&&(h=u);for(let t=0;t<h;++t){let n,o,a,u,h=e[t].replace(l,"%20"),f=h.indexOf(r);f>=0?(n=h.substr(0,f),o=h.substr(f+1)):(n=h,o=""),a=i?decodeURIComponent(n):n,u=i?decodeURIComponent(o):o,j.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(u):c[a]=[c[a],u]:c[a]=u}return sr.parseValue(c,{number:o,boolean:a}),c},wr=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},br=function(e,t=!0){return t?encodeURIComponent(e):e},_r=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},vr=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,xr=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}},Ar=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(vr);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},Sr=(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 kr={parse:mr,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=br(wr(n),s)+r,l=e[n];return Array.isArray(l)?l.map((function(e){return c+br(wr(e),s)})).join(t):_r(l,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+br(wr(l),s)})).filter(Boolean).join(t):n?br(wr(n),s)+r+br(wr(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=Ar(e),{origin:r="",url:n="",query:s=""}=t,i=xr(n),o=mr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:xr,parseHost:Ar,join:(...e)=>{let t=[];return e.forEach((e=>{const r=e.trim().replace(/^\/*(.*?)\/*$/,"$1");r.length<=0||(/^(\w+):\/\//.test(r)?t=[r]:t.push(r))})),t.join("/")},shExpMatch:Sr,isLocalIpAddress:e=>!!e&&!!(Sr(e,"127.0.0.1")||Sr(e,"localhost")||Sr(e,"192.168.*.*"))};const Cr=/%[sdj%]/g;let $r=()=>{};function Or(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 Er(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(Cr,(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 jr(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 Pr(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&&($r=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class Tr extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function qr(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);Pr(o,r,(e=>(n(e),e.length?i(new Tr(e,Or(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 h=e=>{if(l.push.apply(l,e),c++,c===a)return n(l),l.length?u(new Tr(l,Or(l))):t(s)};o.length||(n(l),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?Pr(n,r,h):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,h)}))}));return u.catch((e=>e)),u}function Br(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],function(e){return!(!e||void 0===e.message)}(r)?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField}}}function Lr(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 Fr=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!jr(t,i||e.type)||n.push(Er(s.messages.required,e.fullField))};let Rr;const Ir=/^(([^<>()\[\]\\.,;:\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,}))$/,Ur=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,Dr={integer:e=>Dr.number(e)&&parseInt(e,10)===e,float:e=>Dr.number(e)&&!Dr.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&&!Dr.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(Ir),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(Rr)return Rr;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 Rr=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"),Rr})()),hex:e=>"string"==typeof e&&!!e.match(Ur)},Mr="enum";var Kr={required:Fr,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(Er(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void Fr(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?Dr[i](t)||n.push(Er(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(Er(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 h="number"==typeof t,f="string"==typeof t,d=Array.isArray(t);if(h?u="number":f?u="string":d&&(u="array"),!u)return!1;d&&(l=t.length),f&&(l=t.replace(c,"_").length),i?l!==e.len&&n.push(Er(s.messages[u].len,e.fullField,e.len)):o&&!a&&l<e.min?n.push(Er(s.messages[u].min,e.fullField,e.min)):a&&!o&&l>e.max?n.push(Er(s.messages[u].max,e.fullField,e.max)):o&&a&&(l<e.min||l>e.max)&&n.push(Er(s.messages[u].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[Mr]=Array.isArray(e[Mr])?e[Mr]:[],-1===e[Mr].indexOf(t)&&n.push(Er(s.messages[Mr],e.fullField,e[Mr].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(Er(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(Er(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const zr=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(jr(t,i)&&!e.required)return r();Kr.required(e,t,n,o,s,i),jr(t,i)||Kr.type(e,t,n,o,s)}r(o)};var Nr={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(jr(t,"string")&&!e.required)return r();Kr.required(e,t,n,i,s,"string"),jr(t,"string")||(Kr.type(e,t,n,i,s),Kr.range(e,t,n,i,s),Kr.pattern(e,t,n,i,s),!0===e.whitespace&&Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&Kr.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),jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&(Kr.type(e,t,n,i,s),Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),jr(t)||Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&(Kr.type(e,t,n,i,s),Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&(Kr.type(e,t,n,i,s),Kr.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();Kr.required(e,t,n,i,s,"array"),null!=t&&(Kr.type(e,t,n,i,s),Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s),void 0!==t&&Kr.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(jr(t,"string")&&!e.required)return r();Kr.required(e,t,n,i,s),jr(t,"string")||Kr.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(jr(t,"date")&&!e.required)return r();if(Kr.required(e,t,n,i,s),!jr(t,"date")){let r;r=t instanceof Date?t:new Date(t),Kr.type(e,r,n,i,s),r&&Kr.range(e,r.getTime(),n,i,s)}}r(i)},url:zr,hex:zr,email:zr,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;Kr.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(jr(t)&&!e.required)return r();Kr.required(e,t,n,i,s)}r(i)}};function Hr(){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 Vr=Hr();class Wr{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");Nr[e]=t};static warning=$r;static messages=Vr;static validators=Nr;rules={};_messages=Vr;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=Lr(Hr(),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===Vr&&(e=Hr()),Lr(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 qr(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&&Wr.warning("async-validator:",l),l.length&&void 0!==r.message&&(l=[].concat(r.message));let u=l.map(Br(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(Br(r,n)):s.error&&(u=[s.error(r,Er(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 Wr(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=Or(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&&!Nr.hasOwnProperty(e.type))throw new Error(Er("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]?Nr.required:Nr[this.getType(e)]||void 0}}function Zr(e){return new Wr(e)}var Yr={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:Zr,validate:function(e,t,r={},n=(()=>{})){return Ht.run(Zr(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)}};var Qr={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})$/}};const Gr=e=>Ee.toBase64(e);var Jr={encode:Gr,decode:e=>Ee.fromBase64(e),encodeByOss:e=>Gr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var Xr={...u,base64:Jr,tea:Ge,uuid:h,guid:(e,t=!1,r="")=>{const n=h(e||32);return t?b.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=u.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 en=e=>{if(!e)return"";if(!ir.isObject(e))return"";let t="";return ir.forof(e,((e,r)=>{r&&(t+=`${zt.kebabCase(e)}:${r};`)})),t},tn=["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"],rn=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],nn=(e,t="px")=>e&&t?"0"===e?e:Yr.isFloat(e.toString())?`${e}${t}`:e:e;var sn={stringify:en,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=kr.parse(e,{sep:";",eq:":",uri:!1}),s={};return ir.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:zt.camelCase(e):e;Yr.isFloat(n)||n.length>=2&&n.startsWith(".")&&Yr.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:nn,style:(e,t="px")=>{if(!e)return"";const r=ir.copy(e,{fields:tn});ir.forof(r,((e,n)=>{(rn.includes(e)||rn.includes(zt.camelCase(e)))&&(r[e]=nn(n,t))}));return en(r)},commonFields:tn};const on=(e,t="",r=!1)=>{try{if(!e)return;const n=kr.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}?${kr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){an(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},an=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;on(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},cn=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}},ln=(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)))})),un=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e;var hn={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:on,download:(e,t="")=>{e&&("string"!=typeof e?an(e,t):on(e,t))},downloadFile:an,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();on(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?ln("clipboard-write").then((t=>{un(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(cn(e)))):r(cn(e))})).catch((()=>{r(cn(e))})):r(cn(e))})),queryPermission:ln,isAllowed:un,legacyCopy:cn};var fn={ossImage:(e,t={})=>{if(!e)return e;const r=kr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=ar.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=kr.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=>Ee.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const dn=({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 pn(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function gn(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(ir.isPlainObject(e)){const r=kr.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 yn{host="";reqConfig={};handleError;interceptors={request:new dr,response:new dr};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(gn),this.interceptors.response.use(e.handleResponse||pn),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){yn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete yn.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=ir.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(yn.blockId,(()=>dn(s))),i=await yn.requestLock[yn.blockId].request;else if(yn.requestLock[yn.blockId]&&yn.requestLock[yn.blockId].lock&&await yn.requestLock[yn.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),yn.requestLock[e]||this.lockR(e,(()=>dn(s))),i=await yn.requestLock[e].request,this.unlockR(e)}else i=await dn(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)}}}const mn={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},wn=e=>(...t)=>{const r=console[e];mn.overrode?r(...t):bn(r,e,...t)},bn=(e,t,...r)=>{const n=b.format(new Date,mn.format),s=mn.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 _n={override:()=>{if(mn.overrode)return;mn.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{bn(t,e,...r)}}))},log:wn("log"),info:wn("info"),warn:wn("warn"),error:wn("error"),config:({tag:e=mn.tag,format:t=mn.format}={})=>{mn.tag=e,mn.format=t}};var vn={getDataURL:e=>{const t={contentType:"",dataUrl:""};return ve.to(fetch(e).then((e=>(t.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(t.dataUrl=`data:${t.contentType};base64,`+Re.ab2str(e,!0),t))))},getArrayBuffer:async e=>ve.to(fetch(e).then((e=>e.arrayBuffer()))),getJson:async e=>ve.to(fetch(e).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=qe.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=>ve.to(fetch(e).then((e=>e.text())))};const xn=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,${Jr.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}`}},An=(e,t,r)=>({key:e,fields:t,storage:r});class Sn{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=Ht.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=sr.copy(e,{fields:this.fields});this.save(r)}}class kn extends f{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!te.isFunction(n))return;const[,s]=await Ht.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=sr.copy(t);else{const[,t]=await Ht.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){te.isObject(t)&&(t=sr.copy(t)),this[e]=t}}const Cn=(e,t)=>{const r=Object.assign(new kn,e||{});r.__persist=new Sn(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 te.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(te.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 $n{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=kr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=kr.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=Xr.base64.encodeByOss(n),i=kr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=Xr.base64.encodeByOss(e),i=kr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}const On=(e,t)=>new $n(e,t);class En{__list=[];constructor(){this.clear()}add(e){const t=Ht.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 jn=new class{state=Cn(new kn);frame=new d;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||b.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&&!b.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=ir.copy(r);ir.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||b.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new En};class Pn{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=h(),this.start=Date.now(),this.timeStartDesc=b.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=b.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const Tn=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 Pn;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=sr.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 ar.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)))}};var qn={brotliCompress:function(e,r=t.constants.BROTLI_DEFAULT_QUALITY){try{if(!e)return"";const n=Re.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=Re.base64ToBytes(e);return t.brotliDecompressSync(r).toString("utf-8")}catch(t){return e||""}}};var Bn={child_exec:e=>new Promise((t=>{if(!e)return t([null,""]);s(e,((e,r)=>{t(e?[e||"error",""]:[null,r||""])}))}))};const Ln=()=>{try{return"win32"===process.platform?Fn():"darwin"===process.platform?Rn():void 0}catch(e){return}},Fn=async()=>{do{let e,t;if([e,t]=await Bn.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)},Rn=async()=>{do{let e,t;if([e,t]=await Bn.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)},In=(e,t=["*"],r="DIRECT")=>{const n=e||r||"DIRECT",s=r||"DIRECT",i=`\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 = "${n}";\n var _default = "${s}";\n\n for (var i = 0; i < _rules.length; i++) {\n if (shExpMatch(host, _rules[i])) {\n return _proxy;\n }\n }\n\n return _default;\n }\n `;return Re.toDataUrl(i,"application/x-ns-proxy-autoconfig")},Un=(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 Dn={getSystemProxy:Ln,toPacScript:In,toPacProxy:Un,pacScript:async(e,t,r)=>{const{type:n="SOCKS5",rules:s=["*"],useSystem:i}=r||{},o=Un(e,t,{type:n});if(!o)return"";let a;if(i){const e=await Ln();e&&(a=Un(e?.ipaddress||"",e?.port||0,{direct:!0}))}return In(o,s||[],a)}};class Mn{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 Re.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Re.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=Re.base64ToBytes(r),s=Re.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Re.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Re.base64ToBytes(r):Re.getRandomBytes(12),s=Re.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Re.concatBytes(new Uint8Array(i),n);return Re.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Re.base64ToBytes(e),s=Re.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Re.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Re.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 Re.textDecode(s)}}const Kn=(e,t)=>new Promise(((r,n)=>{i.readdir(e,(async(s,i)=>{if(s)return n(s);r(zn(e,i,t))}))})),zn=async(e,t,r)=>{for(let n of t){const t=`${e}\\${n}`;i.lstatSync(t).isDirectory()?await Kn(`${t}`,r):r&&await r(t)}};var Nn={...{readDirectory:Kn,readFiles:zn},...qn,...Bn,...Dn,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=Re.base64ToBytes(n),i=e.createCipheriv("aes-256-gcm",Re.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?Re.base64ToBytes(n):Re.getRandomBytes(12),i=e.createCipheriv("aes-256-gcm",Re.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",Re.base64ToBytes(this.sharedSecret),Re.base64ToBytes(n)),i=Re.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=Re.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",Re.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 Mn{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=h(),this.__pipeline=new ke(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] handle 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&&!kr.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(!kr.isLocalIpAddress(e))for(const t of this.upstreamProxy)if(this.isAllowedDomain(e,t.rules||[]))return t}isAllowedDomain(e,t){if(kr.isLocalIpAddress(e))return!1;if(!t||!Array.isArray(t))return!1;for(const r of t){if("*"===r)return!0;if(kr.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=ar.distinct(this.upstreamProxy.reduce(((e,t)=>e.concat(t?.rules||[])),[])))}},rsa:Ke},Hn={Ecdh:Mn};class Vn{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 Wn{_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 Vn(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)}}}"undefined"!=typeof window&&require("./modules/node");const Zn={gbk:o,math:qe,list:ar,string:zt,time:b,obj:sr,rule:Yr,regex:Qr,...Re,...Xr,...ir,Event:f},Yn=ir.singleton,Qn={...Re,...Xr,...Ht,...zt,...qe,qs:kr,singleton:Yn},Gn={mini:yr,css:sn,qs:kr,icon:xn,html:hn},Jn={cdn:fn,watermark:On},Xn={Store:kn,storeRef:Cn,Persist:Sn,persistConfig:An},es=jn,ts=Tn,rs=_n,ns={fetch:vn,Http:yn,css:sn,qs:kr,icon:xn,html:hn,rsa:Ne,...Hn},ss={...Nn};var is={gbk:o,time:b,hook:Ht,math:qe,util:ir,list:ar,string:zt,obj:sr,crypto:Xr,mini:yr,qs:kr,css:sn,cdn:fn,html:hn,icon:xn,rule:Yr,regex:Qr,convert:Re,KValue:Vn,Mapping:Wn,Event:f,Http:yn,Store:kn,storeRef:Cn,Persist:Sn,persistConfig:An,watermark:On,joker:jn,tracker:Tn,logger:_n,fetch:vn,rsa:Ne};export{f as Event,Vn as KValue,Wn as Mapping,Jn as dCdn,Qn as dHook,es as dJoker,rs as dLogger,Gn as dMini,ss as dNode,Xn as dStore,ts as dTracker,Zn as dUtil,ns as dWeb,is as default};
|
package/bin/ddan-js.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("crypto")):"function"==typeof define&&define.amd?define(["exports","crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ddan={},e.crypto$1)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);var s={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)}};const i="0123456789",o="abcdefghijklmnopqrstuvwxyz",a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var c={keyNumber:i,keyLower:o,keyUpper:a,keyChars:i+o+a};const u=(e=0,t=0)=>{const r=c.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 l{__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 f{_loopTimer;_event=new l;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 h={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class d{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/h.oneSecond);let r=t.countdown;t.d=Math.floor(r/h.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=h.oneDay,t.h=Math.floor(r/h.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=h.oneHour,t.m=Math.floor(r/h.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=h.oneMinute,t.s=Math.floor(r/h.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=h.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>h.oneHour?"hh:mm:ss":t.countdown>h.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 p=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?g(r).format(t):""},g=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new d(t||0)};function y({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(p(Date.now(),o)).getTime()}var m={...h,now:function(){return g(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:y,todayZero:()=>y({}),format:p,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return g(r).toCountdown(t)},dtime:g,loopFrame:(e=500)=>new f(e),getTimezoneOffset:()=>d.timezoneOffset,getLocalTime:d.getLocalTime};const w="object"==typeof global&&null!==global&&global.Object===Object&&global,b="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,v="object"==typeof self&&null!==self&&self.Object===Object&&self,_=b||w||v||Function("return this")(),A=_.Symbol,{toString:x,hasOwnProperty:k,propertyIsEnumerable:S}=Object.prototype,C=A?A.toStringTag:void 0;function $(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":C&&C in Object(e)?function(e){const t=k.call(e,C),r=e[C];let n=!1;try{e[C]=void 0,n=!0}catch(e){}const s=x.call(e);return n&&(t?e[C]=r:delete e[C]),s}(e):x.call(e)}var j={getTag:$,getType:function(e){return($(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:x,hasOwnProperty:k,propertyIsEnumerable:S};const O="object"==typeof e&&null!==e&&!e.nodeType&&e,E=O&&"object"==typeof module&&null!==module&&!module.nodeType&&module,q=E&&E.exports===O&&w.process,B=(()=>{try{const e=E&&E.require&&E.require("util").types;return e||q&&q.binding&&q.binding("util")}catch(e){}})();var T="[object Function]",L="[object GeneratorFunction]",F="[object AsyncFunction]",P=9007199254740991;const R=/^(?:0|[1-9]\d*)$/,M=_?.Buffer?.isBuffer,I=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,D=B&&B.isTypedArray;function U(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function K(e){return null!=e&&"object"==typeof e}const z=Array.isArray;function N(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=P}(e.length)&&!H(e)}function V(e){return K(e)&&N(e)}function H(e){var t=U(e)?j.getTag(e):"";return t===T||t===L||t===F}function W(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function Z(e){return V(e)&&j.hasOwnProperty.call(e,"callee")&&(!j.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==j.toString.call(e))}const Q="undefined"!=typeof window&&void 0!==window.document,G="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,J=D?e=>D(e):e=>K(e)&&I.test(j.getTag(e)),Y="function"==typeof M?M:()=>!1;var X={is:function(e,t){return j.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===j.getTag(e)},isString:function(e){return"string"==typeof e||!z(e)&&K(e)&&"[object String]"==j.getTag(e)},isObject:U,isObjectLike:K,isPlainObject:function(e){if(!K(e)||"[object Object]"!=j.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||K(e)&&"[object Symbol]"===j.getTag(e)},isFunction:H,isArray:z,isArrayLikeObject:V,isIndex:function(e,t){return!!(t=null==t?P:t)&&("number"==typeof e||R.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:N,isPrototype:W,isArguments:Z,isPromise:function(e){return"[object Promise]"===(U(e)?j.getTag(e):"")},isBrowser:Q,isNode:G,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(N(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||Y(e)||J(e)||Z(e)))return!e.length;const t=j.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(W(e))return!Object.keys(e).length;for(const t in e)if(j.hasOwnProperty.call(e,t))return!1;return!0}};const ee=NaN,te=/^\s+|\s+$/g,re=/^[-+]0x[0-9a-f]+$/i,ne=/^0b[01]+$/i,se=/^0o[0-7]+$/i,ie=parseInt,oe=1/0,ae=17976931348623157e292;function ce(e){if("number"==typeof e)return e;if(X.isSymbol(e))return ee;if(X.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=X.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(te,"");const t=ne.test(e);return t||se.test(e)?ie(e.slice(2),t?2:8):re.test(e)?ee:+e}function ue(e){return e?(e=ce(e))===oe||e===-oe?(e<0?-1:1)*ae:e==e?e:0:0===e?e:0}var le={toNumber:ce,toFinite:ue,toInteger:function(e){var t=ue(e),r=t%1;return t==t?r?t-r:t:0}};const fe="Expected a function",he=Math.max,de=Math.min;function pe(e,t=300,r={}){let n,s,i,o,a,c,u=0,l=!1,f=!1,h=!0;if("function"!=typeof e)throw new TypeError(fe);function d(t){const r=n,i=s;return n=s=void 0,u=t,o=e.apply(i,r),o}function p(e){const r=e-c;return void 0===c||r>=t||r<0||f&&e-u>=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?de(r,i-(e-u)):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 u=e,a=setTimeout(g,t),l?d(e):o}(c);if(f)return a=setTimeout(g,t),d(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=le.toNumber(t)||0,X.isObject(r)&&(l=!!r.leading,f="maxWait"in r,i=f?he(le.toNumber(r.maxWait)||0,t):i,h="trailing"in r?!!r.trailing:h),m.cancel=function(){void 0!==a&&clearTimeout(a),u=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 ge{__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(X.isFunction(e))r=e(t);else{if(X.isPromise(e))return e.then((e=>({...t,...e})));r=e}return X.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 ye(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const me=(e,t)=>{try{let r;return r=X.isFunction(e)?e():e,ye(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 be={to:ye,go:(e,t)=>me(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:me,toError:we,timeout:(e,t=0,r="timeout")=>{if(t<=0)return me(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([me(e,s),i])}};class ve{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var _e={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 be.safeRun(this._func).then((e=>{try{this._callback&&this._callback(e)}catch(e){console.log("[ddan] task",e)}finally{return e}}))}}class xe{__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 be.delay(100),this._step()}return this.clear()}}class ke extends(_e.singleton()){__lockedMap=new Map;pipeline=new xe;constructor(){super()}lock(e,t){if(!e||!t)return;const r=be.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 be.safeRun(e);const r=this.__lockedMap.get(t);if(r)return r;const n=this.lock(t,e);if(!n)return be.safeRun(e);const s=await n;return this.unlock(t),s}}var Se={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 Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var $e={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",u=0;for(e=Se.toUtf8(e);u<e.length;)t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u++),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+Ce.charAt(s)+Ce.charAt(i)+Ce.charAt(o)+Ce.charAt(a);return c},fromBase64:(e="")=>{let t,r,n,s,i,o,a,c="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)s=Ce.indexOf(e.charAt(u++)),i=Ce.indexOf(e.charAt(u++)),o=Ce.indexOf(e.charAt(u++)),a=Ce.indexOf(e.charAt(u++)),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=Se.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",u=0;if(!e||!X.isArrayLike(e)||!X.isUint8Array(e))return"";for(;u<e.length;)t=e[u++],r=e[u++],n=e[u++],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+Ce.charAt(s)+Ce.charAt(i)+Ce.charAt(o)+Ce.charAt(a);return c},base64ToBytes:(e="")=>{let t,r,n,s,i,o,a,c=[],u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)s=Ce.indexOf(e.charAt(u++)),i=Ce.indexOf(e.charAt(u++)),o=Ce.indexOf(e.charAt(u++)),a=Ce.indexOf(e.charAt(u++)),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 je(e){return Math.floor(Math.random()*e)}function Oe(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Ee=180/Math.PI;var qe={random:je,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=je(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:Oe,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=Oe(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Ee},degree2radian:function(e){return e/Ee},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 Be={bytes2str:e=>{if(!e||!X.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 Te={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return Be.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};const Le=(e,t=!1)=>{const r=new Uint8Array(e);return t?$e.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var Fe={...Be,...Te,...Se,...$e,str2ab:(e="",t=!1)=>{if(t)return $e.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:Le,utf8ToBase64:e=>X.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>X.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]=qe.random(256);return t},textEncode:e=>Se.toUtf8Bytes(e),textDecode:e=>Se.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+$e.toBase64(e):X.isArrayBuffer(e)?`data:${t};base64,`+Le(e,!0):"":""};const Pe=e=>{try{const t=Fe.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},Re=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Me={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=Pe(r),s=Re(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=Pe(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:Re(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:Re,format_pem_content:Pe,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",Fe.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=Fe.concatBytes(...i);return Fe.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=Fe.base64ToBytes(t),s=await e.importKey("pkcs8",Fe.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=Fe.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const Ie=()=>n.default.webcrypto.subtle;var De=async e=>Me.encrypt(Ie(),e,Me.RSAPublicKey),Ue=async e=>Me.decrypt(Ie(),e,Me.RSAPrivateKey);const Ke="undefined"!=typeof window?window.crypto.subtle:{};var ze={generateKeys:()=>Me.generateKeys(Ke),encrypt:async(e,t)=>Me.encrypt(Ke,e,t),decrypt:async(e,t)=>Me.decrypt(Ke,e,t),encode:async e=>Me.encrypt(Ke,e,Me.RSAPublicKey),decode:async e=>Me.decrypt(Ke,e,Me.RSAPrivateKey)};const Ne=2654435769,Ve=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+Ne>>>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},He=(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-Ne>>>0;return e},We=e=>{const t=Fe.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},Ze=(e,t)=>{const r=Fe.pkcs7Padding(e,8),n=We(t),s=[];for(let e=0;e<r.length;e+=8){const t=Fe.bytesToUint32(r.slice(e,e+8)),i=Ve(t,n);s.push(Fe.uint32ToBytes(i))}return Fe.concatBytes(...s)},Qe=(e,t)=>{const r=We(t),n=[];for(let t=0;t<e.length;t+=8){const s=Fe.bytesToUint32(e.slice(t,t+8)),i=He(s,r);n.push(Fe.uint32ToBytes(i))}const s=Fe.concatBytes(...n);return Fe.pkcs7Unpadding(s)};var Ge={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:Ve,decrypt:He,toTeaKey:We,encode:(e,t)=>{const r=Fe.textEncode(e),n=Ze(r,t);return Fe.bytesToBase64(n)},decode:(e,t)=>{const r=Fe.base64ToBytes(e),n=Qe(r,t);return Fe.textDecode(n.buffer)},encodeBytes:Ze,decodeBytes:Qe};function Je(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 Ye=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function Xe(e){return Ye.test(e)}const et="\\ud800-\\udfff",tt=`[${et}]`,rt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",nt="\\ud83c[\\udffb-\\udfff]",st=`[^${et}]`,it="(?:\\ud83c[\\udde6-\\uddff]){2}",ot="[\\ud800-\\udbff][\\udc00-\\udfff]",at=`${`(?:${rt}|${nt})`}?`,ct="[\\ufe0e\\ufe0f]?",ut=ct+at+`(?:\\u200d(?:${[st,it,ot].join("|")})${ct+at})*`,lt=`(?:${[`${st}${rt}?`,rt,it,ot,tt].join("|")})`,ft=RegExp(`${nt}(?=${nt})|${lt+ut}`,"g");function ht(e){return Xe(e)?function(e){return e.match(ft)||[]}(e):function(e){return e.split("")}(e)}function dt(e){return t=>{if(!t)return"";const r=Xe(t)?ht(t):void 0,n=r?r[0]:t[0],s=r?Je(r,1).join(""):t.slice(1);return n[e]()+s}}const pt="\\ud800-\\udfff",gt="\\u2700-\\u27bf",yt="a-z\\xdf-\\xf6\\xf8-\\xff",mt="A-Z\\xc0-\\xd6\\xd8-\\xde",wt="\\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",bt="['’]",vt=`[${wt}]`,_t=`[${gt}]`,At=`[${yt}]`,xt=`[^${pt}${wt+"\\d"+gt+yt+mt}]`,kt="(?:\\ud83c[\\udde6-\\uddff]){2}",St="[\\ud800-\\udbff][\\udc00-\\udfff]",Ct=`[${mt}]`,$t=`(?:${At}|${xt})`,jt=`(?:${Ct}|${xt})`,Ot=`(?:${bt}(?:d|ll|m|re|s|t|ve))?`,Et=`(?:${bt}(?:D|LL|M|RE|S|T|VE))?`,qt="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Bt="[\\ufe0e\\ufe0f]?",Tt=Bt+qt+`(?:\\u200d(?:${[`[^${pt}]`,kt,St].join("|")})${Bt+qt})*`,Lt=`(?:${[_t,kt,St].join("|")})${Tt}`,Ft=RegExp([`${Ct}?${At}+${Ot}(?=${[vt,Ct,"$"].join("|")})`,`${jt}+${Et}(?=${[vt,Ct+$t,"$"].join("|")})`,`${Ct}?${$t}+${Ot}`,`${Ct}+${Et}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Lt].join("|"),"g");const Pt=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 ]/),Rt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Mt(e,t){if(void 0===t){const t=Pt(e)?function(e){return e.match(Ft)}(e):function(e){return e.match(Rt)}(e);return t||[]}return e.match(t)||[]}function It(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:It(e)))}`;if(X.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Dt=dt("toUpperCase"),Ut=dt("toLowerCase");var Kt={toString:It,startCase:e=>Mt(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Dt(t)),""),snakeCase:e=>Mt(It(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>Mt(It(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>Mt(It(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Dt(t):t))),""),upperCase:e=>Mt(It(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Dt,lowerCase:e=>Mt(It(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Ut,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}}};var zt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":Ge.encode(t,Fe.hex2str(Ge.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=Ge.decode(e,Fe.hex2str(Ge.TEAKey));return Kt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return X.isBrowser?await ze.encode(t):await De(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=X.isBrowser?await ze.decode(e):await Ue(e);return Kt.jsonFormat(t)}catch(e){return""}}};var Nt={...be,...zt,sleep:be.delay,run:async function(e,t=0){if(t<=0)return be.safeRun(e);const r=t>0?Date.now():0,n=await be.safeRun(e),s=Date.now()-r;return s<t&&await be.delay(t-s),n},exec:(e,t="")=>ke.I.exec(e,t),debounce:pe,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return X.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),pe(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new ge(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 be.to(Promise.resolve(t()));if(e||!1===r)break;s>0&&s--,0!==s&&await be.delay(i)}while(-1===n||s>0)},pipe:(e,t)=>ke.I.pipeline.push(e,t),pipeline:(e=1)=>new xe(e),safeTask:(e,t)=>new Ae(e,t)};function Vt(e){return e!=e}function Ht(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 Wt,Zt,Qt=(Wt=Object.keys,Zt=Object,function(e){return Wt(Zt(e))}),Gt=Math.max;function Jt(e,t){var r=X.isArray(e)||X.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&&!j.hasOwnProperty.call(e,i)||s&&("length"==i||X.isIndex(i,n))||r.push(i);return r}const Yt=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]=Yt(e[r]));return t};const Xt=(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]=er(e[o],a,r)}return n},er=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?Xt(e,t,r):Xt({...e},t,r),n},tr=(e,t,r={})=>Xt({...e},t,{cover:!0,...r}),rr=(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=>{rr(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&rr(e,t,r,n,s)},get:()=>i})};var nr={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:Kt.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:Yt,merge:er,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]=Kt.parseValue(n,{number:t,boolean:r});else e[n]=Kt.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:tr,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=tr(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:rr,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};var sr={...X,...j,...nr,..._e,includes:function(e,t,r,n){e=X.isArrayLike(e)?e:function(e){return e?Ht(e,function(e){return X.isArrayLike(e)?Jt(e):function(e){if(!X.isPrototype(e))return Qt(e);var t=[];for(var r in Object(e))j.hasOwnProperty.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}(e)):[]}(e),r=r&&!n?le.toInteger(r):0;var s=e.length;return r<0&&(r=Gt(s+r,0)),X.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,Vt,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(X.isObject(e)&&(r=X.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var ir={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]:[]}};var or={...ir,stepAction:function(e,t,r=100){if(!X.isFunction(t))return;if(!X.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(!X.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!X.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!X.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return qe.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!X.isObject(e))return;const s=e[t];(X.isString(s)&&""!==s||X.isNumber(s))&&(n[s]=e[r])})),n):n}};const ar="[object Object]",cr="[object Array]",ur=e=>Object.prototype.toString.call(e),lr=(e,t,r=!1)=>{if(e===t)return;const n=ur(e);if(n===ur(t))if(n===cr&&e.length>=t.length)for(let r=0;r<t.length;r++)lr(e[r],t[r]);else if(n===ar&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?lr(e[n],t[n]):e[n]=null},fr=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=ur(e),o=ur(t);if(i===cr&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)fr(e[s],t[s],r,`${n}[${s}]`);else if(i===ar&&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=ur(s),c=ur(o);if(s!==o)if(a===cr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)fr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===ar&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)fr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class hr{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 dr{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new hr,response:new hr};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){dr.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete dr.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=nr.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(dr.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await dr.requestLock[dr.blockId].request;else if(dr.requestLock[dr.blockId]&&dr.requestLock[dr.blockId].lock&&await dr.requestLock[dr.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),dr.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await dr.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 pr=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var gr={diff:function(e,t){const r={};return(e=>{if(ur(e)===ar)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];ur(n[t])!==ar&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),lr(e,t,!0),fr(e,t,r,"",!0),r},promixify:pr,run:(e,t={})=>e?Nt.run(pr(e)(t)):Nt.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:dr,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;nr.observe(s,o,a,e,c)}))}};const yr=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 u=/\+/g,l=n||1e3;let f=(e=e.split(t)).length;l>0&&f>l&&(f=l);for(let t=0;t<f;++t){let n,o,a,l,f=e[t].replace(u,"%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,l=i?decodeURIComponent(o):o,j.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(l):c[a]=[c[a],l]:c[a]=l}return nr.parseValue(c,{number:o,boolean:a}),c},mr=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},wr=function(e,t=!0){return t?encodeURIComponent(e):e},br=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},vr=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,_r=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}},Ar=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match(vr);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},xr=(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 kr={parse:yr,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=wr(mr(n),s)+r,u=e[n];return Array.isArray(u)?u.map((function(e){return c+wr(mr(e),s)})).join(t):br(u,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+wr(mr(u),s)})).filter(Boolean).join(t):n?wr(mr(n),s)+r+wr(mr(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=Ar(e),{origin:r="",url:n="",query:s=""}=t,i=_r(n),o=yr(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:_r,parseHost:Ar,join:(...e)=>{let t=[];return e.forEach((e=>{const r=e.trim().replace(/^\/*(.*?)\/*$/,"$1");r.length<=0||(/^(\w+):\/\//.test(r)?t=[r]:t.push(r))})),t.join("/")},shExpMatch:xr,isLocalIpAddress:e=>!!e&&!!(xr(e,"127.0.0.1")||xr(e,"localhost")||xr(e,"192.168.*.*"))};const Sr=/%[sdj%]/g;let Cr=()=>{};function $r(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 jr(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(Sr,(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 Or(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 Er(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&&(Cr=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class qr extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function Br(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);Er(o,r,(e=>(n(e),e.length?i(new qr(e,$r(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 u=[],l=new Promise(((t,l)=>{const f=e=>{if(u.push.apply(u,e),c++,c===a)return n(u),u.length?l(new qr(u,$r(u))):t(s)};o.length||(n(u),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?Er(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 l.catch((e=>e)),l}function Tr(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],function(e){return!(!e||void 0===e.message)}(r)?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField}}}function Lr(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 Fr=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!Or(t,i||e.type)||n.push(jr(s.messages.required,e.fullField))};let Pr;const Rr=/^(([^<>()\[\]\\.,;:\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,}))$/,Mr=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,Ir={integer:e=>Ir.number(e)&&parseInt(e,10)===e,float:e=>Ir.number(e)&&!Ir.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&&!Ir.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(Rr),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(Pr)return Pr;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 u=c.v4().source,l=c.v6().source;return Pr=new RegExp(`(?:^(?:(?:(?:[a-z]+:)?//)|www\\.)(?:\\S+(?::\\S*)?@)?(?:localhost|${u}|${l}|(?:(?:[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"),Pr})()),hex:e=>"string"==typeof e&&!!e.match(Mr)},Dr="enum";var Ur={required:Fr,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(jr(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void Fr(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?Ir[i](t)||n.push(jr(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(jr(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 u=t,l="";const f="number"==typeof t,h="string"==typeof t,d=Array.isArray(t);if(f?l="number":h?l="string":d&&(l="array"),!l)return!1;d&&(u=t.length),h&&(u=t.replace(c,"_").length),i?u!==e.len&&n.push(jr(s.messages[l].len,e.fullField,e.len)):o&&!a&&u<e.min?n.push(jr(s.messages[l].min,e.fullField,e.min)):a&&!o&&u>e.max?n.push(jr(s.messages[l].max,e.fullField,e.max)):o&&a&&(u<e.min||u>e.max)&&n.push(jr(s.messages[l].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[Dr]=Array.isArray(e[Dr])?e[Dr]:[],-1===e[Dr].indexOf(t)&&n.push(jr(s.messages[Dr],e.fullField,e[Dr].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(jr(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(jr(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const Kr=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(Or(t,i)&&!e.required)return r();Ur.required(e,t,n,o,s,i),Or(t,i)||Ur.type(e,t,n,o,s)}r(o)};var zr={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(Or(t,"string")&&!e.required)return r();Ur.required(e,t,n,i,s,"string"),Or(t,"string")||(Ur.type(e,t,n,i,s),Ur.range(e,t,n,i,s),Ur.pattern(e,t,n,i,s),!0===e.whitespace&&Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&Ur.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),Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&(Ur.type(e,t,n,i,s),Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),Or(t)||Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&(Ur.type(e,t,n,i,s),Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&(Ur.type(e,t,n,i,s),Ur.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();Ur.required(e,t,n,i,s,"array"),null!=t&&(Ur.type(e,t,n,i,s),Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s),void 0!==t&&Ur.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(Or(t,"string")&&!e.required)return r();Ur.required(e,t,n,i,s),Or(t,"string")||Ur.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(Or(t,"date")&&!e.required)return r();if(Ur.required(e,t,n,i,s),!Or(t,"date")){let r;r=t instanceof Date?t:new Date(t),Ur.type(e,r,n,i,s),r&&Ur.range(e,r.getTime(),n,i,s)}}r(i)},url:Kr,hex:Kr,email:Kr,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;Ur.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(Or(t)&&!e.required)return r();Ur.required(e,t,n,i,s)}r(i)}};function Nr(){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 Vr=Nr();class Hr{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");zr[e]=t};static warning=Cr;static messages=Vr;static validators=zr;rules={};_messages=Vr;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=Lr(Nr(),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===Vr&&(e=Nr()),Lr(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 Br(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 u(i=[]){let u=Array.isArray(i)?i:[i];!0===s.suppressWarning&&u.length&&Hr.warning("async-validator:",u),u.length&&void 0!==r.message&&(u=[].concat(r.message));let l=u.map(Tr(r,n));if(s.first&&l.length)return a[r.field]=1,t(l);if(o){if(r.required&&!e.value)return void 0!==r.message?l=[].concat(r.message).map(Tr(r,n)):s.error&&(l=[s.error(r,jr(s.messages.required,r.field))]),t(l);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 Hr(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=[];l&&l.length&&r.push(...l),e&&e.length&&r.push(...e),t(r.length?r:null)}))}else t(l)}if(o=o&&(r.required||!r.required&&e.value),r.field=e.field,r.asyncValidator)i=r.asyncValidator(r,e.value,u,e.source,s);else if(r.validator){try{i=r.validator(r,e.value,u,e.source,s)}catch(e){console.error?.(e),s.suppressValidatorError||setTimeout((()=>{throw e}),0),u(e.message)}!0===i?u():!1===i?u("function"==typeof r.message?r.message(r.fullField||r.field):r.message||`${r.fullField||r.field} fails`):i instanceof Array?u(i):i instanceof Error&&u(i.message)}i&&i.then&&i.then((()=>u()),(e=>u(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=$r(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&&!zr.hasOwnProperty(e.type))throw new Error(jr("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]?zr.required:zr[this.getType(e)]||void 0}}function Wr(e){return new Hr(e)}var Zr={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:Wr,validate:function(e,t,r={},n=(()=>{})){return Nt.run(Wr(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)}};var Qr={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})$/}};const Gr=e=>$e.toBase64(e);var Jr={encode:Gr,decode:e=>$e.fromBase64(e),encodeByOss:e=>Gr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var Yr={...c,base64:Jr,tea:Ge,uuid:u,guid:(e,t=!1,r="")=>{const n=u(e||32);return t?m.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=c.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 Xr=e=>{if(!e)return"";if(!sr.isObject(e))return"";let t="";return sr.forof(e,((e,r)=>{r&&(t+=`${Kt.kebabCase(e)}:${r};`)})),t},en=["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"],tn=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],rn=(e,t="px")=>e&&t?"0"===e?e:Zr.isFloat(e.toString())?`${e}${t}`:e:e;var nn={stringify:Xr,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=kr.parse(e,{sep:";",eq:":",uri:!1}),s={};return sr.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:Kt.camelCase(e):e;Zr.isFloat(n)||n.length>=2&&n.startsWith(".")&&Zr.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:rn,style:(e,t="px")=>{if(!e)return"";const r=sr.copy(e,{fields:en});sr.forof(r,((e,n)=>{(tn.includes(e)||tn.includes(Kt.camelCase(e)))&&(r[e]=rn(n,t))}));return Xr(r)},commonFields:en};const sn=(e,t="",r=!1)=>{try{if(!e)return;const n=kr.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}?${kr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){on(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},on=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;sn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},an=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}},cn=(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)))})),un=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e;var ln={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:sn,download:(e,t="")=>{e&&("string"!=typeof e?on(e,t):sn(e,t))},downloadFile:on,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();sn(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 u=c.getContext("2d");return u?(n&&u.rotate(n*Math.PI/180),s&&(u.fillStyle=s),i&&(u.font=i),o&&(u.textAlign=o),a&&(u.textBaseline=a),u.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?cn("clipboard-write").then((t=>{un(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(an(e)))):r(an(e))})).catch((()=>{r(an(e))})):r(an(e))})),queryPermission:cn,isAllowed:un,legacyCopy:an};var fn={ossImage:(e,t={})=>{if(!e)return e;const r=kr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=or.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=kr.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=>$e.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const hn=({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 dn(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function pn(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(sr.isPlainObject(e)){const r=kr.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 gn{host="";reqConfig={};handleError;interceptors={request:new hr,response:new hr};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(pn),this.interceptors.response.use(e.handleResponse||dn),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){gn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete gn.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=sr.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(gn.blockId,(()=>hn(s))),i=await gn.requestLock[gn.blockId].request;else if(gn.requestLock[gn.blockId]&&gn.requestLock[gn.blockId].lock&&await gn.requestLock[gn.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),gn.requestLock[e]||this.lockR(e,(()=>hn(s))),i=await gn.requestLock[e].request,this.unlockR(e)}else i=await hn(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)}}}const yn={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},mn=e=>(...t)=>{const r=console[e];yn.overrode?r(...t):wn(r,e,...t)},wn=(e,t,...r)=>{const n=m.format(new Date,yn.format),s=yn.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 bn={override:()=>{if(yn.overrode)return;yn.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{wn(t,e,...r)}}))},log:mn("log"),info:mn("info"),warn:mn("warn"),error:mn("error"),config:({tag:e=yn.tag,format:t=yn.format}={})=>{yn.tag=e,yn.format=t}};var vn={getDataURL:e=>{const t={contentType:"",dataUrl:""};return be.to(fetch(e).then((e=>(t.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(t.dataUrl=`data:${t.contentType};base64,`+Fe.ab2str(e,!0),t))))},getArrayBuffer:async e=>be.to(fetch(e).then((e=>e.arrayBuffer()))),getJson:async e=>be.to(fetch(e).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=qe.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=>be.to(fetch(e).then((e=>e.text())))};const _n=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,${Jr.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}`}},An=(e,t,r)=>({key:e,fields:t,storage:r});class xn{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=Nt.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=nr.copy(e,{fields:this.fields});this.save(r)}}class kn extends l{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!X.isFunction(n))return;const[,s]=await Nt.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=nr.copy(t);else{const[,t]=await Nt.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){X.isObject(t)&&(t=nr.copy(t)),this[e]=t}}const Sn=(e,t)=>{const r=Object.assign(new kn,e||{});r.__persist=new xn(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 X.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(X.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 Cn{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=kr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=kr.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=Yr.base64.encodeByOss(n),i=kr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=Yr.base64.encodeByOss(e),i=kr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}const $n=(e,t)=>new Cn(e,t);class jn{__list=[];constructor(){this.clear()}add(e){const t=Nt.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 On=new class{state=Sn(new kn);frame=new f;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||m.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&&!m.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=sr.copy(r);sr.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||m.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new jn};class En{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=m.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=m.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const qn=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 En;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=nr.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 or.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)))}};var Bn={Ecdh:class{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 Fe.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=Fe.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=Fe.base64ToBytes(r),s=Fe.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return Fe.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?Fe.base64ToBytes(r):Fe.getRandomBytes(12),s=Fe.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=Fe.concatBytes(new Uint8Array(i),n);return Fe.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=Fe.base64ToBytes(e),s=Fe.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return Fe.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=Fe.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 Fe.textDecode(s)}}};class Tn{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 Ln{_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 Tn(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)}}}if(e.dNode=void 0,"undefined"!=typeof window){const t=require("./modules/node");e.dNode={...t}}else e.dNode={};const Fn={gbk:s,math:qe,list:or,string:Kt,time:m,obj:nr,rule:Zr,regex:Qr,...Fe,...Yr,...sr,Event:l},Pn=sr.singleton,Rn={...Fe,...Yr,...Nt,...Kt,...qe,qs:kr,singleton:Pn},Mn={mini:gr,css:nn,qs:kr,icon:_n,html:ln},In={cdn:fn,watermark:$n},Dn={Store:kn,storeRef:Sn,Persist:xn,persistConfig:An},Un=On,Kn=qn,zn=bn,Nn={fetch:vn,Http:gn,css:nn,qs:kr,icon:_n,html:ln,rsa:ze,...Bn};var Vn={gbk:s,time:m,hook:Nt,math:qe,util:sr,list:or,string:Kt,obj:nr,crypto:Yr,mini:gr,qs:kr,css:nn,cdn:fn,html:ln,icon:_n,rule:Zr,regex:Qr,convert:Fe,KValue:Tn,Mapping:Ln,Event:l,Http:gn,Store:kn,storeRef:Sn,Persist:xn,persistConfig:An,watermark:$n,joker:On,tracker:qn,logger:bn,fetch:vn,rsa:ze};e.Event=l,e.KValue=Tn,e.Mapping=Ln,e.dCdn=In,e.dHook=Rn,e.dJoker=Un,e.dLogger=zn,e.dMini=Mn,e.dStore=Dn,e.dTracker=Kn,e.dUtil=Fn,e.dWeb=Nn,e.default=Vn,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.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),h=a(o);var d={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)}};const f="0123456789",p="abcdefghijklmnopqrstuvwxyz",g="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var y={keyNumber:f,keyLower:p,keyUpper:g,keyChars:f+p+g};const m=(e=0,t=0)=>{const r=y.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 w{__map;__tagList;__eventId="";constructor(){this.__map=new Map,this.__tagList=[],this.__eventId=m()}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{_loopTimer;_event=new w;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 _={oneDay:864e5,oneHour:36e5,oneMinute:6e4,oneSecond:1e3};class v{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/_.oneSecond);let r=t.countdown;t.d=Math.floor(r/_.oneDay),t.dd=(t.d<10?"0":"")+t.d,r%=_.oneDay,t.h=Math.floor(r/_.oneHour),t.hh=(t.h<10?"0":"")+t.h,r%=_.oneHour,t.m=Math.floor(r/_.oneMinute),t.mm=(t.m<10?"0":"")+t.m,r%=_.oneMinute,t.s=Math.floor(r/_.oneSecond),t.ss=(t.s<10?"0":"")+t.s,r%=_.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>_.oneHour?"hh:mm:ss":t.countdown>_.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 x=(e,t="yyyy-MM-dd hh:mm:ss")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;return r?A(r).format(t):""},A=e=>{const t="string"==typeof e||"number"==typeof e?new Date(e):e;return new v(t||0)};function S({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(x(Date.now(),o)).getTime()}var k={..._,now:function(){return A(new Date)},isToday:e=>e&&(new Date).toDateString()===new Date(e).toDateString(),parseTimestamp:S,todayZero:()=>S({}),format:x,countdown:(e,t="")=>{const r="string"==typeof e||"number"==typeof e?new Date(e):e;if(!r)return"";return A(r).toCountdown(t)},dtime:A,loopFrame:(e=500)=>new b(e),getTimezoneOffset:()=>v.timezoneOffset,getLocalTime:v.getLocalTime};const C="object"==typeof global&&null!==global&&global.Object===Object&&global,$="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis,O="object"==typeof self&&null!==self&&self.Object===Object&&self,E=$||C||O||Function("return this")(),j=E.Symbol,{toString:P,hasOwnProperty:T,propertyIsEnumerable:q}=Object.prototype,B=j?j.toStringTag:void 0;function L(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":B&&B in Object(e)?function(e){const t=T.call(e,B),r=e[B];let n=!1;try{e[B]=void 0,n=!0}catch(e){}const s=P.call(e);return n&&(t?e[B]=r:delete e[B]),s}(e):P.call(e)}var F={getTag:L,getType:function(e){return(L(e).match(/\w+/g)||["object","Undefined"])[1]||""},toString:P,hasOwnProperty:T,propertyIsEnumerable:q};const R="object"==typeof e&&null!==e&&!e.nodeType&&e,I=R&&"object"==typeof module&&null!==module&&!module.nodeType&&module,U=I&&I.exports===R&&C.process,D=(()=>{try{const e=I&&I.require&&I.require("util").types;return e||U&&U.binding&&U.binding("util")}catch(e){}})();var M="[object Function]",K="[object GeneratorFunction]",z="[object AsyncFunction]",N=9007199254740991;const H=/^(?:0|[1-9]\d*)$/,V=E?.Buffer?.isBuffer,W=/^\[object (?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)Array\]$/,Z=D&&D.isTypedArray;function Y(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}function Q(e){return null!=e&&"object"==typeof e}const J=Array.isArray;function G(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=N}(e.length)&&!ee(e)}function X(e){return Q(e)&&G(e)}function ee(e){var t=Y(e)?F.getTag(e):"";return t===M||t===K||t===z}function te(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Object.prototype)}function re(e){return X(e)&&F.hasOwnProperty.call(e,"callee")&&(!F.propertyIsEnumerable.call(e,"callee")||"[object Arguments]"==F.toString.call(e))}const ne="undefined"!=typeof window&&void 0!==window.document,se="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,ie=Z?e=>Z(e):e=>Q(e)&&W.test(F.getTag(e)),oe="function"==typeof V?V:()=>!1;var ae={is:function(e,t){return F.getTag(e)===`[object ${t}]`},isNumber:function(e){return"[object Number]"===F.getTag(e)},isString:function(e){return"string"==typeof e||!J(e)&&Q(e)&&"[object String]"==F.getTag(e)},isObject:Y,isObjectLike:Q,isPlainObject:function(e){if(!Q(e)||"[object Object]"!=F.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||Q(e)&&"[object Symbol]"===F.getTag(e)},isFunction:ee,isArray:J,isArrayLikeObject:X,isIndex:function(e,t){return!!(t=null==t?N:t)&&("number"==typeof e||H.test(e))&&e>-1&&e%1==0&&e<t},isArrayLike:G,isPrototype:te,isArguments:re,isPromise:function(e){return"[object Promise]"===(Y(e)?F.getTag(e):"")},isBrowser:ne,isNode:se,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(G(e)&&(Array.isArray(e)||"string"==typeof e||"function"==typeof e.splice||oe(e)||ie(e)||re(e)))return!e.length;const t=F.getTag(e);if("[object Map]"===t||"[object Set]"===t)return!e.size;if(te(e))return!Object.keys(e).length;for(const t in e)if(F.hasOwnProperty.call(e,t))return!1;return!0}};const ce=NaN,le=/^\s+|\s+$/g,ue=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,de=/^0o[0-7]+$/i,fe=parseInt,pe=1/0,ge=17976931348623157e292;function ye(e){if("number"==typeof e)return e;if(ae.isSymbol(e))return ce;if(ae.isObject(e)){const t="function"==typeof e.valueOf?e.valueOf():e;e=ae.isObject(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(le,"");const t=he.test(e);return t||de.test(e)?fe(e.slice(2),t?2:8):ue.test(e)?ce:+e}function me(e){return e?(e=ye(e))===pe||e===-pe?(e<0?-1:1)*ge:e==e?e:0:0===e?e:0}var we={toNumber:ye,toFinite:me,toInteger:function(e){var t=me(e),r=t%1;return t==t?r?t-r:t:0}};const be="Expected a function",_e=Math.max,ve=Math.min;function xe(e,t=300,r={}){let n,s,i,o,a,c,l=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(be);function f(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||h&&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 h?ve(r,i-(e-l)):r}(e))}function y(e){return a=void 0,d&&n?f(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?f(e):o}(c);if(h)return a=setTimeout(g,t),f(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=we.toNumber(t)||0,ae.isObject(r)&&(u=!!r.leading,h="maxWait"in r,i=h?_e(we.toNumber(r.maxWait)||0,t):i,d="trailing"in r?!!r.trailing:d),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 Ae{__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(ae.isFunction(e))r=e(t);else{if(ae.isPromise(e))return e.then((e=>({...t,...e})));r=e}return ae.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 Se(e,t,r){return e.then((e=>(r&&r(),[null,e]))).catch((e=>(t&&Object.assign(e,t),r&&r(),[e,void 0])))}const ke=(e,t)=>{try{let r;return r=ae.isFunction(e)?e():e,Se(Promise.resolve(r),void 0,t)}catch(e){return t&&t(),Promise.resolve([e,void 0])}},Ce=e=>"string"==typeof(e="function"==typeof e?e():e)?new Error(e):e;var $e={to:Se,go:(e,t)=>ke(e,t),delay:(e=1e3)=>new Promise((t=>setTimeout(t,e))),safeRun:ke,toError:Ce,timeout:(e,t=0,r="timeout")=>{if(t<=0)return ke(e);let n;function s(){n&&clearTimeout(n)}const i=new Promise((e=>{s(),n=setTimeout((()=>e([Ce(r||"timeout"),void 0])),t)}));return Promise.race([ke(e,s),i])}};class Oe{__value=void 0;set(e){this.__value=e}get(){return this.__value}}var Ee={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 Oe;return void 0!==e&&t.set(e),t}};class je{_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 Pe{__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 je(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 Te extends(Ee.singleton()){__lockedMap=new Map;pipeline=new Pe;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 qe={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 Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var Le={toBase64:(e="")=>{let t,r,n,s,i,o,a,c="",l=0;for(e=qe.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+Be.charAt(s)+Be.charAt(i)+Be.charAt(o)+Be.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=Be.indexOf(e.charAt(l++)),i=Be.indexOf(e.charAt(l++)),o=Be.indexOf(e.charAt(l++)),a=Be.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=qe.fromUtf8(c),c},bytesToBase64:e=>{let t,r,n,s,i,o,a,c="",l=0;if(!e||!ae.isArrayLike(e)||!ae.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+Be.charAt(s)+Be.charAt(i)+Be.charAt(o)+Be.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=Be.indexOf(e.charAt(l++)),i=Be.indexOf(e.charAt(l++)),o=Be.indexOf(e.charAt(l++)),a=Be.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 Fe(e){return Math.floor(Math.random()*e)}function Re(e,t=10){return+parseFloat(Number(e).toExponential(t))}const Ie=180/Math.PI;var Ue={random:Fe,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=Fe(e);r?n.push(s):n.includes(s)||n.push(s)}return n},strip:Re,float:function(e,{digits:t=2,fixed:r=!1}={}){const n=Re(e).toFixed(t);return r||!t?+n:+n.replace(/(\.[1-9]?)0+$/,"$1").replace(/\.$/,"")},radian2degree:function(e){return e*Ie},degree2radian:function(e){return e/Ie},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 De={bytes2str:e=>{if(!e||!ae.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 Me={pkcs7Padding:(e,t)=>{const r=t-e.length%t,n=new Uint8Array(r).fill(r);return De.concatBytes(e,n)},pkcs7Unpadding:e=>{const t=e[e.length-1];return e.slice(0,-t)}};const Ke=(e,t=!1)=>{const r=new Uint8Array(e);return t?Le.bytesToBase64(r):r.reduce(((e,t)=>e+String.fromCharCode(t)),"")};var ze={...De,...Me,...qe,...Le,str2ab:(e="",t=!1)=>{if(t)return Le.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:Ke,utf8ToBase64:e=>ae.isBrowser?btoa(e):Buffer.from(e,"utf-8").toString("base64"),base64ToUtf8:e=>ae.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]=Ue.random(256);return t},textEncode:e=>qe.toUtf8Bytes(e),textDecode:e=>qe.fromUtf8Bytes(new Uint8Array(e)),toDataUrl:(e,t="text/plain")=>e?"string"==typeof e?`data:${t};base64,`+Le.toBase64(e):ae.isArrayBuffer(e)?`data:${t};base64,`+Ke(e,!0):"":""};const Ne=e=>{try{const t=ze.ab2str(e,!0);return t.match(/.{1,64}/g)?.join("\n")||""}catch(e){return""}},He=(e="",t="PUBLIC KEY")=>`-----BEGIN ${t}-----\n${e}\n-----END ${t}-----`;var Ve={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=Ne(r),s=He(n,"PUBLIC KEY"),i=await window.crypto.subtle.exportKey("pkcs8",t.privateKey),o=Ne(i);return{publicKey:n,publicKeyPem:s,privateKey:o,privateKeyPem:He(o,"PRIVATE KEY")}}catch(e){return console.error("generateKeys failed:",e),{publicKey:"",publicKeyPem:"",privateKey:"",privateKeyPem:""}}},format_pem_key:He,format_pem_content:Ne,encrypt:async(e,t,r)=>{try{const n=(new TextEncoder).encode(t),s=await e.importKey("spki",ze.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=ze.concatBytes(...i);return ze.bytesToBase64(o)}catch(e){return console.error("[debug] encrypt",e),""}},decrypt:async(e,t,r)=>{try{const n=ze.base64ToBytes(t),s=await e.importKey("pkcs8",ze.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=ze.concatBytes(...i);return(new TextDecoder).decode(a)}catch(e){return console.error("decrypt failed:",e),""}}};const We=()=>c.default.webcrypto.subtle;var Ze={generateKeys:()=>Ve.generateKeys(We()),encrypt:async(e,t)=>Ve.encrypt(We(),e,t),decrypt:async(e,t)=>Ve.decrypt(We(),e,t),encode:async e=>Ve.encrypt(We(),e,Ve.RSAPublicKey),decode:async e=>Ve.decrypt(We(),e,Ve.RSAPrivateKey)};const Ye="undefined"!=typeof window?window.crypto.subtle:{};var Qe={generateKeys:()=>Ve.generateKeys(Ye),encrypt:async(e,t)=>Ve.encrypt(Ye,e,t),decrypt:async(e,t)=>Ve.decrypt(Ye,e,t),encode:async e=>Ve.encrypt(Ye,e,Ve.RSAPublicKey),decode:async e=>Ve.decrypt(Ye,e,Ve.RSAPrivateKey)};const Je=2654435769,Ge=(e,t)=>{let r=0;for(let n=0;n<32;n++)r=r+Je>>>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},Xe=(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-Je>>>0;return e},et=e=>{const t=ze.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},tt=(e,t)=>{const r=ze.pkcs7Padding(e,8),n=et(t),s=[];for(let e=0;e<r.length;e+=8){const t=ze.bytesToUint32(r.slice(e,e+8)),i=Ge(t,n);s.push(ze.uint32ToBytes(i))}return ze.concatBytes(...s)},rt=(e,t)=>{const r=et(t),n=[];for(let t=0;t<e.length;t+=8){const s=ze.bytesToUint32(e.slice(t,t+8)),i=Xe(s,r);n.push(ze.uint32ToBytes(i))}const s=ze.concatBytes(...n);return ze.pkcs7Unpadding(s)};var nt={TEAKey:"33576f37387276645054657a6831686e454664424e5652456f47794835795942",encrypt:Ge,decrypt:Xe,toTeaKey:et,encode:(e,t)=>{const r=ze.textEncode(e),n=tt(r,t);return ze.bytesToBase64(n)},decode:(e,t)=>{const r=ze.base64ToBytes(e),n=rt(r,t);return ze.textDecode(n.buffer)},encodeBytes:tt,decodeBytes:rt};function st(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 it=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff\\ufe0e\\ufe0f]");function ot(e){return it.test(e)}const at="\\ud800-\\udfff",ct=`[${at}]`,lt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]",ut="\\ud83c[\\udffb-\\udfff]",ht=`[^${at}]`,dt="(?:\\ud83c[\\udde6-\\uddff]){2}",ft="[\\ud800-\\udbff][\\udc00-\\udfff]",pt=`${`(?:${lt}|${ut})`}?`,gt="[\\ufe0e\\ufe0f]?",yt=gt+pt+`(?:\\u200d(?:${[ht,dt,ft].join("|")})${gt+pt})*`,mt=`(?:${[`${ht}${lt}?`,lt,dt,ft,ct].join("|")})`,wt=RegExp(`${ut}(?=${ut})|${mt+yt}`,"g");function bt(e){return ot(e)?function(e){return e.match(wt)||[]}(e):function(e){return e.split("")}(e)}function _t(e){return t=>{if(!t)return"";const r=ot(t)?bt(t):void 0,n=r?r[0]:t[0],s=r?st(r,1).join(""):t.slice(1);return n[e]()+s}}const vt="\\ud800-\\udfff",xt="\\u2700-\\u27bf",At="a-z\\xdf-\\xf6\\xf8-\\xff",St="A-Z\\xc0-\\xd6\\xd8-\\xde",kt="\\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",Ct="['’]",$t=`[${kt}]`,Ot=`[${xt}]`,Et=`[${At}]`,jt=`[^${vt}${kt+"\\d"+xt+At+St}]`,Pt="(?:\\ud83c[\\udde6-\\uddff]){2}",Tt="[\\ud800-\\udbff][\\udc00-\\udfff]",qt=`[${St}]`,Bt=`(?:${Et}|${jt})`,Lt=`(?:${qt}|${jt})`,Ft=`(?:${Ct}(?:d|ll|m|re|s|t|ve))?`,Rt=`(?:${Ct}(?:D|LL|M|RE|S|T|VE))?`,It="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]|\\ud83c[\\udffb-\\udfff])?",Ut="[\\ufe0e\\ufe0f]?",Dt=Ut+It+`(?:\\u200d(?:${[`[^${vt}]`,Pt,Tt].join("|")})${Ut+It})*`,Mt=`(?:${[Ot,Pt,Tt].join("|")})${Dt}`,Kt=RegExp([`${qt}?${Et}+${Ft}(?=${[$t,qt,"$"].join("|")})`,`${Lt}+${Rt}(?=${[$t,qt+Bt,"$"].join("|")})`,`${qt}?${Bt}+${Ft}`,`${qt}+${Rt}`,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])","\\d+",Mt].join("|"),"g");const zt=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 ]/),Nt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Ht(e,t){if(void 0===t){const t=zt(e)?function(e){return e.match(Kt)}(e):function(e){return e.match(Nt)}(e);return t||[]}return e.match(t)||[]}function Vt(e){if(null==e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return`${e.map((e=>null==e?e:Vt(e)))}`;if(ae.isSymbol(e))return e.toString();const t=`${e}`;return"0"==t&&1/e==-Infinity?"-0":t}const Wt=_t("toUpperCase"),Zt=_t("toLowerCase");var Yt={toString:Vt,startCase:e=>Ht(`${e}`.replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+Wt(t)),""),snakeCase:e=>Ht(Vt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"_":"")+t.toLowerCase()),""),kebabCase:e=>Ht(Vt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?"-":"")+t.toLowerCase()),""),camelCase:e=>Ht(Vt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>(t=t.toLowerCase(),e+(r?Wt(t):t))),""),upperCase:e=>Ht(Vt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toUpperCase()),""),upperFirst:Wt,lowerCase:e=>Ht(Vt(e).replace(/['\u2019]/g,"")).reduce(((e,t,r)=>e+(r?" ":"")+t.toLowerCase()),""),lowerFirst:Zt,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}}};var Qt={logString:e=>{try{const t=JSON.stringify(e);return void 0===t?"":nt.encode(t,ze.hex2str(nt.TEAKey))}catch(e){return""}},logParse:e=>{try{if(!e)return"";const t=nt.decode(e,ze.hex2str(nt.TEAKey));return Yt.jsonFormat(t)}catch(e){return""}},logRString:async e=>{try{const t=JSON.stringify(e);if(void 0===t)return"";return ae.isBrowser?await Qe.encode(t):await Ze.encode(t)}catch(e){return""}},logRParse:async e=>{try{if(!e)return"";const t=ae.isBrowser?await Qe.decode(e):await Ze.decode(e);return Yt.jsonFormat(t)}catch(e){return""}}};var Jt={...$e,...Qt,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="")=>Te.I.exec(e,t),debounce:xe,throttle:function(e,t=300,r={}){let n=!0,s=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return ae.isObject(r)&&(n=r.leading?!!r.leading:n,s=r.trailing?!!r.trailing:s),xe(e,t,{leading:n,maxWait:t,trailing:s})},task:e=>new Ae(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)=>Te.I.pipeline.push(e,t),pipeline:(e=1)=>new Pe(e),safeTask:(e,t)=>new je(e,t)};function Gt(e){return e!=e}function Xt(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 er,tr,rr=(er=Object.keys,tr=Object,function(e){return er(tr(e))}),nr=Math.max;function sr(e,t){var r=ae.isArray(e)||ae.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&&!F.hasOwnProperty.call(e,i)||s&&("length"==i||ae.isIndex(i,n))||r.push(i);return r}const ir=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]=ir(e[r]));return t};const or=(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]=ar(e[o],a,r)}return n},ar=(e,t,r={})=>{let n={};return n=e&&"object"==typeof e&&!Array.isArray(e)?or(e,t,r):or({...e},t,r),n},cr=(e,t,r={})=>or({...e},t,{cover:!0,...r}),lr=(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=>{lr(i,e,r,n,s)})),Object.defineProperty(e,t,{configurable:!0,enumerable:!0,set:o=>{r.call(n,o,i),i=o,s&&lr(e,t,r,n,s)},get:()=>i})};var ur={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:Yt.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:ir,merge:ar,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]=Yt.parseValue(n,{number:t,boolean:r});else e[n]=Yt.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:cr,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=cr(r,e,{ignoreUndefined:n,ignoreNull:s,ignoreZero:i,ignoreEmptyArray:o,ignoreEmptyString:a,cover:c}))),r},observe:lr,find:(e,t)=>{if(e&&"object"==typeof e)return Object.entries(e||{}).find((([e,r])=>!(!t||!t(e,r))))}};var hr={...ae,...F,...ur,...Ee,includes:function(e,t,r,n){e=ae.isArrayLike(e)?e:function(e){return e?Xt(e,function(e){return ae.isArrayLike(e)?sr(e):function(e){if(!ae.isPrototype(e))return rr(e);var t=[];for(var r in Object(e))F.hasOwnProperty.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}(e)):[]}(e),r=r&&!n?we.toInteger(r):0;var s=e.length;return r<0&&(r=nr(s+r,0)),ae.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,Gt,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(ae.isObject(e)&&(r=ae.isArray(e)?e.entries():Object.entries(e),r))for(const[e,n]of r)t&&t(e,n)}};var dr={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]:[]}};var fr={...dr,stepAction:function(e,t,r=100){if(!ae.isFunction(t))return;if(!ae.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(!ae.isArray(e)||e.length<=0)return[];const r=t;return e.slice(r)},take:function(e,t,r=0){if(!ae.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!ae.isArray(e)||e.length<=0?[]:[...new Set(e)]},randoms:function(e,t=1,r=!1){const n=e.length||0;return Ue.randoms(n,t,r).map((t=>e[t]))||[]},toKV:(e,t,r)=>{const n={};return t&&r?((e||[]).forEach((e=>{if(!e||!ae.isObject(e))return;const s=e[t];(ae.isString(s)&&""!==s||ae.isNumber(s))&&(n[s]=e[r])})),n):n}};const pr="[object Object]",gr="[object Array]",yr=e=>Object.prototype.toString.call(e),mr=(e,t,r=!1)=>{if(e===t)return;const n=yr(e);if(n===yr(t))if(n===gr&&e.length>=t.length)for(let r=0;r<t.length;r++)mr(e[r],t[r]);else if(n===pr&&Object.keys(e).length>=Object.keys(t).length)for(let n in t)r||void 0!==e[n]?mr(e[n],t[n]):e[n]=null},wr=(e,t,r,n="",s=!1)=>{if(e===t)return;const i=yr(e),o=yr(t);if(i===gr&&o===i&&e.length>=t.length)for(let s=0;s<e.length;s++)wr(e[s],t[s],r,`${n}[${s}]`);else if(i===pr&&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=yr(s),c=yr(o);if(s!==o)if(a===gr&&c===a&&s.length>=o.length)for(let e=0;e<s.length;e++)wr(s[e],o[e],r,`${n?n+".":""}${i}[${e}]`);else if(a===pr&&c===a&&Object.keys(s).length>=Object.keys(o).length)for(let e in s)wr(s[e],o[e],r,`${n?n+".":""}${i}.${e}`);else r[`${n?n+".":""}${i}`]=s}}else r[n]=e};class br{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 _r{reqConfig={};handleRequest;handleEncrypt;handleDecrypt;handleError;interceptors={request:new br,response:new br};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){_r.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete _r.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=ur.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(_r.blockId,(()=>this._fetch(s,n.hasEncrypt))),i=await _r.requestLock[_r.blockId].request;else if(_r.requestLock[_r.blockId]&&_r.requestLock[_r.blockId].lock&&await _r.requestLock[_r.blockId].request,"debounce"===n.model||"debounceUrl"===n.model){let e;e="debounceUrl"===n.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),_r.requestLock[e]||this.lockR(e,(()=>this._fetch(s,n.hasEncrypt))),i=await _r.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 vr=e=>"function"!=typeof e?e:(t={})=>new Promise(((r,n)=>{e(Object.assign(t,{success:r,fail:n}))}));var xr={diff:function(e,t){const r={};return(e=>{if(yr(e)===pr)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];yr(n[t])!==pr&&(n[t]={}),n=n[t]}n[r[s-1]]=e[t],delete e[t]}})(e),mr(e,t,!0),wr(e,t,r,"",!0),r},promixify:vr,run:(e,t={})=>e?Jt.run(vr(e)(t)):Jt.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:_r,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;ur.observe(s,o,a,e,c)}))}};const Ar=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 h=(e=e.split(t)).length;u>0&&h>u&&(h=u);for(let t=0;t<h;++t){let n,o,a,u,h=e[t].replace(l,"%20"),d=h.indexOf(r);d>=0?(n=h.substr(0,d),o=h.substr(d+1)):(n=h,o=""),a=i?decodeURIComponent(n):n,u=i?decodeURIComponent(o):o,F.hasOwnProperty.call(c,a)&&s?Array.isArray(c[a])?c[a].push(u):c[a]=[c[a],u]:c[a]=u}return ur.parseValue(c,{number:o,boolean:a}),c},Sr=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},kr=function(e,t=!0){return t?encodeURIComponent(e):e},Cr=function(e,{cleanZero:t=!1,cleanNull:r=!1,cleanWhitespace:n=!1}={}){return!(!t||0!==e)||(!(!r||null!=e)||!(!n||"string"!=typeof e||""!==e.trim()))},$r=/^(https?):\/\/([\w.\_\-]+)(?::(\d+))?/,Or=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}},Er=e=>{const t={href:e,url:"",origin:"",protocol:"",host:"",port:"",query:""};if(!e)return t;const r=e.match($r);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},jr=(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 Pr={parse:Ar,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=kr(Sr(n),s)+r,l=e[n];return Array.isArray(l)?l.map((function(e){return c+kr(Sr(e),s)})).join(t):Cr(l,{cleanZero:i,cleanNull:o,cleanWhitespace:a})?"":c+kr(Sr(l),s)})).filter(Boolean).join(t):n?kr(Sr(n),s)+r+kr(Sr(e),s):""},https:e=>e?e.replace(/^http[s]?/,"https"):e,parseUrl:e=>{const t=Er(e),{origin:r="",url:n="",query:s=""}=t,i=Or(n),o=Ar(s,{multiple:!0,uri:!1});return{...t,...i,pathname:n.substring(n.indexOf(r||"")+r.length),params:o}},parsePath:Or,parseHost:Er,join:(...e)=>{let t=[];return e.forEach((e=>{const r=e.trim().replace(/^\/*(.*?)\/*$/,"$1");r.length<=0||(/^(\w+):\/\//.test(r)?t=[r]:t.push(r))})),t.join("/")},shExpMatch:jr,isLocalIpAddress:e=>!!e&&!!(jr(e,"127.0.0.1")||jr(e,"localhost")||jr(e,"192.168.*.*"))};const Tr=/%[sdj%]/g;let qr=()=>{};function Br(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 Lr(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(Tr,(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 Fr(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 Rr(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&&(qr=(e,t)=>{"undefined"!=typeof console&&console.warn&&"undefined"==typeof ASYNC_VALIDATOR_NO_WARNING&&t.every((e=>"string"==typeof e))&&console.warn(e,t)});class Ir extends Error{errors;fields;constructor(e,t){super("Async Validation Error"),this.errors=e,this.fields=t}}function Ur(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);Rr(o,r,(e=>(n(e),e.length?i(new Ir(e,Br(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 h=e=>{if(l.push.apply(l,e),c++,c===a)return n(l),l.length?u(new Ir(l,Br(l))):t(s)};o.length||(n(l),t(s)),o.forEach((t=>{const n=e[t];-1!==i.indexOf(t)?Rr(n,r,h):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,h)}))}));return u.catch((e=>e)),u}function Dr(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],function(e){return!(!e||void 0===e.message)}(r)?(r.field=r.field||e.fullField,r.fieldValue=n,r):{message:"function"==typeof r?r():r,fieldValue:n,field:r.field||e.fullField}}}function Mr(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 Kr=(e,t,r,n,s,i)=>{!e.required||r.hasOwnProperty(e.field||"")&&!Fr(t,i||e.type)||n.push(Lr(s.messages.required,e.fullField))};let zr;const Nr=/^(([^<>()\[\]\\.,;:\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,}))$/,Hr=/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i,Vr={integer:e=>Vr.number(e)&&parseInt(e,10)===e,float:e=>Vr.number(e)&&!Vr.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&&!Vr.array(e),method:e=>"function"==typeof e,email:e=>"string"==typeof e&&e.length<=320&&!!e.match(Nr),url:e=>"string"==typeof e&&e.length<=2048&&!!e.match((()=>{if(zr)return zr;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 zr=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"),zr})()),hex:e=>"string"==typeof e&&!!e.match(Hr)},Wr="enum";var Zr={required:Kr,whitespace:(e,t,r,n,s)=>{(/^\s+$/.test(t)||""===t)&&n.push(Lr(s.messages.whitespace,e.fullField))},type:(e,t,r,n,s)=>{if(e.required&&void 0===t)return void Kr(e,t,r,n,s);const i=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(i)>-1?Vr[i](t)||n.push(Lr(s.messages.types[i],e.fullField,e.type)):i&&typeof t!==e.type&&n.push(Lr(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 h="number"==typeof t,d="string"==typeof t,f=Array.isArray(t);if(h?u="number":d?u="string":f&&(u="array"),!u)return!1;f&&(l=t.length),d&&(l=t.replace(c,"_").length),i?l!==e.len&&n.push(Lr(s.messages[u].len,e.fullField,e.len)):o&&!a&&l<e.min?n.push(Lr(s.messages[u].min,e.fullField,e.min)):a&&!o&&l>e.max?n.push(Lr(s.messages[u].max,e.fullField,e.max)):o&&a&&(l<e.min||l>e.max)&&n.push(Lr(s.messages[u].range,e.fullField,e.min,e.max))},enum:(e,t,r,n,s)=>{e[Wr]=Array.isArray(e[Wr])?e[Wr]:[],-1===e[Wr].indexOf(t)&&n.push(Lr(s.messages[Wr],e.fullField,e[Wr].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(Lr(s.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||n.push(Lr(s.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};const Yr=(e,t,r,n,s)=>{const i=e.type,o=[];if(e.required||!e.required&&n.hasOwnProperty(e.field)){if(Fr(t,i)&&!e.required)return r();Zr.required(e,t,n,o,s,i),Fr(t,i)||Zr.type(e,t,n,o,s)}r(o)};var Qr={string:(e,t,r,n,s)=>{const i=[];if(e.required||!e.required&&n.hasOwnProperty(e.field||"")){if(Fr(t,"string")&&!e.required)return r();Zr.required(e,t,n,i,s,"string"),Fr(t,"string")||(Zr.type(e,t,n,i,s),Zr.range(e,t,n,i,s),Zr.pattern(e,t,n,i,s),!0===e.whitespace&&Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&Zr.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),Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&(Zr.type(e,t,n,i,s),Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),Fr(t)||Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&(Zr.type(e,t,n,i,s),Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&(Zr.type(e,t,n,i,s),Zr.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();Zr.required(e,t,n,i,s,"array"),null!=t&&(Zr.type(e,t,n,i,s),Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s),void 0!==t&&Zr.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(Fr(t,"string")&&!e.required)return r();Zr.required(e,t,n,i,s),Fr(t,"string")||Zr.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(Fr(t,"date")&&!e.required)return r();if(Zr.required(e,t,n,i,s),!Fr(t,"date")){let r;r=t instanceof Date?t:new Date(t),Zr.type(e,r,n,i,s),r&&Zr.range(e,r.getTime(),n,i,s)}}r(i)},url:Yr,hex:Yr,email:Yr,required:(e,t,r,n,s)=>{const i=[],o=Array.isArray(t)?"array":typeof t;Zr.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(Fr(t)&&!e.required)return r();Zr.required(e,t,n,i,s)}r(i)}};function Jr(){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 Gr=Jr();class Xr{static register=function(e,t){if("function"!=typeof t)throw new Error("Cannot register a validator by type, validator is not a function");Qr[e]=t};static warning=qr;static messages=Gr;static validators=Qr;rules={};_messages=Gr;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=Mr(Jr(),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===Gr&&(e=Jr()),Mr(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 Ur(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&&Xr.warning("async-validator:",l),l.length&&void 0!==r.message&&(l=[].concat(r.message));let u=l.map(Dr(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(Dr(r,n)):s.error&&(u=[s.error(r,Lr(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 Xr(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=Br(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&&!Qr.hasOwnProperty(e.type))throw new Error(Lr("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]?Qr.required:Qr[this.getType(e)]||void 0}}function en(e){return new Xr(e)}var tn={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:en,validate:function(e,t,r={},n=(()=>{})){return Jt.run(en(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)}};var rn={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})$/}};const nn=e=>Le.toBase64(e);var sn={encode:nn,decode:e=>Le.fromBase64(e),encodeByOss:e=>nn(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};var on={...y,base64:sn,tea:nt,uuid:m,guid:(e,t=!1,r="")=>{const n=m(e||32);return t?k.now().format("yyyyMMddhhmmss")+r+n:n},getHexString:e=>{const t=y.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 an=e=>{if(!e)return"";if(!hr.isObject(e))return"";let t="";return hr.forof(e,((e,r)=>{r&&(t+=`${Yt.kebabCase(e)}:${r};`)})),t},cn=["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"],ln=["top","bottom","left","right","padding","margin","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","height","width","border","borderLeft","borderRight","borderTop","borderBottom","borderColor","borderRadius"],un=(e,t="px")=>e&&t?"0"===e?e:tn.isFloat(e.toString())?`${e}${t}`:e:e;var hn={stringify:an,parse:(e,{camel:t=!1,pure:r=!0}={})=>{if(!e.trim())return;const n=Pr.parse(e,{sep:";",eq:":",uri:!1}),s={};return hr.forof(n,((e,n)=>{if(!n)return;const i=t?r&&e.startsWith("_")?e:Yt.camelCase(e):e;tn.isFloat(n)||n.length>=2&&n.startsWith(".")&&tn.isNumber(n.substr(1))?s[i]=+n:s[i]=n})),s},fixValue:un,style:(e,t="px")=>{if(!e)return"";const r=hr.copy(e,{fields:cn});hr.forof(r,((e,n)=>{(ln.includes(e)||ln.includes(Yt.camelCase(e)))&&(r[e]=un(n,t))}));return an(r)},commonFields:cn};const dn=(e,t="",r=!1)=>{try{if(!e)return;const n=Pr.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}?${Pr.stringify(t,{uri:!1})}`,i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="blob",i.onload=function(){fn(i.response,s)},i.onerror=function(t){console.error(`[ddan] downloadUrl ${e}`,t)},i.send()}}catch(t){console.error(`[ddan] downloadUrl ${e}`,t)}},fn=(e,t="")=>{try{if(!e)return;const r=URL?.createObjectURL(e);if(!r)return;dn(r,t),URL?.revokeObjectURL(r)}catch(e){console.error("[ddan] downloadFile",e)}},pn=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)))})),yn=(e,t=!0)=>!(!t||"prompt"!==e)||"granted"===e;var mn={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:dn,download:(e,t="")=>{e&&("string"!=typeof e?fn(e,t):dn(e,t))},downloadFile:fn,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();dn(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=>{yn(t,!1)?navigator.clipboard.writeText(e).then((()=>r(!0))).catch((()=>r(pn(e)))):r(pn(e))})).catch((()=>{r(pn(e))})):r(pn(e))})),queryPermission:gn,isAllowed:yn,legacyCopy:pn};var wn={ossImage:(e,t={})=>{if(!e)return e;const r=Pr.parseUrl(e).url;if(t.domain){if(!e.startsWith("http"))return e;const r=fr.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=Pr.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=>Le.toBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")};const bn=({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 _n(e){const{response:t}=e;return 0===t.code?Promise.resolve(t):Promise.reject(t)}function vn(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(hr.isPlainObject(e)){const r=Pr.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 xn{host="";reqConfig={};handleError;interceptors={request:new br,response:new br};constructor(e){this.host=e.host||"",this.reqConfig=e.config,this.interceptors.request.use(e.handleRequest||[]),this.interceptors.request.use(vn),this.interceptors.response.use(e.handleResponse||_n),this.handleError=e.handleError}static blockId="blockid";static requestLock={};lockR(e,t){xn.requestLock[e]={lock:!0,request:t()}}unlockR(e){delete xn.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=hr.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(xn.blockId,(()=>bn(s))),i=await xn.requestLock[xn.blockId].request;else if(xn.requestLock[xn.blockId]&&xn.requestLock[xn.blockId].lock&&await xn.requestLock[xn.blockId].request,"debounce"===r.model||"debounceUrl"===r.model){let e;e="debounceUrl"===r.model?this.getIdFromReqUrl(s):this.getIdFromReq(s),xn.requestLock[e]||this.lockR(e,(()=>bn(s))),i=await xn.requestLock[e].request,this.unlockR(e)}else i=await bn(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)}}}const An={overrode:!1,tag:!1,format:"hh:mm:ss.SSS"},Sn=e=>(...t)=>{const r=console[e];An.overrode?r(...t):kn(r,e,...t)},kn=(e,t,...r)=>{const n=k.format(new Date,An.format),s=An.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 Cn={override:()=>{if(An.overrode)return;An.overrode=!0;["log","info","warn","error"].forEach((e=>{const t=console[e];console[e]=(...r)=>{kn(t,e,...r)}}))},log:Sn("log"),info:Sn("info"),warn:Sn("warn"),error:Sn("error"),config:({tag:e=An.tag,format:t=An.format}={})=>{An.tag=e,An.format=t}};var $n={getDataURL:e=>{const t={contentType:"",dataUrl:""};return $e.to(fetch(e).then((e=>(t.contentType=e.headers.get("content-type")||"",e.arrayBuffer()))).then((e=>(t.dataUrl=`data:${t.contentType};base64,`+ze.ab2str(e,!0),t))))},getArrayBuffer:async e=>$e.to(fetch(e).then((e=>e.arrayBuffer()))),getJson:async e=>$e.to(fetch(e).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=Ue.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=>$e.to(fetch(e).then((e=>e.text())))};const On=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,${sn.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}`}},En=(e,t,r)=>({key:e,fields:t,storage:r});class jn{key;storage;fields=[];constructor(e){this.key=e?.key||"",this.fields=e?.fields||[],this.storage=e?.storage||void 0}save=Jt.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=ur.copy(e,{fields:this.fields});this.save(r)}}class Pn extends w{setters={};getters={};actions={};persist;constructor(){super()}async dispatch(e,t=void 0){const r=this,n=Reflect.get(r.actions,e);if(!ae.isFunction(n))return;const[,s]=await Jt.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=ur.copy(t);else{const[,t]=await Jt.exec((()=>this.dispatch(e)),`${this.__eventId}_${e}`);r=t}return r}commit(e,t){ae.isObject(t)&&(t=ur.copy(t)),this[e]=t}}const Tn=(e,t)=>{const r=Object.assign(new Pn,e||{});r.__persist=new jn(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 ae.isFunction(n)?n(e):Reflect.get(e,t,r)},set:(e,t,r,n)=>{const s=Reflect.get(e.setters,t);if(ae.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 qn{host="";list=[];constructor(e,t={}){this._parseHost(e);const{width:r=500,height:n=400}=t,s=Pr.parseUrl(e)?.params||{};s["x-oss-process"]=`image/resize,w_${r},h_${n},m_fill`;const i=Pr.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=on.base64.encodeByOss(n),i=Pr.stringify({image:s,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}text(e,t={},r={}){if(!e)return;const n={g:"nw",...t},s=on.base64.encodeByOss(e),i=Pr.stringify({text:s,...n,...r},{sep:",",eq:"_"});this.list.push(`/watermark,${i}`)}result(){return this.list.join("")}}const Bn=(e,t)=>new qn(e,t);class Ln{__list=[];constructor(){this.clear()}add(e){const t=Jt.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 Fn=new class{state=Tn(new Pn);frame=new b;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||k.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&&!k.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=hr.copy(r);hr.forof(n,((e,t)=>{"day"!==t.cycle&&void 0!==t.cycle||k.isToday(t.time||0)||delete r[e]})),this.setCache(t,r)};parallel=()=>new Ln};class Rn{id="";start=0;end=0;cost=0;name="";type="";desc="";timeStartDesc="";timeEndDesc="";isDone=!1;flag=0;constructor(){this.id=m(),this.start=Date.now(),this.timeStartDesc=k.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=k.format(this.end,"hh:mm:ss.SSS"),this.isDone=!0)}}const In=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 Rn;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=ur.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 fr.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)))}};var Un={brotliCompress:function(e,t=l.default.constants.BROTLI_DEFAULT_QUALITY){try{if(!e)return"";const r=ze.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=ze.base64ToBytes(e);return l.default.brotliDecompressSync(t).toString("utf-8")}catch(t){return e||""}}};var Dn={child_exec:e=>new Promise((t=>{if(!e)return t([null,""]);i.exec(e,((e,r)=>{t(e?[e||"error",""]:[null,r||""])}))}))};const Mn=()=>{try{return"win32"===process.platform?Kn():"darwin"===process.platform?zn():void 0}catch(e){return}},Kn=async()=>{do{let e,t;if([e,t]=await Dn.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)},zn=async()=>{do{let e,t;if([e,t]=await Dn.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)},Nn=(e,t=["*"],r="DIRECT")=>{const n=e||r||"DIRECT",s=r||"DIRECT",i=`\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 = "${n}";\n var _default = "${s}";\n\n for (var i = 0; i < _rules.length; i++) {\n if (shExpMatch(host, _rules[i])) {\n return _proxy;\n }\n }\n\n return _default;\n }\n `;return ze.toDataUrl(i,"application/x-ns-proxy-autoconfig")},Hn=(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 Vn={getSystemProxy:Mn,toPacScript:Nn,toPacProxy:Hn,pacScript:async(e,t,r)=>{const{type:n="SOCKS5",rules:s=["*"],useSystem:i}=r||{},o=Hn(e,t,{type:n});if(!o)return"";let a;if(i){const e=await Mn();e&&(a=Hn(e?.ipaddress||"",e?.port||0,{direct:!0}))}return Nn(o,s||[],a)}};class Wn{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 ze.ab2str(r,!0)}async importKey(e,t="raw",r=[]){const n=ze.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=ze.base64ToBytes(r),s=ze.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s);return ze.ab2str(i,!0)}async encodeiv(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv,n=r?ze.base64ToBytes(r):ze.getRandomBytes(12),s=ze.textEncode(e),i=await this.__subtle.encrypt({name:"AES-GCM",iv:n},this.__sharedSecret,s),o=ze.concatBytes(new Uint8Array(i),n);return ze.bytesToBase64(o)}async decode(e,t){if(!this.__sharedSecret)return"";const r=t||this.iv;if(!r)return"";const n=ze.base64ToBytes(e),s=ze.base64ToBytes(r),i=await this.__subtle.decrypt({name:"AES-GCM",iv:s},this.__sharedSecret,n);return ze.textDecode(i)}async decodeiv(e){if(!this.__sharedSecret)return"";const t=ze.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 ze.textDecode(s)}}const Zn=(e,t)=>new Promise(((r,n)=>{h.default.readdir(e,(async(s,i)=>{if(s)return n(s);r(Yn(e,i,t))}))})),Yn=async(e,t,r)=>{for(let n of t){const t=`${e}\\${n}`;h.default.lstatSync(t).isDirectory()?await Zn(`${t}`,r):r&&await r(t)}};var Qn={...{readDirectory:Zn,readFiles:Yn},...Un,...Dn,...Vn,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=ze.base64ToBytes(r),s=c.default.createCipheriv("aes-256-gcm",ze.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?ze.base64ToBytes(r):ze.getRandomBytes(12),s=c.default.createCipheriv("aes-256-gcm",ze.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",ze.base64ToBytes(this.sharedSecret),ze.base64ToBytes(r)),s=ze.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=ze.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",ze.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 Wn{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 w,this.upstreamProxy=this.filterProxyConfigs(e),this._updateRules(),this.__debug=t,this.__uuid=m(),this.__pipeline=new Pe(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] handle 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&&!Pr.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(!Pr.isLocalIpAddress(e))for(const t of this.upstreamProxy)if(this.isAllowedDomain(e,t.rules||[]))return t}isAllowedDomain(e,t){if(Pr.isLocalIpAddress(e))return!1;if(!t||!Array.isArray(t))return!1;for(const r of t){if("*"===r)return!0;if(Pr.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=fr.distinct(this.upstreamProxy.reduce(((e,t)=>e.concat(t?.rules||[])),[])))}},rsa:Ze},Jn={Ecdh:Wn};class Gn{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 Xn{_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 Gn(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)}}}"undefined"!=typeof window&&require("./modules/node");const es={gbk:d,math:Ue,list:fr,string:Yt,time:k,obj:ur,rule:tn,regex:rn,...ze,...on,...hr,Event:w},ts=hr.singleton,rs={...ze,...on,...Jt,...Yt,...Ue,qs:Pr,singleton:ts},ns={mini:xr,css:hn,qs:Pr,icon:On,html:mn},ss={cdn:wn,watermark:Bn},is={Store:Pn,storeRef:Tn,Persist:jn,persistConfig:En},os=Fn,as=In,cs=Cn,ls={fetch:$n,Http:xn,css:hn,qs:Pr,icon:On,html:mn,rsa:Qe,...Jn},us={...Qn};var hs={gbk:d,time:k,hook:Jt,math:Ue,util:hr,list:fr,string:Yt,obj:ur,crypto:on,mini:xr,qs:Pr,css:hn,cdn:wn,html:mn,icon:On,rule:tn,regex:rn,convert:ze,KValue:Gn,Mapping:Xn,Event:w,Http:xn,Store:Pn,storeRef:Tn,Persist:jn,persistConfig:En,watermark:Bn,joker:Fn,tracker:In,logger:Cn,fetch:$n,rsa:Qe};e.Event=w,e.KValue=Gn,e.Mapping=Xn,e.dCdn=ss,e.dHook=rs,e.dJoker=os,e.dLogger=cs,e.dMini=ns,e.dNode=us,e.dStore=is,e.dTracker=as,e.dUtil=es,e.dWeb=ls,e.default=hs,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/bin/lib/index.js
CHANGED
|
@@ -30,18 +30,19 @@ const watermark_1 = require("./class/watermark");
|
|
|
30
30
|
const joker_1 = require("./class/joker");
|
|
31
31
|
const tracker_1 = require("./class/tracker");
|
|
32
32
|
const rsa_1 = require("./modules/rsa");
|
|
33
|
+
const node_1 = require("./modules/node");
|
|
33
34
|
const browser_1 = require("./modules/browser");
|
|
34
35
|
const kvalue_1 = require("./class/kvalue");
|
|
35
36
|
exports.KValue = kvalue_1.default;
|
|
36
37
|
const mapping_1 = require("./class/mapping");
|
|
37
38
|
exports.Mapping = mapping_1.default;
|
|
38
|
-
let
|
|
39
|
+
let _dNode;
|
|
39
40
|
if (typeof window !== 'undefined') {
|
|
40
41
|
const _node = require('./modules/node');
|
|
41
|
-
|
|
42
|
+
_dNode = _node;
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
44
|
-
|
|
45
|
+
_dNode = {};
|
|
45
46
|
}
|
|
46
47
|
const dUtil = {
|
|
47
48
|
gbk: gbk_1.default,
|
|
@@ -66,7 +67,7 @@ const dHook = {
|
|
|
66
67
|
...string_1.default,
|
|
67
68
|
...math_1.default,
|
|
68
69
|
qs: qs_1.default,
|
|
69
|
-
singleton
|
|
70
|
+
singleton,
|
|
70
71
|
};
|
|
71
72
|
exports.dHook = dHook;
|
|
72
73
|
const dMini = { mini: mini_1.default, css: css_1.default, qs: qs_1.default, icon: icon_1.default, html: html_1.default };
|
|
@@ -83,6 +84,8 @@ const dLogger = logger_1.default;
|
|
|
83
84
|
exports.dLogger = dLogger;
|
|
84
85
|
const dWeb = { fetch: fetch_1.default, Http: http_1.default, css: css_1.default, qs: qs_1.default, icon: icon_1.default, html: html_1.default, rsa: rsa_1.default, ...browser_1.default };
|
|
85
86
|
exports.dWeb = dWeb;
|
|
87
|
+
const dNode = { ...node_1.default };
|
|
88
|
+
exports.dNode = dNode;
|
|
86
89
|
exports.default = {
|
|
87
90
|
gbk: gbk_1.default,
|
|
88
91
|
time: time_1.default,
|
|
@@ -5,6 +5,7 @@ const net_1 = require("net");
|
|
|
5
5
|
const socks_1 = require("socks");
|
|
6
6
|
const uuid_1 = require("../crypto/uuid");
|
|
7
7
|
const index_1 = require("../qs/index");
|
|
8
|
+
const list_1 = require("../list");
|
|
8
9
|
const event_1 = require("../../class/event");
|
|
9
10
|
const pipeline_1 = require("../hook/modules/pipeline");
|
|
10
11
|
const Socks5Event = {
|
|
@@ -24,9 +25,11 @@ class Socks5 {
|
|
|
24
25
|
__logger;
|
|
25
26
|
__totalReceived = 0;
|
|
26
27
|
__totalSent = 0;
|
|
28
|
+
__rules = [];
|
|
27
29
|
constructor(upstreamProxy, debug = false, logger) {
|
|
28
30
|
this.__event = new event_1.default();
|
|
29
31
|
this.upstreamProxy = this.filterProxyConfigs(upstreamProxy);
|
|
32
|
+
this._updateRules();
|
|
30
33
|
this.__debug = debug;
|
|
31
34
|
this.__uuid = (0, uuid_1.default)();
|
|
32
35
|
this.__pipeline = new pipeline_1.default(1);
|
|
@@ -49,6 +52,9 @@ class Socks5 {
|
|
|
49
52
|
get totalSent() {
|
|
50
53
|
return this.__totalSent;
|
|
51
54
|
}
|
|
55
|
+
get rules() {
|
|
56
|
+
return this.__rules;
|
|
57
|
+
}
|
|
52
58
|
validateProxyConfig(proxyConfig) {
|
|
53
59
|
const { ipaddress, port, userId, password } = proxyConfig || {};
|
|
54
60
|
if (!ipaddress || typeof ipaddress !== 'string') {
|
|
@@ -109,6 +115,7 @@ class Socks5 {
|
|
|
109
115
|
if (!configs || configs.length <= 0)
|
|
110
116
|
return false;
|
|
111
117
|
this.upstreamProxy = configs;
|
|
118
|
+
this._updateRules();
|
|
112
119
|
return true;
|
|
113
120
|
}
|
|
114
121
|
setSystemProxy(use, config) {
|
|
@@ -162,7 +169,7 @@ class Socks5 {
|
|
|
162
169
|
const addr = destination.addr;
|
|
163
170
|
addrport = `${addr}:${destination.port}`;
|
|
164
171
|
this.__debug && this.__logger?.info(`[socks5] handle connection`, addrport);
|
|
165
|
-
const proxyConfig = this.
|
|
172
|
+
const proxyConfig = this.findProxyConfig(addr);
|
|
166
173
|
if (proxyConfig) {
|
|
167
174
|
// 走上游代理
|
|
168
175
|
const upstreamSocket = await this.connectToUpstreamProxy(destination, proxyConfig);
|
|
@@ -339,7 +346,7 @@ class Socks5 {
|
|
|
339
346
|
clientSocket.end();
|
|
340
347
|
});
|
|
341
348
|
}
|
|
342
|
-
|
|
349
|
+
findProxyConfig(addr) {
|
|
343
350
|
if (index_1.default.isLocalIpAddress(addr))
|
|
344
351
|
return undefined;
|
|
345
352
|
for (const cfg of this.upstreamProxy) {
|
|
@@ -408,5 +415,10 @@ class Socks5 {
|
|
|
408
415
|
// nothing
|
|
409
416
|
}
|
|
410
417
|
}
|
|
418
|
+
_updateRules() {
|
|
419
|
+
if (!this.upstreamProxy)
|
|
420
|
+
return;
|
|
421
|
+
this.__rules = list_1.default.distinct(this.upstreamProxy.reduce((prev, current) => prev.concat(current?.rules || []), []));
|
|
422
|
+
}
|
|
411
423
|
}
|
|
412
424
|
exports.Socks5 = Socks5;
|
package/bin/types/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import Store from './class/store';
|
|
|
5
5
|
import Persist from './class/persist';
|
|
6
6
|
import KValue from './class/kvalue';
|
|
7
7
|
import Mapping from './class/mapping';
|
|
8
|
-
declare let dNode: any;
|
|
9
8
|
declare const dUtil: {
|
|
10
9
|
Event: typeof Event;
|
|
11
10
|
includes: typeof import("./util/includes").default;
|
|
@@ -645,7 +644,43 @@ declare const dWeb: {
|
|
|
645
644
|
decode: (encryptedBase64: string) => Promise<string>;
|
|
646
645
|
};
|
|
647
646
|
};
|
|
648
|
-
|
|
647
|
+
declare const dNode: {
|
|
648
|
+
Ecdh: typeof import("./modules/node/ecdh").default;
|
|
649
|
+
EcdhWeb: typeof import("./modules/node/ecdh-web").default;
|
|
650
|
+
Socks5: typeof import("./modules/node/socks5").Socks5;
|
|
651
|
+
rsa: {
|
|
652
|
+
generateKeys: () => Promise<{
|
|
653
|
+
publicKey: string;
|
|
654
|
+
publicKeyPem: string;
|
|
655
|
+
privateKey: string;
|
|
656
|
+
privateKeyPem: string;
|
|
657
|
+
}>;
|
|
658
|
+
encrypt: (data: string, publicKey: string) => Promise<string>;
|
|
659
|
+
decrypt: (encryptedBase64: string, privateKey: string) => Promise<string>;
|
|
660
|
+
encode: (data: string) => Promise<string>;
|
|
661
|
+
decode: (encryptedBase64: string) => Promise<string>;
|
|
662
|
+
};
|
|
663
|
+
getSystemProxy: () => Promise<{
|
|
664
|
+
ipaddress: string;
|
|
665
|
+
port: number;
|
|
666
|
+
} | undefined> | undefined;
|
|
667
|
+
toPacScript: (proxy: string, rules?: string[], defaultProxy?: string) => string;
|
|
668
|
+
toPacProxy: (ipaddress: string, port: number, options?: {
|
|
669
|
+
type?: "PROXY" | "SOCKS5" | "ALL" | undefined;
|
|
670
|
+
direct?: boolean | undefined;
|
|
671
|
+
} | undefined) => string;
|
|
672
|
+
pacScript: (host: string, port: number, options?: {
|
|
673
|
+
rules?: string[] | undefined;
|
|
674
|
+
type?: "PROXY" | "SOCKS5" | "ALL" | undefined;
|
|
675
|
+
useSystem?: boolean | undefined;
|
|
676
|
+
} | undefined) => Promise<string>;
|
|
677
|
+
child_exec: (cmd: string) => Promise<[any, string]>;
|
|
678
|
+
brotliCompress: typeof import("./modules/node/brotli").brotliCompress;
|
|
679
|
+
brotliDecompress: typeof import("./modules/node/brotli").brotliDecompress;
|
|
680
|
+
readDirectory: (dir: string, callback?: import("./typings").Ddan.Func1<string, any> | undefined) => Promise<unknown>;
|
|
681
|
+
readFiles: (dir: string, files: string[], callback?: import("./typings").Ddan.Func1<string, any> | undefined) => Promise<void>;
|
|
682
|
+
};
|
|
683
|
+
export { dUtil, dHook, dWeb, dMini, dCdn, dStore, dJoker, dTracker, dLogger, dNode, Event, KValue, Mapping, };
|
|
649
684
|
declare const _default: {
|
|
650
685
|
gbk: {
|
|
651
686
|
gbkLength: (str: string) => number;
|
|
@@ -34,12 +34,14 @@ export declare class Socks5 {
|
|
|
34
34
|
__logger: ILogger;
|
|
35
35
|
__totalReceived: number;
|
|
36
36
|
__totalSent: number;
|
|
37
|
+
__rules: string[];
|
|
37
38
|
constructor(upstreamProxy: IRuleProxy | IRuleProxy[], debug?: boolean, logger?: ILogger);
|
|
38
39
|
get id(): string;
|
|
39
40
|
get port(): number;
|
|
40
41
|
get url(): string;
|
|
41
42
|
get totalReceived(): number;
|
|
42
43
|
get totalSent(): number;
|
|
44
|
+
get rules(): string[];
|
|
43
45
|
validateProxyConfig(proxyConfig: IProxy): "" | "无效的上游代理 IP 地址" | "无效的上游代理端口" | "无效的上游代理用户名" | "无效的上游代理密码";
|
|
44
46
|
private filterProxyConfigs;
|
|
45
47
|
start(startPort?: number): Promise<number>;
|
|
@@ -85,12 +87,13 @@ export declare class Socks5 {
|
|
|
85
87
|
private connectToProxy;
|
|
86
88
|
private connectToLocal;
|
|
87
89
|
private setupDataForwarding;
|
|
88
|
-
|
|
90
|
+
findProxyConfig(addr: string): IRuleProxy | undefined;
|
|
89
91
|
private isAllowedDomain;
|
|
90
92
|
close(): void;
|
|
91
93
|
on(name: Socks5EventType, listener: (...args: any[]) => void): void;
|
|
92
94
|
off(name: Socks5EventType, listener: (...args: any[]) => void): void;
|
|
93
95
|
resetStatistics(): void;
|
|
94
96
|
private _emit;
|
|
97
|
+
private _updateRules;
|
|
95
98
|
}
|
|
96
99
|
export {};
|