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.

2,301 lines (2,069 loc) 160 kB
import e, { useEffect as t, useRef as n, useLayoutEffect as r, useState as o, createContext as i, useContext as s, Fragment as a, Component as c, useCallback as l, useMemo as d } from "react"; import { as as u } from "./chunk1.mjs"; import { useMemo as p, useCallback as g } from "use-memo-one"; import { Provider as f, connect as m } from "react-redux"; import { createStore as b, applyMiddleware as h, compose as v, bindActionCreators as y } from "redux"; import D from "raf-schd"; import I from "memoize-one"; import { getRect as x, expand as C, offset as w, withScroll as E, calculateBox as A, getBox as S, createBox as B } from "css-box-model"; import { jsx as N, jsxs as P } from "react/jsx-runtime"; import R from "react-dom"; import "react-dom/client"; import "tslib"; import "rxjs"; import "rxjs/operators"; import "i18next"; import "react-i18next"; import "react-focus-lock"; import "classnames"; import "framer-motion"; import "handlebars"; import "zod"; import "polished"; import "axios"; import "reselect"; import "./i18n/nova_i18n.mjs"; import "react-popper"; import "@popperjs/core"; import "cldr-core/supplemental/weekData.json"; import "@tanstack/react-query"; import "react-cropper"; import "redux-observable"; import "@redux-devtools/extension"; const O = `\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`; const T = e => e + 1; const L = e => `\n You have lifted an item in position ${T(e.source.index)}\n`; const G = (e, t) => { const n = e.droppableId === t.droppableId; const r = T(e.index); const o = T(t.index); if (n) { return `\n You have moved the item from position ${r}\n to position ${o}\n `; } return `\n You have moved the item from position ${r}\n in list ${e.droppableId}\n to list ${t.droppableId}\n in position ${o}\n `; }; const M = (e, t, n) => { const r = t.droppableId === n.droppableId; if (r) { return `\n The item ${e}\n has been combined with ${n.draggableId}`; } return `\n The item ${e}\n in list ${t.droppableId}\n has been combined with ${n.draggableId}\n in list ${n.droppableId}\n `; }; const _ = e => { const t = e.destination; if (t) { return G(e.source, t); } const n = e.combine; if (n) { return M(e.draggableId, e.source, n); } return "You are over an area that cannot be dropped on"; }; const $ = e => `\n The item has returned to its starting position\n of ${T(e.index)}\n`; const F = e => { if (e.reason === "CANCEL") { return `\n Movement cancelled.\n ${$(e.source)}\n `; } const t = e.destination; const n = e.combine; if (t) { return `\n You have dropped the item.\n ${G(e.source, t)}\n `; } if (n) { return `\n You have dropped the item.\n ${M(e.draggableId, e.source, n)}\n `; } return `\n The item has been dropped while not over a drop area.\n ${$(e.source)}\n `; }; const k = { dragHandleUsageInstructions: O, onDragStart: L, onDragUpdate: _, onDragEnd: F }; var U = k; let W = 0; const H = { separator: "::" }; function j() { W = 0; } function V(e, t = H) { return p((() => `${e}${t.separator}${W++}`), [ t.separator, e ]); } function q(e, t) { { return; } } const z = q.bind(null, "warn"); q.bind(null, "error"); const Y = "production" === "production"; const J = "Invariant failed"; class X { constructor(e) { this.message = e; } } X.prototype.toString = function e() { return this.message; }; function K(e, t) { if (e) { return; } if (Y) { throw new X(J); } else { throw new X(`${J}: ${t || ""}`); } } const Q = e => ({ type: "BEFORE_INITIAL_CAPTURE", payload: e }); const Z = e => ({ type: "LIFT", payload: e }); const ee = e => ({ type: "INITIAL_PUBLISH", payload: e }); const te = e => ({ type: "PUBLISH_WHILE_DRAGGING", payload: e }); const ne = () => ({ type: "COLLECTION_STARTING", payload: null }); const re = e => ({ type: "UPDATE_DROPPABLE_SCROLL", payload: e }); const oe = e => ({ type: "UPDATE_DROPPABLE_IS_ENABLED", payload: e }); const ie = e => ({ type: "UPDATE_DROPPABLE_IS_COMBINE_ENABLED", payload: e }); const se = e => ({ type: "MOVE", payload: e }); const ae = e => ({ type: "MOVE_BY_WINDOW_SCROLL", payload: e }); const ce = e => ({ type: "UPDATE_VIEWPORT_MAX_SCROLL", payload: e }); const le = () => ({ type: "MOVE_UP", payload: null }); const de = () => ({ type: "MOVE_DOWN", payload: null }); const ue = () => ({ type: "MOVE_RIGHT", payload: null }); const pe = () => ({ type: "MOVE_LEFT", payload: null }); const ge = () => ({ type: "FLUSH", payload: null }); const fe = e => ({ type: "DROP_ANIMATE", payload: e }); const me = e => ({ type: "DROP_COMPLETE", payload: e }); const be = e => ({ type: "DROP", payload: e }); const he = e => ({ type: "DROP_PENDING", payload: e }); const ve = () => ({ type: "DROP_ANIMATION_FINISHED", payload: null }); const ye = e => {}; const De = e => {}; var Ie = e => { const t = e.at; if (!t) { return null; } if (t.type === "REORDER") { return t.destination.droppableId; } return t.combine.droppableId; }; function xe(e) { if (Object.values) { return Object.values(e); } return Object.keys(e).map((t => e[t])); } function Ce(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 we(e, t) { if (e.find) { return e.find(t); } const n = Ce(e, t); if (n !== -1) { return e[n]; } return undefined; } function Ee(e) { return Array.prototype.slice.call(e); } const Ae = I((e => e.reduce(((e, t) => { e[t.descriptor.id] = t; return e; }), {}))); const Se = I((e => e.reduce(((e, t) => { e[t.descriptor.id] = t; return e; }), {}))); const Be = I((e => xe(e))); const Ne = I((e => xe(e))); var Pe = (e, t) => n => e <= n && n <= t; function Re(e) { const t = Pe(e.top, e.bottom); const n = Pe(e.left, e.right); return function e(r) { return t(r.y) && n(r.x); }; } const Oe = I((e => Be(e).filter((e => { if (!e.isEnabled) { return false; } if (!e.frame) { return false; } return true; })))); const Te = (e, t) => { const n = we(Oe(t), (t => { K(t.frame, "Invalid result"); return Re(t.frame.pageMarginBox)(e); })); return n; }; var Le = ({center: e, destination: t, droppables: n}) => { if (t) { const e = n[t]; if (!e.frame) { return null; } return e; } const r = Te(e, n); return r; }; const Ge = { x: 0, y: 0 }; const Me = (e, t) => ({ x: e.x + t.x, y: e.y + t.y }); const _e = (e, t) => ({ x: e.x - t.x, y: e.y - t.y }); const $e = (e, t) => e.x === t.x && e.y === t.y; const Fe = e => ({ x: e.x !== 0 ? -e.x : 0, y: e.y !== 0 ? -e.y : 0 }); const ke = (e, t, n = 0) => { if (e === "x") { return { x: t, y: n }; } return { x: n, y: t }; }; const Ue = (e, t) => Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)); const We = (e, t) => Math.min(...t.map((t => Ue(e, t)))); const He = e => t => ({ x: e(t.x), y: e(t.y) }); const je = He((e => { if (e === 0) { return 0; } return e > 0 ? 1 : -1; })); const Ve = (() => { const e = (e, t) => { if (e < 0) { return e; } if (e > t) { return e - t; } return 0; }; return ({current: t, max: n, change: r}) => { const o = Me(t, r); const i = { x: e(o.x, n.x), y: e(o.y, n.y) }; if ($e(i, Ge)) { return null; } return i; }; })(); const qe = ({max: e, current: t, change: n}) => { const r = { x: Math.max(t.x, e.x), y: Math.max(t.y, e.y) }; const o = je(n); const i = Ve({ max: r, current: t, change: o }); if (!i) { return true; } if (o.x !== 0 && i.x === 0) { return true; } if (o.y !== 0 && i.y === 0) { return true; } return false; }; const ze = (e, t) => qe({ current: e.scroll.current, max: e.scroll.max, change: t }); const Ye = (e, t) => { if (!ze(e, t)) { return null; } const n = e.scroll.max; const r = e.scroll.current; return Ve({ current: r, max: n, change: t }); }; const Je = (e, t) => { const n = e.frame; if (!n) { return false; } return qe({ current: n.scroll.current, max: n.scroll.max, change: t }); }; const Xe = (e, t) => { const n = e.frame; if (!n) { return null; } if (!Je(e, t)) { return null; } return Ve({ current: n.scroll.current, max: n.scroll.max, change: t }); }; const Ke = { direction: "vertical", line: "y", crossAxisLine: "x", start: "top", end: "bottom", size: "height", crossAxisStart: "left", crossAxisEnd: "right", crossAxisSize: "width" }; const Qe = { direction: "horizontal", line: "x", crossAxisLine: "y", start: "left", end: "right", size: "width", crossAxisStart: "top", crossAxisEnd: "bottom", crossAxisSize: "height" }; var Ze = ({container: e, subject: t, proposedScroll: n}) => { const r = t.height > e.height; const o = t.width > e.width; if (!o && !r) { return n; } if (o && r) { return null; } return { x: o ? 0 : n.x, y: r ? 0 : n.y }; }; const et = { startFromPercentage: .25, maxScrollAtPercentage: .05, maxPixelScroll: 28, ease: e => Math.pow(e, 2), durationDampening: { stopDampeningAt: 1200, accelerateAt: 360 } }; var tt = (e, t) => { const n = e[t.size] * et.startFromPercentage; const r = e[t.size] * et.maxScrollAtPercentage; const o = { startScrollingFrom: n, maxScrollValueAt: r }; return o; }; var nt = ({startOfRange: e, endOfRange: t, current: n}) => { const r = t - e; if (r === 0) { z(`\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 `); return 0; } const o = n - e; const i = o / r; return i; }; var rt = 1; const ot = et.durationDampening.accelerateAt; const it = et.durationDampening.stopDampeningAt; var st = (e, t) => { const n = t; const r = it; const o = Date.now(); const i = o - n; if (i >= it) { return e; } if (i < ot) { return rt; } const s = nt({ startOfRange: ot, endOfRange: r, current: i }); const a = e * et.ease(s); return Math.ceil(a); }; var at = (e, t) => { if (e > t.startScrollingFrom) { return 0; } if (e <= t.maxScrollValueAt) { return et.maxPixelScroll; } if (e === t.startScrollingFrom) { return rt; } const n = nt({ startOfRange: t.maxScrollValueAt, endOfRange: t.startScrollingFrom, current: e }); const r = 1 - n; const o = et.maxPixelScroll * et.ease(r); return Math.ceil(o); }; var ct = ({distanceToEdge: e, thresholds: t, dragStartTime: n, shouldUseTimeDampening: r}) => { const o = at(e, t); if (o === 0) { return 0; } if (!r) { return o; } return Math.max(st(o, n), rt); }; var lt = ({container: e, distanceToEdges: t, dragStartTime: n, axis: r, shouldUseTimeDampening: o}) => { const i = tt(e, r); const s = t[r.end] < t[r.start]; if (s) { return ct({ distanceToEdge: t[r.end], thresholds: i, dragStartTime: n, shouldUseTimeDampening: o }); } return -1 * ct({ distanceToEdge: t[r.start], thresholds: i, dragStartTime: n, shouldUseTimeDampening: o }); }; const dt = He((e => e === 0 ? 0 : e)); var ut = ({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 }; const s = lt({ container: t, distanceToEdges: i, dragStartTime: e, axis: Ke, shouldUseTimeDampening: o }); const a = lt({ container: t, distanceToEdges: i, dragStartTime: e, axis: Qe, shouldUseTimeDampening: o }); const c = dt({ x: a, y: s }); if ($e(c, Ge)) { return null; } const l = Ze({ container: t, subject: n, proposedScroll: c }); if (!l) { return null; } return $e(l, Ge) ? null : l; }; var pt = ({droppable: e, subject: t, center: n, dragStartTime: r, shouldUseTimeDampening: o}) => { const i = e.frame; if (!i) { return null; } const s = ut({ dragStartTime: r, container: i.pageMarginBox, subject: t, center: n, shouldUseTimeDampening: o }); return s && Je(e, s) ? s : null; }; var gt = ({viewport: e, subject: t, center: n, dragStartTime: r, shouldUseTimeDampening: o}) => { const i = ut({ dragStartTime: r, container: e.frame, subject: t, center: n, shouldUseTimeDampening: o }); return i && ze(e, i) ? i : null; }; var ft = ({state: e, dragStartTime: t, shouldUseTimeDampening: n, scrollWindow: r, scrollDroppable: o}) => { const i = e.current.page.borderBoxCenter; const s = e.dimensions.draggables[e.critical.draggable.id]; const a = s.page.marginBox; if (e.isWindowScrollAllowed) { const o = e.viewport; const s = gt({ dragStartTime: t, viewport: o, subject: a, center: i, shouldUseTimeDampening: n }); if (s) { r(s); return; } } const c = Le({ center: i, destination: Ie(e.impact), droppables: e.dimensions.droppables }); if (!c) { return; } const l = pt({ dragStartTime: t, droppable: c, subject: a, center: i, shouldUseTimeDampening: n }); if (l) { o(c.descriptor.id, l); } }; var mt = ({scrollWindow: e, scrollDroppable: t}) => { const n = D(e); const r = D(t); let o = null; const i = e => { K(o, "Cannot fluid scroll if not dragging"); const {shouldUseTimeDampening: t, dragStartTime: i} = o; ft({ state: e, scrollWindow: n, scrollDroppable: r, dragStartTime: i, shouldUseTimeDampening: t }); }; const s = e => { K(!o, "Cannot start auto scrolling when already started"); const t = Date.now(); let n = false; const r = () => { n = true; }; ft({ state: e, dragStartTime: 0, shouldUseTimeDampening: false, scrollWindow: r, scrollDroppable: r }); o = { dragStartTime: t, shouldUseTimeDampening: n }; if (n) { i(e); } }; const a = () => { if (!o) { return; } n.cancel(); r.cancel(); o = null; }; return { start: s, stop: a, scroll: i }; }; var bt = ({move: e, scrollDroppable: t, scrollWindow: n}) => { const r = (t, n) => { const r = Me(t.current.client.selection, n); e({ client: r }); }; const o = (e, n) => { if (!Je(e, n)) { return n; } const r = Xe(e, n); if (!r) { t(e.descriptor.id, n); return null; } const o = _e(n, r); t(e.descriptor.id, o); const i = _e(n, o); return i; }; const i = (e, t, r) => { if (!e) { return r; } if (!ze(t, r)) { return r; } const o = Ye(t, r); if (!o) { n(r); return null; } const i = _e(r, o); n(i); const s = _e(r, i); return s; }; const s = e => { const t = e.scrollJumpRequest; if (!t) { return; } const n = Ie(e.impact); K(n, "Cannot perform a jump scroll when there is no destination"); const s = o(e.dimensions.droppables[n], t); if (!s) { return; } const a = e.viewport; const c = i(e.isWindowScrollAllowed, a, s); if (!c) { return; } r(e, c); }; return s; }; var ht = ({scrollDroppable: e, scrollWindow: t, move: n}) => { const r = mt({ scrollWindow: t, scrollDroppable: e }); const o = bt({ move: n, scrollWindow: t, scrollDroppable: e }); const i = e => { if (e.phase !== "DRAGGING") { return; } if (e.movementMode === "FLUID") { r.scroll(e); return; } if (!e.scrollJumpRequest) { return; } o(e); }; const s = { scroll: i, start: r.start, stop: r.stop }; return s; }; var vt = (e, t) => { if (e.phase === "IDLE") { return true; } if (e.phase !== "DROP_ANIMATING") { return false; } if (e.completed.result.draggableId === t) { return false; } return e.completed.result.reason === "DROP"; }; const yt = e => e.type === "DROP_COMPLETE" || e.type === "DROP_ANIMATE" || e.type === "FLUSH"; var Dt = e => t => n => r => { if (yt(r)) { e.stop(); n(r); return; } if (r.type === "INITIAL_PUBLISH") { n(r); const o = t.getState(); K(o.phase === "DRAGGING", "Expected phase to be DRAGGING after INITIAL_PUBLISH"); e.start(o); return; } n(r); e.scroll(t.getState()); }; var It = e => () => t => n => { if (n.type === "DROP_COMPLETE" || n.type === "FLUSH" || n.type === "DROP_ANIMATE") { e.stopPublishing(); } t(n); }; var xt = e => t => n => { if (n.type !== "DROP_ANIMATION_FINISHED") { t(n); return; } const r = e.getState(); K(r.phase === "DROP_ANIMATING", "Cannot finish a drop animating when no drop is occurring"); e.dispatch(me({ completed: r.completed })); }; function Ct(e, t) { return { ...e, ...t }; } function wt(e, t, n) { const r = t.map((t => { const r = Ct(n, t.options); e.addEventListener(t.eventName, t.fn, r); return function n() { e.removeEventListener(t.eventName, t.fn, r); }; })); return function e() { r.forEach((e => { e(); })); }; } var Et = e => { let t = null; let n = null; function r() { if (n) { cancelAnimationFrame(n); n = null; } if (t) { t(); t = null; } } return o => i => { if (i.type === "FLUSH" || i.type === "DROP_COMPLETE" || i.type === "DROP_ANIMATION_FINISHED") { r(); } o(i); if (i.type !== "DROP_ANIMATE") { return; } const s = { eventName: "scroll", options: { capture: true, passive: false, once: true }, fn: function t() { const n = e.getState(); if (n.phase === "DROP_ANIMATING") { e.dispatch(ve()); } } }; n = requestAnimationFrame((() => { n = null; t = wt(window, [ s ]); })); }; }; function At(e) { if (e.at && e.at.type === "REORDER") { return e.at.destination; } return null; } function St(e) { if (e.at && e.at.type === "COMBINE") { return e.at.combine; } return null; } const Bt = { outOfTheWay: "cubic-bezier(0.2, 0, 0, 1)", drop: "cubic-bezier(.2,1,.1,1)" }; const Nt = { opacity: { drop: 0, combining: .7 }, scale: { drop: .75 } }; const Pt = { outOfTheWay: .2, minDropTime: .33, maxDropTime: .55 }; const Rt = `${Pt.outOfTheWay}s ${Bt.outOfTheWay}`; const Ot = { fluid: `opacity ${Rt}`, snap: `transform ${Rt}, opacity ${Rt}`, drop: e => { const t = `${e}s ${Bt.drop}`; return `transform ${t}, opacity ${t}`; }, outOfTheWay: `transform ${Rt}`, placeholder: `height ${Rt}, width ${Rt}, margin ${Rt}` }; const Tt = e => $e(e, Ge) ? undefined : `translate(${e.x}px, ${e.y}px)`; const Lt = { moveTo: Tt, drop: (e, t) => { const n = Tt(e); if (!n) { return undefined; } if (!t) { return n; } return `${n} scale(${Nt.scale.drop})`; } }; const {minDropTime: Gt, maxDropTime: Mt} = Pt; const _t = Mt - Gt; const $t = 1500; const Ft = .6; var kt = ({current: e, destination: t, reason: n}) => { const r = Ue(e, t); if (r <= 0) { return Gt; } if (r >= $t) { return Mt; } const o = r / $t; const i = Gt + _t * o; const s = n === "CANCEL" ? i * Ft : i; return Number(s.toFixed(2)); }; const Ut = { point: Ge, value: 0 }; const Wt = { invisible: {}, visible: {}, all: [] }; const Ht = { displaced: Wt, displacedBy: Ut, at: null }; var jt = Ht; const Vt = (e, t) => ({ top: e.top + t.y, left: e.left + t.x, bottom: e.bottom + t.y, right: e.right + t.x }); const qt = 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 } ]; const zt = { top: 0, right: 0, bottom: 0, left: 0 }; var Yt = e => { const t = Pe(e.top, e.bottom); const n = Pe(e.left, e.right); return r => { const o = t(r.top) && t(r.bottom) && n(r.left) && n(r.right); if (o) { return true; } const i = t(r.top) || t(r.bottom); const s = n(r.left) || n(r.right); const a = i && s; if (a) { return true; } const c = r.top < e.top && r.bottom > e.bottom; const l = r.left < e.left && r.right > e.right; const d = c && l; if (d) { return true; } const u = c && s || l && i; return u; }; }; var Jt = e => { const t = Pe(e.top, e.bottom); const n = Pe(e.left, e.right); return e => { const r = t(e.top) && t(e.bottom) && n(e.left) && n(e.right); return r; }; }; var Xt = e => t => { const n = Pe(t.top, t.bottom); const r = Pe(t.left, t.right); return t => { if (e === Ke) { return n(t.top) && n(t.bottom); } return r(t.left) && r(t.right); }; }; const Kt = (e, t) => { const n = t.frame ? t.frame.scroll.diff.displacement : Ge; return Vt(e, n); }; const Qt = (e, t, n) => { if (!t.subject.active) { return false; } return n(t.subject.active)(e); }; const Zt = (e, t, n) => n(t)(e); const en = ({target: e, destination: t, viewport: n, withDroppableDisplacement: r, isVisibleThroughFrameFn: o}) => { const i = r ? Kt(e, t) : e; return Qt(i, t, o) && Zt(i, n, o); }; const tn = e => en({ ...e, isVisibleThroughFrameFn: Yt }); const nn = e => en({ ...e, isVisibleThroughFrameFn: Jt }); const rn = e => en({ ...e, isVisibleThroughFrameFn: Xt(e.destination.axis) }); const on = (e, t, n) => { if (typeof n === "boolean") { return n; } if (!t) { return true; } const {invisible: r, visible: o} = t; if (r[e]) { return false; } const i = o[e]; return i ? i.shouldAnimate : true; }; function sn(e, t) { const n = e.page.marginBox; const r = { top: t.point.y, right: 0, bottom: 0, left: t.point.x }; return x(C(n, r)); } function an({afterDragging: e, destination: t, displacedBy: n, viewport: r, forceShouldAnimate: o, last: i}) { return e.reduce((function e(s, a) { const c = sn(a, n); const l = a.descriptor.id; s.all.push(l); const d = tn({ target: c, destination: t, viewport: r, withDroppableDisplacement: true }); if (!d) { s.invisible[a.descriptor.id] = true; return s; } const u = on(l, i, o); const p = { draggableId: l, shouldAnimate: u }; s.visible[l] = p; return s; }), { all: [], visible: {}, invisible: {} }); } function cn(e, t) { return e.map((e => t[e])); } var ln = ({impact: e, viewport: t, draggables: n, destination: r, forceShouldAnimate: o}) => { const i = e.displaced; const s = cn(i.all, n); const a = an({ afterDragging: s, destination: r, displacedBy: e.displacedBy, viewport: t.frame, forceShouldAnimate: o, last: i }); return { ...e, displaced: a }; }; var dn = ({draggables: e, reason: t, lastImpact: n, home: r, viewport: o, onLiftImpact: i}) => { if (!n.at || t !== "DROP") { const t = ln({ draggables: e, impact: i, destination: r, viewport: o, forceShouldAnimate: true }); return { impact: t, didDropInsideDroppable: false }; } if (n.at.type === "REORDER") { return { impact: n, didDropInsideDroppable: true }; } const s = { ...n, displaced: Wt }; return { impact: s, didDropInsideDroppable: true }; }; var un = (e, t) => { const n = e.frame; if (!n) { return t; } return Me(t, n.scroll.diff.displacement); }; function pn(e, t) { return Boolean(t.effected[e]); } var gn = ({displaced: e, afterCritical: t, combineWith: n, displacedBy: r}) => { const o = Boolean(e.visible[n] || e.invisible[n]); if (pn(n, t)) { return o ? Ge : Fe(r.point); } return o ? r.point : Ge; }; var fn = ({afterCritical: e, impact: t, draggables: n}) => { const r = St(t); K(r); const o = r.draggableId; const i = n[o].page.borderBox.center; const s = gn({ displaced: t.displaced, afterCritical: e, combineWith: o, displacedBy: t.displacedBy }); return Me(i, s); }; var mn = I(((e, t) => { const n = Ne(t).filter((t => e === t.descriptor.droppableId)).sort(((e, t) => e.descriptor.index - t.descriptor.index)); return n; })); const bn = (e, t) => t.margin[e.start] + t.borderBox[e.size] / 2; const hn = (e, t) => t.margin[e.end] + t.borderBox[e.size] / 2; const vn = (e, t, n) => t[e.crossAxisStart] + n.margin[e.crossAxisStart] + n.borderBox[e.crossAxisSize] / 2; const yn = ({axis: e, moveRelativeTo: t, isMoving: n}) => ke(e.line, t.marginBox[e.end] + bn(e, n), vn(e, t.marginBox, n)); const Dn = ({axis: e, moveRelativeTo: t, isMoving: n}) => ke(e.line, t.marginBox[e.start] - hn(e, n), vn(e, t.marginBox, n)); const In = ({axis: e, moveInto: t, isMoving: n}) => ke(e.line, t.contentBox[e.start] + bn(e, n), vn(e, t.contentBox, n)); var xn = ({impact: e, draggable: t, draggables: n, droppable: r, afterCritical: o}) => { const i = mn(r.descriptor.id, n); const s = t.page; const a = r.axis; if (!i.length) { return In({ axis: a, moveInto: r.page, isMoving: s }); } const {displaced: c, displacedBy: l} = e; const d = c.all[0]; if (d) { const e = n[d]; if (pn(d, o)) { return Dn({ axis: a, moveRelativeTo: e.page, isMoving: s }); } const t = w(e.page, l.point); return Dn({ axis: a, moveRelativeTo: t, isMoving: s }); } const u = i[i.length - 1]; if (u.descriptor.id === t.descriptor.id) { return s.borderBox.center; } if (pn(u.descriptor.id, o)) { const e = w(u.page, Fe(o.displacedBy.point)); return yn({ axis: a, moveRelativeTo: e, isMoving: s }); } return yn({ axis: a, moveRelativeTo: u.page, isMoving: s }); }; const Cn = ({impact: e, draggable: t, droppable: n, draggables: r, afterCritical: o}) => { const i = t.page.borderBox.center; const s = e.at; if (!n) { return i; } if (!s) { return i; } if (s.type === "REORDER") { return xn({ impact: e, draggable: t, draggables: r, droppable: n, afterCritical: o }); } return fn({ impact: e, draggables: r, afterCritical: o }); }; var wn = e => { const t = Cn(e); const n = e.droppable; const r = n ? un(n, t) : t; return r; }; var En = (e, t) => Me(e.scroll.diff.displacement, t); var An = ({pageBorderBoxCenter: e, draggable: t, viewport: n}) => { const r = En(n, e); const o = _e(r, t.page.borderBox.center); return Me(t.client.borderBox.center, o); }; var Sn = ({impact: e, draggable: t, droppable: n, draggables: r, viewport: o, afterCritical: i}) => { const s = wn({ impact: e, draggable: t, draggables: r, droppable: n, afterCritical: i }); return An({ pageBorderBoxCenter: s, draggable: t, viewport: o }); }; var Bn = ({impact: e, draggable: t, dimensions: n, viewport: r, afterCritical: o}) => { const {draggables: i, droppables: s} = n; const a = Ie(e); const c = a ? s[a] : null; const l = s[t.descriptor.droppableId]; const d = Sn({ impact: e, draggable: t, draggables: i, afterCritical: o, droppable: c || l, viewport: r }); const u = _e(d, t.client.borderBox.center); return u; }; var Nn = ({getState: e, dispatch: t}) => n => r => { if (r.type !== "DROP") { n(r); return; } const o = e(); const i = r.payload.reason; if (o.phase === "COLLECTING") { t(he({ reason: i })); return; } if (o.phase === "IDLE") { return; } const s = o.phase === "DROP_PENDING" && o.isWaiting; K(!s, "A DROP action occurred while DROP_PENDING and still waiting"); K(o.phase === "DRAGGING" || o.phase === "DROP_PENDING", `Cannot drop in phase: ${o.phase}`); const a = o; const c = a.critical; const l = o.dimensions; const d = l.draggables[a.critical.draggable.id]; const {impact: u, didDropInsideDroppable: p} = dn({ 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 }); const g = p ? At(u) : null; const f = p ? St(u) : null; const m = { index: c.draggable.index, droppableId: c.droppable.id }; const b = { draggableId: d.descriptor.id, type: d.descriptor.type, source: m, reason: i, mode: a.movementMode, destination: g, combine: f }; const h = Bn({ impact: u, draggable: d, dimensions: l, viewport: a.viewport, afterCritical: a.afterCritical }); const v = { critical: a.critical, afterCritical: a.afterCritical, result: b, impact: u }; const y = !$e(a.current.client.offset, h) || Boolean(b.combine); if (!y) { t(me({ completed: v })); return; } const D = kt({ current: a.current.client.offset, destination: h, reason: i }); const I = { newHomeClientOffset: h, dropDuration: D, completed: v }; t(fe(I)); }; var Pn = e => { let t = false; return () => n => r => { if (r.type === "INITIAL_PUBLISH") { t = true; e.tryRecordFocus(r.payload.critical.draggable.id); n(r); e.tryRestoreFocusRecorded(); return; } n(r); if (!t) { return; } if (r.type === "FLUSH") { t = false; e.tryRestoreFocusRecorded(); return; } if (r.type === "DROP_COMPLETE") { t = false; const n = r.payload.completed.result; if (n.combine) { e.tryShiftRecord(n.draggableId, n.combine.draggableId); } e.tryRestoreFocusRecorded(); } }; }; var Rn = e => ({getState: t, dispatch: n}) => r => o => { if (o.type !== "LIFT") { r(o); return; } const {id: i, clientSelection: s, movementMode: a} = o.payload; const c = t(); if (c.phase === "DROP_ANIMATING") { n(me({ completed: c.completed })); } K(t().phase === "IDLE", "Unexpected phase to start a drag"); n(ge()); n(Q({ draggableId: i, movementMode: a })); const l = { shouldPublishImmediately: a === "SNAP" }; const d = { draggableId: i, scrollOptions: l }; const {critical: u, dimensions: p, viewport: g} = e.startPublishing(d); n(ee({ critical: u, dimensions: p, clientSelection: s, movementMode: a, viewport: g })); }; var On = e => t => n => { t(n); if (n.type !== "PUBLISH_WHILE_DRAGGING") { return; } const r = e.getState(); if (r.phase !== "DROP_PENDING") { return; } if (r.isWaiting) { return; } e.dispatch(be({ reason: r.reason })); }; var Tn = () => { const e = []; const t = t => { const n = Ce(e, (e => e.timerId === t)); K(n !== -1, "Could not find timer"); const [r] = e.splice(n, 1); r.callback(); }; const n = n => { const r = setTimeout((() => t(r))); const o = { timerId: r, callback: n }; e.push(o); }; const r = () => { if (!e.length) { return; } const t = [ ...e ]; e.length = 0; t.forEach((e => { clearTimeout(e.timerId); e.callback(); })); }; return { add: n, flush: r }; }; var Ln = e => { let t = false; let n = false; const r = setTimeout((() => { n = true; })); const o = o => { if (t) { z("Announcement already made. Not making a second announcement"); return; } if (n) { z(`\n Announcements cannot be made asynchronously.\n Default message has already been announced.\n `); return; } t = true; e(o); clearTimeout(r); }; o.wasCalled = () => t; return o; }; const Gn = (e, t) => { if (!e && !t) { return true; } if (!e || !t) { return false; } return e.droppableId === t.droppableId && e.index === t.index; }; const Mn = (e, t) => { if (!e && !t) { return true; } if (!e || !t) { return false; } return e.draggableId === t.draggableId && e.droppableId === t.droppableId; }; const _n = (e, t) => { if (e === t) { return true; } 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; const r = e.droppable.id === t.droppable.id && e.droppable.type === t.droppable.type; return n && r; }; const $n = (e, t) => { t(); }; const Fn = (e, t) => ({ draggableId: e.draggable.id, type: e.droppable.type, source: { droppableId: e.droppable.id, index: e.draggable.index }, mode: t }); const kn = (e, t, n, r) => { if (!e) { n(r(t)); return; } const o = Ln(n); const i = { announce: o }; e(t, i); if (!o.wasCalled()) { n(r(t)); } }; var Un = (e, t) => { const n = Tn(); let r = null; const o = (t, n) => { K(!r, "Cannot fire onBeforeCapture as a drag start has already been published"); $n("onBeforeCapture", (() => { const r = e().onBeforeCapture; if (r) { const e = { draggableId: t, mode: n }; r(e); } })); }; const i = (t, n) => { K(!r, "Cannot fire onBeforeDragStart as a drag start has already been published"); $n("onBeforeDragStart", (() => { const r = e().onBeforeDragStart; if (r) { r(Fn(t, n)); } })); }; const s = (o, i) => { K(!r, "Cannot fire onBeforeDragStart as a drag start has already been published"); const s = Fn(o, i); r = { mode: i, lastCritical: o, lastLocation: s.source, lastCombine: null }; n.add((() => { $n("onDragStart", (() => kn(e().onDragStart, s, t, U.onDragStart))); })); }; const a = (o, i) => { const s = At(i); const a = St(i); K(r, "Cannot fire onDragMove when onDragStart has not been called"); const c = !_n(o, r.lastCritical); if (c) { r.lastCritical = o; } const l = !Gn(r.lastLocation, s); if (l) { r.lastLocation = s; } const d = !Mn(r.lastCombine, a); if (d) { r.lastCombine = a; } if (!c && !l && !d) { return; } const u = { ...Fn(o, r.mode), combine: a, destination: s }; n.add((() => { $n("onDragUpdate", (() => kn(e().onDragUpdate, u, t, U.onDragUpdate))); })); }; const c = () => { K(r, "Can only flush responders while dragging"); n.flush(); }; const l = n => { K(r, "Cannot fire onDragEnd when there is no matching onDragStart"); r = null; $n("onDragEnd", (() => kn(e().onDragEnd, n, t, U.onDragEnd))); }; const d = () => { if (!r) { return; } const e = { ...Fn(r.lastCritical, r.mode), combine: null, destination: null, reason: "CANCEL" }; l(e); }; return { beforeCapture: o, beforeStart: i, start: s, update: a, flush: c, drop: l, abort: d }; }; var Wn = (e, t) => { const n = Un(e, t); return e => t => r => { if (r.type === "BEFORE_INITIAL_CAPTURE") { n.beforeCapture(r.payload.draggableId, r.payload.movementMode); return; } if (r.type === "INITIAL_PUBLISH") { const e = r.payload.critical; n.beforeStart(e, r.payload.movementMode); t(r); n.start(e, r.payload.movementMode); return; } if (r.type === "DROP_COMPLETE") { const e = r.payload.completed.result; n.flush(); t(r); n.drop(e); return; } t(r); if (r.type === "FLUSH") { n.abort(); return; } const o = e.getState(); if (o.phase === "DRAGGING") { n.update(o.critical, o.impact); } }; }; function Hn() {} var jn = () => ({ x: window.pageXOffset, y: window.pageYOffset }); function Vn(e) { return { eventName: "scroll", options: { passive: true, capture: false }, fn: t => { if (t.target !== window && t.target !== window.document) { return; } e(); } }; } function qn({onWindowScroll: e}) { function t() { e(jn()); } const n = D(t); const r = Vn(n); let o = Hn; function i() { return o !== Hn; } function s() { K(!i(), "Cannot start scroll listener when already active"); o = wt(window, [ r ]); } function a() { K(i(), "Cannot stop scroll listener when not active"); n.cancel(); o(); o = Hn; } return { start: s, stop: a, isActive: i }; } const zn = e => e.type === "DROP_COMPLETE" || e.type === "DROP_ANIMATE" || e.type === "FLUSH"; var Yn = e => { const t = qn({ onWindowScroll: t => { e.dispatch(ae({ newScroll: t })); } }); return e => n => { if (!t.isActive() && n.type === "INITIAL_PUBLISH") { t.start(); } if (t.isActive() && zn(n)) { t.stop(); } e(n); }; }; var Jn = e => () => t => n => { if (n.type === "INITIAL_PUBLISH") { e.dragging(); } if (n.type === "DROP_ANIMATE") { e.dropping(n.payload.completed.result.reason); } if (n.type === "FLUSH" || n.type === "DROP_COMPLETE") { e.resting(); } t(n); }; const Xn = e => e.isDragging; var Kn = (e, t) => { const n = x({ 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) }); if (n.width <= 0 || n.height <= 0) { return null; } return n; }; const Qn = (e, t) => { if (!t) { return e; } return Vt(e, t.scroll.diff.displacement); }; const Zn = (e, t, n) => { if (n && n.increasedBy) { return { ...e, [t.end]: e[t.end] + n.increasedBy[t.line] }; } return e; }; const er = (e, t) => { if (t && t.shouldClipSubject) { return Kn(t.pageMarginBox, e); } return x(e); }; var tr = ({page: e, withPlaceholder: t, axis: n, frame: r}) => { const o = Qn(e.marginBox, r); const i = Zn(o, n, t); const s = er(i, r); return { page: e, withPlaceholder: t, active: s }; }; var nr = (e, t) => { K(e.frame); const n = e.frame; const r = _e(t, n.scroll.initial); const o = Fe(r); const i = { ...n, scroll: { initial: n.scroll.initial, current: t, diff: { value: r, displacement: o }, max: n.scroll.max } }; const s = tr({ page: e.subject.page, withPlaceholder: e.subject.withPlaceholder, axis: e.axis, frame: i }); const a = { ...e, frame: i, subject: s }; return a; }; var rr = I((function e(t, n) { const r = n[t.line]; return { value: r, point: ke(t.line, r) }; })); var or = e => ({ index: e.index, droppableId: e.droppableId }); var ir = ({draggable: e, home: t, draggables: n, viewport: r}) => { const o = rr(t.axis, e.displaceBy); const i = mn(t.descriptor.id, n); const s = i.indexOf(e); K(s !== -1, "Expected draggable to be inside home list"); const a = i.slice(s + 1); const c = a.reduce(((e, t) => { e[t.descriptor.id] = true; return e; }), {}); const l = { inVirtualList: t.descriptor.mode === "virtual", displacedBy: o, effected: c }; const d = an({ afterDragging: a, destination: t, displacedBy: o, last: null, viewport: r.frame, forceShouldAnimate: false }); const u = { displaced: d, displacedBy: o, at: { type: "REORDER", destination: or(e.descriptor) } }; return { impact: u, afterCritical: l }; }; function sr(e) { return e.phase === "DRAGGING" || e.phase === "COLLECTING"; } const ar = e => { const t = e.subject.active; K(t, "Cannot get clipped area from droppable"); return t; }; var cr = ({isMovingForward: e, pageBorderBoxCenter: t, source: n, droppables: r, viewport: o}) => { const i = n.subject.active; if (!i) { return null; } const s = n.axis; const a = Pe(i[s.start], i[s.end]); const c = Be(r).filter((e => e !== n)).filter((e => e.isEnabled)).filter((e => Boolean(e.subject.active))).filter((e => Yt(o.frame)(ar(e)))).filter((t => { const n = ar(t); if (e) { return i[s.crossAxisEnd] < n[s.crossAxisEnd]; } return n[s.crossAxisStart] < i[s.crossAxisStart]; })).filter((e => { const t = ar(e); const n = Pe(t[s.start], t[s.end]); return a(t[s.start]) || a(t[s.end]) || n(i[s.start]) || n(i[s.end]); })).sort(((t, n) => { const r = ar(t)[s.crossAxisStart]; const o = ar(n)[s.crossAxisStart]; if (e) { return r - o; } return o - r; })).filter(((e, t, n) => ar(e)[s.crossAxisStart] === ar(n[0])[s.crossAxisStart])); if (!c.length) { return null; } if (c.length === 1) { return c[0]; } const l = c.filter((e => { const n = Pe(ar(e)[s.start], ar(e)[s.end]); return n(t[s.line]); })); if (l.length === 1) { return l[0]; } if (l.length > 1) { return l.sort(((e, t) => ar(e)[s.start] - ar(t)[s.start]))[0]; } return c.sort(((e, n) => { const r = We(t, qt(ar(e))); const o = We(t, qt(ar(n))); if (r !== o) { return r - o; } return ar(e)[s.start] - ar(n)[s.start]; }))[0]; }; const lr = (e, t) => { const n = e.page.borderBox.center; return pn(e.descriptor.id, t) ? _e(n, t.displacedBy.point) : n; }; const dr = (e, t) => { const n = e.page.borderBox; return pn(e.descriptor.id, t) ? Vt(n, Fe(t.displacedBy.point)) : n; }; var ur = ({pageBorderBoxCenter: e, viewport: t, destination: n, insideDestination: r, afterCritical: o}) => { const i = r.filter((e => nn({ target: dr(e, o), destination: n, viewport: t.frame, withDroppableDisplacement: true }))).sort(((t, r) => { const i = Ue(e, un(n, lr(t, o))); const s = Ue(e, un(n, lr(r, o))); if (i < s) { return -1; } if (s < i) { return 1; } return t.descriptor.index - r.descriptor.index; })); return i[0] || null; }; var pr = (e, t) => e.descriptor.droppableId === t.descriptor.id; var gr = I(((e, t) => t.filter((t => t.descriptor.id !== e.descriptor.id)))); function fr(e, t) { if (!e.length) { return 0; } const n = e[e.length - 1].descriptor.index; return t.inHomeList ? n : n + 1; } function mr({insideDestination: e, inHomeList: t, displacedBy: n, destination: r}) { const o = fr(e, { inHomeList: t }); return { displaced: Wt, displacedBy: n, at: { type: "REORDER", destination: { droppableId: r.descriptor.id, index: o } } }; } function br({draggable: e, insideDestination: t, destination: n, viewport: r, displacedBy: o, last: i, index: s, forceShouldAnimate: a}) { const c = pr(e, n); if (s === null) { return mr({ insideDestination: t, inHomeList: c, displacedBy: o, destination: n }); } const l = we(t, (e => e.descriptor.index === s)); if (!l) { return mr({ insideDestination: t, inHomeList: c, displacedBy: o, destination: n }); } const d = gr(e, t); const u = t.indexOf(l); const p = d.slice(u); const g = an({ afterDragging: p, destination: n, displacedBy: o, last: i, viewport: r.frame, forceShouldAnimate: a }); return { displaced: g, displacedBy: o, at: { type