@cloudbase/js-sdk 3.3.14-alpha.2 → 3.3.14-beta.1

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.
Files changed (101) hide show
  1. package/dist/index.cjs.js +2 -40
  2. package/dist/index.cjs.js.LICENSE.txt +37 -0
  3. package/dist/index.esm.js +2 -35
  4. package/dist/index.esm.js.LICENSE.txt +37 -0
  5. package/dist/packages/ai/index.cjs.js +2 -0
  6. package/dist/packages/ai/index.cjs.js.LICENSE.txt +22 -0
  7. package/dist/packages/ai/index.esm.js +2 -0
  8. package/dist/packages/ai/index.esm.js.LICENSE.txt +22 -0
  9. package/dist/packages/analytics/index.cjs.js +1 -0
  10. package/dist/packages/analytics/index.esm.js +1 -0
  11. package/dist/packages/apis/index.cjs.js +1 -0
  12. package/dist/packages/apis/index.esm.js +1 -0
  13. package/dist/packages/app/index.cjs.js +2 -0
  14. package/dist/packages/app/index.cjs.js.LICENSE.txt +7 -0
  15. package/dist/packages/app/index.esm.js +2 -0
  16. package/dist/packages/app/index.esm.js.LICENSE.txt +7 -0
  17. package/dist/packages/auth/index.cjs.js +2 -0
  18. package/dist/packages/auth/index.cjs.js.LICENSE.txt +22 -0
  19. package/dist/packages/auth/index.esm.js +2 -0
  20. package/dist/packages/auth/index.esm.js.LICENSE.txt +22 -0
  21. package/dist/packages/cloudrun/index.cjs.js +1 -0
  22. package/dist/packages/cloudrun/index.esm.js +1 -0
  23. package/dist/packages/container/index.cjs.js +1 -0
  24. package/dist/packages/container/index.esm.js +1 -0
  25. package/dist/packages/functions/index.cjs.js +1 -0
  26. package/dist/packages/functions/index.esm.js +1 -0
  27. package/dist/packages/model/index.cjs.js +1 -0
  28. package/dist/packages/model/index.esm.js +1 -0
  29. package/dist/packages/mysql/index.cjs.js +1 -0
  30. package/dist/packages/mysql/index.esm.js +1 -0
  31. package/dist/packages/oauth/index.cjs.js +2 -0
  32. package/dist/packages/oauth/index.cjs.js.LICENSE.txt +14 -0
  33. package/dist/packages/oauth/index.esm.js +2 -0
  34. package/dist/packages/oauth/index.esm.js.LICENSE.txt +14 -0
  35. package/dist/packages/realtime/index.cjs.js +1 -0
  36. package/dist/packages/realtime/index.esm.js +1 -0
  37. package/dist/packages/storage/index.cjs.js +1 -0
  38. package/dist/packages/storage/index.esm.js +1 -0
  39. package/dist/packages/utilities/index.cjs.js +1 -0
  40. package/dist/packages/utilities/index.esm.js +1 -0
  41. package/miniprogram_dist/app.js +1 -1
  42. package/miniprogram_dist/database.js +1 -1
  43. package/miniprogram_dist/index.js +1 -1
  44. package/miniprogram_dist/storage.js +1 -1
  45. package/package.json +68 -17
  46. package/ai/dist/index.esm.js +0 -3
  47. package/ai/dist/index.js +0 -21
  48. package/ai/package.json +0 -6
  49. package/analytics/dist/index.esm.js +0 -4
  50. package/analytics/dist/index.js +0 -9
  51. package/analytics/package.json +0 -6
  52. package/apis/dist/index.esm.js +0 -3
  53. package/apis/dist/index.js +0 -21
  54. package/apis/package.json +0 -6
  55. package/app/dist/index.esm.js +0 -11
  56. package/app/dist/index.js +0 -18
  57. package/app/package.json +0 -6
  58. package/auth/dist/index.esm.js +0 -8
  59. package/auth/dist/index.js +0 -13
  60. package/auth/package.json +0 -6
  61. package/cloudrun/dist/index.esm.js +0 -3
  62. package/cloudrun/dist/index.js +0 -21
  63. package/cloudrun/package.json +0 -6
  64. package/container/dist/index.esm.js +0 -8
  65. package/container/dist/index.js +0 -13
  66. package/container/package.json +0 -6
  67. package/database/dist/index.d.ts +0 -3
  68. package/database/dist/index.esm.js +0 -503
  69. package/database/dist/index.js +0 -509
  70. package/database/package.json +0 -6
  71. package/functions/dist/index.esm.js +0 -8
  72. package/functions/dist/index.js +0 -13
  73. package/functions/package.json +0 -6
  74. package/model/dist/index.esm.js +0 -3
  75. package/model/dist/index.js +0 -21
  76. package/model/package.json +0 -6
  77. package/mysql/dist/index.esm.js +0 -3
  78. package/mysql/dist/index.js +0 -21
  79. package/mysql/package.json +0 -6
  80. package/oauth/dist/index.esm.js +0 -3
  81. package/oauth/dist/index.js +0 -21
  82. package/oauth/package.json +0 -6
  83. package/realtime/dist/index.esm.js +0 -8
  84. package/realtime/dist/index.js +0 -13
  85. package/realtime/package.json +0 -6
  86. package/storage/dist/index.esm.js +0 -4
  87. package/storage/dist/index.js +0 -9
  88. package/storage/package.json +0 -6
  89. /package/{ai/dist → dist/packages/ai}/index.d.ts +0 -0
  90. /package/{analytics/dist → dist/packages/analytics}/index.d.ts +0 -0
  91. /package/{apis/dist → dist/packages/apis}/index.d.ts +0 -0
  92. /package/{app/dist → dist/packages/app}/index.d.ts +0 -0
  93. /package/{auth/dist → dist/packages/auth}/index.d.ts +0 -0
  94. /package/{cloudrun/dist → dist/packages/cloudrun}/index.d.ts +0 -0
  95. /package/{container/dist → dist/packages/container}/index.d.ts +0 -0
  96. /package/{functions/dist → dist/packages/functions}/index.d.ts +0 -0
  97. /package/{model/dist → dist/packages/model}/index.d.ts +0 -0
  98. /package/{mysql/dist → dist/packages/mysql}/index.d.ts +0 -0
  99. /package/{oauth/dist → dist/packages/oauth}/index.d.ts +0 -0
  100. /package/{realtime/dist → dist/packages/realtime}/index.d.ts +0 -0
  101. /package/{storage/dist → dist/packages/storage}/index.d.ts +0 -0
