@maveio/components 0.0.157 → 0.0.159

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 (107) hide show
  1. package/dist/{chunk-45FW5DBN.js → chunk-24TUG5TP.js} +1 -1
  2. package/dist/{chunk-KZOVSI7R.cjs → chunk-2UJ446RI.cjs} +13 -29
  3. package/dist/{chunk-Z5AM3NST.cjs → chunk-32WXLTTE.cjs} +2 -2
  4. package/dist/{chunk-4CDE2QCJ.js → chunk-6XR2OUZW.js} +1 -1
  5. package/dist/chunk-7ZRXZY5C.js +20 -0
  6. package/dist/{chunk-TVNAG7X4.cjs → chunk-B3QILQEE.cjs} +3 -3
  7. package/dist/{chunk-6MCTUE3H.js → chunk-CHHWULL2.js} +4 -4
  8. package/dist/chunk-DITZCOYN.cjs +379 -0
  9. package/dist/{chunk-MKZYI5TY.cjs → chunk-EOHKHSQ3.cjs} +1 -1
  10. package/dist/{chunk-KTGL4HLA.cjs → chunk-FUSQ4EZG.cjs} +2 -2
  11. package/dist/chunk-JHSFSCC2.cjs +1 -0
  12. package/dist/chunk-KA24PL7V.js +1 -0
  13. package/dist/{chunk-VZKW2VWI.js → chunk-KNAAIER3.js} +2 -2
  14. package/dist/{chunk-5KQJTT3P.cjs → chunk-KVMGCTLR.cjs} +1 -1
  15. package/dist/{chunk-JBRRVOTV.cjs → chunk-MLZIA6JO.cjs} +5 -5
  16. package/dist/chunk-MSWONVA7.cjs +20 -0
  17. package/dist/{chunk-4AYP3SUJ.js → chunk-NKEVN7FX.js} +1 -1
  18. package/dist/{chunk-PLCF3Z5Q.cjs → chunk-OTRPT6Y4.cjs} +4 -4
  19. package/dist/{chunk-PC26CFMJ.cjs → chunk-PHGKLFNF.cjs} +1 -1
  20. package/dist/{chunk-2AXZ5ZCT.js → chunk-QNX3YAVY.js} +7 -23
  21. package/dist/chunk-QSQE5WBN.js +35 -0
  22. package/dist/chunk-QZSLJNS4.js +7 -0
  23. package/dist/chunk-STJ6CEFZ.cjs +1468 -0
  24. package/dist/chunk-T2P4BAWY.js +379 -0
  25. package/dist/chunk-ULZI6OGL.js +1468 -0
  26. package/dist/{chunk-CUGRXOA2.js → chunk-XLUB3ATV.js} +1 -1
  27. package/dist/{chunk-6NWQAHZT.cjs → chunk-ZLS57S3I.cjs} +1 -1
  28. package/dist/components/audio-track-menu.cjs +1 -0
  29. package/dist/components/audio-track-menu.d.cts +27 -0
  30. package/dist/components/audio-track-menu.d.ts +27 -0
  31. package/dist/components/audio-track-menu.js +1 -0
  32. package/dist/components/clip.cjs +1 -1
  33. package/dist/components/clip.js +1 -1
  34. package/dist/components/files.cjs +1 -1
  35. package/dist/components/files.js +1 -1
  36. package/dist/components/img.cjs +1 -1
  37. package/dist/components/img.js +1 -1
  38. package/dist/components/list.cjs +1 -1
  39. package/dist/components/list.js +1 -1
  40. package/dist/components/player.cjs +1 -1
  41. package/dist/components/player.d.cts +8 -0
  42. package/dist/components/player.d.ts +8 -0
  43. package/dist/components/player.js +1 -1
  44. package/dist/components/pop.cjs +1 -1
  45. package/dist/components/pop.js +1 -1
  46. package/dist/components/text.cjs +1 -1
  47. package/dist/components/text.js +1 -1
  48. package/dist/components/upload.cjs +1 -1
  49. package/dist/components/upload.d.cts +5 -0
  50. package/dist/components/upload.d.ts +5 -0
  51. package/dist/components/upload.js +1 -1
  52. package/dist/config.cjs +1 -1
  53. package/dist/config.js +1 -1
  54. package/dist/embed/api.cjs +1 -1
  55. package/dist/embed/api.d.cts +11 -1
  56. package/dist/embed/api.d.ts +11 -1
  57. package/dist/embed/api.js +1 -1
  58. package/dist/embed/caption.cjs +1 -1
  59. package/dist/embed/caption.js +1 -1
  60. package/dist/embed/controller.cjs +1 -1
  61. package/dist/embed/controller.js +1 -1
  62. package/dist/embed/socket.cjs +1 -1
  63. package/dist/embed/socket.d.cts +3 -5
  64. package/dist/embed/socket.d.ts +3 -5
  65. package/dist/embed/socket.js +1 -1
  66. package/dist/generated/locales/de.cjs +1 -1
  67. package/dist/generated/locales/de.js +1 -1
  68. package/dist/generated/locales/en.cjs +1 -1
  69. package/dist/generated/locales/en.js +1 -1
  70. package/dist/generated/locales/fr.cjs +1 -1
  71. package/dist/generated/locales/fr.js +1 -1
  72. package/dist/generated/locales/nl.cjs +1 -1
  73. package/dist/generated/locales/nl.js +1 -1
  74. package/dist/index.cjs +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/react.cjs +1 -1
  77. package/dist/react.js +1 -1
  78. package/dist/themes/default.cjs +53 -1
  79. package/dist/themes/default.js +53 -1
  80. package/dist/themes/dolphin.cjs +1 -1
  81. package/dist/themes/dolphin.js +1 -1
  82. package/dist/themes/loader.cjs +1 -1
  83. package/dist/themes/loader.js +1 -1
  84. package/dist/themes/synthwave.cjs +1 -1
  85. package/dist/themes/synthwave.js +1 -1
  86. package/dist/utils/localization.cjs +1 -1
  87. package/dist/utils/localization.js +1 -1
  88. package/dist/utils/mave_element.cjs +1 -1
  89. package/dist/utils/mave_element.js +1 -1
  90. package/dist/utils/origin.cjs +1 -1
  91. package/dist/utils/origin.js +1 -1
  92. package/dist/utils/video_events.cjs +1 -1
  93. package/dist/utils/video_events.js +1 -1
  94. package/dist/vue.cjs +1 -1
  95. package/dist/vue.js +1 -1
  96. package/package.json +3 -3
  97. package/dist/chunk-5IPIXU3O.js +0 -1807
  98. package/dist/chunk-IBTJ5OMP.js +0 -35
  99. package/dist/chunk-IPA5Q26W.cjs +0 -1
  100. package/dist/chunk-LGWESJBJ.cjs +0 -20
  101. package/dist/chunk-NDDFZTBA.js +0 -1
  102. package/dist/chunk-SRXHXTDF.js +0 -7
  103. package/dist/chunk-ZMMJMM4X.cjs +0 -1807
  104. package/dist/chunk-ZT2E4EC7.js +0 -20
  105. /package/dist/{chunk-NI57YLPL.cjs → chunk-BVMU4ZXD.cjs} +0 -0
  106. /package/dist/{chunk-EXNM5EV2.js → chunk-DFLPNNA4.js} +0 -0
  107. /package/dist/{chunk-4GKJNXUA.js → chunk-FRPU6QLJ.js} +0 -0
