pos-gis/public/js/filepond.min.js
2024-10-07 13:13:42 +07:00

6 lines
203 KiB
JavaScript
Vendored

/*!
* FilePond 4.25.1
* Licensed under MIT, https://opensource.org/licenses/MIT/
* Please visit https://pqina.nl/filepond/ for details.
*/
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory((global=global||self).FilePond={})}(this,(function(exports){"use strict";var isNode=function isNode(value){return value instanceof HTMLElement},createStore=function createStore(initialState){var queries=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],actions=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],state=Object.assign({},initialState),actionQueue=[],dispatchQueue=[],getState=function getState(){return Object.assign({},state)},processActionQueue=function processActionQueue(){var queue=[].concat(actionQueue);return actionQueue.length=0,queue},processDispatchQueue=function processDispatchQueue(){var queue=[].concat(dispatchQueue);dispatchQueue.length=0,queue.forEach((function(_ref){var type=_ref.type,data=_ref.data;dispatch(type,data)}))},dispatch=function dispatch(type,data,isBlocking){!isBlocking||document.hidden?(actionHandlers[type]&&actionHandlers[type](data),actionQueue.push({type:type,data:data})):dispatchQueue.push({type:type,data:data})},query=function query(str){for(var _queryHandles,_len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return queryHandles[str]?(_queryHandles=queryHandles)[str].apply(_queryHandles,args):null},api={getState:getState,processActionQueue:processActionQueue,processDispatchQueue:processDispatchQueue,dispatch:dispatch,query:query},queryHandles={};queries.forEach((function(query){queryHandles=Object.assign({},query(state),{},queryHandles)}));var actionHandlers={};return actions.forEach((function(action){actionHandlers=Object.assign({},action(dispatch,query,state),{},actionHandlers)})),api},defineProperty=function defineProperty(obj,property,definition){"function"!=typeof definition?Object.defineProperty(obj,property,Object.assign({},definition)):obj[property]=definition},forin=function forin(obj,cb){for(var key in obj)obj.hasOwnProperty(key)&&cb(key,obj[key])},createObject=function createObject(definition){var obj={};return forin(definition,(function(property){defineProperty(obj,property,definition[property])})),obj},attr=function attr(node,name){var value=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===value)return node.getAttribute(name)||node.hasAttribute(name);node.setAttribute(name,value)},ns="http://www.w3.org/2000/svg",svgElements=["svg","path"],isSVGElement=function isSVGElement(tag){return svgElements.includes(tag)},createElement=function createElement(tag,className){var attributes=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof className&&(attributes=className,className=null);var element=isSVGElement(tag)?document.createElementNS(ns,tag):document.createElement(tag);return className&&(isSVGElement(tag)?attr(element,"class",className):element.className=className),forin(attributes,(function(name,value){attr(element,name,value)})),element},appendChild=function appendChild(parent){return function(child,index){void 0!==index&&parent.children[index]?parent.insertBefore(child,parent.children[index]):parent.appendChild(child)}},appendChildView=function appendChildView(parent,childViews){return function(view,index){return void 0!==index?childViews.splice(index,0,view):childViews.push(view),view}},removeChildView=function removeChildView(parent,childViews){return function(view){return childViews.splice(childViews.indexOf(view),1),view.element.parentNode&&parent.removeChild(view.element),view}},IS_BROWSER="undefined"!=typeof window&&void 0!==window.document,isBrowser=function isBrowser(){return IS_BROWSER},testElement,getChildCount="children"in(isBrowser()?createElement("svg"):{})?function(el){return el.children.length}:function(el){return el.childNodes.length},getViewRect=function getViewRect(elementRect,childViews,offset,scale){var left=offset[0]||elementRect.left,top=offset[1]||elementRect.top,right=left+elementRect.width,bottom=top+elementRect.height*(scale[1]||1),rect={element:Object.assign({},elementRect),inner:{left:elementRect.left,top:elementRect.top,right:elementRect.right,bottom:elementRect.bottom},outer:{left:left,top:top,right:right,bottom:bottom}};return childViews.filter((function(childView){return!childView.isRectIgnored()})).map((function(childView){return childView.rect})).forEach((function(childViewRect){expandRect(rect.inner,Object.assign({},childViewRect.inner)),expandRect(rect.outer,Object.assign({},childViewRect.outer))})),calculateRectSize(rect.inner),rect.outer.bottom+=rect.element.marginBottom,rect.outer.right+=rect.element.marginRight,calculateRectSize(rect.outer),rect},expandRect=function expandRect(parent,child){child.top+=parent.top,child.right+=parent.left,child.bottom+=parent.top,child.left+=parent.left,child.bottom>parent.bottom&&(parent.bottom=child.bottom),child.right>parent.right&&(parent.right=child.right)},calculateRectSize=function calculateRectSize(rect){rect.width=rect.right-rect.left,rect.height=rect.bottom-rect.top},isNumber=function isNumber(value){return"number"==typeof value},thereYet=function thereYet(position,destination,velocity){var errorMargin=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(position-destination)<errorMargin&&Math.abs(velocity)<errorMargin},spring,easeLinear=function easeLinear(t){return t},easeInOutQuad=function easeInOutQuad(t){return t<.5?2*t*t:(4-2*t)*t-1},tween,animator={spring:function spring(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},_ref$stiffness=_ref.stiffness,stiffness=void 0===_ref$stiffness?.5:_ref$stiffness,_ref$damping=_ref.damping,damping=void 0===_ref$damping?.75:_ref$damping,_ref$mass=_ref.mass,mass=void 0===_ref$mass?10:_ref$mass,target=null,position=null,velocity=0,resting=!1,interpolate=function interpolate(ts,skipToEndState){if(!resting){if(!isNumber(target)||!isNumber(position))return resting=!0,void(velocity=0);var f;thereYet(position+=velocity+=-(position-target)*stiffness/mass,target,velocity*=damping)||skipToEndState?(position=target,velocity=0,resting=!0,api.onupdate(position),api.oncomplete(position)):api.onupdate(position)}},setTarget=function setTarget(value){if(isNumber(value)&&!isNumber(position)&&(position=value),null===target&&(target=value,position=value),position===(target=value)||void 0===target)return resting=!0,velocity=0,api.onupdate(position),void api.oncomplete(position);resting=!1},api=createObject({interpolate:interpolate,target:{set:setTarget,get:function get(){return target}},resting:{get:function get(){return resting}},onupdate:function onupdate(value){},oncomplete:function oncomplete(value){}});return api},tween:function tween(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},_ref$duration=_ref.duration,duration=void 0===_ref$duration?500:_ref$duration,_ref$easing=_ref.easing,easing=void 0===_ref$easing?easeInOutQuad:_ref$easing,_ref$delay=_ref.delay,delay=void 0===_ref$delay?0:_ref$delay,start=null,t,p,resting=!0,reverse=!1,target=null,interpolate=function interpolate(ts,skipToEndState){resting||null===target||(null===start&&(start=ts),ts-start<delay||((t=ts-start-delay)>=duration||skipToEndState?(t=1,p=reverse?0:1,api.onupdate(p*target),api.oncomplete(p*target),resting=!0):(p=t/duration,api.onupdate((t>=0?easing(reverse?1-p:p):0)*target))))},api=createObject({interpolate:interpolate,target:{get:function get(){return reverse?0:target},set:function set(value){if(null===target)return target=value,api.onupdate(value),void api.oncomplete(value);value<target?(target=1,reverse=!0):(reverse=!1,target=value),resting=!1,start=null}},resting:{get:function get(){return resting}},onupdate:function onupdate(value){},oncomplete:function oncomplete(value){}});return api}},createAnimator=function createAnimator(definition,category,property){var def=definition[category]&&"object"==typeof definition[category][property]?definition[category][property]:definition[category]||definition,type="string"==typeof def?def:def.type,props="object"==typeof def?Object.assign({},def):{};return animator[type]?animator[type](props):null},addGetSet=function addGetSet(keys,obj,props){var overwrite=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(obj=Array.isArray(obj)?obj:[obj]).forEach((function(o){keys.forEach((function(key){var name=key,getter=function getter(){return props[key]},setter=function setter(value){return props[key]=value};"object"==typeof key&&(name=key.key,getter=key.getter||getter,setter=key.setter||setter),o[name]&&!overwrite||(o[name]={get:getter,set:setter})}))}))},animations,addEvent=function addEvent(element){return function(type,fn){element.addEventListener(type,fn)}},removeEvent=function removeEvent(element){return function(type,fn){element.removeEventListener(type,fn)}},listeners,apis,isDefined=function isDefined(value){return null!=value},defaults={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},styles=function styles(_ref){var mixinConfig=_ref.mixinConfig,viewProps=_ref.viewProps,viewInternalAPI=_ref.viewInternalAPI,viewExternalAPI=_ref.viewExternalAPI,view=_ref.view,initialProps=Object.assign({},viewProps),currentProps={};addGetSet(mixinConfig,[viewInternalAPI,viewExternalAPI],viewProps);var getOffset=function getOffset(){return[viewProps.translateX||0,viewProps.translateY||0]},getScale=function getScale(){return[viewProps.scaleX||0,viewProps.scaleY||0]},getRect=function getRect(){return view.rect?getViewRect(view.rect,view.childViews,getOffset(),getScale()):null};return viewInternalAPI.rect={get:getRect},viewExternalAPI.rect={get:getRect},mixinConfig.forEach((function(key){viewProps[key]=void 0===initialProps[key]?defaults[key]:initialProps[key]})),{write:function write(){if(propsHaveChanged(currentProps,viewProps))return applyStyles(view.element,viewProps),Object.assign(currentProps,Object.assign({},viewProps)),!0},destroy:function destroy(){}}},propsHaveChanged=function propsHaveChanged(currentProps,newProps){if(Object.keys(currentProps).length!==Object.keys(newProps).length)return!0;for(var prop in newProps)if(newProps[prop]!==currentProps[prop])return!0;return!1},applyStyles=function applyStyles(element,_ref2){var opacity=_ref2.opacity,perspective=_ref2.perspective,translateX=_ref2.translateX,translateY=_ref2.translateY,scaleX=_ref2.scaleX,scaleY=_ref2.scaleY,rotateX=_ref2.rotateX,rotateY=_ref2.rotateY,rotateZ=_ref2.rotateZ,originX=_ref2.originX,originY=_ref2.originY,width=_ref2.width,height=_ref2.height,transforms="",styles="";(isDefined(originX)||isDefined(originY))&&(styles+="transform-origin: "+(originX||0)+"px "+(originY||0)+"px;"),isDefined(perspective)&&(transforms+="perspective("+perspective+"px) "),(isDefined(translateX)||isDefined(translateY))&&(transforms+="translate3d("+(translateX||0)+"px, "+(translateY||0)+"px, 0) "),(isDefined(scaleX)||isDefined(scaleY))&&(transforms+="scale3d("+(isDefined(scaleX)?scaleX:1)+", "+(isDefined(scaleY)?scaleY:1)+", 1) "),isDefined(rotateZ)&&(transforms+="rotateZ("+rotateZ+"rad) "),isDefined(rotateX)&&(transforms+="rotateX("+rotateX+"rad) "),isDefined(rotateY)&&(transforms+="rotateY("+rotateY+"rad) "),transforms.length&&(styles+="transform:"+transforms+";"),isDefined(opacity)&&(styles+="opacity:"+opacity+";",0===opacity&&(styles+="visibility:hidden;"),opacity<1&&(styles+="pointer-events:none;")),isDefined(height)&&(styles+="height:"+height+"px;"),isDefined(width)&&(styles+="width:"+width+"px;");var elementCurrentStyle=element.elementCurrentStyle||"";styles.length===elementCurrentStyle.length&&styles===elementCurrentStyle||(element.style.cssText=styles,element.elementCurrentStyle=styles)},Mixins={styles:styles,listeners:function listeners(_ref){var mixinConfig=_ref.mixinConfig,viewProps=_ref.viewProps,viewInternalAPI=_ref.viewInternalAPI,viewExternalAPI=_ref.viewExternalAPI,viewState=_ref.viewState,view=_ref.view,events=[],add=addEvent(view.element),remove=removeEvent(view.element);return viewExternalAPI.on=function(type,fn){events.push({type:type,fn:fn}),add(type,fn)},viewExternalAPI.off=function(type,fn){events.splice(events.findIndex((function(event){return event.type===type&&event.fn===fn})),1),remove(type,fn)},{write:function write(){return!0},destroy:function destroy(){events.forEach((function(event){remove(event.type,event.fn)}))}}},animations:function animations(_ref){var mixinConfig=_ref.mixinConfig,viewProps=_ref.viewProps,viewInternalAPI=_ref.viewInternalAPI,viewExternalAPI=_ref.viewExternalAPI,initialProps=Object.assign({},viewProps),animations=[];return forin(mixinConfig,(function(property,animation){var animator=createAnimator(animation),prop;animator&&(animator.onupdate=function(value){viewProps[property]=value},animator.target=initialProps[property],addGetSet([{key:property,setter:function setter(value){animator.target!==value&&(animator.target=value)},getter:function getter(){return viewProps[property]}}],[viewInternalAPI,viewExternalAPI],viewProps,!0),animations.push(animator))})),{write:function write(ts){var skipToEndState=document.hidden,resting=!0;return animations.forEach((function(animation){animation.resting||(resting=!1),animation.interpolate(ts,skipToEndState)})),resting},destroy:function destroy(){}}},apis:function apis(_ref){var mixinConfig=_ref.mixinConfig,viewProps=_ref.viewProps,viewExternalAPI=_ref.viewExternalAPI;addGetSet(mixinConfig,viewExternalAPI,viewProps)}},updateRect=function updateRect(){var rect=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},element=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},style=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return element.layoutCalculated||(rect.paddingTop=parseInt(style.paddingTop,10)||0,rect.marginTop=parseInt(style.marginTop,10)||0,rect.marginRight=parseInt(style.marginRight,10)||0,rect.marginBottom=parseInt(style.marginBottom,10)||0,rect.marginLeft=parseInt(style.marginLeft,10)||0,element.layoutCalculated=!0),rect.left=element.offsetLeft||0,rect.top=element.offsetTop||0,rect.width=element.offsetWidth||0,rect.height=element.offsetHeight||0,rect.right=rect.left+rect.width,rect.bottom=rect.top+rect.height,rect.scrollTop=element.scrollTop,rect.hidden=null===element.offsetParent,rect},createView=function createView(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},_ref$tag=_ref.tag,tag=void 0===_ref$tag?"div":_ref$tag,_ref$name=_ref.name,name=void 0===_ref$name?null:_ref$name,_ref$attributes=_ref.attributes,attributes=void 0===_ref$attributes?{}:_ref$attributes,_ref$read=_ref.read,read=void 0===_ref$read?function(){}:_ref$read,_ref$write=_ref.write,write=void 0===_ref$write?function(){}:_ref$write,_ref$create=_ref.create,create=void 0===_ref$create?function(){}:_ref$create,_ref$destroy=_ref.destroy,destroy=void 0===_ref$destroy?function(){}:_ref$destroy,_ref$filterFrameActio=_ref.filterFrameActionsForChild,filterFrameActionsForChild=void 0===_ref$filterFrameActio?function(child,actions){return actions}:_ref$filterFrameActio,_ref$didCreateView=_ref.didCreateView,didCreateView=void 0===_ref$didCreateView?function(){}:_ref$didCreateView,_ref$didWriteView=_ref.didWriteView,didWriteView=void 0===_ref$didWriteView?function(){}:_ref$didWriteView,_ref$ignoreRect=_ref.ignoreRect,ignoreRect=void 0!==_ref$ignoreRect&&_ref$ignoreRect,_ref$ignoreRectUpdate=_ref.ignoreRectUpdate,ignoreRectUpdate=void 0!==_ref$ignoreRectUpdate&&_ref$ignoreRectUpdate,_ref$mixins=_ref.mixins,mixins=void 0===_ref$mixins?[]:_ref$mixins;return function(store){var props=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},element=createElement(tag,"filepond--"+name,attributes),style=window.getComputedStyle(element,null),rect=updateRect(),frameRect=null,isResting=!1,childViews=[],activeMixins=[],ref={},state={},writers=[write],readers=[read],destroyers=[destroy],getElement=function getElement(){return element},getChildViews=function getChildViews(){return childViews.concat()},getReference=function getReference(){return ref},createChildView=function createChildView(store){return function(view,props){return view(store,props)}},getRect=function getRect(){return frameRect||(frameRect=getViewRect(rect,childViews,[0,0],[1,1]))},getStyle=function getStyle(){return style},_read=function _read(){var shouldUpdate;frameRect=null,childViews.forEach((function(child){return child._read()})),!(ignoreRectUpdate&&rect.width&&rect.height)&&updateRect(rect,element,style);var api={root:internalAPI,props:props,rect:rect};readers.forEach((function(reader){return reader(api)}))},_write=function _write(ts,frameActions,shouldOptimize){var resting=0===frameActions.length;return writers.forEach((function(writer){var writerResting;!1===writer({props:props,root:internalAPI,actions:frameActions,timestamp:ts,shouldOptimize:shouldOptimize})&&(resting=!1)})),activeMixins.forEach((function(mixin){var mixinResting;!1===mixin.write(ts)&&(resting=!1)})),childViews.filter((function(child){return!!child.element.parentNode})).forEach((function(child){var childResting;child._write(ts,filterFrameActionsForChild(child,frameActions),shouldOptimize)||(resting=!1)})),childViews.forEach((function(child,index){child.element.parentNode||(internalAPI.appendChild(child.element,index),child._read(),child._write(ts,filterFrameActionsForChild(child,frameActions),shouldOptimize),resting=!1)})),isResting=resting,didWriteView({props:props,root:internalAPI,actions:frameActions,timestamp:ts}),resting},_destroy=function _destroy(){activeMixins.forEach((function(mixin){return mixin.destroy()})),destroyers.forEach((function(destroyer){destroyer({root:internalAPI,props:props})})),childViews.forEach((function(child){return child._destroy()}))},sharedAPIDefinition={element:{get:getElement},style:{get:getStyle},childViews:{get:getChildViews}},internalAPIDefinition=Object.assign({},sharedAPIDefinition,{rect:{get:getRect},ref:{get:getReference},is:function is(needle){return name===needle},appendChild:appendChild(element),createChildView:createChildView(store),linkView:function linkView(view){return childViews.push(view),view},unlinkView:function unlinkView(view){childViews.splice(childViews.indexOf(view),1)},appendChildView:appendChildView(element,childViews),removeChildView:removeChildView(element,childViews),registerWriter:function registerWriter(writer){return writers.push(writer)},registerReader:function registerReader(reader){return readers.push(reader)},registerDestroyer:function registerDestroyer(destroyer){return destroyers.push(destroyer)},invalidateLayout:function invalidateLayout(){return element.layoutCalculated=!1},dispatch:store.dispatch,query:store.query}),externalAPIDefinition={element:{get:getElement},childViews:{get:getChildViews},rect:{get:getRect},resting:{get:function get(){return isResting}},isRectIgnored:function isRectIgnored(){return ignoreRect},_read:_read,_write:_write,_destroy:_destroy},mixinAPIDefinition=Object.assign({},sharedAPIDefinition,{rect:{get:function get(){return rect}}});Object.keys(mixins).sort((function(a,b){return"styles"===a?1:"styles"===b?-1:0})).forEach((function(key){var mixinAPI=Mixins[key]({mixinConfig:mixins[key],viewProps:props,viewState:state,viewInternalAPI:internalAPIDefinition,viewExternalAPI:externalAPIDefinition,view:createObject(mixinAPIDefinition)});mixinAPI&&activeMixins.push(mixinAPI)}));var internalAPI=createObject(internalAPIDefinition);create({root:internalAPI,props:props});var childCount=getChildCount(element);return childViews.forEach((function(child,index){internalAPI.appendChild(child.element,childCount+index)})),didCreateView(internalAPI),createObject(externalAPIDefinition)}},createPainter=function createPainter(read,write){var fps=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,name="__framePainter";if(window[name])return window[name].readers.push(read),void window[name].writers.push(write);window[name]={readers:[read],writers:[write]};var painter=window[name],interval=1e3/fps,last=null,id=null,requestTick=null,cancelTick=null,setTimerType=function setTimerType(){document.hidden?(requestTick=function requestTick(){return window.setTimeout((function(){return tick(performance.now())}),interval)},cancelTick=function cancelTick(){return window.clearTimeout(id)}):(requestTick=function requestTick(){return window.requestAnimationFrame(tick)},cancelTick=function cancelTick(){return window.cancelAnimationFrame(id)})};document.addEventListener("visibilitychange",(function(){cancelTick&&cancelTick(),setTimerType(),tick(performance.now())}));var tick=function tick(ts){id=requestTick(tick),last||(last=ts);var delta=ts-last;delta<=interval||(last=ts-delta%interval,painter.readers.forEach((function(read){return read()})),painter.writers.forEach((function(write){return write(ts)})))};return setTimerType(),tick(performance.now()),{pause:function pause(){cancelTick(id)}}},createRoute=function createRoute(routes,fn){return function(_ref){var root=_ref.root,props=_ref.props,_ref$actions=_ref.actions,actions=void 0===_ref$actions?[]:_ref$actions,timestamp=_ref.timestamp,shouldOptimize=_ref.shouldOptimize;actions.filter((function(action){return routes[action.type]})).forEach((function(action){return routes[action.type]({root:root,props:props,action:action.data,timestamp:timestamp,shouldOptimize:shouldOptimize})})),fn&&fn({root:root,props:props,actions:actions,timestamp:timestamp,shouldOptimize:shouldOptimize})}},insertBefore=function insertBefore(newNode,referenceNode){return referenceNode.parentNode.insertBefore(newNode,referenceNode)},insertAfter=function insertAfter(newNode,referenceNode){return referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling)},isArray=function isArray(value){return Array.isArray(value)},isEmpty=function isEmpty(value){return null==value},trim=function trim(str){return str.trim()},toString=function toString(value){return""+value},toArray,isBoolean=function isBoolean(value){return"boolean"==typeof value},toBoolean=function toBoolean(value){return isBoolean(value)?value:"true"===value},isString=function isString(value){return"string"==typeof value},toNumber=function toNumber(value){return isNumber(value)?value:isString(value)?toString(value).replace(/[a-z]+/gi,""):0},toInt=function toInt(value){return parseInt(toNumber(value),10)},toFloat=function toFloat(value){return parseFloat(toNumber(value))},isInt=function isInt(value){return isNumber(value)&&isFinite(value)&&Math.floor(value)===value},toBytes=function toBytes(value){var base=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(isInt(value))return value;var naturalFileSize=toString(value).trim();return/MB$/i.test(naturalFileSize)?(naturalFileSize=naturalFileSize.replace(/MB$i/,"").trim(),toInt(naturalFileSize)*base*base):/KB/i.test(naturalFileSize)?(naturalFileSize=naturalFileSize.replace(/KB$i/,"").trim(),toInt(naturalFileSize)*base):toInt(naturalFileSize)},isFunction=function isFunction(value){return"function"==typeof value},toFunctionReference=function toFunctionReference(string){for(var ref=self,levels=string.split("."),level=null;level=levels.shift();)if(!(ref=ref[level]))return null;return ref},methods={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},createServerAPI=function createServerAPI(outline){var api={};return api.url=isString(outline)?outline:outline.url||"",api.timeout=outline.timeout?parseInt(outline.timeout,10):0,api.headers=outline.headers?outline.headers:{},forin(methods,(function(key){api[key]=createAction(key,outline[key],methods[key],api.timeout,api.headers)})),api.remove=outline.remove||null,delete api.headers,api},createAction=function createAction(name,outline,method,timeout,headers){if(null===outline)return null;if("function"==typeof outline)return outline;var action={url:"GET"===method||"PATCH"===method?"?"+name+"=":"",method:method,headers:headers,withCredentials:!1,timeout:timeout,onload:null,ondata:null,onerror:null};if(isString(outline))return action.url=outline,action;if(Object.assign(action,outline),isString(action.headers)){var parts=action.headers.split(/:(.+)/);action.headers={header:parts[0],value:parts[1]}}return action.withCredentials=toBoolean(action.withCredentials),action},toServerAPI,isNull=function isNull(value){return null===value},isObject=function isObject(value){return"object"==typeof value&&null!==value},isAPI=function isAPI(value){return isObject(value)&&isString(value.url)&&isObject(value.process)&&isObject(value.revert)&&isObject(value.restore)&&isObject(value.fetch)},getType=function getType(value){return isArray(value)?"array":isNull(value)?"null":isInt(value)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(value)?"bytes":isAPI(value)?"api":typeof value},replaceSingleQuotes=function replaceSingleQuotes(str){return str.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",')},conversionTable={array:function toArray(value){var splitter=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return isEmpty(value)?[]:isArray(value)?value:toString(value).split(splitter).map(trim).filter((function(str){return str.length}))},boolean:toBoolean,int:function int(value){return"bytes"===getType(value)?toBytes(value):toInt(value)},number:toFloat,float:toFloat,bytes:toBytes,string:function string(value){return isFunction(value)?value:toString(value)},function:function _function(value){return toFunctionReference(value)},serverapi:function toServerAPI(value){return createServerAPI(value)},object:function object(value){try{return JSON.parse(replaceSingleQuotes(value))}catch(e){return null}}},convertTo=function convertTo(value,type){return conversionTable[type](value)},getValueByType=function getValueByType(newValue,defaultValue,valueType){if(newValue===defaultValue)return newValue;var newValueType=getType(newValue);if(newValueType!==valueType){var convertedValue=convertTo(newValue,valueType);if(newValueType=getType(convertedValue),null===convertedValue)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+valueType+'"';newValue=convertedValue}return newValue},createOption=function createOption(defaultValue,valueType){var currentValue=defaultValue;return{enumerable:!0,get:function get(){return currentValue},set:function set(newValue){currentValue=getValueByType(newValue,defaultValue,valueType)}}},createOptions=function createOptions(options){var obj={};return forin(options,(function(prop){var optionDefinition=options[prop];obj[prop]=createOption(optionDefinition[0],optionDefinition[1])})),createObject(obj)},createInitialState=function createInitialState(options){return{items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:createOptions(options)}},fromCamels=function fromCamels(string){var separator=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return string.split(/(?=[A-Z])/).map((function(part){return part.toLowerCase()})).join(separator)},createOptionAPI=function createOptionAPI(store,options){var obj={};return forin(options,(function(key){obj[key]={get:function get(){return store.getState().options[key]},set:function set(value){store.dispatch("SET_"+fromCamels(key,"_").toUpperCase(),{value:value})}}})),obj},createOptionActions=function createOptionActions(options){return function(dispatch,query,state){var obj={};return forin(options,(function(key){var name=fromCamels(key,"_").toUpperCase();obj["SET_"+name]=function(action){try{state.options[key]=action.value}catch(e){}dispatch("DID_SET_"+name,{value:state.options[key]})}})),obj}},createOptionQueries=function createOptionQueries(options){return function(state){var obj={};return forin(options,(function(key){obj["GET_"+fromCamels(key,"_").toUpperCase()]=function(action){return state.options[key]}})),obj}},InteractionMethod_API=1,InteractionMethod_DROP=2,InteractionMethod_BROWSE=3,InteractionMethod_PASTE=4,InteractionMethod_NONE=5,getUniqueId=function getUniqueId(){return Math.random().toString(36).substr(2,9)},REACT_ELEMENT_TYPE;function _typeof(obj){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _jsx(type,props,key,children){REACT_ELEMENT_TYPE||(REACT_ELEMENT_TYPE="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103);var defaultProps=type&&type.defaultProps,childrenLength=arguments.length-3;if(props||0===childrenLength||(props={children:void 0}),props&&defaultProps)for(var propName in defaultProps)void 0===props[propName]&&(props[propName]=defaultProps[propName]);else props||(props=defaultProps||{});if(1===childrenLength)props.children=children;else if(childrenLength>1){for(var childArray=new Array(childrenLength),i=0;i<childrenLength;i++)childArray[i]=arguments[i+3];props.children=childArray}return{$$typeof:REACT_ELEMENT_TYPE,type:type,key:void 0===key?null:""+key,ref:null,props:props,_owner:null}}function _asyncIterator(iterable){var method;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(method=iterable[Symbol.asyncIterator]))return method.call(iterable);if(Symbol.iterator&&null!=(method=iterable[Symbol.iterator]))return method.call(iterable)}throw new TypeError("Object is not async iterable")}function _AwaitValue(value){this.wrapped=value}function _AsyncGenerator(gen){var front,back;function send(key,arg){return new Promise((function(resolve,reject){var request={key:key,arg:arg,resolve:resolve,reject:reject,next:null};back?back=back.next=request:(front=back=request,resume(key,arg))}))}function resume(key,arg){try{var result=gen[key](arg),value=result.value,wrappedAwait=value instanceof _AwaitValue;Promise.resolve(wrappedAwait?value.wrapped:value).then((function(arg){wrappedAwait?resume("next",arg):settle(result.done?"return":"normal",arg)}),(function(err){resume("throw",err)}))}catch(err){settle("throw",err)}}function settle(type,value){switch(type){case"return":front.resolve({value:value,done:!0});break;case"throw":front.reject(value);break;default:front.resolve({value:value,done:!1})}(front=front.next)?resume(front.key,front.arg):back=null}this._invoke=send,"function"!=typeof gen.return&&(this.return=void 0)}function _wrapAsyncGenerator(fn){return function(){return new _AsyncGenerator(fn.apply(this,arguments))}}function _awaitAsyncGenerator(value){return new _AwaitValue(value)}function _asyncGeneratorDelegate(inner,awaitWrap){var iter={},waiting=!1;function pump(key,value){return waiting=!0,value=new Promise((function(resolve){resolve(inner[key](value))})),{done:!1,value:awaitWrap(value)}}return"function"==typeof Symbol&&Symbol.iterator&&(iter[Symbol.iterator]=function(){return this}),iter.next=function(value){return waiting?(waiting=!1,value):pump("next",value)},"function"==typeof inner.throw&&(iter.throw=function(value){if(waiting)throw waiting=!1,value;return pump("throw",value)}),"function"==typeof inner.return&&(iter.return=function(value){return pump("return",value)}),iter}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}function _defineEnumerableProperties(obj,descs){for(var key in descs){var desc;(desc=descs[key]).configurable=desc.enumerable=!0,"value"in desc&&(desc.writable=!0),Object.defineProperty(obj,key,desc)}if(Object.getOwnPropertySymbols)for(var objectSymbols=Object.getOwnPropertySymbols(descs),i=0;i<objectSymbols.length;i++){var sym=objectSymbols[i],desc;(desc=descs[sym]).configurable=desc.enumerable=!0,"value"in desc&&(desc.writable=!0),Object.defineProperty(obj,sym,desc)}return obj}function _defaults(obj,defaults){for(var keys=Object.getOwnPropertyNames(defaults),i=0;i<keys.length;i++){var key=keys[i],value=Object.getOwnPropertyDescriptor(defaults,key);value&&value.configurable&&void 0===obj[key]&&Object.defineProperty(obj,key,value)}return obj}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _extends(){return(_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target}).apply(this,arguments)}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter((function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable})))),ownKeys.forEach((function(key){_defineProperty(target,key,source[key])}))}return target}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter((function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable}))),keys.push.apply(keys,symbols)}return keys}function _objectSpread2(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(source,!0).forEach((function(key){_defineProperty(target,key,source[key])})):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(source).forEach((function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}))}return target}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(subClass,superClass)}function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype),subClass.prototype.constructor=subClass,subClass.__proto__=superClass}function _getPrototypeOf(o){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)})(o)}function _setPrototypeOf(o,p){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){return o.__proto__=p,o})(o,p)}function isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _construct(Parent,args,Class){return(_construct=isNativeReflectConstruct()?Reflect.construct:function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor,instance=new(Function.bind.apply(Parent,a));return Class&&_setPrototypeOf(instance,Class.prototype),instance}).apply(null,arguments)}function _isNativeFunction(fn){return-1!==Function.toString.call(fn).indexOf("[native code]")}function _wrapNativeSuper(Class){var _cache="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function _wrapNativeSuper(Class){if(null===Class||!_isNativeFunction(Class))return Class;if("function"!=typeof Class)throw new TypeError("Super expression must either be null or a function");if(void 0!==_cache){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper)}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,Class)})(Class)}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)if(Object.prototype.hasOwnProperty.call(obj,key)){var desc=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):{};desc.get||desc.set?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,newObj}function _newArrowCheck(innerThis,boundThis){if(innerThis!==boundThis)throw new TypeError("Cannot instantiate an arrow function")}function _objectDestructuringEmpty(obj){if(null==obj)throw new TypeError("Cannot destructure undefined")}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var target={},sourceKeys=Object.keys(source),key,i;for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],excluded.indexOf(key)>=0||(target[key]=source[key]);return target}function _objectWithoutProperties(source,excluded){if(null==source)return{};var target=_objectWithoutPropertiesLoose(source,excluded),key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],excluded.indexOf(key)>=0||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _possibleConstructorReturn(self,call){return!call||"object"!=typeof call&&"function"!=typeof call?_assertThisInitialized(self):call}function _superPropBase(object,property){for(;!Object.prototype.hasOwnProperty.call(object,property)&&null!==(object=_getPrototypeOf(object)););return object}function _get(target,property,receiver){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(target,property,receiver){var base=_superPropBase(target,property);if(base){var desc=Object.getOwnPropertyDescriptor(base,property);return desc.get?desc.get.call(receiver):desc.value}})(target,property,receiver||target)}function set(target,property,value,receiver){return(set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function set(target,property,value,receiver){var base=_superPropBase(target,property),desc;if(base){if((desc=Object.getOwnPropertyDescriptor(base,property)).set)return desc.set.call(receiver,value),!0;if(!desc.writable)return!1}if(desc=Object.getOwnPropertyDescriptor(receiver,property)){if(!desc.writable)return!1;desc.value=value,Object.defineProperty(receiver,property,desc)}else _defineProperty(receiver,property,value);return!0})(target,property,value,receiver)}function _set(target,property,value,receiver,isStrict){var s;if(!set(target,property,value,receiver||target)&&isStrict)throw new Error("failed to set property");return value}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}function _taggedTemplateLiteralLoose(strings,raw){return raw||(raw=strings.slice(0)),strings.raw=raw,strings}function _temporalRef(val,name){if(val===_temporalUndefined)throw new ReferenceError(name+" is not defined - temporal dead zone");return val}function _readOnlyError(name){throw new Error('"'+name+'" is read-only')}function _classNameTDZError(name){throw new Error('Class "'+name+'" cannot be referenced in computed property keys.')}"function"==typeof Symbol&&Symbol.asyncIterator&&(_AsyncGenerator.prototype[Symbol.asyncIterator]=function(){return this}),_AsyncGenerator.prototype.next=function(arg){return this._invoke("next",arg)},_AsyncGenerator.prototype.throw=function(arg){return this._invoke("throw",arg)},_AsyncGenerator.prototype.return=function(arg){return this._invoke("return",arg)};var _temporalUndefined={};function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _slicedToArrayLoose(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimitLoose(arr,i)||_nonIterableRest()}function _toArray(arr){return _arrayWithHoles(arr)||_iterableToArray(arr)||_nonIterableRest()}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}function _iterableToArrayLimit(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}function _iterableToArrayLimitLoose(arr,i){for(var _arr=[],_iterator=arr[Symbol.iterator](),_step;!(_step=_iterator.next()).done&&(_arr.push(_step.value),!i||_arr.length!==i););return _arr}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _skipFirstGeneratorNext(fn){return function(){var it=fn.apply(this,arguments);return it.next(),it}}function _toPrimitive(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"==typeof key?key:String(key)}function _initializerWarningHelper(descriptor,context){throw new Error("Decorating class property failed. Please ensure that proposal-class-properties is enabled and set to use loose mode. To use proposal-class-properties in spec mode with decorators, wait for the next major version of decorators in stage 2.")}function _initializerDefineProperty(target,property,descriptor,context){descriptor&&Object.defineProperty(target,property,{enumerable:descriptor.enumerable,configurable:descriptor.configurable,writable:descriptor.writable,value:descriptor.initializer?descriptor.initializer.call(context):void 0})}function _applyDecoratedDescriptor(target,property,decorators,descriptor,context){var desc={};return Object.keys(descriptor).forEach((function(key){desc[key]=descriptor[key]})),desc.enumerable=!!desc.enumerable,desc.configurable=!!desc.configurable,("value"in desc||desc.initializer)&&(desc.writable=!0),desc=decorators.slice().reverse().reduce((function(desc,decorator){return decorator(target,property,desc)||desc}),desc),context&&void 0!==desc.initializer&&(desc.value=desc.initializer?desc.initializer.call(context):void 0,desc.initializer=void 0),void 0===desc.initializer&&(Object.defineProperty(target,property,desc),desc=null),desc}var id=0;function _classPrivateFieldLooseKey(name){return"__private_"+id+++"_"+name}function _classPrivateFieldLooseBase(receiver,privateKey){if(!Object.prototype.hasOwnProperty.call(receiver,privateKey))throw new TypeError("attempted to use private field on non-instance");return receiver}function _classPrivateFieldGet(receiver,privateMap){var descriptor=privateMap.get(receiver);if(!descriptor)throw new TypeError("attempted to get private field on non-instance");return descriptor.get?descriptor.get.call(receiver):descriptor.value}function _classPrivateFieldSet(receiver,privateMap,value){var descriptor=privateMap.get(receiver);if(!descriptor)throw new TypeError("attempted to set private field on non-instance");if(descriptor.set)descriptor.set.call(receiver,value);else{if(!descriptor.writable)throw new TypeError("attempted to set read only private field");descriptor.value=value}return value}function _classPrivateFieldDestructureSet(receiver,privateMap){if(!privateMap.has(receiver))throw new TypeError("attempted to set private field on non-instance");var descriptor=privateMap.get(receiver);if(descriptor.set)return"__destrObj"in descriptor||(descriptor.__destrObj={set value(v){descriptor.set.call(receiver,v)}}),descriptor.__destrObj;if(!descriptor.writable)throw new TypeError("attempted to set read only private field");return descriptor}function _classStaticPrivateFieldSpecGet(receiver,classConstructor,descriptor){if(receiver!==classConstructor)throw new TypeError("Private static access of wrong provenance");return descriptor.value}function _classStaticPrivateFieldSpecSet(receiver,classConstructor,descriptor,value){if(receiver!==classConstructor)throw new TypeError("Private static access of wrong provenance");if(!descriptor.writable)throw new TypeError("attempted to set read only private field");return descriptor.value=value,value}function _classStaticPrivateMethodGet(receiver,classConstructor,method){if(receiver!==classConstructor)throw new TypeError("Private static access of wrong provenance");return method}function _classStaticPrivateMethodSet(){throw new TypeError("attempted to set read only static private field")}function _decorate(decorators,factory,superClass,mixins){var api=_getDecoratorsApi();if(mixins)for(var i=0;i<mixins.length;i++)api=mixins[i](api);var r=factory((function initialize(O){api.initializeInstanceElements(O,decorated.elements)}),superClass),decorated=api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)),decorators);return api.initializeClassElements(r.F,decorated.elements),api.runClassFinishers(r.F,decorated.finishers)}function _getDecoratorsApi(){_getDecoratorsApi=function(){return api};var api={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(O,elements){["method","field"].forEach((function(kind){elements.forEach((function(element){element.kind===kind&&"own"===element.placement&&this.defineClassElement(O,element)}),this)}),this)},initializeClassElements:function(F,elements){var proto=F.prototype;["method","field"].forEach((function(kind){elements.forEach((function(element){var placement=element.placement;if(element.kind===kind&&("static"===placement||"prototype"===placement)){var receiver="static"===placement?F:proto;this.defineClassElement(receiver,element)}}),this)}),this)},defineClassElement:function(receiver,element){var descriptor=element.descriptor;if("field"===element.kind){var initializer=element.initializer;descriptor={enumerable:descriptor.enumerable,writable:descriptor.writable,configurable:descriptor.configurable,value:void 0===initializer?void 0:initializer.call(receiver)}}Object.defineProperty(receiver,element.key,descriptor)},decorateClass:function(elements,decorators){var newElements=[],finishers=[],placements={static:[],prototype:[],own:[]};if(elements.forEach((function(element){this.addElementPlacement(element,placements)}),this),elements.forEach((function(element){if(!_hasDecorators(element))return newElements.push(element);var elementFinishersExtras=this.decorateElement(element,placements);newElements.push(elementFinishersExtras.element),newElements.push.apply(newElements,elementFinishersExtras.extras),finishers.push.apply(finishers,elementFinishersExtras.finishers)}),this),!decorators)return{elements:newElements,finishers:finishers};var result=this.decorateConstructor(newElements,decorators);return finishers.push.apply(finishers,result.finishers),result.finishers=finishers,result},addElementPlacement:function(element,placements,silent){var keys=placements[element.placement];if(!silent&&-1!==keys.indexOf(element.key))throw new TypeError("Duplicated element ("+element.key+")");keys.push(element.key)},decorateElement:function(element,placements){for(var extras=[],finishers=[],decorators=element.decorators,i=decorators.length-1;i>=0;i--){var keys=placements[element.placement];keys.splice(keys.indexOf(element.key),1);var elementObject=this.fromElementDescriptor(element),elementFinisherExtras=this.toElementFinisherExtras((0,decorators[i])(elementObject)||elementObject);element=elementFinisherExtras.element,this.addElementPlacement(element,placements),elementFinisherExtras.finisher&&finishers.push(elementFinisherExtras.finisher);var newExtras=elementFinisherExtras.extras;if(newExtras){for(var j=0;j<newExtras.length;j++)this.addElementPlacement(newExtras[j],placements);extras.push.apply(extras,newExtras)}}return{element:element,finishers:finishers,extras:extras}},decorateConstructor:function(elements,decorators){for(var finishers=[],i=decorators.length-1;i>=0;i--){var obj=this.fromClassDescriptor(elements),elementsAndFinisher=this.toClassDescriptor((0,decorators[i])(obj)||obj);if(void 0!==elementsAndFinisher.finisher&&finishers.push(elementsAndFinisher.finisher),void 0!==elementsAndFinisher.elements){elements=elementsAndFinisher.elements;for(var j=0;j<elements.length-1;j++)for(var k=j+1;k<elements.length;k++)if(elements[j].key===elements[k].key&&elements[j].placement===elements[k].placement)throw new TypeError("Duplicated element ("+elements[j].key+")")}}return{elements:elements,finishers:finishers}},fromElementDescriptor:function(element){var obj={kind:element.kind,key:element.key,placement:element.placement,descriptor:element.descriptor},desc={value:"Descriptor",configurable:!0};return Object.defineProperty(obj,Symbol.toStringTag,desc),"field"===element.kind&&(obj.initializer=element.initializer),obj},toElementDescriptors:function(elementObjects){if(void 0!==elementObjects)return _toArray(elementObjects).map((function(elementObject){var element=this.toElementDescriptor(elementObject);return this.disallowProperty(elementObject,"finisher","An element descriptor"),this.disallowProperty(elementObject,"extras","An element descriptor"),element}),this)},toElementDescriptor:function(elementObject){var kind=String(elementObject.kind);if("method"!==kind&&"field"!==kind)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+kind+'"');var key=_toPropertyKey(elementObject.key),placement=String(elementObject.placement);if("static"!==placement&&"prototype"!==placement&&"own"!==placement)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+placement+'"');var descriptor=elementObject.descriptor;this.disallowProperty(elementObject,"elements","An element descriptor");var element={kind:kind,key:key,placement:placement,descriptor:Object.assign({},descriptor)};return"field"!==kind?this.disallowProperty(elementObject,"initializer","A method descriptor"):(this.disallowProperty(descriptor,"get","The property descriptor of a field descriptor"),this.disallowProperty(descriptor,"set","The property descriptor of a field descriptor"),this.disallowProperty(descriptor,"value","The property descriptor of a field descriptor"),element.initializer=elementObject.initializer),element},toElementFinisherExtras:function(elementObject){var element,finisher,extras;return{element:this.toElementDescriptor(elementObject),finisher:_optionalCallableProperty(elementObject,"finisher"),extras:this.toElementDescriptors(elementObject.extras)}},fromClassDescriptor:function(elements){var obj={kind:"class",elements:elements.map(this.fromElementDescriptor,this)},desc={value:"Descriptor",configurable:!0};return Object.defineProperty(obj,Symbol.toStringTag,desc),obj},toClassDescriptor:function(obj){var kind=String(obj.kind);if("class"!==kind)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+kind+'"');this.disallowProperty(obj,"key","A class descriptor"),this.disallowProperty(obj,"placement","A class descriptor"),this.disallowProperty(obj,"descriptor","A class descriptor"),this.disallowProperty(obj,"initializer","A class descriptor"),this.disallowProperty(obj,"extras","A class descriptor");var finisher=_optionalCallableProperty(obj,"finisher"),elements;return{elements:this.toElementDescriptors(obj.elements),finisher:finisher}},runClassFinishers:function(constructor,finishers){for(var i=0;i<finishers.length;i++){var newConstructor=(0,finishers[i])(constructor);if(void 0!==newConstructor){if("function"!=typeof newConstructor)throw new TypeError("Finishers must return a constructor.");constructor=newConstructor}}return constructor},disallowProperty:function(obj,name,objectType){if(void 0!==obj[name])throw new TypeError(objectType+" can't have a ."+name+" property.")}};return api}function _createElementDescriptor(def){var key=_toPropertyKey(def.key),descriptor;"method"===def.kind?descriptor={value:def.value,writable:!0,configurable:!0,enumerable:!1}:"get"===def.kind?descriptor={get:def.value,configurable:!0,enumerable:!1}:"set"===def.kind?descriptor={set:def.value,configurable:!0,enumerable:!1}:"field"===def.kind&&(descriptor={configurable:!0,writable:!0,enumerable:!0});var element={kind:"field"===def.kind?"field":"method",key:key,placement:def.static?"static":"field"===def.kind?"own":"prototype",descriptor:descriptor};return def.decorators&&(element.decorators=def.decorators),"field"===def.kind&&(element.initializer=def.value),element}function _coalesceGetterSetter(element,other){void 0!==element.descriptor.get?other.descriptor.get=element.descriptor.get:other.descriptor.set=element.descriptor.set}function _coalesceClassElements(elements){for(var newElements=[],isSameElement=function(other){return"method"===other.kind&&other.key===element.key&&other.placement===element.placement},i=0;i<elements.length;i++){var element=elements[i],other;if("method"===element.kind&&(other=newElements.find(isSameElement)))if(_isDataDescriptor(element.descriptor)||_isDataDescriptor(other.descriptor)){if(_hasDecorators(element)||_hasDecorators(other))throw new ReferenceError("Duplicated methods ("+element.key+") can't be decorated.");other.descriptor=element.descriptor}else{if(_hasDecorators(element)){if(_hasDecorators(other))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+element.key+").");other.decorators=element.decorators}_coalesceGetterSetter(element,other)}else newElements.push(element)}return newElements}function _hasDecorators(element){return element.decorators&&element.decorators.length}function _isDataDescriptor(desc){return void 0!==desc&&!(void 0===desc.value&&void 0===desc.writable)}function _optionalCallableProperty(obj,name){var value=obj[name];if(void 0!==value&&"function"!=typeof value)throw new TypeError("Expected '"+name+"' to be a function");return value}function _classPrivateMethodGet(receiver,privateSet,fn){if(!privateSet.has(receiver))throw new TypeError("attempted to get private field on non-instance");return fn}function _classPrivateMethodSet(){throw new TypeError("attempted to reassign private method")}function _wrapRegExp(re,groups){_wrapRegExp=function(re,groups){return new BabelRegExp(re,groups)};var _RegExp=_wrapNativeSuper(RegExp),_super=RegExp.prototype,_groups=new WeakMap;function BabelRegExp(re,groups){var _this=_RegExp.call(this,re);return _groups.set(_this,groups),_this}function buildGroups(result,re){var g=_groups.get(re);return Object.keys(g).reduce((function(groups,name){return groups[name]=result[g[name]],groups}),Object.create(null))}return _inherits(BabelRegExp,_RegExp),BabelRegExp.prototype.exec=function(str){var result=_super.exec.call(this,str);return result&&(result.groups=buildGroups(result,this)),result},BabelRegExp.prototype[Symbol.replace]=function(str,substitution){if("string"==typeof substitution){var groups=_groups.get(this);return _super[Symbol.replace].call(this,str,substitution.replace(/\$<([^>]+)>/g,(function(_,name){return"$"+groups[name]})))}if("function"==typeof substitution){var _this=this;return _super[Symbol.replace].call(this,str,(function(){var args=[];return args.push.apply(args,arguments),"object"!=typeof args[args.length-1]&&args.push(buildGroups(args,_this)),substitution.apply(this,args)}))}return _super[Symbol.replace].call(this,str,substitution)},_wrapRegExp.apply(this,arguments)}var arrayRemove=function arrayRemove(arr,index){return arr.splice(index,1)},run=function run(cb,sync){sync?cb():document.hidden?Promise.resolve(1).then(cb):setTimeout(cb,0)},on=function on(){var listeners=[],off=function off(event,cb){arrayRemove(listeners,listeners.findIndex((function(listener){return listener.event===event&&(listener.cb===cb||!cb)})))},_fire=function fire(event,args,sync){listeners.filter((function(listener){return listener.event===event})).map((function(listener){return listener.cb})).forEach((function(cb){return run((function(){return cb.apply(void 0,_toConsumableArray(args))}),sync)}))};return{fireSync:function fireSync(event){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];_fire(event,args,!0)},fire:function fire(event){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];_fire(event,args,!1)},on:function on(event,cb){listeners.push({event:event,cb:cb})},onOnce:function onOnce(event,_cb){listeners.push({event:event,cb:function cb(){off(event,_cb),_cb.apply(void 0,arguments)}})},off:off}},copyObjectPropertiesToObject=function copyObjectPropertiesToObject(src,target,excluded){Object.getOwnPropertyNames(src).filter((function(property){return!excluded.includes(property)})).forEach((function(key){return Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(src,key))}))},PRIVATE=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],createItemAPI=function createItemAPI(item){var api={};return copyObjectPropertiesToObject(item,api,PRIVATE),api},removeReleasedItems=function removeReleasedItems(items){items.forEach((function(item,index){item.released&&arrayRemove(items,index)}))},ItemStatus={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},FileOrigin={INPUT:1,LIMBO:2,LOCAL:3},getNonNumeric=function getNonNumeric(str){return/[^0-9]+/.exec(str)},getDecimalSeparator=function getDecimalSeparator(){return getNonNumeric(1.1.toLocaleString())[0]},getThousandsSeparator=function getThousandsSeparator(){var decimalSeparator=getDecimalSeparator(),thousandsStringWithSeparator=1e3.toLocaleString(),thousandsStringWithoutSeparator;return thousandsStringWithSeparator!==1e3.toString()?getNonNumeric(thousandsStringWithSeparator)[0]:"."===decimalSeparator?",":"."},Type={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},filters=[],applyFilterChain=function applyFilterChain(key,value,utils){return new Promise((function(resolve,reject){var matchingFilters=filters.filter((function(f){return f.key===key})).map((function(f){return f.cb}));if(0!==matchingFilters.length){var initialFilter=matchingFilters.shift();matchingFilters.reduce((function(current,next){return current.then((function(value){return next(value,utils)}))}),initialFilter(value,utils)).then((function(value){return resolve(value)})).catch((function(error){return reject(error)}))}else resolve(value)}))},applyFilters=function applyFilters(key,value,utils){return filters.filter((function(f){return f.key===key})).map((function(f){return f.cb(value,utils)}))},addFilter=function addFilter(key,cb){return filters.push({key:key,cb:cb})},extendDefaultOptions=function extendDefaultOptions(additionalOptions){return Object.assign(defaultOptions,additionalOptions)},getOptions=function getOptions(){return Object.assign({},defaultOptions)},setOptions=function setOptions(opts){forin(opts,(function(key,value){defaultOptions[key]&&(defaultOptions[key][0]=getValueByType(value,defaultOptions[key][0],defaultOptions[key][1]))}))},defaultOptions={id:[null,Type.STRING],name:["filepond",Type.STRING],disabled:[!1,Type.BOOLEAN],className:[null,Type.STRING],required:[!1,Type.BOOLEAN],captureMethod:[null,Type.STRING],allowSyncAcceptAttribute:[!0,Type.BOOLEAN],allowDrop:[!0,Type.BOOLEAN],allowBrowse:[!0,Type.BOOLEAN],allowPaste:[!0,Type.BOOLEAN],allowMultiple:[!1,Type.BOOLEAN],allowReplace:[!0,Type.BOOLEAN],allowRevert:[!0,Type.BOOLEAN],allowRemove:[!0,Type.BOOLEAN],allowProcess:[!0,Type.BOOLEAN],allowReorder:[!1,Type.BOOLEAN],allowDirectoriesOnly:[!1,Type.BOOLEAN],forceRevert:[!1,Type.BOOLEAN],maxFiles:[null,Type.INT],checkValidity:[!1,Type.BOOLEAN],itemInsertLocationFreedom:[!0,Type.BOOLEAN],itemInsertLocation:["before",Type.STRING],itemInsertInterval:[75,Type.INT],dropOnPage:[!1,Type.BOOLEAN],dropOnElement:[!0,Type.BOOLEAN],dropValidation:[!1,Type.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Type.ARRAY],instantUpload:[!0,Type.BOOLEAN],maxParallelUploads:[2,Type.INT],chunkUploads:[!1,Type.BOOLEAN],chunkForce:[!1,Type.BOOLEAN],chunkSize:[5e6,Type.INT],chunkRetryDelays:[[500,1e3,3e3],Type.Array],server:[null,Type.SERVER_API],fileSizeBase:[1e3,Type.INT],labelDecimalSeparator:[getDecimalSeparator(),Type.STRING],labelThousandsSeparator:[getThousandsSeparator(),Type.STRING],labelIdle:['Drag & Drop your files or <span class="filepond--label-action">Browse</span>',Type.STRING],labelInvalidField:["Field contains invalid files",Type.STRING],labelFileWaitingForSize:["Waiting for size",Type.STRING],labelFileSizeNotAvailable:["Size not available",Type.STRING],labelFileCountSingular:["file in list",Type.STRING],labelFileCountPlural:["files in list",Type.STRING],labelFileLoading:["Loading",Type.STRING],labelFileAdded:["Added",Type.STRING],labelFileLoadError:["Error during load",Type.STRING],labelFileRemoved:["Removed",Type.STRING],labelFileRemoveError:["Error during remove",Type.STRING],labelFileProcessing:["Uploading",Type.STRING],labelFileProcessingComplete:["Upload complete",Type.STRING],labelFileProcessingAborted:["Upload cancelled",Type.STRING],labelFileProcessingError:["Error during upload",Type.STRING],labelFileProcessingRevertError:["Error during revert",Type.STRING],labelTapToCancel:["tap to cancel",Type.STRING],labelTapToRetry:["tap to retry",Type.STRING],labelTapToUndo:["tap to undo",Type.STRING],labelButtonRemoveItem:["Remove",Type.STRING],labelButtonAbortItemLoad:["Abort",Type.STRING],labelButtonRetryItemLoad:["Retry",Type.STRING],labelButtonAbortItemProcessing:["Cancel",Type.STRING],labelButtonUndoItemProcessing:["Undo",Type.STRING],labelButtonRetryItemProcessing:["Retry",Type.STRING],labelButtonProcessItem:["Upload",Type.STRING],iconRemove:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg>',Type.STRING],iconProcess:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M14 10.414v3.585a1 1 0 0 1-2 0v-3.585l-1.293 1.293a1 1 0 0 1-1.414-1.415l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1-1.414 1.415L14 10.414zM9 18a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2H9z" fill="currentColor" fill-rule="evenodd"/></svg>',Type.STRING],iconRetry:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"/></svg>',Type.STRING],iconUndo:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M9.185 10.81l.02-.038A4.997 4.997 0 0 1 13.683 8a5 5 0 0 1 5 5 5 5 0 0 1-5 5 1 1 0 0 0 0 2A7 7 0 1 0 7.496 9.722l-.21-.842a.999.999 0 1 0-1.94.484l.806 3.23c.133.535.675.86 1.21.73l3.233-.803a.997.997 0 0 0 .73-1.21.997.997 0 0 0-1.21-.73l-.928.23-.002-.001z" fill="currentColor" fill-rule="nonzero"/></svg>',Type.STRING],iconDone:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"/></svg>',Type.STRING],oninit:[null,Type.FUNCTION],onwarning:[null,Type.FUNCTION],onerror:[null,Type.FUNCTION],onactivatefile:[null,Type.FUNCTION],oninitfile:[null,Type.FUNCTION],onaddfilestart:[null,Type.FUNCTION],onaddfileprogress:[null,Type.FUNCTION],onaddfile:[null,Type.FUNCTION],onprocessfilestart:[null,Type.FUNCTION],onprocessfileprogress:[null,Type.FUNCTION],onprocessfileabort:[null,Type.FUNCTION],onprocessfilerevert:[null,Type.FUNCTION],onprocessfile:[null,Type.FUNCTION],onprocessfiles:[null,Type.FUNCTION],onremovefile:[null,Type.FUNCTION],onpreparefile:[null,Type.FUNCTION],onupdatefiles:[null,Type.FUNCTION],onreorderfiles:[null,Type.FUNCTION],beforeDropFile:[null,Type.FUNCTION],beforeAddFile:[null,Type.FUNCTION],beforeRemoveFile:[null,Type.FUNCTION],beforePrepareFile:[null,Type.FUNCTION],stylePanelLayout:[null,Type.STRING],stylePanelAspectRatio:[null,Type.STRING],styleItemPanelAspectRatio:[null,Type.STRING],styleButtonRemoveItemPosition:["left",Type.STRING],styleButtonProcessItemPosition:["right",Type.STRING],styleLoadIndicatorPosition:["right",Type.STRING],styleProgressIndicatorPosition:["right",Type.STRING],styleButtonRemoveItemAlign:[!1,Type.BOOLEAN],files:[[],Type.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],Type.ARRAY]},getItemByQuery=function getItemByQuery(items,query){return isEmpty(query)?items[0]||null:isInt(query)?items[query]||null:("object"==typeof query&&(query=query.id),items.find((function(item){return item.id===query}))||null)},getNumericAspectRatioFromString=function getNumericAspectRatioFromString(aspectRatio){if(isEmpty(aspectRatio))return aspectRatio;if(/:/.test(aspectRatio)){var parts=aspectRatio.split(":");return parts[1]/parts[0]}return parseFloat(aspectRatio)},getActiveItems=function getActiveItems(items){return items.filter((function(item){return!item.archived}))},Status={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},ITEM_ERROR=[ItemStatus.LOAD_ERROR,ItemStatus.PROCESSING_ERROR,ItemStatus.PROCESSING_REVERT_ERROR],ITEM_BUSY=[ItemStatus.LOADING,ItemStatus.PROCESSING,ItemStatus.PROCESSING_QUEUED,ItemStatus.INIT],ITEM_READY=[ItemStatus.PROCESSING_COMPLETE],isItemInErrorState=function isItemInErrorState(item){return ITEM_ERROR.includes(item.status)},isItemInBusyState=function isItemInBusyState(item){return ITEM_BUSY.includes(item.status)},isItemInReadyState=function isItemInReadyState(item){return ITEM_READY.includes(item.status)},queries=function queries(state){return{GET_STATUS:function GET_STATUS(){var items=getActiveItems(state.items),EMPTY=Status.EMPTY,ERROR=Status.ERROR,BUSY=Status.BUSY,IDLE=Status.IDLE,READY=Status.READY;return 0===items.length?EMPTY:items.some(isItemInErrorState)?ERROR:items.some(isItemInBusyState)?BUSY:items.some(isItemInReadyState)?READY:IDLE},GET_ITEM:function GET_ITEM(query){return getItemByQuery(state.items,query)},GET_ACTIVE_ITEM:function GET_ACTIVE_ITEM(query){return getItemByQuery(getActiveItems(state.items),query)},GET_ACTIVE_ITEMS:function GET_ACTIVE_ITEMS(){return getActiveItems(state.items)},GET_ITEMS:function GET_ITEMS(){return state.items},GET_ITEM_NAME:function GET_ITEM_NAME(query){var item=getItemByQuery(state.items,query);return item?item.filename:null},GET_ITEM_SIZE:function GET_ITEM_SIZE(query){var item=getItemByQuery(state.items,query);return item?item.fileSize:null},GET_STYLES:function GET_STYLES(){return Object.keys(state.options).filter((function(key){return/^style/.test(key)})).map((function(option){return{name:option,value:state.options[option]}}))},GET_PANEL_ASPECT_RATIO:function GET_PANEL_ASPECT_RATIO(){var isShapeCircle,aspectRatio;return/circle/.test(state.options.stylePanelLayout)?1:getNumericAspectRatioFromString(state.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function GET_ITEM_PANEL_ASPECT_RATIO(){return state.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function GET_ITEMS_BY_STATUS(status){return getActiveItems(state.items).filter((function(item){return item.status===status}))},GET_TOTAL_ITEMS:function GET_TOTAL_ITEMS(){return getActiveItems(state.items).length},IS_ASYNC:function IS_ASYNC(){return isObject(state.options.server)&&(isObject(state.options.server.process)||isFunction(state.options.server.process))}}},hasRoomForItem=function hasRoomForItem(state){var count=getActiveItems(state.items).length;if(!state.options.allowMultiple)return 0===count;var maxFileCount=state.options.maxFiles;return null===maxFileCount||count<maxFileCount},limit=function limit(value,min,max){return Math.max(Math.min(max,value),min)},arrayInsert=function arrayInsert(arr,index,item){return arr.splice(index,0,item)},insertItem=function insertItem(items,item,index){return isEmpty(item)?null:void 0===index?(items.push(item),item):(index=limit(index,0,items.length),arrayInsert(items,index,item),item)},isBase64DataURI=function isBase64DataURI(str){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(str)},getFilenameFromURL=function getFilenameFromURL(url){return url.split("/").pop().split("?").shift()},getExtensionFromFilename=function getExtensionFromFilename(name){return name.split(".").pop()},guesstimateExtension=function guesstimateExtension(type){if("string"!=typeof type)return"";var subtype=type.split("/").pop();return/svg/.test(subtype)?"svg":/zip|compressed/.test(subtype)?"zip":/plain/.test(subtype)?"txt":/msword/.test(subtype)?"doc":/[a-z]+/.test(subtype)?"jpeg"===subtype?"jpg":subtype:""},leftPad=function leftPad(value){var padding=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(padding+value).slice(-padding.length)},getDateString=function getDateString(){var date=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return date.getFullYear()+"-"+leftPad(date.getMonth()+1,"00")+"-"+leftPad(date.getDate(),"00")+"_"+leftPad(date.getHours(),"00")+"-"+leftPad(date.getMinutes(),"00")+"-"+leftPad(date.getSeconds(),"00")},getFileFromBlob=function getFileFromBlob(blob,filename){var type=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,extension=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,file="string"==typeof type?blob.slice(0,blob.size,type):blob.slice(0,blob.size,blob.type);return file.lastModifiedDate=new Date,blob._relativePath&&(file._relativePath=blob._relativePath),isString(filename)||(filename=getDateString()),filename&&null===extension&&getExtensionFromFilename(filename)?file.name=filename:(extension=extension||guesstimateExtension(file.type),file.name=filename+(extension?"."+extension:"")),file},getBlobBuilder=function getBlobBuilder(){return window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder},createBlob=function createBlob(arrayBuffer,mimeType){var BB=getBlobBuilder();if(BB){var bb=new BB;return bb.append(arrayBuffer),bb.getBlob(mimeType)}return new Blob([arrayBuffer],{type:mimeType})},getBlobFromByteStringWithMimeType=function getBlobFromByteStringWithMimeType(byteString,mimeType){for(var ab=new ArrayBuffer(byteString.length),ia=new Uint8Array(ab),i=0;i<byteString.length;i++)ia[i]=byteString.charCodeAt(i);return createBlob(ab,mimeType)},getMimeTypeFromBase64DataURI=function getMimeTypeFromBase64DataURI(dataURI){return(/^data:(.+);/.exec(dataURI)||[])[1]||null},getBase64DataFromBase64DataURI=function getBase64DataFromBase64DataURI(dataURI){var data;return dataURI.split(",")[1].replace(/\s/g,"")},getByteStringFromBase64DataURI=function getByteStringFromBase64DataURI(dataURI){return atob(getBase64DataFromBase64DataURI(dataURI))},getBlobFromBase64DataURI=function getBlobFromBase64DataURI(dataURI){var mimeType=getMimeTypeFromBase64DataURI(dataURI),byteString=getByteStringFromBase64DataURI(dataURI);return getBlobFromByteStringWithMimeType(byteString,mimeType)},getFileFromBase64DataURI=function getFileFromBase64DataURI(dataURI,filename,extension){return getFileFromBlob(getBlobFromBase64DataURI(dataURI),filename,null,extension)},getFileNameFromHeader=function getFileNameFromHeader(header){if(!/^content-disposition:/i.test(header))return null;var matches=header.split(/filename=|filename\*=.+''/).splice(1).map((function(name){return name.trim().replace(/^["']|[;"']{0,2}$/g,"")})).filter((function(name){return name.length}));return matches.length?decodeURI(matches[matches.length-1]):null},getFileSizeFromHeader=function getFileSizeFromHeader(header){if(/content-length:/i.test(header)){var size=header.match(/[0-9]+/)[0];return size?parseInt(size,10):null}return null},getTranfserIdFromHeader=function getTranfserIdFromHeader(header){var id;return/x-content-transfer-id:/i.test(header)&&(header.split(":")[1]||"").trim()||null},getFileInfoFromHeaders=function getFileInfoFromHeaders(headers){var info={source:null,name:null,size:null},rows=headers.split("\n"),_iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _iterator=rows[Symbol.iterator](),_step;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var header=_step.value,name=getFileNameFromHeader(header);if(name)info.name=name;else{var size=getFileSizeFromHeader(header);if(size)info.size=size;else{var source=getTranfserIdFromHeader(header);source&&(info.source=source)}}}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return info},createFileLoader=function createFileLoader(fetchFn){var state={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},getProgress=function getProgress(){return state.progress},abort=function abort(){state.request&&state.request.abort&&state.request.abort()},load=function load(){var source=state.source;api.fire("init",source),source instanceof File?api.fire("load",source):source instanceof Blob?api.fire("load",getFileFromBlob(source,source.name)):isBase64DataURI(source)?api.fire("load",getFileFromBase64DataURI(source)):loadURL(source)},loadURL=function loadURL(url){fetchFn?(state.timestamp=Date.now(),state.request=fetchFn(url,(function(response){state.duration=Date.now()-state.timestamp,state.complete=!0,response instanceof Blob&&(response=getFileFromBlob(response,response.name||getFilenameFromURL(url))),api.fire("load",response instanceof Blob?response:response?response.body:null)}),(function(error){api.fire("error","string"==typeof error?{type:"error",code:0,body:error}:error)}),(function(computable,current,total){total&&(state.size=total),state.duration=Date.now()-state.timestamp,computable?(state.progress=current/total,api.fire("progress",state.progress)):state.progress=null}),(function(){api.fire("abort")}),(function(response){var fileinfo=getFileInfoFromHeaders("string"==typeof response?response:response.headers);api.fire("meta",{size:state.size||fileinfo.size,filename:fileinfo.name,source:fileinfo.source})}))):api.fire("error",{type:"error",body:"Can't load URL",code:400})},api=Object.assign({},on(),{setSource:function setSource(source){return state.source=source},getProgress:getProgress,abort:abort,load:load});return api},isGet=function isGet(method){return/GET|HEAD/.test(method)},sendRequest=function sendRequest(data,url,options){var api={onheaders:function onheaders(){},onprogress:function onprogress(){},onload:function onload(){},ontimeout:function ontimeout(){},onerror:function onerror(){},onabort:function onabort(){},abort:function abort(){aborted=!0,xhr.abort()}},aborted=!1,headersReceived=!1;options=Object.assign({method:"POST",headers:{},withCredentials:!1},options),url=encodeURI(url),isGet(options.method)&&data&&(url=""+url+encodeURIComponent("string"==typeof data?data:JSON.stringify(data)));var xhr=new XMLHttpRequest,process;return(isGet(options.method)?xhr:xhr.upload).onprogress=function(e){aborted||api.onprogress(e.lengthComputable,e.loaded,e.total)},xhr.onreadystatechange=function(){xhr.readyState<2||4===xhr.readyState&&0===xhr.status||headersReceived||(headersReceived=!0,api.onheaders(xhr))},xhr.onload=function(){xhr.status>=200&&xhr.status<300?api.onload(xhr):api.onerror(xhr)},xhr.onerror=function(){return api.onerror(xhr)},xhr.onabort=function(){aborted=!0,api.onabort()},xhr.ontimeout=function(){return api.ontimeout(xhr)},xhr.open(options.method,url,!0),isInt(options.timeout)&&(xhr.timeout=options.timeout),Object.keys(options.headers).forEach((function(key){var value=unescape(encodeURIComponent(options.headers[key]));xhr.setRequestHeader(key,value)})),options.responseType&&(xhr.responseType=options.responseType),options.withCredentials&&(xhr.withCredentials=!0),xhr.send(data),api},createResponse=function createResponse(type,code,body,headers){return{type:type,code:code,body:body,headers:headers}},createTimeoutResponse=function createTimeoutResponse(cb){return function(xhr){cb(createResponse("error",0,"Timeout",xhr.getAllResponseHeaders()))}},hasQS=function hasQS(str){return/\?/.test(str)},buildURL=function buildURL(){for(var url="",_len=arguments.length,parts=new Array(_len),_key=0;_key<_len;_key++)parts[_key]=arguments[_key];return parts.forEach((function(part){url+=hasQS(url)&&hasQS(part)?part.replace(/\?/,"&"):part})),url},createFetchFunction=function createFetchFunction(){var apiUrl=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",action=arguments.length>1?arguments[1]:void 0;if("function"==typeof action)return action;if(!action||!isString(action.url))return null;var onload=action.onload||function(res){return res},onerror=action.onerror||function(res){return null};return function(url,load,error,progress,abort,headers){var request=sendRequest(url,buildURL(apiUrl,action.url),Object.assign({},action,{responseType:"blob"}));return request.onload=function(xhr){var headers=xhr.getAllResponseHeaders(),filename=getFileInfoFromHeaders(headers).name||getFilenameFromURL(url);load(createResponse("load",xhr.status,"HEAD"===action.method?null:getFileFromBlob(onload(xhr.response),filename),headers))},request.onerror=function(xhr){error(createResponse("error",xhr.status,onerror(xhr.response)||xhr.statusText,xhr.getAllResponseHeaders()))},request.onheaders=function(xhr){headers(createResponse("headers",xhr.status,null,xhr.getAllResponseHeaders()))},request.ontimeout=createTimeoutResponse(error),request.onprogress=progress,request.onabort=abort,request}},ChunkStatus_QUEUED=0,ChunkStatus_COMPLETE=1,ChunkStatus_PROCESSING=2,ChunkStatus_ERROR=3,ChunkStatus_WAITING=4,processFileChunked=function processFileChunked(apiUrl,action,name,file,metadata,load,error,progress,abort,transfer,options){for(var chunks=[],chunkTransferId=options.chunkTransferId,chunkServer=options.chunkServer,chunkSize=options.chunkSize,chunkRetryDelays=options.chunkRetryDelays,state={serverId:chunkTransferId,aborted:!1},ondata=action.ondata||function(fd){return fd},onload=action.onload||function(xhr,method){return"HEAD"===method?xhr.getResponseHeader("Upload-Offset"):xhr.response},onerror=action.onerror||function(res){return null},requestTransferId=function requestTransferId(cb){var formData=new FormData;isObject(metadata)&&formData.append(name,JSON.stringify(metadata));var headers="function"==typeof action.headers?action.headers(file,metadata):Object.assign({},action.headers,{"Upload-Length":file.size}),requestParams=Object.assign({},action,{headers:headers}),request=sendRequest(ondata(formData),buildURL(apiUrl,action.url),requestParams);request.onload=function(xhr){return cb(onload(xhr,requestParams.method))},request.onerror=function(xhr){return error(createResponse("error",xhr.status,onerror(xhr.response)||xhr.statusText,xhr.getAllResponseHeaders()))},request.ontimeout=createTimeoutResponse(error)},requestTransferOffset=function requestTransferOffset(cb){var requestUrl=buildURL(apiUrl,chunkServer.url,state.serverId),headers,requestParams={headers:"function"==typeof action.headers?action.headers(state.serverId):Object.assign({},action.headers),method:"HEAD"},request=sendRequest(null,requestUrl,requestParams);request.onload=function(xhr){return cb(onload(xhr,requestParams.method))},request.onerror=function(xhr){return error(createResponse("error",xhr.status,onerror(xhr.response)||xhr.statusText,xhr.getAllResponseHeaders()))},request.ontimeout=createTimeoutResponse(error)},lastChunkIndex=Math.floor(file.size/chunkSize),i=0;i<=lastChunkIndex;i++){var offset=i*chunkSize,data=file.slice(offset,offset+chunkSize,"application/offset+octet-stream");chunks[i]={index:i,size:data.size,offset:offset,data:data,file:file,progress:0,retries:_toConsumableArray(chunkRetryDelays),status:ChunkStatus_QUEUED,error:null,request:null,timeout:null}}var completeProcessingChunks=function completeProcessingChunks(){return load(state.serverId)},canProcessChunk=function canProcessChunk(chunk){return chunk.status===ChunkStatus_QUEUED||chunk.status===ChunkStatus_ERROR},processChunk=function processChunk(chunk){if(!state.aborted)if(chunk=chunk||chunks.find(canProcessChunk)){chunk.status=ChunkStatus_PROCESSING,chunk.progress=null;var ondata=chunkServer.ondata||function(fd){return fd},onerror=chunkServer.onerror||function(res){return null},requestUrl=buildURL(apiUrl,chunkServer.url,state.serverId),headers="function"==typeof chunkServer.headers?chunkServer.headers(chunk):Object.assign({},chunkServer.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":chunk.offset,"Upload-Length":file.size,"Upload-Name":file.name}),request=chunk.request=sendRequest(ondata(chunk.data),requestUrl,Object.assign({},chunkServer,{headers:headers}));request.onload=function(){chunk.status=ChunkStatus_COMPLETE,chunk.request=null,processChunks()},request.onprogress=function(lengthComputable,loaded,total){chunk.progress=lengthComputable?loaded:null,updateTotalProgress()},request.onerror=function(xhr){chunk.status=ChunkStatus_ERROR,chunk.request=null,chunk.error=onerror(xhr.response)||xhr.statusText,retryProcessChunk(chunk)||error(createResponse("error",xhr.status,onerror(xhr.response)||xhr.statusText,xhr.getAllResponseHeaders()))},request.ontimeout=function(xhr){chunk.status=ChunkStatus_ERROR,chunk.request=null,retryProcessChunk(chunk)||createTimeoutResponse(error)(xhr)},request.onabort=function(){chunk.status=ChunkStatus_QUEUED,chunk.request=null,abort()}}else chunks.every((function(chunk){return chunk.status===ChunkStatus_COMPLETE}))&&completeProcessingChunks()},retryProcessChunk=function retryProcessChunk(chunk){return 0!==chunk.retries.length&&(chunk.status=ChunkStatus_WAITING,clearTimeout(chunk.timeout),chunk.timeout=setTimeout((function(){processChunk(chunk)}),chunk.retries.shift()),!0)},updateTotalProgress=function updateTotalProgress(){var totalBytesTransfered=chunks.reduce((function(p,chunk){return null===p||null===chunk.progress?null:p+chunk.progress}),0);if(null===totalBytesTransfered)return progress(!1,0,0);var totalSize=chunks.reduce((function(total,chunk){return total+chunk.size}),0);progress(!0,totalBytesTransfered,totalSize)},processChunks=function processChunks(){var totalProcessing;chunks.filter((function(chunk){return chunk.status===ChunkStatus_PROCESSING})).length>=1||processChunk()},abortChunks=function abortChunks(){chunks.forEach((function(chunk){clearTimeout(chunk.timeout),chunk.request&&chunk.request.abort()}))};return state.serverId?requestTransferOffset((function(offset){state.aborted||(chunks.filter((function(chunk){return chunk.offset<offset})).forEach((function(chunk){chunk.status=ChunkStatus_COMPLETE,chunk.progress=chunk.size})),processChunks())})):requestTransferId((function(serverId){state.aborted||(transfer(serverId),state.serverId=serverId,processChunks())})),{abort:function abort(){state.aborted=!0,abortChunks()}}},createFileProcessorFunction=function createFileProcessorFunction(apiUrl,action,name,options){return function(file,metadata,load,error,progress,abort,transfer){if(file){var canChunkUpload=options.chunkUploads,shouldChunkUpload=canChunkUpload&&file.size>options.chunkSize,willChunkUpload=canChunkUpload&&(shouldChunkUpload||options.chunkForce);if(file instanceof Blob&&willChunkUpload)return processFileChunked(apiUrl,action,name,file,metadata,load,error,progress,abort,transfer,options);var ondata=action.ondata||function(fd){return fd},onload=action.onload||function(res){return res},onerror=action.onerror||function(res){return null},formData=new FormData;isObject(metadata)&&formData.append(name,JSON.stringify(metadata)),(file instanceof Blob?[{name:null,file:file}]:file).forEach((function(item){formData.append(name,item.file,null===item.name?item.file.name:""+item.name+item.file.name)}));var request=sendRequest(ondata(formData),buildURL(apiUrl,action.url),action);return request.onload=function(xhr){load(createResponse("load",xhr.status,onload(xhr.response),xhr.getAllResponseHeaders()))},request.onerror=function(xhr){error(createResponse("error",xhr.status,onerror(xhr.response)||xhr.statusText,xhr.getAllResponseHeaders()))},request.ontimeout=createTimeoutResponse(error),request.onprogress=progress,request.onabort=abort,request}}},createProcessorFunction=function createProcessorFunction(){var apiUrl=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",action=arguments.length>1?arguments[1]:void 0,name=arguments.length>2?arguments[2]:void 0,options=arguments.length>3?arguments[3]:void 0;return"function"==typeof action?function(){for(var _len=arguments.length,params=new Array(_len),_key=0;_key<_len;_key++)params[_key]=arguments[_key];return action.apply(void 0,[name].concat(params,[options]))}:action&&isString(action.url)?createFileProcessorFunction(apiUrl,action,name,options):null},createRevertFunction=function createRevertFunction(){var apiUrl=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",action=arguments.length>1?arguments[1]:void 0;if("function"==typeof action)return action;if(!action||!isString(action.url))return function(uniqueFileId,load){return load()};var onload=action.onload||function(res){return res},onerror=action.onerror||function(res){return null};return function(uniqueFileId,load,error){var request=sendRequest(uniqueFileId,apiUrl+action.url,action);return request.onload=function(xhr){load(createResponse("load",xhr.status,onload(xhr.response),xhr.getAllResponseHeaders()))},request.onerror=function(xhr){error(createResponse("error",xhr.status,onerror(xhr.response)||xhr.statusText,xhr.getAllResponseHeaders()))},request.ontimeout=createTimeoutResponse(error),request}},getRandomNumber=function getRandomNumber(){var min=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,max=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return min+Math.random()*(max-min)},createPerceivedPerformanceUpdater=function createPerceivedPerformanceUpdater(cb){var duration=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,offset=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,tickMin=arguments.length>3&&void 0!==arguments[3]?arguments[3]:25,tickMax=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,timeout=null,start=Date.now(),tick=function tick(){var runtime=Date.now()-start,delay=getRandomNumber(tickMin,tickMax);runtime+delay>duration&&(delay=runtime+delay-duration);var progress=runtime/duration;progress>=1||document.hidden?cb(1):(cb(progress),timeout=setTimeout(tick,delay))};return tick(),{clear:function clear(){clearTimeout(timeout)}}},createFileProcessor=function createFileProcessor(processFn){var state={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},process=function process(file,metadata){var progressFn=function progressFn(){0!==state.duration&&null!==state.progress&&api.fire("progress",api.getProgress())},completeFn=function completeFn(){state.complete=!0,api.fire("load-perceived",state.response.body)};api.fire("start"),state.timestamp=Date.now(),state.perceivedPerformanceUpdater=createPerceivedPerformanceUpdater((function(progress){state.perceivedProgress=progress,state.perceivedDuration=Date.now()-state.timestamp,progressFn(),state.response&&1===state.perceivedProgress&&!state.complete&&completeFn()}),getRandomNumber(750,1500)),state.request=processFn(file,metadata,(function(response){state.response=isObject(response)?response:{type:"load",code:200,body:""+response,headers:{}},state.duration=Date.now()-state.timestamp,state.progress=1,api.fire("load",state.response.body),1===state.perceivedProgress&&completeFn()}),(function(error){state.perceivedPerformanceUpdater.clear(),api.fire("error",isObject(error)?error:{type:"error",code:0,body:""+error})}),(function(computable,current,total){state.duration=Date.now()-state.timestamp,state.progress=computable?current/total:null,progressFn()}),(function(){state.perceivedPerformanceUpdater.clear(),api.fire("abort",state.response?state.response.body:null)}),(function(transferId){api.fire("transfer",transferId)}))},abort=function abort(){state.request&&(state.perceivedPerformanceUpdater.clear(),state.request.abort&&state.request.abort(),state.complete=!0)},reset=function reset(){abort(),state.complete=!1,state.perceivedProgress=0,state.progress=0,state.timestamp=null,state.perceivedDuration=0,state.duration=0,state.request=null,state.response=null},getProgress=function getProgress(){return state.progress?Math.min(state.progress,state.perceivedProgress):null},getDuration=function getDuration(){return Math.min(state.duration,state.perceivedDuration)},api=Object.assign({},on(),{process:process,abort:abort,getProgress:getProgress,getDuration:getDuration,reset:reset});return api},getFilenameWithoutExtension=function getFilenameWithoutExtension(name){return name.substr(0,name.lastIndexOf("."))||name},createFileStub=function createFileStub(source){var data=[source.name,source.size,source.type];return source instanceof Blob||isBase64DataURI(source)?data[0]=source.name||getDateString():isBase64DataURI(source)?(data[1]=source.length,data[2]=getMimeTypeFromBase64DataURI(source)):isString(source)&&(data[0]=getFilenameFromURL(source),data[1]=0,data[2]="application/octet-stream"),{name:data[0],size:data[1],type:data[2]}},isFile=function isFile(value){return!!(value instanceof File||value instanceof Blob&&value.name)},deepCloneObject=function deepCloneObject(src){if(!isObject(src))return src;var target=isArray(src)?[]:{};for(var key in src)if(src.hasOwnProperty(key)){var v=src[key];target[key]=v&&isObject(v)?deepCloneObject(v):v}return target},createItem=function createItem(){var origin=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,serverFileReference=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,file=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,id=getUniqueId(),state={archived:!1,frozen:!1,released:!1,source:null,file:file,serverFileReference:serverFileReference,transferId:null,processingAborted:!1,status:serverFileReference?ItemStatus.PROCESSING_COMPLETE:ItemStatus.INIT,activeLoader:null,activeProcessor:null},abortProcessingRequestComplete=null,metadata={},setStatus=function setStatus(status){return state.status=status},fire=function fire(event){if(!state.released&&!state.frozen){for(var _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)params[_key-1]=arguments[_key];api.fire.apply(api,[event].concat(params))}},getFileExtension=function getFileExtension(){return getExtensionFromFilename(state.file.name)},getFileType=function getFileType(){return state.file.type},getFileSize=function getFileSize(){return state.file.size},getFile=function getFile(){return state.file},load=function load(source,loader,onload){state.source=source,api.fireSync("init"),state.file?api.fireSync("load-skip"):(state.file=createFileStub(source),loader.on("init",(function(){fire("load-init")})),loader.on("meta",(function(meta){state.file.size=meta.size,state.file.filename=meta.filename,meta.source&&(origin=FileOrigin.LIMBO,state.serverFileReference=meta.source,state.status=ItemStatus.PROCESSING_COMPLETE),fire("load-meta")})),loader.on("progress",(function(progress){setStatus(ItemStatus.LOADING),fire("load-progress",progress)})),loader.on("error",(function(error){setStatus(ItemStatus.LOAD_ERROR),fire("load-request-error",error)})),loader.on("abort",(function(){setStatus(ItemStatus.INIT),fire("load-abort")})),loader.on("load",(function(file){state.activeLoader=null;var success=function success(result){state.file=isFile(result)?result:state.file,origin===FileOrigin.LIMBO&&state.serverFileReference?setStatus(ItemStatus.PROCESSING_COMPLETE):setStatus(ItemStatus.IDLE),fire("load")},error=function error(result){state.file=file,fire("load-meta"),setStatus(ItemStatus.LOAD_ERROR),fire("load-file-error",result)};state.serverFileReference?success(file):onload(file,success,error)})),loader.setSource(source),state.activeLoader=loader,loader.load())},retryLoad=function retryLoad(){state.activeLoader&&state.activeLoader.load()},abortLoad=function abortLoad(){state.activeLoader?state.activeLoader.abort():(setStatus(ItemStatus.INIT),fire("load-abort"))},process=function process(processor,onprocess){if(state.processingAborted)state.processingAborted=!1;else if(setStatus(ItemStatus.PROCESSING),abortProcessingRequestComplete=null,state.file instanceof Blob){processor.on("load",(function(serverFileReference){state.transferId=null,state.serverFileReference=serverFileReference})),processor.on("transfer",(function(transferId){state.transferId=transferId})),processor.on("load-perceived",(function(serverFileReference){state.activeProcessor=null,state.transferId=null,state.serverFileReference=serverFileReference,setStatus(ItemStatus.PROCESSING_COMPLETE),fire("process-complete",serverFileReference)})),processor.on("start",(function(){fire("process-start")})),processor.on("error",(function(error){state.activeProcessor=null,setStatus(ItemStatus.PROCESSING_ERROR),fire("process-error",error)})),processor.on("abort",(function(serverFileReference){state.activeProcessor=null,state.transferId=null,state.serverFileReference=serverFileReference,setStatus(ItemStatus.IDLE),fire("process-abort"),abortProcessingRequestComplete&&abortProcessingRequestComplete()})),processor.on("progress",(function(progress){fire("process-progress",progress)}));var success=function success(file){state.archived||processor.process(file,Object.assign({},metadata))},error=console.error;onprocess(state.file,success,error),state.activeProcessor=processor}else api.on("load",(function(){process(processor,onprocess)}))},requestProcessing=function requestProcessing(){state.processingAborted=!1,setStatus(ItemStatus.PROCESSING_QUEUED)},abortProcessing=function abortProcessing(){return new Promise((function(resolve){if(!state.activeProcessor)return state.processingAborted=!0,setStatus(ItemStatus.IDLE),fire("process-abort"),void resolve();abortProcessingRequestComplete=function abortProcessingRequestComplete(){resolve()},state.activeProcessor.abort()}))},revert=function revert(revertFileUpload,forceRevert){return new Promise((function(resolve,reject){null!==state.serverFileReference?(revertFileUpload(state.serverFileReference,(function(){state.serverFileReference=null,resolve()}),(function(error){forceRevert?(setStatus(ItemStatus.PROCESSING_REVERT_ERROR),fire("process-revert-error"),reject(error)):resolve()})),setStatus(ItemStatus.IDLE),fire("process-revert")):resolve()}))},_setMetadata=function setMetadata(key,value,silent){var keys=key.split("."),root=keys[0],last=keys.pop(),data=metadata;keys.forEach((function(key){return data=data[key]})),JSON.stringify(data[last])!==JSON.stringify(value)&&(data[last]=value,silent||fire("metadata-update",{key:root,value:metadata[root]}))},getMetadata=function getMetadata(key){return deepCloneObject(key?metadata[key]:metadata)},api=Object.assign({id:{get:function get(){return id}},origin:{get:function get(){return origin}},serverId:{get:function get(){return state.serverFileReference}},transferId:{get:function get(){return state.transferId}},status:{get:function get(){return state.status}},filename:{get:function get(){return state.file.name}},filenameWithoutExtension:{get:function get(){return getFilenameWithoutExtension(state.file.name)}},fileExtension:{get:getFileExtension},fileType:{get:getFileType},fileSize:{get:getFileSize},file:{get:getFile},relativePath:{get:function get(){return state.file._relativePath}},source:{get:function get(){return state.source}},getMetadata:getMetadata,setMetadata:function setMetadata(key,value,silent){if(isObject(key)){var data=key;return Object.keys(data).forEach((function(key){_setMetadata(key,data[key],value)})),key}return _setMetadata(key,value,silent),value},extend:function extend(name,handler){return itemAPI[name]=handler},abortLoad:abortLoad,retryLoad:retryLoad,requestProcessing:requestProcessing,abortProcessing:abortProcessing,load:load,process:process,revert:revert},on(),{freeze:function freeze(){return state.frozen=!0},release:function release(){return state.released=!0},released:{get:function get(){return state.released}},archive:function archive(){return state.archived=!0},archived:{get:function get(){return state.archived}}}),itemAPI=createObject(api);return itemAPI},getItemIndexByQuery=function getItemIndexByQuery(items,query){return isEmpty(query)?0:isString(query)?items.findIndex((function(item){return item.id===query})):-1},getItemById=function getItemById(items,itemId){var index=getItemIndexByQuery(items,itemId);if(!(index<0))return items[index]||null},fetchBlob=function fetchBlob(url,load,error,progress,abort,headers){var request=sendRequest(null,url,{method:"GET",responseType:"blob"});return request.onload=function(xhr){var headers=xhr.getAllResponseHeaders(),filename=getFileInfoFromHeaders(headers).name||getFilenameFromURL(url);load(createResponse("load",xhr.status,getFileFromBlob(xhr.response,filename),headers))},request.onerror=function(xhr){error(createResponse("error",xhr.status,xhr.statusText,xhr.getAllResponseHeaders()))},request.onheaders=function(xhr){headers(createResponse("headers",xhr.status,null,xhr.getAllResponseHeaders()))},request.ontimeout=createTimeoutResponse(error),request.onprogress=progress,request.onabort=abort,request},getDomainFromURL=function getDomainFromURL(url){return 0===url.indexOf("//")&&(url=location.protocol+url),url.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]},isExternalURL=function isExternalURL(url){return(url.indexOf(":")>-1||url.indexOf("//")>-1)&&getDomainFromURL(location.href)!==getDomainFromURL(url)},dynamicLabel=function dynamicLabel(label){return function(){return isFunction(label)?label.apply(void 0,arguments):label}},isMockItem=function isMockItem(item){return!isFile(item.file)},listUpdated=function listUpdated(dispatch,state){clearTimeout(state.listUpdateTimeout),state.listUpdateTimeout=setTimeout((function(){dispatch("DID_UPDATE_ITEMS",{items:getActiveItems(state.items)})}),0)},optionalPromise=function optionalPromise(fn){for(var _len=arguments.length,params=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)params[_key-1]=arguments[_key];return new Promise((function(resolve){if(!fn)return resolve(!0);var result=fn.apply(void 0,params);return null==result?resolve(!0):"boolean"==typeof result?resolve(result):void("function"==typeof result.then&&result.then(resolve))}))},sortItems=function sortItems(state,compare){state.items.sort((function(a,b){return compare(createItemAPI(a),createItemAPI(b))}))},getItemByQueryFromState=function getItemByQueryFromState(state,itemHandler){return function(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},query=_ref.query,_ref$success=_ref.success,success=void 0===_ref$success?function(){}:_ref$success,_ref$failure=_ref.failure,failure=void 0===_ref$failure?function(){}:_ref$failure,options=_objectWithoutProperties(_ref,["query","success","failure"]),item=getItemByQuery(state.items,query);item?itemHandler(item,success,failure,options||{}):failure({error:createResponse("error",0,"Item not found"),file:null})}},actions=function actions(dispatch,query,state){return{ABORT_ALL:function ABORT_ALL(){getActiveItems(state.items).forEach((function(item){item.freeze(),item.abortLoad(),item.abortProcessing()}))},DID_SET_FILES:function DID_SET_FILES(_ref2){var _ref2$value=_ref2.value,value,files=(void 0===_ref2$value?[]:_ref2$value).map((function(file){return{source:file.source?file.source:file,options:file.options}})),activeItems=getActiveItems(state.items);activeItems.forEach((function(item){files.find((function(file){return file.source===item.source||file.source===item.file}))||dispatch("REMOVE_ITEM",{query:item,remove:!1})})),activeItems=getActiveItems(state.items),files.forEach((function(file,index){activeItems.find((function(item){return item.source===file.source||item.file===file.source}))||dispatch("ADD_ITEM",Object.assign({},file,{interactionMethod:InteractionMethod_NONE,index:index}))}))},DID_UPDATE_ITEM_METADATA:function DID_UPDATE_ITEM_METADATA(_ref3){var id=_ref3.id,action=_ref3.action;clearTimeout(state.itemUpdateTimeout),state.itemUpdateTimeout=setTimeout((function(){var item=getItemById(state.items,id);if(query("IS_ASYNC")){var upload=function upload(){setTimeout((function(){dispatch("REQUEST_ITEM_PROCESSING",{query:id})}),32)},revert=function revert(doUpload){item.revert(createRevertFunction(state.options.server.url,state.options.server.revert),query("GET_FORCE_REVERT")).then(doUpload?upload:function(){}).catch((function(){}))},abort=function abort(doUpload){item.abortProcessing().then(doUpload?upload:function(){})};return item.status===ItemStatus.PROCESSING_COMPLETE?revert(state.options.instantUpload):item.status===ItemStatus.PROCESSING?abort(state.options.instantUpload):void(state.options.instantUpload&&upload())}applyFilterChain("SHOULD_PREPARE_OUTPUT",!1,{item:item,query:query,action:action}).then((function(shouldPrepareOutput){var beforePrepareFile=query("GET_BEFORE_PREPARE_FILE");beforePrepareFile&&(shouldPrepareOutput=beforePrepareFile(item,shouldPrepareOutput)),shouldPrepareOutput&&dispatch("REQUEST_PREPARE_OUTPUT",{query:id,item:item,success:function success(file){dispatch("DID_PREPARE_OUTPUT",{id:id,file:file})}},!0)}))}),0)},MOVE_ITEM:function MOVE_ITEM(_ref4){var query=_ref4.query,index=_ref4.index,item=getItemByQuery(state.items,query);if(item){var currentIndex=state.items.indexOf(item);currentIndex!==(index=limit(index,0,state.items.length-1))&&state.items.splice(index,0,state.items.splice(currentIndex,1)[0])}},SORT:function SORT(_ref5){var compare=_ref5.compare;sortItems(state,compare),dispatch("DID_SORT_ITEMS",{items:query("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function ADD_ITEMS(_ref6){var items=_ref6.items,index=_ref6.index,interactionMethod=_ref6.interactionMethod,_ref6$success=_ref6.success,success=void 0===_ref6$success?function(){}:_ref6$success,_ref6$failure=_ref6.failure,failure=void 0===_ref6$failure?function(){}:_ref6$failure,currentIndex=index;if(-1===index||void 0===index){var insertLocation=query("GET_ITEM_INSERT_LOCATION"),totalItems=query("GET_TOTAL_ITEMS");currentIndex="before"===insertLocation?0:totalItems}var ignoredFiles=query("GET_IGNORED_FILES"),isValidFile=function isValidFile(source){return isFile(source)?!ignoredFiles.includes(source.name.toLowerCase()):!isEmpty(source)},validItems,promises=items.filter(isValidFile).map((function(source){return new Promise((function(resolve,reject){dispatch("ADD_ITEM",{interactionMethod:interactionMethod,source:source.source||source,success:resolve,failure:reject,index:currentIndex++,options:source.options||{}})}))}));Promise.all(promises).then(success).catch(failure)},ADD_ITEM:function ADD_ITEM(_ref7){var source=_ref7.source,_ref7$index=_ref7.index,index=void 0===_ref7$index?-1:_ref7$index,interactionMethod=_ref7.interactionMethod,_ref7$success=_ref7.success,success=void 0===_ref7$success?function(){}:_ref7$success,_ref7$failure=_ref7.failure,failure=void 0===_ref7$failure?function(){}:_ref7$failure,_ref7$options=_ref7.options,options=void 0===_ref7$options?{}:_ref7$options;if(isEmpty(source))failure({error:createResponse("error",0,"No source"),file:null});else if(!isFile(source)||!state.options.ignoredFiles.includes(source.name.toLowerCase())){if(!hasRoomForItem(state)){if(state.options.allowMultiple||!state.options.allowMultiple&&!state.options.allowReplace){var error=createResponse("warning",0,"Max files");return dispatch("DID_THROW_MAX_FILES",{source:source,error:error}),void failure({error:error,file:null})}var _item=getActiveItems(state.items)[0];if(_item.status===ItemStatus.PROCESSING_COMPLETE||_item.status===ItemStatus.PROCESSING_REVERT_ERROR){var forceRevert=query("GET_FORCE_REVERT");if(_item.revert(createRevertFunction(state.options.server.url,state.options.server.revert),forceRevert).then((function(){forceRevert&&dispatch("ADD_ITEM",{source:source,index:index,interactionMethod:interactionMethod,success:success,failure:failure,options:options})})).catch((function(){})),forceRevert)return}dispatch("REMOVE_ITEM",{query:_item.id})}var origin="local"===options.type?FileOrigin.LOCAL:"limbo"===options.type?FileOrigin.LIMBO:FileOrigin.INPUT,item=createItem(origin,origin===FileOrigin.INPUT?null:source,options.file);Object.keys(options.metadata||{}).forEach((function(key){item.setMetadata(key,options.metadata[key])})),applyFilters("DID_CREATE_ITEM",item,{query:query,dispatch:dispatch});var itemInsertLocation=query("GET_ITEM_INSERT_LOCATION");state.options.itemInsertLocationFreedom||(index="before"===itemInsertLocation?-1:state.items.length),insertItem(state.items,item,index),isFunction(itemInsertLocation)&&source&&sortItems(state,itemInsertLocation);var id=item.id;item.on("init",(function(){dispatch("DID_INIT_ITEM",{id:id})})),item.on("load-init",(function(){dispatch("DID_START_ITEM_LOAD",{id:id})})),item.on("load-meta",(function(){dispatch("DID_UPDATE_ITEM_META",{id:id})})),item.on("load-progress",(function(progress){dispatch("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:id,progress:progress})})),item.on("load-request-error",(function(error){var mainStatus=dynamicLabel(state.options.labelFileLoadError)(error);if(error.code>=400&&error.code<500)return dispatch("DID_THROW_ITEM_INVALID",{id:id,error:error,status:{main:mainStatus,sub:error.code+" ("+error.body+")"}}),void failure({error:error,file:createItemAPI(item)});dispatch("DID_THROW_ITEM_LOAD_ERROR",{id:id,error:error,status:{main:mainStatus,sub:state.options.labelTapToRetry}})})),item.on("load-file-error",(function(error){dispatch("DID_THROW_ITEM_INVALID",{id:id,error:error.status,status:error.status}),failure({error:error.status,file:createItemAPI(item)})})),item.on("load-abort",(function(){dispatch("REMOVE_ITEM",{query:id})})),item.on("load-skip",(function(){dispatch("COMPLETE_LOAD_ITEM",{query:id,item:item,data:{source:source,success:success}})})),item.on("load",(function(){var handleAdd=function handleAdd(shouldAdd){shouldAdd?(item.on("metadata-update",(function(change){dispatch("DID_UPDATE_ITEM_METADATA",{id:id,change:change})})),applyFilterChain("SHOULD_PREPARE_OUTPUT",!1,{item:item,query:query}).then((function(shouldPrepareOutput){var beforePrepareFile=query("GET_BEFORE_PREPARE_FILE");beforePrepareFile&&(shouldPrepareOutput=beforePrepareFile(item,shouldPrepareOutput));var loadComplete=function loadComplete(){dispatch("COMPLETE_LOAD_ITEM",{query:id,item:item,data:{source:source,success:success}}),listUpdated(dispatch,state)};shouldPrepareOutput?dispatch("REQUEST_PREPARE_OUTPUT",{query:id,item:item,success:function success(file){dispatch("DID_PREPARE_OUTPUT",{id:id,file:file}),loadComplete()}},!0):loadComplete()}))):dispatch("REMOVE_ITEM",{query:id})};applyFilterChain("DID_LOAD_ITEM",item,{query:query,dispatch:dispatch}).then((function(){optionalPromise(query("GET_BEFORE_ADD_FILE"),createItemAPI(item)).then(handleAdd)})).catch((function(){handleAdd(!1)}))})),item.on("process-start",(function(){dispatch("DID_START_ITEM_PROCESSING",{id:id})})),item.on("process-progress",(function(progress){dispatch("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:id,progress:progress})})),item.on("process-error",(function(error){dispatch("DID_THROW_ITEM_PROCESSING_ERROR",{id:id,error:error,status:{main:dynamicLabel(state.options.labelFileProcessingError)(error),sub:state.options.labelTapToRetry}})})),item.on("process-revert-error",(function(error){dispatch("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:id,error:error,status:{main:dynamicLabel(state.options.labelFileProcessingRevertError)(error),sub:state.options.labelTapToRetry}})})),item.on("process-complete",(function(serverFileReference){dispatch("DID_COMPLETE_ITEM_PROCESSING",{id:id,error:null,serverFileReference:serverFileReference}),dispatch("DID_DEFINE_VALUE",{id:id,value:serverFileReference})})),item.on("process-abort",(function(){dispatch("DID_ABORT_ITEM_PROCESSING",{id:id})})),item.on("process-revert",(function(){dispatch("DID_REVERT_ITEM_PROCESSING",{id:id}),dispatch("DID_DEFINE_VALUE",{id:id,value:null})})),dispatch("DID_ADD_ITEM",{id:id,index:index,interactionMethod:interactionMethod}),listUpdated(dispatch,state);var _ref8=state.options.server||{},url=_ref8.url,load=_ref8.load,restore=_ref8.restore,fetch=_ref8.fetch;item.load(source,createFileLoader(origin===FileOrigin.INPUT?isString(source)&&isExternalURL(source)&&fetch?createFetchFunction(url,fetch):fetchBlob:createFetchFunction(url,origin===FileOrigin.LIMBO?restore:load)),(function(file,success,error){applyFilterChain("LOAD_FILE",file,{query:query}).then(success).catch(error)}))}},REQUEST_PREPARE_OUTPUT:function REQUEST_PREPARE_OUTPUT(_ref9){var item=_ref9.item,success=_ref9.success,_ref9$failure=_ref9.failure,failure=void 0===_ref9$failure?function(){}:_ref9$failure,err={error:createResponse("error",0,"Item not found"),file:null};if(item.archived)return failure(err);applyFilterChain("PREPARE_OUTPUT",item.file,{query:query,item:item}).then((function(result){applyFilterChain("COMPLETE_PREPARE_OUTPUT",result,{query:query,item:item}).then((function(result){if(item.archived)return failure(err);success(result)}))}))},COMPLETE_LOAD_ITEM:function COMPLETE_LOAD_ITEM(_ref10){var item=_ref10.item,data=_ref10.data,success=data.success,source=data.source,itemInsertLocation=query("GET_ITEM_INSERT_LOCATION");if(isFunction(itemInsertLocation)&&source&&sortItems(state,itemInsertLocation),dispatch("DID_LOAD_ITEM",{id:item.id,error:null,serverFileReference:item.origin===FileOrigin.INPUT?null:source}),success(createItemAPI(item)),item.origin!==FileOrigin.LOCAL)return item.origin===FileOrigin.LIMBO?(dispatch("DID_COMPLETE_ITEM_PROCESSING",{id:item.id,error:null,serverFileReference:source}),void dispatch("DID_DEFINE_VALUE",{id:item.id,value:source})):void(query("IS_ASYNC")&&state.options.instantUpload&&dispatch("REQUEST_ITEM_PROCESSING",{query:item.id}));dispatch("DID_LOAD_LOCAL_ITEM",{id:item.id})},RETRY_ITEM_LOAD:getItemByQueryFromState(state,(function(item){item.retryLoad()})),REQUEST_ITEM_PREPARE:getItemByQueryFromState(state,(function(item,_success,failure){dispatch("REQUEST_PREPARE_OUTPUT",{query:item.id,item:item,success:function success(file){dispatch("DID_PREPARE_OUTPUT",{id:item.id,file:file}),_success({file:item,output:file})},failure:failure},!0)})),REQUEST_ITEM_PROCESSING:getItemByQueryFromState(state,(function(item,success,failure){var itemCanBeQueuedForProcessing;if(item.status===ItemStatus.IDLE||item.status===ItemStatus.PROCESSING_ERROR)item.status!==ItemStatus.PROCESSING_QUEUED&&(item.requestProcessing(),dispatch("DID_REQUEST_ITEM_PROCESSING",{id:item.id}),dispatch("PROCESS_ITEM",{query:item,success:success,failure:failure},!0));else{var processNow=function processNow(){return dispatch("REQUEST_ITEM_PROCESSING",{query:item,success:success,failure:failure})},process=function process(){return document.hidden?processNow():setTimeout(processNow,32)};item.status===ItemStatus.PROCESSING_COMPLETE||item.status===ItemStatus.PROCESSING_REVERT_ERROR?item.revert(createRevertFunction(state.options.server.url,state.options.server.revert),query("GET_FORCE_REVERT")).then(process).catch((function(){})):item.status===ItemStatus.PROCESSING&&item.abortProcessing().then(process)}})),PROCESS_ITEM:getItemByQueryFromState(state,(function(item,success,failure){var maxParallelUploads=query("GET_MAX_PARALLEL_UPLOADS"),totalCurrentUploads;if(query("GET_ITEMS_BY_STATUS",ItemStatus.PROCESSING).length!==maxParallelUploads){if(item.status!==ItemStatus.PROCESSING){var processNext=function processNext(){var queueEntry=state.processingQueue.shift();if(queueEntry){var id=queueEntry.id,success=queueEntry.success,failure=queueEntry.failure,itemReference=getItemByQuery(state.items,id);itemReference&&!itemReference.archived?dispatch("PROCESS_ITEM",{query:id,success:success,failure:failure},!0):processNext()}};item.onOnce("process-complete",(function(){var allItemsProcessed;success(createItemAPI(item)),processNext(),query("GET_ITEMS_BY_STATUS",ItemStatus.PROCESSING_COMPLETE).length===state.items.length&&dispatch("DID_COMPLETE_ITEM_PROCESSING_ALL")})),item.onOnce("process-error",(function(error){failure({error:error,file:createItemAPI(item)}),processNext()}));var options=state.options;item.process(createFileProcessor(createProcessorFunction(options.server.url,options.server.process,options.name,{chunkTransferId:item.transferId,chunkServer:options.server.patch,chunkUploads:options.chunkUploads,chunkForce:options.chunkForce,chunkSize:options.chunkSize,chunkRetryDelays:options.chunkRetryDelays})),(function(file,success,error){applyFilterChain("PREPARE_OUTPUT",file,{query:query,item:item}).then((function(file){dispatch("DID_PREPARE_OUTPUT",{id:item.id,file:file}),success(file)})).catch(error)}))}}else state.processingQueue.push({id:item.id,success:success,failure:failure})})),RETRY_ITEM_PROCESSING:getItemByQueryFromState(state,(function(item){dispatch("REQUEST_ITEM_PROCESSING",{query:item})})),REQUEST_REMOVE_ITEM:getItemByQueryFromState(state,(function(item){optionalPromise(query("GET_BEFORE_REMOVE_FILE"),createItemAPI(item)).then((function(shouldRemove){shouldRemove&&dispatch("REMOVE_ITEM",{query:item})}))})),RELEASE_ITEM:getItemByQueryFromState(state,(function(item){item.release()})),REMOVE_ITEM:getItemByQueryFromState(state,(function(item,success,failure,options){var removeFromView=function removeFromView(){var id=item.id;getItemById(state.items,id).archive(),dispatch("DID_REMOVE_ITEM",{error:null,id:id,item:item}),listUpdated(dispatch,state),success(createItemAPI(item))},server=state.options.server;item.origin===FileOrigin.LOCAL&&server&&isFunction(server.remove)&&!1!==options.remove?(dispatch("DID_START_ITEM_REMOVE",{id:item.id}),server.remove(item.source,(function(){return removeFromView()}),(function(status){dispatch("DID_THROW_ITEM_REMOVE_ERROR",{id:item.id,error:createResponse("error",0,status,null),status:{main:dynamicLabel(state.options.labelFileRemoveError)(status),sub:state.options.labelTapToRetry}})}))):(options.revert&&item.origin!==FileOrigin.LOCAL&&null!==item.serverId&&item.revert(createRevertFunction(state.options.server.url,state.options.server.revert),query("GET_FORCE_REVERT")),removeFromView())})),ABORT_ITEM_LOAD:getItemByQueryFromState(state,(function(item){item.abortLoad()})),ABORT_ITEM_PROCESSING:getItemByQueryFromState(state,(function(item){item.serverId?dispatch("REVERT_ITEM_PROCESSING",{id:item.id}):item.abortProcessing().then((function(){var shouldRemove;state.options.instantUpload&&dispatch("REMOVE_ITEM",{query:item.id})}))})),REQUEST_REVERT_ITEM_PROCESSING:getItemByQueryFromState(state,(function(item){if(state.options.instantUpload){var handleRevert=function handleRevert(shouldRevert){shouldRevert&&dispatch("REVERT_ITEM_PROCESSING",{query:item})},fn=query("GET_BEFORE_REMOVE_FILE");if(!fn)return handleRevert(!0);var requestRemoveResult=fn(createItemAPI(item));return null==requestRemoveResult?handleRevert(!0):"boolean"==typeof requestRemoveResult?handleRevert(requestRemoveResult):void("function"==typeof requestRemoveResult.then&&requestRemoveResult.then(handleRevert))}dispatch("REVERT_ITEM_PROCESSING",{query:item})})),REVERT_ITEM_PROCESSING:getItemByQueryFromState(state,(function(item){item.revert(createRevertFunction(state.options.server.url,state.options.server.revert),query("GET_FORCE_REVERT")).then((function(){var shouldRemove;(state.options.instantUpload||isMockItem(item))&&dispatch("REMOVE_ITEM",{query:item.id})})).catch((function(){}))})),SET_OPTIONS:function SET_OPTIONS(_ref11){var options=_ref11.options;forin(options,(function(key,value){dispatch("SET_"+fromCamels(key,"_").toUpperCase(),{value:value})}))}}},formatFilename=function formatFilename(name){return name},createElement$1=function createElement(tagName){return document.createElement(tagName)},text=function text(node,value){var textNode=node.childNodes[0];textNode?value!==textNode.nodeValue&&(textNode.nodeValue=value):(textNode=document.createTextNode(value),node.appendChild(textNode))},polarToCartesian=function polarToCartesian(centerX,centerY,radius,angleInDegrees){var angleInRadians=(angleInDegrees%360-90)*Math.PI/180;return{x:centerX+radius*Math.cos(angleInRadians),y:centerY+radius*Math.sin(angleInRadians)}},describeArc=function describeArc(x,y,radius,startAngle,endAngle,arcSweep){var start=polarToCartesian(x,y,radius,endAngle),end=polarToCartesian(x,y,radius,startAngle);return["M",start.x,start.y,"A",radius,radius,0,arcSweep,0,end.x,end.y].join(" ")},percentageArc=function percentageArc(x,y,radius,from,to){var arcSweep=1;return to>from&&to-from<=.5&&(arcSweep=0),from>to&&from-to>=.5&&(arcSweep=0),describeArc(x,y,radius,360*Math.min(.9999,from),360*Math.min(.9999,to),arcSweep)},create,write,progressIndicator=createView({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function create(_ref){var root=_ref.root,props=_ref.props;props.spin=!1,props.progress=0,props.opacity=0;var svg=createElement("svg");root.ref.path=createElement("path",{"stroke-width":2,"stroke-linecap":"round"}),svg.appendChild(root.ref.path),root.ref.svg=svg,root.appendChild(svg)},write:function write(_ref2){var root=_ref2.root,props=_ref2.props;if(0!==props.opacity){props.align&&(root.element.dataset.align=props.align);var ringStrokeWidth=parseInt(attr(root.ref.path,"stroke-width"),10),size=.5*root.rect.element.width,ringFrom=0,ringTo=0;props.spin?(ringFrom=0,ringTo=.5):(ringFrom=0,ringTo=props.progress);var coordinates=percentageArc(size,size,size-ringStrokeWidth,ringFrom,ringTo);attr(root.ref.path,"d",coordinates),attr(root.ref.path,"stroke-opacity",props.spin||props.progress>0?1:0)}},mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),create$1,write$1,fileActionButton=createView({tag:"button",attributes:{type:"button"},ignoreRect:!0,ignoreRectUpdate:!0,name:"file-action-button",mixins:{apis:["label"],styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}},listeners:!0},create:function create(_ref){var root=_ref.root,props=_ref.props;root.element.innerHTML=(props.icon||"")+"<span>"+props.label+"</span>",props.isDisabled=!1},write:function write(_ref2){var root=_ref2.root,props=_ref2.props,isDisabled=props.isDisabled,shouldDisable=root.query("GET_DISABLED")||0===props.opacity;shouldDisable&&!isDisabled?(props.isDisabled=!0,attr(root.element,"disabled","disabled")):!shouldDisable&&isDisabled&&(props.isDisabled=!1,root.element.removeAttribute("disabled"))}}),toNaturalFileSize=function toNaturalFileSize(bytes){var decimalSeparator=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",base=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,KB=base,MB=base*base,GB=base*base*base;return(bytes=Math.round(Math.abs(bytes)))<KB?bytes+" bytes":bytes<MB?Math.floor(bytes/KB)+" KB":bytes<GB?removeDecimalsWhenZero(bytes/MB,1,decimalSeparator)+" MB":removeDecimalsWhenZero(bytes/GB,2,decimalSeparator)+" GB"},removeDecimalsWhenZero=function removeDecimalsWhenZero(value,decimalCount,separator){return value.toFixed(decimalCount).split(".").filter((function(part){return"0"!==part})).join(separator)},create$2=function create(_ref){var root=_ref.root,props=_ref.props,fileName=createElement$1("span");fileName.className="filepond--file-info-main",attr(fileName,"aria-hidden","true"),root.appendChild(fileName),root.ref.fileName=fileName;var fileSize=createElement$1("span");fileSize.className="filepond--file-info-sub",root.appendChild(fileSize),root.ref.fileSize=fileSize,text(fileSize,root.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),text(fileName,root.query("GET_ITEM_NAME",props.id))},updateFile=function updateFile(_ref2){var root=_ref2.root,props=_ref2.props;text(root.ref.fileSize,toNaturalFileSize(root.query("GET_ITEM_SIZE",props.id),".",root.query("GET_FILE_SIZE_BASE"))),text(root.ref.fileName,root.query("GET_ITEM_NAME",props.id))},updateFileSizeOnError=function updateFileSizeOnError(_ref3){var root=_ref3.root,props=_ref3.props;isInt(root.query("GET_ITEM_SIZE",props.id))||text(root.ref.fileSize,root.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},fileInfo=createView({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:createRoute({DID_LOAD_ITEM:updateFile,DID_UPDATE_ITEM_META:updateFile,DID_THROW_ITEM_LOAD_ERROR:updateFileSizeOnError,DID_THROW_ITEM_INVALID:updateFileSizeOnError}),didCreateView:function didCreateView(root){applyFilters("CREATE_VIEW",Object.assign({},root,{view:root}))},create:create$2,mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),toPercentage=function toPercentage(value){return Math.round(100*value)},create$3=function create(_ref){var root=_ref.root,main=createElement$1("span");main.className="filepond--file-status-main",root.appendChild(main),root.ref.main=main;var sub=createElement$1("span");sub.className="filepond--file-status-sub",root.appendChild(sub),root.ref.sub=sub,didSetItemLoadProgress({root:root,action:{progress:null}})},didSetItemLoadProgress=function didSetItemLoadProgress(_ref2){var root=_ref2.root,action=_ref2.action,title=null===action.progress?root.query("GET_LABEL_FILE_LOADING"):root.query("GET_LABEL_FILE_LOADING")+" "+toPercentage(action.progress)+"%";text(root.ref.main,title),text(root.ref.sub,root.query("GET_LABEL_TAP_TO_CANCEL"))},didSetItemProcessProgress,didRequestItemProcessing,didAbortItemProcessing,didCompleteItemProcessing,clear=function clear(_ref7){var root=_ref7.root;text(root.ref.main,""),text(root.ref.sub,"")},error=function error(_ref8){var root=_ref8.root,action=_ref8.action;text(root.ref.main,action.status.main),text(root.ref.sub,action.status.sub)},fileStatus=createView({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:createRoute({DID_LOAD_ITEM:clear,DID_REVERT_ITEM_PROCESSING:clear,DID_REQUEST_ITEM_PROCESSING:function didRequestItemProcessing(_ref4){var root=_ref4.root;text(root.ref.main,root.query("GET_LABEL_FILE_PROCESSING")),text(root.ref.sub,root.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:function didAbortItemProcessing(_ref5){var root=_ref5.root;text(root.ref.main,root.query("GET_LABEL_FILE_PROCESSING_ABORTED")),text(root.ref.sub,root.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:function didCompleteItemProcessing(_ref6){var root=_ref6.root;text(root.ref.main,root.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),text(root.ref.sub,root.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:function didSetItemProcessProgress(_ref3){var root=_ref3.root,action=_ref3.action,title=null===action.progress?root.query("GET_LABEL_FILE_PROCESSING"):root.query("GET_LABEL_FILE_PROCESSING")+" "+toPercentage(action.progress)+"%";text(root.ref.main,title),text(root.ref.sub,root.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:didSetItemLoadProgress,DID_THROW_ITEM_LOAD_ERROR:error,DID_THROW_ITEM_INVALID:error,DID_THROW_ITEM_PROCESSING_ERROR:error,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:error,DID_THROW_ITEM_REMOVE_ERROR:error}),didCreateView:function didCreateView(root){applyFilters("CREATE_VIEW",Object.assign({},root,{view:root}))},create:create$3,mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),Buttons={AbortItemLoad:{label:"GET_LABEL_BUTTON_ABORT_ITEM_LOAD",action:"ABORT_ITEM_LOAD",className:"filepond--action-abort-item-load",align:"LOAD_INDICATOR_POSITION"},RetryItemLoad:{label:"GET_LABEL_BUTTON_RETRY_ITEM_LOAD",action:"RETRY_ITEM_LOAD",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-load",align:"BUTTON_PROCESS_ITEM_POSITION"},RemoveItem:{label:"GET_LABEL_BUTTON_REMOVE_ITEM",action:"REQUEST_REMOVE_ITEM",icon:"GET_ICON_REMOVE",className:"filepond--action-remove-item",align:"BUTTON_REMOVE_ITEM_POSITION"},ProcessItem:{label:"GET_LABEL_BUTTON_PROCESS_ITEM",action:"REQUEST_ITEM_PROCESSING",icon:"GET_ICON_PROCESS",className:"filepond--action-process-item",align:"BUTTON_PROCESS_ITEM_POSITION"},AbortItemProcessing:{label:"GET_LABEL_BUTTON_ABORT_ITEM_PROCESSING",action:"ABORT_ITEM_PROCESSING",className:"filepond--action-abort-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RetryItemProcessing:{label:"GET_LABEL_BUTTON_RETRY_ITEM_PROCESSING",action:"RETRY_ITEM_PROCESSING",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RevertItemProcessing:{label:"GET_LABEL_BUTTON_UNDO_ITEM_PROCESSING",action:"REQUEST_REVERT_ITEM_PROCESSING",icon:"GET_ICON_UNDO",className:"filepond--action-revert-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"}},ButtonKeys=[];forin(Buttons,(function(key){ButtonKeys.push(key)}));var calculateFileInfoOffset=function calculateFileInfoOffset(root){var buttonRect=root.ref.buttonRemoveItem.rect.element;return buttonRect.hidden?null:buttonRect.width+buttonRect.left},calculateButtonWidth=function calculateButtonWidth(root){var buttonRect;return root.ref.buttonAbortItemLoad.rect.element.width},calculateFileVerticalCenterOffset=function calculateFileVerticalCenterOffset(root){return Math.floor(root.ref.buttonRemoveItem.rect.element.height/4)},calculateFileHorizontalCenterOffset=function calculateFileHorizontalCenterOffset(root){return Math.floor(root.ref.buttonRemoveItem.rect.element.left/2)},getLoadIndicatorAlignment,getProcessIndicatorAlignment,getRemoveIndicatorAligment=function getRemoveIndicatorAligment(root){return root.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION")},DefaultStyle={buttonAbortItemLoad:{opacity:0},buttonRetryItemLoad:{opacity:0},buttonRemoveItem:{opacity:0},buttonProcessItem:{opacity:0},buttonAbortItemProcessing:{opacity:0},buttonRetryItemProcessing:{opacity:0},buttonRevertItemProcessing:{opacity:0},loadProgressIndicator:{opacity:0,align:function getLoadIndicatorAlignment(root){return root.query("GET_STYLE_LOAD_INDICATOR_POSITION")}},processProgressIndicator:{opacity:0,align:function getProcessIndicatorAlignment(root){return root.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}},processingCompleteIndicator:{opacity:0,scaleX:.75,scaleY:.75},info:{translateX:0,translateY:0,opacity:0},status:{translateX:0,translateY:0,opacity:0}},IdleStyle={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:calculateFileInfoOffset},status:{translateX:calculateFileInfoOffset}},ProcessingStyle={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},StyleMap={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:calculateFileInfoOffset},status:{translateX:calculateFileInfoOffset,opacity:1}},DID_START_ITEM_LOAD:{buttonAbortItemLoad:{opacity:1},loadProgressIndicator:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_LOAD_ERROR:{buttonRetryItemLoad:{opacity:1},buttonRemoveItem:{opacity:1},info:{translateX:calculateFileInfoOffset},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:getRemoveIndicatorAligment},info:{translateX:calculateFileInfoOffset},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:getRemoveIndicatorAligment},buttonRemoveItem:{opacity:1},info:{translateX:calculateFileInfoOffset},status:{opacity:1,translateX:calculateFileInfoOffset}},DID_LOAD_ITEM:IdleStyle,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:calculateFileInfoOffset},status:{translateX:calculateFileInfoOffset}},DID_START_ITEM_PROCESSING:ProcessingStyle,DID_REQUEST_ITEM_PROCESSING:ProcessingStyle,DID_UPDATE_ITEM_PROCESS_PROGRESS:ProcessingStyle,DID_COMPLETE_ITEM_PROCESSING:{buttonRevertItemProcessing:{opacity:1},info:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_PROCESSING_ERROR:{buttonRemoveItem:{opacity:1},buttonRetryItemProcessing:{opacity:1},status:{opacity:1},info:{translateX:calculateFileInfoOffset}},DID_THROW_ITEM_PROCESSING_REVERT_ERROR:{buttonRevertItemProcessing:{opacity:1},status:{opacity:1},info:{opacity:1}},DID_ABORT_ITEM_PROCESSING:{buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:calculateFileInfoOffset},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:IdleStyle},processingCompleteIndicatorView=createView({create:function create(_ref){var root=_ref.root;root.element.innerHTML=root.query("GET_ICON_DONE")},name:"processing-complete-indicator",ignoreRect:!0,mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",opacity:{type:"tween",duration:250}}}}),create$4=function create(_ref2){var root=_ref2.root,props,id=_ref2.props.id,allowRevert=root.query("GET_ALLOW_REVERT"),allowRemove=root.query("GET_ALLOW_REMOVE"),allowProcess=root.query("GET_ALLOW_PROCESS"),instantUpload=root.query("GET_INSTANT_UPLOAD"),isAsync=root.query("IS_ASYNC"),alignRemoveItemButton=root.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN"),buttonFilter;isAsync?allowProcess&&!allowRevert?buttonFilter=function buttonFilter(key){return!/RevertItemProcessing/.test(key)}:!allowProcess&&allowRevert?buttonFilter=function buttonFilter(key){return!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(key)}:allowProcess||allowRevert||(buttonFilter=function buttonFilter(key){return!/Process/.test(key)}):buttonFilter=function buttonFilter(key){return!/Process/.test(key)};var enabledButtons=buttonFilter?ButtonKeys.filter(buttonFilter):ButtonKeys.concat();if(instantUpload&&allowRevert&&(Buttons.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",Buttons.RevertItemProcessing.icon="GET_ICON_REMOVE"),isAsync&&!allowRevert){var map=StyleMap.DID_COMPLETE_ITEM_PROCESSING;map.info.translateX=calculateFileHorizontalCenterOffset,map.info.translateY=calculateFileVerticalCenterOffset,map.status.translateY=calculateFileVerticalCenterOffset,map.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(isAsync&&!allowProcess&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach((function(key){StyleMap[key].status.translateY=calculateFileVerticalCenterOffset})),StyleMap.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=calculateButtonWidth),alignRemoveItemButton&&allowRevert){Buttons.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";var _map=StyleMap.DID_COMPLETE_ITEM_PROCESSING;_map.info.translateX=calculateFileInfoOffset,_map.status.translateY=calculateFileVerticalCenterOffset,_map.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}allowRemove||(Buttons.RemoveItem.disabled=!0),forin(Buttons,(function(key,definition){var buttonView=root.createChildView(fileActionButton,{label:root.query(definition.label),icon:root.query(definition.icon),opacity:0});enabledButtons.includes(key)&&root.appendChildView(buttonView),definition.disabled&&(buttonView.element.setAttribute("disabled","disabled"),buttonView.element.setAttribute("hidden","hidden")),buttonView.element.dataset.align=root.query("GET_STYLE_"+definition.align),buttonView.element.classList.add(definition.className),buttonView.on("click",(function(e){e.stopPropagation(),definition.disabled||root.dispatch(definition.action,{query:id})})),root.ref["button"+key]=buttonView})),root.ref.processingCompleteIndicator=root.appendChildView(root.createChildView(processingCompleteIndicatorView)),root.ref.processingCompleteIndicator.element.dataset.align=root.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),root.ref.info=root.appendChildView(root.createChildView(fileInfo,{id:id})),root.ref.status=root.appendChildView(root.createChildView(fileStatus,{id:id}));var loadIndicatorView=root.appendChildView(root.createChildView(progressIndicator,{opacity:0,align:root.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));loadIndicatorView.element.classList.add("filepond--load-indicator"),root.ref.loadProgressIndicator=loadIndicatorView;var progressIndicatorView=root.appendChildView(root.createChildView(progressIndicator,{opacity:0,align:root.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));progressIndicatorView.element.classList.add("filepond--process-indicator"),root.ref.processProgressIndicator=progressIndicatorView,root.ref.activeStyles=[]},write$2=function write(_ref3){var root=_ref3.root,actions=_ref3.actions,props=_ref3.props;route({root:root,actions:actions,props:props});var action=actions.concat().filter((function(action){return/^DID_/.test(action.type)})).reverse().find((function(action){return StyleMap[action.type]}));if(action){root.ref.activeStyles=[];var stylesToApply=StyleMap[action.type];forin(DefaultStyle,(function(name,defaultStyles){var control=root.ref[name];forin(defaultStyles,(function(key,defaultValue){var value=stylesToApply[name]&&void 0!==stylesToApply[name][key]?stylesToApply[name][key]:defaultValue;root.ref.activeStyles.push({control:control,key:key,value:value})}))}))}root.ref.activeStyles.forEach((function(_ref4){var control=_ref4.control,key=_ref4.key,value=_ref4.value;control[key]="function"==typeof value?value(root):value}))},route=createRoute({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:function DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING(_ref5){var root=_ref5.root,action=_ref5.action;root.ref.buttonAbortItemProcessing.label=action.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:function DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD(_ref6){var root=_ref6.root,action=_ref6.action;root.ref.buttonAbortItemLoad.label=action.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:function DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL(_ref7){var root=_ref7.root,action=_ref7.action;root.ref.buttonAbortItemRemoval.label=action.value},DID_REQUEST_ITEM_PROCESSING:function DID_REQUEST_ITEM_PROCESSING(_ref8){var root=_ref8.root;root.ref.processProgressIndicator.spin=!0,root.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:function DID_START_ITEM_LOAD(_ref9){var root=_ref9.root;root.ref.loadProgressIndicator.spin=!0,root.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:function DID_START_ITEM_REMOVE(_ref10){var root=_ref10.root;root.ref.processProgressIndicator.spin=!0,root.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:function DID_UPDATE_ITEM_LOAD_PROGRESS(_ref11){var root=_ref11.root,action=_ref11.action;root.ref.loadProgressIndicator.spin=!1,root.ref.loadProgressIndicator.progress=action.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:function DID_UPDATE_ITEM_PROCESS_PROGRESS(_ref12){var root=_ref12.root,action=_ref12.action;root.ref.processProgressIndicator.spin=!1,root.ref.processProgressIndicator.progress=action.progress}}),file=createView({create:create$4,write:write$2,didCreateView:function didCreateView(root){applyFilters("CREATE_VIEW",Object.assign({},root,{view:root}))},name:"file"}),create$5,didLoadItem,fileWrapper=createView({create:function create(_ref){var root=_ref.root,props=_ref.props;root.ref.fileName=createElement$1("legend"),root.appendChild(root.ref.fileName),root.ref.file=root.appendChildView(root.createChildView(file,{id:props.id})),root.ref.data=!1},ignoreRect:!0,write:createRoute({DID_LOAD_ITEM:function didLoadItem(_ref2){var root=_ref2.root,props=_ref2.props;text(root.ref.fileName,root.query("GET_ITEM_NAME",props.id))}}),didCreateView:function didCreateView(root){applyFilters("CREATE_VIEW",Object.assign({},root,{view:root}))},tag:"fieldset",name:"file-wrapper"}),PANEL_SPRING_PROPS={type:"spring",damping:.6,mass:7},create$6=function create(_ref){var root=_ref.root,props=_ref.props;[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:PANEL_SPRING_PROPS},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:PANEL_SPRING_PROPS},styles:["translateY"]}}].forEach((function(section){createSection(root,section,props.name)})),root.element.classList.add("filepond--"+props.name),root.ref.scalable=null},createSection=function createSection(root,section,className){var viewConstructor=createView({name:"panel-"+section.name+" filepond--"+className,mixins:section.mixins,ignoreRectUpdate:!0}),view=root.createChildView(viewConstructor,section.props);root.ref[section.name]=root.appendChildView(view)},write$3,panel=createView({name:"panel",read:function read(_ref3){var root=_ref3.root,props;return _ref3.props.heightCurrent=root.ref.bottom.translateY},write:function write(_ref2){var root=_ref2.root,props=_ref2.props;if(null!==root.ref.scalable&&props.scalable===root.ref.scalable||(root.ref.scalable=!isBoolean(props.scalable)||props.scalable,root.element.dataset.scalable=root.ref.scalable),props.height){var topRect=root.ref.top.rect.element,bottomRect=root.ref.bottom.rect.element,height=Math.max(topRect.height+bottomRect.height,props.height);root.ref.center.translateY=topRect.height,root.ref.center.scaleY=(height-topRect.height-bottomRect.height)/100,root.ref.bottom.translateY=height-bottomRect.height}},create:create$6,ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),createDragHelper=function createDragHelper(items){var itemIds=items.map((function(item){return item.id})),prevIndex=void 0;return{setIndex:function setIndex(index){prevIndex=index},getIndex:function getIndex(){return prevIndex},getItemIndex:function getItemIndex(item){return itemIds.indexOf(item.id)}}},ITEM_TRANSLATE_SPRING={type:"spring",stiffness:.75,damping:.45,mass:10},ITEM_SCALE_SPRING="spring",StateMap={DID_START_ITEM_LOAD:"busy",DID_UPDATE_ITEM_LOAD_PROGRESS:"loading",DID_THROW_ITEM_INVALID:"load-invalid",DID_THROW_ITEM_LOAD_ERROR:"load-error",DID_LOAD_ITEM:"idle",DID_THROW_ITEM_REMOVE_ERROR:"remove-error",DID_START_ITEM_REMOVE:"busy",DID_START_ITEM_PROCESSING:"busy processing",DID_REQUEST_ITEM_PROCESSING:"busy processing",DID_UPDATE_ITEM_PROCESS_PROGRESS:"processing",DID_COMPLETE_ITEM_PROCESSING:"processing-complete",DID_THROW_ITEM_PROCESSING_ERROR:"processing-error",DID_THROW_ITEM_PROCESSING_REVERT_ERROR:"processing-revert-error",DID_ABORT_ITEM_PROCESSING:"cancelled",DID_REVERT_ITEM_PROCESSING:"idle"},create$7=function create(_ref){var root=_ref.root,props=_ref.props;if(root.ref.handleClick=function(e){return root.dispatch("DID_ACTIVATE_ITEM",{id:props.id})},root.element.id="filepond--item-"+props.id,root.element.addEventListener("click",root.ref.handleClick),root.ref.container=root.appendChildView(root.createChildView(fileWrapper,{id:props.id})),root.ref.panel=root.appendChildView(root.createChildView(panel,{name:"item-panel"})),root.ref.panel.height=null,props.markedForRemoval=!1,root.query("GET_ALLOW_REORDER")){root.element.dataset.dragState="idle";var grab=function grab(e){if(e.isPrimary){var removedActivateListener=!1,origin_x=e.pageX,origin_y=e.pageY;props.dragOrigin={x:root.translateX,y:root.translateY},props.dragCenter={x:e.offsetX,y:e.offsetY};var dragState=createDragHelper(root.query("GET_ACTIVE_ITEMS"));root.dispatch("DID_GRAB_ITEM",{id:props.id,dragState:dragState});var drag=function drag(e){var dist;e.isPrimary&&(e.stopPropagation(),e.preventDefault(),props.dragOffset={x:e.pageX-origin_x,y:e.pageY-origin_y},props.dragOffset.x*props.dragOffset.x+props.dragOffset.y*props.dragOffset.y>16&&!removedActivateListener&&(removedActivateListener=!0,root.element.removeEventListener("click",root.ref.handleClick)),root.dispatch("DID_DRAG_ITEM",{id:props.id,dragState:dragState}))},drop=function drop(e){e.isPrimary&&(document.removeEventListener("pointermove",drag),document.removeEventListener("pointerup",drop),props.dragOffset={x:e.pageX-origin_x,y:e.pageY-origin_y},root.dispatch("DID_DROP_ITEM",{id:props.id,dragState:dragState}),removedActivateListener&&setTimeout((function(){return root.element.addEventListener("click",root.ref.handleClick)}),0))};document.addEventListener("pointermove",drag),document.addEventListener("pointerup",drop)}};root.element.addEventListener("pointerdown",grab)}},route$1=createRoute({DID_UPDATE_PANEL_HEIGHT:function DID_UPDATE_PANEL_HEIGHT(_ref2){var root=_ref2.root,action=_ref2.action;root.height=action.height}}),write$4=createRoute({DID_GRAB_ITEM:function DID_GRAB_ITEM(_ref3){var root=_ref3.root,props;_ref3.props.dragOrigin={x:root.translateX,y:root.translateY}},DID_DRAG_ITEM:function DID_DRAG_ITEM(_ref4){var root;_ref4.root.element.dataset.dragState="drag"},DID_DROP_ITEM:function DID_DROP_ITEM(_ref5){var root=_ref5.root,props=_ref5.props;props.dragOffset=null,props.dragOrigin=null,root.element.dataset.dragState="drop"}},(function(_ref6){var root=_ref6.root,actions=_ref6.actions,props=_ref6.props,shouldOptimize=_ref6.shouldOptimize;"drop"===root.element.dataset.dragState&&root.scaleX<=1&&(root.element.dataset.dragState="idle");var action=actions.concat().filter((function(action){return/^DID_/.test(action.type)})).reverse().find((function(action){return StateMap[action.type]}));action&&action.type!==props.currentState&&(props.currentState=action.type,root.element.dataset.filepondItemState=StateMap[props.currentState]||"");var aspectRatio=root.query("GET_ITEM_PANEL_ASPECT_RATIO")||root.query("GET_PANEL_ASPECT_RATIO");aspectRatio?shouldOptimize||(root.height=root.rect.element.width*aspectRatio):(route$1({root:root,actions:actions,props:props}),!root.height&&root.ref.container.rect.element.height>0&&(root.height=root.ref.container.rect.element.height)),shouldOptimize&&(root.ref.panel.height=null),root.ref.panel.height=root.height})),item=createView({create:create$7,write:write$4,destroy:function destroy(_ref7){var root=_ref7.root,props=_ref7.props;root.element.removeEventListener("click",root.ref.handleClick),root.dispatch("RELEASE_ITEM",{query:props.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:"spring",scaleY:"spring",translateX:ITEM_TRANSLATE_SPRING,translateY:ITEM_TRANSLATE_SPRING,opacity:{type:"tween",duration:150}}}}),getItemIndexByPosition=function getItemIndexByPosition(view,children,positionInView){if(positionInView){var horizontalSpace=view.rect.element.width,l=children.length,last=null;if(0===l||positionInView.top<children[0].rect.element.top)return-1;var item,itemRect=children[0].rect.element,itemHorizontalMargin=itemRect.marginLeft+itemRect.marginRight,itemWidth=itemRect.width+itemHorizontalMargin,itemsPerRow=Math.round(horizontalSpace/itemWidth);if(1===itemsPerRow){for(var index=0;index<l;index++){var child=children[index],childMid=child.rect.outer.top+.5*child.rect.element.height;if(positionInView.top<childMid)return index}return l}for(var itemVerticalMargin=itemRect.marginTop+itemRect.marginBottom,itemHeight=itemRect.height+itemVerticalMargin,_index=0;_index<l;_index++){var indexX,indexY,offsetX=_index%itemsPerRow*itemWidth,offsetY=Math.floor(_index/itemsPerRow)*itemHeight,itemTop=offsetY-itemRect.marginTop,itemRight=offsetX+itemWidth,itemBottom=offsetY+itemHeight+itemRect.marginBottom;if(positionInView.top<itemBottom&&positionInView.top>itemTop){if(positionInView.left<itemRight)return _index;last=_index!==l-1?_index:null}}return null!==last?last:l}},dropAreaDimensions={height:0,width:0,get getHeight(){return this.height},set setHeight(val){0!==this.height&&0!==val||(this.height=val)},get getWidth(){return this.width},set setWidth(val){0!==this.width&&0!==val||(this.width=val)},setDimensions:function setDimensions(height,width){0!==this.height&&0!==height||(this.height=height),0!==this.width&&0!==width||(this.width=width)}},create$8=function create(_ref){var root=_ref.root;attr(root.element,"role","list"),root.ref.lastItemSpanwDate=Date.now()},addItemView,moveItem=function moveItem(item,x,y){var vx=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,vy=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;item.dragOffset?(item.translateX=null,item.translateY=null,item.translateX=item.dragOrigin.x+item.dragOffset.x,item.translateY=item.dragOrigin.y+item.dragOffset.y,item.scaleX=1.025,item.scaleY=1.025):(item.translateX=x,item.translateY=y,Date.now()>item.spawnDate&&(0===item.opacity&&introItemView(item,x,y,vx,vy),item.scaleX=1,item.scaleY=1,item.opacity=1))},introItemView=function introItemView(item,x,y,vx,vy){item.interactionMethod===InteractionMethod_NONE?(item.translateX=null,item.translateX=x,item.translateY=null,item.translateY=y):item.interactionMethod===InteractionMethod_DROP?(item.translateX=null,item.translateX=x-20*vx,item.translateY=null,item.translateY=y-10*vy,item.scaleX=.8,item.scaleY=.8):item.interactionMethod===InteractionMethod_BROWSE?(item.translateY=null,item.translateY=y-30):item.interactionMethod===InteractionMethod_API&&(item.translateX=null,item.translateX=x-30,item.translateY=null)},removeItemView,getItemHeight=function getItemHeight(child){return child.rect.element.height+.5*child.rect.element.marginBottom+.5*child.rect.element.marginTop},getItemWidth=function getItemWidth(child){return child.rect.element.width+.5*child.rect.element.marginLeft+.5*child.rect.element.marginRight},dragItem,route$2=createRoute({DID_ADD_ITEM:function addItemView(_ref2){var root=_ref2.root,action=_ref2.action,id=action.id,index=action.index,interactionMethod=action.interactionMethod;root.ref.addIndex=index;var now=Date.now(),spawnDate=now,opacity=1;if(interactionMethod!==InteractionMethod_NONE){opacity=0;var cooldown=root.query("GET_ITEM_INSERT_INTERVAL"),dist=now-root.ref.lastItemSpanwDate;spawnDate=dist<cooldown?now+(cooldown-dist):now}root.ref.lastItemSpanwDate=spawnDate,root.appendChildView(root.createChildView(item,{spawnDate:spawnDate,id:id,opacity:opacity,interactionMethod:interactionMethod}),index)},DID_REMOVE_ITEM:function removeItemView(_ref3){var root=_ref3.root,action,id=_ref3.action.id,view=root.childViews.find((function(child){return child.id===id}));view&&(view.scaleX=.9,view.scaleY=.9,view.opacity=0,view.markedForRemoval=!0)},DID_DRAG_ITEM:function dragItem(_ref4){var root=_ref4.root,action=_ref4.action,id=action.id,dragState=action.dragState,item=root.query("GET_ITEM",{id:id}),view=root.childViews.find((function(child){return child.id===id})),numItems=root.childViews.length,oldIndex=dragState.getItemIndex(item);if(view){var dragPosition_x=view.dragOrigin.x+view.dragOffset.x+view.dragCenter.x,dragPosition_y=view.dragOrigin.y+view.dragOffset.y+view.dragCenter.y,dragHeight=getItemHeight(view),dragWidth=getItemWidth(view),cols=Math.floor(root.rect.outer.width/dragWidth);cols>numItems&&(cols=numItems);var rows=Math.floor(numItems/cols+1);dropAreaDimensions.setHeight=dragHeight*rows,dropAreaDimensions.setWidth=dragWidth*cols;var location={y:Math.floor(dragPosition_y/dragHeight),x:Math.floor(dragPosition_x/dragWidth),getGridIndex:function getGridIndex(){return dragPosition_y>dropAreaDimensions.getHeight||dragPosition_y<0||dragPosition_x>dropAreaDimensions.getWidth||dragPosition_x<0?oldIndex:this.y*cols+this.x},getColIndex:function getColIndex(){for(var items=root.query("GET_ACTIVE_ITEMS"),visibleChildren=root.childViews.filter((function(child){return child.rect.element.height})),children=items.map((function(item){return visibleChildren.find((function(childView){return childView.id===item.id}))})),currentIndex=children.findIndex((function(child){return child===view})),dragHeight=getItemHeight(view),l=children.length,idx=l,childHeight=0,childBottom=0,childTop=0,i=0;i<l;i++)if(childHeight=getItemHeight(children[i]),dragPosition_y<(childBottom=(childTop=childBottom)+childHeight)){if(currentIndex>i){if(dragPosition_y<childTop+dragHeight){idx=i;break}continue}idx=i;break}return idx}},index=cols>1?location.getGridIndex():location.getColIndex();root.dispatch("MOVE_ITEM",{query:view,index:index});var currentIndex=dragState.getIndex();if(void 0===currentIndex||currentIndex!==index){if(dragState.setIndex(index),void 0===currentIndex)return;root.dispatch("DID_REORDER_ITEMS",{items:root.query("GET_ACTIVE_ITEMS"),origin:oldIndex,target:index})}}}}),write$5,filterSetItemActions,list=createView({create:create$8,write:function write(_ref5){var root=_ref5.root,props=_ref5.props,actions=_ref5.actions,shouldOptimize=_ref5.shouldOptimize;route$2({root:root,props:props,actions:actions});var dragCoordinates=props.dragCoordinates,horizontalSpace=root.rect.element.width,visibleChildren=root.childViews.filter((function(child){return child.rect.element.height})),children=root.query("GET_ACTIVE_ITEMS").map((function(item){return visibleChildren.find((function(child){return child.id===item.id}))})).filter((function(item){return item})),dragIndex=dragCoordinates?getItemIndexByPosition(root,children,dragCoordinates):null,addIndex=root.ref.addIndex||null;root.ref.addIndex=null;var dragIndexOffset=0,removeIndexOffset=0,addIndexOffset=0;if(0!==children.length){var childRect=children[0].rect.element,itemVerticalMargin=childRect.marginTop+childRect.marginBottom,itemHorizontalMargin=childRect.marginLeft+childRect.marginRight,itemWidth=childRect.width+itemHorizontalMargin,itemHeight=childRect.height+itemVerticalMargin,itemsPerRow=Math.round(horizontalSpace/itemWidth);if(1===itemsPerRow){var offsetY=0,dragOffset=0;children.forEach((function(child,index){if(dragIndex){var dist=index-dragIndex;dragOffset=-2===dist?.25*-itemVerticalMargin:-1===dist?.75*-itemVerticalMargin:0===dist?.75*itemVerticalMargin:1===dist?.25*itemVerticalMargin:0}shouldOptimize&&(child.translateX=null,child.translateY=null),child.markedForRemoval||moveItem(child,0,offsetY+dragOffset);var itemHeight,visualHeight=(child.rect.element.height+itemVerticalMargin)*(child.markedForRemoval?child.opacity:1);offsetY+=visualHeight}))}else{var prevX=0,prevY=0;children.forEach((function(child,index){index===dragIndex&&(dragIndexOffset=1),index===addIndex&&(addIndexOffset+=1),child.markedForRemoval&&child.opacity<.5&&(removeIndexOffset-=1);var visualIndex=index+addIndexOffset+dragIndexOffset+removeIndexOffset,indexX=visualIndex%itemsPerRow,indexY=Math.floor(visualIndex/itemsPerRow),offsetX=indexX*itemWidth,offsetY=indexY*itemHeight,vectorX=Math.sign(offsetX-prevX),vectorY=Math.sign(offsetY-prevY);prevX=offsetX,prevY=offsetY,child.markedForRemoval||(shouldOptimize&&(child.translateX=null,child.translateY=null),moveItem(child,offsetX,offsetY,vectorX,vectorY))}))}}},tag:"ul",name:"list",didWriteView:function didWriteView(_ref6){var root=_ref6.root;root.childViews.filter((function(view){return view.markedForRemoval&&0===view.opacity&&view.resting})).forEach((function(view){view._destroy(),root.removeChildView(view)}))},filterFrameActionsForChild:function filterSetItemActions(child,actions){return actions.filter((function(action){return!action.data||!action.data.id||child.id===action.data.id}))},mixins:{apis:["dragCoordinates"]}}),create$9=function create(_ref){var root=_ref.root,props=_ref.props;root.ref.list=root.appendChildView(root.createChildView(list)),props.dragCoordinates=null,props.overflowing=!1},storeDragCoordinates,clearDragCoordinates,route$3=createRoute({DID_DRAG:function storeDragCoordinates(_ref2){var root=_ref2.root,props=_ref2.props,action=_ref2.action;root.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(props.dragCoordinates={left:action.position.scopeLeft-root.ref.list.rect.element.left,top:action.position.scopeTop-(root.rect.outer.top+root.rect.element.marginTop+root.rect.element.scrollTop)})},DID_END_DRAG:function clearDragCoordinates(_ref3){var props;_ref3.props.dragCoordinates=null}}),write$6,listScroller=createView({create:create$9,write:function write(_ref4){var root=_ref4.root,props=_ref4.props,actions=_ref4.actions;if(route$3({root:root,props:props,actions:actions}),root.ref.list.dragCoordinates=props.dragCoordinates,props.overflowing&&!props.overflow&&(props.overflowing=!1,root.element.dataset.state="",root.height=null),props.overflow){var newHeight=Math.round(props.overflow);newHeight!==root.height&&(props.overflowing=!0,root.element.dataset.state="overflow",root.height=newHeight)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),attrToggle=function attrToggle(element,name,state){var enabledValue=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";state?attr(element,name,enabledValue):element.removeAttribute(name)},resetFileInput=function resetFileInput(input){if(input&&""!==input.value){try{input.value=""}catch(err){}if(input.value){var form=createElement$1("form"),parentNode=input.parentNode,ref=input.nextSibling;form.appendChild(input),form.reset(),ref?parentNode.insertBefore(input,ref):parentNode.appendChild(input)}}},create$a=function create(_ref){var root=_ref.root,props=_ref.props;root.element.id="filepond--browser-"+props.id,attr(root.element,"name",root.query("GET_NAME")),attr(root.element,"aria-controls","filepond--assistant-"+props.id),attr(root.element,"aria-labelledby","filepond--drop-label-"+props.id),setAcceptedFileTypes({root:root,action:{value:root.query("GET_ACCEPTED_FILE_TYPES")}}),toggleAllowMultiple({root:root,action:{value:root.query("GET_ALLOW_MULTIPLE")}}),toggleDirectoryFilter({root:root,action:{value:root.query("GET_ALLOW_DIRECTORIES_ONLY")}}),toggleDisabled({root:root}),toggleRequired({root:root,action:{value:root.query("GET_REQUIRED")}}),setCaptureMethod({root:root,action:{value:root.query("GET_CAPTURE_METHOD")}}),root.ref.handleChange=function(e){if(root.element.value){var files=Array.from(root.element.files).map((function(file){return file._relativePath=file.webkitRelativePath,file}));setTimeout((function(){props.onload(files),resetFileInput(root.element)}),250)}},root.element.addEventListener("change",root.ref.handleChange)},setAcceptedFileTypes=function setAcceptedFileTypes(_ref2){var root=_ref2.root,action=_ref2.action;root.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&attrToggle(root.element,"accept",!!action.value,action.value?action.value.join(","):"")},toggleAllowMultiple=function toggleAllowMultiple(_ref3){var root=_ref3.root,action=_ref3.action;attrToggle(root.element,"multiple",action.value)},toggleDirectoryFilter=function toggleDirectoryFilter(_ref4){var root=_ref4.root,action=_ref4.action;attrToggle(root.element,"webkitdirectory",action.value)},toggleDisabled=function toggleDisabled(_ref5){var root=_ref5.root,isDisabled=root.query("GET_DISABLED"),doesAllowBrowse=root.query("GET_ALLOW_BROWSE"),disableField=isDisabled||!doesAllowBrowse;attrToggle(root.element,"disabled",disableField)},toggleRequired=function toggleRequired(_ref6){var root=_ref6.root,action;_ref6.action.value?0===root.query("GET_TOTAL_ITEMS")&&attrToggle(root.element,"required",!0):attrToggle(root.element,"required",!1)},setCaptureMethod=function setCaptureMethod(_ref7){var root=_ref7.root,action=_ref7.action;attrToggle(root.element,"capture",!!action.value,!0===action.value?"":action.value)},updateRequiredStatus=function updateRequiredStatus(_ref8){var root=_ref8.root,element=root.element,shouldCheckValidity;root.query("GET_TOTAL_ITEMS")>0?(attrToggle(element,"required",!1),attrToggle(element,"name",!1)):(attrToggle(element,"name",!0,root.query("GET_NAME")),root.query("GET_CHECK_VALIDITY")&&element.setCustomValidity(""),root.query("GET_REQUIRED")&&attrToggle(element,"required",!0))},updateFieldValidityStatus,browser=createView({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:create$a,destroy:function destroy(_ref10){var root=_ref10.root;root.element.removeEventListener("change",root.ref.handleChange)},write:createRoute({DID_LOAD_ITEM:updateRequiredStatus,DID_REMOVE_ITEM:updateRequiredStatus,DID_THROW_ITEM_INVALID:function updateFieldValidityStatus(_ref9){var root=_ref9.root,shouldCheckValidity;root.query("GET_CHECK_VALIDITY")&&root.element.setCustomValidity(root.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:toggleDisabled,DID_SET_ALLOW_BROWSE:toggleDisabled,DID_SET_ALLOW_DIRECTORIES_ONLY:toggleDirectoryFilter,DID_SET_ALLOW_MULTIPLE:toggleAllowMultiple,DID_SET_ACCEPTED_FILE_TYPES:setAcceptedFileTypes,DID_SET_CAPTURE_METHOD:setCaptureMethod,DID_SET_REQUIRED:toggleRequired})}),Key_ENTER=13,Key_SPACE=32,create$b=function create(_ref){var root=_ref.root,props=_ref.props,label=createElement$1("label");attr(label,"for","filepond--browser-"+props.id),attr(label,"id","filepond--drop-label-"+props.id),attr(label,"aria-hidden","true"),root.ref.handleKeyDown=function(e){var isActivationKey;(e.keyCode===Key_ENTER||e.keyCode===Key_SPACE)&&(e.preventDefault(),root.ref.label.click())},root.ref.handleClick=function(e){var isLabelClick;e.target===label||label.contains(e.target)||root.ref.label.click()},label.addEventListener("keydown",root.ref.handleKeyDown),root.element.addEventListener("click",root.ref.handleClick),updateLabelValue(label,props.caption),root.appendChild(label),root.ref.label=label},updateLabelValue=function updateLabelValue(label,value){label.innerHTML=value;var clickable=label.querySelector(".filepond--label-action");return clickable&&attr(clickable,"tabindex","0"),value},dropLabel=createView({name:"drop-label",ignoreRect:!0,create:create$b,destroy:function destroy(_ref2){var root=_ref2.root;root.ref.label.addEventListener("keydown",root.ref.handleKeyDown),root.element.removeEventListener("click",root.ref.handleClick)},write:createRoute({DID_SET_LABEL_IDLE:function DID_SET_LABEL_IDLE(_ref3){var root=_ref3.root,action=_ref3.action;updateLabelValue(root.ref.label,action.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),blob=createView({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),addBlob=function addBlob(_ref){var root=_ref.root,centerX=.5*root.rect.element.width,centerY=.5*root.rect.element.height;root.ref.blob=root.appendChildView(root.createChildView(blob,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:centerX,translateY:centerY}))},moveBlob,hideBlob,explodeBlob,write$7=function write(_ref5){var root=_ref5.root,props=_ref5.props,actions=_ref5.actions;route$4({root:root,props:props,actions:actions});var blob=root.ref.blob;0===actions.length&&blob&&0===blob.opacity&&(root.removeChildView(blob),root.ref.blob=null)},route$4=createRoute({DID_DRAG:function moveBlob(_ref2){var root=_ref2.root,action=_ref2.action;root.ref.blob?(root.ref.blob.translateX=action.position.scopeLeft,root.ref.blob.translateY=action.position.scopeTop,root.ref.blob.scaleX=1,root.ref.blob.scaleY=1,root.ref.blob.opacity=1):addBlob({root:root})},DID_DROP:function explodeBlob(_ref4){var root=_ref4.root;root.ref.blob&&(root.ref.blob.scaleX=2.5,root.ref.blob.scaleY=2.5,root.ref.blob.opacity=0)},DID_END_DRAG:function hideBlob(_ref3){var root=_ref3.root;root.ref.blob&&(root.ref.blob.opacity=0)}}),drip=createView({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:write$7}),create$c=function create(_ref){var root;return _ref.root.ref.fields={}},getField=function getField(root,id){return root.ref.fields[id]},syncFieldPositionsWithItems=function syncFieldPositionsWithItems(root){root.query("GET_ACTIVE_ITEMS").forEach((function(item){root.ref.fields[item.id]&&root.element.appendChild(root.ref.fields[item.id])}))},didReorderItems=function didReorderItems(_ref2){var root=_ref2.root;return syncFieldPositionsWithItems(root)},didAddItem,didLoadItem$1,didSetDisabled,didRemoveItem,didDefineValue,write$8=createRoute({DID_SET_DISABLED:function didSetDisabled(_ref5){var root=_ref5.root;root.element.disabled=root.query("GET_DISABLED")},DID_ADD_ITEM:function didAddItem(_ref3){var root=_ref3.root,action=_ref3.action,dataContainer=createElement$1("input");dataContainer.type="hidden",dataContainer.name=root.query("GET_NAME"),dataContainer.disabled=root.query("GET_DISABLED"),root.ref.fields[action.id]=dataContainer,syncFieldPositionsWithItems(root)},DID_LOAD_ITEM:function didLoadItem(_ref4){var root=_ref4.root,action=_ref4.action,field=getField(root,action.id);field&&null!==action.serverFileReference&&(field.value=action.serverFileReference)},DID_REMOVE_ITEM:function didRemoveItem(_ref6){var root=_ref6.root,action=_ref6.action,field=getField(root,action.id);field&&(field.parentNode&&field.parentNode.removeChild(field),delete root.ref.fields[action.id])},DID_DEFINE_VALUE:function didDefineValue(_ref7){var root=_ref7.root,action=_ref7.action,field=getField(root,action.id);field&&(null===action.value?field.removeAttribute("value"):field.value=action.value,syncFieldPositionsWithItems(root))},DID_REORDER_ITEMS:didReorderItems,DID_SORT_ITEMS:didReorderItems}),data=createView({tag:"fieldset",name:"data",create:create$c,write:write$8,ignoreRect:!0}),getRootNode=function getRootNode(element){return"getRootNode"in element?element.getRootNode():document},images=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],text$1=["css","csv","html","txt"],map={zip:"zip|compressed",epub:"application/epub+zip"},guesstimateMimeType=function guesstimateMimeType(){var extension=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return extension=extension.toLowerCase(),images.includes(extension)?"image/"+("jpg"===extension?"jpeg":"svg"===extension?"svg+xml":extension):text$1.includes(extension)?"text/"+extension:map[extension]||""},requestDataTransferItems=function requestDataTransferItems(dataTransfer){return new Promise((function(resolve,reject){var links=getLinks(dataTransfer);if(links.length&&!hasFiles(dataTransfer))return resolve(links);getFiles(dataTransfer).then(resolve)}))},hasFiles=function hasFiles(dataTransfer){return!!dataTransfer.files&&dataTransfer.files.length>0},getFiles=function getFiles(dataTransfer){return new Promise((function(resolve,reject){var promisedFiles=(dataTransfer.items?Array.from(dataTransfer.items):[]).filter((function(item){return isFileSystemItem(item)})).map((function(item){return getFilesFromItem(item)}));promisedFiles.length?Promise.all(promisedFiles).then((function(returnedFileGroups){var files=[];returnedFileGroups.forEach((function(group){files.push.apply(files,group)})),resolve(files.filter((function(file){return file})).map((function(file){return file._relativePath||(file._relativePath=file.webkitRelativePath),file})))})).catch(console.error):resolve(dataTransfer.files?Array.from(dataTransfer.files):[])}))},isFileSystemItem=function isFileSystemItem(item){if(isEntry(item)){var entry=getAsEntry(item);if(entry)return entry.isFile||entry.isDirectory}return"file"===item.kind},getFilesFromItem=function getFilesFromItem(item){return new Promise((function(resolve,reject){isDirectoryEntry(item)?getFilesInDirectory(getAsEntry(item)).then(resolve).catch(reject):resolve([item.getAsFile()])}))},getFilesInDirectory=function getFilesInDirectory(entry){return new Promise((function(resolve,reject){var files=[],dirCounter=0,fileCounter=0,resolveIfDone=function resolveIfDone(){0===fileCounter&&0===dirCounter&&resolve(files)},readEntries;(function readEntries(dirEntry){dirCounter++;var directoryReader=dirEntry.createReader(),readBatch;(function readBatch(){directoryReader.readEntries((function(entries){if(0===entries.length)return dirCounter--,void resolveIfDone();entries.forEach((function(entry){entry.isDirectory?readEntries(entry):(fileCounter++,entry.file((function(file){var correctedFile=correctMissingFileType(file);entry.fullPath&&(correctedFile._relativePath=entry.fullPath),files.push(correctedFile),fileCounter--,resolveIfDone()})))})),readBatch()}),reject)})()})(entry)}))},correctMissingFileType=function correctMissingFileType(file){if(file.type.length)return file;var date=file.lastModifiedDate,name=file.name,type=guesstimateMimeType(getExtensionFromFilename(file.name));return type.length?((file=file.slice(0,file.size,type)).name=name,file.lastModifiedDate=date,file):file},isDirectoryEntry=function isDirectoryEntry(item){return isEntry(item)&&(getAsEntry(item)||{}).isDirectory},isEntry=function isEntry(item){return"webkitGetAsEntry"in item},getAsEntry=function getAsEntry(item){return item.webkitGetAsEntry()},getLinks=function getLinks(dataTransfer){var links=[];try{if((links=getLinksFromTransferMetaData(dataTransfer)).length)return links;links=getLinksFromTransferURLData(dataTransfer)}catch(e){}return links},getLinksFromTransferURLData=function getLinksFromTransferURLData(dataTransfer){var data=dataTransfer.getData("url");return"string"==typeof data&&data.length?[data]:[]},getLinksFromTransferMetaData=function getLinksFromTransferMetaData(dataTransfer){var data=dataTransfer.getData("text/html");if("string"==typeof data&&data.length){var matches=data.match(/src\s*=\s*"(.+?)"/);if(matches)return[matches[1]]}return[]},dragNDropObservers=[],eventPosition=function eventPosition(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},createDragNDropClient=function createDragNDropClient(element,scopeToObserve,filterElement){var observer=getDragNDropObserver(scopeToObserve),client={element:element,filterElement:filterElement,state:null,ondrop:function ondrop(){},onenter:function onenter(){},ondrag:function ondrag(){},onexit:function onexit(){},onload:function onload(){},allowdrop:function allowdrop(){}};return client.destroy=observer.addListener(client),client},getDragNDropObserver=function getDragNDropObserver(element){var observer=dragNDropObservers.find((function(item){return item.element===element}));if(observer)return observer;var newObserver=createDragNDropObserver(element);return dragNDropObservers.push(newObserver),newObserver},createDragNDropObserver=function createDragNDropObserver(element){var clients=[],routes={dragenter:dragenter,dragover:dragover,dragleave:dragleave,drop:drop},handlers={};forin(routes,(function(event,createHandler){handlers[event]=createHandler(element,clients),element.addEventListener(event,handlers[event],!1)}));var observer={element:element,addListener:function addListener(client){return clients.push(client),function(){clients.splice(clients.indexOf(client),1),0===clients.length&&(dragNDropObservers.splice(dragNDropObservers.indexOf(observer),1),forin(routes,(function(event){element.removeEventListener(event,handlers[event],!1)})))}}};return observer},elementFromPoint=function elementFromPoint(root,point){return"elementFromPoint"in root||(root=document),root.elementFromPoint(point.x,point.y)},isEventTarget=function isEventTarget(e,target){var root=getRootNode(target),elementAtPosition=elementFromPoint(root,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return elementAtPosition===target||target.contains(elementAtPosition)},initialTarget=null,setDropEffect=function setDropEffect(dataTransfer,effect){try{dataTransfer.dropEffect=effect}catch(e){}},dragenter=function dragenter(root,clients){return function(e){e.preventDefault(),initialTarget=e.target,clients.forEach((function(client){var element=client.element,onenter=client.onenter;isEventTarget(e,element)&&(client.state="enter",onenter(eventPosition(e)))}))}},dragover=function dragover(root,clients){return function(e){e.preventDefault();var dataTransfer=e.dataTransfer;requestDataTransferItems(dataTransfer).then((function(items){var overDropTarget=!1;clients.some((function(client){var filterElement=client.filterElement,element=client.element,onenter=client.onenter,onexit=client.onexit,ondrag=client.ondrag,allowdrop=client.allowdrop;setDropEffect(dataTransfer,"copy");var allowsTransfer=allowdrop(items);if(allowsTransfer)if(isEventTarget(e,element)){if(overDropTarget=!0,null===client.state)return client.state="enter",void onenter(eventPosition(e));if(client.state="over",filterElement&&!allowsTransfer)return void setDropEffect(dataTransfer,"none");ondrag(eventPosition(e))}else filterElement&&!overDropTarget&&setDropEffect(dataTransfer,"none"),client.state&&(client.state=null,onexit(eventPosition(e)));else setDropEffect(dataTransfer,"none")}))}))}},drop=function drop(root,clients){return function(e){e.preventDefault();var dataTransfer=e.dataTransfer;requestDataTransferItems(dataTransfer).then((function(items){clients.forEach((function(client){var filterElement=client.filterElement,element=client.element,ondrop=client.ondrop,onexit=client.onexit,allowdrop=client.allowdrop;if(client.state=null,!filterElement||isEventTarget(e,element))return allowdrop(items)?void ondrop(eventPosition(e),items):onexit(eventPosition(e))}))}))}},dragleave=function dragleave(root,clients){return function(e){initialTarget===e.target&&clients.forEach((function(client){var onexit=client.onexit;client.state=null,onexit(eventPosition(e))}))}},createHopper=function createHopper(scope,validateItems,options){scope.classList.add("filepond--hopper");var catchesDropsOnPage=options.catchesDropsOnPage,requiresDropOnElement=options.requiresDropOnElement,_options$filterItems=options.filterItems,filterItems=void 0===_options$filterItems?function(items){return items}:_options$filterItems,client=createDragNDropClient(scope,catchesDropsOnPage?document.documentElement:scope,requiresDropOnElement),lastState="",currentState="";client.allowdrop=function(items){return validateItems(filterItems(items))},client.ondrop=function(position,items){var filteredItems=filterItems(items);validateItems(filteredItems)?(currentState="drag-drop",api.onload(filteredItems,position)):api.ondragend(position)},client.ondrag=function(position){api.ondrag(position)},client.onenter=function(position){currentState="drag-over",api.ondragstart(position)},client.onexit=function(position){currentState="drag-exit",api.ondragend(position)};var api={updateHopperState:function updateHopperState(){lastState!==currentState&&(scope.dataset.hopperState=currentState,lastState=currentState)},onload:function onload(){},ondragstart:function ondragstart(){},ondrag:function ondrag(){},ondragend:function ondragend(){},destroy:function destroy(){client.destroy()}};return api},listening=!1,listeners$1=[],handlePaste=function handlePaste(e){var activeEl=document.activeElement;if(activeEl&&/textarea|input/i.test(activeEl.nodeName)){for(var inScope=!1,element=activeEl;element!==document.body;){if(element.classList.contains("filepond--root")){inScope=!0;break}element=element.parentNode}if(!inScope)return}requestDataTransferItems(e.clipboardData).then((function(files){files.length&&listeners$1.forEach((function(listener){return listener(files)}))}))},listen=function listen(cb){listeners$1.includes(cb)||(listeners$1.push(cb),listening||(listening=!0,document.addEventListener("paste",handlePaste)))},unlisten=function unlisten(listener){arrayRemove(listeners$1,listeners$1.indexOf(listener)),0===listeners$1.length&&(document.removeEventListener("paste",handlePaste),listening=!1)},createPaster=function createPaster(){var cb=function cb(files){api.onload(files)},api={destroy:function destroy(){unlisten(cb)},onload:function onload(){}};return listen(cb),api},create$d,addFilesNotificationTimeout=null,notificationClearTimeout=null,filenames=[],assist=function assist(root,message){root.element.textContent=message},clear$1=function clear(root){root.element.textContent=""},listModified=function listModified(root,filename,label){var total=root.query("GET_TOTAL_ITEMS");assist(root,label+" "+filename+", "+total+" "+(1===total?root.query("GET_LABEL_FILE_COUNT_SINGULAR"):root.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(notificationClearTimeout),notificationClearTimeout=setTimeout((function(){clear$1(root)}),1500)},isUsingFilePond=function isUsingFilePond(root){return root.element.parentNode.contains(document.activeElement)},itemAdded,itemRemoved,itemProcessed,itemProcessedUndo=function itemProcessedUndo(_ref5){var root=_ref5.root,action=_ref5.action,item,filename=root.query("GET_ITEM",action.id).filename,label=root.query("GET_LABEL_FILE_PROCESSING_ABORTED");assist(root,filename+" "+label)},itemError=function itemError(_ref6){var root=_ref6.root,action=_ref6.action,item,filename=root.query("GET_ITEM",action.id).filename;assist(root,action.status.main+" "+filename+" "+action.status.sub)},assistant=createView({create:function create(_ref){var root=_ref.root,props=_ref.props;root.element.id="filepond--assistant-"+props.id,attr(root.element,"role","status"),attr(root.element,"aria-live","polite"),attr(root.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:createRoute({DID_LOAD_ITEM:function itemAdded(_ref2){var root=_ref2.root,action=_ref2.action;if(isUsingFilePond(root)){root.element.textContent="";var item=root.query("GET_ITEM",action.id);filenames.push(item.filename),clearTimeout(addFilesNotificationTimeout),addFilesNotificationTimeout=setTimeout((function(){listModified(root,filenames.join(", "),root.query("GET_LABEL_FILE_ADDED")),filenames.length=0}),750)}},DID_REMOVE_ITEM:function itemRemoved(_ref3){var root=_ref3.root,action=_ref3.action;if(isUsingFilePond(root)){var item=action.item;listModified(root,item.filename,root.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function itemProcessed(_ref4){var root=_ref4.root,action=_ref4.action,item,filename=root.query("GET_ITEM",action.id).filename,label=root.query("GET_LABEL_FILE_PROCESSING_COMPLETE");assist(root,filename+" "+label)},DID_ABORT_ITEM_PROCESSING:itemProcessedUndo,DID_REVERT_ITEM_PROCESSING:itemProcessedUndo,DID_THROW_ITEM_REMOVE_ERROR:itemError,DID_THROW_ITEM_LOAD_ERROR:itemError,DID_THROW_ITEM_INVALID:itemError,DID_THROW_ITEM_PROCESSING_ERROR:itemError}),tag:"span",name:"assistant"}),toCamels=function toCamels(string){var separator=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return string.replace(new RegExp(separator+".","g"),(function(sub){return sub.charAt(1).toUpperCase()}))},debounce=function debounce(func){var interval=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,immidiateOnly=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],last=Date.now(),timeout=null;return function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];clearTimeout(timeout);var dist=Date.now()-last,fn=function fn(){last=Date.now(),func.apply(void 0,args)};dist<interval?immidiateOnly||(timeout=setTimeout(fn,interval-dist)):fn()}},MAX_FILES_LIMIT=1e6,prevent=function prevent(e){return e.preventDefault()},create$e=function create(_ref){var root=_ref.root,props=_ref.props,id=root.query("GET_ID");id&&(root.element.id=id);var className=root.query("GET_CLASS_NAME");className&&className.split(" ").filter((function(name){return name.length})).forEach((function(name){root.element.classList.add(name)})),root.ref.label=root.appendChildView(root.createChildView(dropLabel,Object.assign({},props,{translateY:null,caption:root.query("GET_LABEL_IDLE")}))),root.ref.list=root.appendChildView(root.createChildView(listScroller,{translateY:null})),root.ref.panel=root.appendChildView(root.createChildView(panel,{name:"panel-root"})),root.ref.assistant=root.appendChildView(root.createChildView(assistant,Object.assign({},props))),root.ref.data=root.appendChildView(root.createChildView(data,Object.assign({},props))),root.ref.measure=createElement$1("div"),root.ref.measure.style.height="100%",root.element.appendChild(root.ref.measure),root.ref.bounds=null,root.query("GET_STYLES").filter((function(style){return!isEmpty(style.value)})).map((function(_ref2){var name=_ref2.name,value=_ref2.value;root.element.dataset[name]=value})),root.ref.widthPrevious=null,root.ref.widthUpdated=debounce((function(){root.ref.updateHistory=[],root.dispatch("DID_RESIZE_ROOT")}),250),root.ref.previousAspectRatio=null,root.ref.updateHistory=[];var canHover=window.matchMedia("(pointer: fine) and (hover: hover)").matches,hasPointerEvents="PointerEvent"in window;root.query("GET_ALLOW_REORDER")&&hasPointerEvents&&!canHover&&(root.element.addEventListener("touchmove",prevent,{passive:!1}),root.element.addEventListener("gesturestart",prevent));var credits=root.query("GET_CREDITS"),hasCredits;if(2===credits.length){var frag=document.createElement("a");frag.className="filepond--credits",frag.setAttribute("aria-hidden","true"),frag.href=credits[0],frag.tabindex=-1,frag.target="_blank",frag.rel="noopener noreferrer",frag.textContent=credits[1],root.element.appendChild(frag),root.ref.credits=frag}},write$9=function write(_ref3){var root=_ref3.root,props=_ref3.props,actions=_ref3.actions;if(route$5({root:root,props:props,actions:actions}),actions.filter((function(action){return/^DID_SET_STYLE_/.test(action.type)})).filter((function(action){return!isEmpty(action.data.value)})).map((function(_ref4){var type=_ref4.type,data=_ref4.data,name=toCamels(type.substr(8).toLowerCase(),"_");root.element.dataset[name]=data.value,root.invalidateLayout()})),!root.rect.element.hidden){root.rect.element.width!==root.ref.widthPrevious&&(root.ref.widthPrevious=root.rect.element.width,root.ref.widthUpdated());var bounds=root.ref.bounds;bounds||(bounds=root.ref.bounds=calculateRootBoundingBoxHeight(root),root.element.removeChild(root.ref.measure),root.ref.measure=null);var _root$ref=root.ref,hopper=_root$ref.hopper,label=_root$ref.label,list=_root$ref.list,panel=_root$ref.panel;hopper&&hopper.updateHopperState();var aspectRatio=root.query("GET_PANEL_ASPECT_RATIO"),isMultiItem=root.query("GET_ALLOW_MULTIPLE"),totalItems=root.query("GET_TOTAL_ITEMS"),maxItems,atMaxCapacity=totalItems===(isMultiItem?root.query("GET_MAX_FILES")||1e6:1),addAction=actions.find((function(action){return"DID_ADD_ITEM"===action.type}));if(atMaxCapacity&&addAction){var interactionMethod=addAction.data.interactionMethod;label.opacity=0,isMultiItem?label.translateY=-40:interactionMethod===InteractionMethod_API?label.translateX=40:label.translateY=interactionMethod===InteractionMethod_BROWSE?40:30}else atMaxCapacity||(label.opacity=1,label.translateX=0,label.translateY=0);var listItemMargin=calculateListItemMargin(root),listHeight=calculateListHeight(root),labelHeight=label.rect.element.height,currentLabelHeight=!isMultiItem||atMaxCapacity?0:labelHeight,listMarginTop=atMaxCapacity?list.rect.element.marginTop:0,listMarginBottom=0===totalItems?0:list.rect.element.marginBottom,visualHeight=currentLabelHeight+listMarginTop+listHeight.visual+listMarginBottom,boundsHeight=currentLabelHeight+listMarginTop+listHeight.bounds+listMarginBottom;if(list.translateY=Math.max(0,currentLabelHeight-list.rect.element.marginTop)-listItemMargin.top,aspectRatio){var width=root.rect.element.width,height=width*aspectRatio;aspectRatio!==root.ref.previousAspectRatio&&(root.ref.previousAspectRatio=aspectRatio,root.ref.updateHistory=[]);var history=root.ref.updateHistory;history.push(width);var MAX_BOUNCES=2;if(history.length>4)for(var l=history.length,bottom=l-10,bounces=0,i=l;i>=bottom;i--)if(history[i]===history[i-2]&&bounces++,bounces>=2)return;panel.scalable=!1,panel.height=height;var listAvailableHeight=height-currentLabelHeight-(listMarginBottom-listItemMargin.bottom)-(atMaxCapacity?listMarginTop:0);listHeight.visual>listAvailableHeight?list.overflow=listAvailableHeight:list.overflow=null,root.height=height}else if(bounds.fixedHeight){panel.scalable=!1;var _listAvailableHeight=bounds.fixedHeight-currentLabelHeight-(listMarginBottom-listItemMargin.bottom)-(atMaxCapacity?listMarginTop:0);listHeight.visual>_listAvailableHeight?list.overflow=_listAvailableHeight:list.overflow=null}else if(bounds.cappedHeight){var isCappedHeight=visualHeight>=bounds.cappedHeight,panelHeight=Math.min(bounds.cappedHeight,visualHeight);panel.scalable=!0,panel.height=isCappedHeight?panelHeight:panelHeight-listItemMargin.top-listItemMargin.bottom;var _listAvailableHeight2=panelHeight-currentLabelHeight-(listMarginBottom-listItemMargin.bottom)-(atMaxCapacity?listMarginTop:0);visualHeight>bounds.cappedHeight&&listHeight.visual>_listAvailableHeight2?list.overflow=_listAvailableHeight2:list.overflow=null,root.height=Math.min(bounds.cappedHeight,boundsHeight-listItemMargin.top-listItemMargin.bottom)}else{var itemMargin=totalItems>0?listItemMargin.top+listItemMargin.bottom:0;panel.scalable=!0,panel.height=Math.max(labelHeight,visualHeight-itemMargin),root.height=Math.max(labelHeight,boundsHeight-itemMargin)}root.ref.credits&&panel.heightCurrent&&(root.ref.credits.style.transform="translateY("+panel.heightCurrent+"px)")}},calculateListItemMargin=function calculateListItemMargin(root){var item=root.ref.list.childViews[0].childViews[0];return item?{top:item.rect.element.marginTop,bottom:item.rect.element.marginBottom}:{top:0,bottom:0}},calculateListHeight=function calculateListHeight(root){var visual=0,bounds=0,scrollList=root.ref.list,itemList=scrollList.childViews[0],visibleChildren=itemList.childViews.filter((function(child){return child.rect.element.height})),children=root.query("GET_ACTIVE_ITEMS").map((function(item){return visibleChildren.find((function(child){return child.id===item.id}))})).filter((function(item){return item}));if(0===children.length)return{visual:visual,bounds:bounds};var horizontalSpace=itemList.rect.element.width,dragIndex=getItemIndexByPosition(itemList,children,scrollList.dragCoordinates),childRect=children[0].rect.element,itemVerticalMargin=childRect.marginTop+childRect.marginBottom,itemHorizontalMargin=childRect.marginLeft+childRect.marginRight,itemWidth=childRect.width+itemHorizontalMargin,itemHeight=childRect.height+itemVerticalMargin,newItem=void 0!==dragIndex&&dragIndex>=0?1:0,removedItem=children.find((function(child){return child.markedForRemoval&&child.opacity<.45}))?-1:0,verticalItemCount=children.length+newItem+removedItem,itemsPerRow=Math.round(horizontalSpace/itemWidth);return 1===itemsPerRow?children.forEach((function(item){var height=item.rect.element.height+itemVerticalMargin;bounds+=height,visual+=height*item.opacity})):(bounds=Math.ceil(verticalItemCount/itemsPerRow)*itemHeight,visual=bounds),{visual:visual,bounds:bounds}},calculateRootBoundingBoxHeight=function calculateRootBoundingBoxHeight(root){var height=root.ref.measureHeight||null,cappedHeight,fixedHeight;return{cappedHeight:parseInt(root.style.maxHeight,10)||null,fixedHeight:0===height?null:height}},exceedsMaxFiles=function exceedsMaxFiles(root,items){var allowReplace=root.query("GET_ALLOW_REPLACE"),allowMultiple=root.query("GET_ALLOW_MULTIPLE"),totalItems=root.query("GET_TOTAL_ITEMS"),maxItems=root.query("GET_MAX_FILES"),totalBrowseItems=items.length,hasMaxItems;return!allowMultiple&&totalBrowseItems>1||!!(isInt(maxItems=allowMultiple?maxItems:allowReplace?maxItems:1)&&totalItems+totalBrowseItems>maxItems)&&(root.dispatch("DID_THROW_MAX_FILES",{source:items,error:createResponse("warning",0,"Max files")}),!0)},getDragIndex=function getDragIndex(list,children,position){var itemList=list.childViews[0];return getItemIndexByPosition(itemList,children,{left:position.scopeLeft-itemList.rect.element.left,top:position.scopeTop-(list.rect.outer.top+list.rect.element.marginTop+list.rect.element.scrollTop)})},toggleDrop=function toggleDrop(root){var isAllowed=root.query("GET_ALLOW_DROP"),isDisabled=root.query("GET_DISABLED"),enabled=isAllowed&&!isDisabled;if(enabled&&!root.ref.hopper){var hopper=createHopper(root.element,(function(items){var beforeDropFile=root.query("GET_BEFORE_DROP_FILE")||function(){return!0},dropValidation;return!root.query("GET_DROP_VALIDATION")||items.every((function(item){return applyFilters("ALLOW_HOPPER_ITEM",item,{query:root.query}).every((function(result){return!0===result}))&&beforeDropFile(item)}))}),{filterItems:function filterItems(items){var ignoredFiles=root.query("GET_IGNORED_FILES");return items.filter((function(item){return!isFile(item)||!ignoredFiles.includes(item.name.toLowerCase())}))},catchesDropsOnPage:root.query("GET_DROP_ON_PAGE"),requiresDropOnElement:root.query("GET_DROP_ON_ELEMENT")});hopper.onload=function(items,position){var list,visibleChildren=root.ref.list.childViews[0].childViews.filter((function(child){return child.rect.element.height})),children=root.query("GET_ACTIVE_ITEMS").map((function(item){return visibleChildren.find((function(child){return child.id===item.id}))})).filter((function(item){return item}));applyFilterChain("ADD_ITEMS",items,{dispatch:root.dispatch}).then((function(queue){if(exceedsMaxFiles(root,queue))return!1;root.dispatch("ADD_ITEMS",{items:queue,index:getDragIndex(root.ref.list,children,position),interactionMethod:InteractionMethod_DROP})})),root.dispatch("DID_DROP",{position:position}),root.dispatch("DID_END_DRAG",{position:position})},hopper.ondragstart=function(position){root.dispatch("DID_START_DRAG",{position:position})},hopper.ondrag=debounce((function(position){root.dispatch("DID_DRAG",{position:position})})),hopper.ondragend=function(position){root.dispatch("DID_END_DRAG",{position:position})},root.ref.hopper=hopper,root.ref.drip=root.appendChildView(root.createChildView(drip))}else!enabled&&root.ref.hopper&&(root.ref.hopper.destroy(),root.ref.hopper=null,root.removeChildView(root.ref.drip))},toggleBrowse=function toggleBrowse(root,props){var isAllowed=root.query("GET_ALLOW_BROWSE"),isDisabled=root.query("GET_DISABLED"),enabled=isAllowed&&!isDisabled;enabled&&!root.ref.browser?root.ref.browser=root.appendChildView(root.createChildView(browser,Object.assign({},props,{onload:function onload(items){applyFilterChain("ADD_ITEMS",items,{dispatch:root.dispatch}).then((function(queue){if(exceedsMaxFiles(root,queue))return!1;root.dispatch("ADD_ITEMS",{items:queue,index:-1,interactionMethod:InteractionMethod_BROWSE})}))}})),0):!enabled&&root.ref.browser&&(root.removeChildView(root.ref.browser),root.ref.browser=null)},togglePaste=function togglePaste(root){var isAllowed=root.query("GET_ALLOW_PASTE"),isDisabled=root.query("GET_DISABLED"),enabled=isAllowed&&!isDisabled;enabled&&!root.ref.paster?(root.ref.paster=createPaster(),root.ref.paster.onload=function(items){applyFilterChain("ADD_ITEMS",items,{dispatch:root.dispatch}).then((function(queue){if(exceedsMaxFiles(root,queue))return!1;root.dispatch("ADD_ITEMS",{items:queue,index:-1,interactionMethod:InteractionMethod_PASTE})}))}):!enabled&&root.ref.paster&&(root.ref.paster.destroy(),root.ref.paster=null)},route$5=createRoute({DID_SET_ALLOW_BROWSE:function DID_SET_ALLOW_BROWSE(_ref5){var root=_ref5.root,props=_ref5.props;toggleBrowse(root,props)},DID_SET_ALLOW_DROP:function DID_SET_ALLOW_DROP(_ref6){var root=_ref6.root;toggleDrop(root)},DID_SET_ALLOW_PASTE:function DID_SET_ALLOW_PASTE(_ref7){var root=_ref7.root;togglePaste(root)},DID_SET_DISABLED:function DID_SET_DISABLED(_ref8){var root=_ref8.root,props=_ref8.props,isDisabled;toggleDrop(root),togglePaste(root),toggleBrowse(root,props),root.query("GET_DISABLED")?root.element.dataset.disabled="disabled":root.element.removeAttribute("data-disabled")}}),root=createView({name:"root",read:function read(_ref9){var root=_ref9.root;root.ref.measure&&(root.ref.measureHeight=root.ref.measure.offsetHeight)},create:create$e,write:write$9,destroy:function destroy(_ref10){var root=_ref10.root;root.ref.paster&&root.ref.paster.destroy(),root.ref.hopper&&root.ref.hopper.destroy(),root.element.removeEventListener("touchmove",prevent),root.element.removeEventListener("gesturestart",prevent)},mixins:{styles:["height"]}}),createApp=function createApp(){var initialOptions=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},originalElement=null,defaultOptions=getOptions(),store=createStore(createInitialState(defaultOptions),[queries,createOptionQueries(defaultOptions)],[actions,createOptionActions(defaultOptions)]);store.dispatch("SET_OPTIONS",{options:initialOptions});var visibilityHandler=function visibilityHandler(){document.hidden||store.dispatch("KICK")};document.addEventListener("visibilitychange",visibilityHandler);var resizeDoneTimer=null,isResizing=!1,isResizingHorizontally=!1,initialWindowWidth=null,currentWindowWidth=null,resizeHandler=function resizeHandler(){isResizing||(isResizing=!0),clearTimeout(resizeDoneTimer),resizeDoneTimer=setTimeout((function(){isResizing=!1,initialWindowWidth=null,currentWindowWidth=null,isResizingHorizontally&&(isResizingHorizontally=!1,store.dispatch("DID_STOP_RESIZE"))}),500)};window.addEventListener("resize",resizeHandler);var view=root(store,{id:getUniqueId()}),isResting=!1,isHidden=!1,readWriteApi={_read:function _read(){isResizing&&(currentWindowWidth=window.innerWidth,initialWindowWidth||(initialWindowWidth=currentWindowWidth),isResizingHorizontally||currentWindowWidth===initialWindowWidth||(store.dispatch("DID_START_RESIZE"),isResizingHorizontally=!0)),isHidden&&isResting&&(isResting=null===view.element.offsetParent),isResting||(view._read(),isHidden=view.rect.element.hidden)},_write:function _write(ts){var actions=store.processActionQueue().filter((function(action){return!/^SET_/.test(action.type)}));isResting&&!actions.length||(routeActionsToEvents(actions),isResting=view._write(ts,actions,isResizingHorizontally),removeReleasedItems(store.query("GET_ITEMS")),isResting&&store.processDispatchQueue())}},createEvent=function createEvent(name){return function(data){var event={type:name};if(!data)return event;if(data.hasOwnProperty("error")&&(event.error=data.error?Object.assign({},data.error):null),data.status&&(event.status=Object.assign({},data.status)),data.file&&(event.output=data.file),data.source)event.file=data.source;else if(data.item||data.id){var item=data.item?data.item:store.query("GET_ITEM",data.id);event.file=item?createItemAPI(item):null}return data.items&&(event.items=data.items.map(createItemAPI)),/progress/.test(name)&&(event.progress=data.progress),data.hasOwnProperty("origin")&&data.hasOwnProperty("target")&&(event.origin=data.origin,event.target=data.target),event}},eventRoutes={DID_DESTROY:createEvent("destroy"),DID_INIT:createEvent("init"),DID_THROW_MAX_FILES:createEvent("warning"),DID_INIT_ITEM:createEvent("initfile"),DID_START_ITEM_LOAD:createEvent("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:createEvent("addfileprogress"),DID_LOAD_ITEM:createEvent("addfile"),DID_THROW_ITEM_INVALID:[createEvent("error"),createEvent("addfile")],DID_THROW_ITEM_LOAD_ERROR:[createEvent("error"),createEvent("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[createEvent("error"),createEvent("removefile")],DID_PREPARE_OUTPUT:createEvent("preparefile"),DID_START_ITEM_PROCESSING:createEvent("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:createEvent("processfileprogress"),DID_ABORT_ITEM_PROCESSING:createEvent("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:createEvent("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:createEvent("processfiles"),DID_REVERT_ITEM_PROCESSING:createEvent("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[createEvent("error"),createEvent("processfile")],DID_REMOVE_ITEM:createEvent("removefile"),DID_UPDATE_ITEMS:createEvent("updatefiles"),DID_ACTIVATE_ITEM:createEvent("activatefile"),DID_REORDER_ITEMS:createEvent("reorderfiles")},exposeEvent=function exposeEvent(event){var detail=Object.assign({pond:exports},event);delete detail.type,view.element.dispatchEvent(new CustomEvent("FilePond:"+event.type,{detail:detail,bubbles:!0,cancelable:!0,composed:!0}));var params=[];event.hasOwnProperty("error")&&params.push(event.error),event.hasOwnProperty("file")&&params.push(event.file);var filtered=["type","error","file"];Object.keys(event).filter((function(key){return!filtered.includes(key)})).forEach((function(key){return params.push(event[key])})),exports.fire.apply(exports,[event.type].concat(params));var handler=store.query("GET_ON"+event.type.toUpperCase());handler&&handler.apply(void 0,params)},routeActionsToEvents=function routeActionsToEvents(actions){actions.length&&actions.filter((function(action){return eventRoutes[action.type]})).forEach((function(action){var routes=eventRoutes[action.type];(Array.isArray(routes)?routes:[routes]).forEach((function(route){"DID_INIT_ITEM"===action.type?exposeEvent(route(action.data)):setTimeout((function(){exposeEvent(route(action.data))}),0)}))}))},setOptions=function setOptions(options){return store.dispatch("SET_OPTIONS",{options:options})},getFile=function getFile(query){return store.query("GET_ACTIVE_ITEM",query)},prepareFile=function prepareFile(query){return new Promise((function(resolve,reject){store.dispatch("REQUEST_ITEM_PREPARE",{query:query,success:function success(item){resolve(item)},failure:function failure(error){reject(error)}})}))},addFile=function addFile(source){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(resolve,reject){addFiles([{source:source,options:options}],{index:options.index}).then((function(items){return resolve(items&&items[0])})).catch(reject)}))},isFilePondFile=function isFilePondFile(obj){return obj.file&&obj.id},removeFile=function removeFile(query,options){return"object"!=typeof query||isFilePondFile(query)||options||(options=query,query=void 0),store.dispatch("REMOVE_ITEM",Object.assign({},options,{query:query})),null===store.query("GET_ACTIVE_ITEM",query)},addFiles=function addFiles(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return new Promise((function(resolve,reject){var sources=[],options={};if(isArray(args[0]))sources.push.apply(sources,args[0]),Object.assign(options,args[1]||{});else{var lastArgument=args[args.length-1];"object"!=typeof lastArgument||lastArgument instanceof Blob||Object.assign(options,args.pop()),sources.push.apply(sources,args)}store.dispatch("ADD_ITEMS",{items:sources,index:options.index,interactionMethod:InteractionMethod_API,success:resolve,failure:reject})}))},getFiles=function getFiles(){return store.query("GET_ACTIVE_ITEMS")},processFile=function processFile(query){return new Promise((function(resolve,reject){store.dispatch("REQUEST_ITEM_PROCESSING",{query:query,success:function success(item){resolve(item)},failure:function failure(error){reject(error)}})}))},prepareFiles=function prepareFiles(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++)args[_key2]=arguments[_key2];var queries=Array.isArray(args[0])?args[0]:args,items=queries.length?queries:getFiles();return Promise.all(items.map(prepareFile))},processFiles=function processFiles(){for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++)args[_key3]=arguments[_key3];var queries=Array.isArray(args[0])?args[0]:args;if(!queries.length){var files=getFiles().filter((function(item){return!(item.status===ItemStatus.IDLE&&item.origin===FileOrigin.LOCAL)&&item.status!==ItemStatus.PROCESSING&&item.status!==ItemStatus.PROCESSING_COMPLETE&&item.status!==ItemStatus.PROCESSING_REVERT_ERROR}));return Promise.all(files.map(processFile))}return Promise.all(queries.map(processFile))},removeFiles=function removeFiles(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++)args[_key4]=arguments[_key4];var queries=Array.isArray(args[0])?args[0]:args,options;"object"==typeof queries[queries.length-1]?options=queries.pop():Array.isArray(args[0])&&(options=args[1]);var files=getFiles();if(!queries.length)return Promise.all(files.map((function(file){return removeFile(file,options)})));var mappedQueries=queries.map((function(query){return isNumber(query)?files[query]?files[query].id:null:query})).filter((function(query){return query}));return mappedQueries.map((function(q){return removeFile(q,options)}))},exports=Object.assign({},on(),{},readWriteApi,{},createOptionAPI(store,defaultOptions),{setOptions:setOptions,addFile:addFile,addFiles:addFiles,getFile:getFile,processFile:processFile,prepareFile:prepareFile,removeFile:removeFile,moveFile:function moveFile(query,index){return store.dispatch("MOVE_ITEM",{query:query,index:index})},getFiles:getFiles,processFiles:processFiles,removeFiles:removeFiles,prepareFiles:prepareFiles,sort:function sort(compare){return store.dispatch("SORT",{compare:compare})},browse:function browse(){var input=view.element.querySelector("input[type=file]");input&&input.click()},destroy:function destroy(){exports.fire("destroy",view.element),store.dispatch("ABORT_ALL"),view._destroy(),window.removeEventListener("resize",resizeHandler),document.removeEventListener("visibilitychange",visibilityHandler),store.dispatch("DID_DESTROY")},insertBefore:function insertBefore$1(element){return insertBefore(view.element,element)},insertAfter:function insertAfter$1(element){return insertAfter(view.element,element)},appendTo:function appendTo(element){return element.appendChild(view.element)},replaceElement:function replaceElement(element){insertBefore(view.element,element),element.parentNode.removeChild(element),originalElement=element},restoreElement:function restoreElement(){originalElement&&(insertAfter(originalElement,view.element),view.element.parentNode.removeChild(view.element),originalElement=null)},isAttachedTo:function isAttachedTo(element){return view.element===element||originalElement===element},element:{get:function get(){return view.element}},status:{get:function get(){return store.query("GET_STATUS")}}});return store.dispatch("DID_INIT"),createObject(exports)},createAppObject=function createAppObject(){var customOptions=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},defaultOptions={};forin(getOptions(),(function(key,value){defaultOptions[key]=value[0]}));var app=createApp(Object.assign({},defaultOptions,{},customOptions));return app},lowerCaseFirstLetter=function lowerCaseFirstLetter(string){return string.charAt(0).toLowerCase()+string.slice(1)},attributeNameToPropertyName=function attributeNameToPropertyName(attributeName){return toCamels(attributeName.replace(/^data-/,""))},mapObject=function mapObject(object,propertyMap){forin(propertyMap,(function(selector,mapping){forin(object,(function(property,value){var selectorRegExp=new RegExp(selector),matches;if(selectorRegExp.test(property)&&(delete object[property],!1!==mapping))if(isString(mapping))object[mapping]=value;else{var group=mapping.group;isObject(mapping)&&!object[group]&&(object[group]={}),object[group][lowerCaseFirstLetter(property.replace(selectorRegExp,""))]=value}})),mapping.mapping&&mapObject(object[mapping.group],mapping.mapping)}))},getAttributesAsObject=function getAttributesAsObject(node){var attributeMapping=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributes=[];forin(node.attributes,(function(index){attributes.push(node.attributes[index])}));var output=attributes.filter((function(attribute){return attribute.name})).reduce((function(obj,attribute){var value=attr(node,attribute.name);return obj[attributeNameToPropertyName(attribute.name)]=value===attribute.name||value,obj}),{});return mapObject(output,attributeMapping),output},createAppAtElement=function createAppAtElement(element){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},attributeMapping={"^class$":"className","^multiple$":"allowMultiple","^capture$":"captureMethod","^webkitdirectory$":"allowDirectoriesOnly","^server":{group:"server",mapping:{"^process":{group:"process"},"^revert":{group:"revert"},"^fetch":{group:"fetch"},"^restore":{group:"restore"},"^load":{group:"load"}}},"^type$":!1,"^files$":!1};applyFilters("SET_ATTRIBUTE_TO_OPTION_MAP",attributeMapping);var mergedOptions=Object.assign({},options),attributeOptions=getAttributesAsObject("FIELDSET"===element.nodeName?element.querySelector("input[type=file]"):element,attributeMapping);Object.keys(attributeOptions).forEach((function(key){isObject(attributeOptions[key])?(isObject(mergedOptions[key])||(mergedOptions[key]={}),Object.assign(mergedOptions[key],attributeOptions[key])):mergedOptions[key]=attributeOptions[key]})),mergedOptions.files=(options.files||[]).concat(Array.from(element.querySelectorAll("input:not([type=file])")).map((function(input){return{source:input.value,options:{type:input.dataset.type}}})));var app=createAppObject(mergedOptions);return element.files&&Array.from(element.files).forEach((function(file){app.addFile(file)})),app.replaceElement(element),app},createApp$1=function createApp(){return isNode(arguments.length<=0?void 0:arguments[0])?createAppAtElement.apply(void 0,arguments):createAppObject.apply(void 0,arguments)},PRIVATE_METHODS=["fire","_read","_write"],createAppAPI=function createAppAPI(app){var api={};return copyObjectPropertiesToObject(app,api,PRIVATE_METHODS),api},replaceInString=function replaceInString(string,replacements){return string.replace(/(?:{([a-zA-Z]+)})/g,(function(match,group){return replacements[group]}))},createWorker=function createWorker(fn){var workerBlob=new Blob(["(",fn.toString(),")()"],{type:"application/javascript"}),workerURL=URL.createObjectURL(workerBlob),worker=new Worker(workerURL);return{transfer:function transfer(message,cb){},post:function post(message,cb,transferList){var id=getUniqueId();worker.onmessage=function(e){e.data.id===id&&cb(e.data.message)},worker.postMessage({id:id,message:message},transferList)},terminate:function terminate(){worker.terminate(),URL.revokeObjectURL(workerURL)}}},loadImage=function loadImage(url){return new Promise((function(resolve,reject){var img=new Image;img.onload=function(){resolve(img)},img.onerror=function(e){reject(e)},img.src=url}))},renameFile=function renameFile(file,name){var renamedFile=file.slice(0,file.size,file.type);return renamedFile.lastModifiedDate=file.lastModifiedDate,renamedFile.name=name,renamedFile},copyFile=function copyFile(file){return renameFile(file,file.name)},registeredPlugins=[],createAppPlugin=function createAppPlugin(plugin){if(!registeredPlugins.includes(plugin)){registeredPlugins.push(plugin);var pluginOutline=plugin({addFilter:addFilter,utils:{Type:Type,forin:forin,isString:isString,isFile:isFile,toNaturalFileSize:toNaturalFileSize,replaceInString:replaceInString,getExtensionFromFilename:getExtensionFromFilename,getFilenameWithoutExtension:getFilenameWithoutExtension,guesstimateMimeType:guesstimateMimeType,getFileFromBlob:getFileFromBlob,getFilenameFromURL:getFilenameFromURL,createRoute:createRoute,createWorker:createWorker,createView:createView,createItemAPI:createItemAPI,loadImage:loadImage,copyFile:copyFile,renameFile:renameFile,createBlob:createBlob,applyFilterChain:applyFilterChain,text:text,getNumericAspectRatioFromString:getNumericAspectRatioFromString},views:{fileActionButton:fileActionButton}});extendDefaultOptions(pluginOutline.options)}},isOperaMini=function isOperaMini(){return"[object OperaMini]"===Object.prototype.toString.call(window.operamini)},hasPromises=function hasPromises(){return"Promise"in window},hasBlobSlice=function hasBlobSlice(){return"slice"in Blob.prototype},hasCreateObjectURL=function hasCreateObjectURL(){return"URL"in window&&"createObjectURL"in window.URL},hasVisibility=function hasVisibility(){return"visibilityState"in document},hasTiming=function hasTiming(){return"performance"in window},hasCSSSupports=function hasCSSSupports(){return"supports"in(window.CSS||{})},isIE11=function isIE11(){return/MSIE|Trident/.test(window.navigator.userAgent)},supported=(isSupported=isBrowser()&&!isOperaMini()&&hasVisibility()&&hasPromises()&&hasBlobSlice()&&hasCreateObjectURL()&&hasTiming()&&(hasCSSSupports()||isIE11()),function(){return isSupported}),isSupported,state={apps:[]},name="filepond",fn=function fn(){};if(exports.Status={},exports.FileStatus={},exports.FileOrigin={},exports.OptionTypes={},exports.create=fn,exports.destroy=fn,exports.parse=fn,exports.find=fn,exports.registerPlugin=fn,exports.getOptions=fn,exports.setOptions=fn,supported()){createPainter((function(){state.apps.forEach((function(app){return app._read()}))}),(function(ts){state.apps.forEach((function(app){return app._write(ts)}))}));var dispatch=function dispatch(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:supported,create:exports.create,destroy:exports.destroy,parse:exports.parse,find:exports.find,registerPlugin:exports.registerPlugin,setOptions:exports.setOptions}})),document.removeEventListener("DOMContentLoaded",dispatch)};"loading"!==document.readyState?setTimeout((function(){return dispatch()}),0):document.addEventListener("DOMContentLoaded",dispatch);var updateOptionTypes=function updateOptionTypes(){return forin(getOptions(),(function(key,value){exports.OptionTypes[key]=value[1]}))};exports.Status=Object.assign({},Status),exports.FileOrigin=Object.assign({},FileOrigin),exports.FileStatus=Object.assign({},ItemStatus),exports.OptionTypes={},updateOptionTypes(),exports.create=function create(){var app=createApp$1.apply(void 0,arguments);return app.on("destroy",exports.destroy),state.apps.push(app),createAppAPI(app)},exports.destroy=function destroy(hook){var indexToRemove=state.apps.findIndex((function(app){return app.isAttachedTo(hook)})),app;return indexToRemove>=0&&(state.apps.splice(indexToRemove,1)[0].restoreElement(),!0)},exports.parse=function parse(context){var matchedHooks,newHooks;return Array.from(context.querySelectorAll("."+name)).filter((function(newHook){return!state.apps.find((function(app){return app.isAttachedTo(newHook)}))})).map((function(hook){return exports.create(hook)}))},exports.find=function find(hook){var app=state.apps.find((function(app){return app.isAttachedTo(hook)}));return app?createAppAPI(app):null},exports.registerPlugin=function registerPlugin(){for(var _len=arguments.length,plugins=new Array(_len),_key=0;_key<_len;_key++)plugins[_key]=arguments[_key];plugins.forEach(createAppPlugin),updateOptionTypes()},exports.getOptions=function getOptions$1(){var opts={};return forin(getOptions(),(function(key,value){opts[key]=value[0]})),opts},exports.setOptions=function setOptions$1(opts){return isObject(opts)&&(state.apps.forEach((function(app){app.setOptions(opts)})),setOptions(opts)),exports.getOptions()}}exports.supported=supported,Object.defineProperty(exports,"__esModule",{value:!0})}));