@mptool/all 0.10.6 → 0.10.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/lib/index.d.mts +10 -2
- package/lib/index.d.ts +10 -2
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/package.json +4 -4
package/lib/index.d.mts
CHANGED
|
@@ -462,7 +462,11 @@ interface ExtendedComponentMethods extends InstanceEmitterMethods {
|
|
|
462
462
|
type ComponentInstance<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends Partial<WechatMiniprogram.Component.MethodOption>, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = WechatMiniprogram.Component.InstanceProperties & WechatMiniprogram.Component.InstanceMethods<Data> & ExtendedComponentMethods & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>) & InstanceProps & ExtendedComponentProperty & ExtendedPageMethods<Data & InferPropTypes<Props>, InstanceProps & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>)> & {
|
|
463
463
|
/** 组件数据,**包括内部数据和属性值** */
|
|
464
464
|
data: Data & InferPropTypes<Props>;
|
|
465
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* @deprecated 优先使用 `data`
|
|
467
|
+
*
|
|
468
|
+
* 组件数据,**包括内部数据和属性值**(与 `data` 一致)
|
|
469
|
+
*/
|
|
466
470
|
properties: Data & InferPropTypes<Props>;
|
|
467
471
|
};
|
|
468
472
|
type ComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = Partial<WechatMiniprogram.Component.Data<Data>> & Partial<{
|
|
@@ -1006,6 +1010,10 @@ declare const isDir: (path: string) => boolean;
|
|
|
1006
1010
|
declare const rm: (path: string, type?: "dir" | "file") => void;
|
|
1007
1011
|
/** 列出目录下内容 */
|
|
1008
1012
|
declare const ls: (path: string) => string[];
|
|
1013
|
+
interface ReadFile {
|
|
1014
|
+
(path: string): string | undefined;
|
|
1015
|
+
<T extends FileEncoding>(path: string, encoding: T): (T extends "binary" ? ArrayBuffer : string) | undefined;
|
|
1016
|
+
}
|
|
1009
1017
|
/**
|
|
1010
1018
|
* 文件管理器读取文件包装
|
|
1011
1019
|
*
|
|
@@ -1013,7 +1021,7 @@ declare const ls: (path: string) => string[];
|
|
|
1013
1021
|
* @param encoding 文件的编码格式,默认 `utf-8`
|
|
1014
1022
|
* @returns 文件内容
|
|
1015
1023
|
*/
|
|
1016
|
-
declare const readFile:
|
|
1024
|
+
declare const readFile: ReadFile;
|
|
1017
1025
|
/**
|
|
1018
1026
|
* 读取并解析 JSON 文件
|
|
1019
1027
|
*
|
package/lib/index.d.ts
CHANGED
|
@@ -462,7 +462,11 @@ interface ExtendedComponentMethods extends InstanceEmitterMethods {
|
|
|
462
462
|
type ComponentInstance<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends Partial<WechatMiniprogram.Component.MethodOption>, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = WechatMiniprogram.Component.InstanceProperties & WechatMiniprogram.Component.InstanceMethods<Data> & ExtendedComponentMethods & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>) & InstanceProps & ExtendedComponentProperty & ExtendedPageMethods<Data & InferPropTypes<Props>, InstanceProps & Method & (IsPage extends true ? WechatMiniprogram.Page.ILifetime : Record<never, never>)> & {
|
|
463
463
|
/** 组件数据,**包括内部数据和属性值** */
|
|
464
464
|
data: Data & InferPropTypes<Props>;
|
|
465
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* @deprecated 优先使用 `data`
|
|
467
|
+
*
|
|
468
|
+
* 组件数据,**包括内部数据和属性值**(与 `data` 一致)
|
|
469
|
+
*/
|
|
466
470
|
properties: Data & InferPropTypes<Props>;
|
|
467
471
|
};
|
|
468
472
|
type ComponentOptions<Data extends WechatMiniprogram.Component.DataOption, Props extends PropsOptions, Method extends WechatMiniprogram.Component.MethodOption, InstanceProps extends WechatMiniprogram.IAnyObject = Record<never, never>, IsPage extends boolean = false> = Partial<WechatMiniprogram.Component.Data<Data>> & Partial<{
|
|
@@ -1006,6 +1010,10 @@ declare const isDir: (path: string) => boolean;
|
|
|
1006
1010
|
declare const rm: (path: string, type?: "dir" | "file") => void;
|
|
1007
1011
|
/** 列出目录下内容 */
|
|
1008
1012
|
declare const ls: (path: string) => string[];
|
|
1013
|
+
interface ReadFile {
|
|
1014
|
+
(path: string): string | undefined;
|
|
1015
|
+
<T extends FileEncoding>(path: string, encoding: T): (T extends "binary" ? ArrayBuffer : string) | undefined;
|
|
1016
|
+
}
|
|
1009
1017
|
/**
|
|
1010
1018
|
* 文件管理器读取文件包装
|
|
1011
1019
|
*
|
|
@@ -1013,7 +1021,7 @@ declare const ls: (path: string) => string[];
|
|
|
1013
1021
|
* @param encoding 文件的编码格式,默认 `utf-8`
|
|
1014
1022
|
* @returns 文件内容
|
|
1015
1023
|
*/
|
|
1016
|
-
declare const readFile:
|
|
1024
|
+
declare const readFile: ReadFile;
|
|
1017
1025
|
/**
|
|
1018
1026
|
* 读取并解析 JSON 文件
|
|
1019
1027
|
*
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";for(var Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ss=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Gt=0;Gt<Mn.length;Gt++)ss[Mn.charCodeAt(Gt)]=Gt;const zt=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let dt=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Fn;const L=zt==="js"?console:((Fn=wx.getRealtimeLogManager)==null?void 0:Fn.call(wx))||wx.getLogManager({level:1}),Oe=zt!=="js"&&"getRealtimeLogManager"in wx,os=(...t)=>{wx.env.DEBUG&&(Oe?L.info("debug",...t):L.debug(...t))},as=(...t)=>{L.info(...t),L!==console&&console.info(...t)},cs=(...t)=>{L.warn(...t),L!==console&&console.warn(...t)},ls=(...t)=>{Oe?L.error(...t):L.warn("error",...t),L!==console&&console.error(...t)},hs=t=>{Oe&&L.setFilterMsg(t)};var H=Object.freeze({__proto__:null,debug:os,error:ls,filter:hs,info:as,warn:cs});const us=(t="")=>t?new Promise((e,n)=>{wx.setClipboardData({data:t,success:()=>e(),fail:({errMsg:r})=>n(new dt({message:r}))})}):Promise.reject(new Error("data is empty")),Ct=(t,e,n,r)=>{wx.showModal({title:t,content:e,showCancel:!!r,theme:"day",success:({confirm:i})=>{i?n==null||n():r==null||r()},fail:()=>r==null?void 0:r()})},ds=(t,e="",n,r=()=>{})=>{Ct("操作确认",`您确定要${t}么?${e}`,n,r)},fs=(t,e,n,r=!1)=>{wx.showModal({title:t,content:e,confirmText:"重试",theme:"day",success:({confirm:i})=>{i?n():r&&getCurrentPages().length>1&&wx.navigateBack()}})},P=(t,e=1500,n="none")=>new Promise((r,i)=>{wx.showToast({title:t,icon:n,duration:e,success:()=>r(),fail:({errMsg:s})=>i(new dt({message:s}))})}),ps=()=>(wx.getWindowInfo||wx.getSystemInfoSync)();var gs=Object.defineProperty,ms=Object.defineProperties,bs=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,ys=Object.prototype.hasOwnProperty,ws=Object.prototype.propertyIsEnumerable,Un=(t,e,n)=>e in t?gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Pe=(t,e)=>{for(var n in e||(e={}))ys.call(e,n)&&Un(t,n,e[n]);if(Bn)for(var n of Bn(e))ws.call(e,n)&&Un(t,n,e[n]);return t},De=(t,e)=>ms(t,bs(e));const xs=t=>new Promise((e,n)=>{if(zt==="donut")return wx.addPhoneContact(De(Pe({},t),{success:()=>e()}));wx.getSetting({success:({authSetting:r})=>{r["scope.addPhoneContact"]?wx.addPhoneContact(De(Pe({},t),{success:()=>e()})):wx.authorize({scope:"scope.addPhoneContact",success:()=>{wx.addPhoneContact(De(Pe({},t),{success:()=>e()}))},fail:()=>{Ct("权限被拒","如果想要保存联系人,请在“权限设置”允许添加到联系人权限",()=>{wx.openSetting(),n(new dt({message:"用户拒绝权限"}))})}})}})}),vs=(t,e)=>{const n=t.split("."),r=e.split("."),i=Math.max(n.length,r.length);for(;n.length<i;)n.push("0");for(;r.length<i;)r.push("0");for(let s=0;s<i;s++){const o=parseInt(n[s]),c=parseInt(r[s]);if(o>c)return 1;if(o<c)return-1}return 0},Rn=()=>{const t=getCurrentPages();return t[t.length-1]||null},As=()=>{var t,e;return(e=(t=Rn())==null?void 0:t.route)!=null?e:""},Vn=()=>{wx.getNetworkType({success:({networkType:t})=>{switch(t){case"wifi":wx.startWifi({success:()=>{wx.getConnectedWifi({success:({wifi:e})=>{e.signalStrength<.5&&P("Wifi 信号不佳")},fail:()=>{P("无法连接网络")}})},fail:()=>{P("无法连接网络")}});break;case"2g":case"3g":P("您的网络状态不佳");break;case"none":P("您没有连接到网络");break;default:P("网络连接出现问题,请稍后重试")}H.error("Request fail with",t)},fail:()=>{P("网络连接出现问题,请稍后重试"),H.error("Request fail and cannot get networkType")}})},Wt=(t,e=!1)=>new Promise((n,r)=>{wx.downloadFile({url:t,success:({statusCode:i,tempFilePath:s})=>{if(wx.hideLoading(),i===200)n(s);else{const o=`Download ${t} failed with statusCode: ${i}`;P("下载失败"),H.warn(o),r(new dt({code:i,message:o}))}},fail:({errMsg:i})=>{wx.hideLoading(),r(new dt({message:i})),Vn(),H.warn(`Download ${t} failed:`,i)}}).onProgressUpdate(({progress:i})=>{wx.showLoading({title:`下载中...${Math.round(i)}%`,mask:e})})}),Ss=t=>{Wt(t).then(e=>{wx.openDocument({filePath:e,showMenu:!0,success:()=>{H.debug(`打开文档 ${e} 成功`)},fail:({errMsg:n})=>{H.error(`打开文档 ${e} 失败`,n)}})}).catch(()=>{var e;P("下载文档失败"),(e=wx.reportEvent)==null||e.call(wx,"resource_load_failed",{broken_url:t})})},$s=(t,e=(n=>(n=(r=>(r=/\/([^/]+)\.[^/]+?$/.exec(t))==null?void 0:r[1])())!=null?n:"document")())=>{wx.canIUse("addFileToFavorites")&&Wt(t).then(n=>{const r=t.split(".").pop();wx.addFileToFavorites({fileName:`${e}.${r}`,filePath:n,success:()=>{Ct("文件已保存","文件已保存至“微信收藏”"),H.debug(t,"添加至收藏成功")},fail:({errMsg:i})=>{H.error(t,"添加至收藏失败",i)}})}).catch(()=>{var n;P("下载文档失败"),(n=wx.reportEvent)==null||n.call(wx,"resource_load_failed",{broken_url:t})})},Cs=t=>Wt(t).then(e=>new Promise((n,r)=>{if(zt==="donut")return wx.saveImageToPhotosAlbum({filePath:e,success:()=>n()});wx.getSetting({success:({authSetting:i})=>{i["scope.writePhotosAlbum"]?wx.saveImageToPhotosAlbum({filePath:e,success:()=>n()}):wx.authorize({scope:"scope.writePhotosAlbum",success:()=>{wx.saveImageToPhotosAlbum({filePath:e,success:()=>n()})},fail:()=>{Ct("权限被拒","如果想要保存图片,请在“权限设置”允许保存图片权限",()=>{r(new dt({message:"用户拒绝权限"})),wx.openSetting()})}})}})})),Es=t=>{var e;const n=(e=wx.getUpdateManager)==null?void 0:e.call(wx);n&&(n.onCheckForUpdate(({hasUpdate:r})=>{r&&P("发现小程序更新,下载中...")}),n.onUpdateReady(()=>{t(()=>{n.applyUpdate()})}),n.onUpdateFailed(({errMsg:r})=>{P("小程序更新下载失败,请检查您的网络!"),H.error("更新应用失败",r)}))};for(var ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Et=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Qt=0;Qt<ft.length;Qt++)Et[ft.charCodeAt(Qt)]=Qt;var ks=function(t){var e=new Uint8Array(t),n,r=e.length,i="";for(n=0;n<r;n+=3)i+=ft[e[n]>>2],i+=ft[(e[n]&3)<<4|e[n+1]>>4],i+=ft[(e[n+1]&15)<<2|e[n+2]>>6],i+=ft[e[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Ts=function(t){var e=t.length*.75,n=t.length,r,i=0,s,o,c,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var l=new ArrayBuffer(e),h=new Uint8Array(l);for(r=0;r<n;r+=4)s=Et[t.charCodeAt(r)],o=Et[t.charCodeAt(r+1)],c=Et[t.charCodeAt(r+2)],a=Et[t.charCodeAt(r+3)],h[i++]=s<<2|o>>4,h[i++]=(o&15)<<4|c>>2,h[i++]=(c&3)<<6|a&63;return l};const _e=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var Is=(t,e,n)=>new Promise((r,i)=>{var s=a=>{try{c(n.next(a))}catch(l){i(l)}},o=a=>{try{c(n.throw(a))}catch(l){i(l)}},c=a=>a.done?r(a.value):Promise.resolve(a.value).then(s,o);c((n=n.apply(t,e)).next())});function Zt(t=new Map){return{all:t,on:(e,n)=>{const r=t.get(e);r?r.push(n):t.set(e,[n])},off:(e,n)=>{const r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:(e,n)=>{let r=t.get(e);r&&r.slice().map(i=>i(n)),r=t.get("*"),r&&r.slice().map(i=>i(e,n))},emitAsync:(e,n)=>Is(this,null,function*(){var r,i;yield Promise.all(((r=t.get(e))!=null?r:[]).slice().map(s=>s(n))),yield Promise.all(((i=t.get("*"))!=null?i:[]).slice().map(s=>s(e,n)))})}}let Ns=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Hn;const M=_e==="js"?console:((Hn=wx.getRealtimeLogManager)==null?void 0:Hn.call(wx))||wx.getLogManager({level:1}),je=_e!=="js"&&"getRealtimeLogManager"in wx,qs=(...t)=>{wx.env.DEBUG&&(je?M.info("debug",...t):M.debug(...t))},Os=(...t)=>{M.info(...t),M!==console&&console.info(...t)},Ps=(...t)=>{M.warn(...t),M!==console&&console.warn(...t)},Ds=(...t)=>{je?M.error(...t):M.warn("error",...t),M!==console&&console.error(...t)},_s=t=>{je&&M.setFilterMsg(t)};var Z=Object.freeze({__proto__:null,debug:qs,error:Ds,filter:_s,info:Os,warn:Ps});const js=(t="",e="&")=>{const n={},r=t?t.split(e):void 0;return r&&r.length>0&&r.forEach(i=>{const[s,o]=i.split("=");n[s]=o}),n},Gn=(t={},e="&",n=!1)=>Object.keys(t).map(r=>{const i=t[r];return`${r}=${n?i:encodeURIComponent(i)}`}).join(e),Ls=(t,e,n=!1)=>{const r=Gn(e,"&",n);return r?`${t}${/[?&]$/u.test(t)?"":t.includes("?")?"&":"?"}${r}`:t};var zn=Object.freeze({__proto__:null,join:Ls,parse:js,stringify:Gn});const Wn=t=>{if(t===void 0)return"undefined";const e=typeof t;if(e==="object"){if(t===null)return"null";const n=/\[object (\w+)\]/u.exec(Object.prototype.toString.call(t));return n?n[1].toLowerCase():""}return e},Qn=t=>Wn(t)==="function";function F(t,e){return function(...n){if(e.apply(this,n),t)return t.apply(this,n)}}const Ms=(t,e)=>{let n;return function(...r){if(!n)return n=!0,t.apply(e!=null?e:this,[()=>{n=!1},...r])}},Fs=(t,e)=>{let n;return function(...r){if(!(n||!t))return n=!0,t.apply(e!=null?e:null,r)}};let Zn=class{constructor(e=1){this.capacity=e,this.funcQueue=[],this.running=0}next(){const e=this.funcQueue.shift();if(e){const{func:n,ctx:r,args:i}=e,s=()=>{n.apply(r,[()=>{this.running-=1,this.next()},...[].slice.call(i,0)])};this.running+=1,s()}}add(e,n,...r){this.funcQueue.push({func:e,ctx:n,args:[].slice.call(r,0)}),this.running<this.capacity&&this.next()}clear(){this.funcQueue=[]}};const Bs=(t,e=1)=>{const n=new Zn(e);return function(...r){n.add(t,this,...r)}},Le="a",Jn="al",Yn="n",Xn="p",Kn="r",tr="u",G=Zt(),Jt=Zt(),z=Zt(),J={launch:!1,lOpt:{},hide:0},Us=t=>{J.launch=!0,J.lOpt=t,G.emit(Jn,t)},Rs=()=>{J.hide&&(G.emit(Le,new Date().getTime()-J.hide),J.hide=0)},Vs=()=>{J.hide=new Date().getTime()},Hs=t=>{t.onLaunch=F(t.onLaunch,Us),t.onShow=F(t.onShow,Rs),t.onHide=F(t.onHide,Vs),t.onAwake&&(G.on(Le,e=>{Z.debug(`App: awake after ${e}ms`),t.onAwake(e)}),Z.debug("App: registered onAwake")),t.$on=z.on,t.$off=z.off,t.$emit=z.emit,t.$emitAsync=z.emitAsync,App(t)},Me={},er=t=>Me[t],Gs=(t,e)=>{Me[t]=e},zs=t=>{delete Me[t]};var Ws=Object.defineProperty,Qs=Object.defineProperties,Zs=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,ir=(t,e,n)=>e in t?Ws(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sr=(t,e)=>{for(var n in e||(e={}))nr.call(e,n)&&ir(t,n,e[n]);if(Yt)for(var n of Yt(e))rr.call(e,n)&&ir(t,n,e[n]);return t},or=(t,e)=>Qs(t,Zs(e)),Js=(t,e)=>{var n={};for(var r in t)nr.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Yt)for(var r of Yt(t))e.indexOf(r)<0&&rr.call(t,r)&&(n[r]=t[r]);return n};let Xt;const Ys=t=>{const e=t,{defaultPage:n,pages:r=[],getPath:i}=e,s=Js(e,["defaultPage","pages","getPath"]);if(Qn(i)){Xt=or(sr({},s),{getPath:i});return}let o={},c={};const a=(l,h)=>{const d=h.replace(/\$name/g,l);o[l]=d,c[d]=l};Array.isArray(r)?r.forEach(([l,h])=>{typeof l=="string"?a(l,h):l.forEach(d=>a(d,h))}):typeof r=="object"&&(o=r,c=Object.fromEntries(Object.keys(r).map(l=>[r[l],l]))),Xt=or(sr({},s),{getPath:l=>o[l]||n.replace(/\$name/g,l)})},et=()=>{if(!Xt)throw new Error("$Config is not called");return Xt};let kt=!0;const ar=t=>{const e=et(),[n,r]=t.split("?"),i=n.startsWith("/")?n:e.getPath(n);return{path:i,query:zn.parse(r),url:`${i}${r?`?${r}`:""}`}};function Kt(t){return e=>{if(kt){kt=!1;const{path:n,url:r,query:i}=ar(e);return Promise.race([Jt.emitAsync(`${Yn}:${n}`,i),new Promise(s=>{var o;setTimeout(()=>s(),(o=et().maxDelay)!=null?o:200)})]).then(()=>(kt=!0,wx[t]({url:r})))}}}G.on(Kn,()=>{var t;setTimeout(()=>{kt=!0},(t=et().minInterval)!=null?t:100)}),G.on(tr,()=>{kt=!0});const Fe=Kt("navigateTo"),Be=Kt("redirectTo"),Ue=Kt("switchTab"),te=Kt("reLaunch");function ee(t){return function(e){if(e){const{before:n,after:r,url:i}=e.currentTarget.dataset;if(this&&n&&typeof this[n]=="function"&&this[n](e),i)return t(i).then(()=>{this&&r&&typeof this[r]=="function"&&this[r](e)})}}}const Xs=ee(Fe),Ks=ee(Be),to=ee(Ue),eo=ee(te),cr=(t=1)=>{const{home:e}=et();return getCurrentPages().length<=t&&e?te(e):wx.navigateBack({delta:t})},no=function(t){if(t){const{before:e,after:n,delta:r=1}=t.currentTarget.dataset;return this&&e&&typeof this[e]=="function"&&this[e](t),Promise.resolve(cr(Number(r))).then(()=>{this&&n&&typeof this[n]=="function"&&this[n](t)})}},ro=()=>getCurrentPages().slice(0).pop(),io=t=>{const{path:e,query:n}=ar(t);Jt.emit(`${Xn}:${e}`,n)};function lr(t){const{args:e,event:n,id:r}=t.detail;switch(n){case"_$attached":{const i=er(r);if(!i)break;const s=i.$refID;s&&this.$refs&&(this.$refs[s]=i),i._$attached(this);break}default:{const i=this[n];i&&i.apply(this,e)}}}function hr(t){const e=et();t.$=lr,t.$refs={},t.$on=z.on,t.$off=z.off,t.$emit=z.emit,t.$emitAsync=z.emitAsync,t.$go=Fe,t.$redirect=Be,t.$switch=Ue,t.$reLaunch=te,t.$back=cr,t.$preload=io,t.$currentPage=ro,t.$getPath=e.getPath,t.$bindGo=Xs,t.$bindRedirect=Ks,t.$bindSwitch=to,t.$bindRelaunch=eo,t.$bindBack=no}var so=Object.defineProperty,oo=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,ur=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,lo=Object.prototype.propertyIsEnumerable,dr=(t,e,n)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Re=(t,e)=>{for(var n in e||(e={}))co.call(e,n)&&dr(t,n,e[n]);if(ur)for(var n of ur(e))lo.call(e,n)&&dr(t,n,e[n]);return t},Ve=(t,e)=>oo(t,ao(e));let ho=0;const uo=(t={})=>{const e={};return Object.keys(t).forEach(n=>{const r=t[n];if(r===null||typeof r=="function")e[n]=r;else{const{type:i}=r;i===null?e[n]={type:null,value:r.default}:Array.isArray(i)?e[n]={type:i[0],value:r.default,optionalTypes:i.slice(1)}:e[n]={type:i,value:r.default}}}),Ve(Re({},e),{ref:{type:String,value:""}})},fo=t=>{const{extendComponent:e,injectComponent:n}=et();return e&&e(t),t.lifetimes||(t.lifetimes={}),t.lifetimes.created=F(t.lifetimes.created,function(){hr(this),n&&n(t)}),t.lifetimes.attached=F(t.lifetimes.attached,function(){const r=ho+=1;this.$id=r,Gs(r,this),this.$refID=this.properties.ref,this.triggerEvent("ing",{id:this.$id,event:"_$attached"})}),t.lifetimes.detached=F(t.lifetimes.detached,function(){var r;zs(this.$id);const i=(r=this.$parent)==null?void 0:r.$refs,s=this.$refID;s&&i&&delete i[s],delete this.$parent}),t.methods=Ve(Re({},t.methods),{$call(r,...i){Z.debug(`Component ${this.$id} call ${r}:`,i),this.triggerEvent("ing",{id:this.$id,event:r,args:i})},$getRef:er,_$attached(r){this.$root=r.$root||r,this.$parent=r},$:lr}),t.observers=Ve(Re({},t.observers),{ref(r){var i;this.$refID&&this.$refID!==r&&((i=this.$parent)!=null&&i.$refs&&delete this.$parent.$refs[this.$refID],this.$refID=r,Z.debug(`Component ${this.$id} ref: ${r}`))}}),t.properties=uo(t.props),delete t.props,Component(t)};let fr=!0;const po=(t,e)=>{const{getPath:n,extendPage:r,injectPage:i}=et(),s=n(t),o=(a,l)=>Z.debug(`Page ${t}: ${a} has been invoked`,l||""),c=a=>Z.debug(`Page ${t}: registered ${a}`);if(r&&r(t,e),e.$name=t,e.$state={firstOpen:!1},e.onAppLaunch){if(J.launch){const{lOpt:a}=J;o("onAppLaunch"),e.onAppLaunch(a)}else G.on(Jn,a=>{o("onAppLaunch"),e.onAppLaunch(a)});c("onAppLaunch")}e.onNavigate&&(Jt.on(`${Yn}:${s}`,a=>(o("onNavigate",a),e.onNavigate(a))),c("onNavigate")),e.onPreload&&(Jt.on(`${Xn}:${s}`,a=>(o("onPreload",a),e.onPreload(a))),c("onPreload")),e.onLoad=F(e.onLoad,()=>{e.onAwake&&(G.on(Le,a=>{o("onAwake"),e.onAwake(a)}),c("onAwake")),fr&&(fr=!1,e.$state.firstOpen=!0)}),e.onReady=F(e.onReady,()=>G.emit(Kn)),e.onUnload=F(e.onUnload,()=>G.emit(tr)),hr(e),i&&i(t,e),e.onRegister&&(o("onRegister"),e.onRegister()),Page(e),Z.debug(`Registered: Page ${t}`)};for(var pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",go=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),ne=0;ne<pr.length;ne++)go[pr.charCodeAt(ne)]=ne;const gr=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let He=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var mr;const B=gr==="js"?console:((mr=wx.getRealtimeLogManager)==null?void 0:mr.call(wx))||wx.getLogManager({level:1}),Ge=gr!=="js"&&"getRealtimeLogManager"in wx,mo=(...t)=>{wx.env.DEBUG&&(Ge?B.info("debug",...t):B.debug(...t))},bo=(...t)=>{B.info(...t),B!==console&&console.info(...t)},yo=(...t)=>{B.warn(...t),B!==console&&console.warn(...t)},wo=(...t)=>{Ge?B.error(...t):B.warn("error",...t),B!==console&&console.error(...t)},xo=t=>{Ge&&B.setFilterMsg(t)};var I=Object.freeze({__proto__:null,debug:mo,error:wo,filter:xo,info:bo,warn:yo});const D=wx.getFileSystemManager(),q=wx.env.USER_DATA_PATH,re=t=>t.split("/").slice(0,-1).join("/"),ze=t=>{try{return D.statSync(`${q}/${t}`,!1),!0}catch(e){return!1}},vo=t=>ze(t)&&D.statSync(`${q}/${t}`).isFile(),br=t=>ze(t)&&D.statSync(`${q}/${t}`).isDirectory(),Ao=(t,e=br(t)?"dir":"file")=>{const n=()=>I.debug(`Deleted ${t}`),r=i=>I.error(`Error deleting ${t}:`,i);if(e==="dir")try{D.rmdirSync(`${q}/${t}`,!0),n()}catch(i){r(i)}else try{D.unlinkSync(`${q}/${t}`),n()}catch(i){r(i)}},So=t=>{try{const e=D.readdirSync(`${q}/${t}`);return I.debug(`Listing ${t} folder:`,e),e}catch(e){return I.error(`Error listing ${t} folder:`,e),[]}},$o=(t,e="utf-8")=>{try{return D.readFileSync(`${q}/${t}`,e)}catch(n){I.warn(`${t} don't exist`);return}},Co=(t,e="utf-8")=>{let n;try{const r=D.readFileSync(`${q}/${t}.json`,e);try{n=JSON.parse(r),I.debug(`Read ${t}.json success:`,n)}catch(i){n=void 0,I.warn(`Parse ${t}.json failed`)}}catch(r){n=void 0,I.warn(`${t}.json doesn't exist`)}return n},ie=(t,e=!0)=>{try{D.mkdirSync(`${q}/${t}`,e)}catch(n){I.debug(`${t} folder already exists`)}},Eo=(t,e)=>{try{D.saveFileSync(t,`${q}/${e}`)}catch(n){I.error(`Saving to ${e} failed:`,n)}},ko=(t,e)=>(ie(re(e)),new Promise((n,r)=>{wx.downloadFile({url:t,filePath:`${q}/${e}`,success:({statusCode:i,tempFilePath:s})=>{if(i===200)return I.debug(`${t} saved`),n(s);I.error(`Download ${t} failed with statusCode ${i}`),r(new He({code:i}))},fail:({errMsg:i})=>{I.error(`Download ${t} failed:`,i),r(new He({message:i}))}})})),To=(t,e,n=e instanceof ArrayBuffer?"binary":"utf-8")=>{ie(re(t)),D.writeFileSync(`${q}/${t}`,e instanceof ArrayBuffer?e:JSON.stringify(e),n)},Io=(t,e,n="utf-8")=>{const r=JSON.stringify(e);ie(re(t)),D.writeFileSync(`${q}/${t}.json`,r,n)},No=(t,e)=>new Promise((n,r)=>{D.unzip({zipFilePath:`${q}/${t}`,targetPath:`${q}/${e}`,success:()=>{n()},fail:({errCode:i,errMsg:s})=>{I.error(`Unzip ${t} failed:`,s),r(new He({code:i,message:s}))}})}),Tt=new Date().getTime();I.debug(`Current sessionId is ${Tt}`);const se={},qo=(t,e)=>{se[t]=e},Oo=t=>{const e=se[t];return se[t]=void 0,e},We=(t,e)=>e?e.expired?e.expired===Tt||new Date().getTime()<e.expired?e.data:(wx.removeStorageSync(`_cache_${t}`),void 0):e.data:void 0,yr=(t,e,n)=>{const r={expired:0,data:e};if(n==="keep"){const i=wx.getStorageSync(`_cache_${t}`);if(!i)return;r.expired=i.expired||0}else n&&(r.expired=n==="once"?Tt:n+new Date().getTime());return r},Po=(t,e,n=0)=>{wx.setStorageSync(`_cache_${t}`,yr(t,e,n))},Do=(t,e,n=0)=>wx.setStorage({key:`_cache_${t}`,data:yr(t,e,n)}).catch(()=>{I.error(`set "${t}" fail`)}),_o=t=>We(t,wx.getStorageSync(`_cache_${t}`)),jo=t=>wx.getStorage({key:`_cache_${t}`}).then(({data:e})=>We(t,e)).catch(()=>{I.error(`set "${t}" fail`)}),Lo=t=>{wx.removeStorageSync(`_cache_${t}`),We(t,null)},Mo=t=>wx.removeStorage({key:`_cache_${t}`}),Fo=()=>{wx.getStorageInfoSync().keys.forEach(t=>{if(t.startsWith("_cache_")){const e=wx.getStorageSync(t);(!e||e.expired!==Tt&&new Date().getTime()>=e.expired)&&wx.removeStorageSync(t)}})},Bo=()=>wx.getStorageInfo().then(({keys:t})=>Promise.all(t.filter(e=>e.startsWith("_cache_")).map(e=>wx.getStorage({key:e}).then(({data:n})=>{if(!n||n.expired!==Tt&&new Date().getTime()>=n.expired)return wx.removeStorage({key:e}).then(()=>{})})))),pt=(t="")=>t.replace(/^(\.*)?(?=\S)/gi,".").replace(/\.+$/,""),wr=t=>t.replace(/[#?].*$/,""),oe=t=>wr(t).replace(/^https?:\/\//,"").split("/").shift().replace(/:\d+$/,""),ae=(t="")=>{if(!t)return[];t=pt(t).replace(/^\.+/gi,"");const e=t.split(".").map(n=>[".",t.slice(t.indexOf(n))].join(""));return[t].concat(e)},xr=t=>{const e=oe(t),n=wr(t).split(e)[1].replace(/^:\d+/,"")||"/";return{domain:e,path:n}},Qe=t=>{const{domain:e="",path:n="/"}=typeof t=="object"?t:typeof t=="string"?xr(t):{};return{domain:pt(e),path:n}};let ce=class{constructor(e){this.expires="session";var n,r,i,s;this.name=(n=e.name)!=null?n:"",this.value=(r=e.value)!=null?r:"",this.domain=(i=e.domain)!=null?i:"",this.path=(s=e.path)!=null?s:"/",this.httpOnly=!!e.httpOnly,this.expires=Number.isInteger(e.maxAge)?e.maxAge>0?new Date(new Date().getTime()+e.maxAge*1e3):"outdate":e.expires?new Date(e.expires):"session"}isExpired(){return this.expires==="outdate"||this.expires instanceof Date&&new Date>this.expires}isPersistence(){return this.expires!=="session"}isDomainMatched(e){return ae(e).includes(this.domain)}isPathMatched(e){return e.startsWith(this.path)||this.path.replace(/\/$/,"")===e}toString(){return`${this.name}=${this.value}`}toJSON(){const e={name:this.name,value:this.value,domain:this.domain};return this.path!=="/"&&(e.path=this.path),this.httpOnly&&(e.httpOnly=this.httpOnly),this.expires instanceof Date&&(e.expires=this.expires),e}};for(var vr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Uo=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),le=0;le<vr.length;le++)Uo[vr.charCodeAt(le)]=le;const nt=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let Ro=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Ar;const U=nt==="js"?console:((Ar=wx.getRealtimeLogManager)==null?void 0:Ar.call(wx))||wx.getLogManager({level:1}),Ze=nt!=="js"&&"getRealtimeLogManager"in wx,Vo=(...t)=>{wx.env.DEBUG&&(Ze?U.info("debug",...t):U.debug(...t))},Ho=(...t)=>{U.info(...t),U!==console&&console.info(...t)},Go=(...t)=>{U.warn(...t),U!==console&&console.warn(...t)},zo=(...t)=>{Ze?U.error(...t):U.warn("error",...t),U!==console&&console.error(...t)},Wo=t=>{Ze&&U.setFilterMsg(t)};var Je=Object.freeze({__proto__:null,debug:Vo,error:zo,filter:Wo,info:Ho,warn:Go}),he={exports:{}},gt={decodeValues:!0,map:!1,silent:!1};function Ye(t){return typeof t=="string"&&!!t.trim()}function Xe(t,e){var n=t.split(";").filter(Ye),r=n.shift(),i=Qo(r),s=i.name,o=i.value;e=e?Object.assign({},gt,e):gt;try{o=e.decodeValues?decodeURIComponent(o):o}catch(a){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+o+"'. Set options.decodeValues to false to disable this feature.",a)}var c={name:s,value:o};return n.forEach(function(a){var l=a.split("="),h=l.shift().trimLeft().toLowerCase(),d=l.join("=");h==="expires"?c.expires=new Date(d):h==="max-age"?c.maxAge=parseInt(d,10):h==="secure"?c.secure=!0:h==="httponly"?c.httpOnly=!0:h==="samesite"?c.sameSite=d:h==="partitioned"?c.partitioned=!0:c[h]=d}),c}function Qo(t){var e="",n="",r=t.split("=");return r.length>1?(e=r.shift(),n=r.join("=")):n=t,{name:e,value:n}}function Sr(t,e){if(e=e?Object.assign({},gt,e):gt,!t)return e.map?{}:[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var n=t.headers[Object.keys(t.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!n&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=n}if(Array.isArray(t)||(t=[t]),e=e?Object.assign({},gt,e):gt,e.map){var r={};return t.filter(Ye).reduce(function(i,s){var o=Xe(s,e);return i[o.name]=o,i},r)}else return t.filter(Ye).map(function(i){return Xe(i,e)})}function Zo(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],n=0,r,i,s,o,c;function a(){for(;n<t.length&&/\s/.test(t.charAt(n));)n+=1;return n<t.length}function l(){return i=t.charAt(n),i!=="="&&i!==";"&&i!==","}for(;n<t.length;){for(r=n,c=!1;a();)if(i=t.charAt(n),i===","){for(s=n,n+=1,a(),o=n;n<t.length&&l();)n+=1;n<t.length&&t.charAt(n)==="="?(c=!0,n=o,e.push(t.substring(r,s)),r=n):n=s+1}else n+=1;(!c||n>=t.length)&&e.push(t.substring(r,t.length))}return e}he.exports=Sr;var Jo=he.exports.parse=Sr;he.exports.parseString=Xe;var $r=he.exports.splitCookiesString=Zo,Yo=Object.defineProperty,Xo=Object.defineProperties,Ko=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertySymbols,ta=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,Er=(t,e,n)=>e in t?Yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,na=(t,e)=>{for(var n in e||(e={}))ta.call(e,n)&&Er(t,n,e[n]);if(Cr)for(var n of Cr(e))ea.call(e,n)&&Er(t,n,e[n]);return t},ra=(t,e)=>Xo(t,Ko(e));const ia=/[^a-z0-9\-#$%&'*+.^_`|~]/i,kr=`
|
|
1
|
+
"use strict";for(var Mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ss=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Gt=0;Gt<Mn.length;Gt++)ss[Mn.charCodeAt(Gt)]=Gt;const zt=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let dt=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Fn;const L=zt==="js"?console:((Fn=wx.getRealtimeLogManager)==null?void 0:Fn.call(wx))||wx.getLogManager({level:1}),Oe=zt!=="js"&&"getRealtimeLogManager"in wx,os=(...t)=>{wx.env.DEBUG&&(Oe?L.info("debug",...t):L.debug(...t))},as=(...t)=>{L.info(...t),L!==console&&console.info(...t)},cs=(...t)=>{L.warn(...t),L!==console&&console.warn(...t)},ls=(...t)=>{Oe?L.error(...t):L.warn("error",...t),L!==console&&console.error(...t)},hs=t=>{Oe&&L.setFilterMsg(t)};var H=Object.freeze({__proto__:null,debug:os,error:ls,filter:hs,info:as,warn:cs});const us=(t="")=>t?new Promise((e,n)=>{wx.setClipboardData({data:t,success:()=>e(),fail:({errMsg:r})=>n(new dt({message:r}))})}):Promise.reject(new Error("data is empty")),Ct=(t,e,n,r)=>{wx.showModal({title:t,content:e,showCancel:!!r,theme:"day",success:({confirm:i})=>{i?n==null||n():r==null||r()},fail:()=>r==null?void 0:r()})},ds=(t,e="",n,r=()=>{})=>{Ct("操作确认",`您确定要${t}么?${e}`,n,r)},fs=(t,e,n,r=!1)=>{wx.showModal({title:t,content:e,confirmText:"重试",theme:"day",success:({confirm:i})=>{i?n():r&&getCurrentPages().length>1&&wx.navigateBack()}})},P=(t,e=1500,n="none")=>new Promise((r,i)=>{wx.showToast({title:t,icon:n,duration:e,success:()=>r(),fail:({errMsg:s})=>i(new dt({message:s}))})}),ps=()=>(wx.getWindowInfo||wx.getSystemInfoSync)();var gs=Object.defineProperty,ms=Object.defineProperties,bs=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,ys=Object.prototype.hasOwnProperty,ws=Object.prototype.propertyIsEnumerable,Un=(t,e,n)=>e in t?gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Pe=(t,e)=>{for(var n in e||(e={}))ys.call(e,n)&&Un(t,n,e[n]);if(Bn)for(var n of Bn(e))ws.call(e,n)&&Un(t,n,e[n]);return t},De=(t,e)=>ms(t,bs(e));const xs=t=>new Promise((e,n)=>{if(zt==="donut")return wx.addPhoneContact(De(Pe({},t),{success:()=>e()}));wx.getSetting({success:({authSetting:r})=>{r["scope.addPhoneContact"]?wx.addPhoneContact(De(Pe({},t),{success:()=>e()})):wx.authorize({scope:"scope.addPhoneContact",success:()=>{wx.addPhoneContact(De(Pe({},t),{success:()=>e()}))},fail:()=>{Ct("权限被拒","如果想要保存联系人,请在“权限设置”允许添加到联系人权限",()=>{wx.openSetting(),n(new dt({message:"用户拒绝权限"}))})}})}})}),vs=(t,e)=>{const n=t.split("."),r=e.split("."),i=Math.max(n.length,r.length);for(;n.length<i;)n.push("0");for(;r.length<i;)r.push("0");for(let s=0;s<i;s++){const o=parseInt(n[s]),c=parseInt(r[s]);if(o>c)return 1;if(o<c)return-1}return 0},Rn=()=>{const t=getCurrentPages();return t[t.length-1]||null},As=()=>{var t,e;return(e=(t=Rn())==null?void 0:t.route)!=null?e:""},Vn=()=>{wx.getNetworkType({success:({networkType:t})=>{switch(t){case"wifi":wx.startWifi({success:()=>{wx.getConnectedWifi({success:({wifi:e})=>{e.signalStrength<.5&&P("Wifi 信号不佳")},fail:()=>{P("无法连接网络")}})},fail:()=>{P("无法连接网络")}});break;case"2g":case"3g":P("您的网络状态不佳");break;case"none":P("您没有连接到网络");break;default:P("网络连接出现问题,请稍后重试")}H.error("Request fail with",t)},fail:()=>{P("网络连接出现问题,请稍后重试"),H.error("Request fail and cannot get networkType")}})},Wt=(t,e=!1)=>new Promise((n,r)=>{wx.downloadFile({url:t,success:({statusCode:i,tempFilePath:s})=>{if(wx.hideLoading(),i===200)n(s);else{const o=`Download ${t} failed with statusCode: ${i}`;P("下载失败"),H.warn(o),r(new dt({code:i,message:o}))}},fail:({errMsg:i})=>{wx.hideLoading(),r(new dt({message:i})),Vn(),H.warn(`Download ${t} failed:`,i)}}).onProgressUpdate(({progress:i})=>{wx.showLoading({title:`下载中...${Math.round(i)}%`,mask:e})})}),Ss=t=>{Wt(t).then(e=>{wx.openDocument({filePath:e,showMenu:!0,success:()=>{H.debug(`打开文档 ${e} 成功`)},fail:({errMsg:n})=>{H.error(`打开文档 ${e} 失败`,n)}})}).catch(()=>{var e;P("下载文档失败"),(e=wx.reportEvent)==null||e.call(wx,"resource_load_failed",{broken_url:t})})},$s=(t,e=(n=>(n=(r=>(r=/\/([^/]+)\.[^/]+?$/.exec(t))==null?void 0:r[1])())!=null?n:"document")())=>{wx.canIUse("addFileToFavorites")&&Wt(t).then(n=>{const r=t.split(".").pop();wx.addFileToFavorites({fileName:`${e}.${r}`,filePath:n,success:()=>{Ct("文件已保存","文件已保存至“微信收藏”"),H.debug(t,"添加至收藏成功")},fail:({errMsg:i})=>{H.error(t,"添加至收藏失败",i)}})}).catch(()=>{var n;P("下载文档失败"),(n=wx.reportEvent)==null||n.call(wx,"resource_load_failed",{broken_url:t})})},Cs=t=>Wt(t).then(e=>new Promise((n,r)=>{if(zt==="donut")return wx.saveImageToPhotosAlbum({filePath:e,success:()=>n()});wx.getSetting({success:({authSetting:i})=>{i["scope.writePhotosAlbum"]?wx.saveImageToPhotosAlbum({filePath:e,success:()=>n()}):wx.authorize({scope:"scope.writePhotosAlbum",success:()=>{wx.saveImageToPhotosAlbum({filePath:e,success:()=>n()})},fail:()=>{Ct("权限被拒","如果想要保存图片,请在“权限设置”允许保存图片权限",()=>{r(new dt({message:"用户拒绝权限"})),wx.openSetting()})}})}})})),Es=t=>{var e;const n=(e=wx.getUpdateManager)==null?void 0:e.call(wx);n&&(n.onCheckForUpdate(({hasUpdate:r})=>{r&&P("发现小程序更新,下载中...")}),n.onUpdateReady(()=>{t(()=>{n.applyUpdate()})}),n.onUpdateFailed(({errMsg:r})=>{P("小程序更新下载失败,请检查您的网络!"),H.error("更新应用失败",r)}))};for(var ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Et=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Qt=0;Qt<ft.length;Qt++)Et[ft.charCodeAt(Qt)]=Qt;var ks=function(t){var e=new Uint8Array(t),n,r=e.length,i="";for(n=0;n<r;n+=3)i+=ft[e[n]>>2],i+=ft[(e[n]&3)<<4|e[n+1]>>4],i+=ft[(e[n+1]&15)<<2|e[n+2]>>6],i+=ft[e[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Ts=function(t){var e=t.length*.75,n=t.length,r,i=0,s,o,c,a;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var l=new ArrayBuffer(e),h=new Uint8Array(l);for(r=0;r<n;r+=4)s=Et[t.charCodeAt(r)],o=Et[t.charCodeAt(r+1)],c=Et[t.charCodeAt(r+2)],a=Et[t.charCodeAt(r+3)],h[i++]=s<<2|o>>4,h[i++]=(o&15)<<4|c>>2,h[i++]=(c&3)<<6|a&63;return l};const _e=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var Is=(t,e,n)=>new Promise((r,i)=>{var s=a=>{try{c(n.next(a))}catch(l){i(l)}},o=a=>{try{c(n.throw(a))}catch(l){i(l)}},c=a=>a.done?r(a.value):Promise.resolve(a.value).then(s,o);c((n=n.apply(t,e)).next())});function Zt(t=new Map){return{all:t,on:(e,n)=>{const r=t.get(e);r?r.push(n):t.set(e,[n])},off:(e,n)=>{const r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:(e,n)=>{let r=t.get(e);r&&r.slice().map(i=>i(n)),r=t.get("*"),r&&r.slice().map(i=>i(e,n))},emitAsync:(e,n)=>Is(this,null,function*(){var r,i;yield Promise.all(((r=t.get(e))!=null?r:[]).slice().map(s=>s(n))),yield Promise.all(((i=t.get("*"))!=null?i:[]).slice().map(s=>s(e,n)))})}}let Ns=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Hn;const M=_e==="js"?console:((Hn=wx.getRealtimeLogManager)==null?void 0:Hn.call(wx))||wx.getLogManager({level:1}),je=_e!=="js"&&"getRealtimeLogManager"in wx,qs=(...t)=>{wx.env.DEBUG&&(je?M.info("debug",...t):M.debug(...t))},Os=(...t)=>{M.info(...t),M!==console&&console.info(...t)},Ps=(...t)=>{M.warn(...t),M!==console&&console.warn(...t)},Ds=(...t)=>{je?M.error(...t):M.warn("error",...t),M!==console&&console.error(...t)},_s=t=>{je&&M.setFilterMsg(t)};var Z=Object.freeze({__proto__:null,debug:qs,error:Ds,filter:_s,info:Os,warn:Ps});const js=(t="",e="&")=>{const n={},r=t?t.split(e):void 0;return r&&r.length>0&&r.forEach(i=>{const[s,o]=i.split("=");n[s]=o}),n},Gn=(t={},e="&",n=!1)=>Object.keys(t).map(r=>{const i=t[r];return`${r}=${n?i:encodeURIComponent(i)}`}).join(e),Ls=(t,e,n=!1)=>{const r=Gn(e,"&",n);return r?`${t}${/[?&]$/u.test(t)?"":t.includes("?")?"&":"?"}${r}`:t};var zn=Object.freeze({__proto__:null,join:Ls,parse:js,stringify:Gn});const Wn=t=>{if(t===void 0)return"undefined";const e=typeof t;if(e==="object"){if(t===null)return"null";const n=/\[object (\w+)\]/u.exec(Object.prototype.toString.call(t));return n?n[1].toLowerCase():""}return e},Qn=t=>Wn(t)==="function";function F(t,e){return function(...n){if(e.apply(this,n),t)return t.apply(this,n)}}const Ms=(t,e)=>{let n;return function(...r){if(!n)return n=!0,t.apply(e!=null?e:this,[()=>{n=!1},...r])}},Fs=(t,e)=>{let n;return function(...r){if(!(n||!t))return n=!0,t.apply(e!=null?e:null,r)}};let Zn=class{constructor(e=1){this.capacity=e,this.funcQueue=[],this.running=0}next(){const e=this.funcQueue.shift();if(e){const{func:n,ctx:r,args:i}=e,s=()=>{n.apply(r,[()=>{this.running-=1,this.next()},...[].slice.call(i,0)])};this.running+=1,s()}}add(e,n,...r){this.funcQueue.push({func:e,ctx:n,args:[].slice.call(r,0)}),this.running<this.capacity&&this.next()}clear(){this.funcQueue=[]}};const Bs=(t,e=1)=>{const n=new Zn(e);return function(...r){n.add(t,this,...r)}},Le="a",Jn="al",Yn="n",Xn="p",Kn="r",tr="u",G=Zt(),Jt=Zt(),z=Zt(),J={launch:!1,lOpt:{},hide:0},Us=t=>{J.launch=!0,J.lOpt=t,G.emit(Jn,t)},Rs=()=>{J.hide&&(G.emit(Le,new Date().getTime()-J.hide),J.hide=0)},Vs=()=>{J.hide=new Date().getTime()},Hs=t=>{t.onLaunch=F(t.onLaunch,Us),t.onShow=F(t.onShow,Rs),t.onHide=F(t.onHide,Vs),t.onAwake&&(G.on(Le,e=>{Z.debug(`App: awake after ${e}ms`),t.onAwake(e)}),Z.debug("App: registered onAwake")),t.$on=z.on,t.$off=z.off,t.$emit=z.emit,t.$emitAsync=z.emitAsync,App(t)},Me={},er=t=>Me[t],Gs=(t,e)=>{Me[t]=e},zs=t=>{delete Me[t]};var Ws=Object.defineProperty,Qs=Object.defineProperties,Zs=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable,ir=(t,e,n)=>e in t?Ws(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,sr=(t,e)=>{for(var n in e||(e={}))nr.call(e,n)&&ir(t,n,e[n]);if(Yt)for(var n of Yt(e))rr.call(e,n)&&ir(t,n,e[n]);return t},or=(t,e)=>Qs(t,Zs(e)),Js=(t,e)=>{var n={};for(var r in t)nr.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Yt)for(var r of Yt(t))e.indexOf(r)<0&&rr.call(t,r)&&(n[r]=t[r]);return n};let Xt;const Ys=t=>{const e=t,{defaultPage:n,pages:r=[],getPath:i}=e,s=Js(e,["defaultPage","pages","getPath"]);if(Qn(i)){Xt=or(sr({},s),{getPath:i});return}let o={},c={};const a=(l,h)=>{const d=h.replace(/\$name/g,l);o[l]=d,c[d]=l};Array.isArray(r)?r.forEach(([l,h])=>{typeof l=="string"?a(l,h):l.forEach(d=>a(d,h))}):typeof r=="object"&&(o=r,c=Object.fromEntries(Object.keys(r).map(l=>[r[l],l]))),Xt=or(sr({},s),{getPath:l=>o[l]||n.replace(/\$name/g,l)})},et=()=>{if(!Xt)throw new Error("$Config is not called");return Xt};let kt=!0;const ar=t=>{const e=et(),[n,r]=t.split("?"),i=n.startsWith("/")?n:e.getPath(n);return{path:i,query:zn.parse(r),url:`${i}${r?`?${r}`:""}`}};function Kt(t){return e=>{if(kt){kt=!1;const{path:n,url:r,query:i}=ar(e);return Promise.race([Jt.emitAsync(`${Yn}:${n}`,i),new Promise(s=>{var o;setTimeout(()=>s(),(o=et().maxDelay)!=null?o:200)})]).then(()=>(kt=!0,wx[t]({url:r})))}}}G.on(Kn,()=>{var t;setTimeout(()=>{kt=!0},(t=et().minInterval)!=null?t:100)}),G.on(tr,()=>{kt=!0});const Fe=Kt("navigateTo"),Be=Kt("redirectTo"),Ue=Kt("switchTab"),te=Kt("reLaunch");function ee(t){return function(e){if(e){const{before:n,after:r,url:i}=e.currentTarget.dataset;if(this&&n&&typeof this[n]=="function"&&this[n](e),i)return t(i).then(()=>{this&&r&&typeof this[r]=="function"&&this[r](e)})}}}const Xs=ee(Fe),Ks=ee(Be),to=ee(Ue),eo=ee(te),cr=(t=1)=>{const{home:e}=et();return getCurrentPages().length<=t&&e?te(e):wx.navigateBack({delta:t})},no=function(t){if(t){const{before:e,after:n,delta:r=1}=t.currentTarget.dataset;return this&&e&&typeof this[e]=="function"&&this[e](t),Promise.resolve(cr(Number(r))).then(()=>{this&&n&&typeof this[n]=="function"&&this[n](t)})}},ro=()=>getCurrentPages().slice(0).pop(),io=t=>{const{path:e,query:n}=ar(t);Jt.emit(`${Xn}:${e}`,n)};function lr(t){const{args:e,event:n,id:r}=t.detail;switch(n){case"_$attached":{const i=er(r);if(!i)break;const s=i.$refID;s&&this.$refs&&(this.$refs[s]=i),i._$attached(this);break}default:{const i=this[n];i&&i.apply(this,e)}}}function hr(t){const e=et();t.$=lr,t.$refs={},t.$on=z.on,t.$off=z.off,t.$emit=z.emit,t.$emitAsync=z.emitAsync,t.$go=Fe,t.$redirect=Be,t.$switch=Ue,t.$reLaunch=te,t.$back=cr,t.$preload=io,t.$currentPage=ro,t.$getPath=e.getPath,t.$bindGo=Xs,t.$bindRedirect=Ks,t.$bindSwitch=to,t.$bindRelaunch=eo,t.$bindBack=no}var so=Object.defineProperty,oo=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,ur=Object.getOwnPropertySymbols,co=Object.prototype.hasOwnProperty,lo=Object.prototype.propertyIsEnumerable,dr=(t,e,n)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Re=(t,e)=>{for(var n in e||(e={}))co.call(e,n)&&dr(t,n,e[n]);if(ur)for(var n of ur(e))lo.call(e,n)&&dr(t,n,e[n]);return t},Ve=(t,e)=>oo(t,ao(e));let ho=0;const uo=(t={})=>{const e={};return Object.keys(t).forEach(n=>{const r=t[n];if(r===null||typeof r=="function")e[n]=r;else{const{type:i}=r;i===null?e[n]={type:null,value:r.default}:Array.isArray(i)?e[n]={type:i[0],value:r.default,optionalTypes:i.slice(1)}:e[n]={type:i,value:r.default}}}),Ve(Re({},e),{ref:{type:String,value:""}})},fo=t=>{const{extendComponent:e,injectComponent:n}=et();return e&&e(t),t.lifetimes||(t.lifetimes={}),t.lifetimes.created=F(t.lifetimes.created,function(){hr(this),n&&n(t)}),t.lifetimes.attached=F(t.lifetimes.attached,function(){const r=ho+=1;this.$id=r,Gs(r,this),this.$refID=this.properties.ref,this.triggerEvent("ing",{id:this.$id,event:"_$attached"})}),t.lifetimes.detached=F(t.lifetimes.detached,function(){var r;zs(this.$id);const i=(r=this.$parent)==null?void 0:r.$refs,s=this.$refID;s&&i&&delete i[s],delete this.$parent}),t.methods=Ve(Re({},t.methods),{$call(r,...i){Z.debug(`Component ${this.$id} call ${r}:`,i),this.triggerEvent("ing",{id:this.$id,event:r,args:i})},$getRef:er,_$attached(r){this.$root=r.$root||r,this.$parent=r},$:lr}),t.observers=Ve(Re({},t.observers),{ref(r){var i;this.$refID&&this.$refID!==r&&((i=this.$parent)!=null&&i.$refs&&delete this.$parent.$refs[this.$refID],this.$refID=r,Z.debug(`Component ${this.$id} ref: ${r}`))}}),t.properties=uo(t.props),delete t.props,Component(t)};let fr=!0;const po=(t,e)=>{const{getPath:n,extendPage:r,injectPage:i}=et(),s=n(t),o=(a,l)=>Z.debug(`Page ${t}: ${a} has been invoked`,l||""),c=a=>Z.debug(`Page ${t}: registered ${a}`);if(r&&r(t,e),e.$name=t,e.$state={firstOpen:!1},e.onAppLaunch){if(J.launch){const{lOpt:a}=J;o("onAppLaunch"),e.onAppLaunch(a)}else G.on(Jn,a=>{o("onAppLaunch"),e.onAppLaunch(a)});c("onAppLaunch")}e.onNavigate&&(Jt.on(`${Yn}:${s}`,a=>(o("onNavigate",a),e.onNavigate(a))),c("onNavigate")),e.onPreload&&(Jt.on(`${Xn}:${s}`,a=>(o("onPreload",a),e.onPreload(a))),c("onPreload")),e.onLoad=F(e.onLoad,()=>{e.onAwake&&(G.on(Le,a=>{o("onAwake"),e.onAwake(a)}),c("onAwake")),fr&&(fr=!1,e.$state.firstOpen=!0)}),e.onReady=F(e.onReady,()=>G.emit(Kn)),e.onUnload=F(e.onUnload,()=>G.emit(tr)),hr(e),i&&i(t,e),e.onRegister&&(o("onRegister"),e.onRegister()),Page(e),Z.debug(`Registered: Page ${t}`)};for(var pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",go=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),ne=0;ne<pr.length;ne++)go[pr.charCodeAt(ne)]=ne;const gr=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let He=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var mr;const B=gr==="js"?console:((mr=wx.getRealtimeLogManager)==null?void 0:mr.call(wx))||wx.getLogManager({level:1}),Ge=gr!=="js"&&"getRealtimeLogManager"in wx,mo=(...t)=>{wx.env.DEBUG&&(Ge?B.info("debug",...t):B.debug(...t))},bo=(...t)=>{B.info(...t),B!==console&&console.info(...t)},yo=(...t)=>{B.warn(...t),B!==console&&console.warn(...t)},wo=(...t)=>{Ge?B.error(...t):B.warn("error",...t),B!==console&&console.error(...t)},xo=t=>{Ge&&B.setFilterMsg(t)};var I=Object.freeze({__proto__:null,debug:mo,error:wo,filter:xo,info:bo,warn:yo});const D=wx.getFileSystemManager(),q=wx.env.USER_DATA_PATH,re=t=>t.split("/").slice(0,-1).join("/"),ze=t=>{try{return D.statSync(`${q}/${t}`,!1),!0}catch(e){return!1}},vo=t=>ze(t)&&D.statSync(`${q}/${t}`).isFile(),br=t=>ze(t)&&D.statSync(`${q}/${t}`).isDirectory(),Ao=(t,e=br(t)?"dir":"file")=>{const n=()=>I.debug(`Deleted ${t}`),r=i=>I.error(`Error deleting ${t}:`,i);if(e==="dir")try{D.rmdirSync(`${q}/${t}`,!0),n()}catch(i){r(i)}else try{D.unlinkSync(`${q}/${t}`),n()}catch(i){r(i)}},So=t=>{try{const e=D.readdirSync(`${q}/${t}`);return I.debug(`Listing ${t} folder:`,e),e}catch(e){return I.error(`Error listing ${t} folder:`,e),[]}},$o=(t,e="utf-8")=>{try{return D.readFileSync(`${q}/${t}`,e!=null?e:"utf-8")}catch(n){I.warn(`${t} don't exist`);return}},Co=(t,e="utf-8")=>{let n;try{const r=D.readFileSync(`${q}/${t}.json`,e);try{n=JSON.parse(r),I.debug(`Read ${t}.json success:`,n)}catch(i){n=void 0,I.warn(`Parse ${t}.json failed`)}}catch(r){n=void 0,I.warn(`${t}.json doesn't exist`)}return n},ie=(t,e=!0)=>{try{D.mkdirSync(`${q}/${t}`,e)}catch(n){I.debug(`${t} folder already exists`)}},Eo=(t,e)=>{try{D.saveFileSync(t,`${q}/${e}`)}catch(n){I.error(`Saving to ${e} failed:`,n)}},ko=(t,e)=>(ie(re(e)),new Promise((n,r)=>{wx.downloadFile({url:t,filePath:`${q}/${e}`,success:({statusCode:i,tempFilePath:s})=>{if(i===200)return I.debug(`${t} saved`),n(s);I.error(`Download ${t} failed with statusCode ${i}`),r(new He({code:i}))},fail:({errMsg:i})=>{I.error(`Download ${t} failed:`,i),r(new He({message:i}))}})})),To=(t,e,n=e instanceof ArrayBuffer?"binary":"utf-8")=>{ie(re(t)),D.writeFileSync(`${q}/${t}`,e instanceof ArrayBuffer?e:JSON.stringify(e),n)},Io=(t,e,n="utf-8")=>{const r=JSON.stringify(e);ie(re(t)),D.writeFileSync(`${q}/${t}.json`,r,n)},No=(t,e)=>new Promise((n,r)=>{D.unzip({zipFilePath:`${q}/${t}`,targetPath:`${q}/${e}`,success:()=>{n()},fail:({errCode:i,errMsg:s})=>{I.error(`Unzip ${t} failed:`,s),r(new He({code:i,message:s}))}})}),Tt=new Date().getTime();I.debug(`Current sessionId is ${Tt}`);const se={},qo=(t,e)=>{se[t]=e},Oo=t=>{const e=se[t];return se[t]=void 0,e},We=(t,e)=>e?e.expired?e.expired===Tt||new Date().getTime()<e.expired?e.data:(wx.removeStorageSync(`_cache_${t}`),void 0):e.data:void 0,yr=(t,e,n)=>{const r={expired:0,data:e};if(n==="keep"){const i=wx.getStorageSync(`_cache_${t}`);if(!i)return;r.expired=i.expired||0}else n&&(r.expired=n==="once"?Tt:n+new Date().getTime());return r},Po=(t,e,n=0)=>{wx.setStorageSync(`_cache_${t}`,yr(t,e,n))},Do=(t,e,n=0)=>wx.setStorage({key:`_cache_${t}`,data:yr(t,e,n)}).catch(()=>{I.error(`set "${t}" fail`)}),_o=t=>We(t,wx.getStorageSync(`_cache_${t}`)),jo=t=>wx.getStorage({key:`_cache_${t}`}).then(({data:e})=>We(t,e)).catch(()=>{I.error(`set "${t}" fail`)}),Lo=t=>{wx.removeStorageSync(`_cache_${t}`),We(t,null)},Mo=t=>wx.removeStorage({key:`_cache_${t}`}),Fo=()=>{wx.getStorageInfoSync().keys.forEach(t=>{if(t.startsWith("_cache_")){const e=wx.getStorageSync(t);(!e||e.expired!==Tt&&new Date().getTime()>=e.expired)&&wx.removeStorageSync(t)}})},Bo=()=>wx.getStorageInfo().then(({keys:t})=>Promise.all(t.filter(e=>e.startsWith("_cache_")).map(e=>wx.getStorage({key:e}).then(({data:n})=>{if(!n||n.expired!==Tt&&new Date().getTime()>=n.expired)return wx.removeStorage({key:e}).then(()=>{})})))),pt=(t="")=>t.replace(/^(\.*)?(?=\S)/gi,".").replace(/\.+$/,""),wr=t=>t.replace(/[#?].*$/,""),oe=t=>wr(t).replace(/^https?:\/\//,"").split("/").shift().replace(/:\d+$/,""),ae=(t="")=>{if(!t)return[];t=pt(t).replace(/^\.+/gi,"");const e=t.split(".").map(n=>[".",t.slice(t.indexOf(n))].join(""));return[t].concat(e)},xr=t=>{const e=oe(t),n=wr(t).split(e)[1].replace(/^:\d+/,"")||"/";return{domain:e,path:n}},Qe=t=>{const{domain:e="",path:n="/"}=typeof t=="object"?t:typeof t=="string"?xr(t):{};return{domain:pt(e),path:n}};let ce=class{constructor(e){this.expires="session";var n,r,i,s;this.name=(n=e.name)!=null?n:"",this.value=(r=e.value)!=null?r:"",this.domain=(i=e.domain)!=null?i:"",this.path=(s=e.path)!=null?s:"/",this.httpOnly=!!e.httpOnly,this.expires=Number.isInteger(e.maxAge)?e.maxAge>0?new Date(new Date().getTime()+e.maxAge*1e3):"outdate":e.expires?new Date(e.expires):"session"}isExpired(){return this.expires==="outdate"||this.expires instanceof Date&&new Date>this.expires}isPersistence(){return this.expires!=="session"}isDomainMatched(e){return ae(e).includes(this.domain)}isPathMatched(e){return e.startsWith(this.path)||this.path.replace(/\/$/,"")===e}toString(){return`${this.name}=${this.value}`}toJSON(){const e={name:this.name,value:this.value,domain:this.domain};return this.path!=="/"&&(e.path=this.path),this.httpOnly&&(e.httpOnly=this.httpOnly),this.expires instanceof Date&&(e.expires=this.expires),e}};for(var vr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Uo=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),le=0;le<vr.length;le++)Uo[vr.charCodeAt(le)]=le;const nt=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let Ro=class extends Error{constructor({code:e,message:n}){super(n),this.code=e!=null?e:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Ar;const U=nt==="js"?console:((Ar=wx.getRealtimeLogManager)==null?void 0:Ar.call(wx))||wx.getLogManager({level:1}),Ze=nt!=="js"&&"getRealtimeLogManager"in wx,Vo=(...t)=>{wx.env.DEBUG&&(Ze?U.info("debug",...t):U.debug(...t))},Ho=(...t)=>{U.info(...t),U!==console&&console.info(...t)},Go=(...t)=>{U.warn(...t),U!==console&&console.warn(...t)},zo=(...t)=>{Ze?U.error(...t):U.warn("error",...t),U!==console&&console.error(...t)},Wo=t=>{Ze&&U.setFilterMsg(t)};var Je=Object.freeze({__proto__:null,debug:Vo,error:zo,filter:Wo,info:Ho,warn:Go}),he={exports:{}},gt={decodeValues:!0,map:!1,silent:!1};function Ye(t){return typeof t=="string"&&!!t.trim()}function Xe(t,e){var n=t.split(";").filter(Ye),r=n.shift(),i=Qo(r),s=i.name,o=i.value;e=e?Object.assign({},gt,e):gt;try{o=e.decodeValues?decodeURIComponent(o):o}catch(a){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+o+"'. Set options.decodeValues to false to disable this feature.",a)}var c={name:s,value:o};return n.forEach(function(a){var l=a.split("="),h=l.shift().trimLeft().toLowerCase(),d=l.join("=");h==="expires"?c.expires=new Date(d):h==="max-age"?c.maxAge=parseInt(d,10):h==="secure"?c.secure=!0:h==="httponly"?c.httpOnly=!0:h==="samesite"?c.sameSite=d:h==="partitioned"?c.partitioned=!0:c[h]=d}),c}function Qo(t){var e="",n="",r=t.split("=");return r.length>1?(e=r.shift(),n=r.join("=")):n=t,{name:e,value:n}}function Sr(t,e){if(e=e?Object.assign({},gt,e):gt,!t)return e.map?{}:[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var n=t.headers[Object.keys(t.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!n&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=n}if(Array.isArray(t)||(t=[t]),e=e?Object.assign({},gt,e):gt,e.map){var r={};return t.filter(Ye).reduce(function(i,s){var o=Xe(s,e);return i[o.name]=o,i},r)}else return t.filter(Ye).map(function(i){return Xe(i,e)})}function Zo(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],n=0,r,i,s,o,c;function a(){for(;n<t.length&&/\s/.test(t.charAt(n));)n+=1;return n<t.length}function l(){return i=t.charAt(n),i!=="="&&i!==";"&&i!==","}for(;n<t.length;){for(r=n,c=!1;a();)if(i=t.charAt(n),i===","){for(s=n,n+=1,a(),o=n;n<t.length&&l();)n+=1;n<t.length&&t.charAt(n)==="="?(c=!0,n=o,e.push(t.substring(r,s)),r=n):n=s+1}else n+=1;(!c||n>=t.length)&&e.push(t.substring(r,t.length))}return e}he.exports=Sr;var Jo=he.exports.parse=Sr;he.exports.parseString=Xe;var $r=he.exports.splitCookiesString=Zo,Yo=Object.defineProperty,Xo=Object.defineProperties,Ko=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertySymbols,ta=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,Er=(t,e,n)=>e in t?Yo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,na=(t,e)=>{for(var n in e||(e={}))ta.call(e,n)&&Er(t,n,e[n]);if(Cr)for(var n of Cr(e))ea.call(e,n)&&Er(t,n,e[n]);return t},ra=(t,e)=>Xo(t,Ko(e));const ia=/[^a-z0-9\-#$%&'*+.^_`|~]/i,kr=`
|
|
2
2
|
\r `,sa=new RegExp(`(^[${kr}]|$[${kr}])`,"g"),It=t=>{if(typeof t!="string"||t.length===0||t.length>128)return!1;for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n>127||n===32)return!1}return!0},Nt=t=>{if(ia.test(t)||t.trim()==="")throw new TypeError("Invalid character in header field name");return t.trim().toLowerCase()},Tr=t=>{if(typeof t!="string"||t.trim()!==t)return!1;for(let e=0;e<t.length;e++){const n=t.charCodeAt(e);if(n===0||n===10||n===13)return!1}return!0},Ke=t=>t.replace(sa,""),tn=(t,e)=>Jo($r(t)).map(n=>new ce(ra(na({},n),{domain:pt(n.domain)||e})));let en=class is{constructor(e){this.headers={},this.headerNames=new Map,e instanceof is?e.forEach((n,r)=>{this.append(r,n)},this):Array.isArray(e)?e.forEach(([n,r])=>{this.append(n,Array.isArray(r)?r.join(", "):r)}):e&&Object.getOwnPropertyNames(e).forEach(n=>{const r=e[n];this.append(n,Array.isArray(r)?r.join(", "):r)})}append(e,n){if(!It(e)||!Tr(n))return;const r=Nt(e),i=Ke(n),s=this.has(r)?`${this.get(r)}, ${i}`:i;this.set(e,s)}delete(e){if(!It(e)||!this.has(e))return;const n=Nt(e);delete this.headers[n],this.headerNames.delete(n)}get(e){var n;if(!It(e))throw TypeError(`Invalid header name "${e}"`);return(n=this.headers[Nt(e)])!=null?n:null}getSetCookie(){const e=this.get("set-cookie");return e===null?[]:e===""?[""]:$r(e)}has(e){if(!It(e))throw new TypeError(`Invalid header name "${e}"`);return this.headers.hasOwnProperty(Nt(e))}set(e,n){if(!It(e)||!Tr(n))return;const r=Nt(e),i=Ke(n);this.headers[r]=Ke(i),this.headerNames.set(r,e)}forEach(e,n){for(const[r,i]of this.entries())e.call(n,i,r,this)}*keys(){for(const[e]of this.entries())yield e}*values(){for(const[,e]of this.entries())yield e}*entries(){const e=Object.keys(this.headers).sort((n,r)=>n.localeCompare(r));for(const n of e)if(n==="set-cookie")for(const r of this.getSetCookie())yield[n,r];else yield[n,this.get(n)]}toObject(){return this.headers}[Symbol.iterator](){return this.entries()}};var Ir=t=>{throw TypeError(t)},oa=(t,e,n)=>e.has(t)||Ir("Cannot "+n),aa=(t,e,n)=>e.has(t)?Ir("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),qt=(t,e,n)=>(oa(t,e,"access private method"),n),rt,Nr,Ot;let ue=class{constructor(e="__cookie_store__"){this.key=e,aa(this,rt),this.store=new Map,qt(this,rt,Nr).call(this)}get(e,n){const{domain:r,path:i}=Qe(n),s=ae(r);for(const[o,c]of this.store.entries()){if(r&&!s.includes(o))continue;const a=c.get(e);if(a&&a.isPathMatched(i)&&!a.isExpired())return a}return null}getValue(e,n){var r;return(r=this.get(e,n))==null?void 0:r.value}has(e,n){return!!this.get(e,n)}set(e){var n;const{name:r,domain:i}=e,s=new ce(e),o=(n=this.store.get(i))!=null?n:new Map;return o.set(r,s),this.store.set(i,o),qt(this,rt,Ot).call(this),s}delete(e,n=""){if(n){const r=this.store.get(n);r&&r.delete(e);const i=this.store.get(pt(n));i&&i.delete(e)}else for(const r of this.store.values())r.delete(e);qt(this,rt,Ot).call(this)}list(){const e={};for(const n of this.store.keys())e[n]=this.getCookiesMap(n);return e}getCookies(e){const{domain:n,path:r}=Qe(e),i=ae(n),s=[];for(const[o,c]of this.store.entries())if(!(n&&!i.includes(o)))for(const a of c.values())a.isPathMatched(r)&&!a.isExpired()&&s.push(a);return s}getAllCookies(){const e=[];for(const n of this.store.values())for(const r of n.values())r.isExpired()||e.push(r);return e}getCookiesMap(e){return Object.fromEntries(this.getCookies(e).map(({name:n,value:r})=>[n,r]))}apply(e){e.forEach(n=>{let r=this.store.get(n.domain);r||(r=new Map,this.store.set(n.domain,r)),r.set(n.name,n)}),qt(this,rt,Ot).call(this)}clear(e="",n=!1){if(e){const r=this.store.get(e);if(r&&r.clear(),!n){const i=this.store.get(pt(e));i&&i.clear()}}else this.store.clear();qt(this,rt,Ot).call(this)}applyHeader(e,n){if(nt==="js")return this.apply(tn(e.getSetCookie().join(","),oe(n)));const r=e["Set-Cookie"]||e["set-cookie"]||"",i=Array.isArray(r)?r.filter(Boolean).join(","):nt==="qq"?r.replace(/;((?!Path|Expires|Max-Age|Domain|Path|SameSite)[^\s;]*?)=/gi,",$1="):r;return this.apply(tn(i,oe(n)))}applyResponse(e,n){return this.applyHeader(nt==="js"?e.headers:e.header,n)}getHeader(e){return this.getCookies(e).map(n=>n.toString()).join("; ")}};rt=new WeakSet,Nr=function(){var t;try{const e=nt==="js"?[]:(t=wx.getStorageSync(this.key))!=null?t:[];this.apply(e.map(n=>new ce(n)))}catch(e){console.warn("Error applying cookie storage",e);return}},Ot=function(){try{const t=[];for(const e of this.store.values())for(const n of e.values())n.isExpired()?e.delete(n.name):n.isPersistence()&&t.push(n);nt!=="js"&&wx.setStorageSync(this.key,t)}catch(t){console.warn("Error setting cookies",t)}};const ca={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},qr=t=>encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,e=>ca[e]),Or=t=>decodeURIComponent(t.replace(/\+/g," "));class Vt{constructor(e){if(!e)this.params=new Map;else if(e instanceof Vt)this.params=new Map(e.params);else if(this.params=new Map,typeof e=="string")(e.startsWith("?")?e.slice(1):e).split("&").forEach(n=>{var r;const[,i,s]=(r=/^([^=]+)=?(.*?)$/.exec(n))!=null?r:[];i&&this.append(Or(i),Or(s))});else if(Symbol.iterator in e)for(const n of e){if(n.length!==2)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");const[r,i]=n;this.append(r,i)}else for(const n of Object.keys(e)){const r=e[n];this.params.set(n,[String(r)])}}get size(){return Array.from(this.params.values()).flat().length}append(e,n){this.params.set(e,this.getAll(e).concat(String(n)))}delete(e){this.params.delete(e)}entries(){const e=new Set;return this.forEach((n,r)=>{e.add([r,n])}),e.values()}forEach(e,n){this.params.forEach((r,i)=>r.forEach(s=>e.bind(n)(s,i,this)))}get(e){var n,r;return(r=(n=this.getAll(e))==null?void 0:n[0])!=null?r:null}getAll(e){return this.has(e)?this.params.get(e).slice(0):[]}has(e){return this.params.has(e)}keys(){return this.params.keys()}set(e,n){this.params.set(e,[n!=null?n:""])}sort(){this.params=new Map(Array.from(this.params.entries()).sort(([e],[n])=>e.localeCompare(n)))}toString(){const e=[];for(const[n,r]of this.params){const i=qr(n);for(const s of r)e.push(`${i}=${qr(s)}`)}return e.join("&")}values(){const e=new Set;return this.forEach(n=>{e.add(n)}),e.values()}[Symbol.iterator](){return this.entries()}}var la=Object.defineProperty,de=Object.getOwnPropertySymbols,Pr=Object.prototype.hasOwnProperty,Dr=Object.prototype.propertyIsEnumerable,_r=(t,e,n)=>e in t?la(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nn=(t,e)=>{for(var n in e||(e={}))Pr.call(e,n)&&_r(t,n,e[n]);if(de)for(var n of de(e))Dr.call(e,n)&&_r(t,n,e[n]);return t},jr=(t,e)=>{var n={};for(var r in t)Pr.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&de)for(var r of de(t))e.indexOf(r)<0&&Dr.call(t,r)&&(n[r]=t[r]);return n};const rn=new ue("__request_cookie__"),Lr=(t,e={})=>{var n=e,{method:r="GET",headers:i,body:s,cookieScope:o=t,cookieStore:c=rn}=n,a=jr(n,["method","headers","body","cookieScope","cookieStore"]);return new Promise((l,h)=>{const d=c.getHeader(o),f=new en(i);d&&f.append("Cookie",d);const g=s instanceof Vt?s.toString():s!=null?s:void 0;f.has("Content-Type")||(s instanceof Vt?f.set("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"):s instanceof ArrayBuffer?f.set("Content-Type","application/octet-stream; charset=UTF-8"):Object.prototype.toString.call(s)==="[object Object]"&&f.set("Content-Type","application/json; charset=UTF-8")),Je.debug(`Requesting ${t}:
|
|
3
3
|
Cookie: ${d}
|
|
4
4
|
Options:
|