@cloudbase/js-sdk 3.10.4-beta.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/dist/AI.d.ts +1 -1
- package/ai/dist/index.esm.js +1 -1
- package/ai/dist/index.esm.js.map +1 -1
- package/ai/dist/index.js +1 -1
- package/ai/dist/index.js.map +1 -1
- package/ai/dist/models/image-model.d.ts +6 -2
- package/ai/dist/type.d.ts +67 -0
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.esm.js.map +1 -1
- package/app/dist/index.js +1 -1
- package/app/dist/index.js.map +1 -1
- package/app/dist/index.node.esm.js +1 -1
- package/app/dist/index.node.esm.js.map +1 -1
- package/app/dist/index.node.js +1 -1
- package/app/dist/index.node.js.map +1 -1
- package/database/package.json +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/miniprogram_dist/ai/index.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/package.json +2 -2
- package/types/package.json +1 -1
- package/utilities/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ModelReq, HunyuanGenerateImageInput, HunyuanGenerateImageOutput, HunyuanARGenerateImageInput, HunyuanARGenerateImageOutput } from '../type';
|
|
1
|
+
import type { ModelReq, HunyuanGenerateImageInput, HunyuanGenerateImageOutput, HunyuanARGenerateImageInput, HunyuanARGenerateImageOutput, CloudbaseGenerateImageInput, CloudbaseGenerateImageOutput } from '../type';
|
|
2
2
|
interface HunyuanImageGenerateFn {
|
|
3
3
|
(input: HunyuanARGenerateImageInput): Promise<HunyuanARGenerateImageOutput>;
|
|
4
4
|
(input: HunyuanGenerateImageInput): Promise<HunyuanGenerateImageOutput>;
|
|
5
5
|
}
|
|
6
|
-
type
|
|
6
|
+
type CloudbaseImageGenerateFn = (input: CloudbaseGenerateImageInput) => Promise<CloudbaseGenerateImageOutput>;
|
|
7
|
+
type GenerateImageFn<TProvider> = TProvider extends 'hunyuan-image' ? HunyuanImageGenerateFn : TProvider extends 'cloudbase' ? CloudbaseImageGenerateFn : (input: unknown) => Promise<unknown>;
|
|
7
8
|
export declare class DefaultImageModel<TProvider extends string> {
|
|
8
9
|
private req;
|
|
9
10
|
baseUrl: string;
|
|
@@ -13,6 +14,9 @@ export declare class DefaultImageModel<TProvider extends string> {
|
|
|
13
14
|
generateImage: GenerateImageFn<TProvider>;
|
|
14
15
|
constructor(req: ModelReq, baseUrl: string, provider: TProvider);
|
|
15
16
|
private generateImageImpl;
|
|
17
|
+
private validateInput;
|
|
18
|
+
private assertHunyuanInput;
|
|
19
|
+
private resolveSubUrl;
|
|
16
20
|
private getGenerateUrl;
|
|
17
21
|
private getGenerateImageSubUrl;
|
|
18
22
|
}
|
package/ai/dist/type.d.ts
CHANGED
|
@@ -157,6 +157,73 @@ export interface HunyuanARGenerateImageOutput {
|
|
|
157
157
|
revised_prompt?: string;
|
|
158
158
|
}>;
|
|
159
159
|
}
|
|
160
|
+
export interface ChatContentPartText {
|
|
161
|
+
type: 'text';
|
|
162
|
+
text: string;
|
|
163
|
+
}
|
|
164
|
+
export interface ChatContentPartImageUrl {
|
|
165
|
+
type: 'image_url';
|
|
166
|
+
image_url: {
|
|
167
|
+
url: string;
|
|
168
|
+
};
|
|
169
|
+
is_generate?: boolean;
|
|
170
|
+
}
|
|
171
|
+
export type ChatContentPart = ChatContentPartText | ChatContentPartImageUrl;
|
|
172
|
+
export interface ChatMessage {
|
|
173
|
+
role: 'user' | 'assistant' | 'tool';
|
|
174
|
+
content?: ChatContentPart[];
|
|
175
|
+
reasoning?: string;
|
|
176
|
+
tool_calls?: ToolCall[];
|
|
177
|
+
tool_call_id?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface CloudbaseGenerateImageInput {
|
|
180
|
+
model: 'hy-image-v3.5-preview';
|
|
181
|
+
messages: ChatMessage[];
|
|
182
|
+
size?: string;
|
|
183
|
+
seed?: number;
|
|
184
|
+
generate_max_pixels?: number;
|
|
185
|
+
resize_max_pixels?: number;
|
|
186
|
+
session?: string;
|
|
187
|
+
footnote?: string;
|
|
188
|
+
use_search_tool?: {
|
|
189
|
+
value: boolean;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export interface CloudbaseGenerateImageOutput {
|
|
193
|
+
id: string;
|
|
194
|
+
object: string;
|
|
195
|
+
created: number;
|
|
196
|
+
model: string;
|
|
197
|
+
round: number;
|
|
198
|
+
choices: Array<{
|
|
199
|
+
index: number;
|
|
200
|
+
delta: {
|
|
201
|
+
type?: string;
|
|
202
|
+
image?: {
|
|
203
|
+
url: string;
|
|
204
|
+
width: number;
|
|
205
|
+
height: number;
|
|
206
|
+
source: string;
|
|
207
|
+
tool_call_id: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
finish_reason?: string | null;
|
|
211
|
+
}>;
|
|
212
|
+
usage?: {
|
|
213
|
+
total_tokens: number;
|
|
214
|
+
};
|
|
215
|
+
tokenhub_usage?: {
|
|
216
|
+
total_tokens: number;
|
|
217
|
+
};
|
|
218
|
+
request_id?: string;
|
|
219
|
+
assembled_history?: ChatMessage[];
|
|
220
|
+
error?: {
|
|
221
|
+
type: string;
|
|
222
|
+
code: string;
|
|
223
|
+
message: string;
|
|
224
|
+
request_id?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
160
227
|
export type HunyuanEditImageInput = {
|
|
161
228
|
model: 'hunyuan-image' | (string & {});
|
|
162
229
|
prompt: string;
|
package/app/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";import*as n from"@cloudbase/adapter-wx_mp";var o={d:(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},r={};o.d(r,{Z:()=>Jt});var i="@cloudbase/js-sdk";function a(){return i}var s="https:",c={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};const u=(l={AbstractSDKRequest:()=>t.AbstractSDKRequest,AbstractStorage:()=>t.AbstractStorage,StorageType:()=>t.StorageType},p={},o.d(p,l),p);var l,p,f,d=(f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function h(t){return"[object FormData]"===Object.prototype.toString.call(t)}function v(t,e,n){void 0===n&&(n={});var o=/\?/.test(e),r="";return Object.keys(n).forEach(function(t){""===r?!o&&(e+="?"):r+="&",r+="".concat(t,"=").concat(encodeURIComponent(n[t]))}),/^http(s)?:\/\//.test(e+=r)?e:"".concat(t).concat(e)}function y(t,e){console.warn("[".concat(a(),"][").concat(t,"]:").concat(e))}var g=function(t){function e(e){var n=t.call(this,e.msg||e.message||"")||this;return n.code=e.code||"",n.requestId=e.requestId||"",Object.defineProperty(n,"message",{value:e.msg||e.message||"",enumerable:!0,writable:!0,configurable:!0}),n}return d(e,t),e}(Error),b=function(t){return new g(t)};function m(t,e){return(e||b)(t)}function w(t){var e={},n=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){t=n[1];var o=n[2];o&&(e=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach(function(t){var n=t.split("="),o=n[0],r=n[1];o=decodeURIComponent(o),r=decodeURIComponent(r),o&&(e[o]?Array.isArray(e[o])?e[o].push(r):e[o]=[e[o],r]:e[o]=r)}),e}(o))}var r=e.token,i=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(e,["token"]);return/^data:/.test(t)&&!r?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:r?{state:i.state,token:r,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}var O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),A=function(){return A=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},A.apply(this,arguments)},I=function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})},E=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function P(t){try{return JSON.parse(t)}catch(e){return t}}var S,C=function(t){function e(e){var n=t.call(this)||this,o=e.timeout,r=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=o||0,n.timeoutMsg=r||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return O(e,t),e.prototype.get=function(t){return this.request(A(A({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(A(A({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(A(A({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t,n=e.data,o=e.file,r=e.fileContent,i=e.name,a=e.method,s=e.headers,c=void 0===s?{}:s,u=null!=o?o:r,l={post:"post",put:"put"}[null==a?void 0:a.toLowerCase()]||"put",p=new FormData;return"post"===l?(Object.keys(n).forEach(function(t){p.append(t,n[t])}),p.append("key",i),p.append("file",u instanceof Blob?u:new Blob([u])),this.request(A(A({},t),{data:p,method:l}),this.restrictedMethods.includes("upload"))):this.request(A(A({},t),{method:"put",headers:c,body:u}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return I(this,void 0,Promise,function(){var e,n,o,r;return E(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(A(A({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),o=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=n,r.setAttribute("download",o),r.style.display="none",document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise(function(e){e({statusCode:200,tempFilePath:t.url})})]}})})},e.prototype.fetch=function(t){var e;return I(this,void 0,Promise,function(){var n,o,r,i,a,s,c,u,l,p,f,d,h,v,y,g=this;return E(this,function(b){switch(b.label){case 0:return n=new AbortController,o=t.url,r=t.enableAbort,i=void 0!==r&&r,a=t.stream,s=void 0!==a&&a,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,p=void 0===l||l,f=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",function(){return n.abort()})),d=null,i&&f&&(d=setTimeout(function(){console.warn(g.timeoutMsg),n.abort(new Error(g.timeoutMsg))},f)),[4,fetch(o,A(A({},t),{signal:n.signal})).then(function(t){return I(g,void 0,void 0,function(){var e,n,o;return E(this,function(r){switch(r.label){case 0:return clearTimeout(d),p?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return o=(n=Promise).reject,[4,t.json()];case 2:e=o.apply(n,[r.sent()]),r.label=3;case 3:return[2,e];case 4:return[2,t]}})})}).catch(function(t){return clearTimeout(d),Promise.reject(t)})];case 1:return h=b.sent(),s?(v=h.body,[3,5]):[3,2];case 2:return(null===(e=h.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?(y=P,[4,h.text()]):[3,4];case 3:return v=y.apply(void 0,[b.sent()]),[3,5];case 4:v=h.text(),b.label=5;case 5:return[2,{data:v,statusCode:h.status,header:h.headers,response:h}]}})})},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var o=String(t.method).toLowerCase()||"get";return new Promise(function(r){var i=t.url,a=t.headers,c=void 0===a?{}:a,u=t.data,l=t.responseType,p=t.withCredentials,f=t.body,d=t.onUploadProgress,y=v(s,i,"get"===o?u:{}),g=new XMLHttpRequest;g.open(o,y),l&&(g.responseType=l);var b,m,w=t.signal;w&&(w.aborted?g.abort():w.addEventListener("abort",function(){return g.abort()},{once:!0})),Object.keys(c).forEach(function(t){g.setRequestHeader(t,c[t])}),d&&g.upload.addEventListener("progress",d),g.onreadystatechange=function(){var t={};if(4===g.readyState){var e=g.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach(function(t){var e=t.split(": "),o=e.shift().toLowerCase(),r=e.join(": ");n[o]=r}),t.header=n,t.statusCode=g.status;try{t.data="blob"===l?g.response:JSON.parse(g.responseText)}catch(e){t.data="blob"===l?g.response:g.responseText}clearTimeout(b),r(t)}},e&&n.timeout&&(b=setTimeout(function(){console.warn(n.timeoutMsg),g.abort()},n.timeout)),m=h(u)?u:"application/x-www-form-urlencoded"===c["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach(function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))}),e.join("&")}(u):f||(u?JSON.stringify(u):void 0),p&&(g.withCredentials=!0),g.send(m)})},e}(u.AbstractSDKRequest),_=function(){return _=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},_.apply(this,arguments)};!function(t){t.WEB="web",t.WX_MP="wx_mp"}(S||(S={}));var x=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),j=function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})},T=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},k=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return x(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(u.AbstractStorage),R=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,o=void 0===n?{}:n,r=t.keys,i=void 0===r?{}:r;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(y(c.INVALID_PARAMS,"localStorage is not supported on current platform"),new k(e.root));case"none":return new k(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var o={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(o))}catch(t){throw new Error(JSON.stringify({code:c.OPERATION_FAIL,msg:"[".concat(a(),"][").concat(c.OPERATION_FAIL,"]setStore failed"),info:t}))}}else y(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return j(this,void 0,void 0,function(){var o;return T(this,function(r){switch(r.label){case 0:if(!this.storage)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),o={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(o))];case 2:return r.sent(),[3,4];case 3:return r.sent(),[2];case 4:return[2]}})})},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var o=this.storage.getItem(t);return o&&o.indexOf(e)>=0?JSON.parse(o).content:""}y(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return j(this,void 0,void 0,function(){var o;return T(this,function(r){switch(r.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(o=r.sent())&&o.indexOf(e)>=0?[2,JSON.parse(o).content]:[2,""]}})})},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):y(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return j(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}})})},t}(),N=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),D=function(t,e){this.data=e||null,this.name=t},L=function(t){function e(e,n){var o=t.call(this,"error",{error:e,data:n})||this;return o.error=e,o}return N(e,t),e}(D),U=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var o=n[t].indexOf(e);-1!==o&&n[t].splice(o,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof L)return console.error(t.error),this;var n="string"==typeof t?new D(t,e||{}):t,o=n.name;if(this.listens(o)){n.target=this;for(var r=0,i=this.listeners[o]?function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}([],this.listeners[o],!0):[];r<i.length;r++)i[r].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new U;var q=new U,M="lang_change";"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");const W=(t=>{var e={};return o.d(e,t),e})({default:()=>e.default});W.default;var K=function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},V=c,B={};function H(t,e){var n=e.name,o=e.namespace,r=e.entity,i=e.injectEvents,a=e.IIFE,s=void 0!==a&&a;if(B[n]||o&&t[o])throw new Error(JSON.stringify({code:V.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(s){if(!r||"function"!=typeof r)throw new Error(JSON.stringify({code:V.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));r.call(t)}if(B[n]=e,o?t.prototype[o]=r:F(t.prototype,r),i){var c=i.bus,u=i.events;if(!c||!u||0===u.length)return;var l=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=K(K([],t.prototype.events[n].events,!0),u,!0):t.prototype.events[n]={bus:c,events:u},t.prototype.fire=function(t,e){l(t,e);for(var n=0,o=Object.keys(this.events);n<o.length;n++){var r=o[n],i=this.events[r],a=i.bus;if(i.events.includes(t)){a.fire(t,e);break}}}}}function F(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,o=Object.keys(e);n<o.length;n++){var r=o[n];Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=F(t[r],e[r]))}return t}const J=(t=>{var e={};return o.d(e,t),e})({WxMpWebSocket:()=>n.WxMpWebSocket,WxRequest:()=>n.WxRequest,default:()=>n.default,parseQueryString:()=>n.parseQueryString,wxMpStorage:()=>n.wxMpStorage});var G=function(){return G=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},G.apply(this,arguments)},X={},Y=function(){return Y=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Y.apply(this,arguments)},Q=R,$={},z={};function Z(t){var e=t.env,n=t.platformInfo,o={userInfoKey:"".concat("user_info","_").concat(e)};$[e]=$[e]||new Q(Y(Y({},t),{keys:o,platformInfo:n})),z[e]=z[e]||new Q(Y(Y({},t),{keys:o,platformInfo:n,persistence:"local"}))}function tt(t){return z[t]}var et=function(){return et=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},et.apply(this,arguments)},nt="",ot="@cloudbase/js-sdk";function rt(){return nt}var it,at=[],st=["env","endPointKey","region"],ct="https:";function ut(t){return at.find(function(e){return st.filter(function(e){return null!=t[e]}).every(function(n){return e[n]===t[n]})})}function lt(t){var e,n;t.protocol&&!/:$/.test(t.protocol)&&(t.protocol="".concat(t.protocol,":"));var o,r=ut(t);r?(null!=t.baseUrl&&(r.baseUrl=t.baseUrl),null!=t.protocol&&(r.protocol=t.protocol)):at.push(et(et({},t),{protocol:null!==(e=t.protocol)&&void 0!==e?e:ct})),"CLOUD_API"===t.endPointKey&&(o=null!==(n=t.protocol)&&void 0!==n?n:ct,s=o)}function pt(t,e,n){return ut({env:t,endPointKey:e,region:n})}function ft(t,e){void 0===e&&(e="CLOUD_API");var n=pt(t,e||"CLOUD_API"),o=n.protocol,r=n.baseUrl;return"".concat(o).concat(r).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(it||(it={}));var dt=function(){return dt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},dt.apply(this,arguments)},ht=function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})},vt=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},yt=c,gt=h,bt=v,mt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function wt(t,e,n){var o=t[e];t[e]=function(e){var r={},i={};n.forEach(function(n){var o=n.call(t,e),a=o.data,s=o.headers;Object.assign(r,a),Object.assign(i,s)});var a=e.data;return a&&(gt(a)?Object.keys(r).forEach(function(t){a.append(t,r[t])}):e.data=dt(dt({},a),r)),e.headers=dt(dt({},e.headers||{}),i),o.call(t,e)}}function Ot(){var t=Math.random().toString(16).slice(2);return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(rt()),"x-seqid":t}}}var At,It,Et=function(){function t(t){var e=this;this.config=t;var n={env:this.config.env,region:this.config.region,accessKey:this.config.accessKey,context:this.config.context,auth:this.config.auth,timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new X.adapter.reqClass(n),this.localCache=tt(this.config.env),"GATEWAY"!==this.config.endPointMode&&(wt(this.reqClass,"post",[Ot]),wt(this.reqClass,"upload",[Ot]),wt(this.reqClass,"download",[Ot])),q.on(M,function(t){var n;e.config.i18n=(null===(n=t.data)||void 0===n?void 0:n.i18n)||e.config.i18n})}return Object.defineProperty(t.prototype,"throwWhenRequestFail",{get:function(){var t,e,n,o,r=null===(n=null===(e=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===e?void 0:e.config)||void 0===n?void 0:n.throw;return"boolean"==typeof r?r:!1!==(null===(o=this.config)||void 0===o?void 0:o.throw)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"errorFactory",{get:function(){var t,e,n,o=this.config;return null!==(t=null==o?void 0:o.errorFactory)&&void 0!==t?t:null===(n=null===(e=null==o?void 0:o._fromApp)||void 0===e?void 0:e.config)||void 0===n?void 0:n.errorFactory},enumerable:!1,configurable:!0}),t.prototype.getAccessToken=function(t){return void 0===t&&(t=null),ht(this,void 0,void 0,function(){var e,n,o;return vt(this,function(r){switch(r.label){case 0:if(null!=t)return[2,t];if(!(e=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return n=e.oauthInstance,o=n.oauth2client,[4,this.getOauthAccessTokenV2(o)];case 1:return[2,r.sent().accessToken]}})})},t.prototype.getDefaultHeaders=function(){var t,e,n;return(t={})[null===(e=this.config.i18n)||void 0===e?void 0:e.LANG_HEADER_KEY]=null===(n=this.config.i18n)||void 0===n?void 0:n.lang,t["X-SDK-Version"]="@cloudbase/js-sdk/".concat(rt()),t},Object.defineProperty(t.prototype,"requestDebug",{get:function(){var t,e,n;return!0===(null===(n=null===(e=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===e?void 0:e.config)||void 0===n?void 0:n.debug)},enumerable:!1,configurable:!0}),t.prototype.post=function(t,e){return ht(this,void 0,Promise,function(){return vt(this,function(n){switch(n.label){case 0:return[4,this.reqClass.post(dt(dt({},t),{headers:dt(dt({},t.headers),this.getDefaultHeaders()),customReqOpts:e,debug:this.requestDebug}))];case 1:return[2,n.sent()]}})})},t.prototype.upload=function(t){var e;return ht(this,void 0,Promise,function(){var n,o,r;return vt(this,function(i){switch(i.label){case 0:return o=null!==(e=(n=t).file)&&void 0!==e?e:n.fileContent,delete(r=dt(dt({},n),{file:o,headers:dt(dt({},n.headers),this.getDefaultHeaders()),debug:this.requestDebug})).fileContent,[4,this.reqClass.upload(r)];case 1:return[2,i.sent()]}})})},t.prototype.download=function(t){return ht(this,void 0,Promise,function(){return vt(this,function(e){switch(e.label){case 0:return[4,this.reqClass.download(dt(dt({},t),{headers:dt(dt({},t.headers),this.getDefaultHeaders()),debug:this.requestDebug}))];case 1:return[2,e.sent()]}})})},t.prototype.getUploadByteLength=function(t){var e,n;return null===(n=(e=this.reqClass).getUploadByteLength)||void 0===n?void 0:n.call(e,t)},t.prototype.getBaseEndPoint=function(t){return void 0===t&&(t="CLOUD_API"),ft(this.config.env,t)},t.prototype.getOauthAccessTokenV2=function(t){return ht(this,void 0,Promise,function(){var e,n;return vt(this,function(o){switch(o.label){case 0:return[4,t.getAccessToken()];case 1:return e=o.sent(),[4,t.getCredentials()];case 2:return n=o.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}})})},t.prototype.request=function(t,e,n,o){var r,i;return ht(this,void 0,Promise,function(){var a,s,c,u,l,p,f,d,h,v,y,g,b,m,w,O,A,I,E,P,S,C,_;return vt(this,function(x){switch(x.label){case 0:if(x.trys.push([0,4,,5]),a="x-tcb-trace_".concat(this.config.env),s="application/x-www-form-urlencoded",c=dt({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==mt.indexOf(t))return[3,2];if(!(u=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return l=u.oauthInstance,p=l.oauth2client,f=c,[4,this.getOauthAccessTokenV2(p)];case 1:f.access_token=x.sent().accessToken,x.label=2;case 2:return"storage.uploadFile"===t?(d=new FormData,Object.keys(d).forEach(function(t){Object.prototype.hasOwnProperty.call(d,t)&&void 0!==d[t]&&d.append(t,c[t])}),s="multipart/form-data"):(s="application/json;charset=UTF-8",d={},Object.keys(c).forEach(function(t){void 0!==c[t]&&(d[t]=c[t])})),h={headers:dt(dt({"content-type":s},this.getDefaultHeaders()),null==n?void 0:n.headers)},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(v=this.localCache.getStore(a))&&(h.headers["X-TCB-Trace"]=v),y=void 0!==(null==n?void 0:n.parse)?n.parse:e.parse,g=void 0!==(null==n?void 0:n.inQuery)?n.inQuery:e.inQuery,b=void 0!==(null==n?void 0:n.search)?n.search:e.search,m=dt(dt({},(null==n?void 0:n.defaultQuery)||{}),{env:this.config.env}),y&&(m.parse=!0),g&&(m=dt(dt({},g),m)),w=(null==n?void 0:n.endPointMode)||this.config.endPointMode||"CLOUD_API",O=pt(this.config.env,w),A=O.baseUrl,I=O.protocol,"GATEWAY"===w&&/^((database)\.)|(auth\.wsWebSign)/.test(t)&&(E=pt(this.config.env,"CLOUD_API"),A="".concat(E.baseUrl.match(/\/\/([^/?#]*)/)[0],"/web")),P=void 0,P=n.pathname?bt(I,"".concat(null===(r=ft(this.config.env,w))||void 0===r?void 0:r.replace(/^https?:/,""),"/").concat(n.pathname),m):bt(I,A,m),b&&(P+=b),[4,this.post(dt({url:P,data:d},h),o)];case 3:if(S=x.sent(),(C=null===(i=S.header)||void 0===i?void 0:i["x-tcb-trace"])&&this.localCache.setStore(a,C),200!==Number(S.status)&&200!==Number(S.statusCode)||!S.data)throw new Error("network request error");return[2,S];case 4:_=x.sent();try{_.requestId=_.requestId||(null==n?void 0:n.headers["x-request-id"])||(null==n?void 0:n.headers["X-Request-Id"])||""}catch(t){}throw _;case 5:return[2]}})})},t.prototype.fetch=function(t){var e,n,o,r,i,a,s,c;return ht(this,void 0,Promise,function(){var u,l,p,f,d,h,v,y,g=this;return vt(this,function(b){switch(b.label){case 0:u=t.token,l=t.headers,p=void 0===l?{}:l,f=t.withCredentials,d=void 0===f||f,h=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(t,["token","headers","withCredentials"]),v=function(){return ht(g,void 0,void 0,function(){var t,e,n,o;return vt(this,function(r){switch(r.label){case 0:if(t={},!d)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.getAccessToken(u)];case 2:return(e=r.sent())&&(t.Authorization="Bearer ".concat(e)),[3,4];case 3:if(n=r.sent(),"undefined"==typeof process||null==process.versions||null==process.versions.node)throw n;return[3,4];case 4:return o=dt({headers:dt(dt(dt({"X-SDK-Version":"@cloudbase/js-sdk/".concat(rt())},t),this.getDefaultHeaders()),p),withCredentials:d},h),[2,this.reqClass.fetch(o)]}})})},b.label=1;case 1:return b.trys.push([1,3,,6]),[4,v()];case 2:return[2,b.sent()];case 3:y=b.sent();try{y.requestId=y.requestId||p["x-request-id"]||p["X-Request-Id"]||""}catch(t){}if("ACCESS_TOKEN_EXPIRED"!==(null==y?void 0:y.code))return[3,5];if("function"!=typeof(null===(r=null===(o=null===(n=null===(e=this.config)||void 0===e?void 0:e._fromApp)||void 0===n?void 0:n.oauthInstance)||void 0===o?void 0:o.authApi)||void 0===r?void 0:r.refreshTokenForce))throw y;return[4,null===(c=null===(s=null===(a=null===(i=this.config)||void 0===i?void 0:i._fromApp)||void 0===a?void 0:a.oauthInstance)||void 0===s?void 0:s.authApi)||void 0===c?void 0:c.refreshTokenForce()];case 4:return b.sent(),[2,v()];case 5:throw y;case 6:return[2]}})})},t.prototype.send=function(t,e,n,o){return void 0===e&&(e={}),void 0===n&&(n={}),ht(this,void 0,Promise,function(){var r;return vt(this,function(i){switch(i.label){case 0:return[4,this.request(t,e,dt(dt({},n),{onUploadProgress:e.onUploadProgress}),o)];case 1:if((r=i.sent()).data.code&&this.throwWhenRequestFail)throw m({code:r.data.code,msg:r.data.message||"",requestId:r.requestId},this.errorFactory);return[2,r.data]}})})},t.prototype.gateWay=function(t,e){var n,o;return ht(this,void 0,void 0,function(){var r,i,a,s,c,u,l,p,f,d,h,v,y,g,b,w,O,A,I;return vt(this,function(E){switch(E.label){case 0:if(r=t.url,i=t.name,a=t.data,s=t.path,c=void 0===s?"":s,u=t.method,l=t.header,p=void 0===l?{}:l,!(i&&c||r))throw m({code:yt.INVALID_PARAMS,msg:"[gateWay] invalid function name or path or url"},this.errorFactory);try{f=a?JSON.stringify(a):""}catch(t){throw m({code:yt.INVALID_PARAMS,msg:"[gateWay] invalid data"},this.errorFactory)}if(P=(new Date).getTime(),S=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0,d="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random();return P>0?(e=(P+e)%16|0,P=Math.floor(P/16)):(e=(S+e)%16|0,S=Math.floor(S/16)),("x"===t?e:7&e|8).toString(16)}),h=pt(this.config.env,"GATEWAY"),v=h.baseUrl,y=h.protocol,g="".concat(y).concat(v).concat(r||"/".concat(c,"/").concat(i)),b=["GET","HEAD"].includes(null===(n=null==u?void 0:u.toUpperCase)||void 0===n?void 0:n.call(u)))try{w={};try{w=JSON.parse(a)}catch(t){w=a||{}}g="".concat(g).concat(g.includes("?")?"&":"?").concat(Object.keys(w).map(function(t){return"".concat(t,"=").concat(w[t])}).join("&"))}catch(t){}return[4,this.fetch(dt(dt({method:u||"POST",headers:dt({"Content-Type":"application/json; charset=utf-8","X-Request-Id":d},p)},b?{}:{body:f}),{url:g,customReqOpts:e,shouldThrowOnError:null!==(o=t.shouldThrowOnError)&&void 0!==o?o:this.throwWhenRequestFail}))];case 1:return O=E.sent(),A=[dt({requestId:d},O)],I={},[4,O.data];case 2:return[2,dt.apply(void 0,A.concat([(I.data=E.sent(),I)]))]}var P,S})})},t}(),Pt={};!function(t){t.ZH="zh-CN",t.EN="en-US"}(It||(It={}));var St=((At={})[It.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":"Please check the calling method or visit the AI+ homepage to view the documentation","AI+ 请求出错,错误码":"AI+ request error, error code",错误信息:"error message",未实现:"not implemented","小程序不支持 wasm 加载":"wasm loading is not supported in mini programs","小程序不支持动态 js 加载":"dynamic js loading is not supported in mini programs",请求超时:"request timeout","缺少 privatelink sdk 地址":"missing privatelink sdk address"},At),Ct=function(t,e){var n;return(null===(n=St[e])||void 0===n?void 0:n[t])||t},_t=function(t,e){var n,o,r=function(t){return"lang_".concat(t.clientId||t.env)}(e),i=(t.adapter||{}).localStorage,a=e.lang||(null===(n=null==i?void 0:i.getItem)||void 0===n?void 0:n.call(i,r))||It.ZH;return null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,r,a),new Proxy({t:function(t){return Ct(t,a)},LANG_HEADER_KEY:"Accept-Language",lang:a},{get:function(t,e){var n;return"lang"===e&&(null===(n=null==i?void 0:i.getItem)||void 0===n?void 0:n.call(i,r))||t[e]},set:function(t,e,n){var o;return"lang"===e&&n!==t[e]&&(t[e]=n,t.t=function(t){return Ct(t,n)},null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,r,n),q.fire(M,{i18n:t})),t[e]=n,!0}})},xt=new Set,jt=function(){return jt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},jt.apply(this,arguments)},Tt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},kt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rt=function(){return{adapter:_({},{type:"default",root:window,reqClass:C,wsClass:WebSocket,localStorage}),runtime:S.WEB}},Nt=c,Dt="https://support.qq.com/products/148793",Lt=y,Ut=function(t){return t.mode,t.customInfo,t.title,t.messages,function(t,e,n){}},qt={persistence:"local"},Mt=6e5,Wt={},Kt=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.requestInstance=null,this.version=rt()}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return X},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,$[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return tt(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return this.requestInstance||(t=this.cloudbaseConfig.env,Pt[t]);var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){var n,o,r,i,a;if(void 0===e&&(e={env:""}),e.endPointMode=e.endPointMode||"GATEWAY",X.adapter||this.useDefaultAdapter(),(e=this.dealNodeAdapterConfig(e)).throw=null===(o=null!==(n=e.throw)&&void 0!==n?n:e.throwOnCode)||void 0===o||o,delete e.throwOnCode,!e.env)throw new Error(JSON.stringify({code:Nt.INVALID_PARAMS,msg:"env must not be specified"}));this.isInitialized(e);var s=this.isNodeEnv()?void 0:15e3,c=e.timeout||s,u={env:e.env,region:e.region,accessKey:e.accessKey,context:e.context,auth:e.auth,timeout:c,timeoutMsg:c?"[".concat(ot,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(c/1e3,"s"):void 0};this.requestClient=new X.adapter.reqClass(u),this.cloudbaseConfig=jt(jt(jt({},qt),e),{timeout:c,i18n:_t(X,e)}),function(t){t&&"object"==typeof t&&xt.add(t)}(this.cloudbaseConfig),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var l=this.cloudbaseConfig,p=l.env,f=l.persistence,d=l.debug,h=l.timeout,v=l.oauthClient,y=l.i18n;Z({env:p,persistence:f,debug:d,platformInfo:this.platform}),function(t,e){lt({env:t,region:e,baseUrl:"//".concat(t,".").concat(e||"ap-shanghai",".tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(p,e.region||""),function(t,e,n){var o="//".concat(t,".api.tcloudbasegateway.com/v1");n&&(o="//".concat(t,".api.intl.tcloudbasegateway.com/v1")),lt({endPointKey:"GATEWAY",env:t,baseUrl:o,protocol:e})}(p,ct,e.intl);var g=new t(this.cloudbaseConfig);return g.requestInstance=function(t){var e=new Et(dt(dt({},t),{throw:t.throw}));return Pt[t.env]=e,e}({env:p,region:e.region||"",timeout:h,oauthClient:v,_fromApp:g,i18n:y,endPointMode:e.endPointMode,auth:e.auth,context:e.context,accessKey:e.accessKey,throw:e.throw}),g.requestClient=this.requestClient,null===(r=null==this?void 0:this.fire)||void 0===r||r.call(this,"cloudbase_init",g),this.try2InitAuth(g),(null===(i=X.adapter)||void 0===i?void 0:i.nodeTool)&&(null===(a=X.adapter)||void 0===a||a.nodeTool(g,this.cloudbaseConfig)),g},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,Z({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.setThrowOnCode=function(t){this.cloudbaseConfig.throw=t},t.prototype.updateLang=function(t){var e;t&&t!==(null===(e=this.cloudbaseConfig.i18n)||void 0===e?void 0:e.lang)&&(this.cloudbaseConfig.i18n.lang=t)},t.prototype.registerExtension=function(t){Wt[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,o=void 0,i=function(){var n;return function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(o){switch(o.label){case 0:if(!(n=Wt[t]))throw new Error(JSON.stringify({code:Nt.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,o.sent()]}})},new((r=void 0)||(r=Promise))(function(t,e){function a(t){try{c(i.next(t))}catch(t){e(t)}}function s(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r(function(t){t(n)})).then(a,s)}c((i=i.apply(n,o||[])).next())});var n,o,r,i},t.prototype.useAdapters=function(t,e){var n=function(t,e){for(var n,o=0,r=(n=t,"[object Array]"===Object.prototype.toString.call(n)?t:[t]);o<r.length;o++){var i=r[o],a=i.isMatch,s=i.genAdapter,c=i.runtime;if(a())return{adapter:_({isMatch:a},s(e)),runtime:c}}}(t,e)||{},o=n.adapter,r=n.runtime;o&&(X.adapter=o),r&&(X.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,o=e.target;if(Object.prototype.hasOwnProperty.call(t,o))throw new Error(JSON.stringify({code:V.INVALID_OPERATION,msg:"target:".concat(o," is not exist")}));var r=t.prototype[o];if("function"!=typeof r)throw new Error(JSON.stringify({code:V.INVALID_OPERATION,msg:"target:".concat(o," is not a function which is the only type supports hook")}));t.prototype[o]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,K([this],t,!1)),r.call.apply(r,K([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){H(t,e)},t.prototype.registerVersion=function(t){!function(t){nt=t}(t),this.version=t},t.prototype.registerSdkName=function(t){!function(t){ot=t,function(t){i=t}(t)}(t)},t.prototype.isInitialized=function(t){return void 0===t&&(t=this.cloudbaseConfig),"string"==typeof t.env&&["your-env-id","your-envid","your_env_id","xxx-yyy","xxxx-yyy","envId","env-id","your-environment-id","REPLACE_ME"].some(function(e){return t.env.toLowerCase()===e.toLowerCase()})&&Lt(Nt.INVALID_PARAMS,'[CloudBase] 检测到环境 ID "'.concat(t.env,'" 可能是占位符,请替换为真实的环境 ID。\n')+" 获取方式:登录腾讯云开发平台 → 环境管理 → 环境设置 → 环境 ID\n 建议通过环境变量配置:process.env.CLOUDBASE_ENV 或 import.meta.env.VITE_CLOUDBASE_ENV"),!!(null==t?void 0:t.env)},t.prototype.registerEndPoint=function(t,e){lt({baseUrl:t,protocol:e,env:this.config.env,endPointKey:"CLOUD_API"})},t.prototype.registerEndPointWithKey=function(t){lt({env:this.config.env,endPointKey:t.key,baseUrl:t.url,protocol:t.protocol})},t.prototype.registerHost=function(t,e){void 0===e&&(e="http");var n=t.replace(/^(https?:)?\/\//,""),o="//".concat(n);lt({baseUrl:"".concat(o,"/web"),protocol:e,env:this.config.env,endPointKey:"CLOUD_API"}),lt({baseUrl:"".concat(o,"/v1"),protocol:e,env:this.config.env,endPointKey:"GATEWAY"})},t.prototype.getEndPointWithKey=function(t){var e=pt(this.config.env,t);return{BASE_URL:e.baseUrl,PROTOCOL:e.protocol}},t.prototype.parseCaptcha=function(t){return w(t)},t.prototype.useDefaultAdapter=function(){var t=Rt.bind(this)(),e=t.adapter,n=t.runtime;X.adapter=e,X.runtime=n},t.prototype.isNodeEnv=function(){var t;return"undefined"!=typeof process&&!!(null===(t=X.adapter)||void 0===t?void 0:t.getSecretInfo)},t.prototype.formatTimeout=function(t){if(null==t)return t;switch(!0){case t>Mt:return Lt(Nt.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),Mt;case t<100:return Lt(Nt.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},t.prototype.try2InitAuth=function(t){try{t.auth()}catch(t){console.log("try2InitAuth error:",t)}},t.prototype.dealNodeAdapterConfig=function(t){var e,n,o,r,i;if(this.isNodeEnv()){var a=null===(e=X.adapter)||void 0===e?void 0:e.getSecretInfo(t);t.env&&"symbol"!=typeof t.env||(t.env=a.env),a.credentials&&(t.auth=jt(jt({},t.auth),{credentials:a.credentials}));var s=t,c=s.secretId||(null===(n=t.auth)||void 0===n?void 0:n.secretId),u=s.secretKey||(null===(o=t.auth)||void 0===o?void 0:o.secretKey);if(c&&u){var l=s.sessionToken||(null===(r=t.auth)||void 0===r?void 0:r.sessionToken)||"";t.auth=jt(jt({},t.auth),{secretId:c,secretKey:u,sessionToken:l,secretType:(null===(i=t.auth)||void 0===i?void 0:i.secretType)||(l?"SESSION_SECRET":"SECRET")})}}return t},Tt([Ut({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Dt)]}),kt("design:type",Function),kt("design:paramtypes",[Object]),kt("design:returntype",t)],t.prototype,"init",null),Tt([Ut({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Dt)]}),kt("design:type",Function),kt("design:paramtypes",[String,Object]),kt("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),Vt=new Kt,Bt=void 0===J.WxRequest?null:(J.default.genAdapter=function(t){return{root:{globalThis:{}},reqClass:J.WxRequest,wsClass:J.WxMpWebSocket,captchaOptions:{openURIWithCallback:function(e){var n=t.EventBus,o={},r=e;console.log("openURIWithCallback",e);var i=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){r=i[1],console.log("openURIWithCallback url",r);var a=i[2];a&&(o=(0,J.parseQueryString)(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,c=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(o,["token"]);return/^data:/.test(r)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: ".concat(e)}):s?new Promise(function(t){console.log("wait for captcha..."),n.$emit("CAPTCHA_DATA_CHANGE",G(G({},c),{token:s,url:r})),n.$once("RESOLVE_CAPTCHA_DATA",function(e){t(e)})}):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:J.wxMpStorage,primaryStorage:u.StorageType.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},J.default);Bt&&Vt.useAdapters(Bt);const Ht=Vt,Ft=JSON.parse('{"i8":"3.10.3-beta.0"}');Ht.registerVersion(Ft.i8);try{window.cloudbase=Ht}catch(t){}const Jt=Ht;var Gt=r.Z;export{Gt as default};
|
|
1
|
+
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";import*as n from"@cloudbase/adapter-wx_mp";var o={d:(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},r={};o.d(r,{Z:()=>Ft});var i="@cloudbase/js-sdk";function a(){return i}var s="https:",c={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};const u=(l={AbstractSDKRequest:()=>t.AbstractSDKRequest,AbstractStorage:()=>t.AbstractStorage,StorageType:()=>t.StorageType},p={},o.d(p,l),p);var l,p,f,d=(f=function(t,e){return f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},f(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function h(t){return"[object FormData]"===Object.prototype.toString.call(t)}function v(t,e,n){void 0===n&&(n={});var o=/\?/.test(e),r="";return Object.keys(n).forEach(function(t){""===r?!o&&(e+="?"):r+="&",r+="".concat(t,"=").concat(encodeURIComponent(n[t]))}),/^http(s)?:\/\//.test(e+=r)?e:"".concat(t).concat(e)}function y(t,e){console.warn("[".concat(a(),"][").concat(t,"]:").concat(e))}var g=function(t){function e(e){var n=t.call(this,e.msg||e.message||"")||this;return n.code=e.code||"",n.requestId=e.requestId||"",Object.defineProperty(n,"message",{value:e.msg||e.message||"",enumerable:!0,writable:!0,configurable:!0}),n}return d(e,t),e}(Error),b=function(t){return new g(t)};function m(t,e){return(e||b)(t)}function w(t){var e={},n=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){t=n[1];var o=n[2];o&&(e=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach(function(t){var n=t.split("="),o=n[0],r=n[1];o=decodeURIComponent(o),r=decodeURIComponent(r),o&&(e[o]?Array.isArray(e[o])?e[o].push(r):e[o]=[e[o],r]:e[o]=r)}),e}(o))}var r=e.token,i=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(e,["token"]);return/^data:/.test(t)&&!r?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:r?{state:i.state,token:r,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}var O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),A=function(){return A=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},A.apply(this,arguments)},I=function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})},E=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function P(t){try{return JSON.parse(t)}catch(e){return t}}var C,S=function(t){function e(e){var n=t.call(this)||this,o=e.timeout,r=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=o||0,n.timeoutMsg=r||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}return O(e,t),e.prototype.get=function(t){return this.request(A(A({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(A(A({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(A(A({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t,n=e.data,o=e.file,r=e.fileContent,i=e.name,a=e.method,s=e.headers,c=void 0===s?{}:s,u=null!=o?o:r,l={post:"post",put:"put"}[null==a?void 0:a.toLowerCase()]||"put",p=new FormData;return"post"===l?(Object.keys(n).forEach(function(t){p.append(t,n[t])}),p.append("key",i),p.append("file",u instanceof Blob?u:new Blob([u])),this.request(A(A({},t),{data:p,method:l}),this.restrictedMethods.includes("upload"))):this.request(A(A({},t),{method:"put",headers:c,body:u}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return I(this,void 0,Promise,function(){var e,n,o,r;return E(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(A(A({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),o=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=n,r.setAttribute("download",o),r.style.display="none",document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise(function(e){e({statusCode:200,tempFilePath:t.url})})]}})})},e.prototype.fetch=function(t){var e;return I(this,void 0,Promise,function(){var n,o,r,i,a,s,c,u,l,p,f,d,h,v,y,g=this;return E(this,function(b){switch(b.label){case 0:return n=new AbortController,o=t.url,r=t.enableAbort,i=void 0!==r&&r,a=t.stream,s=void 0!==a&&a,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,p=void 0===l||l,f=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",function(){return n.abort()})),d=null,i&&f&&(d=setTimeout(function(){console.warn(g.timeoutMsg),n.abort(new Error(g.timeoutMsg))},f)),[4,fetch(o,A(A({},t),{signal:n.signal})).then(function(t){return I(g,void 0,void 0,function(){var e,n,o;return E(this,function(r){switch(r.label){case 0:return clearTimeout(d),p?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return o=(n=Promise).reject,[4,t.json()];case 2:e=o.apply(n,[r.sent()]),r.label=3;case 3:return[2,e];case 4:return[2,t]}})})}).catch(function(t){return clearTimeout(d),Promise.reject(t)})];case 1:return h=b.sent(),s?(v=h.body,[3,5]):[3,2];case 2:return(null===(e=h.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?(y=P,[4,h.text()]):[3,4];case 3:return v=y.apply(void 0,[b.sent()]),[3,5];case 4:v=h.text(),b.label=5;case 5:return[2,{data:v,statusCode:h.status,header:h.headers,response:h}]}})})},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var o=String(t.method).toLowerCase()||"get";return new Promise(function(r){var i=t.url,a=t.headers,c=void 0===a?{}:a,u=t.data,l=t.responseType,p=t.withCredentials,f=t.body,d=t.onUploadProgress,y=v(s,i,"get"===o?u:{}),g=new XMLHttpRequest;g.open(o,y),l&&(g.responseType=l);var b,m,w=t.signal;w&&(w.aborted?g.abort():w.addEventListener("abort",function(){return g.abort()},{once:!0})),Object.keys(c).forEach(function(t){g.setRequestHeader(t,c[t])}),d&&g.upload.addEventListener("progress",d),g.onreadystatechange=function(){var t={};if(4===g.readyState){var e=g.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach(function(t){var e=t.split(": "),o=e.shift().toLowerCase(),r=e.join(": ");n[o]=r}),t.header=n,t.statusCode=g.status;try{t.data="blob"===l?g.response:JSON.parse(g.responseText)}catch(e){t.data="blob"===l?g.response:g.responseText}clearTimeout(b),r(t)}},e&&n.timeout&&(b=setTimeout(function(){console.warn(n.timeoutMsg),g.abort()},n.timeout)),m=h(u)?u:"application/x-www-form-urlencoded"===c["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach(function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))}),e.join("&")}(u):f||(u?JSON.stringify(u):void 0),p&&(g.withCredentials=!0),g.send(m)})},e}(u.AbstractSDKRequest),_=function(){return _=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},_.apply(this,arguments)};!function(t){t.WEB="web",t.WX_MP="wx_mp"}(C||(C={}));var x=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),j=function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})},T=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},k=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return x(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(u.AbstractStorage),R=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,o=void 0===n?{}:n,r=t.keys,i=void 0===r?{}:r;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(y(c.INVALID_PARAMS,"localStorage is not supported on current platform"),new k(e.root));case"none":return new k(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var o={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(o))}catch(t){throw new Error(JSON.stringify({code:c.OPERATION_FAIL,msg:"[".concat(a(),"][").concat(c.OPERATION_FAIL,"]setStore failed"),info:t}))}}else y(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return j(this,void 0,void 0,function(){var o;return T(this,function(r){switch(r.label){case 0:if(!this.storage)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),o={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(o))];case 2:return r.sent(),[3,4];case 3:return r.sent(),[2];case 4:return[2]}})})},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var o=this.storage.getItem(t);return o&&o.indexOf(e)>=0?JSON.parse(o).content:""}y(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return j(this,void 0,void 0,function(){var o;return T(this,function(r){switch(r.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(o=r.sent())&&o.indexOf(e)>=0?[2,JSON.parse(o).content]:[2,""]}})})},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):y(c.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return j(this,void 0,void 0,function(){return T(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}})})},t}(),N=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),D=function(t,e){this.data=e||null,this.name=t},L=function(t){function e(e,n){var o=t.call(this,"error",{error:e,data:n})||this;return o.error=e,o}return N(e,t),e}(D),U=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var o=n[t].indexOf(e);-1!==o&&n[t].splice(o,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof L)return console.error(t.error),this;var n="string"==typeof t?new D(t,e||{}):t,o=n.name;if(this.listens(o)){n.target=this;for(var r=0,i=this.listeners[o]?function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}([],this.listeners[o],!0):[];r<i.length;r++)i[r].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new U;var q=new U,M="lang_change";"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");const W=(t=>{var e={};return o.d(e,t),e})({default:()=>e.default});W.default;var K=function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))},V=c,B={};function H(t,e){var n=e.name,o=e.namespace,r=e.entity,i=e.injectEvents,a=e.IIFE,s=void 0!==a&&a;if(B[n]||o&&t[o])throw new Error(JSON.stringify({code:V.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(s){if(!r||"function"!=typeof r)throw new Error(JSON.stringify({code:V.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));r.call(t)}if(B[n]=e,o?t.prototype[o]=r:F(t.prototype,r),i){var c=i.bus,u=i.events;if(!c||!u||0===u.length)return;var l=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=K(K([],t.prototype.events[n].events,!0),u,!0):t.prototype.events[n]={bus:c,events:u},t.prototype.fire=function(t,e){l(t,e);for(var n=0,o=Object.keys(this.events);n<o.length;n++){var r=o[n],i=this.events[r],a=i.bus;if(i.events.includes(t)){a.fire(t,e);break}}}}}function F(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,o=Object.keys(e);n<o.length;n++){var r=o[n];Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=F(t[r],e[r]))}return t}const J=(t=>{var e={};return o.d(e,t),e})({WxMpWebSocket:()=>n.WxMpWebSocket,WxRequest:()=>n.WxRequest,default:()=>n.default,parseQueryString:()=>n.parseQueryString,wxMpStorage:()=>n.wxMpStorage});var G=function(){return G=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},G.apply(this,arguments)},X={},Y=function(){return Y=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},Y.apply(this,arguments)},Q=R,$={},z={};function Z(t){var e=t.env,n=t.platformInfo,o={userInfoKey:"".concat("user_info","_").concat(e)};$[e]=$[e]||new Q(Y(Y({},t),{keys:o,platformInfo:n})),z[e]=z[e]||new Q(Y(Y({},t),{keys:o,platformInfo:n,persistence:"local"}))}function tt(t){return z[t]}var et=function(){return et=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},et.apply(this,arguments)},nt="",ot="@cloudbase/js-sdk";function rt(){return nt}var it,at=[],st=["env","endPointKey","region"],ct="https:";function ut(t){return at.find(function(e){return st.filter(function(e){return null!=t[e]}).every(function(n){return e[n]===t[n]})})}function lt(t){var e,n;t.protocol&&!/:$/.test(t.protocol)&&(t.protocol="".concat(t.protocol,":"));var o,r=ut(t);r?(null!=t.baseUrl&&(r.baseUrl=t.baseUrl),null!=t.protocol&&(r.protocol=t.protocol)):at.push(et(et({},t),{protocol:null!==(e=t.protocol)&&void 0!==e?e:ct})),"CLOUD_API"===t.endPointKey&&(o=null!==(n=t.protocol)&&void 0!==n?n:ct,s=o)}function pt(t,e,n){return ut({env:t,endPointKey:e,region:n})}function ft(t,e){void 0===e&&(e="CLOUD_API");var n=pt(t,e||"CLOUD_API"),o=n.protocol,r=n.baseUrl;return"".concat(o).concat(r).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(it||(it={}));var dt=function(){return dt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},dt.apply(this,arguments)},ht=function(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})},vt=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},yt=c,gt=h,bt=v,mt=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function wt(t,e,n){var o=t[e];t[e]=function(e){var r={},i={};n.forEach(function(n){var o=n.call(t,e),a=o.data,s=o.headers;Object.assign(r,a),Object.assign(i,s)});var a=e.data;return a&&(gt(a)?Object.keys(r).forEach(function(t){a.append(t,r[t])}):e.data=dt(dt({},a),r)),e.headers=dt(dt({},e.headers||{}),i),o.call(t,e)}}function Ot(){var t=Math.random().toString(16).slice(2);return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(rt()),"x-seqid":t}}}var At,It,Et=function(){function t(t){var e=this;this.config=t;var n={env:this.config.env,region:this.config.region,accessKey:this.config.accessKey,context:this.config.context,auth:this.config.auth,timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new X.adapter.reqClass(n),this.localCache=tt(this.config.env),"GATEWAY"!==this.config.endPointMode&&(wt(this.reqClass,"post",[Ot]),wt(this.reqClass,"upload",[Ot]),wt(this.reqClass,"download",[Ot])),q.on(M,function(t){var n;e.config.i18n=(null===(n=t.data)||void 0===n?void 0:n.i18n)||e.config.i18n})}return Object.defineProperty(t.prototype,"throwWhenRequestFail",{get:function(){var t,e,n,o,r=null===(n=null===(e=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===e?void 0:e.config)||void 0===n?void 0:n.throw;return"boolean"==typeof r?r:!1!==(null===(o=this.config)||void 0===o?void 0:o.throw)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"errorFactory",{get:function(){var t,e,n,o=this.config;return null!==(t=null==o?void 0:o.errorFactory)&&void 0!==t?t:null===(n=null===(e=null==o?void 0:o._fromApp)||void 0===e?void 0:e.config)||void 0===n?void 0:n.errorFactory},enumerable:!1,configurable:!0}),t.prototype.getAccessToken=function(t){return void 0===t&&(t=null),ht(this,void 0,void 0,function(){var e,n,o;return vt(this,function(r){switch(r.label){case 0:if(null!=t)return[2,t];if(!(e=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return n=e.oauthInstance,o=n.oauth2client,[4,this.getOauthAccessTokenV2(o)];case 1:return[2,r.sent().accessToken]}})})},t.prototype.getDefaultHeaders=function(){var t,e,n;return(t={})[null===(e=this.config.i18n)||void 0===e?void 0:e.LANG_HEADER_KEY]=null===(n=this.config.i18n)||void 0===n?void 0:n.lang,t["X-SDK-Version"]="@cloudbase/js-sdk/".concat(rt()),t},Object.defineProperty(t.prototype,"requestDebug",{get:function(){var t,e,n;return!0===(null===(n=null===(e=null===(t=this.config)||void 0===t?void 0:t._fromApp)||void 0===e?void 0:e.config)||void 0===n?void 0:n.debug)},enumerable:!1,configurable:!0}),t.prototype.post=function(t,e){return ht(this,void 0,Promise,function(){return vt(this,function(n){switch(n.label){case 0:return[4,this.reqClass.post(dt(dt({},t),{headers:dt(dt({},t.headers),this.getDefaultHeaders()),customReqOpts:e,debug:this.requestDebug}))];case 1:return[2,n.sent()]}})})},t.prototype.upload=function(t){var e;return ht(this,void 0,Promise,function(){var n,o,r;return vt(this,function(i){switch(i.label){case 0:return o=null!==(e=(n=t).file)&&void 0!==e?e:n.fileContent,delete(r=dt(dt({},n),{file:o,headers:dt(dt({},n.headers),this.getDefaultHeaders()),debug:this.requestDebug})).fileContent,[4,this.reqClass.upload(r)];case 1:return[2,i.sent()]}})})},t.prototype.download=function(t){return ht(this,void 0,Promise,function(){return vt(this,function(e){switch(e.label){case 0:return[4,this.reqClass.download(dt(dt({},t),{headers:dt(dt({},t.headers),this.getDefaultHeaders()),debug:this.requestDebug}))];case 1:return[2,e.sent()]}})})},t.prototype.getUploadByteLength=function(t){var e,n;return null===(n=(e=this.reqClass).getUploadByteLength)||void 0===n?void 0:n.call(e,t)},t.prototype.getBaseEndPoint=function(t){return void 0===t&&(t="CLOUD_API"),ft(this.config.env,t)},t.prototype.getOauthAccessTokenV2=function(t){return ht(this,void 0,Promise,function(){var e,n;return vt(this,function(o){switch(o.label){case 0:return[4,t.getAccessToken()];case 1:return e=o.sent(),[4,t.getCredentials()];case 2:return n=o.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}})})},t.prototype.request=function(t,e,n,o){var r,i;return ht(this,void 0,Promise,function(){var a,s,c,u,l,p,f,d,h,v,y,g,b,m,w,O,A,I,E,P,C,S,_;return vt(this,function(x){switch(x.label){case 0:if(x.trys.push([0,4,,5]),a="x-tcb-trace_".concat(this.config.env),s="application/x-www-form-urlencoded",c=dt({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==mt.indexOf(t))return[3,2];if(!(u=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return l=u.oauthInstance,p=l.oauth2client,f=c,[4,this.getOauthAccessTokenV2(p)];case 1:f.access_token=x.sent().accessToken,x.label=2;case 2:return"storage.uploadFile"===t?(d=new FormData,Object.keys(d).forEach(function(t){Object.prototype.hasOwnProperty.call(d,t)&&void 0!==d[t]&&d.append(t,c[t])}),s="multipart/form-data"):(s="application/json;charset=UTF-8",d={},Object.keys(c).forEach(function(t){void 0!==c[t]&&(d[t]=c[t])})),h={headers:dt(dt({"content-type":s},this.getDefaultHeaders()),null==n?void 0:n.headers)},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(v=this.localCache.getStore(a))&&(h.headers["X-TCB-Trace"]=v),y=void 0!==(null==n?void 0:n.parse)?n.parse:e.parse,g=void 0!==(null==n?void 0:n.inQuery)?n.inQuery:e.inQuery,b=void 0!==(null==n?void 0:n.search)?n.search:e.search,m=dt(dt({},(null==n?void 0:n.defaultQuery)||{}),{env:this.config.env}),y&&(m.parse=!0),g&&(m=dt(dt({},g),m)),w=(null==n?void 0:n.endPointMode)||this.config.endPointMode||"CLOUD_API",O=pt(this.config.env,w),A=O.baseUrl,I=O.protocol,"GATEWAY"===w&&/^((database)\.)|(auth\.wsWebSign)/.test(t)&&(E=pt(this.config.env,"CLOUD_API"),A="".concat(E.baseUrl.match(/\/\/([^/?#]*)/)[0],"/web")),P=void 0,P=n.pathname?bt(I,"".concat(null===(r=ft(this.config.env,w))||void 0===r?void 0:r.replace(/^https?:/,""),"/").concat(n.pathname),m):bt(I,A,m),b&&(P+=b),[4,this.post(dt({url:P,data:d},h),o)];case 3:if(C=x.sent(),(S=null===(i=C.header)||void 0===i?void 0:i["x-tcb-trace"])&&this.localCache.setStore(a,S),200!==Number(C.status)&&200!==Number(C.statusCode)||!C.data)throw new Error("network request error");return[2,C];case 4:_=x.sent();try{_.requestId=_.requestId||(null==n?void 0:n.headers["x-request-id"])||(null==n?void 0:n.headers["X-Request-Id"])||""}catch(t){}throw _;case 5:return[2]}})})},t.prototype.fetch=function(t){var e,n,o,r,i,a,s,c;return ht(this,void 0,Promise,function(){var u,l,p,f,d,h,v,y,g=this;return vt(this,function(b){switch(b.label){case 0:u=t.token,l=t.headers,p=void 0===l?{}:l,f=t.withCredentials,d=void 0===f||f,h=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(t,["token","headers","withCredentials"]),v=function(){return ht(g,void 0,void 0,function(){var t,e,n,o;return vt(this,function(r){switch(r.label){case 0:if(t={},!d)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.getAccessToken(u)];case 2:return(e=r.sent())&&(t.Authorization="Bearer ".concat(e)),[3,4];case 3:if(n=r.sent(),"undefined"==typeof process||null==process.versions||null==process.versions.node)throw n;return[3,4];case 4:return o=dt({headers:dt(dt(dt({"X-SDK-Version":"@cloudbase/js-sdk/".concat(rt())},t),this.getDefaultHeaders()),p),withCredentials:d},h),[2,this.reqClass.fetch(o)]}})})},b.label=1;case 1:return b.trys.push([1,3,,6]),[4,v()];case 2:return[2,b.sent()];case 3:y=b.sent();try{y.requestId=y.requestId||p["x-request-id"]||p["X-Request-Id"]||""}catch(t){}if("ACCESS_TOKEN_EXPIRED"!==(null==y?void 0:y.code))return[3,5];if("function"!=typeof(null===(r=null===(o=null===(n=null===(e=this.config)||void 0===e?void 0:e._fromApp)||void 0===n?void 0:n.oauthInstance)||void 0===o?void 0:o.authApi)||void 0===r?void 0:r.refreshTokenForce))throw y;return[4,null===(c=null===(s=null===(a=null===(i=this.config)||void 0===i?void 0:i._fromApp)||void 0===a?void 0:a.oauthInstance)||void 0===s?void 0:s.authApi)||void 0===c?void 0:c.refreshTokenForce()];case 4:return b.sent(),[2,v()];case 5:throw y;case 6:return[2]}})})},t.prototype.send=function(t,e,n,o){return void 0===e&&(e={}),void 0===n&&(n={}),ht(this,void 0,Promise,function(){var r;return vt(this,function(i){switch(i.label){case 0:return[4,this.request(t,e,dt(dt({},n),{onUploadProgress:e.onUploadProgress}),o)];case 1:if((r=i.sent()).data.code&&this.throwWhenRequestFail)throw m({code:r.data.code,msg:r.data.message||"",requestId:r.requestId},this.errorFactory);return[2,r.data]}})})},t.prototype.gateWay=function(t,e){var n,o;return ht(this,void 0,void 0,function(){var r,i,a,s,c,u,l,p,f,d,h,v,y,g,b,w,O,A,I;return vt(this,function(E){switch(E.label){case 0:if(r=t.url,i=t.name,a=t.data,s=t.path,c=void 0===s?"":s,u=t.method,l=t.header,p=void 0===l?{}:l,!(i&&c||r))throw m({code:yt.INVALID_PARAMS,msg:"[gateWay] invalid function name or path or url"},this.errorFactory);try{f=a?JSON.stringify(a):""}catch(t){throw m({code:yt.INVALID_PARAMS,msg:"[gateWay] invalid data"},this.errorFactory)}if(P=(new Date).getTime(),C=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0,d="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random();return P>0?(e=(P+e)%16|0,P=Math.floor(P/16)):(e=(C+e)%16|0,C=Math.floor(C/16)),("x"===t?e:7&e|8).toString(16)}),h=pt(this.config.env,"GATEWAY"),v=h.baseUrl,y=h.protocol,g="".concat(y).concat(v).concat(r||"/".concat(c,"/").concat(i)),b=["GET","HEAD"].includes(null===(n=null==u?void 0:u.toUpperCase)||void 0===n?void 0:n.call(u)))try{w={};try{w=JSON.parse(a)}catch(t){w=a||{}}g="".concat(g).concat(g.includes("?")?"&":"?").concat(Object.keys(w).map(function(t){return"".concat(t,"=").concat(w[t])}).join("&"))}catch(t){}return[4,this.fetch(dt(dt({method:u||"POST",headers:dt({"Content-Type":"application/json; charset=utf-8","X-Request-Id":d},p)},b?{}:{body:f}),{url:g,customReqOpts:e,shouldThrowOnError:null!==(o=t.shouldThrowOnError)&&void 0!==o?o:this.throwWhenRequestFail}))];case 1:return O=E.sent(),A=[dt({requestId:d},O)],I={},[4,O.data];case 2:return[2,dt.apply(void 0,A.concat([(I.data=E.sent(),I)]))]}var P,C})})},t}(),Pt={};!function(t){t.ZH="zh-CN",t.EN="en-US"}(It||(It={}));var Ct=((At={})[It.EN]={"请检查调用方式,或前往云开发 AI+ 首页查看文档":"Please check the calling method or visit the AI+ homepage to view the documentation","AI+ 请求出错,错误码":"AI+ request error, error code",错误信息:"error message",未实现:"not implemented","小程序不支持 wasm 加载":"wasm loading is not supported in mini programs","小程序不支持动态 js 加载":"dynamic js loading is not supported in mini programs",请求超时:"request timeout","缺少 privatelink sdk 地址":"missing privatelink sdk address"},At),St=function(t,e){var n;return(null===(n=Ct[e])||void 0===n?void 0:n[t])||t},_t=function(t,e){var n,o,r=function(t){return"lang_".concat(t.clientId||t.env)}(e),i=(t.adapter||{}).localStorage,a=e.lang||(null===(n=null==i?void 0:i.getItem)||void 0===n?void 0:n.call(i,r))||It.ZH;return null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,r,a),new Proxy({t:function(t){return St(t,a)},LANG_HEADER_KEY:"Accept-Language",lang:a},{get:function(t,e){var n;return"lang"===e&&(null===(n=null==i?void 0:i.getItem)||void 0===n?void 0:n.call(i,r))||t[e]},set:function(t,e,n){var o;return"lang"===e&&n!==t[e]&&(t[e]=n,t.t=function(t){return St(t,n)},null===(o=null==i?void 0:i.setItem)||void 0===o||o.call(i,r,n),q.fire(M,{i18n:t})),t[e]=n,!0}})},xt=new Set,jt=function(){return jt=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},jt.apply(this,arguments)},Tt=function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},kt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rt=function(){return{adapter:_({},{type:"default",root:window,reqClass:S,wsClass:WebSocket,localStorage}),runtime:C.WEB}},Nt=c,Dt="https://support.qq.com/products/148793",Lt=y,Ut=function(t){return t.mode,t.customInfo,t.title,t.messages,function(t,e,n){}},qt={persistence:"local"},Mt=6e5,Wt={},Kt=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null,this.requestInstance=null,this.version=rt()}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return X},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,$[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return tt(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return this.requestInstance||(t=this.cloudbaseConfig.env,Pt[t]);var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){var n,o,r,i,a;if(void 0===e&&(e={env:""}),e.endPointMode=e.endPointMode||"GATEWAY",X.adapter||this.useDefaultAdapter(),(e=this.dealNodeAdapterConfig(e)).throw=null===(o=null!==(n=e.throw)&&void 0!==n?n:e.throwOnCode)||void 0===o||o,delete e.throwOnCode,!e.env)throw new Error(JSON.stringify({code:Nt.INVALID_PARAMS,msg:"env must not be specified"}));this.isInitialized(e);var s=this.isNodeEnv()?void 0:15e3,c=e.timeout||s,u={env:e.env,region:e.region,accessKey:e.accessKey,context:e.context,auth:e.auth,timeout:c,timeoutMsg:c?"[".concat(ot,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(c/1e3,"s"):void 0};this.requestClient=new X.adapter.reqClass(u),this.cloudbaseConfig=jt(jt(jt({},qt),e),{timeout:c,i18n:_t(X,e)}),function(t){t&&"object"==typeof t&&xt.add(t)}(this.cloudbaseConfig),delete this.cloudbaseConfig.lang,this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var l=this.cloudbaseConfig,p=l.env,f=l.persistence,d=l.debug,h=l.timeout,v=l.oauthClient,y=l.i18n;Z({env:p,persistence:f,debug:d,platformInfo:this.platform}),function(t,e){lt({env:t,region:e,baseUrl:"//".concat(t,".").concat(e||"ap-shanghai",".tcb-api.tencentcloudapi.com/web"),protocol:void 0,endPointKey:"CLOUD_API"})}(p,e.region||""),function(t,e,n){var o="//".concat(t,".api.tcloudbasegateway.com/v1");n&&(o="//".concat(t,".api.intl.tcloudbasegateway.com/v1")),lt({endPointKey:"GATEWAY",env:t,baseUrl:o,protocol:e})}(p,ct,e.intl);var g=new t(this.cloudbaseConfig);return g.requestInstance=function(t){var e=new Et(dt(dt({},t),{throw:t.throw}));return Pt[t.env]=e,e}({env:p,region:e.region||"",timeout:h,oauthClient:v,_fromApp:g,i18n:y,endPointMode:e.endPointMode,auth:e.auth,context:e.context,accessKey:e.accessKey,throw:e.throw}),g.requestClient=this.requestClient,null===(r=null==this?void 0:this.fire)||void 0===r||r.call(this,"cloudbase_init",g),this.try2InitAuth(g),(null===(i=X.adapter)||void 0===i?void 0:i.nodeTool)&&(null===(a=X.adapter)||void 0===a||a.nodeTool(g,this.cloudbaseConfig)),g},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,Z({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.setThrowOnCode=function(t){this.cloudbaseConfig.throw=t},t.prototype.updateLang=function(t){var e;t&&t!==(null===(e=this.cloudbaseConfig.i18n)||void 0===e?void 0:e.lang)&&(this.cloudbaseConfig.i18n.lang=t)},t.prototype.registerExtension=function(t){Wt[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,o=void 0,i=function(){var n;return function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(o){switch(o.label){case 0:if(!(n=Wt[t]))throw new Error(JSON.stringify({code:Nt.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,o.sent()]}})},new((r=void 0)||(r=Promise))(function(t,e){function a(t){try{c(i.next(t))}catch(t){e(t)}}function s(t){try{c(i.throw(t))}catch(t){e(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r(function(t){t(n)})).then(a,s)}c((i=i.apply(n,o||[])).next())});var n,o,r,i},t.prototype.useAdapters=function(t,e){var n=function(t,e){for(var n,o=0,r=(n=t,"[object Array]"===Object.prototype.toString.call(n)?t:[t]);o<r.length;o++){var i=r[o],a=i.isMatch,s=i.genAdapter,c=i.runtime;if(a())return{adapter:_({isMatch:a},s(e)),runtime:c}}}(t,e)||{},o=n.adapter,r=n.runtime;o&&(X.adapter=o),r&&(X.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,o=e.target;if(Object.prototype.hasOwnProperty.call(t,o))throw new Error(JSON.stringify({code:V.INVALID_OPERATION,msg:"target:".concat(o," is not exist")}));var r=t.prototype[o];if("function"!=typeof r)throw new Error(JSON.stringify({code:V.INVALID_OPERATION,msg:"target:".concat(o," is not a function which is the only type supports hook")}));t.prototype[o]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,K([this],t,!1)),r.call.apply(r,K([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){H(t,e)},t.prototype.registerVersion=function(t){!function(t){nt=t}(t),this.version=t},t.prototype.registerSdkName=function(t){!function(t){ot=t,function(t){i=t}(t)}(t)},t.prototype.isInitialized=function(t){return void 0===t&&(t=this.cloudbaseConfig),"string"==typeof t.env&&["your-env-id","your-envid","your_env_id","xxx-yyy","xxxx-yyy","envId","env-id","your-environment-id","REPLACE_ME"].some(function(e){return t.env.toLowerCase()===e.toLowerCase()})&&Lt(Nt.INVALID_PARAMS,'[CloudBase] 检测到环境 ID "'.concat(t.env,'" 可能是占位符,请替换为真实的环境 ID。\n')+" 获取方式:登录腾讯云开发平台 → 环境管理 → 环境设置 → 环境 ID\n 建议通过环境变量配置:process.env.CLOUDBASE_ENV 或 import.meta.env.VITE_CLOUDBASE_ENV"),!!(null==t?void 0:t.env)},t.prototype.registerEndPoint=function(t,e){lt({baseUrl:t,protocol:e,env:this.config.env,endPointKey:"CLOUD_API"})},t.prototype.registerEndPointWithKey=function(t){lt({env:this.config.env,endPointKey:t.key,baseUrl:t.url,protocol:t.protocol})},t.prototype.registerHost=function(t,e){void 0===e&&(e="http");var n=t.replace(/^(https?:)?\/\//,""),o="//".concat(n);lt({baseUrl:"".concat(o,"/web"),protocol:e,env:this.config.env,endPointKey:"CLOUD_API"}),lt({baseUrl:"".concat(o,"/v1"),protocol:e,env:this.config.env,endPointKey:"GATEWAY"})},t.prototype.getEndPointWithKey=function(t){var e=pt(this.config.env,t);return{BASE_URL:e.baseUrl,PROTOCOL:e.protocol}},t.prototype.parseCaptcha=function(t){return w(t)},t.prototype.useDefaultAdapter=function(){var t=Rt.bind(this)(),e=t.adapter,n=t.runtime;X.adapter=e,X.runtime=n},t.prototype.isNodeEnv=function(){var t;return"undefined"!=typeof process&&!!(null===(t=X.adapter)||void 0===t?void 0:t.getSecretInfo)},t.prototype.formatTimeout=function(t){if(null==t)return t;switch(!0){case t>Mt:return Lt(Nt.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),Mt;case t<100:return Lt(Nt.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},t.prototype.try2InitAuth=function(t){try{t.auth()}catch(t){console.log("try2InitAuth error:",t)}},t.prototype.dealNodeAdapterConfig=function(t){var e,n,o,r,i;if(this.isNodeEnv()){var a=null===(e=X.adapter)||void 0===e?void 0:e.getSecretInfo(t);t.env&&"symbol"!=typeof t.env||(t.env=a.env),a.credentials&&(t.auth=jt(jt({},t.auth),{credentials:a.credentials}));var s=t,c=s.secretId||(null===(n=t.auth)||void 0===n?void 0:n.secretId),u=s.secretKey||(null===(o=t.auth)||void 0===o?void 0:o.secretKey);if(c&&u){var l=s.sessionToken||(null===(r=t.auth)||void 0===r?void 0:r.sessionToken)||"";t.auth=jt(jt({},t.auth),{secretId:c,secretKey:u,sessionToken:l,secretType:(null===(i=t.auth)||void 0===i?void 0:i.secretType)||(l?"SESSION_SECRET":"SECRET")})}}return t},Tt([Ut({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Dt)]}),kt("design:type",Function),kt("design:paramtypes",[Object]),kt("design:returntype",t)],t.prototype,"init",null),Tt([Ut({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Dt)]}),kt("design:type",Function),kt("design:paramtypes",[String,Object]),kt("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),Vt=new Kt,Bt=void 0===J.WxRequest?null:(J.default.genAdapter=function(t){return{root:{globalThis:{}},reqClass:J.WxRequest,wsClass:J.WxMpWebSocket,captchaOptions:{openURIWithCallback:function(e){var n=t.EventBus,o={},r=e;console.log("openURIWithCallback",e);var i=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(i){r=i[1],console.log("openURIWithCallback url",r);var a=i[2];a&&(o=(0,J.parseQueryString)(a))}console.log("openURIWithCallback queryObj",o);var s=o.token,c=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(t);r<o.length;r++)e.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(t,o[r])&&(n[o[r]]=t[o[r]])}return n}(o,["token"]);return/^data:/.test(r)&&!s?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: ".concat(e)}):s?new Promise(function(t){console.log("wait for captcha..."),n.$emit("CAPTCHA_DATA_CHANGE",G(G({},c),{token:s,url:r})),n.$once("RESOLVE_CAPTCHA_DATA",function(e){t(e)})}):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:J.wxMpStorage,primaryStorage:u.StorageType.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},J.default);Bt&&Vt.useAdapters(Bt);const Ht=Vt;Ht.registerVersion("3.10.3");try{window.cloudbase=Ht}catch(t){}const Ft=Ht;var Jt=r.Z;export{Jt as default};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|