@cloudbase/js-sdk
Version:
cloudbase javascript sdk
2 lines • 119 kB
JavaScript
/*! For license information please see app.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase",[],t):"object"==typeof exports?exports.cloudbase=t():e.cloudbase=t()}("undefined"!=typeof window?window:this,(function(){return function(){var e={23:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},o=n(r(353)),i=n(r(878));o.default.registerVersion(i.default.version);try{window.cloudbase=o.default}catch(e){}t.default=o.default,e.exports=o.default},353:function(e,t,r){"use strict";r.r(t),r.d(t,{LANGS:function(){return Fo},cloudbase:function(){return di},default:function(){return fi},getBaseEndPoint:function(){return Co}});var n="@cloudbase/js-sdk";function o(){return n}var i,a="https:",s={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};!function(e){e.local="local",e.none="none",e.session="session"}(i||(i={}));var u=function(){};function l(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}function c(e){return"[object FormData]"===Object.prototype.toString.call(e)}function d(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach((function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)}function f(e,t){console.warn("[".concat(o(),"][").concat(e,"]:").concat(t))}var h,p,b=(h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},h(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),y=function(){return y=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},y.apply(this,arguments)},m=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},v=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},_=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return b(t,e),t.prototype.get=function(e){return this.request(y(y({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(y(y({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(y(y({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,i=e.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===s?(Object.keys(t).forEach((function(e){u.append(e,t[e])})),u.append("key",n),u.append("file",r),this.request(y(y({},e),{data:u,method:s}),this.restrictedMethods.includes("upload"))):this.request(y(y({},e),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return m(this,void 0,void 0,(function(){var t,r,n,o;return v(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(y(y({},e),{headers:{},responseType:"blob"}))];case 1:return t=i.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return m(this,void 0,void 0,(function(){var r,n,o,i,a,s,u,l,c,d,f,h=this;return v(this,(function(p){switch(p.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,i=void 0!==o&&o,a=e.stream,s=void 0!==a&&a,u=e.signal,l=e.timeout,c=null!=l?l:this.timeout,u&&(u.aborted&&r.abort(),u.addEventListener("abort",(function(){return r.abort()}))),d=null,i&&c&&(d=setTimeout((function(){console.warn(h.timeoutMsg),r.abort(new Error(h.timeoutMsg))}),c)),[4,fetch(n,y(y({},e),{signal:r.signal})).then((function(e){return m(h,void 0,void 0,(function(){var t,r,n;return v(this,(function(o){switch(o.label){case 0:return clearTimeout(d),e.ok?(t=e,[3,3]):[3,1];case 1:return n=(r=Promise).reject,[4,e.json()];case 2:t=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,t]}}))}))})).catch((function(e){return clearTimeout(d),Promise.reject(e)}))];case 1:return f=p.sent(),[2,{data:s?f.body:(null===(t=f.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?f.json():f.text(),statusCode:f.status,header:f.headers}]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,u=e.url,l=e.headers,f=void 0===l?{}:l,h=e.data,p=e.responseType,b=e.withCredentials,y=e.body,m=e.onUploadProgress,v=d(a,u,"get"===n?h:{}),_=new XMLHttpRequest;_.open(n,v),p&&(_.responseType=p),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(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o})),e.header=r,e.statusCode=_.status;try{e.data="blob"===p?_.response:JSON.parse(_.responseText)}catch(t){e.data="blob"===p?_.response:_.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),_.abort()}),r.timeout)),s=c(h)?h:"application/x-www-form-urlencoded"===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("&")}(h):y||(h?JSON.stringify(h):void 0),b&&(_.withCredentials=!0),_.send(s)}))},t}(u),g=function(){return g=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},g.apply(this,arguments)};!function(e){e.WEB="web",e.WX_MP="wx_mp"}(p||(p={}));var w=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),S=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},O=function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},P=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return w(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}((function(){})),E=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(f(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new P(t.root));case"none":return new P(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:s.OPERATION_FAIL,msg:"[".concat(o(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:e}))}}else 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 n;return O(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}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 n;return O(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):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 O(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}(),T=function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),R=function(e,t){this.data=t||null,this.name=e},A=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return T(t,e),t}(R),C=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof A)return console.error(e.error),this;var r="string"==typeof e?new R(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([],this.listeners[n],!0):[];o<i.length;o++)i[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new C;var I=new C,j="lang_change";function k(e){this.message=e}function q(e){this.message=e}function x(){}function L(e){return"object"==typeof e&&null!==e||"function"==typeof e}"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),k.prototype=new Error,k.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),q.prototype=new Error,q.prototype.name="InvalidTokenError";const N=x;function W(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const M=Promise,D=Promise.resolve.bind(M),F=Promise.prototype.then,B=Promise.reject.bind(M),U=D;function z(e){return new M(e)}function $(e){return z((t=>t(e)))}function V(e){return B(e)}function H(e,t,r){return F.call(e,t,r)}function Y(e,t,r){H(H(e,t,r),void 0,N)}function G(e,t){Y(e,t)}function K(e,t){Y(e,void 0,t)}function Q(e,t,r){return H(e,t,r)}function J(e){H(e,void 0,N)}let X=e=>{if("function"==typeof queueMicrotask)X=queueMicrotask;else{const e=$(void 0);X=t=>H(e,t)}return X(e)};function Z(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function ee(e,t,r){try{return $(Z(e,t,r))}catch(e){return V(e)}}class te{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let n=r+1;const o=e._elements,i=o[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),o[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,n=r._elements;for(;!(t===n.length&&void 0===r._next||t===n.length&&(r=r._next,n=r._elements,t=0,0===n.length));)e(n[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const re=Symbol("[[AbortSteps]]"),ne=Symbol("[[ErrorSteps]]"),oe=Symbol("[[CancelSteps]]"),ie=Symbol("[[PullSteps]]"),ae=Symbol("[[ReleaseSteps]]");function se(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?de(e):"closed"===t._state?function(e){de(e),pe(e)}(e):fe(e,t._storedError)}function ue(e,t){return mn(e._ownerReadableStream,t)}function le(e){const t=e._ownerReadableStream;"readable"===t._state?he(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){fe(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[ae](),t._reader=void 0,e._ownerReadableStream=void 0}function ce(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function de(e){e._closedPromise=z(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function fe(e,t){de(e),he(e,t)}function he(e,t){void 0!==e._closedPromise_reject&&(J(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function pe(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const be=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},ye=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function me(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function ve(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function _e(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function ge(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function we(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function Se(e){return Number(e)}function Oe(e){return 0===e?0:e}function Pe(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Oe(n),!be(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Oe(ye(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return be(n)&&0!==n?n:0}function Ee(e,t){if(!bn(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Te(e){return new je(e)}function Re(e,t){e._reader._readRequests.push(t)}function Ae(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function Ce(e){return e._reader._readRequests.length}function Ie(e){const t=e._reader;return void 0!==t&&!!ke(t)}class je{constructor(e){if(ge(e,1,"ReadableStreamDefaultReader"),Ee(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");se(this,e),this._readRequests=new te}get closed(){return ke(this)?this._closedPromise:V(Le("closed"))}cancel(e=void 0){return ke(this)?void 0===this._ownerReadableStream?V(ce("cancel")):ue(this,e):V(Le("cancel"))}read(){if(!ke(this))return V(Le("read"));if(void 0===this._ownerReadableStream)return V(ce("read from"));let e,t;const r=z(((r,n)=>{e=r,t=n}));return qe(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!ke(this))throw Le("releaseLock");void 0!==this._ownerReadableStream&&function(e){le(e),xe(e,new TypeError("Reader was released"))}(this)}}function ke(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof je}function qe(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[ie](t)}function xe(e,t){const r=e._readRequests;e._readRequests=new te,r.forEach((e=>{e._errorSteps(t)}))}function Le(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var Ne,We,Me;function De(e){return e.slice()}function Fe(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(je.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),W(je.prototype.cancel,"cancel"),W(je.prototype.read,"read"),W(je.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(je.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let Be=e=>(Be="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,Be(e)),Ue=e=>(Ue="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,Ue(e));function ze(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return Fe(o,0,e,t,n),o}function $e(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(`${String(t)} is not a function`);return r}}function Ve(e){try{const t=e.done,r=e.value;return H(U(r),(e=>({done:t,value:e})))}catch(e){return V(e)}}const He=null!==(Me=null!==(Ne=Symbol.asyncIterator)&&void 0!==Ne?Ne:null===(We=Symbol.for)||void 0===We?void 0:We.call(Symbol,"Symbol.asyncIterator"))&&void 0!==Me?Me:"@@asyncIterator";function Ye(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=$e(e,He)))return function(e){const t={next(){let t;try{t=Ge(e)}catch(e){return V(e)}return Ve(t)},return(t){let r;try{const n=$e(e.iterator,"return");if(void 0===n)return $({done:!0,value:t});r=Z(n,e.iterator,[t])}catch(e){return V(e)}return L(r)?Ve(r):V(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(Ye(e,"sync",$e(e,Symbol.iterator)))}else r=$e(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const n=Z(r,e,[]);if(!L(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function Ge(e){const t=Z(e.nextMethod,e.iterator,[]);if(!L(t))throw new TypeError("The iterator.next() method must return an object");return t}class Ke{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?Q(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?Q(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const n=z(((e,n)=>{t=e,r=n}));return qe(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,X((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,le(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,le(e),r(t)}}),n}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=ue(t,e);return le(t),Q(r,(()=>({value:e,done:!0})))}return le(t),$({value:e,done:!0})}}const Qe={next(){return Je(this)?this._asyncIteratorImpl.next():V(Xe("next"))},return(e){return Je(this)?this._asyncIteratorImpl.return(e):V(Xe("return"))},[He](){return this}};function Je(e){if(!L(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof Ke}catch(e){return!1}}function Xe(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(Qe,He,{enumerable:!1});const Ze=Number.isNaN||function(e){return e!=e};function et(e){const t=ze(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function tt(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function rt(e,t,r){if("number"!=typeof(n=r)||Ze(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function nt(e){e._queue=new te,e._queueTotalSize=0}function ot(e){return e===DataView}class it{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ut(this))throw qt("view");return this._view}respond(e){if(!ut(this))throw qt("respond");if(ge(e,1,"respond"),e=Pe(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ue(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");It(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ut(this))throw qt("respondWithNewView");if(ge(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(Ue(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");jt(this._associatedReadableByteStreamController,e)}}Object.defineProperties(it.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),W(it.prototype.respond,"respond"),W(it.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class at{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!st(this))throw xt("byobRequest");return At(this)}get desiredSize(){if(!st(this))throw xt("desiredSize");return Ct(this)}close(){if(!st(this))throw xt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError(`The stream (in ${e} state) is not in the readable state and cannot be closed`);Pt(this)}enqueue(e){if(!st(this))throw xt("enqueue");if(ge(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be enqueued to`);Et(this,e)}error(e=void 0){if(!st(this))throw xt("error");Tt(this,e)}[oe](e){ct(this),nt(this);const t=this._cancelAlgorithm(e);return Ot(this),t}[ie](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Rt(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let n;try{n=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}Re(t,e),lt(this)}[ae](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new te,this._pendingPullIntos.push(e)}}}function st(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof at}function ut(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof it}function lt(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Ie(t)&&Ce(t)>0)||(!!(Dt(t)&&Mt(t)>0)||Ct(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,Y(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,lt(e)),null)),(t=>(Tt(e,t),null)))))}function ct(e){_t(e),e._pendingPullIntos=new te}function dt(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=ft(t);"default"===t.readerType?Ae(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function ft(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function ht(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function pt(e,t,r,n){let o;try{o=ze(t,r,r+n)}catch(t){throw Tt(e,t),t}ht(e,o,0,n)}function bt(e,t){t.bytesFilled>0&&pt(e,t.buffer,t.byteOffset,t.bytesFilled),St(e)}function yt(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const a=n-n%t.elementSize;a>=t.minimumFill&&(o=a-t.bytesFilled,i=!0);const s=e._queue;for(;o>0;){const r=s.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;Fe(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?s.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,mt(0,n,t),o-=n}return i}function mt(e,t,r){r.bytesFilled+=t}function vt(e){0===e._queueTotalSize&&e._closeRequested?(Ot(e),vn(e._controlledReadableByteStream)):lt(e)}function _t(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function gt(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();yt(e,t)&&(St(e),dt(e._controlledReadableByteStream,t))}}function wt(e,t){const r=e._pendingPullIntos.peek();_t(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&St(e);const r=e._controlledReadableByteStream;if(Dt(r))for(;Mt(r)>0;)dt(r,St(e))}(e,r):function(e,t,r){if(mt(0,t,r),"none"===r.readerType)return bt(e,r),void gt(e);if(r.bytesFilled<r.minimumFill)return;St(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;pt(e,r.buffer,t-n,n)}r.bytesFilled-=n,dt(e._controlledReadableByteStream,r),gt(e)}(e,t,r),lt(e)}function St(e){return e._pendingPullIntos.shift()}function Ot(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Pt(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Tt(e,t),t}}Ot(e),vn(t)}}function Et(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(Ue(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=Be(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(Ue(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");_t(e),t.buffer=Be(t.buffer),"none"===t.readerType&&bt(e,t)}Ie(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Rt(e,t._readRequests.shift())}}(e),0===Ce(r)?ht(e,a,o,i):(e._pendingPullIntos.length>0&&St(e),Ae(r,new Uint8Array(a,o,i),!1))):Dt(r)?(ht(e,a,o,i),gt(e)):ht(e,a,o,i),lt(e)}function Tt(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(ct(e),nt(e),Ot(e),_n(r,t))}function Rt(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,vt(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function At(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(it.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Ct(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function It(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=Be(r.buffer),wt(e,t)}function jt(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const n=t.byteLength;r.buffer=Be(t.buffer),wt(e,n)}function kt(e,t,r,n,o,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,nt(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=a,t._pendingPullIntos=new te,e._readableStreamController=t,Y($(r()),(()=>(t._started=!0,lt(t),null)),(e=>(Tt(t,e),null)))}function qt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function xt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function Lt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function Nt(e){return new Ft(e)}function Wt(e,t){e._reader._readIntoRequests.push(t)}function Mt(e){return e._reader._readIntoRequests.length}function Dt(e){const t=e._reader;return void 0!==t&&!!Bt(t)}Object.defineProperties(at.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),W(at.prototype.close,"close"),W(at.prototype.enqueue,"enqueue"),W(at.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(at.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class Ft{constructor(e){if(ge(e,1,"ReadableStreamBYOBReader"),Ee(e,"First parameter"),yn(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!st(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");se(this,e),this._readIntoRequests=new te}get closed(){return Bt(this)?this._closedPromise:V($t("closed"))}cancel(e=void 0){return Bt(this)?void 0===this._ownerReadableStream?V(ce("cancel")):ue(this,e):V($t("cancel"))}read(e,t={}){if(!Bt(this))return V($t("read"));if(!ArrayBuffer.isView(e))return V(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return V(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return V(new TypeError("view's buffer must have non-zero byteLength"));if(Ue(e.buffer))return V(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return me(e,t),{min:Pe(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return V(e)}const n=r.min;if(0===n)return V(new TypeError("options.min must be greater than 0"));if(function(e){return ot(e.constructor)}(e)){if(n>e.byteLength)return V(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return V(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return V(ce("read from"));let o,i;const a=z(((e,t)=>{o=e,i=t}));return Ut(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!Bt(this))throw $t("releaseLock");void 0!==this._ownerReadableStream&&function(e){le(e),zt(e,new TypeError("Reader was released"))}(this)}}function Bt(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof Ft}function Ut(e,t,r,n){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?n._errorSteps(o._storedError):function(e,t,r,n){const o=e._controlledReadableByteStream,i=t.constructor,a=function(e){return ot(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:u}=t,l=r*a;let c;try{c=Be(t.buffer)}catch(e){return void n._errorSteps(e)}const d={buffer:c,bufferByteLength:c.byteLength,byteOffset:s,byteLength:u,bytesFilled:0,minimumFill:l,elementSize:a,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(d),void Wt(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(yt(e,d)){const t=ft(d);return vt(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Tt(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(d),Wt(o,n),lt(e)}else{const e=new i(d.buffer,d.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function zt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new te,r.forEach((e=>{e._errorSteps(t)}))}function $t(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function Vt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(Ze(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function Ht(e){const{size:t}=e;return t||(()=>1)}function Yt(e,t){me(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:Se(r),size:void 0===n?void 0:Gt(n,`${t} has member 'size' that`)}}function Gt(e,t){return ve(e,t),t=>Se(e(t))}function Kt(e,t,r){return ve(e,r),r=>ee(e,t,[r])}function Qt(e,t,r){return ve(e,r),()=>ee(e,t,[])}function Jt(e,t,r){return ve(e,r),r=>Z(e,t,[r])}function Xt(e,t,r){return ve(e,r),(r,n)=>ee(e,t,[r,n])}function Zt(e,t){if(!or(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(Ft.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),W(Ft.prototype.cancel,"cancel"),W(Ft.prototype.read,"read"),W(Ft.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ft.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const er="function"==typeof AbortController;class tr{constructor(e={},t={}){void 0===e?e=null:_e(e,"First parameter");const r=Yt(t,"Second parameter"),n=function(e,t){me(e,t);const r=null==e?void 0:e.abort,n=null==e?void 0:e.close,o=null==e?void 0:e.start,i=null==e?void 0:e.type,a=null==e?void 0:e.write;return{abort:void 0===r?void 0:Kt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:Qt(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:Jt(o,e,`${t} has member 'start' that`),write:void 0===a?void 0:Xt(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(nr(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=Ht(r);!function(e,t,r,n){const o=Object.create(wr.prototype);let i,a,s,u;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.write?e=>t.write(e,o):()=>$(void 0),s=void 0!==t.close?()=>t.close():()=>$(void 0),u=void 0!==t.abort?e=>t.abort(e):()=>$(void 0),Or(e,o,i,a,s,u,r,n)}(this,n,Vt(r,1),o)}get locked(){if(!or(this))throw Ir("locked");return ir(this)}abort(e=void 0){return or(this)?ir(this)?V(new TypeError("Cannot abort a stream that already has a writer")):ar(this,e):V(Ir("abort"))}close(){return or(this)?ir(this)?V(new TypeError("Cannot close a stream that already has a writer")):dr(this)?V(new TypeError("Cannot close an already-closing stream")):sr(this):V(Ir("close"))}getWriter(){if(!or(this))throw Ir("getWriter");return rr(this)}}function rr(e){return new pr(e)}function nr(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new te,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function or(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof tr}function ir(e){return void 0!==e._writer}function ar(e,t){var r;if("closed"===e._state||"errored"===e._state)return $(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const n=e._state;if("closed"===n||"errored"===n)return $(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=z(((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}}));return e._pendingAbortRequest._promise=i,o||lr(e,t),i}function sr(e){const t=e._state;if("closed"===t||"errored"===t)return V(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=z(((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n})),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&Ur(n),rt(o=e._writableStreamController,gr,0),Tr(o),r}function ur(e,t){"writable"!==e._state?cr(e):lr(e,t)}function lr(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&mr(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&cr(e)}function cr(e){e._state="errored",e._writableStreamController[ne]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new te,void 0===e._pendingAbortRequest)return void fr(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void fr(e);Y(e._writableStreamController[re](r._reason),(()=>(r._resolve(),fr(e),null)),(t=>(r._reject(t),fr(e),null)))}function dr(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function fr(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&Nr(t,e._storedError)}function hr(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){Mr(e)}(r):Ur(r)),e._backpressure=t}Object.defineProperties(tr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),W(tr.prototype.abort,"abort"),W(tr.prototype.close,"close"),W(tr.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(tr.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class pr{constructor(e){if(ge(e,1,"WritableStreamDefaultWriter"),Zt(e,"First parameter"),ir(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!dr(e)&&e._backpressure?Mr(this):Fr(this),xr(this);else if("erroring"===t)Dr(this,e._storedError),xr(this);else if("closed"===t)Fr(this),xr(this),Wr(this);else{const t=e._storedError;Dr(this,t),Lr(this,t)}}get closed(){return br(this)?this._closedPromise:V(kr("closed"))}get desiredSize(){if(!br(this))throw kr("desiredSize");if(void 0===this._ownerWritableStream)throw qr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Er(t._writableStreamController)}(this)}get ready(){return br(this)?this._readyPromise:V(kr("ready"))}abort(e=void 0){return br(this)?void 0===this._ownerWritableStream?V(qr("abort")):function(e,t){return ar(e._ownerWritableStream,t)}(this,e):V(kr("abort"))}close(){if(!br(this))return V(kr("close"));const e=this._ownerWritableStream;return void 0===e?V(qr("close")):dr(e)?V(new TypeError("Cannot close an already-closing stream")):yr(this)}releaseLock(){if(!br(this))throw kr("releaseLock");void 0!==this._ownerWritableStream&&vr(this)}write(e=void 0){return br(this)?void 0===this._ownerWritableStream?V(qr("write to")):_r(this,e):V(kr("write"))}}function br(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof pr}function yr(e){return sr(e._ownerWritableStream)}function mr(e,t){"pending"===e._readyPromiseState?Br(e,t):function(e,t){Dr(e,t)}(e,t)}function vr(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");mr(e,r),function(e,t){"pending"===e._closedPromiseState?Nr(e,t):function(e,t){Lr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function _r(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Rr(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return V(qr("write to"));const i=r._state;if("errored"===i)return V(r._storedError);if(dr(r)||"closed"===i)return V(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return V(r._storedError);const a=function(e){return z(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{rt(e,t,r)}catch(t){return void Rr(e,t)}const n=e._controlledWritableStream;dr(n)||"writable"!==n._state||hr(n,Ar(e)),Tr(e)}(n,t,o),a}Object.defineProperties(pr.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),W(pr.prototype.abort,"abort"),W(pr.prototype.close,"close"),W(pr.prototype.releaseLock,"releaseLock"),W(pr.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(pr.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const gr={};class wr{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Sr(this))throw jr("abortReason");return this._abortReason}get signal(){if(!Sr(this))throw jr("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Sr(this))throw jr("error");"writable"===this._controlledWritableStream._state&&Cr(this,e)}[re](e){const t=this._abortAlgorithm(e);return Pr(this),t}[ne](){nt(this)}}function Sr(e){return!!L(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof wr}function Or(e,t,r,n,o,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,nt(t),t._abortReason=void 0,t._abortController=function(){if(er)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const u=Ar(t);hr(e,u),Y($(r()),(()=>(t._started=!0,Tr(t),null)),(r=>(t._started=!0,ur(e,r),null)))}function Pr(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Er(e){return e._strategyHWM-e._queueTotalSize}function Tr(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void cr(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===gr?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),tt(e);const r=e._closeAlgorithm();Pr(e),Y(r,(()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&Wr(t)}(t),null)),(e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),ur(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),Y(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(tt(e),!dr(r)&&"writable"===t){const t=Ar(e);hr(r,t)}return Tr(e),null}),(t=>("writable"===r._state&&Pr(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,ur(e,t)}(r,t),null)))}(e,r)}function Rr(e,t){"writable"===e._controlledWritableStream._state&&Cr(e,t)}function Ar(e){return Er(e)<=0}function Cr(e,t){const r=e._controlledWritableStream;Pr(e),lr(r,t)}function Ir(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function jr(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function kr(e){r