@cloudbase/js-sdk 3.4.7 → 3.4.9-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- 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/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/auth/dist/index.esm.js +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js +1 -1
- package/auth/dist/index.js.map +1 -1
- package/cloudrun/dist/index.esm.js +1 -1
- package/cloudrun/dist/index.esm.js.map +1 -1
- package/cloudrun/dist/index.js +1 -1
- package/cloudrun/dist/index.js.map +1 -1
- package/container/dist/index.esm.js +1 -1
- package/container/dist/index.esm.js.map +1 -1
- package/container/dist/index.js +1 -1
- package/container/dist/index.js.map +1 -1
- 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/functions/dist/index.esm.js +1 -1
- package/functions/dist/index.esm.js.map +1 -1
- package/functions/dist/index.js +1 -1
- package/functions/dist/index.js.map +1 -1
- package/index.d.ts +654 -45
- package/miniprogram_dist/ai.js +1 -1
- package/miniprogram_dist/app.js +1 -1
- package/miniprogram_dist/auth.js +1 -1
- package/miniprogram_dist/cloudrun.js +1 -1
- package/miniprogram_dist/container.js +1 -1
- package/miniprogram_dist/functions.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/model.js +1 -1
- package/miniprogram_dist/oauth.js +1 -1
- package/miniprogram_dist/storage.js +1 -1
- package/model/dist/index.esm.js +1 -1
- package/model/dist/index.esm.js.map +1 -1
- package/model/dist/index.js +1 -1
- package/model/dist/index.js.map +1 -1
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.js +1 -1
- package/oauth/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/storage/dist/index.esm.js +1 -1
- package/storage/dist/index.esm.js.map +1 -1
- package/storage/dist/index.js +1 -1
- package/storage/dist/index.js.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/package.json +1 -1
- package/utilities/dist/cjs/adapters/platforms/web.js +12 -4
- package/utilities/dist/esm/adapters/platforms/web.js +12 -4
- package/utilities/dist/miniprogram/index.js +1 -1
- package/utilities/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_storage",[],t):"object"==typeof exports?exports.cloudbase_storage=t():e.cloudbase_storage=t()}("undefined"!=typeof window?window:this,(()=>(()=>{var e={829:(e,t,r)=>{"use strict";var o;r.r(t),r.d(t,{AbstractSDKRequest:()=>n,AbstractStorage:()=>i,StorageType:()=>o,formatUrl:()=>a}),function(e){e.local="local",e.none="none",e.session="session"}(o||(o={}));var n=function(){},i=function(){};function a(e,t,r){void 0===r&&(r={});var o=/\?/.test(t),n="";for(var i in r)""===n?!o&&(t+="?"):n+="&",n+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=n)?t:""+e+t}},456:function(e,t,r){"use strict";var o,n=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},s=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},c=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},u=this&&this.__generator||function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.registerStorage=t.SupabaseFileAPILikeStorage=t.CloudbaseStorage=t.COMPONENT_NAME=void 0;var l,d=r(957),f=r(877),p=r(388);!function(e){e.put="put",e.post="post"}(l||(l={}));var h=f.constants.getSdkName,g=f.constants.ERRORS,y=f.constants.COMMUNITY_SITE_URL,m=f.utils.isArray,v=f.utils.isString,b=f.utils.isPalinObject,w=f.utils.execCallback,O=f.helpers.catchErrorsDecorator;t.COMPONENT_NAME="storage";var _=function(e,t,r){return c(void 0,void 0,void 0,(function(){var o,n,a;return u(this,(function(s){switch(s.label){case 0:return[4,e.gateWay({path:"storages",name:"get-objects-upload-info",data:[i({objectId:t.path},t.headers?{signedHeader:Object.keys(t.headers).reduce((function(e,r){var o;return i(i({},e),((o={})[r]=[t.headers[r]],o))}),{})}:{})]},r)];case 1:return o=s.sent(),n=(null===(a=o.data)||void 0===a?void 0:a[0])||{},[2,o=i(i({},o),{data:i(i({},n.code?i({},n):{}),{authorization:n.authorization,token:n.token,url:n.uploadUrl,fileId:n.cloudObjectId,cosFileId:n.cloudObjectMeta,download_url:n.downloadUrl})})]}}))}))},S=function(e,t,r){return c(void 0,void 0,void 0,(function(){var o,n;return u(this,(function(a){switch(a.label){case 0:return[4,e.gateWay({path:"storages",name:"get-objects-download-info",data:t.convertedFileList.map((function(e){return{cloudObjectId:e.fileid}}))},r)];case 1:return o=a.sent(),[2,o=i(i({},o),{data:{download_list:null===(n=o.data)||void 0===n?void 0:n.map((function(e){return{code:e.code||"SUCCESS",message:e.message,fileid:e.cloudObjectId,download_url:e.downloadUrl,fileID:e.cloudObjectId,tempFileURL:e.downloadUrl}}))}})]}}))}))},I=function(e,t,r){return c(void 0,void 0,void 0,(function(){var o,n;return u(this,(function(a){switch(a.label){case 0:return[4,e.gateWay({path:"storages",name:"delete-objects",data:t.fileList.map((function(e){return{cloudObjectId:e}}))},r)];case 1:return o=a.sent(),[2,o=i(i({},o),{data:{delete_list:null===(n=o.data)||void 0===n?void 0:n.map((function(e){return{code:e.code||"SUCCESS",fileID:e.cloudObjectId,message:e.message}}))}})]}}))}))},E=function(e,t,r){return c(void 0,void 0,void 0,(function(){var o,n;return u(this,(function(a){switch(a.label){case 0:return[4,e.gateWay({path:"storages",name:"copy-objects",data:t.convertedFileList.map((function(e){return{srcPath:e.src_path,dstPath:e.dst_path,overwrite:e.overwrite,removeOriginal:e.remove_original}}))},r)];case 1:return o=a.sent(),[2,o=i(i({},o),{data:{copy_list:null===(n=o.data)||void 0===n?void 0:n.map((function(e){return{code:e.code||"SUCCESS",fileID:e.cloudObjectId,message:e.message}}))}})]}}))}))},P=t.CloudbaseStorage=function(){function e(){}var r,o,n,d,f,P,N,C,R,j,A,L,F,M,U,x;return e.prototype.isGateWay=function(){return"GATEWAY"===(this.config.endPointMode||"CLOUD_API")},e.prototype.uploadFile=function(e,r){return c(this,void 0,Promise,(function(){var o,n,a,s,c,d,f,p,y,m,b,O,_,S,I,E,P,N,C,R,j,A,L,F;return u(this,(function(u){switch(u.label){case 0:if(o=e.cloudPath,n=e.filePath,a=e.onUploadProgress,A=e.method,s=void 0===A?"put":A,L=e.headers,c=void 0===L?{}:L,d=e.fileContent,!v(o)||!n&&!d)throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".uploadFile] invalid params")}));return f={put:l.put,post:l.post}[s.toLocaleLowerCase()]||l.put,[4,this.getUploadMetadata({cloudPath:o,method:f,headers:f===l.put?c:void 0,customReqOpts:e.customReqOpts})];case 1:return p=u.sent(),y=p.data,m=p.requestId,b=y.url,O=y.authorization,_=y.token,S=y.fileId,I=y.cosFileId,E=y.download_url,N=i(i({},P={url:b,file:n,name:o,onUploadProgress:a,fileContent:d,fileId:S,requestId:m}),{method:l.put,headers:i(i({},c),{authorization:O,"x-cos-meta-fileid":I,"x-cos-security-token":_})}),C=i(i({},P),{method:l.post,data:{key:o,signature:O,"x-cos-meta-fileid":I,success_action_status:"201","x-cos-security-token":_}}),(F={})[l.put]={params:N,isSuccess:function(e){return e>=200&&e<300}},F[l.post]={params:C,isSuccess:function(e){return 201===e}},R=F,[4,this.request.upload(R[f].params)];case 2:return j=u.sent(),R[f].isSuccess(j.statusCode)?[2,w(r,null,{fileID:S,download_url:E,requestId:m})]:[2,w(r,new Error("[".concat(h(),"][").concat(g.OPERATION_FAIL,"][").concat(t.COMPONENT_NAME,"]:").concat(j.data)))]}}))}))},e.prototype.getUploadMetadata=function(e,r){return c(this,void 0,Promise,(function(){var o,n,i,a,s,c,d,f;return u(this,(function(u){switch(u.label){case 0:if(o=e.cloudPath,n=e.method,i=e.headers,!v(o))throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".getUploadMetadata] invalid cloudPath")}));a=this.request,s="storage.getUploadMetadata",u.label=1;case 1:return u.trys.push([1,6,,7]),c=void 0,d={path:o},n&&(d.method=n),n===l.put&&i&&(d.headers=i),this.isGateWay()?[4,_(a,d,e.customReqOpts)]:[3,3];case 2:return c=u.sent(),[3,5];case 3:return[4,a.send(s,d,e.customReqOpts)];case 4:c=u.sent(),u.label=5;case 5:return[2,w(r,null,c)];case 6:return f=u.sent(),[2,w(r,f)];case 7:return[2]}}))}))},e.prototype.deleteFile=function(e,r){return c(this,void 0,Promise,(function(){var o,n,i,a,s,c,l,d;return u(this,(function(u){switch(u.label){case 0:if(!(o=e.fileList)||!m(o)||0===o.length)throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".deleteFile] fileList must not be empty")}));for(n=0,i=o;n<i.length;n++)if(!(a=i[n])||!v(a))throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".deleteFile] fileID must be string")}));return s="storage.batchDeleteFile",c=this.request,l={},this.isGateWay()?[4,I(c,{fileList:o},e.customReqOpts)]:[3,2];case 1:return l=u.sent(),[3,4];case 2:return[4,c.send(s,{fileid_list:o},e.customReqOpts)];case 3:l=u.sent(),u.label=4;case 4:return l.code?[2,w(r,null,l)]:(d={fileList:l.data.delete_list,requestId:l.requestId},[2,w(r,null,d)])}}))}))},e.prototype.getTempFileURL=function(e,r){return c(this,void 0,Promise,(function(){var o,n,i,a,s,c,l,d;return u(this,(function(u){switch(u.label){case 0:if(!(o=e.fileList)||!m(o)||0===o.length)throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".getTempFileURL] fileList must not be empty")}));for(n=[],i=0,a=o;i<a.length;i++)if(s=a[i],b(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID"))throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".getTempFileURL] file info must include fileID")}));n.push({fileid:s.fileID,max_age:s.maxAge||7200})}else{if(!v(s))throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".getTempFileURL] invalid fileList")}));n.push({fileid:s})}return c="storage.batchGetDownloadUrl",l=this.request,d={},this.isGateWay()?[4,S(l,{convertedFileList:n},e.customReqOpts)]:[3,2];case 1:return d=u.sent(),[3,4];case 2:return[4,l.send(c,{file_list:n},e.customReqOpts)];case 3:d=u.sent(),u.label=4;case 4:return d.code?[2,w(r,null,d)]:[2,w(r,null,{fileList:d.data.download_list,requestId:d.requestId})]}}))}))},e.prototype.downloadFile=function(e,r){return c(this,void 0,Promise,(function(){var o,n,i,a,s,c;return u(this,(function(u){switch(u.label){case 0:if(o=e.fileID,!v(o))throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:o,maxAge:600}],customReqOpts:e.customReqOpts})];case 1:return n=u.sent(),"SUCCESS"!==(i=n.fileList[0]).code?[2,w(r,i)]:(a=this.request,s=encodeURI(i.download_url),[4,a.download({url:s,tempFilePath:e.tempFilePath})]);case 2:return c=u.sent(),[2,w(r,null,c)]}}))}))},e.prototype.copyFile=function(e,r){return c(this,void 0,Promise,(function(){var o,n,i,a,s,c,l,d,f;return u(this,(function(u){switch(u.label){case 0:if(!(o=e.fileList)||!m(o)||0===o.length)throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".copyFile] fileList must not be empty")}));for(n=[],i=0,a=o;i<a.length;i++){if(s=a[i],c=s.srcPath,l=s.dstPath,!c||!l||"string"!=typeof c||"string"!=typeof l)throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".copyFile] srcPath and dstPath may not be empty")}));if(c===l)throw new Error(JSON.stringify({code:g.INVALID_PARAMS,msg:"[".concat(t.COMPONENT_NAME,".copyFile] srcPath and dstPath can not be the same")}));n.push({src_path:c,dst_path:l,overwrite:s.overwrite,remove_original:s.removeOriginal})}return d=this.request,f={},this.isGateWay()?[4,E(d,{convertedFileList:n},e.customReqOpts)]:[3,2];case 1:return f=u.sent(),[3,4];case 2:return[4,d.send("storage.batchCopyFile",{file_list:n},e.customReqOpts)];case 3:f=u.sent(),u.label=4;case 4:return f.code?[2,w(r,null,f)]:[2,w(r,null,{fileList:f.data.copy_list,requestId:f.requestId})]}}))}))},e.prototype.getFileInfo=function(e){var t;return c(this,void 0,Promise,(function(){var r,o=this;return u(this,(function(n){switch(n.label){case 0:return[4,this.getTempFileURL(e)];case 1:return(null==(r=n.sent())?void 0:r.fileList)&&(null===(t=null==r?void 0:r.fileList)||void 0===t?void 0:t.length)>0?[4,Promise.all(r.fileList.map((function(e){return c(o,void 0,void 0,(function(){var t,r,o,n,i;return u(this,(function(a){switch(a.label){case 0:if("SUCCESS"!==e.code)return[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,message:e.message}];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.request.fetch({url:e.tempFileURL,method:"HEAD"})];case 2:return t=a.sent(),r=t.header,Headers&&r instanceof Headers&&(r=Object.fromEntries(t.header.entries())),o=parseInt(r["content-length"])||0,n=r["content-type"]||"",[400,404].includes(Number(t.statusCode))?[2,{code:"FILE_NOT_FOUND",fileID:e.fileID,tempFileURL:e.tempFileURL,message:"file not found"}]:[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,cloudId:e.fileID,fileName:e.fileID.split("/").pop(),contentType:n,mime:n.split(";")[0].trim(),size:o,etag:r.etag||"",lastModified:r["last-modified"]||"",cacheControl:r["cache-control"]||""}];case 3:return i=a.sent(),[2,{code:"FETCH_FILE_INFO_ERROR",fileID:e.fileID,tempFileURL:e.tempFileURL,message:i.message}];case 4:return[2]}}))}))})))]:[3,3];case 2:return[2,{fileList:n.sent(),requestId:r.requestId}];case 3:return[2,{fileList:[],requestId:r.requestId}]}}))}))},a([O({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(y)]}),s("design:type",Function),s("design:paramtypes",[Object,"function"==typeof(r="undefined"!=typeof Function&&Function)?r:Object]),s("design:returntype","function"==typeof(o="undefined"!=typeof Promise&&Promise)?o:Object)],e.prototype,"uploadFile",null),a([O({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(y)]}),s("design:type",Function),s("design:paramtypes",[Object,"function"==typeof(n="undefined"!=typeof Function&&Function)?n:Object]),s("design:returntype","function"==typeof(d="undefined"!=typeof Promise&&Promise)?d:Object)],e.prototype,"getUploadMetadata",null),a([O({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(y)]}),s("design:type",Function),s("design:paramtypes",["function"==typeof(f=void 0!==p.ICloudbaseDeleteFileParams&&p.ICloudbaseDeleteFileParams)?f:Object,"function"==typeof(P="undefined"!=typeof Function&&Function)?P:Object]),s("design:returntype","function"==typeof(N="undefined"!=typeof Promise&&Promise)?N:Object)],e.prototype,"deleteFile",null),a([O({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(y)]}),s("design:type",Function),s("design:paramtypes",["function"==typeof(C=void 0!==p.ICloudbaseGetTempFileURLParams&&p.ICloudbaseGetTempFileURLParams)?C:Object,"function"==typeof(R="undefined"!=typeof Function&&Function)?R:Object]),s("design:returntype","function"==typeof(j="undefined"!=typeof Promise&&Promise)?j:Object)],e.prototype,"getTempFileURL",null),a([O({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(y)]}),s("design:type",Function),s("design:paramtypes",["function"==typeof(A=void 0!==p.ICloudbaseDownloadFileParams&&p.ICloudbaseDownloadFileParams)?A:Object,"function"==typeof(L="undefined"!=typeof Function&&Function)?L:Object]),s("design:returntype","function"==typeof(F="undefined"!=typeof Promise&&Promise)?F:Object)],e.prototype,"downloadFile",null),a([O({customInfo:{className:"Cloudbase",methodName:"copyFile"},title:"批量复制文件",messages:["请确认以下各项:"," 1 - 调用 copyFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(y)]}),s("design:type",Function),s("design:paramtypes",["function"==typeof(M=void 0!==p.ICloudbaseCopyFileParams&&p.ICloudbaseCopyFileParams)?M:Object,"function"==typeof(U="undefined"!=typeof Function&&Function)?U:Object]),s("design:returntype","function"==typeof(x="undefined"!=typeof Promise&&Promise)?x:Object)],e.prototype,"copyFile",null),e}(),N=new P,C={name:t.COMPONENT_NAME,entity:{uploadFile:N.uploadFile,deleteFile:N.deleteFile,getTempFileURL:N.getTempFileURL,downloadFile:N.downloadFile,getUploadMetadata:N.getUploadMetadata,copyFile:N.copyFile,getFileInfo:N.getFileInfo,isGateWay:N.isGateWay}},R=function(e){function r(t){var r=e.call(this)||this;return r.shouldThrowOnError=!1,r.bucketId="",r.context=t,r}return n(r,e),Object.defineProperty(r.prototype,"config",{get:function(){var e;return null===(e=this.context)||void 0===e?void 0:e.config},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"request",{get:function(){var e;return null===(e=this.context)||void 0===e?void 0:e.request},enumerable:!1,configurable:!0}),r.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},r.prototype.from=function(e){return this.bucketId=e||"",this},r.prototype.upload=function(e,r,o){return c(this,void 0,Promise,(function(){var n,a,s,c,l,f,p,h,y;return u(this,(function(u){switch(u.label){case 0:n=i({upsert:!0},o),a=n.cacheControl,s=n.contentType,c=n.metadata,u.label=1;case 1:return u.trys.push([1,3,,4]),l=this._getCloudPath(e),f={cloudPath:l,filePath:r},(a||s||c)&&(p={},a&&(p["cache-control"]=a),s&&(p["content-type"]=s),c&&(p["x-cos-metadata-metadata"]=this.toBase64(JSON.stringify(c))),f.headers=p),[4,this.uploadFile(f)];case 2:if(!(h=u.sent()).fileID)throw new Error(JSON.stringify({code:g.OPERATION_FAIL,msg:"[".concat(t.COMPONENT_NAME,".update] no fileID returned")}));return[2,{data:{id:h.fileID,path:e,fullPath:e},error:null}];case 3:if(y=u.sent(),this.shouldThrowOnError)throw y;if((0,d.isStorageError)(y))return[2,{data:null,error:y}];throw y;case 4:return[2]}}))}))},r.prototype.uploadToSignedUrl=function(e,t,r,o){return c(this,void 0,Promise,(function(){return u(this,(function(t){return[2,this.upload(e,r,o)]}))}))},r.prototype.createSignedUploadUrl=function(e){return c(this,void 0,Promise,(function(){var t,r,o;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this._getCloudPath(e),[4,this.getUploadMetadata({cloudPath:t})];case 1:return[2,{data:{signedUrl:(r=n.sent().data).url,token:r.token,path:e,authorization:r.authorization,id:r.fileId,cosFileId:r.cosFileId,downloadUrl:r.download_url},error:null}];case 2:if(o=n.sent(),this.shouldThrowOnError)throw o;return[2,{data:null,error:o instanceof d.StorageError?o:new d.StorageError(o.message)}];case 3:return[2]}}))}))},r.prototype.update=function(e,t,r){return c(this,void 0,Promise,(function(){return u(this,(function(o){return[2,this.upload(e,t,i(i({},r),{upsert:!0}))]}))}))},r.prototype.move=function(e,t){return c(this,void 0,Promise,(function(){var r,o;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.copyFile({fileList:[{srcPath:this._getCloudPath(e),dstPath:this._getCloudPath(t),overwrite:!0,removeOriginal:!0}]})];case 1:if((r=n.sent()).fileList[0].code&&"SUCCESS"!==r.fileList[0].code)throw new d.StorageError(r.fileList[0].message||"Move failed");return[2,{data:{message:"File moved from ".concat(e," to ").concat(t)},error:null}];case 2:if(o=n.sent(),this.shouldThrowOnError)throw o;if((0,d.isStorageError)(o))return[2,{data:null,error:o}];throw o;case 3:return[2]}}))}))},r.prototype.copy=function(e,t){return c(this,void 0,Promise,(function(){var r,o;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.copyFile({fileList:[{srcPath:this._getCloudPath(e),dstPath:this._getCloudPath(t),overwrite:!0,removeOriginal:!1}]})];case 1:if((r=n.sent()).fileList[0].code&&"SUCCESS"!==r.fileList[0].code)throw new d.StorageError(r.fileList[0].message||"Copy failed");return[2,{data:{path:this._getCloudPath(t)},error:null}];case 2:if(o=n.sent(),this.shouldThrowOnError)throw o;if((0,d.isStorageError)(o))return[2,{data:null,error:o}];throw o;case 3:return[2]}}))}))},r.prototype.createSignedUrl=function(e,t,r){return c(this,void 0,Promise,(function(){var o,n,i,a,s,c,l;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),o=this._normalizeCloudId(e),[4,this.getTempFileURL({fileList:[{fileID:o,maxAge:t}]})];case 1:if("SUCCESS"!==(n=u.sent()).fileList[0].code)throw new d.StorageError("Failed to create signed URL: [".concat(n.fileList[0].code,"] ").concat(n.fileList[0].fileID));return i=n.fileList[0].download_url,a=[],void 0!==(null==r?void 0:r.download)&&("string"==typeof r.download?a.push("download=".concat(encodeURIComponent(r.download))):!0===r.download&&a.push("download=true")),(null==r?void 0:r.transform)&&(s=this._transformOptsToQueryString(r.transform))&&a.push(s),a.length>0&&(c=i.includes("?")?"&":"?",i="".concat(i).concat(c).concat(a.join("&"))),[2,{data:{signedUrl:i},error:null}];case 2:if(l=u.sent(),this.shouldThrowOnError)throw l;if((0,d.isStorageError)(l))return[2,{data:null,error:l}];throw l;case 3:return[2]}}))}))},r.prototype.createSignedUrls=function(e,t){return c(this,void 0,Promise,(function(){var r,o,n=this;return u(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r=e.map((function(e){return{fileID:n._normalizeCloudId(e),maxAge:t}})),[4,this.getTempFileURL({fileList:r})];case 1:return[2,{data:i.sent().fileList.map((function(t,r){return{path:e[r],signedUrl:t.tempFileURL||"",error:"SUCCESS"===t.code?null:t.message}})),error:null}];case 2:if(o=i.sent(),this.shouldThrowOnError)throw o;if((0,d.isStorageError)(o))return[2,{data:null,error:o}];throw o;case 3:return[2]}}))}))},r.prototype.download=function(e,t){return c(this,void 0,Promise,(function(){var r,o,n=this;return u(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),o={},[4,c(n,void 0,void 0,(function(){var r,o,n,i;return u(this,(function(a){switch(a.label){case 0:return[4,this.createSignedUrl(e,600,{transform:t})];case 1:if((r=a.sent()).error)throw r.error;return o=encodeURI(null===(i=r.data)||void 0===i?void 0:i.signedUrl),[4,this.request.reqClass.get({url:o,headers:{},responseType:"blob"})];case 2:if(!(n=a.sent().data))throw new d.StorageError("Download failed: no file content");return[2,new Blob([n])]}}))}))];case 1:return[2,(o.data=i.sent(),o.error=null,o)];case 2:if(r=i.sent(),this.shouldThrowOnError)throw r;if((0,d.isStorageError)(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},r.prototype.info=function(e){return c(this,void 0,Promise,(function(){var t,r,o,n,i,a,s,c;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=e.startsWith("cloud://"),r=t?this._extractPathFromFileId(e):e,o=t?this._extractBucketFromFileId(e):this.bucketId,[4,this.getFileInfo({fileList:[this._normalizeCloudId(e)]})];case 1:if(n=u.sent(),"SUCCESS"!==(i=n.fileList[0]).code)throw new d.StorageError(i.message);return a=(new Date).toISOString(),s=(i.lastModified?new Date(i.lastModified):new Date).toISOString(),[2,{data:{id:i.fileID,version:"1",name:r,bucketId:o,updatedAt:s,createdAt:s,lastAccessedAt:a,size:i.size,cacheControl:i.cacheControl,contentType:i.contentType,etag:i.etag,lastModified:s,metadata:{}},error:null}];case 2:if(c=u.sent(),this.shouldThrowOnError)throw c;return[2,{data:null,error:c instanceof d.StorageError?c:new d.StorageError(c.message)}];case 3:return[2]}}))}))},r.prototype.exists=function(e){return c(this,void 0,Promise,(function(){var t,r,o;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getFileInfo({fileList:[this._normalizeCloudId(e)]})];case 1:if(t=n.sent(),"FILE_NOT_FOUND"===(r=t.fileList[0]).code)return[2,{data:!1,error:null}];if("SUCCESS"!==r.code)throw new d.StorageError(r.message);return[2,{data:!0,error:null}];case 2:if(o=n.sent(),this.shouldThrowOnError)throw o;if((0,d.isStorageError)(o))return[2,{data:null,error:o}];throw o;case 3:return[2]}}))}))},r.prototype.getPublicUrl=function(e,t){return c(this,void 0,Promise,(function(){var r;return u(this,(function(o){switch(o.label){case 0:return[4,this.createSignedUrl(e,600,t)];case 1:return(r=o.sent()).data?[2,{data:{publicUrl:r.data.signedUrl}}]:[2,{data:null,error:r.error}]}}))}))},r.prototype.remove=function(e){return c(this,void 0,Promise,(function(){var t,r,o,n,i,a,s,c,l,f,p=this;return u(this,(function(u){switch(u.label){case 0:for(u.trys.push([0,3,,4]),t=10,r=[],o=0;o<e.length;o+=t)r.push(e.slice(o,o+t));return[4,Promise.all(r.map((function(e){return Promise.all(e.map((function(e){return p.info(e)})))})))];case 1:return n=u.sent(),i=new Map,n.flat().forEach((function(r,o){r.data&&i.set(e[Math.floor(o/t)*t+o%t],r.data)})),a=e.map((function(e){return p._normalizeCloudId(e)})),[4,this.deleteFile({fileList:a})];case 2:if(s=u.sent(),(c=s.fileList.filter((function(e){return"SUCCESS"!==e.code}))).length>0)throw new d.StorageError("Delete failed for ".concat(c.length," file(s)"));return l=(new Date).toISOString(),[2,{data:e.map((function(e){var t=i.get(e);return{name:null==t?void 0:t.name,id:null==t?void 0:t.id,bucket_id:null==t?void 0:t.bucketId,owner:void 0,updated_at:(null==t?void 0:t.updatedAt)||l,created_at:null==t?void 0:t.createdAt,last_accessed_at:(null==t?void 0:t.lastAccessedAt)||l,metadata:(null==t?void 0:t.metadata)||{},buckets:{id:null==t?void 0:t.bucketId,name:null==t?void 0:t.bucketId,owner:void 0,public:!1,created_at:"",updated_at:l}}})),error:null}];case 3:if(f=u.sent(),this.shouldThrowOnError)throw f;if((0,d.isStorageError)(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}}))}))},r.prototype.list=function(){return c(this,void 0,void 0,(function(){return u(this,(function(e){throw new d.StorageError("Not implemented")}))}))},r.prototype._getCloudPath=function(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")},r.prototype._normalizeCloudId=function(e){var t;if(/^cloud:\/\//.test(e))return e;var r=this._getCloudPath(e);if(!this.bucketId)throw new d.StorageError("bucketId is not set");var o=(null===(t=this.config)||void 0===t?void 0:t.env)||"";return o?"cloud://".concat(o,".").concat(this.bucketId,"/").concat(r):void 0},r.prototype.toBase64=function(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)},r.prototype._transformOptsToQueryString=function(e){var t=["imageMogr2"];if(e.width||e.height){var r=e.width||"",o=e.height||"";"fill"===e.resize?t.push("thumbnail/".concat(r,"x").concat(o,"!")):"contain"===e.resize?t.push("thumbnail/".concat(r,"x").concat(o)):t.push("thumbnail/".concat(r,"x").concat(o,"^"))}if(e.format&&"origin"!==e.format&&t.push("format/".concat(e.format)),void 0!==e.quality){var n=Math.max(1,Math.min(100,e.quality));t.push("quality/".concat(n))}return t.join("/")},r.prototype._extractPathFromFileId=function(e){var t=e.replace(/^cloud:\/\//,"").split("/");return t.length<2?e:t.slice(1).join("/")},r.prototype._extractBucketFromFileId=function(e){var t=e.replace(/^cloud:\/\//,"").split("/");if(t.length<1)return"";var r=t[0],o=r.indexOf(".");return-1===o?r:r.substring(o+1)},r}(P);t.SupabaseFileAPILikeStorage=R;var j={name:"".concat(t.COMPONENT_NAME,"/supabase"),IIFE:!0,entity:function(){var e=new WeakMap;Object.defineProperty(this.prototype,"storage",{get:function(){if(e.has(this))return e.get(this);var t=this,r=new Proxy({},{get:function(e,r){return"config"===r?t.config:"request"===r?t.request:void 0}}),o=new R(r);return e.set(this,o),o},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(C),cloudbase.registerComponent(j)}catch(e){}function A(e){try{e.registerComponent(C),e.registerComponent(j)}catch(e){console.warn(e)}}t.registerStorage=A;try{window.registerStorage=A}catch(e){}},957:function(e,t){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)});Object.defineProperty(t,"__esModule",{value:!0}),t.StorageUnknownError=t.StorageApiError=t.isStorageError=t.StorageError=void 0;var n=function(e){function t(t){var r=e.call(this,t)||this;return r.__isStorageError=!0,r.name="StorageError",r}return o(t,e),t}(Error);t.StorageError=n,t.isStorageError=function(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e};var i=function(e){function t(t,r,o){var n=e.call(this,t)||this;return n.name="StorageApiError",n.status=r,n.statusCode=o,n}return o(t,e),t.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},t}(n);t.StorageApiError=i;var a=function(e){function t(t,r){var o=e.call(this,t)||this;return o.name="StorageUnknownError",o.originalError=r,o}return o(t,e),t}(n);t.StorageUnknownError=a},563:function(e,t,r){"use strict";var o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},o.apply(this,arguments)},n=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,c=a(r(92)),u=r(962);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e,t){for(var r=0,n=(0,u.isArray)(e)?e:[e];r<n.length;r++){var i=n[r],a=i.isMatch,s=i.genAdapter,c=i.runtime;if(a())return{adapter:o({isMatch:a},s(t)),runtime:c}}},t.useDefaultAdapter=function(){return{adapter:o({},c.genAdapter()),runtime:s.WEB}}},92:function(e,t,r){"use strict";var o,n=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var c=r(829),u=r(962),l=r(464),d=function(e){function t(t){var r=e.call(this)||this,o=t.timeout,n=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=o||0,r.timeoutMsg=n||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return n(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,o=e.name,n=e.method,a=e.headers,s=void 0===a?{}:a,c={post:"post",put:"put"}[null==n?void 0:n.toLowerCase()]||"put",u=new FormData;return"post"===c?(Object.keys(t).forEach((function(e){u.append(e,t[e])})),u.append("key",o),u.append("file",r),this.request(i(i({},e),{data:u,method:c}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return a(this,void 0,Promise,(function(){var t,r,o,n;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=a.sent().data,r=window.URL.createObjectURL(new Blob([t])),o=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(n=document.createElement("a")).href=r,n.setAttribute("download",o),n.style.display="none",document.body.appendChild(n),n.click(),window.URL.revokeObjectURL(r),document.body.removeChild(n),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.fetch=function(e){var t;return a(this,void 0,Promise,(function(){var r,o,n,c,u,l,d,f,p,h,g,y,m,v=this;return s(this,(function(b){switch(b.label){case 0:return r=new AbortController,o=e.url,n=e.enableAbort,c=void 0!==n&&n,u=e.stream,l=void 0!==u&&u,d=e.signal,f=e.timeout,p=e.shouldThrowOnError,h=void 0===p||p,g=null!=f?f:this.timeout,d&&(d.aborted&&r.abort(),d.addEventListener("abort",(function(){return r.abort()}))),y=null,c&&g&&(y=setTimeout((function(){console.warn(v.timeoutMsg),r.abort(new Error(v.timeoutMsg))}),g)),[4,fetch(o,i(i({},e),{signal:r.signal})).then((function(e){return a(v,void 0,void 0,(function(){var t,r,o;return s(this,(function(n){switch(n.label){case 0:return clearTimeout(y),h?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return o=(r=Promise).reject,[4,e.json()];case 2:t=o.apply(r,[n.sent()]),n.label=3;case 3:return[2,t];case 4:return[2,e]}}))}))})).catch((function(e){if(clearTimeout(y),h)return Promise.reject(e)}))];case 1:return m=b.sent(),[2,{data:l?m.body:(null===(t=m.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?m.json():m.text(),statusCode:m.status,header:m.headers}]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var o=String(e.method).toLowerCase()||"get";return new Promise((function(n){var i,a,s=e.url,c=e.headers,d=void 0===c?{}:c,f=e.data,p=e.responseType,h=e.withCredentials,g=e.body,y=e.onUploadProgress,m=(0,u.formatUrl)((0,l.getProtocol)(),s,"get"===o?f:{}),v=new XMLHttpRequest;v.open(o,m),p&&(v.responseType=p),Object.keys(d).forEach((function(e){v.setRequestHeader(e,d[e])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var e={};if(4===v.readyState){var t=v.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach((function(e){var t=e.split(": "),o=t.shift().toLowerCase(),n=t.join(": ");r[o]=n})),e.header=r,e.statusCode=v.status;try{e.data="blob"===p?v.response:JSON.parse(v.responseText)}catch(t){e.data="blob"===p?v.response:v.responseText}clearTimeout(i),n(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),v.abort()}),r.timeout)),a=(0,u.isFormData)(f)?f:"application/x-www-form-urlencoded"===d["content-type"]?(0,u.toQueryString)(f):g||(f?JSON.stringify(f):void 0),h&&(v.withCredentials=!0),v.send(a)}))},t}(c.AbstractSDKRequest);t.WebRequest=d,t.genAdapter=function(){return{type:"default",root:window,reqClass:d,wsClass:WebSocket,localStorage}}},464:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var r="@cloudbase/js-sdk";t.setSdkName=function(e){r=e},t.getSdkName=function(){return r};var o="https:";t.setProtocol=function(e){o=e},t.getProtocol=function(){return o},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},519:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},778:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,n(r(464),t),n(r(519),t),t.OATUH_LOGINTYPE="constants"},517:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},n=this&&this.__generator||function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(962),a=r(778),s=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(s=-1!==navigator.userAgent.indexOf("Firefox"));var c=s?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function l(e){var t=e.err,r=e.className,o=e.methodName,n=e.sourceLink;if(!n)return null;var i,a=t.stack.split("\n"),c=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(o,"\\]\\s*\\(.*\\)$")),l=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(o,"\\]")),d=a.findIndex((function(e){return c.test(e)}));if(-1!==d){var f=a.filter((function(e,t){return t>d}));f.unshift(a[d].replace(l,"".concat(r,".").concat(o)).replace(u,n)),(i=new Error).stack="".concat(s?"@debugger":"Error","\n").concat(f.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,s=e.customInfo,d=void 0===s?{}:s,f=e.title,p=e.messages,h=void 0===p?[]:p;return function(e,t,s){if(a.IS_DEBUG_MODE){var p=d.className||e.constructor.name,g=d.methodName||t,y=s.value,m=function(){var e="",t=(new Error).stack.split("\n"),r=t.findIndex((function(e){return c.test(e)}));if(-1!==r){var o=u.exec(t[r+1]||"");e=o?o[0]:""}return e}();s.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l({err:new Error,className:p,methodName:g,sourceLink:m});try{return y.apply(this,e)}catch(e){var o=e,n=e.message,a=e.error,s=e.error_description,c={title:f||"".concat(p,".").concat(g," failed"),content:[{type:"error",body:e}]};if(n&&/^\{.*\}$/.test(n)){var u=JSON.parse(n);c.subtitle=n,u.code&&(r?(r.code=u.code,r.msg=u.msg):(e.code=u.code,e.message=u.msg),o=r||e,c.content=h.map((function(e){return{type:"info",body:e}})))}throw a&&s&&(c.subtitle=s,r?(r.code=a,r.msg=s):(e.code=a,e.message=s),o=r||e,c.content=h.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(c),o}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o(this,void 0,void 0,(function(){var t,r,o,a,s,c,u,d;return n(this,(function(n){switch(n.label){case 0:t=l({err:new Error,className:p,methodName:g,sourceLink:m}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,y.apply(this,e)];case 2:return[2,n.sent()];case 3:throw r=n.sent(),o=r,a=r.message,s=r.error,c=r.error_description,u={title:f||"".concat(p,".").concat(g," failed"),content:[{type:"error",body:r}]},a&&/^\{.*\}$/.test(a)&&(d=JSON.parse(a),u.subtitle=d,d.code&&(t?(t.code=d.code,t.message=d.msg):(r.code=d.code,r.message=d.msg),o=t||r,u.content=h.map((function(e){return{type:"info",body:e}})))),s&&c&&(u.subtitle=c,t?(t.code=s,t.msg=c):(r.code=s,r.message=c),o=t||r,u.content=h.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),o;case 4:return[2]}}))}))}}}}},260:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(517),t)},877:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return n(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.langEvent=t.AbortController=t.jwt=t.helpers=t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var s=i(r(778));t.constants=s;var c=i(r(563));t.adapters=c;var u=i(r(865));t.cache=u;var l=i(r(940));t.events=l;var d=i(r(991));t.langEvent=d;var f=i(r(962));t.utils=f;var p=i(r(260));t.helpers=p;var h=a(r(644));t.AbortController=h.default;var g={decode:a(r(949)).default};t.jwt=g},644:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){var e=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(t,r){"abort"===t&&e.listeners.push(r)}}}return e.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(e){return e()})))},e}();t.default=r},865:function(e,t,r){"use strict";var o,n=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&s[0]?o.return:s[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,s[1])).done)return n;switch(o=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((n=(n=a.trys).length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var s=r(829),c=r(962),u=r(778),l=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return n(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(s.AbstractStorage),d=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,o=void 0===r?{}:r,n=e.keys,i=void 0===n?{}:n;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:((0,c.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this.storage)try{var o={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(o))}catch(e){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"[".concat((0,u.getSdkName)(),"][").concat(u.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var o;return a(this,(function(n){switch(n.label){case 0:if(!this.storage)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),o={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(o))];case 2:return n.sent(),[3,4];case 3:return n.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var o=this.storage.getItem(e);return o&&o.indexOf(t)>=0?JSON.parse(o).content:""}(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return i(this,void 0,void 0,(function(){var o;return a(this,(function(n){switch(n.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(o=n.sent())&&o.indexOf(t)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();t.CloudbaseCache=d},940:function(e,t,r){"use strict";var o,n=this&&this.__extends||(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var a=r(962),s=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=s;var c=function(e){function t(t,r){var o=e.call(this,"error",{error:t,data:r})||this;return o.error=t,o}return n(t,e),t}(s);t.IErrorEvent=c;var u=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var o=r[e].indexOf(t);-1!==o&&r[e].splice(o,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if((0,a.isInstanceOf)(e,c))return console.error(e.error),this;var r=(0,a.isString)(e)?new s(e,t||{}):e,o=r.name;if(this.listens(o)){r.target=this;for(var n=0,u=this.listeners[o]?i([],this.listeners[o],!0):[];n<u.length;n++)u[n].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var l=new u;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},991:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LANG_CHANGE_EVENT=t.bus=void 0;var o=r(940);t.bus=new o.CloudbaseEventEmitter,t.LANG_CHANGE_EVENT="lang_change"},962:function(e,t,r){"use strict";var o=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.parseCaptcha=t.parseQueryString=t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var n=r(778);t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=(new Date).getTime(),t=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var o=16*Math.random();return e>0?(o=(e+o)%16|0,e=Math.floor(e/16)):(o=(t+o)%16|0,t=Math.floor(t/16)),("x"===r?o:7&o|8).toString(16)}))},t.formatUrl=function(e,t,r){void 0===r&&(r={});var o=/\?/.test(t),n="";return Object.keys(r).forEach((function(e){""===n?!o&&(t+="?"):n+="&",n+="".concat(e,"=").concat(encodeURIComponent(r[e]))})),/^http(s)?:\/\//.test(t+=n)?t:"".concat(e).concat(t)},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||decodeURIComponent(window.location.search),o=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),n=r.substr(r.indexOf("?")+1).match(o);return null!=n?n[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],o=[],n=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==n){for(var i=(o=n.split("&")).length-1;i>=0;i-=1)o[i].split("=")[0]===e&&o.splice(i,1);r="".concat(r,"?").concat(o.join("&"))}return r},t.createPromiseCallback=function(){var e={};if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,o){return e?r(e):t(o)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,n.getSdkName)(),"][").concat(e,"]:").concat(t)}))},t.printGroupLog=function(e){var t,r=e.title,o=e.subtitle,n=void 0===o?"":o,i=e.content,a=void 0===i?[]:i,s=e.printTrace,c=void 0!==s&&s,u=e.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,n):(console.group||console.error)(r,n);for(var l=0,d=a;l<d.length;l++){var f=d[l],p=f.type,h=f.body;switch(p){case"info":console.log(h);break;case"warn":console.warn(h);break;case"error":console.error(h)}}c&&(console.trace||console.log)("stack trace:"),null===(t=console.groupEnd)||void 0===t||t.call(console)},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86".concat(e)},t.parseQueryString=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach((function(e){var r=e.split("="),o=r[0],n=r[1];o=decodeURIComponent(o),n=decodeURIComponent(n),o&&(t[o]?Array.isArray(t[o])?t[o].push(n):t[o]=[t[o],n]:t[o]=n)})),t},t.parseCaptcha=function(e){var r={},n=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){e=n[1];var i=n[2];i&&(r=(0,t.parseQueryString)(i))}var a=r.token,s=o(r,["token"]);return/^data:/.test(e)&&!a?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:a?{state:s.state,token:a,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}}},388:e=>{e.exports={}},949:(e,t,r)=>{"use strict";function o(e){this.message=e}r.r(t),r.d(t,{InvalidTokenError:()=>a,default:()=>s}),o.prototype=new Error,o.prototype.name="InvalidCharacterError";var n="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new o("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,a=0,s="";n=t.charAt(a++);~n&&(r=i%4?64*r+n:n,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return s};function i(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(n(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return n(t)}}function a(e){this.message=e}a.prototype=new Error,a.prototype.name="InvalidTokenError";const s=function(e,t){if("string"!=typeof e)throw new a("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(i(e.split(".")[r]))}catch(e){throw new a("Invalid token specified: "+e.message)}}}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";var e=o;Object.defineProperty(e,"__esModule",{value:!0}),e.registerStorage=void 0;var t=r(456);e.registerStorage=t.registerStorage})(),o})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_storage",[],e):"object"==typeof exports?exports.cloudbase_storage=e():t.cloudbase_storage=e()}("undefined"!=typeof window?window:this,(()=>(()=>{var t={829:(t,e,r)=>{"use strict";var n;r.r(e),r.d(e,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>n,formatUrl:()=>a}),function(t){t.local="local",t.none="none",t.session="session"}(n||(n={}));var o=function(){},i=function(){};function a(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";for(var i in r)""===o?!n&&(e+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(e+=o)?e:""+t+e}},891:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__decorate||function(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},i=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseStorage=e.COMPONENT_NAME=e.EUploadMethod=void 0;var c,u=r(877),l=r(90),d=r(388);!function(t){t.put="put",t.post="post"}(c=e.EUploadMethod||(e.EUploadMethod={}));var f=u.constants.getSdkName,h=u.constants.ERRORS,p=u.constants.COMMUNITY_SITE_URL,v=u.utils.isArray,y=u.utils.isString,g=u.utils.isPalinObject,m=u.utils.execCallback,b=u.helpers.catchErrorsDecorator;e.COMPONENT_NAME="storage";var w=function(t,e,r){return a(void 0,void 0,void 0,(function(){var o,i,a;return s(this,(function(s){switch(s.label){case 0:return[4,t.gateWay({path:"storages",name:"get-objects-upload-info",data:[n({objectId:e.path},e.signedHeader?{signedHeader:e.signedHeader}:{})]},r)];case 1:return o=s.sent(),i=(null===(a=o.data)||void 0===a?void 0:a[0])||{},[2,n(n({},o),{data:n(n({},i.code?n({},i):{}),{authorization:i.authorization,token:i.token,url:i.uploadUrl,fileId:i.cloudObjectId,cosFileId:i.cloudObjectMeta,download_url:i.downloadUrl})})]}}))}))},O=function(t,e,r){return a(void 0,void 0,void 0,(function(){var o,i;return s(this,(function(a){switch(a.label){case 0:return[4,t.gateWay({path:"storages",name:"get-objects-download-info",data:e.convertedFileList.map((function(t){return{cloudObjectId:t.fileid}}))},r)];case 1:return o=a.sent(),[2,n(n({},o),{data:{download_list:null===(i=o.data)||void 0===i?void 0:i.map((function(t){return{code:t.code||"SUCCESS",message:t.message,fileid:t.cloudObjectId,download_url:t.downloadUrl,fileID:t.cloudObjectId,tempFileURL:t.downloadUrl}}))}})]}}))}))},_=function(t,e,r){return a(void 0,void 0,void 0,(function(){var o,i;return s(this,(function(a){switch(a.label){case 0:return[4,t.gateWay({path:"storages",name:"delete-objects",data:e.fileList.map((function(t){return{cloudObjectId:t}}))},r)];case 1:return o=a.sent(),[2,n(n({},o),{data:{delete_list:null===(i=o.data)||void 0===i?void 0:i.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},S=function(t,e,r){return a(void 0,void 0,void 0,(function(){var o,i;return s(this,(function(a){switch(a.label){case 0:return[4,t.gateWay({path:"storages",name:"copy-objects",data:e.convertedFileList.map((function(t){return{srcPath:t.src_path,dstPath:t.dst_path,overwrite:t.overwrite,removeOriginal:t.remove_original}}))},r)];case 1:return o=a.sent(),[2,n(n({},o),{data:{copy_list:null===(i=o.data)||void 0===i?void 0:i.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},E={txt:"text/plain",json:"application/json",html:"text/html",htm:"text/html",css:"text/css",js:"application/javascript",csv:"text/csv",xml:"application/xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",pdf:"application/pdf",zip:"application/zip",gz:"application/gzip",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",wav:"audio/wav"};function P(t,e){if("undefined"!=typeof Blob&&t instanceof Blob&&t.type)return t.type;var r=/\.([a-zA-Z0-9]+)$/.exec(e||""),n=r?r[1].toLowerCase():"";return E[n]||"application/octet-stream"}function I(t,e){var r=e.toLowerCase();return Object.keys(t).some((function(t){return t.toLowerCase()===r}))}function j(t){return Object.keys(t).reduce((function(e,r){var o;return n(n({},e),((o={})[r]=[t[r]],o))}),{})}e.CloudbaseStorage=function(){function t(t){this.context=t}var r,u,E,N,C,x,T,A,R,U,k,L,F,M,D,B;return Object.defineProperty(t.prototype,"config",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.config},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.request},enumerable:!1,configurable:!0}),t.prototype.isGateWay=function(){return"GATEWAY"===(this.config.endPointMode||"CLOUD_API")},t.prototype.uploadFile=function(t,r){return a(this,void 0,Promise,(function(){var o,i,a,u,d,p,v,g,b,w,O,_,S,E,N,C,x,T,A,R,U,k,L,F,M,D,B,q,G,W,V;return s(this,(function(s){switch(s.label){case 0:if(o=t.cloudPath,i=t.filePath,a=t.onUploadProgress,G=t.method,u=void 0===G?"put":G,W=t.headers,d=void 0===W?{}:W,p=t.fileContent,!y(o)||!i&&!p)throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".uploadFile] invalid params")}));return v={put:c.put,post:c.post}[u.toLocaleLowerCase()]||c.put,g=this.isGateWay(),b=n({},d),w=Object.keys(d).reduce((function(t,e){return"content-length"!==e.toLowerCase()&&(t[e]=d[e]),t}),{}),v===c.put&&g&&(I(b,"content-length")||(O=function(t,e){var r=null!=t?t:e;if(null!==r){if("undefined"!=typeof Blob&&r instanceof Blob)return r.size;if("undefined"!=typeof ArrayBuffer){if(r instanceof ArrayBuffer)return r.byteLength;if("function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(r))return r.byteLength}if("string"==typeof r){if("undefined"!=typeof Blob)return new Blob([r]).size;var n=(0,l.getStringByteLength)(r);return"number"==typeof n?n:r.length}return"object"==typeof r&&"number"==typeof r.size?r.size:void 0}}(i,p),"number"==typeof O&&(b["content-length"]=String(O))),I(b,"content-type")||(b["content-type"]=P(i,o)),I(w,"content-type")||(w["content-type"]=P(i,o))),[4,this.getUploadMetadata({cloudPath:o,method:v,headers:v!==c.put||g?void 0:w,signedHeader:v===c.put&&g?j(b):void 0,customReqOpts:t.customReqOpts})];case 1:return _=s.sent(),S=_.data,E=_.requestId,(null==(N=S)?void 0:N.code)||!(null==N?void 0:N.url)?(C=(null==N?void 0:N.code)||h.OPERATION_FAIL,x=(null==N?void 0:N.message)||"get upload info failed",[2,m(r,new Error("[".concat(f(),"][").concat(C,"][").concat(e.COMPONENT_NAME,"]:").concat(x)))]):(T=S.url,A=S.authorization,R=S.token,U=S.fileId,k=S.cosFileId,L=S.download_url,M=n(n({},F={url:T,file:i,name:o,onUploadProgress:a,fileContent:p,fileId:U,requestId:E}),{method:c.put,headers:n(n({},w),{authorization:A,"x-cos-meta-fileid":k,"x-cos-security-token":R})}),D=n(n({},F),{method:c.post,data:{key:o,signature:A,"x-cos-meta-fileid":k,success_action_status:"201","x-cos-security-token":R}}),(V={})[c.put]={params:M,isSuccess:function(t){return t>=200&&t<300}},V[c.post]={params:D,isSuccess:function(t){return 201===t}},B=V,[4,this.request.upload(B[v].params)]);case 2:return q=s.sent(),B[v].isSuccess(q.statusCode)?[2,m(r,null,{fileID:U,download_url:L,requestId:E})]:[2,m(r,new Error("[".concat(f(),"][").concat(h.OPERATION_FAIL,"][").concat(e.COMPONENT_NAME,"]:").concat(q.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,r){return a(this,void 0,Promise,(function(){var n,o,i,a,u,l,d,f,p,v;return s(this,(function(s){switch(s.label){case 0:if(n=t.cloudPath,o=t.method,i=t.headers,a=t.signedHeader,!y(n))throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getUploadMetadata] invalid cloudPath")}));u=this.request,l="storage.getUploadMetadata",s.label=1;case 1:return s.trys.push([1,6,,7]),d=void 0,f={path:n},p=this.isGateWay(),o&&(f.method=o),o===c.put&&(p&&a?f.signedHeader=a:!p&&i&&(f.headers=i)),p?[4,w(u,f,t.customReqOpts)]:[3,3];case 2:return d=s.sent(),[3,5];case 3:return[4,u.send(l,f,t.customReqOpts)];case 4:d=s.sent(),s.label=5;case 5:return[2,m(r,null,d)];case 6:return v=s.sent(),[2,m(r,v)];case 7:return[2]}}))}))},t.prototype.deleteFile=function(t,r){return a(this,void 0,Promise,(function(){var n,o,i,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:if(!(n=t.fileList)||!v(n)||0===n.length)throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".deleteFile] fileList must not be empty")}));for(o=0,i=n;o<i.length;o++)if(!(a=i[o])||!y(a))throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".deleteFile] fileID must be string")}));return c="storage.batchDeleteFile",u=this.request,l={},this.isGateWay()?[4,_(u,{fileList:n},t.customReqOpts)]:[3,2];case 1:return l=s.sent(),[3,4];case 2:return[4,u.send(c,{fileid_list:n},t.customReqOpts)];case 3:l=s.sent(),s.label=4;case 4:return l.code?[2,m(r,null,l)]:(d={fileList:l.data.delete_list,requestId:l.requestId},[2,m(r,null,d)])}}))}))},t.prototype.getTempFileURL=function(t,r){return a(this,void 0,Promise,(function(){var n,o,i,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:if(!(n=t.fileList)||!v(n)||0===n.length)throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getTempFileURL] fileList must not be empty")}));for(o=[],i=0,a=n;i<a.length;i++)if(c=a[i],g(c)){if(!Object.prototype.hasOwnProperty.call(c,"fileID"))throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getTempFileURL] file info must include fileID")}));o.push({fileid:c.fileID,max_age:c.maxAge||7200})}else{if(!y(c))throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getTempFileURL] invalid fileList")}));o.push({fileid:c})}return u="storage.batchGetDownloadUrl",l=this.request,d={},this.isGateWay()?[4,O(l,{convertedFileList:o},t.customReqOpts)]:[3,2];case 1:return d=s.sent(),[3,4];case 2:return[4,l.send(u,{file_list:o},t.customReqOpts)];case 3:d=s.sent(),s.label=4;case 4:return d.code?[2,m(r,null,d)]:[2,m(r,null,{fileList:d.data.download_list,requestId:d.requestId})]}}))}))},t.prototype.downloadFile=function(t,r){return a(this,void 0,Promise,(function(){var n,o,i,a,c,u;return s(this,(function(s){switch(s.label){case 0:if(n=t.fileID,!y(n))throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}],customReqOpts:t.customReqOpts})];case 1:return o=s.sent(),"SUCCESS"!==(i=o.fileList[0]).code?[2,m(r,i)]:(a=this.request,c=encodeURI(i.download_url),[4,a.download({url:c,tempFilePath:t.tempFilePath})]);case 2:return u=s.sent(),[2,m(r,null,u)]}}))}))},t.prototype.copyFile=function(t,r){return a(this,void 0,Promise,(function(){var n,o,i,a,c,u,l,d,f;return s(this,(function(s){switch(s.label){case 0:if(!(n=t.fileList)||!v(n)||0===n.length)throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".copyFile] fileList must not be empty")}));for(o=[],i=0,a=n;i<a.length;i++){if(c=a[i],u=c.srcPath,l=c.dstPath,!u||!l||"string"!=typeof u||"string"!=typeof l)throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".copyFile] srcPath and dstPath may not be empty")}));if(u===l)throw new Error(JSON.stringify({code:h.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".copyFile] srcPath and dstPath can not be the same")}));o.push({src_path:u,dst_path:l,overwrite:c.overwrite,remove_original:c.removeOriginal})}return d=this.request,f={},this.isGateWay()?[4,S(d,{convertedFileList:o},t.customReqOpts)]:[3,2];case 1:return f=s.sent(),[3,4];case 2:return[4,d.send("storage.batchCopyFile",{file_list:o},t.customReqOpts)];case 3:f=s.sent(),s.label=4;case 4:return f.code?[2,m(r,null,f)]:[2,m(r,null,{fileList:f.data.copy_list,requestId:f.requestId})]}}))}))},t.prototype.getFileInfo=function(t){var e;return a(this,void 0,Promise,(function(){var r,n=this;return s(this,(function(o){switch(o.label){case 0:return[4,this.getTempFileURL(t)];case 1:return(null==(r=o.sent())?void 0:r.fileList)&&(null===(e=null==r?void 0:r.fileList)||void 0===e?void 0:e.length)>0?[4,Promise.all(r.fileList.map((function(t){return a(n,void 0,void 0,(function(){var e,r,n,o,i,a,c;return s(this,(function(s){switch(s.label){case 0:if("SUCCESS"!==t.code)return[2,{code:t.code,fileID:t.fileID,tempFileURL:t.tempFileURL,message:t.message}];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.request.fetch({url:t.tempFileURL,method:"HEAD"})];case 2:return e=s.sent(),r=e.header,"undefined"!=typeof Headers&&r instanceof Headers&&(n={},r.forEach((function(t,e){n[e]=t})),r=n),o=parseInt(r["content-length"])||0,i=r["content-type"]||"",[400,404].includes(Number(e.statusCode))?[2,{code:"FILE_NOT_FOUND",fileID:t.fileID,tempFileURL:t.tempFileURL,message:"file not found"}]:[2,{code:t.code,fileID:t.fileID,tempFileURL:t.tempFileURL,cloudId:t.fileID,fileName:t.fileID.split("/").pop(),contentType:i,mime:i.split(";")[0].trim(),size:o,etag:r.etag||"",lastModified:r["last-modified"]||"",cacheControl:r["cache-control"]||""}];case 3:return a=s.sent(),c="object"==typeof a&&null!==a&&"message"in a?String(a.message):void 0,[2,{code:"FETCH_FILE_INFO_ERROR",fileID:t.fileID,tempFileURL:t.tempFileURL,message:c}];case 4:return[2]}}))}))})))]:[3,3];case 2:return[2,{fileList:o.sent(),requestId:r.requestId}];case 3:return[2,{fileList:[],requestId:r.requestId}]}}))}))},o([b({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(p)]}),i("design:type",Function),i("design:paramtypes",[Object,"function"==typeof(r="undefined"!=typeof Function&&Function)?r:Object]),i("design:returntype","function"==typeof(u="undefined"!=typeof Promise&&Promise)?u:Object)],t.prototype,"uploadFile",null),o([b({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(p)]}),i("design:type",Function),i("design:paramtypes",[Object,"function"==typeof(E="undefined"!=typeof Function&&Function)?E:Object]),i("design:returntype","function"==typeof(N="undefined"!=typeof Promise&&Promise)?N:Object)],t.prototype,"getUploadMetadata",null),o([b({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(p)]}),i("design:type",Function),i("design:paramtypes",["function"==typeof(C=void 0!==d.ICloudbaseDeleteFileParams&&d.ICloudbaseDeleteFileParams)?C:Object,"function"==typeof(x="undefined"!=typeof Function&&Function)?x:Object]),i("design:returntype","function"==typeof(T="undefined"!=typeof Promise&&Promise)?T:Object)],t.prototype,"deleteFile",null),o([b({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(p)]}),i("design:type",Function),i("design:paramtypes",["function"==typeof(A=void 0!==d.ICloudbaseGetTempFileURLParams&&d.ICloudbaseGetTempFileURLParams)?A:Object,"function"==typeof(R="undefined"!=typeof Function&&Function)?R:Object]),i("design:returntype","function"==typeof(U="undefined"!=typeof Promise&&Promise)?U:Object)],t.prototype,"getTempFileURL",null),o([b({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(p)]}),i("design:type",Function),i("design:paramtypes",["function"==typeof(k=void 0!==d.ICloudbaseDownloadFileParams&&d.ICloudbaseDownloadFileParams)?k:Object,"function"==typeof(L="undefined"!=typeof Function&&Function)?L:Object]),i("design:returntype","function"==typeof(F="undefined"!=typeof Promise&&Promise)?F:Object)],t.prototype,"downloadFile",null),o([b({customInfo:{className:"Cloudbase",methodName:"copyFile"},title:"批量复制文件",messages:["请确认以下各项:"," 1 - 调用 copyFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(p)]}),i("design:type",Function),i("design:paramtypes",["function"==typeof(M=void 0!==d.ICloudbaseCopyFileParams&&d.ICloudbaseCopyFileParams)?M:Object,"function"==typeof(D="undefined"!=typeof Function&&Function)?D:Object]),i("design:returntype","function"==typeof(B="undefined"!=typeof Promise&&Promise)?B:Object)],t.prototype,"copyFile",null),t}()},656:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.DownloadBuilder=e.StreamDownloadBuilder=void 0;var a=r(957),s=r(90);function c(t){return(0,a.isStorageError)(t)?t:new a.StorageError((null==t?void 0:t.message)||String(t))}function u(t){var e={};return void 0!==(null==t?void 0:t.download)&&(e.download=!0===t.download?"":t.download),void 0!==(null==t?void 0:t.cacheNonce)&&(e.cacheNonce=String(t.cacheNonce)),{headers:{},query:e}}var l=function(){function t(t){this.ctx=t}return t.prototype.then=function(t,e){return this.execute().then(t,e)},t.prototype.execute=function(){var t,e;return o(this,void 0,Promise,(function(){var r,o,l,d,f;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r=u(this.ctx.options),o=r.headers,l=r.query,[4,this.ctx.http.download({path:"/object/".concat(this.ctx.bucketId,"/").concat((0,s.encodeObjectName)(this.ctx.cleanName)),headers:n(n({},this.ctx.headers),o),query:l,signal:null===(t=this.ctx.parameters)||void 0===t?void 0:t.signal,cache:null===(e=this.ctx.parameters)||void 0===e?void 0:e.cache})];case 1:if(!(d=i.sent().response).body)throw new a.StorageApiError("Response body is empty",d.status,"STORAGE_PG_EMPTY_BODY");return[2,{data:d.body,error:null}];case 2:if(f=i.sent(),this.ctx.shouldThrowOnError)throw f;return[2,{data:null,error:c(f)}];case 3:return[2]}}))}))},t}();e.StreamDownloadBuilder=l;var d=function(){function t(t){this.ctx=t}return t.prototype.asStream=function(){return new l(this.ctx)},t.prototype.then=function(t,e){return this.execute().then(t,e)},t.prototype.execute=function(){var t,e;return o(this,void 0,Promise,(function(){var r,o,a,l,d,f;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),r=u(this.ctx.options),o=r.headers,a=r.query,[4,this.ctx.http.download({path:"/object/".concat(this.ctx.bucketId,"/").concat((0,s.encodeObjectName)(this.ctx.cleanName)),headers:n(n({},this.ctx.headers),o),query:a,signal:null===(t=this.ctx.parameters)||void 0===t?void 0:t.signal,cache:null===(e=this.ctx.parameters)||void 0===e?void 0:e.cache})];case 1:return l=i.sent().response,f={},[4,l.blob()];case 2:return[2,(f.data=i.sent(),f.error=null,f)];case 3:if(d=i.sent(),this.ctx.shouldThrowOnError)throw d;return[2,{data:null,error:c(d)}];case 4:return[2]}}))}))},t}();e.DownloadBuilder=d},90:(t,e)=>{"use strict";function r(){return globalThis.Buffer}Object.defineProperty(e,"__esModule",{value:!0}),e.encodeObjectName=e.toBase64=e.getStringByteLength=void 0,e.getStringByteLength=function(t){var e;return null===(e=r())||void 0===e?void 0:e.byteLength(t)},e.toBase64=function(t){var e=r();return e?e.from(t).toString("base64"):btoa(t)},e.encodeObjectName=function(t){return t.split("/").map((function(t){return encodeURIComponent(t)})).join("/")}},98:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.Http=e.handleOperation=void 0;var a=r(957),s="/v1/storages";e.handleOperation=function(t,e){return o(this,void 0,Promise,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,t()];case 1:return[2,{data:n.sent(),error:null}];case 2:if(r=n.sent(),e)throw r;return(0,a.isStorageError)(r)?[2,{data:null,error:r}]:[2,{data:null,error:new a.StorageError((null==r?void 0:r.message)||String(r))}];case 3:return[2]}}))}))};var c=function(){function t(t){this.ctx=t}return Object.defineProperty(t.prototype,"request",{get:function(){return this.ctx.request},enumerable:!1,configurable:!0}),t.prototype.gatewayOrigin=function(){return this.request.getBaseEndPoint("GATEWAY")},t.prototype.buildUrl=function(t,e){var r="".concat(this.gatewayOrigin()).concat(s).concat(t),n=function(t){if(!t)return"";var e=[];return Object.keys(t).forEach((function(r){var n=t[r];null!=n&&e.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(String(n))))})),e.join("&")}(e);return n&&(r+=(r.includes("?")?"&":"?")+n),r},t.prototype.toFullUrl=function(t){return t?/^https?:\/\//.test(t)||t.startsWith("//")?t:"".concat(this.gatewayOrigin()).concat(s).concat(t.startsWith("/")?"":"/").concat(t):t},t.prototype.send=function(t){return o(this,void 0,Promise,(function(){var e,r,o,a,s,c;return i(this,(function(i){switch(i.label){case 0:return e=this.buildUrl(t.path,t.query),r=t.method.toUpperCase(),o=["GET","HEAD"].includes(r),a=n({},t.headers||{}),o||(void 0!==t.rawBody?s=t.rawBody:void 0!==t.json&&(a["Content-Type"]=a["Content-Type"]||"application/json",s=JSON.stringify(t.json))),[4,this.request.fetch(n(n(n(n({url:e,method:r,headers:a},void 0!==s?{body:s}:{}),{withCredentials:!1!==t.withCredentials,shouldThrowOnError:!1}),t.signal?{signal:t.signal}:{}),t.cache?{cache:t.cache}:{}))];case 1:return c=i.sent(),[2,this.unwrap(c,e)]}}))}))},t.prototype.download=function(t){var e,r;return o(this,void 0,Promise,(function(){var o,s,c,u;return i(this,(function(i){switch(i.label){case 0:return o=this.buildUrl(t.path,t.query),[4,this.request.fetch(n(n({url:o,method:"GET",headers:n({},t.headers||{}),stream:!0,withCredentials:!1!==t.withCredentials,shouldThrowOnError:!1},t.signal?{signal:t.signal}:{}),t.cache?{cache:t.cache}:{}))];case 1:if(s=i.sent(),null===(e=t.signal)||void 0===e?void 0:e.aborted)throw new a.StorageApiError("The download was aborted",0,"STORAGE_PG_ABORTED");if(304===(c=Number(null!==(r=null==s?void 0:s.statusCode)&&void 0!==r?r:200)))throw new a.StorageApiError("Not Modified",c,"STORAGE_PG_NOT_MODIFIED");if(c>=400)throw new a.StorageApiError("Download failed with status ".concat(c),c,"STORAGE_PG_REQUEST_FAIL");if(!(u=null==s?void 0:s.response))throw new a.StorageApiError("Underlying adapter did not expose the raw Response",c,"STORAGE_PG_NO_RESPONSE");return[2,{response:u,status:c,header:null==s?void 0:s.header}]}}))}))},t.prototype.unwrap=function(t,e){var r,n;return o(this,void 0,Promise,(function(){var o,s,c,u;return i(this,(function(i){switch(i.label){case 0:o=Number(null!==(n=null!==(r=null==t?void 0:t.statusCode)&&void 0!==r?r:null==t?void 0:t.status)&&void 0!==n?n:200),s=null==t?void 0:t.data,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s];case 2:return s=i.sent(),[3,4];case 3:return i.sent(),s=void 0,[3,4];case 4:if(o>=200&&o<300)return[2,s];throw c=(null==s?void 0:s.code)||(null==s?void 0:s.error)||"STORAGE_PG_REQUEST_FAIL",u=(null==s?void 0:s.message)||"Storage request failed with status ".concat(o,": ").concat(e),new a.StorageApiError(u,o,c)}}))}))},t}();e.Http=c},456:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.registerStorage=e.StorageClient=e.StorageFileApi=e.ClassicStorageFileApi=e.CloudbaseStorage=e.COMPONENT_NAME=void 0;var i=r(502),a=r(14),s=r(504),c=r(891),u=r(77),l=r(891);Object.defineProperty(e,"COMPONENT_NAME",{enumerable:!0,get:function(){return l.COMPONENT_NAME}}),Object.defineProperty(e,"CloudbaseStorage",{enumerable:!0,get:function(){return l.CloudbaseStorage}});var d=r(77);Object.defineProperty(e,"ClassicStorageFileApi",{enumerable:!0,get:function(){return d.ClassicStorageFileApi}});var f=r(502);Object.defineProperty(e,"StorageFileApi",{enumerable:!0,get:function(){return f.StorageFileApi}});var h=new c.CloudbaseStorage,p={name:c.COMPONENT_NAME,entity:{uploadFile:h.uploadFile,deleteFile:h.deleteFile,getTempFileURL:h.getTempFileURL,downloadFile:h.downloadFile,getUploadMetadata:h.getUploadMetadata,copyFile:h.copyFile,getFileInfo:h.getFileInfo,isGateWay:h.isGateWay}},v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.from=function(t){return t?((0,s.assertValidBucketId)(t,"from"),new i.StorageFileApi(this.http,t,this.shouldThrowOnError)):new u.ClassicStorageFileApi(this.http.ctx,this.shouldThrowOnError)},e}(a.StorageBucketApi);e.StorageClient=v;var y={name:"".concat(c.COMPONENT_NAME,"/supabase"),IIFE:!0,entity:function(){var t=new WeakMap;Object.defineProperty(this.prototype,"storage",{get:function(){if(t.has(this))return t.get(this);var e=this,r=new Proxy({},{get:function(t,r){return"config"===r?e.config:"request"===r?e.request:void 0}}),n=new v(r);return t.set(this,n),n},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(p),cloudbase.registerComponent(y)}catch(t){}function g(t){try{t.registerComponent(p),t.registerComponent(y)}catch(t){console.warn(t)}}e.registerStorage=g;try{window.registerStorage=g}catch(t){}},14:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.StorageBucketApi=void 0;var i=r(98),a=r(504),s=function(){function t(t,e){void 0===e&&(e=!1),this.http=new i.Http(t),this.shouldThrowOnError=e}return t.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},t.prototype.listBuckets=function(t){return n(this,void 0,Promise,(function(){var e=this;return o(this,(function(r){return[2,(0,i.handleOperation)((function(){var r={};return void 0!==(null==t?void 0:t.limit)&&(r.limit=t.limit),void 0!==(null==t?void 0:t.offset)&&(r.offset=t.offset),(null==t?void 0:t.sortColumn)&&(r.sortColumn=t.sortColumn),(null==t?void 0:t.sortOrder)&&(r.sortOrder=t.sortOrder),(null==t?void 0:t.search)&&(r.search=t.search),e.http.send({method:"GET",path:"/bucket/",query:r})}),this.shouldThrowOnError)]}))}))},t.prototype.getBucket=function(t){return n(this,void 0,Promise,(function(){var e=this;return o(this,(function(r){return[2,(0,i.handleOperation)((function(){return(0,a.assertValidBucketId)(t,"getBucket"),e.http.send({method:"GET",path:"/bucket/".concat(t)})}),this.shouldThrowOnError)]}))}))},t.prototype.createBucket=function(t,e){return n(this,void 0,Promise,(function(){var r=this;return o(this,(function(n){return[2,(0,i.handleOperation)((function(){var n;return(0,a.assertValidBucketId)(t,"createBucket"),r.http.send({method:"POST",path:"/bucket/",json:{id:t,name:t,public:null!==(n=null==e?void 0:e.public)&&void 0!==n&&n,type:null==e?void 0:e.type,file_size_limit:null==e?void 0:e.fileSizeLimit,allowed_mime_types:null==e?void 0:e.allowedMimeTypes}})}),this.shouldThrowOnError)]}))}))},t.prototype.updateBucket=function(t,e){return n(this,void 0,Promise,(function(){var r=this;return o(this,(function(n){return[2,(0,i.handleOperation)((function(){return(0,a.assertValidBucketId)(t,"updateBucket"),r.http.send({method:"PUT",path:"/bucket/".concat(t),json:{public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes}})}),this.shouldThrowOnError)]}))}))},t.prototype.deleteBucket=function(t){return n(this,void 0,Promise,(function(){var e=this;return o(this,(function(r){return[2,(0,i.handleOperation)((function(){return(0,a.assertValidBucketId)(t,"deleteBucket"),e.http.send({method:"DELETE",path:"/bucket/".concat(t)})}),this.shouldThrowOnError)]}))}))},t}();e.StorageBucketApi=s},77:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.ClassicStorageFileApi=void 0;var a=r(877),s=r(957),c=r(891),u=r(90),l=a.constants.ERRORS,d=function(){function t(t,e){void 0===e&&(e=!1),this.shouldThrowOnError=!1,this.bucketId="",this.context=t,this.shouldThrowOnError=e,this.storage=new c.CloudbaseStorage(t)}return Object.defineProperty(t.prototype,"config",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.config},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.request},enumerable:!1,configurable:!0}),t.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},t.prototype.upload=function(t,e,r){return o(this,void 0,Promise,(function(){var o,a,u,d,f,h,p,v,y;return i(this,(function(i){switch(i.label){case 0:o=n({upsert:!0},r),a=o.cacheControl,u=o.contentType,d=o.metadata,i.label=1;case 1:return i.trys.push([1,3,,4]),f=this.getCloudPath(t),h={cloudPath:f,filePath:e},(a||u||d)&&(p={},a&&(p["cache-control"]=a),u&&(p["content-type"]=u),d&&(p["x-cos-metadata-metadata"]=this.toBase64(JSON.stringify(d))),h.headers=p),[4,this.storage.uploadFile(h)];case 2:if(!(v=i.sent()).fileID)throw new Error(JSON.stringify({code:l.OPERATION_FAIL,msg:"[".concat(c.COMPONENT_NAME,".update] no fileID returned")}));return[2,{data:{id:v.fileID,path:t,fullPath:t},error:null}];case 3:if(y=i.sent(),this.shouldThrowOnError)throw y;if((0,s.isStorageError)(y))return[2,{data:null,error:y}];throw y;case 4:return[2]}}))}))},t.prototype.uploadToSignedUrl=function(t,e,r,n){return o(this,void 0,Promise,(function(){return i(this,(function(e){return[2,this.upload(t,r,n)]}))}))},t.prototype.createSignedUploadUrl=function(t){return o(this,void 0,Promise,(function(){var e,r,n;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=this.getCloudPath(t),[4,this.storage.getUploadMetadata({cloudPath:e})];case 1:return[2,{data:{signedUrl:(r=o.sent().data).url,token:r.token,path:t,authorization:r.authorization,id:r.fileId,cosFileId:r.cosFileId,downloadUrl:r.download_url},error:null}];case 2:if(n=o.sent(),this.shouldThrowOnError)throw n;return[2,{data:null,error:n instanceof s.StorageError?n:new s.StorageError(n.message)}];case 3:return[2]}}))}))},t.prototype.update=function(t,e,r){return o(this,void 0,Promise,(function(){return i(this,(function(o){return[2,this.upload(t,e,n(n({},r),{upsert:!0}))]}))}))},t.prototype.move=function(t,e){return o(this,void 0,Promise,(function(){var r,n;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(t),dstPath:this.getCloudPath(e),overwrite:!0,removeOriginal:!0}]})];case 1:if((r=o.sent()).fileList[0].code&&"SUCCESS"!==r.fileList[0].code)throw new s.StorageError(r.fileList[0].message||"Move failed");return[2,{data:{message:"File moved from ".concat(t," to ").concat(e)},error:null}];case 2:if(n=o.sent(),this.shouldThrowOnError)throw n;if((0,s.isStorageError)(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},t.prototype.copy=function(t,e){return o(this,void 0,Promise,(function(){var r,n;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(t),dstPath:this.getCloudPath(e),overwrite:!0,removeOriginal:!1}]})];case 1:if((r=o.sent()).fileList[0].code&&"SUCCESS"!==r.fileList[0].code)throw new s.StorageError(r.fileList[0].message||"Copy failed");return[2,{data:{path:this.getCloudPath(e)},error:null}];case 2:if(n=o.sent(),this.shouldThrowOnError)throw n;if((0,s.isStorageError)(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},t.prototype.createSignedUrl=function(t,e,r){return o(this,void 0,Promise,(function(){var n,o,a,c,u,l,d;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=this.normalizeCloudId(t),[4,this.storage.getTempFileURL({fileList:[{fileID:n,maxAge:e}]})];case 1:if("SUCCESS"!==(o=i.sent()).fileList[0].code)throw new s.StorageError("Failed to create signed URL: [".concat(o.fileList[0].code,"] ").concat(o.fileList[0].fileID));return a=o.fileList[0].download_url,c=[],void 0!==(null==r?void 0:r.download)&&("string"==typeof r.download?c.push("download=".concat(encodeURIComponent(r.download))):!0===r.download&&c.push("download=true")),(null==r?void 0:r.transform)&&(u=this.transformOptsToQueryString(r.transform))&&c.push(u),c.length>0&&(l=a.includes("?")?"&":"?",a="".concat(a).concat(l).concat(c.join("&"))),[2,{data:{signedUrl:a},error:null}];case 2:if(d=i.sent(),this.shouldThrowOnError)throw d;if((0,s.isStorageError)(d))return[2,{data:null,error:d}];throw d;case 3:return[2]}}))}))},t.prototype.createSignedUrls=function(t,e){return o(this,void 0,Promise,(function(){var r,n,o=this;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r=t.map((function(t){return{fileID:o.normalizeCloudId(t),maxAge:e}})),[4,this.storage.getTempFileURL({fileList:r})];case 1:return[2,{data:i.sent().fileList.map((function(e,r){return{path:t[r],signedUrl:e.tempFileURL||"",error:"SUCCESS"===e.code?null:e.message}})),error:null}];case 2:if(n=i.sent(),this.shouldThrowOnError)throw n;if((0,s.isStorageError)(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},t.prototype.download=function(t,e){return o(this,void 0,Promise,(function(){var r,n,a=this;return i(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),n={},[4,o(a,void 0,void 0,(function(){var r,n,o,a;return i(this,(function(i){switch(i.label){case 0:return[4,this.createSignedUrl(t,600,{transform:e})];case 1:if((r=i.sent()).error)throw r.error;return n=encodeURI(null===(a=r.data)||void 0===a?void 0:a.signedUrl),[4,this.request.reqClass.get({url:n,headers:{},responseType:"blob"})];case 2:if(!(o=i.sent().data))throw new s.StorageError("Download failed: no file content");return[2,new Blob([o])]}}))}))];case 1:return[2,(n.data=c.sent(),n.error=null,n)];case 2:if(r=c.sent(),this.shouldThrowOnError)throw r;if((0,s.isStorageError)(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},t.prototype.info=function(t){return o(this,void 0,Promise,(function(){var e,r,n,o,a,c,u,l;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e=t.startsWith("cloud://"),r=e?this.extractPathFromFileId(t):t,n=e?this.extractBucketFromFileId(t):this.bucketId,[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(t)]})];case 1:if(o=i.sent(),"SUCCESS"!==(a=o.fileList[0]).code)throw new s.StorageError(a.message);return c=(new Date).toISOString(),u=(a.lastModified?new Date(a.lastModified):new Date).toISOString(),[2,{data:{id:a.fileID,version:"1",name:r,bucketId:n,updatedAt:u,createdAt:u,lastAccessedAt:c,size:a.size,cacheControl:a.cacheControl,contentType:a.contentType,etag:a.etag,lastModified:u,metadata:{}},error:null}];case 2:if(l=i.sent(),this.shouldThrowOnError)throw l;return[2,{data:null,error:l instanceof s.StorageError?l:new s.StorageError(l.message)}];case 3:return[2]}}))}))},t.prototype.exists=function(t){return o(this,void 0,Promise,(function(){var e,r,n;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(t)]})];case 1:if(e=o.sent(),"FILE_NOT_FOUND"===(r=e.fileList[0]).code)return[2,{data:!1,error:null}];if("SUCCESS"!==r.code)throw new s.StorageError(r.message);return[2,{data:!0,error:null}];case 2:if(n=o.sent(),this.shouldThrowOnError)throw n;if((0,s.isStorageError)(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},t.prototype.getPublicUrl=function(t,e){return o(this,void 0,Promise,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.createSignedUrl(t,600,e)];case 1:return(r=n.sent()).data?[2,{data:{publicUrl:r.data.signedUrl}}]:[2,{data:null,error:r.error}]}}))}))},t.prototype.remove=function(t){return o(this,void 0,Promise,(function(){var e,r,n,o,a,c,u,l,d,f,h=this;return i(this,(function(i){switch(i.label){case 0:for(i.trys.push([0,3,,4]),e=10,r=[],n=0;n<t.length;n+=e)r.push(t.slice(n,n+e));return[4,Promise.all(r.map((function(t){return Promise.all(t.map((function(t){return h.info(t)})))})))];case 1:return o=i.sent(),a=new Map,o.forEach((function(r,n){r.forEach((function(r,o){r.data&&a.set(t[n*e+o],r.data)}))})),c=t.map((function(t){return h.normalizeCloudId(t)})),[4,this.storage.deleteFile({fileList:c})];case 2:if(u=i.sent(),(l=u.fileList.filter((function(t){return"SUCCESS"!==t.code}))).length>0)throw new s.StorageError("Delete failed for ".concat(l.length," file(s)"));return d=(new Date).toISOString(),[2,{data:t.map((function(t){var e=a.get(t);return{name:null==e?void 0:e.name,id:null==e?void 0:e.id,bucket_id:null==e?void 0:e.bucketId,owner:void 0,updated_at:(null==e?void 0:e.updatedAt)||d,created_at:null==e?void 0:e.createdAt,last_accessed_at:(null==e?void 0:e.lastAccessedAt)||d,metadata:(null==e?void 0:e.metadata)||{},buckets:{id:null==e?void 0:e.bucketId,name:null==e?void 0:e.bucketId,owner:void 0,public:!1,created_at:"",updated_at:d}}})),error:null}];case 3:if(f=i.sent(),this.shouldThrowOnError)throw f;if((0,s.isStorageError)(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}}))}))},t.prototype.list=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){throw new s.StorageError("Not implemented")}))}))},t.prototype.getCloudPath=function(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")},t.prototype.normalizeCloudId=function(t){var e;if(/^cloud:\/\//.test(t))return t;var r=this.getCloudPath(t);if(!this.bucketId)throw new s.StorageError("bucketId is not set");var n=(null===(e=this.config)||void 0===e?void 0:e.env)||"";return n?"cloud://".concat(n,".").concat(this.bucketId,"/").concat(r):void 0},t.prototype.toBase64=function(t){return(0,u.toBase64)(t)},t.prototype.transformOptsToQueryString=function(t){var e=["imageMogr2"];if(t.width||t.height){var r=t.width||"",n=t.height||"";"fill"===t.resize?e.push("thumbnail/".concat(r,"x").concat(n,"!")):"contain"===t.resize?e.push("thumbnail/".concat(r,"x").concat(n)):e.push("thumbnail/".concat(r,"x").concat(n,"^"))}if(t.format&&"origin"!==t.format&&e.push("format/".concat(t.format)),void 0!==t.quality){var o=Math.max(1,Math.min(100,t.quality));e.push("quality/".concat(o))}return e.join("/")},t.prototype.extractPathFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");return e.length<2?t:e.slice(1).join("/")},t.prototype.extractBucketFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");if(e.length<1)return"";var r=e[0],n=r.indexOf(".");return-1===n?r:r.substring(n+1)},t}();e.ClassicStorageFileApi=d},502:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.StorageFileApi=void 0;var a=r(957),s=r(90),c=r(98),u=r(656),l="3600",d=function(){function t(t,e,r){void 0===r&&(r=!1),this.headers={},this.http=t,this.bucketId=e,this.shouldThrowOnError=r}return t.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},t.prototype.setHeader=function(t,e){var r;if("string"!=typeof t||""===t.trim())throw new a.StorageError("setHeader requires a non-empty header name");if(/[\r\n]/.test(t)||"string"==typeof e&&/[\r\n]/.test(e))throw new a.StorageError("setHeader does not allow CR/LF characters in header name or value");return this.headers=n(n({},this.headers),((r={})[t]=String(e),r)),this},t.prototype.upload=function(t,e,r){return o(this,void 0,Promise,(function(){return i(this,(function(n){return[2,this.uploadOrUpdate("POST",t,e,r)]}))}))},t.prototype.update=function(t,e,r){return o(this,void 0,Promise,(function(){return i(this,(function(n){return[2,this.uploadOrUpdate("PUT",t,e,r)]}))}))},t.prototype.download=function(t,e,r){return new u.DownloadBuilder({http:this.http,bucketId:this.bucketId,cleanName:this.cleanPath(t),options:e,parameters:r,headers:this.headers,shouldThrowOnError:this.shouldThrowOnError})},t.prototype.list=function(t,e,r){return o(this,void 0,Promise,(function(){var n=this;return i(this,(function(a){return[2,(0,c.handleOperation)((function(){return o(n,void 0,void 0,(function(){var n;return i(this,(function(o){return n={prefix:t||""},void 0!==(null==e?void 0:e.limit)&&(n.limit=e.limit),void 0!==(null==e?void 0:e.cursor)&&(n.cursor=e.cursor),void 0!==(null==e?void 0:e.withDelimiter)&&(n.with_delimiter=e.withDelimiter),void 0!==(null==e?void 0:e.sortBy)&&(n.sortBy=e.sortBy),[2,this.send({method:"POST",path:"/object/list/".concat(this.bucketId),json:n,signal:null==r?void 0:r.signal,cache:null==r?void 0:r.cache})]}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.remove=function(t){return o(this,void 0,Promise,(function(){var e=this;return i(this,(function(r){return[2,(0,c.handleOperation)((function(){return o(e,void 0,void 0,(function(){var e,r,n,o,a,s=this;return i(this,(function(i){switch(i.label){case 0:e=t.map((function(t){return s.cleanPath(t)})),r=[],n=0,i.label=1;case 1:return n<e.length?(o=e.slice(n,n+100),[4,this.send({method:"DELETE",path:"/object/".concat(this.bucketId),json:{prefixes:o}})]):[3,4];case 2:a=i.sent(),Array.isArray(a)&&r.push.apply(r,a),i.label=3;case 3:return n+=100,[3,1];case 4:return[2,r]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.copy=function(t,e,r){return o(this,void 0,Promise,(function(){var n=this;return i(this,(function(a){return[2,(0,c.handleOperation)((function(){return o(n,void 0,void 0,(function(){var n;return i(this,(function(o){switch(o.label){case 0:return n=this.buildCopyMoveHeaders(r),[4,this.send({method:"POST",path:"/object/copy",json:{bucketId:this.bucketId,sourceKey:this.cleanPath(t),destinationKey:this.cleanPath(e),destinationBucket:null==r?void 0:r.destinationBucket,copyMetadata:null==r?void 0:r.copyMetadata,metadata:null==r?void 0:r.metadata},headers:n})];case 1:return[2,{path:o.sent().Key}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.move=function(t,e,r){return o(this,void 0,Promise,(function(){var n=this;return i(this,(function(a){return[2,(0,c.handleOperation)((function(){return o(n,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,this.send({method:"POST",path:"/object/move",json:{bucketId:this.bucketId,sourceKey:this.cleanPath(t),destinationKey:this.cleanPath(e),destinationBucket:null==r?void 0:r.destinationBucket}})];case 1:return[2,{message:n.sent().message||"Successfully moved"}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.info=function(t){return o(this,void 0,Promise,(function(){var e=this;return i(this,(function(r){return[2,(0,c.handleOperation)((function(){return o(e,void 0,void 0,(function(){var e,r;return i(this,(function(n){switch(n.label){case 0:return e=this.cleanPath(t),[4,this.send({method:"GET",path:"/object/info/".concat(this.bucketId,"/").concat(this.encodePath(e))})];case 1:return[2,{id:(r=n.sent()).id,name:r.name,version:r.version,bucketId:r.bucket_id,size:r.size,contentType:r.content_type,cacheControl:r.cache_control,etag:r.etag,metadata:r.metadata,lastModified:r.last_modified,createdAt:r.created_at}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.exists=function(t){return o(this,void 0,Promise,(function(){var e,r,n;return i(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=this.cleanPath(t),[4,this.send({method:"GET",path:"/object/info/".concat(this.bucketId,"/").concat(this.encodePath(e))})];case 1:return o.sent(),[2,{data:!0,error:null}];case 2:if(r=o.sent(),void 0!==(n=null==r?void 0:r.status)&&[400,404].includes(Number(n)))return[2,{data:!1,error:null}];if(this.shouldThrowOnError)throw r;return[2,{data:null,error:r instanceof a.StorageError?r:new a.StorageError((null==r?void 0:r.message)||String(r))}];case 3:return[2]}}))}))},t.prototype.createSignedUrl=function(t,e,r){return o(this,void 0,Promise,(function(){var n=this;return i(this,(function(a){return[2,(0,c.handleOperation)((function(){return o(n,void 0,void 0,(function(){var n,o,a;return i(this,(function(i){switch(i.label){case 0:return n=this.cleanPath(t),[4,this.send({method:"POST",path:"/object/sign/".concat(this.bucketId,"/").concat(this.encodePath(n)),json:{expiresIn:e}})];case 1:return o=i.sent(),a=o.fullSignedURL||this.http.toFullUrl(o.signedURL||""),[2,{fullSignedURL:this.appendUrlOptions(a,r)}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.createSignedUrls=function(t,e,r){return o(this,void 0,Promise,(function(){var n=this;return i(this,(function(a){return[2,(0,c.handleOperation)((function(){return o(n,void 0,void 0,(function(){var n,o,a,s,c=this;return i(this,(function(i){switch(i.label){case 0:n=t.map((function(t){return c.cleanPath(t)})),o=[],a=0,i.label=1;case 1:return a<n.length?(s=n.slice(a,a+500),[4,this.send({method:"POST",path:"/object/sign/".concat(this.bucketId),json:{expiresIn:e,paths:s}})]):[3,4];case 2:i.sent().forEach((function(t){var e,n=t.fullSignedURL||(t.signedURL?c.http.toFullUrl(t.signedURL):null);o.push({path:t.path,fullSignedURL:n?c.appendUrlOptions(n,r):null,error:null!==(e=t.error)&&void 0!==e?e:null})})),i.label=3;case 3:return a+=500,[3,1];case 4:return[2,o]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.createSignedUploadUrl=function(t,e){return o(this,void 0,Promise,(function(){var r=this;return i(this,(function(n){return[2,(0,c.handleOperation)((function(){return o(r,void 0,void 0,(function(){var r,n,o;return i(this,(function(i){switch(i.label){case 0:return r=this.cleanPath(t),n={},(null==e?void 0:e.upsert)&&(n["x-upsert"]="true"),[4,this.send({method:"POST",path:"/object/upload/sign/".concat(this.bucketId,"/").concat(this.encodePath(r)),headers:n})];case 1:return[2,{fullSignedURL:(o=i.sent()).fullURL||this.http.toFullUrl(o.url||""),path:r,token:o.token}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.uploadToSignedUrl=function(t,e,r,n){return o(this,void 0,Promise,(function(){var a=this;return i(this,(function(s){return[2,(0,c.handleOperation)((function(){return o(a,void 0,void 0,(function(){var o,a,s,c,u;return i(this,(function(i){switch(i.label){case 0:return o=this.cleanPath(t),a=this.buildUploadBody(r,n),s=a.body,c=a.headers,[4,this.send({method:"PUT",path:"/object/upload/sign/".concat(this.bucketId,"/").concat(this.encodePath(o)),query:{token:e},rawBody:s,headers:c,withCredentials:!1})];case 1:return u=i.sent(),[2,{path:o,fullPath:u.Key}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.getPublicUrl=function(t,e){var r=this.cleanPath(t),n=this.http.buildUrl("/object/public/".concat(this.bucketId,"/").concat(this.encodePath(r)));return{data:{publicUrl:this.appendUrlOptions(n,e)}}},t.prototype.send=function(t){return this.http.send(n(n({},t),{headers:n(n({},this.headers),t.headers||{})}))},t.prototype.uploadOrUpdate=function(t,e,r,n){return o(this,void 0,Promise,(function(){var a=this;return i(this,(function(s){return[2,(0,c.handleOperation)((function(){return o(a,void 0,void 0,(function(){var o,a,s,c,u;return i(this,(function(i){switch(i.label){case 0:return o=this.cleanPath(e),a=this.buildUploadBody(r,n),s=a.body,c=a.headers,"POST"===t&&(c["x-upsert"]=String(Boolean(null==n?void 0:n.upsert))),[4,this.send({method:t,path:"/object/".concat(this.bucketId,"/").concat(this.encodePath(o)),rawBody:s,headers:c})];case 1:return[2,{id:(u=i.sent()).Id,path:o,fullPath:u.Key}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.cleanPath=function(t){var e=t.replace(/^\/+|\/+$/g,"").replace(/\/+/g,"/");if(e.split("/").some((function(t){return".."===t})))throw new a.StorageError('invalid path: ".." segment is not allowed');return e},t.prototype.encodePath=function(t){return(0,s.encodeObjectName)(t)},t.prototype.buildUploadBody=function(t,e){var r,o,i,a,s,c=n({},(null==e?void 0:e.headers)||{}),u=t,d="undefined"!=typeof FormData&&t instanceof FormData;if("undefined"!=typeof Blob&&t instanceof Blob||d){var f=void 0,h={};if(d){var p=this.extractFromFormData(t);f=p.file,h=p.fields}else f=t;var v=null!==(o=null!==(r=null==e?void 0:e.cacheControl)&&void 0!==r?r:h.cacheControl)&&void 0!==o?o:l,y=null!==(i=null==e?void 0:e.contentType)&&void 0!==i?i:h.contentType,g=void 0!==(null==e?void 0:e.metadata)?JSON.stringify(e.metadata):h.metadata,m=new FormData;void 0!==v&&m.append("cacheControl",String(v)),void 0!==y&&m.append("contentType",y),void 0!==g&&m.append("metadata",g),m.append("",f),u=m}else u=t,v=null!==(a=null==e?void 0:e.cacheControl)&&void 0!==a?a:l,y=null!==(s=null==e?void 0:e.contentType)&&void 0!==s?s:"text/plain;charset=UTF-8",c["cache-control"]="max-age=".concat(v),y&&(c["content-type"]=y),(null==e?void 0:e.metadata)&&(c["x-metadata"]=this.toBase64(JSON.stringify(e.metadata)));return{body:u,headers:c}},t.prototype.extractFromFormData=function(t){var e,r={},n=0,o=[];if(t.forEach((function(t,i){if("undefined"!=typeof Blob&&t instanceof Blob)return e=t,void(n+=1);"cacheControl"!==i&&"contentType"!==i&&"metadata"!==i?o.push(i):r[i]=String(t)})),o.length>0&&console.warn("Ignored unsupported FormData field(s): [".concat(o.join(", "),"]. Only file, cacheControl, contentType and metadata are supported")),0===n||!e)throw new a.StorageError("FormData must contain a file");if(n>1)throw new a.StorageError("FormData must contain exactly one file");return{file:e,fields:r}},t.prototype.buildCopyMoveHeaders=function(t){var e={};return(null==t?void 0:t.upsert)&&(e["x-upsert"]="true"),!1===(null==t?void 0:t.copyMetadata)&&(null==t?void 0:t.metadata)&&(e["x-metadata"]=this.toBase64(JSON.stringify(t.metadata))),e},t.prototype.appendUrlOptions=function(t,e){var r=[];if(void 0!==(null==e?void 0:e.download)){var n=!0===e.download?"":String(e.download);r.push("download=".concat(encodeURIComponent(n)))}if(void 0!==(null==e?void 0:e.cacheNonce)&&r.push("cacheNonce=".concat(encodeURIComponent(String(e.cacheNonce)))),0===r.length)return t;var o=t.includes("?")?"&":"?";return"".concat(t).concat(o).concat(r.join("&"))},t.prototype.toBase64=function(t){return(0,s.toBase64)(t)},t}();e.StorageFileApi=d},957:function(t,e){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(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}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.StorageUnknownError=e.StorageApiError=e.isStorageError=e.StorageError=void 0;var o=function(t){function e(e){var r=t.call(this,e)||this;return r.__isStorageError=!0,r.name="StorageError",r}return n(e,t),e}(Error);e.StorageError=o,e.isStorageError=function(t){return"object"==typeof t&&null!==t&&"__isStorageError"in t};var i=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.name="StorageApiError",o.status=r,o.statusCode=n,o}return n(e,t),e.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},e}(o);e.StorageApiError=i;var a=function(t){function e(e,r){var n=t.call(this,e)||this;return n.name="StorageUnknownError",n.originalError=r,n}return n(e,t),e}(o);e.StorageUnknownError=a},504:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assertValidBucketId=e.isValidBucketId=void 0;var n=r(957),o=/[\x00-\x20\x7f/\\?#%]/;e.isValidBucketId=function(t){return"string"==typeof t&&t.length>0&&t.length<=256&&!o.test(t)},e.assertValidBucketId=function(t,e){if("string"!=typeof t||0===t.length)throw new n.StorageError("[storage.".concat(e,"] bucketId is required"));if(t.length>256)throw new n.StorageError("[storage.".concat(e,"] invalid bucketId: length must be 1-").concat(256));var r=o.exec(t);if(r){var i="[storage.".concat(e,'] invalid bucketId "').concat(t,'": ')+"contains forbidden character ".concat(JSON.stringify(r[0]),"; ")+'must not contain whitespace, control chars, "/", "\\", "?", "#" or "%"';throw new n.StorageError(i)}}},563:function(t,e,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var s,c=a(r(92)),u=r(962);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(s=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t,e){for(var r=0,o=(0,u.isArray)(t)?t:[t];r<o.length;r++){var i=o[r],a=i.isMatch,s=i.genAdapter,c=i.runtime;if(a())return{adapter:n({isMatch:a},s(e)),runtime:c}}},e.useDefaultAdapter=function(){return{adapter:n({},c.genAdapter()),runtime:s.WEB}}},92:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var c=r(829),u=r(962),l=r(464),d=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return o(e,t),e.prototype.get=function(t){return this.request(i(i({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(i(i({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(i(i({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=t.method,a=t.headers,s=void 0===a?{}:a,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===c?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",n),u.append("file",r),this.request(i(i({},t),{data:u,method:c}),this.restrictedMethods.includes("upload"))):this.request(i(i({},t),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return a(this,void 0,Promise,(function(){var e,r,n,o;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(i(i({},t),{headers:{},responseType:"blob"}))];case 1:return e=a.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return a(this,void 0,Promise,(function(){var r,n,o,c,u,l,d,f,h,p,v,y,g,m=this;return s(this,(function(b){switch(b.label){case 0:return r=new AbortController,n=t.url,o=t.enableAbort,c=void 0!==o&&o,u=t.stream,l=void 0!==u&&u,d=t.signal,f=t.timeout,h=t.shouldThrowOnError,p=void 0===h||h,v=null!=f?f:this.timeout,d&&(d.aborted&&r.abort(),d.addEventListener("abort",(function(){return r.abort()}))),y=null,c&&v&&(y=setTimeout((function(){console.warn(m.timeoutMsg),r.abort(new Error(m.timeoutMsg))}),v)),[4,fetch(n,i(i({},t),{signal:r.signal})).then((function(t){return a(m,void 0,void 0,(function(){var e,r,n;return s(this,(function(o){switch(o.label){case 0:return clearTimeout(y),p?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,t.json()];case 2:e=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){return clearTimeout(y),Promise.reject(t)}))];case 1:return g=b.sent(),[2,{data:l?g.body:(null===(e=g.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?g.json():g.text(),statusCode:g.status,header:g.headers,response:g}]}}))}))},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i=t.url,a=t.headers,s=void 0===a?{}:a,c=t.data,d=t.responseType,f=t.withCredentials,h=t.body,p=t.onUploadProgress,v=(0,u.formatUrl)((0,l.getProtocol)(),i,"get"===n?c:{}),y=new XMLHttpRequest;y.open(n,v),d&&(y.responseType=d);var g,m,b=t.signal;b&&(b.aborted?y.abort():b.addEventListener("abort",(function(){return y.abort()}),{once:!0})),Object.keys(s).forEach((function(t){y.setRequestHeader(t,s[t])})),p&&y.upload.addEventListener("progress",p),y.onreadystatechange=function(){var t={};if(4===y.readyState){var e=y.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=y.status;try{t.data="blob"===d?y.response:JSON.parse(y.responseText)}catch(e){t.data="blob"===d?y.response:y.responseText}clearTimeout(g),o(t)}},e&&r.timeout&&(g=setTimeout((function(){console.warn(r.timeoutMsg),y.abort()}),r.timeout)),m=(0,u.isFormData)(c)?c:"application/x-www-form-urlencoded"===s["content-type"]?(0,u.toQueryString)(c):h||(c?JSON.stringify(c):void 0),f&&(y.withCredentials=!0),y.send(m)}))},e}(c.AbstractSDKRequest);e.WebRequest=d,e.genAdapter=function(){return{type:"default",root:window,reqClass:d,wsClass:WebSocket,localStorage}}},464:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.COMMUNITY_SITE_URL=e.IS_DEBUG_MODE=e.getProtocol=e.setProtocol=e.getSdkName=e.setSdkName=void 0;var r="@cloudbase/js-sdk";e.setSdkName=function(t){r=t},e.getSdkName=function(){return r};var n="https:";e.setProtocol=function(t){n=t},e.getProtocol=function(){return n},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},519:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},778:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,o(r(464),e),o(r(519),e),e.OATUH_LOGINTYPE="constants"},517:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.catchErrorsDecorator=void 0;var i=r(962),a=r(778),s=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(s=-1!==navigator.userAgent.indexOf("Firefox"));var c=s?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function l(t){var e=t.err,r=t.className,n=t.methodName,o=t.sourceLink;if(!o)return null;var i,a=e.stack.split("\n"),c=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),l=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),d=a.findIndex((function(t){return c.test(t)}));if(-1!==d){var f=a.filter((function(t,e){return e>d}));f.unshift(a[d].replace(l,"".concat(r,".").concat(n)).replace(u,o)),(i=new Error).stack="".concat(s?"@debugger":"Error","\n").concat(f.join("\n"))}return i}e.catchErrorsDecorator=function(t){var e=t.mode,r=void 0===e?"async":e,s=t.customInfo,d=void 0===s?{}:s,f=t.title,h=t.messages,p=void 0===h?[]:h;return function(t,e,s){if(a.IS_DEBUG_MODE){var h=d.className||t.constructor.name,v=d.methodName||e,y=s.value,g=function(){var t="",e=(new Error).stack.split("\n"),r=e.findIndex((function(t){return c.test(t)}));if(-1!==r){var n=u.exec(e[r+1]||"");t=n?n[0]:""}return t}();s.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=l({err:new Error,className:h,methodName:v,sourceLink:g});try{return y.apply(this,t)}catch(t){var n=t,o=t.message,a=t.error,s=t.error_description,c={title:f||"".concat(h,".").concat(v," failed"),content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);c.subtitle=o,u.code&&(r?(r.code=u.code,r.msg=u.msg):(t.code=u.code,t.message=u.msg),n=r||t,c.content=p.map((function(t){return{type:"info",body:t}})))}throw a&&s&&(c.subtitle=s,r?(r.code=a,r.msg=s):(t.code=a,t.message=s),n=r||t,c.content=p.map((function(t){return{type:"info",body:t}}))),(0,i.printGroupLog)(c),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(this,void 0,void 0,(function(){var e,r,n,a,s,c,u,d;return o(this,(function(o){switch(o.label){case 0:e=l({err:new Error,className:h,methodName:v,sourceLink:g}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,y.apply(this,t)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,a=r.message,s=r.error,c=r.error_description,u={title:f||"".concat(h,".").concat(v," failed"),content:[{type:"error",body:r}]},a&&/^\{.*\}$/.test(a)&&(d=JSON.parse(a),u.subtitle=d,d.code&&(e?(e.code=d.code,e.message=d.msg):(r.code=d.code,r.message=d.msg),n=e||r,u.content=p.map((function(t){return{type:"info",body:t}})))),s&&c&&(u.subtitle=c,e?(e.code=s,e.msg=c):(r.code=s,r.message=c),n=e||r,u.content=p.map((function(t){return{type:"info",body:t}}))),(0,i.printGroupLog)(u),n;case 4:return[2]}}))}))}}}}},260:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(517),e)},877:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.langEvent=e.AbortController=e.jwt=e.helpers=e.utils=e.events=e.cache=e.adapters=e.constants=void 0;var s=i(r(778));e.constants=s;var c=i(r(563));e.adapters=c;var u=i(r(865));e.cache=u;var l=i(r(940));e.events=l;var d=i(r(991));e.langEvent=d;var f=i(r(962));e.utils=f;var h=i(r(260));e.helpers=h;var p=a(r(644));e.AbortController=p.default;var v={decode:a(r(949)).default};e.jwt=v},644:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){var t=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(e,r){"abort"===e&&t.listeners.push(r)}}}return t.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(t){return t()})))},t}();e.default=r},865:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function s(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var s=r(829),c=r(962),u=r(778),l=function(t){function e(e){var r=t.call(this)||this;return r.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return o(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}(s.AbstractStorage),d=function(){function t(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:((0,c.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(e.root));case"none":return new l(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,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"[".concat((0,u.getSdkName)(),"][").concat(u.ERRORS.OPERATION_FAIL,"]setStore failed"),info:t}))}}else(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,r){return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var n=this.storage.getItem(t);return n&&n.indexOf(e)>=0?JSON.parse(n).content:""}(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var r;return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0,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(n=o.sent())&&n.indexOf(e)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):(0,c.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}();e.CloudbaseCache=d},940:function(t,e,r){"use strict";var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(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 r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.removeEventListener=e.activateEvent=e.addEventListener=e.CloudbaseEventEmitter=e.IErrorEvent=e.CloudbaseEvent=void 0;var a=r(962),s=function(t,e){this.data=e||null,this.name=t};e.CloudbaseEvent=s;var c=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return o(e,t),e}(s);e.IErrorEvent=c;var u=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if((0,a.isInstanceOf)(t,c))return console.error(t.error),this;var r=(0,a.isString)(t)?new s(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,u=this.listeners[n]?i([],this.listeners[n],!0):[];o<u.length;o++)u[o].call(this,r)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();e.CloudbaseEventEmitter=u;var l=new u;e.addEventListener=function(t,e){l.on(t,e)},e.activateEvent=function(t,e){void 0===e&&(e={}),l.fire(t,e)},e.removeEventListener=function(t,e){l.off(t,e)}},991:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LANG_CHANGE_EVENT=e.bus=void 0;var n=r(940);e.bus=new n.CloudbaseEventEmitter,e.LANG_CHANGE_EVENT="lang_change"},962:function(t,e,r){"use strict";var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.parseCaptcha=e.parseQueryString=e.transformPhone=e.sleep=e.printGroupLog=e.throwError=e.printInfo=e.printError=e.printWarn=e.execCallback=e.createPromiseCallback=e.removeParam=e.getHash=e.getQuery=e.toQueryString=e.formatUrl=e.generateRequestId=e.genSeqId=e.isFormData=e.isInstanceOf=e.isNull=e.isPalinObject=e.isUndefined=e.isString=e.isArray=void 0;var o=r(778);e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.isString=function(t){return"string"==typeof t},e.isUndefined=function(t){return void 0===t},e.isPalinObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isNull=function(t){return"[object Null]"===Object.prototype.toString.call(t)},e.isInstanceOf=function(t,e){return t instanceof e},e.isFormData=function(t){return"[object FormData]"===Object.prototype.toString.call(t)},e.genSeqId=function(){return Math.random().toString(16).slice(2)},e.generateRequestId=function(){var t=(new Date).getTime(),e=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),("x"===r?n:7&n|8).toString(16)}))},e.formatUrl=function(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";return Object.keys(r).forEach((function(t){""===o?!n&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)},e.toQueryString=function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(r){e.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),e.join("&")},e.getQuery=function(t,e){if("undefined"==typeof window)return!1;var r=e||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},e.getHash=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]".concat(t,"=([^&#]*)")));return e?e[1]:""},e.removeParam=function(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===t&&n.splice(i,1);r="".concat(r,"?").concat(n.join("&"))}return r},e.createPromiseCallback=function(){var t={};if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t},e.execCallback=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},e.printWarn=function(t,e){console.warn("[".concat((0,o.getSdkName)(),"][").concat(t,"]:").concat(e))},e.printError=function(t,e){console.error({code:t,msg:"[".concat((0,o.getSdkName)(),"][").concat(t,"]:").concat(e)})},e.printInfo=function(t,e){console.log("[".concat((0,o.getSdkName)(),"][").concat(t,"]:").concat(e))},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat((0,o.getSdkName)(),"][").concat(t,"]:").concat(e)}))},e.printGroupLog=function(t){var e,r=t.title,n=t.subtitle,o=void 0===n?"":n,i=t.content,a=void 0===i?[]:i,s=t.printTrace,c=void 0!==s&&s,u=t.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var l=0,d=a;l<d.length;l++){var f=d[l],h=f.type,p=f.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}c&&(console.trace||console.log)("stack trace:"),null===(e=console.groupEnd)||void 0===e||e.call(console)},e.sleep=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},e.transformPhone=function(t){return"+86".concat(t)},e.parseQueryString=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach((function(t){var r=t.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(e[n]?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o)})),e},e.parseCaptcha=function(t){var r={},o=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(o){t=o[1];var i=o[2];i&&(r=(0,e.parseQueryString)(i))}var a=r.token,s=n(r,["token"]);return/^data:/.test(t)&&!a?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:a?{state:s.state,token:a,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}},388:t=>{t.exports={}},949:(t,e,r)=>{"use strict";function n(t){this.message=t}r.r(e),r.d(e,{InvalidTokenError:()=>a,default:()=>s}),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,a=0,s="";o=e.charAt(a++);~o&&(r=i%4?64*r+o:o,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function i(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(o(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return o(e)}}function a(t){this.message=t}a.prototype=new Error,a.prototype.name="InvalidTokenError";const s=function(t,e){if("string"!=typeof t)throw new a("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(i(t.split(".")[r]))}catch(t){throw new a("Invalid token specified: "+t.message)}}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";var t=n;Object.defineProperty(t,"__esModule",{value:!0}),t.registerStorage=void 0;var e=r(456);t.registerStorage=e.registerStorage})(),n})()));
|
package/model/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as t from"@cloudbase/wx-cloud-client-sdk";import*as e from"@cloudbase/adapter-interface";import*as n from"jwt-decode";var r={d:(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},o={};r.d(o,{lazyGetEntity:()=>M,registerModel:()=>D});const i=(s={generateHTTPClient:()=>t.generateHTTPClient},a={},r.d(a,s),a);var s,a,c="@cloudbase/js-sdk";function u(){return c}var l="INVALID_OPERATION",f="OPERATION_FAIL";const p=(t=>{var e={};return r.d(e,t),e})({AbstractSDKRequest:()=>e.AbstractSDKRequest,AbstractStorage:()=>e.AbstractStorage});function h(t,e){console.warn("[".concat(u(),"][").concat(t,"]:").concat(e))}var d,y,b=(d=function(t,e){return d=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])},d(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}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),v=function(){return v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},v.apply(this,arguments)},g=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},m=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};!function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}b(e,t),e.prototype.get=function(t){return this.request(v(v({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(v(v({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(v(v({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,i=t.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",r),c.append("file",n),this.request(v(v({},t),{data:c,method:a}),this.restrictedMethods.includes("upload"))):this.request(v(v({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return g(this,void 0,Promise,(function(){var e,n,r,o;return m(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(v(v({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[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 g(this,void 0,Promise,(function(){var n,r,o,i,s,a,c,u,l,f,p,h,d,y=this;return m(this,(function(b){switch(b.label){case 0:return n=new AbortController,r=t.url,o=t.enableAbort,i=void 0!==o&&o,s=t.stream,a=void 0!==s&&s,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,f=void 0===l||l,p=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",(function(){return n.abort()}))),h=null,i&&p&&(h=setTimeout((function(){console.warn(y.timeoutMsg),n.abort(new Error(y.timeoutMsg))}),p)),[4,fetch(r,v(v({},t),{signal:n.signal})).then((function(t){return g(y,void 0,void 0,(function(){var e,n,r;return m(this,(function(o){switch(o.label){case 0:return clearTimeout(h),f?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,t.json()];case 2:e=r.apply(n,[o.sent()]),o.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(h),f)return Promise.reject(t)}))];case 1:return d=b.sent(),[2,{data:a?d.body:(null===(e=d.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?d.json():d.text(),statusCode:d.status,header:d.headers}]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a,c=t.url,u=t.headers,l=void 0===u?{}:u,f=t.data,p=t.responseType,h=t.withCredentials,d=t.body,y=t.onUploadProgress,b=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}("https:",c,"get"===r?f:{}),v=new XMLHttpRequest;v.open(r,b),p&&(v.responseType=p),Object.keys(l).forEach((function(t){v.setRequestHeader(t,l[t])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=v.status;try{t.data="blob"===p?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===p?v.response:v.responseText}clearTimeout(i),o(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),a=f,s="[object FormData]"===Object.prototype.toString.call(a)?f:"application/x-www-form-urlencoded"===l["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("&")}(f):d||(f?JSON.stringify(f):void 0),h&&(v.withCredentials=!0),v.send(s)}))}}(p.AbstractSDKRequest),function(t){t.WEB="web",t.WX_MP="wx_mp"}(y||(y={}));var w=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 r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),O=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},S=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},_=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return w(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}(p.AbstractStorage);!function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(h("INVALID_PARAMS","localStorage is not supported on current platform"),new _(e.root));case"none":return new _(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}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 r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:f,msg:"[".concat(u(),"][").concat(f,"]setStore failed"),info:t}))}}else h(l,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return O(this,void 0,void 0,(function(){var r;return S(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.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 r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}h(l,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return O(this,void 0,void 0,(function(){var r;return S(this,(function(o){switch(o.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(r=o.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):h(l,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return O(this,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var j=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 r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),P=function(t,e){this.data=e||null,this.name=t},I=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return j(e,t),e}(P),A=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 r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof I)return console.error(t.error),this;var n="string"==typeof t?new P(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,i=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];o<i.length;o++)i[o].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new A,new A,"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");const C=(t=>{var e={};return r.d(e,t),e})({default:()=>n.default});C.default;var E=function(){return E=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},E.apply(this,arguments)},T=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},x=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},R=A,k="models",L=new WeakMap;function M(t){return new Proxy({},{get:function(e,n){var r=t.getEndPointWithKey("GATEWAY"),o=r.BASE_URL,s=r.PROTOCOL,a=E(E({},t),{BASE_URL:o,PROTOCOL:s}),c=L.get(a);return c||(c=function(t){var e=this,n=t.callFunction.bind(t),r=t.request.fetch.bind(t.request),o=t.getEndPointWithKey("GATEWAY"),s=o.BASE_URL,a=o.PROTOCOL,c="".concat(a).concat(s,"/model"),u="".concat(a).concat(s,"/sql"),l=(0,i.generateHTTPClient)(n,(function(t){return T(e,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,r(E(E({},t),{headers:E({"Content-Type":"application/json"},t.headers)}))];case 1:return[4,e.sent().data];case 2:return[2,e.sent()]}}))}))}),c,{sqlBaseUrl:u});return l}(t),L.set(a,c)),c[n]}})}var U="cloudbase_init",B=new R;B.on(U,(function(t){var e=t.data;Object.assign(e,{models:M(e)})}));var q={name:k,namespace:k,entity:new Proxy({},{get:function(t,e){console.warn("【deprecated】Accessing Cloudbase.prototype.models.".concat(e,"."))}}),injectEvents:{bus:B,events:[U]}};try{cloudbase.registerComponent(q)}catch(t){}function D(t){try{t.registerComponent(q)}catch(t){console.warn(t)}}try{window.registerModel=D}catch(t){}var N=o.lazyGetEntity,W=o.registerModel;export{N as lazyGetEntity,W as registerModel};
|
|
1
|
+
import*as t from"@cloudbase/wx-cloud-client-sdk";import*as e from"@cloudbase/adapter-interface";import*as n from"jwt-decode";var r={d:(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},o={};r.d(o,{lazyGetEntity:()=>M,registerModel:()=>D});const i=(s={generateHTTPClient:()=>t.generateHTTPClient},a={},r.d(a,s),a);var s,a,c="@cloudbase/js-sdk";function u(){return c}var l="INVALID_OPERATION",f="OPERATION_FAIL";const p=(t=>{var e={};return r.d(e,t),e})({AbstractSDKRequest:()=>e.AbstractSDKRequest,AbstractStorage:()=>e.AbstractStorage});function h(t,e){console.warn("[".concat(u(),"][").concat(t,"]:").concat(e))}var d,y,b=(d=function(t,e){return d=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])},d(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}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),v=function(){return v=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},v.apply(this,arguments)},g=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},m=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};!function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}b(e,t),e.prototype.get=function(t){return this.request(v(v({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(v(v({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(v(v({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,i=t.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",r),c.append("file",n),this.request(v(v({},t),{data:c,method:a}),this.restrictedMethods.includes("upload"))):this.request(v(v({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return g(this,void 0,Promise,(function(){var e,n,r,o;return m(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(v(v({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[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 g(this,void 0,Promise,(function(){var n,r,o,i,s,a,c,u,l,f,p,h,d,y=this;return m(this,(function(b){switch(b.label){case 0:return n=new AbortController,r=t.url,o=t.enableAbort,i=void 0!==o&&o,s=t.stream,a=void 0!==s&&s,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,f=void 0===l||l,p=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",(function(){return n.abort()}))),h=null,i&&p&&(h=setTimeout((function(){console.warn(y.timeoutMsg),n.abort(new Error(y.timeoutMsg))}),p)),[4,fetch(r,v(v({},t),{signal:n.signal})).then((function(t){return g(y,void 0,void 0,(function(){var e,n,r;return m(this,(function(o){switch(o.label){case 0:return clearTimeout(h),f?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,t.json()];case 2:e=r.apply(n,[o.sent()]),o.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){return clearTimeout(h),Promise.reject(t)}))];case 1:return d=b.sent(),[2,{data:a?d.body:(null===(e=d.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?d.json():d.text(),statusCode:d.status,header:d.headers,response:d}]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i=t.url,s=t.headers,a=void 0===s?{}:s,c=t.data,u=t.responseType,l=t.withCredentials,f=t.body,p=t.onUploadProgress,h=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}("https:",i,"get"===r?c:{}),d=new XMLHttpRequest;d.open(r,h),u&&(d.responseType=u);var y,b,v,g=t.signal;g&&(g.aborted?d.abort():g.addEventListener("abort",(function(){return d.abort()}),{once:!0})),Object.keys(a).forEach((function(t){d.setRequestHeader(t,a[t])})),p&&d.upload.addEventListener("progress",p),d.onreadystatechange=function(){var t={};if(4===d.readyState){var e=d.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=d.status;try{t.data="blob"===u?d.response:JSON.parse(d.responseText)}catch(e){t.data="blob"===u?d.response:d.responseText}clearTimeout(y),o(t)}},e&&n.timeout&&(y=setTimeout((function(){console.warn(n.timeoutMsg),d.abort()}),n.timeout)),v=c,b="[object FormData]"===Object.prototype.toString.call(v)?c:"application/x-www-form-urlencoded"===a["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("&")}(c):f||(c?JSON.stringify(c):void 0),l&&(d.withCredentials=!0),d.send(b)}))}}(p.AbstractSDKRequest),function(t){t.WEB="web",t.WX_MP="wx_mp"}(y||(y={}));var w=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 r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),O=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},S=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},_=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return w(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}(p.AbstractStorage);!function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(h("INVALID_PARAMS","localStorage is not supported on current platform"),new _(e.root));case"none":return new _(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}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 r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:f,msg:"[".concat(u(),"][").concat(f,"]setStore failed"),info:t}))}}else h(l,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return O(this,void 0,void 0,(function(){var r;return S(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.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 r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}h(l,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return O(this,void 0,void 0,(function(){var r;return S(this,(function(o){switch(o.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(r=o.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):h(l,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return O(this,void 0,void 0,(function(){return S(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var j=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 r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),P=function(t,e){this.data=e||null,this.name=t},I=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return j(e,t),e}(P),A=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 r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof I)return console.error(t.error),this;var n="string"==typeof t?new P(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,i=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];o<i.length;o++)i[o].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new A,new A,"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");const C=(t=>{var e={};return r.d(e,t),e})({default:()=>n.default});C.default;var E=function(){return E=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},E.apply(this,arguments)},T=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},x=function(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},R=A,k="models",L=new WeakMap;function M(t){return new Proxy({},{get:function(e,n){var r=t.getEndPointWithKey("GATEWAY"),o=r.BASE_URL,s=r.PROTOCOL,a=E(E({},t),{BASE_URL:o,PROTOCOL:s}),c=L.get(a);return c||(c=function(t){var e=this,n=t.callFunction.bind(t),r=t.request.fetch.bind(t.request),o=t.getEndPointWithKey("GATEWAY"),s=o.BASE_URL,a=o.PROTOCOL,c="".concat(a).concat(s,"/model"),u="".concat(a).concat(s,"/sql"),l=(0,i.generateHTTPClient)(n,(function(t){return T(e,void 0,void 0,(function(){return x(this,(function(e){switch(e.label){case 0:return[4,r(E(E({},t),{headers:E({"Content-Type":"application/json"},t.headers)}))];case 1:return[4,e.sent().data];case 2:return[2,e.sent()]}}))}))}),c,{sqlBaseUrl:u});return l}(t),L.set(a,c)),c[n]}})}var U="cloudbase_init",B=new R;B.on(U,(function(t){var e=t.data;Object.assign(e,{models:M(e)})}));var q={name:k,namespace:k,entity:new Proxy({},{get:function(t,e){console.warn("【deprecated】Accessing Cloudbase.prototype.models.".concat(e,"."))}}),injectEvents:{bus:B,events:[U]}};try{cloudbase.registerComponent(q)}catch(t){}function D(t){try{t.registerComponent(q)}catch(t){console.warn(t)}}try{window.registerModel=D}catch(t){}var N=o.lazyGetEntity,W=o.registerModel;export{N as lazyGetEntity,W as registerModel};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|