@cloudbase/js-sdk 3.4.8 → 3.4.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/ai/dist/index.esm.js +1 -1
- package/ai/dist/index.esm.js.map +1 -1
- package/ai/dist/index.js +1 -1
- package/ai/dist/index.js.map +1 -1
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.esm.js.map +1 -1
- package/app/dist/index.js +1 -1
- package/app/dist/index.js.map +1 -1
- package/auth/dist/index.esm.js +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js +1 -1
- package/auth/dist/index.js.map +1 -1
- package/cloudrun/dist/index.esm.js +1 -1
- package/cloudrun/dist/index.esm.js.map +1 -1
- package/cloudrun/dist/index.js +1 -1
- package/cloudrun/dist/index.js.map +1 -1
- package/container/dist/index.esm.js +1 -1
- package/container/dist/index.esm.js.map +1 -1
- package/container/dist/index.js +1 -1
- package/container/dist/index.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/functions/dist/index.esm.js +1 -1
- package/functions/dist/index.esm.js.map +1 -1
- package/functions/dist/index.js +1 -1
- package/functions/dist/index.js.map +1 -1
- package/index.d.ts +654 -45
- package/miniprogram_dist/ai.js +1 -1
- package/miniprogram_dist/app.js +1 -1
- package/miniprogram_dist/auth.js +1 -1
- package/miniprogram_dist/cloudrun.js +1 -1
- package/miniprogram_dist/container.js +1 -1
- package/miniprogram_dist/functions.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/model.js +1 -1
- package/miniprogram_dist/oauth.js +1 -1
- package/miniprogram_dist/storage.js +1 -1
- package/model/dist/index.esm.js +1 -1
- package/model/dist/index.esm.js.map +1 -1
- package/model/dist/index.js +1 -1
- package/model/dist/index.js.map +1 -1
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.js +1 -1
- package/oauth/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/storage/dist/index.esm.js +1 -1
- package/storage/dist/index.esm.js.map +1 -1
- package/storage/dist/index.js +1 -1
- package/storage/dist/index.js.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/package.json +1 -1
- package/utilities/dist/cjs/adapters/platforms/web.js +12 -4
- package/utilities/dist/esm/adapters/platforms/web.js +12 -4
- package/utilities/dist/miniprogram/index.js +1 -1
- package/utilities/package.json +2 -2
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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};
|
|
1
|
+
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";var n={388:t=>{t.exports={}}},r={};function o(t){var e=r[t];if(void 0!==e)return e.exports;var i=r[t]={exports:{}};return n[t](i,i.exports,o),i.exports}o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var i={};(()=>{o.d(i,{v:()=>qt});var n,r=(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=function(t){function e(e){var n=t.call(this,e)||this;return n.__isStorageError=!0,n.name="StorageError",n}return r(e,t),e}(Error);function s(t){return"object"==typeof t&&null!==t&&"__isStorageError"in t}var c,u=function(t){function e(e,n,r){var o=t.call(this,e)||this;return o.name="StorageApiError",o.status=n,o.statusCode=r,o}return r(e,t),e.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},e}(a);function l(){return globalThis.Buffer}function d(t){var e=l();return e?e.from(t).toString("base64"):btoa(t)}function h(t){return t.split("/").map((function(t){return encodeURIComponent(t)})).join("/")}r((function(t,e){var n=c.call(this,t)||this;return n.name="StorageUnknownError",n.originalError=e,n}),c=a);var f=function(){return f=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},f.apply(this,arguments)},p=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},y=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},v="/v1/storages";function m(t,e){return p(this,void 0,Promise,(function(){var n;return y(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t()];case 1:return[2,{data:r.sent(),error:null}];case 2:if(n=r.sent(),e)throw n;return s(n)?[2,{data:null,error:n}]:[2,{data:null,error:new a((null==n?void 0:n.message)||String(n))}];case 3:return[2]}}))}))}var b=function(){function t(t){this.ctx=t}return Object.defineProperty(t.prototype,"request",{get:function(){return this.ctx.request},enumerable:!1,configurable:!0}),t.prototype.gatewayOrigin=function(){return this.request.getBaseEndPoint("GATEWAY")},t.prototype.buildUrl=function(t,e){var n="".concat(this.gatewayOrigin()).concat(v).concat(t),r=function(t){if(!t)return"";var e=[];return Object.keys(t).forEach((function(n){var r=t[n];null!=r&&e.push("".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(String(r))))})),e.join("&")}(e);return r&&(n+=(n.includes("?")?"&":"?")+r),n},t.prototype.toFullUrl=function(t){return t?/^https?:\/\//.test(t)||t.startsWith("//")?t:"".concat(this.gatewayOrigin()).concat(v).concat(t.startsWith("/")?"":"/").concat(t):t},t.prototype.send=function(t){return p(this,void 0,Promise,(function(){var e,n,r,o,i,a;return y(this,(function(s){switch(s.label){case 0:return e=this.buildUrl(t.path,t.query),n=t.method.toUpperCase(),r=["GET","HEAD"].includes(n),o=f({},t.headers||{}),r||(void 0!==t.rawBody?i=t.rawBody:void 0!==t.json&&(o["Content-Type"]=o["Content-Type"]||"application/json",i=JSON.stringify(t.json))),[4,this.request.fetch(f(f(f(f({url:e,method:n,headers:o},void 0!==i?{body:i}:{}),{withCredentials:!1!==t.withCredentials,shouldThrowOnError:!1}),t.signal?{signal:t.signal}:{}),t.cache?{cache:t.cache}:{}))];case 1:return a=s.sent(),[2,this.unwrap(a,e)]}}))}))},t.prototype.download=function(t){var e,n;return p(this,void 0,Promise,(function(){var r,o,i,a;return y(this,(function(s){switch(s.label){case 0:return r=this.buildUrl(t.path,t.query),[4,this.request.fetch(f(f({url:r,method:"GET",headers:f({},t.headers||{}),stream:!0,withCredentials:!1!==t.withCredentials,shouldThrowOnError:!1},t.signal?{signal:t.signal}:{}),t.cache?{cache:t.cache}:{}))];case 1:if(o=s.sent(),null===(e=t.signal)||void 0===e?void 0:e.aborted)throw new u("The download was aborted",0,"STORAGE_PG_ABORTED");if(304===(i=Number(null!==(n=null==o?void 0:o.statusCode)&&void 0!==n?n:200)))throw new u("Not Modified",i,"STORAGE_PG_NOT_MODIFIED");if(i>=400)throw new u("Download failed with status ".concat(i),i,"STORAGE_PG_REQUEST_FAIL");if(!(a=null==o?void 0:o.response))throw new u("Underlying adapter did not expose the raw Response",i,"STORAGE_PG_NO_RESPONSE");return[2,{response:a,status:i,header:null==o?void 0:o.header}]}}))}))},t.prototype.unwrap=function(t,e){var n,r;return p(this,void 0,Promise,(function(){var o,i,a,s;return y(this,(function(c){switch(c.label){case 0:o=Number(null!==(r=null!==(n=null==t?void 0:t.statusCode)&&void 0!==n?n:null==t?void 0:t.status)&&void 0!==r?r:200),i=null==t?void 0:t.data,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,i];case 2:return i=c.sent(),[3,4];case 3:return c.sent(),i=void 0,[3,4];case 4:if(o>=200&&o<300)return[2,i];throw a=(null==i?void 0:i.code)||(null==i?void 0:i.error)||"STORAGE_PG_REQUEST_FAIL",s=(null==i?void 0:i.message)||"Storage request failed with status ".concat(o,": ").concat(e),new u(s,o,a)}}))}))},t}(),g=function(){return g=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},g.apply(this,arguments)},w=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},O=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function I(t){return s(t)?t:new a((null==t?void 0:t.message)||String(t))}function P(t){var e={};return void 0!==(null==t?void 0:t.download)&&(e.download=!0===t.download?"":t.download),void 0!==(null==t?void 0:t.cacheNonce)&&(e.cacheNonce=String(t.cacheNonce)),{headers:{},query:e}}var S=function(){function t(t){this.ctx=t}return t.prototype.then=function(t,e){return this.execute().then(t,e)},t.prototype.execute=function(){var t,e;return w(this,void 0,Promise,(function(){var n,r,o,i,a;return O(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),n=P(this.ctx.options),r=n.headers,o=n.query,[4,this.ctx.http.download({path:"/object/".concat(this.ctx.bucketId,"/").concat(h(this.ctx.cleanName)),headers:g(g({},this.ctx.headers),r),query:o,signal:null===(t=this.ctx.parameters)||void 0===t?void 0:t.signal,cache:null===(e=this.ctx.parameters)||void 0===e?void 0:e.cache})];case 1:if(!(i=s.sent().response).body)throw new u("Response body is empty",i.status,"STORAGE_PG_EMPTY_BODY");return[2,{data:i.body,error:null}];case 2:if(a=s.sent(),this.ctx.shouldThrowOnError)throw a;return[2,{data:null,error:I(a)}];case 3:return[2]}}))}))},t}(),E=function(){function t(t){this.ctx=t}return t.prototype.asStream=function(){return new S(this.ctx)},t.prototype.then=function(t,e){return this.execute().then(t,e)},t.prototype.execute=function(){var t,e;return w(this,void 0,Promise,(function(){var n,r,o,i,a,s;return O(this,(function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),n=P(this.ctx.options),r=n.headers,o=n.query,[4,this.ctx.http.download({path:"/object/".concat(this.ctx.bucketId,"/").concat(h(this.ctx.cleanName)),headers:g(g({},this.ctx.headers),r),query:o,signal:null===(t=this.ctx.parameters)||void 0===t?void 0:t.signal,cache:null===(e=this.ctx.parameters)||void 0===e?void 0:e.cache})];case 1:return i=c.sent().response,s={},[4,i.blob()];case 2:return[2,(s.data=c.sent(),s.error=null,s)];case 3:if(a=c.sent(),this.ctx.shouldThrowOnError)throw a;return[2,{data:null,error:I(a)}];case 4:return[2]}}))}))},t}(),_=function(){return _=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},_.apply(this,arguments)},T=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},F=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},L="3600",j=function(){function t(t,e,n){void 0===n&&(n=!1),this.headers={},this.http=t,this.bucketId=e,this.shouldThrowOnError=n}return t.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},t.prototype.setHeader=function(t,e){var n;if("string"!=typeof t||""===t.trim())throw new a("setHeader requires a non-empty header name");if(/[\r\n]/.test(t)||"string"==typeof e&&/[\r\n]/.test(e))throw new a("setHeader does not allow CR/LF characters in header name or value");return this.headers=_(_({},this.headers),((n={})[t]=String(e),n)),this},t.prototype.upload=function(t,e,n){return T(this,void 0,Promise,(function(){return F(this,(function(r){return[2,this.uploadOrUpdate("POST",t,e,n)]}))}))},t.prototype.update=function(t,e,n){return T(this,void 0,Promise,(function(){return F(this,(function(r){return[2,this.uploadOrUpdate("PUT",t,e,n)]}))}))},t.prototype.download=function(t,e,n){return new E({http:this.http,bucketId:this.bucketId,cleanName:this.cleanPath(t),options:e,parameters:n,headers:this.headers,shouldThrowOnError:this.shouldThrowOnError})},t.prototype.list=function(t,e,n){return T(this,void 0,Promise,(function(){var r=this;return F(this,(function(o){return[2,m((function(){return T(r,void 0,void 0,(function(){var r;return F(this,(function(o){return r={prefix:t||""},void 0!==(null==e?void 0:e.limit)&&(r.limit=e.limit),void 0!==(null==e?void 0:e.cursor)&&(r.cursor=e.cursor),void 0!==(null==e?void 0:e.withDelimiter)&&(r.with_delimiter=e.withDelimiter),void 0!==(null==e?void 0:e.sortBy)&&(r.sortBy=e.sortBy),[2,this.send({method:"POST",path:"/object/list/".concat(this.bucketId),json:r,signal:null==n?void 0:n.signal,cache:null==n?void 0:n.cache})]}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.remove=function(t){return T(this,void 0,Promise,(function(){var e=this;return F(this,(function(n){return[2,m((function(){return T(e,void 0,void 0,(function(){var e,n,r,o,i,a=this;return F(this,(function(s){switch(s.label){case 0:e=t.map((function(t){return a.cleanPath(t)})),n=[],r=0,s.label=1;case 1:return r<e.length?(o=e.slice(r,r+100),[4,this.send({method:"DELETE",path:"/object/".concat(this.bucketId),json:{prefixes:o}})]):[3,4];case 2:i=s.sent(),Array.isArray(i)&&n.push.apply(n,i),s.label=3;case 3:return r+=100,[3,1];case 4:return[2,n]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.copy=function(t,e,n){return T(this,void 0,Promise,(function(){var r=this;return F(this,(function(o){return[2,m((function(){return T(r,void 0,void 0,(function(){var r;return F(this,(function(o){switch(o.label){case 0:return r=this.buildCopyMoveHeaders(n),[4,this.send({method:"POST",path:"/object/copy",json:{bucketId:this.bucketId,sourceKey:this.cleanPath(t),destinationKey:this.cleanPath(e),destinationBucket:null==n?void 0:n.destinationBucket,copyMetadata:null==n?void 0:n.copyMetadata,metadata:null==n?void 0:n.metadata},headers:r})];case 1:return[2,{path:o.sent().Key}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.move=function(t,e,n){return T(this,void 0,Promise,(function(){var r=this;return F(this,(function(o){return[2,m((function(){return T(r,void 0,void 0,(function(){return F(this,(function(r){switch(r.label){case 0:return[4,this.send({method:"POST",path:"/object/move",json:{bucketId:this.bucketId,sourceKey:this.cleanPath(t),destinationKey:this.cleanPath(e),destinationBucket:null==n?void 0:n.destinationBucket}})];case 1:return[2,{message:r.sent().message||"Successfully moved"}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.info=function(t){return T(this,void 0,Promise,(function(){var e=this;return F(this,(function(n){return[2,m((function(){return T(e,void 0,void 0,(function(){var e,n;return F(this,(function(r){switch(r.label){case 0:return e=this.cleanPath(t),[4,this.send({method:"GET",path:"/object/info/".concat(this.bucketId,"/").concat(this.encodePath(e))})];case 1:return[2,{id:(n=r.sent()).id,name:n.name,version:n.version,bucketId:n.bucket_id,size:n.size,contentType:n.content_type,cacheControl:n.cache_control,etag:n.etag,metadata:n.metadata,lastModified:n.last_modified,createdAt:n.created_at}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.exists=function(t){return T(this,void 0,Promise,(function(){var e,n,r;return F(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=this.cleanPath(t),[4,this.send({method:"GET",path:"/object/info/".concat(this.bucketId,"/").concat(this.encodePath(e))})];case 1:return o.sent(),[2,{data:!0,error:null}];case 2:if(n=o.sent(),void 0!==(r=null==n?void 0:n.status)&&[400,404].includes(Number(r)))return[2,{data:!1,error:null}];if(this.shouldThrowOnError)throw n;return[2,{data:null,error:n instanceof a?n:new a((null==n?void 0:n.message)||String(n))}];case 3:return[2]}}))}))},t.prototype.createSignedUrl=function(t,e,n){return T(this,void 0,Promise,(function(){var r=this;return F(this,(function(o){return[2,m((function(){return T(r,void 0,void 0,(function(){var r,o,i;return F(this,(function(a){switch(a.label){case 0:return r=this.cleanPath(t),[4,this.send({method:"POST",path:"/object/sign/".concat(this.bucketId,"/").concat(this.encodePath(r)),json:{expiresIn:e}})];case 1:return o=a.sent(),i=o.fullSignedURL||this.http.toFullUrl(o.signedURL||""),[2,{fullSignedURL:this.appendUrlOptions(i,n)}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.createSignedUrls=function(t,e,n){return T(this,void 0,Promise,(function(){var r=this;return F(this,(function(o){return[2,m((function(){return T(r,void 0,void 0,(function(){var r,o,i,a,s=this;return F(this,(function(c){switch(c.label){case 0:r=t.map((function(t){return s.cleanPath(t)})),o=[],i=0,c.label=1;case 1:return i<r.length?(a=r.slice(i,i+500),[4,this.send({method:"POST",path:"/object/sign/".concat(this.bucketId),json:{expiresIn:e,paths:a}})]):[3,4];case 2:c.sent().forEach((function(t){var e,r=t.fullSignedURL||(t.signedURL?s.http.toFullUrl(t.signedURL):null);o.push({path:t.path,fullSignedURL:r?s.appendUrlOptions(r,n):null,error:null!==(e=t.error)&&void 0!==e?e:null})})),c.label=3;case 3:return i+=500,[3,1];case 4:return[2,o]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.createSignedUploadUrl=function(t,e){return T(this,void 0,Promise,(function(){var n=this;return F(this,(function(r){return[2,m((function(){return T(n,void 0,void 0,(function(){var n,r,o;return F(this,(function(i){switch(i.label){case 0:return n=this.cleanPath(t),r={},(null==e?void 0:e.upsert)&&(r["x-upsert"]="true"),[4,this.send({method:"POST",path:"/object/upload/sign/".concat(this.bucketId,"/").concat(this.encodePath(n)),headers:r})];case 1:return[2,{fullSignedURL:(o=i.sent()).fullURL||this.http.toFullUrl(o.url||""),path:n,token:o.token}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.uploadToSignedUrl=function(t,e,n,r){return T(this,void 0,Promise,(function(){var o=this;return F(this,(function(i){return[2,m((function(){return T(o,void 0,void 0,(function(){var o,i,a,s,c;return F(this,(function(u){switch(u.label){case 0:return o=this.cleanPath(t),i=this.buildUploadBody(n,r),a=i.body,s=i.headers,[4,this.send({method:"PUT",path:"/object/upload/sign/".concat(this.bucketId,"/").concat(this.encodePath(o)),query:{token:e},rawBody:a,headers:s,withCredentials:!1})];case 1:return c=u.sent(),[2,{path:o,fullPath:c.Key}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.getPublicUrl=function(t,e){var n=this.cleanPath(t),r=this.http.buildUrl("/object/public/".concat(this.bucketId,"/").concat(this.encodePath(n)));return{data:{publicUrl:this.appendUrlOptions(r,e)}}},t.prototype.send=function(t){return this.http.send(_(_({},t),{headers:_(_({},this.headers),t.headers||{})}))},t.prototype.uploadOrUpdate=function(t,e,n,r){return T(this,void 0,Promise,(function(){var o=this;return F(this,(function(i){return[2,m((function(){return T(o,void 0,void 0,(function(){var o,i,a,s,c;return F(this,(function(u){switch(u.label){case 0:return o=this.cleanPath(e),i=this.buildUploadBody(n,r),a=i.body,s=i.headers,"POST"===t&&(s["x-upsert"]=String(Boolean(null==r?void 0:r.upsert))),[4,this.send({method:t,path:"/object/".concat(this.bucketId,"/").concat(this.encodePath(o)),rawBody:a,headers:s})];case 1:return[2,{id:(c=u.sent()).Id,path:o,fullPath:c.Key}]}}))}))}),this.shouldThrowOnError)]}))}))},t.prototype.cleanPath=function(t){var e=t.replace(/^\/+|\/+$/g,"").replace(/\/+/g,"/");if(e.split("/").some((function(t){return".."===t})))throw new a('invalid path: ".." segment is not allowed');return e},t.prototype.encodePath=function(t){return h(t)},t.prototype.buildUploadBody=function(t,e){var n,r,o,i,a,s=_({},(null==e?void 0:e.headers)||{}),c=t,u="undefined"!=typeof FormData&&t instanceof FormData;if("undefined"!=typeof Blob&&t instanceof Blob||u){var l=void 0,d={};if(u){var h=this.extractFromFormData(t);l=h.file,d=h.fields}else l=t;var f=null!==(r=null!==(n=null==e?void 0:e.cacheControl)&&void 0!==n?n:d.cacheControl)&&void 0!==r?r:L,p=null!==(o=null==e?void 0:e.contentType)&&void 0!==o?o:d.contentType,y=void 0!==(null==e?void 0:e.metadata)?JSON.stringify(e.metadata):d.metadata,v=new FormData;void 0!==f&&v.append("cacheControl",String(f)),void 0!==p&&v.append("contentType",p),void 0!==y&&v.append("metadata",y),v.append("",l),c=v}else c=t,f=null!==(i=null==e?void 0:e.cacheControl)&&void 0!==i?i:L,p=null!==(a=null==e?void 0:e.contentType)&&void 0!==a?a:"text/plain;charset=UTF-8",s["cache-control"]="max-age=".concat(f),p&&(s["content-type"]=p),(null==e?void 0:e.metadata)&&(s["x-metadata"]=this.toBase64(JSON.stringify(e.metadata)));return{body:c,headers:s}},t.prototype.extractFromFormData=function(t){var e,n={},r=0,o=[];if(t.forEach((function(t,i){if("undefined"!=typeof Blob&&t instanceof Blob)return e=t,void(r+=1);"cacheControl"!==i&&"contentType"!==i&&"metadata"!==i?o.push(i):n[i]=String(t)})),o.length>0&&console.warn("Ignored unsupported FormData field(s): [".concat(o.join(", "),"]. Only file, cacheControl, contentType and metadata are supported")),0===r||!e)throw new a("FormData must contain a file");if(r>1)throw new a("FormData must contain exactly one file");return{file:e,fields:n}},t.prototype.buildCopyMoveHeaders=function(t){var e={};return(null==t?void 0:t.upsert)&&(e["x-upsert"]="true"),!1===(null==t?void 0:t.copyMetadata)&&(null==t?void 0:t.metadata)&&(e["x-metadata"]=this.toBase64(JSON.stringify(t.metadata))),e},t.prototype.appendUrlOptions=function(t,e){var n=[];if(void 0!==(null==e?void 0:e.download)){var r=!0===e.download?"":String(e.download);n.push("download=".concat(encodeURIComponent(r)))}if(void 0!==(null==e?void 0:e.cacheNonce)&&n.push("cacheNonce=".concat(encodeURIComponent(String(e.cacheNonce)))),0===n.length)return t;var o=t.includes("?")?"&":"?";return"".concat(t).concat(o).concat(n.join("&"))},t.prototype.toBase64=function(t){return d(t)},t}(),x=/[\x00-\x20\x7f/\\?#%]/;function U(t,e){if("string"!=typeof t||0===t.length)throw new a("[storage.".concat(e,"] bucketId is required"));if(t.length>256)throw new a("[storage.".concat(e,"] invalid bucketId: length must be 1-").concat(256));var n=x.exec(t);if(n){var r="[storage.".concat(e,'] invalid bucketId "').concat(t,'": ')+"contains forbidden character ".concat(JSON.stringify(n[0]),"; ")+'must not contain whitespace, control chars, "/", "\\", "?", "#" or "%"';throw new a(r)}}var R=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},C=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},A=function(){function t(t,e){void 0===e&&(e=!1),this.http=new b(t),this.shouldThrowOnError=e}return t.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},t.prototype.listBuckets=function(t){return R(this,void 0,Promise,(function(){var e=this;return C(this,(function(n){return[2,m((function(){var n={};return void 0!==(null==t?void 0:t.limit)&&(n.limit=t.limit),void 0!==(null==t?void 0:t.offset)&&(n.offset=t.offset),(null==t?void 0:t.sortColumn)&&(n.sortColumn=t.sortColumn),(null==t?void 0:t.sortOrder)&&(n.sortOrder=t.sortOrder),(null==t?void 0:t.search)&&(n.search=t.search),e.http.send({method:"GET",path:"/bucket/",query:n})}),this.shouldThrowOnError)]}))}))},t.prototype.getBucket=function(t){return R(this,void 0,Promise,(function(){var e=this;return C(this,(function(n){return[2,m((function(){return U(t,"getBucket"),e.http.send({method:"GET",path:"/bucket/".concat(t)})}),this.shouldThrowOnError)]}))}))},t.prototype.createBucket=function(t,e){return R(this,void 0,Promise,(function(){var n=this;return C(this,(function(r){return[2,m((function(){var r;return U(t,"createBucket"),n.http.send({method:"POST",path:"/bucket/",json:{id:t,name:t,public:null!==(r=null==e?void 0:e.public)&&void 0!==r&&r,type:null==e?void 0:e.type,file_size_limit:null==e?void 0:e.fileSizeLimit,allowed_mime_types:null==e?void 0:e.allowedMimeTypes}})}),this.shouldThrowOnError)]}))}))},t.prototype.updateBucket=function(t,e){return R(this,void 0,Promise,(function(){var n=this;return C(this,(function(r){return[2,m((function(){return U(t,"updateBucket"),n.http.send({method:"PUT",path:"/bucket/".concat(t),json:{public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes}})}),this.shouldThrowOnError)]}))}))},t.prototype.deleteBucket=function(t){return R(this,void 0,Promise,(function(){var e=this;return C(this,(function(n){return[2,m((function(){return U(t,"deleteBucket"),e.http.send({method:"DELETE",path:"/bucket/".concat(t)})}),this.shouldThrowOnError)]}))}))},t}(),k="@cloudbase/js-sdk";function N(){return k}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 q=(B={AbstractSDKRequest:()=>t.AbstractSDKRequest,AbstractStorage:()=>t.AbstractStorage},M={},o.d(M,B),M);var B,M;function G(t){return"string"==typeof t}function z(t,e){console.warn("[".concat(N(),"][").concat(t,"]:").concat(e))}var W,J=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),V=function(){return V=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},V.apply(this,arguments)},H=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},K=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};!function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}J(e,t),e.prototype.get=function(t){return this.request(V(V({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(V(V({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(V(V({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,i=t.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===s?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",r),c.append("file",n),this.request(V(V({},t),{data:c,method:s}),this.restrictedMethods.includes("upload"))):this.request(V(V({},t),{method:"put",headers:a,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return H(this,void 0,Promise,(function(){var e,n,r,o;return K(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(V(V({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return H(this,void 0,Promise,(function(){var n,r,o,i,a,s,c,u,l,d,h,f,p,y=this;return K(this,(function(v){switch(v.label){case 0:return n=new AbortController,r=t.url,o=t.enableAbort,i=void 0!==o&&o,a=t.stream,s=void 0!==a&&a,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,d=void 0===l||l,h=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",(function(){return n.abort()}))),f=null,i&&h&&(f=setTimeout((function(){console.warn(y.timeoutMsg),n.abort(new Error(y.timeoutMsg))}),h)),[4,fetch(r,V(V({},t),{signal:n.signal})).then((function(t){return H(y,void 0,void 0,(function(){var e,n,r;return K(this,(function(o){switch(o.label){case 0:return clearTimeout(f),d?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,t.json()];case 2:e=r.apply(n,[o.sent()]),o.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){return clearTimeout(f),Promise.reject(t)}))];case 1:return p=v.sent(),[2,{data:s?p.body:(null===(e=p.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i=t.url,a=t.headers,s=void 0===a?{}:a,c=t.data,u=t.responseType,l=t.withCredentials,d=t.body,h=t.onUploadProgress,f=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}("https:",i,"get"===r?c:{}),p=new XMLHttpRequest;p.open(r,f),u&&(p.responseType=u);var y,v,m,b=t.signal;b&&(b.aborted?p.abort():b.addEventListener("abort",(function(){return p.abort()}),{once:!0})),Object.keys(s).forEach((function(t){p.setRequestHeader(t,s[t])})),h&&p.upload.addEventListener("progress",h),p.onreadystatechange=function(){var t={};if(4===p.readyState){var e=p.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=p.status;try{t.data="blob"===u?p.response:JSON.parse(p.responseText)}catch(e){t.data="blob"===u?p.response:p.responseText}clearTimeout(y),o(t)}},e&&n.timeout&&(y=setTimeout((function(){console.warn(n.timeoutMsg),p.abort()}),n.timeout)),m=c,v="[object FormData]"===Object.prototype.toString.call(m)?c:"application/x-www-form-urlencoded"===s["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}(c):d||(c?JSON.stringify(c):void 0),l&&(p.withCredentials=!0),p.send(v)}))}}(q.AbstractSDKRequest),function(t){t.WEB="web",t.WX_MP="wx_mp"}(W||(W={}));var Y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Q=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},X=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},$=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return Y(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}(q.AbstractStorage);!function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,o=t.keys,i=void 0===o?{}:o;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(z(D.INVALID_PARAMS,"localStorage is not supported on current platform"),new $(e.root));case"none":return new $(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:D.OPERATION_FAIL,msg:"[".concat(N(),"][").concat(D.OPERATION_FAIL,"]setStore failed"),info:t}))}}else z(D.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return Q(this,void 0,void 0,(function(){var r;return X(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}z(D.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return Q(this,void 0,void 0,(function(){var r;return X(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=o.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):z(D.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var Z=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),tt=function(t,e){this.data=e||null,this.name=t},et=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return Z(e,t),e}(tt),nt=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof et)return console.error(t.error),this;var n=G(t)?new tt(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,i=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];o<i.length;o++)i[o].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new nt,new nt,"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");const rt=(t=>{var e={};return o.d(e,t),e})({default:()=>e.default});rt.default;var ot,it=o(388),at=function(){return at=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},at.apply(this,arguments)},st=function(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a},ct=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ut=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},lt=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};!function(t){t.put="put",t.post="post"}(ot||(ot={}));var dt=N,ht=D,ft="https://support.qq.com/products/148793",pt=function(t){return"[object Array]"===Object.prototype.toString.call(t)},yt=G,vt=function(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n},mt=function(t){return t.mode,t.customInfo,t.title,t.messages,function(t,e,n){}},bt="storage",gt=function(t,e,n){return ut(void 0,void 0,void 0,(function(){var r,o,i;return lt(this,(function(a){switch(a.label){case 0:return[4,t.gateWay({path:"storages",name:"get-objects-upload-info",data:[at({objectId:e.path},e.signedHeader?{signedHeader:e.signedHeader}:{})]},n)];case 1:return r=a.sent(),o=(null===(i=r.data)||void 0===i?void 0:i[0])||{},[2,at(at({},r),{data:at(at({},o.code?at({},o):{}),{authorization:o.authorization,token:o.token,url:o.uploadUrl,fileId:o.cloudObjectId,cosFileId:o.cloudObjectMeta,download_url:o.downloadUrl})})]}}))}))},wt=function(t,e,n){return ut(void 0,void 0,void 0,(function(){var r,o;return lt(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}}))},n)];case 1:return r=i.sent(),[2,at(at({},r),{data:{download_list:null===(o=r.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}}))}})]}}))}))},Ot=function(t,e,n){return ut(void 0,void 0,void 0,(function(){var r,o;return lt(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}}))},n)];case 1:return r=i.sent(),[2,at(at({},r),{data:{delete_list:null===(o=r.data)||void 0===o?void 0:o.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},It=function(t,e,n){return ut(void 0,void 0,void 0,(function(){var r,o;return lt(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}}))},n)];case 1:return r=i.sent(),[2,at(at({},r),{data:{copy_list:null===(o=r.data)||void 0===o?void 0:o.map((function(t){return{code:t.code||"SUCCESS",fileID:t.cloudObjectId,message:t.message}}))}})]}}))}))},Pt={txt:"text/plain",json:"application/json",html:"text/html",htm:"text/html",css:"text/css",js:"application/javascript",csv:"text/csv",xml:"application/xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",svg:"image/svg+xml",ico:"image/x-icon",pdf:"application/pdf",zip:"application/zip",gz:"application/gzip",mp4:"video/mp4",webm:"video/webm",mp3:"audio/mpeg",wav:"audio/wav"};function St(t,e){if("undefined"!=typeof Blob&&t instanceof Blob&&t.type)return t.type;var n=/\.([a-zA-Z0-9]+)$/.exec(e||""),r=n?n[1].toLowerCase():"";return Pt[r]||"application/octet-stream"}function Et(t,e){var n=e.toLowerCase();return Object.keys(t).some((function(t){return t.toLowerCase()===n}))}function _t(t){return Object.keys(t).reduce((function(e,n){var r;return at(at({},e),((r={})[n]=[t[n]],r))}),{})}var Tt=function(){function t(t){this.context=t}var e,n,r,o,i,a,s,c,u,d,h,f,p,y,v,m;return Object.defineProperty(t.prototype,"config",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.config},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.request},enumerable:!1,configurable:!0}),t.prototype.isGateWay=function(){return"GATEWAY"===(this.config.endPointMode||"CLOUD_API")},t.prototype.uploadFile=function(t,e){return ut(this,void 0,Promise,(function(){var n,r,o,i,a,s,c,u,d,h,f,p,y,v,m,b,g,w,O,I,P,S,E,_,T,F,L,j,x,U,R;return lt(this,(function(C){switch(C.label){case 0:if(n=t.cloudPath,r=t.filePath,o=t.onUploadProgress,x=t.method,i=void 0===x?"put":x,U=t.headers,a=void 0===U?{}:U,s=t.fileContent,!yt(n)||!r&&!s)throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".uploadFile] invalid params")}));return c={put:ot.put,post:ot.post}[i.toLocaleLowerCase()]||ot.put,u=this.isGateWay(),d=at({},a),h=Object.keys(a).reduce((function(t,e){return"content-length"!==e.toLowerCase()&&(t[e]=a[e]),t}),{}),c===ot.put&&u&&(Et(d,"content-length")||"number"==typeof(f=function(t,e){var n=null!=t?t:e;if(null!==n){if("undefined"!=typeof Blob&&n instanceof Blob)return n.size;if("undefined"!=typeof ArrayBuffer){if(n instanceof ArrayBuffer)return n.byteLength;if("function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(n))return n.byteLength}if("string"==typeof n){if("undefined"!=typeof Blob)return new Blob([n]).size;var r=(o=n,null===(i=l())||void 0===i?void 0:i.byteLength(o));return"number"==typeof r?r:n.length}var o,i;return"object"==typeof n&&"number"==typeof n.size?n.size:void 0}}(r,s))&&(d["content-length"]=String(f)),Et(d,"content-type")||(d["content-type"]=St(r,n)),Et(h,"content-type")||(h["content-type"]=St(r,n))),[4,this.getUploadMetadata({cloudPath:n,method:c,headers:c!==ot.put||u?void 0:h,signedHeader:c===ot.put&&u?_t(d):void 0,customReqOpts:t.customReqOpts})];case 1:return p=C.sent(),y=p.data,v=p.requestId,(null==(m=y)?void 0:m.code)||!(null==m?void 0:m.url)?(b=(null==m?void 0:m.code)||ht.OPERATION_FAIL,g=(null==m?void 0:m.message)||"get upload info failed",[2,vt(e,new Error("[".concat(dt(),"][").concat(b,"][").concat(bt,"]:").concat(g)))]):(w=y.url,O=y.authorization,I=y.token,P=y.fileId,S=y.cosFileId,E=y.download_url,T=at(at({},_={url:w,file:r,name:n,onUploadProgress:o,fileContent:s,fileId:P,requestId:v}),{method:ot.put,headers:at(at({},h),{authorization:O,"x-cos-meta-fileid":S,"x-cos-security-token":I})}),F=at(at({},_),{method:ot.post,data:{key:n,signature:O,"x-cos-meta-fileid":S,success_action_status:"201","x-cos-security-token":I}}),(R={})[ot.put]={params:T,isSuccess:function(t){return t>=200&&t<300}},R[ot.post]={params:F,isSuccess:function(t){return 201===t}},L=R,[4,this.request.upload(L[c].params)]);case 2:return j=C.sent(),L[c].isSuccess(j.statusCode)?[2,vt(e,null,{fileID:P,download_url:E,requestId:v})]:[2,vt(e,new Error("[".concat(dt(),"][").concat(ht.OPERATION_FAIL,"][").concat(bt,"]:").concat(j.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return ut(this,void 0,Promise,(function(){var n,r,o,i,a,s,c,u,l,d;return lt(this,(function(h){switch(h.label){case 0:if(n=t.cloudPath,r=t.method,o=t.headers,i=t.signedHeader,!yt(n))throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".getUploadMetadata] invalid cloudPath")}));a=this.request,s="storage.getUploadMetadata",h.label=1;case 1:return h.trys.push([1,6,,7]),c=void 0,u={path:n},l=this.isGateWay(),r&&(u.method=r),r===ot.put&&(l&&i?u.signedHeader=i:!l&&o&&(u.headers=o)),l?[4,gt(a,u,t.customReqOpts)]:[3,3];case 2:return c=h.sent(),[3,5];case 3:return[4,a.send(s,u,t.customReqOpts)];case 4:c=h.sent(),h.label=5;case 5:return[2,vt(e,null,c)];case 6:return d=h.sent(),[2,vt(e,d)];case 7:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return ut(this,void 0,Promise,(function(){var n,r,o,i,a,s,c,u;return lt(this,(function(l){switch(l.label){case 0:if(!(n=t.fileList)||!pt(n)||0===n.length)throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".deleteFile] fileList must not be empty")}));for(r=0,o=n;r<o.length;r++)if(!(i=o[r])||!yt(i))throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".deleteFile] fileID must be string")}));return a="storage.batchDeleteFile",s=this.request,c={},this.isGateWay()?[4,Ot(s,{fileList:n},t.customReqOpts)]:[3,2];case 1:return c=l.sent(),[3,4];case 2:return[4,s.send(a,{fileid_list:n},t.customReqOpts)];case 3:c=l.sent(),l.label=4;case 4:return c.code?[2,vt(e,null,c)]:(u={fileList:c.data.delete_list,requestId:c.requestId},[2,vt(e,null,u)])}}))}))},t.prototype.getTempFileURL=function(t,e){return ut(this,void 0,Promise,(function(){var n,r,o,i,a,s,c,u;return lt(this,(function(l){switch(l.label){case 0:if(!(n=t.fileList)||!pt(n)||0===n.length)throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".getTempFileURL] fileList must not be empty")}));for(r=[],o=0,i=n;o<i.length;o++)if(a=i[o],d=a,"[object Object]"===Object.prototype.toString.call(d)){if(!Object.prototype.hasOwnProperty.call(a,"fileID"))throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".getTempFileURL] file info must include fileID")}));r.push({fileid:a.fileID,max_age:a.maxAge||7200})}else{if(!yt(a))throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".getTempFileURL] invalid fileList")}));r.push({fileid:a})}return s="storage.batchGetDownloadUrl",c=this.request,u={},this.isGateWay()?[4,wt(c,{convertedFileList:r},t.customReqOpts)]:[3,2];case 1:return u=l.sent(),[3,4];case 2:return[4,c.send(s,{file_list:r},t.customReqOpts)];case 3:u=l.sent(),l.label=4;case 4:return u.code?[2,vt(e,null,u)]:[2,vt(e,null,{fileList:u.data.download_list,requestId:u.requestId})]}var d}))}))},t.prototype.downloadFile=function(t,e){return ut(this,void 0,Promise,(function(){var n,r,o,i,a,s;return lt(this,(function(c){switch(c.label){case 0:if(n=t.fileID,!yt(n))throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}],customReqOpts:t.customReqOpts})];case 1:return r=c.sent(),"SUCCESS"!==(o=r.fileList[0]).code?[2,vt(e,o)]:(i=this.request,a=encodeURI(o.download_url),[4,i.download({url:a,tempFilePath:t.tempFilePath})]);case 2:return s=c.sent(),[2,vt(e,null,s)]}}))}))},t.prototype.copyFile=function(t,e){return ut(this,void 0,Promise,(function(){var n,r,o,i,a,s,c,u,l;return lt(this,(function(d){switch(d.label){case 0:if(!(n=t.fileList)||!pt(n)||0===n.length)throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".copyFile] fileList must not be empty")}));for(r=[],o=0,i=n;o<i.length;o++){if(a=i[o],s=a.srcPath,c=a.dstPath,!s||!c||"string"!=typeof s||"string"!=typeof c)throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".copyFile] srcPath and dstPath may not be empty")}));if(s===c)throw new Error(JSON.stringify({code:ht.INVALID_PARAMS,msg:"[".concat(bt,".copyFile] srcPath and dstPath can not be the same")}));r.push({src_path:s,dst_path:c,overwrite:a.overwrite,remove_original:a.removeOriginal})}return u=this.request,l={},this.isGateWay()?[4,It(u,{convertedFileList:r},t.customReqOpts)]:[3,2];case 1:return l=d.sent(),[3,4];case 2:return[4,u.send("storage.batchCopyFile",{file_list:r},t.customReqOpts)];case 3:l=d.sent(),d.label=4;case 4:return l.code?[2,vt(e,null,l)]:[2,vt(e,null,{fileList:l.data.copy_list,requestId:l.requestId})]}}))}))},t.prototype.getFileInfo=function(t){var e;return ut(this,void 0,Promise,(function(){var n,r=this;return lt(this,(function(o){switch(o.label){case 0:return[4,this.getTempFileURL(t)];case 1:return(null==(n=o.sent())?void 0:n.fileList)&&(null===(e=null==n?void 0:n.fileList)||void 0===e?void 0:e.length)>0?[4,Promise.all(n.fileList.map((function(t){return ut(r,void 0,void 0,(function(){var e,n,r,o,i,a,s;return lt(this,(function(c){switch(c.label){case 0:if("SUCCESS"!==t.code)return[2,{code:t.code,fileID:t.fileID,tempFileURL:t.tempFileURL,message:t.message}];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request.fetch({url:t.tempFileURL,method:"HEAD"})];case 2:return e=c.sent(),n=e.header,"undefined"!=typeof Headers&&n instanceof Headers&&(r={},n.forEach((function(t,e){r[e]=t})),n=r),o=parseInt(n["content-length"])||0,i=n["content-type"]||"",[400,404].includes(Number(e.statusCode))?[2,{code:"FILE_NOT_FOUND",fileID:t.fileID,tempFileURL:t.tempFileURL,message:"file not found"}]:[2,{code:t.code,fileID:t.fileID,tempFileURL:t.tempFileURL,cloudId:t.fileID,fileName:t.fileID.split("/").pop(),contentType:i,mime:i.split(";")[0].trim(),size:o,etag:n.etag||"",lastModified:n["last-modified"]||"",cacheControl:n["cache-control"]||""}];case 3:return a=c.sent(),s="object"==typeof a&&null!==a&&"message"in a?String(a.message):void 0,[2,{code:"FETCH_FILE_INFO_ERROR",fileID:t.fileID,tempFileURL:t.tempFileURL,message:s}];case 4:return[2]}}))}))})))]:[3,3];case 2:return[2,{fileList:o.sent(),requestId:n.requestId}];case 3:return[2,{fileList:[],requestId:n.requestId}]}}))}))},st([mt({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ft)]}),ct("design:type",Function),ct("design:paramtypes",[Object,"function"==typeof(e="undefined"!=typeof Function&&Function)?e:Object]),ct("design:returntype","function"==typeof(n="undefined"!=typeof Promise&&Promise)?n:Object)],t.prototype,"uploadFile",null),st([mt({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ft)]}),ct("design:type",Function),ct("design:paramtypes",[Object,"function"==typeof(r="undefined"!=typeof Function&&Function)?r:Object]),ct("design:returntype","function"==typeof(o="undefined"!=typeof Promise&&Promise)?o:Object)],t.prototype,"getUploadMetadata",null),st([mt({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ft)]}),ct("design:type",Function),ct("design:paramtypes",["function"==typeof(i=void 0!==it.ICloudbaseDeleteFileParams&&it.ICloudbaseDeleteFileParams)?i:Object,"function"==typeof(a="undefined"!=typeof Function&&Function)?a:Object]),ct("design:returntype","function"==typeof(s="undefined"!=typeof Promise&&Promise)?s:Object)],t.prototype,"deleteFile",null),st([mt({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ft)]}),ct("design:type",Function),ct("design:paramtypes",["function"==typeof(c=void 0!==it.ICloudbaseGetTempFileURLParams&&it.ICloudbaseGetTempFileURLParams)?c:Object,"function"==typeof(u="undefined"!=typeof Function&&Function)?u:Object]),ct("design:returntype","function"==typeof(d="undefined"!=typeof Promise&&Promise)?d:Object)],t.prototype,"getTempFileURL",null),st([mt({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ft)]}),ct("design:type",Function),ct("design:paramtypes",["function"==typeof(h=void 0!==it.ICloudbaseDownloadFileParams&&it.ICloudbaseDownloadFileParams)?h:Object,"function"==typeof(f="undefined"!=typeof Function&&Function)?f:Object]),ct("design:returntype","function"==typeof(p="undefined"!=typeof Promise&&Promise)?p:Object)],t.prototype,"downloadFile",null),st([mt({customInfo:{className:"Cloudbase",methodName:"copyFile"},title:"批量复制文件",messages:["请确认以下各项:"," 1 - 调用 copyFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ft)]}),ct("design:type",Function),ct("design:paramtypes",["function"==typeof(y=void 0!==it.ICloudbaseCopyFileParams&&it.ICloudbaseCopyFileParams)?y:Object,"function"==typeof(v="undefined"!=typeof Function&&Function)?v:Object]),ct("design:returntype","function"==typeof(m="undefined"!=typeof Promise&&Promise)?m:Object)],t.prototype,"copyFile",null),t}(),Ft=function(){return Ft=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ft.apply(this,arguments)},Lt=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},jt=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},xt=D,Ut=function(){function t(t,e){void 0===e&&(e=!1),this.shouldThrowOnError=!1,this.bucketId="",this.context=t,this.shouldThrowOnError=e,this.storage=new Tt(t)}return Object.defineProperty(t.prototype,"config",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.config},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){var t;return null===(t=this.context)||void 0===t?void 0:t.request},enumerable:!1,configurable:!0}),t.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},t.prototype.upload=function(t,e,n){return Lt(this,void 0,Promise,(function(){var r,o,i,a,c,u,l,d,h;return jt(this,(function(f){switch(f.label){case 0:r=Ft({upsert:!0},n),o=r.cacheControl,i=r.contentType,a=r.metadata,f.label=1;case 1:return f.trys.push([1,3,,4]),c=this.getCloudPath(t),u={cloudPath:c,filePath:e},(o||i||a)&&(l={},o&&(l["cache-control"]=o),i&&(l["content-type"]=i),a&&(l["x-cos-metadata-metadata"]=this.toBase64(JSON.stringify(a))),u.headers=l),[4,this.storage.uploadFile(u)];case 2:if(!(d=f.sent()).fileID)throw new Error(JSON.stringify({code:xt.OPERATION_FAIL,msg:"[".concat(bt,".update] no fileID returned")}));return[2,{data:{id:d.fileID,path:t,fullPath:t},error:null}];case 3:if(h=f.sent(),this.shouldThrowOnError)throw h;if(s(h))return[2,{data:null,error:h}];throw h;case 4:return[2]}}))}))},t.prototype.uploadToSignedUrl=function(t,e,n,r){return Lt(this,void 0,Promise,(function(){return jt(this,(function(e){return[2,this.upload(t,n,r)]}))}))},t.prototype.createSignedUploadUrl=function(t){return Lt(this,void 0,Promise,(function(){var e,n,r;return jt(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=this.getCloudPath(t),[4,this.storage.getUploadMetadata({cloudPath:e})];case 1:return[2,{data:{signedUrl:(n=o.sent().data).url,token:n.token,path:t,authorization:n.authorization,id:n.fileId,cosFileId:n.cosFileId,downloadUrl:n.download_url},error:null}];case 2:if(r=o.sent(),this.shouldThrowOnError)throw r;return[2,{data:null,error:r instanceof a?r:new a(r.message)}];case 3:return[2]}}))}))},t.prototype.update=function(t,e,n){return Lt(this,void 0,Promise,(function(){return jt(this,(function(r){return[2,this.upload(t,e,Ft(Ft({},n),{upsert:!0}))]}))}))},t.prototype.move=function(t,e){return Lt(this,void 0,Promise,(function(){var n,r;return jt(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(t),dstPath:this.getCloudPath(e),overwrite:!0,removeOriginal:!0}]})];case 1:if((n=o.sent()).fileList[0].code&&"SUCCESS"!==n.fileList[0].code)throw new a(n.fileList[0].message||"Move failed");return[2,{data:{message:"File moved from ".concat(t," to ").concat(e)},error:null}];case 2:if(r=o.sent(),this.shouldThrowOnError)throw r;if(s(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},t.prototype.copy=function(t,e){return Lt(this,void 0,Promise,(function(){var n,r;return jt(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(t),dstPath:this.getCloudPath(e),overwrite:!0,removeOriginal:!1}]})];case 1:if((n=o.sent()).fileList[0].code&&"SUCCESS"!==n.fileList[0].code)throw new a(n.fileList[0].message||"Copy failed");return[2,{data:{path:this.getCloudPath(e)},error:null}];case 2:if(r=o.sent(),this.shouldThrowOnError)throw r;if(s(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},t.prototype.createSignedUrl=function(t,e,n){return Lt(this,void 0,Promise,(function(){var r,o,i,c,u,l,d;return jt(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,,3]),r=this.normalizeCloudId(t),[4,this.storage.getTempFileURL({fileList:[{fileID:r,maxAge:e}]})];case 1:if("SUCCESS"!==(o=h.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,c=[],void 0!==(null==n?void 0:n.download)&&("string"==typeof n.download?c.push("download=".concat(encodeURIComponent(n.download))):!0===n.download&&c.push("download=true")),(null==n?void 0:n.transform)&&(u=this.transformOptsToQueryString(n.transform))&&c.push(u),c.length>0&&(l=i.includes("?")?"&":"?",i="".concat(i).concat(l).concat(c.join("&"))),[2,{data:{signedUrl:i},error:null}];case 2:if(d=h.sent(),this.shouldThrowOnError)throw d;if(s(d))return[2,{data:null,error:d}];throw d;case 3:return[2]}}))}))},t.prototype.createSignedUrls=function(t,e){return Lt(this,void 0,Promise,(function(){var n,r,o=this;return jt(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),n=t.map((function(t){return{fileID:o.normalizeCloudId(t),maxAge:e}})),[4,this.storage.getTempFileURL({fileList:n})];case 1:return[2,{data:i.sent().fileList.map((function(e,n){return{path:t[n],signedUrl:e.tempFileURL||"",error:"SUCCESS"===e.code?null:e.message}})),error:null}];case 2:if(r=i.sent(),this.shouldThrowOnError)throw r;if(s(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},t.prototype.download=function(t,e){return Lt(this,void 0,Promise,(function(){var n,r,o=this;return jt(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),r={},[4,Lt(o,void 0,void 0,(function(){var n,r,o,i;return jt(this,(function(s){switch(s.label){case 0:return[4,this.createSignedUrl(t,600,{transform:e})];case 1:if((n=s.sent()).error)throw n.error;return r=encodeURI(null===(i=n.data)||void 0===i?void 0:i.signedUrl),[4,this.request.reqClass.get({url:r,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,(r.data=i.sent(),r.error=null,r)];case 2:if(n=i.sent(),this.shouldThrowOnError)throw n;if(s(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}}))}))},t.prototype.info=function(t){return Lt(this,void 0,Promise,(function(){var e,n,r,o,i,s,c,u;return jt(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),e=t.startsWith("cloud://"),n=e?this.extractPathFromFileId(t):t,r=e?this.extractBucketFromFileId(t):this.bucketId,[4,this.storage.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:n,bucketId:r,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]}}))}))},t.prototype.exists=function(t){return Lt(this,void 0,Promise,(function(){var e,n,r;return jt(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(t)]})];case 1:if(e=o.sent(),"FILE_NOT_FOUND"===(n=e.fileList[0]).code)return[2,{data:!1,error:null}];if("SUCCESS"!==n.code)throw new a(n.message);return[2,{data:!0,error:null}];case 2:if(r=o.sent(),this.shouldThrowOnError)throw r;if(s(r))return[2,{data:null,error:r}];throw r;case 3:return[2]}}))}))},t.prototype.getPublicUrl=function(t,e){return Lt(this,void 0,Promise,(function(){var n;return jt(this,(function(r){switch(r.label){case 0:return[4,this.createSignedUrl(t,600,e)];case 1:return(n=r.sent()).data?[2,{data:{publicUrl:n.data.signedUrl}}]:[2,{data:null,error:n.error}]}}))}))},t.prototype.remove=function(t){return Lt(this,void 0,Promise,(function(){var e,n,r,o,i,c,u,l,d,h,f=this;return jt(this,(function(p){switch(p.label){case 0:for(p.trys.push([0,3,,4]),e=10,n=[],r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return[4,Promise.all(n.map((function(t){return Promise.all(t.map((function(t){return f.info(t)})))})))];case 1:return o=p.sent(),i=new Map,o.forEach((function(n,r){n.forEach((function(n,o){n.data&&i.set(t[r*e+o],n.data)}))})),c=t.map((function(t){return f.normalizeCloudId(t)})),[4,this.storage.deleteFile({fileList:c})];case 2:if(u=p.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(h=p.sent(),this.shouldThrowOnError)throw h;if(s(h))return[2,{data:null,error:h}];throw h;case 4:return[2]}}))}))},t.prototype.list=function(){return Lt(this,void 0,void 0,(function(){return jt(this,(function(t){throw new a("Not implemented")}))}))},t.prototype.getCloudPath=function(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")},t.prototype.normalizeCloudId=function(t){var e;if(/^cloud:\/\//.test(t))return t;var n=this.getCloudPath(t);if(!this.bucketId)throw new a("bucketId is not set");var r=(null===(e=this.config)||void 0===e?void 0:e.env)||"";return r?"cloud://".concat(r,".").concat(this.bucketId,"/").concat(n):void 0},t.prototype.toBase64=function(t){return d(t)},t.prototype.transformOptsToQueryString=function(t){var e=["imageMogr2"];if(t.width||t.height){var n=t.width||"",r=t.height||"";"fill"===t.resize?e.push("thumbnail/".concat(n,"x").concat(r,"!")):"contain"===t.resize?e.push("thumbnail/".concat(n,"x").concat(r)):e.push("thumbnail/".concat(n,"x").concat(r,"^"))}if(t.format&&"origin"!==t.format&&e.push("format/".concat(t.format)),void 0!==t.quality){var o=Math.max(1,Math.min(100,t.quality));e.push("quality/".concat(o))}return e.join("/")},t.prototype.extractPathFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");return e.length<2?t:e.slice(1).join("/")},t.prototype.extractBucketFromFileId=function(t){var e=t.replace(/^cloud:\/\//,"").split("/");if(e.length<1)return"";var n=e[0],r=n.indexOf(".");return-1===r?n:n.substring(r+1)},t}(),Rt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ct=new Tt,At={name:bt,entity:{uploadFile:Ct.uploadFile,deleteFile:Ct.deleteFile,getTempFileURL:Ct.getTempFileURL,downloadFile:Ct.downloadFile,getUploadMetadata:Ct.getUploadMetadata,copyFile:Ct.copyFile,getFileInfo:Ct.getFileInfo,isGateWay:Ct.isGateWay}},kt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Rt(e,t),e.prototype.from=function(t){return t?(U(t,"from"),new j(this.http,t,this.shouldThrowOnError)):new Ut(this.http.ctx,this.shouldThrowOnError)},e}(A),Nt={name:"".concat(bt,"/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,n=new Proxy({},{get:function(t,n){return"config"===n?e.config:"request"===n?e.request:void 0}}),r=new kt(n);return t.set(this,r),r},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(At),cloudbase.registerComponent(Nt)}catch(t){}function Dt(t){try{t.registerComponent(At),t.registerComponent(Nt)}catch(t){console.warn(t)}}try{window.registerStorage=Dt}catch(t){}var qt=Dt})();var a=i.v;export{a as registerStorage};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|