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1Bd,EAAOC,QAJP,SAAwBmB,GACtB,IAAIvD,EAAMiD,EAAYM,EAAK,UAC3B,MAAwB,WAAjBX,EAAQ5C,GAAoBA,EAAMqD,OAAOrD,EAClD,EACiCmC,EAAOC,QAAQO,YAAa,EAAMR,EAAOC,QAAiB,QAAID,EAAOC,O,WCNtG,SAASQ,EAAQY,GAGf,OAAQrB,EAAOC,QAAUQ,EAAU,mBAAqBI,QAAU,iBAAmBA,OAAOS,SAAW,SAAUD,GAC/G,cAAcA,CAChB,EAAI,SAAUA,GACZ,OAAOA,GAAK,mBAAqBR,QAAUQ,EAAEtG,cAAgB8F,QAAUQ,IAAMR,OAAOU,UAAY,gBAAkBF,CACpH,EAAGrB,EAAOC,QAAQO,YAAa,EAAMR,EAAOC,QAAiB,QAAID,EAAOC,QAAUQ,EAAQY,EAC5F,CACArB,EAAOC,QAAUQ,EAAST,EAAOC,QAAQO,YAAa,EAAMR,EAAOC,QAAiB,QAAID,EAAOC,O","sources":["../node_modules/react-sortablejs/dist/src/util.ts","../node_modules/react-sortablejs/dist/src/react-sortable.tsx","../node_modules/tiny-invariant/dist/tiny-invariant.esm.js","../node_modules/@babel/runtime/helpers/defineProperty.js","../node_modules/@babel/runtime/helpers/toPrimitive.js","../node_modules/@babel/runtime/helpers/toPropertyKey.js","../node_modules/@babel/runtime/helpers/typeof.js"],"sourcesContent":["import { PropsWithChildren } from \"react\";\nimport Sortable, { Options } from \"sortablejs\";\nimport { MultiDragEvent } from \"./react-sortable\";\nimport { AllMethodNames, ItemInterface, ReactSortableProps } from \"./types\";\n\n/**\n * Removes the `node` from the DOM\n * @param node\n */\nexport function removeNode(node: HTMLElement): void {\n if (node.parentElement !== null) node.parentElement.removeChild(node);\n}\n\n/**\n * Inserts the `newChild` node at the given index in a parent\n * @param parent The parent HTML Element.\n * @param newChild A HTML eement to add as a child of the parent.\n * @param index index of the parent to place the new child in.\n */\nexport function insertNodeAt(\n parent: HTMLElement,\n newChild: HTMLElement,\n index: number\n): void {\n const refChild = parent.children[index] || null;\n parent.insertBefore(newChild, refChild);\n}\n\n// @todo - create a dom handler function for arrays or not at all\n\n/** removes stuff from the dom in a nice order */\n// @todo - do I need parenElement?\nexport function handleDOMChanges<T extends ItemInterface>(\n customs: Normalized<T>[]\n): void {\n removeNodes(customs);\n insertNodes(customs);\n}\n\nexport function removeNodes<T extends ItemInterface>(\n customs: Normalized<T>[]\n): void {\n customs.forEach((curr) => removeNode(curr.element));\n}\n\nexport function insertNodes<T extends ItemInterface>(\n customs: Normalized<T>[]\n): void {\n customs.forEach((curr) => {\n insertNodeAt(curr.parentElement, curr.element, curr.oldIndex);\n });\n}\n\nexport function createCustoms<T extends ItemInterface>(\n evt: MultiDragEvent,\n list: T[]\n): Normalized<T>[] {\n const mode = getMode(evt);\n const parentElement = { parentElement: evt.from };\n let custom = [];\n switch (mode) {\n case \"normal\":\n /* eslint-disable */\n const item = {\n element: evt.item,\n newIndex: evt.newIndex!,\n oldIndex: evt.oldIndex!,\n parentElement: evt.from,\n };\n custom = [item];\n break;\n case \"swap\":\n const drag: Input = {\n element: evt.item,\n oldIndex: evt.oldIndex!,\n newIndex: evt.newIndex!,\n ...parentElement,\n };\n const swap: Input = {\n element: evt.swapItem!,\n oldIndex: evt.newIndex!,\n newIndex: evt.oldIndex!,\n ...parentElement,\n };\n custom = [drag, swap];\n break;\n case \"multidrag\":\n custom = evt.oldIndicies.map<Input>((curr, index) => ({\n element: curr.multiDragElement,\n oldIndex: curr.index,\n newIndex: evt.newIndicies[index].index,\n ...parentElement,\n }));\n break;\n }\n /* eslint-enable */\n\n const customs = createNormalized(custom, list);\n return customs;\n}\n\n/** moves items form old index to new index without breaking anything ideally. */\nexport function handleStateChanges<T extends ItemInterface>(\n normalized: Normalized<T>[],\n list: T[]\n): T[] {\n const a = handleStateRemove(normalized, list);\n const b = handleStateAdd(normalized, a);\n return b;\n}\n\nexport function handleStateRemove<T extends ItemInterface>(\n normalized: Normalized<T>[],\n list: T[]\n): T[] {\n const newList = [...list];\n normalized\n .concat()\n .reverse()\n .forEach((curr) => newList.splice(curr.oldIndex, 1));\n return newList;\n}\n\nexport function handleStateAdd<T extends ItemInterface>(\n normalized: Normalized<T>[],\n list: T[],\n evt?: Sortable.SortableEvent,\n clone?: ((currentItem: T, evt: Sortable.SortableEvent) => T) | undefined\n): T[] {\n const newList = [...list];\n normalized.forEach((curr) => {\n const newItem = clone && evt && clone(curr.item, evt);\n newList.splice(curr.newIndex, 0, newItem || curr.item);\n });\n return newList;\n}\n\nexport function getMode(evt: MultiDragEvent): \"multidrag\" | \"swap\" | \"normal\" {\n if (evt.oldIndicies && evt.oldIndicies.length > 0) return \"multidrag\";\n if (evt.swapItem) return \"swap\";\n return \"normal\";\n}\n\nexport function createNormalized<T extends ItemInterface>(\n inputs: Input[],\n list: T[]\n): Normalized<T>[] {\n const normalized = inputs\n .map<Normalized<T>>((curr) => ({ ...curr, item: list[curr.oldIndex] }))\n .sort((a, b) => a.oldIndex - b.oldIndex);\n return normalized;\n}\n\nexport interface Input {\n parentElement: HTMLElement;\n element: HTMLElement;\n oldIndex: number;\n newIndex: number;\n}\n\nexport interface Normalized<T> extends Input {\n item: T;\n}\n\n/**\n * Removes the following group of properties from `props`,\n * leaving only `Sortable.Options` without any `on` methods.\n * @param props `ReactSortable.Props`\n */\nexport function destructurePropsForOptions<T>(\n props: PropsWithChildren<ReactSortableProps<T>>\n): Exclude<Options, AllMethodNames> {\n /* eslint-disable */\n const {\n // react sortable props\n list,\n setList,\n children,\n tag,\n style,\n className,\n clone,\n // sortable options that have methods we want to overwrite\n onAdd,\n onChange,\n onChoose,\n onClone,\n onEnd,\n onFilter,\n onRemove,\n onSort,\n onStart,\n onUnchoose,\n onUpdate,\n onMove,\n onSpill,\n onSelect,\n onDeselect,\n ...options\n } = props;\n /* eslint-enable */\n return options;\n}\n\n/**\n * Construct a type with the properties of T except for those in type K.\n * Including this allows for backwards compatibility with earlier versions of TS.\n */\nexport type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;\n","import classNames from \"classnames\";\nimport {\n Children,\n cloneElement,\n Component,\n createElement,\n createRef,\n ReactElement,\n RefObject,\n} from \"react\";\nimport Sortable, { MoveEvent, Options, SortableEvent } from \"sortablejs\";\nimport invariant from \"tiny-invariant\";\nimport {\n AllMethodsExceptMove,\n HandledMethodNames,\n ItemInterface,\n ReactSortableProps,\n Store,\n UnHandledMethodNames,\n} from \"./types\";\nimport {\n createCustoms,\n destructurePropsForOptions,\n getMode,\n handleStateAdd,\n handleStateChanges,\n handleStateRemove,\n insertNodes,\n removeNode,\n removeNodes,\n} from \"./util\";\n\n/** Holds a global reference for which react element is being dragged */\n// @todo - use context to manage this. How does one use 2 different providers?\nconst store: Store = { dragging: null };\n\nexport class ReactSortable<T extends ItemInterface> extends Component<\n ReactSortableProps<T>\n> {\n /* eslint-disable-next-line */\n static defaultProps: Partial<ReactSortableProps<any>> = {\n clone: (item) => item,\n };\n\n private ref: RefObject<HTMLElement>;\n constructor(props: ReactSortableProps<T>) {\n super(props);\n // @todo forward ref this component\n this.ref = createRef<HTMLElement>();\n\n // make all state false because we can't change sortable unless a mouse gesture is made.\n const newList = [...props.list].map((item) =>\n Object.assign(item, {\n chosen: false,\n selected: false,\n })\n );\n\n props.setList(newList, this.sortable, store);\n invariant(\n //@ts-expect-error: Doesn't exist. Will deprecate soon.\n !props.plugins,\n `\nPlugins prop is no longer supported.\nInstead, mount it with \"Sortable.mount(new MultiDrag())\"\nPlease read the updated README.md at https://github.com/SortableJS/react-sortablejs.\n `\n );\n }\n\n componentDidMount(): void {\n if (this.ref.current === null) return;\n const newOptions = this.makeOptions();\n Sortable.create(this.ref.current, newOptions);\n }\n\n componentDidUpdate(prevProps: ReactSortableProps<T>): void {\n if (prevProps.disabled !== this.props.disabled && this.sortable) {\n this.sortable.option(\"disabled\", this.props.disabled);\n }\n }\n\n render(): JSX.Element {\n const { tag, style, className, id } = this.props;\n const classicProps = { style, className, id };\n\n // if no tag, default to a `div` element.\n const newTag = !tag || tag === null ? \"div\" : tag;\n return createElement(\n newTag,\n {\n // @todo - find a way (perhaps with the callback) to allow AntD components to work\n ref: this.ref,\n ...classicProps,\n },\n this.getChildren()\n );\n }\n\n private getChildren() {\n const {\n children,\n dataIdAttr,\n selectedClass = \"sortable-selected\",\n chosenClass = \"sortable-chosen\",\n /* eslint-disable */\n dragClass = \"sortable-drag\",\n fallbackClass = \"sortable-falback\",\n ghostClass = \"sortable-ghost\",\n swapClass = \"sortable-swap-highlight\",\n /* eslint-enable */\n filter = \"sortable-filter\",\n list,\n } = this.props;\n\n // if no children, don't do anything.\n if (!children || children == null) return null;\n const dataid = dataIdAttr || \"data-id\";\n /* eslint-disable-next-line */\n return Children.map(children as ReactElement<any>[], (child, index) => {\n if (child === undefined) return undefined;\n\n const item = list[index] || {};\n const { className: prevClassName } = child.props;\n\n // @todo - handle the function if avalable. I don't think anyone will be doing this soon.\n const filtered = typeof filter === \"string\" && {\n [filter.replace(\".\", \"\")]: !!item.filtered,\n };\n\n const className = classNames(prevClassName, {\n [selectedClass]: item.selected,\n [chosenClass]: item.chosen,\n ...filtered,\n // [dragClass]: true,\n // [fallbackClass]: true,\n // [ghostClass]: true,\n // [swapClass]: true\n });\n\n return cloneElement(child, {\n [dataid]: child.key,\n className,\n });\n });\n }\n\n /** Appends the `sortable` property to this component */\n private get sortable(): Sortable | null {\n const el = this.ref.current;\n if (el === null) return null;\n const key = Object.keys(el).find((k) => k.includes(\"Sortable\"));\n if (!key) return null;\n //@ts-expect-error: fix me.\n return el[key] as Sortable;\n }\n\n /** Converts all the props from `ReactSortable` into the `options` object that `Sortable.create(el, [options])` can use. */\n makeOptions(): Options {\n const DOMHandlers: HandledMethodNames[] = [\n \"onAdd\",\n \"onChoose\",\n \"onDeselect\",\n \"onEnd\",\n \"onRemove\",\n \"onSelect\",\n \"onSpill\",\n \"onStart\",\n \"onUnchoose\",\n \"onUpdate\",\n ];\n const NonDOMHandlers: UnHandledMethodNames[] = [\n \"onChange\",\n \"onClone\",\n \"onFilter\",\n \"onSort\",\n ];\n const newOptions: Options = destructurePropsForOptions(this.props);\n DOMHandlers.forEach(\n (name) => (newOptions[name] = this.prepareOnHandlerPropAndDOM(name))\n );\n NonDOMHandlers.forEach(\n (name) => (newOptions[name] = this.prepareOnHandlerProp(name))\n );\n\n /** onMove has 2 arguments and needs to be handled seperately. */\n const onMove = (evt: MoveEvent, originalEvt: Event) => {\n const { onMove } = this.props;\n const defaultValue = evt.willInsertAfter || -1;\n if (!onMove) return defaultValue;\n const result = onMove(evt, originalEvt, this.sortable, store);\n if (typeof result === \"undefined\") return false;\n return result;\n };\n\n return {\n ...newOptions,\n onMove,\n };\n }\n\n /** Prepares a method that will be used in the sortable options to call an `on[Handler]` prop & an `on[Handler]` ReactSortable method. */\n prepareOnHandlerPropAndDOM(\n evtName: HandledMethodNames\n ): (evt: SortableEvent) => void {\n return (evt) => {\n // call the component prop\n this.callOnHandlerProp(evt, evtName);\n // calls state change\n //@ts-expect-error: until @types multidrag item is in\n this[evtName](evt);\n };\n }\n\n /** Prepares a method that will be used in the sortable options to call an `on[Handler]` prop */\n prepareOnHandlerProp(\n evtName: Exclude<AllMethodsExceptMove, HandledMethodNames>\n ): (evt: SortableEvent) => void {\n return (evt) => {\n // call the component prop\n this.callOnHandlerProp(evt, evtName);\n };\n }\n\n /** Calls the `props.on[Handler]` function */\n callOnHandlerProp(evt: SortableEvent, evtName: AllMethodsExceptMove): void {\n const propEvent = this.props[evtName];\n if (propEvent) propEvent(evt, this.sortable, store);\n }\n\n // SORTABLE DOM HANDLING\n\n onAdd(evt: MultiDragEvent): void {\n const { list, setList, clone } = this.props;\n /* eslint-disable-next-line */\n const otherList = [...store.dragging!.props.list];\n const customs = createCustoms(evt, otherList);\n removeNodes(customs);\n\n const newList = handleStateAdd(customs, list, evt, clone).map((item) =>\n Object.assign(item, {\n selected: false,\n })\n );\n\n setList(newList, this.sortable, store);\n }\n\n onRemove(evt: MultiDragEvent): void {\n const { list, setList } = this.props;\n const mode = getMode(evt);\n const customs = createCustoms(evt, list);\n insertNodes(customs);\n\n let newList = [...list];\n // remove state if not in clone mode. otherwise, keep.\n if (evt.pullMode !== \"clone\") newList = handleStateRemove(customs, newList);\n // if clone, it doesn't really remove. instead it clones in place.\n // @todo -\n else {\n // switch used to get the clone\n let customClones = customs;\n switch (mode) {\n case \"multidrag\":\n customClones = customs.map((item, index) => ({\n ...item,\n element: evt.clones[index],\n }));\n break;\n case \"normal\":\n customClones = customs.map((item) => ({\n ...item,\n element: evt.clone,\n }));\n break;\n case \"swap\":\n default: {\n invariant(\n true,\n `mode \"${mode}\" cannot clone. Please remove \"props.clone\" from <ReactSortable/> when using the \"${mode}\" plugin`\n );\n }\n }\n removeNodes(customClones);\n\n // replace selected items with cloned items\n customs.forEach((curr) => {\n const index = curr.oldIndex;\n /* eslint-disable-next-line */\n const newItem = this.props.clone!(curr.item, evt);\n newList.splice(index, 1, newItem);\n });\n }\n\n // remove item.selected from list\n newList = newList.map((item: T) =>\n Object.assign(item, {\n selected: false,\n })\n );\n\n setList(newList, this.sortable, store);\n }\n\n onUpdate(evt: MultiDragEvent): void {\n const { list, setList } = this.props;\n const customs = createCustoms(evt, list);\n removeNodes(customs);\n insertNodes(customs);\n const newList = handleStateChanges(customs, list);\n return setList(newList, this.sortable, store);\n }\n\n onStart(): void {\n store.dragging = this;\n }\n\n onEnd(): void {\n store.dragging = null;\n }\n\n onChoose(evt: SortableEvent): void {\n const { list, setList } = this.props;\n const newList = list.map((item, index) => {\n let newItem = item;\n if (index === evt.oldIndex) {\n newItem = Object.assign(item, {\n chosen: true,\n });\n }\n return newItem;\n });\n setList(newList, this.sortable, store);\n }\n\n onUnchoose(evt: SortableEvent): void {\n const { list, setList } = this.props;\n const newList = list.map((item, index) => {\n let newItem = item;\n if (index === evt.oldIndex) {\n newItem = Object.assign(newItem, {\n chosen: false,\n });\n }\n return newItem;\n });\n setList(newList, this.sortable, store);\n }\n\n onSpill(evt: SortableEvent): void {\n const { removeOnSpill, revertOnSpill } = this.props;\n if (removeOnSpill && !revertOnSpill) removeNode(evt.item);\n }\n\n onSelect(evt: MultiDragEvent): void {\n const { list, setList } = this.props;\n const newList = list.map((item) =>\n Object.assign(item, {\n selected: false,\n })\n );\n\n evt.newIndicies.forEach((curr) => {\n const index = curr.index;\n if (index === -1) {\n console.log(\n `\"${evt.type}\" had indice of \"${curr.index}\", which is probably -1 and doesn't usually happen here.`\n );\n console.log(evt);\n return;\n }\n newList[index].selected = true;\n });\n setList(newList, this.sortable, store);\n }\n\n onDeselect(evt: MultiDragEvent): void {\n const { list, setList } = this.props;\n const newList = list.map((item) =>\n Object.assign(item, {\n selected: false,\n })\n );\n evt.newIndicies.forEach((curr) => {\n const index = curr.index;\n if (index === -1) return;\n newList[index].selected = true;\n });\n setList(newList, this.sortable, store);\n }\n}\n\n// everything below this point can be removed\n// once @types has been merged. PR submited\ninterface MultiIndices {\n multiDragElement: HTMLElement;\n index: number;\n}\n\nexport interface MultiDragEvent extends SortableEvent {\n // @todo - add this to @types\n clones: HTMLElement[];\n oldIndicies: MultiIndices[];\n newIndicies: MultiIndices[];\n swapItem: HTMLElement | null;\n}\n","var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? prefix + \": \" + provided : prefix;\n throw new Error(value);\n}\n\nexport { invariant as default };\n","var toPropertyKey = require(\"./toPropertyKey.js\");\nfunction _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nfunction _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\nmodule.exports = _toPrimitive, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\nvar toPrimitive = require(\"./toPrimitive.js\");\nfunction _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}\nmodule.exports = _toPropertyKey, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;"],"names":["$eb03e74f8f7db1f3$export$1d0aa160432dfea5","node","parentElement","removeChild","$eb03e74f8f7db1f3$export$77f49a256021c8de","customs","forEach","curr","element","$eb03e74f8f7db1f3$export$a6177d5829f70ebc","parent","newChild","index","refChild","children","insertBefore","$eb03e74f8f7db1f3$export$6d240faa51aa562f","oldIndex","$eb03e74f8f7db1f3$export$4655efe700f887a","evt","list","mode","$eb03e74f8f7db1f3$export$1fc0f6205829e19c","from","custom","item","newIndex","swapItem","oldIndicies","map","multiDragElement","newIndicies","inputs","normalized","sort","a","b","$eb03e74f8f7db1f3$export$bc06a3af7dc65f53","$eb03e74f8f7db1f3$export$c25cf8080bd305ec","$eb03e74f8f7db1f3$export$eca851ee65ae17e4","$eb03e74f8f7db1f3$export$be2da95e6167b0bd","newList","concat","reverse","splice","clone","newItem","length","$eb03e74f8f7db1f3$export$7553c81e62e31b7e","props","setList","tag","style","className","onAdd","onChange","onChoose","onClone","onEnd","onFilter","onRemove","onSort","onStart","onUnchoose","onUpdate","onMove","onSpill","onSelect","onDeselect","options","$7fe8e3ea572bda7a$var$store","dragging","$7fe8e3ea572bda7a$export$11bbed9ee0012c13","$8zHUo$react","Component","constructor","super","this","ref","createRef","Object","assign","chosen","selected","sortable","$parcel$interopDefault","$8zHUo$tinyinvariant","plugins","componentDidMount","current","newOptions","makeOptions","$8zHUo$sortablejs","create","componentDidUpdate","prevProps","disabled","option","render","id","classicProps","newTag","createElement","getChildren","dataIdAttr","selectedClass","chosenClass","dragClass","fallbackClass","ghostClass","swapClass","filter","dataid","Children","child","undefined","prevClassName","filtered","replace","$8zHUo$classnames","cloneElement","key","el","keys","find","k","includes","name","prepareOnHandlerPropAndDOM","prepareOnHandlerProp","onMove1","originalEvt","defaultValue","willInsertAfter","result","evtName","callOnHandlerProp","propEvent","pullMode","customClones","clones","removeOnSpill","revertOnSpill","console","log","type","_defineProperty","isProduction","process","prefix","invariant","condition","message","Error","provided","toPropertyKey","module","exports","obj","value","defineProperty","enumerable","configurable","writable","__esModule","_typeof","input","hint","prim","Symbol","toPrimitive","res","call","TypeError","String","Number","arg","o","iterator","prototype"],"sourceRoot":""}