@micromag/viewer-build 0.2.390 → 0.2.395
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-manifest.json +39 -41
- package/build/index.html +1 -1
- package/build/static/css/{main.7f2f5b5a.chunk.css → main.f4d95294.chunk.css} +2 -2
- package/build/static/css/main.f4d95294.chunk.css.map +1 -0
- package/build/static/js/0.738d262a.chunk.js +2 -0
- package/build/static/js/0.738d262a.chunk.js.map +1 -0
- package/build/static/js/1.8b3ff205.chunk.js +2 -0
- package/build/static/js/1.8b3ff205.chunk.js.map +1 -0
- package/build/static/js/{11.9b03ae00.chunk.js → 10.1cb3daca.chunk.js} +2 -2
- package/build/static/js/{11.9b03ae00.chunk.js.map → 10.1cb3daca.chunk.js.map} +1 -1
- package/build/static/js/{12.07f6dfbf.chunk.js → 11.e5cda4e3.chunk.js} +2 -2
- package/build/static/js/{12.07f6dfbf.chunk.js.map → 11.e5cda4e3.chunk.js.map} +1 -1
- package/build/static/js/{13.af8da627.chunk.js → 12.06c49e96.chunk.js} +2 -2
- package/build/static/js/{13.af8da627.chunk.js.map → 12.06c49e96.chunk.js.map} +1 -1
- package/build/static/js/{14.e42f0789.chunk.js → 13.6888ee8a.chunk.js} +2 -2
- package/build/static/js/{14.e42f0789.chunk.js.map → 13.6888ee8a.chunk.js.map} +1 -1
- package/build/static/js/14.06a09227.chunk.js +2 -0
- package/build/static/js/14.06a09227.chunk.js.map +1 -0
- package/build/static/js/{16.d2386b37.chunk.js → 15.be60e44e.chunk.js} +2 -2
- package/build/static/js/{16.d2386b37.chunk.js.map → 15.be60e44e.chunk.js.map} +1 -1
- package/build/static/js/4.96c340f4.chunk.js +3 -0
- package/build/static/js/{5.36556929.chunk.js.LICENSE.txt → 4.96c340f4.chunk.js.LICENSE.txt} +0 -0
- package/build/static/js/4.96c340f4.chunk.js.map +1 -0
- package/build/static/js/{7.1cc6c06d.chunk.js → 5.5555a5fa.chunk.js} +2 -2
- package/build/static/js/{7.1cc6c06d.chunk.js.map → 5.5555a5fa.chunk.js.map} +1 -1
- package/build/static/js/{2.89735343.chunk.js → 6.4ca96426.chunk.js} +2 -2
- package/build/static/js/6.4ca96426.chunk.js.map +1 -0
- package/build/static/js/{8.7d772a7e.chunk.js → 7.f9e2e742.chunk.js} +2 -2
- package/build/static/js/{8.7d772a7e.chunk.js.map → 7.f9e2e742.chunk.js.map} +1 -1
- package/build/static/js/{9.2b1ae3f1.chunk.js → 8.e3121c5a.chunk.js} +2 -2
- package/build/static/js/{9.2b1ae3f1.chunk.js.map → 8.e3121c5a.chunk.js.map} +1 -1
- package/build/static/js/9.d9e4ad43.chunk.js +2 -0
- package/build/static/js/9.d9e4ad43.chunk.js.map +1 -0
- package/build/static/js/main.c42fa4c9.chunk.js +2 -0
- package/build/static/js/main.c42fa4c9.chunk.js.map +1 -0
- package/build/static/js/runtime-main.f4f072c5.js +2 -0
- package/build/static/js/runtime-main.f4f072c5.js.map +1 -0
- package/package.json +7 -7
- package/build/static/css/main.7f2f5b5a.chunk.css.map +0 -1
- package/build/static/js/0.b8a162a9.chunk.js +0 -2
- package/build/static/js/0.b8a162a9.chunk.js.map +0 -1
- package/build/static/js/1.c7a69c3d.chunk.js +0 -2
- package/build/static/js/1.c7a69c3d.chunk.js.map +0 -1
- package/build/static/js/10.11cb5892.chunk.js +0 -2
- package/build/static/js/10.11cb5892.chunk.js.map +0 -1
- package/build/static/js/15.15c6ee58.chunk.js +0 -2
- package/build/static/js/15.15c6ee58.chunk.js.map +0 -1
- package/build/static/js/2.89735343.chunk.js.map +0 -1
- package/build/static/js/5.36556929.chunk.js +0 -3
- package/build/static/js/5.36556929.chunk.js.map +0 -1
- package/build/static/js/6.9d7e4dda.chunk.js +0 -2
- package/build/static/js/6.9d7e4dda.chunk.js.map +0 -1
- package/build/static/js/main.271c3d25.chunk.js +0 -2
- package/build/static/js/main.271c3d25.chunk.js.map +0 -1
- package/build/static/js/runtime-main.82def290.js +0 -2
- package/build/static/js/runtime-main.82def290.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[2],{485:function(e,t,r){"use strict";r.r(t),r.d(t,"Upload",(function(){return pe})),r.d(t,"canStoreURLs",(function(){return T})),r.d(t,"defaultOptions",(function(){return ce})),r.d(t,"isSupported",(function(){return ve})),r.d(t,"enableDebugLog",(function(){return m})),r.d(t,"HttpStack",(function(){return N}));var n=r(487),o=r(488),i=r.n(o);function a(e){return a="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return!t||"object"!==a(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){var t="function"===typeof Map?new Map:void 0;return l=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return c(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,e)},l(e)}function c(e,t,r){return c=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&f(o,r.prototype),o},c.apply(null,arguments)}function p(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}var h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,e);var t,r=(t=n,function(){var e,r=d(t);if(p()){var n=d(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return u(this,e)});function n(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(s(this,n),(t=r.call(this,e)).originalRequest=i,t.originalResponse=a,t.causingError=o,null!=o&&(e+=", caused by ".concat(o.toString())),null!=i){var u=i.getHeader("X-Request-ID")||"n/a",l=i.getMethod(),c=i.getURL(),p=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";e+=", originated from request (method: ".concat(l,", url: ").concat(c,", response code: ").concat(p,", response text: ").concat(f,", request id: ").concat(u,")")}return t.message=e,t}return n}(l(Error)),v=h,y=!1;function m(){y=!0}function g(e){y&&console.log(e)}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var S={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,_onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:null,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},R=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(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._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}var t,r,n;return t=e,r=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then((function(t){return e._urlStorage.findUploadsByFingerprint(t)}))}},{key:"resumeFromPreviousUpload",value:function(e){this.url=e.uploadUrl||null,this._parallelUploadUrls=e.parallelUploadUrls||null,this._urlStorageKey=e.urlStorageKey}},{key:"start",value:function(){var e=this,t=this.file;if(t)if(this.options.endpoint||this.options.uploadUrl){var r=this.options.retryDelays;null==r||"[object Array]"===Object.prototype.toString.call(r)?(this.options.parallelUploads>1&&["uploadUrl","uploadSize","uploadLengthDeferred"].forEach((function(t){e.options[t]&&e._emitError(new Error("tus: cannot use the ".concat(t," option when parallelUploads is enabled")))})),this.options.fingerprint(t,this.options).then((function(r){return g(null==r?"No fingerprint was calculated meaning that the upload cannot be stored in the URL storage.":"Calculated fingerprint: ".concat(r)),e._fingerprint=r,e._source?e._source:e.options.fileReader.openFile(t,e.options.chunkSize)})).then((function(t){e._source=t,e.options.parallelUploads>1||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()})).catch((function(t){e._emitError(t)}))):this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var t=this,r=this._size=this._source.size,n=0;this._parallelUploads=[];var o=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,i=function(e,t,r){for(var n=Math.floor(e/t),o=[],i=0;i<t;i++)o.push({start:n*i,end:n*(i+1)});return o[t-1].end=e,r&&o.forEach((function(e,t){e.uploadUrl=r[t]||null})),o}(this._source.size,o,this._parallelUploadUrls);this._parallelUploadUrls=new Array(i.length);var a,s=i.map((function(o,a){var s=0;return t._source.slice(o.start,o.end).then((function(u){var l=u.value;return new Promise((function(u,c){var p=b({},t.options,{uploadUrl:o.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,metadata:{},headers:b({},t.options.headers,{"Upload-Concat":"partial"}),onSuccess:u,onError:c,onProgress:function(e){n=n-s+e,s=e,t._emitProgress(n,r)},_onUploadUrlAvailable:function(){t._parallelUploadUrls[a]=f.url,t._parallelUploadUrls.filter((function(e){return!!e})).length===i.length&&t._saveUploadInUrlStorage()}}),f=new e(l,p);f.start(),t._parallelUploads.push(f)}))}))}));Promise.all(s).then((function(){(a=t._openRequest("POST",t.options.endpoint)).setHeader("Upload-Concat","final;".concat(t._parallelUploadUrls.join(" ")));var e=k(t.options.metadata);return""!==e&&a.setHeader("Upload-Metadata",e),t._sendRequest(a,null)})).then((function(e){if(P(e.getStatus(),200)){var r=e.getHeader("Location");null!=r?(t.url=A(t.options.endpoint,r),g("Created upload at ".concat(t.url)),t._emitSuccess()):t._emitHttpError(a,e,"tus: invalid or missing Location header")}else t._emitHttpError(a,e,"tus: unexpected response while creating upload")})).catch((function(e){t._emitError(e)}))}},{key:"_startSingleUpload",value:function(){if(this.options.uploadLengthDeferred)this._size=null;else if(null!=this.options.uploadSize){if(this._size=+this.options.uploadSize,isNaN(this._size))return void this._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(this._size=this._source.size,null==this._size)return void this._emitError(new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option"));return this._aborted=!1,null!=this.url?(g("Resuming upload from previous URL: ".concat(this.url)),void this._resumeUpload()):null!=this.options.uploadUrl?(g("Resuming upload from provided URL: ".concat(this.options.url)),this.url=this.options.uploadUrl,void this._resumeUpload()):(g("Creating a new upload"),void this._createUpload())}},{key:"abort",value:function(t){var r=this;if(arguments.length>1&&"function"===typeof arguments[1])throw new Error("tus: the abort function does not accept a callback since v2 anymore; please use the returned Promise instead");return null!=this._parallelUploads&&this._parallelUploads.forEach((function(e){e.abort(t)})),null!==this._req&&(this._req.abort(),this._source.close()),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),t&&null!=this.url?e.terminate(this.url,this.options).then((function(){return r._removeFromUrlStorage()})):Promise.resolve()}},{key:"_emitHttpError",value:function(e,t,r,n){this._emitError(new v(r,n,e,t))}},{key:"_emitError",value:function(e){var t=this;if(!this._aborted){if(null!=this.options.retryDelays&&(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),x(e,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){t.start()}),r))}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 e=this;if(this.options.endpoint){var t=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?t.setHeader("Upload-Defer-Length",1):t.setHeader("Upload-Length",this._size);var r,n=k(this.options.metadata);""!==n&&t.setHeader("Upload-Metadata",n),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(t)):r=this._sendRequest(t,null),r.then((function(r){if(P(r.getStatus(),200)){var n=r.getHeader("Location");if(null!=n){if(e.url=A(e.options.endpoint,n),g("Created upload at ".concat(e.url)),"function"===typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),0===e._size)return e._emitSuccess(),void e._source.close();e._saveUploadInUrlStorage(),e.options.uploadDataDuringCreation?e._handleUploadResponse(t,r):(e._offset=0,e._performUpload())}else e._emitHttpError(t,r,"tus: invalid or missing Location header")}else e._emitHttpError(t,r,"tus: unexpected response while creating upload")})).catch((function(r){e._emitHttpError(t,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var e=this,t=this._openRequest("HEAD",this.url);this._sendRequest(t,null).then((function(r){var n=r.getStatus();if(!P(n,200))return P(n,400)&&e._removeFromUrlStorage(),423===n?void e._emitHttpError(t,r,"tus: upload is currently locked; retry later"):e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitHttpError(t,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)");var o=parseInt(r.getHeader("Upload-Offset"),10);if(isNaN(o))e._emitHttpError(t,r,"tus: invalid or missing offset value");else{var i=parseInt(r.getHeader("Upload-Length"),10);if(!isNaN(i)||e.options.uploadLengthDeferred){if("function"===typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),o===i)return e._emitProgress(i,i),void e._emitSuccess();e._offset=o,e._performUpload()}else e._emitHttpError(t,r,"tus: invalid or missing length value")}})).catch((function(r){e._emitHttpError(t,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var e,t=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(e).then((function(r){P(r.getStatus(),200)?t._handleUploadResponse(e,r):t._emitHttpError(e,r,"tus: unexpected response while uploading chunk")})).catch((function(r){t._aborted||t._emitHttpError(e,null,"tus: failed to upload chunk at offset ".concat(t._offset),r)})))}},{key:"_addChunkToRequest",value:function(e){var t=this,r=this._offset,n=this._offset+this.options.chunkSize;return e.setProgressHandler((function(e){t._emitProgress(r+e,t._size)})),e.setHeader("Content-Type","application/offset+octet-stream"),(n===1/0||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n).then((function(r){var n=r.value,o=r.done;return t.options.uploadLengthDeferred&&o&&(t._size=t._offset+(n&&n.size?n.size:0),e.setHeader("Upload-Length",t._size)),null===n?t._sendRequest(e):(t._emitProgress(t._offset,t._size),t._sendRequest(e,n))}))}},{key:"_handleUploadResponse",value:function(e,t){var r=parseInt(t.getHeader("Upload-Offset"),10);if(isNaN(r))this._emitHttpError(e,t,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r==this._size)return this._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(e,t){var r=O(e,t,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(t){e._emitError(t)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var e=this;if(this.options.storeFingerprintForResuming&&this._fingerprint){var t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then((function(t){return e._urlStorageKey=t})).catch((function(t){e._emitError(t)}))}}},{key:"_sendRequest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return E(e,t,this.options)}}],n=[{key:"terminate",value:function(t,r){if(arguments.length>1&&"function"===typeof arguments[arguments.length-1])throw new Error("tus: the terminate function does not accept a callback since v2 anymore; please use the returned Promise instead");void 0===r&&(r={});var n=O("DELETE",t,r);return E(n,null,r).then((function(e){if(204!==e.getStatus())throw new v("tus: unexpected response while terminating upload",null,n,e)})).catch((function(o){if(o instanceof v||(o=new v("tus: failed to terminate upload",o,n,null)),!x(o,0,r))throw o;var i=r.retryDelays[0],a=r.retryDelays.slice(1),s=b({},r,{retryDelays:a});return new Promise((function(e){return setTimeout(e,i)})).then((function(){return e.terminate(t,s)}))}))}}],r&&U(t.prototype,r),n&&U(t,n),e}();function k(e){var t=[];for(var r in e)t.push("".concat(r," ").concat(n.Base64.encode(e[r])));return t.join(",")}function P(e,t){return e>=t&&e<t+100}function O(e,t,r){var n=r.httpStack.createRequest(e,t);n.setHeader("Tus-Resumable","1.0.0");var o=r.headers||{};for(var i in o)n.setHeader(i,o[i]);if(r.addRequestId){var a="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)}));n.setHeader("X-Request-ID",a)}return n}function E(e,t,r){return("function"===typeof r.onBeforeRequest?Promise.resolve(r.onBeforeRequest(e)):Promise.resolve()).then((function(){return e.send(t).then((function(t){return("function"===typeof r.onAfterResponse?Promise.resolve(r.onAfterResponse(e,t)):Promise.resolve()).then((function(){return t}))}))}))}function x(e,t,r){if(null==r.retryDelays||t>=r.retryDelays.length||null==e.originalRequest)return!1;if(r&&"function"===typeof r.onShouldRetry)return r.onShouldRetry(e,t,r);var n=e.originalResponse?e.originalResponse.getStatus():0;return(!P(n,400)||409===n||423===n)&&function(){var e=!0;return"undefined"!==typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(e=!1),e}()}function A(e,t){return new i.a(t,e).toString()}R.defaultOptions=S;var C=R;function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var F=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,(r=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(e){return Promise.resolve([])}},{key:"removeUpload",value:function(e){return Promise.resolve()}},{key:"addUpload",value:function(e,t){return Promise.resolve(null)}}])&&j(t.prototype,r),n&&j(t,n),e}();function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var q=!1;try{q="localStorage"in window;var z="tusSupport";localStorage.setItem(z,localStorage.getItem(z))}catch(ye){if(ye.code!==ye.SECURITY_ERR&&ye.code!==ye.QUOTA_EXCEEDED_ERR)throw ye;q=!1}var T=q,H=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,r=[{key:"findAllUploads",value:function(){var e=this._findEntries("tus::");return Promise.resolve(e)}},{key:"findUploadsByFingerprint",value:function(e){var t=this._findEntries("tus::".concat(e,"::"));return Promise.resolve(t)}},{key:"removeUpload",value:function(e){return localStorage.removeItem(e),Promise.resolve()}},{key:"addUpload",value:function(e,t){var r=Math.round(1e12*Math.random()),n="tus::".concat(e,"::").concat(r);return localStorage.setItem(n,JSON.stringify(t)),Promise.resolve(n)}},{key:"_findEntries",value:function(e){for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);if(0===n.indexOf(e))try{var o=JSON.parse(localStorage.getItem(n));o.urlStorageKey=n,t.push(o)}catch(ye){}}return t}}],r&&D(t.prototype,r),n&&D(t,n),e}();function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e,t,r){return t&&L(e.prototype,t),r&&L(e,r),e}var N=function(){function e(){B(this,e)}return I(e,[{key:"createRequest",value:function(e,t){return new M(e,t)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),e}(),M=function(){function e(t,r){B(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,!0),this._method=t,this._url=r,this._headers={}}return I(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(e,t){this._xhr.setRequestHeader(e,t),this._headers[e]=t}},{key:"getHeader",value:function(e){return this._headers[e]}},{key:"setProgressHandler",value:function(e){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(t){t.lengthComputable&&e(t.loaded)})}},{key:"send",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,n){e._xhr.onload=function(){r(new K(e._xhr))},e._xhr.onerror=function(e){n(e)},e._xhr.send(t)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),K=function(){function e(t){B(this,e),this._xhr=t}return I(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(e){return this._xhr.getResponseHeader(e)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),X=function(){return"undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};var J=function(){return"undefined"!=typeof window&&("undefined"!=typeof window.PhoneGap||"undefined"!=typeof window.Cordova||"undefined"!=typeof window.cordova)};function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Q(e,t,r){return t&&G(e.prototype,t),r&&G(e,r),e}var V=function(){function e(t){Z(this,e),this._file=t,this.size=t.size}return Q(e,[{key:"slice",value:function(e,t){if(J())return r=this._file.slice(e,t),new Promise((function(e,t){var n=new FileReader;n.onload=function(){var t=new Uint8Array(n.result);e({value:t})},n.onerror=function(e){t(e)},n.readAsArrayBuffer(r)}));var r,n=this._file.slice(e,t);return Promise.resolve({value:n})}},{key:"close",value:function(){}}]),e}(),W=function(){function e(t,r){Z(this,e),this._chunkSize=r,this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1}return Q(e,[{key:"slice",value:function(e,t){return e<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(e,t)}},{key:"_readUntilEnoughDataOrDone",value:function(e,t){var r=this,n=t<=this._bufferOffset+Y(this._buffer);if(this._done||n){var o=this._getDataFromBuffer(e,t),i=null==o&&this._done;return Promise.resolve({value:o,done:i})}return this._reader.read().then((function(n){var o=n.value;return n.done?r._done=!0:void 0===r._buffer?r._buffer=o:r._buffer=function(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")}(r._buffer,o),r._readUntilEnoughDataOrDone(e,t)}))}},{key:"_getDataFromBuffer",value:function(e,t){e>this._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===Y(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),e}();function Y(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var $=function(){function e(){Z(this,e)}return Q(e,[{key:"openFile",value:function(e,t){return X()&&e&&"undefined"!==typeof e.uri?(r=e.uri,new Promise((function(e,t){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=n.response;e(t)},n.onerror=function(e){t(e)},n.open("GET",r),n.send()}))).then((function(e){return new V(e)})).catch((function(e){throw new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(e))})):"function"===typeof e.slice&&"undefined"!==typeof e.size?Promise.resolve(new V(e)):"function"===typeof e.read?(t=+t,isFinite(t)?Promise.resolve(new W(e,t)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment"));var r}}]),e}();function ee(e){return ee="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ne(e,t)}function oe(e,t){return!t||"object"!==ee(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(ye){return!1}}function ae(e){return ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ae(e)}function se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?se(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ce=ue({},C.defaultOptions,{httpStack:new N,fileReader:new $,urlStorage:T?new H:new F,fingerprint:function(e,t){return X()?Promise.resolve(function(e,t){var r=e.exif?function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return t}(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}}),pe=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ne(e,t)}(a,e);var t,r,n,o,i=(t=a,function(){var e,r=ae(t);if(ie()){var n=ae(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return oe(this,e)});function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return te(this,a),t=ue({},ce,{},t),i.call(this,e,t)}return r=a,o=[{key:"terminate",value:function(e,t,r){return t=ue({},ce,{},t),C.terminate(e,t,r)}}],(n=null)&&re(r.prototype,n),o&&re(r,o),a}(C),fe=window,de=fe.XMLHttpRequest,he=fe.Blob,ve=de&&he&&"function"===typeof he.prototype.slice},486:function(e,t,r){"use strict";var n,o,i=r(29),a=r(19),s=r(20),u=r(56),l=r(24),c=r(25),p=r(149),f=r(485),d=r(452),h=d.Provider,v=d.RequestClient,y=d.Socket,m=r(470),g=r(471),_=r(472),b=r(473),w=r(454),U=r(474),S=r(475).RateLimitedQueue,R=r(229),k=r(491),P={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1};e.exports=(o=n=function(e){l(r,e);var t=c(r);function r(e,n){var o;a(this,r),(o=t.call(this,e,n)).type="uploader",o.id=o.opts.id||"Tus",o.title="Tus";if(o.opts=i(i({},{useFastRemoteRetry:!0,limit:5,retryDelays:[0,1e3,3e3,5e3],withCredentials:!1}),n),"autoRetry"in n)throw new Error("The `autoRetry` option was deprecated and has been removed.");return o.requests=new S(o.opts.limit),o.uploaders=Object.create(null),o.uploaderEvents=Object.create(null),o.uploaderSockets=Object.create(null),o.handleResetProgress=o.handleResetProgress.bind(u(o)),o.handleUpload=o.handleUpload.bind(u(o)),o}return s(r,[{key:"handleResetProgress",value:function(){var e=i({},this.uppy.getState().files);Object.keys(e).forEach((function(t){if(e[t].tus&&e[t].tus.uploadUrl){var r=i({},e[t].tus);delete r.uploadUrl,e[t]=i(i({},e[t]),{},{tus:r})}})),this.uppy.setState({files:e})}},{key:"resetUploaderReferences",value:function(e,t){if(void 0===t&&(t={}),this.uploaders[e]){var r=this.uploaders[e];r.abort(),t.abort&&r.abort(!0),this.uploaders[e]=null}this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null),this.uploaderSockets[e]&&(this.uploaderSockets[e].close(),this.uploaderSockets[e]=null)}},{key:"upload",value:function(e){var t=this;return this.resetUploaderReferences(e.id),new Promise((function(r,n){t.uppy.emit("upload-started",e);var o=i(i({},t.opts),e.tus||{});"function"===typeof o.headers&&(o.headers=o.headers(e));var a=i(i({},P),o);a.fingerprint=k(e),a.onBeforeRequest=function(e){e.getUnderlyingObject().withCredentials=!!o.withCredentials,"function"===typeof o.onBeforeRequest&&o.onBeforeRequest(e)},a.onError=function(r){t.uppy.log(r);var o=r.originalRequest?r.originalRequest.getUnderlyingObject():null;U(o)&&(r=new w(r,o)),t.resetUploaderReferences(e.id),c.done(),t.uppy.emit("upload-error",e,r),n(r)},a.onProgress=function(r,n){t.onReceiveUploadUrl(e,l.url),t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:r,bytesTotal:n})},a.onSuccess=function(){var n={uploadURL:l.url};t.resetUploaderReferences(e.id),c.done(),t.uppy.emit("upload-success",e,n),l.url&&t.uppy.log("Download ".concat(l.file.name," from ").concat(l.url)),r(l)};var s=function(e,t,r){R(e,t)&&!R(e,r)&&(e[r]=e[t])},u={};(Array.isArray(o.metaFields)?o.metaFields:Object.keys(e.meta)).forEach((function(t){u[t]=e.meta[t]})),s(u,"type","filetype"),s(u,"name","filename"),a.metadata=u;var l=new f.Upload(e.data,a);t.uploaders[e.id]=l,t.uploaderEvents[e.id]=new b(t.uppy),l.findPreviousUploads().then((function(r){var n=r[0];n&&(t.uppy.log("[Tus] Resuming upload of ".concat(e.id," started at ").concat(n.creationTime)),l.resumeFromPreviousUpload(n))}));var c=t.requests.run((function(){return e.isPaused||l.start(),function(){}}));t.onFileRemove(e.id,(function(n){c.abort(),t.resetUploaderReferences(e.id,{abort:!!l.url}),r("upload ".concat(n," was removed"))})),t.onPause(e.id,(function(e){e?(c.abort(),l.abort()):(c.abort(),c=t.requests.run((function(){return l.start(),function(){}})))})),t.onPauseAll(e.id,(function(){c.abort(),l.abort()})),t.onCancelAll(e.id,(function(){c.abort(),t.resetUploaderReferences(e.id,{abort:!!l.url}),r("upload ".concat(e.id," was canceled"))})),t.onResumeAll(e.id,(function(){c.abort(),e.error&&l.abort(),c=t.requests.run((function(){return l.start(),function(){}}))}))})).catch((function(r){throw t.uppy.emit("upload-error",e,r),r}))}},{key:"uploadRemote",value:function(e){var t=this;this.resetUploaderReferences(e.id);var r=i({},this.opts);return e.tus&&Object.assign(r,e.tus),this.uppy.emit("upload-started",e),this.uppy.log(e.remote.url),e.serverToken?this.connectToServerSocket(e):new Promise((function(n,o){new(e.remote.providerOptions.provider?h:v)(t.uppy,e.remote.providerOptions).post(e.remote.url,i(i({},e.remote.body),{},{endpoint:r.endpoint,uploadUrl:r.uploadUrl,protocol:"tus",size:e.data.size,headers:r.headers,metadata:e.meta})).then((function(r){return t.uppy.setFileState(e.id,{serverToken:r.token}),e=t.uppy.getFile(e.id),t.connectToServerSocket(e)})).then((function(){n()})).catch((function(r){t.uppy.emit("upload-error",e,r),o(r)}))}))}},{key:"connectToServerSocket",value:function(e){var t=this;return new Promise((function(r,n){var o=e.serverToken,i=g(e.remote.companionUrl),a=new y({target:"".concat(i,"/api/").concat(o),autoOpen:!1});t.uploaderSockets[e.id]=a,t.uploaderEvents[e.id]=new b(t.uppy),t.onFileRemove(e.id,(function(){s.abort(),a.send("cancel",{}),t.resetUploaderReferences(e.id),r("upload ".concat(e.id," was removed"))})),t.onPause(e.id,(function(e){e?(s.abort(),a.send("pause",{})):(s.abort(),s=t.requests.run((function(){return a.send("resume",{}),function(){}})))})),t.onPauseAll(e.id,(function(){s.abort(),a.send("pause",{})})),t.onCancelAll(e.id,(function(){s.abort(),a.send("cancel",{}),t.resetUploaderReferences(e.id),r("upload ".concat(e.id," was canceled"))})),t.onResumeAll(e.id,(function(){s.abort(),e.error&&a.send("pause",{}),s=t.requests.run((function(){return a.send("resume",{}),function(){}}))})),t.onRetry(e.id,(function(){a.isOpen&&(a.send("pause",{}),a.send("resume",{}))})),t.onRetryAll(e.id,(function(){a.isOpen&&(a.send("pause",{}),a.send("resume",{}))})),a.on("progress",(function(r){return m(t,r,e)})),a.on("error",(function(r){var o=r.error.message,i=Object.assign(new Error(o),{cause:r.error});t.opts.useFastRemoteRetry?a.close():(t.resetUploaderReferences(e.id),t.uppy.setFileState(e.id,{serverToken:null})),t.uppy.emit("upload-error",e,i),s.done(),n(i)})),a.on("success",(function(n){var o={uploadURL:n.url};t.uppy.emit("upload-success",e,o),t.resetUploaderReferences(e.id),s.done(),r()}));var s=t.requests.run((function(){return a.open(),e.isPaused&&a.send("pause",{}),function(){}}))}))}},{key:"onReceiveUploadUrl",value:function(e,t){var r=this.uppy.getFile(e.id);r&&(r.tus&&r.tus.uploadUrl===t||(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:i(i({},r.tus),{},{uploadUrl:t})})))}},{key:"onFileRemove",value:function(e,t){this.uploaderEvents[e].on("file-removed",(function(r){e===r.id&&t(r.id)}))}},{key:"onPause",value:function(e,t){this.uploaderEvents[e].on("upload-pause",(function(r,n){e===r&&t(n)}))}},{key:"onRetry",value:function(e,t){this.uploaderEvents[e].on("upload-retry",(function(r){e===r&&t()}))}},{key:"onRetryAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("retry-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onPauseAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("pause-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onCancelAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("cancel-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onResumeAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("resume-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"uploadFiles",value:function(e){var t=this,r=e.map((function(r,n){var o=n+1,i=e.length;return"error"in r&&r.error?Promise.reject(new Error(r.error)):r.isRemote?(r.progress.uploadStarted&&r.isRestored||t.uppy.emit("upload-started",r),t.uploadRemote(r,o,i)):(r.progress.uploadStarted&&r.isRestored||t.uppy.emit("upload-started",r),t.upload(r,o,i))}));return _(r)}},{key:"handleUpload",value:function(e){var t=this;if(0===e.length)return this.uppy.log("[Tus] No files to upload"),Promise.resolve();0===this.opts.limit&&this.uppy.log("[Tus] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");var r=e.map((function(e){return t.uppy.getFile(e)}));return this.uploadFiles(r).then((function(){return null}))}},{key:"install",value:function(){this.uppy.setState({capabilities:i(i({},this.uppy.getState().capabilities),{},{resumableUploads:!0})}),this.uppy.addUploader(this.handleUpload),this.uppy.on("reset-progress",this.handleResetProgress)}},{key:"uninstall",value:function(){this.uppy.setState({capabilities:i(i({},this.uppy.getState().capabilities),{},{resumableUploads:!1})}),this.uppy.removeUploader(this.handleUpload)}}]),r}(p),n.VERSION="2.1.2",o)},487:function(e,t,r){(function(r){var n;!function(r,o){e.exports=function(r){"use strict";var o,i=(r=r||{}).Base64,a="2.6.4",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=function(e){for(var t={},r=0,n=e.length;r<n;r++)t[e.charAt(r)]=r;return t}(s),l=String.fromCharCode,c=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?l(192|t>>>6)+l(128|63&t):l(224|t>>>12&15)+l(128|t>>>6&63)+l(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return l(240|t>>>18&7)+l(128|t>>>12&63)+l(128|t>>>6&63)+l(128|63&t)},p=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(e){return e.replace(p,c)},d=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[s.charAt(r>>>18),s.charAt(r>>>12&63),t>=2?"=":s.charAt(r>>>6&63),t>=1?"=":s.charAt(63&r)].join("")},h=r.btoa&&"function"==typeof r.btoa?function(e){return r.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,d)},v=function(e){return h(f(String(e)))},y=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},m=function(e,t){return t?y(v(e)):v(e)},g=function(e){return m(e,!0)};r.Uint8Array&&(o=function(e,t){for(var r="",n=0,o=e.length;n<o;n+=3){var i=e[n],a=e[n+1],u=e[n+2],l=i<<16|a<<8|u;r+=s.charAt(l>>>18)+s.charAt(l>>>12&63)+("undefined"!=typeof a?s.charAt(l>>>6&63):"=")+("undefined"!=typeof u?s.charAt(63&l):"=")}return t?y(r):r});var _,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=function(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 l(55296+(t>>>10))+l(56320+(1023&t));case 3:return l((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return l((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},U=function(e){return e.replace(b,w)},S=function(e){var t=e.length,r=t%4,n=(t>0?u[e.charAt(0)]<<18:0)|(t>1?u[e.charAt(1)]<<12:0)|(t>2?u[e.charAt(2)]<<6:0)|(t>3?u[e.charAt(3)]:0),o=[l(n>>>16),l(n>>>8&255),l(255&n)];return o.length-=[0,0,2,1][r],o.join("")},R=r.atob&&"function"==typeof r.atob?function(e){return r.atob(e)}:function(e){return e.replace(/\S{1,4}/g,S)},k=function(e){return R(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},P=function(e){return U(R(e))},O=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},E=function(e){return P(O(e))};r.Uint8Array&&(_=function(e){return Uint8Array.from(k(O(e)),(function(e){return e.charCodeAt(0)}))});var x=function(){var e=r.Base64;return r.Base64=i,e};if(r.Base64={VERSION:a,atob:k,btoa:h,fromBase64:E,toBase64:m,utob:f,encode:m,encodeURI:g,btou:U,decode:E,noConflict:x,fromUint8Array:o,toUint8Array:_},"function"===typeof Object.defineProperty){var A=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};r.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",A((function(){return E(this)}))),Object.defineProperty(String.prototype,"toBase64",A((function(e){return m(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",A((function(){return m(this,!0)})))}}r.Meteor&&(Base64=r.Base64);e.exports?e.exports.Base64=r.Base64:void 0===(n=function(){return r.Base64}.apply(t,[]))||(e.exports=n);return{Base64:r.Base64}}(r)}("undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof r?r:this)}).call(this,r(49))},488:function(e,t,r){"use strict";(function(t){var n=r(489),o=r(490),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,s=/^[a-zA-Z]:/,u=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function l(e){return(e||"").toString().replace(u,"")}var c=[["#","hash"],["?","query"],function(e,t){return d(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],p={hash:1,query:1};function f(e){var r,n=("undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{}).location||{},o={},a=typeof(e=e||n);if("blob:"===e.protocol)o=new v(unescape(e.pathname),{});else if("string"===a)for(r in o=new v(e,{}),p)delete o[r];else if("object"===a){for(r in e)r in p||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=i.test(e.href))}return o}function d(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function h(e,t){e=l(e),t=t||{};var r,n=a.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],s=!!n[3],u=0;return i?s?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):s?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):d(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&d(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||d(o),slashesCount:u,rest:r}}function v(e,t,r){if(e=l(e),!(this instanceof v))return new v(e,t,r);var i,a,u,p,y,m,g=c.slice(),_=typeof t,b=this,w=0;for("object"!==_&&"string"!==_&&(r=t,t=null),r&&"function"!==typeof r&&(r=o.parse),i=!(a=h(e||"",t=f(t))).protocol&&!a.slashes,b.slashes=a.slashes||i&&t.slashes,b.protocol=a.protocol||t.protocol||"",e=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||s.test(e))||!a.slashes&&(a.protocol||a.slashesCount<2||!d(b.protocol)))&&(g[3]=[/(.*)/,"pathname"]);w<g.length;w++)"function"!==typeof(p=g[w])?(u=p[0],m=p[1],u!==u?b[m]=e:"string"===typeof u?~(y=e.indexOf(u))&&("number"===typeof p[2]?(b[m]=e.slice(0,y),e=e.slice(y+p[2])):(b[m]=e.slice(y),e=e.slice(0,y))):(y=u.exec(e))&&(b[m]=y[1],e=e.slice(0,y.index)),b[m]=b[m]||i&&p[3]&&t[m]||"",p[4]&&(b[m]=b[m].toLowerCase())):e=p(e,b);r&&(b.query=r(b.query)),i&&t.slashes&&"/"!==b.pathname.charAt(0)&&(""!==b.pathname||""!==t.pathname)&&(b.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),a++):a&&(0===n&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(b.pathname,t.pathname)),"/"!==b.pathname.charAt(0)&&d(b.protocol)&&(b.pathname="/"+b.pathname),n(b.port,b.protocol)||(b.host=b.hostname,b.port=""),b.username=b.password="",b.auth&&(p=b.auth.split(":"),b.username=p[0]||"",b.password=p[1]||""),b.origin="file:"!==b.protocol&&d(b.protocol)&&b.host?b.protocol+"//"+b.host:"null",b.href=b.toString()}v.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"===typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,/:\d+$/.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";i[e]=t.charAt(0)!==a?a+t:t}else i[e]=t;break;default:i[e]=t}for(var s=0;s<c.length;s++){var u=c[s];u[4]&&(i[u[1]]=i[u[1]].toLowerCase())}return i.origin="file:"!==i.protocol&&d(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"===typeof e||(e=o.stringify);var t,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.slashes||d(r.protocol)?"//":"");return r.username&&(i+=r.username,r.password&&(i+=":"+r.password),i+="@"),i+=r.host+r.pathname,(t="object"===typeof r.query?e(r.query):r.query)&&(i+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(i+=r.hash),i}},v.extractProtocol=h,v.location=f,v.trimLeft=l,v.qs=o,e.exports=v}).call(this,r(49))},489:function(e,t,r){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},490:function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return null}}function i(e){try{return encodeURIComponent(e)}catch(t){return null}}t.stringify=function(e,t){t=t||"";var r,o,a=[];for(o in"string"!==typeof t&&(t="?"),e)if(n.call(e,o)){if((r=e[o])||null!==r&&undefined!==r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;a.push(o+"="+r)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var i=o(t[1]),a=o(t[2]);null===i||null===a||i in n||(n[i]=a)}return n}},491:function(e,t,r){"use strict";var n=r(485);e.exports=function(e){return function(t,r){if("undefined"!==typeof window&&("undefined"!==typeof window.PhoneGap||"undefined"!==typeof window.Cordova||"undefined"!==typeof window.cordova)||"undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return n.defaultOptions.fingerprint(t,r);var o=["tus",e.id,r.endpoint].join("-");return Promise.resolve(o)}}}}]);
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
(this["webpackJsonp@micromag/viewer-build"]=this["webpackJsonp@micromag/viewer-build"]||[]).push([[6],{476:function(e,t,r){"use strict";r.r(t),r.d(t,"Upload",(function(){return pe})),r.d(t,"canStoreURLs",(function(){return z})),r.d(t,"defaultOptions",(function(){return ce})),r.d(t,"isSupported",(function(){return ve})),r.d(t,"enableDebugLog",(function(){return m})),r.d(t,"HttpStack",(function(){return N}));var n=r(477),o=r(478),i=r.n(o);function a(e){return a="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return!t||"object"!==a(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e){var t="function"===typeof Map?new Map:void 0;return l=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return c(e,arguments,d(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,e)},l(e)}function c(e,t,r){return c=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&f(o,r.prototype),o},c.apply(null,arguments)}function p(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}var h=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(n,e);var t,r=(t=n,function(){var e,r=d(t);if(p()){var n=d(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return u(this,e)});function n(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(s(this,n),(t=r.call(this,e)).originalRequest=i,t.originalResponse=a,t.causingError=o,null!=o&&(e+=", caused by ".concat(o.toString())),null!=i){var u=i.getHeader("X-Request-ID")||"n/a",l=i.getMethod(),c=i.getURL(),p=a?a.getStatus():"n/a",f=a?a.getBody()||"":"n/a";e+=", originated from request (method: ".concat(l,", url: ").concat(c,", response code: ").concat(p,", response text: ").concat(f,", request id: ").concat(u,")")}return t.message=e,t}return n}(l(Error)),v=h,y=!1;function m(){y=!0}function g(e){y&&console.log(e)}function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var S={endpoint:null,uploadUrl:null,metadata:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,_onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:null,chunkSize:1/0,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null},R=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(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._urlStorage=this.options.urlStorage,this.file=t,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}var t,r,n;return t=e,r=[{key:"findPreviousUploads",value:function(){var e=this;return this.options.fingerprint(this.file,this.options).then((function(t){return e._urlStorage.findUploadsByFingerprint(t)}))}},{key:"resumeFromPreviousUpload",value:function(e){this.url=e.uploadUrl||null,this._parallelUploadUrls=e.parallelUploadUrls||null,this._urlStorageKey=e.urlStorageKey}},{key:"start",value:function(){var e=this,t=this.file;if(t)if(this.options.endpoint||this.options.uploadUrl){var r=this.options.retryDelays;null==r||"[object Array]"===Object.prototype.toString.call(r)?(this.options.parallelUploads>1&&["uploadUrl","uploadSize","uploadLengthDeferred"].forEach((function(t){e.options[t]&&e._emitError(new Error("tus: cannot use the ".concat(t," option when parallelUploads is enabled")))})),this.options.fingerprint(t,this.options).then((function(r){return g(null==r?"No fingerprint was calculated meaning that the upload cannot be stored in the URL storage.":"Calculated fingerprint: ".concat(r)),e._fingerprint=r,e._source?e._source:e.options.fileReader.openFile(t,e.options.chunkSize)})).then((function(t){e._source=t,e.options.parallelUploads>1||null!=e._parallelUploadUrls?e._startParallelUpload():e._startSingleUpload()})).catch((function(t){e._emitError(t)}))):this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"))}else this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));else this._emitError(new Error("tus: no file or stream to upload provided"))}},{key:"_startParallelUpload",value:function(){var t=this,r=this._size=this._source.size,n=0;this._parallelUploads=[];var o=null!=this._parallelUploadUrls?this._parallelUploadUrls.length:this.options.parallelUploads,i=function(e,t,r){for(var n=Math.floor(e/t),o=[],i=0;i<t;i++)o.push({start:n*i,end:n*(i+1)});return o[t-1].end=e,r&&o.forEach((function(e,t){e.uploadUrl=r[t]||null})),o}(this._source.size,o,this._parallelUploadUrls);this._parallelUploadUrls=new Array(i.length);var a,s=i.map((function(o,a){var s=0;return t._source.slice(o.start,o.end).then((function(u){var l=u.value;return new Promise((function(u,c){var p=b({},t.options,{uploadUrl:o.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,metadata:{},headers:b({},t.options.headers,{"Upload-Concat":"partial"}),onSuccess:u,onError:c,onProgress:function(e){n=n-s+e,s=e,t._emitProgress(n,r)},_onUploadUrlAvailable:function(){t._parallelUploadUrls[a]=f.url,t._parallelUploadUrls.filter((function(e){return!!e})).length===i.length&&t._saveUploadInUrlStorage()}}),f=new e(l,p);f.start(),t._parallelUploads.push(f)}))}))}));Promise.all(s).then((function(){(a=t._openRequest("POST",t.options.endpoint)).setHeader("Upload-Concat","final;".concat(t._parallelUploadUrls.join(" ")));var e=k(t.options.metadata);return""!==e&&a.setHeader("Upload-Metadata",e),t._sendRequest(a,null)})).then((function(e){if(P(e.getStatus(),200)){var r=e.getHeader("Location");null!=r?(t.url=A(t.options.endpoint,r),g("Created upload at ".concat(t.url)),t._emitSuccess()):t._emitHttpError(a,e,"tus: invalid or missing Location header")}else t._emitHttpError(a,e,"tus: unexpected response while creating upload")})).catch((function(e){t._emitError(e)}))}},{key:"_startSingleUpload",value:function(){if(this.options.uploadLengthDeferred)this._size=null;else if(null!=this.options.uploadSize){if(this._size=+this.options.uploadSize,isNaN(this._size))return void this._emitError(new Error("tus: cannot convert `uploadSize` option into a number"))}else if(this._size=this._source.size,null==this._size)return void this._emitError(new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option"));return this._aborted=!1,null!=this.url?(g("Resuming upload from previous URL: ".concat(this.url)),void this._resumeUpload()):null!=this.options.uploadUrl?(g("Resuming upload from provided URL: ".concat(this.options.url)),this.url=this.options.uploadUrl,void this._resumeUpload()):(g("Creating a new upload"),void this._createUpload())}},{key:"abort",value:function(t){var r=this;if(arguments.length>1&&"function"===typeof arguments[1])throw new Error("tus: the abort function does not accept a callback since v2 anymore; please use the returned Promise instead");return null!=this._parallelUploads&&this._parallelUploads.forEach((function(e){e.abort(t)})),null!==this._req&&(this._req.abort(),this._source.close()),this._aborted=!0,null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),t&&null!=this.url?e.terminate(this.url,this.options).then((function(){return r._removeFromUrlStorage()})):Promise.resolve()}},{key:"_emitHttpError",value:function(e,t,r,n){this._emitError(new v(r,n,e,t))}},{key:"_emitError",value:function(e){var t=this;if(!this._aborted){if(null!=this.options.retryDelays&&(null!=this._offset&&this._offset>this._offsetBeforeRetry&&(this._retryAttempt=0),x(e,this._retryAttempt,this.options))){var r=this.options.retryDelays[this._retryAttempt++];return this._offsetBeforeRetry=this._offset,void(this._retryTimeout=setTimeout((function(){t.start()}),r))}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 e=this;if(this.options.endpoint){var t=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?t.setHeader("Upload-Defer-Length",1):t.setHeader("Upload-Length",this._size);var r,n=k(this.options.metadata);""!==n&&t.setHeader("Upload-Metadata",n),this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,r=this._addChunkToRequest(t)):r=this._sendRequest(t,null),r.then((function(r){if(P(r.getStatus(),200)){var n=r.getHeader("Location");if(null!=n){if(e.url=A(e.options.endpoint,n),g("Created upload at ".concat(e.url)),"function"===typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),0===e._size)return e._emitSuccess(),void e._source.close();e._saveUploadInUrlStorage(),e.options.uploadDataDuringCreation?e._handleUploadResponse(t,r):(e._offset=0,e._performUpload())}else e._emitHttpError(t,r,"tus: invalid or missing Location header")}else e._emitHttpError(t,r,"tus: unexpected response while creating upload")})).catch((function(r){e._emitHttpError(t,null,"tus: failed to create upload",r)}))}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var e=this,t=this._openRequest("HEAD",this.url);this._sendRequest(t,null).then((function(r){var n=r.getStatus();if(!P(n,200))return P(n,400)&&e._removeFromUrlStorage(),423===n?void e._emitHttpError(t,r,"tus: upload is currently locked; retry later"):e.options.endpoint?(e.url=null,void e._createUpload()):void e._emitHttpError(t,r,"tus: unable to resume upload (new upload cannot be created without an endpoint)");var o=parseInt(r.getHeader("Upload-Offset"),10);if(isNaN(o))e._emitHttpError(t,r,"tus: invalid or missing offset value");else{var i=parseInt(r.getHeader("Upload-Length"),10);if(!isNaN(i)||e.options.uploadLengthDeferred){if("function"===typeof e.options._onUploadUrlAvailable&&e.options._onUploadUrlAvailable(),o===i)return e._emitProgress(i,i),void e._emitSuccess();e._offset=o,e._performUpload()}else e._emitHttpError(t,r,"tus: invalid or missing length value")}})).catch((function(r){e._emitHttpError(t,null,"tus: failed to resume upload",r)}))}},{key:"_performUpload",value:function(){var e,t=this;this._aborted||(this.options.overridePatchMethod?(e=this._openRequest("POST",this.url)).setHeader("X-HTTP-Method-Override","PATCH"):e=this._openRequest("PATCH",this.url),e.setHeader("Upload-Offset",this._offset),this._addChunkToRequest(e).then((function(r){P(r.getStatus(),200)?t._handleUploadResponse(e,r):t._emitHttpError(e,r,"tus: unexpected response while uploading chunk")})).catch((function(r){t._aborted||t._emitHttpError(e,null,"tus: failed to upload chunk at offset ".concat(t._offset),r)})))}},{key:"_addChunkToRequest",value:function(e){var t=this,r=this._offset,n=this._offset+this.options.chunkSize;return e.setProgressHandler((function(e){t._emitProgress(r+e,t._size)})),e.setHeader("Content-Type","application/offset+octet-stream"),(n===1/0||n>this._size)&&!this.options.uploadLengthDeferred&&(n=this._size),this._source.slice(r,n).then((function(r){var n=r.value,o=r.done;return t.options.uploadLengthDeferred&&o&&(t._size=t._offset+(n&&n.size?n.size:0),e.setHeader("Upload-Length",t._size)),null===n?t._sendRequest(e):(t._emitProgress(t._offset,t._size),t._sendRequest(e,n))}))}},{key:"_handleUploadResponse",value:function(e,t){var r=parseInt(t.getHeader("Upload-Offset"),10);if(isNaN(r))this._emitHttpError(e,t,"tus: invalid or missing offset value");else{if(this._emitProgress(r,this._size),this._emitChunkComplete(r-this._offset,r,this._size),this._offset=r,r==this._size)return this._emitSuccess(),void this._source.close();this._performUpload()}}},{key:"_openRequest",value:function(e,t){var r=O(e,t,this.options);return this._req=r,r}},{key:"_removeFromUrlStorage",value:function(){var e=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch((function(t){e._emitError(t)})),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var e=this;if(this.options.storeFingerprintForResuming&&this._fingerprint){var t={size:this._size,metadata:this.options.metadata,creationTime:(new Date).toString()};this._parallelUploads?t.parallelUploadUrls=this._parallelUploadUrls:t.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,t).then((function(t){return e._urlStorageKey=t})).catch((function(t){e._emitError(t)}))}}},{key:"_sendRequest",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return E(e,t,this.options)}}],n=[{key:"terminate",value:function(t,r){if(arguments.length>1&&"function"===typeof arguments[arguments.length-1])throw new Error("tus: the terminate function does not accept a callback since v2 anymore; please use the returned Promise instead");void 0===r&&(r={});var n=O("DELETE",t,r);return E(n,null,r).then((function(e){if(204!==e.getStatus())throw new v("tus: unexpected response while terminating upload",null,n,e)})).catch((function(o){if(o instanceof v||(o=new v("tus: failed to terminate upload",o,n,null)),!x(o,0,r))throw o;var i=r.retryDelays[0],a=r.retryDelays.slice(1),s=b({},r,{retryDelays:a});return new Promise((function(e){return setTimeout(e,i)})).then((function(){return e.terminate(t,s)}))}))}}],r&&U(t.prototype,r),n&&U(t,n),e}();function k(e){var t=[];for(var r in e)t.push("".concat(r," ").concat(n.Base64.encode(e[r])));return t.join(",")}function P(e,t){return e>=t&&e<t+100}function O(e,t,r){var n=r.httpStack.createRequest(e,t);n.setHeader("Tus-Resumable","1.0.0");var o=r.headers||{};for(var i in o)n.setHeader(i,o[i]);if(r.addRequestId){var a="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)}));n.setHeader("X-Request-ID",a)}return n}function E(e,t,r){return("function"===typeof r.onBeforeRequest?Promise.resolve(r.onBeforeRequest(e)):Promise.resolve()).then((function(){return e.send(t).then((function(t){return("function"===typeof r.onAfterResponse?Promise.resolve(r.onAfterResponse(e,t)):Promise.resolve()).then((function(){return t}))}))}))}function x(e,t,r){if(null==r.retryDelays||t>=r.retryDelays.length||null==e.originalRequest)return!1;if(r&&"function"===typeof r.onShouldRetry)return r.onShouldRetry(e,t,r);var n=e.originalResponse?e.originalResponse.getStatus():0;return(!P(n,400)||409===n||423===n)&&function(){var e=!0;return"undefined"!==typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(e=!1),e}()}function A(e,t){return new i.a(t,e).toString()}R.defaultOptions=S;var j=R;function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var q=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,(r=[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(e){return Promise.resolve([])}},{key:"removeUpload",value:function(e){return Promise.resolve()}},{key:"addUpload",value:function(e,t){return Promise.resolve(null)}}])&&C(t.prototype,r),n&&C(t,n),e}();function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var F=!1;try{F="localStorage"in window;var T="tusSupport";localStorage.setItem(T,localStorage.getItem(T))}catch(ye){if(ye.code!==ye.SECURITY_ERR&&ye.code!==ye.QUOTA_EXCEEDED_ERR)throw ye;F=!1}var z=F,H=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,r=[{key:"findAllUploads",value:function(){var e=this._findEntries("tus::");return Promise.resolve(e)}},{key:"findUploadsByFingerprint",value:function(e){var t=this._findEntries("tus::".concat(e,"::"));return Promise.resolve(t)}},{key:"removeUpload",value:function(e){return localStorage.removeItem(e),Promise.resolve()}},{key:"addUpload",value:function(e,t){var r=Math.round(1e12*Math.random()),n="tus::".concat(e,"::").concat(r);return localStorage.setItem(n,JSON.stringify(t)),Promise.resolve(n)}},{key:"_findEntries",value:function(e){for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);if(0===n.indexOf(e))try{var o=JSON.parse(localStorage.getItem(n));o.urlStorageKey=n,t.push(o)}catch(ye){}}return t}}],r&&D(t.prototype,r),n&&D(t,n),e}();function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e,t,r){return t&&L(e.prototype,t),r&&L(e,r),e}var N=function(){function e(){B(this,e)}return I(e,[{key:"createRequest",value:function(e,t){return new M(e,t)}},{key:"getName",value:function(){return"XHRHttpStack"}}]),e}(),M=function(){function e(t,r){B(this,e),this._xhr=new XMLHttpRequest,this._xhr.open(t,r,!0),this._method=t,this._url=r,this._headers={}}return I(e,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(e,t){this._xhr.setRequestHeader(e,t),this._headers[e]=t}},{key:"getHeader",value:function(e){return this._headers[e]}},{key:"setProgressHandler",value:function(e){"upload"in this._xhr&&(this._xhr.upload.onprogress=function(t){t.lengthComputable&&e(t.loaded)})}},{key:"send",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new Promise((function(r,n){e._xhr.onload=function(){r(new K(e._xhr))},e._xhr.onerror=function(e){n(e)},e._xhr.send(t)}))}},{key:"abort",value:function(){return this._xhr.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),K=function(){function e(t){B(this,e),this._xhr=t}return I(e,[{key:"getStatus",value:function(){return this._xhr.status}},{key:"getHeader",value:function(e){return this._xhr.getResponseHeader(e)}},{key:"getBody",value:function(){return this._xhr.responseText}},{key:"getUnderlyingObject",value:function(){return this._xhr}}]),e}(),X=function(){return"undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase()};var J=function(){return"undefined"!=typeof window&&("undefined"!=typeof window.PhoneGap||"undefined"!=typeof window.Cordova||"undefined"!=typeof window.cordova)};function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Q(e,t,r){return t&&G(e.prototype,t),r&&G(e,r),e}var V=function(){function e(t){Z(this,e),this._file=t,this.size=t.size}return Q(e,[{key:"slice",value:function(e,t){if(J())return r=this._file.slice(e,t),new Promise((function(e,t){var n=new FileReader;n.onload=function(){var t=new Uint8Array(n.result);e({value:t})},n.onerror=function(e){t(e)},n.readAsArrayBuffer(r)}));var r,n=this._file.slice(e,t);return Promise.resolve({value:n})}},{key:"close",value:function(){}}]),e}(),W=function(){function e(t,r){Z(this,e),this._chunkSize=r,this._buffer=void 0,this._bufferOffset=0,this._reader=t,this._done=!1}return Q(e,[{key:"slice",value:function(e,t){return e<this._bufferOffset?Promise.reject(new Error("Requested data is before the reader's current offset")):this._readUntilEnoughDataOrDone(e,t)}},{key:"_readUntilEnoughDataOrDone",value:function(e,t){var r=this,n=t<=this._bufferOffset+Y(this._buffer);if(this._done||n){var o=this._getDataFromBuffer(e,t),i=null==o&&this._done;return Promise.resolve({value:o,done:i})}return this._reader.read().then((function(n){var o=n.value;return n.done?r._done=!0:void 0===r._buffer?r._buffer=o:r._buffer=function(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")}(r._buffer,o),r._readUntilEnoughDataOrDone(e,t)}))}},{key:"_getDataFromBuffer",value:function(e,t){e>this._bufferOffset&&(this._buffer=this._buffer.slice(e-this._bufferOffset),this._bufferOffset=e);var r=0===Y(this._buffer);return this._done&&r?null:this._buffer.slice(0,t-e)}},{key:"close",value:function(){this._reader.cancel&&this._reader.cancel()}}]),e}();function Y(e){return void 0===e?0:void 0!==e.size?e.size:e.length}var $=function(){function e(){Z(this,e)}return Q(e,[{key:"openFile",value:function(e,t){return X()&&e&&"undefined"!==typeof e.uri?(r=e.uri,new Promise((function(e,t){var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=n.response;e(t)},n.onerror=function(e){t(e)},n.open("GET",r),n.send()}))).then((function(e){return new V(e)})).catch((function(e){throw new Error("tus: cannot fetch `file.uri` as Blob, make sure the uri is correct and accessible. ".concat(e))})):"function"===typeof e.slice&&"undefined"!==typeof e.size?Promise.resolve(new V(e)):"function"===typeof e.read?(t=+t,isFinite(t)?Promise.resolve(new W(e,t)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option"))):Promise.reject(new Error("source object may only be an instance of File, Blob, or Reader in this environment"));var r}}]),e}();function ee(e){return ee="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ne(e,t){return ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ne(e,t)}function oe(e,t){return!t||"object"!==ee(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(ye){return!1}}function ae(e){return ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},ae(e)}function se(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?se(Object(r),!0).forEach((function(t){le(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ce=ue({},j.defaultOptions,{httpStack:new N,fileReader:new $,urlStorage:z?new H:new q,fingerprint:function(e,t){return X()?Promise.resolve(function(e,t){var r=e.exif?function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return t}(JSON.stringify(e.exif)):"noexif";return["tus-rn",e.name||"noname",e.size||"nosize",r,t.endpoint].join("/")}(e,t)):Promise.resolve(["tus-br",e.name,e.type,e.size,e.lastModified,t.endpoint].join("-"))}}),pe=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ne(e,t)}(a,e);var t,r,n,o,i=(t=a,function(){var e,r=ae(t);if(ie()){var n=ae(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return oe(this,e)});function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return te(this,a),t=ue({},ce,{},t),i.call(this,e,t)}return r=a,o=[{key:"terminate",value:function(e,t,r){return t=ue({},ce,{},t),j.terminate(e,t,r)}}],(n=null)&&re(r.prototype,n),o&&re(r,o),a}(j),fe=window,de=fe.XMLHttpRequest,he=fe.Blob,ve=de&&he&&"function"===typeof he.prototype.slice},477:function(e,t,r){(function(r){var n;!function(r,o){e.exports=function(r){"use strict";var o,i=(r=r||{}).Base64,a="2.6.4",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=function(e){for(var t={},r=0,n=e.length;r<n;r++)t[e.charAt(r)]=r;return t}(s),l=String.fromCharCode,c=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?l(192|t>>>6)+l(128|63&t):l(224|t>>>12&15)+l(128|t>>>6&63)+l(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return l(240|t>>>18&7)+l(128|t>>>12&63)+l(128|t>>>6&63)+l(128|63&t)},p=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,f=function(e){return e.replace(p,c)},d=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[s.charAt(r>>>18),s.charAt(r>>>12&63),t>=2?"=":s.charAt(r>>>6&63),t>=1?"=":s.charAt(63&r)].join("")},h=r.btoa&&"function"==typeof r.btoa?function(e){return r.btoa(e)}:function(e){if(e.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return e.replace(/[\s\S]{1,3}/g,d)},v=function(e){return h(f(String(e)))},y=function(e){return e.replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,"")},m=function(e,t){return t?y(v(e)):v(e)},g=function(e){return m(e,!0)};r.Uint8Array&&(o=function(e,t){for(var r="",n=0,o=e.length;n<o;n+=3){var i=e[n],a=e[n+1],u=e[n+2],l=i<<16|a<<8|u;r+=s.charAt(l>>>18)+s.charAt(l>>>12&63)+("undefined"!=typeof a?s.charAt(l>>>6&63):"=")+("undefined"!=typeof u?s.charAt(63&l):"=")}return t?y(r):r});var _,b=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=function(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 l(55296+(t>>>10))+l(56320+(1023&t));case 3:return l((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return l((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},U=function(e){return e.replace(b,w)},S=function(e){var t=e.length,r=t%4,n=(t>0?u[e.charAt(0)]<<18:0)|(t>1?u[e.charAt(1)]<<12:0)|(t>2?u[e.charAt(2)]<<6:0)|(t>3?u[e.charAt(3)]:0),o=[l(n>>>16),l(n>>>8&255),l(255&n)];return o.length-=[0,0,2,1][r],o.join("")},R=r.atob&&"function"==typeof r.atob?function(e){return r.atob(e)}:function(e){return e.replace(/\S{1,4}/g,S)},k=function(e){return R(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},P=function(e){return U(R(e))},O=function(e){return String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,"")},E=function(e){return P(O(e))};r.Uint8Array&&(_=function(e){return Uint8Array.from(k(O(e)),(function(e){return e.charCodeAt(0)}))});var x=function(){var e=r.Base64;return r.Base64=i,e};if(r.Base64={VERSION:a,atob:k,btoa:h,fromBase64:E,toBase64:m,utob:f,encode:m,encodeURI:g,btou:U,decode:E,noConflict:x,fromUint8Array:o,toUint8Array:_},"function"===typeof Object.defineProperty){var A=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};r.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",A((function(){return E(this)}))),Object.defineProperty(String.prototype,"toBase64",A((function(e){return m(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",A((function(){return m(this,!0)})))}}r.Meteor&&(Base64=r.Base64);e.exports?e.exports.Base64=r.Base64:void 0===(n=function(){return r.Base64}.apply(t,[]))||(e.exports=n);return{Base64:r.Base64}}(r)}("undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof r?r:this)}).call(this,r(49))},478:function(e,t,r){"use strict";(function(t){var n=r(479),o=r(480),i=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,a=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,s=/^[a-zA-Z]:/,u=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function l(e){return(e||"").toString().replace(u,"")}var c=[["#","hash"],["?","query"],function(e,t){return d(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],p={hash:1,query:1};function f(e){var r,n=("undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{}).location||{},o={},a=typeof(e=e||n);if("blob:"===e.protocol)o=new v(unescape(e.pathname),{});else if("string"===a)for(r in o=new v(e,{}),p)delete o[r];else if("object"===a){for(r in e)r in p||(o[r]=e[r]);void 0===o.slashes&&(o.slashes=i.test(e.href))}return o}function d(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function h(e,t){e=l(e),t=t||{};var r,n=a.exec(e),o=n[1]?n[1].toLowerCase():"",i=!!n[2],s=!!n[3],u=0;return i?s?(r=n[2]+n[3]+n[4],u=n[2].length+n[3].length):(r=n[2]+n[4],u=n[2].length):s?(r=n[3]+n[4],u=n[3].length):r=n[4],"file:"===o?u>=2&&(r=r.slice(2)):d(o)?r=n[4]:o?i&&(r=r.slice(2)):u>=2&&d(t.protocol)&&(r=n[4]),{protocol:o,slashes:i||d(o),slashesCount:u,rest:r}}function v(e,t,r){if(e=l(e),!(this instanceof v))return new v(e,t,r);var i,a,u,p,y,m,g=c.slice(),_=typeof t,b=this,w=0;for("object"!==_&&"string"!==_&&(r=t,t=null),r&&"function"!==typeof r&&(r=o.parse),i=!(a=h(e||"",t=f(t))).protocol&&!a.slashes,b.slashes=a.slashes||i&&t.slashes,b.protocol=a.protocol||t.protocol||"",e=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||s.test(e))||!a.slashes&&(a.protocol||a.slashesCount<2||!d(b.protocol)))&&(g[3]=[/(.*)/,"pathname"]);w<g.length;w++)"function"!==typeof(p=g[w])?(u=p[0],m=p[1],u!==u?b[m]=e:"string"===typeof u?~(y=e.indexOf(u))&&("number"===typeof p[2]?(b[m]=e.slice(0,y),e=e.slice(y+p[2])):(b[m]=e.slice(y),e=e.slice(0,y))):(y=u.exec(e))&&(b[m]=y[1],e=e.slice(0,y.index)),b[m]=b[m]||i&&p[3]&&t[m]||"",p[4]&&(b[m]=b[m].toLowerCase())):e=p(e,b);r&&(b.query=r(b.query)),i&&t.slashes&&"/"!==b.pathname.charAt(0)&&(""!==b.pathname||""!==t.pathname)&&(b.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),a++):a&&(0===n&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),"."!==o&&".."!==o||r.push(""),r.join("/")}(b.pathname,t.pathname)),"/"!==b.pathname.charAt(0)&&d(b.protocol)&&(b.pathname="/"+b.pathname),n(b.port,b.protocol)||(b.host=b.hostname,b.port=""),b.username=b.password="",b.auth&&(p=b.auth.split(":"),b.username=p[0]||"",b.password=p[1]||""),b.origin="file:"!==b.protocol&&d(b.protocol)&&b.host?b.protocol+"//"+b.host:"null",b.href=b.toString()}v.prototype={set:function(e,t,r){var i=this;switch(e){case"query":"string"===typeof t&&t.length&&(t=(r||o.parse)(t)),i[e]=t;break;case"port":i[e]=t,n(t,i.protocol)?t&&(i.host=i.hostname+":"+t):(i.host=i.hostname,i[e]="");break;case"hostname":i[e]=t,i.port&&(t+=":"+i.port),i.host=t;break;case"host":i[e]=t,/:\d+$/.test(t)?(t=t.split(":"),i.port=t.pop(),i.hostname=t.join(":")):(i.hostname=t,i.port="");break;case"protocol":i.protocol=t.toLowerCase(),i.slashes=!r;break;case"pathname":case"hash":if(t){var a="pathname"===e?"/":"#";i[e]=t.charAt(0)!==a?a+t:t}else i[e]=t;break;default:i[e]=t}for(var s=0;s<c.length;s++){var u=c[s];u[4]&&(i[u[1]]=i[u[1]].toLowerCase())}return i.origin="file:"!==i.protocol&&d(i.protocol)&&i.host?i.protocol+"//"+i.host:"null",i.href=i.toString(),i},toString:function(e){e&&"function"===typeof e||(e=o.stringify);var t,r=this,n=r.protocol;n&&":"!==n.charAt(n.length-1)&&(n+=":");var i=n+(r.slashes||d(r.protocol)?"//":"");return r.username&&(i+=r.username,r.password&&(i+=":"+r.password),i+="@"),i+=r.host+r.pathname,(t="object"===typeof r.query?e(r.query):r.query)&&(i+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(i+=r.hash),i}},v.extractProtocol=h,v.location=f,v.trimLeft=l,v.qs=o,e.exports=v}).call(this,r(49))},479:function(e,t,r){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},480:function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty;function o(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return null}}function i(e){try{return encodeURIComponent(e)}catch(t){return null}}t.stringify=function(e,t){t=t||"";var r,o,a=[];for(o in"string"!==typeof t&&(t="?"),e)if(n.call(e,o)){if((r=e[o])||null!==r&&undefined!==r&&!isNaN(r)||(r=""),o=i(o),r=i(r),null===o||null===r)continue;a.push(o+"="+r)}return a.length?t+a.join("&"):""},t.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,n={};t=r.exec(e);){var i=o(t[1]),a=o(t[2]);null===i||null===a||i in n||(n[i]=a)}return n}},481:function(e,t,r){"use strict";var n=r(476);e.exports=function(e){return function(t,r){if("undefined"!==typeof window&&("undefined"!==typeof window.PhoneGap||"undefined"!==typeof window.Cordova||"undefined"!==typeof window.cordova)||"undefined"!==typeof navigator&&"string"===typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return n.defaultOptions.fingerprint(t,r);var o=["tus",e.id,r.endpoint].join("-");return Promise.resolve(o)}}},521:function(e,t,r){"use strict";var n,o,i,a=r(30),s=r(19),u=r(20),l=r(56),c=r(24),p=r(25);function f(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var d=0;function h(e){return"__private_"+d+++"_"+e}var v=r(149),y=r(476),m=r(452),g=m.Provider,_=m.RequestClient,b=m.Socket,w=r(464),U=r(465),S=r(466),R=r(467),k=r(455),P=r(468),O=r(469).RateLimitedQueue,E=r(230),x=r(481),A={endpoint:"",uploadUrl:null,metadata:{},uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,overridePatchMethod:!1,headers:{},addRequestId:!1,chunkSize:1/0,retryDelays:[100,1e3,3e3,5e3],parallelUploads:1,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1};e.exports=(o=h("retryDelayIterator"),i=n=function(e){c(r,e);var t=p(r);function r(e,n){var i,u;s(this,r),i=t.call(this,e,n),Object.defineProperty(l(i),o,{writable:!0,value:void 0}),i.type="uploader",i.id=i.opts.id||"Tus",i.title="Tus";var c={useFastRemoteRetry:!0,limit:20,retryDelays:A.retryDelays,withCredentials:!1};if(i.opts=a(a({},c),n),"autoRetry"in n)throw new Error("The `autoRetry` option was deprecated and has been removed.");return i.requests=new O(i.opts.limit),f(l(i),o)[o]=null==(u=i.opts.retryDelays)?void 0:u.values(),i.uploaders=Object.create(null),i.uploaderEvents=Object.create(null),i.uploaderSockets=Object.create(null),i.handleResetProgress=i.handleResetProgress.bind(l(i)),i.handleUpload=i.handleUpload.bind(l(i)),i}return u(r,[{key:"handleResetProgress",value:function(){var e=a({},this.uppy.getState().files);Object.keys(e).forEach((function(t){if(e[t].tus&&e[t].tus.uploadUrl){var r=a({},e[t].tus);delete r.uploadUrl,e[t]=a(a({},e[t]),{},{tus:r})}})),this.uppy.setState({files:e})}},{key:"resetUploaderReferences",value:function(e,t){if(void 0===t&&(t={}),this.uploaders[e]){var r=this.uploaders[e];r.abort(),t.abort&&r.abort(!0),this.uploaders[e]=null}this.uploaderEvents[e]&&(this.uploaderEvents[e].remove(),this.uploaderEvents[e]=null),this.uploaderSockets[e]&&(this.uploaderSockets[e].close(),this.uploaderSockets[e]=null)}},{key:"upload",value:function(e){var t=this;return this.resetUploaderReferences(e.id),new Promise((function(r,n){var i,s;t.uppy.emit("upload-started",e);var u=a(a({},t.opts),e.tus||{});"function"===typeof u.headers&&(u.headers=u.headers(e));var l=a(a({},A),u);l.fingerprint=x(e),l.onBeforeRequest=function(e){e.getUnderlyingObject().withCredentials=!!u.withCredentials,"function"===typeof u.onBeforeRequest&&u.onBeforeRequest(e)},l.onError=function(r){t.uppy.log(r);var o=r.originalRequest?r.originalRequest.getUnderlyingObject():null;P(o)&&(r=new k(r,o)),t.resetUploaderReferences(e.id),i.abort(),t.uppy.emit("upload-error",e,r),n(r)},l.onProgress=function(r,n){t.onReceiveUploadUrl(e,d.url),t.uppy.emit("upload-progress",e,{uploader:t,bytesUploaded:r,bytesTotal:n})},l.onSuccess=function(){var n={uploadURL:d.url};t.resetUploaderReferences(e.id),i.done(),t.uppy.emit("upload-success",e,n),d.url&&t.uppy.log("Download ".concat(d.file.name," from ").concat(d.url)),r(d)},l.onShouldRetry=function(e,r,n){var a,u=null==e||null==(a=e.originalResponse)?void 0:a.getStatus();if(429===u){if(!t.requests.isPaused){var l,c=null==(l=f(t,o)[o])?void 0:l.next();if(null==c||c.done)return!1;t.requests.rateLimit(c.value)}i.abort(),i=t.requests.run(s)}else{if(u>400&&u<500&&409!==u)return!1;"undefined"!==typeof navigator&&!1===navigator.onLine?(t.requests.isPaused||(t.requests.pause(),window.addEventListener("online",(function(){t.requests.resume()}),{once:!0})),i.abort(),i=t.requests.run(s)):setTimeout((function(){i.abort(),i=t.requests.run(s)}),n.retryDelays[r])}return queueMicrotask((function(){return clearTimeout(i._retryTimeout)})),!0};var c=function(e,t,r){E(e,t)&&!E(e,r)&&(e[r]=e[t])},p={};(Array.isArray(u.metaFields)?u.metaFields:Object.keys(e.meta)).forEach((function(t){p[t]=e.meta[t]})),c(p,"type","filetype"),c(p,"name","filename"),l.metadata=p;var d=new y.Upload(e.data,l);t.uploaders[e.id]=d,t.uploaderEvents[e.id]=new R(t.uppy),s=function(){return e.isPaused||d.start(),function(){}},d.findPreviousUploads().then((function(r){var n=r[0];n&&(t.uppy.log("[Tus] Resuming upload of ".concat(e.id," started at ").concat(n.creationTime)),d.resumeFromPreviousUpload(n))})),i=t.requests.run(s),t.onFileRemove(e.id,(function(n){i.abort(),t.resetUploaderReferences(e.id,{abort:!!d.url}),r("upload ".concat(n," was removed"))})),t.onPause(e.id,(function(e){e?(i.abort(),d.abort()):(i.abort(),i=t.requests.run(s))})),t.onPauseAll(e.id,(function(){i.abort(),d.abort()})),t.onCancelAll(e.id,(function(){i.abort(),t.resetUploaderReferences(e.id,{abort:!!d.url}),r("upload ".concat(e.id," was canceled"))})),t.onResumeAll(e.id,(function(){i.abort(),e.error&&d.abort(),i=t.requests.run(s)}))})).catch((function(r){throw t.uppy.emit("upload-error",e,r),r}))}},{key:"uploadRemote",value:function(e){var t=this;this.resetUploaderReferences(e.id);var r=a({},this.opts);return e.tus&&Object.assign(r,e.tus),this.uppy.emit("upload-started",e),this.uppy.log(e.remote.url),e.serverToken?this.connectToServerSocket(e):new Promise((function(n,o){new(e.remote.providerOptions.provider?g:_)(t.uppy,e.remote.providerOptions).post(e.remote.url,a(a({},e.remote.body),{},{endpoint:r.endpoint,uploadUrl:r.uploadUrl,protocol:"tus",size:e.data.size,headers:r.headers,metadata:e.meta})).then((function(r){return t.uppy.setFileState(e.id,{serverToken:r.token}),e=t.uppy.getFile(e.id),t.connectToServerSocket(e)})).then((function(){n()})).catch((function(r){t.uppy.emit("upload-error",e,r),o(r)}))}))}},{key:"connectToServerSocket",value:function(e){var t=this;return new Promise((function(r,n){var o,i=e.serverToken,a=U(e.remote.companionUrl),s=new b({target:"".concat(a,"/api/").concat(i),autoOpen:!1});t.uploaderSockets[e.id]=s,t.uploaderEvents[e.id]=new R(t.uppy),t.onFileRemove(e.id,(function(){o.abort(),s.send("cancel",{}),t.resetUploaderReferences(e.id),r("upload ".concat(e.id," was removed"))})),t.onPause(e.id,(function(e){e?(o.abort(),s.send("pause",{})):(o.abort(),o=t.requests.run((function(){return s.send("resume",{}),function(){}})))})),t.onPauseAll(e.id,(function(){o.abort(),s.send("pause",{})})),t.onCancelAll(e.id,(function(){o.abort(),s.send("cancel",{}),t.resetUploaderReferences(e.id),r("upload ".concat(e.id," was canceled"))})),t.onResumeAll(e.id,(function(){o.abort(),e.error&&s.send("pause",{}),o=t.requests.run((function(){return s.send("resume",{}),function(){}}))})),t.onRetry(e.id,(function(){s.isOpen&&(s.send("pause",{}),s.send("resume",{}))})),t.onRetryAll(e.id,(function(){s.isOpen&&(s.send("pause",{}),s.send("resume",{}))})),s.on("progress",(function(r){return w(t,r,e)})),s.on("error",(function(r){var i=r.error.message,a=Object.assign(new Error(i),{cause:r.error});t.opts.useFastRemoteRetry?s.close():(t.resetUploaderReferences(e.id),t.uppy.setFileState(e.id,{serverToken:null})),t.uppy.emit("upload-error",e,a),o.done(),n(a)})),s.on("success",(function(n){var i={uploadURL:n.url};t.uppy.emit("upload-success",e,i),t.resetUploaderReferences(e.id),o.done(),r()})),o=t.requests.run((function(){return s.open(),e.isPaused&&s.send("pause",{}),function(){}}))}))}},{key:"onReceiveUploadUrl",value:function(e,t){var r=this.uppy.getFile(e.id);r&&(r.tus&&r.tus.uploadUrl===t||(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(r.id,{tus:a(a({},r.tus),{},{uploadUrl:t})})))}},{key:"onFileRemove",value:function(e,t){this.uploaderEvents[e].on("file-removed",(function(r){e===r.id&&t(r.id)}))}},{key:"onPause",value:function(e,t){this.uploaderEvents[e].on("upload-pause",(function(r,n){e===r&&t(n)}))}},{key:"onRetry",value:function(e,t){this.uploaderEvents[e].on("upload-retry",(function(r){e===r&&t()}))}},{key:"onRetryAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("retry-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onPauseAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("pause-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onCancelAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("cancel-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"onResumeAll",value:function(e,t){var r=this;this.uploaderEvents[e].on("resume-all",(function(){r.uppy.getFile(e)&&t()}))}},{key:"uploadFiles",value:function(e){var t=this,r=e.map((function(r,n){var o=n+1,i=e.length;return"error"in r&&r.error?Promise.reject(new Error(r.error)):r.isRemote?(r.progress.uploadStarted&&r.isRestored||t.uppy.emit("upload-started",r),t.uploadRemote(r,o,i)):(r.progress.uploadStarted&&r.isRestored||t.uppy.emit("upload-started",r),t.upload(r,o,i))}));return S(r)}},{key:"handleUpload",value:function(e){var t=this;if(0===e.length)return this.uppy.log("[Tus] No files to upload"),Promise.resolve();0===this.opts.limit&&this.uppy.log("[Tus] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/tus/#limit-0","warning"),this.uppy.log("[Tus] Uploading...");var r=e.map((function(e){return t.uppy.getFile(e)}));return this.uploadFiles(r).then((function(){return null}))}},{key:"install",value:function(){this.uppy.setState({capabilities:a(a({},this.uppy.getState().capabilities),{},{resumableUploads:!0})}),this.uppy.addUploader(this.handleUpload),this.uppy.on("reset-progress",this.handleResetProgress)}},{key:"uninstall",value:function(){this.uppy.setState({capabilities:a(a({},this.uppy.getState().capabilities),{},{resumableUploads:!1})}),this.uppy.removeUploader(this.handleUpload)}}]),r}(v),n.VERSION="2.2.0",i)}}]);
|
|
2
|
+
//# sourceMappingURL=6.4ca96426.chunk.js.map
|