(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["9027"],{94697:function(e,t,r){"use strict";r.d(t,{Ai:()=>e2,Cj:()=>eq,Dy:()=>I,LB:()=>eW,Lg:()=>ep,O1:()=>eU,VK:()=>U,VT:()=>O,Zj:()=>e_,_8:()=>j,ey:()=>Y,g4:()=>m,hI:()=>K,pE:()=>B,we:()=>ey,y9:()=>e3});var n,i,l,o,s,a,u,c,d,h,p,f,m,g,v,y,b,w,x,k=r(98661),S=r(24285),C=r(42617);let E=(0,k.createContext)(null),M={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},R={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function D(e){let{announcements:t=R,container:r,hiddenTextDescribedById:n,screenReaderInstructions:i=M}=e,{announce:l,announcement:o}=(0,C.qg)(),s=(0,S.Ld)("DndLiveRegion"),[a,u]=(0,k.useState)(!1);if((0,k.useEffect)(()=>{u(!0)},[]),!function(e){let t=(0,k.useContext)(E);(0,k.useEffect)(()=>{if(!t)throw Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}((0,k.useMemo)(()=>({onDragStart(e){let{active:r}=e;l(t.onDragStart({active:r}))},onDragMove(e){let{active:r,over:n}=e;t.onDragMove&&l(t.onDragMove({active:r,over:n}))},onDragOver(e){let{active:r,over:n}=e;l(t.onDragOver({active:r,over:n}))},onDragEnd(e){let{active:r,over:n}=e;l(t.onDragEnd({active:r,over:n}))},onDragCancel(e){let{active:r,over:n}=e;l(t.onDragCancel({active:r,over:n}))}}),[l,t])),!a)return null;let c=k.default.createElement(k.default.Fragment,null,k.default.createElement(C.Mv,{id:n,value:i.draggable}),k.default.createElement(C.LE,{id:s,announcement:o}));return r?(0,k.createPortal)(c,r):c}function N(){}function O(e,t){return(0,k.useMemo)(()=>({sensor:e,options:null!=t?t:{}}),[e,t])}function I(){for(var e=arguments.length,t=Array(e),r=0;r[...t].filter(e=>null!=e),[...t])}(n=h||(h={})).DragStart="dragStart",n.DragMove="dragMove",n.DragEnd="dragEnd",n.DragCancel="dragCancel",n.DragOver="dragOver",n.RegisterDroppable="registerDroppable",n.SetDroppableDisabled="setDroppableDisabled",n.UnregisterDroppable="unregisterDroppable";let T=Object.freeze({x:0,y:0});function A(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function L(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function z(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function J(e){let{left:t,top:r,height:n,width:i}=e;return[{x:t,y:r},{x:t+i,y:r},{x:t,y:r+n},{x:t+i,y:r+n}]}function j(e,t){if(!e||0===e.length)return null;let[r]=e;return t?r[t]:r}function F(e,t,r){return void 0===t&&(t=e.left),void 0===r&&(r=e.top),{x:t+.5*e.width,y:r+.5*e.height}}let B=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=F(t,t.left,t.top),l=[];for(let e of n){let{id:t}=e,n=r.get(t);if(n){let r=A(F(n),i);l.push({id:t,data:{droppableContainer:e,value:r}})}}return l.sort(L)},Y=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=J(t),l=[];for(let e of n){let{id:t}=e,n=r.get(t);if(n){let r=J(n),o=Number((i.reduce((e,t,n)=>e+A(r[n],t),0)/4).toFixed(4));l.push({id:t,data:{droppableContainer:e,value:o}})}}return l.sort(L)},H=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e,i=[];for(let e of n){let{id:n}=e,l=r.get(n);if(l){let r=function(e,t){let r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height);if(n0&&i.push({id:n,data:{droppableContainer:e,value:r}})}}return i.sort(z)};function P(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:T}let W=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n({...e,top:e.top+ +t.y,bottom:e.bottom+ +t.y,left:e.left+ +t.x,right:e.right+ +t.x}),{...e})};function X(e){if(e.startsWith("matrix3d(")){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}let $={ignoreTransform:!1};function U(e,t){void 0===t&&(t=$);let r=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:n}=(0,S.Jj)(e).getComputedStyle(e);t&&(r=function(e,t,r){let n=X(t);if(!n)return e;let{scaleX:i,scaleY:l,x:o,y:s}=n,a=e.left-o-(1-i)*parseFloat(r),u=e.top-s-(1-l)*parseFloat(r.slice(r.indexOf(" ")+1)),c=i?e.width/i:e.width,d=l?e.height/l:e.height;return{width:c,height:d,top:u,right:a+c,bottom:u+d,left:a}}(r,t,n))}let{top:n,left:i,width:l,height:o,bottom:s,right:a}=r;return{top:n,left:i,width:l,height:o,bottom:s,right:a}}function q(e){return U(e,{ignoreTransform:!0})}function K(e,t){let r=[];return e?function n(i){var l;if(null!=t&&r.length>=t||!i)return r;if((0,S.qk)(i)&&null!=i.scrollingElement&&!r.includes(i.scrollingElement))return r.push(i.scrollingElement),r;if(!(0,S.Re)(i)||(0,S.vZ)(i)||r.includes(i))return r;let o=(0,S.Jj)(e).getComputedStyle(i);return(i!==e&&function(e,t){void 0===t&&(t=(0,S.Jj)(e).getComputedStyle(e));let r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{let n=t[e];return"string"==typeof n&&r.test(n)})}(i,o)&&r.push(i),void 0===(l=o)&&(l=(0,S.Jj)(i).getComputedStyle(i)),"fixed"===l.position)?r:n(i.parentNode)}(e):r}function _(e){let[t]=K(e,1);return null!=t?t:null}function G(e){return S.Nq&&e?(0,S.FJ)(e)?e:(0,S.UG)(e)?(0,S.qk)(e)||e===(0,S.r3)(e).scrollingElement?window:(0,S.Re)(e)?e:null:null:null}function V(e){return(0,S.FJ)(e)?e.scrollX:e.scrollLeft}function Z(e){return(0,S.FJ)(e)?e.scrollY:e.scrollTop}function Q(e){return{x:V(e),y:Z(e)}}function ee(e){return!!S.Nq&&!!e&&e===document.scrollingElement}function et(e){let t={x:0,y:0},r=ee(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},i=e.scrollTop<=t.y,l=e.scrollLeft<=t.x;return{isTop:i,isLeft:l,isBottom:e.scrollTop>=n.y,isRight:e.scrollLeft>=n.x,maxScroll:n,minScroll:t}}(i=p||(p={}))[i.Forward=1]="Forward",i[i.Backward=-1]="Backward";let er={x:.2,y:.2};function en(e){return e.reduce((e,t)=>(0,S.IH)(e,Q(t)),T)}function ei(e,t){if(void 0===t&&(t=U),!e)return;let{top:r,left:n,bottom:i,right:l}=t(e);_(e)&&(i<=0||l<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}let el=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+V(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+Z(t),0)}]];class eo{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let r=K(t),n=en(r);for(let[t,i,l]of(this.rect={...e},this.width=e.width,this.height=e.height,el))for(let e of i)Object.defineProperty(this,e,{get:()=>{let i=l(r),o=n[t]-i;return this.rect[e]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class es{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,r){var n;null==(n=this.target)||n.addEventListener(e,t,r),this.listeners.push([e,t,r])}}function ea(e,t){let r=Math.abs(e.x),n=Math.abs(e.y);return"number"==typeof t?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t&&n>t.y}function eu(e){e.preventDefault()}function ec(e){e.stopPropagation()}(l=f||(f={})).Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange",(o=m||(m={})).Space="Space",o.Down="ArrowDown",o.Right="ArrowRight",o.Left="ArrowLeft",o.Up="ArrowUp",o.Esc="Escape",o.Enter="Enter",o.Tab="Tab";let ed={start:[m.Space,m.Enter],cancel:[m.Esc],end:[m.Space,m.Enter,m.Tab]},eh=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case m.Right:return{...r,x:r.x+25};case m.Left:return{...r,x:r.x-25};case m.Down:return{...r,y:r.y+25};case m.Up:return{...r,y:r.y-25}}};class ep{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new es((0,S.r3)(t)),this.windowListeners=new es((0,S.Jj)(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(f.Resize,this.handleCancel),this.windowListeners.add(f.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(f.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,r=e.node.current;r&&ei(r),t(T)}handleKeyDown(e){if((0,S.vd)(e)){let{active:t,context:r,options:n}=this.props,{keyboardCodes:i=ed,coordinateGetter:l=eh,scrollBehavior:o="smooth"}=n,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:a}=r.current,u=a?{x:a.left,y:a.top}:T;this.referenceCoordinates||(this.referenceCoordinates=u);let c=l(e,{active:t,context:r.current,currentCoordinates:u});if(c){let t=(0,S.$X)(c,u),n={x:0,y:0},{scrollableAncestors:i}=r.current;for(let r of i){let i=e.code,{isTop:l,isRight:s,isLeft:a,isBottom:u,maxScroll:d,minScroll:h}=et(r),p=function(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:r,right:n,bottom:i}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:i,width:e.clientWidth,height:e.clientHeight}}(r),f={x:Math.min(i===m.Right?p.right-p.width/2:p.right,Math.max(i===m.Right?p.left:p.left+p.width/2,c.x)),y:Math.min(i===m.Down?p.bottom-p.height/2:p.bottom,Math.max(i===m.Down?p.top:p.top+p.height/2,c.y))},g=i===m.Right&&!s||i===m.Left&&!a,v=i===m.Down&&!u||i===m.Up&&!l;if(g&&f.x!==c.x){let e=r.scrollLeft+t.x,l=i===m.Right&&e<=d.x||i===m.Left&&e>=h.x;if(l&&!t.y){r.scrollTo({left:e,behavior:o});return}l?n.x=r.scrollLeft-e:n.x=i===m.Right?r.scrollLeft-d.x:r.scrollLeft-h.x,n.x&&r.scrollBy({left:-n.x,behavior:o});break}if(v&&f.y!==c.y){let e=r.scrollTop+t.y,l=i===m.Down&&e<=d.y||i===m.Up&&e>=h.y;if(l&&!t.x){r.scrollTo({top:e,behavior:o});return}l?n.y=r.scrollTop-e:n.y=i===m.Down?r.scrollTop-d.y:r.scrollTop-h.y,n.y&&r.scrollBy({top:-n.y,behavior:o});break}}this.handleMove(e,(0,S.IH)((0,S.$X)(c,this.referenceCoordinates),n))}}}handleMove(e,t){let{onMove:r}=this.props;e.preventDefault(),r(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function ef(e){return!!(e&&"distance"in e)}function em(e){return!!(e&&"delay"in e)}ep.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=ed,onActivation:i}=t,{active:l}=r,{code:o}=e.nativeEvent;if(n.start.includes(o)){let t=l.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==i||i({event:e.nativeEvent}),!0)}return!1}}];class eg{constructor(e,t,r){var n;void 0===r&&(r=function(e){let{EventTarget:t}=(0,S.Jj)(e);return e instanceof t?e:(0,S.r3)(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:i}=e,{target:l}=i;this.props=e,this.events=t,this.document=(0,S.r3)(l),this.documentListeners=new es(this.document),this.listeners=new es(r),this.windowListeners=new es((0,S.Jj)(l)),this.initialCoordinates=null!=(n=(0,S.DC)(i))?n:T,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(f.Resize,this.handleCancel),this.windowListeners.add(f.DragStart,eu),this.windowListeners.add(f.VisibilityChange,this.handleCancel),this.windowListeners.add(f.ContextMenu,eu),this.documentListeners.add(f.Keydown,this.handleKeydown),t){if(null!=r&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(em(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(ef(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:r,onPending:n}=this.props;n(r,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(f.Click,ec,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(f.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;let{activated:r,initialCoordinates:n,props:i}=this,{onMove:l,options:{activationConstraint:o}}=i;if(!n)return;let s=null!=(t=(0,S.DC)(e))?t:T,a=(0,S.$X)(n,s);if(!r&&o){if(ef(o)){if(null!=o.tolerance&&ea(a,o.tolerance))return this.handleCancel();if(ea(a,o.distance))return this.handleStart()}return em(o)&&ea(a,o.tolerance)?this.handleCancel():void this.handlePending(o,a)}e.cancelable&&e.preventDefault(),l(s)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===m.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}let ev={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ey extends eg{constructor(e){let{event:t}=e;super(e,ev,(0,S.r3)(t.target))}}ey.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!!r.isPrimary&&0===r.button&&(null==n||n({event:r}),!0)}}];(s=g||(g={}))[s.RightClick=2]="RightClick";(a=v||(v={}))[a.Pointer=0]="Pointer",a[a.DraggableRect=1]="DraggableRect",(u=y||(y={}))[u.TreeOrder=0]="TreeOrder",u[u.ReversedTreeOrder=1]="ReversedTreeOrder";let eb={x:{[p.Backward]:!1,[p.Forward]:!1},y:{[p.Backward]:!1,[p.Forward]:!1}};(c=b||(b={}))[c.Always=0]="Always",c[c.BeforeDragging=1]="BeforeDragging",c[c.WhileDragging=2]="WhileDragging",(w||(w={})).Optimized="optimized";let ew=new Map;function ex(e,t){return(0,S.Gj)(r=>e?r||("function"==typeof t?t(e):e):null,[t,e])}function ek(e){let{callback:t,disabled:r}=e,n=(0,S.zX)(t),i=(0,k.useMemo)(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;let{ResizeObserver:e}=window;return new e(n)},[r]);return(0,k.useEffect)(()=>()=>null==i?void 0:i.disconnect(),[i]),i}function eS(e){return new eo(U(e),e)}function eC(e,t,r){void 0===t&&(t=eS);let[n,i]=(0,k.useState)(null);function l(){i(n=>{if(!e)return null;if(!1===e.isConnected){var i;return null!=(i=null!=n?n:r)?i:null}let l=t(e);return JSON.stringify(n)===JSON.stringify(l)?n:l})}let o=function(e){let{callback:t,disabled:r}=e,n=(0,S.zX)(t),i=(0,k.useMemo)(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;let{MutationObserver:e}=window;return new e(n)},[n,r]);return(0,k.useEffect)(()=>()=>null==i?void 0:i.disconnect(),[i]),i}({callback(t){if(e)for(let r of t){let{type:t,target:n}=r;if("childList"===t&&n instanceof HTMLElement&&n.contains(e)){l();break}}}}),s=ek({callback:l});return(0,S.LI)(()=>{l(),e?(null==s||s.observe(e),null==o||o.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==o||o.disconnect())},[e]),n}let eE=[];function eM(e,t){void 0===t&&(t=[]);let r=(0,k.useRef)(null);return(0,k.useEffect)(()=>{r.current=null},t),(0,k.useEffect)(()=>{let t=e!==T;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?(0,S.$X)(e,r.current):T}function eR(e){return(0,k.useMemo)(()=>e?function(e){let t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}(e):null,[e])}let eD=[];function eN(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return(0,S.Re)(t)?t:e}let eO=[{sensor:ey,options:{}},{sensor:ep,options:{}}],eI={current:{}},eT={draggable:{measure:q},droppable:{measure:q,strategy:b.WhileDragging,frequency:w.Optimized},dragOverlay:{measure:U}};class eA extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,r;return null!=(t=null==(r=this.get(e))?void 0:r.node.current)?t:void 0}}let eL={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new eA,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:N},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:eT,measureDroppableContainers:N,windowRect:null,measuringScheduled:!1},ez={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:N,draggableNodes:new Map,over:null,measureDroppableContainers:N},eJ=(0,k.createContext)(ez),ej=(0,k.createContext)(eL);function eF(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new eA}}}function eB(e,t){switch(t.type){case h.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case h.DragMove:if(null==e.draggable.active)return e;return{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case h.DragEnd:case h.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case h.RegisterDroppable:{let{element:r}=t,{id:n}=r,i=new eA(e.droppable.containers);return i.set(n,r),{...e,droppable:{...e.droppable,containers:i}}}case h.SetDroppableDisabled:{let{id:r,key:n,disabled:i}=t,l=e.droppable.containers.get(r);if(!l||n!==l.key)return e;let o=new eA(e.droppable.containers);return o.set(r,{...l,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case h.UnregisterDroppable:{let{id:r,key:n}=t,i=e.droppable.containers.get(r);if(!i||n!==i.key)return e;let l=new eA(e.droppable.containers);return l.delete(r),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function eY(e){let{disabled:t}=e,{active:r,activatorEvent:n,draggableNodes:i}=(0,k.useContext)(eJ),l=(0,S.D9)(n),o=(0,S.D9)(null==r?void 0:r.id);return(0,k.useEffect)(()=>{if(!t&&!n&&l&&null!=o){if(!(0,S.vd)(l)||document.activeElement===l.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:r}=e;if(t.current||r.current)requestAnimationFrame(()=>{for(let e of[t.current,r.current]){if(!e)continue;let t=(0,S.so)(e);if(t){t.focus();break}}})}},[n,t,i,o,l]),null}function eH(e,t){let{transform:r,...n}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...n}),r):r}let eP=(0,k.createContext)({...T,scaleX:1,scaleY:1});(d=x||(x={}))[d.Uninitialized=0]="Uninitialized",d[d.Initializing=1]="Initializing",d[d.Initialized=2]="Initialized";let eW=(0,k.memo)(function(e){var t,r,n,i,l,o;let{id:s,accessibility:a,autoScroll:u=!0,children:c,sensors:d=eO,collisionDetection:f=H,measuring:m,modifiers:g,...w}=e,[C,M]=(0,k.useReducer)(eB,void 0,eF),[R,N]=function(){let[e]=(0,k.useState)(()=>new Set),t=(0,k.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,k.useCallback)(t=>{let{type:r,event:n}=t;e.forEach(e=>{var t;return null==(t=e[r])?void 0:t.call(e,n)})},[e]),t]}(),[O,I]=(0,k.useState)(x.Uninitialized),A=O===x.Initialized,{draggable:{active:L,nodes:z,translate:J},droppable:{containers:F}}=C,B=null!=L?z.get(L):null,Y=(0,k.useRef)({initial:null,translated:null}),X=(0,k.useMemo)(()=>{var e;return null!=L?{id:L,data:null!=(e=null==B?void 0:B.data)?e:eI,rect:Y}:null},[L,B]),$=(0,k.useRef)(null),[q,V]=(0,k.useState)(null),[Z,ei]=(0,k.useState)(null),el=(0,S.Ey)(w,Object.values(w)),es=(0,S.Ld)("DndDescribedBy",s),ea=(0,k.useMemo)(()=>F.getEnabled(),[F]),eu=(0,k.useMemo)(()=>({draggable:{...eT.draggable,...null==m?void 0:m.draggable},droppable:{...eT.droppable,...null==m?void 0:m.droppable},dragOverlay:{...eT.dragOverlay,...null==m?void 0:m.dragOverlay}}),[null==m?void 0:m.draggable,null==m?void 0:m.droppable,null==m?void 0:m.dragOverlay]),{droppableRects:ec,measureDroppableContainers:ed,measuringScheduled:eh}=function(e,t){let{dragging:r,dependencies:n,config:i}=t,[l,o]=(0,k.useState)(null),{frequency:s,measure:a,strategy:u}=i,c=(0,k.useRef)(e),d=function(){switch(u){case b.Always:return!1;case b.BeforeDragging:return r;default:return!r}}(),h=(0,S.Ey)(d),p=(0,k.useCallback)(function(e){void 0===e&&(e=[]),!h.current&&o(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[h]),f=(0,k.useRef)(null),m=(0,S.Gj)(t=>{if(d&&!r)return ew;if(!t||t===ew||c.current!==e||null!=l){let t=new Map;for(let r of e){if(!r)continue;if(l&&l.length>0&&!l.includes(r.id)&&r.rect.current){t.set(r.id,r.rect.current);continue}let e=r.node.current,n=e?new eo(a(e),e):null;r.rect.current=n,n&&t.set(r.id,n)}return t}return t},[e,l,r,d,a]);return(0,k.useEffect)(()=>{c.current=e},[e]),(0,k.useEffect)(()=>{!d&&p()},[r,d]),(0,k.useEffect)(()=>{l&&l.length>0&&o(null)},[JSON.stringify(l)]),(0,k.useEffect)(()=>{!d&&"number"==typeof s&&null===f.current&&(f.current=setTimeout(()=>{p(),f.current=null},s))},[s,d,p,...n]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:null!=l}}(ea,{dragging:A,dependencies:[J.x,J.y],config:eu.droppable}),ep=function(e,t){let r=null!=t?e.get(t):void 0,n=r?r.node.current:null;return(0,S.Gj)(e=>{var r;return null==t?null:null!=(r=null!=n?n:e)?r:null},[n,t])}(z,L),ef=(0,k.useMemo)(()=>Z?(0,S.DC)(Z):null,[Z]),em=function(){let e=(null==q?void 0:q.autoScrollEnabled)===!1,t="object"==typeof u?!1===u.enabled:!1===u,r=A&&!e&&!t;return"object"==typeof u?{...u,enabled:r}:{enabled:r}}(),eg=ex(ep,eu.draggable.measure);!function(e){let{activeNode:t,measure:r,initialRect:n,config:i=!0}=e,l=(0,k.useRef)(!1),{x:o,y:s}="boolean"==typeof i?{x:i,y:i}:i;(0,S.LI)(()=>{if(!o&&!s||!t){l.current=!1;return}if(l.current||!n)return;let e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;let i=P(r(e),n);if(o||(i.x=0),s||(i.y=0),l.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=_(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,n,r])}({activeNode:null!=L?z.get(L):null,config:em.layoutShiftCompensation,initialRect:eg,measure:eu.draggable.measure});let ev=eC(ep,eu.draggable.measure,eg),ey=eC(ep?ep.parentElement:null),eS=(0,k.useRef)({activatorEvent:null,active:null,activeNode:ep,collisionRect:null,collisions:null,droppableRects:ec,draggableNodes:z,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),eA=F.getNodeFor(null==(t=eS.current.over)?void 0:t.id),eL=function(e){let{measure:t}=e,[r,n]=(0,k.useState)(null),i=ek({callback:(0,k.useCallback)(e=>{for(let{target:r}of e)if((0,S.Re)(r)){n(e=>{let n=t(r);return e?{...e,width:n.width,height:n.height}:n});break}},[t])}),l=(0,k.useCallback)(e=>{let r=eN(e);null==i||i.disconnect(),r&&(null==i||i.observe(r)),n(r?t(r):null)},[t,i]),[o,s]=(0,S.wm)(l);return(0,k.useMemo)(()=>({nodeRef:o,rect:r,setRef:s}),[r,o,s])}({measure:eu.dragOverlay.measure}),ez=null!=(r=eL.nodeRef.current)?r:ep,eW=A?null!=(n=eL.rect)?n:ev:null,eX=!!(eL.nodeRef.current&&eL.rect),e$=function(e){let t=ex(e);return P(e,t)}(eX?null:ev),eU=eR(ez?(0,S.Jj)(ez):null),eq=function(e){let t=(0,k.useRef)(e),r=(0,S.Gj)(r=>e?r&&r!==eE&&e&&t.current&&e.parentNode===t.current.parentNode?r:K(e):eE,[e]);return(0,k.useEffect)(()=>{t.current=e},[e]),r}(A?null!=eA?eA:ep:null),eK=function(e,t){void 0===t&&(t=U);let[r]=e,n=eR(r?(0,S.Jj)(r):null),[i,l]=(0,k.useState)(eD);function o(){l(()=>e.length?e.map(e=>ee(e)?n:new eo(t(e),e)):eD)}let s=ek({callback:o});return(0,S.LI)(()=>{null==s||s.disconnect(),o(),e.forEach(e=>null==s?void 0:s.observe(e))},[e]),i}(eq),e_=eH(g,{transform:{x:J.x-e$.x,y:J.y-e$.y,scaleX:1,scaleY:1},activatorEvent:Z,active:X,activeNodeRect:ev,containerNodeRect:ey,draggingNodeRect:eW,over:eS.current.over,overlayNodeRect:eL.rect,scrollableAncestors:eq,scrollableAncestorRects:eK,windowRect:eU}),eG=ef?(0,S.IH)(ef,J):null,eV=function(e){let[t,r]=(0,k.useState)(null),n=(0,k.useRef)(e),i=(0,k.useCallback)(e=>{let t=G(e.target);t&&r(e=>e?(e.set(t,Q(t)),new Map(e)):null)},[]);return(0,k.useEffect)(()=>{let t=n.current;if(e!==t){l(t);let o=e.map(e=>{let t=G(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Q(t)]):null}).filter(e=>null!=e);r(o.length?new Map(o):null),n.current=e}return()=>{l(e),l(t)};function l(e){e.forEach(e=>{let t=G(e);null==t||t.removeEventListener("scroll",i)})}},[i,e]),(0,k.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>(0,S.IH)(e,t),T):en(e):T,[e,t])}(eq),eZ=eM(eV),eQ=eM(eV,[ev]),e0=(0,S.IH)(e_,eZ),e1=eW?W(eW,e_):null,e2=X&&e1?f({active:X,collisionRect:e1,droppableRects:ec,droppableContainers:ea,pointerCoordinates:eG}):null,e5=j(e2,"id"),[e4,e3]=(0,k.useState)(null),e6=(l=eX?e_:(0,S.IH)(e_,eQ),o=null!=(i=null==e4?void 0:e4.rect)?i:null,{...l,scaleX:o&&ev?o.width/ev.width:1,scaleY:o&&ev?o.height/ev.height:1}),e9=(0,k.useRef)(null),e8=(0,k.useCallback)((e,t)=>{let{sensor:r,options:n}=t;if(null==$.current)return;let i=z.get($.current);if(!i)return;let l=e.nativeEvent,o=new r({active:$.current,activeNode:i,event:l,options:n,context:eS,onAbort(e){if(!z.get(e))return;let{onDragAbort:t}=el.current,r={id:e};null==t||t(r),R({type:"onDragAbort",event:r})},onPending(e,t,r,n){if(!z.get(e))return;let{onDragPending:i}=el.current,l={id:e,constraint:t,initialCoordinates:r,offset:n};null==i||i(l),R({type:"onDragPending",event:l})},onStart(e){let t=$.current;if(null==t)return;let r=z.get(t);if(!r)return;let{onDragStart:n}=el.current,i={activatorEvent:l,active:{id:t,data:r.data,rect:Y}};(0,k.unstable_batchedUpdates)(()=>{null==n||n(i),I(x.Initializing),M({type:h.DragStart,initialCoordinates:e,active:t}),R({type:"onDragStart",event:i}),V(e9.current),ei(l)})},onMove(e){M({type:h.DragMove,coordinates:e})},onEnd:s(h.DragEnd),onCancel:s(h.DragCancel)});function s(e){return async function(){let{active:t,collisions:r,over:n,scrollAdjustedTranslate:i}=eS.current,o=null;if(t&&i){let{cancelDrop:s}=el.current;o={activatorEvent:l,active:t,collisions:r,delta:i,over:n},e===h.DragEnd&&"function"==typeof s&&await Promise.resolve(s(o))&&(e=h.DragCancel)}$.current=null,(0,k.unstable_batchedUpdates)(()=>{M({type:e}),I(x.Uninitialized),e3(null),V(null),ei(null),e9.current=null;let t=e===h.DragEnd?"onDragEnd":"onDragCancel";if(o){let e=el.current[t];null==e||e(o),R({type:t,event:o})}})}}e9.current=o},[z]),e7=(0,k.useCallback)((e,t)=>(r,n)=>{let i=r.nativeEvent,l=z.get(n);null===$.current&&l&&!i.dndKit&&!i.defaultPrevented&&!0===e(r,t.options,{active:l})&&(i.dndKit={capturedBy:t.sensor},$.current=n,e8(r,t))},[z,e8]),te=(0,k.useMemo)(()=>d.reduce((e,t)=>{let{sensor:r}=t;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:e7(e.handler,t)}))]},[]),[d,e7]);(0,k.useEffect)(()=>{if(!S.Nq)return;let e=d.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(let t of e)null==t||t()}},d.map(e=>{let{sensor:t}=e;return t})),(0,S.LI)(()=>{ev&&O===x.Initializing&&I(x.Initialized)},[ev,O]),(0,k.useEffect)(()=>{let{onDragMove:e}=el.current,{active:t,activatorEvent:r,collisions:n,over:i}=eS.current;if(!t||!r)return;let l={active:t,activatorEvent:r,collisions:n,delta:{x:e0.x,y:e0.y},over:i};(0,k.unstable_batchedUpdates)(()=>{null==e||e(l),R({type:"onDragMove",event:l})})},[e0.x,e0.y]),(0,k.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:r,droppableContainers:n,scrollAdjustedTranslate:i}=eS.current;if(!e||null==$.current||!t||!i)return;let{onDragOver:l}=el.current,o=n.get(e5),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,a={active:e,activatorEvent:t,collisions:r,delta:{x:i.x,y:i.y},over:s};(0,k.unstable_batchedUpdates)(()=>{e3(s),null==l||l(a),R({type:"onDragOver",event:a})})},[e5]),(0,S.LI)(()=>{eS.current={activatorEvent:Z,active:X,activeNode:ep,collisionRect:e1,collisions:e2,droppableRects:ec,draggableNodes:z,draggingNode:ez,draggingNodeRect:eW,droppableContainers:F,over:e4,scrollableAncestors:eq,scrollAdjustedTranslate:e0},Y.current={initial:eW,translated:e1}},[X,ep,e2,e1,z,ez,eW,ec,F,e4,eq,e0]),function(e){let{acceleration:t,activator:r=v.Pointer,canScroll:n,draggingRect:i,enabled:l,interval:o=5,order:s=y.TreeOrder,pointerCoordinates:a,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:h}=e,f=function(e){let{delta:t,disabled:r}=e,n=(0,S.D9)(t);return(0,S.Gj)(e=>{if(r||!n||!e)return eb;let i={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[p.Backward]:e.x[p.Backward]||-1===i.x,[p.Forward]:e.x[p.Forward]||1===i.x},y:{[p.Backward]:e.y[p.Backward]||-1===i.y,[p.Forward]:e.y[p.Forward]||1===i.y}}},[r,t,n])}({delta:d,disabled:!l}),[m,g]=(0,S.Yz)(),b=(0,k.useRef)({x:0,y:0}),w=(0,k.useRef)({x:0,y:0}),x=(0,k.useMemo)(()=>{switch(r){case v.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case v.DraggableRect:return i}},[r,i,a]),C=(0,k.useRef)(null),E=(0,k.useCallback)(()=>{let e=C.current;if(!e)return;let t=b.current.x*w.current.x,r=b.current.y*w.current.y;e.scrollBy(t,r)},[]),M=(0,k.useMemo)(()=>s===y.TreeOrder?[...u].reverse():u,[s,u]);(0,k.useEffect)(()=>{if(!l||!u.length||!x){g();return}for(let e of M){if((null==n?void 0:n(e))===!1)continue;let r=c[u.indexOf(e)];if(!r)continue;let{direction:i,speed:l}=function(e,t,r,n,i){let{top:l,left:o,right:s,bottom:a}=r;void 0===n&&(n=10),void 0===i&&(i=er);let{isTop:u,isBottom:c,isLeft:d,isRight:h}=et(e),f={x:0,y:0},m={x:0,y:0},g={height:t.height*i.y,width:t.width*i.x};return!u&&l<=t.top+g.height?(f.y=p.Backward,m.y=n*Math.abs((t.top+g.height-l)/g.height)):!c&&a>=t.bottom-g.height&&(f.y=p.Forward,m.y=n*Math.abs((t.bottom-g.height-a)/g.height)),!h&&s>=t.right-g.width?(f.x=p.Forward,m.x=n*Math.abs((t.right-g.width-s)/g.width)):!d&&o<=t.left+g.width&&(f.x=p.Backward,m.x=n*Math.abs((t.left+g.width-o)/g.width)),{direction:f,speed:m}}(e,r,x,t,h);for(let e of["x","y"])f[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0){g(),C.current=e,m(E,o),b.current=l,w.current=i;return}}b.current={x:0,y:0},w.current={x:0,y:0},g()},[t,E,n,g,l,o,JSON.stringify(x),JSON.stringify(f),m,u,M,c,JSON.stringify(h)])}({...em,delta:J,draggingRect:e1,pointerCoordinates:eG,scrollableAncestors:eq,scrollableAncestorRects:eK});let tt=(0,k.useMemo)(()=>({active:X,activeNode:ep,activeNodeRect:ev,activatorEvent:Z,collisions:e2,containerNodeRect:ey,dragOverlay:eL,draggableNodes:z,droppableContainers:F,droppableRects:ec,over:e4,measureDroppableContainers:ed,scrollableAncestors:eq,scrollableAncestorRects:eK,measuringConfiguration:eu,measuringScheduled:eh,windowRect:eU}),[X,ep,ev,Z,e2,ey,eL,z,F,ec,e4,ed,eq,eK,eu,eh,eU]),tr=(0,k.useMemo)(()=>({activatorEvent:Z,activators:te,active:X,activeNodeRect:ev,ariaDescribedById:{draggable:es},dispatch:M,draggableNodes:z,over:e4,measureDroppableContainers:ed}),[Z,te,X,ev,M,es,z,e4,ed]);return k.default.createElement(E.Provider,{value:N},k.default.createElement(eJ.Provider,{value:tr},k.default.createElement(ej.Provider,{value:tt},k.default.createElement(eP.Provider,{value:e6},c)),k.default.createElement(eY,{disabled:(null==a?void 0:a.restoreFocus)===!1})),k.default.createElement(D,{...a,hiddenTextDescribedById:es}))}),eX=(0,k.createContext)(null),e$="button";function eU(e){let{id:t,data:r,disabled:n=!1,attributes:i}=e,l=(0,S.Ld)("Draggable"),{activators:o,activatorEvent:s,active:a,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:h}=(0,k.useContext)(eJ),{role:p=e$,roleDescription:f="draggable",tabIndex:m=0}=null!=i?i:{},g=(null==a?void 0:a.id)===t,v=(0,k.useContext)(g?eP:eX),[y,b]=(0,S.wm)(),[w,x]=(0,S.wm)(),C=(0,k.useMemo)(()=>o.reduce((e,r)=>{let{eventName:n,handler:i}=r;return e[n]=e=>{i(e,t)},e},{}),[o,t]),E=(0,S.Ey)(r);return(0,S.LI)(()=>(d.set(t,{id:t,key:l,node:y,activatorNode:w,data:E}),()=>{let e=d.get(t);e&&e.key===l&&d.delete(t)}),[d,t]),{active:a,activatorEvent:s,activeNodeRect:u,attributes:(0,k.useMemo)(()=>({role:p,tabIndex:m,"aria-disabled":n,"aria-pressed":!!g&&p===e$||void 0,"aria-roledescription":f,"aria-describedby":c.draggable}),[n,p,m,g,f,c.draggable]),isDragging:g,listeners:n?void 0:C,node:y,over:h,setNodeRef:b,setActivatorNodeRef:x,transform:v}}function eq(){return(0,k.useContext)(ej)}let eK={timeout:25};function e_(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:i}=e,l=(0,S.Ld)("Droppable"),{active:o,dispatch:s,over:a,measureDroppableContainers:u}=(0,k.useContext)(eJ),c=(0,k.useRef)({disabled:r}),d=(0,k.useRef)(!1),p=(0,k.useRef)(null),f=(0,k.useRef)(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...eK,...i},y=(0,S.Ey)(null!=g?g:n),b=ek({callback:(0,k.useCallback)(()=>{if(!d.current){d.current=!0;return}null!=f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{u(Array.isArray(y.current)?y.current:[y.current]),f.current=null},v)},[v]),disabled:m||!o}),w=(0,k.useCallback)((e,t)=>{b&&(t&&(b.unobserve(t),d.current=!1),e&&b.observe(e))},[b]),[x,C]=(0,S.wm)(w),E=(0,S.Ey)(t);return(0,k.useEffect)(()=>{b&&x.current&&(b.disconnect(),d.current=!1,b.observe(x.current))},[x,b]),(0,k.useEffect)(()=>(s({type:h.RegisterDroppable,element:{id:n,key:l,disabled:r,node:x,rect:p,data:E}}),()=>s({type:h.UnregisterDroppable,key:l,id:n})),[n]),(0,k.useEffect)(()=>{r!==c.current.disabled&&(s({type:h.SetDroppableDisabled,id:n,key:l,disabled:r}),c.current.disabled=r)},[n,l,r,s]),{active:o,rect:p,isOver:(null==a?void 0:a.id)===n,node:x,over:a,setNodeRef:C}}function eG(e){let{animation:t,children:r}=e,[n,i]=(0,k.useState)(null),[l,o]=(0,k.useState)(null),s=(0,S.D9)(r);return r||n||!s||i(s),(0,S.LI)(()=>{if(!l)return;let e=null==n?void 0:n.key,r=null==n?void 0:n.props.id;if(null==e||null==r){i(null);return}Promise.resolve(t(r,l)).then(()=>{i(null)})},[t,n,l]),k.default.createElement(k.default.Fragment,null,r,n?(0,k.cloneElement)(n,{ref:o}):null)}let eV=4716==r.j?{x:0,y:0,scaleX:1,scaleY:1}:null;function eZ(e){let{children:t}=e;return k.default.createElement(eJ.Provider,{value:ez},k.default.createElement(eP.Provider,{value:eV},t))}let eQ=4716==r.j?{position:"fixed",touchAction:"none"}:null,e0=e=>(0,S.vd)(e)?"transform 250ms ease":void 0,e1=4716==r.j?(0,k.forwardRef)((e,t)=>{let{as:r,activatorEvent:n,adjustScale:i,children:l,className:o,rect:s,style:a,transform:u,transition:c=e0}=e;if(!s)return null;let d=i?u:{...u,scaleX:1,scaleY:1},h={...eQ,width:s.width,height:s.height,top:s.top,left:s.left,transform:S.ux.Transform.toString(d),transformOrigin:i&&n?function(e,t){let r=(0,S.DC)(e);if(!r)return"0 0";let n={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return n.x+"% "+n.y+"%"}(n,s):void 0,transition:"function"==typeof c?c(n):c,...a};return k.default.createElement(r,{className:o,style:h,ref:t},l)}):null,e2=e=>t=>{let{active:r,dragOverlay:n}=t,i={},{styles:l,className:o}=e;if(null!=l&&l.active)for(let[e,t]of Object.entries(l.active))void 0!==t&&(i[e]=r.node.style.getPropertyValue(e),r.node.style.setProperty(e,t));if(null!=l&&l.dragOverlay)for(let[e,t]of Object.entries(l.dragOverlay))void 0!==t&&n.node.style.setProperty(e,t);return null!=o&&o.active&&r.node.classList.add(o.active),null!=o&&o.dragOverlay&&n.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))r.node.style.setProperty(e,t);null!=o&&o.active&&r.node.classList.remove(o.active)}},e5={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:t,final:r}}=e;return[{transform:S.ux.Transform.toString(t)},{transform:S.ux.Transform.toString(r)}]},sideEffects:e2({styles:{active:{opacity:"0"}}})},e4=0,e3=4716==r.j?k.default.memo(e=>{var t;let{adjustScale:r=!1,children:n,dropAnimation:i,style:l,transition:o,modifiers:s,wrapperElement:a="div",className:u,zIndex:c=999}=e,{activatorEvent:d,active:h,activeNodeRect:p,containerNodeRect:f,draggableNodes:m,droppableContainers:g,dragOverlay:v,over:y,measuringConfiguration:b,scrollableAncestors:w,scrollableAncestorRects:x,windowRect:C}=eq(),E=(0,k.useContext)(eP),M=(t=null==h?void 0:h.id,(0,k.useMemo)(()=>{if(null!=t)return++e4},[t])),R=eH(s,{activatorEvent:d,active:h,activeNodeRect:p,containerNodeRect:f,draggingNodeRect:v.rect,over:y,overlayNodeRect:v.rect,scrollableAncestors:w,scrollableAncestorRects:x,transform:E,windowRect:C}),D=ex(p),N=function(e){let{config:t,draggableNodes:r,droppableContainers:n,measuringConfiguration:i}=e;return(0,S.zX)((e,l)=>{if(null===t)return;let o=r.get(e);if(!o)return;let s=o.node.current;if(!s)return;let a=eN(l);if(!a)return;let{transform:u}=(0,S.Jj)(l).getComputedStyle(l),c=X(u);if(!c)return;let d="function"==typeof t?t:function(e){let{duration:t,easing:r,sideEffects:n,keyframes:i}={...e5,...e};return e=>{let{active:l,dragOverlay:o,transform:s,...a}=e;if(!t)return;let u={x:o.rect.left-l.rect.left,y:o.rect.top-l.rect.top},c={scaleX:1!==s.scaleX?l.rect.width*s.scaleX/o.rect.width:1,scaleY:1!==s.scaleY?l.rect.height*s.scaleY/o.rect.height:1},d={x:s.x-u.x,y:s.y-u.y,...c},h=i({...a,active:l,dragOverlay:o,transform:{initial:s,final:d}}),[p]=h,f=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(f))return;let m=null==n?void 0:n({active:l,dragOverlay:o,...a}),g=o.node.animate(h,{duration:t,easing:r,fill:"forwards"});return new Promise(e=>{g.onfinish=()=>{null==m||m(),e()}})}}(t);return ei(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:r,dragOverlay:{node:l,rect:i.dragOverlay.measure(a)},droppableContainers:n,measuringConfiguration:i,transform:c})})}({config:i,draggableNodes:m,droppableContainers:g,measuringConfiguration:b}),O=D?v.setRef:void 0;return k.default.createElement(eZ,null,k.default.createElement(eG,{animation:N},h&&M?k.default.createElement(e1,{key:M,id:h.id,ref:O,as:a,activatorEvent:d,adjustScale:r,className:u,transition:o,rect:D,style:{zIndex:c,...l},transform:R},n):null))}):null},45587:function(e,t,r){"use strict";r.d(t,{Fo:()=>p,Rp:()=>o,U2:()=>a,is:()=>S,nB:()=>w,qw:()=>c});var n=r(98661),i=r(94697),l=r(24285);function o(e,t,r){let n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function s(e){return null!==e&&e>=0}let a=e=>{let{rects:t,activeIndex:r,overIndex:n,index:i}=e,l=o(t,n,r),s=t[i],a=l[i];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},u=4716==r.j?{scaleX:1,scaleY:1}:null,c=e=>{var t;let{activeIndex:r,activeNodeRect:n,index:i,rects:l,overIndex:o}=e,s=null!=(t=l[r])?t:n;if(!s)return null;if(i===r){let e=l[o];return e?{x:0,y:rr&&i<=o?{x:0,y:-s.height-a,...u}:i=o?{x:0,y:s.height+a,...u}:{x:0,y:0,...u}},d="Sortable",h=n.default.createContext({activeIndex:-1,containerId:d,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:a,disabled:{draggable:!1,droppable:!1}});function p(e){let{children:t,id:r,items:o,strategy:s=a,disabled:u=!1}=e,{active:c,dragOverlay:p,droppableRects:f,over:m,measureDroppableContainers:g}=(0,i.Cj)(),v=(0,l.Ld)(d,r),y=null!==p.rect,b=(0,n.useMemo)(()=>o.map(e=>"object"==typeof e&&"id"in e?e.id:e),[o]),w=null!=c,x=c?b.indexOf(c.id):-1,k=m?b.indexOf(m.id):-1,S=(0,n.useRef)(b),C=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r{C&&w&&g(b)},[C,b,w,g]),(0,n.useEffect)(()=>{S.current=b},[b]);let R=(0,n.useMemo)(()=>({activeIndex:x,containerId:v,disabled:M,disableTransforms:E,items:b,overIndex:k,useDragOverlay:y,sortedRects:b.reduce((e,t,r)=>{let n=f.get(t);return n&&(e[r]=n),e},Array(b.length)),strategy:s}),[x,v,M.draggable,M.droppable,E,b,k,f,y,s]);return n.default.createElement(h.Provider,{value:R},t)}let f=e=>{let{id:t,items:r,activeIndex:n,overIndex:i}=e;return o(r,n,i).indexOf(t)},m=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:i,items:l,newIndex:o,previousItems:s,previousContainerId:a,transition:u}=e;return!!u&&!!n&&(s===l||i!==o)&&(!!r||o!==i&&t===a)},g={duration:200,easing:"ease"},v="transform",y=l.ux.Transition.toString({property:v,duration:0,easing:"linear"}),b={roleDescription:"sortable"};function w(e){var t,r,o,a;let{animateLayoutChanges:u=m,attributes:c,disabled:d,data:p,getNewIndex:w=f,id:x,strategy:k,resizeObserverConfig:S,transition:C=g}=e,{items:E,containerId:M,activeIndex:R,disabled:D,disableTransforms:N,sortedRects:O,overIndex:I,useDragOverlay:T,strategy:A}=(0,n.useContext)(h),L=(t=d,r=D,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(o=null==t?void 0:t.draggable)?o:r.draggable,droppable:null!=(a=null==t?void 0:t.droppable)?a:r.droppable}),z=E.indexOf(x),J=(0,n.useMemo)(()=>({sortable:{containerId:M,index:z,items:E},...p}),[M,p,z,E]),j=(0,n.useMemo)(()=>E.slice(E.indexOf(x)),[E,x]),{rect:F,node:B,isOver:Y,setNodeRef:H}=(0,i.Zj)({id:x,data:J,disabled:L.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...S}}),{active:P,activatorEvent:W,activeNodeRect:X,attributes:$,setNodeRef:U,listeners:q,isDragging:K,over:_,setActivatorNodeRef:G,transform:V}=(0,i.O1)({id:x,data:J,attributes:{...b,...c},disabled:L.draggable}),Z=(0,l.HB)(H,U),Q=!!P,ee=Q&&!N&&s(R)&&s(I),et=!T&&K,er=et&&ee?V:null,en=ee?null!=er?er:(null!=k?k:A)({rects:O,activeNodeRect:X,activeIndex:R,overIndex:I,index:z}):null,ei=s(R)&&s(I)?w({id:x,items:E,activeIndex:R,overIndex:I}):z,el=null==P?void 0:P.id,eo=(0,n.useRef)({activeId:el,items:E,newIndex:ei,containerId:M}),es=E!==eo.current.items,ea=u({active:P,containerId:M,isDragging:K,isSorting:Q,id:x,index:z,items:E,newIndex:eo.current.newIndex,previousItems:eo.current.items,previousContainerId:eo.current.containerId,transition:C,wasDragging:null!=eo.current.activeId}),eu=function(e){let{disabled:t,index:r,node:o,rect:s}=e,[a,u]=(0,n.useState)(null),c=(0,n.useRef)(r);return(0,l.LI)(()=>{if(!t&&r!==c.current&&o.current){let e=s.current;if(e){let t=(0,i.VK)(o.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&u(r)}}r!==c.current&&(c.current=r)},[t,r,o,s]),(0,n.useEffect)(()=>{a&&u(null)},[a]),a}({disabled:!ea,index:z,node:B,rect:F});return(0,n.useEffect)(()=>{Q&&eo.current.newIndex!==ei&&(eo.current.newIndex=ei),M!==eo.current.containerId&&(eo.current.containerId=M),E!==eo.current.items&&(eo.current.items=E)},[Q,ei,M,E]),(0,n.useEffect)(()=>{if(el===eo.current.activeId)return;if(el&&!eo.current.activeId){eo.current.activeId=el;return}let e=setTimeout(()=>{eo.current.activeId=el},50);return()=>clearTimeout(e)},[el]),{active:P,activeIndex:R,attributes:$,data:J,rect:F,index:z,newIndex:ei,items:E,isOver:Y,isSorting:Q,isDragging:K,listeners:q,node:B,overIndex:I,over:_,setNodeRef:Z,setActivatorNodeRef:G,setDroppableNodeRef:H,setDraggableNodeRef:U,transform:null!=eu?eu:en,transition:eu||es&&eo.current.newIndex===z?y:(!et||(0,l.vd)(W))&&C&&(Q||ea)?l.ux.Transition.toString({...C,property:v}):void 0}}function x(e){if(!e)return!1;let t=e.data.current;return!!t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable}let k=[i.g4.Down,i.g4.Right,i.g4.Up,i.g4.Left],S=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:s,over:a,scrollableAncestors:u}}=t;if(k.includes(e.code)){if(e.preventDefault(),!r||!n)return;let t=[];s.getEnabled().forEach(r=>{if(!r||null!=r&&r.disabled)return;let l=o.get(r.id);if(l)switch(e.code){case i.g4.Down:n.topl.top&&t.push(r);break;case i.g4.Left:n.left>l.left&&t.push(r);break;case i.g4.Right:n.left1&&(p=h[1].id),null!=p){let e=s.get(r.id),t=s.get(p),a=t?o.get(t.id):null,h=null==t?void 0:t.node.current;if(h&&a&&e&&t){var c,d;let r=(0,i.hI)(h).some((e,t)=>u[t]!==e),o=C(e,t),s=(c=e,d=t,!!(x(c)&&x(d)&&C(c,d))&&c.data.current.sortable.indexC,D9:()=>b,DC:()=>M,Ey:()=>g,FJ:()=>o,Gj:()=>v,HB:()=>i,IH:()=>S,Jj:()=>a,LI:()=>p,Ld:()=>x,Nq:()=>l,Re:()=>c,UG:()=>s,Yz:()=>m,qk:()=>u,r3:()=>h,so:()=>N,ux:()=>R,vZ:()=>d,vd:()=>E,wm:()=>y,zX:()=>f});var n=r(98661);function i(){for(var e=arguments.length,t=Array(e),r=0;re=>{t.forEach(t=>t(e))},t)}let l="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function o(e){let t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function s(e){return"nodeType"in e}function a(e){var t,r;return e?o(e)?e:s(e)&&null!=(t=null==(r=e.ownerDocument)?void 0:r.defaultView)?t:window:window}function u(e){let{Document:t}=a(e);return e instanceof t}function c(e){return!o(e)&&e instanceof a(e).HTMLElement}function d(e){return e instanceof a(e).SVGElement}function h(e){return e?o(e)?e.document:s(e)?u(e)?e:c(e)||d(e)?e.ownerDocument:document:document:document}let p=l?n.useLayoutEffect:n.useEffect;function f(e){let t=(0,n.useRef)(e);return p(()=>{t.current=e}),(0,n.useCallback)(function(){for(var e=arguments.length,r=Array(e),n=0;n{e.current=setInterval(t,r)},[]),(0,n.useCallback)(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}function g(e,t){void 0===t&&(t=[e]);let r=(0,n.useRef)(e);return p(()=>{r.current!==e&&(r.current=e)},t),r}function v(e,t){let r=(0,n.useRef)();return(0,n.useMemo)(()=>{let t=e(r.current);return r.current=t,t},[...t])}function y(e){let t=f(e),r=(0,n.useRef)(null),i=(0,n.useCallback)(e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e},[]);return[r,i]}function b(e){let t=(0,n.useRef)();return(0,n.useEffect)(()=>{t.current=e},[e]),t.current}let w={};function x(e,t){return(0,n.useMemo)(()=>{if(t)return t;let r=null==w[e]?0:w[e]+1;return w[e]=r,e+"-"+r},[e,t])}function k(e){return function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i{for(let[n,i]of Object.entries(r)){let r=t[n];null!=r&&(t[n]=r+e*i)}return t},{...t})}}let S=k(1),C=k(-1);function E(e){if(!e)return!1;let{KeyboardEvent:t}=a(e.target);return t&&e instanceof t}function M(e){if(function(e){if(!e)return!1;let{TouchEvent:t}=a(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return"clientX"in e&&"clientY"in e?{x:e.clientX,y:e.clientY}:null}let R=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[R.Translate.toString(e),R.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),D="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function N(e){return e.matches(D)?e:e.querySelector(D)}},25235:function(e,t,r){e.exports=r(8425)},83311:function(e,t,r){"use strict";r.d(t,{Ax:()=>k,FC:()=>g,GJ:()=>E,Mn:()=>S,Pu:()=>m,dR:()=>R,h8:()=>a,k9:()=>b,nd:()=>w,nj:()=>M,oo:()=>u,vs:()=>o,wx:()=>F});var n=r(76405);class i{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class l{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&l.empty)return l.empty}recover(e){let t=0,r=65535&e;if(!this.inverted)for(let e=0;ee)break;let u=this.ranges[s+l],c=this.ranges[s+o],d=a+u;if(e<=d){let l=u?e==a?-1:e==d?1:t:t,o=a+n+(l<0?0:c);if(r)return o;let h=e==(t<0?a:d)?null:s/3+(e-a)*65536,p=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(p|=8),new i(o,p,h)}n+=c-u}return r?e+n:new i(e+n,0,null)}touches(e,t){let r=0,n=65535&t,i=this.inverted?2:1,l=this.inverted?1:2;for(let t=0;te)break;let s=this.ranges[t+i];if(e<=o+s&&t==3*n)return!0;r+=this.ranges[t+l]-s}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n=0;t--){let n=e.getMirror(t);this.appendMap(e.maps[t].invert(),null!=n&&n>t?r-n-1:void 0)}}invert(){let e=new o;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rr&&te.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,i),t.openStart,t.openEnd);return u.fromReplace(e,this.from,this.to,l)}invert(){return new h(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new d(t.pos,r.pos,this.mark)}merge(e){return e instanceof d&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new d(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new d(t.from,t.to,e.markFromJSON(t.mark))}}a.jsonID("addMark",d);class h extends a{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new n.p2(c(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return u.fromReplace(e,this.from,this.to,r)}invert(){return new d(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new h(t.pos,r.pos,this.mark)}merge(e){return e instanceof h&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new h(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new h(t.from,t.to,e.markFromJSON(t.mark))}}a.jsonID("removeMark",h);class p extends a{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return u.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return u.fromReplace(e,this.pos,this.pos+1,new n.p2(n.HY.from(r),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let r=0;rr.pos?null:new g(t.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new g(t.from,t.to,t.gapFrom,t.gapTo,n.p2.fromJSON(e,t.slice),t.insert,!!t.structure)}}function v(e,t,r){let n=e.resolve(t),i=r-t,l=n.depth;for(;i>0&&l>0&&n.indexAfter(l)==n.node(l).childCount;)l--,i--;if(i>0){let e=n.node(l).maybeChild(n.indexAfter(l));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function y(e,t,r,i=r.contentMatch,l=!0){let o=e.doc.nodeAt(t),s=[],a=t+1;for(let t=0;t=0;t--)e.step(s[t])}function b(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let n=e.$from.node(r),i=e.$from.index(r),l=e.$to.indexAfter(r);if(rl;e--,t--){let r=i.node(e),l=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(l,r.childCount),s=n&&n[t+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let a=n&&n[t]||r;if(!r.canReplace(l+1,r.childCount)||!a.type.validContent(o))return!1}let s=i.indexAfter(l),a=n&&n[0];return i.node(l).canReplaceWith(s,s,a?a.type:i.node(l+1).type)}function S(e,t){let r=e.resolve(t),n=r.index();return C(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function C(e,t){return!!(e&&t&&!e.isLeaf&&e.canAppend(t))}function E(e,t,r=-1){let n=e.resolve(t);for(let e=n.depth;;e--){let i,l,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,l=n.nodeAfter):r>0?(i=n.node(e+1),o++,l=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),l=n.node(e+1)),i&&!i.isTextblock&&C(i,l)&&n.node(e).canReplace(o,o+1))return t;if(0==e)break;t=r<0?n.before(e):n.after(e)}}function M(e,t,r){let n=e.resolve(t);if(!r.content.size)return t;let i=r.content;for(let e=0;e=0;t--){let r=t==n.depth?0:n.pos<=(n.start(t+1)+n.end(t+1))/2?-1:1,l=n.index(t)+ +(r>0),o=n.node(t),s=!1;if(1==e)s=o.canReplace(l,l,i);else{let e=o.contentMatchAt(l).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(l,l,e[0])}if(s)return 0==r?n.pos:r<0?n.before(t+1):n.after(t+1)}return null}function R(e,t,r=t,i=n.p2.empty){if(t==r&&!i.size)return null;let l=e.resolve(t),o=e.resolve(r);return D(l,o,i)?new m(t,r,i):new N(l,o,i).fit()}function D(e,t,r){return!r.openStart&&!r.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),r.content)}a.jsonID("replaceAround",g);class N{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=n.HY.empty;for(let t=0;t<=e.depth;t++){let r=e.node(t);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=n.HY.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let l=this.placed,o=r.depth,s=i.depth;for(;o&&s&&1==l.childCount;)l=l.firstChild.content,o--,s--;let a=new n.p2(l,o,s);return e>-1?new g(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new m(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,n=this.unplaced.openEnd;r1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}t=i.content}for(let t=1;t<=2;t++)for(let r=1==t?e:this.unplaced.openStart;r>=0;r--){let e,i=null,l=(r?(i=T(this.unplaced.content,r-1).firstChild).content:this.unplaced.content).firstChild;for(let e=this.depth;e>=0;e--){let{type:o,match:s}=this.frontier[e],a,u=null;if(1==t&&(l?s.matchType(l.type)||(u=s.fillBefore(n.HY.from(l),!1)):i&&o.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:e,parent:i,inject:u};if(2==t&&l&&(a=s.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:e,parent:i,wrap:a};if(i&&s.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=T(e,t);return!!i.childCount&&!i.firstChild.isLeaf&&(this.unplaced=new n.p2(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=T(e,t);if(i.childCount<=1&&t>0){let l=e.size-t<=t+i.size;this.unplaced=new n.p2(O(e,t-1,1),t-1,l?t-1:r)}else this.unplaced=new n.p2(O(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:l}){for(;this.depth>t;)this.closeFrontierNode();if(l)for(let e=0;e1||0==a||e.content.size)&&(d=t,c.push(function e(t,r,i){if(r<=0)return t;let l=t.content;return r>1&&(l=l.replaceChild(0,e(l.firstChild,r-1,1==l.childCount?i-1:0))),r>0&&(l=t.type.contentMatch.fillBefore(l).append(l),i<=0&&(l=l.append(t.type.contentMatch.matchFragment(l).fillBefore(n.HY.empty,!0)))),t.copy(l)}(e.mark(h.allowedMarks(e.marks)),1==u?a:0,u==s.childCount?p:-1)))}let f=u==s.childCount;f||(p=-1),this.placed=I(this.placed,t,n.HY.from(c)),this.frontier[t].match=d,f&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:n}=this.frontier[t],i=t=0;r--){let{match:t,type:n}=this.frontier[r],i=A(e,r,n,t,!0);if(!i||i.childCount)continue e}return{depth:t,fit:l,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=I(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let t=e.node(r),n=t.type.contentMatch.fillBefore(t.content,!0,e.index(r));this.openFrontierNode(t.type,t.attrs,n)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=I(this.placed,this.depth,n.HY.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(n.HY.empty,!0);e.childCount&&(this.placed=I(this.placed,this.frontier.length,e))}}function O(e,t,r){return 0==t?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(O(e.firstChild.content,t-1,r)))}function I(e,t,r){return 0==t?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(I(e.lastChild.content,t-1,r)))}function T(e,t){for(let r=0;r=0;i--){let n=e.start(i);if(nt.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(n==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==n-1)&&r.push(i)}return r}class z extends a{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return u.fail("No node at attribute step's position");let r=Object.create(null);for(let e in t.attrs)r[e]=t.attrs[e];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return u.fromReplace(e,this.pos,this.pos+1,new n.p2(n.HY.from(i),0,+!t.isLeaf))}getMap(){return l.empty}invert(e){return new z(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new z(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new z(t.pos,t.attr,t.value)}}a.jsonID("attr",z);class J extends a{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return u.ok(r)}getMap(){return l.empty}invert(e){return new J(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new J(t.attr,t.value)}}a.jsonID("docAttr",J);let j=class extends Error{};(j=function e(t){let r=Error.call(this,t);return r.__proto__=e.prototype,r}).prototype=Object.create(Error.prototype),j.prototype.constructor=j,j.prototype.name="TransformError";class F{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new o}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new j(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=n.p2.empty){let i=R(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new n.p2(n.HY.from(r),0,0))}delete(e,t){return this.replace(e,t,n.p2.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return!function(e,t,r,i){if(!i.size)return e.deleteRange(t,r);let l=e.doc.resolve(t),o=e.doc.resolve(r);if(D(l,o,i))return e.step(new m(t,r,i));let s=L(l,e.doc.resolve(r));0==s[s.length-1]&&s.pop();let a=-(l.depth+1);s.unshift(a);for(let e=l.depth,t=l.pos-1;e>0;e--,t--){let r=l.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;s.indexOf(e)>-1?a=e:l.before(e)==t&&s.splice(1,0,-e)}let u=s.indexOf(a),c=[],d=i.openStart;for(let e=i.content,t=0;;t++){let r=e.firstChild;if(c.push(r),t==i.openStart)break;e=r.content}for(let e=d-1;e>=0;e--){var h;let t=c[e],r=(h=t.type).spec.defining||h.spec.definingForContent;if(r&&!t.sameMarkup(l.node(Math.abs(a)-1)))d=e;else if(r||!t.type.isTextblock)break}for(let t=i.openStart;t>=0;t--){let a=(t+d+1)%(i.openStart+1),h=c[a];if(h)for(let t=0;tl){let e=o.contentMatchAt(0),r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(n.HY.empty,!0))}return t}(i.content,0,i.openStart,a),a,i.openEnd))}}let p=e.steps.length;for(let n=s.length-1;n>=0&&(e.replace(t,r,i),!(e.steps.length>p));n--){let e=s[n];e<0||(t=l.before(e),r=o.after(e))}}(this,e,t,r),this}replaceRangeWith(e,t,r){return!function(e,t,r,i){if(!i.isInline&&t==r&&e.doc.resolve(t).parent.content.size){let n=function(e,t,r){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),r))return t;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let t=n.index(e);if(n.node(e).canReplaceWith(t,t,r))return n.before(e+1);if(t>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let t=n.indexAfter(e);if(n.node(e).canReplaceWith(t,t,r))return n.after(e+1);if(t0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let l=1;l<=n.depth&&l<=i.depth;l++)if(t-n.start(l)==n.depth-l&&r>n.end(l)&&i.end(l)-r!=i.depth-l)return e.delete(n.before(l),r);e.delete(t,r)}(this,e,t),this}lift(e,t){return!function(e,t,r){let{$from:i,$to:l,depth:o}=t,s=i.before(o+1),a=l.after(o+1),u=s,c=a,d=n.HY.empty,h=0;for(let e=o,t=!1;e>r;e--)t||i.index(e)>0?(t=!0,d=n.HY.from(i.node(e).copy(d)),h++):u--;let p=n.HY.empty,f=0;for(let e=o,t=!1;e>r;e--)t||l.after(e+1)=0;e--){if(i.size){let t=r[e].type.contentMatch.matchFragment(i);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=n.HY.from(r[e].type.create(r[e].attrs,i))}let l=t.start,o=t.end;e.step(new g(l,o,l,o,new n.p2(i,0,0),r.length,!0))}(this,e,t),this}setBlockType(e,t=e,r,i=null){return!function(e,t,r,i,l){if(!i.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,r,(t,r)=>{var s,a,u;let c,d;if(t.isTextblock&&!t.hasMarkup(i,l)&&(s=e.doc,a=e.mapping.slice(o).map(r),u=i,d=(c=s.resolve(a)).index(),c.parent.canReplaceWith(d,d+1,u))){let s=null;if(i.schema.linebreakReplacement){let e="pre"==i.whitespace,t=!!i.contentMatch.matchType(i.schema.linebreakReplacement);e&&!t?s=!1:!e&&t&&(s=!0)}!1===s&&function(e,t,r,n){t.forEach((i,l)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+l);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}(e,t,r,o),y(e,e.mapping.slice(o).map(r,1),i,void 0,null===s);let a=e.mapping.slice(o),u=a.map(r,1),c=a.map(r+t.nodeSize,1);return e.step(new g(u,c,u+1,c-1,new n.p2(n.HY.from(i.create(l,null,t.marks)),0,0),1,!0)),!0===s&&function(e,t,r,n){t.forEach((i,l)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(n).map(r+1+l+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}(e,t,r,o),!1}})}(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return!function(e,t,r,i,l){let o=e.doc.nodeAt(t);if(!o)throw RangeError("No node at given position");r||(r=o.type);let s=r.create(i,null,l||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!r.validContent(o.content))throw RangeError("Invalid content for node type "+r.name);e.step(new g(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new n.p2(n.HY.from(s),0,0),1,!0))}(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new z(e,t,r)),this}setDocAttribute(e,t){return this.step(new J(e,t)),this}addNodeMark(e,t){return this.step(new p(e,t)),this}removeNodeMark(e,t){if(!(t instanceof n.vc)){let r=this.doc.nodeAt(e);if(!r)throw RangeError("No node at position "+e);if(!(t=t.isInSet(r.marks)))return this}return this.step(new f(e,t)),this}split(e,t=1,r){return!function(e,t,r=1,i){let l=e.doc.resolve(t),o=n.HY.empty,s=n.HY.empty;for(let e=l.depth,t=l.depth-r,a=r-1;e>t;e--,a--){o=n.HY.from(l.node(e).copy(o));let t=i&&i[a];s=n.HY.from(t?t.type.create(t.attrs,s):l.node(e).copy(s))}e.step(new m(t,t,new n.p2(o.append(s),r,r),!0))}(this,e,t,r),this}addMark(e,t,r){var n;let i,l,o,s;return n=this,o=[],s=[],n.doc.nodesBetween(e,t,(n,a,u)=>{if(!n.isInline)return;let c=n.marks;if(!r.isInSet(c)&&u.type.allowsMarkType(r.type)){let u=Math.max(a,e),p=Math.min(a+n.nodeSize,t),f=r.addToSet(c);for(let e=0;en.step(e)),s.forEach(e=>n.step(e)),this}removeMark(e,t,r){var i;let l,o;return i=this,l=[],o=0,i.doc.nodesBetween(e,t,(i,s)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof n.ZU){let e=i.marks,t;for(;t=r.isInSet(e);)(a||(a=[])).push(t),e=t.removeFromSet(e)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let r=Math.min(s+i.nodeSize,t);for(let t=0;ti.step(new h(e.from,e.to,e.style))),this}clearIncompatible(e,t,r){return y(this,e,t,r),this}}}}]);