@mptool/all 0.10.12 → 0.10.13

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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- for(var Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ii=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Qe=0;Qe<Mr.length;Qe++)ii[Mr.charCodeAt(Qe)]=Qe;const Ze=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var ai=Object.defineProperty,oi=(e,t,r)=>t in e?ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,li=(e,t,r)=>oi(e,t+"",r);let de=class extends Error{constructor({code:t,message:r}){super(r),li(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Br;const M=Ze==="js"?console:((Br=wx.getRealtimeLogManager)==null?void 0:Br.call(wx))||wx.getLogManager({level:1}),Pt=Ze!=="js"&&"getRealtimeLogManager"in wx,ci=(...e)=>{wx.env.DEBUG&&(Pt?M.info("debug",...e):M.debug(...e))},hi=(...e)=>{M.info(...e),M!==console&&console.info(...e)},ui=(...e)=>{M.warn(...e),M!==console&&console.warn(...e)},fi=(...e)=>{Pt?M.error(...e):M.warn("error",...e),M!==console&&console.error(...e)},di=e=>{Pt&&M.setFilterMsg(e)};var z=Object.freeze({__proto__:null,debug:ci,error:fi,filter:di,info:hi,warn:ui});const pi=(e="")=>e?new Promise((t,r)=>{wx.setClipboardData({data:e,success:()=>t(),fail:({errMsg:n})=>r(new de({message:n}))})}):Promise.reject(new Error("data is empty")),ke=(e,t,r,n)=>{wx.showModal({title:e,content:t,showCancel:!!n,theme:"day",success:({confirm:s})=>{s?r==null||r():n==null||n()},fail:()=>n==null?void 0:n()})},gi=(e,t="",r,n=()=>{})=>{ke("操作确认",`您确定要${e}么?${t}`,r,n)},mi=(e,t,r,n=!1)=>{wx.showModal({title:e,content:t,confirmText:"重试",theme:"day",success:({confirm:s})=>{s?r():n&&getCurrentPages().length>1&&wx.navigateBack()}})},P=(e,t=1500,r="none")=>new Promise((n,s)=>{wx.showToast({title:e,icon:r,duration:t,success:()=>n(),fail:({errMsg:i})=>s(new de({message:i}))})}),bi=()=>(wx.getWindowInfo||wx.getSystemInfoSync)();var yi=Object.defineProperty,wi=Object.defineProperties,xi=Object.getOwnPropertyDescriptors,Fr=Object.getOwnPropertySymbols,vi=Object.prototype.hasOwnProperty,Ai=Object.prototype.propertyIsEnumerable,Ur=(e,t,r)=>t in e?yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dt=(e,t)=>{for(var r in t||(t={}))vi.call(t,r)&&Ur(e,r,t[r]);if(Fr)for(var r of Fr(t))Ai.call(t,r)&&Ur(e,r,t[r]);return e},jt=(e,t)=>wi(e,xi(t));const Si=e=>new Promise((t,r)=>{if(Ze==="donut")return wx.addPhoneContact(jt(Dt({},e),{success:()=>t()}));wx.getSetting({success:({authSetting:n})=>{n["scope.addPhoneContact"]?wx.addPhoneContact(jt(Dt({},e),{success:()=>t()})):wx.authorize({scope:"scope.addPhoneContact",success:()=>{wx.addPhoneContact(jt(Dt({},e),{success:()=>t()}))},fail:()=>{ke("权限被拒","如果想要保存联系人,请在“权限设置”允许添加到联系人权限",()=>{wx.openSetting(),r(new de({message:"用户拒绝权限"}))})}})}})}),$i=(e,t)=>{const r=e.split("."),n=t.split("."),s=Math.max(r.length,n.length);for(;r.length<s;)r.push("0");for(;n.length<s;)n.push("0");for(let i=0;i<s;i++){const a=parseInt(r[i]),l=parseInt(n[i]);if(a>l)return 1;if(a<l)return-1}return 0},Rr=()=>{const e=getCurrentPages();return e[e.length-1]||null},Ci=()=>{var e,t;return(t=(e=Rr())==null?void 0:e.route)!=null?t:""},Vr=()=>{wx.getNetworkType({success:({networkType:e})=>{switch(e){case"wifi":wx.startWifi({success:()=>{wx.getConnectedWifi({success:({wifi:t})=>{t.signalStrength<.5&&P("Wifi 信号不佳")},fail:()=>{P("无法连接网络")}})},fail:()=>{P("无法连接网络")}});break;case"2g":case"3g":P("您的网络状态不佳");break;case"none":P("您没有连接到网络");break;default:P("网络连接出现问题,请稍后重试")}z.error("Request fail with",e)},fail:()=>{P("网络连接出现问题,请稍后重试"),z.error("Request fail and cannot get networkType")}})},Je=(e,t=!1)=>new Promise((r,n)=>{wx.downloadFile({url:e,success:({statusCode:s,tempFilePath:i})=>{if(wx.hideLoading(),s===200)r(i);else{const a=`Download ${e} failed with statusCode: ${s}`;P("下载失败"),z.warn(a),n(new de({code:s,message:a}))}},fail:({errMsg:s})=>{wx.hideLoading(),n(new de({message:s})),Vr(),z.warn(`Download ${e} failed:`,s)}}).onProgressUpdate(({progress:s})=>{wx.showLoading({title:`下载中...${Math.round(s)}%`,mask:t})})}),Ei=e=>{Je(e).then(t=>{wx.openDocument({filePath:t,showMenu:!0,success:()=>{z.debug(`打开文档 ${t} 成功`)},fail:({errMsg:r})=>{z.error(`打开文档 ${t} 失败`,r)}})}).catch(()=>{var t;P("下载文档失败"),(t=wx.reportEvent)==null||t.call(wx,"resource_load_failed",{broken_url:e})})},ki=(e,t=(r=>(r=(n=>(n=/\/([^/]+)\.[^/]+?$/.exec(e))==null?void 0:n[1])())!=null?r:"document")())=>{wx.canIUse("addFileToFavorites")&&Je(e).then(r=>{const n=e.split(".").pop();wx.addFileToFavorites({fileName:`${t}.${n}`,filePath:r,success:()=>{ke("文件已保存","文件已保存至“微信收藏”"),z.debug(e,"添加至收藏成功")},fail:({errMsg:s})=>{z.error(e,"添加至收藏失败",s)}})}).catch(()=>{var r;P("下载文档失败"),(r=wx.reportEvent)==null||r.call(wx,"resource_load_failed",{broken_url:e})})},Ti=e=>Je(e).then(t=>new Promise((r,n)=>{if(Ze==="donut")return wx.saveImageToPhotosAlbum({filePath:t,success:()=>r()});wx.getSetting({success:({authSetting:s})=>{s["scope.writePhotosAlbum"]?wx.saveImageToPhotosAlbum({filePath:t,success:()=>r()}):wx.authorize({scope:"scope.writePhotosAlbum",success:()=>{wx.saveImageToPhotosAlbum({filePath:t,success:()=>r()})},fail:()=>{ke("权限被拒","如果想要保存图片,请在“权限设置”允许保存图片权限",()=>{n(new de({message:"用户拒绝权限"})),wx.openSetting()})}})}})})),Ii=e=>{if(!("getUpdateManager"in wx))return;const t=wx.getUpdateManager();t.onCheckForUpdate(({hasUpdate:r})=>{r&&P("发现小程序更新,下载中...")}),t.onUpdateReady(()=>{e(()=>{t.applyUpdate()})}),t.onUpdateFailed(({errMsg:r})=>{P("小程序更新下载失败,请检查您的网络!"),z.error("更新应用失败",r)})};for(var pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Te=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Ye=0;Ye<pe.length;Ye++)Te[pe.charCodeAt(Ye)]=Ye;var Ni=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=pe[t[r]>>2],s+=pe[(t[r]&3)<<4|t[r+1]>>4],s+=pe[(t[r+1]&15)<<2|t[r+2]>>6],s+=pe[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},qi=function(e){var t=e.length*.75,r=e.length,n,s=0,i,a,l,o;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var c=new ArrayBuffer(t),h=new Uint8Array(c);for(n=0;n<r;n+=4)i=Te[e.charCodeAt(n)],a=Te[e.charCodeAt(n+1)],l=Te[e.charCodeAt(n+2)],o=Te[e.charCodeAt(n+3)],h[s++]=i<<2|a>>4,h[s++]=(a&15)<<4|l>>2,h[s++]=(l&3)<<6|o&63;return c};const Lt=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var Oi=(e,t,r)=>new Promise((n,s)=>{var i=o=>{try{l(r.next(o))}catch(c){s(c)}},a=o=>{try{l(r.throw(o))}catch(c){s(c)}},l=o=>o.done?n(o.value):Promise.resolve(o.value).then(i,a);l((r=r.apply(e,t)).next())});function Xe(e=new Map){return{all:e,on:(t,r)=>{const n=e.get(t);n?n.push(r):e.set(t,[r])},off:(t,r)=>{const n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:(t,r)=>{let n=e.get(t);n&&n.slice().map(s=>s(r)),n=e.get("*"),n&&n.slice().map(s=>s(t,r))},emitAsync:(t,r)=>Oi(this,null,function*(){var n,s;yield Promise.all(((n=e.get(t))!=null?n:[]).slice().map(i=>i(r))),yield Promise.all(((s=e.get("*"))!=null?s:[]).slice().map(i=>i(t,r)))})}}var Pi=Object.defineProperty,Di=(e,t,r)=>t in e?Pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ji=(e,t,r)=>Di(e,t+"",r);let Li=class extends Error{constructor({code:t,message:r}){super(r),ji(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Hr;const B=Lt==="js"?console:((Hr=wx.getRealtimeLogManager)==null?void 0:Hr.call(wx))||wx.getLogManager({level:1}),_t=Lt!=="js"&&"getRealtimeLogManager"in wx,_i=(...e)=>{wx.env.DEBUG&&(_t?B.info("debug",...e):B.debug(...e))},Mi=(...e)=>{B.info(...e),B!==console&&console.info(...e)},Bi=(...e)=>{B.warn(...e),B!==console&&console.warn(...e)},Fi=(...e)=>{_t?B.error(...e):B.warn("error",...e),B!==console&&console.error(...e)},Ui=e=>{_t&&B.setFilterMsg(e)};var Y=Object.freeze({__proto__:null,debug:_i,error:Fi,filter:Ui,info:Mi,warn:Bi});const Ri=(e="",t="&")=>{const r={},n=e?e.split(t):void 0;return n&&n.length>0&&n.forEach(s=>{const[i,a]=s.split("=");r[i]=a}),r},Gr=(e={},t="&",r=!1)=>Object.keys(e).map(n=>{const s=e[n];return`${n}=${r?s:encodeURIComponent(s)}`}).join(t),Vi=(e,t,r=!1)=>{const n=Gr(t,"&",r);return n?`${e}${/[?&]$/u.test(e)?"":e.includes("?")?"&":"?"}${n}`:e};var zr=Object.freeze({__proto__:null,join:Vi,parse:Ri,stringify:Gr});const Wr=e=>{if(e===void 0)return"undefined";const t=typeof e;if(t==="object"){if(e===null)return"null";const r=/\[object (\w+)\]/u.exec(Object.prototype.toString.call(e));return r?r[1].toLowerCase():""}return t},Qr=e=>Wr(e)==="function";var Hi=Object.defineProperty,Gi=(e,t,r)=>t in e?Hi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zr=(e,t,r)=>Gi(e,typeof t!="symbol"?t+"":t,r);function F(e,t){return function(...r){if(t.apply(this,r),e)return e.apply(this,r)}}const zi=(e,t)=>{let r;return function(...n){if(!r)return r=!0,e.apply(t!=null?t:this,[()=>{r=!1},...n])}},Wi=(e,t)=>{let r;return function(...n){if(!r)return r=!0,e.apply(t!=null?t:null,n)}};let Jr=class{constructor(t=1){this.capacity=t,Zr(this,"funcQueue",[]),Zr(this,"running",0)}next(){const t=this.funcQueue.shift();if(t){const{func:r,ctx:n,args:s}=t,i=()=>{r.apply(n,[()=>{this.running-=1,this.next()},...[].slice.call(s,0)])};this.running+=1,i()}}add(t,r,...n){this.funcQueue.push({func:t,ctx:r,args:[].slice.call(n,0)}),this.running<this.capacity&&this.next()}clear(){this.funcQueue=[]}};const Qi=(e,t=1)=>{const r=new Jr(t);return function(...n){r.add(e,this,...n)}},Mt="a",Yr="al",Xr="n",Kr="p",en="r",tn="u",W=Xe(),Ke=Xe(),Q=Xe(),X={launch:!1,lOpt:{},hide:0},Zi=e=>{X.launch=!0,X.lOpt=e,W.emit(Yr,e)},Ji=()=>{X.hide&&(W.emit(Mt,new Date().getTime()-X.hide),X.hide=0)},Yi=()=>{X.hide=new Date().getTime()},Xi=e=>{e.onLaunch=F(e.onLaunch,Zi),e.onShow=F(e.onShow,Ji),e.onHide=F(e.onHide,Yi),e.onAwake&&(W.on(Mt,t=>{Y.debug(`App: awake after ${t}ms`),e.onAwake(t)}),Y.debug("App: registered onAwake")),e.$on=Q.on,e.$off=Q.off,e.$emit=Q.emit,e.$emitAsync=Q.emitAsync,App(e)},Bt={},rn=e=>Bt[e],Ki=(e,t)=>{Bt[e]=t},ea=e=>{delete Bt[e]};var ta=Object.defineProperty,ra=Object.defineProperties,na=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,nn=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable,an=(e,t,r)=>t in e?ta(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,on=(e,t)=>{for(var r in t||(t={}))nn.call(t,r)&&an(e,r,t[r]);if(et)for(var r of et(t))sn.call(t,r)&&an(e,r,t[r]);return e},ln=(e,t)=>ra(e,na(t)),sa=(e,t)=>{var r={};for(var n in e)nn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&et)for(var n of et(e))t.indexOf(n)<0&&sn.call(e,n)&&(r[n]=e[n]);return r};let tt;const ia=e=>{const t=e,{defaultPage:r,pages:n=[],getPath:s}=t,i=sa(t,["defaultPage","pages","getPath"]);if(Qr(s)){tt=ln(on({},i),{getPath:s});return}let a={},l={};const o=(c,h)=>{const f=h.replace(/\$name/g,c);a[c]=f,l[f]=c};Array.isArray(n)?n.forEach(([c,h])=>{typeof c=="string"?o(c,h):c.forEach(f=>o(f,h))}):typeof n=="object"&&(a=n,l=Object.fromEntries(Object.keys(n).map(c=>[n[c],c]))),tt=ln(on({},i),{getPath:c=>a[c]||r.replace(/\$name/g,c)})},ne=()=>{if(!tt)throw new Error("$Config is not called");return tt};let Ie=!0;const cn=e=>{const t=ne(),[r,n]=e.split("?"),s=r.startsWith("/")?r:t.getPath(r);return{path:s,query:zr.parse(n),url:`${s}${n?`?${n}`:""}`}};function rt(e){return t=>{if(Ie){Ie=!1;const{path:r,url:n,query:s}=cn(t);return Promise.race([Ke.emitAsync(`${Xr}:${r}`,s),new Promise(i=>{var a;setTimeout(()=>i(),(a=ne().maxDelay)!=null?a:200)})]).then(()=>(Ie=!0,wx[e]({url:n})))}}}W.on(en,()=>{var e;setTimeout(()=>{Ie=!0},(e=ne().minInterval)!=null?e:100)}),W.on(tn,()=>{Ie=!0});const Ft=rt("navigateTo"),Ut=rt("redirectTo"),Rt=rt("switchTab"),nt=rt("reLaunch");function st(e){return function(t){if(t){const{before:r,after:n,url:s}=t.currentTarget.dataset;if(this&&r&&typeof this[r]=="function"&&this[r](t),s)return e(s).then(()=>{this&&n&&typeof this[n]=="function"&&this[n](t)})}}}const aa=st(Ft),oa=st(Ut),la=st(Rt),ca=st(nt),hn=(e=1)=>{const{home:t}=ne();return getCurrentPages().length<=e&&t?nt(t):wx.navigateBack({delta:e})},ha=function(e){if(e){const{before:t,after:r,delta:n=1}=e.currentTarget.dataset;return this&&t&&typeof this[t]=="function"&&this[t](e),Promise.resolve(hn(Number(n))).then(()=>{this&&r&&typeof this[r]=="function"&&this[r](e)})}},ua=()=>getCurrentPages().slice(0).pop(),fa=e=>{const{path:t,query:r}=cn(e);Ke.emit(`${Kr}:${t}`,r)};function un(e){const{args:t,event:r,id:n}=e.detail;switch(r){case"$attached":{const s=rn(n);if(!s)break;const i=s.$refID;i&&(this.$refs[i]=s),s.$attached(this);break}default:{const s=this[r];s&&s.apply(this,t)}}}function fn(e){const t=ne();e.$=un,e.$refs={},e.$on=Q.on,e.$off=Q.off,e.$emit=Q.emit,e.$emitAsync=Q.emitAsync,e.$go=Ft,e.$redirect=Ut,e.$switch=Rt,e.$reLaunch=nt,e.$back=hn,e.$preload=fa,e.$currentPage=ua,e.$getPath=t.getPath,e.$bindGo=aa,e.$bindRedirect=oa,e.$bindSwitch=la,e.$bindRelaunch=ca,e.$bindBack=ha}var da=Object.defineProperty,pa=Object.defineProperties,ga=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,ma=Object.prototype.hasOwnProperty,ba=Object.prototype.propertyIsEnumerable,pn=(e,t,r)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Vt=(e,t)=>{for(var r in t||(t={}))ma.call(t,r)&&pn(e,r,t[r]);if(dn)for(var r of dn(t))ba.call(t,r)&&pn(e,r,t[r]);return e},Ht=(e,t)=>pa(e,ga(t));let ya=0;const wa=(e={})=>{const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(n===null||typeof n=="function")t[r]=n;else{const{type:s}=n;s===null?t[r]={type:null,value:n.default}:Array.isArray(s)?t[r]={type:s[0],value:n.default,optionalTypes:s.slice(1)}:t[r]={type:s,value:n.default}}}),Ht(Vt({},t),{ref:{type:String,value:""}})},xa=e=>{const{extendComponent:t,injectComponent:r}=ne();return t&&t(e),e.lifetimes||(e.lifetimes={}),e.lifetimes.created=F(e.lifetimes.created,function(){fn(this),r&&r(e)}),e.lifetimes.attached=F(e.lifetimes.attached,function(){const n=ya+=1;this.$id=n,Ki(n,this),this.$refID=this.data.ref,this.triggerEvent("ing",{id:this.$id,event:"$attached"})}),e.lifetimes.detached=F(e.lifetimes.detached,function(){var n;ea(this.$id);const s=(n=this.$parent)==null?void 0:n.$refs,i=this.$refID;i&&s&&delete s[i],delete this.$parent}),e.methods=Ht(Vt({},e.methods),{$call(n,...s){Y.debug(`Component ${this.$id} call ${n}:`,s),this.triggerEvent("ing",{id:this.$id,event:n,args:s})},$getRef:rn,$attached(n){this.$root=n.$root||n,this.$parent=n},$:un}),e.observers=Ht(Vt({},e.observers),{ref(n){var s;this.$refID&&this.$refID!==n&&((s=this.$parent)!=null&&s.$refs&&delete this.$parent.$refs[this.$refID],this.$refID=n,Y.debug(`Component ${this.$id} ref: ${n}`))}}),e.properties=wa(e.props),delete e.props,Component(e)};let gn=!0;const va=(e,t)=>{const{getPath:r,extendPage:n,injectPage:s}=ne(),i=r(e),a=(o,c)=>Y.debug(`Page ${e}: ${o} has been invoked`,c||""),l=o=>Y.debug(`Page ${e}: registered ${o}`);if(n&&n(e,t),t.$name=e,t.$state={firstOpen:!1},t.onAppLaunch){if(X.launch){const{lOpt:o}=X;a("onAppLaunch"),t.onAppLaunch(o)}else W.on(Yr,o=>{a("onAppLaunch"),t.onAppLaunch(o)});l("onAppLaunch")}t.onNavigate&&(Ke.on(`${Xr}:${i}`,o=>(a("onNavigate",o),t.onNavigate(o))),l("onNavigate")),t.onPreload&&(Ke.on(`${Kr}:${i}`,o=>(a("onPreload",o),t.onPreload(o))),l("onPreload")),t.onLoad=F(t.onLoad,()=>{t.onAwake&&(W.on(Mt,o=>{a("onAwake"),t.onAwake(o)}),l("onAwake")),gn&&(gn=!1,t.$state.firstOpen=!0)}),t.onReady=F(t.onReady,()=>W.emit(en)),t.onUnload=F(t.onUnload,()=>W.emit(tn)),fn(t),s&&s(e,t),t.onRegister&&(a("onRegister"),t.onRegister()),Page(t),Y.debug(`Registered: Page ${e}`)};for(var mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Aa=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),it=0;it<mn.length;it++)Aa[mn.charCodeAt(it)]=it;const bn=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var Sa=Object.defineProperty,$a=(e,t,r)=>t in e?Sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ca=(e,t,r)=>$a(e,t+"",r);class Gt extends Error{constructor({code:t,message:r}){super(r),Ca(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}}var yn;const U=bn==="js"?console:((yn=wx.getRealtimeLogManager)==null?void 0:yn.call(wx))||wx.getLogManager({level:1}),zt=bn!=="js"&&"getRealtimeLogManager"in wx,Ea=(...e)=>{wx.env.DEBUG&&(zt?U.info("debug",...e):U.debug(...e))},ka=(...e)=>{U.info(...e),U!==console&&console.info(...e)},Ta=(...e)=>{U.warn(...e),U!==console&&console.warn(...e)},Ia=(...e)=>{zt?U.error(...e):U.warn("error",...e),U!==console&&console.error(...e)},Na=e=>{zt&&U.setFilterMsg(e)};var I=Object.freeze({__proto__:null,debug:Ea,error:Ia,filter:Na,info:ka,warn:Ta});const D=wx.getFileSystemManager(),q=wx.env.USER_DATA_PATH,at=e=>e.split("/").slice(0,-1).join("/"),Wt=e=>{try{return D.statSync(`${q}/${e}`,!1),!0}catch(t){return!1}},qa=e=>Wt(e)&&D.statSync(`${q}/${e}`).isFile(),wn=e=>Wt(e)&&D.statSync(`${q}/${e}`).isDirectory(),Oa=(e,t=wn(e)?"dir":"file")=>{const r=()=>I.debug(`Deleted ${e}`),n=s=>I.error(`Error deleting ${e}:`,s);if(t==="dir")try{D.rmdirSync(`${q}/${e}`,!0),r()}catch(s){n(s)}else try{D.unlinkSync(`${q}/${e}`),r()}catch(s){n(s)}},Pa=e=>{try{const t=D.readdirSync(`${q}/${e}`);return I.debug(`Listing ${e} folder:`,t),t}catch(t){return I.error(`Error listing ${e} folder:`,t),[]}},Da=(e,t="utf-8")=>{try{return D.readFileSync(`${q}/${e}`,t)}catch(r){I.warn(`${e} don't exist`);return}},ja=(e,t="utf-8")=>{let r;try{const n=D.readFileSync(`${q}/${e}.json`,t);try{r=JSON.parse(n),I.debug(`Read ${e}.json success:`,r)}catch(s){r=void 0,I.warn(`Parse ${e}.json failed`)}}catch(n){r=void 0,I.warn(`${e}.json doesn't exist`)}return r},ot=(e,t=!0)=>{try{D.mkdirSync(`${q}/${e}`,t)}catch(r){I.debug(`${e} folder already exists`)}},La=(e,t)=>{try{D.saveFileSync(e,`${q}/${t}`)}catch(r){I.error(`Saving to ${t} failed:`,r)}},_a=(e,t)=>(ot(at(t)),new Promise((r,n)=>{wx.downloadFile({url:e,filePath:`${q}/${t}`,success:({statusCode:s,tempFilePath:i})=>{if(s===200)return I.debug(`${e} saved`),r(i);I.error(`Download ${e} failed with statusCode ${s}`),n(new Gt({code:s}))},fail:({errMsg:s})=>{I.error(`Download ${e} failed:`,s),n(new Gt({message:s}))}})})),Ma=(e,t,r=t instanceof ArrayBuffer?"binary":"utf-8")=>{ot(at(e)),D.writeFileSync(`${q}/${e}`,t instanceof ArrayBuffer?t:JSON.stringify(t),r)},Ba=(e,t,r="utf-8")=>{const n=JSON.stringify(t);ot(at(e)),D.writeFileSync(`${q}/${e}.json`,n,r)},Fa=(e,t)=>new Promise((r,n)=>{D.unzip({zipFilePath:`${q}/${e}`,targetPath:`${q}/${t}`,success:()=>{r()},fail:({errCode:s,errMsg:i})=>{I.error(`Unzip ${e} failed:`,i),n(new Gt({code:s,message:i}))}})}),Ne=new Date().getTime();I.debug(`Current sessionId is ${Ne}`);const R="_cache_",lt={},Ua=(e,t)=>{lt[e]=t},Ra=e=>{const t=lt[e];return lt[e]=void 0,t},Qt=(e,t)=>t?t.expired?t.expired===Ne||new Date().getTime()<t.expired?t.data:(wx.removeStorageSync(`${R}${e}`),void 0):t.data:void 0,xn=(e,t,r)=>{const n={expired:0,data:t};if(r==="keep"){const s=wx.getStorageSync(`${R}${e}`);if(!s)return;n.expired=s.expired||0}else r&&(n.expired=r==="once"?Ne:r+new Date().getTime());return n},Va=(e,t,r=0)=>{wx.setStorageSync(`${R}${e}`,xn(e,t,r))},Ha=(e,t,r=0)=>wx.setStorage({key:`${R}${e}`,data:xn(e,t,r)}).catch(()=>{I.error(`set "${e}" fail`)}),Ga=e=>Qt(e,wx.getStorageSync(`${R}${e}`)),za=e=>wx.getStorage({key:`${R}${e}`}).then(({data:t})=>Qt(e,t)).catch(()=>{I.error(`set "${e}" fail`)}),Wa=e=>{wx.removeStorageSync(`${R}${e}`),Qt(e,null)},Qa=e=>wx.removeStorage({key:`${R}${e}`}),Za=()=>{wx.getStorageInfoSync().keys.forEach(e=>{if(e.startsWith(R)){const t=wx.getStorageSync(e);(!t||t.expired!==Ne&&new Date().getTime()>=t.expired)&&wx.removeStorageSync(e)}})},Ja=()=>wx.getStorageInfo().then(({keys:e})=>Promise.all(e.filter(t=>t.startsWith(R)).map(t=>wx.getStorage({key:t}).then(({data:r})=>{if(!r||r.expired!==Ne&&new Date().getTime()>=r.expired)return wx.removeStorage({key:t}).then(()=>{})})))),ge=(e="")=>e.replace(/^(\.*)?(?=\S)/gi,".").replace(/\.+$/,""),vn=e=>e.replace(/[#?].*$/,""),ct=e=>vn(e).replace(/^https?:\/\//,"").split("/").shift().replace(/:\d+$/,""),ht=(e="")=>{if(!e)return[];e=ge(e).replace(/^\.+/gi,"");const t=e.split(".").map(r=>[".",e.slice(e.indexOf(r))].join(""));return[e].concat(t)},An=e=>{const t=ct(e),r=vn(e).split(t)[1].replace(/^:\d+/,"")||"/";return{domain:t,path:r}},Zt=e=>{const{domain:t="",path:r="/"}=typeof e=="object"?e:typeof e=="string"?An(e):{};return{domain:ge(t),path:r}};var Ya=Object.defineProperty,Xa=(e,t,r)=>t in e?Ya(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,me=(e,t,r)=>Xa(e,typeof t!="symbol"?t+"":t,r);let ut=class{constructor(t){me(this,"name"),me(this,"value"),me(this,"domain"),me(this,"path"),me(this,"expires","session"),me(this,"httpOnly");var r,n;this.name=t.name||"",this.value=t.value||"",this.domain=(r=t.domain)!=null?r:"",this.path=(n=t.path)!=null?n:"/",this.httpOnly=!!t.httpOnly,this.expires=Number.isInteger(t.maxAge)?t.maxAge>0?new Date(new Date().getTime()+t.maxAge*1e3):"outdate":t.expires?new Date(t.expires):"session"}isExpired(){return this.expires==="outdate"||this.expires instanceof Date&&new Date>this.expires}isPersistence(){return this.expires!=="session"}isDomainMatched(t){return ht(t).includes(this.domain)}isPathMatched(t){return t.startsWith(this.path)||this.path.replace(/\/$/,"")===t}toString(){return`${this.name}=${this.value}`}toJSON(){const t={name:this.name,value:this.value,domain:this.domain};return this.path!=="/"&&(t.path=this.path),this.httpOnly&&(t.httpOnly=this.httpOnly),this.expires instanceof Date&&(t.expires=this.expires),t}};for(var Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ka=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),ft=0;ft<Sn.length;ft++)Ka[Sn.charCodeAt(ft)]=ft;const se=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var eo=Object.defineProperty,to=(e,t,r)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ro=(e,t,r)=>to(e,t+"",r);let $n=class extends Error{constructor({code:t,message:r}){super(r),ro(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Cn;const V=se==="js"?console:((Cn=wx.getRealtimeLogManager)==null?void 0:Cn.call(wx))||wx.getLogManager({level:1}),Jt=se!=="js"&&"getRealtimeLogManager"in wx,no=(...e)=>{wx.env.DEBUG&&(Jt?V.info("debug",...e):V.debug(...e))},so=(...e)=>{V.info(...e),V!==console&&console.info(...e)},io=(...e)=>{V.warn(...e),V!==console&&console.warn(...e)},ao=(...e)=>{Jt?V.error(...e):V.warn("error",...e),V!==console&&console.error(...e)},oo=e=>{Jt&&V.setFilterMsg(e)};var Yt=Object.freeze({__proto__:null,debug:no,error:ao,filter:oo,info:so,warn:io}),be={exports:{}},En;function lo(){if(En)return be.exports;En=1;var e={decodeValues:!0,map:!1,silent:!1};function t(a){return typeof a=="string"&&!!a.trim()}function r(a,l){var o=a.split(";").filter(t),c=o.shift(),h=n(c),f=h.name,d=h.value;l=l?Object.assign({},e,l):e;try{d=l.decodeValues?decodeURIComponent(d):d}catch(g){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+d+"'. Set options.decodeValues to false to disable this feature.",g)}var p={name:f,value:d};return o.forEach(function(g){var v=g.split("="),A=v.shift().trimLeft().toLowerCase(),_=v.join("=");A==="expires"?p.expires=new Date(_):A==="max-age"?p.maxAge=parseInt(_,10):A==="secure"?p.secure=!0:A==="httponly"?p.httpOnly=!0:A==="samesite"?p.sameSite=_:A==="partitioned"?p.partitioned=!0:p[A]=_}),p}function n(a){var l="",o="",c=a.split("=");return c.length>1?(l=c.shift(),o=c.join("=")):o=a,{name:l,value:o}}function s(a,l){if(l=l?Object.assign({},e,l):e,!a)return l.map?{}:[];if(a.headers)if(typeof a.headers.getSetCookie=="function")a=a.headers.getSetCookie();else if(a.headers["set-cookie"])a=a.headers["set-cookie"];else{var o=a.headers[Object.keys(a.headers).find(function(h){return h.toLowerCase()==="set-cookie"})];!o&&a.headers.cookie&&!l.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."),a=o}if(Array.isArray(a)||(a=[a]),l.map){var c={};return a.filter(t).reduce(function(h,f){var d=r(f,l);return h[d.name]=d,h},c)}else return a.filter(t).map(function(h){return r(h,l)})}function i(a){if(Array.isArray(a))return a;if(typeof a!="string")return[];var l=[],o=0,c,h,f,d,p;function g(){for(;o<a.length&&/\s/.test(a.charAt(o));)o+=1;return o<a.length}function v(){return h=a.charAt(o),h!=="="&&h!==";"&&h!==","}for(;o<a.length;){for(c=o,p=!1;g();)if(h=a.charAt(o),h===","){for(f=o,o+=1,g(),d=o;o<a.length&&v();)o+=1;o<a.length&&a.charAt(o)==="="?(p=!0,o=d,l.push(a.substring(c,f)),c=o):o=f+1}else o+=1;(!p||o>=a.length)&&l.push(a.substring(c,a.length))}return l}return be.exports=s,be.exports.parse=s,be.exports.parseString=r,be.exports.splitCookiesString=i,be.exports}var Xt=lo(),co=Object.defineProperty,ho=Object.defineProperties,uo=Object.getOwnPropertyDescriptors,kn=Object.getOwnPropertySymbols,fo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,Kt=(e,t,r)=>t in e?co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,go=(e,t)=>{for(var r in t||(t={}))fo.call(t,r)&&Kt(e,r,t[r]);if(kn)for(var r of kn(t))po.call(t,r)&&Kt(e,r,t[r]);return e},mo=(e,t)=>ho(e,uo(t)),Tn=(e,t,r)=>Kt(e,typeof t!="symbol"?t+"":t,r);const bo=/[^a-z0-9\-#$%&'*+.^_`|~]/i,In=`
1
+ for(var Mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ii=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Qe=0;Qe<Mr.length;Qe++)ii[Mr.charCodeAt(Qe)]=Qe;const Ze=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var ai=Object.defineProperty,oi=(e,t,r)=>t in e?ai(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,li=(e,t,r)=>oi(e,t+"",r);let de=class extends Error{constructor({code:t,message:r}){super(r),li(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Br;const M=Ze==="js"?console:((Br=wx.getRealtimeLogManager)==null?void 0:Br.call(wx))||wx.getLogManager({level:1}),Pt=Ze!=="js"&&"getRealtimeLogManager"in wx,ci=(...e)=>{wx.env.DEBUG&&(Pt?M.info("debug",...e):M.debug(...e)),M!==console&&console.error(...e)},hi=(...e)=>{M.info(...e),M!==console&&console.info(...e)},ui=(...e)=>{M.warn(...e),M!==console&&console.warn(...e)},fi=(...e)=>{Pt?M.error(...e):M.warn("error",...e),M!==console&&console.error(...e)},di=e=>{Pt&&M.setFilterMsg(e)};var z=Object.freeze({__proto__:null,debug:ci,error:fi,filter:di,info:hi,warn:ui});const pi=(e="")=>e?new Promise((t,r)=>{wx.setClipboardData({data:e,success:()=>t(),fail:({errMsg:n})=>r(new de({message:n}))})}):Promise.reject(new Error("data is empty")),ke=(e,t,r,n)=>{wx.showModal({title:e,content:t,showCancel:!!n,theme:"day",success:({confirm:s})=>{s?r==null||r():n==null||n()},fail:()=>n==null?void 0:n()})},gi=(e,t="",r,n=()=>{})=>{ke("操作确认",`您确定要${e}么?${t}`,r,n)},mi=(e,t,r,n=!1)=>{wx.showModal({title:e,content:t,confirmText:"重试",theme:"day",success:({confirm:s})=>{s?r():n&&getCurrentPages().length>1&&wx.navigateBack()}})},P=(e,t=1500,r="none")=>new Promise((n,s)=>{wx.showToast({title:e,icon:r,duration:t,success:()=>n(),fail:({errMsg:i})=>s(new de({message:i}))})}),bi=()=>(wx.getWindowInfo||wx.getSystemInfoSync)();var yi=Object.defineProperty,wi=Object.defineProperties,xi=Object.getOwnPropertyDescriptors,Fr=Object.getOwnPropertySymbols,vi=Object.prototype.hasOwnProperty,Ai=Object.prototype.propertyIsEnumerable,Ur=(e,t,r)=>t in e?yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dt=(e,t)=>{for(var r in t||(t={}))vi.call(t,r)&&Ur(e,r,t[r]);if(Fr)for(var r of Fr(t))Ai.call(t,r)&&Ur(e,r,t[r]);return e},jt=(e,t)=>wi(e,xi(t));const Si=e=>new Promise((t,r)=>{if(Ze==="donut")return wx.addPhoneContact(jt(Dt({},e),{success:()=>t()}));wx.getSetting({success:({authSetting:n})=>{n["scope.addPhoneContact"]?wx.addPhoneContact(jt(Dt({},e),{success:()=>t()})):wx.authorize({scope:"scope.addPhoneContact",success:()=>{wx.addPhoneContact(jt(Dt({},e),{success:()=>t()}))},fail:()=>{ke("权限被拒","如果想要保存联系人,请在“权限设置”允许添加到联系人权限",()=>{wx.openSetting(),r(new de({message:"用户拒绝权限"}))})}})}})}),$i=(e,t)=>{const r=e.split("."),n=t.split("."),s=Math.max(r.length,n.length);for(;r.length<s;)r.push("0");for(;n.length<s;)n.push("0");for(let i=0;i<s;i++){const a=parseInt(r[i]),l=parseInt(n[i]);if(a>l)return 1;if(a<l)return-1}return 0},Rr=()=>{const e=getCurrentPages();return e[e.length-1]||null},Ci=()=>{var e,t;return(t=(e=Rr())==null?void 0:e.route)!=null?t:""},Vr=()=>{wx.getNetworkType({success:({networkType:e})=>{switch(e){case"wifi":wx.startWifi({success:()=>{wx.getConnectedWifi({success:({wifi:t})=>{t.signalStrength<.5&&P("Wifi 信号不佳")},fail:()=>{P("无法连接网络")}})},fail:()=>{P("无法连接网络")}});break;case"2g":case"3g":P("您的网络状态不佳");break;case"none":P("您没有连接到网络");break;default:P("网络连接出现问题,请稍后重试")}z.error("Request fail with",e)},fail:()=>{P("网络连接出现问题,请稍后重试"),z.error("Request fail and cannot get networkType")}})},Je=(e,t=!1)=>new Promise((r,n)=>{wx.downloadFile({url:e,success:({statusCode:s,tempFilePath:i})=>{if(wx.hideLoading(),s===200)r(i);else{const a=`Download ${e} failed with statusCode: ${s}`;P("下载失败"),z.warn(a),n(new de({code:s,message:a}))}},fail:({errMsg:s})=>{wx.hideLoading(),n(new de({message:s})),Vr(),z.warn(`Download ${e} failed:`,s)}}).onProgressUpdate(({progress:s})=>{wx.showLoading({title:`下载中...${Math.round(s)}%`,mask:t})})}),Ei=e=>{Je(e).then(t=>{wx.openDocument({filePath:t,showMenu:!0,success:()=>{z.debug(`打开文档 ${t} 成功`)},fail:({errMsg:r})=>{z.error(`打开文档 ${t} 失败`,r)}})}).catch(()=>{var t;P("下载文档失败"),(t=wx.reportEvent)==null||t.call(wx,"resource_load_failed",{broken_url:e})})},ki=(e,t=(r=>(r=(n=>(n=/\/([^/]+)\.[^/]+?$/.exec(e))==null?void 0:n[1])())!=null?r:"document")())=>{wx.canIUse("addFileToFavorites")&&Je(e).then(r=>{const n=e.split(".").pop();wx.addFileToFavorites({fileName:`${t}.${n}`,filePath:r,success:()=>{ke("文件已保存","文件已保存至“微信收藏”"),z.debug(e,"添加至收藏成功")},fail:({errMsg:s})=>{z.error(e,"添加至收藏失败",s)}})}).catch(()=>{var r;P("下载文档失败"),(r=wx.reportEvent)==null||r.call(wx,"resource_load_failed",{broken_url:e})})},Ti=e=>Je(e).then(t=>new Promise((r,n)=>{if(Ze==="donut")return wx.saveImageToPhotosAlbum({filePath:t,success:()=>r()});wx.getSetting({success:({authSetting:s})=>{s["scope.writePhotosAlbum"]?wx.saveImageToPhotosAlbum({filePath:t,success:()=>r()}):wx.authorize({scope:"scope.writePhotosAlbum",success:()=>{wx.saveImageToPhotosAlbum({filePath:t,success:()=>r()})},fail:()=>{ke("权限被拒","如果想要保存图片,请在“权限设置”允许保存图片权限",()=>{n(new de({message:"用户拒绝权限"})),wx.openSetting()})}})}})})),Ii=e=>{if(!("getUpdateManager"in wx))return;const t=wx.getUpdateManager();t.onCheckForUpdate(({hasUpdate:r})=>{r&&P("发现小程序更新,下载中...")}),t.onUpdateReady(()=>{e(()=>{t.applyUpdate()})}),t.onUpdateFailed(({errMsg:r})=>{P("小程序更新下载失败,请检查您的网络!"),z.error("更新应用失败",r)})};for(var pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Te=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Ye=0;Ye<pe.length;Ye++)Te[pe.charCodeAt(Ye)]=Ye;var Ni=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=pe[t[r]>>2],s+=pe[(t[r]&3)<<4|t[r+1]>>4],s+=pe[(t[r+1]&15)<<2|t[r+2]>>6],s+=pe[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},qi=function(e){var t=e.length*.75,r=e.length,n,s=0,i,a,l,o;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var c=new ArrayBuffer(t),h=new Uint8Array(c);for(n=0;n<r;n+=4)i=Te[e.charCodeAt(n)],a=Te[e.charCodeAt(n+1)],l=Te[e.charCodeAt(n+2)],o=Te[e.charCodeAt(n+3)],h[s++]=i<<2|a>>4,h[s++]=(a&15)<<4|l>>2,h[s++]=(l&3)<<6|o&63;return c};const Lt=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var Oi=(e,t,r)=>new Promise((n,s)=>{var i=o=>{try{l(r.next(o))}catch(c){s(c)}},a=o=>{try{l(r.throw(o))}catch(c){s(c)}},l=o=>o.done?n(o.value):Promise.resolve(o.value).then(i,a);l((r=r.apply(e,t)).next())});function Xe(e=new Map){return{all:e,on:(t,r)=>{const n=e.get(t);n?n.push(r):e.set(t,[r])},off:(t,r)=>{const n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:(t,r)=>{let n=e.get(t);n&&n.slice().map(s=>s(r)),n=e.get("*"),n&&n.slice().map(s=>s(t,r))},emitAsync:(t,r)=>Oi(this,null,function*(){var n,s;yield Promise.all(((n=e.get(t))!=null?n:[]).slice().map(i=>i(r))),yield Promise.all(((s=e.get("*"))!=null?s:[]).slice().map(i=>i(t,r)))})}}var Pi=Object.defineProperty,Di=(e,t,r)=>t in e?Pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ji=(e,t,r)=>Di(e,t+"",r);let Li=class extends Error{constructor({code:t,message:r}){super(r),ji(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Hr;const B=Lt==="js"?console:((Hr=wx.getRealtimeLogManager)==null?void 0:Hr.call(wx))||wx.getLogManager({level:1}),_t=Lt!=="js"&&"getRealtimeLogManager"in wx,_i=(...e)=>{wx.env.DEBUG&&(_t?B.info("debug",...e):B.debug(...e)),B!==console&&console.error(...e)},Mi=(...e)=>{B.info(...e),B!==console&&console.info(...e)},Bi=(...e)=>{B.warn(...e),B!==console&&console.warn(...e)},Fi=(...e)=>{_t?B.error(...e):B.warn("error",...e),B!==console&&console.error(...e)},Ui=e=>{_t&&B.setFilterMsg(e)};var Y=Object.freeze({__proto__:null,debug:_i,error:Fi,filter:Ui,info:Mi,warn:Bi});const Ri=(e="",t="&")=>{const r={},n=e?e.split(t):void 0;return n&&n.length>0&&n.forEach(s=>{const[i,a]=s.split("=");r[i]=a}),r},Gr=(e={},t="&",r=!1)=>Object.keys(e).map(n=>{const s=e[n];return`${n}=${r?s:encodeURIComponent(s)}`}).join(t),Vi=(e,t,r=!1)=>{const n=Gr(t,"&",r);return n?`${e}${/[?&]$/u.test(e)?"":e.includes("?")?"&":"?"}${n}`:e};var zr=Object.freeze({__proto__:null,join:Vi,parse:Ri,stringify:Gr});const Wr=e=>{if(e===void 0)return"undefined";const t=typeof e;if(t==="object"){if(e===null)return"null";const r=/\[object (\w+)\]/u.exec(Object.prototype.toString.call(e));return r?r[1].toLowerCase():""}return t},Qr=e=>Wr(e)==="function";var Hi=Object.defineProperty,Gi=(e,t,r)=>t in e?Hi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zr=(e,t,r)=>Gi(e,typeof t!="symbol"?t+"":t,r);function R(e,t){return function(...r){if(t.apply(this,r),e)return e.apply(this,r)}}const zi=(e,t)=>{let r;return function(...n){if(!r)return r=!0,e.apply(t!=null?t:this,[()=>{r=!1},...n])}},Wi=(e,t)=>{let r;return function(...n){if(!r)return r=!0,e.apply(t!=null?t:null,n)}};let Jr=class{constructor(t=1){this.capacity=t,Zr(this,"funcQueue",[]),Zr(this,"running",0)}next(){const t=this.funcQueue.shift();if(t){const{func:r,ctx:n,args:s}=t,i=()=>{r.apply(n,[()=>{this.running-=1,this.next()},...[].slice.call(s,0)])};this.running+=1,i()}}add(t,r,...n){this.funcQueue.push({func:t,ctx:r,args:[].slice.call(n,0)}),this.running<this.capacity&&this.next()}clear(){this.funcQueue=[]}};const Qi=(e,t=1)=>{const r=new Jr(t);return function(...n){r.add(e,this,...n)}},Mt="a",Yr="al",Xr="n",Kr="p",en="r",tn="u",W=Xe(),Ke=Xe(),Q=Xe(),X={launch:!1,lOpt:{},hide:0},Zi=e=>{X.launch=!0,X.lOpt=e,W.emit(Yr,e)},Ji=()=>{X.hide&&(W.emit(Mt,new Date().getTime()-X.hide),X.hide=0)},Yi=()=>{X.hide=new Date().getTime()},Xi=e=>{e.onLaunch=R(e.onLaunch,Zi),e.onShow=R(e.onShow,Ji),e.onHide=R(e.onHide,Yi),e.onAwake&&(W.on(Mt,t=>{Y.debug(`App: awake after ${t}ms`),e.onAwake(t)}),Y.debug("App: registered onAwake")),e.$on=Q.on,e.$off=Q.off,e.$emit=Q.emit,e.$emitAsync=Q.emitAsync,App(e)},Bt={},rn=e=>Bt[e],Ki=(e,t)=>{Bt[e]=t},ea=e=>{delete Bt[e]};var ta=Object.defineProperty,ra=Object.defineProperties,na=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,nn=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable,an=(e,t,r)=>t in e?ta(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,on=(e,t)=>{for(var r in t||(t={}))nn.call(t,r)&&an(e,r,t[r]);if(et)for(var r of et(t))sn.call(t,r)&&an(e,r,t[r]);return e},ln=(e,t)=>ra(e,na(t)),sa=(e,t)=>{var r={};for(var n in e)nn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&et)for(var n of et(e))t.indexOf(n)<0&&sn.call(e,n)&&(r[n]=e[n]);return r};let tt;const ia=e=>{const t=e,{defaultPage:r,pages:n=[],getPath:s}=t,i=sa(t,["defaultPage","pages","getPath"]);if(Qr(s)){tt=ln(on({},i),{getPath:s});return}let a={},l={};const o=(c,h)=>{const f=h.replace(/\$name/g,c);a[c]=f,l[f]=c};Array.isArray(n)?n.forEach(([c,h])=>{typeof c=="string"?o(c,h):c.forEach(f=>o(f,h))}):typeof n=="object"&&(a=n,l=Object.fromEntries(Object.keys(n).map(c=>[n[c],c]))),tt=ln(on({},i),{getPath:c=>a[c]||r.replace(/\$name/g,c)})},ne=()=>{if(!tt)throw new Error("$Config is not called");return tt};let Ie=!0;const cn=e=>{const t=ne(),[r,n]=e.split("?"),s=r.startsWith("/")?r:t.getPath(r);return{path:s,query:zr.parse(n),url:`${s}${n?`?${n}`:""}`}};function rt(e){return t=>{if(Ie){Ie=!1;const{path:r,url:n,query:s}=cn(t);return Promise.race([Ke.emitAsync(`${Xr}:${r}`,s),new Promise(i=>{var a;setTimeout(()=>i(),(a=ne().maxDelay)!=null?a:200)})]).then(()=>(Ie=!0,wx[e]({url:n})))}}}W.on(en,()=>{var e;setTimeout(()=>{Ie=!0},(e=ne().minInterval)!=null?e:100)}),W.on(tn,()=>{Ie=!0});const Ft=rt("navigateTo"),Ut=rt("redirectTo"),Rt=rt("switchTab"),nt=rt("reLaunch");function st(e){return function(t){if(t){const{before:r,after:n,url:s}=t.currentTarget.dataset;if(this&&r&&typeof this[r]=="function"&&this[r](t),s)return e(s).then(()=>{this&&n&&typeof this[n]=="function"&&this[n](t)})}}}const aa=st(Ft),oa=st(Ut),la=st(Rt),ca=st(nt),hn=(e=1)=>{const{home:t}=ne();return getCurrentPages().length<=e&&t?nt(t):wx.navigateBack({delta:e})},ha=function(e){if(e){const{before:t,after:r,delta:n=1}=e.currentTarget.dataset;return this&&t&&typeof this[t]=="function"&&this[t](e),Promise.resolve(hn(Number(n))).then(()=>{this&&r&&typeof this[r]=="function"&&this[r](e)})}},ua=()=>getCurrentPages().slice(0).pop(),fa=e=>{const{path:t,query:r}=cn(e);Ke.emit(`${Kr}:${t}`,r)};function un(e){const{args:t,event:r,id:n}=e.detail;switch(r){case"$attached":{const s=rn(n);if(!s)break;const i=s.$refID;i&&(this.$refs[i]=s),s.$attached(this);break}default:{const s=this[r];s&&s.apply(this,t)}}}function fn(e){const t=ne();e.$=un,e.$refs={},e.$on=Q.on,e.$off=Q.off,e.$emit=Q.emit,e.$emitAsync=Q.emitAsync,e.$go=Ft,e.$redirect=Ut,e.$switch=Rt,e.$reLaunch=nt,e.$back=hn,e.$preload=fa,e.$currentPage=ua,e.$getPath=t.getPath,e.$bindGo=aa,e.$bindRedirect=oa,e.$bindSwitch=la,e.$bindRelaunch=ca,e.$bindBack=ha}var da=Object.defineProperty,pa=Object.defineProperties,ga=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,ma=Object.prototype.hasOwnProperty,ba=Object.prototype.propertyIsEnumerable,pn=(e,t,r)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Vt=(e,t)=>{for(var r in t||(t={}))ma.call(t,r)&&pn(e,r,t[r]);if(dn)for(var r of dn(t))ba.call(t,r)&&pn(e,r,t[r]);return e},Ht=(e,t)=>pa(e,ga(t));let ya=0;const wa=(e={})=>{const t={};return Object.keys(e).forEach(r=>{const n=e[r];if(n===null||typeof n=="function")t[r]=n;else{const{type:s}=n;s===null?t[r]={type:null,value:n.default}:Array.isArray(s)?t[r]={type:s[0],value:n.default,optionalTypes:s.slice(1)}:t[r]={type:s,value:n.default}}}),Ht(Vt({},t),{ref:{type:String,value:""}})},xa=e=>{const{extendComponent:t,injectComponent:r}=ne();return t&&t(e),e.lifetimes||(e.lifetimes={}),e.lifetimes.created=R(e.lifetimes.created,function(){fn(this),r&&r(e)}),e.lifetimes.attached=R(e.lifetimes.attached,function(){const n=ya+=1;this.$id=n,Ki(n,this),this.$refID=this.data.ref,this.triggerEvent("ing",{id:this.$id,event:"$attached"})}),e.lifetimes.detached=R(e.lifetimes.detached,function(){var n;ea(this.$id);const s=(n=this.$parent)==null?void 0:n.$refs,i=this.$refID;i&&s&&delete s[i],delete this.$parent}),e.methods=Ht(Vt({},e.methods),{$call(n,...s){Y.debug(`Component ${this.$id} call ${n}:`,s),this.triggerEvent("ing",{id:this.$id,event:n,args:s})},$getRef:rn,$attached(n){this.$root=n.$root||n,this.$parent=n},$:un}),e.observers=Ht(Vt({},e.observers),{ref(n){var s;this.$refID&&this.$refID!==n&&((s=this.$parent)!=null&&s.$refs&&delete this.$parent.$refs[this.$refID],this.$refID=n,Y.debug(`Component ${this.$id} ref: ${n}`))}}),e.properties=wa(e.props),delete e.props,Component(e)};let gn=!0;const va=(e,t)=>{const{getPath:r,extendPage:n,injectPage:s}=ne(),i=r(e),a=(o,c)=>Y.debug(`Page ${e}: ${o} has been invoked`,c||""),l=o=>Y.debug(`Page ${e}: registered ${o}`);if(n&&n(e,t),t.$name=e,t.$state={firstOpen:!1},t.onAppLaunch){if(X.launch){const{lOpt:o}=X;a("onAppLaunch"),t.onAppLaunch(o)}else W.on(Yr,o=>{a("onAppLaunch"),t.onAppLaunch(o)});l("onAppLaunch")}t.onNavigate&&(Ke.on(`${Xr}:${i}`,o=>(a("onNavigate",o),t.onNavigate(o))),l("onNavigate")),t.onPreload&&(Ke.on(`${Kr}:${i}`,o=>(a("onPreload",o),t.onPreload(o))),l("onPreload")),t.onLoad=R(t.onLoad,()=>{t.onAwake&&(W.on(Mt,o=>{a("onAwake"),t.onAwake(o)}),l("onAwake")),gn&&(gn=!1,t.$state.firstOpen=!0)}),t.onReady=R(t.onReady,()=>W.emit(en)),t.onUnload=R(t.onUnload,()=>W.emit(tn)),fn(t),s&&s(e,t),t.onRegister&&(a("onRegister"),t.onRegister()),Page(t),Y.debug(`Registered: Page ${e}`)};for(var mn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Aa=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),it=0;it<mn.length;it++)Aa[mn.charCodeAt(it)]=it;const bn=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var Sa=Object.defineProperty,$a=(e,t,r)=>t in e?Sa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ca=(e,t,r)=>$a(e,t+"",r);class Gt extends Error{constructor({code:t,message:r}){super(r),Ca(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}}var yn;const F=bn==="js"?console:((yn=wx.getRealtimeLogManager)==null?void 0:yn.call(wx))||wx.getLogManager({level:1}),zt=bn!=="js"&&"getRealtimeLogManager"in wx,Ea=(...e)=>{wx.env.DEBUG&&(zt?F.info("debug",...e):F.debug(...e)),F!==console&&console.error(...e)},ka=(...e)=>{F.info(...e),F!==console&&console.info(...e)},Ta=(...e)=>{F.warn(...e),F!==console&&console.warn(...e)},Ia=(...e)=>{zt?F.error(...e):F.warn("error",...e),F!==console&&console.error(...e)},Na=e=>{zt&&F.setFilterMsg(e)};var I=Object.freeze({__proto__:null,debug:Ea,error:Ia,filter:Na,info:ka,warn:Ta});const D=wx.getFileSystemManager(),q=wx.env.USER_DATA_PATH,at=e=>e.split("/").slice(0,-1).join("/"),Wt=e=>{try{return D.statSync(`${q}/${e}`,!1),!0}catch(t){return!1}},qa=e=>Wt(e)&&D.statSync(`${q}/${e}`).isFile(),wn=e=>Wt(e)&&D.statSync(`${q}/${e}`).isDirectory(),Oa=(e,t=wn(e)?"dir":"file")=>{const r=()=>I.debug(`Deleted ${e}`),n=s=>I.error(`Error deleting ${e}:`,s);if(t==="dir")try{D.rmdirSync(`${q}/${e}`,!0),r()}catch(s){n(s)}else try{D.unlinkSync(`${q}/${e}`),r()}catch(s){n(s)}},Pa=e=>{try{const t=D.readdirSync(`${q}/${e}`);return I.debug(`Listing ${e} folder:`,t),t}catch(t){return I.error(`Error listing ${e} folder:`,t),[]}},Da=(e,t="utf-8")=>{try{return D.readFileSync(`${q}/${e}`,t)}catch(r){I.warn(`${e} don't exist`);return}},ja=(e,t="utf-8")=>{let r;try{const n=D.readFileSync(`${q}/${e}.json`,t);try{r=JSON.parse(n),I.debug(`Read ${e}.json success:`,r)}catch(s){r=void 0,I.warn(`Parse ${e}.json failed`)}}catch(n){r=void 0,I.warn(`${e}.json doesn't exist`)}return r},ot=(e,t=!0)=>{try{D.mkdirSync(`${q}/${e}`,t)}catch(r){I.debug(`${e} folder already exists`)}},La=(e,t)=>{try{D.saveFileSync(e,`${q}/${t}`)}catch(r){I.error(`Saving to ${t} failed:`,r)}},_a=(e,t)=>(ot(at(t)),new Promise((r,n)=>{wx.downloadFile({url:e,filePath:`${q}/${t}`,success:({statusCode:s,tempFilePath:i})=>{if(s===200)return I.debug(`${e} saved`),r(i);I.error(`Download ${e} failed with statusCode ${s}`),n(new Gt({code:s}))},fail:({errMsg:s})=>{I.error(`Download ${e} failed:`,s),n(new Gt({message:s}))}})})),Ma=(e,t,r=t instanceof ArrayBuffer?"binary":"utf-8")=>{ot(at(e)),D.writeFileSync(`${q}/${e}`,t instanceof ArrayBuffer?t:JSON.stringify(t),r)},Ba=(e,t,r="utf-8")=>{const n=JSON.stringify(t);ot(at(e)),D.writeFileSync(`${q}/${e}.json`,n,r)},Fa=(e,t)=>new Promise((r,n)=>{D.unzip({zipFilePath:`${q}/${e}`,targetPath:`${q}/${t}`,success:()=>{r()},fail:({errCode:s,errMsg:i})=>{I.error(`Unzip ${e} failed:`,i),n(new Gt({code:s,message:i}))}})}),Ne=new Date().getTime();I.debug(`Current sessionId is ${Ne}`);const V="_cache_",lt={},Ua=(e,t)=>{lt[e]=t},Ra=e=>{const t=lt[e];return lt[e]=void 0,t},Qt=(e,t)=>t?t.expired?t.expired===Ne||new Date().getTime()<t.expired?t.data:(wx.removeStorageSync(`${V}${e}`),void 0):t.data:void 0,xn=(e,t,r)=>{const n={expired:0,data:t};if(r==="keep"){const s=wx.getStorageSync(`${V}${e}`);if(!s)return;n.expired=s.expired||0}else r&&(n.expired=r==="once"?Ne:r+new Date().getTime());return n},Va=(e,t,r=0)=>{wx.setStorageSync(`${V}${e}`,xn(e,t,r))},Ha=(e,t,r=0)=>wx.setStorage({key:`${V}${e}`,data:xn(e,t,r)}).catch(()=>{I.error(`set "${e}" fail`)}),Ga=e=>Qt(e,wx.getStorageSync(`${V}${e}`)),za=e=>wx.getStorage({key:`${V}${e}`}).then(({data:t})=>Qt(e,t)).catch(()=>{I.error(`set "${e}" fail`)}),Wa=e=>{wx.removeStorageSync(`${V}${e}`),Qt(e,null)},Qa=e=>wx.removeStorage({key:`${V}${e}`}),Za=()=>{wx.getStorageInfoSync().keys.forEach(e=>{if(e.startsWith(V)){const t=wx.getStorageSync(e);(!t||t.expired!==Ne&&new Date().getTime()>=t.expired)&&wx.removeStorageSync(e)}})},Ja=()=>wx.getStorageInfo().then(({keys:e})=>Promise.all(e.filter(t=>t.startsWith(V)).map(t=>wx.getStorage({key:t}).then(({data:r})=>{if(!r||r.expired!==Ne&&new Date().getTime()>=r.expired)return wx.removeStorage({key:t}).then(()=>{})})))),ge=(e="")=>e.replace(/^(\.*)?(?=\S)/gi,".").replace(/\.+$/,""),vn=e=>e.replace(/[#?].*$/,""),ct=e=>vn(e).replace(/^https?:\/\//,"").split("/").shift().replace(/:\d+$/,""),ht=(e="")=>{if(!e)return[];e=ge(e).replace(/^\.+/gi,"");const t=e.split(".").map(r=>[".",e.slice(e.indexOf(r))].join(""));return[e].concat(t)},An=e=>{const t=ct(e),r=vn(e).split(t)[1].replace(/^:\d+/,"")||"/";return{domain:t,path:r}},Zt=e=>{const{domain:t="",path:r="/"}=typeof e=="object"?e:typeof e=="string"?An(e):{};return{domain:ge(t),path:r}};var Ya=Object.defineProperty,Xa=(e,t,r)=>t in e?Ya(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,me=(e,t,r)=>Xa(e,typeof t!="symbol"?t+"":t,r);let ut=class{constructor(t){me(this,"name"),me(this,"value"),me(this,"domain"),me(this,"path"),me(this,"expires","session"),me(this,"httpOnly");var r,n;this.name=t.name||"",this.value=t.value||"",this.domain=(r=t.domain)!=null?r:"",this.path=(n=t.path)!=null?n:"/",this.httpOnly=!!t.httpOnly,this.expires=Number.isInteger(t.maxAge)?t.maxAge>0?new Date(new Date().getTime()+t.maxAge*1e3):"outdate":t.expires?new Date(t.expires):"session"}isExpired(){return this.expires==="outdate"||this.expires instanceof Date&&new Date>this.expires}isPersistence(){return this.expires!=="session"}isDomainMatched(t){return ht(t).includes(this.domain)}isPathMatched(t){return t.startsWith(this.path)||this.path.replace(/\/$/,"")===t}toString(){return`${this.name}=${this.value}`}toJSON(){const t={name:this.name,value:this.value,domain:this.domain};return this.path!=="/"&&(t.path=this.path),this.httpOnly&&(t.httpOnly=this.httpOnly),this.expires instanceof Date&&(t.expires=this.expires),t}};for(var Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ka=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),ft=0;ft<Sn.length;ft++)Ka[Sn.charCodeAt(ft)]=ft;const se=typeof qq=="object"?"qq":typeof wx=="object"?"miniapp"in wx?"donut":"wx":"js";var eo=Object.defineProperty,to=(e,t,r)=>t in e?eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ro=(e,t,r)=>to(e,t+"",r);let $n=class extends Error{constructor({code:t,message:r}){super(r),ro(this,"code"),this.code=t!=null?t:null}toString(){return`code: ${this.code}, message: ${this.message}`}};var Cn;const U=se==="js"?console:((Cn=wx.getRealtimeLogManager)==null?void 0:Cn.call(wx))||wx.getLogManager({level:1}),Jt=se!=="js"&&"getRealtimeLogManager"in wx,no=(...e)=>{wx.env.DEBUG&&(Jt?U.info("debug",...e):U.debug(...e)),U!==console&&console.error(...e)},so=(...e)=>{U.info(...e),U!==console&&console.info(...e)},io=(...e)=>{U.warn(...e),U!==console&&console.warn(...e)},ao=(...e)=>{Jt?U.error(...e):U.warn("error",...e),U!==console&&console.error(...e)},oo=e=>{Jt&&U.setFilterMsg(e)};var Yt=Object.freeze({__proto__:null,debug:no,error:ao,filter:oo,info:so,warn:io}),be={exports:{}},En;function lo(){if(En)return be.exports;En=1;var e={decodeValues:!0,map:!1,silent:!1};function t(a){return typeof a=="string"&&!!a.trim()}function r(a,l){var o=a.split(";").filter(t),c=o.shift(),h=n(c),f=h.name,d=h.value;l=l?Object.assign({},e,l):e;try{d=l.decodeValues?decodeURIComponent(d):d}catch(g){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+d+"'. Set options.decodeValues to false to disable this feature.",g)}var p={name:f,value:d};return o.forEach(function(g){var v=g.split("="),A=v.shift().trimLeft().toLowerCase(),_=v.join("=");A==="expires"?p.expires=new Date(_):A==="max-age"?p.maxAge=parseInt(_,10):A==="secure"?p.secure=!0:A==="httponly"?p.httpOnly=!0:A==="samesite"?p.sameSite=_:A==="partitioned"?p.partitioned=!0:p[A]=_}),p}function n(a){var l="",o="",c=a.split("=");return c.length>1?(l=c.shift(),o=c.join("=")):o=a,{name:l,value:o}}function s(a,l){if(l=l?Object.assign({},e,l):e,!a)return l.map?{}:[];if(a.headers)if(typeof a.headers.getSetCookie=="function")a=a.headers.getSetCookie();else if(a.headers["set-cookie"])a=a.headers["set-cookie"];else{var o=a.headers[Object.keys(a.headers).find(function(h){return h.toLowerCase()==="set-cookie"})];!o&&a.headers.cookie&&!l.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."),a=o}if(Array.isArray(a)||(a=[a]),l.map){var c={};return a.filter(t).reduce(function(h,f){var d=r(f,l);return h[d.name]=d,h},c)}else return a.filter(t).map(function(h){return r(h,l)})}function i(a){if(Array.isArray(a))return a;if(typeof a!="string")return[];var l=[],o=0,c,h,f,d,p;function g(){for(;o<a.length&&/\s/.test(a.charAt(o));)o+=1;return o<a.length}function v(){return h=a.charAt(o),h!=="="&&h!==";"&&h!==","}for(;o<a.length;){for(c=o,p=!1;g();)if(h=a.charAt(o),h===","){for(f=o,o+=1,g(),d=o;o<a.length&&v();)o+=1;o<a.length&&a.charAt(o)==="="?(p=!0,o=d,l.push(a.substring(c,f)),c=o):o=f+1}else o+=1;(!p||o>=a.length)&&l.push(a.substring(c,a.length))}return l}return be.exports=s,be.exports.parse=s,be.exports.parseString=r,be.exports.splitCookiesString=i,be.exports}var Xt=lo(),co=Object.defineProperty,ho=Object.defineProperties,uo=Object.getOwnPropertyDescriptors,kn=Object.getOwnPropertySymbols,fo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,Kt=(e,t,r)=>t in e?co(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,go=(e,t)=>{for(var r in t||(t={}))fo.call(t,r)&&Kt(e,r,t[r]);if(kn)for(var r of kn(t))po.call(t,r)&&Kt(e,r,t[r]);return e},mo=(e,t)=>ho(e,uo(t)),Tn=(e,t,r)=>Kt(e,typeof t!="symbol"?t+"":t,r);const bo=/[^a-z0-9\-#$%&'*+.^_`|~]/i,In=`
2
2
  \r `,yo=new RegExp(`(^[${In}]|$[${In}])`,"g"),qe=e=>{if(typeof e!="string"||e.length===0||e.length>128)return!1;for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r>127||r===32)return!1}return!0},Oe=e=>{if(bo.test(e)||e.trim()==="")throw new TypeError("Invalid character in header field name");return e.trim().toLowerCase()},Nn=e=>{if(typeof e!="string"||e.trim()!==e)return!1;for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r===0||r===10||r===13)return!1}return!0},er=e=>e.replace(yo,""),tr=(e,t)=>Xt.parse(Xt.splitCookiesString(e)).map(r=>new ut(mo(go({},r),{domain:ge(r.domain)||t})));let rr=class si{constructor(t){Tn(this,"headers",{}),Tn(this,"headerNames",new Map),t instanceof si?t.forEach((r,n)=>{this.append(n,r)},this):Array.isArray(t)?t.forEach(([r,n])=>{this.append(r,Array.isArray(n)?n.join(", "):n)}):t&&Object.getOwnPropertyNames(t).forEach(r=>{const n=t[r];this.append(r,Array.isArray(n)?n.join(", "):n)})}append(t,r){if(!qe(t)||!Nn(r))return;const n=Oe(t),s=er(r),i=this.has(n)?`${this.get(n)}, ${s}`:s;this.set(t,i)}delete(t){if(!qe(t)||!this.has(t))return;const r=Oe(t);delete this.headers[r],this.headerNames.delete(r)}get(t){var r;if(!qe(t))throw TypeError(`Invalid header name "${t}"`);return(r=this.headers[Oe(t)])!=null?r:null}getSetCookie(){const t=this.get("set-cookie");return t===null?[]:t===""?[""]:Xt.splitCookiesString(t)}has(t){if(!qe(t))throw new TypeError(`Invalid header name "${t}"`);return this.headers.hasOwnProperty(Oe(t))}set(t,r){if(!qe(t)||!Nn(r))return;const n=Oe(t),s=er(r);this.headers[n]=er(s),this.headerNames.set(n,t)}forEach(t,r){for(const[n,s]of this.entries())t.call(r,s,n,this)}*keys(){for(const[t]of this.entries())yield t}*values(){for(const[,t]of this.entries())yield t}*entries(){const t=Object.keys(this.headers).sort((r,n)=>r.localeCompare(n));for(const r of t)if(r==="set-cookie")for(const n of this.getSetCookie())yield[r,n];else yield[r,this.get(r)]}toObject(){return this.headers}[Symbol.iterator](){return this.entries()}};var wo=Object.defineProperty,qn=e=>{throw TypeError(e)},xo=(e,t,r)=>t in e?wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vo=(e,t,r)=>xo(e,t+"",r),Ao=(e,t,r)=>t.has(e)||qn("Cannot "+r),So=(e,t,r)=>t.has(e)?qn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Pe=(e,t,r)=>(Ao(e,t,"access private method"),r),ie,On,De;class dt{constructor(t="__cookie_store__"){this.key=t,So(this,ie),vo(this,"store",new Map),Pe(this,ie,On).call(this)}get(t,r){const{domain:n,path:s}=Zt(r),i=ht(n);for(const[a,l]of this.store.entries()){if(n&&!i.includes(a))continue;const o=l.get(t);if(o&&o.isPathMatched(s)&&!o.isExpired())return o}return null}getValue(t,r){var n;return(n=this.get(t,r))==null?void 0:n.value}has(t,r){return!!this.get(t,r)}set(t){var r;const{name:n,domain:s}=t,i=new ut(t),a=(r=this.store.get(s))!=null?r:new Map;return a.set(n,i),this.store.set(s,a),Pe(this,ie,De).call(this),i}delete(t,r=""){if(r){const n=this.store.get(r);n&&n.delete(t);const s=this.store.get(ge(r));s&&s.delete(t)}else for(const n of this.store.values())n.delete(t);Pe(this,ie,De).call(this)}list(){const t={};for(const r of this.store.keys())t[r]=this.getCookiesMap(r);return t}getCookies(t){const{domain:r,path:n}=Zt(t),s=ht(r),i=[];for(const[a,l]of this.store.entries())if(!(r&&!s.includes(a)))for(const o of l.values())o.isPathMatched(n)&&!o.isExpired()&&i.push(o);return i}getAllCookies(){const t=[];for(const r of this.store.values())for(const n of r.values())n.isExpired()||t.push(n);return t}getCookiesMap(t){return Object.fromEntries(this.getCookies(t).map(({name:r,value:n})=>[r,n]))}apply(t){t.forEach(r=>{let n=this.store.get(r.domain);n||(n=new Map,this.store.set(r.domain,n)),n.set(r.name,r)}),Pe(this,ie,De).call(this)}clear(t="",r=!1){if(t){const n=this.store.get(t);if(n&&n.clear(),!r){const s=this.store.get(ge(t));s&&s.clear()}}else this.store.clear();Pe(this,ie,De).call(this)}applyHeader(t,r){if(se==="js")return this.apply(tr(t.getSetCookie().join(","),ct(r)));const n=t["Set-Cookie"]||t["set-cookie"]||"",s=Array.isArray(n)?n.filter(Boolean).join(","):se==="qq"?n.replace(/;((?!Path|Expires|Max-Age|Domain|Path|SameSite)[^\s;]*?)=/gi,",$1="):n;return this.apply(tr(s,ct(r)))}applyResponse(t,r){return this.applyHeader(se==="js"?t.headers:t.header,r)}getHeader(t){return this.getCookies(t).map(r=>r.toString()).join("; ")}}ie=new WeakSet,On=function(){try{let e=[];if(se!=="js"){const t=wx.getStorageSync(this.key);Array.isArray(t)&&(e=t)}this.apply(e.map(t=>new ut(t)))}catch(e){console.warn("Error applying cookie storage",e);return}},De=function(){try{const e=[];for(const t of this.store.values())for(const r of t.values())r.isExpired()?t.delete(r.name):r.isPersistence()&&e.push(r);se!=="js"&&wx.setStorageSync(this.key,e)}catch(e){console.warn("Error setting cookies",e)}};var $o=Object.defineProperty,Co=(e,t,r)=>t in e?$o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Eo=(e,t,r)=>Co(e,t+"",r);const ko={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"},Pn=e=>encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,t=>ko[t]),Dn=e=>decodeURIComponent(e.replace(/\+/g," "));class ze{constructor(t){if(Eo(this,"params"),!t)this.params=new Map;else if(t instanceof ze)this.params=new Map(t.params);else if(this.params=new Map,typeof t=="string")(t.startsWith("?")?t.slice(1):t).split("&").forEach(r=>{var n;const[,s,i]=(n=/^([^=]+)=?(.*?)$/.exec(r))!=null?n:[];s&&this.append(Dn(s),Dn(i))});else if(Symbol.iterator in t)for(const r of t){if(r.length!==2)throw new TypeError("Failed to construct 'URLSearchParams': Sequence initializer must only contain pair elements");const[n,s]=r;this.append(n,s)}else for(const r of Object.keys(t)){const n=t[r];this.params.set(r,[String(n)])}}get size(){return Array.from(this.params.values()).flat().length}append(t,r){this.params.set(t,this.getAll(t).concat(String(r)))}delete(t){this.params.delete(t)}entries(){const t=new Set;return this.forEach((r,n)=>{t.add([n,r])}),t.values()}forEach(t,r){this.params.forEach((n,s)=>n.forEach(i=>t.bind(r)(i,s,this)))}get(t){var r;return(r=this.getAll(t)[0])!=null?r:null}getAll(t){var r,n;return(n=(r=this.params.get(t))==null?void 0:r.slice(0))!=null?n:[]}has(t){return this.params.has(t)}keys(){return this.params.keys()}set(t,r){this.params.set(t,[r||""])}sort(){this.params=new Map(Array.from(this.params.entries()).sort(([t],[r])=>t.localeCompare(r)))}toString(){const t=[];for(const[r,n]of this.params){const s=Pn(r);for(const i of n)t.push(`${s}=${Pn(i)}`)}return t.join("&")}values(){const t=new Set;return this.forEach(r=>{t.add(r)}),t.values()}[Symbol.iterator](){return this.entries()}}var To=Object.defineProperty,pt=Object.getOwnPropertySymbols,jn=Object.prototype.hasOwnProperty,Ln=Object.prototype.propertyIsEnumerable,_n=(e,t,r)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nr=(e,t)=>{for(var r in t||(t={}))jn.call(t,r)&&_n(e,r,t[r]);if(pt)for(var r of pt(t))Ln.call(t,r)&&_n(e,r,t[r]);return e},Mn=(e,t)=>{var r={};for(var n in e)jn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&pt)for(var n of pt(e))t.indexOf(n)<0&&Ln.call(e,n)&&(r[n]=e[n]);return r};const sr=new dt("__request_cookie__"),Bn=(e,t={})=>{var r=t,{method:n="GET",headers:s,body:i,cookieScope:a=e,cookieStore:l=sr}=r,o=Mn(r,["method","headers","body","cookieScope","cookieStore"]);return new Promise((c,h)=>{const f=l.getHeader(a),d=new rr(s);f&&d.append("Cookie",f);const p=i instanceof ze?i.toString():i!=null?i:void 0;d.has("Content-Type")||(i instanceof ze?d.set("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"):i instanceof ArrayBuffer?d.set("Content-Type","application/octet-stream; charset=UTF-8"):Object.prototype.toString.call(i)==="[object Object]"&&d.set("Content-Type","application/json; charset=UTF-8")),Yt.debug(`Requesting ${e}:
3
3
  Cookie: ${f}
4
4
  Options:
@@ -9,5 +9,5 @@ Options:
9
9
  fieldset[disabled]:not(fieldset[disabled] legend:first-of-type *)
10
10
  )`,enabled:":not(:disabled)",checked:":is(:is(input[type=radio], input[type=checkbox])[checked], option:selected)",required:":is(input, select, textarea)[required]",optional:":is(input, select, textarea):not([required])",selected:"option:is([selected], select:not([multiple]):not(:has(> option[selected])) > :first-of-type)",checkbox:"[type=checkbox]",file:"[type=file]",password:"[type=password]",radio:"[type=radio]",reset:"[type=reset]",image:"[type=image]",submit:"[type=submit]",parent:":not(:empty)",header:":is(h1, h2, h3, h4, h5, h6)",button:":is(button, input[type=button])",input:":is(input, textarea, select, button)",text:"input:is(:not([type!='']), [type=text])"},Ts={};function Tc(e,t){return e===w.falseFunc?w.falseFunc:r=>t.isTag(r)&&e(r)}function Is(e,t){const r=t.getSiblings(e);if(r.length<=1)return[];const n=r.indexOf(e);return n<0||n===r.length-1?[]:r.slice(n+1).filter(t.isTag)}function Cr(e){return{xmlMode:!!e.xmlMode,lowerCaseAttributeNames:!!e.lowerCaseAttributeNames,lowerCaseTags:!!e.lowerCaseTags,quirksMode:!!e.quirksMode,cacheResults:!!e.cacheResults,pseudos:e.pseudos,adapter:e.adapter,equals:e.equals}}const Er=(e,t,r,n,s)=>{const i=s(t,Cr(r),n);return i===w.trueFunc?e:i===w.falseFunc?w.falseFunc:a=>i(a)&&e(a)},kr={is:Er,matches:Er,where:Er,not(e,t,r,n,s){const i=s(t,Cr(r),n);return i===w.falseFunc?e:i===w.trueFunc?w.falseFunc:a=>!i(a)&&e(a)},has(e,t,r,n,s){const{adapter:i}=r,a=Cr(r);a.relativeSelector=!0;const l=t.some(h=>h.some(Ar))?[Ts]:void 0,o=s(t,a,l);if(o===w.falseFunc)return w.falseFunc;const c=Tc(o,i);if(l&&o!==w.trueFunc){const{shouldTestNextSiblings:h=!1}=o;return f=>{if(!e(f))return!1;l[0]=f;const d=i.getChildren(f),p=h?[...d,...Is(f,i)]:d;return i.existsOne(c,p)}}return h=>e(h)&&i.existsOne(c,i.getChildren(h))}};function Ic(e,t,r,n,s){var i;const{name:a,data:l}=t;if(Array.isArray(l)){if(!(a in kr))throw new Error(`Unknown pseudo-class :${a}(${l})`);return kr[a](e,l,r,n,s)}const o=(i=r.pseudos)===null||i===void 0?void 0:i[a],c=typeof o=="string"?o:kc[a];if(typeof c=="string"){if(l!=null)throw new Error(`Pseudo ${a} doesn't have any arguments`);const h=Et(c);return kr.is(e,h,r,n,s)}if(typeof o=="function")return ks(o,a,l,1),h=>o(h,l)&&e(h);if(a in Sr)return Sr[a](e,l,r,n);if(a in Es){const h=Es[a];return ks(h,a,l,2),f=>h(f,r,l)&&e(f)}throw new Error(`Unknown pseudo-class :${a}`)}function Tr(e,t){const r=t.getParent(e);return r&&t.isTag(r)?r:null}function Nc(e,t,r,n,s){const{adapter:i,equals:a}=r;switch(t.type){case m.PseudoElement:throw new Error("Pseudo-elements are not supported by css-select");case m.ColumnCombinator:throw new Error("Column combinators are not yet supported by css-select");case m.Attribute:{if(t.namespace!=null)throw new Error("Namespaced attributes are not yet supported by css-select");return(!r.xmlMode||r.lowerCaseAttributeNames)&&(t.name=t.name.toLowerCase()),Ac[t.action](e,t,r)}case m.Pseudo:return Ic(e,t,r,n,s);case m.Tag:{if(t.namespace!=null)throw new Error("Namespaced tag names are not yet supported by css-select");let{name:l}=t;return(!r.xmlMode||r.lowerCaseTags)&&(l=l.toLowerCase()),function(o){return i.getName(o)===l&&e(o)}}case m.Descendant:{if(r.cacheResults===!1||typeof WeakSet=="undefined")return function(o){let c=o;for(;c=Tr(c,i);)if(e(c))return!0;return!1};const l=new WeakSet;return function(o){let c=o;for(;c=Tr(c,i);)if(!l.has(c)){if(i.isTag(c)&&e(c))return!0;l.add(c)}return!1}}case"_flexibleDescendant":return function(l){let o=l;do if(e(o))return!0;while(o=Tr(o,i));return!1};case m.Parent:return function(l){return i.getChildren(l).some(o=>i.isTag(o)&&e(o))};case m.Child:return function(l){const o=i.getParent(l);return o!=null&&i.isTag(o)&&e(o)};case m.Sibling:return function(l){const o=i.getSiblings(l);for(let c=0;c<o.length;c++){const h=o[c];if(a(l,h))break;if(i.isTag(h)&&e(h))return!0}return!1};case m.Adjacent:return i.prevElementSibling?function(l){const o=i.prevElementSibling(l);return o!=null&&e(o)}:function(l){const o=i.getSiblings(l);let c;for(let h=0;h<o.length;h++){const f=o[h];if(a(l,f))break;i.isTag(f)&&(c=f)}return!!c&&e(c)};case m.Universal:{if(t.namespace!=null&&t.namespace!=="*")throw new Error("Namespaced universal selectors are not yet supported by css-select");return e}}}function Ns(e){return e.type===m.Pseudo&&(e.name==="scope"||Array.isArray(e.data)&&e.data.some(t=>t.some(Ns)))}const qc={type:m.Descendant},Oc={type:"_flexibleDescendant"},Pc={type:m.Pseudo,name:"scope",data:null};function Dc(e,{adapter:t},r){const n=!!(r!=null&&r.every(s=>{const i=t.isTag(s)&&t.getParent(s);return s===Ts||i&&t.isTag(i)}));for(const s of e){if(!(s.length>0&&Ar(s[0])&&s[0].type!==m.Descendant))if(n&&!s.some(Ns))s.unshift(qc);else continue;s.unshift(Pc)}}function qs(e,t,r){var n;e.forEach(wc),r=(n=t.context)!==null&&n!==void 0?n:r;const s=Array.isArray(r),i=r&&(Array.isArray(r)?r:[r]);if(t.relativeSelector!==!1)Dc(e,t,i);else if(e.some(o=>o.length>0&&Ar(o[0])))throw new Error("Relative selectors are not allowed when the `relativeSelector` option is disabled");let a=!1;const l=e.map(o=>{if(o.length>=2){const[c,h]=o;c.type!==m.Pseudo||c.name!=="scope"||(s&&h.type===m.Descendant?o[1]=Oc:(h.type===m.Adjacent||h.type===m.Sibling)&&(a=!0))}return jc(o,t,i)}).reduce(Lc,w.falseFunc);return l.shouldTestNextSiblings=a,l}function jc(e,t,r){var n;return e.reduce((s,i)=>s===w.falseFunc?w.falseFunc:Nc(s,i,t,r,qs),(n=t.rootFunc)!==null&&n!==void 0?n:w.trueFunc)}function Lc(e,t){return t===w.falseFunc||e===w.trueFunc?e:e===w.falseFunc||t===w.trueFunc?t:function(r){return e(r)||t(r)}}const Os=(e,t)=>e===t,_c={adapter:St,equals:Os};function Mc(e){var t,r,n,s;const i=e!=null?e:_c;return(t=i.adapter)!==null&&t!==void 0||(i.adapter=St),(r=i.equals)!==null&&r!==void 0||(i.equals=(s=(n=i.adapter)===null||n===void 0?void 0:n.equals)!==null&&s!==void 0?s:Os),i}function Bc(e){return function(t,r,n){const s=Mc(r);return e(t,s,n)}}const Ir=Bc(qs);function Ps(e,t,r=!1){return r&&(e=Fc(e,t)),Array.isArray(e)?t.removeSubsets(e):t.getChildren(e)}function Fc(e,t){const r=Array.isArray(e)?e.slice(0):[e],n=r.length;for(let s=0;s<n;s++){const i=Is(r[s],t);r.push(...i)}return r}const Uc=new Set(["first","last","eq","gt","nth","lt","even","odd"]);function Nt(e){return e.type!=="pseudo"?!1:Uc.has(e.name)?!0:e.name==="not"&&Array.isArray(e.data)?e.data.some(t=>t.some(Nt)):!1}function Rc(e,t,r){const n=t!=null?parseInt(t,10):NaN;switch(e){case"first":return 1;case"nth":case"eq":return isFinite(n)?n>=0?n+1:1/0:0;case"lt":return isFinite(n)?n>=0?Math.min(n,r):1/0:0;case"gt":return isFinite(n)?1/0:0;case"odd":return 2*r;case"even":return 2*r-1;case"last":case"not":return 1/0}}function Vc(e){for(;e.parent;)e=e.parent;return e}function Nr(e){const t=[],r=[];for(const n of e)n.some(Nt)?t.push(n):r.push(n);return[r,t]}const Hc={type:m.Universal,namespace:null},Gc={type:m.Pseudo,name:"scope",data:null};function Ds(e,t,r={}){return js([e],t,r)}function js(e,t,r={}){if(typeof t=="function")return e.some(t);const[n,s]=Nr(Et(t));return n.length>0&&e.some(Ir(n,r))||s.some(i=>Ms(i,e,r).length>0)}function zc(e,t,r,n){const s=typeof r=="string"?parseInt(r,10):NaN;switch(e){case"first":case"lt":return t;case"last":return t.length>0?[t[t.length-1]]:t;case"nth":case"eq":return isFinite(s)&&Math.abs(s)<t.length?[s<0?t[t.length+s]:t[s]]:[];case"gt":return isFinite(s)?t.slice(s+1):[];case"even":return t.filter((i,a)=>a%2===0);case"odd":return t.filter((i,a)=>a%2===1);case"not":{const i=new Set(_s(r,t,n));return t.filter(a=>!i.has(a))}}}function Ls(e,t,r={}){return _s(Et(e),t,r)}function _s(e,t,r){if(t.length===0)return[];const[n,s]=Nr(e);let i;if(n.length){const a=Or(t,n,r);if(s.length===0)return a;a.length&&(i=new Set(a))}for(let a=0;a<s.length&&(i==null?void 0:i.size)!==t.length;a++){const l=s[a];if((i?t.filter(c=>y(c)&&!i.has(c)):t).length===0)break;const o=Ms(l,t,r);if(o.length)if(i)o.forEach(c=>i.add(c));else{if(a===s.length-1)return o;i=new Set(o)}}return typeof i!="undefined"?i.size===t.length?t:t.filter(a=>i.has(a)):[]}function Ms(e,t,r){var n;if(e.some(Ue)){const s=(n=r.root)!==null&&n!==void 0?n:Vc(t[0]),i=ye(j({},r),{context:t,relativeSelector:!1});return e.push(Gc),qt(s,e,i,!0,t.length)}return qt(t,e,r,!1,t.length)}function Wc(e,t,r={},n=1/0){if(typeof e=="function")return Bs(t,e);const[s,i]=Nr(Et(e)),a=i.map(l=>qt(t,l,r,!0,n));return s.length&&a.push(qr(t,s,r,n)),a.length===0?[]:a.length===1?a[0]:ve(a.reduce((l,o)=>[...l,...o]))}function qt(e,t,r,n,s){const i=t.findIndex(Nt),a=t.slice(0,i),l=t[i],o=t.length-1===i?s:1/0,c=Rc(l.name,l.data,o);if(c===0)return[];const h=(a.length===0&&!Array.isArray(e)?xt(e).filter(y):a.length===0?(Array.isArray(e)?e:[e]).filter(y):n||a.some(Ue)?qr(e,[a],r,c):Or(e,[a],r)).slice(0,c);let f=zc(l.name,h,l.data,r);if(f.length===0||t.length===i+1)return f;const d=t.slice(i+1),p=d.some(Ue);if(p){if(Ue(d[0])){const{type:g}=d[0];(g===m.Sibling||g===m.Adjacent)&&(f=Ps(f,St,!0)),d.unshift(Hc)}r=ye(j({},r),{relativeSelector:!1,rootFunc:g=>f.includes(g)})}else r.rootFunc&&r.rootFunc!==kt.trueFunc&&(r=ye(j({},r),{rootFunc:kt.trueFunc}));return d.some(Nt)?qt(f,d,r,!1,s):p?qr(f,[d],r,s):Or(f,[d],r)}function qr(e,t,r,n){const s=Ir(t,r,e);return Bs(e,s,n)}function Bs(e,t,r=1/0){const n=Ps(e,St,t.shouldTestNextSiblings);return pr(s=>y(s)&&t(s),n,!0,r)}function Or(e,t,r){const n=(Array.isArray(e)?e:[e]).filter(y);if(n.length===0)return n;const s=Ir(t,r);return s===kt.trueFunc?n:n.filter(s)}const Qc=/^\s*[+~]/;function Zc(e){if(!e)return this._make([]);if(typeof e!="string"){const t=Z(e)?e.toArray():[e],r=this.toArray();return this._make(t.filter(n=>r.some(s=>ls(s,n))))}return this._findBySelector(e,Number.POSITIVE_INFINITY)}function Jc(e,t){var r;const n=this.toArray(),s=Qc.test(e)?n:this.children().toArray(),i={context:n,root:(r=this._root)===null||r===void 0?void 0:r[0],xmlMode:this.options.xmlMode,lowerCaseTags:this.options.lowerCaseTags,lowerCaseAttributeNames:this.options.lowerCaseAttributeNames,pseudos:this.options.pseudos,quirksMode:this.options.quirksMode};return this._make(Wc(e,s,i,t))}function Pr(e){return function(t,...r){return function(n){var s;let i=e(t,this);return n&&(i=Lr(i,n,this.options.xmlMode,(s=this._root)===null||s===void 0?void 0:s[0])),this._make(this.length>1&&i.length>1?r.reduce((a,l)=>l(a),i):i)}}}const Ve=Pr((e,t)=>{let r=[];for(let n=0;n<t.length;n++){const s=e(t[n]);s.length>0&&(r=r.concat(s))}return r}),Dr=Pr((e,t)=>{const r=[];for(let n=0;n<t.length;n++){const s=e(t[n]);s!==null&&r.push(s)}return r});function jr(e,...t){let r=null;const n=Pr((s,i)=>{const a=[];return $(i,l=>{for(let o;(o=s(l))&&!(r!=null&&r(o,a.length));l=o)a.push(o)}),a})(e,...t);return function(s,i){r=typeof s=="string"?l=>Ds(l,s,this.options):s?He(s):null;const a=n.call(this,i);return r=null,a}}function Se(e){return e.length>1?Array.from(new Set(e)):e}const Yc=Dr(({parent:e})=>e&&!oe(e)?e:null,Se),Xc=Ve(e=>{const t=[];for(;e.parent&&!oe(e.parent);)t.push(e.parent),e=e.parent;return t},ve,e=>e.reverse()),Kc=jr(({parent:e})=>e&&!oe(e)?e:null,ve,e=>e.reverse());function eh(e){var t;const r=[];if(!e)return this._make(r);const n={xmlMode:this.options.xmlMode,root:(t=this._root)===null||t===void 0?void 0:t[0]},s=typeof e=="string"?i=>Ds(i,e,n):He(e);return $(this,i=>{for(i&&!oe(i)&&!y(i)&&(i=i.parent);i&&y(i);){if(s(i,0)){r.includes(i)||r.push(i);break}i=i.parent}}),this._make(r)}const th=Dr(e=>fr(e)),rh=Ve(e=>{const t=[];for(;e.next;)e=e.next,y(e)&&t.push(e);return t},Se),nh=jr(e=>fr(e),Se),sh=Dr(e=>dr(e)),ih=Ve(e=>{const t=[];for(;e.prev;)e=e.prev,y(e)&&t.push(e);return t},Se),ah=jr(e=>dr(e),Se),oh=Ve(e=>rs(e).filter(t=>y(t)&&t!==e),ve),lh=Ve(e=>xt(e).filter(y),Se);function ch(){const e=this.toArray().reduce((t,r)=>C(r)?t.concat(r.children):t,[]);return this._make(e)}function hh(e){let t=0;const r=this.length;for(;t<r&&e.call(this[t],t,this[t])!==!1;)++t;return this}function uh(e){let t=[];for(let r=0;r<this.length;r++){const n=this[r],s=e.call(n,r,n);s!=null&&(t=t.concat(s))}return this._make(t)}function He(e){return typeof e=="function"?(t,r)=>e.call(t,r,t):Z(e)?t=>Array.prototype.includes.call(e,t):function(t){return e===t}}function fh(e){var t;return this._make(Lr(this.toArray(),e,this.options.xmlMode,(t=this._root)===null||t===void 0?void 0:t[0]))}function Lr(e,t,r,n){return typeof t=="string"?Ls(t,e,{xmlMode:r,root:n}):e.filter(He(t))}function dh(e){const t=this.toArray();return typeof e=="string"?js(t.filter(y),e,this.options):e?t.some(He(e)):!1}function ph(e){let t=this.toArray();if(typeof e=="string"){const r=new Set(Ls(e,t,this.options));t=t.filter(n=>!r.has(n))}else{const r=He(e);t=t.filter((n,s)=>!r(n,s))}return this._make(t)}function gh(e){return this.filter(typeof e=="string"?`:has(${e})`:(t,r)=>this._make(r).find(e).length>0)}function mh(){return this.length>1?this._make(this[0]):this}function bh(){return this.length>0?this._make(this[this.length-1]):this}function yh(e){var t;return e=+e,e===0&&this.length<=1?this:(e<0&&(e=this.length+e),this._make((t=this[e])!==null&&t!==void 0?t:[]))}function wh(e){return e==null?this.toArray():this[e<0?this.length+e:e]}function xh(){return Array.prototype.slice.call(this)}function vh(e){let t,r;return e==null?(t=this.parent().children(),r=this[0]):typeof e=="string"?(t=this._make(e),r=this[0]):(t=this,r=Z(e)?e[0]:e),Array.prototype.indexOf.call(t,r)}function Ah(e,t){return this._make(Array.prototype.slice.call(this,e,t))}function Sh(){var e;return(e=this.prevObject)!==null&&e!==void 0?e:this._make([])}function $h(e,t){const r=this._make(e,t),n=ve([...this.get(),...r.get()]);return this._make(n)}function Ch(e){return this.prevObject?this.add(e?this.prevObject.filter(e):this.prevObject):this}var Eh=Object.freeze({__proto__:null,_findBySelector:Jc,add:$h,addBack:Ch,children:lh,closest:eh,contents:ch,each:hh,end:Sh,eq:yh,filter:fh,filterArray:Lr,find:Zc,first:mh,get:wh,has:gh,index:vh,is:dh,last:bh,map:uh,next:th,nextAll:rh,nextUntil:nh,not:ph,parent:Yc,parents:Xc,parentsUntil:Kc,prev:sh,prevAll:ih,prevUntil:ah,siblings:oh,slice:Ah,toArray:xh});function kh(e){return function(t,r,n,s){if(typeof Buffer!="undefined"&&Buffer.isBuffer(t)&&(t=t.toString()),typeof t=="string")return e(t,r,n,s);const i=t;if(!Array.isArray(i)&&oe(i))return i;const a=new je([]);return ue(i,a),a}}function ue(e,t){const r=Array.isArray(e)?e:[e];t?t.children=r:t=null;for(let n=0;n<r.length;n++){const s=r[n];s.parent&&s.parent.children!==r&&le(s),t?(s.prev=r[n-1]||null,s.next=r[n+1]||null):s.prev=s.next=null,s.parent=t}return t}function Th(e,t){if(e==null)return[];if(typeof e=="string")return this._parse(e,this.options,!1,null).children.slice(0);if("length"in e){if(e.length===1)return this._makeDomArray(e[0],t);const r=[];for(let n=0;n<e.length;n++){const s=e[n];if(typeof s=="object"){if(s==null)continue;if(!("length"in s)){r.push(t?Le(s,!0):s);continue}}r.push(...this._makeDomArray(s,t))}return r}return[t?Le(e,!0):e]}function Fs(e){return function(...t){const r=this.length-1;return $(this,(n,s)=>{if(!C(n))return;const i=typeof t[0]=="function"?t[0].call(n,s,this._render(n.children)):t,a=this._makeDomArray(i,s<r);e(a,n.children,n)})}}function te(e,t,r,n,s){var i,a;const l=[t,r,...n],o=t===0?null:e[t-1],c=t+r>=e.length?null:e[t+r];for(let h=0;h<n.length;++h){const f=n[h],d=f.parent;if(d){const p=d.children.indexOf(f);p>-1&&(d.children.splice(p,1),s===d&&t>p&&l[0]--)}f.parent=s,f.prev&&(f.prev.next=(i=f.next)!==null&&i!==void 0?i:null),f.next&&(f.next.prev=(a=f.prev)!==null&&a!==void 0?a:null),f.prev=h===0?o:n[h-1],f.next=h===n.length-1?c:n[h+1]}return o&&(o.next=n[0]),c&&(c.prev=n[n.length-1]),e.splice(...l)}function Ih(e){return(Z(e)?e:this._make(e)).append(this),this}function Nh(e){return(Z(e)?e:this._make(e)).prepend(this),this}const qh=Fs((e,t,r)=>{te(t,t.length,0,e,r)}),Oh=Fs((e,t,r)=>{te(t,0,0,e,r)});function Us(e){return function(t){const r=this.length-1,n=this.parents().last();for(let s=0;s<this.length;s++){const i=this[s],a=typeof t=="function"?t.call(i,s,i):typeof t=="string"&&!br(t)?n.find(t).clone():t,[l]=this._makeDomArray(a,s<r);if(!l||!C(l))continue;let o=l,c=0;for(;c<o.children.length;){const h=o.children[c];y(h)?(o=h,c=0):c++}e(i,o,[l])}return this}}const Ph=Us((e,t,r)=>{const{parent:n}=e;if(!n)return;const s=n.children,i=s.indexOf(e);ue([e],t),te(s,i,0,r,n)}),Dh=Us((e,t,r)=>{C(e)&&(ue(e.children,t),ue(r,e))});function jh(e){return this.parent(e).not("body").each((t,r)=>{this._make(r).replaceWith(r.children)}),this}function Lh(e){const t=this[0];if(t){const r=this._make(typeof e=="function"?e.call(t,0,t):e).insertBefore(t);let n;for(let i=0;i<r.length;i++)r[i].type==="tag"&&(n=r[i]);let s=0;for(;n&&s<n.children.length;){const i=n.children[s];i.type==="tag"?(n=i,s=0):s++}n&&this._make(n).append(this)}return this}function _h(...e){const t=this.length-1;return $(this,(r,n)=>{if(!C(r)||!r.parent)return;const s=r.parent.children,i=s.indexOf(r);if(i<0)return;const a=typeof e[0]=="function"?e[0].call(r,n,this._render(r.children)):e,l=this._makeDomArray(a,n<t);te(s,i+1,0,l,r.parent)})}function Mh(e){typeof e=="string"&&(e=this._make(e)),this.remove();const t=[];for(const r of this._makeDomArray(e)){const n=this.clone().toArray(),{parent:s}=r;if(!s)continue;const i=s.children,a=i.indexOf(r);a<0||(te(i,a+1,0,n,s),t.push(...n))}return this._make(t)}function Bh(...e){const t=this.length-1;return $(this,(r,n)=>{if(!C(r)||!r.parent)return;const s=r.parent.children,i=s.indexOf(r);if(i<0)return;const a=typeof e[0]=="function"?e[0].call(r,n,this._render(r.children)):e,l=this._makeDomArray(a,n<t);te(s,i,0,l,r.parent)})}function Fh(e){const t=this._make(e);this.remove();const r=[];return $(t,n=>{const s=this.clone().toArray(),{parent:i}=n;if(!i)return;const a=i.children,l=a.indexOf(n);l<0||(te(a,l,0,s,i),r.push(...s))}),this._make(r)}function Uh(e){const t=e?this.filter(e):this;return $(t,r=>{le(r),r.prev=r.next=r.parent=null}),this}function Rh(e){return $(this,(t,r)=>{const{parent:n}=t;if(!n)return;const s=n.children,i=typeof e=="function"?e.call(t,r,t):e,a=this._makeDomArray(i);ue(a,null);const l=s.indexOf(t);te(s,l,1,a,n),a.includes(t)||(t.parent=t.prev=t.next=null)})}function Vh(){return $(this,e=>{if(C(e)){for(const t of e.children)t.next=t.prev=t.parent=null;e.children.length=0}})}function Hh(e){if(e===void 0){const t=this[0];return!t||!C(t)?null:this._render(t.children)}return $(this,t=>{if(!C(t))return;for(const n of t.children)n.next=n.prev=n.parent=null;const r=Z(e)?e.toArray():this._parse(`${e}`,this.options,!1,t).children;ue(r,t)})}function Gh(){return this._render(this)}function zh(e){return e===void 0?Me(this):typeof e=="function"?$(this,(t,r)=>this._make(t).text(e.call(t,r,Me([t])))):$(this,t=>{if(!C(t))return;for(const n of t.children)n.next=n.prev=n.parent=null;const r=new gt(`${e}`);ue(r,t)})}function Wh(){const e=Array.prototype.map.call(this.get(),r=>Le(r,!0)),t=new je(e);for(const r of e)r.parent=t;return this._make(e)}var Qh=Object.freeze({__proto__:null,_makeDomArray:Th,after:_h,append:qh,appendTo:Ih,before:Bh,clone:Wh,empty:Vh,html:Hh,insertAfter:Mh,insertBefore:Fh,prepend:Oh,prependTo:Nh,remove:Uh,replaceWith:Rh,text:zh,toString:Gh,unwrap:jh,wrap:Ph,wrapAll:Lh,wrapInner:Dh});function Zh(e,t){if(e!=null&&t!=null||typeof e=="object"&&!Array.isArray(e))return $(this,(r,n)=>{y(r)&&Rs(r,e,t,n)});if(this.length!==0)return Vs(this[0],e)}function Rs(e,t,r,n){if(typeof t=="string"){const s=Vs(e),i=typeof r=="function"?r.call(e,n,s[t]):r;i===""?delete s[t]:i!=null&&(s[t]=i),e.attribs.style=Jh(s)}else if(typeof t=="object"){const s=Object.keys(t);for(let i=0;i<s.length;i++){const a=s[i];Rs(e,a,t[a],i)}}}function Vs(e,t){if(!e||!y(e))return;const r=Yh(e.attribs.style);if(typeof t=="string")return r[t];if(Array.isArray(t)){const n={};for(const s of t)r[s]!=null&&(n[s]=r[s]);return n}return r}function Jh(e){return Object.keys(e).reduce((t,r)=>`${t}${t?" ":""}${r}: ${e[r]};`,"")}function Yh(e){if(e=(e||"").trim(),!e)return{};const t={};let r;for(const n of e.split(";")){const s=n.indexOf(":");if(s<1||s===n.length-1){const i=n.trimEnd();i.length>0&&r!==void 0&&(t[r]+=`;${i}`)}else r=n.slice(0,s).trim(),t[r]=n.slice(s+1).trim()}return t}var Xh=Object.freeze({__proto__:null,css:Zh});const Hs="input,select,textarea,keygen",Kh=/%20/g,Gs=/\r?\n/g;function eu(){return this.serializeArray().map(e=>`${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("&").replace(Kh,"+")}function tu(){return this.map((e,t)=>{const r=this._make(t);return y(t)&&t.name==="form"?r.find(Hs).toArray():r.filter(Hs).toArray()}).filter('[name!=""]:enabled:not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))').map((e,t)=>{var r;const n=this._make(t),s=n.attr("name"),i=(r=n.val())!==null&&r!==void 0?r:"";return Array.isArray(i)?i.map(a=>({name:s,value:a.replace(Gs,`\r
11
11
  `)})):{name:s,value:i.replace(Gs,`\r
12
- `)}}).toArray()}var ru=Object.freeze({__proto__:null,serialize:eu,serializeArray:tu});function nu(e){var t;return typeof e=="string"?{selector:e,value:"textContent"}:{selector:e.selector,value:(t=e.value)!==null&&t!==void 0?t:"textContent"}}function su(e){const t={};for(const r in e){const n=e[r],s=Array.isArray(n),{selector:i,value:a}=nu(s?n[0]:n),l=typeof a=="function"?a:typeof a=="string"?o=>this._make(o).prop(a):o=>this._make(o).extract(a);if(s)t[r]=this._findBySelector(i,Number.POSITIVE_INFINITY).map((o,c)=>l(c,r,t)).get();else{const o=this._findBySelector(i,1);t[r]=o.length>0?l(o[0],r,t):void 0}}return t}var iu=Object.freeze({__proto__:null,extract:su});class Ge{constructor(t,r,n){if(this.length=0,this.options=n,this._root=r,t){for(let s=0;s<t.length;s++)this[s]=t[s];this.length=t.length}}}Ge.prototype.cheerio="[cheerio object]",Ge.prototype.splice=Array.prototype.splice,Ge.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(Ge.prototype,hc,Eh,Qh,Xh,ru,iu);function au(e,t){return function r(n,s,i=!0){if(n==null)throw new Error("cheerio.load() expects a string");const a=ir(s),l=e(n,a,i,null);class o extends Ge{_make(f,d){const p=c(f,d);return p.prevObject=this,p}_parse(f,d,p,g){return e(f,d,p,g)}_render(f){return t(f,this.options)}}function c(h,f,d=l,p){if(h&&Z(h))return h;const g=ir(p,a),v=typeof d=="string"?[e(d,g,!1,null)]:"length"in d?d:[d],A=Z(v)?v:new o(v,null,g);if(A._root=A,!h)return new o(void 0,A,g);const _=typeof h=="string"&&br(h)?e(h,g,!1,null).children:ou(h)?[h]:Array.isArray(h)?h:void 0,fe=new o(_,A,g);if(_)return fe;if(typeof h!="string")throw new TypeError("Unexpected type of selector");let Ce=h;const Ee=f?typeof f=="string"?br(f)?new o([e(f,g,!1,null)],A,g):(Ce=`${f} ${Ce}`,A):Z(f)?f:new o(Array.isArray(f)?f:[f],A,g):A;return Ee?Ee.find(Ce):fe}return Object.assign(c,Xl,{load:r,_root:l,_options:a,fn:o.prototype,prototype:o.prototype}),c}}function ou(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}var b;(function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"})(b||(b={}));var u;(function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.BeforeSpecialT=23]="BeforeSpecialT",e[e.SpecialStartSequence=24]="SpecialStartSequence",e[e.InSpecialTag=25]="InSpecialTag",e[e.InEntity=26]="InEntity"})(u||(u={}));function J(e){return e===b.Space||e===b.NewLine||e===b.Tab||e===b.FormFeed||e===b.CarriageReturn}function Ot(e){return e===b.Slash||e===b.Gt||J(e)}function lu(e){return e>=b.LowerA&&e<=b.LowerZ||e>=b.UpperA&&e<=b.UpperZ}var G;(function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"})(G||(G={}));const N={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class cu{constructor({xmlMode:t=!1,decodeEntities:r=!0},n){this.cbs=n,this.state=u.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=u.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=r,this.entityDecoder=new rl(t?Zo:Qo,(s,i)=>this.emitCodePoint(s,i))}reset(){this.state=u.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=u.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===b.Lt||!this.decodeEntities&&this.fastForwardTo(b.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=u.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===b.Amp&&this.startEntity()}stateSpecialStartSequence(t){const r=this.sequenceIndex===this.currentSequence.length;if(!(r?Ot(t):(t|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!r){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=u.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===b.Gt||J(t)){const r=this.index-this.currentSequence.length;if(this.sectionStart<r){const n=this.index;this.index=r,this.cbs.ontext(this.sectionStart,r),this.index=n}this.isSpecial=!1,this.sectionStart=r+2,this.stateInClosingTagName(t);return}this.sequenceIndex=0}(t|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===N.TitleEnd?this.decodeEntities&&t===b.Amp&&this.startEntity():this.fastForwardTo(b.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(t===b.Lt)}stateCDATASequence(t){t===N.Cdata[this.sequenceIndex]?++this.sequenceIndex===N.Cdata.length&&(this.state=u.InCommentLike,this.currentSequence=N.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=u.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===N.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=u.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!Ot(t):lu(t)}startSpecial(t,r){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=r,this.state=u.SpecialStartSequence}stateBeforeTagName(t){if(t===b.ExclamationMark)this.state=u.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===b.Questionmark)this.state=u.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const r=t|32;this.sectionStart=this.index,this.xmlMode?this.state=u.InTagName:r===N.ScriptEnd[2]?this.state=u.BeforeSpecialS:r===N.TitleEnd[2]?this.state=u.BeforeSpecialT:this.state=u.InTagName}else t===b.Slash?this.state=u.BeforeClosingTagName:(this.state=u.Text,this.stateText(t))}stateInTagName(t){Ot(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){J(t)||(t===b.Gt?this.state=u.Text:(this.state=this.isTagStartChar(t)?u.InClosingTagName:u.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===b.Gt||J(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=u.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.state=u.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===b.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=u.InSpecialTag,this.sequenceIndex=0):this.state=u.Text,this.sectionStart=this.index+1):t===b.Slash?this.state=u.InSelfClosingTag:J(t)||(this.state=u.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===b.Gt?(this.cbs.onselfclosingtag(this.index),this.state=u.Text,this.sectionStart=this.index+1,this.isSpecial=!1):J(t)||(this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===b.Eq||Ot(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=u.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===b.Eq?this.state=u.BeforeAttributeValue:t===b.Slash||t===b.Gt?(this.cbs.onattribend(G.NoValue,this.sectionStart),this.sectionStart=-1,this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t)):J(t)||(this.cbs.onattribend(G.NoValue,this.sectionStart),this.state=u.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===b.DoubleQuote?(this.state=u.InAttributeValueDq,this.sectionStart=this.index+1):t===b.SingleQuote?(this.state=u.InAttributeValueSq,this.sectionStart=this.index+1):J(t)||(this.sectionStart=this.index,this.state=u.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,r){t===r||!this.decodeEntities&&this.fastForwardTo(r)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(r===b.DoubleQuote?G.Double:G.Single,this.index+1),this.state=u.BeforeAttributeName):this.decodeEntities&&t===b.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,b.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,b.SingleQuote)}stateInAttributeValueNoQuotes(t){J(t)||t===b.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(G.Unquoted,this.index),this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===b.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===b.OpeningSquareBracket?(this.state=u.CDATASequence,this.sequenceIndex=0):this.state=t===b.Dash?u.BeforeComment:u.InDeclaration}stateInDeclaration(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=u.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=u.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===b.Dash?(this.state=u.InCommentLike,this.currentSequence=N.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=u.InDeclaration}stateInSpecialComment(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=u.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const r=t|32;r===N.ScriptEnd[3]?this.startSpecial(N.ScriptEnd,4):r===N.StyleEnd[3]?this.startSpecial(N.StyleEnd,4):(this.state=u.InTagName,this.stateInTagName(t))}stateBeforeSpecialT(t){const r=t|32;r===N.TitleEnd[3]?this.startSpecial(N.TitleEnd,4):r===N.TextareaEnd[3]?this.startSpecial(N.TextareaEnd,4):(this.state=u.InTagName,this.stateInTagName(t))}startEntity(){this.baseState=this.state,this.state=u.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?H.Strict:this.baseState===u.Text||this.baseState===u.InSpecialTag?H.Legacy:H.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,t===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===u.Text||this.state===u.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===u.InAttributeValueDq||this.state===u.InAttributeValueSq||this.state===u.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case u.Text:{this.stateText(t);break}case u.SpecialStartSequence:{this.stateSpecialStartSequence(t);break}case u.InSpecialTag:{this.stateInSpecialTag(t);break}case u.CDATASequence:{this.stateCDATASequence(t);break}case u.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(t);break}case u.InAttributeName:{this.stateInAttributeName(t);break}case u.InCommentLike:{this.stateInCommentLike(t);break}case u.InSpecialComment:{this.stateInSpecialComment(t);break}case u.BeforeAttributeName:{this.stateBeforeAttributeName(t);break}case u.InTagName:{this.stateInTagName(t);break}case u.InClosingTagName:{this.stateInClosingTagName(t);break}case u.BeforeTagName:{this.stateBeforeTagName(t);break}case u.AfterAttributeName:{this.stateAfterAttributeName(t);break}case u.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(t);break}case u.BeforeAttributeValue:{this.stateBeforeAttributeValue(t);break}case u.BeforeClosingTagName:{this.stateBeforeClosingTagName(t);break}case u.AfterClosingTagName:{this.stateAfterClosingTagName(t);break}case u.BeforeSpecialS:{this.stateBeforeSpecialS(t);break}case u.BeforeSpecialT:{this.stateBeforeSpecialT(t);break}case u.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(t);break}case u.InSelfClosingTag:{this.stateInSelfClosingTag(t);break}case u.InDeclaration:{this.stateInDeclaration(t);break}case u.BeforeDeclaration:{this.stateBeforeDeclaration(t);break}case u.BeforeComment:{this.stateBeforeComment(t);break}case u.InProcessingInstruction:{this.stateInProcessingInstruction(t);break}case u.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===u.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===u.InCommentLike?this.currentSequence===N.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===u.InTagName||this.state===u.BeforeAttributeName||this.state===u.BeforeAttributeValue||this.state===u.AfterAttributeName||this.state===u.InAttributeName||this.state===u.InAttributeValueSq||this.state===u.InAttributeValueDq||this.state===u.InAttributeValueNq||this.state===u.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,r){this.baseState!==u.Text&&this.baseState!==u.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+r,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+r,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const $e=new Set(["input","option","optgroup","select","button","datalist","textarea"]),S=new Set(["p"]),zs=new Set(["thead","tbody"]),Ws=new Set(["dd","dt"]),Qs=new Set(["rt","rp"]),hu=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",S],["h1",S],["h2",S],["h3",S],["h4",S],["h5",S],["h6",S],["select",$e],["input",$e],["output",$e],["button",$e],["datalist",$e],["textarea",$e],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",Ws],["dt",Ws],["address",S],["article",S],["aside",S],["blockquote",S],["details",S],["div",S],["dl",S],["fieldset",S],["figcaption",S],["figure",S],["footer",S],["form",S],["header",S],["hr",S],["main",S],["nav",S],["ol",S],["pre",S],["section",S],["table",S],["ul",S],["rt",Qs],["rp",Qs],["tbody",zs],["tfoot",zs]]),uu=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Zs=new Set(["math","svg"]),Js=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),fu=/\s|\//;class du{constructor(t,r={}){var n,s,i,a,l,o;this.options=r,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t!=null?t:{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(n=r.lowerCaseTags)!==null&&n!==void 0?n:this.htmlMode,this.lowerCaseAttributeNames=(s=r.lowerCaseAttributeNames)!==null&&s!==void 0?s:this.htmlMode,this.recognizeSelfClosing=(i=r.recognizeSelfClosing)!==null&&i!==void 0?i:!this.htmlMode,this.tokenizer=new((a=r.Tokenizer)!==null&&a!==void 0?a:cu)(this.options,this),this.foreignContext=[!this.htmlMode],(o=(l=this.cbs).onparserinit)===null||o===void 0||o.call(l,this)}ontext(t,r){var n,s;const i=this.getSlice(t,r);this.endIndex=r-1,(s=(n=this.cbs).ontext)===null||s===void 0||s.call(n,i),this.startIndex=r}ontextentity(t,r){var n,s;this.endIndex=r-1,(s=(n=this.cbs).ontext)===null||s===void 0||s.call(n,Zn(t)),this.startIndex=r}isVoidElement(t){return this.htmlMode&&uu.has(t)}onopentagname(t,r){this.endIndex=r;let n=this.getSlice(t,r);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(t){var r,n,s,i;this.openTagStart=this.startIndex,this.tagname=t;const a=this.htmlMode&&hu.get(t);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){const l=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,l,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(Zs.has(t)?this.foreignContext.unshift(!0):Js.has(t)&&this.foreignContext.unshift(!1))),(i=(s=this.cbs).onopentagname)===null||i===void 0||i.call(s,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var r,n;this.startIndex=this.openTagStart,this.attribs&&((n=(r=this.cbs).onopentag)===null||n===void 0||n.call(r,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,r){var n,s,i,a,l,o,c,h;this.endIndex=r;let f=this.getSlice(t,r);if(this.lowerCaseTagNames&&(f=f.toLowerCase()),this.htmlMode&&(Zs.has(f)||Js.has(f))&&this.foreignContext.shift(),this.isVoidElement(f))this.htmlMode&&f==="br"&&((a=(i=this.cbs).onopentagname)===null||a===void 0||a.call(i,"br"),(o=(l=this.cbs).onopentag)===null||o===void 0||o.call(l,"br",{},!0),(h=(c=this.cbs).onclosetag)===null||h===void 0||h.call(c,"br",!1));else{const d=this.stack.indexOf(f);if(d!==-1)for(let p=0;p<=d;p++){const g=this.stack.shift();(s=(n=this.cbs).onclosetag)===null||s===void 0||s.call(n,g,p!==d)}else this.htmlMode&&f==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=r+1}onselfclosingtag(t){this.endIndex=t,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var r,n;const s=this.tagname;this.endOpenTag(t),this.stack[0]===s&&((n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,s,!t),this.stack.shift())}onattribname(t,r){this.startIndex=t;const n=this.getSlice(t,r);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(t,r){this.attribvalue+=this.getSlice(t,r)}onattribentity(t){this.attribvalue+=Zn(t)}onattribend(t,r){var n,s;this.endIndex=r,(s=(n=this.cbs).onattribute)===null||s===void 0||s.call(n,this.attribname,this.attribvalue,t===G.Double?'"':t===G.Single?"'":t===G.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const r=t.search(fu);let n=r<0?t:t.substr(0,r);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(t,r){this.endIndex=r;const n=this.getSlice(t,r);if(this.cbs.onprocessinginstruction){const s=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${s}`,`!${n}`)}this.startIndex=r+1}onprocessinginstruction(t,r){this.endIndex=r;const n=this.getSlice(t,r);if(this.cbs.onprocessinginstruction){const s=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${s}`,`?${n}`)}this.startIndex=r+1}oncomment(t,r,n){var s,i,a,l;this.endIndex=r,(i=(s=this.cbs).oncomment)===null||i===void 0||i.call(s,this.getSlice(t,r-n)),(l=(a=this.cbs).oncommentend)===null||l===void 0||l.call(a),this.startIndex=r+1}oncdata(t,r,n){var s,i,a,l,o,c,h,f,d,p;this.endIndex=r;const g=this.getSlice(t,r-n);!this.htmlMode||this.options.recognizeCDATA?((i=(s=this.cbs).oncdatastart)===null||i===void 0||i.call(s),(l=(a=this.cbs).ontext)===null||l===void 0||l.call(a,g),(c=(o=this.cbs).oncdataend)===null||c===void 0||c.call(o)):((f=(h=this.cbs).oncomment)===null||f===void 0||f.call(h,`[CDATA[${g}]]`),(p=(d=this.cbs).oncommentend)===null||p===void 0||p.call(d)),this.startIndex=r+1}onend(){var t,r;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let n=0;n<this.stack.length;n++)this.cbs.onclosetag(this.stack[n],!0)}(r=(t=this.cbs).onend)===null||r===void 0||r.call(t)}reset(){var t,r,n,s;(r=(t=this.cbs).onreset)===null||r===void 0||r.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(s=(n=this.cbs).onparserinit)===null||s===void 0||s.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,r){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(t-this.bufferOffset,r-this.bufferOffset);for(;r-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,r-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var r,n;if(this.ended){(n=(r=this.cbs).onerror)===null||n===void 0||n.call(r,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var r,n;if(this.ended){(n=(r=this.cbs).onerror)===null||n===void 0||n.call(r,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}function pu(e,t){const r=new Wo(void 0,t);return new du(r,t).end(e),r.root}const gu=au(kh(pu),bt),mu=gu(""),_r=e=>{var t;return(t=mu.parseHTML(e))!=null?t:[]};var bu=Object.defineProperty,Ys=Object.getOwnPropertySymbols,yu=Object.prototype.hasOwnProperty,wu=Object.prototype.propertyIsEnumerable,Xs=(e,t,r)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ks=(e,t)=>{for(var r in t||(t={}))yu.call(t,r)&&Xs(e,r,t[r]);if(Ys)for(var r of Ys(t))wu.call(t,r)&&Xs(e,r,t[r]);return e},ei=(e,t,r)=>new Promise((n,s)=>{var i=o=>{try{l(r.next(o))}catch(c){s(c)}},a=o=>{try{l(r.throw(o))}catch(c){s(c)}},l=o=>o.done?n(o.value):Promise.resolve(o.value).then(i,a);l((r=r.apply(e,t)).next())});const ti=e=>{const t=e.filter(s=>!!s),r=t[0];r&&r.type==="text"&&!r.text.trim()&&t.shift();const n=t[t.length-1];return n&&n.type==="text"&&!n.text.trim()&&t.pop(),t},ri=(e,t)=>ei(void 0,[e,t],function*(r,{appendClass:n,transform:s}){if(r.type==="text")return{type:"text",text:r.data.replace(/\r/g,"")};if(r.type==="tag"){const i=Rn.find(([a])=>r.name===a);if(i){const a=Object.fromEntries(r.attributes.filter(({name:h})=>{var f;return["class","style"].includes(h)||((f=i[1])==null?void 0:f.includes(h))}).map(({name:h,value:f})=>[h,f])),l=ti(yield Promise.all(r.children.map(h=>ri(h,{appendClass:n,transform:s}))));n&&(a.class=a.class?`${a.class} ${r.name}`:r.name);const o=Ks(Ks({type:"node",name:r.name},Object.keys(a).length?{attrs:a}:{}),l.length?{children:l}:{}),c=s[r.name];return yield c?c(o):o}}return null}),xu=(e,...t)=>ei(void 0,[e,...t],function*(r,{appendClass:n=!0,transform:s={}}={}){return ti(yield Promise.all((Array.isArray(r)?r:_r(r)).map(i=>ri(i,{appendClass:n,transform:s}))))}),ni=e=>(typeof e=="string"?_r(e):e).map(t=>t.type==="text"?t.data:"childNodes"in t?ni(t.childNodes):"").join("");export{Xi as $App,xa as $Component,ia as $Config,va as $Page,Rn as ALLOWED_TAGS,ut as Cookie,dt as CookieStore,Xe as Emitter,rr as Headers,Li as MpError,Jr as Queue,ze as URLSearchParams,Si as addContact,Za as check,Ja as checkAsync,$i as compareVersion,gi as confirm,Io as createRequest,qi as decodeBase64,at as dirname,Je as download,Q as emitter,Ni as encodeBase64,Lt as env,Wt as exists,Qi as funcQueue,Ga as get,za as getAsync,ht as getCookieScopeDomain,Rr as getCurrentPage,Ci as getCurrentRoute,ct as getDomain,xu as getRichTextNodes,ni as getText,Zt as getUrlInfo,bi as getWindowInfo,Ft as go,wn as isDir,qa as isFile,Qr as isFunction,zi as lock,Y as logger,Pa as ls,ot as mkdir,ge as normalizeDomain,Wi as once,Ei as openDocument,tr as parseCookieHeader,_r as parseHTML,An as parseUrl,Ua as put,zr as query,nt as reLaunch,Da as readFile,ja as readJSON,Ut as redirect,Wa as remove,Qa as removeAsync,Vr as reportNetworkStatus,Bn as request,sr as requestCookieStore,mi as retry,Oa as rm,ki as saveDocument,La as saveFile,_a as saveOnlineFile,Ti as savePhoto,Va as set,Ha as setAsync,ke as showModal,P as showToast,lt as storage,Rt as switchTab,Ra as take,Wr as type,Fa as unzip,Ii as updateApp,F as wrapFunction,pi as writeClipboard,Ma as writeFile,Ba as writeJSON};
12
+ `)}}).toArray()}var ru=Object.freeze({__proto__:null,serialize:eu,serializeArray:tu});function nu(e){var t;return typeof e=="string"?{selector:e,value:"textContent"}:{selector:e.selector,value:(t=e.value)!==null&&t!==void 0?t:"textContent"}}function su(e){const t={};for(const r in e){const n=e[r],s=Array.isArray(n),{selector:i,value:a}=nu(s?n[0]:n),l=typeof a=="function"?a:typeof a=="string"?o=>this._make(o).prop(a):o=>this._make(o).extract(a);if(s)t[r]=this._findBySelector(i,Number.POSITIVE_INFINITY).map((o,c)=>l(c,r,t)).get();else{const o=this._findBySelector(i,1);t[r]=o.length>0?l(o[0],r,t):void 0}}return t}var iu=Object.freeze({__proto__:null,extract:su});class Ge{constructor(t,r,n){if(this.length=0,this.options=n,this._root=r,t){for(let s=0;s<t.length;s++)this[s]=t[s];this.length=t.length}}}Ge.prototype.cheerio="[cheerio object]",Ge.prototype.splice=Array.prototype.splice,Ge.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator],Object.assign(Ge.prototype,hc,Eh,Qh,Xh,ru,iu);function au(e,t){return function r(n,s,i=!0){if(n==null)throw new Error("cheerio.load() expects a string");const a=ir(s),l=e(n,a,i,null);class o extends Ge{_make(f,d){const p=c(f,d);return p.prevObject=this,p}_parse(f,d,p,g){return e(f,d,p,g)}_render(f){return t(f,this.options)}}function c(h,f,d=l,p){if(h&&Z(h))return h;const g=ir(p,a),v=typeof d=="string"?[e(d,g,!1,null)]:"length"in d?d:[d],A=Z(v)?v:new o(v,null,g);if(A._root=A,!h)return new o(void 0,A,g);const _=typeof h=="string"&&br(h)?e(h,g,!1,null).children:ou(h)?[h]:Array.isArray(h)?h:void 0,fe=new o(_,A,g);if(_)return fe;if(typeof h!="string")throw new TypeError("Unexpected type of selector");let Ce=h;const Ee=f?typeof f=="string"?br(f)?new o([e(f,g,!1,null)],A,g):(Ce=`${f} ${Ce}`,A):Z(f)?f:new o(Array.isArray(f)?f:[f],A,g):A;return Ee?Ee.find(Ce):fe}return Object.assign(c,Xl,{load:r,_root:l,_options:a,fn:o.prototype,prototype:o.prototype}),c}}function ou(e){return!!e.name||e.type==="root"||e.type==="text"||e.type==="comment"}var b;(function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"})(b||(b={}));var u;(function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.BeforeSpecialT=23]="BeforeSpecialT",e[e.SpecialStartSequence=24]="SpecialStartSequence",e[e.InSpecialTag=25]="InSpecialTag",e[e.InEntity=26]="InEntity"})(u||(u={}));function J(e){return e===b.Space||e===b.NewLine||e===b.Tab||e===b.FormFeed||e===b.CarriageReturn}function Ot(e){return e===b.Slash||e===b.Gt||J(e)}function lu(e){return e>=b.LowerA&&e<=b.LowerZ||e>=b.UpperA&&e<=b.UpperZ}var G;(function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"})(G||(G={}));const N={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class cu{constructor({xmlMode:t=!1,decodeEntities:r=!0},n){this.cbs=n,this.state=u.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=u.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=r,this.entityDecoder=new rl(t?Zo:Qo,(s,i)=>this.emitCodePoint(s,i))}reset(){this.state=u.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=u.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===b.Lt||!this.decodeEntities&&this.fastForwardTo(b.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=u.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===b.Amp&&this.startEntity()}stateSpecialStartSequence(t){const r=this.sequenceIndex===this.currentSequence.length;if(!(r?Ot(t):(t|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!r){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=u.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===b.Gt||J(t)){const r=this.index-this.currentSequence.length;if(this.sectionStart<r){const n=this.index;this.index=r,this.cbs.ontext(this.sectionStart,r),this.index=n}this.isSpecial=!1,this.sectionStart=r+2,this.stateInClosingTagName(t);return}this.sequenceIndex=0}(t|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===N.TitleEnd?this.decodeEntities&&t===b.Amp&&this.startEntity():this.fastForwardTo(b.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(t===b.Lt)}stateCDATASequence(t){t===N.Cdata[this.sequenceIndex]?++this.sequenceIndex===N.Cdata.length&&(this.state=u.InCommentLike,this.currentSequence=N.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=u.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===N.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=u.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!Ot(t):lu(t)}startSpecial(t,r){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=r,this.state=u.SpecialStartSequence}stateBeforeTagName(t){if(t===b.ExclamationMark)this.state=u.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===b.Questionmark)this.state=u.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const r=t|32;this.sectionStart=this.index,this.xmlMode?this.state=u.InTagName:r===N.ScriptEnd[2]?this.state=u.BeforeSpecialS:r===N.TitleEnd[2]?this.state=u.BeforeSpecialT:this.state=u.InTagName}else t===b.Slash?this.state=u.BeforeClosingTagName:(this.state=u.Text,this.stateText(t))}stateInTagName(t){Ot(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){J(t)||(t===b.Gt?this.state=u.Text:(this.state=this.isTagStartChar(t)?u.InClosingTagName:u.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===b.Gt||J(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=u.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.state=u.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===b.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=u.InSpecialTag,this.sequenceIndex=0):this.state=u.Text,this.sectionStart=this.index+1):t===b.Slash?this.state=u.InSelfClosingTag:J(t)||(this.state=u.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===b.Gt?(this.cbs.onselfclosingtag(this.index),this.state=u.Text,this.sectionStart=this.index+1,this.isSpecial=!1):J(t)||(this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===b.Eq||Ot(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=u.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===b.Eq?this.state=u.BeforeAttributeValue:t===b.Slash||t===b.Gt?(this.cbs.onattribend(G.NoValue,this.sectionStart),this.sectionStart=-1,this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t)):J(t)||(this.cbs.onattribend(G.NoValue,this.sectionStart),this.state=u.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===b.DoubleQuote?(this.state=u.InAttributeValueDq,this.sectionStart=this.index+1):t===b.SingleQuote?(this.state=u.InAttributeValueSq,this.sectionStart=this.index+1):J(t)||(this.sectionStart=this.index,this.state=u.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,r){t===r||!this.decodeEntities&&this.fastForwardTo(r)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(r===b.DoubleQuote?G.Double:G.Single,this.index+1),this.state=u.BeforeAttributeName):this.decodeEntities&&t===b.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,b.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,b.SingleQuote)}stateInAttributeValueNoQuotes(t){J(t)||t===b.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(G.Unquoted,this.index),this.state=u.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===b.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===b.OpeningSquareBracket?(this.state=u.CDATASequence,this.sequenceIndex=0):this.state=t===b.Dash?u.BeforeComment:u.InDeclaration}stateInDeclaration(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=u.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=u.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===b.Dash?(this.state=u.InCommentLike,this.currentSequence=N.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=u.InDeclaration}stateInSpecialComment(t){(t===b.Gt||this.fastForwardTo(b.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=u.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const r=t|32;r===N.ScriptEnd[3]?this.startSpecial(N.ScriptEnd,4):r===N.StyleEnd[3]?this.startSpecial(N.StyleEnd,4):(this.state=u.InTagName,this.stateInTagName(t))}stateBeforeSpecialT(t){const r=t|32;r===N.TitleEnd[3]?this.startSpecial(N.TitleEnd,4):r===N.TextareaEnd[3]?this.startSpecial(N.TextareaEnd,4):(this.state=u.InTagName,this.stateInTagName(t))}startEntity(){this.baseState=this.state,this.state=u.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?H.Strict:this.baseState===u.Text||this.baseState===u.InSpecialTag?H.Legacy:H.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,t===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===u.Text||this.state===u.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===u.InAttributeValueDq||this.state===u.InAttributeValueSq||this.state===u.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case u.Text:{this.stateText(t);break}case u.SpecialStartSequence:{this.stateSpecialStartSequence(t);break}case u.InSpecialTag:{this.stateInSpecialTag(t);break}case u.CDATASequence:{this.stateCDATASequence(t);break}case u.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(t);break}case u.InAttributeName:{this.stateInAttributeName(t);break}case u.InCommentLike:{this.stateInCommentLike(t);break}case u.InSpecialComment:{this.stateInSpecialComment(t);break}case u.BeforeAttributeName:{this.stateBeforeAttributeName(t);break}case u.InTagName:{this.stateInTagName(t);break}case u.InClosingTagName:{this.stateInClosingTagName(t);break}case u.BeforeTagName:{this.stateBeforeTagName(t);break}case u.AfterAttributeName:{this.stateAfterAttributeName(t);break}case u.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(t);break}case u.BeforeAttributeValue:{this.stateBeforeAttributeValue(t);break}case u.BeforeClosingTagName:{this.stateBeforeClosingTagName(t);break}case u.AfterClosingTagName:{this.stateAfterClosingTagName(t);break}case u.BeforeSpecialS:{this.stateBeforeSpecialS(t);break}case u.BeforeSpecialT:{this.stateBeforeSpecialT(t);break}case u.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(t);break}case u.InSelfClosingTag:{this.stateInSelfClosingTag(t);break}case u.InDeclaration:{this.stateInDeclaration(t);break}case u.BeforeDeclaration:{this.stateBeforeDeclaration(t);break}case u.BeforeComment:{this.stateBeforeComment(t);break}case u.InProcessingInstruction:{this.stateInProcessingInstruction(t);break}case u.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===u.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===u.InCommentLike?this.currentSequence===N.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===u.InTagName||this.state===u.BeforeAttributeName||this.state===u.BeforeAttributeValue||this.state===u.AfterAttributeName||this.state===u.InAttributeName||this.state===u.InAttributeValueSq||this.state===u.InAttributeValueDq||this.state===u.InAttributeValueNq||this.state===u.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,r){this.baseState!==u.Text&&this.baseState!==u.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+r,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+r,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const $e=new Set(["input","option","optgroup","select","button","datalist","textarea"]),S=new Set(["p"]),zs=new Set(["thead","tbody"]),Ws=new Set(["dd","dt"]),Qs=new Set(["rt","rp"]),hu=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",S],["h1",S],["h2",S],["h3",S],["h4",S],["h5",S],["h6",S],["select",$e],["input",$e],["output",$e],["button",$e],["datalist",$e],["textarea",$e],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",Ws],["dt",Ws],["address",S],["article",S],["aside",S],["blockquote",S],["details",S],["div",S],["dl",S],["fieldset",S],["figcaption",S],["figure",S],["footer",S],["form",S],["header",S],["hr",S],["main",S],["nav",S],["ol",S],["pre",S],["section",S],["table",S],["ul",S],["rt",Qs],["rp",Qs],["tbody",zs],["tfoot",zs]]),uu=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Zs=new Set(["math","svg"]),Js=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),fu=/\s|\//;class du{constructor(t,r={}){var n,s,i,a,l,o;this.options=r,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t!=null?t:{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(n=r.lowerCaseTags)!==null&&n!==void 0?n:this.htmlMode,this.lowerCaseAttributeNames=(s=r.lowerCaseAttributeNames)!==null&&s!==void 0?s:this.htmlMode,this.recognizeSelfClosing=(i=r.recognizeSelfClosing)!==null&&i!==void 0?i:!this.htmlMode,this.tokenizer=new((a=r.Tokenizer)!==null&&a!==void 0?a:cu)(this.options,this),this.foreignContext=[!this.htmlMode],(o=(l=this.cbs).onparserinit)===null||o===void 0||o.call(l,this)}ontext(t,r){var n,s;const i=this.getSlice(t,r);this.endIndex=r-1,(s=(n=this.cbs).ontext)===null||s===void 0||s.call(n,i),this.startIndex=r}ontextentity(t,r){var n,s;this.endIndex=r-1,(s=(n=this.cbs).ontext)===null||s===void 0||s.call(n,Zn(t)),this.startIndex=r}isVoidElement(t){return this.htmlMode&&uu.has(t)}onopentagname(t,r){this.endIndex=r;let n=this.getSlice(t,r);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(t){var r,n,s,i;this.openTagStart=this.startIndex,this.tagname=t;const a=this.htmlMode&&hu.get(t);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){const l=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,l,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(Zs.has(t)?this.foreignContext.unshift(!0):Js.has(t)&&this.foreignContext.unshift(!1))),(i=(s=this.cbs).onopentagname)===null||i===void 0||i.call(s,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var r,n;this.startIndex=this.openTagStart,this.attribs&&((n=(r=this.cbs).onopentag)===null||n===void 0||n.call(r,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,r){var n,s,i,a,l,o,c,h;this.endIndex=r;let f=this.getSlice(t,r);if(this.lowerCaseTagNames&&(f=f.toLowerCase()),this.htmlMode&&(Zs.has(f)||Js.has(f))&&this.foreignContext.shift(),this.isVoidElement(f))this.htmlMode&&f==="br"&&((a=(i=this.cbs).onopentagname)===null||a===void 0||a.call(i,"br"),(o=(l=this.cbs).onopentag)===null||o===void 0||o.call(l,"br",{},!0),(h=(c=this.cbs).onclosetag)===null||h===void 0||h.call(c,"br",!1));else{const d=this.stack.indexOf(f);if(d!==-1)for(let p=0;p<=d;p++){const g=this.stack.shift();(s=(n=this.cbs).onclosetag)===null||s===void 0||s.call(n,g,p!==d)}else this.htmlMode&&f==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=r+1}onselfclosingtag(t){this.endIndex=t,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var r,n;const s=this.tagname;this.endOpenTag(t),this.stack[0]===s&&((n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,s,!t),this.stack.shift())}onattribname(t,r){this.startIndex=t;const n=this.getSlice(t,r);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(t,r){this.attribvalue+=this.getSlice(t,r)}onattribentity(t){this.attribvalue+=Zn(t)}onattribend(t,r){var n,s;this.endIndex=r,(s=(n=this.cbs).onattribute)===null||s===void 0||s.call(n,this.attribname,this.attribvalue,t===G.Double?'"':t===G.Single?"'":t===G.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const r=t.search(fu);let n=r<0?t:t.substr(0,r);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(t,r){this.endIndex=r;const n=this.getSlice(t,r);if(this.cbs.onprocessinginstruction){const s=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${s}`,`!${n}`)}this.startIndex=r+1}onprocessinginstruction(t,r){this.endIndex=r;const n=this.getSlice(t,r);if(this.cbs.onprocessinginstruction){const s=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${s}`,`?${n}`)}this.startIndex=r+1}oncomment(t,r,n){var s,i,a,l;this.endIndex=r,(i=(s=this.cbs).oncomment)===null||i===void 0||i.call(s,this.getSlice(t,r-n)),(l=(a=this.cbs).oncommentend)===null||l===void 0||l.call(a),this.startIndex=r+1}oncdata(t,r,n){var s,i,a,l,o,c,h,f,d,p;this.endIndex=r;const g=this.getSlice(t,r-n);!this.htmlMode||this.options.recognizeCDATA?((i=(s=this.cbs).oncdatastart)===null||i===void 0||i.call(s),(l=(a=this.cbs).ontext)===null||l===void 0||l.call(a,g),(c=(o=this.cbs).oncdataend)===null||c===void 0||c.call(o)):((f=(h=this.cbs).oncomment)===null||f===void 0||f.call(h,`[CDATA[${g}]]`),(p=(d=this.cbs).oncommentend)===null||p===void 0||p.call(d)),this.startIndex=r+1}onend(){var t,r;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let n=0;n<this.stack.length;n++)this.cbs.onclosetag(this.stack[n],!0)}(r=(t=this.cbs).onend)===null||r===void 0||r.call(t)}reset(){var t,r,n,s;(r=(t=this.cbs).onreset)===null||r===void 0||r.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(s=(n=this.cbs).onparserinit)===null||s===void 0||s.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,r){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(t-this.bufferOffset,r-this.bufferOffset);for(;r-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,r-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var r,n;if(this.ended){(n=(r=this.cbs).onerror)===null||n===void 0||n.call(r,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var r,n;if(this.ended){(n=(r=this.cbs).onerror)===null||n===void 0||n.call(r,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}function pu(e,t){const r=new Wo(void 0,t);return new du(r,t).end(e),r.root}const gu=au(kh(pu),bt),mu=gu(""),_r=e=>{var t;return(t=mu.parseHTML(e))!=null?t:[]};var bu=Object.defineProperty,Ys=Object.getOwnPropertySymbols,yu=Object.prototype.hasOwnProperty,wu=Object.prototype.propertyIsEnumerable,Xs=(e,t,r)=>t in e?bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ks=(e,t)=>{for(var r in t||(t={}))yu.call(t,r)&&Xs(e,r,t[r]);if(Ys)for(var r of Ys(t))wu.call(t,r)&&Xs(e,r,t[r]);return e},ei=(e,t,r)=>new Promise((n,s)=>{var i=o=>{try{l(r.next(o))}catch(c){s(c)}},a=o=>{try{l(r.throw(o))}catch(c){s(c)}},l=o=>o.done?n(o.value):Promise.resolve(o.value).then(i,a);l((r=r.apply(e,t)).next())});const ti=e=>{const t=e.filter(s=>!!s),r=t[0];r&&r.type==="text"&&!r.text.trim()&&t.shift();const n=t[t.length-1];return n&&n.type==="text"&&!n.text.trim()&&t.pop(),t},ri=(e,t)=>ei(void 0,[e,t],function*(r,{appendClass:n,transform:s}){if(r.type==="text")return{type:"text",text:r.data.replace(/\r/g,"")};if(r.type==="tag"){const i=Rn.find(([a])=>r.name===a);if(i){const a=Object.fromEntries(r.attributes.filter(({name:h})=>{var f;return["class","style"].includes(h)||((f=i[1])==null?void 0:f.includes(h))}).map(({name:h,value:f})=>[h,f])),l=ti(yield Promise.all(r.children.map(h=>ri(h,{appendClass:n,transform:s}))));n&&(a.class=a.class?`${a.class} ${r.name}`:r.name);const o=Ks(Ks({type:"node",name:r.name},Object.keys(a).length?{attrs:a}:{}),l.length?{children:l}:{}),c=s[r.name];return yield c?c(o):o}}return null}),xu=(e,...t)=>ei(void 0,[e,...t],function*(r,{appendClass:n=!0,transform:s={}}={}){return ti(yield Promise.all((Array.isArray(r)?r:_r(r)).map(i=>ri(i,{appendClass:n,transform:s}))))}),ni=e=>(typeof e=="string"?_r(e):e).map(t=>t.type==="text"?t.data:"childNodes"in t?ni(t.childNodes):"").join("");export{Xi as $App,xa as $Component,ia as $Config,va as $Page,Rn as ALLOWED_TAGS,ut as Cookie,dt as CookieStore,Xe as Emitter,rr as Headers,Li as MpError,Jr as Queue,ze as URLSearchParams,Si as addContact,Za as check,Ja as checkAsync,$i as compareVersion,gi as confirm,Io as createRequest,qi as decodeBase64,at as dirname,Je as download,Q as emitter,Ni as encodeBase64,Lt as env,Wt as exists,Qi as funcQueue,Ga as get,za as getAsync,ht as getCookieScopeDomain,Rr as getCurrentPage,Ci as getCurrentRoute,ct as getDomain,xu as getRichTextNodes,ni as getText,Zt as getUrlInfo,bi as getWindowInfo,Ft as go,wn as isDir,qa as isFile,Qr as isFunction,zi as lock,Y as logger,Pa as ls,ot as mkdir,ge as normalizeDomain,Wi as once,Ei as openDocument,tr as parseCookieHeader,_r as parseHTML,An as parseUrl,Ua as put,zr as query,nt as reLaunch,Da as readFile,ja as readJSON,Ut as redirect,Wa as remove,Qa as removeAsync,Vr as reportNetworkStatus,Bn as request,sr as requestCookieStore,mi as retry,Oa as rm,ki as saveDocument,La as saveFile,_a as saveOnlineFile,Ti as savePhoto,Va as set,Ha as setAsync,ke as showModal,P as showToast,lt as storage,Rt as switchTab,Ra as take,Wr as type,Fa as unzip,Ii as updateApp,R as wrapFunction,pi as writeClipboard,Ma as writeFile,Ba as writeJSON};
13
13
  //# sourceMappingURL=index.mjs.map