@@ -1 +1 @@
1
- import {a}from'./chunk-HMISRRKC.js';import {i,c as c$1}from'./chunk-A4GZBQEB.js';import {a as a$1}from'./chunk-JBV2AYRP.js';import {c}from'./chunk-NDDFZTBA.js';var s=class extends i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return c$1``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return c$1`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};c([a({type:String})],s.prototype,"embed",1);export{s as a};
1
+ import {a}from'./chunk-HMISRRKC.js';import {i,c as c$1}from'./chunk-A4GZBQEB.js';import {a as a$1}from'./chunk-JBV2AYRP.js';import {c}from'./chunk-KA24PL7V.js';var s=class extends i{constructor(){super(...arguments);this.EVENT_TYPES={CLICK:"user_click"};}get embed(){return this._embed}set embed(t){this._embed=t;}get embedId(){return this._embed?.substring(5,this._embed?.length)}get spaceId(){return this.embed?.substring(0,5)}get cdn_root(){return a$1.cdn.endpoint.replace("${this.spaceId}",this.spaceId)}get _stylesheets(){if(typeof document>"u")return c$1``;let t=document.querySelectorAll('style, link[rel="stylesheet"]');return c$1`${Array.from(t).map(e=>e.cloneNode(true))}`}durationToTime(t){let e=Math.floor(t),n=Math.floor(e/3600),i=Math.floor(e%3600/60),o=e%60;return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${i}:${o.toString().padStart(2,"0")}`}emit(t,e){this.dispatchEvent(new CustomEvent(`mave:${t}`,{detail:{...e,eventType:t}})),this.dispatchEvent(new CustomEvent("mave:*",{detail:{...e,eventType:t}}));}};c([a({type:String})],s.prototype,"embed",1);export{s as a};
@@ -1,6 +1,6 @@
1
- 'use strict';var chunkPC26CFMJ_cjs=require('./chunk-PC26CFMJ.cjs'),chunkKTGL4HLA_cjs=require('./chunk-KTGL4HLA.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var Ot=chunkIPA5Q26W_cjs.a((no,Pt)=>{Pt.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return false;switch(r){case "http":case "ws":return t!==80;case "https":case "wss":return t!==443;case "ftp":return t!==21;case "gopher":return t!==70;case "file":return false}return t!==0};});var Dt=chunkIPA5Q26W_cjs.a(Ae=>{var Vr=Object.prototype.hasOwnProperty,Wr;function kt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Rt(e){try{return encodeURIComponent(e)}catch{return null}}function Yr(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=kt(n[1]),a=kt(n[2]);o===null||a===null||o in r||(r[o]=a);}return r}function Zr(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(Vr.call(e,o)){if(n=e[o],!n&&(n===null||n===Wr||isNaN(n))&&(n=""),o=Rt(o),n=Rt(n),o===null||n===null)continue;r.push(o+"="+n);}return r.length?t+r.join("&"):""}Ae.stringify=Zr;Ae.parse=Yr;});var Nt=chunkIPA5Q26W_cjs.a((io,It)=>{var jt=Ot(),be=Dt(),Jr=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Tt=/[\n\r\t]/g,Qr=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,At=/:\d+$/,en=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,tn=/^[a-zA-Z]:/;function Fe(e){return (e||"").toString().replace(Jr,"")}var Le=[["#","hash"],["?","query"],function(t,r){return L(r.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]],Ct={hash:1,query:1};function Lt(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},o=typeof e,a;if(e.protocol==="blob:")n=new F(unescape(e.pathname),{});else if(o==="string"){n=new F(e,{});for(a in Ct)delete n[a];}else if(o==="object"){for(a in e)a in Ct||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=Qr.test(e.href));}return n}function L(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Ft(e,t){e=Fe(e),e=e.replace(Tt,""),t=t||{};var r=en.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],a=!!r[3],u=0,f;return o?a?(f=r[2]+r[3]+r[4],u=r[2].length+r[3].length):(f=r[2]+r[4],u=r[2].length):a?(f=r[3]+r[4],u=r[3].length):f=r[4],n==="file:"?u>=2&&(f=f.slice(2)):L(n)?f=r[4]:n?o&&(f=f.slice(2)):u>=2&&L(t.protocol)&&(f=r[4]),{protocol:n,slashes:o||L(n),slashesCount:u,rest:f}}function rn(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],a=false,u=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),u++):u&&(n===0&&(a=true),r.splice(n,1),u--);return a&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function F(e,t,r){if(e=Fe(e),e=e.replace(Tt,""),!(this instanceof F))return new F(e,t,r);var n,o,a,u,f,h,m=Le.slice(),v=typeof t,y=this,j=0;for(v!=="object"&&v!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=be.parse),t=Lt(t),o=Ft(e||"",t),n=!o.protocol&&!o.slashes,y.slashes=o.slashes||n&&t.slashes,y.protocol=o.protocol||t.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||tn.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!L(y.protocol)))&&(m[3]=[/(.*)/,"pathname"]);j<m.length;j++){if(u=m[j],typeof u=="function"){e=u(e,y);continue}a=u[0],h=u[1],a!==a?y[h]=e:typeof a=="string"?(f=a==="@"?e.lastIndexOf(a):e.indexOf(a),~f&&(typeof u[2]=="number"?(y[h]=e.slice(0,f),e=e.slice(f+u[2])):(y[h]=e.slice(f),e=e.slice(0,f)))):(f=a.exec(e))&&(y[h]=f[1],e=e.slice(0,f.index)),y[h]=y[h]||n&&u[3]&&t[h]||"",u[4]&&(y[h]=y[h].toLowerCase());}r&&(y.query=r(y.query)),n&&t.slashes&&y.pathname.charAt(0)!=="/"&&(y.pathname!==""||t.pathname!=="")&&(y.pathname=rn(y.pathname,t.pathname)),y.pathname.charAt(0)!=="/"&&L(y.protocol)&&(y.pathname="/"+y.pathname),jt(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(f=y.auth.indexOf(":"),~f?(y.username=y.auth.slice(0,f),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(f+1),y.password=encodeURIComponent(decodeURIComponent(y.password))):y.username=encodeURIComponent(decodeURIComponent(y.auth)),y.auth=y.password?y.username+":"+y.password:y.username),y.origin=y.protocol!=="file:"&&L(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString();}function nn(e,t,r){var n=this;switch(e){case "query":typeof t=="string"&&t.length&&(t=(r||be.parse)(t)),n[e]=t;break;case "port":n[e]=t,jt(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case "hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case "host":n[e]=t,At.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case "protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case "pathname":case "hash":if(t){var o=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==o?o+t:t;}else n[e]=t;break;case "username":case "password":n[e]=encodeURIComponent(t);break;case "auth":var a=t.indexOf(":");~a?(n.username=t.slice(0,a),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(a+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t));}for(var u=0;u<Le.length;u++){var f=Le[u];f[4]&&(n[f[1]]=n[f[1]].toLowerCase());}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&L(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function on(e){(!e||typeof e!="function")&&(e=be.stringify);var t,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var a=o+(r.protocol&&r.slashes||L(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&L(r.protocol)&&!n&&r.pathname!=="/"&&(a+="@"),(n[n.length-1]===":"||At.test(r.hostname)&&!r.port)&&(n+=":"),a+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(a+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(a+=r.hash),a}F.prototype={set:nn,toString:on};F.extractProtocol=Ft;F.location=Lt;F.trimLeft=Fe;F.qs=be;It.exports=F;});function J(e){"@babel/helpers - typeof";return J=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J(e)}function _r(e,t,r){return Object.defineProperty(e,"prototype",{writable:false}),e}function xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Er(e,t,r){return t=fe(t),Ur(e,Re()?Reflect.construct(t,r||[],fe(e).constructor):t.apply(e,r))}function Ur(e,t){if(t&&(J(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pr(e)}function Pr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Or(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&ue(e,t);}function ke(e){var t=typeof Map=="function"?new Map:void 0;return ke=function(n){if(n===null||!Rr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,o);}function o(){return kr(n,arguments,fe(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}}),ue(o,n)},ke(e)}function kr(e,t,r){if(Re())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&ue(o,r.prototype),o}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (Re=function(){return !!e})()}function Rr(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function ue(e,t){return ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ue(e,t)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fe(e)}var Dr=function(e){function t(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(xr(this,t),n=Er(this,t,[r]),n.originalRequest=a,n.originalResponse=u,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),a!=null){var f=a.getHeader("X-Request-ID")||"n/a",h=a.getMethod(),m=a.getURL(),v=u?u.getStatus():"n/a",y=u?u.getBody()||"":"n/a";r+=", originated from request (method: ".concat(h,", url: ").concat(m,", response code: ").concat(v,", response text: ").concat(y,", request id: ").concat(f,")");}return n.message=r,n}return Or(t,e),_r(t)}(ke(Error)),Q=Dr;function z(e){}function ce(e){"@babel/helpers - typeof";return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}function jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function it(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Ar(n.key),n);}}function Tr(e,t,r){return t&&it(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Ar(e){var t=Lr(e,"string");return ce(t)=="symbol"?t:t+""}function Lr(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var at=function(){function e(){jr(this,e);}return Tr(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])}();var pt="3.7.5",Fr=pt,Ir=typeof atob=="function",Nr=typeof btoa=="function",te=typeof Buffer=="function",st=typeof TextDecoder=="function"?new TextDecoder:void 0,lt=typeof TextEncoder=="function"?new TextEncoder:void 0,Br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",pe=Array.prototype.slice.call(Br),ge=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(pe),Hr=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,U=String.fromCharCode.bind(String),ut=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),ht=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),dt=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),yt=e=>{let t,r,n,o,a="",u=e.length%3;for(let f=0;f<e.length;){if((r=e.charCodeAt(f++))>255||(n=e.charCodeAt(f++))>255||(o=e.charCodeAt(f++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,a+=pe[t>>18&63]+pe[t>>12&63]+pe[t>>6&63]+pe[t&63];}return u?a.slice(0,u-3)+"===".substring(u):a},je=Nr?e=>btoa(e):te?e=>Buffer.from(e,"binary").toString("base64"):yt,De=te?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(U.apply(null,e.subarray(n,n+4096)));return je(r.join(""))},ve=(e,t=false)=>t?ht(De(e)):De(e),zr=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?U(192|t>>>6)+U(128|t&63):U(224|t>>>12&15)+U(128|t>>>6&63)+U(128|t&63)}else {var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return U(240|t>>>18&7)+U(128|t>>>12&63)+U(128|t>>>6&63)+U(128|t&63)}},qr=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,mt=e=>e.replace(qr,zr),ft=te?e=>Buffer.from(e,"utf8").toString("base64"):lt?e=>De(lt.encode(e)):e=>je(mt(e)),ee=(e,t=false)=>t?ht(ft(e)):ft(e),ct=e=>ee(e,true),$r=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Mr=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return U((r>>>10)+55296)+U((r&1023)+56320);case 3:return U((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return U((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},gt=e=>e.replace($r,Mr),vt=e=>{if(e=e.replace(/\s+/g,""),!Hr.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let a=0;a<e.length;)t=ge[e.charAt(a++)]<<18|ge[e.charAt(a++)]<<12|(n=ge[e.charAt(a++)])<<6|(o=ge[e.charAt(a++)]),r+=n===64?U(t>>16&255):o===64?U(t>>16&255,t>>8&255):U(t>>16&255,t>>8&255,t&255);return r},Te=Ir?e=>atob(dt(e)):te?e=>Buffer.from(e,"base64").toString("binary"):vt,bt=te?e=>ut(Buffer.from(e,"base64")):e=>ut(Te(e).split("").map(t=>t.charCodeAt(0))),_t=e=>bt(wt(e)),Gr=te?e=>Buffer.from(e,"base64").toString("utf8"):st?e=>st.decode(bt(e)):e=>gt(Te(e)),wt=e=>dt(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),Ce=e=>Gr(wt(e)),Kr=e=>{if(typeof e!="string")return false;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return !/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},St=e=>({value:e,enumerable:false,writable:true,configurable:true}),xt=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,St(r));e("fromBase64",function(){return Ce(this)}),e("toBase64",function(t){return ee(this,t)}),e("toBase64URI",function(){return ee(this,true)}),e("toBase64URL",function(){return ee(this,true)}),e("toUint8Array",function(){return _t(this)});},Et=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,St(r));e("toBase64",function(t){return ve(this,t)}),e("toBase64URI",function(){return ve(this,true)}),e("toBase64URL",function(){return ve(this,true)});},Xr=()=>{xt(),Et();},Ut={version:pt,VERSION:Fr,atob:Te,atobPolyfill:vt,btoa:je,btoaPolyfill:yt,fromBase64:Ce,toBase64:ee,encode:ee,encodeURI:ct,encodeURL:ct,utob:mt,btou:gt,decode:Ce,isValid:Kr,fromUint8Array:ve,toUint8Array:_t,extendString:xt,extendUint8Array:Et,extendBuiltins:Xr};var Zt=chunkIPA5Q26W_cjs.b(Nt());function Ie(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}function Ne(){Ne=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(l,i,s){l[i]=s.value;},a=typeof Symbol=="function"?Symbol:{},u=a.iterator||"@@iterator",f=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function m(l,i,s){return Object.defineProperty(l,i,{value:s,enumerable:true,configurable:true,writable:true}),l[i]}try{m({},"");}catch{m=function(s,c,d){return s[c]=d};}function v(l,i,s,c){var d=i&&i.prototype instanceof I?i:I,p=Object.create(d.prototype),g=new G(c||[]);return o(p,"_invoke",{value:Ue(l,s,g)}),p}function y(l,i,s){try{return {type:"normal",arg:l.call(i,s)}}catch(c){return {type:"throw",arg:c}}}t.wrap=v;var j="suspendedStart",ae="suspendedYield",q="executing",A="completed",S={};function I(){}function R(){}function x(){}var T={};m(T,u,function(){return this});var $=Object.getPrototypeOf,N=$&&$($(K([])));N&&N!==r&&n.call(N,u)&&(T=N);var D=x.prototype=I.prototype=Object.create(T);function se(l){["next","throw","return"].forEach(function(i){m(l,i,function(s){return this._invoke(i,s)});});}function B(l,i){function s(d,p,g,b){var _=y(l[d],l,p);if(_.type!=="throw"){var P=_.arg,E=P.value;return E&&W(E)=="object"&&n.call(E,"__await")?i.resolve(E.__await).then(function(O){s("next",O,g,b);},function(O){s("throw",O,g,b);}):i.resolve(E).then(function(O){P.value=O,g(P);},function(O){return s("throw",O,g,b)})}b(_.arg);}var c;o(this,"_invoke",{value:function(p,g){function b(){return new i(function(_,P){s(p,g,_,P);})}return c=c?c.then(b,b):b()}});}function Ue(l,i,s){var c=j;return function(d,p){if(c===q)throw Error("Generator is already running");if(c===A){if(d==="throw")throw p;return {value:e,done:true}}for(s.method=d,s.arg=p;;){var g=s.delegate;if(g){var b=le(g,s);if(b){if(b===S)continue;return b}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(c===j)throw c=A,s.arg;s.dispatchException(s.arg);}else s.method==="return"&&s.abrupt("return",s.arg);c=q;var _=y(l,i,s);if(_.type==="normal"){if(c=s.done?A:ae,_.arg===S)continue;return {value:_.arg,done:s.done}}_.type==="throw"&&(c=A,s.method="throw",s.arg=_.arg);}}}function le(l,i){var s=i.method,c=l.iterator[s];if(c===e)return i.delegate=null,s==="throw"&&l.iterator.return&&(i.method="return",i.arg=e,le(l,i),i.method==="throw")||s!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+s+"' method")),S;var d=y(c,l.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,S;var p=d.arg;return p?p.done?(i[l.resultName]=p.value,i.next=l.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,S):p:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,S)}function Pe(l){var i={tryLoc:l[0]};1 in l&&(i.catchLoc=l[1]),2 in l&&(i.finallyLoc=l[2],i.afterLoc=l[3]),this.tryEntries.push(i);}function M(l){var i=l.completion||{};i.type="normal",delete i.arg,l.completion=i;}function G(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Pe,this),this.reset(true);}function K(l){if(l||l===""){var i=l[u];if(i)return i.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,c=function d(){for(;++s<l.length;)if(n.call(l,s))return d.value=l[s],d.done=false,d;return d.value=e,d.done=true,d};return c.next=c}}throw new TypeError(W(l)+" is not iterable")}return R.prototype=x,o(D,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:R,configurable:true}),R.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(l){var i=typeof l=="function"&&l.constructor;return !!i&&(i===R||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,x):(l.__proto__=x,m(l,h,"GeneratorFunction")),l.prototype=Object.create(D),l},t.awrap=function(l){return {__await:l}},se(B.prototype),m(B.prototype,f,function(){return this}),t.AsyncIterator=B,t.async=function(l,i,s,c,d){d===void 0&&(d=Promise);var p=new B(v(l,i,s,c),d);return t.isGeneratorFunction(i)?p:p.next().then(function(g){return g.done?g.value:p.next()})},se(D),m(D,h,"Generator"),m(D,u,function(){return this}),m(D,"toString",function(){return "[object Generator]"}),t.keys=function(l){var i=Object(l),s=[];for(var c in i)s.push(c);return s.reverse(),function d(){for(;s.length;){var p=s.pop();if(p in i)return d.value=p,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var s in this)s.charAt(0)==="t"&&n.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var s=this;function c(P,E){return g.type="throw",g.arg=i,s.next=P,E&&(s.method="next",s.arg=e),!!E}for(var d=this.tryEntries.length-1;d>=0;--d){var p=this.tryEntries[d],g=p.completion;if(p.tryLoc==="root")return c("end");if(p.tryLoc<=this.prev){var b=n.call(p,"catchLoc"),_=n.call(p,"finallyLoc");if(b&&_){if(this.prev<p.catchLoc)return c(p.catchLoc,true);if(this.prev<p.finallyLoc)return c(p.finallyLoc)}else if(b){if(this.prev<p.catchLoc)return c(p.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<p.finallyLoc)return c(p.finallyLoc)}}}},abrupt:function(i,s){for(var c=this.tryEntries.length-1;c>=0;--c){var d=this.tryEntries[c];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var p=d;break}}p&&(i==="break"||i==="continue")&&p.tryLoc<=s&&s<=p.finallyLoc&&(p=null);var g=p?p.completion:{};return g.type=i,g.arg=s,p?(this.method="next",this.next=p.finallyLoc,S):this.complete(g)},complete:function(i,s){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&s&&(this.next=s),S},finish:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var c=this.tryEntries[s];if(c.finallyLoc===i)return this.complete(c.completion,c.afterLoc),M(c),S}},catch:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var c=this.tryEntries[s];if(c.tryLoc===i){var d=c.completion;if(d.type==="throw"){var p=d.arg;M(c);}return p}}throw Error("illegal catch attempt")},delegateYield:function(i,s,c){return this.delegate={iterator:K(i),resultName:s,nextLoc:c},this.method==="next"&&(this.arg=e),S}},t}function Bt(e,t,r,n,o,a,u){try{var f=e[a](u),h=f.value;}catch(m){r(m);return}f.done?t(h):Promise.resolve(h).then(n,o);}function an(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function u(h){Bt(a,n,o,u,f,"next",h);}function f(h){Bt(a,n,o,u,f,"throw",h);}u(void 0);})}}function Vt(e,t){return un(e)||ln(e,t)||Wt(e,t)||sn()}function sn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ln(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,u,f=[],h=true,m=false;try{if(a=(r=r.call(e)).next,t===0);else for(;!(h=(n=a.call(r)).done)&&(f.push(n.value),f.length!==t);h=!0);}catch(v){m=true,o=v;}finally{try{if(!h&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(m)throw o}}return f}}function un(e){if(Array.isArray(e))return e}function W(e){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(e)}function fn(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Wt(e))||t){r&&(e=r);var n=0,o=function(){};return {s:o,n:function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}},e:function(m){throw m},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=true,u=false,f;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return a=m.done,m},e:function(m){u=true,f=m;},f:function(){try{!a&&r.return!=null&&r.return();}finally{if(u)throw f}}}}function Wt(e,t){if(e){if(typeof e=="string")return Ht(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ht(e,t)}}function Ht(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function zt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zt(Object(r),true).forEach(function(n){cn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function cn(e,t,r){return t=Yt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Yt(n.key),n);}}function hn(e,t,r){return t&&qt(e.prototype,t),r&&qt(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Yt(e){var t=dn(e,"string");return W(t)=="symbol"?t:t+""}function dn(e,t){if(W(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(W(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Be="tus-v1",_e="ietf-draft-03",yn={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:false,headers:{},addRequestId:false,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Qt,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:true,removeFingerprintOnSuccess:false,uploadLengthDeferred:false,uploadDataDuringCreation:false,urlStorage:null,fileReader:null,httpStack:null,protocol:Be},Jt=function(){function e(t,r){pn(this,e),"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=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=false,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null;}return hn(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey;}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Be,_e].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var a=0,u=["uploadUrl","uploadSize","uploadLengthDeferred"];a<u.length;a++){var f=u[a];if(this.options[f]){this._emitError(new Error("tus: cannot use the ".concat(f," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(h){return r._fingerprint=h,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(h){if(r._source=h,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload();}).catch(function(h){r._emitError(h);});}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,a=0;this._parallelUploads=[];var u=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,f=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:gn(this._source.size,u);this._parallelUploadUrls&&f.forEach(function(v,y){v.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(f.length);var h=f.map(function(v,y){var j=0;return n._source.slice(v.start,v.end).then(function(ae){var q=ae.value;return new Promise(function(A,S){var I=re(re({},n.options),{},{uploadUrl:v.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:re(re({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:A,onError:S,onProgress:function(T){a=a-j+T,j=T,n._emitProgress(a,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=R.url,n._parallelUploadUrls.filter(function(T){return !!T}).length===f.length&&n._saveUploadInUrlStorage();}}),R=new e(q,I);R.start(),n._parallelUploads.push(R);})})}),m;Promise.all(h).then(function(){m=n._openRequest("POST",n.options.endpoint),m.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var v=$t(n.options.metadata);return v!==""&&m.setHeader("Upload-Metadata",v),n._sendRequest(m,null)}).then(function(v){if(!ne(v.getStatus(),200)){n._emitHttpError(m,v,"tus: unexpected response while creating upload");return}var y=v.getHeader("Location");if(y==null){n._emitHttpError(m,v,"tus: invalid or missing Location header");return}n.url=Xt(n.options.endpoint,y),z("Created upload at ".concat(n.url)),n._emitSuccess(v);}).catch(function(v){n._emitError(v);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){z("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){z("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload();}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=fn(this._parallelUploads),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;u.abort(r);}}catch(f){o.e(f);}finally{o.f();}}return this._req!==null&&this._req.abort(),this._aborted=true,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():e.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,a){this._emitError(new Q(o,a,r,n));}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Kt(r,this._retryAttempt,this.options)){var a=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start();},a);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r});}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n);}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o);}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=$t(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var a;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,a=this._addChunkToRequest(n)):(this.options.protocol===_e&&n.setHeader("Upload-Complete","?0"),a=this._sendRequest(n,null)),a.then(function(u){if(!ne(u.getStatus(),200)){r._emitHttpError(n,u,"tus: unexpected response while creating upload");return}var f=u.getHeader("Location");if(f==null){r._emitHttpError(n,u,"tus: invalid or missing Location header");return}if(r.url=Xt(r.options.endpoint,f),z("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(u),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,u):(r._offset=0,r._performUpload());});}).catch(function(u){r._emitHttpError(n,null,"tus: failed to create upload",u);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(a){var u=a.getStatus();if(!ne(u,200)){if(u===423){r._emitHttpError(n,a,"tus: upload is currently locked; retry later");return}if(ne(u,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,a,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var f=Number.parseInt(a.getHeader("Upload-Offset"),10);if(Number.isNaN(f)){r._emitHttpError(n,a,"tus: invalid or missing offset value");return}var h=Number.parseInt(a.getHeader("Upload-Length"),10);if(Number.isNaN(h)&&!r.options.uploadLengthDeferred&&r.options.protocol===Be){r._emitHttpError(n,a,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(f===h){r._emitProgress(h,h),r._emitSuccess(a);return}r._offset=f,r._performUpload();});}).catch(function(a){r._emitHttpError(n,null,"tus: failed to resume upload",a);});}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(a){if(!ne(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,a);}).catch(function(a){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),a);});}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,a=this._offset+this.options.chunkSize;return r.setProgressHandler(function(u){n._emitProgress(o+u,n._size);}),r.setHeader("Content-Type","application/offset+octet-stream"),(a===Number.POSITIVE_INFINITY||a>this._size)&&!this.options.uploadLengthDeferred&&(a=this._size),this._source.slice(o,a).then(function(u){var f=u.value,h=u.done,m=f!=null&&f.size?f.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var v=n._offset+m;return !n.options.uploadLengthDeferred&&h&&v!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(v," bytes"))):f===null?n._sendRequest(r):(n.options.protocol===_e&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,f))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload();}},{key:"_openRequest",value:function(r,n){var o=Mt(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n);}),this._urlStorageKey=null);}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o;})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return Gt(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Mt("DELETE",r,n);return Gt(o,null,n).then(function(a){if(a.getStatus()!==204)throw new Q("tus: unexpected response while terminating upload",null,o,a)}).catch(function(a){if(a instanceof Q||(a=new Q("tus: failed to terminate upload",a,o,null)),!Kt(a,0,n))throw a;var u=n.retryDelays[0],f=n.retryDelays.slice(1),h=re(re({},n),{},{retryDelays:f});return new Promise(function(m){return setTimeout(m,u)}).then(function(){return e.terminate(r,h)})})}}])}();function $t(e){return Object.entries(e).map(function(t){var r=Vt(t,2),n=r[0],o=r[1];return "".concat(n," ").concat(Ut.encode(String(o)))}).join(",")}function ne(e,t){return e>=t&&e<t+100}function Mt(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===_e?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},a=0,u=Object.entries(o);a<u.length;a++){var f=Vt(u[a],2),h=f[0],m=f[1];n.setHeader(h,m);}if(r.addRequestId){var v=Ie();n.setHeader("X-Request-ID",v);}return n}function Gt(e,t,r){return He.apply(this,arguments)}function He(){return He=an(Ne().mark(function e(t,r,n){var o;return Ne().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(typeof n.onBeforeRequest!="function"){u.next=3;break}return u.next=3,n.onBeforeRequest(t);case 3:return u.next=5,t.send(r);case 5:if(o=u.sent,typeof n.onAfterResponse!="function"){u.next=9;break}return u.next=9,n.onAfterResponse(t,o);case 9:return u.abrupt("return",o);case 10:case "end":return u.stop()}},e)})),He.apply(this,arguments)}function mn(){var e=true;return typeof navigator<"u"&&navigator.onLine===false&&(e=false),e}function Kt(e,t,r){return r.retryDelays==null||t>=r.retryDelays.length||e.originalRequest==null?false:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(e,t,r):Qt(e)}function Qt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!ne(t,400)||t===409||t===423)&&mn()}function Xt(e,t){return new Zt.default(t,e).toString()}function gn(e,t){for(var r=Math.floor(e/t),n=[],o=0;o<t;o++)n.push({start:r*o,end:r*(o+1)});return n[t-1].end=e,n}Jt.defaultOptions=yn;var we=Jt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},Se=vn;function ze(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var o=n.response;t(o);},n.onerror=function(o){r(o);},n.open("GET",e),n.send();})}var bn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},er=bn;function qe(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var o=new Uint8Array(n.result);t({value:o});},n.onerror=function(o){r(o);},n.readAsArrayBuffer(e);})}function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function _n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Sn(n.key),n);}}function wn(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Sn(e){var t=xn(e,"string");return he(t)=="symbol"?t:t+""}function xn(e,t){if(he(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(he(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var $e=function(){function e(t){_n(this,e),this._file=t,this.size=t.size;}return wn(e,[{key:"slice",value:function(r,n){if(er())return qe(this._file.slice(r,n));var o=this._file.slice(r,n),a=n>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){}}])}();function de(e){"@babel/helpers - typeof";return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(e)}function En(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Pn(n.key),n);}}function Un(e,t,r){return t&&rr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Pn(e){var t=On(e,"string");return de(t)=="symbol"?t:t+""}function On(e,t){if(de(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(de(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function nr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function kn(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}var or=function(){function e(t){En(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=false;}return Un(e,[{key:"slice",value:function(r,n){return r<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(r,n)}},{key:"_readUntilEnoughDataOrDone",value:function(r,n){var o=this,a=n<=this._bufferOffset+nr(this._buffer);if(this._done||a){var u=this._getDataFromBuffer(r,n),f=u==null?this._done:false;return Promise.resolve({value:u,done:f})}return this._reader.read().then(function(h){var m=h.value,v=h.done;return v?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=kn(o._buffer,m),o._readUntilEnoughDataOrDone(r,n)})}},{key:"_getDataFromBuffer",value:function(r,n){r>this._bufferOffset&&(this._buffer=this._buffer.slice(r-this._bufferOffset),this._bufferOffset=r);var o=nr(this._buffer)===0;return this._done&&o?null:this._buffer.slice(0,n-r)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel();}}])}();function Y(e){"@babel/helpers - typeof";return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(e)}function Me(){Me=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(l,i,s){l[i]=s.value;},a=typeof Symbol=="function"?Symbol:{},u=a.iterator||"@@iterator",f=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function m(l,i,s){return Object.defineProperty(l,i,{value:s,enumerable:true,configurable:true,writable:true}),l[i]}try{m({},"");}catch{m=function(s,c,d){return s[c]=d};}function v(l,i,s,c){var d=i&&i.prototype instanceof I?i:I,p=Object.create(d.prototype),g=new G(c||[]);return o(p,"_invoke",{value:Ue(l,s,g)}),p}function y(l,i,s){try{return {type:"normal",arg:l.call(i,s)}}catch(c){return {type:"throw",arg:c}}}t.wrap=v;var j="suspendedStart",ae="suspendedYield",q="executing",A="completed",S={};function I(){}function R(){}function x(){}var T={};m(T,u,function(){return this});var $=Object.getPrototypeOf,N=$&&$($(K([])));N&&N!==r&&n.call(N,u)&&(T=N);var D=x.prototype=I.prototype=Object.create(T);function se(l){["next","throw","return"].forEach(function(i){m(l,i,function(s){return this._invoke(i,s)});});}function B(l,i){function s(d,p,g,b){var _=y(l[d],l,p);if(_.type!=="throw"){var P=_.arg,E=P.value;return E&&Y(E)=="object"&&n.call(E,"__await")?i.resolve(E.__await).then(function(O){s("next",O,g,b);},function(O){s("throw",O,g,b);}):i.resolve(E).then(function(O){P.value=O,g(P);},function(O){return s("throw",O,g,b)})}b(_.arg);}var c;o(this,"_invoke",{value:function(p,g){function b(){return new i(function(_,P){s(p,g,_,P);})}return c=c?c.then(b,b):b()}});}function Ue(l,i,s){var c=j;return function(d,p){if(c===q)throw Error("Generator is already running");if(c===A){if(d==="throw")throw p;return {value:e,done:true}}for(s.method=d,s.arg=p;;){var g=s.delegate;if(g){var b=le(g,s);if(b){if(b===S)continue;return b}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(c===j)throw c=A,s.arg;s.dispatchException(s.arg);}else s.method==="return"&&s.abrupt("return",s.arg);c=q;var _=y(l,i,s);if(_.type==="normal"){if(c=s.done?A:ae,_.arg===S)continue;return {value:_.arg,done:s.done}}_.type==="throw"&&(c=A,s.method="throw",s.arg=_.arg);}}}function le(l,i){var s=i.method,c=l.iterator[s];if(c===e)return i.delegate=null,s==="throw"&&l.iterator.return&&(i.method="return",i.arg=e,le(l,i),i.method==="throw")||s!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+s+"' method")),S;var d=y(c,l.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,S;var p=d.arg;return p?p.done?(i[l.resultName]=p.value,i.next=l.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,S):p:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,S)}function Pe(l){var i={tryLoc:l[0]};1 in l&&(i.catchLoc=l[1]),2 in l&&(i.finallyLoc=l[2],i.afterLoc=l[3]),this.tryEntries.push(i);}function M(l){var i=l.completion||{};i.type="normal",delete i.arg,l.completion=i;}function G(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Pe,this),this.reset(true);}function K(l){if(l||l===""){var i=l[u];if(i)return i.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,c=function d(){for(;++s<l.length;)if(n.call(l,s))return d.value=l[s],d.done=false,d;return d.value=e,d.done=true,d};return c.next=c}}throw new TypeError(Y(l)+" is not iterable")}return R.prototype=x,o(D,"constructor",{value:x,configurable:true}),o(x,"constructor",{value:R,configurable:true}),R.displayName=m(x,h,"GeneratorFunction"),t.isGeneratorFunction=function(l){var i=typeof l=="function"&&l.constructor;return !!i&&(i===R||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,x):(l.__proto__=x,m(l,h,"GeneratorFunction")),l.prototype=Object.create(D),l},t.awrap=function(l){return {__await:l}},se(B.prototype),m(B.prototype,f,function(){return this}),t.AsyncIterator=B,t.async=function(l,i,s,c,d){d===void 0&&(d=Promise);var p=new B(v(l,i,s,c),d);return t.isGeneratorFunction(i)?p:p.next().then(function(g){return g.done?g.value:p.next()})},se(D),m(D,h,"Generator"),m(D,u,function(){return this}),m(D,"toString",function(){return "[object Generator]"}),t.keys=function(l){var i=Object(l),s=[];for(var c in i)s.push(c);return s.reverse(),function d(){for(;s.length;){var p=s.pop();if(p in i)return d.value=p,d.done=false,d}return d.done=true,d}},t.values=K,G.prototype={constructor:G,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var s in this)s.charAt(0)==="t"&&n.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var s=this;function c(P,E){return g.type="throw",g.arg=i,s.next=P,E&&(s.method="next",s.arg=e),!!E}for(var d=this.tryEntries.length-1;d>=0;--d){var p=this.tryEntries[d],g=p.completion;if(p.tryLoc==="root")return c("end");if(p.tryLoc<=this.prev){var b=n.call(p,"catchLoc"),_=n.call(p,"finallyLoc");if(b&&_){if(this.prev<p.catchLoc)return c(p.catchLoc,true);if(this.prev<p.finallyLoc)return c(p.finallyLoc)}else if(b){if(this.prev<p.catchLoc)return c(p.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<p.finallyLoc)return c(p.finallyLoc)}}}},abrupt:function(i,s){for(var c=this.tryEntries.length-1;c>=0;--c){var d=this.tryEntries[c];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var p=d;break}}p&&(i==="break"||i==="continue")&&p.tryLoc<=s&&s<=p.finallyLoc&&(p=null);var g=p?p.completion:{};return g.type=i,g.arg=s,p?(this.method="next",this.next=p.finallyLoc,S):this.complete(g)},complete:function(i,s){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&s&&(this.next=s),S},finish:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var c=this.tryEntries[s];if(c.finallyLoc===i)return this.complete(c.completion,c.afterLoc),M(c),S}},catch:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var c=this.tryEntries[s];if(c.tryLoc===i){var d=c.completion;if(d.type==="throw"){var p=d.arg;M(c);}return p}}throw Error("illegal catch attempt")},delegateYield:function(i,s,c){return this.delegate={iterator:K(i),resultName:s,nextLoc:c},this.method==="next"&&(this.arg=e),S}},t}function ir(e,t,r,n,o,a,u){try{var f=e[a](u),h=f.value;}catch(m){r(m);return}f.done?t(h):Promise.resolve(h).then(n,o);}function Rn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function u(h){ir(a,n,o,u,f,"next",h);}function f(h){ir(a,n,o,u,f,"throw",h);}u(void 0);})}}function Dn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ar(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,jn(n.key),n);}}function Cn(e,t,r){return t&&ar(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function jn(e){var t=Tn(e,"string");return Y(t)=="symbol"?t:t+""}function Tn(e,t){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var sr=function(){function e(){Dn(this,e);}return Cn(e,[{key:"openFile",value:function(){var t=Rn(Me().mark(function n(o,a){var u;return Me().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(Se()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,ze(o.uri);case 4:return u=h.sent,h.abrupt("return",new $e(u));case 8:throw h.prev=8,h.t0=h.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(h.t0));case 11:if(!(typeof o.slice=="function"&&typeof o.size<"u")){h.next=13;break}return h.abrupt("return",Promise.resolve(new $e(o)));case 13:if(typeof o.read!="function"){h.next=18;break}if(a=Number(a),Number.isFinite(a)){h.next=17;break}return h.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return h.abrupt("return",Promise.resolve(new or(o,a)));case 18:return h.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 h.stop()}},n,null,[[1,8]])}));function r(n,o){return t.apply(this,arguments)}return r}()}])}();function Ge(e,t){return Se()?Promise.resolve(An(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}function An(e,t){var r=e.exif?Ln(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function Ln(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t;}return t}function ye(e){"@babel/helpers - typeof";return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}function Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Fn(n.key),n);}}function Xe(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Fn(e){var t=In(e,"string");return ye(t)=="symbol"?t:t+""}function In(e,t){if(ye(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ye(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ur=function(){function e(){Ke(this,e);}return Xe(e,[{key:"createRequest",value:function(r,n){return new Nn(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var Nn=function(){function e(t,r){Ke(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,true),this._method=t,this._url=r,this._headers={};}return Xe(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._xhr.setRequestHeader(r,n),this._headers[r]=n;}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&r(n.loaded);});}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,a){r._xhr.onload=function(){o(new Bn(r._xhr));},r._xhr.onerror=function(u){a(u);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Bn=function(){function e(t){Ke(this,e),this._xhr=t;}return Xe(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(r){return this._xhr.getResponseHeader(r)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function me(e){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}function Hn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,qn(n.key),n);}}function zn(e,t,r){return t&&fr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function qn(e){var t=$n(e,"string");return me(t)=="symbol"?t:t+""}function $n(e,t){if(me(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(me(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var We=false;try{We="localStorage"in window,xe="tusSupport",Ve=localStorage.getItem(xe),localStorage.setItem(xe,Ve),Ve===null&&localStorage.removeItem(xe);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)We=false;else throw e}var xe,Ve,cr=We,pr=function(){function e(){Hn(this,e);}return zn(e,[{key:"findAllUploads",value:function(){var r=this._findEntries("tus::");return Promise.resolve(r)}},{key:"findUploadsByFingerprint",value:function(r){var n=this._findEntries("tus::".concat(r,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(r){return localStorage.removeItem(r),Promise.resolve()}},{key:"addUpload",value:function(r,n){var o=Math.round(Math.random()*1e12),a="tus::".concat(r,"::").concat(o);return localStorage.setItem(a,JSON.stringify(n)),Promise.resolve(a)}},{key:"_findEntries",value:function(r){for(var n=[],o=0;o<localStorage.length;o++){var a=localStorage.key(o);if(a.indexOf(r)===0)try{var u=JSON.parse(localStorage.getItem(a));u.urlStorageKey=a,n.push(u);}catch{}}return n}}])}();function ie(e){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ie(e)}function Mn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,gr(n.key),n);}}function Gn(e,t,r){return r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=Ee(t),Xn(e,mr()?Reflect.construct(t,r||[],Ee(e).constructor):t.apply(e,r))}function Xn(e,t){if(t&&(ie(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vn(e)}function Vn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (mr=function(){return !!e})()}function Ee(e){return Ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ee(e)}function Wn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&Ye(e,t);}function Ye(e,t){return Ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ye(e,t)}function dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dr(Object(r),true).forEach(function(n){Yn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Yn(e,t,r){return t=gr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function gr(e){var t=Zn(e,"string");return ie(t)=="symbol"?t:t+""}function Zn(e,t){if(ie(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ie(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (t==="string"?String:Number)(e)}var yr=oe(oe({},we.defaultOptions),{},{httpStack:new ur,fileReader:new sr,urlStorage:cr?new pr:new at,fingerprint:Ge}),vr=function(e){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Mn(this,t),n=oe(oe({},yr),n),Kn(this,t,[r,n])}return Wn(t,e),Gn(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=oe(oe({},yr),o),we.terminate(n,o)}}])}(we);exports.a=class w extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);this.disableCompletion=false;this._progress=0;this._completed=false;this._dragging=false;this._error=null;this.playableEmitted=false;this.languageController=new chunkPC26CFMJ_cjs.d(this);this.lastState="initial";this.lastProgress=-1;}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleActionClick),this.addEventListener("keydown",this.handleActionKeyDown),this.languageController.locale=this.locale||"en",this.embedChannel=chunkKTGL4HLA_cjs.a.connect(this.token),this.embedChannel.upload_id&&(this._upload_id=this.embedChannel.upload_id),this.embedChannel.channel.on("initiate",({upload_id:r})=>{this._upload_id=r,this.embedChannel.upload_id=r,this.playableEmitted=false;}),this.embedChannel.channel.on("completed",this.completed.bind(this)),this.embedChannel.channel.on("rendition",this.rendition.bind(this)),this.embedChannel.channel.on("error",this.error.bind(this));}requestUpdate(r,n){super.requestUpdate(r,n),r==="locale"&&(this.languageController.locale=this.locale);}reset(){this._progress=0,this._completed=false,this._error=null,this.playableEmitted=false,this.currentEmbed=void 0,this.embedChannel.channel.push("reset",{});}disconnectedCallback(){this.removeEventListener("click",this.handleActionClick),this.removeEventListener("keydown",this.handleActionKeyDown),super.disconnectedCallback();}handleDrop(r){r.preventDefault(),this._dragging=false;let n=r.dataTransfer;if(!n)return;let o=[];if(n.items){for(let u of n.items)if(u.kind==="file"){let f=u.getAsFile();f&&o.push(f);}}else if(n.files)for(let u of n.files)o.push(u);if(!o.length)return;this._error=null;let a=false;for(let u of o)this.isSupportedFile(u)?(a||(this._progress=1,a=true),this.upload(u)):this.handleUnsupportedFile(u);}handleForm(r){let n=r.target;if(n.files){n.files.length&&(this._error=null);let o=false;for(let a of n.files)this.isSupportedFile(a)?(o||(this._progress=1,o=true),this.upload(a)):this.handleUnsupportedFile(a);n.value="";}}upload(r){this.dispatchEvent(new CustomEvent("upload",{bubbles:true,composed:true,detail:{file:r}})),this._error=null;let n=new vr(r,{endpoint:chunk5STN56TL_cjs.a.upload.endpoint,retryDelays:[0,3e3,5e3,1e4,2e4,6e4,6e4],metadata:{title:r.name,filetype:r.type,token:this.token,upload_id:this._upload_id},onError:o=>{console.log(o),this.dispatchEvent(new CustomEvent("failed",{bubbles:true,composed:true,detail:o}));},onProgress:(o,a)=>{let u=Math.round(o/a*100);u>this._progress&&(this._progress=u),this.dispatchEvent(new CustomEvent("progress",{bubbles:true,composed:true,detail:{progress:u}}));},onSuccess:()=>{this._progress=100,this.dispatchEvent(new CustomEvent("processing",{bubbles:true,composed:true}));},removeFingerprintOnSuccess:true});n.findPreviousUploads().then(o=>{o.length&&n.resumeFromPreviousUpload(o[0]),n.start();});}completed(r){this.currentEmbed=r?.embed,this.disableCompletion||(this._completed=true),this.dispatchEvent(new CustomEvent("completed",{bubbles:true,composed:true,detail:r}));}rendition(r){!this.playableEmitted&&this.isPlayableRendition(r)&&(this.playableEmitted=true,this.dispatchEvent(new CustomEvent("playable",{bubbles:true,composed:true,detail:{embed:this.currentEmbed}}))),this.dispatchEvent(new CustomEvent("rendition",{bubbles:true,composed:true,detail:r}));}error(r){console.warn(`[mave-upload] ${r.message}`),this._error={reason:"upload error",message:r.message},this._progress=0,this._completed=false,this.dispatchEvent(new CustomEvent("error",{bubbles:true,detail:r}));}isPlayableRendition(r){return typeof r?.container=="string"&&r.container==="hls"&&r?.type==="video"}render(){switch(this.currentState){case "error":return this.renderError();case "uploading":return this.renderUploading();case "processing":return this.renderProcessing();case "done":return this.renderDone();default:return this.renderInitial()}}styleOpacity(){return this.languageController.loaded?this._upload_id?{}:{pointerEvents:"none",opacity:"0.5"}:{pointerEvents:"none",opacity:"0"}}styleFont(){return this.font?{fontFamily:this.font}:{fontFamily:"system-ui"}}get currentState(){return this._error?"error":this._completed?"done":this._progress>=100&&this._progress>0?"processing":this._progress>0?"uploading":"initial"}openFileDialog(){this.fileInput&&!this.fileInput.disabled&&this.fileInput.click();}findActionTarget(r){for(let n of r.composedPath())if(n instanceof HTMLElement&&n.hasAttribute("data-mave-upload-select"))return n;return null}handleActionClick(r){this.findActionTarget(r)&&(r.preventDefault(),this.openFileDialog());}handleActionKeyDown(r){if(r.key!=="Enter"&&r.key!==" ")return;this.findActionTarget(r)&&(r.preventDefault(),this.openFileDialog());}blockSubmit(r){r.preventDefault();}handleDragEnter(r){r.preventDefault(),this._dragging=true;}handleDragOver(r){r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="copy"),this._dragging=true;}handleDragLeave(r){r.preventDefault();let n=r.currentTarget,o=r.relatedTarget;if(!n){this._dragging=false;return}(!o||!(o instanceof Node)||!n.contains(o))&&(this._dragging=false);}isSupportedFile(r){let n=(r.type||"").toLowerCase(),o=exports.a.getFileExtension(r);return n.startsWith("video/")?!o||exports.a.SUPPORTED_VIDEO_EXTENSIONS.has(o):n.startsWith("audio/")?!o||exports.a.SUPPORTED_AUDIO_EXTENSIONS.has(o):o?!!(exports.a.SUPPORTED_VIDEO_EXTENSIONS.has(o)||exports.a.SUPPORTED_AUDIO_EXTENSIONS.has(o)):false}static getFileExtension(r){let n=r.name||"",o=n.lastIndexOf(".");if(!(o===-1||o===n.length-1))return n.slice(o+1).toLowerCase()}handleUnsupportedFile(r){let n={file:r,reason:"unsupported type",allowedExtensions:{video:Array.from(exports.a.SUPPORTED_VIDEO_EXTENSIONS),audio:Array.from(exports.a.SUPPORTED_AUDIO_EXTENSIONS)}};this._error=n,this._progress=0,this._completed=false,this.dispatchEvent(new CustomEvent("invalid",{bubbles:true,composed:true,detail:{...n,message:chunkPC26CFMJ_cjs.b("unsupported file type")}}));}updated(r){super.updated(r);let n=this._progress||0,o=this.currentState;this.setAttribute("state",o),this.setAttribute("progress",`${n}`),this.toggleAttribute("drag-over",this._dragging),this.toggleAttribute("ready",!!this._upload_id&&this.languageController.loaded);let a=o!==this.lastState,u=n!==this.lastProgress,f=r.has("_dragging");(a||u||f)&&this.dispatchEvent(new CustomEvent("statechange",{bubbles:true,composed:true,detail:{state:o,progress:n,dragging:this._dragging,error:this._error}})),this.lastState=o,this.lastProgress=n;}renderInitial(){let r=this.color?this.color:"#1997FF",n=this.radius?this.radius:"16px";return chunk5NSCV6C2_cjs.c`<form
1
+ 'use strict';var chunkFUSQ4EZG_cjs=require('./chunk-FUSQ4EZG.cjs'),chunkPHGKLFNF_cjs=require('./chunk-PHGKLFNF.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunk5STN56TL_cjs=require('./chunk-5STN56TL.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var Pt=chunkJHSFSCC2_cjs.a((no,Ot)=>{Ot.exports=function(t,r){if(r=r.split(":")[0],t=+t,!t)return false;switch(r){case "http":case "ws":return t!==80;case "https":case "wss":return t!==443;case "ftp":return t!==21;case "gopher":return t!==70;case "file":return false}return t!==0};});var Dt=chunkJHSFSCC2_cjs.a(Ae=>{var Vr=Object.prototype.hasOwnProperty,Wr;function kt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function Rt(e){try{return encodeURIComponent(e)}catch{return null}}function Yr(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=kt(n[1]),a=kt(n[2]);o===null||a===null||o in r||(r[o]=a);}return r}function Zr(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(Vr.call(e,o)){if(n=e[o],!n&&(n===null||n===Wr||isNaN(n))&&(n=""),o=Rt(o),n=Rt(n),o===null||n===null)continue;r.push(o+"="+n);}return r.length?t+r.join("&"):""}Ae.stringify=Zr;Ae.parse=Yr;});var Nt=chunkJHSFSCC2_cjs.a((io,It)=>{var jt=Pt(),be=Dt(),Jr=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Tt=/[\n\r\t]/g,Qr=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Lt=/:\d+$/,en=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,tn=/^[a-zA-Z]:/;function Ie(e){return (e||"").toString().replace(Jr,"")}var Fe=[["#","hash"],["?","query"],function(t,r){return L(r.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]],Ct={hash:1,query:1};function At(e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},o=typeof e,a;if(e.protocol==="blob:")n=new A(unescape(e.pathname),{});else if(o==="string"){n=new A(e,{});for(a in Ct)delete n[a];}else if(o==="object"){for(a in e)a in Ct||(n[a]=e[a]);n.slashes===void 0&&(n.slashes=Qr.test(e.href));}return n}function L(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function Ft(e,t){e=Ie(e),e=e.replace(Tt,""),t=t||{};var r=en.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],a=!!r[3],u=0,c;return o?a?(c=r[2]+r[3]+r[4],u=r[2].length+r[3].length):(c=r[2]+r[4],u=r[2].length):a?(c=r[3]+r[4],u=r[3].length):c=r[4],n==="file:"?u>=2&&(c=c.slice(2)):L(n)?c=r[4]:n?o&&(c=c.slice(2)):u>=2&&L(t.protocol)&&(c=r[4]),{protocol:n,slashes:o||L(n),slashesCount:u,rest:c}}function rn(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],a=false,u=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),u++):u&&(n===0&&(a=true),r.splice(n,1),u--);return a&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function A(e,t,r){if(e=Ie(e),e=e.replace(Tt,""),!(this instanceof A))return new A(e,t,r);var n,o,a,u,c,h,m=Fe.slice(),v=typeof t,y=this,C=0;for(v!=="object"&&v!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=be.parse),t=At(t),o=Ft(e||"",t),n=!o.protocol&&!o.slashes,y.slashes=o.slashes||n&&t.slashes,y.protocol=o.protocol||t.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||tn.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!L(y.protocol)))&&(m[3]=[/(.*)/,"pathname"]);C<m.length;C++){if(u=m[C],typeof u=="function"){e=u(e,y);continue}a=u[0],h=u[1],a!==a?y[h]=e:typeof a=="string"?(c=a==="@"?e.lastIndexOf(a):e.indexOf(a),~c&&(typeof u[2]=="number"?(y[h]=e.slice(0,c),e=e.slice(c+u[2])):(y[h]=e.slice(c),e=e.slice(0,c)))):(c=a.exec(e))&&(y[h]=c[1],e=e.slice(0,c.index)),y[h]=y[h]||n&&u[3]&&t[h]||"",u[4]&&(y[h]=y[h].toLowerCase());}r&&(y.query=r(y.query)),n&&t.slashes&&y.pathname.charAt(0)!=="/"&&(y.pathname!==""||t.pathname!=="")&&(y.pathname=rn(y.pathname,t.pathname)),y.pathname.charAt(0)!=="/"&&L(y.protocol)&&(y.pathname="/"+y.pathname),jt(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(c=y.auth.indexOf(":"),~c?(y.username=y.auth.slice(0,c),y.username=encodeURIComponent(decodeURIComponent(y.username)),y.password=y.auth.slice(c+1),y.password=encodeURIComponent(decodeURIComponent(y.password))):y.username=encodeURIComponent(decodeURIComponent(y.auth)),y.auth=y.password?y.username+":"+y.password:y.username),y.origin=y.protocol!=="file:"&&L(y.protocol)&&y.host?y.protocol+"//"+y.host:"null",y.href=y.toString();}function nn(e,t,r){var n=this;switch(e){case "query":typeof t=="string"&&t.length&&(t=(r||be.parse)(t)),n[e]=t;break;case "port":n[e]=t,jt(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case "hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case "host":n[e]=t,Lt.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case "protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case "pathname":case "hash":if(t){var o=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==o?o+t:t;}else n[e]=t;break;case "username":case "password":n[e]=encodeURIComponent(t);break;case "auth":var a=t.indexOf(":");~a?(n.username=t.slice(0,a),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(a+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t));}for(var u=0;u<Fe.length;u++){var c=Fe[u];c[4]&&(n[c[1]]=n[c[1]].toLowerCase());}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&L(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function on(e){(!e||typeof e!="function")&&(e=be.stringify);var t,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var a=o+(r.protocol&&r.slashes||L(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):r.protocol!=="file:"&&L(r.protocol)&&!n&&r.pathname!=="/"&&(a+="@"),(n[n.length-1]===":"||Lt.test(r.hostname)&&!r.port)&&(n+=":"),a+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(a+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(a+=r.hash),a}A.prototype={set:nn,toString:on};A.extractProtocol=Ft;A.location=At;A.trimLeft=Ie;A.qs=be;It.exports=A;});function J(e){"@babel/helpers - typeof";return J=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},J(e)}function _r(e,t,r){return Object.defineProperty(e,"prototype",{writable:false}),e}function Er(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xr(e,t,r){return t=fe(t),Ur(e,De()?Reflect.construct(t,r||[],fe(e).constructor):t.apply(e,r))}function Ur(e,t){if(t&&(J(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Or(e)}function Or(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&ue(e,t);}function Re(e){var t=typeof Map=="function"?new Map:void 0;return Re=function(n){if(n===null||!Rr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,o);}function o(){return kr(n,arguments,fe(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:false,writable:true,configurable:true}}),ue(o,n)},Re(e)}function kr(e,t,r){if(De())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var o=new(e.bind.apply(e,n));return r&&ue(o,r.prototype),o}function De(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (De=function(){return !!e})()}function Rr(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function ue(e,t){return ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ue(e,t)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},fe(e)}var Dr=function(e){function t(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(Er(this,t),n=xr(this,t,[r]),n.originalRequest=a,n.originalResponse=u,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),a!=null){var c=a.getHeader("X-Request-ID")||"n/a",h=a.getMethod(),m=a.getURL(),v=u?u.getStatus():"n/a",y=u?u.getBody()||"":"n/a";r+=", originated from request (method: ".concat(h,", url: ").concat(m,", response code: ").concat(v,", response text: ").concat(y,", request id: ").concat(c,")");}return n.message=r,n}return Pr(t,e),_r(t)}(Re(Error)),Q=Dr;function B(e){}function ce(e){"@babel/helpers - typeof";return ce=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ce(e)}function jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function it(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Lr(n.key),n);}}function Tr(e,t,r){return t&&it(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Lr(e){var t=Ar(e,"string");return ce(t)=="symbol"?t:t+""}function Ar(e,t){if(ce(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ce(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var at=function(){function e(){jr(this,e);}return Tr(e,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])}();var pt="3.7.5",Fr=pt,Ir=typeof atob=="function",Nr=typeof btoa=="function",te=typeof Buffer=="function",st=typeof TextDecoder=="function"?new TextDecoder:void 0,lt=typeof TextEncoder=="function"?new TextEncoder:void 0,Hr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",pe=Array.prototype.slice.call(Hr),ge=(e=>{let t={};return e.forEach((r,n)=>t[r]=n),t})(pe),Br=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,U=String.fromCharCode.bind(String),ut=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),ht=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),dt=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),yt=e=>{let t,r,n,o,a="",u=e.length%3;for(let c=0;c<e.length;){if((r=e.charCodeAt(c++))>255||(n=e.charCodeAt(c++))>255||(o=e.charCodeAt(c++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|o,a+=pe[t>>18&63]+pe[t>>12&63]+pe[t>>6&63]+pe[t&63];}return u?a.slice(0,u-3)+"===".substring(u):a},Te=Nr?e=>btoa(e):te?e=>Buffer.from(e,"binary").toString("base64"):yt,Ce=te?e=>Buffer.from(e).toString("base64"):e=>{let r=[];for(let n=0,o=e.length;n<o;n+=4096)r.push(U.apply(null,e.subarray(n,n+4096)));return Te(r.join(""))},ve=(e,t=false)=>t?ht(Ce(e)):Ce(e),qr=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?U(192|t>>>6)+U(128|t&63):U(224|t>>>12&15)+U(128|t>>>6&63)+U(128|t&63)}else {var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return U(240|t>>>18&7)+U(128|t>>>12&63)+U(128|t>>>6&63)+U(128|t&63)}},zr=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,mt=e=>e.replace(zr,qr),ft=te?e=>Buffer.from(e,"utf8").toString("base64"):lt?e=>Ce(lt.encode(e)):e=>Te(mt(e)),ee=(e,t=false)=>t?ht(ft(e)):ft(e),ct=e=>ee(e,true),Mr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,$r=e=>{switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return U((r>>>10)+55296)+U((r&1023)+56320);case 3:return U((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return U((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},gt=e=>e.replace(Mr,$r),vt=e=>{if(e=e.replace(/\s+/g,""),!Br.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(e.length&3));let t,r="",n,o;for(let a=0;a<e.length;)t=ge[e.charAt(a++)]<<18|ge[e.charAt(a++)]<<12|(n=ge[e.charAt(a++)])<<6|(o=ge[e.charAt(a++)]),r+=n===64?U(t>>16&255):o===64?U(t>>16&255,t>>8&255):U(t>>16&255,t>>8&255,t&255);return r},Le=Ir?e=>atob(dt(e)):te?e=>Buffer.from(e,"base64").toString("binary"):vt,bt=te?e=>ut(Buffer.from(e,"base64")):e=>ut(Le(e).split("").map(t=>t.charCodeAt(0))),_t=e=>bt(wt(e)),Gr=te?e=>Buffer.from(e,"base64").toString("utf8"):st?e=>st.decode(bt(e)):e=>gt(Le(e)),wt=e=>dt(e.replace(/[-_]/g,t=>t=="-"?"+":"/")),je=e=>Gr(wt(e)),Kr=e=>{if(typeof e!="string")return false;let t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return !/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},St=e=>({value:e,enumerable:false,writable:true,configurable:true}),Et=function(){let e=(t,r)=>Object.defineProperty(String.prototype,t,St(r));e("fromBase64",function(){return je(this)}),e("toBase64",function(t){return ee(this,t)}),e("toBase64URI",function(){return ee(this,true)}),e("toBase64URL",function(){return ee(this,true)}),e("toUint8Array",function(){return _t(this)});},xt=function(){let e=(t,r)=>Object.defineProperty(Uint8Array.prototype,t,St(r));e("toBase64",function(t){return ve(this,t)}),e("toBase64URI",function(){return ve(this,true)}),e("toBase64URL",function(){return ve(this,true)});},Xr=()=>{Et(),xt();},Ut={version:pt,VERSION:Fr,atob:Le,atobPolyfill:vt,btoa:Te,btoaPolyfill:yt,fromBase64:je,toBase64:ee,encode:ee,encodeURI:ct,encodeURL:ct,utob:mt,btou:gt,decode:je,isValid:Kr,fromUint8Array:ve,toUint8Array:_t,extendString:Et,extendUint8Array:xt,extendBuiltins:Xr};var Zt=chunkJHSFSCC2_cjs.b(Nt());function Ne(){return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e==="x"?t:t&3|8;return r.toString(16)})}function He(){He=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(l,i,s){l[i]=s.value;},a=typeof Symbol=="function"?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function m(l,i,s){return Object.defineProperty(l,i,{value:s,enumerable:true,configurable:true,writable:true}),l[i]}try{m({},"");}catch{m=function(s,f,d){return s[f]=d};}function v(l,i,s,f){var d=i&&i.prototype instanceof F?i:F,p=Object.create(d.prototype),g=new $(f||[]);return o(p,"_invoke",{value:Ue(l,s,g)}),p}function y(l,i,s){try{return {type:"normal",arg:l.call(i,s)}}catch(f){return {type:"throw",arg:f}}}t.wrap=v;var C="suspendedStart",ae="suspendedYield",q="executing",T="completed",S={};function F(){}function R(){}function E(){}var j={};m(j,u,function(){return this});var z=Object.getPrototypeOf,I=z&&z(z(G([])));I&&I!==r&&n.call(I,u)&&(j=I);var D=E.prototype=F.prototype=Object.create(j);function se(l){["next","throw","return"].forEach(function(i){m(l,i,function(s){return this._invoke(i,s)});});}function N(l,i){function s(d,p,g,b){var _=y(l[d],l,p);if(_.type!=="throw"){var O=_.arg,x=O.value;return x&&W(x)=="object"&&n.call(x,"__await")?i.resolve(x.__await).then(function(P){s("next",P,g,b);},function(P){s("throw",P,g,b);}):i.resolve(x).then(function(P){O.value=P,g(O);},function(P){return s("throw",P,g,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(p,g){function b(){return new i(function(_,O){s(p,g,_,O);})}return f=f?f.then(b,b):b()}});}function Ue(l,i,s){var f=C;return function(d,p){if(f===q)throw Error("Generator is already running");if(f===T){if(d==="throw")throw p;return {value:e,done:true}}for(s.method=d,s.arg=p;;){var g=s.delegate;if(g){var b=le(g,s);if(b){if(b===S)continue;return b}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(f===C)throw f=T,s.arg;s.dispatchException(s.arg);}else s.method==="return"&&s.abrupt("return",s.arg);f=q;var _=y(l,i,s);if(_.type==="normal"){if(f=s.done?T:ae,_.arg===S)continue;return {value:_.arg,done:s.done}}_.type==="throw"&&(f=T,s.method="throw",s.arg=_.arg);}}}function le(l,i){var s=i.method,f=l.iterator[s];if(f===e)return i.delegate=null,s==="throw"&&l.iterator.return&&(i.method="return",i.arg=e,le(l,i),i.method==="throw")||s!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+s+"' method")),S;var d=y(f,l.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,S;var p=d.arg;return p?p.done?(i[l.resultName]=p.value,i.next=l.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,S):p:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,S)}function Oe(l){var i={tryLoc:l[0]};1 in l&&(i.catchLoc=l[1]),2 in l&&(i.finallyLoc=l[2],i.afterLoc=l[3]),this.tryEntries.push(i);}function M(l){var i=l.completion||{};i.type="normal",delete i.arg,l.completion=i;}function $(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Oe,this),this.reset(true);}function G(l){if(l||l===""){var i=l[u];if(i)return i.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,f=function d(){for(;++s<l.length;)if(n.call(l,s))return d.value=l[s],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(W(l)+" is not iterable")}return R.prototype=E,o(D,"constructor",{value:E,configurable:true}),o(E,"constructor",{value:R,configurable:true}),R.displayName=m(E,h,"GeneratorFunction"),t.isGeneratorFunction=function(l){var i=typeof l=="function"&&l.constructor;return !!i&&(i===R||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,E):(l.__proto__=E,m(l,h,"GeneratorFunction")),l.prototype=Object.create(D),l},t.awrap=function(l){return {__await:l}},se(N.prototype),m(N.prototype,c,function(){return this}),t.AsyncIterator=N,t.async=function(l,i,s,f,d){d===void 0&&(d=Promise);var p=new N(v(l,i,s,f),d);return t.isGeneratorFunction(i)?p:p.next().then(function(g){return g.done?g.value:p.next()})},se(D),m(D,h,"Generator"),m(D,u,function(){return this}),m(D,"toString",function(){return "[object Generator]"}),t.keys=function(l){var i=Object(l),s=[];for(var f in i)s.push(f);return s.reverse(),function d(){for(;s.length;){var p=s.pop();if(p in i)return d.value=p,d.done=false,d}return d.done=true,d}},t.values=G,$.prototype={constructor:$,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var s in this)s.charAt(0)==="t"&&n.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var s=this;function f(O,x){return g.type="throw",g.arg=i,s.next=O,x&&(s.method="next",s.arg=e),!!x}for(var d=this.tryEntries.length-1;d>=0;--d){var p=this.tryEntries[d],g=p.completion;if(p.tryLoc==="root")return f("end");if(p.tryLoc<=this.prev){var b=n.call(p,"catchLoc"),_=n.call(p,"finallyLoc");if(b&&_){if(this.prev<p.catchLoc)return f(p.catchLoc,true);if(this.prev<p.finallyLoc)return f(p.finallyLoc)}else if(b){if(this.prev<p.catchLoc)return f(p.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<p.finallyLoc)return f(p.finallyLoc)}}}},abrupt:function(i,s){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var p=d;break}}p&&(i==="break"||i==="continue")&&p.tryLoc<=s&&s<=p.finallyLoc&&(p=null);var g=p?p.completion:{};return g.type=i,g.arg=s,p?(this.method="next",this.next=p.finallyLoc,S):this.complete(g)},complete:function(i,s){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&s&&(this.next=s),S},finish:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),M(f),S}},catch:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var p=d.arg;M(f);}return p}}throw Error("illegal catch attempt")},delegateYield:function(i,s,f){return this.delegate={iterator:G(i),resultName:s,nextLoc:f},this.method==="next"&&(this.arg=e),S}},t}function Ht(e,t,r,n,o,a,u){try{var c=e[a](u),h=c.value;}catch(m){r(m);return}c.done?t(h):Promise.resolve(h).then(n,o);}function an(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function u(h){Ht(a,n,o,u,c,"next",h);}function c(h){Ht(a,n,o,u,c,"throw",h);}u(void 0);})}}function Vt(e,t){return un(e)||ln(e,t)||Wt(e,t)||sn()}function sn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ln(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,u,c=[],h=true,m=false;try{if(a=(r=r.call(e)).next,t===0);else for(;!(h=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);h=!0);}catch(v){m=true,o=v;}finally{try{if(!h&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(m)throw o}}return c}}function un(e){if(Array.isArray(e))return e}function W(e){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(e)}function fn(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Wt(e))||t){r&&(e=r);var n=0,o=function(){};return {s:o,n:function(){return n>=e.length?{done:true}:{done:false,value:e[n++]}},e:function(m){throw m},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=true,u=false,c;return {s:function(){r=r.call(e);},n:function(){var m=r.next();return a=m.done,m},e:function(m){u=true,c=m;},f:function(){try{!a&&r.return!=null&&r.return();}finally{if(u)throw c}}}}function Wt(e,t){if(e){if(typeof e=="string")return Bt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Bt(e,t)}}function Bt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function qt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qt(Object(r),true).forEach(function(n){cn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function cn(e,t,r){return t=Yt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Yt(n.key),n);}}function hn(e,t,r){return t&&zt(e.prototype,t),r&&zt(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Yt(e){var t=dn(e,"string");return W(t)=="symbol"?t:t+""}function dn(e,t){if(W(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(W(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Be="tus-v1",_e="ietf-draft-03",yn={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:false,headers:{},addRequestId:false,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Qt,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:true,removeFingerprintOnSuccess:false,uploadLengthDeferred:false,uploadDataDuringCreation:false,urlStorage:null,fileReader:null,httpStack:null,protocol:Be},Jt=function(){function e(t,r){pn(this,e),"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=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=false,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null;}return hn(e,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey;}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![Be,_e].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var a=0,u=["uploadUrl","uploadSize","uploadLengthDeferred"];a<u.length;a++){var c=u[a];if(this.options[c]){this._emitError(new Error("tus: cannot use the ".concat(c," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(h){return r._fingerprint=h,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(h){if(r._source=h,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload();}).catch(function(h){r._emitError(h);});}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,a=0;this._parallelUploads=[];var u=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,c=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:gn(this._source.size,u);this._parallelUploadUrls&&c.forEach(function(v,y){v.uploadUrl=n._parallelUploadUrls[y]||null;}),this._parallelUploadUrls=new Array(c.length);var h=c.map(function(v,y){var C=0;return n._source.slice(v.start,v.end).then(function(ae){var q=ae.value;return new Promise(function(T,S){var F=re(re({},n.options),{},{uploadUrl:v.uploadUrl||null,storeFingerprintForResuming:false,removeFingerprintOnSuccess:false,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:re(re({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:T,onError:S,onProgress:function(j){a=a-C+j,C=j,n._emitProgress(a,o);},onUploadUrlAvailable:function(){n._parallelUploadUrls[y]=R.url,n._parallelUploadUrls.filter(function(j){return !!j}).length===c.length&&n._saveUploadInUrlStorage();}}),R=new e(q,F);R.start(),n._parallelUploads.push(R);})})}),m;Promise.all(h).then(function(){m=n._openRequest("POST",n.options.endpoint),m.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var v=Mt(n.options.metadata);return v!==""&&m.setHeader("Upload-Metadata",v),n._sendRequest(m,null)}).then(function(v){if(!ne(v.getStatus(),200)){n._emitHttpError(m,v,"tus: unexpected response while creating upload");return}var y=v.getHeader("Location");if(y==null){n._emitHttpError(m,v,"tus: invalid or missing Location header");return}n.url=Xt(n.options.endpoint,y),B("Created upload at ".concat(n.url)),n._emitSuccess(v);}).catch(function(v){n._emitError(v);});}},{key:"_startSingleUpload",value:function(){if(this._aborted=false,this.url!=null){B("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){B("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}this._createUpload();}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=fn(this._parallelUploads),a;try{for(o.s();!(a=o.n()).done;){var u=a.value;u.abort(r);}}catch(c){o.e(c);}finally{o.f();}}return this._req!==null&&this._req.abort(),this._aborted=true,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():e.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,a){this._emitError(new Q(o,a,r,n));}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),Kt(r,this._retryAttempt,this.options)){var a=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start();},a);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r});}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n);}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o);}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=Mt(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var a;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,a=this._addChunkToRequest(n)):(this.options.protocol===_e&&n.setHeader("Upload-Complete","?0"),a=this._sendRequest(n,null)),a.then(function(u){if(!ne(u.getStatus(),200)){r._emitHttpError(n,u,"tus: unexpected response while creating upload");return}var c=u.getHeader("Location");if(c==null){r._emitHttpError(n,u,"tus: invalid or missing Location header");return}if(r.url=Xt(r.options.endpoint,c),B("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(u),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,u):(r._offset=0,r._performUpload());});}).catch(function(u){r._emitHttpError(n,null,"tus: failed to create upload",u);});}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(a){var u=a.getStatus();if(!ne(u,200)){if(u===423){r._emitHttpError(n,a,"tus: upload is currently locked; retry later");return}if(ne(u,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,a,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var c=Number.parseInt(a.getHeader("Upload-Offset"),10);if(Number.isNaN(c)){r._emitHttpError(n,a,"tus: invalid or missing offset value");return}var h=Number.parseInt(a.getHeader("Upload-Length"),10);if(Number.isNaN(h)&&!r.options.uploadLengthDeferred&&r.options.protocol===Be){r._emitHttpError(n,a,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(c===h){r._emitProgress(h,h),r._emitSuccess(a);return}r._offset=c,r._performUpload();});}).catch(function(a){r._emitHttpError(n,null,"tus: failed to resume upload",a);});}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(a){if(!ne(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,a);}).catch(function(a){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),a);});}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,a=this._offset+this.options.chunkSize;return r.setProgressHandler(function(u){n._emitProgress(o+u,n._size);}),r.setHeader("Content-Type","application/offset+octet-stream"),(a===Number.POSITIVE_INFINITY||a>this._size)&&!this.options.uploadLengthDeferred&&(a=this._size),this._source.slice(o,a).then(function(u){var c=u.value,h=u.done,m=c!=null&&c.size?c.size:0;n.options.uploadLengthDeferred&&h&&(n._size=n._offset+m,r.setHeader("Upload-Length","".concat(n._size)));var v=n._offset+m;return !n.options.uploadLengthDeferred&&h&&v!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(v," bytes"))):c===null?n._sendRequest(r):(n.options.protocol===_e&&r.setHeader("Upload-Complete",h?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,c))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload();}},{key:"_openRequest",value:function(r,n){var o=$t(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n);}),this._urlStorageKey=null);}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o;})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return Gt(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=$t("DELETE",r,n);return Gt(o,null,n).then(function(a){if(a.getStatus()!==204)throw new Q("tus: unexpected response while terminating upload",null,o,a)}).catch(function(a){if(a instanceof Q||(a=new Q("tus: failed to terminate upload",a,o,null)),!Kt(a,0,n))throw a;var u=n.retryDelays[0],c=n.retryDelays.slice(1),h=re(re({},n),{},{retryDelays:c});return new Promise(function(m){return setTimeout(m,u)}).then(function(){return e.terminate(r,h)})})}}])}();function Mt(e){return Object.entries(e).map(function(t){var r=Vt(t,2),n=r[0],o=r[1];return "".concat(n," ").concat(Ut.encode(String(o)))}).join(",")}function ne(e,t){return e>=t&&e<t+100}function $t(e,t,r){var n=r.httpStack.createRequest(e,t);r.protocol===_e?n.setHeader("Upload-Draft-Interop-Version","5"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},a=0,u=Object.entries(o);a<u.length;a++){var c=Vt(u[a],2),h=c[0],m=c[1];n.setHeader(h,m);}if(r.addRequestId){var v=Ne();n.setHeader("X-Request-ID",v);}return n}function Gt(e,t,r){return qe.apply(this,arguments)}function qe(){return qe=an(He().mark(function e(t,r,n){var o;return He().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(typeof n.onBeforeRequest!="function"){u.next=3;break}return u.next=3,n.onBeforeRequest(t);case 3:return u.next=5,t.send(r);case 5:if(o=u.sent,typeof n.onAfterResponse!="function"){u.next=9;break}return u.next=9,n.onAfterResponse(t,o);case 9:return u.abrupt("return",o);case 10:case "end":return u.stop()}},e)})),qe.apply(this,arguments)}function mn(){var e=true;return typeof navigator<"u"&&navigator.onLine===false&&(e=false),e}function Kt(e,t,r){return r.retryDelays==null||t>=r.retryDelays.length||e.originalRequest==null?false:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(e,t,r):Qt(e)}function Qt(e){var t=e.originalResponse?e.originalResponse.getStatus():0;return (!ne(t,400)||t===409||t===423)&&mn()}function Xt(e,t){return new Zt.default(t,e).toString()}function gn(e,t){for(var r=Math.floor(e/t),n=[],o=0;o<t;o++)n.push({start:r*o,end:r*(o+1)});return n[t-1].end=e,n}Jt.defaultOptions=yn;var we=Jt;var vn=function(){return typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative"},Se=vn;function ze(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var o=n.response;t(o);},n.onerror=function(o){r(o);},n.open("GET",e),n.send();})}var bn=function(){return typeof window<"u"&&(typeof window.PhoneGap<"u"||typeof window.Cordova<"u"||typeof window.cordova<"u")},er=bn;function Me(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var o=new Uint8Array(n.result);t({value:o});},n.onerror=function(o){r(o);},n.readAsArrayBuffer(e);})}function he(e){"@babel/helpers - typeof";return he=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},he(e)}function _n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Sn(n.key),n);}}function wn(e,t,r){return t&&tr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Sn(e){var t=En(e,"string");return he(t)=="symbol"?t:t+""}function En(e,t){if(he(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(he(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var $e=function(){function e(t){_n(this,e),this._file=t,this.size=t.size;}return wn(e,[{key:"slice",value:function(r,n){if(er())return Me(this._file.slice(r,n));var o=this._file.slice(r,n),a=n>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){}}])}();function de(e){"@babel/helpers - typeof";return de=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(e)}function xn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,On(n.key),n);}}function Un(e,t,r){return t&&rr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function On(e){var t=Pn(e,"string");return de(t)=="symbol"?t:t+""}function Pn(e,t){if(de(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(de(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}function nr(e){return e===void 0?0:e.size!==void 0?e.size:e.length}function kn(e,t){if(e.concat)return e.concat(t);if(e instanceof Blob)return new Blob([e,t],{type:e.type});if(e.set){var r=new e.constructor(e.length+t.length);return r.set(e),r.set(t,e.length),r}throw new Error("Unknown data type")}var or=function(){function e(t){xn(this,e),this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=false;}return Un(e,[{key:"slice",value:function(r,n){return r<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(r,n)}},{key:"_readUntilEnoughDataOrDone",value:function(r,n){var o=this,a=n<=this._bufferOffset+nr(this._buffer);if(this._done||a){var u=this._getDataFromBuffer(r,n),c=u==null?this._done:false;return Promise.resolve({value:u,done:c})}return this._reader.read().then(function(h){var m=h.value,v=h.done;return v?o._done=true:o._buffer===void 0?o._buffer=m:o._buffer=kn(o._buffer,m),o._readUntilEnoughDataOrDone(r,n)})}},{key:"_getDataFromBuffer",value:function(r,n){r>this._bufferOffset&&(this._buffer=this._buffer.slice(r-this._bufferOffset),this._bufferOffset=r);var o=nr(this._buffer)===0;return this._done&&o?null:this._buffer.slice(0,n-r)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel();}}])}();function Y(e){"@babel/helpers - typeof";return Y=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Y(e)}function Ge(){Ge=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(l,i,s){l[i]=s.value;},a=typeof Symbol=="function"?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",h=a.toStringTag||"@@toStringTag";function m(l,i,s){return Object.defineProperty(l,i,{value:s,enumerable:true,configurable:true,writable:true}),l[i]}try{m({},"");}catch{m=function(s,f,d){return s[f]=d};}function v(l,i,s,f){var d=i&&i.prototype instanceof F?i:F,p=Object.create(d.prototype),g=new $(f||[]);return o(p,"_invoke",{value:Ue(l,s,g)}),p}function y(l,i,s){try{return {type:"normal",arg:l.call(i,s)}}catch(f){return {type:"throw",arg:f}}}t.wrap=v;var C="suspendedStart",ae="suspendedYield",q="executing",T="completed",S={};function F(){}function R(){}function E(){}var j={};m(j,u,function(){return this});var z=Object.getPrototypeOf,I=z&&z(z(G([])));I&&I!==r&&n.call(I,u)&&(j=I);var D=E.prototype=F.prototype=Object.create(j);function se(l){["next","throw","return"].forEach(function(i){m(l,i,function(s){return this._invoke(i,s)});});}function N(l,i){function s(d,p,g,b){var _=y(l[d],l,p);if(_.type!=="throw"){var O=_.arg,x=O.value;return x&&Y(x)=="object"&&n.call(x,"__await")?i.resolve(x.__await).then(function(P){s("next",P,g,b);},function(P){s("throw",P,g,b);}):i.resolve(x).then(function(P){O.value=P,g(O);},function(P){return s("throw",P,g,b)})}b(_.arg);}var f;o(this,"_invoke",{value:function(p,g){function b(){return new i(function(_,O){s(p,g,_,O);})}return f=f?f.then(b,b):b()}});}function Ue(l,i,s){var f=C;return function(d,p){if(f===q)throw Error("Generator is already running");if(f===T){if(d==="throw")throw p;return {value:e,done:true}}for(s.method=d,s.arg=p;;){var g=s.delegate;if(g){var b=le(g,s);if(b){if(b===S)continue;return b}}if(s.method==="next")s.sent=s._sent=s.arg;else if(s.method==="throw"){if(f===C)throw f=T,s.arg;s.dispatchException(s.arg);}else s.method==="return"&&s.abrupt("return",s.arg);f=q;var _=y(l,i,s);if(_.type==="normal"){if(f=s.done?T:ae,_.arg===S)continue;return {value:_.arg,done:s.done}}_.type==="throw"&&(f=T,s.method="throw",s.arg=_.arg);}}}function le(l,i){var s=i.method,f=l.iterator[s];if(f===e)return i.delegate=null,s==="throw"&&l.iterator.return&&(i.method="return",i.arg=e,le(l,i),i.method==="throw")||s!=="return"&&(i.method="throw",i.arg=new TypeError("The iterator does not provide a '"+s+"' method")),S;var d=y(f,l.iterator,i.arg);if(d.type==="throw")return i.method="throw",i.arg=d.arg,i.delegate=null,S;var p=d.arg;return p?p.done?(i[l.resultName]=p.value,i.next=l.nextLoc,i.method!=="return"&&(i.method="next",i.arg=e),i.delegate=null,S):p:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,S)}function Oe(l){var i={tryLoc:l[0]};1 in l&&(i.catchLoc=l[1]),2 in l&&(i.finallyLoc=l[2],i.afterLoc=l[3]),this.tryEntries.push(i);}function M(l){var i=l.completion||{};i.type="normal",delete i.arg,l.completion=i;}function $(l){this.tryEntries=[{tryLoc:"root"}],l.forEach(Oe,this),this.reset(true);}function G(l){if(l||l===""){var i=l[u];if(i)return i.call(l);if(typeof l.next=="function")return l;if(!isNaN(l.length)){var s=-1,f=function d(){for(;++s<l.length;)if(n.call(l,s))return d.value=l[s],d.done=false,d;return d.value=e,d.done=true,d};return f.next=f}}throw new TypeError(Y(l)+" is not iterable")}return R.prototype=E,o(D,"constructor",{value:E,configurable:true}),o(E,"constructor",{value:R,configurable:true}),R.displayName=m(E,h,"GeneratorFunction"),t.isGeneratorFunction=function(l){var i=typeof l=="function"&&l.constructor;return !!i&&(i===R||(i.displayName||i.name)==="GeneratorFunction")},t.mark=function(l){return Object.setPrototypeOf?Object.setPrototypeOf(l,E):(l.__proto__=E,m(l,h,"GeneratorFunction")),l.prototype=Object.create(D),l},t.awrap=function(l){return {__await:l}},se(N.prototype),m(N.prototype,c,function(){return this}),t.AsyncIterator=N,t.async=function(l,i,s,f,d){d===void 0&&(d=Promise);var p=new N(v(l,i,s,f),d);return t.isGeneratorFunction(i)?p:p.next().then(function(g){return g.done?g.value:p.next()})},se(D),m(D,h,"Generator"),m(D,u,function(){return this}),m(D,"toString",function(){return "[object Generator]"}),t.keys=function(l){var i=Object(l),s=[];for(var f in i)s.push(f);return s.reverse(),function d(){for(;s.length;){var p=s.pop();if(p in i)return d.value=p,d.done=false,d}return d.done=true,d}},t.values=G,$.prototype={constructor:$,reset:function(i){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=false,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!i)for(var s in this)s.charAt(0)==="t"&&n.call(this,s)&&!isNaN(+s.slice(1))&&(this[s]=e);},stop:function(){this.done=true;var i=this.tryEntries[0].completion;if(i.type==="throw")throw i.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var s=this;function f(O,x){return g.type="throw",g.arg=i,s.next=O,x&&(s.method="next",s.arg=e),!!x}for(var d=this.tryEntries.length-1;d>=0;--d){var p=this.tryEntries[d],g=p.completion;if(p.tryLoc==="root")return f("end");if(p.tryLoc<=this.prev){var b=n.call(p,"catchLoc"),_=n.call(p,"finallyLoc");if(b&&_){if(this.prev<p.catchLoc)return f(p.catchLoc,true);if(this.prev<p.finallyLoc)return f(p.finallyLoc)}else if(b){if(this.prev<p.catchLoc)return f(p.catchLoc,true)}else {if(!_)throw Error("try statement without catch or finally");if(this.prev<p.finallyLoc)return f(p.finallyLoc)}}}},abrupt:function(i,s){for(var f=this.tryEntries.length-1;f>=0;--f){var d=this.tryEntries[f];if(d.tryLoc<=this.prev&&n.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var p=d;break}}p&&(i==="break"||i==="continue")&&p.tryLoc<=s&&s<=p.finallyLoc&&(p=null);var g=p?p.completion:{};return g.type=i,g.arg=s,p?(this.method="next",this.next=p.finallyLoc,S):this.complete(g)},complete:function(i,s){if(i.type==="throw")throw i.arg;return i.type==="break"||i.type==="continue"?this.next=i.arg:i.type==="return"?(this.rval=this.arg=i.arg,this.method="return",this.next="end"):i.type==="normal"&&s&&(this.next=s),S},finish:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.finallyLoc===i)return this.complete(f.completion,f.afterLoc),M(f),S}},catch:function(i){for(var s=this.tryEntries.length-1;s>=0;--s){var f=this.tryEntries[s];if(f.tryLoc===i){var d=f.completion;if(d.type==="throw"){var p=d.arg;M(f);}return p}}throw Error("illegal catch attempt")},delegateYield:function(i,s,f){return this.delegate={iterator:G(i),resultName:s,nextLoc:f},this.method==="next"&&(this.arg=e),S}},t}function ir(e,t,r,n,o,a,u){try{var c=e[a](u),h=c.value;}catch(m){r(m);return}c.done?t(h):Promise.resolve(h).then(n,o);}function Rn(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function u(h){ir(a,n,o,u,c,"next",h);}function c(h){ir(a,n,o,u,c,"throw",h);}u(void 0);})}}function Dn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ar(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,jn(n.key),n);}}function Cn(e,t,r){return t&&ar(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function jn(e){var t=Tn(e,"string");return Y(t)=="symbol"?t:t+""}function Tn(e,t){if(Y(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Y(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var sr=function(){function e(){Dn(this,e);}return Cn(e,[{key:"openFile",value:function(){var t=Rn(Ge().mark(function n(o,a){var u;return Ge().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(Se()&&o&&typeof o.uri<"u")){h.next=11;break}return h.prev=1,h.next=4,ze(o.uri);case 4:return u=h.sent,h.abrupt("return",new $e(u));case 8:throw h.prev=8,h.t0=h.catch(1),new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(h.t0));case 11:if(!(typeof o.slice=="function"&&typeof o.size<"u")){h.next=13;break}return h.abrupt("return",Promise.resolve(new $e(o)));case 13:if(typeof o.read!="function"){h.next=18;break}if(a=Number(a),Number.isFinite(a)){h.next=17;break}return h.abrupt("return",Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option")));case 17:return h.abrupt("return",Promise.resolve(new or(o,a)));case 18:return h.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 h.stop()}},n,null,[[1,8]])}));function r(n,o){return t.apply(this,arguments)}return r}()}])}();function Ke(e,t){return Se()?Promise.resolve(Ln(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}function Ln(e,t){var r=e.exif?An(JSON.stringify(e.exif)):"noexif";return ["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}function An(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t&=t;}return t}function ye(e){"@babel/helpers - typeof";return ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ye(e)}function Xe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,Fn(n.key),n);}}function Ve(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function Fn(e){var t=In(e,"string");return ye(t)=="symbol"?t:t+""}function In(e,t){if(ye(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ye(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var ur=function(){function e(){Xe(this,e);}return Ve(e,[{key:"createRequest",value:function(r,n){return new Nn(r,n)}},{key:"getName",value:function(){return "XHRHttpStack"}}])}();var Nn=function(){function e(t,r){Xe(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,true),this._method=t,this._url=r,this._headers={};}return Ve(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._xhr.setRequestHeader(r,n),this._headers[r]=n;}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(n){n.lengthComputable&&r(n.loaded);});}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,a){r._xhr.onload=function(){o(new Hn(r._xhr));},r._xhr.onerror=function(u){a(u);},r._xhr.send(n);})}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}(),Hn=function(){function e(t){Xe(this,e),this._xhr=t;}return Ve(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(r){return this._xhr.getResponseHeader(r)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}])}();function me(e){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(e)}function Bn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,zn(n.key),n);}}function qn(e,t,r){return t&&fr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:false}),e}function zn(e){var t=Mn(e,"string");return me(t)=="symbol"?t:t+""}function Mn(e,t){if(me(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(me(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (String)(e)}var Ye=false;try{Ye="localStorage"in window,Ee="tusSupport",We=localStorage.getItem(Ee),localStorage.setItem(Ee,We),We===null&&localStorage.removeItem(Ee);}catch(e){if(e.code===e.SECURITY_ERR||e.code===e.QUOTA_EXCEEDED_ERR)Ye=false;else throw e}var Ee,We,cr=Ye,pr=function(){function e(){Bn(this,e);}return qn(e,[{key:"findAllUploads",value:function(){var r=this._findEntries("tus::");return Promise.resolve(r)}},{key:"findUploadsByFingerprint",value:function(r){var n=this._findEntries("tus::".concat(r,"::"));return Promise.resolve(n)}},{key:"removeUpload",value:function(r){return localStorage.removeItem(r),Promise.resolve()}},{key:"addUpload",value:function(r,n){var o=Math.round(Math.random()*1e12),a="tus::".concat(r,"::").concat(o);return localStorage.setItem(a,JSON.stringify(n)),Promise.resolve(a)}},{key:"_findEntries",value:function(r){for(var n=[],o=0;o<localStorage.length;o++){var a=localStorage.key(o);if(a.indexOf(r)===0)try{var u=JSON.parse(localStorage.getItem(a));u.urlStorageKey=a,n.push(u);}catch{}}return n}}])}();function ie(e){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ie(e)}function $n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false,n.configurable=true,"value"in n&&(n.writable=true),Object.defineProperty(e,gr(n.key),n);}}function Gn(e,t,r){return r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:false}),e}function Kn(e,t,r){return t=xe(t),Xn(e,mr()?Reflect.construct(t,r||[],xe(e).constructor):t.apply(e,r))}function Xn(e,t){if(t&&(ie(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Vn(e)}function Vn(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch{}return (mr=function(){return !!e})()}function xe(e){return xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},xe(e)}function Wn(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:true,configurable:true}}),Object.defineProperty(e,"prototype",{writable:false}),t&&Ze(e,t);}function Ze(e,t){return Ze=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ze(e,t)}function dr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n);}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dr(Object(r),true).forEach(function(n){Yn(e,n,r[n]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n));});}return e}function Yn(e,t,r){return t=gr(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true}):e[t]=r,e}function gr(e){var t=Zn(e,"string");return ie(t)=="symbol"?t:t+""}function Zn(e,t){if(ie(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ie(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return (t==="string"?String:Number)(e)}var yr=oe(oe({},we.defaultOptions),{},{httpStack:new ur,fileReader:new sr,urlStorage:cr?new pr:new at,fingerprint:Ke}),vr=function(e){function t(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return $n(this,t),n=oe(oe({},yr),n),Kn(this,t,[r,n])}return Wn(t,e),Gn(t,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=oe(oe({},yr),o),we.terminate(n,o)}}])}(we);exports.a=class w extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);this.disableCompletion=false;this._progress=0;this._completed=false;this._dragging=false;this._error=null;this._hasErrorSlot=false;this.playableEmitted=false;this.languageController=new chunkPHGKLFNF_cjs.d(this);this.lastState="initial";this.lastProgress=-1;}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.handleActionClick),this.addEventListener("keydown",this.handleActionKeyDown),this.languageController.locale=this.locale||"en",this.updateHasErrorSlot(),typeof MutationObserver<"u"&&(this.slotObserver=new MutationObserver(()=>{this.updateHasErrorSlot();}),this.slotObserver.observe(this,{childList:true,subtree:true,attributes:true,attributeFilter:["slot"]})),this.embedChannel=chunkFUSQ4EZG_cjs.a.connect(this.token),this.embedChannel.upload_id&&(this._upload_id=this.embedChannel.upload_id),this.embedChannel.channel.on("initiate",({upload_id:r})=>{this._upload_id=r,this.embedChannel.upload_id=r,this.playableEmitted=false;}),this.embedChannel.channel.on("completed",this.completed.bind(this)),this.embedChannel.channel.on("rendition",this.rendition.bind(this)),this.embedChannel.channel.on("error",this.error.bind(this));}requestUpdate(r,n){super.requestUpdate(r,n),r==="locale"&&(this.languageController.locale=this.locale);}reset(){this._progress=0,this._completed=false,this._error=null,this.playableEmitted=false,this.currentEmbed=void 0,this.embedChannel.channel.push("reset",{});}disconnectedCallback(){chunkFUSQ4EZG_cjs.a.disconnect(this.embedChannel),this.removeEventListener("click",this.handleActionClick),this.removeEventListener("keydown",this.handleActionKeyDown),this.slotObserver?.disconnect(),this.slotObserver=void 0,super.disconnectedCallback();}handleDrop(r){r.preventDefault(),this._dragging=false;let n=r.dataTransfer;if(!n)return;let o=this.collectFilesFromDataTransfer(n);if(!o.length)return;this._error=null;let a=false;for(let u of o)this.isSupportedFile(u)?(a||(this._progress=1,a=true),this.upload(u)):this.handleUnsupportedFile(u);}handleForm(r){let n=r.target;if(n.files){n.files.length&&(this._error=null);let o=false;for(let a of n.files)this.isSupportedFile(a)?(o||(this._progress=1,o=true),this.upload(a)):this.handleUnsupportedFile(a);n.value="";}}upload(r){this.dispatchEvent(new CustomEvent("upload",{bubbles:true,composed:true,detail:{file:r}})),this._error=null;let n=new vr(r,{endpoint:chunk5STN56TL_cjs.a.upload.endpoint,retryDelays:[0,3e3,5e3,1e4,2e4,6e4,6e4],metadata:{title:r.name,filetype:r.type,token:this.token,upload_id:this._upload_id},onError:o=>{console.log(o),this.dispatchEvent(new CustomEvent("failed",{bubbles:true,composed:true,detail:o}));},onProgress:(o,a)=>{let u=Math.round(o/a*100);u>this._progress&&(this._progress=u),this.dispatchEvent(new CustomEvent("progress",{bubbles:true,composed:true,detail:{progress:u}}));},onSuccess:()=>{this._progress=100,this.dispatchEvent(new CustomEvent("processing",{bubbles:true,composed:true}));},removeFingerprintOnSuccess:true});n.findPreviousUploads().then(o=>{o.length&&n.resumeFromPreviousUpload(o[0]),n.start();});}completed(r){this.currentEmbed=r?.embed,this.disableCompletion||(this._completed=true),this.dispatchEvent(new CustomEvent("completed",{bubbles:true,composed:true,detail:r}));}rendition(r){!this.playableEmitted&&this.isPlayableRendition(r)&&(this.playableEmitted=true,this.dispatchEvent(new CustomEvent("playable",{bubbles:true,composed:true,detail:{embed:this.currentEmbed}}))),this.dispatchEvent(new CustomEvent("rendition",{bubbles:true,composed:true,detail:r}));}error(r){console.warn(`[mave-upload] ${r.message}`),this._error={reason:"upload error",message:r.message},this._progress=0,this._completed=false,this.dispatchEvent(new CustomEvent("error",{bubbles:true,detail:r}));}isPlayableRendition(r){return typeof r?.container=="string"&&r.container==="hls"&&r?.type==="video"}updateHasErrorSlot(r){let n=!!this.querySelector('[slot="error"]');this._hasErrorSlot!==n&&(this._hasErrorSlot=n);}render(){switch(this.currentState){case "error":return this.renderError();case "uploading":return this.renderUploading();case "processing":return this.renderProcessing();case "done":return this.renderDone();default:return this.renderInitial()}}styleOpacity(){return this.languageController.loaded?this._upload_id?{}:{pointerEvents:"none",opacity:"0.5"}:{pointerEvents:"none",opacity:"0"}}styleFont(){return this.font?{fontFamily:this.font}:{fontFamily:"system-ui"}}get currentState(){return this._error?"error":this._completed?"done":this._progress>=100&&this._progress>0?"processing":this._progress>0?"uploading":"initial"}openFileDialog(){this.fileInput&&!this.fileInput.disabled&&this.fileInput.click();}findActionTarget(r){for(let n of r.composedPath())if(n instanceof HTMLElement&&n.hasAttribute("data-mave-upload-select"))return n;return null}handleActionClick(r){this.findActionTarget(r)&&(r.preventDefault(),this.openFileDialog());}handleActionKeyDown(r){if(r.key!=="Enter"&&r.key!==" ")return;this.findActionTarget(r)&&(r.preventDefault(),this.openFileDialog());}blockSubmit(r){r.preventDefault();}collectFilesFromDataTransfer(r){let n=[];if(r.items&&r.items.length){for(let o of r.items){if(o.kind!=="file")continue;let a=o.getAsFile();a&&n.push(a);}if(n.length)return n}if(r.files&&r.files.length)for(let o of r.files)n.push(o);return n}hasSupportedFiles(r){let n=this.collectFilesFromDataTransfer(r);if(n.length)return n.some(o=>this.isSupportedFile(o));if(r.items&&r.items.length)for(let o of r.items){if(o.kind!=="file")continue;let a=(o.type||"").toLowerCase();if(a.startsWith("video/")||a.startsWith("audio/"))return true}return false}handleDragEnter(r){r.preventDefault();let n=r.dataTransfer;if(!n){this._dragging=false;return}let o=this.hasSupportedFiles(n);n.dropEffect=o?"copy":"none",this._dragging=o;}handleDragOver(r){r.preventDefault();let n=r.dataTransfer;if(!n){this._dragging=false;return}let o=this.hasSupportedFiles(n);n.dropEffect=o?"copy":"none",this._dragging=o;}handleDragLeave(r){r.preventDefault();let n=r.currentTarget,o=r.relatedTarget;if(!n){this._dragging=false;return}(!o||!(o instanceof Node)||!n.contains(o))&&(this._dragging=false);}isSupportedFile(r){let n=(r.type||"").toLowerCase(),o=exports.a.getFileExtension(r);return n.startsWith("video/")?!o||exports.a.SUPPORTED_VIDEO_EXTENSIONS.has(o):n.startsWith("audio/")?!o||exports.a.SUPPORTED_AUDIO_EXTENSIONS.has(o):o?!!(exports.a.SUPPORTED_VIDEO_EXTENSIONS.has(o)||exports.a.SUPPORTED_AUDIO_EXTENSIONS.has(o)):false}static getFileExtension(r){let n=r.name||"",o=n.lastIndexOf(".");if(!(o===-1||o===n.length-1))return n.slice(o+1).toLowerCase()}handleUnsupportedFile(r){let n={file:r,reason:"unsupported type",allowedExtensions:{video:Array.from(exports.a.SUPPORTED_VIDEO_EXTENSIONS),audio:Array.from(exports.a.SUPPORTED_AUDIO_EXTENSIONS)}};this._error=n,this._progress=0,this._completed=false,this.dispatchEvent(new CustomEvent("invalid",{bubbles:true,composed:true,detail:{...n,message:chunkPHGKLFNF_cjs.b("unsupported file type")}}));}updated(r){super.updated(r);let n=this._progress||0,o=this.currentState;this.setAttribute("state",o),this.setAttribute("progress",`${n}`),this.toggleAttribute("drag-over",this._dragging),this.toggleAttribute("ready",!!this._upload_id&&this.languageController.loaded);let a=o!==this.lastState,u=n!==this.lastProgress,c=r.has("_dragging");(a||u||c)&&this.dispatchEvent(new CustomEvent("statechange",{bubbles:true,composed:true,detail:{state:o,progress:n,dragging:this._dragging,error:this._error}})),this.lastState=o,this.lastProgress=n;}renderInitial(){let r=this.color?this.color:"#1997FF",n=this.radius?this.radius:"16px";return chunk5NSCV6C2_cjs.c`<form
4
4
  class="state state--initial"
5
5
  style=${chunkQ22T22LT_cjs.a({...this.styleOpacity(),...this.styleFont()})}
6
6
  @submit=${this.blockSubmit}
@@ -10,15 +10,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
10
10
  @drop=${this.handleDrop}
11
11
  >
12
12
  <slot name="initial">
13
- <div class="upload-default-title">${chunkPC26CFMJ_cjs.b("drop video here")}</div>
14
- <div class="upload-default-subtitle">${chunkPC26CFMJ_cjs.b("or browse your files")}</div>
13
+ <div class="upload-default-title">${chunkPHGKLFNF_cjs.b("drop video here")}</div>
14
+ <div class="upload-default-subtitle">${chunkPHGKLFNF_cjs.b("or browse your files")}</div>
15
15
  <button
16
16
  type="button"
17
17
  data-mave-upload-select
18
18
  class="upload-default-button"
19
19
  style=${chunkQ22T22LT_cjs.a({background:r,borderRadius:n})}
20
20
  >
21
- ${chunkPC26CFMJ_cjs.b("select file")}
21
+ ${chunkPHGKLFNF_cjs.b("select file")}
22
22
  </button>
23
23
  </slot>
24
24
  <input
@@ -29,7 +29,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
29
29
  @change=${this.handleForm}
30
30
  hidden
31
31
  />
32
- </form>`}renderError(){let r=this.color?this.color:"#1997FF",n=this.radius?this.radius:"16px",o=this._error?.file?.name,a=this._error?.message??(this._error?.reason==="unsupported type"?chunkPC26CFMJ_cjs.b("please choose a video or audio file in a supported format."):chunkPC26CFMJ_cjs.b("something went wrong. please try again.")),u=this._error?.reason==="unsupported type"&&o;return chunk5NSCV6C2_cjs.c`<form
32
+ </form>`}renderError(){return this._hasErrorSlot?chunk5NSCV6C2_cjs.c`<form
33
33
  class="state state--error"
34
34
  style=${chunkQ22T22LT_cjs.a({...this.styleOpacity(),...this.styleFont()})}
35
35
  @submit=${this.blockSubmit}
@@ -38,23 +38,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38
38
  @dragleave=${this.handleDragLeave}
39
39
  @drop=${this.handleDrop}
40
40
  >
41
- <slot name="error">
42
- <div class="upload-default-error" role="alert">
43
- ${u?chunk5NSCV6C2_cjs.c`<div class="upload-default-error-filename">${o}</div>`:null}
44
- <div class="upload-default-error-title">
45
- ${this._error?.reason==="unsupported type"?chunkPC26CFMJ_cjs.b("unsupported file type"):chunkPC26CFMJ_cjs.b("upload failed")}
46
- </div>
47
- <div class="upload-default-error-subtitle">${a}</div>
48
- <button
49
- type="button"
50
- data-mave-upload-select
51
- class="upload-default-button"
52
- style=${chunkQ22T22LT_cjs.a({background:r,borderRadius:n})}
53
- >
54
- ${chunkPC26CFMJ_cjs.b("try again")}
55
- </button>
56
- </div>
57
- </slot>
41
+ <slot name="error" @slotchange=${this.updateHasErrorSlot}></slot>
58
42
  <input
59
43
  id="mave-upload-input"
60
44
  .disabled=${!this._upload_id}
@@ -63,7 +47,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
63
47
  @change=${this.handleForm}
64
48
  hidden
65
49
  />
66
- </form>`}renderUploading(){let r=Math.max(0,Math.min(100,this._progress||0));return chunk5NSCV6C2_cjs.c`<div class="state state--uploading" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
50
+ </form>`:this.renderInitial()}renderUploading(){let r=Math.max(0,Math.min(100,this._progress||0));return chunk5NSCV6C2_cjs.c`<div class="state state--uploading" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
67
51
  <slot name="uploading">
68
52
  <div class="upload-default-progress" role="status">
69
53
  <div
@@ -75,16 +59,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
75
59
  >
76
60
  <div class="upload-default-progress-value" style="width: ${r}%;"></div>
77
61
  </div>
78
- <div class="upload-default-progress-label">${chunkPC26CFMJ_cjs.b("uploading...")}</div>
62
+ <div class="upload-default-progress-label">${chunkPHGKLFNF_cjs.b("uploading...")}</div>
79
63
  </div>
80
64
  </slot>
81
65
  </div>`}renderProcessing(){return chunk5NSCV6C2_cjs.c`<div class="state state--processing" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
82
66
  <slot name="processing">
83
- <div class="upload-default-status" role="status">${chunkPC26CFMJ_cjs.b("just a minute...")}</div>
67
+ <div class="upload-default-status" role="status">${chunkPHGKLFNF_cjs.b("just a minute...")}</div>
84
68
  </slot>
85
69
  </div>`}renderDone(){return chunk5NSCV6C2_cjs.c`<div class="state state--done" style=${chunkQ22T22LT_cjs.a(this.styleFont())}>
86
70
  <slot name="done">
87
- <div class="upload-default-status" role="status">${chunkPC26CFMJ_cjs.b("done")}</div>
71
+ <div class="upload-default-status" role="status">${chunkPHGKLFNF_cjs.b("done")}</div>
88
72
  </slot>
89
73
  </div>`}};exports.a.SUPPORTED_VIDEO_EXTENSIONS=new Set(["3g2","3gp","avi","mov","mp4","m4v","mkv","qt","ts","mts","m2t","m2ts","webm"]),exports.a.SUPPORTED_AUDIO_EXTENSIONS=new Set(["aac","amr","flac","m4a","m4b","m4p","mp3","ogg","wav"]),exports.a.styles=chunk5NSCV6C2_cjs.h`
90
74
  :host {
@@ -219,7 +203,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
219
203
  padding-bottom: 24px;
220
204
  text-align: center;
221
205
  }
222
- `,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"token",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"locale",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"color",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"font",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"radius",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a({type:Boolean})],exports.a.prototype,"disableCompletion",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_progress",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_upload_id",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_completed",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_dragging",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_error",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c("#mave-upload-input")],exports.a.prototype,"fileInput",2),exports.a=chunkIPA5Q26W_cjs.c([chunkPC26CFMJ_cjs.a()],exports.a);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-upload")||window.customElements.define("mave-upload",exports.a));/*! Bundled license information:
206
+ `,chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"token",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"locale",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"color",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"font",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],exports.a.prototype,"radius",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a({type:Boolean})],exports.a.prototype,"disableCompletion",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_progress",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_upload_id",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_completed",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_dragging",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_error",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],exports.a.prototype,"_hasErrorSlot",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.c("#mave-upload-input")],exports.a.prototype,"fileInput",2),exports.a=chunkJHSFSCC2_cjs.c([chunkPHGKLFNF_cjs.a()],exports.a);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-upload")||window.customElements.define("mave-upload",exports.a));/*! Bundled license information:
223
207
 
224
208
  tus-js-client/lib.esm/upload.js:
225
209
  (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE *)
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkZMMJMM4X_cjs=require('./chunk-ZMMJMM4X.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var n=class extends chunk5NSCV6C2_cjs.i{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return chunkQ22T22LT_cjs.a(t)}open(t){if(this._player=t,t.aspect_ratio){let[i,s]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",i),this.style.setProperty("--frame-ratio-h",s);}this.style.display="block";let o=i=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",s=>{s.preventDefault(),this.close();},{once:true}),i(this);};return new Promise(i=>{if(this._dialog)o(i);else {let s=setInterval(()=>{this._dialog&&(o(i),clearInterval(s));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return chunk5NSCV6C2_cjs.c`
1
+ 'use strict';var chunkSTJ6CEFZ_cjs=require('./chunk-STJ6CEFZ.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var n=class extends chunk5NSCV6C2_cjs.i{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return chunkQ22T22LT_cjs.a(t)}open(t){if(this._player=t,t.aspect_ratio){let[i,s]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",i),this.style.setProperty("--frame-ratio-h",s);}this.style.display="block";let o=i=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",s=>{s.preventDefault(),this.close();},{once:true}),i(this);};return new Promise(i=>{if(this._dialog)o(i);else {let s=setInterval(()=>{this._dialog&&(o(i),clearInterval(s));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return chunk5NSCV6C2_cjs.c`
2
2
  <dialog style=${this.styles}>
3
3
  <div class="backdrop"></div>
4
4
  <div class="content" @click=${this.possibleClose}>
@@ -151,4 +151,4 @@
151
151
  background-position: center center;
152
152
  background-repeat: no-repeat;
153
153
  }
154
- `,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c("dialog")],n.prototype,"_dialog",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".content")],n.prototype,"_content",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".frame")],n.prototype,"_frame",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".backdrop")],n.prototype,"_backdrop",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"backdrop",1),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a({attribute:"backdrop-filter"})],n.prototype,"backdropFilter",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",n));function E(l){let t={};if(!l)return t;for(let o=0;o<l.attributes.length;o++){let i=l.attributes[o];t[i.name]=i.value;}return t}var x=()=>typeof document<"u"?document:void 0,_=l=>{let t=x();if(!t)return;let o=t;function i(c){let e,r,a=o.querySelector(`mave-pop[embed="${c}"]`);if(a)return r=E(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=o.querySelector("mave-pop:not([embed])");return p?(r=E(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new n,o.body.appendChild(e),{pop:e})}function s(c,e){let r=new chunkZMMJMM4X_cjs.a;if(e)for(let a in e)r.setAttribute(a,e[a]);return r.embed=c,r}function g(c){c.querySelectorAll("[x-mave-pop]").forEach(e=>{let r=e.getAttribute("x-mave-pop")||e.getAttribute("embed");if(!r)return;let{pop:a,attributes:p}=i(r);s(r,p),e.addEventListener("click",L=>{L.preventDefault();let M=o.querySelectorAll("mave-player");if(!Array.from(M).find(m=>m.popped)){let m=s(r,p);a.open(m).then(()=>{m.play();}),a.addEventListener("closed",()=>{m.pause();});}});});}g(l),new MutationObserver(c=>{for(let e of c)e.type==="childList"&&e.addedNodes.forEach(r=>{r instanceof HTMLElement&&g(r);});}).observe(o.body,{childList:true,subtree:true});},f=x();f&&(f.readyState==="loading"?f.addEventListener("DOMContentLoaded",()=>{_(f);}):setTimeout(()=>_(f),500));exports.a=n;exports.b=_;
154
+ `,chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.c("dialog")],n.prototype,"_dialog",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.c(".content")],n.prototype,"_content",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.c(".frame")],n.prototype,"_frame",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.c(".backdrop")],n.prototype,"_backdrop",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"backdrop",1),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a({attribute:"backdrop-filter"})],n.prototype,"backdropFilter",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",n));function E(l){let t={};if(!l)return t;for(let o=0;o<l.attributes.length;o++){let i=l.attributes[o];t[i.name]=i.value;}return t}var x=()=>typeof document<"u"?document:void 0,_=l=>{let t=x();if(!t)return;let o=t;function i(c){let e,r,a=o.querySelector(`mave-pop[embed="${c}"]`);if(a)return r=E(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=o.querySelector("mave-pop:not([embed])");return p?(r=E(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new n,o.body.appendChild(e),{pop:e})}function s(c,e){let r=new chunkSTJ6CEFZ_cjs.a;if(e)for(let a in e)r.setAttribute(a,e[a]);return r.embed=c,r}function g(c){c.querySelectorAll("[x-mave-pop]").forEach(e=>{let r=e.getAttribute("x-mave-pop")||e.getAttribute("embed");if(!r)return;let{pop:a,attributes:p}=i(r);s(r,p),e.addEventListener("click",L=>{L.preventDefault();let M=o.querySelectorAll("mave-player");if(!Array.from(M).find(m=>m.popped)){let m=s(r,p);a.open(m).then(()=>{m.play();}),a.addEventListener("closed",()=>{m.pause();});}});});}g(l),new MutationObserver(c=>{for(let e of c)e.type==="childList"&&e.addedNodes.forEach(r=>{r instanceof HTMLElement&&g(r);});}).observe(o.body,{childList:true,subtree:true});},f=x();f&&(f.readyState==="loading"?f.addEventListener("DOMContentLoaded",()=>{_(f);}):setTimeout(()=>_(f),500));exports.a=n;exports.b=_;
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-45FW5DBN.js';import {h,c}from'./chunk-A4GZBQEB.js';var e=class extends a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return c`<img src=${this.poster} />`}};e.styles=h`
1
+ import {a}from'./chunk-24TUG5TP.js';import {h,c}from'./chunk-A4GZBQEB.js';var e=class extends a{get poster(){return `${this.cdn_root}/${this.embedId}/poster.webp`}render(){return c`<img src=${this.poster} />`}};e.styles=h`
2
2
  :host {
3
3
  display: block;
4
4
  }
@@ -0,0 +1,20 @@
1
+ import {b as b$1}from'./chunk-HX6F65VL.js';import {a as a$1}from'./chunk-24TUG5TP.js';import {a}from'./chunk-HMISRRKC.js';import {h,c as c$1}from'./chunk-A4GZBQEB.js';import {c,e,g}from'./chunk-KA24PL7V.js';var n,l,C,x,b,v,y,z,L,T,U,f=class extends a$1{constructor(){super(...arguments);e(this,n);this.embedController=new b$1(this);}get embed(){return this._embed}set embed(t){this._embed!==t&&(this._embed=t,this.requestUpdate("embed"),this.embedController.embed=this.embed);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}render(){return c$1`
2
+ ${this.embedController.render({pending:this.renderPending,complete:t=>{if(this._data=t,!t)return;let i=g(this,n,T).call(this),e=g(this,n,U).call(this),o=this._slottedChildren.map(d=>{function m(){let r;return d.nodeName==="TEMPLATE"?r=d.content.cloneNode(true):r=d.cloneNode(true),r}if(d.getAttribute("name")=="mave-files-video"){if(!i)return;let r=m(),a=Number(this._data.created_at),h=a&&a<1e12?a*1e3:a;Number.isFinite(h)&&g(this,n,l).call(this,r,"date",new Date(h).toLocaleDateString().replaceAll("/","-"));let p=this._data.video.duration;p&&g(this,n,l).call(this,r,"duration",this.durationToTime(p));let u=this._data.video.filetype;u&&g(this,n,l).call(this,r,"filetype",u);let _=i.file_size||this._data.video.size;_&&g(this,n,l).call(this,r,"size",g(this,n,v).call(this,_));let M=g(this,n,z).call(this,i),F=i.container||"mp4",g$1=g(this,n,b).call(this,M,`${this._data.name}.${F}`);return g$1.setAttribute("aria-label","Download video"),g$1.appendChild(r),c$1`${g$1}`}if(e&&this._data.video.audio&&d.getAttribute("name")=="mave-files-audio"){let r=m(),a=e.container||"mp3";g(this,n,l).call(this,r,"filetype",a);let h=e.file_size;h&&g(this,n,l).call(this,r,"size",g(this,n,v).call(this,h));let p=g(this,n,L).call(this,e),u=g(this,n,b).call(this,p,`${this._data.name}.${a}`);return u.setAttribute("aria-label","Download audio"),u.appendChild(r),c$1`${u}`}let w=this._data.subtitles.find(r=>r.language==this._data.video.language);if(w&&d.getAttribute("name")=="mave-files-subtitles"){let r=m();g(this,n,l).call(this,r,"filetype","vtt");let a=g(this,n,b).call(this,w.path,`${this._data.name}.vtt`);return a.setAttribute("aria-label","Download subtitles"),a.appendChild(r),c$1`${a}`}});return c$1`${this._stylesheets} ${o}`}})}
3
+ `}renderPending(){return c$1`<slot style="display: none"></slot>`}};n=new WeakSet,l=function(t,i,e){let o=t.querySelector(`[slot="${i}"], [data-slot="${i}"]`);o&&(o.textContent=e,o.removeAttribute("slot"),o.removeAttribute("data-slot"));},C=function(t,i){let e=window.URL.createObjectURL(t),o=document.createElement("a");o.style.display="none",o.href=e,o.download=i,this.appendChild(o),o.click(),window.URL.revokeObjectURL(e),this.removeChild(o);},x=function(t,i){return fetch(t).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.blob()}).then(e=>g(this,n,C).call(this,e,i)).catch(e=>console.error("Something went wrong:",e))},b=function(t,i){let e=document.createElement("a");e.classList.add("link"),e.setAttribute("href",t),e.setAttribute("download",i),e.setAttribute("target","new");let o=false;return e.addEventListener("click",d=>{d.preventDefault(),!o&&(o=true,e.style.cursor="wait",e.style.opacity="0.5",g(this,n,x).call(this,t,i).then(()=>{o=false,e.style.cursor="pointer",e.style.opacity="1";}));}),e},v=function(t){let i=t/1e6;if(i<10)return `${i.toFixed(1)} MB`;let e=i%1!==0;return `${i.toFixed(e?1:0)} MB`},y=function(t){let i=this._data?.video?.version&&this._data.video.version>0?`v${this._data.video.version}/`:"";return `${this.cdn_root}/${this.embedId}/${i}${t}`},z=function(t){let i=t?.codec||"h264",e=t?.size||"hd",o=t?.container||"mp4";return g(this,n,y).call(this,`${i}_${e}.${o}`)},L=function(t){let i=t?.container||"mp3";return g(this,n,y).call(this,`audio.${i}`)},T=function(){let t=this._data?.video?.renditions||[];if(!t.length)return;let i=t.filter(o=>o.container==="mp4"&&o.codec==="h264"&&(!o.type||o.type==="video")),e=["hd","fhd","sd","qhd","uhd"];for(let o of e){let d=i.find(m=>m.size===o);if(d)return d}return i[0]||t.find(o=>o.type==="video")},U=function(){let t=this._data?.video?.renditions||[];if(t.length)return t.find(i=>i.type==="audio"||i.container==="mp3"||i.codec==="mp3")},f.styles=h`
4
+ :host {
5
+ display: block;
6
+ --link-color: #006fc6;
7
+ --link-decoration: underline;
8
+ --link-decoration-thickness: 1px;
9
+ --link-decoration-offset: 1px;
10
+ --link-cursor: pointer;
11
+ }
12
+
13
+ a {
14
+ text-decoration: var(--link-decoration);
15
+ text-decoration-thickness: var(--link-decoration-thickness);
16
+ text-underline-offset: var(--link-decoration-thickness);
17
+ color: var(--link-color);
18
+ cursor: var(--link-cursor);
19
+ }
20
+ `,c([a({type:String})],f.prototype,"embed",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-files")||window.customElements.define("mave-files",f));export{f as a};
@@ -1,10 +1,10 @@
1
- 'use strict';var chunkQJHVSRHC_cjs=require('./chunk-QJHVSRHC.cjs'),chunkH57FX4I6_cjs=require('./chunk-H57FX4I6.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var o,k,C,S,n=class extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,o);this._clickable=true;this._autoscroll=true;this._lastScrollTime=0;this.currentTime=0;}get embed(){return this._embedId}set embed(t){this._embedId!=t&&(this._embedId=t,this.captionController=new chunkQJHVSRHC_cjs.a(this,this.embed),this.reset(),this.requestUpdate("embed"));}get clickable(){return this._clickable}set clickable(t){this._clickable!=t&&(typeof t=="string"?this._clickable=t==="true"||t==="":this._clickable=t,this.requestUpdate("clickable"));}get autoscroll(){return this._autoscroll}set autoscroll(t){this._autoscroll!=t&&(typeof t=="string"?this._autoscroll=t==="true"||t==="":this._autoscroll=t,this.requestUpdate("autoscroll"));}get wordIndex(){return this._wordIndex}set wordIndex(t){if(this._wordIndex!=t&&(this._wordIndex=t,this.autoscroll)){let e=this.shadowRoot?.querySelector(`[data-word-id="word-${this.segmentIndex}-${this.wordIndex}"]`);if(e&&this._lastScrollTime+2500<Date.now()){let r=this.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.top-r.top;if(s>0){let c=this.scrollTop+s;chunkIPA5Q26W_cjs.f(this,o,k).call(this,this,c-i.height/2);}}}}get segmentIndex(){return this._segmentIndex}set segmentIndex(t){this._segmentIndex!=t&&(this._segmentIndex=t);}connectedCallback(){super.connectedCallback(),this.addEventListener("scroll",chunkIPA5Q26W_cjs.f(this,o,C).bind(this)),this.reset();}reset(){if(typeof document>"u")return;this.loop=false,this.currentTime=0,this.wordIndex=0,this.segmentIndex=0;let t=document.querySelector(`mave-player[embed="${this.embed}"]`);t&&(this.player=t,t.addEventListener("play",()=>{this.loop=true,this.loopUpdateTime();}),t.addEventListener("pause",()=>{this.loop=false;}));}updateTime(){this.currentTime=this.player.currentTime;}loopUpdateTime(){this.updateTime(),setTimeout(()=>{this.loop&&requestAnimationFrame(this.loopUpdateTime.bind(this));},10);}inRange({start:t,end:e},r,i,s){if(this.currentTime>=t&&this.currentTime<=e)return s&&(this.wordIndex=s),i&&(this.segmentIndex=i),r||true}segmentStyle(){return this.clickable?{cursor:"pointer"}:{}}wordStyle(t){return t?{"background-color":this.highlight}:{}}render(){return this.captionController?this.captionController.render({complete:t=>(this.captions=t,chunk5NSCV6C2_cjs.c`
1
+ 'use strict';var chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkQJHVSRHC_cjs=require('./chunk-QJHVSRHC.cjs'),chunkH57FX4I6_cjs=require('./chunk-H57FX4I6.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var o,k,C,S,n=class extends chunk5NSCV6C2_cjs.i{constructor(){super(...arguments);chunkJHSFSCC2_cjs.e(this,o);this._clickable=true;this._autoscroll=true;this._lastScrollTime=0;this.currentTime=0;}get embed(){return this._embedId}set embed(t){this._embedId!=t&&(this._embedId=t,this.captionController=new chunkQJHVSRHC_cjs.a(this,this.embed),this.reset(),this.requestUpdate("embed"));}get clickable(){return this._clickable}set clickable(t){this._clickable!=t&&(typeof t=="string"?this._clickable=t==="true"||t==="":this._clickable=t,this.requestUpdate("clickable"));}get autoscroll(){return this._autoscroll}set autoscroll(t){this._autoscroll!=t&&(typeof t=="string"?this._autoscroll=t==="true"||t==="":this._autoscroll=t,this.requestUpdate("autoscroll"));}get wordIndex(){return this._wordIndex}set wordIndex(t){if(this._wordIndex!=t&&(this._wordIndex=t,this.autoscroll)){let e=this.shadowRoot?.querySelector(`[data-word-id="word-${this.segmentIndex}-${this.wordIndex}"]`);if(e&&this._lastScrollTime+2500<Date.now()){let r=this.getBoundingClientRect(),i=e.getBoundingClientRect(),s=i.top-r.top;if(s>0){let c=this.scrollTop+s;chunkJHSFSCC2_cjs.g(this,o,k).call(this,this,c-i.height/2);}}}}get segmentIndex(){return this._segmentIndex}set segmentIndex(t){this._segmentIndex!=t&&(this._segmentIndex=t);}connectedCallback(){super.connectedCallback(),this.addEventListener("scroll",chunkJHSFSCC2_cjs.g(this,o,C).bind(this)),this.reset();}reset(){if(typeof document>"u")return;this.loop=false,this.currentTime=0,this.wordIndex=0,this.segmentIndex=0;let t=document.querySelector(`mave-player[embed="${this.embed}"]`);t&&(this.player=t,t.addEventListener("play",()=>{this.loop=true,this.loopUpdateTime();}),t.addEventListener("pause",()=>{this.loop=false;}));}updateTime(){this.currentTime=this.player.currentTime;}loopUpdateTime(){this.updateTime(),setTimeout(()=>{this.loop&&requestAnimationFrame(this.loopUpdateTime.bind(this));},10);}inRange({start:t,end:e},r,i,s){if(this.currentTime>=t&&this.currentTime<=e)return s&&(this.wordIndex=s),i&&(this.segmentIndex=i),r||true}segmentStyle(){return this.clickable?{cursor:"pointer"}:{}}wordStyle(t){return t?{"background-color":this.highlight}:{}}render(){return this.captionController?this.captionController.render({complete:t=>(this.captions=t,chunk5NSCV6C2_cjs.c`
2
2
  <div>
3
3
  ${this.captions.segments.map((e,r)=>chunk5NSCV6C2_cjs.c`
4
4
  <p
5
5
  data-segment-id="segment-${r}"
6
6
  style=${chunkQ22T22LT_cjs.a(this.segmentStyle())}
7
- @click=${this.clickable?chunkIPA5Q26W_cjs.f(this,o,S):chunk5NSCV6C2_cjs.f}
7
+ @click=${this.clickable?chunkJHSFSCC2_cjs.g(this,o,S):chunk5NSCV6C2_cjs.f}
8
8
  part=${chunkH57FX4I6_cjs.a(this.inRange(e,"segment"))}
9
9
  x-caption-segment-start="${e.start}"
10
10
  x-caption-segment-end="${e.end}"
@@ -32,4 +32,4 @@
32
32
  [part='word'] {
33
33
  background-color: rgba(255, 210, 42, 0.5);
34
34
  }
35
- `,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"embed",1),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"highlight",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"clickable",1),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"autoscroll",1),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],n.prototype,"currentTime",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.b()],n.prototype,"captions",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-text")||window.customElements.define("mave-text",n));exports.a=n;
35
+ `,chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"embed",1),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"highlight",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"clickable",1),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.a()],n.prototype,"autoscroll",1),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],n.prototype,"currentTime",2),chunkJHSFSCC2_cjs.c([chunkFUBUUA7Y_cjs.b()],n.prototype,"captions",2);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-text")||window.customElements.define("mave-text",n));exports.a=n;