@rpldy/uploader
Advanced tools
Comparing version 0.2.4 to 0.3.0
@@ -10,2 +10,4 @@ "use strict"; | ||
var _simpleState = require("@rpldy/simple-state"); | ||
var _consts = require("../consts"); | ||
@@ -166,8 +168,11 @@ | ||
stateItems = state.items; | ||
queue.trigger(event, _objectSpread(_objectSpread({}, batch), {}, { | ||
var eventBatch = _objectSpread(_objectSpread({}, (0, _simpleState.unwrap)(batch)), {}, { | ||
items: batch.items.map(function (_ref2) { | ||
var id = _ref2.id; | ||
return stateItems[id]; | ||
return (0, _simpleState.unwrap)(stateItems[id]); | ||
}) | ||
})); | ||
}); | ||
queue.trigger(event, eventBatch); | ||
}; | ||
@@ -174,0 +179,0 @@ |
@@ -12,2 +12,4 @@ "use strict"; | ||
var _simpleState = _interopRequireWildcard(require("@rpldy/simple-state")); | ||
var _consts = require("../consts"); | ||
@@ -19,2 +21,4 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
@@ -24,4 +28,2 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
@@ -31,12 +33,20 @@ | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
var _default = function _default(options, cancellable, trigger, sender, uploaderId) { | ||
var _getUpdateable = (0, _shared.getUpdateable)({ | ||
var _createState = (0, _simpleState["default"])({ | ||
itemQueue: [], | ||
@@ -49,5 +59,25 @@ currentBatch: null, | ||
}), | ||
state = _getUpdateable.state, | ||
update = _getUpdateable.update; | ||
state = _createState.state, | ||
update = _createState.update; | ||
var unWrapAndTrigger = function unWrapAndTrigger(name) { | ||
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
data[_key - 1] = arguments[_key]; | ||
} | ||
return trigger.apply(void 0, [name].concat(_toConsumableArray(data.map(function (d) { | ||
return (0, _simpleState.unwrap)(d); | ||
})))); | ||
}; | ||
var unWrapAndCancellable = function unWrapAndCancellable(name) { | ||
for (var _len2 = arguments.length, data = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
data[_key2 - 1] = arguments[_key2]; | ||
} | ||
return cancellable.apply(void 0, [name].concat(_toConsumableArray(data.map(function (d) { | ||
return (0, _simpleState.unwrap)(d); | ||
})))); | ||
}; | ||
var getState = function getState() { | ||
@@ -91,3 +121,3 @@ return state; | ||
trigger(_consts.UPLOADER_EVENTS.ITEM_PROGRESS, getState().items[item.id]); | ||
unWrapAndTrigger(_consts.UPLOADER_EVENTS.ITEM_PROGRESS, getState().items[item.id]); | ||
} | ||
@@ -119,3 +149,3 @@ }; | ||
}); | ||
trigger(_consts.UPLOADER_EVENTS.BATCH_PROGRESS, state.batches[batch.id].batch); | ||
unWrapAndTrigger(_consts.UPLOADER_EVENTS.BATCH_PROGRESS, state.batches[batch.id].batch); | ||
} | ||
@@ -132,4 +162,4 @@ }); | ||
updateState: updateState, | ||
trigger: trigger, | ||
cancellable: cancellable, | ||
trigger: unWrapAndTrigger, | ||
cancellable: unWrapAndCancellable, | ||
sender: sender, | ||
@@ -136,0 +166,0 @@ handleItemProgress: handleItemProgress |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _simpleState = require("@rpldy/simple-state"); | ||
var _consts = require("../consts"); | ||
@@ -34,4 +36,6 @@ | ||
return (0, _shared.triggerUpdater)(queue.trigger, _consts.UPLOADER_EVENTS.REQUEST_PRE_SEND, { | ||
items: items, | ||
options: options | ||
items: items.map(function (i) { | ||
return (0, _simpleState.unwrap)(i); | ||
}), | ||
options: (0, _simpleState.unwrap)(options) | ||
}); | ||
@@ -54,3 +58,3 @@ | ||
if (!(updated.items.length !== items.length || !(0, _shared.isSamePropInArrays)(updated.items, items, ["id", "batchId"]))) { | ||
if (!(updated.items.length !== items.length || !(0, _shared.isSamePropInArrays)(updated.items, items, ["id", "batchId", "recycled"]))) { | ||
_context.next = 8; | ||
@@ -73,3 +77,4 @@ break; | ||
items: items, | ||
options: options | ||
options: options, | ||
cancelled: updated === false | ||
}); | ||
@@ -92,3 +97,3 @@ | ||
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(queue, items) { | ||
var allowedIds, options; | ||
var allowedIds, prepared, updatedState; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -104,10 +109,27 @@ while (1) { | ||
}); | ||
options = queue.getState().batches[items[0].batchId].batchOptions; | ||
_context2.next = 5; | ||
return triggerPreSendUpdate(queue, items, options); | ||
_context2.next = 4; | ||
return triggerPreSendUpdate(queue, items, queue.getState().batches[items[0].batchId].batchOptions); | ||
case 5: | ||
return _context2.abrupt("return", _context2.sent); | ||
case 4: | ||
prepared = _context2.sent; | ||
case 6: | ||
if (!prepared.cancelled) { | ||
//update potentially changed data back into queue state | ||
queue.updateState(function (state) { | ||
prepared.items.forEach(function (i) { | ||
state.items[i.id] = i; | ||
}); | ||
state.batches[items[0].batchId].batchOptions = prepared.options; | ||
}); //use objects from internal state(proxies) - not objects from userland | ||
updatedState = queue.getState(); | ||
prepared.items = prepared.items.map(function (item) { | ||
return updatedState.items[item.id]; | ||
}); | ||
prepared.options = updatedState.batches[items[0].batchId].batchOptions; | ||
} | ||
return _context2.abrupt("return", prepared); | ||
case 7: | ||
case "end": | ||
@@ -189,3 +211,3 @@ return _context2.stop(); | ||
}); | ||
(0, _processFinishedRequest["default"])(queue, finishedData, next); //report out info about cancelled items | ||
(0, _processFinishedRequest["default"])(queue, finishedData, next); //report about cancelled items | ||
} | ||
@@ -209,3 +231,3 @@ | ||
case 0: | ||
state = queue.getState(); //multiple items can happen when grouping is allowed | ||
state = queue.getState(); //ids will have more than one when grouping is allowed | ||
@@ -215,3 +237,3 @@ items = Object.values(state.items); | ||
return !!~ids.indexOf(item.id); | ||
}); //allow external code to cancel items | ||
}); //allow user code cancel items from start event handler(s) | ||
@@ -239,4 +261,12 @@ _context4.next = 5; | ||
itemsSendData = _context4.sent; | ||
sendAllowedItems(queue, itemsSendData, next); //we dont need to wait for the response here | ||
if (itemsSendData.cancelled) { | ||
cancelledResults = ids.map(function () { | ||
return true; | ||
}); | ||
} else { | ||
//we dont need to wait for the response here | ||
sendAllowedItems(queue, itemsSendData, next); | ||
} | ||
case 12: | ||
@@ -243,0 +273,0 @@ if (reportCancelledItems(queue, items, cancelledResults, next)) { |
{ | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"name": "@rpldy/uploader", | ||
@@ -26,5 +26,6 @@ "description": "the processing and queuing engine for react-uploady", | ||
"dependencies": { | ||
"@rpldy/life-events": "^0.2.4", | ||
"@rpldy/sender": "^0.2.4", | ||
"@rpldy/shared": "^0.2.4" | ||
"@rpldy/life-events": "^0.3.0", | ||
"@rpldy/sender": "^0.3.0", | ||
"@rpldy/shared": "^0.3.0", | ||
"@rpldy/simple-state": "^0.3.0" | ||
}, | ||
@@ -37,3 +38,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "8c954910416ffd3c3522807b2ea5b58d94e7e208" | ||
"gitHead": "be3502009a685d56ab30894d113e5386c8af7da7" | ||
} |
@@ -231,5 +231,8 @@ <a href="https://badge.fury.io/js/%40rpldy%2Fuploader"> | ||
Triggered when item starts uploading (just before) | ||
For grouped uploads (multiple files in same xhr request) ITEM_START is triggered for each item separately | ||
- Parameters: _(item)_ | ||
> This event is _[cancellable](#cancellable-events)_ | ||
### UPLOADER_EVENTS.ITEM_FINISH | ||
@@ -289,6 +292,8 @@ | ||
> This event is _[cancellable](#cancellable-events)_ | ||
## Cancellable Events | ||
These are events that allow the client to cancel their respective upload object (batch or batch item) | ||
To cancel the upload, the handler can return false. | ||
These are events that allow the client to cancel their respective upload object (batch or batch-item) | ||
To cancel the upload, the handler must return (boolean) false. | ||
@@ -295,0 +300,0 @@ ```javascript |
@@ -25,3 +25,3 @@ /*! | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.rpldy=t():e.rpldy=t()}(window,(function(){return function(e){function t(t){for(var r,u,i=t[0],c=t[1],l=t[2],d=0,f=[];d<i.length;d++)u=i[d],Object.prototype.hasOwnProperty.call(a,u)&&a[u]&&f.push(a[u][0]),a[u]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);for(s&&s(t);f.length;)f.shift()();return o.push.apply(o,l||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,i=1;i<n.length;i++){var c=n[i];0!==a[c]&&(r=!1)}r&&(o.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},a={core:0},o=[];function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="";var i=window.webpackJsonprpldy=window.webpackJsonprpldy||[],c=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var s=c;return o.push([0,"polyfills"]),n()}({0:function(e,t,n){n("9SVt"),n("KkDc"),n("jRAa"),e.exports=n("QELF")},"9SVt":function(e,t,n){"use strict";n.r(t),n.d(t,"addLife",(function(){return ue})),n.d(t,"isLE",(function(){return J}));var r=n("04Ix"),a=n.n(r),o=n("RSWj"),u=n.n(o),i=n("HnXd"),c=n.n(i),l=n("M5Mt"),s=n.n(l),d=n("OBge"),f=n.n(d),p=n("FLGM"),g=n.n(p),v=n("5PDf"),E=n.n(v),h=n("kT1S"),S=n.n(h),b=n("eLKs"),m=n.n(b),T=n("+oHS"),A=n.n(T),R=n("zLi2"),I=n.n(R),y=n("i5y0"),_=n.n(y),O=n("KYsz"),L=n.n(O),w=n("STz3"),D=n.n(w),C=n("cdeZ"),F=n.n(C),x=n("UtpJ"),N=n.n(x),P=n("/FZm"),B=n.n(P),H=n("ZbhI"),j=n.n(H),k=n("JlUD"),M=n.n(k),U=n("KkDc"),G=Object(U.devFreeze)({allowRegisterNonExistent:!0,canAddEvents:!0,canRemoveEvents:!0,collectStats:!1}),z=function(e,t){if(!Object(U.isFunction)(e))throw new Error("'".concat(t,"' is not a valid function"))},q=function(e){return void 0===e},Q=n("CtDf"),K=n.n(Q)()("__le__"),X=function(e){return e?e[K]:null},Z=function(e){var t=X(e);if(!t)throw new Error("Didnt find LE internal object. Something very bad happened!");return t},J=function(e){return!!X(e)},Y=function(e,t,n){var r,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];z(n,"cb");var o=Z(e);if(!o.options.allowRegisterNonExistent&&!~j()(r=o.events).call(r,t))throw new Error("Cannot register for event ".concat(t.toString()," that wasn't already defined (allowRegisterNonExistent = false)"));var u={name:t,cb:n,once:a},i=o.registry[t]||[];return B()(i).call(i,(function(e){return e.cb===n}))||(i.push(u),o.registry[t]=i),function(){return ae.call(e,t,n)}},W=function(e,t){var n,r,a=Z(e).registry;return t?a[t]?N()(n=a[t]).call(n):[]:F()(r=D()(a)).call(r)},V={on:function(e,t){return Y(this,e,t)},once:function(e,t){return Y(this,e,t,!0)},off:ae,getEvents:function(){var e;return N()(e=Z(this).events).call(e)}},$=function(){var e;return L()(e=_()(V)).call(e,(function(e,t){var n=I()(t,2),r=n[0],a=n[1];return e[r]={value:a},e}),{})},ee={trigger:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];var o,u,i,c=W(this,e);c.length&&(o=g()(u=E()(i=g()(c).call(c,(function(n){return n.once&&re(t,e,n.cb),r.length?1===r.length?n.cb(r[0]):2===r.length?n.cb(r[0],r[1]):3===r.length?n.cb(r[0],r[1],r[2]):n.cb.apply(n,r):n.cb()}))).call(i,(function(e){return!q(e)}))).call(u,(function(e){return M()(e)?e:f.a.resolve(e)})));return o&&(o.length?o:void 0)},addEvent:function(e){var t=Z(this);if(!t.options.canAddEvents)throw new Error("Cannot add new events (canAddEvents = false)");var n;if(~j()(n=t.events).call(n,e))throw new Error("Event '".concat(e,"' already defined"));t.events.push(e)},removeEvent:function(e){var t=Z(this);if(!t.options.canRemoveEvents)throw new Error("Cannot remove events (canRemoveEvents = false)");var n,r,a=j()(n=t.events).call(n,e);s()(r=t.events).call(r,a,1)},hasEvent:function(e){var t,n=Z(this);return!!~j()(t=n.events).call(t,e)},hasEventRegistrations:function(e){return!!W(this,e).length},assign:function(e){var t=Z(this);return oe(e,t.options,t.events,t.registry,t.stats),te(e)}},te=function(e){var t;return L()(t=A()(ee)).call(t,(function(t,n){var r;return t[n]=m()(r=ee[n]).call(r,e),t}),S()({target:e},ee))},ne=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Z(e).registry;!r[t]||!n&&r[t].length||delete r[t]},re=function(e,t,n){var r,a=Z(e).registry;a[t]&&(n?(a[t]=E()(r=a[t]).call(r,(function(e){return e.cb!==n})),ne(e,t)):ne(e,t,!0))};function ae(e,t){re(this,e,t)}var oe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};c()(e,S()(a()({},K,{value:u()({registry:r,events:n,options:t,stats:o})}),$()))},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return e=e||{},n=S()(S()({},G),n),J(e)||oe(e,n,t),te(e)};t.default=ue},KkDc:function(e,t,n){"use strict";n.r(t),n.d(t,"BATCH_STATES",(function(){return l})),n.d(t,"FILE_STATES",(function(){return s})),n.d(t,"invariant",(function(){return u.a})),n.d(t,"throttle",(function(){return c.a})),n.d(t,"logger",(function(){return r})),n.d(t,"triggerCancellable",(function(){return _})),n.d(t,"triggerUpdater",(function(){return L})),n.d(t,"createBatchItem",(function(){return B})),n.d(t,"request",(function(){return J})),n.d(t,"parseResponseHeaders",(function(){return Z})),n.d(t,"isFunction",(function(){return Y})),n.d(t,"isSamePropInArrays",(function(){return te})),n.d(t,"devFreeze",(function(){return ne})),n.d(t,"merge",(function(){return ie})),n.d(t,"getMerge",(function(){return ue})),n.d(t,"clone",(function(){return ce})),n.d(t,"getUpdateable",(function(){return le})),n.d(t,"pick",(function(){return se}));var r={};n.r(r),n.d(r,"isDebugOn",(function(){return p})),n.d(r,"setDebug",(function(){return g})),n.d(r,"debugLog",(function(){return v}));var a,o=n("QLaP"),u=n.n(o),i=n("uDTZ"),c=n.n(i),l={ADDED:"added",PROCESSING:"processing",UPLOADING:"uploading",CANCELLED:"cancelled",FINISHED:"finished",ABORTED:"aborted"},s={ADDED:"added",UPLOADING:"uploading",CANCELLED:"cancelled",FINISHED:"finished",ERROR:"error",ABORTED:"aborted"},d=n("ZbhI"),f=n.n(d),p=function(){var e;"boolean"!=typeof a&&(a=!!~f()(e=window.location.search).call(e,"rpldy_debug=true")||!0===window["__rupy-logger-debug__"]);return a},g=function(e){window["__rupy-logger-debug__"]=e,a=!!e||null},v=function(){var e;p()&&(e=console).log.apply(e,arguments)},E=n("a0dU"),h=n.n(E),S=n("TEMH"),b=n.n(S),m=n("OBge"),T=n.n(m),A=n("o+MX"),R=n.n(A),I=n("SPx3"),y=n.n(I),_=function(e,t){for(var n,r=function(){var t=y()(h.a.mark((function t(n){var r,a,o,u,i,c,l,s=arguments;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a=!1,o=s.length,u=new Array(o>1?o-1:0),i=1;i<o;i++)u[i-1]=s[i];if(!(c=e.apply(void 0,R()(r=[n]).call(r,u)))||!c.length){t.next=8;break}return t.next=6,T.a.all(c);case 6:l=t.sent,a=!!~b()(l).call(l,(function(e){return!1===e}));case 8:return t.abrupt("return",a);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a=arguments.length,o=new Array(a>2?a-2:0),u=2;u<a;u++)o[u-2]=arguments[u];return t?r.apply(void 0,R()(n=[t]).call(n,o)):r},O=function(e){return null==e},L=function(e,t){for(var n,r=function(){var t=y()(h.a.mark((function t(n){var r,a,o,u,i,c,l,s=arguments;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o=s.length,u=new Array(o>1?o-1:0),i=1;i<o;i++)u[i-1]=s[i];if(!(c=e.apply(void 0,R()(r=[n]).call(r,u)))||!c.length){t.next=7;break}return t.next=5,T.a.all(c);case 5:for(l=t.sent;O(a)&&l.length;)a=l.pop();case 7:return t.abrupt("return",O(a)?void 0:a);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a=arguments.length,o=new Array(a>2?a-2:0),u=2;u<a;u++)o[u-2]=arguments[u];return t?r.apply(void 0,R()(n=[t]).call(n,o)):r},w=n("LYCE"),D=n.n(w),C=n("nhkr"),F=n.n(C),x=n("CtDf"),N=n.n(x)()("__rpldy-bi__"),P=0,B=function(e,t){var n;P+=1;var r={id:e.id?e.id:R()(n="".concat(t,".item-")).call(n,P),batchId:t,state:s.ADDED,completed:0,loaded:0,aborted:!1,recycled:!1};if(D()(r,N,{value:!0}),"object"===F()(e)&&!0===e[N]&&(r.recycled=!0,e=e.file||e.url),"string"==typeof e)r=function(e,t){return e.url=t,e}(r,e);else{if(!function(e){return e&&(e instanceof Blob||e instanceof File||"object"===F()(e)&&e.name&&e.type)}(e))throw new Error("Unknown type of file added: ".concat(F()(e)));r=function(e,t){return e.file=t,e}(r,e)}return r},H=n("+oHS"),j=n.n(H),k=n("RXMP"),M=n.n(k),U=function(e,t){var n;t&&M()(n=j()(t)).call(n,(function(n){void 0!==t[n]&&e.setRequestHeader(n,t[n])}))},G=n("zLi2"),z=n.n(G),q=n("RKTd"),Q=n.n(q),K=n("KYsz"),X=n.n(K),Z=function(e){var t;try{var n,r;t=X()(n=Q()(r=e.getAllResponseHeaders()).call(r).split(/[\r\n]+/)).call(n,(function(e,t){var n=t.split(": "),r=z()(n,2),a=r[0],o=r[1];return e[a]=o,e}),{})}catch(t){v("uploady.request: failed to read response headers",e)}return t},J=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new XMLHttpRequest,a=new T.a((function(a,o){r.onerror=function(){return o(r)},r.ontimeout=function(){return o(r)},r.onabort=function(){return o(r)},r.onload=function(){return a(r)},r.open(n.method||"GET",e),U(r,n.headers),r.withCredentials=!!n.withCredentials,n.preSend&&n.preSend(r),r.send(t)}));return a.xhr=r,a},Y=function(e){return"function"==typeof e},W=n("/FZm"),V=n.n(W),$=n("FLGM"),ee=n.n($),te=function(e,t,n){var r=!0,a=function(e){var t,n=R()(t=[]).call(t,e);return function(e){return ee()(e).call(e,(function(e){return ee()(n).call(n,(function(t){return e[t]})).join()}))}}(n);if(e&&t&&e.length===t.length){var o=a(e),u=a(t);r=!!V()(o).call(o,(function(e,t){return e!==u[t]}))}return!r},ne=(n("9yv6"),function(e){return e}),re=n("zKQ6"),ae=n.n(re),oe=function(e){var t;return!!e&&"object"===F()(e)&&("Object"===(null===(t=ae()(e))||void 0===t?void 0:t.constructor.name)||null===ae()(e))},ue=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=function t(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return n&&a.length&&M()(a).call(a,(function(r){var a;r&&M()(a=j()(r)).call(a,(function(a){var o=r[a];(void 0!==o||e.undefinedOverwrites)&&(oe(o)?(n[a]&&oe(n[a])||(n[a]={}),t(n[a],o)):n[a]=o)}))})),n};return t},ie=ue(),ce=function(e){return ie({},e)},le=(n("6UaR"),function(e){var t=!1,n=e;return{state:n,update:function(e){if(t)throw new Error("Can't call update on Updateable already being updated!");try{t=!0,e(n)}finally{t=!1}return n}}}),se=function(e,t){var n;return e&&X()(n=j()(e)).call(n,(function(n,r){return~f()(t).call(t,r)&&(n[r]=e[r]),n}),{})}},QELF:function(e,t,n){"use strict";n.r(t),n.d(t,"UPLOADER_EVENTS",(function(){return P})),n.d(t,"DEFAULT_OPTIONS",(function(){return O})),n.d(t,"composeEnhancers",(function(){return Ne})),n.d(t,"createUploader",(function(){return xe})),n.d(t,"send",(function(){return Le.send})),n.d(t,"createMockSender",(function(){return Le.createMockSender})),n.d(t,"XHR_SENDER_TYPE",(function(){return Le.XHR_SENDER_TYPE})),n.d(t,"MOCK_SENDER_TYPE",(function(){return Le.MOCK_SENDER_TYPE}));var r,a=n("RXMP"),o=n.n(a),u=n("M5Mt"),i=n.n(u),c=n("UtpJ"),l=n.n(c),s=n("a0dU"),d=n.n(s),f=n("o+MX"),p=n.n(f),g=n("SPx3"),v=n.n(g),E=n("STz3"),h=n.n(E),S=n("9SVt"),b=n("KkDc"),m=n("6UaR"),T=n.n(m),A=n("5PDf"),R=n.n(A),I=n("FLGM"),y=n.n(I),_=function(){return!0},O=Object(b.devFreeze)({autoUpload:!0,inputFieldName:"file",concurrent:!1,maxConcurrent:2,grouped:!1,maxGroupSize:5,method:"POST",params:{},fileFilter:_,forceJsonResponse:!1,withCredentials:!1,destination:{},send:null,sendWithFormData:!0}),L=0,w=function(e,t,n){var r;return y()(r=R()(Array.prototype).call(t,n||_)).call(r,(function(t){return Object(b.createBatchItem)(t,e)}))},D=function(e,t,n){var r="batch-".concat(L+=1),a=e instanceof FileList||"[object FileList]"===e.toString();return e=T()(e)||a?e:[e],{id:r,uploaderId:t,items:w(r,e,n.fileFilter),state:b.BATCH_STATES.ADDED,completed:0,loaded:0}},C=n("KYsz"),F=n.n(C),x=n("zLi2"),N=n.n(x),P=Object(b.devFreeze)({BATCH_ADD:"BATCH-ADD",BATCH_START:"BATCH-START",BATCH_PROGRESS:"BATCH_PROGRESS",BATCH_FINISH:"BATCH-FINISH",BATCH_ABORT:"BATCH-ABORT",BATCH_CANCEL:"BATCH-CANCEL",ITEM_START:"FILE-START",ITEM_CANCEL:"FILE-CANCEL",ITEM_PROGRESS:"FILE-PROGRESS",ITEM_FINISH:"FILE-FINISH",ITEM_ABORT:"FILE-ABORT",ITEM_ERROR:"FILE-ERROR",ITEM_FINALIZE:"FILE-FINALIZE",REQUEST_PRE_SEND:"REQUEST_PRE_SEND"}),B=Object(b.devFreeze)({ITEM_PROGRESS:"ITEM_PROGRESS",BATCH_PROGRESS:"BATCH_PROGRESS"}),H=n("cdeZ"),j=n.n(H),k=n("ZbhI"),M=n.n(k),U=n("OBge"),G=n.n(U),z=n("04Ix"),q=n.n(z),Q=n("mnMc"),K=n.n(Q),X=n("kT1S"),Z=n.n(X),J=[b.BATCH_STATES.ADDED,b.BATCH_STATES.PROCESSING,b.BATCH_STATES.UPLOADING],Y=function(e,t){return e.batches[t].batch},W=function(e,t,n){return e.getState().items[t].batchId===n},V=function(e,t){var n=e.getState(),r=n.items[t];return n.batches[r.batchId]},$=function(e,t){return V(e,t).batch},ee=function(e,t){var n,r=function(e,t){return Y(e.getState(),t)}(e,t),a=y()(n=r.items).call(n,(function(e){return e.id}));e.updateState((function(e){o()(a).call(a,(function(t){var n;delete e.items[t];var r,a=M()(n=e.itemQueue).call(n,t);~a&&i()(r=e.itemQueue).call(r,a,1)}))}))},te=function(e,t){e.updateState((function(e){delete e.batches[t]}))},ne=function(e,t){var n=$(e,t),r=n.id;b.logger.debugLog("uploady.uploader.processor: cancelling batch: ",{batch:n}),e.updateState((function(e){Y(e,r).state=b.BATCH_STATES.CANCELLED})),ue(e,r,P.BATCH_CANCEL),ee(e,r),te(e,r)},re=function(e,t){var n=$(e,t);return e.getState().currentBatch!==n.id},ae=function(){var e=v()(d.a.mark((function e(t,n){var r,a;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=$(t,n),e.next=3,t.cancellable(P.BATCH_START,r);case 3:return(a=e.sent)||t.updateState((function(e){e.currentBatch=r.id})),e.abrupt("return",!a);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),oe=function(e){var t=e.getState().currentBatch;t&&function(e){var t=e.getState().itemQueue;return 0===t.length||re(e,t[0])}(e)&&(ue(e,t,P.BATCH_FINISH),ee(e,t),te(e,t))},ue=function(e,t,n){var r,a=e.getState(),o=Y(a,t),u=a.items;e.trigger(n,Z()(Z()({},o),{},{items:y()(r=o.items).call(r,(function(e){var t=e.id;return u[t]}))}))},ie=function(e,t){var n=$(e,t);return K()(J).call(J,n.state)},ce=(r={},q()(r,b.FILE_STATES.ADDED,P.ITEM_START),q()(r,b.FILE_STATES.FINISHED,P.ITEM_FINISH),q()(r,b.FILE_STATES.ERROR,P.ITEM_ERROR),q()(r,b.FILE_STATES.CANCELLED,P.ITEM_CANCEL),q()(r,b.FILE_STATES.ABORTED,P.ITEM_ABORT),q()(r,b.FILE_STATES.UPLOADING,P.ITEM_PROGRESS),r),le=[b.FILE_STATES.FINISHED,b.FILE_STATES.ERROR,b.FILE_STATES.CANCELLED,b.FILE_STATES.ABORTED],se=function(e){return!!~M()(le).call(le,e.state)},de=function(e,t,n){return o()(t).call(t,(function(t){var n,r=e.getState(),a=t.id,o=t.info;if(b.logger.debugLog("uploader.processor.queue: request finished for item - ",{id:a,info:o}),r.items[a]){e.updateState((function(e){var t=e.items[a];t.state=o.state,t.uploadResponse=o.response,se(t)&&delete e.aborts[a]}));var u=e.getState().items[a];o.state===b.FILE_STATES.FINISHED&&u.completed<100&&e.handleItemProgress(u,100,u.file?u.file.size:0),e.trigger(ce[u.state],u),se(u)&&e.trigger(P.ITEM_FINALIZE,u)}var c=M()(n=r.itemQueue).call(n,a);~c&&e.updateState((function(e){var t,n;i()(t=e.itemQueue).call(t,c,1);var r,o=M()(n=e.activeIds).call(n,a);~o&&i()(r=e.activeIds).call(r,o,1)}))})),oe(e),n(e)},fe=Object(b.getMerge)({undefinedOverwrites:!0}),pe=function(){var e=v()(d.a.mark((function e(t,n,r){var a;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(b.triggerUpdater)(t.trigger,P.REQUEST_PRE_SEND,{items:n,options:r});case 2:if(!(a=e.sent)){e.next=10;break}if(b.logger.debugLog("uploader.queue: REQUEST_PRE_SEND event returned updated items/options",a),!a.items){e.next=9;break}if(a.items.length===n.length&&Object(b.isSamePropInArrays)(a.items,n,["id","batchId"])){e.next=8;break}throw new Error("REQUEST_PRE_SEND event handlers must return same items with same ids");case 8:n=a.items;case 9:a.options&&(r=fe({},r,a.options));case 10:return e.abrupt("return",{items:n,options:r});case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),ge=function(){var e=v()(d.a.mark((function e(t,n){var r,a;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=y()(n).call(n,(function(e){return e.id})),t.updateState((function(e){var t;e.activeIds=p()(t=e.activeIds).call(t,r)})),a=t.getState().batches[n[0].batchId].batchOptions,e.next=5,pe(t,n,a);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ve=function(e,t,n){e.updateState((function(e){o()(t).call(t,(function(t){e.items[t.id].state=b.FILE_STATES.UPLOADING,e.aborts[t.id]=n.abort}))}))},Ee=function(){var e=v()(d.a.mark((function e(t,n,r){var a,o,u,i,c,l;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.items,o=n.options,u=t.getState().batches[a[0].batchId].batch,i=t.sender.send(a,u,o),ve(t,a,i),e.next=6,i.request;case 6:c=e.sent,l=y()(a).call(a,(function(e){return{id:e.id,info:c}})),de(t,l,r);case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),he=function(e,t,n,r){var a,o=R()(a=y()(n).call(n,(function(e,n){return e?t[n].id:null}))).call(a,Boolean);if(o.length){var u=y()(o).call(o,(function(e){return{id:e,info:{status:0,state:b.FILE_STATES.CANCELLED,response:"cancel"}}}));de(e,u,r)}return!!o.length},Se=function(e,t){return t.getState().items[e]},be=function(){var e=v()(d.a.mark((function e(t,n,r){var a,o,u,i,c,l;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.getState(),u=h()(o.items),u=R()(u).call(u,(function(e){return!!~M()(n).call(n,e.id)})),e.next=5,G.a.all(y()(u).call(u,(function(e){return t.cancellable(P.ITEM_START,e)})));case 5:if(i=e.sent,!(c=R()(a=y()(i).call(i,(function(e,n){return e?null:Se(u[n].id,t)}))).call(a,Boolean)).length){e.next=12;break}return e.next=10,ge(t,c);case 10:l=e.sent,Ee(t,l,r);case 12:if(he(t,u,i,r)){e.next=15;break}return e.next=15,r(t);case 15:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),me=function(e,t){var n,r;return!!~M()(n=j()(r=e.getState().activeIds).call(r)).call(n,t)},Te=function(e){var t,n=e.getState().itemQueue,r=function(e){for(var t=e.getState(),n=t.itemQueue,r=t.items,a=0,o=n[a];o&&(me(e,o)||!ie(e,o)||r[o].state!==b.FILE_STATES.ADDED);)o=n[a+=1];return o?a:-1}(e),a=n[r];if(a){var o=V(e,a),u=o.batch.id,i=o.batchOptions.maxGroupSize||0;if(o.batchOptions.grouped&&i>1){t=[];for(var c=!0;t.length<i&&c;)t.push(a),c=(a=n[r+t.length])&&W(e,a,u)}else t=[a]}return t},Ae=function(){var e=v()(d.a.mark((function e(t){var n,r,a,o,u,i,c,l,s;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=Te(t))){e.next=13;break}if(r=t.getCurrentActiveCount(),a=t.getOptions(),o=a.concurrent,u=void 0===o?0:o,i=a.maxConcurrent,c=void 0===i?0:i,r&&!(u&&r<c)){e.next=13;break}if(b.logger.debugLog("uploader.processor: Processing next upload - ",{ids:n,state:t.getState(),currentCount:r}),l=!1,!re(t,n[0])){e.next=12;break}return e.next=9,ae(t,n[0]);case 9:s=e.sent,(l=!s)&&(ne(t,n[0]),Ae(t));case 12:l||be(t,n,Ae);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Re=Ae,Ie=n("+oHS"),ye=n.n(Ie),_e=function(e,t,n){var r=!1,a=e.getState(),o=a.items[t];return o&&function(e){return e===b.FILE_STATES.ADDED||e===b.FILE_STATES.UPLOADING}(o.state)&&(b.logger.debugLog("uploader.queue: aborting item in progress - ",o),o.state===b.FILE_STATES.UPLOADING?(e.updateState((function(e){e.items[t].state=b.FILE_STATES.ABORTED})),r=a.aborts[t]()):(de(e,[{id:t,info:{status:0,state:b.FILE_STATES.ABORTED,response:"aborted"}}],n),r=!0)),r},Oe=function(e,t,n,r,a){var u=Object(b.getUpdateable)({itemQueue:[],currentBatch:null,batches:{},items:{},activeIds:[],aborts:{}}),i=u.state,c=u.update,l=function(){return i},s=function(e){c(e)},d=function(e){var t;if(i.items[e.id])throw new Error(p()(t="Uploader queue conflict - item ".concat(e.id," already exists (recycled: ")).call(t,String(e.recycled),")"));s((function(t){t.items[e.id]=e,t.itemQueue.push(e.id)}))},f=function(e,t,r){i.items[e.id]&&(s((function(n){var a=n.items[e.id];a.loaded=r,a.completed=t})),n(P.ITEM_PROGRESS,l().items[e.id]))};r.on(B.ITEM_PROGRESS,f),r.on(B.BATCH_PROGRESS,(function(e){var t,r=null===(t=i.batches[e.id])||void 0===t?void 0:t.batch.items;if(r){var a=F()(r).call(r,(function(e,t){return e[0]+=t.completed,e[1]+=t.loaded,e}),[0,0]),o=N()(a,2),u=o[0],c=o[1];s((function(t){var n=t.batches[e.id].batch;n.completed=u/r.length,n.loaded=c})),n(P.BATCH_PROGRESS,i.batches[e.id].batch)}}));var g={getOptions:function(){return e},getCurrentActiveCount:function(){return i.activeIds.length},getState:l,updateState:s,trigger:n,cancellable:t,sender:r,handleItemProgress:f};b.logger.isDebugOn()&&(window["__rpldy_".concat(a,"_queue_state")]=g);return{updateState:s,getState:g.getState,uploadBatch:function(e,t){var n;s((function(n){n.batches[e.id]={batch:e,batchOptions:t}})),o()(n=e.items).call(n,d),Re(g)},abortItem:function(e){return function(e,t,n){return _e(e,t,n)}(g,e,Re)},abortBatch:function(e){!function(e,t,n){var r,a=e.getState().batches[t],u=null==a?void 0:a.batch;u&&u.state!==b.BATCH_STATES.CANCELLED&&u.state!==b.BATCH_STATES.FINISHED&&(o()(r=u.items).call(r,(function(t){return _e(e,t.id,n)})),e.updateState((function(e){Y(e,t).state=b.BATCH_STATES.ABORTED})),ue(e,t,P.BATCH_ABORT))}(g,e,Re)},abortAll:function(){var e,t,n,r;t=Re,r=(e=g).getState().items,o()(n=ye()(r)).call(n,(function(n){return _e(e,n,t)}))}}},Le=n("jRAa"),we=function(e,t,n,r){!function(e,t,n,r){o()(e).call(e,(function(e){var a,o;b.logger.debugLog(p()(a=p()(o="uploady.uploader.processor: file: ".concat(e.id," progress event: loaded(")).call(o,n,") - completed(")).call(a,t,")")),r(B.ITEM_PROGRESS,e,t,n)}))}(e,Math.min(n.loaded/n.total*100,100)/e.length,n.loaded/e.length,r),r(B.BATCH_PROGRESS,t)},De=function(e,t,n){var r=Object(b.triggerCancellable)(e),a=function(){var e=Object(S.default)({send:function(e,n,r){var a=r.destination,o=null==a?void 0:a.url;if(!o)throw new Error("Destination URL not found! Can't send files without it");var u=Object(b.throttle)((function(r){return we(e,n,r,t)}),50,!0),i=Object(b.isFunction)(r.send)?r.send:Le.default;return i(e,o,{method:(null==a?void 0:a.method)||r.method||O.method,paramName:(null==a?void 0:a.filesParamName)||r.inputFieldName||"file",params:Z()(Z()({},r.params),null==a?void 0:a.params),forceJsonResponse:r.forceJsonResponse,withCredentials:r.withCredentials,formatGroupParamName:r.formatGroupParamName,headers:null==a?void 0:a.headers,sendWithFormData:r.sendWithFormData},u)}},h()(B)),t=e.trigger;return e.target}(),o=Oe(t,r,e,a,n);return{process:function(e,t){o.uploadBatch(e,t)},abortBatch:function(e){o.abortBatch(e)},abort:function(e){e?o.abortItem(e):o.abortAll()}}},Ce=h()(P),Fe=0,xe=function(e){var t="uploader-".concat(Fe+=1),n=!1,r=[],a={};b.logger.debugLog("uploady.uploader: creating new instance (".concat(t,")"),{options:e,counter:Fe});var u=function(e){return Z()(Z()(Z()({},O),e),{},{destination:e&&e.destination?(t=e.destination,Z()({filesParamName:"file",params:{}},t)):null});var t}(e),c=function(){var e=v()(d.a.mark((function e(t,n){var a,o,i;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=Object(b.merge)({},u,n),!(o=D(t,g.id,a)).items.length){e.next=9;break}return e.next=5,E(P.BATCH_ADD,o,a);case 5:e.sent?(o.state=b.BATCH_STATES.CANCELLED,f(P.BATCH_CANCEL,o)):(b.logger.debugLog(p()(i="uploady.uploader [".concat(g.id,"]: new items added - auto upload = ")).call(i,String(a.autoUpload)),o.items),a.autoUpload?m.process(o,a):r.push({batch:o,uploadOptions:a})),e.next=10;break;case 9:b.logger.debugLog("uploady.uploader: no items to add. batch ".concat(o.id," is empty. check fileFilter if this isn't intended"));case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),s=Object(S.default)({id:t,update:function(e){return u=Object(b.merge)({},u,e),g},add:c,upload:function(){var e;o()(e=i()(r).call(r,0)).call(e,(function(e){var t=e.batch,n=e.uploadOptions;return m.process(t,n)}))},abort:function(e){m.abort(e)},abortBatch:function(e){m.abortBatch(e)},getOptions:function(){return Object(b.clone)(u)},getPending:function(){return l()(r).call(r)},clearPending:function(){i()(r).call(r,0)},registerExtension:function(e,t){Object(b.invariant)(n,"Uploady - uploader extensions can only be registered by enhancers"),Object(b.invariant)(!a[e],"Uploady - uploader extension by this name [%s] already exists",e),b.logger.debugLog("uploady.uploader: registering extension: ".concat(e.toString()),t),a[e]=t},getExtension:function(e){return a[e]}},Ce,{canAddEvents:!1,canRemoveEvents:!1}),f=s.trigger,g=s.target,E=Object(b.triggerCancellable)(f);if(u.enhancer){n=!0;var h=u.enhancer(g,f);n=!1,g=h||g}var m=De(f,u,g.id);return Object(b.devFreeze)(g)},Ne=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return F()(t).call(t,(function(e,t){var n;return t.apply(void 0,p()(n=[e]).call(n,r))||e}),e)}};t.default=xe},jRAa:function(e,t,n){"use strict";n.r(t),n.d(t,"send",(function(){return w})),n.d(t,"createMockSender",(function(){return M})),n.d(t,"XHR_SENDER_TYPE",(function(){return E})),n.d(t,"MOCK_SENDER_TYPE",(function(){return h}));var r=n("o+MX"),a=n.n(r),o=n("a0dU"),u=n.n(o),i=n("SPx3"),c=n.n(i),l=n("ZbhI"),s=n.n(l),d=n("UtpJ"),f=n.n(d),p=n("kT1S"),g=n.n(p),v=n("KkDc"),E="rpldy-sender",h="rpldy-mock-sender",S=n("zLi2"),b=n.n(S),m=n("i5y0"),T=n.n(m),A=n("RXMP"),R=n.n(A),I=function(e,t){var n,r=new FormData;(function(e,t,n){var r=1===t.length;R()(t).call(t,(function(t,o){var u,i=r?n.paramName:Object(v.isFunction)(n.formatGroupParamName)?n.formatGroupParamName(o,n.paramName):a()(u="".concat(n.paramName,"[")).call(u,o,"]");t.file?e.set(i,t.file,t.file.name):t.url&&e.set(i,t.url)}))}(r,e,t),t.params)&&R()(n=T()(t.params)).call(n,(function(e){var t=b()(e,2),n=t[0],a=t[1];return r.set(n,a)}));return r},y=[200,201,202,203,204],_=function(e,t,n,r){var a=function(e,t){var n;if(t.sendWithFormData)v.logger.debugLog("uploady.sender: sending ".concat(e.length," item(s) as form data")),n=I(e,t);else{if(e.length>1)throw new Error("XHR Sender - Request without form data can only contain 1 item. received ".concat(e.length));var r=e[0];v.logger.debugLog("uploady.sender: sending item ".concat(r.id," as request body")),n=r.file||r.url}return n}(e,n),o=Object(v.request)(t,a,g()(g()({},Object(v.pick)(n,["method","headers","withCredentials"])),{},{preSend:function(t){t.upload.onprogress=function(t){t.lengthComputable&&r&&r(t,f()(e).call(e))}}}));return{url:t,count:e.length,pXhr:o,xhr:o.xhr,aborted:!1}},O=function(e,t,n){var r=e,a=t&&t["content-type"];if(n.forceJsonResponse||a&&~s()(a).call(a,"json"))try{r=JSON.parse(e)}catch(e){}return r},L=function(){var e=c()(u.a.mark((function e(t,n){var r,a,o,i,c;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=0,e.prev=1,e.next=4,t.pXhr;case 4:i=e.sent,v.logger.debugLog("uploady.sender: received upload response ",i),r=~s()(y).call(y,i.status)?v.FILE_STATES.FINISHED:v.FILE_STATES.ERROR,o=i.status,c=Object(v.parseResponseHeaders)(i),a={data:O(i.response,c,n),headers:c},e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),t.aborted?(r=v.FILE_STATES.ABORTED,a="aborted"):(v.logger.debugLog("uploady.sender: upload failed: ",e.t0),r=v.FILE_STATES.ERROR,a=e.t0);case 15:return e.abrupt("return",{status:o,state:r,response:a});case 16:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(t,n){return e.apply(this,arguments)}}(),w=function(e,t,n,r){v.logger.debugLog("uploady.sender: sending file: ",{items:e,url:t,options:n});var o=_(e,t,n,r);return{request:L(o,n),abort:function(){return function(e){var t,n=!1,r=e.aborted,o=e.xhr;!r&&o.readyState&&4!==o.readyState&&(v.logger.debugLog(a()(t="uploady.sender: cancelling request with ".concat(e.count," items to: ")).call(t,e.url)),o.abort(),e.aborted=!0,n=!0);return n}(o)},senderType:E}},D=n("eLKs"),C=n.n(D),F=n("FLGM"),x=n.n(F),N=n("Kwsy"),P=n.n(N),B=n("OBge"),H=n.n(B),j=Object(v.devFreeze)({delay:500,fileSize:1e6,progressIntervals:[10,25,50,75,99]}),k=function(e,t){return e.then((function(e){return v.logger.debugLog("uploady.mockSender: mock request finished successfully"),{status:t.responseStatus||200,state:v.FILE_STATES.FINISHED,response:g()(g()({},e),{},{headers:{"x-request-type":"react-uploady.mockSender"},data:t.response||{mock:!0,success:!0}})}})).catch((function(){return v.logger.debugLog("uploady.mockSender: mock request was aborted"),{status:0,state:v.FILE_STATES.ABORTED,response:"abort"}}))},M=function(e){var t=g()(g()({},j),e);return{send:function(e,n,r,a){v.logger.debugLog("uploady.mockSender: about to make a mock request for items: ",e);var o=function(e,t){var n,r,a=performance.now(),o=[],u=!1,i=!1,c=null,l=null,s=null,d=function(){l&&(R()(l).call(l,(function(e){clearTimeout(e)})),l=null)},f=new H.a((function(t,n){s=n,P()((function(){i=!0,t({options:e,time:performance.now()-a,progressEvents:o}),d()}),e.delay||0)}));e.progressIntervals&&(l=x()(r=e.progressIntervals).call(r,(function(n){var r=n/100,a=(e.delay||0)*r;return P()((function(){if(!u&&!i&&c){var n={total:e.fileSize||0,loaded:(e.fileSize||0)*r};o.push(n),c(n,t)}}),a)})));return{then:C()(n=f.then).call(n,f),abort:function(){return u=!0,i=!0,s&&s(),d(),!0},onProgress:function(e){c=e}}}(t,e);return o.onProgress(a),{request:k(o,t),abort:o.abort,senderType:h}},update:function(e){t=g()(g()({},t),e)}}};t.default=w}})})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.rpldy=t():e.rpldy=t()}(window,(function(){return function(e){function t(t){for(var r,u,i=t[0],c=t[1],l=t[2],d=0,f=[];d<i.length;d++)u=i[d],Object.prototype.hasOwnProperty.call(a,u)&&a[u]&&f.push(a[u][0]),a[u]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);for(s&&s(t);f.length;)f.shift()();return o.push.apply(o,l||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,i=1;i<n.length;i++){var c=n[i];0!==a[c]&&(r=!1)}r&&(o.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},a={core:0},o=[];function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="";var i=window.webpackJsonprpldy=window.webpackJsonprpldy||[],c=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var s=c;return o.push([0,"polyfills"]),n()}({0:function(e,t,n){n("9SVt"),n("KkDc"),n("jRAa"),e.exports=n("QELF")},"9SVt":function(e,t,n){"use strict";n.r(t),n.d(t,"addLife",(function(){return ue})),n.d(t,"isLE",(function(){return J}));var r=n("04Ix"),a=n.n(r),o=n("RSWj"),u=n.n(o),i=n("HnXd"),c=n.n(i),l=n("M5Mt"),s=n.n(l),d=n("OBge"),f=n.n(d),p=n("FLGM"),g=n.n(p),v=n("5PDf"),E=n.n(v),h=n("kT1S"),S=n.n(h),b=n("eLKs"),m=n.n(b),T=n("+oHS"),A=n.n(T),y=n("zLi2"),_=n.n(y),I=n("i5y0"),R=n.n(I),O=n("KYsz"),L=n.n(O),w=n("STz3"),D=n.n(w),C=n("cdeZ"),F=n.n(C),x=n("UtpJ"),N=n.n(x),P=n("/FZm"),B=n.n(P),H=n("ZbhI"),j=n.n(H),k=n("JlUD"),M=n.n(k),G=n("KkDc"),U=Object(G.devFreeze)({allowRegisterNonExistent:!0,canAddEvents:!0,canRemoveEvents:!0,collectStats:!1}),z=function(e,t){if(!Object(G.isFunction)(e))throw new Error("'".concat(t,"' is not a valid function"))},q=function(e){return void 0===e},Q=n("CtDf"),K=n.n(Q)()("__le__"),X=function(e){return e?e[K]:null},Z=function(e){var t=X(e);if(!t)throw new Error("Didnt find LE internal object. Something very bad happened!");return t},J=function(e){return!!X(e)},Y=function(e,t,n){var r,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];z(n,"cb");var o=Z(e);if(!o.options.allowRegisterNonExistent&&!~j()(r=o.events).call(r,t))throw new Error("Cannot register for event ".concat(t.toString()," that wasn't already defined (allowRegisterNonExistent = false)"));var u={name:t,cb:n,once:a},i=o.registry[t]||[];return B()(i).call(i,(function(e){return e.cb===n}))||(i.push(u),o.registry[t]=i),function(){return ae.call(e,t,n)}},W=function(e,t){var n,r,a=Z(e).registry;return t?a[t]?N()(n=a[t]).call(n):[]:F()(r=D()(a)).call(r)},V={on:function(e,t){return Y(this,e,t)},once:function(e,t){return Y(this,e,t,!0)},off:ae,getEvents:function(){var e;return N()(e=Z(this).events).call(e)}},$=function(){var e;return L()(e=R()(V)).call(e,(function(e,t){var n=_()(t,2),r=n[0],a=n[1];return e[r]={value:a},e}),{})},ee={trigger:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];var o,u,i,c=W(this,e);c.length&&(o=g()(u=E()(i=g()(c).call(c,(function(n){return n.once&&re(t,e,n.cb),r.length?1===r.length?n.cb(r[0]):2===r.length?n.cb(r[0],r[1]):3===r.length?n.cb(r[0],r[1],r[2]):n.cb.apply(n,r):n.cb()}))).call(i,(function(e){return!q(e)}))).call(u,(function(e){return M()(e)?e:f.a.resolve(e)})));return o&&(o.length?o:void 0)},addEvent:function(e){var t=Z(this);if(!t.options.canAddEvents)throw new Error("Cannot add new events (canAddEvents = false)");var n;if(~j()(n=t.events).call(n,e))throw new Error("Event '".concat(e,"' already defined"));t.events.push(e)},removeEvent:function(e){var t=Z(this);if(!t.options.canRemoveEvents)throw new Error("Cannot remove events (canRemoveEvents = false)");var n,r,a=j()(n=t.events).call(n,e);s()(r=t.events).call(r,a,1)},hasEvent:function(e){var t,n=Z(this);return!!~j()(t=n.events).call(t,e)},hasEventRegistrations:function(e){return!!W(this,e).length},assign:function(e){var t=Z(this);return oe(e,t.options,t.events,t.registry,t.stats),te(e)}},te=function(e){var t;return L()(t=A()(ee)).call(t,(function(t,n){var r;return t[n]=m()(r=ee[n]).call(r,e),t}),S()({target:e},ee))},ne=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=Z(e).registry;!r[t]||!n&&r[t].length||delete r[t]},re=function(e,t,n){var r,a=Z(e).registry;a[t]&&(n?(a[t]=E()(r=a[t]).call(r,(function(e){return e.cb!==n})),ne(e,t)):ne(e,t,!0))};function ae(e,t){re(this,e,t)}var oe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};c()(e,S()(a()({},K,{value:u()({registry:r,events:n,options:t,stats:o})}),$()))},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return e=e||{},n=S()(S()({},U),n),J(e)||oe(e,n,t),te(e)};t.default=ue},KkDc:function(e,t,n){"use strict";n.r(t),n.d(t,"BATCH_STATES",(function(){return l})),n.d(t,"FILE_STATES",(function(){return s})),n.d(t,"invariant",(function(){return u.a})),n.d(t,"throttle",(function(){return c.a})),n.d(t,"logger",(function(){return r})),n.d(t,"triggerCancellable",(function(){return R})),n.d(t,"triggerUpdater",(function(){return L})),n.d(t,"createBatchItem",(function(){return B})),n.d(t,"request",(function(){return J})),n.d(t,"parseResponseHeaders",(function(){return Z})),n.d(t,"isFunction",(function(){return Y})),n.d(t,"isPlainObject",(function(){return ie})),n.d(t,"isSamePropInArrays",(function(){return te})),n.d(t,"devFreeze",(function(){return ne})),n.d(t,"merge",(function(){return se})),n.d(t,"getMerge",(function(){return le})),n.d(t,"clone",(function(){return de})),n.d(t,"pick",(function(){return fe}));var r={};n.r(r),n.d(r,"isDebugOn",(function(){return p})),n.d(r,"setDebug",(function(){return g})),n.d(r,"debugLog",(function(){return v}));var a,o=n("QLaP"),u=n.n(o),i=n("uDTZ"),c=n.n(i),l={ADDED:"added",PROCESSING:"processing",UPLOADING:"uploading",CANCELLED:"cancelled",FINISHED:"finished",ABORTED:"aborted"},s={ADDED:"added",UPLOADING:"uploading",CANCELLED:"cancelled",FINISHED:"finished",ERROR:"error",ABORTED:"aborted"},d=n("ZbhI"),f=n.n(d),p=function(){var e;"boolean"!=typeof a&&(a=!!~f()(e=window.location.search).call(e,"rpldy_debug=true")||!0===window["__rupy-logger-debug__"]);return a},g=function(e){window["__rupy-logger-debug__"]=e,a=!!e||null},v=function(){var e;p()&&(e=console).log.apply(e,arguments)},E=n("a0dU"),h=n.n(E),S=n("TEMH"),b=n.n(S),m=n("OBge"),T=n.n(m),A=n("o+MX"),y=n.n(A),_=n("SPx3"),I=n.n(_),R=function(e,t){for(var n,r=function(){var t=I()(h.a.mark((function t(n){var r,a,o,u,i,c,l,s=arguments;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a=!1,o=s.length,u=new Array(o>1?o-1:0),i=1;i<o;i++)u[i-1]=s[i];if(!(c=e.apply(void 0,y()(r=[n]).call(r,u)))||!c.length){t.next=8;break}return t.next=6,T.a.all(c);case 6:l=t.sent,a=!!~b()(l).call(l,(function(e){return!1===e}));case 8:return t.abrupt("return",a);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a=arguments.length,o=new Array(a>2?a-2:0),u=2;u<a;u++)o[u-2]=arguments[u];return t?r.apply(void 0,y()(n=[t]).call(n,o)):r},O=function(e){return null==e},L=function(e,t){for(var n,r=function(){var t=I()(h.a.mark((function t(n){var r,a,o,u,i,c,l,s=arguments;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o=s.length,u=new Array(o>1?o-1:0),i=1;i<o;i++)u[i-1]=s[i];if(!(c=e.apply(void 0,y()(r=[n]).call(r,u)))||!c.length){t.next=7;break}return t.next=5,T.a.all(c);case 5:for(l=t.sent;O(a)&&l.length;)a=l.pop();case 7:return t.abrupt("return",O(a)?void 0:a);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),a=arguments.length,o=new Array(a>2?a-2:0),u=2;u<a;u++)o[u-2]=arguments[u];return t?r.apply(void 0,y()(n=[t]).call(n,o)):r},w=n("LYCE"),D=n.n(w),C=n("nhkr"),F=n.n(C),x=n("CtDf"),N=n.n(x)()("__rpldy-bi__"),P=0,B=function(e,t){var n;P+=1;var r={id:e.id?e.id:y()(n="".concat(t,".item-")).call(n,P),batchId:t,state:s.ADDED,completed:0,loaded:0,aborted:!1,recycled:!1};if(D()(r,N,{value:!0}),"object"===F()(e)&&!0===e[N]&&(r.recycled=!0,e=e.file||e.url),"string"==typeof e)r=function(e,t){return e.url=t,e}(r,e);else{if(!function(e){return e&&(e instanceof Blob||e instanceof File||"object"===F()(e)&&e.name&&e.type)}(e))throw new Error("Unknown type of file added: ".concat(F()(e)));r=function(e,t){return e.file=t,e}(r,e)}return r},H=n("+oHS"),j=n.n(H),k=n("RXMP"),M=n.n(k),G=function(e,t){var n;t&&M()(n=j()(t)).call(n,(function(n){void 0!==t[n]&&e.setRequestHeader(n,t[n])}))},U=n("zLi2"),z=n.n(U),q=n("RKTd"),Q=n.n(q),K=n("KYsz"),X=n.n(K),Z=function(e){var t;try{var n,r;t=X()(n=Q()(r=e.getAllResponseHeaders()).call(r).split(/[\r\n]+/)).call(n,(function(e,t){var n=t.split(": "),r=z()(n,2),a=r[0],o=r[1];return e[a]=o,e}),{})}catch(t){v("uploady.request: failed to read response headers",e)}return t},J=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new XMLHttpRequest,a=new T.a((function(a,o){r.onerror=function(){return o(r)},r.ontimeout=function(){return o(r)},r.onabort=function(){return o(r)},r.onload=function(){return a(r)},r.open(n.method||"GET",e),G(r,n.headers),r.withCredentials=!!n.withCredentials,n.preSend&&n.preSend(r),r.send(t)}));return a.xhr=r,a},Y=function(e){return"function"==typeof e},W=n("/FZm"),V=n.n(W),$=n("FLGM"),ee=n.n($),te=function(e,t,n){var r=!0,a=function(e){var t,n=y()(t=[]).call(t,e);return function(e){return ee()(e).call(e,(function(e){return ee()(n).call(n,(function(t){return e[t]})).join()}))}}(n);if(e&&t&&e.length===t.length){var o=a(e),u=a(t);r=!!V()(o).call(o,(function(e,t){return e!==u[t]}))}return!r},ne=(n("9yv6"),function(e){return e}),re=n("6UaR"),ae=n.n(re),oe=n("zKQ6"),ue=n.n(oe),ie=function(e){var t;return!!e&&"object"===F()(e)&&("Object"===(null===(t=ue()(e))||void 0===t?void 0:t.constructor.name)||null===ue()(e))},ce=function(e){return ie(e)||ae()(e)},le=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=function t(n){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return n&&a.length&&M()(a).call(a,(function(r){var a;r&&M()(a=j()(r)).call(a,(function(a){var o=r[a];(void 0!==o||e.undefinedOverwrites)&&(ce(o)?(void 0!==n[a]&&ie(n[a])||(n[a]=ae()(o)?[]:{}),t(n[a],o)):n[a]=o)}))})),n};return t},se=le(),de=function(e){return ce(e)?se(ae()(e)?[]:{},e):e},fe=function(e,t){var n;return e&&X()(n=j()(e)).call(n,(function(n,r){return~f()(t).call(t,r)&&(n[r]=e[r]),n}),{})}},QELF:function(e,t,n){"use strict";n.r(t),n.d(t,"UPLOADER_EVENTS",(function(){return K})),n.d(t,"DEFAULT_OPTIONS",(function(){return O})),n.d(t,"composeEnhancers",(function(){return Ge})),n.d(t,"createUploader",(function(){return Me})),n.d(t,"send",(function(){return Pe.send})),n.d(t,"createMockSender",(function(){return Pe.createMockSender})),n.d(t,"XHR_SENDER_TYPE",(function(){return Pe.XHR_SENDER_TYPE})),n.d(t,"MOCK_SENDER_TYPE",(function(){return Pe.MOCK_SENDER_TYPE}));var r,a=n("RXMP"),o=n.n(a),u=n("M5Mt"),i=n.n(u),c=n("UtpJ"),l=n.n(c),s=n("a0dU"),d=n.n(s),f=n("o+MX"),p=n.n(f),g=n("SPx3"),v=n.n(g),E=n("STz3"),h=n.n(E),S=n("9SVt"),b=n("KkDc"),m=n("6UaR"),T=n.n(m),A=n("5PDf"),y=n.n(A),_=n("FLGM"),I=n.n(_),R=function(){return!0},O=Object(b.devFreeze)({autoUpload:!0,inputFieldName:"file",concurrent:!1,maxConcurrent:2,grouped:!1,maxGroupSize:5,method:"POST",params:{},fileFilter:R,forceJsonResponse:!1,withCredentials:!1,destination:{},send:null,sendWithFormData:!0}),L=0,w=function(e,t,n){var r;return I()(r=y()(Array.prototype).call(t,n||R)).call(r,(function(t){return Object(b.createBatchItem)(t,e)}))},D=function(e,t,n){var r="batch-".concat(L+=1),a=e instanceof FileList||"[object FileList]"===e.toString();return e=T()(e)||a?e:[e],{id:r,uploaderId:t,items:w(r,e,n.fileFilter),state:b.BATCH_STATES.ADDED,completed:0,loaded:0}},C=n("KYsz"),F=n.n(C),x=n("zLi2"),N=n.n(x),P=n("Vi3r"),B=n.n(P),H=(n("LYCE"),n("+oHS")),j=n.n(H),k=(n("OWCx"),n("ZbhI")),M=n.n(k),G=n("CtDf"),U=n.n(G),z=(U()("__rpldy-sstt-proxy__"),U()("__rpldy-sstt-state__"),function(e,t){0}),q=function(e){return e},Q=function(e){var t=e;return{state:t,update:function(e){try{z(),e(t)}finally{z()}return t},unwrap:function(e){return e?q(e):t}}},K=Object(b.devFreeze)({BATCH_ADD:"BATCH-ADD",BATCH_START:"BATCH-START",BATCH_PROGRESS:"BATCH_PROGRESS",BATCH_FINISH:"BATCH-FINISH",BATCH_ABORT:"BATCH-ABORT",BATCH_CANCEL:"BATCH-CANCEL",ITEM_START:"FILE-START",ITEM_CANCEL:"FILE-CANCEL",ITEM_PROGRESS:"FILE-PROGRESS",ITEM_FINISH:"FILE-FINISH",ITEM_ABORT:"FILE-ABORT",ITEM_ERROR:"FILE-ERROR",ITEM_FINALIZE:"FILE-FINALIZE",REQUEST_PRE_SEND:"REQUEST_PRE_SEND"}),X=Object(b.devFreeze)({ITEM_PROGRESS:"ITEM_PROGRESS",BATCH_PROGRESS:"BATCH_PROGRESS"}),Z=n("cdeZ"),J=n.n(Z),Y=n("OBge"),W=n.n(Y),V=n("04Ix"),$=n.n(V),ee=n("mnMc"),te=n.n(ee),ne=n("kT1S"),re=n.n(ne),ae=[b.BATCH_STATES.ADDED,b.BATCH_STATES.PROCESSING,b.BATCH_STATES.UPLOADING],oe=function(e,t){return e.batches[t].batch},ue=function(e,t,n){return e.getState().items[t].batchId===n},ie=function(e,t){var n=e.getState(),r=n.items[t];return n.batches[r.batchId]},ce=function(e,t){return ie(e,t).batch},le=function(e,t){var n,r=function(e,t){return oe(e.getState(),t)}(e,t),a=I()(n=r.items).call(n,(function(e){return e.id}));e.updateState((function(e){o()(a).call(a,(function(t){var n;delete e.items[t];var r,a=M()(n=e.itemQueue).call(n,t);~a&&i()(r=e.itemQueue).call(r,a,1)}))}))},se=function(e,t){e.updateState((function(e){delete e.batches[t]}))},de=function(e,t){var n=ce(e,t),r=n.id;b.logger.debugLog("uploady.uploader.processor: cancelling batch: ",{batch:n}),e.updateState((function(e){oe(e,r).state=b.BATCH_STATES.CANCELLED})),ve(e,r,K.BATCH_CANCEL),le(e,r),se(e,r)},fe=function(e,t){var n=ce(e,t);return e.getState().currentBatch!==n.id},pe=function(){var e=v()(d.a.mark((function e(t,n){var r,a;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=ce(t,n),e.next=3,t.cancellable(K.BATCH_START,r);case 3:return(a=e.sent)||t.updateState((function(e){e.currentBatch=r.id})),e.abrupt("return",!a);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),ge=function(e){var t=e.getState().currentBatch;t&&function(e){var t=e.getState().itemQueue;return 0===t.length||fe(e,t[0])}(e)&&(ve(e,t,K.BATCH_FINISH),le(e,t),se(e,t))},ve=function(e,t,n){var r,a=e.getState(),o=oe(a,t),u=a.items,i=re()(re()({},q(o)),{},{items:I()(r=o.items).call(r,(function(e){var t=e.id;return q(u[t])}))});e.trigger(n,i)},Ee=function(e,t){var n=ce(e,t);return te()(ae).call(ae,n.state)},he=(r={},$()(r,b.FILE_STATES.ADDED,K.ITEM_START),$()(r,b.FILE_STATES.FINISHED,K.ITEM_FINISH),$()(r,b.FILE_STATES.ERROR,K.ITEM_ERROR),$()(r,b.FILE_STATES.CANCELLED,K.ITEM_CANCEL),$()(r,b.FILE_STATES.ABORTED,K.ITEM_ABORT),$()(r,b.FILE_STATES.UPLOADING,K.ITEM_PROGRESS),r),Se=[b.FILE_STATES.FINISHED,b.FILE_STATES.ERROR,b.FILE_STATES.CANCELLED,b.FILE_STATES.ABORTED],be=function(e){return!!~M()(Se).call(Se,e.state)},me=function(e,t,n){return o()(t).call(t,(function(t){var n,r=e.getState(),a=t.id,o=t.info;if(b.logger.debugLog("uploader.processor.queue: request finished for item - ",{id:a,info:o}),r.items[a]){e.updateState((function(e){var t=e.items[a];t.state=o.state,t.uploadResponse=o.response,be(t)&&delete e.aborts[a]}));var u=e.getState().items[a];o.state===b.FILE_STATES.FINISHED&&u.completed<100&&e.handleItemProgress(u,100,u.file?u.file.size:0),e.trigger(he[u.state],u),be(u)&&e.trigger(K.ITEM_FINALIZE,u)}var c=M()(n=r.itemQueue).call(n,a);~c&&e.updateState((function(e){var t,n;i()(t=e.itemQueue).call(t,c,1);var r,o=M()(n=e.activeIds).call(n,a);~o&&i()(r=e.activeIds).call(r,o,1)}))})),ge(e),n(e)},Te=Object(b.getMerge)({undefinedOverwrites:!0}),Ae=function(){var e=v()(d.a.mark((function e(t,n,r){var a;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(b.triggerUpdater)(t.trigger,K.REQUEST_PRE_SEND,{items:I()(n).call(n,(function(e){return q(e)})),options:q(r)});case 2:if(!(a=e.sent)){e.next=10;break}if(b.logger.debugLog("uploader.queue: REQUEST_PRE_SEND event returned updated items/options",a),!a.items){e.next=9;break}if(a.items.length===n.length&&Object(b.isSamePropInArrays)(a.items,n,["id","batchId","recycled"])){e.next=8;break}throw new Error("REQUEST_PRE_SEND event handlers must return same items with same ids");case 8:n=a.items;case 9:a.options&&(r=Te({},r,a.options));case 10:return e.abrupt("return",{items:n,options:r,cancelled:!1===a});case 11:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),ye=function(){var e=v()(d.a.mark((function e(t,n){var r,a,u,i;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=I()(n).call(n,(function(e){return e.id})),t.updateState((function(e){var t;e.activeIds=p()(t=e.activeIds).call(t,r)})),e.next=4,Ae(t,n,t.getState().batches[n[0].batchId].batchOptions);case 4:return(a=e.sent).cancelled||(t.updateState((function(e){var t;o()(t=a.items).call(t,(function(t){e.items[t.id]=t})),e.batches[n[0].batchId].batchOptions=a.options})),i=t.getState(),a.items=I()(u=a.items).call(u,(function(e){return i.items[e.id]})),a.options=i.batches[n[0].batchId].batchOptions),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),_e=function(e,t,n){e.updateState((function(e){o()(t).call(t,(function(t){e.items[t.id].state=b.FILE_STATES.UPLOADING,e.aborts[t.id]=n.abort}))}))},Ie=function(){var e=v()(d.a.mark((function e(t,n,r){var a,o,u,i,c,l;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=n.items,o=n.options,u=t.getState().batches[a[0].batchId].batch,i=t.sender.send(a,u,o),_e(t,a,i),e.next=6,i.request;case 6:c=e.sent,l=I()(a).call(a,(function(e){return{id:e.id,info:c}})),me(t,l,r);case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Re=function(e,t,n,r){var a,o=y()(a=I()(n).call(n,(function(e,n){return e?t[n].id:null}))).call(a,Boolean);if(o.length){var u=I()(o).call(o,(function(e){return{id:e,info:{status:0,state:b.FILE_STATES.CANCELLED,response:"cancel"}}}));me(e,u,r)}return!!o.length},Oe=function(e,t){return t.getState().items[e]},Le=function(){var e=v()(d.a.mark((function e(t,n,r){var a,o,u,i,c,l;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.getState(),u=h()(o.items),u=y()(u).call(u,(function(e){return!!~M()(n).call(n,e.id)})),e.next=5,W.a.all(I()(u).call(u,(function(e){return t.cancellable(K.ITEM_START,e)})));case 5:if(i=e.sent,!(c=y()(a=I()(i).call(i,(function(e,n){return e?null:Oe(u[n].id,t)}))).call(a,Boolean)).length){e.next=12;break}return e.next=10,ye(t,c);case 10:(l=e.sent).cancelled?i=I()(n).call(n,(function(){return!0})):Ie(t,l,r);case 12:if(Re(t,u,i,r)){e.next=15;break}return e.next=15,r(t);case 15:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),we=function(e,t){var n,r;return!!~M()(n=J()(r=e.getState().activeIds).call(r)).call(n,t)},De=function(e){var t,n=e.getState().itemQueue,r=function(e){for(var t=e.getState(),n=t.itemQueue,r=t.items,a=0,o=n[a];o&&(we(e,o)||!Ee(e,o)||r[o].state!==b.FILE_STATES.ADDED);)o=n[a+=1];return o?a:-1}(e),a=n[r];if(a){var o=ie(e,a),u=o.batch.id,i=o.batchOptions.maxGroupSize||0;if(o.batchOptions.grouped&&i>1){t=[];for(var c=!0;t.length<i&&c;)t.push(a),c=(a=n[r+t.length])&&ue(e,a,u)}else t=[a]}return t},Ce=function(){var e=v()(d.a.mark((function e(t){var n,r,a,o,u,i,c,l,s;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=De(t))){e.next=13;break}if(r=t.getCurrentActiveCount(),a=t.getOptions(),o=a.concurrent,u=void 0===o?0:o,i=a.maxConcurrent,c=void 0===i?0:i,r&&!(u&&r<c)){e.next=13;break}if(b.logger.debugLog("uploader.processor: Processing next upload - ",{ids:n,state:t.getState(),currentCount:r}),l=!1,!fe(t,n[0])){e.next=12;break}return e.next=9,pe(t,n[0]);case 9:s=e.sent,(l=!s)&&(de(t,n[0]),Ce(t));case 12:l||Le(t,n,Ce);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Fe=Ce,xe=function(e,t,n){var r=!1,a=e.getState(),o=a.items[t];return o&&function(e){return e===b.FILE_STATES.ADDED||e===b.FILE_STATES.UPLOADING}(o.state)&&(b.logger.debugLog("uploader.queue: aborting item in progress - ",o),o.state===b.FILE_STATES.UPLOADING?(e.updateState((function(e){e.items[t].state=b.FILE_STATES.ABORTED})),r=a.aborts[t]()):(me(e,[{id:t,info:{status:0,state:b.FILE_STATES.ABORTED,response:"aborted"}}],n),r=!0)),r},Ne=function(e,t,n,r,a){var u=Q({itemQueue:[],currentBatch:null,batches:{},items:{},activeIds:[],aborts:{}}),i=u.state,c=u.update,l=function(e){for(var t,r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return n.apply(void 0,p()(t=[e]).call(t,B()(I()(a).call(a,(function(e){return q(e)})))))},s=function(){return i},d=function(e){c(e)},f=function(e){var t;if(i.items[e.id])throw new Error(p()(t="Uploader queue conflict - item ".concat(e.id," already exists (recycled: ")).call(t,String(e.recycled),")"));d((function(t){t.items[e.id]=e,t.itemQueue.push(e.id)}))},g=function(e,t,n){i.items[e.id]&&(d((function(r){var a=r.items[e.id];a.loaded=n,a.completed=t})),l(K.ITEM_PROGRESS,s().items[e.id]))};r.on(X.ITEM_PROGRESS,g),r.on(X.BATCH_PROGRESS,(function(e){var t,n=null===(t=i.batches[e.id])||void 0===t?void 0:t.batch.items;if(n){var r=F()(n).call(n,(function(e,t){return e[0]+=t.completed,e[1]+=t.loaded,e}),[0,0]),a=N()(r,2),o=a[0],u=a[1];d((function(t){var r=t.batches[e.id].batch;r.completed=o/n.length,r.loaded=u})),l(K.BATCH_PROGRESS,i.batches[e.id].batch)}}));var v={getOptions:function(){return e},getCurrentActiveCount:function(){return i.activeIds.length},getState:s,updateState:d,trigger:l,cancellable:function(e){for(var n,r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];return t.apply(void 0,p()(n=[e]).call(n,B()(I()(a).call(a,(function(e){return q(e)})))))},sender:r,handleItemProgress:g};b.logger.isDebugOn()&&(window["__rpldy_".concat(a,"_queue_state")]=v);return{updateState:d,getState:v.getState,uploadBatch:function(e,t){var n;d((function(n){n.batches[e.id]={batch:e,batchOptions:t}})),o()(n=e.items).call(n,f),Fe(v)},abortItem:function(e){return function(e,t,n){return xe(e,t,n)}(v,e,Fe)},abortBatch:function(e){!function(e,t,n){var r,a=e.getState().batches[t],u=null==a?void 0:a.batch;u&&u.state!==b.BATCH_STATES.CANCELLED&&u.state!==b.BATCH_STATES.FINISHED&&(o()(r=u.items).call(r,(function(t){return xe(e,t.id,n)})),e.updateState((function(e){oe(e,t).state=b.BATCH_STATES.ABORTED})),ve(e,t,K.BATCH_ABORT))}(v,e,Fe)},abortAll:function(){var e,t,n,r;t=Fe,r=(e=v).getState().items,o()(n=j()(r)).call(n,(function(n){return xe(e,n,t)}))}}},Pe=n("jRAa"),Be=function(e,t,n,r){!function(e,t,n,r){o()(e).call(e,(function(e){var a,o;b.logger.debugLog(p()(a=p()(o="uploady.uploader.processor: file: ".concat(e.id," progress event: loaded(")).call(o,n,") - completed(")).call(a,t,")")),r(X.ITEM_PROGRESS,e,t,n)}))}(e,Math.min(n.loaded/n.total*100,100)/e.length,n.loaded/e.length,r),r(X.BATCH_PROGRESS,t)},He=function(e,t,n){var r=Object(b.triggerCancellable)(e),a=function(){var e=Object(S.default)({send:function(e,n,r){var a=r.destination,o=null==a?void 0:a.url;if(!o)throw new Error("Destination URL not found! Can't send files without it");var u=Object(b.throttle)((function(r){return Be(e,n,r,t)}),50,!0),i=Object(b.isFunction)(r.send)?r.send:Pe.default;return i(e,o,{method:(null==a?void 0:a.method)||r.method||O.method,paramName:(null==a?void 0:a.filesParamName)||r.inputFieldName||"file",params:re()(re()({},r.params),null==a?void 0:a.params),forceJsonResponse:r.forceJsonResponse,withCredentials:r.withCredentials,formatGroupParamName:r.formatGroupParamName,headers:null==a?void 0:a.headers,sendWithFormData:r.sendWithFormData},u)}},h()(X)),t=e.trigger;return e.target}(),o=Ne(t,r,e,a,n);return{process:function(e,t){o.uploadBatch(e,t)},abortBatch:function(e){o.abortBatch(e)},abort:function(e){e?o.abortItem(e):o.abortAll()}}},je=h()(K),ke=0,Me=function(e){var t="uploader-".concat(ke+=1),n=!1,r=[],a={};b.logger.debugLog("uploady.uploader: creating new instance (".concat(t,")"),{options:e,counter:ke});var u=function(e){return re()(re()(re()({},O),e),{},{destination:e&&e.destination?(t=e.destination,re()({filesParamName:"file",params:{}},t)):null});var t}(e),c=function(){var e=v()(d.a.mark((function e(t,n){var a,o,i;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=Object(b.merge)({},u,n),!(o=D(t,g.id,a)).items.length){e.next=9;break}return e.next=5,E(K.BATCH_ADD,o,a);case 5:e.sent?(o.state=b.BATCH_STATES.CANCELLED,f(K.BATCH_CANCEL,o)):(b.logger.debugLog(p()(i="uploady.uploader [".concat(g.id,"]: new items added - auto upload = ")).call(i,String(a.autoUpload)),o.items),a.autoUpload?m.process(o,a):r.push({batch:o,uploadOptions:a})),e.next=10;break;case 9:b.logger.debugLog("uploady.uploader: no items to add. batch ".concat(o.id," is empty. check fileFilter if this isn't intended"));case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),s=Object(S.default)({id:t,update:function(e){return u=Object(b.merge)({},u,e),g},add:c,upload:function(){var e;o()(e=i()(r).call(r,0)).call(e,(function(e){var t=e.batch,n=e.uploadOptions;return m.process(t,n)}))},abort:function(e){m.abort(e)},abortBatch:function(e){m.abortBatch(e)},getOptions:function(){return Object(b.clone)(u)},getPending:function(){return l()(r).call(r)},clearPending:function(){i()(r).call(r,0)},registerExtension:function(e,t){Object(b.invariant)(n,"Uploady - uploader extensions can only be registered by enhancers"),Object(b.invariant)(!a[e],"Uploady - uploader extension by this name [%s] already exists",e),b.logger.debugLog("uploady.uploader: registering extension: ".concat(e.toString()),t),a[e]=t},getExtension:function(e){return a[e]}},je,{canAddEvents:!1,canRemoveEvents:!1}),f=s.trigger,g=s.target,E=Object(b.triggerCancellable)(f);if(u.enhancer){n=!0;var h=u.enhancer(g,f);n=!1,g=h||g}var m=He(f,u,g.id);return Object(b.devFreeze)(g)},Ge=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return F()(t).call(t,(function(e,t){var n;return t.apply(void 0,p()(n=[e]).call(n,r))||e}),e)}};t.default=Me},jRAa:function(e,t,n){"use strict";n.r(t),n.d(t,"send",(function(){return w})),n.d(t,"createMockSender",(function(){return M})),n.d(t,"XHR_SENDER_TYPE",(function(){return E})),n.d(t,"MOCK_SENDER_TYPE",(function(){return h}));var r=n("o+MX"),a=n.n(r),o=n("a0dU"),u=n.n(o),i=n("SPx3"),c=n.n(i),l=n("ZbhI"),s=n.n(l),d=n("UtpJ"),f=n.n(d),p=n("kT1S"),g=n.n(p),v=n("KkDc"),E="rpldy-sender",h="rpldy-mock-sender",S=n("zLi2"),b=n.n(S),m=n("i5y0"),T=n.n(m),A=n("RXMP"),y=n.n(A),_=function(e,t){var n,r=new FormData;(function(e,t,n){var r=1===t.length;y()(t).call(t,(function(t,o){var u,i=r?n.paramName:Object(v.isFunction)(n.formatGroupParamName)?n.formatGroupParamName(o,n.paramName):a()(u="".concat(n.paramName,"[")).call(u,o,"]");t.file?e.set(i,t.file,t.file.name):t.url&&e.set(i,t.url)}))}(r,e,t),t.params)&&y()(n=T()(t.params)).call(n,(function(e){var t=b()(e,2),n=t[0],a=t[1];return r.set(n,a)}));return r},I=[200,201,202,203,204],R=function(e,t,n,r){var a=function(e,t){var n;if(t.sendWithFormData)v.logger.debugLog("uploady.sender: sending ".concat(e.length," item(s) as form data")),n=_(e,t);else{if(e.length>1)throw new Error("XHR Sender - Request without form data can only contain 1 item. received ".concat(e.length));var r=e[0];v.logger.debugLog("uploady.sender: sending item ".concat(r.id," as request body")),n=r.file||r.url}return n}(e,n),o=Object(v.request)(t,a,g()(g()({},Object(v.pick)(n,["method","headers","withCredentials"])),{},{preSend:function(t){t.upload.onprogress=function(t){t.lengthComputable&&r&&r(t,f()(e).call(e))}}}));return{url:t,count:e.length,pXhr:o,xhr:o.xhr,aborted:!1}},O=function(e,t,n){var r=e,a=t&&t["content-type"];if(n.forceJsonResponse||a&&~s()(a).call(a,"json"))try{r=JSON.parse(e)}catch(e){}return r},L=function(){var e=c()(u.a.mark((function e(t,n){var r,a,o,i,c;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=0,e.prev=1,e.next=4,t.pXhr;case 4:i=e.sent,v.logger.debugLog("uploady.sender: received upload response ",i),r=~s()(I).call(I,i.status)?v.FILE_STATES.FINISHED:v.FILE_STATES.ERROR,o=i.status,c=Object(v.parseResponseHeaders)(i),a={data:O(i.response,c,n),headers:c},e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),t.aborted?(r=v.FILE_STATES.ABORTED,a="aborted"):(v.logger.debugLog("uploady.sender: upload failed: ",e.t0),r=v.FILE_STATES.ERROR,a=e.t0);case 15:return e.abrupt("return",{status:o,state:r,response:a});case 16:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(t,n){return e.apply(this,arguments)}}(),w=function(e,t,n,r){v.logger.debugLog("uploady.sender: sending file: ",{items:e,url:t,options:n});var o=R(e,t,n,r);return{request:L(o,n),abort:function(){return function(e){var t,n=!1,r=e.aborted,o=e.xhr;!r&&o.readyState&&4!==o.readyState&&(v.logger.debugLog(a()(t="uploady.sender: cancelling request with ".concat(e.count," items to: ")).call(t,e.url)),o.abort(),e.aborted=!0,n=!0);return n}(o)},senderType:E}},D=n("eLKs"),C=n.n(D),F=n("FLGM"),x=n.n(F),N=n("Kwsy"),P=n.n(N),B=n("OBge"),H=n.n(B),j=Object(v.devFreeze)({delay:500,fileSize:1e6,progressIntervals:[10,25,50,75,99]}),k=function(e,t){return e.then((function(e){return v.logger.debugLog("uploady.mockSender: mock request finished successfully"),{status:t.responseStatus||200,state:v.FILE_STATES.FINISHED,response:g()(g()({},e),{},{headers:{"x-request-type":"react-uploady.mockSender"},data:t.response||{mock:!0,success:!0}})}})).catch((function(){return v.logger.debugLog("uploady.mockSender: mock request was aborted"),{status:0,state:v.FILE_STATES.ABORTED,response:"abort"}}))},M=function(e){var t=g()(g()({},j),e);return{send:function(e,n,r,a){v.logger.debugLog("uploady.mockSender: about to make a mock request for items: ",e);var o=function(e,t){var n,r,a=performance.now(),o=[],u=!1,i=!1,c=null,l=null,s=null,d=function(){l&&(y()(l).call(l,(function(e){clearTimeout(e)})),l=null)},f=new H.a((function(t,n){s=n,P()((function(){i=!0,t({options:e,time:performance.now()-a,progressEvents:o}),d()}),e.delay||0)}));e.progressIntervals&&(l=x()(r=e.progressIntervals).call(r,(function(n){var r=n/100,a=(e.delay||0)*r;return P()((function(){if(!u&&!i&&c){var n={total:e.fileSize||0,loaded:(e.fileSize||0)*r};o.push(n),c(n,t)}}),a)})));return{then:C()(n=f.then).call(n,f),abort:function(){return u=!0,i=!0,s&&s(),d(),!0},onProgress:function(e){c=e}}}(t,e);return o.onProgress(a),{request:k(o,t),abort:o.abort,senderType:h}},update:function(e){t=g()(g()({},t),e)}}};t.default=w}})})); | ||
//# sourceMappingURL=rpldy-core.umd.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206244
1730
308
4
+ Added@rpldy/simple-state@^0.3.0
+ Added@rpldy/life-events@0.3.2(transitive)
+ Added@rpldy/sender@0.3.2(transitive)
+ Added@rpldy/shared@0.3.2(transitive)
+ Added@rpldy/simple-state@0.3.2(transitive)
+ Addedis-promise@4.0.0(transitive)
- Removed@rpldy/life-events@0.2.4(transitive)
- Removed@rpldy/sender@0.2.4(transitive)
- Removed@rpldy/shared@0.2.4(transitive)
- Removedis-promise@2.2.2(transitive)
Updated@rpldy/life-events@^0.3.0
Updated@rpldy/sender@^0.3.0
Updated@rpldy/shared@^0.3.0