buckyos 0.7.133 → 0.7.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/cli/dist/cli.mjs +1 -1
  2. package/cli/dist/cli.mjs.map +1 -1
  3. package/cli/version.ts +1 -1
  4. package/dist/account.d.ts +11 -0
  5. package/dist/account.d.ts.map +1 -1
  6. package/dist/browser.cjs +1 -1
  7. package/dist/browser.cjs.map +1 -1
  8. package/dist/browser.d.ts +2 -0
  9. package/dist/browser.d.ts.map +1 -1
  10. package/dist/browser.mjs +166 -143
  11. package/dist/browser.mjs.map +1 -1
  12. package/dist/hybrid_sso.d.ts +110 -0
  13. package/dist/hybrid_sso.d.ts.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.mjs +166 -143
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/krpc_client.d.ts +7 -1
  21. package/dist/krpc_client.d.ts.map +1 -1
  22. package/dist/msg_center_client.d.ts +13 -1
  23. package/dist/msg_center_client.d.ts.map +1 -1
  24. package/dist/ndm_client.d.ts +6 -0
  25. package/dist/ndm_client.d.ts.map +1 -1
  26. package/dist/ndm_proxy-7cf15839.js +13 -0
  27. package/dist/ndm_proxy-7cf15839.js.map +1 -0
  28. package/dist/{ndm_proxy-501cb1e8.mjs → ndm_proxy-b5c95488.mjs} +360 -170
  29. package/dist/ndm_proxy-b5c95488.mjs.map +1 -0
  30. package/dist/ndn_types-324121ae.js +2 -0
  31. package/dist/ndn_types-324121ae.js.map +1 -0
  32. package/dist/{ndn_types-d768245f.mjs → ndn_types-ac9c1e48.mjs} +64 -38
  33. package/dist/ndn_types-ac9c1e48.mjs.map +1 -0
  34. package/dist/node.cjs +1 -1
  35. package/dist/node.cjs.map +1 -1
  36. package/dist/node.d.ts +2 -0
  37. package/dist/node.d.ts.map +1 -1
  38. package/dist/node.mjs +166 -143
  39. package/dist/node.mjs.map +1 -1
  40. package/dist/provision.cjs +1 -1
  41. package/dist/provision.mjs +1 -1
  42. package/dist/runtime.d.ts +30 -1
  43. package/dist/runtime.d.ts.map +1 -1
  44. package/dist/sdk_core.d.ts +14 -1
  45. package/dist/sdk_core.d.ts.map +1 -1
  46. package/dist/{tus_client-b1c35e8c.mjs → tus_client-19baa342.mjs} +2 -2
  47. package/dist/{tus_client-b1c35e8c.mjs.map → tus_client-19baa342.mjs.map} +1 -1
  48. package/dist/{tus_client-d0798623.js → tus_client-2b915a81.js} +2 -2
  49. package/dist/{tus_client-d0798623.js.map → tus_client-2b915a81.js.map} +1 -1
  50. package/dist/verify-hub-client.d.ts +1 -0
  51. package/dist/verify-hub-client.d.ts.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/ndm_proxy-501cb1e8.mjs.map +0 -1
  54. package/dist/ndm_proxy-68b8160c.js +0 -13
  55. package/dist/ndm_proxy-68b8160c.js.map +0 -1
  56. package/dist/ndn_types-44c69036.js +0 -2
  57. package/dist/ndn_types-44c69036.js.map +0 -1
  58. package/dist/ndn_types-d768245f.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./ndn_types-44c69036.js");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function o(t,r,n){return r=l(r),function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,a()?Reflect.construct(r,n||[],l(t).constructor):r.apply(t,n))}function i(t){var e="function"==typeof Map?new Map:void 0;return i=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(a())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&u(o,r.prototype),o}(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,t)},i(t)}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(a=function(){return!!t})()}function u(t,e){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}const s=function(){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(r=o(this,t,[e])).originalRequest=i,r.originalResponse=a,r.causingError=n,null!=n&&(e+=", caused by ".concat(n.toString())),null!=i){var u=i.getHeader("X-Request-ID")||"n/a",l=i.getMethod(),s=i.getURL(),c=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";e+=", originated from request (method: ".concat(l,", url: ").concat(s,", response code: ").concat(c,", response text: ").concat(f,", request id: ").concat(u,")")}return r.message=e,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(t,i(Error)),e=t,n&&r(e.prototype,n),a&&r(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,a}();var c=!1;function f(t){c&&console.log(t)}function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,d(n.key),n)}}function d(t){var e=function(t,e){if("object"!=p(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==p(e)?e:e+""}var y=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,e){return Promise.resolve(null)}}])&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();const v="function"==typeof Buffer,m=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),b=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),g=(()=>{let t={};return b.forEach(((e,r)=>t[e]=r)),t})(),w=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_=String.fromCharCode.bind(String),S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_"))),U=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),E=t=>{let e,r,n,o,i="";const a=t.length%3;for(let u=0;u<t.length;){if((r=t.charCodeAt(u++))>255||(n=t.charCodeAt(u++))>255||(o=t.charCodeAt(u++))>255)throw new TypeError("invalid character found");e=r<<16|n<<8|o,i+=b[e>>18&63]+b[e>>12&63]+b[e>>6&63]+b[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},O="function"==typeof btoa?t=>btoa(t):v?t=>Buffer.from(t,"binary").toString("base64"):E,x=v?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let r=0,n=t.length;r<n;r+=4096)e.push(_.apply(null,t.subarray(r,r+4096)));return O(e.join(""))},P=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?_(192|e>>>6)+_(128|63&e):_(224|e>>>12&15)+_(128|e>>>6&63)+_(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return _(240|e>>>18&7)+_(128|e>>>12&63)+_(128|e>>>6&63)+_(128|63&e)},j=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,k=t=>t.replace(j,P),R=v?t=>Buffer.from(t,"utf8").toString("base64"):m?t=>x(m.encode(t)):t=>O(k(t)),L=(t,e=!1)=>e?S(R(t)):R(t),T=t=>{if(t=t.replace(/\s+/g,""),!w.test(t))throw new TypeError("malformed base64.");let e,r,n;t+="==".slice(2-(3&t.length));let o=[];for(let i=0;i<t.length;)e=g[t.charAt(i++)]<<18|g[t.charAt(i++)]<<12|(r=g[t.charAt(i++)])<<6|(n=g[t.charAt(i++)]),64===r?o.push(_(e>>16&255)):64===n?o.push(_(e>>16&255,e>>8&255)):o.push(_(e>>16&255,e>>8&255,255&e));return o.join("")},C=L;var A={},D=Object.prototype.hasOwnProperty;function N(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return null}}function z(t){try{return encodeURIComponent(t)}catch(e){return null}}A.stringify=function(t,e){e=e||"";var r,n,o=[];for(n in"string"!=typeof e&&(e="?"),t)if(D.call(t,n)){if((r=t[n])||null!=r&&!isNaN(r)||(r=""),n=z(n),r=z(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?e+o.join("&"):""},A.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var o=N(e[1]),i=N(e[2]);null===o||null===i||o in n||(n[o]=i)}return n};var I=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},H=A,q=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,F=/[\n\r\t]/g,B=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,G=/:\d+$/,M=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,K=/^[a-zA-Z]:/;function X(t){return(t||"").toString().replace(q,"")}var Y=[["#","hash"],["?","query"],function(t,e){return J(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Z={hash:1,query:1};function V(e){var r,n=("undefined"!=typeof window?window:void 0!==t.commonjsGlobal?t.commonjsGlobal:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(e=e||n);if("blob:"===e.protocol)o=new Q(unescape(e.pathname),{});else if("string"===i)for(r in o=new Q(e,{}),Z)delete o[r];else if("object"===i){for(r in e)r in Z||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=B.test(e.href))}return o}function J(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function $(t,e){t=(t=X(t)).replace(F,""),e=e||{};var r,n=M.exec(t),o=n[1]?n[1].toLowerCase():"",i=!!n[2],a=!!n[3],u=0;return i?a?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):a?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):J(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&J(e.protocol)&&(r=n[4]),{protocol:o,slashes:i||J(o),slashesCount:u,rest:r}}function Q(t,e,r){if(t=(t=X(t)).replace(F,""),!(this instanceof Q))return new Q(t,e,r);var n,o,i,a,u,l,s=Y.slice(),c=typeof e,f=this,p=0;for("object"!==c&&"string"!==c&&(r=e,e=null),r&&"function"!=typeof r&&(r=H.parse),n=!(o=$(t||"",e=V(e))).protocol&&!o.slashes,f.slashes=o.slashes||n&&e.slashes,f.protocol=o.protocol||e.protocol||"",t=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||K.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!J(f.protocol)))&&(s[3]=[/(.*)/,"pathname"]);p<s.length;p++)"function"!=typeof(a=s[p])?(i=a[0],l=a[1],i!=i?f[l]=t:"string"==typeof i?~(u="@"===i?t.lastIndexOf(i):t.indexOf(i))&&("number"==typeof a[2]?(f[l]=t.slice(0,u),t=t.slice(u+a[2])):(f[l]=t.slice(u),t=t.slice(0,u))):(u=i.exec(t))&&(f[l]=u[1],t=t.slice(0,u.index)),f[l]=f[l]||n&&a[3]&&e[l]||"",a[4]&&(f[l]=f[l].toLowerCase())):t=a(t,f);r&&(f.query=r(f.query)),n&&e.slashes&&"/"!==f.pathname.charAt(0)&&(""!==f.pathname||""!==e.pathname)&&(f.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),a++):a&&(0===n&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(f.pathname,e.pathname)),"/"!==f.pathname.charAt(0)&&J(f.protocol)&&(f.pathname="/"+f.pathname),I(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(~(u=f.auth.indexOf(":"))?(f.username=f.auth.slice(0,u),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(u+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin="file:"!==f.protocol&&J(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}Q.prototype={set:function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||H.parse)(e)),n[t]=e;break;case"port":n[t]=e,I(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,G.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o="pathname"===t?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var i=e.indexOf(":");~i?(n.username=e.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<Y.length;a++){var u=Y[a];u[4]&&(n[u[1]]=n[u[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&J(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(t){t&&"function"==typeof t||(t=H.stringify);var e,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var i=o+(r.protocol&&r.slashes||J(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):"file:"!==r.protocol&&J(r.protocol)&&!n&&"/"!==r.pathname&&(i+="@"),(":"===n[n.length-1]||G.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(i+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(i+=r.hash),i}},Q.extractProtocol=$,Q.location=V,Q.trimLeft=X,Q.qs=H;var W=Q;const tt=t.getDefaultExportFromCjs(W);function et(){
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./ndn_types-324121ae.js");function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function o(t,r,n){return r=l(r),function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,a()?Reflect.construct(r,n||[],l(t).constructor):r.apply(t,n))}function i(t){var e="function"==typeof Map?new Map:void 0;return i=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(a())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&u(o,r.prototype),o}(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,t)},i(t)}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(a=function(){return!!t})()}function u(t,e){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}const s=function(){function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),(r=o(this,t,[e])).originalRequest=i,r.originalResponse=a,r.causingError=n,null!=n&&(e+=", caused by ".concat(n.toString())),null!=i){var u=i.getHeader("X-Request-ID")||"n/a",l=i.getMethod(),s=i.getURL(),c=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";e+=", originated from request (method: ".concat(l,", url: ").concat(s,", response code: ").concat(c,", response text: ").concat(f,", request id: ").concat(u,")")}return r.message=e,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(t,i(Error)),e=t,n&&r(e.prototype,n),a&&r(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,a}();var c=!1;function f(t){c&&console.log(t)}function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,d(n.key),n)}}function d(t){var e=function(t,e){if("object"!=p(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==p(e)?e:e+""}var y=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(t){return Promise.resolve([])}},{key:"removeUpload",value:function(t){return Promise.resolve()}},{key:"addUpload",value:function(t,e){return Promise.resolve(null)}}])&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();const v="function"==typeof Buffer,m=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder?new TextEncoder:void 0),b=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),g=(()=>{let t={};return b.forEach(((e,r)=>t[e]=r)),t})(),w=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_=String.fromCharCode.bind(String),S=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),t=>t.replace(/=/g,"").replace(/[+\/]/g,(t=>"+"==t?"-":"_"))),U=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),E=t=>{let e,r,n,o,i="";const a=t.length%3;for(let u=0;u<t.length;){if((r=t.charCodeAt(u++))>255||(n=t.charCodeAt(u++))>255||(o=t.charCodeAt(u++))>255)throw new TypeError("invalid character found");e=r<<16|n<<8|o,i+=b[e>>18&63]+b[e>>12&63]+b[e>>6&63]+b[63&e]}return a?i.slice(0,a-3)+"===".substring(a):i},O="function"==typeof btoa?t=>btoa(t):v?t=>Buffer.from(t,"binary").toString("base64"):E,x=v?t=>Buffer.from(t).toString("base64"):t=>{let e=[];for(let r=0,n=t.length;r<n;r+=4096)e.push(_.apply(null,t.subarray(r,r+4096)));return O(e.join(""))},P=t=>{if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?_(192|e>>>6)+_(128|63&e):_(224|e>>>12&15)+_(128|e>>>6&63)+_(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return _(240|e>>>18&7)+_(128|e>>>12&63)+_(128|e>>>6&63)+_(128|63&e)},j=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,k=t=>t.replace(j,P),R=v?t=>Buffer.from(t,"utf8").toString("base64"):m?t=>x(m.encode(t)):t=>O(k(t)),L=(t,e=!1)=>e?S(R(t)):R(t),T=t=>{if(t=t.replace(/\s+/g,""),!w.test(t))throw new TypeError("malformed base64.");let e,r,n;t+="==".slice(2-(3&t.length));let o=[];for(let i=0;i<t.length;)e=g[t.charAt(i++)]<<18|g[t.charAt(i++)]<<12|(r=g[t.charAt(i++)])<<6|(n=g[t.charAt(i++)]),64===r?o.push(_(e>>16&255)):64===n?o.push(_(e>>16&255,e>>8&255)):o.push(_(e>>16&255,e>>8&255,255&e));return o.join("")},C=L;var A={},D=Object.prototype.hasOwnProperty;function N(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return null}}function z(t){try{return encodeURIComponent(t)}catch(e){return null}}A.stringify=function(t,e){e=e||"";var r,n,o=[];for(n in"string"!=typeof e&&(e="?"),t)if(D.call(t,n)){if((r=t[n])||null!=r&&!isNaN(r)||(r=""),n=z(n),r=z(r),null===n||null===r)continue;o.push(n+"="+r)}return o.length?e+o.join("&"):""},A.parse=function(t){for(var e,r=/([^=?#&]+)=?([^&]*)/g,n={};e=r.exec(t);){var o=N(e[1]),i=N(e[2]);null===o||null===i||o in n||(n[o]=i)}return n};var I=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t},H=A,q=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,F=/[\n\r\t]/g,B=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,G=/:\d+$/,M=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,K=/^[a-zA-Z]:/;function X(t){return(t||"").toString().replace(q,"")}var Y=[["#","hash"],["?","query"],function(t,e){return J(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Z={hash:1,query:1};function V(e){var r,n=("undefined"!=typeof window?window:void 0!==t.commonjsGlobal?t.commonjsGlobal:"undefined"!=typeof self?self:{}).location||{},o={},i=typeof(e=e||n);if("blob:"===e.protocol)o=new Q(unescape(e.pathname),{});else if("string"===i)for(r in o=new Q(e,{}),Z)delete o[r];else if("object"===i){for(r in e)r in Z||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=B.test(e.href))}return o}function J(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function $(t,e){t=(t=X(t)).replace(F,""),e=e||{};var r,n=M.exec(t),o=n[1]?n[1].toLowerCase():"",i=!!n[2],a=!!n[3],u=0;return i?a?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):a?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):J(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&J(e.protocol)&&(r=n[4]),{protocol:o,slashes:i||J(o),slashesCount:u,rest:r}}function Q(t,e,r){if(t=(t=X(t)).replace(F,""),!(this instanceof Q))return new Q(t,e,r);var n,o,i,a,u,l,s=Y.slice(),c=typeof e,f=this,p=0;for("object"!==c&&"string"!==c&&(r=e,e=null),r&&"function"!=typeof r&&(r=H.parse),n=!(o=$(t||"",e=V(e))).protocol&&!o.slashes,f.slashes=o.slashes||n&&e.slashes,f.protocol=o.protocol||e.protocol||"",t=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||K.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!J(f.protocol)))&&(s[3]=[/(.*)/,"pathname"]);p<s.length;p++)"function"!=typeof(a=s[p])?(i=a[0],l=a[1],i!=i?f[l]=t:"string"==typeof i?~(u="@"===i?t.lastIndexOf(i):t.indexOf(i))&&("number"==typeof a[2]?(f[l]=t.slice(0,u),t=t.slice(u+a[2])):(f[l]=t.slice(u),t=t.slice(0,u))):(u=i.exec(t))&&(f[l]=u[1],t=t.slice(0,u.index)),f[l]=f[l]||n&&a[3]&&e[l]||"",a[4]&&(f[l]=f[l].toLowerCase())):t=a(t,f);r&&(f.query=r(f.query)),n&&e.slashes&&"/"!==f.pathname.charAt(0)&&(""!==f.pathname||""!==e.pathname)&&(f.pathname=function(t,e){if(""===t)return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),a++):a&&(0===n&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(f.pathname,e.pathname)),"/"!==f.pathname.charAt(0)&&J(f.protocol)&&(f.pathname="/"+f.pathname),I(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(~(u=f.auth.indexOf(":"))?(f.username=f.auth.slice(0,u),f.username=encodeURIComponent(decodeURIComponent(f.username)),f.password=f.auth.slice(u+1),f.password=encodeURIComponent(decodeURIComponent(f.password))):f.username=encodeURIComponent(decodeURIComponent(f.auth)),f.auth=f.password?f.username+":"+f.password:f.username),f.origin="file:"!==f.protocol&&J(f.protocol)&&f.host?f.protocol+"//"+f.host:"null",f.href=f.toString()}Q.prototype={set:function(t,e,r){var n=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(r||H.parse)(e)),n[t]=e;break;case"port":n[t]=e,I(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,G.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o="pathname"===t?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var i=e.indexOf(":");~i?(n.username=e.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<Y.length;a++){var u=Y[a];u[4]&&(n[u[1]]=n[u[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin="file:"!==n.protocol&&J(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n},toString:function(t){t&&"function"==typeof t||(t=H.stringify);var e,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var i=o+(r.protocol&&r.slashes||J(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):"file:"!==r.protocol&&J(r.protocol)&&!n&&"/"!==r.pathname&&(i+="@"),(":"===n[n.length-1]||G.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,(e="object"==typeof r.query?t(r.query):r.query)&&(i+="?"!==e.charAt(0)?"?"+e:e),r.hash&&(i+=r.hash),i}},Q.extractProtocol=$,Q.location=V,Q.trimLeft=X,Q.qs=H;var W=Q;const tt=t.getDefaultExportFromCjs(W);function et(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
3
3
  et=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(T){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),u=new R(n||[]);return o(a,"_invoke",{value:x(t,r,u)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(n){return{type:"throw",arg:n}}}e.wrap=c;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function b(){}function g(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(L([])));S&&S!==r&&n.call(S,a)&&(w=S);var U=g.prototype=m.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"==ot(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(c).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var l=P(u,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?y:h,s.arg===v)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(ot(e)+" is not iterable")}return b.prototype=g,o(U,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=s(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,l,"GeneratorFunction")),t.prototype=Object.create(U),t},e.awrap=function(t){return{__await:t}},E(O.prototype),s(O.prototype,u,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(U),s(U,l,"Generator"),s(U,a,(function(){return this})),s(U,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=L,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function rt(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(s){return void r(s)}u.done?e(l):Promise.resolve(l).then(n,o)}function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(c){s=!0,o=c}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||it(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ot(t){return(ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function it(t,e){if(t){if("string"==typeof t)return at(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?at(t,e):void 0}}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function lt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach((function(e){st(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function st(t,e,r){return(e=ft(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ct(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ft(n.key),n)}}function ft(t){var e=function(t,e){if("object"!=ot(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==ot(e)?e:e+""}var pt="tus-v1",ht="ietf-draft-03",dt="ietf-draft-05",yt={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Ut,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:pt},vt=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return e=t,r=[{key:"findPreviousUploads",value:function(){var t=this;return this.options.fingerprint(this.file,this.options).then((function(e){return t._urlStorage.findUploadsByFingerprint(e)}))}},{key:"resumeFromPreviousUpload",value:function(t){this.url=t.uploadUrl||null,this._parallelUploadUrls=t.parallelUploadUrls||null,this._urlStorageKey=t.urlStorageKey}},{key:"start",value:function(){var t=this,e=this.file;if(e)if([pt,ht,dt].includes(this.options.protocol))if(this.options.endpoint||this.options.uploadUrl||this.url){var r=this.options.retryDelays;if(null==r||"[object Array]"===Object.prototype.toString.call(r)){if(this.options.parallelUploads>1)for(var n=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];n<o.length;n++){var i=o[n];if(this.options[i])return void this._emitError(new Error("tus: cannot use the ".concat(i," option when parallelUploads is enabled")))}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1)return void this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length)return void this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"))}this.options.fingerprint(e,this.options).then((function(r){return f(null==r?"No fingerprint was calculated meaning that the upload cannot be stored in the URL storage.":"Calculated fingerprint: ".concat(r)),t._fingerprint=r,t._source?t._source:t.options.fileReader.openFile(e,t.options.chunkSize)})).then((function(e){if(t._source=e,t.options.uploadLengthDeferred)t._size=null;else if(null!=t.options.uploadSize){if(t._size=Number(t.options.uploadSize),Number.isNaN(t._size))return void t._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(t._size=t._source.size,null==t._size)return void t._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));t.options.parallelUploads>1||null!=t._parallelUploadUrls?t._startParallelUpload():t._startSingleUpload()})).catch((function(e){t._emitError(e)}))}else this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var e,r=this,n=this._size,o=0;this._parallelUploads=[];var i=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,a=null!==(e=this.options.parallelUploadBoundaries)&&void 0!==e?e:function(t,e){for(var r=Math.floor(t/e),n=[],o=0;o<e;o++)n.push({start:r*o,end:r*(o+1)});return n[e-1].end=t,n}(this._source.size,i);this._parallelUploadUrls&&a.forEach((function(t,e){t.uploadUrl=r._parallelUploadUrls[e]||null})),this._parallelUploadUrls=new Array(a.length);var u,l=a.map((function(e,i){var u=0;return r._source.slice(e.start,e.end).then((function(l){var s=l.value;return new Promise((function(l,c){var f=lt(lt({},r.options),{},{uploadUrl:e.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:r.options.metadataForPartialUploads,headers:lt(lt({},r.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:l,onError:c,onProgress:function(t){o=o-u+t,u=t,r._emitProgress(o,n)},onUploadUrlAvailable:function(){r._parallelUploadUrls[i]=p.url,r._parallelUploadUrls.filter((function(t){return Boolean(t)})).length===a.length&&r._saveUploadInUrlStorage()}}),p=new t(s,f);p.start(),r._parallelUploads.push(p)}))}))}));Promise.all(l).then((function(){(u=r._openRequest("POST",r.options.endpoint)).setHeader("Upload-Concat","final;".concat(r._parallelUploadUrls.join(" ")));var t=mt(r.options.metadata);return""!==t&&u.setHeader("Upload-Metadata",t),r._sendRequest(u,null)})).then((function(t){if(bt(t.getStatus(),200)){var e=t.getHeader("Location");null!=e?(r.url=Et(r.options.endpoint,e),f("Created upload at ".concat(r.url)),r._emitSuccess(t)):r._emitHttpError(u,t,"tus: invalid or missing Location header")}else r._emitHttpError(u,t,"tus: unexpected response while creating upload")})).catch((function(t){r._emitError(t)}))}},{key:"_startSingleUpload",value:function(){return this._aborted=!1,null!=this.url?(f("Resuming upload from previous URL: ".concat(this.url)),void this._resumeUpload()):null!=this.options.uploadUrl?(f("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,void this._resumeUpload()):(f("Creating a new upload"),void this._createUpload())}},{key:"abort",value:function(e){var r=this;if(null!=this._parallelUploads){var n,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=it(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(this._parallelUploads);try{for(o.s();!(n=o.n()).done;)n.value.abort(e)}catch(i){o.e(i)}finally{o.f()}}return null!==this._req&&this._req.abort(),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),e&&null!=this.url?t.terminate(this.url,this.options).then((function(){return r._removeFromUrlStorage()})):Promise.resolve()}},{key:"_emitHttpError",value:function(t,e,r,n){this._emitError(new s(r,n,t,e))}},{key:"_emitError",value:function(t){var e=this;if(!this._aborted){if(null!=this.options.retryDelays&&(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),St(t,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){e.start()}),r))}if("function"!=typeof this.options.onError)throw t;this.options.onError(t)}}},{key:"_emitSuccess",value:function(t){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess({lastResponse:t})}},{key:"_emitProgress",value:function(t,e){"function"==typeof this.options.onProgress&&this.options.onProgress(t,e)}},{key:"_emitChunkComplete",value:function(t,e,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(t,e,r)}},{key:"_createUpload",value:function(){var t=this;if(this.options.endpoint){var e=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?e.setHeader("Upload-Defer-Length","1"):e.setHeader("Upload-Length","".concat(this._size));var r,n=mt(this.options.metadata);""!==n&&e.setHeader("Upload-Metadata",n),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(e)):(this.options.protocol!==ht&&this.options.protocol!==dt||e.setHeader("Upload-Complete","?0"),r=this._sendRequest(e,null)),r.then((function(r){if(bt(r.getStatus(),200)){var n=r.getHeader("Location");if(null!=n){if(t.url=Et(t.options.endpoint,n),f("Created upload at ".concat(t.url)),"function"==typeof t.options.onUploadUrlAvailable&&t.options.onUploadUrlAvailable(),0===t._size)return t._emitSuccess(r),void t._source.close();t._saveUploadInUrlStorage().then((function(){t.options.uploadDataDuringCreation?t._handleUploadResponse(e,r):(t._offset=0,t._performUpload())}))}else t._emitHttpError(e,r,"tus: invalid or missing Location header")}else t._emitHttpError(e,r,"tus: unexpected response while creating upload")})).catch((function(r){t._emitHttpError(e,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var t=this,e=this._openRequest("HEAD",this.url);this._sendRequest(e,null).then((function(r){var n=r.getStatus();if(!bt(n,200))return 423===n?void t._emitHttpError(e,r,"tus: upload is currently locked; retry later"):(bt(n,400)&&t._removeFromUrlStorage(),t.options.endpoint?(t.url=null,void t._createUpload()):void t._emitHttpError(e,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)"));var o=Number.parseInt(r.getHeader("Upload-Offset"),10);if(Number.isNaN(o))t._emitHttpError(e,r,"tus: invalid or missing offset value");else{var i=Number.parseInt(r.getHeader("Upload-Length"),10);!Number.isNaN(i)||t.options.uploadLengthDeferred||t.options.protocol!==pt?("function"==typeof t.options.onUploadUrlAvailable&&t.options.onUploadUrlAvailable(),t._saveUploadInUrlStorage().then((function(){if(o===i)return t._emitProgress(i,i),void t._emitSuccess(r);t._offset=o,t._performUpload()}))):t._emitHttpError(e,r,"tus: invalid or missing length value")}})).catch((function(r){t._emitHttpError(e,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var t,e=this;this._aborted||(this.options.overridePatchMethod?(t=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):t=this._openRequest("PATCH",this.url),t.setHeader("Upload-Offset","".concat(this._offset)),this._addChunkToRequest(t).then((function(r){bt(r.getStatus(),200)?e._handleUploadResponse(t,r):e._emitHttpError(t,r,"tus: unexpected response while uploading chunk")})).catch((function(r){e._aborted||e._emitHttpError(t,null,"tus: failed to upload chunk at offset ".concat(e._offset),r)})))}},{key:"_addChunkToRequest",value:function(t){var e=this,r=this._offset,n=this._offset+this.options.chunkSize;return t.setProgressHandler((function(t){e._emitProgress(r+t,e._size)})),this.options.protocol===pt?t.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===dt&&t.setHeader("Content-Type","application/partial-upload"),(n===Number.POSITIVE_INFINITY||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n).then((function(r){var n=r.value,o=r.done,i=null!=n&&n.size?n.size:0;e.options.uploadLengthDeferred&&o&&(e._size=e._offset+i,t.setHeader("Upload-Length","".concat(e._size)));var a=e._offset+i;return!e.options.uploadLengthDeferred&&o&&a!==e._size?Promise.reject(new Error("upload was configured with a size of ".concat(e._size," bytes, but the source is done after ").concat(a," bytes"))):null===n?e._sendRequest(t):(e.options.protocol!==ht&&e.options.protocol!==dt||t.setHeader("Upload-Complete",o?"?1":"?0"),e._emitProgress(e._offset,e._size),e._sendRequest(t,n))}))}},{key:"_handleUploadResponse",value:function(t,e){var r=Number.parseInt(e.getHeader("Upload-Offset"),10);if(Number.isNaN(r))this._emitHttpError(t,e,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r===this._size)return this._emitSuccess(e),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(t,e){var r=gt(t,e,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(e){t._emitError(e)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||null!==this._urlStorageKey)return Promise.resolve();var e={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};return this._parallelUploads?e.parallelUploadUrls=this._parallelUploadUrls:e.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,e).then((function(e){t._urlStorageKey=e}))}},{key:"_sendRequest",value:function(t){return wt(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,this.options)}}],n=[{key:"terminate",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=gt("DELETE",e,r);return wt(n,null,r).then((function(t){if(204!==t.getStatus())throw new s("tus: unexpected response while terminating upload",null,n,t)})).catch((function(o){if(o instanceof s||(o=new s("tus: failed to terminate upload",o,n,null)),!St(o,0,r))throw o;var i=r.retryDelays[0],a=r.retryDelays.slice(1),u=lt(lt({},r),{},{retryDelays:a});return new Promise((function(t){return setTimeout(t,i)})).then((function(){return t.terminate(e,u)}))}))}}],r&&ct(e.prototype,r),n&&ct(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}();function mt(t){return Object.entries(t).map((function(t){var e=nt(t,2),r=e[0],n=e[1];return"".concat(r," ").concat(C(String(n)))})).join(",")}function bt(t,e){return t>=e&&t<e+100}function gt(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===ht?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===dt?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,a=Object.entries(o);i<a.length;i++){var u=nt(a[i],2),l=u[0],s=u[1];n.setHeader(l,s)}if(r.addRequestId){var c="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));n.setHeader("X-Request-ID",c)}return n}function wt(t,e,r){return _t.apply(this,arguments)}function _t(){var t;return t=et().mark((function t(e,r,n){var o;return et().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"!=typeof n.onBeforeRequest){t.next=3;break}return t.next=3,n.onBeforeRequest(e);case 3:return t.next=5,e.send(r);case 5:if(o=t.sent,"function"!=typeof n.onAfterResponse){t.next=9;break}return t.next=9,n.onAfterResponse(e,o);case 9:return t.abrupt("return",o);case 10:case"end":return t.stop()}}),t)})),_t=function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){rt(i,n,o,a,u,"next",t)}function u(t){rt(i,n,o,a,u,"throw",t)}a(void 0)}))},_t.apply(this,arguments)}function St(t,e,r){return!(null==r.retryDelays||e>=r.retryDelays.length||null==t.originalRequest)&&(r&&"function"==typeof r.onShouldRetry?r.onShouldRetry(t,e,r):Ut(t))}function Ut(t){var e,r=t.originalResponse?t.originalResponse.getStatus():0;return(!bt(r,400)||409===r||423===r)&&(e=!0,"undefined"!=typeof navigator&&!1===navigator.onLine&&(e=!1),e)}function Et(t,e){return new tt(e,t).toString()}vt.defaultOptions=yt;var Ot=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};function xt(t){return new Promise((function(e,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=n.response;e(t)},n.onerror=function(t){r(t)},n.open("GET",t),n.send()}))}function Pt(t){return(Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kt(n.key),n)}}function kt(t){var e=function(t,e){if("object"!=Pt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Pt(e)?e:e+""}var Rt=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._file=e,this.size=e.size},(e=[{key:"slice",value:function(t,e){if("undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova))return r=this._file.slice(t,e),new Promise((function(t,e){var n=new FileReader;n.onload=function(){var e=new Uint8Array(n.result);t({value:e})},n.onerror=function(t){e(t)},n.readAsArrayBuffer(r)}));var r,n=this._file.slice(t,e),o=e>=this.size;return Promise.resolve({value:n,done:o})}},{key:"close",value:function(){}}])&&jt(t.prototype,e),r&&jt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Lt(t){return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Tt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ct(n.key),n)}}function Ct(t){var e=function(t,e){if("object"!=Lt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Lt(e)?e:e+""}function At(t){return void 0===t?0:void 0!==t.size?t.size:t.length}var Dt=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._buffer=void 0,this._bufferOffset=0,this._reader=e,this._done=!1},(e=[{key:"slice",value:function(t,e){return t<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(t,e)}},{key:"_readUntilEnoughDataOrDone",value:function(t,e){var r=this,n=e<=this._bufferOffset+At(this._buffer);if(this._done||n){var o=this._getDataFromBuffer(t,e),i=null==o&&this._done;return Promise.resolve({value:o,done:i})}return this._reader.read().then((function(n){var o=n.value;return n.done?r._done=!0:void 0===r._buffer?r._buffer=o:r._buffer=function(t,e){if(t.concat)return t.concat(e);if(t instanceof Blob)return new Blob([t,e],{type:t.type});if(t.set){var r=new t.constructor(t.length+e.length);return r.set(t),r.set(e,t.length),r}throw new Error("Unknown data type")}(r._buffer,o),r._readUntilEnoughDataOrDone(t,e)}))}},{key:"_getDataFromBuffer",value:function(t,e){t>this._bufferOffset&&(this._buffer=this._buffer.slice(t-this._bufferOffset),this._bufferOffset=t);var r=0===At(this._buffer);return this._done&&r?null:this._buffer.slice(0,e-t)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])&&Tt(t.prototype,e),r&&Tt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function Nt(t){return(Nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zt(){
4
4
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
5
5
  zt=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(T){s=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),u=new R(n||[]);return o(a,"_invoke",{value:x(t,r,u)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(n){return{type:"throw",arg:n}}}e.wrap=c;var p="suspendedStart",h="suspendedYield",d="executing",y="completed",v={};function m(){}function b(){}function g(){}var w={};s(w,a,(function(){return this}));var _=Object.getPrototypeOf,S=_&&_(_(L([])));S&&S!==r&&n.call(S,a)&&(w=S);var U=g.prototype=m.prototype=Object.create(w);function E(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,i,a,u){var l=f(t[o],t,i);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"==Nt(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(c).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(l.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function x(e,r,n){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var l=P(u,n);if(l){if(l===v)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=f(e,r,n);if("normal"===s.type){if(o=n.done?y:h,s.arg===v)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),v;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(Nt(e)+" is not iterable")}return b.prototype=g,o(U,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=s(g,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,s(t,l,"GeneratorFunction")),t.prototype=Object.create(U),t},e.awrap=function(t){return{__await:t}},E(O.prototype),s(O.prototype,u,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(U),s(U,l,"Generator"),s(U,a,(function(){return this})),s(U,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=L,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(l&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}function It(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(s){return void r(s)}u.done?e(l):Promise.resolve(l).then(n,o)}function Ht(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,qt(n.key),n)}}function qt(t){var e=function(t,e){if("object"!=Nt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Nt(e)?e:e+""}var Ft=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"openFile",value:(n=zt().mark((function t(e,r){var n;return zt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!Ot()||!e||void 0===e.uri){t.next=11;break}return t.prev=1,t.next=4,xt(e.uri);case 4:return n=t.sent,t.abrupt("return",new Rt(n));case 8:throw t.prev=8,t.t0=t.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(t.t0));case 11:if("function"!=typeof e.slice||void 0===e.size){t.next=13;break}return t.abrupt("return",Promise.resolve(new Rt(e)));case 13:if("function"!=typeof e.read){t.next=18;break}if(r=Number(r),Number.isFinite(r)){t.next=17;break}return t.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return t.abrupt("return",Promise.resolve(new Dt(e,r)));case 18:return t.abrupt("return",Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment")));case 19:case"end":return t.stop()}}),t,null,[[1,8]])})),o=function(){var t=this,e=arguments;return new Promise((function(r,o){var i=n.apply(t,e);function a(t){It(i,r,o,a,u,"next",t)}function u(t){It(i,r,o,a,u,"throw",t)}a(void 0)}))},function(t,e){return o.apply(this,arguments)})}],e&&Ht(t.prototype,e),r&&Ht(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,n,o}();function Bt(t){return(Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Gt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Xt(n.key),n)}}function Kt(t,e,r){return e&&Mt(t.prototype,e),r&&Mt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xt(t){var e=function(t,e){if("object"!=Bt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bt(e)?e:e+""}var Yt=function(){return Kt((function t(){Gt(this,t)}),[{key:"createRequest",value:function(t,e){return new Zt(t,e)}},{key:"getName",value:function(){return"XHRHttpStack"}}])}(),Zt=function(){return Kt((function t(e,r){Gt(this,t),this._xhr=new XMLHttpRequest,this._xhr.open(e,r,!0),this._method=e,this._url=r,this._headers={}}),[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(t,e){this._xhr.setRequestHeader(t,e),this._headers[t]=e}},{key:"getHeader",value:function(t){return this._headers[t]}},{key:"setProgressHandler",value:function(t){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(e){e.lengthComputable&&t(e.loaded)})}},{key:"send",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,n){t._xhr.onload=function(){r(new Vt(t._xhr))},t._xhr.onerror=function(t){n(t)},t._xhr.send(e)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Vt=function(){return Kt((function t(e){Gt(this,t),this._xhr=e}),[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(t){return this._xhr.getResponseHeader(t)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function Jt(t){return(Jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function $t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qt(n.key),n)}}function Qt(t){var e=function(t,e){if("object"!=Jt(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=Jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Jt(e)?e:e+""}var Wt=!1;try{Wt="localStorage"in window;var te="tusSupport",ee=localStorage.getItem(te);localStorage.setItem(te,ee),null===ee&&localStorage.removeItem(te)}catch(me){if(me.code!==me.SECURITY_ERR&&me.code!==me.QUOTA_EXCEEDED_ERR)throw me;Wt=!1}var re=Wt,ne=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"findAllUploads",value:function(){var t=this._findEntries("tus::");return Promise.resolve(t)}},{key:"findUploadsByFingerprint",value:function(t){var e=this._findEntries("tus::".concat(t,"::"));return Promise.resolve(e)}},{key:"removeUpload",value:function(t){return localStorage.removeItem(t),Promise.resolve()}},{key:"addUpload",value:function(t,e){var r=Math.round(1e12*Math.random()),n="tus::".concat(t,"::").concat(r);return localStorage.setItem(n,JSON.stringify(e)),Promise.resolve(n)}},{key:"_findEntries",value:function(t){for(var e=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);if(0===n.indexOf(t))try{var o=JSON.parse(localStorage.getItem(n));o.urlStorageKey=n,e.push(o)}catch(i){}}return e}}],e&&$t(t.prototype,e),r&&$t(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();function oe(t){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ie(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,he(n.key),n)}}function ae(t,e,r){return e=le(e),function(t,e){if(e&&("object"===oe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ue()?Reflect.construct(e,r||[],le(t).constructor):e.apply(t,r))}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ue=function(){return!!t})()}function le(t){return(le=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function se(t,e){return(se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function ce(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function fe(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ce(Object(r),!0).forEach((function(e){pe(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ce(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function pe(t,e,r){return(e=he(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function he(t){var e=function(t,e){if("object"!=oe(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==oe(e)?e:e+""}var de=fe(fe({},vt.defaultOptions),{},{httpStack:new Yt,fileReader:new Ft,urlStorage:re?new ne:new y,fingerprint:function(t,e){return Ot()?Promise.resolve(function(t,e){var r=t.exif?function(t){var e=0;if(0===t.length)return e;for(var r=0;r<t.length;r++){e=(e<<5)-e+t.charCodeAt(r),e&=e}return e}(JSON.stringify(t.exif)):"noexif";return["tus-rn",t.name||"noname",t.size||"nosize",r,e.endpoint].join("/")}(t,e)):Promise.resolve(["tus-br",t.name,t.type,t.size,t.lastModified,e.endpoint].join("-"))}}),ye=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),ae(this,t,[e,r=fe(fe({},de),r)])}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&se(t,e)}(t,vt),e=t,n=[{key:"terminate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e=fe(fe({},de),e),vt.terminate(t,e)}}],(r=null)&&ie(e.prototype,r),n&&ie(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r,n}(),ve="function"==typeof XMLHttpRequest&&"function"==typeof Blob&&"function"==typeof Blob.prototype.slice;exports.DefaultHttpStack=Yt,exports.DetailedError=s,exports.Upload=ye,exports.canStoreURLs=re,exports.defaultOptions=de,exports.enableDebugLog=function(){c=!0},exports.isSupported=ve;
6
- //# sourceMappingURL=tus_client-d0798623.js.map
6
+ //# sourceMappingURL=tus_client-2b915a81.js.map