UNPKG

@sassoftware/va-report-components

Version:

The SAS Visual Analytics SDK is a set of JavaScript APIs and web components that enable SAS Visual Analytics report content to be easily embedded in a third-party application or web page.

1 lines 103 kB
/*! License information is available at ../../LICENSE.txt and ../../LICENSE-3RD-PARTY.txt */"use strict";(globalThis["va-report-componentsJsonp"]=globalThis["va-report-componentsJsonp"]||[]).push([[38],{762:(e,t,n)=>{n.r(t),n.d(t,{DragDropContext:()=>Go,Draggable:()=>ti,Droppable:()=>Ai,resetServerContext:()=>Mo,useKeyboardSensor:()=>Ri,useMouseSensor:()=>ao,useTouchSensor:()=>po});var r=n(2),o=n(16);const i=e=>e+1,a=(e,t)=>{const n=e.droppableId===t.droppableId,r=i(e.index),o=i(t.index);return n?`\n You have moved the item from position ${r}\n to position ${o}\n `:`\n You have moved the item from position ${r}\n in list ${e.droppableId}\n to list ${t.droppableId}\n in position ${o}\n `},s=(e,t,n)=>t.droppableId===n.droppableId?`\n The item ${e}\n has been combined with ${n.draggableId}`:`\n The item ${e}\n in list ${t.droppableId}\n has been combined with ${n.draggableId}\n in list ${n.droppableId}\n `,l=e=>`\n The item has returned to its starting position\n of ${i(e.index)}\n`,c={dragHandleUsageInstructions:"\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n",onDragStart:e=>`\n You have lifted an item in position ${i(e.source.index)}\n`,onDragUpdate:e=>{const t=e.destination;if(t)return a(e.source,t);const n=e.combine;return n?s(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},onDragEnd:e=>{if("CANCEL"===e.reason)return`\n Movement cancelled.\n ${l(e.source)}\n `;const t=e.destination,n=e.combine;return t?`\n You have dropped the item.\n ${a(e.source,t)}\n `:n?`\n You have dropped the item.\n ${s(e.draggableId,e.source,n)}\n `:`\n The item has been dropped while not over a drop area.\n ${l(e.source)}\n `}},d=c;var p=n(554);let u=0;const g={separator:"::"};function f(e,t=g){return(0,p.Ye)((()=>`${e}${t.separator}${u++}`),[t.separator,e])}var m=n(557),b=n(686),h=n(5);let y=function(e){e()};const v=()=>y,I=r.createContext(null);let D=null;var x=n(146),w=n(454),C=n(688),E=n.n(C),S=n(763);const A=["initMapStateToProps","initMapDispatchToProps","initMergeProps"];function P(e,t,n,r,{areStatesEqual:o,areOwnPropsEqual:i,areStatePropsEqual:a}){let s,l,c,d,p,u=!1;function g(u,g){const f=!i(g,l),m=!o(u,s);return s=u,l=g,f&&m?(c=e(s,l),t.dependsOnOwnProps&&(d=t(r,l)),p=n(c,d,l),p):f?(e.dependsOnOwnProps&&(c=e(s,l)),t.dependsOnOwnProps&&(d=t(r,l)),p=n(c,d,l),p):m?function(){const t=e(s,l),r=!a(t,c);return c=t,r&&(p=n(c,d,l)),p}():p}return function(o,i){return u?g(o,i):(s=o,l=i,c=e(s,l),d=t(r,l),p=n(c,d,l),u=!0,p)}}function B(e){return function(t){const n=e(t);function r(){return n}return r.dependsOnOwnProps=!1,r}}function N(e){return e.dependsOnOwnProps?Boolean(e.dependsOnOwnProps):1!==e.length}function R(e,t){return function(t,{displayName:n}){const r=function(e,t){return r.dependsOnOwnProps?r.mapToProps(e,t):r.mapToProps(e,void 0)};return r.dependsOnOwnProps=!0,r.mapToProps=function(t,n){r.mapToProps=e,r.dependsOnOwnProps=N(e);let o=r(t,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=N(o),o=r(t,n)),o},r}}function O(e,t){return(n,r)=>{throw new Error(`Invalid value of type ${typeof e} for ${t} argument when connecting component ${r.wrappedComponentName}.`)}}function T(e,t,n){return(0,x.Z)({},n,e,t)}const L={notify(){},get:()=>[]};function M(e,t){let n,r=L;function o(){a.onStateChange&&a.onStateChange()}function i(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){const e=v();let t=null,n=null;return{clear(){t=null,n=null},notify(){e((()=>{let e=t;for(;e;)e.callback(),e=e.next}))},get(){let e=[],n=t;for(;n;)e.push(n),n=n.next;return e},subscribe(e){let r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}const a={addNestedSub:function(e){return i(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:i,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=L)},getListeners:()=>r};return a}const G=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement)?r.useLayoutEffect:r.useEffect;function _(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function $(e,t){if(_(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!_(e[n[r]],t[n[r]]))return!1;return!0}const F=["reactReduxForwardedRef"];let U=()=>{throw new Error("uSES not initialized!")};const k=[null,null];function W(e,t,n,r,o,i){e.current=r,n.current=!1,o.current&&(o.current=null,i())}function j(e,t){return e===t}const H=function(e,t,n,{pure:o,areStatesEqual:i=j,areOwnPropsEqual:a=$,areStatePropsEqual:s=$,areMergedPropsEqual:l=$,forwardRef:c=!1,context:d=I}={}){const p=d,u=function(e){return e?"function"==typeof e?R(e):O(e,"mapStateToProps"):B((()=>({})))}(e),g=function(e){return e&&"object"==typeof e?B((t=>function(e,t){const n={};for(const r in e){const o=e[r];"function"==typeof o&&(n[r]=(...e)=>t(o(...e)))}return n}(e,t))):e?"function"==typeof e?R(e):O(e,"mapDispatchToProps"):B((e=>({dispatch:e})))}(t),f=function(e){return e?"function"==typeof e?function(e){return function(t,{displayName:n,areMergedPropsEqual:r}){let o,i=!1;return function(t,n,a){const s=e(t,n,a);return i?r(s,o)||(o=s):(i=!0,o=s),o}}}(e):O(e,"mergeProps"):()=>T}(n),m=Boolean(e);return e=>{const t=e.displayName||e.name||"Component",n=`Connect(${t})`,o={shouldHandleStateChanges:m,displayName:n,wrappedComponentName:t,WrappedComponent:e,initMapStateToProps:u,initMapDispatchToProps:g,initMergeProps:f,areStatesEqual:i,areStatePropsEqual:s,areOwnPropsEqual:a,areMergedPropsEqual:l};function d(t){const[n,i,a]=(0,r.useMemo)((()=>{const{reactReduxForwardedRef:e}=t,n=(0,w.Z)(t,F);return[t.context,e,n]}),[t]),s=(0,r.useMemo)((()=>n&&n.Consumer&&(0,S.isContextConsumer)(r.createElement(n.Consumer,null))?n:p),[n,p]),l=(0,r.useContext)(s),c=Boolean(t.store)&&Boolean(t.store.getState)&&Boolean(t.store.dispatch),d=Boolean(l)&&Boolean(l.store);const u=c?t.store:l.store,g=d?l.getServerState:u.getState,f=(0,r.useMemo)((()=>function(e,t){let{initMapStateToProps:n,initMapDispatchToProps:r,initMergeProps:o}=t,i=(0,w.Z)(t,A);return P(n(e,i),r(e,i),o(e,i),e,i)}(u.dispatch,o)),[u]),[b,h]=(0,r.useMemo)((()=>{if(!m)return k;const e=M(u,c?void 0:l.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[u,c,l]),y=(0,r.useMemo)((()=>c?l:(0,x.Z)({},l,{subscription:b})),[c,l,b]),v=(0,r.useRef)(),I=(0,r.useRef)(a),D=(0,r.useRef)(),C=(0,r.useRef)(!1),E=((0,r.useRef)(!1),(0,r.useRef)(!1)),B=(0,r.useRef)();G((()=>(E.current=!0,()=>{E.current=!1})),[]);const N=(0,r.useMemo)((()=>()=>D.current&&a===I.current?D.current:f(u.getState(),a)),[u,a]),R=(0,r.useMemo)((()=>e=>b?function(e,t,n,r,o,i,a,s,l,c,d){if(!e)return()=>{};let p=!1,u=null;const g=()=>{if(p||!s.current)return;const e=t.getState();let n,g;try{n=r(e,o.current)}catch(e){g=e,u=e}g||(u=null),n===i.current?a.current||c():(i.current=n,l.current=n,a.current=!0,d())};return n.onStateChange=g,n.trySubscribe(),g(),()=>{if(p=!0,n.tryUnsubscribe(),n.onStateChange=null,u)throw u}}(m,u,b,f,I,v,C,E,D,h,e):()=>{}),[b]);var O,T,L;let _;O=W,T=[I,v,C,a,D,h],G((()=>O(...T)),L);try{_=U(R,N,g?()=>f(g(),a):N)}catch(e){throw B.current&&(e.message+=`\nThe error may be correlated with this previous error:\n${B.current.stack}\n\n`),e}G((()=>{B.current=void 0,D.current=void 0,v.current=_}));const $=(0,r.useMemo)((()=>r.createElement(e,(0,x.Z)({},_,{ref:i}))),[i,e,_]);return(0,r.useMemo)((()=>m?r.createElement(s.Provider,{value:y},$):$),[s,$,y])}const b=r.memo(d);if(b.WrappedComponent=e,b.displayName=d.displayName=n,c){const t=r.forwardRef((function(e,t){return r.createElement(b,(0,x.Z)({},e,{reactReduxForwardedRef:t}))}));return t.displayName=n,t.WrappedComponent=e,E()(t,e)}return E()(b,e)}};const Y=function({store:e,context:t,children:n,serverState:o}){const i=(0,r.useMemo)((()=>{const t=M(e);return{store:e,subscription:t,getServerState:o?()=>o:void 0}}),[e,o]),a=(0,r.useMemo)((()=>e.getState()),[e]);G((()=>{const{subscription:t}=i;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),a!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[i,a]);const s=t||I;return r.createElement(s.Provider,{value:i},n)};var q,V;q=b.useSyncExternalStoreWithSelector,D=q,(e=>{U=e})(m.useSyncExternalStore),V=h.unstable_batchedUpdates,y=V;var z=n(697);function Z(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var J="function"==typeof Symbol&&Symbol.observable||"@@observable",X=function(){return Math.random().toString(36).substring(7).split("").join(".")},K={INIT:"@@redux/INIT"+X(),REPLACE:"@@redux/REPLACE"+X(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+X()}};function Q(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function ee(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Z(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Z(1));return n(ee)(e,t)}if("function"!=typeof e)throw new Error(Z(2));var o=e,i=t,a=[],s=a,l=!1;function c(){s===a&&(s=a.slice())}function d(){if(l)throw new Error(Z(3));return i}function p(e){if("function"!=typeof e)throw new Error(Z(4));if(l)throw new Error(Z(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Z(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),a=null}}}function u(e){if(!Q(e))throw new Error(Z(7));if(void 0===e.type)throw new Error(Z(8));if(l)throw new Error(Z(9));try{l=!0,i=o(i,e)}finally{l=!1}for(var t=a=s,n=0;n<t.length;n++){(0,t[n])()}return e}return u({type:K.INIT}),(r={dispatch:u,subscribe:p,getState:d,replaceReducer:function(e){if("function"!=typeof e)throw new Error(Z(10));o=e,u({type:K.REPLACE})}})[J]=function(){var e,t=p;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Z(11));function n(){e.next&&e.next(d())}return n(),{unsubscribe:t(n)}}})[J]=function(){return this},e},r}function te(e,t){return function(){return t(e.apply(this,arguments))}}function ne(e,t){if("function"==typeof e)return te(e,t);if("object"!=typeof e||null===e)throw new Error(Z(16));var n={};for(var r in e){var o=e[r];"function"==typeof o&&(n[r]=te(o,t))}return n}function re(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function oe(e,t){}const ie=oe.bind(null,"warn"),ae=(oe.bind(null,"error"),!0),se="Invariant failed";class le{constructor(e){this.message=e}}function ce(e,t){if(!e)throw new le(ae?se:`${se}: ${t||""}`)}le.prototype.toString=function(){return this.message};const de=e=>({type:"LIFT",payload:e}),pe=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),ue=()=>({type:"COLLECTION_STARTING",payload:null}),ge=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),fe=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),me=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),be=e=>({type:"MOVE",payload:e}),he=()=>({type:"MOVE_UP",payload:null}),ye=()=>({type:"MOVE_DOWN",payload:null}),ve=()=>({type:"MOVE_RIGHT",payload:null}),Ie=()=>({type:"MOVE_LEFT",payload:null}),De=()=>({type:"FLUSH",payload:null}),xe=e=>({type:"DROP_COMPLETE",payload:e}),we=e=>({type:"DROP",payload:e}),Ce=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});const Ee=function(e){var t=[],n=null,r=function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];t=o,n||(n=requestAnimationFrame((function(){n=null,e.apply(void 0,t)})))};return r.cancel=function(){n&&(cancelAnimationFrame(n),n=null)},r};const Se=e=>{0},Ae=e=>{0},Pe=e=>{const t=e.at;return t?"REORDER"===t.type?t.destination.droppableId:t.combine.droppableId:null};var Be=n(638);function Ne(e){return Object.values?Object.values(e):Object.keys(e).map((t=>e[t]))}function Re(e,t){if(e.findIndex)return e.findIndex(t);for(let n=0;n<e.length;n++)if(t(e[n]))return n;return-1}function Oe(e,t){if(e.find)return e.find(t);const n=Re(e,t);return-1!==n?e[n]:void 0}function Te(e){return Array.prototype.slice.call(e)}const Le=(0,Be.Z)((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),Me=(0,Be.Z)((e=>e.reduce(((e,t)=>(e[t.descriptor.id]=t,e)),{}))),Ge=(0,Be.Z)((e=>Ne(e))),_e=(0,Be.Z)((e=>Ne(e))),$e=(e,t)=>n=>e<=n&&n<=t;function Fe(e){const t=$e(e.top,e.bottom),n=$e(e.left,e.right);return function(e){return t(e.y)&&n(e.x)}}const Ue=(0,Be.Z)((e=>Ge(e).filter((e=>!!e.isEnabled&&!!e.frame)))),ke=({center:e,destination:t,droppables:n})=>{if(t){const e=n[t];return e.frame?e:null}const r=((e,t)=>Oe(Ue(t),(t=>(ce(t.frame,"Invalid result"),Fe(t.frame.pageMarginBox)(e)))))(e,n);return r},We={x:0,y:0},je=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),He=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),Ye=(e,t)=>e.x===t.x&&e.y===t.y,qe=e=>({x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}),Ve=(e,t,n=0)=>"x"===e?{x:t,y:n}:{x:n,y:t},ze=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),Ze=(e,t)=>Math.min(...t.map((t=>ze(e,t)))),Je=e=>t=>({x:e(t.x),y:e(t.y)}),Xe=Je((e=>0===e?0:e>0?1:-1)),Ke=(()=>{const e=(e,t)=>e<0?e:e>t?e-t:0;return({current:t,max:n,change:r})=>{const o=je(t,r),i={x:e(o.x,n.x),y:e(o.y,n.y)};return Ye(i,We)?null:i}})(),Qe=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},o=Xe(n),i=Ke({max:r,current:t,change:o});return!i||(0!==o.x&&0===i.x||0!==o.y&&0===i.y)},et=(e,t)=>Qe({current:e.scroll.current,max:e.scroll.max,change:t}),tt=(e,t)=>{const n=e.frame;return!!n&&Qe({current:n.scroll.current,max:n.scroll.max,change:t})},nt={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},rt={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},ot={startFromPercentage:.25,maxScrollAtPercentage:.05,maxPixelScroll:28,ease:e=>Math.pow(e,2),durationDampening:{stopDampeningAt:1200,accelerateAt:360}},it=({startOfRange:e,endOfRange:t,current:n})=>{const r=t-e;if(0===r)return ie("\n Detected distance range of 0 in the fluid auto scroller\n This is unexpected and would cause a divide by 0 issue.\n Not allowing an auto scroll\n "),0;return(n-e)/r},at=ot.durationDampening.accelerateAt,st=ot.durationDampening.stopDampeningAt,lt=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r})=>{const o=((e,t)=>{if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return ot.maxPixelScroll;if(e===t.startScrollingFrom)return 1;const n=1-it({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),r=ot.maxPixelScroll*ot.ease(n);return Math.ceil(r)})(e,t);return 0===o?0:r?Math.max(((e,t)=>{const n=t,r=st,o=Date.now()-n;if(o>=st)return e;if(o<at)return 1;const i=it({startOfRange:at,endOfRange:r,current:o}),a=e*ot.ease(i);return Math.ceil(a)})(o,n),1):o},ct=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:o})=>{const i=((e,t)=>({startScrollingFrom:e[t.size]*ot.startFromPercentage,maxScrollValueAt:e[t.size]*ot.maxScrollAtPercentage}))(e,r);return t[r.end]<t[r.start]?lt({distanceToEdge:t[r.end],thresholds:i,dragStartTime:n,shouldUseTimeDampening:o}):-1*lt({distanceToEdge:t[r.start],thresholds:i,dragStartTime:n,shouldUseTimeDampening:o})},dt=Je((e=>0===e?0:e)),pt=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:o})=>{const i={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},a=ct({container:t,distanceToEdges:i,dragStartTime:e,axis:nt,shouldUseTimeDampening:o}),s=ct({container:t,distanceToEdges:i,dragStartTime:e,axis:rt,shouldUseTimeDampening:o}),l=dt({x:s,y:a});if(Ye(l,We))return null;const c=(({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,o=t.width>e.width;return o||r?o&&r?null:{x:o?0:n.x,y:r?0:n.y}:n})({container:t,subject:n,proposedScroll:l});return c?Ye(c,We)?null:c:null},ut=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:o})=>{const i=e.current.page.borderBoxCenter,a=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const o=(({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o})=>{const i=pt({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:o});return i&&et(e,i)?i:null})({dragStartTime:t,viewport:e.viewport,subject:a,center:i,shouldUseTimeDampening:n});if(o)return void r(o)}const s=ke({center:i,destination:Pe(e.impact),droppables:e.dimensions.droppables});if(!s)return;const l=(({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o})=>{const i=e.frame;if(!i)return null;const a=pt({dragStartTime:r,container:i.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:o});return a&&tt(e,a)?a:null})({dragStartTime:t,droppable:s,subject:a,center:i,shouldUseTimeDampening:n});l&&o(s.descriptor.id,l)},gt=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(e,n)=>{if(!tt(e,n))return n;const r=((e,t)=>{const n=e.frame;return n&&tt(e,t)?Ke({current:n.scroll.current,max:n.scroll.max,change:t}):null})(e,n);if(!r)return t(e.descriptor.id,n),null;const o=He(n,r);t(e.descriptor.id,o);return He(n,o)},o=(e,t,r)=>{if(!e)return r;if(!et(t,r))return r;const o=((e,t)=>{if(!et(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return Ke({current:r,max:n,change:t})})(t,r);if(!o)return n(r),null;const i=He(r,o);n(i);return He(r,i)};return t=>{const n=t.scrollJumpRequest;if(!n)return;const i=Pe(t.impact);ce(i,"Cannot perform a jump scroll when there is no destination");const a=r(t.dimensions.droppables[i],n);if(!a)return;const s=t.viewport,l=o(t.isWindowScrollAllowed,s,a);l&&((t,n)=>{const r=je(t.current.client.selection,n);e({client:r})})(t,l)}},ft=({scrollDroppable:e,scrollWindow:t,move:n})=>{const r=(({scrollWindow:e,scrollDroppable:t})=>{const n=Ee(e),r=Ee(t);let o=null;const i=e=>{ce(o,"Cannot fluid scroll if not dragging");const{shouldUseTimeDampening:t,dragStartTime:i}=o;ut({state:e,scrollWindow:n,scrollDroppable:r,dragStartTime:i,shouldUseTimeDampening:t})};return{start:e=>{Se(),ce(!o,"Cannot start auto scrolling when already started");const t=Date.now();let n=!1;const r=()=>{n=!0};ut({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:r,scrollDroppable:r}),o={dragStartTime:t,shouldUseTimeDampening:n},Ae(),n&&i(e)},stop:()=>{o&&(n.cancel(),r.cancel(),o=null)},scroll:i}})({scrollWindow:t,scrollDroppable:e}),o=gt({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:e=>{"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&o(e):r.scroll(e))},start:r.start,stop:r.stop}},mt=(e,t)=>"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason),bt=e=>t=>n=>{if("DROP_ANIMATION_FINISHED"!==n.type)return void t(n);const r=e.getState();ce("DROP_ANIMATING"===r.phase,"Cannot finish a drop animating when no drop is occurring"),e.dispatch(xe({completed:r.completed}))};function ht(e,t,n){const r=t.map((t=>{const r=function(e,t){return{...e,...t}}(n,t.options);return e.addEventListener(t.eventName,t.fn,r),function(){e.removeEventListener(t.eventName,t.fn,r)}}));return function(){r.forEach((e=>{e()}))}}const yt=e=>{let t=null,n=null;return r=>o=>{if("FLUSH"!==o.type&&"DROP_COMPLETE"!==o.type&&"DROP_ANIMATION_FINISHED"!==o.type||(n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)),r(o),"DROP_ANIMATE"!==o.type)return;const i={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){"DROP_ANIMATING"===e.getState().phase&&e.dispatch({type:"DROP_ANIMATION_FINISHED",payload:null})}};n=requestAnimationFrame((()=>{n=null,t=ht(window,[i])}))}};function vt(e){return e.at&&"REORDER"===e.at.type?e.at.destination:null}function It(e){return e.at&&"COMBINE"===e.at.type?e.at.combine:null}const Dt="cubic-bezier(.2,1,.1,1)",xt={drop:0,combining:.7},wt={drop:.75},Ct={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},Et=`${Ct.outOfTheWay}s ${"cubic-bezier(0.2, 0, 0, 1)"}`,St={fluid:`opacity ${Et}`,snap:`transform ${Et}, opacity ${Et}`,drop:e=>{const t=`${e}s ${Dt}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${Et}`,placeholder:`height ${Et}, width ${Et}, margin ${Et}`},At=e=>Ye(e,We)?void 0:`translate(${e.x}px, ${e.y}px)`,Pt={moveTo:At,drop:(e,t)=>{const n=At(e);if(n)return t?`${n} scale(${wt.drop})`:n}},{minDropTime:Bt,maxDropTime:Nt}=Ct,Rt=Nt-Bt,Ot={point:We,value:0},Tt={invisible:{},visible:{},all:[]},Lt={displaced:Tt,displacedBy:Ot,at:null};var Mt="Invariant failed";const Gt=function(e,t){if(!e)throw new Error(Mt)};var _t=function(e){var t=e.top,n=e.right,r=e.bottom,o=e.left;return{top:t,right:n,bottom:r,left:o,width:n-o,height:r-t,x:o,y:t,center:{x:(n+o)/2,y:(r+t)/2}}},$t=function(e,t){return{top:e.top-t.top,left:e.left-t.left,bottom:e.bottom+t.bottom,right:e.right+t.right}},Ft=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},Ut={top:0,right:0,bottom:0,left:0},kt=function(e){var t=e.borderBox,n=e.margin,r=void 0===n?Ut:n,o=e.border,i=void 0===o?Ut:o,a=e.padding,s=void 0===a?Ut:a,l=_t($t(t,r)),c=_t(Ft(t,i)),d=_t(Ft(c,s));return{marginBox:l,borderBox:_t(t),paddingBox:c,contentBox:d,margin:r,border:i,padding:s}},Wt=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var n=Number(t);return isNaN(n)&&Gt(!1),n},jt=function(e,t){var n,r,o=e.borderBox,i=e.border,a=e.margin,s=e.padding,l=(r=t,{top:(n=o).top+r.y,left:n.left+r.x,bottom:n.bottom+r.y,right:n.right+r.x});return kt({borderBox:l,border:i,margin:a,padding:s})},Ht=function(e,t){return void 0===t&&(t={x:window.pageXOffset,y:window.pageYOffset}),jt(e,t)},Yt=function(e,t){var n={top:Wt(t.marginTop),right:Wt(t.marginRight),bottom:Wt(t.marginBottom),left:Wt(t.marginLeft)},r={top:Wt(t.paddingTop),right:Wt(t.paddingRight),bottom:Wt(t.paddingBottom),left:Wt(t.paddingLeft)},o={top:Wt(t.borderTopWidth),right:Wt(t.borderRightWidth),bottom:Wt(t.borderBottomWidth),left:Wt(t.borderLeftWidth)};return kt({borderBox:e,margin:n,padding:r,border:o})},qt=function(e){var t=e.getBoundingClientRect(),n=window.getComputedStyle(e);return Yt(t,n)};const Vt=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),zt=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],Zt=e=>{const t=$e(e.top,e.bottom),n=$e(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const o=t(r.top)||t(r.bottom),i=n(r.left)||n(r.right);if(o&&i)return!0;const a=r.top<e.top&&r.bottom>e.bottom,s=r.left<e.left&&r.right>e.right;if(a&&s)return!0;return a&&i||s&&o}},Jt=e=>{const t=$e(e.top,e.bottom),n=$e(e.left,e.right);return e=>t(e.top)&&t(e.bottom)&&n(e.left)&&n(e.right)},Xt=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:o})=>{const i=r?((e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:We;return Vt(e,n)})(e,t):e;return((e,t,n)=>!!t.subject.active&&n(t.subject.active)(e))(i,t,o)&&((e,t,n)=>n(t)(e))(i,n,o)},Kt=e=>Xt({...e,isVisibleThroughFrameFn:Zt}),Qt=e=>Xt({...e,isVisibleThroughFrameFn:Jt}),en=(e,t,n)=>{if("boolean"==typeof n)return n;if(!t)return!0;const{invisible:r,visible:o}=t;if(r[e])return!1;const i=o[e];return!i||i.shouldAnimate};function tn({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:o,last:i}){return e.reduce((function(e,a){const s=function(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return _t($t(n,r))}(a,n),l=a.descriptor.id;e.all.push(l);if(!Kt({target:s,destination:t,viewport:r,withDroppableDisplacement:!0}))return e.invisible[a.descriptor.id]=!0,e;const c={draggableId:l,shouldAnimate:en(l,i,o)};return e.visible[l]=c,e}),{all:[],visible:{},invisible:{}})}const nn=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:o})=>{const i=e.displaced,a=function(e,t){return e.map((e=>t[e]))}(i.all,n),s=tn({afterDragging:a,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:s}},rn=(e,t)=>{const n=e.frame;return n?je(t,n.scroll.diff.displacement):t};function on(e,t){return Boolean(t.effected[e])}const an=({afterCritical:e,impact:t,draggables:n})=>{const r=It(t);ce(r);const o=r.draggableId,i=n[o].page.borderBox.center,a=(({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const o=Boolean(e.visible[n]||e.invisible[n]);return on(n,t)?o?We:qe(r.point):o?r.point:We})({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return je(i,a)},sn=(0,Be.Z)(((e,t)=>_e(t).filter((t=>e===t.descriptor.droppableId)).sort(((e,t)=>e.descriptor.index-t.descriptor.index)))),ln=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,cn=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,dn=({axis:e,moveRelativeTo:t,isMoving:n})=>Ve(e.line,t.marginBox[e.end]+ln(e,n),cn(e,t.marginBox,n)),pn=({axis:e,moveRelativeTo:t,isMoving:n})=>Ve(e.line,t.marginBox[e.start]-((e,t)=>t.margin[e.end]+t.borderBox[e.size]/2)(e,n),cn(e,t.marginBox,n)),un=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o})=>{const i=sn(r.descriptor.id,n),a=t.page,s=r.axis;if(!i.length)return(({axis:e,moveInto:t,isMoving:n})=>Ve(e.line,t.contentBox[e.start]+ln(e,n),cn(e,t.contentBox,n)))({axis:s,moveInto:r.page,isMoving:a});const{displaced:l,displacedBy:c}=e,d=l.all[0];if(d){const e=n[d];if(on(d,o))return pn({axis:s,moveRelativeTo:e.page,isMoving:a});const t=jt(e.page,c.point);return pn({axis:s,moveRelativeTo:t,isMoving:a})}const p=i[i.length-1];if(p.descriptor.id===t.descriptor.id)return a.borderBox.center;if(on(p.descriptor.id,o)){const e=jt(p.page,qe(o.displacedBy.point));return dn({axis:s,moveRelativeTo:e,isMoving:a})}return dn({axis:s,moveRelativeTo:p.page,isMoving:a})},gn=e=>{const t=(({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:o})=>{const i=t.page.borderBox.center,a=e.at;return n&&a?"REORDER"===a.type?un({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o}):an({impact:e,draggables:r,afterCritical:o}):i})(e),n=e.droppable;return n?rn(n,t):t},fn=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=((e,t)=>je(e.scroll.diff.displacement,t))(n,e),o=He(r,t.page.borderBox.center);return je(t.client.borderBox.center,o)},mn=({impact:e,draggable:t,droppable:n,draggables:r,viewport:o,afterCritical:i})=>{const a=gn({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return fn({pageBorderBoxCenter:a,draggable:t,viewport:o})},bn=({getState:e,dispatch:t})=>n=>r=>{if("DROP"!==r.type)return void n(r);const o=e(),i=r.payload.reason;if("COLLECTING"===o.phase)return void t((e=>({type:"DROP_PENDING",payload:e}))({reason:i}));if("IDLE"===o.phase)return;ce(!("DROP_PENDING"===o.phase&&o.isWaiting),"A DROP action occurred while DROP_PENDING and still waiting"),ce("DRAGGING"===o.phase||"DROP_PENDING"===o.phase,`Cannot drop in phase: ${o.phase}`);const a=o,s=a.critical,l=o.dimensions,c=l.draggables[a.critical.draggable.id],{impact:d,didDropInsideDroppable:p}=(({draggables:e,reason:t,lastImpact:n,home:r,viewport:o,onLiftImpact:i})=>{if(!n.at||"DROP"!==t)return{impact:nn({draggables:e,impact:i,destination:r,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1};return"REORDER"===n.at.type?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Tt},didDropInsideDroppable:!0}})({reason:i,lastImpact:a.impact,afterCritical:a.afterCritical,onLiftImpact:a.onLiftImpact,home:a.dimensions.droppables[a.critical.droppable.id],viewport:a.viewport,draggables:a.dimensions.draggables}),u=p?vt(d):null,g=p?It(d):null,f={index:s.draggable.index,droppableId:s.droppable.id},m={draggableId:c.descriptor.id,type:c.descriptor.type,source:f,reason:i,mode:a.movementMode,destination:u,combine:g},b=(({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:o})=>{const{draggables:i,droppables:a}=n,s=Pe(e),l=s?a[s]:null,c=a[t.descriptor.droppableId],d=mn({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:l||c,viewport:r});return He(d,t.client.borderBox.center)})({impact:d,draggable:c,dimensions:l,viewport:a.viewport,afterCritical:a.afterCritical}),h={critical:a.critical,afterCritical:a.afterCritical,result:m,impact:d};if(!(!Ye(a.current.client.offset,b)||Boolean(m.combine)))return void t(xe({completed:h}));const y=(({current:e,destination:t,reason:n})=>{const r=ze(e,t);if(r<=0)return Bt;if(r>=1500)return Nt;const o=Bt+Rt*(r/1500);return Number(("CANCEL"===n?.6*o:o).toFixed(2))})({current:a.current.client.offset,destination:b,reason:i});t((e=>({type:"DROP_ANIMATE",payload:e}))({newHomeClientOffset:b,dropDuration:y,completed:h}))};const hn=e=>t=>n=>{if(t(n),"PUBLISH_WHILE_DRAGGING"!==n.type)return;const r=e.getState();"DROP_PENDING"===r.phase&&(r.isWaiting||e.dispatch(we({reason:r.reason})))},yn=()=>{const e=[];return{add:t=>{const n=setTimeout((()=>(t=>{const n=Re(e,(e=>e.timerId===t));ce(-1!==n,"Could not find timer");const[r]=e.splice(n,1);r.callback()})(n))),r={timerId:n,callback:t};e.push(r)},flush:()=>{if(!e.length)return;const t=[...e];e.length=0,t.forEach((e=>{clearTimeout(e.timerId),e.callback()}))}}},vn=(e,t)=>{Se(),t(),Ae()},In=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}),Dn=(e,t,n,r)=>{if(!e)return void n(r(t));const o=(e=>{let t=!1,n=!1;const r=setTimeout((()=>{n=!0})),o=o=>{t?ie("Announcement already made. Not making a second announcement"):n?ie("\n Announcements cannot be made asynchronously.\n Default message has already been announced.\n "):(t=!0,e(o),clearTimeout(r))};return o.wasCalled=()=>t,o})(n);e(t,{announce:o}),o.wasCalled()||n(r(t))},xn=(e,t)=>{const n=((e,t)=>{const n=yn();let r=null;const o=n=>{ce(r,"Cannot fire onDragEnd when there is no matching onDragStart"),r=null,vn(0,(()=>Dn(e().onDragEnd,n,t,d.onDragEnd)))};return{beforeCapture:(t,n)=>{ce(!r,"Cannot fire onBeforeCapture as a drag start has already been published"),vn(0,(()=>{const r=e().onBeforeCapture;r&&r({draggableId:t,mode:n})}))},beforeStart:(t,n)=>{ce(!r,"Cannot fire onBeforeDragStart as a drag start has already been published"),vn(0,(()=>{const r=e().onBeforeDragStart;r&&r(In(t,n))}))},start:(o,i)=>{ce(!r,"Cannot fire onBeforeDragStart as a drag start has already been published");const a=In(o,i);r={mode:i,lastCritical:o,lastLocation:a.source,lastCombine:null},n.add((()=>{vn(0,(()=>Dn(e().onDragStart,a,t,d.onDragStart)))}))},update:(o,i)=>{const a=vt(i),s=It(i);ce(r,"Cannot fire onDragMove when onDragStart has not been called");const l=!((e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r})(o,r.lastCritical);l&&(r.lastCritical=o);const c=(u=a,!(!(p=r.lastLocation)&&!u||p&&u&&p.droppableId===u.droppableId&&p.index===u.index));var p,u;c&&(r.lastLocation=a);const g=!((e,t)=>!e&&!t||!(!e||!t)&&e.draggableId===t.draggableId&&e.droppableId===t.droppableId)(r.lastCombine,s);if(g&&(r.lastCombine=s),!l&&!c&&!g)return;const f={...In(o,r.mode),combine:s,destination:a};n.add((()=>{vn(0,(()=>Dn(e().onDragUpdate,f,t,d.onDragUpdate)))}))},flush:()=>{ce(r,"Can only flush responders while dragging"),n.flush()},drop:o,abort:()=>{if(!r)return;const e={...In(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};o(e)}}})(e,t);return e=>t=>r=>{if("BEFORE_INITIAL_CAPTURE"===r.type)return void n.beforeCapture(r.payload.draggableId,r.payload.movementMode);if("INITIAL_PUBLISH"===r.type){const e=r.payload.critical;return n.beforeStart(e,r.payload.movementMode),t(r),void n.start(e,r.payload.movementMode)}if("DROP_COMPLETE"===r.type){const e=r.payload.completed.result;return n.flush(),t(r),void n.drop(e)}if(t(r),"FLUSH"===r.type)return void n.abort();const o=e.getState();"DRAGGING"===o.phase&&n.update(o.critical,o.impact)}};function wn(){}const Cn=()=>({x:window.pageXOffset,y:window.pageYOffset});function En({onWindowScroll:e}){const t=Ee((function(){e(Cn())})),n=function(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}(t);let r=wn;function o(){return r!==wn}return{start:function(){ce(!o(),"Cannot start scroll listener when already active"),r=ht(window,[n])},stop:function(){ce(o(),"Cannot stop scroll listener when not active"),t.cancel(),r(),r=wn},isActive:o}}const Sn=e=>{const t=En({onWindowScroll:t=>{e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return e=>n=>{t.isActive()||"INITIAL_PUBLISH"!==n.type||t.start(),t.isActive()&&(e=>"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type)(n)&&t.stop(),e(n)}},An=(e,t)=>t&&t.shouldClipSubject?((e,t)=>{const n=_t({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n})(t.pageMarginBox,e):_t(e),Pn=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const o=((e,t)=>t?Vt(e,t.scroll.diff.displacement):e)(e.marginBox,r),i=((e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e)(o,n,t);return{page:e,withPlaceholder:t,active:An(i,r)}},Bn=(e,t)=>{ce(e.frame);const n=e.frame,r=He(t,n.scroll.initial),o=qe(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}},a=Pn({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}},Nn=(0,Be.Z)((function(e,t){const n=t[e.line];return{value:n,point:Ve(e.line,n)}})),Rn=({draggable:e,home:t,draggables:n,viewport:r})=>{const o=Nn(t.axis,e.displaceBy),i=sn(t.descriptor.id,n),a=i.indexOf(e);ce(-1!==a,"Expected draggable to be inside home list");const s=i.slice(a+1),l=s.reduce(((e,t)=>(e[t.descriptor.id]=!0,e)),{}),c={inVirtualList:"virtual"===t.descriptor.mode,displacedBy:o,effected:l};var d;return{impact:{displaced:tn({afterDragging:s,destination:t,displacedBy:o,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:(d=e.descriptor,{index:d.index,droppableId:d.droppableId})}},afterCritical:c}};function On(e){return"DRAGGING"===e.phase||"COLLECTING"===e.phase}const Tn=e=>{const t=e.subject.active;return ce(t,"Cannot get clipped area from droppable"),t},Ln=(e,t)=>{const n=e.page.borderBox.center;return on(e.descriptor.id,t)?He(n,t.displacedBy.point):n},Mn=(e,t)=>{const n=e.page.borderBox;return on(e.descriptor.id,t)?Vt(n,qe(t.displacedBy.point)):n},Gn=(e,t)=>e.descriptor.droppableId===t.descriptor.id,_n=(0,Be.Z)(((e,t)=>t.filter((t=>t.descriptor.id!==e.descriptor.id))));function $n({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const o=function(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}(e,{inHomeList:t});return{displaced:Tt,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function Fn({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:o,last:i,index:a,forceShouldAnimate:s}){const l=Gn(e,n);if(null===a)return $n({insideDestination:t,inHomeList:l,displacedBy:o,destination:n});const c=Oe(t,(e=>e.descriptor.index===a));if(!c)return $n({insideDestination:t,inHomeList:l,displacedBy:o,destination:n});const d=_n(e,t),p=t.indexOf(c);return{displaced:tn({afterDragging:d.slice(p),destination:n,displacedBy:o,last:i,viewport:r.frame,forceShouldAnimate:s}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}const Un=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),kn=(e,t,n)=>{const r=e.frame;ce(!Gn(t,e),"Should not add placeholder space to home list"),ce(!e.subject.withPlaceholder,"Cannot add placeholder size to a subject when it already has one");const o=Nn(e.axis,t.displaceBy).point,i=((e,t,n)=>{const r=e.axis;if("virtual"===e.descriptor.mode)return Ve(r.line,t[r.line]);const o=e.subject.page.contentBox[r.size],i=sn(e.descriptor.id,n).reduce(((e,t)=>e+t.client.marginBox[r.size]),0)+t[r.line]-o;return i<=0?null:Ve(r.line,i)})(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const t=Pn({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:t}}const s=i?je(r.scroll.max,i):r.scroll.max,l=Un(r,s),c=Pn({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:l});return{...e,subject:c,frame:l}},Wn=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=He(n,e.page.borderBox.center),s={target:Vt(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:r};return i?(e=>{return Xt({...e,isVisibleThroughFrameFn:(t=e.destination.axis,e=>{const n=$e(e.top,e.bottom),r=$e(e.left,e.right);return e=>t===nt?n(e.top)&&n(e.bottom):r(e.left)&&r(e.right)})});var t})(s):Qt(s)},jn=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:o,droppables:i,viewport:a,afterCritical:s})=>{const l=(({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:o})=>{const i=n.subject.active;if(!i)return null;const a=n.axis,s=$e(i[a.start],i[a.end]),l=Ge(r).filter((e=>e!==n)).filter((e=>e.isEnabled)).filter((e=>Boolean(e.subject.active))).filter((e=>Zt(o.frame)(Tn(e)))).filter((t=>{const n=Tn(t);return e?i[a.crossAxisEnd]<n[a.crossAxisEnd]:n[a.crossAxisStart]<i[a.crossAxisStart]})).filter((e=>{const t=Tn(e),n=$e(t[a.start],t[a.end]);return s(t[a.start])||s(t[a.end])||n(i[a.start])||n(i[a.end])})).sort(((t,n)=>{const r=Tn(t)[a.crossAxisStart],o=Tn(n)[a.crossAxisStart];return e?r-o:o-r})).filter(((e,t,n)=>Tn(e)[a.crossAxisStart]===Tn(n[0])[a.crossAxisStart]));if(!l.length)return null;if(1===l.length)return l[0];const c=l.filter((e=>$e(Tn(e)[a.start],Tn(e)[a.end])(t[a.line])));return 1===c.length?c[0]:c.length>1?c.sort(((e,t)=>Tn(e)[a.start]-Tn(t)[a.start]))[0]:l.sort(((e,n)=>{const r=Ze(t,zt(Tn(e))),o=Ze(t,zt(Tn(n)));return r!==o?r-o:Tn(e)[a.start]-Tn(n)[a.start]}))[0]})({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:a});if(!l)return null;const c=sn(l.descriptor.id,o),d=(({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:o})=>r.filter((e=>Qt({target:Mn(e,o),destination:n,viewport:t.frame,withDroppableDisplacement:!0}))).sort(((t,r)=>{const i=ze(e,rn(n,Ln(t,o))),a=ze(e,rn(n,Ln(r,o)));return i<a?-1:a<i?1:t.descriptor.index-r.descriptor.index}))[0]||null)({pageBorderBoxCenter:t,viewport:a,destination:l,insideDestination:c,afterCritical:s}),p=(({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:o,destination:i,viewport:a,afterCritical:s})=>{if(!t){if(n.length)return null;const e={displaced:Tt,displacedBy:Ot,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},t=gn({impact:e,draggable:r,droppable:i,draggables:o,afterCritical:s}),l=Gn(r,i)?i:kn(i,r,o);return Wn({draggable:r,destination:l,newPageBorderBoxCenter:t,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?e:null}const l=Boolean(e[i.axis.line]<=t.page.borderBox.center[i.axis.line]),c=(()=>{const e=t.descriptor.index;return t.descriptor.id===r.descriptor.id||l?e:e+1})(),d=Nn(i.axis,r.displaceBy);return Fn({draggable:r,insideDestination:n,destination:i,viewport:a,displacedBy:d,last:Tt,index:c})})({previousPageBorderBoxCenter:t,destination:l,draggable:n,draggables:o,moveRelativeTo:d,insideDestination:c,viewport:a,afterCritical:s});if(!p)return null;const u=gn({impact:p,draggable:n,droppable:l,draggables:o,afterCritical:s});return{clientSelection:fn({pageBorderBoxCenter:u,draggable:n,viewport:a}),impact:p,scrollJumpRequest:null}},Hn=(e,t)=>{const n=He(t,e.scroll.initial),r=qe(n);return{frame:_t({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function Yn(e,t){return e.map((e=>t[e]))}const qn=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:o,insideDestination:i,previousImpact:a,viewport:s,afterCritical:l})=>{const c=a.at;if(ce(c,"Cannot move in direction without previous impact location"),(e=>"REORDER"===e.type)(c)){const r=(({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const o=r.index,i=e?o+1:o-1,a=n[0].descriptor.index,s=n[n.length-1].descriptor.index;return i<a||i>(t?s:s+1)?null:i})({isMovingForward:e,isInHomeList:t,location:c.destination,insideDestination:i});return null===r?null:Fn({draggable:n,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:r})}const d=(({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,a=n[i].descriptor.index;return on(i,o)?e?a:a-1:e?a+1:a})({isMovingForward:e,destination:o,displaced:a.displaced,draggables:r,combine:c.combine,afterCritical:l});return null===d?null:Fn({draggable:n,insideDestination:i,destination:o,viewport:s,last:a.displaced,displacedBy:a.displacedBy,index:d})},Vn=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:s,afterCritical:l})=>{if(!n.isEnabled)return null;const c=sn(n.descriptor.id,r),d=Gn(t,n),p=(({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:o})=>{if(!n.isCombineEnabled)return null;if(!vt(o))return null;function i(e){const t={type:"COMBINE",combine:{draggableId:e,droppableId:n.descriptor.id}};return{...o,at:t}}const a=o.displaced.all,s=a.length?a[0]:null;if(e)return s?i(s):null;const l=_n(t,r);if(!s)return l.length?i(l[l.length-1].descriptor.id):null;const c=Re(l,(e=>e.descriptor.id===s));ce(-1!==c,"Could not find displaced item in set");const d=c-1;return d<0?null:i(l[d].descriptor.id)})({isMovingForward:e,draggable:t,destination:n,insideDestination:c,previousImpact:o})||qn({isMovingForward:e,isInHomeList:d,draggable:t,draggables:r,destination:n,insideDestination:c,previousImpact:o,viewport:i,afterCritical:l});if(!p)return null;const u=gn({impact:p,draggable:t,droppable:n,draggables:r,afterCritical:l});if(Wn({draggable:t,destination:n,newPageBorderBoxCenter:u,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})){return{clientSelection:fn({pageBorderBoxCenter:u,draggable:t,viewport:i}),impact:p,scrollJumpRequest:null}}const g=He(u,a),f=(({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:o})=>{const i=Hn(t,je(t.scroll.current,o)),a=n.frame?Bn(n,je(n.frame.scroll.current,o)):n,s=e.displaced,l=tn({afterDragging:Yn(s.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:s,forceShouldAnimate:!1}),c=tn({afterDragging:Yn(s.all,r),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:s,forceShouldAnimate:!1}),d={},p={},u=[s,l,c];return s.all.forEach((e=>{const t=function(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}(e,u);t?p[e]=t:d[e]=!0})),{...e,displaced:{all:s.all,invisible:d,visible:p}}})({impact:p,viewport:i,destination:n,draggables:r,maxScrollChange:g});return{clientSelection:s,impact:f,scrollJumpRequest:g}},zn=({state:e,type:t})=>{const n=((e,t)=>{const n=Pe(e);return n?t[n]:null})(e.impact,e.dimensions.droppables),r=Boolean(n),o=e.dimensions.droppables[e.critical.droppable.id],i=n||o,a=i.axis.direction,s="vertical"===a&&("MOVE_UP"===t||"MOVE_DOWN"===t)||"horizontal"===a&&("MOVE_LEFT"===t||"MOVE_RIGHT"===t);if(s&&!r)return null;const l="MOVE_DOWN"===t||"MOVE_RIGHT"===t,c=e.dimensions.draggables[e.critical.draggable.id],d=e.current.page.borderBoxCenter,{draggables:p,droppables:u}=e.dimensions;return s?Vn({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,destination:i,draggables:p,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):jn({isMovingForward:l,previousPageBorderBoxCenter:d,draggable:c,isOver:i,draggables:p,droppables:u,viewport:e.viewport,afterCritical:e.afterCritical})},Zn=(e,t)=>({...e,[t.descriptor.id]:t});function Jn({pageBorderBox:e,draggable:t,droppables:n}){const r=Ge(n).filter((t=>{if(!t.isEnabled)return!1;const n=t.subject.active;if(!n)return!1;if(o=n,!((r=e).left<o.right&&r.right>o.left&&r.top<o.bottom&&r.bottom>o.top))return!1;var r,o;if(Fe(n)(e.center))return!0;const i=t.axis,a=n.center[i.crossAxisLine],s=e[i.crossAxisStart],l=e[i.crossAxisEnd],c=$e(n[i.crossAxisStart],n[i.crossAxisEnd]),d=c(s),p=c(l);return!d&&!p||(d?s<a:l>a)}));return r.length?1===r.length?r[0].descriptor.id:function({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,o=n.map((t=>{const n=t.axis,o=Ve(t.axis.line,e.center[n.line],t.page.borderBox.center[n.crossAxisLine]);return{id:t.descriptor.id,distance:ze(r,o)}})).sort(((e,t)=>t.distance-e.distance));return o[0]?o[0].id:null}({pageBorderBox:e,draggable:t,candidates:r}):null}const Xn=(e,t)=>_t(Vt(e,t));function Kn({displaced:e,id:t}){return Boolean(e.visible[t]||e.invisible[t])}const Qn=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:o,viewport:i,afterCritical:a})=>{const s=Xn(t.page.borderBox,e),l=Jn({pageBorderBox:s,draggable:t,droppables:r});if(!l)return Lt;const c=r[l],d=sn(c.descriptor.id,n),p=((e,t)=>{const n=e.frame;return n?Xn(t,n.scroll.diff.value):t})(c,s);return(({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:o,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const a=r.axis,s=Nn(r.axis,e.displaceBy),l=s.value,c=t[a.start],d=t[a.end],p=Oe(_n(e,o),(e=>{const t=e.descriptor.id,r=e.page.borderBox,o=r[a.size]/4,s=on(t,i),p=Kn({displaced:n.displaced,id:t});return s?p?d>r[a.start]+o&&d<r[a.end]-o:c>r[a.start]-l+o&&c<r[a.end]-l-o:p?d>r[a.start]+l+o&&d<r[a.end]+l-o:c>r[a.start]+o&&c<r[a.end]-o}));return p?{displacedBy:s,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:p.descriptor.id,droppableId:r.descriptor.id}}}:null})({pageBorderBoxWithDroppableScroll:p,draggable:t,previousImpact:o,destination:c,insideDestination:d,afterCritical:a})||(({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:o,viewport:i,afterCritical:a})=>{const s=n.axis,l=Nn(n.axis,t.displaceBy),c=l.value,d=e[s.start],p=e[s.end],u=function({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}({draggable:t,closest:Oe(_n(t,r),(e=>{const t=e.descriptor.id,n=e.page.borderBox.center[s.line],r=e.page.borderBox["y"===s.line?"top":"left"],i=e.page.borderBox["y"===s.line?"bottom":"right"],l=on(t,a),u=Kn({displaced:o,id:t});return l?u?"y"===s.line?d<=r:p<=n:"y"===s.line?d<r:d<n-c:u?"y"===s.line?d<=i:p<=n+c:"y"===s.line?d<i:d<n})),inHomeList:Gn(t,n)});return Fn({draggable:t,insideDestination:r,destination:n,viewport:i,last:o,displacedBy:l,index:u})})({pageBorderBoxWithDroppableScroll:p,draggable:t,destination:c,insideDestination:d,last:o.displaced,viewport:i,afterCritical:a})},er=({previousImpact:e,impact:t,droppables:n})=>{const r=Pe(e),o=Pe(t);if(!r)return n;if(r===o)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const a=(e=>{const t=e.subject.withPlaceholder;ce(t,"Cannot remove placeholder form subject when there was none");const n=e.frame;if(!n){const t=Pn({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:t}}const r=t.oldFrameMaxScroll;ce(r,"Expected droppable with frame to have old max frame scroll when removing placeholder");const o=Un(n,r),i=Pn({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}})(i);return Zn(n,a)},tr=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:o,scrollJumpRequest:i})=>{const a=r||e.viewport,s=n||e.dimensions,l=t||e.current.client.selection,c=He(l,e.initial.client.selection),d={offset:c,selection:l,borderBoxCenter:je(e.initial.client.borderBoxCenter,c)},p={selection:je(d.selection,a.scroll.current),borderBoxCenter:je(d.borderBoxCenter,a.scroll.current),offset:je(d.offset,a.scroll.diff.value)},u={client:d,page:p};if("COLLECTING"===e.phase)return{...e,dimensions:s,viewport:a,current:u};const g=s.draggables[e.critical.draggable.id],f=o||Qn({pageOffset:p.offset,draggable:g,draggables:s.draggables,droppables:s.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),m=(({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:o})=>{const i=er({previousImpact:r,impact:o,droppables:n}),a=Pe(o);if(!a)return i;const s=n[a];if(Gn(e,s))return i;if(s.subject.withPlaceholder)return i;const l=kn(s,e,t);return Zn(i,l)})({draggable:g,impact:f,previousImpact:e.impact,draggables:s.draggables,droppables:s.droppables});return{...e,current:u,dimensions:{draggables:s.draggables,droppables:m},impact:f,viewport:a,scrollJumpRequest:i||null,forceShouldAnimate:!i&&null}},nr=({state:e,dimensions:t,viewport:n})=>{ce("SNAP"===e.movementMode);const r=e.impact,o=n||e.viewport,i=t||e.dimensions,{draggables:a,droppables:s}=i,l=a[e.critical.draggable.id],c=Pe(r);ce(c,"Must be over a destination in SNAP movement mode");const d=s[c],p=nn({impact:r,viewport:o,destination:d,draggables:a}),u=mn({impact:p,draggable:l,droppable:d,draggables:a,viewport:o,after