uppy-8.x-1.x-dev/js/uppy.min.js
js/uppy.min.js
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Uppy=t()}}(function(){var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},n={limit:1,onStart:function(){},onProgress:function(){},onPartComplete:function(){},onSuccess:function(){},onError:function(t){throw t}};function r(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}var o=function(){function o(t,r){!function(t,e){if(!(t instanceof o))throw new TypeError("Cannot call a class as a function")}(this),this.options=e({},n,r),this.file=t,this.key=this.options.key||null,this.uploadId=this.options.uploadId||null,this.parts=this.options.parts||[],this.isPaused=!1,this.chunks=null,this.chunkState=null,this.uploading=[],this._initChunks()}return o.prototype._initChunks=function(){for(var t=[],e=Math.max(Math.ceil(this.file.size/1e4),5242880),n=0;n<this.file.size;n+=e){var r=Math.min(this.file.size,n+e);t.push(this.file.slice(n,r))}this.chunks=t,this.chunkState=t.map(function(){return{uploaded:0,busy:!1,done:!1}})},o.prototype._createUpload=function(){var e=this;return Promise.resolve().then(function(){return e.options.createMultipartUpload()}).then(function(e){if("object"!==(void 0===e?"undefined":t(e))||!e||"string"!=typeof e.uploadId||"string"!=typeof e.key)throw new TypeError("AwsS3/Multipart: Got incorrect result from 'createMultipartUpload()', expected an object '{ uploadId, key }'.");return e}).then(function(t){e.key=t.key,e.uploadId=t.uploadId,e.options.onStart(t)}).then(function(){e._uploadParts()}).catch(function(t){e._onError(t)})},o.prototype._resumeUpload=function(){var t=this;return Promise.resolve().then(function(){return t.options.listParts({uploadId:t.uploadId,key:t.key})}).then(function(e){e.forEach(function(e){var n=e.PartNumber-1;t.chunkState[n]={uploaded:e.Size,etag:e.ETag,done:!0},t.parts.some(function(t){return t.PartNumber===e.PartNumber})||t.parts.push({PartNumber:e.PartNumber,ETag:e.ETag})}),t._uploadParts()}).catch(function(e){t._onError(e)})},o.prototype._uploadParts=function(){var t=this;if(!this.isPaused){var e=this.options.limit-this.uploading.length;if(0!==e)if(this.chunkState.every(function(t){return t.done}))this._completeUpload();else{for(var n=[],r=0;r<this.chunkState.length;r++){var o=this.chunkState[r];if(!o.done&&!o.busy&&(n.push(r),n.length>=e))break}n.forEach(function(e){t._uploadPart(e)})}}},o.prototype._uploadPart=function(e){var n=this,r=this.chunks[e];return this.chunkState[e].busy=!0,Promise.resolve().then(function(){return n.options.prepareUploadPart({key:n.key,uploadId:n.uploadId,body:r,number:e+1})}).then(function(e){if("object"!==(void 0===e?"undefined":t(e))||!e||"string"!=typeof e.url)throw new TypeError("AwsS3/Multipart: Got incorrect result from 'prepareUploadPart()', expected an object '{ url }'.");return e}).then(function(t){var r=t.url;n._uploadPartBytes(e,r)},function(t){n._onError(t)})},o.prototype._onPartProgress=function(t,e,n){this.chunkState[t].uploaded=e;var r=this.chunkState.reduce(function(t,e){return t+e.uploaded},0);this.options.onProgress(r,this.file.size)},o.prototype._onPartComplete=function(t,e){this.chunkState[t].etag=e,this.chunkState[t].done=!0;var n={PartNumber:t+1,ETag:e};this.parts.push(n),this.options.onPartComplete(n),this._uploadParts()},o.prototype._uploadPartBytes=function(t,e){var n=this,o=this.chunks[t],i=new XMLHttpRequest;i.open("PUT",e,!0),i.responseType="text",this.uploading.push(i),i.upload.addEventListener("progress",function(e){e.lengthComputable&&n._onPartProgress(t,e.loaded,e.total)}),i.addEventListener("abort",function(e){r(n.uploading,e.target),n.chunkState[t].busy=!1}),i.addEventListener("load",function(e){if(r(n.uploading,e.target),n.chunkState[t].busy=!1,e.target.status<200||e.target.status>=300)n._onError(new Error("Non 2xx"));else{n._onPartProgress(t,o.size,o.size);var i=e.target.getResponseHeader("ETag");null!==i?n._onPartComplete(t,i):n._onError(new Error("AwsS3/Multipart: Could not read the ETag header. This likely means CORS is not configured correctly on the S3 Bucket. Seee https://uppy.io/docs/aws-s3-multipart#S3-Bucket-Configuration for instructions."))}}),i.addEventListener("error",function(e){r(n.uploading,e.target),n.chunkState[t].busy=!1;var o=new Error("Unknown error");o.source=e.target,n._onError(o)}),i.send(o)},o.prototype._completeUpload=function(){var t=this;return this.parts.sort(function(t,e){return t.PartNumber-e.PartNumber}),Promise.resolve().then(function(){return t.options.completeMultipartUpload({key:t.key,uploadId:t.uploadId,parts:t.parts})}).then(function(e){t.options.onSuccess(e)},function(e){t._onError(e)})},o.prototype._abortUpload=function(){this.uploading.slice().forEach(function(t){t.abort()}),this.options.abortMultipartUpload({key:this.key,uploadId:this.uploadId}),this.uploading=[]},o.prototype._onError=function(t){this.options.onError(t)},o.prototype.start=function(){this.isPaused=!1,this.uploadId?this._resumeUpload():this._createUpload()},o.prototype.pause=function(){this.uploading.slice().forEach(function(t){t.abort()}),this.isPaused=!0},o.prototype.abort=function(){if(!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).really)return this.pause();this._abortUpload()},o}(),i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.uppy=e,this.opts=n,this.onReceiveResponse=this.onReceiveResponse.bind(this)}return t.prototype.onReceiveResponse=function(t){var e,n=this.uppy.getState().companion||{},r=this.opts.serverUrl,o=t.headers;return o.has("i-am")&&o.get("i-am")!==n[r]&&this.uppy.setState({companion:i({},n,(e={},e[r]=o.get("i-am"),e))}),t},t.prototype._getUrl=function(t){return/^(https?:|)\/\//.test(t)?t:this.hostname+"/"+t},t.prototype.get=function(t){var e=this;return fetch(this._getUrl(t),{method:"get",headers:this.headers,credentials:"same-origin"}).then(this.onReceiveResponse).then(function(t){return t.json()}).catch(function(n){throw new Error("Could not get "+e._getUrl(t)+". "+n)})},t.prototype.post=function(t,e){var n=this;return fetch(this._getUrl(t),{method:"post",headers:this.headers,credentials:"same-origin",body:JSON.stringify(e)}).then(this.onReceiveResponse).then(function(e){if(e.status<200||e.status>300)throw new Error("Could not post "+n._getUrl(t)+". "+e.statusText);return e.json()}).catch(function(e){throw new Error("Could not post "+n._getUrl(t)+". "+e)})},t.prototype.delete=function(t,e){var n=this;return fetch(this.hostname+"/"+t,{method:"delete",headers:this.headers,credentials:"same-origin",body:e?JSON.stringify(e):null}).then(this.onReceiveResponse).then(function(t){return t.json()}).catch(function(e){throw new Error("Could not delete "+n._getUrl(t)+". "+e)})},s(t,[{key:"hostname",get:function(){var t=this.uppy.getState().companion,e=this.opts.serverUrl;return(t&&t[e]?t[e]:e).replace(/\/$/,"")}},{key:"defaultHeaders",get:function(){return{Accept:"application/json","Content-Type":"application/json"}}},{key:"headers",get:function(){return i({},this.defaultHeaders,this.opts.serverHeaders||{})}}]),t}(),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),p=function(t){return t.split("-").map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join(" ")},c=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.provider=r.provider,o.id=o.provider,o.authProvider=r.authProvider||o.provider,o.name=o.opts.name||p(o.id),o.tokenKey="companion-"+o.id+"-auth-token",o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.setAuthToken=function(t){localStorage.setItem(this.tokenKey,t)},e.prototype.checkAuth=function(){return this.get(this.id+"/authorized").then(function(t){return t.authenticated})},e.prototype.authUrl=function(){return this.hostname+"/"+this.id+"/connect"},e.prototype.fileUrl=function(t){return this.hostname+"/"+this.id+"/get/"+t},e.prototype.list=function(t){return this.get(this.id+"/list/"+(t||""))},e.prototype.logout=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:location.href;return this.get(this.id+"/logout?redirect="+e).then(function(e){return localStorage.removeItem(t.tokenKey),e})},e.initPlugin=function(t,e,n){if(t.type="acquirer",t.files=[],n&&(t.opts=l({},n,e)),e.serverPattern){var r=e.serverPattern;if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError(t.id+': the option "serverPattern" must be one of string, Array, RegExp');t.opts.serverPattern=r}else/^(?!https?:\/\/).*$/.test(e.serverUrl)?t.opts.serverPattern=location.protocol+"//"+e.serverUrl.replace(/^\/\//,""):t.opts.serverPattern=e.serverUrl},u(e,[{key:"defaultHeaders",get:function(){return l({},t.prototype.defaultHeaders,{"uppy-auth-token":localStorage.getItem(this.tokenKey)})}}]),e}(a),h=function(){var t={},e=t._fns={};return t.emit=function(t,n,r,o,i,s,a){var l=function(t){for(var n=e[t]?e[t]:[],r=t.indexOf(":"),o=-1===r?[t]:[t.substring(0,r),t.substring(r+1)],i=Object.keys(e),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(n=n.concat(e[l])),2===o.length&&o[0]===l){n=n.concat(e[l]);break}}return n}(t);l.length&&function(t,e,n){for(var r=0,o=e.length;r<o&&e[r];r++)e[r].event=t,e[r].apply(e[r],n)}(t,l,[n,r,o,i,s,a])},t.on=function(t,n){e[t]||(e[t]=[]),e[t].push(n)},t.once=function(e,n){this.on(e,function r(){n.apply(this,arguments),t.off(e,r)})},t.off=function(t,e){var n=[];if(t&&e)for(var r=this._fns[t],o=0,i=r?r.length:0;o<i;o++)r[o]!==e&&n.push(r[o]);n.length?this._fns[t]=n:delete this._fns[t]},t},d={RequestClient:a,Provider:c,Socket:function(){function t(e){var n=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.queued=[],this.isOpen=!1,this.socket=new WebSocket(e.target),this.emitter=h(),this.socket.onopen=function(t){for(n.isOpen=!0;n.queued.length>0&&n.isOpen;){var e=n.queued[0];n.send(e.action,e.payload),n.queued=n.queued.slice(1)}},this.socket.onclose=function(t){n.isOpen=!1},this._handleMessage=this._handleMessage.bind(this),this.socket.onmessage=this._handleMessage,this.close=this.close.bind(this),this.emit=this.emit.bind(this),this.on=this.on.bind(this),this.once=this.once.bind(this),this.send=this.send.bind(this)}return t.prototype.close=function(){return this.socket.close()},t.prototype.send=function(t,e){this.isOpen?this.socket.send(JSON.stringify({action:t,payload:e})):this.queued.push({action:t,payload:e})},t.prototype.on=function(t,e){this.emitter.on(t,e)},t.prototype.emit=function(t,e){this.emitter.emit(t,e)},t.prototype.once=function(t,e){this.emitter.once(t,e)},t.prototype._handleMessage=function(t){try{var e=JSON.parse(t.data);this.emit(e.action,e.payload)}catch(t){console.log(t)}},t}()},f=function(t,e){var n="000000000"+t;return n.substr(n.length-e)},y="object"==typeof window?window:self,g=Object.keys(y).length,m=f(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+g.toString(36),4),v=function(){return m},b={},w=0,S=4,_=36,P=Math.pow(_,S);function E(){return f((Math.random()*P<<0).toString(_),S)}function k(){return w=w<P?w:0,++w-1}function C(){return"c"+(new Date).getTime().toString(_)+f(k().toString(_),S)+v()+(E()+E())}C.slug=function(){var t=(new Date).getTime().toString(36),e=k().toString(36).slice(-4),n=v().slice(0,1)+v().slice(-1),r=E().slice(-2);return t.slice(-2)+e+n+r},C.isCuid=function(t){return"string"==typeof t&&!!t.startsWith("c")},C.isSlug=function(t){if("string"!=typeof t)return!1;var e=t.length;return e>=7&&e<=10},C.fingerprint=v,b=C;var T={};function O(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}O.prototype.match=function(t){var e,n,r=!0,o=this.parts,i=o.length;if("string"==typeof t||t instanceof String)if(this.hasWild||this.text==t){for(n=(t||"").split(this.separator),e=0;r&&e<i;e++)"*"!==o[e]&&(r=e<n.length&&o[e]===n[e]);r=r&&n}else r=!1;else if("function"==typeof t.splice)for(r=[],e=t.length;e--;)this.match(t[e])&&(r[r.length]=t[e]);else if("object"==typeof t)for(var s in r={},t)this.match(s)&&(r[s]=t[s]);return r},T=function(t,e,n){var r=new O(t,n||/[\/\.]/);return void 0!==e?r.match(e):r};var U=/[\/\+\.]/,F=function(t){if("number"!=typeof t||isNaN(t))throw new TypeError("Expected a number, got "+typeof t);var e=t<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(e&&(t=-t),t<1)return(e?"-":"")+t+" B";var r=Math.min(Math.floor(Math.log(t)/Math.log(1e3)),n.length-1);t=Number(t/Math.pow(1e3,r));var o=n[r];return t>=10||t%1==0?(e?"-":"")+t.toFixed(0)+" "+o:(e?"-":"")+t.toFixed(1)+" "+o},A={exports:{}};!function(){"use strict";function t(t,e){var n,r,o,i,s=_;for(i=arguments.length;i-- >2;)S.push(arguments[i]);for(e&&null!=e.children&&(S.length||S.push(e.children),delete e.children);S.length;)if((r=S.pop())&&void 0!==r.pop)for(i=r.length;i--;)S.push(r[i]);else"boolean"==typeof r&&(r=null),(o="function"!=typeof t)&&(null==r?r="":"number"==typeof r?r=String(r):"string"!=typeof r&&(o=!1)),o&&n?s[s.length-1]+=r:s===_?s=[r]:s.push(r),n=o;var a=new b;return a.nodeName=t,a.children=s,a.attributes=null==e?void 0:e,a.key=null==e?void 0:e.key,void 0!==w.vnode&&w.vnode(a),a}function e(t,e){for(var n in e)t[n]=e[n];return t}function n(t){!t.__d&&(t.__d=!0)&&1==k.push(t)&&(w.debounceRendering||P)(r)}function r(){var t,e=k;for(k=[];t=e.pop();)t.__d&&g(t)}function o(t,e){return t.__n===e||t.nodeName.toLowerCase()===e.toLowerCase()}function i(t){var n=e({},t.attributes);n.children=t.children;var r=t.nodeName.defaultProps;if(void 0!==r)for(var o in r)void 0===n[o]&&(n[o]=r[o]);return n}function s(t){var e=t.parentNode;e&&e.removeChild(t)}function a(t,e,n,r,o){if("className"===e&&(e="class"),"key"===e);else if("ref"===e)n&&n(null),r&&r(t);else if("class"!==e||o)if("style"===e){if(r&&"string"!=typeof r&&"string"!=typeof n||(t.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(t.style[i]="");for(var i in r)t.style[i]="number"==typeof r[i]&&!1===E.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===e)r&&(t.innerHTML=r.__html||"");else if("o"==e[0]&&"n"==e[1]){var s=e!==(e=e.replace(/Capture$/,""));e=e.toLowerCase().substring(2),r?n||t.addEventListener(e,l,s):t.removeEventListener(e,l,s),(t.__l||(t.__l={}))[e]=r}else if("list"!==e&&"type"!==e&&!o&&e in t){try{t[e]=null==r?"":r}catch(t){}null!=r&&!1!==r||"spellcheck"==e||t.removeAttribute(e)}else{var a=o&&e!==(e=e.replace(/^xlink:?/,""));null==r||!1===r?a?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.removeAttribute(e):"function"!=typeof r&&(a?t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),r):t.setAttribute(e,r))}else t.className=r||""}function l(t){return this.__l[t.type](w.event&&w.event(t)||t)}function u(){for(var t;t=C.pop();)w.afterMount&&w.afterMount(t),t.componentDidMount&&t.componentDidMount()}function p(t,e,n,r,l,p){T++||(O=null!=l&&void 0!==l.ownerSVGElement,U=null!=t&&!("__preactattr_"in t));var h=function t(e,n,r,l,u){var p=e,h=O;if(null!=n&&"boolean"!=typeof n||(n=""),"string"==typeof n||"number"==typeof n)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||u)?e.nodeValue!=n&&(e.nodeValue=n):(p=document.createTextNode(n),e&&(e.parentNode&&e.parentNode.replaceChild(p,e),c(e,!0))),p.__preactattr_=!0,p;var f,g,v=n.nodeName;if("function"==typeof v)return function(t,e,n,r){for(var o=t&&t._component,s=o,a=t,l=o&&t._componentConstructor===e.nodeName,u=l,p=i(e);o&&!u&&(o=o.__u);)u=o.constructor===e.nodeName;return o&&u&&(!r||o._component)?(y(o,p,3,n,r),t=o.base):(s&&!l&&(m(s),t=a=null),o=d(e.nodeName,p,n),t&&!o.__b&&(o.__b=t,a=null),y(o,p,1,n,r),t=o.base,a&&t!==a&&(a._component=null,c(a,!1))),t}(e,n,r,l);if(O="svg"===v||"foreignObject"!==v&&O,v=String(v),(!e||!o(e,v))&&(f=v,(g=O?document.createElementNS("http://www.w3.org/2000/svg",f):document.createElement(f)).__n=f,p=g,e)){for(;e.firstChild;)p.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(p,e),c(e,!0)}var b=p.firstChild,w=p.__preactattr_,S=n.children;if(null==w){w=p.__preactattr_={};for(var _=p.attributes,P=_.length;P--;)w[_[P].name]=_[P].value}return!U&&S&&1===S.length&&"string"==typeof S[0]&&null!=b&&void 0!==b.splitText&&null==b.nextSibling?b.nodeValue!=S[0]&&(b.nodeValue=S[0]):(S&&S.length||null!=b)&&function(e,n,r,i,a){var l,u,p,h,d,f,y,g,m=e.childNodes,v=[],b={},w=0,S=0,_=m.length,P=0,E=n?n.length:0;if(0!==_)for(var k=0;k<_;k++){var C=m[k],T=C.__preactattr_,O=E&&T?C._component?C._component.__k:T.key:null;null!=O?(w++,b[O]=C):(T||(void 0!==C.splitText?!a||C.nodeValue.trim():a))&&(v[P++]=C)}if(0!==E)for(var k=0;k<E;k++){h=n[k],d=null;var O=h.key;if(null!=O)w&&void 0!==b[O]&&(d=b[O],b[O]=void 0,w--);else if(S<P)for(l=S;l<P;l++)if(void 0!==v[l]&&(f=u=v[l],g=a,"string"==typeof(y=h)||"number"==typeof y?void 0!==f.splitText:"string"==typeof y.nodeName?!f._componentConstructor&&o(f,y.nodeName):g||f._componentConstructor===y.nodeName)){d=u,v[l]=void 0,l===P-1&&P--,l===S&&S++;break}d=t(d,h,r,i),p=m[k],d&&d!==e&&d!==p&&(null==p?e.appendChild(d):d===p.nextSibling?s(p):e.insertBefore(d,p))}if(w)for(var k in b)void 0!==b[k]&&c(b[k],!1);for(;S<=P;)void 0!==(d=v[P--])&&c(d,!1)}(p,S,r,l,U||null!=w.dangerouslySetInnerHTML),function(t,e,n){var r;for(r in n)e&&null!=e[r]||null==n[r]||a(t,r,n[r],n[r]=void 0,O);for(r in e)"children"===r||"innerHTML"===r||r in n&&e[r]===("value"===r||"checked"===r?t[r]:n[r])||a(t,r,n[r],n[r]=e[r],O)}(p,n.attributes,w),O=h,p}(t,e,n,r,p);return l&&h.parentNode!==l&&l.appendChild(h),--T||(U=!1,p||u()),h}function c(t,e){var n=t._component;n?m(n):(null!=t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),!1!==e&&null!=t.__preactattr_||s(t),h(t))}function h(t){for(t=t.lastChild;t;){var e=t.previousSibling;c(t,!0),t=e}}function d(t,e,n){var r,o=F.length;for(t.prototype&&t.prototype.render?(r=new t(e,n),v.call(r,e,n)):((r=new v(e,n)).constructor=t,r.render=f);o--;)if(F[o].constructor===t)return r.__b=F[o].__b,F.splice(o,1),r;return r}function f(t,e,n){return this.constructor(t,n)}function y(t,e,r,o,i){t.__x||(t.__x=!0,t.__r=e.ref,t.__k=e.key,delete e.ref,delete e.key,void 0===t.constructor.getDerivedStateFromProps&&(!t.base||i?t.componentWillMount&&t.componentWillMount():t.componentWillReceiveProps&&t.componentWillReceiveProps(e,o)),o&&o!==t.context&&(t.__c||(t.__c=t.context),t.context=o),t.__p||(t.__p=t.props),t.props=e,t.__x=!1,0!==r&&(1!==r&&!1===w.syncComponentUpdates&&t.base?n(t):g(t,1,i)),t.__r&&t.__r(t))}function g(t,n,r,o){if(!t.__x){var s,a,l,h=t.props,f=t.state,v=t.context,b=t.__p||h,S=t.__s||f,_=t.__c||v,P=t.base,E=t.__b,k=P||E,O=t._component,U=!1,F=_;if(t.constructor.getDerivedStateFromProps&&(f=e(e({},f),t.constructor.getDerivedStateFromProps(h,f)),t.state=f),P&&(t.props=b,t.state=S,t.context=_,2!==n&&t.shouldComponentUpdate&&!1===t.shouldComponentUpdate(h,f,v)?U=!0:t.componentWillUpdate&&t.componentWillUpdate(h,f,v),t.props=h,t.state=f,t.context=v),t.__p=t.__s=t.__c=t.__b=null,t.__d=!1,!U){s=t.render(h,f,v),t.getChildContext&&(v=e(e({},v),t.getChildContext())),P&&t.getSnapshotBeforeUpdate&&(F=t.getSnapshotBeforeUpdate(b,S));var A,x,D=s&&s.nodeName;if("function"==typeof D){var R=i(s);(a=O)&&a.constructor===D&&R.key==a.__k?y(a,R,1,v,!1):(A=a,t._component=a=d(D,R,v),a.__b=a.__b||E,a.__u=t,y(a,R,0,v,!1),g(a,1,r,!0)),x=a.base}else l=k,(A=O)&&(l=t._component=null),(k||1===n)&&(l&&(l._component=null),x=p(l,s,v,r||!P,k&&k.parentNode,!0));if(k&&x!==k&&a!==O){var I=k.parentNode;I&&x!==I&&(I.replaceChild(x,k),A||(k._component=null,c(k,!1)))}if(A&&m(A),t.base=x,x&&!o){for(var B=t,j=t;j=j.__u;)(B=j).base=x;x._component=B,x._componentConstructor=B.constructor}}for(!P||r?C.unshift(t):U||(t.componentDidUpdate&&t.componentDidUpdate(b,S,F),w.afterUpdate&&w.afterUpdate(t));t.__h.length;)t.__h.pop().call(t);T||o||u()}}function m(t){w.beforeUnmount&&w.beforeUnmount(t);var e=t.base;t.__x=!0,t.componentWillUnmount&&t.componentWillUnmount(),t.base=null;var n=t._component;n?m(n):e&&(e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),t.__b=e,s(e),F.push(t),h(e)),t.__r&&t.__r(null)}function v(t,e){this.__d=!0,this.context=e,this.props=t,this.state=this.state||{},this.__h=[]}var b=function(){},w={},S=[],_=[],P="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,E=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,k=[],C=[],T=0,O=!1,U=!1,F=[];e(v.prototype,{setState:function(t,r){this.__s||(this.__s=this.state),this.state=e(e({},this.state),"function"==typeof t?t(this.state,this.props):t),r&&this.__h.push(r),n(this)},forceUpdate:function(t){t&&this.__h.push(t),g(this,2)},render:function(){}});var x={h:t,createElement:t,cloneElement:function(n,r){return t(n.nodeName,e(e({},n.attributes),r),arguments.length>2?[].slice.call(arguments,2):n.children)},Component:v,render:function(t,e,n){return p(n,t,{},!1,e,!1)},rerender:r,options:w};A.exports=x}(),A=A.exports;var x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D=function(t){return t&&"object"===(void 0===t?"undefined":x(t))&&t.nodeType===Node.ELEMENT_NODE},R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I=function(t){return"string"==typeof t?document.querySelector(t):"object"===(void 0===t?"undefined":R(t))&&D(t)?t:void 0},B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},L=function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.uppy=e,this.opts=n||{},this.update=this.update.bind(this),this.mount=this.mount.bind(this),this.install=this.install.bind(this),this.uninstall=this.uninstall.bind(this)}return t.prototype.getPluginState=function(){return this.uppy.getState().plugins[this.id]||{}},t.prototype.setPluginState=function(t){var e,n=this.uppy.getState().plugins;this.uppy.setState({plugins:j({},n,(e={},e[this.id]=j({},n[this.id],t),e))})},t.prototype.update=function(t){void 0!==this.el&&this._updateUI&&this._updateUI(t)},t.prototype.onMount=function(){},t.prototype.mount=function(e,n){var r,o,i,s=this,a=n.id,l=I(e);if(l)return this.isTargetDOMEl=!0,this.rerender=function(t){s.uppy.getPlugin(s.id)&&(s.el=A.render(s.render(t),l,s.el))},this._updateUI=(r=this.rerender,o=null,i=null,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return i=e,o||(o=Promise.resolve().then(function(){return o=null,r.apply(void 0,i)})),o}),this.uppy.log("Installing "+a+" to a DOM element"),this.opts.replaceTargetContent&&(l.innerHTML=""),this.el=A.render(this.render(this.uppy.getState()),l),this.onMount(),this.el;var u=void 0;if("object"===(void 0===e?"undefined":B(e))&&e instanceof t)u=e;else if("function"==typeof e){var p=e;this.uppy.iteratePlugins(function(t){if(t instanceof p)return u=t,!1})}if(u)return this.uppy.log("Installing "+a+" to "+u.id),this.parent=u,this.el=u.addTarget(n),this.onMount(),this.el;throw this.uppy.log("Not installing "+a),new Error("Invalid target option given to "+a+". Please make sure that the element \n exists on the page, or that the plugin you are targeting has been installed. Check that the <script> tag initializing Uppy \n comes at the bottom of the page, before the closing </body> tag (see https://github.com/transloadit/uppy/issues/1042).")},t.prototype.render=function(t){throw new Error("Extend the render method to add your plugin to a DOM element")},t.prototype.addTarget=function(t){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},t.prototype.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.prototype.install=function(){},t.prototype.uninstall=function(){this.unmount()},t}(),M=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},N=function(){function t(){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.state={},this.callbacks=[]}return t.prototype.getState=function(){return this.state},t.prototype.setState=function(t){var e=M({},this.state),n=M({},this.state,t);this.state=n,this._publish(e,n,t)},t.prototype.subscribe=function(t){var e=this;return this.callbacks.push(t),function(){e.callbacks.splice(e.callbacks.indexOf(t),1)}},t.prototype._publish=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callbacks.forEach(function(t){t.apply(void 0,e)})},t}(),z=function(){return new N},q=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},H=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this);var n={locale:{strings:{},pluralize:function(t){return 1===t?0:1}}};this.opts=q({},n,e),this.locale=q({},n.locale,e.locale)}return t.prototype.interpolate=function(t,e){var n=String.prototype,r=n.split,o=n.replace,i=/\$/g,s=[t];for(var a in e)if("_"!==a&&e.hasOwnProperty(a)){var l=e[a];"string"==typeof l&&(l=o.call(e[a],i,"$$$$")),s=u(s,new RegExp("%\\{"+a+"\\}","g"),l)}return s;function u(t,e,n){var o=[];return t.forEach(function(t){r.call(t,e).forEach(function(t,e,r){""!==t&&o.push(t),e<r.length-1&&o.push(n)})}),o}},t.prototype.translate=function(t,e){return this.translateArray(t,e).join("")},t.prototype.translateArray=function(t,e){if(e&&void 0!==e.smart_count){var n=this.locale.pluralize(e.smart_count);return this.interpolate(this.opts.locale.strings[t][n],e)}return this.interpolate(this.opts.locale.strings[t],e)},t}(),W=function(t){return["uppy",t.name?t.name.toLowerCase().replace(/[^A-Z0-9]/gi,""):"",t.type,t.data.size,t.data.lastModified].filter(function(t){return t}).join("-")},X=function(t){var e=/(?:\.([^.]+))?$/.exec(t)[1];return{name:t.replace("."+e,""),extension:e}},V={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel"},G=function(t){var e=t.name?X(t.name).extension:null;return t.isRemote?t.type?t.type:V[e]:t.type?t.type:e&&V[e]?V[e]:"application/octet-stream"};function K(t){return 2!==t.length?0+t:t}var Y,J=function(){var t=new Date;return K(t.getHours().toString())+":"+K(t.getMinutes().toString())+":"+K(t.getSeconds().toString())},$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Z=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),tt=function(){function t(e){var n=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this);var r={strings:{youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},exceedsSize:"This file exceeds maximum allowed size of",youCanOnlyUploadFileTypes:"You can only upload:",companionError:"Connection with Companion failed",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectXFiles:{0:"Select %{smart_count} file",1:"Select %{smart_count} files"},cancel:"Cancel",logOut:"Log out"}},o={id:"uppy",autoProceed:!1,debug:!1,restrictions:{maxFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null},meta:{},onBeforeFileAdded:function(t,e){return t},onBeforeUpload:function(t){return t},locale:r,store:z()};this.opts=Q({},o,e),this.opts.restrictions=Q({},o.restrictions,this.opts.restrictions),this.locale=Q({},r,this.opts.locale),this.locale.strings=Q({},r.strings,this.opts.locale.strings),this.translator=new H({locale:this.locale}),this.i18n=this.translator.translate.bind(this.translator),this.plugins={},this.getState=this.getState.bind(this),this.getPlugin=this.getPlugin.bind(this),this.setFileMeta=this.setFileMeta.bind(this),this.setFileState=this.setFileState.bind(this),this.log=this.log.bind(this),this.info=this.info.bind(this),this.hideInfo=this.hideInfo.bind(this),this.addFile=this.addFile.bind(this),this.removeFile=this.removeFile.bind(this),this.pauseResume=this.pauseResume.bind(this),this._calculateProgress=this._calculateProgress.bind(this),this.updateOnlineStatus=this.updateOnlineStatus.bind(this),this.resetProgress=this.resetProgress.bind(this),this.pauseAll=this.pauseAll.bind(this),this.resumeAll=this.resumeAll.bind(this),this.retryAll=this.retryAll.bind(this),this.cancelAll=this.cancelAll.bind(this),this.retryUpload=this.retryUpload.bind(this),this.upload=this.upload.bind(this),this.emitter=h(),this.on=this.on.bind(this),this.off=this.off.bind(this),this.once=this.emitter.once.bind(this.emitter),this.emit=this.emitter.emit.bind(this.emitter),this.preProcessors=[],this.uploaders=[],this.postProcessors=[],this.store=this.opts.store,this.setState({plugins:{},files:{},currentUploads:{},capabilities:{resumableUploads:!1},totalProgress:0,meta:Q({},this.opts.meta),info:{isHidden:!0,type:"info",message:""}}),this._storeUnsubscribe=this.store.subscribe(function(t,e,r){n.emit("state-update",t,e,r),n.updateAll(e)}),this.opts.debug&&"undefined"!=typeof window&&(window.uppyLog="",window[this.opts.id]=this),this._addListeners()}return t.prototype.on=function(t,e){return this.emitter.on(t,e),this},t.prototype.off=function(t,e){return this.emitter.off(t,e),this},t.prototype.updateAll=function(t){this.iteratePlugins(function(e){e.update(t)})},t.prototype.setState=function(t){this.store.setState(t)},t.prototype.getState=function(){return this.store.getState()},t.prototype.setFileState=function(t,e){var n;if(!this.getState().files[t])throw new Error("Can\u2019t set state for "+t+" (the file could have been removed)");this.setState({files:Q({},this.getState().files,(n={},n[t]=Q({},this.getState().files[t],e),n))})},t.prototype.resetProgress=function(){var t={percentage:0,bytesUploaded:0,uploadComplete:!1,uploadStarted:!1},e=Q({},this.getState().files),n={};Object.keys(e).forEach(function(r){var o=Q({},e[r]);o.progress=Q({},o.progress,t),n[r]=o}),this.setState({files:n,totalProgress:0}),this.emit("reset-progress")},t.prototype.addPreProcessor=function(t){this.preProcessors.push(t)},t.prototype.removePreProcessor=function(t){var e=this.preProcessors.indexOf(t);-1!==e&&this.preProcessors.splice(e,1)},t.prototype.addPostProcessor=function(t){this.postProcessors.push(t)},t.prototype.removePostProcessor=function(t){var e=this.postProcessors.indexOf(t);-1!==e&&this.postProcessors.splice(e,1)},t.prototype.addUploader=function(t){this.uploaders.push(t)},t.prototype.removeUploader=function(t){var e=this.uploaders.indexOf(t);-1!==e&&this.uploaders.splice(e,1)},t.prototype.setMeta=function(t){var e=Q({},this.getState().meta,t),n=Q({},this.getState().files);Object.keys(n).forEach(function(e){n[e]=Q({},n[e],{meta:Q({},n[e].meta,t)})}),this.log("Adding metadata:"),this.log(t),this.setState({meta:e,files:n})},t.prototype.setFileMeta=function(t,e){var n=Q({},this.getState().files);if(n[t]){var r=Q({},n[t].meta,e);n[t]=Q({},n[t],{meta:r}),this.setState({files:n})}else this.log("Was trying to set metadata for a file that\u2019s not with us anymore: ",t)},t.prototype.getFile=function(t){return this.getState().files[t]},t.prototype.getFiles=function(){var t=this.getState().files;return Object.keys(t).map(function(e){return t[e]})},t.prototype._checkMinNumberOfFiles=function(t){var e=this.opts.restrictions.minNumberOfFiles;if(Object.keys(t).length<e)throw new Error(""+this.i18n("youHaveToAtLeastSelectX",{smart_count:e}))},t.prototype._checkRestrictions=function(t){var e=this.opts.restrictions,n=e.maxFileSize,r=e.maxNumberOfFiles,o=e.allowedFileTypes;if(r&&Object.keys(this.getState().files).length+1>r)throw new Error(""+this.i18n("youCanOnlyUploadX",{smart_count:r}));if(o&&!(o.filter(function(e){return e.indexOf("/")>-1?!!t.type&&function(t,e){function n(e){var n=T(e,t,U);return n&&n.length>=2}return e?n(e.split(";")[0]):n}(t.type,e):"."===e[0]&&t.extension===e.substr(1)?t.extension:void 0}).length>0)){var i=o.join(", ");throw new Error(this.i18n("youCanOnlyUploadFileTypes")+" "+i)}if(n&&t.data.size>n)throw new Error(this.i18n("exceedsSize")+" "+F(n))},t.prototype.addFile=function(t){var e,n=this,r=this.getState().files,o=this.opts.onBeforeFileAdded(t,r);if(!1!==o){if("object"===(void 0===o?"undefined":$(o))&&o){if(o.then)throw new TypeError("onBeforeFileAdded() returned a Promise, but this is no longer supported. It must be synchronous.");t=o}var i,s=G(t);i=t.name?t.name:"image"===s.split("/")[0]?s.split("/")[0]+"."+s.split("/")[1]:"noname";var a=X(i).extension,l=t.isRemote||!1,u=W(t),p=t.meta||{};p.name=i,p.type=s;var c={source:t.source||"",id:u,name:i,extension:a||"",meta:Q({},this.getState().meta,p),type:s,data:t.data,progress:{percentage:0,bytesUploaded:0,bytesTotal:t.data.size||0,uploadComplete:!1,uploadStarted:!1},size:t.data.size||0,isRemote:l,remote:t.remote||"",preview:t.preview};try{this._checkRestrictions(c)}catch(t){!function(t){var e="object"===(void 0===t?"undefined":$(t))?t:new Error(t);throw n.log(e.message),n.info(e.message,"error",5e3),e}(t)}this.setState({files:Q({},r,(e={},e[u]=c,e))}),this.emit("file-added",c),this.log("Added file: "+i+", "+u+", mime type: "+s),this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(function(){n.scheduledAutoProceed=null,n.upload().catch(function(t){console.error(t.stack||t.message||t)})},4))}else this.log("Not adding file because onBeforeFileAdded returned false")},t.prototype.removeFile=function(t){var e=this,n=this.getState(),r=n.files,o=n.currentUploads,i=Q({},r),s=i[t];delete i[t];var a=Q({},o),l=[];Object.keys(a).forEach(function(e){var n=o[e].fileIDs.filter(function(e){return e!==t});0!==n.length?a[e]=Q({},o[e],{fileIDs:n}):l.push(e)}),this.setState({currentUploads:a,files:i}),l.forEach(function(t){e._removeUpload(t)}),this._calculateTotalProgress(),this.emit("file-removed",s),this.log("File removed: "+s.id),s.preview&&0===s.preview.indexOf("blob:")&&URL.revokeObjectURL(s.preview)},t.prototype.pauseResume=function(t){if(!this.getFile(t).uploadComplete){var e=!this.getFile(t).isPaused;return this.setFileState(t,{isPaused:e}),this.emit("upload-pause",t,e),e}},t.prototype.pauseAll=function(){var t=Q({},this.getState().files);Object.keys(t).filter(function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted}).forEach(function(e){var n=Q({},t[e],{isPaused:!0});t[e]=n}),this.setState({files:t}),this.emit("pause-all")},t.prototype.resumeAll=function(){var t=Q({},this.getState().files);Object.keys(t).filter(function(e){return!t[e].progress.uploadComplete&&t[e].progress.uploadStarted}).forEach(function(e){var n=Q({},t[e],{isPaused:!1,error:null});t[e]=n}),this.setState({files:t}),this.emit("resume-all")},t.prototype.retryAll=function(){var t=Q({},this.getState().files),e=Object.keys(t).filter(function(e){return t[e].error});e.forEach(function(e){var n=Q({},t[e],{isPaused:!1,error:null});t[e]=n}),this.setState({files:t,error:null}),this.emit("retry-all",e);var n=this._createUpload(e);return this._runUpload(n)},t.prototype.cancelAll=function(){var t=this;this.emit("cancel-all"),Object.keys(this.getState().files).forEach(function(e){t.removeFile(e)}),this.setState({totalProgress:0,error:null})},t.prototype.retryUpload=function(t){var e=Q({},this.getState().files),n=Q({},e[t],{error:null,isPaused:!1});e[t]=n,this.setState({files:e}),this.emit("upload-retry",t);var r=this._createUpload([t]);return this._runUpload(r)},t.prototype.reset=function(){this.cancelAll()},t.prototype._calculateProgress=function(t,e){this.getFile(t.id)?(this.setFileState(t.id,{progress:Q({},this.getFile(t.id).progress,{bytesUploaded:e.bytesUploaded,bytesTotal:e.bytesTotal,percentage:Math.floor((e.bytesUploaded/e.bytesTotal*100).toFixed(2))})}),this._calculateTotalProgress()):this.log("Not setting progress for a file that has been removed: "+t.id)},t.prototype._calculateTotalProgress=function(){var t=Q({},this.getState().files),e=Object.keys(t).filter(function(e){return t[e].progress.uploadStarted}),n=100*e.length,r=0;e.forEach(function(e){r+=t[e].progress.percentage});var o=0===n?0:Math.floor((100*r/n).toFixed(2));this.setState({totalProgress:o})},t.prototype._addListeners=function(){var t=this;this.on("error",function(e){t.setState({error:e.message})}),this.on("upload-error",function(e,n){t.setFileState(e.id,{error:n.message}),t.setState({error:n.message});var r=t.i18n("failedToUpload",{file:e.name});"object"===(void 0===n?"undefined":$(n))&&n.message&&(r={message:r,details:n.message}),t.info(r,"error",5e3)}),this.on("upload",function(){t.setState({error:null})}),this.on("upload-started",function(e,n){t.getFile(e.id)?t.setFileState(e.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,percentage:0,bytesUploaded:0,bytesTotal:e.size}}):t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("upload-progress",this._calculateProgress),this.on("upload-success",function(e,n,r){var o=t.getFile(e.id).progress;t.setFileState(e.id,{progress:Q({},o,{uploadComplete:!0,percentage:100,bytesUploaded:o.bytesTotal}),uploadURL:r,isPaused:!1}),t._calculateTotalProgress()}),this.on("preprocess-progress",function(e,n){t.getFile(e.id)?t.setFileState(e.id,{progress:Q({},t.getFile(e.id).progress,{preprocess:n})}):t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("preprocess-complete",function(e){if(t.getFile(e.id)){var n=Q({},t.getState().files);n[e.id]=Q({},n[e.id],{progress:Q({},n[e.id].progress)}),delete n[e.id].progress.preprocess,t.setState({files:n})}else t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("postprocess-progress",function(e,n){t.getFile(e.id)?t.setFileState(e.id,{progress:Q({},t.getState().files[e.id].progress,{postprocess:n})}):t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("postprocess-complete",function(e){if(t.getFile(e.id)){var n=Q({},t.getState().files);n[e.id]=Q({},n[e.id],{progress:Q({},n[e.id].progress)}),delete n[e.id].progress.postprocess,t.setState({files:n})}else t.log("Not setting progress for a file that has been removed: "+e.id)}),this.on("restored",function(){t._calculateTotalProgress()}),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",function(){return t.updateOnlineStatus()}),window.addEventListener("offline",function(){return t.updateOnlineStatus()}),setTimeout(function(){return t.updateOnlineStatus()},3e3))},t.prototype.updateOnlineStatus=function(){void 0===window.navigator.onLine||window.navigator.onLine?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)},t.prototype.getID=function(){return this.opts.id},t.prototype.use=function(t,e){if("function"!=typeof t){var n="Expected a plugin class, but got "+(null===t?"null":void 0===t?"undefined":$(t))+". Please verify that the plugin was imported and spelled correctly.";throw new TypeError(n)}var r=new t(this,e),o=r.id;if(this.plugins[r.type]=this.plugins[r.type]||[],!o)throw new Error("Your plugin must have an id");if(!r.type)throw new Error("Your plugin must have a type");var i=this.getPlugin(o);if(i){var s="Already found a plugin named '"+i.id+"'. Tried to use: '"+o+"'.\nUppy plugins must have unique 'id' options. See https://uppy.io/docs/plugins/#id.";throw new Error(s)}return this.plugins[r.type].push(r),r.install(),this},t.prototype.getPlugin=function(t){var e=null;return this.iteratePlugins(function(n){if(n.id===t)return e=n,!1}),e},t.prototype.iteratePlugins=function(t){var e=this;Object.keys(this.plugins).forEach(function(n){e.plugins[n].forEach(t)})},t.prototype.removePlugin=function(t){this.log("Removing plugin "+t.id),this.emit("plugin-remove",t),t.uninstall&&t.uninstall();var e=this.plugins[t.type].slice(),n=e.indexOf(t);-1!==n&&(e.splice(n,1),this.plugins[t.type]=e);var r=this.getState();delete r.plugins[t.id],this.setState(r)},t.prototype.close=function(){var t=this;this.log("Closing Uppy instance "+this.opts.id+": removing all files and uninstalling plugins"),this.reset(),this._storeUnsubscribe(),this.iteratePlugins(function(e){t.removePlugin(e)})},t.prototype.info=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,r="object"===(void 0===t?"undefined":$(t));this.setState({info:{isHidden:!1,type:e,message:r?t.message:t,details:r?t.details:null}}),this.emit("info-visible"),clearTimeout(this.infoTimeoutID),this.infoTimeoutID=0!==n?setTimeout(this.hideInfo,n):void 0},t.prototype.hideInfo=function(){var t=Q({},this.getState().info,{isHidden:!0});this.setState({info:t}),this.emit("info-hidden")},t.prototype.log=function(t,e){if(this.opts.debug){var n="[Uppy] ["+J()+"] "+t;window.uppyLog=window.uppyLog+"\nDEBUG LOG: "+t,"error"!==e?"warning"!==e?t===""+t?console.log(n):(n="[Uppy] ["+J()+"]",console.log(n),console.dir(t)):console.warn(n):console.error(n)}},t.prototype.run=function(){return this.log("Calling run() is no longer necessary.","warning"),this},t.prototype.restore=function(t){return this.log('Core: attempting to restore upload "'+t+'"'),this.getState().currentUploads[t]?this._runUpload(t):(this._removeUpload(t),Promise.reject(new Error("Nonexistent upload")))},t.prototype._createUpload=function(t){var e,n=b();return this.emit("upload",{id:n,fileIDs:t}),this.setState({currentUploads:Q({},this.getState().currentUploads,(e={},e[n]={fileIDs:t,step:0,result:{}},e))}),n},t.prototype._getUpload=function(t){return this.getState().currentUploads[t]},t.prototype.addResultData=function(t,e){var n;if(this._getUpload(t)){var r=this.getState().currentUploads,o=Q({},r[t],{result:Q({},r[t].result,e)});this.setState({currentUploads:Q({},r,(n={},n[t]=o,n))})}else this.log("Not setting result for an upload that has been removed: "+t)},t.prototype._removeUpload=function(t){var e=Q({},this.getState().currentUploads);delete e[t],this.setState({currentUploads:e})},t.prototype._runUpload=function(t){var e=this,n=this.getState().currentUploads[t],r=n.fileIDs,o=n.step,i=[].concat(this.preProcessors,this.uploaders,this.postProcessors),s=Promise.resolve();return i.forEach(function(n,i){i<o||(s=s.then(function(){var o,s=e.getState().currentUploads,a=Q({},s[t],{step:i});return e.setState({currentUploads:Q({},s,(o={},o[t]=a,o))}),n(r,t)}).then(function(t){return null}))}),s.catch(function(n){e.emit("error",n,t),e._removeUpload(t)}),s.then(function(){var n=r.map(function(t){return e.getFile(t)}),o=n.filter(function(t){return t&&!t.error}),i=n.filter(function(t){return t&&t.error});e.addResultData(t,{successful:o,failed:i,uploadID:t});var s=e.getState().currentUploads;if(s[t]){var a=s[t].result;return e.emit("complete",a),e._removeUpload(t),a}e.log("Not setting result for an upload that has been removed: "+t)})},t.prototype.upload=function(){var t=this;this.plugins.uploader||this.log("No uploader type plugins are used","warning");var e=this.getState().files,n=this.opts.onBeforeUpload(e);if(!1===n)return Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false"));if(n&&"object"===(void 0===n?"undefined":$(n))){if(n.then)throw new TypeError("onBeforeUpload() returned a Promise, but this is no longer supported. It must be synchronous.");e=n}return Promise.resolve().then(function(){return t._checkMinNumberOfFiles(e)}).then(function(){var n=t.getState().currentUploads,r=Object.keys(n).reduce(function(t,e){return t.concat(n[e].fileIDs)},[]),o=[];Object.keys(e).forEach(function(e){var n=t.getFile(e);n.progress.uploadStarted||-1!==r.indexOf(e)||o.push(n.id)});var i=t._createUpload(o);return t._runUpload(i)}).catch(function(e){var n="object"===(void 0===e?"undefined":$(e))?e.message:e,r="object"===(void 0===e?"undefined":$(e))?e.details:null;return t.log(n+" "+r),t.info({message:n,details:r},"error",4e3),Promise.reject("object"===(void 0===e?"undefined":$(e))?e:new Error(e))})},Z(t,[{key:"state",get:function(){return this.getState()}}]),t}();(Y=function(t){return new tt(t)}).Uppy=tt,Y.Plugin=L;var et={};(function(t){var e="Expected a function",n=NaN,r="[object Symbol]",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt,u="object"==typeof t&&t&&t.Object===Object&&t,p="object"==typeof self&&self&&self.Object===Object&&self,c=u||p||Function("return this")(),h=Object.prototype.toString,d=Math.max,f=Math.min,y=function(){return c.Date.now()};function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&h.call(t)==r}(t))return n;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var u=s.test(t);return u||a.test(t)?l(t.slice(2),u?2:8):i.test(t)?n:+t}et=function(t,n,r){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError(e);return g(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),function(t,n,r){var o,i,s,a,l,u,p=0,c=!1,h=!1,v=!0;if("function"!=typeof t)throw new TypeError(e);function b(e){var n=o,r=i;return o=i=void 0,p=e,a=t.apply(r,n)}function w(t){var e=t-u;return void 0===u||e>=n||e<0||h&&t-p>=s}function S(){var t=y();if(w(t))return _(t);l=setTimeout(S,function(t){var e=n-(t-u);return h?f(e,s-(t-p)):e}(t))}function _(t){return l=void 0,v&&o?b(t):(o=i=void 0,a)}function P(){var t=y(),e=w(t);if(o=arguments,i=this,u=t,e){if(void 0===l)return function(t){return p=t,l=setTimeout(S,n),c?b(t):a}(u);if(h)return l=setTimeout(S,n),b(u)}return void 0===l&&(l=setTimeout(S,n)),a}return n=m(n)||0,g(r)&&(c=!!r.leading,s=(h="maxWait"in r)?d(m(r.maxWait)||0,n):s,v="trailing"in r?!!r.trailing:v),P.cancel=function(){void 0!==l&&clearTimeout(l),p=0,o=u=i=l=void 0},P.flush=function(){return void 0===l?a:_(y())},P}(t,n,{leading:o,maxWait:n,trailing:i})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var nt=et(function(t,e,n){var r=e.progress,o=e.bytesUploaded,i=e.bytesTotal;r&&(t.uppy.log("Upload progress: "+r),t.uppy.emit("upload-progress",n,{uploader:t,bytesUploaded:o,bytesTotal:i}))},300,{leading:!0,trailing:!0}),rt=function(t){var e=/^(?:https?:\/\/|\/\/)?(?:[^@\n]+@)?(?:www\.)?([^\n]+)/.exec(t)[1];return("https:"===location.protocol?"wss":"ws")+"://"+e},ot=function(t){var e=0,n=[];return function(o){return function(){for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];var l=function(){e++;var t=o.apply(void 0,s);return t.then(r,r),t};return e>=t?new Promise(function(t,e){n.push(function(){l().then(t,e)})}):l()}};function r(){e--;var t=n.shift();t&&t()}},it=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},st=d.Socket,at=d.RequestClient;function lt(t){var e=[];return{on:function(n,r){return e.push([n,r]),t.on(n,r)},remove:function(){e.forEach(function(e){var n=e[0],r=e[1];t.off(n,r)})}}}function ut(t){if(t&&t.error){var e=new Error(t.message);throw it(e,t.error),e}return t}var pt,ct=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="AwsS3Multipart",o.title="AWS S3 Multipart",o.client=new at(n,r);var i={timeout:3e4,limit:0,createMultipartUpload:o.createMultipartUpload.bind(o),listParts:o.listParts.bind(o),prepareUploadPart:o.prepareUploadPart.bind(o),abortMultipartUpload:o.abortMultipartUpload.bind(o),completeMultipartUpload:o.completeMultipartUpload.bind(o)};return o.opts=it({},i,r),o.upload=o.upload.bind(o),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitRequests=ot(o.opts.limit):o.limitRequests=function(t){return t},o.uploaders=Object.create(null),o.uploaderEvents=Object.create(null),o.uploaderSockets=Object.create(null),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.resetUploaderReferences=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.uploaders[t]&&(this.uploaders[t].abort({really:e.abort||!1}),this.uploaders[t]=null),this.uploaderEvents[t]&&(this.uploaderEvents[t].remove(),this.uploaderEvents[t]=null),this.uploaderSockets[t]&&(this.uploaderSockets[t].close(),this.uploaderSockets[t]=null)},e.prototype.assertHost=function(){if(!this.opts.serverUrl)throw new Error("Expected a `serverUrl` option containing a Companion address.")},e.prototype.createMultipartUpload=function(t){return this.assertHost(),this.client.post("s3/multipart",{filename:t.name,type:t.type}).then(ut)},e.prototype.listParts=function(t,e){var n=e.key,r=e.uploadId;this.assertHost();var o=encodeURIComponent(n);return this.client.get("s3/multipart/"+r+"?key="+o).then(ut)},e.prototype.prepareUploadPart=function(t,e){var n=e.key,r=e.uploadId,o=e.number;this.assertHost();var i=encodeURIComponent(n);return this.client.get("s3/multipart/"+r+"/"+o+"?key="+i).then(ut)},e.prototype.completeMultipartUpload=function(t,e){var n=e.key,r=e.uploadId,o=e.parts;this.assertHost();var i=encodeURIComponent(n),s=encodeURIComponent(r);return this.client.post("s3/multipart/"+s+"/complete?key="+i,{parts:o}).then(ut)},e.prototype.abortMultipartUpload=function(t,e){var n=e.key,r=e.uploadId;this.assertHost();var o=encodeURIComponent(n),i=encodeURIComponent(r);return this.client.delete("s3/multipart/"+i+"?key="+o).then(ut)},e.prototype.uploadFile=function(t){var e=this;return new Promise(function(n,r){var i=new o(t.data,it({createMultipartUpload:e.limitRequests(e.opts.createMultipartUpload.bind(e,t)),listParts:e.limitRequests(e.opts.listParts.bind(e,t)),prepareUploadPart:e.opts.prepareUploadPart.bind(e,t),completeMultipartUpload:e.limitRequests(e.opts.completeMultipartUpload.bind(e,t)),abortMultipartUpload:e.limitRequests(e.opts.abortMultipartUpload.bind(e,t)),limit:e.opts.limit||5,onStart:function(n){var r=e.uppy.getFile(t.id);e.uppy.setFileState(t.id,{s3Multipart:it({},r.s3Multipart,{key:n.key,uploadId:n.uploadId,parts:[]})})},onProgress:function(n,r){e.uppy.emit("upload-progress",t,{uploader:e,bytesUploaded:n,bytesTotal:r})},onError:function(n){e.uppy.log(n),e.uppy.emit("upload-error",t,n),n.message="Failed because: "+n.message,e.resetUploaderReferences(t.id),r(n)},onSuccess:function(r){e.uppy.emit("upload-success",t,i,r.location),r.location&&e.uppy.log("Download "+i.file.name+" from "+r.location),e.resetUploaderReferences(t.id),n(i)},onPartComplete:function(n){var r=e.uppy.getFile(t.id);r&&(e.uppy.setFileState(t.id,{s3Multipart:it({},r.s3Multipart,{parts:[].concat(r.s3Multipart.parts,[n])})}),e.uppy.emit("s3-multipart:part-uploaded",r,n))}},t.s3Multipart));e.uploaders[t.id]=i,e.uploaderEvents[t.id]=lt(e.uppy),e.onFileRemove(t.id,function(r){e.resetUploaderReferences(t.id,{abort:!0}),n("upload "+r.id+" was removed")}),e.onFilePause(t.id,function(t){t?i.pause():i.start()}),e.onPauseAll(t.id,function(){i.pause()}),e.onResumeAll(t.id,function(){i.start()}),t.isPaused||i.start(),t.isRestored||e.uppy.emit("upload-started",t,i)})},e.prototype.uploadRemote=function(t){var e=this;return this.resetUploaderReferences(t.id),new Promise(function(n,r){if(t.serverToken)return e.connectToServerSocket(t).then(function(){return n()}).catch(r);e.uppy.emit("upload-started",t),fetch(t.remote.url,{method:"post",credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(it({},t.remote.body,{protocol:"s3-multipart",size:t.data.size,metadata:t.meta}))}).then(function(n){return n.status<200||n.status>300?r(n.statusText):n.json().then(function(n){return e.uppy.setFileState(t.id,{serverToken:n.token}),e.uppy.getFile(t.id)})}).then(function(t){return e.connectToServerSocket(t)}).then(function(){n()}).catch(function(t){r(new Error(t))})})},e.prototype.connectToServerSocket=function(t){var e=this;return new Promise(function(n,r){var o=t.serverToken,i=rt(t.remote.serverUrl),s=new st({target:i+"/api/"+o});e.uploaderSockets[s]=s,e.uploaderEvents[t.id]=lt(e.uppy),e.onFileRemove(t.id,function(r){e.resetUploaderReferences(t.id,{abort:!0}),n("upload "+t.id+" was removed")}),e.onFilePause(t.id,function(t){s.send(t?"pause":"resume",{})}),e.onPauseAll(t.id,function(){return s.send("pause",{})}),e.onResumeAll(t.id,function(){t.error&&s.send("pause",{}),s.send("resume",{})}),e.onRetry(t.id,function(){s.send("pause",{}),s.send("resume",{})}),e.onRetryAll(t.id,function(){s.send("pause",{}),s.send("resume",{})}),t.isPaused&&s.send("pause",{}),s.on("progress",function(n){return nt(e,n,t)}),s.on("error",function(n){e.uppy.emit("upload-error",t,new Error(n.error)),r(new Error(n.error))}),s.on("success",function(r){e.uppy.emit("upload-success",t,r,r.url),n()})})},e.prototype.upload=function(t){var e=this;if(0===t.length)return Promise.resolve();var n=t.map(function(t){var n=e.uppy.getFile(t);return n.isRemote?e.uploadRemote(n):e.uploadFile(n)});return Promise.all(n)},e.prototype.onFileRemove=function(t,e){this.uploaderEvents[t].on("file-removed",function(n){t===n.id&&e(n.id)})},e.prototype.onFilePause=function(t,e){this.uploaderEvents[t].on("upload-pause",function(n,r){t===n&&e(r)})},e.prototype.onRetry=function(t,e){this.uploaderEvents[t].on("upload-retry",function(n){t===n&&e()})},e.prototype.onRetryAll=function(t,e){var n=this;this.uploaderEvents[t].on("retry-all",function(r){n.uppy.getFile(t)&&e()})},e.prototype.onPauseAll=function(t,e){var n=this;this.uploaderEvents[t].on("pause-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.onResumeAll=function(t,e){var n=this;this.uploaderEvents[t].on("resume-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.install=function(){var t=this,e=this.uppy.getState().capabilities;this.uppy.setState({capabilities:it({},e,{resumableUploads:!0})}),this.uppy.addUploader(this.upload),this.uppy.on("cancel-all",function(){t.uppy.getFiles().forEach(function(e){t.resetUploaderReferences(e.id,{abort:!0})})})},e.prototype.uninstall=function(){this.uppy.setState({capabilities:it({},this.uppy.getState().capabilities,{resumableUploads:!1})}),this.uppy.removeUploader(this.upload)},e}(Y.Plugin),ht={};pt=function(){return function(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var n=document.getElementsByTagName("head")[0];n.insertBefore(e,n.firstChild);for(var r,o=document.createElement("a"),i=1;i<t;i++)o.href=arguments[i],r=o.href,e.href=r;return n.removeChild(e),r}},"object"==typeof ht?ht=pt():this.resolveUrl=pt();var dt=function(t){var e=[],n=[];function r(t){e.push(t)}function o(t){n.push(t)}return Promise.all(t.map(function(t){return t.then(r,o)})).then(function(){return{successful:e,failed:n}})},ft=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},yt=d.Provider,gt=d.Socket;function mt(t,e){return e||(e=new Error("Upload error")),"string"==typeof e&&(e=new Error(e)),e instanceof Error||(e=ft(new Error("Upload error"),{data:e})),e.request=t,e}var vt=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="XHRUpload",o.title="XHRUpload";var i={strings:{timedOut:"Upload stalled for %{seconds} seconds, aborting."}},s={formData:!0,fieldName:"files[]",method:"post",metaFields:null,responseUrlFieldName:"url",bundle:!1,headers:{},locale:i,timeout:3e4,limit:0,withCredentials:!1,getResponseData:function(t,e){var n={};try{n=JSON.parse(t)}catch(t){console.log(t)}return n},getResponseError:function(t,e){return new Error("Upload error")}};if(o.opts=ft({},s,r),o.locale=ft({},i,o.opts.locale),o.locale.strings=ft({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.handleUpload=o.handleUpload.bind(o),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitUploads=ot(o.opts.limit):o.limitUploads=function(t){return t},o.opts.bundle&&!o.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");return o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getOptions=function(t){var e=this.uppy.getState().xhrUpload,n=ft({},this.opts,e||{},t.xhrUpload||{});return n.headers={},ft(n.headers,this.opts.headers),e&&ft(n.headers,e.headers),t.xhrUpload&&ft(n.headers,t.xhrUpload.headers),n},e.prototype.createProgressTimeout=function(t,e){var n=this.uppy,r=this,o=!1;function i(){n.log("[XHRUpload] timed out");var o=new Error(r.i18n("timedOut",{seconds:Math.ceil(t/1e3)}));e(o)}var s=null;return{progress:function(){o||t>0&&(s&&clearTimeout(s),s=setTimeout(i,t))},done:function(){n.log("[XHRUpload] timer done"),s&&(clearTimeout(s),s=null),o=!0}}},e.prototype.createFormDataUpload=function(t,e){var n=new FormData;return(Array.isArray(e.metaFields)?e.metaFields:Object.keys(t.meta)).forEach(function(e){n.append(e,t.meta[e])}),t.name?n.append(e.fieldName,t.data,t.name):n.append(e.fieldName,t.data),n},e.prototype.createBareUpload=function(t,e){return t.data},e.prototype.upload=function(t,e,n){var r=this,o=this.getOptions(t);return this.uppy.log("uploading "+e+" of "+n),new Promise(function(e,n){var i=o.formData?r.createFormDataUpload(t,o):r.createBareUpload(t,o),s=r.createProgressTimeout(o.timeout,function(e){a.abort(),r.uppy.emit("upload-error",t,e),n(e)}),a=new XMLHttpRequest,l=b();a.upload.addEventListener("loadstart",function(t){r.uppy.log("[XHRUpload] "+l+" started"),s.progress()}),a.upload.addEventListener("progress",function(e){r.uppy.log("[XHRUpload] "+l+" progress: "+e.loaded+" / "+e.total),s.progress(),e.lengthComputable&&r.uppy.emit("upload-progress",t,{uploader:r,bytesUploaded:e.loaded,bytesTotal:e.total})}),a.addEventListener("load",function(i){if(r.uppy.log("[XHRUpload] "+l+" finished"),s.done(),i.target.status>=200&&i.target.status<300){var u=o.getResponseData(a.responseText,a),p=u[o.responseUrlFieldName],c={status:i.target.status,body:u,uploadURL:p};return r.uppy.setFileState(t.id,{response:c}),r.uppy.emit("upload-success",t,u,p),p&&r.uppy.log("Download "+t.name+" from "+t.uploadURL),e(t)}var h=o.getResponseData(a.responseText,a),d=mt(a,o.getResponseError(a.responseText,a)),f={status:i.target.status,body:h};return r.uppy.setFileState(t.id,{response:f}),r.uppy.emit("upload-error",t,d),n(d)}),a.addEventListener("error",function(e){r.uppy.log("[XHRUpload] "+l+" errored"),s.done();var i=mt(a,o.getResponseError(a.responseText,a));return r.uppy.emit("upload-error",t,i),n(i)}),a.open(o.method.toUpperCase(),o.endpoint,!0),a.withCredentials=o.withCredentials,Object.keys(o.headers).forEach(function(t){a.setRequestHeader(t,o.headers[t])}),a.send(i),r.uppy.on("file-removed",function(e){e.id===t.id&&(s.done(),a.abort())}),r.uppy.on("upload-cancel",function(e){e===t.id&&(s.done(),a.abort())}),r.uppy.on("cancel-all",function(){s.done(),a.abort()})})},e.prototype.uploadRemote=function(t,e,n){var r=this,o=this.getOptions(t);return new Promise(function(e,n){var i={};(Array.isArray(o.metaFields)?o.metaFields:Object.keys(t.meta)).forEach(function(e){i[e]=t.meta[e]}),new yt(r.uppy,t.remote.providerOptions).post(t.remote.url,ft({},t.remote.body,{endpoint:o.endpoint,size:t.data.size,fieldname:o.fieldName,metadata:i,headers:o.headers})).then(function(i){var s=i.token,a=rt(t.remote.serverUrl),l=new gt({target:a+"/api/"+s});l.on("progress",function(e){return nt(r,e,t)}),l.on("success",function(n){var i=o.getResponseData(n.response.responseText,n.response),s=i[o.responseUrlFieldName];return r.uppy.emit("upload-success",t,i,s),l.close(),e()}),l.on("error",function(e){var i=e.response,s=i?o.getResponseError(i.responseText,i):ft(new Error(e.error.message),{cause:e.error});r.uppy.emit("upload-error",t,s),n(s)})})})},e.prototype.uploadBundle=function(t){var e=this;return new Promise(function(n,r){var o=e.opts.endpoint,i=e.opts.method,s=new FormData;t.forEach(function(t,n){var r=e.getOptions(t);s.append(r.fieldName,t.data)});var a=new XMLHttpRequest;a.withCredentials=e.opts.withCredentials;var l=e.createProgressTimeout(e.opts.timeout,function(t){a.abort(),u(t),r(t)}),u=function(n){t.forEach(function(t){e.uppy.emit("upload-error",t,n)})};a.upload.addEventListener("loadstart",function(t){e.uppy.log("[XHRUpload] started uploading bundle"),l.progress()}),a.upload.addEventListener("progress",function(n){l.progress(),n.lengthComputable&&t.forEach(function(t){e.uppy.emit("upload-progress",t,{uploader:e,bytesUploaded:n.loaded/n.total*t.size,bytesTotal:t.size})})}),a.addEventListener("load",function(o){if(l.done(),o.target.status>=200&&o.target.status<300){var i=e.opts.getResponseData(a.responseText,a);return t.forEach(function(t){e.uppy.emit("upload-success",t,i)}),n()}var s=e.opts.getResponseError(a.responseText,a)||new Error("Upload error");return s.request=a,u(s),r(s)}),a.addEventListener("error",function(t){l.done();var n=e.opts.getResponseError(a.responseText,a)||new Error("Upload error");return u(n),r(n)}),e.uppy.on("cancel-all",function(){l.done(),a.abort()}),a.open(i.toUpperCase(),o,!0),a.withCredentials=e.opts.withCredentials,Object.keys(e.opts.headers).forEach(function(t){a.setRequestHeader(t,e.opts.headers[t])}),a.send(s),t.forEach(function(t){e.uppy.emit("upload-started",t)})})},e.prototype.uploadFiles=function(t){var e=this,n=t.map(function(n,r){var o=parseInt(r,10)+1,i=t.length;return n.error?function(){return Promise.reject(new Error(n.error))}:n.isRemote?(e.uppy.emit("upload-started",n),e.uploadRemote.bind(e,n,o,i)):(e.uppy.emit("upload-started",n),e.upload.bind(e,n,o,i))}).map(function(t){return e.limitUploads(t)()});return dt(n)},e.prototype.handleUpload=function(t){var e=this;if(0===t.length)return this.uppy.log("[XHRUpload] No files to upload!"),Promise.resolve();this.uppy.log("[XHRUpload] Uploading...");var n=t.map(function(t){return e.uppy.getFile(t)});return this.opts.bundle?this.uploadBundle(n):this.uploadFiles(n).then(function(){return null})},e.prototype.install=function(){this.opts.bundle&&this.uppy.setState({capabilities:ft({},this.uppy.getState().capabilities,{bundled:!0})}),this.uppy.addUploader(this.handleUpload)},e.prototype.uninstall=function(){this.opts.bundle&&this.uppy.setState({capabilities:ft({},this.uppy.getState().capabilities,{bundled:!0})}),this.uppy.removeUploader(this.handleUpload)},e}(Y.Plugin),bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function St(t){var e=t.headers?t.headers["content-type"]:t.getResponseHeader("Content-Type");return"string"==typeof e&&"application/xml"===e.toLowerCase()}var _t,Pt,Et,kt=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="AwsS3",o.title="AWS S3";var i={strings:{preparingUpload:"Preparing upload..."}},s={timeout:3e4,limit:0,getUploadParameters:o.getUploadParameters.bind(o),locale:i};return o.opts=wt({},s,r),o.locale=wt({},i,o.opts.locale),o.locale.strings=wt({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.prepareUpload=o.prepareUpload.bind(o),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitRequests=ot(o.opts.limit):o.limitRequests=function(t){return t},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUploadParameters=function(t){if(!this.opts.serverUrl)throw new Error("Expected a `serverUrl` option containing a Companion address.");var e=encodeURIComponent(t.name),n=encodeURIComponent(t.type);return fetch(this.opts.serverUrl+"/s3/params?filename="+e+"&type="+n,{method:"get",headers:{accept:"application/json"}}).then(function(t){return t.json()})},e.prototype.validateParameters=function(t,e){if("object"!==(void 0===e?"undefined":bt(e))||!e||"string"!=typeof e.url||"object"!==bt(e.fields)&&null!=e.fields||null!=e.method&&!/^(put|post)$/i.test(e.method)){var n=new TypeError("AwsS3: got incorrect result from 'getUploadParameters()' for file '"+t.name+"', expected an object '{ url, method, fields, headers }'.\nSee https://uppy.io/docs/aws-s3/#getUploadParameters-file for more on the expected format.");throw console.error(n),n}return e},e.prototype.prepareUpload=function(t){var e=this;t.forEach(function(t){var n=e.uppy.getFile(t);e.uppy.emit("preprocess-progress",n,{mode:"determinate",message:e.i18n("preparingUpload"),value:0})});var n=this.limitRequests(this.opts.getUploadParameters);return Promise.all(t.map(function(t){var r=e.uppy.getFile(t);return Promise.resolve().then(function(){return n(r)}).then(function(t){return e.validateParameters(r,t)}).then(function(t){return e.uppy.emit("preprocess-progress",r,{mode:"determinate",message:e.i18n("preparingUpload"),value:1}),t}).catch(function(t){e.uppy.emit("upload-error",r,t)})})).then(function(n){var r={};t.forEach(function(t,o){var i=e.uppy.getFile(t);if(!i.error){var s=n[o],a=s.method,l=void 0===a?"post":a,u=s.url,p=s.fields,c=s.headers,h={method:l,formData:"post"===l.toLowerCase(),endpoint:u,metaFields:Object.keys(p)};c&&(h.headers=c);var d=wt({},i,{meta:wt({},i.meta,p),xhrUpload:h});r[t]=d}}),e.uppy.setState({files:wt({},e.uppy.getState().files,r)}),t.forEach(function(t){var n=e.uppy.getFile(t);e.uppy.emit("preprocess-complete",n)})})},e.prototype.install=function(){var t=this.uppy.log;this.uppy.addPreProcessor(this.prepareUpload);var e=!1;this.uppy.use(vt,{fieldName:"file",responseUrlFieldName:"location",timeout:this.opts.timeout,limit:this.opts.limit,getResponseData:function(n,r){if(!St(r))return"POST"===this.method.toUpperCase()?(e||(t("[AwsS3] No response data found, make sure to set the success_action_status AWS SDK option to 201. See https://uppy.io/docs/aws-s3/#POST-Uploads","warning"),e=!0),{location:null}):r.responseURL?{location:r.responseURL.replace(/\?.*$/,"")}:{location:null};var o=function(){return""};return r.responseXML&&(o=function(t){var e=r.responseXML.querySelector(t);return e?e.textContent:""}),r.responseText&&(o=function(t){var e=r.responseText.indexOf("<"+t+">"),n=r.responseText.indexOf("</"+t+">");return-1!==e&&-1!==n?r.responseText.slice(e+t.length+2,n):""}),{location:ht(r.responseURL,o("Location")),bucket:o("Bucket"),key:o("Key"),etag:o("ETag")}},getResponseError:function(t,e){if(St(e)){var n=e.responseXML.querySelector("Error > Message");return new Error(n.textContent)}}})},e.prototype.uninstall=function(){var t=this.uppy.getPlugin("XHRUpload");this.uppy.removePlugin(t),this.uppy.removePreProcessor(this.prepareUpload)},e}(Y.Plugin),Ct=function(t,e){return(e="number"==typeof e?e:1/0)?function t(n,r){return n.reduce(function(n,o){return Array.isArray(o)&&r<e?n.concat(t(o,r+1)):n.concat(o)},[])}(t,1):Array.isArray(t)?t.map(function(t){return t}):t},Tt=_t={};function Ot(){throw new Error("setTimeout has not been defined")}function Ut(){throw new Error("clearTimeout has not been defined")}function Ft(t){if(Pt===setTimeout)return setTimeout(t,0);if((Pt===Ot||!Pt)&&setTimeout)return Pt=setTimeout,setTimeout(t,0);try{return Pt(t,0)}catch(e){try{return Pt.call(null,t,0)}catch(e){return Pt.call(this,t,0)}}}!function(){try{Pt="function"==typeof setTimeout?setTimeout:Ot}catch(t){Pt=Ot}try{Et="function"==typeof clearTimeout?clearTimeout:Ut}catch(t){Et=Ut}}();var At,xt=[],Dt=!1,Rt=-1;function It(){Dt&&At&&(Dt=!1,At.length?xt=At.concat(xt):Rt=-1,xt.length&&Bt())}function Bt(){if(!Dt){var t=Ft(It);Dt=!0;for(var e=xt.length;e;){for(At=xt,xt=[];++Rt<e;)At&&At[Rt].run();Rt=-1,e=xt.length}At=null,Dt=!1,function(t){if(Et===clearTimeout)return clearTimeout(t);if((Et===Ut||!Et)&&clearTimeout)return Et=clearTimeout,clearTimeout(t);try{Et(t)}catch(e){try{return Et.call(null,t)}catch(e){return Et.call(this,t)}}}(t)}}function jt(t,e){this.fun=t,this.array=e}function Lt(){}Tt.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];xt.push(new jt(t,e)),1!==xt.length||Dt||Ft(Bt)},jt.prototype.run=function(){this.fun.apply(null,this.array)},Tt.title="browser",Tt.browser=!0,Tt.env={},Tt.argv=[],Tt.version="",Tt.versions={},Tt.on=Lt,Tt.addListener=Lt,Tt.once=Lt,Tt.off=Lt,Tt.removeListener=Lt,Tt.removeAllListeners=Lt,Tt.emit=Lt,Tt.prependListener=Lt,Tt.prependOnceListener=Lt,Tt.listeners=function(t){return[]},Tt.binding=function(t){throw new Error("process.binding is not supported")},Tt.cwd=function(){return"/"},Tt.chdir=function(t){throw new Error("process.chdir is not supported")},Tt.umask=function(){return 0};var Mt={};(function(t){Mt=function(e,n){var r,o,i,s=!0;function a(e){function o(){n&&n(e,r),n=null}s?t.nextTick(o):o()}function l(t,e,n){r[t]=n,(0==--o||e)&&a(e)}Array.isArray(e)?(r=[],o=e.length):(i=Object.keys(e),r={},o=i.length),o?i?i.forEach(function(t){e[t](function(e,n){l(t,e,n)})}):e.forEach(function(t,e){t(function(t,n){l(e,t,n)})}):a(null),s=!1}}).call(this,_t);var Nt=function(t,e){if("string"==typeof t){var n=t;if(!(t=window.document.querySelector(t)))throw new Error('"'+n+'" does not match any HTML elements')}if(!t)throw new Error('"'+t+'" is not a valid HTML element');var r;return"function"==typeof e&&(e={onDrop:e}),t.addEventListener("dragenter",o,!1),t.addEventListener("dragover",i,!1),t.addEventListener("dragleave",s,!1),t.addEventListener("drop",a,!1),function(){l(),t.removeEventListener("dragenter",o,!1),t.removeEventListener("dragover",i,!1),t.removeEventListener("dragleave",s,!1),t.removeEventListener("drop",a,!1)};function o(t){return e.onDragEnter&&e.onDragEnter(t),t.stopPropagation(),t.preventDefault(),!1}function i(n){if(n.stopPropagation(),n.preventDefault(),n.dataTransfer.items){var o=qt(n.dataTransfer.items),i=o.filter(function(t){return"file"===t.kind}),s=o.filter(function(t){return"string"===t.kind});if(0===i.length&&!e.onDropText)return;if(0===s.length&&!e.onDrop)return;if(0===i.length&&0===s.length)return}return t.classList.add("drag"),clearTimeout(r),e.onDragOver&&e.onDragOver(n),n.dataTransfer.dropEffect="copy",!1}function s(t){return t.stopPropagation(),t.preventDefault(),e.onDragLeave&&e.onDragLeave(t),clearTimeout(r),r=setTimeout(l,50),!1}function a(t){t.stopPropagation(),t.preventDefault(),e.onDragLeave&&e.onDragLeave(t),clearTimeout(r),l();var n={x:t.clientX,y:t.clientY},o=t.dataTransfer.getData("text");if(o&&e.onDropText&&e.onDropText(o,n),t.dataTransfer.items){var i=qt(t.dataTransfer.items).filter(function(t){return"file"===t.kind});if(0===i.length)return;Mt(i.map(function(t){return function(e){!function(t,e){var n=[];if(t.isFile)t.file(function(n){n.fullPath=t.fullPath,e(null,n)},function(t){e(t)});else if(t.isDirectory){var r=t.createReader();!function t(){r.readEntries(function(r){r.length>0?(n=n.concat(qt(r)),t()):Mt(n.map(function(t){return function(e){!function(t,e){var n=[];if(t.isFile)t.file(function(n){n.fullPath=t.fullPath,e(null,n)},function(t){e(t)});else if(t.isDirectory){var r=t.createReader();!function t(){r.readEntries(function(r){r.length>0?(n=n.concat(qt(r)),t()):Mt(n.map(function(t){return function(e){zt(t,e)}}),e)})}()}}(t,e)}}),e)})}()}}(t.webkitGetAsEntry(),e)}}),function(t,r){if(t)throw t;e.onDrop&&e.onDrop(Ct(r),n)})}else{var s=qt(t.dataTransfer.files);if(0===s.length)return;s.forEach(function(t){t.fullPath="/"+t.name}),e.onDrop&&e.onDrop(s,n)}return!1}function l(){t.classList.remove("drag")}};function zt(t,e){var n=[];if(t.isFile){t.file(function(n){n.fullPath=t.fullPath;e(null,n)},function(t){e(t)})}else if(t.isDirectory){var r=t.createReader();o()}function o(){r.readEntries(function(t){if(t.length>0){n=n.concat(qt(t));o()}else{i()}})}function i(){Mt(n.map(function(t){return function(e){zt(t,e)}}),e)}}function qt(t){return Array.prototype.slice.call(t||[],0)}var Ht={exports:{}};(function(t){!function(t,e){"object"==typeof Ht.exports?Ht.exports=e():t.ResizeObserver=e()}(this,function(){"use strict";var e=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,r){return t[0]===e&&(n=r,!0)}),n}return function(){function e(){this.__entries__=[]}var n={size:{configurable:!0}};return n.size.get=function(){return this.__entries__.length},e.prototype.get=function(e){var n=t(this.__entries__,e),r=this.__entries__[n];return r&&r[1]},e.prototype.set=function(e,n){var r=t(this.__entries__,e);~r?this.__entries__[r][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,r=t(n,e);~r&&n.splice(r,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,r=this.__entries__;n<r.length;n+=1){var o=r[n];t.call(e,o[1],o[0])}},Object.defineProperties(e.prototype,n),e}()}(),n="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,r=void 0!==t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),o="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(r):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},i=2,s=["top","right","bottom","left","width","height","size","weight"],a="undefined"!=typeof MutationObserver,l=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,r=!1,s=0;function a(){n&&(n=!1,t()),r&&u()}function l(){o(a)}function u(){var t=Date.now();if(n){if(t-s<i)return;r=!0}else n=!0,r=!1,setTimeout(l,e);s=t}return u}(this.refresh.bind(this),20)};l.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},l.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},l.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},l.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),t.length>0},l.prototype.connect_=function(){n&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},l.prototype.disconnect_=function(){n&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},l.prototype.onTransitionEnd_=function(t){var e=t.propertyName;void 0===e&&(e=""),s.some(function(t){return!!~e.indexOf(t)})&&this.refresh()},l.getInstance=function(){return this.instance_||(this.instance_=new l),this.instance_},l.instance_=null;var u=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n+=1){var o=r[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},p=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||r},c=g(0,0,0,0);function h(t){return parseFloat(t)||0}function d(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.reduce(function(e,n){return e+h(t["border-"+n+"-width"])},0)}var f="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof p(t).SVGGraphicsElement}:function(t){return t instanceof p(t).SVGElement&&"function"==typeof t.getBBox};function y(t){return n?f(t)?function(t){var e=t.getBBox();return g(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return c;var r=p(t).getComputedStyle(t),o=function(t){for(var e={},n=0,r=["top","right","bottom","left"];n<r.length;n+=1){var o=r[n],i=t["padding-"+o];e[o]=h(i)}return e}(r),i=o.left+o.right,s=o.top+o.bottom,a=h(r.width),l=h(r.height);if("border-box"===r.boxSizing&&(Math.round(a+i)!==e&&(a-=d(r,"left","right")+i),Math.round(l+s)!==n&&(l-=d(r,"top","bottom")+s)),!function(t){return t===p(t).document.documentElement}(t)){var u=Math.round(a+i)-e,f=Math.round(l+s)-n;1!==Math.abs(u)&&(a-=u),1!==Math.abs(f)&&(l-=f)}return g(o.left,o.top,a,l)}(t):c}function g(t,e,n,r){return{x:t,y:e,width:n,height:r}}var m=function(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=g(0,0,0,0),this.target=t};m.prototype.isActive=function(){var t=y(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},m.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t};var v=function(t,e){var n,r,o,i,s,a,l,p=(r=(n=e).x,o=n.y,i=n.width,s=n.height,a="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(a.prototype),u(l,{x:r,y:o,width:i,height:s,top:o,right:r+i,bottom:s+o,left:r}),l);u(this,{target:t,contentRect:p})},b=function(t,n,r){if(this.activeObservations_=[],this.observations_=new e,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r};b.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof p(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new m(t)),this.controller_.addObserver(this),this.controller_.refresh())}},b.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof p(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},b.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},b.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},b.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new v(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},b.prototype.clearActive=function(){this.activeObservations_.splice(0)},b.prototype.hasActive=function(){return this.activeObservations_.length>0};var w="undefined"!=typeof WeakMap?new WeakMap:new e,S=function(t){if(!(this instanceof S))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var e=l.getInstance(),n=new b(t,e,this);w.set(this,n)};return["observe","unobserve","disconnect"].forEach(function(t){S.prototype[t]=function(){return(e=w.get(this))[t].apply(e,arguments);var e}}),void 0!==r.ResizeObserver?r.ResizeObserver:S})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),Ht=Ht.exports;var Wt={exports:{}};!function(){"use strict";var t={}.hasOwnProperty;function e(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)&&o.length){var s=e.apply(null,o);s&&n.push(s)}else if("object"===i)for(var a in o)t.call(o,a)&&o[a]&&n.push(a)}}return n.join(" ")}Wt.exports?(e.default=e,Wt.exports=e):window.classNames=e}(),Wt=Wt.exports;var Xt,Vt={exports:{}};Xt=function(t){"use strict";function e(t){return t.attributes&&t.attributes.key}function n(t){return t.base}function r(t){return t&&t.filter(function(t){return null!==t})}function o(t,e){for(var n=t.length;n--;)if(e(t[n]))return!0;return!1}function i(t,n){return o(t,function(t){return e(t)===n})}function s(t,n){return i(t,e(n))}function a(t,n,r){return o(t,function(t){return e(t)===n&&t.props[r]})}function l(t,n,r){return a(t,e(n),r)}var u=" ",p=/[\n\t\r]+/g,c=function(t){return(u+t+u).replace(p,u)};function h(t,e){var n;t.classList?(n=t.classList).add.apply(n,e.split(" ")):t.className+=" "+e}function d(t,e){if(e=e.trim(),t.classList){var n;(n=t.classList).remove.apply(n,e.split(" "))}else{var r=t.className.trim(),o=c(r);for(e=u+e+u;o.indexOf(e)>=0;)o=o.replace(e,u);t.className=o.trim()}}var f={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},y=[];"undefined"!=typeof window&&function(){var t=document.createElement("div").style;for(var e in"AnimationEvent"in window||delete f.animationend.animation,"TransitionEvent"in window||delete f.transitionend.transition,f){var n=f[e];for(var r in n)if(r in t){y.push(n[r]);break}}}();var g=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},m=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},v=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},b=function(t){function e(){var r,o;g(this,e);for(var i=arguments.length,s=Array(i),a=0;a<i;a++)s[a]=arguments[a];return r=o=v(this,t.call.apply(t,[this].concat(s))),o.flushClassNameQueue=function(){n(o)&&h(n(o),o.classNameQueue.join(" ")),o.classNameQueue.length=0,o.timeout=null},v(o,r)}return m(e,t),e.prototype.transition=function(t,e,r){var o=this,i=n(this),s=this.props.name[t]||this.props.name+"-"+t,a=this.props.name[t+"Active"]||s+"-active",l=null;this.endListener&&this.endListener(),this.endListener=function(t){t&&t.target!==i||(clearTimeout(l),d(i,s),d(i,a),function(t,e){y.length&&y.forEach(function(n){t.removeEventListener(n,e,!1)})}(i,o.endListener),o.endListener=null,e&&e())},r?(l=setTimeout(this.endListener,r),this.transitionTimeouts.push(l)):function(t,e){if(!y.length)return window.setTimeout(e,0);y.forEach(function(n){t.addEventListener(n,e,!1)})}(i,this.endListener),h(i,s),this.queueClass(a)},e.prototype.queueClass=function(t){this.classNameQueue.push(t),this.timeout||(this.timeout=setTimeout(this.flushClassNameQueue,17))},e.prototype.stop=function(){this.timeout&&(clearTimeout(this.timeout),this.classNameQueue.length=0,this.timeout=null),this.endListener&&this.endListener()},e.prototype.componentWillMount=function(){this.classNameQueue=[],this.transitionTimeouts=[]},e.prototype.componentWillUnmount=function(){this.timeout&&clearTimeout(this.timeout),this.transitionTimeouts.forEach(function(t){clearTimeout(t)})},e.prototype.componentWillEnter=function(t){this.props.enter?this.transition("enter",t,this.props.enterTimeout):t()},e.prototype.componentWillLeave=function(t){this.props.leave?this.transition("leave",t,this.props.leaveTimeout):t()},e.prototype.render=function(){return(t=this.props.children)&&t[0];var t},e}(t.Component),w=function(n){function o(r){g(this,o);var i=v(this,n.call(this));return i.renderChild=function(n){var r=i.props,o=r.transitionName,s=r.transitionEnter,a=r.transitionLeave,l=r.transitionEnterTimeout,u=r.transitionLeaveTimeout,p=e(n);return t.h(b,{key:p,ref:function(t){(i.refs[p]=t)||(n=null)},name:o,enter:s,leave:a,enterTimeout:l,leaveTimeout:u},n)},i.refs={},i.state={children:(r.children||[]).slice()},i}return m(o,n),o.prototype.shouldComponentUpdate=function(t,e){return e.children!==this.state.children},o.prototype.componentWillMount=function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},o.prototype.componentWillReceiveProps=function(n){var o,a,u,p,c=this,h=n.children,d=n.exclusive,f=n.showProp,y=r(h||[]).slice(),g=r(d?this.props.children:this.state.children),m=(o=y,a=[],u={},p=[],g.forEach(function(t){var n=e(t);i(o,n)?p.length&&(u[n]=p,p=[]):p.push(t)}),o.forEach(function(t){var n=e(t);u.hasOwnProperty(n)&&(a=a.concat(u[n])),a.push(t)}),a.concat(p));f&&(m=m.map(function(e){var n;return!e.props[f]&&l(g,e,f)&&(e=t.cloneElement(e,((n={})[f]=!0,n))),e})),d&&m.forEach(function(t){return c.stop(e(t))}),this.setState({children:m}),this.forceUpdate(),y.forEach(function(t){var e=t.key,n=g&&s(g,t);if(f){if(n){var r=l(g,t,f),o=t.props[f];r||!o||c.currentlyTransitioningKeys[e]||c.keysToEnter.push(e)}}else n||c.currentlyTransitioningKeys[e]||c.keysToEnter.push(e)}),g.forEach(function(t){var e=t.key,n=y&&s(y,t);if(f){if(n){var r=l(y,t,f),o=t.props[f];r||!o||c.currentlyTransitioningKeys[e]||c.keysToLeave.push(e)}}else n||c.currentlyTransitioningKeys[e]||c.keysToLeave.push(e)})},o.prototype.performEnter=function(t){var e=this;this.currentlyTransitioningKeys[t]=!0;var n=this.refs[t];n.componentWillEnter?n.componentWillEnter(function(){return e._handleDoneEntering(t)}):this._handleDoneEntering(t)},o.prototype._handleDoneEntering=function(t){delete this.currentlyTransitioningKeys[t];var e=r(this.props.children),n=this.props.showProp;!e||!n&&!i(e,t)||n&&!a(e,t,n)?this.performLeave(t):this.setState({children:e})},o.prototype.stop=function(t){delete this.currentlyTransitioningKeys[t];var e=this.refs[t];e&&e.stop()},o.prototype.performLeave=function(t){var e=this;this.currentlyTransitioningKeys[t]=!0;var n=this.refs[t];n&&n.componentWillLeave?n.componentWillLeave(function(){return e._handleDoneLeaving(t)}):this._handleDoneLeaving(t)},o.prototype._handleDoneLeaving=function(t){delete this.currentlyTransitioningKeys[t];var e=this.props.showProp,n=r(this.props.children);e&&n&&a(n,t,e)?this.performEnter(t):!e&&n&&i(n,t)?this.performEnter(t):this.setState({children:n})},o.prototype.componentDidUpdate=function(){var t=this,e=this.keysToEnter,n=this.keysToLeave;this.keysToEnter=[],e.forEach(function(e){return t.performEnter(e)}),this.keysToLeave=[],n.forEach(function(e){return t.performLeave(e)})},o.prototype.render=function(e,n){var o=e.component,i=(e.transitionName,e.transitionEnter,e.transitionLeave,e.transitionEnterTimeout,e.transitionLeaveTimeout,e.children,function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(e,["component","transitionName","transitionEnter","transitionLeave","transitionEnterTimeout","transitionLeaveTimeout","children"])),s=n.children;return t.h(o,i,r(s).map(this.renderChild))},o}(t.Component);return w.defaultProps={component:"span",transitionEnter:!0,transitionLeave:!0},w},"object"==typeof Vt.exports?Vt.exports=Xt(A):this.PreactCSSTransitionGroup=Xt(this.preact),Vt=Vt.exports;var Gt=A.h,Kt=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.handleClick=r.handleClick.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleClick=function(t){this.input.click()},e.prototype.render=function(){var t=this,e=Gt("button",{type:"button",class:"uppy-Dashboard-browse",onclick:this.handleClick},this.props.i18n("browse"));return Gt("div",{class:"uppy-Dashboard-dropFilesTitle"},0===this.props.acquirers.length?this.props.i18nArray("dropPaste",{browse:e}):this.props.i18nArray("dropPasteImport",{browse:e}),Gt("input",{class:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabindex:-1,type:"file",name:"files[]",multiple:1!==this.props.maxNumberOfFiles,onchange:this.props.handleInputChange,accept:this.props.allowedFileTypes,value:"",ref:function(e){t.input=e}}))},e}(A.Component),Yt=A.h,Jt=function(){return Yt("svg",{"aria-hidden":"true",width:"30",height:"30",viewBox:"0 0 30 30"},Yt("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))},$t=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",width:"51",height:"51",viewBox:"0 0 51 51"},Yt("path",{d:"M17.21 45.765a5.394 5.394 0 0 1-7.62 0l-4.12-4.122a5.393 5.393 0 0 1 0-7.618l6.774-6.775-2.404-2.404-6.775 6.776c-3.424 3.427-3.424 9 0 12.426l4.12 4.123a8.766 8.766 0 0 0 6.216 2.57c2.25 0 4.5-.858 6.214-2.57l13.55-13.552a8.72 8.72 0 0 0 2.575-6.213 8.73 8.73 0 0 0-2.575-6.213l-4.123-4.12-2.404 2.404 4.123 4.12a5.352 5.352 0 0 1 1.58 3.81c0 1.438-.562 2.79-1.58 3.808l-13.55 13.55z"}),Yt("path",{d:"M44.256 2.858A8.728 8.728 0 0 0 38.043.283h-.002a8.73 8.73 0 0 0-6.212 2.574l-13.55 13.55a8.725 8.725 0 0 0-2.575 6.214 8.73 8.73 0 0 0 2.574 6.216l4.12 4.12 2.405-2.403-4.12-4.12a5.357 5.357 0 0 1-1.58-3.812c0-1.437.562-2.79 1.58-3.808l13.55-13.55a5.348 5.348 0 0 1 3.81-1.58c1.44 0 2.792.562 3.81 1.58l4.12 4.12c2.1 2.1 2.1 5.518 0 7.617L39.2 23.775l2.404 2.404 6.775-6.777c3.426-3.427 3.426-9 0-12.426l-4.12-4.12z"}))},Qt=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon retry",width:"28",height:"31",viewBox:"0 0 16 19",xmlns:"http://www.w3.org/2000/svg"},Yt("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),Yt("path",{d:"M7.9 3H10v2H7.9z"}),Yt("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),Yt("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"}))},Zt=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",width:"55",height:"55",viewBox:"0 0 55 55"},Yt("path",{d:"M52.66.25c-.216-.19-.5-.276-.79-.242l-31 4.01a1 1 0 0 0-.87.992V40.622C18.174 38.428 15.273 37 12 37c-5.514 0-10 4.037-10 9s4.486 9 10 9 10-4.037 10-9c0-.232-.02-.46-.04-.687.014-.065.04-.124.04-.192V16.12l29-3.753v18.257C49.174 28.428 46.273 27 43 27c-5.514 0-10 4.037-10 9s4.486 9 10 9c5.464 0 9.913-3.966 9.993-8.867 0-.013.007-.024.007-.037V1a.998.998 0 0 0-.34-.75zM12 53c-4.41 0-8-3.14-8-7s3.59-7 8-7 8 3.14 8 7-3.59 7-8 7zm31-10c-4.41 0-8-3.14-8-7s3.59-7 8-7 8 3.14 8 7-3.59 7-8 7zM22 14.1V5.89l29-3.753v8.21l-29 3.754z"}))},te=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",viewBox:"0 0 58 58"},Yt("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),Yt("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))},ee=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",viewBox:"0 0 342 335"},Yt("path",{d:"M329.337 227.84c-2.1 1.3-8.1 2.1-11.9 2.1-12.4 0-27.6-5.7-49.1-14.9 8.3-.6 15.8-.9 22.6-.9 12.4 0 16 0 28.2 3.1 12.1 3 12.2 9.3 10.2 10.6zm-215.1 1.9c4.8-8.4 9.7-17.3 14.7-26.8 12.2-23.1 20-41.3 25.7-56.2 11.5 20.9 25.8 38.6 42.5 52.8 2.1 1.8 4.3 3.5 6.7 5.3-34.1 6.8-63.6 15-89.6 24.9zm39.8-218.9c6.8 0 10.7 17.06 11 33.16.3 16-3.4 27.2-8.1 35.6-3.9-12.4-5.7-31.8-5.7-44.5 0 0-.3-24.26 2.8-24.26zm-133.4 307.2c3.9-10.5 19.1-31.3 41.6-49.8 1.4-1.1 4.9-4.4 8.1-7.4-23.5 37.6-39.3 52.5-49.7 57.2zm315.2-112.3c-6.8-6.7-22-10.2-45-10.5-15.6-.2-34.3 1.2-54.1 3.9-8.8-5.1-17.9-10.6-25.1-17.3-19.2-18-35.2-42.9-45.2-70.3.6-2.6 1.2-4.8 1.7-7.1 0 0 10.8-61.5 7.9-82.3-.4-2.9-.6-3.7-1.4-5.9l-.9-2.5c-2.9-6.76-8.7-13.96-17.8-13.57l-5.3-.17h-.1c-10.1 0-18.4 5.17-20.5 12.84-6.6 24.3.2 60.5 12.5 107.4l-3.2 7.7c-8.8 21.4-19.8 43-29.5 62l-1.3 2.5c-10.2 20-19.5 37-27.9 51.4l-8.7 4.6c-.6.4-15.5 8.2-19 10.3-29.6 17.7-49.28 37.8-52.54 53.8-1.04 5-.26 11.5 5.01 14.6l8.4 4.2c3.63 1.8 7.53 2.7 11.43 2.7 21.1 0 45.6-26.2 79.3-85.1 39-12.7 83.4-23.3 122.3-29.1 29.6 16.7 66 28.3 89 28.3 4.1 0 7.6-.4 10.5-1.2 4.4-1.1 8.1-3.6 10.4-7.1 4.4-6.7 5.4-15.9 4.1-25.4-.3-2.8-2.6-6.3-5-8.7z"}))},ne=function(){return Yt("svg",{"aria-hidden":"true",class:"UppyIcon",width:"62",height:"62",viewBox:"0 0 62 62",xmlns:"http://www.w3.org/2000/svg"},Yt("path",{d:"M4.309 4.309h24.912v53.382h-6.525v3.559h16.608v-3.559h-6.525V4.309h24.912v10.676h3.559V.75H.75v14.235h3.559z","fill-rule":"nonzero",fill:"#000"}))},re=function(){return Yt("svg",{"aria-hidden":"true",fill:"#607d8b",width:"27",height:"25",viewBox:"0 0 27 25"},Yt("path",{d:"M5.586 9.288a.313.313 0 0 0 .282.176h4.84v3.922c0 1.514 1.25 2.24 2.792 2.24 1.54 0 2.79-.726 2.79-2.24V9.464h4.84c.122 0 .23-.068.284-.176a.304.304 0 0 0-.046-.324L13.735.106a.316.316 0 0 0-.472 0l-7.63 8.857a.302.302 0 0 0-.047.325z"}),Yt("path",{d:"M24.3 5.093c-.218-.76-.54-1.187-1.208-1.187h-4.856l1.018 1.18h3.948l2.043 11.038h-7.193v2.728H9.114v-2.725h-7.36l2.66-11.04h3.33l1.018-1.18H3.907c-.668 0-1.06.46-1.21 1.186L0 16.456v7.062C0 24.338.676 25 1.51 25h23.98c.833 0 1.51-.663 1.51-1.482v-7.062L24.3 5.093z"}))},oe=A.h,ie=A.Component,se=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.handleClick=r.handleClick.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleClick=function(t){this.input.click()},e.prototype.render=function(){var t=this,e=0!==this.props.acquirers.length;return oe("div",{class:"uppy-DashboarAddFiles"},e?oe("div",{class:"uppy-DashboardTabs"},oe(Kt,{acquirers:this.props.acquirers,handleInputChange:this.props.handleInputChange,i18n:this.props.i18n,i18nArray:this.props.i18nArray,allowedFileTypes:this.props.allowedFileTypes,maxNumberOfFiles:this.props.maxNumberOfFiles}),oe("div",{class:"uppy-DashboardTabs-list",role:"tablist"},oe("div",{class:"uppy-DashboardTab",role:"presentation"},oe("button",{type:"button",class:"uppy-DashboardTab-btn",role:"tab",tabindex:0,onclick:this.handleClick},re(),oe("div",{class:"uppy-DashboardTab-name"},this.props.i18n("myDevice"))),oe("input",{class:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabindex:-1,type:"file",name:"files[]",multiple:1!==this.props.maxNumberOfFiles,accept:this.props.allowedFileTypes,onchange:this.props.handleInputChange,value:"",ref:function(e){t.input=e}})),this.props.acquirers.map(function(e){return oe("div",{class:"uppy-DashboardTab",role:"presentation"},oe("button",{class:"uppy-DashboardTab-btn",type:"button",role:"tab",tabindex:0,"aria-controls":"uppy-DashboardContent-panel--"+e.id,"aria-selected":t.props.activePanel.id===e.id,onclick:function(){return t.props.showPanel(e.id)}},e.icon(),oe("div",{class:"uppy-DashboardTab-name"},e.name)))}))):oe("div",{class:"uppy-DashboardTabs"},oe(Kt,{acquirers:this.props.acquirers,handleInputChange:this.props.handleInputChange,i18n:this.props.i18n,i18nArray:this.props.i18nArray,allowedFileTypes:this.props.allowedFileTypes,maxNumberOfFiles:this.props.maxNumberOfFiles})),oe("div",{class:"uppy-DashboarAddFiles-info"},this.props.note&&oe("div",{class:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&(this.props,oe("a",{tabindex:"-1",href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",class:"uppy-Dashboard-poweredBy"},"Powered by ",oe("svg",{"aria-hidden":"true",class:"UppyIcon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11",xmlns:"http://www.w3.org/2000/svg"},oe("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z","fill-rule":"evenodd"})),oe("span",{class:"uppy-Dashboard-poweredByUppy"},"Uppy")))))},e}(ie),ae=A.h,le=function(t){return ae("div",{class:"uppy-Dashboard-AddFilesPanel","aria-hidden":t.showAddFilesPanel},ae("div",{class:"uppy-DashboardContent-bar"},ae("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},t.i18n("addingMoreFiles")),ae("button",{class:"uppy-DashboardContent-back",type:"button",onclick:function(e){return t.toggleAddFilesPanel(!1)}},t.i18n("back"))),ae(se,t))},ue=ne,pe=Zt,ce=te,he=ee,de=function(t){var e={color:"#cbcbcb",icon:""};if(!t)return e;var n=t.split("/")[0],r=t.split("/")[1];return"text"===n?{color:"#cbcbcb",icon:ue()}:"audio"===n?{color:"#1abc9c",icon:pe()}:"video"===n?{color:"#2980b9",icon:ce()}:"application"===n&&"pdf"===r?{color:"#e74c3c",icon:he()}:"image"===n?{color:"#f2f2f2",icon:""}:e},fe=A.h,ye=function(t){var e=t.file;if(e.preview)return fe("img",{class:"uppy-DashboardItem-previewImg",alt:e.name,src:e.preview});var n=de(e.type),r=n.color,o=n.icon;return fe("div",{class:"uppy-DashboardItem-previewIconWrap"},fe("span",{class:"uppy-DashboardItem-previewIcon",style:{color:r}},o),fe("svg",{class:"uppy-DashboardItem-previewIconBg",width:"72",height:"93",viewBox:"0 0 72 93"},fe("g",null,fe("path",{d:"M24.08 5h38.922A2.997 2.997 0 0 1 66 8.003v74.994A2.997 2.997 0 0 1 63.004 86H8.996A2.998 2.998 0 0 1 6 83.01V22.234L24.08 5z",fill:"#FFF"}),fe("path",{d:"M24 5L6 22.248h15.007A2.995 2.995 0 0 0 24 19.244V5z",fill:"#E4E4E4"}))))},ge=function(t){var e=t.target.tagName;"INPUT"!==e&&"TEXTAREA"!==e?(t.preventDefault(),t.stopPropagation()):t.stopPropagation()},me=A.h,ve=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.meta={},r.tempStoreMetaOrSubmit=r.tempStoreMetaOrSubmit.bind(r),r.renderMetaFields=r.renderMetaFields.bind(r),r.handleSave=r.handleSave.bind(r),r.handleCancel=r.handleCancel.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){var t=this;setTimeout(function(){t.firstInput&&t.firstInput.focus({preventScroll:!0})},150)},e.prototype.tempStoreMetaOrSubmit=function(t){var e=this.props.files[this.props.fileCardFor];if(13===t.keyCode)return t.stopPropagation(),t.preventDefault(),void this.props.saveFileCard(this.meta,e.id);var n=t.target.value,r=t.target.dataset.name;this.meta[r]=n},e.prototype.renderMetaFields=function(t){var e=this;return(this.props.metaFields||[]).map(function(n,r){return me("fieldset",{class:"uppy-DashboardFileCard-fieldset"},me("label",{class:"uppy-DashboardFileCard-label"},n.name),me("input",{class:"uppy-c-textInput uppy-DashboardFileCard-input",type:"text","data-name":n.id,value:t.meta[n.id],placeholder:n.placeholder,onkeyup:e.tempStoreMetaOrSubmit,onkeydown:e.tempStoreMetaOrSubmit,onkeypress:e.tempStoreMetaOrSubmit,ref:function(t){0===r&&(e.firstInput=t)}}))})},e.prototype.handleSave=function(t){var e=this.props.fileCardFor;this.props.saveFileCard(this.meta,e)},e.prototype.handleCancel=function(t){this.meta={},this.props.toggleFileCard()},e.prototype.render=function(){var t=this.props.files[this.props.fileCardFor];return me("div",{class:"uppy-DashboardFileCard",onDragOver:ge,onDragLeave:ge,onDrop:ge,onPaste:ge},me("div",{class:"uppy-DashboardContent-bar"},me("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},this.props.i18nArray("editing",{file:me("span",{class:"uppy-DashboardContent-titleFile"},t.meta?t.meta.name:t.name)})),me("button",{class:"uppy-DashboardContent-back",type:"button",title:this.props.i18n("finishEditingFile"),onclick:this.handleSave},this.props.i18n("done"))),me("div",{class:"uppy-DashboardFileCard-inner"},me("div",{class:"uppy-DashboardFileCard-preview",style:{backgroundColor:de(t.type).color}},me(ye,{file:t})),me("div",{class:"uppy-DashboardFileCard-info"},this.renderMetaFields(t)),me("div",{class:"uppy-Dashboard-actions"},me("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-actionsBtn",type:"button",onclick:this.handleSave},this.props.i18n("saveChanges")),me("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-actionsBtn",type:"button",onclick:this.handleCancel},this.props.i18n("cancel")))))},e}(A.Component),be=A.h,we=2*Math.PI*15,Se=function(t){return be("svg",{width:"70",height:"70",viewBox:"0 0 36 36",class:"UppyIcon UppyIcon-progressCircle"},be("g",{class:"progress-group"},be("circle",{class:"bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),be("circle",{class:"progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)","stroke-width":"2",fill:"none","stroke-dasharray":we,"stroke-dashoffset":we-we/100*t.progress})),t.hidePauseResumeCancelButtons||t.bundled?null:be("g",null,be("polygon",{class:"play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}),be("g",{class:"pause",transform:"translate(14.5, 13)"},be("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),be("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})),be("polygon",{class:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"})),be("polygon",{class:"check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"}))},_e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pe=$t,Ee=Qt,ke=A.h;function Ce(t){if(!t.hideRetryButton||!t.error)return t.isUploaded||t.bundled||t.hidePauseResumeCancelButtons&&!t.error?ke("div",{class:"uppy-DashboardItem-progressIndicator"},ke(Se,{progress:t.file.progress.percentage,fileID:t.file.id,hidePauseResumeCancelButtons:t.hidePauseResumeCancelButtons,bundled:t.bundled})):ke("button",{class:"uppy-DashboardItem-progressIndicator",type:"button","aria-label":t.progressIndicatorTitle,title:t.progressIndicatorTitle,onclick:t.onPauseResumeCancelRetry},t.error?t.hideRetryButton?null:Ee():ke(Se,{progress:t.file.progress.percentage,fileID:t.file.id,hidePauseResumeCancelButtons:t.hidePauseResumeCancelButtons}))}var Te=function(t){var e,n,r=t.file,o=t.acquirers,i=r.progress.preprocess||r.progress.postprocess,s=r.progress.uploadComplete&&!i&&!r.error,a=r.progress.uploadStarted||i,l=r.progress.uploadStarted&&!r.progress.uploadComplete||i,u=r.isPaused||!1,p=r.error||!1,c=X(r.meta.name).name,h=t.isWide?(n=30,(e=c).length>n?e.substr(0,n/2)+"..."+e.substr(e.length-n/4,e.length):e):c,d=Wt("uppy-DashboardItem",{"is-inprogress":l},{"is-processing":i},{"is-complete":s},{"is-paused":u},{"is-error":p},{"is-resumable":t.resumableUploads},{"is-bundled":t.bundledUpload});return ke("li",{class:d,id:"uppy_"+r.id,title:r.meta.name},ke("div",{class:"uppy-DashboardItem-preview"},ke("div",{class:"uppy-DashboardItem-previewInnerWrap",style:{backgroundColor:de(r.type).color}},t.showLinkToFileUploadResult&&r.uploadURL?ke("a",{class:"uppy-DashboardItem-previewLink",href:r.uploadURL,rel:"noreferrer noopener",target:"_blank"}):null,ke(ye,{file:r})),ke("div",{class:"uppy-DashboardItem-progress"},ke(Ce,_e({progressIndicatorTitle:function(t){return s?t.i18n("uploadComplete"):p?t.i18n("retryUpload"):t.resumableUploads?r.isPaused?t.i18n("resumeUpload"):t.i18n("pauseUpload"):t.i18n("cancelUpload")}(t),onPauseResumeCancelRetry:function(e){s||(!p||t.hideRetryButton?t.hidePauseResumeCancelButtons||(t.resumableUploads?t.pauseUpload(r.id):t.cancelUpload(r.id)):t.retryUpload(r.id))},file:r,error:p},t)))),ke("div",{class:"uppy-DashboardItem-info"},ke("div",{class:"uppy-DashboardItem-name",title:c},t.showLinkToFileUploadResult&&r.uploadURL?ke("a",{href:r.uploadURL,rel:"noreferrer noopener",target:"_blank"},r.extension?h+"."+r.extension:h):r.extension?h+"."+r.extension:h),ke("div",{class:"uppy-DashboardItem-status"},r.data.size?ke("div",{class:"uppy-DashboardItem-statusSize"},F(r.data.size)):null,r.source&&r.source!==t.id&&ke("div",{class:"uppy-DashboardItem-sourceIcon"},o.map(function(e){if(e.id===r.source)return ke("span",{title:t.i18n("fileSource",{name:e.name})},e.icon())})),!a&&t.metaFields&&t.metaFields.length?ke("button",{class:"uppy-DashboardItem-edit",type:"button","aria-label":t.i18n("editFile"),title:t.i18n("editFile"),onclick:function(e){return t.toggleFileCard(r.id)}},t.i18n("edit")):null,t.showLinkToFileUploadResult&&r.uploadURL?ke("button",{class:"uppy-DashboardItem-copyLink",type:"button","aria-label":t.i18n("copyLink"),title:t.i18n("copyLink"),onclick:function(){var e,n;(e=r.uploadURL,n=t.i18n("copyLinkToClipboardFallback"),n=n||"Copy the URL below",new Promise(function(t){var r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=e,document.body.appendChild(r),r.select();var o=function(){document.body.removeChild(r),window.prompt(n,e),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):o()}catch(t){return document.body.removeChild(r),o()}})).then(function(){t.log("Link copied to clipboard."),t.info(t.i18n("copyLinkToClipboardSuccess"),"info",3e3)}).catch(t.log)}},Pe()):"")),ke("div",{class:"uppy-DashboardItem-action"},!s&&ke("button",{class:"uppy-DashboardItem-remove",type:"button","aria-label":t.i18n("removeFile"),title:t.i18n("removeFile"),onclick:function(){return t.removeFile(r.id)}},ke("svg",{"aria-hidden":"true",class:"UppyIcon",width:"60",height:"60",viewBox:"0 0 60 60",xmlns:"http://www.w3.org/2000/svg"},ke("path",{stroke:"#FFF","stroke-width":"1","fill-rule":"nonzero","vector-effect":"non-scaling-stroke",d:"M30 1C14 1 1 14 1 30s13 29 29 29 29-13 29-29S46 1 30 1z"}),ke("path",{fill:"#FFF","vector-effect":"non-scaling-stroke",d:"M42 39.667L39.667 42 30 32.333 20.333 42 18 39.667 27.667 30 18 20.333 20.333 18 30 27.667 39.667 18 42 20.333 32.333 30z"})))))},Oe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ue=A.h,Fe=function(t){var e=0===t.totalFileCount,n=Wt("uppy-Dashboard-files",{"uppy-Dashboard-files--noFiles":e});return Ue("ul",{class:n},Object.keys(t.files).map(function(e){return Ue(Te,Oe({},t,{acquirers:t.acquirers,file:t.files[e]}))}))},Ae=A.h,xe=function(t){return Ae("div",{class:"uppy-DashboardContent-panel",role:"tabpanel",id:t.activePanel&&"uppy-DashboardContent-panel--"+t.activePanel.id,onDragOver:ge,onDragLeave:ge,onDrop:ge,onPaste:ge},Ae("div",{class:"uppy-DashboardContent-bar"},Ae("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},t.i18n("importFrom",{name:t.activePanel.name})),Ae("button",{class:"uppy-DashboardContent-back",type:"button",onclick:t.hideAllPanels},t.i18n("done"))),Ae("div",{class:"uppy-DashboardContent-panelBody"},t.getPlugin(t.activePanel.id).render(t.state)))},De=A.h;function Re(t){if(t.newFiles.length)return t.i18n("xFilesSelected",{smart_count:t.newFiles.length})}var Ie=function(t){var e=!t.maxNumberOfFiles||t.totalFileCount<t.maxNumberOfFiles;return De("div",{class:"uppy-DashboardContent-bar"},De("button",{class:"uppy-DashboardContent-back",type:"button",onclick:t.cancelAll},t.i18n("cancel")),De("div",{class:"uppy-DashboardContent-title",role:"heading","aria-level":"h1"},De(Re,t)),e&&De("button",{class:"uppy-DashboardContent-addMore",type:"button","aria-label":t.i18n("addMoreFiles"),title:t.i18n("addMoreFiles"),onclick:function(){return t.toggleAddFilesPanel(!0)}},De("svg",{class:"UppyIcon",width:"15",height:"15",viewBox:"0 0 13 13",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},De("path",{d:"M7,6 L13,6 L13,7 L7,7 L7,13 L6,13 L6,7 L0,7 L0,6 L6,6 L6,0 L7,0 L7,6 Z"}))))},Be=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},je=A.h,Le=function(t){var e=0===t.totalFileCount,n=Wt({"uppy-Root":t.isTargetDOMEl},"uppy-Dashboard",{"Uppy--isTouchDevice":"ontouchstart"in window||navigator.maxTouchPoints},{"uppy-Dashboard--animateOpenClose":t.animateOpenClose},{"uppy-Dashboard--isClosing":t.isClosing},{"uppy-Dashboard--modal":!t.inline},{"uppy-size--md":t.containerWidth>576},{"uppy-size--lg":t.containerWidth>700},{"uppy-Dashboard--isAddFilesPanelVisible":t.showAddFilesPanel});return je("div",{class:n,"aria-hidden":t.inline?"false":t.modal.isHidden,"aria-label":t.inline?t.i18n("dashboardTitle"):t.i18n("dashboardWindowTitle"),onpaste:t.handlePaste},je("div",{class:"uppy-Dashboard-overlay",tabindex:-1,onclick:t.handleClickOutside}),je("div",{class:"uppy-Dashboard-inner","aria-modal":!t.inline&&"true",role:!t.inline&&"dialog",style:{width:t.inline&&t.width?t.width:"",height:t.inline&&t.height?t.height:""}},je("button",{class:"uppy-Dashboard-close",type:"button","aria-label":t.i18n("closeModal"),title:t.i18n("closeModal"),onclick:t.closeModal},je("span",{"aria-hidden":"true"},"\xd7")),je("div",{class:"uppy-Dashboard-innerWrap"},!e&&t.showSelectedFiles&&je(Ie,t),t.showSelectedFiles?je(e?se:Fe,t):je(se,t),je(Vt,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},t.showAddFilesPanel?je(le,Be({key:"AddFilesPanel"},t)):null),je(Vt,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},t.fileCardFor?je(ve,Be({key:"FileCard"},t)):null),je(Vt,{transitionName:"uppy-transition-slideDownUp",transitionEnterTimeout:250,transitionLeaveTimeout:250},t.activePanel?je(xe,Be({key:"PanelContent"},t)):null),je("div",{class:"uppy-Dashboard-progressindicators"},t.progressindicators.map(function(e){return t.getPlugin(e.id).render(t.state)})))))},Me=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ne=Y.Plugin,ze=A.h,qe=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="progressindicator",o.id=o.opts.id||"Informer",o.title="Informer",o.opts=Me({},{typeColors:{info:{text:"#fff",bg:"#000"},warning:{text:"#fff",bg:"#F6A623"},error:{text:"#fff",bg:"#D32F2F"},success:{text:"#fff",bg:"#1BB240"}}},r),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.render=function(t){var e=t.info,n=e.isHidden,r=e.message,o=e.details;return ze("div",{class:"uppy uppy-Informer","aria-hidden":n},ze("p",{role:"alert"},r," ",o&&ze("span",{"aria-label":o,"data-microtip-position":"top","data-microtip-size":"large",role:"tooltip"},"?")))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e}(Ne),He="error",We="waiting",Xe="preprocessing",Ve="uploading",Ge="postprocessing",Ke="complete",Ye=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Je=A.h,$e=function(t){var e=Wt("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":t.uploadState===We});return Je("button",{type:"button",class:e,"aria-label":t.i18n("uploadXFiles",{smart_count:t.newFiles}),onclick:t.startUpload},t.newFiles&&t.uploadStarted?t.i18n("uploadXNewFiles",{smart_count:t.newFiles}):t.i18n("uploadXFiles",{smart_count:t.newFiles}))},Qe=function(t){return Je("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":t.i18n("retryUpload"),onclick:t.retryAll},t.i18n("retry"))},Ze=function(t){return Je("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--cancel","aria-label":t.i18n("cancel"),onclick:t.cancelAll},t.i18n("cancel"))},tn=function(t){var e=t.resumableUploads,n=t.isAllPaused,r=(0,t.i18n)(e?n?"resumeUpload":"pauseUpload":"cancelUpload");return Je("button",{title:r,class:"uppy-u-reset uppy-StatusBar-statusIndicator",type:"button",onclick:function(){return function(t){if(!t.isAllComplete)return t.resumableUploads?t.isAllPaused?t.resumeAll():t.pauseAll():t.cancelAll()}(t)}},e?n?Je("svg",{"aria-hidden":"true",class:"UppyIcon",width:"15",height:"17",viewBox:"0 0 11 13"},Je("path",{d:"M1.26 12.534a.67.67 0 0 1-.674.012.67.67 0 0 1-.336-.583v-11C.25.724.38.5.586.382a.658.658 0 0 1 .673.012l9.165 5.5a.66.66 0 0 1 .325.57.66.66 0 0 1-.325.573l-9.166 5.5z"})):Je("svg",{"aria-hidden":"true",class:"UppyIcon",width:"16",height:"17",viewBox:"0 0 12 13"},Je("path",{d:"M4.888.81v11.38c0 .446-.324.81-.722.81H2.722C2.324 13 2 12.636 2 12.19V.81c0-.446.324-.81.722-.81h1.444c.398 0 .722.364.722.81zM9.888.81v11.38c0 .446-.324.81-.722.81H7.722C7.324 13 7 12.636 7 12.19V.81c0-.446.324-.81.722-.81h1.444c.398 0 .722.364.722.81z"})):Je("svg",{"aria-hidden":"true",class:"UppyIcon",width:"16px",height:"16px",viewBox:"0 0 19 19"},Je("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"})))},en=function(t){var e=Math.round(100*t.value);return Je("div",{class:"uppy-StatusBar-content"},"determinate"===t.mode?e+"% \xb7 ":"",t.message)},nn=et(function(t){return Je("div",{class:"uppy-StatusBar-statusSecondary"},t.numUploads>1&&t.i18n("filesUploadedOfTotal",{complete:t.complete,smart_count:t.numUploads})+" \xb7 ",t.i18n("dataUploadedOfTotal",{complete:t.totalUploadedSize,total:t.totalSize})+" \xb7 ",t.i18n("xTimeLeft",{time:t.totalETA}))},500,{leading:!0,trailing:!0}),rn=function(t){if(!t.isUploadStarted||t.isAllComplete)return null;var e=t.isAllPaused?t.i18n("paused"):t.i18n("uploading");return Je("div",{class:"uppy-StatusBar-content","aria-label":e,title:e},!t.hidePauseResumeCancelButtons&&Je(tn,t),Je("div",{class:"uppy-StatusBar-status"},Je("div",{class:"uppy-StatusBar-statusPrimary"},e,": ",t.totalProgress,"%"),!t.isAllPaused&&Je(nn,t)))},on=function(t){t.totalProgress;var e=t.i18n;return Je("div",{class:"uppy-StatusBar-content",role:"status",title:e("complete")},Je("svg",{"aria-hidden":"true",class:"uppy-StatusBar-statusIndicator UppyIcon",width:"18",height:"17",viewBox:"0 0 23 17"},Je("path",{d:"M8.944 17L0 7.865l2.555-2.61 6.39 6.525L20.41 0 23 2.645z"})),e("complete"))},sn=function(t){var e=t.error,n=(t.retryAll,t.hideRetryButton),r=t.i18n;return Je("div",{class:"uppy-StatusBar-content",role:"alert"},Je("span",{class:"uppy-StatusBar-contentPadding"},r("uploadFailed"),"."),!n&&Je("span",{class:"uppy-StatusBar-contentPadding"},r("pleasePressRetry")),Je("span",{class:"uppy-StatusBar-details","aria-label":e,"data-microtip-position":"top","data-microtip-size":"large",role:"tooltip"},"?"))},an=function(t){var e,n=(e=t,{hours:Math.floor(e/3600)%24,minutes:Math.floor(e/60)%60,seconds:Math.floor(e%60)}),r=n.hours?n.hours+"h ":"",o=n.hours?("0"+n.minutes).substr(-2):n.minutes;return r+(o?o+"m ":"")+(o?("0"+n.seconds).substr(-2):n.seconds)+"s"},ln=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},un=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"StatusBar",o.title="StatusBar",o.type="progressindicator";var i={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",pleasePressRetry:"Please press Retry to upload again",paused:"Paused",error:"Error",retry:"Retry",cancel:"Cancel",pressToRetry:"Press to retry",retryUpload:"Retry upload",resumeUpload:"Resume upload",cancelUpload:"Cancel upload",pauseUpload:"Pause upload",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"}}},s={target:"body",hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeCancelButtons:!1,showProgressDetails:!1,locale:i,hideAfterFinish:!0};return o.opts=ln({},s,r),o.locale=ln({},i,o.opts.locale),o.locale.strings=ln({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.startUpload=o.startUpload.bind(o),o.render=o.render.bind(o),o.install=o.install.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getTotalSpeed=function(t){var e=0;return t.forEach(function(t){e+=function(t){if(!t.bytesUploaded)return 0;var e=new Date-t.uploadStarted;return t.bytesUploaded/(e/1e3)}(t.progress)}),e},e.prototype.getTotalETA=function(t){var e=this.getTotalSpeed(t);if(0===e)return 0;var n=t.reduce(function(t,e){return t+((n=e.progress).bytesTotal-n.bytesUploaded);var n},0);return Math.round(n/e*10)/10},e.prototype.startUpload=function(){var t=this;return this.uppy.upload().catch(function(e){t.uppy.log(e.stack||e.message||e)})},e.prototype.getUploadingState=function(t,e,n){if(t)return He;if(e)return Ke;for(var r=We,o=Object.keys(n),i=0;i<o.length;i++){var s=n[o[i]].progress;if(s.uploadStarted&&!s.uploadComplete)return Ve;s.preprocess&&r!==Ve&&(r=Xe),s.postprocess&&r!==Ve&&r!==Xe&&(r=Ge)}return r},e.prototype.render=function(t){var e=t.files,n=Object.keys(e).filter(function(t){return e[t].progress.uploadStarted}),r=Object.keys(e).filter(function(t){return!e[t].progress.uploadStarted&&!e[t].progress.preprocess&&!e[t].progress.postprocess}),o=Object.keys(e).filter(function(t){return e[t].progress.uploadComplete}),i=Object.keys(e).filter(function(t){return e[t].error}),s=Object.keys(e).filter(function(t){return!e[t].progress.uploadComplete&&e[t].progress.uploadStarted&&!e[t].isPaused}),a=Object.keys(e).filter(function(t){return e[t].progress.uploadStarted||e[t].progress.preprocess||e[t].progress.postprocess}),l=Object.keys(e).filter(function(t){return e[t].progress.preprocess||e[t].progress.postprocess}),u=s.map(function(t){return e[t]}),p=F(this.getTotalSpeed(u)),c=an(this.getTotalETA(u)),h=0,d=0;u.forEach(function(t){h+=t.progress.bytesTotal||0,d+=t.progress.bytesUploaded||0}),h=F(h),d=F(d);var f=n.length>0,y=100===t.totalProgress&&o.length===Object.keys(e).length&&0===l.length,g=f&&i.length===n.length,m=0===s.length&&!y&&!g&&n.length>0,v=t.capabilities.resumableUploads||!1;return function(t){var e=(t=t||{}).uploadState,n=t.totalProgress,r=void 0,o=void 0;if(e===Xe||e===Ge){var i=function(t){var e=[];Object.keys(t).forEach(function(n){var r=t[n].progress;r.preprocess&&e.push(r.preprocess),r.postprocess&&e.push(r.postprocess)});var n=e[0];return{mode:n.mode,message:n.message,value:e.filter(function(t){return"determinate"===t.mode}).reduce(function(t,e,n,r){return t+e.value/r.length},0)}}(t.files);"determinate"===(r=i.mode)&&(n=100*i.value),o=en(i)}else e===Ke?o=on(t):e===Ve?o=rn(t):e===He&&(n=void 0,o=sn(t));var s="number"==typeof n?n:100,a=e===We&&t.hideUploadButton||e===We&&!t.newFiles>0||e===Ke&&t.hideAfterFinish,l="uppy-StatusBar-progress\n "+(r?"is-"+r:""),u=Wt({"uppy-Root":t.isTargetDOMEl},"uppy-StatusBar","is-"+e,{"uppy-StatusBar--detailedProgress":t.showProgressDetails});return Je("div",{class:u,"aria-hidden":a},Je("div",{class:l,style:{width:s+"%"},role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":n}),o,Je("div",{class:"uppy-StatusBar-actions"},t.newFiles&&!t.hideUploadButton?Je($e,Ye({},t,{uploadState:e})):null,t.error&&!t.hideRetryButton?Je(Qe,t):null,t.hidePauseResumeCancelButtons||e===We||e===Ke?null:Je(Ze,t)))}({error:t.error,uploadState:this.getUploadingState(g,y,t.files||{}),totalProgress:t.totalProgress,totalSize:h,totalUploadedSize:d,uploadStarted:n.length,isAllComplete:y,isAllPaused:m,isAllErrored:g,isUploadStarted:f,complete:o.length,newFiles:r.length,numUploads:a.length,totalSpeed:p,totalETA:c,files:t.files,i18n:this.i18n,pauseAll:this.uppy.pauseAll,resumeAll:this.uppy.resumeAll,retryAll:this.uppy.retryAll,cancelAll:this.uppy.cancelAll,startUpload:this.startUpload,resumableUploads:v,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeCancelButtons:this.opts.hidePauseResumeCancelButtons,hideAfterFinish:this.opts.hideAfterFinish,isTargetDOMEl:this.isTargetDOMEl})},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.unmount()},e}(Y.Plugin),pn=function(t,e,n){var r=t.split(",")[1],o=e.mimeType||t.split(",")[0].split(":")[1].split(";")[0];null==o&&(o="plain/text");for(var i=atob(r),s=[],a=0;a<i.length;a++)s.push(i.charCodeAt(a));return n?new File([new Uint8Array(s)],e.name||"",{type:o}):new Blob([new Uint8Array(s)],{type:o})},cn=function(t){if(!t)return!1;var e=t.split("/")[1];return!!/^(jpeg|gif|png|svg|svg\+xml|bmp)$/.test(e)},hn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},dn=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="thumbnail",o.id=o.opts.id||"ThumbnailGenerator",o.title="Thumbnail Generator",o.queue=[],o.queueProcessing=!1,o.opts=hn({},{thumbnailWidth:200},r),o.addToQueue=o.addToQueue.bind(o),o.onRestored=o.onRestored.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.createThumbnail=function(t,e){var n=this,r=URL.createObjectURL(t.data);return new Promise(function(t,e){var n=new Image;n.src=r,n.onload=function(){URL.revokeObjectURL(r),t(n)},n.onerror=function(){URL.revokeObjectURL(r),e(new Error("Could not create thumbnail"))}}).then(function(t){var r=n.getProportionalHeight(t,e),o=n.resizeImage(t,e,r);return n.canvasToBlob(o,"image/png")}).then(function(t){return URL.createObjectURL(t)})},e.prototype.protect=function(t){var e=t.width/t.height,n=Math.floor(Math.sqrt(5e6*e)),r=Math.floor(5e6/Math.sqrt(5e6*e));if(n>4096&&(n=4096,r=Math.round(n/e)),r>4096&&(r=4096,n=Math.round(e*r)),t.width>n){var o=document.createElement("canvas");o.width=n,o.height=r,o.getContext("2d").drawImage(t,0,0,n,r),t=o}return t},e.prototype.resizeImage=function(t,e,n){t=this.protect(t);var r=Math.ceil(Math.log(t.width/e)*Math.LOG2E);r<1&&(r=1);for(var o=e*Math.pow(2,r-1),i=n*Math.pow(2,r-1);r--;){var s=document.createElement("canvas");s.width=o,s.height=i,s.getContext("2d").drawImage(t,0,0,o,i),t=s,o=Math.round(o/2),i=Math.round(i/2)}return t},e.prototype.canvasToBlob=function(t,e,n){return t.toBlob?new Promise(function(r){t.toBlob(r,e,n)}):Promise.resolve().then(function(){return pn(t.toDataURL(e,n),{})})},e.prototype.getProportionalHeight=function(t,e){var n=t.width/t.height;return Math.round(e/n)},e.prototype.setPreviewURL=function(t,e){this.uppy.setFileState(t,{preview:e})},e.prototype.addToQueue=function(t){this.queue.push(t),!1===this.queueProcessing&&this.processQueue()},e.prototype.processQueue=function(){var t=this;if(this.queueProcessing=!0,this.queue.length>0){var e=this.queue.shift();return this.requestThumbnail(e).catch(function(t){}).then(function(){return t.processQueue()})}this.queueProcessing=!1},e.prototype.requestThumbnail=function(t){var e=this;return cn(t.type)&&!t.isRemote?this.createThumbnail(t,this.opts.thumbnailWidth).then(function(n){e.setPreviewURL(t.id,n)}).catch(function(t){console.warn(t.stack||t.message)}):Promise.resolve()},e.prototype.onRestored=function(){var t=this;Object.keys(this.uppy.getState().files).forEach(function(e){var n=t.uppy.getFile(e);n.isRestored&&(n.preview&&!/^blob:/.test(n.preview)||t.addToQueue(n))})},e.prototype.install=function(){this.uppy.on("file-added",this.addToQueue),this.uppy.on("restored",this.onRestored)},e.prototype.uninstall=function(){this.uppy.off("file-added",this.addToQueue),this.uppy.off("restored",this.onRestored)},e}(Y.Plugin),fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yn=function(t){if("string"==typeof t){var e=[].slice.call(document.querySelectorAll(t));return e.length>0?e:null}if("object"===(void 0===t?"undefined":fn(t))&&D(t))return[t]},gn=function(t){return Array.prototype.slice.call(t||[],0)},mn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vn=Y.Plugin,bn=Ht.default||Ht,wn=Jt,Sn=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'],_n=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"Dashboard",o.title="Dashboard",o.type="orchestrator",o.modalName="uppy-Dashboard";var i={strings:{selectToUpload:"Select files to upload",closeModal:"Close Modal",upload:"Upload",importFrom:"Import from %{name}",addingMoreFiles:"Adding more files",addMoreFiles:"Add more files",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",fileSource:"File source: %{name}",done:"Done",back:"Back",name:"Name",removeFile:"Remove file",editFile:"Edit file",editing:"Editing %{file}",edit:"Edit",finishEditingFile:"Finish editing file",saveChanges:"Save changes",cancel:"Cancel",localDisk:"Local Disk",myDevice:"My Device",dropPasteImport:"Drop files here, paste, %{browse} or import from",dropPaste:"Drop files here, paste or %{browse}",browse:"browse",fileProgress:"File progress: upload speed and ETA",numberOfSelectedFiles:"Number of selected files",uploadAllNewFiles:"Upload all new files",emptyFolderAdded:"No files were added from empty folder",uploadComplete:"Upload complete",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"}}},s={target:"body",metaFields:[],trigger:"#uppy-select-files",inline:!1,width:750,height:550,thumbnailWidth:280,defaultTabIcon:wn,showLinkToFileUploadResult:!0,showProgressDetails:!1,hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeCancelButtons:!1,hideProgressAfterFinish:!1,note:null,closeModalOnClickOutside:!1,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,disablePageScrollWhenModalOpen:!0,animateOpenClose:!0,proudlyDisplayPoweredByUppy:!0,onRequestCloseModal:function(){return o.closeModal()},showSelectedFiles:!0,locale:i,browserBackButtonClose:!1};return o.opts=mn({},s,r),o.locale=mn({},i,o.opts.locale),o.locale.strings=mn({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.i18nArray=o.translator.translateArray.bind(o.translator),o.openModal=o.openModal.bind(o),o.closeModal=o.closeModal.bind(o),o.requestCloseModal=o.requestCloseModal.bind(o),o.isModalOpen=o.isModalOpen.bind(o),o.addTarget=o.addTarget.bind(o),o.removeTarget=o.removeTarget.bind(o),o.hideAllPanels=o.hideAllPanels.bind(o),o.showPanel=o.showPanel.bind(o),o.getFocusableNodes=o.getFocusableNodes.bind(o),o.setFocusToFirstNode=o.setFocusToFirstNode.bind(o),o.handlePopState=o.handlePopState.bind(o),o.maintainFocus=o.maintainFocus.bind(o),o.initEvents=o.initEvents.bind(o),o.onKeydown=o.onKeydown.bind(o),o.handleClickOutside=o.handleClickOutside.bind(o),o.toggleFileCard=o.toggleFileCard.bind(o),o.toggleAddFilesPanel=o.toggleAddFilesPanel.bind(o),o.handleDrop=o.handleDrop.bind(o),o.handlePaste=o.handlePaste.bind(o),o.handleInputChange=o.handleInputChange.bind(o),o.render=o.render.bind(o),o.install=o.install.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.removeTarget=function(t){var e=this.getPluginState().targets.filter(function(e){return e.id!==t.id});this.setPluginState({targets:e})},e.prototype.addTarget=function(t){var e=t.id||t.constructor.name,n=t.title||e,r=t.type;if("acquirer"===r||"progressindicator"===r||"presenter"===r){var o={id:e,name:n,type:r},i=this.getPluginState().targets.slice();return i.push(o),this.setPluginState({targets:i}),this.el}this.uppy.log("Dashboard: Modal can only be used by plugins of types: acquirer, progressindicator, presenter")},e.prototype.hideAllPanels=function(){this.setPluginState({activePanel:!1,showAddFilesPanel:!1})},e.prototype.showPanel=function(t){var e=this.getPluginState().targets.filter(function(e){return"acquirer"===e.type&&e.id===t})[0];this.setPluginState({activePanel:e})},e.prototype.requestCloseModal=function(){if(this.opts.onRequestCloseModal)return this.opts.onRequestCloseModal();this.closeModal()},e.prototype.getFocusableNodes=function(){var t=this.el.querySelectorAll(Sn);return Object.keys(t).map(function(e){return t[e]})},e.prototype.setFocusToFirstNode=function(){var t=this.getFocusableNodes();t.length&&t[0].focus()},e.prototype.updateBrowserHistory=function(){var t;history.state&&history.state[this.modalName]||history.pushState(((t={})[this.modalName]=!0,t),""),window.addEventListener("popstate",this.handlePopState,!1)},e.prototype.handlePopState=function(t){t.state&&t.state[this.modalName]||this.closeModal({manualClose:!1}),!this.isModalOpen()&&t.state&&t.state[this.modalName]&&history.go(-1)},e.prototype.setFocusToBrowse=function(){var t=this.el.querySelector(".uppy-Dashboard-browse");t&&t.focus()},e.prototype.maintainFocus=function(t){var e=this.getFocusableNodes(),n=e.indexOf(document.activeElement);t.shiftKey&&0===n&&(e[e.length-1].focus(),t.preventDefault()),t.shiftKey||n!==e.length-1||(e[0].focus(),t.preventDefault())},e.prototype.openModal=function(){var t=this;this.savedScrollPosition=window.scrollY,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing?this.el.addEventListener("animationend",function e(){t.setPluginState({isHidden:!1}),t.el.removeEventListener("animationend",e,!1)},!1):this.setPluginState({isHidden:!1}),this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.onKeydown),this.setFocusToBrowse()},e.prototype.closeModal=function(){var t=this,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).manualClose,n=void 0===e||e;this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose?(this.setPluginState({isClosing:!0}),this.el.addEventListener("animationend",function e(){t.setPluginState({isHidden:!0,isClosing:!1}),t.el.removeEventListener("animationend",e,!1)},!1)):this.setPluginState({isHidden:!0}),document.removeEventListener("keydown",this.onKeydown),this.savedActiveElement.focus(),n&&this.opts.browserBackButtonClose&&history.state&&history.state[this.modalName]&&history.go(-1)},e.prototype.isModalOpen=function(){return!this.getPluginState().isHidden||!1},e.prototype.onKeydown=function(t){27===t.keyCode&&this.requestCloseModal(t),9===t.keyCode&&this.maintainFocus(t)},e.prototype.handleClickOutside=function(){this.opts.closeModalOnClickOutside&&this.requestCloseModal()},e.prototype.handlePaste=function(t){var e=this;gn(t.clipboardData.items).forEach(function(t){if("file"===t.kind){var n=t.getAsFile();if(!n)return e.uppy.log("[Dashboard] File pasted, but the file blob is empty"),void e.uppy.info("Error pasting file","error");e.uppy.log("[Dashboard] File pasted");try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:n})}catch(t){}}})},e.prototype.handleInputChange=function(t){var e=this;t.preventDefault(),gn(t.target.files).forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.initEvents=function(){var t=this,e=yn(this.opts.trigger);!this.opts.inline&&e&&e.forEach(function(e){return e.addEventListener("click",t.openModal)}),this.opts.inline||e||this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options unless you are planning to call openModal() method yourself"),this.removeDragDropListener=Nt(this.el,function(e){t.handleDrop(e)}),this.ro=new bn(function(e,n){var r=e,o=Array.isArray(r),i=0;for(r=o?r:r[Symbol.iterator]();;){var s;if(o){if(i>=r.length)break;s=r[i++]}else{if((i=r.next()).done)break;s=i.value}var a=s.contentRect,l=a.width,u=a.height;t.uppy.log("[Dashboard] resized: "+l+" / "+u),t.setPluginState({containerWidth:l,containerHeight:u})}}),this.ro.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",function(e){t.toggleAddFilesPanel(!1),t.hideAllPanels()})},e.prototype.removeEvents=function(){var t=this,e=yn(this.opts.trigger);!this.opts.inline&&e&&e.forEach(function(e){return e.removeEventListener("click",t.openModal)}),this.ro.unobserve(this.el.querySelector(".uppy-Dashboard-inner")),this.removeDragDropListener(),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",function(e){return t.toggleAddFilesPanel(!1)})},e.prototype.toggleFileCard=function(t){this.setPluginState({fileCardFor:t||!1})},e.prototype.toggleAddFilesPanel=function(t){this.setPluginState({showAddFilesPanel:t})},e.prototype.handleDrop=function(t){var e=this;this.uppy.log("[Dashboard] Files were dropped"),t.forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.render=function(t){var e=this,n=this.getPluginState(),r=t.files,o=t.capabilities,i=Object.keys(r).filter(function(t){return!r[t].progress.uploadStarted}),s=Object.keys(r).filter(function(t){return!r[t].progress.uploadComplete&&r[t].progress.uploadStarted&&!r[t].isPaused}),a=[];s.forEach(function(t){a.push(r[t])});var l=0,u=0;a.forEach(function(t){l+=t.progress.bytesTotal||0,u+=t.progress.bytesUploaded||0}),l=F(l),u=F(u);var p=function(t){var n=e.uppy.getPlugin(t.id);return mn({},t,{icon:n.icon||e.opts.defaultTabIcon,render:n.render})},c=n.targets.filter(function(t){return"acquirer"===t.type&&function(t){var n=e.uppy.getPlugin(t.id);return"function"!=typeof n.isSupported||n.isSupported()}(t)}).map(p),h=n.targets.filter(function(t){return"progressindicator"===t.type}).map(p);return Le({state:t,modal:n,newFiles:i,files:r,totalFileCount:Object.keys(r).length,totalProgress:t.totalProgress,acquirers:c,activePanel:n.activePanel,animateOpenClose:this.opts.animateOpenClose,isClosing:n.isClosing,getPlugin:this.uppy.getPlugin,progressindicators:h,autoProceed:this.uppy.opts.autoProceed,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeCancelButtons:this.opts.hidePauseResumeCancelButtons,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,log:this.uppy.log,i18n:this.i18n,i18nArray:this.i18nArray,addFile:this.uppy.addFile,removeFile:this.uppy.removeFile,info:this.uppy.info,note:this.opts.note,metaFields:n.metaFields,resumableUploads:o.resumableUploads||!1,bundled:o.bundled||!1,startUpload:function(t){e.uppy.upload().catch(function(t){e.uppy.log(t.stack||t.message||t)})},pauseUpload:this.uppy.pauseResume,retryUpload:this.uppy.retryUpload,cancelUpload:function(t){e.uppy.emit("upload-cancel",t),e.uppy.removeFile(t)},cancelAll:this.uppy.cancelAll,fileCardFor:n.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:n.showAddFilesPanel,saveFileCard:function(t,n){e.uppy.setFileMeta(n,t),e.toggleFileCard()},width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,currentWidth:n.containerWidth,isWide:n.containerWidth>400,containerWidth:n.containerWidth,isTargetDOMEl:this.isTargetDOMEl,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,showSelectedFiles:this.opts.showSelectedFiles})},e.prototype.discoverProviderPlugins=function(){var t=this;this.uppy.iteratePlugins(function(e){e&&!e.target&&e.opts&&e.opts.target===t.constructor&&t.addTarget(e)})},e.prototype.install=function(){var t=this;this.setPluginState({isHidden:!0,showFileCard:!1,showAddFilesPanel:!1,activePanel:!1,metaFields:this.opts.metaFields,targets:[]});var e=this.opts.target;e&&this.mount(e,this),(this.opts.plugins||[]).forEach(function(e){var n=t.uppy.getPlugin(e);n&&n.mount(t,n)}),this.opts.disableStatusBar||this.uppy.use(un,{id:this.id+":StatusBar",target:this,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeCancelButtons:this.opts.hidePauseResumeCancelButtons,showProgressDetails:this.opts.showProgressDetails,hideAfterFinish:this.opts.hideProgressAfterFinish,locale:this.opts.locale}),this.opts.disableInformer||this.uppy.use(qe,{id:this.id+":Informer",target:this}),this.opts.disableThumbnailGenerator||this.uppy.use(dn,{id:this.id+":ThumbnailGenerator",thumbnailWidth:this.opts.thumbnailWidth}),this.discoverProviderPlugins(),this.initEvents()},e.prototype.uninstall=function(){var t=this;if(!this.opts.disableInformer){var e=this.uppy.getPlugin(this.id+":Informer");e&&this.uppy.removePlugin(e)}if(!this.opts.disableStatusBar){var n=this.uppy.getPlugin(this.id+":StatusBar");n&&this.uppy.removePlugin(n)}if(!this.opts.disableThumbnailGenerator){var r=this.uppy.getPlugin(this.id+":ThumbnailGenerator");r&&this.uppy.removePlugin(r)}(this.opts.plugins||[]).forEach(function(e){var n=t.uppy.getPlugin(e);n&&n.unmount()}),this.unmount(),this.removeEvents()},e}(vn),Pn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},En=Y.Plugin,kn=A.h,Cn=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="acquirer",o.id=o.opts.id||"DragDrop",o.title="Drag & Drop";var i={strings:{dropHereOr:"Drop files here or %{browse}",browse:"browse"}},s={target:null,inputName:"files[]",width:"100%",height:"100%",note:null,locale:i};return o.opts=Pn({},s,r),o.isDragDropSupported=o.checkDragDropSupport(),o.locale=Pn({},i,o.opts.locale),o.locale.strings=Pn({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.i18nArray=o.translator.translateArray.bind(o.translator),o.handleDrop=o.handleDrop.bind(o),o.handleInputChange=o.handleInputChange.bind(o),o.checkDragDropSupport=o.checkDragDropSupport.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.checkDragDropSupport=function(){var t=document.createElement("div");return"draggable"in t&&"ondragstart"in t&&"ondrop"in t&&"FormData"in window&&"FileReader"in window},e.prototype.handleDrop=function(t){var e=this;this.uppy.log("[DragDrop] Files dropped"),t.forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.handleInputChange=function(t){var e=this;this.uppy.log("[DragDrop] Files selected through input"),gn(t.target.files).forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.render=function(t){var e=this,n="uppy-Root uppy-DragDrop-container "+(this.isDragDropSupported?"uppy-DragDrop--is-dragdrop-supported":""),r={width:this.opts.width,height:this.opts.height},o=this.uppy.opts.restrictions;return kn("div",{class:n,style:r},kn("div",{class:"uppy-DragDrop-inner"},kn("svg",{"aria-hidden":"true",class:"UppyIcon uppy-DragDrop-arrow",width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},kn("path",{d:"M11 10V0H5v10H2l6 6 6-6h-3zm0 0","fill-rule":"evenodd"})),kn("label",{class:"uppy-DragDrop-label"},kn("input",{style:{width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},class:"uppy-DragDrop-input",type:"file",name:this.opts.inputName,multiple:1!==o.maxNumberOfFiles,accept:o.allowedFileTypes,ref:function(t){e.input=t},onchange:this.handleInputChange,value:""}),this.i18nArray("dropHereOr",{browse:kn("span",{class:"uppy-DragDrop-dragText"},this.i18n("browse"))})),kn("span",{class:"uppy-DragDrop-note"},this.opts.note)))},e.prototype.install=function(){var t=this,e=this.opts.target;e&&this.mount(e,this),this.removeDragDropListener=Nt(this.el,function(e){t.handleDrop(e),t.uppy.log(e)})},e.prototype.uninstall=function(){this.unmount(),this.removeDragDropListener()},e}(En),Tn=A.h,On=function(t){return Tn("div",{class:"uppy-Provider-loading"},Tn("span",null,"Loading..."))};function Un(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fn(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function An(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var xn=A.h,Dn=A.Component,Rn=function(t){function e(){return Un(this,e),Fn(this,t.apply(this,arguments))}return An(e,t),e.prototype.componentDidMount=function(){var t=this;setTimeout(function(){t.connectButton&&t.connectButton.focus({preventScroll:!0})},150)},e.prototype.render=function(){var t=this;return xn("div",{class:"uppy-Provider-auth"},xn("div",{class:"uppy-Provider-authIcon"},this.props.pluginIcon()),xn("h1",{class:"uppy-Provider-authTitle"},"Please authenticate with ",xn("span",{class:"uppy-Provider-authTitleName"},this.props.pluginName),xn("br",null)," to select files"),xn("button",{type:"button",class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn",onclick:this.props.handleAuth,ref:function(e){t.connectButton=e}},"Connect to ",this.props.pluginName),this.props.demo&&xn("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn",onclick:this.props.handleDemoAuth},"Proceed with Demo Account"))},e}(Dn),In=function(t){function e(){return Un(this,e),Fn(this,t.apply(this,arguments))}return An(e,t),e.prototype.componentDidMount=function(){this.props.checkAuth()},e.prototype.render=function(){return this.props.checkAuthInProgress?xn(On,null):xn(Rn,this.props)},e}(Dn),Bn=A.h,jn=A.h,Ln=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.isEmpty=!0,r.handleKeyPress=r.handleKeyPress.bind(r),r.handleClear=r.handleClear.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleKeyPress=function(t){if(13===t.keyCode)return t.stopPropagation(),void t.preventDefault();this.isEmpty=!this.input.value.length>0,this.props.filterQuery(t)},e.prototype.handleClear=function(t){this.input.value="",this.props.filterQuery()},e.prototype.render=function(){var t=this;return jn("div",{class:"uppy-u-reset uppy-ProviderBrowser-search"},jn("svg",{class:"UppyIcon uppy-ProviderBrowser-searchIcon",viewBox:"0 0 100 100"},jn("path",{d:"M87.533 80.03L62.942 55.439c3.324-4.587 5.312-10.207 5.312-16.295 0-.312-.043-.611-.092-.908.05-.301.093-.605.093-.922 0-15.36-12.497-27.857-27.857-27.857-.273 0-.536.043-.799.08-.265-.037-.526-.08-.799-.08-15.361 0-27.858 12.497-27.858 27.857 0 .312.042.611.092.909a5.466 5.466 0 0 0-.093.921c0 15.36 12.496 27.858 27.857 27.858.273 0 .535-.043.8-.081.263.038.524.081.798.081 5.208 0 10.071-1.464 14.245-3.963L79.582 87.98a5.603 5.603 0 0 0 3.976 1.647 5.621 5.621 0 0 0 3.975-9.597zM39.598 55.838c-.265-.038-.526-.081-.8-.081-9.16 0-16.612-7.452-16.612-16.612 0-.312-.042-.611-.092-.908.051-.301.093-.605.093-.922 0-9.16 7.453-16.612 16.613-16.612.272 0 .534-.042.799-.079.263.037.525.079.799.079 9.16 0 16.612 7.452 16.612 16.612 0 .312.043.611.092.909-.05.301-.094.604-.094.921 0 9.16-7.452 16.612-16.612 16.612-.274 0-.536.043-.798.081z"})),jn("input",{class:"uppy-u-reset uppy-ProviderBrowser-searchInput",type:"text",placeholder:"Filter","aria-label":"Filter",onkeyup:this.handleKeyPress,onkeydown:this.handleKeyPress,onkeypress:this.handleKeyPress,value:this.props.filterInput,ref:function(e){t.input=e}}),!this.isEmpty&&jn("button",{class:"uppy-u-reset uppy-ProviderBrowser-searchClose",type:"button",onclick:this.handleClear},jn("svg",{class:"UppyIcon",viewBox:"0 0 19 19"},jn("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))))},e}(A.Component),Mn=A.h,Nn=function(t){return Mn("div",{class:"uppy-ProviderBrowser-footer"},Mn("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary",onclick:t.done},t.i18n("selectXFiles",{smart_count:t.selected})),Mn("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onclick:t.cancel},t.i18n("cancel")))},zn=A.h,qn=function(t){var e=function(t){13===t.keyCode&&(t.stopPropagation(),t.preventDefault())},n=t.getItemIcon();return zn("li",{class:"uppy-ProviderBrowserItem"+(t.isChecked?" uppy-ProviderBrowserItem--selected":"")+("video"===n?" uppy-ProviderBrowserItem--noPreview":"")},zn("div",{class:"uppy-ProviderBrowserItem-checkbox"},zn("input",{type:"checkbox",role:"option",tabindex:0,"aria-label":"Select "+t.title,id:t.id,checked:t.isChecked,disabled:t.isDisabled,onchange:t.handleClick,onkeyup:e,onkeydown:e,onkeypress:e}),zn("label",{for:t.id,onclick:t.handleClick})),zn("button",{type:"button",class:"uppy-ProviderBrowserItem-inner","aria-label":"Select "+t.title,tabindex:0,onclick:function(e){if(e.preventDefault(),"folder"===t.type)return t.handleFolderClick(e);t.handleClick(e)}},function(t){if(null!==t)switch(t){case"file":return zn("svg",{"aria-hidden":"true",class:"UppyIcon",width:11,height:14.5,viewBox:"0 0 44 58"},zn("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}));case"folder":return zn("svg",{"aria-hidden":"true",class:"UppyIcon",style:{width:16,marginRight:3},viewBox:"0 0 276.157 276.157"},zn("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}));case"video":return zn("svg",{"aria-hidden":"true",viewBox:"0 0 58 58"},zn("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),zn("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}));default:return zn("img",{src:t})}}(t.getItemIcon()),t.showTitles&&t.title))},Hn=A.h,Wn=function(t){return t.folders.length||t.files.length?Hn("div",{class:"uppy-ProviderBrowser-body"},Hn("ul",{class:"uppy-ProviderBrowser-list",onscroll:t.handleScroll,role:"listbox","aria-label":"List of files from "+t.title},t.folders.map(function(e){var n=!1,r=t.isChecked(e);return r&&(n=r.loading),qn({title:t.getItemName(e),id:t.getItemId(e),type:"folder",getItemIcon:function(){return t.getItemIcon(e)},isDisabled:n,isChecked:r,handleFolderClick:function(){return t.handleFolderClick(e)},handleClick:function(n){return t.toggleCheckbox(n,e)},columns:t.columns,showTitles:t.showTitles})}),t.files.map(function(e){return qn({title:t.getItemName(e),id:t.getItemId(e),type:"file",getItemIcon:function(){return t.getItemIcon(e)},isDisabled:!1,isChecked:t.isChecked(e),handleClick:function(n){return t.toggleCheckbox(n,e)},columns:t.columns,showTitles:t.showTitles})}))):Hn("div",{class:"uppy-Provider-empty"},t.i18n("noFilesFound"))},Xn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Vn=A.h,Gn=function(t){var e=t.folders,n=t.files;""!==t.filterInput&&(e=t.filterItems(t.folders),n=t.filterItems(t.files));var r=t.currentSelection.length;return Vn("div",{class:Wt("uppy-ProviderBrowser","uppy-ProviderBrowser-viewType--"+t.viewType)},Vn("div",{class:"uppy-ProviderBrowser-header"},Vn("div",{class:Wt("uppy-ProviderBrowser-headerBar",!t.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple")},Vn("div",{class:"uppy-Provider-breadcrumbsWrap"},Vn("div",{class:"uppy-Provider-breadcrumbsIcon"},t.pluginIcon&&t.pluginIcon()),t.showBreadcrumbs&&function(t){return Bn("div",{class:"uppy-Provider-breadcrumbs"},t.directories.map(function(e,n){return function(t){return Bn("button",{type:"button",onclick:t.getFolder},t.title)}({getFolder:function(){return t.getFolder(e.id)},title:0===n?t.title:e.title})}))}({getFolder:t.getFolder,directories:t.directories,title:t.title})),Vn("span",{class:"uppy-ProviderBrowser-user"},t.username),Vn("button",{type:"button",onclick:t.logout,class:"uppy-ProviderBrowser-userLogout"},t.i18n("logOut")))),t.showFilter&&Vn(Ln,t),Vn(Wn,{columns:[{name:"Name",key:"title"}],folders:e,files:n,activeRow:t.isActiveRow,sortByTitle:t.sortByTitle,sortByDate:t.sortByDate,isChecked:t.isChecked,handleFolderClick:t.getNextFolder,toggleCheckbox:t.toggleCheckbox,getItemName:t.getItemName,getItemIcon:t.getItemIcon,handleScroll:t.handleScroll,title:t.title,showTitles:t.showTitles,getItemId:t.getItemId,i18n:t.i18n}),r>0&&Vn(Nn,Xn({selected:r},t)))},Kn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Yn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Jn=A.h,$n=function(t){function e(){return Yn(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillUnmount=function(){this.props.onUnmount()},e.prototype.render=function(){return this.props.children[0]},e}(A.Component),Qn=function(){function t(e,n){Yn(this,t),this.plugin=e,this.Provider=e[e.id],this.opts=Kn({},{viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0},n),this.addFile=this.addFile.bind(this),this.filterItems=this.filterItems.bind(this),this.filterQuery=this.filterQuery.bind(this),this.toggleSearch=this.toggleSearch.bind(this),this.getFolder=this.getFolder.bind(this),this.getNextFolder=this.getNextFolder.bind(this),this.logout=this.logout.bind(this),this.checkAuth=this.checkAuth.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleDemoAuth=this.handleDemoAuth.bind(this),this.sortByTitle=this.sortByTitle.bind(this),this.sortByDate=this.sortByDate.bind(this),this.isActiveRow=this.isActiveRow.bind(this),this.isChecked=this.isChecked.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.handleError=this.handleError.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelPicking=this.cancelPicking.bind(this),this.clearSelection=this.clearSelection.bind(this),this.render=this.render.bind(this),this.clearSelection()}return t.prototype.tearDown=function(){},t.prototype._updateFilesAndFolders=function(t,e,n){var r=this;this.plugin.getItemSubList(t).forEach(function(t){r.plugin.isFolder(t)?n.push(t):e.push(t)}),this.plugin.setPluginState({folders:n,files:e})},t.prototype.checkAuth=function(){var t=this;this.plugin.setPluginState({checkAuthInProgress:!0}),this.Provider.checkAuth().then(function(e){t.plugin.setPluginState({checkAuthInProgress:!1}),t.plugin.onAuth(e)}).catch(function(e){t.plugin.setPluginState({checkAuthInProgress:!1}),t.handleError(e)})},t.prototype.getFolder=function(t,e){var n=this;return this._loaderWrapper(this.Provider.list(t),function(r){var o,i=n.plugin.getPluginState(),s=function(e,n){for(var r=0;r<e.length;r++)if(o=e[r],t===o.id)return r;var o;return-1}(i.directories);o=-1!==s?i.directories.slice(0,s+1):i.directories.concat([{id:t,title:e||n.plugin.getItemName(r)}]),n.username=n.username?n.username:n.plugin.getUsername(r),n._updateFilesAndFolders(r,[],[]),n.plugin.setPluginState({directories:o})},this.handleError)},t.prototype.getNextFolder=function(t){var e=this.plugin.getItemRequestPath(t);this.getFolder(e,this.plugin.getItemName(t)),this.lastCheckbox=void 0},t.prototype.addFile=function(t){var e={id:this.providerFileToId(t),source:this.plugin.id,data:this.plugin.getItemData(t),name:this.plugin.getItemName(t)||this.plugin.getItemId(t),type:this.plugin.getMimeType(t),isRemote:!0,body:{fileId:this.plugin.getItemId(t)},remote:{serverUrl:this.plugin.opts.serverUrl,url:""+this.Provider.fileUrl(this.plugin.getItemRequestPath(t)),body:{fileId:this.plugin.getItemId(t)},providerOptions:this.Provider.opts}},n=G(e);n&&cn(n)&&(e.preview=this.plugin.getItemThumbnailUrl(t)),this.plugin.uppy.log("Adding remote file");try{this.plugin.uppy.addFile(e)}catch(t){}},t.prototype.removeFile=function(t){var e=this.plugin.getPluginState().currentSelection;this.plugin.setPluginState({currentSelection:e.filter(function(e){return e.id!==t})})},t.prototype.logout=function(){var t=this;this.Provider.logout(location.href).then(function(e){e.ok&&t.plugin.setPluginState({authenticated:!1,files:[],folders:[],directories:[]})}).catch(this.handleError)},t.prototype.filterQuery=function(t){var e=this.plugin.getPluginState();this.plugin.setPluginState(Kn({},e,{filterInput:t?t.target.value:""}))},t.prototype.toggleSearch=function(t){var e=this.plugin.getPluginState();this.plugin.setPluginState({isSearchVisible:!e.isSearchVisible,filterInput:""})},t.prototype.filterItems=function(t){var e=this,n=this.plugin.getPluginState();return""===n.filterInput?t:t.filter(function(t){return-1!==e.plugin.getItemName(t).toLowerCase().indexOf(n.filterInput.toLowerCase())})},t.prototype.sortByTitle=function(){var t=this,e=Kn({},this.plugin.getPluginState()),n=e.files,r=e.folders,o=e.sorting,i=n.sort(function(e,n){return"titleDescending"===o?t.plugin.getItemName(n).localeCompare(t.plugin.getItemName(e)):t.plugin.getItemName(e).localeCompare(t.plugin.getItemName(n))}),s=r.sort(function(e,n){return"titleDescending"===o?t.plugin.getItemName(n).localeCompare(t.plugin.getItemName(e)):t.plugin.getItemName(e).localeCompare(t.plugin.getItemName(n))});this.plugin.setPluginState(Kn({},e,{files:i,folders:s,sorting:"titleDescending"===o?"titleAscending":"titleDescending"}))},t.prototype.sortByDate=function(){var t=this,e=Kn({},this.plugin.getPluginState()),n=e.files,r=e.folders,o=e.sorting,i=n.sort(function(e,n){var r=new Date(t.plugin.getItemModifiedDate(e)),i=new Date(t.plugin.getItemModifiedDate(n));return"dateDescending"===o?r>i?-1:r<i?1:0:r>i?1:r<i?-1:0}),s=r.sort(function(e,n){var r=new Date(t.plugin.getItemModifiedDate(e)),i=new Date(t.plugin.getItemModifiedDate(n));return"dateDescending"===o?r>i?-1:r<i?1:0:r>i?1:r<i?-1:0});this.plugin.setPluginState(Kn({},e,{files:i,folders:s,sorting:"dateDescending"===o?"dateAscending":"dateDescending"}))},t.prototype.sortBySize=function(){var t=this,e=Kn({},this.plugin.getPluginState()),n=e.files,r=e.sorting;if(n.length&&this.plugin.getItemData(n[0]).size){var o=n.sort(function(e,n){var o=t.plugin.getItemData(e).size,i=t.plugin.getItemData(n).size;return"sizeDescending"===r?o>i?-1:o<i?1:0:o>i?1:o<i?-1:0});this.plugin.setPluginState(Kn({},e,{files:o,sorting:"sizeDescending"===r?"sizeAscending":"sizeDescending"}))}},t.prototype.isActiveRow=function(t){return this.plugin.getPluginState().activeRow===this.plugin.getItemId(t)},t.prototype.isChecked=function(t){return this.plugin.getPluginState().currentSelection.some(function(e){return e===t})},t.prototype.addFolder=function(t){var e=this,n=this.providerFileToId(t),r=this.plugin.getPluginState(),o=r.selectedFolders||{};if(!(n in o&&o[n].loading))return o[n]={loading:!0,files:[]},this.plugin.setPluginState({selectedFolders:o}),this.Provider.list(this.plugin.getItemRequestPath(t)).then(function(i){var s=[];e.plugin.getItemSubList(i).forEach(function(t){e.plugin.isFolder(t)||(e.addFile(t),s.push(e.providerFileToId(t)))}),(r=e.plugin.getPluginState()).selectedFolders[n]={loading:!1,files:s},e.plugin.setPluginState({selectedFolders:o});var a,l=e.plugin.uppy.getPlugin("Dashboard");a=s.length?l.i18n("folderAdded",{smart_count:s.length,folder:e.plugin.getItemName(t)}):l.i18n("emptyFolderAdded"),e.plugin.uppy.info(a)}).catch(function(t){delete(r=e.plugin.getPluginState()).selectedFolders[n],e.plugin.setPluginState({selectedFolders:r.selectedFolders}),e.handleError(t)})},t.prototype.toggleCheckbox=function(t,e){t.stopPropagation(),t.preventDefault();var n=this.plugin.getPluginState(),r=n.folders,o=n.files,i=this.filterItems(r.concat(o));if(this.lastCheckbox&&t.shiftKey){var s,a=i.indexOf(this.lastCheckbox),l=i.indexOf(e);return s=a<l?i.slice(a,l+1):i.slice(l,a+1),void this.plugin.setPluginState({currentSelection:s})}this.lastCheckbox=e;var u=this.plugin.getPluginState().currentSelection;this.isChecked(e)?this.plugin.setPluginState({currentSelection:u.filter(function(t){return t!==e})}):this.plugin.setPluginState({currentSelection:u.concat([e])})},t.prototype.providerFileToId=function(t){return W({data:this.plugin.getItemData(t),name:this.plugin.getItemName(t)||this.plugin.getItemId(t),type:this.plugin.getMimeType(t)})},t.prototype.handleDemoAuth=function(){var t=this.plugin.getPluginState();this.plugin.setPluginState({},t,{authenticated:!0})},t.prototype.handleAuth=function(){var t=this,e=btoa(JSON.stringify({origin:location.origin})),n=this.Provider.authUrl()+"?state="+e,r=window.open(n,"_blank");window.addEventListener("message",function e(n){t._isOriginAllowed(n.origin,t.plugin.opts.serverPattern)&&n.source===r?(r.close(),window.removeEventListener("message",e),t.Provider.setAuthToken(n.data.token),t._loaderWrapper(t.Provider.checkAuth(),t.plugin.onAuth,t.handleError)):t.plugin.uppy.log("rejecting event from "+n.origin+" vs allowed pattern "+t.plugin.opts.serverPattern)})},t.prototype._isOriginAllowed=function(t,e){var n=function(t){return"string"==typeof t?new RegExp("^"+t+"$"):t instanceof RegExp?t:void 0};return(Array.isArray(e)?e.map(n):[n(e)]).filter(function(t){return null!==t}).some(function(e){return e.test(t)})},t.prototype.handleError=function(t){var e=this.plugin.uppy,n=e.i18n("companionError");e.log(t.toString()),e.info({message:n,details:t.toString()},"error",5e3)},t.prototype.handleScroll=function(t){var e=this,n=t.target.scrollHeight-(t.target.scrollTop+t.target.offsetHeight),r=this.plugin.getNextPagePath?this.plugin.getNextPagePath():null;n<50&&r&&!this._isHandlingScroll&&(this.Provider.list(r).then(function(t){var n=e.plugin.getPluginState(),r=n.files,o=n.folders;e._updateFilesAndFolders(t,r,o)}).catch(this.handleError).then(function(){e._isHandlingScroll=!1}),this._isHandlingScroll=!0)},t.prototype.donePicking=function(){var t=this,e=this.plugin.getPluginState().currentSelection.map(function(e){return t.plugin.isFolder(e)?t.addFolder(e):t.addFile(e)});this._loaderWrapper(Promise.all(e),function(){t.clearSelection();var e=t.plugin.uppy.getPlugin("Dashboard");e&&e.hideAllPanels()},function(){})},t.prototype.cancelPicking=function(){this.clearSelection();var t=this.plugin.uppy.getPlugin("Dashboard");t&&t.hideAllPanels()},t.prototype.clearSelection=function(){this.plugin.setPluginState({currentSelection:[]})},t.prototype._loaderWrapper=function(t,e,n){var r=this;t.then(function(t){r.plugin.setPluginState({loading:!1}),e(t)}).catch(function(t){r.plugin.setPluginState({loading:!1}),n(t)}),this.plugin.setPluginState({loading:!0})},t.prototype.render=function(t){var e=this.plugin.getPluginState(),n=e.authenticated,r=e.checkAuthInProgress;if(e.loading)return Jn($n,{onUnmount:this.clearSelection},Jn(On,null));if(!n)return Jn($n,{onUnmount:this.clearSelection},Jn(In,{pluginName:this.plugin.title,pluginIcon:this.plugin.icon,demo:this.plugin.opts.demo,checkAuth:this.checkAuth,handleAuth:this.handleAuth,handleDemoAuth:this.handleDemoAuth,checkAuthInProgress:r}));var o=Kn({},this.plugin.getPluginState(),{username:this.username,getNextFolder:this.getNextFolder,getFolder:this.getFolder,filterItems:this.filterItems,filterQuery:this.filterQuery,toggleSearch:this.toggleSearch,sortByTitle:this.sortByTitle,sortByDate:this.sortByDate,logout:this.logout,demo:this.plugin.opts.demo,isActiveRow:this.isActiveRow,isChecked:this.isChecked,toggleCheckbox:this.toggleCheckbox,getItemId:this.plugin.getItemId,getItemName:this.plugin.getItemName,getItemIcon:this.plugin.getItemIcon,handleScroll:this.handleScroll,done:this.donePicking,cancel:this.cancelPicking,title:this.plugin.title,viewType:this.opts.viewType,showTitles:this.opts.showTitles,showFilter:this.opts.showFilter,showBreadcrumbs:this.opts.showBreadcrumbs,pluginIcon:this.plugin.icon,i18n:this.plugin.uppy.i18n});return Jn($n,{onUnmount:this.clearSelection},Jn(Gn,o))},t}(),Zn=Y.Plugin,tr=d.Provider,er=A.h,nr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"Dropbox",tr.initPlugin(o,r),o.title=o.opts.title||"Dropbox",o.icon=function(){return er("svg",{"aria-hidden":"true",fill:"#0060ff",width:"128",height:"118",viewBox:"0 0 128 118"},er("path",{d:"M38.145.777L1.108 24.96l25.608 20.507 37.344-23.06z"}),er("path",{d:"M1.108 65.975l37.037 24.183L64.06 68.525l-37.343-23.06zM64.06 68.525l25.917 21.633 37.036-24.183-25.61-20.51z"}),er("path",{d:"M127.014 24.96L89.977.776 64.06 22.407l37.345 23.06zM64.136 73.18l-25.99 21.567-11.122-7.262v8.142l37.112 22.256 37.114-22.256v-8.142l-11.12 7.262z"}))},o[o.id]=new tr(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders,provider:"dropbox"}),o.onAuth=o.onAuth.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.install=function(){this.view=new Qn(this),this.setPluginState({authenticated:!1,files:[],folders:[],directories:[],activeRow:-1,filterInput:"",isSearchVisible:!1});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.view.tearDown(),this.unmount()},e.prototype.onAuth=function(t){this.setPluginState({authenticated:t}),t&&this.view.getFolder()},e.prototype.getUsername=function(t){return t.user_email},e.prototype.isFolder=function(t){return"folder"===t[".tag"]},e.prototype.getItemData=function(t){return t},e.prototype.getItemIcon=function(t){return t[".tag"]},e.prototype.getItemSubList=function(t){return t.entries},e.prototype.getItemName=function(t){return t.name||""},e.prototype.getMimeType=function(t){return null},e.prototype.getItemId=function(t){return t.id},e.prototype.getItemRequestPath=function(t){return encodeURIComponent(t.path_lower)},e.prototype.getItemModifiedDate=function(t){return t.server_modified},e.prototype.getItemThumbnailUrl=function(t){return this.opts.serverUrl+"/"+this.Dropbox.id+"/thumbnail/"+this.getItemRequestPath(t)},e.prototype.render=function(t){return this.view.render(t)},e}(Zn),rr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},or=Y.Plugin,ir=A.h,sr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"FileInput",o.title="File Input",o.type="acquirer";var i={strings:{chooseFiles:"Choose files"}},s={target:null,pretty:!0,inputName:"files[]",locale:i};return o.opts=rr({},s,r),o.locale=rr({},i,o.opts.locale),o.locale.strings=rr({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.render=o.render.bind(o),o.handleInputChange=o.handleInputChange.bind(o),o.handleClick=o.handleClick.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleInputChange=function(t){var e=this;this.uppy.log("[FileInput] Something selected through input..."),gn(t.target.files).forEach(function(t){try{e.uppy.addFile({source:e.id,name:t.name,type:t.type,data:t})}catch(t){}})},e.prototype.handleClick=function(t){this.input.click()},e.prototype.render=function(t){var e=this,n=this.uppy.opts.restrictions;return ir("div",{class:"uppy-Root uppy-FileInput-container"},ir("input",{class:"uppy-FileInput-input",style:this.opts.pretty&&{width:"0.1px",height:"0.1px",opacity:0,overflow:"hidden",position:"absolute",zIndex:-1},type:"file",name:this.opts.inputName,onchange:this.handleInputChange,multiple:1!==n.maxNumberOfFiles,accept:n.allowedFileTypes,ref:function(t){e.input=t},value:""}),this.opts.pretty&&ir("button",{class:"uppy-FileInput-btn",type:"button",onclick:this.handleClick},this.i18n("chooseFiles")))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.unmount()},e}(or),ar={__esModule:!0};ar.default=fr,ar.getFieldData=yr;var lr={"[object HTMLCollection]":!0,"[object NodeList]":!0,"[object RadioNodeList]":!0},ur={button:!0,fieldset:!0,reset:!0,submit:!0},pr={checkbox:!0,radio:!0},cr=/^\s+|\s+$/g,hr=Array.prototype.slice,dr=Object.prototype.toString;function fr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{trim:!1};if(!t)throw new Error("A form is required by getFormData, was given form="+t);for(var n={},r=void 0,o=[],i={},s=0,a=t.elements.length;s<a;s++){var l=t.elements[s];ur[l.type]||l.disabled||(r=l.name||l.id)&&!i[r]&&(o.push(r),i[r]=!0)}for(var u=0,p=o.length;u<p;u++){var c=yr(t,r=o[u],e);null!=c&&(n[r]=c)}return n}function yr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{trim:!1};if(!t)throw new Error("A form is required by getFieldData, was given form="+t);if(!e&&"[object String]"!==dr.call(e))throw new Error("A field name is required by getFieldData, was given fieldName="+e);var r=t.elements[e];if(!r||r.disabled)return null;if(!lr[dr.call(r)])return gr(r,n.trim);for(var o=[],i=!0,s=0,a=r.length;s<a;s++)if(!r[s].disabled){i&&"radio"!==r[s].type&&(i=!1);var l=gr(r[s],n.trim);null!=l&&(o=o.concat(l))}return i&&1===o.length?o[0]:o.length>0?o:null}function gr(t,e){var n=null,r=t.type;if("select-one"===r)return t.options.length&&(n=t.options[t.selectedIndex].value),n;if("select-multiple"===r){n=[];for(var o=0,i=t.options.length;o<i;o++)t.options[o].selected&&n.push(t.options[o].value);return 0===n.length&&(n=null),n}return"file"===r&&"files"in t?(t.multiple?0===(n=hr.call(t.files)).length&&(n=null):n=t.files[0],n):(pr[r]?t.checked&&(n=t.value):n=e?t.value.replace(cr,""):t.value,n)}fr.getFieldData=yr;var mr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},vr=Y.Plugin,br=ar.default||ar,wr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="acquirer",o.id="Form",o.title="Form",o.opts=mr({},{target:null,resultName:"uppyResult",getMetaFromForm:!0,addResultToForm:!0,submitOnSuccess:!1,triggerUploadOnSubmit:!1},r),o.handleFormSubmit=o.handleFormSubmit.bind(o),o.handleUploadStart=o.handleUploadStart.bind(o),o.handleSuccess=o.handleSuccess.bind(o),o.addResultToForm=o.addResultToForm.bind(o),o.getMetaFromForm=o.getMetaFromForm.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleUploadStart=function(){this.opts.getMetaFromForm&&this.getMetaFromForm()},e.prototype.handleSuccess=function(t){this.opts.addResultToForm&&this.addResultToForm(t),this.opts.submitOnSuccess&&this.form.submit()},e.prototype.handleFormSubmit=function(t){var e=this;this.opts.triggerUploadOnSubmit&&(t.preventDefault(),this.uppy.upload().catch(function(t){e.uppy.log(t.stack||t.message||t)}))},e.prototype.addResultToForm=function(t){this.uppy.log("[Form] Adding result to the original form:"),this.uppy.log(t);var e=this.form.querySelector('[name="'+this.opts.resultName+'"]');e?e.value=JSON.stringify(t):((e=document.createElement("input")).name=this.opts.resultName,e.type="hidden",e.value=JSON.stringify(t),this.form.appendChild(e))},e.prototype.getMetaFromForm=function(){var t=br(this.form);this.uppy.setMeta(t)},e.prototype.install=function(){this.form=I(this.opts.target),this.form&&"FORM"!==!this.form.nodeName?(this.form.addEventListener("submit",this.handleFormSubmit),this.uppy.on("upload",this.handleUploadStart),this.uppy.on("complete",this.handleSuccess)):console.error("Form plugin requires a <form> target element passed in options to operate, none was found","error")},e.prototype.uninstall=function(){this.form.removeEventListener("submit",this.handleFormSubmit),this.uppy.off("upload",this.handleUploadStart),this.uppy.off("complete",this.handleSuccess)},e}(vr),Sr={},_r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pr="undefined"!=typeof window&&(window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.OIndexedDB||window.msIndexedDB),Er=!!Pr,kr="uppy-blobs",Cr="files",Tr=864e5,Or=3;function Ur(t){var e=Pr.open(t,Or);return new Promise(function(t,n){e.onupgradeneeded=function(e){var n=e.target.result,r=e.currentTarget.transaction;if(e.oldVersion<2&&n.createObjectStore(Cr,{keyPath:"id"}).createIndex("store","store",{unique:!1}),e.oldVersion<3){var o=r.objectStore(Cr);o.createIndex("expires","expires",{unique:!1}),o.openCursor().onsuccess=function(t){var e=t.target.result;if(e){var n=e.value;n.expires=Date.now()+Tr,e.update(n)}}}r.oncomplete=function(){t(n)}},e.onsuccess=function(e){t(e.target.result)},e.onerror=n})}function Fr(t){return new Promise(function(e,n){t.onsuccess=function(t){e(t.target.result)},t.onerror=n})}var Ar=!1,xr=function(){function t(e){var n=this;!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.opts=_r({dbName:kr,storeName:"default",expires:Tr,maxFileSize:10485760,maxTotalSize:314572800},e),this.name=this.opts.storeName;var r=function(){return Ur(n.opts.dbName)};Ar?this.ready=r():(Ar=!0,this.ready=t.cleanup().then(r,r))}return t.prototype.key=function(t){return this.name+"!"+t},t.prototype.list=function(){var t=this;return this.ready.then(function(e){return Fr(e.transaction([Cr],"readonly").objectStore(Cr).index("store").getAll(IDBKeyRange.only(t.name)))}).then(function(t){var e={};return t.forEach(function(t){e[t.fileID]=t.data}),e})},t.prototype.get=function(t){var e=this;return this.ready.then(function(n){return Fr(n.transaction([Cr],"readonly").objectStore(Cr).get(e.key(t)))}).then(function(t){return{id:t.data.fileID,data:t.data.data}})},t.prototype.getSize=function(){var t=this;return this.ready.then(function(e){var n=e.transaction([Cr],"readonly").objectStore(Cr).index("store").openCursor(IDBKeyRange.only(t.name));return new Promise(function(t,e){var r=0;n.onsuccess=function(e){var n=e.target.result;n?(r+=n.value.data.size,n.continue()):t(r)},n.onerror=function(){e(new Error("Could not retrieve stored blobs size"))}})})},t.prototype.put=function(t){var e=this;return t.data.size>this.opts.maxFileSize?Promise.reject(new Error("File is too big to store.")):this.getSize().then(function(t){return t>e.opts.maxTotalSize?Promise.reject(new Error("No space left")):e.ready}).then(function(n){return Fr(n.transaction([Cr],"readwrite").objectStore(Cr).add({id:e.key(t.id),fileID:t.id,store:e.name,expires:Date.now()+e.opts.expires,data:t.data}))})},t.prototype.delete=function(t){var e=this;return this.ready.then(function(n){return Fr(n.transaction([Cr],"readwrite").objectStore(Cr).delete(e.key(t)))})},t.cleanup=function(){return Ur(kr).then(function(t){var e=t.transaction([Cr],"readwrite").objectStore(Cr).index("expires").openCursor(IDBKeyRange.upperBound(Date.now()));return new Promise(function(n,r){e.onsuccess=function(e){var r=e.target.result;if(r){var o=r.value;console.log("[IndexedDBStore] Deleting record",o.fileID,"of size",F(o.data.size),"- expired on",new Date(o.expires)),r.delete(),r.continue()}else n(t)},e.onerror=r})}).then(function(t){t.close()})},t}();xr.isSupported=Er,Sr=xr;var Dr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Rr(t){try{return JSON.parse(t)}catch(t){return null}}var Ir=!1,Br=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.opts=Dr({expires:864e5},e),this.name="uppyState:"+e.storeName,Ir||(Ir=!0,t.cleanup())}return t.prototype.load=function(){var t=localStorage.getItem(this.name);if(!t)return null;var e=Rr(t);return e?e.metadata?e.metadata:(this.save(e),e):null},t.prototype.save=function(t){var e=Date.now()+this.opts.expires,n=JSON.stringify({metadata:t,expires:e});localStorage.setItem(this.name,n)},t.cleanup=function(){var t=function(){for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);/^uppyState:/.test(n)&&t.push(n.slice("uppyState:".length))}return t}(),e=Date.now();t.forEach(function(t){var n=localStorage.getItem("uppyState:"+t);if(!n)return null;var r=Rr(n);if(!r)return null;r.expires&&r.expires<e&&localStorage.removeItem("uppyState:"+t)})},t}(),jr={},Lr="undefined"!=typeof navigator&&"serviceWorker"in navigator,Mr=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.ready=new Promise(function(t,e){Lr?navigator.serviceWorker.controller?t():navigator.serviceWorker.addEventListener("controllerchange",function(){t()}):e(new Error("Unsupported"))}),this.name=e.storeName}return t.prototype.list=function(){var t=this,e={},n=new Promise(function(t,n){e.resolve=t,e.reject=n});console.log("Loading stored blobs from Service Worker");var r=function n(r){if(r.data.store===t.name)switch(r.data.type){case"uppy/ALL_FILES":e.resolve(r.data.files),navigator.serviceWorker.removeEventListener("message",n)}};return this.ready.then(function(){navigator.serviceWorker.addEventListener("message",r),navigator.serviceWorker.controller.postMessage({type:"uppy/GET_FILES",store:t.name})}),n},t.prototype.put=function(t){var e=this;return this.ready.then(function(){navigator.serviceWorker.controller.postMessage({type:"uppy/ADD_FILE",store:e.name,file:t})})},t.prototype.delete=function(t){var e=this;return this.ready.then(function(){navigator.serviceWorker.controller.postMessage({type:"uppy/REMOVE_FILE",store:e.name,fileID:t})})},t}();Mr.isSupported=Lr,jr=Mr;var Nr,zr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},qr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="debugger",o.id="GoldenRetriever",o.title="Golden Retriever",o.opts=zr({},{expires:864e5,serviceWorker:!1},r),o.MetaDataStore=new Br({expires:o.opts.expires,storeName:n.getID()}),o.ServiceWorkerStore=null,o.opts.serviceWorker&&(o.ServiceWorkerStore=new jr({storeName:n.getID()})),o.IndexedDBStore=new Sr(zr({expires:o.opts.expires},r.indexedDB||{},{storeName:n.getID()})),o.saveFilesStateToLocalStorage=o.saveFilesStateToLocalStorage.bind(o),o.loadFilesStateFromLocalStorage=o.loadFilesStateFromLocalStorage.bind(o),o.loadFileBlobsFromServiceWorker=o.loadFileBlobsFromServiceWorker.bind(o),o.loadFileBlobsFromIndexedDB=o.loadFileBlobsFromIndexedDB.bind(o),o.onBlobsLoaded=o.onBlobsLoaded.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.loadFilesStateFromLocalStorage=function(){var t=this.MetaDataStore.load();t&&(this.uppy.log("[GoldenRetriever] Recovered some state from Local Storage"),this.uppy.setState({currentUploads:t.currentUploads||{},files:t.files||{}}),this.savedPluginData=t.pluginData)},e.prototype.getWaitingFiles=function(){var t={};return this.uppy.getFiles().forEach(function(e){e.progress&&e.progress.uploadStarted||(t[e.id]=e)}),t},e.prototype.getUploadingFiles=function(){var t=this,e={},n=this.uppy.getState().currentUploads;return n&&Object.keys(n).forEach(function(r){n[r].fileIDs.forEach(function(n){e[n]=t.uppy.getFile(n)})}),e},e.prototype.saveFilesStateToLocalStorage=function(){var t=zr(this.getWaitingFiles(),this.getUploadingFiles()),e={};this.uppy.emit("restore:get-data",function(t){zr(e,t)});var n=this.uppy.getState().currentUploads;this.MetaDataStore.save({currentUploads:n,files:t,pluginData:e})},e.prototype.loadFileBlobsFromServiceWorker=function(){var t=this;this.ServiceWorkerStore.list().then(function(e){var n=Object.keys(e).length;return n===t.uppy.getFiles().length?(t.uppy.log("[GoldenRetriever] Successfully recovered "+n+" blobs from Service Worker!"),t.uppy.info("Successfully recovered "+n+" files","success",3e3),t.onBlobsLoaded(e)):(t.uppy.log("[GoldenRetriever] No blobs found in Service Worker, trying IndexedDB now..."),t.loadFileBlobsFromIndexedDB())}).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to recover blobs from Service Worker","warning"),t.uppy.log(e)})},e.prototype.loadFileBlobsFromIndexedDB=function(){var t=this;this.IndexedDBStore.list().then(function(e){var n=Object.keys(e).length;if(n>0)return t.uppy.log("[GoldenRetriever] Successfully recovered "+n+" blobs from IndexedDB!"),t.uppy.info("Successfully recovered "+n+" files","success",3e3),t.onBlobsLoaded(e);t.uppy.log("[GoldenRetriever] No blobs found in IndexedDB")}).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to recover blobs from IndexedDB","warning"),t.uppy.log(e)})},e.prototype.onBlobsLoaded=function(t){var e=this,n=[],r=zr({},this.uppy.getState().files);Object.keys(t).forEach(function(o){var i=e.uppy.getFile(o);if(i){var s=t[o],a=zr({},i,{data:s,isRestored:!0});r[o]=a}else n.push(o)}),this.uppy.setState({files:r}),this.uppy.emit("restored",this.savedPluginData),n.length&&this.deleteBlobs(n).then(function(){e.uppy.log("[GoldenRetriever] Cleaned up "+n.length+" old files")}).catch(function(t){e.uppy.log("[GoldenRetriever] Could not clean up "+n.length+" old files","warning"),e.uppy.log(t)})},e.prototype.deleteBlobs=function(t){var e=this,n=[];return t.forEach(function(t){e.ServiceWorkerStore&&n.push(e.ServiceWorkerStore.delete(t)),e.IndexedDBStore&&n.push(e.IndexedDBStore.delete(t))}),Promise.all(n)},e.prototype.install=function(){var t=this;this.loadFilesStateFromLocalStorage(),this.uppy.getFiles().length>0?this.ServiceWorkerStore?(this.uppy.log("[GoldenRetriever] Attempting to load files from Service Worker..."),this.loadFileBlobsFromServiceWorker()):(this.uppy.log("[GoldenRetriever] Attempting to load files from Indexed DB..."),this.loadFileBlobsFromIndexedDB()):(this.uppy.log("[GoldenRetriever] No files need to be loaded, only restoring processing state..."),this.onBlobsLoaded([])),this.uppy.on("file-added",function(e){e.isRemote||(t.ServiceWorkerStore&&t.ServiceWorkerStore.put(e).catch(function(e){t.uppy.log("[GoldenRetriever] Could not store file","warning"),t.uppy.log(e)}),t.IndexedDBStore.put(e).catch(function(e){t.uppy.log("[GoldenRetriever] Could not store file","warning"),t.uppy.log(e)}))}),this.uppy.on("file-removed",function(e){t.ServiceWorkerStore&&t.ServiceWorkerStore.delete(e.id).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to remove file","warning"),t.uppy.log(e)}),t.IndexedDBStore.delete(e.id).catch(function(e){t.uppy.log("[GoldenRetriever] Failed to remove file","warning"),t.uppy.log(e)})}),this.uppy.on("complete",function(e){var n=e.successful,r=n.map(function(t){return t.id});t.deleteBlobs(r).then(function(){t.uppy.log("[GoldenRetriever] Removed "+n.length+" files that finished uploading")}).catch(function(e){t.uppy.log("[GoldenRetriever] Could not remove "+n.length+" files that finished uploading","warning"),t.uppy.log(e)})}),this.uppy.on("state-update",this.saveFilesStateToLocalStorage),this.uppy.on("restored",function(){var e=t.uppy.getState().currentUploads;e&&Object.keys(e).forEach(function(n){t.uppy.restore(n,e[n])})})},e}(Y.Plugin),Hr=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toggleCheckbox=function(e,n){e.stopPropagation(),e.preventDefault(),"drive#teamDrive"!==n.kind&&t.prototype.toggleCheckbox.call(this,e,n)},e}(Qn),Wr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Xr=Y.Plugin,Vr=d.Provider,Gr=A.h,Kr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"GoogleDrive",o.title=o.opts.title||"Google Drive",Vr.initPlugin(o,r),o.title=o.opts.title||"Google Drive",o.icon=function(){return Gr("svg",{"aria-hidden":"true",width:"18px",height:"16px",viewBox:"0 0 18 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},Gr("g",{"fill-rule":"evenodd"},Gr("polygon",{fill:"#3089FC",points:"6.32475 10.2 18 10.2 14.999625 15.3 3.324375 15.3"}),Gr("polygon",{fill:"#00A85D",points:"3.000375 15.3 0 10.2 5.83875 0.275974026 8.838 5.37597403 5.999625 10.2"}),Gr("polygon",{fill:"#FFD024",points:"11.838375 9.92402597 5.999625 0 12.000375 0 17.839125 9.92402597"})))},o[o.id]=new Vr(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders,provider:"drive",authProvider:"google"}),o.onAuth=o.onAuth.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.install=function(){this.view=new Hr(this),this.setPluginState({authenticated:!1,files:[],folders:[],directories:[],activeRow:-1,filterInput:"",isSearchVisible:!1,hasTeamDrives:!1,teamDrives:[],teamDriveId:""});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.view.tearDown(),this.unmount()},e.prototype.onAuth=function(t){this.setPluginState({authenticated:t}),t&&(this.view.getFolder("root"),this.getTeamDrives())},e.prototype.getTeamDrives=function(){var t=this;this[this.id].get(this.GoogleDrive.id+"/list/?listTeamDrives=true").then(function(e){e.teamDrives&&e.teamDrives.length&&t.setPluginState({hasTeamDrives:!0,teamDrives:e.teamDrives})})},e.prototype.getUsername=function(t){var e=t.files,n=Array.isArray(e),r=0;for(e=n?e:e[Symbol.iterator]();;){var o;if(n){if(r>=e.length)break;o=e[r++]}else{if((r=e.next()).done)break;o=r.value}var i=o;if(i.ownedByMe){var s=i.permissions,a=Array.isArray(s),l=0;for(s=a?s:s[Symbol.iterator]();;){var u;if(a){if(l>=s.length)break;u=s[l++]}else{if((l=s.next()).done)break;u=l.value}var p=u;if("owner"===p.role)return p.emailAddress}}}},e.prototype.isFolder=function(t){return"application/vnd.google-apps.folder"===t.mimeType},e.prototype.getItemData=function(t){return Wr({},t,{size:parseFloat(t.size)})},e.prototype.getItemIcon=function(t){return t.iconLink},e.prototype.getItemSubList=function(t){var e=this;return t.files.filter(function(t){return e.isFolder(t)||!t.mimeType.startsWith("application/vnd.google")})},e.prototype.getItemName=function(t){return t.name?t.name:"/"},e.prototype.getMimeType=function(t){return t.mimeType},e.prototype.getItemId=function(t){return t.id},e.prototype.getItemRequestPath=function(t){return t.teamDriveId&&(t.id+="?teamDriveId="+t.teamDriveId,delete t.teamDriveId),this.getItemId(t)},e.prototype.getItemModifiedDate=function(t){return t.modifiedTime},e.prototype.getItemThumbnailUrl=function(t){return this.opts.serverUrl+"/"+this.GoogleDrive.id+"/thumbnail/"+this.getItemRequestPath(t)},e.prototype.render=function(t){var e=this.getPluginState();if(e.hasTeamDrives){var n=e.folders;n=n.filter(function(t){return"drive#teamDrive"!==t.kind}),1===e.directories.length&&e.teamDrives.forEach(function(t){n.splice(0,0,{id:"?teamDriveId="+t.id,name:t.name,kind:t.kind,iconLink:t.backgroundImageLink+"=w16-h16-n"})}),e.folders=n}return this.view.render(t)},e}(Xr),Yr=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Jr=Y.Plugin,$r=d.Provider,Qr=A.h,Zr=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"Instagram",$r.initPlugin(o,r),o.title=o.opts.title||"Instagram",o.icon=function(){return Qr("svg",{"aria-hidden":"true",fill:"#DE3573",width:"28",height:"28",viewBox:"0 0 512 512"},Qr("path",{d:"M256,49.471c67.266,0,75.233.257,101.8,1.469,24.562,1.121,37.9,5.224,46.778,8.674a78.052,78.052,0,0,1,28.966,18.845,78.052,78.052,0,0,1,18.845,28.966c3.45,8.877,7.554,22.216,8.674,46.778,1.212,26.565,1.469,34.532,1.469,101.8s-0.257,75.233-1.469,101.8c-1.121,24.562-5.225,37.9-8.674,46.778a83.427,83.427,0,0,1-47.811,47.811c-8.877,3.45-22.216,7.554-46.778,8.674-26.56,1.212-34.527,1.469-101.8,1.469s-75.237-.257-101.8-1.469c-24.562-1.121-37.9-5.225-46.778-8.674a78.051,78.051,0,0,1-28.966-18.845,78.053,78.053,0,0,1-18.845-28.966c-3.45-8.877-7.554-22.216-8.674-46.778-1.212-26.564-1.469-34.532-1.469-101.8s0.257-75.233,1.469-101.8c1.121-24.562,5.224-37.9,8.674-46.778A78.052,78.052,0,0,1,78.458,78.458a78.053,78.053,0,0,1,28.966-18.845c8.877-3.45,22.216-7.554,46.778-8.674,26.565-1.212,34.532-1.469,101.8-1.469m0-45.391c-68.418,0-77,.29-103.866,1.516-26.815,1.224-45.127,5.482-61.151,11.71a123.488,123.488,0,0,0-44.62,29.057A123.488,123.488,0,0,0,17.3,90.982C11.077,107.007,6.819,125.319,5.6,152.134,4.369,179,4.079,187.582,4.079,256S4.369,333,5.6,359.866c1.224,26.815,5.482,45.127,11.71,61.151a123.489,123.489,0,0,0,29.057,44.62,123.486,123.486,0,0,0,44.62,29.057c16.025,6.228,34.337,10.486,61.151,11.71,26.87,1.226,35.449,1.516,103.866,1.516s77-.29,103.866-1.516c26.815-1.224,45.127-5.482,61.151-11.71a128.817,128.817,0,0,0,73.677-73.677c6.228-16.025,10.486-34.337,11.71-61.151,1.226-26.87,1.516-35.449,1.516-103.866s-0.29-77-1.516-103.866c-1.224-26.815-5.482-45.127-11.71-61.151a123.486,123.486,0,0,0-29.057-44.62A123.487,123.487,0,0,0,421.018,17.3C404.993,11.077,386.681,6.819,359.866,5.6,333,4.369,324.418,4.079,256,4.079h0Z"}),Qr("path",{d:"M256,126.635A129.365,129.365,0,1,0,385.365,256,129.365,129.365,0,0,0,256,126.635Zm0,213.338A83.973,83.973,0,1,1,339.974,256,83.974,83.974,0,0,1,256,339.973Z"}),Qr("circle",{cx:"390.476",cy:"121.524",r:"30.23"}))},o[o.id]=new $r(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders,provider:"instagram",authProvider:"instagram"}),o.onAuth=o.onAuth.bind(o),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.install=function(){this.view=new Qn(this,{viewType:"grid",showTitles:!1,showFilter:!1,showBreadcrumbs:!1}),this.setPluginState({authenticated:!1,files:[],folders:[],directories:[],activeRow:-1,filterInput:"",isSearchVisible:!1});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.view.tearDown(),this.unmount()},e.prototype.onAuth=function(t){this.setPluginState({authenticated:t}),t&&this.view.getFolder("recent")},e.prototype.getUsername=function(t){return t.data[0].user.username},e.prototype.isFolder=function(t){return!1},e.prototype.getItemData=function(t){return t},e.prototype.getItemIcon=function(t){return t.images?t.images.low_resolution.url:"video"},e.prototype.getItemSubList=function(t){var e=[];return t.data.forEach(function(t){t.carousel_media?t.carousel_media.forEach(function(n,r){var o=t.id,i=t.created_time,s=Yr({},n,{id:o,created_time:i});s.carousel_id=r,e.push(s)}):e.push(t)}),e},e.prototype.getItemName=function(t){if(t&&t.created_time){var e="video"===t.type?"mp4":"jpeg",n=new Date(1e3*t.created_time);return"Instagram "+(n=n.toLocaleDateString([],{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}))+(t.carousel_id?" "+t.carousel_id:"")+"."+e}return""},e.prototype.getMimeType=function(t){return"video"===t.type?"video/mp4":"image/jpeg"},e.prototype.getItemId=function(t){return""+t.id+(t.carousel_id||"")},e.prototype.getItemRequestPath=function(t){var e=isNaN(t.carousel_id)?"":"?carousel_id="+t.carousel_id;return""+t.id+e},e.prototype.getItemModifiedDate=function(t){return t.created_time},e.prototype.getItemThumbnailUrl=function(t){return t.images.thumbnail.url},e.prototype.getNextPagePath=function(){var t=this.getPluginState().files;return"recent?max_id="+this.getItemId(t[t.length-1])},e.prototype.render=function(t){return this.view.render(t)},e}(Jr),to=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},eo=Y.Plugin,no=A.h,ro=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.id=o.opts.id||"ProgressBar",o.title="Progress Bar",o.type="progressindicator",o.opts=to({},{target:"body",replaceTargetContent:!1,fixed:!1,hideAfterFinish:!0},r),o.render=o.render.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.render=function(t){var e=t.totalProgress||0,n=100===e&&this.opts.hideAfterFinish;return no("div",{class:"uppy uppy-ProgressBar",style:{position:this.opts.fixed?"fixed":"initial"},"aria-hidden":n},no("div",{class:"uppy-ProgressBar-inner",style:{width:e+"%"}}),no("div",{class:"uppy-ProgressBar-percentage"},e))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.unmount()},e}(eo),oo=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},io=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="debugger",o.id="ReduxDevTools",o.title="Redux DevTools",o.opts=oo({},{},r),o.handleStateChange=o.handleStateChange.bind(o),o.initDevTools=o.initDevTools.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleStateChange=function(t,e,n){this.devTools.send("UPPY_STATE_UPDATE",e)},e.prototype.initDevTools=function(){var t=this;this.devTools=window.devToolsExtension.connect(),this.devToolsUnsubscribe=this.devTools.subscribe(function(e){if("DISPATCH"===e.type)switch(console.log(e.payload.type),e.payload.type){case"RESET":return void t.uppy.reset();case"IMPORT_STATE":var n=e.payload.nextLiftedState.computedStates;return t.uppy.store.state=oo({},t.uppy.getState(),n[n.length-1].state),void t.uppy.updateAll(t.uppy.getState());case"JUMP_TO_STATE":case"JUMP_TO_ACTION":t.uppy.store.state=oo({},t.uppy.getState(),JSON.parse(e.state)),t.uppy.updateAll(t.uppy.getState())}})},e.prototype.install=function(){this.withDevTools="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,this.withDevTools&&(this.initDevTools(),this.uppy.on("state-update",this.handleStateChange))},e.prototype.uninstall=function(){this.withDevTools&&(this.devToolsUnsubscribe(),this.uppy.off("state-update",this.handleStateUpdate))},e}(Y.Plugin),so=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ao=function(t){return function(e){return e.uppy[t]}},lo=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this._store=e.store,this._id=e.id||b(),this._selector=e.selector||ao(this._id),this.setState({})}return t.prototype.setState=function(t){this._store.dispatch({type:"uppy/STATE_UPDATE",id:this._id,payload:t})},t.prototype.getState=function(){return this._selector(this._store.getState())},t.prototype.subscribe=function(t){var e=this,n=this.getState();return this._store.subscribe(function(){var r=e.getState();if(n!==r){var o=function(t,e){var n=Object.keys(e),r={};return n.forEach(function(n){t[n]!==e[n]&&(r[n]=e[n])}),r}(n,r);t(n,r,o),n=r}})},t}();(Nr=function(t){return new lo(t)}).STATE_UPDATE="uppy/STATE_UPDATE",Nr.reducer=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];if("uppy/STATE_UPDATE"===e.type){var n,r=so({},t[e.id],e.payload);return so({},t,((n={})[e.id]=r,n))}return t},Nr.middleware=function(){return function(){return function(t){return function(e){t(e)}}}};var uo={exports:{}};function po(t){if(t)return function(t){for(var e in po.prototype)t[e]=po.prototype[e];return t}(t)}uo.exports=po,po.prototype.on=po.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},po.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},po.prototype.off=po.prototype.removeListener=po.prototype.removeAllListeners=po.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return this},po.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var r=0,o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e);return this},po.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},po.prototype.hasListeners=function(t){return!!this.listeners(t).length},uo=uo.exports;var co={};function ho(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}co=ho,ho.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},ho.prototype.reset=function(){this.attempts=0},ho.prototype.setMin=function(t){this.ms=t},ho.prototype.setMax=function(t){this.max=t},ho.prototype.setJitter=function(t){this.jitter=t};for(var fo=[].slice,yo=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=fo.call(arguments,2);return function(){return e.apply(t,n.concat(fo.call(arguments)))}},go=[].indexOf,mo=function(t,e){if(go)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1},vo=function(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}},bo={toByteArray:function(t){var e,n,r,o,i,s,a=t.length;i=Co(t),s=new _o(3*a/4-i),r=i>0?a-4:a;var l=0;for(e=0,n=0;e<r;e+=4,n+=3)o=So[t.charCodeAt(e)]<<18|So[t.charCodeAt(e+1)]<<12|So[t.charCodeAt(e+2)]<<6|So[t.charCodeAt(e+3)],s[l++]=o>>16&255,s[l++]=o>>8&255,s[l++]=255&o;return 2===i?(o=So[t.charCodeAt(e)]<<2|So[t.charCodeAt(e+1)]>>4,s[l++]=255&o):1===i&&(o=So[t.charCodeAt(e)]<<10|So[t.charCodeAt(e+1)]<<4|So[t.charCodeAt(e+2)]>>2,s[l++]=o>>8&255,s[l++]=255&o),s},fromByteArray:function(t){for(var e,n=t.length,r=n%3,o="",i=[],s=0,a=n-r;s<a;s+=16383)i.push(To(t,s,s+16383>a?a:s+16383));return 1===r?(e=t[n-1],o+=wo[e>>2],o+=wo[e<<4&63],o+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],o+=wo[e>>10],o+=wo[e>>4&63],o+=wo[e<<2&63],o+="="),i.push(o),i.join("")}},wo=[],So=[],_o="undefined"!=typeof Uint8Array?Uint8Array:Array,Po="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Eo=0,ko=Po.length;Eo<ko;++Eo)wo[Eo]=Po[Eo],So[Po.charCodeAt(Eo)]=Eo;function Co(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function To(t,e,n){for(var r,o,i=[],s=e;s<n;s+=3)r=(t[s]<<16)+(t[s+1]<<8)+t[s+2],i.push(wo[(o=r)>>18&63]+wo[o>>12&63]+wo[o>>6&63]+wo[63&o]);return i.join("")}So["-".charCodeAt(0)]=62,So["_".charCodeAt(0)]=63;var Oo={read:function(t,e,n,r,o){var i,s,a=8*o-r-1,l=(1<<a)-1,u=l>>1,p=-7,c=n?o-1:0,h=n?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-p)-1,d>>=-p,p+=a;p>0;i=256*i+t[e+c],c+=h,p-=8);for(s=i&(1<<-p)-1,i>>=-p,p+=r;p>0;s=256*s+t[e+c],c+=h,p-=8);if(0===i)i=1-u;else{if(i===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)},write:function(t,e,n,r,o,i){var s,a,l,u=8*i-o-1,p=(1<<u)-1,c=p>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,f=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=p):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?h/l:h*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=p?(a=0,s=p):s+c>=1?(a=(e*l-1)*Math.pow(2,o),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[n+d]=255&a,d+=f,a/=256,o-=8);for(s=s<<o|a,u+=o;u>0;t[n+d]=255&s,d+=f,s/=256,u-=8);t[n+d-f]|=128*y}},Uo={};Uo.Buffer=xo,Uo.INSPECT_MAX_BYTES=50;var Fo=2147483647;function Ao(t){if(t>Fo)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=xo.prototype,e}function xo(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Io(t)}return Do(t,e,n)}function Do(t,e,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return pi(t)||t&&pi(t.buffer)?function(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return(r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n)).__proto__=xo.prototype,r}(t,e,n):"string"==typeof t?function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!xo.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|Lo(t,e),r=Ao(n),o=r.write(t,e);return o!==n&&(r=r.slice(0,o)),r}(t,e):function(t){if(xo.isBuffer(t)){var e=0|jo(t.length),n=Ao(e);return 0===n.length?n:(t.copy(n,0,0,e),n)}if(t){if(ArrayBuffer.isView(t)||"length"in t)return"number"!=typeof t.length||ci(t.length)?Ao(0):Bo(t);if("Buffer"===t.type&&Array.isArray(t.data))return Bo(t.data)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.")}(t)}function Ro(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Io(t){return Ro(t),Ao(t<0?0:0|jo(t))}function Bo(t){for(var e=t.length<0?0:0|jo(t.length),n=Ao(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function jo(t){if(t>=Fo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Fo.toString(16)+" bytes");return 0|t}function Lo(t,e){if(xo.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||pi(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return ai(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return li(t).length;default:if(r)return ai(t).length;e=(""+e).toLowerCase(),r=!0}}function Mo(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function No(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),ci(n=+n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=xo.from(e,r)),xo.isBuffer(e))return 0===e.length?-1:zo(t,e,n,r,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):zo(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function zo(t,e,n,r,o){var i,s=1,a=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var p=-1;for(i=n;i<a;i++)if(u(t,i)===u(e,-1===p?0:i-p)){if(-1===p&&(p=i),i-p+1===l)return p*s}else-1!==p&&(i-=i-p),p=-1}else for(n+l>a&&(n=a-l),i=n;i>=0;i--){for(var c=!0,h=0;h<l;h++)if(u(t,i+h)!==u(e,h)){c=!1;break}if(c)return i}return-1}function qo(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;r>i/2&&(r=i/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(ci(a))return s;t[n+s]=a}return s}function Ho(t,e,n,r){return ui(ai(e,t.length-n),t,n,r)}function Wo(t,e,n,r){return ui(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function Xo(t,e,n,r){return Wo(t,e,n,r)}function Vo(t,e,n,r){return ui(li(e),t,n,r)}function Go(t,e,n,r){return ui(function(t,e){for(var n,r,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function Ko(t,e,n){return 0===e&&n===t.length?bo.fromByteArray(t):bo.fromByteArray(t.slice(e,n))}function Yo(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,s,a,l,u=t[o],p=null,c=u>239?4:u>223?3:u>191?2:1;if(o+c<=n)switch(c){case 1:u<128&&(p=u);break;case 2:128==(192&(i=t[o+1]))&&(l=(31&u)<<6|63&i)>127&&(p=l);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(p=l);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(p=l)}null===p?(p=65533,c=1):p>65535&&(p-=65536,r.push(p>>>10&1023|55296),p=56320|1023&p),r.push(p),o+=c}return function(t){var e=t.length;if(e<=Jo)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Jo));return n}(r)}xo.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),xo.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(xo.prototype,"parent",{get:function(){if(this instanceof xo)return this.buffer}}),Object.defineProperty(xo.prototype,"offset",{get:function(){if(this instanceof xo)return this.byteOffset}}),"undefined"!=typeof Symbol&&Symbol.species&&xo[Symbol.species]===xo&&Object.defineProperty(xo,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),xo.poolSize=8192,xo.from=function(t,e,n){return Do(t,e,n)},xo.prototype.__proto__=Uint8Array.prototype,xo.__proto__=Uint8Array,xo.alloc=function(t,e,n){return function(t,e,n){return Ro(t),t<=0?Ao(t):void 0!==e?"string"==typeof n?Ao(t).fill(e,n):Ao(t).fill(e):Ao(t)}(t,e,n)},xo.allocUnsafe=function(t){return Io(t)},xo.allocUnsafeSlow=function(t){return Io(t)},xo.isBuffer=function(t){return null!=t&&!0===t._isBuffer},xo.compare=function(t,e){if(!xo.isBuffer(t)||!xo.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},xo.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},xo.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return xo.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=xo.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var i=t[n];if(ArrayBuffer.isView(i)&&(i=xo.from(i)),!xo.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o),o+=i.length}return r},xo.byteLength=Lo,xo.prototype._isBuffer=!0,xo.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Mo(this,e,e+1);return this},xo.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Mo(this,e,e+3),Mo(this,e+1,e+2);return this},xo.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Mo(this,e,e+7),Mo(this,e+1,e+6),Mo(this,e+2,e+5),Mo(this,e+3,e+4);return this},xo.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?Yo(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Zo(this,e,n);case"utf8":case"utf-8":return Yo(this,e,n);case"ascii":return $o(this,e,n);case"latin1":case"binary":return Qo(this,e,n);case"base64":return Ko(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ti(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},xo.prototype.toLocaleString=xo.prototype.toString,xo.prototype.equals=function(t){if(!xo.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===xo.compare(this,t)},xo.prototype.inspect=function(){var t="",e=Uo.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},xo.prototype.compare=function(t,e,n,r,o){if(!xo.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(i,s),l=this.slice(r,o),u=t.slice(e,n),p=0;p<a;++p)if(l[p]!==u[p]){i=l[p],s=u[p];break}return i<s?-1:s<i?1:0},xo.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},xo.prototype.indexOf=function(t,e,n){return No(this,t,e,n,!0)},xo.prototype.lastIndexOf=function(t,e,n){return No(this,t,e,n,!1)},xo.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return qo(this,t,e,n);case"utf8":case"utf-8":return Ho(this,t,e,n);case"ascii":return Wo(this,t,e,n);case"latin1":case"binary":return Xo(this,t,e,n);case"base64":return Vo(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Go(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},xo.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Jo=4096;function $o(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function Qo(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function Zo(t,e,n){var r,o=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>o)&&(n=o);for(var i="",s=e;s<n;++s)i+=(r=t[s])<16?"0"+r.toString(16):r.toString(16);return i}function ti(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function ei(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function ni(t,e,n,r,o,i){if(!xo.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function ri(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function oi(t,e,n,r,o){return e=+e,n>>>=0,o||ri(t,0,n,4),Oo.write(t,e,n,r,23,4),n+4}function ii(t,e,n,r,o){return e=+e,n>>>=0,o||ri(t,0,n,8),Oo.write(t,e,n,r,52,8),n+8}xo.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return r.__proto__=xo.prototype,r},xo.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},xo.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},xo.prototype.readUInt8=function(t,e){return t>>>=0,e||ei(t,1,this.length),this[t]},xo.prototype.readUInt16LE=function(t,e){return t>>>=0,e||ei(t,2,this.length),this[t]|this[t+1]<<8},xo.prototype.readUInt16BE=function(t,e){return t>>>=0,e||ei(t,2,this.length),this[t]<<8|this[t+1]},xo.prototype.readUInt32LE=function(t,e){return t>>>=0,e||ei(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},xo.prototype.readUInt32BE=function(t,e){return t>>>=0,e||ei(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},xo.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},xo.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||ei(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},xo.prototype.readInt8=function(t,e){return t>>>=0,e||ei(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},xo.prototype.readInt16LE=function(t,e){t>>>=0,e||ei(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},xo.prototype.readInt16BE=function(t,e){t>>>=0,e||ei(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},xo.prototype.readInt32LE=function(t,e){return t>>>=0,e||ei(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},xo.prototype.readInt32BE=function(t,e){return t>>>=0,e||ei(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},xo.prototype.readFloatLE=function(t,e){return t>>>=0,e||ei(t,4,this.length),Oo.read(this,t,!0,23,4)},xo.prototype.readFloatBE=function(t,e){return t>>>=0,e||ei(t,4,this.length),Oo.read(this,t,!1,23,4)},xo.prototype.readDoubleLE=function(t,e){return t>>>=0,e||ei(t,8,this.length),Oo.read(this,t,!0,52,8)},xo.prototype.readDoubleBE=function(t,e){return t>>>=0,e||ei(t,8,this.length),Oo.read(this,t,!1,52,8)},xo.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||ni(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},xo.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||ni(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},xo.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,1,255,0),this[e]=255&t,e+1},xo.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},xo.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},xo.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},xo.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},xo.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);ni(this,t,e,n,o-1,-o)}var i=0,s=1,a=0;for(this[e]=255&t;++i<n&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},xo.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var o=Math.pow(2,8*n-1);ni(this,t,e,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+n},xo.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},xo.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},xo.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},xo.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},xo.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||ni(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},xo.prototype.writeFloatLE=function(t,e,n){return oi(this,t,e,!0,n)},xo.prototype.writeFloatBE=function(t,e,n){return oi(this,t,e,!1,n)},xo.prototype.writeDoubleLE=function(t,e,n){return ii(this,t,e,!0,n)},xo.prototype.writeDoubleBE=function(t,e,n){return ii(this,t,e,!1,n)},xo.prototype.copy=function(t,e,n,r){if(!xo.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o=r-n;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,n,r);else if(this===t&&n<e&&e<r)for(var i=o-1;i>=0;--i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,r),e);return o},xo.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!xo.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var o=t.charCodeAt(0);("utf8"===r&&o<128||"latin1"===r)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var s=xo.isBuffer(t)?t:new xo(t,r),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=s[i%a]}return this};var si=/[^+\/0-9A-Za-z-_]/g;function ai(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function li(t){return bo.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(si,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ui(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function pi(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function ci(t){return t!=t}var hi={}.toString,di=Array.isArray||function(t){return"[object Array]"==hi.call(t)},fi={};(function(t){var e=Object.prototype.toString,n="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===e.call(Blob),r="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===e.call(File);fi=function e(o){if(!o||"object"!=typeof o)return!1;if(di(o)){for(var i=0,s=o.length;i<s;i++)if(e(o[i]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(o)||"function"==typeof ArrayBuffer&&o instanceof ArrayBuffer||n&&o instanceof Blob||r&&o instanceof File)return!0;if(o.toJSON&&"function"==typeof o.toJSON&&1===arguments.length)return e(o.toJSON(),!0);for(var a in o)if(Object.prototype.hasOwnProperty.call(o,a)&&e(o[a]))return!0;return!1}}).call(this,Uo.Buffer);var yi={encode:function(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e},decode:function(t){for(var e={},n=t.split("&"),r=0,o=n.length;r<o;r++){var i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},gi=1e3,mi=6e4,vi=864e5;function bi(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var wi={};function Si(t){var e;function n(){if(n.enabled){var t=n,r=+new Date,o=r-(e||r);t.diff=o,t.prev=e,t.curr=r,e=r;for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];i[0]=wi.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var a=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(e,n){if("%%"===e)return e;a++;var r=wi.formatters[n];if("function"==typeof r){var o=i[a];e=r.call(t,o),i.splice(a,1),a--}return e}),wi.formatArgs.call(t,i),(n.log||wi.log||console.log.bind(console)).apply(t,i)}}return n.namespace=t,n.enabled=wi.enabled(t),n.useColors=wi.useColors(),n.color=function(t){var e,n=0;for(e in t)n=(n<<5)-n+t.charCodeAt(e),n|=0;return wi.colors[Math.abs(n)%wi.colors.length]}(t),n.destroy=_i,"function"==typeof wi.init&&wi.init(n),wi.instances.push(n),n}function _i(){var t=wi.instances.indexOf(this);return-1!==t&&(wi.instances.splice(t,1),!0)}(wi=wi=Si.debug=Si.default=Si).coerce=function(t){return t instanceof Error?t.stack||t.message:t},wi.disable=function(){wi.enable("")},wi.enable=function(t){var e;wi.save(t),wi.names=[],wi.skips=[];var n=("string"==typeof t?t:"").split(/[\s,]+/),r=n.length;for(e=0;e<r;e++)n[e]&&("-"===(t=n[e].replace(/\*/g,".*?"))[0]?wi.skips.push(new RegExp("^"+t.substr(1)+"$")):wi.names.push(new RegExp("^"+t+"$")));for(e=0;e<wi.instances.length;e++){var o=wi.instances[e];o.enabled=wi.enabled(o.namespace)}},wi.enabled=function(t){if("*"===t[t.length-1])return!0;var e,n;for(e=0,n=wi.skips.length;e<n;e++)if(wi.skips[e].test(t))return!1;for(e=0,n=wi.names.length;e<n;e++)if(wi.names[e].test(t))return!0;return!1},wi.humanize=function(t,e){e=e||{};var n,r=typeof t;if("string"===r&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"days":case"day":case"d":return n*vi;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return n*mi;case"seconds":case"second":case"secs":case"sec":case"s":return n*gi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===r&&!1===isNaN(t))return e.long?bi(n=t,vi,"day")||bi(n,36e5,"hour")||bi(n,mi,"minute")||bi(n,gi,"second")||n+" ms":function(t){return t>=vi?Math.round(t/vi)+"d":t>=36e5?Math.round(t/36e5)+"h":t>=mi?Math.round(t/mi)+"m":t>=gi?Math.round(t/gi)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))},wi.instances=[],wi.names=[],wi.skips=[],wi.formatters={};var Pi={};(function(t){function e(){var e;try{e=Pi.storage.debug}catch(t){}return!e&&void 0!==t&&"env"in t&&(e=t.env.DEBUG),e}(Pi=Pi=wi).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},Pi.formatArgs=function(t){var e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+Pi.humanize(this.diff),e){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(r++,"%c"===t&&(o=r))}),t.splice(o,0,n)}},Pi.save=function(t){try{null==t?Pi.storage.removeItem("debug"):Pi.storage.debug=t}catch(t){}},Pi.load=e,Pi.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},Pi.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),Pi.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],Pi.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},Pi.enable(e())}).call(this,_t);var Ei={};(function(t){Ei=function(o){return e&&t.Buffer.isBuffer(o)||n&&(o instanceof t.ArrayBuffer||r(o))};var e="function"==typeof t.Buffer&&"function"==typeof t.Buffer.isBuffer,n="function"==typeof t.ArrayBuffer,r=n&&"function"==typeof t.ArrayBuffer.isView?t.ArrayBuffer.isView:function(e){return e.buffer instanceof t.ArrayBuffer}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ki={};(function(t){var e=Object.prototype.toString,n="function"==typeof t.Blob||"[object BlobConstructor]"===e.call(t.Blob),r="function"==typeof t.File||"[object FileConstructor]"===e.call(t.File);ki.deconstructPacket=function(t){var e=[],n=t.data,r=t;return r.data=function t(e,n){if(!e)return e;if(Ei(e)){var r={_placeholder:!0,num:n.length};return n.push(e),r}if(di(e)){for(var o=new Array(e.length),i=0;i<e.length;i++)o[i]=t(e[i],n);return o}if("object"==typeof e&&!(e instanceof Date)){o={};for(var s in e)o[s]=t(e[s],n);return o}return e}(n,e),r.attachments=e.length,{packet:r,buffers:e}},ki.reconstructPacket=function(t,e){return t.data=function t(e,n){if(!e)return e;if(e&&e._placeholder)return n[e.num];if(di(e))for(var r=0;r<e.length;r++)e[r]=t(e[r],n);else if("object"==typeof e)for(var o in e)e[o]=t(e[o],n);return e}(t.data,e),t.attachments=void 0,t},ki.removeBlobs=function(t,e){var o=0,i=t;!function t(s,a,l){if(!s)return s;if(n&&s instanceof Blob||r&&s instanceof File){o++;var u=new FileReader;u.onload=function(){l?l[a]=this.result:i=this.result,--o||e(i)},u.readAsArrayBuffer(s)}else if(di(s))for(var p=0;p<s.length;p++)t(s[p],p,s);else if("object"==typeof s&&!Ei(s))for(var c in s)t(s[c],c,s)}(i),o||e(i)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ci={},Ti=Pi("socket.io-parser");function Oi(){}Ci.protocol=4,Ci.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],Ci.CONNECT=0,Ci.DISCONNECT=1,Ci.EVENT=2,Ci.ACK=3,Ci.ERROR=4,Ci.BINARY_EVENT=5,Ci.BINARY_ACK=6,Ci.Encoder=Oi,Ci.Decoder=Ai;var Ui=Ci.ERROR+'"encode error"';function Fi(t){var e=""+t.type;if(Ci.BINARY_EVENT!==t.type&&Ci.BINARY_ACK!==t.type||(e+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(e+=t.nsp+","),null!=t.id&&(e+=t.id),null!=t.data){var n=function(t){try{return JSON.stringify(t)}catch(t){return!1}}(t.data);if(!1===n)return Ui;e+=n}return Ti("encoded %j as %s",t,e),e}function Ai(){this.reconstructor=null}function xi(t){this.reconPack=t,this.buffers=[]}function Di(t){return{type:Ci.ERROR,data:"parser error: "+t}}Oi.prototype.encode=function(t,e){Ti("encoding packet %j",t),Ci.BINARY_EVENT===t.type||Ci.BINARY_ACK===t.type?function(t,e){ki.removeBlobs(t,function(t){var n=ki.deconstructPacket(t),r=Fi(n.packet),o=n.buffers;o.unshift(r),e(o)})}(t,e):e([Fi(t)])},uo(Ai.prototype),Ai.prototype.add=function(t){var e;if("string"==typeof t)e=function(t){var e=0,n={type:Number(t.charAt(0))};if(null==Ci.types[n.type])return Di("unknown packet type "+n.type);if(Ci.BINARY_EVENT===n.type||Ci.BINARY_ACK===n.type){for(var r="";"-"!==t.charAt(++e)&&(r+=t.charAt(e),e!=t.length););if(r!=Number(r)||"-"!==t.charAt(e))throw new Error("Illegal attachments");n.attachments=Number(r)}if("/"===t.charAt(e+1))for(n.nsp="";++e;){if(","===(i=t.charAt(e)))break;if(n.nsp+=i,e===t.length)break}else n.nsp="/";var o=t.charAt(e+1);if(""!==o&&Number(o)==o){for(n.id="";++e;){var i;if(null==(i=t.charAt(e))||Number(i)!=i){--e;break}if(n.id+=t.charAt(e),e===t.length)break}n.id=Number(n.id)}if(t.charAt(++e)){var s=function(t){try{return JSON.parse(t)}catch(t){return!1}}(t.substr(e));if(!(!1!==s&&(n.type===Ci.ERROR||di(s))))return Di("invalid payload");n.data=s}return Ti("decoded %s as %j",t,n),n}(t),Ci.BINARY_EVENT===e.type||Ci.BINARY_ACK===e.type?(this.reconstructor=new xi(e),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",e)):this.emit("decoded",e);else{if(!Ei(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(e=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",e))}},Ai.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},xi.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=ki.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},xi.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};var Ri=function(t,e){for(var n=[],r=(e=e||0)||0;r<t.length;r++)n[r-e]=t[r];return n},Ii={},Bi=Pi("socket.io-client:socket");Ii=Ii=Mi;var ji={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},Li=uo.prototype.emit;function Mi(t,e,n){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}function Ni(){}uo(Mi.prototype),Mi.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[vo(t,"open",yo(this,"onopen")),vo(t,"packet",yo(this,"onpacket")),vo(t,"close",yo(this,"onclose"))]}},Mi.prototype.open=Mi.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},Mi.prototype.send=function(){var t=Ri(arguments);return t.unshift("message"),this.emit.apply(this,t),this},Mi.prototype.emit=function(t){if(ji.hasOwnProperty(t))return Li.apply(this,arguments),this;var e=Ri(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:fi(e))?Ci.BINARY_EVENT:Ci.EVENT,data:e,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(Bi("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},Mi.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},Mi.prototype.onopen=function(){if(Bi("transport is open - connecting"),"/"!==this.nsp)if(this.query){var t="object"==typeof this.query?yi.encode(this.query):this.query;Bi("sending connect packet with query %s",t),this.packet({type:Ci.CONNECT,query:t})}else this.packet({type:Ci.CONNECT})},Mi.prototype.onclose=function(t){Bi("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},Mi.prototype.onpacket=function(t){var e=t.nsp===this.nsp,n=t.type===Ci.ERROR&&"/"===t.nsp;if(e||n)switch(t.type){case Ci.CONNECT:this.onconnect();break;case Ci.EVENT:case Ci.BINARY_EVENT:this.onevent(t);break;case Ci.ACK:case Ci.BINARY_ACK:this.onack(t);break;case Ci.DISCONNECT:this.ondisconnect();break;case Ci.ERROR:this.emit("error",t.data)}},Mi.prototype.onevent=function(t){var e=t.data||[];Bi("emitting event %j",e),null!=t.id&&(Bi("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?Li.apply(this,e):this.receiveBuffer.push(e)},Mi.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=Ri(arguments);Bi("sending ack %j",r),e.packet({type:fi(r)?Ci.BINARY_ACK:Ci.ACK,id:t,data:r})}}},Mi.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(Bi("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):Bi("bad ack %s",t.id)},Mi.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},Mi.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)Li.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},Mi.prototype.ondisconnect=function(){Bi("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},Mi.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},Mi.prototype.close=Mi.prototype.disconnect=function(){return this.connected&&(Bi("performing disconnect (%s)",this.nsp),this.packet({type:Ci.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},Mi.prototype.compress=function(t){return this.flags.compress=t,this},Mi.prototype.binary=function(t){return this.flags.binary=t,this};var zi=function(t,e,n){var r=!1;return n=n||Ni,o.count=t,0===t?e():o;function o(t,i){if(o.count<=0)throw new Error("after called too many times");--o.count,t?(r=!0,e(t),e=n):0!==o.count||r||e(null,i)}},qi=function(t,e,n){var r=t.byteLength;if(e=e||0,n=n||r,t.slice)return t.slice(e,n);if(e<0&&(e+=r),n<0&&(n+=r),n>r&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s<n;s++,a++)i[a]=o[s];return i.buffer},Hi={};!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Uint8Array(256),n=0;n<t.length;n++)e[t.charCodeAt(n)]=n;Hi.encode=function(e){var n,r=new Uint8Array(e),o=r.length,i="";for(n=0;n<o;n+=3)i+=t[r[n]>>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3==2?i=i.substring(0,i.length-1)+"=":o%3==1&&(i=i.substring(0,i.length-2)+"=="),i},Hi.decode=function(t){var n,r,o,i,s,a=.75*t.length,l=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),c=new Uint8Array(p);for(n=0;n<l;n+=4)r=e[t.charCodeAt(n)],o=e[t.charCodeAt(n+1)],i=e[t.charCodeAt(n+2)],s=e[t.charCodeAt(n+3)],c[u++]=r<<2|o>>4,c[u++]=(15&o)<<4|i>>2,c[u++]=(3&i)<<6|63&s;return p}}();var Wi={};(function(t){var e=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,n=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),r=n&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),o=e&&e.prototype.append&&e.prototype.getBlob;function i(t){for(var e=0;e<t.length;e++){var n=t[e];if(n.buffer instanceof ArrayBuffer){var r=n.buffer;if(n.byteLength!==r.byteLength){var o=new Uint8Array(n.byteLength);o.set(new Uint8Array(r,n.byteOffset,n.byteLength)),r=o.buffer}t[e]=r}}}Wi=n?r?t.Blob:function(t,e){return i(t),new Blob(t,e||{})}:o?function(t,n){n=n||{};var r=new e;i(t);for(var o=0;o<t.length;o++)r.append(t[o]);return n.type?r.getBlob(n.type):r.getBlob()}:void 0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Xi=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e},Vi={exports:{}};(function(t){!function(e){var n="object"==typeof Vi.exports&&Vi.exports,r=Vi&&Vi.exports==n&&Vi,o="object"==typeof t&&t;o.global!==o&&o.window!==o||(e=o);var i,s,a,l=String.fromCharCode;function u(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function p(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(t,e){return l(t>>e&63|128)}function h(t,e){if(0==(4294967168&t))return l(t);var n="";return 0==(4294965248&t)?n=l(t>>6&31|192):0==(4294901760&t)?(p(t,e)||(t=65533),n=l(t>>12&15|224),n+=c(t,6)):0==(4292870144&t)&&(n=l(t>>18&7|240),n+=c(t,12),n+=c(t,6)),n+l(63&t|128)}function d(){if(a>=s)throw Error("Invalid byte index");var t=255&i[a];if(a++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function f(t){var e,n;if(a>s)throw Error("Invalid byte index");if(a==s)return!1;if(e=255&i[a],a++,0==(128&e))return e;if(192==(224&e)){if((n=(31&e)<<6|d())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&e)){if((n=(15&e)<<12|d()<<6|d())>=2048)return p(n,t)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=(7&e)<<18|d()<<12|d()<<6|d())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}var y={version:"2.1.2",encode:function(t,e){for(var n=!1!==(e=e||{}).strict,r=u(t),o=r.length,i=-1,s="";++i<o;)s+=h(r[i],n);return s},decode:function(t,e){var n=!1!==(e=e||{}).strict;i=u(t),s=i.length,a=0;for(var r,o=[];!1!==(r=f(n));)o.push(r);return function(t){for(var e,n=t.length,r=-1,o="";++r<n;)(e=t[r])>65535&&(o+=l((e-=65536)>>>10&1023|55296),e=56320|1023&e),o+=l(e);return o}(o)}};if(n&&!n.nodeType)if(r)r.exports=y;else{var g={}.hasOwnProperty;for(var m in y)g.call(y,m)&&(n[m]=y[m])}else e.utf8=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),Vi=Vi.exports;var Gi={};(function(t){var e;t&&t.ArrayBuffer&&(e=Hi);var n="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),r="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),o=n||r;Gi.protocol=3;var i=Gi.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},s=Xi(i),a={type:"error",data:"parser error"};function l(t,e,n){for(var r=new Array(t.length),o=zi(t.length,n),i=function(t,n,o){e(n,function(e,n){r[t]=n,o(e,r)})},s=0;s<t.length;s++)i(s,t[s],o)}Gi.encodePacket=function(e,n,r,s){"function"==typeof n&&(s=n,n=!1),"function"==typeof r&&(s=r,r=null);var a=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&a instanceof ArrayBuffer)return function(t,e,n){if(!e)return Gi.encodeBase64Packet(t,n);var r=t.data,o=new Uint8Array(r),s=new Uint8Array(1+r.byteLength);s[0]=i[t.type];for(var a=0;a<o.length;a++)s[a+1]=o[a];return n(s.buffer)}(e,n,s);if(Wi&&a instanceof t.Blob)return function(t,e,n){if(!e)return Gi.encodeBase64Packet(t,n);if(o)return function(t,e,n){if(!e)return Gi.encodeBase64Packet(t,n);var r=new FileReader;return r.onload=function(){t.data=r.result,Gi.encodePacket(t,e,!0,n)},r.readAsArrayBuffer(t.data)}(t,e,n);var r=new Uint8Array(1);return r[0]=i[t.type],n(new Wi([r.buffer,t.data]))}(e,n,s);if(a&&a.base64)return function(t,e){return e("b"+Gi.packets[t.type]+t.data.data)}(e,s);var l=i[e.type];return void 0!==e.data&&(l+=r?Vi.encode(String(e.data),{strict:!1}):String(e.data)),s(""+l)},Gi.encodeBase64Packet=function(e,n){var r,o="b"+Gi.packets[e.type];if(Wi&&e.data instanceof t.Blob){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];n(o+t)},i.readAsDataURL(e.data)}try{r=String.fromCharCode.apply(null,new Uint8Array(e.data))}catch(t){for(var s=new Uint8Array(e.data),a=new Array(s.length),l=0;l<s.length;l++)a[l]=s[l];r=String.fromCharCode.apply(null,a)}return o+=t.btoa(r),n(o)},Gi.decodePacket=function(t,e,n){if(void 0===t)return a;if("string"==typeof t){if("b"===t.charAt(0))return Gi.decodeBase64Packet(t.substr(1),e);if(n&&!1===(t=function(t){try{t=Vi.decode(t,{strict:!1})}catch(t){return!1}return t}(t)))return a;var r=t.charAt(0);return Number(r)==r&&s[r]?t.length>1?{type:s[r],data:t.substring(1)}:{type:s[r]}:a}r=new Uint8Array(t)[0];var o=qi(t,1);return Wi&&"blob"===e&&(o=new Wi([o])),{type:s[r],data:o}},Gi.decodeBase64Packet=function(t,n){var r=s[t.charAt(0)];if(!e)return{type:r,data:{base64:!0,data:t.substr(1)}};var o=e.decode(t.substr(1));return"blob"===n&&Wi&&(o=new Wi([o])),{type:r,data:o}},Gi.encodePayload=function(t,e,n){"function"==typeof e&&(n=e,e=null);var r=fi(t);return e&&r?Wi&&!o?Gi.encodePayloadAsBlob(t,n):Gi.encodePayloadAsArrayBuffer(t,n):t.length?void l(t,function(t,n){Gi.encodePacket(t,!!r&&e,!1,function(t){n(null,function(t){return t.length+":"+t}(t))})},function(t,e){return n(e.join(""))}):n("0:")},Gi.decodePayload=function(t,e,n){if("string"!=typeof t)return Gi.decodePayloadAsBinary(t,e,n);var r;if("function"==typeof e&&(n=e,e=null),""===t)return n(a,0,1);for(var o,i,s="",l=0,u=t.length;l<u;l++){var p=t.charAt(l);if(":"===p){if(""===s||s!=(o=Number(s)))return n(a,0,1);if(s!=(i=t.substr(l+1,o)).length)return n(a,0,1);if(i.length){if(r=Gi.decodePacket(i,e,!1),a.type===r.type&&a.data===r.data)return n(a,0,1);if(!1===n(r,l+o,u))return}l+=o,s=""}else s+=p}return""!==s?n(a,0,1):void 0},Gi.encodePayloadAsArrayBuffer=function(t,e){if(!t.length)return e(new ArrayBuffer(0));l(t,function(t,e){Gi.encodePacket(t,!0,!0,function(t){return e(null,t)})},function(t,n){var r=n.reduce(function(t,e){var n;return t+(n="string"==typeof e?e.length:e.byteLength).toString().length+n+2},0),o=new Uint8Array(r),i=0;return n.forEach(function(t){var e="string"==typeof t,n=t;if(e){for(var r=new Uint8Array(t.length),s=0;s<t.length;s++)r[s]=t.charCodeAt(s);n=r.buffer}o[i++]=e?0:1;var a=n.byteLength.toString();for(s=0;s<a.length;s++)o[i++]=parseInt(a[s]);for(o[i++]=255,r=new Uint8Array(n),s=0;s<r.length;s++)o[i++]=r[s]}),e(o.buffer)})},Gi.encodePayloadAsBlob=function(t,e){l(t,function(t,e){Gi.encodePacket(t,!0,!0,function(t){var n=new Uint8Array(1);if(n[0]=1,"string"==typeof t){for(var r=new Uint8Array(t.length),o=0;o<t.length;o++)r[o]=t.charCodeAt(o);t=r.buffer,n[0]=0}var i=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),s=new Uint8Array(i.length+1);for(o=0;o<i.length;o++)s[o]=parseInt(i[o]);if(s[i.length]=255,Wi){var a=new Wi([n.buffer,s.buffer,t]);e(null,a)}})},function(t,n){return e(new Wi(n))})},Gi.decodePayloadAsBinary=function(t,e,n){"function"==typeof e&&(n=e,e=null);for(var r=t,o=[];r.byteLength>0;){for(var i=new Uint8Array(r),s=0===i[0],l="",u=1;255!==i[u];u++){if(l.length>310)return n(a,0,1);l+=i[u]}r=qi(r,2+l.length),l=parseInt(l);var p=qi(r,0,l);if(s)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(t){var c=new Uint8Array(p);for(p="",u=0;u<c.length;u++)p+=String.fromCharCode(c[u])}o.push(p),r=qi(r,l)}var h=o.length;o.forEach(function(t,r){n(Gi.decodePacket(t,e,!0),r,h)})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ki=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Yi=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Ji=function(t){var e=t,n=t.indexOf("["),r=t.indexOf("]");-1!=n&&-1!=r&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));for(var o=Ki.exec(t||""),i={},s=14;s--;)i[Yi[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},$i={};function Qi(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}$i=Qi,uo(Qi.prototype),Qi.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},Qi.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},Qi.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},Qi.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},Qi.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},Qi.prototype.onData=function(t){var e=Gi.decodePacket(t,this.socket.binaryType);this.onPacket(e)},Qi.prototype.onPacket=function(t){this.emit("packet",t)},Qi.prototype.onClose=function(){this.readyState="closed",this.emit("close")};var Zi=function(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t},ts={};try{ts="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(t){ts=!1}var es={};(function(t){es=function(e){var n=e.xdomain,r=e.xscheme,o=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!n||ts))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!r&&o)return new XDomainRequest}catch(t){}if(!n)try{return new(t[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ns,rs={},os="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),is=64,ss={},as=0,ls=0;function us(t){var e="";do{e=os[t%is]+e,t=Math.floor(t/is)}while(t>0);return e}function ps(){var t=us(+new Date);return t!==ns?(as=0,ns=t):t+"."+us(as++)}for(;ls<is;ls++)ss[os[ls]]=ls;ps.encode=us,ps.decode=function(t){var e=0;for(ls=0;ls<t.length;ls++)e=e*is+ss[t.charAt(ls)];return e},rs=ps;var cs=Pi("engine.io-client:polling"),hs=fs,ds=null!=new es({xdomain:!1}).responseType;function fs(t){var e=t&&t.forceBase64;ds&&!e||(this.supportsBinary=!1),$i.call(this,t)}Zi(fs,$i),fs.prototype.name="polling",fs.prototype.doOpen=function(){this.poll()},fs.prototype.pause=function(t){var e=this;function n(){cs("paused"),e.readyState="paused",t()}if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(cs("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){cs("pre-pause polling complete"),--r||n()})),this.writable||(cs("we are currently writing - waiting to pause"),r++,this.once("drain",function(){cs("pre-pause writing complete"),--r||n()}))}else n()},fs.prototype.poll=function(){cs("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},fs.prototype.onData=function(t){var e=this;cs("polling got data %s",t),Gi.decodePayload(t,this.socket.binaryType,function(t,n,r){if("opening"===e.readyState&&e.onOpen(),"close"===t.type)return e.onClose(),!1;e.onPacket(t)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():cs('ignoring poll - transport state "%s"',this.readyState))},fs.prototype.doClose=function(){var t=this;function e(){cs("writing close packet"),t.write([{type:"close"}])}"open"===this.readyState?(cs("transport open - closing"),e()):(cs("transport not open - deferring close"),this.once("open",e))},fs.prototype.write=function(t){var e=this;this.writable=!1;var n=function(){e.writable=!0,e.emit("drain")};Gi.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,n)})},fs.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(t[this.timestampParam]=rs()),this.supportsBinary||t.sid||(t.b64=1),t=yi.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(n=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t};var ys={};(function(t){ys=i;var e,n=/\n/g,r=/\\n/g;function o(){}function i(n){hs.call(this,n),this.query=this.query||{},e||(t.___eio||(t.___eio=[]),e=t.___eio),this.index=e.length;var r=this;e.push(function(t){r.onData(t)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){r.script&&(r.script.onerror=o)},!1)}Zi(i,hs),i.prototype.supportsBinary=!1,i.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),hs.prototype.doClose.call(this)},i.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},i.prototype.doWrite=function(t,e){var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),l=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=l,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}function u(){p(),e()}function p(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+o.iframeId+'">';i=document.createElement(t)}catch(t){(i=document.createElement("iframe")).name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}this.form.action=this.uri(),p(),t=t.replace(r,"\\\n"),this.area.value=t.replace(n,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&u()}:this.iframe.onload=u}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var gs={};(function(t){var e=Pi("engine.io-client:polling-xhr");function n(){}function r(e){if(hs.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,t.location){var n="https:"===location.protocol,r=location.port;r||(r=n?443:80),this.xd=e.hostname!==t.location.hostname||r!==e.port,this.xs=e.secure!==n}}function o(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function i(){for(var t in o.requests)o.requests.hasOwnProperty(t)&&o.requests[t].abort()}(gs=r).Request=o,Zi(r,hs),r.prototype.supportsBinary=!0,r.prototype.request=function(t){return(t=t||{}).uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new o(t)},r.prototype.doWrite=function(t,e){var n="string"!=typeof t&&void 0!==t,r=this.request({method:"POST",data:t,isBinary:n}),o=this;r.on("success",e),r.on("error",function(t){o.onError("xhr post error",t)}),this.sendXhr=r},r.prototype.doPoll=function(){e("xhr poll");var t=this.request(),n=this;t.on("data",function(t){n.onData(t)}),t.on("error",function(t){n.onError("xhr poll error",t)}),this.pollXhr=t},uo(o.prototype),o.prototype.create=function(){var n={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized;var r=this.xhr=new es(n),i=this;try{e("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var s in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.extraHeaders[s])}catch(t){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=!0),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){i.onLoad()},r.onerror=function(){i.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState)try{var t=r.getResponseHeader("Content-Type");i.supportsBinary&&"application/octet-stream"===t&&(r.responseType="arraybuffer")}catch(t){}4===r.readyState&&(200===r.status||1223===r.status?i.onLoad():setTimeout(function(){i.onError(r.status)},0))},e("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout(function(){i.onError(t)},0)}t.document&&(this.index=o.requestsCount++,o.requests[this.index]=this)},o.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},o.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},o.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},o.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,e)try{this.xhr.abort()}catch(t){}t.document&&delete o.requests[this.index],this.xhr=null}},o.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e&&this.xhr.response||this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},o.prototype.hasXDR=function(){return void 0!==t.XDomainRequest&&!this.xs&&this.enablesXDR},o.prototype.abort=function(){this.cleanup()},o.requestsCount=0,o.requests={},t.document&&(t.attachEvent?t.attachEvent("onunload",i):t.addEventListener&&t.addEventListener("beforeunload",i,!1))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ms={},vs={};(function(t){var e,n=Pi("engine.io-client:websocket"),r=t.WebSocket||t.MozWebSocket;if("undefined"==typeof window)try{e=ms}catch(t){}var o=r;function i(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=r&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(o=e),$i.call(this,t)}o||"undefined"!=typeof window||(o=e),vs=i,Zi(i,$i),i.prototype.name="websocket",i.prototype.supportsBinary=!0,i.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new o(t,e):new o(t):new o(t,e,n)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},i.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},i.prototype.write=function(e){var r=this;this.writable=!1;for(var o=e.length,i=0,s=o;i<s;i++)!function(e){Gi.encodePacket(e,r.supportsBinary,function(i){if(!r.usingBrowserWebSocket){var s={};e.options&&(s.compress=e.options.compress),r.perMessageDeflate&&("string"==typeof i?t.Buffer.byteLength(i):i.length)<r.perMessageDeflate.threshold&&(s.compress=!1)}try{r.usingBrowserWebSocket?r.ws.send(i):r.ws.send(i,s)}catch(t){n("websocket closed before onclose event")}--o||(r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0))})}(e[i])},i.prototype.onClose=function(){$i.prototype.onClose.call(this)},i.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},i.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",n="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=rs()),this.supportsBinary||(t.b64=1),(t=yi.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+t},i.prototype.check=function(){return!(!o||"__initialize"in o&&this.name===i.prototype.name)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var bs={};(function(t){bs.polling=function(e){var n=!1,r=!1,o=!1!==e.jsonp;if(t.location){var i="https:"===location.protocol,s=location.port;s||(s=i?443:80),n=e.hostname!==location.hostname||s!==e.port,r=e.secure!==i}if(e.xdomain=n,e.xscheme=r,"open"in new es(e)&&!e.forceJSONP)return new gs(e);if(!o)throw new Error("JSONP disabled");return new ys(e)},bs.websocket=vs}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ws={};(function(t){var e=Pi("engine.io-client:socket");function n(e,r){if(!(this instanceof n))return new n(e,r);r=r||{},e&&"object"==typeof e&&(r=e,e=null),e?(e=Ji(e),r.hostname=e.host,r.secure="https"===e.protocol||"wss"===e.protocol,r.port=e.port,e.query&&(r.query=e.query)):r.host&&(r.hostname=Ji(r.host).host),this.secure=null!=r.secure?r.secure:t.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(t.location?location.hostname:"localhost"),this.port=r.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=yi.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.transportOptions=r.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized||r.rejectUnauthorized,this.forceNode=!!r.forceNode;var o="object"==typeof t&&t;o.global===o&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}ws=n,n.priorWebsocketSuccess=!1,uo(n.prototype),n.protocol=Gi.protocol,n.Socket=n,n.Transport=$i,n.transports=bs,n.parser=Gi,n.prototype.createTransport=function(t){e('creating transport "%s"',t);var n=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.query);n.EIO=Gi.protocol,n.transport=t;var r=this.transportOptions[t]||{};return this.id&&(n.sid=this.id),new bs[t]({query:n,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0})},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){e("setting transport %s",t.name);var n=this;this.transport&&(e("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){n.onDrain()}).on("packet",function(t){n.onPacket(t)}).on("error",function(t){n.onError(t)}).on("close",function(){n.onClose("transport close")})},n.prototype.probe=function(t){e('probing transport "%s"',t);var r=this.createTransport(t,{probe:1}),o=!1,i=this;function s(){if(i.onlyBinaryUpgrades){var s=!this.supportsBinary&&i.transport.supportsBinary;o=o||s}o||(e('probe transport "%s" opened',t),r.send([{type:"ping",data:"probe"}]),r.once("packet",function(s){if(!o)if("pong"===s.type&&"probe"===s.data){if(e('probe transport "%s" pong',t),i.upgrading=!0,i.emit("upgrading",r),!r)return;n.priorWebsocketSuccess="websocket"===r.name,e('pausing current transport "%s"',i.transport.name),i.transport.pause(function(){o||"closed"!==i.readyState&&(e("changing transport and sending upgrade packet"),h(),i.setTransport(r),r.send([{type:"upgrade"}]),i.emit("upgrade",r),r=null,i.upgrading=!1,i.flush())})}else{e('probe transport "%s" failed',t);var a=new Error("probe error");a.transport=r.name,i.emit("upgradeError",a)}}))}function a(){o||(o=!0,h(),r.close(),r=null)}function l(n){var o=new Error("probe error: "+n);o.transport=r.name,a(),e('probe transport "%s" failed because of error: %s',t,n),i.emit("upgradeError",o)}function u(){l("transport closed")}function p(){l("socket closed")}function c(t){r&&t.name!==r.name&&(e('"%s" works - aborting "%s"',t.name,r.name),a())}function h(){r.removeListener("open",s),r.removeListener("error",l),r.removeListener("close",u),i.removeListener("close",p),i.removeListener("upgrading",c)}n.priorWebsocketSuccess=!1,r.once("open",s),r.once("error",l),r.once("close",u),this.once("close",p),this.once("upgrading",c),r.open()},n.prototype.onOpen=function(){if(e("socket open"),this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){e("starting upgrade probes");for(var t=0,r=this.upgrades.length;t<r;t++)this.probe(this.upgrades[t])}},n.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(e('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var n=new Error("server error");n.code=t.data,this.onError(n);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else e('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!==e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){e("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},n.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},n.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(e("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e,n){return this.sendPacket("message",t,e,n),this},n.prototype.sendPacket=function(t,e,n,r){if("function"==typeof e&&(r=e,e=void 0),"function"==typeof n&&(r=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var o={type:t,data:e,options:n};this.emit("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}},n.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?o():n()}):this.upgrading?o():n()}function n(){t.onClose("forced close"),e("socket closing - telling transport to close"),t.transport.close()}function r(){t.removeListener("upgrade",r),t.removeListener("upgradeError",r),n()}function o(){t.once("upgrade",r),t.once("upgradeError",r)}return this},n.prototype.onError=function(t){e("socket error %j",t),n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,n){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(e('socket close with reason: "%s"',t),clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)},n.prototype.filterUpgrades=function(t){for(var e=[],n=0,r=t.length;n<r;n++)~mo(this.transports,t[n])&&e.push(t[n]);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ss={};(Ss=ws).parser=Gi;var _s={},Ps=Pi("socket.io-client:manager"),Es=Object.prototype.hasOwnProperty;function ks(t,e){if(!(this instanceof ks))return new ks(t,e);t&&"object"==typeof t&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new co({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=e.parser||Ci;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}_s=ks,ks.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)Es.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},ks.prototype.updateSocketIds=function(){for(var t in this.nsps)Es.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},ks.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},uo(ks.prototype),ks.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},ks.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},ks.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},ks.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},ks.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},ks.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},ks.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},ks.prototype.open=ks.prototype.connect=function(t,e){if(Ps("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Ps("opening %s",this.uri),this.engine=Ss(this.uri,this.opts);var n=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var o=vo(n,"open",function(){r.onopen(),t&&t()}),i=vo(n,"error",function(e){if(Ps("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else r.maybeReconnectOnOpen()});if(!1!==this._timeout){var s=this._timeout;Ps("connect attempt will timeout after %d",s);var a=setTimeout(function(){Ps("connect attempt timed out after %d",s),o.destroy(),n.close(),n.emit("error","timeout"),r.emitAll("connect_timeout",s)},s);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(o),this.subs.push(i),this},ks.prototype.onopen=function(){Ps("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(vo(t,"data",yo(this,"ondata"))),this.subs.push(vo(t,"ping",yo(this,"onping"))),this.subs.push(vo(t,"pong",yo(this,"onpong"))),this.subs.push(vo(t,"error",yo(this,"onerror"))),this.subs.push(vo(t,"close",yo(this,"onclose"))),this.subs.push(vo(this.decoder,"decoded",yo(this,"ondecoded")))},ks.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},ks.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},ks.prototype.ondata=function(t){this.decoder.add(t)},ks.prototype.ondecoded=function(t){this.emit("packet",t)},ks.prototype.onerror=function(t){Ps("error",t),this.emitAll("error",t)},ks.prototype.socket=function(t,e){var n=this.nsps[t];if(!n){n=new Ii(this,t,e),this.nsps[t]=n;var r=this;n.on("connecting",o),n.on("connect",function(){n.id=r.generateId(t)}),this.autoConnect&&o()}function o(){~mo(r.connecting,n)||r.connecting.push(n)}return n},ks.prototype.destroy=function(t){var e=mo(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},ks.prototype.packet=function(t){Ps("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(n){for(var r=0;r<n.length;r++)e.engine.write(n[r],t.options);e.encoding=!1,e.processPacketQueue()}))},ks.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},ks.prototype.cleanup=function(){Ps("cleanup");for(var t=this.subs.length,e=0;e<t;e++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},ks.prototype.close=ks.prototype.disconnect=function(){Ps("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},ks.prototype.onclose=function(t){Ps("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},ks.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)Ps("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();Ps("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(Ps("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(Ps("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(Ps("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},ks.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};var Cs={};(function(t){var e=Pi("socket.io-client:url");Cs=function(n,r){var o=n;r=r||t.location,null==n&&(n=r.protocol+"//"+r.host),"string"==typeof n&&("/"===n.charAt(0)&&(n="/"===n.charAt(1)?r.protocol+n:r.host+n),/^(https?|wss?):\/\//.test(n)||(e("protocol-less url %s",n),n=void 0!==r?r.protocol+"//"+n:"https://"+n),e("parse %s",n),o=Ji(n)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";var i=-1!==o.host.indexOf(":")?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+i+":"+o.port,o.href=o.protocol+"://"+i+(r&&r.port===o.port?"":":"+o.port),o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Ts={},Os=Pi("socket.io-client"),Us=(Ts=Ts=Fs).managers={};function Fs(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var n,r=Cs(t),o=r.source,i=r.id,s=r.path,a=Us[i]&&s in Us[i].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||a?(Os("ignoring socket cache for %s",o),n=_s(o,e)):(Us[i]||(Os("new io instance for %s",o),Us[i]=_s(o,e)),n=Us[i]),r.query&&!e.query&&(e.query=r.query),n.socket(r.path,e)}Ts.protocol=Ci.protocol,Ts.connect=Fs,Ts.Manager=_s,Ts.Socket=Ii;var As=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},xs=void 0,Ds=["ASSEMBLY_UPLOADING","ASSEMBLY_EXECUTING","ASSEMBLY_COMPLETED"];function Rs(t,e){return Ds.indexOf(t)>=Ds.indexOf(e)}var Is=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this));return r.status=n,r.socket=null,r.pollInterval=null,r.closed=!1,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.connect=function(){this._connectSocket(),this._beginPolling()},e.prototype._onFinished=function(){this.emit("finished"),this.close()},e.prototype._connectSocket=function(){var t=this,e=function(t){var e=/^\w+:\/\//.exec(t),n=0;e&&(n=e[0].length+1);var r=t.indexOf("/",n);return-1===r?{origin:t,pathname:"/"}:{origin:t.slice(0,r),pathname:t.slice(r)}}(this.status.websocket_url),n=(xs||(xs=Ts),xs).connect(e.origin,{transports:["websocket"],path:e.pathname});n.on("connect",function(){n.emit("assembly_connect",{id:t.status.assembly_id}),t.emit("connect")}),n.on("error",function(){n.disconnect(),t.socket=null}),n.on("assembly_finished",function(){t._onFinished()}),n.on("assembly_upload_finished",function(e){t.emit("upload",e),t._fetchStatus({diff:!1})}),n.on("assembly_uploading_finished",function(){t.emit("executing"),t._fetchStatus({diff:!1})}),n.on("assembly_upload_meta_data_extracted",function(){t.emit("metadata"),t._fetchStatus({diff:!1})}),n.on("assembly_result_finished",function(e,n){t.emit("result",e,n),t._fetchStatus({diff:!1})}),n.on("assembly_error",function(e){t._onError(e),t._fetchStatus({diff:!1})}),this.socket=n},e.prototype._onError=function(t){this.emit("error",As(new Error(t.message),t))},e.prototype._beginPolling=function(){var t=this;this.pollInterval=setInterval(function(){t.socket&&t.socket.connected||t._fetchStatus()},2e3)},e.prototype._fetchStatus=function(){var t=this,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).diff,n=void 0===e||e;return fetch(this.status.assembly_ssl_url).then(function(t){return t.json()}).then(function(e){t.closed||(t.emit("status",e),n?t.updateStatus(e):t.status=e)})},e.prototype.update=function(){return this._fetchStatus({diff:!0})},e.prototype.updateStatus=function(t){this._diffStatus(this.status,t),this.status=t},e.prototype._diffStatus=function(t,e){var n=this,r=t.ok,o=e.ok;if(e.error&&!t.error)return this._onError(e);var i=Rs(o,"ASSEMBLY_EXECUTING")&&!Rs(r,"ASSEMBLY_EXECUTING");i&&this.emit("executing"),Object.keys(e.uploads).filter(function(e){return!t.uploads.hasOwnProperty(e)}).map(function(t){return e.uploads[t]}).forEach(function(t){n.emit("upload",t)}),i&&this.emit("metadata"),Object.keys(e.results).forEach(function(r){var o=e.results[r],i=t.results[r];o.filter(function(t){return!i||!i.some(function(e){return e.id===t.id})}).forEach(function(t){n.emit("result",r,t)})}),Rs(o,"ASSEMBLY_COMPLETED")&&!Rs(r,"ASSEMBLY_COMPLETED")&&this.emit("finished")},e.prototype.close=function(){this.closed=!0,this.socket&&(this.socket.disconnect(),this.socket=null),clearInterval(this.pollInterval)},e}(uo);function Bs(t){if(!t)throw new Error("Transloadit: The `params` option is required.");if("string"==typeof t)try{t=JSON.parse(t)}catch(t){throw t.message="Transloadit: The `params` option is a malformed JSON string: "+t.message,t}if(!t.auth||!t.auth.key)throw new Error("Transloadit: The `params.auth.key` option is required. You can find your Transloadit API key at https://transloadit.com/accounts/credentials.")}var js=(Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t})(function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.files=e,this.opts=n}return t.prototype._normalizeAssemblyOptions=function(t,e){if(Array.isArray(e.fields)){var n=e.fields;e.fields={},n.forEach(function(n){e.fields[n]=t.meta[n]})}return e.fields||(e.fields={}),e},t.prototype._getAssemblyOptions=function(t){var e=this,n=this.opts;return Promise.resolve().then(function(){return n.getAssemblyOptions(t,n)}).then(function(n){return e._normalizeAssemblyOptions(t,n)}).then(function(e){return Bs(e.params),{fileIDs:[t.id],options:e}})},t.prototype._dedupe=function(t){var e=Object.create(null);return t.forEach(function(t){var n,r=t.fileIDs,o=t.options,i=JSON.stringify(o);e[i]?(n=e[i].fileIDs).push.apply(n,r):e[i]={options:o,fileIDs:[].concat(r)}}),Object.keys(e).map(function(t){return e[t]})},t.prototype.build=function(){var t=this,e=this.opts;return this.files.length>0?Promise.all(this.files.map(function(e){return t._getAssemblyOptions(e)})).then(function(e){return t._dedupe(e)}):e.alwaysRunAssembly?Promise.resolve(e.getAssemblyOptions(null,e)).then(function(e){return Bs(e.params),[{fileIDs:t.files.map(function(t){return t.id}),options:e}]}):Promise.resolve([])},t}(),{validateParams:Bs}),Ls=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this));return o._uppy=n,o._assemblyIDs=r,o._remaining=r.length,o.promise=new Promise(function(t,e){o._resolve=t,o._reject=e}),o._onAssemblyComplete=o._onAssemblyComplete.bind(o),o._onAssemblyError=o._onAssemblyError.bind(o),o._onImportError=o._onImportError.bind(o),o._addListeners(),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype._watching=function(t){return-1!==this._assemblyIDs.indexOf(t)},e.prototype._onAssemblyComplete=function(t){this._watching(t.assembly_id)&&(this._uppy.log("[Transloadit] AssemblyWatcher: Got Assembly finish "+t.assembly_id),this.emit("assembly-complete",t.assembly_id),this._checkAllComplete())},e.prototype._onAssemblyError=function(t,e){this._watching(t.assembly_id)&&(this._uppy.log("[Transloadit] AssemblyWatcher: Got Assembly error "+t.assembly_id),this._uppy.log(e),this.emit("assembly-error",t.assembly_id,e),this._checkAllComplete())},e.prototype._onImportError=function(t,e,n){this._watching(t.assembly_id)&&this._onAssemblyError(t,n)},e.prototype._checkAllComplete=function(){this._remaining-=1,0===this._remaining&&(this._removeListeners(),this._resolve())},e.prototype._removeListeners=function(){this._uppy.off("transloadit:complete",this._onAssemblyComplete),this._uppy.off("transloadit:assembly-error",this._onAssemblyError),this._uppy.off("transloadit:import-error",this._onImportError)},e.prototype._addListeners=function(){this._uppy.on("transloadit:complete",this._onAssemblyComplete),this._uppy.on("transloadit:assembly-error",this._onAssemblyError),this._uppy.on("transloadit:import-error",this._onImportError)},e}(uo),Ms=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.opts=e}return t.prototype.createAssembly=function(t){t.templateId;var e=t.params,n=t.fields,r=t.signature,o=t.expectedFiles,i=new FormData;return i.append("params","string"==typeof e?e:JSON.stringify(e)),r&&i.append("signature",r),Object.keys(n).forEach(function(t){i.append(t,n[t])}),i.append("num_expected_upload_files",o),fetch(this.opts.service+"/assemblies",{method:"post",body:i}).then(function(t){return t.json()}).then(function(t){if(t.error){var e=new Error(t.error);throw e.message=t.error,e.details=t.reason,e}return t})},t.prototype.reserveFile=function(t,e){var n=encodeURIComponent(e.size);return fetch(t.assembly_ssl_url+"/reserve_file?size="+n,{method:"post"}).then(function(t){return t.json()})},t.prototype.addFile=function(t,e){if(!e.uploadURL)return Promise.reject(new Error("File does not have an `uploadURL`."));var n=encodeURIComponent(e.size),r=encodeURIComponent(e.uploadURL),o="size="+n+"&filename="+encodeURIComponent(e.name)+"&fieldname=file&s3Url="+r;return fetch(t.assembly_ssl_url+"/add_file?"+o,{method:"post"}).then(function(t){return t.json()})},t.prototype.getAssemblyStatus=function(t){return fetch(t).then(function(t){return t.json()})},t}(),Ns={};Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.setItem=function(t,e){if(zs)return localStorage.setItem(t,e)},Ns.getItem=function(t){if(zs)return localStorage.getItem(t)},Ns.removeItem=function(t){if(zs)return localStorage.removeItem(t)};var zs=!1;try{zs="localStorage"in window;var qs="tusSupport";localStorage.setItem(qs,localStorage.getItem(qs))}catch(t){if(t.code!==t.SECURITY_ERR&&t.code!==t.QUOTA_EXCEEDED_ERR)throw t;zs=!1}Ns.canStoreURLs=zs;var Hs=Object.prototype.hasOwnProperty,Ws=Object.prototype.toString,Xs=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Ws.call(t)},Vs=function(t){if(!t||"[object Object]"!==Ws.call(t))return!1;var e,n=Hs.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Hs.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;for(e in t);return void 0===e||Hs.call(t,e)},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0}),Gs.encode=function(t){return Ks(unescape(encodeURIComponent(t)))};var Ks=window.btoa;Gs.isSupported="btoa"in window;var Ys={};Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.newRequest=function(){return new window.XMLHttpRequest},Ys.resolveUrl=function(t,e){return(0,$s.default)(t,e)};var Js,$s=(Js=ht)&&Js.__esModule?Js:{default:Js},Qs={},Zs=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.getSource=function(t){if("function"==typeof t.slice&&void 0!==t.size)return new ta(t);throw new Error("source object may only be an instance of File or Blob in this environment")};var ta=function(){function t(e){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this._file=e,this.size=e.size}return Zs(t,[{key:"slice",value:function(t,e){return this._file.slice(t,e)}},{key:"close",value:function(){}}]),t}(),ea={};Object.defineProperty(ea,"__esModule",{value:!0});var na=function(t){function e(t){var n=arguments.length<=1||void 0===arguments[1]?null:arguments[1],r=arguments.length<=2||void 0===arguments[2]?null:arguments[2];!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,Object.getPrototypeOf(e).call(this,t.message));o.originalRequest=r,o.causingError=n;var i=t.message;return null!=n&&(i+=", caused by "+n.toString()),null!=r&&(i+=", originated from request (response code: "+r.status+", response text: "+r.responseText+")"),o.message=i,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,Error),e}();ea.default=na;var ra={};Object.defineProperty(ra,"__esModule",{value:!0}),ra.default=function(t,e){return["tus",t.name,t.type,t.size,t.lastModified,e.endpoint].join("-")};var oa={},ia=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();Object.defineProperty(oa,"__esModule",{value:!0});var sa=ha(ra),aa=ha(ea),la=ha(function t(){var e,n,r,o,i,s,a=arguments[0],l=1,u=arguments.length,p=!1;for("boolean"==typeof a&&(p=a,a=arguments[1]||{},l=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});l<u;++l)if(null!=(e=arguments[l]))for(n in e)r=a[n],a!==(o=e[n])&&(p&&o&&(Vs(o)||(i=Xs(o)))?(i?(i=!1,s=r&&Xs(r)?r:[]):s=r&&Vs(r)?r:{},a[n]=t(p,s,o)):void 0!==o&&(a[n]=o));return a}),ua=ca(Gs),pa=ca(Ns);function ca(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function ha(t){return t&&t.__esModule?t:{default:t}}var da={endpoint:null,fingerprint:sa.default,resume:!0,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,headers:{},chunkSize:1/0,withCredentials:!1,uploadUrl:null,uploadSize:null,overridePatchMethod:!1,retryDelays:null,removeFingerprintOnSuccess:!1},fa=function(){function t(e,n){!function(e,n){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.options=(0,la.default)(!0,{},da,n),this.file=e,this.url=null,this._xhr=null,this._fingerprint=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0}return ia(t,[{key:"start",value:function(){var t=this,e=this.file;if(e)if(this.options.endpoint||this.options.uploadUrl){var n=this._source=(0,Qs.getSource)(e,this.options.chunkSize);if(null!=this.options.uploadSize){var r=+this.options.uploadSize;if(isNaN(r))throw new Error("tus: cannot convert `uploadSize` option into a number");this._size=r}else{if(null==(r=n.size))throw new Error("tus: cannot automatically derive upload's size from input and must be specified manually using the `uploadSize` option");this._size=r}var o,i=this.options.retryDelays;if(null!=i){if("[object Array]"!==Object.prototype.toString.call(i))throw new Error("tus: the `retryDelays` option must either be an array or null");o=t.options.onError,t.options.onError=function(e){t.options.onError=o,null!=t._offset&&t._offset>t._offsetBeforeRetry&&(t._retryAttempt=0);var n=!0;if("undefined"!=typeof window&&"navigator"in window&&!1===window.navigator.onLine&&(n=!1),t._retryAttempt<i.length&&null!=e.originalRequest&&!ya(e.originalRequest.status,400)&&n){var r=i[t._retryAttempt++];t._offsetBeforeRetry=t._offset,t.options.uploadUrl=t.url,t._retryTimeout=setTimeout(function(){t.start()},r)}else t._emitError(e)}}if(this._aborted=!1,null==this.url){if(null!=this.options.uploadUrl)return this.url=this.options.uploadUrl,void this._resumeUpload();if(this.options.resume){this._fingerprint=this.options.fingerprint(e,this.options);var s=pa.getItem(this._fingerprint);if(null!=s)return this.url=s,void this._resumeUpload()}this._createUpload()}else this._resumeUpload()}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:"abort",value:function(){null!==this._xhr&&(this._xhr.abort(),this._source.close(),this._aborted=!0),null!=this._retryTimeout&&(clearTimeout(this._retryTimeout),this._retryTimeout=null)}},{key:"_emitXhrError",value:function(t,e,n){this._emitError(new aa.default(e,n,t))}},{key:"_emitError",value:function(t){if("function"!=typeof this.options.onError)throw t;this.options.onError(t)}},{key:"_emitSuccess",value:function(){"function"==typeof this.options.onSuccess&&this.options.onSuccess()}},{key:"_emitProgress",value:function(t,e){"function"==typeof this.options.onProgress&&this.options.onProgress(t,e)}},{key:"_emitChunkComplete",value:function(t,e,n){"function"==typeof this.options.onChunkComplete&&this.options.onChunkComplete(t,e,n)}},{key:"_setupXHR",value:function(t){this._xhr=t,t.setRequestHeader("Tus-Resumable","1.0.0");var e=this.options.headers;for(var n in e)t.setRequestHeader(n,e[n]);t.withCredentials=this.options.withCredentials}},{key:"_createUpload",value:function(){var t=this;if(this.options.endpoint){var e=(0,Ys.newRequest)();e.open("POST",this.options.endpoint,!0),e.onload=function(){if(ya(e.status,200)){var n=e.getResponseHeader("Location");if(null!=n){if(t.url=(0,Ys.resolveUrl)(t.options.endpoint,n),0===t._size)return t._emitSuccess(),void t._source.close();t.options.resume&&pa.setItem(t._fingerprint,t.url),t._offset=0,t._startUpload()}else t._emitXhrError(e,new Error("tus: invalid or missing Location header"))}else t._emitXhrError(e,new Error("tus: unexpected response while creating upload"))},e.onerror=function(n){t._emitXhrError(e,new Error("tus: failed to create upload"),n)},this._setupXHR(e),e.setRequestHeader("Upload-Length",this._size);var n=function(t){if(!ua.isSupported)return"";var e=[];for(var n in t)e.push(n+" "+ua.encode(t[n]));return e.join(",")}(this.options.metadata);""!==n&&e.setRequestHeader("Upload-Metadata",n),e.send(null)}else this._emitError(new Error("tus: unable to create upload because no endpoint is provided"))}},{key:"_resumeUpload",value:function(){var t=this,e=(0,Ys.newRequest)();e.open("HEAD",this.url,!0),e.onload=function(){if(!ya(e.status,200))return t.options.resume&&ya(e.status,400)&&pa.removeItem(t._fingerprint),423===e.status?void t._emitXhrError(e,new Error("tus: upload is currently locked; retry later")):t.options.endpoint?(t.url=null,void t._createUpload()):void t._emitXhrError(e,new Error("tus: unable to resume upload (new upload cannot be created without an endpoint)"));var n=parseInt(e.getResponseHeader("Upload-Offset"),10);if(isNaN(n))t._emitXhrError(e,new Error("tus: invalid or missing offset value"));else{var r=parseInt(e.getResponseHeader("Upload-Length"),10);if(isNaN(r))t._emitXhrError(e,new Error("tus: invalid or missing length value"));else{if(n===r)return t._emitProgress(r,r),void t._emitSuccess();t._offset=n,t._startUpload()}}},e.onerror=function(n){t._emitXhrError(e,new Error("tus: failed to resume upload"),n)},this._setupXHR(e),e.send(null)}},{key:"_startUpload",value:function(){var t=this;if(!this._aborted){var e=(0,Ys.newRequest)();this.options.overridePatchMethod?(e.open("POST",this.url,!0),e.setRequestHeader("X-HTTP-Method-Override","PATCH")):e.open("PATCH",this.url,!0),e.onload=function(){if(ya(e.status,200)){var n=parseInt(e.getResponseHeader("Upload-Offset"),10);if(isNaN(n))t._emitXhrError(e,new Error("tus: invalid or missing offset value"));else{if(t._emitProgress(n,t._size),t._emitChunkComplete(n-t._offset,n,t._size),t._offset=n,n==t._size)return t.options.removeFingerprintOnSuccess&&t.options.resume&&pa.removeItem(t._fingerprint),t._emitSuccess(),void t._source.close();t._startUpload()}}else t._emitXhrError(e,new Error("tus: unexpected response while uploading chunk"))},e.onerror=function(n){t._aborted||t._emitXhrError(e,new Error("tus: failed to upload chunk at offset "+t._offset),n)},"upload"in e&&(e.upload.onprogress=function(e){e.lengthComputable&&t._emitProgress(n+e.loaded,t._size)}),this._setupXHR(e),e.setRequestHeader("Upload-Offset",this._offset),e.setRequestHeader("Content-Type","application/offset+octet-stream");var n=this._offset,r=this._offset+this.options.chunkSize;(r===1/0||r>this._size)&&(r=this._size),e.send(this._source.slice(n,r)),this._emitProgress(this._offset,this._size)}}}]),t}();function ya(t,e){return t>=e&&t<e+100}fa.defaultOptions=da,oa.default=fa;var ga,ma=(ga=oa)&&ga.__esModule?ga:{default:ga};ma.default.defaultOptions;if("undefined"!=typeof window){var va=window,ba=va.XMLHttpRequest,wa=va.Blob;ba&&wa&&wa.prototype.slice}else!0;var Sa={Upload:ma.default},_a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pa=d.Provider,Ea=d.RequestClient,ka=d.Socket,Ca={endpoint:"",resume:!0,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,headers:{},chunkSize:1/0,withCredentials:!1,uploadUrl:null,uploadSize:null,overridePatchMethod:!1,retryDelays:null};function Ta(t){var e=[];return{on:function(n,r){return e.push([n,r]),t.on(n,r)},remove:function(){e.forEach(function(e){var n=e[0],r=e[1];t.off(n,r)})}}}var Oa=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));return o.type="uploader",o.id="Tus",o.title="Tus",o.opts=_a({},{resume:!0,autoRetry:!0,useFastRemoteRetry:!0,limit:0,retryDelays:[0,1e3,3e3,5e3]},r),"number"==typeof o.opts.limit&&0!==o.opts.limit?o.limitUploads=ot(o.opts.limit):o.limitUploads=function(t){return t},o.uploaders=Object.create(null),o.uploaderEvents=Object.create(null),o.uploaderSockets=Object.create(null),o.handleResetProgress=o.handleResetProgress.bind(o),o.handleUpload=o.handleUpload.bind(o),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.handleResetProgress=function(){var t=_a({},this.uppy.getState().files);Object.keys(t).forEach(function(e){if(t[e].tus&&t[e].tus.uploadUrl){var n=_a({},t[e].tus);delete n.uploadUrl,t[e]=_a({},t[e],{tus:n})}}),this.uppy.setState({files:t})},e.prototype.resetUploaderReferences=function(t){this.uploaders[t]&&(this.uploaders[t].abort(),this.uploaders[t]=null),this.uploaderEvents[t]&&(this.uploaderEvents[t].remove(),this.uploaderEvents[t]=null),this.uploaderSockets[t]&&(this.uploaderSockets[t].close(),this.uploaderSockets[t]=null)},e.prototype.upload=function(t,e,n){var r=this;return this.resetUploaderReferences(t.id),new Promise(function(e,n){var o=_a({},Ca,r.opts,t.tus||{});o.onError=function(e){r.uppy.log(e),r.uppy.emit("upload-error",t,e),e.message="Failed because: "+e.message,r.resetUploaderReferences(t.id),n(e)},o.onProgress=function(e,n){r.onReceiveUploadUrl(t,a.url),r.uppy.emit("upload-progress",t,{uploader:r,bytesUploaded:e,bytesTotal:n})},o.onSuccess=function(){r.uppy.emit("upload-success",t,a,a.url),a.url&&r.uppy.log("Download "+a.file.name+" from "+a.url),r.resetUploaderReferences(t.id),e(a)};var i=function(t,e,n){Object.prototype.hasOwnProperty.call(t,e)&&!Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=t[e])},s=_a({},t.meta);i(s,"type","filetype"),i(s,"name","filename"),o.metadata=s;var a=new Sa.Upload(t.data,o);r.uploaders[t.id]=a,r.uploaderEvents[t.id]=Ta(r.uppy),r.onFileRemove(t.id,function(n){r.resetUploaderReferences(t.id),e("upload "+n+" was removed")}),r.onPause(t.id,function(t){t?a.abort():a.start()}),r.onPauseAll(t.id,function(){a.abort()}),r.onCancelAll(t.id,function(){r.resetUploaderReferences(t.id)}),r.onResumeAll(t.id,function(){t.error&&a.abort(),a.start()}),t.isPaused||a.start()})},e.prototype.uploadRemote=function(t,e,n){var r=this;this.resetUploaderReferences(t.id);var o=_a({},this.opts,t.tus||{});return new Promise(function(e,n){if(r.uppy.log(t.remote.url),t.serverToken)return r.connectToServerSocket(t).then(function(){return e()}).catch(n);r.uppy.emit("upload-started",t),new(t.remote.providerOptions.provider?Pa:Ea)(r.uppy,t.remote.providerOptions).post(t.remote.url,_a({},t.remote.body,{endpoint:o.endpoint,uploadUrl:o.uploadUrl,protocol:"tus",size:t.data.size,metadata:t.meta})).then(function(e){return r.uppy.setFileState(t.id,{serverToken:e.token}),t=r.uppy.getFile(t.id)}).then(function(t){return r.connectToServerSocket(t)}).then(function(){e()}).catch(function(t){n(new Error(t))})})},e.prototype.connectToServerSocket=function(t){var e=this;return new Promise(function(n,r){var o=t.serverToken,i=rt(t.remote.serverUrl),s=new ka({target:i+"/api/"+o});e.uploaderSockets[t.id]=s,e.uploaderEvents[t.id]=Ta(e.uppy),e.onFileRemove(t.id,function(){s.send("pause",{}),n("upload "+t.id+" was removed")}),e.onPause(t.id,function(t){t?s.send("pause",{}):s.send("resume",{})}),e.onPauseAll(t.id,function(){return s.send("pause",{})}),e.onCancelAll(t.id,function(){return s.send("pause",{})}),e.onResumeAll(t.id,function(){t.error&&s.send("pause",{}),s.send("resume",{})}),e.onRetry(t.id,function(){s.send("pause",{}),s.send("resume",{})}),e.onRetryAll(t.id,function(){s.send("pause",{}),s.send("resume",{})}),t.isPaused&&s.send("pause",{}),s.on("progress",function(n){return nt(e,n,t)}),s.on("error",function(n){var o=n.error.message,i=_a(new Error(o),{cause:n.error});e.opts.useFastRemoteRetry||(e.resetUploaderReferences(t.id),e.uppy.setFileState(t.id,{serverToken:null})),e.uppy.emit("upload-error",t,i),r(i)}),s.on("success",function(r){e.uppy.emit("upload-success",t,r,r.url),e.resetUploaderReferences(t.id),n()})})},e.prototype.onReceiveUploadUrl=function(t,e){var n=this.uppy.getFile(t.id);n&&(n.tus&&n.tus.uploadUrl===e||(this.uppy.log("[Tus] Storing upload url"),this.uppy.setFileState(n.id,{tus:_a({},n.tus,{uploadUrl:e})})))},e.prototype.onFileRemove=function(t,e){this.uploaderEvents[t].on("file-removed",function(n){t===n.id&&e(n.id)})},e.prototype.onPause=function(t,e){this.uploaderEvents[t].on("upload-pause",function(n,r){t===n&&e(r)})},e.prototype.onRetry=function(t,e){this.uploaderEvents[t].on("upload-retry",function(n){t===n&&e()})},e.prototype.onRetryAll=function(t,e){var n=this;this.uploaderEvents[t].on("retry-all",function(r){n.uppy.getFile(t)&&e()})},e.prototype.onPauseAll=function(t,e){var n=this;this.uploaderEvents[t].on("pause-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.onCancelAll=function(t,e){var n=this;this.uploaderEvents[t].on("cancel-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.onResumeAll=function(t,e){var n=this;this.uploaderEvents[t].on("resume-all",function(){n.uppy.getFile(t)&&e()})},e.prototype.uploadFiles=function(t){var e=this,n=t.map(function(n,r){var o=parseInt(r,10)+1,i=t.length;return n.error?function(){return Promise.reject(new Error(n.error))}:n.isRemote?(e.uppy.emit("upload-started",n),e.uploadRemote.bind(e,n,o,i)):(e.uppy.emit("upload-started",n),e.upload.bind(e,n,o,i))}).map(function(t){return e.limitUploads(t)()});return dt(n)},e.prototype.handleUpload=function(t){var e=this;if(0===t.length)return this.uppy.log("Tus: no files to upload!"),Promise.resolve();this.uppy.log("Tus is uploading...");var n=t.map(function(t){return e.uppy.getFile(t)});return this.uploadFiles(n).then(function(){return null})},e.prototype.install=function(){this.uppy.setState({capabilities:_a({},this.uppy.getState().capabilities,{resumableUploads:!0})}),this.uppy.addUploader(this.handleUpload),this.uppy.on("reset-progress",this.handleResetProgress),this.opts.autoRetry&&this.uppy.on("back-online",this.uppy.retryAll)},e.prototype.uninstall=function(){this.uppy.setState({capabilities:_a({},this.uppy.getState().capabilities,{resumableUploads:!1})}),this.uppy.removeUploader(this.handleUpload),this.opts.autoRetry&&this.uppy.off("back-online",this.uppy.retryAll)},e}(Y.Plugin),Ua={},Fa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function Aa(t,e){return{params:e.params,signature:e.signature,fields:e.fields}}var xa="https://api2.transloadit.com/companion",Da=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/companion/,Ra=/https?:\/\/api2(?:-\w+)?\.transloadit\.com\/uppy-server/;(Ua=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.type="uploader",o.id="Transloadit",o.title="Transloadit";var i={strings:{creatingAssembly:"Preparing upload...",creatingAssemblyFailed:"Transloadit: Could not create Assembly",encoding:"Encoding..."}},s={service:"https://api2.transloadit.com",waitForEncoding:!1,waitForMetadata:!1,alwaysRunAssembly:!1,importFromUploadURLs:!1,signature:null,params:null,fields:{},getAssemblyOptions:Aa,locale:i};return o.opts=Fa({},s,r),o.locale=Fa({},i,o.opts.locale),o.locale.strings=Fa({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o._prepareUpload=o._prepareUpload.bind(o),o._afterUpload=o._afterUpload.bind(o),o._handleError=o._handleError.bind(o),o._onFileUploadURLAvailable=o._onFileUploadURLAvailable.bind(o),o._onRestored=o._onRestored.bind(o),o._getPersistentData=o._getPersistentData.bind(o),o.opts.params&&js.validateParams(o.opts.params),o.client=new Ms({service:o.opts.service}),o.activeAssemblies={},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype._attachAssemblyMetadata=function(t,e){var n=Fa({},t.meta,{assembly_url:e.assembly_url,filename:t.name,fieldname:"file"}),r=Fa({},t.tus,{endpoint:e.tus_url}),o=t.remote;if(t.remote&&Ra.test(t.remote.serverUrl)){var i=new Error("The https://api2.transloadit.com/uppy-server endpoint was renamed to https://api2.transloadit.com/companion, please update your `serverUrl` options accordingly.");throw this.uppy.log(i),i}if(t.remote&&Da.test(t.remote.serverUrl)){var s=e.companion_url.replace(/\/$/,""),a=t.remote.url.replace(t.remote.serverUrl,"").replace(/^\//,"");o=Fa({},t.remote,{serverUrl:s,url:s+"/"+a})}var l=Fa({},t,{transloadit:{assembly:e.assembly_id}});return this.opts.importFromUploadURLs||Fa(l,{meta:n,tus:r,remote:o}),l},e.prototype._createAssembly=function(t,e,n){var r=this;return this.uppy.log("[Transloadit] create Assembly"),this.client.createAssembly({params:n.params,fields:n.fields,expectedFiles:t.length,signature:n.signature}).then(function(n){var o,i,s=new Is(n),a=s.status,l=r.getPluginState(),u=l.assemblies,p=l.uploadsAssemblies;r.setPluginState({assemblies:Fa({},u,(o={},o[a.assembly_id]=a,o)),uploadsAssemblies:Fa({},p,(i={},i[e]=[].concat(p[e],[a.assembly_id]),i))});var c=r.uppy.getState().files,h={};return t.forEach(function(t){h[t]=r._attachAssemblyMetadata(r.uppy.getFile(t),a)}),r.uppy.setState({files:Fa({},c,h)}),r.uppy.emit("transloadit:assembly-created",a,t),r._connectAssembly(s),r.uppy.log("[Transloadit] Created Assembly "+a.assembly_id),s}).catch(function(t){throw t.message=r.i18n("creatingAssemblyFailed")+": "+t.message,t})},e.prototype._shouldWaitAfterUpload=function(){return this.opts.waitForEncoding||this.opts.waitForMetadata},e.prototype._reserveFiles=function(t,e){var n=this;return Promise.all(e.map(function(e){var r=n.uppy.getFile(e);return n.client.reserveFile(t,r)}))},e.prototype._onFileUploadURLAvailable=function(t){var e=this;if(t&&t.transloadit&&t.transloadit.assembly){var n=this.getPluginState().assemblies[t.transloadit.assembly];this.client.addFile(n,t).catch(function(r){e.uppy.log(r),e.uppy.emit("transloadit:import-error",n,t.id,r)})}},e.prototype._findFile=function(t){for(var e=this.uppy.getFiles(),n=0;n<e.length;n++){var r=e[n];if(r.uploadURL===t.tus_upload_url)return r;if(r.tus&&r.tus.uploadUrl===t.tus_upload_url)return r;if(!t.is_tus_file&&r.name===t.name&&r.size===t.size)return r}},e.prototype._onFileUploadComplete=function(t,e){var n,r=this.getPluginState(),o=this._findFile(e);o?(this.setPluginState({files:Fa({},r.files,(n={},n[e.id]={assembly:t,id:o.id,uploadedFile:e},n))}),this.uppy.emit("transloadit:upload",e,this.getAssembly(t))):this.uppy.log("[Transloadit] Couldn\u2019t file the file, it was likely removed in the process")},e.prototype._onResult=function(t,e,n){var r=this.getPluginState(),o=r.files[n.original_id];n.localId=o?o.id:null;var i={result:n,stepName:e,id:n.id,assembly:t};this.setPluginState({results:[].concat(r.results,[i])}),this.uppy.emit("transloadit:result",e,n,this.getAssembly(t))},e.prototype._onAssemblyFinished=function(t){var e=this,n=t.assembly_ssl_url;this.client.getAssemblyStatus(n).then(function(t){var n,r=e.getPluginState();e.setPluginState({assemblies:Fa({},r.assemblies,(n={},n[t.assembly_id]=t,n))}),e.uppy.emit("transloadit:complete",t)})},e.prototype._getPersistentData=function(t){var e,n=this.getPluginState(),r=n.assemblies,o=n.uploadsAssemblies;t(((e={})[this.id]={assemblies:r,uploadsAssemblies:o},e))},e.prototype._onRestored=function(t){var e=this,n=t&&t[this.id]?t[this.id]:{},r=n.assemblies||{},o=n.uploadsAssemblies||{};0!==Object.keys(o).length&&(this.restored=Promise.resolve().then(function(){var t,n,i;return t=r,n={},i=[],Object.keys(t).forEach(function(r){var o=t[r];o.uploads.forEach(function(t){var o=e._findFile(t);n[t.id]={id:o.id,assembly:r,uploadedFile:t}});var s=e.getPluginState();Object.keys(o.results).forEach(function(t){o.results[t].forEach(function(e){var n=s.files[e.original_id];e.localId=n?n.id:null,i.push({id:e.id,result:e,stepName:t,assembly:r})})})}),e.setPluginState({assemblies:t,files:n,results:i,uploadsAssemblies:o}),function(){var t=e.getPluginState().assemblies;Object.keys(t).forEach(function(n){var r=new Is(t[n]);e._connectAssembly(r)})}(),function(){var t=e.getPluginState().assemblies;return Promise.all(Object.keys(t).map(function(t){return e.activeAssemblies[t].update()}))}()}),this.restored.then(function(){e.restored=null}))},e.prototype._connectAssembly=function(t){var e=this,n=t.status.assembly_id;return this.activeAssemblies[n]=t,t.on("status",function(t){var r,o=e.getPluginState().assemblies;e.setPluginState({assemblies:Fa({},o,(r={},r[n]=t,r))})}),t.on("upload",function(t){e._onFileUploadComplete(n,t)}),t.on("error",function(n){e.uppy.emit("transloadit:assembly-error",t.status,n)}),t.on("executing",function(){e.uppy.emit("transloadit:assembly-executing",t.status)}),this.opts.waitForEncoding&&t.on("result",function(t,r){e._onResult(n,t,r)}),this.opts.waitForEncoding?t.on("finished",function(){e._onAssemblyFinished(t.status)}):this.opts.waitForMetadata&&t.on("metadata",function(){e._onAssemblyFinished(t.status)}),"ASSEMBLY_COMPLETE"===t.ok?t:(new Promise(function(e,n){t.once("connect",e),t.once("status",e),t.once("error",n)}).then(function(){e.uppy.log("[Transloadit] Socket is ready")}),t.connect(),t)},e.prototype._prepareUpload=function(t,e){var n,r=this;(t=t.filter(function(t){return!t.error})).forEach(function(t){var e=r.uppy.getFile(t);r.uppy.emit("preprocess-progress",e,{mode:"indeterminate",message:r.i18n("creatingAssembly")})});var o=function(t){var n=t.fileIDs,o=t.options;return r._createAssembly(n,e,o).then(function(t){if(r.opts.importFromUploadURLs)return r._reserveFiles(t,n)}).then(function(){n.forEach(function(t){var e=r.uppy.getFile(t);r.uppy.emit("preprocess-complete",e)})}).catch(function(t){throw n.forEach(function(e){var n=r.uppy.getFile(e);r.uppy.emit("preprocess-complete",n),r.uppy.emit("upload-error",n,t)}),t})},i=this.getPluginState().uploadsAssemblies;this.setPluginState({uploadsAssemblies:Fa({},i,(n={},n[e]=[],n))});var s=t.map(function(t){return r.uppy.getFile(t)});return new js(s,this.opts).build().then(function(t){return Promise.all(t.map(o))},function(e){throw t.forEach(function(t){var n=r.uppy.getFile(t);r.uppy.emit("preprocess-complete",n),r.uppy.emit("upload-error",n,e)}),e})},e.prototype._afterUpload=function(t,e){var n=this;t=t.filter(function(t){return!t.error});var r=this.getPluginState();if(this.restored)return this.restored.then(function(){return n._afterUpload(t,e)});var o=r.uploadsAssemblies[e];if(!this._shouldWaitAfterUpload()){o.forEach(function(t){n.activeAssemblies[t].close(),delete n.activeAssemblies[t]});var i=o.map(function(t){return n.getAssembly(t)});return this.uppy.addResultData(e,{transloadit:i}),Promise.resolve()}if(0===o.length)return this.uppy.addResultData(e,{transloadit:[]}),Promise.resolve();var s=new Ls(this.uppy,o);return t.forEach(function(t){var e=n.uppy.getFile(t);n.uppy.emit("postprocess-progress",e,{mode:"indeterminate",message:n.i18n("encoding")})}),s.on("assembly-complete",function(t){n.getAssemblyFiles(t).forEach(function(t){n.uppy.emit("postprocess-complete",t)})}),s.on("assembly-error",function(t,e){n.getAssemblyFiles(t).forEach(function(t){n.uppy.emit("upload-error",t,e),n.uppy.emit("postprocess-complete",t)})}),s.promise.then(function(){var t=o.map(function(t){return n.getAssembly(t)}),r=n.getPluginState(),i=Fa({},r.uploadsAssemblies);delete i[e],n.setPluginState({uploadsAssemblies:i}),n.uppy.addResultData(e,{transloadit:t})})},e.prototype._handleError=function(t,e){var n=this;this.uppy.log("[Transloadit] _handleError in upload "+e),this.uppy.log(t),this.getPluginState().uploadsAssemblies[e].forEach(function(t){n.activeAssemblies[t]&&n.activeAssemblies[t].close()})},e.prototype.install=function(){this.uppy.addPreProcessor(this._prepareUpload),this.uppy.addPostProcessor(this._afterUpload),this.uppy.on("error",this._handleError),this.opts.importFromUploadURLs?this.uppy.on("upload-success",this._onFileUploadURLAvailable):this.uppy.use(Oa,{resume:!1,useFastRemoteRetry:!1,metaFields:["assembly_url","filename","fieldname"]}),this.uppy.on("restore:get-data",this._getPersistentData),this.uppy.on("restored",this._onRestored),this.setPluginState({assemblies:{},uploadsAssemblies:{},files:{},results:[]})},e.prototype.uninstall=function(){this.uppy.removePreProcessor(this._prepareUpload),this.uppy.removePostProcessor(this._afterUpload),this.uppy.off("error",this._handleError),this.opts.importFromUploadURLs&&this.uppy.off("upload-success",this._onFileUploadURLAvailable)},e.prototype.getAssembly=function(t){return this.getPluginState().assemblies[t]},e.prototype.getAssemblyFiles=function(t){return this.uppy.getFiles().filter(function(e){return e&&e.transloadit&&e.transloadit.assembly===t})},e}(Y.Plugin)).COMPANION=xa,Ua.UPPY_SERVER=xa;var Ia=A.h,Ba=function(t){function e(n){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.handleKeyPress=r.handleKeyPress.bind(r),r.handleClick=r.handleClick.bind(r),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){var t=this;this.input.value="",setTimeout(function(){t.input&&t.input.focus({preventScroll:!0})},150)},e.prototype.handleKeyPress=function(t){13===t.keyCode&&this.props.addFile(this.input.value)},e.prototype.handleClick=function(){this.props.addFile(this.input.value)},e.prototype.render=function(){var t=this;return Ia("div",{class:"uppy-Url"},Ia("input",{class:"uppy-c-textInput uppy-Url-input",type:"text",placeholder:this.props.i18n("enterUrlToImport"),onkeyup:this.handleKeyPress,ref:function(e){t.input=e}}),Ia("button",{class:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton",type:"button","aria-label":this.props.i18n("import"),onclick:this.handleClick},this.props.i18n("import")))},e}(A.Component),ja=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},La=Y.Plugin,Ma=A.h,Na=d.RequestClient,za=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.id=o.opts.id||"Url",o.title=o.opts.title||"Link",o.type="acquirer",o.icon=function(){return Ma("svg",{"aria-hidden":"true",width:"23",height:"23",viewBox:"0 0 23 23",xmlns:"http://www.w3.org/2000/svg"},Ma("path",{d:"M20.485 11.236l-2.748 2.737c-.184.182-.367.365-.642.547-1.007.73-2.107 1.095-3.298 1.095-1.65 0-3.298-.73-4.398-2.19-.275-.365-.183-1.003.183-1.277.367-.273 1.008-.182 1.283.183 1.191 1.642 3.482 1.915 5.13.73a.714.714 0 0 0 .367-.365l2.75-2.737c1.373-1.46 1.373-3.74-.093-5.108a3.72 3.72 0 0 0-5.13 0L12.33 6.4a.888.888 0 0 1-1.283 0 .88.88 0 0 1 0-1.277l1.558-1.55a5.38 5.38 0 0 1 7.605 0c2.29 2.006 2.382 5.564.274 7.662zm-8.979 6.294L9.95 19.081a3.72 3.72 0 0 1-5.13 0c-1.467-1.368-1.467-3.74-.093-5.108l2.75-2.737.366-.365c.824-.547 1.74-.82 2.748-.73 1.008.183 1.833.639 2.382 1.46.275.365.917.456 1.283.182.367-.273.458-.912.183-1.277-.916-1.186-2.199-1.915-3.573-2.098-1.374-.273-2.84.091-4.031 1.004l-.55.547-2.749 2.737c-2.107 2.189-2.015 5.655.092 7.753C4.727 21.453 6.101 22 7.475 22c1.374 0 2.749-.547 3.848-1.55l1.558-1.551a.88.88 0 0 0 0-1.278c-.367-.364-1.008-.456-1.375-.09z",fill:"#FF814F","fill-rule":"nonzero"}))};var i={strings:{import:"Import",enterUrlToImport:"Enter URL to import a file",failedToFetch:"Companion failed to fetch this URL, please make sure it\u2019s correct",enterCorrectUrl:"Incorrect URL: Please make sure you are entering a direct link to a file"}},s={locale:i};if(o.opts=ja({},s,r),o.locale=ja({},i,o.opts.locale),o.locale.strings=ja({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.hostname=o.opts.serverUrl,!o.hostname)throw new Error("Companion hostname is required, please consult https://uppy.io/docs/companion");return o.getMeta=o.getMeta.bind(o),o.addFile=o.addFile.bind(o),o.handleDrop=o.handleDrop.bind(o),o.handleDragOver=o.handleDragOver.bind(o),o.handleDragLeave=o.handleDragLeave.bind(o),o.handlePaste=o.handlePaste.bind(o),o.client=new Na(n,{serverUrl:o.opts.serverUrl,serverHeaders:o.opts.serverHeaders}),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getFileNameFromUrl=function(t){return t.substring(t.lastIndexOf("/")+1)},e.prototype.checkIfCorrectURL=function(t){if(!t)return!1;var e=t.match(/^([a-z0-9]+):\/\//)[1];return"http"===e||"https"===e},e.prototype.addProtocolToURL=function(t){return/^[a-z0-9]+:\/\//.test(t)?t:"http://"+t},e.prototype.getMeta=function(t){var e=this;return this.client.post("url/meta",{url:t}).then(function(t){if(t.error)throw e.uppy.log("[URL] Error:"),e.uppy.log(t.error),new Error("Failed to fetch the file");return t})},e.prototype.addFile=function(t){var e=this;return t=this.addProtocolToURL(t),this.checkIfCorrectURL(t)?this.getMeta(t).then(function(n){return{source:e.id,name:e.getFileNameFromUrl(t),type:n.type,data:{size:n.size},isRemote:!0,body:{url:t},remote:{serverUrl:e.opts.serverUrl,url:e.hostname+"/url/get",body:{fileId:t,url:t},providerOptions:e.client.opts}}}).then(function(t){e.uppy.log("[Url] Adding remote file");try{e.uppy.addFile(t)}catch(t){}}).then(function(){}).catch(function(t){e.uppy.log(t),e.uppy.info({message:e.i18n("failedToFetch"),details:t},"error",4e3)}):(this.uppy.log("[URL] Incorrect URL entered: "+t),void this.uppy.info(this.i18n("enterCorrectUrl"),"error",4e3))},e.prototype.handleDrop=function(t){var e=this;t.preventDefault(),t.dataTransfer.items&&gn(t.dataTransfer.items).forEach(function(t){"string"===t.kind&&"text/uri-list"===t.type&&t.getAsString(function(t){e.uppy.log("[URL] Adding file from dropped url: "+t),e.addFile(t)})})},e.prototype.handleDragOver=function(t){t.preventDefault(),this.el.classList.add("drag")},e.prototype.handleDragLeave=function(t){t.preventDefault(),this.el.classList.remove("drag")},e.prototype.handlePaste=function(t){var e=this;if(t.clipboardData.items){var n=gn(t.clipboardData.items);n.filter(function(t){return"file"===t.kind}).length>0||n.forEach(function(t){"string"===t.kind&&"text/plain"===t.type&&t.getAsString(function(t){e.uppy.log("[URL] Adding file from pasted url: "+t),e.addFile(t)})})}},e.prototype.render=function(t){return Ma(Ba,{i18n:this.i18n,addFile:this.addFile})},e.prototype.onMount=function(){this.el&&(this.el.addEventListener("drop",this.handleDrop),this.el.addEventListener("dragover",this.handleDragOver),this.el.addEventListener("dragleave",this.handleDragLeave),this.el.addEventListener("paste",this.handlePaste))},e.prototype.install=function(){var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.el&&(this.el.removeEventListener("drop",this.handleDrop),this.el.removeEventListener("dragover",this.handleDragOver),this.el.removeEventListener("dragleave",this.handleDragLeave),this.el.removeEventListener("paste",this.handlePaste)),this.unmount()},e}(La),qa={"video/ogg":"ogv","audio/ogg":"ogg","video/webm":"webm","audio/webm":"webm","video/mp4":"mp4","audio/mp3":"mp3"},Ha=A.h,Wa=function(t){return Ha("svg",{"aria-hidden":"true",fill:"#0097DC",width:"66",height:"55",viewBox:"0 0 66 55",xmlns:"http://www.w3.org/2000/svg"},Ha("path",{d:"M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z","fill-rule":"evenodd"}))},Xa=A.h,Va=A.h,Ga=A.h;function Ka(t,e){return-1!==t.indexOf(e)}var Ya=function(t){function e(){return function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.props.onFocus(),this.btnContainer.firstChild.focus()},e.prototype.componentWillUnmount=function(){this.props.onStop()},e.prototype.render=function(){var t,e,n,r=this,o=this.props.supportsRecording&&(Ka(this.props.modes,"video-only")||Ka(this.props.modes,"audio-only")||Ka(this.props.modes,"video-audio")),i=Ka(this.props.modes,"picture");return Ga("div",{class:"uppy uppy-Webcam-container"},Ga("div",{class:"uppy-Webcam-videoContainer"},Ga("video",{class:"uppy-Webcam-video "+(this.props.mirror?"uppy-Webcam-video--mirrored":""),autoplay:!0,muted:!0,playsinline:!0,srcObject:this.props.src||""})),Ga("div",{class:"uppy-Webcam-buttonContainer",ref:function(t){r.btnContainer=t}},i?(t=this.props,e=t.onSnapshot,n=t.i18n,Va("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--picture",type:"button",title:n("takePicture"),"aria-label":n("takePicture"),onclick:e},Wa())):null," ",o?function(t){var e=t.recording,n=t.onStartRecording,r=t.onStopRecording,o=t.i18n;return console.log("is recording",e),e?Xa("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--video",type:"button",title:o("stopRecording"),"aria-label":o("stopRecording"),onclick:r},Xa("svg",{"aria-hidden":"true",class:"UppyIcon",width:"100",height:"100",viewBox:"0 0 100 100"},Xa("rect",{x:"15",y:"15",width:"70",height:"70"}))):Xa("button",{class:"uppy-u-reset uppy-c-btn uppy-Webcam-button uppy-Webcam-button--video",type:"button",title:o("startRecording"),"aria-label":o("startRecording"),onclick:n},Xa("svg",{"aria-hidden":"true",class:"UppyIcon",width:"100",height:"100",viewBox:"0 0 100 100"},Xa("circle",{cx:"50",cy:"50",r:"40"})))}(this.props):null))},e}(A.Component),Ja=A.h,$a=function(t){return Ja("div",{class:"uppy-Webcam-permissons"},Ja("div",{class:"uppy-Webcam-permissonsIcon"},t.icon()),Ja("h1",{class:"uppy-Webcam-title"},t.i18n("allowAccessTitle")),Ja("p",null,t.i18n("allowAccessDescription")))},Qa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Za=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},tl=A.h,el=function(t){function e(n,r){!function(t,n){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n,r));o.mediaDevices=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)return navigator.mediaDevices;var t=navigator.mozGetUserMedia||navigator.webkitGetUserMedia;return t?{getUserMedia:function(e){return new Promise(function(n,r){t.call(navigator,e,n,r)})}}:null}(),o.supportsUserMedia=!!o.mediaDevices,o.protocol=location.protocol.match(/https/i)?"https":"http",o.id=o.opts.id||"Webcam",o.title=o.opts.title||"Camera",o.type="acquirer",o.icon=Wa;var i={strings:{smile:"Smile!",takePicture:"Take a picture",startRecording:"Begin video recording",stopRecording:"Stop video recording",allowAccessTitle:"Please allow access to your camera",allowAccessDescription:"In order to take pictures or record video with your camera, please allow camera access for this site."}},s={onBeforeSnapshot:function(){return Promise.resolve()},countdown:!1,locale:i,modes:["video-audio","video-only","audio-only","picture"],mirror:!0,facingMode:"user"};return o.opts=Za({},s,r),o.locale=Za({},i,o.opts.locale),o.locale.strings=Za({},i.strings,o.opts.locale.strings),o.translator=new H({locale:o.locale}),o.i18n=o.translator.translate.bind(o.translator),o.install=o.install.bind(o),o.setPluginState=o.setPluginState.bind(o),o.render=o.render.bind(o),o.start=o.start.bind(o),o.stop=o.stop.bind(o),o.takeSnapshot=o.takeSnapshot.bind(o),o.startRecording=o.startRecording.bind(o),o.stopRecording=o.stopRecording.bind(o),o.oneTwoThreeSmile=o.oneTwoThreeSmile.bind(o),o.focus=o.focus.bind(o),o.webcamActive=!1,o.opts.countdown&&(o.opts.onBeforeSnapshot=o.oneTwoThreeSmile),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.isSupported=function(){return!!this.mediaDevices},e.prototype.getConstraints=function(){return{audio:-1!==this.opts.modes.indexOf("video-audio")||-1!==this.opts.modes.indexOf("audio-only"),video:!(-1===this.opts.modes.indexOf("video-audio")&&-1===this.opts.modes.indexOf("video-only")&&-1===this.opts.modes.indexOf("picture"))&&{facingMode:this.opts.facingMode}}},e.prototype.start=function(){var t=this;if(!this.isSupported())return Promise.reject(new Error("Webcam access not supported"));this.webcamActive=!0;var e=this.getConstraints();return this.mediaDevices.getUserMedia(e).then(function(e){t.stream=e,t.setPluginState({cameraReady:!0})}).catch(function(e){t.setPluginState({cameraError:e})})},e.prototype.startRecording=function(){var t=this;this.recorder=new MediaRecorder(this.stream),this.recordingChunks=[],this.recorder.addEventListener("dataavailable",function(e){t.recordingChunks.push(e.data)}),this.recorder.start(),this.setPluginState({isRecording:!0})},e.prototype.stopRecording=function(){var t=this;return new Promise(function(e,n){t.recorder.addEventListener("stop",function(){e()}),t.recorder.stop()}).then(function(){return t.setPluginState({isRecording:!1}),t.getVideo()}).then(function(e){try{t.uppy.addFile(e)}catch(t){}}).then(function(){t.recordingChunks=null,t.recorder=null},function(e){throw t.recordingChunks=null,t.recorder=null,e})},e.prototype.stop=function(){this.stream.getAudioTracks().forEach(function(t){t.stop()}),this.stream.getVideoTracks().forEach(function(t){t.stop()}),this.webcamActive=!1,this.stream=null},e.prototype.getVideoElement=function(){return this.el.querySelector(".uppy-Webcam-video")},e.prototype.oneTwoThreeSmile=function(){var t=this;return new Promise(function(e,n){var r=t.opts.countdown,o=setInterval(function(){if(!t.webcamActive)return clearInterval(o),t.captureInProgress=!1,n(new Error("Webcam is not active"));r>0?(t.uppy.info(r+"...","warning",800),r--):(clearInterval(o),t.uppy.info(t.i18n("smile"),"success",1500),setTimeout(function(){return e()},1500))},1e3)})},e.prototype.takeSnapshot=function(){var t=this;this.captureInProgress||(this.captureInProgress=!0,this.opts.onBeforeSnapshot().catch(function(e){var n="object"===(void 0===e?"undefined":Qa(e))?e.message:e;return t.uppy.info(n,"error",5e3),Promise.reject(new Error("onBeforeSnapshot: "+n))}).then(function(){return t.getImage()}).then(function(e){t.captureInProgress=!1;try{t.uppy.addFile(e)}catch(t){}},function(e){throw t.captureInProgress=!1,e}))},e.prototype.getImage=function(){var t=this,e=this.getVideoElement();if(!e)return Promise.reject(new Error("No video element found, likely due to the Webcam tab being closed."));var n="webcam-"+Date.now()+".jpg",r=e.videoWidth,o=e.videoHeight,i=document.createElement("canvas");return i.width=r,i.height=o,i.getContext("2d").drawImage(e,0,0),function(t,e,n){return t.toBlob?new Promise(function(r){t.toBlob(r,e,n)}):Promise.resolve().then(function(){return pn(t.toDataURL(e,n),{})})}(i,"image/jpeg").then(function(e){return{source:t.id,name:n,data:new Blob([e],{type:"image/jpeg"}),type:"image/jpeg"}})},e.prototype.getVideo=function(){var t=this.recordingChunks[0].type,e=function(t){return qa[t]||null}(t);if(!e)return Promise.reject(new Error('Could not retrieve recording: Unsupported media type "'+t+'"'));var n="webcam-"+Date.now()+"."+e,r=new Blob(this.recordingChunks,{type:t}),o={source:this.id,name:n,data:new Blob([r],{type:t}),type:t};return Promise.resolve(o)},e.prototype.focus=function(){var t=this;this.opts.countdown||setTimeout(function(){t.uppy.info(t.i18n("smile"),"success",1500)},1e3)},e.prototype.render=function(t){this.webcamActive||this.start();var e=this.getPluginState();return e.cameraReady?tl(Ya,Za({},e,{onSnapshot:this.takeSnapshot,onStartRecording:this.startRecording,onStopRecording:this.stopRecording,onFocus:this.focus,onStop:this.stop,i18n:this.i18n,modes:this.opts.modes,supportsRecording:"function"==typeof MediaRecorder&&!!MediaRecorder.prototype&&"function"==typeof MediaRecorder.prototype.start,recording:e.isRecording,mirror:this.opts.mirror,src:this.stream})):tl($a,{icon:Wa,i18n:this.i18n})},e.prototype.install=function(){this.setPluginState({cameraReady:!1});var t=this.opts.target;t&&this.mount(t,this)},e.prototype.uninstall=function(){this.stream&&this.stop(),this.unmount()},e}(Y.Plugin),nl={};return nl.Core=Y,nl.server=d,nl.views={ProviderView:Qn},nl.DefaultStore=z,nl.ReduxStore=Nr,nl.Dashboard=_n,nl.DragDrop=Cn,nl.FileInput=sr,nl.Informer=qe,nl.ProgressBar=ro,nl.StatusBar=un,nl.Dropbox=nr,nl.GoogleDrive=Kr,nl.Instagram=Zr,nl.Url=za,nl.Webcam=el,nl.AwsS3=kt,nl.AwsS3Multipart=ct,nl.Transloadit=Ua,nl.Tus=Oa,nl.XHRUpload=vt,nl.Form=wr,nl.GoldenRetriever=qr,nl.ReduxDevTools=io,nl.ThumbnailGenerator=dn,nl});
//# sourceMappingURL=uppy.min.js.map