From c1ee6f1dafde7dc12ccb6dc3fde9beaf903900ba Mon Sep 17 00:00:00 2001 From: Anton Sylka Date: Fri, 10 Jun 2022 16:30:06 +0800 Subject: [PATCH 1/5] Refs #26680: Fix height calculation --- src/js/app/view/list.js | 22 ++++++++++++++++------ src/js/app/view/root.js | 30 ++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/js/app/view/list.js b/src/js/app/view/list.js index accb6af8..7ad8d76c 100644 --- a/src/js/app/view/list.js +++ b/src/js/app/view/list.js @@ -294,7 +294,6 @@ const write = ({ root, props, actions, shouldOptimize }) => { const itemVerticalMargin = childRect.marginTop + childRect.marginBottom; const itemHorizontalMargin = childRect.marginLeft + childRect.marginRight; const itemWidth = childRect.width + itemHorizontalMargin; - const itemHeight = childRect.height + itemVerticalMargin; const itemsPerRow = getItemsPerRow(horizontalSpace, itemWidth); // stack @@ -338,6 +337,7 @@ const write = ({ root, props, actions, shouldOptimize }) => { else { let prevX = 0; let prevY = 0; + let rowMaxHeight = 0; children.forEach((child, index) => { if (index === dragIndex) { @@ -355,16 +355,26 @@ const write = ({ root, props, actions, shouldOptimize }) => { const visualIndex = index + addIndexOffset + dragIndexOffset + removeIndexOffset; const indexX = visualIndex % itemsPerRow; - const indexY = Math.floor(visualIndex / itemsPerRow); + const itemHeight = child.rect.element.height + itemVerticalMargin; + if (itemHeight > rowMaxHeight) { + rowMaxHeight = itemHeight; + } + + const isLastItemInRow = indexX + 1 === itemsPerRow || !(children[index + 1]); + const offsetX = indexX * itemWidth; - const offsetY = indexY * itemHeight; - + const offsetY = prevY; + const vectorX = Math.sign(offsetX - prevX); const vectorY = Math.sign(offsetY - prevY); - + prevX = offsetX; - prevY = offsetY; + + if (isLastItemInRow) { + prevY += rowMaxHeight; + rowMaxHeight = 0; + } if (child.markedForRemoval) return; diff --git a/src/js/app/view/root.js b/src/js/app/view/root.js index 5e24102a..2a8f53e0 100644 --- a/src/js/app/view/root.js +++ b/src/js/app/view/root.js @@ -366,7 +366,6 @@ const calculateListHeight = root => { if (children.length === 0) return { visual, bounds }; const horizontalSpace = itemList.rect.element.width; - const dragIndex = getItemIndexByPosition(itemList, children, scrollList.dragCoordinates); const childRect = children[0].rect.element; @@ -374,13 +373,7 @@ const calculateListHeight = root => { const itemHorizontalMargin = childRect.marginLeft + childRect.marginRight; const itemWidth = childRect.width + itemHorizontalMargin; - const itemHeight = childRect.height + itemVerticalMargin; - const newItem = typeof dragIndex !== 'undefined' && dragIndex >= 0 ? 1 : 0; - const removedItem = children.find(child => child.markedForRemoval && child.opacity < 0.45) - ? -1 - : 0; - const verticalItemCount = children.length + newItem + removedItem; const itemsPerRow = getItemsPerRow(horizontalSpace, itemWidth); // stack @@ -393,7 +386,28 @@ const calculateListHeight = root => { } // grid else { - bounds = Math.ceil(verticalItemCount / itemsPerRow) * itemHeight; + let maxItemHeightInRow = 0; + let maxColumnHeight = 0; + + children.forEach(function(item, index) { + let height = item.rect.element.height + itemVerticalMargin; + const rowIndex = Math.floor(index / itemsPerRow); + const colIndex = Math.floor(index - (rowIndex * itemsPerRow)); + const isLastItemInRow = colIndex + 1 === itemsPerRow || !(children[index + 1]); + if (height > maxItemHeightInRow) { + maxItemHeightInRow = height; + } + + if (!isLastItemInRow) { + return; + } + + maxColumnHeight += maxItemHeightInRow; + + maxItemHeightInRow = 0; + }); + + bounds = maxColumnHeight; visual = bounds; } From 92a4420c7280aebafde6973ce69b3a1fa078397f Mon Sep 17 00:00:00 2001 From: Anton Sylka Date: Fri, 10 Jun 2022 16:36:45 +0800 Subject: [PATCH 2/5] Refs #26680: Update build files --- dist/filepond.esm.js | 48 ++++++++++++++++++++++++++++---------- dist/filepond.esm.min.js | 2 +- dist/filepond.js | 50 +++++++++++++++++++++++++++++----------- dist/filepond.min.js | 2 +- 4 files changed, 74 insertions(+), 28 deletions(-) diff --git a/dist/filepond.esm.js b/dist/filepond.esm.js index 5c0ce440..a236d241 100644 --- a/dist/filepond.esm.js +++ b/dist/filepond.esm.js @@ -6568,7 +6568,6 @@ const write$5 = ({ root, props, actions, shouldOptimize }) => { const itemVerticalMargin = childRect.marginTop + childRect.marginBottom; const itemHorizontalMargin = childRect.marginLeft + childRect.marginRight; const itemWidth = childRect.width + itemHorizontalMargin; - const itemHeight = childRect.height + itemVerticalMargin; const itemsPerRow = getItemsPerRow(horizontalSpace, itemWidth); // stack @@ -6612,6 +6611,7 @@ const write$5 = ({ root, props, actions, shouldOptimize }) => { else { let prevX = 0; let prevY = 0; + let rowMaxHeight = 0; children.forEach((child, index) => { if (index === dragIndex) { @@ -6629,16 +6629,26 @@ const write$5 = ({ root, props, actions, shouldOptimize }) => { const visualIndex = index + addIndexOffset + dragIndexOffset + removeIndexOffset; const indexX = visualIndex % itemsPerRow; - const indexY = Math.floor(visualIndex / itemsPerRow); + const itemHeight = child.rect.element.height + itemVerticalMargin; + + if (itemHeight > rowMaxHeight) { + rowMaxHeight = itemHeight; + } + + const isLastItemInRow = indexX + 1 === itemsPerRow || !children[index + 1]; const offsetX = indexX * itemWidth; - const offsetY = indexY * itemHeight; + const offsetY = prevY; const vectorX = Math.sign(offsetX - prevX); const vectorY = Math.sign(offsetY - prevY); prevX = offsetX; - prevY = offsetY; + + if (isLastItemInRow) { + prevY += rowMaxHeight; + rowMaxHeight = 0; + } if (child.markedForRemoval) return; @@ -8305,7 +8315,6 @@ const calculateListHeight = root => { if (children.length === 0) return { visual, bounds }; const horizontalSpace = itemList.rect.element.width; - const dragIndex = getItemIndexByPosition(itemList, children, scrollList.dragCoordinates); const childRect = children[0].rect.element; @@ -8313,13 +8322,7 @@ const calculateListHeight = root => { const itemHorizontalMargin = childRect.marginLeft + childRect.marginRight; const itemWidth = childRect.width + itemHorizontalMargin; - const itemHeight = childRect.height + itemVerticalMargin; - const newItem = typeof dragIndex !== 'undefined' && dragIndex >= 0 ? 1 : 0; - const removedItem = children.find(child => child.markedForRemoval && child.opacity < 0.45) - ? -1 - : 0; - const verticalItemCount = children.length + newItem + removedItem; const itemsPerRow = getItemsPerRow(horizontalSpace, itemWidth); // stack @@ -8332,7 +8335,28 @@ const calculateListHeight = root => { } // grid else { - bounds = Math.ceil(verticalItemCount / itemsPerRow) * itemHeight; + let maxItemHeightInRow = 0; + let maxColumnHeight = 0; + + children.forEach(function(item, index) { + let height = item.rect.element.height + itemVerticalMargin; + const rowIndex = Math.floor(index / itemsPerRow); + const colIndex = Math.floor(index - rowIndex * itemsPerRow); + const isLastItemInRow = colIndex + 1 === itemsPerRow || !children[index + 1]; + if (height > maxItemHeightInRow) { + maxItemHeightInRow = height; + } + + if (!isLastItemInRow) { + return; + } + + maxColumnHeight += maxItemHeightInRow; + + maxItemHeightInRow = 0; + }); + + bounds = maxColumnHeight; visual = bounds; } diff --git a/dist/filepond.esm.min.js b/dist/filepond.esm.min.js index c3db6252..d5ef2a10 100644 --- a/dist/filepond.esm.min.js +++ b/dist/filepond.esm.min.js @@ -6,4 +6,4 @@ /* eslint-disable */ -const e=(e,t)=>{for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])},t=t=>{const r={};return e(t,e=>{((e,t,r)=>{"function"!=typeof r?Object.defineProperty(e,t,{...r}):e[t]=r})(r,e,t[e])}),r},r=(e,t,r=null)=>{if(null===r)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,r)},o=["svg","path"],n=e=>o.includes(e),i=(t,o,i={})=>{"object"==typeof o&&(i=o,o=null);const s=n(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return o&&(n(t)?r(s,"class",o):s.className=o),e(i,(e,t)=>{r(s,e,t)}),s},s=e=>(t,r)=>{void 0!==r&&e.children[r]?e.insertBefore(t,e.children[r]):e.appendChild(t)},a=(e,t)=>(e,r)=>(void 0!==r?t.splice(r,0,e):t.push(e),e),l=(e,t)=>r=>(t.splice(t.indexOf(r),1),r.element.parentNode&&e.removeChild(r.element),r),c=(()=>"undefined"!=typeof window&&void 0!==window.document)(),d=()=>c,p="children"in(d()?i("svg"):{})?e=>e.children.length:e=>e.childNodes.length,E=(e,t,r,o)=>{const n=r[0]||e.left,i=r[1]||e.top,s=n+e.width,a=i+e.height*(o[1]||1),l={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:i,right:s,bottom:a}};return t.filter(e=>!e.isRectIgnored()).map(e=>e.rect).forEach(e=>{u(l.inner,{...e.inner}),u(l.outer,{...e.outer})}),_(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,_(l.outer),l},u=(e,t)=>{t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},_=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},T=e=>"number"==typeof e,f=e=>e<.5?2*e*e:(4-2*e)*e-1,I={spring:({stiffness:e=.5,damping:r=.75,mass:o=10}={})=>{let n=null,i=null,s=0,a=!1;const l=t({interpolate:(t,c)=>{if(!a)return T(n)&&T(i)?void(((e,t,r,o=.001)=>Math.abs(e-t){if(T(e)&&!T(i)&&(i=e),null===n&&(n=e,i=e),i===(n=e)||void 0===n)return a=!0,s=0,l.onupdate(i),void l.oncomplete(i);a=!1},get:()=>n},resting:{get:()=>a},onupdate:e=>{},oncomplete:e=>{}});return l},tween:({duration:e=500,easing:r=f,delay:o=0}={})=>{let n,i,s=null,a=!0,l=!1,c=null;const d=t({interpolate:(t,p)=>{a||null===c||(null===s&&(s=t),t-s=e||p?(n=1,i=l?0:1,d.onupdate(i*c),d.oncomplete(i*c),a=!0):(i=n/e,d.onupdate((n>=0?r(l?1-i:i):0)*c))))},target:{get:()=>l?0:c,set:e=>{if(null===c)return c=e,d.onupdate(e),void d.oncomplete(e);ea},onupdate:e=>{},oncomplete:e=>{}});return d}},m=(e,t,r)=>{const o=e[t]&&"object"==typeof e[t][r]?e[t][r]:e[t]||e,n="string"==typeof o?o:o.type,i="object"==typeof o?{...o}:{};return I[n]?I[n](i):null},h=(e,t,r,o=!1)=>{(t=Array.isArray(t)?t:[t]).forEach(t=>{e.forEach(e=>{let n=e,i=()=>r[e],s=t=>r[e]=t;"object"==typeof e&&(n=e.key,i=e.getter||i,s=e.setter||s),t[n]&&!o||(t[n]={get:i,set:s})})})},R=e=>null!=e,g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},O=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in t)if(t[r]!==e[r])return!0;return!1},D=(e,{opacity:t,perspective:r,translateX:o,translateY:n,scaleX:i,scaleY:s,rotateX:a,rotateY:l,rotateZ:c,originX:d,originY:p,width:E,height:u})=>{let _="",T="";(R(d)||R(p))&&(T+=`transform-origin: ${d||0}px ${p||0}px;`),R(r)&&(_+=`perspective(${r}px) `),(R(o)||R(n))&&(_+=`translate3d(${o||0}px, ${n||0}px, 0) `),(R(i)||R(s))&&(_+=`scale3d(${R(i)?i:1}, ${R(s)?s:1}, 1) `),R(c)&&(_+=`rotateZ(${c}rad) `),R(a)&&(_+=`rotateX(${a}rad) `),R(l)&&(_+=`rotateY(${l}rad) `),_.length&&(T+=`transform:${_};`),R(t)&&(T+=`opacity:${t};`,0===t&&(T+="visibility:hidden;"),t<1&&(T+="pointer-events:none;")),R(u)&&(T+=`height:${u}px;`),R(E)&&(T+=`width:${E}px;`);const f=e.elementCurrentStyle||"";T.length===f.length&&T===f||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,view:n})=>{const i={...t},s={};h(e,[r,o],t);const a=()=>n.rect?E(n.rect,n.childViews,(()=>[t.translateX||0,t.translateY||0])(),(()=>[t.scaleX||0,t.scaleY||0])()):null;return r.rect={get:a},o.rect={get:a},e.forEach(e=>{t[e]=void 0===i[e]?g[e]:i[e]}),{write:()=>{if(O(s,t))return D(n.element,t),Object.assign(s,{...t}),!0},destroy:()=>{}}},listeners:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,viewState:n,view:i})=>{const s=[],a=(e=>(t,r)=>{e.addEventListener(t,r)})(i.element),l=(e=>(t,r)=>{e.removeEventListener(t,r)})(i.element);return o.on=((e,t)=>{s.push({type:e,fn:t}),a(e,t)}),o.off=((e,t)=>{s.splice(s.findIndex(r=>r.type===e&&r.fn===t),1),l(e,t)}),{write:()=>!0,destroy:()=>{s.forEach(e=>{l(e.type,e.fn)})}}},animations:({mixinConfig:t,viewProps:r,viewInternalAPI:o,viewExternalAPI:n})=>{const i={...r},s=[];return e(t,(e,t)=>{const a=m(t);a&&(a.onupdate=(t=>{r[e]=t}),a.target=i[e],h([{key:e,setter:e=>{a.target!==e&&(a.target=e)},getter:()=>r[e]}],[o,n],r,!0),s.push(a))}),{write:e=>{let t=document.hidden,r=!0;return s.forEach(o=>{o.resting||(r=!1),o.interpolate(e,t)}),r},destroy:()=>{}}},apis:({mixinConfig:e,viewProps:t,viewExternalAPI:r})=>{h(e,r,t)}},y=(e={},t={},r={})=>(t.layoutCalculated||(e.paddingTop=parseInt(r.paddingTop,10)||0,e.marginTop=parseInt(r.marginTop,10)||0,e.marginRight=parseInt(r.marginRight,10)||0,e.marginBottom=parseInt(r.marginBottom,10)||0,e.marginLeft=parseInt(r.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e),A=({tag:e="div",name:r=null,attributes:o={},read:n=(()=>{}),write:c=(()=>{}),create:d=(()=>{}),destroy:u=(()=>{}),filterFrameActionsForChild:_=((e,t)=>t),didCreateView:T=(()=>{}),didWriteView:f=(()=>{}),ignoreRect:I=!1,ignoreRectUpdate:m=!1,mixins:h=[]}={})=>(R,g={})=>{const O=i(e,`filepond--${r}`,o),D=window.getComputedStyle(O,null),A=y();let L=null,P=!1;const v=[],M=[],b={},C={},N=[c],w=[n],G=[u],U=()=>O,B=()=>v.concat(),F=()=>L||(L=E(A,v,[0,0],[1,1])),q={element:{get:U},style:{get:()=>D},childViews:{get:B}},V={...q,rect:{get:F},ref:{get:()=>b},is:e=>r===e,appendChild:s(O),createChildView:(e=>(t,r)=>t(e,r))(R),linkView:e=>(v.push(e),e),unlinkView:e=>{v.splice(v.indexOf(e),1)},appendChildView:a(0,v),removeChildView:l(O,v),registerWriter:e=>N.push(e),registerReader:e=>w.push(e),registerDestroyer:e=>G.push(e),invalidateLayout:()=>O.layoutCalculated=!1,dispatch:R.dispatch,query:R.query},x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:()=>P},isRectIgnored:()=>I,_read:()=>{L=null,v.forEach(e=>e._read()),!(m&&A.width&&A.height)&&y(A,O,D);const e={root:H,props:g,rect:A};w.forEach(t=>t(e))},_write:(e,t,r)=>{let o=0===t.length;return N.forEach(n=>{!1===n({props:g,root:H,actions:t,timestamp:e,shouldOptimize:r})&&(o=!1)}),M.forEach(t=>{!1===t.write(e)&&(o=!1)}),v.filter(e=>!!e.element.parentNode).forEach(n=>{n._write(e,_(n,t),r)||(o=!1)}),v.forEach((n,i)=>{n.element.parentNode||(H.appendChild(n.element,i),n._read(),n._write(e,_(n,t),r),o=!1)}),P=o,f({props:g,root:H,actions:t,timestamp:e}),o},_destroy:()=>{M.forEach(e=>e.destroy()),G.forEach(e=>{e({root:H,props:g})}),v.forEach(e=>e._destroy())}},Y={...q,rect:{get:()=>A}};Object.keys(h).sort((e,t)=>"styles"===e?1:"styles"===t?-1:0).forEach(e=>{const r=S[e]({mixinConfig:h[e],viewProps:g,viewState:C,viewInternalAPI:V,viewExternalAPI:x,view:t(Y)});r&&M.push(r)});const H=t(V);d({root:H,props:g});const k=p(O);return v.forEach((e,t)=>{H.appendChild(e.element,k+t)}),T(H),t(x)},L=(e,t)=>({root:r,props:o,actions:n=[],timestamp:i,shouldOptimize:s})=>{n.filter(t=>e[t.type]).forEach(t=>e[t.type]({root:r,props:o,action:t.data,timestamp:i,shouldOptimize:s})),t&&t({root:r,props:o,actions:n,timestamp:i,shouldOptimize:s})},P=(e,t)=>t.parentNode.insertBefore(e,t),v=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),M=e=>Array.isArray(e),b=e=>null==e,C=e=>e.trim(),N=e=>""+e,w=e=>"boolean"==typeof e,G=e=>w(e)?e:"true"===e,U=e=>"string"==typeof e,B=e=>T(e)?e:U(e)?N(e).replace(/[a-z]+/gi,""):0,F=e=>parseInt(B(e),10),q=e=>parseFloat(B(e)),V=e=>T(e)&&isFinite(e)&&Math.floor(e)===e,x=(e,t=1e3)=>{if(V(e))return e;let r=N(e).trim();return/MB$/i.test(r)?(r=r.replace(/MB$i/,"").trim(),F(r)*t*t):/KB/i.test(r)?(r=r.replace(/KB$i/,"").trim(),F(r)*t):F(r)},Y=e=>"function"==typeof e,H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},k=(e,t,r,o,n)=>{if(null===t)return null;if("function"==typeof t)return t;const i={url:"GET"===r||"PATCH"===r?`?${e}=`:"",method:r,headers:n,withCredentials:!1,timeout:o,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){const e=i.headers.split(/:(.+)/);i.headers={header:e[0],value:e[1]}}return i.withCredentials=G(i.withCredentials),i},X=e=>"object"==typeof e&&null!==e,$=e=>M(e)?"array":(e=>null===e)(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":(e=>X(e)&&U(e.url)&&X(e.process)&&X(e.revert)&&X(e.restore)&&X(e.fetch))(e)?"api":typeof e,W={array:(e,t=",")=>b(e)?[]:M(e)?e:N(e).split(t).map(C).filter(e=>e.length),boolean:G,int:e=>"bytes"===$(e)?x(e):F(e),number:q,float:q,bytes:x,string:e=>Y(e)?e:N(e),function:e=>(e=>{let t=self,r=e.split("."),o=null;for(;o=r.shift();)if(!(t=t[o]))return null;return t})(e),serverapi:t=>(t=>{const r={};return r.url=U(t)?t:t.url||"",r.timeout=t.timeout?parseInt(t.timeout,10):0,r.headers=t.headers?t.headers:{},e(H,e=>{r[e]=k(e,t[e],H[e],r.timeout,r.headers)}),r.process=t.process||U(t)||t.url?r.process:null,r.remove=t.remove||null,delete r.headers,r})(t),object:e=>{try{return JSON.parse((e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))(e))}catch(e){return null}}},z=(e,t,r)=>{if(e===t)return e;let o=$(e);if(o!==r){const t=((e,t)=>W[t](e))(e,r);if(o=$(t),null===t)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;e=t}return e},j=r=>{const o={};return e(r,e=>{const t=r[e];o[e]=((e,t)=>{let r=e;return{enumerable:!0,get:()=>r,set:o=>{r=z(o,e,t)}}})(t[0],t[1])}),t(o)},Q=(e,t="-")=>e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()).join(t),Z=(t,r)=>{const o={};return e(r,e=>{o[e]={get:()=>t.getState().options[e],set:r=>{t.dispatch(`SET_${Q(e,"_").toUpperCase()}`,{value:r})}}}),o},K=t=>(r,o,n)=>{const i={};return e(t,e=>{const t=Q(e,"_").toUpperCase();i[`SET_${t}`]=(o=>{try{n.options[e]=o.value}catch(e){}r(`DID_SET_${t}`,{value:n.options[e]})})}),i},J=t=>r=>{const o={};return e(t,e=>{o[`GET_${Q(e,"_").toUpperCase()}`]=(t=>r.options[e])}),o},ee=1,te=2,re=3,oe=4,ne=5,ie=()=>Math.random().toString(36).substr(2,9),se=(e,t)=>e.splice(t,1),ae=()=>{const e=[],t=(t,r)=>{se(e,e.findIndex(e=>e.event===t&&(e.cb===r||!r)))},r=(t,r,o)=>{e.filter(e=>e.event===t).map(e=>e.cb).forEach(e=>((e,t)=>{t?e():document.hidden?Promise.resolve(1).then(e):setTimeout(e,0)})(()=>e(...r),o))};return{fireSync:(e,...t)=>{r(e,t,!0)},fire:(e,...t)=>{r(e,t,!1)},on:(t,r)=>{e.push({event:t,cb:r})},onOnce:(r,o)=>{e.push({event:r,cb:(...e)=>{t(r,o),o(...e)}})},off:t}},le=(e,t,r)=>{Object.getOwnPropertyNames(e).filter(e=>!r.includes(e)).forEach(r=>Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)))},ce=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],de=e=>{const t={};return le(e,t,ce),t},pe={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},Ee={INPUT:1,LIMBO:2,LOCAL:3},ue=e=>/[^0-9]+/.exec(e),_e=()=>ue(1.1.toLocaleString())[0],Te={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},fe=[],Ie=(e,t,r)=>new Promise((o,n)=>{const i=fe.filter(t=>t.key===e).map(e=>e.cb);if(0===i.length)return void o(t);const s=i.shift();i.reduce((e,t)=>e.then(e=>t(e,r)),s(t,r)).then(e=>o(e)).catch(e=>n(e))}),me=(e,t,r)=>fe.filter(t=>t.key===e).map(e=>e.cb(t,r)),he=(e,t)=>fe.push({key:e,cb:t}),Re=()=>({...ge}),ge={id:[null,Te.STRING],name:["filepond",Te.STRING],disabled:[!1,Te.BOOLEAN],className:[null,Te.STRING],required:[!1,Te.BOOLEAN],captureMethod:[null,Te.STRING],allowSyncAcceptAttribute:[!0,Te.BOOLEAN],allowDrop:[!0,Te.BOOLEAN],allowBrowse:[!0,Te.BOOLEAN],allowPaste:[!0,Te.BOOLEAN],allowMultiple:[!1,Te.BOOLEAN],allowReplace:[!0,Te.BOOLEAN],allowRevert:[!0,Te.BOOLEAN],allowRemove:[!0,Te.BOOLEAN],allowProcess:[!0,Te.BOOLEAN],allowReorder:[!1,Te.BOOLEAN],allowDirectoriesOnly:[!1,Te.BOOLEAN],storeAsFile:[!1,Te.BOOLEAN],forceRevert:[!1,Te.BOOLEAN],maxFiles:[null,Te.INT],checkValidity:[!1,Te.BOOLEAN],itemInsertLocationFreedom:[!0,Te.BOOLEAN],itemInsertLocation:["before",Te.STRING],itemInsertInterval:[75,Te.INT],dropOnPage:[!1,Te.BOOLEAN],dropOnElement:[!0,Te.BOOLEAN],dropValidation:[!1,Te.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Te.ARRAY],instantUpload:[!0,Te.BOOLEAN],maxParallelUploads:[2,Te.INT],allowMinimumUploadDuration:[!0,Te.BOOLEAN],chunkUploads:[!1,Te.BOOLEAN],chunkForce:[!1,Te.BOOLEAN],chunkSize:[5e6,Te.INT],chunkRetryDelays:[[500,1e3,3e3],Te.ARRAY],server:[null,Te.SERVER_API],fileSizeBase:[1e3,Te.INT],labelFileSizeBytes:["bytes",Te.STRING],labelFileSizeKilobytes:["KB",Te.STRING],labelFileSizeMegabytes:["MB",Te.STRING],labelFileSizeGigabytes:["GB",Te.STRING],labelDecimalSeparator:[_e(),Te.STRING],labelThousandsSeparator:[(()=>{const e=_e(),t=1e3.toLocaleString();return t!==1e3.toString()?ue(t)[0]:"."===e?",":"."})(),Te.STRING],labelIdle:['Drag & Drop your files or Browse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],oninitfile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],beforePrepareFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],Te.ARRAY]},Oe=(e,t)=>b(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(e=>e.id===t)||null),De=e=>{if(b(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Se=e=>e.filter(e=>!e.archived),ye={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let Ae=null;const Le=[pe.LOAD_ERROR,pe.PROCESSING_ERROR,pe.PROCESSING_REVERT_ERROR],Pe=[pe.LOADING,pe.PROCESSING,pe.PROCESSING_QUEUED,pe.INIT],ve=[pe.PROCESSING_COMPLETE],Me=e=>Le.includes(e.status),be=e=>Pe.includes(e.status),Ce=e=>ve.includes(e.status),Ne=e=>X(e.options.server)&&(X(e.options.server.process)||Y(e.options.server.process)),we=e=>({GET_STATUS:()=>{const t=Se(e.items),{EMPTY:r,ERROR:o,BUSY:n,IDLE:i,READY:s}=ye;return 0===t.length?r:t.some(Me)?o:t.some(be)?n:t.some(Ce)?s:i},GET_ITEM:t=>Oe(e.items,t),GET_ACTIVE_ITEM:t=>Oe(Se(e.items),t),GET_ACTIVE_ITEMS:()=>Se(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const r=Oe(e.items,t);return r?r.filename:null},GET_ITEM_SIZE:t=>{const r=Oe(e.items,t);return r?r.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(e=>/^style/.test(e)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>{return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>Se(e.items).filter(e=>e.status===t),GET_TOTAL_ITEMS:()=>Se(e.items).length,SHOULD_UPDATE_FILE_INPUT:()=>e.options.storeAsFile&&(()=>{if(null===Ae)try{const e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));const t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,Ae=1===t.files.length}catch(e){Ae=!1}return Ae})()&&!Ne(e),IS_ASYNC:()=>Ne(e),GET_FILE_SIZE_LABELS:e=>({labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0})}),Ge=(e,t,r)=>Math.max(Math.min(r,e),t),Ue=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),Be=e=>e.split("/").pop().split("?").shift(),Fe=e=>e.split(".").pop(),qe=(e,t="")=>(t+e).slice(-t.length),Ve=(e=new Date)=>`${e.getFullYear()}-${qe(e.getMonth()+1,"00")}-${qe(e.getDate(),"00")}_${qe(e.getHours(),"00")}-${qe(e.getMinutes(),"00")}-${qe(e.getSeconds(),"00")}`,xe=(e,t,r=null,o=null)=>{const n="string"==typeof r?e.slice(0,e.size,r):e.slice(0,e.size,e.type);return n.lastModifiedDate=new Date,e._relativePath&&(n._relativePath=e._relativePath),U(t)||(t=Ve()),t&&null===o&&Fe(t)?n.name=t:(o=o||(e=>{if("string"!=typeof e)return"";const t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""})(n.type),n.name=t+(o?"."+o:"")),n},Ye=(e,t)=>{const r=(()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)();if(r){const o=new r;return o.append(e),o.getBlob(t)}return new Blob([e],{type:t})},He=e=>(/^data:(.+);/.exec(e)||[])[1]||null,ke=e=>{const t=He(e);return((e,t)=>{const r=new ArrayBuffer(e.length),o=new Uint8Array(r);for(let t=0;tatob((e=>e.split(",")[1].replace(/\s/g,""))(e)))(e),t)},Xe=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null},$e=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},We=e=>{if(/x-content-transfer-id:/i.test(e)){return(e.split(":")[1]||"").trim()||null}return null},ze=e=>{const t={source:null,name:null,size:null},r=e.split("\n");for(let e of r){const r=Xe(e);if(r){t.name=r;continue}const o=$e(e);if(o){t.size=o;continue}const n=We(e);n&&(t.source=n)}return t},je=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},r=r=>{e?(t.timestamp=Date.now(),t.request=e(r,e=>{t.duration=Date.now()-t.timestamp,t.complete=!0,e instanceof Blob&&(e=xe(e,e.name||Be(r))),o.fire("load",e instanceof Blob?e:e?e.body:null)},e=>{o.fire("error","string"==typeof e?{type:"error",code:0,body:e}:e)},(e,r,n)=>{n&&(t.size=n),t.duration=Date.now()-t.timestamp,e?(t.progress=r/n,o.fire("progress",t.progress)):t.progress=null},()=>{o.fire("abort")},e=>{const r=ze("string"==typeof e?e:e.headers);o.fire("meta",{size:t.size||r.size,filename:r.name,source:r.source})})):o.fire("error",{type:"error",body:"Can't load URL",code:400})},o={...ae(),setSource:e=>t.source=e,getProgress:()=>t.progress,abort:()=>{t.request&&t.request.abort&&t.request.abort()},load:()=>{const e=t.source;o.fire("init",e),e instanceof File?o.fire("load",e):e instanceof Blob?o.fire("load",xe(e,e.name)):Ue(e)?o.fire("load",((e,t,r)=>xe(ke(e),t,null,r))(e)):r(e)}};return o},Qe=e=>/GET|HEAD/.test(e),Ze=(e,t,r)=>{const o={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,s.abort()}};let n=!1,i=!1;r={method:"POST",headers:{},withCredentials:!1,...r},t=encodeURI(t),Qe(r.method)&&e&&(t=`${t}${encodeURIComponent("string"==typeof e?e:JSON.stringify(e))}`);const s=new XMLHttpRequest;return(Qe(r.method)?s:s.upload).onprogress=(e=>{n||o.onprogress(e.lengthComputable,e.loaded,e.total)}),s.onreadystatechange=(()=>{s.readyState<2||4===s.readyState&&0===s.status||i||(i=!0,o.onheaders(s))}),s.onload=(()=>{s.status>=200&&s.status<300?o.onload(s):o.onerror(s)}),s.onerror=(()=>o.onerror(s)),s.onabort=(()=>{n=!0,o.onabort()}),s.ontimeout=(()=>o.ontimeout(s)),s.open(r.method,t,!0),V(r.timeout)&&(s.timeout=r.timeout),Object.keys(r.headers).forEach(e=>{const t=unescape(encodeURIComponent(r.headers[e]));s.setRequestHeader(e,t)}),r.responseType&&(s.responseType=r.responseType),r.withCredentials&&(s.withCredentials=!0),s.send(e),o},Ke=(e,t,r,o)=>({type:e,code:t,body:r,headers:o}),Je=e=>t=>{e(Ke("error",0,"Timeout",t.getAllResponseHeaders()))},et=e=>/\?/.test(e),tt=(...e)=>{let t="";return e.forEach(e=>{t+=et(t)&&et(e)?e.replace(/\?/,"&"):e}),t},rt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return null;const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s,a,l,c)=>{const d=Ze(n,tt(e,t.url),{...t,responseType:"blob"});return d.onload=(e=>{const o=e.getAllResponseHeaders(),s=ze(o).name||Be(n);i(Ke("load",e.status,"HEAD"===t.method?null:xe(r(e.response),s),o))}),d.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.onheaders=(e=>{c(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),d.ontimeout=Je(s),d.onprogress=a,d.onabort=l,d}},ot=0,nt=1,it=2,st=3,at=4,lt=(e,t,r,o,n,i,s,a,l,c,d)=>{const p=[],{chunkTransferId:E,chunkServer:u,chunkSize:_,chunkRetryDelays:T}=d,f={serverId:E,aborted:!1},I=t.ondata||(e=>e),m=t.onload||((e,t)=>"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response),h=t.onerror||(e=>null),R=Math.floor(o.size/_);for(let e=0;e<=R;e++){const t=e*_,r=o.slice(t,t+_,"application/offset+octet-stream");p[e]={index:e,size:r.size,offset:t,data:r,file:o,progress:0,retries:[...T],status:ot,error:null,request:null,timeout:null}}const g=e=>e.status===ot||e.status===st,O=t=>{if(f.aborted)return;if(!(t=t||p.find(g)))return void(p.every(e=>e.status===nt)&&(()=>i(f.serverId))());t.status=it,t.progress=null;const r=u.ondata||(e=>e),n=u.onerror||(e=>null),a=tt(e,u.url,f.serverId),c="function"==typeof u.headers?u.headers(t):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":o.size,"Upload-Name":o.name},d=t.request=Ze(r(t.data),a,{...u,headers:c});d.onload=(()=>{t.status=nt,t.request=null,y()}),d.onprogress=((e,r,o)=>{t.progress=e?r:null,S()}),d.onerror=(e=>{t.status=st,t.request=null,t.error=n(e.response)||e.statusText,D(t)||s(Ke("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.ontimeout=(e=>{t.status=st,t.request=null,D(t)||Je(s)(e)}),d.onabort=(()=>{t.status=ot,t.request=null,l()})},D=e=>0!==e.retries.length&&(e.status=at,clearTimeout(e.timeout),e.timeout=setTimeout(()=>{O(e)},e.retries.shift()),!0),S=()=>{const e=p.reduce((e,t)=>null===e||null===t.progress?null:e+t.progress,0);if(null===e)return a(!1,0,0);const t=p.reduce((e,t)=>e+t.size,0);a(!0,e,t)},y=()=>{p.filter(e=>e.status===it).length>=1||O()};return f.serverId?(r=>{const o=tt(e,u.url,f.serverId),n={headers:"function"==typeof t.headers?t.headers(f.serverId):{...t.headers},method:"HEAD"},i=Ze(null,o,n);i.onload=(e=>r(m(e,n.method))),i.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),i.ontimeout=Je(s)})(e=>{f.aborted||(p.filter(t=>t.offset{e.status=nt,e.progress=e.size}),y())}):(i=>{const a=new FormData;X(n)&&a.append(r,JSON.stringify(n));const l="function"==typeof t.headers?t.headers(o,n):{...t.headers,"Upload-Length":o.size},c={...t,headers:l},d=Ze(I(a),tt(e,t.url),c);d.onload=(e=>i(m(e,c.method))),d.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),d.ontimeout=Je(s)})(e=>{f.aborted||(c(e),f.serverId=e,y())}),{abort:()=>{f.aborted=!0,p.forEach(e=>{clearTimeout(e.timeout),e.request&&e.request.abort()})}}},ct=(e="",t,r,o)=>"function"==typeof t?(...e)=>t(r,...e,o):t&&U(t.url)?((e,t,r,o)=>(n,i,s,a,l,c,d)=>{if(!n)return;const p=o.chunkUploads,E=p&&n.size>o.chunkSize,u=p&&(E||o.chunkForce);if(n instanceof Blob&&u)return lt(e,t,r,n,i,s,a,l,c,d,o);const _=t.ondata||(e=>e),T=t.onload||(e=>e),f=t.onerror||(e=>null),I="function"==typeof t.headers?t.headers(n,i)||{}:{...t.headers},m={...t,headers:I};var h=new FormData;X(i)&&h.append(r,JSON.stringify(i)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(e=>{h.append(r,e.file,null===e.name?e.file.name:`${e.name}${e.file.name}`)});const R=Ze(_(h),tt(e,t.url),m);return R.onload=(e=>{s(Ke("load",e.status,T(e.response),e.getAllResponseHeaders()))}),R.onerror=(e=>{a(Ke("error",e.status,f(e.response)||e.statusText,e.getAllResponseHeaders()))}),R.ontimeout=Je(a),R.onprogress=l,R.onabort=c,R})(e,t,r,o):null,dt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return(e,t)=>t();const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s)=>{const a=Ze(n,e+t.url,t);return a.onload=(e=>{i(Ke("load",e.status,r(e.response),e.getAllResponseHeaders()))}),a.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),a.ontimeout=Je(s),a}},pt=(e=0,t=1)=>e+Math.random()*(t-e),Et=(e,t)=>{const r={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},{allowMinimumUploadDuration:o}=t,n=()=>{r.request&&(r.perceivedPerformanceUpdater.clear(),r.request.abort&&r.request.abort(),r.complete=!0)},i=o?()=>r.progress?Math.min(r.progress,r.perceivedProgress):null:()=>r.progress||null,s=o?()=>Math.min(r.duration,r.perceivedDuration):()=>r.duration,a={...ae(),process:(t,n)=>{const i=()=>{0!==r.duration&&null!==r.progress&&a.fire("progress",a.getProgress())},s=()=>{r.complete=!0,a.fire("load-perceived",r.response.body)};a.fire("start"),r.timestamp=Date.now(),r.perceivedPerformanceUpdater=((e,t=1e3,r=0,o=25,n=250)=>{let i=null;const s=Date.now(),a=()=>{let r=Date.now()-s,l=pt(o,n);r+l>t&&(l=r+l-t);let c=r/t;c>=1||document.hidden?e(1):(e(c),i=setTimeout(a,l))};return t>0&&a(),{clear:()=>{clearTimeout(i)}}})(e=>{r.perceivedProgress=e,r.perceivedDuration=Date.now()-r.timestamp,i(),r.response&&1===r.perceivedProgress&&!r.complete&&s()},o?pt(750,1500):0),r.request=e(t,n,e=>{r.response=X(e)?e:{type:"load",code:200,body:`${e}`,headers:{}},r.duration=Date.now()-r.timestamp,r.progress=1,a.fire("load",r.response.body),(!o||o&&1===r.perceivedProgress)&&s()},e=>{r.perceivedPerformanceUpdater.clear(),a.fire("error",X(e)?e:{type:"error",code:0,body:`${e}`})},(e,t,o)=>{r.duration=Date.now()-r.timestamp,r.progress=e?t/o:null,i()},()=>{r.perceivedPerformanceUpdater.clear(),a.fire("abort",r.response?r.response.body:null)},e=>{a.fire("transfer",e)})},abort:n,getProgress:i,getDuration:s,reset:()=>{n(),r.complete=!1,r.perceivedProgress=0,r.progress=0,r.timestamp=null,r.perceivedDuration=0,r.duration=0,r.request=null,r.response=null}};return a},ut=e=>e.substr(0,e.lastIndexOf("."))||e,_t=e=>!!(e instanceof File||e instanceof Blob&&e.name),Tt=e=>{if(!X(e))return e;const t=M(e)?[]:{};for(const r in e){if(!e.hasOwnProperty(r))continue;const o=e[r];t[r]=o&&X(o)?Tt(o):o}return t},ft=(e=null,r=null,o=null)=>{const n=ie(),i={archived:!1,frozen:!1,released:!1,source:null,file:o,serverFileReference:r,transferId:null,processingAborted:!1,status:r?pe.PROCESSING_COMPLETE:pe.INIT,activeLoader:null,activeProcessor:null};let s=null;const a={},l=e=>i.status=e,c=(e,...t)=>{i.released||i.frozen||E.fire(e,...t)},d=(e,t)=>{if(i.processingAborted)return void(i.processingAborted=!1);if(l(pe.PROCESSING),s=null,!(i.file instanceof Blob))return void E.on("load",()=>{d(e,t)});e.on("load",e=>{i.transferId=null,i.serverFileReference=e}),e.on("transfer",e=>{i.transferId=e}),e.on("load-perceived",e=>{i.activeProcessor=null,i.transferId=null,i.serverFileReference=e,l(pe.PROCESSING_COMPLETE),c("process-complete",e)}),e.on("start",()=>{c("process-start")}),e.on("error",e=>{i.activeProcessor=null,l(pe.PROCESSING_ERROR),c("process-error",e)}),e.on("abort",e=>{i.activeProcessor=null,i.serverFileReference=e,l(pe.IDLE),c("process-abort"),s&&s()}),e.on("progress",e=>{c("process-progress",e)});const r=console.error;t(i.file,t=>{i.archived||e.process(t,{...a})},r),i.activeProcessor=e},p=(e,t,r)=>{const o=e.split("."),n=o[0],i=o.pop();let s=a;o.forEach(e=>s=s[e]),JSON.stringify(s[i])!==JSON.stringify(t)&&(s[i]=t,c("metadata-update",{key:n,value:a[n],silent:r}))},E={id:{get:()=>n},origin:{get:()=>e,set:t=>e=t},serverId:{get:()=>i.serverFileReference},transferId:{get:()=>i.transferId},status:{get:()=>i.status},filename:{get:()=>i.file.name},filenameWithoutExtension:{get:()=>ut(i.file.name)},fileExtension:{get:()=>Fe(i.file.name)},fileType:{get:()=>i.file.type},fileSize:{get:()=>i.file.size},file:{get:()=>i.file},relativePath:{get:()=>i.file._relativePath},source:{get:()=>i.source},getMetadata:e=>Tt(e?a[e]:a),setMetadata:(e,t,r)=>{if(X(e)){const r=e;return Object.keys(r).forEach(e=>{p(e,r[e],t)}),e}return p(e,t,r),t},extend:(e,t)=>u[e]=t,abortLoad:()=>{i.activeLoader?i.activeLoader.abort():(l(pe.INIT),c("load-abort"))},retryLoad:()=>{i.activeLoader&&i.activeLoader.load()},requestProcessing:()=>{i.processingAborted=!1,l(pe.PROCESSING_QUEUED)},abortProcessing:()=>new Promise(e=>{if(!i.activeProcessor)return i.processingAborted=!0,l(pe.IDLE),c("process-abort"),void e();s=(()=>{e()}),i.activeProcessor.abort()}),load:(t,r,o)=>{i.source=t,E.fireSync("init"),i.file?E.fireSync("load-skip"):(i.file=(e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||Ue(e)?t[0]=e.name||Ve():Ue(e)?(t[1]=e.length,t[2]=He(e)):U(e)&&(t[0]=Be(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}})(t),r.on("init",()=>{c("load-init")}),r.on("meta",t=>{i.file.size=t.size,i.file.filename=t.filename,t.source&&(e=Ee.LIMBO,i.serverFileReference=t.source,i.status=pe.PROCESSING_COMPLETE),c("load-meta")}),r.on("progress",e=>{l(pe.LOADING),c("load-progress",e)}),r.on("error",e=>{l(pe.LOAD_ERROR),c("load-request-error",e)}),r.on("abort",()=>{l(pe.INIT),c("load-abort")}),r.on("load",t=>{i.activeLoader=null;const r=t=>{i.file=_t(t)?t:i.file,e===Ee.LIMBO&&i.serverFileReference?l(pe.PROCESSING_COMPLETE):l(pe.IDLE),c("load")};i.serverFileReference?r(t):o(t,r,e=>{i.file=t,c("load-meta"),l(pe.LOAD_ERROR),c("load-file-error",e)})}),r.setSource(t),i.activeLoader=r,r.load())},process:d,revert:(e,t)=>new Promise((r,o)=>{const n=null!==i.serverFileReference?i.serverFileReference:i.transferId;null!==n?(e(n,()=>{i.serverFileReference=null,i.transferId=null,r()},e=>{t?(l(pe.PROCESSING_REVERT_ERROR),c("process-revert-error"),o(e)):r()}),l(pe.IDLE),c("process-revert")):r()}),...ae(),freeze:()=>i.frozen=!0,release:()=>i.released=!0,released:{get:()=>i.released},archive:()=>i.archived=!0,archived:{get:()=>i.archived}},u=t(E);return u},It=(e,t)=>{const r=((e,t)=>b(t)?0:U(t)?e.findIndex(e=>e.id===t):-1)(e,t);if(!(r<0))return e[r]||null},mt=(e,t,r,o,n,i)=>{const s=Ze(null,e,{method:"GET",responseType:"blob"});return s.onload=(r=>{const o=r.getAllResponseHeaders(),n=ze(o).name||Be(e);t(Ke("load",r.status,xe(r.response,n),o))}),s.onerror=(e=>{r(Ke("error",e.status,e.statusText,e.getAllResponseHeaders()))}),s.onheaders=(e=>{i(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),s.ontimeout=Je(r),s.onprogress=o,s.onabort=n,s},ht=e=>(0===e.indexOf("//")&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),Rt=e=>(...t)=>Y(e)?e(...t):e,gt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:Se(t.items)})},0)},Ot=(e,...t)=>new Promise(r=>{if(!e)return r(!0);const o=e(...t);return null==o?r(!0):"boolean"==typeof o?r(o):void("function"==typeof o.then&&o.then(r))}),Dt=(e,t)=>{e.items.sort((e,r)=>t(de(e),de(r)))},St=(e,t)=>({query:r,success:o=(()=>{}),failure:n=(()=>{}),...i}={})=>{const s=Oe(e.items,r);s?t(s,o,n,i||{}):n({error:Ke("error",0,"Item not found"),file:null})},yt=(e,t,r)=>({ABORT_ALL:()=>{Se(r.items).forEach(e=>{e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:({value:t=[]})=>{const o=t.map(e=>({source:e.source?e.source:e,options:e.options}));let n=Se(r.items);n.forEach(t=>{o.find(e=>e.source===t.source||e.source===t.file)||e("REMOVE_ITEM",{query:t,remove:!1})}),n=Se(r.items),o.forEach((t,r)=>{n.find(e=>e.source===t.source||e.file===t.source)||e("ADD_ITEM",{...t,interactionMethod:ne,index:r})})},DID_UPDATE_ITEM_METADATA:({id:o,action:n,change:i})=>{i.silent||(clearTimeout(r.itemUpdateTimeout),r.itemUpdateTimeout=setTimeout(()=>{const s=It(r.items,o);if(!t("IS_ASYNC"))return void Ie("SHOULD_PREPARE_OUTPUT",!1,{item:s,query:t,action:n,change:i}).then(r=>{const n=t("GET_BEFORE_PREPARE_FILE");n&&(r=n(s,r)),r&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:s,success:t=>{e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)});s.origin===Ee.LOCAL&&e("DID_LOAD_ITEM",{id:s.id,error:null,serverFileReference:s.source});const a=()=>{setTimeout(()=>{e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return s.status===pe.PROCESSING_COMPLETE?(e=>{s.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(e?a:()=>{}).catch(()=>{})})(r.options.instantUpload):s.status===pe.PROCESSING?(e=>{s.abortProcessing().then(e?a:()=>{})})(r.options.instantUpload):void(r.options.instantUpload&&a())},0))},MOVE_ITEM:({query:e,index:t})=>{const o=Oe(r.items,e);if(!o)return;const n=r.items.indexOf(o);n!==(t=Ge(t,0,r.items.length-1))&&r.items.splice(t,0,r.items.splice(n,1)[0])},SORT:({compare:o})=>{Dt(r,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:r,index:o,interactionMethod:n,success:i=(()=>{}),failure:s=(()=>{})})=>{let a=o;if(-1===o||void 0===o){const e=t("GET_ITEM_INSERT_LOCATION"),r=t("GET_TOTAL_ITEMS");a="before"===e?0:r}const l=t("GET_IGNORED_FILES"),c=r.filter(e=>_t(e)?!l.includes(e.name.toLowerCase()):!b(e)).map(t=>new Promise((r,o)=>{e("ADD_ITEM",{interactionMethod:n,source:t.source||t,success:r,failure:o,index:a++,options:t.options||{}})}));Promise.all(c).then(i).catch(s)},ADD_ITEM:({source:o,index:n=-1,interactionMethod:i,success:s=(()=>{}),failure:a=(()=>{}),options:l={}})=>{if(b(o))return void a({error:Ke("error",0,"No source"),file:null});if(_t(o)&&r.options.ignoredFiles.includes(o.name.toLowerCase()))return;if(!(e=>{const t=Se(e.items).length;if(!e.options.allowMultiple)return 0===t;const r=e.options.maxFiles;return null===r||t{d&&e("ADD_ITEM",{source:o,index:n,interactionMethod:i,success:s,failure:a,options:l})}).catch(()=>{}),d)return}e("REMOVE_ITEM",{query:c.id})}const c="local"===l.type?Ee.LOCAL:"limbo"===l.type?Ee.LIMBO:Ee.INPUT,d=ft(c,c===Ee.INPUT?null:o,l.file);Object.keys(l.metadata||{}).forEach(e=>{d.setMetadata(e,l.metadata[e])}),me("DID_CREATE_ITEM",d,{query:t,dispatch:e});const p=t("GET_ITEM_INSERT_LOCATION");r.options.itemInsertLocationFreedom||(n="before"===p?-1:r.items.length),((e,t,r)=>b(t)?null:void 0===r?(e.push(t),t):(((e,t,r)=>e.splice(t,0,r))(e,r=Ge(r,0,e.length),t),t))(r.items,d,n),Y(p)&&o&&Dt(r,p);const E=d.id;d.on("init",()=>{e("DID_INIT_ITEM",{id:E})}),d.on("load-init",()=>{e("DID_START_ITEM_LOAD",{id:E})}),d.on("load-meta",()=>{e("DID_UPDATE_ITEM_META",{id:E})}),d.on("load-progress",t=>{e("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:E,progress:t})}),d.on("load-request-error",t=>{const o=Rt(r.options.labelFileLoadError)(t);if(t.code>=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:E,error:t,status:{main:o,sub:`${t.code} (${t.body})`}}),void a({error:t,file:de(d)});e("DID_THROW_ITEM_LOAD_ERROR",{id:E,error:t,status:{main:o,sub:r.options.labelTapToRetry}})}),d.on("load-file-error",t=>{e("DID_THROW_ITEM_INVALID",{id:E,error:t.status,status:t.status}),a({error:t.status,file:de(d)})}),d.on("load-abort",()=>{e("REMOVE_ITEM",{query:E})}),d.on("load-skip",()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}})}),d.on("load",()=>{const n=n=>{n?(d.on("metadata-update",t=>{e("DID_UPDATE_ITEM_METADATA",{id:E,change:t})}),Ie("SHOULD_PREPARE_OUTPUT",!1,{item:d,query:t}).then(n=>{const i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(d,n));const a=()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}}),gt(e,r)};n?e("REQUEST_PREPARE_OUTPUT",{query:E,item:d,success:t=>{e("DID_PREPARE_OUTPUT",{id:E,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:E})};Ie("DID_LOAD_ITEM",d,{query:t,dispatch:e}).then(()=>{Ot(t("GET_BEFORE_ADD_FILE"),de(d)).then(n)}).catch(t=>{if(!t||!t.error||!t.status)return n(!1);e("DID_THROW_ITEM_INVALID",{id:E,error:t.error,status:t.status})})}),d.on("process-start",()=>{e("DID_START_ITEM_PROCESSING",{id:E})}),d.on("process-progress",t=>{e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:E,progress:t})}),d.on("process-error",t=>{e("DID_THROW_ITEM_PROCESSING_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-revert-error",t=>{e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingRevertError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-complete",t=>{e("DID_COMPLETE_ITEM_PROCESSING",{id:E,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:E,value:t})}),d.on("process-abort",()=>{e("DID_ABORT_ITEM_PROCESSING",{id:E})}),d.on("process-revert",()=>{e("DID_REVERT_ITEM_PROCESSING",{id:E}),e("DID_DEFINE_VALUE",{id:E,value:null})}),e("DID_ADD_ITEM",{id:E,index:n,interactionMethod:i}),gt(e,r);const{url:u,load:_,restore:T,fetch:f}=r.options.server||{};d.load(o,je(c===Ee.INPUT?U(o)&&(e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&ht(location.href)!==ht(e))(o)&&f?rt(u,f):mt:rt(u,c===Ee.LIMBO?T:_)),(e,r,o)=>{Ie("LOAD_FILE",e,{query:t}).then(r).catch(o)})},REQUEST_PREPARE_OUTPUT:({item:e,success:r,failure:o=(()=>{})})=>{const n={error:Ke("error",0,"Item not found"),file:null};if(e.archived)return o(n);Ie("PREPARE_OUTPUT",e.file,{query:t,item:e}).then(i=>{Ie("COMPLETE_PREPARE_OUTPUT",i,{query:t,item:e}).then(t=>{if(e.archived)return o(n);r(t)})})},COMPLETE_LOAD_ITEM:({item:o,data:n})=>{const{success:i,source:s}=n,a=t("GET_ITEM_INSERT_LOCATION");if(Y(a)&&s&&Dt(r,a),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===Ee.INPUT?null:s}),i(de(o)),o.origin!==Ee.LOCAL)return o.origin===Ee.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&r.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:St(r,e=>{e.retryLoad()}),REQUEST_ITEM_PREPARE:St(r,(t,r,o)=>{e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:o=>{e("DID_PREPARE_OUTPUT",{id:t.id,file:o}),r({file:t,output:o})},failure:o},!0)}),REQUEST_ITEM_PROCESSING:St(r,(o,n,i)=>{if(o.status===pe.IDLE||o.status===pe.PROCESSING_ERROR)o.status!==pe.PROCESSING_QUEUED&&(o.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:o.id}),e("PROCESS_ITEM",{query:o,success:n,failure:i},!0));else{const s=()=>e("REQUEST_ITEM_PROCESSING",{query:o,success:n,failure:i}),a=()=>document.hidden?s():setTimeout(s,32);o.status===pe.PROCESSING_COMPLETE||o.status===pe.PROCESSING_REVERT_ERROR?o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(a).catch(()=>{}):o.status===pe.PROCESSING&&o.abortProcessing().then(a)}}),PROCESS_ITEM:St(r,(o,n,i)=>{const s=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",pe.PROCESSING).length===s)return void r.processingQueue.push({id:o.id,success:n,failure:i});if(o.status===pe.PROCESSING)return;const a=()=>{const t=r.processingQueue.shift();if(!t)return;const{id:o,success:n,failure:i}=t,s=Oe(r.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:n,failure:i},!0):a()};o.onOnce("process-complete",()=>{n(de(o)),a();const i=r.options.server;if(r.options.instantUpload&&o.origin===Ee.LOCAL&&Y(i.remove)){const e=()=>{};o.origin=Ee.LIMBO,r.options.server.remove(o.source,e,e)}t("GET_ITEMS_BY_STATUS",pe.PROCESSING_COMPLETE).length===r.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),o.onOnce("process-error",e=>{i({error:e,file:de(o)}),a()});const l=r.options;o.process(Et(ct(l.server.url,l.server.process,l.name,{chunkTransferId:o.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),(r,n,i)=>{Ie("PREPARE_OUTPUT",r,{query:t,item:o}).then(t=>{e("DID_PREPARE_OUTPUT",{id:o.id,file:t}),n(t)}).catch(i)})}),RETRY_ITEM_PROCESSING:St(r,t=>{e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:St(r,r=>{Ot(t("GET_BEFORE_REMOVE_FILE"),de(r)).then(t=>{t&&e("REMOVE_ITEM",{query:r})})}),RELEASE_ITEM:St(r,e=>{e.release()}),REMOVE_ITEM:St(r,(o,n,i,s)=>{const a=()=>{const t=o.id;It(r.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:o}),gt(e,r),n(de(o))},l=r.options.server;o.origin===Ee.LOCAL&&l&&Y(l.remove)&&!1!==s.remove?(e("DID_START_ITEM_REMOVE",{id:o.id}),l.remove(o.source,()=>a(),t=>{e("DID_THROW_ITEM_REMOVE_ERROR",{id:o.id,error:Ke("error",0,t,null),status:{main:Rt(r.options.labelFileRemoveError)(t),sub:r.options.labelTapToRetry}})})):((s.revert&&o.origin!==Ee.LOCAL&&null!==o.serverId||r.options.chunkUploads&&o.file.size>r.options.chunkSize||r.options.chunkUploads&&r.options.chunkForce)&&o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")),a())}),ABORT_ITEM_LOAD:St(r,e=>{e.abortLoad()}),ABORT_ITEM_PROCESSING:St(r,t=>{t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(()=>{r.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:St(r,o=>{if(!r.options.instantUpload)return void e("REVERT_ITEM_PROCESSING",{query:o});const n=t=>{t&&e("REVERT_ITEM_PROCESSING",{query:o})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return n(!0);const s=i(de(o));return null==s?n(!0):"boolean"==typeof s?n(s):void("function"==typeof s.then&&s.then(n))}),REVERT_ITEM_PROCESSING:St(r,o=>{o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(()=>{(r.options.instantUpload||(e=>!_t(e.file))(o))&&e("REMOVE_ITEM",{query:o.id})}).catch(()=>{})}),SET_OPTIONS:({options:t})=>{const r=Object.keys(t),o=At.filter(e=>r.includes(e));[...o,...Object.keys(t).filter(e=>!o.includes(e))].forEach(r=>{e(`SET_${Q(r,"_").toUpperCase()}`,{value:t[r]})})}}),At=["server"],Lt=e=>e,Pt=e=>document.createElement(e),vt=(e,t)=>{let r=e.childNodes[0];r?t!==r.nodeValue&&(r.nodeValue=t):(r=document.createTextNode(t),e.appendChild(r))},Mt=(e,t,r,o)=>{const n=(o%360-90)*Math.PI/180;return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}},bt=(e,t,r,o,n)=>{let i=1;return n>o&&n-o<=.5&&(i=0),o>n&&o-n>=.5&&(i=0),((e,t,r,o,n,i)=>{const s=Mt(e,t,r,n),a=Mt(e,t,r,o);return["M",s.x,s.y,"A",r,r,0,i,0,a.x,a.y].join(" ")})(e,t,r,360*Math.min(.9999,o),360*Math.min(.9999,n),i)},Ct=A({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:({root:e,props:t})=>{t.spin=!1,t.progress=0,t.opacity=0;const r=i("svg");e.ref.path=i("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(e.ref.path),e.ref.svg=r,e.appendChild(r)},write:({root:e,props:t})=>{if(0===t.opacity)return;t.align&&(e.element.dataset.align=t.align);const o=parseInt(r(e.ref.path,"stroke-width"),10),n=.5*e.rect.element.width;let i=0,s=0;t.spin?(i=0,s=.5):(i=0,s=t.progress);const a=bt(n,n,n-o,i,s);r(e.ref.path,"d",a),r(e.ref.path,"stroke-opacity",t.spin||t.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}}}}),Nt=A({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:({root:e,props:t})=>{e.element.innerHTML=(t.icon||"")+`${t.label}`,t.isDisabled=!1},write:({root:e,props:t})=>{const{isDisabled:o}=t,n=e.query("GET_DISABLED")||0===t.opacity;n&&!o?(t.isDisabled=!0,r(e.element,"disabled","disabled")):!n&&o&&(t.isDisabled=!1,e.element.removeAttribute("disabled"))}}),wt=(e,t=".",r=1e3,o={})=>{const{labelBytes:n="bytes",labelKilobytes:i="KB",labelMegabytes:s="MB",labelGigabytes:a="GB"}=o,l=r,c=r*r,d=r*r*r;return(e=Math.round(Math.abs(e)))e.toFixed(t).split(".").filter(e=>"0"!==e).join(r),Ut=({root:e,props:t})=>{vt(e.ref.fileSize,wt(e.query("GET_ITEM_SIZE",t.id),".",e.query("GET_FILE_SIZE_BASE"),e.query("GET_FILE_SIZE_LABELS",e.query))),vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))},Bt=({root:e,props:t})=>{V(e.query("GET_ITEM_SIZE",t.id))?Ut({root:e,props:t}):vt(e.ref.fileSize,e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},Ft=A({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:Ut,DID_UPDATE_ITEM_META:Ut,DID_THROW_ITEM_LOAD_ERROR:Bt,DID_THROW_ITEM_INVALID:Bt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e,props:t})=>{const o=Pt("span");o.className="filepond--file-info-main",r(o,"aria-hidden","true"),e.appendChild(o),e.ref.fileName=o;const n=Pt("span");n.className="filepond--file-info-sub",e.appendChild(n),e.ref.fileSize=n,vt(n,e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),vt(o,Lt(e.query("GET_ITEM_NAME",t.id)))},mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),qt=e=>Math.round(100*e),Vt=({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_LOADING"):`${e.query("GET_LABEL_FILE_LOADING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},xt=({root:e})=>{vt(e.ref.main,""),vt(e.ref.sub,"")},Yt=({root:e,action:t})=>{vt(e.ref.main,t.status.main),vt(e.ref.sub,t.status.sub)},Ht=A({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:xt,DID_REVERT_ITEM_PROCESSING:xt,DID_REQUEST_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_ABORTED")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_PROCESSING"):`${e.query("GET_LABEL_FILE_PROCESSING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:Vt,DID_THROW_ITEM_LOAD_ERROR:Yt,DID_THROW_ITEM_INVALID:Yt,DID_THROW_ITEM_PROCESSING_ERROR:Yt,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Yt,DID_THROW_ITEM_REMOVE_ERROR:Yt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e})=>{const t=Pt("span");t.className="filepond--file-status-main",e.appendChild(t),e.ref.main=t;const r=Pt("span");r.className="filepond--file-status-sub",e.appendChild(r),e.ref.sub=r,Vt({root:e,action:{progress:null}})},mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),kt={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"}},Xt=[];e(kt,e=>{Xt.push(e)});const $t=e=>{if("right"===Qt(e))return 0;const t=e.ref.buttonRemoveItem.rect.element;return t.hidden?null:t.width+t.left},Wt=e=>{return e.ref.buttonAbortItemLoad.rect.element.width},zt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.height/4),jt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.left/2),Qt=e=>e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Zt={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:e=>e.query("GET_STYLE_LOAD_INDICATOR_POSITION")},processProgressIndicator:{opacity:0,align:e=>e.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}},Kt={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},Jt={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},er={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t,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:$t},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:Qt},info:{translateX:$t},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:Qt},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1,translateX:$t}},DID_LOAD_ITEM:Kt,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},DID_START_ITEM_PROCESSING:Jt,DID_REQUEST_ITEM_PROCESSING:Jt,DID_UPDATE_ITEM_PROCESS_PROGRESS:Jt,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:$t}},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:$t},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:Kt},tr=A({create:({root:e})=>{e.element.innerHTML=e.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}}}}),rr=L({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:e,action:t})=>{e.ref.buttonAbortItemProcessing.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:e,action:t})=>{e.ref.buttonAbortItemLoad.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:e,action:t})=>{e.ref.buttonAbortItemRemoval.label=t.value},DID_REQUEST_ITEM_PROCESSING:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:e})=>{e.ref.loadProgressIndicator.spin=!0,e.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:e,action:t})=>{e.ref.loadProgressIndicator.spin=!1,e.ref.loadProgressIndicator.progress=t.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{e.ref.processProgressIndicator.spin=!1,e.ref.processProgressIndicator.progress=t.progress}}),or=A({create:({root:t,props:r})=>{const o=Object.keys(kt).reduce((e,t)=>(e[t]={...kt[t]},e),{}),{id:n}=r,i=t.query("GET_ALLOW_REVERT"),s=t.query("GET_ALLOW_REMOVE"),a=t.query("GET_ALLOW_PROCESS"),l=t.query("GET_INSTANT_UPLOAD"),c=t.query("IS_ASYNC"),d=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");let p;c?a&&!i?p=(e=>!/RevertItemProcessing/.test(e)):!a&&i?p=(e=>!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(e)):a||i||(p=(e=>!/Process/.test(e))):p=(e=>!/Process/.test(e));const E=p?Xt.filter(p):Xt.concat();if(l&&i&&(o.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",o.RevertItemProcessing.icon="GET_ICON_REMOVE"),c&&!i){const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=jt,e.info.translateY=zt,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(c&&!a&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach(e=>{er[e].status.translateY=zt}),er.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=Wt),d&&i){o.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=$t,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}s||(o.RemoveItem.disabled=!0),e(o,(e,r)=>{const o=t.createChildView(Nt,{label:t.query(r.label),icon:t.query(r.icon),opacity:0});E.includes(e)&&t.appendChildView(o),r.disabled&&(o.element.setAttribute("disabled","disabled"),o.element.setAttribute("hidden","hidden")),o.element.dataset.align=t.query(`GET_STYLE_${r.align}`),o.element.classList.add(r.className),o.on("click",e=>{e.stopPropagation(),r.disabled||t.dispatch(r.action,{query:n})}),t.ref[`button${e}`]=o}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(tr)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(Ft,{id:n})),t.ref.status=t.appendChildView(t.createChildView(Ht,{id:n}));const u=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));u.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=u;const _=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));_.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=_,t.ref.activeStyles=[]},write:({root:t,actions:r,props:o})=>{rr({root:t,actions:r,props:o});let n=r.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>er[e.type]);if(n){t.ref.activeStyles=[];const r=er[n.type];e(Zt,(o,n)=>{const i=t.ref[o];e(n,(e,n)=>{const s=r[o]&&void 0!==r[o][e]?r[o][e]:n;t.ref.activeStyles.push({control:i,key:e,value:s})})})}t.ref.activeStyles.forEach(({control:e,key:r,value:o})=>{e[r]="function"==typeof o?o(t):o})},didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},name:"file"}),nr=A({create:({root:e,props:t})=>{e.ref.fileName=Pt("legend"),e.appendChild(e.ref.fileName),e.ref.file=e.appendChildView(e.createChildView(or,{id:t.id})),e.ref.data=!1},ignoreRect:!0,write:L({DID_LOAD_ITEM:({root:e,props:t})=>{vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))}}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},tag:"fieldset",name:"file-wrapper"}),ir={type:"spring",damping:.6,mass:7},sr=(e,t,r)=>{const o=A({name:`panel-${t.name} filepond--${r}`,mixins:t.mixins,ignoreRectUpdate:!0}),n=e.createChildView(o,t.props);e.ref[t.name]=e.appendChildView(n)},ar=A({name:"panel",read:({root:e,props:t})=>t.heightCurrent=e.ref.bottom.translateY,write:({root:e,props:t})=>{if(null!==e.ref.scalable&&t.scalable===e.ref.scalable||(e.ref.scalable=!w(t.scalable)||t.scalable,e.element.dataset.scalable=e.ref.scalable),!t.height)return;const r=e.ref.top.rect.element,o=e.ref.bottom.rect.element,n=Math.max(r.height+o.height,t.height);e.ref.center.translateY=r.height,e.ref.center.scaleY=(n-r.height-o.height)/100,e.ref.bottom.translateY=n-o.height},create:({root:e,props:t})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:ir},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:ir},styles:["translateY"]}}].forEach(r=>{sr(e,r,t.name)}),e.element.classList.add(`filepond--${t.name}`),e.ref.scalable=null},ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),lr={type:"spring",stiffness:.75,damping:.45,mass:10},cr={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"},dr=L({DID_UPDATE_PANEL_HEIGHT:({root:e,action:t})=>{e.height=t.height}}),pr=L({DID_GRAB_ITEM:({root:e,props:t})=>{t.dragOrigin={x:e.translateX,y:e.translateY}},DID_DRAG_ITEM:({root:e})=>{e.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:e,props:t})=>{t.dragOffset=null,t.dragOrigin=null,e.element.dataset.dragState="drop"}},({root:e,actions:t,props:r,shouldOptimize:o})=>{"drop"===e.element.dataset.dragState&&e.scaleX<=1&&(e.element.dataset.dragState="idle");let n=t.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>cr[e.type]);n&&n.type!==r.currentState&&(r.currentState=n.type,e.element.dataset.filepondItemState=cr[r.currentState]||"");const i=e.query("GET_ITEM_PANEL_ASPECT_RATIO")||e.query("GET_PANEL_ASPECT_RATIO");i?o||(e.height=e.rect.element.width*i):(dr({root:e,actions:t,props:r}),!e.height&&e.ref.container.rect.element.height>0&&(e.height=e.ref.container.rect.element.height)),o&&(e.ref.panel.height=null),e.ref.panel.height=e.height}),Er=A({create:({root:e,props:t})=>{if(e.ref.handleClick=(r=>e.dispatch("DID_ACTIVATE_ITEM",{id:t.id})),e.element.id=`filepond--item-${t.id}`,e.element.addEventListener("click",e.ref.handleClick),e.ref.container=e.appendChildView(e.createChildView(nr,{id:t.id})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"item-panel"})),e.ref.panel.height=null,t.markedForRemoval=!1,!e.query("GET_ALLOW_REORDER"))return;e.element.dataset.dragState="idle";e.element.addEventListener("pointerdown",r=>{if(!r.isPrimary)return;let o=!1;const n=r.pageX,i=r.pageY;t.dragOrigin={x:e.translateX,y:e.translateY},t.dragCenter={x:r.offsetX,y:r.offsetY};const s=(e=>{const t=e.map(e=>e.id);let r=void 0;return{setIndex:e=>{r=e},getIndex:()=>r,getItemIndex:e=>t.indexOf(e.id)}})(e.query("GET_ACTIVE_ITEMS"));e.dispatch("DID_GRAB_ITEM",{id:t.id,dragState:s});const a=r=>{r.isPrimary&&(r.stopPropagation(),r.preventDefault(),t.dragOffset={x:r.pageX-n,y:r.pageY-i},t.dragOffset.x*t.dragOffset.x+t.dragOffset.y*t.dragOffset.y>16&&!o&&(o=!0,e.element.removeEventListener("click",e.ref.handleClick)),e.dispatch("DID_DRAG_ITEM",{id:t.id,dragState:s}))},l=r=>{r.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",l),t.dragOffset={x:r.pageX-n,y:r.pageY-i},e.dispatch("DID_DROP_ITEM",{id:t.id,dragState:s}),o&&setTimeout(()=>e.element.addEventListener("click",e.ref.handleClick),0))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",l)})},write:pr,destroy:({root:e,props:t})=>{e.element.removeEventListener("click",e.ref.handleClick),e.dispatch("RELEASE_ITEM",{query:t.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:lr,translateY:lr,opacity:{type:"tween",duration:150}}}});var ur=(e,t)=>Math.max(1,Math.floor((e+1)/t));const _r=(e,t,r)=>{if(!r)return;const o=e.rect.element.width,n=t.length;let i=null;if(0===n||r.topa){if(r.left{e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=r,Date.now()>e.spawnDate&&(0===e.opacity&&Ir(e,t,r,o,n),e.scaleX=1,e.scaleY=1,e.opacity=1))},Ir=(e,t,r,o,n)=>{e.interactionMethod===ne?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=r):e.interactionMethod===te?(e.translateX=null,e.translateX=t-20*o,e.translateY=null,e.translateY=r-10*n,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=r-30):e.interactionMethod===ee&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},mr=e=>e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop,hr=L({DID_ADD_ITEM:({root:e,action:t})=>{const{id:r,index:o,interactionMethod:n}=t;e.ref.addIndex=o;const i=Date.now();let s=i,a=1;if(n!==ne){a=0;const t=e.query("GET_ITEM_INSERT_INTERVAL"),r=i-e.ref.lastItemSpanwDate;s=r{const{id:r}=t,o=e.childViews.find(e=>e.id===r);o&&(o.scaleX=.9,o.scaleY=.9,o.opacity=0,o.markedForRemoval=!0)},DID_DRAG_ITEM:({root:e,action:t})=>{const{id:r,dragState:o}=t,n=e.query("GET_ITEM",{id:r}),i=e.childViews.find(e=>e.id===r),s=e.childViews.length,a=o.getItemIndex(n);if(!i)return;const l=i.dragOrigin.x+i.dragOffset.x+i.dragCenter.x,c=i.dragOrigin.y+i.dragOffset.y+i.dragCenter.y,d=mr(i),p=(e=>e.rect.element.width+.5*e.rect.element.marginLeft+.5*e.rect.element.marginRight)(i);let E=Math.floor(e.rect.outer.width/p);E>s&&(E=s);const u=Math.floor(s/E+1);Tr.setHeight=d*u,Tr.setWidth=p*E;var _={y:Math.floor(c/d),x:Math.floor(l/p),getGridIndex:function(){return c>Tr.getHeight||c<0||l>Tr.getWidth||l<0?a:this.y*E+this.x},getColIndex:function(){const t=e.query("GET_ACTIVE_ITEMS"),r=e.childViews.filter(e=>e.rect.element.height),o=t.map(e=>r.find(t=>t.id===e.id)),n=o.findIndex(e=>e===i),s=mr(i),a=o.length;let l=a,d=0,p=0,E=0;for(let e=0;ee){if(c1?_.getGridIndex():_.getColIndex();e.dispatch("MOVE_ITEM",{query:i,index:T});const f=o.getIndex();if(void 0===f||f!==T){if(o.setIndex(T),void 0===f)return;e.dispatch("DID_REORDER_ITEMS",{items:e.query("GET_ACTIVE_ITEMS"),origin:a,target:T})}}}),Rr=A({create:({root:e})=>{r(e.element,"role","list"),e.ref.lastItemSpanwDate=Date.now()},write:({root:e,props:t,actions:r,shouldOptimize:o})=>{hr({root:e,props:t,actions:r});const{dragCoordinates:n}=t,i=e.rect.element.width,s=e.childViews.filter(e=>e.rect.element.height),a=e.query("GET_ACTIVE_ITEMS").map(e=>s.find(t=>t.id===e.id)).filter(e=>e),l=n?_r(e,a,n):null,c=e.ref.addIndex||null;e.ref.addIndex=null;let d=0,p=0,E=0;if(0===a.length)return;const u=a[0].rect.element,_=u.marginTop+u.marginBottom,T=u.marginLeft+u.marginRight,f=u.width+T,I=u.height+_,m=ur(i,f);if(1===m){let e=0,t=0;a.forEach((r,n)=>{if(l){let e=n-l;t=-2===e?.25*-_:-1===e?.75*-_:0===e?.75*_:1===e?.25*_:0}o&&(r.translateX=null,r.translateY=null),r.markedForRemoval||fr(r,0,e+t);let i=(r.rect.element.height+_)*(r.markedForRemoval?r.opacity:1);e+=i})}else{let e=0,t=0;a.forEach((r,n)=>{n===l&&(d=1),n===c&&(E+=1),r.markedForRemoval&&r.opacity<.5&&(p-=1);const i=n+E+d+p,s=i%m,a=Math.floor(i/m),u=s*f,_=a*I,T=Math.sign(u-e),h=Math.sign(_-t);e=u,t=_,r.markedForRemoval||(o&&(r.translateX=null,r.translateY=null),fr(r,u,_,T,h))})}},tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(e=>e.markedForRemoval&&0===e.opacity&&e.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:(e,t)=>t.filter(t=>!t.data||!t.data.id||e.id===t.data.id),mixins:{apis:["dragCoordinates"]}}),gr=L({DID_DRAG:({root:e,props:t,action:r})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:r.position.scopeLeft-e.ref.list.rect.element.left,top:r.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},DID_END_DRAG:({props:e})=>{e.dragCoordinates=null}}),Or=A({create:({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(Rr)),t.dragCoordinates=null,t.overflowing=!1},write:({root:e,props:t,actions:r})=>{if(gr({root:e,props:t,actions:r}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){const r=Math.round(t.overflow);r!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Dr=(e,t,o,n="")=>{o?r(e,t,n):e.removeAttribute(t)},Sr=({root:e,action:t})=>{e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Dr(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},yr=({root:e,action:t})=>{Dr(e.element,"multiple",t.value)},Ar=({root:e,action:t})=>{Dr(e.element,"webkitdirectory",t.value)},Lr=({root:e})=>{const t=e.query("GET_DISABLED"),r=e.query("GET_ALLOW_BROWSE"),o=t||!r;Dr(e.element,"disabled",o)},Pr=({root:e,action:t})=>{t.value?0===e.query("GET_TOTAL_ITEMS")&&Dr(e.element,"required",!0):Dr(e.element,"required",!1)},vr=({root:e,action:t})=>{Dr(e.element,"capture",!!t.value,!0===t.value?"":t.value)},Mr=({root:e})=>{const{element:t}=e;if(e.query("GET_TOTAL_ITEMS")>0)Dr(t,"required",!1),Dr(t,"name",!1);else{Dr(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&Dr(t,"required",!0)}},br=A({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,r(e.element,"name",e.query("GET_NAME")),r(e.element,"aria-controls",`filepond--assistant-${t.id}`),r(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),Sr({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),yr({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Ar({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Lr({root:e}),Pr({root:e,action:{value:e.query("GET_REQUIRED")}}),vr({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=(r=>{if(!e.element.value)return;const o=Array.from(e.element.files).map(e=>(e._relativePath=e.webkitRelativePath,e));setTimeout(()=>{t.onload(o),(e=>{if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){const t=Pt("form"),r=e.parentNode,o=e.nextSibling;t.appendChild(e),t.reset(),o?r.insertBefore(e,o):r.appendChild(e)}}})(e.element)},250)}),e.element.addEventListener("change",e.ref.handleChange)},destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:L({DID_LOAD_ITEM:Mr,DID_REMOVE_ITEM:Mr,DID_THROW_ITEM_INVALID:({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Lr,DID_SET_ALLOW_BROWSE:Lr,DID_SET_ALLOW_DIRECTORIES_ONLY:Ar,DID_SET_ALLOW_MULTIPLE:yr,DID_SET_ACCEPTED_FILE_TYPES:Sr,DID_SET_CAPTURE_METHOD:vr,DID_SET_REQUIRED:Pr})}),Cr=13,Nr=32,wr=(e,t)=>{e.innerHTML=t;const o=e.querySelector(".filepond--label-action");return o&&r(o,"tabindex","0"),t},Gr=A({name:"drop-label",ignoreRect:!0,create:({root:e,props:t})=>{const o=Pt("label");r(o,"for",`filepond--browser-${t.id}`),r(o,"id",`filepond--drop-label-${t.id}`),r(o,"aria-hidden","true"),e.ref.handleKeyDown=(t=>{(t.keyCode===Cr||t.keyCode===Nr)&&(t.preventDefault(),e.ref.label.click())}),e.ref.handleClick=(t=>{t.target===o||o.contains(t.target)||e.ref.label.click()}),o.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),wr(o,t.caption),e.appendChild(o),e.ref.label=o},destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:L({DID_SET_LABEL_IDLE:({root:e,action:t})=>{wr(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Ur=A({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}}}}),Br=L({DID_DRAG:({root:e,action:t})=>{e.ref.blob?(e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1):(({root:e})=>{const t=.5*e.rect.element.width,r=.5*e.rect.element.height;e.ref.blob=e.appendChildView(e.createChildView(Ur,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:r}))})({root:e})},DID_DROP:({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},DID_END_DRAG:({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)}}),Fr=A({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:({root:e,props:t,actions:r})=>{Br({root:e,props:t,actions:r});const{blob:o}=e.ref;0===r.length&&o&&0===o.opacity&&(e.removeChildView(o),e.ref.blob=null)}}),qr=(e,t)=>{try{const r=new DataTransfer;t.forEach(e=>{e instanceof File?r.items.add(e):r.items.add(new File([e],e.name,{type:e.type}))}),e.files=r.files}catch(e){return!1}return!0},Vr=(e,t)=>e.ref.fields[t],xr=e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Yr=({root:e})=>xr(e),Hr=L({DID_SET_DISABLED:({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},DID_ADD_ITEM:({root:e,action:t})=>{const r=!(e.query("GET_ITEM",t.id).origin===Ee.LOCAL)&&e.query("SHOULD_UPDATE_FILE_INPUT"),o=Pt("input");o.type=r?"file":"hidden",o.name=e.query("GET_NAME"),o.disabled=e.query("GET_DISABLED"),e.ref.fields[t.id]=o,xr(e)},DID_LOAD_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);if(!r)return;if(null!==t.serverFileReference&&(r.value=t.serverFileReference),!e.query("SHOULD_UPDATE_FILE_INPUT"))return;const o=e.query("GET_ITEM",t.id);qr(r,[o.file])},DID_REMOVE_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete e.ref.fields[t.id])},DID_DEFINE_VALUE:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(null===t.value?r.removeAttribute("value"):r.value=t.value,xr(e))},DID_PREPARE_OUTPUT:({root:e,action:t})=>{e.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{const r=Vr(e,t.id);r&&qr(r,[t.file])},0)},DID_REORDER_ITEMS:Yr,DID_SORT_ITEMS:Yr}),kr=A({tag:"fieldset",name:"data",create:({root:e})=>e.ref.fields={},write:Hr,ignoreRect:!0}),Xr=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],$r=["css","csv","html","txt"],Wr={zip:"zip|compressed",epub:"application/epub+zip"},zr=(e="")=>(e=e.toLowerCase(),Xr.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):$r.includes(e)?"text/"+e:Wr[e]||""),jr=e=>new Promise((t,r)=>{const o=io(e);if(o.length&&!Qr(e))return t(o);Zr(e).then(t)}),Qr=e=>!!e.files&&e.files.length>0,Zr=e=>new Promise((t,r)=>{const o=(e.items?Array.from(e.items):[]).filter(e=>Kr(e)).map(e=>Jr(e));o.length?Promise.all(o).then(e=>{const r=[];e.forEach(e=>{r.push.apply(r,e)}),t(r.filter(e=>e).map(e=>(e._relativePath||(e._relativePath=e.webkitRelativePath),e)))}).catch(console.error):t(e.files?Array.from(e.files):[])}),Kr=e=>{if(oo(e)){const t=no(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},Jr=e=>new Promise((t,r)=>{ro(e)?eo(no(e)).then(t).catch(r):t([e.getAsFile()])}),eo=e=>new Promise((t,r)=>{const o=[];let n=0,i=0;const s=()=>{0===i&&0===n&&t(o)},a=e=>{n++;const t=e.createReader(),l=()=>{t.readEntries(e=>{if(0===e.length)return n--,void s();e.forEach(e=>{e.isDirectory?a(e):(i++,e.file(t=>{const r=to(t);e.fullPath&&(r._relativePath=e.fullPath),o.push(r),i--,s()}))}),l()},r)};l()};a(e)}),to=e=>{if(e.type.length)return e;const t=e.lastModifiedDate,r=e.name,o=zr(Fe(e.name));return o.length?((e=e.slice(0,e.size,o)).name=r,e.lastModifiedDate=t,e):e},ro=e=>oo(e)&&(no(e)||{}).isDirectory,oo=e=>"webkitGetAsEntry"in e,no=e=>e.webkitGetAsEntry(),io=e=>{let t=[];try{if((t=ao(e)).length)return t;t=so(e)}catch(e){}return t},so=e=>{let t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},ao=e=>{let t=e.getData("text/html");if("string"==typeof t&&t.length){const e=t.match(/src\s*=\s*"(.+?)"/);if(e)return[e[1]]}return[]},lo=[],co=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),po=e=>{const t=lo.find(t=>t.element===e);if(t)return t;const r=Eo(e);return lo.push(r),r},Eo=t=>{const r=[],o={dragenter:fo,dragover:Io,dragleave:ho,drop:mo},n={};e(o,(e,o)=>{n[e]=o(t,r),t.addEventListener(e,n[e],!1)});const i={element:t,addListener:s=>(r.push(s),()=>{r.splice(r.indexOf(s),1),0===r.length&&(lo.splice(lo.indexOf(i),1),e(o,e=>{t.removeEventListener(e,n[e],!1)}))})};return i},uo=(e,t)=>{const r=((e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)))((e=>"getRootNode"in e?e.getRootNode():document)(t),{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)};let _o=null;const To=(e,t)=>{try{e.dropEffect=t}catch(e){}},fo=(e,t)=>e=>{e.preventDefault(),_o=e.target,t.forEach(t=>{const{element:r,onenter:o}=t;uo(e,r)&&(t.state="enter",o(co(e)))})},Io=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(o=>{let n=!1;t.some(t=>{const{filterElement:i,element:s,onenter:a,onexit:l,ondrag:c,allowdrop:d}=t;To(r,"copy");const p=d(o);if(p)if(uo(e,s)){if(n=!0,null===t.state)return t.state="enter",void a(co(e));if(t.state="over",i&&!p)return void To(r,"none");c(co(e))}else i&&!n&&To(r,"none"),t.state&&(t.state=null,l(co(e)));else To(r,"none")})})},mo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(r=>{t.forEach(t=>{const{filterElement:o,element:n,ondrop:i,onexit:s,allowdrop:a}=t;if(t.state=null,!o||uo(e,n))return a(r)?void i(co(e),r):s(co(e))})})},ho=(e,t)=>e=>{_o===e.target&&t.forEach(t=>{const{onexit:r}=t;t.state=null,r(co(e))})},Ro=(e,t,r)=>{e.classList.add("filepond--hopper");const{catchesDropsOnPage:o,requiresDropOnElement:n,filterItems:i=(e=>e)}=r,s=((e,t,r)=>{const o=po(t),n={element:e,filterElement:r,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=o.addListener(n),n})(e,o?document.documentElement:e,n);let a="",l="";s.allowdrop=(e=>t(i(e))),s.ondrop=((e,r)=>{const o=i(r);t(o)?(l="drag-drop",c.onload(o,e)):c.ondragend(e)}),s.ondrag=(e=>{c.ondrag(e)}),s.onenter=(e=>{l="drag-over",c.ondragstart(e)}),s.onexit=(e=>{l="drag-exit",c.ondragend(e)});const c={updateHopperState:()=>{a!==l&&(e.dataset.hopperState=l,a=l)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{s.destroy()}};return c};let go=!1;const Oo=[],Do=e=>{const t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){let e=!1,r=t;for(;r!==document.body;){if(r.classList.contains("filepond--root")){e=!0;break}r=r.parentNode}if(!e)return}jr(e.clipboardData).then(e=>{e.length&&Oo.forEach(t=>t(e))})},So=()=>{const e=e=>{t.onload(e)},t={destroy:()=>{(e=>{se(Oo,Oo.indexOf(e)),0===Oo.length&&(document.removeEventListener("paste",Do),go=!1)})(e)},onload:()=>{}};return(e=>{Oo.includes(e)||(Oo.push(e),go||(go=!0,document.addEventListener("paste",Do)))})(e),t};let yo=null,Ao=null;const Lo=[],Po=(e,t)=>{e.element.textContent=t},vo=(e,t,r)=>{const o=e.query("GET_TOTAL_ITEMS");Po(e,`${r} ${t}, ${o} ${1===o?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(Ao),Ao=setTimeout(()=>{(e=>{e.element.textContent=""})(e)},1500)},Mo=e=>e.element.parentNode.contains(document.activeElement),bo=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");Po(e,`${r} ${o}`)},Co=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename;Po(e,`${t.status.main} ${r} ${t.status.sub}`)},No=A({create:({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,r(e.element,"role","status"),r(e.element,"aria-live","polite"),r(e.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:({root:e,action:t})=>{if(!Mo(e))return;e.element.textContent="";const r=e.query("GET_ITEM",t.id);Lo.push(r.filename),clearTimeout(yo),yo=setTimeout(()=>{vo(e,Lo.join(", "),e.query("GET_LABEL_FILE_ADDED")),Lo.length=0},750)},DID_REMOVE_ITEM:({root:e,action:t})=>{if(!Mo(e))return;const r=t.item;vo(e,r.filename,e.query("GET_LABEL_FILE_REMOVED"))},DID_COMPLETE_ITEM_PROCESSING:({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Po(e,`${r} ${o}`)},DID_ABORT_ITEM_PROCESSING:bo,DID_REVERT_ITEM_PROCESSING:bo,DID_THROW_ITEM_REMOVE_ERROR:Co,DID_THROW_ITEM_LOAD_ERROR:Co,DID_THROW_ITEM_INVALID:Co,DID_THROW_ITEM_PROCESSING_ERROR:Co}),tag:"span",name:"assistant"}),wo=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),e=>e.charAt(1).toUpperCase()),Go=(e,t=16,r=!0)=>{let o=Date.now(),n=null;return(...i)=>{clearTimeout(n);const s=Date.now()-o,a=()=>{o=Date.now(),e(...i)};se.preventDefault(),Bo=e=>{const t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},Fo=e=>{let t=0,r=0;const o=e.ref.list,n=o.childViews[0],i=n.childViews.filter(e=>e.rect.element.height),s=e.query("GET_ACTIVE_ITEMS").map(e=>i.find(t=>t.id===e.id)).filter(e=>e);if(0===s.length)return{visual:t,bounds:r};const a=n.rect.element.width,l=_r(n,s,o.dragCoordinates),c=s[0].rect.element,d=c.marginTop+c.marginBottom,p=c.marginLeft+c.marginRight,E=c.width+p,u=c.height+d,_=void 0!==l&&l>=0?1:0,T=s.find(e=>e.markedForRemoval&&e.opacity<.45)?-1:0,f=s.length+_+T,I=ur(a,E);return 1===I?s.forEach(e=>{const o=e.rect.element.height+d;r+=o,t+=o*e.opacity}):(r=Math.ceil(f/I)*u,t=r),{visual:t,bounds:r}},qo=e=>{const t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Vo=(e,t)=>{const r=e.query("GET_ALLOW_REPLACE"),o=e.query("GET_ALLOW_MULTIPLE"),n=e.query("GET_TOTAL_ITEMS");let i=e.query("GET_MAX_FILES");const s=t.length;return!o&&s>1||!!(V(i=o?i:r?i:1)&&n+s>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ke("warning",0,"Max files")}),!0)},xo=(e,t,r)=>{const o=e.childViews[0];return _r(o,t,{left:r.scopeLeft-o.rect.element.left,top:r.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Yo=e=>{const t=e.query("GET_ALLOW_DROP"),r=e.query("GET_DISABLED"),o=t&&!r;if(o&&!e.ref.hopper){const t=Ro(e.element,t=>{const r=e.query("GET_BEFORE_DROP_FILE")||(()=>!0);return!e.query("GET_DROP_VALIDATION")||t.every(t=>me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(e=>!0===e)&&r(t))},{filterItems:t=>{const r=e.query("GET_IGNORED_FILES");return t.filter(e=>!_t(e)||!r.includes(e.name.toLowerCase()))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});t.onload=((t,r)=>{const o=e.ref.list.childViews[0].childViews.filter(e=>e.rect.element.height),n=e.query("GET_ACTIVE_ITEMS").map(e=>o.find(t=>t.id===e.id)).filter(e=>e);Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:xo(e.ref.list,n,r),interactionMethod:te})}),e.dispatch("DID_DROP",{position:r}),e.dispatch("DID_END_DRAG",{position:r})}),t.ondragstart=(t=>{e.dispatch("DID_START_DRAG",{position:t})}),t.ondrag=Go(t=>{e.dispatch("DID_DRAG",{position:t})}),t.ondragend=(t=>{e.dispatch("DID_END_DRAG",{position:t})}),e.ref.hopper=t,e.ref.drip=e.appendChildView(e.createChildView(Fr))}else!o&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Ho=(e,t)=>{const r=e.query("GET_ALLOW_BROWSE"),o=e.query("GET_DISABLED"),n=r&&!o;n&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(br,{...t,onload:t=>{Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})})}}),0):!n&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},ko=e=>{const t=e.query("GET_ALLOW_PASTE"),r=e.query("GET_DISABLED"),o=t&&!r;o&&!e.ref.paster?(e.ref.paster=So(),e.ref.paster.onload=(t=>{Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})})})):!o&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Xo=L({DID_SET_ALLOW_BROWSE:({root:e,props:t})=>{Ho(e,t)},DID_SET_ALLOW_DROP:({root:e})=>{Yo(e)},DID_SET_ALLOW_PASTE:({root:e})=>{ko(e)},DID_SET_DISABLED:({root:e,props:t})=>{Yo(e),ko(e),Ho(e,t),e.query("GET_DISABLED")?e.element.dataset.disabled="disabled":e.element.removeAttribute("data-disabled")}}),$o=A({name:"root",read:({root:e})=>{e.ref.measure&&(e.ref.measureHeight=e.ref.measure.offsetHeight)},create:({root:e,props:t})=>{const r=e.query("GET_ID");r&&(e.element.id=r);const o=e.query("GET_CLASS_NAME");o&&o.split(" ").filter(e=>e.length).forEach(t=>{e.element.classList.add(t)}),e.ref.label=e.appendChildView(e.createChildView(Gr,{...t,translateY:null,caption:e.query("GET_LABEL_IDLE")})),e.ref.list=e.appendChildView(e.createChildView(Or,{translateY:null})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"panel-root"})),e.ref.assistant=e.appendChildView(e.createChildView(No,{...t})),e.ref.data=e.appendChildView(e.createChildView(kr,{...t})),e.ref.measure=Pt("div"),e.ref.measure.style.height="100%",e.element.appendChild(e.ref.measure),e.ref.bounds=null,e.query("GET_STYLES").filter(e=>!b(e.value)).map(({name:t,value:r})=>{e.element.dataset[t]=r}),e.ref.widthPrevious=null,e.ref.widthUpdated=Go(()=>{e.ref.updateHistory=[],e.dispatch("DID_RESIZE_ROOT")},250),e.ref.previousAspectRatio=null,e.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,i="PointerEvent"in window;e.query("GET_ALLOW_REORDER")&&i&&!n&&(e.element.addEventListener("touchmove",Uo,{passive:!1}),e.element.addEventListener("gesturestart",Uo));const s=e.query("GET_CREDITS");if(2===s.length){const t=document.createElement("a");t.className="filepond--credits",t.setAttribute("aria-hidden","true"),t.href=s[0],t.tabindex=-1,t.target="_blank",t.rel="noopener noreferrer",t.textContent=s[1],e.element.appendChild(t),e.ref.credits=t}},write:({root:e,props:t,actions:r})=>{if(Xo({root:e,props:t,actions:r}),r.filter(e=>/^DID_SET_STYLE_/.test(e.type)).filter(e=>!b(e.data.value)).map(({type:t,data:r})=>{const o=wo(t.substr(8).toLowerCase(),"_");e.element.dataset[o]=r.value,e.invalidateLayout()}),e.rect.element.hidden)return;e.rect.element.width!==e.ref.widthPrevious&&(e.ref.widthPrevious=e.rect.element.width,e.ref.widthUpdated());let o=e.ref.bounds;o||(o=e.ref.bounds=qo(e),e.element.removeChild(e.ref.measure),e.ref.measure=null);const{hopper:n,label:i,list:s,panel:a}=e.ref;n&&n.updateHopperState();const l=e.query("GET_PANEL_ASPECT_RATIO"),c=e.query("GET_ALLOW_MULTIPLE"),d=e.query("GET_TOTAL_ITEMS"),p=d===(c?e.query("GET_MAX_FILES")||1e6:1),E=r.find(e=>"DID_ADD_ITEM"===e.type);if(p&&E){const e=E.data.interactionMethod;i.opacity=0,c?i.translateY=-40:e===ee?i.translateX=40:i.translateY=e===re?40:30}else p||(i.opacity=1,i.translateX=0,i.translateY=0);const u=Bo(e),_=Fo(e),T=i.rect.element.height,f=!c||p?0:T,I=p?s.rect.element.marginTop:0,m=0===d?0:s.rect.element.marginBottom,h=f+I+_.visual+m,R=f+I+_.bounds+m;if(s.translateY=Math.max(0,f-s.rect.element.marginTop)-u.top,l){const t=e.rect.element.width,r=t*l;l!==e.ref.previousAspectRatio&&(e.ref.previousAspectRatio=l,e.ref.updateHistory=[]);const o=e.ref.updateHistory;o.push(t);const n=2;if(o.length>2*n){const e=o.length,t=e-10;let r=0;for(let i=e;i>=t;i--)if(o[i]===o[i-2]&&r++,r>=n)return}a.scalable=!1,a.height=r;const i=r-f-(m-u.bottom)-(p?I:0);_.visual>i?s.overflow=i:s.overflow=null,e.height=r}else if(o.fixedHeight){a.scalable=!1;const e=o.fixedHeight-f-(m-u.bottom)-(p?I:0);_.visual>e?s.overflow=e:s.overflow=null}else if(o.cappedHeight){const t=h>=o.cappedHeight,r=Math.min(o.cappedHeight,h);a.scalable=!0,a.height=t?r:r-u.top-u.bottom;const n=r-f-(m-u.bottom)-(p?I:0);h>o.cappedHeight&&_.visual>n?s.overflow=n:s.overflow=null,e.height=Math.min(o.cappedHeight,R-u.top-u.bottom)}else{const t=d>0?u.top+u.bottom:0;a.scalable=!0,a.height=Math.max(T,h-t),e.height=Math.max(T,R-t)}e.ref.credits&&a.heightCurrent&&(e.ref.credits.style.transform=`translateY(${a.heightCurrent}px)`)},destroy:({root:e})=>{e.ref.paster&&e.ref.paster.destroy(),e.ref.hopper&&e.ref.hopper.destroy(),e.element.removeEventListener("touchmove",Uo),e.element.removeEventListener("gesturestart",Uo)},mixins:{styles:["height"]}}),Wo=(e={})=>{let r=null;const o=Re(),n=((e,t=[],r=[])=>{const o={...e},n=[],i=[],s=(e,t,r)=>{!r||document.hidden?(d[e]&&d[e](t),n.push({type:e,data:t})):i.push({type:e,data:t})},a=(e,...t)=>c[e]?c[e](...t):null,l={getState:()=>({...o}),processActionQueue:()=>{const e=[...n];return n.length=0,e},processDispatchQueue:()=>{const e=[...i];i.length=0,e.forEach(({type:e,data:t})=>{s(e,t)})},dispatch:s,query:a};let c={};t.forEach(e=>{c={...e(o),...c}});let d={};return r.forEach(e=>{d={...e(s,a,o),...d}}),l})((e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:j(e)}))(o),[we,J(o)],[yt,K(o)]);n.dispatch("SET_OPTIONS",{options:e});const i=()=>{document.hidden||n.dispatch("KICK")};document.addEventListener("visibilitychange",i);let s=null,a=!1,l=!1,c=null,d=null;const p=()=>{a||(a=!0),clearTimeout(s),s=setTimeout(()=>{a=!1,c=null,d=null,l&&(l=!1,n.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const E=$o(n,{id:ie()});let u=!1,_=!1;const f={_read:()=>{a&&(d=window.innerWidth,c||(c=d),l||d===c||(n.dispatch("DID_START_RESIZE"),l=!0)),_&&u&&(u=null===E.element.offsetParent),u||(E._read(),_=E.rect.element.hidden)},_write:e=>{const t=n.processActionQueue().filter(e=>!/^SET_/.test(e.type));u&&!t.length||(R(t),u=E._write(e,t,l),(e=>{e.forEach((t,r)=>{t.released&&se(e,r)})})(n.query("GET_ITEMS")),u&&n.processDispatchQueue())}},I=e=>t=>{const r={type:e};if(!t)return r;if(t.hasOwnProperty("error")&&(r.error=t.error?{...t.error}:null),t.status&&(r.status={...t.status}),t.file&&(r.output=t.file),t.source)r.file=t.source;else if(t.item||t.id){const e=t.item?t.item:n.query("GET_ITEM",t.id);r.file=e?de(e):null}return t.items&&(r.items=t.items.map(de)),/progress/.test(e)&&(r.progress=t.progress),t.hasOwnProperty("origin")&&t.hasOwnProperty("target")&&(r.origin=t.origin,r.target=t.target),r},m={DID_DESTROY:I("destroy"),DID_INIT:I("init"),DID_THROW_MAX_FILES:I("warning"),DID_INIT_ITEM:I("initfile"),DID_START_ITEM_LOAD:I("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:I("addfileprogress"),DID_LOAD_ITEM:I("addfile"),DID_THROW_ITEM_INVALID:[I("error"),I("addfile")],DID_THROW_ITEM_LOAD_ERROR:[I("error"),I("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[I("error"),I("removefile")],DID_PREPARE_OUTPUT:I("preparefile"),DID_START_ITEM_PROCESSING:I("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:I("processfileprogress"),DID_ABORT_ITEM_PROCESSING:I("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:I("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:I("processfiles"),DID_REVERT_ITEM_PROCESSING:I("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[I("error"),I("processfile")],DID_REMOVE_ITEM:I("removefile"),DID_UPDATE_ITEMS:I("updatefiles"),DID_ACTIVATE_ITEM:I("activatefile"),DID_REORDER_ITEMS:I("reorderfiles")},h=e=>{const t={pond:A,...e};delete t.type,E.element.dispatchEvent(new CustomEvent(`FilePond:${e.type}`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const r=[];e.hasOwnProperty("error")&&r.push(e.error),e.hasOwnProperty("file")&&r.push(e.file);const o=["type","error","file"];Object.keys(e).filter(e=>!o.includes(e)).forEach(t=>r.push(e[t])),A.fire(e.type,...r);const i=n.query(`GET_ON${e.type.toUpperCase()}`);i&&i(...r)},R=e=>{e.length&&e.filter(e=>m[e.type]).forEach(e=>{const t=m[e.type];(Array.isArray(t)?t:[t]).forEach(t=>{"DID_INIT_ITEM"===e.type?h(t(e.data)):setTimeout(()=>{h(t(e.data))},0)})})},g=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),O=(e,t)=>("object"!=typeof e||(e=>e.file&&e.id)(e)||t||(t=e,e=void 0),n.dispatch("REMOVE_ITEM",{...t,query:e}),null===n.query("GET_ACTIVE_ITEM",e)),D=(...e)=>new Promise((t,r)=>{const o=[],i={};if(M(e[0]))o.push.apply(o,e[0]),Object.assign(i,e[1]||{});else{const t=e[e.length-1];"object"!=typeof t||t instanceof Blob||Object.assign(i,e.pop()),o.push(...e)}n.dispatch("ADD_ITEMS",{items:o,index:i.index,interactionMethod:ee,success:t,failure:r})}),S=()=>n.query("GET_ACTIVE_ITEMS"),y=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PROCESSING",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),A={...ae(),...f,...Z(n,o),setOptions:e=>n.dispatch("SET_OPTIONS",{options:e}),addFile:(e,t={})=>new Promise((r,o)=>{D([{source:e,options:t}],{index:t.index}).then(e=>r(e&&e[0])).catch(o)}),addFiles:D,getFile:e=>n.query("GET_ACTIVE_ITEM",e),processFile:y,prepareFile:g,removeFile:O,moveFile:(e,t)=>n.dispatch("MOVE_ITEM",{query:e,index:t}),getFiles:S,processFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;if(!t.length){const e=S().filter(e=>!(e.status===pe.IDLE&&e.origin===Ee.LOCAL)&&e.status!==pe.PROCESSING&&e.status!==pe.PROCESSING_COMPLETE&&e.status!==pe.PROCESSING_REVERT_ERROR);return Promise.all(e.map(y))}return Promise.all(t.map(y))},removeFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;let r;"object"==typeof t[t.length-1]?r=t.pop():Array.isArray(e[0])&&(r=e[1]);const o=S();return t.length?t.map(e=>T(e)?o[e]?o[e].id:null:e).filter(e=>e).map(e=>O(e,r)):Promise.all(o.map(e=>O(e,r)))},prepareFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=t.length?t:S();return Promise.all(r.map(g))},sort:e=>n.dispatch("SORT",{compare:e}),browse:()=>{var e=E.element.querySelector("input[type=file]");e&&e.click()},destroy:()=>{A.fire("destroy",E.element),n.dispatch("ABORT_ALL"),E._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",i),n.dispatch("DID_DESTROY")},insertBefore:e=>P(E.element,e),insertAfter:e=>v(E.element,e),appendTo:e=>e.appendChild(E.element),replaceElement:e=>{P(E.element,e),e.parentNode.removeChild(e),r=e},restoreElement:()=>{r&&(v(r,E.element),E.element.parentNode.removeChild(E.element),r=null)},isAttachedTo:e=>E.element===e||r===e,element:{get:()=>E.element},status:{get:()=>n.query("GET_STATUS")}};return n.dispatch("DID_INIT"),t(A)},zo=(t={})=>{const r={};return e(Re(),(e,t)=>{r[e]=t[0]}),Wo({...r,...t})},jo=(t,r)=>{e(r,(r,o)=>{e(t,(e,n)=>{const i=new RegExp(r);if(!i.test(e))return;if(delete t[e],!1===o)return;if(U(o))return void(t[o]=n);const s=o.group;X(o)&&!t[s]&&(t[s]={}),t[s][(e=>e.charAt(0).toLowerCase()+e.slice(1))(e.replace(i,""))]=n}),o.mapping&&jo(t[o.group],o.mapping)})},Qo=(t,o={})=>{const n=[];e(t.attributes,e=>{n.push(t.attributes[e])});const i=n.filter(e=>e.name).reduce((e,o)=>{const n=r(t,o.name);return e[(e=>wo(e.replace(/^data-/,"")))(o.name)]=n===o.name||n,e},{});return jo(i,o),i},Zo=(...e)=>(e=>e instanceof HTMLElement)(e[0])?((e,t={})=>{const r={"^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};me("SET_ATTRIBUTE_TO_OPTION_MAP",r);const o={...t},n=Qo("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,r);Object.keys(n).forEach(e=>{X(n[e])?(X(o[e])||(o[e]={}),Object.assign(o[e],n[e])):o[e]=n[e]}),o.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(e=>({source:e.value,options:{type:e.dataset.type}})));const i=zo(o);return e.files&&Array.from(e.files).forEach(e=>{i.addFile(e)}),i.replaceElement(e),i})(...e):zo(...e),Ko=["fire","_read","_write"],Jo=e=>{const t={};return le(e,t,Ko),t},en=(e,t)=>e.replace(/(?:{([a-zA-Z]+)})/g,(e,r)=>t[r]),tn=e=>{const t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),r=URL.createObjectURL(t),o=new Worker(r);return{transfer:(e,t)=>{},post:(e,t,r)=>{const n=ie();o.onmessage=(e=>{e.data.id===n&&t(e.data.message)}),o.postMessage({id:n,message:e},r)},terminate:()=>{o.terminate(),URL.revokeObjectURL(r)}}},rn=e=>new Promise((t,r)=>{const o=new Image;o.onload=(()=>{t(o)}),o.onerror=(e=>{r(e)}),o.src=e}),on=(e,t)=>{const r=e.slice(0,e.size,e.type);return r.lastModifiedDate=e.lastModifiedDate,r.name=t,r},nn=e=>on(e,e.name),sn=[],an=t=>{if(sn.includes(t))return;sn.push(t),(e=>Object.assign(ge,e))(t({addFilter:he,utils:{Type:Te,forin:e,isString:U,isFile:_t,toNaturalFileSize:wt,replaceInString:en,getExtensionFromFilename:Fe,getFilenameWithoutExtension:ut,guesstimateMimeType:zr,getFileFromBlob:xe,getFilenameFromURL:Be,createRoute:L,createWorker:tn,createView:A,createItemAPI:de,loadImage:rn,copyFile:nn,renameFile:on,createBlob:Ye,applyFilterChain:Ie,text:vt,getNumericAspectRatioFromString:De},views:{fileActionButton:Nt}}).options)},ln=(()=>{const e=d()&&!(()=>"[object OperaMini]"===Object.prototype.toString.call(window.operamini))()&&(()=>"visibilityState"in document)()&&(()=>"Promise"in window)()&&(()=>"slice"in Blob.prototype)()&&(()=>"URL"in window&&"createObjectURL"in window.URL)()&&(()=>"performance"in window)()&&((()=>"supports"in(window.CSS||{}))()||(()=>/MSIE|Trident/.test(window.navigator.userAgent))());return()=>e})(),cn={apps:[]},dn=()=>{};let pn={},En={},un={},_n={},Tn=dn,fn=dn,In=dn,mn=dn,hn=dn,Rn=dn,gn=dn;if(ln()){((e,t,r=60)=>{const o="__framePainter";if(window[o])return window[o].readers.push(e),void window[o].writers.push(t);window[o]={readers:[e],writers:[t]};const n=window[o],i=1e3/r;let s=null,a=null,l=null,c=null;const d=()=>{document.hidden?(l=(()=>window.setTimeout(()=>p(performance.now()),i)),c=(()=>window.clearTimeout(a))):(l=(()=>window.requestAnimationFrame(p)),c=(()=>window.cancelAnimationFrame(a)))};document.addEventListener("visibilitychange",()=>{c&&c(),d(),p(performance.now())});const p=e=>{a=l(p),s||(s=e);const t=e-s;t<=i||(s=e-t%i,n.readers.forEach(e=>e()),n.writers.forEach(t=>t(e)))};d(),p(performance.now())})(()=>{cn.apps.forEach(e=>e._read())},e=>{cn.apps.forEach(t=>t._write(e))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:ln,create:Tn,destroy:fn,parse:In,find:mn,registerPlugin:hn,setOptions:gn}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const r=()=>e(Re(),(e,t)=>{_n[e]=t[1]});pn={...ye},un={...Ee},En={...pe},_n={},r(),Tn=((...e)=>{const t=Zo(...e);return t.on("destroy",fn),cn.apps.push(t),Jo(t)}),fn=(e=>{const t=cn.apps.findIndex(t=>t.isAttachedTo(e));if(t>=0){return cn.apps.splice(t,1)[0].restoreElement(),!0}return!1}),In=(e=>{return Array.from(e.querySelectorAll(".filepond")).filter(e=>!cn.apps.find(t=>t.isAttachedTo(e))).map(e=>Tn(e))}),mn=(e=>{const t=cn.apps.find(t=>t.isAttachedTo(e));return t?Jo(t):null}),hn=((...e)=>{e.forEach(an),r()}),Rn=(()=>{const t={};return e(Re(),(e,r)=>{t[e]=r[0]}),t}),gn=(t=>(X(t)&&(cn.apps.forEach(e=>{e.setOptions(t)}),(t=>{e(t,(e,t)=>{ge[e]&&(ge[e][0]=z(t,ge[e][0],ge[e][1]))})})(t)),Rn()))}export{un as FileOrigin,En as FileStatus,_n as OptionTypes,pn as Status,Tn as create,fn as destroy,mn as find,Rn as getOptions,In as parse,hn as registerPlugin,gn as setOptions,ln as supported}; +const e=(e,t)=>{for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])},t=t=>{const r={};return e(t,e=>{((e,t,r)=>{"function"!=typeof r?Object.defineProperty(e,t,{...r}):e[t]=r})(r,e,t[e])}),r},r=(e,t,r=null)=>{if(null===r)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,r)},o=["svg","path"],n=e=>o.includes(e),i=(t,o,i={})=>{"object"==typeof o&&(i=o,o=null);const s=n(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return o&&(n(t)?r(s,"class",o):s.className=o),e(i,(e,t)=>{r(s,e,t)}),s},s=e=>(t,r)=>{void 0!==r&&e.children[r]?e.insertBefore(t,e.children[r]):e.appendChild(t)},a=(e,t)=>(e,r)=>(void 0!==r?t.splice(r,0,e):t.push(e),e),l=(e,t)=>r=>(t.splice(t.indexOf(r),1),r.element.parentNode&&e.removeChild(r.element),r),c=(()=>"undefined"!=typeof window&&void 0!==window.document)(),d=()=>c,p="children"in(d()?i("svg"):{})?e=>e.children.length:e=>e.childNodes.length,E=(e,t,r,o)=>{const n=r[0]||e.left,i=r[1]||e.top,s=n+e.width,a=i+e.height*(o[1]||1),l={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:i,right:s,bottom:a}};return t.filter(e=>!e.isRectIgnored()).map(e=>e.rect).forEach(e=>{u(l.inner,{...e.inner}),u(l.outer,{...e.outer})}),_(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,_(l.outer),l},u=(e,t)=>{t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},_=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},T=e=>"number"==typeof e,f=e=>e<.5?2*e*e:(4-2*e)*e-1,I={spring:({stiffness:e=.5,damping:r=.75,mass:o=10}={})=>{let n=null,i=null,s=0,a=!1;const l=t({interpolate:(t,c)=>{if(!a)return T(n)&&T(i)?void(((e,t,r,o=.001)=>Math.abs(e-t){if(T(e)&&!T(i)&&(i=e),null===n&&(n=e,i=e),i===(n=e)||void 0===n)return a=!0,s=0,l.onupdate(i),void l.oncomplete(i);a=!1},get:()=>n},resting:{get:()=>a},onupdate:e=>{},oncomplete:e=>{}});return l},tween:({duration:e=500,easing:r=f,delay:o=0}={})=>{let n,i,s=null,a=!0,l=!1,c=null;const d=t({interpolate:(t,p)=>{a||null===c||(null===s&&(s=t),t-s=e||p?(n=1,i=l?0:1,d.onupdate(i*c),d.oncomplete(i*c),a=!0):(i=n/e,d.onupdate((n>=0?r(l?1-i:i):0)*c))))},target:{get:()=>l?0:c,set:e=>{if(null===c)return c=e,d.onupdate(e),void d.oncomplete(e);ea},onupdate:e=>{},oncomplete:e=>{}});return d}},m=(e,t,r)=>{const o=e[t]&&"object"==typeof e[t][r]?e[t][r]:e[t]||e,n="string"==typeof o?o:o.type,i="object"==typeof o?{...o}:{};return I[n]?I[n](i):null},h=(e,t,r,o=!1)=>{(t=Array.isArray(t)?t:[t]).forEach(t=>{e.forEach(e=>{let n=e,i=()=>r[e],s=t=>r[e]=t;"object"==typeof e&&(n=e.key,i=e.getter||i,s=e.setter||s),t[n]&&!o||(t[n]={get:i,set:s})})})},R=e=>null!=e,g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},O=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in t)if(t[r]!==e[r])return!0;return!1},D=(e,{opacity:t,perspective:r,translateX:o,translateY:n,scaleX:i,scaleY:s,rotateX:a,rotateY:l,rotateZ:c,originX:d,originY:p,width:E,height:u})=>{let _="",T="";(R(d)||R(p))&&(T+=`transform-origin: ${d||0}px ${p||0}px;`),R(r)&&(_+=`perspective(${r}px) `),(R(o)||R(n))&&(_+=`translate3d(${o||0}px, ${n||0}px, 0) `),(R(i)||R(s))&&(_+=`scale3d(${R(i)?i:1}, ${R(s)?s:1}, 1) `),R(c)&&(_+=`rotateZ(${c}rad) `),R(a)&&(_+=`rotateX(${a}rad) `),R(l)&&(_+=`rotateY(${l}rad) `),_.length&&(T+=`transform:${_};`),R(t)&&(T+=`opacity:${t};`,0===t&&(T+="visibility:hidden;"),t<1&&(T+="pointer-events:none;")),R(u)&&(T+=`height:${u}px;`),R(E)&&(T+=`width:${E}px;`);const f=e.elementCurrentStyle||"";T.length===f.length&&T===f||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,view:n})=>{const i={...t},s={};h(e,[r,o],t);const a=()=>n.rect?E(n.rect,n.childViews,(()=>[t.translateX||0,t.translateY||0])(),(()=>[t.scaleX||0,t.scaleY||0])()):null;return r.rect={get:a},o.rect={get:a},e.forEach(e=>{t[e]=void 0===i[e]?g[e]:i[e]}),{write:()=>{if(O(s,t))return D(n.element,t),Object.assign(s,{...t}),!0},destroy:()=>{}}},listeners:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,viewState:n,view:i})=>{const s=[],a=(e=>(t,r)=>{e.addEventListener(t,r)})(i.element),l=(e=>(t,r)=>{e.removeEventListener(t,r)})(i.element);return o.on=((e,t)=>{s.push({type:e,fn:t}),a(e,t)}),o.off=((e,t)=>{s.splice(s.findIndex(r=>r.type===e&&r.fn===t),1),l(e,t)}),{write:()=>!0,destroy:()=>{s.forEach(e=>{l(e.type,e.fn)})}}},animations:({mixinConfig:t,viewProps:r,viewInternalAPI:o,viewExternalAPI:n})=>{const i={...r},s=[];return e(t,(e,t)=>{const a=m(t);a&&(a.onupdate=(t=>{r[e]=t}),a.target=i[e],h([{key:e,setter:e=>{a.target!==e&&(a.target=e)},getter:()=>r[e]}],[o,n],r,!0),s.push(a))}),{write:e=>{let t=document.hidden,r=!0;return s.forEach(o=>{o.resting||(r=!1),o.interpolate(e,t)}),r},destroy:()=>{}}},apis:({mixinConfig:e,viewProps:t,viewExternalAPI:r})=>{h(e,r,t)}},y=(e={},t={},r={})=>(t.layoutCalculated||(e.paddingTop=parseInt(r.paddingTop,10)||0,e.marginTop=parseInt(r.marginTop,10)||0,e.marginRight=parseInt(r.marginRight,10)||0,e.marginBottom=parseInt(r.marginBottom,10)||0,e.marginLeft=parseInt(r.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e),A=({tag:e="div",name:r=null,attributes:o={},read:n=(()=>{}),write:c=(()=>{}),create:d=(()=>{}),destroy:u=(()=>{}),filterFrameActionsForChild:_=((e,t)=>t),didCreateView:T=(()=>{}),didWriteView:f=(()=>{}),ignoreRect:I=!1,ignoreRectUpdate:m=!1,mixins:h=[]}={})=>(R,g={})=>{const O=i(e,`filepond--${r}`,o),D=window.getComputedStyle(O,null),A=y();let L=null,P=!1;const v=[],M=[],b={},C={},N=[c],w=[n],G=[u],U=()=>O,B=()=>v.concat(),F=()=>L||(L=E(A,v,[0,0],[1,1])),q={element:{get:U},style:{get:()=>D},childViews:{get:B}},V={...q,rect:{get:F},ref:{get:()=>b},is:e=>r===e,appendChild:s(O),createChildView:(e=>(t,r)=>t(e,r))(R),linkView:e=>(v.push(e),e),unlinkView:e=>{v.splice(v.indexOf(e),1)},appendChildView:a(0,v),removeChildView:l(O,v),registerWriter:e=>N.push(e),registerReader:e=>w.push(e),registerDestroyer:e=>G.push(e),invalidateLayout:()=>O.layoutCalculated=!1,dispatch:R.dispatch,query:R.query},x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:()=>P},isRectIgnored:()=>I,_read:()=>{L=null,v.forEach(e=>e._read()),!(m&&A.width&&A.height)&&y(A,O,D);const e={root:H,props:g,rect:A};w.forEach(t=>t(e))},_write:(e,t,r)=>{let o=0===t.length;return N.forEach(n=>{!1===n({props:g,root:H,actions:t,timestamp:e,shouldOptimize:r})&&(o=!1)}),M.forEach(t=>{!1===t.write(e)&&(o=!1)}),v.filter(e=>!!e.element.parentNode).forEach(n=>{n._write(e,_(n,t),r)||(o=!1)}),v.forEach((n,i)=>{n.element.parentNode||(H.appendChild(n.element,i),n._read(),n._write(e,_(n,t),r),o=!1)}),P=o,f({props:g,root:H,actions:t,timestamp:e}),o},_destroy:()=>{M.forEach(e=>e.destroy()),G.forEach(e=>{e({root:H,props:g})}),v.forEach(e=>e._destroy())}},Y={...q,rect:{get:()=>A}};Object.keys(h).sort((e,t)=>"styles"===e?1:"styles"===t?-1:0).forEach(e=>{const r=S[e]({mixinConfig:h[e],viewProps:g,viewState:C,viewInternalAPI:V,viewExternalAPI:x,view:t(Y)});r&&M.push(r)});const H=t(V);d({root:H,props:g});const k=p(O);return v.forEach((e,t)=>{H.appendChild(e.element,k+t)}),T(H),t(x)},L=(e,t)=>({root:r,props:o,actions:n=[],timestamp:i,shouldOptimize:s})=>{n.filter(t=>e[t.type]).forEach(t=>e[t.type]({root:r,props:o,action:t.data,timestamp:i,shouldOptimize:s})),t&&t({root:r,props:o,actions:n,timestamp:i,shouldOptimize:s})},P=(e,t)=>t.parentNode.insertBefore(e,t),v=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),M=e=>Array.isArray(e),b=e=>null==e,C=e=>e.trim(),N=e=>""+e,w=e=>"boolean"==typeof e,G=e=>w(e)?e:"true"===e,U=e=>"string"==typeof e,B=e=>T(e)?e:U(e)?N(e).replace(/[a-z]+/gi,""):0,F=e=>parseInt(B(e),10),q=e=>parseFloat(B(e)),V=e=>T(e)&&isFinite(e)&&Math.floor(e)===e,x=(e,t=1e3)=>{if(V(e))return e;let r=N(e).trim();return/MB$/i.test(r)?(r=r.replace(/MB$i/,"").trim(),F(r)*t*t):/KB/i.test(r)?(r=r.replace(/KB$i/,"").trim(),F(r)*t):F(r)},Y=e=>"function"==typeof e,H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},k=(e,t,r,o,n)=>{if(null===t)return null;if("function"==typeof t)return t;const i={url:"GET"===r||"PATCH"===r?`?${e}=`:"",method:r,headers:n,withCredentials:!1,timeout:o,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){const e=i.headers.split(/:(.+)/);i.headers={header:e[0],value:e[1]}}return i.withCredentials=G(i.withCredentials),i},X=e=>"object"==typeof e&&null!==e,$=e=>M(e)?"array":(e=>null===e)(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":(e=>X(e)&&U(e.url)&&X(e.process)&&X(e.revert)&&X(e.restore)&&X(e.fetch))(e)?"api":typeof e,W={array:(e,t=",")=>b(e)?[]:M(e)?e:N(e).split(t).map(C).filter(e=>e.length),boolean:G,int:e=>"bytes"===$(e)?x(e):F(e),number:q,float:q,bytes:x,string:e=>Y(e)?e:N(e),function:e=>(e=>{let t=self,r=e.split("."),o=null;for(;o=r.shift();)if(!(t=t[o]))return null;return t})(e),serverapi:t=>(t=>{const r={};return r.url=U(t)?t:t.url||"",r.timeout=t.timeout?parseInt(t.timeout,10):0,r.headers=t.headers?t.headers:{},e(H,e=>{r[e]=k(e,t[e],H[e],r.timeout,r.headers)}),r.process=t.process||U(t)||t.url?r.process:null,r.remove=t.remove||null,delete r.headers,r})(t),object:e=>{try{return JSON.parse((e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))(e))}catch(e){return null}}},z=(e,t,r)=>{if(e===t)return e;let o=$(e);if(o!==r){const t=((e,t)=>W[t](e))(e,r);if(o=$(t),null===t)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;e=t}return e},j=r=>{const o={};return e(r,e=>{const t=r[e];o[e]=((e,t)=>{let r=e;return{enumerable:!0,get:()=>r,set:o=>{r=z(o,e,t)}}})(t[0],t[1])}),t(o)},Q=(e,t="-")=>e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()).join(t),Z=(t,r)=>{const o={};return e(r,e=>{o[e]={get:()=>t.getState().options[e],set:r=>{t.dispatch(`SET_${Q(e,"_").toUpperCase()}`,{value:r})}}}),o},K=t=>(r,o,n)=>{const i={};return e(t,e=>{const t=Q(e,"_").toUpperCase();i[`SET_${t}`]=(o=>{try{n.options[e]=o.value}catch(e){}r(`DID_SET_${t}`,{value:n.options[e]})})}),i},J=t=>r=>{const o={};return e(t,e=>{o[`GET_${Q(e,"_").toUpperCase()}`]=(t=>r.options[e])}),o},ee=1,te=2,re=3,oe=4,ne=5,ie=()=>Math.random().toString(36).substr(2,9),se=(e,t)=>e.splice(t,1),ae=()=>{const e=[],t=(t,r)=>{se(e,e.findIndex(e=>e.event===t&&(e.cb===r||!r)))},r=(t,r,o)=>{e.filter(e=>e.event===t).map(e=>e.cb).forEach(e=>((e,t)=>{t?e():document.hidden?Promise.resolve(1).then(e):setTimeout(e,0)})(()=>e(...r),o))};return{fireSync:(e,...t)=>{r(e,t,!0)},fire:(e,...t)=>{r(e,t,!1)},on:(t,r)=>{e.push({event:t,cb:r})},onOnce:(r,o)=>{e.push({event:r,cb:(...e)=>{t(r,o),o(...e)}})},off:t}},le=(e,t,r)=>{Object.getOwnPropertyNames(e).filter(e=>!r.includes(e)).forEach(r=>Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)))},ce=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],de=e=>{const t={};return le(e,t,ce),t},pe={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},Ee={INPUT:1,LIMBO:2,LOCAL:3},ue=e=>/[^0-9]+/.exec(e),_e=()=>ue(1.1.toLocaleString())[0],Te={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},fe=[],Ie=(e,t,r)=>new Promise((o,n)=>{const i=fe.filter(t=>t.key===e).map(e=>e.cb);if(0===i.length)return void o(t);const s=i.shift();i.reduce((e,t)=>e.then(e=>t(e,r)),s(t,r)).then(e=>o(e)).catch(e=>n(e))}),me=(e,t,r)=>fe.filter(t=>t.key===e).map(e=>e.cb(t,r)),he=(e,t)=>fe.push({key:e,cb:t}),Re=()=>({...ge}),ge={id:[null,Te.STRING],name:["filepond",Te.STRING],disabled:[!1,Te.BOOLEAN],className:[null,Te.STRING],required:[!1,Te.BOOLEAN],captureMethod:[null,Te.STRING],allowSyncAcceptAttribute:[!0,Te.BOOLEAN],allowDrop:[!0,Te.BOOLEAN],allowBrowse:[!0,Te.BOOLEAN],allowPaste:[!0,Te.BOOLEAN],allowMultiple:[!1,Te.BOOLEAN],allowReplace:[!0,Te.BOOLEAN],allowRevert:[!0,Te.BOOLEAN],allowRemove:[!0,Te.BOOLEAN],allowProcess:[!0,Te.BOOLEAN],allowReorder:[!1,Te.BOOLEAN],allowDirectoriesOnly:[!1,Te.BOOLEAN],storeAsFile:[!1,Te.BOOLEAN],forceRevert:[!1,Te.BOOLEAN],maxFiles:[null,Te.INT],checkValidity:[!1,Te.BOOLEAN],itemInsertLocationFreedom:[!0,Te.BOOLEAN],itemInsertLocation:["before",Te.STRING],itemInsertInterval:[75,Te.INT],dropOnPage:[!1,Te.BOOLEAN],dropOnElement:[!0,Te.BOOLEAN],dropValidation:[!1,Te.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Te.ARRAY],instantUpload:[!0,Te.BOOLEAN],maxParallelUploads:[2,Te.INT],allowMinimumUploadDuration:[!0,Te.BOOLEAN],chunkUploads:[!1,Te.BOOLEAN],chunkForce:[!1,Te.BOOLEAN],chunkSize:[5e6,Te.INT],chunkRetryDelays:[[500,1e3,3e3],Te.ARRAY],server:[null,Te.SERVER_API],fileSizeBase:[1e3,Te.INT],labelFileSizeBytes:["bytes",Te.STRING],labelFileSizeKilobytes:["KB",Te.STRING],labelFileSizeMegabytes:["MB",Te.STRING],labelFileSizeGigabytes:["GB",Te.STRING],labelDecimalSeparator:[_e(),Te.STRING],labelThousandsSeparator:[(()=>{const e=_e(),t=1e3.toLocaleString();return t!==1e3.toString()?ue(t)[0]:"."===e?",":"."})(),Te.STRING],labelIdle:['Drag & Drop your files or Browse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],oninitfile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],beforePrepareFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],Te.ARRAY]},Oe=(e,t)=>b(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(e=>e.id===t)||null),De=e=>{if(b(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Se=e=>e.filter(e=>!e.archived),ye={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let Ae=null;const Le=[pe.LOAD_ERROR,pe.PROCESSING_ERROR,pe.PROCESSING_REVERT_ERROR],Pe=[pe.LOADING,pe.PROCESSING,pe.PROCESSING_QUEUED,pe.INIT],ve=[pe.PROCESSING_COMPLETE],Me=e=>Le.includes(e.status),be=e=>Pe.includes(e.status),Ce=e=>ve.includes(e.status),Ne=e=>X(e.options.server)&&(X(e.options.server.process)||Y(e.options.server.process)),we=e=>({GET_STATUS:()=>{const t=Se(e.items),{EMPTY:r,ERROR:o,BUSY:n,IDLE:i,READY:s}=ye;return 0===t.length?r:t.some(Me)?o:t.some(be)?n:t.some(Ce)?s:i},GET_ITEM:t=>Oe(e.items,t),GET_ACTIVE_ITEM:t=>Oe(Se(e.items),t),GET_ACTIVE_ITEMS:()=>Se(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const r=Oe(e.items,t);return r?r.filename:null},GET_ITEM_SIZE:t=>{const r=Oe(e.items,t);return r?r.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(e=>/^style/.test(e)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>{return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>Se(e.items).filter(e=>e.status===t),GET_TOTAL_ITEMS:()=>Se(e.items).length,SHOULD_UPDATE_FILE_INPUT:()=>e.options.storeAsFile&&(()=>{if(null===Ae)try{const e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));const t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,Ae=1===t.files.length}catch(e){Ae=!1}return Ae})()&&!Ne(e),IS_ASYNC:()=>Ne(e),GET_FILE_SIZE_LABELS:e=>({labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0})}),Ge=(e,t,r)=>Math.max(Math.min(r,e),t),Ue=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),Be=e=>e.split("/").pop().split("?").shift(),Fe=e=>e.split(".").pop(),qe=(e,t="")=>(t+e).slice(-t.length),Ve=(e=new Date)=>`${e.getFullYear()}-${qe(e.getMonth()+1,"00")}-${qe(e.getDate(),"00")}_${qe(e.getHours(),"00")}-${qe(e.getMinutes(),"00")}-${qe(e.getSeconds(),"00")}`,xe=(e,t,r=null,o=null)=>{const n="string"==typeof r?e.slice(0,e.size,r):e.slice(0,e.size,e.type);return n.lastModifiedDate=new Date,e._relativePath&&(n._relativePath=e._relativePath),U(t)||(t=Ve()),t&&null===o&&Fe(t)?n.name=t:(o=o||(e=>{if("string"!=typeof e)return"";const t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""})(n.type),n.name=t+(o?"."+o:"")),n},Ye=(e,t)=>{const r=(()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)();if(r){const o=new r;return o.append(e),o.getBlob(t)}return new Blob([e],{type:t})},He=e=>(/^data:(.+);/.exec(e)||[])[1]||null,ke=e=>{const t=He(e);return((e,t)=>{const r=new ArrayBuffer(e.length),o=new Uint8Array(r);for(let t=0;tatob((e=>e.split(",")[1].replace(/\s/g,""))(e)))(e),t)},Xe=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null},$e=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},We=e=>{if(/x-content-transfer-id:/i.test(e)){return(e.split(":")[1]||"").trim()||null}return null},ze=e=>{const t={source:null,name:null,size:null},r=e.split("\n");for(let e of r){const r=Xe(e);if(r){t.name=r;continue}const o=$e(e);if(o){t.size=o;continue}const n=We(e);n&&(t.source=n)}return t},je=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},r=r=>{e?(t.timestamp=Date.now(),t.request=e(r,e=>{t.duration=Date.now()-t.timestamp,t.complete=!0,e instanceof Blob&&(e=xe(e,e.name||Be(r))),o.fire("load",e instanceof Blob?e:e?e.body:null)},e=>{o.fire("error","string"==typeof e?{type:"error",code:0,body:e}:e)},(e,r,n)=>{n&&(t.size=n),t.duration=Date.now()-t.timestamp,e?(t.progress=r/n,o.fire("progress",t.progress)):t.progress=null},()=>{o.fire("abort")},e=>{const r=ze("string"==typeof e?e:e.headers);o.fire("meta",{size:t.size||r.size,filename:r.name,source:r.source})})):o.fire("error",{type:"error",body:"Can't load URL",code:400})},o={...ae(),setSource:e=>t.source=e,getProgress:()=>t.progress,abort:()=>{t.request&&t.request.abort&&t.request.abort()},load:()=>{const e=t.source;o.fire("init",e),e instanceof File?o.fire("load",e):e instanceof Blob?o.fire("load",xe(e,e.name)):Ue(e)?o.fire("load",((e,t,r)=>xe(ke(e),t,null,r))(e)):r(e)}};return o},Qe=e=>/GET|HEAD/.test(e),Ze=(e,t,r)=>{const o={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,s.abort()}};let n=!1,i=!1;r={method:"POST",headers:{},withCredentials:!1,...r},t=encodeURI(t),Qe(r.method)&&e&&(t=`${t}${encodeURIComponent("string"==typeof e?e:JSON.stringify(e))}`);const s=new XMLHttpRequest;return(Qe(r.method)?s:s.upload).onprogress=(e=>{n||o.onprogress(e.lengthComputable,e.loaded,e.total)}),s.onreadystatechange=(()=>{s.readyState<2||4===s.readyState&&0===s.status||i||(i=!0,o.onheaders(s))}),s.onload=(()=>{s.status>=200&&s.status<300?o.onload(s):o.onerror(s)}),s.onerror=(()=>o.onerror(s)),s.onabort=(()=>{n=!0,o.onabort()}),s.ontimeout=(()=>o.ontimeout(s)),s.open(r.method,t,!0),V(r.timeout)&&(s.timeout=r.timeout),Object.keys(r.headers).forEach(e=>{const t=unescape(encodeURIComponent(r.headers[e]));s.setRequestHeader(e,t)}),r.responseType&&(s.responseType=r.responseType),r.withCredentials&&(s.withCredentials=!0),s.send(e),o},Ke=(e,t,r,o)=>({type:e,code:t,body:r,headers:o}),Je=e=>t=>{e(Ke("error",0,"Timeout",t.getAllResponseHeaders()))},et=e=>/\?/.test(e),tt=(...e)=>{let t="";return e.forEach(e=>{t+=et(t)&&et(e)?e.replace(/\?/,"&"):e}),t},rt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return null;const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s,a,l,c)=>{const d=Ze(n,tt(e,t.url),{...t,responseType:"blob"});return d.onload=(e=>{const o=e.getAllResponseHeaders(),s=ze(o).name||Be(n);i(Ke("load",e.status,"HEAD"===t.method?null:xe(r(e.response),s),o))}),d.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.onheaders=(e=>{c(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),d.ontimeout=Je(s),d.onprogress=a,d.onabort=l,d}},ot=0,nt=1,it=2,st=3,at=4,lt=(e,t,r,o,n,i,s,a,l,c,d)=>{const p=[],{chunkTransferId:E,chunkServer:u,chunkSize:_,chunkRetryDelays:T}=d,f={serverId:E,aborted:!1},I=t.ondata||(e=>e),m=t.onload||((e,t)=>"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response),h=t.onerror||(e=>null),R=Math.floor(o.size/_);for(let e=0;e<=R;e++){const t=e*_,r=o.slice(t,t+_,"application/offset+octet-stream");p[e]={index:e,size:r.size,offset:t,data:r,file:o,progress:0,retries:[...T],status:ot,error:null,request:null,timeout:null}}const g=e=>e.status===ot||e.status===st,O=t=>{if(f.aborted)return;if(!(t=t||p.find(g)))return void(p.every(e=>e.status===nt)&&(()=>i(f.serverId))());t.status=it,t.progress=null;const r=u.ondata||(e=>e),n=u.onerror||(e=>null),a=tt(e,u.url,f.serverId),c="function"==typeof u.headers?u.headers(t):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":o.size,"Upload-Name":o.name},d=t.request=Ze(r(t.data),a,{...u,headers:c});d.onload=(()=>{t.status=nt,t.request=null,y()}),d.onprogress=((e,r,o)=>{t.progress=e?r:null,S()}),d.onerror=(e=>{t.status=st,t.request=null,t.error=n(e.response)||e.statusText,D(t)||s(Ke("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.ontimeout=(e=>{t.status=st,t.request=null,D(t)||Je(s)(e)}),d.onabort=(()=>{t.status=ot,t.request=null,l()})},D=e=>0!==e.retries.length&&(e.status=at,clearTimeout(e.timeout),e.timeout=setTimeout(()=>{O(e)},e.retries.shift()),!0),S=()=>{const e=p.reduce((e,t)=>null===e||null===t.progress?null:e+t.progress,0);if(null===e)return a(!1,0,0);const t=p.reduce((e,t)=>e+t.size,0);a(!0,e,t)},y=()=>{p.filter(e=>e.status===it).length>=1||O()};return f.serverId?(r=>{const o=tt(e,u.url,f.serverId),n={headers:"function"==typeof t.headers?t.headers(f.serverId):{...t.headers},method:"HEAD"},i=Ze(null,o,n);i.onload=(e=>r(m(e,n.method))),i.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),i.ontimeout=Je(s)})(e=>{f.aborted||(p.filter(t=>t.offset{e.status=nt,e.progress=e.size}),y())}):(i=>{const a=new FormData;X(n)&&a.append(r,JSON.stringify(n));const l="function"==typeof t.headers?t.headers(o,n):{...t.headers,"Upload-Length":o.size},c={...t,headers:l},d=Ze(I(a),tt(e,t.url),c);d.onload=(e=>i(m(e,c.method))),d.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),d.ontimeout=Je(s)})(e=>{f.aborted||(c(e),f.serverId=e,y())}),{abort:()=>{f.aborted=!0,p.forEach(e=>{clearTimeout(e.timeout),e.request&&e.request.abort()})}}},ct=(e="",t,r,o)=>"function"==typeof t?(...e)=>t(r,...e,o):t&&U(t.url)?((e,t,r,o)=>(n,i,s,a,l,c,d)=>{if(!n)return;const p=o.chunkUploads,E=p&&n.size>o.chunkSize,u=p&&(E||o.chunkForce);if(n instanceof Blob&&u)return lt(e,t,r,n,i,s,a,l,c,d,o);const _=t.ondata||(e=>e),T=t.onload||(e=>e),f=t.onerror||(e=>null),I="function"==typeof t.headers?t.headers(n,i)||{}:{...t.headers},m={...t,headers:I};var h=new FormData;X(i)&&h.append(r,JSON.stringify(i)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(e=>{h.append(r,e.file,null===e.name?e.file.name:`${e.name}${e.file.name}`)});const R=Ze(_(h),tt(e,t.url),m);return R.onload=(e=>{s(Ke("load",e.status,T(e.response),e.getAllResponseHeaders()))}),R.onerror=(e=>{a(Ke("error",e.status,f(e.response)||e.statusText,e.getAllResponseHeaders()))}),R.ontimeout=Je(a),R.onprogress=l,R.onabort=c,R})(e,t,r,o):null,dt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return(e,t)=>t();const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s)=>{const a=Ze(n,e+t.url,t);return a.onload=(e=>{i(Ke("load",e.status,r(e.response),e.getAllResponseHeaders()))}),a.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),a.ontimeout=Je(s),a}},pt=(e=0,t=1)=>e+Math.random()*(t-e),Et=(e,t)=>{const r={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},{allowMinimumUploadDuration:o}=t,n=()=>{r.request&&(r.perceivedPerformanceUpdater.clear(),r.request.abort&&r.request.abort(),r.complete=!0)},i=o?()=>r.progress?Math.min(r.progress,r.perceivedProgress):null:()=>r.progress||null,s=o?()=>Math.min(r.duration,r.perceivedDuration):()=>r.duration,a={...ae(),process:(t,n)=>{const i=()=>{0!==r.duration&&null!==r.progress&&a.fire("progress",a.getProgress())},s=()=>{r.complete=!0,a.fire("load-perceived",r.response.body)};a.fire("start"),r.timestamp=Date.now(),r.perceivedPerformanceUpdater=((e,t=1e3,r=0,o=25,n=250)=>{let i=null;const s=Date.now(),a=()=>{let r=Date.now()-s,l=pt(o,n);r+l>t&&(l=r+l-t);let c=r/t;c>=1||document.hidden?e(1):(e(c),i=setTimeout(a,l))};return t>0&&a(),{clear:()=>{clearTimeout(i)}}})(e=>{r.perceivedProgress=e,r.perceivedDuration=Date.now()-r.timestamp,i(),r.response&&1===r.perceivedProgress&&!r.complete&&s()},o?pt(750,1500):0),r.request=e(t,n,e=>{r.response=X(e)?e:{type:"load",code:200,body:`${e}`,headers:{}},r.duration=Date.now()-r.timestamp,r.progress=1,a.fire("load",r.response.body),(!o||o&&1===r.perceivedProgress)&&s()},e=>{r.perceivedPerformanceUpdater.clear(),a.fire("error",X(e)?e:{type:"error",code:0,body:`${e}`})},(e,t,o)=>{r.duration=Date.now()-r.timestamp,r.progress=e?t/o:null,i()},()=>{r.perceivedPerformanceUpdater.clear(),a.fire("abort",r.response?r.response.body:null)},e=>{a.fire("transfer",e)})},abort:n,getProgress:i,getDuration:s,reset:()=>{n(),r.complete=!1,r.perceivedProgress=0,r.progress=0,r.timestamp=null,r.perceivedDuration=0,r.duration=0,r.request=null,r.response=null}};return a},ut=e=>e.substr(0,e.lastIndexOf("."))||e,_t=e=>!!(e instanceof File||e instanceof Blob&&e.name),Tt=e=>{if(!X(e))return e;const t=M(e)?[]:{};for(const r in e){if(!e.hasOwnProperty(r))continue;const o=e[r];t[r]=o&&X(o)?Tt(o):o}return t},ft=(e=null,r=null,o=null)=>{const n=ie(),i={archived:!1,frozen:!1,released:!1,source:null,file:o,serverFileReference:r,transferId:null,processingAborted:!1,status:r?pe.PROCESSING_COMPLETE:pe.INIT,activeLoader:null,activeProcessor:null};let s=null;const a={},l=e=>i.status=e,c=(e,...t)=>{i.released||i.frozen||E.fire(e,...t)},d=(e,t)=>{if(i.processingAborted)return void(i.processingAborted=!1);if(l(pe.PROCESSING),s=null,!(i.file instanceof Blob))return void E.on("load",()=>{d(e,t)});e.on("load",e=>{i.transferId=null,i.serverFileReference=e}),e.on("transfer",e=>{i.transferId=e}),e.on("load-perceived",e=>{i.activeProcessor=null,i.transferId=null,i.serverFileReference=e,l(pe.PROCESSING_COMPLETE),c("process-complete",e)}),e.on("start",()=>{c("process-start")}),e.on("error",e=>{i.activeProcessor=null,l(pe.PROCESSING_ERROR),c("process-error",e)}),e.on("abort",e=>{i.activeProcessor=null,i.serverFileReference=e,l(pe.IDLE),c("process-abort"),s&&s()}),e.on("progress",e=>{c("process-progress",e)});const r=console.error;t(i.file,t=>{i.archived||e.process(t,{...a})},r),i.activeProcessor=e},p=(e,t,r)=>{const o=e.split("."),n=o[0],i=o.pop();let s=a;o.forEach(e=>s=s[e]),JSON.stringify(s[i])!==JSON.stringify(t)&&(s[i]=t,c("metadata-update",{key:n,value:a[n],silent:r}))},E={id:{get:()=>n},origin:{get:()=>e,set:t=>e=t},serverId:{get:()=>i.serverFileReference},transferId:{get:()=>i.transferId},status:{get:()=>i.status},filename:{get:()=>i.file.name},filenameWithoutExtension:{get:()=>ut(i.file.name)},fileExtension:{get:()=>Fe(i.file.name)},fileType:{get:()=>i.file.type},fileSize:{get:()=>i.file.size},file:{get:()=>i.file},relativePath:{get:()=>i.file._relativePath},source:{get:()=>i.source},getMetadata:e=>Tt(e?a[e]:a),setMetadata:(e,t,r)=>{if(X(e)){const r=e;return Object.keys(r).forEach(e=>{p(e,r[e],t)}),e}return p(e,t,r),t},extend:(e,t)=>u[e]=t,abortLoad:()=>{i.activeLoader?i.activeLoader.abort():(l(pe.INIT),c("load-abort"))},retryLoad:()=>{i.activeLoader&&i.activeLoader.load()},requestProcessing:()=>{i.processingAborted=!1,l(pe.PROCESSING_QUEUED)},abortProcessing:()=>new Promise(e=>{if(!i.activeProcessor)return i.processingAborted=!0,l(pe.IDLE),c("process-abort"),void e();s=(()=>{e()}),i.activeProcessor.abort()}),load:(t,r,o)=>{i.source=t,E.fireSync("init"),i.file?E.fireSync("load-skip"):(i.file=(e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||Ue(e)?t[0]=e.name||Ve():Ue(e)?(t[1]=e.length,t[2]=He(e)):U(e)&&(t[0]=Be(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}})(t),r.on("init",()=>{c("load-init")}),r.on("meta",t=>{i.file.size=t.size,i.file.filename=t.filename,t.source&&(e=Ee.LIMBO,i.serverFileReference=t.source,i.status=pe.PROCESSING_COMPLETE),c("load-meta")}),r.on("progress",e=>{l(pe.LOADING),c("load-progress",e)}),r.on("error",e=>{l(pe.LOAD_ERROR),c("load-request-error",e)}),r.on("abort",()=>{l(pe.INIT),c("load-abort")}),r.on("load",t=>{i.activeLoader=null;const r=t=>{i.file=_t(t)?t:i.file,e===Ee.LIMBO&&i.serverFileReference?l(pe.PROCESSING_COMPLETE):l(pe.IDLE),c("load")};i.serverFileReference?r(t):o(t,r,e=>{i.file=t,c("load-meta"),l(pe.LOAD_ERROR),c("load-file-error",e)})}),r.setSource(t),i.activeLoader=r,r.load())},process:d,revert:(e,t)=>new Promise((r,o)=>{const n=null!==i.serverFileReference?i.serverFileReference:i.transferId;null!==n?(e(n,()=>{i.serverFileReference=null,i.transferId=null,r()},e=>{t?(l(pe.PROCESSING_REVERT_ERROR),c("process-revert-error"),o(e)):r()}),l(pe.IDLE),c("process-revert")):r()}),...ae(),freeze:()=>i.frozen=!0,release:()=>i.released=!0,released:{get:()=>i.released},archive:()=>i.archived=!0,archived:{get:()=>i.archived}},u=t(E);return u},It=(e,t)=>{const r=((e,t)=>b(t)?0:U(t)?e.findIndex(e=>e.id===t):-1)(e,t);if(!(r<0))return e[r]||null},mt=(e,t,r,o,n,i)=>{const s=Ze(null,e,{method:"GET",responseType:"blob"});return s.onload=(r=>{const o=r.getAllResponseHeaders(),n=ze(o).name||Be(e);t(Ke("load",r.status,xe(r.response,n),o))}),s.onerror=(e=>{r(Ke("error",e.status,e.statusText,e.getAllResponseHeaders()))}),s.onheaders=(e=>{i(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),s.ontimeout=Je(r),s.onprogress=o,s.onabort=n,s},ht=e=>(0===e.indexOf("//")&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),Rt=e=>(...t)=>Y(e)?e(...t):e,gt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:Se(t.items)})},0)},Ot=(e,...t)=>new Promise(r=>{if(!e)return r(!0);const o=e(...t);return null==o?r(!0):"boolean"==typeof o?r(o):void("function"==typeof o.then&&o.then(r))}),Dt=(e,t)=>{e.items.sort((e,r)=>t(de(e),de(r)))},St=(e,t)=>({query:r,success:o=(()=>{}),failure:n=(()=>{}),...i}={})=>{const s=Oe(e.items,r);s?t(s,o,n,i||{}):n({error:Ke("error",0,"Item not found"),file:null})},yt=(e,t,r)=>({ABORT_ALL:()=>{Se(r.items).forEach(e=>{e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:({value:t=[]})=>{const o=t.map(e=>({source:e.source?e.source:e,options:e.options}));let n=Se(r.items);n.forEach(t=>{o.find(e=>e.source===t.source||e.source===t.file)||e("REMOVE_ITEM",{query:t,remove:!1})}),n=Se(r.items),o.forEach((t,r)=>{n.find(e=>e.source===t.source||e.file===t.source)||e("ADD_ITEM",{...t,interactionMethod:ne,index:r})})},DID_UPDATE_ITEM_METADATA:({id:o,action:n,change:i})=>{i.silent||(clearTimeout(r.itemUpdateTimeout),r.itemUpdateTimeout=setTimeout(()=>{const s=It(r.items,o);if(!t("IS_ASYNC"))return void Ie("SHOULD_PREPARE_OUTPUT",!1,{item:s,query:t,action:n,change:i}).then(r=>{const n=t("GET_BEFORE_PREPARE_FILE");n&&(r=n(s,r)),r&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:s,success:t=>{e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)});s.origin===Ee.LOCAL&&e("DID_LOAD_ITEM",{id:s.id,error:null,serverFileReference:s.source});const a=()=>{setTimeout(()=>{e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return s.status===pe.PROCESSING_COMPLETE?(e=>{s.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(e?a:()=>{}).catch(()=>{})})(r.options.instantUpload):s.status===pe.PROCESSING?(e=>{s.abortProcessing().then(e?a:()=>{})})(r.options.instantUpload):void(r.options.instantUpload&&a())},0))},MOVE_ITEM:({query:e,index:t})=>{const o=Oe(r.items,e);if(!o)return;const n=r.items.indexOf(o);n!==(t=Ge(t,0,r.items.length-1))&&r.items.splice(t,0,r.items.splice(n,1)[0])},SORT:({compare:o})=>{Dt(r,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:r,index:o,interactionMethod:n,success:i=(()=>{}),failure:s=(()=>{})})=>{let a=o;if(-1===o||void 0===o){const e=t("GET_ITEM_INSERT_LOCATION"),r=t("GET_TOTAL_ITEMS");a="before"===e?0:r}const l=t("GET_IGNORED_FILES"),c=r.filter(e=>_t(e)?!l.includes(e.name.toLowerCase()):!b(e)).map(t=>new Promise((r,o)=>{e("ADD_ITEM",{interactionMethod:n,source:t.source||t,success:r,failure:o,index:a++,options:t.options||{}})}));Promise.all(c).then(i).catch(s)},ADD_ITEM:({source:o,index:n=-1,interactionMethod:i,success:s=(()=>{}),failure:a=(()=>{}),options:l={}})=>{if(b(o))return void a({error:Ke("error",0,"No source"),file:null});if(_t(o)&&r.options.ignoredFiles.includes(o.name.toLowerCase()))return;if(!(e=>{const t=Se(e.items).length;if(!e.options.allowMultiple)return 0===t;const r=e.options.maxFiles;return null===r||t{d&&e("ADD_ITEM",{source:o,index:n,interactionMethod:i,success:s,failure:a,options:l})}).catch(()=>{}),d)return}e("REMOVE_ITEM",{query:c.id})}const c="local"===l.type?Ee.LOCAL:"limbo"===l.type?Ee.LIMBO:Ee.INPUT,d=ft(c,c===Ee.INPUT?null:o,l.file);Object.keys(l.metadata||{}).forEach(e=>{d.setMetadata(e,l.metadata[e])}),me("DID_CREATE_ITEM",d,{query:t,dispatch:e});const p=t("GET_ITEM_INSERT_LOCATION");r.options.itemInsertLocationFreedom||(n="before"===p?-1:r.items.length),((e,t,r)=>b(t)?null:void 0===r?(e.push(t),t):(((e,t,r)=>e.splice(t,0,r))(e,r=Ge(r,0,e.length),t),t))(r.items,d,n),Y(p)&&o&&Dt(r,p);const E=d.id;d.on("init",()=>{e("DID_INIT_ITEM",{id:E})}),d.on("load-init",()=>{e("DID_START_ITEM_LOAD",{id:E})}),d.on("load-meta",()=>{e("DID_UPDATE_ITEM_META",{id:E})}),d.on("load-progress",t=>{e("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:E,progress:t})}),d.on("load-request-error",t=>{const o=Rt(r.options.labelFileLoadError)(t);if(t.code>=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:E,error:t,status:{main:o,sub:`${t.code} (${t.body})`}}),void a({error:t,file:de(d)});e("DID_THROW_ITEM_LOAD_ERROR",{id:E,error:t,status:{main:o,sub:r.options.labelTapToRetry}})}),d.on("load-file-error",t=>{e("DID_THROW_ITEM_INVALID",{id:E,error:t.status,status:t.status}),a({error:t.status,file:de(d)})}),d.on("load-abort",()=>{e("REMOVE_ITEM",{query:E})}),d.on("load-skip",()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}})}),d.on("load",()=>{const n=n=>{n?(d.on("metadata-update",t=>{e("DID_UPDATE_ITEM_METADATA",{id:E,change:t})}),Ie("SHOULD_PREPARE_OUTPUT",!1,{item:d,query:t}).then(n=>{const i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(d,n));const a=()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}}),gt(e,r)};n?e("REQUEST_PREPARE_OUTPUT",{query:E,item:d,success:t=>{e("DID_PREPARE_OUTPUT",{id:E,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:E})};Ie("DID_LOAD_ITEM",d,{query:t,dispatch:e}).then(()=>{Ot(t("GET_BEFORE_ADD_FILE"),de(d)).then(n)}).catch(t=>{if(!t||!t.error||!t.status)return n(!1);e("DID_THROW_ITEM_INVALID",{id:E,error:t.error,status:t.status})})}),d.on("process-start",()=>{e("DID_START_ITEM_PROCESSING",{id:E})}),d.on("process-progress",t=>{e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:E,progress:t})}),d.on("process-error",t=>{e("DID_THROW_ITEM_PROCESSING_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-revert-error",t=>{e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingRevertError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-complete",t=>{e("DID_COMPLETE_ITEM_PROCESSING",{id:E,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:E,value:t})}),d.on("process-abort",()=>{e("DID_ABORT_ITEM_PROCESSING",{id:E})}),d.on("process-revert",()=>{e("DID_REVERT_ITEM_PROCESSING",{id:E}),e("DID_DEFINE_VALUE",{id:E,value:null})}),e("DID_ADD_ITEM",{id:E,index:n,interactionMethod:i}),gt(e,r);const{url:u,load:_,restore:T,fetch:f}=r.options.server||{};d.load(o,je(c===Ee.INPUT?U(o)&&(e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&ht(location.href)!==ht(e))(o)&&f?rt(u,f):mt:rt(u,c===Ee.LIMBO?T:_)),(e,r,o)=>{Ie("LOAD_FILE",e,{query:t}).then(r).catch(o)})},REQUEST_PREPARE_OUTPUT:({item:e,success:r,failure:o=(()=>{})})=>{const n={error:Ke("error",0,"Item not found"),file:null};if(e.archived)return o(n);Ie("PREPARE_OUTPUT",e.file,{query:t,item:e}).then(i=>{Ie("COMPLETE_PREPARE_OUTPUT",i,{query:t,item:e}).then(t=>{if(e.archived)return o(n);r(t)})})},COMPLETE_LOAD_ITEM:({item:o,data:n})=>{const{success:i,source:s}=n,a=t("GET_ITEM_INSERT_LOCATION");if(Y(a)&&s&&Dt(r,a),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===Ee.INPUT?null:s}),i(de(o)),o.origin!==Ee.LOCAL)return o.origin===Ee.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&r.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:St(r,e=>{e.retryLoad()}),REQUEST_ITEM_PREPARE:St(r,(t,r,o)=>{e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:o=>{e("DID_PREPARE_OUTPUT",{id:t.id,file:o}),r({file:t,output:o})},failure:o},!0)}),REQUEST_ITEM_PROCESSING:St(r,(o,n,i)=>{if(o.status===pe.IDLE||o.status===pe.PROCESSING_ERROR)o.status!==pe.PROCESSING_QUEUED&&(o.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:o.id}),e("PROCESS_ITEM",{query:o,success:n,failure:i},!0));else{const s=()=>e("REQUEST_ITEM_PROCESSING",{query:o,success:n,failure:i}),a=()=>document.hidden?s():setTimeout(s,32);o.status===pe.PROCESSING_COMPLETE||o.status===pe.PROCESSING_REVERT_ERROR?o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(a).catch(()=>{}):o.status===pe.PROCESSING&&o.abortProcessing().then(a)}}),PROCESS_ITEM:St(r,(o,n,i)=>{const s=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",pe.PROCESSING).length===s)return void r.processingQueue.push({id:o.id,success:n,failure:i});if(o.status===pe.PROCESSING)return;const a=()=>{const t=r.processingQueue.shift();if(!t)return;const{id:o,success:n,failure:i}=t,s=Oe(r.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:n,failure:i},!0):a()};o.onOnce("process-complete",()=>{n(de(o)),a();const i=r.options.server;if(r.options.instantUpload&&o.origin===Ee.LOCAL&&Y(i.remove)){const e=()=>{};o.origin=Ee.LIMBO,r.options.server.remove(o.source,e,e)}t("GET_ITEMS_BY_STATUS",pe.PROCESSING_COMPLETE).length===r.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),o.onOnce("process-error",e=>{i({error:e,file:de(o)}),a()});const l=r.options;o.process(Et(ct(l.server.url,l.server.process,l.name,{chunkTransferId:o.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),(r,n,i)=>{Ie("PREPARE_OUTPUT",r,{query:t,item:o}).then(t=>{e("DID_PREPARE_OUTPUT",{id:o.id,file:t}),n(t)}).catch(i)})}),RETRY_ITEM_PROCESSING:St(r,t=>{e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:St(r,r=>{Ot(t("GET_BEFORE_REMOVE_FILE"),de(r)).then(t=>{t&&e("REMOVE_ITEM",{query:r})})}),RELEASE_ITEM:St(r,e=>{e.release()}),REMOVE_ITEM:St(r,(o,n,i,s)=>{const a=()=>{const t=o.id;It(r.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:o}),gt(e,r),n(de(o))},l=r.options.server;o.origin===Ee.LOCAL&&l&&Y(l.remove)&&!1!==s.remove?(e("DID_START_ITEM_REMOVE",{id:o.id}),l.remove(o.source,()=>a(),t=>{e("DID_THROW_ITEM_REMOVE_ERROR",{id:o.id,error:Ke("error",0,t,null),status:{main:Rt(r.options.labelFileRemoveError)(t),sub:r.options.labelTapToRetry}})})):((s.revert&&o.origin!==Ee.LOCAL&&null!==o.serverId||r.options.chunkUploads&&o.file.size>r.options.chunkSize||r.options.chunkUploads&&r.options.chunkForce)&&o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")),a())}),ABORT_ITEM_LOAD:St(r,e=>{e.abortLoad()}),ABORT_ITEM_PROCESSING:St(r,t=>{t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(()=>{r.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:St(r,o=>{if(!r.options.instantUpload)return void e("REVERT_ITEM_PROCESSING",{query:o});const n=t=>{t&&e("REVERT_ITEM_PROCESSING",{query:o})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return n(!0);const s=i(de(o));return null==s?n(!0):"boolean"==typeof s?n(s):void("function"==typeof s.then&&s.then(n))}),REVERT_ITEM_PROCESSING:St(r,o=>{o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(()=>{(r.options.instantUpload||(e=>!_t(e.file))(o))&&e("REMOVE_ITEM",{query:o.id})}).catch(()=>{})}),SET_OPTIONS:({options:t})=>{const r=Object.keys(t),o=At.filter(e=>r.includes(e));[...o,...Object.keys(t).filter(e=>!o.includes(e))].forEach(r=>{e(`SET_${Q(r,"_").toUpperCase()}`,{value:t[r]})})}}),At=["server"],Lt=e=>e,Pt=e=>document.createElement(e),vt=(e,t)=>{let r=e.childNodes[0];r?t!==r.nodeValue&&(r.nodeValue=t):(r=document.createTextNode(t),e.appendChild(r))},Mt=(e,t,r,o)=>{const n=(o%360-90)*Math.PI/180;return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}},bt=(e,t,r,o,n)=>{let i=1;return n>o&&n-o<=.5&&(i=0),o>n&&o-n>=.5&&(i=0),((e,t,r,o,n,i)=>{const s=Mt(e,t,r,n),a=Mt(e,t,r,o);return["M",s.x,s.y,"A",r,r,0,i,0,a.x,a.y].join(" ")})(e,t,r,360*Math.min(.9999,o),360*Math.min(.9999,n),i)},Ct=A({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:({root:e,props:t})=>{t.spin=!1,t.progress=0,t.opacity=0;const r=i("svg");e.ref.path=i("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(e.ref.path),e.ref.svg=r,e.appendChild(r)},write:({root:e,props:t})=>{if(0===t.opacity)return;t.align&&(e.element.dataset.align=t.align);const o=parseInt(r(e.ref.path,"stroke-width"),10),n=.5*e.rect.element.width;let i=0,s=0;t.spin?(i=0,s=.5):(i=0,s=t.progress);const a=bt(n,n,n-o,i,s);r(e.ref.path,"d",a),r(e.ref.path,"stroke-opacity",t.spin||t.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}}}}),Nt=A({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:({root:e,props:t})=>{e.element.innerHTML=(t.icon||"")+`${t.label}`,t.isDisabled=!1},write:({root:e,props:t})=>{const{isDisabled:o}=t,n=e.query("GET_DISABLED")||0===t.opacity;n&&!o?(t.isDisabled=!0,r(e.element,"disabled","disabled")):!n&&o&&(t.isDisabled=!1,e.element.removeAttribute("disabled"))}}),wt=(e,t=".",r=1e3,o={})=>{const{labelBytes:n="bytes",labelKilobytes:i="KB",labelMegabytes:s="MB",labelGigabytes:a="GB"}=o,l=r,c=r*r,d=r*r*r;return(e=Math.round(Math.abs(e)))e.toFixed(t).split(".").filter(e=>"0"!==e).join(r),Ut=({root:e,props:t})=>{vt(e.ref.fileSize,wt(e.query("GET_ITEM_SIZE",t.id),".",e.query("GET_FILE_SIZE_BASE"),e.query("GET_FILE_SIZE_LABELS",e.query))),vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))},Bt=({root:e,props:t})=>{V(e.query("GET_ITEM_SIZE",t.id))?Ut({root:e,props:t}):vt(e.ref.fileSize,e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},Ft=A({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:Ut,DID_UPDATE_ITEM_META:Ut,DID_THROW_ITEM_LOAD_ERROR:Bt,DID_THROW_ITEM_INVALID:Bt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e,props:t})=>{const o=Pt("span");o.className="filepond--file-info-main",r(o,"aria-hidden","true"),e.appendChild(o),e.ref.fileName=o;const n=Pt("span");n.className="filepond--file-info-sub",e.appendChild(n),e.ref.fileSize=n,vt(n,e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),vt(o,Lt(e.query("GET_ITEM_NAME",t.id)))},mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),qt=e=>Math.round(100*e),Vt=({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_LOADING"):`${e.query("GET_LABEL_FILE_LOADING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},xt=({root:e})=>{vt(e.ref.main,""),vt(e.ref.sub,"")},Yt=({root:e,action:t})=>{vt(e.ref.main,t.status.main),vt(e.ref.sub,t.status.sub)},Ht=A({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:xt,DID_REVERT_ITEM_PROCESSING:xt,DID_REQUEST_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_ABORTED")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_PROCESSING"):`${e.query("GET_LABEL_FILE_PROCESSING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:Vt,DID_THROW_ITEM_LOAD_ERROR:Yt,DID_THROW_ITEM_INVALID:Yt,DID_THROW_ITEM_PROCESSING_ERROR:Yt,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Yt,DID_THROW_ITEM_REMOVE_ERROR:Yt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e})=>{const t=Pt("span");t.className="filepond--file-status-main",e.appendChild(t),e.ref.main=t;const r=Pt("span");r.className="filepond--file-status-sub",e.appendChild(r),e.ref.sub=r,Vt({root:e,action:{progress:null}})},mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),kt={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"}},Xt=[];e(kt,e=>{Xt.push(e)});const $t=e=>{if("right"===Qt(e))return 0;const t=e.ref.buttonRemoveItem.rect.element;return t.hidden?null:t.width+t.left},Wt=e=>{return e.ref.buttonAbortItemLoad.rect.element.width},zt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.height/4),jt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.left/2),Qt=e=>e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Zt={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:e=>e.query("GET_STYLE_LOAD_INDICATOR_POSITION")},processProgressIndicator:{opacity:0,align:e=>e.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}},Kt={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},Jt={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},er={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t,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:$t},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:Qt},info:{translateX:$t},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:Qt},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1,translateX:$t}},DID_LOAD_ITEM:Kt,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},DID_START_ITEM_PROCESSING:Jt,DID_REQUEST_ITEM_PROCESSING:Jt,DID_UPDATE_ITEM_PROCESS_PROGRESS:Jt,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:$t}},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:$t},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:Kt},tr=A({create:({root:e})=>{e.element.innerHTML=e.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}}}}),rr=L({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:e,action:t})=>{e.ref.buttonAbortItemProcessing.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:e,action:t})=>{e.ref.buttonAbortItemLoad.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:e,action:t})=>{e.ref.buttonAbortItemRemoval.label=t.value},DID_REQUEST_ITEM_PROCESSING:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:e})=>{e.ref.loadProgressIndicator.spin=!0,e.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:e,action:t})=>{e.ref.loadProgressIndicator.spin=!1,e.ref.loadProgressIndicator.progress=t.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{e.ref.processProgressIndicator.spin=!1,e.ref.processProgressIndicator.progress=t.progress}}),or=A({create:({root:t,props:r})=>{const o=Object.keys(kt).reduce((e,t)=>(e[t]={...kt[t]},e),{}),{id:n}=r,i=t.query("GET_ALLOW_REVERT"),s=t.query("GET_ALLOW_REMOVE"),a=t.query("GET_ALLOW_PROCESS"),l=t.query("GET_INSTANT_UPLOAD"),c=t.query("IS_ASYNC"),d=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");let p;c?a&&!i?p=(e=>!/RevertItemProcessing/.test(e)):!a&&i?p=(e=>!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(e)):a||i||(p=(e=>!/Process/.test(e))):p=(e=>!/Process/.test(e));const E=p?Xt.filter(p):Xt.concat();if(l&&i&&(o.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",o.RevertItemProcessing.icon="GET_ICON_REMOVE"),c&&!i){const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=jt,e.info.translateY=zt,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(c&&!a&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach(e=>{er[e].status.translateY=zt}),er.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=Wt),d&&i){o.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=$t,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}s||(o.RemoveItem.disabled=!0),e(o,(e,r)=>{const o=t.createChildView(Nt,{label:t.query(r.label),icon:t.query(r.icon),opacity:0});E.includes(e)&&t.appendChildView(o),r.disabled&&(o.element.setAttribute("disabled","disabled"),o.element.setAttribute("hidden","hidden")),o.element.dataset.align=t.query(`GET_STYLE_${r.align}`),o.element.classList.add(r.className),o.on("click",e=>{e.stopPropagation(),r.disabled||t.dispatch(r.action,{query:n})}),t.ref[`button${e}`]=o}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(tr)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(Ft,{id:n})),t.ref.status=t.appendChildView(t.createChildView(Ht,{id:n}));const u=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));u.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=u;const _=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));_.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=_,t.ref.activeStyles=[]},write:({root:t,actions:r,props:o})=>{rr({root:t,actions:r,props:o});let n=r.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>er[e.type]);if(n){t.ref.activeStyles=[];const r=er[n.type];e(Zt,(o,n)=>{const i=t.ref[o];e(n,(e,n)=>{const s=r[o]&&void 0!==r[o][e]?r[o][e]:n;t.ref.activeStyles.push({control:i,key:e,value:s})})})}t.ref.activeStyles.forEach(({control:e,key:r,value:o})=>{e[r]="function"==typeof o?o(t):o})},didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},name:"file"}),nr=A({create:({root:e,props:t})=>{e.ref.fileName=Pt("legend"),e.appendChild(e.ref.fileName),e.ref.file=e.appendChildView(e.createChildView(or,{id:t.id})),e.ref.data=!1},ignoreRect:!0,write:L({DID_LOAD_ITEM:({root:e,props:t})=>{vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))}}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},tag:"fieldset",name:"file-wrapper"}),ir={type:"spring",damping:.6,mass:7},sr=(e,t,r)=>{const o=A({name:`panel-${t.name} filepond--${r}`,mixins:t.mixins,ignoreRectUpdate:!0}),n=e.createChildView(o,t.props);e.ref[t.name]=e.appendChildView(n)},ar=A({name:"panel",read:({root:e,props:t})=>t.heightCurrent=e.ref.bottom.translateY,write:({root:e,props:t})=>{if(null!==e.ref.scalable&&t.scalable===e.ref.scalable||(e.ref.scalable=!w(t.scalable)||t.scalable,e.element.dataset.scalable=e.ref.scalable),!t.height)return;const r=e.ref.top.rect.element,o=e.ref.bottom.rect.element,n=Math.max(r.height+o.height,t.height);e.ref.center.translateY=r.height,e.ref.center.scaleY=(n-r.height-o.height)/100,e.ref.bottom.translateY=n-o.height},create:({root:e,props:t})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:ir},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:ir},styles:["translateY"]}}].forEach(r=>{sr(e,r,t.name)}),e.element.classList.add(`filepond--${t.name}`),e.ref.scalable=null},ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),lr={type:"spring",stiffness:.75,damping:.45,mass:10},cr={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"},dr=L({DID_UPDATE_PANEL_HEIGHT:({root:e,action:t})=>{e.height=t.height}}),pr=L({DID_GRAB_ITEM:({root:e,props:t})=>{t.dragOrigin={x:e.translateX,y:e.translateY}},DID_DRAG_ITEM:({root:e})=>{e.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:e,props:t})=>{t.dragOffset=null,t.dragOrigin=null,e.element.dataset.dragState="drop"}},({root:e,actions:t,props:r,shouldOptimize:o})=>{"drop"===e.element.dataset.dragState&&e.scaleX<=1&&(e.element.dataset.dragState="idle");let n=t.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>cr[e.type]);n&&n.type!==r.currentState&&(r.currentState=n.type,e.element.dataset.filepondItemState=cr[r.currentState]||"");const i=e.query("GET_ITEM_PANEL_ASPECT_RATIO")||e.query("GET_PANEL_ASPECT_RATIO");i?o||(e.height=e.rect.element.width*i):(dr({root:e,actions:t,props:r}),!e.height&&e.ref.container.rect.element.height>0&&(e.height=e.ref.container.rect.element.height)),o&&(e.ref.panel.height=null),e.ref.panel.height=e.height}),Er=A({create:({root:e,props:t})=>{if(e.ref.handleClick=(r=>e.dispatch("DID_ACTIVATE_ITEM",{id:t.id})),e.element.id=`filepond--item-${t.id}`,e.element.addEventListener("click",e.ref.handleClick),e.ref.container=e.appendChildView(e.createChildView(nr,{id:t.id})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"item-panel"})),e.ref.panel.height=null,t.markedForRemoval=!1,!e.query("GET_ALLOW_REORDER"))return;e.element.dataset.dragState="idle";e.element.addEventListener("pointerdown",r=>{if(!r.isPrimary)return;let o=!1;const n=r.pageX,i=r.pageY;t.dragOrigin={x:e.translateX,y:e.translateY},t.dragCenter={x:r.offsetX,y:r.offsetY};const s=(e=>{const t=e.map(e=>e.id);let r=void 0;return{setIndex:e=>{r=e},getIndex:()=>r,getItemIndex:e=>t.indexOf(e.id)}})(e.query("GET_ACTIVE_ITEMS"));e.dispatch("DID_GRAB_ITEM",{id:t.id,dragState:s});const a=r=>{r.isPrimary&&(r.stopPropagation(),r.preventDefault(),t.dragOffset={x:r.pageX-n,y:r.pageY-i},t.dragOffset.x*t.dragOffset.x+t.dragOffset.y*t.dragOffset.y>16&&!o&&(o=!0,e.element.removeEventListener("click",e.ref.handleClick)),e.dispatch("DID_DRAG_ITEM",{id:t.id,dragState:s}))},l=r=>{r.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",l),t.dragOffset={x:r.pageX-n,y:r.pageY-i},e.dispatch("DID_DROP_ITEM",{id:t.id,dragState:s}),o&&setTimeout(()=>e.element.addEventListener("click",e.ref.handleClick),0))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",l)})},write:pr,destroy:({root:e,props:t})=>{e.element.removeEventListener("click",e.ref.handleClick),e.dispatch("RELEASE_ITEM",{query:t.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:lr,translateY:lr,opacity:{type:"tween",duration:150}}}});var ur=(e,t)=>Math.max(1,Math.floor((e+1)/t));const _r=(e,t,r)=>{if(!r)return;const o=e.rect.element.width,n=t.length;let i=null;if(0===n||r.topa){if(r.left{e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=r,Date.now()>e.spawnDate&&(0===e.opacity&&Ir(e,t,r,o,n),e.scaleX=1,e.scaleY=1,e.opacity=1))},Ir=(e,t,r,o,n)=>{e.interactionMethod===ne?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=r):e.interactionMethod===te?(e.translateX=null,e.translateX=t-20*o,e.translateY=null,e.translateY=r-10*n,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=r-30):e.interactionMethod===ee&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},mr=e=>e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop,hr=L({DID_ADD_ITEM:({root:e,action:t})=>{const{id:r,index:o,interactionMethod:n}=t;e.ref.addIndex=o;const i=Date.now();let s=i,a=1;if(n!==ne){a=0;const t=e.query("GET_ITEM_INSERT_INTERVAL"),r=i-e.ref.lastItemSpanwDate;s=r{const{id:r}=t,o=e.childViews.find(e=>e.id===r);o&&(o.scaleX=.9,o.scaleY=.9,o.opacity=0,o.markedForRemoval=!0)},DID_DRAG_ITEM:({root:e,action:t})=>{const{id:r,dragState:o}=t,n=e.query("GET_ITEM",{id:r}),i=e.childViews.find(e=>e.id===r),s=e.childViews.length,a=o.getItemIndex(n);if(!i)return;const l=i.dragOrigin.x+i.dragOffset.x+i.dragCenter.x,c=i.dragOrigin.y+i.dragOffset.y+i.dragCenter.y,d=mr(i),p=(e=>e.rect.element.width+.5*e.rect.element.marginLeft+.5*e.rect.element.marginRight)(i);let E=Math.floor(e.rect.outer.width/p);E>s&&(E=s);const u=Math.floor(s/E+1);Tr.setHeight=d*u,Tr.setWidth=p*E;var _={y:Math.floor(c/d),x:Math.floor(l/p),getGridIndex:function(){return c>Tr.getHeight||c<0||l>Tr.getWidth||l<0?a:this.y*E+this.x},getColIndex:function(){const t=e.query("GET_ACTIVE_ITEMS"),r=e.childViews.filter(e=>e.rect.element.height),o=t.map(e=>r.find(t=>t.id===e.id)),n=o.findIndex(e=>e===i),s=mr(i),a=o.length;let l=a,d=0,p=0,E=0;for(let e=0;ee){if(c1?_.getGridIndex():_.getColIndex();e.dispatch("MOVE_ITEM",{query:i,index:T});const f=o.getIndex();if(void 0===f||f!==T){if(o.setIndex(T),void 0===f)return;e.dispatch("DID_REORDER_ITEMS",{items:e.query("GET_ACTIVE_ITEMS"),origin:a,target:T})}}}),Rr=A({create:({root:e})=>{r(e.element,"role","list"),e.ref.lastItemSpanwDate=Date.now()},write:({root:e,props:t,actions:r,shouldOptimize:o})=>{hr({root:e,props:t,actions:r});const{dragCoordinates:n}=t,i=e.rect.element.width,s=e.childViews.filter(e=>e.rect.element.height),a=e.query("GET_ACTIVE_ITEMS").map(e=>s.find(t=>t.id===e.id)).filter(e=>e),l=n?_r(e,a,n):null,c=e.ref.addIndex||null;e.ref.addIndex=null;let d=0,p=0,E=0;if(0===a.length)return;const u=a[0].rect.element,_=u.marginTop+u.marginBottom,T=u.marginLeft+u.marginRight,f=u.width+T,I=ur(i,f);if(1===I){let e=0,t=0;a.forEach((r,n)=>{if(l){let e=n-l;t=-2===e?.25*-_:-1===e?.75*-_:0===e?.75*_:1===e?.25*_:0}o&&(r.translateX=null,r.translateY=null),r.markedForRemoval||fr(r,0,e+t);let i=(r.rect.element.height+_)*(r.markedForRemoval?r.opacity:1);e+=i})}else{let e=0,t=0,r=0;a.forEach((n,i)=>{i===l&&(d=1),i===c&&(E+=1),n.markedForRemoval&&n.opacity<.5&&(p-=1);const s=(i+E+d+p)%I,u=n.rect.element.height+_;u>r&&(r=u);const T=s+1===I||!a[i+1],m=s*f,h=t,R=Math.sign(m-e),g=Math.sign(h-t);e=m,T&&(t+=r,r=0),n.markedForRemoval||(o&&(n.translateX=null,n.translateY=null),fr(n,m,h,R,g))})}},tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(e=>e.markedForRemoval&&0===e.opacity&&e.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:(e,t)=>t.filter(t=>!t.data||!t.data.id||e.id===t.data.id),mixins:{apis:["dragCoordinates"]}}),gr=L({DID_DRAG:({root:e,props:t,action:r})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:r.position.scopeLeft-e.ref.list.rect.element.left,top:r.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},DID_END_DRAG:({props:e})=>{e.dragCoordinates=null}}),Or=A({create:({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(Rr)),t.dragCoordinates=null,t.overflowing=!1},write:({root:e,props:t,actions:r})=>{if(gr({root:e,props:t,actions:r}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){const r=Math.round(t.overflow);r!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Dr=(e,t,o,n="")=>{o?r(e,t,n):e.removeAttribute(t)},Sr=({root:e,action:t})=>{e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Dr(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},yr=({root:e,action:t})=>{Dr(e.element,"multiple",t.value)},Ar=({root:e,action:t})=>{Dr(e.element,"webkitdirectory",t.value)},Lr=({root:e})=>{const t=e.query("GET_DISABLED"),r=e.query("GET_ALLOW_BROWSE"),o=t||!r;Dr(e.element,"disabled",o)},Pr=({root:e,action:t})=>{t.value?0===e.query("GET_TOTAL_ITEMS")&&Dr(e.element,"required",!0):Dr(e.element,"required",!1)},vr=({root:e,action:t})=>{Dr(e.element,"capture",!!t.value,!0===t.value?"":t.value)},Mr=({root:e})=>{const{element:t}=e;if(e.query("GET_TOTAL_ITEMS")>0)Dr(t,"required",!1),Dr(t,"name",!1);else{Dr(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&Dr(t,"required",!0)}},br=A({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,r(e.element,"name",e.query("GET_NAME")),r(e.element,"aria-controls",`filepond--assistant-${t.id}`),r(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),Sr({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),yr({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Ar({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Lr({root:e}),Pr({root:e,action:{value:e.query("GET_REQUIRED")}}),vr({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=(r=>{if(!e.element.value)return;const o=Array.from(e.element.files).map(e=>(e._relativePath=e.webkitRelativePath,e));setTimeout(()=>{t.onload(o),(e=>{if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){const t=Pt("form"),r=e.parentNode,o=e.nextSibling;t.appendChild(e),t.reset(),o?r.insertBefore(e,o):r.appendChild(e)}}})(e.element)},250)}),e.element.addEventListener("change",e.ref.handleChange)},destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:L({DID_LOAD_ITEM:Mr,DID_REMOVE_ITEM:Mr,DID_THROW_ITEM_INVALID:({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Lr,DID_SET_ALLOW_BROWSE:Lr,DID_SET_ALLOW_DIRECTORIES_ONLY:Ar,DID_SET_ALLOW_MULTIPLE:yr,DID_SET_ACCEPTED_FILE_TYPES:Sr,DID_SET_CAPTURE_METHOD:vr,DID_SET_REQUIRED:Pr})}),Cr=13,Nr=32,wr=(e,t)=>{e.innerHTML=t;const o=e.querySelector(".filepond--label-action");return o&&r(o,"tabindex","0"),t},Gr=A({name:"drop-label",ignoreRect:!0,create:({root:e,props:t})=>{const o=Pt("label");r(o,"for",`filepond--browser-${t.id}`),r(o,"id",`filepond--drop-label-${t.id}`),r(o,"aria-hidden","true"),e.ref.handleKeyDown=(t=>{(t.keyCode===Cr||t.keyCode===Nr)&&(t.preventDefault(),e.ref.label.click())}),e.ref.handleClick=(t=>{t.target===o||o.contains(t.target)||e.ref.label.click()}),o.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),wr(o,t.caption),e.appendChild(o),e.ref.label=o},destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:L({DID_SET_LABEL_IDLE:({root:e,action:t})=>{wr(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Ur=A({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}}}}),Br=L({DID_DRAG:({root:e,action:t})=>{e.ref.blob?(e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1):(({root:e})=>{const t=.5*e.rect.element.width,r=.5*e.rect.element.height;e.ref.blob=e.appendChildView(e.createChildView(Ur,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:r}))})({root:e})},DID_DROP:({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},DID_END_DRAG:({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)}}),Fr=A({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:({root:e,props:t,actions:r})=>{Br({root:e,props:t,actions:r});const{blob:o}=e.ref;0===r.length&&o&&0===o.opacity&&(e.removeChildView(o),e.ref.blob=null)}}),qr=(e,t)=>{try{const r=new DataTransfer;t.forEach(e=>{e instanceof File?r.items.add(e):r.items.add(new File([e],e.name,{type:e.type}))}),e.files=r.files}catch(e){return!1}return!0},Vr=(e,t)=>e.ref.fields[t],xr=e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Yr=({root:e})=>xr(e),Hr=L({DID_SET_DISABLED:({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},DID_ADD_ITEM:({root:e,action:t})=>{const r=!(e.query("GET_ITEM",t.id).origin===Ee.LOCAL)&&e.query("SHOULD_UPDATE_FILE_INPUT"),o=Pt("input");o.type=r?"file":"hidden",o.name=e.query("GET_NAME"),o.disabled=e.query("GET_DISABLED"),e.ref.fields[t.id]=o,xr(e)},DID_LOAD_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);if(!r)return;if(null!==t.serverFileReference&&(r.value=t.serverFileReference),!e.query("SHOULD_UPDATE_FILE_INPUT"))return;const o=e.query("GET_ITEM",t.id);qr(r,[o.file])},DID_REMOVE_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete e.ref.fields[t.id])},DID_DEFINE_VALUE:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(null===t.value?r.removeAttribute("value"):r.value=t.value,xr(e))},DID_PREPARE_OUTPUT:({root:e,action:t})=>{e.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{const r=Vr(e,t.id);r&&qr(r,[t.file])},0)},DID_REORDER_ITEMS:Yr,DID_SORT_ITEMS:Yr}),kr=A({tag:"fieldset",name:"data",create:({root:e})=>e.ref.fields={},write:Hr,ignoreRect:!0}),Xr=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],$r=["css","csv","html","txt"],Wr={zip:"zip|compressed",epub:"application/epub+zip"},zr=(e="")=>(e=e.toLowerCase(),Xr.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):$r.includes(e)?"text/"+e:Wr[e]||""),jr=e=>new Promise((t,r)=>{const o=io(e);if(o.length&&!Qr(e))return t(o);Zr(e).then(t)}),Qr=e=>!!e.files&&e.files.length>0,Zr=e=>new Promise((t,r)=>{const o=(e.items?Array.from(e.items):[]).filter(e=>Kr(e)).map(e=>Jr(e));o.length?Promise.all(o).then(e=>{const r=[];e.forEach(e=>{r.push.apply(r,e)}),t(r.filter(e=>e).map(e=>(e._relativePath||(e._relativePath=e.webkitRelativePath),e)))}).catch(console.error):t(e.files?Array.from(e.files):[])}),Kr=e=>{if(oo(e)){const t=no(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},Jr=e=>new Promise((t,r)=>{ro(e)?eo(no(e)).then(t).catch(r):t([e.getAsFile()])}),eo=e=>new Promise((t,r)=>{const o=[];let n=0,i=0;const s=()=>{0===i&&0===n&&t(o)},a=e=>{n++;const t=e.createReader(),l=()=>{t.readEntries(e=>{if(0===e.length)return n--,void s();e.forEach(e=>{e.isDirectory?a(e):(i++,e.file(t=>{const r=to(t);e.fullPath&&(r._relativePath=e.fullPath),o.push(r),i--,s()}))}),l()},r)};l()};a(e)}),to=e=>{if(e.type.length)return e;const t=e.lastModifiedDate,r=e.name,o=zr(Fe(e.name));return o.length?((e=e.slice(0,e.size,o)).name=r,e.lastModifiedDate=t,e):e},ro=e=>oo(e)&&(no(e)||{}).isDirectory,oo=e=>"webkitGetAsEntry"in e,no=e=>e.webkitGetAsEntry(),io=e=>{let t=[];try{if((t=ao(e)).length)return t;t=so(e)}catch(e){}return t},so=e=>{let t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},ao=e=>{let t=e.getData("text/html");if("string"==typeof t&&t.length){const e=t.match(/src\s*=\s*"(.+?)"/);if(e)return[e[1]]}return[]},lo=[],co=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),po=e=>{const t=lo.find(t=>t.element===e);if(t)return t;const r=Eo(e);return lo.push(r),r},Eo=t=>{const r=[],o={dragenter:fo,dragover:Io,dragleave:ho,drop:mo},n={};e(o,(e,o)=>{n[e]=o(t,r),t.addEventListener(e,n[e],!1)});const i={element:t,addListener:s=>(r.push(s),()=>{r.splice(r.indexOf(s),1),0===r.length&&(lo.splice(lo.indexOf(i),1),e(o,e=>{t.removeEventListener(e,n[e],!1)}))})};return i},uo=(e,t)=>{const r=((e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)))((e=>"getRootNode"in e?e.getRootNode():document)(t),{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)};let _o=null;const To=(e,t)=>{try{e.dropEffect=t}catch(e){}},fo=(e,t)=>e=>{e.preventDefault(),_o=e.target,t.forEach(t=>{const{element:r,onenter:o}=t;uo(e,r)&&(t.state="enter",o(co(e)))})},Io=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(o=>{let n=!1;t.some(t=>{const{filterElement:i,element:s,onenter:a,onexit:l,ondrag:c,allowdrop:d}=t;To(r,"copy");const p=d(o);if(p)if(uo(e,s)){if(n=!0,null===t.state)return t.state="enter",void a(co(e));if(t.state="over",i&&!p)return void To(r,"none");c(co(e))}else i&&!n&&To(r,"none"),t.state&&(t.state=null,l(co(e)));else To(r,"none")})})},mo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(r=>{t.forEach(t=>{const{filterElement:o,element:n,ondrop:i,onexit:s,allowdrop:a}=t;if(t.state=null,!o||uo(e,n))return a(r)?void i(co(e),r):s(co(e))})})},ho=(e,t)=>e=>{_o===e.target&&t.forEach(t=>{const{onexit:r}=t;t.state=null,r(co(e))})},Ro=(e,t,r)=>{e.classList.add("filepond--hopper");const{catchesDropsOnPage:o,requiresDropOnElement:n,filterItems:i=(e=>e)}=r,s=((e,t,r)=>{const o=po(t),n={element:e,filterElement:r,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=o.addListener(n),n})(e,o?document.documentElement:e,n);let a="",l="";s.allowdrop=(e=>t(i(e))),s.ondrop=((e,r)=>{const o=i(r);t(o)?(l="drag-drop",c.onload(o,e)):c.ondragend(e)}),s.ondrag=(e=>{c.ondrag(e)}),s.onenter=(e=>{l="drag-over",c.ondragstart(e)}),s.onexit=(e=>{l="drag-exit",c.ondragend(e)});const c={updateHopperState:()=>{a!==l&&(e.dataset.hopperState=l,a=l)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{s.destroy()}};return c};let go=!1;const Oo=[],Do=e=>{const t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){let e=!1,r=t;for(;r!==document.body;){if(r.classList.contains("filepond--root")){e=!0;break}r=r.parentNode}if(!e)return}jr(e.clipboardData).then(e=>{e.length&&Oo.forEach(t=>t(e))})},So=()=>{const e=e=>{t.onload(e)},t={destroy:()=>{(e=>{se(Oo,Oo.indexOf(e)),0===Oo.length&&(document.removeEventListener("paste",Do),go=!1)})(e)},onload:()=>{}};return(e=>{Oo.includes(e)||(Oo.push(e),go||(go=!0,document.addEventListener("paste",Do)))})(e),t};let yo=null,Ao=null;const Lo=[],Po=(e,t)=>{e.element.textContent=t},vo=(e,t,r)=>{const o=e.query("GET_TOTAL_ITEMS");Po(e,`${r} ${t}, ${o} ${1===o?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(Ao),Ao=setTimeout(()=>{(e=>{e.element.textContent=""})(e)},1500)},Mo=e=>e.element.parentNode.contains(document.activeElement),bo=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");Po(e,`${r} ${o}`)},Co=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename;Po(e,`${t.status.main} ${r} ${t.status.sub}`)},No=A({create:({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,r(e.element,"role","status"),r(e.element,"aria-live","polite"),r(e.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:({root:e,action:t})=>{if(!Mo(e))return;e.element.textContent="";const r=e.query("GET_ITEM",t.id);Lo.push(r.filename),clearTimeout(yo),yo=setTimeout(()=>{vo(e,Lo.join(", "),e.query("GET_LABEL_FILE_ADDED")),Lo.length=0},750)},DID_REMOVE_ITEM:({root:e,action:t})=>{if(!Mo(e))return;const r=t.item;vo(e,r.filename,e.query("GET_LABEL_FILE_REMOVED"))},DID_COMPLETE_ITEM_PROCESSING:({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Po(e,`${r} ${o}`)},DID_ABORT_ITEM_PROCESSING:bo,DID_REVERT_ITEM_PROCESSING:bo,DID_THROW_ITEM_REMOVE_ERROR:Co,DID_THROW_ITEM_LOAD_ERROR:Co,DID_THROW_ITEM_INVALID:Co,DID_THROW_ITEM_PROCESSING_ERROR:Co}),tag:"span",name:"assistant"}),wo=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),e=>e.charAt(1).toUpperCase()),Go=(e,t=16,r=!0)=>{let o=Date.now(),n=null;return(...i)=>{clearTimeout(n);const s=Date.now()-o,a=()=>{o=Date.now(),e(...i)};se.preventDefault(),Bo=e=>{const t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},Fo=e=>{let t=0,r=0;const o=e.ref.list.childViews[0],n=o.childViews.filter(e=>e.rect.element.height),i=e.query("GET_ACTIVE_ITEMS").map(e=>n.find(t=>t.id===e.id)).filter(e=>e);if(0===i.length)return{visual:t,bounds:r};const s=o.rect.element.width,a=i[0].rect.element,l=a.marginTop+a.marginBottom,c=a.marginLeft+a.marginRight,d=a.width+c,p=ur(s,d);if(1===p)i.forEach(e=>{const o=e.rect.element.height+l;r+=o,t+=o*e.opacity});else{let e=0,o=0;i.forEach(function(t,r){let n=t.rect.element.height+l;const s=Math.floor(r/p),a=Math.floor(r-s*p)+1===p||!i[r+1];n>e&&(e=n),a&&(o+=e,e=0)}),t=r=o}return{visual:t,bounds:r}},qo=e=>{const t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Vo=(e,t)=>{const r=e.query("GET_ALLOW_REPLACE"),o=e.query("GET_ALLOW_MULTIPLE"),n=e.query("GET_TOTAL_ITEMS");let i=e.query("GET_MAX_FILES");const s=t.length;return!o&&s>1||!!(V(i=o?i:r?i:1)&&n+s>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ke("warning",0,"Max files")}),!0)},xo=(e,t,r)=>{const o=e.childViews[0];return _r(o,t,{left:r.scopeLeft-o.rect.element.left,top:r.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Yo=e=>{const t=e.query("GET_ALLOW_DROP"),r=e.query("GET_DISABLED"),o=t&&!r;if(o&&!e.ref.hopper){const t=Ro(e.element,t=>{const r=e.query("GET_BEFORE_DROP_FILE")||(()=>!0);return!e.query("GET_DROP_VALIDATION")||t.every(t=>me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(e=>!0===e)&&r(t))},{filterItems:t=>{const r=e.query("GET_IGNORED_FILES");return t.filter(e=>!_t(e)||!r.includes(e.name.toLowerCase()))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});t.onload=((t,r)=>{const o=e.ref.list.childViews[0].childViews.filter(e=>e.rect.element.height),n=e.query("GET_ACTIVE_ITEMS").map(e=>o.find(t=>t.id===e.id)).filter(e=>e);Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:xo(e.ref.list,n,r),interactionMethod:te})}),e.dispatch("DID_DROP",{position:r}),e.dispatch("DID_END_DRAG",{position:r})}),t.ondragstart=(t=>{e.dispatch("DID_START_DRAG",{position:t})}),t.ondrag=Go(t=>{e.dispatch("DID_DRAG",{position:t})}),t.ondragend=(t=>{e.dispatch("DID_END_DRAG",{position:t})}),e.ref.hopper=t,e.ref.drip=e.appendChildView(e.createChildView(Fr))}else!o&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Ho=(e,t)=>{const r=e.query("GET_ALLOW_BROWSE"),o=e.query("GET_DISABLED"),n=r&&!o;n&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(br,{...t,onload:t=>{Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})})}}),0):!n&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},ko=e=>{const t=e.query("GET_ALLOW_PASTE"),r=e.query("GET_DISABLED"),o=t&&!r;o&&!e.ref.paster?(e.ref.paster=So(),e.ref.paster.onload=(t=>{Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})})})):!o&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Xo=L({DID_SET_ALLOW_BROWSE:({root:e,props:t})=>{Ho(e,t)},DID_SET_ALLOW_DROP:({root:e})=>{Yo(e)},DID_SET_ALLOW_PASTE:({root:e})=>{ko(e)},DID_SET_DISABLED:({root:e,props:t})=>{Yo(e),ko(e),Ho(e,t),e.query("GET_DISABLED")?e.element.dataset.disabled="disabled":e.element.removeAttribute("data-disabled")}}),$o=A({name:"root",read:({root:e})=>{e.ref.measure&&(e.ref.measureHeight=e.ref.measure.offsetHeight)},create:({root:e,props:t})=>{const r=e.query("GET_ID");r&&(e.element.id=r);const o=e.query("GET_CLASS_NAME");o&&o.split(" ").filter(e=>e.length).forEach(t=>{e.element.classList.add(t)}),e.ref.label=e.appendChildView(e.createChildView(Gr,{...t,translateY:null,caption:e.query("GET_LABEL_IDLE")})),e.ref.list=e.appendChildView(e.createChildView(Or,{translateY:null})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"panel-root"})),e.ref.assistant=e.appendChildView(e.createChildView(No,{...t})),e.ref.data=e.appendChildView(e.createChildView(kr,{...t})),e.ref.measure=Pt("div"),e.ref.measure.style.height="100%",e.element.appendChild(e.ref.measure),e.ref.bounds=null,e.query("GET_STYLES").filter(e=>!b(e.value)).map(({name:t,value:r})=>{e.element.dataset[t]=r}),e.ref.widthPrevious=null,e.ref.widthUpdated=Go(()=>{e.ref.updateHistory=[],e.dispatch("DID_RESIZE_ROOT")},250),e.ref.previousAspectRatio=null,e.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,i="PointerEvent"in window;e.query("GET_ALLOW_REORDER")&&i&&!n&&(e.element.addEventListener("touchmove",Uo,{passive:!1}),e.element.addEventListener("gesturestart",Uo));const s=e.query("GET_CREDITS");if(2===s.length){const t=document.createElement("a");t.className="filepond--credits",t.setAttribute("aria-hidden","true"),t.href=s[0],t.tabindex=-1,t.target="_blank",t.rel="noopener noreferrer",t.textContent=s[1],e.element.appendChild(t),e.ref.credits=t}},write:({root:e,props:t,actions:r})=>{if(Xo({root:e,props:t,actions:r}),r.filter(e=>/^DID_SET_STYLE_/.test(e.type)).filter(e=>!b(e.data.value)).map(({type:t,data:r})=>{const o=wo(t.substr(8).toLowerCase(),"_");e.element.dataset[o]=r.value,e.invalidateLayout()}),e.rect.element.hidden)return;e.rect.element.width!==e.ref.widthPrevious&&(e.ref.widthPrevious=e.rect.element.width,e.ref.widthUpdated());let o=e.ref.bounds;o||(o=e.ref.bounds=qo(e),e.element.removeChild(e.ref.measure),e.ref.measure=null);const{hopper:n,label:i,list:s,panel:a}=e.ref;n&&n.updateHopperState();const l=e.query("GET_PANEL_ASPECT_RATIO"),c=e.query("GET_ALLOW_MULTIPLE"),d=e.query("GET_TOTAL_ITEMS"),p=d===(c?e.query("GET_MAX_FILES")||1e6:1),E=r.find(e=>"DID_ADD_ITEM"===e.type);if(p&&E){const e=E.data.interactionMethod;i.opacity=0,c?i.translateY=-40:e===ee?i.translateX=40:i.translateY=e===re?40:30}else p||(i.opacity=1,i.translateX=0,i.translateY=0);const u=Bo(e),_=Fo(e),T=i.rect.element.height,f=!c||p?0:T,I=p?s.rect.element.marginTop:0,m=0===d?0:s.rect.element.marginBottom,h=f+I+_.visual+m,R=f+I+_.bounds+m;if(s.translateY=Math.max(0,f-s.rect.element.marginTop)-u.top,l){const t=e.rect.element.width,r=t*l;l!==e.ref.previousAspectRatio&&(e.ref.previousAspectRatio=l,e.ref.updateHistory=[]);const o=e.ref.updateHistory;o.push(t);const n=2;if(o.length>2*n){const e=o.length,t=e-10;let r=0;for(let i=e;i>=t;i--)if(o[i]===o[i-2]&&r++,r>=n)return}a.scalable=!1,a.height=r;const i=r-f-(m-u.bottom)-(p?I:0);_.visual>i?s.overflow=i:s.overflow=null,e.height=r}else if(o.fixedHeight){a.scalable=!1;const e=o.fixedHeight-f-(m-u.bottom)-(p?I:0);_.visual>e?s.overflow=e:s.overflow=null}else if(o.cappedHeight){const t=h>=o.cappedHeight,r=Math.min(o.cappedHeight,h);a.scalable=!0,a.height=t?r:r-u.top-u.bottom;const n=r-f-(m-u.bottom)-(p?I:0);h>o.cappedHeight&&_.visual>n?s.overflow=n:s.overflow=null,e.height=Math.min(o.cappedHeight,R-u.top-u.bottom)}else{const t=d>0?u.top+u.bottom:0;a.scalable=!0,a.height=Math.max(T,h-t),e.height=Math.max(T,R-t)}e.ref.credits&&a.heightCurrent&&(e.ref.credits.style.transform=`translateY(${a.heightCurrent}px)`)},destroy:({root:e})=>{e.ref.paster&&e.ref.paster.destroy(),e.ref.hopper&&e.ref.hopper.destroy(),e.element.removeEventListener("touchmove",Uo),e.element.removeEventListener("gesturestart",Uo)},mixins:{styles:["height"]}}),Wo=(e={})=>{let r=null;const o=Re(),n=((e,t=[],r=[])=>{const o={...e},n=[],i=[],s=(e,t,r)=>{!r||document.hidden?(d[e]&&d[e](t),n.push({type:e,data:t})):i.push({type:e,data:t})},a=(e,...t)=>c[e]?c[e](...t):null,l={getState:()=>({...o}),processActionQueue:()=>{const e=[...n];return n.length=0,e},processDispatchQueue:()=>{const e=[...i];i.length=0,e.forEach(({type:e,data:t})=>{s(e,t)})},dispatch:s,query:a};let c={};t.forEach(e=>{c={...e(o),...c}});let d={};return r.forEach(e=>{d={...e(s,a,o),...d}}),l})((e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:j(e)}))(o),[we,J(o)],[yt,K(o)]);n.dispatch("SET_OPTIONS",{options:e});const i=()=>{document.hidden||n.dispatch("KICK")};document.addEventListener("visibilitychange",i);let s=null,a=!1,l=!1,c=null,d=null;const p=()=>{a||(a=!0),clearTimeout(s),s=setTimeout(()=>{a=!1,c=null,d=null,l&&(l=!1,n.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const E=$o(n,{id:ie()});let u=!1,_=!1;const f={_read:()=>{a&&(d=window.innerWidth,c||(c=d),l||d===c||(n.dispatch("DID_START_RESIZE"),l=!0)),_&&u&&(u=null===E.element.offsetParent),u||(E._read(),_=E.rect.element.hidden)},_write:e=>{const t=n.processActionQueue().filter(e=>!/^SET_/.test(e.type));u&&!t.length||(R(t),u=E._write(e,t,l),(e=>{e.forEach((t,r)=>{t.released&&se(e,r)})})(n.query("GET_ITEMS")),u&&n.processDispatchQueue())}},I=e=>t=>{const r={type:e};if(!t)return r;if(t.hasOwnProperty("error")&&(r.error=t.error?{...t.error}:null),t.status&&(r.status={...t.status}),t.file&&(r.output=t.file),t.source)r.file=t.source;else if(t.item||t.id){const e=t.item?t.item:n.query("GET_ITEM",t.id);r.file=e?de(e):null}return t.items&&(r.items=t.items.map(de)),/progress/.test(e)&&(r.progress=t.progress),t.hasOwnProperty("origin")&&t.hasOwnProperty("target")&&(r.origin=t.origin,r.target=t.target),r},m={DID_DESTROY:I("destroy"),DID_INIT:I("init"),DID_THROW_MAX_FILES:I("warning"),DID_INIT_ITEM:I("initfile"),DID_START_ITEM_LOAD:I("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:I("addfileprogress"),DID_LOAD_ITEM:I("addfile"),DID_THROW_ITEM_INVALID:[I("error"),I("addfile")],DID_THROW_ITEM_LOAD_ERROR:[I("error"),I("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[I("error"),I("removefile")],DID_PREPARE_OUTPUT:I("preparefile"),DID_START_ITEM_PROCESSING:I("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:I("processfileprogress"),DID_ABORT_ITEM_PROCESSING:I("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:I("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:I("processfiles"),DID_REVERT_ITEM_PROCESSING:I("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[I("error"),I("processfile")],DID_REMOVE_ITEM:I("removefile"),DID_UPDATE_ITEMS:I("updatefiles"),DID_ACTIVATE_ITEM:I("activatefile"),DID_REORDER_ITEMS:I("reorderfiles")},h=e=>{const t={pond:A,...e};delete t.type,E.element.dispatchEvent(new CustomEvent(`FilePond:${e.type}`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const r=[];e.hasOwnProperty("error")&&r.push(e.error),e.hasOwnProperty("file")&&r.push(e.file);const o=["type","error","file"];Object.keys(e).filter(e=>!o.includes(e)).forEach(t=>r.push(e[t])),A.fire(e.type,...r);const i=n.query(`GET_ON${e.type.toUpperCase()}`);i&&i(...r)},R=e=>{e.length&&e.filter(e=>m[e.type]).forEach(e=>{const t=m[e.type];(Array.isArray(t)?t:[t]).forEach(t=>{"DID_INIT_ITEM"===e.type?h(t(e.data)):setTimeout(()=>{h(t(e.data))},0)})})},g=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),O=(e,t)=>("object"!=typeof e||(e=>e.file&&e.id)(e)||t||(t=e,e=void 0),n.dispatch("REMOVE_ITEM",{...t,query:e}),null===n.query("GET_ACTIVE_ITEM",e)),D=(...e)=>new Promise((t,r)=>{const o=[],i={};if(M(e[0]))o.push.apply(o,e[0]),Object.assign(i,e[1]||{});else{const t=e[e.length-1];"object"!=typeof t||t instanceof Blob||Object.assign(i,e.pop()),o.push(...e)}n.dispatch("ADD_ITEMS",{items:o,index:i.index,interactionMethod:ee,success:t,failure:r})}),S=()=>n.query("GET_ACTIVE_ITEMS"),y=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PROCESSING",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),A={...ae(),...f,...Z(n,o),setOptions:e=>n.dispatch("SET_OPTIONS",{options:e}),addFile:(e,t={})=>new Promise((r,o)=>{D([{source:e,options:t}],{index:t.index}).then(e=>r(e&&e[0])).catch(o)}),addFiles:D,getFile:e=>n.query("GET_ACTIVE_ITEM",e),processFile:y,prepareFile:g,removeFile:O,moveFile:(e,t)=>n.dispatch("MOVE_ITEM",{query:e,index:t}),getFiles:S,processFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;if(!t.length){const e=S().filter(e=>!(e.status===pe.IDLE&&e.origin===Ee.LOCAL)&&e.status!==pe.PROCESSING&&e.status!==pe.PROCESSING_COMPLETE&&e.status!==pe.PROCESSING_REVERT_ERROR);return Promise.all(e.map(y))}return Promise.all(t.map(y))},removeFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;let r;"object"==typeof t[t.length-1]?r=t.pop():Array.isArray(e[0])&&(r=e[1]);const o=S();return t.length?t.map(e=>T(e)?o[e]?o[e].id:null:e).filter(e=>e).map(e=>O(e,r)):Promise.all(o.map(e=>O(e,r)))},prepareFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=t.length?t:S();return Promise.all(r.map(g))},sort:e=>n.dispatch("SORT",{compare:e}),browse:()=>{var e=E.element.querySelector("input[type=file]");e&&e.click()},destroy:()=>{A.fire("destroy",E.element),n.dispatch("ABORT_ALL"),E._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",i),n.dispatch("DID_DESTROY")},insertBefore:e=>P(E.element,e),insertAfter:e=>v(E.element,e),appendTo:e=>e.appendChild(E.element),replaceElement:e=>{P(E.element,e),e.parentNode.removeChild(e),r=e},restoreElement:()=>{r&&(v(r,E.element),E.element.parentNode.removeChild(E.element),r=null)},isAttachedTo:e=>E.element===e||r===e,element:{get:()=>E.element},status:{get:()=>n.query("GET_STATUS")}};return n.dispatch("DID_INIT"),t(A)},zo=(t={})=>{const r={};return e(Re(),(e,t)=>{r[e]=t[0]}),Wo({...r,...t})},jo=(t,r)=>{e(r,(r,o)=>{e(t,(e,n)=>{const i=new RegExp(r);if(!i.test(e))return;if(delete t[e],!1===o)return;if(U(o))return void(t[o]=n);const s=o.group;X(o)&&!t[s]&&(t[s]={}),t[s][(e=>e.charAt(0).toLowerCase()+e.slice(1))(e.replace(i,""))]=n}),o.mapping&&jo(t[o.group],o.mapping)})},Qo=(t,o={})=>{const n=[];e(t.attributes,e=>{n.push(t.attributes[e])});const i=n.filter(e=>e.name).reduce((e,o)=>{const n=r(t,o.name);return e[(e=>wo(e.replace(/^data-/,"")))(o.name)]=n===o.name||n,e},{});return jo(i,o),i},Zo=(...e)=>(e=>e instanceof HTMLElement)(e[0])?((e,t={})=>{const r={"^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};me("SET_ATTRIBUTE_TO_OPTION_MAP",r);const o={...t},n=Qo("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,r);Object.keys(n).forEach(e=>{X(n[e])?(X(o[e])||(o[e]={}),Object.assign(o[e],n[e])):o[e]=n[e]}),o.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(e=>({source:e.value,options:{type:e.dataset.type}})));const i=zo(o);return e.files&&Array.from(e.files).forEach(e=>{i.addFile(e)}),i.replaceElement(e),i})(...e):zo(...e),Ko=["fire","_read","_write"],Jo=e=>{const t={};return le(e,t,Ko),t},en=(e,t)=>e.replace(/(?:{([a-zA-Z]+)})/g,(e,r)=>t[r]),tn=e=>{const t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),r=URL.createObjectURL(t),o=new Worker(r);return{transfer:(e,t)=>{},post:(e,t,r)=>{const n=ie();o.onmessage=(e=>{e.data.id===n&&t(e.data.message)}),o.postMessage({id:n,message:e},r)},terminate:()=>{o.terminate(),URL.revokeObjectURL(r)}}},rn=e=>new Promise((t,r)=>{const o=new Image;o.onload=(()=>{t(o)}),o.onerror=(e=>{r(e)}),o.src=e}),on=(e,t)=>{const r=e.slice(0,e.size,e.type);return r.lastModifiedDate=e.lastModifiedDate,r.name=t,r},nn=e=>on(e,e.name),sn=[],an=t=>{if(sn.includes(t))return;sn.push(t),(e=>Object.assign(ge,e))(t({addFilter:he,utils:{Type:Te,forin:e,isString:U,isFile:_t,toNaturalFileSize:wt,replaceInString:en,getExtensionFromFilename:Fe,getFilenameWithoutExtension:ut,guesstimateMimeType:zr,getFileFromBlob:xe,getFilenameFromURL:Be,createRoute:L,createWorker:tn,createView:A,createItemAPI:de,loadImage:rn,copyFile:nn,renameFile:on,createBlob:Ye,applyFilterChain:Ie,text:vt,getNumericAspectRatioFromString:De},views:{fileActionButton:Nt}}).options)},ln=(()=>{const e=d()&&!(()=>"[object OperaMini]"===Object.prototype.toString.call(window.operamini))()&&(()=>"visibilityState"in document)()&&(()=>"Promise"in window)()&&(()=>"slice"in Blob.prototype)()&&(()=>"URL"in window&&"createObjectURL"in window.URL)()&&(()=>"performance"in window)()&&((()=>"supports"in(window.CSS||{}))()||(()=>/MSIE|Trident/.test(window.navigator.userAgent))());return()=>e})(),cn={apps:[]},dn=()=>{};let pn={},En={},un={},_n={},Tn=dn,fn=dn,In=dn,mn=dn,hn=dn,Rn=dn,gn=dn;if(ln()){((e,t,r=60)=>{const o="__framePainter";if(window[o])return window[o].readers.push(e),void window[o].writers.push(t);window[o]={readers:[e],writers:[t]};const n=window[o],i=1e3/r;let s=null,a=null,l=null,c=null;const d=()=>{document.hidden?(l=(()=>window.setTimeout(()=>p(performance.now()),i)),c=(()=>window.clearTimeout(a))):(l=(()=>window.requestAnimationFrame(p)),c=(()=>window.cancelAnimationFrame(a)))};document.addEventListener("visibilitychange",()=>{c&&c(),d(),p(performance.now())});const p=e=>{a=l(p),s||(s=e);const t=e-s;t<=i||(s=e-t%i,n.readers.forEach(e=>e()),n.writers.forEach(t=>t(e)))};d(),p(performance.now())})(()=>{cn.apps.forEach(e=>e._read())},e=>{cn.apps.forEach(t=>t._write(e))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:ln,create:Tn,destroy:fn,parse:In,find:mn,registerPlugin:hn,setOptions:gn}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const r=()=>e(Re(),(e,t)=>{_n[e]=t[1]});pn={...ye},un={...Ee},En={...pe},_n={},r(),Tn=((...e)=>{const t=Zo(...e);return t.on("destroy",fn),cn.apps.push(t),Jo(t)}),fn=(e=>{const t=cn.apps.findIndex(t=>t.isAttachedTo(e));if(t>=0){return cn.apps.splice(t,1)[0].restoreElement(),!0}return!1}),In=(e=>{return Array.from(e.querySelectorAll(".filepond")).filter(e=>!cn.apps.find(t=>t.isAttachedTo(e))).map(e=>Tn(e))}),mn=(e=>{const t=cn.apps.find(t=>t.isAttachedTo(e));return t?Jo(t):null}),hn=((...e)=>{e.forEach(an),r()}),Rn=(()=>{const t={};return e(Re(),(e,r)=>{t[e]=r[0]}),t}),gn=(t=>(X(t)&&(cn.apps.forEach(e=>{e.setOptions(t)}),(t=>{e(t,(e,t)=>{ge[e]&&(ge[e][0]=z(t,ge[e][0],ge[e][1]))})})(t)),Rn()))}export{un as FileOrigin,En as FileStatus,_n as OptionTypes,pn as Status,Tn as create,fn as destroy,mn as find,Rn as getOptions,In as parse,hn as registerPlugin,gn as setOptions,ln as supported}; diff --git a/dist/filepond.js b/dist/filepond.js index 9f8d0fcf..d7e10653 100644 --- a/dist/filepond.js +++ b/dist/filepond.js @@ -9178,7 +9178,6 @@ var itemVerticalMargin = childRect.marginTop + childRect.marginBottom; var itemHorizontalMargin = childRect.marginLeft + childRect.marginRight; var itemWidth = childRect.width + itemHorizontalMargin; - var itemHeight = childRect.height + itemVerticalMargin; var itemsPerRow = getItemsPerRow(horizontalSpace, itemWidth); // stack @@ -9222,6 +9221,7 @@ else { var prevX = 0; var prevY = 0; + var rowMaxHeight = 0; children.forEach(function(child, index) { if (index === dragIndex) { @@ -9239,16 +9239,26 @@ var visualIndex = index + addIndexOffset + dragIndexOffset + removeIndexOffset; var indexX = visualIndex % itemsPerRow; - var indexY = Math.floor(visualIndex / itemsPerRow); + var itemHeight = child.rect.element.height + itemVerticalMargin; + + if (itemHeight > rowMaxHeight) { + rowMaxHeight = itemHeight; + } + + var isLastItemInRow = indexX + 1 === itemsPerRow || !children[index + 1]; var offsetX = indexX * itemWidth; - var offsetY = indexY * itemHeight; + var offsetY = prevY; var vectorX = Math.sign(offsetX - prevX); var vectorY = Math.sign(offsetY - prevY); prevX = offsetX; - prevY = offsetY; + + if (isLastItemInRow) { + prevY += rowMaxHeight; + rowMaxHeight = 0; + } if (child.markedForRemoval) return; @@ -11129,7 +11139,6 @@ if (children.length === 0) return { visual: visual, bounds: bounds }; var horizontalSpace = itemList.rect.element.width; - var dragIndex = getItemIndexByPosition(itemList, children, scrollList.dragCoordinates); var childRect = children[0].rect.element; @@ -11137,15 +11146,7 @@ var itemHorizontalMargin = childRect.marginLeft + childRect.marginRight; var itemWidth = childRect.width + itemHorizontalMargin; - var itemHeight = childRect.height + itemVerticalMargin; - var newItem = typeof dragIndex !== 'undefined' && dragIndex >= 0 ? 1 : 0; - var removedItem = children.find(function(child) { - return child.markedForRemoval && child.opacity < 0.45; - }) - ? -1 - : 0; - var verticalItemCount = children.length + newItem + removedItem; var itemsPerRow = getItemsPerRow(horizontalSpace, itemWidth); // stack @@ -11158,7 +11159,28 @@ } // grid else { - bounds = Math.ceil(verticalItemCount / itemsPerRow) * itemHeight; + var maxItemHeightInRow = 0; + var maxColumnHeight = 0; + + children.forEach(function(item, index) { + var height = item.rect.element.height + itemVerticalMargin; + var rowIndex = Math.floor(index / itemsPerRow); + var colIndex = Math.floor(index - rowIndex * itemsPerRow); + var isLastItemInRow = colIndex + 1 === itemsPerRow || !children[index + 1]; + if (height > maxItemHeightInRow) { + maxItemHeightInRow = height; + } + + if (!isLastItemInRow) { + return; + } + + maxColumnHeight += maxItemHeightInRow; + + maxItemHeightInRow = 0; + }); + + bounds = maxColumnHeight; visual = bounds; } diff --git a/dist/filepond.min.js b/dist/filepond.min.js index 930e8739..46b0b7fc 100644 --- a/dist/filepond.min.js +++ b/dist/filepond.min.js @@ -6,4 +6,4 @@ /* eslint-disable */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).FilePond={})}(this,function(e){"use strict";var t=function(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])},n=function(e){var n={};return t(e,function(t){!function(e,t,n){"function"!=typeof n?Object.defineProperty(e,t,Object.assign({},n)):e[t]=n}(n,t,e[t])}),n},r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===n)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},o=["svg","path"],i=function(e){return o.includes(e)},a=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof n&&(o=n,n=null);var a=i(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n&&(i(e)?r(a,"class",n):a.className=n),t(o,function(e,t){r(a,e,t)}),a},s=function(e,t){return function(e,n){return void 0!==n?t.splice(n,0,e):t.push(e),e}},u=function(e,t){return function(n){return t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n}},l="undefined"!=typeof window&&void 0!==window.document,c=function(){return l},f="children"in(c()?a("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},d=function(e,t,n,r){var o=n[0]||e.left,i=n[1]||e.top,a=o+e.width,s=i+e.height*(r[1]||1),u={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:o,top:i,right:a,bottom:s}};return t.filter(function(e){return!e.isRectIgnored()}).map(function(e){return e.rect}).forEach(function(e){p(u.inner,Object.assign({},e.inner)),p(u.outer,Object.assign({},e.outer))}),E(u.inner),u.outer.bottom+=u.element.marginBottom,u.outer.right+=u.element.marginRight,E(u.outer),u},p=function(e,t){t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},E=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},_=function(e){return"number"==typeof e},T=function(e){return e<.5?2*e*e:(4-2*e)*e-1},I={spring:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,r=void 0===t?.5:t,o=e.damping,i=void 0===o?.75:o,a=e.mass,s=void 0===a?10:a,u=null,l=null,c=0,f=!1,d=n({interpolate:function(e,t){if(!f){if(!_(u)||!_(l))return f=!0,void(c=0);(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},o=r.duration,i=void 0===o?500:o,a=r.easing,s=void 0===a?T:a,u=r.delay,l=void 0===u?0:u,c=null,f=!0,d=!1,p=null,E=n({interpolate:function(n,r){f||null===p||(null===c&&(c=n),n-c=i||r?(e=1,t=d?0:1,E.onupdate(t*p),E.oncomplete(t*p),f=!0):(t=e/i,E.onupdate((e>=0?s(d?1-t:t):0)*p))))},target:{get:function(){return d?0:p},set:function(e){if(null===p)return p=e,E.onupdate(e),void E.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach(function(t){e.forEach(function(e){var o=e,i=function(){return n[e]},a=function(t){return n[e]=t};"object"==typeof e&&(o=e.key,i=e.getter||i,a=e.setter||a),t[o]&&!r||(t[o]={get:i,set:a})})})},h=function(e){return null!=e},g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},R=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var n in t)if(t[n]!==e[n])return!0;return!1},O=function(e,t){var n=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,a=t.scaleX,s=t.scaleY,u=t.rotateX,l=t.rotateY,c=t.rotateZ,f=t.originX,d=t.originY,p=t.width,E=t.height,_="",T="";(h(f)||h(d))&&(T+="transform-origin: "+(f||0)+"px "+(d||0)+"px;"),h(r)&&(_+="perspective("+r+"px) "),(h(o)||h(i))&&(_+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(h(a)||h(s))&&(_+="scale3d("+(h(a)?a:1)+", "+(h(s)?s:1)+", 1) "),h(c)&&(_+="rotateZ("+c+"rad) "),h(u)&&(_+="rotateX("+u+"rad) "),h(l)&&(_+="rotateY("+l+"rad) "),_.length&&(T+="transform:"+_+";"),h(n)&&(T+="opacity:"+n+";",0===n&&(T+="visibility:hidden;"),n<1&&(T+="pointer-events:none;")),h(E)&&(T+="height:"+E+"px;"),h(p)&&(T+="width:"+p+"px;");var I=e.elementCurrentStyle||"";T.length===I.length&&T===I||(e.style.cssText=T,e.elementCurrentStyle=T)},y={styles:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewInternalAPI,o=e.viewExternalAPI,i=e.view,a=Object.assign({},n),s={};m(t,[r,o],n);var u=function(){return i.rect?d(i.rect,i.childViews,[n.translateX||0,n.translateY||0],[n.scaleX||0,n.scaleY||0]):null};return r.rect={get:u},o.rect={get:u},t.forEach(function(e){n[e]=void 0===a[e]?g[e]:a[e]}),{write:function(){if(R(s,n))return O(i.element,n),Object.assign(s,Object.assign({},n)),!0},destroy:function(){}}},listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t,n=e.viewExternalAPI,r=(e.viewState,e.view),o=[],i=(t=r.element,function(e,n){t.addEventListener(e,n)}),a=function(e){return function(t,n){e.removeEventListener(t,n)}}(r.element);return n.on=function(e,t){o.push({type:e,fn:t}),i(e,t)},n.off=function(e,t){o.splice(o.findIndex(function(n){return n.type===e&&n.fn===t}),1),a(e,t)},{write:function(){return!0},destroy:function(){o.forEach(function(e){a(e.type,e.fn)})}}},animations:function(e){var n=e.mixinConfig,r=e.viewProps,o=e.viewInternalAPI,i=e.viewExternalAPI,a=Object.assign({},r),s=[];return t(n,function(e,t){var n=v(t);n&&(n.onupdate=function(t){r[e]=t},n.target=a[e],m([{key:e,setter:function(e){n.target!==e&&(n.target=e)},getter:function(){return r[e]}}],[o,i],r,!0),s.push(n))}),{write:function(e){var t=document.hidden,n=!0;return s.forEach(function(r){r.resting||(n=!1),r.interpolate(e,t)}),n},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewExternalAPI;m(t,r,n)}},D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.layoutCalculated||(e.paddingTop=parseInt(n.paddingTop,10)||0,e.marginTop=parseInt(n.marginTop,10)||0,e.marginRight=parseInt(n.marginRight,10)||0,e.marginBottom=parseInt(n.marginBottom,10)||0,e.marginLeft=parseInt(n.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,r=void 0===t?"div":t,o=e.name,i=void 0===o?null:o,l=e.attributes,c=void 0===l?{}:l,p=e.read,E=void 0===p?function(){}:p,_=e.write,T=void 0===_?function(){}:_,I=e.create,v=void 0===I?function(){}:I,m=e.destroy,h=void 0===m?function(){}:m,g=e.filterFrameActionsForChild,R=void 0===g?function(e,t){return t}:g,O=e.didCreateView,S=void 0===O?function(){}:O,A=e.didWriteView,L=void 0===A?function(){}:A,b=e.ignoreRect,P=void 0!==b&&b,M=e.ignoreRectUpdate,w=void 0!==M&&M,C=e.mixins,N=void 0===C?[]:C;return function(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=a(r,"filepond--"+i,c),p=window.getComputedStyle(l,null),_=D(),I=null,m=!1,g=[],O=[],A={},b={},M=[T],C=[E],G=[h],U=function(){return l},B=function(){return g.concat()},F=function(){return I||(I=d(_,g,[0,0],[1,1]))},q={element:{get:U},style:{get:function(){return p}},childViews:{get:B}},V=Object.assign({},q,{rect:{get:F},ref:{get:function(){return A}},is:function(e){return i===e},appendChild:(t=l,function(e,n){void 0!==n&&t.children[n]?t.insertBefore(e,t.children[n]):t.appendChild(e)}),createChildView:function(e){return function(t,n){return t(e,n)}}(e),linkView:function(e){return g.push(e),e},unlinkView:function(e){g.splice(g.indexOf(e),1)},appendChildView:s(0,g),removeChildView:u(l,g),registerWriter:function(e){return M.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return G.push(e)},invalidateLayout:function(){return l.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:function(){return m}},isRectIgnored:function(){return P},_read:function(){I=null,g.forEach(function(e){return e._read()}),!(w&&_.width&&_.height)&&D(_,l,p);var e={root:k,props:o,rect:_};C.forEach(function(t){return t(e)})},_write:function(e,t,n){var r=0===t.length;return M.forEach(function(i){!1===i({props:o,root:k,actions:t,timestamp:e,shouldOptimize:n})&&(r=!1)}),O.forEach(function(t){!1===t.write(e)&&(r=!1)}),g.filter(function(e){return!!e.element.parentNode}).forEach(function(o){o._write(e,R(o,t),n)||(r=!1)}),g.forEach(function(o,i){o.element.parentNode||(k.appendChild(o.element,i),o._read(),o._write(e,R(o,t),n),r=!1)}),m=r,L({props:o,root:k,actions:t,timestamp:e}),r},_destroy:function(){O.forEach(function(e){return e.destroy()}),G.forEach(function(e){e({root:k,props:o})}),g.forEach(function(e){return e._destroy()})}},Y=Object.assign({},q,{rect:{get:function(){return _}}});Object.keys(N).sort(function(e,t){return"styles"===e?1:"styles"===t?-1:0}).forEach(function(e){var t=y[e]({mixinConfig:N[e],viewProps:o,viewState:b,viewInternalAPI:V,viewExternalAPI:x,view:n(Y)});t&&O.push(t)});var k=n(V);v({root:k,props:o});var j=f(l);return g.forEach(function(e,t){k.appendChild(e.element,j+t)}),S(k),n(x)}},A=function(e,t){return function(n){var r=n.root,o=n.props,i=n.actions,a=void 0===i?[]:i,s=n.timestamp,u=n.shouldOptimize;a.filter(function(t){return e[t.type]}).forEach(function(t){return e[t.type]({root:r,props:o,action:t.data,timestamp:s,shouldOptimize:u})}),t&&t({root:r,props:o,actions:a,timestamp:s,shouldOptimize:u})}},L=function(e,t){return t.parentNode.insertBefore(e,t)},b=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},P=function(e){return Array.isArray(e)},M=function(e){return null==e},w=function(e){return e.trim()},C=function(e){return""+e},N=function(e){return"boolean"==typeof e},G=function(e){return N(e)?e:"true"===e},U=function(e){return"string"==typeof e},B=function(e){return _(e)?e:U(e)?C(e).replace(/[a-z]+/gi,""):0},F=function(e){return parseInt(B(e),10)},q=function(e){return parseFloat(B(e))},V=function(e){return _(e)&&isFinite(e)&&Math.floor(e)===e},x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(V(e))return e;var n=C(e).trim();return/MB$/i.test(n)?(n=n.replace(/MB$i/,"").trim(),F(n)*t*t):/KB/i.test(n)?(n=n.replace(/KB$i/,"").trim(),F(n)*t):F(n)},Y=function(e){return"function"==typeof e},k={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},j=function(e,t,n,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===n||"PATCH"===n?"?"+e+"=":"",method:n,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){var a=i.headers.split(/:(.+)/);i.headers={header:a[0],value:a[1]}}return i.withCredentials=G(i.withCredentials),i},H=function(e){return"object"==typeof e&&null!==e},X=function(e){return P(e)?"array":function(e){return null===e}(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":function(e){return H(e)&&U(e.url)&&H(e.process)&&H(e.revert)&&H(e.restore)&&H(e.fetch)}(e)?"api":typeof e},W={array:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return M(e)?[]:P(e)?e:C(e).split(t).map(w).filter(function(e){return e.length})},boolean:G,int:function(e){return"bytes"===X(e)?x(e):F(e)},number:q,float:q,bytes:x,string:function(e){return Y(e)?e:C(e)},function:function(e){return function(e){for(var t=self,n=e.split("."),r=null;r=n.shift();)if(!(t=t[r]))return null;return t}(e)},serverapi:function(e){return(r={}).url=U(n=e)?n:n.url||"",r.timeout=n.timeout?parseInt(n.timeout,10):0,r.headers=n.headers?n.headers:{},t(k,function(e){r[e]=j(e,n[e],k[e],r.timeout,r.headers)}),r.process=n.process||U(n)||n.url?r.process:null,r.remove=n.remove||null,delete r.headers,r;var n,r},object:function(e){try{return JSON.parse(e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(e){return null}}},z=function(e,t,n){if(e===t)return e;var r,o=X(e);if(o!==n){var i=(r=e,W[n](r));if(o=X(i),null===i)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+n+'"';e=i}return e},Q=function(e){var r={};return t(e,function(t){var n,o,i,a=e[t];r[t]=(n=a[0],o=a[1],i=n,{enumerable:!0,get:function(){return i},set:function(e){i=z(e,n,o)}})}),n(r)},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.split(/(?=[A-Z])/).map(function(e){return e.toLowerCase()}).join(t)},K=function(e){return function(n,r,o){var i={};return t(e,function(e){var t=Z(e,"_").toUpperCase();i["SET_"+t]=function(r){try{o.options[e]=r.value}catch(e){}n("DID_SET_"+t,{value:o.options[e]})}}),i}},$=function(e){return function(n){var r={};return t(e,function(e){r["GET_"+Z(e,"_").toUpperCase()]=function(t){return n.options[e]}}),r}},J=1,ee=2,te=3,ne=4,re=5,oe=function(){return Math.random().toString(36).substr(2,9)};function ie(e){this.wrapped=e}function ae(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof ie;Promise.resolve(s?a.wrapped:a).then(function(e){s?r("next",e):o(i.done?"return":"normal",e)},function(e){r("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function se(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}"function"==typeof Symbol&&Symbol.asyncIterator&&(ae.prototype[Symbol.asyncIterator]=function(){return this}),ae.prototype.next=function(e){return this._invoke("next",e)},ae.prototype.throw=function(e){return this._invoke("throw",e)},ae.prototype.return=function(e){return this._invoke("return",e)};function ue(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1?t-1:0),o=1;o1?t-1:0),o=1;oBrowse',ge.STRING],labelInvalidField:["Field contains invalid files",ge.STRING],labelFileWaitingForSize:["Waiting for size",ge.STRING],labelFileSizeNotAvailable:["Size not available",ge.STRING],labelFileCountSingular:["file in list",ge.STRING],labelFileCountPlural:["files in list",ge.STRING],labelFileLoading:["Loading",ge.STRING],labelFileAdded:["Added",ge.STRING],labelFileLoadError:["Error during load",ge.STRING],labelFileRemoved:["Removed",ge.STRING],labelFileRemoveError:["Error during remove",ge.STRING],labelFileProcessing:["Uploading",ge.STRING],labelFileProcessingComplete:["Upload complete",ge.STRING],labelFileProcessingAborted:["Upload cancelled",ge.STRING],labelFileProcessingError:["Error during upload",ge.STRING],labelFileProcessingRevertError:["Error during revert",ge.STRING],labelTapToCancel:["tap to cancel",ge.STRING],labelTapToRetry:["tap to retry",ge.STRING],labelTapToUndo:["tap to undo",ge.STRING],labelButtonRemoveItem:["Remove",ge.STRING],labelButtonAbortItemLoad:["Abort",ge.STRING],labelButtonRetryItemLoad:["Retry",ge.STRING],labelButtonAbortItemProcessing:["Cancel",ge.STRING],labelButtonUndoItemProcessing:["Undo",ge.STRING],labelButtonRetryItemProcessing:["Retry",ge.STRING],labelButtonProcessItem:["Upload",ge.STRING],iconRemove:['',ge.STRING],iconProcess:['',ge.STRING],iconRetry:['',ge.STRING],iconUndo:['',ge.STRING],iconDone:['',ge.STRING],oninit:[null,ge.FUNCTION],onwarning:[null,ge.FUNCTION],onerror:[null,ge.FUNCTION],onactivatefile:[null,ge.FUNCTION],oninitfile:[null,ge.FUNCTION],onaddfilestart:[null,ge.FUNCTION],onaddfileprogress:[null,ge.FUNCTION],onaddfile:[null,ge.FUNCTION],onprocessfilestart:[null,ge.FUNCTION],onprocessfileprogress:[null,ge.FUNCTION],onprocessfileabort:[null,ge.FUNCTION],onprocessfilerevert:[null,ge.FUNCTION],onprocessfile:[null,ge.FUNCTION],onprocessfiles:[null,ge.FUNCTION],onremovefile:[null,ge.FUNCTION],onpreparefile:[null,ge.FUNCTION],onupdatefiles:[null,ge.FUNCTION],onreorderfiles:[null,ge.FUNCTION],beforeDropFile:[null,ge.FUNCTION],beforeAddFile:[null,ge.FUNCTION],beforeRemoveFile:[null,ge.FUNCTION],beforePrepareFile:[null,ge.FUNCTION],stylePanelLayout:[null,ge.STRING],stylePanelAspectRatio:[null,ge.STRING],styleItemPanelAspectRatio:[null,ge.STRING],styleButtonRemoveItemPosition:["left",ge.STRING],styleButtonProcessItemPosition:["right",ge.STRING],styleLoadIndicatorPosition:["right",ge.STRING],styleProgressIndicatorPosition:["right",ge.STRING],styleButtonRemoveItemAlign:[!1,ge.BOOLEAN],files:[[],ge.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],ge.ARRAY]},Le=function(e,t){return M(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(function(e){return e.id===t})||null)},be=function(e){if(M(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Pe=function(e){return e.filter(function(e){return!e.archived})},Me={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},we=null,Ce=[Ie.LOAD_ERROR,Ie.PROCESSING_ERROR,Ie.PROCESSING_REVERT_ERROR],Ne=[Ie.LOADING,Ie.PROCESSING,Ie.PROCESSING_QUEUED,Ie.INIT],Ge=[Ie.PROCESSING_COMPLETE],Ue=function(e){return Ce.includes(e.status)},Be=function(e){return Ne.includes(e.status)},Fe=function(e){return Ge.includes(e.status)},qe=function(e){return H(e.options.server)&&(H(e.options.server.process)||Y(e.options.server.process))},Ve=function(e){return{GET_STATUS:function(){var t=Pe(e.items),n=Me.EMPTY,r=Me.ERROR,o=Me.BUSY,i=Me.IDLE,a=Me.READY;return 0===t.length?n:t.some(Ue)?r:t.some(Be)?o:t.some(Fe)?a:i},GET_ITEM:function(t){return Le(e.items,t)},GET_ACTIVE_ITEM:function(t){return Le(Pe(e.items),t)},GET_ACTIVE_ITEMS:function(){return Pe(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var n=Le(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:function(t){var n=Le(e.items,t);return n?n.fileSize:null},GET_STYLES:function(){return Object.keys(e.options).filter(function(e){return/^style/.test(e)}).map(function(t){return{name:t,value:e.options[t]}})},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(e.options.stylePanelLayout)?1:be(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return Pe(e.items).filter(function(e){return e.status===t})},GET_TOTAL_ITEMS:function(){return Pe(e.items).length},SHOULD_UPDATE_FILE_INPUT:function(){return e.options.storeAsFile&&function(){if(null===we)try{var e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));var t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,we=1===t.files.length}catch(e){we=!1}return we}()&&!qe(e)},IS_ASYNC:function(){return qe(e)},GET_FILE_SIZE_LABELS:function(e){return{labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0}}}},xe=function(e,t,n){return Math.max(Math.min(n,e),t)},Ye=function(e){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e)},ke=function(e){return e.split("/").pop().split("?").shift()},je=function(e){return e.split(".").pop()},He=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},Xe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+He(e.getMonth()+1,"00")+"-"+He(e.getDate(),"00")+"_"+He(e.getHours(),"00")+"-"+He(e.getMinutes(),"00")+"-"+He(e.getSeconds(),"00")},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="string"==typeof n?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return o.lastModifiedDate=new Date,e._relativePath&&(o._relativePath=e._relativePath),U(t)||(t=Xe()),t&&null===r&&je(t)?o.name=t:(r=r||function(e){if("string"!=typeof e)return"";var t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""}(o.type),o.name=t+(r?"."+r:"")),o},ze=function(e,t){var n=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n){var r=new n;return r.append(e),r.getBlob(t)}return new Blob([e],{type:t})},Qe=function(e){return(/^data:(.+);/.exec(e)||[])[1]||null},Ze=function(e){var t=Qe(e);return function(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=200&&a.status<300?r.onload(a):r.onerror(a)},a.onerror=function(){return r.onerror(a)},a.onabort=function(){o=!0,r.onabort()},a.ontimeout=function(){return r.ontimeout(a)},a.open(n.method,t,!0),V(n.timeout)&&(a.timeout=n.timeout),Object.keys(n.headers).forEach(function(e){var t=unescape(encodeURIComponent(n.headers[e]));a.setRequestHeader(e,t)}),n.responseType&&(a.responseType=n.responseType),n.withCredentials&&(a.withCredentials=!0),a.send(e),r},ot=function(e,t,n,r){return{type:e,code:t,body:n,headers:r}},it=function(e){return function(t){e(ot("error",0,"Timeout",t.getAllResponseHeaders()))}},at=function(e){return/\?/.test(e)},st=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return null;var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a,s,u,l){var c=rt(o,st(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var r=e.getAllResponseHeaders(),a=et(r).name||ke(o);i(ot("load",e.status,"HEAD"===t.method?null:We(n(e.response),a),r))},c.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){l(ot("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=it(a),c.onprogress=s,c.onabort=u,c}},lt=0,ct=1,ft=2,dt=3,pt=4,Et=function(e,t,n,r,o,i,a,s,u,l,c){for(var f=[],d=c.chunkTransferId,p=c.chunkServer,E=c.chunkSize,_=c.chunkRetryDelays,T={serverId:d,aborted:!1},I=t.ondata||function(e){return e},v=t.onload||function(e,t){return"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response},m=t.onerror||function(e){return null},h=Math.floor(r.size/E),g=0;g<=h;g++){var R=g*E,O=r.slice(R,R+E,"application/offset+octet-stream");f[g]={index:g,size:O.size,offset:R,data:O,file:r,progress:0,retries:ue(_),status:lt,error:null,request:null,timeout:null}}var y,D,S,A,L=function(e){return e.status===lt||e.status===dt},b=function(t){if(!T.aborted)if(t=t||f.find(L)){t.status=ft,t.progress=null;var n=p.ondata||function(e){return e},o=p.onerror||function(e){return null},s=st(e,p.url,T.serverId),l="function"==typeof p.headers?p.headers(t):Object.assign({},p.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":r.size,"Upload-Name":r.name}),c=t.request=rt(n(t.data),s,Object.assign({},p,{headers:l}));c.onload=function(){t.status=ct,t.request=null,w()},c.onprogress=function(e,n,r){t.progress=e?n:null,M()},c.onerror=function(e){t.status=dt,t.request=null,t.error=o(e.response)||e.statusText,P(t)||a(ot("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))},c.ontimeout=function(e){t.status=dt,t.request=null,P(t)||it(a)(e)},c.onabort=function(){t.status=lt,t.request=null,u()}}else f.every(function(e){return e.status===ct})&&i(T.serverId)},P=function(e){return 0!==e.retries.length&&(e.status=pt,clearTimeout(e.timeout),e.timeout=setTimeout(function(){b(e)},e.retries.shift()),!0)},M=function(){var e=f.reduce(function(e,t){return null===e||null===t.progress?null:e+t.progress},0);if(null===e)return s(!1,0,0);var t=f.reduce(function(e,t){return e+t.size},0);s(!0,e,t)},w=function(){f.filter(function(e){return e.status===ft}).length>=1||b()};return T.serverId?(y=function(e){T.aborted||(f.filter(function(t){return t.offset0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,o=new Array(e),i=0;ir.chunkSize,p=f&&(d||r.chunkForce);if(o instanceof Blob&&p)return Et(e,t,n,o,i,a,s,u,l,c,r);var E=t.ondata||function(e){return e},_=t.onload||function(e){return e},T=t.onerror||function(e){return null},I="function"==typeof t.headers?t.headers(o,i)||{}:Object.assign({},t.headers),v=Object.assign({},t,{headers:I}),m=new FormData;H(i)&&m.append(n,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach(function(e){m.append(n,e.file,null===e.name?e.file.name:""+e.name+e.file.name)});var h=rt(E(m),st(e,t.url),v);return h.onload=function(e){a(ot("load",e.status,_(e.response),e.getAllResponseHeaders()))},h.onerror=function(e){s(ot("error",e.status,T(e.response)||e.statusText,e.getAllResponseHeaders()))},h.ontimeout=it(s),h.onprogress=u,h.onabort=l,h}}}(e,t,n,r):null},Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return function(e,t){return t()};var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a){var s=rt(o,e+t.url,t);return s.onload=function(e){i(ot("load",e.status,n(e.response),e.getAllResponseHeaders()))},s.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},s.ontimeout=it(a),s}},It=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+Math.random()*(t-e)},vt=function(e,t){var n={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=t.allowMinimumUploadDuration,o=function(){n.request&&(n.perceivedPerformanceUpdater.clear(),n.request.abort&&n.request.abort(),n.complete=!0)},i=r?function(){return n.progress?Math.min(n.progress,n.perceivedProgress):null}:function(){return n.progress||null},a=r?function(){return Math.min(n.duration,n.perceivedDuration)}:function(){return n.duration},s=Object.assign({},pe(),{process:function(t,o){var i=function(){0!==n.duration&&null!==n.progress&&s.fire("progress",s.getProgress())},a=function(){n.complete=!0,s.fire("load-perceived",n.response.body)};s.fire("start"),n.timestamp=Date.now(),n.perceivedPerformanceUpdater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:25),r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=null,i=Date.now();return t>0&&function a(){var s=Date.now()-i,u=It(n,r);s+u>t&&(u=s+u-t);var l=s/t;l>=1||document.hidden?e(1):(e(l),o=setTimeout(a,u))}(),{clear:function(){clearTimeout(o)}}}(function(e){n.perceivedProgress=e,n.perceivedDuration=Date.now()-n.timestamp,i(),n.response&&1===n.perceivedProgress&&!n.complete&&a()},r?It(750,1500):0),n.request=e(t,o,function(e){n.response=H(e)?e:{type:"load",code:200,body:""+e,headers:{}},n.duration=Date.now()-n.timestamp,n.progress=1,s.fire("load",n.response.body),(!r||r&&1===n.perceivedProgress)&&a()},function(e){n.perceivedPerformanceUpdater.clear(),s.fire("error",H(e)?e:{type:"error",code:0,body:""+e})},function(e,t,r){n.duration=Date.now()-n.timestamp,n.progress=e?t/r:null,i()},function(){n.perceivedPerformanceUpdater.clear(),s.fire("abort",n.response?n.response.body:null)},function(e){s.fire("transfer",e)})},abort:o,getProgress:i,getDuration:a,reset:function(){o(),n.complete=!1,n.perceivedProgress=0,n.progress=0,n.timestamp=null,n.perceivedDuration=0,n.duration=0,n.request=null,n.response=null}});return s},mt=function(e){return e.substr(0,e.lastIndexOf("."))||e},ht=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},gt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=oe(),i={archived:!1,frozen:!1,released:!1,source:null,file:r,serverFileReference:t,transferId:null,processingAborted:!1,status:t?Ie.PROCESSING_COMPLETE:Ie.INIT,activeLoader:null,activeProcessor:null},a=null,s={},u=function(e){return i.status=e},l=function(e){if(!i.released&&!i.frozen){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},r=n.query,o=n.success,i=void 0===o?function(){}:o,a=n.failure,s=void 0===a?function(){}:a,u=se(n,["query","success","failure"]),l=Le(e.items,r);l?t(l,i,s,u||{}):s({error:ot("error",0,"Item not found"),file:null})}},Pt=function(e,t,n){return{ABORT_ALL:function(){Pe(n.items).forEach(function(e){e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map(function(e){return{source:e.source?e.source:e,options:e.options}}),i=Pe(n.items);i.forEach(function(t){o.find(function(e){return e.source===t.source||e.source===t.file})||e("REMOVE_ITEM",{query:t,remove:!1})}),i=Pe(n.items),o.forEach(function(t,n){i.find(function(e){return e.source===t.source||e.file===t.source})||e("ADD_ITEM",Object.assign({},t,{interactionMethod:re,index:n}))})},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id,i=r.action,a=r.change;a.silent||(clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(function(){var r=Rt(n.items,o);if(t("IS_ASYNC")){r.origin===ve.LOCAL&&e("DID_LOAD_ITEM",{id:r.id,error:null,serverFileReference:r.source});var s,u=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return r.status===Ie.PROCESSING_COMPLETE?(s=n.options.instantUpload,void r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s?u:function(){}).catch(function(){})):r.status===Ie.PROCESSING?function(e){r.abortProcessing().then(e?u:function(){})}(n.options.instantUpload):void(n.options.instantUpload&&u())}Oe("SHOULD_PREPARE_OUTPUT",!1,{item:r,query:t,action:i,change:a}).then(function(n){var i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(r,n)),n&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:r,success:function(t){e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)})},0))},MOVE_ITEM:function(e){var t=e.query,r=e.index,o=Le(n.items,t);if(o){var i=n.items.indexOf(o);i!==(r=xe(r,0,n.items.length-1))&&n.items.splice(r,0,n.items.splice(i,1)[0])}},SORT:function(r){var o=r.compare;Lt(n,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(n){var r=n.items,o=n.index,i=n.interactionMethod,a=n.success,s=void 0===a?function(){}:a,u=n.failure,l=void 0===u?function(){}:u,c=o;if(-1===o||void 0===o){var f=t("GET_ITEM_INSERT_LOCATION"),d=t("GET_TOTAL_ITEMS");c="before"===f?0:d}var p=t("GET_IGNORED_FILES"),E=r.filter(function(e){return ht(e)?!p.includes(e.name.toLowerCase()):!M(e)}).map(function(t){return new Promise(function(n,r){e("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:n,failure:r,index:c++,options:t.options||{}})})});Promise.all(E).then(s).catch(l)},ADD_ITEM:function(r){var o=r.source,i=r.index,a=void 0===i?-1:i,s=r.interactionMethod,u=r.success,l=void 0===u?function(){}:u,c=r.failure,f=void 0===c?function(){}:c,d=r.options,p=void 0===d?{}:d;if(M(o))f({error:ot("error",0,"No source"),file:null});else if(!ht(o)||!n.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(e){var t=Pe(e.items).length;if(!e.options.allowMultiple)return 0===t;var n=e.options.maxFiles;return null===n||t=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:h,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void f({error:t,file:Te(v)});e("DID_THROW_ITEM_LOAD_ERROR",{id:h,error:t,status:{main:r,sub:n.options.labelTapToRetry}})}),v.on("load-file-error",function(t){e("DID_THROW_ITEM_INVALID",{id:h,error:t.status,status:t.status}),f({error:t.status,file:Te(v)})}),v.on("load-abort",function(){e("REMOVE_ITEM",{query:h})}),v.on("load-skip",function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}})}),v.on("load",function(){var r=function(r){r?(v.on("metadata-update",function(t){e("DID_UPDATE_ITEM_METADATA",{id:h,change:t})}),Oe("SHOULD_PREPARE_OUTPUT",!1,{item:v,query:t}).then(function(r){var i=t("GET_BEFORE_PREPARE_FILE");i&&(r=i(v,r));var a=function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}}),St(e,n)};r?e("REQUEST_PREPARE_OUTPUT",{query:h,item:v,success:function(t){e("DID_PREPARE_OUTPUT",{id:h,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:h})};Oe("DID_LOAD_ITEM",v,{query:t,dispatch:e}).then(function(){At(t("GET_BEFORE_ADD_FILE"),Te(v)).then(r)}).catch(function(t){if(!t||!t.error||!t.status)return r(!1);e("DID_THROW_ITEM_INVALID",{id:h,error:t.error,status:t.status})})}),v.on("process-start",function(){e("DID_START_ITEM_PROCESSING",{id:h})}),v.on("process-progress",function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:h,progress:t})}),v.on("process-error",function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-revert-error",function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingRevertError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-complete",function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:h,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:h,value:t})}),v.on("process-abort",function(){e("DID_ABORT_ITEM_PROCESSING",{id:h})}),v.on("process-revert",function(){e("DID_REVERT_ITEM_PROCESSING",{id:h}),e("DID_DEFINE_VALUE",{id:h,value:null})}),e("DID_ADD_ITEM",{id:h,index:a,interactionMethod:s}),St(e,n);var g=n.options.server||{},R=g.url,O=g.load,y=g.restore,D=g.fetch;v.load(o,tt(I===ve.INPUT?U(o)&&function(e){return(e.indexOf(":")>-1||e.indexOf("//")>-1)&&yt(location.href)!==yt(e)}(o)&&D?ut(R,D):Ot:ut(R,I===ve.LIMBO?y:O)),function(e,n,r){Oe("LOAD_FILE",e,{query:t}).then(n).catch(r)})}},REQUEST_PREPARE_OUTPUT:function(e){var n=e.item,r=e.success,o=e.failure,i=void 0===o?function(){}:o,a={error:ot("error",0,"Item not found"),file:null};if(n.archived)return i(a);Oe("PREPARE_OUTPUT",n.file,{query:t,item:n}).then(function(e){Oe("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:n}).then(function(e){if(n.archived)return i(a);r(e)})})},COMPLETE_LOAD_ITEM:function(r){var o=r.item,i=r.data,a=i.success,s=i.source,u=t("GET_ITEM_INSERT_LOCATION");if(Y(u)&&s&&Lt(n,u),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===ve.INPUT?null:s}),a(Te(o)),o.origin!==ve.LOCAL)return o.origin===ve.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&n.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:bt(n,function(e){e.retryLoad()}),REQUEST_ITEM_PREPARE:bt(n,function(t,n,r){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(r){e("DID_PREPARE_OUTPUT",{id:t.id,file:r}),n({file:t,output:r})},failure:r},!0)}),REQUEST_ITEM_PROCESSING:bt(n,function(r,o,i){if(r.status===Ie.IDLE||r.status===Ie.PROCESSING_ERROR)r.status!==Ie.PROCESSING_QUEUED&&(r.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:r.id}),e("PROCESS_ITEM",{query:r,success:o,failure:i},!0));else{var a=function(){return e("REQUEST_ITEM_PROCESSING",{query:r,success:o,failure:i})},s=function(){return document.hidden?a():setTimeout(a,32)};r.status===Ie.PROCESSING_COMPLETE||r.status===Ie.PROCESSING_REVERT_ERROR?r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s).catch(function(){}):r.status===Ie.PROCESSING&&r.abortProcessing().then(s)}}),PROCESS_ITEM:bt(n,function(r,o,i){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",Ie.PROCESSING).length!==a){if(r.status!==Ie.PROCESSING){var s=function t(){var r=n.processingQueue.shift();if(r){var o=r.id,i=r.success,a=r.failure,s=Le(n.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:i,failure:a},!0):t()}};r.onOnce("process-complete",function(){o(Te(r)),s();var i=n.options.server;if(n.options.instantUpload&&r.origin===ve.LOCAL&&Y(i.remove)){var a=function(){};r.origin=ve.LIMBO,n.options.server.remove(r.source,a,a)}t("GET_ITEMS_BY_STATUS",Ie.PROCESSING_COMPLETE).length===n.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),r.onOnce("process-error",function(e){i({error:e,file:Te(r)}),s()});var u=n.options;r.process(vt(_t(u.server.url,u.server.process,u.name,{chunkTransferId:r.transferId,chunkServer:u.server.patch,chunkUploads:u.chunkUploads,chunkForce:u.chunkForce,chunkSize:u.chunkSize,chunkRetryDelays:u.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),function(n,o,i){Oe("PREPARE_OUTPUT",n,{query:t,item:r}).then(function(t){e("DID_PREPARE_OUTPUT",{id:r.id,file:t}),o(t)}).catch(i)})}}else n.processingQueue.push({id:r.id,success:o,failure:i})}),RETRY_ITEM_PROCESSING:bt(n,function(t){e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:bt(n,function(n){At(t("GET_BEFORE_REMOVE_FILE"),Te(n)).then(function(t){t&&e("REMOVE_ITEM",{query:n})})}),RELEASE_ITEM:bt(n,function(e){e.release()}),REMOVE_ITEM:bt(n,function(r,o,i,a){var s=function(){var t=r.id;Rt(n.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:r}),St(e,n),o(Te(r))},u=n.options.server;r.origin===ve.LOCAL&&u&&Y(u.remove)&&!1!==a.remove?(e("DID_START_ITEM_REMOVE",{id:r.id}),u.remove(r.source,function(){return s()},function(t){e("DID_THROW_ITEM_REMOVE_ERROR",{id:r.id,error:ot("error",0,t,null),status:{main:Dt(n.options.labelFileRemoveError)(t),sub:n.options.labelTapToRetry}})})):((a.revert&&r.origin!==ve.LOCAL&&null!==r.serverId||n.options.chunkUploads&&r.file.size>n.options.chunkSize||n.options.chunkUploads&&n.options.chunkForce)&&r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")),s())}),ABORT_ITEM_LOAD:bt(n,function(e){e.abortLoad()}),ABORT_ITEM_PROCESSING:bt(n,function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(function(){n.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:bt(n,function(r){if(n.options.instantUpload){var o=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:r})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return o(!0);var a=i(Te(r));return null==a?o(!0):"boolean"==typeof a?o(a):void("function"==typeof a.then&&a.then(o))}e("REVERT_ITEM_PROCESSING",{query:r})}),REVERT_ITEM_PROCESSING:bt(n,function(r){r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(function(){(n.options.instantUpload||function(e){return!ht(e.file)}(r))&&e("REMOVE_ITEM",{query:r.id})}).catch(function(){})}),SET_OPTIONS:function(t){var n=t.options,r=Object.keys(n),o=Mt.filter(function(e){return r.includes(e)});[].concat(ue(o),ue(Object.keys(n).filter(function(e){return!o.includes(e)}))).forEach(function(t){e("SET_"+Z(t,"_").toUpperCase(),{value:n[t]})})}}},Mt=["server"],wt=function(e){return e},Ct=function(e){return document.createElement(e)},Nt=function(e,t){var n=e.childNodes[0];n?t!==n.nodeValue&&(n.nodeValue=t):(n=document.createTextNode(t),e.appendChild(n))},Gt=function(e,t,n,r){var o=(r%360-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}},Ut=function(e,t,n,r,o){var i=1;return o>r&&o-r<=.5&&(i=0),r>o&&r-o>=.5&&(i=0),function(e,t,n,r,o,i){var a=Gt(e,t,n,o),s=Gt(e,t,n,r);return["M",a.x,a.y,"A",n,n,0,i,0,s.x,s.y].join(" ")}(e,t,n,360*Math.min(.9999,r),360*Math.min(.9999,o),i)},Bt=S({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,n=e.props;n.spin=!1,n.progress=0,n.opacity=0;var r=a("svg");t.ref.path=a("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(t.ref.path),t.ref.svg=r,t.appendChild(r)},write:function(e){var t=e.root,n=e.props;if(0!==n.opacity){n.align&&(t.element.dataset.align=n.align);var o=parseInt(r(t.ref.path,"stroke-width"),10),i=.5*t.rect.element.width,a=0,s=0;n.spin?(a=0,s=.5):(a=0,s=n.progress);var u=Ut(i,i,i-o,a,s);r(t.ref.path,"d",u),r(t.ref.path,"stroke-opacity",n.spin||n.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}}}}),Ft=S({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(e){var t=e.root,n=e.props;t.element.innerHTML=(n.icon||"")+""+n.label+"",n.isDisabled=!1},write:function(e){var t=e.root,n=e.props,o=n.isDisabled,i=t.query("GET_DISABLED")||0===n.opacity;i&&!o?(n.isDisabled=!0,r(t.element,"disabled","disabled")):!i&&o&&(n.isDisabled=!1,t.element.removeAttribute("disabled"))}}),qt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.labelBytes,i=void 0===o?"bytes":o,a=r.labelKilobytes,s=void 0===a?"KB":a,u=r.labelMegabytes,l=void 0===u?"MB":u,c=r.labelGigabytes,f=void 0===c?"GB":c,d=n,p=n*n,E=n*n*n;return(e=Math.round(Math.abs(e)))0&&(t.height=t.ref.container.rect.element.height)),o&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),mn=S({create:function(e){var t=e.root,n=e.props;t.ref.handleClick=function(e){return t.dispatch("DID_ACTIVATE_ITEM",{id:n.id})},t.element.id="filepond--item-"+n.id,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(fn,{id:n.id})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"item-panel"})),t.ref.panel.height=null,n.markedForRemoval=!1,t.query("GET_ALLOW_REORDER")&&(t.element.dataset.dragState="idle",t.element.addEventListener("pointerdown",function(e){if(e.isPrimary){var r=!1,o=e.pageX,i=e.pageY;n.dragOrigin={x:t.translateX,y:t.translateY},n.dragCenter={x:e.offsetX,y:e.offsetY};var a,s,u,l=(a=t.query("GET_ACTIVE_ITEMS"),s=a.map(function(e){return e.id}),u=void 0,{setIndex:function(e){u=e},getIndex:function(){return u},getItemIndex:function(e){return s.indexOf(e.id)}});t.dispatch("DID_GRAB_ITEM",{id:n.id,dragState:l});var c=function(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),n.dragOffset={x:e.pageX-o,y:e.pageY-i},n.dragOffset.x*n.dragOffset.x+n.dragOffset.y*n.dragOffset.y>16&&!r&&(r=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:n.id,dragState:l}))};document.addEventListener("pointermove",c),document.addEventListener("pointerup",function e(a){a.isPrimary&&(document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",e),n.dragOffset={x:a.pageX-o,y:a.pageY-i},t.dispatch("DID_DROP_ITEM",{id:n.id,dragState:l}),r&&setTimeout(function(){return t.element.addEventListener("click",t.ref.handleClick)},0))})}}))},write:vn,destroy:function(e){var t=e.root,n=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:n.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:_n,translateY:_n,opacity:{type:"tween",duration:150}}}}),hn=function(e,t){return Math.max(1,Math.floor((e+1)/t))},gn=function(e,t,n){if(n){var r=e.rect.element.width,o=t.length,i=null;if(0===o||n.topv){if(n.left3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=n,Date.now()>e.spawnDate&&(0===e.opacity&&yn(e,t,n,r,o),e.scaleX=1,e.scaleY=1,e.opacity=1))},yn=function(e,t,n,r,o){e.interactionMethod===re?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=n):e.interactionMethod===ee?(e.translateX=null,e.translateX=t-20*r,e.translateY=null,e.translateY=n-10*o,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===te?(e.translateY=null,e.translateY=n-30):e.interactionMethod===J&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},Dn=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},Sn=A({DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=n.id,o=n.index,i=n.interactionMethod;t.ref.addIndex=o;var a=Date.now(),s=a,u=1;if(i!==re){u=0;var l=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;s=cs&&(E=s);var _=Math.floor(s/E+1);Rn.setHeight=d*_,Rn.setWidth=p*E;var T={y:Math.floor(f/d),x:Math.floor(c/p),getGridIndex:function(){return f>Rn.getHeight||f<0||c>Rn.getWidth||c<0?u:this.y*E+this.x},getColIndex:function(){for(var e=t.query("GET_ACTIVE_ITEMS"),n=t.childViews.filter(function(e){return e.rect.element.height}),r=e.map(function(e){return n.find(function(t){return t.id===e.id})}),o=r.findIndex(function(e){return e===a}),i=Dn(a),s=r.length,u=s,l=0,c=0,d=0,p=0;pp){if(f1?T.getGridIndex():T.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:I});var v=o.getIndex();if(void 0===v||v!==I){if(o.setIndex(I),void 0===v)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:u,target:I})}}}}),An=S({create:function(e){var t=e.root;r(t.element,"role","list"),t.ref.lastItemSpanwDate=Date.now()},write:function(e){var t=e.root,n=e.props,r=e.actions,o=e.shouldOptimize;Sn({root:t,props:n,actions:r});var i=n.dragCoordinates,a=t.rect.element.width,s=t.childViews.filter(function(e){return e.rect.element.height}),u=t.query("GET_ACTIVE_ITEMS").map(function(e){return s.find(function(t){return t.id===e.id})}).filter(function(e){return e}),l=i?gn(t,u,i):null,c=t.ref.addIndex||null;t.ref.addIndex=null;var f=0,d=0,p=0;if(0!==u.length){var E=u[0].rect.element,_=E.marginTop+E.marginBottom,T=E.marginLeft+E.marginRight,I=E.width+T,v=E.height+_,m=hn(a,I);if(1===m){var h=0,g=0;u.forEach(function(e,t){if(l){var n=t-l;g=-2===n?.25*-_:-1===n?.75*-_:0===n?.75*_:1===n?.25*_:0}o&&(e.translateX=null,e.translateY=null),e.markedForRemoval||On(e,0,h+g);var r=(e.rect.element.height+_)*(e.markedForRemoval?e.opacity:1);h+=r})}else{var R=0,O=0;u.forEach(function(e,t){t===l&&(f=1),t===c&&(p+=1),e.markedForRemoval&&e.opacity<.5&&(d-=1);var n=t+p+f+d,r=n%m,i=Math.floor(n/m),a=r*I,s=i*v,u=Math.sign(a-R),E=Math.sign(s-O);R=a,O=s,e.markedForRemoval||(o&&(e.translateX=null,e.translateY=null),On(e,a,s,u,E))})}}},tag:"ul",name:"list",didWriteView:function(e){var t=e.root;t.childViews.filter(function(e){return e.markedForRemoval&&0===e.opacity&&e.resting}).forEach(function(e){e._destroy(),t.removeChildView(e)})},filterFrameActionsForChild:function(e,t){return t.filter(function(t){return!t.data||!t.data.id||e.id===t.data.id})},mixins:{apis:["dragCoordinates"]}}),Ln=A({DID_DRAG:function(e){var t=e.root,n=e.props,r=e.action;t.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(n.dragCoordinates={left:r.position.scopeLeft-t.ref.list.rect.element.left,top:r.position.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},DID_END_DRAG:function(e){e.props.dragCoordinates=null}}),bn=S({create:function(e){var t=e.root,n=e.props;t.ref.list=t.appendChildView(t.createChildView(An)),n.dragCoordinates=null,n.overflowing=!1},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Ln({root:t,props:n,actions:r}),t.ref.list.dragCoordinates=n.dragCoordinates,n.overflowing&&!n.overflow&&(n.overflowing=!1,t.element.dataset.state="",t.height=null),n.overflow){var o=Math.round(n.overflow);o!==t.height&&(n.overflowing=!0,t.element.dataset.state="overflow",t.height=o)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Pn=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";n?r(e,t,o):e.removeAttribute(t)},Mn=function(e){var t=e.root,n=e.action;t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Pn(t.element,"accept",!!n.value,n.value?n.value.join(","):"")},wn=function(e){var t=e.root,n=e.action;Pn(t.element,"multiple",n.value)},Cn=function(e){var t=e.root,n=e.action;Pn(t.element,"webkitdirectory",n.value)},Nn=function(e){var t=e.root,n=t.query("GET_DISABLED"),r=t.query("GET_ALLOW_BROWSE"),o=n||!r;Pn(t.element,"disabled",o)},Gn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Pn(t.element,"required",!0):Pn(t.element,"required",!1)},Un=function(e){var t=e.root,n=e.action;Pn(t.element,"capture",!!n.value,!0===n.value?"":n.value)},Bn=function(e){var t=e.root,n=t.element;t.query("GET_TOTAL_ITEMS")>0?(Pn(n,"required",!1),Pn(n,"name",!1)):(Pn(n,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&n.setCustomValidity(""),t.query("GET_REQUIRED")&&Pn(n,"required",!0))},Fn=S({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:function(e){var t=e.root,n=e.props;t.element.id="filepond--browser-"+n.id,r(t.element,"name",t.query("GET_NAME")),r(t.element,"aria-controls","filepond--assistant-"+n.id),r(t.element,"aria-labelledby","filepond--drop-label-"+n.id),Mn({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),wn({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),Cn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Nn({root:t}),Gn({root:t,action:{value:t.query("GET_REQUIRED")}}),Un({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var r=Array.from(t.element.files).map(function(e){return e._relativePath=e.webkitRelativePath,e});setTimeout(function(){n.onload(r),function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=Ct("form"),n=e.parentNode,r=e.nextSibling;t.appendChild(e),t.reset(),r?n.insertBefore(e,r):n.appendChild(e)}}}(t.element)},250)}},t.element.addEventListener("change",t.ref.handleChange)},destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:A({DID_LOAD_ITEM:Bn,DID_REMOVE_ITEM:Bn,DID_THROW_ITEM_INVALID:function(e){var t=e.root;t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Nn,DID_SET_ALLOW_BROWSE:Nn,DID_SET_ALLOW_DIRECTORIES_ONLY:Cn,DID_SET_ALLOW_MULTIPLE:wn,DID_SET_ACCEPTED_FILE_TYPES:Mn,DID_SET_CAPTURE_METHOD:Un,DID_SET_REQUIRED:Gn})}),qn=13,Vn=32,xn=function(e,t){e.innerHTML=t;var n=e.querySelector(".filepond--label-action");return n&&r(n,"tabindex","0"),t},Yn=S({name:"drop-label",ignoreRect:!0,create:function(e){var t=e.root,n=e.props,o=Ct("label");r(o,"for","filepond--browser-"+n.id),r(o,"id","filepond--drop-label-"+n.id),r(o,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===qn||e.keyCode===Vn)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===o||o.contains(e.target)||t.ref.label.click()},o.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),xn(o,n.caption),t.appendChild(o),t.ref.label=o},destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:A({DID_SET_LABEL_IDLE:function(e){var t=e.root,n=e.action;xn(t.ref.label,n.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),kn=S({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}}}}),jn=A({DID_DRAG:function(e){var t=e.root,n=e.action;t.ref.blob?(t.ref.blob.translateX=n.position.scopeLeft,t.ref.blob.translateY=n.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):function(e){var t=e.root,n=.5*t.rect.element.width,r=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(kn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:n,translateY:r}))}({root:t})},DID_DROP:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},DID_END_DRAG:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.opacity=0)}}),Hn=S({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:function(e){var t=e.root,n=e.props,r=e.actions;jn({root:t,props:n,actions:r});var o=t.ref.blob;0===r.length&&o&&0===o.opacity&&(t.removeChildView(o),t.ref.blob=null)}}),Xn=function(e,t){try{var n=new DataTransfer;t.forEach(function(e){e instanceof File?n.items.add(e):n.items.add(new File([e],e.name,{type:e.type}))}),e.files=n.files}catch(e){return!1}return!0},Wn=function(e,t){return e.ref.fields[t]},zn=function(e){e.query("GET_ACTIVE_ITEMS").forEach(function(t){e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Qn=function(e){var t=e.root;return zn(t)},Zn=A({DID_SET_DISABLED:function(e){var t=e.root;t.element.disabled=t.query("GET_DISABLED")},DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=!(t.query("GET_ITEM",n.id).origin===ve.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),o=Ct("input");o.type=r?"file":"hidden",o.name=t.query("GET_NAME"),o.disabled=t.query("GET_DISABLED"),t.ref.fields[n.id]=o,zn(t)},DID_LOAD_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);if(r&&(null!==n.serverFileReference&&(r.value=n.serverFileReference),t.query("SHOULD_UPDATE_FILE_INPUT"))){var o=t.query("GET_ITEM",n.id);Xn(r,[o.file])}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete t.ref.fields[n.id])},DID_DEFINE_VALUE:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(null===n.value?r.removeAttribute("value"):r.value=n.value,zn(t))},DID_PREPARE_OUTPUT:function(e){var t=e.root,n=e.action;t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(function(){var e=Wn(t,n.id);e&&Xn(e,[n.file])},0)},DID_REORDER_ITEMS:Qn,DID_SORT_ITEMS:Qn}),Kn=S({tag:"fieldset",name:"data",create:function(e){return e.root.ref.fields={}},write:Zn,ignoreRect:!0}),$n=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],Jn=["css","csv","html","txt"],er={zip:"zip|compressed",epub:"application/epub+zip"},tr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),$n.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):Jn.includes(e)?"text/"+e:er[e]||""},nr=function(e){return new Promise(function(t,n){var r=dr(e);if(r.length&&!rr(e))return t(r);or(e).then(t)})},rr=function(e){return!!e.files&&e.files.length>0},or=function(e){return new Promise(function(t,n){var r=(e.items?Array.from(e.items):[]).filter(function(e){return ir(e)}).map(function(e){return ar(e)});r.length?Promise.all(r).then(function(e){var n=[];e.forEach(function(e){n.push.apply(n,e)}),t(n.filter(function(e){return e}).map(function(e){return e._relativePath||(e._relativePath=e.webkitRelativePath),e}))}).catch(console.error):t(e.files?Array.from(e.files):[])})},ir=function(e){if(cr(e)){var t=fr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},ar=function(e){return new Promise(function(t,n){lr(e)?sr(fr(e)).then(t).catch(n):t([e.getAsFile()])})},sr=function(e){return new Promise(function(t,n){var r=[],o=0,i=0,a=function(){0===i&&0===o&&t(r)};!function e(t){o++;var s=t.createReader();!function t(){s.readEntries(function(n){if(0===n.length)return o--,void a();n.forEach(function(t){t.isDirectory?e(t):(i++,t.file(function(e){var n=ur(e);t.fullPath&&(n._relativePath=t.fullPath),r.push(n),i--,a()}))}),t()},n)}()}(e)})},ur=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,n=e.name,r=tr(je(e.name));return r.length?((e=e.slice(0,e.size,r)).name=n,e.lastModifiedDate=t,e):e},lr=function(e){return cr(e)&&(fr(e)||{}).isDirectory},cr=function(e){return"webkitGetAsEntry"in e},fr=function(e){return e.webkitGetAsEntry()},dr=function(e){var t=[];try{if((t=Er(e)).length)return t;t=pr(e)}catch(e){}return t},pr=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},Er=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var n=t.match(/src\s*=\s*"(.+?)"/);if(n)return[n[1]]}return[]},_r=[],Tr=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},Ir=function(e){var t=_r.find(function(t){return t.element===e});if(t)return t;var n=vr(e);return _r.push(n),n},vr=function(e){var n=[],r={dragenter:Rr,dragover:Or,dragleave:Dr,drop:yr},o={};t(r,function(t,r){o[t]=r(e,n),e.addEventListener(t,o[t],!1)});var i={element:e,addListener:function(a){return n.push(a),function(){n.splice(n.indexOf(a),1),0===n.length&&(_r.splice(_r.indexOf(i),1),t(r,function(t){e.removeEventListener(t,o[t],!1)}))}}};return i},mr=function(e,t){var n,r=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)}("getRootNode"in(n=t)?n.getRootNode():document,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)},hr=null,gr=function(e,t){try{e.dropEffect=t}catch(e){}},Rr=function(e,t){return function(e){e.preventDefault(),hr=e.target,t.forEach(function(t){var n=t.element,r=t.onenter;mr(e,n)&&(t.state="enter",r(Tr(e)))})}},Or=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(r){var o=!1;t.some(function(t){var i=t.filterElement,a=t.element,s=t.onenter,u=t.onexit,l=t.ondrag,c=t.allowdrop;gr(n,"copy");var f=c(r);if(f)if(mr(e,a)){if(o=!0,null===t.state)return t.state="enter",void s(Tr(e));if(t.state="over",i&&!f)return void gr(n,"none");l(Tr(e))}else i&&!o&&gr(n,"none"),t.state&&(t.state=null,u(Tr(e)));else gr(n,"none")})})}},yr=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(n){t.forEach(function(t){var r=t.filterElement,o=t.element,i=t.ondrop,a=t.onexit,s=t.allowdrop;if(t.state=null,!r||mr(e,o))return s(n)?void i(Tr(e),n):a(Tr(e))})})}},Dr=function(e,t){return function(e){hr===e.target&&t.forEach(function(t){var n=t.onexit;t.state=null,n(Tr(e))})}},Sr=function(e,t,n){e.classList.add("filepond--hopper");var r=n.catchesDropsOnPage,o=n.requiresDropOnElement,i=n.filterItems,a=void 0===i?function(e){return e}:i,s=function(e,t,n){var r=Ir(t),o={element:e,filterElement:n,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return o.destroy=r.addListener(o),o}(e,r?document.documentElement:e,o),u="",l="";s.allowdrop=function(e){return t(a(e))},s.ondrop=function(e,n){var r=a(n);t(r)?(l="drag-drop",c.onload(r,e)):c.ondragend(e)},s.ondrag=function(e){c.ondrag(e)},s.onenter=function(e){l="drag-over",c.ondragstart(e)},s.onexit=function(e){l="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){u!==l&&(e.dataset.hopperState=l,u=l)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){s.destroy()}};return c},Ar=!1,Lr=[],br=function(e){var t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){for(var n=!1,r=t;r!==document.body;){if(r.classList.contains("filepond--root")){n=!0;break}r=r.parentNode}if(!n)return}nr(e.clipboardData).then(function(e){e.length&&Lr.forEach(function(t){return t(e)})})},Pr=function(){var e=function(e){t.onload(e)},t={destroy:function(){var t;t=e,de(Lr,Lr.indexOf(t)),0===Lr.length&&(document.removeEventListener("paste",br),Ar=!1)},onload:function(){}};return function(e){Lr.includes(e)||(Lr.push(e),Ar||(Ar=!0,document.addEventListener("paste",br)))}(e),t},Mr=null,wr=null,Cr=[],Nr=function(e,t){e.element.textContent=t},Gr=function(e,t,n){var r=e.query("GET_TOTAL_ITEMS");Nr(e,n+" "+t+", "+r+" "+(1===r?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(wr),wr=setTimeout(function(){!function(e){e.element.textContent=""}(e)},1500)},Ur=function(e){return e.element.parentNode.contains(document.activeElement)},Br=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Nr(t,r+" "+o)},Fr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename;Nr(t,n.status.main+" "+r+" "+n.status.sub)},qr=S({create:function(e){var t=e.root,n=e.props;t.element.id="filepond--assistant-"+n.id,r(t.element,"role","status"),r(t.element,"aria-live","polite"),r(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:A({DID_LOAD_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){t.element.textContent="";var r=t.query("GET_ITEM",n.id);Cr.push(r.filename),clearTimeout(Mr),Mr=setTimeout(function(){Gr(t,Cr.join(", "),t.query("GET_LABEL_FILE_ADDED")),Cr.length=0},750)}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){var r=n.item;Gr(t,r.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Nr(t,r+" "+o)},DID_ABORT_ITEM_PROCESSING:Br,DID_REVERT_ITEM_PROCESSING:Br,DID_THROW_ITEM_REMOVE_ERROR:Fr,DID_THROW_ITEM_LOAD_ERROR:Fr,DID_THROW_ITEM_INVALID:Fr,DID_THROW_ITEM_PROCESSING_ERROR:Fr}),tag:"span",name:"assistant"}),Vr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.replace(new RegExp(t+".","g"),function(e){return e.charAt(1).toUpperCase()})},xr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Date.now(),o=null;return function(){for(var i=arguments.length,a=new Array(i),s=0;s=0?1:0,_=a.find(function(e){return e.markedForRemoval&&e.opacity<.45})?-1:0,T=a.length+E+_,I=hn(s,d);return 1===I?a.forEach(function(e){var r=e.rect.element.height+c;n+=r,t+=r*e.opacity}):(n=Math.ceil(T/I)*p,t=n),{visual:t,bounds:n}},Hr=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Xr=function(e,t){var n=e.query("GET_ALLOW_REPLACE"),r=e.query("GET_ALLOW_MULTIPLE"),o=e.query("GET_TOTAL_ITEMS"),i=e.query("GET_MAX_FILES"),a=t.length;return!r&&a>1||!!(V(i=r?i:n?i:1)&&o+a>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:ot("warning",0,"Max files")}),!0)},Wr=function(e,t,n){var r=e.childViews[0];return gn(r,t,{left:n.scopeLeft-r.rect.element.left,top:n.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},zr=function(e){var t=e.query("GET_ALLOW_DROP"),n=e.query("GET_DISABLED"),r=t&&!n;if(r&&!e.ref.hopper){var o=Sr(e.element,function(t){var n=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every(function(t){return ye("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(function(e){return!0===e})&&n(t)})},{filterItems:function(t){var n=e.query("GET_IGNORED_FILES");return t.filter(function(e){return!ht(e)||!n.includes(e.name.toLowerCase())})},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});o.onload=function(t,n){var r=e.ref.list.childViews[0].childViews.filter(function(e){return e.rect.element.height}),o=e.query("GET_ACTIVE_ITEMS").map(function(e){return r.find(function(t){return t.id===e.id})}).filter(function(e){return e});Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:Wr(e.ref.list,o,n),interactionMethod:ee})}),e.dispatch("DID_DROP",{position:n}),e.dispatch("DID_END_DRAG",{position:n})},o.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},o.ondrag=xr(function(t){e.dispatch("DID_DRAG",{position:t})}),o.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=o,e.ref.drip=e.appendChildView(e.createChildView(Hn))}else!r&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Qr=function(e,t){var n=e.query("GET_ALLOW_BROWSE"),r=e.query("GET_DISABLED"),o=n&&!r;o&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Fn,Object.assign({},t,{onload:function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:te})})}})),0):!o&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},Zr=function(e){var t=e.query("GET_ALLOW_PASTE"),n=e.query("GET_DISABLED"),r=t&&!n;r&&!e.ref.paster?(e.ref.paster=Pr(),e.ref.paster.onload=function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:ne})})}):!r&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Kr=A({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,n=e.props;Qr(t,n)},DID_SET_ALLOW_DROP:function(e){var t=e.root;zr(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;Zr(t)},DID_SET_DISABLED:function(e){var t=e.root,n=e.props;zr(t),Zr(t),Qr(t,n),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),$r=S({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:function(e){var t=e.root,n=e.props,r=t.query("GET_ID");r&&(t.element.id=r);var o=t.query("GET_CLASS_NAME");o&&o.split(" ").filter(function(e){return e.length}).forEach(function(e){t.element.classList.add(e)}),t.ref.label=t.appendChildView(t.createChildView(Yn,Object.assign({},n,{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(bn,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(qr,Object.assign({},n))),t.ref.data=t.appendChildView(t.createChildView(Kn,Object.assign({},n))),t.ref.measure=Ct("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(function(e){return!M(e.value)}).map(function(e){var n=e.name,r=e.value;t.element.dataset[n]=r}),t.ref.widthPrevious=null,t.ref.widthUpdated=xr(function(){t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];var i=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!i&&(t.element.addEventListener("touchmove",Yr,{passive:!1}),t.element.addEventListener("gesturestart",Yr));var s=t.query("GET_CREDITS");if(2===s.length){var u=document.createElement("a");u.className="filepond--credits",u.setAttribute("aria-hidden","true"),u.href=s[0],u.tabindex=-1,u.target="_blank",u.rel="noopener noreferrer",u.textContent=s[1],t.element.appendChild(u),t.ref.credits=u}},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Kr({root:t,props:n,actions:r}),r.filter(function(e){return/^DID_SET_STYLE_/.test(e.type)}).filter(function(e){return!M(e.data.value)}).map(function(e){var n=e.type,r=e.data,o=Vr(n.substr(8).toLowerCase(),"_");t.element.dataset[o]=r.value,t.invalidateLayout()}),!t.rect.element.hidden){t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());var o=t.ref.bounds;o||(o=t.ref.bounds=Hr(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);var i=t.ref,a=i.hopper,s=i.label,u=i.list,l=i.panel;a&&a.updateHopperState();var c=t.query("GET_PANEL_ASPECT_RATIO"),f=t.query("GET_ALLOW_MULTIPLE"),d=t.query("GET_TOTAL_ITEMS"),p=d===(f?t.query("GET_MAX_FILES")||1e6:1),E=r.find(function(e){return"DID_ADD_ITEM"===e.type});if(p&&E){var _=E.data.interactionMethod;s.opacity=0,f?s.translateY=-40:_===J?s.translateX=40:s.translateY=_===te?40:30}else p||(s.opacity=1,s.translateX=0,s.translateY=0);var T=kr(t),I=jr(t),v=s.rect.element.height,m=!f||p?0:v,h=p?u.rect.element.marginTop:0,g=0===d?0:u.rect.element.marginBottom,R=m+h+I.visual+g,O=m+h+I.bounds+g;if(u.translateY=Math.max(0,m-u.rect.element.marginTop)-T.top,c){var y=t.rect.element.width,D=y*c;c!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=c,t.ref.updateHistory=[]);var S=t.ref.updateHistory;if(S.push(y),S.length>4)for(var A=S.length,L=A-10,b=0,P=A;P>=L;P--)if(S[P]===S[P-2]&&b++,b>=2)return;l.scalable=!1,l.height=D;var w=D-m-(g-T.bottom)-(p?h:0);I.visual>w?u.overflow=w:u.overflow=null,t.height=D}else if(o.fixedHeight){l.scalable=!1;var C=o.fixedHeight-m-(g-T.bottom)-(p?h:0);I.visual>C?u.overflow=C:u.overflow=null}else if(o.cappedHeight){var N=R>=o.cappedHeight,G=Math.min(o.cappedHeight,R);l.scalable=!0,l.height=N?G:G-T.top-T.bottom;var U=G-m-(g-T.bottom)-(p?h:0);R>o.cappedHeight&&I.visual>U?u.overflow=U:u.overflow=null,t.height=Math.min(o.cappedHeight,O-T.top-T.bottom)}else{var B=d>0?T.top+T.bottom:0;l.scalable=!0,l.height=Math.max(v,R-B),t.height=Math.max(v,O-B)}t.ref.credits&&l.heightCurrent&&(t.ref.credits.style.transform="translateY("+l.heightCurrent+"px)")}},destroy:function(e){var t=e.root;t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",Yr),t.element.removeEventListener("gesturestart",Yr)},mixins:{styles:["height"]}}),Jr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null,o=Se(),i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object.assign({},e),o=[],i=[],a=function(e,t,n){!n||document.hidden?(c[e]&&c[e](t),o.push({type:e,data:t})):i.push({type:e,data:t})},s=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){y([{source:e,options:t}],{index:t.index}).then(function(e){return n(e&&e[0])}).catch(r)})},addFiles:y,getFile:function(e){return i.query("GET_ACTIVE_ITEM",e)},processFile:S,prepareFile:R,removeFile:O,moveFile:function(e,t){return i.dispatch("MOVE_ITEM",{query:e,index:t})},getFiles:D,processFiles:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n={};return t(Se(),function(e,t){n[e]=t[0]}),Jr(Object.assign({},n,{},e))},to=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[];t(e.attributes,function(t){o.push(e.attributes[t])});var i=o.filter(function(e){return e.name}).reduce(function(t,n){var o,i=r(e,n.name);return t[(o=n.name,Vr(o.replace(/^data-/,"")))]=i===n.name||i,t},{});return function e(n,r){t(r,function(r,o){t(n,function(e,t){var i=new RegExp(r);if(i.test(e)&&(delete n[e],!1!==o))if(U(o))n[o]=t;else{var a,s=o.group;H(o)&&!n[s]&&(n[s]={}),n[s][(a=e.replace(i,""),a.charAt(0).toLowerCase()+a.slice(1))]=t}}),o.mapping&&e(n[o.group],o.mapping)})}(i,n),i},no=function(){return(arguments.length<=0?void 0:arguments[0])instanceof HTMLElement?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={"^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};ye("SET_ATTRIBUTE_TO_OPTION_MAP",n);var r=Object.assign({},t),o=to("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,n);Object.keys(o).forEach(function(e){H(o[e])?(H(r[e])||(r[e]={}),Object.assign(r[e],o[e])):r[e]=o[e]}),r.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(function(e){return{source:e.value,options:{type:e.dataset.type}}}));var i=eo(r);return e.files&&Array.from(e.files).forEach(function(e){i.addFile(e)}),i.replaceElement(e),i}.apply(void 0,arguments):eo.apply(void 0,arguments)},ro=["fire","_read","_write"],oo=function(e){var t={};return Ee(e,t,ro),t},io=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,function(e,n){return t[n]})},ao=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{transfer:function(e,t){},post:function(e,t,n){var o=oe();r.onmessage=function(e){e.data.id===o&&t(e.data.message)},r.postMessage({id:o,message:e},n)},terminate:function(){r.terminate(),URL.revokeObjectURL(n)}}},so=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e})},uo=function(e,t){var n=e.slice(0,e.size,e.type);return n.lastModifiedDate=e.lastModifiedDate,n.name=t,n},lo=function(e){return uo(e,e.name)},co=[],fo=function(e){if(!co.includes(e)){co.push(e);var n,r=e({addFilter:De,utils:{Type:ge,forin:t,isString:U,isFile:ht,toNaturalFileSize:qt,replaceInString:io,getExtensionFromFilename:je,getFilenameWithoutExtension:mt,guesstimateMimeType:tr,getFileFromBlob:We,getFilenameFromURL:ke,createRoute:A,createWorker:ao,createView:S,createItemAPI:Te,loadImage:so,copyFile:lo,renameFile:uo,createBlob:ze,applyFilterChain:Oe,text:Nt,getNumericAspectRatioFromString:be},views:{fileActionButton:Ft}});n=r.options,Object.assign(Ae,n)}},po=(Kt=c()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"slice"in Blob.prototype&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window&&("supports"in(window.CSS||{})||/MSIE|Trident/.test(window.navigator.userAgent)),function(){return Kt}),Eo={apps:[]},_o=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=_o,e.destroy=_o,e.parse=_o,e.find=_o,e.registerPlugin=_o,e.getOptions=_o,e.setOptions=_o,po()){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,r="__framePainter";if(window[r])return window[r].readers.push(e),void window[r].writers.push(t);window[r]={readers:[e],writers:[t]};var o=window[r],i=1e3/n,a=null,s=null,u=null,l=null,c=function(){document.hidden?(u=function(){return window.setTimeout(function(){return f(performance.now())},i)},l=function(){return window.clearTimeout(s)}):(u=function(){return window.requestAnimationFrame(f)},l=function(){return window.cancelAnimationFrame(s)})};document.addEventListener("visibilitychange",function(){l&&l(),c(),f(performance.now())});var f=function e(t){s=u(e),a||(a=t);var n=t-a;n<=i||(a=t-n%i,o.readers.forEach(function(e){return e()}),o.writers.forEach(function(e){return e(t)}))};c(),f(performance.now())}(function(){Eo.apps.forEach(function(e){return e._read()})},function(e){Eo.apps.forEach(function(t){return t._write(e)})});var To=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:po,create:e.create,destroy:e.destroy,parse:e.parse,find:e.find,registerPlugin:e.registerPlugin,setOptions:e.setOptions}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(function(){return To()},0):document.addEventListener("DOMContentLoaded",To);var Io=function(){return t(Se(),function(t,n){e.OptionTypes[t]=n[1]})};e.Status=Object.assign({},Me),e.FileOrigin=Object.assign({},ve),e.FileStatus=Object.assign({},Ie),e.OptionTypes={},Io(),e.create=function(){var t=no.apply(void 0,arguments);return t.on("destroy",e.destroy),Eo.apps.push(t),oo(t)},e.destroy=function(e){var t=Eo.apps.findIndex(function(t){return t.isAttachedTo(e)});return t>=0&&(Eo.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll(".filepond")).filter(function(e){return!Eo.apps.find(function(t){return t.isAttachedTo(e)})}).map(function(t){return e.create(t)})},e.find=function(e){var t=Eo.apps.find(function(t){return t.isAttachedTo(e)});return t?oo(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:null;if(null===n)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},o=["svg","path"],i=function(e){return o.includes(e)},a=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof n&&(o=n,n=null);var a=i(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n&&(i(e)?r(a,"class",n):a.className=n),t(o,function(e,t){r(a,e,t)}),a},s=function(e,t){return function(e,n){return void 0!==n?t.splice(n,0,e):t.push(e),e}},u=function(e,t){return function(n){return t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n}},l="undefined"!=typeof window&&void 0!==window.document,c=function(){return l},f="children"in(c()?a("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},d=function(e,t,n,r){var o=n[0]||e.left,i=n[1]||e.top,a=o+e.width,s=i+e.height*(r[1]||1),u={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:o,top:i,right:a,bottom:s}};return t.filter(function(e){return!e.isRectIgnored()}).map(function(e){return e.rect}).forEach(function(e){p(u.inner,Object.assign({},e.inner)),p(u.outer,Object.assign({},e.outer))}),E(u.inner),u.outer.bottom+=u.element.marginBottom,u.outer.right+=u.element.marginRight,E(u.outer),u},p=function(e,t){t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},E=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},_=function(e){return"number"==typeof e},T=function(e){return e<.5?2*e*e:(4-2*e)*e-1},I={spring:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,r=void 0===t?.5:t,o=e.damping,i=void 0===o?.75:o,a=e.mass,s=void 0===a?10:a,u=null,l=null,c=0,f=!1,d=n({interpolate:function(e,t){if(!f){if(!_(u)||!_(l))return f=!0,void(c=0);(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},o=r.duration,i=void 0===o?500:o,a=r.easing,s=void 0===a?T:a,u=r.delay,l=void 0===u?0:u,c=null,f=!0,d=!1,p=null,E=n({interpolate:function(n,r){f||null===p||(null===c&&(c=n),n-c=i||r?(e=1,t=d?0:1,E.onupdate(t*p),E.oncomplete(t*p),f=!0):(t=e/i,E.onupdate((e>=0?s(d?1-t:t):0)*p))))},target:{get:function(){return d?0:p},set:function(e){if(null===p)return p=e,E.onupdate(e),void E.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach(function(t){e.forEach(function(e){var o=e,i=function(){return n[e]},a=function(t){return n[e]=t};"object"==typeof e&&(o=e.key,i=e.getter||i,a=e.setter||a),t[o]&&!r||(t[o]={get:i,set:a})})})},h=function(e){return null!=e},g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},R=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var n in t)if(t[n]!==e[n])return!0;return!1},O=function(e,t){var n=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,a=t.scaleX,s=t.scaleY,u=t.rotateX,l=t.rotateY,c=t.rotateZ,f=t.originX,d=t.originY,p=t.width,E=t.height,_="",T="";(h(f)||h(d))&&(T+="transform-origin: "+(f||0)+"px "+(d||0)+"px;"),h(r)&&(_+="perspective("+r+"px) "),(h(o)||h(i))&&(_+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(h(a)||h(s))&&(_+="scale3d("+(h(a)?a:1)+", "+(h(s)?s:1)+", 1) "),h(c)&&(_+="rotateZ("+c+"rad) "),h(u)&&(_+="rotateX("+u+"rad) "),h(l)&&(_+="rotateY("+l+"rad) "),_.length&&(T+="transform:"+_+";"),h(n)&&(T+="opacity:"+n+";",0===n&&(T+="visibility:hidden;"),n<1&&(T+="pointer-events:none;")),h(E)&&(T+="height:"+E+"px;"),h(p)&&(T+="width:"+p+"px;");var I=e.elementCurrentStyle||"";T.length===I.length&&T===I||(e.style.cssText=T,e.elementCurrentStyle=T)},y={styles:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewInternalAPI,o=e.viewExternalAPI,i=e.view,a=Object.assign({},n),s={};m(t,[r,o],n);var u=function(){return i.rect?d(i.rect,i.childViews,[n.translateX||0,n.translateY||0],[n.scaleX||0,n.scaleY||0]):null};return r.rect={get:u},o.rect={get:u},t.forEach(function(e){n[e]=void 0===a[e]?g[e]:a[e]}),{write:function(){if(R(s,n))return O(i.element,n),Object.assign(s,Object.assign({},n)),!0},destroy:function(){}}},listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t,n=e.viewExternalAPI,r=(e.viewState,e.view),o=[],i=(t=r.element,function(e,n){t.addEventListener(e,n)}),a=function(e){return function(t,n){e.removeEventListener(t,n)}}(r.element);return n.on=function(e,t){o.push({type:e,fn:t}),i(e,t)},n.off=function(e,t){o.splice(o.findIndex(function(n){return n.type===e&&n.fn===t}),1),a(e,t)},{write:function(){return!0},destroy:function(){o.forEach(function(e){a(e.type,e.fn)})}}},animations:function(e){var n=e.mixinConfig,r=e.viewProps,o=e.viewInternalAPI,i=e.viewExternalAPI,a=Object.assign({},r),s=[];return t(n,function(e,t){var n=v(t);n&&(n.onupdate=function(t){r[e]=t},n.target=a[e],m([{key:e,setter:function(e){n.target!==e&&(n.target=e)},getter:function(){return r[e]}}],[o,i],r,!0),s.push(n))}),{write:function(e){var t=document.hidden,n=!0;return s.forEach(function(r){r.resting||(n=!1),r.interpolate(e,t)}),n},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewExternalAPI;m(t,r,n)}},D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.layoutCalculated||(e.paddingTop=parseInt(n.paddingTop,10)||0,e.marginTop=parseInt(n.marginTop,10)||0,e.marginRight=parseInt(n.marginRight,10)||0,e.marginBottom=parseInt(n.marginBottom,10)||0,e.marginLeft=parseInt(n.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,r=void 0===t?"div":t,o=e.name,i=void 0===o?null:o,l=e.attributes,c=void 0===l?{}:l,p=e.read,E=void 0===p?function(){}:p,_=e.write,T=void 0===_?function(){}:_,I=e.create,v=void 0===I?function(){}:I,m=e.destroy,h=void 0===m?function(){}:m,g=e.filterFrameActionsForChild,R=void 0===g?function(e,t){return t}:g,O=e.didCreateView,S=void 0===O?function(){}:O,A=e.didWriteView,L=void 0===A?function(){}:A,b=e.ignoreRect,P=void 0!==b&&b,M=e.ignoreRectUpdate,w=void 0!==M&&M,C=e.mixins,N=void 0===C?[]:C;return function(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=a(r,"filepond--"+i,c),p=window.getComputedStyle(l,null),_=D(),I=null,m=!1,g=[],O=[],A={},b={},M=[T],C=[E],G=[h],U=function(){return l},B=function(){return g.concat()},F=function(){return I||(I=d(_,g,[0,0],[1,1]))},q={element:{get:U},style:{get:function(){return p}},childViews:{get:B}},V=Object.assign({},q,{rect:{get:F},ref:{get:function(){return A}},is:function(e){return i===e},appendChild:(t=l,function(e,n){void 0!==n&&t.children[n]?t.insertBefore(e,t.children[n]):t.appendChild(e)}),createChildView:function(e){return function(t,n){return t(e,n)}}(e),linkView:function(e){return g.push(e),e},unlinkView:function(e){g.splice(g.indexOf(e),1)},appendChildView:s(0,g),removeChildView:u(l,g),registerWriter:function(e){return M.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return G.push(e)},invalidateLayout:function(){return l.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:function(){return m}},isRectIgnored:function(){return P},_read:function(){I=null,g.forEach(function(e){return e._read()}),!(w&&_.width&&_.height)&&D(_,l,p);var e={root:j,props:o,rect:_};C.forEach(function(t){return t(e)})},_write:function(e,t,n){var r=0===t.length;return M.forEach(function(i){!1===i({props:o,root:j,actions:t,timestamp:e,shouldOptimize:n})&&(r=!1)}),O.forEach(function(t){!1===t.write(e)&&(r=!1)}),g.filter(function(e){return!!e.element.parentNode}).forEach(function(o){o._write(e,R(o,t),n)||(r=!1)}),g.forEach(function(o,i){o.element.parentNode||(j.appendChild(o.element,i),o._read(),o._write(e,R(o,t),n),r=!1)}),m=r,L({props:o,root:j,actions:t,timestamp:e}),r},_destroy:function(){O.forEach(function(e){return e.destroy()}),G.forEach(function(e){e({root:j,props:o})}),g.forEach(function(e){return e._destroy()})}},Y=Object.assign({},q,{rect:{get:function(){return _}}});Object.keys(N).sort(function(e,t){return"styles"===e?1:"styles"===t?-1:0}).forEach(function(e){var t=y[e]({mixinConfig:N[e],viewProps:o,viewState:b,viewInternalAPI:V,viewExternalAPI:x,view:n(Y)});t&&O.push(t)});var j=n(V);v({root:j,props:o});var k=f(l);return g.forEach(function(e,t){j.appendChild(e.element,k+t)}),S(j),n(x)}},A=function(e,t){return function(n){var r=n.root,o=n.props,i=n.actions,a=void 0===i?[]:i,s=n.timestamp,u=n.shouldOptimize;a.filter(function(t){return e[t.type]}).forEach(function(t){return e[t.type]({root:r,props:o,action:t.data,timestamp:s,shouldOptimize:u})}),t&&t({root:r,props:o,actions:a,timestamp:s,shouldOptimize:u})}},L=function(e,t){return t.parentNode.insertBefore(e,t)},b=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},P=function(e){return Array.isArray(e)},M=function(e){return null==e},w=function(e){return e.trim()},C=function(e){return""+e},N=function(e){return"boolean"==typeof e},G=function(e){return N(e)?e:"true"===e},U=function(e){return"string"==typeof e},B=function(e){return _(e)?e:U(e)?C(e).replace(/[a-z]+/gi,""):0},F=function(e){return parseInt(B(e),10)},q=function(e){return parseFloat(B(e))},V=function(e){return _(e)&&isFinite(e)&&Math.floor(e)===e},x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(V(e))return e;var n=C(e).trim();return/MB$/i.test(n)?(n=n.replace(/MB$i/,"").trim(),F(n)*t*t):/KB/i.test(n)?(n=n.replace(/KB$i/,"").trim(),F(n)*t):F(n)},Y=function(e){return"function"==typeof e},j={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},k=function(e,t,n,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===n||"PATCH"===n?"?"+e+"=":"",method:n,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){var a=i.headers.split(/:(.+)/);i.headers={header:a[0],value:a[1]}}return i.withCredentials=G(i.withCredentials),i},H=function(e){return"object"==typeof e&&null!==e},X=function(e){return P(e)?"array":function(e){return null===e}(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":function(e){return H(e)&&U(e.url)&&H(e.process)&&H(e.revert)&&H(e.restore)&&H(e.fetch)}(e)?"api":typeof e},W={array:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return M(e)?[]:P(e)?e:C(e).split(t).map(w).filter(function(e){return e.length})},boolean:G,int:function(e){return"bytes"===X(e)?x(e):F(e)},number:q,float:q,bytes:x,string:function(e){return Y(e)?e:C(e)},function:function(e){return function(e){for(var t=self,n=e.split("."),r=null;r=n.shift();)if(!(t=t[r]))return null;return t}(e)},serverapi:function(e){return(r={}).url=U(n=e)?n:n.url||"",r.timeout=n.timeout?parseInt(n.timeout,10):0,r.headers=n.headers?n.headers:{},t(j,function(e){r[e]=k(e,n[e],j[e],r.timeout,r.headers)}),r.process=n.process||U(n)||n.url?r.process:null,r.remove=n.remove||null,delete r.headers,r;var n,r},object:function(e){try{return JSON.parse(e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(e){return null}}},z=function(e,t,n){if(e===t)return e;var r,o=X(e);if(o!==n){var i=(r=e,W[n](r));if(o=X(i),null===i)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+n+'"';e=i}return e},Q=function(e){var r={};return t(e,function(t){var n,o,i,a=e[t];r[t]=(n=a[0],o=a[1],i=n,{enumerable:!0,get:function(){return i},set:function(e){i=z(e,n,o)}})}),n(r)},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.split(/(?=[A-Z])/).map(function(e){return e.toLowerCase()}).join(t)},K=function(e){return function(n,r,o){var i={};return t(e,function(e){var t=Z(e,"_").toUpperCase();i["SET_"+t]=function(r){try{o.options[e]=r.value}catch(e){}n("DID_SET_"+t,{value:o.options[e]})}}),i}},$=function(e){return function(n){var r={};return t(e,function(e){r["GET_"+Z(e,"_").toUpperCase()]=function(t){return n.options[e]}}),r}},J=1,ee=2,te=3,ne=4,re=5,oe=function(){return Math.random().toString(36).substr(2,9)};function ie(e){this.wrapped=e}function ae(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof ie;Promise.resolve(s?a.wrapped:a).then(function(e){s?r("next",e):o(i.done?"return":"normal",e)},function(e){r("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function se(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}"function"==typeof Symbol&&Symbol.asyncIterator&&(ae.prototype[Symbol.asyncIterator]=function(){return this}),ae.prototype.next=function(e){return this._invoke("next",e)},ae.prototype.throw=function(e){return this._invoke("throw",e)},ae.prototype.return=function(e){return this._invoke("return",e)};function ue(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1?t-1:0),o=1;o1?t-1:0),o=1;oBrowse',ge.STRING],labelInvalidField:["Field contains invalid files",ge.STRING],labelFileWaitingForSize:["Waiting for size",ge.STRING],labelFileSizeNotAvailable:["Size not available",ge.STRING],labelFileCountSingular:["file in list",ge.STRING],labelFileCountPlural:["files in list",ge.STRING],labelFileLoading:["Loading",ge.STRING],labelFileAdded:["Added",ge.STRING],labelFileLoadError:["Error during load",ge.STRING],labelFileRemoved:["Removed",ge.STRING],labelFileRemoveError:["Error during remove",ge.STRING],labelFileProcessing:["Uploading",ge.STRING],labelFileProcessingComplete:["Upload complete",ge.STRING],labelFileProcessingAborted:["Upload cancelled",ge.STRING],labelFileProcessingError:["Error during upload",ge.STRING],labelFileProcessingRevertError:["Error during revert",ge.STRING],labelTapToCancel:["tap to cancel",ge.STRING],labelTapToRetry:["tap to retry",ge.STRING],labelTapToUndo:["tap to undo",ge.STRING],labelButtonRemoveItem:["Remove",ge.STRING],labelButtonAbortItemLoad:["Abort",ge.STRING],labelButtonRetryItemLoad:["Retry",ge.STRING],labelButtonAbortItemProcessing:["Cancel",ge.STRING],labelButtonUndoItemProcessing:["Undo",ge.STRING],labelButtonRetryItemProcessing:["Retry",ge.STRING],labelButtonProcessItem:["Upload",ge.STRING],iconRemove:['',ge.STRING],iconProcess:['',ge.STRING],iconRetry:['',ge.STRING],iconUndo:['',ge.STRING],iconDone:['',ge.STRING],oninit:[null,ge.FUNCTION],onwarning:[null,ge.FUNCTION],onerror:[null,ge.FUNCTION],onactivatefile:[null,ge.FUNCTION],oninitfile:[null,ge.FUNCTION],onaddfilestart:[null,ge.FUNCTION],onaddfileprogress:[null,ge.FUNCTION],onaddfile:[null,ge.FUNCTION],onprocessfilestart:[null,ge.FUNCTION],onprocessfileprogress:[null,ge.FUNCTION],onprocessfileabort:[null,ge.FUNCTION],onprocessfilerevert:[null,ge.FUNCTION],onprocessfile:[null,ge.FUNCTION],onprocessfiles:[null,ge.FUNCTION],onremovefile:[null,ge.FUNCTION],onpreparefile:[null,ge.FUNCTION],onupdatefiles:[null,ge.FUNCTION],onreorderfiles:[null,ge.FUNCTION],beforeDropFile:[null,ge.FUNCTION],beforeAddFile:[null,ge.FUNCTION],beforeRemoveFile:[null,ge.FUNCTION],beforePrepareFile:[null,ge.FUNCTION],stylePanelLayout:[null,ge.STRING],stylePanelAspectRatio:[null,ge.STRING],styleItemPanelAspectRatio:[null,ge.STRING],styleButtonRemoveItemPosition:["left",ge.STRING],styleButtonProcessItemPosition:["right",ge.STRING],styleLoadIndicatorPosition:["right",ge.STRING],styleProgressIndicatorPosition:["right",ge.STRING],styleButtonRemoveItemAlign:[!1,ge.BOOLEAN],files:[[],ge.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],ge.ARRAY]},Le=function(e,t){return M(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(function(e){return e.id===t})||null)},be=function(e){if(M(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Pe=function(e){return e.filter(function(e){return!e.archived})},Me={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},we=null,Ce=[Ie.LOAD_ERROR,Ie.PROCESSING_ERROR,Ie.PROCESSING_REVERT_ERROR],Ne=[Ie.LOADING,Ie.PROCESSING,Ie.PROCESSING_QUEUED,Ie.INIT],Ge=[Ie.PROCESSING_COMPLETE],Ue=function(e){return Ce.includes(e.status)},Be=function(e){return Ne.includes(e.status)},Fe=function(e){return Ge.includes(e.status)},qe=function(e){return H(e.options.server)&&(H(e.options.server.process)||Y(e.options.server.process))},Ve=function(e){return{GET_STATUS:function(){var t=Pe(e.items),n=Me.EMPTY,r=Me.ERROR,o=Me.BUSY,i=Me.IDLE,a=Me.READY;return 0===t.length?n:t.some(Ue)?r:t.some(Be)?o:t.some(Fe)?a:i},GET_ITEM:function(t){return Le(e.items,t)},GET_ACTIVE_ITEM:function(t){return Le(Pe(e.items),t)},GET_ACTIVE_ITEMS:function(){return Pe(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var n=Le(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:function(t){var n=Le(e.items,t);return n?n.fileSize:null},GET_STYLES:function(){return Object.keys(e.options).filter(function(e){return/^style/.test(e)}).map(function(t){return{name:t,value:e.options[t]}})},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(e.options.stylePanelLayout)?1:be(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return Pe(e.items).filter(function(e){return e.status===t})},GET_TOTAL_ITEMS:function(){return Pe(e.items).length},SHOULD_UPDATE_FILE_INPUT:function(){return e.options.storeAsFile&&function(){if(null===we)try{var e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));var t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,we=1===t.files.length}catch(e){we=!1}return we}()&&!qe(e)},IS_ASYNC:function(){return qe(e)},GET_FILE_SIZE_LABELS:function(e){return{labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0}}}},xe=function(e,t,n){return Math.max(Math.min(n,e),t)},Ye=function(e){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e)},je=function(e){return e.split("/").pop().split("?").shift()},ke=function(e){return e.split(".").pop()},He=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},Xe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+He(e.getMonth()+1,"00")+"-"+He(e.getDate(),"00")+"_"+He(e.getHours(),"00")+"-"+He(e.getMinutes(),"00")+"-"+He(e.getSeconds(),"00")},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="string"==typeof n?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return o.lastModifiedDate=new Date,e._relativePath&&(o._relativePath=e._relativePath),U(t)||(t=Xe()),t&&null===r&&ke(t)?o.name=t:(r=r||function(e){if("string"!=typeof e)return"";var t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""}(o.type),o.name=t+(r?"."+r:"")),o},ze=function(e,t){var n=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n){var r=new n;return r.append(e),r.getBlob(t)}return new Blob([e],{type:t})},Qe=function(e){return(/^data:(.+);/.exec(e)||[])[1]||null},Ze=function(e){var t=Qe(e);return function(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=200&&a.status<300?r.onload(a):r.onerror(a)},a.onerror=function(){return r.onerror(a)},a.onabort=function(){o=!0,r.onabort()},a.ontimeout=function(){return r.ontimeout(a)},a.open(n.method,t,!0),V(n.timeout)&&(a.timeout=n.timeout),Object.keys(n.headers).forEach(function(e){var t=unescape(encodeURIComponent(n.headers[e]));a.setRequestHeader(e,t)}),n.responseType&&(a.responseType=n.responseType),n.withCredentials&&(a.withCredentials=!0),a.send(e),r},ot=function(e,t,n,r){return{type:e,code:t,body:n,headers:r}},it=function(e){return function(t){e(ot("error",0,"Timeout",t.getAllResponseHeaders()))}},at=function(e){return/\?/.test(e)},st=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return null;var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a,s,u,l){var c=rt(o,st(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var r=e.getAllResponseHeaders(),a=et(r).name||je(o);i(ot("load",e.status,"HEAD"===t.method?null:We(n(e.response),a),r))},c.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){l(ot("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=it(a),c.onprogress=s,c.onabort=u,c}},lt=0,ct=1,ft=2,dt=3,pt=4,Et=function(e,t,n,r,o,i,a,s,u,l,c){for(var f=[],d=c.chunkTransferId,p=c.chunkServer,E=c.chunkSize,_=c.chunkRetryDelays,T={serverId:d,aborted:!1},I=t.ondata||function(e){return e},v=t.onload||function(e,t){return"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response},m=t.onerror||function(e){return null},h=Math.floor(r.size/E),g=0;g<=h;g++){var R=g*E,O=r.slice(R,R+E,"application/offset+octet-stream");f[g]={index:g,size:O.size,offset:R,data:O,file:r,progress:0,retries:ue(_),status:lt,error:null,request:null,timeout:null}}var y,D,S,A,L=function(e){return e.status===lt||e.status===dt},b=function(t){if(!T.aborted)if(t=t||f.find(L)){t.status=ft,t.progress=null;var n=p.ondata||function(e){return e},o=p.onerror||function(e){return null},s=st(e,p.url,T.serverId),l="function"==typeof p.headers?p.headers(t):Object.assign({},p.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":r.size,"Upload-Name":r.name}),c=t.request=rt(n(t.data),s,Object.assign({},p,{headers:l}));c.onload=function(){t.status=ct,t.request=null,w()},c.onprogress=function(e,n,r){t.progress=e?n:null,M()},c.onerror=function(e){t.status=dt,t.request=null,t.error=o(e.response)||e.statusText,P(t)||a(ot("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))},c.ontimeout=function(e){t.status=dt,t.request=null,P(t)||it(a)(e)},c.onabort=function(){t.status=lt,t.request=null,u()}}else f.every(function(e){return e.status===ct})&&i(T.serverId)},P=function(e){return 0!==e.retries.length&&(e.status=pt,clearTimeout(e.timeout),e.timeout=setTimeout(function(){b(e)},e.retries.shift()),!0)},M=function(){var e=f.reduce(function(e,t){return null===e||null===t.progress?null:e+t.progress},0);if(null===e)return s(!1,0,0);var t=f.reduce(function(e,t){return e+t.size},0);s(!0,e,t)},w=function(){f.filter(function(e){return e.status===ft}).length>=1||b()};return T.serverId?(y=function(e){T.aborted||(f.filter(function(t){return t.offset0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,o=new Array(e),i=0;ir.chunkSize,p=f&&(d||r.chunkForce);if(o instanceof Blob&&p)return Et(e,t,n,o,i,a,s,u,l,c,r);var E=t.ondata||function(e){return e},_=t.onload||function(e){return e},T=t.onerror||function(e){return null},I="function"==typeof t.headers?t.headers(o,i)||{}:Object.assign({},t.headers),v=Object.assign({},t,{headers:I}),m=new FormData;H(i)&&m.append(n,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach(function(e){m.append(n,e.file,null===e.name?e.file.name:""+e.name+e.file.name)});var h=rt(E(m),st(e,t.url),v);return h.onload=function(e){a(ot("load",e.status,_(e.response),e.getAllResponseHeaders()))},h.onerror=function(e){s(ot("error",e.status,T(e.response)||e.statusText,e.getAllResponseHeaders()))},h.ontimeout=it(s),h.onprogress=u,h.onabort=l,h}}}(e,t,n,r):null},Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return function(e,t){return t()};var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a){var s=rt(o,e+t.url,t);return s.onload=function(e){i(ot("load",e.status,n(e.response),e.getAllResponseHeaders()))},s.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},s.ontimeout=it(a),s}},It=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+Math.random()*(t-e)},vt=function(e,t){var n={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=t.allowMinimumUploadDuration,o=function(){n.request&&(n.perceivedPerformanceUpdater.clear(),n.request.abort&&n.request.abort(),n.complete=!0)},i=r?function(){return n.progress?Math.min(n.progress,n.perceivedProgress):null}:function(){return n.progress||null},a=r?function(){return Math.min(n.duration,n.perceivedDuration)}:function(){return n.duration},s=Object.assign({},pe(),{process:function(t,o){var i=function(){0!==n.duration&&null!==n.progress&&s.fire("progress",s.getProgress())},a=function(){n.complete=!0,s.fire("load-perceived",n.response.body)};s.fire("start"),n.timestamp=Date.now(),n.perceivedPerformanceUpdater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:25),r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=null,i=Date.now();return t>0&&function a(){var s=Date.now()-i,u=It(n,r);s+u>t&&(u=s+u-t);var l=s/t;l>=1||document.hidden?e(1):(e(l),o=setTimeout(a,u))}(),{clear:function(){clearTimeout(o)}}}(function(e){n.perceivedProgress=e,n.perceivedDuration=Date.now()-n.timestamp,i(),n.response&&1===n.perceivedProgress&&!n.complete&&a()},r?It(750,1500):0),n.request=e(t,o,function(e){n.response=H(e)?e:{type:"load",code:200,body:""+e,headers:{}},n.duration=Date.now()-n.timestamp,n.progress=1,s.fire("load",n.response.body),(!r||r&&1===n.perceivedProgress)&&a()},function(e){n.perceivedPerformanceUpdater.clear(),s.fire("error",H(e)?e:{type:"error",code:0,body:""+e})},function(e,t,r){n.duration=Date.now()-n.timestamp,n.progress=e?t/r:null,i()},function(){n.perceivedPerformanceUpdater.clear(),s.fire("abort",n.response?n.response.body:null)},function(e){s.fire("transfer",e)})},abort:o,getProgress:i,getDuration:a,reset:function(){o(),n.complete=!1,n.perceivedProgress=0,n.progress=0,n.timestamp=null,n.perceivedDuration=0,n.duration=0,n.request=null,n.response=null}});return s},mt=function(e){return e.substr(0,e.lastIndexOf("."))||e},ht=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},gt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=oe(),i={archived:!1,frozen:!1,released:!1,source:null,file:r,serverFileReference:t,transferId:null,processingAborted:!1,status:t?Ie.PROCESSING_COMPLETE:Ie.INIT,activeLoader:null,activeProcessor:null},a=null,s={},u=function(e){return i.status=e},l=function(e){if(!i.released&&!i.frozen){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},r=n.query,o=n.success,i=void 0===o?function(){}:o,a=n.failure,s=void 0===a?function(){}:a,u=se(n,["query","success","failure"]),l=Le(e.items,r);l?t(l,i,s,u||{}):s({error:ot("error",0,"Item not found"),file:null})}},Pt=function(e,t,n){return{ABORT_ALL:function(){Pe(n.items).forEach(function(e){e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map(function(e){return{source:e.source?e.source:e,options:e.options}}),i=Pe(n.items);i.forEach(function(t){o.find(function(e){return e.source===t.source||e.source===t.file})||e("REMOVE_ITEM",{query:t,remove:!1})}),i=Pe(n.items),o.forEach(function(t,n){i.find(function(e){return e.source===t.source||e.file===t.source})||e("ADD_ITEM",Object.assign({},t,{interactionMethod:re,index:n}))})},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id,i=r.action,a=r.change;a.silent||(clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(function(){var r=Rt(n.items,o);if(t("IS_ASYNC")){r.origin===ve.LOCAL&&e("DID_LOAD_ITEM",{id:r.id,error:null,serverFileReference:r.source});var s,u=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return r.status===Ie.PROCESSING_COMPLETE?(s=n.options.instantUpload,void r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s?u:function(){}).catch(function(){})):r.status===Ie.PROCESSING?function(e){r.abortProcessing().then(e?u:function(){})}(n.options.instantUpload):void(n.options.instantUpload&&u())}Oe("SHOULD_PREPARE_OUTPUT",!1,{item:r,query:t,action:i,change:a}).then(function(n){var i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(r,n)),n&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:r,success:function(t){e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)})},0))},MOVE_ITEM:function(e){var t=e.query,r=e.index,o=Le(n.items,t);if(o){var i=n.items.indexOf(o);i!==(r=xe(r,0,n.items.length-1))&&n.items.splice(r,0,n.items.splice(i,1)[0])}},SORT:function(r){var o=r.compare;Lt(n,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(n){var r=n.items,o=n.index,i=n.interactionMethod,a=n.success,s=void 0===a?function(){}:a,u=n.failure,l=void 0===u?function(){}:u,c=o;if(-1===o||void 0===o){var f=t("GET_ITEM_INSERT_LOCATION"),d=t("GET_TOTAL_ITEMS");c="before"===f?0:d}var p=t("GET_IGNORED_FILES"),E=r.filter(function(e){return ht(e)?!p.includes(e.name.toLowerCase()):!M(e)}).map(function(t){return new Promise(function(n,r){e("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:n,failure:r,index:c++,options:t.options||{}})})});Promise.all(E).then(s).catch(l)},ADD_ITEM:function(r){var o=r.source,i=r.index,a=void 0===i?-1:i,s=r.interactionMethod,u=r.success,l=void 0===u?function(){}:u,c=r.failure,f=void 0===c?function(){}:c,d=r.options,p=void 0===d?{}:d;if(M(o))f({error:ot("error",0,"No source"),file:null});else if(!ht(o)||!n.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(e){var t=Pe(e.items).length;if(!e.options.allowMultiple)return 0===t;var n=e.options.maxFiles;return null===n||t=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:h,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void f({error:t,file:Te(v)});e("DID_THROW_ITEM_LOAD_ERROR",{id:h,error:t,status:{main:r,sub:n.options.labelTapToRetry}})}),v.on("load-file-error",function(t){e("DID_THROW_ITEM_INVALID",{id:h,error:t.status,status:t.status}),f({error:t.status,file:Te(v)})}),v.on("load-abort",function(){e("REMOVE_ITEM",{query:h})}),v.on("load-skip",function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}})}),v.on("load",function(){var r=function(r){r?(v.on("metadata-update",function(t){e("DID_UPDATE_ITEM_METADATA",{id:h,change:t})}),Oe("SHOULD_PREPARE_OUTPUT",!1,{item:v,query:t}).then(function(r){var i=t("GET_BEFORE_PREPARE_FILE");i&&(r=i(v,r));var a=function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}}),St(e,n)};r?e("REQUEST_PREPARE_OUTPUT",{query:h,item:v,success:function(t){e("DID_PREPARE_OUTPUT",{id:h,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:h})};Oe("DID_LOAD_ITEM",v,{query:t,dispatch:e}).then(function(){At(t("GET_BEFORE_ADD_FILE"),Te(v)).then(r)}).catch(function(t){if(!t||!t.error||!t.status)return r(!1);e("DID_THROW_ITEM_INVALID",{id:h,error:t.error,status:t.status})})}),v.on("process-start",function(){e("DID_START_ITEM_PROCESSING",{id:h})}),v.on("process-progress",function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:h,progress:t})}),v.on("process-error",function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-revert-error",function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingRevertError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-complete",function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:h,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:h,value:t})}),v.on("process-abort",function(){e("DID_ABORT_ITEM_PROCESSING",{id:h})}),v.on("process-revert",function(){e("DID_REVERT_ITEM_PROCESSING",{id:h}),e("DID_DEFINE_VALUE",{id:h,value:null})}),e("DID_ADD_ITEM",{id:h,index:a,interactionMethod:s}),St(e,n);var g=n.options.server||{},R=g.url,O=g.load,y=g.restore,D=g.fetch;v.load(o,tt(I===ve.INPUT?U(o)&&function(e){return(e.indexOf(":")>-1||e.indexOf("//")>-1)&&yt(location.href)!==yt(e)}(o)&&D?ut(R,D):Ot:ut(R,I===ve.LIMBO?y:O)),function(e,n,r){Oe("LOAD_FILE",e,{query:t}).then(n).catch(r)})}},REQUEST_PREPARE_OUTPUT:function(e){var n=e.item,r=e.success,o=e.failure,i=void 0===o?function(){}:o,a={error:ot("error",0,"Item not found"),file:null};if(n.archived)return i(a);Oe("PREPARE_OUTPUT",n.file,{query:t,item:n}).then(function(e){Oe("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:n}).then(function(e){if(n.archived)return i(a);r(e)})})},COMPLETE_LOAD_ITEM:function(r){var o=r.item,i=r.data,a=i.success,s=i.source,u=t("GET_ITEM_INSERT_LOCATION");if(Y(u)&&s&&Lt(n,u),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===ve.INPUT?null:s}),a(Te(o)),o.origin!==ve.LOCAL)return o.origin===ve.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&n.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:bt(n,function(e){e.retryLoad()}),REQUEST_ITEM_PREPARE:bt(n,function(t,n,r){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(r){e("DID_PREPARE_OUTPUT",{id:t.id,file:r}),n({file:t,output:r})},failure:r},!0)}),REQUEST_ITEM_PROCESSING:bt(n,function(r,o,i){if(r.status===Ie.IDLE||r.status===Ie.PROCESSING_ERROR)r.status!==Ie.PROCESSING_QUEUED&&(r.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:r.id}),e("PROCESS_ITEM",{query:r,success:o,failure:i},!0));else{var a=function(){return e("REQUEST_ITEM_PROCESSING",{query:r,success:o,failure:i})},s=function(){return document.hidden?a():setTimeout(a,32)};r.status===Ie.PROCESSING_COMPLETE||r.status===Ie.PROCESSING_REVERT_ERROR?r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s).catch(function(){}):r.status===Ie.PROCESSING&&r.abortProcessing().then(s)}}),PROCESS_ITEM:bt(n,function(r,o,i){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",Ie.PROCESSING).length!==a){if(r.status!==Ie.PROCESSING){var s=function t(){var r=n.processingQueue.shift();if(r){var o=r.id,i=r.success,a=r.failure,s=Le(n.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:i,failure:a},!0):t()}};r.onOnce("process-complete",function(){o(Te(r)),s();var i=n.options.server;if(n.options.instantUpload&&r.origin===ve.LOCAL&&Y(i.remove)){var a=function(){};r.origin=ve.LIMBO,n.options.server.remove(r.source,a,a)}t("GET_ITEMS_BY_STATUS",Ie.PROCESSING_COMPLETE).length===n.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),r.onOnce("process-error",function(e){i({error:e,file:Te(r)}),s()});var u=n.options;r.process(vt(_t(u.server.url,u.server.process,u.name,{chunkTransferId:r.transferId,chunkServer:u.server.patch,chunkUploads:u.chunkUploads,chunkForce:u.chunkForce,chunkSize:u.chunkSize,chunkRetryDelays:u.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),function(n,o,i){Oe("PREPARE_OUTPUT",n,{query:t,item:r}).then(function(t){e("DID_PREPARE_OUTPUT",{id:r.id,file:t}),o(t)}).catch(i)})}}else n.processingQueue.push({id:r.id,success:o,failure:i})}),RETRY_ITEM_PROCESSING:bt(n,function(t){e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:bt(n,function(n){At(t("GET_BEFORE_REMOVE_FILE"),Te(n)).then(function(t){t&&e("REMOVE_ITEM",{query:n})})}),RELEASE_ITEM:bt(n,function(e){e.release()}),REMOVE_ITEM:bt(n,function(r,o,i,a){var s=function(){var t=r.id;Rt(n.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:r}),St(e,n),o(Te(r))},u=n.options.server;r.origin===ve.LOCAL&&u&&Y(u.remove)&&!1!==a.remove?(e("DID_START_ITEM_REMOVE",{id:r.id}),u.remove(r.source,function(){return s()},function(t){e("DID_THROW_ITEM_REMOVE_ERROR",{id:r.id,error:ot("error",0,t,null),status:{main:Dt(n.options.labelFileRemoveError)(t),sub:n.options.labelTapToRetry}})})):((a.revert&&r.origin!==ve.LOCAL&&null!==r.serverId||n.options.chunkUploads&&r.file.size>n.options.chunkSize||n.options.chunkUploads&&n.options.chunkForce)&&r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")),s())}),ABORT_ITEM_LOAD:bt(n,function(e){e.abortLoad()}),ABORT_ITEM_PROCESSING:bt(n,function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(function(){n.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:bt(n,function(r){if(n.options.instantUpload){var o=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:r})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return o(!0);var a=i(Te(r));return null==a?o(!0):"boolean"==typeof a?o(a):void("function"==typeof a.then&&a.then(o))}e("REVERT_ITEM_PROCESSING",{query:r})}),REVERT_ITEM_PROCESSING:bt(n,function(r){r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(function(){(n.options.instantUpload||function(e){return!ht(e.file)}(r))&&e("REMOVE_ITEM",{query:r.id})}).catch(function(){})}),SET_OPTIONS:function(t){var n=t.options,r=Object.keys(n),o=Mt.filter(function(e){return r.includes(e)});[].concat(ue(o),ue(Object.keys(n).filter(function(e){return!o.includes(e)}))).forEach(function(t){e("SET_"+Z(t,"_").toUpperCase(),{value:n[t]})})}}},Mt=["server"],wt=function(e){return e},Ct=function(e){return document.createElement(e)},Nt=function(e,t){var n=e.childNodes[0];n?t!==n.nodeValue&&(n.nodeValue=t):(n=document.createTextNode(t),e.appendChild(n))},Gt=function(e,t,n,r){var o=(r%360-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}},Ut=function(e,t,n,r,o){var i=1;return o>r&&o-r<=.5&&(i=0),r>o&&r-o>=.5&&(i=0),function(e,t,n,r,o,i){var a=Gt(e,t,n,o),s=Gt(e,t,n,r);return["M",a.x,a.y,"A",n,n,0,i,0,s.x,s.y].join(" ")}(e,t,n,360*Math.min(.9999,r),360*Math.min(.9999,o),i)},Bt=S({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,n=e.props;n.spin=!1,n.progress=0,n.opacity=0;var r=a("svg");t.ref.path=a("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(t.ref.path),t.ref.svg=r,t.appendChild(r)},write:function(e){var t=e.root,n=e.props;if(0!==n.opacity){n.align&&(t.element.dataset.align=n.align);var o=parseInt(r(t.ref.path,"stroke-width"),10),i=.5*t.rect.element.width,a=0,s=0;n.spin?(a=0,s=.5):(a=0,s=n.progress);var u=Ut(i,i,i-o,a,s);r(t.ref.path,"d",u),r(t.ref.path,"stroke-opacity",n.spin||n.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}}}}),Ft=S({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(e){var t=e.root,n=e.props;t.element.innerHTML=(n.icon||"")+""+n.label+"",n.isDisabled=!1},write:function(e){var t=e.root,n=e.props,o=n.isDisabled,i=t.query("GET_DISABLED")||0===n.opacity;i&&!o?(n.isDisabled=!0,r(t.element,"disabled","disabled")):!i&&o&&(n.isDisabled=!1,t.element.removeAttribute("disabled"))}}),qt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.labelBytes,i=void 0===o?"bytes":o,a=r.labelKilobytes,s=void 0===a?"KB":a,u=r.labelMegabytes,l=void 0===u?"MB":u,c=r.labelGigabytes,f=void 0===c?"GB":c,d=n,p=n*n,E=n*n*n;return(e=Math.round(Math.abs(e)))0&&(t.height=t.ref.container.rect.element.height)),o&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),mn=S({create:function(e){var t=e.root,n=e.props;t.ref.handleClick=function(e){return t.dispatch("DID_ACTIVATE_ITEM",{id:n.id})},t.element.id="filepond--item-"+n.id,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(fn,{id:n.id})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"item-panel"})),t.ref.panel.height=null,n.markedForRemoval=!1,t.query("GET_ALLOW_REORDER")&&(t.element.dataset.dragState="idle",t.element.addEventListener("pointerdown",function(e){if(e.isPrimary){var r=!1,o=e.pageX,i=e.pageY;n.dragOrigin={x:t.translateX,y:t.translateY},n.dragCenter={x:e.offsetX,y:e.offsetY};var a,s,u,l=(a=t.query("GET_ACTIVE_ITEMS"),s=a.map(function(e){return e.id}),u=void 0,{setIndex:function(e){u=e},getIndex:function(){return u},getItemIndex:function(e){return s.indexOf(e.id)}});t.dispatch("DID_GRAB_ITEM",{id:n.id,dragState:l});var c=function(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),n.dragOffset={x:e.pageX-o,y:e.pageY-i},n.dragOffset.x*n.dragOffset.x+n.dragOffset.y*n.dragOffset.y>16&&!r&&(r=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:n.id,dragState:l}))};document.addEventListener("pointermove",c),document.addEventListener("pointerup",function e(a){a.isPrimary&&(document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",e),n.dragOffset={x:a.pageX-o,y:a.pageY-i},t.dispatch("DID_DROP_ITEM",{id:n.id,dragState:l}),r&&setTimeout(function(){return t.element.addEventListener("click",t.ref.handleClick)},0))})}}))},write:vn,destroy:function(e){var t=e.root,n=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:n.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:_n,translateY:_n,opacity:{type:"tween",duration:150}}}}),hn=function(e,t){return Math.max(1,Math.floor((e+1)/t))},gn=function(e,t,n){if(n){var r=e.rect.element.width,o=t.length,i=null;if(0===o||n.topv){if(n.left3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=n,Date.now()>e.spawnDate&&(0===e.opacity&&yn(e,t,n,r,o),e.scaleX=1,e.scaleY=1,e.opacity=1))},yn=function(e,t,n,r,o){e.interactionMethod===re?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=n):e.interactionMethod===ee?(e.translateX=null,e.translateX=t-20*r,e.translateY=null,e.translateY=n-10*o,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===te?(e.translateY=null,e.translateY=n-30):e.interactionMethod===J&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},Dn=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},Sn=A({DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=n.id,o=n.index,i=n.interactionMethod;t.ref.addIndex=o;var a=Date.now(),s=a,u=1;if(i!==re){u=0;var l=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;s=cs&&(E=s);var _=Math.floor(s/E+1);Rn.setHeight=d*_,Rn.setWidth=p*E;var T={y:Math.floor(f/d),x:Math.floor(c/p),getGridIndex:function(){return f>Rn.getHeight||f<0||c>Rn.getWidth||c<0?u:this.y*E+this.x},getColIndex:function(){for(var e=t.query("GET_ACTIVE_ITEMS"),n=t.childViews.filter(function(e){return e.rect.element.height}),r=e.map(function(e){return n.find(function(t){return t.id===e.id})}),o=r.findIndex(function(e){return e===a}),i=Dn(a),s=r.length,u=s,l=0,c=0,d=0,p=0;pp){if(f1?T.getGridIndex():T.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:I});var v=o.getIndex();if(void 0===v||v!==I){if(o.setIndex(I),void 0===v)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:u,target:I})}}}}),An=S({create:function(e){var t=e.root;r(t.element,"role","list"),t.ref.lastItemSpanwDate=Date.now()},write:function(e){var t=e.root,n=e.props,r=e.actions,o=e.shouldOptimize;Sn({root:t,props:n,actions:r});var i=n.dragCoordinates,a=t.rect.element.width,s=t.childViews.filter(function(e){return e.rect.element.height}),u=t.query("GET_ACTIVE_ITEMS").map(function(e){return s.find(function(t){return t.id===e.id})}).filter(function(e){return e}),l=i?gn(t,u,i):null,c=t.ref.addIndex||null;t.ref.addIndex=null;var f=0,d=0,p=0;if(0!==u.length){var E=u[0].rect.element,_=E.marginTop+E.marginBottom,T=E.marginLeft+E.marginRight,I=E.width+T,v=hn(a,I);if(1===v){var m=0,h=0;u.forEach(function(e,t){if(l){var n=t-l;h=-2===n?.25*-_:-1===n?.75*-_:0===n?.75*_:1===n?.25*_:0}o&&(e.translateX=null,e.translateY=null),e.markedForRemoval||On(e,0,m+h);var r=(e.rect.element.height+_)*(e.markedForRemoval?e.opacity:1);m+=r})}else{var g=0,R=0,O=0;u.forEach(function(e,t){t===l&&(f=1),t===c&&(p+=1),e.markedForRemoval&&e.opacity<.5&&(d-=1);var n=(t+p+f+d)%v,r=e.rect.element.height+_;r>O&&(O=r);var i=n+1===v||!u[t+1],a=n*I,s=R,E=Math.sign(a-g),T=Math.sign(s-R);g=a,i&&(R+=O,O=0),e.markedForRemoval||(o&&(e.translateX=null,e.translateY=null),On(e,a,s,E,T))})}}},tag:"ul",name:"list",didWriteView:function(e){var t=e.root;t.childViews.filter(function(e){return e.markedForRemoval&&0===e.opacity&&e.resting}).forEach(function(e){e._destroy(),t.removeChildView(e)})},filterFrameActionsForChild:function(e,t){return t.filter(function(t){return!t.data||!t.data.id||e.id===t.data.id})},mixins:{apis:["dragCoordinates"]}}),Ln=A({DID_DRAG:function(e){var t=e.root,n=e.props,r=e.action;t.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(n.dragCoordinates={left:r.position.scopeLeft-t.ref.list.rect.element.left,top:r.position.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},DID_END_DRAG:function(e){e.props.dragCoordinates=null}}),bn=S({create:function(e){var t=e.root,n=e.props;t.ref.list=t.appendChildView(t.createChildView(An)),n.dragCoordinates=null,n.overflowing=!1},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Ln({root:t,props:n,actions:r}),t.ref.list.dragCoordinates=n.dragCoordinates,n.overflowing&&!n.overflow&&(n.overflowing=!1,t.element.dataset.state="",t.height=null),n.overflow){var o=Math.round(n.overflow);o!==t.height&&(n.overflowing=!0,t.element.dataset.state="overflow",t.height=o)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Pn=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";n?r(e,t,o):e.removeAttribute(t)},Mn=function(e){var t=e.root,n=e.action;t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Pn(t.element,"accept",!!n.value,n.value?n.value.join(","):"")},wn=function(e){var t=e.root,n=e.action;Pn(t.element,"multiple",n.value)},Cn=function(e){var t=e.root,n=e.action;Pn(t.element,"webkitdirectory",n.value)},Nn=function(e){var t=e.root,n=t.query("GET_DISABLED"),r=t.query("GET_ALLOW_BROWSE"),o=n||!r;Pn(t.element,"disabled",o)},Gn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Pn(t.element,"required",!0):Pn(t.element,"required",!1)},Un=function(e){var t=e.root,n=e.action;Pn(t.element,"capture",!!n.value,!0===n.value?"":n.value)},Bn=function(e){var t=e.root,n=t.element;t.query("GET_TOTAL_ITEMS")>0?(Pn(n,"required",!1),Pn(n,"name",!1)):(Pn(n,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&n.setCustomValidity(""),t.query("GET_REQUIRED")&&Pn(n,"required",!0))},Fn=S({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:function(e){var t=e.root,n=e.props;t.element.id="filepond--browser-"+n.id,r(t.element,"name",t.query("GET_NAME")),r(t.element,"aria-controls","filepond--assistant-"+n.id),r(t.element,"aria-labelledby","filepond--drop-label-"+n.id),Mn({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),wn({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),Cn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Nn({root:t}),Gn({root:t,action:{value:t.query("GET_REQUIRED")}}),Un({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var r=Array.from(t.element.files).map(function(e){return e._relativePath=e.webkitRelativePath,e});setTimeout(function(){n.onload(r),function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=Ct("form"),n=e.parentNode,r=e.nextSibling;t.appendChild(e),t.reset(),r?n.insertBefore(e,r):n.appendChild(e)}}}(t.element)},250)}},t.element.addEventListener("change",t.ref.handleChange)},destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:A({DID_LOAD_ITEM:Bn,DID_REMOVE_ITEM:Bn,DID_THROW_ITEM_INVALID:function(e){var t=e.root;t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Nn,DID_SET_ALLOW_BROWSE:Nn,DID_SET_ALLOW_DIRECTORIES_ONLY:Cn,DID_SET_ALLOW_MULTIPLE:wn,DID_SET_ACCEPTED_FILE_TYPES:Mn,DID_SET_CAPTURE_METHOD:Un,DID_SET_REQUIRED:Gn})}),qn=13,Vn=32,xn=function(e,t){e.innerHTML=t;var n=e.querySelector(".filepond--label-action");return n&&r(n,"tabindex","0"),t},Yn=S({name:"drop-label",ignoreRect:!0,create:function(e){var t=e.root,n=e.props,o=Ct("label");r(o,"for","filepond--browser-"+n.id),r(o,"id","filepond--drop-label-"+n.id),r(o,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===qn||e.keyCode===Vn)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===o||o.contains(e.target)||t.ref.label.click()},o.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),xn(o,n.caption),t.appendChild(o),t.ref.label=o},destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:A({DID_SET_LABEL_IDLE:function(e){var t=e.root,n=e.action;xn(t.ref.label,n.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),jn=S({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}}}}),kn=A({DID_DRAG:function(e){var t=e.root,n=e.action;t.ref.blob?(t.ref.blob.translateX=n.position.scopeLeft,t.ref.blob.translateY=n.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):function(e){var t=e.root,n=.5*t.rect.element.width,r=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(jn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:n,translateY:r}))}({root:t})},DID_DROP:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},DID_END_DRAG:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.opacity=0)}}),Hn=S({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:function(e){var t=e.root,n=e.props,r=e.actions;kn({root:t,props:n,actions:r});var o=t.ref.blob;0===r.length&&o&&0===o.opacity&&(t.removeChildView(o),t.ref.blob=null)}}),Xn=function(e,t){try{var n=new DataTransfer;t.forEach(function(e){e instanceof File?n.items.add(e):n.items.add(new File([e],e.name,{type:e.type}))}),e.files=n.files}catch(e){return!1}return!0},Wn=function(e,t){return e.ref.fields[t]},zn=function(e){e.query("GET_ACTIVE_ITEMS").forEach(function(t){e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Qn=function(e){var t=e.root;return zn(t)},Zn=A({DID_SET_DISABLED:function(e){var t=e.root;t.element.disabled=t.query("GET_DISABLED")},DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=!(t.query("GET_ITEM",n.id).origin===ve.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),o=Ct("input");o.type=r?"file":"hidden",o.name=t.query("GET_NAME"),o.disabled=t.query("GET_DISABLED"),t.ref.fields[n.id]=o,zn(t)},DID_LOAD_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);if(r&&(null!==n.serverFileReference&&(r.value=n.serverFileReference),t.query("SHOULD_UPDATE_FILE_INPUT"))){var o=t.query("GET_ITEM",n.id);Xn(r,[o.file])}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete t.ref.fields[n.id])},DID_DEFINE_VALUE:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(null===n.value?r.removeAttribute("value"):r.value=n.value,zn(t))},DID_PREPARE_OUTPUT:function(e){var t=e.root,n=e.action;t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(function(){var e=Wn(t,n.id);e&&Xn(e,[n.file])},0)},DID_REORDER_ITEMS:Qn,DID_SORT_ITEMS:Qn}),Kn=S({tag:"fieldset",name:"data",create:function(e){return e.root.ref.fields={}},write:Zn,ignoreRect:!0}),$n=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],Jn=["css","csv","html","txt"],er={zip:"zip|compressed",epub:"application/epub+zip"},tr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),$n.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):Jn.includes(e)?"text/"+e:er[e]||""},nr=function(e){return new Promise(function(t,n){var r=dr(e);if(r.length&&!rr(e))return t(r);or(e).then(t)})},rr=function(e){return!!e.files&&e.files.length>0},or=function(e){return new Promise(function(t,n){var r=(e.items?Array.from(e.items):[]).filter(function(e){return ir(e)}).map(function(e){return ar(e)});r.length?Promise.all(r).then(function(e){var n=[];e.forEach(function(e){n.push.apply(n,e)}),t(n.filter(function(e){return e}).map(function(e){return e._relativePath||(e._relativePath=e.webkitRelativePath),e}))}).catch(console.error):t(e.files?Array.from(e.files):[])})},ir=function(e){if(cr(e)){var t=fr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},ar=function(e){return new Promise(function(t,n){lr(e)?sr(fr(e)).then(t).catch(n):t([e.getAsFile()])})},sr=function(e){return new Promise(function(t,n){var r=[],o=0,i=0,a=function(){0===i&&0===o&&t(r)};!function e(t){o++;var s=t.createReader();!function t(){s.readEntries(function(n){if(0===n.length)return o--,void a();n.forEach(function(t){t.isDirectory?e(t):(i++,t.file(function(e){var n=ur(e);t.fullPath&&(n._relativePath=t.fullPath),r.push(n),i--,a()}))}),t()},n)}()}(e)})},ur=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,n=e.name,r=tr(ke(e.name));return r.length?((e=e.slice(0,e.size,r)).name=n,e.lastModifiedDate=t,e):e},lr=function(e){return cr(e)&&(fr(e)||{}).isDirectory},cr=function(e){return"webkitGetAsEntry"in e},fr=function(e){return e.webkitGetAsEntry()},dr=function(e){var t=[];try{if((t=Er(e)).length)return t;t=pr(e)}catch(e){}return t},pr=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},Er=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var n=t.match(/src\s*=\s*"(.+?)"/);if(n)return[n[1]]}return[]},_r=[],Tr=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},Ir=function(e){var t=_r.find(function(t){return t.element===e});if(t)return t;var n=vr(e);return _r.push(n),n},vr=function(e){var n=[],r={dragenter:Rr,dragover:Or,dragleave:Dr,drop:yr},o={};t(r,function(t,r){o[t]=r(e,n),e.addEventListener(t,o[t],!1)});var i={element:e,addListener:function(a){return n.push(a),function(){n.splice(n.indexOf(a),1),0===n.length&&(_r.splice(_r.indexOf(i),1),t(r,function(t){e.removeEventListener(t,o[t],!1)}))}}};return i},mr=function(e,t){var n,r=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)}("getRootNode"in(n=t)?n.getRootNode():document,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)},hr=null,gr=function(e,t){try{e.dropEffect=t}catch(e){}},Rr=function(e,t){return function(e){e.preventDefault(),hr=e.target,t.forEach(function(t){var n=t.element,r=t.onenter;mr(e,n)&&(t.state="enter",r(Tr(e)))})}},Or=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(r){var o=!1;t.some(function(t){var i=t.filterElement,a=t.element,s=t.onenter,u=t.onexit,l=t.ondrag,c=t.allowdrop;gr(n,"copy");var f=c(r);if(f)if(mr(e,a)){if(o=!0,null===t.state)return t.state="enter",void s(Tr(e));if(t.state="over",i&&!f)return void gr(n,"none");l(Tr(e))}else i&&!o&&gr(n,"none"),t.state&&(t.state=null,u(Tr(e)));else gr(n,"none")})})}},yr=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(n){t.forEach(function(t){var r=t.filterElement,o=t.element,i=t.ondrop,a=t.onexit,s=t.allowdrop;if(t.state=null,!r||mr(e,o))return s(n)?void i(Tr(e),n):a(Tr(e))})})}},Dr=function(e,t){return function(e){hr===e.target&&t.forEach(function(t){var n=t.onexit;t.state=null,n(Tr(e))})}},Sr=function(e,t,n){e.classList.add("filepond--hopper");var r=n.catchesDropsOnPage,o=n.requiresDropOnElement,i=n.filterItems,a=void 0===i?function(e){return e}:i,s=function(e,t,n){var r=Ir(t),o={element:e,filterElement:n,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return o.destroy=r.addListener(o),o}(e,r?document.documentElement:e,o),u="",l="";s.allowdrop=function(e){return t(a(e))},s.ondrop=function(e,n){var r=a(n);t(r)?(l="drag-drop",c.onload(r,e)):c.ondragend(e)},s.ondrag=function(e){c.ondrag(e)},s.onenter=function(e){l="drag-over",c.ondragstart(e)},s.onexit=function(e){l="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){u!==l&&(e.dataset.hopperState=l,u=l)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){s.destroy()}};return c},Ar=!1,Lr=[],br=function(e){var t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){for(var n=!1,r=t;r!==document.body;){if(r.classList.contains("filepond--root")){n=!0;break}r=r.parentNode}if(!n)return}nr(e.clipboardData).then(function(e){e.length&&Lr.forEach(function(t){return t(e)})})},Pr=function(){var e=function(e){t.onload(e)},t={destroy:function(){var t;t=e,de(Lr,Lr.indexOf(t)),0===Lr.length&&(document.removeEventListener("paste",br),Ar=!1)},onload:function(){}};return function(e){Lr.includes(e)||(Lr.push(e),Ar||(Ar=!0,document.addEventListener("paste",br)))}(e),t},Mr=null,wr=null,Cr=[],Nr=function(e,t){e.element.textContent=t},Gr=function(e,t,n){var r=e.query("GET_TOTAL_ITEMS");Nr(e,n+" "+t+", "+r+" "+(1===r?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(wr),wr=setTimeout(function(){!function(e){e.element.textContent=""}(e)},1500)},Ur=function(e){return e.element.parentNode.contains(document.activeElement)},Br=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Nr(t,r+" "+o)},Fr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename;Nr(t,n.status.main+" "+r+" "+n.status.sub)},qr=S({create:function(e){var t=e.root,n=e.props;t.element.id="filepond--assistant-"+n.id,r(t.element,"role","status"),r(t.element,"aria-live","polite"),r(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:A({DID_LOAD_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){t.element.textContent="";var r=t.query("GET_ITEM",n.id);Cr.push(r.filename),clearTimeout(Mr),Mr=setTimeout(function(){Gr(t,Cr.join(", "),t.query("GET_LABEL_FILE_ADDED")),Cr.length=0},750)}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){var r=n.item;Gr(t,r.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Nr(t,r+" "+o)},DID_ABORT_ITEM_PROCESSING:Br,DID_REVERT_ITEM_PROCESSING:Br,DID_THROW_ITEM_REMOVE_ERROR:Fr,DID_THROW_ITEM_LOAD_ERROR:Fr,DID_THROW_ITEM_INVALID:Fr,DID_THROW_ITEM_PROCESSING_ERROR:Fr}),tag:"span",name:"assistant"}),Vr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.replace(new RegExp(t+".","g"),function(e){return e.charAt(1).toUpperCase()})},xr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Date.now(),o=null;return function(){for(var i=arguments.length,a=new Array(i),s=0;sd&&(d=n),o&&(p+=d,d=0)}),t=n=p}return{visual:t,bounds:n}},Hr=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Xr=function(e,t){var n=e.query("GET_ALLOW_REPLACE"),r=e.query("GET_ALLOW_MULTIPLE"),o=e.query("GET_TOTAL_ITEMS"),i=e.query("GET_MAX_FILES"),a=t.length;return!r&&a>1||!!(V(i=r?i:n?i:1)&&o+a>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:ot("warning",0,"Max files")}),!0)},Wr=function(e,t,n){var r=e.childViews[0];return gn(r,t,{left:n.scopeLeft-r.rect.element.left,top:n.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},zr=function(e){var t=e.query("GET_ALLOW_DROP"),n=e.query("GET_DISABLED"),r=t&&!n;if(r&&!e.ref.hopper){var o=Sr(e.element,function(t){var n=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every(function(t){return ye("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(function(e){return!0===e})&&n(t)})},{filterItems:function(t){var n=e.query("GET_IGNORED_FILES");return t.filter(function(e){return!ht(e)||!n.includes(e.name.toLowerCase())})},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});o.onload=function(t,n){var r=e.ref.list.childViews[0].childViews.filter(function(e){return e.rect.element.height}),o=e.query("GET_ACTIVE_ITEMS").map(function(e){return r.find(function(t){return t.id===e.id})}).filter(function(e){return e});Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:Wr(e.ref.list,o,n),interactionMethod:ee})}),e.dispatch("DID_DROP",{position:n}),e.dispatch("DID_END_DRAG",{position:n})},o.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},o.ondrag=xr(function(t){e.dispatch("DID_DRAG",{position:t})}),o.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=o,e.ref.drip=e.appendChildView(e.createChildView(Hn))}else!r&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Qr=function(e,t){var n=e.query("GET_ALLOW_BROWSE"),r=e.query("GET_DISABLED"),o=n&&!r;o&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Fn,Object.assign({},t,{onload:function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:te})})}})),0):!o&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},Zr=function(e){var t=e.query("GET_ALLOW_PASTE"),n=e.query("GET_DISABLED"),r=t&&!n;r&&!e.ref.paster?(e.ref.paster=Pr(),e.ref.paster.onload=function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:ne})})}):!r&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Kr=A({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,n=e.props;Qr(t,n)},DID_SET_ALLOW_DROP:function(e){var t=e.root;zr(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;Zr(t)},DID_SET_DISABLED:function(e){var t=e.root,n=e.props;zr(t),Zr(t),Qr(t,n),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),$r=S({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:function(e){var t=e.root,n=e.props,r=t.query("GET_ID");r&&(t.element.id=r);var o=t.query("GET_CLASS_NAME");o&&o.split(" ").filter(function(e){return e.length}).forEach(function(e){t.element.classList.add(e)}),t.ref.label=t.appendChildView(t.createChildView(Yn,Object.assign({},n,{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(bn,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(qr,Object.assign({},n))),t.ref.data=t.appendChildView(t.createChildView(Kn,Object.assign({},n))),t.ref.measure=Ct("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(function(e){return!M(e.value)}).map(function(e){var n=e.name,r=e.value;t.element.dataset[n]=r}),t.ref.widthPrevious=null,t.ref.widthUpdated=xr(function(){t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];var i=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!i&&(t.element.addEventListener("touchmove",Yr,{passive:!1}),t.element.addEventListener("gesturestart",Yr));var s=t.query("GET_CREDITS");if(2===s.length){var u=document.createElement("a");u.className="filepond--credits",u.setAttribute("aria-hidden","true"),u.href=s[0],u.tabindex=-1,u.target="_blank",u.rel="noopener noreferrer",u.textContent=s[1],t.element.appendChild(u),t.ref.credits=u}},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Kr({root:t,props:n,actions:r}),r.filter(function(e){return/^DID_SET_STYLE_/.test(e.type)}).filter(function(e){return!M(e.data.value)}).map(function(e){var n=e.type,r=e.data,o=Vr(n.substr(8).toLowerCase(),"_");t.element.dataset[o]=r.value,t.invalidateLayout()}),!t.rect.element.hidden){t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());var o=t.ref.bounds;o||(o=t.ref.bounds=Hr(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);var i=t.ref,a=i.hopper,s=i.label,u=i.list,l=i.panel;a&&a.updateHopperState();var c=t.query("GET_PANEL_ASPECT_RATIO"),f=t.query("GET_ALLOW_MULTIPLE"),d=t.query("GET_TOTAL_ITEMS"),p=d===(f?t.query("GET_MAX_FILES")||1e6:1),E=r.find(function(e){return"DID_ADD_ITEM"===e.type});if(p&&E){var _=E.data.interactionMethod;s.opacity=0,f?s.translateY=-40:_===J?s.translateX=40:s.translateY=_===te?40:30}else p||(s.opacity=1,s.translateX=0,s.translateY=0);var T=jr(t),I=kr(t),v=s.rect.element.height,m=!f||p?0:v,h=p?u.rect.element.marginTop:0,g=0===d?0:u.rect.element.marginBottom,R=m+h+I.visual+g,O=m+h+I.bounds+g;if(u.translateY=Math.max(0,m-u.rect.element.marginTop)-T.top,c){var y=t.rect.element.width,D=y*c;c!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=c,t.ref.updateHistory=[]);var S=t.ref.updateHistory;if(S.push(y),S.length>4)for(var A=S.length,L=A-10,b=0,P=A;P>=L;P--)if(S[P]===S[P-2]&&b++,b>=2)return;l.scalable=!1,l.height=D;var w=D-m-(g-T.bottom)-(p?h:0);I.visual>w?u.overflow=w:u.overflow=null,t.height=D}else if(o.fixedHeight){l.scalable=!1;var C=o.fixedHeight-m-(g-T.bottom)-(p?h:0);I.visual>C?u.overflow=C:u.overflow=null}else if(o.cappedHeight){var N=R>=o.cappedHeight,G=Math.min(o.cappedHeight,R);l.scalable=!0,l.height=N?G:G-T.top-T.bottom;var U=G-m-(g-T.bottom)-(p?h:0);R>o.cappedHeight&&I.visual>U?u.overflow=U:u.overflow=null,t.height=Math.min(o.cappedHeight,O-T.top-T.bottom)}else{var B=d>0?T.top+T.bottom:0;l.scalable=!0,l.height=Math.max(v,R-B),t.height=Math.max(v,O-B)}t.ref.credits&&l.heightCurrent&&(t.ref.credits.style.transform="translateY("+l.heightCurrent+"px)")}},destroy:function(e){var t=e.root;t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",Yr),t.element.removeEventListener("gesturestart",Yr)},mixins:{styles:["height"]}}),Jr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null,o=Se(),i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object.assign({},e),o=[],i=[],a=function(e,t,n){!n||document.hidden?(c[e]&&c[e](t),o.push({type:e,data:t})):i.push({type:e,data:t})},s=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){y([{source:e,options:t}],{index:t.index}).then(function(e){return n(e&&e[0])}).catch(r)})},addFiles:y,getFile:function(e){return i.query("GET_ACTIVE_ITEM",e)},processFile:S,prepareFile:R,removeFile:O,moveFile:function(e,t){return i.dispatch("MOVE_ITEM",{query:e,index:t})},getFiles:D,processFiles:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n={};return t(Se(),function(e,t){n[e]=t[0]}),Jr(Object.assign({},n,{},e))},to=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[];t(e.attributes,function(t){o.push(e.attributes[t])});var i=o.filter(function(e){return e.name}).reduce(function(t,n){var o,i=r(e,n.name);return t[(o=n.name,Vr(o.replace(/^data-/,"")))]=i===n.name||i,t},{});return function e(n,r){t(r,function(r,o){t(n,function(e,t){var i=new RegExp(r);if(i.test(e)&&(delete n[e],!1!==o))if(U(o))n[o]=t;else{var a,s=o.group;H(o)&&!n[s]&&(n[s]={}),n[s][(a=e.replace(i,""),a.charAt(0).toLowerCase()+a.slice(1))]=t}}),o.mapping&&e(n[o.group],o.mapping)})}(i,n),i},no=function(){return(arguments.length<=0?void 0:arguments[0])instanceof HTMLElement?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={"^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};ye("SET_ATTRIBUTE_TO_OPTION_MAP",n);var r=Object.assign({},t),o=to("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,n);Object.keys(o).forEach(function(e){H(o[e])?(H(r[e])||(r[e]={}),Object.assign(r[e],o[e])):r[e]=o[e]}),r.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(function(e){return{source:e.value,options:{type:e.dataset.type}}}));var i=eo(r);return e.files&&Array.from(e.files).forEach(function(e){i.addFile(e)}),i.replaceElement(e),i}.apply(void 0,arguments):eo.apply(void 0,arguments)},ro=["fire","_read","_write"],oo=function(e){var t={};return Ee(e,t,ro),t},io=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,function(e,n){return t[n]})},ao=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{transfer:function(e,t){},post:function(e,t,n){var o=oe();r.onmessage=function(e){e.data.id===o&&t(e.data.message)},r.postMessage({id:o,message:e},n)},terminate:function(){r.terminate(),URL.revokeObjectURL(n)}}},so=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e})},uo=function(e,t){var n=e.slice(0,e.size,e.type);return n.lastModifiedDate=e.lastModifiedDate,n.name=t,n},lo=function(e){return uo(e,e.name)},co=[],fo=function(e){if(!co.includes(e)){co.push(e);var n,r=e({addFilter:De,utils:{Type:ge,forin:t,isString:U,isFile:ht,toNaturalFileSize:qt,replaceInString:io,getExtensionFromFilename:ke,getFilenameWithoutExtension:mt,guesstimateMimeType:tr,getFileFromBlob:We,getFilenameFromURL:je,createRoute:A,createWorker:ao,createView:S,createItemAPI:Te,loadImage:so,copyFile:lo,renameFile:uo,createBlob:ze,applyFilterChain:Oe,text:Nt,getNumericAspectRatioFromString:be},views:{fileActionButton:Ft}});n=r.options,Object.assign(Ae,n)}},po=(Kt=c()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"slice"in Blob.prototype&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window&&("supports"in(window.CSS||{})||/MSIE|Trident/.test(window.navigator.userAgent)),function(){return Kt}),Eo={apps:[]},_o=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=_o,e.destroy=_o,e.parse=_o,e.find=_o,e.registerPlugin=_o,e.getOptions=_o,e.setOptions=_o,po()){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,r="__framePainter";if(window[r])return window[r].readers.push(e),void window[r].writers.push(t);window[r]={readers:[e],writers:[t]};var o=window[r],i=1e3/n,a=null,s=null,u=null,l=null,c=function(){document.hidden?(u=function(){return window.setTimeout(function(){return f(performance.now())},i)},l=function(){return window.clearTimeout(s)}):(u=function(){return window.requestAnimationFrame(f)},l=function(){return window.cancelAnimationFrame(s)})};document.addEventListener("visibilitychange",function(){l&&l(),c(),f(performance.now())});var f=function e(t){s=u(e),a||(a=t);var n=t-a;n<=i||(a=t-n%i,o.readers.forEach(function(e){return e()}),o.writers.forEach(function(e){return e(t)}))};c(),f(performance.now())}(function(){Eo.apps.forEach(function(e){return e._read()})},function(e){Eo.apps.forEach(function(t){return t._write(e)})});var To=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:po,create:e.create,destroy:e.destroy,parse:e.parse,find:e.find,registerPlugin:e.registerPlugin,setOptions:e.setOptions}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(function(){return To()},0):document.addEventListener("DOMContentLoaded",To);var Io=function(){return t(Se(),function(t,n){e.OptionTypes[t]=n[1]})};e.Status=Object.assign({},Me),e.FileOrigin=Object.assign({},ve),e.FileStatus=Object.assign({},Ie),e.OptionTypes={},Io(),e.create=function(){var t=no.apply(void 0,arguments);return t.on("destroy",e.destroy),Eo.apps.push(t),oo(t)},e.destroy=function(e){var t=Eo.apps.findIndex(function(t){return t.isAttachedTo(e)});return t>=0&&(Eo.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll(".filepond")).filter(function(e){return!Eo.apps.find(function(t){return t.isAttachedTo(e)})}).map(function(t){return e.create(t)})},e.find=function(e){var t=Eo.apps.find(function(t){return t.isAttachedTo(e)});return t?oo(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),n=0;n Date: Thu, 16 Jun 2022 18:27:26 +0800 Subject: [PATCH 3/5] update builded files --- dist/filepond.esm.min.js | 2 +- dist/filepond.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/filepond.esm.min.js b/dist/filepond.esm.min.js index fbbb4e21..333aa1e8 100644 --- a/dist/filepond.esm.min.js +++ b/dist/filepond.esm.min.js @@ -6,4 +6,4 @@ /* eslint-disable */ -const e=(e,t)=>{for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])},t=t=>{const r={};return e(t,e=>{((e,t,r)=>{"function"!=typeof r?Object.defineProperty(e,t,{...r}):e[t]=r})(r,e,t[e])}),r},r=(e,t,r=null)=>{if(null===r)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,r)},o=["svg","path"],n=e=>o.includes(e),i=(t,o,i={})=>{"object"==typeof o&&(i=o,o=null);const s=n(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return o&&(n(t)?r(s,"class",o):s.className=o),e(i,(e,t)=>{r(s,e,t)}),s},s=e=>(t,r)=>{void 0!==r&&e.children[r]?e.insertBefore(t,e.children[r]):e.appendChild(t)},a=(e,t)=>(e,r)=>(void 0!==r?t.splice(r,0,e):t.push(e),e),l=(e,t)=>r=>(t.splice(t.indexOf(r),1),r.element.parentNode&&e.removeChild(r.element),r),c=(()=>"undefined"!=typeof window&&void 0!==window.document)(),d=()=>c,p="children"in(d()?i("svg"):{})?e=>e.children.length:e=>e.childNodes.length,E=(e,t,r,o)=>{const n=r[0]||e.left,i=r[1]||e.top,s=n+e.width,a=i+e.height*(o[1]||1),l={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:i,right:s,bottom:a}};return t.filter(e=>!e.isRectIgnored()).map(e=>e.rect).forEach(e=>{u(l.inner,{...e.inner}),u(l.outer,{...e.outer})}),_(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,_(l.outer),l},u=(e,t)=>{t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},_=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},T=e=>"number"==typeof e,I=e=>e<.5?2*e*e:(4-2*e)*e-1,f={spring:({stiffness:e=.5,damping:r=.75,mass:o=10}={})=>{let n=null,i=null,s=0,a=!1;const l=t({interpolate:(t,c)=>{if(!a)return T(n)&&T(i)?void(((e,t,r,o=.001)=>Math.abs(e-t){if(T(e)&&!T(i)&&(i=e),null===n&&(n=e,i=e),i===(n=e)||void 0===n)return a=!0,s=0,l.onupdate(i),void l.oncomplete(i);a=!1},get:()=>n},resting:{get:()=>a},onupdate:e=>{},oncomplete:e=>{}});return l},tween:({duration:e=500,easing:r=I,delay:o=0}={})=>{let n,i,s=null,a=!0,l=!1,c=null;const d=t({interpolate:(t,p)=>{a||null===c||(null===s&&(s=t),t-s=e||p?(n=1,i=l?0:1,d.onupdate(i*c),d.oncomplete(i*c),a=!0):(i=n/e,d.onupdate((n>=0?r(l?1-i:i):0)*c))))},target:{get:()=>l?0:c,set:e=>{if(null===c)return c=e,d.onupdate(e),void d.oncomplete(e);ea},onupdate:e=>{},oncomplete:e=>{}});return d}},m=(e,t,r)=>{const o=e[t]&&"object"==typeof e[t][r]?e[t][r]:e[t]||e,n="string"==typeof o?o:o.type,i="object"==typeof o?{...o}:{};return f[n]?f[n](i):null},h=(e,t,r,o=!1)=>{(t=Array.isArray(t)?t:[t]).forEach(t=>{e.forEach(e=>{let n=e,i=()=>r[e],s=t=>r[e]=t;"object"==typeof e&&(n=e.key,i=e.getter||i,s=e.setter||s),t[n]&&!o||(t[n]={get:i,set:s})})})},R=e=>null!=e,g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},O=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in t)if(t[r]!==e[r])return!0;return!1},D=(e,{opacity:t,perspective:r,translateX:o,translateY:n,scaleX:i,scaleY:s,rotateX:a,rotateY:l,rotateZ:c,originX:d,originY:p,width:E,height:u})=>{let _="",T="";(R(d)||R(p))&&(T+=`transform-origin: ${d||0}px ${p||0}px;`),R(r)&&(_+=`perspective(${r}px) `),(R(o)||R(n))&&(_+=`translate3d(${o||0}px, ${n||0}px, 0) `),(R(i)||R(s))&&(_+=`scale3d(${R(i)?i:1}, ${R(s)?s:1}, 1) `),R(c)&&(_+=`rotateZ(${c}rad) `),R(a)&&(_+=`rotateX(${a}rad) `),R(l)&&(_+=`rotateY(${l}rad) `),_.length&&(T+=`transform:${_};`),R(t)&&(T+=`opacity:${t};`,0===t&&(T+="visibility:hidden;"),t<1&&(T+="pointer-events:none;")),R(u)&&(T+=`height:${u}px;`),R(E)&&(T+=`width:${E}px;`);const I=e.elementCurrentStyle||"";T.length===I.length&&T===I||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,view:n})=>{const i={...t},s={};h(e,[r,o],t);const a=()=>n.rect?E(n.rect,n.childViews,(()=>[t.translateX||0,t.translateY||0])(),(()=>[t.scaleX||0,t.scaleY||0])()):null;return r.rect={get:a},o.rect={get:a},e.forEach(e=>{t[e]=void 0===i[e]?g[e]:i[e]}),{write:()=>{if(O(s,t))return D(n.element,t),Object.assign(s,{...t}),!0},destroy:()=>{}}},listeners:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,viewState:n,view:i})=>{const s=[],a=(e=>(t,r)=>{e.addEventListener(t,r)})(i.element),l=(e=>(t,r)=>{e.removeEventListener(t,r)})(i.element);return o.on=((e,t)=>{s.push({type:e,fn:t}),a(e,t)}),o.off=((e,t)=>{s.splice(s.findIndex(r=>r.type===e&&r.fn===t),1),l(e,t)}),{write:()=>!0,destroy:()=>{s.forEach(e=>{l(e.type,e.fn)})}}},animations:({mixinConfig:t,viewProps:r,viewInternalAPI:o,viewExternalAPI:n})=>{const i={...r},s=[];return e(t,(e,t)=>{const a=m(t);a&&(a.onupdate=(t=>{r[e]=t}),a.target=i[e],h([{key:e,setter:e=>{a.target!==e&&(a.target=e)},getter:()=>r[e]}],[o,n],r,!0),s.push(a))}),{write:e=>{let t=document.hidden,r=!0;return s.forEach(o=>{o.resting||(r=!1),o.interpolate(e,t)}),r},destroy:()=>{}}},apis:({mixinConfig:e,viewProps:t,viewExternalAPI:r})=>{h(e,r,t)}},y=(e={},t={},r={})=>(t.layoutCalculated||(e.paddingTop=parseInt(r.paddingTop,10)||0,e.marginTop=parseInt(r.marginTop,10)||0,e.marginRight=parseInt(r.marginRight,10)||0,e.marginBottom=parseInt(r.marginBottom,10)||0,e.marginLeft=parseInt(r.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e),A=({tag:e="div",name:r=null,attributes:o={},read:n=(()=>{}),write:c=(()=>{}),create:d=(()=>{}),destroy:u=(()=>{}),filterFrameActionsForChild:_=((e,t)=>t),didCreateView:T=(()=>{}),didWriteView:I=(()=>{}),ignoreRect:f=!1,ignoreRectUpdate:m=!1,mixins:h=[]}={})=>(R,g={})=>{const O=i(e,`filepond--${r}`,o),D=window.getComputedStyle(O,null),A=y();let L=null,P=!1;const v=[],M=[],b={},C={},N=[c],w=[n],G=[u],U=()=>O,B=()=>v.concat(),F=()=>L||(L=E(A,v,[0,0],[1,1])),q={element:{get:U},style:{get:()=>D},childViews:{get:B}},V={...q,rect:{get:F},ref:{get:()=>b},is:e=>r===e,appendChild:s(O),createChildView:(e=>(t,r)=>t(e,r))(R),linkView:e=>(v.push(e),e),unlinkView:e=>{v.splice(v.indexOf(e),1)},appendChildView:a(0,v),removeChildView:l(O,v),registerWriter:e=>N.push(e),registerReader:e=>w.push(e),registerDestroyer:e=>G.push(e),invalidateLayout:()=>O.layoutCalculated=!1,dispatch:R.dispatch,query:R.query},x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:()=>P},isRectIgnored:()=>f,_read:()=>{L=null,v.forEach(e=>e._read()),!(m&&A.width&&A.height)&&y(A,O,D);const e={root:H,props:g,rect:A};w.forEach(t=>t(e))},_write:(e,t,r)=>{let o=0===t.length;return N.forEach(n=>{!1===n({props:g,root:H,actions:t,timestamp:e,shouldOptimize:r})&&(o=!1)}),M.forEach(t=>{!1===t.write(e)&&(o=!1)}),v.filter(e=>!!e.element.parentNode).forEach(n=>{n._write(e,_(n,t),r)||(o=!1)}),v.forEach((n,i)=>{n.element.parentNode||(H.appendChild(n.element,i),n._read(),n._write(e,_(n,t),r),o=!1)}),P=o,I({props:g,root:H,actions:t,timestamp:e}),o},_destroy:()=>{M.forEach(e=>e.destroy()),G.forEach(e=>{e({root:H,props:g})}),v.forEach(e=>e._destroy())}},Y={...q,rect:{get:()=>A}};Object.keys(h).sort((e,t)=>"styles"===e?1:"styles"===t?-1:0).forEach(e=>{const r=S[e]({mixinConfig:h[e],viewProps:g,viewState:C,viewInternalAPI:V,viewExternalAPI:x,view:t(Y)});r&&M.push(r)});const H=t(V);d({root:H,props:g});const k=p(O);return v.forEach((e,t)=>{H.appendChild(e.element,k+t)}),T(H),t(x)},L=(e,t)=>({root:r,props:o,actions:n=[],timestamp:i,shouldOptimize:s})=>{n.filter(t=>e[t.type]).forEach(t=>e[t.type]({root:r,props:o,action:t.data,timestamp:i,shouldOptimize:s})),t&&t({root:r,props:o,actions:n,timestamp:i,shouldOptimize:s})},P=(e,t)=>t.parentNode.insertBefore(e,t),v=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),M=e=>Array.isArray(e),b=e=>null==e,C=e=>e.trim(),N=e=>""+e,w=e=>"boolean"==typeof e,G=e=>w(e)?e:"true"===e,U=e=>"string"==typeof e,B=e=>T(e)?e:U(e)?N(e).replace(/[a-z]+/gi,""):0,F=e=>parseInt(B(e),10),q=e=>parseFloat(B(e)),V=e=>T(e)&&isFinite(e)&&Math.floor(e)===e,x=(e,t=1e3)=>{if(V(e))return e;let r=N(e).trim();return/MB$/i.test(r)?(r=r.replace(/MB$i/,"").trim(),F(r)*t*t):/KB/i.test(r)?(r=r.replace(/KB$i/,"").trim(),F(r)*t):F(r)},Y=e=>"function"==typeof e,H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},k=(e,t,r,o,n)=>{if(null===t)return null;if("function"==typeof t)return t;const i={url:"GET"===r||"PATCH"===r?`?${e}=`:"",method:r,headers:n,withCredentials:!1,timeout:o,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){const e=i.headers.split(/:(.+)/);i.headers={header:e[0],value:e[1]}}return i.withCredentials=G(i.withCredentials),i},X=e=>"object"==typeof e&&null!==e,$=e=>M(e)?"array":(e=>null===e)(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":(e=>X(e)&&U(e.url)&&X(e.process)&&X(e.revert)&&X(e.restore)&&X(e.fetch))(e)?"api":typeof e,W={array:(e,t=",")=>b(e)?[]:M(e)?e:N(e).split(t).map(C).filter(e=>e.length),boolean:G,int:e=>"bytes"===$(e)?x(e):F(e),number:q,float:q,bytes:x,string:e=>Y(e)?e:N(e),function:e=>(e=>{let t=self,r=e.split("."),o=null;for(;o=r.shift();)if(!(t=t[o]))return null;return t})(e),serverapi:t=>(t=>{const r={};return r.url=U(t)?t:t.url||"",r.timeout=t.timeout?parseInt(t.timeout,10):0,r.headers=t.headers?t.headers:{},e(H,e=>{r[e]=k(e,t[e],H[e],r.timeout,r.headers)}),r.process=t.process||U(t)||t.url?r.process:null,r.remove=t.remove||null,delete r.headers,r})(t),object:e=>{try{return JSON.parse((e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))(e))}catch(e){return null}}},z=(e,t,r)=>{if(e===t)return e;let o=$(e);if(o!==r){const t=((e,t)=>W[t](e))(e,r);if(o=$(t),null===t)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;e=t}return e},j=r=>{const o={};return e(r,e=>{const t=r[e];o[e]=((e,t)=>{let r=e;return{enumerable:!0,get:()=>r,set:o=>{r=z(o,e,t)}}})(t[0],t[1])}),t(o)},Q=(e,t="-")=>e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()).join(t),Z=(t,r)=>{const o={};return e(r,e=>{o[e]={get:()=>t.getState().options[e],set:r=>{t.dispatch(`SET_${Q(e,"_").toUpperCase()}`,{value:r})}}}),o},K=t=>(r,o,n)=>{const i={};return e(t,e=>{const t=Q(e,"_").toUpperCase();i[`SET_${t}`]=(o=>{try{n.options[e]=o.value}catch(e){}r(`DID_SET_${t}`,{value:n.options[e]})})}),i},J=t=>r=>{const o={};return e(t,e=>{o[`GET_${Q(e,"_").toUpperCase()}`]=(t=>r.options[e])}),o},ee=1,te=2,re=3,oe=4,ne=5,ie=()=>Math.random().toString(36).substring(2,11),se=(e,t)=>e.splice(t,1),ae=()=>{const e=[],t=(t,r)=>{se(e,e.findIndex(e=>e.event===t&&(e.cb===r||!r)))},r=(t,r,o)=>{e.filter(e=>e.event===t).map(e=>e.cb).forEach(e=>((e,t)=>{t?e():document.hidden?Promise.resolve(1).then(e):setTimeout(e,0)})(()=>e(...r),o))};return{fireSync:(e,...t)=>{r(e,t,!0)},fire:(e,...t)=>{r(e,t,!1)},on:(t,r)=>{e.push({event:t,cb:r})},onOnce:(r,o)=>{e.push({event:r,cb:(...e)=>{t(r,o),o(...e)}})},off:t}},le=(e,t,r)=>{Object.getOwnPropertyNames(e).filter(e=>!r.includes(e)).forEach(r=>Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)))},ce=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],de=e=>{const t={};return le(e,t,ce),t},pe={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},Ee={INPUT:1,LIMBO:2,LOCAL:3},ue=e=>/[^0-9]+/.exec(e),_e=()=>ue(1.1.toLocaleString())[0],Te={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},Ie=[],fe=(e,t,r)=>new Promise((o,n)=>{const i=Ie.filter(t=>t.key===e).map(e=>e.cb);if(0===i.length)return void o(t);const s=i.shift();i.reduce((e,t)=>e.then(e=>t(e,r)),s(t,r)).then(e=>o(e)).catch(e=>n(e))}),me=(e,t,r)=>Ie.filter(t=>t.key===e).map(e=>e.cb(t,r)),he=(e,t)=>Ie.push({key:e,cb:t}),Re=()=>({...ge}),ge={id:[null,Te.STRING],name:["filepond",Te.STRING],disabled:[!1,Te.BOOLEAN],className:[null,Te.STRING],required:[!1,Te.BOOLEAN],captureMethod:[null,Te.STRING],allowSyncAcceptAttribute:[!0,Te.BOOLEAN],allowDrop:[!0,Te.BOOLEAN],allowBrowse:[!0,Te.BOOLEAN],allowPaste:[!0,Te.BOOLEAN],allowMultiple:[!1,Te.BOOLEAN],allowReplace:[!0,Te.BOOLEAN],allowRevert:[!0,Te.BOOLEAN],allowRemove:[!0,Te.BOOLEAN],allowProcess:[!0,Te.BOOLEAN],allowReorder:[!1,Te.BOOLEAN],allowDirectoriesOnly:[!1,Te.BOOLEAN],storeAsFile:[!1,Te.BOOLEAN],forceRevert:[!1,Te.BOOLEAN],maxFiles:[null,Te.INT],checkValidity:[!1,Te.BOOLEAN],itemInsertLocationFreedom:[!0,Te.BOOLEAN],itemInsertLocation:["before",Te.STRING],itemInsertInterval:[75,Te.INT],dropOnPage:[!1,Te.BOOLEAN],dropOnElement:[!0,Te.BOOLEAN],dropValidation:[!1,Te.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Te.ARRAY],instantUpload:[!0,Te.BOOLEAN],maxParallelUploads:[2,Te.INT],allowMinimumUploadDuration:[!0,Te.BOOLEAN],chunkUploads:[!1,Te.BOOLEAN],chunkForce:[!1,Te.BOOLEAN],chunkSize:[5e6,Te.INT],chunkRetryDelays:[[500,1e3,3e3],Te.ARRAY],server:[null,Te.SERVER_API],fileSizeBase:[1e3,Te.INT],labelFileSizeBytes:["bytes",Te.STRING],labelFileSizeKilobytes:["KB",Te.STRING],labelFileSizeMegabytes:["MB",Te.STRING],labelFileSizeGigabytes:["GB",Te.STRING],labelDecimalSeparator:[_e(),Te.STRING],labelThousandsSeparator:[(()=>{const e=_e(),t=1e3.toLocaleString();return t!==1e3.toString()?ue(t)[0]:"."===e?",":"."})(),Te.STRING],labelIdle:['Drag & Drop your files or Browse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],oninitfile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],beforePrepareFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],Te.ARRAY]},Oe=(e,t)=>b(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(e=>e.id===t)||null),De=e=>{if(b(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Se=e=>e.filter(e=>!e.archived),ye={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let Ae=null;const Le=[pe.LOAD_ERROR,pe.PROCESSING_ERROR,pe.PROCESSING_REVERT_ERROR],Pe=[pe.LOADING,pe.PROCESSING,pe.PROCESSING_QUEUED,pe.INIT],ve=[pe.PROCESSING_COMPLETE],Me=e=>Le.includes(e.status),be=e=>Pe.includes(e.status),Ce=e=>ve.includes(e.status),Ne=e=>X(e.options.server)&&(X(e.options.server.process)||Y(e.options.server.process)),we=e=>({GET_STATUS:()=>{const t=Se(e.items),{EMPTY:r,ERROR:o,BUSY:n,IDLE:i,READY:s}=ye;return 0===t.length?r:t.some(Me)?o:t.some(be)?n:t.some(Ce)?s:i},GET_ITEM:t=>Oe(e.items,t),GET_ACTIVE_ITEM:t=>Oe(Se(e.items),t),GET_ACTIVE_ITEMS:()=>Se(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const r=Oe(e.items,t);return r?r.filename:null},GET_ITEM_SIZE:t=>{const r=Oe(e.items,t);return r?r.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(e=>/^style/.test(e)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>{return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>Se(e.items).filter(e=>e.status===t),GET_TOTAL_ITEMS:()=>Se(e.items).length,SHOULD_UPDATE_FILE_INPUT:()=>e.options.storeAsFile&&(()=>{if(null===Ae)try{const e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));const t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,Ae=1===t.files.length}catch(e){Ae=!1}return Ae})()&&!Ne(e),IS_ASYNC:()=>Ne(e),GET_FILE_SIZE_LABELS:e=>({labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0})}),Ge=(e,t,r)=>Math.max(Math.min(r,e),t),Ue=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),Be=e=>e.split("/").pop().split("?").shift(),Fe=e=>e.split(".").pop(),qe=(e,t="")=>(t+e).slice(-t.length),Ve=(e=new Date)=>`${e.getFullYear()}-${qe(e.getMonth()+1,"00")}-${qe(e.getDate(),"00")}_${qe(e.getHours(),"00")}-${qe(e.getMinutes(),"00")}-${qe(e.getSeconds(),"00")}`,xe=(e,t,r=null,o=null)=>{const n="string"==typeof r?e.slice(0,e.size,r):e.slice(0,e.size,e.type);return n.lastModifiedDate=new Date,e._relativePath&&(n._relativePath=e._relativePath),U(t)||(t=Ve()),t&&null===o&&Fe(t)?n.name=t:(o=o||(e=>{if("string"!=typeof e)return"";const t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""})(n.type),n.name=t+(o?"."+o:"")),n},Ye=(e,t)=>{const r=(()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)();if(r){const o=new r;return o.append(e),o.getBlob(t)}return new Blob([e],{type:t})},He=e=>(/^data:(.+);/.exec(e)||[])[1]||null,ke=e=>{const t=He(e);return((e,t)=>{const r=new ArrayBuffer(e.length),o=new Uint8Array(r);for(let t=0;tatob((e=>e.split(",")[1].replace(/\s/g,""))(e)))(e),t)},Xe=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null},$e=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},We=e=>{if(/x-content-transfer-id:/i.test(e)){return(e.split(":")[1]||"").trim()||null}return null},ze=e=>{const t={source:null,name:null,size:null},r=e.split("\n");for(let e of r){const r=Xe(e);if(r){t.name=r;continue}const o=$e(e);if(o){t.size=o;continue}const n=We(e);n&&(t.source=n)}return t},je=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},r=r=>{e?(t.timestamp=Date.now(),t.request=e(r,e=>{t.duration=Date.now()-t.timestamp,t.complete=!0,e instanceof Blob&&(e=xe(e,e.name||Be(r))),o.fire("load",e instanceof Blob?e:e?e.body:null)},e=>{o.fire("error","string"==typeof e?{type:"error",code:0,body:e}:e)},(e,r,n)=>{n&&(t.size=n),t.duration=Date.now()-t.timestamp,e?(t.progress=r/n,o.fire("progress",t.progress)):t.progress=null},()=>{o.fire("abort")},e=>{const r=ze("string"==typeof e?e:e.headers);o.fire("meta",{size:t.size||r.size,filename:r.name,source:r.source})})):o.fire("error",{type:"error",body:"Can't load URL",code:400})},o={...ae(),setSource:e=>t.source=e,getProgress:()=>t.progress,abort:()=>{t.request&&t.request.abort&&t.request.abort()},load:()=>{const e=t.source;o.fire("init",e),e instanceof File?o.fire("load",e):e instanceof Blob?o.fire("load",xe(e,e.name)):Ue(e)?o.fire("load",((e,t,r)=>xe(ke(e),t,null,r))(e)):r(e)}};return o},Qe=e=>/GET|HEAD/.test(e),Ze=(e,t,r)=>{const o={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,s.abort()}};let n=!1,i=!1;r={method:"POST",headers:{},withCredentials:!1,...r},t=encodeURI(t),Qe(r.method)&&e&&(t=`${t}${encodeURIComponent("string"==typeof e?e:JSON.stringify(e))}`);const s=new XMLHttpRequest;return(Qe(r.method)?s:s.upload).onprogress=(e=>{n||o.onprogress(e.lengthComputable,e.loaded,e.total)}),s.onreadystatechange=(()=>{s.readyState<2||4===s.readyState&&0===s.status||i||(i=!0,o.onheaders(s))}),s.onload=(()=>{s.status>=200&&s.status<300?o.onload(s):o.onerror(s)}),s.onerror=(()=>o.onerror(s)),s.onabort=(()=>{n=!0,o.onabort()}),s.ontimeout=(()=>o.ontimeout(s)),s.open(r.method,t,!0),V(r.timeout)&&(s.timeout=r.timeout),Object.keys(r.headers).forEach(e=>{const t=unescape(encodeURIComponent(r.headers[e]));s.setRequestHeader(e,t)}),r.responseType&&(s.responseType=r.responseType),r.withCredentials&&(s.withCredentials=!0),s.send(e),o},Ke=(e,t,r,o)=>({type:e,code:t,body:r,headers:o}),Je=e=>t=>{e(Ke("error",0,"Timeout",t.getAllResponseHeaders()))},et=e=>/\?/.test(e),tt=(...e)=>{let t="";return e.forEach(e=>{t+=et(t)&&et(e)?e.replace(/\?/,"&"):e}),t},rt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return null;const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s,a,l,c)=>{const d=Ze(n,tt(e,t.url),{...t,responseType:"blob"});return d.onload=(e=>{const o=e.getAllResponseHeaders(),s=ze(o).name||Be(n);i(Ke("load",e.status,"HEAD"===t.method?null:xe(r(e.response),s),o))}),d.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.onheaders=(e=>{c(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),d.ontimeout=Je(s),d.onprogress=a,d.onabort=l,d}},ot=0,nt=1,it=2,st=3,at=4,lt=(e,t,r,o,n,i,s,a,l,c,d)=>{const p=[],{chunkTransferId:E,chunkServer:u,chunkSize:_,chunkRetryDelays:T}=d,I={serverId:E,aborted:!1},f=t.ondata||(e=>e),m=t.onload||((e,t)=>"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response),h=t.onerror||(e=>null),R=Math.floor(o.size/_);for(let e=0;e<=R;e++){const t=e*_,r=o.slice(t,t+_,"application/offset+octet-stream");p[e]={index:e,size:r.size,offset:t,data:r,file:o,progress:0,retries:[...T],status:ot,error:null,request:null,timeout:null}}const g=e=>e.status===ot||e.status===st,O=t=>{if(I.aborted)return;if(!(t=t||p.find(g)))return void(p.every(e=>e.status===nt)&&(()=>i(I.serverId))());t.status=it,t.progress=null;const r=u.ondata||(e=>e),n=u.onerror||(e=>null),a=tt(e,u.url,I.serverId),c="function"==typeof u.headers?u.headers(t):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":o.size,"Upload-Name":o.name},d=t.request=Ze(r(t.data),a,{...u,headers:c});d.onload=(()=>{t.status=nt,t.request=null,y()}),d.onprogress=((e,r,o)=>{t.progress=e?r:null,S()}),d.onerror=(e=>{t.status=st,t.request=null,t.error=n(e.response)||e.statusText,D(t)||s(Ke("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.ontimeout=(e=>{t.status=st,t.request=null,D(t)||Je(s)(e)}),d.onabort=(()=>{t.status=ot,t.request=null,l()})},D=e=>0!==e.retries.length&&(e.status=at,clearTimeout(e.timeout),e.timeout=setTimeout(()=>{O(e)},e.retries.shift()),!0),S=()=>{const e=p.reduce((e,t)=>null===e||null===t.progress?null:e+t.progress,0);if(null===e)return a(!1,0,0);const t=p.reduce((e,t)=>e+t.size,0);a(!0,e,t)},y=()=>{p.filter(e=>e.status===it).length>=1||O()};return I.serverId?(r=>{const o=tt(e,u.url,I.serverId),n={headers:"function"==typeof t.headers?t.headers(I.serverId):{...t.headers},method:"HEAD"},i=Ze(null,o,n);i.onload=(e=>r(m(e,n.method))),i.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),i.ontimeout=Je(s)})(e=>{I.aborted||(p.filter(t=>t.offset{e.status=nt,e.progress=e.size}),y())}):(i=>{const a=new FormData;X(n)&&a.append(r,JSON.stringify(n));const l="function"==typeof t.headers?t.headers(o,n):{...t.headers,"Upload-Length":o.size},c={...t,headers:l},d=Ze(f(a),tt(e,t.url),c);d.onload=(e=>i(m(e,c.method))),d.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),d.ontimeout=Je(s)})(e=>{I.aborted||(c(e),I.serverId=e,y())}),{abort:()=>{I.aborted=!0,p.forEach(e=>{clearTimeout(e.timeout),e.request&&e.request.abort()})}}},ct=(e="",t,r,o)=>"function"==typeof t?(...e)=>t(r,...e,o):t&&U(t.url)?((e,t,r,o)=>(n,i,s,a,l,c,d)=>{if(!n)return;const p=o.chunkUploads,E=p&&n.size>o.chunkSize,u=p&&(E||o.chunkForce);if(n instanceof Blob&&u)return lt(e,t,r,n,i,s,a,l,c,d,o);const _=t.ondata||(e=>e),T=t.onload||(e=>e),I=t.onerror||(e=>null),f="function"==typeof t.headers?t.headers(n,i)||{}:{...t.headers},m={...t,headers:f};var h=new FormData;X(i)&&h.append(r,JSON.stringify(i)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(e=>{h.append(r,e.file,null===e.name?e.file.name:`${e.name}${e.file.name}`)});const R=Ze(_(h),tt(e,t.url),m);return R.onload=(e=>{s(Ke("load",e.status,T(e.response),e.getAllResponseHeaders()))}),R.onerror=(e=>{a(Ke("error",e.status,I(e.response)||e.statusText,e.getAllResponseHeaders()))}),R.ontimeout=Je(a),R.onprogress=l,R.onabort=c,R})(e,t,r,o):null,dt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return(e,t)=>t();const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s)=>{const a=Ze(n,e+t.url,t);return a.onload=(e=>{i(Ke("load",e.status,r(e.response),e.getAllResponseHeaders()))}),a.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),a.ontimeout=Je(s),a}},pt=(e=0,t=1)=>e+Math.random()*(t-e),Et=(e,t)=>{const r={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},{allowMinimumUploadDuration:o}=t,n=()=>{r.request&&(r.perceivedPerformanceUpdater.clear(),r.request.abort&&r.request.abort(),r.complete=!0)},i=o?()=>r.progress?Math.min(r.progress,r.perceivedProgress):null:()=>r.progress||null,s=o?()=>Math.min(r.duration,r.perceivedDuration):()=>r.duration,a={...ae(),process:(t,n)=>{const i=()=>{0!==r.duration&&null!==r.progress&&a.fire("progress",a.getProgress())},s=()=>{r.complete=!0,a.fire("load-perceived",r.response.body)};a.fire("start"),r.timestamp=Date.now(),r.perceivedPerformanceUpdater=((e,t=1e3,r=0,o=25,n=250)=>{let i=null;const s=Date.now(),a=()=>{let r=Date.now()-s,l=pt(o,n);r+l>t&&(l=r+l-t);let c=r/t;c>=1||document.hidden?e(1):(e(c),i=setTimeout(a,l))};return t>0&&a(),{clear:()=>{clearTimeout(i)}}})(e=>{r.perceivedProgress=e,r.perceivedDuration=Date.now()-r.timestamp,i(),r.response&&1===r.perceivedProgress&&!r.complete&&s()},o?pt(750,1500):0),r.request=e(t,n,e=>{r.response=X(e)?e:{type:"load",code:200,body:`${e}`,headers:{}},r.duration=Date.now()-r.timestamp,r.progress=1,a.fire("load",r.response.body),(!o||o&&1===r.perceivedProgress)&&s()},e=>{r.perceivedPerformanceUpdater.clear(),a.fire("error",X(e)?e:{type:"error",code:0,body:`${e}`})},(e,t,o)=>{r.duration=Date.now()-r.timestamp,r.progress=e?t/o:null,i()},()=>{r.perceivedPerformanceUpdater.clear(),a.fire("abort",r.response?r.response.body:null)},e=>{a.fire("transfer",e)})},abort:n,getProgress:i,getDuration:s,reset:()=>{n(),r.complete=!1,r.perceivedProgress=0,r.progress=0,r.timestamp=null,r.perceivedDuration=0,r.duration=0,r.request=null,r.response=null}};return a},ut=e=>e.substring(0,e.lastIndexOf("."))||e,_t=e=>!!(e instanceof File||e instanceof Blob&&e.name),Tt=e=>{if(!X(e))return e;const t=M(e)?[]:{};for(const r in e){if(!e.hasOwnProperty(r))continue;const o=e[r];t[r]=o&&X(o)?Tt(o):o}return t},It=(e=null,r=null,o=null)=>{const n=ie(),i={archived:!1,frozen:!1,released:!1,source:null,file:o,serverFileReference:r,transferId:null,processingAborted:!1,status:r?pe.PROCESSING_COMPLETE:pe.INIT,activeLoader:null,activeProcessor:null};let s=null;const a={},l=e=>i.status=e,c=(e,...t)=>{i.released||i.frozen||E.fire(e,...t)},d=(e,t)=>{if(i.processingAborted)return void(i.processingAborted=!1);if(l(pe.PROCESSING),s=null,!(i.file instanceof Blob))return void E.on("load",()=>{d(e,t)});e.on("load",e=>{i.transferId=null,i.serverFileReference=e}),e.on("transfer",e=>{i.transferId=e}),e.on("load-perceived",e=>{i.activeProcessor=null,i.transferId=null,i.serverFileReference=e,l(pe.PROCESSING_COMPLETE),c("process-complete",e)}),e.on("start",()=>{c("process-start")}),e.on("error",e=>{i.activeProcessor=null,l(pe.PROCESSING_ERROR),c("process-error",e)}),e.on("abort",e=>{i.activeProcessor=null,i.serverFileReference=e,l(pe.IDLE),c("process-abort"),s&&s()}),e.on("progress",e=>{c("process-progress",e)});const r=console.error;t(i.file,t=>{i.archived||e.process(t,{...a})},r),i.activeProcessor=e},p=(e,t,r)=>{const o=e.split("."),n=o[0],i=o.pop();let s=a;o.forEach(e=>s=s[e]),JSON.stringify(s[i])!==JSON.stringify(t)&&(s[i]=t,c("metadata-update",{key:n,value:a[n],silent:r}))},E={id:{get:()=>n},origin:{get:()=>e,set:t=>e=t},serverId:{get:()=>i.serverFileReference},transferId:{get:()=>i.transferId},status:{get:()=>i.status},filename:{get:()=>i.file.name},filenameWithoutExtension:{get:()=>ut(i.file.name)},fileExtension:{get:()=>Fe(i.file.name)},fileType:{get:()=>i.file.type},fileSize:{get:()=>i.file.size},file:{get:()=>i.file},relativePath:{get:()=>i.file._relativePath},source:{get:()=>i.source},getMetadata:e=>Tt(e?a[e]:a),setMetadata:(e,t,r)=>{if(X(e)){const r=e;return Object.keys(r).forEach(e=>{p(e,r[e],t)}),e}return p(e,t,r),t},extend:(e,t)=>u[e]=t,abortLoad:()=>{i.activeLoader?i.activeLoader.abort():(l(pe.INIT),c("load-abort"))},retryLoad:()=>{i.activeLoader&&i.activeLoader.load()},requestProcessing:()=>{i.processingAborted=!1,l(pe.PROCESSING_QUEUED)},abortProcessing:()=>new Promise(e=>{if(!i.activeProcessor)return i.processingAborted=!0,l(pe.IDLE),c("process-abort"),void e();s=(()=>{e()}),i.activeProcessor.abort()}),load:(t,r,o)=>{i.source=t,E.fireSync("init"),i.file?E.fireSync("load-skip"):(i.file=(e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||Ue(e)?t[0]=e.name||Ve():Ue(e)?(t[1]=e.length,t[2]=He(e)):U(e)&&(t[0]=Be(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}})(t),r.on("init",()=>{c("load-init")}),r.on("meta",t=>{i.file.size=t.size,i.file.filename=t.filename,t.source&&(e=Ee.LIMBO,i.serverFileReference=t.source,i.status=pe.PROCESSING_COMPLETE),c("load-meta")}),r.on("progress",e=>{l(pe.LOADING),c("load-progress",e)}),r.on("error",e=>{l(pe.LOAD_ERROR),c("load-request-error",e)}),r.on("abort",()=>{l(pe.INIT),c("load-abort")}),r.on("load",t=>{i.activeLoader=null;const r=t=>{i.file=_t(t)?t:i.file,e===Ee.LIMBO&&i.serverFileReference?l(pe.PROCESSING_COMPLETE):l(pe.IDLE),c("load")};i.serverFileReference?r(t):o(t,r,e=>{i.file=t,c("load-meta"),l(pe.LOAD_ERROR),c("load-file-error",e)})}),r.setSource(t),i.activeLoader=r,r.load())},process:d,revert:(e,t)=>new Promise((r,o)=>{const n=null!==i.serverFileReference?i.serverFileReference:i.transferId;null!==n?(e(n,()=>{i.serverFileReference=null,i.transferId=null,r()},e=>{t?(l(pe.PROCESSING_REVERT_ERROR),c("process-revert-error"),o(e)):r()}),l(pe.IDLE),c("process-revert")):r()}),...ae(),freeze:()=>i.frozen=!0,release:()=>i.released=!0,released:{get:()=>i.released},archive:()=>i.archived=!0,archived:{get:()=>i.archived}},u=t(E);return u},ft=(e,t)=>{const r=((e,t)=>b(t)?0:U(t)?e.findIndex(e=>e.id===t):-1)(e,t);if(!(r<0))return e[r]||null},mt=(e,t,r,o,n,i)=>{const s=Ze(null,e,{method:"GET",responseType:"blob"});return s.onload=(r=>{const o=r.getAllResponseHeaders(),n=ze(o).name||Be(e);t(Ke("load",r.status,xe(r.response,n),o))}),s.onerror=(e=>{r(Ke("error",e.status,e.statusText,e.getAllResponseHeaders()))}),s.onheaders=(e=>{i(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),s.ontimeout=Je(r),s.onprogress=o,s.onabort=n,s},ht=e=>(0===e.indexOf("//")&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),Rt=e=>(...t)=>Y(e)?e(...t):e,gt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:Se(t.items)})},0)},Ot=(e,...t)=>new Promise(r=>{if(!e)return r(!0);const o=e(...t);return null==o?r(!0):"boolean"==typeof o?r(o):void("function"==typeof o.then&&o.then(r))}),Dt=(e,t)=>{e.items.sort((e,r)=>t(de(e),de(r)))},St=(e,t)=>({query:r,success:o=(()=>{}),failure:n=(()=>{}),...i}={})=>{const s=Oe(e.items,r);s?t(s,o,n,i||{}):n({error:Ke("error",0,"Item not found"),file:null})},yt=(e,t,r)=>({ABORT_ALL:()=>{Se(r.items).forEach(e=>{e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:({value:t=[]})=>{const o=t.map(e=>({source:e.source?e.source:e,options:e.options}));let n=Se(r.items);n.forEach(t=>{o.find(e=>e.source===t.source||e.source===t.file)||e("REMOVE_ITEM",{query:t,remove:!1})}),n=Se(r.items),o.forEach((t,r)=>{n.find(e=>e.source===t.source||e.file===t.source)||e("ADD_ITEM",{...t,interactionMethod:ne,index:r})})},DID_UPDATE_ITEM_METADATA:({id:o,action:n,change:i})=>{i.silent||(clearTimeout(r.itemUpdateTimeout),r.itemUpdateTimeout=setTimeout(()=>{const s=ft(r.items,o);if(!t("IS_ASYNC"))return void fe("SHOULD_PREPARE_OUTPUT",!1,{item:s,query:t,action:n,change:i}).then(r=>{const n=t("GET_BEFORE_PREPARE_FILE");n&&(r=n(s,r)),r&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:s,success:t=>{e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)});s.origin===Ee.LOCAL&&e("DID_LOAD_ITEM",{id:s.id,error:null,serverFileReference:s.source});const a=()=>{setTimeout(()=>{e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return s.status===pe.PROCESSING_COMPLETE?(e=>{s.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(e?a:()=>{}).catch(()=>{})})(r.options.instantUpload):s.status===pe.PROCESSING?(e=>{s.abortProcessing().then(e?a:()=>{})})(r.options.instantUpload):void(r.options.instantUpload&&a())},0))},MOVE_ITEM:({query:e,index:t})=>{const o=Oe(r.items,e);if(!o)return;const n=r.items.indexOf(o);n!==(t=Ge(t,0,r.items.length-1))&&r.items.splice(t,0,r.items.splice(n,1)[0])},SORT:({compare:o})=>{Dt(r,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:r,index:o,interactionMethod:n,success:i=(()=>{}),failure:s=(()=>{})})=>{let a=o;if(-1===o||void 0===o){const e=t("GET_ITEM_INSERT_LOCATION"),r=t("GET_TOTAL_ITEMS");a="before"===e?0:r}const l=t("GET_IGNORED_FILES"),c=r.filter(e=>_t(e)?!l.includes(e.name.toLowerCase()):!b(e)).map(t=>new Promise((r,o)=>{e("ADD_ITEM",{interactionMethod:n,source:t.source||t,success:r,failure:o,index:a++,options:t.options||{}})}));Promise.all(c).then(i).catch(s)},ADD_ITEM:({source:o,index:n=-1,interactionMethod:i,success:s=(()=>{}),failure:a=(()=>{}),options:l={}})=>{if(b(o))return void a({error:Ke("error",0,"No source"),file:null});if(_t(o)&&r.options.ignoredFiles.includes(o.name.toLowerCase()))return;if(!(e=>{const t=Se(e.items).length;if(!e.options.allowMultiple)return 0===t;const r=e.options.maxFiles;return null===r||t{d&&e("ADD_ITEM",{source:o,index:n,interactionMethod:i,success:s,failure:a,options:l})}).catch(()=>{}),d)return}e("REMOVE_ITEM",{query:c.id})}const c="local"===l.type?Ee.LOCAL:"limbo"===l.type?Ee.LIMBO:Ee.INPUT,d=It(c,c===Ee.INPUT?null:o,l.file);Object.keys(l.metadata||{}).forEach(e=>{d.setMetadata(e,l.metadata[e])}),me("DID_CREATE_ITEM",d,{query:t,dispatch:e});const p=t("GET_ITEM_INSERT_LOCATION");r.options.itemInsertLocationFreedom||(n="before"===p?-1:r.items.length),((e,t,r)=>b(t)?null:void 0===r?(e.push(t),t):(((e,t,r)=>e.splice(t,0,r))(e,r=Ge(r,0,e.length),t),t))(r.items,d,n),Y(p)&&o&&Dt(r,p);const E=d.id;d.on("init",()=>{e("DID_INIT_ITEM",{id:E})}),d.on("load-init",()=>{e("DID_START_ITEM_LOAD",{id:E})}),d.on("load-meta",()=>{e("DID_UPDATE_ITEM_META",{id:E})}),d.on("load-progress",t=>{e("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:E,progress:t})}),d.on("load-request-error",t=>{const o=Rt(r.options.labelFileLoadError)(t);if(t.code>=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:E,error:t,status:{main:o,sub:`${t.code} (${t.body})`}}),void a({error:t,file:de(d)});e("DID_THROW_ITEM_LOAD_ERROR",{id:E,error:t,status:{main:o,sub:r.options.labelTapToRetry}})}),d.on("load-file-error",t=>{e("DID_THROW_ITEM_INVALID",{id:E,error:t.status,status:t.status}),a({error:t.status,file:de(d)})}),d.on("load-abort",()=>{e("REMOVE_ITEM",{query:E})}),d.on("load-skip",()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}})}),d.on("load",()=>{const n=n=>{n?(d.on("metadata-update",t=>{e("DID_UPDATE_ITEM_METADATA",{id:E,change:t})}),fe("SHOULD_PREPARE_OUTPUT",!1,{item:d,query:t}).then(n=>{const i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(d,n));const a=()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}}),gt(e,r)};n?e("REQUEST_PREPARE_OUTPUT",{query:E,item:d,success:t=>{e("DID_PREPARE_OUTPUT",{id:E,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:E})};fe("DID_LOAD_ITEM",d,{query:t,dispatch:e}).then(()=>{Ot(t("GET_BEFORE_ADD_FILE"),de(d)).then(n)}).catch(t=>{if(!t||!t.error||!t.status)return n(!1);e("DID_THROW_ITEM_INVALID",{id:E,error:t.error,status:t.status})})}),d.on("process-start",()=>{e("DID_START_ITEM_PROCESSING",{id:E})}),d.on("process-progress",t=>{e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:E,progress:t})}),d.on("process-error",t=>{e("DID_THROW_ITEM_PROCESSING_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-revert-error",t=>{e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingRevertError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-complete",t=>{e("DID_COMPLETE_ITEM_PROCESSING",{id:E,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:E,value:t})}),d.on("process-abort",()=>{e("DID_ABORT_ITEM_PROCESSING",{id:E})}),d.on("process-revert",()=>{e("DID_REVERT_ITEM_PROCESSING",{id:E}),e("DID_DEFINE_VALUE",{id:E,value:null})}),e("DID_ADD_ITEM",{id:E,index:n,interactionMethod:i}),gt(e,r);const{url:u,load:_,restore:T,fetch:I}=r.options.server||{};d.load(o,je(c===Ee.INPUT?U(o)&&(e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&ht(location.href)!==ht(e))(o)&&I?rt(u,I):mt:rt(u,c===Ee.LIMBO?T:_)),(e,r,o)=>{fe("LOAD_FILE",e,{query:t}).then(r).catch(o)})},REQUEST_PREPARE_OUTPUT:({item:e,success:r,failure:o=(()=>{})})=>{const n={error:Ke("error",0,"Item not found"),file:null};if(e.archived)return o(n);fe("PREPARE_OUTPUT",e.file,{query:t,item:e}).then(i=>{fe("COMPLETE_PREPARE_OUTPUT",i,{query:t,item:e}).then(t=>{if(e.archived)return o(n);r(t)})})},COMPLETE_LOAD_ITEM:({item:o,data:n})=>{const{success:i,source:s}=n,a=t("GET_ITEM_INSERT_LOCATION");if(Y(a)&&s&&Dt(r,a),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===Ee.INPUT?null:s}),i(de(o)),o.origin!==Ee.LOCAL)return o.origin===Ee.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&r.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:St(r,e=>{e.retryLoad()}),REQUEST_ITEM_PREPARE:St(r,(t,r,o)=>{e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:o=>{e("DID_PREPARE_OUTPUT",{id:t.id,file:o}),r({file:t,output:o})},failure:o},!0)}),REQUEST_ITEM_PROCESSING:St(r,(o,n,i)=>{if(o.status===pe.IDLE||o.status===pe.PROCESSING_ERROR)o.status!==pe.PROCESSING_QUEUED&&(o.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:o.id}),e("PROCESS_ITEM",{query:o,success:n,failure:i},!0));else{const s=()=>e("REQUEST_ITEM_PROCESSING",{query:o,success:n,failure:i}),a=()=>document.hidden?s():setTimeout(s,32);o.status===pe.PROCESSING_COMPLETE||o.status===pe.PROCESSING_REVERT_ERROR?o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(a).catch(()=>{}):o.status===pe.PROCESSING&&o.abortProcessing().then(a)}}),PROCESS_ITEM:St(r,(o,n,i)=>{const s=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",pe.PROCESSING).length===s)return void r.processingQueue.push({id:o.id,success:n,failure:i});if(o.status===pe.PROCESSING)return;const a=()=>{const t=r.processingQueue.shift();if(!t)return;const{id:o,success:n,failure:i}=t,s=Oe(r.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:n,failure:i},!0):a()};o.onOnce("process-complete",()=>{n(de(o)),a();const i=r.options.server;if(r.options.instantUpload&&o.origin===Ee.LOCAL&&Y(i.remove)){const e=()=>{};o.origin=Ee.LIMBO,r.options.server.remove(o.source,e,e)}t("GET_ITEMS_BY_STATUS",pe.PROCESSING_COMPLETE).length===r.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),o.onOnce("process-error",e=>{i({error:e,file:de(o)}),a()});const l=r.options;o.process(Et(ct(l.server.url,l.server.process,l.name,{chunkTransferId:o.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),(r,n,i)=>{fe("PREPARE_OUTPUT",r,{query:t,item:o}).then(t=>{e("DID_PREPARE_OUTPUT",{id:o.id,file:t}),n(t)}).catch(i)})}),RETRY_ITEM_PROCESSING:St(r,t=>{e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:St(r,r=>{Ot(t("GET_BEFORE_REMOVE_FILE"),de(r)).then(t=>{t&&e("REMOVE_ITEM",{query:r})})}),RELEASE_ITEM:St(r,e=>{e.release()}),REMOVE_ITEM:St(r,(o,n,i,s)=>{const a=()=>{const t=o.id;ft(r.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:o}),gt(e,r),n(de(o))},l=r.options.server;o.origin===Ee.LOCAL&&l&&Y(l.remove)&&!1!==s.remove?(e("DID_START_ITEM_REMOVE",{id:o.id}),l.remove(o.source,()=>a(),t=>{e("DID_THROW_ITEM_REMOVE_ERROR",{id:o.id,error:Ke("error",0,t,null),status:{main:Rt(r.options.labelFileRemoveError)(t),sub:r.options.labelTapToRetry}})})):((s.revert&&o.origin!==Ee.LOCAL&&null!==o.serverId||r.options.chunkUploads&&o.file.size>r.options.chunkSize||r.options.chunkUploads&&r.options.chunkForce)&&o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")),a())}),ABORT_ITEM_LOAD:St(r,e=>{e.abortLoad()}),ABORT_ITEM_PROCESSING:St(r,t=>{t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(()=>{r.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:St(r,o=>{if(!r.options.instantUpload)return void e("REVERT_ITEM_PROCESSING",{query:o});const n=t=>{t&&e("REVERT_ITEM_PROCESSING",{query:o})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return n(!0);const s=i(de(o));return null==s?n(!0):"boolean"==typeof s?n(s):void("function"==typeof s.then&&s.then(n))}),REVERT_ITEM_PROCESSING:St(r,o=>{o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(()=>{(r.options.instantUpload||(e=>!_t(e.file))(o))&&e("REMOVE_ITEM",{query:o.id})}).catch(()=>{})}),SET_OPTIONS:({options:t})=>{const r=Object.keys(t),o=At.filter(e=>r.includes(e));[...o,...Object.keys(t).filter(e=>!o.includes(e))].forEach(r=>{e(`SET_${Q(r,"_").toUpperCase()}`,{value:t[r]})})}}),At=["server"],Lt=e=>e,Pt=e=>document.createElement(e),vt=(e,t)=>{let r=e.childNodes[0];r?t!==r.nodeValue&&(r.nodeValue=t):(r=document.createTextNode(t),e.appendChild(r))},Mt=(e,t,r,o)=>{const n=(o%360-90)*Math.PI/180;return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}},bt=(e,t,r,o,n)=>{let i=1;return n>o&&n-o<=.5&&(i=0),o>n&&o-n>=.5&&(i=0),((e,t,r,o,n,i)=>{const s=Mt(e,t,r,n),a=Mt(e,t,r,o);return["M",s.x,s.y,"A",r,r,0,i,0,a.x,a.y].join(" ")})(e,t,r,360*Math.min(.9999,o),360*Math.min(.9999,n),i)},Ct=A({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:({root:e,props:t})=>{t.spin=!1,t.progress=0,t.opacity=0;const r=i("svg");e.ref.path=i("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(e.ref.path),e.ref.svg=r,e.appendChild(r)},write:({root:e,props:t})=>{if(0===t.opacity)return;t.align&&(e.element.dataset.align=t.align);const o=parseInt(r(e.ref.path,"stroke-width"),10),n=.5*e.rect.element.width;let i=0,s=0;t.spin?(i=0,s=.5):(i=0,s=t.progress);const a=bt(n,n,n-o,i,s);r(e.ref.path,"d",a),r(e.ref.path,"stroke-opacity",t.spin||t.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}}}}),Nt=A({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:({root:e,props:t})=>{e.element.innerHTML=(t.icon||"")+`${t.label}`,t.isDisabled=!1},write:({root:e,props:t})=>{const{isDisabled:o}=t,n=e.query("GET_DISABLED")||0===t.opacity;n&&!o?(t.isDisabled=!0,r(e.element,"disabled","disabled")):!n&&o&&(t.isDisabled=!1,e.element.removeAttribute("disabled"))}}),wt=(e,t=".",r=1e3,o={})=>{const{labelBytes:n="bytes",labelKilobytes:i="KB",labelMegabytes:s="MB",labelGigabytes:a="GB"}=o,l=r,c=r*r,d=r*r*r;return(e=Math.round(Math.abs(e)))e.toFixed(t).split(".").filter(e=>"0"!==e).join(r),Ut=({root:e,props:t})=>{vt(e.ref.fileSize,wt(e.query("GET_ITEM_SIZE",t.id),".",e.query("GET_FILE_SIZE_BASE"),e.query("GET_FILE_SIZE_LABELS",e.query))),vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))},Bt=({root:e,props:t})=>{V(e.query("GET_ITEM_SIZE",t.id))?Ut({root:e,props:t}):vt(e.ref.fileSize,e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},Ft=A({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:Ut,DID_UPDATE_ITEM_META:Ut,DID_THROW_ITEM_LOAD_ERROR:Bt,DID_THROW_ITEM_INVALID:Bt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e,props:t})=>{const o=Pt("span");o.className="filepond--file-info-main",r(o,"aria-hidden","true"),e.appendChild(o),e.ref.fileName=o;const n=Pt("span");n.className="filepond--file-info-sub",e.appendChild(n),e.ref.fileSize=n,vt(n,e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),vt(o,Lt(e.query("GET_ITEM_NAME",t.id)))},mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),qt=e=>Math.round(100*e),Vt=({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_LOADING"):`${e.query("GET_LABEL_FILE_LOADING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},xt=({root:e})=>{vt(e.ref.main,""),vt(e.ref.sub,"")},Yt=({root:e,action:t})=>{vt(e.ref.main,t.status.main),vt(e.ref.sub,t.status.sub)},Ht=A({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:xt,DID_REVERT_ITEM_PROCESSING:xt,DID_REQUEST_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_ABORTED")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_PROCESSING"):`${e.query("GET_LABEL_FILE_PROCESSING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:Vt,DID_THROW_ITEM_LOAD_ERROR:Yt,DID_THROW_ITEM_INVALID:Yt,DID_THROW_ITEM_PROCESSING_ERROR:Yt,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Yt,DID_THROW_ITEM_REMOVE_ERROR:Yt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e})=>{const t=Pt("span");t.className="filepond--file-status-main",e.appendChild(t),e.ref.main=t;const r=Pt("span");r.className="filepond--file-status-sub",e.appendChild(r),e.ref.sub=r,Vt({root:e,action:{progress:null}})},mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),kt={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"}},Xt=[];e(kt,e=>{Xt.push(e)});const $t=e=>{if("right"===Qt(e))return 0;const t=e.ref.buttonRemoveItem.rect.element;return t.hidden?null:t.width+t.left},Wt=e=>{return e.ref.buttonAbortItemLoad.rect.element.width},zt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.height/4),jt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.left/2),Qt=e=>e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Zt={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:e=>e.query("GET_STYLE_LOAD_INDICATOR_POSITION")},processProgressIndicator:{opacity:0,align:e=>e.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}},Kt={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},Jt={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},er={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t,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:$t},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:Qt},info:{translateX:$t},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:Qt},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1,translateX:$t}},DID_LOAD_ITEM:Kt,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},DID_START_ITEM_PROCESSING:Jt,DID_REQUEST_ITEM_PROCESSING:Jt,DID_UPDATE_ITEM_PROCESS_PROGRESS:Jt,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:$t}},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:$t},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:Kt},tr=A({create:({root:e})=>{e.element.innerHTML=e.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}}}}),rr=L({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:e,action:t})=>{e.ref.buttonAbortItemProcessing.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:e,action:t})=>{e.ref.buttonAbortItemLoad.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:e,action:t})=>{e.ref.buttonAbortItemRemoval.label=t.value},DID_REQUEST_ITEM_PROCESSING:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:e})=>{e.ref.loadProgressIndicator.spin=!0,e.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:e,action:t})=>{e.ref.loadProgressIndicator.spin=!1,e.ref.loadProgressIndicator.progress=t.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{e.ref.processProgressIndicator.spin=!1,e.ref.processProgressIndicator.progress=t.progress}}),or=A({create:({root:t,props:r})=>{const o=Object.keys(kt).reduce((e,t)=>(e[t]={...kt[t]},e),{}),{id:n}=r,i=t.query("GET_ALLOW_REVERT"),s=t.query("GET_ALLOW_REMOVE"),a=t.query("GET_ALLOW_PROCESS"),l=t.query("GET_INSTANT_UPLOAD"),c=t.query("IS_ASYNC"),d=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");let p;c?a&&!i?p=(e=>!/RevertItemProcessing/.test(e)):!a&&i?p=(e=>!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(e)):a||i||(p=(e=>!/Process/.test(e))):p=(e=>!/Process/.test(e));const E=p?Xt.filter(p):Xt.concat();if(l&&i&&(o.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",o.RevertItemProcessing.icon="GET_ICON_REMOVE"),c&&!i){const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=jt,e.info.translateY=zt,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(c&&!a&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach(e=>{er[e].status.translateY=zt}),er.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=Wt),d&&i){o.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=$t,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}s||(o.RemoveItem.disabled=!0),e(o,(e,r)=>{const o=t.createChildView(Nt,{label:t.query(r.label),icon:t.query(r.icon),opacity:0});E.includes(e)&&t.appendChildView(o),r.disabled&&(o.element.setAttribute("disabled","disabled"),o.element.setAttribute("hidden","hidden")),o.element.dataset.align=t.query(`GET_STYLE_${r.align}`),o.element.classList.add(r.className),o.on("click",e=>{e.stopPropagation(),r.disabled||t.dispatch(r.action,{query:n})}),t.ref[`button${e}`]=o}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(tr)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(Ft,{id:n})),t.ref.status=t.appendChildView(t.createChildView(Ht,{id:n}));const u=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));u.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=u;const _=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));_.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=_,t.ref.activeStyles=[]},write:({root:t,actions:r,props:o})=>{rr({root:t,actions:r,props:o});let n=r.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>er[e.type]);if(n){t.ref.activeStyles=[];const r=er[n.type];e(Zt,(o,n)=>{const i=t.ref[o];e(n,(e,n)=>{const s=r[o]&&void 0!==r[o][e]?r[o][e]:n;t.ref.activeStyles.push({control:i,key:e,value:s})})})}t.ref.activeStyles.forEach(({control:e,key:r,value:o})=>{e[r]="function"==typeof o?o(t):o})},didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},name:"file"}),nr=A({create:({root:e,props:t})=>{e.ref.fileName=Pt("legend"),e.appendChild(e.ref.fileName),e.ref.file=e.appendChildView(e.createChildView(or,{id:t.id})),e.ref.data=!1},ignoreRect:!0,write:L({DID_LOAD_ITEM:({root:e,props:t})=>{vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))}}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},tag:"fieldset",name:"file-wrapper"}),ir={type:"spring",damping:.6,mass:7},sr=(e,t,r)=>{const o=A({name:`panel-${t.name} filepond--${r}`,mixins:t.mixins,ignoreRectUpdate:!0}),n=e.createChildView(o,t.props);e.ref[t.name]=e.appendChildView(n)},ar=A({name:"panel",read:({root:e,props:t})=>t.heightCurrent=e.ref.bottom.translateY,write:({root:e,props:t})=>{if(null!==e.ref.scalable&&t.scalable===e.ref.scalable||(e.ref.scalable=!w(t.scalable)||t.scalable,e.element.dataset.scalable=e.ref.scalable),!t.height)return;const r=e.ref.top.rect.element,o=e.ref.bottom.rect.element,n=Math.max(r.height+o.height,t.height);e.ref.center.translateY=r.height,e.ref.center.scaleY=(n-r.height-o.height)/100,e.ref.bottom.translateY=n-o.height},create:({root:e,props:t})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:ir},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:ir},styles:["translateY"]}}].forEach(r=>{sr(e,r,t.name)}),e.element.classList.add(`filepond--${t.name}`),e.ref.scalable=null},ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),lr={type:"spring",stiffness:.75,damping:.45,mass:10},cr={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"},dr=L({DID_UPDATE_PANEL_HEIGHT:({root:e,action:t})=>{e.height=t.height}}),pr=L({DID_GRAB_ITEM:({root:e,props:t})=>{t.dragOrigin={x:e.translateX,y:e.translateY}},DID_DRAG_ITEM:({root:e})=>{e.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:e,props:t})=>{t.dragOffset=null,t.dragOrigin=null,e.element.dataset.dragState="drop"}},({root:e,actions:t,props:r,shouldOptimize:o})=>{"drop"===e.element.dataset.dragState&&e.scaleX<=1&&(e.element.dataset.dragState="idle");let n=t.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>cr[e.type]);n&&n.type!==r.currentState&&(r.currentState=n.type,e.element.dataset.filepondItemState=cr[r.currentState]||"");const i=e.query("GET_ITEM_PANEL_ASPECT_RATIO")||e.query("GET_PANEL_ASPECT_RATIO");i?o||(e.height=e.rect.element.width*i):(dr({root:e,actions:t,props:r}),!e.height&&e.ref.container.rect.element.height>0&&(e.height=e.ref.container.rect.element.height)),o&&(e.ref.panel.height=null),e.ref.panel.height=e.height}),Er=A({create:({root:e,props:t})=>{if(e.ref.handleClick=(r=>e.dispatch("DID_ACTIVATE_ITEM",{id:t.id})),e.element.id=`filepond--item-${t.id}`,e.element.addEventListener("click",e.ref.handleClick),e.ref.container=e.appendChildView(e.createChildView(nr,{id:t.id})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"item-panel"})),e.ref.panel.height=null,t.markedForRemoval=!1,!e.query("GET_ALLOW_REORDER"))return;e.element.dataset.dragState="idle";e.element.addEventListener("pointerdown",r=>{if(!r.isPrimary)return;let o=!1;const n=r.pageX,i=r.pageY;t.dragOrigin={x:e.translateX,y:e.translateY},t.dragCenter={x:r.offsetX,y:r.offsetY};const s=(e=>{const t=e.map(e=>e.id);let r=void 0;return{setIndex:e=>{r=e},getIndex:()=>r,getItemIndex:e=>t.indexOf(e.id)}})(e.query("GET_ACTIVE_ITEMS"));e.dispatch("DID_GRAB_ITEM",{id:t.id,dragState:s});const a=r=>{r.isPrimary&&(r.stopPropagation(),r.preventDefault(),t.dragOffset={x:r.pageX-n,y:r.pageY-i},t.dragOffset.x*t.dragOffset.x+t.dragOffset.y*t.dragOffset.y>16&&!o&&(o=!0,e.element.removeEventListener("click",e.ref.handleClick)),e.dispatch("DID_DRAG_ITEM",{id:t.id,dragState:s}))},l=r=>{r.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",l),t.dragOffset={x:r.pageX-n,y:r.pageY-i},e.dispatch("DID_DROP_ITEM",{id:t.id,dragState:s}),o&&setTimeout(()=>e.element.addEventListener("click",e.ref.handleClick),0))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",l)})},write:pr,destroy:({root:e,props:t})=>{e.element.removeEventListener("click",e.ref.handleClick),e.dispatch("RELEASE_ITEM",{query:t.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:lr,translateY:lr,opacity:{type:"tween",duration:150}}}});var ur=(e,t)=>Math.max(1,Math.floor((e+1)/t));const _r=(e,t,r)=>{if(!r)return;const o=e.rect.element.width,n=t.length;let i=null;if(0===n||r.topa){if(r.left{e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=r,Date.now()>e.spawnDate&&(0===e.opacity&&fr(e,t,r,o,n),e.scaleX=1,e.scaleY=1,e.opacity=1))},fr=(e,t,r,o,n)=>{e.interactionMethod===ne?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=r):e.interactionMethod===te?(e.translateX=null,e.translateX=t-20*o,e.translateY=null,e.translateY=r-10*n,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=r-30):e.interactionMethod===ee&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},mr=e=>e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop,hr=L({DID_ADD_ITEM:({root:e,action:t})=>{const{id:r,index:o,interactionMethod:n}=t;e.ref.addIndex=o;const i=Date.now();let s=i,a=1;if(n!==ne){a=0;const t=e.query("GET_ITEM_INSERT_INTERVAL"),r=i-e.ref.lastItemSpanwDate;s=r{const{id:r}=t,o=e.childViews.find(e=>e.id===r);o&&(o.scaleX=.9,o.scaleY=.9,o.opacity=0,o.markedForRemoval=!0)},DID_DRAG_ITEM:({root:e,action:t})=>{const{id:r,dragState:o}=t,n=e.query("GET_ITEM",{id:r}),i=e.childViews.find(e=>e.id===r),s=e.childViews.length,a=o.getItemIndex(n);if(!i)return;const l=i.dragOrigin.x+i.dragOffset.x+i.dragCenter.x,c=i.dragOrigin.y+i.dragOffset.y+i.dragCenter.y,d=mr(i),p=(e=>e.rect.element.width+.5*e.rect.element.marginLeft+.5*e.rect.element.marginRight)(i);let E=Math.floor(e.rect.outer.width/p);E>s&&(E=s);const u=Math.floor(s/E+1);Tr.setHeight=d*u,Tr.setWidth=p*E;var _={y:Math.floor(c/d),x:Math.floor(l/p),getGridIndex:function(){return c>Tr.getHeight||c<0||l>Tr.getWidth||l<0?a:this.y*E+this.x},getColIndex:function(){const t=e.query("GET_ACTIVE_ITEMS"),r=e.childViews.filter(e=>e.rect.element.height),o=t.map(e=>r.find(t=>t.id===e.id)),n=o.findIndex(e=>e===i),s=mr(i),a=o.length;let l=a,d=0,p=0,E=0;for(let e=0;ee){if(c1?_.getGridIndex():_.getColIndex();e.dispatch("MOVE_ITEM",{query:i,index:T});const I=o.getIndex();if(void 0===I||I!==T){if(o.setIndex(T),void 0===I)return;e.dispatch("DID_REORDER_ITEMS",{items:e.query("GET_ACTIVE_ITEMS"),origin:a,target:T})}}}),Rr=A({create:({root:e})=>{r(e.element,"role","list"),e.ref.lastItemSpanwDate=Date.now()},write:({root:e,props:t,actions:r,shouldOptimize:o})=>{hr({root:e,props:t,actions:r});const{dragCoordinates:n}=t,i=e.rect.element.width,s=e.childViews.filter(e=>e.rect.element.height),a=e.query("GET_ACTIVE_ITEMS").map(e=>s.find(t=>t.id===e.id)).filter(e=>e),l=n?_r(e,a,n):null,c=e.ref.addIndex||null;e.ref.addIndex=null;let d=0,p=0,E=0;if(0===a.length)return;const u=a[0].rect.element,_=u.marginTop+u.marginBottom,T=u.marginLeft+u.marginRight,I=u.width+T,f=u.height+_,m=ur(i,I);if(1===m){let e=0,t=0;a.forEach((r,n)=>{if(l){let e=n-l;t=-2===e?.25*-_:-1===e?.75*-_:0===e?.75*_:1===e?.25*_:0}o&&(r.translateX=null,r.translateY=null),r.markedForRemoval||Ir(r,0,e+t);let i=(r.rect.element.height+_)*(r.markedForRemoval?r.opacity:1);e+=i})}else{let e=0,t=0;a.forEach((r,n)=>{n===l&&(d=1),n===c&&(E+=1),r.markedForRemoval&&r.opacity<.5&&(p-=1);const i=n+E+d+p,s=i%m,a=Math.floor(i/m),u=s*I,_=a*f,T=Math.sign(u-e),h=Math.sign(_-t);e=u,t=_,r.markedForRemoval||(o&&(r.translateX=null,r.translateY=null),Ir(r,u,_,T,h))})}},tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(e=>e.markedForRemoval&&0===e.opacity&&e.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:(e,t)=>t.filter(t=>!t.data||!t.data.id||e.id===t.data.id),mixins:{apis:["dragCoordinates"]}}),gr=L({DID_DRAG:({root:e,props:t,action:r})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:r.position.scopeLeft-e.ref.list.rect.element.left,top:r.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},DID_END_DRAG:({props:e})=>{e.dragCoordinates=null}}),Or=A({create:({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(Rr)),t.dragCoordinates=null,t.overflowing=!1},write:({root:e,props:t,actions:r})=>{if(gr({root:e,props:t,actions:r}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){const r=Math.round(t.overflow);r!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Dr=(e,t,o,n="")=>{o?r(e,t,n):e.removeAttribute(t)},Sr=({root:e,action:t})=>{e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Dr(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},yr=({root:e,action:t})=>{Dr(e.element,"multiple",t.value)},Ar=({root:e,action:t})=>{Dr(e.element,"webkitdirectory",t.value)},Lr=({root:e})=>{const t=e.query("GET_DISABLED"),r=e.query("GET_ALLOW_BROWSE"),o=t||!r;Dr(e.element,"disabled",o)},Pr=({root:e,action:t})=>{t.value?0===e.query("GET_TOTAL_ITEMS")&&Dr(e.element,"required",!0):Dr(e.element,"required",!1)},vr=({root:e,action:t})=>{Dr(e.element,"capture",!!t.value,!0===t.value?"":t.value)},Mr=({root:e})=>{const{element:t}=e;if(e.query("GET_TOTAL_ITEMS")>0)Dr(t,"required",!1),Dr(t,"name",!1);else{Dr(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&Dr(t,"required",!0)}},br=A({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,r(e.element,"name",e.query("GET_NAME")),r(e.element,"aria-controls",`filepond--assistant-${t.id}`),r(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),Sr({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),yr({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Ar({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Lr({root:e}),Pr({root:e,action:{value:e.query("GET_REQUIRED")}}),vr({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=(r=>{if(!e.element.value)return;const o=Array.from(e.element.files).map(e=>(e._relativePath=e.webkitRelativePath,e));setTimeout(()=>{t.onload(o),(e=>{if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){const t=Pt("form"),r=e.parentNode,o=e.nextSibling;t.appendChild(e),t.reset(),o?r.insertBefore(e,o):r.appendChild(e)}}})(e.element)},250)}),e.element.addEventListener("change",e.ref.handleChange)},destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:L({DID_LOAD_ITEM:Mr,DID_REMOVE_ITEM:Mr,DID_THROW_ITEM_INVALID:({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Lr,DID_SET_ALLOW_BROWSE:Lr,DID_SET_ALLOW_DIRECTORIES_ONLY:Ar,DID_SET_ALLOW_MULTIPLE:yr,DID_SET_ACCEPTED_FILE_TYPES:Sr,DID_SET_CAPTURE_METHOD:vr,DID_SET_REQUIRED:Pr})}),Cr=13,Nr=32,wr=(e,t)=>{e.innerHTML=t;const o=e.querySelector(".filepond--label-action");return o&&r(o,"tabindex","0"),t},Gr=A({name:"drop-label",ignoreRect:!0,create:({root:e,props:t})=>{const o=Pt("label");r(o,"for",`filepond--browser-${t.id}`),r(o,"id",`filepond--drop-label-${t.id}`),r(o,"aria-hidden","true"),e.ref.handleKeyDown=(t=>{(t.keyCode===Cr||t.keyCode===Nr)&&(t.preventDefault(),e.ref.label.click())}),e.ref.handleClick=(t=>{t.target===o||o.contains(t.target)||e.ref.label.click()}),o.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),wr(o,t.caption),e.appendChild(o),e.ref.label=o},destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:L({DID_SET_LABEL_IDLE:({root:e,action:t})=>{wr(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Ur=A({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}}}}),Br=L({DID_DRAG:({root:e,action:t})=>{e.ref.blob?(e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1):(({root:e})=>{const t=.5*e.rect.element.width,r=.5*e.rect.element.height;e.ref.blob=e.appendChildView(e.createChildView(Ur,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:r}))})({root:e})},DID_DROP:({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},DID_END_DRAG:({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)}}),Fr=A({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:({root:e,props:t,actions:r})=>{Br({root:e,props:t,actions:r});const{blob:o}=e.ref;0===r.length&&o&&0===o.opacity&&(e.removeChildView(o),e.ref.blob=null)}}),qr=(e,t)=>{try{const r=new DataTransfer;t.forEach(e=>{e instanceof File?r.items.add(e):r.items.add(new File([e],e.name,{type:e.type}))}),e.files=r.files}catch(e){return!1}return!0},Vr=(e,t)=>e.ref.fields[t],xr=e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Yr=({root:e})=>xr(e),Hr=L({DID_SET_DISABLED:({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},DID_ADD_ITEM:({root:e,action:t})=>{const r=!(e.query("GET_ITEM",t.id).origin===Ee.LOCAL)&&e.query("SHOULD_UPDATE_FILE_INPUT"),o=Pt("input");o.type=r?"file":"hidden",o.name=e.query("GET_NAME"),o.disabled=e.query("GET_DISABLED"),e.ref.fields[t.id]=o,xr(e)},DID_LOAD_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);if(!r)return;if(null!==t.serverFileReference&&(r.value=t.serverFileReference),!e.query("SHOULD_UPDATE_FILE_INPUT"))return;const o=e.query("GET_ITEM",t.id);qr(r,[o.file])},DID_REMOVE_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete e.ref.fields[t.id])},DID_DEFINE_VALUE:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(null===t.value?r.removeAttribute("value"):r.value=t.value,xr(e))},DID_PREPARE_OUTPUT:({root:e,action:t})=>{e.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{const r=Vr(e,t.id);r&&qr(r,[t.file])},0)},DID_REORDER_ITEMS:Yr,DID_SORT_ITEMS:Yr}),kr=A({tag:"fieldset",name:"data",create:({root:e})=>e.ref.fields={},write:Hr,ignoreRect:!0}),Xr=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],$r=["css","csv","html","txt"],Wr={zip:"zip|compressed",epub:"application/epub+zip"},zr=(e="")=>(e=e.toLowerCase(),Xr.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):$r.includes(e)?"text/"+e:Wr[e]||""),jr=e=>new Promise((t,r)=>{const o=io(e);if(o.length&&!Qr(e))return t(o);Zr(e).then(t)}),Qr=e=>!!e.files&&e.files.length>0,Zr=e=>new Promise((t,r)=>{const o=(e.items?Array.from(e.items):[]).filter(e=>Kr(e)).map(e=>Jr(e));o.length?Promise.all(o).then(e=>{const r=[];e.forEach(e=>{r.push.apply(r,e)}),t(r.filter(e=>e).map(e=>(e._relativePath||(e._relativePath=e.webkitRelativePath),e)))}).catch(console.error):t(e.files?Array.from(e.files):[])}),Kr=e=>{if(oo(e)){const t=no(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},Jr=e=>new Promise((t,r)=>{ro(e)?eo(no(e)).then(t).catch(r):t([e.getAsFile()])}),eo=e=>new Promise((t,r)=>{const o=[];let n=0,i=0;const s=()=>{0===i&&0===n&&t(o)},a=e=>{n++;const t=e.createReader(),l=()=>{t.readEntries(e=>{if(0===e.length)return n--,void s();e.forEach(e=>{e.isDirectory?a(e):(i++,e.file(t=>{const r=to(t);e.fullPath&&(r._relativePath=e.fullPath),o.push(r),i--,s()}))}),l()},r)};l()};a(e)}),to=e=>{if(e.type.length)return e;const t=e.lastModifiedDate,r=e.name,o=zr(Fe(e.name));return o.length?((e=e.slice(0,e.size,o)).name=r,e.lastModifiedDate=t,e):e},ro=e=>oo(e)&&(no(e)||{}).isDirectory,oo=e=>"webkitGetAsEntry"in e,no=e=>e.webkitGetAsEntry(),io=e=>{let t=[];try{if((t=ao(e)).length)return t;t=so(e)}catch(e){}return t},so=e=>{let t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},ao=e=>{let t=e.getData("text/html");if("string"==typeof t&&t.length){const e=t.match(/src\s*=\s*"(.+?)"/);if(e)return[e[1]]}return[]},lo=[],co=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),po=e=>{const t=lo.find(t=>t.element===e);if(t)return t;const r=Eo(e);return lo.push(r),r},Eo=t=>{const r=[],o={dragenter:Io,dragover:fo,dragleave:ho,drop:mo},n={};e(o,(e,o)=>{n[e]=o(t,r),t.addEventListener(e,n[e],!1)});const i={element:t,addListener:s=>(r.push(s),()=>{r.splice(r.indexOf(s),1),0===r.length&&(lo.splice(lo.indexOf(i),1),e(o,e=>{t.removeEventListener(e,n[e],!1)}))})};return i},uo=(e,t)=>{const r=((e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)))((e=>"getRootNode"in e?e.getRootNode():document)(t),{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)};let _o=null;const To=(e,t)=>{try{e.dropEffect=t}catch(e){}},Io=(e,t)=>e=>{e.preventDefault(),_o=e.target,t.forEach(t=>{const{element:r,onenter:o}=t;uo(e,r)&&(t.state="enter",o(co(e)))})},fo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(o=>{let n=!1;t.some(t=>{const{filterElement:i,element:s,onenter:a,onexit:l,ondrag:c,allowdrop:d}=t;To(r,"copy");const p=d(o);if(p)if(uo(e,s)){if(n=!0,null===t.state)return t.state="enter",void a(co(e));if(t.state="over",i&&!p)return void To(r,"none");c(co(e))}else i&&!n&&To(r,"none"),t.state&&(t.state=null,l(co(e)));else To(r,"none")})})},mo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(r=>{t.forEach(t=>{const{filterElement:o,element:n,ondrop:i,onexit:s,allowdrop:a}=t;if(t.state=null,!o||uo(e,n))return a(r)?void i(co(e),r):s(co(e))})})},ho=(e,t)=>e=>{_o===e.target&&t.forEach(t=>{const{onexit:r}=t;t.state=null,r(co(e))})},Ro=(e,t,r)=>{e.classList.add("filepond--hopper");const{catchesDropsOnPage:o,requiresDropOnElement:n,filterItems:i=(e=>e)}=r,s=((e,t,r)=>{const o=po(t),n={element:e,filterElement:r,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=o.addListener(n),n})(e,o?document.documentElement:e,n);let a="",l="";s.allowdrop=(e=>t(i(e))),s.ondrop=((e,r)=>{const o=i(r);t(o)?(l="drag-drop",c.onload(o,e)):c.ondragend(e)}),s.ondrag=(e=>{c.ondrag(e)}),s.onenter=(e=>{l="drag-over",c.ondragstart(e)}),s.onexit=(e=>{l="drag-exit",c.ondragend(e)});const c={updateHopperState:()=>{a!==l&&(e.dataset.hopperState=l,a=l)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{s.destroy()}};return c};let go=!1;const Oo=[],Do=e=>{const t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){let e=!1,r=t;for(;r!==document.body;){if(r.classList.contains("filepond--root")){e=!0;break}r=r.parentNode}if(!e)return}jr(e.clipboardData).then(e=>{e.length&&Oo.forEach(t=>t(e))})},So=()=>{const e=e=>{t.onload(e)},t={destroy:()=>{(e=>{se(Oo,Oo.indexOf(e)),0===Oo.length&&(document.removeEventListener("paste",Do),go=!1)})(e)},onload:()=>{}};return(e=>{Oo.includes(e)||(Oo.push(e),go||(go=!0,document.addEventListener("paste",Do)))})(e),t};let yo=null,Ao=null;const Lo=[],Po=(e,t)=>{e.element.textContent=t},vo=(e,t,r)=>{const o=e.query("GET_TOTAL_ITEMS");Po(e,`${r} ${t}, ${o} ${1===o?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(Ao),Ao=setTimeout(()=>{(e=>{e.element.textContent=""})(e)},1500)},Mo=e=>e.element.parentNode.contains(document.activeElement),bo=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");Po(e,`${r} ${o}`)},Co=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename;Po(e,`${t.status.main} ${r} ${t.status.sub}`)},No=A({create:({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,r(e.element,"role","status"),r(e.element,"aria-live","polite"),r(e.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:({root:e,action:t})=>{if(!Mo(e))return;e.element.textContent="";const r=e.query("GET_ITEM",t.id);Lo.push(r.filename),clearTimeout(yo),yo=setTimeout(()=>{vo(e,Lo.join(", "),e.query("GET_LABEL_FILE_ADDED")),Lo.length=0},750)},DID_REMOVE_ITEM:({root:e,action:t})=>{if(!Mo(e))return;const r=t.item;vo(e,r.filename,e.query("GET_LABEL_FILE_REMOVED"))},DID_COMPLETE_ITEM_PROCESSING:({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Po(e,`${r} ${o}`)},DID_ABORT_ITEM_PROCESSING:bo,DID_REVERT_ITEM_PROCESSING:bo,DID_THROW_ITEM_REMOVE_ERROR:Co,DID_THROW_ITEM_LOAD_ERROR:Co,DID_THROW_ITEM_INVALID:Co,DID_THROW_ITEM_PROCESSING_ERROR:Co}),tag:"span",name:"assistant"}),wo=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),e=>e.charAt(1).toUpperCase()),Go=(e,t=16,r=!0)=>{let o=Date.now(),n=null;return(...i)=>{clearTimeout(n);const s=Date.now()-o,a=()=>{o=Date.now(),e(...i)};se.preventDefault(),Bo=e=>{const t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},Fo=e=>{let t=0,r=0;const o=e.ref.list,n=o.childViews[0],i=n.childViews.filter(e=>e.rect.element.height),s=e.query("GET_ACTIVE_ITEMS").map(e=>i.find(t=>t.id===e.id)).filter(e=>e);if(0===s.length)return{visual:t,bounds:r};const a=n.rect.element.width,l=_r(n,s,o.dragCoordinates),c=s[0].rect.element,d=c.marginTop+c.marginBottom,p=c.marginLeft+c.marginRight,E=c.width+p,u=c.height+d,_=void 0!==l&&l>=0?1:0,T=s.find(e=>e.markedForRemoval&&e.opacity<.45)?-1:0,I=s.length+_+T,f=ur(a,E);return 1===f?s.forEach(e=>{const o=e.rect.element.height+d;r+=o,t+=o*e.opacity}):(r=Math.ceil(I/f)*u,t=r),{visual:t,bounds:r}},qo=e=>{const t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Vo=(e,t)=>{const r=e.query("GET_ALLOW_REPLACE"),o=e.query("GET_ALLOW_MULTIPLE"),n=e.query("GET_TOTAL_ITEMS");let i=e.query("GET_MAX_FILES");const s=t.length;return!o&&s>1?(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ke("warning",0,"Max files")}),!0):!(!o&&r)&&(!!(V(i=o?i:1)&&n+s>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ke("warning",0,"Max files")}),!0))},xo=(e,t,r)=>{const o=e.childViews[0];return _r(o,t,{left:r.scopeLeft-o.rect.element.left,top:r.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Yo=e=>{const t=e.query("GET_ALLOW_DROP"),r=e.query("GET_DISABLED"),o=t&&!r;if(o&&!e.ref.hopper){const t=Ro(e.element,t=>{const r=e.query("GET_BEFORE_DROP_FILE")||(()=>!0);return!e.query("GET_DROP_VALIDATION")||t.every(t=>me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(e=>!0===e)&&r(t))},{filterItems:t=>{const r=e.query("GET_IGNORED_FILES");return t.filter(e=>!_t(e)||!r.includes(e.name.toLowerCase()))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});t.onload=((t,r)=>{const o=e.ref.list.childViews[0].childViews.filter(e=>e.rect.element.height),n=e.query("GET_ACTIVE_ITEMS").map(e=>o.find(t=>t.id===e.id)).filter(e=>e);fe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:xo(e.ref.list,n,r),interactionMethod:te})}),e.dispatch("DID_DROP",{position:r}),e.dispatch("DID_END_DRAG",{position:r})}),t.ondragstart=(t=>{e.dispatch("DID_START_DRAG",{position:t})}),t.ondrag=Go(t=>{e.dispatch("DID_DRAG",{position:t})}),t.ondragend=(t=>{e.dispatch("DID_END_DRAG",{position:t})}),e.ref.hopper=t,e.ref.drip=e.appendChildView(e.createChildView(Fr))}else!o&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Ho=(e,t)=>{const r=e.query("GET_ALLOW_BROWSE"),o=e.query("GET_DISABLED"),n=r&&!o;n&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(br,{...t,onload:t=>{fe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})})}}),0):!n&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},ko=e=>{const t=e.query("GET_ALLOW_PASTE"),r=e.query("GET_DISABLED"),o=t&&!r;o&&!e.ref.paster?(e.ref.paster=So(),e.ref.paster.onload=(t=>{fe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})})})):!o&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Xo=L({DID_SET_ALLOW_BROWSE:({root:e,props:t})=>{Ho(e,t)},DID_SET_ALLOW_DROP:({root:e})=>{Yo(e)},DID_SET_ALLOW_PASTE:({root:e})=>{ko(e)},DID_SET_DISABLED:({root:e,props:t})=>{Yo(e),ko(e),Ho(e,t),e.query("GET_DISABLED")?e.element.dataset.disabled="disabled":e.element.removeAttribute("data-disabled")}}),$o=A({name:"root",read:({root:e})=>{e.ref.measure&&(e.ref.measureHeight=e.ref.measure.offsetHeight)},create:({root:e,props:t})=>{const r=e.query("GET_ID");r&&(e.element.id=r);const o=e.query("GET_CLASS_NAME");o&&o.split(" ").filter(e=>e.length).forEach(t=>{e.element.classList.add(t)}),e.ref.label=e.appendChildView(e.createChildView(Gr,{...t,translateY:null,caption:e.query("GET_LABEL_IDLE")})),e.ref.list=e.appendChildView(e.createChildView(Or,{translateY:null})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"panel-root"})),e.ref.assistant=e.appendChildView(e.createChildView(No,{...t})),e.ref.data=e.appendChildView(e.createChildView(kr,{...t})),e.ref.measure=Pt("div"),e.ref.measure.style.height="100%",e.element.appendChild(e.ref.measure),e.ref.bounds=null,e.query("GET_STYLES").filter(e=>!b(e.value)).map(({name:t,value:r})=>{e.element.dataset[t]=r}),e.ref.widthPrevious=null,e.ref.widthUpdated=Go(()=>{e.ref.updateHistory=[],e.dispatch("DID_RESIZE_ROOT")},250),e.ref.previousAspectRatio=null,e.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,i="PointerEvent"in window;e.query("GET_ALLOW_REORDER")&&i&&!n&&(e.element.addEventListener("touchmove",Uo,{passive:!1}),e.element.addEventListener("gesturestart",Uo));const s=e.query("GET_CREDITS");if(2===s.length){const t=document.createElement("a");t.className="filepond--credits",t.setAttribute("aria-hidden","true"),t.href=s[0],t.tabindex=-1,t.target="_blank",t.rel="noopener noreferrer",t.textContent=s[1],e.element.appendChild(t),e.ref.credits=t}},write:({root:e,props:t,actions:r})=>{if(Xo({root:e,props:t,actions:r}),r.filter(e=>/^DID_SET_STYLE_/.test(e.type)).filter(e=>!b(e.data.value)).map(({type:t,data:r})=>{const o=wo(t.substring(8).toLowerCase(),"_");e.element.dataset[o]=r.value,e.invalidateLayout()}),e.rect.element.hidden)return;e.rect.element.width!==e.ref.widthPrevious&&(e.ref.widthPrevious=e.rect.element.width,e.ref.widthUpdated());let o=e.ref.bounds;o||(o=e.ref.bounds=qo(e),e.element.removeChild(e.ref.measure),e.ref.measure=null);const{hopper:n,label:i,list:s,panel:a}=e.ref;n&&n.updateHopperState();const l=e.query("GET_PANEL_ASPECT_RATIO"),c=e.query("GET_ALLOW_MULTIPLE"),d=e.query("GET_TOTAL_ITEMS"),p=d===(c?e.query("GET_MAX_FILES")||1e6:1),E=r.find(e=>"DID_ADD_ITEM"===e.type);if(p&&E){const e=E.data.interactionMethod;i.opacity=0,c?i.translateY=-40:e===ee?i.translateX=40:i.translateY=e===re?40:30}else p||(i.opacity=1,i.translateX=0,i.translateY=0);const u=Bo(e),_=Fo(e),T=i.rect.element.height,I=!c||p?0:T,f=p?s.rect.element.marginTop:0,m=0===d?0:s.rect.element.marginBottom,h=I+f+_.visual+m,R=I+f+_.bounds+m;if(s.translateY=Math.max(0,I-s.rect.element.marginTop)-u.top,l){const t=e.rect.element.width,r=t*l;l!==e.ref.previousAspectRatio&&(e.ref.previousAspectRatio=l,e.ref.updateHistory=[]);const o=e.ref.updateHistory;o.push(t);const n=2;if(o.length>2*n){const e=o.length,t=e-10;let r=0;for(let i=e;i>=t;i--)if(o[i]===o[i-2]&&r++,r>=n)return}a.scalable=!1,a.height=r;const i=r-I-(m-u.bottom)-(p?f:0);_.visual>i?s.overflow=i:s.overflow=null,e.height=r}else if(o.fixedHeight){a.scalable=!1;const e=o.fixedHeight-I-(m-u.bottom)-(p?f:0);_.visual>e?s.overflow=e:s.overflow=null}else if(o.cappedHeight){const t=h>=o.cappedHeight,r=Math.min(o.cappedHeight,h);a.scalable=!0,a.height=t?r:r-u.top-u.bottom;const n=r-I-(m-u.bottom)-(p?f:0);h>o.cappedHeight&&_.visual>n?s.overflow=n:s.overflow=null,e.height=Math.min(o.cappedHeight,R-u.top-u.bottom)}else{const t=d>0?u.top+u.bottom:0;a.scalable=!0,a.height=Math.max(T,h-t),e.height=Math.max(T,R-t)}e.ref.credits&&a.heightCurrent&&(e.ref.credits.style.transform=`translateY(${a.heightCurrent}px)`)},destroy:({root:e})=>{e.ref.paster&&e.ref.paster.destroy(),e.ref.hopper&&e.ref.hopper.destroy(),e.element.removeEventListener("touchmove",Uo),e.element.removeEventListener("gesturestart",Uo)},mixins:{styles:["height"]}}),Wo=(e={})=>{let r=null;const o=Re(),n=((e,t=[],r=[])=>{const o={...e},n=[],i=[],s=(e,t,r)=>{!r||document.hidden?(d[e]&&d[e](t),n.push({type:e,data:t})):i.push({type:e,data:t})},a=(e,...t)=>c[e]?c[e](...t):null,l={getState:()=>({...o}),processActionQueue:()=>{const e=[...n];return n.length=0,e},processDispatchQueue:()=>{const e=[...i];i.length=0,e.forEach(({type:e,data:t})=>{s(e,t)})},dispatch:s,query:a};let c={};t.forEach(e=>{c={...e(o),...c}});let d={};return r.forEach(e=>{d={...e(s,a,o),...d}}),l})((e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:j(e)}))(o),[we,J(o)],[yt,K(o)]);n.dispatch("SET_OPTIONS",{options:e});const i=()=>{document.hidden||n.dispatch("KICK")};document.addEventListener("visibilitychange",i);let s=null,a=!1,l=!1,c=null,d=null;const p=()=>{a||(a=!0),clearTimeout(s),s=setTimeout(()=>{a=!1,c=null,d=null,l&&(l=!1,n.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const E=$o(n,{id:ie()});let u=!1,_=!1;const I={_read:()=>{a&&(d=window.innerWidth,c||(c=d),l||d===c||(n.dispatch("DID_START_RESIZE"),l=!0)),_&&u&&(u=null===E.element.offsetParent),u||(E._read(),_=E.rect.element.hidden)},_write:e=>{const t=n.processActionQueue().filter(e=>!/^SET_/.test(e.type));u&&!t.length||(R(t),u=E._write(e,t,l),(e=>{e.forEach((t,r)=>{t.released&&se(e,r)})})(n.query("GET_ITEMS")),u&&n.processDispatchQueue())}},f=e=>t=>{const r={type:e};if(!t)return r;if(t.hasOwnProperty("error")&&(r.error=t.error?{...t.error}:null),t.status&&(r.status={...t.status}),t.file&&(r.output=t.file),t.source)r.file=t.source;else if(t.item||t.id){const e=t.item?t.item:n.query("GET_ITEM",t.id);r.file=e?de(e):null}return t.items&&(r.items=t.items.map(de)),/progress/.test(e)&&(r.progress=t.progress),t.hasOwnProperty("origin")&&t.hasOwnProperty("target")&&(r.origin=t.origin,r.target=t.target),r},m={DID_DESTROY:f("destroy"),DID_INIT:f("init"),DID_THROW_MAX_FILES:f("warning"),DID_INIT_ITEM:f("initfile"),DID_START_ITEM_LOAD:f("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:f("addfileprogress"),DID_LOAD_ITEM:f("addfile"),DID_THROW_ITEM_INVALID:[f("error"),f("addfile")],DID_THROW_ITEM_LOAD_ERROR:[f("error"),f("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[f("error"),f("removefile")],DID_PREPARE_OUTPUT:f("preparefile"),DID_START_ITEM_PROCESSING:f("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:f("processfileprogress"),DID_ABORT_ITEM_PROCESSING:f("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:f("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:f("processfiles"),DID_REVERT_ITEM_PROCESSING:f("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[f("error"),f("processfile")],DID_REMOVE_ITEM:f("removefile"),DID_UPDATE_ITEMS:f("updatefiles"),DID_ACTIVATE_ITEM:f("activatefile"),DID_REORDER_ITEMS:f("reorderfiles")},h=e=>{const t={pond:A,...e};delete t.type,E.element.dispatchEvent(new CustomEvent(`FilePond:${e.type}`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const r=[];e.hasOwnProperty("error")&&r.push(e.error),e.hasOwnProperty("file")&&r.push(e.file);const o=["type","error","file"];Object.keys(e).filter(e=>!o.includes(e)).forEach(t=>r.push(e[t])),A.fire(e.type,...r);const i=n.query(`GET_ON${e.type.toUpperCase()}`);i&&i(...r)},R=e=>{e.length&&e.filter(e=>m[e.type]).forEach(e=>{const t=m[e.type];(Array.isArray(t)?t:[t]).forEach(t=>{"DID_INIT_ITEM"===e.type?h(t(e.data)):setTimeout(()=>{h(t(e.data))},0)})})},g=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),O=(e,t)=>("object"!=typeof e||(e=>e.file&&e.id)(e)||t||(t=e,e=void 0),n.dispatch("REMOVE_ITEM",{...t,query:e}),null===n.query("GET_ACTIVE_ITEM",e)),D=(...e)=>new Promise((t,r)=>{const o=[],i={};if(M(e[0]))o.push.apply(o,e[0]),Object.assign(i,e[1]||{});else{const t=e[e.length-1];"object"!=typeof t||t instanceof Blob||Object.assign(i,e.pop()),o.push(...e)}n.dispatch("ADD_ITEMS",{items:o,index:i.index,interactionMethod:ee,success:t,failure:r})}),S=()=>n.query("GET_ACTIVE_ITEMS"),y=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PROCESSING",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),A={...ae(),...I,...Z(n,o),setOptions:e=>n.dispatch("SET_OPTIONS",{options:e}),addFile:(e,t={})=>new Promise((r,o)=>{D([{source:e,options:t}],{index:t.index}).then(e=>r(e&&e[0])).catch(o)}),addFiles:D,getFile:e=>n.query("GET_ACTIVE_ITEM",e),processFile:y,prepareFile:g,removeFile:O,moveFile:(e,t)=>n.dispatch("MOVE_ITEM",{query:e,index:t}),getFiles:S,processFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;if(!t.length){const e=S().filter(e=>!(e.status===pe.IDLE&&e.origin===Ee.LOCAL)&&e.status!==pe.PROCESSING&&e.status!==pe.PROCESSING_COMPLETE&&e.status!==pe.PROCESSING_REVERT_ERROR);return Promise.all(e.map(y))}return Promise.all(t.map(y))},removeFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;let r;"object"==typeof t[t.length-1]?r=t.pop():Array.isArray(e[0])&&(r=e[1]);const o=S();return t.length?t.map(e=>T(e)?o[e]?o[e].id:null:e).filter(e=>e).map(e=>O(e,r)):Promise.all(o.map(e=>O(e,r)))},prepareFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=t.length?t:S();return Promise.all(r.map(g))},sort:e=>n.dispatch("SORT",{compare:e}),browse:()=>{var e=E.element.querySelector("input[type=file]");e&&e.click()},destroy:()=>{A.fire("destroy",E.element),n.dispatch("ABORT_ALL"),E._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",i),n.dispatch("DID_DESTROY")},insertBefore:e=>P(E.element,e),insertAfter:e=>v(E.element,e),appendTo:e=>e.appendChild(E.element),replaceElement:e=>{P(E.element,e),e.parentNode.removeChild(e),r=e},restoreElement:()=>{r&&(v(r,E.element),E.element.parentNode.removeChild(E.element),r=null)},isAttachedTo:e=>E.element===e||r===e,element:{get:()=>E.element},status:{get:()=>n.query("GET_STATUS")}};return n.dispatch("DID_INIT"),t(A)},zo=(t={})=>{const r={};return e(Re(),(e,t)=>{r[e]=t[0]}),Wo({...r,...t})},jo=(t,r)=>{e(r,(r,o)=>{e(t,(e,n)=>{const i=new RegExp(r);if(!i.test(e))return;if(delete t[e],!1===o)return;if(U(o))return void(t[o]=n);const s=o.group;X(o)&&!t[s]&&(t[s]={}),t[s][(e=>e.charAt(0).toLowerCase()+e.slice(1))(e.replace(i,""))]=n}),o.mapping&&jo(t[o.group],o.mapping)})},Qo=(t,o={})=>{const n=[];e(t.attributes,e=>{n.push(t.attributes[e])});const i=n.filter(e=>e.name).reduce((e,o)=>{const n=r(t,o.name);return e[(e=>wo(e.replace(/^data-/,"")))(o.name)]=n===o.name||n,e},{});return jo(i,o),i},Zo=(...e)=>(e=>e instanceof HTMLElement)(e[0])?((e,t={})=>{const r={"^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};me("SET_ATTRIBUTE_TO_OPTION_MAP",r);const o={...t},n=Qo("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,r);Object.keys(n).forEach(e=>{X(n[e])?(X(o[e])||(o[e]={}),Object.assign(o[e],n[e])):o[e]=n[e]}),o.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(e=>({source:e.value,options:{type:e.dataset.type}})));const i=zo(o);return e.files&&Array.from(e.files).forEach(e=>{i.addFile(e)}),i.replaceElement(e),i})(...e):zo(...e),Ko=["fire","_read","_write"],Jo=e=>{const t={};return le(e,t,Ko),t},en=(e,t)=>e.replace(/(?:{([a-zA-Z]+)})/g,(e,r)=>t[r]),tn=e=>{const t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),r=URL.createObjectURL(t),o=new Worker(r);return{transfer:(e,t)=>{},post:(e,t,r)=>{const n=ie();o.onmessage=(e=>{e.data.id===n&&t(e.data.message)}),o.postMessage({id:n,message:e},r)},terminate:()=>{o.terminate(),URL.revokeObjectURL(r)}}},rn=e=>new Promise((t,r)=>{const o=new Image;o.onload=(()=>{t(o)}),o.onerror=(e=>{r(e)}),o.src=e}),on=(e,t)=>{const r=e.slice(0,e.size,e.type);return r.lastModifiedDate=e.lastModifiedDate,r.name=t,r},nn=e=>on(e,e.name),sn=[],an=t=>{if(sn.includes(t))return;sn.push(t),(e=>Object.assign(ge,e))(t({addFilter:he,utils:{Type:Te,forin:e,isString:U,isFile:_t,toNaturalFileSize:wt,replaceInString:en,getExtensionFromFilename:Fe,getFilenameWithoutExtension:ut,guesstimateMimeType:zr,getFileFromBlob:xe,getFilenameFromURL:Be,createRoute:L,createWorker:tn,createView:A,createItemAPI:de,loadImage:rn,copyFile:nn,renameFile:on,createBlob:Ye,applyFilterChain:fe,text:vt,getNumericAspectRatioFromString:De},views:{fileActionButton:Nt}}).options)},ln=(()=>{const e=d()&&!(()=>"[object OperaMini]"===Object.prototype.toString.call(window.operamini))()&&(()=>"visibilityState"in document)()&&(()=>"Promise"in window)()&&(()=>"slice"in Blob.prototype)()&&(()=>"URL"in window&&"createObjectURL"in window.URL)()&&(()=>"performance"in window)()&&((()=>"supports"in(window.CSS||{}))()||(()=>/MSIE|Trident/.test(window.navigator.userAgent))());return()=>e})(),cn={apps:[]},dn=()=>{};let pn={},En={},un={},_n={},Tn=dn,In=dn,fn=dn,mn=dn,hn=dn,Rn=dn,gn=dn;if(ln()){((e,t,r=60)=>{const o="__framePainter";if(window[o])return window[o].readers.push(e),void window[o].writers.push(t);window[o]={readers:[e],writers:[t]};const n=window[o],i=1e3/r;let s=null,a=null,l=null,c=null;const d=()=>{document.hidden?(l=(()=>window.setTimeout(()=>p(performance.now()),i)),c=(()=>window.clearTimeout(a))):(l=(()=>window.requestAnimationFrame(p)),c=(()=>window.cancelAnimationFrame(a)))};document.addEventListener("visibilitychange",()=>{c&&c(),d(),p(performance.now())});const p=e=>{a=l(p),s||(s=e);const t=e-s;t<=i||(s=e-t%i,n.readers.forEach(e=>e()),n.writers.forEach(t=>t(e)))};d(),p(performance.now())})(()=>{cn.apps.forEach(e=>e._read())},e=>{cn.apps.forEach(t=>t._write(e))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:ln,create:Tn,destroy:In,parse:fn,find:mn,registerPlugin:hn,setOptions:gn}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const r=()=>e(Re(),(e,t)=>{_n[e]=t[1]});pn={...ye},un={...Ee},En={...pe},_n={},r(),Tn=((...e)=>{const t=Zo(...e);return t.on("destroy",In),cn.apps.push(t),Jo(t)}),In=(e=>{const t=cn.apps.findIndex(t=>t.isAttachedTo(e));if(t>=0){return cn.apps.splice(t,1)[0].restoreElement(),!0}return!1}),fn=(e=>{return Array.from(e.querySelectorAll(".filepond")).filter(e=>!cn.apps.find(t=>t.isAttachedTo(e))).map(e=>Tn(e))}),mn=(e=>{const t=cn.apps.find(t=>t.isAttachedTo(e));return t?Jo(t):null}),hn=((...e)=>{e.forEach(an),r()}),Rn=(()=>{const t={};return e(Re(),(e,r)=>{t[e]=r[0]}),t}),gn=(t=>(X(t)&&(cn.apps.forEach(e=>{e.setOptions(t)}),(t=>{e(t,(e,t)=>{ge[e]&&(ge[e][0]=z(t,ge[e][0],ge[e][1]))})})(t)),Rn()))}export{un as FileOrigin,En as FileStatus,_n as OptionTypes,pn as Status,Tn as create,In as destroy,mn as find,Rn as getOptions,fn as parse,hn as registerPlugin,gn as setOptions,ln as supported}; +const e=(e,t)=>{for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])},t=t=>{const r={};return e(t,e=>{((e,t,r)=>{"function"!=typeof r?Object.defineProperty(e,t,{...r}):e[t]=r})(r,e,t[e])}),r},r=(e,t,r=null)=>{if(null===r)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,r)},o=["svg","path"],n=e=>o.includes(e),i=(t,o,i={})=>{"object"==typeof o&&(i=o,o=null);const s=n(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return o&&(n(t)?r(s,"class",o):s.className=o),e(i,(e,t)=>{r(s,e,t)}),s},s=e=>(t,r)=>{void 0!==r&&e.children[r]?e.insertBefore(t,e.children[r]):e.appendChild(t)},a=(e,t)=>(e,r)=>(void 0!==r?t.splice(r,0,e):t.push(e),e),l=(e,t)=>r=>(t.splice(t.indexOf(r),1),r.element.parentNode&&e.removeChild(r.element),r),c=(()=>"undefined"!=typeof window&&void 0!==window.document)(),d=()=>c,p="children"in(d()?i("svg"):{})?e=>e.children.length:e=>e.childNodes.length,E=(e,t,r,o)=>{const n=r[0]||e.left,i=r[1]||e.top,s=n+e.width,a=i+e.height*(o[1]||1),l={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:i,right:s,bottom:a}};return t.filter(e=>!e.isRectIgnored()).map(e=>e.rect).forEach(e=>{u(l.inner,{...e.inner}),u(l.outer,{...e.outer})}),_(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,_(l.outer),l},u=(e,t)=>{t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},_=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},T=e=>"number"==typeof e,f=e=>e<.5?2*e*e:(4-2*e)*e-1,I={spring:({stiffness:e=.5,damping:r=.75,mass:o=10}={})=>{let n=null,i=null,s=0,a=!1;const l=t({interpolate:(t,c)=>{if(!a)return T(n)&&T(i)?void(((e,t,r,o=.001)=>Math.abs(e-t){if(T(e)&&!T(i)&&(i=e),null===n&&(n=e,i=e),i===(n=e)||void 0===n)return a=!0,s=0,l.onupdate(i),void l.oncomplete(i);a=!1},get:()=>n},resting:{get:()=>a},onupdate:e=>{},oncomplete:e=>{}});return l},tween:({duration:e=500,easing:r=f,delay:o=0}={})=>{let n,i,s=null,a=!0,l=!1,c=null;const d=t({interpolate:(t,p)=>{a||null===c||(null===s&&(s=t),t-s=e||p?(n=1,i=l?0:1,d.onupdate(i*c),d.oncomplete(i*c),a=!0):(i=n/e,d.onupdate((n>=0?r(l?1-i:i):0)*c))))},target:{get:()=>l?0:c,set:e=>{if(null===c)return c=e,d.onupdate(e),void d.oncomplete(e);ea},onupdate:e=>{},oncomplete:e=>{}});return d}},m=(e,t,r)=>{const o=e[t]&&"object"==typeof e[t][r]?e[t][r]:e[t]||e,n="string"==typeof o?o:o.type,i="object"==typeof o?{...o}:{};return I[n]?I[n](i):null},h=(e,t,r,o=!1)=>{(t=Array.isArray(t)?t:[t]).forEach(t=>{e.forEach(e=>{let n=e,i=()=>r[e],s=t=>r[e]=t;"object"==typeof e&&(n=e.key,i=e.getter||i,s=e.setter||s),t[n]&&!o||(t[n]={get:i,set:s})})})},R=e=>null!=e,g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},O=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in t)if(t[r]!==e[r])return!0;return!1},D=(e,{opacity:t,perspective:r,translateX:o,translateY:n,scaleX:i,scaleY:s,rotateX:a,rotateY:l,rotateZ:c,originX:d,originY:p,width:E,height:u})=>{let _="",T="";(R(d)||R(p))&&(T+=`transform-origin: ${d||0}px ${p||0}px;`),R(r)&&(_+=`perspective(${r}px) `),(R(o)||R(n))&&(_+=`translate3d(${o||0}px, ${n||0}px, 0) `),(R(i)||R(s))&&(_+=`scale3d(${R(i)?i:1}, ${R(s)?s:1}, 1) `),R(c)&&(_+=`rotateZ(${c}rad) `),R(a)&&(_+=`rotateX(${a}rad) `),R(l)&&(_+=`rotateY(${l}rad) `),_.length&&(T+=`transform:${_};`),R(t)&&(T+=`opacity:${t};`,0===t&&(T+="visibility:hidden;"),t<1&&(T+="pointer-events:none;")),R(u)&&(T+=`height:${u}px;`),R(E)&&(T+=`width:${E}px;`);const f=e.elementCurrentStyle||"";T.length===f.length&&T===f||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,view:n})=>{const i={...t},s={};h(e,[r,o],t);const a=()=>n.rect?E(n.rect,n.childViews,(()=>[t.translateX||0,t.translateY||0])(),(()=>[t.scaleX||0,t.scaleY||0])()):null;return r.rect={get:a},o.rect={get:a},e.forEach(e=>{t[e]=void 0===i[e]?g[e]:i[e]}),{write:()=>{if(O(s,t))return D(n.element,t),Object.assign(s,{...t}),!0},destroy:()=>{}}},listeners:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,viewState:n,view:i})=>{const s=[],a=(e=>(t,r)=>{e.addEventListener(t,r)})(i.element),l=(e=>(t,r)=>{e.removeEventListener(t,r)})(i.element);return o.on=((e,t)=>{s.push({type:e,fn:t}),a(e,t)}),o.off=((e,t)=>{s.splice(s.findIndex(r=>r.type===e&&r.fn===t),1),l(e,t)}),{write:()=>!0,destroy:()=>{s.forEach(e=>{l(e.type,e.fn)})}}},animations:({mixinConfig:t,viewProps:r,viewInternalAPI:o,viewExternalAPI:n})=>{const i={...r},s=[];return e(t,(e,t)=>{const a=m(t);a&&(a.onupdate=(t=>{r[e]=t}),a.target=i[e],h([{key:e,setter:e=>{a.target!==e&&(a.target=e)},getter:()=>r[e]}],[o,n],r,!0),s.push(a))}),{write:e=>{let t=document.hidden,r=!0;return s.forEach(o=>{o.resting||(r=!1),o.interpolate(e,t)}),r},destroy:()=>{}}},apis:({mixinConfig:e,viewProps:t,viewExternalAPI:r})=>{h(e,r,t)}},y=(e={},t={},r={})=>(t.layoutCalculated||(e.paddingTop=parseInt(r.paddingTop,10)||0,e.marginTop=parseInt(r.marginTop,10)||0,e.marginRight=parseInt(r.marginRight,10)||0,e.marginBottom=parseInt(r.marginBottom,10)||0,e.marginLeft=parseInt(r.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e),A=({tag:e="div",name:r=null,attributes:o={},read:n=(()=>{}),write:c=(()=>{}),create:d=(()=>{}),destroy:u=(()=>{}),filterFrameActionsForChild:_=((e,t)=>t),didCreateView:T=(()=>{}),didWriteView:f=(()=>{}),ignoreRect:I=!1,ignoreRectUpdate:m=!1,mixins:h=[]}={})=>(R,g={})=>{const O=i(e,`filepond--${r}`,o),D=window.getComputedStyle(O,null),A=y();let L=null,P=!1;const v=[],M=[],b={},C={},N=[c],w=[n],G=[u],U=()=>O,B=()=>v.concat(),F=()=>L||(L=E(A,v,[0,0],[1,1])),q={element:{get:U},style:{get:()=>D},childViews:{get:B}},V={...q,rect:{get:F},ref:{get:()=>b},is:e=>r===e,appendChild:s(O),createChildView:(e=>(t,r)=>t(e,r))(R),linkView:e=>(v.push(e),e),unlinkView:e=>{v.splice(v.indexOf(e),1)},appendChildView:a(0,v),removeChildView:l(O,v),registerWriter:e=>N.push(e),registerReader:e=>w.push(e),registerDestroyer:e=>G.push(e),invalidateLayout:()=>O.layoutCalculated=!1,dispatch:R.dispatch,query:R.query},x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:()=>P},isRectIgnored:()=>I,_read:()=>{L=null,v.forEach(e=>e._read()),!(m&&A.width&&A.height)&&y(A,O,D);const e={root:H,props:g,rect:A};w.forEach(t=>t(e))},_write:(e,t,r)=>{let o=0===t.length;return N.forEach(n=>{!1===n({props:g,root:H,actions:t,timestamp:e,shouldOptimize:r})&&(o=!1)}),M.forEach(t=>{!1===t.write(e)&&(o=!1)}),v.filter(e=>!!e.element.parentNode).forEach(n=>{n._write(e,_(n,t),r)||(o=!1)}),v.forEach((n,i)=>{n.element.parentNode||(H.appendChild(n.element,i),n._read(),n._write(e,_(n,t),r),o=!1)}),P=o,f({props:g,root:H,actions:t,timestamp:e}),o},_destroy:()=>{M.forEach(e=>e.destroy()),G.forEach(e=>{e({root:H,props:g})}),v.forEach(e=>e._destroy())}},Y={...q,rect:{get:()=>A}};Object.keys(h).sort((e,t)=>"styles"===e?1:"styles"===t?-1:0).forEach(e=>{const r=S[e]({mixinConfig:h[e],viewProps:g,viewState:C,viewInternalAPI:V,viewExternalAPI:x,view:t(Y)});r&&M.push(r)});const H=t(V);d({root:H,props:g});const k=p(O);return v.forEach((e,t)=>{H.appendChild(e.element,k+t)}),T(H),t(x)},L=(e,t)=>({root:r,props:o,actions:n=[],timestamp:i,shouldOptimize:s})=>{n.filter(t=>e[t.type]).forEach(t=>e[t.type]({root:r,props:o,action:t.data,timestamp:i,shouldOptimize:s})),t&&t({root:r,props:o,actions:n,timestamp:i,shouldOptimize:s})},P=(e,t)=>t.parentNode.insertBefore(e,t),v=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),M=e=>Array.isArray(e),b=e=>null==e,C=e=>e.trim(),N=e=>""+e,w=e=>"boolean"==typeof e,G=e=>w(e)?e:"true"===e,U=e=>"string"==typeof e,B=e=>T(e)?e:U(e)?N(e).replace(/[a-z]+/gi,""):0,F=e=>parseInt(B(e),10),q=e=>parseFloat(B(e)),V=e=>T(e)&&isFinite(e)&&Math.floor(e)===e,x=(e,t=1e3)=>{if(V(e))return e;let r=N(e).trim();return/MB$/i.test(r)?(r=r.replace(/MB$i/,"").trim(),F(r)*t*t):/KB/i.test(r)?(r=r.replace(/KB$i/,"").trim(),F(r)*t):F(r)},Y=e=>"function"==typeof e,H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},k=(e,t,r,o,n)=>{if(null===t)return null;if("function"==typeof t)return t;const i={url:"GET"===r||"PATCH"===r?`?${e}=`:"",method:r,headers:n,withCredentials:!1,timeout:o,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){const e=i.headers.split(/:(.+)/);i.headers={header:e[0],value:e[1]}}return i.withCredentials=G(i.withCredentials),i},X=e=>"object"==typeof e&&null!==e,$=e=>M(e)?"array":(e=>null===e)(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":(e=>X(e)&&U(e.url)&&X(e.process)&&X(e.revert)&&X(e.restore)&&X(e.fetch))(e)?"api":typeof e,W={array:(e,t=",")=>b(e)?[]:M(e)?e:N(e).split(t).map(C).filter(e=>e.length),boolean:G,int:e=>"bytes"===$(e)?x(e):F(e),number:q,float:q,bytes:x,string:e=>Y(e)?e:N(e),function:e=>(e=>{let t=self,r=e.split("."),o=null;for(;o=r.shift();)if(!(t=t[o]))return null;return t})(e),serverapi:t=>(t=>{const r={};return r.url=U(t)?t:t.url||"",r.timeout=t.timeout?parseInt(t.timeout,10):0,r.headers=t.headers?t.headers:{},e(H,e=>{r[e]=k(e,t[e],H[e],r.timeout,r.headers)}),r.process=t.process||U(t)||t.url?r.process:null,r.remove=t.remove||null,delete r.headers,r})(t),object:e=>{try{return JSON.parse((e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))(e))}catch(e){return null}}},z=(e,t,r)=>{if(e===t)return e;let o=$(e);if(o!==r){const t=((e,t)=>W[t](e))(e,r);if(o=$(t),null===t)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;e=t}return e},j=r=>{const o={};return e(r,e=>{const t=r[e];o[e]=((e,t)=>{let r=e;return{enumerable:!0,get:()=>r,set:o=>{r=z(o,e,t)}}})(t[0],t[1])}),t(o)},Q=(e,t="-")=>e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()).join(t),Z=(t,r)=>{const o={};return e(r,e=>{o[e]={get:()=>t.getState().options[e],set:r=>{t.dispatch(`SET_${Q(e,"_").toUpperCase()}`,{value:r})}}}),o},K=t=>(r,o,n)=>{const i={};return e(t,e=>{const t=Q(e,"_").toUpperCase();i[`SET_${t}`]=(o=>{try{n.options[e]=o.value}catch(e){}r(`DID_SET_${t}`,{value:n.options[e]})})}),i},J=t=>r=>{const o={};return e(t,e=>{o[`GET_${Q(e,"_").toUpperCase()}`]=(t=>r.options[e])}),o},ee=1,te=2,re=3,oe=4,ne=5,ie=()=>Math.random().toString(36).substring(2,11),se=(e,t)=>e.splice(t,1),ae=()=>{const e=[],t=(t,r)=>{se(e,e.findIndex(e=>e.event===t&&(e.cb===r||!r)))},r=(t,r,o)=>{e.filter(e=>e.event===t).map(e=>e.cb).forEach(e=>((e,t)=>{t?e():document.hidden?Promise.resolve(1).then(e):setTimeout(e,0)})(()=>e(...r),o))};return{fireSync:(e,...t)=>{r(e,t,!0)},fire:(e,...t)=>{r(e,t,!1)},on:(t,r)=>{e.push({event:t,cb:r})},onOnce:(r,o)=>{e.push({event:r,cb:(...e)=>{t(r,o),o(...e)}})},off:t}},le=(e,t,r)=>{Object.getOwnPropertyNames(e).filter(e=>!r.includes(e)).forEach(r=>Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)))},ce=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],de=e=>{const t={};return le(e,t,ce),t},pe={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},Ee={INPUT:1,LIMBO:2,LOCAL:3},ue=e=>/[^0-9]+/.exec(e),_e=()=>ue(1.1.toLocaleString())[0],Te={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},fe=[],Ie=(e,t,r)=>new Promise((o,n)=>{const i=fe.filter(t=>t.key===e).map(e=>e.cb);if(0===i.length)return void o(t);const s=i.shift();i.reduce((e,t)=>e.then(e=>t(e,r)),s(t,r)).then(e=>o(e)).catch(e=>n(e))}),me=(e,t,r)=>fe.filter(t=>t.key===e).map(e=>e.cb(t,r)),he=(e,t)=>fe.push({key:e,cb:t}),Re=()=>({...ge}),ge={id:[null,Te.STRING],name:["filepond",Te.STRING],disabled:[!1,Te.BOOLEAN],className:[null,Te.STRING],required:[!1,Te.BOOLEAN],captureMethod:[null,Te.STRING],allowSyncAcceptAttribute:[!0,Te.BOOLEAN],allowDrop:[!0,Te.BOOLEAN],allowBrowse:[!0,Te.BOOLEAN],allowPaste:[!0,Te.BOOLEAN],allowMultiple:[!1,Te.BOOLEAN],allowReplace:[!0,Te.BOOLEAN],allowRevert:[!0,Te.BOOLEAN],allowRemove:[!0,Te.BOOLEAN],allowProcess:[!0,Te.BOOLEAN],allowReorder:[!1,Te.BOOLEAN],allowDirectoriesOnly:[!1,Te.BOOLEAN],storeAsFile:[!1,Te.BOOLEAN],forceRevert:[!1,Te.BOOLEAN],maxFiles:[null,Te.INT],checkValidity:[!1,Te.BOOLEAN],itemInsertLocationFreedom:[!0,Te.BOOLEAN],itemInsertLocation:["before",Te.STRING],itemInsertInterval:[75,Te.INT],dropOnPage:[!1,Te.BOOLEAN],dropOnElement:[!0,Te.BOOLEAN],dropValidation:[!1,Te.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Te.ARRAY],instantUpload:[!0,Te.BOOLEAN],maxParallelUploads:[2,Te.INT],allowMinimumUploadDuration:[!0,Te.BOOLEAN],chunkUploads:[!1,Te.BOOLEAN],chunkForce:[!1,Te.BOOLEAN],chunkSize:[5e6,Te.INT],chunkRetryDelays:[[500,1e3,3e3],Te.ARRAY],server:[null,Te.SERVER_API],fileSizeBase:[1e3,Te.INT],labelFileSizeBytes:["bytes",Te.STRING],labelFileSizeKilobytes:["KB",Te.STRING],labelFileSizeMegabytes:["MB",Te.STRING],labelFileSizeGigabytes:["GB",Te.STRING],labelDecimalSeparator:[_e(),Te.STRING],labelThousandsSeparator:[(()=>{const e=_e(),t=1e3.toLocaleString();return t!==1e3.toString()?ue(t)[0]:"."===e?",":"."})(),Te.STRING],labelIdle:['Drag & Drop your files or Browse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],oninitfile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],beforePrepareFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],Te.ARRAY]},Oe=(e,t)=>b(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(e=>e.id===t)||null),De=e=>{if(b(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Se=e=>e.filter(e=>!e.archived),ye={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let Ae=null;const Le=[pe.LOAD_ERROR,pe.PROCESSING_ERROR,pe.PROCESSING_REVERT_ERROR],Pe=[pe.LOADING,pe.PROCESSING,pe.PROCESSING_QUEUED,pe.INIT],ve=[pe.PROCESSING_COMPLETE],Me=e=>Le.includes(e.status),be=e=>Pe.includes(e.status),Ce=e=>ve.includes(e.status),Ne=e=>X(e.options.server)&&(X(e.options.server.process)||Y(e.options.server.process)),we=e=>({GET_STATUS:()=>{const t=Se(e.items),{EMPTY:r,ERROR:o,BUSY:n,IDLE:i,READY:s}=ye;return 0===t.length?r:t.some(Me)?o:t.some(be)?n:t.some(Ce)?s:i},GET_ITEM:t=>Oe(e.items,t),GET_ACTIVE_ITEM:t=>Oe(Se(e.items),t),GET_ACTIVE_ITEMS:()=>Se(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const r=Oe(e.items,t);return r?r.filename:null},GET_ITEM_SIZE:t=>{const r=Oe(e.items,t);return r?r.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(e=>/^style/.test(e)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>{return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>Se(e.items).filter(e=>e.status===t),GET_TOTAL_ITEMS:()=>Se(e.items).length,SHOULD_UPDATE_FILE_INPUT:()=>e.options.storeAsFile&&(()=>{if(null===Ae)try{const e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));const t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,Ae=1===t.files.length}catch(e){Ae=!1}return Ae})()&&!Ne(e),IS_ASYNC:()=>Ne(e),GET_FILE_SIZE_LABELS:e=>({labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0})}),Ge=(e,t,r)=>Math.max(Math.min(r,e),t),Ue=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),Be=e=>e.split("/").pop().split("?").shift(),Fe=e=>e.split(".").pop(),qe=(e,t="")=>(t+e).slice(-t.length),Ve=(e=new Date)=>`${e.getFullYear()}-${qe(e.getMonth()+1,"00")}-${qe(e.getDate(),"00")}_${qe(e.getHours(),"00")}-${qe(e.getMinutes(),"00")}-${qe(e.getSeconds(),"00")}`,xe=(e,t,r=null,o=null)=>{const n="string"==typeof r?e.slice(0,e.size,r):e.slice(0,e.size,e.type);return n.lastModifiedDate=new Date,e._relativePath&&(n._relativePath=e._relativePath),U(t)||(t=Ve()),t&&null===o&&Fe(t)?n.name=t:(o=o||(e=>{if("string"!=typeof e)return"";const t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""})(n.type),n.name=t+(o?"."+o:"")),n},Ye=(e,t)=>{const r=(()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)();if(r){const o=new r;return o.append(e),o.getBlob(t)}return new Blob([e],{type:t})},He=e=>(/^data:(.+);/.exec(e)||[])[1]||null,ke=e=>{const t=He(e);return((e,t)=>{const r=new ArrayBuffer(e.length),o=new Uint8Array(r);for(let t=0;tatob((e=>e.split(",")[1].replace(/\s/g,""))(e)))(e),t)},Xe=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null},$e=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},We=e=>{if(/x-content-transfer-id:/i.test(e)){return(e.split(":")[1]||"").trim()||null}return null},ze=e=>{const t={source:null,name:null,size:null},r=e.split("\n");for(let e of r){const r=Xe(e);if(r){t.name=r;continue}const o=$e(e);if(o){t.size=o;continue}const n=We(e);n&&(t.source=n)}return t},je=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},r=r=>{e?(t.timestamp=Date.now(),t.request=e(r,e=>{t.duration=Date.now()-t.timestamp,t.complete=!0,e instanceof Blob&&(e=xe(e,e.name||Be(r))),o.fire("load",e instanceof Blob?e:e?e.body:null)},e=>{o.fire("error","string"==typeof e?{type:"error",code:0,body:e}:e)},(e,r,n)=>{n&&(t.size=n),t.duration=Date.now()-t.timestamp,e?(t.progress=r/n,o.fire("progress",t.progress)):t.progress=null},()=>{o.fire("abort")},e=>{const r=ze("string"==typeof e?e:e.headers);o.fire("meta",{size:t.size||r.size,filename:r.name,source:r.source})})):o.fire("error",{type:"error",body:"Can't load URL",code:400})},o={...ae(),setSource:e=>t.source=e,getProgress:()=>t.progress,abort:()=>{t.request&&t.request.abort&&t.request.abort()},load:()=>{const e=t.source;o.fire("init",e),e instanceof File?o.fire("load",e):e instanceof Blob?o.fire("load",xe(e,e.name)):Ue(e)?o.fire("load",((e,t,r)=>xe(ke(e),t,null,r))(e)):r(e)}};return o},Qe=e=>/GET|HEAD/.test(e),Ze=(e,t,r)=>{const o={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,s.abort()}};let n=!1,i=!1;r={method:"POST",headers:{},withCredentials:!1,...r},t=encodeURI(t),Qe(r.method)&&e&&(t=`${t}${encodeURIComponent("string"==typeof e?e:JSON.stringify(e))}`);const s=new XMLHttpRequest;return(Qe(r.method)?s:s.upload).onprogress=(e=>{n||o.onprogress(e.lengthComputable,e.loaded,e.total)}),s.onreadystatechange=(()=>{s.readyState<2||4===s.readyState&&0===s.status||i||(i=!0,o.onheaders(s))}),s.onload=(()=>{s.status>=200&&s.status<300?o.onload(s):o.onerror(s)}),s.onerror=(()=>o.onerror(s)),s.onabort=(()=>{n=!0,o.onabort()}),s.ontimeout=(()=>o.ontimeout(s)),s.open(r.method,t,!0),V(r.timeout)&&(s.timeout=r.timeout),Object.keys(r.headers).forEach(e=>{const t=unescape(encodeURIComponent(r.headers[e]));s.setRequestHeader(e,t)}),r.responseType&&(s.responseType=r.responseType),r.withCredentials&&(s.withCredentials=!0),s.send(e),o},Ke=(e,t,r,o)=>({type:e,code:t,body:r,headers:o}),Je=e=>t=>{e(Ke("error",0,"Timeout",t.getAllResponseHeaders()))},et=e=>/\?/.test(e),tt=(...e)=>{let t="";return e.forEach(e=>{t+=et(t)&&et(e)?e.replace(/\?/,"&"):e}),t},rt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return null;const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s,a,l,c)=>{const d=Ze(n,tt(e,t.url),{...t,responseType:"blob"});return d.onload=(e=>{const o=e.getAllResponseHeaders(),s=ze(o).name||Be(n);i(Ke("load",e.status,"HEAD"===t.method?null:xe(r(e.response),s),o))}),d.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.onheaders=(e=>{c(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),d.ontimeout=Je(s),d.onprogress=a,d.onabort=l,d}},ot=0,nt=1,it=2,st=3,at=4,lt=(e,t,r,o,n,i,s,a,l,c,d)=>{const p=[],{chunkTransferId:E,chunkServer:u,chunkSize:_,chunkRetryDelays:T}=d,f={serverId:E,aborted:!1},I=t.ondata||(e=>e),m=t.onload||((e,t)=>"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response),h=t.onerror||(e=>null),R=Math.floor(o.size/_);for(let e=0;e<=R;e++){const t=e*_,r=o.slice(t,t+_,"application/offset+octet-stream");p[e]={index:e,size:r.size,offset:t,data:r,file:o,progress:0,retries:[...T],status:ot,error:null,request:null,timeout:null}}const g=e=>e.status===ot||e.status===st,O=t=>{if(f.aborted)return;if(!(t=t||p.find(g)))return void(p.every(e=>e.status===nt)&&(()=>i(f.serverId))());t.status=it,t.progress=null;const r=u.ondata||(e=>e),n=u.onerror||(e=>null),a=tt(e,u.url,f.serverId),c="function"==typeof u.headers?u.headers(t):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":o.size,"Upload-Name":o.name},d=t.request=Ze(r(t.data),a,{...u,headers:c});d.onload=(()=>{t.status=nt,t.request=null,y()}),d.onprogress=((e,r,o)=>{t.progress=e?r:null,S()}),d.onerror=(e=>{t.status=st,t.request=null,t.error=n(e.response)||e.statusText,D(t)||s(Ke("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.ontimeout=(e=>{t.status=st,t.request=null,D(t)||Je(s)(e)}),d.onabort=(()=>{t.status=ot,t.request=null,l()})},D=e=>0!==e.retries.length&&(e.status=at,clearTimeout(e.timeout),e.timeout=setTimeout(()=>{O(e)},e.retries.shift()),!0),S=()=>{const e=p.reduce((e,t)=>null===e||null===t.progress?null:e+t.progress,0);if(null===e)return a(!1,0,0);const t=p.reduce((e,t)=>e+t.size,0);a(!0,e,t)},y=()=>{p.filter(e=>e.status===it).length>=1||O()};return f.serverId?(r=>{const o=tt(e,u.url,f.serverId),n={headers:"function"==typeof t.headers?t.headers(f.serverId):{...t.headers},method:"HEAD"},i=Ze(null,o,n);i.onload=(e=>r(m(e,n.method))),i.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),i.ontimeout=Je(s)})(e=>{f.aborted||(p.filter(t=>t.offset{e.status=nt,e.progress=e.size}),y())}):(i=>{const a=new FormData;X(n)&&a.append(r,JSON.stringify(n));const l="function"==typeof t.headers?t.headers(o,n):{...t.headers,"Upload-Length":o.size},c={...t,headers:l},d=Ze(I(a),tt(e,t.url),c);d.onload=(e=>i(m(e,c.method))),d.onerror=(e=>s(Ke("error",e.status,h(e.response)||e.statusText,e.getAllResponseHeaders()))),d.ontimeout=Je(s)})(e=>{f.aborted||(c(e),f.serverId=e,y())}),{abort:()=>{f.aborted=!0,p.forEach(e=>{clearTimeout(e.timeout),e.request&&e.request.abort()})}}},ct=(e="",t,r,o)=>"function"==typeof t?(...e)=>t(r,...e,o):t&&U(t.url)?((e,t,r,o)=>(n,i,s,a,l,c,d)=>{if(!n)return;const p=o.chunkUploads,E=p&&n.size>o.chunkSize,u=p&&(E||o.chunkForce);if(n instanceof Blob&&u)return lt(e,t,r,n,i,s,a,l,c,d,o);const _=t.ondata||(e=>e),T=t.onload||(e=>e),f=t.onerror||(e=>null),I="function"==typeof t.headers?t.headers(n,i)||{}:{...t.headers},m={...t,headers:I};var h=new FormData;X(i)&&h.append(r,JSON.stringify(i)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(e=>{h.append(r,e.file,null===e.name?e.file.name:`${e.name}${e.file.name}`)});const R=Ze(_(h),tt(e,t.url),m);return R.onload=(e=>{s(Ke("load",e.status,T(e.response),e.getAllResponseHeaders()))}),R.onerror=(e=>{a(Ke("error",e.status,f(e.response)||e.statusText,e.getAllResponseHeaders()))}),R.ontimeout=Je(a),R.onprogress=l,R.onabort=c,R})(e,t,r,o):null,dt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return(e,t)=>t();const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,i,s)=>{const a=Ze(n,e+t.url,t);return a.onload=(e=>{i(Ke("load",e.status,r(e.response),e.getAllResponseHeaders()))}),a.onerror=(e=>{s(Ke("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),a.ontimeout=Je(s),a}},pt=(e=0,t=1)=>e+Math.random()*(t-e),Et=(e,t)=>{const r={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},{allowMinimumUploadDuration:o}=t,n=()=>{r.request&&(r.perceivedPerformanceUpdater.clear(),r.request.abort&&r.request.abort(),r.complete=!0)},i=o?()=>r.progress?Math.min(r.progress,r.perceivedProgress):null:()=>r.progress||null,s=o?()=>Math.min(r.duration,r.perceivedDuration):()=>r.duration,a={...ae(),process:(t,n)=>{const i=()=>{0!==r.duration&&null!==r.progress&&a.fire("progress",a.getProgress())},s=()=>{r.complete=!0,a.fire("load-perceived",r.response.body)};a.fire("start"),r.timestamp=Date.now(),r.perceivedPerformanceUpdater=((e,t=1e3,r=0,o=25,n=250)=>{let i=null;const s=Date.now(),a=()=>{let r=Date.now()-s,l=pt(o,n);r+l>t&&(l=r+l-t);let c=r/t;c>=1||document.hidden?e(1):(e(c),i=setTimeout(a,l))};return t>0&&a(),{clear:()=>{clearTimeout(i)}}})(e=>{r.perceivedProgress=e,r.perceivedDuration=Date.now()-r.timestamp,i(),r.response&&1===r.perceivedProgress&&!r.complete&&s()},o?pt(750,1500):0),r.request=e(t,n,e=>{r.response=X(e)?e:{type:"load",code:200,body:`${e}`,headers:{}},r.duration=Date.now()-r.timestamp,r.progress=1,a.fire("load",r.response.body),(!o||o&&1===r.perceivedProgress)&&s()},e=>{r.perceivedPerformanceUpdater.clear(),a.fire("error",X(e)?e:{type:"error",code:0,body:`${e}`})},(e,t,o)=>{r.duration=Date.now()-r.timestamp,r.progress=e?t/o:null,i()},()=>{r.perceivedPerformanceUpdater.clear(),a.fire("abort",r.response?r.response.body:null)},e=>{a.fire("transfer",e)})},abort:n,getProgress:i,getDuration:s,reset:()=>{n(),r.complete=!1,r.perceivedProgress=0,r.progress=0,r.timestamp=null,r.perceivedDuration=0,r.duration=0,r.request=null,r.response=null}};return a},ut=e=>e.substring(0,e.lastIndexOf("."))||e,_t=e=>!!(e instanceof File||e instanceof Blob&&e.name),Tt=e=>{if(!X(e))return e;const t=M(e)?[]:{};for(const r in e){if(!e.hasOwnProperty(r))continue;const o=e[r];t[r]=o&&X(o)?Tt(o):o}return t},ft=(e=null,r=null,o=null)=>{const n=ie(),i={archived:!1,frozen:!1,released:!1,source:null,file:o,serverFileReference:r,transferId:null,processingAborted:!1,status:r?pe.PROCESSING_COMPLETE:pe.INIT,activeLoader:null,activeProcessor:null};let s=null;const a={},l=e=>i.status=e,c=(e,...t)=>{i.released||i.frozen||E.fire(e,...t)},d=(e,t)=>{if(i.processingAborted)return void(i.processingAborted=!1);if(l(pe.PROCESSING),s=null,!(i.file instanceof Blob))return void E.on("load",()=>{d(e,t)});e.on("load",e=>{i.transferId=null,i.serverFileReference=e}),e.on("transfer",e=>{i.transferId=e}),e.on("load-perceived",e=>{i.activeProcessor=null,i.transferId=null,i.serverFileReference=e,l(pe.PROCESSING_COMPLETE),c("process-complete",e)}),e.on("start",()=>{c("process-start")}),e.on("error",e=>{i.activeProcessor=null,l(pe.PROCESSING_ERROR),c("process-error",e)}),e.on("abort",e=>{i.activeProcessor=null,i.serverFileReference=e,l(pe.IDLE),c("process-abort"),s&&s()}),e.on("progress",e=>{c("process-progress",e)});const r=console.error;t(i.file,t=>{i.archived||e.process(t,{...a})},r),i.activeProcessor=e},p=(e,t,r)=>{const o=e.split("."),n=o[0],i=o.pop();let s=a;o.forEach(e=>s=s[e]),JSON.stringify(s[i])!==JSON.stringify(t)&&(s[i]=t,c("metadata-update",{key:n,value:a[n],silent:r}))},E={id:{get:()=>n},origin:{get:()=>e,set:t=>e=t},serverId:{get:()=>i.serverFileReference},transferId:{get:()=>i.transferId},status:{get:()=>i.status},filename:{get:()=>i.file.name},filenameWithoutExtension:{get:()=>ut(i.file.name)},fileExtension:{get:()=>Fe(i.file.name)},fileType:{get:()=>i.file.type},fileSize:{get:()=>i.file.size},file:{get:()=>i.file},relativePath:{get:()=>i.file._relativePath},source:{get:()=>i.source},getMetadata:e=>Tt(e?a[e]:a),setMetadata:(e,t,r)=>{if(X(e)){const r=e;return Object.keys(r).forEach(e=>{p(e,r[e],t)}),e}return p(e,t,r),t},extend:(e,t)=>u[e]=t,abortLoad:()=>{i.activeLoader?i.activeLoader.abort():(l(pe.INIT),c("load-abort"))},retryLoad:()=>{i.activeLoader&&i.activeLoader.load()},requestProcessing:()=>{i.processingAborted=!1,l(pe.PROCESSING_QUEUED)},abortProcessing:()=>new Promise(e=>{if(!i.activeProcessor)return i.processingAborted=!0,l(pe.IDLE),c("process-abort"),void e();s=(()=>{e()}),i.activeProcessor.abort()}),load:(t,r,o)=>{i.source=t,E.fireSync("init"),i.file?E.fireSync("load-skip"):(i.file=(e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||Ue(e)?t[0]=e.name||Ve():Ue(e)?(t[1]=e.length,t[2]=He(e)):U(e)&&(t[0]=Be(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}})(t),r.on("init",()=>{c("load-init")}),r.on("meta",t=>{i.file.size=t.size,i.file.filename=t.filename,t.source&&(e=Ee.LIMBO,i.serverFileReference=t.source,i.status=pe.PROCESSING_COMPLETE),c("load-meta")}),r.on("progress",e=>{l(pe.LOADING),c("load-progress",e)}),r.on("error",e=>{l(pe.LOAD_ERROR),c("load-request-error",e)}),r.on("abort",()=>{l(pe.INIT),c("load-abort")}),r.on("load",t=>{i.activeLoader=null;const r=t=>{i.file=_t(t)?t:i.file,e===Ee.LIMBO&&i.serverFileReference?l(pe.PROCESSING_COMPLETE):l(pe.IDLE),c("load")};i.serverFileReference?r(t):o(t,r,e=>{i.file=t,c("load-meta"),l(pe.LOAD_ERROR),c("load-file-error",e)})}),r.setSource(t),i.activeLoader=r,r.load())},process:d,revert:(e,t)=>new Promise((r,o)=>{const n=null!==i.serverFileReference?i.serverFileReference:i.transferId;null!==n?(e(n,()=>{i.serverFileReference=null,i.transferId=null,r()},e=>{t?(l(pe.PROCESSING_REVERT_ERROR),c("process-revert-error"),o(e)):r()}),l(pe.IDLE),c("process-revert")):r()}),...ae(),freeze:()=>i.frozen=!0,release:()=>i.released=!0,released:{get:()=>i.released},archive:()=>i.archived=!0,archived:{get:()=>i.archived}},u=t(E);return u},It=(e,t)=>{const r=((e,t)=>b(t)?0:U(t)?e.findIndex(e=>e.id===t):-1)(e,t);if(!(r<0))return e[r]||null},mt=(e,t,r,o,n,i)=>{const s=Ze(null,e,{method:"GET",responseType:"blob"});return s.onload=(r=>{const o=r.getAllResponseHeaders(),n=ze(o).name||Be(e);t(Ke("load",r.status,xe(r.response,n),o))}),s.onerror=(e=>{r(Ke("error",e.status,e.statusText,e.getAllResponseHeaders()))}),s.onheaders=(e=>{i(Ke("headers",e.status,null,e.getAllResponseHeaders()))}),s.ontimeout=Je(r),s.onprogress=o,s.onabort=n,s},ht=e=>(0===e.indexOf("//")&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),Rt=e=>(...t)=>Y(e)?e(...t):e,gt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:Se(t.items)})},0)},Ot=(e,...t)=>new Promise(r=>{if(!e)return r(!0);const o=e(...t);return null==o?r(!0):"boolean"==typeof o?r(o):void("function"==typeof o.then&&o.then(r))}),Dt=(e,t)=>{e.items.sort((e,r)=>t(de(e),de(r)))},St=(e,t)=>({query:r,success:o=(()=>{}),failure:n=(()=>{}),...i}={})=>{const s=Oe(e.items,r);s?t(s,o,n,i||{}):n({error:Ke("error",0,"Item not found"),file:null})},yt=(e,t,r)=>({ABORT_ALL:()=>{Se(r.items).forEach(e=>{e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:({value:t=[]})=>{const o=t.map(e=>({source:e.source?e.source:e,options:e.options}));let n=Se(r.items);n.forEach(t=>{o.find(e=>e.source===t.source||e.source===t.file)||e("REMOVE_ITEM",{query:t,remove:!1})}),n=Se(r.items),o.forEach((t,r)=>{n.find(e=>e.source===t.source||e.file===t.source)||e("ADD_ITEM",{...t,interactionMethod:ne,index:r})})},DID_UPDATE_ITEM_METADATA:({id:o,action:n,change:i})=>{i.silent||(clearTimeout(r.itemUpdateTimeout),r.itemUpdateTimeout=setTimeout(()=>{const s=It(r.items,o);if(!t("IS_ASYNC"))return void Ie("SHOULD_PREPARE_OUTPUT",!1,{item:s,query:t,action:n,change:i}).then(r=>{const n=t("GET_BEFORE_PREPARE_FILE");n&&(r=n(s,r)),r&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:s,success:t=>{e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)});s.origin===Ee.LOCAL&&e("DID_LOAD_ITEM",{id:s.id,error:null,serverFileReference:s.source});const a=()=>{setTimeout(()=>{e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return s.status===pe.PROCESSING_COMPLETE?(e=>{s.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(e?a:()=>{}).catch(()=>{})})(r.options.instantUpload):s.status===pe.PROCESSING?(e=>{s.abortProcessing().then(e?a:()=>{})})(r.options.instantUpload):void(r.options.instantUpload&&a())},0))},MOVE_ITEM:({query:e,index:t})=>{const o=Oe(r.items,e);if(!o)return;const n=r.items.indexOf(o);n!==(t=Ge(t,0,r.items.length-1))&&r.items.splice(t,0,r.items.splice(n,1)[0])},SORT:({compare:o})=>{Dt(r,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:r,index:o,interactionMethod:n,success:i=(()=>{}),failure:s=(()=>{})})=>{let a=o;if(-1===o||void 0===o){const e=t("GET_ITEM_INSERT_LOCATION"),r=t("GET_TOTAL_ITEMS");a="before"===e?0:r}const l=t("GET_IGNORED_FILES"),c=r.filter(e=>_t(e)?!l.includes(e.name.toLowerCase()):!b(e)).map(t=>new Promise((r,o)=>{e("ADD_ITEM",{interactionMethod:n,source:t.source||t,success:r,failure:o,index:a++,options:t.options||{}})}));Promise.all(c).then(i).catch(s)},ADD_ITEM:({source:o,index:n=-1,interactionMethod:i,success:s=(()=>{}),failure:a=(()=>{}),options:l={}})=>{if(b(o))return void a({error:Ke("error",0,"No source"),file:null});if(_t(o)&&r.options.ignoredFiles.includes(o.name.toLowerCase()))return;if(!(e=>{const t=Se(e.items).length;if(!e.options.allowMultiple)return 0===t;const r=e.options.maxFiles;return null===r||t{d&&e("ADD_ITEM",{source:o,index:n,interactionMethod:i,success:s,failure:a,options:l})}).catch(()=>{}),d)return}e("REMOVE_ITEM",{query:c.id})}const c="local"===l.type?Ee.LOCAL:"limbo"===l.type?Ee.LIMBO:Ee.INPUT,d=ft(c,c===Ee.INPUT?null:o,l.file);Object.keys(l.metadata||{}).forEach(e=>{d.setMetadata(e,l.metadata[e])}),me("DID_CREATE_ITEM",d,{query:t,dispatch:e});const p=t("GET_ITEM_INSERT_LOCATION");r.options.itemInsertLocationFreedom||(n="before"===p?-1:r.items.length),((e,t,r)=>b(t)?null:void 0===r?(e.push(t),t):(((e,t,r)=>e.splice(t,0,r))(e,r=Ge(r,0,e.length),t),t))(r.items,d,n),Y(p)&&o&&Dt(r,p);const E=d.id;d.on("init",()=>{e("DID_INIT_ITEM",{id:E})}),d.on("load-init",()=>{e("DID_START_ITEM_LOAD",{id:E})}),d.on("load-meta",()=>{e("DID_UPDATE_ITEM_META",{id:E})}),d.on("load-progress",t=>{e("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:E,progress:t})}),d.on("load-request-error",t=>{const o=Rt(r.options.labelFileLoadError)(t);if(t.code>=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:E,error:t,status:{main:o,sub:`${t.code} (${t.body})`}}),void a({error:t,file:de(d)});e("DID_THROW_ITEM_LOAD_ERROR",{id:E,error:t,status:{main:o,sub:r.options.labelTapToRetry}})}),d.on("load-file-error",t=>{e("DID_THROW_ITEM_INVALID",{id:E,error:t.status,status:t.status}),a({error:t.status,file:de(d)})}),d.on("load-abort",()=>{e("REMOVE_ITEM",{query:E})}),d.on("load-skip",()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}})}),d.on("load",()=>{const n=n=>{n?(d.on("metadata-update",t=>{e("DID_UPDATE_ITEM_METADATA",{id:E,change:t})}),Ie("SHOULD_PREPARE_OUTPUT",!1,{item:d,query:t}).then(n=>{const i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(d,n));const a=()=>{e("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:o,success:s}}),gt(e,r)};n?e("REQUEST_PREPARE_OUTPUT",{query:E,item:d,success:t=>{e("DID_PREPARE_OUTPUT",{id:E,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:E})};Ie("DID_LOAD_ITEM",d,{query:t,dispatch:e}).then(()=>{Ot(t("GET_BEFORE_ADD_FILE"),de(d)).then(n)}).catch(t=>{if(!t||!t.error||!t.status)return n(!1);e("DID_THROW_ITEM_INVALID",{id:E,error:t.error,status:t.status})})}),d.on("process-start",()=>{e("DID_START_ITEM_PROCESSING",{id:E})}),d.on("process-progress",t=>{e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:E,progress:t})}),d.on("process-error",t=>{e("DID_THROW_ITEM_PROCESSING_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-revert-error",t=>{e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:E,error:t,status:{main:Rt(r.options.labelFileProcessingRevertError)(t),sub:r.options.labelTapToRetry}})}),d.on("process-complete",t=>{e("DID_COMPLETE_ITEM_PROCESSING",{id:E,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:E,value:t})}),d.on("process-abort",()=>{e("DID_ABORT_ITEM_PROCESSING",{id:E})}),d.on("process-revert",()=>{e("DID_REVERT_ITEM_PROCESSING",{id:E}),e("DID_DEFINE_VALUE",{id:E,value:null})}),e("DID_ADD_ITEM",{id:E,index:n,interactionMethod:i}),gt(e,r);const{url:u,load:_,restore:T,fetch:f}=r.options.server||{};d.load(o,je(c===Ee.INPUT?U(o)&&(e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&ht(location.href)!==ht(e))(o)&&f?rt(u,f):mt:rt(u,c===Ee.LIMBO?T:_)),(e,r,o)=>{Ie("LOAD_FILE",e,{query:t}).then(r).catch(o)})},REQUEST_PREPARE_OUTPUT:({item:e,success:r,failure:o=(()=>{})})=>{const n={error:Ke("error",0,"Item not found"),file:null};if(e.archived)return o(n);Ie("PREPARE_OUTPUT",e.file,{query:t,item:e}).then(i=>{Ie("COMPLETE_PREPARE_OUTPUT",i,{query:t,item:e}).then(t=>{if(e.archived)return o(n);r(t)})})},COMPLETE_LOAD_ITEM:({item:o,data:n})=>{const{success:i,source:s}=n,a=t("GET_ITEM_INSERT_LOCATION");if(Y(a)&&s&&Dt(r,a),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===Ee.INPUT?null:s}),i(de(o)),o.origin!==Ee.LOCAL)return o.origin===Ee.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&r.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:St(r,e=>{e.retryLoad()}),REQUEST_ITEM_PREPARE:St(r,(t,r,o)=>{e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:o=>{e("DID_PREPARE_OUTPUT",{id:t.id,file:o}),r({file:t,output:o})},failure:o},!0)}),REQUEST_ITEM_PROCESSING:St(r,(o,n,i)=>{if(o.status===pe.IDLE||o.status===pe.PROCESSING_ERROR)o.status!==pe.PROCESSING_QUEUED&&(o.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:o.id}),e("PROCESS_ITEM",{query:o,success:n,failure:i},!0));else{const s=()=>e("REQUEST_ITEM_PROCESSING",{query:o,success:n,failure:i}),a=()=>document.hidden?s():setTimeout(s,32);o.status===pe.PROCESSING_COMPLETE||o.status===pe.PROCESSING_REVERT_ERROR?o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(a).catch(()=>{}):o.status===pe.PROCESSING&&o.abortProcessing().then(a)}}),PROCESS_ITEM:St(r,(o,n,i)=>{const s=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",pe.PROCESSING).length===s)return void r.processingQueue.push({id:o.id,success:n,failure:i});if(o.status===pe.PROCESSING)return;const a=()=>{const t=r.processingQueue.shift();if(!t)return;const{id:o,success:n,failure:i}=t,s=Oe(r.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:n,failure:i},!0):a()};o.onOnce("process-complete",()=>{n(de(o)),a();const i=r.options.server;if(r.options.instantUpload&&o.origin===Ee.LOCAL&&Y(i.remove)){const e=()=>{};o.origin=Ee.LIMBO,r.options.server.remove(o.source,e,e)}t("GET_ITEMS_BY_STATUS",pe.PROCESSING_COMPLETE).length===r.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),o.onOnce("process-error",e=>{i({error:e,file:de(o)}),a()});const l=r.options;o.process(Et(ct(l.server.url,l.server.process,l.name,{chunkTransferId:o.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),(r,n,i)=>{Ie("PREPARE_OUTPUT",r,{query:t,item:o}).then(t=>{e("DID_PREPARE_OUTPUT",{id:o.id,file:t}),n(t)}).catch(i)})}),RETRY_ITEM_PROCESSING:St(r,t=>{e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:St(r,r=>{Ot(t("GET_BEFORE_REMOVE_FILE"),de(r)).then(t=>{t&&e("REMOVE_ITEM",{query:r})})}),RELEASE_ITEM:St(r,e=>{e.release()}),REMOVE_ITEM:St(r,(o,n,i,s)=>{const a=()=>{const t=o.id;It(r.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:o}),gt(e,r),n(de(o))},l=r.options.server;o.origin===Ee.LOCAL&&l&&Y(l.remove)&&!1!==s.remove?(e("DID_START_ITEM_REMOVE",{id:o.id}),l.remove(o.source,()=>a(),t=>{e("DID_THROW_ITEM_REMOVE_ERROR",{id:o.id,error:Ke("error",0,t,null),status:{main:Rt(r.options.labelFileRemoveError)(t),sub:r.options.labelTapToRetry}})})):((s.revert&&o.origin!==Ee.LOCAL&&null!==o.serverId||r.options.chunkUploads&&o.file.size>r.options.chunkSize||r.options.chunkUploads&&r.options.chunkForce)&&o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")),a())}),ABORT_ITEM_LOAD:St(r,e=>{e.abortLoad()}),ABORT_ITEM_PROCESSING:St(r,t=>{t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(()=>{r.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:St(r,o=>{if(!r.options.instantUpload)return void e("REVERT_ITEM_PROCESSING",{query:o});const n=t=>{t&&e("REVERT_ITEM_PROCESSING",{query:o})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return n(!0);const s=i(de(o));return null==s?n(!0):"boolean"==typeof s?n(s):void("function"==typeof s.then&&s.then(n))}),REVERT_ITEM_PROCESSING:St(r,o=>{o.revert(dt(r.options.server.url,r.options.server.revert),t("GET_FORCE_REVERT")).then(()=>{(r.options.instantUpload||(e=>!_t(e.file))(o))&&e("REMOVE_ITEM",{query:o.id})}).catch(()=>{})}),SET_OPTIONS:({options:t})=>{const r=Object.keys(t),o=At.filter(e=>r.includes(e));[...o,...Object.keys(t).filter(e=>!o.includes(e))].forEach(r=>{e(`SET_${Q(r,"_").toUpperCase()}`,{value:t[r]})})}}),At=["server"],Lt=e=>e,Pt=e=>document.createElement(e),vt=(e,t)=>{let r=e.childNodes[0];r?t!==r.nodeValue&&(r.nodeValue=t):(r=document.createTextNode(t),e.appendChild(r))},Mt=(e,t,r,o)=>{const n=(o%360-90)*Math.PI/180;return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}},bt=(e,t,r,o,n)=>{let i=1;return n>o&&n-o<=.5&&(i=0),o>n&&o-n>=.5&&(i=0),((e,t,r,o,n,i)=>{const s=Mt(e,t,r,n),a=Mt(e,t,r,o);return["M",s.x,s.y,"A",r,r,0,i,0,a.x,a.y].join(" ")})(e,t,r,360*Math.min(.9999,o),360*Math.min(.9999,n),i)},Ct=A({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:({root:e,props:t})=>{t.spin=!1,t.progress=0,t.opacity=0;const r=i("svg");e.ref.path=i("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(e.ref.path),e.ref.svg=r,e.appendChild(r)},write:({root:e,props:t})=>{if(0===t.opacity)return;t.align&&(e.element.dataset.align=t.align);const o=parseInt(r(e.ref.path,"stroke-width"),10),n=.5*e.rect.element.width;let i=0,s=0;t.spin?(i=0,s=.5):(i=0,s=t.progress);const a=bt(n,n,n-o,i,s);r(e.ref.path,"d",a),r(e.ref.path,"stroke-opacity",t.spin||t.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}}}}),Nt=A({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:({root:e,props:t})=>{e.element.innerHTML=(t.icon||"")+`${t.label}`,t.isDisabled=!1},write:({root:e,props:t})=>{const{isDisabled:o}=t,n=e.query("GET_DISABLED")||0===t.opacity;n&&!o?(t.isDisabled=!0,r(e.element,"disabled","disabled")):!n&&o&&(t.isDisabled=!1,e.element.removeAttribute("disabled"))}}),wt=(e,t=".",r=1e3,o={})=>{const{labelBytes:n="bytes",labelKilobytes:i="KB",labelMegabytes:s="MB",labelGigabytes:a="GB"}=o,l=r,c=r*r,d=r*r*r;return(e=Math.round(Math.abs(e)))e.toFixed(t).split(".").filter(e=>"0"!==e).join(r),Ut=({root:e,props:t})=>{vt(e.ref.fileSize,wt(e.query("GET_ITEM_SIZE",t.id),".",e.query("GET_FILE_SIZE_BASE"),e.query("GET_FILE_SIZE_LABELS",e.query))),vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))},Bt=({root:e,props:t})=>{V(e.query("GET_ITEM_SIZE",t.id))?Ut({root:e,props:t}):vt(e.ref.fileSize,e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},Ft=A({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:Ut,DID_UPDATE_ITEM_META:Ut,DID_THROW_ITEM_LOAD_ERROR:Bt,DID_THROW_ITEM_INVALID:Bt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e,props:t})=>{const o=Pt("span");o.className="filepond--file-info-main",r(o,"aria-hidden","true"),e.appendChild(o),e.ref.fileName=o;const n=Pt("span");n.className="filepond--file-info-sub",e.appendChild(n),e.ref.fileSize=n,vt(n,e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),vt(o,Lt(e.query("GET_ITEM_NAME",t.id)))},mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),qt=e=>Math.round(100*e),Vt=({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_LOADING"):`${e.query("GET_LABEL_FILE_LOADING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},xt=({root:e})=>{vt(e.ref.main,""),vt(e.ref.sub,"")},Yt=({root:e,action:t})=>{vt(e.ref.main,t.status.main),vt(e.ref.sub,t.status.sub)},Ht=A({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:xt,DID_REVERT_ITEM_PROCESSING:xt,DID_REQUEST_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_ABORTED")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{vt(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_PROCESSING"):`${e.query("GET_LABEL_FILE_PROCESSING")} ${qt(t.progress)}%`;vt(e.ref.main,r),vt(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:Vt,DID_THROW_ITEM_LOAD_ERROR:Yt,DID_THROW_ITEM_INVALID:Yt,DID_THROW_ITEM_PROCESSING_ERROR:Yt,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Yt,DID_THROW_ITEM_REMOVE_ERROR:Yt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e})=>{const t=Pt("span");t.className="filepond--file-status-main",e.appendChild(t),e.ref.main=t;const r=Pt("span");r.className="filepond--file-status-sub",e.appendChild(r),e.ref.sub=r,Vt({root:e,action:{progress:null}})},mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),kt={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"}},Xt=[];e(kt,e=>{Xt.push(e)});const $t=e=>{if("right"===Qt(e))return 0;const t=e.ref.buttonRemoveItem.rect.element;return t.hidden?null:t.width+t.left},Wt=e=>{return e.ref.buttonAbortItemLoad.rect.element.width},zt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.height/4),jt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.left/2),Qt=e=>e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Zt={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:e=>e.query("GET_STYLE_LOAD_INDICATOR_POSITION")},processProgressIndicator:{opacity:0,align:e=>e.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}},Kt={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},Jt={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},er={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t,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:$t},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:Qt},info:{translateX:$t},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:Qt},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1,translateX:$t}},DID_LOAD_ITEM:Kt,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},DID_START_ITEM_PROCESSING:Jt,DID_REQUEST_ITEM_PROCESSING:Jt,DID_UPDATE_ITEM_PROCESS_PROGRESS:Jt,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:$t}},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:$t},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:Kt},tr=A({create:({root:e})=>{e.element.innerHTML=e.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}}}}),rr=L({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:e,action:t})=>{e.ref.buttonAbortItemProcessing.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:e,action:t})=>{e.ref.buttonAbortItemLoad.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:e,action:t})=>{e.ref.buttonAbortItemRemoval.label=t.value},DID_REQUEST_ITEM_PROCESSING:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:e})=>{e.ref.loadProgressIndicator.spin=!0,e.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:e,action:t})=>{e.ref.loadProgressIndicator.spin=!1,e.ref.loadProgressIndicator.progress=t.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{e.ref.processProgressIndicator.spin=!1,e.ref.processProgressIndicator.progress=t.progress}}),or=A({create:({root:t,props:r})=>{const o=Object.keys(kt).reduce((e,t)=>(e[t]={...kt[t]},e),{}),{id:n}=r,i=t.query("GET_ALLOW_REVERT"),s=t.query("GET_ALLOW_REMOVE"),a=t.query("GET_ALLOW_PROCESS"),l=t.query("GET_INSTANT_UPLOAD"),c=t.query("IS_ASYNC"),d=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");let p;c?a&&!i?p=(e=>!/RevertItemProcessing/.test(e)):!a&&i?p=(e=>!/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(e)):a||i||(p=(e=>!/Process/.test(e))):p=(e=>!/Process/.test(e));const E=p?Xt.filter(p):Xt.concat();if(l&&i&&(o.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",o.RevertItemProcessing.icon="GET_ICON_REMOVE"),c&&!i){const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=jt,e.info.translateY=zt,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(c&&!a&&(["DID_START_ITEM_PROCESSING","DID_REQUEST_ITEM_PROCESSING","DID_UPDATE_ITEM_PROCESS_PROGRESS","DID_THROW_ITEM_PROCESSING_ERROR"].forEach(e=>{er[e].status.translateY=zt}),er.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX=Wt),d&&i){o.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const e=er.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=$t,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}s||(o.RemoveItem.disabled=!0),e(o,(e,r)=>{const o=t.createChildView(Nt,{label:t.query(r.label),icon:t.query(r.icon),opacity:0});E.includes(e)&&t.appendChildView(o),r.disabled&&(o.element.setAttribute("disabled","disabled"),o.element.setAttribute("hidden","hidden")),o.element.dataset.align=t.query(`GET_STYLE_${r.align}`),o.element.classList.add(r.className),o.on("click",e=>{e.stopPropagation(),r.disabled||t.dispatch(r.action,{query:n})}),t.ref[`button${e}`]=o}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(tr)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(Ft,{id:n})),t.ref.status=t.appendChildView(t.createChildView(Ht,{id:n}));const u=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));u.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=u;const _=t.appendChildView(t.createChildView(Ct,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));_.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=_,t.ref.activeStyles=[]},write:({root:t,actions:r,props:o})=>{rr({root:t,actions:r,props:o});let n=r.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>er[e.type]);if(n){t.ref.activeStyles=[];const r=er[n.type];e(Zt,(o,n)=>{const i=t.ref[o];e(n,(e,n)=>{const s=r[o]&&void 0!==r[o][e]?r[o][e]:n;t.ref.activeStyles.push({control:i,key:e,value:s})})})}t.ref.activeStyles.forEach(({control:e,key:r,value:o})=>{e[r]="function"==typeof o?o(t):o})},didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},name:"file"}),nr=A({create:({root:e,props:t})=>{e.ref.fileName=Pt("legend"),e.appendChild(e.ref.fileName),e.ref.file=e.appendChildView(e.createChildView(or,{id:t.id})),e.ref.data=!1},ignoreRect:!0,write:L({DID_LOAD_ITEM:({root:e,props:t})=>{vt(e.ref.fileName,Lt(e.query("GET_ITEM_NAME",t.id)))}}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},tag:"fieldset",name:"file-wrapper"}),ir={type:"spring",damping:.6,mass:7},sr=(e,t,r)=>{const o=A({name:`panel-${t.name} filepond--${r}`,mixins:t.mixins,ignoreRectUpdate:!0}),n=e.createChildView(o,t.props);e.ref[t.name]=e.appendChildView(n)},ar=A({name:"panel",read:({root:e,props:t})=>t.heightCurrent=e.ref.bottom.translateY,write:({root:e,props:t})=>{if(null!==e.ref.scalable&&t.scalable===e.ref.scalable||(e.ref.scalable=!w(t.scalable)||t.scalable,e.element.dataset.scalable=e.ref.scalable),!t.height)return;const r=e.ref.top.rect.element,o=e.ref.bottom.rect.element,n=Math.max(r.height+o.height,t.height);e.ref.center.translateY=r.height,e.ref.center.scaleY=(n-r.height-o.height)/100,e.ref.bottom.translateY=n-o.height},create:({root:e,props:t})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:ir},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:ir},styles:["translateY"]}}].forEach(r=>{sr(e,r,t.name)}),e.element.classList.add(`filepond--${t.name}`),e.ref.scalable=null},ignoreRect:!0,mixins:{apis:["height","heightCurrent","scalable"]}}),lr={type:"spring",stiffness:.75,damping:.45,mass:10},cr={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"},dr=L({DID_UPDATE_PANEL_HEIGHT:({root:e,action:t})=>{e.height=t.height}}),pr=L({DID_GRAB_ITEM:({root:e,props:t})=>{t.dragOrigin={x:e.translateX,y:e.translateY}},DID_DRAG_ITEM:({root:e})=>{e.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:e,props:t})=>{t.dragOffset=null,t.dragOrigin=null,e.element.dataset.dragState="drop"}},({root:e,actions:t,props:r,shouldOptimize:o})=>{"drop"===e.element.dataset.dragState&&e.scaleX<=1&&(e.element.dataset.dragState="idle");let n=t.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>cr[e.type]);n&&n.type!==r.currentState&&(r.currentState=n.type,e.element.dataset.filepondItemState=cr[r.currentState]||"");const i=e.query("GET_ITEM_PANEL_ASPECT_RATIO")||e.query("GET_PANEL_ASPECT_RATIO");i?o||(e.height=e.rect.element.width*i):(dr({root:e,actions:t,props:r}),!e.height&&e.ref.container.rect.element.height>0&&(e.height=e.ref.container.rect.element.height)),o&&(e.ref.panel.height=null),e.ref.panel.height=e.height}),Er=A({create:({root:e,props:t})=>{if(e.ref.handleClick=(r=>e.dispatch("DID_ACTIVATE_ITEM",{id:t.id})),e.element.id=`filepond--item-${t.id}`,e.element.addEventListener("click",e.ref.handleClick),e.ref.container=e.appendChildView(e.createChildView(nr,{id:t.id})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"item-panel"})),e.ref.panel.height=null,t.markedForRemoval=!1,!e.query("GET_ALLOW_REORDER"))return;e.element.dataset.dragState="idle";e.element.addEventListener("pointerdown",r=>{if(!r.isPrimary)return;let o=!1;const n=r.pageX,i=r.pageY;t.dragOrigin={x:e.translateX,y:e.translateY},t.dragCenter={x:r.offsetX,y:r.offsetY};const s=(e=>{const t=e.map(e=>e.id);let r=void 0;return{setIndex:e=>{r=e},getIndex:()=>r,getItemIndex:e=>t.indexOf(e.id)}})(e.query("GET_ACTIVE_ITEMS"));e.dispatch("DID_GRAB_ITEM",{id:t.id,dragState:s});const a=r=>{r.isPrimary&&(r.stopPropagation(),r.preventDefault(),t.dragOffset={x:r.pageX-n,y:r.pageY-i},t.dragOffset.x*t.dragOffset.x+t.dragOffset.y*t.dragOffset.y>16&&!o&&(o=!0,e.element.removeEventListener("click",e.ref.handleClick)),e.dispatch("DID_DRAG_ITEM",{id:t.id,dragState:s}))},l=r=>{r.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",l),t.dragOffset={x:r.pageX-n,y:r.pageY-i},e.dispatch("DID_DROP_ITEM",{id:t.id,dragState:s}),o&&setTimeout(()=>e.element.addEventListener("click",e.ref.handleClick),0))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",l)})},write:pr,destroy:({root:e,props:t})=>{e.element.removeEventListener("click",e.ref.handleClick),e.dispatch("RELEASE_ITEM",{query:t.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:lr,translateY:lr,opacity:{type:"tween",duration:150}}}});var ur=(e,t)=>Math.max(1,Math.floor((e+1)/t));const _r=(e,t,r)=>{if(!r)return;const o=e.rect.element.width,n=t.length;let i=null;if(0===n||r.topa){if(r.left{e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=r,Date.now()>e.spawnDate&&(0===e.opacity&&Ir(e,t,r,o,n),e.scaleX=1,e.scaleY=1,e.opacity=1))},Ir=(e,t,r,o,n)=>{e.interactionMethod===ne?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=r):e.interactionMethod===te?(e.translateX=null,e.translateX=t-20*o,e.translateY=null,e.translateY=r-10*n,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=r-30):e.interactionMethod===ee&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},mr=e=>e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop,hr=L({DID_ADD_ITEM:({root:e,action:t})=>{const{id:r,index:o,interactionMethod:n}=t;e.ref.addIndex=o;const i=Date.now();let s=i,a=1;if(n!==ne){a=0;const t=e.query("GET_ITEM_INSERT_INTERVAL"),r=i-e.ref.lastItemSpanwDate;s=r{const{id:r}=t,o=e.childViews.find(e=>e.id===r);o&&(o.scaleX=.9,o.scaleY=.9,o.opacity=0,o.markedForRemoval=!0)},DID_DRAG_ITEM:({root:e,action:t})=>{const{id:r,dragState:o}=t,n=e.query("GET_ITEM",{id:r}),i=e.childViews.find(e=>e.id===r),s=e.childViews.length,a=o.getItemIndex(n);if(!i)return;const l=i.dragOrigin.x+i.dragOffset.x+i.dragCenter.x,c=i.dragOrigin.y+i.dragOffset.y+i.dragCenter.y,d=mr(i),p=(e=>e.rect.element.width+.5*e.rect.element.marginLeft+.5*e.rect.element.marginRight)(i);let E=Math.floor(e.rect.outer.width/p);E>s&&(E=s);const u=Math.floor(s/E+1);Tr.setHeight=d*u,Tr.setWidth=p*E;var _={y:Math.floor(c/d),x:Math.floor(l/p),getGridIndex:function(){return c>Tr.getHeight||c<0||l>Tr.getWidth||l<0?a:this.y*E+this.x},getColIndex:function(){const t=e.query("GET_ACTIVE_ITEMS"),r=e.childViews.filter(e=>e.rect.element.height),o=t.map(e=>r.find(t=>t.id===e.id)),n=o.findIndex(e=>e===i),s=mr(i),a=o.length;let l=a,d=0,p=0,E=0;for(let e=0;ee){if(c1?_.getGridIndex():_.getColIndex();e.dispatch("MOVE_ITEM",{query:i,index:T});const f=o.getIndex();if(void 0===f||f!==T){if(o.setIndex(T),void 0===f)return;e.dispatch("DID_REORDER_ITEMS",{items:e.query("GET_ACTIVE_ITEMS"),origin:a,target:T})}}}),Rr=A({create:({root:e})=>{r(e.element,"role","list"),e.ref.lastItemSpanwDate=Date.now()},write:({root:e,props:t,actions:r,shouldOptimize:o})=>{hr({root:e,props:t,actions:r});const{dragCoordinates:n}=t,i=e.rect.element.width,s=e.childViews.filter(e=>e.rect.element.height),a=e.query("GET_ACTIVE_ITEMS").map(e=>s.find(t=>t.id===e.id)).filter(e=>e),l=n?_r(e,a,n):null,c=e.ref.addIndex||null;e.ref.addIndex=null;let d=0,p=0,E=0;if(0===a.length)return;const u=a[0].rect.element,_=u.marginTop+u.marginBottom,T=u.marginLeft+u.marginRight,f=u.width+T,I=ur(i,f);if(1===I){let e=0,t=0;a.forEach((r,n)=>{if(l){let e=n-l;t=-2===e?.25*-_:-1===e?.75*-_:0===e?.75*_:1===e?.25*_:0}o&&(r.translateX=null,r.translateY=null),r.markedForRemoval||fr(r,0,e+t);let i=(r.rect.element.height+_)*(r.markedForRemoval?r.opacity:1);e+=i})}else{let e=0,t=0,r=0;a.forEach((n,i)=>{i===l&&(d=1),i===c&&(E+=1),n.markedForRemoval&&n.opacity<.5&&(p-=1);const s=(i+E+d+p)%I,u=n.rect.element.height+_;u>r&&(r=u);const T=s+1===I||!a[i+1],m=s*f,h=t,R=Math.sign(m-e),g=Math.sign(h-t);e=m,T&&(t+=r,r=0),n.markedForRemoval||(o&&(n.translateX=null,n.translateY=null),fr(n,m,h,R,g))})}},tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(e=>e.markedForRemoval&&0===e.opacity&&e.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:(e,t)=>t.filter(t=>!t.data||!t.data.id||e.id===t.data.id),mixins:{apis:["dragCoordinates"]}}),gr=L({DID_DRAG:({root:e,props:t,action:r})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:r.position.scopeLeft-e.ref.list.rect.element.left,top:r.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},DID_END_DRAG:({props:e})=>{e.dragCoordinates=null}}),Or=A({create:({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(Rr)),t.dragCoordinates=null,t.overflowing=!1},write:({root:e,props:t,actions:r})=>{if(gr({root:e,props:t,actions:r}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){const r=Math.round(t.overflow);r!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Dr=(e,t,o,n="")=>{o?r(e,t,n):e.removeAttribute(t)},Sr=({root:e,action:t})=>{e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Dr(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},yr=({root:e,action:t})=>{Dr(e.element,"multiple",t.value)},Ar=({root:e,action:t})=>{Dr(e.element,"webkitdirectory",t.value)},Lr=({root:e})=>{const t=e.query("GET_DISABLED"),r=e.query("GET_ALLOW_BROWSE"),o=t||!r;Dr(e.element,"disabled",o)},Pr=({root:e,action:t})=>{t.value?0===e.query("GET_TOTAL_ITEMS")&&Dr(e.element,"required",!0):Dr(e.element,"required",!1)},vr=({root:e,action:t})=>{Dr(e.element,"capture",!!t.value,!0===t.value?"":t.value)},Mr=({root:e})=>{const{element:t}=e;if(e.query("GET_TOTAL_ITEMS")>0)Dr(t,"required",!1),Dr(t,"name",!1);else{Dr(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&Dr(t,"required",!0)}},br=A({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,r(e.element,"name",e.query("GET_NAME")),r(e.element,"aria-controls",`filepond--assistant-${t.id}`),r(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),Sr({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),yr({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Ar({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Lr({root:e}),Pr({root:e,action:{value:e.query("GET_REQUIRED")}}),vr({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=(r=>{if(!e.element.value)return;const o=Array.from(e.element.files).map(e=>(e._relativePath=e.webkitRelativePath,e));setTimeout(()=>{t.onload(o),(e=>{if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){const t=Pt("form"),r=e.parentNode,o=e.nextSibling;t.appendChild(e),t.reset(),o?r.insertBefore(e,o):r.appendChild(e)}}})(e.element)},250)}),e.element.addEventListener("change",e.ref.handleChange)},destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:L({DID_LOAD_ITEM:Mr,DID_REMOVE_ITEM:Mr,DID_THROW_ITEM_INVALID:({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Lr,DID_SET_ALLOW_BROWSE:Lr,DID_SET_ALLOW_DIRECTORIES_ONLY:Ar,DID_SET_ALLOW_MULTIPLE:yr,DID_SET_ACCEPTED_FILE_TYPES:Sr,DID_SET_CAPTURE_METHOD:vr,DID_SET_REQUIRED:Pr})}),Cr=13,Nr=32,wr=(e,t)=>{e.innerHTML=t;const o=e.querySelector(".filepond--label-action");return o&&r(o,"tabindex","0"),t},Gr=A({name:"drop-label",ignoreRect:!0,create:({root:e,props:t})=>{const o=Pt("label");r(o,"for",`filepond--browser-${t.id}`),r(o,"id",`filepond--drop-label-${t.id}`),r(o,"aria-hidden","true"),e.ref.handleKeyDown=(t=>{(t.keyCode===Cr||t.keyCode===Nr)&&(t.preventDefault(),e.ref.label.click())}),e.ref.handleClick=(t=>{t.target===o||o.contains(t.target)||e.ref.label.click()}),o.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),wr(o,t.caption),e.appendChild(o),e.ref.label=o},destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:L({DID_SET_LABEL_IDLE:({root:e,action:t})=>{wr(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Ur=A({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}}}}),Br=L({DID_DRAG:({root:e,action:t})=>{e.ref.blob?(e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1):(({root:e})=>{const t=.5*e.rect.element.width,r=.5*e.rect.element.height;e.ref.blob=e.appendChildView(e.createChildView(Ur,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:r}))})({root:e})},DID_DROP:({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},DID_END_DRAG:({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)}}),Fr=A({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:({root:e,props:t,actions:r})=>{Br({root:e,props:t,actions:r});const{blob:o}=e.ref;0===r.length&&o&&0===o.opacity&&(e.removeChildView(o),e.ref.blob=null)}}),qr=(e,t)=>{try{const r=new DataTransfer;t.forEach(e=>{e instanceof File?r.items.add(e):r.items.add(new File([e],e.name,{type:e.type}))}),e.files=r.files}catch(e){return!1}return!0},Vr=(e,t)=>e.ref.fields[t],xr=e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Yr=({root:e})=>xr(e),Hr=L({DID_SET_DISABLED:({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},DID_ADD_ITEM:({root:e,action:t})=>{const r=!(e.query("GET_ITEM",t.id).origin===Ee.LOCAL)&&e.query("SHOULD_UPDATE_FILE_INPUT"),o=Pt("input");o.type=r?"file":"hidden",o.name=e.query("GET_NAME"),o.disabled=e.query("GET_DISABLED"),e.ref.fields[t.id]=o,xr(e)},DID_LOAD_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);if(!r)return;if(null!==t.serverFileReference&&(r.value=t.serverFileReference),!e.query("SHOULD_UPDATE_FILE_INPUT"))return;const o=e.query("GET_ITEM",t.id);qr(r,[o.file])},DID_REMOVE_ITEM:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete e.ref.fields[t.id])},DID_DEFINE_VALUE:({root:e,action:t})=>{const r=Vr(e,t.id);r&&(null===t.value?r.removeAttribute("value"):r.value=t.value,xr(e))},DID_PREPARE_OUTPUT:({root:e,action:t})=>{e.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(()=>{const r=Vr(e,t.id);r&&qr(r,[t.file])},0)},DID_REORDER_ITEMS:Yr,DID_SORT_ITEMS:Yr}),kr=A({tag:"fieldset",name:"data",create:({root:e})=>e.ref.fields={},write:Hr,ignoreRect:!0}),Xr=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],$r=["css","csv","html","txt"],Wr={zip:"zip|compressed",epub:"application/epub+zip"},zr=(e="")=>(e=e.toLowerCase(),Xr.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):$r.includes(e)?"text/"+e:Wr[e]||""),jr=e=>new Promise((t,r)=>{const o=io(e);if(o.length&&!Qr(e))return t(o);Zr(e).then(t)}),Qr=e=>!!e.files&&e.files.length>0,Zr=e=>new Promise((t,r)=>{const o=(e.items?Array.from(e.items):[]).filter(e=>Kr(e)).map(e=>Jr(e));o.length?Promise.all(o).then(e=>{const r=[];e.forEach(e=>{r.push.apply(r,e)}),t(r.filter(e=>e).map(e=>(e._relativePath||(e._relativePath=e.webkitRelativePath),e)))}).catch(console.error):t(e.files?Array.from(e.files):[])}),Kr=e=>{if(oo(e)){const t=no(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},Jr=e=>new Promise((t,r)=>{ro(e)?eo(no(e)).then(t).catch(r):t([e.getAsFile()])}),eo=e=>new Promise((t,r)=>{const o=[];let n=0,i=0;const s=()=>{0===i&&0===n&&t(o)},a=e=>{n++;const t=e.createReader(),l=()=>{t.readEntries(e=>{if(0===e.length)return n--,void s();e.forEach(e=>{e.isDirectory?a(e):(i++,e.file(t=>{const r=to(t);e.fullPath&&(r._relativePath=e.fullPath),o.push(r),i--,s()}))}),l()},r)};l()};a(e)}),to=e=>{if(e.type.length)return e;const t=e.lastModifiedDate,r=e.name,o=zr(Fe(e.name));return o.length?((e=e.slice(0,e.size,o)).name=r,e.lastModifiedDate=t,e):e},ro=e=>oo(e)&&(no(e)||{}).isDirectory,oo=e=>"webkitGetAsEntry"in e,no=e=>e.webkitGetAsEntry(),io=e=>{let t=[];try{if((t=ao(e)).length)return t;t=so(e)}catch(e){}return t},so=e=>{let t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},ao=e=>{let t=e.getData("text/html");if("string"==typeof t&&t.length){const e=t.match(/src\s*=\s*"(.+?)"/);if(e)return[e[1]]}return[]},lo=[],co=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),po=e=>{const t=lo.find(t=>t.element===e);if(t)return t;const r=Eo(e);return lo.push(r),r},Eo=t=>{const r=[],o={dragenter:fo,dragover:Io,dragleave:ho,drop:mo},n={};e(o,(e,o)=>{n[e]=o(t,r),t.addEventListener(e,n[e],!1)});const i={element:t,addListener:s=>(r.push(s),()=>{r.splice(r.indexOf(s),1),0===r.length&&(lo.splice(lo.indexOf(i),1),e(o,e=>{t.removeEventListener(e,n[e],!1)}))})};return i},uo=(e,t)=>{const r=((e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)))((e=>"getRootNode"in e?e.getRootNode():document)(t),{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)};let _o=null;const To=(e,t)=>{try{e.dropEffect=t}catch(e){}},fo=(e,t)=>e=>{e.preventDefault(),_o=e.target,t.forEach(t=>{const{element:r,onenter:o}=t;uo(e,r)&&(t.state="enter",o(co(e)))})},Io=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(o=>{let n=!1;t.some(t=>{const{filterElement:i,element:s,onenter:a,onexit:l,ondrag:c,allowdrop:d}=t;To(r,"copy");const p=d(o);if(p)if(uo(e,s)){if(n=!0,null===t.state)return t.state="enter",void a(co(e));if(t.state="over",i&&!p)return void To(r,"none");c(co(e))}else i&&!n&&To(r,"none"),t.state&&(t.state=null,l(co(e)));else To(r,"none")})})},mo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;jr(r).then(r=>{t.forEach(t=>{const{filterElement:o,element:n,ondrop:i,onexit:s,allowdrop:a}=t;if(t.state=null,!o||uo(e,n))return a(r)?void i(co(e),r):s(co(e))})})},ho=(e,t)=>e=>{_o===e.target&&t.forEach(t=>{const{onexit:r}=t;t.state=null,r(co(e))})},Ro=(e,t,r)=>{e.classList.add("filepond--hopper");const{catchesDropsOnPage:o,requiresDropOnElement:n,filterItems:i=(e=>e)}=r,s=((e,t,r)=>{const o=po(t),n={element:e,filterElement:r,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=o.addListener(n),n})(e,o?document.documentElement:e,n);let a="",l="";s.allowdrop=(e=>t(i(e))),s.ondrop=((e,r)=>{const o=i(r);t(o)?(l="drag-drop",c.onload(o,e)):c.ondragend(e)}),s.ondrag=(e=>{c.ondrag(e)}),s.onenter=(e=>{l="drag-over",c.ondragstart(e)}),s.onexit=(e=>{l="drag-exit",c.ondragend(e)});const c={updateHopperState:()=>{a!==l&&(e.dataset.hopperState=l,a=l)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{s.destroy()}};return c};let go=!1;const Oo=[],Do=e=>{const t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){let e=!1,r=t;for(;r!==document.body;){if(r.classList.contains("filepond--root")){e=!0;break}r=r.parentNode}if(!e)return}jr(e.clipboardData).then(e=>{e.length&&Oo.forEach(t=>t(e))})},So=()=>{const e=e=>{t.onload(e)},t={destroy:()=>{(e=>{se(Oo,Oo.indexOf(e)),0===Oo.length&&(document.removeEventListener("paste",Do),go=!1)})(e)},onload:()=>{}};return(e=>{Oo.includes(e)||(Oo.push(e),go||(go=!0,document.addEventListener("paste",Do)))})(e),t};let yo=null,Ao=null;const Lo=[],Po=(e,t)=>{e.element.textContent=t},vo=(e,t,r)=>{const o=e.query("GET_TOTAL_ITEMS");Po(e,`${r} ${t}, ${o} ${1===o?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(Ao),Ao=setTimeout(()=>{(e=>{e.element.textContent=""})(e)},1500)},Mo=e=>e.element.parentNode.contains(document.activeElement),bo=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");Po(e,`${r} ${o}`)},Co=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename;Po(e,`${t.status.main} ${r} ${t.status.sub}`)},No=A({create:({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,r(e.element,"role","status"),r(e.element,"aria-live","polite"),r(e.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:({root:e,action:t})=>{if(!Mo(e))return;e.element.textContent="";const r=e.query("GET_ITEM",t.id);Lo.push(r.filename),clearTimeout(yo),yo=setTimeout(()=>{vo(e,Lo.join(", "),e.query("GET_LABEL_FILE_ADDED")),Lo.length=0},750)},DID_REMOVE_ITEM:({root:e,action:t})=>{if(!Mo(e))return;const r=t.item;vo(e,r.filename,e.query("GET_LABEL_FILE_REMOVED"))},DID_COMPLETE_ITEM_PROCESSING:({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Po(e,`${r} ${o}`)},DID_ABORT_ITEM_PROCESSING:bo,DID_REVERT_ITEM_PROCESSING:bo,DID_THROW_ITEM_REMOVE_ERROR:Co,DID_THROW_ITEM_LOAD_ERROR:Co,DID_THROW_ITEM_INVALID:Co,DID_THROW_ITEM_PROCESSING_ERROR:Co}),tag:"span",name:"assistant"}),wo=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),e=>e.charAt(1).toUpperCase()),Go=(e,t=16,r=!0)=>{let o=Date.now(),n=null;return(...i)=>{clearTimeout(n);const s=Date.now()-o,a=()=>{o=Date.now(),e(...i)};se.preventDefault(),Bo=e=>{const t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},Fo=e=>{let t=0,r=0;const o=e.ref.list.childViews[0],n=o.childViews.filter(e=>e.rect.element.height),i=e.query("GET_ACTIVE_ITEMS").map(e=>n.find(t=>t.id===e.id)).filter(e=>e);if(0===i.length)return{visual:t,bounds:r};const s=o.rect.element.width,a=i[0].rect.element,l=a.marginTop+a.marginBottom,c=a.marginLeft+a.marginRight,d=a.width+c,p=ur(s,d);if(1===p)i.forEach(e=>{const o=e.rect.element.height+l;r+=o,t+=o*e.opacity});else{let e=0,o=0;i.forEach(function(t,r){let n=t.rect.element.height+l;const s=Math.floor(r/p),a=Math.floor(r-s*p)+1===p||!i[r+1];n>e&&(e=n),a&&(o+=e,e=0)}),t=r=o}return{visual:t,bounds:r}},qo=e=>{const t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Vo=(e,t)=>{const r=e.query("GET_ALLOW_REPLACE"),o=e.query("GET_ALLOW_MULTIPLE"),n=e.query("GET_TOTAL_ITEMS");let i=e.query("GET_MAX_FILES");const s=t.length;return!o&&s>1?(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ke("warning",0,"Max files")}),!0):!(!o&&r)&&(!!(V(i=o?i:1)&&n+s>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ke("warning",0,"Max files")}),!0))},xo=(e,t,r)=>{const o=e.childViews[0];return _r(o,t,{left:r.scopeLeft-o.rect.element.left,top:r.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Yo=e=>{const t=e.query("GET_ALLOW_DROP"),r=e.query("GET_DISABLED"),o=t&&!r;if(o&&!e.ref.hopper){const t=Ro(e.element,t=>{const r=e.query("GET_BEFORE_DROP_FILE")||(()=>!0);return!e.query("GET_DROP_VALIDATION")||t.every(t=>me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(e=>!0===e)&&r(t))},{filterItems:t=>{const r=e.query("GET_IGNORED_FILES");return t.filter(e=>!_t(e)||!r.includes(e.name.toLowerCase()))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});t.onload=((t,r)=>{const o=e.ref.list.childViews[0].childViews.filter(e=>e.rect.element.height),n=e.query("GET_ACTIVE_ITEMS").map(e=>o.find(t=>t.id===e.id)).filter(e=>e);Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:xo(e.ref.list,n,r),interactionMethod:te})}),e.dispatch("DID_DROP",{position:r}),e.dispatch("DID_END_DRAG",{position:r})}),t.ondragstart=(t=>{e.dispatch("DID_START_DRAG",{position:t})}),t.ondrag=Go(t=>{e.dispatch("DID_DRAG",{position:t})}),t.ondragend=(t=>{e.dispatch("DID_END_DRAG",{position:t})}),e.ref.hopper=t,e.ref.drip=e.appendChildView(e.createChildView(Fr))}else!o&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Ho=(e,t)=>{const r=e.query("GET_ALLOW_BROWSE"),o=e.query("GET_DISABLED"),n=r&&!o;n&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(br,{...t,onload:t=>{Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})})}}),0):!n&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},ko=e=>{const t=e.query("GET_ALLOW_PASTE"),r=e.query("GET_DISABLED"),o=t&&!r;o&&!e.ref.paster?(e.ref.paster=So(),e.ref.paster.onload=(t=>{Ie("ADD_ITEMS",t,{dispatch:e.dispatch}).then(t=>{if(Vo(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})})})):!o&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Xo=L({DID_SET_ALLOW_BROWSE:({root:e,props:t})=>{Ho(e,t)},DID_SET_ALLOW_DROP:({root:e})=>{Yo(e)},DID_SET_ALLOW_PASTE:({root:e})=>{ko(e)},DID_SET_DISABLED:({root:e,props:t})=>{Yo(e),ko(e),Ho(e,t),e.query("GET_DISABLED")?e.element.dataset.disabled="disabled":e.element.removeAttribute("data-disabled")}}),$o=A({name:"root",read:({root:e})=>{e.ref.measure&&(e.ref.measureHeight=e.ref.measure.offsetHeight)},create:({root:e,props:t})=>{const r=e.query("GET_ID");r&&(e.element.id=r);const o=e.query("GET_CLASS_NAME");o&&o.split(" ").filter(e=>e.length).forEach(t=>{e.element.classList.add(t)}),e.ref.label=e.appendChildView(e.createChildView(Gr,{...t,translateY:null,caption:e.query("GET_LABEL_IDLE")})),e.ref.list=e.appendChildView(e.createChildView(Or,{translateY:null})),e.ref.panel=e.appendChildView(e.createChildView(ar,{name:"panel-root"})),e.ref.assistant=e.appendChildView(e.createChildView(No,{...t})),e.ref.data=e.appendChildView(e.createChildView(kr,{...t})),e.ref.measure=Pt("div"),e.ref.measure.style.height="100%",e.element.appendChild(e.ref.measure),e.ref.bounds=null,e.query("GET_STYLES").filter(e=>!b(e.value)).map(({name:t,value:r})=>{e.element.dataset[t]=r}),e.ref.widthPrevious=null,e.ref.widthUpdated=Go(()=>{e.ref.updateHistory=[],e.dispatch("DID_RESIZE_ROOT")},250),e.ref.previousAspectRatio=null,e.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,i="PointerEvent"in window;e.query("GET_ALLOW_REORDER")&&i&&!n&&(e.element.addEventListener("touchmove",Uo,{passive:!1}),e.element.addEventListener("gesturestart",Uo));const s=e.query("GET_CREDITS");if(2===s.length){const t=document.createElement("a");t.className="filepond--credits",t.setAttribute("aria-hidden","true"),t.href=s[0],t.tabindex=-1,t.target="_blank",t.rel="noopener noreferrer",t.textContent=s[1],e.element.appendChild(t),e.ref.credits=t}},write:({root:e,props:t,actions:r})=>{if(Xo({root:e,props:t,actions:r}),r.filter(e=>/^DID_SET_STYLE_/.test(e.type)).filter(e=>!b(e.data.value)).map(({type:t,data:r})=>{const o=wo(t.substring(8).toLowerCase(),"_");e.element.dataset[o]=r.value,e.invalidateLayout()}),e.rect.element.hidden)return;e.rect.element.width!==e.ref.widthPrevious&&(e.ref.widthPrevious=e.rect.element.width,e.ref.widthUpdated());let o=e.ref.bounds;o||(o=e.ref.bounds=qo(e),e.element.removeChild(e.ref.measure),e.ref.measure=null);const{hopper:n,label:i,list:s,panel:a}=e.ref;n&&n.updateHopperState();const l=e.query("GET_PANEL_ASPECT_RATIO"),c=e.query("GET_ALLOW_MULTIPLE"),d=e.query("GET_TOTAL_ITEMS"),p=d===(c?e.query("GET_MAX_FILES")||1e6:1),E=r.find(e=>"DID_ADD_ITEM"===e.type);if(p&&E){const e=E.data.interactionMethod;i.opacity=0,c?i.translateY=-40:e===ee?i.translateX=40:i.translateY=e===re?40:30}else p||(i.opacity=1,i.translateX=0,i.translateY=0);const u=Bo(e),_=Fo(e),T=i.rect.element.height,f=!c||p?0:T,I=p?s.rect.element.marginTop:0,m=0===d?0:s.rect.element.marginBottom,h=f+I+_.visual+m,R=f+I+_.bounds+m;if(s.translateY=Math.max(0,f-s.rect.element.marginTop)-u.top,l){const t=e.rect.element.width,r=t*l;l!==e.ref.previousAspectRatio&&(e.ref.previousAspectRatio=l,e.ref.updateHistory=[]);const o=e.ref.updateHistory;o.push(t);const n=2;if(o.length>2*n){const e=o.length,t=e-10;let r=0;for(let i=e;i>=t;i--)if(o[i]===o[i-2]&&r++,r>=n)return}a.scalable=!1,a.height=r;const i=r-f-(m-u.bottom)-(p?I:0);_.visual>i?s.overflow=i:s.overflow=null,e.height=r}else if(o.fixedHeight){a.scalable=!1;const e=o.fixedHeight-f-(m-u.bottom)-(p?I:0);_.visual>e?s.overflow=e:s.overflow=null}else if(o.cappedHeight){const t=h>=o.cappedHeight,r=Math.min(o.cappedHeight,h);a.scalable=!0,a.height=t?r:r-u.top-u.bottom;const n=r-f-(m-u.bottom)-(p?I:0);h>o.cappedHeight&&_.visual>n?s.overflow=n:s.overflow=null,e.height=Math.min(o.cappedHeight,R-u.top-u.bottom)}else{const t=d>0?u.top+u.bottom:0;a.scalable=!0,a.height=Math.max(T,h-t),e.height=Math.max(T,R-t)}e.ref.credits&&a.heightCurrent&&(e.ref.credits.style.transform=`translateY(${a.heightCurrent}px)`)},destroy:({root:e})=>{e.ref.paster&&e.ref.paster.destroy(),e.ref.hopper&&e.ref.hopper.destroy(),e.element.removeEventListener("touchmove",Uo),e.element.removeEventListener("gesturestart",Uo)},mixins:{styles:["height"]}}),Wo=(e={})=>{let r=null;const o=Re(),n=((e,t=[],r=[])=>{const o={...e},n=[],i=[],s=(e,t,r)=>{!r||document.hidden?(d[e]&&d[e](t),n.push({type:e,data:t})):i.push({type:e,data:t})},a=(e,...t)=>c[e]?c[e](...t):null,l={getState:()=>({...o}),processActionQueue:()=>{const e=[...n];return n.length=0,e},processDispatchQueue:()=>{const e=[...i];i.length=0,e.forEach(({type:e,data:t})=>{s(e,t)})},dispatch:s,query:a};let c={};t.forEach(e=>{c={...e(o),...c}});let d={};return r.forEach(e=>{d={...e(s,a,o),...d}}),l})((e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:j(e)}))(o),[we,J(o)],[yt,K(o)]);n.dispatch("SET_OPTIONS",{options:e});const i=()=>{document.hidden||n.dispatch("KICK")};document.addEventListener("visibilitychange",i);let s=null,a=!1,l=!1,c=null,d=null;const p=()=>{a||(a=!0),clearTimeout(s),s=setTimeout(()=>{a=!1,c=null,d=null,l&&(l=!1,n.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const E=$o(n,{id:ie()});let u=!1,_=!1;const f={_read:()=>{a&&(d=window.innerWidth,c||(c=d),l||d===c||(n.dispatch("DID_START_RESIZE"),l=!0)),_&&u&&(u=null===E.element.offsetParent),u||(E._read(),_=E.rect.element.hidden)},_write:e=>{const t=n.processActionQueue().filter(e=>!/^SET_/.test(e.type));u&&!t.length||(R(t),u=E._write(e,t,l),(e=>{e.forEach((t,r)=>{t.released&&se(e,r)})})(n.query("GET_ITEMS")),u&&n.processDispatchQueue())}},I=e=>t=>{const r={type:e};if(!t)return r;if(t.hasOwnProperty("error")&&(r.error=t.error?{...t.error}:null),t.status&&(r.status={...t.status}),t.file&&(r.output=t.file),t.source)r.file=t.source;else if(t.item||t.id){const e=t.item?t.item:n.query("GET_ITEM",t.id);r.file=e?de(e):null}return t.items&&(r.items=t.items.map(de)),/progress/.test(e)&&(r.progress=t.progress),t.hasOwnProperty("origin")&&t.hasOwnProperty("target")&&(r.origin=t.origin,r.target=t.target),r},m={DID_DESTROY:I("destroy"),DID_INIT:I("init"),DID_THROW_MAX_FILES:I("warning"),DID_INIT_ITEM:I("initfile"),DID_START_ITEM_LOAD:I("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:I("addfileprogress"),DID_LOAD_ITEM:I("addfile"),DID_THROW_ITEM_INVALID:[I("error"),I("addfile")],DID_THROW_ITEM_LOAD_ERROR:[I("error"),I("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[I("error"),I("removefile")],DID_PREPARE_OUTPUT:I("preparefile"),DID_START_ITEM_PROCESSING:I("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:I("processfileprogress"),DID_ABORT_ITEM_PROCESSING:I("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:I("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:I("processfiles"),DID_REVERT_ITEM_PROCESSING:I("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[I("error"),I("processfile")],DID_REMOVE_ITEM:I("removefile"),DID_UPDATE_ITEMS:I("updatefiles"),DID_ACTIVATE_ITEM:I("activatefile"),DID_REORDER_ITEMS:I("reorderfiles")},h=e=>{const t={pond:A,...e};delete t.type,E.element.dispatchEvent(new CustomEvent(`FilePond:${e.type}`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const r=[];e.hasOwnProperty("error")&&r.push(e.error),e.hasOwnProperty("file")&&r.push(e.file);const o=["type","error","file"];Object.keys(e).filter(e=>!o.includes(e)).forEach(t=>r.push(e[t])),A.fire(e.type,...r);const i=n.query(`GET_ON${e.type.toUpperCase()}`);i&&i(...r)},R=e=>{e.length&&e.filter(e=>m[e.type]).forEach(e=>{const t=m[e.type];(Array.isArray(t)?t:[t]).forEach(t=>{"DID_INIT_ITEM"===e.type?h(t(e.data)):setTimeout(()=>{h(t(e.data))},0)})})},g=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),O=(e,t)=>("object"!=typeof e||(e=>e.file&&e.id)(e)||t||(t=e,e=void 0),n.dispatch("REMOVE_ITEM",{...t,query:e}),null===n.query("GET_ACTIVE_ITEM",e)),D=(...e)=>new Promise((t,r)=>{const o=[],i={};if(M(e[0]))o.push.apply(o,e[0]),Object.assign(i,e[1]||{});else{const t=e[e.length-1];"object"!=typeof t||t instanceof Blob||Object.assign(i,e.pop()),o.push(...e)}n.dispatch("ADD_ITEMS",{items:o,index:i.index,interactionMethod:ee,success:t,failure:r})}),S=()=>n.query("GET_ACTIVE_ITEMS"),y=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PROCESSING",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),A={...ae(),...f,...Z(n,o),setOptions:e=>n.dispatch("SET_OPTIONS",{options:e}),addFile:(e,t={})=>new Promise((r,o)=>{D([{source:e,options:t}],{index:t.index}).then(e=>r(e&&e[0])).catch(o)}),addFiles:D,getFile:e=>n.query("GET_ACTIVE_ITEM",e),processFile:y,prepareFile:g,removeFile:O,moveFile:(e,t)=>n.dispatch("MOVE_ITEM",{query:e,index:t}),getFiles:S,processFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;if(!t.length){const e=S().filter(e=>!(e.status===pe.IDLE&&e.origin===Ee.LOCAL)&&e.status!==pe.PROCESSING&&e.status!==pe.PROCESSING_COMPLETE&&e.status!==pe.PROCESSING_REVERT_ERROR);return Promise.all(e.map(y))}return Promise.all(t.map(y))},removeFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;let r;"object"==typeof t[t.length-1]?r=t.pop():Array.isArray(e[0])&&(r=e[1]);const o=S();return t.length?t.map(e=>T(e)?o[e]?o[e].id:null:e).filter(e=>e).map(e=>O(e,r)):Promise.all(o.map(e=>O(e,r)))},prepareFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=t.length?t:S();return Promise.all(r.map(g))},sort:e=>n.dispatch("SORT",{compare:e}),browse:()=>{var e=E.element.querySelector("input[type=file]");e&&e.click()},destroy:()=>{A.fire("destroy",E.element),n.dispatch("ABORT_ALL"),E._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",i),n.dispatch("DID_DESTROY")},insertBefore:e=>P(E.element,e),insertAfter:e=>v(E.element,e),appendTo:e=>e.appendChild(E.element),replaceElement:e=>{P(E.element,e),e.parentNode.removeChild(e),r=e},restoreElement:()=>{r&&(v(r,E.element),E.element.parentNode.removeChild(E.element),r=null)},isAttachedTo:e=>E.element===e||r===e,element:{get:()=>E.element},status:{get:()=>n.query("GET_STATUS")}};return n.dispatch("DID_INIT"),t(A)},zo=(t={})=>{const r={};return e(Re(),(e,t)=>{r[e]=t[0]}),Wo({...r,...t})},jo=(t,r)=>{e(r,(r,o)=>{e(t,(e,n)=>{const i=new RegExp(r);if(!i.test(e))return;if(delete t[e],!1===o)return;if(U(o))return void(t[o]=n);const s=o.group;X(o)&&!t[s]&&(t[s]={}),t[s][(e=>e.charAt(0).toLowerCase()+e.slice(1))(e.replace(i,""))]=n}),o.mapping&&jo(t[o.group],o.mapping)})},Qo=(t,o={})=>{const n=[];e(t.attributes,e=>{n.push(t.attributes[e])});const i=n.filter(e=>e.name).reduce((e,o)=>{const n=r(t,o.name);return e[(e=>wo(e.replace(/^data-/,"")))(o.name)]=n===o.name||n,e},{});return jo(i,o),i},Zo=(...e)=>(e=>e instanceof HTMLElement)(e[0])?((e,t={})=>{const r={"^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};me("SET_ATTRIBUTE_TO_OPTION_MAP",r);const o={...t},n=Qo("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,r);Object.keys(n).forEach(e=>{X(n[e])?(X(o[e])||(o[e]={}),Object.assign(o[e],n[e])):o[e]=n[e]}),o.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(e=>({source:e.value,options:{type:e.dataset.type}})));const i=zo(o);return e.files&&Array.from(e.files).forEach(e=>{i.addFile(e)}),i.replaceElement(e),i})(...e):zo(...e),Ko=["fire","_read","_write"],Jo=e=>{const t={};return le(e,t,Ko),t},en=(e,t)=>e.replace(/(?:{([a-zA-Z]+)})/g,(e,r)=>t[r]),tn=e=>{const t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),r=URL.createObjectURL(t),o=new Worker(r);return{transfer:(e,t)=>{},post:(e,t,r)=>{const n=ie();o.onmessage=(e=>{e.data.id===n&&t(e.data.message)}),o.postMessage({id:n,message:e},r)},terminate:()=>{o.terminate(),URL.revokeObjectURL(r)}}},rn=e=>new Promise((t,r)=>{const o=new Image;o.onload=(()=>{t(o)}),o.onerror=(e=>{r(e)}),o.src=e}),on=(e,t)=>{const r=e.slice(0,e.size,e.type);return r.lastModifiedDate=e.lastModifiedDate,r.name=t,r},nn=e=>on(e,e.name),sn=[],an=t=>{if(sn.includes(t))return;sn.push(t),(e=>Object.assign(ge,e))(t({addFilter:he,utils:{Type:Te,forin:e,isString:U,isFile:_t,toNaturalFileSize:wt,replaceInString:en,getExtensionFromFilename:Fe,getFilenameWithoutExtension:ut,guesstimateMimeType:zr,getFileFromBlob:xe,getFilenameFromURL:Be,createRoute:L,createWorker:tn,createView:A,createItemAPI:de,loadImage:rn,copyFile:nn,renameFile:on,createBlob:Ye,applyFilterChain:Ie,text:vt,getNumericAspectRatioFromString:De},views:{fileActionButton:Nt}}).options)},ln=(()=>{const e=d()&&!(()=>"[object OperaMini]"===Object.prototype.toString.call(window.operamini))()&&(()=>"visibilityState"in document)()&&(()=>"Promise"in window)()&&(()=>"slice"in Blob.prototype)()&&(()=>"URL"in window&&"createObjectURL"in window.URL)()&&(()=>"performance"in window)()&&((()=>"supports"in(window.CSS||{}))()||(()=>/MSIE|Trident/.test(window.navigator.userAgent))());return()=>e})(),cn={apps:[]},dn=()=>{};let pn={},En={},un={},_n={},Tn=dn,fn=dn,In=dn,mn=dn,hn=dn,Rn=dn,gn=dn;if(ln()){((e,t,r=60)=>{const o="__framePainter";if(window[o])return window[o].readers.push(e),void window[o].writers.push(t);window[o]={readers:[e],writers:[t]};const n=window[o],i=1e3/r;let s=null,a=null,l=null,c=null;const d=()=>{document.hidden?(l=(()=>window.setTimeout(()=>p(performance.now()),i)),c=(()=>window.clearTimeout(a))):(l=(()=>window.requestAnimationFrame(p)),c=(()=>window.cancelAnimationFrame(a)))};document.addEventListener("visibilitychange",()=>{c&&c(),d(),p(performance.now())});const p=e=>{a=l(p),s||(s=e);const t=e-s;t<=i||(s=e-t%i,n.readers.forEach(e=>e()),n.writers.forEach(t=>t(e)))};d(),p(performance.now())})(()=>{cn.apps.forEach(e=>e._read())},e=>{cn.apps.forEach(t=>t._write(e))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:ln,create:Tn,destroy:fn,parse:In,find:mn,registerPlugin:hn,setOptions:gn}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const r=()=>e(Re(),(e,t)=>{_n[e]=t[1]});pn={...ye},un={...Ee},En={...pe},_n={},r(),Tn=((...e)=>{const t=Zo(...e);return t.on("destroy",fn),cn.apps.push(t),Jo(t)}),fn=(e=>{const t=cn.apps.findIndex(t=>t.isAttachedTo(e));if(t>=0){return cn.apps.splice(t,1)[0].restoreElement(),!0}return!1}),In=(e=>{return Array.from(e.querySelectorAll(".filepond")).filter(e=>!cn.apps.find(t=>t.isAttachedTo(e))).map(e=>Tn(e))}),mn=(e=>{const t=cn.apps.find(t=>t.isAttachedTo(e));return t?Jo(t):null}),hn=((...e)=>{e.forEach(an),r()}),Rn=(()=>{const t={};return e(Re(),(e,r)=>{t[e]=r[0]}),t}),gn=(t=>(X(t)&&(cn.apps.forEach(e=>{e.setOptions(t)}),(t=>{e(t,(e,t)=>{ge[e]&&(ge[e][0]=z(t,ge[e][0],ge[e][1]))})})(t)),Rn()))}export{un as FileOrigin,En as FileStatus,_n as OptionTypes,pn as Status,Tn as create,fn as destroy,mn as find,Rn as getOptions,In as parse,hn as registerPlugin,gn as setOptions,ln as supported}; diff --git a/dist/filepond.min.js b/dist/filepond.min.js index 43999718..2e801d07 100644 --- a/dist/filepond.min.js +++ b/dist/filepond.min.js @@ -6,4 +6,4 @@ /* eslint-disable */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).FilePond={})}(this,function(e){"use strict";var t=function(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])},n=function(e){var n={};return t(e,function(t){!function(e,t,n){"function"!=typeof n?Object.defineProperty(e,t,Object.assign({},n)):e[t]=n}(n,t,e[t])}),n},r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===n)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},o=["svg","path"],i=function(e){return o.includes(e)},a=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof n&&(o=n,n=null);var a=i(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n&&(i(e)?r(a,"class",n):a.className=n),t(o,function(e,t){r(a,e,t)}),a},s=function(e,t){return function(e,n){return void 0!==n?t.splice(n,0,e):t.push(e),e}},u=function(e,t){return function(n){return t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n}},l="undefined"!=typeof window&&void 0!==window.document,c=function(){return l},f="children"in(c()?a("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},d=function(e,t,n,r){var o=n[0]||e.left,i=n[1]||e.top,a=o+e.width,s=i+e.height*(r[1]||1),u={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:o,top:i,right:a,bottom:s}};return t.filter(function(e){return!e.isRectIgnored()}).map(function(e){return e.rect}).forEach(function(e){p(u.inner,Object.assign({},e.inner)),p(u.outer,Object.assign({},e.outer))}),E(u.inner),u.outer.bottom+=u.element.marginBottom,u.outer.right+=u.element.marginRight,E(u.outer),u},p=function(e,t){t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},E=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},_=function(e){return"number"==typeof e},T=function(e){return e<.5?2*e*e:(4-2*e)*e-1},I={spring:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,r=void 0===t?.5:t,o=e.damping,i=void 0===o?.75:o,a=e.mass,s=void 0===a?10:a,u=null,l=null,c=0,f=!1,d=n({interpolate:function(e,t){if(!f){if(!_(u)||!_(l))return f=!0,void(c=0);(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},o=r.duration,i=void 0===o?500:o,a=r.easing,s=void 0===a?T:a,u=r.delay,l=void 0===u?0:u,c=null,f=!0,d=!1,p=null,E=n({interpolate:function(n,r){f||null===p||(null===c&&(c=n),n-c=i||r?(e=1,t=d?0:1,E.onupdate(t*p),E.oncomplete(t*p),f=!0):(t=e/i,E.onupdate((e>=0?s(d?1-t:t):0)*p))))},target:{get:function(){return d?0:p},set:function(e){if(null===p)return p=e,E.onupdate(e),void E.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach(function(t){e.forEach(function(e){var o=e,i=function(){return n[e]},a=function(t){return n[e]=t};"object"==typeof e&&(o=e.key,i=e.getter||i,a=e.setter||a),t[o]&&!r||(t[o]={get:i,set:a})})})},h=function(e){return null!=e},g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},R=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var n in t)if(t[n]!==e[n])return!0;return!1},O=function(e,t){var n=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,a=t.scaleX,s=t.scaleY,u=t.rotateX,l=t.rotateY,c=t.rotateZ,f=t.originX,d=t.originY,p=t.width,E=t.height,_="",T="";(h(f)||h(d))&&(T+="transform-origin: "+(f||0)+"px "+(d||0)+"px;"),h(r)&&(_+="perspective("+r+"px) "),(h(o)||h(i))&&(_+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(h(a)||h(s))&&(_+="scale3d("+(h(a)?a:1)+", "+(h(s)?s:1)+", 1) "),h(c)&&(_+="rotateZ("+c+"rad) "),h(u)&&(_+="rotateX("+u+"rad) "),h(l)&&(_+="rotateY("+l+"rad) "),_.length&&(T+="transform:"+_+";"),h(n)&&(T+="opacity:"+n+";",0===n&&(T+="visibility:hidden;"),n<1&&(T+="pointer-events:none;")),h(E)&&(T+="height:"+E+"px;"),h(p)&&(T+="width:"+p+"px;");var I=e.elementCurrentStyle||"";T.length===I.length&&T===I||(e.style.cssText=T,e.elementCurrentStyle=T)},y={styles:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewInternalAPI,o=e.viewExternalAPI,i=e.view,a=Object.assign({},n),s={};m(t,[r,o],n);var u=function(){return i.rect?d(i.rect,i.childViews,[n.translateX||0,n.translateY||0],[n.scaleX||0,n.scaleY||0]):null};return r.rect={get:u},o.rect={get:u},t.forEach(function(e){n[e]=void 0===a[e]?g[e]:a[e]}),{write:function(){if(R(s,n))return O(i.element,n),Object.assign(s,Object.assign({},n)),!0},destroy:function(){}}},listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t,n=e.viewExternalAPI,r=(e.viewState,e.view),o=[],i=(t=r.element,function(e,n){t.addEventListener(e,n)}),a=function(e){return function(t,n){e.removeEventListener(t,n)}}(r.element);return n.on=function(e,t){o.push({type:e,fn:t}),i(e,t)},n.off=function(e,t){o.splice(o.findIndex(function(n){return n.type===e&&n.fn===t}),1),a(e,t)},{write:function(){return!0},destroy:function(){o.forEach(function(e){a(e.type,e.fn)})}}},animations:function(e){var n=e.mixinConfig,r=e.viewProps,o=e.viewInternalAPI,i=e.viewExternalAPI,a=Object.assign({},r),s=[];return t(n,function(e,t){var n=v(t);n&&(n.onupdate=function(t){r[e]=t},n.target=a[e],m([{key:e,setter:function(e){n.target!==e&&(n.target=e)},getter:function(){return r[e]}}],[o,i],r,!0),s.push(n))}),{write:function(e){var t=document.hidden,n=!0;return s.forEach(function(r){r.resting||(n=!1),r.interpolate(e,t)}),n},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewExternalAPI;m(t,r,n)}},D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.layoutCalculated||(e.paddingTop=parseInt(n.paddingTop,10)||0,e.marginTop=parseInt(n.marginTop,10)||0,e.marginRight=parseInt(n.marginRight,10)||0,e.marginBottom=parseInt(n.marginBottom,10)||0,e.marginLeft=parseInt(n.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,r=void 0===t?"div":t,o=e.name,i=void 0===o?null:o,l=e.attributes,c=void 0===l?{}:l,p=e.read,E=void 0===p?function(){}:p,_=e.write,T=void 0===_?function(){}:_,I=e.create,v=void 0===I?function(){}:I,m=e.destroy,h=void 0===m?function(){}:m,g=e.filterFrameActionsForChild,R=void 0===g?function(e,t){return t}:g,O=e.didCreateView,S=void 0===O?function(){}:O,A=e.didWriteView,L=void 0===A?function(){}:A,b=e.ignoreRect,P=void 0!==b&&b,M=e.ignoreRectUpdate,w=void 0!==M&&M,C=e.mixins,N=void 0===C?[]:C;return function(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=a(r,"filepond--"+i,c),p=window.getComputedStyle(l,null),_=D(),I=null,m=!1,g=[],O=[],A={},b={},M=[T],C=[E],G=[h],U=function(){return l},B=function(){return g.concat()},F=function(){return I||(I=d(_,g,[0,0],[1,1]))},q={element:{get:U},style:{get:function(){return p}},childViews:{get:B}},V=Object.assign({},q,{rect:{get:F},ref:{get:function(){return A}},is:function(e){return i===e},appendChild:(t=l,function(e,n){void 0!==n&&t.children[n]?t.insertBefore(e,t.children[n]):t.appendChild(e)}),createChildView:function(e){return function(t,n){return t(e,n)}}(e),linkView:function(e){return g.push(e),e},unlinkView:function(e){g.splice(g.indexOf(e),1)},appendChildView:s(0,g),removeChildView:u(l,g),registerWriter:function(e){return M.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return G.push(e)},invalidateLayout:function(){return l.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:function(){return m}},isRectIgnored:function(){return P},_read:function(){I=null,g.forEach(function(e){return e._read()}),!(w&&_.width&&_.height)&&D(_,l,p);var e={root:k,props:o,rect:_};C.forEach(function(t){return t(e)})},_write:function(e,t,n){var r=0===t.length;return M.forEach(function(i){!1===i({props:o,root:k,actions:t,timestamp:e,shouldOptimize:n})&&(r=!1)}),O.forEach(function(t){!1===t.write(e)&&(r=!1)}),g.filter(function(e){return!!e.element.parentNode}).forEach(function(o){o._write(e,R(o,t),n)||(r=!1)}),g.forEach(function(o,i){o.element.parentNode||(k.appendChild(o.element,i),o._read(),o._write(e,R(o,t),n),r=!1)}),m=r,L({props:o,root:k,actions:t,timestamp:e}),r},_destroy:function(){O.forEach(function(e){return e.destroy()}),G.forEach(function(e){e({root:k,props:o})}),g.forEach(function(e){return e._destroy()})}},Y=Object.assign({},q,{rect:{get:function(){return _}}});Object.keys(N).sort(function(e,t){return"styles"===e?1:"styles"===t?-1:0}).forEach(function(e){var t=y[e]({mixinConfig:N[e],viewProps:o,viewState:b,viewInternalAPI:V,viewExternalAPI:x,view:n(Y)});t&&O.push(t)});var k=n(V);v({root:k,props:o});var j=f(l);return g.forEach(function(e,t){k.appendChild(e.element,j+t)}),S(k),n(x)}},A=function(e,t){return function(n){var r=n.root,o=n.props,i=n.actions,a=void 0===i?[]:i,s=n.timestamp,u=n.shouldOptimize;a.filter(function(t){return e[t.type]}).forEach(function(t){return e[t.type]({root:r,props:o,action:t.data,timestamp:s,shouldOptimize:u})}),t&&t({root:r,props:o,actions:a,timestamp:s,shouldOptimize:u})}},L=function(e,t){return t.parentNode.insertBefore(e,t)},b=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},P=function(e){return Array.isArray(e)},M=function(e){return null==e},w=function(e){return e.trim()},C=function(e){return""+e},N=function(e){return"boolean"==typeof e},G=function(e){return N(e)?e:"true"===e},U=function(e){return"string"==typeof e},B=function(e){return _(e)?e:U(e)?C(e).replace(/[a-z]+/gi,""):0},F=function(e){return parseInt(B(e),10)},q=function(e){return parseFloat(B(e))},V=function(e){return _(e)&&isFinite(e)&&Math.floor(e)===e},x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(V(e))return e;var n=C(e).trim();return/MB$/i.test(n)?(n=n.replace(/MB$i/,"").trim(),F(n)*t*t):/KB/i.test(n)?(n=n.replace(/KB$i/,"").trim(),F(n)*t):F(n)},Y=function(e){return"function"==typeof e},k={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},j=function(e,t,n,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===n||"PATCH"===n?"?"+e+"=":"",method:n,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){var a=i.headers.split(/:(.+)/);i.headers={header:a[0],value:a[1]}}return i.withCredentials=G(i.withCredentials),i},H=function(e){return"object"==typeof e&&null!==e},X=function(e){return P(e)?"array":function(e){return null===e}(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":function(e){return H(e)&&U(e.url)&&H(e.process)&&H(e.revert)&&H(e.restore)&&H(e.fetch)}(e)?"api":typeof e},W={array:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return M(e)?[]:P(e)?e:C(e).split(t).map(w).filter(function(e){return e.length})},boolean:G,int:function(e){return"bytes"===X(e)?x(e):F(e)},number:q,float:q,bytes:x,string:function(e){return Y(e)?e:C(e)},function:function(e){return function(e){for(var t=self,n=e.split("."),r=null;r=n.shift();)if(!(t=t[r]))return null;return t}(e)},serverapi:function(e){return(r={}).url=U(n=e)?n:n.url||"",r.timeout=n.timeout?parseInt(n.timeout,10):0,r.headers=n.headers?n.headers:{},t(k,function(e){r[e]=j(e,n[e],k[e],r.timeout,r.headers)}),r.process=n.process||U(n)||n.url?r.process:null,r.remove=n.remove||null,delete r.headers,r;var n,r},object:function(e){try{return JSON.parse(e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(e){return null}}},z=function(e,t,n){if(e===t)return e;var r,o=X(e);if(o!==n){var i=(r=e,W[n](r));if(o=X(i),null===i)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+n+'"';e=i}return e},Q=function(e){var r={};return t(e,function(t){var n,o,i,a=e[t];r[t]=(n=a[0],o=a[1],i=n,{enumerable:!0,get:function(){return i},set:function(e){i=z(e,n,o)}})}),n(r)},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.split(/(?=[A-Z])/).map(function(e){return e.toLowerCase()}).join(t)},K=function(e){return function(n,r,o){var i={};return t(e,function(e){var t=Z(e,"_").toUpperCase();i["SET_"+t]=function(r){try{o.options[e]=r.value}catch(e){}n("DID_SET_"+t,{value:o.options[e]})}}),i}},$=function(e){return function(n){var r={};return t(e,function(e){r["GET_"+Z(e,"_").toUpperCase()]=function(t){return n.options[e]}}),r}},J=1,ee=2,te=3,ne=4,re=5,oe=function(){return Math.random().toString(36).substring(2,11)};function ie(e){this.wrapped=e}function ae(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof ie;Promise.resolve(s?a.wrapped:a).then(function(e){s?r("next",e):o(i.done?"return":"normal",e)},function(e){r("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function se(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}"function"==typeof Symbol&&Symbol.asyncIterator&&(ae.prototype[Symbol.asyncIterator]=function(){return this}),ae.prototype.next=function(e){return this._invoke("next",e)},ae.prototype.throw=function(e){return this._invoke("throw",e)},ae.prototype.return=function(e){return this._invoke("return",e)};function ue(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1?t-1:0),o=1;o1?t-1:0),o=1;oBrowse',ge.STRING],labelInvalidField:["Field contains invalid files",ge.STRING],labelFileWaitingForSize:["Waiting for size",ge.STRING],labelFileSizeNotAvailable:["Size not available",ge.STRING],labelFileCountSingular:["file in list",ge.STRING],labelFileCountPlural:["files in list",ge.STRING],labelFileLoading:["Loading",ge.STRING],labelFileAdded:["Added",ge.STRING],labelFileLoadError:["Error during load",ge.STRING],labelFileRemoved:["Removed",ge.STRING],labelFileRemoveError:["Error during remove",ge.STRING],labelFileProcessing:["Uploading",ge.STRING],labelFileProcessingComplete:["Upload complete",ge.STRING],labelFileProcessingAborted:["Upload cancelled",ge.STRING],labelFileProcessingError:["Error during upload",ge.STRING],labelFileProcessingRevertError:["Error during revert",ge.STRING],labelTapToCancel:["tap to cancel",ge.STRING],labelTapToRetry:["tap to retry",ge.STRING],labelTapToUndo:["tap to undo",ge.STRING],labelButtonRemoveItem:["Remove",ge.STRING],labelButtonAbortItemLoad:["Abort",ge.STRING],labelButtonRetryItemLoad:["Retry",ge.STRING],labelButtonAbortItemProcessing:["Cancel",ge.STRING],labelButtonUndoItemProcessing:["Undo",ge.STRING],labelButtonRetryItemProcessing:["Retry",ge.STRING],labelButtonProcessItem:["Upload",ge.STRING],iconRemove:['',ge.STRING],iconProcess:['',ge.STRING],iconRetry:['',ge.STRING],iconUndo:['',ge.STRING],iconDone:['',ge.STRING],oninit:[null,ge.FUNCTION],onwarning:[null,ge.FUNCTION],onerror:[null,ge.FUNCTION],onactivatefile:[null,ge.FUNCTION],oninitfile:[null,ge.FUNCTION],onaddfilestart:[null,ge.FUNCTION],onaddfileprogress:[null,ge.FUNCTION],onaddfile:[null,ge.FUNCTION],onprocessfilestart:[null,ge.FUNCTION],onprocessfileprogress:[null,ge.FUNCTION],onprocessfileabort:[null,ge.FUNCTION],onprocessfilerevert:[null,ge.FUNCTION],onprocessfile:[null,ge.FUNCTION],onprocessfiles:[null,ge.FUNCTION],onremovefile:[null,ge.FUNCTION],onpreparefile:[null,ge.FUNCTION],onupdatefiles:[null,ge.FUNCTION],onreorderfiles:[null,ge.FUNCTION],beforeDropFile:[null,ge.FUNCTION],beforeAddFile:[null,ge.FUNCTION],beforeRemoveFile:[null,ge.FUNCTION],beforePrepareFile:[null,ge.FUNCTION],stylePanelLayout:[null,ge.STRING],stylePanelAspectRatio:[null,ge.STRING],styleItemPanelAspectRatio:[null,ge.STRING],styleButtonRemoveItemPosition:["left",ge.STRING],styleButtonProcessItemPosition:["right",ge.STRING],styleLoadIndicatorPosition:["right",ge.STRING],styleProgressIndicatorPosition:["right",ge.STRING],styleButtonRemoveItemAlign:[!1,ge.BOOLEAN],files:[[],ge.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],ge.ARRAY]},Le=function(e,t){return M(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(function(e){return e.id===t})||null)},be=function(e){if(M(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Pe=function(e){return e.filter(function(e){return!e.archived})},Me={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},we=null,Ce=[Ie.LOAD_ERROR,Ie.PROCESSING_ERROR,Ie.PROCESSING_REVERT_ERROR],Ne=[Ie.LOADING,Ie.PROCESSING,Ie.PROCESSING_QUEUED,Ie.INIT],Ge=[Ie.PROCESSING_COMPLETE],Ue=function(e){return Ce.includes(e.status)},Be=function(e){return Ne.includes(e.status)},Fe=function(e){return Ge.includes(e.status)},qe=function(e){return H(e.options.server)&&(H(e.options.server.process)||Y(e.options.server.process))},Ve=function(e){return{GET_STATUS:function(){var t=Pe(e.items),n=Me.EMPTY,r=Me.ERROR,o=Me.BUSY,i=Me.IDLE,a=Me.READY;return 0===t.length?n:t.some(Ue)?r:t.some(Be)?o:t.some(Fe)?a:i},GET_ITEM:function(t){return Le(e.items,t)},GET_ACTIVE_ITEM:function(t){return Le(Pe(e.items),t)},GET_ACTIVE_ITEMS:function(){return Pe(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var n=Le(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:function(t){var n=Le(e.items,t);return n?n.fileSize:null},GET_STYLES:function(){return Object.keys(e.options).filter(function(e){return/^style/.test(e)}).map(function(t){return{name:t,value:e.options[t]}})},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(e.options.stylePanelLayout)?1:be(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return Pe(e.items).filter(function(e){return e.status===t})},GET_TOTAL_ITEMS:function(){return Pe(e.items).length},SHOULD_UPDATE_FILE_INPUT:function(){return e.options.storeAsFile&&function(){if(null===we)try{var e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));var t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,we=1===t.files.length}catch(e){we=!1}return we}()&&!qe(e)},IS_ASYNC:function(){return qe(e)},GET_FILE_SIZE_LABELS:function(e){return{labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0}}}},xe=function(e,t,n){return Math.max(Math.min(n,e),t)},Ye=function(e){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e)},ke=function(e){return e.split("/").pop().split("?").shift()},je=function(e){return e.split(".").pop()},He=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},Xe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+He(e.getMonth()+1,"00")+"-"+He(e.getDate(),"00")+"_"+He(e.getHours(),"00")+"-"+He(e.getMinutes(),"00")+"-"+He(e.getSeconds(),"00")},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="string"==typeof n?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return o.lastModifiedDate=new Date,e._relativePath&&(o._relativePath=e._relativePath),U(t)||(t=Xe()),t&&null===r&&je(t)?o.name=t:(r=r||function(e){if("string"!=typeof e)return"";var t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""}(o.type),o.name=t+(r?"."+r:"")),o},ze=function(e,t){var n=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n){var r=new n;return r.append(e),r.getBlob(t)}return new Blob([e],{type:t})},Qe=function(e){return(/^data:(.+);/.exec(e)||[])[1]||null},Ze=function(e){var t=Qe(e);return function(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=200&&a.status<300?r.onload(a):r.onerror(a)},a.onerror=function(){return r.onerror(a)},a.onabort=function(){o=!0,r.onabort()},a.ontimeout=function(){return r.ontimeout(a)},a.open(n.method,t,!0),V(n.timeout)&&(a.timeout=n.timeout),Object.keys(n.headers).forEach(function(e){var t=unescape(encodeURIComponent(n.headers[e]));a.setRequestHeader(e,t)}),n.responseType&&(a.responseType=n.responseType),n.withCredentials&&(a.withCredentials=!0),a.send(e),r},ot=function(e,t,n,r){return{type:e,code:t,body:n,headers:r}},it=function(e){return function(t){e(ot("error",0,"Timeout",t.getAllResponseHeaders()))}},at=function(e){return/\?/.test(e)},st=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return null;var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a,s,u,l){var c=rt(o,st(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var r=e.getAllResponseHeaders(),a=et(r).name||ke(o);i(ot("load",e.status,"HEAD"===t.method?null:We(n(e.response),a),r))},c.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){l(ot("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=it(a),c.onprogress=s,c.onabort=u,c}},lt=0,ct=1,ft=2,dt=3,pt=4,Et=function(e,t,n,r,o,i,a,s,u,l,c){for(var f=[],d=c.chunkTransferId,p=c.chunkServer,E=c.chunkSize,_=c.chunkRetryDelays,T={serverId:d,aborted:!1},I=t.ondata||function(e){return e},v=t.onload||function(e,t){return"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response},m=t.onerror||function(e){return null},h=Math.floor(r.size/E),g=0;g<=h;g++){var R=g*E,O=r.slice(R,R+E,"application/offset+octet-stream");f[g]={index:g,size:O.size,offset:R,data:O,file:r,progress:0,retries:ue(_),status:lt,error:null,request:null,timeout:null}}var y,D,S,A,L=function(e){return e.status===lt||e.status===dt},b=function(t){if(!T.aborted)if(t=t||f.find(L)){t.status=ft,t.progress=null;var n=p.ondata||function(e){return e},o=p.onerror||function(e){return null},s=st(e,p.url,T.serverId),l="function"==typeof p.headers?p.headers(t):Object.assign({},p.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":r.size,"Upload-Name":r.name}),c=t.request=rt(n(t.data),s,Object.assign({},p,{headers:l}));c.onload=function(){t.status=ct,t.request=null,w()},c.onprogress=function(e,n,r){t.progress=e?n:null,M()},c.onerror=function(e){t.status=dt,t.request=null,t.error=o(e.response)||e.statusText,P(t)||a(ot("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))},c.ontimeout=function(e){t.status=dt,t.request=null,P(t)||it(a)(e)},c.onabort=function(){t.status=lt,t.request=null,u()}}else f.every(function(e){return e.status===ct})&&i(T.serverId)},P=function(e){return 0!==e.retries.length&&(e.status=pt,clearTimeout(e.timeout),e.timeout=setTimeout(function(){b(e)},e.retries.shift()),!0)},M=function(){var e=f.reduce(function(e,t){return null===e||null===t.progress?null:e+t.progress},0);if(null===e)return s(!1,0,0);var t=f.reduce(function(e,t){return e+t.size},0);s(!0,e,t)},w=function(){f.filter(function(e){return e.status===ft}).length>=1||b()};return T.serverId?(y=function(e){T.aborted||(f.filter(function(t){return t.offset0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,o=new Array(e),i=0;ir.chunkSize,p=f&&(d||r.chunkForce);if(o instanceof Blob&&p)return Et(e,t,n,o,i,a,s,u,l,c,r);var E=t.ondata||function(e){return e},_=t.onload||function(e){return e},T=t.onerror||function(e){return null},I="function"==typeof t.headers?t.headers(o,i)||{}:Object.assign({},t.headers),v=Object.assign({},t,{headers:I}),m=new FormData;H(i)&&m.append(n,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach(function(e){m.append(n,e.file,null===e.name?e.file.name:""+e.name+e.file.name)});var h=rt(E(m),st(e,t.url),v);return h.onload=function(e){a(ot("load",e.status,_(e.response),e.getAllResponseHeaders()))},h.onerror=function(e){s(ot("error",e.status,T(e.response)||e.statusText,e.getAllResponseHeaders()))},h.ontimeout=it(s),h.onprogress=u,h.onabort=l,h}}}(e,t,n,r):null},Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return function(e,t){return t()};var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a){var s=rt(o,e+t.url,t);return s.onload=function(e){i(ot("load",e.status,n(e.response),e.getAllResponseHeaders()))},s.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},s.ontimeout=it(a),s}},It=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+Math.random()*(t-e)},vt=function(e,t){var n={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=t.allowMinimumUploadDuration,o=function(){n.request&&(n.perceivedPerformanceUpdater.clear(),n.request.abort&&n.request.abort(),n.complete=!0)},i=r?function(){return n.progress?Math.min(n.progress,n.perceivedProgress):null}:function(){return n.progress||null},a=r?function(){return Math.min(n.duration,n.perceivedDuration)}:function(){return n.duration},s=Object.assign({},pe(),{process:function(t,o){var i=function(){0!==n.duration&&null!==n.progress&&s.fire("progress",s.getProgress())},a=function(){n.complete=!0,s.fire("load-perceived",n.response.body)};s.fire("start"),n.timestamp=Date.now(),n.perceivedPerformanceUpdater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:25),r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=null,i=Date.now();return t>0&&function a(){var s=Date.now()-i,u=It(n,r);s+u>t&&(u=s+u-t);var l=s/t;l>=1||document.hidden?e(1):(e(l),o=setTimeout(a,u))}(),{clear:function(){clearTimeout(o)}}}(function(e){n.perceivedProgress=e,n.perceivedDuration=Date.now()-n.timestamp,i(),n.response&&1===n.perceivedProgress&&!n.complete&&a()},r?It(750,1500):0),n.request=e(t,o,function(e){n.response=H(e)?e:{type:"load",code:200,body:""+e,headers:{}},n.duration=Date.now()-n.timestamp,n.progress=1,s.fire("load",n.response.body),(!r||r&&1===n.perceivedProgress)&&a()},function(e){n.perceivedPerformanceUpdater.clear(),s.fire("error",H(e)?e:{type:"error",code:0,body:""+e})},function(e,t,r){n.duration=Date.now()-n.timestamp,n.progress=e?t/r:null,i()},function(){n.perceivedPerformanceUpdater.clear(),s.fire("abort",n.response?n.response.body:null)},function(e){s.fire("transfer",e)})},abort:o,getProgress:i,getDuration:a,reset:function(){o(),n.complete=!1,n.perceivedProgress=0,n.progress=0,n.timestamp=null,n.perceivedDuration=0,n.duration=0,n.request=null,n.response=null}});return s},mt=function(e){return e.substring(0,e.lastIndexOf("."))||e},ht=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},gt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=oe(),i={archived:!1,frozen:!1,released:!1,source:null,file:r,serverFileReference:t,transferId:null,processingAborted:!1,status:t?Ie.PROCESSING_COMPLETE:Ie.INIT,activeLoader:null,activeProcessor:null},a=null,s={},u=function(e){return i.status=e},l=function(e){if(!i.released&&!i.frozen){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},r=n.query,o=n.success,i=void 0===o?function(){}:o,a=n.failure,s=void 0===a?function(){}:a,u=se(n,["query","success","failure"]),l=Le(e.items,r);l?t(l,i,s,u||{}):s({error:ot("error",0,"Item not found"),file:null})}},Pt=function(e,t,n){return{ABORT_ALL:function(){Pe(n.items).forEach(function(e){e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map(function(e){return{source:e.source?e.source:e,options:e.options}}),i=Pe(n.items);i.forEach(function(t){o.find(function(e){return e.source===t.source||e.source===t.file})||e("REMOVE_ITEM",{query:t,remove:!1})}),i=Pe(n.items),o.forEach(function(t,n){i.find(function(e){return e.source===t.source||e.file===t.source})||e("ADD_ITEM",Object.assign({},t,{interactionMethod:re,index:n}))})},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id,i=r.action,a=r.change;a.silent||(clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(function(){var r=Rt(n.items,o);if(t("IS_ASYNC")){r.origin===ve.LOCAL&&e("DID_LOAD_ITEM",{id:r.id,error:null,serverFileReference:r.source});var s,u=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return r.status===Ie.PROCESSING_COMPLETE?(s=n.options.instantUpload,void r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s?u:function(){}).catch(function(){})):r.status===Ie.PROCESSING?function(e){r.abortProcessing().then(e?u:function(){})}(n.options.instantUpload):void(n.options.instantUpload&&u())}Oe("SHOULD_PREPARE_OUTPUT",!1,{item:r,query:t,action:i,change:a}).then(function(n){var i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(r,n)),n&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:r,success:function(t){e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)})},0))},MOVE_ITEM:function(e){var t=e.query,r=e.index,o=Le(n.items,t);if(o){var i=n.items.indexOf(o);i!==(r=xe(r,0,n.items.length-1))&&n.items.splice(r,0,n.items.splice(i,1)[0])}},SORT:function(r){var o=r.compare;Lt(n,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(n){var r=n.items,o=n.index,i=n.interactionMethod,a=n.success,s=void 0===a?function(){}:a,u=n.failure,l=void 0===u?function(){}:u,c=o;if(-1===o||void 0===o){var f=t("GET_ITEM_INSERT_LOCATION"),d=t("GET_TOTAL_ITEMS");c="before"===f?0:d}var p=t("GET_IGNORED_FILES"),E=r.filter(function(e){return ht(e)?!p.includes(e.name.toLowerCase()):!M(e)}).map(function(t){return new Promise(function(n,r){e("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:n,failure:r,index:c++,options:t.options||{}})})});Promise.all(E).then(s).catch(l)},ADD_ITEM:function(r){var o=r.source,i=r.index,a=void 0===i?-1:i,s=r.interactionMethod,u=r.success,l=void 0===u?function(){}:u,c=r.failure,f=void 0===c?function(){}:c,d=r.options,p=void 0===d?{}:d;if(M(o))f({error:ot("error",0,"No source"),file:null});else if(!ht(o)||!n.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(e){var t=Pe(e.items).length;if(!e.options.allowMultiple)return 0===t;var n=e.options.maxFiles;return null===n||t=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:h,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void f({error:t,file:Te(v)});e("DID_THROW_ITEM_LOAD_ERROR",{id:h,error:t,status:{main:r,sub:n.options.labelTapToRetry}})}),v.on("load-file-error",function(t){e("DID_THROW_ITEM_INVALID",{id:h,error:t.status,status:t.status}),f({error:t.status,file:Te(v)})}),v.on("load-abort",function(){e("REMOVE_ITEM",{query:h})}),v.on("load-skip",function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}})}),v.on("load",function(){var r=function(r){r?(v.on("metadata-update",function(t){e("DID_UPDATE_ITEM_METADATA",{id:h,change:t})}),Oe("SHOULD_PREPARE_OUTPUT",!1,{item:v,query:t}).then(function(r){var i=t("GET_BEFORE_PREPARE_FILE");i&&(r=i(v,r));var a=function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}}),St(e,n)};r?e("REQUEST_PREPARE_OUTPUT",{query:h,item:v,success:function(t){e("DID_PREPARE_OUTPUT",{id:h,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:h})};Oe("DID_LOAD_ITEM",v,{query:t,dispatch:e}).then(function(){At(t("GET_BEFORE_ADD_FILE"),Te(v)).then(r)}).catch(function(t){if(!t||!t.error||!t.status)return r(!1);e("DID_THROW_ITEM_INVALID",{id:h,error:t.error,status:t.status})})}),v.on("process-start",function(){e("DID_START_ITEM_PROCESSING",{id:h})}),v.on("process-progress",function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:h,progress:t})}),v.on("process-error",function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-revert-error",function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingRevertError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-complete",function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:h,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:h,value:t})}),v.on("process-abort",function(){e("DID_ABORT_ITEM_PROCESSING",{id:h})}),v.on("process-revert",function(){e("DID_REVERT_ITEM_PROCESSING",{id:h}),e("DID_DEFINE_VALUE",{id:h,value:null})}),e("DID_ADD_ITEM",{id:h,index:a,interactionMethod:s}),St(e,n);var g=n.options.server||{},R=g.url,O=g.load,y=g.restore,D=g.fetch;v.load(o,tt(I===ve.INPUT?U(o)&&function(e){return(e.indexOf(":")>-1||e.indexOf("//")>-1)&&yt(location.href)!==yt(e)}(o)&&D?ut(R,D):Ot:ut(R,I===ve.LIMBO?y:O)),function(e,n,r){Oe("LOAD_FILE",e,{query:t}).then(n).catch(r)})}},REQUEST_PREPARE_OUTPUT:function(e){var n=e.item,r=e.success,o=e.failure,i=void 0===o?function(){}:o,a={error:ot("error",0,"Item not found"),file:null};if(n.archived)return i(a);Oe("PREPARE_OUTPUT",n.file,{query:t,item:n}).then(function(e){Oe("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:n}).then(function(e){if(n.archived)return i(a);r(e)})})},COMPLETE_LOAD_ITEM:function(r){var o=r.item,i=r.data,a=i.success,s=i.source,u=t("GET_ITEM_INSERT_LOCATION");if(Y(u)&&s&&Lt(n,u),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===ve.INPUT?null:s}),a(Te(o)),o.origin!==ve.LOCAL)return o.origin===ve.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&n.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:bt(n,function(e){e.retryLoad()}),REQUEST_ITEM_PREPARE:bt(n,function(t,n,r){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(r){e("DID_PREPARE_OUTPUT",{id:t.id,file:r}),n({file:t,output:r})},failure:r},!0)}),REQUEST_ITEM_PROCESSING:bt(n,function(r,o,i){if(r.status===Ie.IDLE||r.status===Ie.PROCESSING_ERROR)r.status!==Ie.PROCESSING_QUEUED&&(r.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:r.id}),e("PROCESS_ITEM",{query:r,success:o,failure:i},!0));else{var a=function(){return e("REQUEST_ITEM_PROCESSING",{query:r,success:o,failure:i})},s=function(){return document.hidden?a():setTimeout(a,32)};r.status===Ie.PROCESSING_COMPLETE||r.status===Ie.PROCESSING_REVERT_ERROR?r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s).catch(function(){}):r.status===Ie.PROCESSING&&r.abortProcessing().then(s)}}),PROCESS_ITEM:bt(n,function(r,o,i){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",Ie.PROCESSING).length!==a){if(r.status!==Ie.PROCESSING){var s=function t(){var r=n.processingQueue.shift();if(r){var o=r.id,i=r.success,a=r.failure,s=Le(n.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:i,failure:a},!0):t()}};r.onOnce("process-complete",function(){o(Te(r)),s();var i=n.options.server;if(n.options.instantUpload&&r.origin===ve.LOCAL&&Y(i.remove)){var a=function(){};r.origin=ve.LIMBO,n.options.server.remove(r.source,a,a)}t("GET_ITEMS_BY_STATUS",Ie.PROCESSING_COMPLETE).length===n.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),r.onOnce("process-error",function(e){i({error:e,file:Te(r)}),s()});var u=n.options;r.process(vt(_t(u.server.url,u.server.process,u.name,{chunkTransferId:r.transferId,chunkServer:u.server.patch,chunkUploads:u.chunkUploads,chunkForce:u.chunkForce,chunkSize:u.chunkSize,chunkRetryDelays:u.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),function(n,o,i){Oe("PREPARE_OUTPUT",n,{query:t,item:r}).then(function(t){e("DID_PREPARE_OUTPUT",{id:r.id,file:t}),o(t)}).catch(i)})}}else n.processingQueue.push({id:r.id,success:o,failure:i})}),RETRY_ITEM_PROCESSING:bt(n,function(t){e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:bt(n,function(n){At(t("GET_BEFORE_REMOVE_FILE"),Te(n)).then(function(t){t&&e("REMOVE_ITEM",{query:n})})}),RELEASE_ITEM:bt(n,function(e){e.release()}),REMOVE_ITEM:bt(n,function(r,o,i,a){var s=function(){var t=r.id;Rt(n.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:r}),St(e,n),o(Te(r))},u=n.options.server;r.origin===ve.LOCAL&&u&&Y(u.remove)&&!1!==a.remove?(e("DID_START_ITEM_REMOVE",{id:r.id}),u.remove(r.source,function(){return s()},function(t){e("DID_THROW_ITEM_REMOVE_ERROR",{id:r.id,error:ot("error",0,t,null),status:{main:Dt(n.options.labelFileRemoveError)(t),sub:n.options.labelTapToRetry}})})):((a.revert&&r.origin!==ve.LOCAL&&null!==r.serverId||n.options.chunkUploads&&r.file.size>n.options.chunkSize||n.options.chunkUploads&&n.options.chunkForce)&&r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")),s())}),ABORT_ITEM_LOAD:bt(n,function(e){e.abortLoad()}),ABORT_ITEM_PROCESSING:bt(n,function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(function(){n.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:bt(n,function(r){if(n.options.instantUpload){var o=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:r})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return o(!0);var a=i(Te(r));return null==a?o(!0):"boolean"==typeof a?o(a):void("function"==typeof a.then&&a.then(o))}e("REVERT_ITEM_PROCESSING",{query:r})}),REVERT_ITEM_PROCESSING:bt(n,function(r){r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(function(){(n.options.instantUpload||function(e){return!ht(e.file)}(r))&&e("REMOVE_ITEM",{query:r.id})}).catch(function(){})}),SET_OPTIONS:function(t){var n=t.options,r=Object.keys(n),o=Mt.filter(function(e){return r.includes(e)});[].concat(ue(o),ue(Object.keys(n).filter(function(e){return!o.includes(e)}))).forEach(function(t){e("SET_"+Z(t,"_").toUpperCase(),{value:n[t]})})}}},Mt=["server"],wt=function(e){return e},Ct=function(e){return document.createElement(e)},Nt=function(e,t){var n=e.childNodes[0];n?t!==n.nodeValue&&(n.nodeValue=t):(n=document.createTextNode(t),e.appendChild(n))},Gt=function(e,t,n,r){var o=(r%360-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}},Ut=function(e,t,n,r,o){var i=1;return o>r&&o-r<=.5&&(i=0),r>o&&r-o>=.5&&(i=0),function(e,t,n,r,o,i){var a=Gt(e,t,n,o),s=Gt(e,t,n,r);return["M",a.x,a.y,"A",n,n,0,i,0,s.x,s.y].join(" ")}(e,t,n,360*Math.min(.9999,r),360*Math.min(.9999,o),i)},Bt=S({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,n=e.props;n.spin=!1,n.progress=0,n.opacity=0;var r=a("svg");t.ref.path=a("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(t.ref.path),t.ref.svg=r,t.appendChild(r)},write:function(e){var t=e.root,n=e.props;if(0!==n.opacity){n.align&&(t.element.dataset.align=n.align);var o=parseInt(r(t.ref.path,"stroke-width"),10),i=.5*t.rect.element.width,a=0,s=0;n.spin?(a=0,s=.5):(a=0,s=n.progress);var u=Ut(i,i,i-o,a,s);r(t.ref.path,"d",u),r(t.ref.path,"stroke-opacity",n.spin||n.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}}}}),Ft=S({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(e){var t=e.root,n=e.props;t.element.innerHTML=(n.icon||"")+""+n.label+"",n.isDisabled=!1},write:function(e){var t=e.root,n=e.props,o=n.isDisabled,i=t.query("GET_DISABLED")||0===n.opacity;i&&!o?(n.isDisabled=!0,r(t.element,"disabled","disabled")):!i&&o&&(n.isDisabled=!1,t.element.removeAttribute("disabled"))}}),qt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.labelBytes,i=void 0===o?"bytes":o,a=r.labelKilobytes,s=void 0===a?"KB":a,u=r.labelMegabytes,l=void 0===u?"MB":u,c=r.labelGigabytes,f=void 0===c?"GB":c,d=n,p=n*n,E=n*n*n;return(e=Math.round(Math.abs(e)))0&&(t.height=t.ref.container.rect.element.height)),o&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),mn=S({create:function(e){var t=e.root,n=e.props;t.ref.handleClick=function(e){return t.dispatch("DID_ACTIVATE_ITEM",{id:n.id})},t.element.id="filepond--item-"+n.id,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(fn,{id:n.id})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"item-panel"})),t.ref.panel.height=null,n.markedForRemoval=!1,t.query("GET_ALLOW_REORDER")&&(t.element.dataset.dragState="idle",t.element.addEventListener("pointerdown",function(e){if(e.isPrimary){var r=!1,o=e.pageX,i=e.pageY;n.dragOrigin={x:t.translateX,y:t.translateY},n.dragCenter={x:e.offsetX,y:e.offsetY};var a,s,u,l=(a=t.query("GET_ACTIVE_ITEMS"),s=a.map(function(e){return e.id}),u=void 0,{setIndex:function(e){u=e},getIndex:function(){return u},getItemIndex:function(e){return s.indexOf(e.id)}});t.dispatch("DID_GRAB_ITEM",{id:n.id,dragState:l});var c=function(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),n.dragOffset={x:e.pageX-o,y:e.pageY-i},n.dragOffset.x*n.dragOffset.x+n.dragOffset.y*n.dragOffset.y>16&&!r&&(r=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:n.id,dragState:l}))};document.addEventListener("pointermove",c),document.addEventListener("pointerup",function e(a){a.isPrimary&&(document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",e),n.dragOffset={x:a.pageX-o,y:a.pageY-i},t.dispatch("DID_DROP_ITEM",{id:n.id,dragState:l}),r&&setTimeout(function(){return t.element.addEventListener("click",t.ref.handleClick)},0))})}}))},write:vn,destroy:function(e){var t=e.root,n=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:n.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:_n,translateY:_n,opacity:{type:"tween",duration:150}}}}),hn=function(e,t){return Math.max(1,Math.floor((e+1)/t))},gn=function(e,t,n){if(n){var r=e.rect.element.width,o=t.length,i=null;if(0===o||n.topv){if(n.left3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=n,Date.now()>e.spawnDate&&(0===e.opacity&&yn(e,t,n,r,o),e.scaleX=1,e.scaleY=1,e.opacity=1))},yn=function(e,t,n,r,o){e.interactionMethod===re?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=n):e.interactionMethod===ee?(e.translateX=null,e.translateX=t-20*r,e.translateY=null,e.translateY=n-10*o,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===te?(e.translateY=null,e.translateY=n-30):e.interactionMethod===J&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},Dn=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},Sn=A({DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=n.id,o=n.index,i=n.interactionMethod;t.ref.addIndex=o;var a=Date.now(),s=a,u=1;if(i!==re){u=0;var l=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;s=cs&&(E=s);var _=Math.floor(s/E+1);Rn.setHeight=d*_,Rn.setWidth=p*E;var T={y:Math.floor(f/d),x:Math.floor(c/p),getGridIndex:function(){return f>Rn.getHeight||f<0||c>Rn.getWidth||c<0?u:this.y*E+this.x},getColIndex:function(){for(var e=t.query("GET_ACTIVE_ITEMS"),n=t.childViews.filter(function(e){return e.rect.element.height}),r=e.map(function(e){return n.find(function(t){return t.id===e.id})}),o=r.findIndex(function(e){return e===a}),i=Dn(a),s=r.length,u=s,l=0,c=0,d=0,p=0;pp){if(f1?T.getGridIndex():T.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:I});var v=o.getIndex();if(void 0===v||v!==I){if(o.setIndex(I),void 0===v)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:u,target:I})}}}}),An=S({create:function(e){var t=e.root;r(t.element,"role","list"),t.ref.lastItemSpanwDate=Date.now()},write:function(e){var t=e.root,n=e.props,r=e.actions,o=e.shouldOptimize;Sn({root:t,props:n,actions:r});var i=n.dragCoordinates,a=t.rect.element.width,s=t.childViews.filter(function(e){return e.rect.element.height}),u=t.query("GET_ACTIVE_ITEMS").map(function(e){return s.find(function(t){return t.id===e.id})}).filter(function(e){return e}),l=i?gn(t,u,i):null,c=t.ref.addIndex||null;t.ref.addIndex=null;var f=0,d=0,p=0;if(0!==u.length){var E=u[0].rect.element,_=E.marginTop+E.marginBottom,T=E.marginLeft+E.marginRight,I=E.width+T,v=E.height+_,m=hn(a,I);if(1===m){var h=0,g=0;u.forEach(function(e,t){if(l){var n=t-l;g=-2===n?.25*-_:-1===n?.75*-_:0===n?.75*_:1===n?.25*_:0}o&&(e.translateX=null,e.translateY=null),e.markedForRemoval||On(e,0,h+g);var r=(e.rect.element.height+_)*(e.markedForRemoval?e.opacity:1);h+=r})}else{var R=0,O=0;u.forEach(function(e,t){t===l&&(f=1),t===c&&(p+=1),e.markedForRemoval&&e.opacity<.5&&(d-=1);var n=t+p+f+d,r=n%m,i=Math.floor(n/m),a=r*I,s=i*v,u=Math.sign(a-R),E=Math.sign(s-O);R=a,O=s,e.markedForRemoval||(o&&(e.translateX=null,e.translateY=null),On(e,a,s,u,E))})}}},tag:"ul",name:"list",didWriteView:function(e){var t=e.root;t.childViews.filter(function(e){return e.markedForRemoval&&0===e.opacity&&e.resting}).forEach(function(e){e._destroy(),t.removeChildView(e)})},filterFrameActionsForChild:function(e,t){return t.filter(function(t){return!t.data||!t.data.id||e.id===t.data.id})},mixins:{apis:["dragCoordinates"]}}),Ln=A({DID_DRAG:function(e){var t=e.root,n=e.props,r=e.action;t.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(n.dragCoordinates={left:r.position.scopeLeft-t.ref.list.rect.element.left,top:r.position.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},DID_END_DRAG:function(e){e.props.dragCoordinates=null}}),bn=S({create:function(e){var t=e.root,n=e.props;t.ref.list=t.appendChildView(t.createChildView(An)),n.dragCoordinates=null,n.overflowing=!1},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Ln({root:t,props:n,actions:r}),t.ref.list.dragCoordinates=n.dragCoordinates,n.overflowing&&!n.overflow&&(n.overflowing=!1,t.element.dataset.state="",t.height=null),n.overflow){var o=Math.round(n.overflow);o!==t.height&&(n.overflowing=!0,t.element.dataset.state="overflow",t.height=o)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Pn=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";n?r(e,t,o):e.removeAttribute(t)},Mn=function(e){var t=e.root,n=e.action;t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Pn(t.element,"accept",!!n.value,n.value?n.value.join(","):"")},wn=function(e){var t=e.root,n=e.action;Pn(t.element,"multiple",n.value)},Cn=function(e){var t=e.root,n=e.action;Pn(t.element,"webkitdirectory",n.value)},Nn=function(e){var t=e.root,n=t.query("GET_DISABLED"),r=t.query("GET_ALLOW_BROWSE"),o=n||!r;Pn(t.element,"disabled",o)},Gn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Pn(t.element,"required",!0):Pn(t.element,"required",!1)},Un=function(e){var t=e.root,n=e.action;Pn(t.element,"capture",!!n.value,!0===n.value?"":n.value)},Bn=function(e){var t=e.root,n=t.element;t.query("GET_TOTAL_ITEMS")>0?(Pn(n,"required",!1),Pn(n,"name",!1)):(Pn(n,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&n.setCustomValidity(""),t.query("GET_REQUIRED")&&Pn(n,"required",!0))},Fn=S({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:function(e){var t=e.root,n=e.props;t.element.id="filepond--browser-"+n.id,r(t.element,"name",t.query("GET_NAME")),r(t.element,"aria-controls","filepond--assistant-"+n.id),r(t.element,"aria-labelledby","filepond--drop-label-"+n.id),Mn({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),wn({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),Cn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Nn({root:t}),Gn({root:t,action:{value:t.query("GET_REQUIRED")}}),Un({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var r=Array.from(t.element.files).map(function(e){return e._relativePath=e.webkitRelativePath,e});setTimeout(function(){n.onload(r),function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=Ct("form"),n=e.parentNode,r=e.nextSibling;t.appendChild(e),t.reset(),r?n.insertBefore(e,r):n.appendChild(e)}}}(t.element)},250)}},t.element.addEventListener("change",t.ref.handleChange)},destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:A({DID_LOAD_ITEM:Bn,DID_REMOVE_ITEM:Bn,DID_THROW_ITEM_INVALID:function(e){var t=e.root;t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Nn,DID_SET_ALLOW_BROWSE:Nn,DID_SET_ALLOW_DIRECTORIES_ONLY:Cn,DID_SET_ALLOW_MULTIPLE:wn,DID_SET_ACCEPTED_FILE_TYPES:Mn,DID_SET_CAPTURE_METHOD:Un,DID_SET_REQUIRED:Gn})}),qn=13,Vn=32,xn=function(e,t){e.innerHTML=t;var n=e.querySelector(".filepond--label-action");return n&&r(n,"tabindex","0"),t},Yn=S({name:"drop-label",ignoreRect:!0,create:function(e){var t=e.root,n=e.props,o=Ct("label");r(o,"for","filepond--browser-"+n.id),r(o,"id","filepond--drop-label-"+n.id),r(o,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===qn||e.keyCode===Vn)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===o||o.contains(e.target)||t.ref.label.click()},o.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),xn(o,n.caption),t.appendChild(o),t.ref.label=o},destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:A({DID_SET_LABEL_IDLE:function(e){var t=e.root,n=e.action;xn(t.ref.label,n.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),kn=S({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}}}}),jn=A({DID_DRAG:function(e){var t=e.root,n=e.action;t.ref.blob?(t.ref.blob.translateX=n.position.scopeLeft,t.ref.blob.translateY=n.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):function(e){var t=e.root,n=.5*t.rect.element.width,r=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(kn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:n,translateY:r}))}({root:t})},DID_DROP:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},DID_END_DRAG:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.opacity=0)}}),Hn=S({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:function(e){var t=e.root,n=e.props,r=e.actions;jn({root:t,props:n,actions:r});var o=t.ref.blob;0===r.length&&o&&0===o.opacity&&(t.removeChildView(o),t.ref.blob=null)}}),Xn=function(e,t){try{var n=new DataTransfer;t.forEach(function(e){e instanceof File?n.items.add(e):n.items.add(new File([e],e.name,{type:e.type}))}),e.files=n.files}catch(e){return!1}return!0},Wn=function(e,t){return e.ref.fields[t]},zn=function(e){e.query("GET_ACTIVE_ITEMS").forEach(function(t){e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Qn=function(e){var t=e.root;return zn(t)},Zn=A({DID_SET_DISABLED:function(e){var t=e.root;t.element.disabled=t.query("GET_DISABLED")},DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=!(t.query("GET_ITEM",n.id).origin===ve.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),o=Ct("input");o.type=r?"file":"hidden",o.name=t.query("GET_NAME"),o.disabled=t.query("GET_DISABLED"),t.ref.fields[n.id]=o,zn(t)},DID_LOAD_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);if(r&&(null!==n.serverFileReference&&(r.value=n.serverFileReference),t.query("SHOULD_UPDATE_FILE_INPUT"))){var o=t.query("GET_ITEM",n.id);Xn(r,[o.file])}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete t.ref.fields[n.id])},DID_DEFINE_VALUE:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(null===n.value?r.removeAttribute("value"):r.value=n.value,zn(t))},DID_PREPARE_OUTPUT:function(e){var t=e.root,n=e.action;t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(function(){var e=Wn(t,n.id);e&&Xn(e,[n.file])},0)},DID_REORDER_ITEMS:Qn,DID_SORT_ITEMS:Qn}),Kn=S({tag:"fieldset",name:"data",create:function(e){return e.root.ref.fields={}},write:Zn,ignoreRect:!0}),$n=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],Jn=["css","csv","html","txt"],er={zip:"zip|compressed",epub:"application/epub+zip"},tr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),$n.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):Jn.includes(e)?"text/"+e:er[e]||""},nr=function(e){return new Promise(function(t,n){var r=dr(e);if(r.length&&!rr(e))return t(r);or(e).then(t)})},rr=function(e){return!!e.files&&e.files.length>0},or=function(e){return new Promise(function(t,n){var r=(e.items?Array.from(e.items):[]).filter(function(e){return ir(e)}).map(function(e){return ar(e)});r.length?Promise.all(r).then(function(e){var n=[];e.forEach(function(e){n.push.apply(n,e)}),t(n.filter(function(e){return e}).map(function(e){return e._relativePath||(e._relativePath=e.webkitRelativePath),e}))}).catch(console.error):t(e.files?Array.from(e.files):[])})},ir=function(e){if(cr(e)){var t=fr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},ar=function(e){return new Promise(function(t,n){lr(e)?sr(fr(e)).then(t).catch(n):t([e.getAsFile()])})},sr=function(e){return new Promise(function(t,n){var r=[],o=0,i=0,a=function(){0===i&&0===o&&t(r)};!function e(t){o++;var s=t.createReader();!function t(){s.readEntries(function(n){if(0===n.length)return o--,void a();n.forEach(function(t){t.isDirectory?e(t):(i++,t.file(function(e){var n=ur(e);t.fullPath&&(n._relativePath=t.fullPath),r.push(n),i--,a()}))}),t()},n)}()}(e)})},ur=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,n=e.name,r=tr(je(e.name));return r.length?((e=e.slice(0,e.size,r)).name=n,e.lastModifiedDate=t,e):e},lr=function(e){return cr(e)&&(fr(e)||{}).isDirectory},cr=function(e){return"webkitGetAsEntry"in e},fr=function(e){return e.webkitGetAsEntry()},dr=function(e){var t=[];try{if((t=Er(e)).length)return t;t=pr(e)}catch(e){}return t},pr=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},Er=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var n=t.match(/src\s*=\s*"(.+?)"/);if(n)return[n[1]]}return[]},_r=[],Tr=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},Ir=function(e){var t=_r.find(function(t){return t.element===e});if(t)return t;var n=vr(e);return _r.push(n),n},vr=function(e){var n=[],r={dragenter:Rr,dragover:Or,dragleave:Dr,drop:yr},o={};t(r,function(t,r){o[t]=r(e,n),e.addEventListener(t,o[t],!1)});var i={element:e,addListener:function(a){return n.push(a),function(){n.splice(n.indexOf(a),1),0===n.length&&(_r.splice(_r.indexOf(i),1),t(r,function(t){e.removeEventListener(t,o[t],!1)}))}}};return i},mr=function(e,t){var n,r=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)}("getRootNode"in(n=t)?n.getRootNode():document,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)},hr=null,gr=function(e,t){try{e.dropEffect=t}catch(e){}},Rr=function(e,t){return function(e){e.preventDefault(),hr=e.target,t.forEach(function(t){var n=t.element,r=t.onenter;mr(e,n)&&(t.state="enter",r(Tr(e)))})}},Or=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(r){var o=!1;t.some(function(t){var i=t.filterElement,a=t.element,s=t.onenter,u=t.onexit,l=t.ondrag,c=t.allowdrop;gr(n,"copy");var f=c(r);if(f)if(mr(e,a)){if(o=!0,null===t.state)return t.state="enter",void s(Tr(e));if(t.state="over",i&&!f)return void gr(n,"none");l(Tr(e))}else i&&!o&&gr(n,"none"),t.state&&(t.state=null,u(Tr(e)));else gr(n,"none")})})}},yr=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(n){t.forEach(function(t){var r=t.filterElement,o=t.element,i=t.ondrop,a=t.onexit,s=t.allowdrop;if(t.state=null,!r||mr(e,o))return s(n)?void i(Tr(e),n):a(Tr(e))})})}},Dr=function(e,t){return function(e){hr===e.target&&t.forEach(function(t){var n=t.onexit;t.state=null,n(Tr(e))})}},Sr=function(e,t,n){e.classList.add("filepond--hopper");var r=n.catchesDropsOnPage,o=n.requiresDropOnElement,i=n.filterItems,a=void 0===i?function(e){return e}:i,s=function(e,t,n){var r=Ir(t),o={element:e,filterElement:n,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return o.destroy=r.addListener(o),o}(e,r?document.documentElement:e,o),u="",l="";s.allowdrop=function(e){return t(a(e))},s.ondrop=function(e,n){var r=a(n);t(r)?(l="drag-drop",c.onload(r,e)):c.ondragend(e)},s.ondrag=function(e){c.ondrag(e)},s.onenter=function(e){l="drag-over",c.ondragstart(e)},s.onexit=function(e){l="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){u!==l&&(e.dataset.hopperState=l,u=l)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){s.destroy()}};return c},Ar=!1,Lr=[],br=function(e){var t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){for(var n=!1,r=t;r!==document.body;){if(r.classList.contains("filepond--root")){n=!0;break}r=r.parentNode}if(!n)return}nr(e.clipboardData).then(function(e){e.length&&Lr.forEach(function(t){return t(e)})})},Pr=function(){var e=function(e){t.onload(e)},t={destroy:function(){var t;t=e,de(Lr,Lr.indexOf(t)),0===Lr.length&&(document.removeEventListener("paste",br),Ar=!1)},onload:function(){}};return function(e){Lr.includes(e)||(Lr.push(e),Ar||(Ar=!0,document.addEventListener("paste",br)))}(e),t},Mr=null,wr=null,Cr=[],Nr=function(e,t){e.element.textContent=t},Gr=function(e,t,n){var r=e.query("GET_TOTAL_ITEMS");Nr(e,n+" "+t+", "+r+" "+(1===r?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(wr),wr=setTimeout(function(){!function(e){e.element.textContent=""}(e)},1500)},Ur=function(e){return e.element.parentNode.contains(document.activeElement)},Br=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Nr(t,r+" "+o)},Fr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename;Nr(t,n.status.main+" "+r+" "+n.status.sub)},qr=S({create:function(e){var t=e.root,n=e.props;t.element.id="filepond--assistant-"+n.id,r(t.element,"role","status"),r(t.element,"aria-live","polite"),r(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:A({DID_LOAD_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){t.element.textContent="";var r=t.query("GET_ITEM",n.id);Cr.push(r.filename),clearTimeout(Mr),Mr=setTimeout(function(){Gr(t,Cr.join(", "),t.query("GET_LABEL_FILE_ADDED")),Cr.length=0},750)}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){var r=n.item;Gr(t,r.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Nr(t,r+" "+o)},DID_ABORT_ITEM_PROCESSING:Br,DID_REVERT_ITEM_PROCESSING:Br,DID_THROW_ITEM_REMOVE_ERROR:Fr,DID_THROW_ITEM_LOAD_ERROR:Fr,DID_THROW_ITEM_INVALID:Fr,DID_THROW_ITEM_PROCESSING_ERROR:Fr}),tag:"span",name:"assistant"}),Vr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.replace(new RegExp(t+".","g"),function(e){return e.charAt(1).toUpperCase()})},xr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Date.now(),o=null;return function(){for(var i=arguments.length,a=new Array(i),s=0;s=0?1:0,_=a.find(function(e){return e.markedForRemoval&&e.opacity<.45})?-1:0,T=a.length+E+_,I=hn(s,d);return 1===I?a.forEach(function(e){var r=e.rect.element.height+c;n+=r,t+=r*e.opacity}):(n=Math.ceil(T/I)*p,t=n),{visual:t,bounds:n}},Hr=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Xr=function(e,t){var n=e.query("GET_ALLOW_REPLACE"),r=e.query("GET_ALLOW_MULTIPLE"),o=e.query("GET_TOTAL_ITEMS"),i=e.query("GET_MAX_FILES"),a=t.length;return!r&&a>1?(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:ot("warning",0,"Max files")}),!0):!(!r&&n)&&(!!(V(i=r?i:1)&&o+a>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:ot("warning",0,"Max files")}),!0))},Wr=function(e,t,n){var r=e.childViews[0];return gn(r,t,{left:n.scopeLeft-r.rect.element.left,top:n.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},zr=function(e){var t=e.query("GET_ALLOW_DROP"),n=e.query("GET_DISABLED"),r=t&&!n;if(r&&!e.ref.hopper){var o=Sr(e.element,function(t){var n=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every(function(t){return ye("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(function(e){return!0===e})&&n(t)})},{filterItems:function(t){var n=e.query("GET_IGNORED_FILES");return t.filter(function(e){return!ht(e)||!n.includes(e.name.toLowerCase())})},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});o.onload=function(t,n){var r=e.ref.list.childViews[0].childViews.filter(function(e){return e.rect.element.height}),o=e.query("GET_ACTIVE_ITEMS").map(function(e){return r.find(function(t){return t.id===e.id})}).filter(function(e){return e});Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:Wr(e.ref.list,o,n),interactionMethod:ee})}),e.dispatch("DID_DROP",{position:n}),e.dispatch("DID_END_DRAG",{position:n})},o.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},o.ondrag=xr(function(t){e.dispatch("DID_DRAG",{position:t})}),o.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=o,e.ref.drip=e.appendChildView(e.createChildView(Hn))}else!r&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Qr=function(e,t){var n=e.query("GET_ALLOW_BROWSE"),r=e.query("GET_DISABLED"),o=n&&!r;o&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Fn,Object.assign({},t,{onload:function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:te})})}})),0):!o&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},Zr=function(e){var t=e.query("GET_ALLOW_PASTE"),n=e.query("GET_DISABLED"),r=t&&!n;r&&!e.ref.paster?(e.ref.paster=Pr(),e.ref.paster.onload=function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:ne})})}):!r&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Kr=A({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,n=e.props;Qr(t,n)},DID_SET_ALLOW_DROP:function(e){var t=e.root;zr(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;Zr(t)},DID_SET_DISABLED:function(e){var t=e.root,n=e.props;zr(t),Zr(t),Qr(t,n),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),$r=S({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:function(e){var t=e.root,n=e.props,r=t.query("GET_ID");r&&(t.element.id=r);var o=t.query("GET_CLASS_NAME");o&&o.split(" ").filter(function(e){return e.length}).forEach(function(e){t.element.classList.add(e)}),t.ref.label=t.appendChildView(t.createChildView(Yn,Object.assign({},n,{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(bn,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(qr,Object.assign({},n))),t.ref.data=t.appendChildView(t.createChildView(Kn,Object.assign({},n))),t.ref.measure=Ct("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(function(e){return!M(e.value)}).map(function(e){var n=e.name,r=e.value;t.element.dataset[n]=r}),t.ref.widthPrevious=null,t.ref.widthUpdated=xr(function(){t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];var i=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!i&&(t.element.addEventListener("touchmove",Yr,{passive:!1}),t.element.addEventListener("gesturestart",Yr));var s=t.query("GET_CREDITS");if(2===s.length){var u=document.createElement("a");u.className="filepond--credits",u.setAttribute("aria-hidden","true"),u.href=s[0],u.tabindex=-1,u.target="_blank",u.rel="noopener noreferrer",u.textContent=s[1],t.element.appendChild(u),t.ref.credits=u}},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Kr({root:t,props:n,actions:r}),r.filter(function(e){return/^DID_SET_STYLE_/.test(e.type)}).filter(function(e){return!M(e.data.value)}).map(function(e){var n=e.type,r=e.data,o=Vr(n.substring(8).toLowerCase(),"_");t.element.dataset[o]=r.value,t.invalidateLayout()}),!t.rect.element.hidden){t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());var o=t.ref.bounds;o||(o=t.ref.bounds=Hr(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);var i=t.ref,a=i.hopper,s=i.label,u=i.list,l=i.panel;a&&a.updateHopperState();var c=t.query("GET_PANEL_ASPECT_RATIO"),f=t.query("GET_ALLOW_MULTIPLE"),d=t.query("GET_TOTAL_ITEMS"),p=d===(f?t.query("GET_MAX_FILES")||1e6:1),E=r.find(function(e){return"DID_ADD_ITEM"===e.type});if(p&&E){var _=E.data.interactionMethod;s.opacity=0,f?s.translateY=-40:_===J?s.translateX=40:s.translateY=_===te?40:30}else p||(s.opacity=1,s.translateX=0,s.translateY=0);var T=kr(t),I=jr(t),v=s.rect.element.height,m=!f||p?0:v,h=p?u.rect.element.marginTop:0,g=0===d?0:u.rect.element.marginBottom,R=m+h+I.visual+g,O=m+h+I.bounds+g;if(u.translateY=Math.max(0,m-u.rect.element.marginTop)-T.top,c){var y=t.rect.element.width,D=y*c;c!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=c,t.ref.updateHistory=[]);var S=t.ref.updateHistory;if(S.push(y),S.length>4)for(var A=S.length,L=A-10,b=0,P=A;P>=L;P--)if(S[P]===S[P-2]&&b++,b>=2)return;l.scalable=!1,l.height=D;var w=D-m-(g-T.bottom)-(p?h:0);I.visual>w?u.overflow=w:u.overflow=null,t.height=D}else if(o.fixedHeight){l.scalable=!1;var C=o.fixedHeight-m-(g-T.bottom)-(p?h:0);I.visual>C?u.overflow=C:u.overflow=null}else if(o.cappedHeight){var N=R>=o.cappedHeight,G=Math.min(o.cappedHeight,R);l.scalable=!0,l.height=N?G:G-T.top-T.bottom;var U=G-m-(g-T.bottom)-(p?h:0);R>o.cappedHeight&&I.visual>U?u.overflow=U:u.overflow=null,t.height=Math.min(o.cappedHeight,O-T.top-T.bottom)}else{var B=d>0?T.top+T.bottom:0;l.scalable=!0,l.height=Math.max(v,R-B),t.height=Math.max(v,O-B)}t.ref.credits&&l.heightCurrent&&(t.ref.credits.style.transform="translateY("+l.heightCurrent+"px)")}},destroy:function(e){var t=e.root;t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",Yr),t.element.removeEventListener("gesturestart",Yr)},mixins:{styles:["height"]}}),Jr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null,o=Se(),i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object.assign({},e),o=[],i=[],a=function(e,t,n){!n||document.hidden?(c[e]&&c[e](t),o.push({type:e,data:t})):i.push({type:e,data:t})},s=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){y([{source:e,options:t}],{index:t.index}).then(function(e){return n(e&&e[0])}).catch(r)})},addFiles:y,getFile:function(e){return i.query("GET_ACTIVE_ITEM",e)},processFile:S,prepareFile:R,removeFile:O,moveFile:function(e,t){return i.dispatch("MOVE_ITEM",{query:e,index:t})},getFiles:D,processFiles:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n={};return t(Se(),function(e,t){n[e]=t[0]}),Jr(Object.assign({},n,{},e))},to=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[];t(e.attributes,function(t){o.push(e.attributes[t])});var i=o.filter(function(e){return e.name}).reduce(function(t,n){var o,i=r(e,n.name);return t[(o=n.name,Vr(o.replace(/^data-/,"")))]=i===n.name||i,t},{});return function e(n,r){t(r,function(r,o){t(n,function(e,t){var i=new RegExp(r);if(i.test(e)&&(delete n[e],!1!==o))if(U(o))n[o]=t;else{var a,s=o.group;H(o)&&!n[s]&&(n[s]={}),n[s][(a=e.replace(i,""),a.charAt(0).toLowerCase()+a.slice(1))]=t}}),o.mapping&&e(n[o.group],o.mapping)})}(i,n),i},no=function(){return(arguments.length<=0?void 0:arguments[0])instanceof HTMLElement?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={"^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};ye("SET_ATTRIBUTE_TO_OPTION_MAP",n);var r=Object.assign({},t),o=to("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,n);Object.keys(o).forEach(function(e){H(o[e])?(H(r[e])||(r[e]={}),Object.assign(r[e],o[e])):r[e]=o[e]}),r.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(function(e){return{source:e.value,options:{type:e.dataset.type}}}));var i=eo(r);return e.files&&Array.from(e.files).forEach(function(e){i.addFile(e)}),i.replaceElement(e),i}.apply(void 0,arguments):eo.apply(void 0,arguments)},ro=["fire","_read","_write"],oo=function(e){var t={};return Ee(e,t,ro),t},io=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,function(e,n){return t[n]})},ao=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{transfer:function(e,t){},post:function(e,t,n){var o=oe();r.onmessage=function(e){e.data.id===o&&t(e.data.message)},r.postMessage({id:o,message:e},n)},terminate:function(){r.terminate(),URL.revokeObjectURL(n)}}},so=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e})},uo=function(e,t){var n=e.slice(0,e.size,e.type);return n.lastModifiedDate=e.lastModifiedDate,n.name=t,n},lo=function(e){return uo(e,e.name)},co=[],fo=function(e){if(!co.includes(e)){co.push(e);var n,r=e({addFilter:De,utils:{Type:ge,forin:t,isString:U,isFile:ht,toNaturalFileSize:qt,replaceInString:io,getExtensionFromFilename:je,getFilenameWithoutExtension:mt,guesstimateMimeType:tr,getFileFromBlob:We,getFilenameFromURL:ke,createRoute:A,createWorker:ao,createView:S,createItemAPI:Te,loadImage:so,copyFile:lo,renameFile:uo,createBlob:ze,applyFilterChain:Oe,text:Nt,getNumericAspectRatioFromString:be},views:{fileActionButton:Ft}});n=r.options,Object.assign(Ae,n)}},po=(Kt=c()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"slice"in Blob.prototype&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window&&("supports"in(window.CSS||{})||/MSIE|Trident/.test(window.navigator.userAgent)),function(){return Kt}),Eo={apps:[]},_o=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=_o,e.destroy=_o,e.parse=_o,e.find=_o,e.registerPlugin=_o,e.getOptions=_o,e.setOptions=_o,po()){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,r="__framePainter";if(window[r])return window[r].readers.push(e),void window[r].writers.push(t);window[r]={readers:[e],writers:[t]};var o=window[r],i=1e3/n,a=null,s=null,u=null,l=null,c=function(){document.hidden?(u=function(){return window.setTimeout(function(){return f(performance.now())},i)},l=function(){return window.clearTimeout(s)}):(u=function(){return window.requestAnimationFrame(f)},l=function(){return window.cancelAnimationFrame(s)})};document.addEventListener("visibilitychange",function(){l&&l(),c(),f(performance.now())});var f=function e(t){s=u(e),a||(a=t);var n=t-a;n<=i||(a=t-n%i,o.readers.forEach(function(e){return e()}),o.writers.forEach(function(e){return e(t)}))};c(),f(performance.now())}(function(){Eo.apps.forEach(function(e){return e._read()})},function(e){Eo.apps.forEach(function(t){return t._write(e)})});var To=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:po,create:e.create,destroy:e.destroy,parse:e.parse,find:e.find,registerPlugin:e.registerPlugin,setOptions:e.setOptions}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(function(){return To()},0):document.addEventListener("DOMContentLoaded",To);var Io=function(){return t(Se(),function(t,n){e.OptionTypes[t]=n[1]})};e.Status=Object.assign({},Me),e.FileOrigin=Object.assign({},ve),e.FileStatus=Object.assign({},Ie),e.OptionTypes={},Io(),e.create=function(){var t=no.apply(void 0,arguments);return t.on("destroy",e.destroy),Eo.apps.push(t),oo(t)},e.destroy=function(e){var t=Eo.apps.findIndex(function(t){return t.isAttachedTo(e)});return t>=0&&(Eo.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll(".filepond")).filter(function(e){return!Eo.apps.find(function(t){return t.isAttachedTo(e)})}).map(function(t){return e.create(t)})},e.find=function(e){var t=Eo.apps.find(function(t){return t.isAttachedTo(e)});return t?oo(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:null;if(null===n)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},o=["svg","path"],i=function(e){return o.includes(e)},a=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof n&&(o=n,n=null);var a=i(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n&&(i(e)?r(a,"class",n):a.className=n),t(o,function(e,t){r(a,e,t)}),a},s=function(e,t){return function(e,n){return void 0!==n?t.splice(n,0,e):t.push(e),e}},u=function(e,t){return function(n){return t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n}},l="undefined"!=typeof window&&void 0!==window.document,c=function(){return l},f="children"in(c()?a("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},d=function(e,t,n,r){var o=n[0]||e.left,i=n[1]||e.top,a=o+e.width,s=i+e.height*(r[1]||1),u={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:o,top:i,right:a,bottom:s}};return t.filter(function(e){return!e.isRectIgnored()}).map(function(e){return e.rect}).forEach(function(e){p(u.inner,Object.assign({},e.inner)),p(u.outer,Object.assign({},e.outer))}),E(u.inner),u.outer.bottom+=u.element.marginBottom,u.outer.right+=u.element.marginRight,E(u.outer),u},p=function(e,t){t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},E=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},_=function(e){return"number"==typeof e},T=function(e){return e<.5?2*e*e:(4-2*e)*e-1},I={spring:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,r=void 0===t?.5:t,o=e.damping,i=void 0===o?.75:o,a=e.mass,s=void 0===a?10:a,u=null,l=null,c=0,f=!1,d=n({interpolate:function(e,t){if(!f){if(!_(u)||!_(l))return f=!0,void(c=0);(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},o=r.duration,i=void 0===o?500:o,a=r.easing,s=void 0===a?T:a,u=r.delay,l=void 0===u?0:u,c=null,f=!0,d=!1,p=null,E=n({interpolate:function(n,r){f||null===p||(null===c&&(c=n),n-c=i||r?(e=1,t=d?0:1,E.onupdate(t*p),E.oncomplete(t*p),f=!0):(t=e/i,E.onupdate((e>=0?s(d?1-t:t):0)*p))))},target:{get:function(){return d?0:p},set:function(e){if(null===p)return p=e,E.onupdate(e),void E.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach(function(t){e.forEach(function(e){var o=e,i=function(){return n[e]},a=function(t){return n[e]=t};"object"==typeof e&&(o=e.key,i=e.getter||i,a=e.setter||a),t[o]&&!r||(t[o]={get:i,set:a})})})},h=function(e){return null!=e},g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},R=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var n in t)if(t[n]!==e[n])return!0;return!1},O=function(e,t){var n=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,a=t.scaleX,s=t.scaleY,u=t.rotateX,l=t.rotateY,c=t.rotateZ,f=t.originX,d=t.originY,p=t.width,E=t.height,_="",T="";(h(f)||h(d))&&(T+="transform-origin: "+(f||0)+"px "+(d||0)+"px;"),h(r)&&(_+="perspective("+r+"px) "),(h(o)||h(i))&&(_+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(h(a)||h(s))&&(_+="scale3d("+(h(a)?a:1)+", "+(h(s)?s:1)+", 1) "),h(c)&&(_+="rotateZ("+c+"rad) "),h(u)&&(_+="rotateX("+u+"rad) "),h(l)&&(_+="rotateY("+l+"rad) "),_.length&&(T+="transform:"+_+";"),h(n)&&(T+="opacity:"+n+";",0===n&&(T+="visibility:hidden;"),n<1&&(T+="pointer-events:none;")),h(E)&&(T+="height:"+E+"px;"),h(p)&&(T+="width:"+p+"px;");var I=e.elementCurrentStyle||"";T.length===I.length&&T===I||(e.style.cssText=T,e.elementCurrentStyle=T)},y={styles:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewInternalAPI,o=e.viewExternalAPI,i=e.view,a=Object.assign({},n),s={};m(t,[r,o],n);var u=function(){return i.rect?d(i.rect,i.childViews,[n.translateX||0,n.translateY||0],[n.scaleX||0,n.scaleY||0]):null};return r.rect={get:u},o.rect={get:u},t.forEach(function(e){n[e]=void 0===a[e]?g[e]:a[e]}),{write:function(){if(R(s,n))return O(i.element,n),Object.assign(s,Object.assign({},n)),!0},destroy:function(){}}},listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t,n=e.viewExternalAPI,r=(e.viewState,e.view),o=[],i=(t=r.element,function(e,n){t.addEventListener(e,n)}),a=function(e){return function(t,n){e.removeEventListener(t,n)}}(r.element);return n.on=function(e,t){o.push({type:e,fn:t}),i(e,t)},n.off=function(e,t){o.splice(o.findIndex(function(n){return n.type===e&&n.fn===t}),1),a(e,t)},{write:function(){return!0},destroy:function(){o.forEach(function(e){a(e.type,e.fn)})}}},animations:function(e){var n=e.mixinConfig,r=e.viewProps,o=e.viewInternalAPI,i=e.viewExternalAPI,a=Object.assign({},r),s=[];return t(n,function(e,t){var n=v(t);n&&(n.onupdate=function(t){r[e]=t},n.target=a[e],m([{key:e,setter:function(e){n.target!==e&&(n.target=e)},getter:function(){return r[e]}}],[o,i],r,!0),s.push(n))}),{write:function(e){var t=document.hidden,n=!0;return s.forEach(function(r){r.resting||(n=!1),r.interpolate(e,t)}),n},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewExternalAPI;m(t,r,n)}},D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.layoutCalculated||(e.paddingTop=parseInt(n.paddingTop,10)||0,e.marginTop=parseInt(n.marginTop,10)||0,e.marginRight=parseInt(n.marginRight,10)||0,e.marginBottom=parseInt(n.marginBottom,10)||0,e.marginLeft=parseInt(n.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=null===t.offsetParent,e},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,r=void 0===t?"div":t,o=e.name,i=void 0===o?null:o,l=e.attributes,c=void 0===l?{}:l,p=e.read,E=void 0===p?function(){}:p,_=e.write,T=void 0===_?function(){}:_,I=e.create,v=void 0===I?function(){}:I,m=e.destroy,h=void 0===m?function(){}:m,g=e.filterFrameActionsForChild,R=void 0===g?function(e,t){return t}:g,O=e.didCreateView,S=void 0===O?function(){}:O,A=e.didWriteView,L=void 0===A?function(){}:A,b=e.ignoreRect,P=void 0!==b&&b,M=e.ignoreRectUpdate,w=void 0!==M&&M,C=e.mixins,N=void 0===C?[]:C;return function(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=a(r,"filepond--"+i,c),p=window.getComputedStyle(l,null),_=D(),I=null,m=!1,g=[],O=[],A={},b={},M=[T],C=[E],G=[h],U=function(){return l},B=function(){return g.concat()},F=function(){return I||(I=d(_,g,[0,0],[1,1]))},q={element:{get:U},style:{get:function(){return p}},childViews:{get:B}},V=Object.assign({},q,{rect:{get:F},ref:{get:function(){return A}},is:function(e){return i===e},appendChild:(t=l,function(e,n){void 0!==n&&t.children[n]?t.insertBefore(e,t.children[n]):t.appendChild(e)}),createChildView:function(e){return function(t,n){return t(e,n)}}(e),linkView:function(e){return g.push(e),e},unlinkView:function(e){g.splice(g.indexOf(e),1)},appendChildView:s(0,g),removeChildView:u(l,g),registerWriter:function(e){return M.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return G.push(e)},invalidateLayout:function(){return l.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:function(){return m}},isRectIgnored:function(){return P},_read:function(){I=null,g.forEach(function(e){return e._read()}),!(w&&_.width&&_.height)&&D(_,l,p);var e={root:j,props:o,rect:_};C.forEach(function(t){return t(e)})},_write:function(e,t,n){var r=0===t.length;return M.forEach(function(i){!1===i({props:o,root:j,actions:t,timestamp:e,shouldOptimize:n})&&(r=!1)}),O.forEach(function(t){!1===t.write(e)&&(r=!1)}),g.filter(function(e){return!!e.element.parentNode}).forEach(function(o){o._write(e,R(o,t),n)||(r=!1)}),g.forEach(function(o,i){o.element.parentNode||(j.appendChild(o.element,i),o._read(),o._write(e,R(o,t),n),r=!1)}),m=r,L({props:o,root:j,actions:t,timestamp:e}),r},_destroy:function(){O.forEach(function(e){return e.destroy()}),G.forEach(function(e){e({root:j,props:o})}),g.forEach(function(e){return e._destroy()})}},Y=Object.assign({},q,{rect:{get:function(){return _}}});Object.keys(N).sort(function(e,t){return"styles"===e?1:"styles"===t?-1:0}).forEach(function(e){var t=y[e]({mixinConfig:N[e],viewProps:o,viewState:b,viewInternalAPI:V,viewExternalAPI:x,view:n(Y)});t&&O.push(t)});var j=n(V);v({root:j,props:o});var k=f(l);return g.forEach(function(e,t){j.appendChild(e.element,k+t)}),S(j),n(x)}},A=function(e,t){return function(n){var r=n.root,o=n.props,i=n.actions,a=void 0===i?[]:i,s=n.timestamp,u=n.shouldOptimize;a.filter(function(t){return e[t.type]}).forEach(function(t){return e[t.type]({root:r,props:o,action:t.data,timestamp:s,shouldOptimize:u})}),t&&t({root:r,props:o,actions:a,timestamp:s,shouldOptimize:u})}},L=function(e,t){return t.parentNode.insertBefore(e,t)},b=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},P=function(e){return Array.isArray(e)},M=function(e){return null==e},w=function(e){return e.trim()},C=function(e){return""+e},N=function(e){return"boolean"==typeof e},G=function(e){return N(e)?e:"true"===e},U=function(e){return"string"==typeof e},B=function(e){return _(e)?e:U(e)?C(e).replace(/[a-z]+/gi,""):0},F=function(e){return parseInt(B(e),10)},q=function(e){return parseFloat(B(e))},V=function(e){return _(e)&&isFinite(e)&&Math.floor(e)===e},x=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(V(e))return e;var n=C(e).trim();return/MB$/i.test(n)?(n=n.replace(/MB$i/,"").trim(),F(n)*t*t):/KB/i.test(n)?(n=n.replace(/KB$i/,"").trim(),F(n)*t):F(n)},Y=function(e){return"function"==typeof e},j={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},k=function(e,t,n,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===n||"PATCH"===n?"?"+e+"=":"",method:n,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){var a=i.headers.split(/:(.+)/);i.headers={header:a[0],value:a[1]}}return i.withCredentials=G(i.withCredentials),i},H=function(e){return"object"==typeof e&&null!==e},X=function(e){return P(e)?"array":function(e){return null===e}(e)?"null":V(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":function(e){return H(e)&&U(e.url)&&H(e.process)&&H(e.revert)&&H(e.restore)&&H(e.fetch)}(e)?"api":typeof e},W={array:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return M(e)?[]:P(e)?e:C(e).split(t).map(w).filter(function(e){return e.length})},boolean:G,int:function(e){return"bytes"===X(e)?x(e):F(e)},number:q,float:q,bytes:x,string:function(e){return Y(e)?e:C(e)},function:function(e){return function(e){for(var t=self,n=e.split("."),r=null;r=n.shift();)if(!(t=t[r]))return null;return t}(e)},serverapi:function(e){return(r={}).url=U(n=e)?n:n.url||"",r.timeout=n.timeout?parseInt(n.timeout,10):0,r.headers=n.headers?n.headers:{},t(j,function(e){r[e]=k(e,n[e],j[e],r.timeout,r.headers)}),r.process=n.process||U(n)||n.url?r.process:null,r.remove=n.remove||null,delete r.headers,r;var n,r},object:function(e){try{return JSON.parse(e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(e){return null}}},z=function(e,t,n){if(e===t)return e;var r,o=X(e);if(o!==n){var i=(r=e,W[n](r));if(o=X(i),null===i)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+n+'"';e=i}return e},Q=function(e){var r={};return t(e,function(t){var n,o,i,a=e[t];r[t]=(n=a[0],o=a[1],i=n,{enumerable:!0,get:function(){return i},set:function(e){i=z(e,n,o)}})}),n(r)},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.split(/(?=[A-Z])/).map(function(e){return e.toLowerCase()}).join(t)},K=function(e){return function(n,r,o){var i={};return t(e,function(e){var t=Z(e,"_").toUpperCase();i["SET_"+t]=function(r){try{o.options[e]=r.value}catch(e){}n("DID_SET_"+t,{value:o.options[e]})}}),i}},$=function(e){return function(n){var r={};return t(e,function(e){r["GET_"+Z(e,"_").toUpperCase()]=function(t){return n.options[e]}}),r}},J=1,ee=2,te=3,ne=4,re=5,oe=function(){return Math.random().toString(36).substring(2,11)};function ie(e){this.wrapped=e}function ae(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof ie;Promise.resolve(s?a.wrapped:a).then(function(e){s?r("next",e):o(i.done?"return":"normal",e)},function(e){r("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function se(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}"function"==typeof Symbol&&Symbol.asyncIterator&&(ae.prototype[Symbol.asyncIterator]=function(){return this}),ae.prototype.next=function(e){return this._invoke("next",e)},ae.prototype.throw=function(e){return this._invoke("throw",e)},ae.prototype.return=function(e){return this._invoke("return",e)};function ue(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1?t-1:0),o=1;o1?t-1:0),o=1;oBrowse',ge.STRING],labelInvalidField:["Field contains invalid files",ge.STRING],labelFileWaitingForSize:["Waiting for size",ge.STRING],labelFileSizeNotAvailable:["Size not available",ge.STRING],labelFileCountSingular:["file in list",ge.STRING],labelFileCountPlural:["files in list",ge.STRING],labelFileLoading:["Loading",ge.STRING],labelFileAdded:["Added",ge.STRING],labelFileLoadError:["Error during load",ge.STRING],labelFileRemoved:["Removed",ge.STRING],labelFileRemoveError:["Error during remove",ge.STRING],labelFileProcessing:["Uploading",ge.STRING],labelFileProcessingComplete:["Upload complete",ge.STRING],labelFileProcessingAborted:["Upload cancelled",ge.STRING],labelFileProcessingError:["Error during upload",ge.STRING],labelFileProcessingRevertError:["Error during revert",ge.STRING],labelTapToCancel:["tap to cancel",ge.STRING],labelTapToRetry:["tap to retry",ge.STRING],labelTapToUndo:["tap to undo",ge.STRING],labelButtonRemoveItem:["Remove",ge.STRING],labelButtonAbortItemLoad:["Abort",ge.STRING],labelButtonRetryItemLoad:["Retry",ge.STRING],labelButtonAbortItemProcessing:["Cancel",ge.STRING],labelButtonUndoItemProcessing:["Undo",ge.STRING],labelButtonRetryItemProcessing:["Retry",ge.STRING],labelButtonProcessItem:["Upload",ge.STRING],iconRemove:['',ge.STRING],iconProcess:['',ge.STRING],iconRetry:['',ge.STRING],iconUndo:['',ge.STRING],iconDone:['',ge.STRING],oninit:[null,ge.FUNCTION],onwarning:[null,ge.FUNCTION],onerror:[null,ge.FUNCTION],onactivatefile:[null,ge.FUNCTION],oninitfile:[null,ge.FUNCTION],onaddfilestart:[null,ge.FUNCTION],onaddfileprogress:[null,ge.FUNCTION],onaddfile:[null,ge.FUNCTION],onprocessfilestart:[null,ge.FUNCTION],onprocessfileprogress:[null,ge.FUNCTION],onprocessfileabort:[null,ge.FUNCTION],onprocessfilerevert:[null,ge.FUNCTION],onprocessfile:[null,ge.FUNCTION],onprocessfiles:[null,ge.FUNCTION],onremovefile:[null,ge.FUNCTION],onpreparefile:[null,ge.FUNCTION],onupdatefiles:[null,ge.FUNCTION],onreorderfiles:[null,ge.FUNCTION],beforeDropFile:[null,ge.FUNCTION],beforeAddFile:[null,ge.FUNCTION],beforeRemoveFile:[null,ge.FUNCTION],beforePrepareFile:[null,ge.FUNCTION],stylePanelLayout:[null,ge.STRING],stylePanelAspectRatio:[null,ge.STRING],styleItemPanelAspectRatio:[null,ge.STRING],styleButtonRemoveItemPosition:["left",ge.STRING],styleButtonProcessItemPosition:["right",ge.STRING],styleLoadIndicatorPosition:["right",ge.STRING],styleProgressIndicatorPosition:["right",ge.STRING],styleButtonRemoveItemAlign:[!1,ge.BOOLEAN],files:[[],ge.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],ge.ARRAY]},Le=function(e,t){return M(t)?e[0]||null:V(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(function(e){return e.id===t})||null)},be=function(e){if(M(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Pe=function(e){return e.filter(function(e){return!e.archived})},Me={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},we=null,Ce=[Ie.LOAD_ERROR,Ie.PROCESSING_ERROR,Ie.PROCESSING_REVERT_ERROR],Ne=[Ie.LOADING,Ie.PROCESSING,Ie.PROCESSING_QUEUED,Ie.INIT],Ge=[Ie.PROCESSING_COMPLETE],Ue=function(e){return Ce.includes(e.status)},Be=function(e){return Ne.includes(e.status)},Fe=function(e){return Ge.includes(e.status)},qe=function(e){return H(e.options.server)&&(H(e.options.server.process)||Y(e.options.server.process))},Ve=function(e){return{GET_STATUS:function(){var t=Pe(e.items),n=Me.EMPTY,r=Me.ERROR,o=Me.BUSY,i=Me.IDLE,a=Me.READY;return 0===t.length?n:t.some(Ue)?r:t.some(Be)?o:t.some(Fe)?a:i},GET_ITEM:function(t){return Le(e.items,t)},GET_ACTIVE_ITEM:function(t){return Le(Pe(e.items),t)},GET_ACTIVE_ITEMS:function(){return Pe(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var n=Le(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:function(t){var n=Le(e.items,t);return n?n.fileSize:null},GET_STYLES:function(){return Object.keys(e.options).filter(function(e){return/^style/.test(e)}).map(function(t){return{name:t,value:e.options[t]}})},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(e.options.stylePanelLayout)?1:be(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return Pe(e.items).filter(function(e){return e.status===t})},GET_TOTAL_ITEMS:function(){return Pe(e.items).length},SHOULD_UPDATE_FILE_INPUT:function(){return e.options.storeAsFile&&function(){if(null===we)try{var e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));var t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,we=1===t.files.length}catch(e){we=!1}return we}()&&!qe(e)},IS_ASYNC:function(){return qe(e)},GET_FILE_SIZE_LABELS:function(e){return{labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0}}}},xe=function(e,t,n){return Math.max(Math.min(n,e),t)},Ye=function(e){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e)},je=function(e){return e.split("/").pop().split("?").shift()},ke=function(e){return e.split(".").pop()},He=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},Xe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+He(e.getMonth()+1,"00")+"-"+He(e.getDate(),"00")+"_"+He(e.getHours(),"00")+"-"+He(e.getMinutes(),"00")+"-"+He(e.getSeconds(),"00")},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="string"==typeof n?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return o.lastModifiedDate=new Date,e._relativePath&&(o._relativePath=e._relativePath),U(t)||(t=Xe()),t&&null===r&&ke(t)?o.name=t:(r=r||function(e){if("string"!=typeof e)return"";var t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?"jpeg"===t?"jpg":t:""}(o.type),o.name=t+(r?"."+r:"")),o},ze=function(e,t){var n=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n){var r=new n;return r.append(e),r.getBlob(t)}return new Blob([e],{type:t})},Qe=function(e){return(/^data:(.+);/.exec(e)||[])[1]||null},Ze=function(e){var t=Qe(e);return function(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=200&&a.status<300?r.onload(a):r.onerror(a)},a.onerror=function(){return r.onerror(a)},a.onabort=function(){o=!0,r.onabort()},a.ontimeout=function(){return r.ontimeout(a)},a.open(n.method,t,!0),V(n.timeout)&&(a.timeout=n.timeout),Object.keys(n.headers).forEach(function(e){var t=unescape(encodeURIComponent(n.headers[e]));a.setRequestHeader(e,t)}),n.responseType&&(a.responseType=n.responseType),n.withCredentials&&(a.withCredentials=!0),a.send(e),r},ot=function(e,t,n,r){return{type:e,code:t,body:n,headers:r}},it=function(e){return function(t){e(ot("error",0,"Timeout",t.getAllResponseHeaders()))}},at=function(e){return/\?/.test(e)},st=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return null;var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a,s,u,l){var c=rt(o,st(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var r=e.getAllResponseHeaders(),a=et(r).name||je(o);i(ot("load",e.status,"HEAD"===t.method?null:We(n(e.response),a),r))},c.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){l(ot("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=it(a),c.onprogress=s,c.onabort=u,c}},lt=0,ct=1,ft=2,dt=3,pt=4,Et=function(e,t,n,r,o,i,a,s,u,l,c){for(var f=[],d=c.chunkTransferId,p=c.chunkServer,E=c.chunkSize,_=c.chunkRetryDelays,T={serverId:d,aborted:!1},I=t.ondata||function(e){return e},v=t.onload||function(e,t){return"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response},m=t.onerror||function(e){return null},h=Math.floor(r.size/E),g=0;g<=h;g++){var R=g*E,O=r.slice(R,R+E,"application/offset+octet-stream");f[g]={index:g,size:O.size,offset:R,data:O,file:r,progress:0,retries:ue(_),status:lt,error:null,request:null,timeout:null}}var y,D,S,A,L=function(e){return e.status===lt||e.status===dt},b=function(t){if(!T.aborted)if(t=t||f.find(L)){t.status=ft,t.progress=null;var n=p.ondata||function(e){return e},o=p.onerror||function(e){return null},s=st(e,p.url,T.serverId),l="function"==typeof p.headers?p.headers(t):Object.assign({},p.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":r.size,"Upload-Name":r.name}),c=t.request=rt(n(t.data),s,Object.assign({},p,{headers:l}));c.onload=function(){t.status=ct,t.request=null,w()},c.onprogress=function(e,n,r){t.progress=e?n:null,M()},c.onerror=function(e){t.status=dt,t.request=null,t.error=o(e.response)||e.statusText,P(t)||a(ot("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))},c.ontimeout=function(e){t.status=dt,t.request=null,P(t)||it(a)(e)},c.onabort=function(){t.status=lt,t.request=null,u()}}else f.every(function(e){return e.status===ct})&&i(T.serverId)},P=function(e){return 0!==e.retries.length&&(e.status=pt,clearTimeout(e.timeout),e.timeout=setTimeout(function(){b(e)},e.retries.shift()),!0)},M=function(){var e=f.reduce(function(e,t){return null===e||null===t.progress?null:e+t.progress},0);if(null===e)return s(!1,0,0);var t=f.reduce(function(e,t){return e+t.size},0);s(!0,e,t)},w=function(){f.filter(function(e){return e.status===ft}).length>=1||b()};return T.serverId?(y=function(e){T.aborted||(f.filter(function(t){return t.offset0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,o=new Array(e),i=0;ir.chunkSize,p=f&&(d||r.chunkForce);if(o instanceof Blob&&p)return Et(e,t,n,o,i,a,s,u,l,c,r);var E=t.ondata||function(e){return e},_=t.onload||function(e){return e},T=t.onerror||function(e){return null},I="function"==typeof t.headers?t.headers(o,i)||{}:Object.assign({},t.headers),v=Object.assign({},t,{headers:I}),m=new FormData;H(i)&&m.append(n,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach(function(e){m.append(n,e.file,null===e.name?e.file.name:""+e.name+e.file.name)});var h=rt(E(m),st(e,t.url),v);return h.onload=function(e){a(ot("load",e.status,_(e.response),e.getAllResponseHeaders()))},h.onerror=function(e){s(ot("error",e.status,T(e.response)||e.statusText,e.getAllResponseHeaders()))},h.ontimeout=it(s),h.onprogress=u,h.onabort=l,h}}}(e,t,n,r):null},Tt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!U(t.url))return function(e,t){return t()};var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a){var s=rt(o,e+t.url,t);return s.onload=function(e){i(ot("load",e.status,n(e.response),e.getAllResponseHeaders()))},s.onerror=function(e){a(ot("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},s.ontimeout=it(a),s}},It=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+Math.random()*(t-e)},vt=function(e,t){var n={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=t.allowMinimumUploadDuration,o=function(){n.request&&(n.perceivedPerformanceUpdater.clear(),n.request.abort&&n.request.abort(),n.complete=!0)},i=r?function(){return n.progress?Math.min(n.progress,n.perceivedProgress):null}:function(){return n.progress||null},a=r?function(){return Math.min(n.duration,n.perceivedDuration)}:function(){return n.duration},s=Object.assign({},pe(),{process:function(t,o){var i=function(){0!==n.duration&&null!==n.progress&&s.fire("progress",s.getProgress())},a=function(){n.complete=!0,s.fire("load-perceived",n.response.body)};s.fire("start"),n.timestamp=Date.now(),n.perceivedPerformanceUpdater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:25),r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=null,i=Date.now();return t>0&&function a(){var s=Date.now()-i,u=It(n,r);s+u>t&&(u=s+u-t);var l=s/t;l>=1||document.hidden?e(1):(e(l),o=setTimeout(a,u))}(),{clear:function(){clearTimeout(o)}}}(function(e){n.perceivedProgress=e,n.perceivedDuration=Date.now()-n.timestamp,i(),n.response&&1===n.perceivedProgress&&!n.complete&&a()},r?It(750,1500):0),n.request=e(t,o,function(e){n.response=H(e)?e:{type:"load",code:200,body:""+e,headers:{}},n.duration=Date.now()-n.timestamp,n.progress=1,s.fire("load",n.response.body),(!r||r&&1===n.perceivedProgress)&&a()},function(e){n.perceivedPerformanceUpdater.clear(),s.fire("error",H(e)?e:{type:"error",code:0,body:""+e})},function(e,t,r){n.duration=Date.now()-n.timestamp,n.progress=e?t/r:null,i()},function(){n.perceivedPerformanceUpdater.clear(),s.fire("abort",n.response?n.response.body:null)},function(e){s.fire("transfer",e)})},abort:o,getProgress:i,getDuration:a,reset:function(){o(),n.complete=!1,n.perceivedProgress=0,n.progress=0,n.timestamp=null,n.perceivedDuration=0,n.duration=0,n.request=null,n.response=null}});return s},mt=function(e){return e.substring(0,e.lastIndexOf("."))||e},ht=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},gt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=oe(),i={archived:!1,frozen:!1,released:!1,source:null,file:r,serverFileReference:t,transferId:null,processingAborted:!1,status:t?Ie.PROCESSING_COMPLETE:Ie.INIT,activeLoader:null,activeProcessor:null},a=null,s={},u=function(e){return i.status=e},l=function(e){if(!i.released&&!i.frozen){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},r=n.query,o=n.success,i=void 0===o?function(){}:o,a=n.failure,s=void 0===a?function(){}:a,u=se(n,["query","success","failure"]),l=Le(e.items,r);l?t(l,i,s,u||{}):s({error:ot("error",0,"Item not found"),file:null})}},Pt=function(e,t,n){return{ABORT_ALL:function(){Pe(n.items).forEach(function(e){e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map(function(e){return{source:e.source?e.source:e,options:e.options}}),i=Pe(n.items);i.forEach(function(t){o.find(function(e){return e.source===t.source||e.source===t.file})||e("REMOVE_ITEM",{query:t,remove:!1})}),i=Pe(n.items),o.forEach(function(t,n){i.find(function(e){return e.source===t.source||e.file===t.source})||e("ADD_ITEM",Object.assign({},t,{interactionMethod:re,index:n}))})},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id,i=r.action,a=r.change;a.silent||(clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(function(){var r=Rt(n.items,o);if(t("IS_ASYNC")){r.origin===ve.LOCAL&&e("DID_LOAD_ITEM",{id:r.id,error:null,serverFileReference:r.source});var s,u=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return r.status===Ie.PROCESSING_COMPLETE?(s=n.options.instantUpload,void r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s?u:function(){}).catch(function(){})):r.status===Ie.PROCESSING?function(e){r.abortProcessing().then(e?u:function(){})}(n.options.instantUpload):void(n.options.instantUpload&&u())}Oe("SHOULD_PREPARE_OUTPUT",!1,{item:r,query:t,action:i,change:a}).then(function(n){var i=t("GET_BEFORE_PREPARE_FILE");i&&(n=i(r,n)),n&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:r,success:function(t){e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)})},0))},MOVE_ITEM:function(e){var t=e.query,r=e.index,o=Le(n.items,t);if(o){var i=n.items.indexOf(o);i!==(r=xe(r,0,n.items.length-1))&&n.items.splice(r,0,n.items.splice(i,1)[0])}},SORT:function(r){var o=r.compare;Lt(n,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(n){var r=n.items,o=n.index,i=n.interactionMethod,a=n.success,s=void 0===a?function(){}:a,u=n.failure,l=void 0===u?function(){}:u,c=o;if(-1===o||void 0===o){var f=t("GET_ITEM_INSERT_LOCATION"),d=t("GET_TOTAL_ITEMS");c="before"===f?0:d}var p=t("GET_IGNORED_FILES"),E=r.filter(function(e){return ht(e)?!p.includes(e.name.toLowerCase()):!M(e)}).map(function(t){return new Promise(function(n,r){e("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:n,failure:r,index:c++,options:t.options||{}})})});Promise.all(E).then(s).catch(l)},ADD_ITEM:function(r){var o=r.source,i=r.index,a=void 0===i?-1:i,s=r.interactionMethod,u=r.success,l=void 0===u?function(){}:u,c=r.failure,f=void 0===c?function(){}:c,d=r.options,p=void 0===d?{}:d;if(M(o))f({error:ot("error",0,"No source"),file:null});else if(!ht(o)||!n.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(e){var t=Pe(e.items).length;if(!e.options.allowMultiple)return 0===t;var n=e.options.maxFiles;return null===n||t=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:h,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void f({error:t,file:Te(v)});e("DID_THROW_ITEM_LOAD_ERROR",{id:h,error:t,status:{main:r,sub:n.options.labelTapToRetry}})}),v.on("load-file-error",function(t){e("DID_THROW_ITEM_INVALID",{id:h,error:t.status,status:t.status}),f({error:t.status,file:Te(v)})}),v.on("load-abort",function(){e("REMOVE_ITEM",{query:h})}),v.on("load-skip",function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}})}),v.on("load",function(){var r=function(r){r?(v.on("metadata-update",function(t){e("DID_UPDATE_ITEM_METADATA",{id:h,change:t})}),Oe("SHOULD_PREPARE_OUTPUT",!1,{item:v,query:t}).then(function(r){var i=t("GET_BEFORE_PREPARE_FILE");i&&(r=i(v,r));var a=function(){e("COMPLETE_LOAD_ITEM",{query:h,item:v,data:{source:o,success:l}}),St(e,n)};r?e("REQUEST_PREPARE_OUTPUT",{query:h,item:v,success:function(t){e("DID_PREPARE_OUTPUT",{id:h,file:t}),a()}},!0):a()})):e("REMOVE_ITEM",{query:h})};Oe("DID_LOAD_ITEM",v,{query:t,dispatch:e}).then(function(){At(t("GET_BEFORE_ADD_FILE"),Te(v)).then(r)}).catch(function(t){if(!t||!t.error||!t.status)return r(!1);e("DID_THROW_ITEM_INVALID",{id:h,error:t.error,status:t.status})})}),v.on("process-start",function(){e("DID_START_ITEM_PROCESSING",{id:h})}),v.on("process-progress",function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:h,progress:t})}),v.on("process-error",function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-revert-error",function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:h,error:t,status:{main:Dt(n.options.labelFileProcessingRevertError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-complete",function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:h,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:h,value:t})}),v.on("process-abort",function(){e("DID_ABORT_ITEM_PROCESSING",{id:h})}),v.on("process-revert",function(){e("DID_REVERT_ITEM_PROCESSING",{id:h}),e("DID_DEFINE_VALUE",{id:h,value:null})}),e("DID_ADD_ITEM",{id:h,index:a,interactionMethod:s}),St(e,n);var g=n.options.server||{},R=g.url,O=g.load,y=g.restore,D=g.fetch;v.load(o,tt(I===ve.INPUT?U(o)&&function(e){return(e.indexOf(":")>-1||e.indexOf("//")>-1)&&yt(location.href)!==yt(e)}(o)&&D?ut(R,D):Ot:ut(R,I===ve.LIMBO?y:O)),function(e,n,r){Oe("LOAD_FILE",e,{query:t}).then(n).catch(r)})}},REQUEST_PREPARE_OUTPUT:function(e){var n=e.item,r=e.success,o=e.failure,i=void 0===o?function(){}:o,a={error:ot("error",0,"Item not found"),file:null};if(n.archived)return i(a);Oe("PREPARE_OUTPUT",n.file,{query:t,item:n}).then(function(e){Oe("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:n}).then(function(e){if(n.archived)return i(a);r(e)})})},COMPLETE_LOAD_ITEM:function(r){var o=r.item,i=r.data,a=i.success,s=i.source,u=t("GET_ITEM_INSERT_LOCATION");if(Y(u)&&s&&Lt(n,u),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===ve.INPUT?null:s}),a(Te(o)),o.origin!==ve.LOCAL)return o.origin===ve.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:o.id,value:o.serverId||s})):void(t("IS_ASYNC")&&n.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:bt(n,function(e){e.retryLoad()}),REQUEST_ITEM_PREPARE:bt(n,function(t,n,r){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(r){e("DID_PREPARE_OUTPUT",{id:t.id,file:r}),n({file:t,output:r})},failure:r},!0)}),REQUEST_ITEM_PROCESSING:bt(n,function(r,o,i){if(r.status===Ie.IDLE||r.status===Ie.PROCESSING_ERROR)r.status!==Ie.PROCESSING_QUEUED&&(r.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:r.id}),e("PROCESS_ITEM",{query:r,success:o,failure:i},!0));else{var a=function(){return e("REQUEST_ITEM_PROCESSING",{query:r,success:o,failure:i})},s=function(){return document.hidden?a():setTimeout(a,32)};r.status===Ie.PROCESSING_COMPLETE||r.status===Ie.PROCESSING_REVERT_ERROR?r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(s).catch(function(){}):r.status===Ie.PROCESSING&&r.abortProcessing().then(s)}}),PROCESS_ITEM:bt(n,function(r,o,i){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",Ie.PROCESSING).length!==a){if(r.status!==Ie.PROCESSING){var s=function t(){var r=n.processingQueue.shift();if(r){var o=r.id,i=r.success,a=r.failure,s=Le(n.items,o);s&&!s.archived?e("PROCESS_ITEM",{query:o,success:i,failure:a},!0):t()}};r.onOnce("process-complete",function(){o(Te(r)),s();var i=n.options.server;if(n.options.instantUpload&&r.origin===ve.LOCAL&&Y(i.remove)){var a=function(){};r.origin=ve.LIMBO,n.options.server.remove(r.source,a,a)}t("GET_ITEMS_BY_STATUS",Ie.PROCESSING_COMPLETE).length===n.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),r.onOnce("process-error",function(e){i({error:e,file:Te(r)}),s()});var u=n.options;r.process(vt(_t(u.server.url,u.server.process,u.name,{chunkTransferId:r.transferId,chunkServer:u.server.patch,chunkUploads:u.chunkUploads,chunkForce:u.chunkForce,chunkSize:u.chunkSize,chunkRetryDelays:u.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),function(n,o,i){Oe("PREPARE_OUTPUT",n,{query:t,item:r}).then(function(t){e("DID_PREPARE_OUTPUT",{id:r.id,file:t}),o(t)}).catch(i)})}}else n.processingQueue.push({id:r.id,success:o,failure:i})}),RETRY_ITEM_PROCESSING:bt(n,function(t){e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:bt(n,function(n){At(t("GET_BEFORE_REMOVE_FILE"),Te(n)).then(function(t){t&&e("REMOVE_ITEM",{query:n})})}),RELEASE_ITEM:bt(n,function(e){e.release()}),REMOVE_ITEM:bt(n,function(r,o,i,a){var s=function(){var t=r.id;Rt(n.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:r}),St(e,n),o(Te(r))},u=n.options.server;r.origin===ve.LOCAL&&u&&Y(u.remove)&&!1!==a.remove?(e("DID_START_ITEM_REMOVE",{id:r.id}),u.remove(r.source,function(){return s()},function(t){e("DID_THROW_ITEM_REMOVE_ERROR",{id:r.id,error:ot("error",0,t,null),status:{main:Dt(n.options.labelFileRemoveError)(t),sub:n.options.labelTapToRetry}})})):((a.revert&&r.origin!==ve.LOCAL&&null!==r.serverId||n.options.chunkUploads&&r.file.size>n.options.chunkSize||n.options.chunkUploads&&n.options.chunkForce)&&r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")),s())}),ABORT_ITEM_LOAD:bt(n,function(e){e.abortLoad()}),ABORT_ITEM_PROCESSING:bt(n,function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(function(){n.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:bt(n,function(r){if(n.options.instantUpload){var o=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:r})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return o(!0);var a=i(Te(r));return null==a?o(!0):"boolean"==typeof a?o(a):void("function"==typeof a.then&&a.then(o))}e("REVERT_ITEM_PROCESSING",{query:r})}),REVERT_ITEM_PROCESSING:bt(n,function(r){r.revert(Tt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(function(){(n.options.instantUpload||function(e){return!ht(e.file)}(r))&&e("REMOVE_ITEM",{query:r.id})}).catch(function(){})}),SET_OPTIONS:function(t){var n=t.options,r=Object.keys(n),o=Mt.filter(function(e){return r.includes(e)});[].concat(ue(o),ue(Object.keys(n).filter(function(e){return!o.includes(e)}))).forEach(function(t){e("SET_"+Z(t,"_").toUpperCase(),{value:n[t]})})}}},Mt=["server"],wt=function(e){return e},Ct=function(e){return document.createElement(e)},Nt=function(e,t){var n=e.childNodes[0];n?t!==n.nodeValue&&(n.nodeValue=t):(n=document.createTextNode(t),e.appendChild(n))},Gt=function(e,t,n,r){var o=(r%360-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}},Ut=function(e,t,n,r,o){var i=1;return o>r&&o-r<=.5&&(i=0),r>o&&r-o>=.5&&(i=0),function(e,t,n,r,o,i){var a=Gt(e,t,n,o),s=Gt(e,t,n,r);return["M",a.x,a.y,"A",n,n,0,i,0,s.x,s.y].join(" ")}(e,t,n,360*Math.min(.9999,r),360*Math.min(.9999,o),i)},Bt=S({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,n=e.props;n.spin=!1,n.progress=0,n.opacity=0;var r=a("svg");t.ref.path=a("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(t.ref.path),t.ref.svg=r,t.appendChild(r)},write:function(e){var t=e.root,n=e.props;if(0!==n.opacity){n.align&&(t.element.dataset.align=n.align);var o=parseInt(r(t.ref.path,"stroke-width"),10),i=.5*t.rect.element.width,a=0,s=0;n.spin?(a=0,s=.5):(a=0,s=n.progress);var u=Ut(i,i,i-o,a,s);r(t.ref.path,"d",u),r(t.ref.path,"stroke-opacity",n.spin||n.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}}}}),Ft=S({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(e){var t=e.root,n=e.props;t.element.innerHTML=(n.icon||"")+""+n.label+"",n.isDisabled=!1},write:function(e){var t=e.root,n=e.props,o=n.isDisabled,i=t.query("GET_DISABLED")||0===n.opacity;i&&!o?(n.isDisabled=!0,r(t.element,"disabled","disabled")):!i&&o&&(n.isDisabled=!1,t.element.removeAttribute("disabled"))}}),qt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.labelBytes,i=void 0===o?"bytes":o,a=r.labelKilobytes,s=void 0===a?"KB":a,u=r.labelMegabytes,l=void 0===u?"MB":u,c=r.labelGigabytes,f=void 0===c?"GB":c,d=n,p=n*n,E=n*n*n;return(e=Math.round(Math.abs(e)))0&&(t.height=t.ref.container.rect.element.height)),o&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),mn=S({create:function(e){var t=e.root,n=e.props;t.ref.handleClick=function(e){return t.dispatch("DID_ACTIVATE_ITEM",{id:n.id})},t.element.id="filepond--item-"+n.id,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(fn,{id:n.id})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"item-panel"})),t.ref.panel.height=null,n.markedForRemoval=!1,t.query("GET_ALLOW_REORDER")&&(t.element.dataset.dragState="idle",t.element.addEventListener("pointerdown",function(e){if(e.isPrimary){var r=!1,o=e.pageX,i=e.pageY;n.dragOrigin={x:t.translateX,y:t.translateY},n.dragCenter={x:e.offsetX,y:e.offsetY};var a,s,u,l=(a=t.query("GET_ACTIVE_ITEMS"),s=a.map(function(e){return e.id}),u=void 0,{setIndex:function(e){u=e},getIndex:function(){return u},getItemIndex:function(e){return s.indexOf(e.id)}});t.dispatch("DID_GRAB_ITEM",{id:n.id,dragState:l});var c=function(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),n.dragOffset={x:e.pageX-o,y:e.pageY-i},n.dragOffset.x*n.dragOffset.x+n.dragOffset.y*n.dragOffset.y>16&&!r&&(r=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:n.id,dragState:l}))};document.addEventListener("pointermove",c),document.addEventListener("pointerup",function e(a){a.isPrimary&&(document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",e),n.dragOffset={x:a.pageX-o,y:a.pageY-i},t.dispatch("DID_DROP_ITEM",{id:n.id,dragState:l}),r&&setTimeout(function(){return t.element.addEventListener("click",t.ref.handleClick)},0))})}}))},write:vn,destroy:function(e){var t=e.root,n=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:n.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:_n,translateY:_n,opacity:{type:"tween",duration:150}}}}),hn=function(e,t){return Math.max(1,Math.floor((e+1)/t))},gn=function(e,t,n){if(n){var r=e.rect.element.width,o=t.length,i=null;if(0===o||n.topv){if(n.left3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=n,Date.now()>e.spawnDate&&(0===e.opacity&&yn(e,t,n,r,o),e.scaleX=1,e.scaleY=1,e.opacity=1))},yn=function(e,t,n,r,o){e.interactionMethod===re?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=n):e.interactionMethod===ee?(e.translateX=null,e.translateX=t-20*r,e.translateY=null,e.translateY=n-10*o,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===te?(e.translateY=null,e.translateY=n-30):e.interactionMethod===J&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},Dn=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},Sn=A({DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=n.id,o=n.index,i=n.interactionMethod;t.ref.addIndex=o;var a=Date.now(),s=a,u=1;if(i!==re){u=0;var l=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;s=cs&&(E=s);var _=Math.floor(s/E+1);Rn.setHeight=d*_,Rn.setWidth=p*E;var T={y:Math.floor(f/d),x:Math.floor(c/p),getGridIndex:function(){return f>Rn.getHeight||f<0||c>Rn.getWidth||c<0?u:this.y*E+this.x},getColIndex:function(){for(var e=t.query("GET_ACTIVE_ITEMS"),n=t.childViews.filter(function(e){return e.rect.element.height}),r=e.map(function(e){return n.find(function(t){return t.id===e.id})}),o=r.findIndex(function(e){return e===a}),i=Dn(a),s=r.length,u=s,l=0,c=0,d=0,p=0;pp){if(f1?T.getGridIndex():T.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:I});var v=o.getIndex();if(void 0===v||v!==I){if(o.setIndex(I),void 0===v)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:u,target:I})}}}}),An=S({create:function(e){var t=e.root;r(t.element,"role","list"),t.ref.lastItemSpanwDate=Date.now()},write:function(e){var t=e.root,n=e.props,r=e.actions,o=e.shouldOptimize;Sn({root:t,props:n,actions:r});var i=n.dragCoordinates,a=t.rect.element.width,s=t.childViews.filter(function(e){return e.rect.element.height}),u=t.query("GET_ACTIVE_ITEMS").map(function(e){return s.find(function(t){return t.id===e.id})}).filter(function(e){return e}),l=i?gn(t,u,i):null,c=t.ref.addIndex||null;t.ref.addIndex=null;var f=0,d=0,p=0;if(0!==u.length){var E=u[0].rect.element,_=E.marginTop+E.marginBottom,T=E.marginLeft+E.marginRight,I=E.width+T,v=hn(a,I);if(1===v){var m=0,h=0;u.forEach(function(e,t){if(l){var n=t-l;h=-2===n?.25*-_:-1===n?.75*-_:0===n?.75*_:1===n?.25*_:0}o&&(e.translateX=null,e.translateY=null),e.markedForRemoval||On(e,0,m+h);var r=(e.rect.element.height+_)*(e.markedForRemoval?e.opacity:1);m+=r})}else{var g=0,R=0,O=0;u.forEach(function(e,t){t===l&&(f=1),t===c&&(p+=1),e.markedForRemoval&&e.opacity<.5&&(d-=1);var n=(t+p+f+d)%v,r=e.rect.element.height+_;r>O&&(O=r);var i=n+1===v||!u[t+1],a=n*I,s=R,E=Math.sign(a-g),T=Math.sign(s-R);g=a,i&&(R+=O,O=0),e.markedForRemoval||(o&&(e.translateX=null,e.translateY=null),On(e,a,s,E,T))})}}},tag:"ul",name:"list",didWriteView:function(e){var t=e.root;t.childViews.filter(function(e){return e.markedForRemoval&&0===e.opacity&&e.resting}).forEach(function(e){e._destroy(),t.removeChildView(e)})},filterFrameActionsForChild:function(e,t){return t.filter(function(t){return!t.data||!t.data.id||e.id===t.data.id})},mixins:{apis:["dragCoordinates"]}}),Ln=A({DID_DRAG:function(e){var t=e.root,n=e.props,r=e.action;t.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(n.dragCoordinates={left:r.position.scopeLeft-t.ref.list.rect.element.left,top:r.position.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},DID_END_DRAG:function(e){e.props.dragCoordinates=null}}),bn=S({create:function(e){var t=e.root,n=e.props;t.ref.list=t.appendChildView(t.createChildView(An)),n.dragCoordinates=null,n.overflowing=!1},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Ln({root:t,props:n,actions:r}),t.ref.list.dragCoordinates=n.dragCoordinates,n.overflowing&&!n.overflow&&(n.overflowing=!1,t.element.dataset.state="",t.height=null),n.overflow){var o=Math.round(n.overflow);o!==t.height&&(n.overflowing=!0,t.element.dataset.state="overflow",t.height=o)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Pn=function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";n?r(e,t,o):e.removeAttribute(t)},Mn=function(e){var t=e.root,n=e.action;t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Pn(t.element,"accept",!!n.value,n.value?n.value.join(","):"")},wn=function(e){var t=e.root,n=e.action;Pn(t.element,"multiple",n.value)},Cn=function(e){var t=e.root,n=e.action;Pn(t.element,"webkitdirectory",n.value)},Nn=function(e){var t=e.root,n=t.query("GET_DISABLED"),r=t.query("GET_ALLOW_BROWSE"),o=n||!r;Pn(t.element,"disabled",o)},Gn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Pn(t.element,"required",!0):Pn(t.element,"required",!1)},Un=function(e){var t=e.root,n=e.action;Pn(t.element,"capture",!!n.value,!0===n.value?"":n.value)},Bn=function(e){var t=e.root,n=t.element;t.query("GET_TOTAL_ITEMS")>0?(Pn(n,"required",!1),Pn(n,"name",!1)):(Pn(n,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&n.setCustomValidity(""),t.query("GET_REQUIRED")&&Pn(n,"required",!0))},Fn=S({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:function(e){var t=e.root,n=e.props;t.element.id="filepond--browser-"+n.id,r(t.element,"name",t.query("GET_NAME")),r(t.element,"aria-controls","filepond--assistant-"+n.id),r(t.element,"aria-labelledby","filepond--drop-label-"+n.id),Mn({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),wn({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),Cn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Nn({root:t}),Gn({root:t,action:{value:t.query("GET_REQUIRED")}}),Un({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var r=Array.from(t.element.files).map(function(e){return e._relativePath=e.webkitRelativePath,e});setTimeout(function(){n.onload(r),function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=Ct("form"),n=e.parentNode,r=e.nextSibling;t.appendChild(e),t.reset(),r?n.insertBefore(e,r):n.appendChild(e)}}}(t.element)},250)}},t.element.addEventListener("change",t.ref.handleChange)},destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:A({DID_LOAD_ITEM:Bn,DID_REMOVE_ITEM:Bn,DID_THROW_ITEM_INVALID:function(e){var t=e.root;t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Nn,DID_SET_ALLOW_BROWSE:Nn,DID_SET_ALLOW_DIRECTORIES_ONLY:Cn,DID_SET_ALLOW_MULTIPLE:wn,DID_SET_ACCEPTED_FILE_TYPES:Mn,DID_SET_CAPTURE_METHOD:Un,DID_SET_REQUIRED:Gn})}),qn=13,Vn=32,xn=function(e,t){e.innerHTML=t;var n=e.querySelector(".filepond--label-action");return n&&r(n,"tabindex","0"),t},Yn=S({name:"drop-label",ignoreRect:!0,create:function(e){var t=e.root,n=e.props,o=Ct("label");r(o,"for","filepond--browser-"+n.id),r(o,"id","filepond--drop-label-"+n.id),r(o,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===qn||e.keyCode===Vn)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===o||o.contains(e.target)||t.ref.label.click()},o.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),xn(o,n.caption),t.appendChild(o),t.ref.label=o},destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:A({DID_SET_LABEL_IDLE:function(e){var t=e.root,n=e.action;xn(t.ref.label,n.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),jn=S({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}}}}),kn=A({DID_DRAG:function(e){var t=e.root,n=e.action;t.ref.blob?(t.ref.blob.translateX=n.position.scopeLeft,t.ref.blob.translateY=n.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):function(e){var t=e.root,n=.5*t.rect.element.width,r=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(jn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:n,translateY:r}))}({root:t})},DID_DROP:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},DID_END_DRAG:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.opacity=0)}}),Hn=S({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:function(e){var t=e.root,n=e.props,r=e.actions;kn({root:t,props:n,actions:r});var o=t.ref.blob;0===r.length&&o&&0===o.opacity&&(t.removeChildView(o),t.ref.blob=null)}}),Xn=function(e,t){try{var n=new DataTransfer;t.forEach(function(e){e instanceof File?n.items.add(e):n.items.add(new File([e],e.name,{type:e.type}))}),e.files=n.files}catch(e){return!1}return!0},Wn=function(e,t){return e.ref.fields[t]},zn=function(e){e.query("GET_ACTIVE_ITEMS").forEach(function(t){e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])})},Qn=function(e){var t=e.root;return zn(t)},Zn=A({DID_SET_DISABLED:function(e){var t=e.root;t.element.disabled=t.query("GET_DISABLED")},DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=!(t.query("GET_ITEM",n.id).origin===ve.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),o=Ct("input");o.type=r?"file":"hidden",o.name=t.query("GET_NAME"),o.disabled=t.query("GET_DISABLED"),t.ref.fields[n.id]=o,zn(t)},DID_LOAD_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);if(r&&(null!==n.serverFileReference&&(r.value=n.serverFileReference),t.query("SHOULD_UPDATE_FILE_INPUT"))){var o=t.query("GET_ITEM",n.id);Xn(r,[o.file])}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(r.parentNode&&r.parentNode.removeChild(r),delete t.ref.fields[n.id])},DID_DEFINE_VALUE:function(e){var t=e.root,n=e.action,r=Wn(t,n.id);r&&(null===n.value?r.removeAttribute("value"):r.value=n.value,zn(t))},DID_PREPARE_OUTPUT:function(e){var t=e.root,n=e.action;t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout(function(){var e=Wn(t,n.id);e&&Xn(e,[n.file])},0)},DID_REORDER_ITEMS:Qn,DID_SORT_ITEMS:Qn}),Kn=S({tag:"fieldset",name:"data",create:function(e){return e.root.ref.fields={}},write:Zn,ignoreRect:!0}),$n=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],Jn=["css","csv","html","txt"],er={zip:"zip|compressed",epub:"application/epub+zip"},tr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),$n.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):Jn.includes(e)?"text/"+e:er[e]||""},nr=function(e){return new Promise(function(t,n){var r=dr(e);if(r.length&&!rr(e))return t(r);or(e).then(t)})},rr=function(e){return!!e.files&&e.files.length>0},or=function(e){return new Promise(function(t,n){var r=(e.items?Array.from(e.items):[]).filter(function(e){return ir(e)}).map(function(e){return ar(e)});r.length?Promise.all(r).then(function(e){var n=[];e.forEach(function(e){n.push.apply(n,e)}),t(n.filter(function(e){return e}).map(function(e){return e._relativePath||(e._relativePath=e.webkitRelativePath),e}))}).catch(console.error):t(e.files?Array.from(e.files):[])})},ir=function(e){if(cr(e)){var t=fr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},ar=function(e){return new Promise(function(t,n){lr(e)?sr(fr(e)).then(t).catch(n):t([e.getAsFile()])})},sr=function(e){return new Promise(function(t,n){var r=[],o=0,i=0,a=function(){0===i&&0===o&&t(r)};!function e(t){o++;var s=t.createReader();!function t(){s.readEntries(function(n){if(0===n.length)return o--,void a();n.forEach(function(t){t.isDirectory?e(t):(i++,t.file(function(e){var n=ur(e);t.fullPath&&(n._relativePath=t.fullPath),r.push(n),i--,a()}))}),t()},n)}()}(e)})},ur=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,n=e.name,r=tr(ke(e.name));return r.length?((e=e.slice(0,e.size,r)).name=n,e.lastModifiedDate=t,e):e},lr=function(e){return cr(e)&&(fr(e)||{}).isDirectory},cr=function(e){return"webkitGetAsEntry"in e},fr=function(e){return e.webkitGetAsEntry()},dr=function(e){var t=[];try{if((t=Er(e)).length)return t;t=pr(e)}catch(e){}return t},pr=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},Er=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var n=t.match(/src\s*=\s*"(.+?)"/);if(n)return[n[1]]}return[]},_r=[],Tr=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},Ir=function(e){var t=_r.find(function(t){return t.element===e});if(t)return t;var n=vr(e);return _r.push(n),n},vr=function(e){var n=[],r={dragenter:Rr,dragover:Or,dragleave:Dr,drop:yr},o={};t(r,function(t,r){o[t]=r(e,n),e.addEventListener(t,o[t],!1)});var i={element:e,addListener:function(a){return n.push(a),function(){n.splice(n.indexOf(a),1),0===n.length&&(_r.splice(_r.indexOf(i),1),t(r,function(t){e.removeEventListener(t,o[t],!1)}))}}};return i},mr=function(e,t){var n,r=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)}("getRootNode"in(n=t)?n.getRootNode():document,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)},hr=null,gr=function(e,t){try{e.dropEffect=t}catch(e){}},Rr=function(e,t){return function(e){e.preventDefault(),hr=e.target,t.forEach(function(t){var n=t.element,r=t.onenter;mr(e,n)&&(t.state="enter",r(Tr(e)))})}},Or=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(r){var o=!1;t.some(function(t){var i=t.filterElement,a=t.element,s=t.onenter,u=t.onexit,l=t.ondrag,c=t.allowdrop;gr(n,"copy");var f=c(r);if(f)if(mr(e,a)){if(o=!0,null===t.state)return t.state="enter",void s(Tr(e));if(t.state="over",i&&!f)return void gr(n,"none");l(Tr(e))}else i&&!o&&gr(n,"none"),t.state&&(t.state=null,u(Tr(e)));else gr(n,"none")})})}},yr=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;nr(n).then(function(n){t.forEach(function(t){var r=t.filterElement,o=t.element,i=t.ondrop,a=t.onexit,s=t.allowdrop;if(t.state=null,!r||mr(e,o))return s(n)?void i(Tr(e),n):a(Tr(e))})})}},Dr=function(e,t){return function(e){hr===e.target&&t.forEach(function(t){var n=t.onexit;t.state=null,n(Tr(e))})}},Sr=function(e,t,n){e.classList.add("filepond--hopper");var r=n.catchesDropsOnPage,o=n.requiresDropOnElement,i=n.filterItems,a=void 0===i?function(e){return e}:i,s=function(e,t,n){var r=Ir(t),o={element:e,filterElement:n,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return o.destroy=r.addListener(o),o}(e,r?document.documentElement:e,o),u="",l="";s.allowdrop=function(e){return t(a(e))},s.ondrop=function(e,n){var r=a(n);t(r)?(l="drag-drop",c.onload(r,e)):c.ondragend(e)},s.ondrag=function(e){c.ondrag(e)},s.onenter=function(e){l="drag-over",c.ondragstart(e)},s.onexit=function(e){l="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){u!==l&&(e.dataset.hopperState=l,u=l)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){s.destroy()}};return c},Ar=!1,Lr=[],br=function(e){var t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){for(var n=!1,r=t;r!==document.body;){if(r.classList.contains("filepond--root")){n=!0;break}r=r.parentNode}if(!n)return}nr(e.clipboardData).then(function(e){e.length&&Lr.forEach(function(t){return t(e)})})},Pr=function(){var e=function(e){t.onload(e)},t={destroy:function(){var t;t=e,de(Lr,Lr.indexOf(t)),0===Lr.length&&(document.removeEventListener("paste",br),Ar=!1)},onload:function(){}};return function(e){Lr.includes(e)||(Lr.push(e),Ar||(Ar=!0,document.addEventListener("paste",br)))}(e),t},Mr=null,wr=null,Cr=[],Nr=function(e,t){e.element.textContent=t},Gr=function(e,t,n){var r=e.query("GET_TOTAL_ITEMS");Nr(e,n+" "+t+", "+r+" "+(1===r?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(wr),wr=setTimeout(function(){!function(e){e.element.textContent=""}(e)},1500)},Ur=function(e){return e.element.parentNode.contains(document.activeElement)},Br=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Nr(t,r+" "+o)},Fr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename;Nr(t,n.status.main+" "+r+" "+n.status.sub)},qr=S({create:function(e){var t=e.root,n=e.props;t.element.id="filepond--assistant-"+n.id,r(t.element,"role","status"),r(t.element,"aria-live","polite"),r(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:A({DID_LOAD_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){t.element.textContent="";var r=t.query("GET_ITEM",n.id);Cr.push(r.filename),clearTimeout(Mr),Mr=setTimeout(function(){Gr(t,Cr.join(", "),t.query("GET_LABEL_FILE_ADDED")),Cr.length=0},750)}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action;if(Ur(t)){var r=n.item;Gr(t,r.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Nr(t,r+" "+o)},DID_ABORT_ITEM_PROCESSING:Br,DID_REVERT_ITEM_PROCESSING:Br,DID_THROW_ITEM_REMOVE_ERROR:Fr,DID_THROW_ITEM_LOAD_ERROR:Fr,DID_THROW_ITEM_INVALID:Fr,DID_THROW_ITEM_PROCESSING_ERROR:Fr}),tag:"span",name:"assistant"}),Vr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.replace(new RegExp(t+".","g"),function(e){return e.charAt(1).toUpperCase()})},xr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Date.now(),o=null;return function(){for(var i=arguments.length,a=new Array(i),s=0;sd&&(d=n),o&&(p+=d,d=0)}),t=n=p}return{visual:t,bounds:n}},Hr=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Xr=function(e,t){var n=e.query("GET_ALLOW_REPLACE"),r=e.query("GET_ALLOW_MULTIPLE"),o=e.query("GET_TOTAL_ITEMS"),i=e.query("GET_MAX_FILES"),a=t.length;return!r&&a>1?(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:ot("warning",0,"Max files")}),!0):!(!r&&n)&&(!!(V(i=r?i:1)&&o+a>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:ot("warning",0,"Max files")}),!0))},Wr=function(e,t,n){var r=e.childViews[0];return gn(r,t,{left:n.scopeLeft-r.rect.element.left,top:n.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},zr=function(e){var t=e.query("GET_ALLOW_DROP"),n=e.query("GET_DISABLED"),r=t&&!n;if(r&&!e.ref.hopper){var o=Sr(e.element,function(t){var n=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every(function(t){return ye("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(function(e){return!0===e})&&n(t)})},{filterItems:function(t){var n=e.query("GET_IGNORED_FILES");return t.filter(function(e){return!ht(e)||!n.includes(e.name.toLowerCase())})},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});o.onload=function(t,n){var r=e.ref.list.childViews[0].childViews.filter(function(e){return e.rect.element.height}),o=e.query("GET_ACTIVE_ITEMS").map(function(e){return r.find(function(t){return t.id===e.id})}).filter(function(e){return e});Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:Wr(e.ref.list,o,n),interactionMethod:ee})}),e.dispatch("DID_DROP",{position:n}),e.dispatch("DID_END_DRAG",{position:n})},o.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},o.ondrag=xr(function(t){e.dispatch("DID_DRAG",{position:t})}),o.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=o,e.ref.drip=e.appendChildView(e.createChildView(Hn))}else!r&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},Qr=function(e,t){var n=e.query("GET_ALLOW_BROWSE"),r=e.query("GET_DISABLED"),o=n&&!r;o&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Fn,Object.assign({},t,{onload:function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:te})})}})),0):!o&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},Zr=function(e){var t=e.query("GET_ALLOW_PASTE"),n=e.query("GET_DISABLED"),r=t&&!n;r&&!e.ref.paster?(e.ref.paster=Pr(),e.ref.paster.onload=function(t){Oe("ADD_ITEMS",t,{dispatch:e.dispatch}).then(function(t){if(Xr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:ne})})}):!r&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Kr=A({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,n=e.props;Qr(t,n)},DID_SET_ALLOW_DROP:function(e){var t=e.root;zr(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;Zr(t)},DID_SET_DISABLED:function(e){var t=e.root,n=e.props;zr(t),Zr(t),Qr(t,n),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),$r=S({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:function(e){var t=e.root,n=e.props,r=t.query("GET_ID");r&&(t.element.id=r);var o=t.query("GET_CLASS_NAME");o&&o.split(" ").filter(function(e){return e.length}).forEach(function(e){t.element.classList.add(e)}),t.ref.label=t.appendChildView(t.createChildView(Yn,Object.assign({},n,{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(bn,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(En,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(qr,Object.assign({},n))),t.ref.data=t.appendChildView(t.createChildView(Kn,Object.assign({},n))),t.ref.measure=Ct("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(function(e){return!M(e.value)}).map(function(e){var n=e.name,r=e.value;t.element.dataset[n]=r}),t.ref.widthPrevious=null,t.ref.widthUpdated=xr(function(){t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];var i=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!i&&(t.element.addEventListener("touchmove",Yr,{passive:!1}),t.element.addEventListener("gesturestart",Yr));var s=t.query("GET_CREDITS");if(2===s.length){var u=document.createElement("a");u.className="filepond--credits",u.setAttribute("aria-hidden","true"),u.href=s[0],u.tabindex=-1,u.target="_blank",u.rel="noopener noreferrer",u.textContent=s[1],t.element.appendChild(u),t.ref.credits=u}},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Kr({root:t,props:n,actions:r}),r.filter(function(e){return/^DID_SET_STYLE_/.test(e.type)}).filter(function(e){return!M(e.data.value)}).map(function(e){var n=e.type,r=e.data,o=Vr(n.substring(8).toLowerCase(),"_");t.element.dataset[o]=r.value,t.invalidateLayout()}),!t.rect.element.hidden){t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());var o=t.ref.bounds;o||(o=t.ref.bounds=Hr(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);var i=t.ref,a=i.hopper,s=i.label,u=i.list,l=i.panel;a&&a.updateHopperState();var c=t.query("GET_PANEL_ASPECT_RATIO"),f=t.query("GET_ALLOW_MULTIPLE"),d=t.query("GET_TOTAL_ITEMS"),p=d===(f?t.query("GET_MAX_FILES")||1e6:1),E=r.find(function(e){return"DID_ADD_ITEM"===e.type});if(p&&E){var _=E.data.interactionMethod;s.opacity=0,f?s.translateY=-40:_===J?s.translateX=40:s.translateY=_===te?40:30}else p||(s.opacity=1,s.translateX=0,s.translateY=0);var T=jr(t),I=kr(t),v=s.rect.element.height,m=!f||p?0:v,h=p?u.rect.element.marginTop:0,g=0===d?0:u.rect.element.marginBottom,R=m+h+I.visual+g,O=m+h+I.bounds+g;if(u.translateY=Math.max(0,m-u.rect.element.marginTop)-T.top,c){var y=t.rect.element.width,D=y*c;c!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=c,t.ref.updateHistory=[]);var S=t.ref.updateHistory;if(S.push(y),S.length>4)for(var A=S.length,L=A-10,b=0,P=A;P>=L;P--)if(S[P]===S[P-2]&&b++,b>=2)return;l.scalable=!1,l.height=D;var w=D-m-(g-T.bottom)-(p?h:0);I.visual>w?u.overflow=w:u.overflow=null,t.height=D}else if(o.fixedHeight){l.scalable=!1;var C=o.fixedHeight-m-(g-T.bottom)-(p?h:0);I.visual>C?u.overflow=C:u.overflow=null}else if(o.cappedHeight){var N=R>=o.cappedHeight,G=Math.min(o.cappedHeight,R);l.scalable=!0,l.height=N?G:G-T.top-T.bottom;var U=G-m-(g-T.bottom)-(p?h:0);R>o.cappedHeight&&I.visual>U?u.overflow=U:u.overflow=null,t.height=Math.min(o.cappedHeight,O-T.top-T.bottom)}else{var B=d>0?T.top+T.bottom:0;l.scalable=!0,l.height=Math.max(v,R-B),t.height=Math.max(v,O-B)}t.ref.credits&&l.heightCurrent&&(t.ref.credits.style.transform="translateY("+l.heightCurrent+"px)")}},destroy:function(e){var t=e.root;t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",Yr),t.element.removeEventListener("gesturestart",Yr)},mixins:{styles:["height"]}}),Jr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null,o=Se(),i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object.assign({},e),o=[],i=[],a=function(e,t,n){!n||document.hidden?(c[e]&&c[e](t),o.push({type:e,data:t})):i.push({type:e,data:t})},s=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){y([{source:e,options:t}],{index:t.index}).then(function(e){return n(e&&e[0])}).catch(r)})},addFiles:y,getFile:function(e){return i.query("GET_ACTIVE_ITEM",e)},processFile:S,prepareFile:R,removeFile:O,moveFile:function(e,t){return i.dispatch("MOVE_ITEM",{query:e,index:t})},getFiles:D,processFiles:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n={};return t(Se(),function(e,t){n[e]=t[0]}),Jr(Object.assign({},n,{},e))},to=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=[];t(e.attributes,function(t){o.push(e.attributes[t])});var i=o.filter(function(e){return e.name}).reduce(function(t,n){var o,i=r(e,n.name);return t[(o=n.name,Vr(o.replace(/^data-/,"")))]=i===n.name||i,t},{});return function e(n,r){t(r,function(r,o){t(n,function(e,t){var i=new RegExp(r);if(i.test(e)&&(delete n[e],!1!==o))if(U(o))n[o]=t;else{var a,s=o.group;H(o)&&!n[s]&&(n[s]={}),n[s][(a=e.replace(i,""),a.charAt(0).toLowerCase()+a.slice(1))]=t}}),o.mapping&&e(n[o.group],o.mapping)})}(i,n),i},no=function(){return(arguments.length<=0?void 0:arguments[0])instanceof HTMLElement?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={"^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};ye("SET_ATTRIBUTE_TO_OPTION_MAP",n);var r=Object.assign({},t),o=to("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,n);Object.keys(o).forEach(function(e){H(o[e])?(H(r[e])||(r[e]={}),Object.assign(r[e],o[e])):r[e]=o[e]}),r.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(function(e){return{source:e.value,options:{type:e.dataset.type}}}));var i=eo(r);return e.files&&Array.from(e.files).forEach(function(e){i.addFile(e)}),i.replaceElement(e),i}.apply(void 0,arguments):eo.apply(void 0,arguments)},ro=["fire","_read","_write"],oo=function(e){var t={};return Ee(e,t,ro),t},io=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,function(e,n){return t[n]})},ao=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{transfer:function(e,t){},post:function(e,t,n){var o=oe();r.onmessage=function(e){e.data.id===o&&t(e.data.message)},r.postMessage({id:o,message:e},n)},terminate:function(){r.terminate(),URL.revokeObjectURL(n)}}},so=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e})},uo=function(e,t){var n=e.slice(0,e.size,e.type);return n.lastModifiedDate=e.lastModifiedDate,n.name=t,n},lo=function(e){return uo(e,e.name)},co=[],fo=function(e){if(!co.includes(e)){co.push(e);var n,r=e({addFilter:De,utils:{Type:ge,forin:t,isString:U,isFile:ht,toNaturalFileSize:qt,replaceInString:io,getExtensionFromFilename:ke,getFilenameWithoutExtension:mt,guesstimateMimeType:tr,getFileFromBlob:We,getFilenameFromURL:je,createRoute:A,createWorker:ao,createView:S,createItemAPI:Te,loadImage:so,copyFile:lo,renameFile:uo,createBlob:ze,applyFilterChain:Oe,text:Nt,getNumericAspectRatioFromString:be},views:{fileActionButton:Ft}});n=r.options,Object.assign(Ae,n)}},po=(Kt=c()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"slice"in Blob.prototype&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window&&("supports"in(window.CSS||{})||/MSIE|Trident/.test(window.navigator.userAgent)),function(){return Kt}),Eo={apps:[]},_o=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=_o,e.destroy=_o,e.parse=_o,e.find=_o,e.registerPlugin=_o,e.getOptions=_o,e.setOptions=_o,po()){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,r="__framePainter";if(window[r])return window[r].readers.push(e),void window[r].writers.push(t);window[r]={readers:[e],writers:[t]};var o=window[r],i=1e3/n,a=null,s=null,u=null,l=null,c=function(){document.hidden?(u=function(){return window.setTimeout(function(){return f(performance.now())},i)},l=function(){return window.clearTimeout(s)}):(u=function(){return window.requestAnimationFrame(f)},l=function(){return window.cancelAnimationFrame(s)})};document.addEventListener("visibilitychange",function(){l&&l(),c(),f(performance.now())});var f=function e(t){s=u(e),a||(a=t);var n=t-a;n<=i||(a=t-n%i,o.readers.forEach(function(e){return e()}),o.writers.forEach(function(e){return e(t)}))};c(),f(performance.now())}(function(){Eo.apps.forEach(function(e){return e._read()})},function(e){Eo.apps.forEach(function(t){return t._write(e)})});var To=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:po,create:e.create,destroy:e.destroy,parse:e.parse,find:e.find,registerPlugin:e.registerPlugin,setOptions:e.setOptions}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(function(){return To()},0):document.addEventListener("DOMContentLoaded",To);var Io=function(){return t(Se(),function(t,n){e.OptionTypes[t]=n[1]})};e.Status=Object.assign({},Me),e.FileOrigin=Object.assign({},ve),e.FileStatus=Object.assign({},Ie),e.OptionTypes={},Io(),e.create=function(){var t=no.apply(void 0,arguments);return t.on("destroy",e.destroy),Eo.apps.push(t),oo(t)},e.destroy=function(e){var t=Eo.apps.findIndex(function(t){return t.isAttachedTo(e)});return t>=0&&(Eo.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll(".filepond")).filter(function(e){return!Eo.apps.find(function(t){return t.isAttachedTo(e)})}).map(function(t){return e.create(t)})},e.find=function(e){var t=Eo.apps.find(function(t){return t.isAttachedTo(e)});return t?oo(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),n=0;n Date: Thu, 16 Jun 2022 18:29:48 +0800 Subject: [PATCH 4/5] remove redundant indents --- src/js/app/view/list.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/app/view/list.js b/src/js/app/view/list.js index 7ad8d76c..15ec8f8c 100644 --- a/src/js/app/view/list.js +++ b/src/js/app/view/list.js @@ -362,10 +362,10 @@ const write = ({ root, props, actions, shouldOptimize }) => { } const isLastItemInRow = indexX + 1 === itemsPerRow || !(children[index + 1]); - + const offsetX = indexX * itemWidth; const offsetY = prevY; - + const vectorX = Math.sign(offsetX - prevX); const vectorY = Math.sign(offsetY - prevY); From 4aa1f2526fca7a4b676533780289a2c4b0add185 Mon Sep 17 00:00:00 2001 From: Anton Sylka Date: Thu, 16 Jun 2022 18:30:13 +0800 Subject: [PATCH 5/5] remove redundant indents --- src/js/app/view/list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/app/view/list.js b/src/js/app/view/list.js index 15ec8f8c..732d3353 100644 --- a/src/js/app/view/list.js +++ b/src/js/app/view/list.js @@ -368,7 +368,7 @@ const write = ({ root, props, actions, shouldOptimize }) => { const vectorX = Math.sign(offsetX - prevX); const vectorY = Math.sign(offsetY - prevY); - + prevX = offsetX; if (isLastItemInRow) {