@cloudbase/js-sdk 2.7.3-beta.0 → 2.7.4-beta.0
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/miniprogram_dist/auth.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see auth.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_auth",[],t):"object"==typeof exports?exports.cloudbase_auth=t():e.cloudbase_auth=t()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var e={997:(e,t,r)=>{var n;r.r(t),r.d(t,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>n,formatUrl:()=>s}),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}},243:(e,t,r)=>{var n,o,i,s,a,u;function c(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}r.r(t),r.d(t,{Auth:()=>wo,LoginState:()=>bo,generateAuthInstance:()=>So,registerAuth:()=>Io}),function(e){e.AUTH_SIGN_IN_URL="/auth/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",e.AUTH_SIGN_IN_WITH_WECHAT_URL="/auth/v1/signin/wechat/noauth",e.AUTH_SIGN_UP_URL="/auth/v1/signup",e.AUTH_TOKEN_URL="/auth/v1/token",e.AUTH_REVOKE_URL="/auth/v1/revoke",e.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",e.PROVIDER_TOKEN_URL="/auth/v1/provider/token",e.PROVIDER_URI_URL="/auth/v1/provider/uri",e.USER_ME_URL="/auth/v1/user/me",e.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",e.USER_QUERY_URL="/auth/v1/user/query",e.USER_PRIFILE_URL="/auth/v1/user/profile",e.USER_BASIC_EDIT_URL="/auth/v1/user/basic/edit",e.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",e.VERIFICATION_URL="/auth/v1/verification",e.VERIFY_URL="/auth/v1/verification/verify",e.CAPTCHA_DATA_URL="/auth/v1/captcha/data",e.VERIFY_CAPTCHA_DATA_URL="/auth/v1/captcha/data/verify",e.GET_CAPTCHA_URL="/auth/v1/captcha/init",e.PROVIDER_LIST="/auth/v1/user/provider",e.PROVIDER_UNBIND_URL="/auth/v1/user/provider",e.CHECK_PWD_URL="/auth/v1/user/sudo",e.SUDO_URL="/auth/v1/user/sudo",e.BIND_CONTACT_URL="/auth/v1/user/contact",e.AUTH_SET_PASSWORD="/auth/v1/user/password",e.AUTH_RESET_PASSWORD="/auth/v1/reset",e.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",e.CHECK_USERNAME="/auth/v1/checkUsername",e.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist",e.AUTHORIZE_URL="/auth/v1/user/authorize",e.AUTHORIZE_DEVICE_URL="/auth/v1/user/device/authorize",e.AUTHORIZE_INFO_URL="/auth/v1/user/authorize/info",e.AUTHORIZED_DEVICES_DELETE_URL="/auth/v1/user/authorized/devices/",e.AUTH_REVOKE_ALL_URL="/auth/v1/user/revoke/all",e.GET_PROVIDER_TYPE="/auth/v1/mgr/provider/providerSubType",e.GET_MINIPROGRAM_QRCODE="/auth/v1/qrcode/generate",e.GET_MINIPROGRAM_QRCODE_STATUS="/auth/v1/qrcode/get/status",e.GET_USER_BEHAVIOR_LOG="/auth/v1/user/security/history"}(n||(n={})),function(e){e.AUTH_SIGN_IN_URL="/auth/v2/signin/username",e.AUTH_TOKEN_URL="/auth/v2/token",e.USER_ME_URL="/auth/v2/user/me",e.VERIFY_URL="/auth/v2/signin/verificationcode",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider",e.AUTH_PUBLIC_KEY="/auth/v2/signin/publichkey"}(o||(o={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(i||(i={})),(u=s||(s={})).UNREACHABLE="unreachable",u.LOCAL="local",u.CANCELLED="cancelled",u.UNKNOWN="unknown",u.UNAUTHENTICATED="unauthenticated",u.RESOURCE_EXHAUSTED="resource_exhausted",u.FAILED_PRECONDITION="failed_precondition",u.INVALID_ARGUMENT="invalid_argument",u.DEADLINE_EXCEEDED="deadline_exceeded",u.NOT_FOUND="not_found",u.ALREADY_EXISTS="already_exists",u.PERMISSION_DENIED="permission_denied",u.ABORTED="aborted",u.OUT_OF_RANGE="out_of_range",u.UNIMPLEMENTED="unimplemented",u.INTERNAL="internal",u.UNAVAILABLE="unavailable",u.DATA_LOSS="data_loss",u.INVALID_PASSWORD="invalid_password",u.PASSWORD_NOT_SET="password_not_set",u.INVALID_STATUS="invalid_status",u.USER_PENDING="user_pending",u.USER_BLOCKED="user_blocked",u.INVALID_VERIFICATION_CODE="invalid_verification_code",u.TWO_FACTOR_REQUIRED="two_factor_required",u.INVALID_TWO_FACTOR="invalid_two_factor",u.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",u.UNDER_REVIEW="under_review",u.INVALID_REQUEST="invalid_request",u.UNAUTHORIZED_CLIENT="unauthorized_client",u.ACCESS_DENIED="access_denied",u.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",u.INVALID_SCOPE="invalid_scope",u.INVALID_GRANT="invalid_grant",u.SERVER_ERROR="server_error",u.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",u.INTERACTION_REQUIRED="interaction_required",u.LOGIN_REQUIRED="login_required",u.ACCOUNT_SELECTION_REQUIRED="account_selection_required",u.CONSENT_REQUIRED="consent_required",u.INVALID_REQUEST_URI="invalid_request_uri",u.INVALID_REQUEST_OBJECT="invalid_request_object",u.REQUEST_NOT_SUPPORTED="request_not_supported",u.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",u.REGISTRATION_NOT_SUPPORTED="registration_not_supported",u.CAPTCHA_REQUIRED="captcha_required",u.CAPTCHA_INVALID="captcha_invalid",function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(a||(a={}));var l=r(616);class h{constructor(){this.fnPromiseMap=new Map}async run(e,t){let r=this.fnPromiseMap.get(e);return await r||(r=new Promise(((r,n)=>{(async()=>{try{await this.runIdlePromise();const e=t();r(await e)}catch(e){n(e)}finally{this.fnPromiseMap.delete(e)}})()})),this.fnPromiseMap.set(e,r)),r}runIdlePromise(){return Promise.resolve()}}const d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f="x-request-id",p="x-device-id",m="device_id",g=async function(e,t){let r=null,n=null;try{const o=Object.assign({},t);o.method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body));const i=await fetch(e,o),s=await i.json();s?.error?(n=s,n.error_uri=new URL(e).pathname):r=s}catch(t){n={error:s.UNREACHABLE,error_description:t.message,error_uri:new URL(e).pathname}}if(n)throw n;return r},y=new class{constructor(e){this._env=e?.env||""}async getItem(e){return window.localStorage.getItem(`${e}${this._env}`)}async removeItem(e){window.localStorage.removeItem(`${e}${this._env}`)}async setItem(e,t){window.localStorage.setItem(`${e}${this._env}`,t)}getItemSync(e){return window.localStorage.getItem(`${e}${this._env}`)}removeItemSync(e){window.localStorage.removeItem(`${e}${this._env}`)}setItemSync(e,t){window.localStorage.setItem(`${e}${this._env}`,t)}};function _(e){let t=!0;return e?.expires_at&&e?.access_token&&(t=e.expires_at<new Date),t}class v{constructor(e){this.credentials=null,this.singlePromise=new h,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage}getStorageCredentialsSync(){let e=null;const t=this.storage.getItemSync(this.tokenSectionName);if(null!=t)try{e=JSON.parse(t),e?.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){this.storage.removeItem(this.tokenSectionName),e=null}return e}async setCredentials(e){if(e?.expires_in){if(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30)),this.storage){const t=JSON.stringify(e);await this.storage.setItem(this.tokenSectionName,t)}this.credentials=e}else this.storage&&await this.storage.removeItem(this.tokenSectionName),this.credentials=null}async getCredentials(){return this.singlePromise.run("getCredentials",(async()=>(_(this.credentials)&&(this.credentials=await this.getStorageCredentials()),this.credentials)))}async getStorageCredentials(){return this.singlePromise.run("_getStorageCredentials",(async()=>{let e=null;const t=await this.storage.getItem(this.tokenSectionName);if(null!=t)try{e=JSON.parse(t),e?.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){await this.storage.removeItem(this.tokenSectionName),e=null}return e}))}}class b{constructor(e){this.singlePromise=new h,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,b.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=g,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||y,this.localCredentials=new v({tokenSectionName:`credentials_${e.clientId}`,storage:this.storage}),this.clientSecret=e.clientSecret,""!==e.clientId&&(this.basicAuth=`Basic ${function(e){let t,r,n,o,i="",s=0;const a=(e=String(e)).length%3;for(;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=r<<16|n<<8|o,i+=d.charAt(t>>18&63)+d.charAt(t>>12&63)+d.charAt(t>>6&63)+d.charAt(63&t)}return a?i.slice(0,a-3)+"===".substring(a):i}(`${e.clientId}:${e.clientSecret}`)}`),this.wxCloud=e.wxCloud;try{(function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0})()&&void 0===this.wxCloud&&e.env&&(wx.cloud.init({env:e.env}),this.wxCloud=wx.cloud)}catch(e){}this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}setCredentials(e){return this.localCredentials.setCredentials(e)}async getAccessToken(){const e=await this.getCredentials();if(e?.access_token)return Promise.resolve(e.access_token);const t={error:s.UNAUTHENTICATED};return Promise.reject(t)}async request(e,t){t||(t={});const r=this.formatRetry(t.retry,this.retry);if(t.headers=t.headers||{},this.headers&&(t.headers={...this.headers,...t.headers}),t.headers[f]||(t.headers[f]=c()),!t.headers[p]){const e=await this.getDeviceId();t.headers[p]=e}if(t?.withBasicAuth&&this.basicAuth&&(t.headers.Authorization=this.basicAuth),t?.withCredentials){const r=await this.getCredentials();r&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+=`access_token=${r.access_token}`):t.headers.Authorization=`${r.token_type} ${r.access_token}`)}else this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+=`client_id=${this.clientId}`);e.startsWith("/")&&(e=this.apiOrigin+e);let n=null;const o=r+1;for(let i=0;i<o;i++){try{n=t.useWxCloud?await this.wxCloudCallFunction(e,t):await this.baseRequest(e,t);break}catch(e){if(t.withCredentials&&e&&e.error===s.UNAUTHENTICATED)return await this.setCredentials(null),Promise.reject(e);if(i===r||!e||"unreachable"!==e.error)return Promise.reject(e)}await this.sleep(b.retryInterval)}return n}async wxCloudCallFunction(e,t){let r=null,n=null;try{const{result:o}=await this.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:e,method:t.method,headers:{origin:"https://servicewechat.com",...t.headers},body:t.body}});o?.body?.error_code?(n=o?.body,n.error_uri=(0,l.y)(e)):r=o?.body}catch(t){n={error:s.UNREACHABLE,error_description:t.message,error_uri:(0,l.y)(e)}}if(n)throw n;return r}async getCredentials(){let e=await this.localCredentials.getCredentials();return e?(_(e)&&(e=e&&"anonymous"===e.scope?this.anonymousSignInFunc?await this.anonymousSignInFunc(e)||await this.localCredentials.getCredentials():await this.anonymousSignIn(e):await this.refreshToken(e)),e):this.unAuthenticatedError("credentials not found")}getCredentialsSync(){return this.localCredentials.getStorageCredentialsSync()}getCredentialsAsync(){return this.getCredentials()}async getScope(){const e=await this.localCredentials.getCredentials();return e?e.scope:this.unAuthenticatedError("credentials not found")}async getGroups(){const e=await this.localCredentials.getCredentials();return e?e.groups:this.unAuthenticatedError("credentials not found")}async refreshToken(e){return this.singlePromise.run("_refreshToken",(async()=>{if(!e||!e.refresh_token)return this.unAuthenticatedError("no refresh token found in credentials");try{const t=await this.refreshTokenFunc(e.refresh_token,e);return await this.localCredentials.setCredentials(t),t}catch(e){return e.error===s.INVALID_GRANT?(await this.localCredentials.setCredentials(null),this.unAuthenticatedError(e.error_description)):Promise.reject(e)}}))}checkRetry(e){let t=null;if(("number"!=typeof e||e<b.minRetry||e>b.maxRetry)&&(t={error:s.UNREACHABLE,error_description:"wrong options param: retry"}),t)throw t;return e}formatRetry(e,t){return void 0===e?t:this.checkRetry(e)}async sleep(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}async anonymousSignIn(e){return this.singlePromise.run("_anonymous",(async()=>{if(!e||"anonymous"!==e.scope)return this.unAuthenticatedError("no anonymous in credentials");try{const e=await this.request(n.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return await this.localCredentials.setCredentials(e),e}catch(e){return e.error===s.INVALID_GRANT?(await this.localCredentials.setCredentials(null),this.unAuthenticatedError(e.error_description)):Promise.reject(e)}}))}async defaultRefreshTokenFunc(e,t){if(void 0===e||""===e)return this.unAuthenticatedError("refresh token not found");let r=n.AUTH_TOKEN_URL;return"v2"===t?.version&&(r=o.AUTH_TOKEN_URL),{...await this.request(r,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:e}}),version:t?.version||"v1"}}async getDeviceId(){if(this.deviceID)return this.deviceID;let e=await this.storage.getItem(m);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=c(),await this.storage.setItem(m,e)),this.deviceID=e,e}unAuthenticatedError(e){const t={error:s.UNAUTHENTICATED,error_description:e};return Promise.reject(t)}}function w(){const{wx:e}=globalThis;if(void 0===e)return!1;if(void 0===globalThis.Page)return!1;if(!e.getSystemInfoSync)return!1;if(!e.getStorageSync)return!1;if(!e.setStorageSync)return!1;if(!e.connectSocket)return!1;if(!e.request)return!1;try{if(!e.getSystemInfoSync())return!1;if("qq"===e.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0}b.defaultRetry=2,b.minRetry=0,b.maxRetry=5,b.retryInterval=1e3;let S=!1;function T(){S=S||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{w()||(S=S||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?T():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",T,!1))}catch(q){}function I(){return S}class E{constructor(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=y),this.config=e,this.tokenSectionName=`captcha_${e.clientId}`}async request(e,t){t||(t={}),t.method||(t.method="GET");const r=`${t.method}:${e}`;let n,o=e;t.withCaptcha&&(o=await this.appendCaptchaTokenToURL(e,r,!1));try{n=await this.config.request(o,t)}catch(n){return n.error===s.CAPTCHA_REQUIRED||n.error===s.CAPTCHA_INVALID?(e=await this.appendCaptchaTokenToURL(e,r,n.error===s.CAPTCHA_INVALID),this.config.request(e,t)):Promise.reject(n)}return n}getDefaultOpenURIWithCallback(){if(!w()&&!I()&&(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap"))){const e=document.createElement("div");e.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",e.setAttribute("id","captcha_panel_wrap"),setTimeout((()=>{document.body.appendChild(e)}),0)}return this.defaultOpenURIWithCallback}async defaultOpenURIWithCallback(e,t){const{width:r="355px",height:n="355px"}=t||{};if(e.match(/^(data:.*)$/))return Promise.reject({error:s.UNIMPLEMENTED,error_description:"need to impl captcha data"});const o=document.getElementById("captcha_panel_wrap"),i=document.createElement("iframe");return o.innerHTML="",i.setAttribute("src",e),i.setAttribute("id","review-panel-iframe"),i.style.cssText=`min-width:${r};display:block;height:${n};margin:0 auto;background-color: rgb(255, 255, 255);border: none;`,o.appendChild(i),o.style.display="block",new Promise(((e,t)=>{i.onload=function(){try{const r=window.location,n=i.contentWindow.location;if(n.host+n.pathname===r.host+r.pathname){o.style.display="none";const r=new URLSearchParams(n.search),i=r.get("captcha_token");return i?e({captcha_token:i,expires_in:Number(r.get("expires_in"))}):t({error:r.get("error"),error_description:r.get("error_description")})}o.style.display="block"}catch(e){o.style.display="block"}}}))}async getCaptchaToken(e,t){if(!e){const e=await this.findCaptchaToken();if(e)return e}let r;if(w()||I()){const e=await this.config.request(n.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:""},withCredentials:!1});r={url:`${e.data}?state=${encodeURIComponent(t)}&token=${encodeURIComponent(e.token)}`}}else{const e=`${window.location.origin+window.location.pathname}?__captcha=on`;if(r=await this.config.request(n.GET_CAPTCHA_URL,{method:"POST",body:{client_id:this.config.clientId,redirect_uri:e,state:t},withCredentials:!1}),r.captcha_token){const e={captcha_token:r.captcha_token,expires_in:r.expires_in};return this.saveCaptchaToken(e),r.captcha_token}}const o=await this.config.openURIWithCallback(r.url);return this.saveCaptchaToken(o),o.captcha_token}async appendCaptchaTokenToURL(e,t,r){const n=await this.getCaptchaToken(r,t);return e.indexOf("?")>0?e+=`&captcha_token=${n}`:e+=`?captcha_token=${n}`,e}async saveCaptchaToken(e){e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10));const t=JSON.stringify(e);await this.config.storage.setItem(this.tokenSectionName,t)}async findCaptchaToken(){const e=await this.config.storage.getItem(this.tokenSectionName);if(null!=e)try{const t=JSON.parse(e);return t?.expires_at&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?null:t.captcha_token}catch(e){return await this.config.storage.removeItem(this.tokenSectionName),null}return null}}function R(e){if(!globalThis.IS_MP_BUILD&&e)return r(431)}class P{static parseParamsToSearch(e){return Object.keys(e).forEach((t=>{e[t]||delete e[t]})),new URLSearchParams(e).toString()}constructor(e){let{request:t}=e,r=e.credentialsClient;if(!r){const t={apiOrigin:e.apiOrigin,clientId:e.clientId,storage:e.storage,env:e.env,baseRequest:e.baseRequest,anonymousSignInFunc:e.anonymousSignInFunc,wxCloud:e.wxCloud};r=new b(t)}if(!t){const n=r.request.bind(r),o=new E({clientId:e.clientId,request:n,storage:e.storage,...e.captchaOptions});t=o.request.bind(o)}this.config={env:e.env,apiOrigin:e.apiOrigin,clientId:e.clientId,request:t,credentialsClient:r,storage:e.storage||y}}getParamsByVersion(e,t){const r=(0,l.I)(e),i={v2:o}[r?.version]?.[t]||n[t];return r&&delete r.version,{params:r,url:i}}async signIn(e){const t=e.version||"v1",r=this.getParamsByVersion(e,"AUTH_SIGN_IN_URL");r.params.query&&delete r.params.query;const n=await this.getEncryptParams(r.params),o=await this.config.request(r.url,{method:"POST",body:n});return await this.config.credentialsClient.setCredentials({...o,version:t}),Promise.resolve(o)}async signInAnonymously(e={}){const t=await this.config.request(n.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signUp(e){const t=await this.config.request(n.AUTH_SIGN_UP_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signOut(){const e=await this.config.credentialsClient.getAccessToken(),t=await this.config.request(n.AUTH_REVOKE_URL,{method:"POST",body:{token:e}});return await this.config.credentialsClient.setCredentials(),Promise.resolve(t)}async revokeAllDevices(){await this.config.request(n.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}async revokeDevice(e){await this.config.request(n.AUTHORIZED_DEVICES_DELETE_URL+e.device_id,{method:"DELETE",withCredentials:!0})}async getVerification(e){let t=!1;return("CUR_USER"===e.target||await this.hasLoginState())&&(t=!0),this.config.request(n.VERIFICATION_URL,{method:"POST",body:e,withCredentials:t})}async verify(e){const t=this.getParamsByVersion(e,"VERIFY_URL"),r=await this.config.request(t.url,{method:"POST",body:t.params});return"v2"===e?.version&&await this.config.credentialsClient.setCredentials({...r,version:"v2"}),r}async genProviderRedirectUri(e){let t=`${n.PROVIDER_URI_URL}?client_id=${this.config.clientId}&provider_id=${e.provider_id}&redirect_uri=${encodeURIComponent(e.provider_redirect_uri)}&state=${e.state}`;const{other_params:r}=e;return r&&"string"==typeof r.sign_out_uri&&r.sign_out_uri.length>0&&(t+=`&other_params[sign_out_uri]=${r.sign_out_uri}`),this.config.request(t,{method:"GET"})}async grantProviderToken(e,t=!1){return this.config.request(n.PROVIDER_TOKEN_URL,{method:"POST",body:e,useWxCloud:t})}async patchProviderToken(e){return this.config.request(n.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})}async signInWithProvider(e,t=!1){const r=this.getParamsByVersion(e,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),n=await this.config.request(r.url,{method:"POST",body:r.params,useWxCloud:t});return await this.config.credentialsClient.setCredentials({...n,version:e?.version||"v1"}),Promise.resolve(n)}async signInWithWechat(e={}){const t=await this.config.request(n.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async bindWithProvider(e){return this.config.request(n.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0})}async getUserProfile(e){return this.getUserInfo(e)}async getUserInfo(e={}){const t=this.getParamsByVersion(e,"USER_ME_URL");if(t.params?.query){const e=new URLSearchParams(t.params.query);t.url+=`?${e.toString()}`}const r=await this.config.request(t.url,{method:"GET",withCredentials:!0});return r.sub&&(r.uid=r.sub),r}async getWedaUserInfo(){return await this.config.request(n.WEDA_USER_URL,{method:"GET",withCredentials:!0})}async deleteMe(e){const t=this.getParamsByVersion(e,"USER_ME_URL"),r=`${t.url}?${P.parseParamsToSearch(t.params)}`;return this.config.request(r,{method:"DELETE",withCredentials:!0})}async hasLoginState(){try{return await this.config.credentialsClient.getAccessToken(),!0}catch(e){return!1}}hasLoginStateSync(){return this.config.credentialsClient.getCredentialsSync()}async getLoginState(){return this.config.credentialsClient.getCredentialsAsync()}async transByProvider(e){return this.config.request(n.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})}async grantToken(e){const t=this.getParamsByVersion(e,"AUTH_TOKEN_URL");return this.config.request(t.url,{method:"POST",body:t.params})}async getProviders(){return this.config.request(n.PROVIDER_LIST,{method:"GET",withCredentials:!0})}async unbindProvider(e){return this.config.request(`${n.PROVIDER_UNBIND_URL}/${e.provider_id}`,{method:"DELETE",withCredentials:!0})}async checkPassword(e){return this.config.request(`${n.CHECK_PWD_URL}`,{method:"POST",withCredentials:!0,body:e})}async editContact(e){return this.config.request(`${n.BIND_CONTACT_URL}`,{method:"PATCH",withCredentials:!0,body:e})}async setPassword(e){return this.config.request(`${n.AUTH_SET_PASSWORD}`,{method:"PATCH",withCredentials:!0,body:e})}async updatePasswordByOld(e){const t=await this.sudo({password:e.old_password});return this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})}async sudo(e){return this.config.request(`${n.SUDO_URL}`,{method:"POST",withCredentials:!0,body:e})}async sendVerificationCodeToCurrentUser(e){return e.target="CUR_USER",this.config.request(n.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})}async changeBoundProvider(e){return this.config.request(`${n.PROVIDER_LIST}/${e.provider_id}/trans`,{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})}async setUserProfile(e){return this.config.request(n.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})}async updateUserBasicInfo(e){return this.config.request(n.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:e})}async queryUserProfile(e){const t=new URLSearchParams(e);return this.config.request(`${n.USER_QUERY_URL}?${t.toString()}`,{method:"GET",withCredentials:!0})}setCustomSignFunc(e){this.getCustomSignTicketFn=e}async signInWithCustomTicket(e){const t=this.getCustomSignTicketFn;if(!t)return Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"});const r=await t();return this.signInWithProvider({...e,provider_id:"custom",provider_token:r})}async resetPassword(e){return this.config.request(n.AUTH_RESET_PASSWORD,{method:"POST",body:e})}async authorize(e){return this.config.request(n.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:e})}async authorizeDevice(e){return this.config.request(n.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:e})}async deviceAuthorize(e){return this.config.request(n.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})}async authorizeInfo(e){const t=`${n.AUTHORIZE_INFO_URL}?${P.parseParamsToSearch(e)}`;let r=!0,o=!1;return await this.hasLoginState()&&(o=!0,r=!1),this.config.request(t,{method:"GET",withBasicAuth:r,withCredentials:o})}async checkUsername(e){return this.config.request(n.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})}async checkIfUserExist(e){const t=new URLSearchParams(e);return this.config.request(`${n.CHECK_IF_USER_EXIST}?${t.toString()}`,{method:"GET"})}async loginScope(){return this.config.credentialsClient.getScope()}async loginGroups(){return this.config.credentialsClient.getGroups()}async refreshTokenForce(e){const t=await this.config.credentialsClient.getCredentials();return await this.config.credentialsClient.refreshToken({...t,version:e?.version||"v1"})}async getCredentials(){return this.config.credentialsClient.getCredentials()}async getPublicKey(){return this.config.request(o.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}async getEncryptParams(e){const{isEncrypt:t}=e;delete e.isEncrypt;const r=(0,l.I)(e),n=R(t);if(!n)return e;let o="",i="";try{const e=await this.getPublicKey();o=e.public_key,i=e.public_key_thumbprint}catch(e){}if(!o||!i)throw new Error("public_key or public_key_thumbprint is empty");return{params:n.getEncryptInfo({publicKey:o,payload:r}),public_key_thumbprint:i}}async getProviderSubType(){return this.config.request(n.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}async verifyCaptchaData({token:e,key:t}){return this.config.request(n.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:e,key:t},withCredentials:!1})}async createCaptchaData({state:e,redirect_uri:t}){return this.config.request(n.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:t},withCredentials:!1})}async getMiniProgramCode(e){return this.config.request(n.GET_MINIPROGRAM_QRCODE,{method:"POST",body:e})}async getMiniProgramQrCodeStatus(e){return this.config.request(n.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:e})}async getUserBehaviorLog(e){const t=`${n.GET_USER_BEHAVIOR_LOG}?${{LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"}[e.type]}&limit=${e.limit}${e.page_token?`&page_token=${e.page_token}`:""}`;return this.config.request(t,{method:"GET",withCredentials:!0})}async modifyPassword(e){let t="",r="";const o=R(!0);if(!o)throw new Error("do not support encrypt, a encrypt util required.");try{const e=await this.getPublicKey();t=e.public_key,r=e.public_key_thumbprint}catch(e){}if(!t||!r)throw new Error("public_key or public_key_thumbprint is empty");const i=e.password?o.getEncryptInfo({publicKey:t,payload:e.password}):"",s=o.getEncryptInfo({publicKey:t,payload:e.new_password});return this.config.request(n.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:e.user_id,encrypt_password:i,encrypt_new_password:s,public_key_thumbprint:r}})}}class O{constructor(e){const{apiOrigin:t,clientId:r,env:n,storage:o,request:i,baseRequest:s,anonymousSignInFunc:a,wxCloud:u}=e;this.oauth2client=new b({apiOrigin:t,clientId:r,env:n,storage:o,baseRequest:s||i,anonymousSignInFunc:a,wxCloud:u}),this.authApi=new P({credentialsClient:this.oauth2client,...e,request:i?this.oauth2client.request.bind(this.oauth2client):void 0})}}var C=r(894),A=r(141),U=r(466),L=r(988),k=r(418),N=r(997);function q(){}function D(e){return"object"==typeof e&&null!==e||"function"==typeof e}const x=q;function M(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const j=Promise,B=Promise.resolve.bind(j),W=Promise.prototype.then,F=Promise.reject.bind(j),V=B;function $(e){return new j(e)}function H(e){return $((t=>t(e)))}function z(e){return F(e)}function G(e,t,r){return W.call(e,t,r)}function Y(e,t,r){G(G(e,t,r),void 0,x)}function K(e,t){Y(e,t)}function Q(e,t){Y(e,void 0,t)}function Z(e,t,r){return G(e,t,r)}function J(e){G(e,void 0,x)}let X=e=>{if("function"==typeof queueMicrotask)X=queueMicrotask;else{const e=H(void 0);X=t=>G(e,t)}return X(e)};function ee(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function te(e,t,r){try{return H(ee(e,t,r))}catch(e){return z(e)}}class re{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let n=r+1;const o=e._elements,i=o[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),o[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,n=r._elements;for(;!(t===n.length&&void 0===r._next||t===n.length&&(r=r._next,n=r._elements,t=0,0===n.length));)e(n[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const ne=Symbol("[[AbortSteps]]"),oe=Symbol("[[ErrorSteps]]"),ie=Symbol("[[CancelSteps]]"),se=Symbol("[[PullSteps]]"),ae=Symbol("[[ReleaseSteps]]");function ue(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?de(e):"closed"===t._state?function(e){de(e),me(e)}(e):fe(e,t._storedError)}function ce(e,t){return _n(e._ownerReadableStream,t)}function le(e){const t=e._ownerReadableStream;"readable"===t._state?pe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){fe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[ae](),t._reader=void 0,e._ownerReadableStream=void 0}function he(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function de(e){e._closedPromise=$(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function fe(e,t){de(e),pe(e,t)}function pe(e,t){void 0!==e._closedPromise_reject&&(J(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function me(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const ge=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},ye=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function _e(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function ve(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function be(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function we(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Se(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Te(e){return Number(e)}function Ie(e){return 0===e?0:e}function Ee(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Ie(n),!ge(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Ie(ye(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return ge(n)&&0!==n?n:0}function Re(e,t){if(!gn(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Pe(e){return new Le(e)}function Oe(e,t){e._reader._readRequests.push(t)}function Ce(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Ae(e){return e._reader._readRequests.length}function Ue(e){const t=e._reader;return void 0!==t&&!!ke(t)}class Le{constructor(e){if(we(e,1,"ReadableStreamDefaultReader"),Re(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ue(this,e),this._readRequests=new re}get closed(){return ke(this)?this._closedPromise:z(De("closed"))}cancel(e=void 0){return ke(this)?void 0===this._ownerReadableStream?z(he("cancel")):ce(this,e):z(De("cancel"))}read(){if(!ke(this))return z(De("read"));if(void 0===this._ownerReadableStream)return z(he("read from"));let e,t;const r=$(((r,n)=>{e=r,t=n}));return Ne(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!ke(this))throw De("releaseLock");void 0!==this._ownerReadableStream&&function(e){le(e),qe(e,new TypeError("Reader was released"))}(this)}}function ke(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof Le}function Ne(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[se](t)}function qe(e,t){const r=e._readRequests;e._readRequests=new re,r.forEach((e=>{e._errorSteps(t)}))}function De(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var xe,Me,je;function Be(e){return e.slice()}function We(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(Le.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),M(Le.prototype.cancel,"cancel"),M(Le.prototype.read,"read"),M(Le.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Le.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let Fe=e=>(Fe="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,Fe(e)),Ve=e=>(Ve="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,Ve(e));function $e(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return We(o,0,e,t,n),o}function He(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(`${String(t)} is not a function`);return r}}function ze(e){try{const t=e.done,r=e.value;return G(V(r),(e=>({done:t,value:e})))}catch(e){return z(e)}}const Ge=null!==(je=null!==(xe=Symbol.asyncIterator)&&void 0!==xe?xe:null===(Me=Symbol.for)||void 0===Me?void 0:Me.call(Symbol,"Symbol.asyncIterator"))&&void 0!==je?je:"@@asyncIterator";function Ye(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=He(e,Ge)))return function(e){const t={next(){let t;try{t=Ke(e)}catch(e){return z(e)}return ze(t)},return(t){let r;try{const n=He(e.iterator,"return");if(void 0===n)return H({done:!0,value:t});r=ee(n,e.iterator,[t])}catch(e){return z(e)}return D(r)?ze(r):z(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(Ye(e,"sync",He(e,Symbol.iterator)))}else r=He(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const n=ee(r,e,[]);if(!D(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Ke(e){const t=ee(e.nextMethod,e.iterator,[]);if(!D(t))throw new TypeError("The iterator.next() method must return an object");return t}class Qe{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?Z(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?Z(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const n=$(((e,n)=>{t=e,r=n}));return Ne(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,X((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,le(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,le(e),r(t)}}),n}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=ce(t,e);return le(t),Z(r,(()=>({value:e,done:!0})))}return le(t),H({value:e,done:!0})}}const Ze={next(){return Je(this)?this._asyncIteratorImpl.next():z(Xe("next"))},return(e){return Je(this)?this._asyncIteratorImpl.return(e):z(Xe("return"))},[Ge](){return this}};function Je(e){if(!D(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Qe}catch(e){return!1}}function Xe(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Ze,Ge,{enumerable:!1});const et=Number.isNaN||function(e){return e!=e};function tt(e){const t=$e(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function rt(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function nt(e,t,r){if("number"!=typeof(n=r)||et(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function ot(e){e._queue=new re,e._queueTotalSize=0}function it(e){return e===DataView}class st{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ct(this))throw Nt("view");return this._view}respond(e){if(!ct(this))throw Nt("respond");if(we(e,1,"respond"),e=Ee(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ve(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Ut(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ct(this))throw Nt("respondWithNewView");if(we(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ve(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Lt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(st.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),M(st.prototype.respond,"respond"),M(st.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(st.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class at{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ut(this))throw qt("byobRequest");return Ct(this)}get desiredSize(){if(!ut(this))throw qt("desiredSize");return At(this)}close(){if(!ut(this))throw qt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);Et(this)}enqueue(e){if(!ut(this))throw qt("enqueue");if(we(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);Rt(this,e)}error(e=void 0){if(!ut(this))throw qt("error");Pt(this,e)}[ie](e){ht(this),ot(this);const t=this._cancelAlgorithm(e);return It(this),t}[se](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Ot(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let n;try{n=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}Oe(t,e),lt(this)}[ae](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new re,this._pendingPullIntos.push(e)}}}function ut(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof at}function ct(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof st}function lt(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Ue(t)&&Ae(t)>0)||(!!(Bt(t)&&jt(t)>0)||At(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,lt(e)),null)),(t=>(Pt(e,t),null)))))}function ht(e){bt(e),e._pendingPullIntos=new re}function dt(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=ft(t);"default"===t.readerType?Ce(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function ft(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function pt(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function mt(e,t,r,n){let o;try{o=$e(t,r,r+n)}catch(t){throw Pt(e,t),t}pt(e,o,0,n)}function gt(e,t){t.bytesFilled>0&&mt(e,t.buffer,t.byteOffset,t.bytesFilled),Tt(e)}function yt(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const s=n-n%t.elementSize;s>=t.minimumFill&&(o=s-t.bytesFilled,i=!0);const a=e._queue;for(;o>0;){const r=a.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;We(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?a.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,_t(0,n,t),o-=n}return i}function _t(e,t,r){r.bytesFilled+=t}function vt(e){0===e._queueTotalSize&&e._closeRequested?(It(e),vn(e._controlledReadableByteStream)):lt(e)}function bt(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function wt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();yt(e,t)&&(Tt(e),dt(e._controlledReadableByteStream,t))}}function St(e,t){const r=e._pendingPullIntos.peek();bt(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Tt(e);const r=e._controlledReadableByteStream;if(Bt(r))for(;jt(r)>0;)dt(r,Tt(e))}(e,r):function(e,t,r){if(_t(0,t,r),"none"===r.readerType)return gt(e,r),void wt(e);if(r.bytesFilled<r.minimumFill)return;Tt(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;mt(e,r.buffer,t-n,n)}r.bytesFilled-=n,dt(e._controlledReadableByteStream,r),wt(e)}(e,t,r),lt(e)}function Tt(e){return e._pendingPullIntos.shift()}function It(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Et(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Pt(e,t),t}}It(e),vn(t)}}function Rt(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(Ve(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const s=Fe(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(Ve(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");bt(e),t.buffer=Fe(t.buffer),"none"===t.readerType&>(e,t)}Ue(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Ot(e,t._readRequests.shift())}}(e),0===Ae(r)?pt(e,s,o,i):(e._pendingPullIntos.length>0&&Tt(e),Ce(r,new Uint8Array(s,o,i),!1))):Bt(r)?(pt(e,s,o,i),wt(e)):pt(e,s,o,i),lt(e)}function Pt(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(ht(e),ot(e),It(e),bn(r,t))}function Ot(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,vt(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function Ct(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(st.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function At(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ut(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=Fe(r.buffer),St(e,t)}function Lt(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const n=t.byteLength;r.buffer=Fe(t.buffer),St(e,n)}function kt(e,t,r,n,o,i,s){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,ot(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=s,t._pendingPullIntos=new re,e._readableStreamController=t,Y(H(r()),(()=>(t._started=!0,lt(t),null)),(e=>(Pt(t,e),null)))}function Nt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function qt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Dt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function xt(e){return new Wt(e)}function Mt(e,t){e._reader._readIntoRequests.push(t)}function jt(e){return e._reader._readIntoRequests.length}function Bt(e){const t=e._reader;return void 0!==t&&!!Ft(t)}Object.defineProperties(at.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),M(at.prototype.close,"close"),M(at.prototype.enqueue,"enqueue"),M(at.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(at.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Wt{constructor(e){if(we(e,1,"ReadableStreamBYOBReader"),Re(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ut(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ue(this,e),this._readIntoRequests=new re}get closed(){return Ft(this)?this._closedPromise:z(Ht("closed"))}cancel(e=void 0){return Ft(this)?void 0===this._ownerReadableStream?z(he("cancel")):ce(this,e):z(Ht("cancel"))}read(e,t={}){if(!Ft(this))return z(Ht("read"));if(!ArrayBuffer.isView(e))return z(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return z(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return z(new TypeError("view's buffer must have non-zero byteLength"));if(Ve(e.buffer))return z(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return _e(e,t),{min:Ee(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return z(e)}const n=r.min;if(0===n)return z(new TypeError("options.min must be greater than 0"));if(function(e){return it(e.constructor)}(e)){if(n>e.byteLength)return z(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return z(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return z(he("read from"));let o,i;const s=$(((e,t)=>{o=e,i=t}));return Vt(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),s}releaseLock(){if(!Ft(this))throw Ht("releaseLock");void 0!==this._ownerReadableStream&&function(e){le(e),$t(e,new TypeError("Reader was released"))}(this)}}function Ft(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Wt}function Vt(e,t,r,n){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?n._errorSteps(o._storedError):function(e,t,r,n){const o=e._controlledReadableByteStream,i=t.constructor,s=function(e){return it(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:a,byteLength:u}=t,c=r*s;let l;try{l=Fe(t.buffer)}catch(e){return void n._errorSteps(e)}const h={buffer:l,bufferByteLength:l.byteLength,byteOffset:a,byteLength:u,bytesFilled:0,minimumFill:c,elementSize:s,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(h),void Mt(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(yt(e,h)){const t=ft(h);return vt(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Pt(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(h),Mt(o,n),lt(e)}else{const e=new i(h.buffer,h.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function $t(e,t){const r=e._readIntoRequests;e._readIntoRequests=new re,r.forEach((e=>{e._errorSteps(t)}))}function Ht(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function zt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(et(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Gt(e){const{size:t}=e;return t||(()=>1)}function Yt(e,t){_e(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Te(r),size:void 0===n?void 0:Kt(n,`${t} has member 'size' that`)}}function Kt(e,t){return ve(e,t),t=>Te(e(t))}function Qt(e,t,r){return ve(e,r),r=>te(e,t,[r])}function Zt(e,t,r){return ve(e,r),()=>te(e,t,[])}function Jt(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function Xt(e,t,r){return ve(e,r),(r,n)=>te(e,t,[r,n])}function er(e,t){if(!ir(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Wt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),M(Wt.prototype.cancel,"cancel"),M(Wt.prototype.read,"read"),M(Wt.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const tr="function"==typeof AbortController;class rr{constructor(e={},t={}){void 0===e?e=null:be(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){_e(e,t);const r=null==e?void 0:e.abort,n=null==e?void 0:e.close,o=null==e?void 0:e.start,i=null==e?void 0:e.type,s=null==e?void 0:e.write;return{abort:void 0===r?void 0:Qt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:Zt(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:Jt(o,e,`${t} has member 'start' that`),write:void 0===s?void 0:Xt(s,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(or(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=Gt(r);!function(e,t,r,n){const o=Object.create(Sr.prototype);let i,s,a,u;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.write?e=>t.write(e,o):()=>H(void 0),a=void 0!==t.close?()=>t.close():()=>H(void 0),u=void 0!==t.abort?e=>t.abort(e):()=>H(void 0),Ir(e,o,i,s,a,u,r,n)}(this,n,zt(r,1),o)}get locked(){if(!ir(this))throw Ur("locked");return sr(this)}abort(e=void 0){return ir(this)?sr(this)?z(new TypeError("Cannot abort a stream that already has a writer")):ar(this,e):z(Ur("abort"))}close(){return ir(this)?sr(this)?z(new TypeError("Cannot close a stream that already has a writer")):dr(this)?z(new TypeError("Cannot close an already-closing stream")):ur(this):z(Ur("close"))}getWriter(){if(!ir(this))throw Ur("getWriter");return nr(this)}}function nr(e){return new mr(e)}function or(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new re,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function ir(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof rr}function sr(e){return void 0!==e._writer}function ar(e,t){var r;if("closed"===e._state||"errored"===e._state)return H(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const n=e._state;if("closed"===n||"errored"===n)return H(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=$(((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}}));return e._pendingAbortRequest._promise=i,o||lr(e,t),i}function ur(e){const t=e._state;if("closed"===t||"errored"===t)return z(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=$(((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n})),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&Vr(n),nt(o=e._writableStreamController,wr,0),Pr(o),r}function cr(e,t){"writable"!==e._state?hr(e):lr(e,t)}function lr(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&_r(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&hr(e)}function hr(e){e._state="errored",e._writableStreamController[oe]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new re,void 0===e._pendingAbortRequest)return void fr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void fr(e);Y(e._writableStreamController[ne](r._reason),(()=>(r._resolve(),fr(e),null)),(t=>(r._reject(t),fr(e),null)))}function dr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function fr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&xr(t,e._storedError)}function pr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){jr(e)}(r):Vr(r)),e._backpressure=t}Object.defineProperties(rr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),M(rr.prototype.abort,"abort"),M(rr.prototype.close,"close"),M(rr.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(rr.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class mr{constructor(e){if(we(e,1,"WritableStreamDefaultWriter"),er(e,"First parameter"),sr(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!dr(e)&&e._backpressure?jr(this):Wr(this),qr(this);else if("erroring"===t)Br(this,e._storedError),qr(this);else if("closed"===t)Wr(this),qr(this),Mr(this);else{const t=e._storedError;Br(this,t),Dr(this,t)}}get closed(){return gr(this)?this._closedPromise:z(kr("closed"))}get desiredSize(){if(!gr(this))throw kr("desiredSize");if(void 0===this._ownerWritableStream)throw Nr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Rr(t._writableStreamController)}(this)}get ready(){return gr(this)?this._readyPromise:z(kr("ready"))}abort(e=void 0){return gr(this)?void 0===this._ownerWritableStream?z(Nr("abort")):function(e,t){return ar(e._ownerWritableStream,t)}(this,e):z(kr("abort"))}close(){if(!gr(this))return z(kr("close"));const e=this._ownerWritableStream;return void 0===e?z(Nr("close")):dr(e)?z(new TypeError("Cannot close an already-closing stream")):yr(this)}releaseLock(){if(!gr(this))throw kr("releaseLock");void 0!==this._ownerWritableStream&&vr(this)}write(e=void 0){return gr(this)?void 0===this._ownerWritableStream?z(Nr("write to")):br(this,e):z(kr("write"))}}function gr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof mr}function yr(e){return ur(e._ownerWritableStream)}function _r(e,t){"pending"===e._readyPromiseState?Fr(e,t):function(e,t){Br(e,t)}(e,t)}function vr(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");_r(e,r),function(e,t){"pending"===e._closedPromiseState?xr(e,t):function(e,t){Dr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function br(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Or(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return z(Nr("write to"));const i=r._state;if("errored"===i)return z(r._storedError);if(dr(r)||"closed"===i)return z(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return z(r._storedError);const s=function(e){return $(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{nt(e,t,r)}catch(t){return void Or(e,t)}const n=e._controlledWritableStream;dr(n)||"writable"!==n._state||pr(n,Cr(e)),Pr(e)}(n,t,o),s}Object.defineProperties(mr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),M(mr.prototype.abort,"abort"),M(mr.prototype.close,"close"),M(mr.prototype.releaseLock,"releaseLock"),M(mr.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(mr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const wr={};class Sr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Tr(this))throw Lr("abortReason");return this._abortReason}get signal(){if(!Tr(this))throw Lr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Tr(this))throw Lr("error");"writable"===this._controlledWritableStream._state&&Ar(this,e)}[ne](e){const t=this._abortAlgorithm(e);return Er(this),t}[oe](){ot(this)}}function Tr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Sr}function Ir(e,t,r,n,o,i,s,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._abortReason=void 0,t._abortController=function(){if(tr)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=s,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const u=Cr(t);pr(e,u),Y(H(r()),(()=>(t._started=!0,Pr(t),null)),(r=>(t._started=!0,cr(e,r),null)))}function Er(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Rr(e){return e._strategyHWM-e._queueTotalSize}function Pr(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void hr(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===wr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),rt(e);const r=e._closeAlgorithm();Er(e),Y(r,(()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&Mr(t)}(t),null)),(e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),cr(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),Y(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(rt(e),!dr(r)&&"writable"===t){const t=Cr(e);pr(r,t)}return Pr(e),null}),(t=>("writable"===r._state&&Er(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,cr(e,t)}(r,t),null)))}(e,r)}function Or(e,t){"writable"===e._controlledWritableStream._state&&Ar(e,t)}function Cr(e){return Rr(e)<=0}function Ar(e,t){const r=e._controlledWritableStream;Er(e),lr(r,t)}function Ur(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Lr(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function kr(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Nr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function qr(e){e._closedPromise=$(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function Dr(e,t){qr(e),xr(e,t)}function xr(e,t){void 0!==e._closedPromise_reject&&(J(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Mr(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function jr(e){e._readyPromise=$(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function Br(e,t){jr(e),Fr(e,t)}function Wr(e){jr(e),Vr(e)}function Fr(e,t){void 0!==e._readyPromise_reject&&(J(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Vr(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Sr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Sr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const $r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,Hr=function(){const e=null==$r?void 0:$r.DOMException;return function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;if("DOMException"!==e.name)return!1;try{return new e,!0}catch(e){return!1}}(e)?e:void 0}()||function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return M(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function zr(e,t,r,n,o,i){const s=Pe(e),a=nr(t);e._disturbed=!0;let u=!1,c=H(void 0);return $(((l,h)=>{let d;if(void 0!==i){if(d=()=>{const r=void 0!==i.reason?i.reason:new Hr("Aborted","AbortError"),s=[];n||s.push((()=>"writable"===t._state?ar(t,r):H(void 0))),o||s.push((()=>"readable"===e._state?_n(e,r):H(void 0))),_((()=>Promise.all(s.map((e=>e())))),!0,r)},i.aborted)return void d();i.addEventListener("abort",d)}var f,p,m;if(y(e,s._closedPromise,(e=>(n?v(!0,e):_((()=>ar(t,e)),!0,e),null))),y(t,a._closedPromise,(t=>(o?v(!0,t):_((()=>_n(e,t)),!0,t),null))),f=e,p=s._closedPromise,m=()=>(r?v():_((()=>function(e){const t=e._ownerWritableStream,r=t._state;return dr(t)||"closed"===r?H(void 0):"errored"===r?z(t._storedError):yr(e)}(a))),null),"closed"===f._state?m():K(p,m),dr(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");o?v(!0,t):_((()=>_n(e,t)),!0,t)}function g(){const e=c;return G(c,(()=>e!==c?g():void 0))}function y(e,t,r){"errored"===e._state?r(e._storedError):Q(t,r)}function _(e,r,n){function o(){return Y(e(),(()=>b(r,n)),(e=>b(!0,e))),null}u||(u=!0,"writable"!==t._state||dr(t)?o():K(g(),o))}function v(e,r){u||(u=!0,"writable"!==t._state||dr(t)?b(e,r):K(g(),(()=>b(e,r))))}function b(e,t){return vr(a),le(s),void 0!==i&&i.removeEventListener("abort",d),e?h(t):l(void 0),null}J($(((e,t)=>{!function r(n){n?e():G(u?H(!0):G(a._readyPromise,(()=>$(((e,t)=>{Ne(s,{_chunkSteps:t=>{c=G(br(a,t),void 0,q),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class Gr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Yr(this))throw on("desiredSize");return tn(this)}close(){if(!Yr(this))throw on("close");if(!rn(this))throw new TypeError("The stream is not in a state that permits close");Jr(this)}enqueue(e=void 0){if(!Yr(this))throw on("enqueue");if(!rn(this))throw new TypeError("The stream is not in a state that permits enqueue");return Xr(this,e)}error(e=void 0){if(!Yr(this))throw on("error");en(this,e)}[ie](e){ot(this);const t=this._cancelAlgorithm(e);return Zr(this),t}[se](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=rt(this);this._closeRequested&&0===this._queue.length?(Zr(this),vn(t)):Kr(this),e._chunkSteps(r)}else Oe(t,e),Kr(this)}[ae](){}}function Yr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Gr}function Kr(e){Qr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Kr(e)),null)),(t=>(en(e,t),null)))))}function Qr(e){const t=e._controlledReadableStream;return!!rn(e)&&!!e._started&&(!!(yn(t)&&Ae(t)>0)||tn(e)>0)}function Zr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Jr(e){if(!rn(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Zr(e),vn(t))}function Xr(e,t){if(!rn(e))return;const r=e._controlledReadableStream;if(yn(r)&&Ae(r)>0)Ce(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw en(e,t),t}try{nt(e,t,r)}catch(t){throw en(e,t),t}}Kr(e)}function en(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(ot(e),Zr(e),bn(r,t))}function tn(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function rn(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function nn(e,t,r,n,o,i,s){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=s,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,Y(H(r()),(()=>(t._started=!0,Kr(t),null)),(e=>(en(t,e),null)))}function on(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function sn(e){return D(t=e)&&void 0!==t.getReader?function(e){let t;return t=fn(q,(function(){let r;try{r=e.read()}catch(r){return z(r)}return Z(r,(e=>{if(!D(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)Jr(t._readableStreamController);else{const r=e.value;Xr(t._readableStreamController,r)}}))}),(function(t){try{return H(e.cancel(t))}catch(t){return z(t)}}),0),t}(e.getReader()):function(e){let t;const r=Ye(e,"async");return t=fn(q,(function(){let e;try{e=Ke(r)}catch(e){return z(e)}return Z(H(e),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)Jr(t._readableStreamController);else{const r=e.value;Xr(t._readableStreamController,r)}}))}),(function(e){const t=r.iterator;let n;try{n=He(t,"return")}catch(e){return z(e)}return void 0===n?H(void 0):Z(te(n,t,[e]),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}))}),0),t}(e);var t}function an(e,t,r){return ve(e,r),r=>te(e,t,[r])}function un(e,t,r){return ve(e,r),r=>te(e,t,[r])}function cn(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function ln(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function hn(e,t){_e(e,t);const r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,o=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(`${t} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(Gr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),M(Gr.prototype.close,"close"),M(Gr.prototype.enqueue,"enqueue"),M(Gr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Gr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class dn{constructor(e={},t={}){void 0===e?e=null:be(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){_e(e,t);const r=e,n=null==r?void 0:r.autoAllocateChunkSize,o=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,s=null==r?void 0:r.start,a=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Ee(n,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===o?void 0:an(o,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:un(i,r,`${t} has member 'pull' that`),start:void 0===s?void 0:cn(s,r,`${t} has member 'start' that`),type:void 0===a?void 0:ln(a,`${t} has member 'type' that`)}}(e,"First parameter");if(mn(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const n=Object.create(at.prototype);let o,i,s;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>H(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>H(void 0);const a=t.autoAllocateChunkSize;if(0===a)throw new TypeError("autoAllocateChunkSize must be greater than 0");kt(e,n,o,i,s,r,a)}(this,n,zt(r,0))}else{const e=Gt(r);!function(e,t,r,n){const o=Object.create(Gr.prototype);let i,s,a;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.pull?()=>t.pull(o):()=>H(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>H(void 0),nn(e,o,i,s,a,r,n)}(this,n,zt(r,1),e)}}get locked(){if(!gn(this))throw wn("locked");return yn(this)}cancel(e=void 0){return gn(this)?yn(this)?z(new TypeError("Cannot cancel a stream that already has a reader")):_n(this,e):z(wn("cancel"))}getReader(e=void 0){if(!gn(this))throw wn("getReader");return void 0===function(e,t){_e(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Dt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Pe(this):xt(this)}pipeThrough(e,t={}){if(!gn(this))throw wn("pipeThrough");we(e,1,"pipeThrough");const r=function(e,t){_e(e,t);const r=null==e?void 0:e.readable;Se(r,"readable","ReadableWritablePair"),Re(r,`${t} has member 'readable' that`);const n=null==e?void 0:e.writable;return Se(n,"writable","ReadableWritablePair"),er(n,`${t} has member 'writable' that`),{readable:r,writable:n}}(e,"First parameter"),n=hn(t,"Second parameter");if(yn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(sr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return J(zr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!gn(this))return z(wn("pipeTo"));if(void 0===e)return z("Parameter 1 is required in 'pipeTo'.");if(!ir(e))return z(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=hn(t,"Second parameter")}catch(e){return z(e)}return yn(this)?z(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):sr(e)?z(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):zr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!gn(this))throw wn("tee");return Be(function(e){return ut(e._readableStreamController)?function(e){let t,r,n,o,i,s=Pe(e),a=!1,u=!1,c=!1,l=!1,h=!1;const d=$((e=>{i=e}));function f(e){Q(e._closedPromise,(t=>(e!==s||(Pt(n._readableStreamController,t),Pt(o._readableStreamController,t),l&&h||i(void 0)),null)))}function p(){Ft(s)&&(le(s),s=Pe(e),f(s)),Ne(s,{_chunkSteps:t=>{X((()=>{u=!1,c=!1;const r=t;let s=t;if(!l&&!h)try{s=tt(t)}catch(t){return Pt(n._readableStreamController,t),Pt(o._readableStreamController,t),void i(_n(e,t))}l||Rt(n._readableStreamController,r),h||Rt(o._readableStreamController,s),a=!1,u?g():c&&y()}))},_closeSteps:()=>{a=!1,l||Et(n._readableStreamController),h||Et(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&Ut(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Ut(o._readableStreamController,0),l&&h||i(void 0)},_errorSteps:()=>{a=!1}})}function m(t,r){ke(s)&&(le(s),s=xt(e),f(s));const d=r?o:n,p=r?n:o;Vt(s,t,1,{_chunkSteps:t=>{X((()=>{u=!1,c=!1;const n=r?h:l;if(r?l:h)n||Lt(d._readableStreamController,t);else{let r;try{r=tt(t)}catch(t){return Pt(d._readableStreamController,t),Pt(p._readableStreamController,t),void i(_n(e,t))}n||Lt(d._readableStreamController,t),Rt(p._readableStreamController,r)}a=!1,u?g():c&&y()}))},_closeSteps:e=>{a=!1;const t=r?h:l,n=r?l:h;t||Et(d._readableStreamController),n||Et(p._readableStreamController),void 0!==e&&(t||Lt(d._readableStreamController,e),!n&&p._readableStreamController._pendingPullIntos.length>0&&Ut(p._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{a=!1}})}function g(){if(a)return u=!0,H(void 0);a=!0;const e=Ct(n._readableStreamController);return null===e?p():m(e._view,!1),H(void 0)}function y(){if(a)return c=!0,H(void 0);a=!0;const e=Ct(o._readableStreamController);return null===e?p():m(e._view,!0),H(void 0)}function _(){}return n=pn(_,g,(function(n){if(l=!0,t=n,h){const n=Be([t,r]),o=_n(e,n);i(o)}return d})),o=pn(_,y,(function(n){if(h=!0,r=n,l){const n=Be([t,r]),o=_n(e,n);i(o)}return d})),f(s),[n,o]}(e):function(e){const t=Pe(e);let r,n,o,i,s,a=!1,u=!1,c=!1,l=!1;const h=$((e=>{s=e}));function d(){return a?(u=!0,H(void 0)):(a=!0,Ne(t,{_chunkSteps:e=>{X((()=>{u=!1;const t=e,r=e;c||Xr(o._readableStreamController,t),l||Xr(i._readableStreamController,r),a=!1,u&&d()}))},_closeSteps:()=>{a=!1,c||Jr(o._readableStreamController),l||Jr(i._readableStreamController),c&&l||s(void 0)},_errorSteps:()=>{a=!1}}),H(void 0))}function f(){}return o=fn(f,d,(function(t){if(c=!0,r=t,l){const t=Be([r,n]),o=_n(e,t);s(o)}return h})),i=fn(f,d,(function(t){if(l=!0,n=t,c){const t=Be([r,n]),o=_n(e,t);s(o)}return h})),Q(t._closedPromise,(e=>(en(o._readableStreamController,e),en(i._readableStreamController,e),c&&l||s(void 0),null))),[o,i]}(e)}(this))}values(e=void 0){if(!gn(this))throw wn("values");return function(e,t){const r=Pe(e),n=new Qe(r,t),o=Object.create(Ze);return o._asyncIteratorImpl=n,o}(this,function(e){_e(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[Ge](e){return this.values(e)}static from(e){return sn(e)}}function fn(e,t,r,n=1,o=()=>1){const i=Object.create(dn.prototype);return mn(i),nn(i,Object.create(Gr.prototype),e,t,r,n,o),i}function pn(e,t,r){const n=Object.create(dn.prototype);return mn(n),kt(n,Object.create(at.prototype),e,t,r,0,void 0),n}function mn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function gn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof dn}function yn(e){return void 0!==e._reader}function _n(e,t){if(e._disturbed=!0,"closed"===e._state)return H(void 0);if("errored"===e._state)return z(e._storedError);vn(e);const r=e._reader;if(void 0!==r&&Ft(r)){const e=r._readIntoRequests;r._readIntoRequests=new re,e.forEach((e=>{e._closeSteps(void 0)}))}return Z(e._readableStreamController[ie](t),q)}function vn(e){e._state="closed";const t=e._reader;if(void 0!==t&&(me(t),ke(t))){const e=t._readRequests;t._readRequests=new re,e.forEach((e=>{e._closeSteps()}))}}function bn(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(pe(r,t),ke(r)?qe(r,t):$t(r,t))}function wn(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Sn(e,t){_e(e,t);const r=null==e?void 0:e.highWaterMark;return Se(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Te(r)}}Object.defineProperties(dn,{from:{enumerable:!0}}),Object.defineProperties(dn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),M(dn.from,"from"),M(dn.prototype.cancel,"cancel"),M(dn.prototype.getReader,"getReader"),M(dn.prototype.pipeThrough,"pipeThrough"),M(dn.prototype.pipeTo,"pipeTo"),M(dn.prototype.tee,"tee"),M(dn.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(dn.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(dn.prototype,Ge,{value:dn.prototype.values,writable:!0,configurable:!0});const Tn=e=>e.byteLength;M(Tn,"size");class In{constructor(e){we(e,1,"ByteLengthQueuingStrategy"),e=Sn(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Rn(this))throw En("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Rn(this))throw En("size");return Tn}}function En(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Rn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof In}Object.defineProperties(In.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(In.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Pn=()=>1;M(Pn,"size");class On{constructor(e){we(e,1,"CountQueuingStrategy"),e=Sn(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!An(this))throw Cn("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!An(this))throw Cn("size");return Pn}}function Cn(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function An(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof On}function Un(e,t,r){return ve(e,r),r=>te(e,t,[r])}function Ln(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function kn(e,t,r){return ve(e,r),(r,n)=>te(e,t,[r,n])}function Nn(e,t,r){return ve(e,r),r=>te(e,t,[r])}Object.defineProperties(On.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(On.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class qn{constructor(e={},t={},r={}){void 0===e&&(e=null);const n=Yt(t,"Second parameter"),o=Yt(r,"Third parameter"),i=function(e,t){_e(e,t);const r=null==e?void 0:e.cancel,n=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,i=null==e?void 0:e.start,s=null==e?void 0:e.transform,a=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:Nn(r,e,`${t} has member 'cancel' that`),flush:void 0===n?void 0:Un(n,e,`${t} has member 'flush' that`),readableType:o,start:void 0===i?void 0:Ln(i,e,`${t} has member 'start' that`),transform:void 0===s?void 0:kn(s,e,`${t} has member 'transform' that`),writableType:a}}(e,"First parameter");if(void 0!==i.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==i.writableType)throw new RangeError("Invalid writableType specified");const s=zt(o,0),a=Gt(o),u=zt(n,1),c=Gt(n);let l;!function(e,t,r,n,o,i){function s(){return t}e._writable=function(e,t,r,n,o=1,i=()=>1){const s=Object.create(rr.prototype);return or(s),Ir(s,Object.create(Sr.prototype),e,t,r,n,o,i),s}(s,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?Z(e._backpressureChangePromise,(()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return Hn(r,t)})):Hn(r,t)}(e,t)}),(function(){return function(e){const t=e._transformStreamController;if(void 0!==t._finishPromise)return t._finishPromise;const r=e._readable;t._finishPromise=$(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const n=t._flushAlgorithm();return Vn(t),Y(n,(()=>("errored"===r._state?Yn(t,r._storedError):(Jr(r._readableStreamController),Gn(t)),null)),(e=>(en(r._readableStreamController,e),Yn(t,e),null))),t._finishPromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._readable;r._finishPromise=$(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return Vn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(en(n._readableStreamController,t),Gn(r)),null)),(e=>(en(n._readableStreamController,e),Yn(r,e),null))),r._finishPromise}(e,t)}),r,n),e._readable=fn(s,(function(){return function(e){return Bn(e,!1),e._backpressureChangePromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._writable;r._finishPromise=$(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return Vn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(Or(n._writableStreamController,t),jn(e),Gn(r)),null)),(t=>(Or(n._writableStreamController,t),jn(e),Yn(r,t),null))),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Bn(e,!0),e._transformStreamController=void 0}(this,$((e=>{l=e})),u,c,s,a),function(e,t){const r=Object.create(Wn.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return $n(r,e),H(void 0)}catch(e){return z(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>H(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>H(void 0),function(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,n,o,i)}(this,i),void 0!==i.start?l(i.start(this._transformStreamController)):l(void 0)}get readable(){if(!Dn(this))throw Kn("readable");return this._readable}get writable(){if(!Dn(this))throw Kn("writable");return this._writable}}function Dn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof qn}function xn(e,t){en(e._readable._readableStreamController,t),Mn(e,t)}function Mn(e,t){Vn(e._transformStreamController),Or(e._writable._writableStreamController,t),jn(e)}function jn(e){e._backpressure&&Bn(e,!1)}function Bn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=$((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(qn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(qn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class Wn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Fn(this))throw zn("desiredSize");return tn(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Fn(this))throw zn("enqueue");$n(this,e)}error(e=void 0){if(!Fn(this))throw zn("error");var t;t=e,xn(this._controlledTransformStream,t)}terminate(){if(!Fn(this))throw zn("terminate");!function(e){const t=e._controlledTransformStream;Jr(t._readable._readableStreamController),Mn(t,new TypeError("TransformStream terminated"))}(this)}}function Fn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Wn}function Vn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function $n(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!rn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Xr(n,t)}catch(e){throw Mn(r,e),r._readable._storedError}const o=function(e){return!Qr(e)}(n);o!==r._backpressure&&Bn(r,!0)}function Hn(e,t){return Z(e._transformAlgorithm(t),void 0,(t=>{throw xn(e._controlledTransformStream,t),t}))}function zn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Gn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Yn(e,t){void 0!==e._finishPromise_reject&&(J(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Kn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Wn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),M(Wn.prototype.enqueue,"enqueue"),M(Wn.prototype.error,"error"),M(Wn.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Qn,Zn=(Qn=function(e,t){return Qn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},Qn(e,t)},function(e,t){function r(){this.constructor=e}Qn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Jn=function(){return Jn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jn.apply(this,arguments)},Xn=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return Zn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,n){var o=e.url,i=e.data,s=e.headers,a=wx.request({url:(0,N.formatUrl)("https:",o),data:i,timeout:t._timeout,method:"POST",header:s,success:function(e){r(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("post")&&"request:fail timeout"===e.errMsg){console.warn(t._timeoutMsg);try{a.abort()}catch(e){}}}})}))},t.prototype.upload=function(e){var t=this,r=this;return new Promise((function(n){return function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var t,o,i,s,a,u;return function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(c){return t=e.url,o=e.file,i=e.data,s=e.headers,a=e.onUploadProgress,u=wx.uploadFile({url:t,filePath:o,name:"file",formData:Jn({},i),header:s,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(t.statusCode=parseInt(i.success_action_status,10)),n(t)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{u.abort()}catch(e){}}}}),a&&u.onProgressUpdate((function(e){a(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,r=this;return new Promise((function(n,o){var i=e.url,s=e.headers,a=wx.downloadFile({url:(0,N.formatUrl)("https:",i),header:s,timeout:t._timeout,success:function(e){200===e.statusCode&&e.tempFilePath?n({statusCode:200,tempFilePath:e.tempFilePath}):n(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("download")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{a.abort()}catch(e){}}}})}))},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,s=e.stream,a=void 0!==s&&s,u=this,c=null,l=new dn({start:function(e){c=e},cancel:function(){c=null}});return new Promise((function(e,s){a&&e({data:l});var h=wx.request({url:(0,N.formatUrl)("https:",t),data:r,timeout:u._timeout,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=c)||void 0===r||r.close(),!a&&e(t)},fail:function(e){var t;if(null===(t=c)||void 0===t||t.close(),s(e),a)throw e},complete:function(e){if(e&&e.errMsg&&u._timeout&&-1!==u._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg){console.warn(u._timeoutMsg);try{h.abort()}catch(e){}}},enableChunked:a});h.onChunkReceived((function(e){var t;null===(t=c)||void 0===t||t.enqueue(e.data)}))}))},t}(N.AbstractSDKRequest),eo={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}},to=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(Jn({url:e},t));return{set onopen(e){r.onOpen(e)},set onmessage(e){r.onMessage(e)},set onclose(e){r.onClose(e)},set onerror(e){r.onError(e)},send:function(e){return r.send({data:e})},close:function(e,t){return r.close({code:e,reason:t})},get readyState(){return r.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};const ro=function(){return{root:{},reqClass:Xn,wsClass:to,localStorage:eo,primaryStorage:N.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.plugin.appId:""}}},no=function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0};var oo=r(105),io=function(){return io=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},io.apply(this,arguments)},so=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},ao=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},uo=function(){function e(e){this.localStorage=(null==e?void 0:e.localStorage)||globalThis.localStorage}return e.prototype.getItem=function(e){return so(this,void 0,void 0,(function(){return ao(this,(function(t){return[2,this.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return so(this,void 0,void 0,(function(){return ao(this,(function(t){return this.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return so(this,void 0,void 0,(function(){return ao(this,(function(r){return this.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),co=/^[^:]+:\/\/[^/]+(\/[^?#]+)/;var lo=function(e){if(!no()||e.storage&&e.baseRequest)return e;var t={};try{var r=ro(),n=r.localStorage,o=r.reqClass;if(n&&(t.storage=new uo({localStorage:n})),o){var i=new o({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});t.request=function(e){return function(t,r){var n;return so(this,void 0,void 0,(function(){var o;return ao(this,(function(i){return o=null===(n=null==r?void 0:r.headers)||void 0===n?void 0:n["x-request-id"],[2,new Promise((function(n,i){var s=Object.assign({},r);s.body&&"string"!=typeof s.body&&(s.body=JSON.stringify(s.body));var a=wx.request({url:t,data:s.body,timeout:e._timeout,method:s.method||"GET",header:s.headers,success:function(e){e.code&&(e={error:e.code,error_description:e.message||e.code,request_id:e.requestId}),e.request_id||(e.request_id=e.request_id||o),e.error&&(e.error_uri=function(e){return co.test(e)?RegExp.$1:e}(t),i(e)),n(e.data||{})},fail:function(e){i({error:"unreachable",error_description:e.message})},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("request")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{a.abort()}catch(e){}}}})}))]}))}))}}(i)}return io(io({},e),t)}catch(e){console.error("adapter generate fail:",e)}return e},ho=function(){return ho=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ho.apply(this,arguments)},fo=function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},po=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},mo=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},go=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},yo="loginStateChanged",_o=new L.CloudbaseEventEmitter,vo=function(){function e(e){var t=e.cache,r=e.oauthInstance;this.cache=t,this.oauthInstance=r,this.setUserInfo()}return e.prototype.checkLocalInfo=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return mo(this,void 0,void 0,(function(){var e,t,r,n;return go(this,(function(o){switch(o.label){case 0:return e=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return e.uid=o.sent(),t=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return t.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),r=this,[4,this.getLocalUserInfoAsync("email")];case 3:return r.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),n=this,[4,this.getLocalUserInfoAsync("username")];case 4:return n.username=o.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},e.prototype.update=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(ho({},e))];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2]}}))}))},e.prototype.updateUserBasicInfo=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(ho({},e))];case 1:return t.sent(),this.setLocalUserInfo({username:e.username}),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&(0,C.throwError)(A.ERRORS.INVALID_PARAMS,"username must be a string"),this.update({username:e})},e.prototype.refresh=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2,t]}}))}))},e.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;return this.cache.getStore(t)[e]},e.prototype.getLocalUserInfoAsync=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,r.sent()[e]]}}))}))},e.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(t){e[t]=r[t]}))},e.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},fo([(0,U.catchErrorsDecorator)({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"update",null),fo([(0,U.catchErrorsDecorator)({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[String,String]),po("design:returntype",void 0)],e.prototype,"updatePassword",null),fo([(0,U.catchErrorsDecorator)({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[String]),po("design:returntype",void 0)],e.prototype,"updateUsername",null),fo([(0,U.catchErrorsDecorator)({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"refresh",null),e}(),bo=function(){function e(e){var t=e.envId,r=e.cache,n=e.oauthInstance;t||(0,C.throwError)(A.ERRORS.INVALID_PARAMS,"envId is not defined"),this.cache=r,this.oauthInstance=n,this.user=new vo({cache:this.cache,oauthInstance:n})}return e.prototype.checkLocalState=function(){var e;this.oauthLoginState=null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){var e;return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.getLoginState()];case 1:return t.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return t.sent(),[2]}}))}))},e}(),wo=function(){function e(e){this.config=e,this.cache=e.cache,this.oauthInstance=e.oauthInstance}return e.prototype.bindPhoneNumber=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.editContact(e)]}))}))},e.prototype.unbindProvider=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]}))}))},e.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},e.prototype.verify=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.verify(e)]}))}))},e.prototype.getVerification=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getVerification(e)]}))}))},Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var e=this.hasLoginState();return e&&e.user||null}(0,C.printWarn)(A.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),e.prototype.getCurrentUser=function(){return mo(this,void 0,void 0,(function(){var e;return go(this,(function(t){switch(t.label){case 0:return[4,this.getLoginState()];case 1:return(e=t.sent())?[4,e.user.checkLocalInfoAsync()]:[3,3];case 2:return t.sent(),[2,e.user||null];case 3:return[2,null]}}))}))},e.prototype.signInAnonymously=function(e){return void 0===e&&(e={}),mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signInWithOpenId=function(e){var t=(void 0===e?{}:e).useWxCloud,r=void 0===t||t;return mo(this,void 0,void 0,(function(){var e,t,n=this;return go(this,(function(o){switch(o.label){case 0:if(!no())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t=function(t){return mo(n,void 0,void 0,(function(){var n,o;return go(this,(function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},r)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:n.provider_token},r)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(o)];case 6:return i.sent(),[2]}}))}))},[4,new Promise((function(e,r){wx.login({success:function(o){return mo(n,void 0,void 0,(function(){var n;return go(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return n=i.sent(),r(n),[3,3];case 3:return[2]}}))}))},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})}))];case 1:return o.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signInWithUnionId=function(){return mo(this,void 0,void 0,(function(){var e=this;return go(this,(function(t){switch(t.label){case 0:if(!no())throw Error("wx api undefined");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise((function(t,r){var n=wx.getAccountInfoSync().miniProgram;wx.login({success:function(o){return mo(e,void 0,void 0,(function(){var e,i,s,a,u;return go(this,(function(c){switch(c.label){case 0:e=null==n?void 0:n.appId,c.label=1;case 1:return c.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:o.code,provider_id:e,provider_params:{provider_code_type:"union_id",appid:null==n?void 0:n.appId}})];case 2:return i=c.sent(),(s=i.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:s})]:(r(i),[2]);case 3:return(null==(a=c.sent())?void 0:a.error_code)?(r(a),[2]):(t(!0),[3,5]);case 4:return u=c.sent(),r(u),[3,5];case 5:return[2]}}))}))},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})}))];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}}))}))},e.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,r=void 0===t?"":t;return mo(this,void 0,void 0,(function(){var e,t,n,o,i;return go(this,(function(s){switch(s.label){case 0:if(!no())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:"phone"},provider_id:e.appId},[4,wx.login()];case 1:n=s.sent().code,t.provider_code=n,s.label=2;case 2:return s.trys.push([2,6,,7]),[4,this.oauthInstance.authApi.grantProviderToken(t)];case 3:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.patchProviderToken({provider_token:o.provider_token,provider_id:e.appId,provider_params:{code:r,provider_code_type:"phone"}})];case 4:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:o.provider_token})];case 5:if(null==(i=s.sent())?void 0:i.error_code)throw i;return[3,7];case 6:throw s.sent();case 7:return[2,this.createLoginState()]}}))}))},e.prototype.signInWithSms=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.phoneNum,s=void 0===i?"":i,a=e.bindInfo,u=void 0===a?void 0:a;return mo(this,void 0,void 0,(function(){var e,t,n,i,a;return go(this,(function(c){switch(c.label){case 0:return c.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:r.verification_id,verification_code:o})];case 1:if(null==(e=c.sent())?void 0:e.error_code)throw e;return t=e.verification_token,r.is_user?[4,this.oauthInstance.authApi.signIn({username:"+86 ".concat(s),verification_token:t})]:[3,5];case 2:if(null==(n=c.sent())?void 0:n.error_code)throw n;return u?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:null==u?void 0:u.providerToken})]:[3,4];case 3:if(null==(i=c.sent())?void 0:i.error_code)throw i;c.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp({phone_number:"+86 ".concat(s),verification_token:t,provider_token:null==u?void 0:u.providerId})];case 6:if(null==(a=c.sent())?void 0:a.error_code)throw a;c.label=7;case 7:return[2,this.createLoginState()];case 8:throw c.sent();case 9:return[2]}}))}))},e.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},e.prototype.signInWithCustomTicket=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signIn=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.signUp=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signUp(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.setPassword=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.setPassword(e)]}))}))},e.prototype.isUsernameRegistered=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return"string"!=typeof e&&(0,C.throwError)(A.ERRORS.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}}))}))},e.prototype.signOut=function(){return mo(this,void 0,void 0,(function(){var e;return go(this,(function(t){switch(t.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return t.sent(),[4,this.cache.removeStoreAsync(e)];case 2:return t.sent(),_o.fire(yo),[2]}}))}))},e.prototype.hasLoginState=function(){var e;if("async"!==this.cache.mode)return(null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync())?new bo({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,C.printWarn)(A.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return e.sent()?[2,new bo({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},e.prototype.getUserInfo=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getUserInfo(e)]}))}))},e.prototype.getWedaUserInfo=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},e.prototype.updateUserBasicInfo=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(t=r.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},e.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},e.prototype.bindWithProvider=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]}))}))},e.prototype.queryUser=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]}))}))},e.prototype.getAccessToken=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}}))}))},e.prototype.grantProviderToken=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]}))}))},e.prototype.patchProviderToken=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]}))}))},e.prototype.signInWithProvider=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.signInWithWechat=function(e){return void 0===e&&(e={}),mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.grantToken=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.genProviderRedirectUri=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]}))}))},e.prototype.resetPassword=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]}))}))},e.prototype.deviceAuthorize=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]}))}))},e.prototype.sudo=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.sudo(e)]}))}))},e.prototype.deleteMe=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]}))}))},e.prototype.getProviders=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getProviders()]}))}))},e.prototype.loginScope=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.loginScope()]}))}))},e.prototype.loginGroups=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},e.prototype.onLoginStateChanged=function(e){return mo(this,void 0,void 0,(function(){var t,r=this;return go(this,(function(n){switch(n.label){case 0:return _o.on(yo,(function(){return mo(r,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))},e.prototype.refreshTokenForce=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]}))}))},e.prototype.getCredentials=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},e.prototype.setCredentials=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getProviderSubType=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]}))}))},e.prototype.createCaptchaData=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]}))}))},e.prototype.verifyCaptchaData=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]}))}))},e.prototype.getMiniProgramQrCode=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]}))}))},e.prototype.getMiniProgramQrCodeStatus=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]}))}))},e.prototype.modifyPassword=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]}))}))},e.prototype.getUserBehaviorLog=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]}))}))},e.prototype.createLoginState=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,(t=new bo({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),[4,t.user.refresh(e)];case 2:return r.sent(),_o.fire(yo),[2,t]}}))}))},fo([(0,U.catchErrorsDecorator)({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"bindPhoneNumber",null),fo([(0,U.catchErrorsDecorator)({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"unbindProvider",null),fo([(0,U.catchErrorsDecorator)({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",void 0)],e.prototype,"bindEmail",null),fo([(0,U.catchErrorsDecorator)({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"verify",null),fo([(0,U.catchErrorsDecorator)({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"getVerification",null),fo([(0,U.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getCurrentUser",null),fo([(0,U.catchErrorsDecorator)({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInAnonymously",null),fo([(0,U.catchErrorsDecorator)({title:"小程序openId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().signInWithOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithOpenId",null),fo([(0,U.catchErrorsDecorator)({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"signInWithUnionId",null),fo([(0,U.catchErrorsDecorator)({title:"小程序手机号授权登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序手机号授权登录"," 2 - 调用 auth().signInWithPhoneAuth() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithPhoneAuth",null),fo([(0,U.catchErrorsDecorator)({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithSms",null),fo([(0,U.catchErrorsDecorator)({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithCustomTicket",null),fo([(0,U.catchErrorsDecorator)({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signUp",null),fo([(0,U.catchErrorsDecorator)({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[String]),po("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),fo([(0,U.catchErrorsDecorator)({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"signOut",null),fo([(0,U.catchErrorsDecorator)({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getLoginState",null),fo([(0,U.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"getUserInfo",null),fo([(0,U.catchErrorsDecorator)({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getWedaUserInfo",null),fo([(0,U.catchErrorsDecorator)({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"bindWithProvider",null),fo([(0,U.catchErrorsDecorator)({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getProviderSubType",null),e}();function So(e,t){var r=e.region,n=void 0===r?"ap-shanghai":r,o=(null==t?void 0:t.platform)||(0,oo.useDefaultAdapter)(),i=o.runtime,s=t||{},a=s.env,u=s.clientId,c=s.debug,l=s.cache,h=s.app,d=(t||{}).apiOrigin;d||(d="https://".concat(a,".").concat(n,".tcb-api.tencentcloudapi.com"));var f=new O(lo({env:a,clientId:u,apiOrigin:d,storage:null==e?void 0:e.storage,baseRequest:null==e?void 0:e.baseRequest,request:null==e?void 0:e.request,anonymousSignInFunc:null==e?void 0:e.anonymousSignInFunc,captchaOptions:null==e?void 0:e.captchaOptions,wxCloud:null==e?void 0:e.wxCloud}));return{authInstance:new wo({env:a,region:n,persistence:e.persistence,debug:c,cache:l||new k.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:"user_info_".concat(a)},platformInfo:o}),runtime:i||"web",_fromApp:h,oauthInstance:f}),oauthInstance:f}}var To={name:"auth",namespace:"auth",entity:function(e){if(void 0===e&&(e={region:"",persistence:"local"}),this.authInstance)return(0,C.printWarn)(A.ERRORS.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var t=this.platform.adapter,r=e.persistence||t.primaryStorage;r&&r!==this.config.persistence&&this.updateConfig({persistence:r});var n=So(ho(ho({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence}),{env:this.config.env,clientId:this.config.clientId,apiOrigin:this.request.getBaseEndPoint(),platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),o=n.authInstance,i=n.oauthInstance;return this.oauthInstance=i,this.authInstance=o,this.authInstance}};try{cloudbase.registerComponent(To)}catch(q){}function Io(e){try{e.registerComponent(To)}catch(e){console.warn(e)}}},431:(e,t,r)=>{let n;if(r.r(t),r.d(t,{getEncryptInfo:()=>U}),!globalThis.IS_MP_BUILD){const L="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;var o="0123456789abcdefghijklmnopqrstuvwxyz";function k(e){return o.charAt(e)}function N(e,t){return e&t}function q(e,t){return e|t}function D(e,t){return e^t}function x(e,t){return e&~t}function M(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function j(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function B(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=i.charAt(r>>6)+i.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=i.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=i.charAt(r>>2)+i.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function W(e){var t,r="",n=0,o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var s=i.indexOf(e.charAt(t));s<0||(0==n?(r+=k(s>>2),o=3&s,n=1):1==n?(r+=k(o<<2|s>>4),o=15&s,n=2):2==n?(r+=k(o),r+=k(s>>2),o=3&s,n=3):(r+=k(o<<2|s>>4),r+=k(15&s),n=0))}return 1==n&&(r+=k(o<<2)),r}var s,a,u={decode:function(e){var t;if(void 0===s){var r="0123456789ABCDEF";for(s={},t=0;t<16;++t)s[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)s[r.charAt(t)]=t;for(t=0;t<8;++t)s[" \f\n\r\t \u2028\u2029".charAt(t)]=-1}var n=[],o=0,i=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=s[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);o|=a,++i>=2?(n[n.length]=o,o=0,i=0):o<<=4}}if(i)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},c={decode:function(e){var t;if(void 0===a){for(a=Object.create(null),t=0;t<64;++t)a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(t=0;t<9;++t)a["= \f\n\r\t \u2028\u2029".charAt(t)]=-1}var r=[],n=0,o=0;for(t=0;t<e.length;++t){var i=e.charAt(t);if("="==i)break;if(-1!=(i=a[i])){if(void 0===i)throw new Error("Illegal character at offset "+t);n|=i,++o>=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,o=0):n<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=c.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return c.decode(e)}},l=1e13;class F{constructor(e){this.buf=[+e||0]}mulAdd(e,t){var r,n,o=this.buf,i=o.length;for(r=0;r<i;++r)(n=o[r]*e+t)<l?t=0:n-=(t=0|n/l)*l,o[r]=n;t>0&&(o[r]=t)}sub(e){var t,r,n=this.buf,o=n.length;for(t=0;t<o;++t)(r=n[t]-e)<0?(r+=l,e=1):e=0,n[t]=r;for(;0===n[n.length-1];)n.pop()}toString(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,r=t[t.length-1].toString(),n=t.length-2;n>=0;--n)r+=(l+t[n]).toString().substring(1);return r}valueOf(){for(var e=this.buf,t=0,r=e.length-1;r>=0;--r)t=t*l+e[r];return t}simplify(){var e=this.buf;return 1==e.length?e[0]:this}}var h,d=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,f=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function V(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}class ${constructor(e,t){this.hexDigits="0123456789ABCDEF",e instanceof $?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=t)}get(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset "+e+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]}hexByte(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)}hexDump(e,t,r){for(var n="",o=e;o<t;++o)if(n+=this.hexByte(this.get(o)),!0!==r)switch(15&o){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(e,t){for(var r=e;r<t;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(e,t){for(var r="",n=e;n<t;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(e,t){for(var r="",n=e;n<t;){var o=this.get(n++);r+=o<128?String.fromCharCode(o):o>191&&o<224?String.fromCharCode((31&o)<<6|63&this.get(n++)):String.fromCharCode((15&o)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(e,t){for(var r,n,o="",i=e;i<t;)r=this.get(i++),n=this.get(i++),o+=String.fromCharCode(r<<8|n);return o}parseTime(e,t,r){var n=this.parseStringISO(e,t),o=(r?d:f).exec(n);return o?(r&&(o[1]=+o[1],o[1]+=+o[1]<70?2e3:1900),n=o[1]+"-"+o[2]+"-"+o[3]+" "+o[4],o[5]&&(n+=":"+o[5],o[6]&&(n+=":"+o[6],o[7]&&(n+="."+o[7]))),o[8]&&(n+=" UTC","Z"!=o[8]&&(n+=o[8],o[9]&&(n+=":"+o[9]))),n):"Unrecognized time: "+n}parseInteger(e,t){for(var r,n=this.get(e),o=n>127,i=o?255:0,s="";n==i&&++e<t;)n=this.get(e);if(0==(r=t-e))return o?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^i));)s=+s<<1,--r;s="("+r+" bit)\n"}o&&(n-=256);for(var a=new F(n),u=e+1;u<t;++u)a.mulAdd(256,this.get(u));return s+a.toString()}parseBitString(e,t,r){for(var n=this.get(e),o="("+((t-e-1<<3)-n)+" bit)\n",i="",s=e+1;s<t;++s){for(var a=this.get(s),u=s==t-1?n:0,c=7;c>=u;--c)i+=a>>c&1?"1":"0";if(i.length>r)return o+V(i,r)}return o+i}parseOctetString(e,t,r){if(this.isASCII(e,t))return V(this.parseStringISO(e,t),r);var n=t-e,o="("+n+" byte)\n";n>(r/=2)&&(t=e+r);for(var i=e;i<t;++i)o+=this.hexByte(this.get(i));return n>r&&(o+="…"),o}parseOID(e,t,r){for(var n="",o=new F,i=0,s=e;s<t;++s){var a=this.get(s);if(o.mulAdd(128,127&a),i+=7,!(128&a)){if(""===n)if((o=o.simplify())instanceof F)o.sub(80),n="2."+o.toString();else{var u=o<80?o<40?0:1:2;n=u+"."+(o-40*u)}else n+="."+o.toString();if(n.length>r)return V(n,r);o=new F,i=0}}return i>0&&(n+=".incomplete"),n}}class H{constructor(e,t,r,n,o){if(!(n instanceof z))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=r,this.tag=n,this.sub=o}typeName(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}}content(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+r,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);case 6:return this.stream.parseOID(t,t+r,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return V(this.stream.parseStringUTF(t,t+r),e);case 18:case 19:case 20:case 21:case 22:case 26:return V(this.stream.parseStringISO(t,t+r),e);case 30:return V(this.stream.parseStringBMP(t,t+r),e);case 23:case 24:return this.stream.parseTime(t,t+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var r=0,n=this.sub.length;r<n;++r)t+=this.sub[r].toPrettyString(e)}return t}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(e){var t=e.get(),r=127&t;if(r==t)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===r)return null;t=0;for(var n=0;n<r;++n)t=256*t+e.get();return t}getHexStringValue(){var e=this.toHexString(),t=2*this.header,r=2*this.length;return e.substr(t,r)}static decode(e){var t;t=e instanceof $?e:new $(e,0);var r=new $(t),n=new z(t),o=H.decodeLength(t),i=t.pos,s=i-r.pos,a=null,u=function(){var e=[];if(null!==o){for(var r=i+o;t.pos<r;)e[e.length]=H.decode(t);if(t.pos!=r)throw new Error("Content size is not correct for container starting at offset "+i)}else try{for(;;){var n=H.decode(t);if(n.tag.isEOC())break;e[e.length]=n}o=i-t.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return e};if(n.tagConstructed)a=u();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=t.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var c=0;c<a.length;++c)if(a[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){a=null}if(null===a){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+i);t.pos=i+Math.abs(o)}return new H(r,s,o,n,a)}}class z{constructor(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var r=new F;do{t=e.get(),r.mulAdd(128,127&t)}while(128&t);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var p=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],m=(1<<26)/p[p.length-1];class G{constructor(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}toString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,i="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(o=!0,i=k(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(o=!0),o&&(i+=k(r));return o?i:"0"}negate(){var e=Y();return G.ZERO.subTo(this,e),e}abs(){return this.s<0?this.negate():this}compareTo(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+te(this[this.t-1]^this.s&this.DM)}mod(e){var t=Y();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(G.ZERO)>0&&e.subTo(t,t),t}modPowInt(e,t){var r;return r=e<256||t.isEven()?new y(t):new _(t),this.exp(e,r)}clone(){var e=Y();return this.copyTo(e),e}intValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var e=this.t,t=[];t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),128&r&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t}equals(e){return 0==this.compareTo(e)}min(e){return this.compareTo(e)<0?this:e}max(e){return this.compareTo(e)>0?this:e}and(e){var t=Y();return this.bitwiseTo(e,N,t),t}or(e){var t=Y();return this.bitwiseTo(e,q,t),t}xor(e){var t=Y();return this.bitwiseTo(e,D,t),t}andNot(e){var t=Y();return this.bitwiseTo(e,x,t),t}not(){for(var e=Y(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}shiftLeft(e){var t=Y();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}shiftRight(e){var t=Y();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}getLowestSetBit(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+M(this[e]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=j(this[r]^t);return e}testBit(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)}setBit(e){return this.changeBit(e,q)}clearBit(e){return this.changeBit(e,x)}flipBit(e){return this.changeBit(e,D)}add(e){var t=Y();return this.addTo(e,t),t}subtract(e){var t=Y();return this.subTo(e,t),t}multiply(e){var t=Y();return this.multiplyTo(e,t),t}divide(e){var t=Y();return this.divRemTo(e,t,null),t}remainder(e){var t=Y();return this.divRemTo(e,null,t),t}divideAndRemainder(e){var t=Y(),r=Y();return this.divRemTo(e,t,r),[t,r]}modPow(e,t){var r,n,o=e.bitLength(),i=ee(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new y(t):t.isEven()?new v(t):new _(t);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var l=Y();for(n.sqrTo(s[1],l);a<=c;)s[a]=Y(),n.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=e.t-1,p=!0,m=Y();for(o=te(e[f])-1;f>=0;){for(o>=u?h=e[f]>>o-u&c:(h=(e[f]&(1<<o+1)-1)<<u-o,f>0&&(h|=e[f-1]>>this.DB+o-u)),a=r;!(1&h);)h>>=1,--a;if((o-=a)<0&&(o+=this.DB,--f),p)s[h].copyTo(i),p=!1;else{for(;a>1;)n.sqrTo(i,m),n.sqrTo(m,i),a-=2;a>0?n.sqrTo(i,m):(d=i,i=m,m=d),n.mulTo(m,s[h],i)}for(;f>=0&&!(e[f]&1<<o);)n.sqrTo(i,m),d=i,i=m,m=d,--o<0&&(o=this.DB-1,--f)}return n.revert(i)}modInverse(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return G.ZERO;for(var r=e.clone(),n=this.clone(),o=ee(1),i=ee(0),s=ee(0),a=ee(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&i.isEven()||(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(s,o),i.subTo(a,i)):(n.subTo(r,n),t&&s.subTo(o,s),a.subTo(i,a))}return 0!=n.compareTo(G.ONE)?G.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a}pow(e){return this.exp(e,new g)}gcd(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}isProbablePrime(e){var t,r=this.abs();if(1==r.t&&r[0]<=p[p.length-1]){for(t=0;t<p.length;++t)if(r[0]==p[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<p.length;){for(var n=p[t],o=t+1;o<p.length&&n<m;)n*=p[o++];for(n=r.modInt(n);t<o;)if(n%p[t++]==0)return!1}return r.millerRabin(e)}copyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}fromInt(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}fromString(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var s=8==r?255&+e[n]:X(e,n);s<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==i?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,(i+=r)>=this.DB&&(i-=this.DB))}8==r&&128&+e[0]&&(this.s=-1,i>0&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&G.ZERO.subTo(this,this)}clamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}dlShiftTo(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}drShiftTo(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}lShiftTo(e,t){for(var r=e%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(e/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)t[a+i+1]=this[a]>>n|s,s=(this[a]&o)<<r;for(a=i-1;a>=0;--a)t[a]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}rShiftTo(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&i)<<o,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}}subTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}multiplyTo(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&G.ZERO.subTo(t,t)}squareTo(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}divRemTo(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=Y());var i=Y(),s=this.s,a=e.s,u=this.DB-te(n[n.t-1]);u>0?(n.lShiftTo(u,i),o.lShiftTo(u,r)):(n.copyTo(i),o.copyTo(r));var c=i.t,l=i[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?i[c-2]>>this.F2:0),d=this.FV/h,f=(1<<this.F1)/h,p=1<<this.F2,m=r.t,g=m-c,y=null==t?Y():t;for(i.dlShiftTo(g,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),G.ONE.dlShiftTo(c,y),y.subTo(i,i);i.t<c;)i[i.t++]=0;for(;--g>=0;){var _=r[--m]==l?this.DM:Math.floor(r[m]*d+(r[m-1]+p)*f);if((r[m]+=i.am(0,_,r,g,0,c))<_)for(i.dlShiftTo(g,y),r.subTo(y,r);r[m]<--_;)r.subTo(y,r)}null!=t&&(r.drShiftTo(c,t),s!=a&&G.ZERO.subTo(t,t)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&G.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(e,t){if(e>4294967295||e<1)return G.ONE;var r=Y(),n=Y(),o=t.convert(this),i=te(e)-1;for(o.copyTo(r);--i>=0;)if(t.sqrTo(r,n),(e&1<<i)>0)t.mulTo(n,o,r);else{var s=r;r=n,n=s}return t.revert(r)}chunkSize(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}toRadix(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=ee(r),o=Y(),i=Y(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(e).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(e)+s}fromRadix(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,i=0,s=0,a=0;a<e.length;++a){var u=X(e,a);u<0?"-"==e.charAt(a)&&0==this.signum()&&(o=!0):(s=t*s+u,++i>=r&&(this.dMultiply(n),this.dAddOffset(s,0),i=0,s=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),o&&G.ZERO.subTo(this,this)}fromNumber(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(G.ONE.shiftLeft(e-1),q,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(G.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}bitwiseTo(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r[n]=t(this[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r[n]=t(o,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}changeBit(e,t){var r=G.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}addTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}dMultiply(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}multiplyLowerTo(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var o=r.t-this.t;n<o;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}multiplyUpperTo(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}modInt(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}millerRabin(e){var t=this.subtract(G.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);(e=e+1>>1)>p.length&&(e=p.length);for(var o=Y(),i=0;i<e;++i){o.fromInt(p[Math.floor(Math.random()*p.length)]);var s=o.modPow(n,this);if(0!=s.compareTo(G.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(G.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0}square(){var e=Y();return this.squareTo(e),e}gcda(e,t){var r=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(r.compareTo(n)<0){var o=r;r=n,n=o}var i=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)t(r);else{i<s&&(s=i),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){t(n)}),0))};setTimeout(a,10)}}fromNumberAsync(e,t,r,n){if("number"==typeof t)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(G.ONE.shiftLeft(e-1),q,this),this.isEven()&&this.dAddOffset(1,0);var o=this,i=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(G.ONE.shiftLeft(e-1),o),o.isProbablePrime(t)?setTimeout((function(){n()}),0):setTimeout(i,0)};setTimeout(i,0)}else{var s=[],a=7&e;s.length=1+(e>>3),t.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var g=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),y=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),_=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=Y();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(G.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=Y();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),v=function(){function e(e){this.m=e,this.r2=Y(),this.q3=Y(),G.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Y();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function Y(){return new G(null)}function K(e,t){return new G(e,t)}function Q(e,t,r,n,o,i){for(;--i>=0;){var s=t*this[e++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=67108863&s}return o}function Z(e,t,r,n,o,i){for(var s=32767&t,a=t>>15;--i>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;o=((u=s*u+((32767&l)<<15)+r[n]+(1073741823&o))>>>30)+(l>>>15)+a*c+(o>>>30),r[n++]=1073741823&u}return o}function J(e,t,r,n,o,i){for(var s=16383&t,a=t>>14;--i>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;o=((u=s*u+((16383&l)<<14)+r[n]+o)>>28)+(l>>14)+a*c,r[n++]=268435455&u}return o}void 0!==L&&"Microsoft Internet Explorer"==L?.appName?(G.prototype.am=Z,h=30):"Netscape"!=L?.appName?(G.prototype.am=Q,h=26):(G.prototype.am=J,h=28),G.prototype.DB=h,G.prototype.DM=(1<<h)-1,G.prototype.DV=1<<h,G.prototype.FV=Math.pow(2,52),G.prototype.F1=52-h,G.prototype.F2=2*h-52;var b,w,S=[];for(b="0".charCodeAt(0),w=0;w<=9;++w)S[b++]=w;for(b="a".charCodeAt(0),w=10;w<36;++w)S[b++]=w;for(b="A".charCodeAt(0),w=10;w<36;++w)S[b++]=w;function X(e,t){var r=S[e.charCodeAt(t)];return null==r?-1:r}function ee(e){var t=Y();return t.fromInt(e),t}function te(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}G.ZERO=ee(0),G.ONE=ee(1);class re{constructor(){this.i=0,this.j=0,this.S=[]}init(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}next(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}}var T,I,E=null;if(null==E){E=[],I=0;var R=void 0;if(window?.crypto&&window?.crypto.getRandomValues){var P=new Uint32Array(256);for(window?.crypto.getRandomValues(P),R=0;R<P.length;++R)E[I++]=255&P[R]}var O=function(e){if(this.count=this.count||0,this.count>=256||I>=256)window?.removeEventListener?window?.removeEventListener("mousemove",O,!1):window?.detachEvent&&window?.detachEvent("onmousemove",O);else try{var t=e.x+e.y;E[I++]=255&t,this.count+=1}catch(e){}};window?.addEventListener?window?.addEventListener("mousemove",O,!1):window?.attachEvent&&window?.attachEvent("onmousemove",O)}function ne(){if(null==T){for(T=new re;I<256;){var e=Math.floor(65536*Math.random());E[I++]=255&e}for(T.init(E),I=0;I<E.length;++I)E[I]=0;I=0}return T.next()}class oe{constructor(){}nextBytes(e){for(var t=0;t<e.length;++t)e[t]=ne()}}function ie(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=e.length-1;n>=0&&t>0;){var o=e.charCodeAt(n--);o<128?r[--t]=o:o>127&&o<2048?(r[--t]=63&o|128,r[--t]=o>>6|192):(r[--t]=63&o|128,r[--t]=o>>6&63|128,r[--t]=o>>12|224)}r[--t]=0;for(var i=new oe,s=[];t>2;){for(s[0]=0;0==s[0];)i.nextBytes(s);r[--t]=s[0]}return r[--t]=2,r[--t]=0,new G(r)}class se{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(e){return e.modPowInt(this.e,this.n)}doPrivate(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=K(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")}encrypt(e){var t=ie(e,this.n.bitLength()+7>>3);if(null==t)return null;var r=this.doPublic(t);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(e){var t=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return e.length>r?(e.match(/.{1,117}/g).forEach((function(e){var r=t.encrypt(e);n+=r})),B(n)):B(this.encrypt(e))}catch(e){return!1}}decryptLong(e){var t=this,r=this.n.bitLength()+7>>3;e=W(e);try{if(e.length>r){var n="";return e.match(/.{1,256}/g).forEach((function(e){var r=t.decrypt(e);n+=r})),n}return this.decrypt(e)}catch(e){return!1}}setPrivate(e,t,r){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=K(e,16),this.e=parseInt(t,16),this.d=K(r,16)):console.error("Invalid RSA private key")}setPrivateEx(e,t,r,n,o,i,s,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=K(e,16),this.e=parseInt(t,16),this.d=K(r,16),this.p=K(n,16),this.q=K(o,16),this.dmp1=K(i,16),this.dmq1=K(s,16),this.coeff=K(a,16)):console.error("Invalid RSA private key")}generate(e,t){var r=new oe,n=e>>1;this.e=parseInt(t,16);for(var o=new G(t,16);;){for(;this.p=new G(e-n,1,r),0!=this.p.subtract(G.ONE).gcd(o).compareTo(G.ONE)||!this.p.isProbablePrime(10););for(;this.q=new G(n,1,r),0!=this.q.subtract(G.ONE).gcd(o).compareTo(G.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var i=this.p;this.p=this.q,this.q=i}var s=this.p.subtract(G.ONE),a=this.q.subtract(G.ONE),u=s.multiply(a);if(0==u.gcd(o).compareTo(G.ONE)){this.n=this.p.multiply(this.q),this.d=o.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(e){var t=K(e,16),r=this.doPrivate(t);return null==r?null:ae(r,this.n.bitLength()+7>>3)}generateAsync(e,t,r){var n=new oe,o=e>>1;this.e=parseInt(t,16);var i=new G(t,16),s=this,a=()=>{var t=()=>{if(s.p.compareTo(s.q)<=0){var e=s.p;s.p=s.q,s.q=e}var t=s.p.subtract(G.ONE),n=s.q.subtract(G.ONE),o=t.multiply(n);0==o.gcd(i).compareTo(G.ONE)?(s.n=s.p.multiply(s.q),s.d=i.modInverse(o),s.dmp1=s.d.mod(t),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=()=>{s.q=Y(),s.q.fromNumberAsync(o,1,n,(function(){s.q.subtract(G.ONE).gcda(i,(function(e){0==e.compareTo(G.ONE)&&s.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(u,0)}))}))},c=()=>{s.p=Y(),s.p.fromNumberAsync(e-o,1,n,(function(){s.p.subtract(G.ONE).gcda(i,(function(e){0==e.compareTo(G.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)}}function ae(e,t){for(var r=e.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=t-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var o="";++n<r.length;){var i=255&r[n];i<128?o+=String.fromCharCode(i):i>191&&i<224?(o+=String.fromCharCode((31&i)<<6|63&r[n+1]),++n):(o+=String.fromCharCode((15&i)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return o}class ue extends se{constructor(e=""){e&&("string"==typeof e?this.parseKey(e):(this.hasPrivateKeyProperty(e)||this.hasPublicKeyProperty(e))&&this.parsePropertiesFrom(e))}parseKey(e){try{var t=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?u.decode(e):c.unarmor(e),o=H.decode(n);if(3===o.sub.length&&(o=o.sub[2].sub[0]),9===o.sub.length){t=o.sub[1].getHexStringValue(),this.n=K(t,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var i=o.sub[3].getHexStringValue();this.d=K(i,16);var s=o.sub[4].getHexStringValue();this.p=K(s,16);var a=o.sub[5].getHexStringValue();this.q=K(a,16);var l=o.sub[6].getHexStringValue();this.dmp1=K(l,16);var h=o.sub[7].getHexStringValue();this.dmq1=K(h,16);var d=o.sub[8].getHexStringValue();this.coeff=K(d,16)}else{if(2!==o.sub.length)return!1;var f=o.sub[1].sub[0];t=f.sub[0].getHexStringValue(),this.n=K(t,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(e){return!1}}hasPublicKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")}hasPrivateKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")}parsePropertiesFrom(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)}}n=function(e){e=e||{},this.default_key_size=parseInt(e.default_key_size,10)||1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null},n.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new ue(e)},n.prototype.setPrivateKey=function(e){this.setKey(e)},n.prototype.setPublicKey=function(e){this.setKey(e)},n.prototype.decrypt=function(e){try{return this.getKey().decrypt(W(e))}catch(e){return!1}},n.prototype.encrypt=function(e){try{return B(this.getKey().encrypt(e))}catch(e){return!1}},n.prototype.encryptLong=function(e){try{for(var t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",n=0,o=/null$/g;o.test(r)&&(n++,t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",!(n>10)););return t}catch(e){return!1}},n.prototype.getKey=function(e){if(!this.key){if(this.key=new ue,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.version="3.1.4"}const C=n;var A=r(616);const U=({publicKey:e="",payload:t={}}={})=>{if(!e)return"";try{const r=(0,A.I)(t),n=new C({});return n.setPublicKey(e),n.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(e){}return""}},616:(e,t,r)=>{r.d(t,{I:()=>n,y:()=>o});const n=e=>{const t=t=>{for(const r in e)e.hasOwnProperty(r)&&(t[r]=n(e[r]));return t},r=null==e?"NullOrUndefined":Object.prototype.toString.call(e).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return e.slice();switch(r){case"Object":return t(Object.create(Object.getPrototypeOf(e)));case"Array":return t([]);case"Date":return new Date(e.valueOf());case"RegExp":return new RegExp(e.source,(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":""));default:return e}},o=e=>{const t=e.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return t&&t[2]||""}},105:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,a=i(r(587)),u=r(894);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,r=(0,u.isArray)(e)?e:[e];t<r.length;t++){var n=r[t],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},t.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},587:function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var u=r(997),c=r(894),l=r(652),h=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,s=e.headers,a=void 0===s?{}:s,u={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===u?(Object.keys(t).forEach((function(e){c.append(e,t[e])})),c.append("key",n),c.append("file",r),this.request(i(i({},e),{data:c,method:u}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=s.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o,s,u,c,l,h=this;return a(this,(function(a){switch(a.label){case 0:return t=e.url,r=e.enableAbort,n=void 0!==r&&r,o=e.stream,s=void 0!==o&&o,u=new AbortController,c=null,n&&this.timeout&&(c=setTimeout((function(){console.warn(h.timeoutMsg),u.abort(h.timeoutMsg)}),this.timeout)),[4,fetch(t,i(i({},e),{signal:u.signal})).then((function(e){return clearTimeout(c),e})).catch((function(e){return clearTimeout(c),Promise.reject(e)}))];case 1:return l=a.sent(),[2,{data:s?l.body:l.json(),statusCode:l.status,header:l.headers}]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=e.url,u=e.headers,h=void 0===u?{}:u,d=e.data,f=e.responseType,p=e.withCredentials,m=e.body,g=e.onUploadProgress,y=(0,c.formatUrl)((0,l.getProtocol)(),a,"get"===n?d:{}),_=new XMLHttpRequest;_.open(n,y),f&&(_.responseType=f),Object.keys(h).forEach((function(e){_.setRequestHeader(e,h[e])})),g&&_.upload.addEventListener("progress",g),_.onreadystatechange=function(){var e={};if(4===_.readyState){var t=_.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach((function(e){var t=e.split(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o})),e.header=r,e.statusCode=_.status;try{e.data="blob"===f?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===f?_.response:_.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=(0,c.isFormData)(d)?d:"application/x-www-form-urlencoded"===h["content-type"]?(0,c.toQueryString)(d):m||(d?JSON.stringify(d):void 0),p&&(_.withCredentials=!0),_.send(s)}))},t}(u.AbstractSDKRequest);t.WebRequest=h,t.genAdapter=function(){return{root:window,reqClass:h,wsClass:WebSocket,localStorage}}},652:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var r="@cloudbase/js-sdk";t.setSdkName=function(e){r=e},t.getSdkName=function(){return r};var n="https:";t.setProtocol=function(e){n=e},t.getProtocol=function(){return n},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},151:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},141:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(652),t),o(r(151),t),t.OATUH_LOGINTYPE="constants"},64:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(894),s=r(141),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var u=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,c=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function l(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),u=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),l=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),h=s.findIndex((function(e){return u.test(e)}));if(-1!==h){var d=s.filter((function(e,t){return t>h}));d.unshift(s[h].replace(l,"".concat(r,".").concat(n)).replace(c,o)),(i=new Error).stack="".concat(a?"@debugger":"Error","\n").concat(d.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,a=e.customInfo,h=void 0===a?{}:a,d=e.title,f=e.messages,p=void 0===f?[]:f;return function(e,t,a){if(s.IS_DEBUG_MODE){var f=h.className||e.constructor.name,m=h.methodName||t,g=a.value,y=function(){var e="",t=(new Error).stack.split("\n"),r=t.findIndex((function(e){return u.test(e)}));if(-1!==r){var n=c.exec(t[r+1]||"");e=n?n[0]:""}return e}();a.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l({err:new Error,className:f,methodName:m,sourceLink:y});try{return g.apply(this,e)}catch(e){var n=e,o=e.message,s=e.error,a=e.error_description,u={title:d||"".concat(f,".").concat(m," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var c=JSON.parse(o);u.subtitle=o,c.code&&(r?(r.code=c.code,r.msg=c.msg):(e.code=c.code,e.message=c.msg),n=r||e,u.content=p.map((function(e){return{type:"info",body:e}})))}throw s&&a&&(u.subtitle=a,r?(r.code=s,r.msg=a):(e.code=s,e.message=a),n=r||e,u.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n,s,a,u,c,h;return o(this,(function(o){switch(o.label){case 0:t=l({err:new Error,className:f,methodName:m,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,g.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,s=r.message,a=r.error,u=r.error_description,c={title:d||"".concat(f,".").concat(m," failed"),content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(h=JSON.parse(s),c.subtitle=h,h.code&&(t?(t.code=h.code,t.message=h.msg):(r.code=h.code,r.message=h.msg),n=t||r,c.content=p.map((function(e){return{type:"info",body:e}})))),a&&u&&(c.subtitle=u,t?(t.code=a,t.msg=u):(r.code=a,r.message=u),n=t||r,c.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(c),n;case 4:return[2]}}))}))}}}}},466:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(64),t)},418:function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var a=r(997),u=r(894),c=r(141),l=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return o(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(a.AbstractStorage),h=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,u.printWarn)(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:c.ERRORS.OPERATION_FAIL,msg:"[".concat((0,c.getSdkName)(),"][").concat(c.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();t.CloudbaseCache=h},988:function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=r(894),a=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=a;var u=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return o(t,e),t}(a);t.IErrorEvent=u;var c=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,s.isInstanceOf)(e,u))return console.error(e.error),this;var r=(0,s.isString)(e)?new a(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,c=this.listeners[n]?i([],this.listeners[n],!0):[];o<c.length;o++)c[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=c;var l=new c;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},894:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var n=r(141);t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=(new Date).getTime(),t=(null===performance||void 0===performance?void 0:performance.now)&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===r?n:7&n|8).toString(16)}))},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach((function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||window.location.search,n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===e&&n.splice(i,1);r="".concat(r,"?").concat(n.join("&"))}return r},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)}))},t.printGroupLog=function(e){var t=e.title,r=e.subtitle,n=void 0===r?"":r,o=e.content,i=void 0===o?[]:o,s=e.printTrace,a=void 0!==s&&s,u=e.collapsed;void 0!==u&&u?console.groupCollapsed(t,n):console.group(t,n);for(var c=0,l=i;c<l.length;c++){var h=l[c],d=h.type,f=h.body;switch(d){case"info":console.log(f);break;case"warn":console.warn(f);break;case"error":console.error(f)}}a&&console.trace("stack trace:"),console.groupEnd()},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86".concat(e)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.registerAuth=void 0;var t=r(243);e.registerAuth=t.registerAuth})(),n})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_auth",[],t):"object"==typeof exports?exports.cloudbase_auth=t():e.cloudbase_auth=t()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var e={997:(e,t,r)=>{var n;r.r(t),r.d(t,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>n,formatUrl:()=>s}),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}},540:(e,t,r)=>{var n,o,i,s,a,u;function c(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}r.r(t),r.d(t,{Auth:()=>wo,LoginState:()=>bo,generateAuthInstance:()=>So,registerAuth:()=>Io}),function(e){e.AUTH_SIGN_UP_URL="/auth/v1/signup",e.AUTH_TOKEN_URL="/auth/v1/token",e.AUTH_REVOKE_URL="/auth/v1/revoke",e.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",e.AUTH_RESET_PASSWORD="/auth/v1/reset",e.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",e.CHECK_USERNAME="/auth/v1/checkUsername",e.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist",e.GET_PROVIDER_TYPE="/auth/v1/mgr/provider/providerSubType",e.AUTH_SIGN_IN_URL="/auth/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",e.AUTH_SIGN_IN_WITH_WECHAT_URL="/auth/v1/signin/wechat/noauth",e.PROVIDER_TOKEN_URL="/auth/v1/provider/token",e.PROVIDER_URI_URL="/auth/v1/provider/uri",e.USER_ME_URL="/auth/v1/user/me",e.AUTH_SIGNOUT_URL="/auth/v1/user/signout",e.USER_QUERY_URL="/auth/v1/user/query",e.USER_PRIFILE_URL="/auth/v1/user/profile",e.USER_BASIC_EDIT_URL="/auth/v1/user/basic/edit",e.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",e.PROVIDER_LIST="/auth/v1/user/provider",e.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",e.PROVIDER_UNBIND_URL="/auth/v1/user/provider",e.CHECK_PWD_URL="/auth/v1/user/sudo",e.SUDO_URL="/auth/v1/user/sudo",e.BIND_CONTACT_URL="/auth/v1/user/contact",e.AUTH_SET_PASSWORD="/auth/v1/user/password",e.AUTHORIZE_DEVICE_URL="/auth/v1/user/device/authorize",e.AUTHORIZE_URL="/auth/v1/user/authorize",e.AUTHORIZE_INFO_URL="/auth/v1/user/authorize/info",e.AUTHORIZED_DEVICES_DELETE_URL="/auth/v1/user/authorized/devices/",e.AUTH_REVOKE_ALL_URL="/auth/v1/user/revoke/all",e.GET_USER_BEHAVIOR_LOG="/auth/v1/user/security/history",e.VERIFICATION_URL="/auth/v1/verification",e.VERIFY_URL="/auth/v1/verification/verify",e.CAPTCHA_DATA_URL="/auth/v1/captcha/data",e.VERIFY_CAPTCHA_DATA_URL="/auth/v1/captcha/data/verify",e.GET_CAPTCHA_URL="/auth/v1/captcha/init",e.GET_MINIPROGRAM_QRCODE="/auth/v1/qrcode/generate",e.GET_MINIPROGRAM_QRCODE_STATUS="/auth/v1/qrcode/get/status"}(n||(n={})),function(e){e.AUTH_SIGN_IN_URL="/auth/v2/signin/username",e.AUTH_TOKEN_URL="/auth/v2/token",e.USER_ME_URL="/auth/v2/user/me",e.VERIFY_URL="/auth/v2/signin/verificationcode",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider",e.AUTH_PUBLIC_KEY="/auth/v2/signin/publichkey"}(o||(o={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(i||(i={})),(u=s||(s={})).UNREACHABLE="unreachable",u.LOCAL="local",u.CANCELLED="cancelled",u.UNKNOWN="unknown",u.UNAUTHENTICATED="unauthenticated",u.RESOURCE_EXHAUSTED="resource_exhausted",u.FAILED_PRECONDITION="failed_precondition",u.INVALID_ARGUMENT="invalid_argument",u.DEADLINE_EXCEEDED="deadline_exceeded",u.NOT_FOUND="not_found",u.ALREADY_EXISTS="already_exists",u.PERMISSION_DENIED="permission_denied",u.ABORTED="aborted",u.OUT_OF_RANGE="out_of_range",u.UNIMPLEMENTED="unimplemented",u.INTERNAL="internal",u.UNAVAILABLE="unavailable",u.DATA_LOSS="data_loss",u.INVALID_PASSWORD="invalid_password",u.PASSWORD_NOT_SET="password_not_set",u.INVALID_STATUS="invalid_status",u.USER_PENDING="user_pending",u.USER_BLOCKED="user_blocked",u.INVALID_VERIFICATION_CODE="invalid_verification_code",u.TWO_FACTOR_REQUIRED="two_factor_required",u.INVALID_TWO_FACTOR="invalid_two_factor",u.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",u.UNDER_REVIEW="under_review",u.INVALID_REQUEST="invalid_request",u.UNAUTHORIZED_CLIENT="unauthorized_client",u.ACCESS_DENIED="access_denied",u.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",u.INVALID_SCOPE="invalid_scope",u.INVALID_GRANT="invalid_grant",u.SERVER_ERROR="server_error",u.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",u.INTERACTION_REQUIRED="interaction_required",u.LOGIN_REQUIRED="login_required",u.ACCOUNT_SELECTION_REQUIRED="account_selection_required",u.CONSENT_REQUIRED="consent_required",u.INVALID_REQUEST_URI="invalid_request_uri",u.INVALID_REQUEST_OBJECT="invalid_request_object",u.REQUEST_NOT_SUPPORTED="request_not_supported",u.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",u.REGISTRATION_NOT_SUPPORTED="registration_not_supported",u.CAPTCHA_REQUIRED="captcha_required",u.CAPTCHA_INVALID="captcha_invalid",function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(a||(a={}));var l=r(479);class h{constructor(){this.fnPromiseMap=new Map}async run(e,t){let r=this.fnPromiseMap.get(e);return await r||(r=new Promise(((r,n)=>{(async()=>{try{await this.runIdlePromise();const e=t();r(await e)}catch(e){n(e)}finally{this.fnPromiseMap.delete(e)}})()})),this.fnPromiseMap.set(e,r)),r}runIdlePromise(){return Promise.resolve()}}const d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f="x-request-id",p="x-device-id",m="device_id",g=async function(e,t){let r=null,n=null;try{const o=Object.assign({},t);o.method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body));const i=await fetch(e,o),s=await i.json();s?.error?(n=s,n.error_uri=new URL(e).pathname):r=s}catch(t){n={error:s.UNREACHABLE,error_description:t.message,error_uri:new URL(e).pathname}}if(n)throw n;return r},y=new class{constructor(e){this._env=e?.env||""}async getItem(e){return window.localStorage.getItem(`${e}${this._env}`)}async removeItem(e){window.localStorage.removeItem(`${e}${this._env}`)}async setItem(e,t){window.localStorage.setItem(`${e}${this._env}`,t)}getItemSync(e){return window.localStorage.getItem(`${e}${this._env}`)}removeItemSync(e){window.localStorage.removeItem(`${e}${this._env}`)}setItemSync(e,t){window.localStorage.setItem(`${e}${this._env}`,t)}};function _(e){let t=!0;return e?.expires_at&&e?.access_token&&(t=e.expires_at<new Date),t}class v{constructor(e){this.credentials=null,this.singlePromise=new h,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage}getStorageCredentialsSync(){let e=null;const t=this.storage.getItemSync(this.tokenSectionName);if(null!=t)try{e=JSON.parse(t),e?.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){this.storage.removeItem(this.tokenSectionName),e=null}return e}async setCredentials(e){if(e?.expires_in){if(e?.expires_at||(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30))),this.storage){const t=JSON.stringify(e);await this.storage.setItem(this.tokenSectionName,t)}this.credentials=e}else this.storage&&await this.storage.removeItem(this.tokenSectionName),this.credentials=null}async getCredentials(){return this.singlePromise.run("getCredentials",(async()=>(_(this.credentials)&&(this.credentials=await this.getStorageCredentials()),this.credentials)))}async getStorageCredentials(){return this.singlePromise.run("_getStorageCredentials",(async()=>{let e=null;const t=await this.storage.getItem(this.tokenSectionName);if(null!=t)try{e=JSON.parse(t),e?.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){await this.storage.removeItem(this.tokenSectionName),e=null}return e}))}}class b{constructor(e){this.singlePromise=new h,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,b.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=g,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||y,this.localCredentials=new v({tokenSectionName:`credentials_${e.clientId}`,storage:this.storage}),this.clientSecret=e.clientSecret,""!==e.clientId&&(this.basicAuth=`Basic ${function(e){let t,r,n,o,i="",s=0;const a=(e=String(e)).length%3;for(;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=r<<16|n<<8|o,i+=d.charAt(t>>18&63)+d.charAt(t>>12&63)+d.charAt(t>>6&63)+d.charAt(63&t)}return a?i.slice(0,a-3)+"===".substring(a):i}(`${e.clientId}:${e.clientSecret}`)}`),this.wxCloud=e.wxCloud;try{(function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0})()&&void 0===this.wxCloud&&e.env&&(wx.cloud.init({env:e.env}),this.wxCloud=wx.cloud)}catch(e){}this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}setCredentials(e){return this.localCredentials.setCredentials(e)}async getAccessToken(){const e=await this.getCredentials();if(e?.access_token)return Promise.resolve(e.access_token);const t={error:s.UNAUTHENTICATED};return Promise.reject(t)}async request(e,t){t||(t={});const r=this.formatRetry(t.retry,this.retry);if(t.headers=t.headers||{},this.headers&&(t.headers={...this.headers,...t.headers}),t.headers[f]||(t.headers[f]=c()),!t.headers[p]){const e=await this.getDeviceId();t.headers[p]=e}if(t?.withBasicAuth&&this.basicAuth&&(t.headers.Authorization=this.basicAuth),t?.withCredentials){const r=await this.getCredentials();r&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+=`access_token=${r.access_token}`):t.headers.Authorization=`${r.token_type} ${r.access_token}`)}else this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+=`client_id=${this.clientId}`);e.startsWith("/")&&(e=this.apiOrigin+e);let n=null;const o=r+1;for(let i=0;i<o;i++){try{n=t.useWxCloud?await this.wxCloudCallFunction(e,t):await this.baseRequest(e,t);break}catch(e){if(t.withCredentials&&e&&e.error===s.UNAUTHENTICATED)return await this.setCredentials(null),Promise.reject(e);if(i===r||!e||"unreachable"!==e.error)return Promise.reject(e)}await this.sleep(b.retryInterval)}return n}async wxCloudCallFunction(e,t){let r=null,n=null;try{const{result:o}=await this.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:e,method:t.method,headers:{origin:"https://servicewechat.com",...t.headers},body:t.body}});o?.body?.error_code?(n=o?.body,n.error_uri=(0,l.y)(e)):r=o?.body}catch(t){n={error:s.UNREACHABLE,error_description:t.message,error_uri:(0,l.y)(e)}}if(n)throw n;return r}async getCredentials(){let e=await this.localCredentials.getCredentials();return e?(_(e)&&(e=e&&"anonymous"===e.scope?this.anonymousSignInFunc?await this.anonymousSignInFunc(e)||await this.localCredentials.getCredentials():await this.anonymousSignIn(e):await this.refreshToken(e)),e):this.unAuthenticatedError("credentials not found")}getCredentialsSync(){return this.localCredentials.getStorageCredentialsSync()}getCredentialsAsync(){return this.getCredentials()}async getScope(){const e=await this.localCredentials.getCredentials();return e?e.scope:this.unAuthenticatedError("credentials not found")}async getGroups(){const e=await this.localCredentials.getCredentials();return e?e.groups:this.unAuthenticatedError("credentials not found")}async refreshToken(e){return this.singlePromise.run("_refreshToken",(async()=>{if(!e||!e.refresh_token)return this.unAuthenticatedError("no refresh token found in credentials");try{const t=await this.refreshTokenFunc(e.refresh_token,e);return await this.localCredentials.setCredentials(t),t}catch(e){return e.error===s.INVALID_GRANT?(await this.localCredentials.setCredentials(null),this.unAuthenticatedError(e.error_description)):Promise.reject(e)}}))}checkRetry(e){let t=null;if(("number"!=typeof e||e<b.minRetry||e>b.maxRetry)&&(t={error:s.UNREACHABLE,error_description:"wrong options param: retry"}),t)throw t;return e}formatRetry(e,t){return void 0===e?t:this.checkRetry(e)}async sleep(e){return new Promise((t=>{setTimeout((()=>{t()}),e)}))}async anonymousSignIn(e){return this.singlePromise.run("_anonymous",(async()=>{if(!e||"anonymous"!==e.scope)return this.unAuthenticatedError("no anonymous in credentials");try{const e=await this.request(n.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return await this.localCredentials.setCredentials(e),e}catch(e){return e.error===s.INVALID_GRANT?(await this.localCredentials.setCredentials(null),this.unAuthenticatedError(e.error_description)):Promise.reject(e)}}))}async defaultRefreshTokenFunc(e,t){if(void 0===e||""===e)return this.unAuthenticatedError("refresh token not found");let r=n.AUTH_TOKEN_URL;return"v2"===t?.version&&(r=o.AUTH_TOKEN_URL),{...await this.request(r,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:e}}),version:t?.version||"v1"}}async getDeviceId(){if(this.deviceID)return this.deviceID;let e=await this.storage.getItem(m);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=c(),await this.storage.setItem(m,e)),this.deviceID=e,e}unAuthenticatedError(e){const t={error:s.UNAUTHENTICATED,error_description:e};return Promise.reject(t)}}function w(){const{wx:e}=globalThis;if(void 0===e)return!1;if(void 0===globalThis.Page)return!1;if(!e.getSystemInfoSync)return!1;if(!e.getStorageSync)return!1;if(!e.setStorageSync)return!1;if(!e.connectSocket)return!1;if(!e.request)return!1;try{if(!e.getSystemInfoSync())return!1;if("qq"===e.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0}b.defaultRetry=2,b.minRetry=0,b.maxRetry=5,b.retryInterval=1e3;let S=!1;function T(){S=S||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{w()||(S=S||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?T():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",T,!1))}catch(q){}function I(){return S}class E{constructor(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=y),this.config=e,this.tokenSectionName=`captcha_${e.clientId}`}async request(e,t){t||(t={}),t.method||(t.method="GET");const r=`${t.method}:${e}`;let n,o=e;t.withCaptcha&&(o=await this.appendCaptchaTokenToURL(e,r,!1));try{n=await this.config.request(o,t)}catch(n){return n.error===s.CAPTCHA_REQUIRED||n.error===s.CAPTCHA_INVALID?(e=await this.appendCaptchaTokenToURL(e,r,n.error===s.CAPTCHA_INVALID),this.config.request(e,t)):Promise.reject(n)}return n}getDefaultOpenURIWithCallback(){if(!w()&&!I()&&(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap"))){const e=document.createElement("div");e.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",e.setAttribute("id","captcha_panel_wrap"),setTimeout((()=>{document.body.appendChild(e)}),0)}return this.defaultOpenURIWithCallback}async defaultOpenURIWithCallback(e,t){const{width:r="355px",height:n="355px"}=t||{};if(e.match(/^(data:.*)$/))return Promise.reject({error:s.UNIMPLEMENTED,error_description:"need to impl captcha data"});const o=document.getElementById("captcha_panel_wrap"),i=document.createElement("iframe");return o.innerHTML="",i.setAttribute("src",e),i.setAttribute("id","review-panel-iframe"),i.style.cssText=`min-width:${r};display:block;height:${n};margin:0 auto;background-color: rgb(255, 255, 255);border: none;`,o.appendChild(i),o.style.display="block",new Promise(((e,t)=>{i.onload=function(){try{const r=window.location,n=i.contentWindow.location;if(n.host+n.pathname===r.host+r.pathname){o.style.display="none";const r=new URLSearchParams(n.search),i=r.get("captcha_token");return i?e({captcha_token:i,expires_in:Number(r.get("expires_in"))}):t({error:r.get("error"),error_description:r.get("error_description")})}o.style.display="block"}catch(e){o.style.display="block"}}}))}async getCaptchaToken(e,t){if(!e){const e=await this.findCaptchaToken();if(e)return e}let r;if(w()||I()){const e=await this.config.request(n.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:""},withCredentials:!1});r={url:`${e.data}?state=${encodeURIComponent(t)}&token=${encodeURIComponent(e.token)}`}}else{const e=`${window.location.origin+window.location.pathname}?__captcha=on`;if(r=await this.config.request(n.GET_CAPTCHA_URL,{method:"POST",body:{client_id:this.config.clientId,redirect_uri:e,state:t},withCredentials:!1}),r.captcha_token){const e={captcha_token:r.captcha_token,expires_in:r.expires_in};return this.saveCaptchaToken(e),r.captcha_token}}const o=await this.config.openURIWithCallback(r.url);return this.saveCaptchaToken(o),o.captcha_token}async appendCaptchaTokenToURL(e,t,r){const n=await this.getCaptchaToken(r,t);return e.indexOf("?")>0?e+=`&captcha_token=${n}`:e+=`?captcha_token=${n}`,e}async saveCaptchaToken(e){e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10));const t=JSON.stringify(e);await this.config.storage.setItem(this.tokenSectionName,t)}async findCaptchaToken(){const e=await this.config.storage.getItem(this.tokenSectionName);if(null!=e)try{const t=JSON.parse(e);return t?.expires_at&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?null:t.captcha_token}catch(e){return await this.config.storage.removeItem(this.tokenSectionName),null}return null}}function R(e){if(!globalThis.IS_MP_BUILD&&e)return r(443)}class P{static parseParamsToSearch(e){return Object.keys(e).forEach((t=>{e[t]||delete e[t]})),new URLSearchParams(e).toString()}constructor(e){let{request:t}=e,r=e.credentialsClient;if(!r){const t={apiOrigin:e.apiOrigin,clientId:e.clientId,storage:e.storage,env:e.env,baseRequest:e.baseRequest,anonymousSignInFunc:e.anonymousSignInFunc,wxCloud:e.wxCloud};r=new b(t)}if(!t){const n=r.request.bind(r),o=new E({clientId:e.clientId,request:n,storage:e.storage,...e.captchaOptions});t=o.request.bind(o)}this.config={env:e.env,apiOrigin:e.apiOrigin,clientId:e.clientId,request:t,credentialsClient:r,storage:e.storage||y}}getParamsByVersion(e,t){const r=(0,l.I)(e),i={v2:o}[r?.version]?.[t]||n[t];return r&&delete r.version,{params:r,url:i}}async signIn(e){const t=e.version||"v1",r=this.getParamsByVersion(e,"AUTH_SIGN_IN_URL");r.params.query&&delete r.params.query;const n=await this.getEncryptParams(r.params),o=await this.config.request(r.url,{method:"POST",body:n});return await this.config.credentialsClient.setCredentials({...o,version:t}),Promise.resolve(o)}async signInAnonymously(e={}){const t=await this.config.request(n.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signUp(e){const t=await this.config.request(n.AUTH_SIGN_UP_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signOut(e){let t={};if(e){try{t=await this.config.request(n.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:e})}catch(e){e.error!==s.UNAUTHENTICATED&&console.log("sign_out_error",e)}return await this.config.credentialsClient.setCredentials(),t}const r=await this.config.credentialsClient.getAccessToken(),o=await this.config.request(n.AUTH_REVOKE_URL,{method:"POST",body:{token:r}});return await this.config.credentialsClient.setCredentials(),Promise.resolve(o)}async revokeAllDevices(){await this.config.request(n.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}async revokeDevice(e){await this.config.request(n.AUTHORIZED_DEVICES_DELETE_URL+e.device_id,{method:"DELETE",withCredentials:!0})}async getVerification(e){let t=!1;return("CUR_USER"===e.target||await this.hasLoginState())&&(t=!0),this.config.request(n.VERIFICATION_URL,{method:"POST",body:e,withCredentials:t})}async verify(e){const t=this.getParamsByVersion(e,"VERIFY_URL"),r=await this.config.request(t.url,{method:"POST",body:t.params});return"v2"===e?.version&&await this.config.credentialsClient.setCredentials({...r,version:"v2"}),r}async genProviderRedirectUri(e){const{provider_redirect_uri:t,other_params:r={},...o}=e;t&&!o.redirect_uri&&(o.redirect_uri=t);let i=`${n.PROVIDER_URI_URL}?${P.parseParamsToSearch(e)}`;return Object.keys(r).forEach((e=>{const t=r[e];("sign_out_uri"!==e||t?.length>0)&&(i+=`&other_params[${e}]=${encodeURIComponent(t)}`)})),this.config.request(i,{method:"GET"})}async grantProviderToken(e,t=!1){return this.config.request(n.PROVIDER_TOKEN_URL,{method:"POST",body:e,useWxCloud:t})}async patchProviderToken(e){return this.config.request(n.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})}async signInWithProvider(e,t=!1){const r=this.getParamsByVersion(e,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),n=await this.config.request(r.url,{method:"POST",body:r.params,useWxCloud:t});return await this.config.credentialsClient.setCredentials({...n,version:e?.version||"v1"}),Promise.resolve(n)}async signInWithWechat(e={}){const t=await this.config.request(n.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async bindWithProvider(e){return this.config.request(n.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0})}async getUserProfile(e){return this.getUserInfo(e)}async getUserInfo(e={}){const t=this.getParamsByVersion(e,"USER_ME_URL");if(t.params?.query){const e=new URLSearchParams(t.params.query);t.url+=`?${e.toString()}`}const r=await this.config.request(t.url,{method:"GET",withCredentials:!0});return r.sub&&(r.uid=r.sub),r}async getWedaUserInfo(){return await this.config.request(n.WEDA_USER_URL,{method:"GET",withCredentials:!0})}async deleteMe(e){const t=this.getParamsByVersion(e,"USER_ME_URL"),r=`${t.url}?${P.parseParamsToSearch(t.params)}`;return this.config.request(r,{method:"DELETE",withCredentials:!0})}async hasLoginState(){try{return await this.config.credentialsClient.getAccessToken(),!0}catch(e){return!1}}hasLoginStateSync(){return this.config.credentialsClient.getCredentialsSync()}async getLoginState(){return this.config.credentialsClient.getCredentialsAsync()}async transByProvider(e){return this.config.request(n.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})}async grantToken(e){const t=this.getParamsByVersion(e,"AUTH_TOKEN_URL");return this.config.request(t.url,{method:"POST",body:t.params})}async getProviders(){return this.config.request(n.PROVIDER_LIST,{method:"GET",withCredentials:!0})}async unbindProvider(e){return this.config.request(`${n.PROVIDER_UNBIND_URL}/${e.provider_id}`,{method:"DELETE",withCredentials:!0})}async checkPassword(e){return this.config.request(`${n.CHECK_PWD_URL}`,{method:"POST",withCredentials:!0,body:e})}async editContact(e){return this.config.request(`${n.BIND_CONTACT_URL}`,{method:"PATCH",withCredentials:!0,body:e})}async setPassword(e){return this.config.request(`${n.AUTH_SET_PASSWORD}`,{method:"PATCH",withCredentials:!0,body:e})}async updatePasswordByOld(e){const t=await this.sudo({password:e.old_password});return this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})}async sudo(e){return this.config.request(`${n.SUDO_URL}`,{method:"POST",withCredentials:!0,body:e})}async sendVerificationCodeToCurrentUser(e){return e.target="CUR_USER",this.config.request(n.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})}async changeBoundProvider(e){return this.config.request(`${n.PROVIDER_LIST}/${e.provider_id}/trans`,{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})}async setUserProfile(e){return this.config.request(n.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})}async updateUserBasicInfo(e){return this.config.request(n.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:e})}async queryUserProfile(e){const t=new URLSearchParams(e);return this.config.request(`${n.USER_QUERY_URL}?${t.toString()}`,{method:"GET",withCredentials:!0})}setCustomSignFunc(e){this.getCustomSignTicketFn=e}async signInWithCustomTicket(e){const t=this.getCustomSignTicketFn;if(!t)return Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"});const r=await t();return this.signInWithProvider({...e,provider_id:"custom",provider_token:r})}async resetPassword(e){return this.config.request(n.AUTH_RESET_PASSWORD,{method:"POST",body:e})}async authorize(e){return this.config.request(n.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:e})}async authorizeDevice(e){return this.config.request(n.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:e})}async deviceAuthorize(e){return this.config.request(n.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})}async authorizeInfo(e){const t=`${n.AUTHORIZE_INFO_URL}?${P.parseParamsToSearch(e)}`;let r=!0,o=!1;return await this.hasLoginState()&&(o=!0,r=!1),this.config.request(t,{method:"GET",withBasicAuth:r,withCredentials:o})}async checkUsername(e){return this.config.request(n.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})}async checkIfUserExist(e){const t=new URLSearchParams(e);return this.config.request(`${n.CHECK_IF_USER_EXIST}?${t.toString()}`,{method:"GET"})}async loginScope(){return this.config.credentialsClient.getScope()}async loginGroups(){return this.config.credentialsClient.getGroups()}async refreshTokenForce(e){const t=await this.config.credentialsClient.getCredentials();return await this.config.credentialsClient.refreshToken({...t,version:e?.version||"v1"})}async getCredentials(){return this.config.credentialsClient.getCredentials()}async getPublicKey(){return this.config.request(o.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}async getEncryptParams(e){const{isEncrypt:t}=e;delete e.isEncrypt;const r=(0,l.I)(e),n=R(t);if(!n)return e;let o="",i="";try{const e=await this.getPublicKey();o=e.public_key,i=e.public_key_thumbprint}catch(e){}if(!o||!i)throw new Error("public_key or public_key_thumbprint is empty");return{params:n.getEncryptInfo({publicKey:o,payload:r}),public_key_thumbprint:i}}async getProviderSubType(){return this.config.request(n.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}async verifyCaptchaData({token:e,key:t}){return this.config.request(n.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:e,key:t},withCredentials:!1})}async createCaptchaData({state:e,redirect_uri:t}){return this.config.request(n.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:t},withCredentials:!1})}async getMiniProgramCode(e){return this.config.request(n.GET_MINIPROGRAM_QRCODE,{method:"POST",body:e})}async getMiniProgramQrCodeStatus(e){return this.config.request(n.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:e})}async getUserBehaviorLog(e){const t=`${n.GET_USER_BEHAVIOR_LOG}?${{LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"}[e.type]}&limit=${e.limit}${e.page_token?`&page_token=${e.page_token}`:""}`;return this.config.request(t,{method:"GET",withCredentials:!0})}async modifyPassword(e){let t="",r="";const o=R(!0);if(!o)throw new Error("do not support encrypt, a encrypt util required.");try{const e=await this.getPublicKey();t=e.public_key,r=e.public_key_thumbprint}catch(e){}if(!t||!r)throw new Error("public_key or public_key_thumbprint is empty");const i=e.password?o.getEncryptInfo({publicKey:t,payload:e.password}):"",s=o.getEncryptInfo({publicKey:t,payload:e.new_password});return this.config.request(n.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:e.user_id,encrypt_password:i,encrypt_new_password:s,public_key_thumbprint:r}})}}class O{constructor(e){const{apiOrigin:t,clientId:r,env:n,storage:o,request:i,baseRequest:s,anonymousSignInFunc:a,wxCloud:u}=e;this.oauth2client=new b({apiOrigin:t,clientId:r,env:n,storage:o,baseRequest:s||i,anonymousSignInFunc:a,wxCloud:u}),this.authApi=new P({credentialsClient:this.oauth2client,...e,request:i?this.oauth2client.request.bind(this.oauth2client):void 0})}}var C=r(894),A=r(141),U=r(466),L=r(988),k=r(418),N=r(997);function q(){}function D(e){return"object"==typeof e&&null!==e||"function"==typeof e}const x=q;function M(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const j=Promise,B=Promise.resolve.bind(j),W=Promise.prototype.then,F=Promise.reject.bind(j),V=B;function H(e){return new j(e)}function $(e){return H((t=>t(e)))}function z(e){return F(e)}function G(e,t,r){return W.call(e,t,r)}function Y(e,t,r){G(G(e,t,r),void 0,x)}function K(e,t){Y(e,t)}function Q(e,t){Y(e,void 0,t)}function Z(e,t,r){return G(e,t,r)}function J(e){G(e,void 0,x)}let X=e=>{if("function"==typeof queueMicrotask)X=queueMicrotask;else{const e=$(void 0);X=t=>G(e,t)}return X(e)};function ee(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function te(e,t,r){try{return $(ee(e,t,r))}catch(e){return z(e)}}class re{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let n=r+1;const o=e._elements,i=o[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),o[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,n=r._elements;for(;!(t===n.length&&void 0===r._next||t===n.length&&(r=r._next,n=r._elements,t=0,0===n.length));)e(n[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const ne=Symbol("[[AbortSteps]]"),oe=Symbol("[[ErrorSteps]]"),ie=Symbol("[[CancelSteps]]"),se=Symbol("[[PullSteps]]"),ae=Symbol("[[ReleaseSteps]]");function ue(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?de(e):"closed"===t._state?function(e){de(e),me(e)}(e):fe(e,t._storedError)}function ce(e,t){return _n(e._ownerReadableStream,t)}function le(e){const t=e._ownerReadableStream;"readable"===t._state?pe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){fe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[ae](),t._reader=void 0,e._ownerReadableStream=void 0}function he(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function de(e){e._closedPromise=H(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function fe(e,t){de(e),pe(e,t)}function pe(e,t){void 0!==e._closedPromise_reject&&(J(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function me(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const ge=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},ye=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function _e(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function ve(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function be(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function we(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Se(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Te(e){return Number(e)}function Ie(e){return 0===e?0:e}function Ee(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Ie(n),!ge(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Ie(ye(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return ge(n)&&0!==n?n:0}function Re(e,t){if(!gn(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Pe(e){return new Le(e)}function Oe(e,t){e._reader._readRequests.push(t)}function Ce(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Ae(e){return e._reader._readRequests.length}function Ue(e){const t=e._reader;return void 0!==t&&!!ke(t)}class Le{constructor(e){if(we(e,1,"ReadableStreamDefaultReader"),Re(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");ue(this,e),this._readRequests=new re}get closed(){return ke(this)?this._closedPromise:z(De("closed"))}cancel(e=void 0){return ke(this)?void 0===this._ownerReadableStream?z(he("cancel")):ce(this,e):z(De("cancel"))}read(){if(!ke(this))return z(De("read"));if(void 0===this._ownerReadableStream)return z(he("read from"));let e,t;const r=H(((r,n)=>{e=r,t=n}));return Ne(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!ke(this))throw De("releaseLock");void 0!==this._ownerReadableStream&&function(e){le(e),qe(e,new TypeError("Reader was released"))}(this)}}function ke(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof Le}function Ne(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[se](t)}function qe(e,t){const r=e._readRequests;e._readRequests=new re,r.forEach((e=>{e._errorSteps(t)}))}function De(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var xe,Me,je;function Be(e){return e.slice()}function We(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(Le.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),M(Le.prototype.cancel,"cancel"),M(Le.prototype.read,"read"),M(Le.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Le.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let Fe=e=>(Fe="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,Fe(e)),Ve=e=>(Ve="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,Ve(e));function He(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return We(o,0,e,t,n),o}function $e(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(`${String(t)} is not a function`);return r}}function ze(e){try{const t=e.done,r=e.value;return G(V(r),(e=>({done:t,value:e})))}catch(e){return z(e)}}const Ge=null!==(je=null!==(xe=Symbol.asyncIterator)&&void 0!==xe?xe:null===(Me=Symbol.for)||void 0===Me?void 0:Me.call(Symbol,"Symbol.asyncIterator"))&&void 0!==je?je:"@@asyncIterator";function Ye(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=$e(e,Ge)))return function(e){const t={next(){let t;try{t=Ke(e)}catch(e){return z(e)}return ze(t)},return(t){let r;try{const n=$e(e.iterator,"return");if(void 0===n)return $({done:!0,value:t});r=ee(n,e.iterator,[t])}catch(e){return z(e)}return D(r)?ze(r):z(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(Ye(e,"sync",$e(e,Symbol.iterator)))}else r=$e(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const n=ee(r,e,[]);if(!D(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Ke(e){const t=ee(e.nextMethod,e.iterator,[]);if(!D(t))throw new TypeError("The iterator.next() method must return an object");return t}class Qe{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?Z(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?Z(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const n=H(((e,n)=>{t=e,r=n}));return Ne(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,X((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,le(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,le(e),r(t)}}),n}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=ce(t,e);return le(t),Z(r,(()=>({value:e,done:!0})))}return le(t),$({value:e,done:!0})}}const Ze={next(){return Je(this)?this._asyncIteratorImpl.next():z(Xe("next"))},return(e){return Je(this)?this._asyncIteratorImpl.return(e):z(Xe("return"))},[Ge](){return this}};function Je(e){if(!D(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Qe}catch(e){return!1}}function Xe(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Ze,Ge,{enumerable:!1});const et=Number.isNaN||function(e){return e!=e};function tt(e){const t=He(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function rt(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function nt(e,t,r){if("number"!=typeof(n=r)||et(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function ot(e){e._queue=new re,e._queueTotalSize=0}function it(e){return e===DataView}class st{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ct(this))throw Nt("view");return this._view}respond(e){if(!ct(this))throw Nt("respond");if(we(e,1,"respond"),e=Ee(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ve(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Ut(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ct(this))throw Nt("respondWithNewView");if(we(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ve(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Lt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(st.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),M(st.prototype.respond,"respond"),M(st.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(st.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class at{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ut(this))throw qt("byobRequest");return Ct(this)}get desiredSize(){if(!ut(this))throw qt("desiredSize");return At(this)}close(){if(!ut(this))throw qt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);Et(this)}enqueue(e){if(!ut(this))throw qt("enqueue");if(we(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);Rt(this,e)}error(e=void 0){if(!ut(this))throw qt("error");Pt(this,e)}[ie](e){ht(this),ot(this);const t=this._cancelAlgorithm(e);return It(this),t}[se](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Ot(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let n;try{n=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}Oe(t,e),lt(this)}[ae](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new re,this._pendingPullIntos.push(e)}}}function ut(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof at}function ct(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof st}function lt(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Ue(t)&&Ae(t)>0)||(!!(Bt(t)&&jt(t)>0)||At(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,lt(e)),null)),(t=>(Pt(e,t),null)))))}function ht(e){bt(e),e._pendingPullIntos=new re}function dt(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=ft(t);"default"===t.readerType?Ce(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function ft(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function pt(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function mt(e,t,r,n){let o;try{o=He(t,r,r+n)}catch(t){throw Pt(e,t),t}pt(e,o,0,n)}function gt(e,t){t.bytesFilled>0&&mt(e,t.buffer,t.byteOffset,t.bytesFilled),Tt(e)}function yt(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const s=n-n%t.elementSize;s>=t.minimumFill&&(o=s-t.bytesFilled,i=!0);const a=e._queue;for(;o>0;){const r=a.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;We(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?a.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,_t(0,n,t),o-=n}return i}function _t(e,t,r){r.bytesFilled+=t}function vt(e){0===e._queueTotalSize&&e._closeRequested?(It(e),vn(e._controlledReadableByteStream)):lt(e)}function bt(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function wt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();yt(e,t)&&(Tt(e),dt(e._controlledReadableByteStream,t))}}function St(e,t){const r=e._pendingPullIntos.peek();bt(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Tt(e);const r=e._controlledReadableByteStream;if(Bt(r))for(;jt(r)>0;)dt(r,Tt(e))}(e,r):function(e,t,r){if(_t(0,t,r),"none"===r.readerType)return gt(e,r),void wt(e);if(r.bytesFilled<r.minimumFill)return;Tt(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;mt(e,r.buffer,t-n,n)}r.bytesFilled-=n,dt(e._controlledReadableByteStream,r),wt(e)}(e,t,r),lt(e)}function Tt(e){return e._pendingPullIntos.shift()}function It(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Et(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Pt(e,t),t}}It(e),vn(t)}}function Rt(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(Ve(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const s=Fe(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(Ve(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");bt(e),t.buffer=Fe(t.buffer),"none"===t.readerType&>(e,t)}Ue(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Ot(e,t._readRequests.shift())}}(e),0===Ae(r)?pt(e,s,o,i):(e._pendingPullIntos.length>0&&Tt(e),Ce(r,new Uint8Array(s,o,i),!1))):Bt(r)?(pt(e,s,o,i),wt(e)):pt(e,s,o,i),lt(e)}function Pt(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(ht(e),ot(e),It(e),bn(r,t))}function Ot(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,vt(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function Ct(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(st.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function At(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ut(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=Fe(r.buffer),St(e,t)}function Lt(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const n=t.byteLength;r.buffer=Fe(t.buffer),St(e,n)}function kt(e,t,r,n,o,i,s){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,ot(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=s,t._pendingPullIntos=new re,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,lt(t),null)),(e=>(Pt(t,e),null)))}function Nt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function qt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Dt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function xt(e){return new Wt(e)}function Mt(e,t){e._reader._readIntoRequests.push(t)}function jt(e){return e._reader._readIntoRequests.length}function Bt(e){const t=e._reader;return void 0!==t&&!!Ft(t)}Object.defineProperties(at.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),M(at.prototype.close,"close"),M(at.prototype.enqueue,"enqueue"),M(at.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(at.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Wt{constructor(e){if(we(e,1,"ReadableStreamBYOBReader"),Re(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ut(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");ue(this,e),this._readIntoRequests=new re}get closed(){return Ft(this)?this._closedPromise:z($t("closed"))}cancel(e=void 0){return Ft(this)?void 0===this._ownerReadableStream?z(he("cancel")):ce(this,e):z($t("cancel"))}read(e,t={}){if(!Ft(this))return z($t("read"));if(!ArrayBuffer.isView(e))return z(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return z(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return z(new TypeError("view's buffer must have non-zero byteLength"));if(Ve(e.buffer))return z(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return _e(e,t),{min:Ee(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return z(e)}const n=r.min;if(0===n)return z(new TypeError("options.min must be greater than 0"));if(function(e){return it(e.constructor)}(e)){if(n>e.byteLength)return z(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return z(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return z(he("read from"));let o,i;const s=H(((e,t)=>{o=e,i=t}));return Vt(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),s}releaseLock(){if(!Ft(this))throw $t("releaseLock");void 0!==this._ownerReadableStream&&function(e){le(e),Ht(e,new TypeError("Reader was released"))}(this)}}function Ft(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Wt}function Vt(e,t,r,n){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?n._errorSteps(o._storedError):function(e,t,r,n){const o=e._controlledReadableByteStream,i=t.constructor,s=function(e){return it(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:a,byteLength:u}=t,c=r*s;let l;try{l=Fe(t.buffer)}catch(e){return void n._errorSteps(e)}const h={buffer:l,bufferByteLength:l.byteLength,byteOffset:a,byteLength:u,bytesFilled:0,minimumFill:c,elementSize:s,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(h),void Mt(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(yt(e,h)){const t=ft(h);return vt(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Pt(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(h),Mt(o,n),lt(e)}else{const e=new i(h.buffer,h.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function Ht(e,t){const r=e._readIntoRequests;e._readIntoRequests=new re,r.forEach((e=>{e._errorSteps(t)}))}function $t(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function zt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(et(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Gt(e){const{size:t}=e;return t||(()=>1)}function Yt(e,t){_e(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Te(r),size:void 0===n?void 0:Kt(n,`${t} has member 'size' that`)}}function Kt(e,t){return ve(e,t),t=>Te(e(t))}function Qt(e,t,r){return ve(e,r),r=>te(e,t,[r])}function Zt(e,t,r){return ve(e,r),()=>te(e,t,[])}function Jt(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function Xt(e,t,r){return ve(e,r),(r,n)=>te(e,t,[r,n])}function er(e,t){if(!ir(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Wt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),M(Wt.prototype.cancel,"cancel"),M(Wt.prototype.read,"read"),M(Wt.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const tr="function"==typeof AbortController;class rr{constructor(e={},t={}){void 0===e?e=null:be(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){_e(e,t);const r=null==e?void 0:e.abort,n=null==e?void 0:e.close,o=null==e?void 0:e.start,i=null==e?void 0:e.type,s=null==e?void 0:e.write;return{abort:void 0===r?void 0:Qt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:Zt(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:Jt(o,e,`${t} has member 'start' that`),write:void 0===s?void 0:Xt(s,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(or(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=Gt(r);!function(e,t,r,n){const o=Object.create(Sr.prototype);let i,s,a,u;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.write?e=>t.write(e,o):()=>$(void 0),a=void 0!==t.close?()=>t.close():()=>$(void 0),u=void 0!==t.abort?e=>t.abort(e):()=>$(void 0),Ir(e,o,i,s,a,u,r,n)}(this,n,zt(r,1),o)}get locked(){if(!ir(this))throw Ur("locked");return sr(this)}abort(e=void 0){return ir(this)?sr(this)?z(new TypeError("Cannot abort a stream that already has a writer")):ar(this,e):z(Ur("abort"))}close(){return ir(this)?sr(this)?z(new TypeError("Cannot close a stream that already has a writer")):dr(this)?z(new TypeError("Cannot close an already-closing stream")):ur(this):z(Ur("close"))}getWriter(){if(!ir(this))throw Ur("getWriter");return nr(this)}}function nr(e){return new mr(e)}function or(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new re,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function ir(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof rr}function sr(e){return void 0!==e._writer}function ar(e,t){var r;if("closed"===e._state||"errored"===e._state)return $(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const n=e._state;if("closed"===n||"errored"===n)return $(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=H(((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}}));return e._pendingAbortRequest._promise=i,o||lr(e,t),i}function ur(e){const t=e._state;if("closed"===t||"errored"===t)return z(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=H(((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n})),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&Vr(n),nt(o=e._writableStreamController,wr,0),Pr(o),r}function cr(e,t){"writable"!==e._state?hr(e):lr(e,t)}function lr(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&_r(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&hr(e)}function hr(e){e._state="errored",e._writableStreamController[oe]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new re,void 0===e._pendingAbortRequest)return void fr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void fr(e);Y(e._writableStreamController[ne](r._reason),(()=>(r._resolve(),fr(e),null)),(t=>(r._reject(t),fr(e),null)))}function dr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function fr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&xr(t,e._storedError)}function pr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){jr(e)}(r):Vr(r)),e._backpressure=t}Object.defineProperties(rr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),M(rr.prototype.abort,"abort"),M(rr.prototype.close,"close"),M(rr.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(rr.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class mr{constructor(e){if(we(e,1,"WritableStreamDefaultWriter"),er(e,"First parameter"),sr(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!dr(e)&&e._backpressure?jr(this):Wr(this),qr(this);else if("erroring"===t)Br(this,e._storedError),qr(this);else if("closed"===t)Wr(this),qr(this),Mr(this);else{const t=e._storedError;Br(this,t),Dr(this,t)}}get closed(){return gr(this)?this._closedPromise:z(kr("closed"))}get desiredSize(){if(!gr(this))throw kr("desiredSize");if(void 0===this._ownerWritableStream)throw Nr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Rr(t._writableStreamController)}(this)}get ready(){return gr(this)?this._readyPromise:z(kr("ready"))}abort(e=void 0){return gr(this)?void 0===this._ownerWritableStream?z(Nr("abort")):function(e,t){return ar(e._ownerWritableStream,t)}(this,e):z(kr("abort"))}close(){if(!gr(this))return z(kr("close"));const e=this._ownerWritableStream;return void 0===e?z(Nr("close")):dr(e)?z(new TypeError("Cannot close an already-closing stream")):yr(this)}releaseLock(){if(!gr(this))throw kr("releaseLock");void 0!==this._ownerWritableStream&&vr(this)}write(e=void 0){return gr(this)?void 0===this._ownerWritableStream?z(Nr("write to")):br(this,e):z(kr("write"))}}function gr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof mr}function yr(e){return ur(e._ownerWritableStream)}function _r(e,t){"pending"===e._readyPromiseState?Fr(e,t):function(e,t){Br(e,t)}(e,t)}function vr(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");_r(e,r),function(e,t){"pending"===e._closedPromiseState?xr(e,t):function(e,t){Dr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function br(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Or(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return z(Nr("write to"));const i=r._state;if("errored"===i)return z(r._storedError);if(dr(r)||"closed"===i)return z(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return z(r._storedError);const s=function(e){return H(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{nt(e,t,r)}catch(t){return void Or(e,t)}const n=e._controlledWritableStream;dr(n)||"writable"!==n._state||pr(n,Cr(e)),Pr(e)}(n,t,o),s}Object.defineProperties(mr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),M(mr.prototype.abort,"abort"),M(mr.prototype.close,"close"),M(mr.prototype.releaseLock,"releaseLock"),M(mr.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(mr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const wr={};class Sr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Tr(this))throw Lr("abortReason");return this._abortReason}get signal(){if(!Tr(this))throw Lr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Tr(this))throw Lr("error");"writable"===this._controlledWritableStream._state&&Ar(this,e)}[ne](e){const t=this._abortAlgorithm(e);return Er(this),t}[oe](){ot(this)}}function Tr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Sr}function Ir(e,t,r,n,o,i,s,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._abortReason=void 0,t._abortController=function(){if(tr)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=s,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const u=Cr(t);pr(e,u),Y($(r()),(()=>(t._started=!0,Pr(t),null)),(r=>(t._started=!0,cr(e,r),null)))}function Er(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Rr(e){return e._strategyHWM-e._queueTotalSize}function Pr(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void hr(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===wr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),rt(e);const r=e._closeAlgorithm();Er(e),Y(r,(()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&Mr(t)}(t),null)),(e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),cr(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),Y(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(rt(e),!dr(r)&&"writable"===t){const t=Cr(e);pr(r,t)}return Pr(e),null}),(t=>("writable"===r._state&&Er(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,cr(e,t)}(r,t),null)))}(e,r)}function Or(e,t){"writable"===e._controlledWritableStream._state&&Ar(e,t)}function Cr(e){return Rr(e)<=0}function Ar(e,t){const r=e._controlledWritableStream;Er(e),lr(r,t)}function Ur(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Lr(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function kr(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Nr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function qr(e){e._closedPromise=H(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function Dr(e,t){qr(e),xr(e,t)}function xr(e,t){void 0!==e._closedPromise_reject&&(J(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Mr(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function jr(e){e._readyPromise=H(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function Br(e,t){jr(e),Fr(e,t)}function Wr(e){jr(e),Vr(e)}function Fr(e,t){void 0!==e._readyPromise_reject&&(J(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Vr(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(Sr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Sr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const Hr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,$r=function(){const e=null==Hr?void 0:Hr.DOMException;return function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;if("DOMException"!==e.name)return!1;try{return new e,!0}catch(e){return!1}}(e)?e:void 0}()||function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return M(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function zr(e,t,r,n,o,i){const s=Pe(e),a=nr(t);e._disturbed=!0;let u=!1,c=$(void 0);return H(((l,h)=>{let d;if(void 0!==i){if(d=()=>{const r=void 0!==i.reason?i.reason:new $r("Aborted","AbortError"),s=[];n||s.push((()=>"writable"===t._state?ar(t,r):$(void 0))),o||s.push((()=>"readable"===e._state?_n(e,r):$(void 0))),_((()=>Promise.all(s.map((e=>e())))),!0,r)},i.aborted)return void d();i.addEventListener("abort",d)}var f,p,m;if(y(e,s._closedPromise,(e=>(n?v(!0,e):_((()=>ar(t,e)),!0,e),null))),y(t,a._closedPromise,(t=>(o?v(!0,t):_((()=>_n(e,t)),!0,t),null))),f=e,p=s._closedPromise,m=()=>(r?v():_((()=>function(e){const t=e._ownerWritableStream,r=t._state;return dr(t)||"closed"===r?$(void 0):"errored"===r?z(t._storedError):yr(e)}(a))),null),"closed"===f._state?m():K(p,m),dr(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");o?v(!0,t):_((()=>_n(e,t)),!0,t)}function g(){const e=c;return G(c,(()=>e!==c?g():void 0))}function y(e,t,r){"errored"===e._state?r(e._storedError):Q(t,r)}function _(e,r,n){function o(){return Y(e(),(()=>b(r,n)),(e=>b(!0,e))),null}u||(u=!0,"writable"!==t._state||dr(t)?o():K(g(),o))}function v(e,r){u||(u=!0,"writable"!==t._state||dr(t)?b(e,r):K(g(),(()=>b(e,r))))}function b(e,t){return vr(a),le(s),void 0!==i&&i.removeEventListener("abort",d),e?h(t):l(void 0),null}J(H(((e,t)=>{!function r(n){n?e():G(u?$(!0):G(a._readyPromise,(()=>H(((e,t)=>{Ne(s,{_chunkSteps:t=>{c=G(br(a,t),void 0,q),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class Gr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Yr(this))throw on("desiredSize");return tn(this)}close(){if(!Yr(this))throw on("close");if(!rn(this))throw new TypeError("The stream is not in a state that permits close");Jr(this)}enqueue(e=void 0){if(!Yr(this))throw on("enqueue");if(!rn(this))throw new TypeError("The stream is not in a state that permits enqueue");return Xr(this,e)}error(e=void 0){if(!Yr(this))throw on("error");en(this,e)}[ie](e){ot(this);const t=this._cancelAlgorithm(e);return Zr(this),t}[se](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=rt(this);this._closeRequested&&0===this._queue.length?(Zr(this),vn(t)):Kr(this),e._chunkSteps(r)}else Oe(t,e),Kr(this)}[ae](){}}function Yr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Gr}function Kr(e){Qr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Kr(e)),null)),(t=>(en(e,t),null)))))}function Qr(e){const t=e._controlledReadableStream;return!!rn(e)&&!!e._started&&(!!(yn(t)&&Ae(t)>0)||tn(e)>0)}function Zr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Jr(e){if(!rn(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Zr(e),vn(t))}function Xr(e,t){if(!rn(e))return;const r=e._controlledReadableStream;if(yn(r)&&Ae(r)>0)Ce(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw en(e,t),t}try{nt(e,t,r)}catch(t){throw en(e,t),t}}Kr(e)}function en(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(ot(e),Zr(e),bn(r,t))}function tn(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function rn(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function nn(e,t,r,n,o,i,s){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,ot(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=s,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,Kr(t),null)),(e=>(en(t,e),null)))}function on(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function sn(e){return D(t=e)&&void 0!==t.getReader?function(e){let t;return t=fn(q,(function(){let r;try{r=e.read()}catch(r){return z(r)}return Z(r,(e=>{if(!D(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)Jr(t._readableStreamController);else{const r=e.value;Xr(t._readableStreamController,r)}}))}),(function(t){try{return $(e.cancel(t))}catch(t){return z(t)}}),0),t}(e.getReader()):function(e){let t;const r=Ye(e,"async");return t=fn(q,(function(){let e;try{e=Ke(r)}catch(e){return z(e)}return Z($(e),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)Jr(t._readableStreamController);else{const r=e.value;Xr(t._readableStreamController,r)}}))}),(function(e){const t=r.iterator;let n;try{n=$e(t,"return")}catch(e){return z(e)}return void 0===n?$(void 0):Z(te(n,t,[e]),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}))}),0),t}(e);var t}function an(e,t,r){return ve(e,r),r=>te(e,t,[r])}function un(e,t,r){return ve(e,r),r=>te(e,t,[r])}function cn(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function ln(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function hn(e,t){_e(e,t);const r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,o=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(`${t} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(Gr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),M(Gr.prototype.close,"close"),M(Gr.prototype.enqueue,"enqueue"),M(Gr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Gr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class dn{constructor(e={},t={}){void 0===e?e=null:be(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){_e(e,t);const r=e,n=null==r?void 0:r.autoAllocateChunkSize,o=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,s=null==r?void 0:r.start,a=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Ee(n,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===o?void 0:an(o,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:un(i,r,`${t} has member 'pull' that`),start:void 0===s?void 0:cn(s,r,`${t} has member 'start' that`),type:void 0===a?void 0:ln(a,`${t} has member 'type' that`)}}(e,"First parameter");if(mn(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const n=Object.create(at.prototype);let o,i,s;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>$(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0);const a=t.autoAllocateChunkSize;if(0===a)throw new TypeError("autoAllocateChunkSize must be greater than 0");kt(e,n,o,i,s,r,a)}(this,n,zt(r,0))}else{const e=Gt(r);!function(e,t,r,n){const o=Object.create(Gr.prototype);let i,s,a;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.pull?()=>t.pull(o):()=>$(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0),nn(e,o,i,s,a,r,n)}(this,n,zt(r,1),e)}}get locked(){if(!gn(this))throw wn("locked");return yn(this)}cancel(e=void 0){return gn(this)?yn(this)?z(new TypeError("Cannot cancel a stream that already has a reader")):_n(this,e):z(wn("cancel"))}getReader(e=void 0){if(!gn(this))throw wn("getReader");return void 0===function(e,t){_e(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Dt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Pe(this):xt(this)}pipeThrough(e,t={}){if(!gn(this))throw wn("pipeThrough");we(e,1,"pipeThrough");const r=function(e,t){_e(e,t);const r=null==e?void 0:e.readable;Se(r,"readable","ReadableWritablePair"),Re(r,`${t} has member 'readable' that`);const n=null==e?void 0:e.writable;return Se(n,"writable","ReadableWritablePair"),er(n,`${t} has member 'writable' that`),{readable:r,writable:n}}(e,"First parameter"),n=hn(t,"Second parameter");if(yn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(sr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return J(zr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!gn(this))return z(wn("pipeTo"));if(void 0===e)return z("Parameter 1 is required in 'pipeTo'.");if(!ir(e))return z(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=hn(t,"Second parameter")}catch(e){return z(e)}return yn(this)?z(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):sr(e)?z(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):zr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!gn(this))throw wn("tee");return Be(function(e){return ut(e._readableStreamController)?function(e){let t,r,n,o,i,s=Pe(e),a=!1,u=!1,c=!1,l=!1,h=!1;const d=H((e=>{i=e}));function f(e){Q(e._closedPromise,(t=>(e!==s||(Pt(n._readableStreamController,t),Pt(o._readableStreamController,t),l&&h||i(void 0)),null)))}function p(){Ft(s)&&(le(s),s=Pe(e),f(s)),Ne(s,{_chunkSteps:t=>{X((()=>{u=!1,c=!1;const r=t;let s=t;if(!l&&!h)try{s=tt(t)}catch(t){return Pt(n._readableStreamController,t),Pt(o._readableStreamController,t),void i(_n(e,t))}l||Rt(n._readableStreamController,r),h||Rt(o._readableStreamController,s),a=!1,u?g():c&&y()}))},_closeSteps:()=>{a=!1,l||Et(n._readableStreamController),h||Et(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&Ut(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Ut(o._readableStreamController,0),l&&h||i(void 0)},_errorSteps:()=>{a=!1}})}function m(t,r){ke(s)&&(le(s),s=xt(e),f(s));const d=r?o:n,p=r?n:o;Vt(s,t,1,{_chunkSteps:t=>{X((()=>{u=!1,c=!1;const n=r?h:l;if(r?l:h)n||Lt(d._readableStreamController,t);else{let r;try{r=tt(t)}catch(t){return Pt(d._readableStreamController,t),Pt(p._readableStreamController,t),void i(_n(e,t))}n||Lt(d._readableStreamController,t),Rt(p._readableStreamController,r)}a=!1,u?g():c&&y()}))},_closeSteps:e=>{a=!1;const t=r?h:l,n=r?l:h;t||Et(d._readableStreamController),n||Et(p._readableStreamController),void 0!==e&&(t||Lt(d._readableStreamController,e),!n&&p._readableStreamController._pendingPullIntos.length>0&&Ut(p._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{a=!1}})}function g(){if(a)return u=!0,$(void 0);a=!0;const e=Ct(n._readableStreamController);return null===e?p():m(e._view,!1),$(void 0)}function y(){if(a)return c=!0,$(void 0);a=!0;const e=Ct(o._readableStreamController);return null===e?p():m(e._view,!0),$(void 0)}function _(){}return n=pn(_,g,(function(n){if(l=!0,t=n,h){const n=Be([t,r]),o=_n(e,n);i(o)}return d})),o=pn(_,y,(function(n){if(h=!0,r=n,l){const n=Be([t,r]),o=_n(e,n);i(o)}return d})),f(s),[n,o]}(e):function(e){const t=Pe(e);let r,n,o,i,s,a=!1,u=!1,c=!1,l=!1;const h=H((e=>{s=e}));function d(){return a?(u=!0,$(void 0)):(a=!0,Ne(t,{_chunkSteps:e=>{X((()=>{u=!1;const t=e,r=e;c||Xr(o._readableStreamController,t),l||Xr(i._readableStreamController,r),a=!1,u&&d()}))},_closeSteps:()=>{a=!1,c||Jr(o._readableStreamController),l||Jr(i._readableStreamController),c&&l||s(void 0)},_errorSteps:()=>{a=!1}}),$(void 0))}function f(){}return o=fn(f,d,(function(t){if(c=!0,r=t,l){const t=Be([r,n]),o=_n(e,t);s(o)}return h})),i=fn(f,d,(function(t){if(l=!0,n=t,c){const t=Be([r,n]),o=_n(e,t);s(o)}return h})),Q(t._closedPromise,(e=>(en(o._readableStreamController,e),en(i._readableStreamController,e),c&&l||s(void 0),null))),[o,i]}(e)}(this))}values(e=void 0){if(!gn(this))throw wn("values");return function(e,t){const r=Pe(e),n=new Qe(r,t),o=Object.create(Ze);return o._asyncIteratorImpl=n,o}(this,function(e){_e(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[Ge](e){return this.values(e)}static from(e){return sn(e)}}function fn(e,t,r,n=1,o=()=>1){const i=Object.create(dn.prototype);return mn(i),nn(i,Object.create(Gr.prototype),e,t,r,n,o),i}function pn(e,t,r){const n=Object.create(dn.prototype);return mn(n),kt(n,Object.create(at.prototype),e,t,r,0,void 0),n}function mn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function gn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof dn}function yn(e){return void 0!==e._reader}function _n(e,t){if(e._disturbed=!0,"closed"===e._state)return $(void 0);if("errored"===e._state)return z(e._storedError);vn(e);const r=e._reader;if(void 0!==r&&Ft(r)){const e=r._readIntoRequests;r._readIntoRequests=new re,e.forEach((e=>{e._closeSteps(void 0)}))}return Z(e._readableStreamController[ie](t),q)}function vn(e){e._state="closed";const t=e._reader;if(void 0!==t&&(me(t),ke(t))){const e=t._readRequests;t._readRequests=new re,e.forEach((e=>{e._closeSteps()}))}}function bn(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(pe(r,t),ke(r)?qe(r,t):Ht(r,t))}function wn(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Sn(e,t){_e(e,t);const r=null==e?void 0:e.highWaterMark;return Se(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Te(r)}}Object.defineProperties(dn,{from:{enumerable:!0}}),Object.defineProperties(dn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),M(dn.from,"from"),M(dn.prototype.cancel,"cancel"),M(dn.prototype.getReader,"getReader"),M(dn.prototype.pipeThrough,"pipeThrough"),M(dn.prototype.pipeTo,"pipeTo"),M(dn.prototype.tee,"tee"),M(dn.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(dn.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(dn.prototype,Ge,{value:dn.prototype.values,writable:!0,configurable:!0});const Tn=e=>e.byteLength;M(Tn,"size");class In{constructor(e){we(e,1,"ByteLengthQueuingStrategy"),e=Sn(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Rn(this))throw En("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Rn(this))throw En("size");return Tn}}function En(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Rn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof In}Object.defineProperties(In.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(In.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Pn=()=>1;M(Pn,"size");class On{constructor(e){we(e,1,"CountQueuingStrategy"),e=Sn(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!An(this))throw Cn("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!An(this))throw Cn("size");return Pn}}function Cn(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function An(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof On}function Un(e,t,r){return ve(e,r),r=>te(e,t,[r])}function Ln(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function kn(e,t,r){return ve(e,r),(r,n)=>te(e,t,[r,n])}function Nn(e,t,r){return ve(e,r),r=>te(e,t,[r])}Object.defineProperties(On.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(On.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class qn{constructor(e={},t={},r={}){void 0===e&&(e=null);const n=Yt(t,"Second parameter"),o=Yt(r,"Third parameter"),i=function(e,t){_e(e,t);const r=null==e?void 0:e.cancel,n=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,i=null==e?void 0:e.start,s=null==e?void 0:e.transform,a=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:Nn(r,e,`${t} has member 'cancel' that`),flush:void 0===n?void 0:Un(n,e,`${t} has member 'flush' that`),readableType:o,start:void 0===i?void 0:Ln(i,e,`${t} has member 'start' that`),transform:void 0===s?void 0:kn(s,e,`${t} has member 'transform' that`),writableType:a}}(e,"First parameter");if(void 0!==i.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==i.writableType)throw new RangeError("Invalid writableType specified");const s=zt(o,0),a=Gt(o),u=zt(n,1),c=Gt(n);let l;!function(e,t,r,n,o,i){function s(){return t}e._writable=function(e,t,r,n,o=1,i=()=>1){const s=Object.create(rr.prototype);return or(s),Ir(s,Object.create(Sr.prototype),e,t,r,n,o,i),s}(s,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?Z(e._backpressureChangePromise,(()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return $n(r,t)})):$n(r,t)}(e,t)}),(function(){return function(e){const t=e._transformStreamController;if(void 0!==t._finishPromise)return t._finishPromise;const r=e._readable;t._finishPromise=H(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const n=t._flushAlgorithm();return Vn(t),Y(n,(()=>("errored"===r._state?Yn(t,r._storedError):(Jr(r._readableStreamController),Gn(t)),null)),(e=>(en(r._readableStreamController,e),Yn(t,e),null))),t._finishPromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._readable;r._finishPromise=H(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return Vn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(en(n._readableStreamController,t),Gn(r)),null)),(e=>(en(n._readableStreamController,e),Yn(r,e),null))),r._finishPromise}(e,t)}),r,n),e._readable=fn(s,(function(){return function(e){return Bn(e,!1),e._backpressureChangePromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._writable;r._finishPromise=H(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return Vn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(Or(n._writableStreamController,t),jn(e),Gn(r)),null)),(t=>(Or(n._writableStreamController,t),jn(e),Yn(r,t),null))),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Bn(e,!0),e._transformStreamController=void 0}(this,H((e=>{l=e})),u,c,s,a),function(e,t){const r=Object.create(Wn.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return Hn(r,e),$(void 0)}catch(e){return z(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>$(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0),function(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,n,o,i)}(this,i),void 0!==i.start?l(i.start(this._transformStreamController)):l(void 0)}get readable(){if(!Dn(this))throw Kn("readable");return this._readable}get writable(){if(!Dn(this))throw Kn("writable");return this._writable}}function Dn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof qn}function xn(e,t){en(e._readable._readableStreamController,t),Mn(e,t)}function Mn(e,t){Vn(e._transformStreamController),Or(e._writable._writableStreamController,t),jn(e)}function jn(e){e._backpressure&&Bn(e,!1)}function Bn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=H((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(qn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(qn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class Wn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Fn(this))throw zn("desiredSize");return tn(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Fn(this))throw zn("enqueue");Hn(this,e)}error(e=void 0){if(!Fn(this))throw zn("error");var t;t=e,xn(this._controlledTransformStream,t)}terminate(){if(!Fn(this))throw zn("terminate");!function(e){const t=e._controlledTransformStream;Jr(t._readable._readableStreamController),Mn(t,new TypeError("TransformStream terminated"))}(this)}}function Fn(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Wn}function Vn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Hn(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!rn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Xr(n,t)}catch(e){throw Mn(r,e),r._readable._storedError}const o=function(e){return!Qr(e)}(n);o!==r._backpressure&&Bn(r,!0)}function $n(e,t){return Z(e._transformAlgorithm(t),void 0,(t=>{throw xn(e._controlledTransformStream,t),t}))}function zn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Gn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Yn(e,t){void 0!==e._finishPromise_reject&&(J(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Kn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Wn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),M(Wn.prototype.enqueue,"enqueue"),M(Wn.prototype.error,"error"),M(Wn.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Qn,Zn=(Qn=function(e,t){return Qn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},Qn(e,t)},function(e,t){function r(){this.constructor=e}Qn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Jn=function(){return Jn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jn.apply(this,arguments)},Xn=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return Zn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,n){var o=e.url,i=e.data,s=e.headers,a=wx.request({url:(0,N.formatUrl)("https:",o),data:i,timeout:t._timeout,method:"POST",header:s,success:function(e){r(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("post")&&"request:fail timeout"===e.errMsg){console.warn(t._timeoutMsg);try{a.abort()}catch(e){}}}})}))},t.prototype.upload=function(e){var t=this,r=this;return new Promise((function(n){return function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var t,o,i,s,a,u;return function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,(function(c){return t=e.url,o=e.file,i=e.data,s=e.headers,a=e.onUploadProgress,u=wx.uploadFile({url:t,filePath:o,name:"file",formData:Jn({},i),header:s,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&i.success_action_status&&(t.statusCode=parseInt(i.success_action_status,10)),n(t)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{u.abort()}catch(e){}}}}),a&&u.onProgressUpdate((function(e){a(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,r=this;return new Promise((function(n,o){var i=e.url,s=e.headers,a=wx.downloadFile({url:(0,N.formatUrl)("https:",i),header:s,timeout:t._timeout,success:function(e){200===e.statusCode&&e.tempFilePath?n({statusCode:200,tempFilePath:e.tempFilePath}):n(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("download")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{a.abort()}catch(e){}}}})}))},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,s=e.stream,a=void 0!==s&&s,u=this,c=null,l=new dn({start:function(e){c=e},cancel:function(){c=null}});return new Promise((function(e,s){a&&e({data:l});var h=wx.request({url:(0,N.formatUrl)("https:",t),data:r,timeout:u._timeout,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=c)||void 0===r||r.close(),!a&&e(t)},fail:function(e){var t;if(null===(t=c)||void 0===t||t.close(),s(e),a)throw e},complete:function(e){if(e&&e.errMsg&&u._timeout&&-1!==u._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg){console.warn(u._timeoutMsg);try{h.abort()}catch(e){}}},enableChunked:a});h.onChunkReceived((function(e){var t;null===(t=c)||void 0===t||t.enqueue(e.data)}))}))},t}(N.AbstractSDKRequest),eo={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}},to=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(Jn({url:e},t));return{set onopen(e){r.onOpen(e)},set onmessage(e){r.onMessage(e)},set onclose(e){r.onClose(e)},set onerror(e){r.onError(e)},send:function(e){return r.send({data:e})},close:function(e,t){return r.close({code:e,reason:t})},get readyState(){return r.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};const ro=function(){return{root:{},reqClass:Xn,wsClass:to,localStorage:eo,primaryStorage:N.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.plugin.appId:""}}},no=function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(e){return!1}return!0};var oo=r(105),io=function(){return io=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},io.apply(this,arguments)},so=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},ao=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},uo=function(){function e(e){this.localStorage=(null==e?void 0:e.localStorage)||globalThis.localStorage}return e.prototype.getItem=function(e){return so(this,void 0,void 0,(function(){return ao(this,(function(t){return[2,this.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return so(this,void 0,void 0,(function(){return ao(this,(function(t){return this.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return so(this,void 0,void 0,(function(){return ao(this,(function(r){return this.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),co=/^[^:]+:\/\/[^/]+(\/[^?#]+)/;var lo=function(e){if(!no()||e.storage&&e.baseRequest)return e;var t={};try{var r=ro(),n=r.localStorage,o=r.reqClass;if(n&&(t.storage=new uo({localStorage:n})),o){var i=new o({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});t.request=function(e){return function(t,r){var n;return so(this,void 0,void 0,(function(){var o;return ao(this,(function(i){return o=null===(n=null==r?void 0:r.headers)||void 0===n?void 0:n["x-request-id"],[2,new Promise((function(n,i){var s=Object.assign({},r);s.body&&"string"!=typeof s.body&&(s.body=JSON.stringify(s.body));var a=wx.request({url:t,data:s.body,timeout:e._timeout,method:s.method||"GET",header:s.headers,success:function(e){e.code&&(e={error:e.code,error_description:e.message||e.code,request_id:e.requestId}),e.request_id||(e.request_id=e.request_id||o),e.error&&(e.error_uri=function(e){return co.test(e)?RegExp.$1:e}(t),i(e)),n(e.data||{})},fail:function(e){i({error:"unreachable",error_description:e.message})},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("request")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{a.abort()}catch(e){}}}})}))]}))}))}}(i)}return io(io({},e),t)}catch(e){console.error("adapter generate fail:",e)}return e},ho=function(){return ho=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ho.apply(this,arguments)},fo=function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},po=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},mo=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},go=function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},yo="loginStateChanged",_o=new L.CloudbaseEventEmitter,vo=function(){function e(e){var t=e.cache,r=e.oauthInstance;this.cache=t,this.oauthInstance=r,this.setUserInfo()}return e.prototype.checkLocalInfo=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return mo(this,void 0,void 0,(function(){var e,t,r,n;return go(this,(function(o){switch(o.label){case 0:return e=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return e.uid=o.sent(),t=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return t.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),r=this,[4,this.getLocalUserInfoAsync("email")];case 3:return r.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),n=this,[4,this.getLocalUserInfoAsync("username")];case 4:return n.username=o.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},e.prototype.update=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(ho({},e))];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2]}}))}))},e.prototype.updateUserBasicInfo=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(ho({},e))];case 1:return t.sent(),this.setLocalUserInfo({username:e.username}),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&(0,C.throwError)(A.ERRORS.INVALID_PARAMS,"username must be a string"),this.update({username:e})},e.prototype.refresh=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2,t]}}))}))},e.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;return this.cache.getStore(t)[e]},e.prototype.getLocalUserInfoAsync=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,r.sent()[e]]}}))}))},e.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(t){e[t]=r[t]}))},e.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},fo([(0,U.catchErrorsDecorator)({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"update",null),fo([(0,U.catchErrorsDecorator)({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[String,String]),po("design:returntype",void 0)],e.prototype,"updatePassword",null),fo([(0,U.catchErrorsDecorator)({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[String]),po("design:returntype",void 0)],e.prototype,"updateUsername",null),fo([(0,U.catchErrorsDecorator)({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"refresh",null),e}(),bo=function(){function e(e){var t=e.envId,r=e.cache,n=e.oauthInstance;t||(0,C.throwError)(A.ERRORS.INVALID_PARAMS,"envId is not defined"),this.cache=r,this.oauthInstance=n,this.user=new vo({cache:this.cache,oauthInstance:n})}return e.prototype.checkLocalState=function(){var e;this.oauthLoginState=null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){var e;return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.getLoginState()];case 1:return t.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return t.sent(),[2]}}))}))},e}(),wo=function(){function e(e){this.config=e,this.cache=e.cache,this.oauthInstance=e.oauthInstance}return e.prototype.bindPhoneNumber=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.editContact(e)]}))}))},e.prototype.unbindProvider=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]}))}))},e.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},e.prototype.verify=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.verify(e)]}))}))},e.prototype.getVerification=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getVerification(e)]}))}))},Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var e=this.hasLoginState();return e&&e.user||null}(0,C.printWarn)(A.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),e.prototype.getCurrentUser=function(){return mo(this,void 0,void 0,(function(){var e;return go(this,(function(t){switch(t.label){case 0:return[4,this.getLoginState()];case 1:return(e=t.sent())?[4,e.user.checkLocalInfoAsync()]:[3,3];case 2:return t.sent(),[2,e.user||null];case 3:return[2,null]}}))}))},e.prototype.signInAnonymously=function(e){return void 0===e&&(e={}),mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signInWithOpenId=function(e){var t=(void 0===e?{}:e).useWxCloud,r=void 0===t||t;return mo(this,void 0,void 0,(function(){var e,t,n=this;return go(this,(function(o){switch(o.label){case 0:if(!no())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t=function(t){return mo(n,void 0,void 0,(function(){var n,o;return go(this,(function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},r)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:n.provider_token},r)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(o)];case 6:return i.sent(),[2]}}))}))},[4,new Promise((function(e,r){wx.login({success:function(o){return mo(n,void 0,void 0,(function(){var n;return go(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return n=i.sent(),r(n),[3,3];case 3:return[2]}}))}))},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})}))];case 1:return o.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signInWithUnionId=function(){return mo(this,void 0,void 0,(function(){var e=this;return go(this,(function(t){switch(t.label){case 0:if(!no())throw Error("wx api undefined");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise((function(t,r){var n=wx.getAccountInfoSync().miniProgram;wx.login({success:function(o){return mo(e,void 0,void 0,(function(){var e,i,s,a,u;return go(this,(function(c){switch(c.label){case 0:e=null==n?void 0:n.appId,c.label=1;case 1:return c.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:o.code,provider_id:e,provider_params:{provider_code_type:"union_id",appid:null==n?void 0:n.appId}})];case 2:return i=c.sent(),(s=i.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:s})]:(r(i),[2]);case 3:return(null==(a=c.sent())?void 0:a.error_code)?(r(a),[2]):(t(!0),[3,5]);case 4:return u=c.sent(),r(u),[3,5];case 5:return[2]}}))}))},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})}))];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}}))}))},e.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,r=void 0===t?"":t;return mo(this,void 0,void 0,(function(){var e,t,n,o,i;return go(this,(function(s){switch(s.label){case 0:if(!no())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:"phone"},provider_id:e.appId},[4,wx.login()];case 1:n=s.sent().code,t.provider_code=n,s.label=2;case 2:return s.trys.push([2,6,,7]),[4,this.oauthInstance.authApi.grantProviderToken(t)];case 3:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.patchProviderToken({provider_token:o.provider_token,provider_id:e.appId,provider_params:{code:r,provider_code_type:"phone"}})];case 4:if((o=s.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:o.provider_token})];case 5:if(null==(i=s.sent())?void 0:i.error_code)throw i;return[3,7];case 6:throw s.sent();case 7:return[2,this.createLoginState()]}}))}))},e.prototype.signInWithSms=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.phoneNum,s=void 0===i?"":i,a=e.bindInfo,u=void 0===a?void 0:a;return mo(this,void 0,void 0,(function(){var e,t,n,i,a;return go(this,(function(c){switch(c.label){case 0:return c.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:r.verification_id,verification_code:o})];case 1:if(null==(e=c.sent())?void 0:e.error_code)throw e;return t=e.verification_token,r.is_user?[4,this.oauthInstance.authApi.signIn({username:"+86 ".concat(s),verification_token:t})]:[3,5];case 2:if(null==(n=c.sent())?void 0:n.error_code)throw n;return u?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:null==u?void 0:u.providerToken})]:[3,4];case 3:if(null==(i=c.sent())?void 0:i.error_code)throw i;c.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp({phone_number:"+86 ".concat(s),verification_token:t,provider_token:null==u?void 0:u.providerId})];case 6:if(null==(a=c.sent())?void 0:a.error_code)throw a;c.label=7;case 7:return[2,this.createLoginState()];case 8:throw c.sent();case 9:return[2]}}))}))},e.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},e.prototype.signInWithCustomTicket=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.signIn=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.signUp=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signUp(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.setPassword=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.setPassword(e)]}))}))},e.prototype.isUsernameRegistered=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return"string"!=typeof e&&(0,C.throwError)(A.ERRORS.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}}))}))},e.prototype.signOut=function(e){return mo(this,void 0,void 0,(function(){var t,r;return go(this,(function(n){switch(n.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return r=n.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return n.sent(),_o.fire(yo),[2,r]}}))}))},e.prototype.hasLoginState=function(){var e;if("async"!==this.cache.mode)return(null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync())?new bo({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,C.printWarn)(A.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return e.sent()?[2,new bo({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},e.prototype.getUserInfo=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getUserInfo(e)]}))}))},e.prototype.getWedaUserInfo=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},e.prototype.updateUserBasicInfo=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(t=r.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},e.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},e.prototype.bindWithProvider=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]}))}))},e.prototype.queryUser=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]}))}))},e.prototype.getAccessToken=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}}))}))},e.prototype.grantProviderToken=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]}))}))},e.prototype.patchProviderToken=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]}))}))},e.prototype.signInWithProvider=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.signInWithWechat=function(e){return void 0===e&&(e={}),mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}}))}))},e.prototype.grantToken=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}}))}))},e.prototype.genProviderRedirectUri=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]}))}))},e.prototype.resetPassword=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]}))}))},e.prototype.deviceAuthorize=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]}))}))},e.prototype.sudo=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.sudo(e)]}))}))},e.prototype.deleteMe=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]}))}))},e.prototype.getProviders=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getProviders()]}))}))},e.prototype.loginScope=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.loginScope()]}))}))},e.prototype.loginGroups=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},e.prototype.onLoginStateChanged=function(e){return mo(this,void 0,void 0,(function(){var t,r=this;return go(this,(function(n){switch(n.label){case 0:return _o.on(yo,(function(){return mo(r,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))},e.prototype.refreshTokenForce=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]}))}))},e.prototype.getCredentials=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},e.prototype.setCredentials=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getProviderSubType=function(){return mo(this,void 0,void 0,(function(){return go(this,(function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]}))}))},e.prototype.createCaptchaData=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]}))}))},e.prototype.verifyCaptchaData=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]}))}))},e.prototype.getMiniProgramQrCode=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]}))}))},e.prototype.getMiniProgramQrCodeStatus=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]}))}))},e.prototype.modifyPassword=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]}))}))},e.prototype.getUserBehaviorLog=function(e){return mo(this,void 0,void 0,(function(){return go(this,(function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]}))}))},e.prototype.createLoginState=function(e){return mo(this,void 0,void 0,(function(){var t;return go(this,(function(r){switch(r.label){case 0:return[4,(t=new bo({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),[4,t.user.refresh(e)];case 2:return r.sent(),_o.fire(yo),[2,t]}}))}))},fo([(0,U.catchErrorsDecorator)({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"bindPhoneNumber",null),fo([(0,U.catchErrorsDecorator)({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"unbindProvider",null),fo([(0,U.catchErrorsDecorator)({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",void 0)],e.prototype,"bindEmail",null),fo([(0,U.catchErrorsDecorator)({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"verify",null),fo([(0,U.catchErrorsDecorator)({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"getVerification",null),fo([(0,U.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getCurrentUser",null),fo([(0,U.catchErrorsDecorator)({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInAnonymously",null),fo([(0,U.catchErrorsDecorator)({title:"小程序openId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().signInWithOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithOpenId",null),fo([(0,U.catchErrorsDecorator)({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"signInWithUnionId",null),fo([(0,U.catchErrorsDecorator)({title:"小程序手机号授权登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序手机号授权登录"," 2 - 调用 auth().signInWithPhoneAuth() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithPhoneAuth",null),fo([(0,U.catchErrorsDecorator)({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithSms",null),fo([(0,U.catchErrorsDecorator)({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signInWithCustomTicket",null),fo([(0,U.catchErrorsDecorator)({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signUp",null),fo([(0,U.catchErrorsDecorator)({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[String]),po("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),fo([(0,U.catchErrorsDecorator)({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"signOut",null),fo([(0,U.catchErrorsDecorator)({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getLoginState",null),fo([(0,U.catchErrorsDecorator)({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"getUserInfo",null),fo([(0,U.catchErrorsDecorator)({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getWedaUserInfo",null),fo([(0,U.catchErrorsDecorator)({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[Object]),po("design:returntype",Promise)],e.prototype,"bindWithProvider",null),fo([(0,U.catchErrorsDecorator)({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(A.COMMUNITY_SITE_URL)]}),po("design:type",Function),po("design:paramtypes",[]),po("design:returntype",Promise)],e.prototype,"getProviderSubType",null),e}();function So(e,t){var r=e.region,n=void 0===r?"ap-shanghai":r,o=(null==t?void 0:t.platform)||(0,oo.useDefaultAdapter)(),i=o.runtime,s=t||{},a=s.env,u=s.clientId,c=s.debug,l=s.cache,h=s.app,d=(t||{}).apiOrigin;d||(d="https://".concat(a,".").concat(n,".tcb-api.tencentcloudapi.com"));var f=new O(lo({env:a,clientId:u,apiOrigin:d,storage:null==e?void 0:e.storage,baseRequest:null==e?void 0:e.baseRequest,request:null==e?void 0:e.request,anonymousSignInFunc:null==e?void 0:e.anonymousSignInFunc,captchaOptions:null==e?void 0:e.captchaOptions,wxCloud:null==e?void 0:e.wxCloud}));return{authInstance:new wo({env:a,region:n,persistence:e.persistence,debug:c,cache:l||new k.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:"user_info_".concat(a)},platformInfo:o}),runtime:i||"web",_fromApp:h,oauthInstance:f}),oauthInstance:f}}var To={name:"auth",namespace:"auth",entity:function(e){if(void 0===e&&(e={region:"",persistence:"local"}),this.authInstance)return(0,C.printWarn)(A.ERRORS.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var t=this.platform.adapter,r=e.persistence||t.primaryStorage;r&&r!==this.config.persistence&&this.updateConfig({persistence:r});var n=So(ho(ho({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence}),{env:this.config.env,clientId:this.config.clientId,apiOrigin:this.request.getBaseEndPoint(),platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),o=n.authInstance,i=n.oauthInstance;return this.oauthInstance=i,this.authInstance=o,this.authInstance}};try{cloudbase.registerComponent(To)}catch(q){}function Io(e){try{e.registerComponent(To)}catch(e){console.warn(e)}}},443:(e,t,r)=>{let n;if(r.r(t),r.d(t,{getEncryptInfo:()=>U}),!globalThis.IS_MP_BUILD){const L="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;var o="0123456789abcdefghijklmnopqrstuvwxyz";function k(e){return o.charAt(e)}function N(e,t){return e&t}function q(e,t){return e|t}function D(e,t){return e^t}function x(e,t){return e&~t}function M(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function j(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function B(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=i.charAt(r>>6)+i.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=i.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=i.charAt(r>>2)+i.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function W(e){var t,r="",n=0,o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var s=i.indexOf(e.charAt(t));s<0||(0==n?(r+=k(s>>2),o=3&s,n=1):1==n?(r+=k(o<<2|s>>4),o=15&s,n=2):2==n?(r+=k(o),r+=k(s>>2),o=3&s,n=3):(r+=k(o<<2|s>>4),r+=k(15&s),n=0))}return 1==n&&(r+=k(o<<2)),r}var s,a,u={decode:function(e){var t;if(void 0===s){var r="0123456789ABCDEF";for(s={},t=0;t<16;++t)s[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)s[r.charAt(t)]=t;for(t=0;t<8;++t)s[" \f\n\r\t \u2028\u2029".charAt(t)]=-1}var n=[],o=0,i=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=s[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);o|=a,++i>=2?(n[n.length]=o,o=0,i=0):o<<=4}}if(i)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},c={decode:function(e){var t;if(void 0===a){for(a=Object.create(null),t=0;t<64;++t)a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(t=0;t<9;++t)a["= \f\n\r\t \u2028\u2029".charAt(t)]=-1}var r=[],n=0,o=0;for(t=0;t<e.length;++t){var i=e.charAt(t);if("="==i)break;if(-1!=(i=a[i])){if(void 0===i)throw new Error("Illegal character at offset "+t);n|=i,++o>=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,o=0):n<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=c.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return c.decode(e)}},l=1e13;class F{constructor(e){this.buf=[+e||0]}mulAdd(e,t){var r,n,o=this.buf,i=o.length;for(r=0;r<i;++r)(n=o[r]*e+t)<l?t=0:n-=(t=0|n/l)*l,o[r]=n;t>0&&(o[r]=t)}sub(e){var t,r,n=this.buf,o=n.length;for(t=0;t<o;++t)(r=n[t]-e)<0?(r+=l,e=1):e=0,n[t]=r;for(;0===n[n.length-1];)n.pop()}toString(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,r=t[t.length-1].toString(),n=t.length-2;n>=0;--n)r+=(l+t[n]).toString().substring(1);return r}valueOf(){for(var e=this.buf,t=0,r=e.length-1;r>=0;--r)t=t*l+e[r];return t}simplify(){var e=this.buf;return 1==e.length?e[0]:this}}var h,d=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,f=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function V(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}class H{constructor(e,t){this.hexDigits="0123456789ABCDEF",e instanceof H?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=t)}get(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset "+e+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]}hexByte(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)}hexDump(e,t,r){for(var n="",o=e;o<t;++o)if(n+=this.hexByte(this.get(o)),!0!==r)switch(15&o){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(e,t){for(var r=e;r<t;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(e,t){for(var r="",n=e;n<t;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(e,t){for(var r="",n=e;n<t;){var o=this.get(n++);r+=o<128?String.fromCharCode(o):o>191&&o<224?String.fromCharCode((31&o)<<6|63&this.get(n++)):String.fromCharCode((15&o)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(e,t){for(var r,n,o="",i=e;i<t;)r=this.get(i++),n=this.get(i++),o+=String.fromCharCode(r<<8|n);return o}parseTime(e,t,r){var n=this.parseStringISO(e,t),o=(r?d:f).exec(n);return o?(r&&(o[1]=+o[1],o[1]+=+o[1]<70?2e3:1900),n=o[1]+"-"+o[2]+"-"+o[3]+" "+o[4],o[5]&&(n+=":"+o[5],o[6]&&(n+=":"+o[6],o[7]&&(n+="."+o[7]))),o[8]&&(n+=" UTC","Z"!=o[8]&&(n+=o[8],o[9]&&(n+=":"+o[9]))),n):"Unrecognized time: "+n}parseInteger(e,t){for(var r,n=this.get(e),o=n>127,i=o?255:0,s="";n==i&&++e<t;)n=this.get(e);if(0==(r=t-e))return o?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^i));)s=+s<<1,--r;s="("+r+" bit)\n"}o&&(n-=256);for(var a=new F(n),u=e+1;u<t;++u)a.mulAdd(256,this.get(u));return s+a.toString()}parseBitString(e,t,r){for(var n=this.get(e),o="("+((t-e-1<<3)-n)+" bit)\n",i="",s=e+1;s<t;++s){for(var a=this.get(s),u=s==t-1?n:0,c=7;c>=u;--c)i+=a>>c&1?"1":"0";if(i.length>r)return o+V(i,r)}return o+i}parseOctetString(e,t,r){if(this.isASCII(e,t))return V(this.parseStringISO(e,t),r);var n=t-e,o="("+n+" byte)\n";n>(r/=2)&&(t=e+r);for(var i=e;i<t;++i)o+=this.hexByte(this.get(i));return n>r&&(o+="…"),o}parseOID(e,t,r){for(var n="",o=new F,i=0,s=e;s<t;++s){var a=this.get(s);if(o.mulAdd(128,127&a),i+=7,!(128&a)){if(""===n)if((o=o.simplify())instanceof F)o.sub(80),n="2."+o.toString();else{var u=o<80?o<40?0:1:2;n=u+"."+(o-40*u)}else n+="."+o.toString();if(n.length>r)return V(n,r);o=new F,i=0}}return i>0&&(n+=".incomplete"),n}}class ${constructor(e,t,r,n,o){if(!(n instanceof z))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=r,this.tag=n,this.sub=o}typeName(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}}content(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+r,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);case 6:return this.stream.parseOID(t,t+r,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return V(this.stream.parseStringUTF(t,t+r),e);case 18:case 19:case 20:case 21:case 22:case 26:return V(this.stream.parseStringISO(t,t+r),e);case 30:return V(this.stream.parseStringBMP(t,t+r),e);case 23:case 24:return this.stream.parseTime(t,t+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var r=0,n=this.sub.length;r<n;++r)t+=this.sub[r].toPrettyString(e)}return t}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(e){var t=e.get(),r=127&t;if(r==t)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===r)return null;t=0;for(var n=0;n<r;++n)t=256*t+e.get();return t}getHexStringValue(){var e=this.toHexString(),t=2*this.header,r=2*this.length;return e.substr(t,r)}static decode(e){var t;t=e instanceof H?e:new H(e,0);var r=new H(t),n=new z(t),o=$.decodeLength(t),i=t.pos,s=i-r.pos,a=null,u=function(){var e=[];if(null!==o){for(var r=i+o;t.pos<r;)e[e.length]=$.decode(t);if(t.pos!=r)throw new Error("Content size is not correct for container starting at offset "+i)}else try{for(;;){var n=$.decode(t);if(n.tag.isEOC())break;e[e.length]=n}o=i-t.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return e};if(n.tagConstructed)a=u();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=t.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var c=0;c<a.length;++c)if(a[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){a=null}if(null===a){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+i);t.pos=i+Math.abs(o)}return new $(r,s,o,n,a)}}class z{constructor(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var r=new F;do{t=e.get(),r.mulAdd(128,127&t)}while(128&t);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var p=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],m=(1<<26)/p[p.length-1];class G{constructor(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}toString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,i="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(o=!0,i=k(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(o=!0),o&&(i+=k(r));return o?i:"0"}negate(){var e=Y();return G.ZERO.subTo(this,e),e}abs(){return this.s<0?this.negate():this}compareTo(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+te(this[this.t-1]^this.s&this.DM)}mod(e){var t=Y();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(G.ZERO)>0&&e.subTo(t,t),t}modPowInt(e,t){var r;return r=e<256||t.isEven()?new y(t):new _(t),this.exp(e,r)}clone(){var e=Y();return this.copyTo(e),e}intValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var e=this.t,t=[];t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),128&r&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t}equals(e){return 0==this.compareTo(e)}min(e){return this.compareTo(e)<0?this:e}max(e){return this.compareTo(e)>0?this:e}and(e){var t=Y();return this.bitwiseTo(e,N,t),t}or(e){var t=Y();return this.bitwiseTo(e,q,t),t}xor(e){var t=Y();return this.bitwiseTo(e,D,t),t}andNot(e){var t=Y();return this.bitwiseTo(e,x,t),t}not(){for(var e=Y(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}shiftLeft(e){var t=Y();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}shiftRight(e){var t=Y();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}getLowestSetBit(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+M(this[e]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=j(this[r]^t);return e}testBit(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)}setBit(e){return this.changeBit(e,q)}clearBit(e){return this.changeBit(e,x)}flipBit(e){return this.changeBit(e,D)}add(e){var t=Y();return this.addTo(e,t),t}subtract(e){var t=Y();return this.subTo(e,t),t}multiply(e){var t=Y();return this.multiplyTo(e,t),t}divide(e){var t=Y();return this.divRemTo(e,t,null),t}remainder(e){var t=Y();return this.divRemTo(e,null,t),t}divideAndRemainder(e){var t=Y(),r=Y();return this.divRemTo(e,t,r),[t,r]}modPow(e,t){var r,n,o=e.bitLength(),i=ee(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new y(t):t.isEven()?new v(t):new _(t);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var l=Y();for(n.sqrTo(s[1],l);a<=c;)s[a]=Y(),n.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=e.t-1,p=!0,m=Y();for(o=te(e[f])-1;f>=0;){for(o>=u?h=e[f]>>o-u&c:(h=(e[f]&(1<<o+1)-1)<<u-o,f>0&&(h|=e[f-1]>>this.DB+o-u)),a=r;!(1&h);)h>>=1,--a;if((o-=a)<0&&(o+=this.DB,--f),p)s[h].copyTo(i),p=!1;else{for(;a>1;)n.sqrTo(i,m),n.sqrTo(m,i),a-=2;a>0?n.sqrTo(i,m):(d=i,i=m,m=d),n.mulTo(m,s[h],i)}for(;f>=0&&!(e[f]&1<<o);)n.sqrTo(i,m),d=i,i=m,m=d,--o<0&&(o=this.DB-1,--f)}return n.revert(i)}modInverse(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return G.ZERO;for(var r=e.clone(),n=this.clone(),o=ee(1),i=ee(0),s=ee(0),a=ee(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&i.isEven()||(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(s,o),i.subTo(a,i)):(n.subTo(r,n),t&&s.subTo(o,s),a.subTo(i,a))}return 0!=n.compareTo(G.ONE)?G.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a}pow(e){return this.exp(e,new g)}gcd(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}isProbablePrime(e){var t,r=this.abs();if(1==r.t&&r[0]<=p[p.length-1]){for(t=0;t<p.length;++t)if(r[0]==p[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<p.length;){for(var n=p[t],o=t+1;o<p.length&&n<m;)n*=p[o++];for(n=r.modInt(n);t<o;)if(n%p[t++]==0)return!1}return r.millerRabin(e)}copyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}fromInt(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}fromString(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var s=8==r?255&+e[n]:X(e,n);s<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==i?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,(i+=r)>=this.DB&&(i-=this.DB))}8==r&&128&+e[0]&&(this.s=-1,i>0&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&G.ZERO.subTo(this,this)}clamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}dlShiftTo(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}drShiftTo(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}lShiftTo(e,t){for(var r=e%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(e/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)t[a+i+1]=this[a]>>n|s,s=(this[a]&o)<<r;for(a=i-1;a>=0;--a)t[a]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}rShiftTo(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&i)<<o,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}}subTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}multiplyTo(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&G.ZERO.subTo(t,t)}squareTo(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}divRemTo(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=Y());var i=Y(),s=this.s,a=e.s,u=this.DB-te(n[n.t-1]);u>0?(n.lShiftTo(u,i),o.lShiftTo(u,r)):(n.copyTo(i),o.copyTo(r));var c=i.t,l=i[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?i[c-2]>>this.F2:0),d=this.FV/h,f=(1<<this.F1)/h,p=1<<this.F2,m=r.t,g=m-c,y=null==t?Y():t;for(i.dlShiftTo(g,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),G.ONE.dlShiftTo(c,y),y.subTo(i,i);i.t<c;)i[i.t++]=0;for(;--g>=0;){var _=r[--m]==l?this.DM:Math.floor(r[m]*d+(r[m-1]+p)*f);if((r[m]+=i.am(0,_,r,g,0,c))<_)for(i.dlShiftTo(g,y),r.subTo(y,r);r[m]<--_;)r.subTo(y,r)}null!=t&&(r.drShiftTo(c,t),s!=a&&G.ZERO.subTo(t,t)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&G.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(e,t){if(e>4294967295||e<1)return G.ONE;var r=Y(),n=Y(),o=t.convert(this),i=te(e)-1;for(o.copyTo(r);--i>=0;)if(t.sqrTo(r,n),(e&1<<i)>0)t.mulTo(n,o,r);else{var s=r;r=n,n=s}return t.revert(r)}chunkSize(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}toRadix(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=ee(r),o=Y(),i=Y(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(e).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(e)+s}fromRadix(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,i=0,s=0,a=0;a<e.length;++a){var u=X(e,a);u<0?"-"==e.charAt(a)&&0==this.signum()&&(o=!0):(s=t*s+u,++i>=r&&(this.dMultiply(n),this.dAddOffset(s,0),i=0,s=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),o&&G.ZERO.subTo(this,this)}fromNumber(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(G.ONE.shiftLeft(e-1),q,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(G.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}bitwiseTo(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r[n]=t(this[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r[n]=t(o,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}changeBit(e,t){var r=G.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}addTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}dMultiply(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}multiplyLowerTo(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var o=r.t-this.t;n<o;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}multiplyUpperTo(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}modInt(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}millerRabin(e){var t=this.subtract(G.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);(e=e+1>>1)>p.length&&(e=p.length);for(var o=Y(),i=0;i<e;++i){o.fromInt(p[Math.floor(Math.random()*p.length)]);var s=o.modPow(n,this);if(0!=s.compareTo(G.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(G.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0}square(){var e=Y();return this.squareTo(e),e}gcda(e,t){var r=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(r.compareTo(n)<0){var o=r;r=n,n=o}var i=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)t(r);else{i<s&&(s=i),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){t(n)}),0))};setTimeout(a,10)}}fromNumberAsync(e,t,r,n){if("number"==typeof t)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(G.ONE.shiftLeft(e-1),q,this),this.isEven()&&this.dAddOffset(1,0);var o=this,i=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(G.ONE.shiftLeft(e-1),o),o.isProbablePrime(t)?setTimeout((function(){n()}),0):setTimeout(i,0)};setTimeout(i,0)}else{var s=[],a=7&e;s.length=1+(e>>3),t.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var g=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),y=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),_=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=Y();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(G.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=Y();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),v=function(){function e(e){this.m=e,this.r2=Y(),this.q3=Y(),G.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=Y();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function Y(){return new G(null)}function K(e,t){return new G(e,t)}function Q(e,t,r,n,o,i){for(;--i>=0;){var s=t*this[e++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=67108863&s}return o}function Z(e,t,r,n,o,i){for(var s=32767&t,a=t>>15;--i>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;o=((u=s*u+((32767&l)<<15)+r[n]+(1073741823&o))>>>30)+(l>>>15)+a*c+(o>>>30),r[n++]=1073741823&u}return o}function J(e,t,r,n,o,i){for(var s=16383&t,a=t>>14;--i>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;o=((u=s*u+((16383&l)<<14)+r[n]+o)>>28)+(l>>14)+a*c,r[n++]=268435455&u}return o}void 0!==L&&"Microsoft Internet Explorer"==L?.appName?(G.prototype.am=Z,h=30):"Netscape"!=L?.appName?(G.prototype.am=Q,h=26):(G.prototype.am=J,h=28),G.prototype.DB=h,G.prototype.DM=(1<<h)-1,G.prototype.DV=1<<h,G.prototype.FV=Math.pow(2,52),G.prototype.F1=52-h,G.prototype.F2=2*h-52;var b,w,S=[];for(b="0".charCodeAt(0),w=0;w<=9;++w)S[b++]=w;for(b="a".charCodeAt(0),w=10;w<36;++w)S[b++]=w;for(b="A".charCodeAt(0),w=10;w<36;++w)S[b++]=w;function X(e,t){var r=S[e.charCodeAt(t)];return null==r?-1:r}function ee(e){var t=Y();return t.fromInt(e),t}function te(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}G.ZERO=ee(0),G.ONE=ee(1);class re{constructor(){this.i=0,this.j=0,this.S=[]}init(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}next(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}}var T,I,E=null;if(null==E){E=[],I=0;var R=void 0;if(window?.crypto&&window?.crypto.getRandomValues){var P=new Uint32Array(256);for(window?.crypto.getRandomValues(P),R=0;R<P.length;++R)E[I++]=255&P[R]}var O=function(e){if(this.count=this.count||0,this.count>=256||I>=256)window?.removeEventListener?window?.removeEventListener("mousemove",O,!1):window?.detachEvent&&window?.detachEvent("onmousemove",O);else try{var t=e.x+e.y;E[I++]=255&t,this.count+=1}catch(e){}};window?.addEventListener?window?.addEventListener("mousemove",O,!1):window?.attachEvent&&window?.attachEvent("onmousemove",O)}function ne(){if(null==T){for(T=new re;I<256;){var e=Math.floor(65536*Math.random());E[I++]=255&e}for(T.init(E),I=0;I<E.length;++I)E[I]=0;I=0}return T.next()}class oe{constructor(){}nextBytes(e){for(var t=0;t<e.length;++t)e[t]=ne()}}function ie(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=e.length-1;n>=0&&t>0;){var o=e.charCodeAt(n--);o<128?r[--t]=o:o>127&&o<2048?(r[--t]=63&o|128,r[--t]=o>>6|192):(r[--t]=63&o|128,r[--t]=o>>6&63|128,r[--t]=o>>12|224)}r[--t]=0;for(var i=new oe,s=[];t>2;){for(s[0]=0;0==s[0];)i.nextBytes(s);r[--t]=s[0]}return r[--t]=2,r[--t]=0,new G(r)}class se{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(e){return e.modPowInt(this.e,this.n)}doPrivate(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=K(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")}encrypt(e){var t=ie(e,this.n.bitLength()+7>>3);if(null==t)return null;var r=this.doPublic(t);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(e){var t=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return e.length>r?(e.match(/.{1,117}/g).forEach((function(e){var r=t.encrypt(e);n+=r})),B(n)):B(this.encrypt(e))}catch(e){return!1}}decryptLong(e){var t=this,r=this.n.bitLength()+7>>3;e=W(e);try{if(e.length>r){var n="";return e.match(/.{1,256}/g).forEach((function(e){var r=t.decrypt(e);n+=r})),n}return this.decrypt(e)}catch(e){return!1}}setPrivate(e,t,r){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=K(e,16),this.e=parseInt(t,16),this.d=K(r,16)):console.error("Invalid RSA private key")}setPrivateEx(e,t,r,n,o,i,s,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=K(e,16),this.e=parseInt(t,16),this.d=K(r,16),this.p=K(n,16),this.q=K(o,16),this.dmp1=K(i,16),this.dmq1=K(s,16),this.coeff=K(a,16)):console.error("Invalid RSA private key")}generate(e,t){var r=new oe,n=e>>1;this.e=parseInt(t,16);for(var o=new G(t,16);;){for(;this.p=new G(e-n,1,r),0!=this.p.subtract(G.ONE).gcd(o).compareTo(G.ONE)||!this.p.isProbablePrime(10););for(;this.q=new G(n,1,r),0!=this.q.subtract(G.ONE).gcd(o).compareTo(G.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var i=this.p;this.p=this.q,this.q=i}var s=this.p.subtract(G.ONE),a=this.q.subtract(G.ONE),u=s.multiply(a);if(0==u.gcd(o).compareTo(G.ONE)){this.n=this.p.multiply(this.q),this.d=o.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(e){var t=K(e,16),r=this.doPrivate(t);return null==r?null:ae(r,this.n.bitLength()+7>>3)}generateAsync(e,t,r){var n=new oe,o=e>>1;this.e=parseInt(t,16);var i=new G(t,16),s=this,a=()=>{var t=()=>{if(s.p.compareTo(s.q)<=0){var e=s.p;s.p=s.q,s.q=e}var t=s.p.subtract(G.ONE),n=s.q.subtract(G.ONE),o=t.multiply(n);0==o.gcd(i).compareTo(G.ONE)?(s.n=s.p.multiply(s.q),s.d=i.modInverse(o),s.dmp1=s.d.mod(t),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=()=>{s.q=Y(),s.q.fromNumberAsync(o,1,n,(function(){s.q.subtract(G.ONE).gcda(i,(function(e){0==e.compareTo(G.ONE)&&s.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(u,0)}))}))},c=()=>{s.p=Y(),s.p.fromNumberAsync(e-o,1,n,(function(){s.p.subtract(G.ONE).gcda(i,(function(e){0==e.compareTo(G.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)}}function ae(e,t){for(var r=e.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=t-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var o="";++n<r.length;){var i=255&r[n];i<128?o+=String.fromCharCode(i):i>191&&i<224?(o+=String.fromCharCode((31&i)<<6|63&r[n+1]),++n):(o+=String.fromCharCode((15&i)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return o}class ue extends se{constructor(e=""){super(),e&&("string"==typeof e?this.parseKey(e):(this.hasPrivateKeyProperty(e)||this.hasPublicKeyProperty(e))&&this.parsePropertiesFrom(e))}parseKey(e){try{var t=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?u.decode(e):c.unarmor(e),o=$.decode(n);if(3===o.sub.length&&(o=o.sub[2].sub[0]),9===o.sub.length){t=o.sub[1].getHexStringValue(),this.n=K(t,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var i=o.sub[3].getHexStringValue();this.d=K(i,16);var s=o.sub[4].getHexStringValue();this.p=K(s,16);var a=o.sub[5].getHexStringValue();this.q=K(a,16);var l=o.sub[6].getHexStringValue();this.dmp1=K(l,16);var h=o.sub[7].getHexStringValue();this.dmq1=K(h,16);var d=o.sub[8].getHexStringValue();this.coeff=K(d,16)}else{if(2!==o.sub.length)return!1;var f=o.sub[1].sub[0];t=f.sub[0].getHexStringValue(),this.n=K(t,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(e){return!1}}hasPublicKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")}hasPrivateKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")}parsePropertiesFrom(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)}}n=function(e){e=e||{},this.default_key_size=parseInt(e.default_key_size,10)||1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null},n.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new ue(e)},n.prototype.setPrivateKey=function(e){this.setKey(e)},n.prototype.setPublicKey=function(e){this.setKey(e)},n.prototype.decrypt=function(e){try{return this.getKey().decrypt(W(e))}catch(e){return!1}},n.prototype.encrypt=function(e){try{return B(this.getKey().encrypt(e))}catch(e){return!1}},n.prototype.encryptLong=function(e){try{for(var t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",n=0,o=/null$/g;o.test(r)&&(n++,t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",!(n>10)););return t}catch(e){return!1}},n.prototype.getKey=function(e){if(!this.key){if(this.key=new ue,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.version="3.1.4"}const C=n;var A=r(479);const U=({publicKey:e="",payload:t={}}={})=>{if(!e)return"";try{const r=(0,A.I)(t),n=new C;return n.setPublicKey(e),n.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(e){console.error("encrypt error:",e)}return""}},479:(e,t,r)=>{r.d(t,{I:()=>n,y:()=>o});const n=e=>{const t=t=>{for(const r in e)e.hasOwnProperty(r)&&(t[r]=n(e[r]));return t},r=null==e?"NullOrUndefined":Object.prototype.toString.call(e).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return e.slice();switch(r){case"Object":return t(Object.create(Object.getPrototypeOf(e)));case"Array":return t([]);case"Date":return new Date(e.valueOf());case"RegExp":return new RegExp(e.source,(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":""));default:return e}},o=e=>{const t=e.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return t&&t[2]||""}},105:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,a=i(r(587)),u=r(894);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,r=(0,u.isArray)(e)?e:[e];t<r.length;t++){var n=r[t],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},t.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},587:function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var u=r(997),c=r(894),l=r(652),h=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,s=e.headers,a=void 0===s?{}:s,u={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===u?(Object.keys(t).forEach((function(e){c.append(e,t[e])})),c.append("key",n),c.append("file",r),this.request(i(i({},e),{data:c,method:u}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=s.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o,s,u,c,l,h=this;return a(this,(function(a){switch(a.label){case 0:return t=e.url,r=e.enableAbort,n=void 0!==r&&r,o=e.stream,s=void 0!==o&&o,u=new AbortController,c=null,n&&this.timeout&&(c=setTimeout((function(){console.warn(h.timeoutMsg),u.abort(h.timeoutMsg)}),this.timeout)),[4,fetch(t,i(i({},e),{signal:u.signal})).then((function(e){return clearTimeout(c),e})).catch((function(e){return clearTimeout(c),Promise.reject(e)}))];case 1:return l=a.sent(),[2,{data:s?l.body:l.json(),statusCode:l.status,header:l.headers}]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=e.url,u=e.headers,h=void 0===u?{}:u,d=e.data,f=e.responseType,p=e.withCredentials,m=e.body,g=e.onUploadProgress,y=(0,c.formatUrl)((0,l.getProtocol)(),a,"get"===n?d:{}),_=new XMLHttpRequest;_.open(n,y),f&&(_.responseType=f),Object.keys(h).forEach((function(e){_.setRequestHeader(e,h[e])})),g&&_.upload.addEventListener("progress",g),_.onreadystatechange=function(){var e={};if(4===_.readyState){var t=_.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach((function(e){var t=e.split(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o})),e.header=r,e.statusCode=_.status;try{e.data="blob"===f?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===f?_.response:_.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=(0,c.isFormData)(d)?d:"application/x-www-form-urlencoded"===h["content-type"]?(0,c.toQueryString)(d):m||(d?JSON.stringify(d):void 0),p&&(_.withCredentials=!0),_.send(s)}))},t}(u.AbstractSDKRequest);t.WebRequest=h,t.genAdapter=function(){return{root:window,reqClass:h,wsClass:WebSocket,localStorage}}},652:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var r="@cloudbase/js-sdk";t.setSdkName=function(e){r=e},t.getSdkName=function(){return r};var n="https:";t.setProtocol=function(e){n=e},t.getProtocol=function(){return n},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},151:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},141:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(652),t),o(r(151),t),t.OATUH_LOGINTYPE="constants"},64:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(894),s=r(141),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var u=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,c=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function l(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),u=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),l=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),h=s.findIndex((function(e){return u.test(e)}));if(-1!==h){var d=s.filter((function(e,t){return t>h}));d.unshift(s[h].replace(l,"".concat(r,".").concat(n)).replace(c,o)),(i=new Error).stack="".concat(a?"@debugger":"Error","\n").concat(d.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,a=e.customInfo,h=void 0===a?{}:a,d=e.title,f=e.messages,p=void 0===f?[]:f;return function(e,t,a){if(s.IS_DEBUG_MODE){var f=h.className||e.constructor.name,m=h.methodName||t,g=a.value,y=function(){var e="",t=(new Error).stack.split("\n"),r=t.findIndex((function(e){return u.test(e)}));if(-1!==r){var n=c.exec(t[r+1]||"");e=n?n[0]:""}return e}();a.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l({err:new Error,className:f,methodName:m,sourceLink:y});try{return g.apply(this,e)}catch(e){var n=e,o=e.message,s=e.error,a=e.error_description,u={title:d||"".concat(f,".").concat(m," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var c=JSON.parse(o);u.subtitle=o,c.code&&(r?(r.code=c.code,r.msg=c.msg):(e.code=c.code,e.message=c.msg),n=r||e,u.content=p.map((function(e){return{type:"info",body:e}})))}throw s&&a&&(u.subtitle=a,r?(r.code=s,r.msg=a):(e.code=s,e.message=a),n=r||e,u.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n,s,a,u,c,h;return o(this,(function(o){switch(o.label){case 0:t=l({err:new Error,className:f,methodName:m,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,g.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,s=r.message,a=r.error,u=r.error_description,c={title:d||"".concat(f,".").concat(m," failed"),content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(h=JSON.parse(s),c.subtitle=h,h.code&&(t?(t.code=h.code,t.message=h.msg):(r.code=h.code,r.message=h.msg),n=t||r,c.content=p.map((function(e){return{type:"info",body:e}})))),a&&u&&(c.subtitle=u,t?(t.code=a,t.msg=u):(r.code=a,r.message=u),n=t||r,c.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(c),n;case 4:return[2]}}))}))}}}}},466:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(64),t)},418:function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var a=r(997),u=r(894),c=r(141),l=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return o(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(a.AbstractStorage),h=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,u.printWarn)(c.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:c.ERRORS.OPERATION_FAIL,msg:"[".concat((0,c.getSdkName)(),"][").concat(c.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return i(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):(0,u.printWarn)(c.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();t.CloudbaseCache=h},988:function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=r(894),a=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=a;var u=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return o(t,e),t}(a);t.IErrorEvent=u;var c=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,s.isInstanceOf)(e,u))return console.error(e.error),this;var r=(0,s.isString)(e)?new a(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,c=this.listeners[n]?i([],this.listeners[n],!0):[];o<c.length;o++)c[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=c;var l=new c;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},894:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var n=r(141);t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=(new Date).getTime(),t=(null===performance||void 0===performance?void 0:performance.now)&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===r?n:7&n|8).toString(16)}))},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach((function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||window.location.search,n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===e&&n.splice(i,1);r="".concat(r,"?").concat(n.join("&"))}return r},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)}))},t.printGroupLog=function(e){var t=e.title,r=e.subtitle,n=void 0===r?"":r,o=e.content,i=void 0===o?[]:o,s=e.printTrace,a=void 0!==s&&s,u=e.collapsed;void 0!==u&&u?console.groupCollapsed(t,n):console.group(t,n);for(var c=0,l=i;c<l.length;c++){var h=l[c],d=h.type,f=h.body;switch(d){case"info":console.log(f);break;case"warn":console.warn(f);break;case"error":console.error(f)}}a&&console.trace("stack trace:"),console.groupEnd()},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86".concat(e)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.registerAuth=void 0;var t=r(540);e.registerAuth=t.registerAuth})(),n})()));
|