@rpldy/uploader
Advanced tools
Comparing version 0.3.0 to 0.3.2
{ | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"name": "@rpldy/uploader", | ||
@@ -26,9 +26,9 @@ "description": "the processing and queuing engine for react-uploady", | ||
"dependencies": { | ||
"@rpldy/life-events": "^0.3.0", | ||
"@rpldy/sender": "^0.3.0", | ||
"@rpldy/shared": "^0.3.0", | ||
"@rpldy/simple-state": "^0.3.0" | ||
"@rpldy/life-events": "^0.3.2", | ||
"@rpldy/sender": "^0.3.2", | ||
"@rpldy/shared": "^0.3.2", | ||
"@rpldy/simple-state": "^0.3.2" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.126.1" | ||
"flow-bin": "^0.129.0" | ||
}, | ||
@@ -38,3 +38,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "be3502009a685d56ab30894d113e5386c8af7da7" | ||
"gitHead": "855e4471317ca0bc82f168b217c43e3f74211364" | ||
} |
@@ -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),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}})})); | ||
!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 Q})),n.d(t,"DEFAULT_OPTIONS",(function(){return O})),n.d(t,"composeEnhancers",(function(){return Me})),n.d(t,"createUploader",(function(){return ke})),n.d(t,"send",(function(){return Ne.send})),n.d(t,"createMockSender",(function(){return Ne.createMockSender})),n.d(t,"XHR_SENDER_TYPE",(function(){return Ne.XHR_SENDER_TYPE})),n.d(t,"MOCK_SENDER_TYPE",(function(){return Ne.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){var t=e;return{state:t,update:function(e){try{z(),e(t)}finally{z()}return t},unwrap:function(e){return e||t}}},Q=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"}),K=Object(b.devFreeze)({ITEM_PROGRESS:"ITEM_PROGRESS",BATCH_PROGRESS:"BATCH_PROGRESS"}),X=n("cdeZ"),Z=n.n(X),J=n("OBge"),Y=n.n(J),W=n("04Ix"),V=n.n(W),$=n("mnMc"),ee=n.n($),te=n("kT1S"),ne=n.n(te),re=[b.BATCH_STATES.ADDED,b.BATCH_STATES.PROCESSING,b.BATCH_STATES.UPLOADING],ae=function(e,t){return e.batches[t].batch},oe=function(e,t,n){return e.getState().items[t].batchId===n},ue=function(e,t){var n=e.getState(),r=n.items[t];return n.batches[r.batchId]},ie=function(e,t){return ue(e,t).batch},ce=function(e,t){var n,r=function(e,t){return ae(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)}))}))},le=function(e,t){e.updateState((function(e){delete e.batches[t]}))},se=function(e,t){var n=ie(e,t),r=n.id;b.logger.debugLog("uploady.uploader.processor: cancelling batch: ",{batch:n}),e.updateState((function(e){ae(e,r).state=b.BATCH_STATES.CANCELLED})),ge(e,r,Q.BATCH_CANCEL),ce(e,r),le(e,r)},de=function(e,t){var n=ie(e,t);return e.getState().currentBatch!==n.id},fe=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=ie(t,n),e.next=3,t.cancellable(Q.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)}}(),pe=function(e){var t=e.getState().currentBatch;t&&function(e){var t=e.getState().itemQueue;return 0===t.length||de(e,t[0])}(e)&&(ge(e,t,Q.BATCH_FINISH),ce(e,t),le(e,t))},ge=function(e,t,n){var r,a=e.getState(),o=ae(a,t),u=a.items,i=ne()(ne()({},o),{},{items:I()(r=o.items).call(r,(function(e){var t=e.id;return u[t]}))});e.trigger(n,i)},ve=function(e,t){var n=ie(e,t);return ee()(re).call(re,n.state)},Ee=(r={},V()(r,b.FILE_STATES.ADDED,Q.ITEM_START),V()(r,b.FILE_STATES.FINISHED,Q.ITEM_FINISH),V()(r,b.FILE_STATES.ERROR,Q.ITEM_ERROR),V()(r,b.FILE_STATES.CANCELLED,Q.ITEM_CANCEL),V()(r,b.FILE_STATES.ABORTED,Q.ITEM_ABORT),V()(r,b.FILE_STATES.UPLOADING,Q.ITEM_PROGRESS),r),he=[b.FILE_STATES.FINISHED,b.FILE_STATES.ERROR,b.FILE_STATES.CANCELLED,b.FILE_STATES.ABORTED],Se=function(e){return!!~M()(he).call(he,e.state)},be=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(Ee[u.state],u),Se(u)&&e.trigger(Q.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)}))})),pe(e),n(e)},me=Object(b.getMerge)({undefinedOverwrites:!0}),Te=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,Q.REQUEST_PRE_SEND,{items:I()(n).call(n,(function(e){return e})),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","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=me({},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)}}(),Ae=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,Te(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)}}(),ye=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}))}))},_e=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),ye(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}})),be(t,l,r);case 9:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Ie=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"}}}));be(e,u,r)}return!!o.length},Re=function(e,t){return t.getState().items[e]},Oe=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,Y.a.all(I()(u).call(u,(function(e){return t.cancellable(Q.ITEM_START,e)})));case 5:if(i=e.sent,!(c=y()(a=I()(i).call(i,(function(e,n){return e?null:Re(u[n].id,t)}))).call(a,Boolean)).length){e.next=12;break}return e.next=10,Ae(t,c);case 10:(l=e.sent).cancelled?i=I()(n).call(n,(function(){return!0})):_e(t,l,r);case 12:if(Ie(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)}}(),Le=function(e,t){var n,r;return!!~M()(n=Z()(r=e.getState().activeIds).call(r)).call(n,t)},we=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&&(Le(e,o)||!ve(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=ue(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])&&oe(e,a,u)}else t=[a]}return t},De=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=we(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,!de(t,n[0])){e.next=12;break}return e.next=9,fe(t,n[0]);case 9:s=e.sent,(l=!s)&&(se(t,n[0]),De(t));case 12:l||Oe(t,n,De);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ce=De,Fe=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]()):(be(e,[{id:t,info:{status:0,state:b.FILE_STATES.ABORTED,response:"aborted"}}],n),r=!0)),r},xe=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 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(Q.ITEM_PROGRESS,s().items[e.id]))};r.on(K.ITEM_PROGRESS,g),r.on(K.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(Q.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 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),Ce(v)},abortItem:function(e){return function(e,t,n){return Fe(e,t,n)}(v,e,Ce)},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 Fe(e,t.id,n)})),e.updateState((function(e){ae(e,t).state=b.BATCH_STATES.ABORTED})),ge(e,t,Q.BATCH_ABORT))}(v,e,Ce)},abortAll:function(){var e,t,n,r;t=Ce,r=(e=v).getState().items,o()(n=j()(r)).call(n,(function(n){return Fe(e,n,t)}))}}},Ne=n("jRAa"),Pe=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(K.ITEM_PROGRESS,e,t,n)}))}(e,Math.min(n.loaded/n.total*100,100)/e.length,n.loaded/e.length,r),r(K.BATCH_PROGRESS,t)},Be=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 Pe(e,n,r,t)}),50,!0),i=Object(b.isFunction)(r.send)?r.send:Ne.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:ne()(ne()({},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()(K)),t=e.trigger;return e.target}(),o=xe(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()}}},He=h()(Q),je=0,ke=function(e){var t="uploader-".concat(je+=1),n=!1,r=[],a={};b.logger.debugLog("uploady.uploader: creating new instance (".concat(t,")"),{options:e,counter:je});var u=function(e){return ne()(ne()(ne()({},O),e),{},{destination:e&&e.destination?(t=e.destination,ne()({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(Q.BATCH_ADD,o,a);case 5:e.sent?(o.state=b.BATCH_STATES.CANCELLED,f(Q.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]}},He,{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=Be(f,u,g.id);return Object(b.devFreeze)(g)},Me=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=ke},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 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
207207
1734
Updated@rpldy/life-events@^0.3.2
Updated@rpldy/sender@^0.3.2
Updated@rpldy/shared@^0.3.2
Updated@rpldy/simple-state@^0.3.2