Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced FineUploader by Uppy library. Refactored things. #8071

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Fensterbank
Copy link
Contributor

Fine uploader is not maintained anymore and we are still stuck with the problem, that image resizing is not working on Firefox for Android since a PR of mine never was brought into a released version.

So I decided to look around for alternatives and found Uppy, a powerful library and successor of FineUploader. Since we are already using Pica for resizing, it's no problem to not have any resizing plugins in Uppy included.

I refactored major parts of the code to fully integrate uppy using a custom Resizer plugin with the following rules:

  • if the file is smaller then the allowed max size, nothing is done and the file is uploaded as it is
  • if the file is bigger then the allowed max size, but the dimensions of the longest edge is smaller than 3072px, we just recompress it as JPEG without resizing, it's propably a huge png file.
  • if the file is bigger then the allowed max size and the dimentions of the longest edge is greater than 3072px, we resize it before uploading.

The whole logic stayed the same, so it's no difference for the user experience.
I also improved a few thing, e.g. the input file buttons are now created on server side via HAML insteald of adding them by JavaScript afterwards.

Unfortunately Uppy is not available in rails-assets, so I had to add the whole package to the codebase. As soon as #8062 is finished, we could change this to use uppy from npm.
But if you have better solutions for this, I'm happy to see them.

@@ -0,0 +1,2 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Uppy=e()}}(function(){var define,module,exports,createModuleFactory=function(e){var t;return function(r){return t||e(t={exports:{},parent:r},t.exports),t.exports}},_$lib_58=createModuleFactory(function(e,t){var r=_$browser_64("socket.io-client");e.exports=t=o;var n=t.managers={};function o(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var o,i=_$url_62(e),s=i.source,a=i.id,l=i.path,u=n[a]&&l in n[a].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||u?(r("ignoring socket cache for %s",s),o=_$manager_59(s,t)):(n[a]||(r("new io instance for %s",s),n[a]=_$manager_59(s,t)),o=n[a]),i.query&&!t.query&&(t.query=i.query),o.socket(i.path,t)}t.protocol=_$socketIoParser_68.protocol,t.connect=o,t.Manager=_$manager_59,t.Socket=_$socket_61}),_$empty_7=createModuleFactory(function(e,t){}),_$buffer_8=createModuleFactory(function(e,t){(function(e){"use strict";t.Buffer=e,t.INSPECT_MAX_BYTES=50;var r=2147483647;function n(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=new Uint8Array(t);return n.__proto__=e.prototype,n}function e(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return o(e,t,r)}function o(t,r,o){if("string"==typeof t)return function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var o=0|u(t,r),i=n(o),s=i.write(t,r);return s!==o&&(i=i.slice(0,s)),i}(t,r);if(ArrayBuffer.isView(t))return a(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(U(t,ArrayBuffer)||t&&U(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');var o;return(o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n)).__proto__=e.prototype,o}(t,r,o);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return e.from(i,r,o);var s=function(t){if(e.isBuffer(t)){var r=0|l(t.length),o=n(r);return 0===o.length?o:(t.copy(o,0,0,r),o)}return void 0!==t.length?"number"!=typeof t.length||D(t.length)?n(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return e.from(t[Symbol.toPrimitive]("string"),r,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function i(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return i(e),n(e<0?0:0|l(e))}function a(e){for(var t=e.length<0?0:0|l(e.length),r=n(t),o=0;o<t;o+=1)r[o]=255&e[o];return r}function l(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function u(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||U(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return R(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return O(t).length;default:if(i)return o?-1:R(t).length;r=(""+r).toLowerCase(),i=!0}}function c(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(t,r,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),D(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=e.from(r,o)),e.isBuffer(r))return 0===r.length?-1:d(t,r,n,o,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):d(t,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var p=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){p=!1;break}if(p)return i}return-1}function _(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(D(a))return s;e[r+s]=a}return s}function h(e,t,r,n){return I(R(t,e.length-r),e,r,n)}function f(e,t,r,n){return I(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function g(e,t,r,n){return f(e,t,r,n)}function m(e,t,r,n){return I(O(t),e,r,n)}function y(e,t,r,n){return I(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function v(e,t,r){return 0===t&&r===e.length?_$base64Js_5.fromByteArray(e):_$base64Js_5.fromByteArray(e.slice(t,r))}function b(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,u=e[o],c=null,p=u>239?4:u>223?3:u>191?2:1;if(o+p<=r)switch(p){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],s=e[o+2],a=e[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&&(c=l)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=p}return function(e){var t=e.length;if(t<=w)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=w));return r}(n)}e.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),e.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(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(e,t,r){return o(e,t,r)},e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,e.alloc=function(e,t,r){return function(e,t,r){return i(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r)},e.allocUnsafe=function(e){return s(e)},e.allocUnsafeSlow=function(e){return s(e)},e.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==e.prototype},e.compare=function(t,r){if(U(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),U(r,Uint8Array)&&(r=e.from(r,r.offset,r.byteLength)),!e.isBuffer(t)||!e.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var n=t.length,o=r.length,i=0,s=Math.min(n,o);i<s;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return n<o?-1:o<n?1:0},e.isEncoding=function(e){switch(String(e).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}},e.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return e.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var o=e.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){var s=t[n];if(U(s,Uint8Array)&&(s=e.from(s)),!e.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,i),i+=s.length}return o},e.byteLength=u,e.prototype._isBuffer=!0,e.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)c(this,t,t+1);return this},e.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)c(this,t,t+3),c(this,t+1,t+2);return this},e.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)c(this,t,t+7),c(this,t+1,t+6),c(this,t+2,t+5),c(this,t+3,t+4);return this},e.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?b(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return v(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},e.prototype.compare=function(t,r,n,o,i){if(U(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),r<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(o>>>=0),a=(n>>>=0)-(r>>>=0),l=Math.min(s,a),u=this.slice(o,i),c=t.slice(r,n),p=0;p<l;++p)if(u[p]!==c[p]){s=u[p],a=c[p];break}return s<a?-1:a<s?1:0},e.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},e.prototype.indexOf=function(e,t,r){return p(this,e,t,r,!0)},e.prototype.lastIndexOf=function(e,t,r){return p(this,e,t,r,!1)},e.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return h(this,e,t,r);case"ascii":return f(this,e,t,r);case"latin1":case"binary":return g(this,e,t,r);case"base64":return m(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function S(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function P(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function E(e,t,r){var n,o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);for(var i="",s=t;s<r;++s)i+=(n=e[s])<16?"0"+n.toString(16):n.toString(16);return i}function C(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function T(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $(t,r,n,o,i,s){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<s)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function k(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,o){return t=+t,r>>>=0,o||k(e,0,r,4),_$ieee754_41.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,o){return t=+t,r>>>=0,o||k(e,0,r,8),_$ieee754_41.write(e,t,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t);var o=this.subarray(t,r);return o.__proto__=e.prototype,o},e.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},e.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},e.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},e.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},e.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},e.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),_$ieee754_41.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),_$ieee754_41.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),_$ieee754_41.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),_$ieee754_41.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||$(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},e.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||$(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},e.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,255,0),this[t]=255&e,t+1},e.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},e.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);$(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},e.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);$(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},e.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},e.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},e.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},e.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},e.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},e.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},e.prototype.copy=function(t,r,n,o){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-n&&(o=t.length-r+n);var i=o-n;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,n,o);else if(this===t&&n<r&&r<o)for(var s=i-1;s>=0;--s)t[s+r]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),r);return i},e.prototype.fill=function(t,r,n,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!e.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;var s;if(r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s<n;++s)this[s]=t;else{var a=e.isBuffer(t)?t:e.from(t,o),l=a.length;if(0===l)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=a[s%l]}return this};var x=/[^+\/0-9A-Za-z-_]/g;function R(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function O(e){return _$base64Js_5.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function U(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function D(e){return e!=e}}).call(this,_$buffer_8({}).Buffer)}),_$browser_54={},cachedSetTimeout,cachedClearTimeout,process=_$browser_54={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,function(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};var _$es6Promise_34={exports:{}};(function(e,t){!function(e,t){"object"==typeof _$es6Promise_34.exports?_$es6Promise_34.exports=t():"function"==typeof define&&define.amd?define(t):e.ES6Promise=t()}(this,function(){"use strict";function r(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,s=void 0,a=function(e,t){h[o]=e,h[o+1]=t,2===(o+=2)&&(s?s(f):b())},l="undefined"!=typeof window?window:void 0,u=l||{},c=u.MutationObserver||u.WebKitMutationObserver,p="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function _(){var e=setTimeout;return function(){return e(f,1)}}var h=new Array(1e3);function f(){for(var e=0;e<o;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;o=0}var g,m,y,v,b=void 0;function w(e,t){var r=this,n=new this.constructor(E);void 0===n[P]&&M(n);var o=r._state;if(o){var i=arguments[o-1];a(function(){return B(o,n,i,r._result)})}else U(r,n,e,t);return n}function S(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(E);return x(t,e),t}p?b=function(){return e.nextTick(f)}:c?(m=0,y=new c(f),v=document.createTextNode(""),y.observe(v,{characterData:!0}),b=function(){v.data=m=++m%2}):d?((g=new MessageChannel).port1.onmessage=f,b=function(){return g.port2.postMessage(0)}):b=void 0===l?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(f)}:_()}catch(t){return _()}}():_();var P=Math.random().toString(36).substring(2);function E(){}var C=void 0,T=1,$=2,k={error:null};function F(e){try{return e.then}catch(error){return k.error=error,k}}function A(e,t,n){t.constructor===e.constructor&&n===w&&t.constructor.resolve===S?function(e,t){t._state===T?O(e,t._result):t._state===$?I(e,t._result):U(t,void 0,function(t){return x(e,t)},function(t){return I(e,t)})}(e,t):n===k?(I(e,k.error),k.error=null):void 0===n?O(e,t):r(n)?function(e,t,r){a(function(e){var n=!1,o=function(r,o,i,s){try{r.call(o,function(r){n||(n=!0,t!==r?x(e,r):O(e,r))},function(t){n||(n=!0,I(e,t))})}catch(a){return a}}(r,t,0,0,e._label);!n&&o&&(n=!0,I(e,o))},e)}(e,t,n):O(e,t)}function x(e,t){var r,n;e===t?I(e,new TypeError("You cannot resolve a promise with itself")):(n=typeof(r=t),null===r||"object"!==n&&"function"!==n?O(e,t):A(e,t,F(t)))}function R(e){e._onerror&&e._onerror(e._result),D(e)}function O(e,t){e._state===C&&(e._result=t,e._state=T,0!==e._subscribers.length&&a(D,e))}function I(e,t){e._state===C&&(e._state=$,e._result=t,a(R,e))}function U(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+T]=r,o[i+$]=n,0===i&&e._state&&a(D,e)}function D(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,s=0;s<t.length;s+=3)n=t[s],o=t[s+r],n?B(r,n,o,i):o(i);e._subscribers.length=0}}function B(e,t,n,o){var i=r(n),s=void 0,a=void 0,l=void 0,u=void 0;if(i){if((s=function(e,t){try{return e(t)}catch(r){return k.error=r,k}}(n,o))===k?(u=!0,a=s.error,s.error=null):l=!0,t===s)return void I(t,new TypeError("A promises callback cannot return that same promise."))}else s=o,l=!0;t._state!==C||(i&&l?x(t,s):u?I(t,a):e===T?O(t,s):e===$&&I(t,s))}var L=0;function M(e){e[P]=L++,e._state=void 0,e._result=void 0,e._subscribers=[]}var N=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(E),this.promise[P]||M(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&O(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===C&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===S){var o=F(e);if(o===w&&e._state!==C)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===j){var i=new r(E);A(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===C&&(this._remaining--,e===$?I(n,r):this._result[t]=r),0===this._remaining&&O(n,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;U(e,void 0,function(e){return r._settledAt(T,t,e)},function(e){return r._settledAt($,t,e)})},e}(),j=function(){function e(t){this[P]=L++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){x(e,t)},function(t){I(e,t)})}catch(r){I(e,r)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var t=this.constructor;return r(e)?this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})}):this.then(e,e)},e}();return j.prototype.then=w,j.all=function(e){return new N(this,e).promise},j.race=function(e){var t=this;return n(e)?new t(function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},j.resolve=S,j.reject=function(e){var t=new this(E);return I(t,e),t},j._setScheduler=function(e){s=e},j._setAsap=function(e){a=e},j._asap=a,j.polyfill=function(){var e=void 0;if(void 0!==t)e=t;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(o){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;if(r){var n=null;try{n=Object.prototype.toString.call(r.resolve())}catch(o){}if("[object Promise]"===n&&!r.cast)return}e.Promise=j},j.Promise=j,j})}).call(this,_$browser_54,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$es6Promise_34=_$es6Promise_34.exports;var _$auto_33=_$es6Promise_34.polyfill(),_$fetchUmd_77={exports:{}},__global_77,factory;__global_77=this,factory=function(e){"use strict";var t={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(t.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&r.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function i(e){return"string"!=typeof e&&(e=String(e)),e}function s(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(r[Symbol.iterator]=function(){return r}),r}function a(e){this.map={},e instanceof a?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function l(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function u(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function c(e){var t=new FileReader,r=u(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(e){var r;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:t.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:t.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():t.arrayBuffer&&t.blob&&(r=e)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):t.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var e,t,r,n=l(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=u(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}a.prototype.append=function(e,t){e=o(e),t=i(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},a.prototype.delete=function(e){delete this.map[o(e)]},a.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},a.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},a.prototype.set=function(e,t){this.map[o(e)]=i(t)},a.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},a.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),s(e)},a.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),s(e)},a.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),s(e)},t.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function h(e,t){var r,n,o=(t=t||{}).body;if(e instanceof h){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new a(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new a(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),_.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new a(t.headers),this.url=t.url||"",this._initBody(e)}h.prototype.clone=function(){return new h(this,{body:this._bodyInit})},d.call(h.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];g.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.DOMException=self.DOMException;try{new e.DOMException}catch(err){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function y(r,n){return new Promise(function(o,i){var s=new h(r,n);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function u(){l.abort()}l.onload=function(){var e,t,r={status:l.status,statusText:l.statusText,headers:(e=l.getAllResponseHeaders()||"",t=new a,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}}),t)};r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var n="response"in l?l.response:l.responseText;o(new g(n,r))},l.onerror=function(){i(new TypeError("Network request failed"))},l.ontimeout=function(){i(new TypeError("Network request failed"))},l.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},l.open(s.method,s.url,!0),"include"===s.credentials?l.withCredentials=!0:"omit"===s.credentials&&(l.withCredentials=!1),"responseType"in l&&t.blob&&(l.responseType="blob"),s.headers.forEach(function(e,t){l.setRequestHeader(t,e)}),s.signal&&(s.signal.addEventListener("abort",u),l.onreadystatechange=function(){4===l.readyState&&s.signal.removeEventListener("abort",u)}),l.send(void 0===s._bodyInit?null:s._bodyInit)})}y.polyfill=!0,self.fetch||(self.fetch=y,self.Headers=a,self.Request=h,self.Response=g),e.Headers=a,e.Request=h,e.Response=g,e.fetch=y,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof _$fetchUmd_77.exports?factory(_$fetchUmd_77.exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory(__global_77.WHATWGFetch={}),_$fetchUmd_77=_$fetchUmd_77.exports;var _$hasProperty_218=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var _$Translator_199=function(){function e(e){var t=this;this.locale={strings:{},pluralize:function(e){return 1===e?0:1}},Array.isArray(e)?e.forEach(function(e){return t._apply(e)}):this._apply(e)}var t=e.prototype;return t._apply=function(e){if(e&&e.strings){var t=this.locale;this.locale=_extends({},t,{strings:_extends({},t.strings,e.strings)}),this.locale.pluralize=e.pluralize||t.pluralize}},t.interpolate=function(e,t){var r=String.prototype,n=r.split,o=r.replace,i=/\$/g,s=[e];for(var a in t)if("_"!==a&&_$hasProperty_218(t,a)){var l=t[a];"string"==typeof l&&(l=o.call(t[a],i,"$$$$")),s=u(s,new RegExp("%\\{"+a+"\\}","g"),l)}return s;function u(e,t,r){var o=[];return e.forEach(function(e){n.call(e,t).forEach(function(e,t,n){""!==e&&o.push(e),t<n.length-1&&o.push(r)})}),o}},t.translate=function(e,t){return this.translateArray(e,t).join("")},t.translateArray=function(e,t){if(t&&void 0!==t.smart_count){var r=this.locale.pluralize(t.smart_count);return this.interpolate(this.locale.strings[e][r],t)}return this.interpolate(this.locale.strings[e],t)},e}(),_$namespaceEmitter_49=function(){var e={},t=e._fns={};return e.emit=function(e,r,n,o,i,s,a){var l=function(e){for(var r=t[e]?t[e]:[],n=e.indexOf(":"),o=-1===n?[e]:[e.substring(0,n),e.substring(n+1)],i=Object.keys(t),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(r=r.concat(t[l])),2===o.length&&o[0]===l){r=r.concat(t[l]);break}}return r}(e);l.length&&function(e,t,r){for(var n=0,o=t.length;n<o&&t[n];n++)t[n].event=e,t[n].apply(t[n],r)}(e,l,[r,n,o,i,s,a])},e.on=function(e,r){t[e]||(t[e]=[]),t[e].push(r)},e.once=function(t,r){this.on(t,function n(){r.apply(this,arguments),e.off(t,n)})},e.off=function(e,t){var r=[];if(e&&t)for(var n=this._fns[e],o=0,i=n?n.length:0;o<i;o++)n[o]!==t&&r.push(n[o]);r.length?this._fns[e]=r:delete this._fns[e]},e},_$pad_16=function(e,t){var r="000000000"+e;return r.substr(r.length-t)},env="object"==typeof window?window:self,globalCount=Object.keys(env).length,clientId=_$pad_16(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+globalCount.toString(36),4),_$fingerprintBrowser_14=function(){return clientId},getRandomValue,crypto=window.crypto||window.msCrypto;if(crypto){var lim=Math.pow(2,32)-1;getRandomValue=function(){return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0]/lim)}}else getRandomValue=Math.random;var _$getRandomValue_15=getRandomValue,_$cuid_13={},c=0,blockSize=4,base=36,discreteValues=Math.pow(base,blockSize);function randomBlock(){return _$pad_16((_$getRandomValue_15()*discreteValues<<0).toString(base),blockSize)}function safeCounter(){return c=c<discreteValues?c:0,++c-1}function cuid(){return"c"+(new Date).getTime().toString(base)+_$pad_16(safeCounter().toString(base),blockSize)+_$fingerprintBrowser_14()+(randomBlock()+randomBlock())}cuid.slug=function(){var e=(new Date).getTime().toString(36),t=safeCounter().toString(36).slice(-4),r=_$fingerprintBrowser_14().slice(0,1)+_$fingerprintBrowser_14().slice(-1),n=randomBlock().slice(-2);return e.slice(-2)+t+r+n},cuid.isCuid=function(e){return"string"==typeof e&&!!e.startsWith("c")},cuid.isSlug=function(e){if("string"!=typeof e)return!1;var t=e.length;return t>=7&&t<=10},cuid.fingerprint=_$fingerprintBrowser_14,_$cuid_13=cuid;var _$lodashThrottle_46={};(function(e){var t="Expected a function",r=NaN,n="[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 e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,p=u||c||Function("return this")(),d=Object.prototype.toString,_=Math.max,h=Math.min,f=function(){return p.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==n}(e))return r;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var u=s.test(e);return u||a.test(e)?l(e.slice(2),u?2:8):i.test(e)?r:+e}_$lodashThrottle_46=function(e,r,n){var o=!0,i=!0;if("function"!=typeof e)throw new TypeError(t);return g(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),function(e,r,n){var o,i,s,a,l,u,c=0,p=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError(t);function v(t){var r=o,n=i;return o=i=void 0,c=t,a=e.apply(n,r)}function b(e){var t=e-u;return void 0===u||t>=r||t<0||d&&e-c>=s}function w(){var e=f();if(b(e))return S(e);l=setTimeout(w,function(e){var t=r-(e-u);return d?h(t,s-(e-c)):t}(e))}function S(e){return l=void 0,y&&o?v(e):(o=i=void 0,a)}function P(){var e=f(),t=b(e);if(o=arguments,i=this,u=e,t){if(void 0===l)return function(e){return c=e,l=setTimeout(w,r),p?v(e):a}(u);if(d)return l=setTimeout(w,r),v(u)}return void 0===l&&(l=setTimeout(w,r)),a}return r=m(r)||0,g(n)&&(p=!!n.leading,s=(d="maxWait"in n)?_(m(n.maxWait)||0,r):s,y="trailing"in n?!!n.trailing:y),P.cancel=function(){void 0!==l&&clearTimeout(l),c=0,o=u=i=l=void 0},P.flush=function(){return void 0===l?a:S(f())},P}(e,r,{leading:o,maxWait:r,trailing:i})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$prettyBytes_225=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/Math.pow(1024,n));var o=r[n];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+o:(t?"-":"")+e.toFixed(1)+" "+o},_$wildcard_78={};function WildcardMatcher(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}WildcardMatcher.prototype.match=function(e){var t,r,n=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;n&&t<i;t++)"*"!==o[t]&&(n=t<r.length&&o[t]===r[t]);n=n&&r}else n=!1;else if("function"==typeof e.splice)for(n=[],t=e.length;t--;)this.match(e[t])&&(n[n.length]=e[t]);else if("object"==typeof e)for(var s in n={},e)this.match(s)&&(n[s]=e[s]);return n},_$wildcard_78=function(e,t,r){var n=new WildcardMatcher(e,r||/[\/\.]/);return void 0!==t?n.match(t):n};var reMimePartSplit=/[\/\+\.]/,_$mimeMatch_48=function(e,t){function r(t){var r=_$wildcard_78(t,e,reMimePartSplit);return r&&r.length>=2}return t?r(t.split(";")[0]):r},_$package_164={version:"1.2.0"},_$lib_163={};function ___extends_163(){return(___extends_163=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var DefaultStore=function(){function e(){this.state={},this.callbacks=[]}var t=e.prototype;return t.getState=function(){return this.state},t.setState=function(e){var t=___extends_163({},this.state),r=___extends_163({},this.state,e);this.state=r,this._publish(t,r,e)},t.subscribe=function(e){var t=this;return this.callbacks.push(e),function(){t.callbacks.splice(t.callbacks.indexOf(e),1)}},t._publish=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.callbacks.forEach(function(e){e.apply(void 0,t)})},e}();DefaultStore.VERSION=_$package_164.version,_$lib_163=function(){return new DefaultStore};var _$getFileNameAndExtension_212=function(e){var t=/(?:\.([^.]+))?$/.exec(e)[1];return{name:e.replace("."+t,""),extension:t}},_$mimeTypes_224={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",heic:"image/heic",heif:"image/heif",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",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf"},_$getFileType_213=function(e){var t=e.name?_$getFileNameAndExtension_212(e.name).extension:null;return t=t?t.toLowerCase():null,e.type?e.type:t&&_$mimeTypes_224[t]?_$mimeTypes_224[t]:"application/octet-stream"};function encodeFilename(e){var t="";return e.replace(/[^A-Z0-9]/gi,function(e){return t+="-"+function(e){return e.charCodeAt(0).toString(32)}(e),"/"})+t}var _$generateFileID_205=function(e){return["uppy",e.name?encodeFilename(e.name.toLowerCase()):"",e.type,e.meta&&e.meta.relativePath?encodeFilename(e.meta.relativePath.toLowerCase()):"",e.data.size,e.data.lastModified].filter(function(e){return e}).join("-")},_$supportsUploadProgress_95=function(e){if(null==e&&(e="undefined"!=typeof navigator?navigator.userAgent:null),!e)return!0;var t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;var r=t[1].split("."),n=r[0],o=r[1];return n=parseInt(n,10),o=parseInt(o,10),n<15||15===n&&o<15063||n>18||18===n&&o>=18218};function __pad_217(e){return 2!==e.length?0+e:e}var _$getTimeStamp_217=function(){var e=new Date;return __pad_217(e.getHours().toString())+":"+__pad_217(e.getMinutes().toString())+":"+__pad_217(e.getSeconds().toString())},debugLogger={debug:function(){for(var e=console.debug||console.log,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e.call.apply(e,[console,"[Uppy] ["+_$getTimeStamp_217()+"]"].concat(r))},warn:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(e=console).warn.apply(e,["[Uppy] ["+_$getTimeStamp_217()+"]"].concat(r))},error:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(e=console).error.apply(e,["[Uppy] ["+_$getTimeStamp_217()+"]"].concat(r))}},_$loggers_94={nullLogger:{debug:function(){},warn:function(){},error:function(){}},debugLogger:debugLogger},_$preact_53={exports:{}};!function(){"use strict";function e(){}function t(t,r){var n,o,i,s,a=S;for(s=arguments.length;s-- >2;)w.push(arguments[s]);for(r&&null!=r.children&&(w.length||w.push(r.children),delete r.children);w.length;)if((o=w.pop())&&void 0!==o.pop)for(s=o.length;s--;)w.push(o[s]);else"boolean"==typeof o&&(o=null),(i="function"!=typeof t)&&(null==o?o="":"number"==typeof o?o=String(o):"string"!=typeof o&&(i=!1)),i&&n?a[a.length-1]+=o:a===S?a=[o]:a.push(o),n=i;var l=new e;return l.nodeName=t,l.children=a,l.attributes=null==r?void 0:r,l.key=null==r?void 0:r.key,void 0!==b.vnode&&b.vnode(l),l}function r(e,t){for(var r in t)e[r]=t[r];return e}function n(e){!e.__d&&(e.__d=!0)&&1==C.push(e)&&(b.debounceRendering||P)(o)}function o(){var e,t=C;for(C=[];e=t.pop();)e.__d&&m(e)}function i(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function s(e){var t=r({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function a(e){var t=e.parentNode;t&&t.removeChild(e)}function l(e,t,r,n,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)r&&r(null),n&&n(e);else if("class"!==t||o)if("style"===t){if(n&&"string"!=typeof n&&"string"!=typeof r||(e.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof r)for(var i in r)i in n||(e.style[i]="");for(var i in n)e.style[i]="number"==typeof n[i]&&!1===E.test(i)?n[i]+"px":n[i]}}else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),n?r||e.addEventListener(t,u,s):e.removeEventListener(t,u,s),(e.__l||(e.__l={}))[t]=n}else if("list"!==t&&"type"!==t&&!o&&t in e)!function(e,t,r){try{e[t]=r}catch(n){}}(e,t,null==n?"":n),null!=n&&!1!==n||e.removeAttribute(t);else{var a=o&&t!==(t=t.replace(/^xlink:?/,""));null==n||!1===n?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof n&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):e.setAttribute(t,n))}else e.className=n||""}function u(e){return this.__l[e.type](b.event&&b.event(e)||e)}function c(){for(var e;e=T.pop();)b.afterMount&&b.afterMount(e),e.componentDidMount&&e.componentDidMount()}function p(e,t,r,n,o,u){$++||(k=null!=o&&void 0!==o.ownerSVGElement,F=null!=e&&!("__preactattr_"in e));var p=function e(t,r,n,o,u){var c=t,p=k;if(null!=r&&"boolean"!=typeof r||(r=""),"string"==typeof r||"number"==typeof r)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||u)?t.nodeValue!=r&&(t.nodeValue=r):(c=document.createTextNode(r),t&&(t.parentNode&&t.parentNode.replaceChild(c,t),d(t,!0))),c.__preactattr_=!0,c;var _,f,m=r.nodeName;if("function"==typeof m)return function(e,t,r,n){for(var o=e&&e._component,i=o,a=e,l=o&&e._componentConstructor===t.nodeName,u=l,c=s(t);o&&!u&&(o=o.__u);)u=o.constructor===t.nodeName;return o&&u&&(!n||o._component)?(g(o,c,3,r,n),e=o.base):(i&&!l&&(y(i),e=a=null),o=h(t.nodeName,c,r),e&&!o.__b&&(o.__b=e,a=null),g(o,c,1,r,n),e=o.base,a&&e!==a&&(a._component=null,d(a,!1))),e}(t,r,n,o);if(k="svg"===m||"foreignObject"!==m&&k,m=String(m),(!t||!i(t,m))&&(_=m,(f=k?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_)).__n=_,c=f,t)){for(;t.firstChild;)c.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(c,t),d(t,!0)}var v=c.firstChild,b=c.__preactattr_,w=r.children;if(null==b){b=c.__preactattr_={};for(var S=c.attributes,P=S.length;P--;)b[S[P].name]=S[P].value}return!F&&w&&1===w.length&&"string"==typeof w[0]&&null!=v&&void 0!==v.splitText&&null==v.nextSibling?v.nodeValue!=w[0]&&(v.nodeValue=w[0]):(w&&w.length||null!=v)&&function(t,r,n,o,s){var l,u,c,p,_,h,f,g,m=t.childNodes,y=[],v={},b=0,w=0,S=m.length,P=0,E=r?r.length:0;if(0!==S)for(var C=0;C<S;C++){var T=m[C],$=T.__preactattr_,k=E&&$?T._component?T._component.__k:$.key:null;null!=k?(b++,v[k]=T):($||(void 0!==T.splitText?!s||T.nodeValue.trim():s))&&(y[P++]=T)}if(0!==E)for(var C=0;C<E;C++){p=r[C],_=null;var k=p.key;if(null!=k)b&&void 0!==v[k]&&(_=v[k],v[k]=void 0,b--);else if(!_&&w<P)for(l=w;l<P;l++)if(void 0!==y[l]&&(h=u=y[l],g=s,"string"==typeof(f=p)||"number"==typeof f?void 0!==h.splitText:"string"==typeof f.nodeName?!h._componentConstructor&&i(h,f.nodeName):g||h._componentConstructor===f.nodeName)){_=u,y[l]=void 0,l===P-1&&P--,l===w&&w++;break}_=e(_,p,n,o),c=m[C],_&&_!==t&&_!==c&&(null==c?t.appendChild(_):_===c.nextSibling?a(c):t.insertBefore(_,c))}if(b)for(var C in v)void 0!==v[C]&&d(v[C],!1);for(;w<=P;)void 0!==(_=y[P--])&&d(_,!1)}(c,w,n,o,F||null!=b.dangerouslySetInnerHTML),function(e,t,r){var n;for(n in r)t&&null!=t[n]||null==r[n]||l(e,n,r[n],r[n]=void 0,k);for(n in t)"children"===n||"innerHTML"===n||n in r&&t[n]===("value"===n||"checked"===n?e[n]:r[n])||l(e,n,r[n],r[n]=t[n],k)}(c,r.attributes,b),k=p,c}(e,t,r,n,u);return o&&p.parentNode!==o&&o.appendChild(p),--$||(F=!1,u||c()),p}function d(e,t){var r=e._component;r?y(r):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||a(e),_(e))}function _(e){for(e=e.lastChild;e;){var t=e.previousSibling;d(e,!0),e=t}}function h(e,t,r){var n,o=A[e.name];if(e.prototype&&e.prototype.render?(n=new e(t,r),v.call(n,t,r)):((n=new v(t,r)).constructor=e,n.render=f),o)for(var i=o.length;i--;)if(o[i].constructor===e){n.__b=o[i].__b,o.splice(i,1);break}return n}function f(e,t,r){return this.constructor(e,r)}function g(e,t,r,o,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==r&&(1!==r&&!1===b.syncComponentUpdates&&e.base?n(e):m(e,1,i)),e.__r&&e.__r(e))}function m(e,t,n,o){if(!e.__x){var i,a,l,u=e.props,_=e.state,f=e.context,v=e.__p||u,w=e.__s||_,S=e.__c||f,P=e.base,E=e.__b,C=P||E,k=e._component,F=!1;if(P&&(e.props=v,e.state=w,e.context=S,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(u,_,f)?F=!0:e.componentWillUpdate&&e.componentWillUpdate(u,_,f),e.props=u,e.state=_,e.context=f),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!F){i=e.render(u,_,f),e.getChildContext&&(f=r(r({},f),e.getChildContext()));var A,x,R=i&&i.nodeName;if("function"==typeof R){var O=s(i);(a=k)&&a.constructor===R&&O.key==a.__k?g(a,O,1,f,!1):(A=a,e._component=a=h(R,O,f),a.__b=a.__b||E,a.__u=e,g(a,O,0,f,!1),m(a,1,n,!0)),x=a.base}else l=C,(A=k)&&(l=e._component=null),(C||1===t)&&(l&&(l._component=null),x=p(l,i,f,n||!P,C&&C.parentNode,!0));if(C&&x!==C&&a!==k){var I=C.parentNode;I&&x!==I&&(I.replaceChild(x,C),A||(C._component=null,d(C,!1)))}if(A&&y(A),e.base=x,x&&!o){for(var U=e,D=e;D=D.__u;)(U=D).base=x;x._component=U,x._componentConstructor=U.constructor}}if(!P||n?T.unshift(e):F||(e.componentDidUpdate&&e.componentDidUpdate(v,w,S),b.afterUpdate&&b.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);$||o||c()}}function y(e){b.beforeUnmount&&b.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;r?y(r):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,a(t),function(e){var t=e.constructor.name;(A[t]||(A[t]=[])).push(e)}(e),_(t)),e.__r&&e.__r(null)}function v(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var b={},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,C=[],T=[],$=0,k=!1,F=!1,A={};r(v.prototype,{setState:function(e,t){var o=this.state;this.__s||(this.__s=r({},o)),r(o,"function"==typeof e?e(o,this.props):e),t&&(this.__h=this.__h||[]).push(t),n(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),m(this,2)},render:function(){}});var x={h:t,createElement:t,cloneElement:function(e,n){return t(e.nodeName,r(r({},e.attributes),n),arguments.length>2?[].slice.call(arguments,2):e.children)},Component:v,render:function(e,t,r){return p(r,e,{},!1,t,!1)},rerender:o,options:b};_$preact_53.exports=x}(),_$preact_53=_$preact_53.exports;var _$isDOMElement_219=function(e){return e&&"object"==typeof e&&e.nodeType===Node.ELEMENT_NODE},_$findDOMElement_204=function(e,t){return void 0===t&&(t=document),"string"==typeof e?t.querySelector(e):"object"==typeof e&&_$isDOMElement_219(e)?e:void 0};function ___extends_92(){return(___extends_92=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var _$Plugin_92=function(){function e(e,t){this.uppy=e,this.opts=t||{},this.update=this.update.bind(this),this.mount=this.mount.bind(this),this.install=this.install.bind(this),this.uninstall=this.uninstall.bind(this)}var t=e.prototype;return t.getPluginState=function(){return this.uppy.getState().plugins[this.id]||{}},t.setPluginState=function(e){var t,r=this.uppy.getState().plugins;this.uppy.setState({plugins:___extends_92({},r,(t={},t[this.id]=___extends_92({},r[this.id],{},e),t))})},t.update=function(e){void 0!==this.el&&this._updateUI&&this._updateUI(e)},t.afterUpdate=function(){},t.onMount=function(){},t.mount=function(t,r){var n,o,i,s,a=this,l=r.id,u=_$findDOMElement_204(t);if(u)return this.isTargetDOMEl=!0,this.rerender=function(e){a.uppy.getPlugin(a.id)&&(a.el=_$preact_53.render(a.render(e),u,a.el),a.afterUpdate())},this._updateUI=(n=this.rerender,o=null,i=null,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i=t,o||(o=Promise.resolve().then(function(){return o=null,n.apply(void 0,i)})),o}),this.uppy.log("Installing "+l+" to a DOM element '"+t+"'"),this.opts.replaceTargetContent&&(u.innerHTML=""),this.el=_$preact_53.render(this.render(this.uppy.getState()),u),this.onMount(),this.el;if("object"==typeof t&&t instanceof e)s=t;else if("function"==typeof t){var c=t;this.uppy.iteratePlugins(function(e){if(e instanceof c)return s=e,!1})}if(s)return this.uppy.log("Installing "+l+" to "+s.id),this.parent=s,this.el=s.addTarget(r),this.onMount(),this.el;throw this.uppy.log("Not installing "+l),new Error("Invalid target option given to "+l+". 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.render=function(e){throw new Error("Extend the render method to add your plugin to a DOM element")},t.addTarget=function(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},t.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.install=function(){},t.uninstall=function(){this.unmount()},e}(),_$package_96={version:"1.5.1"},_$lib_93={};function ___extends_93(){return(___extends_93=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,e)})(e)}function _construct(e,t,r){return(_construct=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_setPrototypeOf(o,r.prototype),o}).apply(null,arguments)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var nullLogger=_$loggers_94.nullLogger,__debugLogger_93=_$loggers_94.debugLogger,RestrictionError=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).isRestriction=!0,t}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(_wrapNativeSuper(Error)),Uppy=function(){function e(e){var t=this;this.defaultLocale={strings:{youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files",2:"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",2:"You have to select at least %{smart_count} files"},exceedsSize:"This file exceeds maximum allowed size of",youCanOnlyUploadFileTypes:"You can only upload: %{types}",companionError:"Connection with Companion failed",companionAuthError:"Authorization required",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}",2:"Select %{smart_count}"},selectAllFilesFromFolderNamed:"Select all files from folder %{name}",unselectAllFilesFromFolderNamed:"Unselect all files from folder %{name}",selectFileNamed:"Select file %{name}",unselectFileNamed:"Unselect file %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",emptyFolderAdded:"No files were added from empty folder",folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}",2:"Added %{smart_count} files from %{folder}"}}};var r={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,debug:!1,restrictions:{maxFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null},meta:{},onBeforeFileAdded:function(e,t){return e},onBeforeUpload:function(e){return e},store:_$lib_163(),logger:nullLogger};if(this.opts=___extends_93({},r,e),this.opts.restrictions=___extends_93({},r.restrictions,this.opts.restrictions),e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=__debugLogger_93),this.log("Using Core v"+this.constructor.VERSION),this.opts.restrictions.allowedFileTypes&&null!==this.opts.restrictions.allowedFileTypes&&!Array.isArray(this.opts.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");this.translator=new _$Translator_199([this.defaultLocale,this.opts.locale]),this.locale=this.translator.locale,this.i18n=this.translator.translate.bind(this.translator),this.i18nArray=this.translator.translateArray.bind(this.translator),this.plugins={},this.getState=t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file lacks a license header. Please use an unminified build of said library (our pipeline compresses it anyway), and leave the license header intact. Also, third-party dependencies belong into vendor/assets/javascripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the official vendor files contained all plugins while we only use @uppy/core and @uppy/xhr-upload, I created a custom bundle, included a license header and put it into vendor/assets/javascripts.

@@ -0,0 +1,2 @@
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Uppy=e()}}(function(){var define,module,exports,createModuleFactory=function(e){var t;return function(r){return t||e(t={exports:{},parent:r},t.exports),t.exports}},_$lib_58=createModuleFactory(function(e,t){var r=_$browser_64("socket.io-client");e.exports=t=o;var n=t.managers={};function o(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var o,i=_$url_62(e),s=i.source,a=i.id,l=i.path,u=n[a]&&l in n[a].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||u?(r("ignoring socket cache for %s",s),o=_$manager_59(s,t)):(n[a]||(r("new io instance for %s",s),n[a]=_$manager_59(s,t)),o=n[a]),i.query&&!t.query&&(t.query=i.query),o.socket(i.path,t)}t.protocol=_$socketIoParser_68.protocol,t.connect=o,t.Manager=_$manager_59,t.Socket=_$socket_61}),_$empty_7=createModuleFactory(function(e,t){}),_$buffer_8=createModuleFactory(function(e,t){(function(e){"use strict";t.Buffer=e,t.INSPECT_MAX_BYTES=50;var r=2147483647;function n(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=new Uint8Array(t);return n.__proto__=e.prototype,n}function e(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return o(e,t,r)}function o(t,r,o){if("string"==typeof t)return function(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!e.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var o=0|u(t,r),i=n(o),s=i.write(t,r);return s!==o&&(i=i.slice(0,s)),i}(t,r);if(ArrayBuffer.isView(t))return a(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(U(t,ArrayBuffer)||t&&U(t.buffer,ArrayBuffer))return function(t,r,n){if(r<0||t.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');var o;return(o=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n)).__proto__=e.prototype,o}(t,r,o);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return e.from(i,r,o);var s=function(t){if(e.isBuffer(t)){var r=0|l(t.length),o=n(r);return 0===o.length?o:(t.copy(o,0,0,r),o)}return void 0!==t.length?"number"!=typeof t.length||D(t.length)?n(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return e.from(t[Symbol.toPrimitive]("string"),r,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function i(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return i(e),n(e<0?0:0|l(e))}function a(e){for(var t=e.length<0?0:0|l(e.length),r=n(t),o=0;o<t;o+=1)r[o]=255&e[o];return r}function l(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function u(t,r){if(e.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||U(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return R(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return O(t).length;default:if(i)return o?-1:R(t).length;r=(""+r).toLowerCase(),i=!0}}function c(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(t,r,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),D(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=e.from(r,o)),e.isBuffer(r))return 0===r.length?-1:d(t,r,n,o,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):d(t,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var c=-1;for(i=r;i<a;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var p=!0,d=0;d<l;d++)if(u(e,i+d)!==u(t,d)){p=!1;break}if(p)return i}return-1}function _(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(D(a))return s;e[r+s]=a}return s}function h(e,t,r,n){return I(R(t,e.length-r),e,r,n)}function f(e,t,r,n){return I(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function g(e,t,r,n){return f(e,t,r,n)}function m(e,t,r,n){return I(O(t),e,r,n)}function y(e,t,r,n){return I(function(e,t){for(var r,n,o,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function v(e,t,r){return 0===t&&r===e.length?_$base64Js_5.fromByteArray(e):_$base64Js_5.fromByteArray(e.slice(t,r))}function b(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,u=e[o],c=null,p=u>239?4:u>223?3:u>191?2:1;if(o+p<=r)switch(p){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(l=(15&u)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],s=e[o+2],a=e[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&&(c=l)}null===c?(c=65533,p=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=p}return function(e){var t=e.length;if(t<=w)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=w));return r}(n)}e.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),e.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(e.prototype,"parent",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.buffer}}),Object.defineProperty(e.prototype,"offset",{enumerable:!0,get:function(){if(e.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),e.poolSize=8192,e.from=function(e,t,r){return o(e,t,r)},e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,e.alloc=function(e,t,r){return function(e,t,r){return i(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}(e,t,r)},e.allocUnsafe=function(e){return s(e)},e.allocUnsafeSlow=function(e){return s(e)},e.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==e.prototype},e.compare=function(t,r){if(U(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),U(r,Uint8Array)&&(r=e.from(r,r.offset,r.byteLength)),!e.isBuffer(t)||!e.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var n=t.length,o=r.length,i=0,s=Math.min(n,o);i<s;++i)if(t[i]!==r[i]){n=t[i],o=r[i];break}return n<o?-1:o<n?1:0},e.isEncoding=function(e){switch(String(e).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}},e.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return e.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var o=e.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){var s=t[n];if(U(s,Uint8Array)&&(s=e.from(s)),!e.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,i),i+=s.length}return o},e.byteLength=u,e.prototype._isBuffer=!0,e.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)c(this,t,t+1);return this},e.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)c(this,t,t+3),c(this,t+1,t+2);return this},e.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)c(this,t,t+7),c(this,t+1,t+6),c(this,t+2,t+5),c(this,t+3,t+4);return this},e.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?b(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return E(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return v(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},e.prototype.toLocaleString=e.prototype.toString,e.prototype.equals=function(t){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===e.compare(this,t)},e.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},e.prototype.compare=function(t,r,n,o,i){if(U(t,Uint8Array)&&(t=e.from(t,t.offset,t.byteLength)),!e.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),r<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(o>>>=0),a=(n>>>=0)-(r>>>=0),l=Math.min(s,a),u=this.slice(o,i),c=t.slice(r,n),p=0;p<l;++p)if(u[p]!==c[p]){s=u[p],a=c[p];break}return s<a?-1:a<s?1:0},e.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},e.prototype.indexOf=function(e,t,r){return p(this,e,t,r,!0)},e.prototype.lastIndexOf=function(e,t,r){return p(this,e,t,r,!1)},e.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return h(this,e,t,r);case"ascii":return f(this,e,t,r);case"latin1":case"binary":return g(this,e,t,r);case"base64":return m(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function S(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function P(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function E(e,t,r){var n,o=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);for(var i="",s=t;s<r;++s)i+=(n=e[s])<16?"0"+n.toString(16):n.toString(16);return i}function C(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function T(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $(t,r,n,o,i,s){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<s)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function k(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,o){return t=+t,r>>>=0,o||k(e,0,r,4),_$ieee754_41.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,o){return t=+t,r>>>=0,o||k(e,0,r,8),_$ieee754_41.write(e,t,r,n,52,8),r+8}e.prototype.slice=function(t,r){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t);var o=this.subarray(t,r);return o.__proto__=e.prototype,o},e.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},e.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},e.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},e.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||T(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},e.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},e.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},e.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),_$ieee754_41.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),_$ieee754_41.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),_$ieee754_41.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),_$ieee754_41.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||$(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},e.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||$(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},e.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,255,0),this[t]=255&e,t+1},e.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},e.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);$(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},e.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);$(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+r},e.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},e.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},e.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},e.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},e.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},e.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},e.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},e.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},e.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},e.prototype.copy=function(t,r,n,o){if(!e.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),o||0===o||(o=this.length),r>=t.length&&(r=t.length),r||(r=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-r<o-n&&(o=t.length-r+n);var i=o-n;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,n,o);else if(this===t&&n<r&&r<o)for(var s=i-1;s>=0;--s)t[s+r]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,o),r);return i},e.prototype.fill=function(t,r,n,o){if("string"==typeof t){if("string"==typeof r?(o=r,r=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!e.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;var s;if(r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=r;s<n;++s)this[s]=t;else{var a=e.isBuffer(t)?t:e.from(t,o),l=a.length;if(0===l)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=a[s%l]}return this};var x=/[^+\/0-9A-Za-z-_]/g;function R(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function O(e){return _$base64Js_5.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function U(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function D(e){return e!=e}}).call(this,_$buffer_8({}).Buffer)}),_$browser_54={},cachedSetTimeout,cachedClearTimeout,process=_$browser_54={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,function(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};var _$es6Promise_34={exports:{}};(function(e,t){!function(e,t){"object"==typeof _$es6Promise_34.exports?_$es6Promise_34.exports=t():"function"==typeof define&&define.amd?define(t):e.ES6Promise=t()}(this,function(){"use strict";function r(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o=0,i=void 0,s=void 0,a=function(e,t){h[o]=e,h[o+1]=t,2===(o+=2)&&(s?s(f):b())},l="undefined"!=typeof window?window:void 0,u=l||{},c=u.MutationObserver||u.WebKitMutationObserver,p="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function _(){var e=setTimeout;return function(){return e(f,1)}}var h=new Array(1e3);function f(){for(var e=0;e<o;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;o=0}var g,m,y,v,b=void 0;function w(e,t){var r=this,n=new this.constructor(E);void 0===n[P]&&M(n);var o=r._state;if(o){var i=arguments[o-1];a(function(){return B(o,n,i,r._result)})}else U(r,n,e,t);return n}function S(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(E);return x(t,e),t}p?b=function(){return e.nextTick(f)}:c?(m=0,y=new c(f),v=document.createTextNode(""),y.observe(v,{characterData:!0}),b=function(){v.data=m=++m%2}):d?((g=new MessageChannel).port1.onmessage=f,b=function(){return g.port2.postMessage(0)}):b=void 0===l?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(f)}:_()}catch(t){return _()}}():_();var P=Math.random().toString(36).substring(2);function E(){}var C=void 0,T=1,$=2,k={error:null};function F(e){try{return e.then}catch(error){return k.error=error,k}}function A(e,t,n){t.constructor===e.constructor&&n===w&&t.constructor.resolve===S?function(e,t){t._state===T?O(e,t._result):t._state===$?I(e,t._result):U(t,void 0,function(t){return x(e,t)},function(t){return I(e,t)})}(e,t):n===k?(I(e,k.error),k.error=null):void 0===n?O(e,t):r(n)?function(e,t,r){a(function(e){var n=!1,o=function(r,o,i,s){try{r.call(o,function(r){n||(n=!0,t!==r?x(e,r):O(e,r))},function(t){n||(n=!0,I(e,t))})}catch(a){return a}}(r,t,0,0,e._label);!n&&o&&(n=!0,I(e,o))},e)}(e,t,n):O(e,t)}function x(e,t){var r,n;e===t?I(e,new TypeError("You cannot resolve a promise with itself")):(n=typeof(r=t),null===r||"object"!==n&&"function"!==n?O(e,t):A(e,t,F(t)))}function R(e){e._onerror&&e._onerror(e._result),D(e)}function O(e,t){e._state===C&&(e._result=t,e._state=T,0!==e._subscribers.length&&a(D,e))}function I(e,t){e._state===C&&(e._state=$,e._result=t,a(R,e))}function U(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+T]=r,o[i+$]=n,0===i&&e._state&&a(D,e)}function D(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,s=0;s<t.length;s+=3)n=t[s],o=t[s+r],n?B(r,n,o,i):o(i);e._subscribers.length=0}}function B(e,t,n,o){var i=r(n),s=void 0,a=void 0,l=void 0,u=void 0;if(i){if((s=function(e,t){try{return e(t)}catch(r){return k.error=r,k}}(n,o))===k?(u=!0,a=s.error,s.error=null):l=!0,t===s)return void I(t,new TypeError("A promises callback cannot return that same promise."))}else s=o,l=!0;t._state!==C||(i&&l?x(t,s):u?I(t,a):e===T?O(t,s):e===$&&I(t,s))}var L=0;function M(e){e[P]=L++,e._state=void 0,e._result=void 0,e._subscribers=[]}var N=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(E),this.promise[P]||M(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?O(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&O(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===C&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===S){var o=F(e);if(o===w&&e._state!==C)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===j){var i=new r(E);A(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===C&&(this._remaining--,e===$?I(n,r):this._result[t]=r),0===this._remaining&&O(n,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;U(e,void 0,function(e){return r._settledAt(T,t,e)},function(e){return r._settledAt($,t,e)})},e}(),j=function(){function e(t){this[P]=L++,this._result=this._state=void 0,this._subscribers=[],E!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){x(e,t)},function(t){I(e,t)})}catch(r){I(e,r)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var t=this.constructor;return r(e)?this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})}):this.then(e,e)},e}();return j.prototype.then=w,j.all=function(e){return new N(this,e).promise},j.race=function(e){var t=this;return n(e)?new t(function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},j.resolve=S,j.reject=function(e){var t=new this(E);return I(t,e),t},j._setScheduler=function(e){s=e},j._setAsap=function(e){a=e},j._asap=a,j.polyfill=function(){var e=void 0;if(void 0!==t)e=t;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(o){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;if(r){var n=null;try{n=Object.prototype.toString.call(r.resolve())}catch(o){}if("[object Promise]"===n&&!r.cast)return}e.Promise=j},j.Promise=j,j})}).call(this,_$browser_54,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),_$es6Promise_34=_$es6Promise_34.exports;var _$auto_33=_$es6Promise_34.polyfill(),_$fetchUmd_77={exports:{}},__global_77,factory;__global_77=this,factory=function(e){"use strict";var t={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(t.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&r.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function i(e){return"string"!=typeof e&&(e=String(e)),e}function s(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(r[Symbol.iterator]=function(){return r}),r}function a(e){this.map={},e instanceof a?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function l(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function u(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function c(e){var t=new FileReader,r=u(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(e){var r;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:t.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:t.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():t.arrayBuffer&&t.blob&&(r=e)&&DataView.prototype.isPrototypeOf(r)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):t.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=l(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(c)}),this.text=function(){var e,t,r,n=l(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=u(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}a.prototype.append=function(e,t){e=o(e),t=i(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},a.prototype.delete=function(e){delete this.map[o(e)]},a.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},a.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},a.prototype.set=function(e,t){this.map[o(e)]=i(t)},a.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},a.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),s(e)},a.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),s(e)},a.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),s(e)},t.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function h(e,t){var r,n,o=(t=t||{}).body;if(e instanceof h){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new a(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new a(t.headers)),this.method=(n=(r=t.method||this.method||"GET").toUpperCase(),_.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new a(t.headers),this.url=t.url||"",this._initBody(e)}h.prototype.clone=function(){return new h(this,{body:this._bodyInit})},d.call(h.prototype),d.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];g.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.DOMException=self.DOMException;try{new e.DOMException}catch(err){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function y(r,n){return new Promise(function(o,i){var s=new h(r,n);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function u(){l.abort()}l.onload=function(){var e,t,r={status:l.status,statusText:l.statusText,headers:(e=l.getAllResponseHeaders()||"",t=new a,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}}),t)};r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var n="response"in l?l.response:l.responseText;o(new g(n,r))},l.onerror=function(){i(new TypeError("Network request failed"))},l.ontimeout=function(){i(new TypeError("Network request failed"))},l.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},l.open(s.method,s.url,!0),"include"===s.credentials?l.withCredentials=!0:"omit"===s.credentials&&(l.withCredentials=!1),"responseType"in l&&t.blob&&(l.responseType="blob"),s.headers.forEach(function(e,t){l.setRequestHeader(t,e)}),s.signal&&(s.signal.addEventListener("abort",u),l.onreadystatechange=function(){4===l.readyState&&s.signal.removeEventListener("abort",u)}),l.send(void 0===s._bodyInit?null:s._bodyInit)})}y.polyfill=!0,self.fetch||(self.fetch=y,self.Headers=a,self.Request=h,self.Response=g),e.Headers=a,e.Request=h,e.Response=g,e.fetch=y,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof _$fetchUmd_77.exports?factory(_$fetchUmd_77.exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory(__global_77.WHATWGFetch={}),_$fetchUmd_77=_$fetchUmd_77.exports;var _$hasProperty_218=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var _$Translator_199=function(){function e(e){var t=this;this.locale={strings:{},pluralize:function(e){return 1===e?0:1}},Array.isArray(e)?e.forEach(function(e){return t._apply(e)}):this._apply(e)}var t=e.prototype;return t._apply=function(e){if(e&&e.strings){var t=this.locale;this.locale=_extends({},t,{strings:_extends({},t.strings,e.strings)}),this.locale.pluralize=e.pluralize||t.pluralize}},t.interpolate=function(e,t){var r=String.prototype,n=r.split,o=r.replace,i=/\$/g,s=[e];for(var a in t)if("_"!==a&&_$hasProperty_218(t,a)){var l=t[a];"string"==typeof l&&(l=o.call(t[a],i,"$$$$")),s=u(s,new RegExp("%\\{"+a+"\\}","g"),l)}return s;function u(e,t,r){var o=[];return e.forEach(function(e){n.call(e,t).forEach(function(e,t,n){""!==e&&o.push(e),t<n.length-1&&o.push(r)})}),o}},t.translate=function(e,t){return this.translateArray(e,t).join("")},t.translateArray=function(e,t){if(t&&void 0!==t.smart_count){var r=this.locale.pluralize(t.smart_count);return this.interpolate(this.locale.strings[e][r],t)}return this.interpolate(this.locale.strings[e],t)},e}(),_$namespaceEmitter_49=function(){var e={},t=e._fns={};return e.emit=function(e,r,n,o,i,s,a){var l=function(e){for(var r=t[e]?t[e]:[],n=e.indexOf(":"),o=-1===n?[e]:[e.substring(0,n),e.substring(n+1)],i=Object.keys(t),s=0,a=i.length;s<a;s++){var l=i[s];if("*"===l&&(r=r.concat(t[l])),2===o.length&&o[0]===l){r=r.concat(t[l]);break}}return r}(e);l.length&&function(e,t,r){for(var n=0,o=t.length;n<o&&t[n];n++)t[n].event=e,t[n].apply(t[n],r)}(e,l,[r,n,o,i,s,a])},e.on=function(e,r){t[e]||(t[e]=[]),t[e].push(r)},e.once=function(t,r){this.on(t,function n(){r.apply(this,arguments),e.off(t,n)})},e.off=function(e,t){var r=[];if(e&&t)for(var n=this._fns[e],o=0,i=n?n.length:0;o<i;o++)n[o]!==t&&r.push(n[o]);r.length?this._fns[e]=r:delete this._fns[e]},e},_$pad_16=function(e,t){var r="000000000"+e;return r.substr(r.length-t)},env="object"==typeof window?window:self,globalCount=Object.keys(env).length,clientId=_$pad_16(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+globalCount.toString(36),4),_$fingerprintBrowser_14=function(){return clientId},getRandomValue,crypto=window.crypto||window.msCrypto;if(crypto){var lim=Math.pow(2,32)-1;getRandomValue=function(){return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0]/lim)}}else getRandomValue=Math.random;var _$getRandomValue_15=getRandomValue,_$cuid_13={},c=0,blockSize=4,base=36,discreteValues=Math.pow(base,blockSize);function randomBlock(){return _$pad_16((_$getRandomValue_15()*discreteValues<<0).toString(base),blockSize)}function safeCounter(){return c=c<discreteValues?c:0,++c-1}function cuid(){return"c"+(new Date).getTime().toString(base)+_$pad_16(safeCounter().toString(base),blockSize)+_$fingerprintBrowser_14()+(randomBlock()+randomBlock())}cuid.slug=function(){var e=(new Date).getTime().toString(36),t=safeCounter().toString(36).slice(-4),r=_$fingerprintBrowser_14().slice(0,1)+_$fingerprintBrowser_14().slice(-1),n=randomBlock().slice(-2);return e.slice(-2)+t+r+n},cuid.isCuid=function(e){return"string"==typeof e&&!!e.startsWith("c")},cuid.isSlug=function(e){if("string"!=typeof e)return!1;var t=e.length;return t>=7&&t<=10},cuid.fingerprint=_$fingerprintBrowser_14,_$cuid_13=cuid;var _$lodashThrottle_46={};(function(e){var t="Expected a function",r=NaN,n="[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 e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,p=u||c||Function("return this")(),d=Object.prototype.toString,_=Math.max,h=Math.min,f=function(){return p.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==n}(e))return r;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var u=s.test(e);return u||a.test(e)?l(e.slice(2),u?2:8):i.test(e)?r:+e}_$lodashThrottle_46=function(e,r,n){var o=!0,i=!0;if("function"!=typeof e)throw new TypeError(t);return g(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),function(e,r,n){var o,i,s,a,l,u,c=0,p=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError(t);function v(t){var r=o,n=i;return o=i=void 0,c=t,a=e.apply(n,r)}function b(e){var t=e-u;return void 0===u||t>=r||t<0||d&&e-c>=s}function w(){var e=f();if(b(e))return S(e);l=setTimeout(w,function(e){var t=r-(e-u);return d?h(t,s-(e-c)):t}(e))}function S(e){return l=void 0,y&&o?v(e):(o=i=void 0,a)}function P(){var e=f(),t=b(e);if(o=arguments,i=this,u=e,t){if(void 0===l)return function(e){return c=e,l=setTimeout(w,r),p?v(e):a}(u);if(d)return l=setTimeout(w,r),v(u)}return void 0===l&&(l=setTimeout(w,r)),a}return r=m(r)||0,g(n)&&(p=!!n.leading,s=(d="maxWait"in n)?_(m(n.maxWait)||0,r):s,y="trailing"in n?!!n.trailing:y),P.cancel=function(){void 0!==l&&clearTimeout(l),c=0,o=u=i=l=void 0},P.flush=function(){return void 0===l?a:S(f())},P}(e,r,{leading:o,maxWait:r,trailing:i})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var _$prettyBytes_225=function(e){if("number"!=typeof e||isNaN(e))throw new TypeError("Expected a number, got "+typeof e);var t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return(t?"-":"")+e+" B";var n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/Math.pow(1024,n));var o=r[n];return e>=10||e%1==0?(t?"-":"")+e.toFixed(0)+" "+o:(t?"-":"")+e.toFixed(1)+" "+o},_$wildcard_78={};function WildcardMatcher(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}WildcardMatcher.prototype.match=function(e){var t,r,n=!0,o=this.parts,i=o.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;n&&t<i;t++)"*"!==o[t]&&(n=t<r.length&&o[t]===r[t]);n=n&&r}else n=!1;else if("function"==typeof e.splice)for(n=[],t=e.length;t--;)this.match(e[t])&&(n[n.length]=e[t]);else if("object"==typeof e)for(var s in n={},e)this.match(s)&&(n[s]=e[s]);return n},_$wildcard_78=function(e,t,r){var n=new WildcardMatcher(e,r||/[\/\.]/);return void 0!==t?n.match(t):n};var reMimePartSplit=/[\/\+\.]/,_$mimeMatch_48=function(e,t){function r(t){var r=_$wildcard_78(t,e,reMimePartSplit);return r&&r.length>=2}return t?r(t.split(";")[0]):r},_$package_164={version:"1.2.0"},_$lib_163={};function ___extends_163(){return(___extends_163=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var DefaultStore=function(){function e(){this.state={},this.callbacks=[]}var t=e.prototype;return t.getState=function(){return this.state},t.setState=function(e){var t=___extends_163({},this.state),r=___extends_163({},this.state,e);this.state=r,this._publish(t,r,e)},t.subscribe=function(e){var t=this;return this.callbacks.push(e),function(){t.callbacks.splice(t.callbacks.indexOf(e),1)}},t._publish=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.callbacks.forEach(function(e){e.apply(void 0,t)})},e}();DefaultStore.VERSION=_$package_164.version,_$lib_163=function(){return new DefaultStore};var _$getFileNameAndExtension_212=function(e){var t=/(?:\.([^.]+))?$/.exec(e)[1];return{name:e.replace("."+t,""),extension:t}},_$mimeTypes_224={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",heic:"image/heic",heif:"image/heif",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",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf"},_$getFileType_213=function(e){var t=e.name?_$getFileNameAndExtension_212(e.name).extension:null;return t=t?t.toLowerCase():null,e.type?e.type:t&&_$mimeTypes_224[t]?_$mimeTypes_224[t]:"application/octet-stream"};function encodeFilename(e){var t="";return e.replace(/[^A-Z0-9]/gi,function(e){return t+="-"+function(e){return e.charCodeAt(0).toString(32)}(e),"/"})+t}var _$generateFileID_205=function(e){return["uppy",e.name?encodeFilename(e.name.toLowerCase()):"",e.type,e.meta&&e.meta.relativePath?encodeFilename(e.meta.relativePath.toLowerCase()):"",e.data.size,e.data.lastModified].filter(function(e){return e}).join("-")},_$supportsUploadProgress_95=function(e){if(null==e&&(e="undefined"!=typeof navigator?navigator.userAgent:null),!e)return!0;var t=/Edge\/(\d+\.\d+)/.exec(e);if(!t)return!0;var r=t[1].split("."),n=r[0],o=r[1];return n=parseInt(n,10),o=parseInt(o,10),n<15||15===n&&o<15063||n>18||18===n&&o>=18218};function __pad_217(e){return 2!==e.length?0+e:e}var _$getTimeStamp_217=function(){var e=new Date;return __pad_217(e.getHours().toString())+":"+__pad_217(e.getMinutes().toString())+":"+__pad_217(e.getSeconds().toString())},debugLogger={debug:function(){for(var e=console.debug||console.log,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e.call.apply(e,[console,"[Uppy] ["+_$getTimeStamp_217()+"]"].concat(r))},warn:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(e=console).warn.apply(e,["[Uppy] ["+_$getTimeStamp_217()+"]"].concat(r))},error:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return(e=console).error.apply(e,["[Uppy] ["+_$getTimeStamp_217()+"]"].concat(r))}},_$loggers_94={nullLogger:{debug:function(){},warn:function(){},error:function(){}},debugLogger:debugLogger},_$preact_53={exports:{}};!function(){"use strict";function e(){}function t(t,r){var n,o,i,s,a=S;for(s=arguments.length;s-- >2;)w.push(arguments[s]);for(r&&null!=r.children&&(w.length||w.push(r.children),delete r.children);w.length;)if((o=w.pop())&&void 0!==o.pop)for(s=o.length;s--;)w.push(o[s]);else"boolean"==typeof o&&(o=null),(i="function"!=typeof t)&&(null==o?o="":"number"==typeof o?o=String(o):"string"!=typeof o&&(i=!1)),i&&n?a[a.length-1]+=o:a===S?a=[o]:a.push(o),n=i;var l=new e;return l.nodeName=t,l.children=a,l.attributes=null==r?void 0:r,l.key=null==r?void 0:r.key,void 0!==b.vnode&&b.vnode(l),l}function r(e,t){for(var r in t)e[r]=t[r];return e}function n(e){!e.__d&&(e.__d=!0)&&1==C.push(e)&&(b.debounceRendering||P)(o)}function o(){var e,t=C;for(C=[];e=t.pop();)e.__d&&m(e)}function i(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function s(e){var t=r({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function a(e){var t=e.parentNode;t&&t.removeChild(e)}function l(e,t,r,n,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)r&&r(null),n&&n(e);else if("class"!==t||o)if("style"===t){if(n&&"string"!=typeof n&&"string"!=typeof r||(e.style.cssText=n||""),n&&"object"==typeof n){if("string"!=typeof r)for(var i in r)i in n||(e.style[i]="");for(var i in n)e.style[i]="number"==typeof n[i]&&!1===E.test(i)?n[i]+"px":n[i]}}else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),n?r||e.addEventListener(t,u,s):e.removeEventListener(t,u,s),(e.__l||(e.__l={}))[t]=n}else if("list"!==t&&"type"!==t&&!o&&t in e)!function(e,t,r){try{e[t]=r}catch(n){}}(e,t,null==n?"":n),null!=n&&!1!==n||e.removeAttribute(t);else{var a=o&&t!==(t=t.replace(/^xlink:?/,""));null==n||!1===n?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof n&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):e.setAttribute(t,n))}else e.className=n||""}function u(e){return this.__l[e.type](b.event&&b.event(e)||e)}function c(){for(var e;e=T.pop();)b.afterMount&&b.afterMount(e),e.componentDidMount&&e.componentDidMount()}function p(e,t,r,n,o,u){$++||(k=null!=o&&void 0!==o.ownerSVGElement,F=null!=e&&!("__preactattr_"in e));var p=function e(t,r,n,o,u){var c=t,p=k;if(null!=r&&"boolean"!=typeof r||(r=""),"string"==typeof r||"number"==typeof r)return t&&void 0!==t.splitText&&t.parentNode&&(!t._component||u)?t.nodeValue!=r&&(t.nodeValue=r):(c=document.createTextNode(r),t&&(t.parentNode&&t.parentNode.replaceChild(c,t),d(t,!0))),c.__preactattr_=!0,c;var _,f,m=r.nodeName;if("function"==typeof m)return function(e,t,r,n){for(var o=e&&e._component,i=o,a=e,l=o&&e._componentConstructor===t.nodeName,u=l,c=s(t);o&&!u&&(o=o.__u);)u=o.constructor===t.nodeName;return o&&u&&(!n||o._component)?(g(o,c,3,r,n),e=o.base):(i&&!l&&(y(i),e=a=null),o=h(t.nodeName,c,r),e&&!o.__b&&(o.__b=e,a=null),g(o,c,1,r,n),e=o.base,a&&e!==a&&(a._component=null,d(a,!1))),e}(t,r,n,o);if(k="svg"===m||"foreignObject"!==m&&k,m=String(m),(!t||!i(t,m))&&(_=m,(f=k?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_)).__n=_,c=f,t)){for(;t.firstChild;)c.appendChild(t.firstChild);t.parentNode&&t.parentNode.replaceChild(c,t),d(t,!0)}var v=c.firstChild,b=c.__preactattr_,w=r.children;if(null==b){b=c.__preactattr_={};for(var S=c.attributes,P=S.length;P--;)b[S[P].name]=S[P].value}return!F&&w&&1===w.length&&"string"==typeof w[0]&&null!=v&&void 0!==v.splitText&&null==v.nextSibling?v.nodeValue!=w[0]&&(v.nodeValue=w[0]):(w&&w.length||null!=v)&&function(t,r,n,o,s){var l,u,c,p,_,h,f,g,m=t.childNodes,y=[],v={},b=0,w=0,S=m.length,P=0,E=r?r.length:0;if(0!==S)for(var C=0;C<S;C++){var T=m[C],$=T.__preactattr_,k=E&&$?T._component?T._component.__k:$.key:null;null!=k?(b++,v[k]=T):($||(void 0!==T.splitText?!s||T.nodeValue.trim():s))&&(y[P++]=T)}if(0!==E)for(var C=0;C<E;C++){p=r[C],_=null;var k=p.key;if(null!=k)b&&void 0!==v[k]&&(_=v[k],v[k]=void 0,b--);else if(!_&&w<P)for(l=w;l<P;l++)if(void 0!==y[l]&&(h=u=y[l],g=s,"string"==typeof(f=p)||"number"==typeof f?void 0!==h.splitText:"string"==typeof f.nodeName?!h._componentConstructor&&i(h,f.nodeName):g||h._componentConstructor===f.nodeName)){_=u,y[l]=void 0,l===P-1&&P--,l===w&&w++;break}_=e(_,p,n,o),c=m[C],_&&_!==t&&_!==c&&(null==c?t.appendChild(_):_===c.nextSibling?a(c):t.insertBefore(_,c))}if(b)for(var C in v)void 0!==v[C]&&d(v[C],!1);for(;w<=P;)void 0!==(_=y[P--])&&d(_,!1)}(c,w,n,o,F||null!=b.dangerouslySetInnerHTML),function(e,t,r){var n;for(n in r)t&&null!=t[n]||null==r[n]||l(e,n,r[n],r[n]=void 0,k);for(n in t)"children"===n||"innerHTML"===n||n in r&&t[n]===("value"===n||"checked"===n?e[n]:r[n])||l(e,n,r[n],r[n]=t[n],k)}(c,r.attributes,b),k=p,c}(e,t,r,n,u);return o&&p.parentNode!==o&&o.appendChild(p),--$||(F=!1,u||c()),p}function d(e,t){var r=e._component;r?y(r):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||a(e),_(e))}function _(e){for(e=e.lastChild;e;){var t=e.previousSibling;d(e,!0),e=t}}function h(e,t,r){var n,o=A[e.name];if(e.prototype&&e.prototype.render?(n=new e(t,r),v.call(n,t,r)):((n=new v(t,r)).constructor=e,n.render=f),o)for(var i=o.length;i--;)if(o[i].constructor===e){n.__b=o[i].__b,o.splice(i,1);break}return n}function f(e,t,r){return this.constructor(e,r)}function g(e,t,r,o,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.__c||(e.__c=e.context),e.context=o),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==r&&(1!==r&&!1===b.syncComponentUpdates&&e.base?n(e):m(e,1,i)),e.__r&&e.__r(e))}function m(e,t,n,o){if(!e.__x){var i,a,l,u=e.props,_=e.state,f=e.context,v=e.__p||u,w=e.__s||_,S=e.__c||f,P=e.base,E=e.__b,C=P||E,k=e._component,F=!1;if(P&&(e.props=v,e.state=w,e.context=S,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(u,_,f)?F=!0:e.componentWillUpdate&&e.componentWillUpdate(u,_,f),e.props=u,e.state=_,e.context=f),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!F){i=e.render(u,_,f),e.getChildContext&&(f=r(r({},f),e.getChildContext()));var A,x,R=i&&i.nodeName;if("function"==typeof R){var O=s(i);(a=k)&&a.constructor===R&&O.key==a.__k?g(a,O,1,f,!1):(A=a,e._component=a=h(R,O,f),a.__b=a.__b||E,a.__u=e,g(a,O,0,f,!1),m(a,1,n,!0)),x=a.base}else l=C,(A=k)&&(l=e._component=null),(C||1===t)&&(l&&(l._component=null),x=p(l,i,f,n||!P,C&&C.parentNode,!0));if(C&&x!==C&&a!==k){var I=C.parentNode;I&&x!==I&&(I.replaceChild(x,C),A||(C._component=null,d(C,!1)))}if(A&&y(A),e.base=x,x&&!o){for(var U=e,D=e;D=D.__u;)(U=D).base=x;x._component=U,x._componentConstructor=U.constructor}}if(!P||n?T.unshift(e):F||(e.componentDidUpdate&&e.componentDidUpdate(v,w,S),b.afterUpdate&&b.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);$||o||c()}}function y(e){b.beforeUnmount&&b.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var r=e._component;r?y(r):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,a(t),function(e){var t=e.constructor.name;(A[t]||(A[t]=[])).push(e)}(e),_(t)),e.__r&&e.__r(null)}function v(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var b={},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,C=[],T=[],$=0,k=!1,F=!1,A={};r(v.prototype,{setState:function(e,t){var o=this.state;this.__s||(this.__s=r({},o)),r(o,"function"==typeof e?e(o,this.props):e),t&&(this.__h=this.__h||[]).push(t),n(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),m(this,2)},render:function(){}});var x={h:t,createElement:t,cloneElement:function(e,n){return t(e.nodeName,r(r({},e.attributes),n),arguments.length>2?[].slice.call(arguments,2):e.children)},Component:v,render:function(e,t,r){return p(r,e,{},!1,t,!1)},rerender:o,options:b};_$preact_53.exports=x}(),_$preact_53=_$preact_53.exports;var _$isDOMElement_219=function(e){return e&&"object"==typeof e&&e.nodeType===Node.ELEMENT_NODE},_$findDOMElement_204=function(e,t){return void 0===t&&(t=document),"string"==typeof e?t.querySelector(e):"object"==typeof e&&_$isDOMElement_219(e)?e:void 0};function ___extends_92(){return(___extends_92=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var _$Plugin_92=function(){function e(e,t){this.uppy=e,this.opts=t||{},this.update=this.update.bind(this),this.mount=this.mount.bind(this),this.install=this.install.bind(this),this.uninstall=this.uninstall.bind(this)}var t=e.prototype;return t.getPluginState=function(){return this.uppy.getState().plugins[this.id]||{}},t.setPluginState=function(e){var t,r=this.uppy.getState().plugins;this.uppy.setState({plugins:___extends_92({},r,(t={},t[this.id]=___extends_92({},r[this.id],{},e),t))})},t.update=function(e){void 0!==this.el&&this._updateUI&&this._updateUI(e)},t.afterUpdate=function(){},t.onMount=function(){},t.mount=function(t,r){var n,o,i,s,a=this,l=r.id,u=_$findDOMElement_204(t);if(u)return this.isTargetDOMEl=!0,this.rerender=function(e){a.uppy.getPlugin(a.id)&&(a.el=_$preact_53.render(a.render(e),u,a.el),a.afterUpdate())},this._updateUI=(n=this.rerender,o=null,i=null,function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i=t,o||(o=Promise.resolve().then(function(){return o=null,n.apply(void 0,i)})),o}),this.uppy.log("Installing "+l+" to a DOM element '"+t+"'"),this.opts.replaceTargetContent&&(u.innerHTML=""),this.el=_$preact_53.render(this.render(this.uppy.getState()),u),this.onMount(),this.el;if("object"==typeof t&&t instanceof e)s=t;else if("function"==typeof t){var c=t;this.uppy.iteratePlugins(function(e){if(e instanceof c)return s=e,!1})}if(s)return this.uppy.log("Installing "+l+" to "+s.id),this.parent=s,this.el=s.addTarget(r),this.onMount(),this.el;throw this.uppy.log("Not installing "+l),new Error("Invalid target option given to "+l+". 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.render=function(e){throw new Error("Extend the render method to add your plugin to a DOM element")},t.addTarget=function(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")},t.unmount=function(){this.isTargetDOMEl&&this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},t.install=function(){},t.uninstall=function(){this.unmount()},e}(),_$package_96={version:"1.5.1"},_$lib_93={};function ___extends_93(){return(___extends_93=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,e)})(e)}function _construct(e,t,r){return(_construct=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_setPrototypeOf(o,r.prototype),o}).apply(null,arguments)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var nullLogger=_$loggers_94.nullLogger,__debugLogger_93=_$loggers_94.debugLogger,RestrictionError=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).isRestriction=!0,t}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(_wrapNativeSuper(Error)),Uppy=function(){function e(e){var t=this;this.defaultLocale={strings:{youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files",2:"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",2:"You have to select at least %{smart_count} files"},exceedsSize:"This file exceeds maximum allowed size of",youCanOnlyUploadFileTypes:"You can only upload: %{types}",companionError:"Connection with Companion failed",companionAuthError:"Authorization required",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}",2:"Select %{smart_count}"},selectAllFilesFromFolderNamed:"Select all files from folder %{name}",unselectAllFilesFromFolderNamed:"Unselect all files from folder %{name}",selectFileNamed:"Select file %{name}",unselectFileNamed:"Unselect file %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",emptyFolderAdded:"No files were added from empty folder",folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}",2:"Added %{smart_count} files from %{folder}"}}};var r={id:"uppy",autoProceed:!1,allowMultipleUploads:!0,debug:!1,restrictions:{maxFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null},meta:{},onBeforeFileAdded:function(e,t){return e},onBeforeUpload:function(e){return e},store:_$lib_163(),logger:nullLogger};if(this.opts=___extends_93({},r,e),this.opts.restrictions=___extends_93({},r.restrictions,this.opts.restrictions),e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=__debugLogger_93),this.log("Using Core v"+this.constructor.VERSION),this.opts.restrictions.allowedFileTypes&&null!==this.opts.restrictions.allowedFileTypes&&!Array.isArray(this.opts.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");this.translator=new _$Translator_199([this.defaultLocale,this.opts.locale]),this.locale=this.translator.locale,this.i18n=this.translator.translate.bind(this.translator),this.i18nArray=this.translator.translateArray.bind(this.translator),this.plugins={},this.getState=t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the unminified version (see above) still references a sourcemap, please make sure it's actually there.

// since size and eventually type are changing, we have to overwrite several redundant information in the file object
const filename = file.name.replace(/\.png$/i, '.jpg')
const processedFile = {
...file,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yo, listen up here's a story, about a contributor who tried to use new features...

pronto will complain about this, and it will complain about this very hard. In fact, it will claim this is a syntax error, although we both know the object spread operator is production-ready and shipped in all major browsers except for Edge (which I, quite frankly, no longer care about, as it works in Edgeium).

The reason pronto will yell at you is because pronto is not using the eslint out of your path. Instead, it calls to pronto-eslint, which in turns calls to eslintrb, which hasn't been updated since 2016, which still is usingeslint 2.7.0. Obviously, object spreads are quite foreign to a eslint parser coming straight out of the early Mesolithic Age.

There is nothing I can do to make pronto happy with this, besides forking eslintrb and forking pronto-eslint, which is not going to happen to preserve the minds of everyone working on this project.

I hate writing this suggestion as much as you will hate it when reading, but can you rewrite that using Object.assign({}, file, { ... }), please?

We'll be in a better place, one day. I promise.

uninstall() {
this.uppy.removePreProcessor(this.prepareUpload);
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants