!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).tus=e()}(function(){return function n(o,i,u){function a(t,e){if(!i[t]){if(!o[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(s)return s(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=i[t]={exports:{}},o[t][0].call(r.exports,function(e){return a(o[t][1][e]||e)},r,r.exports,n,o,i,u)}return i[t].exports}for(var s="function"==typeof require&&require,e=0;ethis._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===i(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();r.default=n},{}],8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){return"undefined"!=typeof window&&(void 0!==window.PhoneGap||void 0!==window.Cordova||void 0!==window.cordova)}},{}],9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var e=new Uint8Array(n.result);t({value:e})},n.onerror=function(e){r(e)},n.readAsArrayBuffer(e)})}},{}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){return new Promise(function(t,r){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var e=n.response;t(e)},n.onerror=function(e){r(e)},n.open("GET",e),n.send()})}},{}],11:[function(e,t,r){"use strict";function o(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);rthis._offsetBeforeRetry&&(this._retryAttempt=0),m(e,this._retryAttempt,this.options))return t=this.options.retryDelays[this._retryAttempt++],this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout(function(){r.start()},t));if("function"!=typeof this.options.onError)throw e;this.options.onError(e)}}},{key:"_emitSuccess",value:function(){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(e,t){"function"==typeof this.options.onProgress&&this.options.onProgress(e,t)}},{key:"_emitChunkComplete",value:function(e,t,r){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(e,t,r)}},{key:"_createUpload",value:function(){var r,e,n=this;this.options.endpoint?(r=this._openRequest("POST",this.options.endpoint),this.options.uploadLengthDeferred?r.setHeader("Upload-Defer-Length",1):r.setHeader("Upload-Length",this._size),""!==(e=y(this.options.metadata))&&r.setHeader("Upload-Metadata",e),(this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,this._addChunkToRequest(r)):this._sendRequest(r,null)).then(function(e){var t;g(e.getStatus(),200)?null==(t=e.getHeader("Location"))?n._emitHttpError(r,e,"tus: invalid or missing Location header"):(n.url=w(n.options.endpoint,t),(0,p.log)("Created upload at ".concat(n.url)),"function"==typeof n.options._onUploadUrlAvailable&&n.options._onUploadUrlAvailable(),0===n._size?(n._emitSuccess(),n._source.close()):n._saveUploadInUrlStorage().then(function(){n.options.uploadDataDuringCreation?n._handleUploadResponse(r,e):(n._offset=0,n._performUpload())})):n._emitHttpError(r,e,"tus: unexpected response while creating upload")}).catch(function(e){n._emitHttpError(r,null,"tus: failed to create upload",e)})):this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var o=this,i=this._openRequest("HEAD",this.url);this._sendRequest(i,null).then(function(e){var t=e.getStatus();if(!g(t,200))return 423===t?void o._emitHttpError(i,e,"tus: upload is currently locked; retry later"):(g(t,400)&&o._removeFromUrlStorage(),o.options.endpoint?(o.url=null,void o._createUpload()):void o._emitHttpError(i,e,"tus: unable to resume upload (new upload cannot be created without an endpoint)"));var r,n=parseInt(e.getHeader("Upload-Offset"),10);Number.isNaN(n)?o._emitHttpError(i,e,"tus: invalid or missing offset value"):(r=parseInt(e.getHeader("Upload-Length"),10),Number.isNaN(r)&&!o.options.uploadLengthDeferred?o._emitHttpError(i,e,"tus: invalid or missing length value"):("function"==typeof o.options._onUploadUrlAvailable&&o.options._onUploadUrlAvailable(),o._saveUploadInUrlStorage().then(function(){n===r?(o._emitProgress(r,r),o._emitSuccess()):(o._offset=n,o._performUpload())})))}).catch(function(e){o._emitHttpError(i,null,"tus: failed to resume upload",e)})}},{key:"_performUpload",value:function(){var t,r=this;this._aborted||(this.options.overridePatchMethod?(t=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):t=this._openRequest("PATCH",this.url),t.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(t).then(function(e){g(e.getStatus(),200)?r._handleUploadResponse(t,e):r._emitHttpError(t,e,"tus: unexpected response while uploading chunk")}).catch(function(e){r._aborted||r._emitHttpError(t,null,"tus: failed to upload chunk at offset ".concat(r._offset),e)}))}},{key:"_addChunkToRequest",value:function(r){var n=this,t=this._offset,e=this._offset+this.options.chunkSize;return r.setProgressHandler(function(e){n._emitProgress(t+e,n._size)}),r.setHeader("Content-Type","application/offset+octet-stream"),(e===1/0||e>this._size)&&!this.options.uploadLengthDeferred&&(e=this._size),this._source.slice(t,e).then(function(e){var t=e.value,e=e.done;return n.options.uploadLengthDeferred&&e&&(n._size=n._offset+(t&&t.size?t.size:0),r.setHeader("Upload-Length",n._size)),null===t?n._sendRequest(r):(n._emitProgress(n._offset,n._size),n._sendRequest(r,t))})}},{key:"_handleUploadResponse",value:function(e,t){var r=parseInt(t.getHeader("Upload-Offset"),10);Number.isNaN(r)?this._emitHttpError(e,t,"tus: invalid or missing offset value"):(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),(this._offset=r)===this._size?(this._emitSuccess(),this._source.close()):this._performUpload())}},{key:"_openRequest",value:function(e,t){e=v(e,t,this.options);return this._req=e}},{key:"_removeFromUrlStorage",value:function(){var t=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(e){t._emitError(e)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var t=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||null!==this._urlStorageKey)return Promise.resolve();var e={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};return this._parallelUploads?e.parallelUploadUrls=this._parallelUploadUrls:e.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,e).then(function(e){t._urlStorageKey=e})}},{key:"_sendRequest",value:function(e){return b(e,1=r.retryDelays.length||null==e.originalRequest)){if(r&&"function"==typeof r.onShouldRetry)return r.onShouldRetry(e,t,r);t=e.originalResponse?e.originalResponse.getStatus():0;return(!g(t,400)||409===t||423===t)&&(r=!0,r=!("undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine)&&r)}}function w(e,t){return new o.default(t,e).toString()}c.defaultOptions=e,r.default=c},{"./error.js":12,"./logger.js":13,"./uuid.js":16,"js-base64":20,"url-parse":23}],16:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},{}],17:[function(e,t,r){"use strict";r.byteLength=function(e){var e=f(e),t=e[0],e=e[1];return 3*(t+e)/4-e},r.toByteArray=function(e){var t,r,n=f(e),o=n[0],n=n[1],i=new l(function(e,t){return 3*(e+t)/4-t}(o,n)),u=0,a=0>16&255,i[u++]=t>>8&255,i[u++]=255&t;2===n&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,i[u++]=255&t);1===n&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,i[u++]=t>>8&255,i[u++]=255&t);return i},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,o=[],i=0,u=r-n;i>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}(n));return o.join("")}(e,i,u>2]+a[t<<4&63]+"==")):2==n&&(t=(e[r-2]<<8)+e[r-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return o.join("")};for(var a=[],s=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o>>1;case"base64":return A(e).length;default:if(o)return n?-1:j(e).length;t=(""+t).toLowerCase(),o=!0}}function r(e,t,r){var n,o=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":var i=this,u=t,a=r,s=i.length;(!a||a<0||s=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:d(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):d(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,o){var i=1,u=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;u/=i=2,a/=2,r/=2}function s(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o)for(var l=-1,f=r;f>8,n=n%256,o.push(n),o.push(r);return o}(t,e.length-r),e,r,n)}function O(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o>>10&1023|55296),f=56320|1023&f),n.push(f),o+=c}var p=n,h=p.length;if(h<=b)return String.fromCharCode.apply(String,p);for(var d="",y=0;yt&&(e+=" ... "),""},c.prototype.compare=function(e,t,r,n,o){if(P(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(r>>>=0)-(t>>>=0),a=Math.min(i,u),s=this.slice(n,o),l=e.slice(t,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||othis.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,u,a,s=!1;;)switch(n){case"hex":var l=this,f=e,c=t,p=r,h=(c=Number(c)||0,l.length-c);(!p||h<(p=Number(p)))&&(p=h),(h=f.length)/2e.length)throw new RangeError("Index out of range")}function w(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _(e,t,r,n,o){return t=+t,r>>>=0,o||w(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||w(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length,r=((e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],o=1,i=0;++i>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],o=1;0>>=0,t||y(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],o=1,i=0;++i>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,o=1,i=this[e+--n];0>>=0,t||y(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},c.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||m(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,n||m(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;0<=--o&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){e=+e,t>>>=0,n||m(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,i=1,u=0;for(this[t]=255&e;++o>0)-u&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){e=+e,t>>>=0,n||m(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,i=1,u=0;for(this[t+o]=255&e;0<=--o&&(i*=256);)e<0&&0===u&&0!==this[t+o+1]&&(u=1),this[t+o]=(e/i>>0)-u&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,1,127,-128),this[t]=255&(e=e<0?255+e+1:e),t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||m(this,e,t,4,2147483647,-2147483648),this[t]=(e=e<0?4294967295+e+1:e)>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return _(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return _(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o=(n=e.length-t>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(i=t;i>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function A(e){return S.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(E,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,r,n){for(var o=0;o=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function P(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function x(e){return e!=e}}.call(this)}.call(this,B("buffer").Buffer)},{"base64-js":17,buffer:18,ieee754:19}],19:[function(e,t,r){r.read=function(e,t,r,n,o){var i,u,a=8*o-n-1,s=(1<>1,f=-7,c=r?o-1:0,p=r?-1:1,o=e[t+c];for(c+=p,i=o&(1<<-f)-1,o>>=-f,f+=a;0>=-f,f+=n;0>1,c=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,h=n?1:-1,i=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=l):(u=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-u))<1&&(u--,n*=2),2<=(t+=1<=u+f?c/n:c*Math.pow(2,1-f))*n&&(u++,n/=2),l<=u+f?(a=0,u=l):1<=u+f?(a=(t*n-1)*Math.pow(2,o),u+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),u=0));8<=o;e[r+p]=255&a,p+=h,a/=256,o-=8);for(u=u<>18&63]+U[t>>12&63]+U[t>>6&63]+U[63&t]}return i?o.slice(0,i-3)+"===".substring(i):o}function t(e,t){return(t=void 0===t?!1:t)?r(P(e)):P(e)}function n(e){var t;return e.length<2?(t=e.charCodeAt(0))<128?e:t<2048?O(192|t>>>6)+O(128|63&t):O(224|t>>>12&15)+O(128|t>>>6&63)+O(128|63&t):(t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320),O(240|t>>>18&7)+O(128|t>>>12&63)+O(128|t>>>6&63)+O(128|63&t))}function o(e){return e.replace(x,n)}function i(e,t){return(t=void 0===t?!1:t)?r(B(e)):B(e)}function u(e){return i(e,!0)}function a(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))-65536;return O(55296+(t>>>10))+O(56320+(1023&t));case 3:return O((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return O((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}}function s(e){return e.replace(C,a)}function l(e){if(e=e.replace(/\s+/g,""),!S.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));for(var t,r,n,o="",i=0;i>16&255):64===n?O(t>>16&255,t>>8&255):O(t>>16&255,t>>8&255,255&t);return o}function f(e){return T(c(e))}function c(e){return A(e.replace(/[-_]/g,function(e){return"-"==e?"+":"/"}))}function p(e){return L(c(e))}function h(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}}function d(){function e(e,t){Object.defineProperty(String.prototype,e,h(t))}e("fromBase64",function(){return p(this)}),e("toBase64",function(e){return i(this,e)}),e("toBase64URI",function(){return i(this,!0)}),e("toBase64URL",function(){return i(this,!0)}),e("toUint8Array",function(){return f(this)})}function y(){function e(e,t){Object.defineProperty(Uint8Array.prototype,e,h(t))}e("toBase64",function(e){return t(this,e)}),e("toBase64URI",function(){return t(this,!0)}),e("toBase64URL",function(){return t(this,!0)})}var g,v="function"==typeof atob,b="function"==typeof btoa,m="function"==typeof D,w="function"==typeof TextDecoder?new TextDecoder:void 0,_="function"==typeof TextEncoder?new TextEncoder:void 0,U=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),E=(g={},U.forEach(function(e,t){return g[e]=t}),g),S=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,O=String.fromCharCode.bind(String),j="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(e,t){return void 0===t&&(t=function(e){return e}),new Uint8Array(Array.prototype.slice.call(e,0).map(t))},A=function(e){return e.replace(/[^A-Za-z0-9\+\/]/g,"")},R=b?function(e){return btoa(e)}:m?function(e){return D.from(e,"binary").toString("base64")}:e,P=m?function(e){return D.from(e).toString("base64")}:function(e){for(var t=[],r=0,n=e.length;r