@@ -0,0 +1,37 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+
16
+ /*! *****************************************************************************
17
+ Copyright (c) Microsoft Corporation. All rights reserved.
18
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
19
+ this file except in compliance with the License. You may obtain a copy of the
20
+ License at http://www.apache.org/licenses/LICENSE-2.0
21
+
22
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
24
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
25
+ MERCHANTABLITY OR NON-INFRINGEMENT.
26
+
27
+ See the Apache Version 2.0 License for specific language governing permissions
28
+ and limitations under the License.
29
+ ***************************************************************************** */
30
+
31
+ /**
32
+ * @license
33
+ * web-streams-polyfill v4.0.0
34
+ * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
35
+ * This code is released under the MIT license.
36
+ * SPDX-License-Identifier: MIT
37
+ */
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.cjs.js.LICENSE.txt */
2
+ (()=>{var e={829:(e,t,r)=>{"use strict";var n;r.r(t),r.d(t,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>n,formatUrl:()=>a}),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function a(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}},949:(e,t,r)=>{"use strict";function n(e){this.message=e}r.r(t),r.d(t,{InvalidTokenError:()=>a,default:()=>s}),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,a=0,s="";o=t.charAt(a++);~o&&(r=i%4?64*r+o:o,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function i(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(o(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return o(t)}}function a(e){this.message=e}a.prototype=new Error,a.prototype.name="InvalidTokenError";const s=function(e,t){if("string"!=typeof e)throw new a("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(i(e.split(".")[r]))}catch(e){throw new a("Invalid token specified: "+e.message)}}},410:function(e,t,r){var n,o;void 0===(o="function"==typeof(n=function(){"use strict";var e=void 0!==r.g?r.g:self;if(void 0!==e.TextEncoder&&void 0!==e.TextDecoder)return{TextEncoder:e.TextEncoder,TextDecoder:e.TextDecoder};var t=["utf8","utf-8","unicode-1-1-utf-8"];return{TextEncoder:function(e){if(t.indexOf(e)<0&&null!=e)throw new RangeError("Invalid encoding type. Only utf-8 is supported");this.encoding="utf-8",this.encode=function(e){if("string"!=typeof e)throw new TypeError("passed argument must be of type string");var t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);return t.split("").forEach((function(e,t){r[t]=e.charCodeAt(0)})),r}},TextDecoder:function(e,r){if(t.indexOf(e)<0&&null!=e)throw new RangeError("Invalid encoding type. Only utf-8 is supported");if(this.encoding="utf-8",this.ignoreBOM=!1,this.fatal=void 0!==r&&"fatal"in r&&r.fatal,"boolean"!=typeof this.fatal)throw new TypeError("fatal flag must be boolean");this.decode=function(e,t){if(void 0===e)return"";if("boolean"!=typeof(void 0!==t&&"stream"in t&&t.stream))throw new TypeError("stream option must be boolean");if(ArrayBuffer.isView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=new Array(r.length);return r.forEach((function(e,t){n[t]=String.fromCharCode(e)})),decodeURIComponent(escape(n.join("")))}throw new TypeError("passed argument must be an array buffer view")}}}})?n.apply(t,[]):n)||(e.exports=o)},787:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},l=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.AI=void 0;var u=r(471),c=a(r(194)),f=r(68),d=r(515),h=c.MODELS,p=function(){function e(e,t,r){var o=this;this.req=e,this.baseUrl=t,this.modelRequest=function(e){var t=e.url,r=e.data,i=e.headers,a=e.stream,u=e.timeout;return s(o,void 0,void 0,(function(){var e,o,s,c,f,d,h;return l(this,(function(l){switch(l.label){case 0:return e={"Content-Type":"application/json"},a&&Object.assign(e,{Accept:"text/event-stream"}),[4,this.req.fetch({method:"post",headers:n(n((f={},f[null===(d=this.i18n)||void 0===d?void 0:d.LANG_HEADER_KEY]=null===(h=this.i18n)||void 0===h?void 0:h.lang,f),e),i),body:JSON.stringify(r),url:t,stream:a,timeout:u})];case 1:return o=l.sent(),s=o.data,c=o.header,[2,this.handleResponseData(s,c)]}}))}))},this.botRequest=function(e){var t=e.method,r=e.url,i=e.data,a=void 0===i?{}:i,u=e.headers,c=e.stream,f=e.timeout;return s(o,void 0,void 0,(function(){var e,o,i,s,d,h,p,b;return l(this,(function(l){switch(l.label){case 0:return"get"!==t?[3,2]:(e=this.handleResponseData,[4,this.req.fetch({url:"".concat(r,"?").concat((m=a,Object.entries(m).map((function(e){var t=e[0],r=e[1];return"".concat(t,"=").concat(r)})).join("&"))),method:t,headers:u,stream:c,timeout:f})]);case 1:return[2,e.apply(this,[l.sent().data])];case 2:return o={"Content-Type":"application/json"},c&&Object.assign(o,{Accept:"text/event-stream"}),[4,this.req.fetch({url:r,body:JSON.stringify(a),headers:n(n((h={},h[null===(p=this.i18n)||void 0===p?void 0:p.LANG_HEADER_KEY]=null===(b=this.i18n)||void 0===b?void 0:b.lang,h),o),u),stream:c,method:t,timeout:f})];case 3:return i=l.sent(),s=i.data,d=i.header,[2,this.handleResponseData(s,d)]}var m}))}))},this.aiBaseUrl="".concat(t,"/ai"),this.aiBotBaseUrl="".concat(t,"/aibot"),this.bot=new u.Bot(this.botRequest,this.aiBotBaseUrl),this.i18n=r,d.langEvent.bus.on(d.langEvent.LANG_CHANGE_EVENT,(function(e){var t;o.i18n=(null===(t=e.data)||void 0===t?void 0:t.i18n)||o.i18n}))}return e.prototype.handleResponseData=function(e,t){var r,n;return s(this,void 0,void 0,(function(){var o,i;return l(this,(function(a){switch(a.label){case 0:return o="".concat(this.i18n.t("请检查调用方式,或前往云开发 AI+ 首页查看文档"),":https://tcb.cloud.tencent.com/dev#/ai"),"object"==typeof e&&e&&"then"in e?[4,e]:[3,2];case 1:if("object"==typeof(i=a.sent())&&i&&"code"in i&&"NORMAL"!==i.code)throw new Error("".concat(this.i18n.t("AI+ 请求出错,错误码"),":").concat(i.code,",").concat(this.i18n.t("错误信息"),":").concat(i.message,"\n").concat(o,"\n").concat(JSON.stringify(i,null,2)));return[2,e];case 2:return(null===(n=null===(r=null==t?void 0:t.get)||void 0===r?void 0:r.call(t,"content-type"))||void 0===n?void 0:n.includes("application/json"))?[4,(0,f.readableStream2JsonObject)(e)]:[3,4];case 3:if("object"==typeof(i=a.sent())&&i&&"code"in i&&"NORMAL"!==i.code)throw new Error("".concat(this.i18n.t("AI+ 请求出错,错误码"),":").concat(i.code,",").concat(this.i18n.t("错误信息"),":").concat(i.message,"\n").concat(o,"\n").concat(JSON.stringify(i,null,2)));a.label=4;case 4:return[2,e]}}))}))},e.prototype.createModel=function(e,t){var r,n=h[e];if(n)r=new n(this.modelRequest,this.aiBaseUrl);else{var o="string"==typeof(null==t?void 0:t.defaultModelSubUrl)?t.defaultModelSubUrl:"/chat/completions";r=new c.DefaultSimpleModel(this.modelRequest,this.aiBaseUrl,"".concat(e).concat(o))}return new c.ReactModel(r)},e.prototype.registerModel=function(e,t){null==h[e]?h[e]=t:console.warn("AI model ".concat(e," already exists!"))},e.prototype.createImageModel=function(e){return new c.DefaultImageModel(this.modelRequest,this.aiBaseUrl,e)},e.prototype.registerFunctionTool=function(e){c.toolMap.has(e.name)&&console.warn("AI function tool ".concat(e.name," already exists and will be overwritten!")),c.toolMap.set(e.name,e.fn)},e}();t.AI=p},471:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.Bot=void 0;var s=r(68),l=function(){function e(e,t){this.baseUrl=t;var r=arguments[2];this.req="string"==typeof r?function(t){var o=t.headers,i=void 0===o?{}:o,s=a(t,["headers"]);return e(n(n({},s),{headers:n(n({},i),{Authorization:"Bearer ".concat(r)})}))}:e}return e.prototype.list=function(e,t){return this.req({method:"get",url:this.join("bots"),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.create=function(e,t){var r=e.botInfo;return this.req({method:"post",url:this.join("bots"),data:r,timeout:null==t?void 0:t.timeout})},e.prototype.get=function(e,t){var r=e.botId;return this.req({method:"get",url:this.join("bots/".concat(r)),timeout:null==t?void 0:t.timeout})},e.prototype.update=function(e,t){var r=e.botId,n=e.botInfo;return this.req({method:"PATCH",url:this.join("bots/".concat(r)),data:n,timeout:null==t?void 0:t.timeout})},e.prototype.delete=function(e,t){var r=e.botId;return this.req({method:"delete",url:this.join("bots/".concat(r)),timeout:null==t?void 0:t.timeout})},e.prototype.getChatRecords=function(e,t){return this.req({method:"get",url:this.join("bots/".concat(e.botId,"/records")),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.sendFeedback=function(e,t){var r=e.userFeedback;return this.req({method:"post",url:this.join("bots/".concat(r.botId,"/feedback")),data:r,timeout:null==t?void 0:t.timeout})},e.prototype.getFeedback=function(e,t){return this.req({method:"get",url:this.join("bots/".concat(e.botId,"/feedback")),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.uploadFiles=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/files")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.createConversation=function(e,t){var r=e.botId,n=a(e,["botId"]);return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.req({method:"post",url:this.join("bots/".concat(r,"/conversation")),data:n,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.getConversation=function(e,t){var r=e.pageSize,s=void 0===r?10:r,l=e.pageNumber,u=void 0===l?1:l,c=e.botId,f=a(e,["pageSize","pageNumber","botId"]);return o(this,void 0,void 0,(function(){var e,r;return i(this,(function(o){if(u<1)throw new Error("pageNumber must be greater than 0");return e=s*(u-1),r=s,[2,this.req({method:"get",url:this.join("bots/".concat(c,"/conversation")),data:n(n({},f),{offset:e,limit:r}),timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.deleteConversation=function(e,t){var r=e.botId,n=e.conversationId,s=a(e,["botId","conversationId"]);return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.req({method:"delete",url:this.join("bots/".concat(r,"/conversation/").concat(n)),data:s,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.speechToText=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/speech-to-text")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.textToSpeech=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/text-to-speech")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.getTextToSpeechResult=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"get",url:this.join("bots/".concat(e.botId,"/text-to-speech")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.getRecommendQuestions=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/recommend-questions")),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.generateBot=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("generate-bot"),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.getPreview=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("preview"),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.generateImage=function(e,t){return this.req({method:"post",url:this.join("generate-image"),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.sendMessage=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/send-message")),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.join=function(e){return"".concat(this.baseUrl,"/").concat(e)},e}();t.Bot=l;var u=function(){function e(e){var t=(0,s.toPolyfillReadable)(e);this._eventSourceStream=t.pipeThrough(new s.TextDecoderStream).pipeThrough((0,s.createEventSourceParserTransformStream)())}return Object.defineProperty(e.prototype,"teeedStream",{get:function(){var e=this._eventSourceStream.tee(),t=e[0],r=e[1];return this._eventSourceStream=r,t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventSourceStream",{get:function(){return(0,s.createAsyncIterable)(this.teeedStream)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataStream",{get:function(){return(0,s.createAsyncIterable)(this.eventSourceStream.pipeThrough(new s.TransformStream({transform:function(e,t){try{var r=JSON.parse(e.data);t.enqueue(r)}catch(r){"[DONE]"!==e.data?console.warn("Error when transforming event source data to json",r,e):t.terminate()}}})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textStream",{get:function(){return(0,s.createAsyncIterable)(this.dataStream.pipeThrough(new s.TransformStream({transform:function(e,t){var r;t.enqueue(null!==(r=null==e?void 0:e.content)&&void 0!==r?r:"")}})))},enumerable:!1,configurable:!0}),e}()},899:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createParser=void 0;var n=r(602);Object.defineProperty(t,"createParser",{enumerable:!0,get:function(){return n.createParser}})},602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createParser=void 0,t.createParser=function(e){var t,n,o,i,a,s,l;return u(),{feed:function(e){n=n?n+e:e,t&&function(e){return r.every((function(t,r){return e.charCodeAt(r)===t}))}(n)&&(n=n.slice(r.length)),t=!1;for(var a=n.length,s=0,l=!1;s<a;){l&&("\n"===n[s]&&(s+=1),l=!1);for(var u=-1,f=i,d=void 0,h=o;u<0&&h<a;h++)":"===(d=n[h])&&f<0?f=h-s:"\r"===d?(l=!0,u=h-s):"\n"===d&&(u=h-s);if(u<0){o=a-s,i=f;break}o=0,i=-1,c(n,s,f,u),s+=u+1}s===a?n="":s>0&&(n=n.slice(s))},reset:u};function u(){t=!0,n="",o=0,i=-1,a=void 0,s=void 0,l=""}function c(t,r,n,o){if(0===o)return l.length>0&&(e({type:"event",id:a,event:s||void 0,data:l.slice(0,-1)}),l="",a=void 0),void(s=void 0);var i,u=n<0,c=t.slice(r,r+(u?o:n)),f=r+(i=u?o:" "===t[r+n+1]?n+2:n+1),d=o-i,h=t.slice(f,f+d).toString();if("data"===c)l+=h?"".concat(h,"\n"):"\n";else if("event"===c)s=h;else if("id"!==c||h.includes("\0")){if("retry"===c){var p=parseInt(h,10);Number.isNaN(p)||e({type:"reconnect-interval",value:p})}}else a=h}};var r=[239,187,191]},448:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)},l=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},u=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},c=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.registerAi=t.models=t.createAI=t.createAi=t.Bot=t.AI=void 0;var f=r(787);Object.defineProperty(t,"AI",{enumerable:!0,get:function(){return f.AI}});var d=r(471);Object.defineProperty(t,"Bot",{enumerable:!0,get:function(){return d.Bot}});var h=a(r(194)),p=a(r(68));t.utils=p,h.MODELS;var b=c(h,["MODELS"]);t.models=b;function m(e){var t=e.env,r=e.baseUrl,o=e.req,i=e.getAccessToken,a=e.handleReqInstance,s=e.i18n;return new f.AI(function(){if(null==a){if(null==i)throw new Error("`getAccessToken` is required when `handleReqInstance` is not provided!");return function(e){var t=e.getAccessToken,r=e.req;return{download:r.download,post:r.post,upload:r.upload,fetch:function(e){return l(void 0,void 0,void 0,(function(){var o,i,a,s,l;return u(this,(function(u){switch(u.label){case 0:if("function"!=typeof r.fetch)throw new Error("req.fetch is not a function");return o=e.token,i=e.headers,a=void 0===i?{}:i,s=c(e,["token","headers"]),null==o?[3,1]:(l=o,[3,3]);case 1:return[4,t()];case 2:l=u.sent().accessToken,u.label=3;case 3:return[2,r.fetch(n({headers:n({Authorization:"Bearer ".concat(l)},a)},s))]}}))}))}}}({req:o,getAccessToken:i})}return a({req:o})}(),function(){if(null!=r)return r;if(null==t)throw new Error("`env` is required when `baseUrl` is not provided!");return"https://".concat(t,".api.tcloudbasegateway.com/v1")}(),s)}t.createAI=m;var y=m;t.createAi=y;var v={name:"ai",entity:{ai:function(e){var t,r=this,n=this.request;if(null==n.fetch)throw new Error("cloudbase.request.fetch() unimplemented!");return m({req:n,baseUrl:null!==(t=null==e?void 0:e.baseUrl)&&void 0!==t?t:function(){var e=r.getEndPointWithKey("GATEWAY"),t=e.BASE_URL,n=e.PROTOCOL;return"".concat(n).concat(t)}(),handleReqInstance:function(e){return e.req},i18n:this.config.i18n})}}};function _(e){try{e.registerComponent(v)}catch(e){console.warn(e)}}t.registerAi=_,s(r(204),t);try{window.registerAi=_}catch(e){}},81:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ArkSimpleModel=void 0;var a=r(68);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="ark/api/v3/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.ArkSimpleModel=l},97:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DSSimpleModel=void 0;var a=r(68);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="dashscope/compatible-mode/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=Object.assign(e.delta,{role:"assistant"});return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),n(n({},e),r?{finish_reason:"tool_calls",delta:t}:{delta:t})})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.DSSimpleModel=l},985:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DeepSeekSimpleModel=void 0;var a=r(68),s=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="deepseek/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},e),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,s,l,u;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},e),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),s=(0,a.toPolyfillReadable)(o),l=(0,a.intoStandardStream)(s),u=l.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(u)]}}))}))},e}();t.DeepSeekSimpleModel=s},921:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultSimpleModel=void 0;var a=r(68),s=function(){function e(e,t,r){void 0===r&&(r=""),this.req=e,this.baseUrl=t,this.subUrl=r}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e){return o(this,void 0,Promise,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.req({url:this.url,data:n(n({},e),{stream:!1}),stream:!1})];case 1:return t=r.sent(),[2,n(n({},t),{rawResponse:t})]}}))}))},e.prototype.doStream=function(e){return o(this,void 0,Promise,(function(){var t,r,o,s,l;return i(this,(function(i){switch(i.label){case 0:return t=null,[4,this.req({url:this.url,data:n(n({},e),{stream:!0}),stream:!0})];case 1:return r=i.sent(),o=(0,a.toPolyfillReadable)(r),s=(0,a.intoStandardStream)(o),l=s.pipeThrough(new a.TransformStream({transform:function(e,r){var o=e.choices.map((function(e){var r=e.delta;return null==t&&(t=(0,a.isToolCallAssistantMessage)(r)),t?n(n({},e),{finish_reason:"tool_calls",delta:r}):e})),i=n(n({},e),{choices:o});r.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(l)]}}))}))},e}();t.DefaultSimpleModel=s},623:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanSimpleModel=void 0;var a=r(68),s=r(427),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return[4,this.req({url:this.url,headers:{"X-Tc-Action":"ChatCompletions"},data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=i.sent(),o=(0,s.titleCaseToSnakeCase)(r.Response),[2,n(n({},o),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,headers:{"X-Tc-Action":"ChatCompletions"},data:n(n({},e),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=(0,s.titleCaseToSnakeCase)(e),i=o.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),l=n(n({},o),{choices:i});t.enqueue(n(n({},l),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.HunYuanSimpleModel=l},427:function(e,t){"use strict";var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.titleCaseToSnakeCase=t.processInput=void 0,t.processInput=function(e){var t=e.messages,n=e.model,o=e.temperature,i=e.tool_choice,a=e.tools,s=e.top_p;return r(r({},e),{messages:(t.forEach((function(e){"tool_calls"in e&&e.tool_calls.filter((function(e){return"function"!==e.type})).forEach((function(t){return console.warn("`type` in tool_call is not 'function'",t,e)}))})),t),model:n,tools:function(){if(a)return a.forEach((function(e){"function"!==e.type&&console.warn("`type` in tool is not 'function'",e)})),a}(),top_p:s,tool_choice:i,temperature:o})},t.titleCaseToSnakeCase=function e(t){return"object"!=typeof t||null==t?t:Array.isArray(t)?t.map((function(t){return e(t)})):Object.entries(t).reduce((function(t,r){var n,o=r[0],i=r[1];return t["_"===(n=o.replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())}))).charAt(0)?n.slice(1):n]="object"==typeof i?e(i):i,t}),{})}},665:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanBetaSimpleModel=void 0;var a=r(68),s=r(427),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan-beta/openapi/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.HunYuanBetaSimpleModel=l},658:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanExpSimpleModel=void 0;var a=r(68),s=r(427),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan-exp/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e){return o(this,void 0,Promise,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1})];case 1:return t=r.sent(),[2,n(n({},t),{rawResponse:t})]}}))}))},e.prototype.doStream=function(e){return o(this,void 0,Promise,(function(){var t,r,o,l,u;return i(this,(function(i){switch(i.label){case 0:return t=null,[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!0}),stream:!0})];case 1:return r=i.sent(),o=(0,a.toPolyfillReadable)(r),l=(0,a.intoStandardStream)(o),u=l.pipeThrough(new a.TransformStream({transform:function(e,r){var o=e.choices.map((function(e){var r=e.delta;return null==t&&(t=(0,a.isToolCallAssistantMessage)(r)),t?n(n({},e),{finish_reason:"tool_calls",delta:r}):e})),i=n(n({},e),{choices:o});r.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(u)]}}))}))},e}();t.HunYuanExpSimpleModel=l},501:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanOpenSimpleModel=void 0;var a=r(68),s=r(427),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan-open/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.HunYuanOpenSimpleModel=l},489:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.MoonshotSimpleModel=void 0;var a=r(68);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="moonshot/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.MoonshotSimpleModel=l},11:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.YiSimpleModel=void 0;var a=r(68);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="01-ai/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o,i,s,l,u,c;if((null===(s=null===(i=null===(o=null==e?void 0:e.choices)||void 0===o?void 0:o[0])||void 0===i?void 0:i.delta)||void 0===s?void 0:s.content)||(null===(c=null===(u=null===(l=null==e?void 0:e.choices)||void 0===l?void 0:l[0])||void 0===u?void 0:u.delta)||void 0===c?void 0:c.tool_calls)){var f=e.choices.map((function(e){var t=Object.assign(e.delta,{role:"assistant"});return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),n(n({},e),r?{finish_reason:"tool_calls",delta:t}:{delta:t})})),d=n(n({},e),{choices:f});t.enqueue(n(n({},d),{rawResponse:e}))}}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.YiSimpleModel=l},734:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ZhiPuSimpleModel=void 0;var a=r(68);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tool_choice,a=e.tools,s=e.top_p;return n(n({},e),{messages:t,model:r,temperature:o,tool_choice:(i&&"auto"!==i&&console.warn("`tool_choice` is not 'auto'"),i),tools:a,top_p:s})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="zhipu/api/paas/v4/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return r=s(e),[4,this.req({url:this.url,data:n(n({},r),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),[2,n(n({},o),{rawResponse:o})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c,f;return i(this,(function(i){switch(i.label){case 0:return r=s(e),o=null,[4,this.req({url:this.url,data:n(n({},r),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return l=i.sent(),u=(0,a.toPolyfillReadable)(l),c=(0,a.intoStandardStream)(u),f=c.pipeThrough(new a.TransformStream({transform:function(e,t){var r=e.choices.map((function(e){var t=e.delta;return null==o&&(o=(0,a.isToolCallAssistantMessage)(t)),o?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:r});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(f)]}}))}))},e}();t.ZhiPuSimpleModel=l},974:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultImageModel=void 0;var o=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.provider=r,this.defaultGenerateImageSubUrl="images/generations",this.generateImageSubUrlConfig={"hunyuan-image":{"hunyuan-image-v3.0-v1.0.4":"images/ar/generations","hunyuan-image-v3.0-v1.0.1":"images/ar/generations"}},this.generateImage=this.generateImageImpl.bind(this)}return e.prototype.generateImageImpl=function(e){var t;return r(this,void 0,Promise,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:return r=this.defaultGenerateImageSubUrl,"object"==typeof e&&e&&"model"in e&&"string"==typeof e.model&&(o=null===(t=this.generateImageSubUrlConfig[this.provider])||void 0===t?void 0:t[e.model])&&(r=o),[4,this.req({url:this.getGenerateUrl(r),data:e,stream:!1})];case 1:return[2,n.sent()]}}))}))},e.prototype.getGenerateUrl=function(e){return"".concat(this.baseUrl,"/").concat(this.provider,"/").concat(e)},e}();t.DefaultImageModel=o},194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toolMap=t.ReactModel=t.DefaultImageModel=t.DefaultSimpleModel=t.HunYuanOpenSimpleModel=t.HunYuanExpSimpleModel=t.MoonshotSimpleModel=t.YiSimpleModel=t.DSSimpleModel=t.ArkSimpleModel=t.HunYuanSimpleModel=t.HunYuanBetaSimpleModel=t.ZhiPuSimpleModel=t.MODELS=void 0;var n=r(734);Object.defineProperty(t,"ZhiPuSimpleModel",{enumerable:!0,get:function(){return n.ZhiPuSimpleModel}});var o=r(665);Object.defineProperty(t,"HunYuanBetaSimpleModel",{enumerable:!0,get:function(){return o.HunYuanBetaSimpleModel}});var i=r(623);Object.defineProperty(t,"HunYuanSimpleModel",{enumerable:!0,get:function(){return i.HunYuanSimpleModel}});var a=r(81);Object.defineProperty(t,"ArkSimpleModel",{enumerable:!0,get:function(){return a.ArkSimpleModel}});var s=r(97);Object.defineProperty(t,"DSSimpleModel",{enumerable:!0,get:function(){return s.DSSimpleModel}});var l=r(11);Object.defineProperty(t,"YiSimpleModel",{enumerable:!0,get:function(){return l.YiSimpleModel}});var u=r(489);Object.defineProperty(t,"MoonshotSimpleModel",{enumerable:!0,get:function(){return u.MoonshotSimpleModel}});var c=r(658);Object.defineProperty(t,"HunYuanExpSimpleModel",{enumerable:!0,get:function(){return c.HunYuanExpSimpleModel}});var f=r(501);Object.defineProperty(t,"HunYuanOpenSimpleModel",{enumerable:!0,get:function(){return f.HunYuanOpenSimpleModel}});var d=r(985),h=r(921);Object.defineProperty(t,"DefaultSimpleModel",{enumerable:!0,get:function(){return h.DefaultSimpleModel}});var p=r(974);Object.defineProperty(t,"DefaultImageModel",{enumerable:!0,get:function(){return p.DefaultImageModel}}),t.MODELS={hunyuan:i.HunYuanSimpleModel,"hunyuan-beta":o.HunYuanBetaSimpleModel,ark:a.ArkSimpleModel,dashscope:s.DSSimpleModel,"01-ai":l.YiSimpleModel,moonshot:u.MoonshotSimpleModel,zhipu:n.ZhiPuSimpleModel,"hunyuan-exp":c.HunYuanExpSimpleModel,"hunyuan-open":f.HunYuanOpenSimpleModel,deepseek:d.DeepSeekSimpleModel};var b=r(239);Object.defineProperty(t,"ReactModel",{enumerable:!0,get:function(){return b.ReactModel}}),Object.defineProperty(t,"toolMap",{enumerable:!0,get:function(){return b.toolMap}})},239:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},s=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,o,(t=e[r](t)).done,t.value)}))}}},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.toolMap=t.ReactModel=void 0;var u=r(68);function c(e){var t,r=e.onStepFinish,o=e.abortSignal,i=e.maxSteps,s=e.topP,l=e.toolChoice,c=a(e,["onStepFinish","abortSignal","maxSteps","topP","toolChoice"]);if(null!=i&&i<1)throw new Error("`maxSteps` muse be greater than 0.");return[{onStepFinish:r,abortSignal:o,maxSteps:i},n(n({},c),{tools:null===(t=c.tools)||void 0===t?void 0:t.map((function(e){return"fn"in e?(0,u.functionToolToModelTool)(e):e})),top_p:null!=s?s:c.top_p,tool_choice:null!=l?l:c.tool_choice})]}var f=function(){function e(e){this.model=e}return e.prototype.generateText=function(e,t){var r,n;return o(this,void 0,Promise,(function(){var o,a,s,u,f,y,v,_,g,w,S,P,O,R,T,j,E,k,C,q,A,x=this;return i(this,(function(i){switch(i.label){case 0:return o=[],a={completion_tokens:0,prompt_tokens:0,total_tokens:0},s=c(e),u=s[0],f=u.onStepFinish,y=u.maxSteps,v=void 0===y?10:y,_=s[1],[4,(g=function(){return x.model.doGenerate(_,t)})()];case 1:w=i.sent(),S=1,w.rawResponse&&o.push(w.rawResponse),P=null,i.label=2;case 2:if(!(S<v&&null!=(P=d(w))))return[3,9];O=b(w.usage),m(a,O),i.label=3;case 3:return i.trys.push([3,7,,8]),[4,p(P)];case 4:return R=i.sent(),T=w.choices[0],[4,null==f?void 0:f({finishReason:T.finish_reason,messages:_.messages.slice(),text:T.message.content,toolCall:P,toolResult:R,stepUsage:O,totalUsage:Object.assign({},a)})];case 5:return i.sent(),h(_.messages,T.message,R),[4,g()];case 6:return(w=i.sent()).rawResponse&&o.push(w.rawResponse),S+=1,[3,8];case 7:return j=i.sent(),[2,{text:"",messages:_.messages,usage:a,error:j,rawResponses:o}];case 8:return[3,2];case 9:return E=null===(r=null==w?void 0:w.choices)||void 0===r?void 0:r[0],k=null==E?void 0:E.message,C=null!==(n=null==k?void 0:k.content)&&void 0!==n?n:"",q=k?l(l([],_.messages,!0),[k],!1):_.messages,A=b(w.usage),m(a,A),[4,null==f?void 0:f({finishReason:E.finish_reason,messages:q.slice(),text:C,toolCall:d(w),toolResult:null,stepUsage:A,totalUsage:Object.assign({},a)})];case 10:return i.sent(),[2,{text:C,messages:q,usage:a,rawResponses:o}]}}))}))},e.prototype.streamText=function(e,t){var r;return o(this,void 0,Promise,(function(){var n,a,f,d,b,y,v,_,g,w,S,P,O,R,T,j,E,k,C,q,A,x,M,I,W,U,L,B,D,N,z,F,$,Y,G,H,V=this;return i(this,(function(Q){switch(Q.label){case 0:return n={completion_tokens:0,prompt_tokens:0,total_tokens:0},a=c(e),f=a[0],d=f.onStepFinish,b=f.maxSteps,y=void 0===b?10:b,v=a[1],[4,(_=function(){return V.model.doStream(v,t)})()];case 1:g=Q.sent(),w=1,S=null,P=function(){var e=g.tee(),t=e[0],r=e[1];return g=(0,u.createAsyncIterable)(t),function(e){var t,r,n,a,l,c,f,d,h,p;return o(this,void 0,Promise,(function(){var o,b,m,y,v,_,g,w,S,P,O,R,T;return i(this,(function(i){switch(i.label){case 0:o={completion_tokens:0,prompt_tokens:0,total_tokens:0},b=(0,u.createAsyncIterable)(e),y={role:"assistant",content:"",tool_calls:[m={id:"",function:{name:"",arguments:""},type:""}]},i.label=1;case 1:i.trys.push([1,6,7,12]),v=!0,_=s(b),i.label=2;case 2:return[4,_.next()];case 3:if(g=i.sent(),t=g.done)return[3,5];a=g.value,v=!1;try{if(!(S=null==(w=a)?void 0:w.choices[0]))return[2,null];if(P=S.finish_reason,O=S.delta,"tool_calls"!==P)return[2,null];if(!O)return[3,4];if(O.content&&(y.content+=O.content),!("tool_calls"in O))return[3,4];(null==(R=null===(l=null==O?void 0:O.tool_calls)||void 0===l?void 0:l[0])?void 0:R.id)&&(m.id=R.id),(null==R?void 0:R.type)&&(m.type=R.type),(null===(c=null==R?void 0:R.function)||void 0===c?void 0:c.name)&&(m.function.name=R.function.name),(null===(f=null==R?void 0:R.function)||void 0===f?void 0:f.arguments)&&(m.function.arguments+=R.function.arguments),(null===(d=null==w?void 0:w.usage)||void 0===d?void 0:d.completion_tokens)&&(o.completion_tokens=w.usage.completion_tokens),(null===(h=null==w?void 0:w.usage)||void 0===h?void 0:h.prompt_tokens)&&(o.prompt_tokens=w.usage.prompt_tokens),(null===(p=null==w?void 0:w.usage)||void 0===p?void 0:p.total_tokens)&&(o.total_tokens=w.usage.total_tokens)}finally{v=!0}i.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return T=i.sent(),r={error:T},[3,12];case 7:return i.trys.push([7,,10,11]),v||t||!(n=_.return)?[3,9]:[4,n.call(_)];case 8:i.sent(),i.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:return[2,{message:y,usage:o}]}}))}))}(r)},Q.label=2;case 2:return(O=w<y)?[4,P()]:[3,4];case 3:O=null!=(S=Q.sent()),Q.label=4;case 4:if(!O)return[3,11];R=S.message,T=S.usage,m(n,T),j=null===(r=R.tool_calls)||void 0===r?void 0:r[0],Q.label=5;case 5:return Q.trys.push([5,9,,10]),[4,p(j)];case 6:return E=Q.sent(),[4,null==d?void 0:d({finishReason:"tool_calls",messages:v.messages.slice(),text:R.content,toolCall:j,toolResult:E,stepUsage:T,totalUsage:Object.assign({},n)})];case 7:return Q.sent(),h(v.messages,R,E),[4,_()];case 8:return g=Q.sent(),[3,10];case 9:return k=Q.sent(),C=g.tee(),q=C[0],A=C[1],[2,{messages:Promise.resolve(v.messages),dataStream:(0,u.createAsyncIterable)(q),textStream:(0,u.createAsyncIterable)(A.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof i&&t.enqueue(i)}}))),usage:Promise.resolve(n),error:k}];case 10:return[3,2];case 11:return[4,P()];case 12:return(S=Q.sent())?(x=S.message,M=S.usage,m(n,M),I=l(l([],v.messages,!0),[x],!1),d({messages:I.slice(),finishReason:"tool_call",stepUsage:M,text:x.content,toolCall:x.tool_calls[0],totalUsage:Object.assign({},n)}),W=g.tee(),U=W[0],L=W[1],[2,{messages:Promise.resolve(l(l([],v.messages,!0),[x],!1)),dataStream:(0,u.createAsyncIterable)(U),textStream:(0,u.createAsyncIterable)(L.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof i&&t.enqueue(i)}}))),usage:Promise.resolve(n)}]):(B=(0,u.createPromise)(),D=(0,u.createPromise)(),N={role:"assistant",content:""},z="",F={completion_tokens:0,prompt_tokens:0,total_tokens:0},$=g.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i,a,s,l,u,c=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof c&&(N.content+=c);var f=null===(a=null===(i=null==e?void 0:e.choices)||void 0===i?void 0:i[0])||void 0===a?void 0:a.finish_reason;f&&(z=f),(null===(s=null==e?void 0:e.usage)||void 0===s?void 0:s.completion_tokens)&&(F.completion_tokens=e.usage.completion_tokens),(null===(l=null==e?void 0:e.usage)||void 0===l?void 0:l.prompt_tokens)&&(F.prompt_tokens=e.usage.prompt_tokens),(null===(u=null==e?void 0:e.usage)||void 0===u?void 0:u.total_tokens)&&(F.total_tokens=e.usage.total_tokens),t.enqueue(e)},flush:function(){B.res(l(l([],v.messages,!0),[N],!1)),m(n,F),D.res(Object.assign({},n)),null==d||d({messages:l(l([],v.messages,!0),[N],!1),finishReason:z,text:N.content,stepUsage:F,totalUsage:Object.assign({},n)})}})),Y=$.tee(),G=Y[0],H=Y[1],[2,{messages:B.promise,dataStream:(0,u.createAsyncIterable)(G),textStream:(0,u.createAsyncIterable)(H.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof i&&t.enqueue(i)}}))),usage:D.promise}])}}))}))},e}();function d(e){var t,r=null===(t=null==e?void 0:e.choices)||void 0===t?void 0:t[0];if(!r)return null;var n=r.finish_reason,o=r.message;return"tool_calls"!==n?null:o&&(0,u.isToolCallAssistantMessage)(o)?o.tool_calls[0]:null}function h(e,t,r){e.push(t,{role:"tool",tool_call_id:t.tool_calls[0].id,content:JSON.stringify(r)})}function p(e){return t.toolMap.get(e.function.name)(JSON.parse(e.function.arguments))}function b(e){var t,r,n;return{completion_tokens:null!==(t=null==e?void 0:e.completion_tokens)&&void 0!==t?t:0,prompt_tokens:null!==(r=null==e?void 0:e.prompt_tokens)&&void 0!==r?r:0,total_tokens:null!==(n=null==e?void 0:e.total_tokens)&&void 0!==n?n:0}}function m(e,t){e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens}t.ReactModel=f,t.toolMap=new Map},204:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleChatModel=void 0;t.SimpleChatModel=function(){}},68:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},i=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,o,(t=e[r](t)).done,t.value)}))}}};Object.defineProperty(t,"__esModule",{value:!0}),t.functionToolToModelTool=t.isToolCallAssistantMessage=t.createPromise=t.readableStream2JsonObject=t.intoTextStream=t.intoStandardStream=t.createAsyncIterable=t.TextDecoderStream=t.toPolyfillReadable=t.createEventSourceParserTransformStream=t.TransformStream=t.ReadableStream=void 0;var a=r(593),s=r(308),l=r(899),u=r(410);t.ReadableStream=a.ReadableStream,t.TransformStream=a.TransformStream,t.createEventSourceParserTransformStream=function(){var e;return new t.TransformStream({start:function(t){e=(0,l.createParser)((function(e){"event"===e.type&&t.enqueue(e)}))},transform:function(t){e.feed(t)}})},t.toPolyfillReadable=(0,s.createReadableStreamWrapper)(t.ReadableStream);var c=function(){function e(e,r){void 0===e&&(e="utf-8"),void 0===r&&(r={});var n=this;this.transform=new t.TransformStream({transform:function(e,t){var r=n.handle.decode(new Uint8Array(e),{stream:!0});r&&t.enqueue(r)},flush:function(e){var t=n.handle.decode();t&&e.enqueue(t),e.terminate()}}),this.handle=new u.TextDecoder(e,r)}return Object.defineProperty(e.prototype,"encoding",{get:function(){return this.handle.encoding},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fatal",{get:function(){return this.handle.fatal},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ignoreBOM",{get:function(){return this.handle.ignoreBOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"readable",{get:function(){return this.transform.readable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"writable",{get:function(){return this.transform.writable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"TextDecoderStream"},enumerable:!1,configurable:!0}),e}();function f(e){var t=e;return t[Symbol.asyncIterator]=function(){var t=e.getReader();return{next:function(){return n(this,void 0,Promise,(function(){var e,r,n;return o(this,(function(o){switch(o.label){case 0:return[4,t.read()];case 1:return e=o.sent(),r=e.done,n=e.value,[2,r?{done:!0,value:void 0}:{done:!1,value:n}]}}))}))}}},t}function d(e){return f((0,t.toPolyfillReadable)(e).pipeThrough(new c))}t.TextDecoderStream=c,t.createAsyncIterable=f,t.intoStandardStream=function(e){return f(e.pipeThrough(new c).pipeThrough((0,t.createEventSourceParserTransformStream)()).pipeThrough(new t.TransformStream({transform:function(e,t){try{var r=JSON.parse(e.data);t.enqueue(r)}catch(r){"[DONE]"!==e.data?console.warn("Error when transforming event source data to json",r,e):t.terminate()}}})))},t.intoTextStream=d,t.readableStream2JsonObject=function(e){var t,r,a,s;return n(this,void 0,void 0,(function(){var n,l,u,c,f,h;return o(this,(function(o){switch(o.label){case 0:n=d(e),l="",o.label=1;case 1:o.trys.push([1,6,7,12]),u=!0,c=i(n),o.label=2;case 2:return[4,c.next()];case 3:if(f=o.sent(),t=f.done)return[3,5];s=f.value,u=!1;try{l+=s}finally{u=!0}o.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return h=o.sent(),r={error:h},[3,12];case 7:return o.trys.push([7,,10,11]),u||t||!(a=c.return)?[3,9]:[4,a.call(c)];case 8:o.sent(),o.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:return[2,JSON.parse(l)]}}))}))},t.createPromise=function(){var e,t;return{promise:new Promise((function(r,n){e=r,t=n})),res:e,rej:t}},t.isToolCallAssistantMessage=function(e){var t;return"assistant"===e.role&&"tool_calls"in e&&null!=(null===(t=e.tool_calls)||void 0===t?void 0:t[0])},t.functionToolToModelTool=function(e){return{type:"function",function:{description:e.description,name:e.name,parameters:e.parameters}}}},662:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=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},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,l=a(r(853)),u=r(102);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e,t){for(var r=0,o=(0,u.isArray)(e)?e:[e];r<o.length;r++){var i=o[r],a=i.isMatch,s=i.genAdapter,l=i.runtime;if(a())return{adapter:n({isMatch:a},s(t)),runtime:l}}},t.useDefaultAdapter=function(){return{adapter:n({},l.genAdapter()),runtime:s.WEB}}},853:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var l=r(829),u=r(102),c=r(78),f=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,a=e.headers,s=void 0===a?{}:a,l={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===l?(Object.keys(t).forEach((function(e){u.append(e,t[e])})),u.append("key",n),u.append("file",r),this.request(i(i({},e),{data:u,method:l}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return a(this,void 0,Promise,(function(){var t,r,n,o;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=a.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 a.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 a(this,void 0,Promise,(function(){var r,n,o,l,u,c,f,d,h,p,b,m,y,v=this;return s(this,(function(_){switch(_.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,l=void 0!==o&&o,u=e.stream,c=void 0!==u&&u,f=e.signal,d=e.timeout,h=e.shouldThrowOnError,p=void 0===h||h,b=null!=d?d:this.timeout,f&&(f.aborted&&r.abort(),f.addEventListener("abort",(function(){return r.abort()}))),m=null,l&&b&&(m=setTimeout((function(){console.warn(v.timeoutMsg),r.abort(new Error(v.timeoutMsg))}),b)),[4,fetch(n,i(i({},e),{signal:r.signal})).then((function(e){return a(v,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:return clearTimeout(m),p?e.ok?(t=e,[3,3]):[3,1]:[3,4];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];case 4:return[2,e]}}))}))})).catch((function(e){if(clearTimeout(m),p)return Promise.reject(e)}))];case 1:return y=_.sent(),[2,{data:c?y.body:(null===(t=y.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?y.json():y.text(),statusCode:y.status,header:y.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,a,s=e.url,l=e.headers,f=void 0===l?{}:l,d=e.data,h=e.responseType,p=e.withCredentials,b=e.body,m=e.onUploadProgress,y=(0,u.formatUrl)((0,c.getProtocol)(),s,"get"===n?d:{}),v=new XMLHttpRequest;v.open(n,y),h&&(v.responseType=h),Object.keys(f).forEach((function(e){v.setRequestHeader(e,f[e])})),m&&v.upload.addEventListener("progress",m),v.onreadystatechange=function(){var e={};if(4===v.readyState){var t=v.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=v.status;try{e.data="blob"===h?v.response:JSON.parse(v.responseText)}catch(t){e.data="blob"===h?v.response:v.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),v.abort()}),r.timeout)),a=(0,u.isFormData)(d)?d:"application/x-www-form-urlencoded"===f["content-type"]?(0,u.toQueryString)(d):b||(d?JSON.stringify(d):void 0),p&&(v.withCredentials=!0),v.send(a)}))},t}(l.AbstractSDKRequest);t.WebRequest=f,t.genAdapter=function(){return{type:"default",root:window,reqClass:f,wsClass:WebSocket,localStorage}}},78:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var r="@cloudbase/js-sdk";t.setSdkName=function(e){r=e},t.getSdkName=function(){return r};var n="https:";t.setProtocol=function(e){n=e},t.getProtocol=function(){return n},t.IS_DEBUG_MODE=("undefined"==typeof process||process.env,!1),t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},630:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},546:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(78),t),o(r(630),t),t.OATUH_LOGINTYPE="constants"},640:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(102),a=r(546),s=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(s=-1!==navigator.userAgent.indexOf("Firefox"));var l=s?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function c(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,a=t.stack.split("\n"),l=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),c=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),f=a.findIndex((function(e){return l.test(e)}));if(-1!==f){var d=a.filter((function(e,t){return t>f}));d.unshift(a[f].replace(c,"".concat(r,".").concat(n)).replace(u,o)),(i=new Error).stack="".concat(s?"@debugger":"Error","\n").concat(d.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,s=e.customInfo,f=void 0===s?{}:s,d=e.title,h=e.messages,p=void 0===h?[]:h;return function(e,t,s){if(a.IS_DEBUG_MODE){var h=f.className||e.constructor.name,b=f.methodName||t,m=s.value,y=function(){var e="",t=(new Error).stack.split("\n"),r=t.findIndex((function(e){return l.test(e)}));if(-1!==r){var n=u.exec(t[r+1]||"");e=n?n[0]:""}return e}();s.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=c({err:new Error,className:h,methodName:b,sourceLink:y});try{return m.apply(this,e)}catch(e){var n=e,o=e.message,a=e.error,s=e.error_description,l={title:d||"".concat(h,".").concat(b," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);l.subtitle=o,u.code&&(r?(r.code=u.code,r.msg=u.msg):(e.code=u.code,e.message=u.msg),n=r||e,l.content=p.map((function(e){return{type:"info",body:e}})))}throw a&&s&&(l.subtitle=s,r?(r.code=a,r.msg=s):(e.code=a,e.message=s),n=r||e,l.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(l),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n,a,s,l,u,f;return o(this,(function(o){switch(o.label){case 0:t=c({err:new Error,className:h,methodName:b,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,m.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,a=r.message,s=r.error,l=r.error_description,u={title:d||"".concat(h,".").concat(b," failed"),content:[{type:"error",body:r}]},a&&/^\{.*\}$/.test(a)&&(f=JSON.parse(a),u.subtitle=f,f.code&&(t?(t.code=f.code,t.message=f.msg):(r.code=f.code,r.message=f.msg),n=t||r,u.content=p.map((function(e){return{type:"info",body:e}})))),s&&l&&(u.subtitle=l,t?(t.code=s,t.msg=l):(r.code=s,r.message=l),n=t||r,u.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),n;case 4:return[2]}}))}))}}}}},607:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(640),t)},515:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.langEvent=t.AbortController=t.jwt=t.helpers=t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var s=i(r(546));t.constants=s;var l=i(r(662));t.adapters=l;var u=i(r(388));t.cache=u;var c=i(r(363));t.events=c;var f=i(r(587));t.langEvent=f;var d=i(r(102));t.utils=d;var h=i(r(607));t.helpers=h;var p=a(r(450));t.AbortController=p.default;var b={decode:a(r(949)).default};t.jwt=b},450:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){var e=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(t,r){"abort"===t&&e.listeners.push(r)}}}return e.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(e){return e()})))},e}();t.default=r},388:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var s=r(829),l=r(102),u=r(546),c=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return o(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(s.AbstractStorage),f=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,l.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new c(t.root));case"none":return new c(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:u.ERRORS.OPERATION_FAIL,msg:"[".concat((0,u.getSdkName)(),"][").concat(u.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,l.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}(0,l.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):(0,l.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();t.CloudbaseCache=f},363:function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var a=r(102),s=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=s;var l=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return o(t,e),t}(s);t.IErrorEvent=l;var u=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,a.isInstanceOf)(e,l))return console.error(e.error),this;var r=(0,a.isString)(e)?new s(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,u=this.listeners[n]?i([],this.listeners[n],!0):[];o<u.length;o++)u[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var c=new u;t.addEventListener=function(e,t){c.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),c.fire(e,t)},t.removeEventListener=function(e,t){c.off(e,t)}},587:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LANG_CHANGE_EVENT=t.bus=void 0;var n=r(363);t.bus=new n.CloudbaseEventEmitter,t.LANG_CHANGE_EVENT="lang_change"},102:function(e,t,r){"use strict";var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.parseCaptcha=t.parseQueryString=t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var o=r(546);t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=(new Date).getTime(),t=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===r?n:7&n|8).toString(16)}))},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach((function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===e&&n.splice(i,1);r="".concat(r,"?").concat(n.join("&"))}return r},t.createPromiseCallback=function(){var e={};if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t)}))},t.printGroupLog=function(e){var t,r=e.title,n=e.subtitle,o=void 0===n?"":n,i=e.content,a=void 0===i?[]:i,s=e.printTrace,l=void 0!==s&&s,u=e.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var c=0,f=a;c<f.length;c++){var d=f[c],h=d.type,p=d.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}l&&(console.trace||console.log)("stack trace:"),null===(t=console.groupEnd)||void 0===t||t.call(console)},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86".concat(e)},t.parseQueryString=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)})),t},t.parseCaptcha=function(e){var r={},o=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(o){e=o[1];var i=o[2];i&&(r=(0,t.parseQueryString)(i))}var a=r.token,s=n(r,["token"]);return/^data:/.test(e)&&!a?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:a?{state:s.state,token:a,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}}},593:function(e,t,r){!function(e){"use strict";function t(){}function n(e){return"object"==typeof e&&null!==e||"function"==typeof e}const o=t;function i(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const a=Promise,s=Promise.resolve.bind(a),l=Promise.prototype.then,u=Promise.reject.bind(a),c=s;function f(e){return new a(e)}function d(e){return f((t=>t(e)))}function h(e){return u(e)}function p(e,t,r){return l.call(e,t,r)}function b(e,t,r){p(p(e,t,r),void 0,o)}function m(e,t){b(e,t)}function y(e,t){b(e,void 0,t)}function v(e,t,r){return p(e,t,r)}function _(e){p(e,void 0,o)}let g=e=>{if("function"==typeof queueMicrotask)g=queueMicrotask;else{const e=d(void 0);g=t=>p(e,t)}return g(e)};function w(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function S(e,t,r){try{return d(w(e,t,r))}catch(e){return h(e)}}class P{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 O=Symbol("[[AbortSteps]]"),R=Symbol("[[ErrorSteps]]"),T=Symbol("[[CancelSteps]]"),j=Symbol("[[PullSteps]]"),E=Symbol("[[ReleaseSteps]]");function k(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?x(e):"closed"===t._state?function(e){x(e),W(e)}(e):M(e,t._storedError)}function C(e,t){return Lr(e._ownerReadableStream,t)}function q(e){const t=e._ownerReadableStream;"readable"===t._state?I(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){M(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[E](),t._reader=void 0,e._ownerReadableStream=void 0}function A(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function x(e){e._closedPromise=f(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r}))}function M(e,t){x(e),I(e,t)}function I(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function W(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const U=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},L=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function B(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function D(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function N(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function z(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function F(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function $(e){return Number(e)}function Y(e){return 0===e?0:e}function G(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Y(n),!U(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Y(L(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return U(n)&&0!==n?n:0}function H(e,t){if(!Wr(e))throw new TypeError(`${t} is not a ReadableStream.`)}function V(e){return new Z(e)}function Q(e,t){e._reader._readRequests.push(t)}function J(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function K(e){return e._reader._readRequests.length}function X(e){const t=e._reader;return void 0!==t&&!!ee(t)}class Z{constructor(e){if(z(e,1,"ReadableStreamDefaultReader"),H(e,"First parameter"),Ur(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");k(this,e),this._readRequests=new P}get closed(){return ee(this)?this._closedPromise:h(ne("closed"))}cancel(e=void 0){return ee(this)?void 0===this._ownerReadableStream?h(A("cancel")):C(this,e):h(ne("cancel"))}read(){if(!ee(this))return h(ne("read"));if(void 0===this._ownerReadableStream)return h(A("read from"));let e,t;const r=f(((r,n)=>{e=r,t=n}));return te(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!ee(this))throw ne("releaseLock");void 0!==this._ownerReadableStream&&function(e){q(e),re(e,new TypeError("Reader was released"))}(this)}}function ee(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof Z}function te(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[j](t)}function re(e,t){const r=e._readRequests;e._readRequests=new P,r.forEach((e=>{e._errorSteps(t)}))}function ne(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var oe,ie,ae;function se(e){return e.slice()}function le(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(Z.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(Z.prototype.cancel,"cancel"),i(Z.prototype.read,"read"),i(Z.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Z.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let ue=e=>(ue="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,ue(e)),ce=e=>(ce="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,ce(e));function fe(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return le(o,0,e,t,n),o}function de(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 he(e){try{const t=e.done,r=e.value;return p(c(r),(e=>({done:t,value:e})))}catch(e){return h(e)}}const pe=null!==(ae=null!==(oe=Symbol.asyncIterator)&&void 0!==oe?oe:null===(ie=Symbol.for)||void 0===ie?void 0:ie.call(Symbol,"Symbol.asyncIterator"))&&void 0!==ae?ae:"@@asyncIterator";function be(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=de(e,pe)))return function(e){const t={next(){let t;try{t=me(e)}catch(e){return h(e)}return he(t)},return(t){let r;try{const n=de(e.iterator,"return");if(void 0===n)return d({done:!0,value:t});r=w(n,e.iterator,[t])}catch(e){return h(e)}return n(r)?he(r):h(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(be(e,"sync",de(e,Symbol.iterator)))}else r=de(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const o=w(r,e,[]);if(!n(o))throw new TypeError("The iterator method must return an object");return{iterator:o,nextMethod:o.next,done:!1}}function me(e){const t=w(e.nextMethod,e.iterator,[]);if(!n(t))throw new TypeError("The iterator.next() method must return an object");return t}class ye{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?v(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?v(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=f(((e,n)=>{t=e,r=n}));return te(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,g((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,q(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,q(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=C(t,e);return q(t),v(r,(()=>({value:e,done:!0})))}return q(t),d({value:e,done:!0})}}const ve={next(){return _e(this)?this._asyncIteratorImpl.next():h(ge("next"))},return(e){return _e(this)?this._asyncIteratorImpl.return(e):h(ge("return"))},[pe](){return this}};function _e(e){if(!n(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof ye}catch(e){return!1}}function ge(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(ve,pe,{enumerable:!1});const we=Number.isNaN||function(e){return e!=e};function Se(e){const t=fe(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Pe(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Oe(e,t,r){if("number"!=typeof(n=r)||we(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 Re(e){e._queue=new P,e._queueTotalSize=0}function Te(e){return e===DataView}class je{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Ce(this))throw tt("view");return this._view}respond(e){if(!Ce(this))throw tt("respond");if(z(e,1,"respond"),e=G(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(ce(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Xe(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!Ce(this))throw tt("respondWithNewView");if(z(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(ce(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");Ze(this._associatedReadableByteStreamController,e)}}Object.defineProperties(je.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),i(je.prototype.respond,"respond"),i(je.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(je.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ee{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!ke(this))throw rt("byobRequest");return Je(this)}get desiredSize(){if(!ke(this))throw rt("desiredSize");return Ke(this)}close(){if(!ke(this))throw rt("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`);Ge(this)}enqueue(e){if(!ke(this))throw rt("enqueue");if(z(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`);He(this,e)}error(e=void 0){if(!ke(this))throw rt("error");Ve(this,e)}[T](e){Ae(this),Re(this);const t=this._cancelAlgorithm(e);return Ye(this),t}[j](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Qe(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)}Q(t,e),qe(this)}[E](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new P,this._pendingPullIntos.push(e)}}}function ke(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof Ee}function Ce(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof je}function qe(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&!e._closeRequested&&!!e._started&&(!!(X(t)&&K(t)>0)||!!(st(t)&&at(t)>0)||Ke(e)>0)}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,b(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,qe(e)),null)),(t=>(Ve(e,t),null)))))}function Ae(e){Ne(e),e._pendingPullIntos=new P}function xe(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=Me(t);"default"===t.readerType?J(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function Me(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Ie(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function We(e,t,r,n){let o;try{o=fe(t,r,r+n)}catch(t){throw Ve(e,t),t}Ie(e,o,0,n)}function Ue(e,t){t.bytesFilled>0&&We(e,t.buffer,t.byteOffset,t.bytesFilled),$e(e)}function Le(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;le(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?s.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,Be(0,n,t),o-=n}return i}function Be(e,t,r){r.bytesFilled+=t}function De(e){0===e._queueTotalSize&&e._closeRequested?(Ye(e),Br(e._controlledReadableByteStream)):qe(e)}function Ne(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function ze(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Le(e,t)&&($e(e),xe(e._controlledReadableByteStream,t))}}function Fe(e,t){const r=e._pendingPullIntos.peek();Ne(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&$e(e);const r=e._controlledReadableByteStream;if(st(r))for(;at(r)>0;)xe(r,$e(e))}(e,r):function(e,t,r){if(Be(0,t,r),"none"===r.readerType)return Ue(e,r),void ze(e);if(r.bytesFilled<r.minimumFill)return;$e(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;We(e,r.buffer,t-n,n)}r.bytesFilled-=n,xe(e._controlledReadableByteStream,r),ze(e)}(e,t,r),qe(e)}function $e(e){return e._pendingPullIntos.shift()}function Ye(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Ge(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 Ve(e,t),t}}Ye(e),Br(t)}}function He(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(ce(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=ue(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(ce(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Ne(e),t.buffer=ue(t.buffer),"none"===t.readerType&&Ue(e,t)}X(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Qe(e,t._readRequests.shift())}}(e),0===K(r)?Ie(e,a,o,i):(e._pendingPullIntos.length>0&&$e(e),J(r,new Uint8Array(a,o,i),!1))):st(r)?(Ie(e,a,o,i),ze(e)):Ie(e,a,o,i),qe(e)}function Ve(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(Ae(e),Re(e),Ye(e),Dr(r,t))}function Qe(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,De(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function Je(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(je.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Ke(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Xe(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=ue(r.buffer),Fe(e,t)}function Ze(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=ue(t.buffer),Fe(e,n)}function et(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,Re(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=a,t._pendingPullIntos=new P,e._readableStreamController=t,b(d(r()),(()=>(t._started=!0,qe(t),null)),(e=>(Ve(t,e),null)))}function tt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function rt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function nt(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function ot(e){return new lt(e)}function it(e,t){e._reader._readIntoRequests.push(t)}function at(e){return e._reader._readIntoRequests.length}function st(e){const t=e._reader;return void 0!==t&&!!ut(t)}Object.defineProperties(Ee.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),i(Ee.prototype.close,"close"),i(Ee.prototype.enqueue,"enqueue"),i(Ee.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ee.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class lt{constructor(e){if(z(e,1,"ReadableStreamBYOBReader"),H(e,"First parameter"),Ur(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!ke(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");k(this,e),this._readIntoRequests=new P}get closed(){return ut(this)?this._closedPromise:h(dt("closed"))}cancel(e=void 0){return ut(this)?void 0===this._ownerReadableStream?h(A("cancel")):C(this,e):h(dt("cancel"))}read(e,t={}){if(!ut(this))return h(dt("read"));if(!ArrayBuffer.isView(e))return h(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return h(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return h(new TypeError("view's buffer must have non-zero byteLength"));if(ce(e.buffer))return h(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return B(e,t),{min:G(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return h(e)}const n=r.min;if(0===n)return h(new TypeError("options.min must be greater than 0"));if(function(e){return Te(e.constructor)}(e)){if(n>e.byteLength)return h(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return h(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return h(A("read from"));let o,i;const a=f(((e,t)=>{o=e,i=t}));return ct(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!ut(this))throw dt("releaseLock");void 0!==this._ownerReadableStream&&function(e){q(e),ft(e,new TypeError("Reader was released"))}(this)}}function ut(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof lt}function ct(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 Te(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:l}=t,u=r*a;let c;try{c=ue(t.buffer)}catch(e){return void n._errorSteps(e)}const f={buffer:c,bufferByteLength:c.byteLength,byteOffset:s,byteLength:l,bytesFilled:0,minimumFill:u,elementSize:a,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(f),void it(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(Le(e,f)){const t=Me(f);return De(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Ve(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(f),it(o,n),qe(e)}else{const e=new i(f.buffer,f.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function ft(e,t){const r=e._readIntoRequests;e._readIntoRequests=new P,r.forEach((e=>{e._errorSteps(t)}))}function dt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function ht(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(we(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function pt(e){const{size:t}=e;return t||(()=>1)}function bt(e,t){B(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:$(r),size:void 0===n?void 0:mt(n,`${t} has member 'size' that`)}}function mt(e,t){return D(e,t),t=>$(e(t))}function yt(e,t,r){return D(e,r),r=>S(e,t,[r])}function vt(e,t,r){return D(e,r),()=>S(e,t,[])}function _t(e,t,r){return D(e,r),r=>w(e,t,[r])}function gt(e,t,r){return D(e,r),(r,n)=>S(e,t,[r,n])}function wt(e,t){if(!Tt(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(lt.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),i(lt.prototype.cancel,"cancel"),i(lt.prototype.read,"read"),i(lt.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(lt.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const St="function"==typeof AbortController;class Pt{constructor(e={},t={}){void 0===e?e=null:N(e,"First parameter");const r=bt(t,"Second parameter"),n=function(e,t){B(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:yt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:vt(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:_t(o,e,`${t} has member 'start' that`),write:void 0===a?void 0:gt(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(Rt(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=pt(r);!function(e,t,r,n){const o=Object.create(Ft.prototype);let i,a,s,l;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.write?e=>t.write(e,o):()=>d(void 0),s=void 0!==t.close?()=>t.close():()=>d(void 0),l=void 0!==t.abort?e=>t.abort(e):()=>d(void 0),Yt(e,o,i,a,s,l,r,n)}(this,n,ht(r,1),o)}get locked(){if(!Tt(this))throw Xt("locked");return jt(this)}abort(e=void 0){return Tt(this)?jt(this)?h(new TypeError("Cannot abort a stream that already has a writer")):Et(this,e):h(Xt("abort"))}close(){return Tt(this)?jt(this)?h(new TypeError("Cannot close a stream that already has a writer")):xt(this)?h(new TypeError("Cannot close an already-closing stream")):kt(this):h(Xt("close"))}getWriter(){if(!Tt(this))throw Xt("getWriter");return Ot(this)}}function Ot(e){return new Wt(e)}function Rt(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new P,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Tt(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Pt}function jt(e){return void 0!==e._writer}function Et(e,t){var r;if("closed"===e._state||"errored"===e._state)return d(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 d(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=f(((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}}));return e._pendingAbortRequest._promise=i,o||qt(e,t),i}function kt(e){const t=e._state;if("closed"===t||"errored"===t)return h(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const r=f(((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n})),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&cr(n),Oe(o=e._writableStreamController,zt,0),Vt(o),r}function Ct(e,t){"writable"!==e._state?At(e):qt(e,t)}function qt(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&Bt(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&At(e)}function At(e){e._state="errored",e._writableStreamController[R]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new P,void 0===e._pendingAbortRequest)return void Mt(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Mt(e);b(e._writableStreamController[O](r._reason),(()=>(r._resolve(),Mt(e),null)),(t=>(r._reject(t),Mt(e),null)))}function xt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Mt(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&or(t,e._storedError)}function It(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){ar(e)}(r):cr(r)),e._backpressure=t}Object.defineProperties(Pt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),i(Pt.prototype.abort,"abort"),i(Pt.prototype.close,"close"),i(Pt.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Pt.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class Wt{constructor(e){if(z(e,1,"WritableStreamDefaultWriter"),wt(e,"First parameter"),jt(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)!xt(e)&&e._backpressure?ar(this):lr(this),rr(this);else if("erroring"===t)sr(this,e._storedError),rr(this);else if("closed"===t)lr(this),rr(this),ir(this);else{const t=e._storedError;sr(this,t),nr(this,t)}}get closed(){return Ut(this)?this._closedPromise:h(er("closed"))}get desiredSize(){if(!Ut(this))throw er("desiredSize");if(void 0===this._ownerWritableStream)throw tr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Ht(t._writableStreamController)}(this)}get ready(){return Ut(this)?this._readyPromise:h(er("ready"))}abort(e=void 0){return Ut(this)?void 0===this._ownerWritableStream?h(tr("abort")):function(e,t){return Et(e._ownerWritableStream,t)}(this,e):h(er("abort"))}close(){if(!Ut(this))return h(er("close"));const e=this._ownerWritableStream;return void 0===e?h(tr("close")):xt(e)?h(new TypeError("Cannot close an already-closing stream")):Lt(this)}releaseLock(){if(!Ut(this))throw er("releaseLock");void 0!==this._ownerWritableStream&&Dt(this)}write(e=void 0){return Ut(this)?void 0===this._ownerWritableStream?h(tr("write to")):Nt(this,e):h(er("write"))}}function Ut(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof Wt}function Lt(e){return kt(e._ownerWritableStream)}function Bt(e,t){"pending"===e._readyPromiseState?ur(e,t):function(e,t){sr(e,t)}(e,t)}function Dt(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Bt(e,r),function(e,t){"pending"===e._closedPromiseState?or(e,t):function(e,t){nr(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Nt(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Qt(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return h(tr("write to"));const i=r._state;if("errored"===i)return h(r._storedError);if(xt(r)||"closed"===i)return h(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return h(r._storedError);const a=function(e){return f(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{Oe(e,t,r)}catch(t){return void Qt(e,t)}const n=e._controlledWritableStream;xt(n)||"writable"!==n._state||It(n,Jt(e)),Vt(e)}(n,t,o),a}Object.defineProperties(Wt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),i(Wt.prototype.abort,"abort"),i(Wt.prototype.close,"close"),i(Wt.prototype.releaseLock,"releaseLock"),i(Wt.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const zt={};class Ft{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!$t(this))throw Zt("abortReason");return this._abortReason}get signal(){if(!$t(this))throw Zt("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!$t(this))throw Zt("error");"writable"===this._controlledWritableStream._state&&Kt(this,e)}[O](e){const t=this._abortAlgorithm(e);return Gt(this),t}[R](){Re(this)}}function $t(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof Ft}function Yt(e,t,r,n,o,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Re(t),t._abortReason=void 0,t._abortController=function(){if(St)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const l=Jt(t);It(e,l),b(d(r()),(()=>(t._started=!0,Vt(t),null)),(r=>(t._started=!0,Ct(e,r),null)))}function Gt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Ht(e){return e._strategyHWM-e._queueTotalSize}function Vt(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void At(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===zt?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Pe(e);const r=e._closeAlgorithm();Gt(e),b(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&&ir(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),Ct(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),b(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(Pe(e),!xt(r)&&"writable"===t){const t=Jt(e);It(r,t)}return Vt(e),null}),(t=>("writable"===r._state&&Gt(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,Ct(e,t)}(r,t),null)))}(e,r)}function Qt(e,t){"writable"===e._controlledWritableStream._state&&Kt(e,t)}function Jt(e){return Ht(e)<=0}function Kt(e,t){const r=e._controlledWritableStream;Gt(e),qt(r,t)}function Xt(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Zt(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function er(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function tr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function rr(e){e._closedPromise=f(((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function nr(e,t){rr(e),or(e,t)}function or(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function ir(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 ar(e){e._readyPromise=f(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function sr(e,t){ar(e),ur(e,t)}function lr(e){ar(e),cr(e)}function ur(e,t){void 0!==e._readyPromise_reject&&(_(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function cr(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(Ft.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ft.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const fr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==r.g?r.g:void 0,dr=function(){const e=null==fr?void 0:fr.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 i(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function hr(e,r,n,o,i,a){const s=V(e),l=Ot(r);e._disturbed=!0;let u=!1,c=d(void 0);return f(((v,g)=>{let w;if(void 0!==a){if(w=()=>{const t=void 0!==a.reason?a.reason:new dr("Aborted","AbortError"),n=[];o||n.push((()=>"writable"===r._state?Et(r,t):d(void 0))),i||n.push((()=>"readable"===e._state?Lr(e,t):d(void 0))),j((()=>Promise.all(n.map((e=>e())))),!0,t)},a.aborted)return void w();a.addEventListener("abort",w)}var S,P,O;if(T(e,s._closedPromise,(e=>(o?E(!0,e):j((()=>Et(r,e)),!0,e),null))),T(r,l._closedPromise,(t=>(i?E(!0,t):j((()=>Lr(e,t)),!0,t),null))),S=e,P=s._closedPromise,O=()=>(n?E():j((()=>function(e){const t=e._ownerWritableStream,r=t._state;return xt(t)||"closed"===r?d(void 0):"errored"===r?h(t._storedError):Lt(e)}(l))),null),"closed"===S._state?O():m(P,O),xt(r)||"closed"===r._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");i?E(!0,t):j((()=>Lr(e,t)),!0,t)}function R(){const e=c;return p(c,(()=>e!==c?R():void 0))}function T(e,t,r){"errored"===e._state?r(e._storedError):y(t,r)}function j(e,t,n){function o(){return b(e(),(()=>k(t,n)),(e=>k(!0,e))),null}u||(u=!0,"writable"!==r._state||xt(r)?o():m(R(),o))}function E(e,t){u||(u=!0,"writable"!==r._state||xt(r)?k(e,t):m(R(),(()=>k(e,t))))}function k(e,t){return Dt(l),q(s),void 0!==a&&a.removeEventListener("abort",w),e?g(t):v(void 0),null}_(f(((e,r)=>{!function n(o){o?e():p(u?d(!0):p(l._readyPromise,(()=>f(((e,r)=>{te(s,{_chunkSteps:r=>{c=p(Nt(l,r),void 0,t),e(!1)},_closeSteps:()=>e(!0),_errorSteps:r})})))),n,r)}(!1)})))}))}class pr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!br(this))throw Rr("desiredSize");return Sr(this)}close(){if(!br(this))throw Rr("close");if(!Pr(this))throw new TypeError("The stream is not in a state that permits close");_r(this)}enqueue(e=void 0){if(!br(this))throw Rr("enqueue");if(!Pr(this))throw new TypeError("The stream is not in a state that permits enqueue");return gr(this,e)}error(e=void 0){if(!br(this))throw Rr("error");wr(this,e)}[T](e){Re(this);const t=this._cancelAlgorithm(e);return vr(this),t}[j](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=Pe(this);this._closeRequested&&0===this._queue.length?(vr(this),Br(t)):mr(this),e._chunkSteps(r)}else Q(t,e),mr(this)}[E](){}}function br(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof pr}function mr(e){yr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,b(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,mr(e)),null)),(t=>(wr(e,t),null)))))}function yr(e){const t=e._controlledReadableStream;return!!Pr(e)&&!!e._started&&(!!(Ur(t)&&K(t)>0)||Sr(e)>0)}function vr(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function _r(e){if(!Pr(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(vr(e),Br(t))}function gr(e,t){if(!Pr(e))return;const r=e._controlledReadableStream;if(Ur(r)&&K(r)>0)J(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw wr(e,t),t}try{Oe(e,t,r)}catch(t){throw wr(e,t),t}}mr(e)}function wr(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(Re(e),vr(e),Dr(r,t))}function Sr(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Pr(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Or(e,t,r,n,o,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Re(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,b(d(r()),(()=>(t._started=!0,mr(t),null)),(e=>(wr(t,e),null)))}function Rr(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Tr(e){return n(r=e)&&void 0!==r.getReader?function(e){let r;return r=xr(t,(function(){let t;try{t=e.read()}catch(e){return h(e)}return v(t,(e=>{if(!n(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)_r(r._readableStreamController);else{const t=e.value;gr(r._readableStreamController,t)}}))}),(function(t){try{return d(e.cancel(t))}catch(e){return h(e)}}),0),r}(e.getReader()):function(e){let r;const o=be(e,"async");return r=xr(t,(function(){let e;try{e=me(o)}catch(e){return h(e)}return v(d(e),(e=>{if(!n(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)_r(r._readableStreamController);else{const t=e.value;gr(r._readableStreamController,t)}}))}),(function(e){const t=o.iterator;let r;try{r=de(t,"return")}catch(e){return h(e)}return void 0===r?d(void 0):v(S(r,t,[e]),(e=>{if(!n(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")}))}),0),r}(e);var r}function jr(e,t,r){return D(e,r),r=>S(e,t,[r])}function Er(e,t,r){return D(e,r),r=>S(e,t,[r])}function kr(e,t,r){return D(e,r),r=>w(e,t,[r])}function Cr(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function qr(e,t){B(e,t);const r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,o=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError(`${t} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(pr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),i(pr.prototype.close,"close"),i(pr.prototype.enqueue,"enqueue"),i(pr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(pr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class Ar{constructor(e={},t={}){void 0===e?e=null:N(e,"First parameter");const r=bt(t,"Second parameter"),n=function(e,t){B(e,t);const r=e,n=null==r?void 0:r.autoAllocateChunkSize,o=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,a=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:G(n,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===o?void 0:jr(o,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:Er(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:kr(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:Cr(s,`${t} has member 'type' that`)}}(e,"First parameter");if(Ir(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const n=Object.create(Ee.prototype);let o,i,a;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>d(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>d(void 0);const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");et(e,n,o,i,a,r,s)}(this,n,ht(r,0))}else{const e=pt(r);!function(e,t,r,n){const o=Object.create(pr.prototype);let i,a,s;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.pull?()=>t.pull(o):()=>d(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>d(void 0),Or(e,o,i,a,s,r,n)}(this,n,ht(r,1),e)}}get locked(){if(!Wr(this))throw Nr("locked");return Ur(this)}cancel(e=void 0){return Wr(this)?Ur(this)?h(new TypeError("Cannot cancel a stream that already has a reader")):Lr(this,e):h(Nr("cancel"))}getReader(e=void 0){if(!Wr(this))throw Nr("getReader");return void 0===function(e,t){B(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:nt(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?V(this):ot(this)}pipeThrough(e,t={}){if(!Wr(this))throw Nr("pipeThrough");z(e,1,"pipeThrough");const r=function(e,t){B(e,t);const r=null==e?void 0:e.readable;F(r,"readable","ReadableWritablePair"),H(r,`${t} has member 'readable' that`);const n=null==e?void 0:e.writable;return F(n,"writable","ReadableWritablePair"),wt(n,`${t} has member 'writable' that`),{readable:r,writable:n}}(e,"First parameter"),n=qr(t,"Second parameter");if(Ur(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(jt(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return _(hr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!Wr(this))return h(Nr("pipeTo"));if(void 0===e)return h("Parameter 1 is required in 'pipeTo'.");if(!Tt(e))return h(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=qr(t,"Second parameter")}catch(e){return h(e)}return Ur(this)?h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):jt(e)?h(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):hr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!Wr(this))throw Nr("tee");return se(function(e){return ke(e._readableStreamController)?function(e){let t,r,n,o,i,a=V(e),s=!1,l=!1,u=!1,c=!1,h=!1;const p=f((e=>{i=e}));function b(e){y(e._closedPromise,(t=>(e!==a||(Ve(n._readableStreamController,t),Ve(o._readableStreamController,t),c&&h||i(void 0)),null)))}function m(){ut(a)&&(q(a),a=V(e),b(a)),te(a,{_chunkSteps:t=>{g((()=>{l=!1,u=!1;const r=t;let a=t;if(!c&&!h)try{a=Se(t)}catch(t){return Ve(n._readableStreamController,t),Ve(o._readableStreamController,t),void i(Lr(e,t))}c||He(n._readableStreamController,r),h||He(o._readableStreamController,a),s=!1,l?_():u&&w()}))},_closeSteps:()=>{s=!1,c||Ge(n._readableStreamController),h||Ge(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&Xe(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Xe(o._readableStreamController,0),c&&h||i(void 0)},_errorSteps:()=>{s=!1}})}function v(t,r){ee(a)&&(q(a),a=ot(e),b(a));const f=r?o:n,d=r?n:o;ct(a,t,1,{_chunkSteps:t=>{g((()=>{l=!1,u=!1;const n=r?h:c;if(r?c:h)n||Ze(f._readableStreamController,t);else{let r;try{r=Se(t)}catch(t){return Ve(f._readableStreamController,t),Ve(d._readableStreamController,t),void i(Lr(e,t))}n||Ze(f._readableStreamController,t),He(d._readableStreamController,r)}s=!1,l?_():u&&w()}))},_closeSteps:e=>{s=!1;const t=r?h:c,n=r?c:h;t||Ge(f._readableStreamController),n||Ge(d._readableStreamController),void 0!==e&&(t||Ze(f._readableStreamController,e),!n&&d._readableStreamController._pendingPullIntos.length>0&&Xe(d._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{s=!1}})}function _(){if(s)return l=!0,d(void 0);s=!0;const e=Je(n._readableStreamController);return null===e?m():v(e._view,!1),d(void 0)}function w(){if(s)return u=!0,d(void 0);s=!0;const e=Je(o._readableStreamController);return null===e?m():v(e._view,!0),d(void 0)}function S(){}return n=Mr(S,_,(function(n){if(c=!0,t=n,h){const n=se([t,r]),o=Lr(e,n);i(o)}return p})),o=Mr(S,w,(function(n){if(h=!0,r=n,c){const n=se([t,r]),o=Lr(e,n);i(o)}return p})),b(a),[n,o]}(e):function(e){const t=V(e);let r,n,o,i,a,s=!1,l=!1,u=!1,c=!1;const h=f((e=>{a=e}));function p(){return s?(l=!0,d(void 0)):(s=!0,te(t,{_chunkSteps:e=>{g((()=>{l=!1;const t=e,r=e;u||gr(o._readableStreamController,t),c||gr(i._readableStreamController,r),s=!1,l&&p()}))},_closeSteps:()=>{s=!1,u||_r(o._readableStreamController),c||_r(i._readableStreamController),u&&c||a(void 0)},_errorSteps:()=>{s=!1}}),d(void 0))}function b(){}return o=xr(b,p,(function(t){if(u=!0,r=t,c){const t=se([r,n]),o=Lr(e,t);a(o)}return h})),i=xr(b,p,(function(t){if(c=!0,n=t,u){const t=se([r,n]),o=Lr(e,t);a(o)}return h})),y(t._closedPromise,(e=>(wr(o._readableStreamController,e),wr(i._readableStreamController,e),u&&c||a(void 0),null))),[o,i]}(e)}(this))}values(e=void 0){if(!Wr(this))throw Nr("values");return function(e,t){const r=V(e),n=new ye(r,t),o=Object.create(ve);return o._asyncIteratorImpl=n,o}(this,function(e){B(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[pe](e){return this.values(e)}static from(e){return Tr(e)}}function xr(e,t,r,n=1,o=()=>1){const i=Object.create(Ar.prototype);return Ir(i),Or(i,Object.create(pr.prototype),e,t,r,n,o),i}function Mr(e,t,r){const n=Object.create(Ar.prototype);return Ir(n),et(n,Object.create(Ee.prototype),e,t,r,0,void 0),n}function Ir(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Wr(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof Ar}function Ur(e){return void 0!==e._reader}function Lr(e,r){if(e._disturbed=!0,"closed"===e._state)return d(void 0);if("errored"===e._state)return h(e._storedError);Br(e);const n=e._reader;if(void 0!==n&&ut(n)){const e=n._readIntoRequests;n._readIntoRequests=new P,e.forEach((e=>{e._closeSteps(void 0)}))}return v(e._readableStreamController[T](r),t)}function Br(e){e._state="closed";const t=e._reader;if(void 0!==t&&(W(t),ee(t))){const e=t._readRequests;t._readRequests=new P,e.forEach((e=>{e._closeSteps()}))}}function Dr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(I(r,t),ee(r)?re(r,t):ft(r,t))}function Nr(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function zr(e,t){B(e,t);const r=null==e?void 0:e.highWaterMark;return F(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:$(r)}}Object.defineProperties(Ar,{from:{enumerable:!0}}),Object.defineProperties(Ar.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),i(Ar.from,"from"),i(Ar.prototype.cancel,"cancel"),i(Ar.prototype.getReader,"getReader"),i(Ar.prototype.pipeThrough,"pipeThrough"),i(Ar.prototype.pipeTo,"pipeTo"),i(Ar.prototype.tee,"tee"),i(Ar.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ar.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(Ar.prototype,pe,{value:Ar.prototype.values,writable:!0,configurable:!0});const Fr=e=>e.byteLength;i(Fr,"size");class $r{constructor(e){z(e,1,"ByteLengthQueuingStrategy"),e=zr(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Gr(this))throw Yr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Gr(this))throw Yr("size");return Fr}}function Yr(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Gr(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof $r}Object.defineProperties($r.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty($r.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Hr=()=>1;i(Hr,"size");class Vr{constructor(e){z(e,1,"CountQueuingStrategy"),e=zr(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Jr(this))throw Qr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Jr(this))throw Qr("size");return Hr}}function Qr(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Jr(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Vr}function Kr(e,t,r){return D(e,r),r=>S(e,t,[r])}function Xr(e,t,r){return D(e,r),r=>w(e,t,[r])}function Zr(e,t,r){return D(e,r),(r,n)=>S(e,t,[r,n])}function en(e,t,r){return D(e,r),r=>S(e,t,[r])}Object.defineProperties(Vr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class tn{constructor(e={},t={},r={}){void 0===e&&(e=null);const n=bt(t,"Second parameter"),o=bt(r,"Third parameter"),i=function(e,t){B(e,t);const r=null==e?void 0:e.cancel,n=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,i=null==e?void 0:e.start,a=null==e?void 0:e.transform,s=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:en(r,e,`${t} has member 'cancel' that`),flush:void 0===n?void 0:Kr(n,e,`${t} has member 'flush' that`),readableType:o,start:void 0===i?void 0:Xr(i,e,`${t} has member 'start' that`),transform:void 0===a?void 0:Zr(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=ht(o,0),s=pt(o),l=ht(n,1),u=pt(n);let c;!function(e,t,r,n,o,i){function a(){return t}e._writable=function(e,t,r,n,o=1,i=()=>1){const a=Object.create(Pt.prototype);return Rt(a),Yt(a,Object.create(Ft.prototype),e,t,r,n,o,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?v(e._backpressureChangePromise,(()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return dn(r,t)})):dn(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=f(((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r}));const n=t._flushAlgorithm();return cn(t),b(n,(()=>("errored"===r._state?bn(t,r._storedError):(_r(r._readableStreamController),pn(t)),null)),(e=>(wr(r._readableStreamController,e),bn(t,e),null))),t._finishPromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._readable;r._finishPromise=f(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return cn(r),b(o,(()=>("errored"===n._state?bn(r,n._storedError):(wr(n._readableStreamController,t),pn(r)),null)),(e=>(wr(n._readableStreamController,e),bn(r,e),null))),r._finishPromise}(e,t)}),r,n),e._readable=xr(a,(function(){return function(e){return sn(e,!1),e._backpressureChangePromise}(e)}),(function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._writable;r._finishPromise=f(((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t}));const o=r._cancelAlgorithm(t);return cn(r),b(o,(()=>("errored"===n._state?bn(r,n._storedError):(Qt(n._writableStreamController,t),an(e),pn(r)),null)),(t=>(Qt(n._writableStreamController,t),an(e),bn(r,t),null))),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,sn(e,!0),e._transformStreamController=void 0}(this,f((e=>{c=e})),l,u,a,s),function(e,t){const r=Object.create(ln.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return fn(r,e),d(void 0)}catch(e){return h(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>d(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>d(void 0),function(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,n,o,i)}(this,i),void 0!==i.start?c(i.start(this._transformStreamController)):c(void 0)}get readable(){if(!rn(this))throw mn("readable");return this._readable}get writable(){if(!rn(this))throw mn("writable");return this._writable}}function rn(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof tn}function nn(e,t){wr(e._readable._readableStreamController,t),on(e,t)}function on(e,t){cn(e._transformStreamController),Qt(e._writable._writableStreamController,t),an(e)}function an(e){e._backpressure&&sn(e,!1)}function sn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=f((t=>{e._backpressureChangePromise_resolve=t})),e._backpressure=t}Object.defineProperties(tn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(tn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class ln{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!un(this))throw hn("desiredSize");return Sr(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!un(this))throw hn("enqueue");fn(this,e)}error(e=void 0){if(!un(this))throw hn("error");var t;t=e,nn(this._controlledTransformStream,t)}terminate(){if(!un(this))throw hn("terminate");!function(e){const t=e._controlledTransformStream;_r(t._readable._readableStreamController),on(t,new TypeError("TransformStream terminated"))}(this)}}function un(e){return!!n(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof ln}function cn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function fn(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Pr(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{gr(n,t)}catch(e){throw on(r,e),r._readable._storedError}const o=function(e){return!yr(e)}(n);o!==r._backpressure&&sn(r,!0)}function dn(e,t){return v(e._transformAlgorithm(t),void 0,(t=>{throw nn(e._controlledTransformStream,t),t}))}function hn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function pn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function bn(e,t){void 0!==e._finishPromise_reject&&(_(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function mn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(ln.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),i(ln.prototype.enqueue,"enqueue"),i(ln.prototype.error,"error"),i(ln.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ln.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0}),e.ByteLengthQueuingStrategy=$r,e.CountQueuingStrategy=Vr,e.ReadableByteStreamController=Ee,e.ReadableStream=Ar,e.ReadableStreamBYOBReader=lt,e.ReadableStreamBYOBRequest=je,e.ReadableStreamDefaultController=pr,e.ReadableStreamDefaultReader=Z,e.TransformStream=tn,e.TransformStreamDefaultController=ln,e.WritableStream=Pt,e.WritableStreamDefaultController=Ft,e.WritableStreamDefaultWriter=Wt}(t)},308:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createReadableStreamWrapper:()=>h,createTransformStreamWrapper:()=>P,createWrappingReadableSource:()=>p,createWrappingTransformer:()=>O,createWrappingWritableSink:()=>w,createWritableStreamWrapper:()=>g});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function i(e){if(!e)throw new TypeError("Assertion failed")}function a(){}function s(e){return"object"==typeof e&&null!==e||"function"==typeof e}function l(e){if("function"!=typeof e)return!1;var t=!1;try{new e({start:function(){t=!0}})}catch(e){}return t}function u(e){return!!s(e)&&"function"==typeof e.getReader}function c(e){return!!s(e)&&"function"==typeof e.getWriter}function f(e){return!!s(e)&&!!u(e.readable)&&!!c(e.writable)}function d(e){try{return e.getReader({mode:"byob"}).releaseLock(),!0}catch(e){return!1}}function h(e){i(function(e){return!!l(e)&&!!u(new e)}(e));var t=function(e){try{return new e({type:"bytes"}),!0}catch(e){return!1}}(e);return function(r,n){var o=(void 0===n?{}:n).type;if("bytes"!==(o=b(o))||t||(o=void 0),r.constructor===e&&("bytes"!==o||d(r)))return r;if("bytes"===o){var i=p(r,{type:o});return new e(i)}return i=p(r),new e(i)}}function p(e,t){var r=(void 0===t?{}:t).type;return i(u(e)),i(!1===e.locked),"bytes"===(r=b(r))?new _(e):new y(e)}function b(e){var t=String(e);if("bytes"===t)return t;if(void 0===e)return e;throw new RangeError("Invalid type is specified")}var m=function(){function e(e){this._underlyingReader=void 0,this._readerMode=void 0,this._readableStreamController=void 0,this._pendingRead=void 0,this._underlyingStream=e,this._attachDefaultReader()}return e.prototype.start=function(e){this._readableStreamController=e},e.prototype.cancel=function(e){return i(void 0!==this._underlyingReader),this._underlyingReader.cancel(e)},e.prototype._attachDefaultReader=function(){if("default"!==this._readerMode){this._detachReader();var e=this._underlyingStream.getReader();this._readerMode="default",this._attachReader(e)}},e.prototype._attachReader=function(e){var t=this;i(void 0===this._underlyingReader),this._underlyingReader=e;var r=this._underlyingReader.closed;r&&r.then((function(){return t._finishPendingRead()})).then((function(){e===t._underlyingReader&&t._readableStreamController.close()}),(function(r){e===t._underlyingReader&&t._readableStreamController.error(r)})).catch(a)},e.prototype._detachReader=function(){void 0!==this._underlyingReader&&(this._underlyingReader.releaseLock(),this._underlyingReader=void 0,this._readerMode=void 0)},e.prototype._pullWithDefaultReader=function(){var e=this;this._attachDefaultReader();var t=this._underlyingReader.read().then((function(t){var r=e._readableStreamController;t.done?e._tryClose():r.enqueue(t.value)}));return this._setPendingRead(t),t},e.prototype._tryClose=function(){try{this._readableStreamController.close()}catch(e){}},e.prototype._setPendingRead=function(e){var t,r=this,n=function(){r._pendingRead===t&&(r._pendingRead=void 0)};this._pendingRead=t=e.then(n,n)},e.prototype._finishPendingRead=function(){var e=this;if(this._pendingRead){var t=function(){return e._finishPendingRead()};return this._pendingRead.then(t,t)}},e}(),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.pull=function(){return this._pullWithDefaultReader()},t}(m);function v(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var _=function(e){function t(t){var r=this,n=d(t);return(r=e.call(this,t)||this)._supportsByob=n,r}return o(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"bytes"},enumerable:!1,configurable:!0}),t.prototype._attachByobReader=function(){if("byob"!==this._readerMode){i(this._supportsByob),this._detachReader();var e=this._underlyingStream.getReader({mode:"byob"});this._readerMode="byob",this._attachReader(e)}},t.prototype.pull=function(){if(this._supportsByob){var e=this._readableStreamController.byobRequest;if(e)return this._pullWithByobRequest(e)}return this._pullWithDefaultReader()},t.prototype._pullWithByobRequest=function(e){var t=this;this._attachByobReader();var r=new Uint8Array(e.view.byteLength),n=this._underlyingReader.read(r).then((function(r){var n,o,i;t._readableStreamController,r.done?(t._tryClose(),e.respond(0)):(n=r.value,o=e.view,i=v(n),v(o).set(i,0),e.respond(r.value.byteLength))}));return this._setPendingRead(n),n},t}(m);function g(e){return i(function(e){return!!l(e)&&!!c(new e)}(e)),function(t){if(t.constructor===e)return t;var r=w(t);return new e(r)}}function w(e){i(c(e)),i(!1===e.locked);var t=e.getWriter();return new S(t)}var S=function(){function e(e){var t=this;this._writableStreamController=void 0,this._pendingWrite=void 0,this._state="writable",this._storedError=void 0,this._underlyingWriter=e,this._errorPromise=new Promise((function(e,r){t._errorPromiseReject=r})),this._errorPromise.catch(a)}return e.prototype.start=function(e){var t=this;this._writableStreamController=e,this._underlyingWriter.closed.then((function(){t._state="closed"})).catch((function(e){return t._finishErroring(e)}))},e.prototype.write=function(e){var t=this,r=this._underlyingWriter;if(null===r.desiredSize)return r.ready;var n=r.write(e);n.catch((function(e){return t._finishErroring(e)})),r.ready.catch((function(e){return t._startErroring(e)}));var o=Promise.race([n,this._errorPromise]);return this._setPendingWrite(o),o},e.prototype.close=function(){var e=this;return void 0===this._pendingWrite?this._underlyingWriter.close():this._finishPendingWrite().then((function(){return e.close()}))},e.prototype.abort=function(e){if("errored"!==this._state)return this._underlyingWriter.abort(e)},e.prototype._setPendingWrite=function(e){var t,r=this,n=function(){r._pendingWrite===t&&(r._pendingWrite=void 0)};this._pendingWrite=t=e.then(n,n)},e.prototype._finishPendingWrite=function(){var e=this;if(void 0===this._pendingWrite)return Promise.resolve();var t=function(){return e._finishPendingWrite()};return this._pendingWrite.then(t,t)},e.prototype._startErroring=function(e){var t=this;if("writable"===this._state){this._state="erroring",this._storedError=e;var r=function(){return t._finishErroring(e)};void 0===this._pendingWrite?r():this._finishPendingWrite().then(r,r),this._writableStreamController.error(e)}},e.prototype._finishErroring=function(e){"writable"===this._state&&this._startErroring(e),"erroring"===this._state&&(this._state="errored",this._errorPromiseReject(this._storedError))},e}();function P(e){return i(function(e){return!!l(e)&&!!f(new e)}(e)),function(t){if(t.constructor===e)return t;var r=O(t);return new e(r)}}function O(e){i(f(e));var t=e.readable,r=e.writable;i(!1===t.locked),i(!1===r.locked);var n,o=t.getReader();try{n=r.getWriter()}catch(e){throw o.releaseLock(),e}return new R(o,n)}var R=function(){function e(e,t){var r=this;this._transformStreamController=void 0,this._onRead=function(e){if(!e.done)return r._transformStreamController.enqueue(e.value),r._reader.read().then(r._onRead)},this._onError=function(e){r._flushReject(e),r._transformStreamController.error(e),r._reader.cancel(e).catch(a),r._writer.abort(e).catch(a)},this._onTerminate=function(){r._flushResolve(),r._transformStreamController.terminate();var e=new TypeError("TransformStream terminated");r._writer.abort(e).catch(a)},this._reader=e,this._writer=t,this._flushPromise=new Promise((function(e,t){r._flushResolve=e,r._flushReject=t}))}return e.prototype.start=function(e){this._transformStreamController=e,this._reader.read().then(this._onRead).then(this._onTerminate,this._onError);var t=this._reader.closed;t&&t.then(this._onTerminate,this._onError)},e.prototype.transform=function(e){return this._writer.write(e)},e.prototype.flush=function(){var e=this;return this._writer.close().then((function(){return e._flushPromise}))},e}()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(448);module.exports=n})();
@@ -0,0 +1,22 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+
16
+ /**
17
+ * @license
18
+ * web-streams-polyfill v4.0.0
19
+ * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
20
+ * This code is released under the MIT license.
21
+ * SPDX-License-Identifier: MIT
22
+ */