@mptool/all 0.10.3 → 0.10.5
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 +2 -2
- package/lib/index.d.ts +2 -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 +5 -5
package/lib/index.d.mts
CHANGED
|
@@ -47,7 +47,7 @@ declare const reportNetworkStatus: () => void;
|
|
|
47
47
|
* @param confirmFunc 确定回调函数
|
|
48
48
|
* @param cancelFunc 取消回调函数
|
|
49
49
|
*/
|
|
50
|
-
declare const confirm: (text: string, warning
|
|
50
|
+
declare const confirm: (text: string, warning: string | undefined, confirmAction: () => Promise<void> | void, cancelAction?: () => void | Promise<void>) => void;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* 显示提示窗口
|
|
@@ -59,7 +59,7 @@ declare const confirm: (text: string, warning?: string) => Promise<void>;
|
|
|
59
59
|
*/
|
|
60
60
|
declare const showModal: (title: string, content: string, confirmAction?: () => void | Promise<void>, cancelAction?: () => void | Promise<void>) => void;
|
|
61
61
|
|
|
62
|
-
declare const retry: (title: string, content: string, navigateBack?: boolean) =>
|
|
62
|
+
declare const retry: (title: string, content: string, retryAction: () => void | Promise<void>, navigateBack?: boolean) => void;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* 显示提示文字
|
package/lib/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ declare const reportNetworkStatus: () => void;
|
|
|
47
47
|
* @param confirmFunc 确定回调函数
|
|
48
48
|
* @param cancelFunc 取消回调函数
|
|
49
49
|
*/
|
|
50
|
-
declare const confirm: (text: string, warning
|
|
50
|
+
declare const confirm: (text: string, warning: string | undefined, confirmAction: () => Promise<void> | void, cancelAction?: () => void | Promise<void>) => void;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* 显示提示窗口
|
|
@@ -59,7 +59,7 @@ declare const confirm: (text: string, warning?: string) => Promise<void>;
|
|
|
59
59
|
*/
|
|
60
60
|
declare const showModal: (title: string, content: string, confirmAction?: () => void | Promise<void>, cancelAction?: () => void | Promise<void>) => void;
|
|
61
61
|
|
|
62
|
-
declare const retry: (title: string, content: string, navigateBack?: boolean) =>
|
|
62
|
+
declare const retry: (title: string, content: string, retryAction: () => void | Promise<void>, navigateBack?: boolean) => void;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* 显示提示文字
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";for(var _n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ss=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Gt=0;Gt<_n.length;Gt++)ss[_n.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 jn;const L=zt==="js"?console:((jn=wx.getRealtimeLogManager)==null?void 0:jn.call(wx))||wx.getLogManager({level:1}),qe=zt!=="js"&&"getRealtimeLogManager"in wx,os=(...t)=>{wx.env.DEBUG&&(qe?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)=>{qe?L.error(...t):L.warn("error",...t),L!==console&&console.error(...t)},hs=t=>{qe&&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="")=>new Promise((n,r)=>{Ct("操作确认",`您确定要${t}么?${e}`,n,r)}),fs=(t,e,n=!1)=>new Promise(r=>{wx.showModal({title:t,content:e,confirmText:"重试",theme:"day",success:({confirm:i})=>{i?r():n&&getCurrentPages().length>1&&wx.navigateBack()},fail:()=>{n&&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,Ln=Object.getOwnPropertySymbols,ys=Object.prototype.hasOwnProperty,ws=Object.prototype.propertyIsEnumerable,Mn=(t,e,n)=>e in t?gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e)=>{for(var n in e||(e={}))ys.call(e,n)&&Mn(t,n,e[n]);if(Ln)for(var n of Ln(e))ws.call(e,n)&&Mn(t,n,e[n]);return t},Pe=(t,e)=>ms(t,bs(e));const xs=t=>new Promise((e,n)=>{if(zt==="donut")return wx.addPhoneContact(Pe(Oe({},t),{success:()=>e()}));wx.getSetting({success:({authSetting:r})=>{r["scope.addPhoneContact"]?wx.addPhoneContact(Pe(Oe({},t),{success:()=>e()})):wx.authorize({scope:"scope.addPhoneContact",success:()=>{wx.addPhoneContact(Pe(Oe({},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},Bn=()=>{const t=getCurrentPages();return t[t.length-1]||null},As=()=>{var t,e;return(e=(t=Bn())==null?void 0:t.route)!=null?e:""},Fn=()=>{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})),Fn(),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 De=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 Un;const M=De==="js"?console:((Un=wx.getRealtimeLogManager)==null?void 0:Un.call(wx))||wx.getLogManager({level:1}),_e=De!=="js"&&"getRealtimeLogManager"in wx,qs=(...t)=>{wx.env.DEBUG&&(_e?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)=>{_e?M.error(...t):M.warn("error",...t),M!==console&&console.error(...t)},_s=t=>{_e&&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},Rn=(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=Rn(e,"&",n);return r?`${t}${/[?&]$/u.test(t)?"":t.includes("?")?"&":"?"}${r}`:t};var Vn=Object.freeze({__proto__:null,join:Ls,parse:js,stringify:Rn});const Hn=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},Gn=t=>Hn(t)==="function";function B(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])}},Bs=(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 Fs=(t,e=1)=>{const n=new zn(e);return function(...r){n.add(t,this,...r)}},je="a",Wn="al",Qn="n",Zn="p",Jn="r",Yn="u",G=Zt(),Jt=Zt(),z=Zt(),J={launch:!1,lOpt:{},hide:0},Us=t=>{J.launch=!0,J.lOpt=t,G.emit(Wn,t)},Rs=()=>{J.hide&&(G.emit(je,new Date().getTime()-J.hide),J.hide=0)},Vs=()=>{J.hide=new Date().getTime()},Hs=t=>{t.onLaunch=B(t.onLaunch,Us),t.onShow=B(t.onShow,Rs),t.onHide=B(t.onHide,Vs),t.onAwake&&(G.on(je,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)};var Gs=Object.defineProperty,zs=Object.defineProperties,Ws=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,Xn=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable,tr=(t,e,n)=>e in t?Gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,er=(t,e)=>{for(var n in e||(e={}))Xn.call(e,n)&&tr(t,n,e[n]);if(Yt)for(var n of Yt(e))Kn.call(e,n)&&tr(t,n,e[n]);return t},nr=(t,e)=>zs(t,Ws(e)),Qs=(t,e)=>{var n={};for(var r in t)Xn.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&&Kn.call(t,r)&&(n[r]=t[r]);return n};let Xt;const Zs=t=>{const e=t,{defaultPage:n,pages:r=[],getPath:i}=e,s=Qs(e,["defaultPage","pages","getPath"]);if(Gn(i)){Xt=nr(er({},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=nr(er({},s),{getPath:l=>o[l]||n.replace(/\$name/g,l)})},et=()=>{if(!Xt)throw new Error("$Config is not called");return Xt},Le={},rr=t=>Le[t],Js=(t,e)=>{Le[t]=e},Ys=t=>{delete Le[t]};let kt=!0;const ir=t=>{const e=et(),[n,r]=t.split("?"),i=n.startsWith("/")?n:e.getPath(n);return{path:i,query:Vn.parse(r),url:`${i}${r?`?${r}`:""}`}};function Kt(t){return e=>{if(kt){kt=!1;const{path:n,url:r,query:i}=ir(e);return Promise.race([Jt.emitAsync(`${Qn}:${n}`,i),new Promise(s=>{var o;setTimeout(()=>s(),(o=et().maxDelay)!=null?o:200)})]).then(()=>(kt=!0,wx[t]({url:r})))}}}G.on(Jn,()=>{var t;setTimeout(()=>{kt=!0},(t=et().minInterval)!=null?t:100)}),G.on(Yn,()=>{kt=!0});const sr=Kt("navigateTo"),or=Kt("redirectTo"),ar=Kt("switchTab"),Me=Kt("reLaunch");function te(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=te(sr),Ks=te(or),to=te(ar),eo=te(Me),cr=(t=1)=>{const{home:e}=et();return getCurrentPages().length<=t&&e?Me(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}=ir(t);Jt.emit(`${Zn}:${e}`,n)};function lr(t){const{args:e,event:n,id:r}=t.detail;switch(n){case"_$attached":{const i=rr(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=sr,t.$redirect=or,t.$switch=ar,t.$reLaunch=Me,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,Be=(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},Fe=(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}}}),Fe(Be({},e),{ref:{type:String,value:""}})},fo=t=>{const{extendComponent:e,injectComponent:n}=et();return e&&e(t),t.lifetimes||(t.lifetimes={}),t.lifetimes.created=B(t.lifetimes.created,function(){hr(this),n&&n(t)}),t.lifetimes.attached=B(t.lifetimes.attached,function(){const r=ho+=1;this.$id=r,Js(r,this),this.$refID=this.properties.ref,this.triggerEvent("ing",{id:this.$id,event:"_$attached"})}),t.lifetimes.detached=B(t.lifetimes.detached,function(){var r;Ys(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=Fe(Be({},t.methods),{$call(r,...i){Z.debug(`Component ${this.$id} call ${r}:`,i),this.triggerEvent("ing",{id:this.$id,event:r,args:i})},$getRef:rr,_$attached(r){this.$root=r.$root||r,this.$parent=r},$:lr}),t.observers=Fe(Be({},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(Wn,a=>{o("onAppLaunch"),e.onAppLaunch(a)});c("onAppLaunch")}e.onNavigate&&(Jt.on(`${Qn}:${s}`,a=>(o("onNavigate",a),e.onNavigate(a))),c("onNavigate")),e.onPreload&&(Jt.on(`${Zn}:${s}`,a=>(o("onPreload",a),e.onPreload(a))),c("onPreload")),e.onLoad=B(e.onLoad,()=>{e.onAwake&&(G.on(je,a=>{o("onAwake"),e.onAwake(a)}),c("onAwake")),fr&&(fr=!1,e.$state.firstOpen=!0)}),e.onReady=B(e.onReady,()=>G.emit(Jn)),e.onUnload=B(e.onUnload,()=>G.emit(Yn)),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),ee=0;ee<pr.length;ee++)go[pr.charCodeAt(ee)]=ee;const gr=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let Ue=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 F=gr==="js"?console:((mr=wx.getRealtimeLogManager)==null?void 0:mr.call(wx))||wx.getLogManager({level:1}),Re=gr!=="js"&&"getRealtimeLogManager"in wx,mo=(...t)=>{wx.env.DEBUG&&(Re?F.info("debug",...t):F.debug(...t))},bo=(...t)=>{F.info(...t),F!==console&&console.info(...t)},yo=(...t)=>{F.warn(...t),F!==console&&console.warn(...t)},wo=(...t)=>{Re?F.error(...t):F.warn("error",...t),F!==console&&console.error(...t)},xo=t=>{Re&&F.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,ne=t=>t.split("/").slice(0,-1).join("/"),Ve=t=>{try{return D.statSync(`${q}/${t}`,!1),!0}catch(e){return!1}},vo=t=>Ve(t)&&D.statSync(`${q}/${t}`).isFile(),br=t=>Ve(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},re=(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)=>(re(ne(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 Ue({code:i}))},fail:({errMsg:i})=>{I.error(`Download ${t} failed:`,i),r(new Ue({message:i}))}})})),To=(t,e,n=e instanceof ArrayBuffer?"binary":"utf-8")=>{re(ne(t)),D.writeFileSync(`${q}/${t}`,e instanceof ArrayBuffer?e:JSON.stringify(e),n)},Io=(t,e,n="utf-8")=>{const r=JSON.stringify(e);re(ne(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 Ue({code:i,message:s}))}})}),Tt=new Date().getTime();I.debug(`Current sessionId is ${Tt}`);const ie={},qo=(t,e)=>{ie[t]=e},Oo=t=>{const e=ie[t];return ie[t]=void 0,e},He=(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=>He(t,wx.getStorageSync(`_cache_${t}`)),jo=t=>wx.getStorage({key:`_cache_${t}`}).then(({data:e})=>He(t,e)).catch(()=>{I.error(`set "${t}" fail`)}),Lo=t=>{wx.removeStorageSync(`_cache_${t}`),He(t,null)},Mo=t=>wx.removeStorage({key:`_cache_${t}`}),Bo=()=>{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)}})},Fo=()=>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(/[#?].*$/,""),se=t=>wr(t).replace(/^https?:\/\//,"").split("/").shift().replace(/:\d+$/,""),oe=(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=se(t),n=wr(t).split(e)[1].replace(/^:\d+/,"")||"/";return{domain:e,path:n}},Ge=t=>{const{domain:e="",path:n="/"}=typeof t=="object"?t:typeof t=="string"?xr(t):{};return{domain:pt(e),path:n}};let ae=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 oe(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),ce=0;ce<vr.length;ce++)Uo[vr.charCodeAt(ce)]=ce;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 We=Object.freeze({__proto__:null,debug:Vo,error:zo,filter:Wo,info:Ho,warn:Go}),le={exports:{}},gt={decodeValues:!0,map:!1,silent:!1};function Qe(t){return typeof t=="string"&&!!t.trim()}function Ze(t,e){var n=t.split(";").filter(Qe),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(Qe).reduce(function(i,s){var o=Ze(s,e);return i[o.name]=o,i},r)}else return t.filter(Qe).map(function(i){return Ze(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}le.exports=Sr;var Jo=le.exports.parse=Sr;le.exports.parseString=Ze;var $r=le.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 _n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ss=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Gt=0;Gt<_n.length;Gt++)ss[_n.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 jn;const L=zt==="js"?console:((jn=wx.getRealtimeLogManager)==null?void 0:jn.call(wx))||wx.getLogManager({level:1}),qe=zt!=="js"&&"getRealtimeLogManager"in wx,os=(...t)=>{wx.env.DEBUG&&(qe?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)=>{qe?L.error(...t):L.warn("error",...t),L!==console&&console.error(...t)},hs=t=>{qe&&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,Ln=Object.getOwnPropertySymbols,ys=Object.prototype.hasOwnProperty,ws=Object.prototype.propertyIsEnumerable,Mn=(t,e,n)=>e in t?gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e)=>{for(var n in e||(e={}))ys.call(e,n)&&Mn(t,n,e[n]);if(Ln)for(var n of Ln(e))ws.call(e,n)&&Mn(t,n,e[n]);return t},Pe=(t,e)=>ms(t,bs(e));const xs=t=>new Promise((e,n)=>{if(zt==="donut")return wx.addPhoneContact(Pe(Oe({},t),{success:()=>e()}));wx.getSetting({success:({authSetting:r})=>{r["scope.addPhoneContact"]?wx.addPhoneContact(Pe(Oe({},t),{success:()=>e()})):wx.authorize({scope:"scope.addPhoneContact",success:()=>{wx.addPhoneContact(Pe(Oe({},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},Bn=()=>{const t=getCurrentPages();return t[t.length-1]||null},As=()=>{var t,e;return(e=(t=Bn())==null?void 0:t.route)!=null?e:""},Fn=()=>{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})),Fn(),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 De=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 Un;const M=De==="js"?console:((Un=wx.getRealtimeLogManager)==null?void 0:Un.call(wx))||wx.getLogManager({level:1}),_e=De!=="js"&&"getRealtimeLogManager"in wx,qs=(...t)=>{wx.env.DEBUG&&(_e?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)=>{_e?M.error(...t):M.warn("error",...t),M!==console&&console.error(...t)},_s=t=>{_e&&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},Rn=(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=Rn(e,"&",n);return r?`${t}${/[?&]$/u.test(t)?"":t.includes("?")?"&":"?"}${r}`:t};var Vn=Object.freeze({__proto__:null,join:Ls,parse:js,stringify:Rn});const Hn=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},Gn=t=>Hn(t)==="function";function B(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])}},Bs=(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 Fs=(t,e=1)=>{const n=new zn(e);return function(...r){n.add(t,this,...r)}},je="a",Wn="al",Qn="n",Zn="p",Jn="r",Yn="u",G=Zt(),Jt=Zt(),z=Zt(),J={launch:!1,lOpt:{},hide:0},Us=t=>{J.launch=!0,J.lOpt=t,G.emit(Wn,t)},Rs=()=>{J.hide&&(G.emit(je,new Date().getTime()-J.hide),J.hide=0)},Vs=()=>{J.hide=new Date().getTime()},Hs=t=>{t.onLaunch=B(t.onLaunch,Us),t.onShow=B(t.onShow,Rs),t.onHide=B(t.onHide,Vs),t.onAwake&&(G.on(je,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)};var Gs=Object.defineProperty,zs=Object.defineProperties,Ws=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,Xn=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable,tr=(t,e,n)=>e in t?Gs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,er=(t,e)=>{for(var n in e||(e={}))Xn.call(e,n)&&tr(t,n,e[n]);if(Yt)for(var n of Yt(e))Kn.call(e,n)&&tr(t,n,e[n]);return t},nr=(t,e)=>zs(t,Ws(e)),Qs=(t,e)=>{var n={};for(var r in t)Xn.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&&Kn.call(t,r)&&(n[r]=t[r]);return n};let Xt;const Zs=t=>{const e=t,{defaultPage:n,pages:r=[],getPath:i}=e,s=Qs(e,["defaultPage","pages","getPath"]);if(Gn(i)){Xt=nr(er({},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=nr(er({},s),{getPath:l=>o[l]||n.replace(/\$name/g,l)})},et=()=>{if(!Xt)throw new Error("$Config is not called");return Xt},Le={},rr=t=>Le[t],Js=(t,e)=>{Le[t]=e},Ys=t=>{delete Le[t]};let kt=!0;const ir=t=>{const e=et(),[n,r]=t.split("?"),i=n.startsWith("/")?n:e.getPath(n);return{path:i,query:Vn.parse(r),url:`${i}${r?`?${r}`:""}`}};function Kt(t){return e=>{if(kt){kt=!1;const{path:n,url:r,query:i}=ir(e);return Promise.race([Jt.emitAsync(`${Qn}:${n}`,i),new Promise(s=>{var o;setTimeout(()=>s(),(o=et().maxDelay)!=null?o:200)})]).then(()=>(kt=!0,wx[t]({url:r})))}}}G.on(Jn,()=>{var t;setTimeout(()=>{kt=!0},(t=et().minInterval)!=null?t:100)}),G.on(Yn,()=>{kt=!0});const sr=Kt("navigateTo"),or=Kt("redirectTo"),ar=Kt("switchTab"),Me=Kt("reLaunch");function te(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=te(sr),Ks=te(or),to=te(ar),eo=te(Me),cr=(t=1)=>{const{home:e}=et();return getCurrentPages().length<=t&&e?Me(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}=ir(t);Jt.emit(`${Zn}:${e}`,n)};function lr(t){const{args:e,event:n,id:r}=t.detail;switch(n){case"_$attached":{const i=rr(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=sr,t.$redirect=or,t.$switch=ar,t.$reLaunch=Me,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,Be=(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},Fe=(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}}}),Fe(Be({},e),{ref:{type:String,value:""}})},fo=t=>{const{extendComponent:e,injectComponent:n}=et();return e&&e(t),t.lifetimes||(t.lifetimes={}),t.lifetimes.created=B(t.lifetimes.created,function(){hr(this),n&&n(t)}),t.lifetimes.attached=B(t.lifetimes.attached,function(){const r=ho+=1;this.$id=r,Js(r,this),this.$refID=this.properties.ref,this.triggerEvent("ing",{id:this.$id,event:"_$attached"})}),t.lifetimes.detached=B(t.lifetimes.detached,function(){var r;Ys(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=Fe(Be({},t.methods),{$call(r,...i){Z.debug(`Component ${this.$id} call ${r}:`,i),this.triggerEvent("ing",{id:this.$id,event:r,args:i})},$getRef:rr,_$attached(r){this.$root=r.$root||r,this.$parent=r},$:lr}),t.observers=Fe(Be({},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(Wn,a=>{o("onAppLaunch"),e.onAppLaunch(a)});c("onAppLaunch")}e.onNavigate&&(Jt.on(`${Qn}:${s}`,a=>(o("onNavigate",a),e.onNavigate(a))),c("onNavigate")),e.onPreload&&(Jt.on(`${Zn}:${s}`,a=>(o("onPreload",a),e.onPreload(a))),c("onPreload")),e.onLoad=B(e.onLoad,()=>{e.onAwake&&(G.on(je,a=>{o("onAwake"),e.onAwake(a)}),c("onAwake")),fr&&(fr=!1,e.$state.firstOpen=!0)}),e.onReady=B(e.onReady,()=>G.emit(Jn)),e.onUnload=B(e.onUnload,()=>G.emit(Yn)),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),ee=0;ee<pr.length;ee++)go[pr.charCodeAt(ee)]=ee;const gr=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";let Ue=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 F=gr==="js"?console:((mr=wx.getRealtimeLogManager)==null?void 0:mr.call(wx))||wx.getLogManager({level:1}),Re=gr!=="js"&&"getRealtimeLogManager"in wx,mo=(...t)=>{wx.env.DEBUG&&(Re?F.info("debug",...t):F.debug(...t))},bo=(...t)=>{F.info(...t),F!==console&&console.info(...t)},yo=(...t)=>{F.warn(...t),F!==console&&console.warn(...t)},wo=(...t)=>{Re?F.error(...t):F.warn("error",...t),F!==console&&console.error(...t)},xo=t=>{Re&&F.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,ne=t=>t.split("/").slice(0,-1).join("/"),Ve=t=>{try{return D.statSync(`${q}/${t}`,!1),!0}catch(e){return!1}},vo=t=>Ve(t)&&D.statSync(`${q}/${t}`).isFile(),br=t=>Ve(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},re=(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)=>(re(ne(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 Ue({code:i}))},fail:({errMsg:i})=>{I.error(`Download ${t} failed:`,i),r(new Ue({message:i}))}})})),To=(t,e,n=e instanceof ArrayBuffer?"binary":"utf-8")=>{re(ne(t)),D.writeFileSync(`${q}/${t}`,e instanceof ArrayBuffer?e:JSON.stringify(e),n)},Io=(t,e,n="utf-8")=>{const r=JSON.stringify(e);re(ne(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 Ue({code:i,message:s}))}})}),Tt=new Date().getTime();I.debug(`Current sessionId is ${Tt}`);const ie={},qo=(t,e)=>{ie[t]=e},Oo=t=>{const e=ie[t];return ie[t]=void 0,e},He=(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=>He(t,wx.getStorageSync(`_cache_${t}`)),jo=t=>wx.getStorage({key:`_cache_${t}`}).then(({data:e})=>He(t,e)).catch(()=>{I.error(`set "${t}" fail`)}),Lo=t=>{wx.removeStorageSync(`_cache_${t}`),He(t,null)},Mo=t=>wx.removeStorage({key:`_cache_${t}`}),Bo=()=>{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)}})},Fo=()=>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(/[#?].*$/,""),se=t=>wr(t).replace(/^https?:\/\//,"").split("/").shift().replace(/:\d+$/,""),oe=(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=se(t),n=wr(t).split(e)[1].replace(/^:\d+/,"")||"/";return{domain:e,path:n}},Ge=t=>{const{domain:e="",path:n="/"}=typeof t=="object"?t:typeof t=="string"?xr(t):{};return{domain:pt(e),path:n}};let ae=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 oe(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),ce=0;ce<vr.length;ce++)Uo[vr.charCodeAt(ce)]=ce;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 We=Object.freeze({__proto__:null,debug:Vo,error:zo,filter:Wo,info:Ho,warn:Go}),le={exports:{}},gt={decodeValues:!0,map:!1,silent:!1};function Qe(t){return typeof t=="string"&&!!t.trim()}function Ze(t,e){var n=t.split(";").filter(Qe),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(Qe).reduce(function(i,s){var o=Ze(s,e);return i[o.name]=o,i},r)}else return t.filter(Qe).map(function(i){return Ze(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}le.exports=Sr;var Jo=le.exports.parse=Sr;le.exports.parseString=Ze;var $r=le.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},Je=t=>t.replace(sa,""),Ye=(t,e)=>Jo($r(t)).map(n=>new ae(ra(na({},n),{domain:pt(n.domain)||e})));let Xe=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=Je(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=Je(n);this.headers[r]=Je(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 he=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}=Ge(n),s=oe(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 ae(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}=Ge(e),i=oe(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(Ye(e.getSetCookie().join(","),se(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(Ye(i,se(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 ae(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,ue=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,Ke=(t,e)=>{for(var n in e||(e={}))Pr.call(e,n)&&_r(t,n,e[n]);if(ue)for(var n of ue(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&&ue)for(var r of ue(t))e.indexOf(r)<0&&Dr.call(t,r)&&(n[r]=t[r]);return n};const tn=new he("__request_cookie__"),Lr=(t,e={})=>{var n=e,{method:r="GET",headers:i,body:s,cookieScope:o=t,cookieStore:c=tn}=n,a=jr(n,["method","headers","body","cookieScope","cookieStore"]);return new Promise((l,h)=>{const d=c.getHeader(o),f=new Xe(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")),We.debug(`Requesting ${t}:
|
|
3
3
|
Cookie: ${d}
|
|
4
4
|
Options:
|