@cloudbase/js-sdk 2.19.7 → 3.0.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/app.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see app.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase",[],t):"object"==typeof exports?exports.cloudbase=t():e.cloudbase=t()}("undefined"!=typeof window?window:this,(function(){return function(){var e={23:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=n(r(353)),i=n(r(878));o.default.registerVersion(i.default.version);try{window.cloudbase=o.default}catch(e){}t.default=o.default,e.exports=o.default},353:function(e,t,r){"use strict";r.r(t),r.d(t,{LANGS:function(){return Mo},cloudbase:function(){return ui},default:function(){return ci},getBaseEndPoint:function(){return Ro}});var n="@cloudbase/js-sdk";function o(){return n}var i,a="https:",s={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};!function(e){e.local="local",e.none="none",e.session="session"}(i||(i={}));var l=function(){};function u(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}function c(e){return"[object FormData]"===Object.prototype.toString.call(e)}function f(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)}function d(e,t){console.warn("[".concat(o(),"][").concat(e,"]:").concat(t))}var h,p,b=(h=function(e,t){return h=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])},h(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}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),y=function(){return y=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},y.apply(this,arguments)},m=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},v=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},_=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 b(t,e),t.prototype.get=function(e){return this.request(y(y({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(y(y({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(y(y({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,i=e.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",l=new FormData;return"post"===s?(Object.keys(t).forEach((function(e){l.append(e,t[e])})),l.append("key",n),l.append("file",r),this.request(y(y({},e),{data:l,method:s}),this.restrictedMethods.includes("upload"))):this.request(y(y({},e),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return m(this,void 0,void 0,(function(){var t,r,n,o;return v(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(y(y({},e),{headers:{},responseType:"blob"}))];case 1:return t=i.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 i.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return m(this,void 0,void 0,(function(){var r,n,o,i,a,s,l,u,c,f,d,h=this;return v(this,(function(p){switch(p.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,i=void 0!==o&&o,a=e.stream,s=void 0!==a&&a,l=e.signal,u=e.timeout,c=null!=u?u:this.timeout,l&&(l.aborted&&r.abort(),l.addEventListener("abort",(function(){return r.abort()}))),f=null,i&&c&&(f=setTimeout((function(){console.warn(h.timeoutMsg),r.abort(new Error(h.timeoutMsg))}),c)),[4,fetch(n,y(y({},e),{signal:r.signal})).then((function(e){return m(h,void 0,void 0,(function(){var t,r,n;return v(this,(function(o){switch(o.label){case 0:return clearTimeout(f),e.ok?(t=e,[3,3]):[3,1];case 1:return n=(r=Promise).reject,[4,e.json()];case 2:t=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,t]}}))}))})).catch((function(e){return clearTimeout(f),Promise.reject(e)}))];case 1:return d=p.sent(),[2,{data:s?d.body:(null===(t=d.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?d.json():d.text(),statusCode:d.status,header:d.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,l=e.url,u=e.headers,d=void 0===u?{}:u,h=e.data,p=e.responseType,b=e.withCredentials,y=e.body,m=e.onUploadProgress,v=f(a,l,"get"===n?h:{}),_=new XMLHttpRequest;_.open(n,v),p&&(_.responseType=p),Object.keys(d).forEach((function(e){_.setRequestHeader(e,d[e])})),m&&_.upload.addEventListener("progress",m),_.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"===p?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===p?_.response:_.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=c(h)?h:"application/x-www-form-urlencoded"===d["content-type"]?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("&")}(h):y||(h?JSON.stringify(h):void 0),b&&(_.withCredentials=!0),_.send(s)}))},t}(l),g=function(){return g=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},g.apply(this,arguments)};!function(e){e.WEB="web",e.WX_MP="wx_mp"}(p||(p={}));var w=function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),S=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},O=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},P=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return w(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}((function(){})),E=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:(d(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new P(t.root));case"none":return new P(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:s.OPERATION_FAIL,msg:"[".concat(o(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:e}))}}else d(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return S(this,void 0,void 0,(function(){var n;return O(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={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0}.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:""}d(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return S(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0}.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):d(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return S(this,void 0,void 0,(function(){return O(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}(),T=function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),R=function(e,t){this.data=t||null,this.name=e},A=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return T(t,e),t}(R),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(e instanceof A)return console.error(e.error),this;var r="string"==typeof e?new R(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?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))}([],this.listeners[n],!0):[];o<i.length;o++)i[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new C;var I=new C,j="lang_change";function k(e){this.message=e}function q(e){this.message=e}function L(){}function x(e){return"object"==typeof e&&null!==e||"function"==typeof e}"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),k.prototype=new Error,k.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),q.prototype=new Error,q.prototype.name="InvalidTokenError";const N=L;function W(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const M=Promise,F=Promise.resolve.bind(M),B=Promise.prototype.then,D=Promise.reject.bind(M),z=F;function U(e){return new M(e)}function $(e){return U((t=>t(e)))}function V(e){return D(e)}function H(e,t,r){return B.call(e,t,r)}function Y(e,t,r){H(H(e,t,r),void 0,N)}function G(e,t){Y(e,t)}function K(e,t){Y(e,void 0,t)}function Q(e,t,r){return H(e,t,r)}function J(e){H(e,void 0,N)}let X=e=>{if("function"==typeof queueMicrotask)X=queueMicrotask;else{const e=$(void 0);X=t=>H(e,t)}return X(e)};function Z(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function ee(e,t,r){try{return $(Z(e,t,r))}catch(e){return V(e)}}class te{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 re=Symbol("[[AbortSteps]]"),ne=Symbol("[[ErrorSteps]]"),oe=Symbol("[[CancelSteps]]"),ie=Symbol("[[PullSteps]]"),ae=Symbol("[[ReleaseSteps]]");function se(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?fe(e):"closed"===t._state?function(e){fe(e),pe(e)}(e):de(e,t._storedError)}function le(e,t){return mn(e._ownerReadableStream,t)}function ue(e){const t=e._ownerReadableStream;"readable"===t._state?he(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){de(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 ce(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function fe(e){e._closedPromise=U(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function de(e,t){fe(e),he(e,t)}function he(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 pe(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const be=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 me(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 _e(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function ge(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function we(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Se(e){return Number(e)}function Oe(e){return 0===e?0:e}function Pe(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Oe(n),!be(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Oe(ye(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return be(n)&&0!==n?n:0}function Ee(e,t){if(!bn(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Te(e){return new je(e)}function Re(e,t){e._reader._readRequests.push(t)}function Ae(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Ce(e){return e._reader._readRequests.length}function Ie(e){const t=e._reader;return void 0!==t&&!!ke(t)}class je{constructor(e){if(ge(e,1,"ReadableStreamDefaultReader"),Ee(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");se(this,e),this._readRequests=new te}get closed(){return ke(this)?this._closedPromise:V(xe("closed"))}cancel(e=void 0){return ke(this)?void 0===this._ownerReadableStream?V(ce("cancel")):le(this,e):V(xe("cancel"))}read(){if(!ke(this))return V(xe("read"));if(void 0===this._ownerReadableStream)return V(ce("read from"));let e,t;const r=U(((r,n)=>{e=r,t=n}));return qe(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 xe("releaseLock");void 0!==this._ownerReadableStream&&function(e){ue(e),Le(e,new TypeError("Reader was released"))}(this)}}function ke(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof je}function qe(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[ie](t)}function Le(e,t){const r=e._readRequests;e._readRequests=new te,r.forEach((e=>{e._errorSteps(t)}))}function xe(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var Ne,We,Me;function Fe(e){return e.slice()}function Be(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(je.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),W(je.prototype.cancel,"cancel"),W(je.prototype.read,"read"),W(je.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(je.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let De=e=>(De="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,De(e)),ze=e=>(ze="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,ze(e));function Ue(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return Be(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 Ve(e){try{const t=e.done,r=e.value;return H(z(r),(e=>({done:t,value:e})))}catch(e){return V(e)}}const He=null!==(Me=null!==(Ne=Symbol.asyncIterator)&&void 0!==Ne?Ne:null===(We=Symbol.for)||void 0===We?void 0:We.call(Symbol,"Symbol.asyncIterator"))&&void 0!==Me?Me:"@@asyncIterator";function Ye(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=$e(e,He)))return function(e){const t={next(){let t;try{t=Ge(e)}catch(e){return V(e)}return Ve(t)},return(t){let r;try{const n=$e(e.iterator,"return");if(void 0===n)return $({done:!0,value:t});r=Z(n,e.iterator,[t])}catch(e){return V(e)}return x(r)?Ve(r):V(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=Z(r,e,[]);if(!x(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Ge(e){const t=Z(e.nextMethod,e.iterator,[]);if(!x(t))throw new TypeError("The iterator.next() method must return an object");return t}class Ke{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?Q(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?Q(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=U(((e,n)=>{t=e,r=n}));return qe(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,X((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,ue(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,ue(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=le(t,e);return ue(t),Q(r,(()=>({value:e,done:!0})))}return ue(t),$({value:e,done:!0})}}const Qe={next(){return Je(this)?this._asyncIteratorImpl.next():V(Xe("next"))},return(e){return Je(this)?this._asyncIteratorImpl.return(e):V(Xe("return"))},[He](){return this}};function Je(e){if(!x(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Ke}catch(e){return!1}}function Xe(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Qe,He,{enumerable:!1});const Ze=Number.isNaN||function(e){return e!=e};function et(e){const t=Ue(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function tt(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function rt(e,t,r){if("number"!=typeof(n=r)||Ze(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 nt(e){e._queue=new te,e._queueTotalSize=0}function ot(e){return e===DataView}class it{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!lt(this))throw qt("view");return this._view}respond(e){if(!lt(this))throw qt("respond");if(ge(e,1,"respond"),e=Pe(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(ze(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");It(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!lt(this))throw qt("respondWithNewView");if(ge(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(ze(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");jt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(it.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),W(it.prototype.respond,"respond"),W(it.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class at{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!st(this))throw Lt("byobRequest");return At(this)}get desiredSize(){if(!st(this))throw Lt("desiredSize");return Ct(this)}close(){if(!st(this))throw Lt("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`);Pt(this)}enqueue(e){if(!st(this))throw Lt("enqueue");if(ge(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`);Et(this,e)}error(e=void 0){if(!st(this))throw Lt("error");Tt(this,e)}[oe](e){ct(this),nt(this);const t=this._cancelAlgorithm(e);return Ot(this),t}[ie](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Rt(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)}Re(t,e),ut(this)}[ae](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new te,this._pendingPullIntos.push(e)}}}function st(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof at}function lt(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof it}function ut(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Ie(t)&&Ce(t)>0)||(!!(Ft(t)&&Mt(t)>0)||Ct(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ut(e)),null)),(t=>(Tt(e,t),null)))))}function ct(e){_t(e),e._pendingPullIntos=new te}function ft(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=dt(t);"default"===t.readerType?Ae(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function dt(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function ht(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function pt(e,t,r,n){let o;try{o=Ue(t,r,r+n)}catch(t){throw Tt(e,t),t}ht(e,o,0,n)}function bt(e,t){t.bytesFilled>0&&pt(e,t.buffer,t.byteOffset,t.bytesFilled),St(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 a=n-n%t.elementSize;a>=t.minimumFill&&(o=a-t.bytesFilled,i=!0);const s=e._queue;for(;o>0;){const r=s.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;Be(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?s.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,mt(0,n,t),o-=n}return i}function mt(e,t,r){r.bytesFilled+=t}function vt(e){0===e._queueTotalSize&&e._closeRequested?(Ot(e),vn(e._controlledReadableByteStream)):ut(e)}function _t(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function gt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();yt(e,t)&&(St(e),ft(e._controlledReadableByteStream,t))}}function wt(e,t){const r=e._pendingPullIntos.peek();_t(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&St(e);const r=e._controlledReadableByteStream;if(Ft(r))for(;Mt(r)>0;)ft(r,St(e))}(e,r):function(e,t,r){if(mt(0,t,r),"none"===r.readerType)return bt(e,r),void gt(e);if(r.bytesFilled<r.minimumFill)return;St(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;pt(e,r.buffer,t-n,n)}r.bytesFilled-=n,ft(e._controlledReadableByteStream,r),gt(e)}(e,t,r),ut(e)}function St(e){return e._pendingPullIntos.shift()}function Ot(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Pt(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 Tt(e,t),t}}Ot(e),vn(t)}}function Et(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(ze(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=De(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(ze(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");_t(e),t.buffer=De(t.buffer),"none"===t.readerType&&bt(e,t)}Ie(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Rt(e,t._readRequests.shift())}}(e),0===Ce(r)?ht(e,a,o,i):(e._pendingPullIntos.length>0&&St(e),Ae(r,new Uint8Array(a,o,i),!1))):Ft(r)?(ht(e,a,o,i),gt(e)):ht(e,a,o,i),ut(e)}function Tt(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(ct(e),nt(e),Ot(e),_n(r,t))}function Rt(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 At(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(it.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Ct(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function It(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=De(r.buffer),wt(e,t)}function jt(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=De(t.buffer),wt(e,n)}function kt(e,t,r,n,o,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,nt(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=a,t._pendingPullIntos=new te,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,ut(t),null)),(e=>(Tt(t,e),null)))}function qt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Lt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function xt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Nt(e){return new Bt(e)}function Wt(e,t){e._reader._readIntoRequests.push(t)}function Mt(e){return e._reader._readIntoRequests.length}function Ft(e){const t=e._reader;return void 0!==t&&!!Dt(t)}Object.defineProperties(at.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),W(at.prototype.close,"close"),W(at.prototype.enqueue,"enqueue"),W(at.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(at.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Bt{constructor(e){if(ge(e,1,"ReadableStreamBYOBReader"),Ee(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!st(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");se(this,e),this._readIntoRequests=new te}get closed(){return Dt(this)?this._closedPromise:V($t("closed"))}cancel(e=void 0){return Dt(this)?void 0===this._ownerReadableStream?V(ce("cancel")):le(this,e):V($t("cancel"))}read(e,t={}){if(!Dt(this))return V($t("read"));if(!ArrayBuffer.isView(e))return V(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return V(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return V(new TypeError("view's buffer must have non-zero byteLength"));if(ze(e.buffer))return V(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return me(e,t),{min:Pe(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return V(e)}const n=r.min;if(0===n)return V(new TypeError("options.min must be greater than 0"));if(function(e){return ot(e.constructor)}(e)){if(n>e.byteLength)return V(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return V(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return V(ce("read from"));let o,i;const a=U(((e,t)=>{o=e,i=t}));return zt(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!Dt(this))throw $t("releaseLock");void 0!==this._ownerReadableStream&&function(e){ue(e),Ut(e,new TypeError("Reader was released"))}(this)}}function Dt(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Bt}function zt(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,a=function(e){return ot(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:l}=t,u=r*a;let c;try{c=De(t.buffer)}catch(e){return void n._errorSteps(e)}const f={buffer:c,bufferByteLength:c.byteLength,byteOffset:s,byteLength:l,bytesFilled:0,minimumFill:u,elementSize:a,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(f),void Wt(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(yt(e,f)){const t=dt(f);return vt(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Tt(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(f),Wt(o,n),ut(e)}else{const e=new i(f.buffer,f.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function Ut(e,t){const r=e._readIntoRequests;e._readIntoRequests=new te,r.forEach((e=>{e._errorSteps(t)}))}function $t(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Vt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(Ze(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Ht(e){const{size:t}=e;return t||(()=>1)}function Yt(e,t){me(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Se(r),size:void 0===n?void 0:Gt(n,`${t} has member 'size' that`)}}function Gt(e,t){return ve(e,t),t=>Se(e(t))}function Kt(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function Qt(e,t,r){return ve(e,r),()=>ee(e,t,[])}function Jt(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function Xt(e,t,r){return ve(e,r),(r,n)=>ee(e,t,[r,n])}function Zt(e,t){if(!or(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Bt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),W(Bt.prototype.cancel,"cancel"),W(Bt.prototype.read,"read"),W(Bt.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Bt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const er="function"==typeof AbortController;class tr{constructor(e={},t={}){void 0===e?e=null:_e(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){me(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,a=null==e?void 0:e.write;return{abort:void 0===r?void 0:Kt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:Qt(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:Jt(o,e,`${t} has member 'start' that`),write:void 0===a?void 0:Xt(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(nr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=Ht(r);!function(e,t,r,n){const o=Object.create(wr.prototype);let i,a,s,l;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.write?e=>t.write(e,o):()=>$(void 0),s=void 0!==t.close?()=>t.close():()=>$(void 0),l=void 0!==t.abort?e=>t.abort(e):()=>$(void 0),Or(e,o,i,a,s,l,r,n)}(this,n,Vt(r,1),o)}get locked(){if(!or(this))throw Ir("locked");return ir(this)}abort(e=void 0){return or(this)?ir(this)?V(new TypeError("Cannot abort a stream that already has a writer")):ar(this,e):V(Ir("abort"))}close(){return or(this)?ir(this)?V(new TypeError("Cannot close a stream that already has a writer")):fr(this)?V(new TypeError("Cannot close an already-closing stream")):sr(this):V(Ir("close"))}getWriter(){if(!or(this))throw Ir("getWriter");return rr(this)}}function rr(e){return new pr(e)}function nr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new te,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function or(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof tr}function ir(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=U(((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}}));return e._pendingAbortRequest._promise=i,o||ur(e,t),i}function sr(e){const t=e._state;if("closed"===t||"errored"===t)return V(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=U(((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n})),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&zr(n),rt(o=e._writableStreamController,gr,0),Tr(o),r}function lr(e,t){"writable"!==e._state?cr(e):ur(e,t)}function ur(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&mr(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&cr(e)}function cr(e){e._state="errored",e._writableStreamController[ne]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new te,void 0===e._pendingAbortRequest)return void dr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void dr(e);Y(e._writableStreamController[re](r._reason),(()=>(r._resolve(),dr(e),null)),(t=>(r._reject(t),dr(e),null)))}function fr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function dr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Nr(t,e._storedError)}function hr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Mr(e)}(r):zr(r)),e._backpressure=t}Object.defineProperties(tr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),W(tr.prototype.abort,"abort"),W(tr.prototype.close,"close"),W(tr.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(tr.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class pr{constructor(e){if(ge(e,1,"WritableStreamDefaultWriter"),Zt(e,"First parameter"),ir(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)!fr(e)&&e._backpressure?Mr(this):Br(this),Lr(this);else if("erroring"===t)Fr(this,e._storedError),Lr(this);else if("closed"===t)Br(this),Lr(this),Wr(this);else{const t=e._storedError;Fr(this,t),xr(this,t)}}get closed(){return br(this)?this._closedPromise:V(kr("closed"))}get desiredSize(){if(!br(this))throw kr("desiredSize");if(void 0===this._ownerWritableStream)throw qr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Er(t._writableStreamController)}(this)}get ready(){return br(this)?this._readyPromise:V(kr("ready"))}abort(e=void 0){return br(this)?void 0===this._ownerWritableStream?V(qr("abort")):function(e,t){return ar(e._ownerWritableStream,t)}(this,e):V(kr("abort"))}close(){if(!br(this))return V(kr("close"));const e=this._ownerWritableStream;return void 0===e?V(qr("close")):fr(e)?V(new TypeError("Cannot close an already-closing stream")):yr(this)}releaseLock(){if(!br(this))throw kr("releaseLock");void 0!==this._ownerWritableStream&&vr(this)}write(e=void 0){return br(this)?void 0===this._ownerWritableStream?V(qr("write to")):_r(this,e):V(kr("write"))}}function br(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof pr}function yr(e){return sr(e._ownerWritableStream)}function mr(e,t){"pending"===e._readyPromiseState?Dr(e,t):function(e,t){Fr(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");mr(e,r),function(e,t){"pending"===e._closedPromiseState?Nr(e,t):function(e,t){xr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function _r(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Rr(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return V(qr("write to"));const i=r._state;if("errored"===i)return V(r._storedError);if(fr(r)||"closed"===i)return V(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return V(r._storedError);const a=function(e){return U(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{rt(e,t,r)}catch(t){return void Rr(e,t)}const n=e._controlledWritableStream;fr(n)||"writable"!==n._state||hr(n,Ar(e)),Tr(e)}(n,t,o),a}Object.defineProperties(pr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),W(pr.prototype.abort,"abort"),W(pr.prototype.close,"close"),W(pr.prototype.releaseLock,"releaseLock"),W(pr.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(pr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const gr={};class wr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Sr(this))throw jr("abortReason");return this._abortReason}get signal(){if(!Sr(this))throw jr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Sr(this))throw jr("error");"writable"===this._controlledWritableStream._state&&Cr(this,e)}[re](e){const t=this._abortAlgorithm(e);return Pr(this),t}[ne](){nt(this)}}function Sr(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof wr}function Or(e,t,r,n,o,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,nt(t),t._abortReason=void 0,t._abortController=function(){if(er)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const l=Ar(t);hr(e,l),Y($(r()),(()=>(t._started=!0,Tr(t),null)),(r=>(t._started=!0,lr(e,r),null)))}function Pr(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Er(e){return e._strategyHWM-e._queueTotalSize}function Tr(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void cr(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===gr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),tt(e);const r=e._closeAlgorithm();Pr(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&&Wr(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),lr(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(tt(e),!fr(r)&&"writable"===t){const t=Ar(e);hr(r,t)}return Tr(e),null}),(t=>("writable"===r._state&&Pr(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,lr(e,t)}(r,t),null)))}(e,r)}function Rr(e,t){"writable"===e._controlledWritableStream._state&&Cr(e,t)}function Ar(e){return Er(e)<=0}function Cr(e,t){const r=e._controlledWritableStream;Pr(e),ur(r,t)}function Ir(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function jr(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 qr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Lr(e){e._closedPromise=U(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function xr(e,t){Lr(e),Nr(e,t)}function Nr(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 Wr(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 Mr(e){e._readyPromise=U(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function Fr(e,t){Mr(e),Dr(e,t)}function Br(e){Mr(e),zr(e)}function Dr(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 zr(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(wr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(wr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const Ur="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,$r=function(){const e=null==Ur?void 0:Ur.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 W(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Vr(e,t,r,n,o,i){const a=Te(e),s=rr(t);e._disturbed=!0;let l=!1,u=$(void 0);return U(((c,f)=>{let d;if(void 0!==i){if(d=()=>{const r=void 0!==i.reason?i.reason:new $r("Aborted","AbortError"),a=[];n||a.push((()=>"writable"===t._state?ar(t,r):$(void 0))),o||a.push((()=>"readable"===e._state?mn(e,r):$(void 0))),v((()=>Promise.all(a.map((e=>e())))),!0,r)},i.aborted)return void d();i.addEventListener("abort",d)}var h,p,b;if(m(e,a._closedPromise,(e=>(n?_(!0,e):v((()=>ar(t,e)),!0,e),null))),m(t,s._closedPromise,(t=>(o?_(!0,t):v((()=>mn(e,t)),!0,t),null))),h=e,p=a._closedPromise,b=()=>(r?_():v((()=>function(e){const t=e._ownerWritableStream,r=t._state;return fr(t)||"closed"===r?$(void 0):"errored"===r?V(t._storedError):yr(e)}(s))),null),"closed"===h._state?b():G(p,b),fr(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");o?_(!0,t):v((()=>mn(e,t)),!0,t)}function y(){const e=u;return H(u,(()=>e!==u?y():void 0))}function m(e,t,r){"errored"===e._state?r(e._storedError):K(t,r)}function v(e,r,n){function o(){return Y(e(),(()=>g(r,n)),(e=>g(!0,e))),null}l||(l=!0,"writable"!==t._state||fr(t)?o():G(y(),o))}function _(e,r){l||(l=!0,"writable"!==t._state||fr(t)?g(e,r):G(y(),(()=>g(e,r))))}function g(e,t){return vr(s),ue(a),void 0!==i&&i.removeEventListener("abort",d),e?f(t):c(void 0),null}J(U(((e,t)=>{!function r(n){n?e():H(l?$(!0):H(s._readyPromise,(()=>U(((e,t)=>{qe(a,{_chunkSteps:t=>{u=H(_r(s,t),void 0,L),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class Hr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Yr(this))throw nn("desiredSize");return en(this)}close(){if(!Yr(this))throw nn("close");if(!tn(this))throw new TypeError("The stream is not in a state that permits close");Jr(this)}enqueue(e=void 0){if(!Yr(this))throw nn("enqueue");if(!tn(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 nn("error");Zr(this,e)}[oe](e){nt(this);const t=this._cancelAlgorithm(e);return Qr(this),t}[ie](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=tt(this);this._closeRequested&&0===this._queue.length?(Qr(this),vn(t)):Gr(this),e._chunkSteps(r)}else Re(t,e),Gr(this)}[ae](){}}function Yr(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Hr}function Gr(e){Kr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Gr(e)),null)),(t=>(Zr(e,t),null)))))}function Kr(e){const t=e._controlledReadableStream;return!!tn(e)&&!!e._started&&(!!(yn(t)&&Ce(t)>0)||en(e)>0)}function Qr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Jr(e){if(!tn(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Qr(e),vn(t))}function Xr(e,t){if(!tn(e))return;const r=e._controlledReadableStream;if(yn(r)&&Ce(r)>0)Ae(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Zr(e,t),t}try{rt(e,t,r)}catch(t){throw Zr(e,t),t}}Gr(e)}function Zr(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(nt(e),Qr(e),_n(r,t))}function en(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function tn(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function rn(e,t,r,n,o,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,nt(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,Gr(t),null)),(e=>(Zr(t,e),null)))}function nn(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function on(e){return x(t=e)&&void 0!==t.getReader?function(e){let t;return t=dn(L,(function(){let r;try{r=e.read()}catch(r){return V(r)}return Q(r,(e=>{if(!x(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 V(t)}}),0),t}(e.getReader()):function(e){let t;const r=Ye(e,"async");return t=dn(L,(function(){let e;try{e=Ge(r)}catch(e){return V(e)}return Q($(e),(e=>{if(!x(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 V(e)}return void 0===n?$(void 0):Q(ee(n,t,[e]),(e=>{if(!x(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=>ee(e,t,[r])}function sn(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function ln(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function un(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function cn(e,t){me(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(Hr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),W(Hr.prototype.close,"close"),W(Hr.prototype.enqueue,"enqueue"),W(Hr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Hr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class fn{constructor(e={},t={}){void 0===e?e=null:_e(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){me(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,a=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Pe(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:sn(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:ln(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:un(s,`${t} has member 'type' that`)}}(e,"First parameter");if(pn(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,a;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>$(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0);const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");kt(e,n,o,i,a,r,s)}(this,n,Vt(r,0))}else{const e=Ht(r);!function(e,t,r,n){const o=Object.create(Hr.prototype);let i,a,s;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.pull?()=>t.pull(o):()=>$(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0),rn(e,o,i,a,s,r,n)}(this,n,Vt(r,1),e)}}get locked(){if(!bn(this))throw gn("locked");return yn(this)}cancel(e=void 0){return bn(this)?yn(this)?V(new TypeError("Cannot cancel a stream that already has a reader")):mn(this,e):V(gn("cancel"))}getReader(e=void 0){if(!bn(this))throw gn("getReader");return void 0===function(e,t){me(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:xt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Te(this):Nt(this)}pipeThrough(e,t={}){if(!bn(this))throw gn("pipeThrough");ge(e,1,"pipeThrough");const r=function(e,t){me(e,t);const r=null==e?void 0:e.readable;we(r,"readable","ReadableWritablePair"),Ee(r,`${t} has member 'readable' that`);const n=null==e?void 0:e.writable;return we(n,"writable","ReadableWritablePair"),Zt(n,`${t} has member 'writable' that`),{readable:r,writable:n}}(e,"First parameter"),n=cn(t,"Second parameter");if(yn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(ir(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return J(Vr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!bn(this))return V(gn("pipeTo"));if(void 0===e)return V("Parameter 1 is required in 'pipeTo'.");if(!or(e))return V(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=cn(t,"Second parameter")}catch(e){return V(e)}return yn(this)?V(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):ir(e)?V(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Vr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!bn(this))throw gn("tee");return Fe(function(e){return st(e._readableStreamController)?function(e){let t,r,n,o,i,a=Te(e),s=!1,l=!1,u=!1,c=!1,f=!1;const d=U((e=>{i=e}));function h(e){K(e._closedPromise,(t=>(e!==a||(Tt(n._readableStreamController,t),Tt(o._readableStreamController,t),c&&f||i(void 0)),null)))}function p(){Dt(a)&&(ue(a),a=Te(e),h(a)),qe(a,{_chunkSteps:t=>{X((()=>{l=!1,u=!1;const r=t;let a=t;if(!c&&!f)try{a=et(t)}catch(t){return Tt(n._readableStreamController,t),Tt(o._readableStreamController,t),void i(mn(e,t))}c||Et(n._readableStreamController,r),f||Et(o._readableStreamController,a),s=!1,l?y():u&&m()}))},_closeSteps:()=>{s=!1,c||Pt(n._readableStreamController),f||Pt(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&It(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&It(o._readableStreamController,0),c&&f||i(void 0)},_errorSteps:()=>{s=!1}})}function b(t,r){ke(a)&&(ue(a),a=Nt(e),h(a));const d=r?o:n,p=r?n:o;zt(a,t,1,{_chunkSteps:t=>{X((()=>{l=!1,u=!1;const n=r?f:c;if(r?c:f)n||jt(d._readableStreamController,t);else{let r;try{r=et(t)}catch(t){return Tt(d._readableStreamController,t),Tt(p._readableStreamController,t),void i(mn(e,t))}n||jt(d._readableStreamController,t),Et(p._readableStreamController,r)}s=!1,l?y():u&&m()}))},_closeSteps:e=>{s=!1;const t=r?f:c,n=r?c:f;t||Pt(d._readableStreamController),n||Pt(p._readableStreamController),void 0!==e&&(t||jt(d._readableStreamController,e),!n&&p._readableStreamController._pendingPullIntos.length>0&&It(p._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{s=!1}})}function y(){if(s)return l=!0,$(void 0);s=!0;const e=At(n._readableStreamController);return null===e?p():b(e._view,!1),$(void 0)}function m(){if(s)return u=!0,$(void 0);s=!0;const e=At(o._readableStreamController);return null===e?p():b(e._view,!0),$(void 0)}function v(){}return n=hn(v,y,(function(n){if(c=!0,t=n,f){const n=Fe([t,r]),o=mn(e,n);i(o)}return d})),o=hn(v,m,(function(n){if(f=!0,r=n,c){const n=Fe([t,r]),o=mn(e,n);i(o)}return d})),h(a),[n,o]}(e):function(e){const t=Te(e);let r,n,o,i,a,s=!1,l=!1,u=!1,c=!1;const f=U((e=>{a=e}));function d(){return s?(l=!0,$(void 0)):(s=!0,qe(t,{_chunkSteps:e=>{X((()=>{l=!1;const t=e,r=e;u||Xr(o._readableStreamController,t),c||Xr(i._readableStreamController,r),s=!1,l&&d()}))},_closeSteps:()=>{s=!1,u||Jr(o._readableStreamController),c||Jr(i._readableStreamController),u&&c||a(void 0)},_errorSteps:()=>{s=!1}}),$(void 0))}function h(){}return o=dn(h,d,(function(t){if(u=!0,r=t,c){const t=Fe([r,n]),o=mn(e,t);a(o)}return f})),i=dn(h,d,(function(t){if(c=!0,n=t,u){const t=Fe([r,n]),o=mn(e,t);a(o)}return f})),K(t._closedPromise,(e=>(Zr(o._readableStreamController,e),Zr(i._readableStreamController,e),u&&c||a(void 0),null))),[o,i]}(e)}(this))}values(e=void 0){if(!bn(this))throw gn("values");return function(e,t){const r=Te(e),n=new Ke(r,t),o=Object.create(Qe);return o._asyncIteratorImpl=n,o}(this,function(e){me(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[He](e){return this.values(e)}static from(e){return on(e)}}function dn(e,t,r,n=1,o=()=>1){const i=Object.create(fn.prototype);return pn(i),rn(i,Object.create(Hr.prototype),e,t,r,n,o),i}function hn(e,t,r){const n=Object.create(fn.prototype);return pn(n),kt(n,Object.create(at.prototype),e,t,r,0,void 0),n}function pn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function bn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof fn}function yn(e){return void 0!==e._reader}function mn(e,t){if(e._disturbed=!0,"closed"===e._state)return $(void 0);if("errored"===e._state)return V(e._storedError);vn(e);const r=e._reader;if(void 0!==r&&Dt(r)){const e=r._readIntoRequests;r._readIntoRequests=new te,e.forEach((e=>{e._closeSteps(void 0)}))}return Q(e._readableStreamController[oe](t),L)}function vn(e){e._state="closed";const t=e._reader;if(void 0!==t&&(pe(t),ke(t))){const e=t._readRequests;t._readRequests=new te,e.forEach((e=>{e._closeSteps()}))}}function _n(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(he(r,t),ke(r)?Le(r,t):Ut(r,t))}function gn(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function wn(e,t){me(e,t);const r=null==e?void 0:e.highWaterMark;return we(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Se(r)}}Object.defineProperties(fn,{from:{enumerable:!0}}),Object.defineProperties(fn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),W(fn.from,"from"),W(fn.prototype.cancel,"cancel"),W(fn.prototype.getReader,"getReader"),W(fn.prototype.pipeThrough,"pipeThrough"),W(fn.prototype.pipeTo,"pipeTo"),W(fn.prototype.tee,"tee"),W(fn.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(fn.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(fn.prototype,He,{value:fn.prototype.values,writable:!0,configurable:!0});const Sn=e=>e.byteLength;W(Sn,"size");class On{constructor(e){ge(e,1,"ByteLengthQueuingStrategy"),e=wn(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!En(this))throw Pn("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!En(this))throw Pn("size");return Sn}}function Pn(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function En(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof On}Object.defineProperties(On.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(On.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Tn=()=>1;W(Tn,"size");class Rn{constructor(e){ge(e,1,"CountQueuingStrategy"),e=wn(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Cn(this))throw An("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Cn(this))throw An("size");return Tn}}function An(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Cn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Rn}function In(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function jn(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function kn(e,t,r){return ve(e,r),(r,n)=>ee(e,t,[r,n])}function qn(e,t,r){return ve(e,r),r=>ee(e,t,[r])}Object.defineProperties(Rn.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Rn.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Ln{constructor(e={},t={},r={}){void 0===e&&(e=null);const n=Yt(t,"Second parameter"),o=Yt(r,"Third parameter"),i=function(e,t){me(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,a=null==e?void 0:e.transform,s=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:qn(r,e,`${t} has member 'cancel' that`),flush:void 0===n?void 0:In(n,e,`${t} has member 'flush' that`),readableType:o,start:void 0===i?void 0:jn(i,e,`${t} has member 'start' that`),transform:void 0===a?void 0:kn(a,e,`${t} has member 'transform' that`),writableType:s}}(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 a=Vt(o,0),s=Ht(o),l=Vt(n,1),u=Ht(n);let c;!function(e,t,r,n,o,i){function a(){return t}e._writable=function(e,t,r,n,o=1,i=()=>1){const a=Object.create(tr.prototype);return nr(a),Or(a,Object.create(wr.prototype),e,t,r,n,o,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?Q(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=U(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const n=t._flushAlgorithm();return zn(t),Y(n,(()=>("errored"===r._state?Yn(t,r._storedError):(Jr(r._readableStreamController),Hn(t)),null)),(e=>(Zr(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=U(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return zn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(Zr(n._readableStreamController,t),Hn(r)),null)),(e=>(Zr(n._readableStreamController,e),Yn(r,e),null))),r._finishPromise}(e,t)}),r,n),e._readable=dn(a,(function(){return function(e){return Fn(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=U(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return zn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(Rr(n._writableStreamController,t),Mn(e),Hn(r)),null)),(t=>(Rr(n._writableStreamController,t),Mn(e),Yn(r,t),null))),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Fn(e,!0),e._transformStreamController=void 0}(this,U((e=>{c=e})),l,u,a,s),function(e,t){const r=Object.create(Bn.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return Un(r,e),$(void 0)}catch(e){return V(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?c(i.start(this._transformStreamController)):c(void 0)}get readable(){if(!xn(this))throw Gn("readable");return this._readable}get writable(){if(!xn(this))throw Gn("writable");return this._writable}}function xn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof Ln}function Nn(e,t){Zr(e._readable._readableStreamController,t),Wn(e,t)}function Wn(e,t){zn(e._transformStreamController),Rr(e._writable._writableStreamController,t),Mn(e)}function Mn(e){e._backpressure&&Fn(e,!1)}function Fn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=U((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(Ln.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ln.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class Bn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Dn(this))throw Vn("desiredSize");return en(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Dn(this))throw Vn("enqueue");Un(this,e)}error(e=void 0){if(!Dn(this))throw Vn("error");var t;t=e,Nn(this._controlledTransformStream,t)}terminate(){if(!Dn(this))throw Vn("terminate");!function(e){const t=e._controlledTransformStream;Jr(t._readable._readableStreamController),Wn(t,new TypeError("TransformStream terminated"))}(this)}}function Dn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Bn}function zn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Un(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!tn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Xr(n,t)}catch(e){throw Wn(r,e),r._readable._storedError}const o=function(e){return!Kr(e)}(n);o!==r._backpressure&&Fn(r,!0)}function $n(e,t){return Q(e._transformAlgorithm(t),void 0,(t=>{throw Nn(e._controlledTransformStream,t),t}))}function Vn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Hn(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 Gn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Bn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),W(Bn.prototype.enqueue,"enqueue"),W(Bn.prototype.error,"error"),W(Bn.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Bn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Kn,Qn=(Kn=function(e,t){return Kn=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])},Kn(e,t)},function(e,t){function r(){this.constructor=e}Kn(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="Error when aborting requestTask",Zn=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 Qn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,n){var o=e.url,i=e.data,a=e.headers,s=wx.request({url:u("https:",o),data:i,timeout:t._timeout,method:"POST",header:a,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{s.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 a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var t,o,i,a,s,l;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}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,s])}}}(this,(function(u){return t=e.url,o=e.file,i=e.data,a=e.headers,s=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:o,name:"file",formData:Jn({},i),header:a,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{l.abort()}catch(e){}}}}),s&&l.onProgressUpdate((function(e){s(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,r=this;return new Promise((function(n,o){var i=e.url,a=e.headers,s=wx.downloadFile({url:u("https:",i),header:a,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{s.abort()}catch(e){}}}})}))},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,a=e.stream,s=void 0!==a&&a,l=e.signal,c=e.timeout,f=this,d=null!=c?c:this._timeout,h=null,p=new fn({start:function(e){h=e},cancel:function(){h=null}});return new Promise((function(e,a){s&&e({data:p});var c=wx.request({url:u("https:",t),data:r,timeout:d,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=h)||void 0===r||r.close(),!s&&e(t)},fail:function(e){var t;if(null===(t=h)||void 0===t||t.close(),a(e),s)throw e},complete:function(e){if(e&&e.errMsg&&d&&-1!==f._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg){console.warn(f._timeoutMsg);try{c.abort()}catch(e){console.warn(Xn,e)}}},enableChunked:s});if(c.onChunkReceived((function(e){var t;null===(t=h)||void 0===t||t.enqueue(new Uint8Array(e.data))})),l){var b=function(){try{c.abort()}catch(e){console.warn(Xn,e)}};l.aborted?b():l.addEventListener("abort",(function(){return b()}))}}))},t}(l),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}},ro={genAdapter:function(){return{root:{},reqClass:Zn,wsClass:to,localStorage:eo,primaryStorage:i.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:""}}},isMatch: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},runtime:"wx_mp"},no=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))},oo=s,io={};function ao(e,t){var r=t.name,n=t.namespace,o=t.entity,i=t.injectEvents,a=t.IIFE,s=void 0!==a&&a;if(io[r]||n&&e[n])throw new Error(JSON.stringify({code:oo.INVALID_OPERATION,msg:"Duplicate component ".concat(r)}));if(s){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(e)}if(io[r]=t,n?e.prototype[n]=o:so(e.prototype,o),i){var l=i.bus,u=i.events;if(!l||!u||0===u.length)return;var c=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[r]?e.prototype.events[r].events=no(no([],e.prototype.events[r].events,!0),u,!0):e.prototype.events[r]={bus:l,events:u},e.prototype.fire=function(e,t){c(e,t);for(var r=0,n=Object.keys(this.events);r<n.length;r++){var o=n[r],i=this.events[o],a=i.bus;if(i.events.includes(e)){a.fire(e,t);break}}}}}function so(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=so(e[o],t[o]))}return e}var lo={},uo=function(){return uo=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},uo.apply(this,arguments)},co=E,fo={},ho={};function po(e){var t=e.env,r=e.platformInfo,n={userInfoKey:"".concat("user_info","_").concat(t)};fo[t]=fo[t]||new co(uo(uo({},e),{keys:n,platformInfo:r})),ho[t]=ho[t]||new co(uo(uo({},e),{keys:n,platformInfo:r,persistence:"local"}))}function bo(e){return ho[e]}var yo=function(){return yo=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},yo.apply(this,arguments)},mo="",vo="@cloudbase/js-sdk";function _o(){return mo}var go,wo=[],So=["env","endPointKey","region"],Oo="https:";function Po(e){return wo.find((function(t){return So.filter((function(t){return null!=e[t]})).every((function(r){return t[r]===e[r]}))}))}function Eo(e){var t,r,n,o=Po(e);o?(null!=e.baseUrl&&(o.baseUrl=e.baseUrl),null!=e.protocol&&(o.protocol=e.protocol)):wo.push(yo(yo({},e),{protocol:null!==(t=e.protocol)&&void 0!==t?t:Oo})),"CLOUD_API"===e.endPointKey&&(n=null!==(r=e.protocol)&&void 0!==r?r:Oo,a=n)}function To(e,t,r){return Po({env:e,endPointKey:t,region:r})}function Ro(e){var t=To(e,"CLOUD_API"),r=t.protocol,n=t.baseUrl;return"".concat(r).concat(n).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(e){e.NULL="NULL",e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.PHONE="PHONE"}(go||(go={}));var Ao=function(){return Ao=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},Ao.apply(this,arguments)},Co=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},Io=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},jo=s,ko=c,qo=f,Lo=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function xo(e,t,r){var n=e[t];e[t]=function(t){var o={},i={};r.forEach((function(r){var n=r.call(e,t),a=n.data,s=n.headers;Object.assign(o,a),Object.assign(i,s)}));var a=t.data;return a&&(ko(a)?Object.keys(o).forEach((function(e){a.append(e,o[e])})):t.data=Ao(Ao({},a),o)),t.headers=Ao(Ao({},t.headers||{}),i),n.call(e,t)}}function No(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(_o()),"x-seqid":e}}}var Wo,Mo,Fo=function(){function e(e){var t=this;this.throwWhenRequestFail=!1,this.config=e;var r={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new lo.adapter.reqClass(r),this.throwWhenRequestFail=e.throw||!1,this.localCache=bo(this.config.env),xo(this.reqClass,"post",[No]),xo(this.reqClass,"upload",[No]),xo(this.reqClass,"download",[No]),I.on(j,(function(e){var r;t.config.i18n=(null===(r=e.data)||void 0===r?void 0:r.i18n)||t.config.i18n}))}return e.prototype.getDefaultHeaders=function(){var e,t,r;return(e={})[null===(t=this.config.i18n)||void 0===t?void 0:t.LANG_HEADER_KEY]=null===(r=this.config.i18n)||void 0===r?void 0:r.lang,e},e.prototype.post=function(e){return Co(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.post(Ao(Ao({},e),{headers:Ao(Ao({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.upload=function(e){return Co(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.upload(Ao(Ao({},e),{headers:Ao(Ao({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return Co(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.download(Ao(Ao({},e),{headers:Ao(Ao({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.getBaseEndPoint=function(){return Ro(this.config.env)},e.prototype.getOauthAccessTokenV2=function(e){return Co(this,void 0,void 0,(function(){var t,r;return Io(this,(function(n){switch(n.label){case 0:return[4,e.getAccessToken()];case 1:return t=n.sent(),[4,e.getCredentials()];case 2:return r=n.sent(),[2,{accessToken:t,accessTokenExpire:new Date(r.expires_at).getTime()}]}}))}))},e.prototype.request=function(e,t,r){var n,o;return Co(this,void 0,void 0,(function(){var i,a,s,l,u,c,f,d,h,p,b,y,m,v,_,g,w,S,O,P;return Io(this,(function(E){switch(E.label){case 0:if(i="x-tcb-trace_".concat(this.config.env),a="application/x-www-form-urlencoded",s=Ao({action:e,dataVersion:"2020-01-10",env:this.config.env},t),-1!==Lo.indexOf(e))return[3,2];if(!(l=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return u=l.oauthInstance,c=u.oauth2client,f=s,[4,this.getOauthAccessTokenV2(c)];case 1:f.access_token=E.sent().accessToken,E.label=2;case 2:return"storage.uploadFile"===e?(d=new FormData,Object.keys(d).forEach((function(e){Object.prototype.hasOwnProperty.call(d,e)&&void 0!==d[e]&&d.append(e,s[e])})),a="multipart/form-data"):(a="application/json;charset=UTF-8",d={},Object.keys(s).forEach((function(e){void 0!==s[e]&&(d[e]=s[e])}))),h={headers:Ao({"content-type":a},this.getDefaultHeaders())},(null==r?void 0:r.onUploadProgress)&&(h.onUploadProgress=r.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(p=this.localCache.getStore(i))&&(h.headers["X-TCB-Trace"]=p),b=void 0!==(null==r?void 0:r.parse)?r.parse:t.parse,y=void 0!==(null==r?void 0:r.inQuery)?r.inQuery:t.inQuery,m=void 0!==(null==r?void 0:r.search)?r.search:t.search,v=Ao(Ao({},(null==r?void 0:r.defaultQuery)||{}),{env:this.config.env}),b&&(v.parse=!0),y&&(v=Ao(Ao({},y),v)),_=To(this.config.env,"CLOUD_API"),g=_.baseUrl,w=_.protocol,S=r.pathname?qo(w,"".concat(null===(n=Ro(this.config.env))||void 0===n?void 0:n.replace(/^https?:/,""),"/").concat(r.pathname),v):qo(w,g,v),m&&(S+=m),[4,this.post(Ao({url:S,data:d},h))];case 3:if(O=E.sent(),(P=null===(o=O.header)||void 0===o?void 0:o["x-tcb-trace"])&&this.localCache.setStore(i,P),200!==Number(O.status)&&200!==Number(O.statusCode)||!O.data)throw new Error("network request error");return[2,O]}}))}))},e.prototype.fetch=function(e){var t,r,n,o,i,a,s,l;return Co(this,void 0,void 0,(function(){var u,c,f,d,h,p,b,y=this;return Io(this,(function(m){switch(m.label){case 0:u=e.token,c=e.headers,f=void 0===c?{}:c,d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["token","headers"]),h=function(){return Co(y,void 0,void 0,(function(){var e,t,r;return Io(this,(function(n){switch(n.label){case 0:if(null!=u)return[2,u];if(!(e=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return t=e.oauthInstance,r=t.oauth2client,[4,this.getOauthAccessTokenV2(r)];case 1:return[2,n.sent().accessToken]}}))}))},p=function(){return Co(y,void 0,void 0,(function(){var e,t,r,n,o;return Io(this,(function(i){switch(i.label){case 0:return t=(e=this.reqClass).fetch,n={},o={"X-SDK-Version":"@cloudbase/js-sdk/".concat(_o())},r="Bearer ".concat,[4,h()];case 1:return[2,t.apply(e,[Ao.apply(void 0,[(n.headers=Ao.apply(void 0,[Ao.apply(void 0,[(o.Authorization=r.apply("Bearer ",[i.sent()]),o),this.getDefaultHeaders()]),f]),n),d])])]}}))}))},m.label=1;case 1:return m.trys.push([1,3,,6]),[4,p()];case 2:return[2,m.sent()];case 3:if("ACCESS_TOKEN_EXPIRED"!==(null==(b=m.sent())?void 0:b.code))return[3,5];if("function"!=typeof(null===(o=null===(n=null===(r=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===r?void 0:r.oauthInstance)||void 0===n?void 0:n.authApi)||void 0===o?void 0:o.refreshTokenForce))throw b;return[4,null===(l=null===(s=null===(a=null===(i=this.config)||void 0===i?void 0:i._fromApp)||void 0===a?void 0:a.oauthInstance)||void 0===s?void 0:s.authApi)||void 0===l?void 0:l.refreshTokenForce()];case 4:return m.sent(),[2,p()];case 5:throw b;case 6:return[2]}}))}))},e.prototype.send=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),Co(this,void 0,void 0,(function(){var n;return Io(this,(function(o){switch(o.label){case 0:return[4,this.request(e,t,Ao(Ao({},r),{onUploadProgress:t.onUploadProgress}))];case 1:if((n=o.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:jo.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},e}(),Bo={};!function(e){e.ZH="zh-CN",e.EN="en-US"}(Mo||(Mo={}));var Do=((Wo={})[Mo.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":"Please check the calling method or visit the AI+ homepage to view the documentation","AI+ 请求出错,错误码":"AI+ request error, error code","错误信息":"error message","未实现":"not implemented","小程序不支持 wasm 加载":"wasm loading is not supported in mini programs","小程序不支持动态 js 加载":"dynamic js loading is not supported in mini programs","请求超时":"request timeout","缺少 privatelink sdk 地址":"missing privatelink sdk address"},Wo),zo=function(e,t){var r;return(null===(r=Do[t])||void 0===r?void 0:r[e])||e},Uo=function(e,t){var r,n,o=function(e){return"lang_".concat(e.clientId||e.env)}(t),i=(e.adapter||{}).localStorage,a=t.lang||(null===(r=null==i?void 0:i.getItem)||void 0===r?void 0:r.call(i,o))||Mo.ZH;return null===(n=null==i?void 0:i.setItem)||void 0===n||n.call(i,o,a),new Proxy({t:function(e){return zo(e,a)},LANG_HEADER_KEY:"Accept-Language",lang:a},{get:function(e,t){var r;return"lang"===t&&(null===(r=null==i?void 0:i.getItem)||void 0===r?void 0:r.call(i,o))||e[t]},set:function(e,t,r){var n;return"lang"===t&&r!==e[t]&&(e[t]=r,e.t=function(e){return zo(e,r)},null===(n=null==i?void 0:i.setItem)||void 0===n||n.call(i,o,r),I.fire(j,{i18n:e})),e[t]=r,!0}})},$o=r(794),Vo=function(){return Vo=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},Vo.apply(this,arguments)},Ho=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},Yo=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};function Go(e,t){var r,n,o;return Ho(this,void 0,void 0,(function(){var i,a,s,l,u,c,f,d,h,p,b,y,m,v,_;return Yo(this,(function(g){switch(g.label){case 0:if(a=(i=e||{}).name,s=i.body,l=i.path,u=void 0===l?"":l,c=i.method,f=void 0===c?"POST":c,d=i.headers,h=void 0===d?{}:d,p=i.token,!a)throw new Error(JSON.stringify({code:$o.ERRORS.INVALID_PARAMS,msg:"[apis] invalid api name"}));return b=this.getEndPointWithKey("GATEWAY"),y=b.BASE_URL,m=b.PROTOCOL,v="".concat(m).concat(y,"/apis/").concat(a),_=u.startsWith("/")?u:"/".concat(u),[4,this.request.fetch(Vo({url:"".concat(v).concat(_),method:f||"POST",headers:Vo({"Content-Type":"application/json; charset=utf-8"},h),body:s,token:(null===(r=null==p?void 0:p.trim)||void 0===r?void 0:r.call(p))||(null===(o=null===(n=h.Authorization)||void 0===n?void 0:n.replace)||void 0===o?void 0:o.call(n,/^Bearer /,""))||""},t))];case 1:return[4,g.sent().data];case 2:return[2,g.sent()]}}))}))}var Ko=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH","REQUEST"];function Qo(e){var t=this;return new Proxy({},{get:function(r,n){if("string"!=typeof n)throw new Error("[apis] method must be string");var o=n.toLocaleUpperCase();if(!Ko.includes(o))throw new Error("[apis] invalid method: ".concat(n));return function(r,n){return Ho(t,void 0,void 0,(function(){return Yo(this,(function(t){switch(t.label){case 0:return[4,Go.call(this,Vo({name:e,method:("REQUEST"===o?r.method:o)||"POST"},r),n)];case 1:return[2,t.sent()]}}))}))}}})}function Jo(){var e=this;return new Proxy({},{get:function(t,r){if("string"==typeof r)return Qo.call(e,r)}})}var Xo=function(){return Xo=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},Xo.apply(this,arguments)},Zo=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},ei=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ti=s,ri="https://support.qq.com/products/148793",ni=d,oi=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,r){}},ii={timeout:15e3,persistence:"local"},ai=6e5,si={},li=function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.version=_o()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return lo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return e=this.cloudbaseConfig.env,fo[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return bo(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this.cloudbaseConfig.env,Bo[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apis",{get:function(){return Jo.call(this)},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var r;if(!t.env)throw new Error(JSON.stringify({code:ti.INVALID_PARAMS,msg:"env must not be specified"}));lo.adapter||this.useDefaultAdapter();var n={timeout:t.timeout||5e3,timeoutMsg:"[".concat(vo,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s")};this.requestClient=new lo.adapter.reqClass(n),this.cloudbaseConfig=Xo(Xo(Xo({},ii),t),{i18n:Uo(lo,t)}),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var o=this.cloudbaseConfig,i=o.env,a=o.persistence,s=o.debug,l=o.timeout,u=o.oauthClient,c=o.i18n;po({env:i,persistence:a,debug:s,platformInfo:this.platform}),function(e,t){Eo({env:e,region:t,baseUrl:t?"//".concat(e,".").concat(t,".tcb-api.tencentcloudapi.com/web"):"//".concat(e,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(i,t.region||""),function(e){Eo({endPointKey:"GATEWAY",env:e,baseUrl:"//".concat(e,".api.tcloudbasegateway.com/v1"),protocol:void 0})}(i);var f=new e(this.cloudbaseConfig);return function(e){Bo[e.env]=new Fo(Ao(Ao({},e),{throw:!0}))}({env:i,region:t.region||"",timeout:l,oauthClient:u,_fromApp:f,i18n:c}),f.requestClient=this.requestClient,null===(r=null==this?void 0:this.fire)||void 0===r||r.call(this,"cloudbase_init",f),f},e.prototype.updateConfig=function(e){var t=e.persistence,r=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=r,po({env:this.cloudbaseConfig.env,persistence:t,debug:r,platformInfo:this.platform})},e.prototype.updateLang=function(e){var t;e&&e!==(null===(t=this.cloudbaseConfig.i18n)||void 0===t?void 0:t.lang)&&(this.cloudbaseConfig.i18n.lang=e)},e.prototype.registerExtension=function(e){si[e.name]=e},e.prototype.invokeExtension=function(e,t){return function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var r;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,(function(n){switch(n.label){case 0:if(!(r=si[e]))throw new Error(JSON.stringify({code:ti.INVALID_PARAMS,msg:"extension:".concat(e," must be registered before invoke")}));return[4,r.invoke(t,this)];case 1:return[2,n.sent()]}}))}))},e.prototype.useAdapters=function(e,t){var r=function(e,t){for(var r,n=0,o=(r=e,"[object Array]"===Object.prototype.toString.call(r)?e:[e]);n<o.length;n++){var i=o[n],a=i.isMatch,s=i.genAdapter,l=i.runtime;if(a())return{adapter:g({isMatch:a},s(t)),runtime:l}}}(e,t)||{},n=r.adapter,o=r.runtime;n&&(lo.adapter=n),o&&(lo.runtime=o)},e.prototype.registerHook=function(t){!function(e,t){var r=t.entity,n=t.target;if(Object.prototype.hasOwnProperty.call(e,n))throw new Error(JSON.stringify({code:oo.INVALID_OPERATION,msg:"target:".concat(n," is not exist")}));var o=e.prototype[n];if("function"!=typeof o)throw new Error(JSON.stringify({code:oo.INVALID_OPERATION,msg:"target:".concat(n," is not a function which is the only type supports hook")}));e.prototype[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.call.apply(r,no([this],e,!1)),o.call.apply(o,no([this],e,!1))}}(e,t)},e.prototype.registerComponent=function(t){ao(e,t)},e.prototype.registerVersion=function(e){!function(e){mo=e}(e),this.version=e},e.prototype.registerSdkName=function(e){!function(e){vo=e,function(e){n=e}(e)}(e)},e.prototype.registerEndPoint=function(e,t){Eo({baseUrl:e,protocol:t,env:this.config.env,endPointKey:"CLOUD_API"})},e.prototype.registerEndPointWithKey=function(e){Eo({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.getEndPointWithKey=function(e){var t=To(this.config.env,e);return{BASE_URL:t.baseUrl,PROTOCOL:t.protocol}},e.prototype.parseCaptcha=function(e){var t={},r=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){e=r[1];var n=r[2];n&&(t=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)})),t}(n))}var o=t.token,i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(t,["token"]);return/^data:/.test(e)&&!o?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:o?{state:i.state,token:o,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}},e.prototype.useDefaultAdapter=function(){var e={adapter:{type:"default",root:window,reqClass:_,wsClass:WebSocket,localStorage:localStorage},runtime:p.WEB},t=e.adapter,r=e.runtime;lo.adapter=t,lo.runtime=r},e.prototype.formatTimeout=function(e){switch(!0){case e>ai:return ni(ti.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),ai;case e<100:return ni(ti.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},Zo([oi({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ri)]}),ei("design:type",Function),ei("design:paramtypes",[Object]),ei("design:returntype",e)],e.prototype,"init",null),Zo([oi({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ri)]}),ei("design:type",Function),ei("design:paramtypes",[String,Object]),ei("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}(),ui=new li;ui.useAdapters(ro);var ci=ui},946:function(e,t){"use strict";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"},205:function(e,t){"use strict";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"}},794:function(e,t,r){"use strict";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(946),t),o(r(205),t),t.OATUH_LOGINTYPE="constants"},47:function(e){var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new I(n||[]);return o(a,"_invoke",{value:T(e,r,s)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",h="suspendedYield",p="executing",b="completed",y={};function m(){}function v(){}function _(){}var g={};u(g,a,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(j([])));S&&S!==r&&n.call(S,a)&&(g=S);var O=_.prototype=m.prototype=Object.create(g);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(o,i,a,s){var l=f(e[o],e,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(c).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function T(e,r,n){var o=d;return function(i,a){if(o===p)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var l=R(s,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?b:h,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=b,n.method="throw",n.arg=u.arg)}}}function R(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function j(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return v.prototype=_,o(O,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:v,configurable:!0}),v.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,u(e,l,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},P(E.prototype),u(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(O),u(O,l,"Generator"),u(O,a,(function(){return this})),u(O,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=j,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},878:function(e){"use strict";e.exports={version:"2.19.7"}}},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}return r.d=function(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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(47),r(23)}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase",[],t):"object"==typeof exports?exports.cloudbase=t():e.cloudbase=t()}("undefined"!=typeof window?window:this,(function(){return function(){var e={23:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=n(r(353)),i=n(r(878));o.default.registerVersion(i.default.version);try{window.cloudbase=o.default}catch(e){}t.default=o.default,e.exports=o.default},353:function(e,t,r){"use strict";r.r(t),r.d(t,{LANGS:function(){return Mo},cloudbase:function(){return ui},default:function(){return ci},getBaseEndPoint:function(){return Ro}});var n="@cloudbase/js-sdk";function o(){return n}var i,a="https:",s={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};!function(e){e.local="local",e.none="none",e.session="session"}(i||(i={}));var l=function(){};function u(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}function c(e){return"[object FormData]"===Object.prototype.toString.call(e)}function f(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)}function d(e,t){console.warn("[".concat(o(),"][").concat(e,"]:").concat(t))}var h,p,b=(h=function(e,t){return h=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])},h(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}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),y=function(){return y=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},y.apply(this,arguments)},m=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},v=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},_=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 b(t,e),t.prototype.get=function(e){return this.request(y(y({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(y(y({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(y(y({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,i=e.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",l=new FormData;return"post"===s?(Object.keys(t).forEach((function(e){l.append(e,t[e])})),l.append("key",n),l.append("file",r),this.request(y(y({},e),{data:l,method:s}),this.restrictedMethods.includes("upload"))):this.request(y(y({},e),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return m(this,void 0,void 0,(function(){var t,r,n,o;return v(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(y(y({},e),{headers:{},responseType:"blob"}))];case 1:return t=i.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 i.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return m(this,void 0,void 0,(function(){var r,n,o,i,a,s,l,u,c,f,d,h=this;return v(this,(function(p){switch(p.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,i=void 0!==o&&o,a=e.stream,s=void 0!==a&&a,l=e.signal,u=e.timeout,c=null!=u?u:this.timeout,l&&(l.aborted&&r.abort(),l.addEventListener("abort",(function(){return r.abort()}))),f=null,i&&c&&(f=setTimeout((function(){console.warn(h.timeoutMsg),r.abort(new Error(h.timeoutMsg))}),c)),[4,fetch(n,y(y({},e),{signal:r.signal})).then((function(e){return m(h,void 0,void 0,(function(){var t,r,n;return v(this,(function(o){switch(o.label){case 0:return clearTimeout(f),e.ok?(t=e,[3,3]):[3,1];case 1:return n=(r=Promise).reject,[4,e.json()];case 2:t=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,t]}}))}))})).catch((function(e){return clearTimeout(f),Promise.reject(e)}))];case 1:return d=p.sent(),[2,{data:s?d.body:(null===(t=d.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?d.json():d.text(),statusCode:d.status,header:d.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,l=e.url,u=e.headers,d=void 0===u?{}:u,h=e.data,p=e.responseType,b=e.withCredentials,y=e.body,m=e.onUploadProgress,v=f(a,l,"get"===n?h:{}),_=new XMLHttpRequest;_.open(n,v),p&&(_.responseType=p),Object.keys(d).forEach((function(e){_.setRequestHeader(e,d[e])})),m&&_.upload.addEventListener("progress",m),_.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"===p?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===p?_.response:_.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=c(h)?h:"application/x-www-form-urlencoded"===d["content-type"]?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("&")}(h):y||(h?JSON.stringify(h):void 0),b&&(_.withCredentials=!0),_.send(s)}))},t}(l),g=function(){return g=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},g.apply(this,arguments)};!function(e){e.WEB="web",e.WX_MP="wx_mp"}(p||(p={}));var w=function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),S=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},O=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},P=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return w(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}((function(){})),E=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:(d(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new P(t.root));case"none":return new P(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:s.OPERATION_FAIL,msg:"[".concat(o(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:e}))}}else d(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return S(this,void 0,void 0,(function(){var n;return O(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={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0}.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:""}d(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return S(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0}.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):d(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return S(this,void 0,void 0,(function(){return O(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}(),T=function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),R=function(e,t){this.data=t||null,this.name=e},A=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return T(t,e),t}(R),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(e instanceof A)return console.error(e.error),this;var r="string"==typeof e?new R(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?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))}([],this.listeners[n],!0):[];o<i.length;o++)i[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new C;var I=new C,j="lang_change";function k(e){this.message=e}function q(e){this.message=e}function L(){}function x(e){return"object"==typeof e&&null!==e||"function"==typeof e}"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),k.prototype=new Error,k.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),q.prototype=new Error,q.prototype.name="InvalidTokenError";const N=L;function W(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const M=Promise,F=Promise.resolve.bind(M),B=Promise.prototype.then,D=Promise.reject.bind(M),z=F;function U(e){return new M(e)}function $(e){return U((t=>t(e)))}function V(e){return D(e)}function H(e,t,r){return B.call(e,t,r)}function Y(e,t,r){H(H(e,t,r),void 0,N)}function G(e,t){Y(e,t)}function K(e,t){Y(e,void 0,t)}function Q(e,t,r){return H(e,t,r)}function J(e){H(e,void 0,N)}let X=e=>{if("function"==typeof queueMicrotask)X=queueMicrotask;else{const e=$(void 0);X=t=>H(e,t)}return X(e)};function Z(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function ee(e,t,r){try{return $(Z(e,t,r))}catch(e){return V(e)}}class te{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 re=Symbol("[[AbortSteps]]"),ne=Symbol("[[ErrorSteps]]"),oe=Symbol("[[CancelSteps]]"),ie=Symbol("[[PullSteps]]"),ae=Symbol("[[ReleaseSteps]]");function se(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?fe(e):"closed"===t._state?function(e){fe(e),pe(e)}(e):de(e,t._storedError)}function le(e,t){return mn(e._ownerReadableStream,t)}function ue(e){const t=e._ownerReadableStream;"readable"===t._state?he(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){de(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 ce(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function fe(e){e._closedPromise=U(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function de(e,t){fe(e),he(e,t)}function he(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 pe(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const be=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 me(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 _e(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function ge(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function we(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Se(e){return Number(e)}function Oe(e){return 0===e?0:e}function Pe(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Oe(n),!be(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Oe(ye(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return be(n)&&0!==n?n:0}function Ee(e,t){if(!bn(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Te(e){return new je(e)}function Re(e,t){e._reader._readRequests.push(t)}function Ae(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Ce(e){return e._reader._readRequests.length}function Ie(e){const t=e._reader;return void 0!==t&&!!ke(t)}class je{constructor(e){if(ge(e,1,"ReadableStreamDefaultReader"),Ee(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");se(this,e),this._readRequests=new te}get closed(){return ke(this)?this._closedPromise:V(xe("closed"))}cancel(e=void 0){return ke(this)?void 0===this._ownerReadableStream?V(ce("cancel")):le(this,e):V(xe("cancel"))}read(){if(!ke(this))return V(xe("read"));if(void 0===this._ownerReadableStream)return V(ce("read from"));let e,t;const r=U(((r,n)=>{e=r,t=n}));return qe(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 xe("releaseLock");void 0!==this._ownerReadableStream&&function(e){ue(e),Le(e,new TypeError("Reader was released"))}(this)}}function ke(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof je}function qe(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[ie](t)}function Le(e,t){const r=e._readRequests;e._readRequests=new te,r.forEach((e=>{e._errorSteps(t)}))}function xe(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var Ne,We,Me;function Fe(e){return e.slice()}function Be(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(je.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),W(je.prototype.cancel,"cancel"),W(je.prototype.read,"read"),W(je.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(je.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let De=e=>(De="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,De(e)),ze=e=>(ze="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,ze(e));function Ue(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return Be(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 Ve(e){try{const t=e.done,r=e.value;return H(z(r),(e=>({done:t,value:e})))}catch(e){return V(e)}}const He=null!==(Me=null!==(Ne=Symbol.asyncIterator)&&void 0!==Ne?Ne:null===(We=Symbol.for)||void 0===We?void 0:We.call(Symbol,"Symbol.asyncIterator"))&&void 0!==Me?Me:"@@asyncIterator";function Ye(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=$e(e,He)))return function(e){const t={next(){let t;try{t=Ge(e)}catch(e){return V(e)}return Ve(t)},return(t){let r;try{const n=$e(e.iterator,"return");if(void 0===n)return $({done:!0,value:t});r=Z(n,e.iterator,[t])}catch(e){return V(e)}return x(r)?Ve(r):V(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=Z(r,e,[]);if(!x(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Ge(e){const t=Z(e.nextMethod,e.iterator,[]);if(!x(t))throw new TypeError("The iterator.next() method must return an object");return t}class Ke{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?Q(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?Q(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=U(((e,n)=>{t=e,r=n}));return qe(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,X((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,ue(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,ue(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=le(t,e);return ue(t),Q(r,(()=>({value:e,done:!0})))}return ue(t),$({value:e,done:!0})}}const Qe={next(){return Je(this)?this._asyncIteratorImpl.next():V(Xe("next"))},return(e){return Je(this)?this._asyncIteratorImpl.return(e):V(Xe("return"))},[He](){return this}};function Je(e){if(!x(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Ke}catch(e){return!1}}function Xe(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Qe,He,{enumerable:!1});const Ze=Number.isNaN||function(e){return e!=e};function et(e){const t=Ue(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function tt(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function rt(e,t,r){if("number"!=typeof(n=r)||Ze(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 nt(e){e._queue=new te,e._queueTotalSize=0}function ot(e){return e===DataView}class it{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!lt(this))throw qt("view");return this._view}respond(e){if(!lt(this))throw qt("respond");if(ge(e,1,"respond"),e=Pe(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(ze(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");It(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!lt(this))throw qt("respondWithNewView");if(ge(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(ze(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");jt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(it.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),W(it.prototype.respond,"respond"),W(it.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class at{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!st(this))throw Lt("byobRequest");return At(this)}get desiredSize(){if(!st(this))throw Lt("desiredSize");return Ct(this)}close(){if(!st(this))throw Lt("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`);Pt(this)}enqueue(e){if(!st(this))throw Lt("enqueue");if(ge(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`);Et(this,e)}error(e=void 0){if(!st(this))throw Lt("error");Tt(this,e)}[oe](e){ct(this),nt(this);const t=this._cancelAlgorithm(e);return Ot(this),t}[ie](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Rt(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)}Re(t,e),ut(this)}[ae](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new te,this._pendingPullIntos.push(e)}}}function st(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof at}function lt(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof it}function ut(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Ie(t)&&Ce(t)>0)||(!!(Ft(t)&&Mt(t)>0)||Ct(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ut(e)),null)),(t=>(Tt(e,t),null)))))}function ct(e){_t(e),e._pendingPullIntos=new te}function ft(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=dt(t);"default"===t.readerType?Ae(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function dt(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function ht(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function pt(e,t,r,n){let o;try{o=Ue(t,r,r+n)}catch(t){throw Tt(e,t),t}ht(e,o,0,n)}function bt(e,t){t.bytesFilled>0&&pt(e,t.buffer,t.byteOffset,t.bytesFilled),St(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 a=n-n%t.elementSize;a>=t.minimumFill&&(o=a-t.bytesFilled,i=!0);const s=e._queue;for(;o>0;){const r=s.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;Be(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?s.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,mt(0,n,t),o-=n}return i}function mt(e,t,r){r.bytesFilled+=t}function vt(e){0===e._queueTotalSize&&e._closeRequested?(Ot(e),vn(e._controlledReadableByteStream)):ut(e)}function _t(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function gt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();yt(e,t)&&(St(e),ft(e._controlledReadableByteStream,t))}}function wt(e,t){const r=e._pendingPullIntos.peek();_t(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&St(e);const r=e._controlledReadableByteStream;if(Ft(r))for(;Mt(r)>0;)ft(r,St(e))}(e,r):function(e,t,r){if(mt(0,t,r),"none"===r.readerType)return bt(e,r),void gt(e);if(r.bytesFilled<r.minimumFill)return;St(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;pt(e,r.buffer,t-n,n)}r.bytesFilled-=n,ft(e._controlledReadableByteStream,r),gt(e)}(e,t,r),ut(e)}function St(e){return e._pendingPullIntos.shift()}function Ot(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Pt(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 Tt(e,t),t}}Ot(e),vn(t)}}function Et(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(ze(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=De(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(ze(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");_t(e),t.buffer=De(t.buffer),"none"===t.readerType&&bt(e,t)}Ie(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Rt(e,t._readRequests.shift())}}(e),0===Ce(r)?ht(e,a,o,i):(e._pendingPullIntos.length>0&&St(e),Ae(r,new Uint8Array(a,o,i),!1))):Ft(r)?(ht(e,a,o,i),gt(e)):ht(e,a,o,i),ut(e)}function Tt(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(ct(e),nt(e),Ot(e),_n(r,t))}function Rt(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 At(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(it.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Ct(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function It(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=De(r.buffer),wt(e,t)}function jt(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=De(t.buffer),wt(e,n)}function kt(e,t,r,n,o,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,nt(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=a,t._pendingPullIntos=new te,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,ut(t),null)),(e=>(Tt(t,e),null)))}function qt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Lt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function xt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Nt(e){return new Bt(e)}function Wt(e,t){e._reader._readIntoRequests.push(t)}function Mt(e){return e._reader._readIntoRequests.length}function Ft(e){const t=e._reader;return void 0!==t&&!!Dt(t)}Object.defineProperties(at.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),W(at.prototype.close,"close"),W(at.prototype.enqueue,"enqueue"),W(at.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(at.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Bt{constructor(e){if(ge(e,1,"ReadableStreamBYOBReader"),Ee(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!st(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");se(this,e),this._readIntoRequests=new te}get closed(){return Dt(this)?this._closedPromise:V($t("closed"))}cancel(e=void 0){return Dt(this)?void 0===this._ownerReadableStream?V(ce("cancel")):le(this,e):V($t("cancel"))}read(e,t={}){if(!Dt(this))return V($t("read"));if(!ArrayBuffer.isView(e))return V(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return V(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return V(new TypeError("view's buffer must have non-zero byteLength"));if(ze(e.buffer))return V(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return me(e,t),{min:Pe(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return V(e)}const n=r.min;if(0===n)return V(new TypeError("options.min must be greater than 0"));if(function(e){return ot(e.constructor)}(e)){if(n>e.byteLength)return V(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return V(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return V(ce("read from"));let o,i;const a=U(((e,t)=>{o=e,i=t}));return zt(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!Dt(this))throw $t("releaseLock");void 0!==this._ownerReadableStream&&function(e){ue(e),Ut(e,new TypeError("Reader was released"))}(this)}}function Dt(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Bt}function zt(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,a=function(e){return ot(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:l}=t,u=r*a;let c;try{c=De(t.buffer)}catch(e){return void n._errorSteps(e)}const f={buffer:c,bufferByteLength:c.byteLength,byteOffset:s,byteLength:l,bytesFilled:0,minimumFill:u,elementSize:a,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(f),void Wt(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(yt(e,f)){const t=dt(f);return vt(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Tt(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(f),Wt(o,n),ut(e)}else{const e=new i(f.buffer,f.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function Ut(e,t){const r=e._readIntoRequests;e._readIntoRequests=new te,r.forEach((e=>{e._errorSteps(t)}))}function $t(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Vt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(Ze(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Ht(e){const{size:t}=e;return t||(()=>1)}function Yt(e,t){me(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Se(r),size:void 0===n?void 0:Gt(n,`${t} has member 'size' that`)}}function Gt(e,t){return ve(e,t),t=>Se(e(t))}function Kt(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function Qt(e,t,r){return ve(e,r),()=>ee(e,t,[])}function Jt(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function Xt(e,t,r){return ve(e,r),(r,n)=>ee(e,t,[r,n])}function Zt(e,t){if(!or(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Bt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),W(Bt.prototype.cancel,"cancel"),W(Bt.prototype.read,"read"),W(Bt.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Bt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const er="function"==typeof AbortController;class tr{constructor(e={},t={}){void 0===e?e=null:_e(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){me(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,a=null==e?void 0:e.write;return{abort:void 0===r?void 0:Kt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:Qt(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:Jt(o,e,`${t} has member 'start' that`),write:void 0===a?void 0:Xt(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(nr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=Ht(r);!function(e,t,r,n){const o=Object.create(wr.prototype);let i,a,s,l;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.write?e=>t.write(e,o):()=>$(void 0),s=void 0!==t.close?()=>t.close():()=>$(void 0),l=void 0!==t.abort?e=>t.abort(e):()=>$(void 0),Or(e,o,i,a,s,l,r,n)}(this,n,Vt(r,1),o)}get locked(){if(!or(this))throw Ir("locked");return ir(this)}abort(e=void 0){return or(this)?ir(this)?V(new TypeError("Cannot abort a stream that already has a writer")):ar(this,e):V(Ir("abort"))}close(){return or(this)?ir(this)?V(new TypeError("Cannot close a stream that already has a writer")):fr(this)?V(new TypeError("Cannot close an already-closing stream")):sr(this):V(Ir("close"))}getWriter(){if(!or(this))throw Ir("getWriter");return rr(this)}}function rr(e){return new pr(e)}function nr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new te,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function or(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof tr}function ir(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=U(((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}}));return e._pendingAbortRequest._promise=i,o||ur(e,t),i}function sr(e){const t=e._state;if("closed"===t||"errored"===t)return V(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=U(((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n})),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&zr(n),rt(o=e._writableStreamController,gr,0),Tr(o),r}function lr(e,t){"writable"!==e._state?cr(e):ur(e,t)}function ur(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&mr(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&cr(e)}function cr(e){e._state="errored",e._writableStreamController[ne]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new te,void 0===e._pendingAbortRequest)return void dr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void dr(e);Y(e._writableStreamController[re](r._reason),(()=>(r._resolve(),dr(e),null)),(t=>(r._reject(t),dr(e),null)))}function fr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function dr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Nr(t,e._storedError)}function hr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Mr(e)}(r):zr(r)),e._backpressure=t}Object.defineProperties(tr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),W(tr.prototype.abort,"abort"),W(tr.prototype.close,"close"),W(tr.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(tr.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class pr{constructor(e){if(ge(e,1,"WritableStreamDefaultWriter"),Zt(e,"First parameter"),ir(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)!fr(e)&&e._backpressure?Mr(this):Br(this),Lr(this);else if("erroring"===t)Fr(this,e._storedError),Lr(this);else if("closed"===t)Br(this),Lr(this),Wr(this);else{const t=e._storedError;Fr(this,t),xr(this,t)}}get closed(){return br(this)?this._closedPromise:V(kr("closed"))}get desiredSize(){if(!br(this))throw kr("desiredSize");if(void 0===this._ownerWritableStream)throw qr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Er(t._writableStreamController)}(this)}get ready(){return br(this)?this._readyPromise:V(kr("ready"))}abort(e=void 0){return br(this)?void 0===this._ownerWritableStream?V(qr("abort")):function(e,t){return ar(e._ownerWritableStream,t)}(this,e):V(kr("abort"))}close(){if(!br(this))return V(kr("close"));const e=this._ownerWritableStream;return void 0===e?V(qr("close")):fr(e)?V(new TypeError("Cannot close an already-closing stream")):yr(this)}releaseLock(){if(!br(this))throw kr("releaseLock");void 0!==this._ownerWritableStream&&vr(this)}write(e=void 0){return br(this)?void 0===this._ownerWritableStream?V(qr("write to")):_r(this,e):V(kr("write"))}}function br(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof pr}function yr(e){return sr(e._ownerWritableStream)}function mr(e,t){"pending"===e._readyPromiseState?Dr(e,t):function(e,t){Fr(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");mr(e,r),function(e,t){"pending"===e._closedPromiseState?Nr(e,t):function(e,t){xr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function _r(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Rr(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return V(qr("write to"));const i=r._state;if("errored"===i)return V(r._storedError);if(fr(r)||"closed"===i)return V(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return V(r._storedError);const a=function(e){return U(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{rt(e,t,r)}catch(t){return void Rr(e,t)}const n=e._controlledWritableStream;fr(n)||"writable"!==n._state||hr(n,Ar(e)),Tr(e)}(n,t,o),a}Object.defineProperties(pr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),W(pr.prototype.abort,"abort"),W(pr.prototype.close,"close"),W(pr.prototype.releaseLock,"releaseLock"),W(pr.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(pr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const gr={};class wr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Sr(this))throw jr("abortReason");return this._abortReason}get signal(){if(!Sr(this))throw jr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Sr(this))throw jr("error");"writable"===this._controlledWritableStream._state&&Cr(this,e)}[re](e){const t=this._abortAlgorithm(e);return Pr(this),t}[ne](){nt(this)}}function Sr(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof wr}function Or(e,t,r,n,o,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,nt(t),t._abortReason=void 0,t._abortController=function(){if(er)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const l=Ar(t);hr(e,l),Y($(r()),(()=>(t._started=!0,Tr(t),null)),(r=>(t._started=!0,lr(e,r),null)))}function Pr(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Er(e){return e._strategyHWM-e._queueTotalSize}function Tr(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void cr(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===gr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),tt(e);const r=e._closeAlgorithm();Pr(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&&Wr(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),lr(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(tt(e),!fr(r)&&"writable"===t){const t=Ar(e);hr(r,t)}return Tr(e),null}),(t=>("writable"===r._state&&Pr(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,lr(e,t)}(r,t),null)))}(e,r)}function Rr(e,t){"writable"===e._controlledWritableStream._state&&Cr(e,t)}function Ar(e){return Er(e)<=0}function Cr(e,t){const r=e._controlledWritableStream;Pr(e),ur(r,t)}function Ir(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function jr(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 qr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Lr(e){e._closedPromise=U(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function xr(e,t){Lr(e),Nr(e,t)}function Nr(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 Wr(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 Mr(e){e._readyPromise=U(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function Fr(e,t){Mr(e),Dr(e,t)}function Br(e){Mr(e),zr(e)}function Dr(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 zr(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(wr.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(wr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const Ur="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,$r=function(){const e=null==Ur?void 0:Ur.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 W(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Vr(e,t,r,n,o,i){const a=Te(e),s=rr(t);e._disturbed=!0;let l=!1,u=$(void 0);return U(((c,f)=>{let d;if(void 0!==i){if(d=()=>{const r=void 0!==i.reason?i.reason:new $r("Aborted","AbortError"),a=[];n||a.push((()=>"writable"===t._state?ar(t,r):$(void 0))),o||a.push((()=>"readable"===e._state?mn(e,r):$(void 0))),v((()=>Promise.all(a.map((e=>e())))),!0,r)},i.aborted)return void d();i.addEventListener("abort",d)}var h,p,b;if(m(e,a._closedPromise,(e=>(n?_(!0,e):v((()=>ar(t,e)),!0,e),null))),m(t,s._closedPromise,(t=>(o?_(!0,t):v((()=>mn(e,t)),!0,t),null))),h=e,p=a._closedPromise,b=()=>(r?_():v((()=>function(e){const t=e._ownerWritableStream,r=t._state;return fr(t)||"closed"===r?$(void 0):"errored"===r?V(t._storedError):yr(e)}(s))),null),"closed"===h._state?b():G(p,b),fr(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");o?_(!0,t):v((()=>mn(e,t)),!0,t)}function y(){const e=u;return H(u,(()=>e!==u?y():void 0))}function m(e,t,r){"errored"===e._state?r(e._storedError):K(t,r)}function v(e,r,n){function o(){return Y(e(),(()=>g(r,n)),(e=>g(!0,e))),null}l||(l=!0,"writable"!==t._state||fr(t)?o():G(y(),o))}function _(e,r){l||(l=!0,"writable"!==t._state||fr(t)?g(e,r):G(y(),(()=>g(e,r))))}function g(e,t){return vr(s),ue(a),void 0!==i&&i.removeEventListener("abort",d),e?f(t):c(void 0),null}J(U(((e,t)=>{!function r(n){n?e():H(l?$(!0):H(s._readyPromise,(()=>U(((e,t)=>{qe(a,{_chunkSteps:t=>{u=H(_r(s,t),void 0,L),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class Hr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Yr(this))throw nn("desiredSize");return en(this)}close(){if(!Yr(this))throw nn("close");if(!tn(this))throw new TypeError("The stream is not in a state that permits close");Jr(this)}enqueue(e=void 0){if(!Yr(this))throw nn("enqueue");if(!tn(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 nn("error");Zr(this,e)}[oe](e){nt(this);const t=this._cancelAlgorithm(e);return Qr(this),t}[ie](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=tt(this);this._closeRequested&&0===this._queue.length?(Qr(this),vn(t)):Gr(this),e._chunkSteps(r)}else Re(t,e),Gr(this)}[ae](){}}function Yr(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Hr}function Gr(e){Kr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Gr(e)),null)),(t=>(Zr(e,t),null)))))}function Kr(e){const t=e._controlledReadableStream;return!!tn(e)&&!!e._started&&(!!(yn(t)&&Ce(t)>0)||en(e)>0)}function Qr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Jr(e){if(!tn(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(Qr(e),vn(t))}function Xr(e,t){if(!tn(e))return;const r=e._controlledReadableStream;if(yn(r)&&Ce(r)>0)Ae(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Zr(e,t),t}try{rt(e,t,r)}catch(t){throw Zr(e,t),t}}Gr(e)}function Zr(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(nt(e),Qr(e),_n(r,t))}function en(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function tn(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function rn(e,t,r,n,o,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,nt(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,Gr(t),null)),(e=>(Zr(t,e),null)))}function nn(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function on(e){return x(t=e)&&void 0!==t.getReader?function(e){let t;return t=dn(L,(function(){let r;try{r=e.read()}catch(r){return V(r)}return Q(r,(e=>{if(!x(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 V(t)}}),0),t}(e.getReader()):function(e){let t;const r=Ye(e,"async");return t=dn(L,(function(){let e;try{e=Ge(r)}catch(e){return V(e)}return Q($(e),(e=>{if(!x(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 V(e)}return void 0===n?$(void 0):Q(ee(n,t,[e]),(e=>{if(!x(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=>ee(e,t,[r])}function sn(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function ln(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function un(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function cn(e,t){me(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(Hr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),W(Hr.prototype.close,"close"),W(Hr.prototype.enqueue,"enqueue"),W(Hr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Hr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class fn{constructor(e={},t={}){void 0===e?e=null:_e(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){me(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,a=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Pe(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:sn(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:ln(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:un(s,`${t} has member 'type' that`)}}(e,"First parameter");if(pn(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,a;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>$(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0);const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");kt(e,n,o,i,a,r,s)}(this,n,Vt(r,0))}else{const e=Ht(r);!function(e,t,r,n){const o=Object.create(Hr.prototype);let i,a,s;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.pull?()=>t.pull(o):()=>$(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>$(void 0),rn(e,o,i,a,s,r,n)}(this,n,Vt(r,1),e)}}get locked(){if(!bn(this))throw gn("locked");return yn(this)}cancel(e=void 0){return bn(this)?yn(this)?V(new TypeError("Cannot cancel a stream that already has a reader")):mn(this,e):V(gn("cancel"))}getReader(e=void 0){if(!bn(this))throw gn("getReader");return void 0===function(e,t){me(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:xt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Te(this):Nt(this)}pipeThrough(e,t={}){if(!bn(this))throw gn("pipeThrough");ge(e,1,"pipeThrough");const r=function(e,t){me(e,t);const r=null==e?void 0:e.readable;we(r,"readable","ReadableWritablePair"),Ee(r,`${t} has member 'readable' that`);const n=null==e?void 0:e.writable;return we(n,"writable","ReadableWritablePair"),Zt(n,`${t} has member 'writable' that`),{readable:r,writable:n}}(e,"First parameter"),n=cn(t,"Second parameter");if(yn(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(ir(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return J(Vr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!bn(this))return V(gn("pipeTo"));if(void 0===e)return V("Parameter 1 is required in 'pipeTo'.");if(!or(e))return V(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=cn(t,"Second parameter")}catch(e){return V(e)}return yn(this)?V(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):ir(e)?V(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Vr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!bn(this))throw gn("tee");return Fe(function(e){return st(e._readableStreamController)?function(e){let t,r,n,o,i,a=Te(e),s=!1,l=!1,u=!1,c=!1,f=!1;const d=U((e=>{i=e}));function h(e){K(e._closedPromise,(t=>(e!==a||(Tt(n._readableStreamController,t),Tt(o._readableStreamController,t),c&&f||i(void 0)),null)))}function p(){Dt(a)&&(ue(a),a=Te(e),h(a)),qe(a,{_chunkSteps:t=>{X((()=>{l=!1,u=!1;const r=t;let a=t;if(!c&&!f)try{a=et(t)}catch(t){return Tt(n._readableStreamController,t),Tt(o._readableStreamController,t),void i(mn(e,t))}c||Et(n._readableStreamController,r),f||Et(o._readableStreamController,a),s=!1,l?y():u&&m()}))},_closeSteps:()=>{s=!1,c||Pt(n._readableStreamController),f||Pt(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&It(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&It(o._readableStreamController,0),c&&f||i(void 0)},_errorSteps:()=>{s=!1}})}function b(t,r){ke(a)&&(ue(a),a=Nt(e),h(a));const d=r?o:n,p=r?n:o;zt(a,t,1,{_chunkSteps:t=>{X((()=>{l=!1,u=!1;const n=r?f:c;if(r?c:f)n||jt(d._readableStreamController,t);else{let r;try{r=et(t)}catch(t){return Tt(d._readableStreamController,t),Tt(p._readableStreamController,t),void i(mn(e,t))}n||jt(d._readableStreamController,t),Et(p._readableStreamController,r)}s=!1,l?y():u&&m()}))},_closeSteps:e=>{s=!1;const t=r?f:c,n=r?c:f;t||Pt(d._readableStreamController),n||Pt(p._readableStreamController),void 0!==e&&(t||jt(d._readableStreamController,e),!n&&p._readableStreamController._pendingPullIntos.length>0&&It(p._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{s=!1}})}function y(){if(s)return l=!0,$(void 0);s=!0;const e=At(n._readableStreamController);return null===e?p():b(e._view,!1),$(void 0)}function m(){if(s)return u=!0,$(void 0);s=!0;const e=At(o._readableStreamController);return null===e?p():b(e._view,!0),$(void 0)}function v(){}return n=hn(v,y,(function(n){if(c=!0,t=n,f){const n=Fe([t,r]),o=mn(e,n);i(o)}return d})),o=hn(v,m,(function(n){if(f=!0,r=n,c){const n=Fe([t,r]),o=mn(e,n);i(o)}return d})),h(a),[n,o]}(e):function(e){const t=Te(e);let r,n,o,i,a,s=!1,l=!1,u=!1,c=!1;const f=U((e=>{a=e}));function d(){return s?(l=!0,$(void 0)):(s=!0,qe(t,{_chunkSteps:e=>{X((()=>{l=!1;const t=e,r=e;u||Xr(o._readableStreamController,t),c||Xr(i._readableStreamController,r),s=!1,l&&d()}))},_closeSteps:()=>{s=!1,u||Jr(o._readableStreamController),c||Jr(i._readableStreamController),u&&c||a(void 0)},_errorSteps:()=>{s=!1}}),$(void 0))}function h(){}return o=dn(h,d,(function(t){if(u=!0,r=t,c){const t=Fe([r,n]),o=mn(e,t);a(o)}return f})),i=dn(h,d,(function(t){if(c=!0,n=t,u){const t=Fe([r,n]),o=mn(e,t);a(o)}return f})),K(t._closedPromise,(e=>(Zr(o._readableStreamController,e),Zr(i._readableStreamController,e),u&&c||a(void 0),null))),[o,i]}(e)}(this))}values(e=void 0){if(!bn(this))throw gn("values");return function(e,t){const r=Te(e),n=new Ke(r,t),o=Object.create(Qe);return o._asyncIteratorImpl=n,o}(this,function(e){me(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[He](e){return this.values(e)}static from(e){return on(e)}}function dn(e,t,r,n=1,o=()=>1){const i=Object.create(fn.prototype);return pn(i),rn(i,Object.create(Hr.prototype),e,t,r,n,o),i}function hn(e,t,r){const n=Object.create(fn.prototype);return pn(n),kt(n,Object.create(at.prototype),e,t,r,0,void 0),n}function pn(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function bn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof fn}function yn(e){return void 0!==e._reader}function mn(e,t){if(e._disturbed=!0,"closed"===e._state)return $(void 0);if("errored"===e._state)return V(e._storedError);vn(e);const r=e._reader;if(void 0!==r&&Dt(r)){const e=r._readIntoRequests;r._readIntoRequests=new te,e.forEach((e=>{e._closeSteps(void 0)}))}return Q(e._readableStreamController[oe](t),L)}function vn(e){e._state="closed";const t=e._reader;if(void 0!==t&&(pe(t),ke(t))){const e=t._readRequests;t._readRequests=new te,e.forEach((e=>{e._closeSteps()}))}}function _n(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(he(r,t),ke(r)?Le(r,t):Ut(r,t))}function gn(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function wn(e,t){me(e,t);const r=null==e?void 0:e.highWaterMark;return we(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Se(r)}}Object.defineProperties(fn,{from:{enumerable:!0}}),Object.defineProperties(fn.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),W(fn.from,"from"),W(fn.prototype.cancel,"cancel"),W(fn.prototype.getReader,"getReader"),W(fn.prototype.pipeThrough,"pipeThrough"),W(fn.prototype.pipeTo,"pipeTo"),W(fn.prototype.tee,"tee"),W(fn.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(fn.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(fn.prototype,He,{value:fn.prototype.values,writable:!0,configurable:!0});const Sn=e=>e.byteLength;W(Sn,"size");class On{constructor(e){ge(e,1,"ByteLengthQueuingStrategy"),e=wn(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!En(this))throw Pn("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!En(this))throw Pn("size");return Sn}}function Pn(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function En(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof On}Object.defineProperties(On.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(On.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Tn=()=>1;W(Tn,"size");class Rn{constructor(e){ge(e,1,"CountQueuingStrategy"),e=wn(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Cn(this))throw An("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Cn(this))throw An("size");return Tn}}function An(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Cn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Rn}function In(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function jn(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function kn(e,t,r){return ve(e,r),(r,n)=>ee(e,t,[r,n])}function qn(e,t,r){return ve(e,r),r=>ee(e,t,[r])}Object.defineProperties(Rn.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Rn.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Ln{constructor(e={},t={},r={}){void 0===e&&(e=null);const n=Yt(t,"Second parameter"),o=Yt(r,"Third parameter"),i=function(e,t){me(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,a=null==e?void 0:e.transform,s=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:qn(r,e,`${t} has member 'cancel' that`),flush:void 0===n?void 0:In(n,e,`${t} has member 'flush' that`),readableType:o,start:void 0===i?void 0:jn(i,e,`${t} has member 'start' that`),transform:void 0===a?void 0:kn(a,e,`${t} has member 'transform' that`),writableType:s}}(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 a=Vt(o,0),s=Ht(o),l=Vt(n,1),u=Ht(n);let c;!function(e,t,r,n,o,i){function a(){return t}e._writable=function(e,t,r,n,o=1,i=()=>1){const a=Object.create(tr.prototype);return nr(a),Or(a,Object.create(wr.prototype),e,t,r,n,o,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?Q(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=U(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const n=t._flushAlgorithm();return zn(t),Y(n,(()=>("errored"===r._state?Yn(t,r._storedError):(Jr(r._readableStreamController),Hn(t)),null)),(e=>(Zr(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=U(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return zn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(Zr(n._readableStreamController,t),Hn(r)),null)),(e=>(Zr(n._readableStreamController,e),Yn(r,e),null))),r._finishPromise}(e,t)}),r,n),e._readable=dn(a,(function(){return function(e){return Fn(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=U(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return zn(r),Y(o,(()=>("errored"===n._state?Yn(r,n._storedError):(Rr(n._writableStreamController,t),Mn(e),Hn(r)),null)),(t=>(Rr(n._writableStreamController,t),Mn(e),Yn(r,t),null))),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,Fn(e,!0),e._transformStreamController=void 0}(this,U((e=>{c=e})),l,u,a,s),function(e,t){const r=Object.create(Bn.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return Un(r,e),$(void 0)}catch(e){return V(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?c(i.start(this._transformStreamController)):c(void 0)}get readable(){if(!xn(this))throw Gn("readable");return this._readable}get writable(){if(!xn(this))throw Gn("writable");return this._writable}}function xn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof Ln}function Nn(e,t){Zr(e._readable._readableStreamController,t),Wn(e,t)}function Wn(e,t){zn(e._transformStreamController),Rr(e._writable._writableStreamController,t),Mn(e)}function Mn(e){e._backpressure&&Fn(e,!1)}function Fn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=U((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(Ln.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ln.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class Bn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Dn(this))throw Vn("desiredSize");return en(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Dn(this))throw Vn("enqueue");Un(this,e)}error(e=void 0){if(!Dn(this))throw Vn("error");var t;t=e,Nn(this._controlledTransformStream,t)}terminate(){if(!Dn(this))throw Vn("terminate");!function(e){const t=e._controlledTransformStream;Jr(t._readable._readableStreamController),Wn(t,new TypeError("TransformStream terminated"))}(this)}}function Dn(e){return!!x(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Bn}function zn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Un(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!tn(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{Xr(n,t)}catch(e){throw Wn(r,e),r._readable._storedError}const o=function(e){return!Kr(e)}(n);o!==r._backpressure&&Fn(r,!0)}function $n(e,t){return Q(e._transformAlgorithm(t),void 0,(t=>{throw Nn(e._controlledTransformStream,t),t}))}function Vn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Hn(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 Gn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Bn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),W(Bn.prototype.enqueue,"enqueue"),W(Bn.prototype.error,"error"),W(Bn.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Bn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var Kn,Qn=(Kn=function(e,t){return Kn=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])},Kn(e,t)},function(e,t){function r(){this.constructor=e}Kn(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="Error when aborting requestTask",Zn=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 Qn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,n){var o=e.url,i=e.data,a=e.headers,s=wx.request({url:u("https:",o),data:i,timeout:t._timeout,method:"POST",header:a,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{s.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 a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var t,o,i,a,s,l;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}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,s])}}}(this,(function(u){return t=e.url,o=e.file,i=e.data,a=e.headers,s=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:o,name:"file",formData:Jn({},i),header:a,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{l.abort()}catch(e){}}}}),s&&l.onProgressUpdate((function(e){s(e)})),[2]}))}))}))},t.prototype.download=function(e){var t=this,r=this;return new Promise((function(n,o){var i=e.url,a=e.headers,s=wx.downloadFile({url:u("https:",i),header:a,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{s.abort()}catch(e){}}}})}))},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,a=e.stream,s=void 0!==a&&a,l=e.signal,c=e.timeout,f=this,d=null!=c?c:this._timeout,h=null,p=new fn({start:function(e){h=e},cancel:function(){h=null}});return new Promise((function(e,a){s&&e({data:p});var c=wx.request({url:u("https:",t),data:r,timeout:d,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=h)||void 0===r||r.close(),!s&&e(t)},fail:function(e){var t;if(null===(t=h)||void 0===t||t.close(),a(e),s)throw e},complete:function(e){if(e&&e.errMsg&&d&&-1!==f._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg){console.warn(f._timeoutMsg);try{c.abort()}catch(e){console.warn(Xn,e)}}},enableChunked:s});if(c.onChunkReceived((function(e){var t;null===(t=h)||void 0===t||t.enqueue(new Uint8Array(e.data))})),l){var b=function(){try{c.abort()}catch(e){console.warn(Xn,e)}};l.aborted?b():l.addEventListener("abort",(function(){return b()}))}}))},t}(l),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}},ro={genAdapter:function(){return{root:{},reqClass:Zn,wsClass:to,localStorage:eo,primaryStorage:i.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:""}}},isMatch: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},runtime:"wx_mp"},no=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))},oo=s,io={};function ao(e,t){var r=t.name,n=t.namespace,o=t.entity,i=t.injectEvents,a=t.IIFE,s=void 0!==a&&a;if(io[r]||n&&e[n])throw new Error(JSON.stringify({code:oo.INVALID_OPERATION,msg:"Duplicate component ".concat(r)}));if(s){if(!o||"function"!=typeof o)throw new Error(JSON.stringify({code:oo.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));o.call(e)}if(io[r]=t,n?e.prototype[n]=o:so(e.prototype,o),i){var l=i.bus,u=i.events;if(!l||!u||0===u.length)return;var c=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[r]?e.prototype.events[r].events=no(no([],e.prototype.events[r].events,!0),u,!0):e.prototype.events[r]={bus:l,events:u},e.prototype.fire=function(e,t){c(e,t);for(var r=0,n=Object.keys(this.events);r<n.length;r++){var o=n[r],i=this.events[o],a=i.bus;if(i.events.includes(e)){a.fire(e,t);break}}}}}function so(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var r=0,n=Object.keys(t);r<n.length;r++){var o=n[r];Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=so(e[o],t[o]))}return e}var lo={},uo=function(){return uo=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},uo.apply(this,arguments)},co=E,fo={},ho={};function po(e){var t=e.env,r=e.platformInfo,n={userInfoKey:"".concat("user_info","_").concat(t)};fo[t]=fo[t]||new co(uo(uo({},e),{keys:n,platformInfo:r})),ho[t]=ho[t]||new co(uo(uo({},e),{keys:n,platformInfo:r,persistence:"local"}))}function bo(e){return ho[e]}var yo=function(){return yo=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},yo.apply(this,arguments)},mo="",vo="@cloudbase/js-sdk";function _o(){return mo}var go,wo=[],So=["env","endPointKey","region"],Oo="https:";function Po(e){return wo.find((function(t){return So.filter((function(t){return null!=e[t]})).every((function(r){return t[r]===e[r]}))}))}function Eo(e){var t,r,n,o=Po(e);o?(null!=e.baseUrl&&(o.baseUrl=e.baseUrl),null!=e.protocol&&(o.protocol=e.protocol)):wo.push(yo(yo({},e),{protocol:null!==(t=e.protocol)&&void 0!==t?t:Oo})),"CLOUD_API"===e.endPointKey&&(n=null!==(r=e.protocol)&&void 0!==r?r:Oo,a=n)}function To(e,t,r){return Po({env:e,endPointKey:t,region:r})}function Ro(e){var t=To(e,"CLOUD_API"),r=t.protocol,n=t.baseUrl;return"".concat(r).concat(n).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(e){e.NULL="NULL",e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.PHONE="PHONE"}(go||(go={}));var Ao=function(){return Ao=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},Ao.apply(this,arguments)},Co=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},Io=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},jo=s,ko=c,qo=f,Lo=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function xo(e,t,r){var n=e[t];e[t]=function(t){var o={},i={};r.forEach((function(r){var n=r.call(e,t),a=n.data,s=n.headers;Object.assign(o,a),Object.assign(i,s)}));var a=t.data;return a&&(ko(a)?Object.keys(o).forEach((function(e){a.append(e,o[e])})):t.data=Ao(Ao({},a),o)),t.headers=Ao(Ao({},t.headers||{}),i),n.call(e,t)}}function No(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(_o()),"x-seqid":e}}}var Wo,Mo,Fo=function(){function e(e){var t=this;this.throwWhenRequestFail=!1,this.config=e;var r={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new lo.adapter.reqClass(r),this.throwWhenRequestFail=e.throw||!1,this.localCache=bo(this.config.env),xo(this.reqClass,"post",[No]),xo(this.reqClass,"upload",[No]),xo(this.reqClass,"download",[No]),I.on(j,(function(e){var r;t.config.i18n=(null===(r=e.data)||void 0===r?void 0:r.i18n)||t.config.i18n}))}return e.prototype.getDefaultHeaders=function(){var e,t,r;return(e={})[null===(t=this.config.i18n)||void 0===t?void 0:t.LANG_HEADER_KEY]=null===(r=this.config.i18n)||void 0===r?void 0:r.lang,e},e.prototype.post=function(e){return Co(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.post(Ao(Ao({},e),{headers:Ao(Ao({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.upload=function(e){return Co(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.upload(Ao(Ao({},e),{headers:Ao(Ao({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return Co(this,void 0,void 0,(function(){return Io(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.download(Ao(Ao({},e),{headers:Ao(Ao({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.getBaseEndPoint=function(){return Ro(this.config.env)},e.prototype.getOauthAccessTokenV2=function(e){return Co(this,void 0,void 0,(function(){var t,r;return Io(this,(function(n){switch(n.label){case 0:return[4,e.getAccessToken()];case 1:return t=n.sent(),[4,e.getCredentials()];case 2:return r=n.sent(),[2,{accessToken:t,accessTokenExpire:new Date(r.expires_at).getTime()}]}}))}))},e.prototype.request=function(e,t,r){var n,o;return Co(this,void 0,void 0,(function(){var i,a,s,l,u,c,f,d,h,p,b,y,m,v,_,g,w,S,O,P;return Io(this,(function(E){switch(E.label){case 0:if(i="x-tcb-trace_".concat(this.config.env),a="application/x-www-form-urlencoded",s=Ao({action:e,dataVersion:"2020-01-10",env:this.config.env},t),-1!==Lo.indexOf(e))return[3,2];if(!(l=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return u=l.oauthInstance,c=u.oauth2client,f=s,[4,this.getOauthAccessTokenV2(c)];case 1:f.access_token=E.sent().accessToken,E.label=2;case 2:return"storage.uploadFile"===e?(d=new FormData,Object.keys(d).forEach((function(e){Object.prototype.hasOwnProperty.call(d,e)&&void 0!==d[e]&&d.append(e,s[e])})),a="multipart/form-data"):(a="application/json;charset=UTF-8",d={},Object.keys(s).forEach((function(e){void 0!==s[e]&&(d[e]=s[e])}))),h={headers:Ao({"content-type":a},this.getDefaultHeaders())},(null==r?void 0:r.onUploadProgress)&&(h.onUploadProgress=r.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(p=this.localCache.getStore(i))&&(h.headers["X-TCB-Trace"]=p),b=void 0!==(null==r?void 0:r.parse)?r.parse:t.parse,y=void 0!==(null==r?void 0:r.inQuery)?r.inQuery:t.inQuery,m=void 0!==(null==r?void 0:r.search)?r.search:t.search,v=Ao(Ao({},(null==r?void 0:r.defaultQuery)||{}),{env:this.config.env}),b&&(v.parse=!0),y&&(v=Ao(Ao({},y),v)),_=To(this.config.env,"CLOUD_API"),g=_.baseUrl,w=_.protocol,S=r.pathname?qo(w,"".concat(null===(n=Ro(this.config.env))||void 0===n?void 0:n.replace(/^https?:/,""),"/").concat(r.pathname),v):qo(w,g,v),m&&(S+=m),[4,this.post(Ao({url:S,data:d},h))];case 3:if(O=E.sent(),(P=null===(o=O.header)||void 0===o?void 0:o["x-tcb-trace"])&&this.localCache.setStore(i,P),200!==Number(O.status)&&200!==Number(O.statusCode)||!O.data)throw new Error("network request error");return[2,O]}}))}))},e.prototype.fetch=function(e){var t,r,n,o,i,a,s,l;return Co(this,void 0,void 0,(function(){var u,c,f,d,h,p,b,y=this;return Io(this,(function(m){switch(m.label){case 0:u=e.token,c=e.headers,f=void 0===c?{}:c,d=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["token","headers"]),h=function(){return Co(y,void 0,void 0,(function(){var e,t,r;return Io(this,(function(n){switch(n.label){case 0:if(null!=u)return[2,u];if(!(e=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return t=e.oauthInstance,r=t.oauth2client,[4,this.getOauthAccessTokenV2(r)];case 1:return[2,n.sent().accessToken]}}))}))},p=function(){return Co(y,void 0,void 0,(function(){var e,t,r,n,o;return Io(this,(function(i){switch(i.label){case 0:return t=(e=this.reqClass).fetch,n={},o={"X-SDK-Version":"@cloudbase/js-sdk/".concat(_o())},r="Bearer ".concat,[4,h()];case 1:return[2,t.apply(e,[Ao.apply(void 0,[(n.headers=Ao.apply(void 0,[Ao.apply(void 0,[(o.Authorization=r.apply("Bearer ",[i.sent()]),o),this.getDefaultHeaders()]),f]),n),d])])]}}))}))},m.label=1;case 1:return m.trys.push([1,3,,6]),[4,p()];case 2:return[2,m.sent()];case 3:if("ACCESS_TOKEN_EXPIRED"!==(null==(b=m.sent())?void 0:b.code))return[3,5];if("function"!=typeof(null===(o=null===(n=null===(r=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===r?void 0:r.oauthInstance)||void 0===n?void 0:n.authApi)||void 0===o?void 0:o.refreshTokenForce))throw b;return[4,null===(l=null===(s=null===(a=null===(i=this.config)||void 0===i?void 0:i._fromApp)||void 0===a?void 0:a.oauthInstance)||void 0===s?void 0:s.authApi)||void 0===l?void 0:l.refreshTokenForce()];case 4:return m.sent(),[2,p()];case 5:throw b;case 6:return[2]}}))}))},e.prototype.send=function(e,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),Co(this,void 0,void 0,(function(){var n;return Io(this,(function(o){switch(o.label){case 0:return[4,this.request(e,t,Ao(Ao({},r),{onUploadProgress:t.onUploadProgress}))];case 1:if((n=o.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:jo.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},e}(),Bo={};!function(e){e.ZH="zh-CN",e.EN="en-US"}(Mo||(Mo={}));var Do=((Wo={})[Mo.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":"Please check the calling method or visit the AI+ homepage to view the documentation","AI+ 请求出错,错误码":"AI+ request error, error code","错误信息":"error message","未实现":"not implemented","小程序不支持 wasm 加载":"wasm loading is not supported in mini programs","小程序不支持动态 js 加载":"dynamic js loading is not supported in mini programs","请求超时":"request timeout","缺少 privatelink sdk 地址":"missing privatelink sdk address"},Wo),zo=function(e,t){var r;return(null===(r=Do[t])||void 0===r?void 0:r[e])||e},Uo=function(e,t){var r,n,o=function(e){return"lang_".concat(e.clientId||e.env)}(t),i=(e.adapter||{}).localStorage,a=t.lang||(null===(r=null==i?void 0:i.getItem)||void 0===r?void 0:r.call(i,o))||Mo.ZH;return null===(n=null==i?void 0:i.setItem)||void 0===n||n.call(i,o,a),new Proxy({t:function(e){return zo(e,a)},LANG_HEADER_KEY:"Accept-Language",lang:a},{get:function(e,t){var r;return"lang"===t&&(null===(r=null==i?void 0:i.getItem)||void 0===r?void 0:r.call(i,o))||e[t]},set:function(e,t,r){var n;return"lang"===t&&r!==e[t]&&(e[t]=r,e.t=function(e){return zo(e,r)},null===(n=null==i?void 0:i.setItem)||void 0===n||n.call(i,o,r),I.fire(j,{i18n:e})),e[t]=r,!0}})},$o=r(794),Vo=function(){return Vo=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},Vo.apply(this,arguments)},Ho=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},Yo=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};function Go(e,t){var r,n,o;return Ho(this,void 0,void 0,(function(){var i,a,s,l,u,c,f,d,h,p,b,y,m,v,_;return Yo(this,(function(g){switch(g.label){case 0:if(a=(i=e||{}).name,s=i.body,l=i.path,u=void 0===l?"":l,c=i.method,f=void 0===c?"POST":c,d=i.headers,h=void 0===d?{}:d,p=i.token,!a)throw new Error(JSON.stringify({code:$o.ERRORS.INVALID_PARAMS,msg:"[apis] invalid api name"}));return b=this.getEndPointWithKey("GATEWAY"),y=b.BASE_URL,m=b.PROTOCOL,v="".concat(m).concat(y,"/apis/").concat(a),_=u.startsWith("/")?u:"/".concat(u),[4,this.request.fetch(Vo({url:"".concat(v).concat(_),method:f||"POST",headers:Vo({"Content-Type":"application/json; charset=utf-8"},h),body:s,token:(null===(r=null==p?void 0:p.trim)||void 0===r?void 0:r.call(p))||(null===(o=null===(n=h.Authorization)||void 0===n?void 0:n.replace)||void 0===o?void 0:o.call(n,/^Bearer /,""))||""},t))];case 1:return[4,g.sent().data];case 2:return[2,g.sent()]}}))}))}var Ko=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH","REQUEST"];function Qo(e){var t=this;return new Proxy({},{get:function(r,n){if("string"!=typeof n)throw new Error("[apis] method must be string");var o=n.toLocaleUpperCase();if(!Ko.includes(o))throw new Error("[apis] invalid method: ".concat(n));return function(r,n){return Ho(t,void 0,void 0,(function(){return Yo(this,(function(t){switch(t.label){case 0:return[4,Go.call(this,Vo({name:e,method:("REQUEST"===o?r.method:o)||"POST"},r),n)];case 1:return[2,t.sent()]}}))}))}}})}function Jo(){var e=this;return new Proxy({},{get:function(t,r){if("string"==typeof r)return Qo.call(e,r)}})}var Xo=function(){return Xo=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},Xo.apply(this,arguments)},Zo=function(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},ei=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},ti=s,ri="https://support.qq.com/products/148793",ni=d,oi=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,r){}},ii={timeout:15e3,persistence:"local"},ai=6e5,si={},li=function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.version=_o()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return lo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return e=this.cloudbaseConfig.env,fo[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return bo(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this.cloudbaseConfig.env,Bo[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"apis",{get:function(){return Jo.call(this)},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var r;if(!t.env)throw new Error(JSON.stringify({code:ti.INVALID_PARAMS,msg:"env must not be specified"}));lo.adapter||this.useDefaultAdapter();var n={timeout:t.timeout||5e3,timeoutMsg:"[".concat(vo,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s")};this.requestClient=new lo.adapter.reqClass(n),this.cloudbaseConfig=Xo(Xo(Xo({},ii),t),{i18n:Uo(lo,t)}),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var o=this.cloudbaseConfig,i=o.env,a=o.persistence,s=o.debug,l=o.timeout,u=o.oauthClient,c=o.i18n;po({env:i,persistence:a,debug:s,platformInfo:this.platform}),function(e,t){Eo({env:e,region:t,baseUrl:t?"//".concat(e,".").concat(t,".tcb-api.tencentcloudapi.com/web"):"//".concat(e,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(i,t.region||""),function(e){Eo({endPointKey:"GATEWAY",env:e,baseUrl:"//".concat(e,".api.tcloudbasegateway.com/v1"),protocol:void 0})}(i);var f=new e(this.cloudbaseConfig);return function(e){Bo[e.env]=new Fo(Ao(Ao({},e),{throw:!0}))}({env:i,region:t.region||"",timeout:l,oauthClient:u,_fromApp:f,i18n:c}),f.requestClient=this.requestClient,null===(r=null==this?void 0:this.fire)||void 0===r||r.call(this,"cloudbase_init",f),f},e.prototype.updateConfig=function(e){var t=e.persistence,r=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=r,po({env:this.cloudbaseConfig.env,persistence:t,debug:r,platformInfo:this.platform})},e.prototype.updateLang=function(e){var t;e&&e!==(null===(t=this.cloudbaseConfig.i18n)||void 0===t?void 0:t.lang)&&(this.cloudbaseConfig.i18n.lang=e)},e.prototype.registerExtension=function(e){si[e.name]=e},e.prototype.invokeExtension=function(e,t){return function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var r;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,(function(n){switch(n.label){case 0:if(!(r=si[e]))throw new Error(JSON.stringify({code:ti.INVALID_PARAMS,msg:"extension:".concat(e," must be registered before invoke")}));return[4,r.invoke(t,this)];case 1:return[2,n.sent()]}}))}))},e.prototype.useAdapters=function(e,t){var r=function(e,t){for(var r,n=0,o=(r=e,"[object Array]"===Object.prototype.toString.call(r)?e:[e]);n<o.length;n++){var i=o[n],a=i.isMatch,s=i.genAdapter,l=i.runtime;if(a())return{adapter:g({isMatch:a},s(t)),runtime:l}}}(e,t)||{},n=r.adapter,o=r.runtime;n&&(lo.adapter=n),o&&(lo.runtime=o)},e.prototype.registerHook=function(t){!function(e,t){var r=t.entity,n=t.target;if(Object.prototype.hasOwnProperty.call(e,n))throw new Error(JSON.stringify({code:oo.INVALID_OPERATION,msg:"target:".concat(n," is not exist")}));var o=e.prototype[n];if("function"!=typeof o)throw new Error(JSON.stringify({code:oo.INVALID_OPERATION,msg:"target:".concat(n," is not a function which is the only type supports hook")}));e.prototype[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.call.apply(r,no([this],e,!1)),o.call.apply(o,no([this],e,!1))}}(e,t)},e.prototype.registerComponent=function(t){ao(e,t)},e.prototype.registerVersion=function(e){!function(e){mo=e}(e),this.version=e},e.prototype.registerSdkName=function(e){!function(e){vo=e,function(e){n=e}(e)}(e)},e.prototype.registerEndPoint=function(e,t){Eo({baseUrl:e,protocol:t,env:this.config.env,endPointKey:"CLOUD_API"})},e.prototype.registerEndPointWithKey=function(e){Eo({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.getEndPointWithKey=function(e){var t=To(this.config.env,e);return{BASE_URL:t.baseUrl,PROTOCOL:t.protocol}},e.prototype.parseCaptcha=function(e){var t={},r=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){e=r[1];var n=r[2];n&&(t=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)})),t}(n))}var o=t.token,i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(t,["token"]);return/^data:/.test(e)&&!o?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:o?{state:i.state,token:o,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}},e.prototype.useDefaultAdapter=function(){var e={adapter:{type:"default",root:window,reqClass:_,wsClass:WebSocket,localStorage:localStorage},runtime:p.WEB},t=e.adapter,r=e.runtime;lo.adapter=t,lo.runtime=r},e.prototype.formatTimeout=function(e){switch(!0){case e>ai:return ni(ti.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),ai;case e<100:return ni(ti.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},Zo([oi({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ri)]}),ei("design:type",Function),ei("design:paramtypes",[Object]),ei("design:returntype",e)],e.prototype,"init",null),Zo([oi({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ri)]}),ei("design:type",Function),ei("design:paramtypes",[String,Object]),ei("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}(),ui=new li;ui.useAdapters(ro);var ci=ui},946:function(e,t){"use strict";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"},205:function(e,t){"use strict";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"}},794:function(e,t,r){"use strict";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(946),t),o(r(205),t),t.OATUH_LOGINTYPE="constants"},47:function(e){var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new I(n||[]);return o(a,"_invoke",{value:T(e,r,s)}),a}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var d="suspendedStart",h="suspendedYield",p="executing",b="completed",y={};function m(){}function v(){}function _(){}var g={};u(g,a,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(j([])));S&&S!==r&&n.call(S,a)&&(g=S);var O=_.prototype=m.prototype=Object.create(g);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function r(o,i,a,s){var l=f(e[o],e,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(c).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(l.arg)}var i;o(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function T(e,r,n){var o=d;return function(i,a){if(o===p)throw new Error("Generator is already running");if(o===b){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var l=R(s,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?b:h,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=b,n.method="throw",n.arg=u.arg)}}}function R(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function j(e){if(null!=e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return v.prototype=_,o(O,"constructor",{value:_,configurable:!0}),o(_,"constructor",{value:v,configurable:!0}),v.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,u(e,l,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},P(E.prototype),u(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(O),u(O,l,"Generator"),u(O,a,(function(){return this})),u(O,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=j,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return s.type="throw",s.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}},878:function(e){"use strict";e.exports={version:"3.0.0"}}},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}return r.d=function(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=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(47),r(23)}()}));
|