@cloudbase/js-sdk 3.4.7-beta.0 → 3.4.7
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 +3 -0
- package/ai/dist/index.esm.js +1 -1
- package/ai/dist/index.esm.js.map +1 -1
- package/apis/dist/index.esm.js +1 -1
- package/apis/dist/index.esm.js.map +1 -1
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.esm.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/container/dist/index.esm.js +1 -1
- package/container/dist/index.esm.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/miniprogram_dist/auth.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/model/dist/index.esm.js +1 -1
- package/model/dist/index.esm.js.map +1 -1
- package/mysql/dist/index.esm.js +1 -1
- package/mysql/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/realtime/dist/index.esm.js +1 -1
- package/realtime/dist/index.esm.js.map +1 -1
- package/storage/dist/index.esm.js +1 -1
- package/storage/dist/index.esm.js.map +1 -1
- package/types/package.json +1 -1
- package/utilities/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";var r={456:function(t,e,r){var o,n=this&&this.__extends||(o=function(t,e){return o=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])},o(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}o(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,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},i.apply(this,arguments)},a=this&&this.__decorate||function(t,e,r,o){var n,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,r,a):n(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},s=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))((function(n,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},u=this&&this.__generator||function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(e,"__esModule",{value:!0}),e.registerStorage=e.SupabaseFileAPILikeStorage=e.CloudbaseStorage=e.COMPONENT_NAME=void 0;var l,d=r(957),f=r(877),p=r(388);!function(t){t.put="put",t.post="post"}(l||(l={}));var h=f.constants.getSdkName,m=f.constants.ERRORS,g=f.constants.COMMUNITY_SITE_URL,y=f.utils.isArray,v=f.utils.isString,b=f.utils.isPalinObject,w=f.utils.execCallback,_=f.helpers.catchErrorsDecorator;e.COMPONENT_NAME="storage";var O=function(t,e,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,t.gateWay({path:"storages",name:"get-objects-upload-info",data:[i({objectId:e.path},e.headers?{signedHeader:Object.keys(e.headers).reduce((function(t,r){var o;return i(i({},t),((o={})[r]=[e.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})})]}}))}))},E=function(t,e,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,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,o=i(i({},o),{data:{download_list:null===(n=o.data)||void 0===n?void 0:n.map((function(t){return{code:t.code||"SUCCESS",message:t.message,fileid:t.cloudObjectId,download_url:t.downloadUrl,fileID:t.cloudObjectId,tempFileURL:t.downloadUrl}}))}})]}}))}))},I=function(t,e,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,t.gateWay({path:"storages",name:"delete-objects",data:e.fileList.map((function(t){return{cloudObjectId:t}}))},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(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},S=function(t,e,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,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,o=i(i({},o),{data:{copy_list:null===(n=o.data)||void 0===n?void 0:n.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},P=e.CloudbaseStorage=function(){function t(){}var r,o,n,d,f,P,N,R,C,A,j,L,F,M,U,x;return t.prototype.isGateWay=function(){return"GATEWAY"===(this.config.endPointMode||"CLOUD_API")},t.prototype.uploadFile=function(t,r){return c(this,void 0,Promise,(function(){var o,n,a,s,c,d,f,p,g,y,b,_,O,E,I,S,P,N,R,C,A,j,L,F;return u(this,(function(u){switch(u.label){case 0:if(o=t.cloudPath,n=t.filePath,a=t.onUploadProgress,j=t.method,s=void 0===j?"put":j,L=t.headers,c=void 0===L?{}:L,d=t.fileContent,!v(o)||!n&&!d)throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.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:t.customReqOpts})];case 1:return p=u.sent(),g=p.data,y=p.requestId,b=g.url,_=g.authorization,O=g.token,E=g.fileId,I=g.cosFileId,S=g.download_url,N=i(i({},P={url:b,file:n,name:o,onUploadProgress:a,fileContent:d,fileId:E,requestId:y}),{method:l.put,headers:i(i({},c),{authorization:_,"x-cos-meta-fileid":I,"x-cos-security-token":O})}),R=i(i({},P),{method:l.post,data:{key:o,signature:_,"x-cos-meta-fileid":I,success_action_status:"201","x-cos-security-token":O}}),(F={})[l.put]={params:N,isSuccess:function(t){return t>=200&&t<300}},F[l.post]={params:R,isSuccess:function(t){return 201===t}},C=F,[4,this.request.upload(C[f].params)];case 2:return A=u.sent(),C[f].isSuccess(A.statusCode)?[2,w(r,null,{fileID:E,download_url:S,requestId:y})]:[2,w(r,new Error("[".concat(h(),"][").concat(m.OPERATION_FAIL,"][").concat(e.COMPONENT_NAME,"]:").concat(A.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,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=t.cloudPath,n=t.method,i=t.headers,!v(o))throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.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,O(a,d,t.customReqOpts)]:[3,3];case 2:return c=u.sent(),[3,5];case 3:return[4,a.send(s,d,t.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]}}))}))},t.prototype.deleteFile=function(t,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=t.fileList)||!y(o)||0===o.length)throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.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:m.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".deleteFile] fileID must be string")}));return s="storage.batchDeleteFile",c=this.request,l={},this.isGateWay()?[4,I(c,{fileList:o},t.customReqOpts)]:[3,2];case 1:return l=u.sent(),[3,4];case 2:return[4,c.send(s,{fileid_list:o},t.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)])}}))}))},t.prototype.getTempFileURL=function(t,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=t.fileList)||!y(o)||0===o.length)throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.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:m.INVALID_PARAMS,msg:"[".concat(e.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:m.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getTempFileURL] invalid fileList")}));n.push({fileid:s})}return c="storage.batchGetDownloadUrl",l=this.request,d={},this.isGateWay()?[4,E(l,{convertedFileList:n},t.customReqOpts)]:[3,2];case 1:return d=u.sent(),[3,4];case 2:return[4,l.send(c,{file_list:n},t.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})]}}))}))},t.prototype.downloadFile=function(t,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=t.fileID,!v(o))throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:o,maxAge:600}],customReqOpts:t.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:t.tempFilePath})]);case 2:return c=u.sent(),[2,w(r,null,c)]}}))}))},t.prototype.copyFile=function(t,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=t.fileList)||!y(o)||0===o.length)throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.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:m.INVALID_PARAMS,msg:"[".concat(e.COMPONENT_NAME,".copyFile] srcPath and dstPath may not be empty")}));if(c===l)throw new Error(JSON.stringify({code:m.INVALID_PARAMS,msg:"[".concat(e.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,S(d,{convertedFileList:n},t.customReqOpts)]:[3,2];case 1:return f=u.sent(),[3,4];case 2:return[4,d.send("storage.batchCopyFile",{file_list:n},t.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})]}}))}))},t.prototype.getFileInfo=function(t){var e;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(t)];case 1:return(null==(r=n.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 c(o,void 0,void 0,(function(){var e,r,o,n,i;return u(this,(function(a){switch(a.label){case 0:if("SUCCESS"!==t.code)return[2,{code:t.code,fileID:t.fileID,tempFileURL:t.tempFileURL,message:t.message}];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.request.fetch({url:t.tempFileURL,method:"HEAD"})];case 2:return e=a.sent(),r=e.header,Headers&&r instanceof Headers&&(r=Object.fromEntries(e.header.entries())),o=parseInt(r["content-length"])||0,n=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: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:t.fileID,tempFileURL:t.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([_({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(g)]}),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)],t.prototype,"uploadFile",null),a([_({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(g)]}),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)],t.prototype,"getUploadMetadata",null),a([_({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(g)]}),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)],t.prototype,"deleteFile",null),a([_({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(g)]}),s("design:type",Function),s("design:paramtypes",["function"==typeof(R=void 0!==p.ICloudbaseGetTempFileURLParams&&p.ICloudbaseGetTempFileURLParams)?R:Object,"function"==typeof(C="undefined"!=typeof Function&&Function)?C:Object]),s("design:returntype","function"==typeof(A="undefined"!=typeof Promise&&Promise)?A:Object)],t.prototype,"getTempFileURL",null),a([_({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(g)]}),s("design:type",Function),s("design:paramtypes",["function"==typeof(j=void 0!==p.ICloudbaseDownloadFileParams&&p.ICloudbaseDownloadFileParams)?j:Object,"function"==typeof(L="undefined"!=typeof Function&&Function)?L:Object]),s("design:returntype","function"==typeof(F="undefined"!=typeof Promise&&Promise)?F:Object)],t.prototype,"downloadFile",null),a([_({customInfo:{className:"Cloudbase",methodName:"copyFile"},title:"批量复制文件",messages:["请确认以下各项:"," 1 - 调用 copyFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(g)]}),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)],t.prototype,"copyFile",null),t}(),N=new P,R={name:e.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}},C=function(t){function r(e){var r=t.call(this)||this;return r.shouldThrowOnError=!1,r.bucketId="",r.context=e,r}return n(r,t),Object.defineProperty(r.prototype,"config",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.config},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"request",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.request},enumerable:!1,configurable:!0}),r.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},r.prototype.from=function(t){return this.bucketId=t||"",this},r.prototype.upload=function(t,r,o){return c(this,void 0,Promise,(function(){var n,a,s,c,l,f,p,h,g;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(t),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:m.OPERATION_FAIL,msg:"[".concat(e.COMPONENT_NAME,".update] no fileID returned")}));return[2,{data:{id:h.fileID,path:t,fullPath:t},error:null}];case 3:if(g=u.sent(),this.shouldThrowOnError)throw g;if((0,d.isStorageError)(g))return[2,{data:null,error:g}];throw g;case 4:return[2]}}))}))},r.prototype.uploadToSignedUrl=function(t,e,r,o){return c(this,void 0,Promise,(function(){return u(this,(function(e){return[2,this.upload(t,r,o)]}))}))},r.prototype.createSignedUploadUrl=function(t){return c(this,void 0,Promise,(function(){var e,r,o;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),e=this._getCloudPath(t),[4,this.getUploadMetadata({cloudPath:e})];case 1:return[2,{data:{signedUrl:(r=n.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(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(t,e,r){return c(this,void 0,Promise,(function(){return u(this,(function(o){return[2,this.upload(t,e,i(i({},r),{upsert:!0}))]}))}))},r.prototype.move=function(t,e){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(t),dstPath:this._getCloudPath(e),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(t," to ").concat(e)},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(t,e){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(t),dstPath:this._getCloudPath(e),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(e)},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(t,e,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(t),[4,this.getTempFileURL({fileList:[{fileID:o,maxAge:e}]})];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(t,e){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=t.map((function(t){return{fileID:n._normalizeCloudId(t),maxAge:e}})),[4,this.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(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(t,e){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(t,600,{transform:e})];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(t){return c(this,void 0,Promise,(function(){var e,r,o,n,i,a,s,c;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),e=t.startsWith("cloud://"),r=e?this._extractPathFromFileId(t):t,o=e?this._extractBucketFromFileId(t):this.bucketId,[4,this.getFileInfo({fileList:[this._normalizeCloudId(t)]})];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(t){return c(this,void 0,Promise,(function(){var e,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(t)]})];case 1:if(e=n.sent(),"FILE_NOT_FOUND"===(r=e.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(t,e){return c(this,void 0,Promise,(function(){var r;return u(this,(function(o){switch(o.label){case 0:return[4,this.createSignedUrl(t,600,e)];case 1:return(r=o.sent()).data?[2,{data:{publicUrl:r.data.signedUrl}}]:[2,{data:null,error:r.error}]}}))}))},r.prototype.remove=function(t){return c(this,void 0,Promise,(function(){var e,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]),e=10,r=[],o=0;o<t.length;o+=e)r.push(t.slice(o,o+e));return[4,Promise.all(r.map((function(t){return Promise.all(t.map((function(t){return p.info(t)})))})))];case 1:return n=u.sent(),i=new Map,n.flat().forEach((function(r,o){r.data&&i.set(t[Math.floor(o/e)*e+o%e],r.data)})),a=t.map((function(t){return p._normalizeCloudId(t)})),[4,this.deleteFile({fileList:a})];case 2:if(s=u.sent(),(c=s.fileList.filter((function(t){return"SUCCESS"!==t.code}))).length>0)throw new d.StorageError("Delete failed for ".concat(c.length," file(s)"));return l=(new Date).toISOString(),[2,{data:t.map((function(t){var e=i.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)||l,created_at:null==e?void 0:e.createdAt,last_accessed_at:(null==e?void 0:e.lastAccessedAt)||l,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: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(t){throw new d.StorageError("Not implemented")}))}))},r.prototype._getCloudPath=function(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")},r.prototype._normalizeCloudId=function(t){var e;if(/^cloud:\/\//.test(t))return t;var r=this._getCloudPath(t);if(!this.bucketId)throw new d.StorageError("bucketId is not set");var o=(null===(e=this.config)||void 0===e?void 0:e.env)||"";return o?"cloud://".concat(o,".").concat(this.bucketId,"/").concat(r):void 0},r.prototype.toBase64=function(t){return"undefined"!=typeof Buffer?Buffer.from(t).toString("base64"):btoa(t)},r.prototype._transformOptsToQueryString=function(t){var e=["imageMogr2"];if(t.width||t.height){var r=t.width||"",o=t.height||"";"fill"===t.resize?e.push("thumbnail/".concat(r,"x").concat(o,"!")):"contain"===t.resize?e.push("thumbnail/".concat(r,"x").concat(o)):e.push("thumbnail/".concat(r,"x").concat(o,"^"))}if(t.format&&"origin"!==t.format&&e.push("format/".concat(t.format)),void 0!==t.quality){var n=Math.max(1,Math.min(100,t.quality));e.push("quality/".concat(n))}return e.join("/")},r.prototype._extractPathFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");return e.length<2?t:e.slice(1).join("/")},r.prototype._extractBucketFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");if(e.length<1)return"";var r=e[0],o=r.indexOf(".");return-1===o?r:r.substring(o+1)},r}(P);e.SupabaseFileAPILikeStorage=C;var A={name:"".concat(e.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}}),o=new C(r);return t.set(this,o),o},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(R),cloudbase.registerComponent(A)}catch(t){}function j(t){try{t.registerComponent(R),t.registerComponent(A)}catch(t){console.warn(t)}}e.registerStorage=j;try{window.registerStorage=j}catch(t){}},957:function(t,e){var r,o=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 o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)});Object.defineProperty(e,"__esModule",{value:!0}),e.StorageUnknownError=e.StorageApiError=e.isStorageError=e.StorageError=void 0;var n=function(t){function e(e){var r=t.call(this,e)||this;return r.__isStorageError=!0,r.name="StorageError",r}return o(e,t),e}(Error);e.StorageError=n,e.isStorageError=function(t){return"object"==typeof t&&null!==t&&"__isStorageError"in t};var i=function(t){function e(e,r,o){var n=t.call(this,e)||this;return n.name="StorageApiError",n.status=r,n.statusCode=o,n}return o(e,t),e.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},e}(n);e.StorageApiError=i;var a=function(t){function e(e,r){var o=t.call(this,e)||this;return o.name="StorageUnknownError",o.originalError=r,o}return o(e,t),e}(n);e.StorageUnknownError=a},563:function(t,e,r){var o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)},n=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=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)&&n(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,n=(0,u.isArray)(t)?t:[t];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(e)),runtime:c}}},e.useDefaultAdapter=function(){return{adapter:o({},c.genAdapter()),runtime:s.WEB}}},92:function(t,e,r){var o,n=this&&this.__extends||(o=function(t,e){return o=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])},o(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}o(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,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},i.apply(this,arguments)},a=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))((function(n,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var c=r(149),u=r(962),l=r(464),d=function(t){function e(e){var r=t.call(this)||this,o=e.timeout,n=e.timeoutMsg,i=e.restrictedMethods;return r.timeout=o||0,r.timeoutMsg=n||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return n(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,o=t.name,n=t.method,a=t.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(e).forEach((function(t){u.append(t,e[t])})),u.append("key",o),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,o,n;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])),o=decodeURIComponent(new URL(t.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(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return a(this,void 0,Promise,(function(){var r,o,n,c,u,l,d,f,p,h,m,g,y,v=this;return s(this,(function(b){switch(b.label){case 0:return r=new AbortController,o=t.url,n=t.enableAbort,c=void 0!==n&&n,u=t.stream,l=void 0!==u&&u,d=t.signal,f=t.timeout,p=t.shouldThrowOnError,h=void 0===p||p,m=null!=f?f:this.timeout,d&&(d.aborted&&r.abort(),d.addEventListener("abort",(function(){return r.abort()}))),g=null,c&&m&&(g=setTimeout((function(){console.warn(v.timeoutMsg),r.abort(new Error(v.timeoutMsg))}),m)),[4,fetch(o,i(i({},t),{signal:r.signal})).then((function(t){return a(v,void 0,void 0,(function(){var e,r,o;return s(this,(function(n){switch(n.label){case 0:return clearTimeout(g),h?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return o=(r=Promise).reject,[4,t.json()];case 2:e=o.apply(r,[n.sent()]),n.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(g),h)return Promise.reject(t)}))];case 1:return y=b.sent(),[2,{data:l?y.body:(null===(e=y.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?y.json():y.text(),statusCode:y.status,header:y.headers}]}}))}))},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var o=String(t.method).toLowerCase()||"get";return new Promise((function(n){var i,a,s=t.url,c=t.headers,d=void 0===c?{}:c,f=t.data,p=t.responseType,h=t.withCredentials,m=t.body,g=t.onUploadProgress,y=(0,u.formatUrl)((0,l.getProtocol)(),s,"get"===o?f:{}),v=new XMLHttpRequest;v.open(o,y),p&&(v.responseType=p),Object.keys(d).forEach((function(t){v.setRequestHeader(t,d[t])})),g&&v.upload.addEventListener("progress",g),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),o=e.shift().toLowerCase(),n=e.join(": ");r[o]=n})),t.header=r,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),n(t)}},e&&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):m||(f?JSON.stringify(f):void 0),h&&(v.withCredentials=!0),v.send(a)}))},e}(c.AbstractSDKRequest);e.WebRequest=d,e.genAdapter=function(){return{type:"default",root:window,reqClass:d,wsClass:WebSocket,localStorage}}},464:(t,e)=>{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 o="https:";e.setProtocol=function(t){o=t},e.getProtocol=function(){return o},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},519:(t,e)=>{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){var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||o(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,n(r(464),e),n(r(519),e),e.OATUH_LOGINTYPE="constants"},517:function(t,e,r){var o=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))((function(n,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(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,o=t.methodName,n=t.sourceLink;if(!n)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(o,"\\]\\s*\\(.*\\)$")),l=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(o,"\\]")),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(o)).replace(u,n)),(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,p=t.messages,h=void 0===p?[]:p;return function(t,e,s){if(a.IS_DEBUG_MODE){var p=d.className||t.constructor.name,m=d.methodName||e,g=s.value,y=function(){var t="",e=(new Error).stack.split("\n"),r=e.findIndex((function(t){return c.test(t)}));if(-1!==r){var o=u.exec(e[r+1]||"");t=o?o[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:p,methodName:m,sourceLink:y});try{return g.apply(this,t)}catch(t){var o=t,n=t.message,a=t.error,s=t.error_description,c={title:f||"".concat(p,".").concat(m," failed"),content:[{type:"error",body:t}]};if(n&&/^\{.*\}$/.test(n)){var u=JSON.parse(n);c.subtitle=n,u.code&&(r?(r.code=u.code,r.msg=u.msg):(t.code=u.code,t.message=u.msg),o=r||t,c.content=h.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),o=r||t,c.content=h.map((function(t){return{type:"info",body:t}}))),(0,i.printGroupLog)(c),o}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return o(this,void 0,void 0,(function(){var e,r,o,a,s,c,u,d;return n(this,(function(n){switch(n.label){case 0:e=l({err:new Error,className:p,methodName:m,sourceLink:y}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,g.apply(this,t)];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(m," 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),o=e||r,u.content=h.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),o=e||r,u.content=h.map((function(t){return{type:"info",body:t}}))),(0,i.printGroupLog)(u),o;case 4:return[2]}}))}))}}}}},260:function(t,e,r){var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),n=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||o(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(r(517),e)},877:function(t,e,r){var o=this&&this.__createBinding||(Object.create?function(t,e,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,o,n)}:function(t,e,r,o){void 0===o&&(o=r),t[o]=e[r]}),n=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)&&o(e,t,r);return n(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 p=i(r(260));e.helpers=p;var h=a(r(829));e.AbortController=h.default;var m={decode:a(r(880)).default};e.jwt=m},829:(t,e)=>{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){var o,n=this&&this.__extends||(o=function(t,e){return o=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])},o(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}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))((function(n,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){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=e.call(t,a)}catch(t){s=[6,t],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(e,"__esModule",{value:!0}),e.CloudbaseCache=void 0;var s=r(149),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 n(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,o=void 0===r?{}:r,n=t.keys,i=void 0===n?{}:n;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:((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 o={version:r||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(o))}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 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:e},[4,this.storage.setItem(t,JSON.stringify(o))];case 2:return n.sent(),[3,4];case 3:return n.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:!1,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var o=this.storage.getItem(t);return o&&o.indexOf(e)>=0?JSON.parse(o).content:""}(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 o;return a(this,(function(n){switch(n.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(o=n.sent())&&o.indexOf(e)>=0?[2,JSON.parse(o).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){var o,n=this&&this.__extends||(o=function(t,e){return o=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])},o(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}o(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 o,n=0,i=e.length;n<i;n++)!o&&n in e||(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||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 o=t.call(this,"error",{error:e,data:r})||this;return o.error=e,o}return n(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 o=r[t].indexOf(e);-1!==o&&r[t].splice(o,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,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},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)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LANG_CHANGE_EVENT=e.bus=void 0;var o=r(940);e.bus=new o.CloudbaseEventEmitter,e.LANG_CHANGE_EVENT="lang_change"},962:function(t,e,r){var o=this&&this.__rest||function(t,e){var r={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(r[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(t);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(t,o[n])&&(r[o[n]]=t[o[n]])}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 n=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 o=16*Math.random();return t>0?(o=(t+o)%16|0,t=Math.floor(t/16)):(o=(e+o)%16|0,e=Math.floor(e/16)),("x"===r?o:7&o|8).toString(16)}))},e.formatUrl=function(t,e,r){void 0===r&&(r={});var o=/\?/.test(e),n="";return Object.keys(r).forEach((function(t){""===n?!o&&(e+="?"):n+="&",n+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=n)?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),o=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),n=r.substr(r.indexOf("?")+1).match(o);return null!=n?n[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],o=[],n=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==n){for(var i=(o=n.split("&")).length-1;i>=0;i-=1)o[i].split("=")[0]===t&&o.splice(i,1);r="".concat(r,"?").concat(o.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,o){return t?r(t):e(o)}}));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,n.getSdkName)(),"][").concat(t,"]:").concat(e))},e.printError=function(t,e){console.error({code:t,msg:"[".concat((0,n.getSdkName)(),"][").concat(t,"]:").concat(e)})},e.printInfo=function(t,e){console.log("[".concat((0,n.getSdkName)(),"][").concat(t,"]:").concat(e))},e.throwError=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat((0,n.getSdkName)(),"][").concat(t,"]:").concat(e)}))},e.printGroupLog=function(t){var e,r=t.title,o=t.subtitle,n=void 0===o?"":o,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,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===(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("="),o=r[0],n=r[1];o=decodeURIComponent(o),n=decodeURIComponent(n),o&&(e[o]?Array.isArray(e[o])?e[o].push(n):e[o]=[e[o],n]:e[o]=n)})),e},e.parseCaptcha=function(t){var r={},n=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(n){t=n[1];var i=n[2];i&&(r=(0,e.parseQueryString)(i))}var a=r.token,s=o(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={}},149:e=>{e.exports=t},880:t=>{t.exports=e}},o={};function n(t){var e=o[t];if(void 0!==e)return e.exports;var i=o[t]={exports:{}};return r[t].call(i.exports,i,i.exports,n),i.exports}var i={};(()=>{var t=i;Object.defineProperty(t,"X",{value:!0}),t.v=void 0;var e=n(456);t.v=e.registerStorage})();var a=i.X,s=i.v;export{a as __esModule,s as registerStorage};
|
|
1
|
+
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";var r={388:t=>{t.exports={}}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var i=n[t]={exports:{}};return r[t](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};(()=>{o.d(i,{v:()=>nt});var r,n,s=(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)}),a=function(t){function e(e){var r=t.call(this,e)||this;return r.__isStorageError=!0,r.name="StorageError",r}return s(e,t),e}(Error);function c(t){return"object"==typeof t&&null!==t&&"__isStorageError"in t}(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}s(e,t),e.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}})(a),s((function(t,e){var r=n.call(this,t)||this;return r.name="StorageUnknownError",r.originalError=e,r}),n=a);var u="@cloudbase/js-sdk";function l(){return u}var d={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};const f=(p={AbstractSDKRequest:()=>t.AbstractSDKRequest,AbstractStorage:()=>t.AbstractStorage},h={},o.d(h,p),h);var p,h;function m(t){return"string"==typeof t}function y(t,e){console.warn("[".concat(l(),"][").concat(t,"]:").concat(e))}var g,v=function(){var t=function(e,r){return t=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])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),b=function(){return b=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},b.apply(this,arguments)},w=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(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(s,a)}c((n=n.apply(t,e||[])).next())}))},I=function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=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 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}v(e,t),e.prototype.get=function(t){return this.request(b(b({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(b(b({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(b(b({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=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",n),c.append("file",r),this.request(b(b({},t),{data:c,method:a}),this.restrictedMethods.includes("upload"))):this.request(b(b({},t),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return w(this,void 0,Promise,(function(){var e,r,n,o;return I(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(b(b({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.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 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 w(this,void 0,Promise,(function(){var r,n,o,i,s,a,c,u,l,d,f,p,h,m=this;return I(this,(function(y){switch(y.label){case 0:return r=new AbortController,n=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,d=void 0===l||l,f=null!=u?u:this.timeout,c&&(c.aborted&&r.abort(),c.addEventListener("abort",(function(){return r.abort()}))),p=null,i&&f&&(p=setTimeout((function(){console.warn(m.timeoutMsg),r.abort(new Error(m.timeoutMsg))}),f)),[4,fetch(n,b(b({},t),{signal:r.signal})).then((function(t){return w(m,void 0,void 0,(function(){var e,r,n;return I(this,(function(o){switch(o.label){case 0:return clearTimeout(p),d?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){if(clearTimeout(p),d)return Promise.reject(t)}))];case 1:return h=y.sent(),[2,{data:a?h.body:(null===(e=h.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?h.json():h.text(),statusCode:h.status,header:h.headers}]}}))}))},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,s,a,c=t.url,u=t.headers,l=void 0===u?{}:u,d=t.data,f=t.responseType,p=t.withCredentials,h=t.body,m=t.onUploadProgress,y=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)}("https:",c,"get"===n?d:{}),g=new XMLHttpRequest;g.open(n,y),f&&(g.responseType=f),Object.keys(l).forEach((function(t){g.setRequestHeader(t,l[t])})),m&&g.upload.addEventListener("progress",m),g.onreadystatechange=function(){var t={};if(4===g.readyState){var e=g.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=g.status;try{t.data="blob"===f?g.response:JSON.parse(g.responseText)}catch(e){t.data="blob"===f?g.response:g.responseText}clearTimeout(i),o(t)}},e&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),g.abort()}),r.timeout)),a=d,s="[object FormData]"===Object.prototype.toString.call(a)?d:"application/x-www-form-urlencoded"===l["content-type"]?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("&")}(d):h||(d?JSON.stringify(d):void 0),p&&(g.withCredentials=!0),g.send(s)}))}}(f.AbstractSDKRequest),function(t){t.WEB="web",t.WX_MP="wx_mp"}(g||(g={}));var O=function(){var t=function(e,r){return t=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])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(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(s,a)}c((n=n.apply(t,e||[])).next())}))},P=function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},S=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}(f.AbstractStorage);!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:(y(d.INVALID_PARAMS,"localStorage is not supported on current platform"),new S(e.root));case"none":return new S(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,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:d.OPERATION_FAIL,msg:"[".concat(l(),"][").concat(d.OPERATION_FAIL,"]setStore failed"),info:t}))}}else y(d.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,r){return _(this,void 0,void 0,(function(){var n;return P(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:!1,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!1,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:""}y(d.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var r;return _(this,void 0,void 0,(function(){var n;return P(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.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(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):y(d.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return _(this,void 0,void 0,(function(){return P(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var F=function(){var t=function(e,r){return t=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])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),L=function(t,e){this.data=e||null,this.name=t},R=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return F(e,t),e}(L),A=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(t instanceof R)return console.error(t.error),this;var r=m(t)?new L(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?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))}([],this.listeners[n],!0):[];o<i.length;o++)i[o].call(this,r)}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 o.d(e,t),e})({default:()=>e.default});C.default;var U,j=o(388),E=function(){var t=function(e,r){return t=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])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),N=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)},D=function(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s},T=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},x=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(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(s,a)}c((n=n.apply(t,e||[])).next())}))},q=function(t,e){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};!function(t){t.put="put",t.post="post"}(U||(U={}));var M=l,k=d,W="https://support.qq.com/products/148793",B=function(t){return"[object Array]"===Object.prototype.toString.call(t)},J=m,V=function(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r},z=function(t){return t.mode,t.customInfo,t.title,t.messages,function(t,e,r){}},G="storage",H=function(t,e,r){return x(void 0,void 0,void 0,(function(){var n,o,i;return q(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.headers?{signedHeader:Object.keys(e.headers).reduce((function(t,r){var n;return N(N({},t),((n={})[r]=[e.headers[r]],n))}),{})}:{})]},r)];case 1:return n=s.sent(),o=(null===(i=n.data)||void 0===i?void 0:i[0])||{},[2,n=N(N({},n),{data:N(N({},o.code?N({},o):{}),{authorization:o.authorization,token:o.token,url:o.uploadUrl,fileId:o.cloudObjectId,cosFileId:o.cloudObjectMeta,download_url:o.downloadUrl})})]}}))}))},K=function(t,e,r){return x(void 0,void 0,void 0,(function(){var n,o;return q(this,(function(i){switch(i.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 n=i.sent(),[2,n=N(N({},n),{data:{download_list:null===(o=n.data)||void 0===o?void 0:o.map((function(t){return{code:t.code||"SUCCESS",message:t.message,fileid:t.cloudObjectId,download_url:t.downloadUrl,fileID:t.cloudObjectId,tempFileURL:t.downloadUrl}}))}})]}}))}))},X=function(t,e,r){return x(void 0,void 0,void 0,(function(){var n,o;return q(this,(function(i){switch(i.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 n=i.sent(),[2,n=N(N({},n),{data:{delete_list:null===(o=n.data)||void 0===o?void 0:o.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},Y=function(t,e,r){return x(void 0,void 0,void 0,(function(){var n,o;return q(this,(function(i){switch(i.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 n=i.sent(),[2,n=N(N({},n),{data:{copy_list:null===(o=n.data)||void 0===o?void 0:o.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},Q=function(){function t(){}var e,r,n,o,i,s,a,c,u,l,d,f,p,h,m,y;return t.prototype.isGateWay=function(){return"GATEWAY"===(this.config.endPointMode||"CLOUD_API")},t.prototype.uploadFile=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o,i,s,a,c,u,l,d,f,p,h,m,y,g,v,b,w,I,O,_,P,S;return q(this,(function(F){switch(F.label){case 0:if(r=t.cloudPath,n=t.filePath,o=t.onUploadProgress,_=t.method,i=void 0===_?"put":_,P=t.headers,s=void 0===P?{}:P,a=t.fileContent,!J(r)||!n&&!a)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".uploadFile] invalid params")}));return c={put:U.put,post:U.post}[i.toLocaleLowerCase()]||U.put,[4,this.getUploadMetadata({cloudPath:r,method:c,headers:c===U.put?s:void 0,customReqOpts:t.customReqOpts})];case 1:return u=F.sent(),l=u.data,d=u.requestId,f=l.url,p=l.authorization,h=l.token,m=l.fileId,y=l.cosFileId,g=l.download_url,b=N(N({},v={url:f,file:n,name:r,onUploadProgress:o,fileContent:a,fileId:m,requestId:d}),{method:U.put,headers:N(N({},s),{authorization:p,"x-cos-meta-fileid":y,"x-cos-security-token":h})}),w=N(N({},v),{method:U.post,data:{key:r,signature:p,"x-cos-meta-fileid":y,success_action_status:"201","x-cos-security-token":h}}),(S={})[U.put]={params:b,isSuccess:function(t){return t>=200&&t<300}},S[U.post]={params:w,isSuccess:function(t){return 201===t}},I=S,[4,this.request.upload(I[c].params)];case 2:return O=F.sent(),I[c].isSuccess(O.statusCode)?[2,V(e,null,{fileID:m,download_url:g,requestId:d})]:[2,V(e,new Error("[".concat(M(),"][").concat(k.OPERATION_FAIL,"][").concat(G,"]:").concat(O.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o,i,s,a,c,u;return q(this,(function(l){switch(l.label){case 0:if(r=t.cloudPath,n=t.method,o=t.headers,!J(r))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".getUploadMetadata] invalid cloudPath")}));i=this.request,s="storage.getUploadMetadata",l.label=1;case 1:return l.trys.push([1,6,,7]),a=void 0,c={path:r},n&&(c.method=n),n===U.put&&o&&(c.headers=o),this.isGateWay()?[4,H(i,c,t.customReqOpts)]:[3,3];case 2:return a=l.sent(),[3,5];case 3:return[4,i.send(s,c,t.customReqOpts)];case 4:a=l.sent(),l.label=5;case 5:return[2,V(e,null,a)];case 6:return u=l.sent(),[2,V(e,u)];case 7:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o,i,s,a,c,u;return q(this,(function(l){switch(l.label){case 0:if(!(r=t.fileList)||!B(r)||0===r.length)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".deleteFile] fileList must not be empty")}));for(n=0,o=r;n<o.length;n++)if(!(i=o[n])||!J(i))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".deleteFile] fileID must be string")}));return s="storage.batchDeleteFile",a=this.request,c={},this.isGateWay()?[4,X(a,{fileList:r},t.customReqOpts)]:[3,2];case 1:return c=l.sent(),[3,4];case 2:return[4,a.send(s,{fileid_list:r},t.customReqOpts)];case 3:c=l.sent(),l.label=4;case 4:return c.code?[2,V(e,null,c)]:(u={fileList:c.data.delete_list,requestId:c.requestId},[2,V(e,null,u)])}}))}))},t.prototype.getTempFileURL=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o,i,s,a,c,u;return q(this,(function(l){switch(l.label){case 0:if(!(r=t.fileList)||!B(r)||0===r.length)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".getTempFileURL] fileList must not be empty")}));for(n=[],o=0,i=r;o<i.length;o++)if(s=i[o],d=s,"[object Object]"===Object.prototype.toString.call(d)){if(!Object.prototype.hasOwnProperty.call(s,"fileID"))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".getTempFileURL] file info must include fileID")}));n.push({fileid:s.fileID,max_age:s.maxAge||7200})}else{if(!J(s))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".getTempFileURL] invalid fileList")}));n.push({fileid:s})}return a="storage.batchGetDownloadUrl",c=this.request,u={},this.isGateWay()?[4,K(c,{convertedFileList:n},t.customReqOpts)]:[3,2];case 1:return u=l.sent(),[3,4];case 2:return[4,c.send(a,{file_list:n},t.customReqOpts)];case 3:u=l.sent(),l.label=4;case 4:return u.code?[2,V(e,null,u)]:[2,V(e,null,{fileList:u.data.download_list,requestId:u.requestId})]}var d}))}))},t.prototype.downloadFile=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o,i,s,a;return q(this,(function(c){switch(c.label){case 0:if(r=t.fileID,!J(r))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:r,maxAge:600}],customReqOpts:t.customReqOpts})];case 1:return n=c.sent(),"SUCCESS"!==(o=n.fileList[0]).code?[2,V(e,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s,tempFilePath:t.tempFilePath})]);case 2:return a=c.sent(),[2,V(e,null,a)]}}))}))},t.prototype.copyFile=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o,i,s,a,c,u,l;return q(this,(function(d){switch(d.label){case 0:if(!(r=t.fileList)||!B(r)||0===r.length)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".copyFile] fileList must not be empty")}));for(n=[],o=0,i=r;o<i.length;o++){if(s=i[o],a=s.srcPath,c=s.dstPath,!a||!c||"string"!=typeof a||"string"!=typeof c)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".copyFile] srcPath and dstPath may not be empty")}));if(a===c)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[".concat(G,".copyFile] srcPath and dstPath can not be the same")}));n.push({src_path:a,dst_path:c,overwrite:s.overwrite,remove_original:s.removeOriginal})}return u=this.request,l={},this.isGateWay()?[4,Y(u,{convertedFileList:n},t.customReqOpts)]:[3,2];case 1:return l=d.sent(),[3,4];case 2:return[4,u.send("storage.batchCopyFile",{file_list:n},t.customReqOpts)];case 3:l=d.sent(),d.label=4;case 4:return l.code?[2,V(e,null,l)]:[2,V(e,null,{fileList:l.data.copy_list,requestId:l.requestId})]}}))}))},t.prototype.getFileInfo=function(t){var e;return x(this,void 0,Promise,(function(){var r,n=this;return q(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 x(n,void 0,void 0,(function(){var e,r,n,o,i;return q(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,Headers&&r instanceof Headers&&(r=Object.fromEntries(e.header.entries())),n=parseInt(r["content-length"])||0,o=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:o,mime:o.split(";")[0].trim(),size:n,etag:r.etag||"",lastModified:r["last-modified"]||"",cacheControl:r["cache-control"]||""}];case 3:return i=s.sent(),[2,{code:"FETCH_FILE_INFO_ERROR",fileID:t.fileID,tempFileURL:t.tempFileURL,message:i.message}];case 4:return[2]}}))}))})))]:[3,3];case 2:return[2,{fileList:o.sent(),requestId:r.requestId}];case 3:return[2,{fileList:[],requestId:r.requestId}]}}))}))},D([z({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(W)]}),T("design:type",Function),T("design:paramtypes",[Object,"function"==typeof(e="undefined"!=typeof Function&&Function)?e:Object]),T("design:returntype","function"==typeof(r="undefined"!=typeof Promise&&Promise)?r:Object)],t.prototype,"uploadFile",null),D([z({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(W)]}),T("design:type",Function),T("design:paramtypes",[Object,"function"==typeof(n="undefined"!=typeof Function&&Function)?n:Object]),T("design:returntype","function"==typeof(o="undefined"!=typeof Promise&&Promise)?o:Object)],t.prototype,"getUploadMetadata",null),D([z({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(W)]}),T("design:type",Function),T("design:paramtypes",["function"==typeof(i=void 0!==j.ICloudbaseDeleteFileParams&&j.ICloudbaseDeleteFileParams)?i:Object,"function"==typeof(s="undefined"!=typeof Function&&Function)?s:Object]),T("design:returntype","function"==typeof(a="undefined"!=typeof Promise&&Promise)?a:Object)],t.prototype,"deleteFile",null),D([z({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(W)]}),T("design:type",Function),T("design:paramtypes",["function"==typeof(c=void 0!==j.ICloudbaseGetTempFileURLParams&&j.ICloudbaseGetTempFileURLParams)?c:Object,"function"==typeof(u="undefined"!=typeof Function&&Function)?u:Object]),T("design:returntype","function"==typeof(l="undefined"!=typeof Promise&&Promise)?l:Object)],t.prototype,"getTempFileURL",null),D([z({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(W)]}),T("design:type",Function),T("design:paramtypes",["function"==typeof(d=void 0!==j.ICloudbaseDownloadFileParams&&j.ICloudbaseDownloadFileParams)?d:Object,"function"==typeof(f="undefined"!=typeof Function&&Function)?f:Object]),T("design:returntype","function"==typeof(p="undefined"!=typeof Promise&&Promise)?p:Object)],t.prototype,"downloadFile",null),D([z({customInfo:{className:"Cloudbase",methodName:"copyFile"},title:"批量复制文件",messages:["请确认以下各项:"," 1 - 调用 copyFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(W)]}),T("design:type",Function),T("design:paramtypes",["function"==typeof(h=void 0!==j.ICloudbaseCopyFileParams&&j.ICloudbaseCopyFileParams)?h:Object,"function"==typeof(m="undefined"!=typeof Function&&Function)?m:Object]),T("design:returntype","function"==typeof(y="undefined"!=typeof Promise&&Promise)?y:Object)],t.prototype,"copyFile",null),t}(),$=new Q,Z={name:G,entity:{uploadFile:$.uploadFile,deleteFile:$.deleteFile,getTempFileURL:$.getTempFileURL,downloadFile:$.downloadFile,getUploadMetadata:$.getUploadMetadata,copyFile:$.copyFile,getFileInfo:$.getFileInfo,isGateWay:$.isGateWay}},tt=function(t){function e(e){var r=t.call(this)||this;return r.shouldThrowOnError=!1,r.bucketId="",r.context=e,r}return E(e,t),Object.defineProperty(e.prototype,"config",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.request},enumerable:!1,configurable:!0}),e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.from=function(t){return this.bucketId=t||"",this},e.prototype.upload=function(t,e,r){return x(this,void 0,Promise,(function(){var n,o,i,s,a,u,l,d,f;return q(this,(function(p){switch(p.label){case 0:n=N({upsert:!0},r),o=n.cacheControl,i=n.contentType,s=n.metadata,p.label=1;case 1:return p.trys.push([1,3,,4]),a=this._getCloudPath(t),u={cloudPath:a,filePath:e},(o||i||s)&&(l={},o&&(l["cache-control"]=o),i&&(l["content-type"]=i),s&&(l["x-cos-metadata-metadata"]=this.toBase64(JSON.stringify(s))),u.headers=l),[4,this.uploadFile(u)];case 2:if(!(d=p.sent()).fileID)throw new Error(JSON.stringify({code:k.OPERATION_FAIL,msg:"[".concat(G,".update] no fileID returned")}));return[2,{data:{id:d.fileID,path:t,fullPath:t},error:null}];case 3:if(f=p.sent(),this.shouldThrowOnError)throw f;if(c(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}}))}))},e.prototype.uploadToSignedUrl=function(t,e,r,n){return x(this,void 0,Promise,(function(){return q(this,(function(e){return[2,this.upload(t,r,n)]}))}))},e.prototype.createSignedUploadUrl=function(t){return x(this,void 0,Promise,(function(){var e,r,n;return q(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=this._getCloudPath(t),[4,this.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 a?n:new a(n.message)}];case 3:return[2]}}))}))},e.prototype.update=function(t,e,r){return x(this,void 0,Promise,(function(){return q(this,(function(n){return[2,this.upload(t,e,N(N({},r),{upsert:!0}))]}))}))},e.prototype.move=function(t,e){return x(this,void 0,Promise,(function(){var r,n;return q(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.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 a(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(c(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},e.prototype.copy=function(t,e){return x(this,void 0,Promise,(function(){var r,n;return q(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.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 a(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(c(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},e.prototype.createSignedUrl=function(t,e,r){return x(this,void 0,Promise,(function(){var n,o,i,s,u,l,d;return q(this,(function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),n=this._normalizeCloudId(t),[4,this.getTempFileURL({fileList:[{fileID:n,maxAge:e}]})];case 1:if("SUCCESS"!==(o=f.sent()).fileList[0].code)throw new a("Failed to create signed URL: [".concat(o.fileList[0].code,"] ").concat(o.fileList[0].fileID));return i=o.fileList[0].download_url,s=[],void 0!==(null==r?void 0:r.download)&&("string"==typeof r.download?s.push("download=".concat(encodeURIComponent(r.download))):!0===r.download&&s.push("download=true")),(null==r?void 0:r.transform)&&(u=this._transformOptsToQueryString(r.transform))&&s.push(u),s.length>0&&(l=i.includes("?")?"&":"?",i="".concat(i).concat(l).concat(s.join("&"))),[2,{data:{signedUrl:i},error:null}];case 2:if(d=f.sent(),this.shouldThrowOnError)throw d;if(c(d))return[2,{data:null,error:d}];throw d;case 3:return[2]}}))}))},e.prototype.createSignedUrls=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o=this;return q(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.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(c(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},e.prototype.download=function(t,e){return x(this,void 0,Promise,(function(){var r,n,o=this;return q(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n={},[4,x(o,void 0,void 0,(function(){var r,n,o,i;return q(this,(function(s){switch(s.label){case 0:return[4,this.createSignedUrl(t,600,{transform:e})];case 1:if((r=s.sent()).error)throw r.error;return n=encodeURI(null===(i=r.data)||void 0===i?void 0:i.signedUrl),[4,this.request.reqClass.get({url:n,headers:{},responseType:"blob"})];case 2:if(!(o=s.sent().data))throw new a("Download failed: no file content");return[2,new Blob([o])]}}))}))];case 1:return[2,(n.data=i.sent(),n.error=null,n)];case 2:if(r=i.sent(),this.shouldThrowOnError)throw r;if(c(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},e.prototype.info=function(t){return x(this,void 0,Promise,(function(){var e,r,n,o,i,s,c,u;return q(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),e=t.startsWith("cloud://"),r=e?this._extractPathFromFileId(t):t,n=e?this._extractBucketFromFileId(t):this.bucketId,[4,this.getFileInfo({fileList:[this._normalizeCloudId(t)]})];case 1:if(o=l.sent(),"SUCCESS"!==(i=o.fileList[0]).code)throw new a(i.message);return s=(new Date).toISOString(),c=(i.lastModified?new Date(i.lastModified):new Date).toISOString(),[2,{data:{id:i.fileID,version:"1",name:r,bucketId:n,updatedAt:c,createdAt:c,lastAccessedAt:s,size:i.size,cacheControl:i.cacheControl,contentType:i.contentType,etag:i.etag,lastModified:c,metadata:{}},error:null}];case 2:if(u=l.sent(),this.shouldThrowOnError)throw u;return[2,{data:null,error:u instanceof a?u:new a(u.message)}];case 3:return[2]}}))}))},e.prototype.exists=function(t){return x(this,void 0,Promise,(function(){var e,r,n;return q(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.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 a(r.message);return[2,{data:!0,error:null}];case 2:if(n=o.sent(),this.shouldThrowOnError)throw n;if(c(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},e.prototype.getPublicUrl=function(t,e){return x(this,void 0,Promise,(function(){var r;return q(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}]}}))}))},e.prototype.remove=function(t){return x(this,void 0,Promise,(function(){var e,r,n,o,i,s,u,l,d,f,p=this;return q(this,(function(h){switch(h.label){case 0:for(h.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 p.info(t)})))})))];case 1:return o=h.sent(),i=new Map,o.flat().forEach((function(r,n){r.data&&i.set(t[Math.floor(n/e)*e+n%e],r.data)})),s=t.map((function(t){return p._normalizeCloudId(t)})),[4,this.deleteFile({fileList:s})];case 2:if(u=h.sent(),(l=u.fileList.filter((function(t){return"SUCCESS"!==t.code}))).length>0)throw new a("Delete failed for ".concat(l.length," file(s)"));return d=(new Date).toISOString(),[2,{data:t.map((function(t){var e=i.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=h.sent(),this.shouldThrowOnError)throw f;if(c(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}}))}))},e.prototype.list=function(){return x(this,void 0,void 0,(function(){return q(this,(function(t){throw new a("Not implemented")}))}))},e.prototype._getCloudPath=function(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")},e.prototype._normalizeCloudId=function(t){var e;if(/^cloud:\/\//.test(t))return t;var r=this._getCloudPath(t);if(!this.bucketId)throw new a("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},e.prototype.toBase64=function(t){return"undefined"!=typeof Buffer?Buffer.from(t).toString("base64"):btoa(t)},e.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("/")},e.prototype._extractPathFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");return e.length<2?t:e.slice(1).join("/")},e.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)},e}(Q),et={name:"".concat(G,"/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 tt(r);return t.set(this,n),n},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(Z),cloudbase.registerComponent(et)}catch(t){}function rt(t){try{t.registerComponent(Z),t.registerComponent(et)}catch(t){console.warn(t)}}try{window.registerStorage=rt}catch(t){}var nt=rt})();var s=i.v;export{s as registerStorage};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|