@cloudbase/js-sdk 2.23.2 → 2.23.4-alpha.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 o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},n=o(r(436)),i=o(r(878));n.default.registerVersion(i.default.version);try{window.cloudbase=n.default}catch(e){}t.default=n.default,e.exports=n.default},436:function(e,t,r){"use strict";r.r(t),r.d(t,{LANGS:function(){return Bn},cloudbase:function(){return ni},default:function(){return ii},getBaseEndPoint:function(){return jn}});var o="@cloudbase/js-sdk";function n(){return o}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 o=/\?/.test(t),n="";for(var i in r)""===n?!o&&(t+="?"):n+="&",n+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=n)?t:""+e+t}function c(e){return"[object FormData]"===Object.prototype.toString.call(e)}function d(e,t,r){void 0===r&&(r={});var o=/\?/.test(t),n="";return Object.keys(r).forEach((function(e){""===n?!o&&(t+="?"):n+="&",n+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=n)?t:"".concat(e).concat(t)}function f(e,t){console.warn("[".concat(n(),"][").concat(e,"]:").concat(t))}var p,h,b=(p=function(e,t){return p=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])},p(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}p(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,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},y.apply(this,arguments)},m=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},v=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=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,o=t.timeout,n=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=o||0,r.timeoutMsg=n||"请求超时",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,o=e.name,n=e.method,i=e.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==n?void 0:n.toLowerCase()]||"put",l=new FormData;return"post"===s?(Object.keys(t).forEach((function(e){l.append(e,t[e])})),l.append("key",o),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,o,n;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])),o=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(n=document.createElement("a")).href=r,n.setAttribute("download",o),n.style.display="none",document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r),document.body.removeChild(n),[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,o,n,i,a,s,l,u,c,d,f,p,h,b=this;return v(this,(function(_){switch(_.label){case 0:return r=new AbortController,o=e.url,n=e.enableAbort,i=void 0!==n&&n,a=e.stream,s=void 0!==a&&a,l=e.signal,u=e.timeout,c=e.shouldThrowOnError,d=void 0===c||c,f=null!=u?u:this.timeout,l&&(l.aborted&&r.abort(),l.addEventListener("abort",(function(){return r.abort()}))),p=null,i&&f&&(p=setTimeout((function(){console.warn(b.timeoutMsg),r.abort(new Error(b.timeoutMsg))}),f)),[4,fetch(o,y(y({},e),{signal:r.signal})).then((function(e){return m(b,void 0,void 0,(function(){var t,r,o;return v(this,(function(n){switch(n.label){case 0:return clearTimeout(p),d?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return o=(r=Promise).reject,[4,e.json()];case 2:t=o.apply(r,[n.sent()]),n.label=3;case 3:return[2,t];case 4:return[2,e]}}))}))})).catch((function(e){if(clearTimeout(p),d)return Promise.reject(e)}))];case 1:return h=_.sent(),[2,{data:s?h.body:(null===(t=h.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?h.json():h.text(),statusCode:h.status,header:h.headers}]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var o=String(e.method).toLowerCase()||"get";return new Promise((function(n){var i,s,l=e.url,u=e.headers,f=void 0===u?{}:u,p=e.data,h=e.responseType,b=e.withCredentials,y=e.body,m=e.onUploadProgress,v=d(a,l,"get"===o?p:{}),_=new XMLHttpRequest;_.open(o,v),h&&(_.responseType=h),Object.keys(f).forEach((function(e){_.setRequestHeader(e,f[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(": "),o=t.shift().toLowerCase(),n=t.join(": ");r[o]=n})),e.header=r,e.statusCode=_.status;try{e.data="blob"===h?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===h?_.response:_.responseText}clearTimeout(i),n(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=c(p)?p:"application/x-www-form-urlencoded"===f["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("&")}(p):y||(p?JSON.stringify(p):void 0),b&&(_.withCredentials=!0),_.send(s)}))},t}(l),g=function(){return g=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},g.apply(this,arguments)};!function(e){e.WEB="web",e.WX_MP="wx_mp"}(h||(h={}));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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),S=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},P=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},O=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(){})),T=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,o=void 0===r?{}:r,n=e.keys,i=void 0===n?{}:n;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(f(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new O(t.root));case"none":return new O(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 o={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(o))}catch(e){throw new Error(JSON.stringify({code:s.OPERATION_FAIL,msg:"[".concat(n(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:e}))}}else f(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 o;return P(this,(function(n){switch(n.label){case 0:if(!this.storage)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),o={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(o))];case 2:return n.sent(),[3,4];case 3:return n.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 o=this.storage.getItem(e);return o&&o.indexOf(t)>=0?JSON.parse(o).content:""}f(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 o;return P(this,(function(n){switch(n.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(o=n.sent())&&o.indexOf(t)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):f(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 P(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}(),E=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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),R=function(e,t){this.data=t||null,this.name=e},C=function(e){function t(t,r){var o=e.call(this,"error",{error:t,data:r})||this;return o.error=t,o}return E(t,e),t}(R),A=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 o=r[e].indexOf(t);-1!==o&&r[e].splice(o,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof C)return console.error(e.error),this;var r="string"==typeof e?new R(e,t||{}):e,o=r.name;if(this.listens(o)){r.target=this;for(var n=0,i=this.listeners[o]?function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}([],this.listeners[o],!0):[];n<i.length;n++)i[n].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new A;var j=new A,I="lang_change";function k(e){this.message=e}function q(e){this.message=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";var x=function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},L=s,W={};function M(e,t){var r=t.name,o=t.namespace,n=t.entity,i=t.injectEvents,a=t.IIFE,s=void 0!==a&&a;if(W[r]||o&&e[o])throw new Error(JSON.stringify({code:L.INVALID_OPERATION,msg:"Duplicate component ".concat(r)}));if(s){if(!n||"function"!=typeof n)throw new Error(JSON.stringify({code:L.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));n.call(e)}if(W[r]=t,o?e.prototype[o]=n:N(e.prototype,n),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=x(x([],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,o=Object.keys(this.events);r<o.length;r++){var n=o[r],i=this.events[n],a=i.bus;if(i.events.includes(e)){a.fire(e,t);break}}}}}function N(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,o=Object.keys(t);r<o.length;r++){var n=o[r];Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=N(e[n],t[n]))}return e}function F(){}function D(e){return"object"==typeof e&&null!==e||"function"==typeof e}const B=F;function z(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const U=Promise,$=Promise.resolve.bind(U),H=Promise.prototype.then,V=Promise.reject.bind(U),G=$;function Y(e){return new U(e)}function K(e){return Y((t=>t(e)))}function Q(e){return V(e)}function J(e,t,r){return H.call(e,t,r)}function X(e,t,r){J(J(e,t,r),void 0,B)}function Z(e,t){X(e,t)}function ee(e,t){X(e,void 0,t)}function te(e,t,r){return J(e,t,r)}function re(e){J(e,void 0,B)}let oe=e=>{if("function"==typeof queueMicrotask)oe=queueMicrotask;else{const e=K(void 0);oe=t=>J(e,t)}return oe(e)};function ne(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function ie(e,t,r){try{return K(ne(e,t,r))}catch(e){return Q(e)}}class ae{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 o=r+1;const n=e._elements,i=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,o=r._elements;for(;!(t===o.length&&void 0===r._next||t===o.length&&(r=r._next,o=r._elements,t=0,0===o.length));)e(o[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const se=Symbol("[[AbortSteps]]"),le=Symbol("[[ErrorSteps]]"),ue=Symbol("[[CancelSteps]]"),ce=Symbol("[[PullSteps]]"),de=Symbol("[[ReleaseSteps]]");function fe(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?ye(e):"closed"===t._state?function(e){ye(e),_e(e)}(e):me(e,t._storedError)}function pe(e,t){return So(e._ownerReadableStream,t)}function he(e){const t=e._ownerReadableStream;"readable"===t._state?ve(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){me(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[de](),t._reader=void 0,e._ownerReadableStream=void 0}function be(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ye(e){e._closedPromise=Y(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function me(e,t){ye(e),ve(e,t)}function ve(e,t){void 0!==e._closedPromise_reject&&(re(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function _e(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const ge=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},we=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Se(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function Pe(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function Oe(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function Te(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Ee(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Re(e){return Number(e)}function Ce(e){return 0===e?0:e}function Ae(e,t){const r=Number.MAX_SAFE_INTEGER;let o=Number(e);if(o=Ce(o),!ge(o))throw new TypeError(`${t} is not a finite number`);if(o=function(e){return Ce(we(e))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return ge(o)&&0!==o?o:0}function je(e,t){if(!go(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Ie(e){return new We(e)}function ke(e,t){e._reader._readRequests.push(t)}function qe(e,t,r){const o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function xe(e){return e._reader._readRequests.length}function Le(e){const t=e._reader;return void 0!==t&&!!Me(t)}class We{constructor(e){if(Te(e,1,"ReadableStreamDefaultReader"),je(e,"First parameter"),wo(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");fe(this,e),this._readRequests=new ae}get closed(){return Me(this)?this._closedPromise:Q(De("closed"))}cancel(e=void 0){return Me(this)?void 0===this._ownerReadableStream?Q(be("cancel")):pe(this,e):Q(De("cancel"))}read(){if(!Me(this))return Q(De("read"));if(void 0===this._ownerReadableStream)return Q(be("read from"));let e,t;const r=Y(((r,o)=>{e=r,t=o}));return Ne(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!Me(this))throw De("releaseLock");void 0!==this._ownerReadableStream&&function(e){he(e),Fe(e,new TypeError("Reader was released"))}(this)}}function Me(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof We}function Ne(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[ce](t)}function Fe(e,t){const r=e._readRequests;e._readRequests=new ae,r.forEach((e=>{e._errorSteps(t)}))}function De(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var Be,ze,Ue;function $e(e){return e.slice()}function He(e,t,r,o,n){new Uint8Array(e).set(new Uint8Array(r,o,n),t)}Object.defineProperties(We.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),z(We.prototype.cancel,"cancel"),z(We.prototype.read,"read"),z(We.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(We.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let Ve=e=>(Ve="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,Ve(e)),Ge=e=>(Ge="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,Ge(e));function Ye(e,t,r){if(e.slice)return e.slice(t,r);const o=r-t,n=new ArrayBuffer(o);return He(n,0,e,t,o),n}function Ke(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 Qe(e){try{const t=e.done,r=e.value;return J(G(r),(e=>({done:t,value:e})))}catch(e){return Q(e)}}const Je=null!==(Ue=null!==(Be=Symbol.asyncIterator)&&void 0!==Be?Be:null===(ze=Symbol.for)||void 0===ze?void 0:ze.call(Symbol,"Symbol.asyncIterator"))&&void 0!==Ue?Ue:"@@asyncIterator";function Xe(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=Ke(e,Je)))return function(e){const t={next(){let t;try{t=Ze(e)}catch(e){return Q(e)}return Qe(t)},return(t){let r;try{const o=Ke(e.iterator,"return");if(void 0===o)return K({done:!0,value:t});r=ne(o,e.iterator,[t])}catch(e){return Q(e)}return D(r)?Qe(r):Q(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(Xe(e,"sync",Ke(e,Symbol.iterator)))}else r=Ke(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const o=ne(r,e,[]);if(!D(o))throw new TypeError("The iterator method must return an object");return{iterator:o,nextMethod:o.next,done:!1}}function Ze(e){const t=ne(e.nextMethod,e.iterator,[]);if(!D(t))throw new TypeError("The iterator.next() method must return an object");return t}class et{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?te(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?te(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 o=Y(((e,o)=>{t=e,r=o}));return Ne(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,oe((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,he(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,he(e),r(t)}}),o}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=pe(t,e);return he(t),te(r,(()=>({value:e,done:!0})))}return he(t),K({value:e,done:!0})}}const tt={next(){return rt(this)?this._asyncIteratorImpl.next():Q(ot("next"))},return(e){return rt(this)?this._asyncIteratorImpl.return(e):Q(ot("return"))},[Je](){return this}};function rt(e){if(!D(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof et}catch(e){return!1}}function ot(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(tt,Je,{enumerable:!1});const nt=Number.isNaN||function(e){return e!=e};function it(e){const t=Ye(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function at(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function st(e,t,r){if("number"!=typeof(o=r)||nt(o)||o<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var o;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function lt(e){e._queue=new ae,e._queueTotalSize=0}function ut(e){return e===DataView}class ct{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!pt(this))throw Nt("view");return this._view}respond(e){if(!pt(this))throw Nt("respond");if(Te(e,1,"respond"),e=Ae(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ge(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Lt(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!pt(this))throw Nt("respondWithNewView");if(Te(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(Ge(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Wt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(ct.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),z(ct.prototype.respond,"respond"),z(ct.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ct.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class dt{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ft(this))throw Ft("byobRequest");return qt(this)}get desiredSize(){if(!ft(this))throw Ft("desiredSize");return xt(this)}close(){if(!ft(this))throw Ft("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`);At(this)}enqueue(e){if(!ft(this))throw Ft("enqueue");if(Te(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`);jt(this,e)}error(e=void 0){if(!ft(this))throw Ft("error");It(this,e)}[ue](e){bt(this),lt(this);const t=this._cancelAlgorithm(e);return Ct(this),t}[ce](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void kt(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let o;try{o=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const n={buffer:o,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(n)}ke(t,e),ht(this)}[de](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new ae,this._pendingPullIntos.push(e)}}}function ft(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof dt}function pt(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof ct}function ht(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Le(t)&&xe(t)>0)||(!!($t(t)&&Ut(t)>0)||xt(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,X(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ht(e)),null)),(t=>(It(e,t),null)))))}function bt(e){Ot(e),e._pendingPullIntos=new ae}function yt(e,t){let r=!1;"closed"===e._state&&(r=!0);const o=mt(t);"default"===t.readerType?qe(e,o,r):function(e,t,r){const o=e._reader._readIntoRequests.shift();r?o._closeSteps(t):o._chunkSteps(t)}(e,o,r)}function mt(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function vt(e,t,r,o){e._queue.push({buffer:t,byteOffset:r,byteLength:o}),e._queueTotalSize+=o}function _t(e,t,r,o){let n;try{n=Ye(t,r,r+o)}catch(t){throw It(e,t),t}vt(e,n,0,o)}function gt(e,t){t.bytesFilled>0&&_t(e,t.buffer,t.byteOffset,t.bytesFilled),Rt(e)}function wt(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),o=t.bytesFilled+r;let n=r,i=!1;const a=o-o%t.elementSize;a>=t.minimumFill&&(n=a-t.bytesFilled,i=!0);const s=e._queue;for(;n>0;){const r=s.peek(),o=Math.min(n,r.byteLength),i=t.byteOffset+t.bytesFilled;He(t.buffer,i,r.buffer,r.byteOffset,o),r.byteLength===o?s.shift():(r.byteOffset+=o,r.byteLength-=o),e._queueTotalSize-=o,St(0,o,t),n-=o}return i}function St(e,t,r){r.bytesFilled+=t}function Pt(e){0===e._queueTotalSize&&e._closeRequested?(Ct(e),Po(e._controlledReadableByteStream)):ht(e)}function Ot(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Tt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();wt(e,t)&&(Rt(e),yt(e._controlledReadableByteStream,t))}}function Et(e,t){const r=e._pendingPullIntos.peek();Ot(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Rt(e);const r=e._controlledReadableByteStream;if($t(r))for(;Ut(r)>0;)yt(r,Rt(e))}(e,r):function(e,t,r){if(St(0,t,r),"none"===r.readerType)return gt(e,r),void Tt(e);if(r.bytesFilled<r.minimumFill)return;Rt(e);const o=r.bytesFilled%r.elementSize;if(o>0){const t=r.byteOffset+r.bytesFilled;_t(e,r.buffer,t-o,o)}r.bytesFilled-=o,yt(e._controlledReadableByteStream,r),Tt(e)}(e,t,r),ht(e)}function Rt(e){return e._pendingPullIntos.shift()}function Ct(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function At(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 It(e,t),t}}Ct(e),Po(t)}}function jt(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:o,byteOffset:n,byteLength:i}=t;if(Ge(o))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=Ve(o);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(Ge(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Ot(e),t.buffer=Ve(t.buffer),"none"===t.readerType&>(e,t)}Le(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;kt(e,t._readRequests.shift())}}(e),0===xe(r)?vt(e,a,n,i):(e._pendingPullIntos.length>0&&Rt(e),qe(r,new Uint8Array(a,n,i),!1))):$t(r)?(vt(e,a,n,i),Tt(e)):vt(e,a,n,i),ht(e)}function It(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(bt(e),lt(e),Ct(e),Oo(r,t))}function kt(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,Pt(e);const o=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(o)}function qt(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),o=Object.create(ct.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(o,e,r),e._byobRequest=o}return e._byobRequest}function xt(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Lt(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=Ve(r.buffer),Et(e,t)}function Wt(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 o=t.byteLength;r.buffer=Ve(t.buffer),Et(e,o)}function Mt(e,t,r,o,n,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,lt(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=o,t._cancelAlgorithm=n,t._autoAllocateChunkSize=a,t._pendingPullIntos=new ae,e._readableStreamController=t,X(K(r()),(()=>(t._started=!0,ht(t),null)),(e=>(It(t,e),null)))}function Nt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Ft(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Dt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Bt(e){return new Ht(e)}function zt(e,t){e._reader._readIntoRequests.push(t)}function Ut(e){return e._reader._readIntoRequests.length}function $t(e){const t=e._reader;return void 0!==t&&!!Vt(t)}Object.defineProperties(dt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),z(dt.prototype.close,"close"),z(dt.prototype.enqueue,"enqueue"),z(dt.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(dt.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Ht{constructor(e){if(Te(e,1,"ReadableStreamBYOBReader"),je(e,"First parameter"),wo(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ft(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");fe(this,e),this._readIntoRequests=new ae}get closed(){return Vt(this)?this._closedPromise:Q(Kt("closed"))}cancel(e=void 0){return Vt(this)?void 0===this._ownerReadableStream?Q(be("cancel")):pe(this,e):Q(Kt("cancel"))}read(e,t={}){if(!Vt(this))return Q(Kt("read"));if(!ArrayBuffer.isView(e))return Q(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return Q(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return Q(new TypeError("view's buffer must have non-zero byteLength"));if(Ge(e.buffer))return Q(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return Se(e,t),{min:Ae(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return Q(e)}const o=r.min;if(0===o)return Q(new TypeError("options.min must be greater than 0"));if(function(e){return ut(e.constructor)}(e)){if(o>e.byteLength)return Q(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(o>e.length)return Q(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return Q(be("read from"));let n,i;const a=Y(((e,t)=>{n=e,i=t}));return Gt(this,e,o,{_chunkSteps:e=>n({value:e,done:!1}),_closeSteps:e=>n({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!Vt(this))throw Kt("releaseLock");void 0!==this._ownerReadableStream&&function(e){he(e),Yt(e,new TypeError("Reader was released"))}(this)}}function Vt(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Ht}function Gt(e,t,r,o){const n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?o._errorSteps(n._storedError):function(e,t,r,o){const n=e._controlledReadableByteStream,i=t.constructor,a=function(e){return ut(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:l}=t,u=r*a;let c;try{c=Ve(t.buffer)}catch(e){return void o._errorSteps(e)}const d={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(d),void zt(n,o);if("closed"!==n._state){if(e._queueTotalSize>0){if(wt(e,d)){const t=mt(d);return Pt(e),void o._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return It(e,t),void o._errorSteps(t)}}e._pendingPullIntos.push(d),zt(n,o),ht(e)}else{const e=new i(d.buffer,d.byteOffset,0);o._closeSteps(e)}}(n._readableStreamController,t,r,o)}function Yt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new ae,r.forEach((e=>{e._errorSteps(t)}))}function Kt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Qt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(nt(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Jt(e){const{size:t}=e;return t||(()=>1)}function Xt(e,t){Se(e,t);const r=null==e?void 0:e.highWaterMark,o=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Re(r),size:void 0===o?void 0:Zt(o,`${t} has member 'size' that`)}}function Zt(e,t){return Pe(e,t),t=>Re(e(t))}function er(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function tr(e,t,r){return Pe(e,r),()=>ie(e,t,[])}function rr(e,t,r){return Pe(e,r),r=>ne(e,t,[r])}function or(e,t,r){return Pe(e,r),(r,o)=>ie(e,t,[r,o])}function nr(e,t){if(!ur(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Ht.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),z(Ht.prototype.cancel,"cancel"),z(Ht.prototype.read,"read"),z(Ht.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ht.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const ir="function"==typeof AbortController;class ar{constructor(e={},t={}){void 0===e?e=null:Oe(e,"First parameter");const r=Xt(t,"Second parameter"),o=function(e,t){Se(e,t);const r=null==e?void 0:e.abort,o=null==e?void 0:e.close,n=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:er(r,e,`${t} has member 'abort' that`),close:void 0===o?void 0:tr(o,e,`${t} has member 'close' that`),start:void 0===n?void 0:rr(n,e,`${t} has member 'start' that`),write:void 0===a?void 0:or(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(lr(this),void 0!==o.type)throw new RangeError("Invalid type is specified");const n=Jt(r);!function(e,t,r,o){const n=Object.create(Er.prototype);let i,a,s,l;i=void 0!==t.start?()=>t.start(n):()=>{},a=void 0!==t.write?e=>t.write(e,n):()=>K(void 0),s=void 0!==t.close?()=>t.close():()=>K(void 0),l=void 0!==t.abort?e=>t.abort(e):()=>K(void 0),Cr(e,n,i,a,s,l,r,o)}(this,o,Qt(r,1),n)}get locked(){if(!ur(this))throw Lr("locked");return cr(this)}abort(e=void 0){return ur(this)?cr(this)?Q(new TypeError("Cannot abort a stream that already has a writer")):dr(this,e):Q(Lr("abort"))}close(){return ur(this)?cr(this)?Q(new TypeError("Cannot close a stream that already has a writer")):yr(this)?Q(new TypeError("Cannot close an already-closing stream")):fr(this):Q(Lr("close"))}getWriter(){if(!ur(this))throw Lr("getWriter");return sr(this)}}function sr(e){return new _r(e)}function lr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ae,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function ur(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof ar}function cr(e){return void 0!==e._writer}function dr(e,t){var r;if("closed"===e._state||"errored"===e._state)return K(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const o=e._state;if("closed"===o||"errored"===o)return K(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let n=!1;"erroring"===o&&(n=!0,t=void 0);const i=Y(((r,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:o,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||hr(e,t),i}function fr(e){const t=e._state;if("closed"===t||"errored"===t)return Q(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=Y(((t,r)=>{const o={_resolve:t,_reject:r};e._closeRequest=o})),o=e._writer;var n;return void 0!==o&&e._backpressure&&"writable"===t&&Gr(o),st(n=e._writableStreamController,Tr,0),Ir(n),r}function pr(e,t){"writable"!==e._state?br(e):hr(e,t)}function hr(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const o=e._writer;void 0!==o&&Sr(o,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&br(e)}function br(e){e._state="errored",e._writableStreamController[le]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new ae,void 0===e._pendingAbortRequest)return void mr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void mr(e);X(e._writableStreamController[se](r._reason),(()=>(r._resolve(),mr(e),null)),(t=>(r._reject(t),mr(e),null)))}function yr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function mr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Br(t,e._storedError)}function vr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Ur(e)}(r):Gr(r)),e._backpressure=t}Object.defineProperties(ar.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),z(ar.prototype.abort,"abort"),z(ar.prototype.close,"close"),z(ar.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ar.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class _r{constructor(e){if(Te(e,1,"WritableStreamDefaultWriter"),nr(e,"First parameter"),cr(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)!yr(e)&&e._backpressure?Ur(this):Hr(this),Fr(this);else if("erroring"===t)$r(this,e._storedError),Fr(this);else if("closed"===t)Hr(this),Fr(this),zr(this);else{const t=e._storedError;$r(this,t),Dr(this,t)}}get closed(){return gr(this)?this._closedPromise:Q(Mr("closed"))}get desiredSize(){if(!gr(this))throw Mr("desiredSize");if(void 0===this._ownerWritableStream)throw Nr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:jr(t._writableStreamController)}(this)}get ready(){return gr(this)?this._readyPromise:Q(Mr("ready"))}abort(e=void 0){return gr(this)?void 0===this._ownerWritableStream?Q(Nr("abort")):function(e,t){return dr(e._ownerWritableStream,t)}(this,e):Q(Mr("abort"))}close(){if(!gr(this))return Q(Mr("close"));const e=this._ownerWritableStream;return void 0===e?Q(Nr("close")):yr(e)?Q(new TypeError("Cannot close an already-closing stream")):wr(this)}releaseLock(){if(!gr(this))throw Mr("releaseLock");void 0!==this._ownerWritableStream&&Pr(this)}write(e=void 0){return gr(this)?void 0===this._ownerWritableStream?Q(Nr("write to")):Or(this,e):Q(Mr("write"))}}function gr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof _r}function wr(e){return fr(e._ownerWritableStream)}function Sr(e,t){"pending"===e._readyPromiseState?Vr(e,t):function(e,t){$r(e,t)}(e,t)}function Pr(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Sr(e,r),function(e,t){"pending"===e._closedPromiseState?Br(e,t):function(e,t){Dr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Or(e,t){const r=e._ownerWritableStream,o=r._writableStreamController,n=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return kr(e,t),1}}(o,t);if(r!==e._ownerWritableStream)return Q(Nr("write to"));const i=r._state;if("errored"===i)return Q(r._storedError);if(yr(r)||"closed"===i)return Q(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return Q(r._storedError);const a=function(e){return Y(((t,r)=>{const o={_resolve:t,_reject:r};e._writeRequests.push(o)}))}(r);return function(e,t,r){try{st(e,t,r)}catch(t){return void kr(e,t)}const o=e._controlledWritableStream;yr(o)||"writable"!==o._state||vr(o,qr(e)),Ir(e)}(o,t,n),a}Object.defineProperties(_r.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),z(_r.prototype.abort,"abort"),z(_r.prototype.close,"close"),z(_r.prototype.releaseLock,"releaseLock"),z(_r.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(_r.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Tr={};class Er{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Rr(this))throw Wr("abortReason");return this._abortReason}get signal(){if(!Rr(this))throw Wr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Rr(this))throw Wr("error");"writable"===this._controlledWritableStream._state&&xr(this,e)}[se](e){const t=this._abortAlgorithm(e);return Ar(this),t}[le](){lt(this)}}function Rr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Er}function Cr(e,t,r,o,n,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,lt(t),t._abortReason=void 0,t._abortController=function(){if(ir)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=o,t._closeAlgorithm=n,t._abortAlgorithm=i;const l=qr(t);vr(e,l),X(K(r()),(()=>(t._started=!0,Ir(t),null)),(r=>(t._started=!0,pr(e,r),null)))}function Ar(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function jr(e){return e._strategyHWM-e._queueTotalSize}function Ir(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void br(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Tr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),at(e);const r=e._closeAlgorithm();Ar(e),X(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&&zr(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),pr(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),X(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(at(e),!yr(r)&&"writable"===t){const t=qr(e);vr(r,t)}return Ir(e),null}),(t=>("writable"===r._state&&Ar(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,pr(e,t)}(r,t),null)))}(e,r)}function kr(e,t){"writable"===e._controlledWritableStream._state&&xr(e,t)}function qr(e){return jr(e)<=0}function xr(e,t){const r=e._controlledWritableStream;Ar(e),hr(r,t)}function Lr(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Wr(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function Mr(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Nr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Fr(e){e._closedPromise=Y(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function Dr(e,t){Fr(e),Br(e,t)}function Br(e,t){void 0!==e._closedPromise_reject&&(re(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function zr(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 Ur(e){e._readyPromise=Y(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function $r(e,t){Ur(e),Vr(e,t)}function Hr(e){Ur(e),Gr(e)}function Vr(e,t){void 0!==e._readyPromise_reject&&(re(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Gr(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(Er.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Er.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const Yr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,Kr=function(){const e=null==Yr?void 0:Yr.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 z(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Qr(e,t,r,o,n,i){const a=Ie(e),s=sr(t);e._disturbed=!0;let l=!1,u=K(void 0);return Y(((c,d)=>{let f;if(void 0!==i){if(f=()=>{const r=void 0!==i.reason?i.reason:new Kr("Aborted","AbortError"),a=[];o||a.push((()=>"writable"===t._state?dr(t,r):K(void 0))),n||a.push((()=>"readable"===e._state?So(e,r):K(void 0))),v((()=>Promise.all(a.map((e=>e())))),!0,r)},i.aborted)return void f();i.addEventListener("abort",f)}var p,h,b;if(m(e,a._closedPromise,(e=>(o?_(!0,e):v((()=>dr(t,e)),!0,e),null))),m(t,s._closedPromise,(t=>(n?_(!0,t):v((()=>So(e,t)),!0,t),null))),p=e,h=a._closedPromise,b=()=>(r?_():v((()=>function(e){const t=e._ownerWritableStream,r=t._state;return yr(t)||"closed"===r?K(void 0):"errored"===r?Q(t._storedError):wr(e)}(s))),null),"closed"===p._state?b():Z(h,b),yr(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");n?_(!0,t):v((()=>So(e,t)),!0,t)}function y(){const e=u;return J(u,(()=>e!==u?y():void 0))}function m(e,t,r){"errored"===e._state?r(e._storedError):ee(t,r)}function v(e,r,o){function n(){return X(e(),(()=>g(r,o)),(e=>g(!0,e))),null}l||(l=!0,"writable"!==t._state||yr(t)?n():Z(y(),n))}function _(e,r){l||(l=!0,"writable"!==t._state||yr(t)?g(e,r):Z(y(),(()=>g(e,r))))}function g(e,t){return Pr(s),he(a),void 0!==i&&i.removeEventListener("abort",f),e?d(t):c(void 0),null}re(Y(((e,t)=>{!function r(o){o?e():J(l?K(!0):J(s._readyPromise,(()=>Y(((e,t)=>{Ne(a,{_chunkSteps:t=>{u=J(Or(s,t),void 0,F),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class Jr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Xr(this))throw lo("desiredSize");return io(this)}close(){if(!Xr(this))throw lo("close");if(!ao(this))throw new TypeError("The stream is not in a state that permits close");ro(this)}enqueue(e=void 0){if(!Xr(this))throw lo("enqueue");if(!ao(this))throw new TypeError("The stream is not in a state that permits enqueue");return oo(this,e)}error(e=void 0){if(!Xr(this))throw lo("error");no(this,e)}[ue](e){lt(this);const t=this._cancelAlgorithm(e);return to(this),t}[ce](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=at(this);this._closeRequested&&0===this._queue.length?(to(this),Po(t)):Zr(this),e._chunkSteps(r)}else ke(t,e),Zr(this)}[de](){}}function Xr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Jr}function Zr(e){eo(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,X(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Zr(e)),null)),(t=>(no(e,t),null)))))}function eo(e){const t=e._controlledReadableStream;return!!ao(e)&&!!e._started&&(!!(wo(t)&&xe(t)>0)||io(e)>0)}function to(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function ro(e){if(!ao(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(to(e),Po(t))}function oo(e,t){if(!ao(e))return;const r=e._controlledReadableStream;if(wo(r)&&xe(r)>0)qe(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw no(e,t),t}try{st(e,t,r)}catch(t){throw no(e,t),t}}Zr(e)}function no(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(lt(e),to(e),Oo(r,t))}function io(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function ao(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function so(e,t,r,o,n,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,lt(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=o,t._cancelAlgorithm=n,e._readableStreamController=t,X(K(r()),(()=>(t._started=!0,Zr(t),null)),(e=>(no(t,e),null)))}function lo(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function uo(e){return D(t=e)&&void 0!==t.getReader?function(e){let t;return t=mo(F,(function(){let r;try{r=e.read()}catch(r){return Q(r)}return te(r,(e=>{if(!D(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)ro(t._readableStreamController);else{const r=e.value;oo(t._readableStreamController,r)}}))}),(function(t){try{return K(e.cancel(t))}catch(t){return Q(t)}}),0),t}(e.getReader()):function(e){let t;const r=Xe(e,"async");return t=mo(F,(function(){let e;try{e=Ze(r)}catch(e){return Q(e)}return te(K(e),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)ro(t._readableStreamController);else{const r=e.value;oo(t._readableStreamController,r)}}))}),(function(e){const t=r.iterator;let o;try{o=Ke(t,"return")}catch(e){return Q(e)}return void 0===o?K(void 0):te(ie(o,t,[e]),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}))}),0),t}(e);var t}function co(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function fo(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function po(e,t,r){return Pe(e,r),r=>ne(e,t,[r])}function ho(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function bo(e,t){Se(e,t);const r=null==e?void 0:e.preventAbort,o=null==e?void 0:e.preventCancel,n=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(o),preventClose:Boolean(n),signal:i}}Object.defineProperties(Jr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),z(Jr.prototype.close,"close"),z(Jr.prototype.enqueue,"enqueue"),z(Jr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Jr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class yo{constructor(e={},t={}){void 0===e?e=null:Oe(e,"First parameter");const r=Xt(t,"Second parameter"),o=function(e,t){Se(e,t);const r=e,o=null==r?void 0:r.autoAllocateChunkSize,n=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===o?void 0:Ae(o,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===n?void 0:co(n,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:fo(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:po(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:ho(s,`${t} has member 'type' that`)}}(e,"First parameter");if(_o(this),"bytes"===o.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 o=Object.create(dt.prototype);let n,i,a;n=void 0!==t.start?()=>t.start(o):()=>{},i=void 0!==t.pull?()=>t.pull(o):()=>K(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>K(void 0);const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");Mt(e,o,n,i,a,r,s)}(this,o,Qt(r,0))}else{const e=Jt(r);!function(e,t,r,o){const n=Object.create(Jr.prototype);let i,a,s;i=void 0!==t.start?()=>t.start(n):()=>{},a=void 0!==t.pull?()=>t.pull(n):()=>K(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>K(void 0),so(e,n,i,a,s,r,o)}(this,o,Qt(r,1),e)}}get locked(){if(!go(this))throw To("locked");return wo(this)}cancel(e=void 0){return go(this)?wo(this)?Q(new TypeError("Cannot cancel a stream that already has a reader")):So(this,e):Q(To("cancel"))}getReader(e=void 0){if(!go(this))throw To("getReader");return void 0===function(e,t){Se(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Dt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Ie(this):Bt(this)}pipeThrough(e,t={}){if(!go(this))throw To("pipeThrough");Te(e,1,"pipeThrough");const r=function(e,t){Se(e,t);const r=null==e?void 0:e.readable;Ee(r,"readable","ReadableWritablePair"),je(r,`${t} has member 'readable' that`);const o=null==e?void 0:e.writable;return Ee(o,"writable","ReadableWritablePair"),nr(o,`${t} has member 'writable' that`),{readable:r,writable:o}}(e,"First parameter"),o=bo(t,"Second parameter");if(wo(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(cr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return re(Qr(this,r.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal)),r.readable}pipeTo(e,t={}){if(!go(this))return Q(To("pipeTo"));if(void 0===e)return Q("Parameter 1 is required in 'pipeTo'.");if(!ur(e))return Q(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=bo(t,"Second parameter")}catch(e){return Q(e)}return wo(this)?Q(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):cr(e)?Q(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Qr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!go(this))throw To("tee");return $e(function(e){return ft(e._readableStreamController)?function(e){let t,r,o,n,i,a=Ie(e),s=!1,l=!1,u=!1,c=!1,d=!1;const f=Y((e=>{i=e}));function p(e){ee(e._closedPromise,(t=>(e!==a||(It(o._readableStreamController,t),It(n._readableStreamController,t),c&&d||i(void 0)),null)))}function h(){Vt(a)&&(he(a),a=Ie(e),p(a)),Ne(a,{_chunkSteps:t=>{oe((()=>{l=!1,u=!1;const r=t;let a=t;if(!c&&!d)try{a=it(t)}catch(t){return It(o._readableStreamController,t),It(n._readableStreamController,t),void i(So(e,t))}c||jt(o._readableStreamController,r),d||jt(n._readableStreamController,a),s=!1,l?y():u&&m()}))},_closeSteps:()=>{s=!1,c||At(o._readableStreamController),d||At(n._readableStreamController),o._readableStreamController._pendingPullIntos.length>0&&Lt(o._readableStreamController,0),n._readableStreamController._pendingPullIntos.length>0&&Lt(n._readableStreamController,0),c&&d||i(void 0)},_errorSteps:()=>{s=!1}})}function b(t,r){Me(a)&&(he(a),a=Bt(e),p(a));const f=r?n:o,h=r?o:n;Gt(a,t,1,{_chunkSteps:t=>{oe((()=>{l=!1,u=!1;const o=r?d:c;if(r?c:d)o||Wt(f._readableStreamController,t);else{let r;try{r=it(t)}catch(t){return It(f._readableStreamController,t),It(h._readableStreamController,t),void i(So(e,t))}o||Wt(f._readableStreamController,t),jt(h._readableStreamController,r)}s=!1,l?y():u&&m()}))},_closeSteps:e=>{s=!1;const t=r?d:c,o=r?c:d;t||At(f._readableStreamController),o||At(h._readableStreamController),void 0!==e&&(t||Wt(f._readableStreamController,e),!o&&h._readableStreamController._pendingPullIntos.length>0&&Lt(h._readableStreamController,0)),t&&o||i(void 0)},_errorSteps:()=>{s=!1}})}function y(){if(s)return l=!0,K(void 0);s=!0;const e=qt(o._readableStreamController);return null===e?h():b(e._view,!1),K(void 0)}function m(){if(s)return u=!0,K(void 0);s=!0;const e=qt(n._readableStreamController);return null===e?h():b(e._view,!0),K(void 0)}function v(){}return o=vo(v,y,(function(o){if(c=!0,t=o,d){const o=$e([t,r]),n=So(e,o);i(n)}return f})),n=vo(v,m,(function(o){if(d=!0,r=o,c){const o=$e([t,r]),n=So(e,o);i(n)}return f})),p(a),[o,n]}(e):function(e){const t=Ie(e);let r,o,n,i,a,s=!1,l=!1,u=!1,c=!1;const d=Y((e=>{a=e}));function f(){return s?(l=!0,K(void 0)):(s=!0,Ne(t,{_chunkSteps:e=>{oe((()=>{l=!1;const t=e,r=e;u||oo(n._readableStreamController,t),c||oo(i._readableStreamController,r),s=!1,l&&f()}))},_closeSteps:()=>{s=!1,u||ro(n._readableStreamController),c||ro(i._readableStreamController),u&&c||a(void 0)},_errorSteps:()=>{s=!1}}),K(void 0))}function p(){}return n=mo(p,f,(function(t){if(u=!0,r=t,c){const t=$e([r,o]),n=So(e,t);a(n)}return d})),i=mo(p,f,(function(t){if(c=!0,o=t,u){const t=$e([r,o]),n=So(e,t);a(n)}return d})),ee(t._closedPromise,(e=>(no(n._readableStreamController,e),no(i._readableStreamController,e),u&&c||a(void 0),null))),[n,i]}(e)}(this))}values(e=void 0){if(!go(this))throw To("values");return function(e,t){const r=Ie(e),o=new et(r,t),n=Object.create(tt);return n._asyncIteratorImpl=o,n}(this,function(e){Se(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[Je](e){return this.values(e)}static from(e){return uo(e)}}function mo(e,t,r,o=1,n=()=>1){const i=Object.create(yo.prototype);return _o(i),so(i,Object.create(Jr.prototype),e,t,r,o,n),i}function vo(e,t,r){const o=Object.create(yo.prototype);return _o(o),Mt(o,Object.create(dt.prototype),e,t,r,0,void 0),o}function _o(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function go(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof yo}function wo(e){return void 0!==e._reader}function So(e,t){if(e._disturbed=!0,"closed"===e._state)return K(void 0);if("errored"===e._state)return Q(e._storedError);Po(e);const r=e._reader;if(void 0!==r&&Vt(r)){const e=r._readIntoRequests;r._readIntoRequests=new ae,e.forEach((e=>{e._closeSteps(void 0)}))}return te(e._readableStreamController[ue](t),F)}function Po(e){e._state="closed";const t=e._reader;if(void 0!==t&&(_e(t),Me(t))){const e=t._readRequests;t._readRequests=new ae,e.forEach((e=>{e._closeSteps()}))}}function Oo(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(ve(r,t),Me(r)?Fe(r,t):Yt(r,t))}function To(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Eo(e,t){Se(e,t);const r=null==e?void 0:e.highWaterMark;return Ee(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Re(r)}}Object.defineProperties(yo,{from:{enumerable:!0}}),Object.defineProperties(yo.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),z(yo.from,"from"),z(yo.prototype.cancel,"cancel"),z(yo.prototype.getReader,"getReader"),z(yo.prototype.pipeThrough,"pipeThrough"),z(yo.prototype.pipeTo,"pipeTo"),z(yo.prototype.tee,"tee"),z(yo.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(yo.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(yo.prototype,Je,{value:yo.prototype.values,writable:!0,configurable:!0});const Ro=e=>e.byteLength;z(Ro,"size");class Co{constructor(e){Te(e,1,"ByteLengthQueuingStrategy"),e=Eo(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!jo(this))throw Ao("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!jo(this))throw Ao("size");return Ro}}function Ao(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function jo(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Co}Object.defineProperties(Co.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Co.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Io=()=>1;z(Io,"size");class ko{constructor(e){Te(e,1,"CountQueuingStrategy"),e=Eo(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!xo(this))throw qo("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!xo(this))throw qo("size");return Io}}function qo(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function xo(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof ko}function Lo(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function Wo(e,t,r){return Pe(e,r),r=>ne(e,t,[r])}function Mo(e,t,r){return Pe(e,r),(r,o)=>ie(e,t,[r,o])}function No(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}Object.defineProperties(ko.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ko.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Fo{constructor(e={},t={},r={}){void 0===e&&(e=null);const o=Xt(t,"Second parameter"),n=Xt(r,"Third parameter"),i=function(e,t){Se(e,t);const r=null==e?void 0:e.cancel,o=null==e?void 0:e.flush,n=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:No(r,e,`${t} has member 'cancel' that`),flush:void 0===o?void 0:Lo(o,e,`${t} has member 'flush' that`),readableType:n,start:void 0===i?void 0:Wo(i,e,`${t} has member 'start' that`),transform:void 0===a?void 0:Mo(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=Qt(n,0),s=Jt(n),l=Qt(o,1),u=Jt(o);let c;!function(e,t,r,o,n,i){function a(){return t}e._writable=function(e,t,r,o,n=1,i=()=>1){const a=Object.create(ar.prototype);return lr(a),Cr(a,Object.create(Er.prototype),e,t,r,o,n,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?te(e._backpressureChangePromise,(()=>{const o=e._writable;if("erroring"===o._state)throw o._storedError;return Ko(r,t)})):Ko(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=Y(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const o=t._flushAlgorithm();return Go(t),X(o,(()=>("errored"===r._state?Xo(t,r._storedError):(ro(r._readableStreamController),Jo(t)),null)),(e=>(no(r._readableStreamController,e),Xo(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 o=e._readable;r._finishPromise=Y(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const n=r._cancelAlgorithm(t);return Go(r),X(n,(()=>("errored"===o._state?Xo(r,o._storedError):(no(o._readableStreamController,t),Jo(r)),null)),(e=>(no(o._readableStreamController,e),Xo(r,e),null))),r._finishPromise}(e,t)}),r,o),e._readable=mo(a,(function(){return function(e){return $o(e,!1),e._backpressureChangePromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const o=e._writable;r._finishPromise=Y(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const n=r._cancelAlgorithm(t);return Go(r),X(n,(()=>("errored"===o._state?Xo(r,o._storedError):(kr(o._writableStreamController,t),Uo(e),Jo(r)),null)),(t=>(kr(o._writableStreamController,t),Uo(e),Xo(r,t),null))),r._finishPromise}(e,t)}),n,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,$o(e,!0),e._transformStreamController=void 0}(this,Y((e=>{c=e})),l,u,a,s),function(e,t){const r=Object.create(Ho.prototype);let o,n,i;o=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return Yo(r,e),K(void 0)}catch(e){return Q(e)}},n=void 0!==t.flush?()=>t.flush(r):()=>K(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>K(void 0),function(e,t,r,o,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=o,t._cancelAlgorithm=n,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,o,n,i)}(this,i),void 0!==i.start?c(i.start(this._transformStreamController)):c(void 0)}get readable(){if(!Do(this))throw Zo("readable");return this._readable}get writable(){if(!Do(this))throw Zo("writable");return this._writable}}function Do(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof Fo}function Bo(e,t){no(e._readable._readableStreamController,t),zo(e,t)}function zo(e,t){Go(e._transformStreamController),kr(e._writable._writableStreamController,t),Uo(e)}function Uo(e){e._backpressure&&$o(e,!1)}function $o(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Y((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(Fo.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Fo.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class Ho{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Vo(this))throw Qo("desiredSize");return io(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Vo(this))throw Qo("enqueue");Yo(this,e)}error(e=void 0){if(!Vo(this))throw Qo("error");var t;t=e,Bo(this._controlledTransformStream,t)}terminate(){if(!Vo(this))throw Qo("terminate");!function(e){const t=e._controlledTransformStream;ro(t._readable._readableStreamController),zo(t,new TypeError("TransformStream terminated"))}(this)}}function Vo(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Ho}function Go(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Yo(e,t){const r=e._controlledTransformStream,o=r._readable._readableStreamController;if(!ao(o))throw new TypeError("Readable side is not in a state that permits enqueue");try{oo(o,t)}catch(e){throw zo(r,e),r._readable._storedError}const n=function(e){return!eo(e)}(o);n!==r._backpressure&&$o(r,!0)}function Ko(e,t){return te(e._transformAlgorithm(t),void 0,(t=>{throw Bo(e._controlledTransformStream,t),t}))}function Qo(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Jo(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Xo(e,t){void 0!==e._finishPromise_reject&&(re(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Zo(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Ho.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),z(Ho.prototype.enqueue,"enqueue"),z(Ho.prototype.error,"error"),z(Ho.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ho.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var en,tn=(en=function(e,t){return en=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])},en(e,t)},function(e,t){function r(){this.constructor=e}en(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),rn=function(){return rn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},rn.apply(this,arguments)},on="Error when aborting requestTask",nn=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,o=t.timeout,n=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=o||0,r._timeoutMsg=n||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return tn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,o){var n=e.url,i=e.data,a=e.headers,s=wx.request({url:u("https:",n),data:i,timeout:t._timeout,method:"POST",header:a,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):o(e)},fail:function(e){o(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.get=function(e){var t=this;return new Promise((function(r,o){var n=e.url,i=e.body,a=e.headers,s=u("https:",n),l=wx.request({url:s,data:i,timeout:t._timeout,method:"GET",header:a,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):o(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("get")&&e.errMsg.includes("timeout")){console.warn(t._timeoutMsg);try{l.abort()}catch(e){console.warn(on,e)}}}})}))},t.prototype.upload=function(e){var t=this,r=this;return new Promise((function(o){return function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var t,n,i,a,s,l;return function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{r=n=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,n=e.file,i=e.data,a=e.headers,s=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:n,name:"file",formData:rn({},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)),o(t)},fail:function(e){o(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(o,n){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?o({statusCode:200,tempFilePath:e.tempFilePath}):o(e)},fail:function(e){n(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,o=e.enableAbort,n=e.headers,i=e.method,a=e.stream,s=void 0!==a&&a,l=e.signal,c=e.timeout,d=this,f=null!=c?c:this._timeout,p=null,h=new yo({start:function(e){p=e},cancel:function(){p=null}});return new Promise((function(e,a){s&&e({data:h});var c=wx.request({url:u("https:",t),data:r,timeout:f,method:i.toUpperCase(),header:n,success:function(t){var r;null===(r=p)||void 0===r||r.close(),!s&&e(t)},fail:function(e){var t;if(null===(t=p)||void 0===t||t.close(),a(e),s)throw e},complete:function(e){if(e&&e.errMsg&&f&&-1!==d._restrictedMethods.indexOf("post")&&o&&"request:fail timeout"===e.errMsg){console.warn(d._timeoutMsg);try{c.abort()}catch(e){console.warn(on,e)}}},enableChunked:s});if(c.onChunkReceived((function(e){var t;null===(t=p)||void 0===t||t.enqueue(new Uint8Array(e.data))})),l){var b=function(){try{c.abort()}catch(e){console.warn(on,e)}};l.aborted?b():l.addEventListener("abort",(function(){return b()}))}}))},t}(l),an={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()}},sn=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(rn({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}};function ln(e){var t={},r=e.replace(/^[?#]/,"");return r?(r.split("&").forEach((function(e){var r=e.split("="),o=r[0],n=r[1];o=decodeURIComponent(o),n=decodeURIComponent(n),o&&(t[o]?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n)})),t):t}var un={genAdapter:function(e){return{root:{globalThis:{}},reqClass:nn,wsClass:sn,captchaOptions:{openURIWithCallback:function(t){var r=e.EventBus,o={},n=t;console.log("openURIWithCallback",t);var i=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){n=i[1],console.log("openURIWithCallback url",n);var a=i[2];a&&(o=ln(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,l=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(o,["token"]);return/^data:/.test(n)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: "+t}):s?new Promise((function(e){console.log("wait for captcha..."),r.$emit("CAPTCHA_DATA_CHANGE",rn(rn({},l),{token:s,url:n})),r.$once("RESOLVE_CAPTCHA_DATA",(function(t){e(t)}))})):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:an,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"},cn=function(){return cn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},cn.apply(this,arguments)},dn={},fn=function(){return fn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},fn.apply(this,arguments)},pn=T,hn={},bn={};function yn(e){var t=e.env,r=e.platformInfo,o={userInfoKey:"".concat("user_info","_").concat(t)};hn[t]=hn[t]||new pn(fn(fn({},e),{keys:o,platformInfo:r})),bn[t]=bn[t]||new pn(fn(fn({},e),{keys:o,platformInfo:r,persistence:"local"}))}function mn(e){return bn[e]}var vn=function(){return vn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},vn.apply(this,arguments)},_n=["ap-shanghai","ap-guangzhou","ap-shenzhen-fsi","ap-shanghai-fsi","ap-nanjing","ap-beijing","ap-chengdu","ap-chongqing","ap-hongkong"],gn="",wn="@cloudbase/js-sdk";function Sn(){return gn}var Pn,On=[],Tn=["env","endPointKey","region"],En="https:";function Rn(e){return On.find((function(t){return Tn.filter((function(t){return null!=e[t]})).every((function(r){return t[r]===e[r]}))}))}function Cn(e){var t,r;e.protocol&&!/:$/.test(e.protocol)&&(e.protocol="".concat(e.protocol,":"));var o,n=Rn(e);n?(null!=e.baseUrl&&(n.baseUrl=e.baseUrl),null!=e.protocol&&(n.protocol=e.protocol)):On.push(vn(vn({},e),{protocol:null!==(t=e.protocol)&&void 0!==t?t:En})),"CLOUD_API"===e.endPointKey&&(o=null!==(r=e.protocol)&&void 0!==r?r:En,a=o)}function An(e,t,r){return Rn({env:e,endPointKey:t,region:r})}function jn(e,t){void 0===t&&(t="CLOUD_API");var r=An(e,t||"CLOUD_API"),o=r.protocol,n=r.baseUrl;return"".concat(o).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"}(Pn||(Pn={}));var In=function(){return In=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},In.apply(this,arguments)},kn=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},qn=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},xn=s,Ln=c,Wn=d,Mn=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function Nn(e,t,r){var o=e[t];e[t]=function(t){var n={},i={};r.forEach((function(r){var o=r.call(e,t),a=o.data,s=o.headers;Object.assign(n,a),Object.assign(i,s)}));var a=t.data;return a&&(Ln(a)?Object.keys(n).forEach((function(e){a.append(e,n[e])})):t.data=In(In({},a),n)),t.headers=In(In({},t.headers||{}),i),o.call(e,t)}}function Fn(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(Sn()),"x-seqid":e}}}var Dn,Bn,zn=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 dn.adapter.reqClass(r),this.throwWhenRequestFail=e.throw||!1,this.localCache=mn(this.config.env),"GATEWAY"!==this.config.endPointMode&&(Nn(this.reqClass,"post",[Fn]),Nn(this.reqClass,"upload",[Fn]),Nn(this.reqClass,"download",[Fn])),j.on(I,(function(e){var r;t.config.i18n=(null===(r=e.data)||void 0===r?void 0:r.i18n)||t.config.i18n}))}return e.prototype.getAccessToken=function(e){return void 0===e&&(e=null),kn(this,void 0,void 0,(function(){var t,r,o;return qn(this,(function(n){switch(n.label){case 0:if(null!=e)return[2,e];if(!(t=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return r=t.oauthInstance,o=r.oauth2client,[4,this.getOauthAccessTokenV2(o)];case 1:return[2,n.sent().accessToken]}}))}))},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["X-SDK-Version"]="@cloudbase/js-sdk/".concat(Sn()),e},e.prototype.post=function(e,t){return kn(this,void 0,void 0,(function(){return qn(this,(function(r){switch(r.label){case 0:return[4,this.reqClass.post(In(In({},e),{headers:In(In({},e.headers),this.getDefaultHeaders()),customReqOpts:t}))];case 1:return[2,r.sent()]}}))}))},e.prototype.upload=function(e){return kn(this,void 0,void 0,(function(){return qn(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.upload(In(In({},e),{headers:In(In({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return kn(this,void 0,void 0,(function(){return qn(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.download(In(In({},e),{headers:In(In({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.getBaseEndPoint=function(e){return void 0===e&&(e="CLOUD_API"),jn(this.config.env,e)},e.prototype.getOauthAccessTokenV2=function(e){return kn(this,void 0,void 0,(function(){var t,r;return qn(this,(function(o){switch(o.label){case 0:return[4,e.getAccessToken()];case 1:return t=o.sent(),[4,e.getCredentials()];case 2:return r=o.sent(),[2,{accessToken:t,accessTokenExpire:new Date(r.expires_at).getTime()}]}}))}))},e.prototype.request=function(e,t,r,o){var n,i;return kn(this,void 0,void 0,(function(){var a,s,l,u,c,d,f,p,h,b,y,m,v,_,g,w,S,P,O,T,E;return qn(this,(function(R){switch(R.label){case 0:if(a="x-tcb-trace_".concat(this.config.env),s="application/x-www-form-urlencoded",l=In({action:e,dataVersion:"2020-01-10",env:this.config.env},t),-1!==Mn.indexOf(e))return[3,2];if(!(u=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return c=u.oauthInstance,d=c.oauth2client,f=l,[4,this.getOauthAccessTokenV2(d)];case 1:f.access_token=R.sent().accessToken,R.label=2;case 2:return"storage.uploadFile"===e?(p=new FormData,Object.keys(p).forEach((function(e){Object.prototype.hasOwnProperty.call(p,e)&&void 0!==p[e]&&p.append(e,l[e])})),s="multipart/form-data"):(s="application/json;charset=UTF-8",p={},Object.keys(l).forEach((function(e){void 0!==l[e]&&(p[e]=l[e])}))),h={headers:In({"content-type":s},this.getDefaultHeaders())},(null==r?void 0:r.onUploadProgress)&&(h.onUploadProgress=r.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(b=this.localCache.getStore(a))&&(h.headers["X-TCB-Trace"]=b),y=void 0!==(null==r?void 0:r.parse)?r.parse:t.parse,m=void 0!==(null==r?void 0:r.inQuery)?r.inQuery:t.inQuery,v=void 0!==(null==r?void 0:r.search)?r.search:t.search,_=In(In({},(null==r?void 0:r.defaultQuery)||{}),{env:this.config.env}),y&&(_.parse=!0),m&&(_=In(In({},m),_)),g=this.config.endPointMode||"CLOUD_API",w=An(this.config.env,g),S=w.baseUrl,P=w.protocol,"GATEWAY"===g&&("functions.invokeFunction"===e||/^(storage|database)\./.test(e))&&(S="".concat(S.match(/\/\/([^/?#]*)/)[0],"/web")),O=r.pathname?Wn(P,"".concat(null===(n=jn(this.config.env,g))||void 0===n?void 0:n.replace(/^https?:/,""),"/").concat(r.pathname),_):Wn(P,S,_),v&&(O+=v),[4,this.post(In({url:O,data:p},h),o)];case 3:if(T=R.sent(),(E=null===(i=T.header)||void 0===i?void 0:i["x-tcb-trace"])&&this.localCache.setStore(a,E),200!==Number(T.status)&&200!==Number(T.statusCode)||!T.data)throw new Error("network request error");return[2,T]}}))}))},e.prototype.fetch=function(e){var t,r,o,n,i,a,s,l;return kn(this,void 0,void 0,(function(){var u,c,d,f,p,h,b=this;return qn(this,(function(y){switch(y.label){case 0:u=e.token,c=e.headers,d=void 0===c?{}:c,f=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(e,["token","headers"]),p=function(){return kn(b,void 0,void 0,(function(){var e,t,r,o,n;return qn(this,(function(i){switch(i.label){case 0:return t=(e=this.reqClass).fetch,o={},n={"X-SDK-Version":"@cloudbase/js-sdk/".concat(Sn())},r="Bearer ".concat,[4,this.getAccessToken(u)];case 1:return[2,t.apply(e,[In.apply(void 0,[(o.headers=In.apply(void 0,[In.apply(void 0,[(n.Authorization=r.apply("Bearer ",[i.sent()]),n),this.getDefaultHeaders()]),d]),o),f])])]}}))}))},y.label=1;case 1:return y.trys.push([1,3,,6]),[4,p()];case 2:return[2,y.sent()];case 3:if("ACCESS_TOKEN_EXPIRED"!==(null==(h=y.sent())?void 0:h.code))return[3,5];if("function"!=typeof(null===(n=null===(o=null===(r=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===r?void 0:r.oauthInstance)||void 0===o?void 0:o.authApi)||void 0===n?void 0:n.refreshTokenForce))throw h;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 y.sent(),[2,p()];case 5:throw h;case 6:return[2]}}))}))},e.prototype.send=function(e,t,r,o){return void 0===t&&(t={}),void 0===r&&(r={}),kn(this,void 0,void 0,(function(){var n;return qn(this,(function(i){switch(i.label){case 0:return[4,this.request(e,t,In(In({},r),{onUploadProgress:t.onUploadProgress}),o)];case 1:if((n=i.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:xn.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},e.prototype.gateWay=function(e,t){return kn(this,void 0,void 0,(function(){var r,o,n,i,a,s,l,u,c,d,f,p,h,b,y,m;return qn(this,(function(v){switch(v.label){case 0:if(r=e.name,o=e.data,n=e.path,i=void 0===n?"":n,a=e.method,s=e.header,l=void 0===s?{}:s,!r||!i)throw new Error(JSON.stringify({code:xn.INVALID_PARAMS,msg:"[gateWay] invalid function name or path"}));try{u=o?JSON.stringify(o):""}catch(e){throw new Error(JSON.stringify({code:xn.INVALID_PARAMS,msg:"[gateWay] invalid data"}))}return c=function(){var e=(new Date).getTime(),t=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var o=16*Math.random();return e>0?(o=(e+o)%16|0,e=Math.floor(e/16)):(o=(t+o)%16|0,t=Math.floor(t/16)),("x"===r?o:7&o|8).toString(16)}))}(),d=An(this.config.env,"GATEWAY"),f=d.baseUrl,p=d.protocol,h="".concat(p).concat(f,"/").concat(i,"/").concat(r),[4,this.fetch({method:a||"POST",headers:In({"Content-Type":"application/json; charset=utf-8","X-Request-Id":c},l),body:u,url:h,customReqOpts:t})];case 1:return b=v.sent(),y=[In({requestId:c},b)],m={},[4,b.data];case 2:return[2,In.apply(void 0,y.concat([(m.data=v.sent(),m)]))]}}))}))},e}(),Un={};!function(e){e.ZH="zh-CN",e.EN="en-US"}(Bn||(Bn={}));var $n=((Dn={})[Bn.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"},Dn),Hn=function(e,t){var r;return(null===(r=$n[t])||void 0===r?void 0:r[e])||e},Vn=function(e,t){var r,o,n=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,n))||Bn.ZH;return null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,n,a),new Proxy({t:function(e){return Hn(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,n))||e[t]},set:function(e,t,r){var o;return"lang"===t&&r!==e[t]&&(e[t]=r,e.t=function(e){return Hn(e,r)},null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,n,r),j.fire(I,{i18n:e})),e[t]=r,!0}})},Gn=function(){return Gn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Gn.apply(this,arguments)},Yn=function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Kn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Qn=s,Jn="https://support.qq.com/products/148793",Xn=f,Zn=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,r){}},ei={timeout:15e3,persistence:"local"},ti=6e5,ri={},oi=function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.version=Sn()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return dn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return e=this.cloudbaseConfig.env,hn[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return mn(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this.cloudbaseConfig.env,Un[e];var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var r;if(!t.env)throw new Error(JSON.stringify({code:Qn.INVALID_PARAMS,msg:"env must not be specified"}));dn.adapter||this.useDefaultAdapter();var o={timeout:t.timeout||5e3,timeoutMsg:"[".concat(wn,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s")};this.requestClient=new dn.adapter.reqClass(o),this.cloudbaseConfig=Gn(Gn(Gn({},ei),t),{i18n:Vn(dn,t)}),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var n=this.cloudbaseConfig,i=n.env,a=n.persistence,s=n.debug,l=n.timeout,u=n.oauthClient,c=n.i18n;yn({env:i,persistence:a,debug:s,platformInfo:this.platform}),function(e,t){Cn({env:e,region:t,baseUrl:"//".concat(e,".").concat(t||"ap-shanghai",".tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(i,t.region||""),function(e,t,r){void 0===r&&(r="ap-shanghai"),r=r||"ap-shanghai";var o="//".concat(e,".api.tcloudbasegateway.com/v1");_n.includes(r)||(o="//".concat(e,".api.intl.tcloudbasegateway.com/v1")),Cn({endPointKey:"GATEWAY",env:e,baseUrl:o,protocol:t})}(i,En,t.region||"");var d=new e(this.cloudbaseConfig);return function(e){Un[e.env]=new zn(In(In({},e),{throw:!0}))}({env:i,region:t.region||"",timeout:l,oauthClient:u,_fromApp:d,i18n:c,endPointMode:t.endPointMode}),d.requestClient=this.requestClient,null===(r=null==this?void 0:this.fire)||void 0===r||r.call(this,"cloudbase_init",d),this.try2InitAuth(t,d),d},e.prototype.updateConfig=function(e){var t=e.persistence,r=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=r,yn({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){ri[e.name]=e},e.prototype.invokeExtension=function(e,t){return function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var r;return function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,(function(o){switch(o.label){case 0:if(!(r=ri[e]))throw new Error(JSON.stringify({code:Qn.INVALID_PARAMS,msg:"extension:".concat(e," must be registered before invoke")}));return[4,r.invoke(t,this)];case 1:return[2,o.sent()]}}))}))},e.prototype.useAdapters=function(e,t){var r=function(e,t){for(var r,o=0,n=(r=e,"[object Array]"===Object.prototype.toString.call(r)?e:[e]);o<n.length;o++){var i=n[o],a=i.isMatch,s=i.genAdapter,l=i.runtime;if(a())return{adapter:g({isMatch:a},s(t)),runtime:l}}}(e,t)||{},o=r.adapter,n=r.runtime;o&&(dn.adapter=o),n&&(dn.runtime=n)},e.prototype.registerHook=function(t){!function(e,t){var r=t.entity,o=t.target;if(Object.prototype.hasOwnProperty.call(e,o))throw new Error(JSON.stringify({code:L.INVALID_OPERATION,msg:"target:".concat(o," is not exist")}));var n=e.prototype[o];if("function"!=typeof n)throw new Error(JSON.stringify({code:L.INVALID_OPERATION,msg:"target:".concat(o," is not a function which is the only type supports hook")}));e.prototype[o]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.call.apply(r,x([this],e,!1)),n.call.apply(n,x([this],e,!1))}}(e,t)},e.prototype.registerComponent=function(t){M(e,t)},e.prototype.registerVersion=function(e){!function(e){gn=e}(e),this.version=e},e.prototype.registerSdkName=function(e){!function(e){wn=e,function(e){o=e}(e)}(e)},e.prototype.registerEndPoint=function(e,t){Cn({baseUrl:e,protocol:t,env:this.config.env,endPointKey:"CLOUD_API"})},e.prototype.registerEndPointWithKey=function(e){Cn({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.getEndPointWithKey=function(e){var t=An(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 o=r[2];o&&(t=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var r=e.split("="),o=r[0],n=r[1];o=decodeURIComponent(o),n=decodeURIComponent(n),o&&(t[o]?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n)})),t}(o))}var n=t.token,i=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(t,["token"]);return/^data:/.test(e)&&!n?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:n?{state:i.state,token:n,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:h.WEB},t=e.adapter,r=e.runtime;dn.adapter=t,dn.runtime=r},e.prototype.formatTimeout=function(e){switch(!0){case e>ti:return Xn(Qn.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),ti;case e<100:return Xn(Qn.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},e.prototype.try2InitAuth=function(e,t){try{e.accessKey&&t.auth()}catch(e){console.log("try2InitAuth error:",e)}},Yn([Zn({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(Jn)]}),Kn("design:type",Function),Kn("design:paramtypes",[Object]),Kn("design:returntype",e)],e.prototype,"init",null),Yn([Zn({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Jn)]}),Kn("design:type",Function),Kn("design:paramtypes",[String,Object]),Kn("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}(),ni=new oi;ni.useAdapters((nn.prototype.upload=function(e){var t=this,r=this;return new Promise((function(o){var n=e.url,i=e.file,a=e.data,s=e.headers,l=wx.getFileSystemManager(),u=wx.request({url:n,method:e.method,header:cn({"content-type":" "},s),data:l.readFileSync(i),timeout:t._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&(null==a?void 0:a.success_action_status)&&(t.statusCode=parseInt(a.success_action_status,10)),o(t)},fail:function(e){o(e)},complete:function(e){if((null==e?void 0:e.errMsg)&&r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{u.abort()}catch(e){}}}})}))},un.genAdapter=function(e){return{root:{globalThis:{}},reqClass:nn,wsClass:sn,captchaOptions:{openURIWithCallback:function(t){var r=e.EventBus,o={},n=t;console.log("openURIWithCallback",t);var i=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){n=i[1],console.log("openURIWithCallback url",n);var a=i[2];a&&(o=ln(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,l=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(o,["token"]);return/^data:/.test(n)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: ".concat(t)}):s?new Promise((function(e){console.log("wait for captcha..."),r.$emit("CAPTCHA_DATA_CHANGE",cn(cn({},l),{token:s,url:n})),r.$once("RESOLVE_CAPTCHA_DATA",(function(t){e(t)}))})):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:an,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:""}}},un));var ii=ni},47:function(e){var t=function(e){"use strict";var t,r=Object.prototype,o=r.hasOwnProperty,n=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,o){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new j(o||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",p="suspendedYield",h="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(I([])));S&&S!==r&&o.call(S,a)&&(g=S);var P=_.prototype=m.prototype=Object.create(g);function O(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(n,i,a,s){var l=d(e[n],e,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&o.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;n(this,"_invoke",{value:function(e,o){function n(){return new t((function(t,n){r(e,o,t,n)}))}return i=i?i.then(n,n):n()}})}function E(e,r,o){var n=f;return function(i,a){if(n===h)throw new Error("Generator is already running");if(n===b){if("throw"===i)throw a;return{value:t,done:!0}}for(o.method=i,o.arg=a;;){var s=o.delegate;if(s){var l=R(s,o);if(l){if(l===y)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(n===f)throw n=b,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n=h;var u=d(e,r,o);if("normal"===u.type){if(n=o.done?b:p,u.arg===y)continue;return{value:u.arg,done:o.done}}"throw"===u.type&&(n=b,o.method="throw",o.arg=u.arg)}}}function R(e,r){var o=r.method,n=e.iterator[o];if(n===t)return r.delegate=null,"throw"===o&&e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method)||"return"!==o&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+o+"' method")),y;var i=d(n,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 C(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 A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function I(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 n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],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=_,n(P,"constructor",{value:_,configurable:!0}),n(_,"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(P),e},e.awrap=function(e){return{__await:e}},O(T.prototype),u(T.prototype,s,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,o,n,i){void 0===i&&(i=Promise);var a=new T(c(t,r,o,n),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(P),u(P,l,"Generator"),u(P,a,(function(){return this})),u(P,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var o in t)r.push(o);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},e.values=I,j.prototype={constructor:j,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(A),!e)for(var r in this)"t"===r.charAt(0)&&o.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 n(o,n){return s.type="throw",s.arg=e,r.next=o,n&&(r.method="next",r.arg=t),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),u=o.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;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),A(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 o=r.completion;if("throw"===o.type){var n=o.arg;A(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,o){return this.delegate={iterator:I(e),resultName:r,nextLoc:o},"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.23.2"}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}return r.d=function(e,t){for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},n=o(r(436)),i=o(r(878));n.default.registerVersion(i.default.version);try{window.cloudbase=n.default}catch(e){}t.default=n.default,e.exports=n.default},436:function(e,t,r){"use strict";r.r(t),r.d(t,{LANGS:function(){return Bn},cloudbase:function(){return ni},default:function(){return ii},getBaseEndPoint:function(){return jn}});var o="@cloudbase/js-sdk";function n(){return o}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 o=/\?/.test(t),n="";for(var i in r)""===n?!o&&(t+="?"):n+="&",n+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=n)?t:""+e+t}function c(e){return"[object FormData]"===Object.prototype.toString.call(e)}function d(e,t,r){void 0===r&&(r={});var o=/\?/.test(t),n="";return Object.keys(r).forEach((function(e){""===n?!o&&(t+="?"):n+="&",n+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=n)?t:"".concat(e).concat(t)}function f(e,t){console.warn("[".concat(n(),"][").concat(e,"]:").concat(t))}var p,h,b=(p=function(e,t){return p=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])},p(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}p(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,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},y.apply(this,arguments)},m=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},v=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=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,o=t.timeout,n=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=o||0,r.timeoutMsg=n||"请求超时",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,o=e.name,n=e.method,i=e.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==n?void 0:n.toLowerCase()]||"put",l=new FormData;return"post"===s?(Object.keys(t).forEach((function(e){l.append(e,t[e])})),l.append("key",o),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,o,n;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])),o=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(n=document.createElement("a")).href=r,n.setAttribute("download",o),n.style.display="none",document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r),document.body.removeChild(n),[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,o,n,i,a,s,l,u,c,d,f,p,h,b=this;return v(this,(function(_){switch(_.label){case 0:return r=new AbortController,o=e.url,n=e.enableAbort,i=void 0!==n&&n,a=e.stream,s=void 0!==a&&a,l=e.signal,u=e.timeout,c=e.shouldThrowOnError,d=void 0===c||c,f=null!=u?u:this.timeout,l&&(l.aborted&&r.abort(),l.addEventListener("abort",(function(){return r.abort()}))),p=null,i&&f&&(p=setTimeout((function(){console.warn(b.timeoutMsg),r.abort(new Error(b.timeoutMsg))}),f)),[4,fetch(o,y(y({},e),{signal:r.signal})).then((function(e){return m(b,void 0,void 0,(function(){var t,r,o;return v(this,(function(n){switch(n.label){case 0:return clearTimeout(p),d?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return o=(r=Promise).reject,[4,e.json()];case 2:t=o.apply(r,[n.sent()]),n.label=3;case 3:return[2,t];case 4:return[2,e]}}))}))})).catch((function(e){if(clearTimeout(p),d)return Promise.reject(e)}))];case 1:return h=_.sent(),[2,{data:s?h.body:(null===(t=h.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?h.json():h.text(),statusCode:h.status,header:h.headers}]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var o=String(e.method).toLowerCase()||"get";return new Promise((function(n){var i,s,l=e.url,u=e.headers,f=void 0===u?{}:u,p=e.data,h=e.responseType,b=e.withCredentials,y=e.body,m=e.onUploadProgress,v=d(a,l,"get"===o?p:{}),_=new XMLHttpRequest;_.open(o,v),h&&(_.responseType=h),Object.keys(f).forEach((function(e){_.setRequestHeader(e,f[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(": "),o=t.shift().toLowerCase(),n=t.join(": ");r[o]=n})),e.header=r,e.statusCode=_.status;try{e.data="blob"===h?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===h?_.response:_.responseText}clearTimeout(i),n(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=c(p)?p:"application/x-www-form-urlencoded"===f["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("&")}(p):y||(p?JSON.stringify(p):void 0),b&&(_.withCredentials=!0),_.send(s)}))},t}(l),g=function(){return g=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},g.apply(this,arguments)};!function(e){e.WEB="web",e.WX_MP="wx_mp"}(h||(h={}));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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),S=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},P=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},O=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(){})),T=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,o=void 0===r?{}:r,n=e.keys,i=void 0===n?{}:n;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(f(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new O(t.root));case"none":return new O(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 o={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(o))}catch(e){throw new Error(JSON.stringify({code:s.OPERATION_FAIL,msg:"[".concat(n(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:e}))}}else f(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 o;return P(this,(function(n){switch(n.label){case 0:if(!this.storage)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),o={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(o))];case 2:return n.sent(),[3,4];case 3:return n.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 o=this.storage.getItem(e);return o&&o.indexOf(t)>=0?JSON.parse(o).content:""}f(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 o;return P(this,(function(n){switch(n.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(o=n.sent())&&o.indexOf(t)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):f(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 P(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}(),E=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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),R=function(e,t){this.data=t||null,this.name=e},C=function(e){function t(t,r){var o=e.call(this,"error",{error:t,data:r})||this;return o.error=t,o}return E(t,e),t}(R),A=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 o=r[e].indexOf(t);-1!==o&&r[e].splice(o,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof C)return console.error(e.error),this;var r="string"==typeof e?new R(e,t||{}):e,o=r.name;if(this.listens(o)){r.target=this;for(var n=0,i=this.listeners[o]?function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}([],this.listeners[o],!0):[];n<i.length;n++)i[n].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new A;var j=new A,I="lang_change";function k(e){this.message=e}function q(e){this.message=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";var x=function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},L=s,W={};function M(e,t){var r=t.name,o=t.namespace,n=t.entity,i=t.injectEvents,a=t.IIFE,s=void 0!==a&&a;if(W[r]||o&&e[o])throw new Error(JSON.stringify({code:L.INVALID_OPERATION,msg:"Duplicate component ".concat(r)}));if(s){if(!n||"function"!=typeof n)throw new Error(JSON.stringify({code:L.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));n.call(e)}if(W[r]=t,o?e.prototype[o]=n:N(e.prototype,n),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=x(x([],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,o=Object.keys(this.events);r<o.length;r++){var n=o[r],i=this.events[n],a=i.bus;if(i.events.includes(e)){a.fire(e,t);break}}}}}function N(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,o=Object.keys(t);r<o.length;r++){var n=o[r];Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=N(e[n],t[n]))}return e}function F(){}function D(e){return"object"==typeof e&&null!==e||"function"==typeof e}const B=F;function z(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const U=Promise,$=Promise.resolve.bind(U),H=Promise.prototype.then,V=Promise.reject.bind(U),G=$;function Y(e){return new U(e)}function K(e){return Y((t=>t(e)))}function Q(e){return V(e)}function J(e,t,r){return H.call(e,t,r)}function X(e,t,r){J(J(e,t,r),void 0,B)}function Z(e,t){X(e,t)}function ee(e,t){X(e,void 0,t)}function te(e,t,r){return J(e,t,r)}function re(e){J(e,void 0,B)}let oe=e=>{if("function"==typeof queueMicrotask)oe=queueMicrotask;else{const e=K(void 0);oe=t=>J(e,t)}return oe(e)};function ne(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function ie(e,t,r){try{return K(ne(e,t,r))}catch(e){return Q(e)}}class ae{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 o=r+1;const n=e._elements,i=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,o=r._elements;for(;!(t===o.length&&void 0===r._next||t===o.length&&(r=r._next,o=r._elements,t=0,0===o.length));)e(o[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const se=Symbol("[[AbortSteps]]"),le=Symbol("[[ErrorSteps]]"),ue=Symbol("[[CancelSteps]]"),ce=Symbol("[[PullSteps]]"),de=Symbol("[[ReleaseSteps]]");function fe(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?ye(e):"closed"===t._state?function(e){ye(e),_e(e)}(e):me(e,t._storedError)}function pe(e,t){return So(e._ownerReadableStream,t)}function he(e){const t=e._ownerReadableStream;"readable"===t._state?ve(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){me(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[de](),t._reader=void 0,e._ownerReadableStream=void 0}function be(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function ye(e){e._closedPromise=Y(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function me(e,t){ye(e),ve(e,t)}function ve(e,t){void 0!==e._closedPromise_reject&&(re(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function _e(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const ge=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},we=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Se(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function Pe(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function Oe(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function Te(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function Ee(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Re(e){return Number(e)}function Ce(e){return 0===e?0:e}function Ae(e,t){const r=Number.MAX_SAFE_INTEGER;let o=Number(e);if(o=Ce(o),!ge(o))throw new TypeError(`${t} is not a finite number`);if(o=function(e){return Ce(we(e))}(o),o<0||o>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return ge(o)&&0!==o?o:0}function je(e,t){if(!go(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Ie(e){return new We(e)}function ke(e,t){e._reader._readRequests.push(t)}function qe(e,t,r){const o=e._reader._readRequests.shift();r?o._closeSteps():o._chunkSteps(t)}function xe(e){return e._reader._readRequests.length}function Le(e){const t=e._reader;return void 0!==t&&!!Me(t)}class We{constructor(e){if(Te(e,1,"ReadableStreamDefaultReader"),je(e,"First parameter"),wo(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");fe(this,e),this._readRequests=new ae}get closed(){return Me(this)?this._closedPromise:Q(De("closed"))}cancel(e=void 0){return Me(this)?void 0===this._ownerReadableStream?Q(be("cancel")):pe(this,e):Q(De("cancel"))}read(){if(!Me(this))return Q(De("read"));if(void 0===this._ownerReadableStream)return Q(be("read from"));let e,t;const r=Y(((r,o)=>{e=r,t=o}));return Ne(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!Me(this))throw De("releaseLock");void 0!==this._ownerReadableStream&&function(e){he(e),Fe(e,new TypeError("Reader was released"))}(this)}}function Me(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof We}function Ne(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[ce](t)}function Fe(e,t){const r=e._readRequests;e._readRequests=new ae,r.forEach((e=>{e._errorSteps(t)}))}function De(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var Be,ze,Ue;function $e(e){return e.slice()}function He(e,t,r,o,n){new Uint8Array(e).set(new Uint8Array(r,o,n),t)}Object.defineProperties(We.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),z(We.prototype.cancel,"cancel"),z(We.prototype.read,"read"),z(We.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(We.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let Ve=e=>(Ve="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,Ve(e)),Ge=e=>(Ge="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,Ge(e));function Ye(e,t,r){if(e.slice)return e.slice(t,r);const o=r-t,n=new ArrayBuffer(o);return He(n,0,e,t,o),n}function Ke(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 Qe(e){try{const t=e.done,r=e.value;return J(G(r),(e=>({done:t,value:e})))}catch(e){return Q(e)}}const Je=null!==(Ue=null!==(Be=Symbol.asyncIterator)&&void 0!==Be?Be:null===(ze=Symbol.for)||void 0===ze?void 0:ze.call(Symbol,"Symbol.asyncIterator"))&&void 0!==Ue?Ue:"@@asyncIterator";function Xe(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=Ke(e,Je)))return function(e){const t={next(){let t;try{t=Ze(e)}catch(e){return Q(e)}return Qe(t)},return(t){let r;try{const o=Ke(e.iterator,"return");if(void 0===o)return K({done:!0,value:t});r=ne(o,e.iterator,[t])}catch(e){return Q(e)}return D(r)?Qe(r):Q(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(Xe(e,"sync",Ke(e,Symbol.iterator)))}else r=Ke(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const o=ne(r,e,[]);if(!D(o))throw new TypeError("The iterator method must return an object");return{iterator:o,nextMethod:o.next,done:!1}}function Ze(e){const t=ne(e.nextMethod,e.iterator,[]);if(!D(t))throw new TypeError("The iterator.next() method must return an object");return t}class et{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?te(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?te(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 o=Y(((e,o)=>{t=e,r=o}));return Ne(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,oe((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,he(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,he(e),r(t)}}),o}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=pe(t,e);return he(t),te(r,(()=>({value:e,done:!0})))}return he(t),K({value:e,done:!0})}}const tt={next(){return rt(this)?this._asyncIteratorImpl.next():Q(ot("next"))},return(e){return rt(this)?this._asyncIteratorImpl.return(e):Q(ot("return"))},[Je](){return this}};function rt(e){if(!D(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof et}catch(e){return!1}}function ot(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(tt,Je,{enumerable:!1});const nt=Number.isNaN||function(e){return e!=e};function it(e){const t=Ye(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function at(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function st(e,t,r){if("number"!=typeof(o=r)||nt(o)||o<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var o;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function lt(e){e._queue=new ae,e._queueTotalSize=0}function ut(e){return e===DataView}class ct{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!pt(this))throw Nt("view");return this._view}respond(e){if(!pt(this))throw Nt("respond");if(Te(e,1,"respond"),e=Ae(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ge(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Lt(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!pt(this))throw Nt("respondWithNewView");if(Te(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(Ge(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Wt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(ct.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),z(ct.prototype.respond,"respond"),z(ct.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ct.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class dt{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ft(this))throw Ft("byobRequest");return qt(this)}get desiredSize(){if(!ft(this))throw Ft("desiredSize");return xt(this)}close(){if(!ft(this))throw Ft("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`);At(this)}enqueue(e){if(!ft(this))throw Ft("enqueue");if(Te(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`);jt(this,e)}error(e=void 0){if(!ft(this))throw Ft("error");It(this,e)}[ue](e){bt(this),lt(this);const t=this._cancelAlgorithm(e);return Ct(this),t}[ce](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void kt(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let o;try{o=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const n={buffer:o,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(n)}ke(t,e),ht(this)}[de](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new ae,this._pendingPullIntos.push(e)}}}function ft(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof dt}function pt(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof ct}function ht(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Le(t)&&xe(t)>0)||(!!($t(t)&&Ut(t)>0)||xt(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,X(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ht(e)),null)),(t=>(It(e,t),null)))))}function bt(e){Ot(e),e._pendingPullIntos=new ae}function yt(e,t){let r=!1;"closed"===e._state&&(r=!0);const o=mt(t);"default"===t.readerType?qe(e,o,r):function(e,t,r){const o=e._reader._readIntoRequests.shift();r?o._closeSteps(t):o._chunkSteps(t)}(e,o,r)}function mt(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function vt(e,t,r,o){e._queue.push({buffer:t,byteOffset:r,byteLength:o}),e._queueTotalSize+=o}function _t(e,t,r,o){let n;try{n=Ye(t,r,r+o)}catch(t){throw It(e,t),t}vt(e,n,0,o)}function gt(e,t){t.bytesFilled>0&&_t(e,t.buffer,t.byteOffset,t.bytesFilled),Rt(e)}function wt(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),o=t.bytesFilled+r;let n=r,i=!1;const a=o-o%t.elementSize;a>=t.minimumFill&&(n=a-t.bytesFilled,i=!0);const s=e._queue;for(;n>0;){const r=s.peek(),o=Math.min(n,r.byteLength),i=t.byteOffset+t.bytesFilled;He(t.buffer,i,r.buffer,r.byteOffset,o),r.byteLength===o?s.shift():(r.byteOffset+=o,r.byteLength-=o),e._queueTotalSize-=o,St(0,o,t),n-=o}return i}function St(e,t,r){r.bytesFilled+=t}function Pt(e){0===e._queueTotalSize&&e._closeRequested?(Ct(e),Po(e._controlledReadableByteStream)):ht(e)}function Ot(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Tt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();wt(e,t)&&(Rt(e),yt(e._controlledReadableByteStream,t))}}function Et(e,t){const r=e._pendingPullIntos.peek();Ot(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Rt(e);const r=e._controlledReadableByteStream;if($t(r))for(;Ut(r)>0;)yt(r,Rt(e))}(e,r):function(e,t,r){if(St(0,t,r),"none"===r.readerType)return gt(e,r),void Tt(e);if(r.bytesFilled<r.minimumFill)return;Rt(e);const o=r.bytesFilled%r.elementSize;if(o>0){const t=r.byteOffset+r.bytesFilled;_t(e,r.buffer,t-o,o)}r.bytesFilled-=o,yt(e._controlledReadableByteStream,r),Tt(e)}(e,t,r),ht(e)}function Rt(e){return e._pendingPullIntos.shift()}function Ct(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function At(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 It(e,t),t}}Ct(e),Po(t)}}function jt(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:o,byteOffset:n,byteLength:i}=t;if(Ge(o))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=Ve(o);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(Ge(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Ot(e),t.buffer=Ve(t.buffer),"none"===t.readerType&>(e,t)}Le(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;kt(e,t._readRequests.shift())}}(e),0===xe(r)?vt(e,a,n,i):(e._pendingPullIntos.length>0&&Rt(e),qe(r,new Uint8Array(a,n,i),!1))):$t(r)?(vt(e,a,n,i),Tt(e)):vt(e,a,n,i),ht(e)}function It(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(bt(e),lt(e),Ct(e),Oo(r,t))}function kt(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,Pt(e);const o=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(o)}function qt(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),o=Object.create(ct.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(o,e,r),e._byobRequest=o}return e._byobRequest}function xt(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Lt(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=Ve(r.buffer),Et(e,t)}function Wt(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 o=t.byteLength;r.buffer=Ve(t.buffer),Et(e,o)}function Mt(e,t,r,o,n,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,lt(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=o,t._cancelAlgorithm=n,t._autoAllocateChunkSize=a,t._pendingPullIntos=new ae,e._readableStreamController=t,X(K(r()),(()=>(t._started=!0,ht(t),null)),(e=>(It(t,e),null)))}function Nt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function Ft(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Dt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Bt(e){return new Ht(e)}function zt(e,t){e._reader._readIntoRequests.push(t)}function Ut(e){return e._reader._readIntoRequests.length}function $t(e){const t=e._reader;return void 0!==t&&!!Vt(t)}Object.defineProperties(dt.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),z(dt.prototype.close,"close"),z(dt.prototype.enqueue,"enqueue"),z(dt.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(dt.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Ht{constructor(e){if(Te(e,1,"ReadableStreamBYOBReader"),je(e,"First parameter"),wo(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ft(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");fe(this,e),this._readIntoRequests=new ae}get closed(){return Vt(this)?this._closedPromise:Q(Kt("closed"))}cancel(e=void 0){return Vt(this)?void 0===this._ownerReadableStream?Q(be("cancel")):pe(this,e):Q(Kt("cancel"))}read(e,t={}){if(!Vt(this))return Q(Kt("read"));if(!ArrayBuffer.isView(e))return Q(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return Q(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return Q(new TypeError("view's buffer must have non-zero byteLength"));if(Ge(e.buffer))return Q(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return Se(e,t),{min:Ae(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return Q(e)}const o=r.min;if(0===o)return Q(new TypeError("options.min must be greater than 0"));if(function(e){return ut(e.constructor)}(e)){if(o>e.byteLength)return Q(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(o>e.length)return Q(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return Q(be("read from"));let n,i;const a=Y(((e,t)=>{n=e,i=t}));return Gt(this,e,o,{_chunkSteps:e=>n({value:e,done:!1}),_closeSteps:e=>n({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!Vt(this))throw Kt("releaseLock");void 0!==this._ownerReadableStream&&function(e){he(e),Yt(e,new TypeError("Reader was released"))}(this)}}function Vt(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Ht}function Gt(e,t,r,o){const n=e._ownerReadableStream;n._disturbed=!0,"errored"===n._state?o._errorSteps(n._storedError):function(e,t,r,o){const n=e._controlledReadableByteStream,i=t.constructor,a=function(e){return ut(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:l}=t,u=r*a;let c;try{c=Ve(t.buffer)}catch(e){return void o._errorSteps(e)}const d={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(d),void zt(n,o);if("closed"!==n._state){if(e._queueTotalSize>0){if(wt(e,d)){const t=mt(d);return Pt(e),void o._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return It(e,t),void o._errorSteps(t)}}e._pendingPullIntos.push(d),zt(n,o),ht(e)}else{const e=new i(d.buffer,d.byteOffset,0);o._closeSteps(e)}}(n._readableStreamController,t,r,o)}function Yt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new ae,r.forEach((e=>{e._errorSteps(t)}))}function Kt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Qt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(nt(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Jt(e){const{size:t}=e;return t||(()=>1)}function Xt(e,t){Se(e,t);const r=null==e?void 0:e.highWaterMark,o=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Re(r),size:void 0===o?void 0:Zt(o,`${t} has member 'size' that`)}}function Zt(e,t){return Pe(e,t),t=>Re(e(t))}function er(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function tr(e,t,r){return Pe(e,r),()=>ie(e,t,[])}function rr(e,t,r){return Pe(e,r),r=>ne(e,t,[r])}function or(e,t,r){return Pe(e,r),(r,o)=>ie(e,t,[r,o])}function nr(e,t){if(!ur(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Ht.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),z(Ht.prototype.cancel,"cancel"),z(Ht.prototype.read,"read"),z(Ht.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ht.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const ir="function"==typeof AbortController;class ar{constructor(e={},t={}){void 0===e?e=null:Oe(e,"First parameter");const r=Xt(t,"Second parameter"),o=function(e,t){Se(e,t);const r=null==e?void 0:e.abort,o=null==e?void 0:e.close,n=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:er(r,e,`${t} has member 'abort' that`),close:void 0===o?void 0:tr(o,e,`${t} has member 'close' that`),start:void 0===n?void 0:rr(n,e,`${t} has member 'start' that`),write:void 0===a?void 0:or(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(lr(this),void 0!==o.type)throw new RangeError("Invalid type is specified");const n=Jt(r);!function(e,t,r,o){const n=Object.create(Er.prototype);let i,a,s,l;i=void 0!==t.start?()=>t.start(n):()=>{},a=void 0!==t.write?e=>t.write(e,n):()=>K(void 0),s=void 0!==t.close?()=>t.close():()=>K(void 0),l=void 0!==t.abort?e=>t.abort(e):()=>K(void 0),Cr(e,n,i,a,s,l,r,o)}(this,o,Qt(r,1),n)}get locked(){if(!ur(this))throw Lr("locked");return cr(this)}abort(e=void 0){return ur(this)?cr(this)?Q(new TypeError("Cannot abort a stream that already has a writer")):dr(this,e):Q(Lr("abort"))}close(){return ur(this)?cr(this)?Q(new TypeError("Cannot close a stream that already has a writer")):yr(this)?Q(new TypeError("Cannot close an already-closing stream")):fr(this):Q(Lr("close"))}getWriter(){if(!ur(this))throw Lr("getWriter");return sr(this)}}function sr(e){return new _r(e)}function lr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ae,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function ur(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof ar}function cr(e){return void 0!==e._writer}function dr(e,t){var r;if("closed"===e._state||"errored"===e._state)return K(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const o=e._state;if("closed"===o||"errored"===o)return K(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let n=!1;"erroring"===o&&(n=!0,t=void 0);const i=Y(((r,o)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:o,_reason:t,_wasAlreadyErroring:n}}));return e._pendingAbortRequest._promise=i,n||hr(e,t),i}function fr(e){const t=e._state;if("closed"===t||"errored"===t)return Q(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=Y(((t,r)=>{const o={_resolve:t,_reject:r};e._closeRequest=o})),o=e._writer;var n;return void 0!==o&&e._backpressure&&"writable"===t&&Gr(o),st(n=e._writableStreamController,Tr,0),Ir(n),r}function pr(e,t){"writable"!==e._state?br(e):hr(e,t)}function hr(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const o=e._writer;void 0!==o&&Sr(o,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&br(e)}function br(e){e._state="errored",e._writableStreamController[le]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new ae,void 0===e._pendingAbortRequest)return void mr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void mr(e);X(e._writableStreamController[se](r._reason),(()=>(r._resolve(),mr(e),null)),(t=>(r._reject(t),mr(e),null)))}function yr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function mr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Br(t,e._storedError)}function vr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Ur(e)}(r):Gr(r)),e._backpressure=t}Object.defineProperties(ar.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),z(ar.prototype.abort,"abort"),z(ar.prototype.close,"close"),z(ar.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ar.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class _r{constructor(e){if(Te(e,1,"WritableStreamDefaultWriter"),nr(e,"First parameter"),cr(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)!yr(e)&&e._backpressure?Ur(this):Hr(this),Fr(this);else if("erroring"===t)$r(this,e._storedError),Fr(this);else if("closed"===t)Hr(this),Fr(this),zr(this);else{const t=e._storedError;$r(this,t),Dr(this,t)}}get closed(){return gr(this)?this._closedPromise:Q(Mr("closed"))}get desiredSize(){if(!gr(this))throw Mr("desiredSize");if(void 0===this._ownerWritableStream)throw Nr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:jr(t._writableStreamController)}(this)}get ready(){return gr(this)?this._readyPromise:Q(Mr("ready"))}abort(e=void 0){return gr(this)?void 0===this._ownerWritableStream?Q(Nr("abort")):function(e,t){return dr(e._ownerWritableStream,t)}(this,e):Q(Mr("abort"))}close(){if(!gr(this))return Q(Mr("close"));const e=this._ownerWritableStream;return void 0===e?Q(Nr("close")):yr(e)?Q(new TypeError("Cannot close an already-closing stream")):wr(this)}releaseLock(){if(!gr(this))throw Mr("releaseLock");void 0!==this._ownerWritableStream&&Pr(this)}write(e=void 0){return gr(this)?void 0===this._ownerWritableStream?Q(Nr("write to")):Or(this,e):Q(Mr("write"))}}function gr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof _r}function wr(e){return fr(e._ownerWritableStream)}function Sr(e,t){"pending"===e._readyPromiseState?Vr(e,t):function(e,t){$r(e,t)}(e,t)}function Pr(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Sr(e,r),function(e,t){"pending"===e._closedPromiseState?Br(e,t):function(e,t){Dr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Or(e,t){const r=e._ownerWritableStream,o=r._writableStreamController,n=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return kr(e,t),1}}(o,t);if(r!==e._ownerWritableStream)return Q(Nr("write to"));const i=r._state;if("errored"===i)return Q(r._storedError);if(yr(r)||"closed"===i)return Q(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return Q(r._storedError);const a=function(e){return Y(((t,r)=>{const o={_resolve:t,_reject:r};e._writeRequests.push(o)}))}(r);return function(e,t,r){try{st(e,t,r)}catch(t){return void kr(e,t)}const o=e._controlledWritableStream;yr(o)||"writable"!==o._state||vr(o,qr(e)),Ir(e)}(o,t,n),a}Object.defineProperties(_r.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),z(_r.prototype.abort,"abort"),z(_r.prototype.close,"close"),z(_r.prototype.releaseLock,"releaseLock"),z(_r.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(_r.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Tr={};class Er{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Rr(this))throw Wr("abortReason");return this._abortReason}get signal(){if(!Rr(this))throw Wr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Rr(this))throw Wr("error");"writable"===this._controlledWritableStream._state&&xr(this,e)}[se](e){const t=this._abortAlgorithm(e);return Ar(this),t}[le](){lt(this)}}function Rr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Er}function Cr(e,t,r,o,n,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,lt(t),t._abortReason=void 0,t._abortController=function(){if(ir)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=o,t._closeAlgorithm=n,t._abortAlgorithm=i;const l=qr(t);vr(e,l),X(K(r()),(()=>(t._started=!0,Ir(t),null)),(r=>(t._started=!0,pr(e,r),null)))}function Ar(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function jr(e){return e._strategyHWM-e._queueTotalSize}function Ir(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void br(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Tr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),at(e);const r=e._closeAlgorithm();Ar(e),X(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&&zr(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),pr(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),X(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(at(e),!yr(r)&&"writable"===t){const t=qr(e);vr(r,t)}return Ir(e),null}),(t=>("writable"===r._state&&Ar(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,pr(e,t)}(r,t),null)))}(e,r)}function kr(e,t){"writable"===e._controlledWritableStream._state&&xr(e,t)}function qr(e){return jr(e)<=0}function xr(e,t){const r=e._controlledWritableStream;Ar(e),hr(r,t)}function Lr(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Wr(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function Mr(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function Nr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Fr(e){e._closedPromise=Y(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function Dr(e,t){Fr(e),Br(e,t)}function Br(e,t){void 0!==e._closedPromise_reject&&(re(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function zr(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 Ur(e){e._readyPromise=Y(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function $r(e,t){Ur(e),Vr(e,t)}function Hr(e){Ur(e),Gr(e)}function Vr(e,t){void 0!==e._readyPromise_reject&&(re(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Gr(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(Er.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Er.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const Yr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,Kr=function(){const e=null==Yr?void 0:Yr.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 z(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function Qr(e,t,r,o,n,i){const a=Ie(e),s=sr(t);e._disturbed=!0;let l=!1,u=K(void 0);return Y(((c,d)=>{let f;if(void 0!==i){if(f=()=>{const r=void 0!==i.reason?i.reason:new Kr("Aborted","AbortError"),a=[];o||a.push((()=>"writable"===t._state?dr(t,r):K(void 0))),n||a.push((()=>"readable"===e._state?So(e,r):K(void 0))),v((()=>Promise.all(a.map((e=>e())))),!0,r)},i.aborted)return void f();i.addEventListener("abort",f)}var p,h,b;if(m(e,a._closedPromise,(e=>(o?_(!0,e):v((()=>dr(t,e)),!0,e),null))),m(t,s._closedPromise,(t=>(n?_(!0,t):v((()=>So(e,t)),!0,t),null))),p=e,h=a._closedPromise,b=()=>(r?_():v((()=>function(e){const t=e._ownerWritableStream,r=t._state;return yr(t)||"closed"===r?K(void 0):"errored"===r?Q(t._storedError):wr(e)}(s))),null),"closed"===p._state?b():Z(h,b),yr(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");n?_(!0,t):v((()=>So(e,t)),!0,t)}function y(){const e=u;return J(u,(()=>e!==u?y():void 0))}function m(e,t,r){"errored"===e._state?r(e._storedError):ee(t,r)}function v(e,r,o){function n(){return X(e(),(()=>g(r,o)),(e=>g(!0,e))),null}l||(l=!0,"writable"!==t._state||yr(t)?n():Z(y(),n))}function _(e,r){l||(l=!0,"writable"!==t._state||yr(t)?g(e,r):Z(y(),(()=>g(e,r))))}function g(e,t){return Pr(s),he(a),void 0!==i&&i.removeEventListener("abort",f),e?d(t):c(void 0),null}re(Y(((e,t)=>{!function r(o){o?e():J(l?K(!0):J(s._readyPromise,(()=>Y(((e,t)=>{Ne(a,{_chunkSteps:t=>{u=J(Or(s,t),void 0,F),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class Jr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Xr(this))throw lo("desiredSize");return io(this)}close(){if(!Xr(this))throw lo("close");if(!ao(this))throw new TypeError("The stream is not in a state that permits close");ro(this)}enqueue(e=void 0){if(!Xr(this))throw lo("enqueue");if(!ao(this))throw new TypeError("The stream is not in a state that permits enqueue");return oo(this,e)}error(e=void 0){if(!Xr(this))throw lo("error");no(this,e)}[ue](e){lt(this);const t=this._cancelAlgorithm(e);return to(this),t}[ce](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=at(this);this._closeRequested&&0===this._queue.length?(to(this),Po(t)):Zr(this),e._chunkSteps(r)}else ke(t,e),Zr(this)}[de](){}}function Xr(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof Jr}function Zr(e){eo(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,X(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Zr(e)),null)),(t=>(no(e,t),null)))))}function eo(e){const t=e._controlledReadableStream;return!!ao(e)&&!!e._started&&(!!(wo(t)&&xe(t)>0)||io(e)>0)}function to(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function ro(e){if(!ao(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(to(e),Po(t))}function oo(e,t){if(!ao(e))return;const r=e._controlledReadableStream;if(wo(r)&&xe(r)>0)qe(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw no(e,t),t}try{st(e,t,r)}catch(t){throw no(e,t),t}}Zr(e)}function no(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(lt(e),to(e),Oo(r,t))}function io(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function ao(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function so(e,t,r,o,n,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,lt(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=o,t._cancelAlgorithm=n,e._readableStreamController=t,X(K(r()),(()=>(t._started=!0,Zr(t),null)),(e=>(no(t,e),null)))}function lo(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function uo(e){return D(t=e)&&void 0!==t.getReader?function(e){let t;return t=mo(F,(function(){let r;try{r=e.read()}catch(r){return Q(r)}return te(r,(e=>{if(!D(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)ro(t._readableStreamController);else{const r=e.value;oo(t._readableStreamController,r)}}))}),(function(t){try{return K(e.cancel(t))}catch(t){return Q(t)}}),0),t}(e.getReader()):function(e){let t;const r=Xe(e,"async");return t=mo(F,(function(){let e;try{e=Ze(r)}catch(e){return Q(e)}return te(K(e),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)ro(t._readableStreamController);else{const r=e.value;oo(t._readableStreamController,r)}}))}),(function(e){const t=r.iterator;let o;try{o=Ke(t,"return")}catch(e){return Q(e)}return void 0===o?K(void 0):te(ie(o,t,[e]),(e=>{if(!D(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}))}),0),t}(e);var t}function co(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function fo(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function po(e,t,r){return Pe(e,r),r=>ne(e,t,[r])}function ho(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function bo(e,t){Se(e,t);const r=null==e?void 0:e.preventAbort,o=null==e?void 0:e.preventCancel,n=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(o),preventClose:Boolean(n),signal:i}}Object.defineProperties(Jr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),z(Jr.prototype.close,"close"),z(Jr.prototype.enqueue,"enqueue"),z(Jr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Jr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class yo{constructor(e={},t={}){void 0===e?e=null:Oe(e,"First parameter");const r=Xt(t,"Second parameter"),o=function(e,t){Se(e,t);const r=e,o=null==r?void 0:r.autoAllocateChunkSize,n=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===o?void 0:Ae(o,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===n?void 0:co(n,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:fo(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:po(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:ho(s,`${t} has member 'type' that`)}}(e,"First parameter");if(_o(this),"bytes"===o.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 o=Object.create(dt.prototype);let n,i,a;n=void 0!==t.start?()=>t.start(o):()=>{},i=void 0!==t.pull?()=>t.pull(o):()=>K(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>K(void 0);const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");Mt(e,o,n,i,a,r,s)}(this,o,Qt(r,0))}else{const e=Jt(r);!function(e,t,r,o){const n=Object.create(Jr.prototype);let i,a,s;i=void 0!==t.start?()=>t.start(n):()=>{},a=void 0!==t.pull?()=>t.pull(n):()=>K(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>K(void 0),so(e,n,i,a,s,r,o)}(this,o,Qt(r,1),e)}}get locked(){if(!go(this))throw To("locked");return wo(this)}cancel(e=void 0){return go(this)?wo(this)?Q(new TypeError("Cannot cancel a stream that already has a reader")):So(this,e):Q(To("cancel"))}getReader(e=void 0){if(!go(this))throw To("getReader");return void 0===function(e,t){Se(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:Dt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Ie(this):Bt(this)}pipeThrough(e,t={}){if(!go(this))throw To("pipeThrough");Te(e,1,"pipeThrough");const r=function(e,t){Se(e,t);const r=null==e?void 0:e.readable;Ee(r,"readable","ReadableWritablePair"),je(r,`${t} has member 'readable' that`);const o=null==e?void 0:e.writable;return Ee(o,"writable","ReadableWritablePair"),nr(o,`${t} has member 'writable' that`),{readable:r,writable:o}}(e,"First parameter"),o=bo(t,"Second parameter");if(wo(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(cr(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return re(Qr(this,r.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal)),r.readable}pipeTo(e,t={}){if(!go(this))return Q(To("pipeTo"));if(void 0===e)return Q("Parameter 1 is required in 'pipeTo'.");if(!ur(e))return Q(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=bo(t,"Second parameter")}catch(e){return Q(e)}return wo(this)?Q(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):cr(e)?Q(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Qr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!go(this))throw To("tee");return $e(function(e){return ft(e._readableStreamController)?function(e){let t,r,o,n,i,a=Ie(e),s=!1,l=!1,u=!1,c=!1,d=!1;const f=Y((e=>{i=e}));function p(e){ee(e._closedPromise,(t=>(e!==a||(It(o._readableStreamController,t),It(n._readableStreamController,t),c&&d||i(void 0)),null)))}function h(){Vt(a)&&(he(a),a=Ie(e),p(a)),Ne(a,{_chunkSteps:t=>{oe((()=>{l=!1,u=!1;const r=t;let a=t;if(!c&&!d)try{a=it(t)}catch(t){return It(o._readableStreamController,t),It(n._readableStreamController,t),void i(So(e,t))}c||jt(o._readableStreamController,r),d||jt(n._readableStreamController,a),s=!1,l?y():u&&m()}))},_closeSteps:()=>{s=!1,c||At(o._readableStreamController),d||At(n._readableStreamController),o._readableStreamController._pendingPullIntos.length>0&&Lt(o._readableStreamController,0),n._readableStreamController._pendingPullIntos.length>0&&Lt(n._readableStreamController,0),c&&d||i(void 0)},_errorSteps:()=>{s=!1}})}function b(t,r){Me(a)&&(he(a),a=Bt(e),p(a));const f=r?n:o,h=r?o:n;Gt(a,t,1,{_chunkSteps:t=>{oe((()=>{l=!1,u=!1;const o=r?d:c;if(r?c:d)o||Wt(f._readableStreamController,t);else{let r;try{r=it(t)}catch(t){return It(f._readableStreamController,t),It(h._readableStreamController,t),void i(So(e,t))}o||Wt(f._readableStreamController,t),jt(h._readableStreamController,r)}s=!1,l?y():u&&m()}))},_closeSteps:e=>{s=!1;const t=r?d:c,o=r?c:d;t||At(f._readableStreamController),o||At(h._readableStreamController),void 0!==e&&(t||Wt(f._readableStreamController,e),!o&&h._readableStreamController._pendingPullIntos.length>0&&Lt(h._readableStreamController,0)),t&&o||i(void 0)},_errorSteps:()=>{s=!1}})}function y(){if(s)return l=!0,K(void 0);s=!0;const e=qt(o._readableStreamController);return null===e?h():b(e._view,!1),K(void 0)}function m(){if(s)return u=!0,K(void 0);s=!0;const e=qt(n._readableStreamController);return null===e?h():b(e._view,!0),K(void 0)}function v(){}return o=vo(v,y,(function(o){if(c=!0,t=o,d){const o=$e([t,r]),n=So(e,o);i(n)}return f})),n=vo(v,m,(function(o){if(d=!0,r=o,c){const o=$e([t,r]),n=So(e,o);i(n)}return f})),p(a),[o,n]}(e):function(e){const t=Ie(e);let r,o,n,i,a,s=!1,l=!1,u=!1,c=!1;const d=Y((e=>{a=e}));function f(){return s?(l=!0,K(void 0)):(s=!0,Ne(t,{_chunkSteps:e=>{oe((()=>{l=!1;const t=e,r=e;u||oo(n._readableStreamController,t),c||oo(i._readableStreamController,r),s=!1,l&&f()}))},_closeSteps:()=>{s=!1,u||ro(n._readableStreamController),c||ro(i._readableStreamController),u&&c||a(void 0)},_errorSteps:()=>{s=!1}}),K(void 0))}function p(){}return n=mo(p,f,(function(t){if(u=!0,r=t,c){const t=$e([r,o]),n=So(e,t);a(n)}return d})),i=mo(p,f,(function(t){if(c=!0,o=t,u){const t=$e([r,o]),n=So(e,t);a(n)}return d})),ee(t._closedPromise,(e=>(no(n._readableStreamController,e),no(i._readableStreamController,e),u&&c||a(void 0),null))),[n,i]}(e)}(this))}values(e=void 0){if(!go(this))throw To("values");return function(e,t){const r=Ie(e),o=new et(r,t),n=Object.create(tt);return n._asyncIteratorImpl=o,n}(this,function(e){Se(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[Je](e){return this.values(e)}static from(e){return uo(e)}}function mo(e,t,r,o=1,n=()=>1){const i=Object.create(yo.prototype);return _o(i),so(i,Object.create(Jr.prototype),e,t,r,o,n),i}function vo(e,t,r){const o=Object.create(yo.prototype);return _o(o),Mt(o,Object.create(dt.prototype),e,t,r,0,void 0),o}function _o(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function go(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof yo}function wo(e){return void 0!==e._reader}function So(e,t){if(e._disturbed=!0,"closed"===e._state)return K(void 0);if("errored"===e._state)return Q(e._storedError);Po(e);const r=e._reader;if(void 0!==r&&Vt(r)){const e=r._readIntoRequests;r._readIntoRequests=new ae,e.forEach((e=>{e._closeSteps(void 0)}))}return te(e._readableStreamController[ue](t),F)}function Po(e){e._state="closed";const t=e._reader;if(void 0!==t&&(_e(t),Me(t))){const e=t._readRequests;t._readRequests=new ae,e.forEach((e=>{e._closeSteps()}))}}function Oo(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(ve(r,t),Me(r)?Fe(r,t):Yt(r,t))}function To(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Eo(e,t){Se(e,t);const r=null==e?void 0:e.highWaterMark;return Ee(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:Re(r)}}Object.defineProperties(yo,{from:{enumerable:!0}}),Object.defineProperties(yo.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),z(yo.from,"from"),z(yo.prototype.cancel,"cancel"),z(yo.prototype.getReader,"getReader"),z(yo.prototype.pipeThrough,"pipeThrough"),z(yo.prototype.pipeTo,"pipeTo"),z(yo.prototype.tee,"tee"),z(yo.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(yo.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(yo.prototype,Je,{value:yo.prototype.values,writable:!0,configurable:!0});const Ro=e=>e.byteLength;z(Ro,"size");class Co{constructor(e){Te(e,1,"ByteLengthQueuingStrategy"),e=Eo(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!jo(this))throw Ao("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!jo(this))throw Ao("size");return Ro}}function Ao(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function jo(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Co}Object.defineProperties(Co.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Co.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Io=()=>1;z(Io,"size");class ko{constructor(e){Te(e,1,"CountQueuingStrategy"),e=Eo(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!xo(this))throw qo("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!xo(this))throw qo("size");return Io}}function qo(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function xo(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof ko}function Lo(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}function Wo(e,t,r){return Pe(e,r),r=>ne(e,t,[r])}function Mo(e,t,r){return Pe(e,r),(r,o)=>ie(e,t,[r,o])}function No(e,t,r){return Pe(e,r),r=>ie(e,t,[r])}Object.defineProperties(ko.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ko.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class Fo{constructor(e={},t={},r={}){void 0===e&&(e=null);const o=Xt(t,"Second parameter"),n=Xt(r,"Third parameter"),i=function(e,t){Se(e,t);const r=null==e?void 0:e.cancel,o=null==e?void 0:e.flush,n=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:No(r,e,`${t} has member 'cancel' that`),flush:void 0===o?void 0:Lo(o,e,`${t} has member 'flush' that`),readableType:n,start:void 0===i?void 0:Wo(i,e,`${t} has member 'start' that`),transform:void 0===a?void 0:Mo(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=Qt(n,0),s=Jt(n),l=Qt(o,1),u=Jt(o);let c;!function(e,t,r,o,n,i){function a(){return t}e._writable=function(e,t,r,o,n=1,i=()=>1){const a=Object.create(ar.prototype);return lr(a),Cr(a,Object.create(Er.prototype),e,t,r,o,n,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?te(e._backpressureChangePromise,(()=>{const o=e._writable;if("erroring"===o._state)throw o._storedError;return Ko(r,t)})):Ko(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=Y(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const o=t._flushAlgorithm();return Go(t),X(o,(()=>("errored"===r._state?Xo(t,r._storedError):(ro(r._readableStreamController),Jo(t)),null)),(e=>(no(r._readableStreamController,e),Xo(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 o=e._readable;r._finishPromise=Y(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const n=r._cancelAlgorithm(t);return Go(r),X(n,(()=>("errored"===o._state?Xo(r,o._storedError):(no(o._readableStreamController,t),Jo(r)),null)),(e=>(no(o._readableStreamController,e),Xo(r,e),null))),r._finishPromise}(e,t)}),r,o),e._readable=mo(a,(function(){return function(e){return $o(e,!1),e._backpressureChangePromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const o=e._writable;r._finishPromise=Y(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const n=r._cancelAlgorithm(t);return Go(r),X(n,(()=>("errored"===o._state?Xo(r,o._storedError):(kr(o._writableStreamController,t),Uo(e),Jo(r)),null)),(t=>(kr(o._writableStreamController,t),Uo(e),Xo(r,t),null))),r._finishPromise}(e,t)}),n,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,$o(e,!0),e._transformStreamController=void 0}(this,Y((e=>{c=e})),l,u,a,s),function(e,t){const r=Object.create(Ho.prototype);let o,n,i;o=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return Yo(r,e),K(void 0)}catch(e){return Q(e)}},n=void 0!==t.flush?()=>t.flush(r):()=>K(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>K(void 0),function(e,t,r,o,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=o,t._cancelAlgorithm=n,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,o,n,i)}(this,i),void 0!==i.start?c(i.start(this._transformStreamController)):c(void 0)}get readable(){if(!Do(this))throw Zo("readable");return this._readable}get writable(){if(!Do(this))throw Zo("writable");return this._writable}}function Do(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof Fo}function Bo(e,t){no(e._readable._readableStreamController,t),zo(e,t)}function zo(e,t){Go(e._transformStreamController),kr(e._writable._writableStreamController,t),Uo(e)}function Uo(e){e._backpressure&&$o(e,!1)}function $o(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=Y((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(Fo.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Fo.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class Ho{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Vo(this))throw Qo("desiredSize");return io(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!Vo(this))throw Qo("enqueue");Yo(this,e)}error(e=void 0){if(!Vo(this))throw Qo("error");var t;t=e,Bo(this._controlledTransformStream,t)}terminate(){if(!Vo(this))throw Qo("terminate");!function(e){const t=e._controlledTransformStream;ro(t._readable._readableStreamController),zo(t,new TypeError("TransformStream terminated"))}(this)}}function Vo(e){return!!D(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof Ho}function Go(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function Yo(e,t){const r=e._controlledTransformStream,o=r._readable._readableStreamController;if(!ao(o))throw new TypeError("Readable side is not in a state that permits enqueue");try{oo(o,t)}catch(e){throw zo(r,e),r._readable._storedError}const n=function(e){return!eo(e)}(o);n!==r._backpressure&&$o(r,!0)}function Ko(e,t){return te(e._transformAlgorithm(t),void 0,(t=>{throw Bo(e._controlledTransformStream,t),t}))}function Qo(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function Jo(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Xo(e,t){void 0!==e._finishPromise_reject&&(re(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function Zo(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(Ho.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),z(Ho.prototype.enqueue,"enqueue"),z(Ho.prototype.error,"error"),z(Ho.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ho.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});var en,tn=(en=function(e,t){return en=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])},en(e,t)},function(e,t){function r(){this.constructor=e}en(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),rn=function(){return rn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},rn.apply(this,arguments)},on="Error when aborting requestTask",nn=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,o=t.timeout,n=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=o||0,r._timeoutMsg=n||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return tn(t,e),t.prototype.post=function(e){var t=this;return new Promise((function(r,o){var n=e.url,i=e.data,a=e.headers,s=wx.request({url:u("https:",n),data:i,timeout:t._timeout,method:"POST",header:a,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):o(e)},fail:function(e){o(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.get=function(e){var t=this;return new Promise((function(r,o){var n=e.url,i=e.body,a=e.headers,s=u("https:",n),l=wx.request({url:s,data:i,timeout:t._timeout,method:"GET",header:a,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):o(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("get")&&e.errMsg.includes("timeout")){console.warn(t._timeoutMsg);try{l.abort()}catch(e){console.warn(on,e)}}}})}))},t.prototype.upload=function(e){var t=this,r=this;return new Promise((function(o){return function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var t,n,i,a,s,l;return function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{r=n=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,n=e.file,i=e.data,a=e.headers,s=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:n,name:"file",formData:rn({},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)),o(t)},fail:function(e){o(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(o,n){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?o({statusCode:200,tempFilePath:e.tempFilePath}):o(e)},fail:function(e){n(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,o=e.enableAbort,n=e.headers,i=e.method,a=e.stream,s=void 0!==a&&a,l=e.signal,c=e.timeout,d=this,f=null!=c?c:this._timeout,p=null,h=new yo({start:function(e){p=e},cancel:function(){p=null}});return new Promise((function(e,a){s&&e({data:h});var c=wx.request({url:u("https:",t),data:r,timeout:f,method:i.toUpperCase(),header:n,success:function(t){var r;null===(r=p)||void 0===r||r.close(),!s&&e(t)},fail:function(e){var t;if(null===(t=p)||void 0===t||t.close(),a(e),s)throw e},complete:function(e){if(e&&e.errMsg&&f&&-1!==d._restrictedMethods.indexOf("post")&&o&&"request:fail timeout"===e.errMsg){console.warn(d._timeoutMsg);try{c.abort()}catch(e){console.warn(on,e)}}},enableChunked:s});if(c.onChunkReceived((function(e){var t;null===(t=p)||void 0===t||t.enqueue(new Uint8Array(e.data))})),l){var b=function(){try{c.abort()}catch(e){console.warn(on,e)}};l.aborted?b():l.addEventListener("abort",(function(){return b()}))}}))},t}(l),an={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()}},sn=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(rn({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}};function ln(e){var t={},r=e.replace(/^[?#]/,"");return r?(r.split("&").forEach((function(e){var r=e.split("="),o=r[0],n=r[1];o=decodeURIComponent(o),n=decodeURIComponent(n),o&&(t[o]?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n)})),t):t}var un={genAdapter:function(e){return{root:{globalThis:{}},reqClass:nn,wsClass:sn,captchaOptions:{openURIWithCallback:function(t){var r=e.EventBus,o={},n=t;console.log("openURIWithCallback",t);var i=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){n=i[1],console.log("openURIWithCallback url",n);var a=i[2];a&&(o=ln(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,l=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(o,["token"]);return/^data:/.test(n)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: "+t}):s?new Promise((function(e){console.log("wait for captcha..."),r.$emit("CAPTCHA_DATA_CHANGE",rn(rn({},l),{token:s,url:n})),r.$once("RESOLVE_CAPTCHA_DATA",(function(t){e(t)}))})):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:an,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"},cn=function(){return cn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},cn.apply(this,arguments)},dn={},fn=function(){return fn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},fn.apply(this,arguments)},pn=T,hn={},bn={};function yn(e){var t=e.env,r=e.platformInfo,o={userInfoKey:"".concat("user_info","_").concat(t)};hn[t]=hn[t]||new pn(fn(fn({},e),{keys:o,platformInfo:r})),bn[t]=bn[t]||new pn(fn(fn({},e),{keys:o,platformInfo:r,persistence:"local"}))}function mn(e){return bn[e]}var vn=function(){return vn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},vn.apply(this,arguments)},_n=["ap-shanghai","ap-guangzhou","ap-shenzhen-fsi","ap-shanghai-fsi","ap-nanjing","ap-beijing","ap-chengdu","ap-chongqing","ap-hongkong"],gn="",wn="@cloudbase/js-sdk";function Sn(){return gn}var Pn,On=[],Tn=["env","endPointKey","region"],En="https:";function Rn(e){return On.find((function(t){return Tn.filter((function(t){return null!=e[t]})).every((function(r){return t[r]===e[r]}))}))}function Cn(e){var t,r;e.protocol&&!/:$/.test(e.protocol)&&(e.protocol="".concat(e.protocol,":"));var o,n=Rn(e);n?(null!=e.baseUrl&&(n.baseUrl=e.baseUrl),null!=e.protocol&&(n.protocol=e.protocol)):On.push(vn(vn({},e),{protocol:null!==(t=e.protocol)&&void 0!==t?t:En})),"CLOUD_API"===e.endPointKey&&(o=null!==(r=e.protocol)&&void 0!==r?r:En,a=o)}function An(e,t,r){return Rn({env:e,endPointKey:t,region:r})}function jn(e,t){void 0===t&&(t="CLOUD_API");var r=An(e,t||"CLOUD_API"),o=r.protocol,n=r.baseUrl;return"".concat(o).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"}(Pn||(Pn={}));var In=function(){return In=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},In.apply(this,arguments)},kn=function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},qn=function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},xn=s,Ln=c,Wn=d,Mn=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function Nn(e,t,r){var o=e[t];e[t]=function(t){var n={},i={};r.forEach((function(r){var o=r.call(e,t),a=o.data,s=o.headers;Object.assign(n,a),Object.assign(i,s)}));var a=t.data;return a&&(Ln(a)?Object.keys(n).forEach((function(e){a.append(e,n[e])})):t.data=In(In({},a),n)),t.headers=In(In({},t.headers||{}),i),o.call(e,t)}}function Fn(){var e=Math.random().toString(16).slice(2);return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(Sn()),"x-seqid":e}}}var Dn,Bn,zn=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 dn.adapter.reqClass(r),this.throwWhenRequestFail=e.throw||!1,this.localCache=mn(this.config.env),"GATEWAY"!==this.config.endPointMode&&(Nn(this.reqClass,"post",[Fn]),Nn(this.reqClass,"upload",[Fn]),Nn(this.reqClass,"download",[Fn])),j.on(I,(function(e){var r;t.config.i18n=(null===(r=e.data)||void 0===r?void 0:r.i18n)||t.config.i18n}))}return e.prototype.getAccessToken=function(e){return void 0===e&&(e=null),kn(this,void 0,void 0,(function(){var t,r,o;return qn(this,(function(n){switch(n.label){case 0:if(null!=e)return[2,e];if(!(t=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return r=t.oauthInstance,o=r.oauth2client,[4,this.getOauthAccessTokenV2(o)];case 1:return[2,n.sent().accessToken]}}))}))},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["X-SDK-Version"]="@cloudbase/js-sdk/".concat(Sn()),e},e.prototype.post=function(e,t){return kn(this,void 0,void 0,(function(){return qn(this,(function(r){switch(r.label){case 0:return[4,this.reqClass.post(In(In({},e),{headers:In(In({},e.headers),this.getDefaultHeaders()),customReqOpts:t}))];case 1:return[2,r.sent()]}}))}))},e.prototype.upload=function(e){return kn(this,void 0,void 0,(function(){return qn(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.upload(In(In({},e),{headers:In(In({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return kn(this,void 0,void 0,(function(){return qn(this,(function(t){switch(t.label){case 0:return[4,this.reqClass.download(In(In({},e),{headers:In(In({},e.headers),this.getDefaultHeaders())}))];case 1:return[2,t.sent()]}}))}))},e.prototype.getBaseEndPoint=function(e){return void 0===e&&(e="CLOUD_API"),jn(this.config.env,e)},e.prototype.getOauthAccessTokenV2=function(e){return kn(this,void 0,void 0,(function(){var t,r;return qn(this,(function(o){switch(o.label){case 0:return[4,e.getAccessToken()];case 1:return t=o.sent(),[4,e.getCredentials()];case 2:return r=o.sent(),[2,{accessToken:t,accessTokenExpire:new Date(r.expires_at).getTime()}]}}))}))},e.prototype.request=function(e,t,r,o){var n,i;return kn(this,void 0,void 0,(function(){var a,s,l,u,c,d,f,p,h,b,y,m,v,_,g,w,S,P,O,T,E;return qn(this,(function(R){switch(R.label){case 0:if(a="x-tcb-trace_".concat(this.config.env),s="application/x-www-form-urlencoded",l=In({action:e,dataVersion:"2020-01-10",env:this.config.env},t),-1!==Mn.indexOf(e))return[3,2];if(!(u=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return c=u.oauthInstance,d=c.oauth2client,f=l,[4,this.getOauthAccessTokenV2(d)];case 1:f.access_token=R.sent().accessToken,R.label=2;case 2:return"storage.uploadFile"===e?(p=new FormData,Object.keys(p).forEach((function(e){Object.prototype.hasOwnProperty.call(p,e)&&void 0!==p[e]&&p.append(e,l[e])})),s="multipart/form-data"):(s="application/json;charset=UTF-8",p={},Object.keys(l).forEach((function(e){void 0!==l[e]&&(p[e]=l[e])}))),h={headers:In({"content-type":s},this.getDefaultHeaders())},(null==r?void 0:r.onUploadProgress)&&(h.onUploadProgress=r.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(b=this.localCache.getStore(a))&&(h.headers["X-TCB-Trace"]=b),y=void 0!==(null==r?void 0:r.parse)?r.parse:t.parse,m=void 0!==(null==r?void 0:r.inQuery)?r.inQuery:t.inQuery,v=void 0!==(null==r?void 0:r.search)?r.search:t.search,_=In(In({},(null==r?void 0:r.defaultQuery)||{}),{env:this.config.env}),y&&(_.parse=!0),m&&(_=In(In({},m),_)),g=this.config.endPointMode||"CLOUD_API",w=An(this.config.env,g),S=w.baseUrl,P=w.protocol,"GATEWAY"===g&&("functions.invokeFunction"===e||/^(storage|database)\./.test(e))&&(S="".concat(S.match(/\/\/([^/?#]*)/)[0],"/web")),O=r.pathname?Wn(P,"".concat(null===(n=jn(this.config.env,g))||void 0===n?void 0:n.replace(/^https?:/,""),"/").concat(r.pathname),_):Wn(P,S,_),v&&(O+=v),[4,this.post(In({url:O,data:p},h),o)];case 3:if(T=R.sent(),(E=null===(i=T.header)||void 0===i?void 0:i["x-tcb-trace"])&&this.localCache.setStore(a,E),200!==Number(T.status)&&200!==Number(T.statusCode)||!T.data)throw new Error("network request error");return[2,T]}}))}))},e.prototype.fetch=function(e){var t,r,o,n,i,a,s,l;return kn(this,void 0,void 0,(function(){var u,c,d,f,p,h,b=this;return qn(this,(function(y){switch(y.label){case 0:u=e.token,c=e.headers,d=void 0===c?{}:c,f=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(e,["token","headers"]),p=function(){return kn(b,void 0,void 0,(function(){var e,t,r,o,n;return qn(this,(function(i){switch(i.label){case 0:return t=(e=this.reqClass).fetch,o={},n={"X-SDK-Version":"@cloudbase/js-sdk/".concat(Sn())},r="Bearer ".concat,[4,this.getAccessToken(u)];case 1:return[2,t.apply(e,[In.apply(void 0,[(o.headers=In.apply(void 0,[In.apply(void 0,[(n.Authorization=r.apply("Bearer ",[i.sent()]),n),this.getDefaultHeaders()]),d]),o),f])])]}}))}))},y.label=1;case 1:return y.trys.push([1,3,,6]),[4,p()];case 2:return[2,y.sent()];case 3:if("ACCESS_TOKEN_EXPIRED"!==(null==(h=y.sent())?void 0:h.code))return[3,5];if("function"!=typeof(null===(n=null===(o=null===(r=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===r?void 0:r.oauthInstance)||void 0===o?void 0:o.authApi)||void 0===n?void 0:n.refreshTokenForce))throw h;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 y.sent(),[2,p()];case 5:throw h;case 6:return[2]}}))}))},e.prototype.send=function(e,t,r,o){return void 0===t&&(t={}),void 0===r&&(r={}),kn(this,void 0,void 0,(function(){var n;return qn(this,(function(i){switch(i.label){case 0:return[4,this.request(e,t,In(In({},r),{onUploadProgress:t.onUploadProgress}),o)];case 1:if((n=i.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:xn.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},e.prototype.gateWay=function(e,t){return kn(this,void 0,void 0,(function(){var r,o,n,i,a,s,l,u,c,d,f,p,h,b,y,m;return qn(this,(function(v){switch(v.label){case 0:if(r=e.name,o=e.data,n=e.path,i=void 0===n?"":n,a=e.method,s=e.header,l=void 0===s?{}:s,!r||!i)throw new Error(JSON.stringify({code:xn.INVALID_PARAMS,msg:"[gateWay] invalid function name or path"}));try{u=o?JSON.stringify(o):""}catch(e){throw new Error(JSON.stringify({code:xn.INVALID_PARAMS,msg:"[gateWay] invalid data"}))}return c=function(){var e=(new Date).getTime(),t=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var o=16*Math.random();return e>0?(o=(e+o)%16|0,e=Math.floor(e/16)):(o=(t+o)%16|0,t=Math.floor(t/16)),("x"===r?o:7&o|8).toString(16)}))}(),d=An(this.config.env,"GATEWAY"),f=d.baseUrl,p=d.protocol,h="".concat(p).concat(f,"/").concat(i,"/").concat(r),[4,this.fetch({method:a||"POST",headers:In({"Content-Type":"application/json; charset=utf-8","X-Request-Id":c},l),body:u,url:h,customReqOpts:t})];case 1:return b=v.sent(),y=[In({requestId:c},b)],m={},[4,b.data];case 2:return[2,In.apply(void 0,y.concat([(m.data=v.sent(),m)]))]}}))}))},e}(),Un={};!function(e){e.ZH="zh-CN",e.EN="en-US"}(Bn||(Bn={}));var $n=((Dn={})[Bn.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"},Dn),Hn=function(e,t){var r;return(null===(r=$n[t])||void 0===r?void 0:r[e])||e},Vn=function(e,t){var r,o,n=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,n))||Bn.ZH;return null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,n,a),new Proxy({t:function(e){return Hn(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,n))||e[t]},set:function(e,t,r){var o;return"lang"===t&&r!==e[t]&&(e[t]=r,e.t=function(e){return Hn(e,r)},null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,n,r),j.fire(I,{i18n:e})),e[t]=r,!0}})},Gn=function(){return Gn=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Gn.apply(this,arguments)},Yn=function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},Kn=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Qn=s,Jn="https://support.qq.com/products/148793",Xn=f,Zn=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,r){}},ei={timeout:15e3,persistence:"local"},ti=6e5,ri={},oi=function(){function e(e){this.cloudbaseConfig=e||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.version=Sn()}return Object.defineProperty(e.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return dn},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return e=this.cloudbaseConfig.env,hn[e];var e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return mn(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return e=this.cloudbaseConfig.env,Un[e];var e},enumerable:!1,configurable:!0}),e.prototype.init=function(t){var r;if(!t.env)throw new Error(JSON.stringify({code:Qn.INVALID_PARAMS,msg:"env must not be specified"}));dn.adapter||this.useDefaultAdapter();var o={timeout:t.timeout||5e3,timeoutMsg:"[".concat(wn,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(t.timeout/1e3,"s")};this.requestClient=new dn.adapter.reqClass(o),this.cloudbaseConfig=Gn(Gn(Gn({},ei),t),{i18n:Vn(dn,t)}),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var n=this.cloudbaseConfig,i=n.env,a=n.persistence,s=n.debug,l=n.timeout,u=n.oauthClient,c=n.i18n;yn({env:i,persistence:a,debug:s,platformInfo:this.platform}),function(e,t){Cn({env:e,region:t,baseUrl:"//".concat(e,".").concat(t||"ap-shanghai",".tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(i,t.region||""),function(e,t,r){void 0===r&&(r="ap-shanghai"),r=r||"ap-shanghai";var o="//".concat(e,".api.tcloudbasegateway.com/v1");_n.includes(r)||(o="//".concat(e,".api.intl.tcloudbasegateway.com/v1")),Cn({endPointKey:"GATEWAY",env:e,baseUrl:o,protocol:t})}(i,En,t.region||"");var d=new e(this.cloudbaseConfig);return function(e){Un[e.env]=new zn(In(In({},e),{throw:!0}))}({env:i,region:t.region||"",timeout:l,oauthClient:u,_fromApp:d,i18n:c,endPointMode:t.endPointMode}),d.requestClient=this.requestClient,null===(r=null==this?void 0:this.fire)||void 0===r||r.call(this,"cloudbase_init",d),this.try2InitAuth(t,d),d},e.prototype.updateConfig=function(e){var t=e.persistence,r=e.debug;this.cloudbaseConfig.persistence=t,this.cloudbaseConfig.debug=r,yn({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){ri[e.name]=e},e.prototype.invokeExtension=function(e,t){return function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))}(this,void 0,void 0,(function(){var r;return function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}(this,(function(o){switch(o.label){case 0:if(!(r=ri[e]))throw new Error(JSON.stringify({code:Qn.INVALID_PARAMS,msg:"extension:".concat(e," must be registered before invoke")}));return[4,r.invoke(t,this)];case 1:return[2,o.sent()]}}))}))},e.prototype.useAdapters=function(e,t){var r=function(e,t){for(var r,o=0,n=(r=e,"[object Array]"===Object.prototype.toString.call(r)?e:[e]);o<n.length;o++){var i=n[o],a=i.isMatch,s=i.genAdapter,l=i.runtime;if(a())return{adapter:g({isMatch:a},s(t)),runtime:l}}}(e,t)||{},o=r.adapter,n=r.runtime;o&&(dn.adapter=o),n&&(dn.runtime=n)},e.prototype.registerHook=function(t){!function(e,t){var r=t.entity,o=t.target;if(Object.prototype.hasOwnProperty.call(e,o))throw new Error(JSON.stringify({code:L.INVALID_OPERATION,msg:"target:".concat(o," is not exist")}));var n=e.prototype[o];if("function"!=typeof n)throw new Error(JSON.stringify({code:L.INVALID_OPERATION,msg:"target:".concat(o," is not a function which is the only type supports hook")}));e.prototype[o]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.call.apply(r,x([this],e,!1)),n.call.apply(n,x([this],e,!1))}}(e,t)},e.prototype.registerComponent=function(t){M(e,t)},e.prototype.registerVersion=function(e){!function(e){gn=e}(e),this.version=e},e.prototype.registerSdkName=function(e){!function(e){wn=e,function(e){o=e}(e)}(e)},e.prototype.registerEndPoint=function(e,t){Cn({baseUrl:e,protocol:t,env:this.config.env,endPointKey:"CLOUD_API"})},e.prototype.registerEndPointWithKey=function(e){Cn({env:this.config.env,endPointKey:e.key,baseUrl:e.url,protocol:e.protocol})},e.prototype.getEndPointWithKey=function(e){var t=An(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 o=r[2];o&&(t=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var r=e.split("="),o=r[0],n=r[1];o=decodeURIComponent(o),n=decodeURIComponent(n),o&&(t[o]?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n)})),t}(o))}var n=t.token,i=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(t,["token"]);return/^data:/.test(e)&&!n?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:n?{state:i.state,token:n,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:h.WEB},t=e.adapter,r=e.runtime;dn.adapter=t,dn.runtime=r},e.prototype.formatTimeout=function(e){switch(!0){case e>ti:return Xn(Qn.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),ti;case e<100:return Xn(Qn.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},e.prototype.try2InitAuth=function(e,t){try{e.accessKey&&t.auth()}catch(e){console.log("try2InitAuth error:",e)}},Yn([Zn({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(Jn)]}),Kn("design:type",Function),Kn("design:paramtypes",[Object]),Kn("design:returntype",e)],e.prototype,"init",null),Yn([Zn({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Jn)]}),Kn("design:type",Function),Kn("design:paramtypes",[String,Object]),Kn("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}(),ni=new oi;ni.useAdapters((nn.prototype.upload=function(e){var t=this,r=this;return new Promise((function(o){var n=e.url,i=e.file,a=e.data,s=e.headers,l=wx.getFileSystemManager(),u=wx.request({url:n,method:e.method,header:cn({"content-type":" "},s),data:l.readFileSync(i),timeout:t._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&(null==a?void 0:a.success_action_status)&&(t.statusCode=parseInt(a.success_action_status,10)),o(t)},fail:function(e){o(e)},complete:function(e){if((null==e?void 0:e.errMsg)&&r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{u.abort()}catch(e){}}}})}))},un.genAdapter=function(e){return{root:{globalThis:{}},reqClass:nn,wsClass:sn,captchaOptions:{openURIWithCallback:function(t){var r=e.EventBus,o={},n=t;console.log("openURIWithCallback",t);var i=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){n=i[1],console.log("openURIWithCallback url",n);var a=i[2];a&&(o=ln(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,l=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(o,["token"]);return/^data:/.test(n)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: ".concat(t)}):s?new Promise((function(e){console.log("wait for captcha..."),r.$emit("CAPTCHA_DATA_CHANGE",cn(cn({},l),{token:s,url:n})),r.$once("RESOLVE_CAPTCHA_DATA",(function(t){e(t)}))})):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:an,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:""}}},un));var ii=ni},47:function(e){var t=function(e){"use strict";var t,r=Object.prototype,o=r.hasOwnProperty,n=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,o){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new j(o||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f="suspendedStart",p="suspendedYield",h="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(I([])));S&&S!==r&&o.call(S,a)&&(g=S);var P=_.prototype=m.prototype=Object.create(g);function O(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(n,i,a,s){var l=d(e[n],e,i);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==typeof c&&o.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;n(this,"_invoke",{value:function(e,o){function n(){return new t((function(t,n){r(e,o,t,n)}))}return i=i?i.then(n,n):n()}})}function E(e,r,o){var n=f;return function(i,a){if(n===h)throw new Error("Generator is already running");if(n===b){if("throw"===i)throw a;return{value:t,done:!0}}for(o.method=i,o.arg=a;;){var s=o.delegate;if(s){var l=R(s,o);if(l){if(l===y)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if(n===f)throw n=b,o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n=h;var u=d(e,r,o);if("normal"===u.type){if(n=o.done?b:p,u.arg===y)continue;return{value:u.arg,done:o.done}}"throw"===u.type&&(n=b,o.method="throw",o.arg=u.arg)}}}function R(e,r){var o=r.method,n=e.iterator[o];if(n===t)return r.delegate=null,"throw"===o&&e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method)||"return"!==o&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+o+"' method")),y;var i=d(n,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 C(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 A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function I(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 n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],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=_,n(P,"constructor",{value:_,configurable:!0}),n(_,"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(P),e},e.awrap=function(e){return{__await:e}},O(T.prototype),u(T.prototype,s,(function(){return this})),e.AsyncIterator=T,e.async=function(t,r,o,n,i){void 0===i&&(i=Promise);var a=new T(c(t,r,o,n),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(P),u(P,l,"Generator"),u(P,a,(function(){return this})),u(P,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var o in t)r.push(o);return r.reverse(),function e(){for(;r.length;){var o=r.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},e.values=I,j.prototype={constructor:j,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(A),!e)for(var r in this)"t"===r.charAt(0)&&o.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 n(o,n){return s.type="throw",s.arg=e,r.next=o,n&&(r.method="next",r.arg=t),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),u=o.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;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),A(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 o=r.completion;if("throw"===o.type){var n=o.arg;A(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,o){return this.delegate={iterator:I(e),resultName:r,nextLoc:o},"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=JSON.parse('{"version":"2.23.4-alpha.0"}')}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}return r.d=function(e,t){for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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)}()}));
|