@valbuild/ui 0.72.2 → 0.72.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -363,7 +363,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
363
363
|
To pick up a draggable item, press the space bar.
|
|
364
364
|
While dragging, use the arrow keys to move the item.
|
|
365
365
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
366
|
-
`},BK={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function VK(e){let{announcements:t=BK,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=$K}=e;const{announce:i,announcement:s}=LK(),a=Ip("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),FK(g.useMemo(()=>({onDragStart(d){let{active:p}=d;i(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:h}=d;t.onDragMove&&i(t.onDragMove({active:p,over:h}))},onDragOver(d){let{active:p,over:h}=d;i(t.onDragOver({active:p,over:h}))},onDragEnd(d){let{active:p,over:h}=d;i(t.onDragEnd({active:p,over:h}))},onDragCancel(d){let{active:p,over:h}=d;i(t.onDragCancel({active:p,over:h}))}}),[i,t])),!l)return null;const u=ye.createElement(ye.Fragment,null,ye.createElement(IK,{id:r,value:o.draggable}),ye.createElement(DK,{id:a,announcement:s}));return n?Nr.createPortal(u,n):u}var Ft;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ft||(Ft={}));function lg(){}function hx(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function UK(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Do=Object.freeze({x:0,y:0});function SA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kA(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WK(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function WE(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function CA(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function HE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const HK=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=HE(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=SA(HE(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(kA)},KK=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=WE(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=WE(l),u=o.reduce((p,h,m)=>p+SA(c[m],h),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(kA)};function qK(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const GK=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=qK(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(WK)};function YK(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function EA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Do}function JK(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const XK=JK(1);function ZK(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function QK(e,t,n){const r=ZK(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const eq={ignoreTransform:!1};function wu(e,t){t===void 0&&(t=eq);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=hr(e).getComputedStyle(e);c&&(n=QK(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function KE(e){return wu(e,{ignoreTransform:!0})}function tq(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function nq(e,t){return t===void 0&&(t=hr(e).getComputedStyle(e)),t.position==="fixed"}function rq(e,t){t===void 0&&(t=hr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function jv(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(fS(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Rp(o)||xA(o)||n.includes(o))return n;const i=hr(e).getComputedStyle(o);return o!==e&&rq(o,i)&&n.push(o),nq(o,i)?n:r(o.parentNode)}return e?r(e):n}function _A(e){const[t]=jv(e,1);return t??null}function mx(e){return!Pv||!e?null:xu(e)?e:dS(e)?fS(e)||e===bu(e).scrollingElement?window:Rp(e)?e:null:null}function NA(e){return xu(e)?e.scrollX:e.scrollLeft}function OA(e){return xu(e)?e.scrollY:e.scrollTop}function ub(e){return{x:NA(e),y:OA(e)}}var Zt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Zt||(Zt={}));function TA(e){return!Pv||!e?!1:e===document.scrollingElement}function MA(e){const t={x:0,y:0},n=TA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const oq={x:.2,y:.2};function iq(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=oq);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=MA(e),h={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(h.y=Zt.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(h.y=Zt.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!p&&a>=t.right-v.width?(h.x=Zt.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=Zt.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:m}}function sq(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function PA(e){return e.reduce((t,n)=>Tc(t,ub(n)),Do)}function aq(e){return e.reduce((t,n)=>t+NA(n),0)}function lq(e){return e.reduce((t,n)=>t+OA(n),0)}function cq(e,t){if(t===void 0&&(t=wu),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);_A(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const uq=[["x",["left","right"],aq],["y",["top","bottom"],lq]];class mS{constructor(t,n){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;const r=jv(n),o=PA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of uq)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Bd{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function dq(e){const{EventTarget:t}=hr(e);return e instanceof t?e:bu(e)}function gx(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var $r;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($r||($r={}));function qE(e){e.preventDefault()}function fq(e){e.stopPropagation()}var Ue;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ue||(Ue={}));const jA={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter,Ue.Tab]},pq=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ue.Right:return{...n,x:n.x+25};case Ue.Left:return{...n,x:n.x-25};case Ue.Down:return{...n,y:n.y+25};case Ue.Up:return{...n,y:n.y-25}}};class gS{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Bd(bu(n)),this.windowListeners=new Bd(hr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($r.Resize,this.handleCancel),this.windowListeners.add($r.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($r.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&cq(r),n(Do)}handleKeyDown(t){if(hS(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=jA,coordinateGetter:s=pq,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Do;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=zf(d,u),h={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:b,isRight:w,isLeft:S,isBottom:k,maxScroll:C,minScroll:N}=MA(v),_=sq(v),O={x:Math.min(x===Ue.Right?_.right-_.width/2:_.right,Math.max(x===Ue.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(x===Ue.Down?_.bottom-_.height/2:_.bottom,Math.max(x===Ue.Down?_.top:_.top+_.height/2,d.y))},M=x===Ue.Right&&!w||x===Ue.Left&&!S,P=x===Ue.Down&&!k||x===Ue.Up&&!b;if(M&&O.x!==d.x){const D=v.scrollLeft+p.x,$=x===Ue.Right&&D<=C.x||x===Ue.Left&&D>=N.x;if($&&!p.y){v.scrollTo({left:D,behavior:a});return}$?h.x=v.scrollLeft-D:h.x=x===Ue.Right?v.scrollLeft-C.x:v.scrollLeft-N.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(P&&O.y!==d.y){const D=v.scrollTop+p.y,$=x===Ue.Down&&D<=C.y||x===Ue.Up&&D>=N.y;if($&&!p.x){v.scrollTo({top:D,behavior:a});return}$?h.y=v.scrollTop-D:h.y=x===Ue.Down?v.scrollTop-C.y:v.scrollTop-N.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,Tc(zf(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gS.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=jA,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function GE(e){return!!(e&&"distance"in e)}function YE(e){return!!(e&&"delay"in e)}class vS{constructor(t,n,r){var o;r===void 0&&(r=dq(t.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=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=bu(s),this.documentListeners=new Bd(this.document),this.listeners=new Bd(r),this.windowListeners=new Bd(hr(s)),this.initialCoordinates=(o=cb(i))!=null?o:Do,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($r.Resize,this.handleCancel),this.windowListeners.add($r.DragStart,qE),this.windowListeners.add($r.VisibilityChange,this.handleCancel),this.windowListeners.add($r.ContextMenu,qE),this.documentListeners.add($r.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(YE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(GE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add($r.Click,fq,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($r.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=cb(t))!=null?n:Do,c=zf(o,l);if(!r&&a){if(GE(a)){if(a.tolerance!=null&&gx(c,a.tolerance))return this.handleCancel();if(gx(c,a.distance))return this.handleStart()}if(YE(a)&&gx(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const hq={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class RA extends vS{constructor(t){const{event:n}=t,r=bu(n.target);super(t,hq,r)}}RA.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const mq={move:{name:"mousemove"},end:{name:"mouseup"}};var db;(function(e){e[e.RightClick=2]="RightClick"})(db||(db={}));class AA extends vS{constructor(t){super(t,mq,bu(t.event.target))}}AA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===db.RightClick?!1:(r==null||r({event:n}),!0)}}];const vx={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class IA extends vS{constructor(t){super(t,vx)}static setup(){return window.addEventListener(vx.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(vx.move.name,t)};function t(){}}}IA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Vd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Vd||(Vd={}));var cg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(cg||(cg={}));function gq(e){let{acceleration:t,activator:n=Vd.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=cg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const h=yq({delta:d,disabled:!i}),[m,v]=MK(),x=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case Vd.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Vd.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),k=g.useCallback(()=>{const N=S.current;if(!N)return;const _=x.current.x*b.current.x,O=x.current.y*b.current.y;N.scrollBy(_,O)},[]),C=g.useMemo(()=>a===cg.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const N of C){if((r==null?void 0:r(N))===!1)continue;const _=c.indexOf(N),O=u[_];if(!O)continue;const{direction:M,speed:P}=iq(N,O,w,t,p);for(const D of["x","y"])h[D][M[D]]||(P[D]=0,M[D]=0);if(P.x>0||P.y>0){v(),S.current=N,m(k,s),x.current=P,b.current=M;return}}x.current={x:0,y:0},b.current={x:0,y:0},v()},[t,k,r,v,i,s,JSON.stringify(w),JSON.stringify(h),m,c,C,u,JSON.stringify(p)])}const vq={x:{[Zt.Backward]:!1,[Zt.Forward]:!1},y:{[Zt.Backward]:!1,[Zt.Forward]:!1}};function yq(e){let{delta:t,disabled:n}=e;const r=lb(t);return Ap(o=>{if(n||!r||!o)return vq;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Zt.Backward]:o.x[Zt.Backward]||i.x===-1,[Zt.Forward]:o.x[Zt.Forward]||i.x===1},y:{[Zt.Backward]:o.y[Zt.Backward]||i.y===-1,[Zt.Forward]:o.y[Zt.Forward]||i.y===1}}},[n,t,r])}function xq(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ap(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function bq(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Bf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Bf||(Bf={}));var fb;(function(e){e.Optimized="optimized"})(fb||(fb={}));const JE=new Map;function wq(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),d=x(),p=Ff(d),h=g.useCallback(function(b){b===void 0&&(b=[]),!p.current&&s(w=>w===null?b:w.concat(b.filter(S=>!w.includes(S))))},[p]),m=g.useRef(null),v=Ap(b=>{if(d&&!n)return JE;if(!b||b===JE||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const k=S.node.current,C=k?new mS(l(k),k):null;S.rect.current=C,C&&w.set(S.id,C)}return w}return b},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||h()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{h(),m.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function x(){switch(c){case Bf.Always:return!1;case Bf.BeforeDragging:return n;default:return!n}}}function DA(e,t){return Ap(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Sq(e,t){return DA(e,t)}function kq(e){let{callback:t,disabled:n}=e;const r=pS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Rv(e){let{callback:t,disabled:n}=e;const r=pS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Cq(e){return new mS(wu(e),e)}function XE(e,t,n){t===void 0&&(t=Cq);const[r,o]=g.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=kq({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=Rv({callback:i});return ri(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function Eq(e){const t=DA(e);return EA(e,t)}const ZE=[];function _q(e){const t=g.useRef(e),n=Ap(r=>e?r&&r!==ZE&&e&&t.current&&e.parentNode===t.current.parentNode?r:jv(e):ZE,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function Nq(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=mx(i.target);s&&n(a=>a?(a.set(s,ub(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=mx(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,ub(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=mx(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Tc(i,s),Do):PA(e):Do,[e,t])}function QE(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==Do;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?zf(e,n.current):Do}function Oq(e){g.useEffect(()=>{if(!Pv)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Tq(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function LA(e){return g.useMemo(()=>e?tq(e):null,[e])}const e_=[];function Mq(e,t){t===void 0&&(t=wu);const[n]=e,r=LA(n?hr(n):null),[o,i]=g.useState(e_);function s(){i(()=>e.length?e.map(l=>TA(l)?r:new mS(t(l),l)):e_)}const a=Rv({callback:s});return ri(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function Pq(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Rp(t)?t:e}function jq(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(Rp(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),i=Rv({callback:o}),s=g.useCallback(c=>{const u=Pq(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=ag(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Rq=[{sensor:RA,options:{}},{sensor:gS,options:{}}],Aq={current:{}},Yh={draggable:{measure:KE},droppable:{measure:KE,strategy:Bf.WhileDragging,frequency:fb.Optimized},dragOverlay:{measure:wu}};class Ud extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Iq={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ud,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yh,measureDroppableContainers:lg,windowRect:null,measuringScheduled:!1},Dq={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:lg,draggableNodes:new Map,over:null,measureDroppableContainers:lg},Av=g.createContext(Dq),FA=g.createContext(Iq);function Lq(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ud}}}function Fq(e,t){switch(t.type){case Ft.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ft.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ft.DragEnd:case Ft.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ft.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ud(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Ft.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Ud(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case Ft.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ud(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function zq(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(Av),i=lb(r),s=lb(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!hS(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=RK(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function $q(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Bq(e){return g.useMemo(()=>({draggable:{...Yh.draggable,...e==null?void 0:e.draggable},droppable:{...Yh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Yh.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Vq(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ri(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=EA(u,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=_A(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const zA=g.createContext({...Do,scaleX:1,scaleY:1});var xs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xs||(xs={}));const Uq=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Rq,collisionDetection:d=GK,measuring:p,modifiers:h,...m}=t;const v=g.useReducer(Fq,void 0,Lq),[x,b]=v,[w,S]=zK(),[k,C]=g.useState(xs.Uninitialized),N=k===xs.Initialized,{draggable:{active:_,nodes:O,translate:M},droppable:{containers:P}}=x,D=_!=null?O.get(_):null,$=g.useRef({initial:null,translated:null}),U=g.useMemo(()=>{var Sn;return _!=null?{id:_,data:(Sn=D==null?void 0:D.data)!=null?Sn:Aq,rect:$}:null},[_,D]),K=g.useRef(null),[G,j]=g.useState(null),[T,E]=g.useState(null),R=Ff(m,Object.values(m)),A=Ip("DndDescribedBy",s),I=g.useMemo(()=>P.getEnabled(),[P]),F=Bq(p),{droppableRects:ce,measureDroppableContainers:pe,measuringScheduled:W}=wq(I,{dragging:N,dependencies:[M.x,M.y],config:F.droppable}),V=xq(O,_),z=g.useMemo(()=>T?cb(T):null,[T]),te=H4(),se=Sq(V,F.draggable.measure);Vq({activeNode:_!=null?O.get(_):null,config:te.layoutShiftCompensation,initialRect:se,measure:F.draggable.measure});const Y=XE(V,F.draggable.measure,se),Oe=XE(V?V.parentElement:null),ae=g.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Me=P.getNodeFor((n=ae.current.over)==null?void 0:n.id),rt=jq({measure:F.dragOverlay.measure}),sn=(r=rt.nodeRef.current)!=null?r:V,an=N?(o=rt.rect)!=null?o:Y:null,Fr=!!(rt.nodeRef.current&&rt.rect),bn=Eq(Fr?null:Y),An=LA(sn?hr(sn):null),wn=_q(N?Me??V:null),Al=Mq(wn),Oa=$q(h,{transform:{x:M.x-bn.x,y:M.y-bn.y,scaleX:1,scaleY:1},activatorEvent:T,active:U,activeNodeRect:Y,containerNodeRect:Oe,draggingNodeRect:an,over:ae.current.over,overlayNodeRect:rt.rect,scrollableAncestors:wn,scrollableAncestorRects:Al,windowRect:An}),kk=z?Tc(z,M):null,Ck=Nq(wn),F4=QE(Ck),z4=QE(Ck,[Y]),Il=Tc(Oa,F4),Dl=an?XK(an,Oa):null,Tu=U&&Dl?d({active:U,collisionRect:Dl,droppableRects:ce,droppableContainers:I,pointerCoordinates:kk}):null,Ek=CA(Tu,"id"),[Zi,_k]=g.useState(null),$4=Fr?Oa:Tc(Oa,z4),B4=YK($4,(i=Zi==null?void 0:Zi.rect)!=null?i:null,Y),py=g.useRef(null),Nk=g.useCallback((Sn,gr)=>{let{sensor:vr,options:Qi}=gr;if(K.current==null)return;const zr=O.get(K.current);if(!zr)return;const yr=Sn.nativeEvent,Vo=new vr({active:K.current,activeNode:zr,event:yr,options:Qi,context:ae,onAbort(ln){if(!O.get(ln))return;const{onDragAbort:Uo}=R.current,ui={id:ln};Uo==null||Uo(ui),w({type:"onDragAbort",event:ui})},onPending(ln,es,Uo,ui){if(!O.get(ln))return;const{onDragPending:Pu}=R.current,ts={id:ln,constraint:es,initialCoordinates:Uo,offset:ui};Pu==null||Pu(ts),w({type:"onDragPending",event:ts})},onStart(ln){const es=K.current;if(es==null)return;const Uo=O.get(es);if(!Uo)return;const{onDragStart:ui}=R.current,Mu={activatorEvent:yr,active:{id:es,data:Uo.data,rect:$}};Nr.unstable_batchedUpdates(()=>{ui==null||ui(Mu),C(xs.Initializing),b({type:Ft.DragStart,initialCoordinates:ln,active:es}),w({type:"onDragStart",event:Mu}),j(py.current),E(yr)})},onMove(ln){b({type:Ft.DragMove,coordinates:ln})},onEnd:Ll(Ft.DragEnd),onCancel:Ll(Ft.DragCancel)});py.current=Vo;function Ll(ln){return async function(){const{active:Uo,collisions:ui,over:Mu,scrollAdjustedTranslate:Pu}=ae.current;let ts=null;if(Uo&&Pu){const{cancelDrop:ju}=R.current;ts={activatorEvent:yr,active:Uo,collisions:ui,delta:Pu,over:Mu},ln===Ft.DragEnd&&typeof ju=="function"&&await Promise.resolve(ju(ts))&&(ln=Ft.DragCancel)}K.current=null,Nr.unstable_batchedUpdates(()=>{b({type:ln}),C(xs.Uninitialized),_k(null),j(null),E(null),py.current=null;const ju=ln===Ft.DragEnd?"onDragEnd":"onDragCancel";if(ts){const hy=R.current[ju];hy==null||hy(ts),w({type:ju,event:ts})}})}}},[O]),V4=g.useCallback((Sn,gr)=>(vr,Qi)=>{const zr=vr.nativeEvent,yr=O.get(Qi);if(K.current!==null||!yr||zr.dndKit||zr.defaultPrevented)return;const Vo={active:yr};Sn(vr,gr.options,Vo)===!0&&(zr.dndKit={capturedBy:gr.sensor},K.current=Qi,Nk(vr,gr))},[O,Nk]),Ok=bq(u,V4);Oq(u),ri(()=>{Y&&k===xs.Initializing&&C(xs.Initialized)},[Y,k]),g.useEffect(()=>{const{onDragMove:Sn}=R.current,{active:gr,activatorEvent:vr,collisions:Qi,over:zr}=ae.current;if(!gr||!vr)return;const yr={active:gr,activatorEvent:vr,collisions:Qi,delta:{x:Il.x,y:Il.y},over:zr};Nr.unstable_batchedUpdates(()=>{Sn==null||Sn(yr),w({type:"onDragMove",event:yr})})},[Il.x,Il.y]),g.useEffect(()=>{const{active:Sn,activatorEvent:gr,collisions:vr,droppableContainers:Qi,scrollAdjustedTranslate:zr}=ae.current;if(!Sn||K.current==null||!gr||!zr)return;const{onDragOver:yr}=R.current,Vo=Qi.get(Ek),Ll=Vo&&Vo.rect.current?{id:Vo.id,rect:Vo.rect.current,data:Vo.data,disabled:Vo.disabled}:null,ln={active:Sn,activatorEvent:gr,collisions:vr,delta:{x:zr.x,y:zr.y},over:Ll};Nr.unstable_batchedUpdates(()=>{_k(Ll),yr==null||yr(ln),w({type:"onDragOver",event:ln})})},[Ek]),ri(()=>{ae.current={activatorEvent:T,active:U,activeNode:V,collisionRect:Dl,collisions:Tu,droppableRects:ce,draggableNodes:O,draggingNode:sn,draggingNodeRect:an,droppableContainers:P,over:Zi,scrollableAncestors:wn,scrollAdjustedTranslate:Il},$.current={initial:an,translated:Dl}},[U,V,Tu,Dl,O,sn,an,ce,P,Zi,wn,Il]),gq({...te,delta:M,draggingRect:Dl,pointerCoordinates:kk,scrollableAncestors:wn,scrollableAncestorRects:Al});const U4=g.useMemo(()=>({active:U,activeNode:V,activeNodeRect:Y,activatorEvent:T,collisions:Tu,containerNodeRect:Oe,dragOverlay:rt,draggableNodes:O,droppableContainers:P,droppableRects:ce,over:Zi,measureDroppableContainers:pe,scrollableAncestors:wn,scrollableAncestorRects:Al,measuringConfiguration:F,measuringScheduled:W,windowRect:An}),[U,V,Y,T,Tu,Oe,rt,O,P,ce,Zi,pe,wn,Al,F,W,An]),W4=g.useMemo(()=>({activatorEvent:T,activators:Ok,active:U,activeNodeRect:Y,ariaDescribedById:{draggable:A},dispatch:b,draggableNodes:O,over:Zi,measureDroppableContainers:pe}),[T,Ok,U,Y,b,A,O,Zi,pe]);return ye.createElement(wA.Provider,{value:S},ye.createElement(Av.Provider,{value:W4},ye.createElement(FA.Provider,{value:U4},ye.createElement(zA.Provider,{value:B4},c)),ye.createElement(zq,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ye.createElement(VK,{...a,hiddenTextDescribedById:A}));function H4(){const Sn=(G==null?void 0:G.autoScrollEnabled)===!1,gr=typeof l=="object"?l.enabled===!1:l===!1,vr=N&&!Sn&&!gr;return typeof l=="object"?{...l,enabled:vr}:{enabled:vr}}}),Wq=g.createContext(null),t_="button",Hq="Draggable";function Kq(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ip(Hq),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=g.useContext(Av),{role:h=t_,roleDescription:m="draggable",tabIndex:v=0}=o??{},x=(l==null?void 0:l.id)===t,b=g.useContext(x?zA:Wq),[w,S]=ag(),[k,C]=ag(),N=Tq(s,t),_=Ff(n);ri(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:k,data:_}),()=>{const M=d.get(t);M&&M.key===i&&d.delete(t)}),[d,t]);const O=g.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&h===t_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,h,v,x,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:O,isDragging:x,listeners:r?void 0:N,node:w,over:p,setNodeRef:S,setActivatorNodeRef:C,transform:b}}function qq(){return g.useContext(FA)}const Gq="Droppable",Yq={timeout:25};function Jq(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ip(Gq),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(Av),u=g.useRef({disabled:n}),d=g.useRef(!1),p=g.useRef(null),h=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...Yq,...o},b=Ff(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),h.current=null},x)},[x]),S=Rv({callback:w,disabled:m||!s}),k=g.useCallback((O,M)=>{S&&(M&&(S.unobserve(M),d.current=!1),O&&S.observe(O))},[S]),[C,N]=ag(k),_=Ff(t);return g.useEffect(()=>{!S||!C.current||(S.disconnect(),d.current=!1,S.observe(C.current))},[C,S]),g.useEffect(()=>(a({type:Ft.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:p,data:_}}),()=>a({type:Ft.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:Ft.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:p,isOver:(l==null?void 0:l.id)===r,node:C,over:l,setNodeRef:N}}function yS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Xq(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ch(e){return e!==null&&e>=0}function Zq(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qq(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const $A=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=yS(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Eh={scaleX:1,scaleY:1},eG=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...Eh}:null}const l=tG(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Eh}:o<n&&o>=s?{x:0,y:a.height+l,...Eh}:{x:0,y:0,...Eh}};function tG(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const BA="Sortable",VA=ye.createContext({activeIndex:-1,containerId:BA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$A,disabled:{draggable:!1,droppable:!1}});function nG(e){let{children:t,id:n,items:r,strategy:o=$A,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=qq(),d=Ip(BA,n),p=a.rect!==null,h=g.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),m=s!=null,v=s?h.indexOf(s.id):-1,x=c?h.indexOf(c.id):-1,b=g.useRef(h),w=!Zq(h,b.current),S=x!==-1&&v===-1||w,k=Qq(i);ri(()=>{w&&m&&u(h)},[w,h,m,u]),g.useEffect(()=>{b.current=h},[h]);const C=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:k,disableTransforms:S,items:h,overIndex:x,useDragOverlay:p,sortedRects:Xq(h,l),strategy:o}),[v,d,k.draggable,k.droppable,S,h,x,l,p,o]);return ye.createElement(VA.Provider,{value:C},t)}const rG=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return yS(n,r,o).indexOf(t)},oG=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},iG={duration:200,easing:"ease"},UA="transform",sG=$f.Transition.toString({property:UA,duration:0,easing:"linear"}),aG={roleDescription:"sortable"};function lG(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return ri(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=wu(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function cG(e){let{animateLayoutChanges:t=oG,attributes:n,disabled:r,data:o,getNewIndex:i=rG,id:s,strategy:a,resizeObserverConfig:l,transition:c=iG}=e;const{items:u,containerId:d,activeIndex:p,disabled:h,disableTransforms:m,sortedRects:v,overIndex:x,useDragOverlay:b,strategy:w}=g.useContext(VA),S=uG(r,h),k=u.indexOf(s),C=g.useMemo(()=>({sortable:{containerId:d,index:k,items:u},...o}),[d,o,k,u]),N=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:O,isOver:M,setNodeRef:P}=Jq({id:s,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...l}}),{active:D,activatorEvent:$,activeNodeRect:U,attributes:K,setNodeRef:G,listeners:j,isDragging:T,over:E,setActivatorNodeRef:R,transform:A}=Kq({id:s,data:C,attributes:{...aG,...n},disabled:S.draggable}),I=TK(P,G),F=!!D,ce=F&&!m&&Ch(p)&&Ch(x),pe=!b&&T,W=pe&&ce?A:null,z=ce?W??(a??w)({rects:v,activeNodeRect:U,activeIndex:p,overIndex:x,index:k}):null,te=Ch(p)&&Ch(x)?i({id:s,items:u,activeIndex:p,overIndex:x}):k,se=D==null?void 0:D.id,Y=g.useRef({activeId:se,items:u,newIndex:te,containerId:d}),Oe=u!==Y.current.items,ae=t({active:D,containerId:d,isDragging:T,isSorting:F,id:s,index:k,items:u,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:c,wasDragging:Y.current.activeId!=null}),Me=lG({disabled:!ae,index:k,node:O,rect:_});return g.useEffect(()=>{F&&Y.current.newIndex!==te&&(Y.current.newIndex=te),d!==Y.current.containerId&&(Y.current.containerId=d),u!==Y.current.items&&(Y.current.items=u)},[F,te,d,u]),g.useEffect(()=>{if(se===Y.current.activeId)return;if(se&&!Y.current.activeId){Y.current.activeId=se;return}const sn=setTimeout(()=>{Y.current.activeId=se},50);return()=>clearTimeout(sn)},[se]),{active:D,activeIndex:p,attributes:K,data:C,rect:_,index:k,newIndex:te,items:u,isOver:M,isSorting:F,isDragging:T,listeners:j,node:O,overIndex:x,over:E,setNodeRef:I,setActivatorNodeRef:R,setDroppableNodeRef:P,setDraggableNodeRef:G,transform:Me??z,transition:rt()};function rt(){if(Me||Oe&&Y.current.newIndex===k)return sG;if(!(pe&&!hS($)||!c)&&(F||ae))return $f.Transition.toString({...c,property:UA})}}function uG(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function ug(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const dG=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],fG=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(dG.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=o.get(d.id);if(p)switch(e.code){case Ue.Down:r.top<p.top&&l.push(d);break;case Ue.Up:r.top>p.top&&l.push(d);break;case Ue.Left:r.left>p.left&&l.push(d);break;case Ue.Right:r.left<p.left&&l.push(d);break}});const c=KK({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=CA(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),p=i.get(u),h=p?o.get(p.id):null,m=p==null?void 0:p.node.current;if(m&&h&&d&&p){const x=jv(m).some((N,_)=>a[_]!==N),b=WA(d,p),w=pG(d,p),S=x||!b?{x:0,y:0}:{x:w?r.width-h.width:0,y:w?r.height-h.height:0},k={x:h.left,y:h.top};return S.x&&S.y?k:zf(k,S)}}}};function WA(e,t){return!ug(e)||!ug(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function pG(e,t){return!ug(e)||!ug(t)||!WA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Su=g.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:Fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Su.displayName="Input";function Rr({path:e}){const{validationErrors:t}=Gi(),n=fr(),r=[];for(const o in t)o.startsWith(e)&&r.push(...t[o].map(i=>({...i,path:o})));return r.length===0?null:r.length===1?f.jsxs("div",{className:"p-4 font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx("div",{children:r[0].message}),e!==r[0].path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at"," ",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(r[0].path)},children:r[0].path})]})]}):f.jsx(cS,{type:"single",collapsible:!0,children:f.jsxs(If,{value:"validation-errors",className:"font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx(Df,{className:"p-4",children:f.jsxs("div",{className:"flex justify-between w-full",children:[f.jsx("span",{className:"truncate",children:"Multiple validation errors"}),f.jsxs("span",{className:"pr-4",children:["(",r.length,")"]})]})}),f.jsx(Lf,{children:r.map(o=>f.jsxs("div",{className:"px-4",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]},o.path))})]})})}function HA({path:e,autoFocus:t}){const n="string",r=Ct(e),o=Je(e,n),{patchPath:i,addDebouncedPatch:s}=yn(e),[a,l]=g.useState(!1),[c,u]=g.useState(null);return g.useEffect(()=>{!a&&"data"in o&&o.data!==void 0&&u(o.data)},["data"in o&&o.data,a]),g.useEffect(()=>{if("data"in o&&o.data!==void 0&&c!==null&&o.data!==c){const d=setTimeout(()=>{console.warn(`Mis-matched strings: '${o.data}' and '${c}'. Patching...`),s(()=>[{op:"replace",path:i,value:c}],e)},3e3);return()=>{clearTimeout(d)}}},["data"in o&&o.data,c]),r.status==="error"?f.jsx(Rt,{path:e,error:r.error,type:n}):o.status==="error"?f.jsx(qe,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?f.jsx(vn,{path:e,type:n}):r.status==="loading"?f.jsx(nt,{path:e,type:n}):!("data"in o)||o.data===void 0?f.jsx(nt,{path:e,type:n}):r.data.type!==n?f.jsx(pr,{path:e,expectedType:n,actualType:r.data.type}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsxs("div",{className:"relative w-full",children:[f.jsx(Su,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,onFocus:()=>{l(!0)},onBlur:()=>{l(!1)},value:c||"",onChange:d=>{u(d.target.value),s(()=>[{op:"replace",path:i,value:d.target.value}],e)}}),f.jsx("span",{className:xe("absolute right-0 -translate-x-full top-4 duration-1000",{"opacity-0":o.data===c,"opacity-100":o.data!==c}),children:f.jsx(hu,{className:"transition-opacity animate-spin",size:12})})]})]})}function hG({path:e}){const t=Je(e,"string");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function mG({path:e}){const t="boolean",n=Ct(e),r=Je(e,t),{patchPath:o,addPatch:i}=yn(e);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(Pp,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}])}})]})}function gG({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=yn(e);return typeof t!="boolean"&&t!==null?f.jsx(qe,{path:e,error:"Expected boolean",type:"boolean"}):f.jsx(Pp,{disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}])}})}function vG({path:e}){const t=Je(e,"boolean");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):t.data===!0?f.jsx("div",{className:"flex items-center justify-center w-4 h-4 border rounded border-text-primary",children:f.jsx(wp,{className:"w-3 h-3"})}):t.data===!1?f.jsx("div",{className:"w-4 h-4 border rounded border-text-primary"}):(console.warn("Unexpected value for boolean field",t.data),f.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function yG({path:e}){const t="number",n=Ct(e),r=Je(e,t),{patchPath:o,addPatch:i}=yn(e);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(Su,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}])}})]})}function xG({path:e}){const t=Je(e,"number");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}var bG="VisuallyHidden",KA=g.forwardRef((e,t)=>f.jsx(ke.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));KA.displayName=bG;var wG=[" ","Enter","ArrowUp","ArrowDown"],SG=[" ","Enter"],Dp="Select",[Iv,Dv,kG]=Ov(Dp),[ku,Ope]=$o(Dp,[kG,wa]),Lv=wa(),[CG,ka]=ku(Dp),[EG,_G]=ku(Dp),qA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:h,form:m}=e,v=Lv(t),[x,b]=g.useState(null),[w,S]=g.useState(null),[k,C]=g.useState(!1),N=kp(c),[_=!1,O]=Qr({prop:r,defaultProp:o,onChange:i}),[M,P]=Qr({prop:s,defaultProp:a,onChange:l}),D=g.useRef(null),$=x?m||!!x.closest("form"):!0,[U,K]=g.useState(new Set),G=Array.from(U).map(j=>j.props.value).join(";");return f.jsx(wv,{...v,children:f.jsxs(CG,{required:h,scope:t,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:Gr(),value:M,onValueChange:P,open:_,onOpenChange:O,dir:N,triggerPointerDownPosRef:D,disabled:p,children:[f.jsx(Iv.Provider,{scope:t,children:f.jsx(EG,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(j=>{K(T=>new Set(T).add(j))},[]),onNativeOptionRemove:g.useCallback(j=>{K(T=>{const E=new Set(T);return E.delete(j),E})},[]),children:n})}),$?f.jsxs(g2,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:M,onChange:j=>P(j.target.value),disabled:p,form:m,children:[M===void 0?f.jsx("option",{value:""}):null,Array.from(U)]},G):null]})})};qA.displayName=Dp;var GA="SelectTrigger",YA=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Lv(n),s=ka(GA,n),a=s.disabled||r,l=Ie(t,s.onTriggerChange),c=Dv(n),u=g.useRef("touch"),[d,p,h]=v2(v=>{const x=c().filter(S=>!S.disabled),b=x.find(S=>S.value===s.value),w=y2(x,v,b);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),h()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return f.jsx(_p,{asChild:!0,...i,children:f.jsx(ke.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":m2(s.value)?"":void 0,...o,ref:l,onClick:Q(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:Q(o.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:Q(o.onKeyDown,v=>{const x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&p(v.key),!(x&&v.key===" ")&&wG.includes(v.key)&&(m(),v.preventDefault())})})})});YA.displayName=GA;var JA="SelectValue",XA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=ka(JA,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Ie(t,l.onValueNodeChange);return gn(()=>{c(u)},[c,u]),f.jsx(ke.span,{...a,ref:d,style:{pointerEvents:"none"},children:m2(l.value)?f.jsx(f.Fragment,{children:s}):i})});XA.displayName=JA;var NG="SelectIcon",ZA=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});ZA.displayName=NG;var OG="SelectPortal",QA=e=>f.jsx(Np,{asChild:!0,...e});QA.displayName=OG;var gl="SelectContent",e2=g.forwardRef((e,t)=>{const n=ka(gl,e.__scopeSelect),[r,o]=g.useState();if(gn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Nr.createPortal(f.jsx(t2,{scope:e.__scopeSelect,children:f.jsx(Iv.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),i):null}return f.jsx(n2,{...e,ref:t})});e2.displayName=gl;var po=10,[t2,Ca]=ku(gl),TG="SelectContentImpl",n2=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:x,...b}=e,w=ka(gl,n),[S,k]=g.useState(null),[C,N]=g.useState(null),_=Ie(t,z=>k(z)),[O,M]=g.useState(null),[P,D]=g.useState(null),$=Dv(n),[U,K]=g.useState(!1),G=g.useRef(!1);g.useEffect(()=>{if(S)return Cv(S)},[S]),vv();const j=g.useCallback(z=>{const[te,...se]=$().map(ae=>ae.ref.current),[Y]=se.slice(-1),Oe=document.activeElement;for(const ae of z)if(ae===Oe||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===te&&C&&(C.scrollTop=0),ae===Y&&C&&(C.scrollTop=C.scrollHeight),ae==null||ae.focus(),document.activeElement!==Oe))return},[$,C]),T=g.useCallback(()=>j([O,S]),[j,O,S]);g.useEffect(()=>{U&&T()},[U,T]);const{onOpenChange:E,triggerPointerDownPosRef:R}=w;g.useEffect(()=>{if(S){let z={x:0,y:0};const te=Y=>{var Oe,ae;z={x:Math.abs(Math.round(Y.pageX)-(((Oe=R.current)==null?void 0:Oe.x)??0)),y:Math.abs(Math.round(Y.pageY)-(((ae=R.current)==null?void 0:ae.y)??0))}},se=Y=>{z.x<=10&&z.y<=10?Y.preventDefault():S.contains(Y.target)||E(!1),document.removeEventListener("pointermove",te),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",se,{capture:!0})}}},[S,E,R]),g.useEffect(()=>{const z=()=>E(!1);return window.addEventListener("blur",z),window.addEventListener("resize",z),()=>{window.removeEventListener("blur",z),window.removeEventListener("resize",z)}},[E]);const[A,I]=v2(z=>{const te=$().filter(Oe=>!Oe.disabled),se=te.find(Oe=>Oe.ref.current===document.activeElement),Y=y2(te,z,se);Y&&setTimeout(()=>Y.ref.current.focus())}),F=g.useCallback((z,te,se)=>{const Y=!G.current&&!se;(w.value!==void 0&&w.value===te||Y)&&(M(z),Y&&(G.current=!0))},[w.value]),ce=g.useCallback(()=>S==null?void 0:S.focus(),[S]),pe=g.useCallback((z,te,se)=>{const Y=!G.current&&!se;(w.value!==void 0&&w.value===te||Y)&&D(z)},[w.value]),W=r==="popper"?pb:r2,V=W===pb?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return f.jsx(t2,{scope:n,content:S,viewport:C,onViewportChange:N,itemRefCallback:F,selectedItem:O,onItemLeave:ce,itemTextRefCallback:pe,focusSelectedItem:T,selectedItemText:P,position:r,isPositioned:U,searchRef:A,children:f.jsx(Op,{as:$i,allowPinchZoom:!0,children:f.jsx(Cp,{asChild:!0,trapped:w.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:Q(o,z=>{var te;(te=w.trigger)==null||te.focus({preventScroll:!0}),z.preventDefault()}),children:f.jsx(gu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:z=>z.preventDefault(),...b,...V,onPlaced:()=>K(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Q(b.onKeyDown,z=>{const te=z.ctrlKey||z.altKey||z.metaKey;if(z.key==="Tab"&&z.preventDefault(),!te&&z.key.length===1&&I(z.key),["ArrowUp","ArrowDown","Home","End"].includes(z.key)){let Y=$().filter(Oe=>!Oe.disabled).map(Oe=>Oe.ref.current);if(["ArrowUp","End"].includes(z.key)&&(Y=Y.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const Oe=z.target,ae=Y.indexOf(Oe);Y=Y.slice(ae+1)}setTimeout(()=>j(Y)),z.preventDefault()}})})})})})})});n2.displayName=TG;var MG="SelectItemAlignedPosition",r2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=ka(gl,n),s=Ca(gl,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=Ie(t,_=>u(_)),p=Dv(n),h=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&x&&b){const _=i.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),P=b.getBoundingClientRect();if(i.dir!=="rtl"){const Oe=P.left-O.left,ae=M.left-Oe,Me=_.left-ae,rt=_.width+Me,sn=Math.max(rt,O.width),an=window.innerWidth-po,Fr=H0(ae,[po,Math.max(po,an-sn)]);a.style.minWidth=rt+"px",a.style.left=Fr+"px"}else{const Oe=O.right-P.right,ae=window.innerWidth-M.right-Oe,Me=window.innerWidth-_.right-ae,rt=_.width+Me,sn=Math.max(rt,O.width),an=window.innerWidth-po,Fr=H0(ae,[po,Math.max(po,an-sn)]);a.style.minWidth=rt+"px",a.style.right=Fr+"px"}const D=p(),$=window.innerHeight-po*2,U=v.scrollHeight,K=window.getComputedStyle(c),G=parseInt(K.borderTopWidth,10),j=parseInt(K.paddingTop,10),T=parseInt(K.borderBottomWidth,10),E=parseInt(K.paddingBottom,10),R=G+j+U+E+T,A=Math.min(x.offsetHeight*5,R),I=window.getComputedStyle(v),F=parseInt(I.paddingTop,10),ce=parseInt(I.paddingBottom,10),pe=_.top+_.height/2-po,W=$-pe,V=x.offsetHeight/2,z=x.offsetTop+V,te=G+j+z,se=R-te;if(te<=pe){const Oe=D.length>0&&x===D[D.length-1].ref.current;a.style.bottom="0px";const ae=c.clientHeight-v.offsetTop-v.offsetHeight,Me=Math.max(W,V+(Oe?ce:0)+ae+T),rt=te+Me;a.style.height=rt+"px"}else{const Oe=D.length>0&&x===D[0].ref.current;a.style.top="0px";const Me=Math.max(pe,G+v.offsetTop+(Oe?F:0)+V)+se;a.style.height=Me+"px",v.scrollTop=te-pe+v.offsetTop}a.style.margin=`${po}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,a,c,v,x,b,i.dir,r]);gn(()=>S(),[S]);const[k,C]=g.useState();gn(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const N=g.useCallback(_=>{_&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return f.jsx(jG,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:N,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:f.jsx(ke.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});r2.displayName=MG;var PG="SelectPopperPosition",pb=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=po,...i}=e,s=Lv(n);return f.jsx(Sv,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pb.displayName=PG;var[jG,xS]=ku(gl,{}),hb="SelectViewport",o2=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Ca(hb,n),s=xS(hb,n),a=Ie(t,i.onViewportChange),l=g.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(Iv.Slot,{scope:n,children:f.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Q(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=s;if(p!=null&&p.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const m=window.innerHeight-po*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),b=Math.max(v,x);if(b<m){const w=b+h,S=Math.min(m,w),k=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});o2.displayName=hb;var i2="SelectGroup",[RG,AG]=ku(i2),IG=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Gr();return f.jsx(RG,{scope:n,id:o,children:f.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});IG.displayName=i2;var s2="SelectLabel",a2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=AG(s2,n);return f.jsx(ke.div,{id:o.id,...r,ref:t})});a2.displayName=s2;var dg="SelectItem",[DG,l2]=ku(dg),c2=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=ka(dg,n),l=Ca(dg,n),c=a.value===r,[u,d]=g.useState(i??""),[p,h]=g.useState(!1),m=Ie(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Gr(),x=g.useRef("touch"),b=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(DG,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx(Iv.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(ke.div,{role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:Q(s.onFocus,()=>h(!0)),onBlur:Q(s.onBlur,()=>h(!1)),onClick:Q(s.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:Q(s.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:Q(s.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:Q(s.onPointerMove,w=>{var S;x.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Q(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:Q(s.onKeyDown,w=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&w.key===" "||(SG.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});c2.displayName=dg;var sd="SelectItemText",u2=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=ka(sd,n),a=Ca(sd,n),l=l2(sd,n),c=_G(sd,n),[u,d]=g.useState(null),p=Ie(t,b=>d(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,l.value,l.disabled)}),h=u==null?void 0:u.textContent,m=g.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return gn(()=>(v(m),()=>x(m)),[v,x,m]),f.jsxs(f.Fragment,{children:[f.jsx(ke.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Nr.createPortal(i.children,s.valueNode):null]})});u2.displayName=sd;var d2="SelectItemIndicator",f2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l2(d2,n).isSelected?f.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});f2.displayName=d2;var mb="SelectScrollUpButton",LG=g.forwardRef((e,t)=>{const n=Ca(mb,e.__scopeSelect),r=xS(mb,e.__scopeSelect),[o,i]=g.useState(!1),s=Ie(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx(p2,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});LG.displayName=mb;var gb="SelectScrollDownButton",FG=g.forwardRef((e,t)=>{const n=Ca(gb,e.__scopeSelect),r=xS(gb,e.__scopeSelect),[o,i]=g.useState(!1),s=Ie(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx(p2,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});FG.displayName=gb;var p2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Ca("SelectScrollButton",n),s=g.useRef(null),a=Dv(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),gn(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),f.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Q(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Q(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Q(o.onPointerLeave,()=>{l()})})}),zG="SelectSeparator",h2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});h2.displayName=zG;var vb="SelectArrow",$G=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Lv(n),i=ka(vb,n),s=Ca(vb,n);return i.open&&s.position==="popper"?f.jsx(kv,{...o,...r,ref:t}):null});$G.displayName=vb;function m2(e){return e===""||e===void 0}var g2=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=Ie(t,o),s=V1(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const d=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(d)}},[s,n]),f.jsx(KA,{asChild:!0,children:f.jsx("select",{...r,ref:i,defaultValue:n})})});g2.displayName="BubbleSelect";function v2(e){const t=$t(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function y2(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=BG(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function BG(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var x2=qA,bS=YA,VG=XA,UG=ZA,WG=QA,wS=e2,b2=o2,w2=a2,SS=c2,S2=u2,HG=f2,k2=h2;const kS=x2,CS=VG,Fv=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(bS,{ref:r,className:Fe("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-bg-primary px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(UG,{asChild:!0,children:f.jsx(Sp,{className:"w-4 h-4 opacity-50"})})]}));Fv.displayName=bS.displayName;const zv=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>f.jsx(WG,{container:r,children:f.jsx(wS,{ref:i,className:Fe("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:f.jsx(b2,{className:Fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));zv.displayName=wS.displayName;const KG=g.forwardRef(({className:e,...t},n)=>f.jsx(w2,{ref:n,className:Fe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));KG.displayName=w2.displayName;const $v=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(SS,{ref:r,className:Fe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-text-primary outline-none focus:bg-bg-brand-primary_alt focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(HG,{children:f.jsx(wp,{className:"w-4 h-4"})})}),f.jsx(S2,{children:t})]}));$v.displayName=SS.displayName;const qG=g.forwardRef(({className:e,...t},n)=>f.jsx(k2,{ref:n,className:Fe("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));qG.displayName=k2.displayName;function vl(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,vl(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?vl(e.items[0]):e.key.value;if(e.type==="date")return qi(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function el(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function GG(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function YG({children:e}){return f.jsx("div",{children:GG(e)})}function C2(e){const[t,n]=ue.splitModuleFilePathAndModulePath(e),r=ue.joinModuleFilePathAndModulePath(t,ue.splitModulePath(n).slice(0,-1).join(".")),o=Ct(r);return{path:r,schema:"data"in o?o.data:void 0}}const n_=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",JG=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",XG=e=>(e==null?void 0:e.type)==="record",ZG=e=>(e==null?void 0:e.type)==="array";function QG(e,t,n,r){if(!t[n])return console.error(`Source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,d)=>{var p;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof d=="string"&&d===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(o_(d)||E2(d))for(const h in d){const m=d==null?void 0:d[h],v=u.type==="object"?(p=u.items)==null?void 0:p[h]:u.item;m&&l(r_(c,h),v,m)}}else if(u.type==="array"){if(eY(d)){let h=0;for(const m of d)l(r_(c,h),u.item,m),h++}}else if(u.type==="union"){const h=u.key;if(typeof h=="string"&&o_(d)){const m=d[h];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[h];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,d)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function r_(e,t){return e.includes(ea)?`${e}.${JSON.stringify(t)}`:`${e}${ea}${JSON.stringify(t)}`}function o_(e){return E2(e)}function E2(e){return typeof e=="object"&&!!e&&!js(e)}function eY(e){return typeof e=="object"&&!!e&&js(e)}function ES({path:e,disabled:t}){const[n,r]=ue.splitModuleFilePathAndModulePath(e),o=ue.splitModuleFilePath(n),i=ue.splitModulePath(r),{navigate:s}=fr();return f.jsxs("div",{className:"w-full",children:[f.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>f.jsxs(g.Fragment,{children:[l===0&&f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:xe({"text-muted":!(i.length===0&&l===o.length-1)}),children:ia(a)}),l>0&&l<o.length-1&&f.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),f.jsx("button",{type:"button",disabled:t,title:ue.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(ue.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:xe({"text-muted":l===i.length-2}),children:ia(a)})]},`${a}-${l}`))})]})}function _2({path:e,variant:t}){const n=Ct(e),{path:r,schema:o}=C2(e),i=N2(e),s=i[i.length-1],a=oY(r,n_(e,r,o)?s==null?void 0:s.part:void 0);return f.jsxs("span",{className:"inline-flex items-center gap-2",children:[n_(e,r,o)&&f.jsxs(f.Fragment,{children:[f.jsx(i_,{refs:a,variant:t}),f.jsx(rY,{defaultValue:s.text,path:e,parentPath:r,variant:t,refs:a}),f.jsx(nY,{path:e,parentPath:r,variant:t,refs:a})]}),ZG("data"in n?n.data:void 0)&&f.jsx(tY,{path:e,variant:t}),XG("data"in n?n.data:void 0)&&f.jsxs(f.Fragment,{children:[f.jsx(i_,{refs:a,variant:t}),f.jsx(iY,{path:e,variant:t})]})]})}function i_({refs:e,variant:t}){const n=no();return e.length===0?null:f.jsxs(ca,{children:[f.jsxs(Nc,{children:[f.jsx(Oc,{children:f.jsx(Ut,{asChild:!0,size:Lp(t),variant:Fp(t),children:f.jsx(Mp,{children:f.jsx(NP,{size:Bv(t)})})})}),f.jsx(Qa,{side:"top",children:"References to this record"})]}),f.jsx(Ui,{container:n,children:f.jsx("div",{className:"text-sm",children:f.jsx("ul",{children:e.map(r=>f.jsx("li",{children:f.jsx(ES,{path:r})},r))})})})]})}function Bv(e){return e==="module"?16:12}function Lp(e){return"icon"}function Fp(e){return e==="module"?"outline":"ghost"}function tY({path:e,variant:t}){const{navigate:n}=fr(),{addPatch:r,patchPath:o}=yn(e),i=Ct(e),s=Je(e,"array"),[a]=ue.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return f.jsx(Ut,{title:"Add",size:Lp(t),variant:Fp(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:vl(l.item)}]),l.item.type!=="string"&&n(ue.joinModuleFilePathAndModulePath(a,ue.patchPathToModulePath(u)))},children:f.jsx(_P,{size:Bv(t)})})}function nY({path:e,parentPath:t,variant:n,refs:r}){const{navigate:o}=fr(),{addPatch:i,patchPath:s}=yn(e),a=Je(t,"record");return!("data"in a)||a.data===void 0||a.data===null?(console.error("Parent source not found",a,{path:e}),null):f.jsxs(Nc,{children:[f.jsx(Oc,{children:f.jsx(Ut,{size:Lp(n),variant:Fp(n),disabled:r.length>0,onClick:()=>{i([{op:"remove",path:s}]),o(t)},children:f.jsx($9,{size:Bv(n)})})}),f.jsx(Qa,{side:"top",children:r.length>0?f.jsxs("div",{children:[f.jsx("p",{children:"Cannot delete record."}),f.jsxs("p",{children:["You must change the following references"," ",f.jsx(NP,{size:10,className:"inline"})," to be able to delete:"]}),f.jsx("ul",{children:r.map(l=>f.jsx("li",{children:f.jsx(ES,{path:l})},l))})]}):f.jsx("p",{children:"Delete record"})})]})}function rY({defaultValue:e,path:t,parentPath:n,variant:r,refs:o}){const[i,s]=ue.splitModuleFilePathAndModulePath(n),{navigate:a}=fr(),{addPatch:l,addModuleFilePatch:c}=yn(t),u=Je(n,"record"),[d,p]=g.useState(e),[h,m]=g.useState(!1),v=no();g.useEffect(()=>{const w=S=>{S.key==="Escape"&&m(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const x=ue.createPatchPath(s);if(!("data"in u)||u.data===void 0||u.data===null)return console.error("Parent source not found",u,{path:t}),null;const b=d===e||d===""||d in u.data;return f.jsxs(ca,{open:h,children:[f.jsxs(Nc,{children:[f.jsx(Oc,{children:f.jsx(Ut,{asChild:!0,size:Lp(r),variant:Fp(r),children:f.jsx(Mp,{onClick:()=>{m(!0)},children:f.jsx(D9,{size:16})})})}),f.jsx(Qa,{side:"top",children:"Change name"})]}),f.jsx(Ui,{container:v,className:"text-text-primary",children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:w=>{w.preventDefault();const S=[{op:"move",from:x.concat(e),path:x.concat(d)}];l(S);for(const k of o){const[C,N]=ue.splitModuleFilePathAndModulePath(k),_=ue.createPatchPath(N);c(C,[{op:"replace",path:_,value:d}])}a(ue.joinModuleFilePathAndModulePath(i,ue.patchPathToModulePath(x.concat(d))),{replace:!0}),m(!1)},children:[f.jsx(Su,{type:"text",value:d,onChange:w=>{p(w.target.value)}}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ut,{disabled:b,variant:"outline",type:"submit",children:"Update"}),f.jsx(Ut,{variant:"ghost",type:"reset",onClick:()=>{m(!1),p(e)},children:"Cancel"})]})]})})]})}function oY(e,t){const n=dv(),r=vP(),o=a9();return g.useMemo(()=>o[e]!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?QG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}function iY({path:e,variant:t}){const n=Je(e,"record"),r=Ct(e),o=no(),{addPatch:i}=yn(e),[s,a]=g.useState(""),{navigate:l}=fr(),[c,u]=g.useState(!1);if(g.useEffect(()=>{const v=x=>{x.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[]),!("data"in n)||n.data===void 0||n.data===null)return console.error("Source not found",n,{path:e}),null;if(!("data"in r)||r.data===void 0)return console.error("Schema not found",n,{path:e}),null;const d=r.data;if(d.type!=="record")return console.error("Schema is not a record",r,{path:e}),null;const p=s===""||s in n.data,[h,m]=ue.splitModuleFilePathAndModulePath(e);return f.jsxs(ca,{open:c,children:[f.jsx(Ut,{asChild:!0,size:Lp(t),variant:Fp(t),children:f.jsx(Mp,{onClick:()=>{u(!0)},title:"Add",children:f.jsx(_P,{size:Bv(t)})})}),f.jsx(Ui,{container:o,children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const x=ue.createPatchPath(m).concat(s);i([{op:"add",path:x,value:vl(d.item)}]),l(ue.joinModuleFilePathAndModulePath(h,ue.patchPathToModulePath(x))),u(!1)},children:[f.jsx(Su,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),f.jsx("div",{children:f.jsx(Ut,{type:"submit",disabled:p,variant:"outline",children:"Add"})})]})})]})}function N2(e){const[t,n]=ue.splitModuleFilePathAndModulePath(e),r=ue.splitModuleFilePath(t).map(a=>({text:ia(a),part:a,sourcePath:t}));if(!n)return r;const o=ue.splitModulePath(n),i=[];let s="";for(let a=0;a<o.length-1;a++){let l=(s?s+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(s?s+".":"")+o[a]),s=l,i.push({text:o[a],part:o[a],sourcePath:ue.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function O2({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,k,C;const s=vP(),{validationErrors:a}=Gi(),{patchPath:l,addPatch:c}=yn(n),u=Ct(n),d=Je(n,o),[p,h]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var N,_;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((N=u.data)==null?void 0:N.type)==="image"||((_=u.data)==null?void 0:_.type)==="file")&&v(!0)},[d,u]);const x="data"in d?d.data:void 0,b="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((k=u.data)==null?void 0:k.opt)===!0;return f.jsxs("div",{className:xe("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":((C=a[n])==null?void 0:C.length)>0}),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[!b&&w&&f.jsx(Pp,{disabled:s==="loading",checked:x!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&x===null?v(!0):c(x===null?[{op:"replace",path:l,value:vl({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}])}}),b&&f.jsx(gG,{path:n,isNullable:w,loadingStatus:s,source:x}),typeof e=="string"&&f.jsx(YG,{children:e}),e&&typeof e!="string"&&e]}),f.jsxs("div",{className:"flex items-center gap-2",children:[x!==null&&f.jsx(_2,{path:n,variant:"field"}),x!==null&&!b&&f.jsxs("button",{onClick:()=>h(N=>!N),className:xe("transform transition-transform",{"rotate-180":p}),children:[i==="1"&&f.jsx(Sp,{size:16}),i==="2"&&f.jsx(y9,{size:16})]})]})]}),!b&&f.jsx(Pf,{isOpen:p&&(x!==null||m),children:(x!==null||m)&&f.jsx("div",{className:"flex flex-col gap-6 pt-6",children:t})})]})}function sY({path:e}){const t="object",n=Ct(e),r=Je(e,t);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=el(e,i);return f.jsx(O2,{label:i,path:a,type:s.type,children:f.jsx(dy,{path:a,schema:s},a)},a)})})]})}function aY({path:e}){const t="object",n=Ct(e);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.data.type!=="object")return f.jsx(pr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return f.jsx(T2,{path:e,schema:r})}function T2({path:e,schema:t}){return f.jsx("div",{className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=el(e,n);return f.jsx(lY,{label:n,children:f.jsx(Sk,{path:r})},n)})})}function lY({label:e,children:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:pv(e)}),t]})}function yb(e){return typeof e.key!="string"}function cY({path:e}){const t="union",n=Ct(e),r=Je(e,t);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(yb(n.data))return typeof o!="string"&&o!==null?f.jsx(qe,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(dY,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!yb(n.data))return typeof o!="object"?f.jsx(qe,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?f.jsx(qe,{path:e,error:"Expected source to be an object, but found an array",type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(uY,{path:e,schema:n.data})]})}function uY({path:e,schema:t}){const n=xP(e),{addPatch:r,patchPath:o}=yn(e),i=no(),s=el(e,t.key),a=Je(s,"literal");if(!("data"in a)||a.data===void 0)return f.jsx(nt,{path:e,type:"union"});const l=t.items.find(d=>{var h;const p=(h=d.items)==null?void 0:h[t.key];return p.type==="literal"?p.value===a.data:(console.error("Expected literal schema in object union",p),!1)});if((l==null?void 0:l.items)===void 0)return f.jsx(nt,{path:e,type:"union"});const c=t.items.flatMap(d=>{var h;const p=(h=d.items)==null?void 0:h[t.key];return p.type==="literal"?[p.value]:(console.error("Expected literal schema in object union",p),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),f.jsxs("div",{className:"grid gap-4",children:[f.jsxs(kS,{value:a.data??void 0,onValueChange:d=>{const p=t.items.find(m=>{var x;const v=(x=m.items)==null?void 0:x[t.key];return v.type==="literal"?v.value===d:(console.error("Expected literal schema in object union",v),!1)});if((p==null?void 0:p.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const h=u.current[e][d]||vl(p);console.log({newValue:h,previouslySelectedSources:u.current,emptyOf:vl(p)}),h[t.key]=d,r([{op:"replace",path:o,value:h}])},children:[f.jsx(Fv,{children:f.jsx(CS,{children:a.data})}),f.jsx(zv,{container:i,className:"w-32",children:c==null?f.jsx(M2,{}):c.map(d=>f.jsx($v,{value:d,children:d},d))})]}),Object.keys(l==null?void 0:l.items).filter(d=>d!==(t==null?void 0:t.key)).map(d=>{var h,m,v;const p=el(e,d);return f.jsx(O2,{path:p,foldLevel:"1",transparent:!0,label:d,type:(m=(h=l==null?void 0:l.items)==null?void 0:h[d])==null?void 0:m.type,children:f.jsx(dy,{path:p,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},p)})]})}function dY({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=yn(e),i=no();return f.jsxs(kS,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}])},children:[f.jsx(Fv,{children:f.jsx(CS,{children:t})}),f.jsx(zv,{className:"w-32",container:i,children:n==null?f.jsx(M2,{}):n.map(s=>f.jsx($v,{value:s,children:s},s))})]})}function M2(){return f.jsx("div",{children:"Loading..."})}function fY({path:e}){const t="union",n=xP(e),r=Ct(e);if(n.status==="error")return f.jsx(qe,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return f.jsx(ar,{path:e});if(!("data"in r)||r.data===void 0)return f.jsx(ar,{path:e});if(n.data===null)return f.jsx(lr,{path:e});if(r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(yb(o))return typeof n.data!="string"?f.jsx(qe,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,type:t}):f.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return f.jsx(lr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return f.jsx(qe,{path:e,error:"Expected source to be an object, but found: "+typeof i,type:t});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!js(i))return l.value===i[o.key]});return s?f.jsx(T2,{path:e,schema:s}):f.jsx(qe,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}const pY=new TextEncoder;function P2(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=ue.getSHA256Hash(pY.encode(s));if(a.naturalWidth&&a.naturalHeight){const c=ue.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,sha256:l,mimeType:c,fileExt:c&&ue.mimeTypeToFileExt(c)})}else t({src:s,filename:r==null?void 0:r.name,sha256:l})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}const hY=new TextEncoder;function mY(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=ue.getSHA256Hash(hY.encode(s)),l=ue.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,sha256:a,mimeType:l,fileExt:l&&ue.mimeTypeToFileExt(l)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function j2(e,t,n,r,o,i,s="/public/val"){const a=ue.createFilename(t,n,o,r);return!a||!o?[]:[{value:{[kt]:`${s}/${a}`,[Zn]:"file",...i!=="file"?{[I0]:i}:{},metadata:o},op:"replace",path:e},{value:t,op:"file",path:e,filePath:`${s}/${a}`}]}function gY({path:e}){var l;const t="file",n=bp(),r=Ct(e),o=Je(e,t),{patchPath:i,addPatch:s}=yn(e);if(r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(qe,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(r.status==="loading")return f.jsx(nt,{path:e,type:t});if(n===void 0)return f.jsx(nt,{path:e,type:t});if(r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});const a=o.data;return a===void 0?f.jsx(vn,{path:e,type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(Ut,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`img_input:${e}`,children:"Update"})}),a&&f.jsxs("a",{className:"flex items-center gap-2",href:ue.convertFileSource({...a,_type:"file"}).url,children:[" ",f.jsx("span",{children:" Open file"}),f.jsx(A9,{})]}),f.jsx("input",{disabled:o.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:(l=r.data.options)==null?void 0:l.accept,onChange:c=>{mY(c).then(u=>{var h;const d={src:u.src,filename:u.filename};let p;u.mimeType&&(p={mimeType:u.mimeType}),s(j2(i,d.src,d.filename??null,u.sha256,p,"file",(h=n.files)==null?void 0:h.directory))})}})]})]})}function vY({path:e}){const t=Je(e,"image");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx(EP,{size:12})}function yY({path:e}){var u,d,p,h;const t="image",n=bp(),r=Ct(e),o=Je(e,t),{patchPath:i,addPatch:s}=yn(e),[a,l]=g.useState(void 0);if(g.useEffect(()=>{if("data"in o&&o.data)if(o.data.metadata){const m=o.data.metadata;if(typeof m.width!="number"||typeof m.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof m.width} and height was: ${typeof m.height}`);return}if("hotspot"in m){if(typeof m.hotspot=="object"&&m.hotspot&&"x"in m.hotspot&&"y"in m.hotspot){const{x:v,y:x}=m.hotspot;typeof v=="number"&&typeof x=="number"?l({x:v,y:x}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof v} and y: ${typeof x}`)}}else l(void 0)}else l(void 0)},["data"in o&&o.data]),r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(qe,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(r.status==="loading")return f.jsx(nt,{path:e,type:t});if(n===void 0)return f.jsx(nt,{path:e,type:t});if(r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});const c=o.data;return c===void 0?f.jsx(vn,{path:e,type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),c&&f.jsxs("div",{className:"py-2",children:[f.jsx("span",{children:"Alt text"}),f.jsx(Su,{value:(u=c.metadata)!=null&&u.alt&&typeof((d=c.metadata)==null?void 0:d.alt)=="string"?(p=c.metadata)==null?void 0:p.alt:"",onChange:m=>{const v=m.target.value;c.metadata&&"alt"in c.metadata?s([{op:"replace",value:v,path:i.concat(["metadata","alt"])}]):c.metadata&&!("alt"in c.metadata)?s([{op:"add",value:v,path:i.concat(["metadata","alt"])}]):c.metadata===void 0?s([{op:"add",value:{...a?{hotspot:a}:{},alt:v},path:i.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof c.metadata}`)}})]}),c&&f.jsxs("div",{className:"relative",children:[f.jsx("img",{src:ue.convertFileSource({...c,_type:"file"}).url,draggable:!1,className:"object-contain w-full max-h-[500px] rounded-t-lg",style:{cursor:"crosshair"},onClick:m=>{const{width:v,height:x,left:b,top:w}=m.currentTarget.getBoundingClientRect(),S={x:Math.max((m.clientX-6-b)/v,0),y:Math.max((m.clientY-6-w)/x,0)};c.metadata&&"hotspot"in c.metadata?s([{op:"replace",path:i.concat(["metadata","hotspot"]),value:S}]):c.metadata?s([{op:"add",path:i.concat(["metadata","hotspot"]),value:S}]):c.metadata===void 0?s([{op:"add",value:{...S?{hotspot:S}:{}},path:i.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof c.metadata}`)}}),a&&f.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-solid border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),f.jsx("div",{children:f.jsx("label",{htmlFor:`img_input:${e}`,className:xe("block px-1 py-2 mt-4 text-sm text-center rounded-lg cursor-pointer bg-bg-primary text-text-secondary"),children:"Update"})}),f.jsx("input",{disabled:o.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((h=r.data.options)==null?void 0:h.accept)||"image/*",onChange:m=>{P2(m).then(v=>{var w;const x={src:v.src,filename:v.filename};let b;v.width&&v.height&&v.mimeType&&(b={width:v.width,height:v.height,mimeType:v.mimeType}),s(j2(i,x.src,x.filename??null,v.sha256,b,"image",(w=n.files)==null?void 0:w.directory))})}})]})}function xY({path:e}){const t=Je(e,"image");if(t.status==="error")return f.jsx(qe,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});if(t.data===null)return f.jsx(lr,{path:e});const n=t.data;return f.jsx("img",{src:ue.convertFileSource({...n,_type:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function bY({path:e}){const t="keyOf",{navigate:n}=fr(),r=Ct(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:r.data.schema.type,path:r.data.path}:void 0,i=Je(o==null?void 0:o.path,o==null?void 0:o.type),s=Je(e,t),{patchPath:a,addPatch:l}=yn(e),c=no();if(r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(s.status==="error")return f.jsx(qe,{path:e,error:s.error,type:t});if(i.status==="error")return f.jsx(qe,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return f.jsx(Rt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return f.jsx(Rt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return f.jsx(nt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return f.jsx(Rt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return f.jsx(Rt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,d=s.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),u&&u.length>0&&d!==null&&!u.includes(d)&&f.jsx("div",{className:"flex flex-col gap-2 p-4 rounded bg-bg-error-primary text-text-error-primary",children:f.jsxs("span",{children:["Value must be one of: ",u.join(", ")]})}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(kS,{value:d??"",onValueChange:p=>{l([{op:"replace",path:a,value:p}])},children:[f.jsx(Fv,{children:f.jsx(CS,{children:d})}),f.jsx(zv,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?f.jsx(wY,{}):u.map(p=>f.jsx($v,{value:p,children:p},p))})]}),d&&(o==null?void 0:o.path)&&f.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(ue.createValPathOfItem(o.path,d))},children:f.jsx(h9,{size:16})})]})]})}function wY(){return f.jsx("span",{children:"Loading..."})}function SY({path:e}){const t=Je(e,"keyOf");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function R2({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return f.jsx(FB,{showOutsideDays:r,captionLayout:n,className:Fe("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:Fe(Q0({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Fe(Q0({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>f.jsx(v9,{className:"w-4 h-4"}),IconRight:()=>f.jsx(fv,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=d=>{c&&c({target:{value:d}})};return f.jsx("div",{className:"flex flex-row space-x-2",children:f.jsxs(x2,{onValueChange:u,value:String(l),children:[f.jsx(bS,{asChild:!0,children:f.jsxs(Ut,{variant:"ghost",size:"sm",children:[s,f.jsx(Sp,{className:"w-4 h-4"})]})}),f.jsx(wS,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:f.jsx(b2,{className:"pb-4 pr-4 overflow-y-auto rounded-md shadow-lg max-h-48 bg-bg-tertiary text-text-tertiary",children:g.Children.map(a,d=>{if(g.isValidElement(d)){const{value:p,children:h}=d.props;return f.jsx(SS,{value:String(p),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:f.jsx(S2,{children:h})},p)}return null})})})]})})}},...o})}R2.displayName="Calendar";function kY({path:e}){var p,h;const t="date",n=Ct(e),r=Je(e,t),{patchPath:o,addPatch:i}=yn(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=no();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsxs(ca,{open:l,onOpenChange:m=>{c(m)},children:[f.jsx(Mp,{asChild:!0,onClick:()=>{c(!0)},children:f.jsxs(Ut,{variant:"outline",className:xe("w-[280px] justify-start text-left font-normal bg-bg-primary",!s&&"text-muted-foreground"),children:[f.jsx(g9,{className:"w-4 h-4 mr-2"}),s?qi(s,"PPP"):f.jsx("span",{children:"Pick a date"})]})}),f.jsx(Ui,{className:"w-auto p-0",container:u,children:f.jsx(R2,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(p=d.options)!=null&&p.from?new Date(d.options.from):void 0,toDate:(h=d.options)!=null&&h.to?new Date(d.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString().slice(0,10),path:o}]),c(!1))}})})]})]})}function CY({path:e}){const t=Je(e,"date");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function EY({path:e}){const t=Je(e,"literal");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function A2(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function I2(){return f.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-primary"})}function _Y({path:e}){const t="record",{validationErrors:n}=Gi(),{navigate:r}=fr(),o=Ct(e),i=Je(e,t);if(o.status==="error")return f.jsx(Rt,{path:e,error:o.error,type:t});if(i.status==="error")return f.jsx(qe,{path:e,error:i.error,type:t});if(i.status=="not-found"||o.status==="not-found")return f.jsx(vn,{path:e,type:t});if(o.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in i)||i.data===void 0)return f.jsx(nt,{path:e,type:t});if(o.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:o.data.type});const s=i.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx("div",{className:"grid grid-cols-1 gap-4",children:s&&Object.entries(s).map(([a])=>f.jsxs("div",{onClick:()=>r(el(e,a)),className:"bg-primary-foreground cursor-pointer hover:bg-primary-foreground/50 min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4",children:[f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("div",{className:"pb-4 font-semibold text-md",children:a}),A2(el(e,a),n)&&f.jsx(I2,{})]}),f.jsx("div",{children:f.jsx(Sk,{path:el(e,a)})})]},a))})]})}function NY({path:e}){const t=Je(e,"record");if(t.status==="error")return f.jsx(qe,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});if(t.data===null)return f.jsx(lr,{path:e});const n=Object.keys(t.data);return f.jsxs("div",{className:"text-left",children:[f.jsx("span",{className:"text-fg-brand-primary",children:n.length}),f.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let Vv=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var xb={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var p=u.stack;return r(this,"stack",{configurable:!0,value:p,writable:!0}),p},set:function(p){r(c,"stack",{configurable:!0,value:p,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}t=e.exports=a,t.BaseError=i})(xb,xb.exports);var D2=xb.exports,s_="ProseMirror-selectednode",L2="",Rs="\0",a_="__state_override__",OY={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},De=OY,Wi=Symbol.for("__remirror__"),nn=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(nn||{}),et=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(et||{}),Yn=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(Yn||{}),Z=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(Z||{}),J=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(J||{}),TY=function(t){return MY(t)&&!PY(t)};function MY(e){return!!e&&typeof e=="object"}function PY(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||AY(e)}var jY=typeof Symbol=="function"&&Symbol.for,RY=jY?Symbol.for("react.element"):60103;function AY(e){return e.$$typeof===RY}function IY(e){return Array.isArray(e)?[]:{}}function Vf(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Qc(IY(e),e,t):e}function DY(e,t,n){return e.concat(t).map(function(r){return Vf(r,n)})}function LY(e,t){if(!t.customMerge)return Qc;var n=t.customMerge(e);return typeof n=="function"?n:Qc}function FY(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function l_(e){return Object.keys(e).concat(FY(e))}function F2(e,t){try{return t in e}catch{return!1}}function zY(e,t){return F2(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function $Y(e,t,n){var r={};return n.isMergeableObject(e)&&l_(e).forEach(function(o){r[o]=Vf(e[o],n)}),l_(t).forEach(function(o){zY(e,o)||(F2(e,o)&&n.isMergeableObject(t[o])?r[o]=LY(o,n)(e[o],t[o],n):r[o]=Vf(t[o],n))}),r}function Qc(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||DY,n.isMergeableObject=n.isMergeableObject||TY,n.cloneUnlessOtherwiseSpecified=Vf;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):$Y(e,t,n):Vf(t,n)}Qc.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Qc(r,o,n)},{})};var BY=Qc,VY=BY;const UY=ga(VY);/*!
|
|
366
|
+
`},BK={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function VK(e){let{announcements:t=BK,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=$K}=e;const{announce:i,announcement:s}=LK(),a=Ip("DndLiveRegion"),[l,c]=g.useState(!1);if(g.useEffect(()=>{c(!0)},[]),FK(g.useMemo(()=>({onDragStart(d){let{active:p}=d;i(t.onDragStart({active:p}))},onDragMove(d){let{active:p,over:h}=d;t.onDragMove&&i(t.onDragMove({active:p,over:h}))},onDragOver(d){let{active:p,over:h}=d;i(t.onDragOver({active:p,over:h}))},onDragEnd(d){let{active:p,over:h}=d;i(t.onDragEnd({active:p,over:h}))},onDragCancel(d){let{active:p,over:h}=d;i(t.onDragCancel({active:p,over:h}))}}),[i,t])),!l)return null;const u=ye.createElement(ye.Fragment,null,ye.createElement(IK,{id:r,value:o.draggable}),ye.createElement(DK,{id:a,announcement:s}));return n?Nr.createPortal(u,n):u}var Ft;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Ft||(Ft={}));function lg(){}function hx(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function UK(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Do=Object.freeze({x:0,y:0});function SA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kA(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function WK(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function WE(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function CA(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function HE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const HK=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=HE(t,t.left,t.top),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=SA(HE(l),o);i.push({id:a,data:{droppableContainer:s,value:c}})}}return i.sort(kA)},KK=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=WE(t),i=[];for(const s of r){const{id:a}=s,l=n.get(a);if(l){const c=WE(l),u=o.reduce((p,h,m)=>p+SA(c[m],h),0),d=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:s,value:d}})}}return i.sort(kA)};function qK(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),s=o-r,a=i-n;if(r<o&&n<i){const l=t.width*t.height,c=e.width*e.height,u=s*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const GK=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:s}=i,a=n.get(s);if(a){const l=qK(a,t);l>0&&o.push({id:s,data:{droppableContainer:i,value:l}})}}return o.sort(WK)};function YK(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function EA(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Do}function JK(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((s,a)=>({...s,top:s.top+e*a.y,bottom:s.bottom+e*a.y,left:s.left+e*a.x,right:s.right+e*a.x}),{...n})}}const XK=JK(1);function ZK(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function QK(e,t,n){const r=ZK(t);if(!r)return e;const{scaleX:o,scaleY:i,x:s,y:a}=r,l=e.left-s-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const eq={ignoreTransform:!1};function wu(e,t){t===void 0&&(t=eq);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=hr(e).getComputedStyle(e);c&&(n=QK(n,c,u))}const{top:r,left:o,width:i,height:s,bottom:a,right:l}=n;return{top:r,left:o,width:i,height:s,bottom:a,right:l}}function KE(e){return wu(e,{ignoreTransform:!0})}function tq(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function nq(e,t){return t===void 0&&(t=hr(e).getComputedStyle(e)),t.position==="fixed"}function rq(e,t){t===void 0&&(t=hr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function jv(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(fS(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Rp(o)||xA(o)||n.includes(o))return n;const i=hr(e).getComputedStyle(o);return o!==e&&rq(o,i)&&n.push(o),nq(o,i)?n:r(o.parentNode)}return e?r(e):n}function _A(e){const[t]=jv(e,1);return t??null}function mx(e){return!Pv||!e?null:xu(e)?e:dS(e)?fS(e)||e===bu(e).scrollingElement?window:Rp(e)?e:null:null}function NA(e){return xu(e)?e.scrollX:e.scrollLeft}function OA(e){return xu(e)?e.scrollY:e.scrollTop}function ub(e){return{x:NA(e),y:OA(e)}}var Zt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Zt||(Zt={}));function TA(e){return!Pv||!e?!1:e===document.scrollingElement}function MA(e){const t={x:0,y:0},n=TA(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:s,isRight:a,maxScroll:r,minScroll:t}}const oq={x:.2,y:.2};function iq(e,t,n,r,o){let{top:i,left:s,right:a,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=oq);const{isTop:c,isBottom:u,isLeft:d,isRight:p}=MA(e),h={x:0,y:0},m={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!c&&i<=t.top+v.height?(h.y=Zt.Backward,m.y=r*Math.abs((t.top+v.height-i)/v.height)):!u&&l>=t.bottom-v.height&&(h.y=Zt.Forward,m.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!p&&a>=t.right-v.width?(h.x=Zt.Forward,m.x=r*Math.abs((t.right-v.width-a)/v.width)):!d&&s<=t.left+v.width&&(h.x=Zt.Backward,m.x=r*Math.abs((t.left+v.width-s)/v.width)),{direction:h,speed:m}}function sq(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:s}=window;return{top:0,left:0,right:i,bottom:s,width:i,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function PA(e){return e.reduce((t,n)=>Tc(t,ub(n)),Do)}function aq(e){return e.reduce((t,n)=>t+NA(n),0)}function lq(e){return e.reduce((t,n)=>t+OA(n),0)}function cq(e,t){if(t===void 0&&(t=wu),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);_A(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const uq=[["x",["left","right"],aq],["y",["top","bottom"],lq]];class mS{constructor(t,n){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;const r=jv(n),o=PA(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,s,a]of uq)for(const l of s)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=o[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Bd{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function dq(e){const{EventTarget:t}=hr(e);return e instanceof t?e:bu(e)}function gx(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var $r;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($r||($r={}));function qE(e){e.preventDefault()}function fq(e){e.stopPropagation()}var Ue;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Ue||(Ue={}));const jA={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter,Ue.Tab]},pq=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ue.Right:return{...n,x:n.x+25};case Ue.Left:return{...n,x:n.x-25};case Ue.Down:return{...n,y:n.y+25};case Ue.Up:return{...n,y:n.y-25}}};class gS{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Bd(bu(n)),this.windowListeners=new Bd(hr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($r.Resize,this.handleCancel),this.windowListeners.add($r.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($r.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&cq(r),n(Do)}handleKeyDown(t){if(hS(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=jA,coordinateGetter:s=pq,scrollBehavior:a="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:Do;this.referenceCoordinates||(this.referenceCoordinates=u);const d=s(t,{active:n,context:r.current,currentCoordinates:u});if(d){const p=zf(d,u),h={x:0,y:0},{scrollableAncestors:m}=r.current;for(const v of m){const x=t.code,{isTop:b,isRight:w,isLeft:S,isBottom:k,maxScroll:C,minScroll:N}=MA(v),_=sq(v),O={x:Math.min(x===Ue.Right?_.right-_.width/2:_.right,Math.max(x===Ue.Right?_.left:_.left+_.width/2,d.x)),y:Math.min(x===Ue.Down?_.bottom-_.height/2:_.bottom,Math.max(x===Ue.Down?_.top:_.top+_.height/2,d.y))},M=x===Ue.Right&&!w||x===Ue.Left&&!S,P=x===Ue.Down&&!k||x===Ue.Up&&!b;if(M&&O.x!==d.x){const D=v.scrollLeft+p.x,$=x===Ue.Right&&D<=C.x||x===Ue.Left&&D>=N.x;if($&&!p.y){v.scrollTo({left:D,behavior:a});return}$?h.x=v.scrollLeft-D:h.x=x===Ue.Right?v.scrollLeft-C.x:v.scrollLeft-N.x,h.x&&v.scrollBy({left:-h.x,behavior:a});break}else if(P&&O.y!==d.y){const D=v.scrollTop+p.y,$=x===Ue.Down&&D<=C.y||x===Ue.Up&&D>=N.y;if($&&!p.x){v.scrollTo({top:D,behavior:a});return}$?h.y=v.scrollTop-D:h.y=x===Ue.Down?v.scrollTop-C.y:v.scrollTop-N.y,h.y&&v.scrollBy({top:-h.y,behavior:a});break}}this.handleMove(t,Tc(zf(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}gS.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=jA,onActivation:o}=t,{active:i}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function GE(e){return!!(e&&"distance"in e)}function YE(e){return!!(e&&"delay"in e)}class vS{constructor(t,n,r){var o;r===void 0&&(r=dq(t.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=t,this.events=n;const{event:i}=t,{target:s}=i;this.props=t,this.events=n,this.document=bu(s),this.documentListeners=new Bd(this.document),this.listeners=new Bd(r),this.windowListeners=new Bd(hr(s)),this.initialCoordinates=(o=cb(i))!=null?o:Do,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(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add($r.Resize,this.handleCancel),this.windowListeners.add($r.DragStart,qE),this.windowListeners.add($r.VisibilityChange,this.handleCancel),this.windowListeners.add($r.ContextMenu,qE),this.documentListeners.add($r.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(YE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(GE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add($r.Click,fq,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($r.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:s,options:{activationConstraint:a}}=i;if(!o)return;const l=(n=cb(t))!=null?n:Do,c=zf(o,l);if(!r&&a){if(GE(a)){if(a.tolerance!=null&&gx(c,a.tolerance))return this.handleCancel();if(gx(c,a.distance))return this.handleStart()}if(YE(a)&&gx(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),s(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const hq={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class RA extends vS{constructor(t){const{event:n}=t,r=bu(n.target);super(t,hq,r)}}RA.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const mq={move:{name:"mousemove"},end:{name:"mouseup"}};var db;(function(e){e[e.RightClick=2]="RightClick"})(db||(db={}));class AA extends vS{constructor(t){super(t,mq,bu(t.event.target))}}AA.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===db.RightClick?!1:(r==null||r({event:n}),!0)}}];const vx={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class IA extends vS{constructor(t){super(t,vx)}static setup(){return window.addEventListener(vx.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(vx.move.name,t)};function t(){}}}IA.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Vd;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Vd||(Vd={}));var cg;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(cg||(cg={}));function gq(e){let{acceleration:t,activator:n=Vd.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:s=5,order:a=cg.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:p}=e;const h=yq({delta:d,disabled:!i}),[m,v]=MK(),x=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),w=g.useMemo(()=>{switch(n){case Vd.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Vd.DraggableRect:return o}},[n,o,l]),S=g.useRef(null),k=g.useCallback(()=>{const N=S.current;if(!N)return;const _=x.current.x*b.current.x,O=x.current.y*b.current.y;N.scrollBy(_,O)},[]),C=g.useMemo(()=>a===cg.TreeOrder?[...c].reverse():c,[a,c]);g.useEffect(()=>{if(!i||!c.length||!w){v();return}for(const N of C){if((r==null?void 0:r(N))===!1)continue;const _=c.indexOf(N),O=u[_];if(!O)continue;const{direction:M,speed:P}=iq(N,O,w,t,p);for(const D of["x","y"])h[D][M[D]]||(P[D]=0,M[D]=0);if(P.x>0||P.y>0){v(),S.current=N,m(k,s),x.current=P,b.current=M;return}}x.current={x:0,y:0},b.current={x:0,y:0},v()},[t,k,r,v,i,s,JSON.stringify(w),JSON.stringify(h),m,c,C,u,JSON.stringify(p)])}const vq={x:{[Zt.Backward]:!1,[Zt.Forward]:!1},y:{[Zt.Backward]:!1,[Zt.Forward]:!1}};function yq(e){let{delta:t,disabled:n}=e;const r=lb(t);return Ap(o=>{if(n||!r||!o)return vq;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Zt.Backward]:o.x[Zt.Backward]||i.x===-1,[Zt.Forward]:o.x[Zt.Forward]||i.x===1},y:{[Zt.Backward]:o.y[Zt.Backward]||i.y===-1,[Zt.Forward]:o.y[Zt.Forward]||i.y===1}}},[n,t,r])}function xq(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ap(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function bq(e,t){return g.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...i]},[]),[e,t])}var Bf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Bf||(Bf={}));var fb;(function(e){e.Optimized="optimized"})(fb||(fb={}));const JE=new Map;function wq(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,s]=g.useState(null),{frequency:a,measure:l,strategy:c}=o,u=g.useRef(e),d=x(),p=Ff(d),h=g.useCallback(function(b){b===void 0&&(b=[]),!p.current&&s(w=>w===null?b:w.concat(b.filter(S=>!w.includes(S))))},[p]),m=g.useRef(null),v=Ap(b=>{if(d&&!n)return JE;if(!b||b===JE||u.current!==e||i!=null){const w=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){w.set(S.id,S.rect.current);continue}const k=S.node.current,C=k?new mS(l(k),k):null;S.rect.current=C,C&&w.set(S.id,C)}return w}return b},[e,i,n,d,l]);return g.useEffect(()=>{u.current=e},[e]),g.useEffect(()=>{d||h()},[n,d]),g.useEffect(()=>{i&&i.length>0&&s(null)},[JSON.stringify(i)]),g.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{h(),m.current=null},a))},[a,d,h,...r]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:i!=null};function x(){switch(c){case Bf.Always:return!1;case Bf.BeforeDragging:return n;default:return!n}}}function DA(e,t){return Ap(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Sq(e,t){return DA(e,t)}function kq(e){let{callback:t,disabled:n}=e;const r=pS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Rv(e){let{callback:t,disabled:n}=e;const r=pS(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return g.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Cq(e){return new mS(wu(e),e)}function XE(e,t,n){t===void 0&&(t=Cq);const[r,o]=g.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const s=kq({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=Rv({callback:i});return ri(()=>{i(),e?(a==null||a.observe(e),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),s==null||s.disconnect())},[e]),r}function Eq(e){const t=DA(e);return EA(e,t)}const ZE=[];function _q(e){const t=g.useRef(e),n=Ap(r=>e?r&&r!==ZE&&e&&t.current&&e.parentNode===t.current.parentNode?r:jv(e):ZE,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function Nq(e){const[t,n]=g.useState(null),r=g.useRef(e),o=g.useCallback(i=>{const s=mx(i.target);s&&n(a=>a?(a.set(s,ub(s)),new Map(a)):null)},[]);return g.useEffect(()=>{const i=r.current;if(e!==i){s(i);const a=e.map(l=>{const c=mx(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,ub(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{s(e),s(i)};function s(a){a.forEach(l=>{const c=mx(l);c==null||c.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,s)=>Tc(i,s),Do):PA(e):Do,[e,t])}function QE(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const r=e!==Do;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?zf(e,n.current):Do}function Oq(e){g.useEffect(()=>{if(!Pv)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Tq(e,t){return g.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=s=>{i(s,t)},n},{}),[e,t])}function LA(e){return g.useMemo(()=>e?tq(e):null,[e])}const e_=[];function Mq(e,t){t===void 0&&(t=wu);const[n]=e,r=LA(n?hr(n):null),[o,i]=g.useState(e_);function s(){i(()=>e.length?e.map(l=>TA(l)?r:new mS(t(l),l)):e_)}const a=Rv({callback:s});return ri(()=>{a==null||a.disconnect(),s(),e.forEach(l=>a==null?void 0:a.observe(l))},[e]),o}function Pq(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Rp(t)?t:e}function jq(e){let{measure:t}=e;const[n,r]=g.useState(null),o=g.useCallback(c=>{for(const{target:u}of c)if(Rp(u)){r(d=>{const p=t(u);return d?{...d,width:p.width,height:p.height}:p});break}},[t]),i=Rv({callback:o}),s=g.useCallback(c=>{const u=Pq(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?t(u):null)},[t,i]),[a,l]=ag(s);return g.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const Rq=[{sensor:RA,options:{}},{sensor:gS,options:{}}],Aq={current:{}},Yh={draggable:{measure:KE},droppable:{measure:KE,strategy:Bf.WhileDragging,frequency:fb.Optimized},dragOverlay:{measure:wu}};class Ud extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Iq={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ud,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lg},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Yh,measureDroppableContainers:lg,windowRect:null,measuringScheduled:!1},Dq={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:lg,draggableNodes:new Map,over:null,measureDroppableContainers:lg},Av=g.createContext(Dq),FA=g.createContext(Iq);function Lq(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ud}}}function Fq(e,t){switch(t.type){case Ft.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ft.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Ft.DragEnd:case Ft.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ft.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ud(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Ft.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Ud(e.droppable.containers);return s.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case Ft.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ud(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function zq(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=g.useContext(Av),i=lb(r),s=lb(n==null?void 0:n.id);return g.useEffect(()=>{if(!t&&!r&&i&&s!=null){if(!hS(i)||document.activeElement===i.target)return;const a=o.get(s);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=RK(u);if(d){d.focus();break}}})}},[r,t,o,s,i]),null}function $q(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function Bq(e){return g.useMemo(()=>({draggable:{...Yh.draggable,...e==null?void 0:e.draggable},droppable:{...Yh.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Yh.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Vq(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=g.useRef(!1),{x:s,y:a}=typeof o=="boolean"?{x:o,y:o}:o;ri(()=>{if(!s&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t==null?void 0:t.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=EA(u,r);if(s||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const p=_A(c);p&&p.scrollBy({top:d.y,left:d.x})}},[t,s,a,r,n])}const zA=g.createContext({...Do,scaleX:1,scaleY:1});var xs;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xs||(xs={}));const Uq=g.memo(function(t){var n,r,o,i;let{id:s,accessibility:a,autoScroll:l=!0,children:c,sensors:u=Rq,collisionDetection:d=GK,measuring:p,modifiers:h,...m}=t;const v=g.useReducer(Fq,void 0,Lq),[x,b]=v,[w,S]=zK(),[k,C]=g.useState(xs.Uninitialized),N=k===xs.Initialized,{draggable:{active:_,nodes:O,translate:M},droppable:{containers:P}}=x,D=_!=null?O.get(_):null,$=g.useRef({initial:null,translated:null}),U=g.useMemo(()=>{var Sn;return _!=null?{id:_,data:(Sn=D==null?void 0:D.data)!=null?Sn:Aq,rect:$}:null},[_,D]),K=g.useRef(null),[G,j]=g.useState(null),[T,E]=g.useState(null),R=Ff(m,Object.values(m)),A=Ip("DndDescribedBy",s),I=g.useMemo(()=>P.getEnabled(),[P]),F=Bq(p),{droppableRects:ce,measureDroppableContainers:pe,measuringScheduled:W}=wq(I,{dragging:N,dependencies:[M.x,M.y],config:F.droppable}),V=xq(O,_),z=g.useMemo(()=>T?cb(T):null,[T]),te=H4(),se=Sq(V,F.draggable.measure);Vq({activeNode:_!=null?O.get(_):null,config:te.layoutShiftCompensation,initialRect:se,measure:F.draggable.measure});const Y=XE(V,F.draggable.measure,se),Oe=XE(V?V.parentElement:null),ae=g.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:ce,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Me=P.getNodeFor((n=ae.current.over)==null?void 0:n.id),rt=jq({measure:F.dragOverlay.measure}),sn=(r=rt.nodeRef.current)!=null?r:V,an=N?(o=rt.rect)!=null?o:Y:null,Fr=!!(rt.nodeRef.current&&rt.rect),bn=Eq(Fr?null:Y),An=LA(sn?hr(sn):null),wn=_q(N?Me??V:null),Al=Mq(wn),Oa=$q(h,{transform:{x:M.x-bn.x,y:M.y-bn.y,scaleX:1,scaleY:1},activatorEvent:T,active:U,activeNodeRect:Y,containerNodeRect:Oe,draggingNodeRect:an,over:ae.current.over,overlayNodeRect:rt.rect,scrollableAncestors:wn,scrollableAncestorRects:Al,windowRect:An}),kk=z?Tc(z,M):null,Ck=Nq(wn),F4=QE(Ck),z4=QE(Ck,[Y]),Il=Tc(Oa,F4),Dl=an?XK(an,Oa):null,Tu=U&&Dl?d({active:U,collisionRect:Dl,droppableRects:ce,droppableContainers:I,pointerCoordinates:kk}):null,Ek=CA(Tu,"id"),[Zi,_k]=g.useState(null),$4=Fr?Oa:Tc(Oa,z4),B4=YK($4,(i=Zi==null?void 0:Zi.rect)!=null?i:null,Y),py=g.useRef(null),Nk=g.useCallback((Sn,gr)=>{let{sensor:vr,options:Qi}=gr;if(K.current==null)return;const zr=O.get(K.current);if(!zr)return;const yr=Sn.nativeEvent,Vo=new vr({active:K.current,activeNode:zr,event:yr,options:Qi,context:ae,onAbort(ln){if(!O.get(ln))return;const{onDragAbort:Uo}=R.current,ui={id:ln};Uo==null||Uo(ui),w({type:"onDragAbort",event:ui})},onPending(ln,es,Uo,ui){if(!O.get(ln))return;const{onDragPending:Pu}=R.current,ts={id:ln,constraint:es,initialCoordinates:Uo,offset:ui};Pu==null||Pu(ts),w({type:"onDragPending",event:ts})},onStart(ln){const es=K.current;if(es==null)return;const Uo=O.get(es);if(!Uo)return;const{onDragStart:ui}=R.current,Mu={activatorEvent:yr,active:{id:es,data:Uo.data,rect:$}};Nr.unstable_batchedUpdates(()=>{ui==null||ui(Mu),C(xs.Initializing),b({type:Ft.DragStart,initialCoordinates:ln,active:es}),w({type:"onDragStart",event:Mu}),j(py.current),E(yr)})},onMove(ln){b({type:Ft.DragMove,coordinates:ln})},onEnd:Ll(Ft.DragEnd),onCancel:Ll(Ft.DragCancel)});py.current=Vo;function Ll(ln){return async function(){const{active:Uo,collisions:ui,over:Mu,scrollAdjustedTranslate:Pu}=ae.current;let ts=null;if(Uo&&Pu){const{cancelDrop:ju}=R.current;ts={activatorEvent:yr,active:Uo,collisions:ui,delta:Pu,over:Mu},ln===Ft.DragEnd&&typeof ju=="function"&&await Promise.resolve(ju(ts))&&(ln=Ft.DragCancel)}K.current=null,Nr.unstable_batchedUpdates(()=>{b({type:ln}),C(xs.Uninitialized),_k(null),j(null),E(null),py.current=null;const ju=ln===Ft.DragEnd?"onDragEnd":"onDragCancel";if(ts){const hy=R.current[ju];hy==null||hy(ts),w({type:ju,event:ts})}})}}},[O]),V4=g.useCallback((Sn,gr)=>(vr,Qi)=>{const zr=vr.nativeEvent,yr=O.get(Qi);if(K.current!==null||!yr||zr.dndKit||zr.defaultPrevented)return;const Vo={active:yr};Sn(vr,gr.options,Vo)===!0&&(zr.dndKit={capturedBy:gr.sensor},K.current=Qi,Nk(vr,gr))},[O,Nk]),Ok=bq(u,V4);Oq(u),ri(()=>{Y&&k===xs.Initializing&&C(xs.Initialized)},[Y,k]),g.useEffect(()=>{const{onDragMove:Sn}=R.current,{active:gr,activatorEvent:vr,collisions:Qi,over:zr}=ae.current;if(!gr||!vr)return;const yr={active:gr,activatorEvent:vr,collisions:Qi,delta:{x:Il.x,y:Il.y},over:zr};Nr.unstable_batchedUpdates(()=>{Sn==null||Sn(yr),w({type:"onDragMove",event:yr})})},[Il.x,Il.y]),g.useEffect(()=>{const{active:Sn,activatorEvent:gr,collisions:vr,droppableContainers:Qi,scrollAdjustedTranslate:zr}=ae.current;if(!Sn||K.current==null||!gr||!zr)return;const{onDragOver:yr}=R.current,Vo=Qi.get(Ek),Ll=Vo&&Vo.rect.current?{id:Vo.id,rect:Vo.rect.current,data:Vo.data,disabled:Vo.disabled}:null,ln={active:Sn,activatorEvent:gr,collisions:vr,delta:{x:zr.x,y:zr.y},over:Ll};Nr.unstable_batchedUpdates(()=>{_k(Ll),yr==null||yr(ln),w({type:"onDragOver",event:ln})})},[Ek]),ri(()=>{ae.current={activatorEvent:T,active:U,activeNode:V,collisionRect:Dl,collisions:Tu,droppableRects:ce,draggableNodes:O,draggingNode:sn,draggingNodeRect:an,droppableContainers:P,over:Zi,scrollableAncestors:wn,scrollAdjustedTranslate:Il},$.current={initial:an,translated:Dl}},[U,V,Tu,Dl,O,sn,an,ce,P,Zi,wn,Il]),gq({...te,delta:M,draggingRect:Dl,pointerCoordinates:kk,scrollableAncestors:wn,scrollableAncestorRects:Al});const U4=g.useMemo(()=>({active:U,activeNode:V,activeNodeRect:Y,activatorEvent:T,collisions:Tu,containerNodeRect:Oe,dragOverlay:rt,draggableNodes:O,droppableContainers:P,droppableRects:ce,over:Zi,measureDroppableContainers:pe,scrollableAncestors:wn,scrollableAncestorRects:Al,measuringConfiguration:F,measuringScheduled:W,windowRect:An}),[U,V,Y,T,Tu,Oe,rt,O,P,ce,Zi,pe,wn,Al,F,W,An]),W4=g.useMemo(()=>({activatorEvent:T,activators:Ok,active:U,activeNodeRect:Y,ariaDescribedById:{draggable:A},dispatch:b,draggableNodes:O,over:Zi,measureDroppableContainers:pe}),[T,Ok,U,Y,b,A,O,Zi,pe]);return ye.createElement(wA.Provider,{value:S},ye.createElement(Av.Provider,{value:W4},ye.createElement(FA.Provider,{value:U4},ye.createElement(zA.Provider,{value:B4},c)),ye.createElement(zq,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ye.createElement(VK,{...a,hiddenTextDescribedById:A}));function H4(){const Sn=(G==null?void 0:G.autoScrollEnabled)===!1,gr=typeof l=="object"?l.enabled===!1:l===!1,vr=N&&!Sn&&!gr;return typeof l=="object"?{...l,enabled:vr}:{enabled:vr}}}),Wq=g.createContext(null),t_="button",Hq="Draggable";function Kq(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Ip(Hq),{activators:s,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:p}=g.useContext(Av),{role:h=t_,roleDescription:m="draggable",tabIndex:v=0}=o??{},x=(l==null?void 0:l.id)===t,b=g.useContext(x?zA:Wq),[w,S]=ag(),[k,C]=ag(),N=Tq(s,t),_=Ff(n);ri(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:k,data:_}),()=>{const M=d.get(t);M&&M.key===i&&d.delete(t)}),[d,t]);const O=g.useMemo(()=>({role:h,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&h===t_?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,h,v,x,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:O,isDragging:x,listeners:r?void 0:N,node:w,over:p,setNodeRef:S,setActivatorNodeRef:C,transform:b}}function qq(){return g.useContext(FA)}const Gq="Droppable",Yq={timeout:25};function Jq(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Ip(Gq),{active:s,dispatch:a,over:l,measureDroppableContainers:c}=g.useContext(Av),u=g.useRef({disabled:n}),d=g.useRef(!1),p=g.useRef(null),h=g.useRef(null),{disabled:m,updateMeasurementsFor:v,timeout:x}={...Yq,...o},b=Ff(v??r),w=g.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{c(Array.isArray(b.current)?b.current:[b.current]),h.current=null},x)},[x]),S=Rv({callback:w,disabled:m||!s}),k=g.useCallback((O,M)=>{S&&(M&&(S.unobserve(M),d.current=!1),O&&S.observe(O))},[S]),[C,N]=ag(k),_=Ff(t);return g.useEffect(()=>{!S||!C.current||(S.disconnect(),d.current=!1,S.observe(C.current))},[C,S]),g.useEffect(()=>(a({type:Ft.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:p,data:_}}),()=>a({type:Ft.UnregisterDroppable,key:i,id:r})),[r]),g.useEffect(()=>{n!==u.current.disabled&&(a({type:Ft.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:s,rect:p,isOver:(l==null?void 0:l.id)===r,node:C,over:l,setNodeRef:N}}function yS(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Xq(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ch(e){return e!==null&&e>=0}function Zq(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qq(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const $A=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=yS(t,r,n),s=t[o],a=i[o];return!a||!s?null:{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}},Eh={scaleX:1,scaleY:1},eG=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:s}=e;const a=(t=i[n])!=null?t:r;if(!a)return null;if(o===n){const c=i[s];return c?{x:0,y:n<s?c.top+c.height-(a.top+a.height):c.top-a.top,...Eh}:null}const l=tG(i,o,n);return o>n&&o<=s?{x:0,y:-a.height-l,...Eh}:o<n&&o>=s?{x:0,y:a.height+l,...Eh}:{x:0,y:0,...Eh}};function tG(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const BA="Sortable",VA=ye.createContext({activeIndex:-1,containerId:BA,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:$A,disabled:{draggable:!1,droppable:!1}});function nG(e){let{children:t,id:n,items:r,strategy:o=$A,disabled:i=!1}=e;const{active:s,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:u}=qq(),d=Ip(BA,n),p=a.rect!==null,h=g.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),m=s!=null,v=s?h.indexOf(s.id):-1,x=c?h.indexOf(c.id):-1,b=g.useRef(h),w=!Zq(h,b.current),S=x!==-1&&v===-1||w,k=Qq(i);ri(()=>{w&&m&&u(h)},[w,h,m,u]),g.useEffect(()=>{b.current=h},[h]);const C=g.useMemo(()=>({activeIndex:v,containerId:d,disabled:k,disableTransforms:S,items:h,overIndex:x,useDragOverlay:p,sortedRects:Xq(h,l),strategy:o}),[v,d,k.draggable,k.droppable,S,h,x,l,p,o]);return ye.createElement(VA.Provider,{value:C},t)}const rG=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return yS(n,r,o).indexOf(t)},oG=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:s,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==i&&o===s?!1:n?!0:s!==o&&t===l},iG={duration:200,easing:"ease"},UA="transform",sG=$f.Transition.toString({property:UA,duration:0,easing:"linear"}),aG={roleDescription:"sortable"};function lG(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,s]=g.useState(null),a=g.useRef(n);return ri(()=>{if(!t&&n!==a.current&&r.current){const l=o.current;if(l){const c=wu(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&s(u)}}n!==a.current&&(a.current=n)},[t,n,r,o]),g.useEffect(()=>{i&&s(null)},[i]),i}function cG(e){let{animateLayoutChanges:t=oG,attributes:n,disabled:r,data:o,getNewIndex:i=rG,id:s,strategy:a,resizeObserverConfig:l,transition:c=iG}=e;const{items:u,containerId:d,activeIndex:p,disabled:h,disableTransforms:m,sortedRects:v,overIndex:x,useDragOverlay:b,strategy:w}=g.useContext(VA),S=uG(r,h),k=u.indexOf(s),C=g.useMemo(()=>({sortable:{containerId:d,index:k,items:u},...o}),[d,o,k,u]),N=g.useMemo(()=>u.slice(u.indexOf(s)),[u,s]),{rect:_,node:O,isOver:M,setNodeRef:P}=Jq({id:s,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...l}}),{active:D,activatorEvent:$,activeNodeRect:U,attributes:K,setNodeRef:G,listeners:j,isDragging:T,over:E,setActivatorNodeRef:R,transform:A}=Kq({id:s,data:C,attributes:{...aG,...n},disabled:S.draggable}),I=TK(P,G),F=!!D,ce=F&&!m&&Ch(p)&&Ch(x),pe=!b&&T,W=pe&&ce?A:null,z=ce?W??(a??w)({rects:v,activeNodeRect:U,activeIndex:p,overIndex:x,index:k}):null,te=Ch(p)&&Ch(x)?i({id:s,items:u,activeIndex:p,overIndex:x}):k,se=D==null?void 0:D.id,Y=g.useRef({activeId:se,items:u,newIndex:te,containerId:d}),Oe=u!==Y.current.items,ae=t({active:D,containerId:d,isDragging:T,isSorting:F,id:s,index:k,items:u,newIndex:Y.current.newIndex,previousItems:Y.current.items,previousContainerId:Y.current.containerId,transition:c,wasDragging:Y.current.activeId!=null}),Me=lG({disabled:!ae,index:k,node:O,rect:_});return g.useEffect(()=>{F&&Y.current.newIndex!==te&&(Y.current.newIndex=te),d!==Y.current.containerId&&(Y.current.containerId=d),u!==Y.current.items&&(Y.current.items=u)},[F,te,d,u]),g.useEffect(()=>{if(se===Y.current.activeId)return;if(se&&!Y.current.activeId){Y.current.activeId=se;return}const sn=setTimeout(()=>{Y.current.activeId=se},50);return()=>clearTimeout(sn)},[se]),{active:D,activeIndex:p,attributes:K,data:C,rect:_,index:k,newIndex:te,items:u,isOver:M,isSorting:F,isDragging:T,listeners:j,node:O,overIndex:x,over:E,setNodeRef:I,setActivatorNodeRef:R,setDroppableNodeRef:P,setDraggableNodeRef:G,transform:Me??z,transition:rt()};function rt(){if(Me||Oe&&Y.current.newIndex===k)return sG;if(!(pe&&!hS($)||!c)&&(F||ae))return $f.Transition.toString({...c,property:UA})}}function uG(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function ug(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const dG=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],fG=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:s,scrollableAncestors:a}}=t;if(dG.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const p=o.get(d.id);if(p)switch(e.code){case Ue.Down:r.top<p.top&&l.push(d);break;case Ue.Up:r.top>p.top&&l.push(d);break;case Ue.Left:r.left>p.left&&l.push(d);break;case Ue.Right:r.left<p.left&&l.push(d);break}});const c=KK({active:n,collisionRect:r,droppableRects:o,droppableContainers:l,pointerCoordinates:null});let u=CA(c,"id");if(u===(s==null?void 0:s.id)&&c.length>1&&(u=c[1].id),u!=null){const d=i.get(n.id),p=i.get(u),h=p?o.get(p.id):null,m=p==null?void 0:p.node.current;if(m&&h&&d&&p){const x=jv(m).some((N,_)=>a[_]!==N),b=WA(d,p),w=pG(d,p),S=x||!b?{x:0,y:0}:{x:w?r.width-h.width:0,y:w?r.height-h.height:0},k={x:h.left,y:h.top};return S.x&&S.y?k:zf(k,S)}}}};function WA(e,t){return!ug(e)||!ug(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function pG(e,t){return!ug(e)||!ug(t)||!WA(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}const Su=g.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:Fe("flex h-10 m-1 w-[calc(100%-8px)] rounded-md border border-input bg-bg-primary px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Su.displayName="Input";function Rr({path:e}){const{validationErrors:t}=Gi(),n=fr(),r=[];for(const o in t)o.startsWith(e)&&r.push(...t[o].map(i=>({...i,path:o})));return r.length===0?null:r.length===1?f.jsxs("div",{className:"p-4 font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx("div",{children:r[0].message}),e!==r[0].path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at"," ",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(r[0].path)},children:r[0].path})]})]}):f.jsx(cS,{type:"single",collapsible:!0,children:f.jsxs(If,{value:"validation-errors",className:"font-normal rounded bg-bg-error-primary text-text-primary",children:[f.jsx(Df,{className:"p-4",children:f.jsxs("div",{className:"flex justify-between w-full",children:[f.jsx("span",{className:"truncate",children:"Multiple validation errors"}),f.jsxs("span",{className:"pr-4",children:["(",r.length,")"]})]})}),f.jsx(Lf,{children:r.map(o=>f.jsxs("div",{className:"px-4",children:[f.jsx("div",{children:o.message}),e!==o.path&&f.jsxs("div",{className:"pl-4 font-thin",children:["at",f.jsx("span",{className:"underline cursor-pointer",onClick:()=>{n.navigate(o.path)},children:o.path})]})]},o.path))})]})})}function HA({path:e,autoFocus:t}){const n="string",r=Ct(e),o=Je(e,n),{patchPath:i,addDebouncedPatch:s}=yn(e),[a,l]=g.useState(!1),[c,u]=g.useState(null);return g.useEffect(()=>{!a&&"data"in o&&o.data!==void 0&&u(o.data)},["data"in o&&o.data,a]),g.useEffect(()=>{if("data"in o&&o.data!==void 0&&c!==null&&o.data!==c){const d=setTimeout(()=>{console.warn(`Mis-matched strings: '${o.data}' and '${c}'. Patching...`),s(()=>[{op:"replace",path:i,value:c}],e)},3e3);return()=>{clearTimeout(d)}}},["data"in o&&o.data,c]),r.status==="error"?f.jsx(Rt,{path:e,error:r.error,type:n}):o.status==="error"?f.jsx(qe,{path:e,error:o.error,type:n}):o.status=="not-found"||r.status==="not-found"?f.jsx(vn,{path:e,type:n}):r.status==="loading"?f.jsx(nt,{path:e,type:n}):!("data"in o)||o.data===void 0?f.jsx(nt,{path:e,type:n}):r.data.type!==n?f.jsx(pr,{path:e,expectedType:n,actualType:r.data.type}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsxs("div",{className:"relative w-full",children:[f.jsx(Su,{className:"pr-6 sm:pr-8 sm:w-[calc(100%-0.5rem)]",autoFocus:t,onFocus:()=>{l(!0)},onBlur:()=>{l(!1)},value:c||"",onChange:d=>{u(d.target.value),s(()=>[{op:"replace",path:i,value:d.target.value}],e)}}),f.jsx("span",{className:xe("absolute right-0 -translate-x-full top-4 duration-1000",{"opacity-0":o.data===c,"opacity-100":o.data!==c}),children:f.jsx(hu,{className:"transition-opacity animate-spin",size:12})})]})]})}function hG({path:e}){const t=Je(e,"string");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"string"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function mG({path:e}){const t="boolean",n=Ct(e),r=Je(e,t),{patchPath:o,addPatch:i}=yn(e);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data,a=s===null?"indeterminate":s;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(Pp,{checked:a,onCheckedChange:()=>{let l=!1;n.data.opt?a===!0?l=null:a===null?l=!1:a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1):a===!0?l=!1:a==="indeterminate"||a===!1?l=!0:(console.warn("Unexpected value for boolean field",a),l=!1),i([{op:"replace",path:o,value:l}])}})]})}function gG({path:e,source:t,isNullable:n,loadingStatus:r}){const{addPatch:o,patchPath:i}=yn(e);return typeof t!="boolean"&&t!==null?f.jsx(qe,{path:e,error:"Expected boolean",type:"boolean"}):f.jsx(Pp,{disabled:r==="loading",checked:t===null?"indeterminate":typeof t=="boolean"?t:!1,onCheckedChange:()=>{o(t===null?[{op:"replace",path:i,value:!0}]:t===!1&&n?[{op:"replace",path:i,value:null}]:t===!1?[{op:"replace",path:i,value:!0}]:[{op:"replace",path:i,value:!1}])}})}function vG({path:e}){const t=Je(e,"boolean");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"boolean"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):t.data===!0?f.jsx("div",{className:"flex items-center justify-center w-4 h-4 border rounded border-text-primary",children:f.jsx(wp,{className:"w-3 h-3"})}):t.data===!1?f.jsx("div",{className:"w-4 h-4 border rounded border-text-primary"}):(console.warn("Unexpected value for boolean field",t.data),f.jsx("div",{className:"w-4 h-4 rounded border-bg-brand-primary"}))}function yG({path:e}){const t="number",n=Ct(e),r=Je(e,t),{patchPath:o,addPatch:i}=yn(e);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const s=r.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(Su,{inputMode:"numeric",value:s||0,onChange:a=>{const l=Number(a.target.value);Number.isNaN(l)||i([{op:"replace",path:o,value:l}])}})]})}function xG({path:e}){const t=Je(e,"number");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"number"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}var bG="VisuallyHidden",KA=g.forwardRef((e,t)=>f.jsx(ke.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));KA.displayName=bG;var wG=[" ","Enter","ArrowUp","ArrowDown"],SG=[" ","Enter"],Dp="Select",[Iv,Dv,kG]=Ov(Dp),[ku,Ope]=$o(Dp,[kG,wa]),Lv=wa(),[CG,ka]=ku(Dp),[EG,_G]=ku(Dp),qA=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:h,form:m}=e,v=Lv(t),[x,b]=g.useState(null),[w,S]=g.useState(null),[k,C]=g.useState(!1),N=kp(c),[_=!1,O]=Qr({prop:r,defaultProp:o,onChange:i}),[M,P]=Qr({prop:s,defaultProp:a,onChange:l}),D=g.useRef(null),$=x?m||!!x.closest("form"):!0,[U,K]=g.useState(new Set),G=Array.from(U).map(j=>j.props.value).join(";");return f.jsx(wv,{...v,children:f.jsxs(CG,{required:h,scope:t,trigger:x,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:k,onValueNodeHasChildrenChange:C,contentId:Gr(),value:M,onValueChange:P,open:_,onOpenChange:O,dir:N,triggerPointerDownPosRef:D,disabled:p,children:[f.jsx(Iv.Provider,{scope:t,children:f.jsx(EG,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(j=>{K(T=>new Set(T).add(j))},[]),onNativeOptionRemove:g.useCallback(j=>{K(T=>{const E=new Set(T);return E.delete(j),E})},[]),children:n})}),$?f.jsxs(g2,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:d,value:M,onChange:j=>P(j.target.value),disabled:p,form:m,children:[M===void 0?f.jsx("option",{value:""}):null,Array.from(U)]},G):null]})})};qA.displayName=Dp;var GA="SelectTrigger",YA=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Lv(n),s=ka(GA,n),a=s.disabled||r,l=Ie(t,s.onTriggerChange),c=Dv(n),u=g.useRef("touch"),[d,p,h]=v2(v=>{const x=c().filter(S=>!S.disabled),b=x.find(S=>S.value===s.value),w=y2(x,v,b);w!==void 0&&s.onValueChange(w.value)}),m=v=>{a||(s.onOpenChange(!0),h()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return f.jsx(_p,{asChild:!0,...i,children:f.jsx(ke.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":m2(s.value)?"":void 0,...o,ref:l,onClick:Q(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&m(v)}),onPointerDown:Q(o.onPointerDown,v=>{u.current=v.pointerType;const x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(m(v),v.preventDefault())}),onKeyDown:Q(o.onKeyDown,v=>{const x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&p(v.key),!(x&&v.key===" ")&&wG.includes(v.key)&&(m(),v.preventDefault())})})})});YA.displayName=GA;var JA="SelectValue",XA=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=ka(JA,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Ie(t,l.onValueNodeChange);return gn(()=>{c(u)},[c,u]),f.jsx(ke.span,{...a,ref:d,style:{pointerEvents:"none"},children:m2(l.value)?f.jsx(f.Fragment,{children:s}):i})});XA.displayName=JA;var NG="SelectIcon",ZA=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return f.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});ZA.displayName=NG;var OG="SelectPortal",QA=e=>f.jsx(Np,{asChild:!0,...e});QA.displayName=OG;var gl="SelectContent",e2=g.forwardRef((e,t)=>{const n=ka(gl,e.__scopeSelect),[r,o]=g.useState();if(gn(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Nr.createPortal(f.jsx(t2,{scope:e.__scopeSelect,children:f.jsx(Iv.Slot,{scope:e.__scopeSelect,children:f.jsx("div",{children:e.children})})}),i):null}return f.jsx(n2,{...e,ref:t})});e2.displayName=gl;var po=10,[t2,Ca]=ku(gl),TG="SelectContentImpl",n2=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:x,...b}=e,w=ka(gl,n),[S,k]=g.useState(null),[C,N]=g.useState(null),_=Ie(t,z=>k(z)),[O,M]=g.useState(null),[P,D]=g.useState(null),$=Dv(n),[U,K]=g.useState(!1),G=g.useRef(!1);g.useEffect(()=>{if(S)return Cv(S)},[S]),vv();const j=g.useCallback(z=>{const[te,...se]=$().map(ae=>ae.ref.current),[Y]=se.slice(-1),Oe=document.activeElement;for(const ae of z)if(ae===Oe||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===te&&C&&(C.scrollTop=0),ae===Y&&C&&(C.scrollTop=C.scrollHeight),ae==null||ae.focus(),document.activeElement!==Oe))return},[$,C]),T=g.useCallback(()=>j([O,S]),[j,O,S]);g.useEffect(()=>{U&&T()},[U,T]);const{onOpenChange:E,triggerPointerDownPosRef:R}=w;g.useEffect(()=>{if(S){let z={x:0,y:0};const te=Y=>{var Oe,ae;z={x:Math.abs(Math.round(Y.pageX)-(((Oe=R.current)==null?void 0:Oe.x)??0)),y:Math.abs(Math.round(Y.pageY)-(((ae=R.current)==null?void 0:ae.y)??0))}},se=Y=>{z.x<=10&&z.y<=10?Y.preventDefault():S.contains(Y.target)||E(!1),document.removeEventListener("pointermove",te),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",se,{capture:!0})}}},[S,E,R]),g.useEffect(()=>{const z=()=>E(!1);return window.addEventListener("blur",z),window.addEventListener("resize",z),()=>{window.removeEventListener("blur",z),window.removeEventListener("resize",z)}},[E]);const[A,I]=v2(z=>{const te=$().filter(Oe=>!Oe.disabled),se=te.find(Oe=>Oe.ref.current===document.activeElement),Y=y2(te,z,se);Y&&setTimeout(()=>Y.ref.current.focus())}),F=g.useCallback((z,te,se)=>{const Y=!G.current&&!se;(w.value!==void 0&&w.value===te||Y)&&(M(z),Y&&(G.current=!0))},[w.value]),ce=g.useCallback(()=>S==null?void 0:S.focus(),[S]),pe=g.useCallback((z,te,se)=>{const Y=!G.current&&!se;(w.value!==void 0&&w.value===te||Y)&&D(z)},[w.value]),W=r==="popper"?pb:r2,V=W===pb?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:h,sticky:m,hideWhenDetached:v,avoidCollisions:x}:{};return f.jsx(t2,{scope:n,content:S,viewport:C,onViewportChange:N,itemRefCallback:F,selectedItem:O,onItemLeave:ce,itemTextRefCallback:pe,focusSelectedItem:T,selectedItemText:P,position:r,isPositioned:U,searchRef:A,children:f.jsx(Op,{as:$i,allowPinchZoom:!0,children:f.jsx(Cp,{asChild:!0,trapped:w.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:Q(o,z=>{var te;(te=w.trigger)==null||te.focus({preventScroll:!0}),z.preventDefault()}),children:f.jsx(gu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(W,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:z=>z.preventDefault(),...b,...V,onPlaced:()=>K(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Q(b.onKeyDown,z=>{const te=z.ctrlKey||z.altKey||z.metaKey;if(z.key==="Tab"&&z.preventDefault(),!te&&z.key.length===1&&I(z.key),["ArrowUp","ArrowDown","Home","End"].includes(z.key)){let Y=$().filter(Oe=>!Oe.disabled).map(Oe=>Oe.ref.current);if(["ArrowUp","End"].includes(z.key)&&(Y=Y.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const Oe=z.target,ae=Y.indexOf(Oe);Y=Y.slice(ae+1)}setTimeout(()=>j(Y)),z.preventDefault()}})})})})})})});n2.displayName=TG;var MG="SelectItemAlignedPosition",r2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=ka(gl,n),s=Ca(gl,n),[a,l]=g.useState(null),[c,u]=g.useState(null),d=Ie(t,_=>u(_)),p=Dv(n),h=g.useRef(!1),m=g.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:b,focusSelectedItem:w}=s,S=g.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&v&&x&&b){const _=i.trigger.getBoundingClientRect(),O=c.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),P=b.getBoundingClientRect();if(i.dir!=="rtl"){const Oe=P.left-O.left,ae=M.left-Oe,Me=_.left-ae,rt=_.width+Me,sn=Math.max(rt,O.width),an=window.innerWidth-po,Fr=H0(ae,[po,Math.max(po,an-sn)]);a.style.minWidth=rt+"px",a.style.left=Fr+"px"}else{const Oe=O.right-P.right,ae=window.innerWidth-M.right-Oe,Me=window.innerWidth-_.right-ae,rt=_.width+Me,sn=Math.max(rt,O.width),an=window.innerWidth-po,Fr=H0(ae,[po,Math.max(po,an-sn)]);a.style.minWidth=rt+"px",a.style.right=Fr+"px"}const D=p(),$=window.innerHeight-po*2,U=v.scrollHeight,K=window.getComputedStyle(c),G=parseInt(K.borderTopWidth,10),j=parseInt(K.paddingTop,10),T=parseInt(K.borderBottomWidth,10),E=parseInt(K.paddingBottom,10),R=G+j+U+E+T,A=Math.min(x.offsetHeight*5,R),I=window.getComputedStyle(v),F=parseInt(I.paddingTop,10),ce=parseInt(I.paddingBottom,10),pe=_.top+_.height/2-po,W=$-pe,V=x.offsetHeight/2,z=x.offsetTop+V,te=G+j+z,se=R-te;if(te<=pe){const Oe=D.length>0&&x===D[D.length-1].ref.current;a.style.bottom="0px";const ae=c.clientHeight-v.offsetTop-v.offsetHeight,Me=Math.max(W,V+(Oe?ce:0)+ae+T),rt=te+Me;a.style.height=rt+"px"}else{const Oe=D.length>0&&x===D[0].ref.current;a.style.top="0px";const Me=Math.max(pe,G+v.offsetTop+(Oe?F:0)+V)+se;a.style.height=Me+"px",v.scrollTop=te-pe+v.offsetTop}a.style.margin=`${po}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,a,c,v,x,b,i.dir,r]);gn(()=>S(),[S]);const[k,C]=g.useState();gn(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const N=g.useCallback(_=>{_&&m.current===!0&&(S(),w==null||w(),m.current=!1)},[S,w]);return f.jsx(jG,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:N,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:f.jsx(ke.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});r2.displayName=MG;var PG="SelectPopperPosition",pb=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=po,...i}=e,s=Lv(n);return f.jsx(Sv,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pb.displayName=PG;var[jG,xS]=ku(gl,{}),hb="SelectViewport",o2=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Ca(hb,n),s=xS(hb,n),a=Ie(t,i.onViewportChange),l=g.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(Iv.Slot,{scope:n,children:f.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Q(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=s;if(p!=null&&p.current&&d){const h=Math.abs(l.current-u.scrollTop);if(h>0){const m=window.innerHeight-po*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),b=Math.max(v,x);if(b<m){const w=b+h,S=Math.min(m,w),k=w-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});o2.displayName=hb;var i2="SelectGroup",[RG,AG]=ku(i2),IG=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Gr();return f.jsx(RG,{scope:n,id:o,children:f.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});IG.displayName=i2;var s2="SelectLabel",a2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=AG(s2,n);return f.jsx(ke.div,{id:o.id,...r,ref:t})});a2.displayName=s2;var dg="SelectItem",[DG,l2]=ku(dg),c2=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=ka(dg,n),l=Ca(dg,n),c=a.value===r,[u,d]=g.useState(i??""),[p,h]=g.useState(!1),m=Ie(t,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,r,o)}),v=Gr(),x=g.useRef("touch"),b=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(DG,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:g.useCallback(w=>{d(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx(Iv.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:f.jsx(ke.div,{role:"option","aria-labelledby":v,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:m,onFocus:Q(s.onFocus,()=>h(!0)),onBlur:Q(s.onBlur,()=>h(!1)),onClick:Q(s.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:Q(s.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:Q(s.onPointerDown,w=>{x.current=w.pointerType}),onPointerMove:Q(s.onPointerMove,w=>{var S;x.current=w.pointerType,o?(S=l.onItemLeave)==null||S.call(l):x.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Q(s.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:Q(s.onKeyDown,w=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&w.key===" "||(SG.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});c2.displayName=dg;var sd="SelectItemText",u2=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=ka(sd,n),a=Ca(sd,n),l=l2(sd,n),c=_G(sd,n),[u,d]=g.useState(null),p=Ie(t,b=>d(b),l.onItemTextChange,b=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,b,l.value,l.disabled)}),h=u==null?void 0:u.textContent,m=g.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:v,onNativeOptionRemove:x}=c;return gn(()=>(v(m),()=>x(m)),[v,x,m]),f.jsxs(f.Fragment,{children:[f.jsx(ke.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Nr.createPortal(i.children,s.valueNode):null]})});u2.displayName=sd;var d2="SelectItemIndicator",f2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l2(d2,n).isSelected?f.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});f2.displayName=d2;var mb="SelectScrollUpButton",LG=g.forwardRef((e,t)=>{const n=Ca(mb,e.__scopeSelect),r=xS(mb,e.__scopeSelect),[o,i]=g.useState(!1),s=Ie(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx(p2,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});LG.displayName=mb;var gb="SelectScrollDownButton",FG=g.forwardRef((e,t)=>{const n=Ca(gb,e.__scopeSelect),r=xS(gb,e.__scopeSelect),[o,i]=g.useState(!1),s=Ie(t,r.onScrollButtonChange);return gn(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?f.jsx(p2,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});FG.displayName=gb;var p2=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Ca("SelectScrollButton",n),s=g.useRef(null),a=Dv(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),gn(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),f.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Q(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Q(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Q(o.onPointerLeave,()=>{l()})})}),zG="SelectSeparator",h2=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return f.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});h2.displayName=zG;var vb="SelectArrow",$G=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Lv(n),i=ka(vb,n),s=Ca(vb,n);return i.open&&s.position==="popper"?f.jsx(kv,{...o,...r,ref:t}):null});$G.displayName=vb;function m2(e){return e===""||e===void 0}var g2=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=g.useRef(null),i=Ie(t,o),s=V1(n);return g.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&u){const d=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(d)}},[s,n]),f.jsx(KA,{asChild:!0,children:f.jsx("select",{...r,ref:i,defaultValue:n})})});g2.displayName="BubbleSelect";function v2(e){const t=$t(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function y2(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=BG(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function BG(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var x2=qA,bS=YA,VG=XA,UG=ZA,WG=QA,wS=e2,b2=o2,w2=a2,SS=c2,S2=u2,HG=f2,k2=h2;const kS=x2,CS=VG,Fv=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(bS,{ref:r,className:Fe("flex h-10 m-1 w-[calc(100%-8px)] items-center justify-between rounded-md border border-input bg-bg-primary px-3 py-2 text-sm ring-offset-background placeholder:text-fg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(UG,{asChild:!0,children:f.jsx(Sp,{className:"w-4 h-4 opacity-50"})})]}));Fv.displayName=bS.displayName;const zv=g.forwardRef(({className:e,children:t,position:n="popper",container:r,...o},i)=>f.jsx(WG,{container:r,children:f.jsx(wS,{ref:i,className:Fe("relative z-50 min-w-[10rem] overflow-hidden rounded-md border bg-bg-primary text-text-primary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...o,children:f.jsx(b2,{className:Fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));zv.displayName=wS.displayName;const KG=g.forwardRef(({className:e,...t},n)=>f.jsx(w2,{ref:n,className:Fe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));KG.displayName=w2.displayName;const $v=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(SS,{ref:r,className:Fe("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-text-primary outline-none focus:bg-bg-brand-primary_alt focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(HG,{children:f.jsx(wp,{className:"w-4 h-4"})})}),f.jsx(S2,{children:t})]}));$v.displayName=SS.displayName;const qG=g.forwardRef(({className:e,...t},n)=>f.jsx(k2,{ref:n,className:Fe("-mx-1 my-1 h-px bg-bg-secondary",e),...t}));qG.displayName=k2.displayName;function vl(e){if(e.type==="object")return Object.fromEntries(Object.keys(e.items).map(n=>[n,vl(e.items[n])]));if(e.type==="array")return[];if(e.type==="record")return{};if(e.opt)return null;if(e.type==="richtext")return[];if(e.type==="string")return"";if(e.type==="boolean")return!1;if(e.type==="number")return 0;if(e.type==="keyOf")return e.values==="string"?"":e.values[0];if(e.type==="file"||e.type==="image")return null;if(e.type==="literal")return e.value;if(e.type==="union")return typeof e.key=="string"?vl(e.items[0]):e.key.value;if(e.type==="date")return qi(new Date,"yyyy-MM-dd");throw Error("Unexpected schema type: "+JSON.stringify(e))}function el(e,t){return e.includes("?p=")?e+"."+JSON.stringify(t):e+"?p="+JSON.stringify(t)}function GG(e){const t=e.replace(/([A-Z])/g," $1").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function YG({children:e}){return f.jsx("div",{children:GG(e)})}function C2(e){const[t,n]=ue.splitModuleFilePathAndModulePath(e),r=ue.joinModuleFilePathAndModulePath(t,ue.splitModulePath(n).slice(0,-1).join(".")),o=Ct(r);return{path:r,schema:"data"in o?o.data:void 0}}const n_=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="record",JG=(e,t,n)=>t!==e&&(n==null?void 0:n.type)==="array",XG=e=>(e==null?void 0:e.type)==="record",ZG=e=>(e==null?void 0:e.type)==="array";function QG(e,t,n,r){if(!t[n])return console.error(`Source not found for ${n}`),[];if(!e[n])return console.error(`Schema not found for ${n}`),[];const s=n,a=[],l=(c,u,d)=>{var p;if(u===void 0){console.error(`Schema not found for ${c}`);return}if(u.type==="keyOf")u.path===s&&(r?typeof d=="string"&&d===r&&(a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c)):a.includes(c)?console.error(`Duplicate keyOf reference found for ${c} in ${n}`):a.push(c));else if(u.type==="object"||u.type==="record"){if(o_(d)||E2(d))for(const h in d){const m=d==null?void 0:d[h],v=u.type==="object"?(p=u.items)==null?void 0:p[h]:u.item;m&&l(r_(c,h),v,m)}}else if(u.type==="array"){if(eY(d)){let h=0;for(const m of d)l(r_(c,h),u.item,m),h++}}else if(u.type==="union"){const h=u.key;if(typeof h=="string"&&o_(d)){const m=d[h];if(typeof m=="string"){const v=u.items.filter(x=>x.type==="object").find(x=>{const b=x.items[h];if((b==null?void 0:b.type)==="literal")return b.value===m});v&&l(c,v,d)}}}else u.type==="string"||u.type==="number"||u.type==="boolean"||u.type==="literal"||u.type==="date"||u.type==="image"||u.type==="file"||u.type==="richtext"||console.error("Could not get keyOf references. Unhandled schema type",u)};for(const c in e){const u=c;l(c,e[u],t[u])}return a}function r_(e,t){return e.includes(ea)?`${e}.${JSON.stringify(t)}`:`${e}${ea}${JSON.stringify(t)}`}function o_(e){return E2(e)}function E2(e){return typeof e=="object"&&!!e&&!js(e)}function eY(e){return typeof e=="object"&&!!e&&js(e)}function ES({path:e,disabled:t}){const[n,r]=ue.splitModuleFilePathAndModulePath(e),o=ue.splitModuleFilePath(n),i=ue.splitModulePath(r),{navigate:s}=fr();return f.jsxs("div",{className:"w-full",children:[f.jsx("button",{type:"button",title:n,disabled:t,className:"inline-block text-left truncate",onClick:()=>{s(n)},children:o.map((a,l)=>f.jsxs(g.Fragment,{children:[l===0&&f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:xe({"text-muted":!(i.length===0&&l===o.length-1)}),children:ia(a)}),l>0&&l<o.length-1&&f.jsx("span",{className:"text-muted",children:"/"})]},`${a}-${l}`))}),f.jsx("button",{type:"button",disabled:t,title:ue.joinModuleFilePathAndModulePath(n,r),className:"inline-block text-left truncate",onClick:()=>{s(ue.joinModuleFilePathAndModulePath(n,r))},children:i.map((a,l)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{className:"text-muted",children:"/"}),f.jsx("span",{className:xe({"text-muted":l===i.length-2}),children:ia(a)})]},`${a}-${l}`))})]})}function _2({path:e,variant:t}){const n=Ct(e),{path:r,schema:o}=C2(e),i=N2(e),s=i[i.length-1],a=oY(r,n_(e,r,o)?s==null?void 0:s.part:void 0);return f.jsxs("span",{className:"inline-flex items-center gap-2",children:[n_(e,r,o)&&f.jsxs(f.Fragment,{children:[f.jsx(i_,{refs:a,variant:t}),f.jsx(rY,{defaultValue:s.text,path:e,parentPath:r,variant:t,refs:a}),f.jsx(nY,{path:e,parentPath:r,variant:t,refs:a})]}),ZG("data"in n?n.data:void 0)&&f.jsx(tY,{path:e,variant:t}),XG("data"in n?n.data:void 0)&&f.jsxs(f.Fragment,{children:[f.jsx(i_,{refs:a,variant:t}),f.jsx(iY,{path:e,variant:t})]})]})}function i_({refs:e,variant:t}){const n=no();return e.length===0?null:f.jsxs(ca,{children:[f.jsxs(Nc,{children:[f.jsx(Oc,{children:f.jsx(Ut,{asChild:!0,size:Lp(t),variant:Fp(t),children:f.jsx(Mp,{children:f.jsx(NP,{size:Bv(t)})})})}),f.jsx(Qa,{side:"top",children:"References to this record"})]}),f.jsx(Ui,{container:n,children:f.jsx("div",{className:"text-sm",children:f.jsx("ul",{children:e.map(r=>f.jsx("li",{children:f.jsx(ES,{path:r})},r))})})})]})}function Bv(e){return e==="module"?16:12}function Lp(e){return"icon"}function Fp(e){return e==="module"?"outline":"ghost"}function tY({path:e,variant:t}){const{navigate:n}=fr(),{addPatch:r,patchPath:o}=yn(e),i=Ct(e),s=Je(e,"array"),[a]=ue.splitModuleFilePathAndModulePath(e);if(!("data"in s)||!s.data||!("data"in i))return null;const l=i.data;if(l.type!=="array")return console.error("Cannot add to non-array",s,{parentPath:e}),null;const c=s.data.length;return f.jsx(Ut,{title:"Add",size:Lp(t),variant:Fp(t),onClick:()=>{const u=o.concat(c.toString());r([{op:"add",path:u,value:vl(l.item)}]),l.item.type!=="string"&&n(ue.joinModuleFilePathAndModulePath(a,ue.patchPathToModulePath(u)))},children:f.jsx(_P,{size:Bv(t)})})}function nY({path:e,parentPath:t,variant:n,refs:r}){const{navigate:o}=fr(),{addPatch:i,patchPath:s}=yn(e),a=Je(t,"record");return!("data"in a)||a.data===void 0||a.data===null?(console.error("Parent source not found",a,{path:e}),null):f.jsxs(Nc,{children:[f.jsx(Oc,{children:f.jsx(Ut,{size:Lp(n),variant:Fp(n),disabled:r.length>0,onClick:()=>{i([{op:"remove",path:s}]),o(t)},children:f.jsx($9,{size:Bv(n)})})}),f.jsx(Qa,{side:"top",children:r.length>0?f.jsxs("div",{children:[f.jsx("p",{children:"Cannot delete record."}),f.jsxs("p",{children:["You must change the following references"," ",f.jsx(NP,{size:10,className:"inline"})," to be able to delete:"]}),f.jsx("ul",{children:r.map(l=>f.jsx("li",{children:f.jsx(ES,{path:l})},l))})]}):f.jsx("p",{children:"Delete record"})})]})}function rY({defaultValue:e,path:t,parentPath:n,variant:r,refs:o}){const[i,s]=ue.splitModuleFilePathAndModulePath(n),{navigate:a}=fr(),{addPatch:l,addModuleFilePatch:c}=yn(t),u=Je(n,"record"),[d,p]=g.useState(e),[h,m]=g.useState(!1),v=no();g.useEffect(()=>{const w=S=>{S.key==="Escape"&&m(!1)};return window.addEventListener("keydown",w),()=>{window.removeEventListener("keydown",w)}},[]);const x=ue.createPatchPath(s);if(!("data"in u)||u.data===void 0||u.data===null)return console.error("Parent source not found",u,{path:t}),null;const b=d===e||d===""||d in u.data;return f.jsxs(ca,{open:h,children:[f.jsxs(Nc,{children:[f.jsx(Oc,{children:f.jsx(Ut,{asChild:!0,size:Lp(r),variant:Fp(r),children:f.jsx(Mp,{onClick:()=>{m(!0)},children:f.jsx(D9,{size:16})})})}),f.jsx(Qa,{side:"top",children:"Change name"})]}),f.jsx(Ui,{container:v,className:"text-text-primary",children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:w=>{w.preventDefault();const S=[{op:"move",from:x.concat(e),path:x.concat(d)}];l(S);for(const k of o){const[C,N]=ue.splitModuleFilePathAndModulePath(k),_=ue.createPatchPath(N);c(C,[{op:"replace",path:_,value:d}])}a(ue.joinModuleFilePathAndModulePath(i,ue.patchPathToModulePath(x.concat(d))),{replace:!0}),m(!1)},children:[f.jsx(Su,{type:"text",value:d,onChange:w=>{p(w.target.value)}}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ut,{disabled:b,variant:"outline",type:"submit",children:"Update"}),f.jsx(Ut,{variant:"ghost",type:"reset",onClick:()=>{m(!1),p(e)},children:"Cancel"})]})]})})]})}function oY(e,t){const n=dv(),r=vP(),o=a9();return g.useMemo(()=>o[e]!==void 0&&"data"in n&&n.data!==void 0&&n.data[e]!==void 0?QG(n.data,o,e,t):[],[r,o,"data"in n&&n.data,e,t])}function iY({path:e,variant:t}){const n=Je(e,"record"),r=Ct(e),o=no(),{addPatch:i}=yn(e),[s,a]=g.useState(""),{navigate:l}=fr(),[c,u]=g.useState(!1);if(g.useEffect(()=>{const v=x=>{x.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}},[]),!("data"in n)||n.data===void 0||n.data===null)return console.error("Source not found",n,{path:e}),null;if(!("data"in r)||r.data===void 0)return console.error("Schema not found",n,{path:e}),null;const d=r.data;if(d.type!=="record")return console.error("Schema is not a record",r,{path:e}),null;const p=s===""||s in n.data,[h,m]=ue.splitModuleFilePathAndModulePath(e);return f.jsxs(ca,{open:c,children:[f.jsx(Ut,{asChild:!0,size:Lp(t),variant:Fp(t),children:f.jsx(Mp,{onClick:()=>{u(!0)},title:"Add",children:f.jsx(_P,{size:Bv(t)})})}),f.jsx(Ui,{container:o,children:f.jsxs("form",{className:"flex flex-col gap-2",onSubmit:v=>{v.preventDefault();const x=ue.createPatchPath(m).concat(s);i([{op:"add",path:x,value:vl(d.item)}]),l(ue.joinModuleFilePathAndModulePath(h,ue.patchPathToModulePath(x))),u(!1)},children:[f.jsx(Su,{autoFocus:!0,value:s,onChange:v=>{a(v.target.value)}}),f.jsx("div",{children:f.jsx(Ut,{type:"submit",disabled:p,variant:"outline",children:"Add"})})]})})]})}function N2(e){const[t,n]=ue.splitModuleFilePathAndModulePath(e),r=ue.splitModuleFilePath(t).map(a=>({text:ia(a),part:a,sourcePath:t}));if(!n)return r;const o=ue.splitModulePath(n),i=[];let s="";for(let a=0;a<o.length;a++){let l=(s?s+".":"")+JSON.stringify(o[a]);n.startsWith(l)||(l=(s?s+".":"")+o[a]),s=l,i.push({text:o[a],part:o[a],sourcePath:ue.joinModuleFilePathAndModulePath(t,l)})}return r.concat(i)}function O2({label:e,children:t,path:n,transparent:r,type:o,foldLevel:i="1"}){var S,k,C;const s=vP(),{validationErrors:a}=Gi(),{patchPath:l,addPatch:c}=yn(n),u=Ct(n),d=Je(n,o),[p,h]=g.useState(!0),[m,v]=g.useState(!1);g.useEffect(()=>{var N,_;"data"in d&&d.data===null&&"data"in u&&!u.data.opt&&(((N=u.data)==null?void 0:N.type)==="image"||((_=u.data)==null?void 0:_.type)==="file")&&v(!0)},[d,u]);const x="data"in d?d.data:void 0,b="data"in u&&((S=u.data)==null?void 0:S.type)==="boolean",w="data"in u&&((k=u.data)==null?void 0:k.opt)===!0;return f.jsxs("div",{className:xe("p-4 border rounded-lg",{"bg-bg-tertiary":!r,"border-border-error":((C=a[n])==null?void 0:C.length)>0}),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[!b&&w&&f.jsx(Pp,{disabled:s==="loading",checked:x!==null||m,onCheckedChange:()=>{(u.data.type==="image"||u.data.type==="file")&&x===null?v(!0):c(x===null?[{op:"replace",path:l,value:vl({...u.data,opt:!1})}]:[{op:"replace",path:l,value:null}])}}),b&&f.jsx(gG,{path:n,isNullable:w,loadingStatus:s,source:x}),typeof e=="string"&&f.jsx(YG,{children:e}),e&&typeof e!="string"&&e]}),f.jsxs("div",{className:"flex items-center gap-2",children:[x!==null&&f.jsx(_2,{path:n,variant:"field"}),x!==null&&!b&&f.jsxs("button",{onClick:()=>h(N=>!N),className:xe("transform transition-transform",{"rotate-180":p}),children:[i==="1"&&f.jsx(Sp,{size:16}),i==="2"&&f.jsx(y9,{size:16})]})]})]}),!b&&f.jsx(Pf,{isOpen:p&&(x!==null||m),children:(x!==null||m)&&f.jsx("div",{className:"flex flex-col gap-6 pt-6",children:t})})]})}function sY({path:e}){const t="object",n=Ct(e),r=Je(e,t);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const o=n.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx("div",{className:"flex flex-col gap-6",children:Object.entries(o.items).map(([i,s])=>{const a=el(e,i);return f.jsx(O2,{label:i,path:a,type:s.type,children:f.jsx(dy,{path:a,schema:s},a)},a)})})]})}function aY({path:e}){const t="object",n=Ct(e);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.data.type!=="object")return f.jsx(pr,{path:e,expectedType:"object",actualType:n.data.type});const r=n.data;return f.jsx(T2,{path:e,schema:r})}function T2({path:e,schema:t}){return f.jsx("div",{className:"grid grid-cols-[min-content,1fr] text-left gap-2 text-xs",children:Object.keys(t.items).map(n=>{const r=el(e,n);return f.jsx(lY,{label:n,children:f.jsx(Sk,{path:r})},n)})})}function lY({label:e,children:t}){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex whitespace-nowrap text-fg-quinary",children:pv(e)}),t]})}function yb(e){return typeof e.key!="string"}function cY({path:e}){const t="union",n=Ct(e),r=Je(e,t);if(n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const o=r.data;if(yb(n.data))return typeof o!="string"&&o!==null?f.jsx(qe,{path:e,error:"Expected source to be a string, but found: "+typeof o,type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(dY,{path:e,source:o,options:n.data.items.concat(n.data.key).flatMap(i=>(i==null?void 0:i.type)==="literal"?[i.value]:(console.warn("Unexpected item in string union",i),[]))})]});if(!yb(n.data))return typeof o!="object"?f.jsx(qe,{path:e,error:"Expected source to be an object, but found: "+typeof o,type:t}):Array.isArray(o)?f.jsx(qe,{path:e,error:"Expected source to be an object, but found an array",type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(uY,{path:e,schema:n.data})]})}function uY({path:e,schema:t}){const n=xP(e),{addPatch:r,patchPath:o}=yn(e),i=no(),s=el(e,t.key),a=Je(s,"literal");if(!("data"in a)||a.data===void 0)return f.jsx(nt,{path:e,type:"union"});const l=t.items.find(d=>{var h;const p=(h=d.items)==null?void 0:h[t.key];return p.type==="literal"?p.value===a.data:(console.error("Expected literal schema in object union",p),!1)});if((l==null?void 0:l.items)===void 0)return f.jsx(nt,{path:e,type:"union"});const c=t.items.flatMap(d=>{var h;const p=(h=d.items)==null?void 0:h[t.key];return p.type==="literal"?[p.value]:(console.error("Expected literal schema in object union",p),[])}),u=g.useRef({});return g.useEffect(()=>{n!==void 0&&a.data!==void 0&&typeof a.data=="string"&&n.status==="success"&&(u.current[e]||(u.current[e]={}),u.current[e][a.data]=n.data)},[n,a,e]),f.jsxs("div",{className:"grid gap-4",children:[f.jsxs(kS,{value:a.data??void 0,onValueChange:d=>{const p=t.items.find(m=>{var x;const v=(x=m.items)==null?void 0:x[t.key];return v.type==="literal"?v.value===d:(console.error("Expected literal schema in object union",v),!1)});if((p==null?void 0:p.items)===void 0){console.error(`Selected schema with ${t.key} = ${d} not found`);return}const h=u.current[e][d]||vl(p);console.log({newValue:h,previouslySelectedSources:u.current,emptyOf:vl(p)}),h[t.key]=d,r([{op:"replace",path:o,value:h}])},children:[f.jsx(Fv,{children:f.jsx(CS,{children:a.data})}),f.jsx(zv,{container:i,className:"w-32",children:c==null?f.jsx(M2,{}):c.map(d=>f.jsx($v,{value:d,children:d},d))})]}),Object.keys(l==null?void 0:l.items).filter(d=>d!==(t==null?void 0:t.key)).map(d=>{var h,m,v;const p=el(e,d);return f.jsx(O2,{path:p,foldLevel:"1",transparent:!0,label:d,type:(m=(h=l==null?void 0:l.items)==null?void 0:h[d])==null?void 0:m.type,children:f.jsx(dy,{path:p,schema:(v=l==null?void 0:l.items)==null?void 0:v[d]},d)},p)})]})}function dY({path:e,source:t,options:n}){const{addPatch:r,patchPath:o}=yn(e),i=no();return f.jsxs(kS,{value:t??"",onValueChange:s=>{r([{op:"replace",path:o,value:s}])},children:[f.jsx(Fv,{children:f.jsx(CS,{children:t})}),f.jsx(zv,{className:"w-32",container:i,children:n==null?f.jsx(M2,{}):n.map(s=>f.jsx($v,{value:s,children:s},s))})]})}function M2(){return f.jsx("div",{children:"Loading..."})}function fY({path:e}){const t="union",n=xP(e),r=Ct(e);if(n.status==="error")return f.jsx(qe,{path:e,error:n.error,type:"union"});if(!("data"in n)||n.data===void 0)return f.jsx(ar,{path:e});if(!("data"in r)||r.data===void 0)return f.jsx(ar,{path:e});if(n.data===null)return f.jsx(lr,{path:e});if(r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});const o=r.data;if(yb(o))return typeof n.data!="string"?f.jsx(qe,{path:e,error:"Expected source to be a string, but found: "+typeof n.data,type:t}):f.jsx("div",{className:"truncate",children:n.data});{const i=n.data;if(!i)return f.jsx(lr,{path:e});if(typeof i!="object"&&!(typeof i=="object"&&o.key in i))return f.jsx(qe,{path:e,error:"Expected source to be an object, but found: "+typeof i,type:t});const s=o.items.find(a=>{var c;const l=(c=a.items)==null?void 0:c[o.key];if((l==null?void 0:l.type)==="literal"&&i!==null&&typeof i=="object"&&o.key in i&&!js(i))return l.value===i[o.key]});return s?f.jsx(T2,{path:e,schema:s}):f.jsx(qe,{path:e,error:"Expected source to have key "+o.key+" but it was not found",type:t})}}const pY=new TextEncoder;function P2(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=new Image;a.addEventListener("load",()=>{const l=ue.getSHA256Hash(pY.encode(s));if(a.naturalWidth&&a.naturalHeight){const c=ue.getMimeType(s);t({src:s,width:a.naturalWidth,height:a.naturalHeight,filename:r==null?void 0:r.name,sha256:l,mimeType:c,fileExt:c&&ue.mimeTypeToFileExt(c)})}else t({src:s,filename:r==null?void 0:r.name,sha256:l})}),a.src=s}else n(s?{message:"Unexpected image result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}const hY=new TextEncoder;function mY(e){return new Promise((t,n)=>{var i;const r=(i=e.currentTarget.files)==null?void 0:i[0],o=new FileReader;o.addEventListener("load",()=>{const s=o.result;if(typeof s=="string"){const a=ue.getSHA256Hash(hY.encode(s)),l=ue.getMimeType(s);t({src:s,filename:r==null?void 0:r.name,sha256:a,mimeType:l,fileExt:l&&ue.mimeTypeToFileExt(l)})}else n(s?{message:"Unexpected file result type",result:s}:{message:"Empty result"})}),r&&o.readAsDataURL(r)})}function j2(e,t,n,r,o,i,s="/public/val"){const a=ue.createFilename(t,n,o,r);return!a||!o?[]:[{value:{[kt]:`${s}/${a}`,[Zn]:"file",...i!=="file"?{[I0]:i}:{},metadata:o},op:"replace",path:e},{value:t,op:"file",path:e,filePath:`${s}/${a}`}]}function gY({path:e}){var l;const t="file",n=bp(),r=Ct(e),o=Je(e,t),{patchPath:i,addPatch:s}=yn(e);if(r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(qe,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(r.status==="loading")return f.jsx(nt,{path:e,type:t});if(n===void 0)return f.jsx(nt,{path:e,type:t});if(r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});const a=o.data;return a===void 0?f.jsx(vn,{path:e,type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx(Ut,{asChild:!0,variant:"ghost",className:"cursor-pointer bg-bg-primary hover:bg-bg-secondary_alt",children:f.jsx("label",{htmlFor:`img_input:${e}`,children:"Update"})}),a&&f.jsxs("a",{className:"flex items-center gap-2",href:ue.convertFileSource({...a,_type:"file"}).url,children:[" ",f.jsx("span",{children:" Open file"}),f.jsx(A9,{})]}),f.jsx("input",{disabled:o.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:(l=r.data.options)==null?void 0:l.accept,onChange:c=>{mY(c).then(u=>{var h;const d={src:u.src,filename:u.filename};let p;u.mimeType&&(p={mimeType:u.mimeType}),s(j2(i,d.src,d.filename??null,u.sha256,p,"file",(h=n.files)==null?void 0:h.directory))})}})]})]})}function vY({path:e}){const t=Je(e,"image");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"image"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx(EP,{size:12})}function yY({path:e}){var u,d,p,h;const t="image",n=bp(),r=Ct(e),o=Je(e,t),{patchPath:i,addPatch:s}=yn(e),[a,l]=g.useState(void 0);if(g.useEffect(()=>{if("data"in o&&o.data)if(o.data.metadata){const m=o.data.metadata;if(typeof m.width!="number"||typeof m.height!="number"){console.warn(`Expected metadata width and height to be numbers but width was: ${typeof m.width} and height was: ${typeof m.height}`);return}if("hotspot"in m){if(typeof m.hotspot=="object"&&m.hotspot&&"x"in m.hotspot&&"y"in m.hotspot){const{x:v,y:x}=m.hotspot;typeof v=="number"&&typeof x=="number"?l({x:v,y:x}):console.warn(`Expected hotspot to have x and y as numbers but x was: ${typeof v} and y: ${typeof x}`)}}else l(void 0)}else l(void 0)},["data"in o&&o.data]),r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(qe,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(r.status==="loading")return f.jsx(nt,{path:e,type:t});if(n===void 0)return f.jsx(nt,{path:e,type:t});if(r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});const c=o.data;return c===void 0?f.jsx(vn,{path:e,type:t}):f.jsxs("div",{children:[f.jsx(Rr,{path:e}),c&&f.jsxs("div",{className:"py-2",children:[f.jsx("span",{children:"Alt text"}),f.jsx(Su,{value:(u=c.metadata)!=null&&u.alt&&typeof((d=c.metadata)==null?void 0:d.alt)=="string"?(p=c.metadata)==null?void 0:p.alt:"",onChange:m=>{const v=m.target.value;c.metadata&&"alt"in c.metadata?s([{op:"replace",value:v,path:i.concat(["metadata","alt"])}]):c.metadata&&!("alt"in c.metadata)?s([{op:"add",value:v,path:i.concat(["metadata","alt"])}]):c.metadata===void 0?s([{op:"add",value:{...a?{hotspot:a}:{},alt:v},path:i.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof c.metadata}`)}})]}),c&&f.jsxs("div",{className:"relative",children:[f.jsx("img",{src:ue.convertFileSource({...c,_type:"file"}).url,draggable:!1,className:"object-contain w-full max-h-[500px] rounded-t-lg",style:{cursor:"crosshair"},onClick:m=>{const{width:v,height:x,left:b,top:w}=m.currentTarget.getBoundingClientRect(),S={x:Math.max((m.clientX-6-b)/v,0),y:Math.max((m.clientY-6-w)/x,0)};c.metadata&&"hotspot"in c.metadata?s([{op:"replace",path:i.concat(["metadata","hotspot"]),value:S}]):c.metadata?s([{op:"add",path:i.concat(["metadata","hotspot"]),value:S}]):c.metadata===void 0?s([{op:"add",value:{...S?{hotspot:S}:{}},path:i.concat(["metadata"])}]):console.warn(`Expected source.metadata to be an object but got ${typeof c.metadata}`)}}),a&&f.jsx("div",{className:"rounded-full h-[12px] w-[12px] bg-background mix-blend-difference border-bg-brand-solid border-2 absolute pointer-events-none",style:{top:`${a.y*100}%`,left:`${a.x*100}%`}})]}),f.jsx("div",{children:f.jsx("label",{htmlFor:`img_input:${e}`,className:xe("block px-1 py-2 mt-4 text-sm text-center rounded-lg cursor-pointer bg-bg-primary text-text-secondary"),children:"Update"})}),f.jsx("input",{disabled:o.status==="loading",hidden:!0,id:`img_input:${e}`,type:"file",accept:((h=r.data.options)==null?void 0:h.accept)||"image/*",onChange:m=>{P2(m).then(v=>{var w;const x={src:v.src,filename:v.filename};let b;v.width&&v.height&&v.mimeType&&(b={width:v.width,height:v.height,mimeType:v.mimeType}),s(j2(i,x.src,x.filename??null,v.sha256,b,"image",(w=n.files)==null?void 0:w.directory))})}})]})}function xY({path:e}){const t=Je(e,"image");if(t.status==="error")return f.jsx(qe,{path:e,error:t.error,type:"image"});if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});if(t.data===null)return f.jsx(lr,{path:e});const n=t.data;return f.jsx("img",{src:ue.convertFileSource({...n,_type:"file"}).url,draggable:!1,className:"object-contain max-w-[60px] max-h-[60px] rounded-lg"})}function bY({path:e}){const t="keyOf",{navigate:n}=fr(),r=Ct(e),o="data"in r&&r.data&&r.data.type==="keyOf"?{type:r.data.schema.type,path:r.data.path}:void 0,i=Je(o==null?void 0:o.path,o==null?void 0:o.type),s=Je(e,t),{patchPath:a,addPatch:l}=yn(e),c=no();if(r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(s.status==="error")return f.jsx(qe,{path:e,error:s.error,type:t});if(i.status==="error")return f.jsx(qe,{path:e,error:i.error,type:o==null?void 0:o.type});if(s.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(o!==void 0&&!(o.type==="record"||o.type==="object"))return f.jsx(Rt,{path:o.path,error:`Cannot refer to keyOf type: ${o.type}. Must refer to be record or object`});if(o!==void 0&&i.status==="not-found")return f.jsx(Rt,{path:o.path,error:"Referenced source not found",type:o.type});if(!("data"in s)||s.data===void 0)return f.jsx(nt,{path:e,type:t});if("data"in r&&r.data&&r.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:r.data.type});if(!i)return f.jsx(Rt,{path:o==null?void 0:o.path,error:"Referenced source not found",type:"keyOf"});if("data"in i&&i.data===null)return f.jsx(Rt,{path:o==null?void 0:o.path,error:"Referenced source is null",type:"keyOf"});const u="data"in i&&i.data?Object.keys(i.data):void 0,d=s.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),u&&u.length>0&&d!==null&&!u.includes(d)&&f.jsx("div",{className:"flex flex-col gap-2 p-4 rounded bg-bg-error-primary text-text-error-primary",children:f.jsxs("span",{children:["Value must be one of: ",u.join(", ")]})}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs(kS,{value:d??"",onValueChange:p=>{l([{op:"replace",path:a,value:p}])},children:[f.jsx(Fv,{children:f.jsx(CS,{children:d})}),f.jsx(zv,{className:"w-32",container:c,children:r.status==="loading"||o==null||u===void 0?f.jsx(wY,{}):u.map(p=>f.jsx($v,{value:p,children:p},p))})]}),d&&(o==null?void 0:o.path)&&f.jsx("button",{title:"Go to reference",className:"px-2",onClick:()=>{n(ue.createValPathOfItem(o.path,d))},children:f.jsx(h9,{size:16})})]})]})}function wY(){return f.jsx("span",{children:"Loading..."})}function SY({path:e}){const t=Je(e,"keyOf");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"keyOf"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function R2({className:e,classNames:t,captionLayout:n,showOutsideDays:r=!0,...o}){const i=o.fromDate&&o.toDate;return f.jsx(FB,{showOutsideDays:r,captionLayout:n,className:Fe("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex flex-row justify-center pt-1 relative items-center",caption_dropdowns:"flex flex-row space-x-2",caption_label:`text-sm font-medium ${i?"hidden":""}`,nav:"space-x-1 flex items-center",dropdown_month:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown_year:"flex flex-row text-accent justify-between text-[0.8rem]",dropdown:"bg-transparent border-solid rounded-md border-2 border-secondary",nav_button:Fe(Q0({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Fe(Q0({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",...t},components:{IconLeft:()=>f.jsx(v9,{className:"w-4 h-4"}),IconRight:()=>f.jsx(fv,{className:"w-4 h-4"}),Dropdown:({caption:s,children:a,value:l,onChange:c})=>{const u=d=>{c&&c({target:{value:d}})};return f.jsx("div",{className:"flex flex-row space-x-2",children:f.jsxs(x2,{onValueChange:u,value:String(l),children:[f.jsx(bS,{asChild:!0,children:f.jsxs(Ut,{variant:"ghost",size:"sm",children:[s,f.jsx(Sp,{className:"w-4 h-4"})]})}),f.jsx(wS,{className:"z-50 p-1 rounded-md bg-bg-secondary_alt text-text-secondary",children:f.jsx(b2,{className:"pb-4 pr-4 overflow-y-auto rounded-md shadow-lg max-h-48 bg-bg-tertiary text-text-tertiary",children:g.Children.map(a,d=>{if(g.isValidElement(d)){const{value:p,children:h}=d.props;return f.jsx(SS,{value:String(p),className:"p-2 rounded-md cursor-pointer hover:bg-bg-secondary_hover hover:text-text-secondary_hover",children:f.jsx(S2,{children:h})},p)}return null})})})]})})}},...o})}R2.displayName="Calendar";function kY({path:e}){var p,h;const t="date",n=Ct(e),r=Je(e,t),{patchPath:o,addPatch:i}=yn(e),[s,a]=g.useState(null),[l,c]=g.useState(!1),u=no();if(g.useEffect(()=>{if("data"in r&&r.data!==void 0)if(r.data===null)a(r.data);else try{const m=new Date(r.data);a(m)}catch{console.error("Cannot parse invalid date:",r.data)}},["data"in r&&r.data]),n.status==="error")return f.jsx(Rt,{path:e,error:n.error,type:t});if(r.status==="error")return f.jsx(qe,{path:e,error:r.error,type:t});if(r.status=="not-found"||n.status==="not-found")return f.jsx(vn,{path:e,type:t});if(n.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in r)||r.data===void 0)return f.jsx(nt,{path:e,type:t});if(n.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:n.data.type});const d=n.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsxs(ca,{open:l,onOpenChange:m=>{c(m)},children:[f.jsx(Mp,{asChild:!0,onClick:()=>{c(!0)},children:f.jsxs(Ut,{variant:"outline",className:xe("w-[280px] justify-start text-left font-normal bg-bg-primary",!s&&"text-muted-foreground"),children:[f.jsx(g9,{className:"w-4 h-4 mr-2"}),s?qi(s,"PPP"):f.jsx("span",{children:"Pick a date"})]})}),f.jsx(Ui,{className:"w-auto p-0",container:u,children:f.jsx(R2,{mode:"single",captionLayout:"dropdown-buttons",defaultMonth:s??void 0,weekStartsOn:1,fromDate:(p=d.options)!=null&&p.from?new Date(d.options.from):void 0,toDate:(h=d.options)!=null&&h.to?new Date(d.options.to):void 0,selected:s||void 0,onSelect:m=>{m&&(a(m),i([{op:"replace",value:m.toISOString().slice(0,10),path:o}]),c(!1))}})})]})]})}function CY({path:e}){const t=Je(e,"date");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"date"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:new Date(t.data).toLocaleString()})}function EY({path:e}){const t=Je(e,"literal");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"literal"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{className:"truncate",children:t.data})}function A2(e,t){for(const n in t)if(n.startsWith(e))return!0;return!1}function I2(){return f.jsx("div",{className:"w-2 h-2 rounded-full bg-bg-error-primary"})}function _Y({path:e}){const t="record",{validationErrors:n}=Gi(),{navigate:r}=fr(),o=Ct(e),i=Je(e,t);if(o.status==="error")return f.jsx(Rt,{path:e,error:o.error,type:t});if(i.status==="error")return f.jsx(qe,{path:e,error:i.error,type:t});if(i.status=="not-found"||o.status==="not-found")return f.jsx(vn,{path:e,type:t});if(o.status==="loading")return f.jsx(nt,{path:e,type:t});if(!("data"in i)||i.data===void 0)return f.jsx(nt,{path:e,type:t});if(o.data.type!==t)return f.jsx(pr,{path:e,expectedType:t,actualType:o.data.type});const s=i.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx("div",{className:"grid grid-cols-1 gap-4",children:s&&Object.entries(s).map(([a])=>f.jsxs("div",{onClick:()=>r(el(e,a)),className:"bg-primary-foreground cursor-pointer hover:bg-primary-foreground/50 min-w-[320px] max-h-[170px] overflow-hidden rounded-md border border-border-primary p-4",children:[f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsx("div",{className:"pb-4 font-semibold text-md",children:a}),A2(el(e,a),n)&&f.jsx(I2,{})]}),f.jsx("div",{children:f.jsx(Sk,{path:el(e,a)})})]},a))})]})}function NY({path:e}){const t=Je(e,"record");if(t.status==="error")return f.jsx(qe,{path:e,error:t.error,type:"record"});if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});if(t.data===null)return f.jsx(lr,{path:e});const n=Object.keys(t.data);return f.jsxs("div",{className:"text-left",children:[f.jsx("span",{className:"text-fg-brand-primary",children:n.length}),f.jsx("span",{className:"mr-1",children:` item${n.length===1?"":"s"}:`}),n.map((r,o)=>f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"text-fg-brand-primary",children:r},r),o<n.length-1?", ":""]}))]})}let Vv=()=>({events:{},emit(e,...t){(this.events[e]||[]).forEach(n=>n(...t))},on(e,t){return(this.events[e]=this.events[e]||[]).push(t),()=>this.events[e]=(this.events[e]||[]).filter(n=>n!==t)}});var xb={exports:{}};(function(e,t){var n=typeof Reflect<"u"?Reflect.construct:void 0,r=Object.defineProperty,o=Error.captureStackTrace;o===void 0&&(o=function(c){var u=new Error;r(c,"stack",{configurable:!0,get:function(){var p=u.stack;return r(this,"stack",{configurable:!0,value:p,writable:!0}),p},set:function(p){r(c,"stack",{configurable:!0,value:p,writable:!0})}})});function i(l){l!==void 0&&r(this,"message",{configurable:!0,value:l,writable:!0});var c=this.constructor.name;c!==void 0&&c!==this.name&&r(this,"name",{configurable:!0,value:c,writable:!0}),o(this,this.constructor)}i.prototype=Object.create(Error.prototype,{constructor:{configurable:!0,value:i,writable:!0}});var s=function(){function l(u,d){return r(u,"name",{configurable:!0,value:d})}try{var c=function(){};if(l(c,"foo"),c.name==="foo")return l}catch{}}();function a(l,c){if(c==null||c===Error)c=i;else if(typeof c!="function")throw new TypeError("super_ should be a function");var u;if(typeof l=="string")u=l,l=n!==void 0?function(){return n(c,arguments,this.constructor)}:function(){c.apply(this,arguments)},s!==void 0&&(s(l,u),u=void 0);else if(typeof l!="function")throw new TypeError("constructor should be either a string or a function");l.super_=l.super=c;var d={constructor:{configurable:!0,value:l,writable:!0}};return u!==void 0&&(d.name={configurable:!0,value:u,writable:!0}),l.prototype=Object.create(c.prototype,d),l}t=e.exports=a,t.BaseError=i})(xb,xb.exports);var D2=xb.exports,s_="ProseMirror-selectednode",L2="",Rs="\0",a_="__state_override__",OY={LastNodeCompatible:"lastNodeCompatible",FormattingMark:"formattingMark",FormattingNode:"formattingNode",NodeCursor:"nodeCursor",FontStyle:"fontStyle",Link:"link",Color:"color",Alignment:"alignment",Indentation:"indentation",Behavior:"behavior",Code:"code",InlineNode:"inline",ListContainerNode:"listContainer",ListItemNode:"listItemNode",Block:"block",BlockNode:"block",TextBlock:"textBlock",ExcludeInputRules:"excludeFromInputRules",PreventExits:"preventsExits",Media:"media"},De=OY,Wi=Symbol.for("__remirror__"),nn=(e=>(e.PlainExtension="RemirrorPlainExtension",e.NodeExtension="RemirrorNodeExtension",e.MarkExtension="RemirrorMarkExtension",e.PlainExtensionConstructor="RemirrorPlainExtensionConstructor",e.NodeExtensionConstructor="RemirrorNodeExtensionConstructor",e.MarkExtensionConstructor="RemirrorMarkExtensionConstructor",e.Manager="RemirrorManager",e.Preset="RemirrorPreset",e.PresetConstructor="RemirrorPresetConstructor",e))(nn||{}),et=(e=>(e[e.Critical=1e6]="Critical",e[e.Highest=1e5]="Highest",e[e.High=1e4]="High",e[e.Medium=1e3]="Medium",e[e.Default=100]="Default",e[e.Low=10]="Low",e[e.Lowest=0]="Lowest",e))(et||{}),Yn=(e=>(e[e.None=0]="None",e[e.Create=1]="Create",e[e.EditorView=2]="EditorView",e[e.Runtime=3]="Runtime",e[e.Destroy=4]="Destroy",e))(Yn||{}),Z=(e=>(e.Undo="_|undo|_",e.Redo="_|redo|_",e.Bold="_|bold|_",e.Italic="_|italic|_",e.Underline="_|underline|_",e.Strike="_|strike|_",e.Code="_|code|_",e.Paragraph="_|paragraph|_",e.H1="_|h1|_",e.H2="_|h2|_",e.H3="_|h3|_",e.H4="_|h4|_",e.H5="_|h5|_",e.H6="_|h6|_",e.TaskList="_|task|_",e.BulletList="_|bullet|_",e.OrderedList="_|number|_",e.Quote="_|quote|_",e.Divider="_|divider|_",e.Codeblock="_|codeblock|_",e.ClearFormatting="_|clear|_",e.Superscript="_|sup|_",e.Subscript="_|sub|_",e.LeftAlignment="_|left-align|_",e.CenterAlignment="_|center-align|_",e.RightAlignment="_|right-align|_",e.JustifyAlignment="_|justify-align|_",e.InsertLink="_|link|_",e.Find="_|find|_",e.FindBackwards="_|find-backwards|_",e.FindReplace="_|find-replace|_",e.AddFootnote="_|footnote|_",e.AddComment="_|comment|_",e.ContextMenu="_|context-menu|_",e.IncreaseFontSize="_|inc-font-size|_",e.DecreaseFontSize="_|dec-font-size|_",e.IncreaseIndent="_|indent|_",e.DecreaseIndent="_|dedent|_",e.Shortcuts="_|shortcuts|_",e.Copy="_|copy|_",e.Cut="_|cut|_",e.Paste="_|paste|_",e.PastePlain="_|paste-plain|_",e.SelectAll="_|select-all|_",e.Format="_|format|_",e))(Z||{}),J=(e=>(e.PROD="RMR0000",e.UNKNOWN="RMR0001",e.INVALID_COMMAND_ARGUMENTS="RMR0002",e.CUSTOM="RMR0003",e.CORE_HELPERS="RMR0004",e.MUTATION="RMR0005",e.INTERNAL="RMR0006",e.MISSING_REQUIRED_EXTENSION="RMR0007",e.MANAGER_PHASE_ERROR="RMR0008",e.INVALID_GET_EXTENSION="RMR0010",e.INVALID_MANAGER_ARGUMENTS="RMR0011",e.SCHEMA="RMR0012",e.HELPERS_CALLED_IN_OUTER_SCOPE="RMR0013",e.INVALID_MANAGER_EXTENSION="RMR0014",e.DUPLICATE_COMMAND_NAMES="RMR0016",e.DUPLICATE_HELPER_NAMES="RMR0017",e.NON_CHAINABLE_COMMAND="RMR0018",e.INVALID_EXTENSION="RMR0019",e.INVALID_CONTENT="RMR0021",e.INVALID_NAME="RMR0050",e.EXTENSION="RMR0100",e.EXTENSION_SPEC="RMR0101",e.EXTENSION_EXTRA_ATTRIBUTES="RMR0102",e.INVALID_SET_EXTENSION_OPTIONS="RMR0103",e.REACT_PROVIDER_CONTEXT="RMR0200",e.REACT_GET_ROOT_PROPS="RMR0201",e.REACT_EDITOR_VIEW="RMR0202",e.REACT_CONTROLLED="RMR0203",e.REACT_NODE_VIEW="RMR0204",e.REACT_GET_CONTEXT="RMR0205",e.REACT_COMPONENTS="RMR0206",e.REACT_HOOKS="RMR0207",e.I18N_CONTEXT="RMR0300",e))(J||{}),TY=function(t){return MY(t)&&!PY(t)};function MY(e){return!!e&&typeof e=="object"}function PY(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||AY(e)}var jY=typeof Symbol=="function"&&Symbol.for,RY=jY?Symbol.for("react.element"):60103;function AY(e){return e.$$typeof===RY}function IY(e){return Array.isArray(e)?[]:{}}function Vf(e,t){return t.clone!==!1&&t.isMergeableObject(e)?Qc(IY(e),e,t):e}function DY(e,t,n){return e.concat(t).map(function(r){return Vf(r,n)})}function LY(e,t){if(!t.customMerge)return Qc;var n=t.customMerge(e);return typeof n=="function"?n:Qc}function FY(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function l_(e){return Object.keys(e).concat(FY(e))}function F2(e,t){try{return t in e}catch{return!1}}function zY(e,t){return F2(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function $Y(e,t,n){var r={};return n.isMergeableObject(e)&&l_(e).forEach(function(o){r[o]=Vf(e[o],n)}),l_(t).forEach(function(o){zY(e,o)||(F2(e,o)&&n.isMergeableObject(t[o])?r[o]=LY(o,n)(e[o],t[o],n):r[o]=Vf(t[o],n))}),r}function Qc(e,t,n){n=n||{},n.arrayMerge=n.arrayMerge||DY,n.isMergeableObject=n.isMergeableObject||TY,n.cloneUnlessOtherwiseSpecified=Vf;var r=Array.isArray(t),o=Array.isArray(e),i=r===o;return i?r?n.arrayMerge(e,t,n):$Y(e,t,n):Vf(t,n)}Qc.all=function(t,n){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(r,o){return Qc(r,o,n)},{})};var BY=Qc,VY=BY;const UY=ga(VY);/*!
|
|
367
367
|
* isobject <https://github.com/jonschlinkert/isobject>
|
|
368
368
|
*
|
|
369
369
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
@@ -423,7 +423,7 @@ If you are using Node.js, you can install JSDOM and Remirror will try to use it
|
|
|
423
423
|
`,Rs)}getHTML(e=this.store.getState()){return Pee(e.doc,this.store.document)}textToProsemirrorNode(e){const t=`<pre>${e.content}</pre>`;return this.store.stringHandlers.html({...e,content:t})}};fe([Et()],to.prototype,"isSelectionEmpty",1);fe([Et()],to.prototype,"isViewEditable",1);fe([Et()],to.prototype,"getStateJSON",1);fe([Et()],to.prototype,"getJSON",1);fe([Et()],to.prototype,"getRemirrorJSON",1);fe([he()],to.prototype,"insertHtml",1);fe([Et()],to.prototype,"getText",1);fe([Et()],to.prototype,"getTextBetween",1);fe([Et()],to.prototype,"getHTML",1);to=fe([Ge({})],to);var Wb=class extends ht{get name(){return"inputRules"}onCreate(){this.store.setExtensionStore("rebuildInputRules",this.rebuildInputRules.bind(this))}createExternalPlugins(){return[this.generateInputRulesPlugin()]}generateInputRulesPlugin(){var e,t;const n=[],r=this.store.markTags[De.ExcludeInputRules];for(const o of this.store.extensions)if(!((e=this.store.managerSettings.exclude)!=null&&e.inputRules||!o.createInputRules||(t=o.options.exclude)!=null&&t.inputRules))for(const i of o.createInputRules())i.shouldSkip=this.options.shouldSkipInputRule,i.invalidMarks=r,n.push(i);return KX({rules:n})}rebuildInputRules(){this.store.updateExtensionPlugins(this)}};Wb=fe([Ge({defaultPriority:et.Default,handlerKeys:["shouldSkipInputRule"],handlerKeyOptions:{shouldSkipInputRule:{earlyReturnValue:!0}}})],Wb);var wo=class extends ht{constructor(){super(...arguments),this.extraKeyBindings=[],this.backwardMarkExitTracker=new Map,this.keydownHandler=null,this.onAddCustomHandler=({keymap:e})=>{var t,n;if(e)return this.extraKeyBindings=[...this.extraKeyBindings,e],(n=(t=this.store).rebuildKeymap)==null||n.call(t),()=>{var r,o;this.extraKeyBindings=this.extraKeyBindings.filter(i=>i!==e),(o=(r=this.store).rebuildKeymap)==null||o.call(r)}},this.rebuildKeymap=()=>{this.setupKeydownHandler()}}get name(){return"keymap"}get shortcutMap(){const{shortcuts:e}=this.options;return Te(e)?Kte[e]:e}onCreate(){this.store.setExtensionStore("rebuildKeymap",this.rebuildKeymap)}createExternalPlugins(){var e;return(e=this.store.managerSettings.exclude)!=null&&e.keymap?[]:(this.setupKeydownHandler(),[new Ji({props:{handleKeyDown:(t,n)=>{var r;return(r=this.keydownHandler)==null?void 0:r.call(this,t,n)}}})])}setupKeydownHandler(){const e=this.generateKeymapBindings();this.keydownHandler=BD(e)}generateKeymapBindings(){var e;const t=[],n=this.shortcutMap,r=this.store.getExtension($e),o=a=>l=>Zh({shortcut:l,map:n,store:this.store,options:a.options});for(const a of this.store.extensions){const l=a.decoratedKeybindings??{};if(!((e=a.options.exclude)!=null&&e.keymap)){a.createKeymap&&t.push(Wte(a.createKeymap(o(a)),n));for(const[c,u]of Vt(l)){if(u.isActive&&!u.isActive(a.options,this.store))continue;const d=a[c].bind(a),p=Zh({shortcut:u.shortcut,map:n,options:a.options,store:this.store}),h=pt(u.priority)?u.priority(a.options,this.store):u.priority??et.Low,m=ve();for(const v of p)m[v]=d;t.push([h,m]),u.command&&r.updateDecorated(u.command,{shortcut:p})}}}const i=this.sortKeymaps([...this.extraKeyBindings,...t]);return lee(i)}arrowRightShortcut(e){const t=this.store.markTags[De.PreventExits],n=this.store.nodeTags[De.PreventExits];return this.exitMarkForwards(t,n)(e)}arrowLeftShortcut(e){const t=this.store.markTags[De.PreventExits],n=this.store.nodeTags[De.PreventExits];return Og(this.exitNodeBackwards(n),this.exitMarkBackwards(t,n))(e)}backspace(e){const t=this.store.markTags[De.PreventExits],n=this.store.nodeTags[De.PreventExits];return Og(this.exitNodeBackwards(n,!0),this.exitMarkBackwards(t,n,!0))(e)}createKeymap(){const{selectParentNodeOnEscape:e,undoInputRuleOnBackspace:t,excludeBaseKeymap:n}=this.options,r=ve();if(!n)for(const[o,i]of Vt(jx))r[o]=Gd(i);return t&&jx.Backspace&&(r.Backspace=Gd(ty(qX,jx.Backspace))),e&&(r.Escape=Gd(ete)),[et.Low,r]}getNamedShortcut(e,t={}){return e.startsWith("_|")?Zh({shortcut:e,map:this.shortcutMap,store:this.store,options:t}):[e]}onSetOptions(e){var t,n;const{changes:r}=e;(r.excludeBaseKeymap.changed||r.selectParentNodeOnEscape.changed||r.undoInputRuleOnBackspace.changed)&&((n=(t=this.store).rebuildKeymap)==null||n.call(t))}sortKeymaps(e){return yl(e.map(t=>Wt(t)?t:[et.Default,t]),(t,n)=>n[0]-t[0]).map(t=>t[1])}exitMarkForwards(e,t){return n=>{const{tr:r,dispatch:o}=n;if(!Aee(r.selection)||Jf({selection:r.selection,types:t}))return!1;const a=r.selection.$from.marks().filter(l=>!e.includes(l.type.name));if(da(a))return!1;if(!o)return!0;for(const l of a)r.removeStoredMark(l);return o(r.insertText(" ",r.selection.from)),!0}}exitNodeBackwards(e,t=!1){return n=>{const{tr:r}=n;if(!(t?CN:Bb)(r.selection))return!1;const i=r.selection.$anchor.node();return!JS(i)||yee(i)||e.includes(i.type.name)?!1:this.store.commands.toggleBlockNodeItem.original({type:i.type})(n)}}exitMarkBackwards(e,t,n=!1){return r=>{const{tr:o,dispatch:i}=r;if(!(n?CN:Bb)(o.selection)||this.backwardMarkExitTracker.has(o.selection.anchor))return this.backwardMarkExitTracker.clear(),!1;if(Jf({selection:o.selection,types:t}))return!1;const l=[...o.storedMarks??[],...o.selection.$from.marks()].filter(c=>!e.includes(c.type.name));if(da(l))return!1;if(!i)return!0;for(const c of l)o.removeStoredMark(c);return this.backwardMarkExitTracker.set(o.selection.anchor,!0),i(o),!0}}};fe([Lr({shortcut:"ArrowRight",isActive:e=>e.exitMarksOnArrowPress})],wo.prototype,"arrowRightShortcut",1);fe([Lr({shortcut:"ArrowLeft",isActive:e=>e.exitMarksOnArrowPress})],wo.prototype,"arrowLeftShortcut",1);fe([Lr({shortcut:"Backspace",isActive:e=>e.exitMarksOnArrowPress})],wo.prototype,"backspace",1);fe([Et()],wo.prototype,"getNamedShortcut",1);wo=fe([Ge({defaultPriority:et.Low,defaultOptions:{shortcuts:"default",undoInputRuleOnBackspace:!0,selectParentNodeOnEscape:!1,excludeBaseKeymap:!1,exitMarksOnArrowPress:!0},customHandlerKeys:["keymap"]})],wo);function Ute(e){return Lo(Uv(Z),e)}function Zh({shortcut:e,map:t,options:n,store:r}){return Te(e)?[Hb(e,t)]:Wt(e)?e.map(o=>Hb(o,t)):(e=e(n,r),Zh({shortcut:e,map:t,options:n,store:r}))}function Hb(e,t){return Ute(e)?t[e]:e}function Wte(e,t){const n={};let r,o;Wt(e)?[o,r]=e:r=e;for(const[i,s]of Vt(r))n[Hb(i,t)]=s;return Wv(o)?n:[o,n]}var KD={[Z.Copy]:"Mod-c",[Z.Cut]:"Mod-x",[Z.Paste]:"Mod-v",[Z.PastePlain]:"Mod-Shift-v",[Z.SelectAll]:"Mod-a",[Z.Undo]:"Mod-z",[Z.Redo]:bo.isMac?"Shift-Mod-z":"Mod-y",[Z.Bold]:"Mod-b",[Z.Italic]:"Mod-i",[Z.Underline]:"Mod-u",[Z.Strike]:"Mod-d",[Z.Code]:"Mod-`",[Z.Paragraph]:"Mod-Shift-0",[Z.H1]:"Mod-Shift-1",[Z.H2]:"Mod-Shift-2",[Z.H3]:"Mod-Shift-3",[Z.H4]:"Mod-Shift-4",[Z.H5]:"Mod-Shift-5",[Z.H6]:"Mod-Shift-6",[Z.TaskList]:"Mod-Shift-7",[Z.BulletList]:"Mod-Shift-8",[Z.OrderedList]:"Mod-Shift-9",[Z.Quote]:"Mod->",[Z.Divider]:"Mod-Shift-|",[Z.Codeblock]:"Mod-Shift-~",[Z.ClearFormatting]:"Mod-Shift-C",[Z.Superscript]:"Mod-.",[Z.Subscript]:"Mod-,",[Z.LeftAlignment]:"Mod-Shift-L",[Z.CenterAlignment]:"Mod-Shift-E",[Z.RightAlignment]:"Mod-Shift-R",[Z.JustifyAlignment]:"Mod-Shift-J",[Z.InsertLink]:"Mod-k",[Z.Find]:"Mod-f",[Z.FindBackwards]:"Mod-Shift-f",[Z.FindReplace]:"Mod-Shift-H",[Z.AddFootnote]:"Mod-Alt-f",[Z.AddComment]:"Mod-Alt-m",[Z.ContextMenu]:"Mod-Shift-\\",[Z.IncreaseFontSize]:"Mod-Shift-.",[Z.DecreaseFontSize]:"Mod-Shift-,",[Z.IncreaseIndent]:"Tab",[Z.DecreaseIndent]:"Shift-Tab",[Z.Shortcuts]:"Mod-/",[Z.Format]:bo.isMac?"Alt-Shift-f":"Shift-Ctrl-f"},Hte={...KD,[Z.Strike]:"Mod-Shift-S",[Z.Code]:"Mod-Shift-M",[Z.Paragraph]:"Mod-Alt-0",[Z.H1]:"Mod-Alt-1",[Z.H2]:"Mod-Alt-2",[Z.H3]:"Mod-Alt-3",[Z.H4]:"Mod-Alt-4",[Z.H5]:"Mod-Alt-5",[Z.H6]:"Mod-Alt-6",[Z.OrderedList]:"Mod-Alt-7",[Z.BulletList]:"Mod-Alt-8",[Z.Quote]:"Mod-Alt-9",[Z.ClearFormatting]:"Mod-\\",[Z.IncreaseIndent]:"Mod-[",[Z.DecreaseIndent]:"Mod-]"},Kte={default:KD,googleDoc:Hte},qte=class extends ht{get name(){return"nodeViews"}createPlugin(){const e=[],t=ve();for(const n of this.store.extensions){if(!n.createNodeViews)continue;const r=n.createNodeViews();e.unshift(pt(r)?{[n.name]:r}:r)}e.unshift(this.store.managerSettings.nodeViews??{});for(const n of e)Object.assign(t,n);return{props:{nodeViews:t}}}},Gte=class extends ht{get name(){return"pasteRules"}createExternalPlugins(){return[this.generatePasteRulesPlugin()]}generatePasteRulesPlugin(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.pasteRules||!r.createPasteRules||(t=r.options.exclude)!=null&&t.pasteRules)continue;const o=r.createPasteRules(),i=Wt(o)?o:[o];n.push(...i)}return hte(n)}},Kb=class extends ht{constructor(){super(...arguments),this.plugins=[],this.managerPlugins=[],this.applyStateHandlers=[],this.initStateHandlers=[],this.appendTransactionHandlers=[],this.pluginKeys=ve(),this.stateGetters=new Map,this.getPluginStateCreator=e=>t=>e.getState(t??this.store.getState()),this.getStateByName=e=>{const t=this.stateGetters.get(e);return be(t,{message:"No plugin exists for the requested extension name."}),t()}}get name(){return"plugins"}onCreate(){const{setStoreKey:e,setExtensionStore:t,managerSettings:n,extensions:r}=this.store;this.updateExtensionStore();const{plugins:o=[]}=n;this.updatePlugins(o,this.managerPlugins);for(const i of r)i.onApplyState&&this.applyStateHandlers.push(i.onApplyState.bind(i)),i.onInitState&&this.initStateHandlers.push(i.onInitState.bind(i)),i.onAppendTransaction&&this.appendTransactionHandlers.push(i.onAppendTransaction.bind(i)),this.extractExtensionPlugins(i);this.managerPlugins=o,this.store.setStoreKey("plugins",this.plugins),e("pluginKeys",this.pluginKeys),e("getPluginState",this.getStateByName),t("getPluginState",this.getStateByName)}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr,o={previousState:t,tr:r,transactions:e,state:n};for(const i of this.appendTransactionHandlers)i(o);return this.options.appendTransaction(o),r.docChanged||r.steps.length>0||r.selectionSet||r.storedMarksSet?r:void 0},state:{init:(e,t)=>{for(const n of this.initStateHandlers)n(t)},apply:(e,t,n,r)=>{const o={previousState:n,state:r,tr:e};for(const i of this.applyStateHandlers)i(o);this.options.applyState(o)}}}}extractExtensionPlugins(e){var t,n;if(!(!e.createPlugin&&!e.createExternalPlugins||(t=this.store.managerSettings.exclude)!=null&&t.plugins||(n=e.options.exclude)!=null&&n.plugins)){if(e.createPlugin){const o=new Eu(e.name);this.pluginKeys[e.name]=o;const i=this.getPluginStateCreator(o);e.pluginKey=o,e.getPluginState=i,this.stateGetters.set(e.name,i),this.stateGetters.set(e.constructor,i);const s={...e.createPlugin(),key:o},a=new Ji(s);this.updatePlugins([a],e.plugin?[e.plugin]:void 0),e.plugin=a}if(e.createExternalPlugins){const o=e.createExternalPlugins();this.updatePlugins(o,e.externalPlugins),e.externalPlugins=o}}}updatePlugins(e,t){if(!t||da(t)){this.plugins=[...this.plugins,...e];return}if(e.length!==t.length){this.plugins=[...this.plugins.filter(r=>!t.includes(r)),...e];return}const n=new Map;for(const[r,o]of e.entries())n.set(yt(t,r),o);this.plugins=this.plugins.map(r=>t.includes(r)?n.get(r):r)}updateExtensionStore(){const{setExtensionStore:e}=this.store;e("updatePlugins",this.updatePlugins.bind(this)),e("dispatchPluginUpdate",this.dispatchPluginUpdate.bind(this)),e("updateExtensionPlugins",this.updateExtensionPlugins.bind(this))}updateExtensionPlugins(e){const t=WD(e)?e:Rte(e)?this.store.manager.getExtension(e):this.store.extensions.find(n=>n.name===e);be(t,{code:J.INVALID_MANAGER_EXTENSION,message:`The extension ${e} does not exist within the editor.`}),this.extractExtensionPlugins(t),this.store.setStoreKey("plugins",this.plugins),this.dispatchPluginUpdate()}dispatchPluginUpdate(){be(this.store.phase>=Yn.EditorView,{code:J.MANAGER_PHASE_ERROR,message:"`dispatchPluginUpdate` should only be called after the view has been added to the manager."});const{view:e,updateState:t}=this.store,n=e.state.reconfigure({plugins:this.plugins});t(n)}};Kb=fe([Ge({defaultPriority:et.Highest,handlerKeys:["applyState","appendTransaction"]})],Kb);var qb=class extends ht{constructor(){super(...arguments),this.dynamicAttributes={marks:ve(),nodes:ve()}}get name(){return"schema"}onCreate(){const{managerSettings:e,tags:t,markNames:n,nodeNames:r,extensions:o}=this.store,{defaultBlockNode:i,disableExtraAttributes:s,nodeOverride:a,markOverride:l}=e,c=m=>!!(m&&t[De.Block].includes(m));if(e.schema){const{nodes:m,marks:v}=nne(e.schema);this.addSchema(e.schema,m,v);return}const u=c(i)?{doc:ve(),[i]:ve()}:ve(),d=ve(),p=Yte({settings:e,gatheredSchemaAttributes:this.gatherExtraAttributes(o),nodeNames:r,markNames:n,tags:t});for(const m of o){p[m.name]={...p[m.name],...m.options.extraAttributes};const v=s===!0||m.options.disableExtraAttributes===!0||m.constructor.disableExtraAttributes===!0;if(Kp(m)){const{spec:x,dynamic:b}=TN({createExtensionSpec:(w,S)=>m.createNodeSpec(w,S),extraAttributes:yt(p,m.name),override:{...a,...m.options.nodeOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags});m.spec=x,u[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.nodes[m.name]=b)}if(ry(m)){const{spec:x,dynamic:b}=TN({createExtensionSpec:(w,S)=>m.createMarkSpec(w,S),extraAttributes:yt(p,m.name),override:{...l,...m.options.markOverride},ignoreExtraAttributes:v,name:m.constructorName,tags:m.tags??[]});m.spec=x,d[m.name]=x,Object.keys(b).length>0&&(this.dynamicAttributes.marks[m.name]=b)}}const h=new DJ({nodes:u,marks:d,topNode:"doc"});this.addSchema(h,u,d)}createPlugin(){return{appendTransaction:(e,t,n)=>{const{tr:r}=n;return!e.some(i=>i.docChanged)||Object.keys(this.dynamicAttributes.nodes).length===0&&Object.keys(this.dynamicAttributes.marks).length===0?null:(r.doc.descendants((i,s)=>(this.checkAndUpdateDynamicNodes(i,s,r),this.checkAndUpdateDynamicMarks(i,s,r),!0)),r.steps.length>0?r:null)}}}addSchema(e,t,n){this.store.setStoreKey("nodes",t),this.store.setStoreKey("marks",n),this.store.setStoreKey("schema",e),this.store.setExtensionStore("schema",e),this.store.setStoreKey("defaultBlockNode",Qv(e).name);for(const r of Object.values(e.nodes))if(r.name!=="doc"&&(r.isBlock||r.isTextblock))break}checkAndUpdateDynamicNodes(e,t,n){for(const[r,o]of Vt(this.dynamicAttributes.nodes))if(e.type.name===r)for(const[i,s]of Vt(o)){if(!ua(e.attrs[i]))continue;const a={...e.attrs,[i]:s(e)};n.setNodeMarkup(t,void 0,a),bN(n)}}checkAndUpdateDynamicMarks(e,t,n){for(const[r,o]of Vt(this.dynamicAttributes.marks)){const i=yt(this.store.schema.marks,r),s=e.marks.find(a=>a.type.name===r);if(s)for(const[a,l]of Vt(o)){if(!ua(s.attrs[a]))continue;const c=Hi(n.doc.resolve(t),i);if(!c)continue;const{from:u,to:d}=c,p=i.create({...s.attrs,[a]:l(s)});n.removeMark(u,d,i).addMark(u,d,p),bN(n)}}}gatherExtraAttributes(e){const t=[];for(const n of e)n.createSchemaAttributes&&t.push(...n.createSchemaAttributes());return t}};qb=fe([Ge({defaultPriority:et.Highest})],qb);function Yte(e){const{settings:t,gatheredSchemaAttributes:n,nodeNames:r,markNames:o,tags:i}=e,s=ve();if(t.disableExtraAttributes)return s;const a=[...n,...t.extraAttributes??[]];for(const l of a??[]){const c=Xte({identifiers:l.identifiers,nodeNames:r,markNames:o,tags:i});for(const u of c){const d=s[u]??{};s[u]={...d,...l.attributes}}}return s}function Jte(e){return Tl(e)&&Wt(e.tags)}function Xte(e){const{identifiers:t,nodeNames:n,markNames:r,tags:o}=e;if(t==="nodes")return n;if(t==="marks")return r;if(t==="all")return[...n,...r];if(Wt(t))return t;be(Jte(t),{code:J.EXTENSION_EXTRA_ATTRIBUTES,message:"Invalid value passed as an identifier when creating `extraAttributes`."});const{tags:i=[],names:s=[],behavior:a="any",excludeNames:l,excludeTags:c,type:u}=t,d=new Set,p=u==="mark"?r:u==="node"?n:[...r,...n],h=v=>p.includes(v)&&!(l!=null&&l.includes(v));for(const v of s)h(v)&&d.add(v);const m=new Map;for(const v of i)if(!(c!=null&&c.includes(v)))for(const x of o[v]){if(!h(x))continue;if(a==="any"){d.add(x);continue}const b=m.get(x)??new Set;b.add(v),m.set(x,b)}for(const[v,x]of m)x.size===i.length&&d.add(v);return[...d]}function TN(e){var t;const{createExtensionSpec:n,extraAttributes:r,ignoreExtraAttributes:o,name:i,tags:s,override:a}=e,l=ve();function c(x,b){l[x]=b}let u=!1;function d(){u=!0}const p=Zte(r,o,d,c),h=Qte(r,o),m=ene(r,o),v=n({defaults:p,parse:h,dom:m},a);return be(o||u,{code:J.EXTENSION_SPEC,message:`When creating a node specification you must call the 'defaults', and parse, and 'dom' methods. To avoid this error you can set the static property 'disableExtraAttributes' of '${i}' to 'true'.`}),v.group=[...((t=v.group)==null?void 0:t.split(" "))??[],...s].join(" ")||void 0,{spec:v,dynamic:l}}function ZS(e){return Te(e)||pt(e)?{default:e}:(be(e,{message:`${W2(e)} is not supported`,code:J.EXTENSION_EXTRA_ATTRIBUTES}),e)}function Zte(e,t,n,r){return()=>{n();const o=ve();if(t)return o;for(const[i,s]of Vt(e)){let l=ZS(s).default;pt(l)&&(r(i,l),l=null),o[i]=l===void 0?{}:{default:l}}return o}}function Qte(e,t){return n=>{const r=ve();if(t)return r;for(const[o,i]of Vt(e)){const{parseDOM:s,...a}=ZS(i);if(si(n)){if(ua(s)){r[o]=n.getAttribute(o)??a.default;continue}if(pt(s)){r[o]=s(n)??a.default;continue}r[o]=n.getAttribute(s)??a.default}}return r}}function ene(e,t){return n=>{const r=ve();if(t)return r;function o(i,s){if(i){if(Te(i)){r[s]=i;return}if(Wt(i)){const[a,l]=i;r[a]=l??n.attrs[s];return}for(const[a,l]of Vt(i))r[a]=l}}for(const[i,s]of Vt(e)){const{toDOM:a,parseDOM:l}=ZS(s);if(ua(a)){const c=Te(l)?l:i;r[c]=n.attrs[i];continue}if(pt(a)){o(a(n.attrs,tne(n)),i);continue}o(a,i)}return r}}function tne(e){return Xv(e)?{node:e}:hee(e)?{mark:e}:{}}function nne(e){const t=ve(),n=ve();for(const[r,o]of Object.entries(e.nodes))t[r]=o.spec;for(const[r,o]of Object.entries(e.marks))n[r]=o.spec;return{nodes:t,marks:n}}var su=class extends ht{constructor(){super(...arguments),this.onAddCustomHandler=({suggester:e})=>{var t;if(!(!e||(t=this.store.managerSettings.exclude)!=null&&t.suggesters))return xN(this.store.getState(),e)}}get name(){return"suggest"}onCreate(){this.store.setExtensionStore("addSuggester",e=>xN(this.store.getState(),e)),this.store.setExtensionStore("removeSuggester",e=>QQ(this.store.getState(),e))}createExternalPlugins(){var e,t;const n=[];for(const r of this.store.extensions){if((e=this.store.managerSettings.exclude)!=null&&e.suggesters)break;if(!r.createSuggesters||(t=r.options.exclude)!=null&&t.suggesters)continue;const o=r.createSuggesters(),i=Wt(o)?o:[o];n.push(...i)}return[eee(...n)]}getSuggestState(e){return US(e??this.store.getState())}getSuggestMethods(){const{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}=this.getSuggestState();return{addIgnored:e,clearIgnored:t,removeIgnored:n,ignoreNextExit:r,setMarkRemoved:o,findMatchAtPosition:i,findNextTextSelection:s,setLastChangeFromAppend:a}}isSuggesterActive(e){var t;return Lo(Wt(e)?e:[e],(t=this.getSuggestState().match)==null?void 0:t.suggester.name)}};fe([Et()],su.prototype,"getSuggestState",1);fe([Et()],su.prototype,"getSuggestMethods",1);fe([Et()],su.prototype,"isSuggesterActive",1);su=fe([Ge({customHandlerKeys:["suggester"]})],su);var Gb=class extends ht{constructor(){super(...arguments),this.allTags=ve(),this.plainTags=ve(),this.markTags=ve(),this.nodeTags=ve()}get name(){return"tags"}onCreate(){this.resetTags();for(const e of this.store.extensions)this.updateTagForExtension(e);this.store.setStoreKey("tags",this.allTags),this.store.setExtensionStore("tags",this.allTags),this.store.setStoreKey("plainTags",this.plainTags),this.store.setExtensionStore("plainTags",this.plainTags),this.store.setStoreKey("markTags",this.markTags),this.store.setExtensionStore("markTags",this.markTags),this.store.setStoreKey("nodeTags",this.nodeTags),this.store.setExtensionStore("nodeTags",this.nodeTags)}resetTags(){const e=ve(),t=ve(),n=ve(),r=ve();for(const o of Uv(De))e[o]=[],t[o]=[],n[o]=[],r[o]=[];this.allTags=e,this.plainTags=t,this.markTags=n,this.nodeTags=r}updateTagForExtension(e){var t,n;const r=new Set([...e.tags??[],...((t=e.createTags)==null?void 0:t.call(e))??[],...e.options.extraTags??[],...((n=this.store.managerSettings.extraTags)==null?void 0:n[e.name])??[]]);for(const o of r)be(rne(o),{code:J.EXTENSION,message:`The tag provided by the extension: ${e.constructorName} is not supported by the editor. To add custom tags you can use the 'mutateTag' method.`}),this.allTags[o].push(e.name),HD(e)&&this.plainTags[o].push(e.name),ry(e)&&this.markTags[o].push(e.name),Kp(e)&&this.nodeTags[o].push(e.name);e.tags=[...r]}};Gb=fe([Ge({defaultPriority:et.Highest})],Gb);function rne(e){return Lo(Uv(De),e)}var one=new Eu("remirrorFilePlaceholderPlugin");function ine(){const e=new Ji({key:one,state:{init(){return{set:Ye.empty,payloads:new Map}},apply(t,{set:n,payloads:r}){n=n.map(t.mapping,t.doc);const o=t.getMeta(e);if(o)if(o.type===0){const i=document.createElement("placeholder"),s=ft.widget(o.pos,i,{id:o.id});n=n.add(t.doc,[s]),r.set(o.id,o.payload)}else o.type===1&&(n=n.remove(n.find(void 0,void 0,i=>i.id===o.id)),r.delete(o.id));return{set:n,payloads:r}}},props:{decorations(t){var n;return((n=e.getState(t))==null?void 0:n.set)??null}}});return e}var sne=class extends ht{get name(){return"upload"}createExternalPlugins(){return[ine()]}};function ane(e={}){e={...{exitMarksOnArrowPress:wo.defaultOptions.exitMarksOnArrowPress,excludeBaseKeymap:wo.defaultOptions.excludeBaseKeymap,selectParentNodeOnEscape:wo.defaultOptions.selectParentNodeOnEscape,undoInputRuleOnBackspace:wo.defaultOptions.undoInputRuleOnBackspace,persistentSelectionClass:zo.defaultOptions.persistentSelectionClass},...e};const n=bb(e,["excludeBaseKeymap","selectParentNodeOnEscape","undoInputRuleOnBackspace"]),r=bb(e,["persistentSelectionClass"]);return[new Gb,new qb,new Ate,new Kb,new Wb,new Gte,new qte,new su,new $e,new to,new wo(n),new Ub,new sne,new zo(r)]}var MN=class extends ht{get name(){return"meta"}onCreate(){if(this.store.setStoreKey("getCommandMeta",this.getCommandMeta.bind(this)),!!this.options.capture)for(const e of this.store.extensions)this.captureCommands(e),this.captureKeybindings(e)}createPlugin(){return{}}captureCommands(e){const t=e.decoratedCommands??{},n=e.createCommands;for(const r of Object.keys(t)){const o=e[r];e[r]=(...i)=>s=>{var a;const l=o(...i)(s);return s.dispatch&&l&&this.setCommandMeta(s.tr,{type:"command",chain:s.dispatch!==((a=s.view)==null?void 0:a.dispatch),name:r,extension:e.name,decorated:!0}),l}}n&&(e.createCommands=()=>{const r=n();for(const[o,i]of Object.entries(r))r[o]=(...s)=>a=>{var l;const c=i(...s)(a);return a.dispatch&&c&&this.setCommandMeta(a.tr,{type:"command",chain:a.dispatch!==((l=a.view)==null?void 0:l.dispatch),name:o,extension:e.name,decorated:!1}),c};return r})}captureKeybindings(e){}getCommandMeta(e){return e.getMeta(this.pluginKey)??[]}setCommandMeta(e,t){const n=this.getCommandMeta(e);e.setMeta(this.pluginKey,[...n,t])}};MN=fe([Ge({defaultOptions:{capture:bo.isDevelopment},staticKeys:["capture"],defaultPriority:et.Highest})],MN);var Qh,ud,em,ec,hs,tm,nm,lne=class{constructor(e){Pt(this,Qh,hg()),Pt(this,ud,void 0),Pt(this,em,void 0),Pt(this,ec,!0),Pt(this,hs,Vv()),Pt(this,tm,void 0),Pt(this,nm,void 0),this.getState=()=>this.view.state??this.initialEditorState,this.getPreviousState=()=>this.previousState,this.dispatchTransaction=i=>{var s,a;be(!this.manager.destroyed,{code:J.MANAGER_PHASE_ERROR,message:"A transaction was dispatched to a manager that has already been destroyed. Please check your set up, or open an issue."}),i=((a=(s=this.props).onDispatchTransaction)==null?void 0:a.call(s,i,this.getState()))??i;const l=this.getState(),{state:c,transactions:u}=l.applyTransaction(i);Jt(this,em,l),this.updateState({state:c,tr:i,transactions:u});const d=this.manager.store.getForcedUpdates(i);da(d)||this.updateViewProps(...d)},this.onChange=(i=ve())=>{var s,a;const l=this.eventListenerProps(i);re(this,ec)&&Jt(this,ec,!1),(a=(s=this.props).onChange)==null||a.call(s,l)},this.onBlur=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onBlur)==null||a.call(s,l,i),re(this,hs).emit("blur",l,i)},this.onFocus=i=>{var s,a;const l=this.eventListenerProps();(a=(s=this.props).onFocus)==null||a.call(s,l,i),re(this,hs).emit("focus",l,i)},this.setContent=(i,{triggerChange:s=!1}={})=>{const{doc:a}=this.manager.createState({content:i}),l=this.getState(),{state:c}=this.getState().applyTransaction(l.tr.replaceRangeWith(0,l.doc.nodeSize-2,a));if(s)return this.updateState({state:c,triggerChange:s});this.view.updateState(c)},this.clearContent=({triggerChange:i=!1}={})=>{this.setContent(this.manager.createEmptyDoc(),{triggerChange:i})},this.createStateFromContent=(i,s)=>this.manager.createState({content:i,selection:s}),this.focus=i=>{this.manager.store.commands.focus(i)},this.blur=i=>{this.manager.store.commands.blur(i)};const{getProps:t,initialEditorState:n,element:r}=e;if(Jt(this,ud,t),Jt(this,nm,n),this.manager.attachFramework(this,this.updateListener.bind(this)),this.manager.view)return;const o=this.createView(n,r);this.manager.addView(o)}get addHandler(){return re(this,tm)??Jt(this,tm,re(this,hs).on.bind(re(this,hs)))}get updatableViewProps(){return{attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0}}get firstRender(){return re(this,ec)}get props(){return re(this,ud).call(this)}get previousState(){return this.previousStateOverride??re(this,em)??this.initialEditorState}get manager(){return this.props.manager}get view(){return this.manager.view}get uid(){return re(this,Qh)}get initialEditorState(){return re(this,nm)}updateListener(e){const{state:t,tr:n}=e;return re(this,hs).emit("updated",this.eventListenerProps({state:t,tr:n}))}update(e){const{getProps:t}=e;return Jt(this,ud,t),this}updateViewProps(...e){const t=bb(this.updatableViewProps,e);this.view.setProps({...this.view.props,...t})}getAttributes(e){var t;const{attributes:n,autoFocus:r,classNames:o=[],label:i,editable:s}=this.props,a=(t=this.manager.store)==null?void 0:t.attributes,l=pt(n)?n(this.eventListenerProps()):n;let c={};(r||Ar(r))&&(c=e?{autoFocus:!0}:{autofocus:"true"});const u=Wf(Vb(e&&"Prosemirror","remirror-editor",a==null?void 0:a.class,...o).split(" ")).join(" "),d={role:"textbox",...c,"aria-multiline":"true",...s??!0?{}:{"aria-readonly":"true"},"aria-label":i??"",...a,class:u};return cJ({...d,...l})}addFocusListeners(){this.view.dom.addEventListener("blur",this.onBlur),this.view.dom.addEventListener("focus",this.onFocus)}removeFocusListeners(){this.view.dom.removeEventListener("blur",this.onBlur),this.view.dom.removeEventListener("focus",this.onFocus)}destroy(){re(this,hs).emit("destroy"),this.view&&this.removeFocusListeners()}eventListenerProps(e=ve()){const{state:t,tr:n,transactions:r}=e;return{tr:n,transactions:r,internalUpdate:!n,view:this.view,firstRender:re(this,ec),state:t??this.getState(),createStateFromContent:this.createStateFromContent,previousState:this.previousState,helpers:this.manager.store.helpers}}get baseOutput(){return{manager:this.manager,...this.manager.store,addHandler:this.addHandler,focus:this.focus,blur:this.blur,uid:re(this,Qh),view:this.view,getState:this.getState,getPreviousState:this.getPreviousState,getExtension:this.manager.getExtension.bind(this.manager),hasExtension:this.manager.hasExtension.bind(this.manager),clearContent:this.clearContent,setContent:this.setContent}}};Qh=new WeakMap;ud=new WeakMap;em=new WeakMap;ec=new WeakMap;hs=new WeakMap;tm=new WeakMap;nm=new WeakMap;function cne(e,t){const n=[],r=new WeakMap,o=[],i=new WeakMap;let s=[];const a={duplicateMap:i,parentExtensions:o,gatheredExtensions:s,settings:t};for(const d of e)qD(a,{extension:d});s=yl(s,(d,p)=>p.priority-d.priority);const l=new WeakSet,c=new Set;for(const d of s){const p=d.constructor,h=d.name,m=i.get(p);be(m,{message:`No entries were found for the ExtensionConstructor ${d.name}`,code:J.INTERNAL}),!(l.has(p)||c.has(h))&&(l.add(p),c.add(h),n.push(d),r.set(p,d),m.forEach(v=>v==null?void 0:v.replaceChildExtension(p,d)))}const u=[];for(const d of n)une({extension:d,found:l,missing:u});return be(da(u),{code:J.MISSING_REQUIRED_EXTENSION,message:u.map(({Constructor:d,extension:p})=>`The extension '${p.name}' requires '${d.name} in order to run correctly.`).join(`
|
|
424
424
|
`)}),{extensions:n,extensionMap:r}}function qD(e,t){var n;const{gatheredExtensions:r,duplicateMap:o,parentExtensions:i,settings:s}=e,{extension:a,parentExtension:l}=t;let{names:c=[]}=t;be(WD(a),{code:J.INVALID_MANAGER_EXTENSION,message:`An invalid extension: ${a} was provided to the [[\`RemirrorManager\`]].`});const u=a.extensions;if(a.setPriority((n=s.priority)==null?void 0:n[a.name]),r.push(a),dne({duplicateMap:o,extension:a,parentExtension:l}),u.length!==0){if(c.includes(a.name)){`${c.join(" > ")}${a.name}`;return}c=[...c,a.name],i.push(a);for(const d of u)qD(e,{names:c,extension:d,parentExtension:a})}}function une(e){const{extension:t,found:n,missing:r}=e;if(t.requiredExtensions)for(const o of t.requiredExtensions??[])n.has(o)||r.push({Constructor:o,extension:t})}function dne(e){const{duplicateMap:t,extension:n,parentExtension:r}=e,o=n.constructor,i=t.get(o),s=r?[r]:[];t.set(o,i?[...i,...s]:s)}function fne(e){var t,n,r,o;const{extension:i,nodeNames:s,markNames:a,plainNames:l,store:c,handlers:u}=e;i.setStore(c);const d=(t=i.onCreate)==null?void 0:t.bind(i),p=(n=i.onView)==null?void 0:n.bind(i),h=(r=i.onStateUpdate)==null?void 0:r.bind(i),m=(o=i.onDestroy)==null?void 0:o.bind(i);d&&u.create.push(d),p&&u.view.push(p),h&&u.update.push(h),m&&u.destroy.push(m),ry(i)&&a.push(i.name),Kp(i)&&i.name!=="doc"&&s.push(i.name),HD(i)&&l.push(i.name)}var ms,dd,co,yi,fd,br,Ia,pd,Da,hd,La,uo,md,rm=class{constructor(e,t={}){Pt(this,ms,void 0),Pt(this,dd,ve()),Pt(this,co,ve()),Pt(this,yi,void 0),Pt(this,fd,void 0),Pt(this,br,Yn.None),Pt(this,Ia,void 0),Pt(this,pd,!0),Pt(this,Da,{create:[],view:[],update:[],destroy:[]}),Pt(this,hd,[]),Pt(this,La,Vv()),Pt(this,uo,void 0),Pt(this,md,void 0),this.getState=()=>{var o;return re(this,br)>=Yn.EditorView?this.view.state:(be(re(this,uo),{code:J.MANAGER_PHASE_ERROR,message:"`getState` can only be called after the `Framework` or the `EditorView` has been added to the manager`. Check your plugins to make sure that the decorations callback uses the state argument."}),(o=re(this,uo))==null?void 0:o.initialEditorState)},this.updateState=o=>{const i=this.getState();this.view.updateState(o),this.onStateUpdate({previousState:i,state:o})};const{extensions:n,extensionMap:r}=cne(e,t);Jt(this,Ia,t),Jt(this,yi,Wa(n)),Jt(this,fd,r),Jt(this,ms,this.createExtensionStore()),Jt(this,br,Yn.Create),this.setupLifecycleHandlers();for(const o of re(this,Da).create){const i=o();i&&re(this,hd).push(i)}}static create(e,t={}){return new rm([...Y2(e),...ane(t.builtin)],t)}get[Wi](){return nn.Manager}get destroyed(){return re(this,br)===Yn.Destroy}get mounted(){return re(this,br)>=Yn.EditorView&&re(this,br)<Yn.Destroy}get output(){var e;return(e=re(this,uo))==null?void 0:e.frameworkOutput}get frameworkAttached(){return!!re(this,uo)}get extensions(){return re(this,yi)}get stringHandlers(){return re(this,dd)}get store(){return Wa(re(this,co))}get extensionStore(){return Wa(re(this,ms))}get tr(){return this.getExtension($e).transaction}get nodes(){return re(this,co).nodes}get marks(){return re(this,co).marks}get schema(){return re(this,co).schema}get extensionTags(){return re(this,co).tags}get view(){return re(this,co).view}get settings(){return re(this,Ia)}get document(){return re(this,Ia).document??ey()}setupLifecycleHandlers(){const e=re(this,ms),t=re(this,Da),n=[],r=[],o=[];e.nodeNames=n,e.markNames=r,e.plainNames=o;for(const i of re(this,yi))fne({extension:i,nodeNames:n,markNames:r,plainNames:o,handlers:t,store:e})}setStringHandler(e,t){re(this,dd)[e]=t}setStoreKey(e,t){re(this,co)[e]=t}getStoreKey(e){const t=re(this,co)[e];return be(!ua(t),{code:J.MANAGER_PHASE_ERROR,message:"`getStoreKey` should not be called before the values are available."}),t}setExtensionStore(e,t){be(re(this,br)<=Yn.EditorView,{code:J.MANAGER_PHASE_ERROR,message:"`setExtensionStore` should only be called during the `onCreate` lifecycle hook. Make sure to only call it within the returned methods."}),re(this,ms)[e]=t}createExtensionStore(){const e=ve(),t=!0;let n,r;return Object.defineProperties(e,{extensions:{get:()=>re(this,yi),enumerable:t},phase:{get:()=>re(this,br),enumerable:t},view:{get:()=>this.view,enumerable:t},managerSettings:{get:()=>Wa(re(this,Ia)),enumerable:t},getState:{value:this.getState,enumerable:t},updateState:{value:this.updateState,enumerable:t},isMounted:{value:()=>this.mounted,enumerable:t},getExtension:{value:this.getExtension.bind(this),enumerable:t},manager:{get:()=>this,enumerable:t},document:{get:()=>this.document,enumerable:t},stringHandlers:{get:()=>re(this,dd),enumerable:t},currentState:{get:()=>n??(n=this.getState()),set:o=>{n=o},enumerable:t},previousState:{get:()=>r,set:o=>{r=o},enumerable:t}}),e.getStoreKey=this.getStoreKey.bind(this),e.setStoreKey=this.setStoreKey.bind(this),e.setExtensionStore=this.setExtensionStore.bind(this),e.setStringHandler=this.setStringHandler.bind(this),e}addView(e){if(re(this,br)>=Yn.EditorView)return this;Jt(this,pd,!0),Jt(this,br,Yn.EditorView),re(this,co).view=e;for(const t of re(this,Da).view){const n=t(e);n&&re(this,hd).push(n)}return this}attachFramework(e,t){var n;re(this,uo)!==e&&(re(this,uo)&&(re(this,uo).destroy(),(n=re(this,md))==null||n.call(this)),Jt(this,uo,e),Jt(this,md,this.addHandler("stateUpdate",t)))}createEmptyDoc(){var e;const t=(e=this.schema.nodes.doc)==null?void 0:e.createAndFill();return be(t,{code:J.INVALID_CONTENT,message:"An empty node could not be created due to an invalid schema."}),t}createState(e={}){const{onError:t,defaultSelection:n="end"}=this.settings,{content:r=this.createEmptyDoc(),selection:o=n,stringHandler:i=this.settings.stringHandler}=e,{schema:s,plugins:a}=this.store,l=ED({stringHandler:Te(i)?this.stringHandlers[i]:i,document:this.document,content:r,onError:t,schema:s,selection:o});return Ha.create({schema:s,doc:l,plugins:a,selection:eo(o,l)})}addHandler(e,t){return re(this,La).on(e,t)}onStateUpdate(e){const t=re(this,pd);re(this,ms).currentState=e.state,re(this,ms).previousState=e.previousState,t&&(Jt(this,br,Yn.Runtime),Jt(this,pd,!1));const n={...e,firstUpdate:t};for(const r of re(this,Da).update)r(n);re(this,La).emit("stateUpdate",n)}getExtension(e){const t=re(this,fd).get(e);return be(t,{code:J.INVALID_MANAGER_EXTENSION,message:`'${e.name}' doesn't exist within this manager. Make sure it is properly added before attempting to use it.`}),t}hasExtension(e){return!!re(this,fd).get(e)}clone(){const e=re(this,yi).map(n=>n.clone(n.options)),t=rm.create(()=>e,re(this,Ia));return re(this,La).emit("clone",t),t}recreate(e=[],t={}){const n=re(this,yi).map(o=>o.clone(o.initialOptions)),r=rm.create(()=>[...n,...e],t);return re(this,La).emit("recreate",r),r}destroy(){var e,t,n,r,o,i;Jt(this,br,Yn.Destroy);for(const s of((e=this.view)==null?void 0:e.state.plugins)??[])(n=(t=s.getState(this.view.state))==null?void 0:t.destroy)==null||n.call(t);(r=re(this,uo))==null||r.destroy(),(o=re(this,md))==null||o.call(this);for(const s of re(this,hd))s();for(const s of re(this,Da).destroy)s();(i=this.view)==null||i.destroy(),re(this,La).emit("destroy")}includes(e){const t=[],n=[];for(const r of re(this,yi))t.push(r.name,r.constructorName),n.push(r.constructor);return e.every(r=>Te(r)?Lo(t,r):Lo(n,r))}},pne=rm;ms=new WeakMap;dd=new WeakMap;co=new WeakMap;yi=new WeakMap;fd=new WeakMap;br=new WeakMap;Ia=new WeakMap;pd=new WeakMap;Da=new WeakMap;hd=new WeakMap;La=new WeakMap;uo=new WeakMap;md=new WeakMap;function hne(e,t){return!(!_u(e)||!Nu(e,nn.Manager))}var mne=Object.defineProperty,gne=Object.getOwnPropertyDescriptor,vne=(e,t,n,r)=>{for(var o=r>1?void 0:r?gne(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&mne(t,n,o),o},GD=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},me=(e,t,n)=>(GD(e,t,"read from private field"),n?n.call(e):t.get(e)),wr=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},xr=(e,t,n,r)=>(GD(e,t,"write to private field"),t.set(e,n),n),gd,yne=class{constructor(){this.portals=new Map,wr(this,gd,Vv()),this.on=e=>me(this,gd).on("update",e),this.once=e=>{const t=me(this,gd).on("update",n=>{t(),e(n)});return t}}update(){me(this,gd).emit("update",this.portals)}render({Component:e,container:t}){const n=this.portals.get(t);this.portals.set(t,{Component:e,key:(n==null?void 0:n.key)??hg()}),this.update()}forceUpdate(){for(const[e,{Component:t}]of this.portals)this.portals.set(e,{Component:t,key:hg()})}remove(e){this.portals.delete(e),this.update()}};gd=new WeakMap;var xne=e=>{const{portals:t}=e;return ye.createElement(ye.Fragment,null,t.map(([n,{Component:r,key:o}])=>Nr.createPortal(ye.createElement(r,null),n,o)))};function bne(e){const[t,n]=g.useState(()=>Array.from(e.portals.entries()));return g.useEffect(()=>e.on(r=>{n(Array.from(r.entries()))}),[e]),g.useMemo(()=>t,[t])}var mt,vd,Fa,yd,om,xd,tc,bd,im,xi,In,Yb,YD=class{constructor({getPosition:e,node:t,portalContainer:n,view:r,ReactComponent:o,options:i}){wr(this,mt,void 0),wr(this,vd,[]),wr(this,Fa,void 0),wr(this,yd,void 0),wr(this,om,void 0),wr(this,xd,void 0),wr(this,tc,void 0),wr(this,bd,!1),wr(this,im,void 0),wr(this,xi,void 0),wr(this,In,void 0),wr(this,Yb,l=>{l&&(be(me(this,xi),{code:J.REACT_NODE_VIEW,message:`You have applied a ref to a node view provided for '${me(this,mt).type.name}' which doesn't support content.`}),l.append(me(this,xi)))}),this.Component=()=>{const l=me(this,om);return be(l,{code:J.REACT_NODE_VIEW,message:`The custom react node view provided for ${me(this,mt).type.name} doesn't have a valid ReactComponent`}),ye.createElement(l,{updateAttributes:this.updateAttributes,selected:this.selected,view:me(this,Fa),getPosition:me(this,xd),node:me(this,mt),forwardRef:me(this,Yb),decorations:me(this,vd)})},this.updateAttributes=l=>{if(!me(this,Fa).editable)return;const c=me(this,xd).call(this);if(c==null)return;const u=me(this,Fa).state.tr.setNodeMarkup(c,void 0,{...me(this,mt).attrs,...l});me(this,Fa).dispatch(u)},be(pt(e),{message:"You are attempting to use a node view for a mark type. This is not supported yet. Please check your configuration."}),xr(this,mt,t),xr(this,Fa,r),xr(this,yd,n),xr(this,om,o),xr(this,xd,e),xr(this,tc,i),xr(this,In,this.createDom());const{contentDOM:s,wrapper:a}=this.createContentDom()??{};xr(this,im,s??void 0),xr(this,xi,a),me(this,xi)&&me(this,In).append(me(this,xi)),this.setDomAttributes(me(this,mt),me(this,In)),this.Component.displayName=V2(`${me(this,mt).type.name}NodeView`),this.renderComponent()}static create(e){const{portalContainer:t,ReactComponent:n,options:r}=e;return(o,i,s)=>new YD({options:r,node:o,view:i,getPosition:s,portalContainer:t,ReactComponent:n})}get selected(){return me(this,bd)}get contentDOM(){return me(this,im)}get dom(){return me(this,In)}renderComponent(){me(this,yd).render({Component:this.Component,container:me(this,In)})}createDom(){const{defaultBlockNode:e,defaultInlineNode:t}=me(this,tc),n=me(this,mt).isInline?document.createElement(t):document.createElement(e);return n.classList.add(`${u_(me(this,mt).type.name)}-node-view-wrapper`),n}createContentDom(){var e,t;if(me(this,mt).isLeaf)return;const n=(t=(e=me(this,mt).type.spec).toDOM)==null?void 0:t.call(e,me(this,mt));if(!n)return;const{contentDOM:r,dom:o}=Ea.renderSpec(document,n);let i;if(si(o))return i=o,o===r&&(i=document.createElement("span"),i.classList.add(`${u_(me(this,mt).type.name)}-node-view-content-wrapper`),i.append(r)),si(r),{wrapper:i,contentDOM:r}}update(e,t){return HS({types:me(this,mt).type,node:e})?(me(this,mt)===e&&me(this,vd)===t||(me(this,mt).sameMarkup(e)||this.setDomAttributes(e,me(this,In)),xr(this,mt,e),xr(this,vd,t),this.renderComponent()),!0):!1}setDomAttributes(e,t){const{toDOM:n}=me(this,mt).type.spec;let r=e.attrs;if(n){const o=n(e);if(Te(o)||wne(o))return;Tl(o[1])&&(r=o[1])}for(const[o,i]of Vt(r))t.setAttribute(o,i)}selectNode(){xr(this,bd,!0),me(this,In)&&me(this,In).classList.add(s_),this.renderComponent()}deselectNode(){xr(this,bd,!1),me(this,In)&&me(this,In).classList.remove(s_),this.renderComponent()}destroy(){me(this,yd).remove(me(this,In))}ignoreMutation(e){return e.type==="selection"?!me(this,mt).type.spec.selectable:me(this,xi)?!me(this,xi).contains(e.target):!0}stopEvent(e){var t;if(!me(this,In))return!1;if(pt(me(this,tc).stopEvent))return me(this,tc).stopEvent({event:e});const n=e.target;if(!(me(this,In).contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o)return!0;const s=!!me(this,mt).type.spec.draggable,a=Se.isSelectable(me(this,mt)),l=e.type==="copy",c=e.type==="paste",u=e.type==="cut",d=e.type==="mousedown",p=e.type.startsWith("drag");return!s&&a&&p&&e.preventDefault(),!(p||o||l||c||u||d&&a)}},PN=YD;mt=new WeakMap;vd=new WeakMap;Fa=new WeakMap;yd=new WeakMap;om=new WeakMap;xd=new WeakMap;tc=new WeakMap;bd=new WeakMap;im=new WeakMap;xi=new WeakMap;In=new WeakMap;Yb=new WeakMap;function wne(e){return zb(e)||Tl(e)&&zb(e.dom)}var Qf=class extends ht{constructor(){super(...arguments),this.portalContainer=new yne}get name(){return"reactComponent"}onCreate(){this.store.setStoreKey("portalContainer",this.portalContainer)}createNodeViews(){const e=ve(),t=this.store.managerSettings.nodeViewComponents??{};for(const r of this.store.extensions)!r.ReactComponent||!Kp(r)||r.reactComponentEnvironment==="ssr"||(e[r.name]=PN.create({options:this.options,ReactComponent:r.ReactComponent,portalContainer:this.portalContainer}));const n=Vt({...this.options.nodeViewComponents,...t});for(const[r,o]of n)e[r]=PN.create({options:this.options,ReactComponent:o,portalContainer:this.portalContainer});return e}};Qf=vne([Ge({defaultOptions:{defaultBlockNode:"div",defaultInlineNode:"span",defaultContentNode:"span",defaultEnvironment:"both",nodeViewComponents:{},stopEvent:null},staticKeys:["defaultBlockNode","defaultInlineNode","defaultContentNode","defaultEnvironment"]})],Qf);var Sne=Object.defineProperty,jN=Object.getOwnPropertySymbols,kne=Object.prototype.hasOwnProperty,Cne=Object.prototype.propertyIsEnumerable,RN=(e,t,n)=>t in e?Sne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,AN=(e,t)=>{for(var n in t||(t={}))kne.call(t,n)&&RN(e,n,t[n]);if(jN)for(var n of jN(t))Cne.call(t,n)&&RN(e,n,t[n]);return e};function Ene(e){const t=g.createContext(null),n=_ne(t);return[o=>{const i=e(o);return ye.createElement(t.Provider,{value:i},o.children)},n,t]}function _ne(e){return(t,n)=>{const r=g.useContext(e),o=Nne(r);if(!r)throw new Error("`useContextHook` must be placed inside the `Provider` returned by the `createContextState` method");if(!t)return r;if(typeof t!="function")throw new TypeError("invalid arguments passed to `useContextHook`. This hook must be called with zero arguments, a getter function or a path string.");const i=t(r);if(!o||!n)return i;const s=t(o);return n(s,i)?s:i}}function Nne(e){const t=g.useRef();return One(()=>{t.current=e}),t.current}var One=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Tne(e,t){return Ene(n=>{const r=g.useRef(null),o=g.useRef(),i=void 0,[s,a]=g.useState(()=>e({get:IN(r),set:DN(o),previousContext:void 0,props:n,state:i})),l=[...Object.values(n),i];return g.useEffect(()=>{l.length!==0&&a(c=>e({get:IN(r),set:DN(o),previousContext:c,props:n,state:i}))},l),r.current=s,o.current=a,s})}function IN(e){return t=>{if(!e.current)throw new Error("`get` called outside of function scope. `get` can only be called within a function.");if(!t)return e.current;if(typeof t!="function")throw new TypeError("Invalid arguments passed to `useContextHook`. The hook must be called with zero arguments, a getter function or a path string.");return t(e.current)}}function DN(e){return t=>{if(!e.current)throw new Error("`set` called outside of function scope. `set` can only be called within a function.");e.current(n=>AN(AN({},n),typeof t=="function"?t(n):t))}}var JD={},XD={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.errorMessages=e.ErrorType=void 0;var t;(function(n){n.MalformedUnicode="MALFORMED_UNICODE",n.MalformedHexadecimal="MALFORMED_HEXADECIMAL",n.CodePointLimit="CODE_POINT_LIMIT",n.OctalDeprecation="OCTAL_DEPRECATION",n.EndOfString="END_OF_STRING"})(t=e.ErrorType||(e.ErrorType={})),e.errorMessages=new Map([[t.MalformedUnicode,"malformed Unicode character escape sequence"],[t.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[t.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[t.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[t.EndOfString,"malformed escape sequence at end of string"]])})(XD);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unraw=e.errorMessages=e.ErrorType=void 0;const t=XD;Object.defineProperty(e,"ErrorType",{enumerable:!0,get:function(){return t.ErrorType}}),Object.defineProperty(e,"errorMessages",{enumerable:!0,get:function(){return t.errorMessages}});function n(h){return!h.match(/[^a-f0-9]/i)?parseInt(h,16):NaN}function r(h,m,v){const x=n(h);if(Number.isNaN(x)||v!==void 0&&v!==h.length)throw new SyntaxError(t.errorMessages.get(m));return x}function o(h){const m=r(h,t.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(m)}function i(h,m){const v=r(h,t.ErrorType.MalformedUnicode,4);if(m!==void 0){const x=r(m,t.ErrorType.MalformedUnicode,4);return String.fromCharCode(v,x)}return String.fromCharCode(v)}function s(h){return h.charAt(0)==="{"&&h.charAt(h.length-1)==="}"}function a(h){if(!s(h))throw new SyntaxError(t.errorMessages.get(t.ErrorType.MalformedUnicode));const m=h.slice(1,-1),v=r(m,t.ErrorType.MalformedUnicode);try{return String.fromCodePoint(v)}catch(x){throw x instanceof RangeError?new SyntaxError(t.errorMessages.get(t.ErrorType.CodePointLimit)):x}}function l(h,m=!1){if(m)throw new SyntaxError(t.errorMessages.get(t.ErrorType.OctalDeprecation));const v=parseInt(h,8);return String.fromCharCode(v)}const c=new Map([["b","\b"],["f","\f"],["n",`
|
|
425
425
|
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function u(h){return c.get(h)||h}const d=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function p(h,m=!1){return h.replace(d,function(v,x,b,w,S,k,C,N,_){if(x!==void 0)return"\\";if(b!==void 0)return o(b);if(w!==void 0)return a(w);if(S!==void 0)return i(S,k);if(C!==void 0)return i(C);if(N==="0")return"\0";if(N!==void 0)return l(N,!m);if(_!==void 0)return u(_);throw new SyntaxError(t.errorMessages.get(t.ErrorType.EndOfString))})}e.unraw=p,e.default=p})(JD);const il=e=>typeof e=="string",Mne=e=>typeof e=="function",LN=new Map,ZD="en";function QS(e){return[...Array.isArray(e)?e:[e],ZD]}function QD(e,t,n){const r=QS(e);return Rg(()=>Ag("date",r,n),()=>new Intl.DateTimeFormat(r,n)).format(il(t)?new Date(t):t)}function Jb(e,t,n){const r=QS(e);return Rg(()=>Ag("number",r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function FN(e,t,n,{offset:r=0,...o}){const i=QS(e),s=t?Rg(()=>Ag("plural-ordinal",i),()=>new Intl.PluralRules(i,{type:"ordinal"})):Rg(()=>Ag("plural-cardinal",i),()=>new Intl.PluralRules(i,{type:"cardinal"}));return o[n]??o[s.select(n-r)]??o.other}function Rg(e,t){const n=e();let r=LN.get(n);return r||(r=t(),LN.set(n,r)),r}function Ag(e,t,n){const r=t.join("-");return`${e}-${r}-${JSON.stringify(n)}`}const eL=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,tL="%__lingui_octothorpe__%",Pne=(e,t,n={})=>{const r=t||e,o=s=>typeof s=="object"?s:n[s]||{style:s},i=(s,a)=>{const l=Object.keys(n).length?o("number"):void 0,c=Jb(r,s,l);return a.replace(new RegExp(tL,"g"),c)};return{plural:(s,a)=>{const{offset:l=0}=a,c=FN(r,!1,s,a);return i(s-l,c)},selectordinal:(s,a)=>{const{offset:l=0}=a,c=FN(r,!0,s,a);return i(s-l,c)},select:jne,number:(s,a)=>Jb(r,s,o(a)),date:(s,a)=>QD(r,s,o(a))}},jne=(e,t)=>t[e]??t.other;function Rne(e,t,n){return(r={},o)=>{const i=Pne(t,n,o),s=(l,c=!1)=>Array.isArray(l)?l.reduce((u,d)=>{if(d==="#"&&c)return u+tL;if(il(d))return u+d;const[p,h,m]=d;let v={};h==="plural"||h==="selectordinal"||h==="select"?Object.entries(m).forEach(([b,w])=>{v[b]=s(w,h==="plural"||h==="selectordinal")}):v=m;let x;if(h){const b=i[h];x=b(r[p],v)}else x=r[p];return x==null?u:u+x},""):l,a=s(e);return il(a)&&eL.test(a)?JD.unraw(a.trim()):il(a)?a.trim():a?String(a):""}}var Ane=Object.defineProperty,Ine=(e,t,n)=>t in e?Ane(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dne=(e,t,n)=>(Ine(e,t+"",n),n);class Lne{constructor(){Dne(this,"_events",{})}on(t,n){var r;return(r=this._events)[t]??(r[t]=[]),this._events[t].push(n),()=>this.removeListener(t,n)}removeListener(t,n){const r=this._getListeners(t);if(!r)return;const o=r.indexOf(n);~o&&r.splice(o,1)}emit(t,...n){const r=this._getListeners(t);r&&r.map(o=>o.apply(this,n))}_getListeners(t){const n=this._events[t];return Array.isArray(n)?n:!1}}var Fne=Object.defineProperty,zne=(e,t,n)=>t in e?Fne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ql=(e,t,n)=>(zne(e,typeof t!="symbol"?t+"":t,n),n);class $ne extends Lne{constructor(t){super(),ql(this,"_locale",""),ql(this,"_locales"),ql(this,"_localeData",{}),ql(this,"_messages",{}),ql(this,"_missing"),ql(this,"t",this._.bind(this)),t.missing!=null&&(this._missing=t.missing),t.messages!=null&&this.load(t.messages),t.localeData!=null&&this.loadLocaleData(t.localeData),(typeof t.locale=="string"||t.locales)&&this.activate(t.locale??ZD,t.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(t,n){const r=this._localeData[t];r?Object.assign(r,n):this._localeData[t]=n}loadLocaleData(t,n){n!=null?this._loadLocaleData(t,n):Object.keys(t).forEach(r=>this._loadLocaleData(r,t[r])),this.emit("change")}_load(t,n){const r=this._messages[t];r?Object.assign(r,n):this._messages[t]=n}load(t,n){typeof t=="string"&&typeof n=="object"?this._load(t,n):Object.entries(t).forEach(([r,o])=>this._load(r,o)),this.emit("change")}loadAndActivate({locale:t,locales:n,messages:r}){this._locale=t,this._locales=n||void 0,this._messages[this._locale]=r,this.emit("change")}activate(t,n){this._locale=t,this._locales=n,this.emit("change")}_(t,n,r){let o=r==null?void 0:r.message;t||(t=""),il(t)||(n=t.values||n,o=t.message,t=t.id);const i=this.messages[t],s=i===void 0,a=this._missing;if(a&&s)return Mne(a)?a(this._locale,t):a;s&&this.emit("missing",{id:t,locale:this._locale});let l=i||o||t;return il(l)&&eL.test(l)?JSON.parse(`"${l}"`):il(l)?l:Rne(l,this._locale,this._locales)(n,r==null?void 0:r.formats)}date(t,n){return QD(this._locales||this._locale,t,n)}number(t,n){return Jb(this._locales||this._locale,t,n)}}function Bne(e={}){return new $ne(e)}const oy=Bne();function ee(e,t){return t?"other":e==1?"one":"other"}function Xi(e,t){return t?"other":e==0||e==1?"one":"other"}function mr(e,t){var n=String(e).split("."),r=!n[1];return t?"other":e==1&&r?"one":"other"}function Xe(e,t){return"other"}function Na(e,t){return t?"other":e==1?"one":e==2?"two":"other"}const Vne=Xe,Une=ee,Wne=Xi;function Hne(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Kne=ee;function qne(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function Gne(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==0?"zero":e==1?"one":e==2?"two":o>=3&&o<=10?"few":o>=11&&o<=99?"many":"other"}function Yne(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Jne=ee,Xne=mr;function Zne(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-1),i=r.slice(-2),s=r.slice(-3);return t?o==1||o==2||o==5||o==7||o==8||i==20||i==50||i==70||i==80?"one":o==3||o==4||s==100||s==200||s==300||s==400||s==500||s==600||s==700||s==800||s==900?"few":r==0||o==6||i==40||i==60||i==90?"many":"other":e==1?"one":"other"}function Qne(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?(o==2||o==3)&&i!=12&&i!=13?"few":"other":o==1&&i!=11?"one":o>=2&&o<=4&&(i<12||i>14)?"few":r&&o==0||o>=5&&o<=9||i>=11&&i<=14?"many":"other"}const ere=ee,tre=ee,nre=ee,rre=Xi,ore=Xe;function ire(e,t){return t?e==1||e==5||e==7||e==8||e==9||e==10?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const sre=Xe;function are(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2),s=r&&n[0].slice(-6);return t?"other":o==1&&i!=11&&i!=71&&i!=91?"one":o==2&&i!=12&&i!=72&&i!=92?"two":(o==3||o==4||o==9)&&(i<10||i>19)&&(i<70||i>79)&&(i<90||i>99)?"few":e!=0&&r&&s==0?"many":"other"}const lre=ee;function cre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function ure(e,t){var n=String(e).split("."),r=!n[1];return t?e==1||e==3?"one":e==2?"two":e==4?"few":"other":e==1&&r?"one":"other"}const dre=ee;function fre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const pre=ee,hre=ee,mre=ee;function gre(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function vre(e,t){return t?e==0||e==7||e==8||e==9?"zero":e==1?"one":e==2?"two":e==3||e==4?"few":e==5||e==6?"many":"other":e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"}function yre(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e;return t?"other":e==1||!o&&(r==0||r==1)?"one":"other"}const xre=mr;function bre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}const wre=ee,Sre=Xe,kre=ee,Cre=ee;function Ere(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?i==1&&s!=11?"one":i==2&&s!=12?"two":i==3&&s!=13?"few":"other":e==1&&r?"one":"other"}const _re=ee,Nre=ee,Ore=mr,Tre=ee;function Mre(e,t){return t?"other":e>=0&&e<=1?"one":"other"}function Pre(e,t){return t?"other":e>=0&&e<2?"one":"other"}const jre=mr;function Rre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const Are=ee;function Ire(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Dre=ee,Lre=mr;function Fre(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1?"one":"other":e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"}function zre(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==11?"one":e==2||e==12?"two":e==3||e==13?"few":"other":e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"}const $re=mr,Bre=ee;function Vre(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}const Ure=Xi;function Wre(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(s==0||s==20||s==40||s==60||s==80)?"few":o?"other":"many"}const Hre=ee,Kre=ee;function qre(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}function Gre(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e>=0&&e<=1?"one":"other"}function Yre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function Jre(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-2),a=o.slice(-2);return t?"other":i&&s==1||a==1?"one":i&&s==2||a==2?"two":i&&(s==3||s==4)||a==3||a==4?"few":"other"}function Xre(e,t){return t?e==1||e==5?"one":"other":e==1?"one":"other"}function Zre(e,t){return t?e==1?"one":"other":e>=0&&e<2?"one":"other"}const Qre=mr,eoe=Xe,toe=Xe,noe=Xe,roe=mr;function ooe(e,t){var n=String(e).split("."),r=n[0],o=Number(n[0])==e,i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11||!o?"one":"other"}function ioe(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const soe=Na;function aoe(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1);return t?"other":e==1&&o?"one":r==2&&o?"two":o&&(e<0||e>10)&&i&&s==0?"many":"other"}const loe=Xe,coe=Xe,uoe=ee,doe=mr,foe=ee,poe=Xe,hoe=Xe;function moe(e,t){var n=String(e).split("."),r=n[0],o=r.slice(-2);return t?r==1?"one":r==0||o>=2&&o<=20||o==40||o==60||o==80?"many":"other":e==1?"one":"other"}function goe(e,t){return t?"other":e>=0&&e<2?"one":"other"}const voe=ee,yoe=ee,xoe=Xe,boe=Xe;function woe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||r&&o==0&&e!=0?"many":"other":e==1?"one":"other"}const Soe=ee,koe=ee,Coe=Xe;function Eoe(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const _oe=Xe,Noe=ee,Ooe=ee;function Toe(e,t){return t?"other":e==0?"zero":e==1?"one":"other"}const Moe=ee;function Poe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2),i=r&&n[0].slice(-3),s=r&&n[0].slice(-5),a=r&&n[0].slice(-6);return t?r&&e>=1&&e<=4||o>=1&&o<=4||o>=21&&o<=24||o>=41&&o<=44||o>=61&&o<=64||o>=81&&o<=84?"one":e==5||o==5?"many":"other":e==0?"zero":e==1?"one":o==2||o==22||o==42||o==62||o==82||r&&i==0&&(s>=1e3&&s<=2e4||s==4e4||s==6e4||s==8e4)||e!=0&&a==1e5?"two":o==3||o==23||o==43||o==63||o==83?"few":e!=1&&(o==1||o==21||o==41||o==61||o==81)?"many":"other"}const joe=ee;function Roe(e,t){var n=String(e).split("."),r=n[0];return t?"other":e==0?"zero":(r==0||r==1)&&e!=0?"one":"other"}const Aoe=ee,Ioe=ee,Doe=Xe,Loe=Xi;function Foe(e,t){return t&&e==1?"one":"other"}function zoe(e,t){var n=String(e).split("."),r=n[1]||"",o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?"other":i==1&&(s<11||s>19)?"one":i>=2&&i<=9&&(s<11||s>19)?"few":r!=0?"many":"other"}function $oe(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const Boe=ee,Voe=Xi,Uoe=ee;function Woe(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?s==1&&a!=11?"one":s==2&&a!=12?"two":(s==7||s==8)&&a!=17&&a!=18?"many":"other":i&&s==1&&a!=11||l==1&&c!=11?"one":"other"}const Hoe=ee,Koe=ee;function qoe(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}function Goe(e,t){return t?e==1?"one":e==2||e==3?"two":e==4?"few":"other":e==1?"one":"other"}function Yoe(e,t){return t&&e==1?"one":"other"}function Joe(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-2);return t?"other":e==1?"one":e==0||o>=2&&o<=10?"few":o>=11&&o<=19?"many":"other"}const Xoe=Xe,Zoe=ee,Qoe=Na,eie=ee,tie=ee;function nie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?r&&e>=1&&e<=4?"one":"other":e==1?"one":"other"}const rie=mr,oie=ee,iie=ee,sie=ee,aie=Xe,lie=ee,cie=Xi,uie=ee,die=ee,fie=ee;function pie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?e==1||e==5||r&&e>=7&&e<=9?"one":e==2||e==3?"two":e==4?"few":e==6?"many":"other":e==1?"one":"other"}const hie=ee,mie=Xe,gie=Xi,vie=ee;function yie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":e==1&&o?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&r!=1&&(i==0||i==1)||o&&i>=5&&i<=9||o&&s>=12&&s<=14?"many":"other"}function xie(e,t){var n=String(e).split("."),r=n[1]||"",o=r.length,i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-2),c=r.slice(-1);return t?"other":i&&s==0||a>=11&&a<=19||o==2&&l>=11&&l<=19?"zero":s==1&&a!=11||o==2&&c==1&&l!=11||o!=2&&c==1?"one":"other"}const bie=ee;function wie(e,t){var n=String(e).split("."),r=n[0];return t?"other":r==0||r==1?"one":"other"}const Sie=mr,kie=ee;function Cie(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-2);return t?e==1?"one":"other":e==1&&r?"one":!r||e==0||i>=2&&i<=19?"few":"other"}const Eie=ee,_ie=Xe;function Nie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),s=r.slice(-2);return t?"other":o&&i==1&&s!=11?"one":o&&i>=2&&i<=4&&(s<12||s>14)?"few":o&&i==0||o&&i>=5&&i<=9||o&&s>=11&&s<=14?"many":"other"}const Oie=ee,Tie=Xe,Mie=ee;function Pie(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}function jie(e,t){var n=String(e).split("."),r=!n[1];return t?e==11||e==8||e==80||e==800?"many":"other":e==1&&r?"one":"other"}const Rie=ee,Aie=ee,Iie=Na,Die=ee,Lie=Xe,Fie=Xe;function zie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}function $ie(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e>=0&&e<=1?"one":r&&e>=2&&e<=10?"few":"other"}function Bie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"";return t?"other":e==0||e==1||r==0&&o==1?"one":"other"}function Vie(e,t){var n=String(e).split("."),r=n[0],o=!n[1];return t?"other":e==1&&o?"one":r>=2&&r<=4&&o?"few":o?"other":"many"}function Uie(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-2);return t?"other":o&&i==1?"one":o&&i==2?"two":o&&(i==3||i==4)||!o?"few":"other"}const Wie=Na,Hie=Na,Kie=Na,qie=Na,Gie=Na,Yie=ee,Jie=ee;function Xie(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1),i=r&&n[0].slice(-2);return t?e==1?"one":o==4&&i!=14?"many":"other":e==1?"one":"other"}function Zie(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=r.slice(-2),l=o.slice(-1),c=o.slice(-2);return t?"other":i&&s==1&&a!=11||l==1&&c!=11?"one":i&&s>=2&&s<=4&&(a<12||a>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"}const Qie=ee,ese=ee,tse=ee,nse=Xe;function rse(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),s=o&&n[0].slice(-2);return t?(i==1||i==2)&&s!=11&&s!=12?"one":"other":e==1&&r?"one":"other"}const ose=mr,ise=ee,sse=ee,ase=ee,lse=ee,cse=Xe,use=Xi,dse=ee;function fse(e,t){var n=String(e).split("."),r=Number(n[0])==e,o=r&&n[0].slice(-1);return t?o==6||o==9||e==10?"few":"other":e==1?"one":"other"}function pse(e,t){var n=String(e).split("."),r=n[0],o=n[1]||"",i=!n[1],s=r.slice(-1),a=o.slice(-1);return t?e==1?"one":"other":i&&(r==1||r==2||r==3)||i&&s!=4&&s!=6&&s!=9||!i&&a!=4&&a!=6&&a!=9?"one":"other"}const hse=ee,mse=Xe,gse=ee,vse=ee;function yse(e,t){var n=String(e).split("."),r=Number(n[0])==e;return t?"other":e==0||e==1||r&&e>=11&&e<=99?"one":"other"}const xse=ee;function bse(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=Number(n[0])==e,s=i&&n[0].slice(-1),a=i&&n[0].slice(-2),l=r.slice(-1),c=r.slice(-2);return t?s==3&&a!=13?"few":"other":o&&l==1&&c!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)?"few":o&&l==0||o&&l>=5&&l<=9||o&&c>=11&&c<=14?"many":"other"}const wse=mr,Sse=ee,kse=ee;function Cse(e,t){return t&&e==1?"one":"other"}const Ese=ee,_se=ee,Nse=Xi,Ose=ee,Tse=Xe,Mse=ee,Pse=ee,jse=mr,Rse=Xe,Ase=Xe,Ise=Xe;function Dse(e,t){return t?"other":e>=0&&e<=1?"one":"other"}const Lse=Object.freeze(Object.defineProperty({__proto__:null,_in:Vne,af:Une,ak:Wne,am:Hne,an:Kne,ar:qne,ars:Gne,as:Yne,asa:Jne,ast:Xne,az:Zne,be:Qne,bem:ere,bez:tre,bg:nre,bho:rre,bm:ore,bn:ire,bo:sre,br:are,brx:lre,bs:cre,ca:ure,ce:dre,ceb:fre,cgg:pre,chr:hre,ckb:mre,cs:gre,cy:vre,da:yre,de:xre,dsb:bre,dv:wre,dz:Sre,ee:kre,el:Cre,en:Ere,eo:_re,es:Nre,et:Ore,eu:Tre,fa:Mre,ff:Pre,fi:jre,fil:Rre,fo:Are,fr:Ire,fur:Dre,fy:Lre,ga:Fre,gd:zre,gl:$re,gsw:Bre,gu:Vre,guw:Ure,gv:Wre,ha:Hre,haw:Kre,he:qre,hi:Gre,hr:Yre,hsb:Jre,hu:Xre,hy:Zre,ia:Qre,id:eoe,ig:toe,ii:noe,io:roe,is:ooe,it:ioe,iu:soe,iw:aoe,ja:loe,jbo:coe,jgo:uoe,ji:doe,jmc:foe,jv:poe,jw:hoe,ka:moe,kab:goe,kaj:voe,kcg:yoe,kde:xoe,kea:boe,kk:woe,kkj:Soe,kl:koe,km:Coe,kn:Eoe,ko:_oe,ks:Noe,ksb:Ooe,ksh:Toe,ku:Moe,kw:Poe,ky:joe,lag:Roe,lb:Aoe,lg:Ioe,lkt:Doe,ln:Loe,lo:Foe,lt:zoe,lv:$oe,mas:Boe,mg:Voe,mgo:Uoe,mk:Woe,ml:Hoe,mn:Koe,mo:qoe,mr:Goe,ms:Yoe,mt:Joe,my:Xoe,nah:Zoe,naq:Qoe,nb:eie,nd:tie,ne:nie,nl:rie,nn:oie,nnh:iie,no:sie,nqo:aie,nr:lie,nso:cie,ny:uie,nyn:die,om:fie,or:pie,os:hie,osa:mie,pa:gie,pap:vie,pl:yie,prg:xie,ps:bie,pt:wie,pt_PT:Sie,rm:kie,ro:Cie,rof:Eie,root:_ie,ru:Nie,rwk:Oie,sah:Tie,saq:Mie,sc:Pie,scn:jie,sd:Rie,sdh:Aie,se:Iie,seh:Die,ses:Lie,sg:Fie,sh:zie,shi:$ie,si:Bie,sk:Vie,sl:Uie,sma:Wie,smi:Hie,smj:Kie,smn:qie,sms:Gie,sn:Yie,so:Jie,sq:Xie,sr:Zie,ss:Qie,ssy:ese,st:tse,su:nse,sv:rse,sw:ose,syr:ise,ta:sse,te:ase,teo:lse,th:cse,ti:use,tig:dse,tk:fse,tl:pse,tn:hse,to:mse,tr:gse,ts:vse,tzm:yse,ug:xse,uk:bse,ur:wse,uz:Sse,ve:kse,vi:Cse,vo:Ese,vun:_se,wa:Nse,wae:Ose,wo:Tse,xh:Mse,xog:Pse,yi:jse,yo:Rse,yue:Ase,zh:Ise,zu:Dse},Symbol.toStringTag,{value:"Module"}));var Fse=Object.defineProperty,zse=Object.getOwnPropertyDescriptor,$se=Object.getOwnPropertyNames,Bse=Object.prototype.hasOwnProperty,Vse=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $se(t))!Bse.call(e,o)&&o!==n&&Fse(e,o,{get:()=>t[o],enumerable:!(r=zse(t,o))||r.enumerable});return e},Use=(e,t,n)=>(Vse(e,t,"default"),n),Wse=JSON.parse('{"extension.command.toggle-upper-case.label":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"extension.table.column_count":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"extension.table.row_count":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.toggle-columns.description":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"extension.command.toggle-columns.label":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"extension.command.set-text-direction.label":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"extension.command.set-text-direction.description":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"extension.command.toggle-heading.label":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"extension.command.toggle-callout.description":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"extension.command.toggle-callout.label":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"extension.command.toggle-code-block.description":"Add a code block","extension.command.add-annotation.label":"Add annotation","extension.command.toggle-blockquote.description":"Add blockquote formatting to the selected text","extension.command.toggle-bold.description":"Add bold formatting to the selected text","extension.command.toggle-code.description":"Add inline code formatting to the selected text","keyboard.shortcut.alt":"Alt","keyboard.shortcut.arrowDown":"Arrow Down","keyboard.shortcut.arrowLeft":"Arrow Left","keyboard.shortcut.arrowRight":"Arrow Right","keyboard.shortcut.arrowUp":"Arrow Up","keyboard.shortcut.backspace":"Backspace","ui.text-color.black":"Black","extension.command.toggle-blockquote.label":"Blockquote","ui.text-color.blue":"Blue","ui.text-color.blue.hue":["Blue ",["hue"]],"extension.command.toggle-bold.label":"Bold","extension.command.toggle-bullet-list.description":"Bulleted list","keyboard.shortcut.capsLock":"Caps Lock","extension.command.center-align.label":"Center align","extension.command.toggle-code.label":"Code","extension.command.toggle-code-block.label":"Codeblock","keyboard.shortcut.command":"Command","QcPNd6":"Image description","ogrUzJ":"Add a short description here.","yqdyzr":"Image","6/02F4":"Image source","X8H91v":"Image","zhQ7Zt":"Italic","ZL7E7l":"Underline","keyboard.shortcut.control":"Control","extension.command.convert-paragraph.description":"Convert current block into a paragraph block.","extension.command.convert-paragraph.label":"Convert Paragraph","extension.command.copy.label":"Copy","extension.command.copy.description":"Copy the selected text","extension.command.create-table.description":"Create a table with set number of rows and columns.","extension.command.create-table.label":"Create table","extension.command.cut.label":"Cut","extension.command.cut.description":"Cut the selected text","ui.text-color.cyan":"Cyan","ui.text-color.cyan.hue":["Cyan ",["hue"]],"extension.command.decrease-font-size.label":"Decrease","extension.command.decrease-indent.label":"Decrease indentation","extension.command.decrease-font-size.description":"Decrease the font size.","keyboard.shortcut.delete":"Delete","extension.command.insert-horizontal-rule.label":"Divider","keyboard.shortcut.end":"End","keyboard.shortcut.escape":"Enter","keyboard.shortcut.enter":"Enter","6PjrOF":"Add annotation","OTq5WC":"Center align","oeZ3ox":"Convert current block into a paragraph block.","m1khs+":"Convert Paragraph","w/1U+3":"Copy the selected text","kdodi0":"Copy","k0KR/u":"Create a table with set number of rows and columns.","zrwMyD":"Create table","D/nWxh":"Cut the selected text","jHPv5m":"Cut","5cNgRx":"Decrease the font size.","vyRNWx":"Decrease","Jgiol4":"Decrease indentation","1gJSHH":"Increase the font size","OQXJXz":"Increase","72TLhr":"Increase indentation","HFlfzJ":"Insert Emoji","RPq9fY":"Separate content with a diving horizontal line","OKQF+e":"Divider","zjYb9C":"Insert a new paragraph","4M4sXC":"Insert Paragraph","1Q+eVc":"Justify","ejWWtP":"Left align","wVqrpS":"Paste content into the editor","07v9aw":"Paste","zUYfou":"Redo the most recent action","9Nq9zr":"Redo","0uxaZe":"Remove annotation","iJWZAz":"Right align","g5WpPn":"Select all content within the editor","2+pZDT":"Select all","yChCR1":"Set text case","GMzAC/":"Set the font size for the selected text.","vzEyrv":"Font size","7VCkJ8":"Set the text color for the selected text.","qjWFaR":"Text color","LVWgFu":[["dir","select",{"ltr":"Set the text direction from left to right","rtl":"Set the text direction from right to left","other":"Reset text direction"}]],"WXwRy1":[["dir","select",{"ltr":"Left-To-Right","rtl":"Right-To-Left","other":"Reset Direction"}]],"G/o315":"Set the text highlight color for the selected text.","xtHg6d":"Text highlight","1p1W/p":"Add blockquote formatting to the selected text","6+rh6I":"Blockquote","0yB3LV":"Add bold formatting to the selected text","sFMo4Z":"Bold","SMKG/s":"Bulleted list","/BYCMi":[["type","select",{"info":"Create an information callout block","warning":"Create a warning callout block","error":"Create an error callout block","success":"Create a success callout block","other":"Create a callout block"}]],"V+3IBe":[["type","select",{"info":"Information Callout","warning":"Warning Callout","error":"Error Callout","success":"Success Callout","other":"Callout"}]],"hbIo4L":"Add a code block","7GkMcx":"Codeblock","2r4JYl":"Add inline code formatting to the selected text","Up8Tpe":"Code","ATHSPS":[["count","select",{"2":"Split the block into two columns","3":"Split the current block into three columns","4":"Split the current block into four columns","other":"Split the current block into multiple columns"}]],"7DC1VE":[["count","select",{"2":"Two Column Block","3":"Three Column Block","4":"Four Column Block","other":"Multi Column Block"}]],"hnrBeo":[["level","select",{"1":"Heading 1","2":"Heading 2","3":"Heading 3","4":"Heading 4","5":"Heading 5","6":"Heading 6","other":"Heading"}]],"NkZAcw":"Italicize the selected text","2fTW9e":"Italic","c759Ra":"Ordered list","uQwrZu":"Strikethrough the selected text","pT3qly":"Strikethrough","BHk+zu":"Subscript","18BVwM":"Superscript","tOIVCV":"Tasked list","4Janx3":"Underline the selected text","dCHt+D":"Underline","YYAprs":[["case","select",{"upper":"Uppercase","lower":"Lowercase","capitalize":"Sentence case","smallCaps":"Small caps","other":"Text case"}]],"tczyZL":"Show hidden whitespace characters in your editor.","0qAX23":"Toggle Whitespace","ezMADU":"Undo the most recent action","N3P7EC":"Undo","2nj/+s":"Update annotation","dWD7u4":[["count","plural",{"one":["#"," column"],"other":["#"," columns"]}]],"qXqgVT":[["count","plural",{"one":["#"," row"],"other":["#"," rows"]}]],"extension.command.set-font-size.label":"Font size","ui.text-color.grape":"Grape","ui.text-color.grape.hue":["Grape ",["hue"]],"ui.text-color.gray":"Gray","ui.text-color.gray.hue":["Gray ",["hue"]],"ui.text-color.green":"Green","ui.text-color.green.hue":["Green ",["hue"]],"keyboard.shortcut.home":"Home","extension.command.increase-font-size.label":"Increase","extension.command.increase-indent.label":"Increase indentation","extension.command.increase-font-size.description":"Increase the font size","ui.text-color.indigo":"Indigo","ui.text-color.indigo.hue":["Indigo ",["hue"]],"extension.command.insert-paragraph.description":"Insert a new paragraph","extension.command.insert-emoji.label":"Insert Emoji","extension.command.insert-paragraph.label":"Insert Paragraph","extension.command.toggle-italic.label":"Italic","extension.command.toggle-italic.description":"Italicize the selected text","extension.command.justify-align.label":"Justify","R7NlCw":"Alt","RbDiK5":"Arrow Down","Dgyd+E":"Arrow Left","8pdCk4":"Arrow Right","Gp/343":"Arrow Up","PFPV0A":"Backspace","0IRYvp":"Caps Lock","X7HX0D":"Command","zq0AdD":"Control","8SfToN":"Delete","Ys/uah":"End","3K5hww":"Enter","veQt1j":"Enter","ySv7i+":"Home","e6RUI1":"Page Down","EEJk31":"Page Up","7sbhAU":"Shift","Q4eplT":"Space","SUhVVC":"Tab","extension.command.left-align.label":"Left align","ui.text-color.lime":"Lime","ui.text-color.lime.hue":["Lime ",["hue"]],"react-components.mention-atom-component.zero-items":"No items available","ui.text-color.orange":"Orange","ui.text-color.orange.hue":["Orange ",["hue"]],"extension.command.toggle-ordered-list.label":"Ordered list","keyboard.shortcut.pageDown":"Page Down","keyboard.shortcut.pageUp":"Page Up","extension.command.paste.label":"Paste","extension.command.paste.description":"Paste content into the editor","ui.text-color.pink":"Pink","ui.text-color.pink.hue":["Pink ",["hue"]],"zvMfIA":"No items available","pEjhti":"Static Menu","ui.text-color.red":"Red","ui.text-color.red.hue":["Red ",["hue"]],"extension.command.redo.label":"Redo","extension.command.redo.description":"Redo the most recent action","extension.command.remove-annotation.label":"Remove annotation","extension.command.right-align.label":"Right align","extension.command.select-all.label":"Select all","extension.command.select-all.description":"Select all content within the editor","extension.command.insert-horizontal-rule.description":"Separate content with a diving horizontal line","extension.command.set-casing.label":"Set text case","extension.command.set-font-size.description":"Set the font size for the selected text.","extension.command.set-text-color.description":"Set the text color for the selected text.","extension.command.set-text-highlight.description":"Set the text highlight color for the selected text.","keyboard.shortcut.shift":"Shift","extension.command.toggle-whitespace.description":"Show hidden whitespace characters in your editor.","keyboard.shortcut.space":"Space","extension.command.toggle-strike.label":"Strikethrough","extension.command.toggle-strike.description":"Strikethrough the selected text","extension.command.toggle-subscript.label":"Subscript","extension.command.toggle-superscript.label":"Superscript","keyboard.shortcut.tab":"Tab","extension.command.toggle-task-list.description":"Tasked list","ui.text-color.teal":"Teal","ui.text-color.teal.hue":["Teal ",["hue"]],"extension.command.set-text-color.label":"Text color","extension.command.set-text-highlight.label":"Text highlight","extension.command.toggle-whitespace.label":"Toggle Whitespace","ui.text-color.transparent":"Transparent","slrB1c":"Black","6QML30":"Blue","xw+keN":["Blue ",["hue"]],"38RHqP":"Cyan","D89yPf":["Cyan ",["hue"]],"VjBLnd":"Grape","Rp40yv":["Grape ",["hue"]],"5Dm9D1":"Gray","HGjXjC":["Gray ",["hue"]],"b9fz+n":"Green","18jo3M":["Green ",["hue"]],"CFzqCV":"Indigo","aVlDku":["Indigo ",["hue"]],"04PfLc":"Lime","KRTK6Y":["Lime ",["hue"]],"pSnXFd":"Orange","ve/MJZ":["Orange ",["hue"]],"OvCgDa":"Pink","l7NqyT":["Pink ",["hue"]],"IT9k0j":"Red","AdyJ7/":["Red ",["hue"]],"3D2UWc":"Teal","Dcq0Y1":["Teal ",["hue"]],"bsi2ik":"Transparent","Tj3PRR":"Violet","xxMH5N":["Violet ",["hue"]],"Rum0ah":"White","4gaw/Q":"Yellow","hhauc3":["Yellow ",["hue"]],"extension.command.toggle-underline.label":"Underline","extension.command.toggle-underline.description":"Underline the selected text","extension.command.undo.label":"Undo","extension.command.undo.description":"Undo the most recent action","extension.command.update-annotation.label":"Update annotation","ui.text-color.violet":"Violet","ui.text-color.violet.hue":["Violet ",["hue"]],"ui.text-color.white":"White","ui.text-color.yellow":"Yellow","ui.text-color.yellow.hue":["Yellow ",["hue"]]}'),nL={};Use(nL,Lse);oy.loadLocaleData("en",{plurals:nL.en});oy.load("en",Wse);oy.activate("en");var Hse=Object.defineProperty,Kse=Object.getOwnPropertyDescriptor,ek=(e,t,n,r)=>{for(var o=r>1?void 0:r?Kse(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Hse(t,n,o),o},au=class extends io{get name(){return"doc"}createNodeSpec(e,t){const{docAttributes:n,content:r}=this.options,o=ve();if(Tl(n))for(const[i,s]of Vt(n))o[i]={default:s};else for(const i of n)o[i]={default:null};return{attrs:o,content:r,...t}}setDocAttributes(e){return({tr:t,dispatch:n})=>{if(n){for(const[r,o]of Object.entries(e))t.step(new Xb(r,o));n(t)}return!0}}isDefaultDocNode({state:e=this.store.getState(),options:t}={}){return YS(e.doc,t)}};ek([he()],au.prototype,"setDocAttributes",1);ek([Et()],au.prototype,"isDefaultDocNode",1);au=ek([Ge({defaultOptions:{content:"block+",docAttributes:[]},defaultPriority:et.Medium,staticKeys:["content","docAttributes"],disableExtraAttributes:!0})],au);var rL="SetDocAttribute",oL="RevertSetDocAttribute",Xb=class Zb extends Ht{constructor(n,r,o=rL){super();_t(this,"key");_t(this,"stepType");_t(this,"value");_t(this,"previous");this.stepType=o,this.key=n,this.value=r}static fromJSON(n,r){return new Zb(r.key,r.value,r.stepType)}apply(n){this.previous=n.attrs[this.key];const r={...n.attrs,[this.key]:this.value};return Ot.ok(n.type.create(r,n.content,n.marks))}invert(){return new Zb(this.key,this.previous,oL)}map(){return this}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}};try{Ht.jsonID(rL,Xb),Ht.jsonID(oL,Xb)}catch(e){if(!e.message.startsWith("Duplicate use of step JSON ID"))throw e}var qse=Object.defineProperty,Gse=Object.getOwnPropertyDescriptor,iL=(e,t,n,r)=>{for(var o=r>1?void 0:r?Gse(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&qse(t,n,o),o};function Yse(e,t,n,r){const o=e.docView.posFromDOM(t,n,r);return o===null||o<0?null:o}function Jse(e,t){const n=t.target;if(n){const r=Yse(e,n,0);if(r!==null){const o=e.state.doc.resolve(r),i=o.node().isLeaf?0:1,s=o.start()-i;return{pos:r,inside:s}}}return e.posAtCoords({left:t.clientX,top:t.clientY})??void 0}var Ig=class extends ht{constructor(){super(...arguments),this.mousedown=!1,this.mouseover=!1,this.createMouseEventHandler=e=>(t,n)=>{const r=n,o=Jse(t,r);if(!o)return!1;const i=[],s=[],{inside:a,pos:l}=o;if(a===-1)return!1;const c=t.state.doc.resolve(l),u=c.depth+1;for(const d of G2(u,1))i.push({node:d>c.depth&&c.nodeAfter?c.nodeAfter:c.node(d),pos:c.before(d)});for(const{type:d}of c.marksAcross(c)??[]){const p=Hi(c,d);p&&s.push(p)}return e(r,{view:t,nodes:i,marks:s,getMark:d=>{const p=Te(d)?t.state.schema.marks[d]:d;return be(p,{code:J.EXTENSION,message:`The mark ${d} being checked does not exist within the editor schema.`}),s.find(h=>h.mark.type===p)},getNode:d=>{var p;const h=Te(d)?t.state.schema.nodes[d]:d;be(h,{code:J.EXTENSION,message:"The node being checked does not exist"});const m=i.find(({node:v})=>v.type===h);if(m)return{...m,isRoot:!!((p=i[0])!=null&&p.node.eq(m.node))}}})}}get name(){return"events"}onView(){var e,t;if(!((e=this.store.managerSettings.exclude)!=null&&e.clickHandler))for(const n of this.store.extensions){if(!n.createEventHandlers||(t=n.options.exclude)!=null&&t.clickHandler)continue;const r=n.createEventHandlers();for(const[o,i]of Vt(r))this.addHandler(o,i)}}createPlugin(){const e=new WeakMap,t=(n,r,o,i,s,a,l,c)=>{const u=this.store.currentState,{schema:d,doc:p}=u,h=p.resolve(i),m=e.has(l),v=Xse({$pos:h,handled:m,view:o,state:u});let x=!1;m||(x=n(l,v)||x);const b={...v,pos:i,direct:c,nodeWithPosition:{node:s,pos:a},getNode:w=>{const S=Te(w)?d.nodes[w]:w;return be(S,{code:J.EXTENSION,message:"The node being checked does not exist"}),S===s.type?{node:s,pos:a}:void 0}};return e.set(l,!0),r(l,b)||x};return{props:{handleKeyPress:(n,r)=>this.options.keypress(r)||!1,handleKeyDown:(n,r)=>this.options.keydown(r)||!1,handleTextInput:(n,r,o,i)=>this.options.textInput({from:r,to:o,text:i})||!1,handleClickOn:(n,r,o,i,s,a)=>t(this.options.clickMark,this.options.click,n,r,o,i,s,a),handleDoubleClickOn:(n,r,o,i,s,a)=>t(this.options.doubleClickMark,this.options.doubleClick,n,r,o,i,s,a),handleTripleClickOn:(n,r,o,i,s,a)=>t(this.options.tripleClickMark,this.options.tripleClick,n,r,o,i,s,a),handleDOMEvents:{focus:(n,r)=>this.options.focus(r)||!1,blur:(n,r)=>this.options.blur(r)||!1,mousedown:(n,r)=>(this.startMouseover(),this.options.mousedown(r)||!1),mouseup:(n,r)=>(this.endMouseover(),this.options.mouseup(r)||!1),mouseleave:(n,r)=>(this.mouseover=!1,this.options.mouseleave(r)||!1),mouseenter:(n,r)=>(this.mouseover=!0,this.options.mouseenter(r)||!1),keyup:(n,r)=>this.options.keyup(r)||!1,mouseout:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!1};return this.options.hover(n,o)||!1}),mouseover:this.createMouseEventHandler((n,r)=>{const o={...r,hovering:!0};return this.options.hover(n,o)||!1}),contextmenu:this.createMouseEventHandler((n,r)=>this.options.contextmenu(n,r)||!1),scroll:(n,r)=>this.options.scroll(r)||!1,copy:(n,r)=>this.options.copy(r)||!1,cut:(n,r)=>this.options.cut(r)||!1,paste:(n,r)=>this.options.paste(r)||!1}},view:n=>{let r=n.editable;const o=this.options;return{update(i){const s=i.editable;s!==r&&(o.editable(s),r=s)}}}}}isInteracting(){return this.mousedown&&this.mouseover}startMouseover(){this.mouseover=!0,!this.mousedown&&(this.mousedown=!0,this.store.document.documentElement.addEventListener("mouseup",()=>{this.endMouseover()},{once:!0}))}endMouseover(){this.mousedown&&(this.mousedown=!1,this.store.commands.emptyUpdate())}};iL([Et()],Ig.prototype,"isInteracting",1);Ig=iL([Ge({handlerKeys:["blur","focus","mousedown","mouseup","mouseenter","mouseleave","textInput","keypress","keyup","keydown","click","clickMark","doubleClick","doubleClickMark","tripleClick","tripleClickMark","contextmenu","hover","scroll","copy","cut","paste","editable"],handlerKeyOptions:{blur:{earlyReturnValue:!0},focus:{earlyReturnValue:!0},mousedown:{earlyReturnValue:!0},mouseleave:{earlyReturnValue:!0},mouseup:{earlyReturnValue:!0},click:{earlyReturnValue:!0},doubleClick:{earlyReturnValue:!0},tripleClick:{earlyReturnValue:!0},hover:{earlyReturnValue:!0},contextmenu:{earlyReturnValue:!0},scroll:{earlyReturnValue:!0},copy:{earlyReturnValue:!0},cut:{earlyReturnValue:!0},paste:{earlyReturnValue:!0}},defaultPriority:et.High})],Ig);function Xse(e){const{handled:t,view:n,$pos:r,state:o}=e,i={getMark:K2,markRanges:[],view:n,state:o};if(t)return i;for(const{type:s}of r.marksAcross(r)??[]){const a=Hi(r,s);a&&i.markRanges.push(a)}return i.getMark=s=>{const a=Te(s)?o.schema.marks[s]:s;return be(a,{code:J.EXTENSION,message:`The mark ${s} being checked does not exist within the editor schema.`}),i.markRanges.find(l=>l.mark.type===a)},i}class St extends ze{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return St.valid(r)?new St(r):ze.near(r)}content(){return ne.empty}eq(t){return t instanceof St&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new St(t.resolve(n.pos))}getBookmark(){return new tk(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!Zse(t)||!Qse(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&St.valid(t))return t;let o=t.pos,i=null;for(let s=t.depth;;s--){let a=t.node(s);if(n>0?t.indexAfter(s)<a.childCount:t.index(s)>0){i=a.child(n>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;o+=n;let l=t.doc.resolve(o);if(St.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Se.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=t.doc.resolve(o);if(St.valid(a))return a}return null}}}St.prototype.visible=!1;St.findFrom=St.findGapCursorFrom;ze.jsonID("gapcursor",St);class tk{constructor(t){this.pos=t}map(t){return new tk(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return St.valid(n)?new St(n):ze.near(n)}}function Zse(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function Qse(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function eae(){return new Ji({props:{decorations:oae,createSelectionBetween(e,t,n){return t.pos==n.pos&&St.valid(n)?new St(n):null},handleClick:nae,handleKeyDown:tae,handleDOMEvents:{beforeinput:rae}}})}const tae=BD({ArrowLeft:Th("horiz",-1),ArrowRight:Th("horiz",1),ArrowUp:Th("vert",-1),ArrowDown:Th("vert",1)});function Th(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,o,i){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof Pe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=St.findGapCursorFrom(a,t,l);return c?(o&&o(r.tr.setSelection(new St(c))),!0):!1}}function nae(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!St.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Se.isSelectable(e.state.doc.nodeAt(o.inside))?!1:(e.dispatch(e.state.tr.setSelection(new St(r))),!0)}function rae(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof St))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=B.empty;for(let s=r.length-1;s>=0;s--)o=B.from(r[s].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new ne(o,0,0));return i.setSelection(Pe.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function oae(e){if(!(e.selection instanceof St))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Ye.create(e.doc,[ft.widget(e.selection.head,t,{key:"gapcursor"})])}var iae=Object.defineProperty,sae=Object.getOwnPropertyDescriptor,aae=(e,t,n,r)=>{for(var o=r>1?void 0:r?sae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&iae(t,n,o),o},Qb=class extends ht{get name(){return"gapCursor"}createExternalPlugins(){return[eae()]}};Qb=aae([Ge({})],Qb);var Dg=200,rn=function(){};rn.prototype.append=function(t){return t.length?(t=rn.from(t),!this.length&&t||t.length<Dg&&this.leafAppend(t)||this.length<Dg&&t.leafPrepend(this)||this.appendInner(t)):this};rn.prototype.prepend=function(t){return t.length?rn.from(t).append(this):this};rn.prototype.appendInner=function(t){return new lae(this,t)};rn.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?rn.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};rn.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};rn.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};rn.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(t(i,s))},n,r),o};rn.from=function(t){return t instanceof rn?t:t&&t.length?new sL(t):rn.empty};var sL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new t(this.values.slice(o,i))},t.prototype.getInner=function(o){return this.values[o]},t.prototype.forEachInner=function(o,i,s,a){for(var l=i;l<s;l++)if(o(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(o,i,s,a){for(var l=i-1;l>=s;l--)if(o(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(o){if(this.length+o.length<=Dg)return new t(this.values.concat(o.flatten()))},t.prototype.leafPrepend=function(o){if(this.length+o.length<=Dg)return new t(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(rn);rn.empty=new sL([]);var lae=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,o,i,s){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(i,a),s)===!1||i>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(o,a),i,s)===!1)return!1},t.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},t.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new t(this.left,o)},t.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new t(o,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(rn);const cae=500;class So{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=t.tr,a,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){o||(o=this.remapping(r,p+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new cs(d.map));let h=d.step.map(o.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],c.push(new cs(m,void 0,void 0,c.length+u.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new So(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),p=new cs(t.mapping.maps[u],d,n),h;(h=l&&l.merge(p))&&(p=h,u?i.pop():a=a.slice(0,a.length-1)),i.push(p),n&&(s++,n=void 0),o||(l=p)}let c=s-r.depth;return c>dae&&(a=uae(a,c),s-=c),new So(a.append(i),s)}remapping(t,n){let r=new Mc;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=t?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},t,n),r}addMaps(t){return this.eventCount==0?this:new So(this.items.append(t.map(n=>new cs(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let l=n;this.items.forEach(p=>{let h=i.getMirror(--l);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(p.step){let v=t.steps[h].invert(t.docs[h]),x=p.selection&&p.selection.map(i.slice(l+1,h));x&&a++,r.push(new cs(m,v,x))}else r.push(new cs(m))},o);let c=[];for(let p=n;p<s;p++)c.push(new cs(i.maps[p]));let u=this.items.slice(0,o).append(c).append(r),d=new So(u,a);return d.emptyItemCount()>cae&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=t)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new cs(c.invert(),l,u),p,h=o.length-1;(p=o.length&&o[h].merge(d))?o[h]=p:o.push(d)}}else s.map&&r--},this.items.length,0),new So(rn.from(o.reverse()),i)}}So.empty=new So(rn.empty,0);function uae(e,t){let n;return e.forEach((r,o)=>{if(r.selection&&t--==0)return n=o,!1}),e.slice(n)}let cs=class aL{constructor(t,n,r,o){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new aL(n.getMap().invert(),n,this.selection)}}};class ws{constructor(t,n,r,o,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const dae=20;function fae(e,t,n,r){let o=n.getMeta(Ai),i;if(o)return o.historyState;n.getMeta(mae)&&(e=new ws(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(Ai))return s.getMeta(Ai).redo?new ws(e.done.addTransform(n,void 0,r,sm(t)),e.undone,zN(n.mapping.maps),e.prevTime,e.prevComposition):new ws(e.done,e.undone.addTransform(n,void 0,r,sm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!pae(n,e.prevRanges)),c=s?Dx(e.prevRanges,n.mapping):zN(n.mapping.maps);return new ws(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,sm(t)),So.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new ws(e.done.rebased(n,i),e.undone.rebased(n,i),Dx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ws(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Dx(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function pae(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&o>=t[i]&&(n=!0)}),n}function zN(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,o,i,s)=>t.push(i,s));return t}function Dx(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}function hae(e,t,n){let r=sm(t),o=Ai.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new ws(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(Ai,{redo:n,historyState:l})}let Lx=!1,$N=null;function sm(e){let t=e.plugins;if($N!=t){Lx=!1,$N=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){Lx=!0;break}}return Lx}const Ai=new Eu("history"),mae=new Eu("closeHistory");function gae(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ji({key:Ai,state:{init(){return new ws(So.empty,So.empty,null,0,-1)},apply(t,n,r){return fae(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,o=r=="historyUndo"?am:r=="historyRedo"?wd:null;return o?(n.preventDefault(),o(t.state,t.dispatch)):!1}}}})}function lL(e,t){return(n,r)=>{let o=Ai.getState(n);if(!o||(e?o.undone:o.done).eventCount==0)return!1;if(r){let i=hae(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const am=lL(!1,!0),wd=lL(!0,!0);function ew(e){let t=Ai.getState(e);return t?t.done.eventCount:0}function vae(e){let t=Ai.getState(e);return t?t.undone.eventCount:0}var yae=Object.defineProperty,xae=Object.getOwnPropertyDescriptor,Pl=(e,t,n,r)=>{for(var o=r>1?void 0:r?xae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&yae(t,n,o),o},ai=class extends ht{constructor(){super(...arguments),this.wrapMethod=(e,t)=>({state:n,dispatch:r,view:o})=>{const{getState:i,getDispatch:s}=this.options,a=pt(i)?i():n,l=pt(s)&&r?s():r,c=e(a,l,o);return t==null||t(c),c}}get name(){return"history"}createKeymap(){return{"Mod-y":bo.isMac?()=>!1:this.wrapMethod(wd,this.options.onRedo),"Mod-z":this.wrapMethod(am,this.options.onUndo),"Shift-Mod-z":this.wrapMethod(wd,this.options.onRedo)}}undoShortcut(e){return this.wrapMethod(am,this.options.onUndo)(e)}redoShortcut(e){return this.wrapMethod(wd,this.options.onRedo)(e)}createExternalPlugins(){const{depth:e,newGroupDelay:t}=this.options;return[gae({depth:e,newGroupDelay:t})]}undo(){return wN(this.wrapMethod(am,this.options.onUndo))}redo(){return wN(this.wrapMethod(wd,this.options.onRedo))}undoDepth(e=this.store.getState()){return ew(e)}redoDepth(e=this.store.getState()){return vae(e)}};Pl([Lr({shortcut:Z.Undo,command:"undo"})],ai.prototype,"undoShortcut",1);Pl([Lr({shortcut:Z.Redo,command:"redo"})],ai.prototype,"redoShortcut",1);Pl([he({disableChaining:!0,description:({t:e})=>e(wg.UNDO_DESCRIPTION),label:({t:e})=>e(wg.UNDO_LABEL),icon:"arrowGoBackFill"})],ai.prototype,"undo",1);Pl([he({disableChaining:!0,description:({t:e})=>e(wg.REDO_DESCRIPTION),label:({t:e})=>e(wg.REDO_LABEL),icon:"arrowGoForwardFill"})],ai.prototype,"redo",1);Pl([Et()],ai.prototype,"undoDepth",1);Pl([Et()],ai.prototype,"redoDepth",1);ai=Pl([Ge({defaultOptions:{depth:100,newGroupDelay:500,getDispatch:void 0,getState:void 0},staticKeys:["depth","newGroupDelay"],handlerKeys:["onUndo","onRedo"]})],ai);var bae=Object.defineProperty,wae=Object.getOwnPropertyDescriptor,iy=(e,t,n,r)=>{for(var o=r>1?void 0:r?wae(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&bae(t,n,o),o},Sae={icon:"paragraph",label:({t:e})=>e(Sg.INSERT_LABEL),description:({t:e})=>e(Sg.INSERT_DESCRIPTION)},kae={icon:"paragraph",label:({t:e})=>e(Sg.CONVERT_LABEL),description:({t:e})=>e(Sg.CONVERT_DESCRIPTION)},kl=class extends io{get name(){return"paragraph"}createTags(){return[De.LastNodeCompatible,De.TextBlock,De.Block,De.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",draggable:!1,...t,attrs:{...e.defaults()},parseDOM:[{tag:"p",getAttrs:n=>({...e.parse(n)})},...t.parseDOM??[]],toDOM:n=>["p",e.dom(n),0]}}convertParagraph(e={}){const{attrs:t,selection:n,preserveAttrs:r}=e;return this.store.commands.setBlockNodeType.original(this.type,t,n,r)}insertParagraph(e,t={}){const{selection:n,attrs:r}=t;return this.store.commands.insertNode.original(this.type,{content:e,selection:n,attrs:r})}shortcut(e){return this.convertParagraph()(e)}};iy([he(kae)],kl.prototype,"convertParagraph",1);iy([he(Sae)],kl.prototype,"insertParagraph",1);iy([Lr({shortcut:Z.Paragraph,command:"convertParagraph"})],kl.prototype,"shortcut",1);kl=iy([Ge({defaultPriority:et.Medium})],kl);function Mi(e,t,n){return Math.min(Math.max(e,n),t)}class Cae extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Sd=Cae;function nk(e){if(typeof e!="string")throw new Sd(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=jae.test(e)?Nae(e):e;const n=Oae.exec(t);if(n){const s=Array.from(n).slice(1);return[...s.slice(0,3).map(a=>parseInt(ep(a,2),16)),parseInt(ep(s[3]||"f",2),16)/255]}const r=Tae.exec(t);if(r){const s=Array.from(r).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,16)),parseInt(s[3]||"ff",16)/255]}const o=Mae.exec(t);if(o){const s=Array.from(o).slice(1);return[...s.slice(0,3).map(a=>parseInt(a,10)),parseFloat(s[3]||"1")]}const i=Pae.exec(t);if(i){const[s,a,l,c]=Array.from(i).slice(1).map(parseFloat);if(Mi(0,100,a)!==a)throw new Sd(e);if(Mi(0,100,l)!==l)throw new Sd(e);return[...Rae(s,a,l),Number.isNaN(c)?1:c]}throw new Sd(e)}function Eae(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const BN=e=>parseInt(e.replace(/_/g,""),36),_ae="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=BN(t.substring(0,3)),r=BN(t.substring(3)).toString(16);let o="";for(let i=0;i<6-r.length;i++)o+="0";return e[n]=`${o}${r}`,e},{});function Nae(e){const t=e.toLowerCase().trim(),n=_ae[Eae(t)];if(!n)throw new Sd(e);return`#${n}`}const ep=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),Oae=new RegExp(`^#${ep("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Tae=new RegExp(`^#${ep("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),Mae=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ep(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Pae=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,jae=/^[a-z]+$/i,VN=e=>Math.round(e*255),Rae=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(VN);const o=(e%360+360)%360/60,i=(1-Math.abs(2*r-1))*(t/100),s=i*(1-Math.abs(o%2-1));let a=0,l=0,c=0;o>=0&&o<1?(a=i,l=s):o>=1&&o<2?(a=s,l=i):o>=2&&o<3?(l=i,c=s):o>=3&&o<4?(l=s,c=i):o>=4&&o<5?(a=s,c=i):o>=5&&o<6&&(a=i,c=s);const u=r-i/2,d=a+u,p=l+u,h=c+u;return[d,p,h].map(VN)};function Aae(e){const[t,n,r,o]=nk(e).map((d,p)=>p===3?d:d/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2;if(i===s)return[0,0,a,o];const l=i-s,c=a>.5?l/(2-i-s):l/(i+s);return[60*(t===i?(n-r)/l+(n<r?6:0):n===i?(r-t)/l+2:(t-n)/l+4),c,a,o]}function Iae(e,t,n,r){return`hsla(${(e%360).toFixed()}, ${Mi(0,100,t*100).toFixed()}%, ${Mi(0,100,n*100).toFixed()}%, ${parseFloat(Mi(0,1,r).toFixed(3))})`}function Cr(e,t){const[n,r,o,i]=Aae(e);return Iae(n,r,o-t,i)}function Dae(e){if(e==="transparent")return 0;function t(i){const s=i/255;return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}const[n,r,o]=nk(e);return .2126*t(n)+.7152*t(r)+.0722*t(o)}function Lae(e,t,n,r){return`rgba(${Mi(0,255,e).toFixed()}, ${Mi(0,255,t).toFixed()}, ${Mi(0,255,n).toFixed()}, ${parseFloat(Mi(0,1,r).toFixed(3))})`}function lm(e,t){return Cr(e,-t)}function Lg(e,t){const[n,r,o,i]=nk(e);return Lae(n,r,o,i-t)}function Fae(e){return Dae(e)>.179}function Ac(e){return Fae(e)?"#000":"#fff"}const zae="remirror-editor-wrapper",$ae="remirror-button-active",Bae="remirror-button",Vae="remirror-composite",Uae="remirror-dialog",Wae="remirror-dialog-backdrop",Hae="remirror-form",Kae="remirror-form-message",qae="remirror-form-label",Gae="remirror-form-group",Yae="remirror-group",Jae="remirror-input",Xae="remirror-menu",Zae="remirror-menu-pane",Qae="remirror-menu-pane-active",ele="remirror-menu-dropdown-label",tle="remirror-menu-pane-icon",nle="remirror-menu-pane-label",rle="remirror-menu-pane-shortcut",ole="remirror-menu-button-left",ile="remirror-menu-button-right",sle="remirror-menu-button-nested-left",ale="remirror-menu-button-nested-right",lle="remirror-menu-button",cle="remirror-menu-bar",ule="remirror-flex-column",dle="remirror-flex-row",fle="remirror-menu-item",ple="remirror-menu-item-row",hle="remirror-menu-item-column",mle="remirror-menu-item-checkbox",gle="remirror-menu-item-radio",vle="remirror-menu-group",yle="remirror-floating-popover",xle="remirror-popover",ble="remirror-animated-popover",wle="remirror-role",Sle="remirror-separator",kle="remirror-tab",Cle="remirror-tab-list",Ele="remirror-tabbable",_le="remirror-toolbar",Nle="remirror-tooltip",Ole="remirror-table-size-editor",Tle="remirror-table-size-editor-body",Mle="remirror-table-size-editor-cell",Ple="remirror-table-size-editor-cell-selected",jle="remirror-table-size-editor-footer",Rle="remirror-color-picker",Ale="remirror-color-picker-cell",Ile="remirror-color-picker-cell-selected";var Dle=Object.freeze({__proto__:null,ANIMATED_POPOVER:ble,BUTTON:Bae,BUTTON_ACTIVE:$ae,COLOR_PICKER:Rle,COLOR_PICKER_CELL:Ale,COLOR_PICKER_CELL_SELECTED:Ile,COMPOSITE:Vae,DIALOG:Uae,DIALOG_BACKDROP:Wae,EDITOR_WRAPPER:zae,FLEX_COLUMN:ule,FLEX_ROW:dle,FLOATING_POPOVER:yle,FORM:Hae,FORM_GROUP:Gae,FORM_LABEL:qae,FORM_MESSAGE:Kae,GROUP:Yae,INPUT:Jae,MENU:Xae,MENU_BAR:cle,MENU_BUTTON:lle,MENU_BUTTON_LEFT:ole,MENU_BUTTON_NESTED_LEFT:sle,MENU_BUTTON_NESTED_RIGHT:ale,MENU_BUTTON_RIGHT:ile,MENU_DROPDOWN_LABEL:ele,MENU_GROUP:vle,MENU_ITEM:fle,MENU_ITEM_CHECKBOX:mle,MENU_ITEM_COLUMN:hle,MENU_ITEM_RADIO:gle,MENU_ITEM_ROW:ple,MENU_PANE:Zae,MENU_PANE_ACTIVE:Qae,MENU_PANE_ICON:tle,MENU_PANE_LABEL:nle,MENU_PANE_SHORTCUT:rle,POPOVER:xle,ROLE:wle,SEPARATOR:Sle,TAB:kle,TABBABLE:Ele,TABLE_SIZE_EDITOR:Ole,TABLE_SIZE_EDITOR_BODY:Tle,TABLE_SIZE_EDITOR_CELL:Mle,TABLE_SIZE_EDITOR_CELL_SELECTED:Ple,TABLE_SIZE_EDITOR_FOOTER:jle,TAB_LIST:Cle,TOOLBAR:_le,TOOLTIP:Nle});const Lle="remirror-image-loader";var Fle=Object.freeze({__proto__:null,IMAGE_LOADER:Lle});const zle="remirror-list-item-with-custom-mark",$le="remirror-ul-list-content",Ble="remirror-editor",Vle="remirror-list-item-marker-container",Ule="remirror-list-item-checkbox",Wle="remirror-collapsible-list-item-closed",Hle="remirror-collapsible-list-item-button",Kle="remirror-list-spine";var ha=Object.freeze({__proto__:null,COLLAPSIBLE_LIST_ITEM_BUTTON:Hle,COLLAPSIBLE_LIST_ITEM_CLOSED:Wle,EDITOR:Ble,LIST_ITEM_CHECKBOX:Ule,LIST_ITEM_MARKER_CONTAINER:Vle,LIST_ITEM_WITH_CUSTOM_MARKER:zle,LIST_SPINE:Kle,UL_LIST_CONTENT:$le});const qle="remirror-is-empty";var Gle=Object.freeze({__proto__:null,IS_EMPTY:qle});const Yle="remirror-editor",Jle="remirror-positioner",Xle="remirror-positioner-widget";var Zle=Object.freeze({__proto__:null,EDITOR:Yle,POSITIONER:Jle,POSITIONER_WIDGET:Xle});const fo={gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},Pi="#000000",rk="#ffffff",Qle="#252103",ok=Lg(Pi,.75),sy="#7963d2",ik="#bcd263",ece="#fff",tce="#fff",sk=fo.gray[1],UN="rgba(10,31,68,0.08)",WN="rgba(10,31,68,0.10)",HN="rgba(10,31,68,0.12)",nce=lm(Lg(Pi,.1),.13),ak={background:rk,border:ok,foreground:Pi,muted:sk,primary:sy,secondary:ik,primaryText:ece,secondaryText:tce,text:Qle,faded:nce},rce={...ak,background:Cr(rk,.15),border:Cr(ok,.15),foreground:Cr(Pi,.15),muted:Cr(sk,.15),primary:Cr(sy,.15),secondary:Cr(ik,.15),get text(){return Ac(this.background)},get primaryText(){return Ac(this.primary)},get secondaryText(){return Ac(this.secondary)}},oce={...ak,background:Cr(rk,.075),border:Cr(ok,.075),foreground:Cr(Pi,.075),muted:Cr(sk,.075),primary:Cr(sy,.075),secondary:Cr(ik,.075),get text(){return Ac(this.background)},get primaryText(){return Ac(this.primary)},get secondaryText(){return Ac(this.secondary)}};({...ak,backdrop:Lg(Pi,.1),outline:Lg(sy,.6),table:(lm(Pi,.8),lm(Pi,.4),fo.gray[3],fo.blue[7],fo.blue[1],fo.blue[5],fo.blue[7],lm(Pi,.4),fo.blue[5],fo.red[7],fo.red[1],fo.red[5])},`${UN}`,`${WN}`,`${HN}`);var ice=Object.defineProperty,sce=Object.getOwnPropertyDescriptor,lk=(e,t,n,r)=>{for(var o=r>1?void 0:r?sce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&ice(t,n,o),o},cL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},It=(e,t,n)=>(cL(e,t,"read from private field"),n?n.call(e):t.get(e)),mi=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},us=(e,t,n,r)=>(cL(e,t,"write to private field"),t.set(e,n),n),kd,Cd,nc,Ed,cm,_d,Nd,Od,Td,um=class{constructor(e){mi(this,kd,Vv()),mi(this,Cd,[]),mi(this,nc,new Map),mi(this,Ed,[]),mi(this,cm,!1),mi(this,_d,void 0),mi(this,Nd,void 0),mi(this,Od,void 0),mi(this,Td,void 0),this.addListener=(t,n)=>It(this,kd).on(t,n),us(this,_d,e),us(this,Nd,e.getActive),us(this,Td,e.getPosition),us(this,Od,e.getID),this.hasChanged=e.hasChanged,this.events=e.events??["state","scroll"]}static create(e){return new um(e)}static fromPositioner(e,t){return um.create({...e.basePositioner,...t})}get basePositioner(){return{getActive:It(this,Nd),getPosition:It(this,Td),hasChanged:this.hasChanged,events:this.events,getID:It(this,Od)}}onActiveChanged(e){this.recentUpdate=e;const t=It(this,Nd).call(this,e);us(this,Cd,t),us(this,nc,new Map),us(this,cm,!1),us(this,Ed,[]);const n=[];for(const[r,o]of t.entries()){const i=this.getID(o,r);It(this,Ed).push(i),n.push({setElement:s=>this.addProps({...e,data:o,element:s},r),id:i,data:o})}It(this,kd).emit("update",n)}getID(e,t){var n;return((n=It(this,Od))==null?void 0:n.call(this,e,t))??t.toString()}addProps(e,t){if(It(this,cm)||(It(this,nc).set(t,e),It(this,nc).size<It(this,Cd).length))return;const n=[];for(const r of It(this,Cd).keys()){const o=It(this,nc).get(r);be(o,{code:J.INTERNAL,message:"Something went wrong when retrieving the parameters"});const i=It(this,Ed)[r];if(!i)return;n.push({position:It(this,Td).call(this,o),element:o.element,id:i})}It(this,kd).emit("done",n)}clone(e){return um.create({...It(this,_d),...pt(e)?e(It(this,_d)):e})}active(e){const t=pt(e)?e:()=>e;return this.clone(n=>({getActive:r=>n.getActive(r).filter(t)}))}},Oo=um;kd=new WeakMap;Cd=new WeakMap;nc=new WeakMap;Ed=new WeakMap;cm=new WeakMap;_d=new WeakMap;Nd=new WeakMap;Od=new WeakMap;Td=new WeakMap;Oo.EMPTY=[];function ace(e,t=pL){const{key:n}=(e==null?void 0:e.getMeta(fL))??{};return n===t}function uL(e){const{tr:t,state:n,previousState:r}=e;return!r||t&&ace(t)?!0:t?iee(t):!n.doc.eq(r.doc)||!n.selection.eq(r.selection)}function dL(e,t,n={}){const r=t.getBoundingClientRect(),{accountForPadding:o=!1}=n;let i=0,s=0,a=0,l=0;if(si(t)&&o){const u=Number.parseFloat(ls(t,"padding-left").replace("px","")),d=Number.parseFloat(ls(t,"padding-right").replace("px","")),p=Number.parseFloat(ls(t,"padding-top").replace("px","")),h=Number.parseFloat(ls(t,"padding-bottom").replace("px","")),m=Number.parseFloat(ls(t,"border-left").replace("px","")),v=Number.parseFloat(ls(t,"border-right").replace("px","")),x=Number.parseFloat(ls(t,"border-top").replace("px","")),b=Number.parseFloat(ls(t,"border-bottom").replace("px","")),w=t.offsetWidth-t.clientWidth,S=t.offsetHeight-t.clientHeight;i+=u+m+(t.dir==="rtl"?w:0),s+=d+v+(t.dir==="rtl"?0:w),a+=p+x,l+=h+b+S}const c=new DOMRect(r.left+i,r.top+a,r.width-s,r.height-l);for(const[u,d]of[[e.top,e.left],[e.top,e.right],[e.bottom,e.left],[e.bottom,e.right]])if(f_(u,c.top,c.bottom)&&f_(d,c.left,c.right))return!0;return!1}var lce="remirror-positioner-widget",fL="positionerUpdate",pL="__all_positioners__",hL={y:-999999,x:-999999,width:0,height:0},KN={...hL,left:-999999,top:-999999,bottom:-999999,right:-999999},cce={...hL,rect:{...KN,toJSON:()=>KN},visible:!1},uce=Oo.create({hasChanged:uL,getActive(e){const{state:t}=e;if(!KS(t)||t.selection.$anchor.depth>2)return Oo.EMPTY;const n=Jv({predicate:r=>r.type.isBlock,selection:t});return n?[n]:Oo.EMPTY},getPosition(e){const{view:t,data:n}=e,r=t.nodeDOM(n.pos);if(!si(r))return cce;const o=r.getBoundingClientRect(),i=t.dom.getBoundingClientRect(),s=o.height,a=o.width,l=t.dom.scrollLeft+o.left-i.left,c=t.dom.scrollTop+o.top-i.top,u=dL(o,t.dom);return{y:c,x:l,height:s,width:a,rect:o,visible:u}}}),mL=uce.clone(({getActive:e})=>({getActive:t=>{const[n]=e(t);return n&&JS(n.node)&&n.node.type===Qv(t.state.schema)?[n]:Oo.EMPTY}}));mL.clone(({getPosition:e})=>({getPosition:t=>({...e(t),width:1})}));mL.clone(({getPosition:e})=>({getPosition:t=>{const{width:n,x:r,y:o,height:i}=e(t);return{...e(t),width:1,x:n+r,rect:new DOMRect(n+r,o,1,i)}}}));function ck(e){return Oo.create({hasChanged:uL,getActive:t=>{const{state:n,view:r}=t;if(!e(n)||!Ml(n.selection))return Oo.EMPTY;try{const{head:o,anchor:i}=n.selection;return[{from:r.coordsAtPos(i),to:r.coordsAtPos(o)}]}catch{return Oo.EMPTY}},getPosition(t){const{element:n,data:r,view:o}=t,{from:i,to:s}=r,a=n.offsetParent??o.dom,l=a.getBoundingClientRect(),c=Math.abs(s.bottom-i.top),u=c>i.bottom-i.top,d=Math.min(i.left,s.left),p=Math.min(i.top,s.top),h=a.scrollLeft+(u?s.left-l.left:d-l.left),m=a.scrollTop+p-l.top,v=u?1:Math.abs(i.left-s.right),x=new DOMRect(u?s.left:d,p,v,c),b=dL(x,o.dom);return{rect:x,y:m,x:h,height:c,width:v,visible:b}}})}var dce=ck(e=>!e.selection.empty);ck(e=>e.selection.empty);ck(()=>!0);dce.clone(()=>({getActive:e=>{const{state:t,view:n}=e;if(!t.selection.empty)return Oo.EMPTY;const r=CD(t);if(!r)return Oo.EMPTY;try{return[{from:n.coordsAtPos(r.from),to:n.coordsAtPos(r.to)}]}catch{return Oo.EMPTY}}}));var tp=class extends ht{constructor(){super(...arguments),this.positioners=[],this.onAddCustomHandler=({positioner:e})=>{if(e)return this.positioners=[...this.positioners,e],this.store.commands.forceUpdate(),()=>{this.positioners=this.positioners.filter(t=>t!==e)}}}get name(){return"positioner"}createAttributes(){return{class:Zle.EDITOR}}init(){this.onScroll=tJ(this.options.scrollDebounce,this.onScroll.bind(this))}createEventHandlers(){return{scroll:()=>(this.onScroll(),!1),hover:(e,t)=>(this.positioner(this.getBaseProps("hover",{hover:t})),!1),contextmenu:(e,t)=>(this.positioner(this.getBaseProps("contextmenu",{contextmenu:t})),!1)}}onStateUpdate(e){this.positioner({...e,previousState:e.firstUpdate?void 0:e.previousState,event:"state",helpers:this.store.helpers})}createDecorations(e){if(this.element??(this.element=this.createElement()),!this.element.hasChildNodes())return Ye.empty;const t=ft.widget(0,this.element,{key:"positioner-widget",side:-1,stopEvent:()=>!0});return Ye.create(e.doc,[t])}forceUpdatePositioners(e=pL){return({tr:t,dispatch:n})=>(n==null||n(t.setMeta(fL,{key:e})),!0)}getPositionerWidget(){return this.element??(this.element=this.createElement())}createElement(){const e=document.createElement("span");return e.dataset.id=lce,e.setAttribute("role","presentation"),e}triggerPositioner(e,t){e.hasChanged(t)&&e.onActiveChanged({...t,view:this.store.view})}positioner(e){for(const t of this.positioners)t.events.includes(e.event)&&this.triggerPositioner(t,e)}getBaseProps(e,t){const n=this.store.getState(),r=this.store.previousState;return{helpers:this.store.helpers,event:e,firstUpdate:!1,previousState:r,state:n,...t}}onScroll(){this.positioner(this.getBaseProps("scroll",{scroll:{scrollTop:this.store.view.dom.scrollTop}}))}};lk([he()],tp.prototype,"forceUpdatePositioners",1);lk([Et()],tp.prototype,"getPositionerWidget",1);tp=lk([Ge({defaultOptions:{scrollDebounce:100},customHandlerKeys:["positioner"],staticKeys:["scrollDebounce"]})],tp);var fce=Object.defineProperty,pce=Object.getOwnPropertyDescriptor,hce=(e,t,n,r)=>{for(var o=r>1?void 0:r?pce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&fce(t,n,o),o},tw=class extends io{get name(){return"text"}createTags(){return[De.InlineNode]}createNodeSpec(){return{}}};tw=hce([Ge({disableExtraAttributes:!0,defaultPriority:et.Medium})],tw);var mce={...au.defaultOptions,...kl.defaultOptions,...ai.defaultOptions,excludeExtensions:[]};function gce(e={}){e={...mce,...e};const{content:t,depth:n,getDispatch:r,getState:o,newGroupDelay:i,excludeExtensions:s}=e,a={};for(const c of s??[])a[c]=!0;const l=[];if(!a.history){const c=new ai({depth:n,getDispatch:r,getState:o,newGroupDelay:i});l.push(c)}return a.doc||l.push(new au({content:t})),a.text||l.push(new tw),a.paragraph||l.push(new kl),a.positioner||l.push(new tp),a.gapCursor||l.push(new Qb),a.events||l.push(new Ig),l}var vce=Object.defineProperty,yce=Object.getOwnPropertyDescriptor,xce=(e,t,n,r)=>{for(var o=r>1?void 0:r?yce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&vce(t,n,o),o},Cl=class extends ht{get name(){return"placeholder"}createAttributes(){return{"aria-placeholder":this.options.placeholder}}createPlugin(){return{state:{init:(e,t)=>({...this.options,empty:YS(t.doc,{ignoreAttributes:!0})}),apply:(e,t,n,r)=>bce({pluginState:t,tr:e,extension:this,state:r})},props:{decorations:e=>wce({state:e,extension:this})}}}onSetOptions(e){const{changes:t}=e;t.placeholder.changed&&this.store.phase>=Yn.EditorView&&this.store.updateAttributes()}};Cl=xce([Ge({defaultOptions:{emptyNodeClass:Gle.IS_EMPTY,placeholder:""}})],Cl);function bce(e){const{pluginState:t,extension:n,tr:r,state:o}=e;return r.docChanged?{...n.options,empty:YS(o.doc)}:t}function wce(e){const{extension:t,state:n}=e,{empty:r}=t.pluginKey.getState(n),{emptyNodeClass:o,placeholder:i}=t.options;if(!r)return null;const s=[];return n.doc.descendants((a,l)=>{const c=ft.node(l,l+a.nodeSize,{class:o,"data-placeholder":i});s.push(c)}),Ye.create(n.doc,s)}var Sce=Object.defineProperty,kce=Object.getOwnPropertyDescriptor,Cce=(e,t,n,r)=>{for(var o=r>1?void 0:r?kce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Sce(t,n,o),o},Ece={...Cl.defaultOptions,...Qf.defaultOptions},_ce=[...Cl.staticKeys,...Qf.staticKeys],np=class extends ht{get name(){return"react"}onSetOptions(e){const{pickChanged:t}=e;this.getExtension(Cl).setOptions(t(["placeholder"]))}createExtensions(){const{emptyNodeClass:e,placeholder:t,defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s}=this.options;return[new Cl({emptyNodeClass:e,placeholder:t,priority:et.Low}),new Qf({defaultBlockNode:n,defaultContentNode:r,defaultEnvironment:o,defaultInlineNode:i,nodeViewComponents:s})]}};np=Cce([Ge({defaultOptions:Ece,staticKeys:_ce})],np);var gL={};Object.defineProperty(gL,"__esModule",{value:!0});function Nce(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length===2)return GN(e[0],e[1])||null;var n=e.slice(1).reduce(function(r,o){return GN(r,o)},e[0]);return n||null}var Ju=gL.default=Nce,qN=new WeakMap;function GN(e,t){if(e&&t){var n=qN.get(e)||new WeakMap;qN.set(e,n);var r=n.get(t)||function(o){YN(e,o),YN(t,o)};return n.set(t,r),r}return e||t}function YN(e,t){typeof e=="function"?e(t):e.current=t}var vL=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Fx=(e,t,n)=>(vL(e,t,"read from private field"),t.get(e)),Oce=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Tce=(e,t,n,r)=>(vL(e,t,"write to private field"),t.set(e,n),n);function Mce(){const[,e]=g.useState(ve());return g.useCallback(()=>{e(ve())},[])}var yL=g.createContext(null);function ay(e){const t=g.useContext(yL),n=g.useRef(Mce());be(t,{code:J.REACT_PROVIDER_CONTEXT});const{addHandler:r}=t;return g.useEffect(()=>{let o=e;if(o){if(Tl(o)){const{autoUpdate:i}=o;o=i?()=>n.current():void 0}if(pt(o))return r("updated",o)}},[r,e]),t}function Pce(e=!0){return ay({autoUpdate:e}).active}function jce(e=!1){return ay(e?{autoUpdate:!0}:void 0).attrs}function xL(){return ay().chain.new()}var[Rce,Tpe]=Tne(({props:e})=>{const t=e.locale??"en",n=e.i18n??oy,r=e.supportedLocales??[t],o=n._.bind(n);return{locale:t,i18n:n,supportedLocales:r,t:o}});function JN(e,t={}){const{core:n,react:r,...o}=t;return hne(e)?e:pne.create(()=>[...Y2(e),new np(r),...gce(n)],o)}function Ace(e,t={}){const n=g.useRef(e),r=g.useRef(t),[o,i]=g.useState(()=>JN(e,t));return n.current=e,r.current=t,g.useEffect(()=>o.addHandler("destroy",()=>{i(()=>JN(n.current,r.current))}),[o]),o}var Ice=typeof Ju=="object"&&Ju.__esModule&&Ju.default?Ju.default:Ju,rc,Dce=class extends lne{constructor(e){if(super(e),Oce(this,rc,void 0),this.rootPropsConfig={called:!1,count:0},this.getRootProps=t=>this.internalGetRootProps(t,null),this.internalGetRootProps=(t,n)=>{this.rootPropsConfig.called=!0;const{refKey:r="ref",ref:o,...i}=t??ve();return{[r]:Ice(o,this.onRef),key:this.uid,...i,children:n}},this.onRef=t=>{t&&(this.rootPropsConfig.count+=1,be(this.rootPropsConfig.count<=1,{code:J.REACT_GET_ROOT_PROPS,message:`Called ${this.rootPropsConfig.count} times`}),Tce(this,rc,t),this.onRefLoad())},this.manager.view){this.manager.view.setProps({state:this.manager.view.state,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0});return}this.manager.getExtension(Cl).setOptions({placeholder:this.props.placeholder??""})}get name(){return"react"}update(e){return super.update(e),this}createView(e){return new _Q(null,{state:e,dispatchTransaction:this.dispatchTransaction,attributes:()=>this.getAttributes(),editable:()=>this.props.editable??!0,plugins:[]})}updateState({state:e,...t}){const{triggerChange:n=!0,tr:r,transactions:o}=t;if(this.props.state){const{onChange:i}=this.props;be(i,{code:J.REACT_CONTROLLED,message:"You are required to provide the `onChange` handler when creating a controlled editor."}),be(n,{code:J.REACT_CONTROLLED,message:"Controlled editors do not support `clearContent` or `setContent` where `triggerChange` is `true`. Update the `state` prop instead."}),this.previousStateOverride||(this.previousStateOverride=this.getState()),this.onChange({state:e,tr:r,transactions:o});return}!r&&!o&&(e=e.apply(e.tr.setMeta(a_,{}))),this.view.updateState(e),n&&(o==null?void 0:o.length)!==0&&this.onChange({state:e,tr:r,transactions:o}),this.manager.onStateUpdate({previousState:this.previousState,state:e,tr:r,transactions:o})}updateControlledState(e,t){this.previousStateOverride=t,e=e.apply(e.tr.setMeta(a_,{})),this.view.updateState(e),this.manager.onStateUpdate({previousState:this.previousState,state:e}),this.previousStateOverride=void 0}addProsemirrorViewToDom(e,t){this.props.insertPosition==="start"?e.insertBefore(t,e.firstChild):e.append(t)}onRefLoad(){be(Fx(this,rc),{code:J.REACT_EDITOR_VIEW,message:"Something went wrong when initializing the text editor. Please check your setup."});const{autoFocus:e}=this.props;this.addProsemirrorViewToDom(Fx(this,rc),this.view.dom),e&&this.focus(e),this.onChange(),this.addFocusListeners()}onUpdate(){this.view&&Fx(this,rc)&&this.view.setProps({...this.view.props,editable:()=>this.props.editable??!0})}get frameworkOutput(){return{...this.baseOutput,getRootProps:this.getRootProps,portalContainer:this.manager.store.portalContainer}}resetRender(){this.rootPropsConfig.called=!1,this.rootPropsConfig.count=0}};rc=new WeakMap;var bL=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Lce(e){const t=g.useRef();return bL(()=>{t.current=e}),t.current}function Fce(e){const{manager:t,state:n}=e,{placeholder:r,editable:o}=e;g.useRef(!0).current&&!ua(r)&&t.getExtension(np).setOptions({placeholder:r}),g.useEffect(()=>{r!=null&&t.getExtension(np).setOptions({placeholder:r})},[r,t]);const[s]=g.useState(()=>{if(n)return n;const l=t.createEmptyDoc(),[c,u]=Wt(e.initialContent)?e.initialContent:[e.initialContent??l];return t.createState({content:c,selection:u})}),a=zce({initialEditorState:s,getProps:()=>e});return g.useEffect(()=>()=>{a.destroy()},[a]),g.useEffect(()=>{a.onUpdate()},[o,a]),$ce(a),a.frameworkOutput}function zce(e){const t=g.useRef(e);t.current=e;const n=g.useMemo(()=>new Dce(t.current),[]);return n.update(e),n}function $ce(e){const{state:t}=e.props,n=g.useRef(!!t),r=Lce(t);bL(()=>{const o=t?n.current===!0:n.current===!1;be(o,{code:J.REACT_CONTROLLED,message:n.current?"You have attempted to switch from a controlled to an uncontrolled editor. Once you set up an editor as a controlled editor it must always provide a `state` prop.":"You have provided a `state` prop to an uncontrolled editor. In order to set up your editor as controlled you must provide the `state` prop from the very first render."}),!(!t||t===r)&&e.updateControlledState(t,r??void 0)},[t,r,e])}function Bce(e={}){const{content:t,document:n,selection:r,extensions:o,...i}=e,s=Ace(o??(()=>[]),i),[a,l]=g.useState(()=>s.createState({selection:r,content:t??s.createEmptyDoc()})),c=g.useCallback(({state:d})=>{l(d)},[]),u=g.useCallback(()=>s.output,[s]);return g.useMemo(()=>({state:a,setState:l,manager:s,onChange:c,getContext:u}),[u,s,c,a])}var nw=()=>ye.createElement("div",{className:Dle.EDITOR_WRAPPER,...ay().getRootProps()}),Vce=e=>(e.hook(),null);function Uce(e){const{children:t,autoRender:n,i18n:r,locale:o,supportedLocales:i,hooks:s=[],...a}=e,l=Fce(a),c=bne(l.portalContainer),u=n==="start"||n===!0||!t&&ua(n),d=n==="end";return ye.createElement(Rce,{i18n:r,locale:o,supportedLocales:i},ye.createElement(yL.Provider,{value:l},ye.createElement(xne,{portals:c}),s.map((p,h)=>ye.createElement(Vce,{hook:p,key:h})),u&&ye.createElement(nw,null),t,d&&ye.createElement(nw,null)))}function Wce(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return Hce(a,s,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function Hce(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=s.resolve(t.start-2);i=new xl(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new xl(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let a=MS(i,n,r,t);return a?(e&&Kce(e,t,a,o,n),!0):!1}function Kce(e,t,n,r,o){let i=B.empty;for(let u=n.length-1;u>=0;u--)i=B.from(n[u].type.create(n[u].attrs,i));e.step(new Tt(t.start-(r?2:0),t.end,t.start,t.end,new ne(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,p=!0;u<d;u++,p=!1)!p&&Pc(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function qce(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?Gce(t,n,e,i):Yce(t,n,i):!0:!1}}function Gce(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Tt(i-1,s,i,s,new ne(B.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new xl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Cu(r);if(a==null)return!1;o.lift(r,a);let l=o.mapping.map(i,-1)-1;return Bp(o.doc,l)&&o.join(l),t(o.scrollIntoView()),!0}function Yce(e,t,n){let r=e.tr,o=n.parent;for(let h=n.end,m=n.endIndex-1,v=n.startIndex;m>v;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?B.empty:B.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new Tt(d-(a?1:0),p+(l?1:0),d+1,p-1,new ne((a?B.empty:B.from(o.copy(B.empty))).append(l?B.empty:B.from(o.copy(B.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}var Jce=Object.defineProperty,Xce=Object.getOwnPropertyDescriptor,so=(e,t,n,r)=>{for(var o=r>1?void 0:r?Xce(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Jce(t,n,o),o};function rw(e){var t;return!!((t=e.spec.group)!=null&&t.includes(De.ListContainerNode))}function Zce(e){var t;return!!((t=e.spec.group)!=null&&t.includes(De.ListItemNode))}function ma(e){return rw(e.type)}function Xs(e){return Zce(e.type)}function uk(e,t){return n=>{const{dispatch:r,tr:o}=n,i=WS(o,n.state),{$from:s,$to:a}=o.selection,l=s.blockRange(a);if(!l)return!1;const c=Jv({predicate:u=>rw(u.type),selection:o.selection});if(c&&l.depth-c.depth<=1&&l.startIndex===0){if(c.node.type===e)return kL(t)(n);if(rw(c.node.type))return e.validContent(c.node.content)?(r==null||r(o.setNodeMarkup(c.pos,e)),!0):Qce(o,c,e,t)?(r==null||r(o.scrollIntoView()),!0):!1}return Wce(e)(i,r)}}function wL(e,t=["checked"]){return function({tr:n,dispatch:r,state:o}){var h,m;const i=dee(e,o.schema),{$from:s,$to:a}=n.selection;if(Zv(n.selection)&&n.selection.node.isBlock||s.depth<2||!s.sameParent(a))return!1;const l=s.node(-1);if(l.type!==i)return!1;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==i||s.index(-2)!==s.node(-2).childCount-1)return!1;if(r){const v=s.index(-1)>0;let x=B.empty;for(let S=s.depth-(v?1:2);S>=s.depth-3;S--)x=B.from(s.node(S).copy(x));const b=((h=i.contentMatch.defaultType)==null?void 0:h.createAndFill())||void 0;x=x.append(B.from(i.createAndFill(null,b)||void 0));const w=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3;n.replace(s.before(v?void 0:-1),s.after(-w),new ne(x,v?3:2,2)),n.setSelection(n.selection.constructor.near(n.doc.resolve(s.pos+(v?3:2)))),r(n.scrollIntoView())}return!0}if(l.attrs.closed&&s.sameParent(a)&&a.pos===a.end()){if(r){const v=s.after(-1),x=((m=i.contentMatch.defaultType)==null?void 0:m.createAndFill())||void 0,b=i.createAndFill(null,x);b&&(n.insert(v,b),n.setSelection(Pe.near(n.doc.resolve(v+1)))),n.delete(s.pos,a.pos),r(n.scrollIntoView())}return!0}const c=Object.fromEntries(Object.entries(l.attrs).filter(([v])=>!t.includes(v))),u=a.pos===s.end()?l.contentMatchAt(0).defaultType:null,d={...s.node().attrs};n.delete(s.pos,a.pos);const p=u?[{type:i,attrs:c},{type:u,attrs:d}]:[{type:i,attrs:c}];return Pc(n.doc,s.pos,2)?(r&&r(n.split(s.pos,2,p).scrollIntoView()),!0):!1}}function Qce(e,t,n,r){const o=t.node,i=e.doc.resolve(t.start),s=i.node(-1),a=i.index(-1);if(!s||!s.canReplace(a,a+1,B.from(n.create())))return!1;const l=[];for(let h=0;h<o.childCount;h++){const m=o.child(h);if(!r.validContent(m.content))return!1;const v=r.createChecked(null,m.content);l.push(v)}const c=n.createChecked(null,l),u=t.pos,d=u+o.nodeSize,p=e.selection.from;return e.replaceRangeWith(u,d,c),e.setSelection(e.selection.constructor.near(e.doc.resolve(p))),!0}function eue({listType:e,itemType:t,tr:n,range:r}){var l;const o=r.parent,i=n.doc.slice(r.start,r.end);if(o.type===e&&((l=i.content.firstChild)==null?void 0:l.type)===t)return!1;const s=[];for(let c=0;c<i.content.childCount;c++){const u=i.content.child(c);if(!t.validContent(u.content))return!1;const d=t.createChecked(null,u.content);s.push(d)}const a=e.createChecked(null,s);return n.replaceRange(r.start,r.end,new ne(B.from(a),0,0)),!0}function lu({listType:e,itemType:t,tr:n}){const r=Fg(n.selection);if(!r)return!1;const o=r.startIndex===0,{from:i,to:s}=n.selection;return eue({listType:e,itemType:t,tr:n,range:r})?(n.setSelection(Pe.between(n.doc.resolve(o?i:i+2),n.doc.resolve(o?s:s+2))),n.scrollIntoView(),!0):!1}function tue(e,t,n){const r=e.tr,o=n.parent,i=r.mapping.maps.length;for(let m=n.end,v=n.endIndex-1,x=n.startIndex;v>x;v--)m-=o.child(v).nodeSize,r.delete(m-1,m+1);const s=r.doc.resolve(n.start),a=s.nodeAfter;if(!a||r.mapping.slice(i).map(n.end)!==n.start+a.nodeSize)return!1;const l=n.startIndex===0,c=n.endIndex===o.childCount,u=s.node(-1),d=s.index(-1);if(!u.canReplace(d+(l?0:1),d+1,a.content.append(c?B.empty:B.from(o))))return!1;const p=s.pos,h=p+a.nodeSize;return r.step(new Tt(p-(l?1:0),h+(c?1:0),p+1,h-1,new ne((l?B.empty:B.from(o.copy(B.empty))).append(c?B.empty:B.from(o.copy(B.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}function SL(e,t){const n=t||e.selection.$from;let r=[],o,i,s,a;for(let c=n.depth;c>=0;c--){if(i=n.node(c),o=n.index(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&ma(s)){const u=n.before(c+1);r.push(u)}if(o=n.indexAfter(c),s=i.maybeChild(o-1),a=i.maybeChild(o),s&&a&&s.type.name===a.type.name&&ma(s)){const u=n.after(c+1);r.push(u)}}r=[...new Set(r)].sort((c,u)=>u-c);let l=!1;for(const c of r)Bp(e.doc,c)&&(e.join(c),l=!0);return l}function kL(e){return t=>{const{dispatch:n,tr:r}=t,o=WS(r,t.state),i=nue(e,r.selection);return i?(n&&tue(o,n,i),!0):!1}}function nue(e,t){const{$from:n,$to:r}=t;return n.blockRange(r,i=>{var s;return((s=i.firstChild)==null?void 0:s.type)===e})}function Fg(e){const{$from:t,$to:n}=e;return t.blockRange(n,ma)}function rue(e){const t=e.selection.$from,n=t.blockRange();if(!n||!Xs(n.parent)||n.startIndex!==0)return!1;const r=t.node(n.depth-2),o=t.index(n.depth),i=t.index(n.depth-1),s=t.index(n.depth-2),a=r.maybeChild(s-1),l=a==null?void 0:a.lastChild;if(o!==0||i!==0)return!1;if(a&&ma(a)&&l&&Xs(l))return lu({listType:a.type,itemType:l.type,tr:e});if(Xs(r)){const c=r,u=t.node(n.depth-3);if(ma(u))return lu({listType:u.type,itemType:c.type,tr:e})}return!1}function XN({view:e}){if(!e)return!1;{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!Xs(n.parent)||n.startIndex!==0)return!1}{const t=e.state.tr;rue(t)&&e.dispatch(t)}{const t=e.state.selection.$cursor;if(!t||t.parentOffset>0)return!1;const n=t.blockRange();if(!n||!Xs(n.parent)||n.startIndex!==0)return!1;const r=t.index(n.depth),o=t.index(n.depth-1),i=t.index(n.depth-2),s=n.depth-2>=1&&Xs(t.node(n.depth-2));r===0&&o===0&&i<=1&&s&&qce(n.parent.type)(e.state,e.dispatch)}return AD(e.state,e.dispatch,e),!0}function CL({node:e,mark:t,updateDOM:n,updateMark:r}){const o=document.createElement("label");o.contentEditable="false",o.classList.add(ha.LIST_ITEM_MARKER_CONTAINER),o.append(t);const i=document.createElement("div"),s=document.createElement("li");s.classList.add(ha.LIST_ITEM_WITH_CUSTOM_MARKER),s.append(o),s.append(i);const a=l=>l.type!==e.type?!1:(e=l,n(e,s),r(e,t),!0);return a(e),{dom:s,contentDOM:i,update:a}}function oue(e,t){const n=e.node(t.depth-1),r=e.node(t.depth-2);return!Xs(n)||!ma(r)?!1:{parentItem:n,parentList:r}}function iue(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth);return o<i?(e.step(new Tt(o-1,i,o,i,new ne(B.from(r.type.create(null,n.copy())),1,0),1,!0)),new xl(e.doc.resolve(t.$from.pos),e.doc.resolve(i),t.depth)):t}function sue(e,t){const n=t.parent,r=t.parent.child(t.endIndex-1),o=t.end,i=t.$to.end(t.depth-1);return o+1<i?(e.step(new Tt(o-1,i,o+1,i,new ne(B.from(n.type.create(null,r.type.create(null))),2,0),0,!0)),new xl(e.selection.$from,e.selection.$to,t.depth)):t}function aue(e,t,n,r){return lu({listType:n.type,itemType:r.type,tr:e})?new xl(e.selection.$from,e.selection.$to,t.depth):t}function lue(e){let t=Fg(e.selection);if(!t)return!1;const n=oue(e.selection.$from,t);if(!n)return!1;const{parentItem:r,parentList:o}=n;t=iue(e,t),t=sue(e,t),t=aue(e,t,o,r);const i=Cu(t);return typeof i!="number"||(e.lift(t,i),t=Fg(e.selection),t&&SL(e,e.doc.resolve(t.end-2))),!0}var cue=({tr:e,dispatch:t})=>lue(e)?(t==null||t(e.scrollIntoView()),!0):!1;function uue(e,t,n){let r,o,i,s;const a=t.doc;if(n.startIndex>=1){r=e.child(n.startIndex-1),o=e,s=a.resolve(n.start).start(n.depth),i=s+1;for(let l=0;l<n.startIndex-1;l++)i+=o.child(l).nodeSize}else{const l=t.index(n.depth-1);if(l>=1){const c=t.node(n.depth-1),u=t.start(n.depth-1);if(o=c.child(l-1),!ma(o))return!1;s=u+1;for(let d=0;d<l-1;d++)s+=c.child(d).nodeSize;if(r=o.child(o.childCount-1),i=s+o.nodeSize-r.nodeSize-1,!Xs(r))return!1}else return!1}return{previousItem:r,previousList:o,previousItemStart:i,previousListStart:s}}function due(e,t,n){let r,o;const i=n.start,s=t.depth>=n.depth+2?t.end(n.depth+2):n.end-1,a=n.end;return s+1>=a?(r=e.slice(i,a),o=null):(r=e.slice(i,s),o=e.slice(s+1,a-1)),{selectedSlice:r,unselectedSlice:o}}function fue(e){const{$from:t,$to:n}=e.selection,r=Fg(e.selection);if(!r)return!1;const o=e.doc.resolve(r.start).node();if(!ma(o))return!1;const i=uue(o,t,r);if(!i)return!1;const{previousItem:s,previousList:a,previousItemStart:l}=i,{selectedSlice:c,unselectedSlice:u}=due(e.doc,n,r),d=s.content.append(B.fromArray([o.copy(c.content)])).append(u?u.content:B.empty);e.deleteRange(r.start,r.end);const p=l+s.nodeSize-2,h=s.copy(d);return h.check(),e.replaceRangeWith(l-1,p+1,h),e.setSelection(a===o?Pe.between(e.doc.resolve(t.pos),e.doc.resolve(n.pos)):Pe.between(e.doc.resolve(t.pos-2),e.doc.resolve(n.pos-2))),!0}var pue=({tr:e,dispatch:t})=>fue(e)?(t==null||t(e.scrollIntoView()),!0):!1,EL=class extends ht{get name(){return"listItemShared"}createKeymap(){const e={Tab:pue,"Shift-Tab":cue,Backspace:XN,"Mod-Backspace":XN};if(bo.isMac){const t={"Ctrl-h":e.Backspace,"Alt-Backspace":e["Mod-Backspace"]};return{...e,...t}}return e}createPlugin(){return{appendTransaction:(e,t,n)=>{const r=n.tr;return SL(r)?r:null}}}},cu=class extends io{get name(){return"listItem"}createTags(){return[De.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),closed:{default:!1},nested:{default:!1}},parseDOM:[{tag:"li",getAttrs:e.parse,priority:et.Lowest},...t.parseDOM??[]],toDOM:n=>["li",e.dom(n),0]}}createNodeViews(){return this.options.enableCollapsible?(e,t,n)=>{const r=document.createElement("div");return r.classList.add(ha.COLLAPSIBLE_LIST_ITEM_BUTTON),r.contentEditable="false",r.addEventListener("click",()=>{if(r.classList.contains("disabled"))return;const o=n(),i=Se.create(t.state.doc,o);return t.dispatch(t.state.tr.setSelection(i)),this.store.commands.toggleListItemClosed(),!0}),CL({mark:r,node:e,updateDOM:hue,updateMark:mue})}:{}}createKeymap(){return{Enter:wL(this.type)}}createExtensions(){return[new EL]}toggleListItemClosed(e){return({state:{tr:t,selection:n},dispatch:r})=>{if(!Zv(n)||n.node.type.name!==this.name)return!1;const{node:o,from:i}=n;return e=oJ(e)?e:!o.attrs.closed,r==null||r(t.setNodeMarkup(i,void 0,{...o.attrs,closed:e})),!0}}liftListItemOutOfList(e){return kL(e??this.type)}};so([he()],cu.prototype,"toggleListItemClosed",1);so([he()],cu.prototype,"liftListItemOutOfList",1);cu=so([Ge({defaultOptions:{enableCollapsible:!1},staticKeys:["enableCollapsible"]})],cu);function hue(e,t){e.attrs.closed?t.classList.add(ha.COLLAPSIBLE_LIST_ITEM_CLOSED):t.classList.remove(ha.COLLAPSIBLE_LIST_ITEM_CLOSED)}function mue(e,t){e.childCount<=1?t.classList.add("disabled"):t.classList.remove("disabled")}var rp=class extends io{get name(){return"bulletList"}createTags(){return[De.Block,De.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["ul",e.dom(n),0]}}createNodeViews(){return this.options.enableSpine?(e,t,n)=>{var c;const r=document.createElement("div");r.style.position="relative";const o=n(),i=t.state.doc.resolve(o+1),s=i.node(i.depth-1);if(!(((c=s==null?void 0:s.type)==null?void 0:c.name)!=="listItem")){const u=document.createElement("div");u.contentEditable="false",u.classList.add(ha.LIST_SPINE),u.addEventListener("click",d=>{const p=n(),h=t.state.doc.resolve(p+1),m=h.start(h.depth-1),v=Se.create(t.state.doc,m-1);t.dispatch(t.state.tr.setSelection(v)),this.store.commands.toggleListItemClosed(),d.preventDefault(),d.stopPropagation()}),r.append(u)}const l=document.createElement("ul");return l.classList.add(ha.UL_LIST_CONTENT),r.append(l),{dom:r,contentDOM:l}}:{}}createExtensions(){return[new cu({priority:et.Low,enableCollapsible:this.options.enableSpine})]}toggleBulletList(){return uk(this.type,yt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleBulletList()(e)}createInputRules(){const e=/^\s*([*+-])\s$/;return[AS(e,this.type),new oo(e,(t,n,r,o)=>{const i=t.tr;return i.deleteRange(r,o),lu({listType:this.type,itemType:yt(this.store.schema.nodes,"listItem"),tr:i})?i:null})]}};so([he({icon:"listUnordered",label:({t:e})=>e(RS.BULLET_LIST_LABEL)})],rp.prototype,"toggleBulletList",1);so([Lr({shortcut:Z.BulletList,command:"toggleBulletList"})],rp.prototype,"listShortcut",1);rp=so([Ge({defaultOptions:{enableSpine:!1},staticKeys:["enableSpine"]})],rp);var op=class extends io{get name(){return"orderedList"}createTags(){return[De.Block,De.ListContainerNode]}createNodeSpec(e,t){return{content:"listItem+",...t,attrs:{...e.defaults(),order:{default:1}},parseDOM:[{tag:"ol",getAttrs:n=>si(n)?{...e.parse(n),order:+(n.getAttribute("start")??1)}:{}},...t.parseDOM??[]],toDOM:n=>{const r=e.dom(n);return n.attrs.order===1?["ol",r,0]:["ol",{...r,start:n.attrs.order},0]}}}createExtensions(){return[new cu({priority:et.Low})]}toggleOrderedList(){return uk(this.type,yt(this.store.schema.nodes,"listItem"))}listShortcut(e){return this.toggleOrderedList()(e)}createInputRules(){const e=/^(\d+)\.\s$/;return[AS(e,this.type,t=>({order:+yt(t,1)}),(t,n)=>n.childCount+n.attrs.order===+yt(t,1)),new oo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!lu({listType:this.type,itemType:yt(this.store.schema.nodes,"listItem"),tr:i}))return null;const a=+yt(n,1);if(a!==1){const l=Jf({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{order:a})}return i})]}};so([he({icon:"listOrdered",label:({t:e})=>e(RS.ORDERED_LIST_LABEL)})],op.prototype,"toggleOrderedList",1);so([Lr({shortcut:Z.OrderedList,command:"toggleOrderedList"})],op.prototype,"listShortcut",1);op=so([Ge({})],op);var _L=class extends io{get name(){return"taskListItem"}createTags(){return[De.ListItemNode]}createNodeSpec(e,t){return{content:"paragraph block*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),checked:{default:!1}},parseDOM:[{tag:"li[data-task-list-item]",getAttrs:n=>{let r=!1;return si(n)&&n.getAttribute("data-checked")!==null&&(r=!0),{checked:r,...e.parse(n)}},priority:et.Medium},...t.parseDOM??[]],toDOM:n=>["li",{...e.dom(n),"data-task-list-item":"","data-checked":n.attrs.checked?"":void 0},0]}}createNodeViews(){return(e,t,n)=>{const r=document.createElement("input");return r.type="checkbox",r.classList.add(ha.LIST_ITEM_CHECKBOX),r.contentEditable="false",r.addEventListener("click",o=>{t.editable||o.preventDefault()}),r.addEventListener("change",()=>{const o=n(),i=t.state.doc.resolve(o+1);this.store.commands.toggleCheckboxChecked({$pos:i})}),r.checked=e.attrs.checked,CL({node:e,mark:r,updateDOM:gue,updateMark:vue})}}createKeymap(){return{Enter:wL(this.type)}}createExtensions(){return[new EL]}toggleCheckboxChecked(e){let t,n;return typeof e=="boolean"?t=e:e&&(t=e.checked,n=e.$pos),({tr:r,dispatch:o})=>{const i=Jf({selection:n??r.selection.$from,types:this.type});if(!i)return!1;const{node:s,pos:a}=i,l={...s.attrs,checked:t??!s.attrs.checked};return o==null||o(r.setNodeMarkup(a,void 0,l)),!0}}createInputRules(){const e=/^\s*(\[( ?|x|X)]\s)$/;return[AS(e,this.type,t=>({checked:["x","X"].includes(Yd(t,2))})),new oo(e,(t,n,r,o)=>{const i=t.tr;if(i.deleteRange(r,o),!lu({listType:yt(this.store.schema.nodes,"taskList"),itemType:this.type,tr:i}))return null;const a=["x","X"].includes(Yd(n,2));if(a){const l=Jf({selection:i.selection,types:this.type});l&&i.setNodeMarkup(l.pos,void 0,{checked:a})}return i})]}};so([he()],_L.prototype,"toggleCheckboxChecked",1);function gue(e,t){e.attrs.checked?t.setAttribute("data-checked",""):t.removeAttribute("data-checked"),t.setAttribute("data-task-list-item","")}function vue(e,t){t.checked=!!e.attrs.checked}var NL=class extends io{get name(){return"taskList"}createTags(){return[De.Block,De.ListContainerNode]}createNodeSpec(e,t){return{content:"taskListItem+",...t,attrs:e.defaults(),parseDOM:[{tag:"ul[data-task-list]",getAttrs:e.parse,priority:et.Medium},...t.parseDOM??[]],toDOM:n=>["ul",{...e.dom(n),"data-task-list":""},0]}}createExtensions(){return[new _L({})]}toggleTaskList(){return uk(this.type,yt(this.store.schema.nodes,"taskListItem"))}listShortcut(e){return this.toggleTaskList()(e)}};so([he({icon:"checkboxMultipleLine",label:({t:e})=>e(RS.TASK_LIST_LABEL)})],NL.prototype,"toggleTaskList",1);so([Lr({shortcut:Z.TaskList,command:"toggleTaskList"})],NL.prototype,"listShortcut",1);function yue(e,t=[]){let n=[];function r(i,s){const a=g.createContext(s),l=n.length;n=[...n,s];function c(d){const{scope:p,children:h,...m}=d,v=(p==null?void 0:p[e][l])||a,x=g.useMemo(()=>m,Object.values(m));return f.jsx(v.Provider,{value:x,children:h})}function u(d,p){const h=(p==null?void 0:p[e][l])||a,m=g.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>g.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,xue(o,...t)]}function xue(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var zx="rovingFocusGroup.onEntryFocus",bue={bubbles:!1,cancelable:!0},ly="RovingFocusGroup",[ow,OL,wue]=Ov(ly),[Sue,TL]=yue(ly,[wue]),[kue,Cue]=Sue(ly),ML=g.forwardRef((e,t)=>f.jsx(ow.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(ow.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Eue,{...e,ref:t})})}));ML.displayName=ly;var Eue=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=g.useRef(null),h=Ie(t,p),m=kp(i),[v=null,x]=Qr({prop:s,defaultProp:a,onChange:l}),[b,w]=g.useState(!1),S=$t(c),k=OL(n),C=g.useRef(!1),[N,_]=g.useState(0);return g.useEffect(()=>{const O=p.current;if(O)return O.addEventListener(zx,S),()=>O.removeEventListener(zx,S)},[S]),f.jsx(kue,{scope:n,orientation:r,dir:m,loop:o,currentTabStopId:v,onItemFocus:g.useCallback(O=>x(O),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>_(O=>O+1),[]),onFocusableItemRemove:g.useCallback(()=>_(O=>O-1),[]),children:f.jsx(ke.div,{tabIndex:b||N===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Q(e.onMouseDown,()=>{C.current=!0}),onFocus:Q(e.onFocus,O=>{const M=!C.current;if(O.target===O.currentTarget&&M&&!b){const P=new CustomEvent(zx,bue);if(O.currentTarget.dispatchEvent(P),!P.defaultPrevented){const D=k().filter(j=>j.focusable),$=D.find(j=>j.active),U=D.find(j=>j.id===v),G=[$,U,...D].filter(Boolean).map(j=>j.ref.current);RL(G,u)}}C.current=!1}),onBlur:Q(e.onBlur,()=>w(!1))})})}),PL="RovingFocusGroupItem",jL=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Gr(),l=i||a,c=Cue(PL,n),u=c.currentTabStopId===l,d=OL(n),{onFocusableItemAdd:p,onFocusableItemRemove:h}=c;return g.useEffect(()=>{if(r)return p(),()=>h()},[r,p,h]),f.jsx(ow.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(ke.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:Q(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:Q(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Q(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const v=Oue(m,c.orientation,c.dir);if(v!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let b=d().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")b.reverse();else if(v==="prev"||v==="next"){v==="prev"&&b.reverse();const w=b.indexOf(m.currentTarget);b=c.loop?Tue(b,w+1):b.slice(w+1)}setTimeout(()=>RL(b))}})})})});jL.displayName=PL;var _ue={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Nue(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Oue(e,t,n){const r=Nue(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return _ue[r]}function RL(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Tue(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Mue=ML,Pue=jL,iw=["Enter"," "],jue=["ArrowDown","PageUp","Home"],AL=["ArrowUp","PageDown","End"],Rue=[...jue,...AL],Aue={ltr:[...iw,"ArrowRight"],rtl:[...iw,"ArrowLeft"]},Iue={ltr:["ArrowLeft"],rtl:["ArrowRight"]},qp="Menu",[ip,Due,Lue]=Ov(qp),[jl,IL]=$o(qp,[Lue,wa,TL]),cy=wa(),DL=TL(),[Fue,Rl]=jl(qp),[zue,Gp]=jl(qp),LL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=cy(t),[l,c]=g.useState(null),u=g.useRef(!1),d=$t(i),p=kp(o);return g.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),f.jsx(wv,{...a,children:f.jsx(Fue,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(zue,{scope:t,onClose:g.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:p,modal:s,children:r})})})};LL.displayName=qp;var $ue="MenuAnchor",dk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=cy(n);return f.jsx(_p,{...o,...r,ref:t})});dk.displayName=$ue;var fk="MenuPortal",[Bue,FL]=jl(fk,{forceMount:void 0}),zL=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Rl(fk,t);return f.jsx(Bue,{scope:t,forceMount:n,children:f.jsx(xn,{present:n||i.open,children:f.jsx(Np,{asChild:!0,container:o,children:r})})})};zL.displayName=fk;var Jr="MenuContent",[Vue,pk]=jl(Jr),$L=g.forwardRef((e,t)=>{const n=FL(Jr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Rl(Jr,e.__scopeMenu),s=Gp(Jr,e.__scopeMenu);return f.jsx(ip.Provider,{scope:e.__scopeMenu,children:f.jsx(xn,{present:r||i.open,children:f.jsx(ip.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(Uue,{...o,ref:t}):f.jsx(Wue,{...o,ref:t})})})})}),Uue=g.forwardRef((e,t)=>{const n=Rl(Jr,e.__scopeMenu),r=g.useRef(null),o=Ie(t,r);return g.useEffect(()=>{const i=r.current;if(i)return Cv(i)},[]),f.jsx(hk,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Q(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Wue=g.forwardRef((e,t)=>{const n=Rl(Jr,e.__scopeMenu);return f.jsx(hk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hk=g.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,onDismiss:h,disableOutsideScroll:m,...v}=e,x=Rl(Jr,n),b=Gp(Jr,n),w=cy(n),S=DL(n),k=Due(n),[C,N]=g.useState(null),_=g.useRef(null),O=Ie(t,_,x.onContentChange),M=g.useRef(0),P=g.useRef(""),D=g.useRef(0),$=g.useRef(null),U=g.useRef("right"),K=g.useRef(0),G=m?Op:g.Fragment,j=m?{as:$i,allowPinchZoom:!0}:void 0,T=R=>{var z,te;const A=P.current+R,I=k().filter(se=>!se.disabled),F=document.activeElement,ce=(z=I.find(se=>se.ref.current===F))==null?void 0:z.textValue,pe=I.map(se=>se.textValue),W=nde(pe,A,ce),V=(te=I.find(se=>se.textValue===W))==null?void 0:te.ref.current;(function se(Y){P.current=Y,window.clearTimeout(M.current),Y!==""&&(M.current=window.setTimeout(()=>se(""),1e3))})(A),V&&setTimeout(()=>V.focus())};g.useEffect(()=>()=>window.clearTimeout(M.current),[]),vv();const E=g.useCallback(R=>{var I,F;return U.current===((I=$.current)==null?void 0:I.side)&&ode(R,(F=$.current)==null?void 0:F.area)},[]);return f.jsx(Vue,{scope:n,searchRef:P,onItemEnter:g.useCallback(R=>{E(R)&&R.preventDefault()},[E]),onItemLeave:g.useCallback(R=>{var A;E(R)||((A=_.current)==null||A.focus(),N(null))},[E]),onTriggerLeave:g.useCallback(R=>{E(R)&&R.preventDefault()},[E]),pointerGraceTimerRef:D,onPointerGraceIntentChange:g.useCallback(R=>{$.current=R},[]),children:f.jsx(G,{...j,children:f.jsx(Cp,{asChild:!0,trapped:o,onMountAutoFocus:Q(i,R=>{var A;R.preventDefault(),(A=_.current)==null||A.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(gu,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,onDismiss:h,children:f.jsx(Mue,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:N,onEntryFocus:Q(l,R=>{b.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Sv,{role:"menu","aria-orientation":"vertical","data-state":n4(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...v,ref:O,style:{outline:"none",...v.style},onKeyDown:Q(v.onKeyDown,R=>{const I=R.target.closest("[data-radix-menu-content]")===R.currentTarget,F=R.ctrlKey||R.altKey||R.metaKey,ce=R.key.length===1;I&&(R.key==="Tab"&&R.preventDefault(),!F&&ce&&T(R.key));const pe=_.current;if(R.target!==pe||!Rue.includes(R.key))return;R.preventDefault();const V=k().filter(z=>!z.disabled).map(z=>z.ref.current);AL.includes(R.key)&&V.reverse(),ede(V)}),onBlur:Q(e.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(M.current),P.current="")}),onPointerMove:Q(e.onPointerMove,sp(R=>{const A=R.target,I=K.current!==R.clientX;if(R.currentTarget.contains(A)&&I){const F=R.clientX>K.current?"right":"left";U.current=F,K.current=R.clientX}}))})})})})})})});$L.displayName=Jr;var Hue="MenuGroup",mk=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(ke.div,{role:"group",...r,ref:t})});mk.displayName=Hue;var Kue="MenuLabel",BL=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(ke.div,{...r,ref:t})});BL.displayName=Kue;var zg="MenuItem",ZN="menu.itemSelect",uy=g.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=g.useRef(null),s=Gp(zg,e.__scopeMenu),a=pk(zg,e.__scopeMenu),l=Ie(t,i),c=g.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const p=new CustomEvent(ZN,{bubbles:!0,cancelable:!0});d.addEventListener(ZN,h=>r==null?void 0:r(h),{once:!0}),MP(d,p),p.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(VL,{...o,ref:l,disabled:n,onClick:Q(e.onClick,u),onPointerDown:d=>{var p;(p=e.onPointerDown)==null||p.call(e,d),c.current=!0},onPointerUp:Q(e.onPointerUp,d=>{var p;c.current||(p=d.currentTarget)==null||p.click()}),onKeyDown:Q(e.onKeyDown,d=>{const p=a.searchRef.current!=="";n||p&&d.key===" "||iw.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});uy.displayName=zg;var VL=g.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=pk(zg,n),a=DL(n),l=g.useRef(null),c=Ie(t,l),[u,d]=g.useState(!1),[p,h]=g.useState("");return g.useEffect(()=>{const m=l.current;m&&h((m.textContent??"").trim())},[i.children]),f.jsx(ip.ItemSlot,{scope:n,disabled:r,textValue:o??p,children:f.jsx(Pue,{asChild:!0,...a,focusable:!r,children:f.jsx(ke.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:Q(e.onPointerMove,sp(m=>{r?s.onItemLeave(m):(s.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Q(e.onPointerLeave,sp(m=>s.onItemLeave(m))),onFocus:Q(e.onFocus,()=>d(!0)),onBlur:Q(e.onBlur,()=>d(!1))})})})}),que="MenuCheckboxItem",UL=g.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx(GL,{scope:e.__scopeMenu,checked:n,children:f.jsx(uy,{role:"menuitemcheckbox","aria-checked":$g(n)?"mixed":n,...o,ref:t,"data-state":vk(n),onSelect:Q(o.onSelect,()=>r==null?void 0:r($g(n)?!0:!n),{checkForDefaultPrevented:!1})})})});UL.displayName=que;var WL="MenuRadioGroup",[Gue,Yue]=jl(WL,{value:void 0,onValueChange:()=>{}}),HL=g.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=$t(r);return f.jsx(Gue,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(mk,{...o,ref:t})})});HL.displayName=WL;var KL="MenuRadioItem",qL=g.forwardRef((e,t)=>{const{value:n,...r}=e,o=Yue(KL,e.__scopeMenu),i=n===o.value;return f.jsx(GL,{scope:e.__scopeMenu,checked:i,children:f.jsx(uy,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":vk(i),onSelect:Q(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});qL.displayName=KL;var gk="MenuItemIndicator",[GL,Jue]=jl(gk,{checked:!1}),YL=g.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Jue(gk,n);return f.jsx(xn,{present:r||$g(i.checked)||i.checked===!0,children:f.jsx(ke.span,{...o,ref:t,"data-state":vk(i.checked)})})});YL.displayName=gk;var Xue="MenuSeparator",JL=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(ke.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});JL.displayName=Xue;var Zue="MenuArrow",XL=g.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=cy(n);return f.jsx(kv,{...o,...r,ref:t})});XL.displayName=Zue;var Que="MenuSub",[Mpe,ZL]=jl(Que),Md="MenuSubTrigger",QL=g.forwardRef((e,t)=>{const n=Rl(Md,e.__scopeMenu),r=Gp(Md,e.__scopeMenu),o=ZL(Md,e.__scopeMenu),i=pk(Md,e.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>u,[u]),g.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),f.jsx(dk,{asChild:!0,...c,children:f.jsx(VL,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":n4(n.open),...e,ref:hv(t,o.onTriggerChange),onClick:d=>{var p;(p=e.onClick)==null||p.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Q(e.onPointerMove,sp(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Q(e.onPointerLeave,sp(d=>{var h,m;u();const p=(h=n.content)==null?void 0:h.getBoundingClientRect();if(p){const v=(m=n.content)==null?void 0:m.dataset.side,x=v==="right",b=x?-5:5,w=p[x?"left":"right"],S=p[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+b,y:d.clientY},{x:w,y:p.top},{x:S,y:p.top},{x:S,y:p.bottom},{x:w,y:p.bottom}],side:v}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Q(e.onKeyDown,d=>{var h;const p=i.searchRef.current!=="";e.disabled||p&&d.key===" "||Aue[r.dir].includes(d.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),d.preventDefault())})})})});QL.displayName=Md;var e4="MenuSubContent",t4=g.forwardRef((e,t)=>{const n=FL(Jr,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Rl(Jr,e.__scopeMenu),s=Gp(Jr,e.__scopeMenu),a=ZL(e4,e.__scopeMenu),l=g.useRef(null),c=Ie(t,l);return f.jsx(ip.Provider,{scope:e.__scopeMenu,children:f.jsx(xn,{present:r||i.open,children:f.jsx(ip.Slot,{scope:e.__scopeMenu,children:f.jsx(hk,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Q(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Q(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Q(e.onKeyDown,u=>{var h;const d=u.currentTarget.contains(u.target),p=Iue[s.dir].includes(u.key);d&&p&&(i.onOpenChange(!1),(h=a.trigger)==null||h.focus(),u.preventDefault())})})})})})});t4.displayName=e4;function n4(e){return e?"open":"closed"}function $g(e){return e==="indeterminate"}function vk(e){return $g(e)?"indeterminate":e?"checked":"unchecked"}function ede(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function tde(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nde(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=tde(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function rde(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function ode(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return rde(n,t)}function sp(e){return t=>t.pointerType==="mouse"?e(t):void 0}var ide=LL,sde=dk,ade=zL,lde=$L,cde=mk,ude=BL,dde=uy,fde=UL,pde=HL,hde=qL,mde=YL,gde=JL,vde=XL,yde=QL,xde=t4,yk="DropdownMenu",[bde,Ppe]=$o(yk,[IL]),Gn=IL(),[wde,r4]=bde(yk),o4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=Gn(t),c=g.useRef(null),[u=!1,d]=Qr({prop:o,defaultProp:i,onChange:s});return f.jsx(wde,{scope:t,triggerId:Gr(),triggerRef:c,contentId:Gr(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(p=>!p),[d]),modal:a,children:f.jsx(ide,{...l,open:u,onOpenChange:d,dir:r,modal:a,children:n})})};o4.displayName=yk;var i4="DropdownMenuTrigger",s4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=r4(i4,n),s=Gn(n);return f.jsx(sde,{asChild:!0,...s,children:f.jsx(ke.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:hv(t,i.triggerRef),onPointerDown:Q(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Q(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});s4.displayName=i4;var Sde="DropdownMenuPortal",a4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Gn(t);return f.jsx(ade,{...r,...n})};a4.displayName=Sde;var l4="DropdownMenuContent",c4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=r4(l4,n),i=Gn(n),s=g.useRef(!1);return f.jsx(lde,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:Q(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Q(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});c4.displayName=l4;var kde="DropdownMenuGroup",Cde=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(cde,{...o,...r,ref:t})});Cde.displayName=kde;var Ede="DropdownMenuLabel",u4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(ude,{...o,...r,ref:t})});u4.displayName=Ede;var _de="DropdownMenuItem",d4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(dde,{...o,...r,ref:t})});d4.displayName=_de;var Nde="DropdownMenuCheckboxItem",f4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(fde,{...o,...r,ref:t})});f4.displayName=Nde;var Ode="DropdownMenuRadioGroup",Tde=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(pde,{...o,...r,ref:t})});Tde.displayName=Ode;var Mde="DropdownMenuRadioItem",p4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(hde,{...o,...r,ref:t})});p4.displayName=Mde;var Pde="DropdownMenuItemIndicator",h4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(mde,{...o,...r,ref:t})});h4.displayName=Pde;var jde="DropdownMenuSeparator",m4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(gde,{...o,...r,ref:t})});m4.displayName=jde;var Rde="DropdownMenuArrow",Ade=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(vde,{...o,...r,ref:t})});Ade.displayName=Rde;var Ide="DropdownMenuSubTrigger",g4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(yde,{...o,...r,ref:t})});g4.displayName=Ide;var Dde="DropdownMenuSubContent",v4=g.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Gn(n);return f.jsx(xde,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});v4.displayName=Dde;var Lde=o4,Fde=s4,zde=a4,y4=c4,x4=u4,b4=d4,w4=f4,S4=p4,k4=h4,C4=m4,E4=g4,_4=v4;const $de=Lde,Bde=Fde,Vde=g.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(E4,{ref:o,className:Fe("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-bg-brand-primary_alt data-[state=open]:bg-bg-brand-primary",t&&"pl-8",e),...r,children:[n,f.jsx(fv,{className:"w-4 h-4 ml-auto"})]}));Vde.displayName=E4.displayName;const Ude=g.forwardRef(({className:e,...t},n)=>f.jsx(_4,{ref:n,className:Fe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ude.displayName=_4.displayName;const N4=g.forwardRef(({className:e,sideOffset:t=4,container:n,...r},o)=>f.jsx(zde,{container:n,children:f.jsx(y4,{ref:o,sideOffset:t,className:Fe("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-bg-secondary_alt p-1 text-text-secondary shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));N4.displayName=y4.displayName;const gs=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(b4,{ref:r,className:Fe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-bg-brand-solid focus:text-text-brand-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));gs.displayName=b4.displayName;const Wde=g.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(w4,{ref:o,className:Fe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(k4,{children:f.jsx(wp,{className:"w-4 h-4"})})}),t]}));Wde.displayName=w4.displayName;const Hde=g.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(S4,{ref:r,className:Fe("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(k4,{children:f.jsx(x9,{className:"w-2 h-2 fill-current"})})}),t]}));Hde.displayName=S4.displayName;const Kde=g.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(x4,{ref:r,className:Fe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Kde.displayName=x4.displayName;const qde=g.forwardRef(({className:e,...t},n)=>f.jsx(C4,{ref:n,className:Fe("-mx-1 my-1 h-px bg-muted",e),...t}));qde.displayName=C4.displayName;var Gde=Object.defineProperty,Yde=Object.getOwnPropertyDescriptor,Yp=(e,t,n,r)=>{for(var o=r>1?void 0:r?Yde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Gde(t,n,o),o},Jde={icon:"bold",label:({t:e})=>e(P_.LABEL),description:({t:e})=>e(P_.DESCRIPTION)},El=class extends Hp{get name(){return"bold"}createTags(){return[De.FormattingMark,De.FontStyle]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"strong",getAttrs:e.parse},{tag:"b",getAttrs:n=>si(n)&&n.style.fontWeight!=="normal"?e.parse(n):!1},{style:"font-weight",getAttrs:n=>Te(n)&&/^(bold(er)?|[5-9]\d{2,})$/.test(n)?null:!1},...t.parseDOM??[]],toDOM:n=>{const{weight:r}=this.options;return r?["strong",{"font-weight":r.toString()},0]:["strong",e.dom(n),0]}}}createInputRules(){return[Pg({regexp:/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/,type:this.type,ignoreWhitespace:!0})]}toggleBold(e){return Zf({type:this.type,selection:e})}setBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=eo(e??t.selection,t.doc);return n==null||n(t.addMark(r,o,this.type.create())),!0}}removeBold(e){return({tr:t,dispatch:n})=>{const{from:r,to:o}=eo(e??t.selection,t.doc);return t.doc.rangeHasMark(r,o,this.type)?(n==null||n(t.removeMark(r,o,this.type)),!0):!1}}shortcut(e){return this.toggleBold()(e)}};Yp([he(Jde)],El.prototype,"toggleBold",1);Yp([he()],El.prototype,"setBold",1);Yp([he()],El.prototype,"removeBold",1);Yp([Lr({shortcut:Z.Bold,command:"toggleBold"})],El.prototype,"shortcut",1);El=Yp([Ge({defaultOptions:{weight:void 0},staticKeys:["weight"]})],El);var Xde=Object.defineProperty,Zde=Object.getOwnPropertyDescriptor,xk=(e,t,n,r)=>{for(var o=r>1?void 0:r?Zde(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Xde(t,n,o),o},Qde={icon:"italic",label:({t:e})=>e(j_.LABEL),description:({t:e})=>e(j_.DESCRIPTION)},ap=class extends Hp{get name(){return"italic"}createTags(){return[De.FontStyle,De.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"i",getAttrs:e.parse},{tag:"em",getAttrs:e.parse},{style:"font-style=italic"},...t.parseDOM??[]],toDOM:n=>["em",e.dom(n),0]}}createKeymap(){return{"Mod-i":Zf({type:this.type})}}createInputRules(){return[Pg({regexp:/(?:^|[^*])\*([^*]+)\*$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("*")?{}:{fullMatch:e.slice(1),start:t+1}}),Pg({regexp:/(?:^|\W)_([^_]+)_$/,type:this.type,ignoreWhitespace:!0,updateCaptured:({fullMatch:e,start:t})=>e.startsWith("_")?{}:{fullMatch:e.slice(1),start:t+1}})]}createPasteRules(){return[{type:"mark",markType:this.type,regexp:/(?:^|\W)_([^_]+)_/g},{type:"mark",markType:this.type,regexp:/\*([^*]+)\*/g}]}toggleItalic(e){return Zf({type:this.type,selection:e})}shortcut(e){return this.toggleItalic()(e)}};xk([he(Qde)],ap.prototype,"toggleItalic",1);xk([Lr({shortcut:Z.Italic,command:"toggleItalic"})],ap.prototype,"shortcut",1);ap=xk([Ge({})],ap);var efe=Object.defineProperty,tfe=Object.getOwnPropertyDescriptor,bk=(e,t,n,r)=>{for(var o=r>1?void 0:r?tfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&efe(t,n,o),o},nfe={icon:"strikethrough",label:({t:e})=>e(R_.LABEL),description:({t:e})=>e(R_.DESCRIPTION)},lp=class extends Hp{get name(){return"strike"}createTags(){return[De.FontStyle,De.FormattingMark]}createMarkSpec(e,t){return{...t,attrs:e.defaults(),parseDOM:[{tag:"s",getAttrs:e.parse},{tag:"del",getAttrs:e.parse},{tag:"strike",getAttrs:e.parse},{style:"text-decoration",getAttrs:n=>n==="line-through"?{}:!1},...t.parseDOM??[]],toDOM:n=>["s",e.dom(n),0]}}toggleStrike(){return Zf({type:this.type})}shortcut(e){return this.toggleStrike()(e)}createInputRules(){return[Pg({regexp:/~([^~]+)~$/,type:this.type,ignoreWhitespace:!0})]}createPasteRules(){return[{regexp:/~([^~]+)~/g,type:"mark",markType:this.type}]}};bk([he(nfe)],lp.prototype,"toggleStrike",1);bk([Lr({shortcut:Z.Strike,command:"toggleStrike"})],lp.prototype,"shortcut",1);lp=bk([Ge({})],lp);var rfe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',ofe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>',ife=encodeURIComponent(rfe),sfe=encodeURIComponent(ofe),Dn,sO,afe=(sO=class{constructor(e){_t(this,"dom");kn(this,Dn);_t(this,"type");const t=document.createElement("div"),n=document.createElement("div");this.dom=t,Ve(this,Dn,n),this.type=e,this.createHandle(e)}createHandle(e){switch(_n(this.dom,{position:"absolute",pointerEvents:"auto",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"100"}),_n(oe(this,Dn),{opacity:"0",transition:"opacity 300ms ease-in 0s"}),oe(this,Dn).dataset.dragging="",e){case 0:_n(this.dom,{right:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),_n(oe(this,Dn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 1:_n(this.dom,{left:"0px",top:"0px",height:"100%",width:"15px",cursor:"col-resize"}),_n(oe(this,Dn),{width:" 4px",height:"36px",maxHeight:"50%",boxSizing:"content-box",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 2:_n(this.dom,{bottom:"0px",width:"100%",height:"14px",cursor:"row-resize"}),_n(oe(this,Dn),{width:" 42px",height:"4px",boxSizing:"content-box",maxWidth:"50%",background:"rgba(0, 0, 0, 0.65)",border:"1px solid rgba(255, 255, 255, 0.5)",borderRadius:"6px"});break;case 3:_n(this.dom,{right:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nwse-resize",zIndex:"101"}),_n(oe(this,Dn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${sfe}") `});break;case 4:_n(this.dom,{left:"-1px",bottom:"-2px",width:"30px",height:"30px",cursor:"nesw-resize",zIndex:"101"}),_n(oe(this,Dn),{height:"22px",width:"22px",backgroundRepeat:"no-repeat",backgroundImage:`url("data:image/svg+xml,${ife}") `});break}this.dom.append(oe(this,Dn))}setHandleVisibility(e){const t=e||!!oe(this,Dn).dataset.dragging;oe(this,Dn).style.opacity=t?"1":"0"}dataSetDragging(e){oe(this,Dn).dataset.dragging=e?"true":""}},Dn=new WeakMap,sO),Mh=50,O4=(e=>(e[e.Fixed=0]="Fixed",e[e.Flexible=1]="Flexible",e))(O4||{}),_s,Ns,Os,Ko,Ts,aO,lfe=(aO=class{constructor({node:e,view:t,getPos:n,aspectRatio:r=0,options:o,initialSize:i}){_t(this,"dom");kn(this,_s);kn(this,Ns);kn(this,Os,[]);_t(this,"aspectRatio");kn(this,Ko);kn(this,Ts);const s=this.createWrapper(e,i),a=this.createElement({node:e,view:t,getPos:n,options:o}),c=(r===1?[0,1,2,3,4]:[0,1]).map(p=>new afe(p));for(const p of c){const h=m=>{this.startResizing(m,t,n,p)};p.dom.addEventListener("mousedown",h),oe(this,Os).push(()=>p.dom.removeEventListener("mousedown",h)),s.append(p.dom)}const u=()=>{c.forEach(p=>p.setHandleVisibility(!0))},d=()=>{c.forEach(p=>p.setHandleVisibility(!1))};s.addEventListener("mouseover",u),s.addEventListener("mouseout",d),oe(this,Os).push(()=>s.removeEventListener("mouseover",u),()=>s.removeEventListener("mouseout",d)),s.append(a),this.dom=s,Ve(this,Ns,e),Ve(this,_s,a),this.aspectRatio=r}createWrapper(e,t){const n=document.createElement("div");return n.classList.add("remirror-resizable-view"),n.style.position="relative",t?_n(n,{width:QN(t.width),aspectRatio:`${t.width} / ${t.height}`}):_n(n,{width:QN(e.attrs.width),aspectRatio:`${e.attrs.width} / ${e.attrs.height}`}),_n(n,{maxWidth:"100%",minWidth:`${Mh}px`,verticalAlign:"bottom",display:"inline-block",lineHeight:"0",transition:"width 0.15s ease-out, height 0.15s ease-out"}),n}startResizing(e,t,n,r){var u,d;e.preventDefault(),r.dataSetDragging(!0),oe(this,_s).style.pointerEvents="none";const o=e.pageX,i=e.pageY,s=((u=oe(this,_s))==null?void 0:u.getBoundingClientRect().width)||0,a=((d=oe(this,_s))==null?void 0:d.getBoundingClientRect().height)||0,l=wb(100,!1,p=>{const h=p.pageX,m=p.pageY,v=h-o,x=m-i;let b=null,w=null;if(this.aspectRatio===0&&s&&a)switch(r.type){case 0:case 3:b=s+v,w=a/s*b;break;case 1:case 4:b=s-v,w=a/s*b;break;case 2:w=a+x,b=s/a*w;break}else if(this.aspectRatio===1)switch(r.type){case 0:b=s+v;break;case 1:b=s-v;break;case 2:w=a+x;break;case 3:b=s+v,w=a+x;break;case 4:b=s-v,w=a+x;break}typeof b=="number"&&b<Mh&&(this.aspectRatio===0&&s&&a?(b=Mh,w=a/s*b):this.aspectRatio===1&&(b=Mh)),b&&(Ve(this,Ko,Math.round(b)),this.dom.style.width=`${oe(this,Ko)}px`),w&&Ve(this,Ts,Math.round(w)),(b||w)&&(this.dom.style.aspectRatio=`${oe(this,Ko)} / ${oe(this,Ts)}`)}),c=p=>{p.preventDefault(),r.dataSetDragging(!1),r.setHandleVisibility(!1),oe(this,_s).style.pointerEvents="auto",document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c);const h=n(),m=t.state.tr.setNodeMarkup(h,void 0,{...oe(this,Ns).attrs,width:oe(this,Ko),height:oe(this,Ts)});t.dispatch(m)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c),oe(this,Os).push(()=>document.removeEventListener("mousemove",l)),oe(this,Os).push(()=>document.removeEventListener("mouseup",c))}update(e){return e.type!==oe(this,Ns).type||this.aspectRatio===0&&e.attrs.width&&e.attrs.width!==oe(this,Ko)||this.aspectRatio===1&&e.attrs.width&&e.attrs.height&&e.attrs.width!==oe(this,Ko)&&e.attrs.height!==oe(this,Ts)||!cfe(oe(this,Ns),e,["width","height"])?!1:(Ve(this,Ns,e),Ve(this,Ko,e.attrs.width),Ve(this,Ts,e.attrs.height),!0)}destroy(){oe(this,Os).forEach(e=>e())}},_s=new WeakMap,Ns=new WeakMap,Os=new WeakMap,Ko=new WeakMap,Ts=new WeakMap,aO);function cfe(e,t,n){return e===t||ufe(e,t,n)&&e.content.eq(t.content)}function ufe(e,t,n){const r=e.attrs,o=t.attrs,i={};for(const a of n)i[a]=null;e.attrs={...r,...i},t.attrs={...o,...i};const s=e.sameMarkup(t);return e.attrs=r,t.attrs=o,s}function QN(e){return typeof e=="number"?`${e}px`:e||void 0}var dfe=Object.defineProperty,ffe=Object.getOwnPropertyDescriptor,wk=(e,t,n,r)=>{for(var o=r>1?void 0:r?ffe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&dfe(t,n,o),o},pfe=class extends lfe{constructor(e,t,n){super({node:e,view:t,getPos:n,aspectRatio:O4.Fixed})}createElement({node:e}){const t=document.createElement("img");return t.setAttribute("src",e.attrs.src),_n(t,{width:"100%",minWidth:"50px",objectFit:"contain"}),t}},cp=class extends io{get name(){return"image"}createTags(){return[De.InlineNode,De.Media]}createNodeSpec(e,t){const{preferPastedTextContent:n}=this.options;return{inline:!0,draggable:!0,selectable:!1,...t,attrs:{...e.defaults(),alt:{default:""},crop:{default:null},height:{default:null},width:{default:null},rotate:{default:null},src:{default:null},title:{default:""},fileName:{default:null},resizable:{default:!1}},parseDOM:[{tag:"img[src]",getAttrs:r=>{var o;if(si(r)){const i=mfe({element:r,parse:e.parse});return n&&((o=i.src)!=null&&o.startsWith("file:///"))?!1:i}return{}}},...t.parseDOM??[]],toDOM:r=>{const o=ND(r.attrs,e);return["img",{...e.dom(r),...o}]}}}insertImage(e,t){return({tr:n,dispatch:r})=>{const{from:o,to:i}=eo(t??n.selection,n.doc),s=this.type.create(e);return r==null||r(n.replaceRangeWith(o,i,s)),!0}}uploadImage(e,t){const{updatePlaceholder:n,destroyPlaceholder:r,createPlaceholder:o}=this.options;return i=>{const{tr:s}=i;let a=s.selection.from;return this.store.createPlaceholderCommand({promise:e,placeholder:{type:"widget",get pos(){return a},createElement:(l,c)=>{const u=o(l,c);return t==null||t(u),u},onUpdate:(l,c,u,d)=>{n(l,c,u,d)},onDestroy:(l,c)=>{r(l,c)}},onSuccess:(l,c,u)=>this.insertImage(l,c)(u)}).validate(({tr:l,dispatch:c})=>{const u=SI(l.doc,a,this.type);return u==null?!1:(a=u,l.selection.empty||c==null||c(l.deleteSelection()),!0)},"unshift").generateCommand()(i)}}fileUploadFileHandler(e,t,n){var c;const{preferPastedTextContent:r,uploadHandler:o}=this.options;if(r&&yfe(t)&&((c=t.clipboardData)!=null&&c.getData("text/plain")))return!1;const{commands:i,chain:s}=this.store,a=e.map((u,d)=>({file:u,progress:p=>{i.updatePlaceholder(l[d],p)}})),l=o(a);Ar(n)&&s.selectText(n);for(const u of l)s.uploadImage(u);return s.run(),!0}createPasteRules(){return[{type:"file",regexp:/image/i,fileHandler:e=>{const t=e.type==="drop"?e.pos:void 0;return this.fileUploadFileHandler(e.files,e.event,t)}}]}createNodeViews(){return this.options.enableResizing?(e,t,n)=>new pfe(e,t,n):{}}};wk([he()],cp.prototype,"insertImage",1);wk([he()],cp.prototype,"uploadImage",1);cp=wk([Ge({defaultOptions:{createPlaceholder:gfe,updatePlaceholder:()=>{},destroyPlaceholder:()=>{},uploadHandler:vfe,enableResizing:!1,preferPastedTextContent:!0}})],cp);function hfe(e){let{width:t,height:n}=e.style;return t=t||e.getAttribute("width")||"",n=n||e.getAttribute("height")||"",{width:t,height:n}}function mfe({element:e,parse:t}){const{width:n,height:r}=hfe(e);return{...t(e),alt:e.getAttribute("alt")??"",height:Number.parseInt(r||"0",10)||null,src:e.getAttribute("src")??null,title:e.getAttribute("title")??"",width:Number.parseInt(n||"0",10)||null,fileName:e.getAttribute("data-file-name")??null}}function gfe(e,t){const n=document.createElement("div");return n.classList.add(Fle.IMAGE_LOADER),n}function vfe(e){be(e.length>0,{code:J.EXTENSION,message:"The upload handler was applied for the image extension without any valid files"});let t=0;const n=[];for(const{file:r,progress:o}of e)n.push(()=>new Promise(i=>{const s=new FileReader;s.addEventListener("load",a=>{var l;t+=1,o(t/e.length),i({src:(l=a.target)==null?void 0:l.result,fileName:r.name})},{once:!0}),s.readAsDataURL(r)}));return n}function yfe(e){return e.clipboardData!==void 0}function xfe(e={}){return new Ji({view(t){return new bfe(t,e)}})}class bfe{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return t.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r;if(n){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,t):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=kI(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}}var wfe=Object.defineProperty,Sfe=Object.getOwnPropertyDescriptor,kfe=(e,t,n,r)=>{for(var o=r>1?void 0:r?Sfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&wfe(t,n,o),o},sw=class extends ht{get name(){return"dropCursor"}createExternalPlugins(){const{color:e,width:t}=this.options;return[xfe({color:e,width:t})]}};sw=kfe([Ge({defaultOptions:{color:"black",width:1}})],sw);var Cfe=Object.defineProperty,Efe=Object.getOwnPropertyDescriptor,T4=(e,t,n,r)=>{for(var o=r>1?void 0:r?Efe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Cfe(t,n,o),o},{LABEL:_fe}=OX,Nfe={icon:({attrs:e})=>`h${(e==null?void 0:e.level)??"1"}`,label:({t:e,attrs:t})=>e({..._fe,values:{level:t==null?void 0:t.level}})},Ofe=[Z.H1,Z.H2,Z.H3,Z.H4,Z.H5,Z.H6],Bg=class extends io{get name(){return"heading"}createTags(){return[De.Block,De.TextBlock,De.FormattingNode]}createNodeSpec(e,t){return{content:"inline*",defining:!0,draggable:!1,...t,attrs:{...e.defaults(),level:{default:this.options.defaultLevel}},parseDOM:[...this.options.levels.map(n=>({tag:`h${n}`,getAttrs:r=>({...e.parse(r),level:n})})),...t.parseDOM??[]],toDOM:n=>this.options.levels.includes(n.attrs.level)?[`h${n.attrs.level}`,e.dom(n),0]:[`h${this.options.defaultLevel}`,e.dom(n),0]}}toggleHeading(e={}){return MD({type:this.type,toggleType:"paragraph",attrs:e})}createKeymap(e){const t=this.store.getExtension($e),n=ve(),r=[];for(const o of this.options.levels){const i=Ofe[o-1]??Z.H1;n[i]=Mg(this.type,{level:o}),r.push({attrs:{level:o},shortcut:e(i)[0]})}return t.updateDecorated("toggleHeading",{shortcut:r}),n}createInputRules(){return this.options.levels.map(e=>GX(new RegExp(`^(#{1,${e}})\\s$`),this.type,()=>({level:e})))}createPasteRules(){return this.options.levels.map(e=>({type:"node",nodeType:this.type,regexp:new RegExp(`^#{${e}}\\s([\\s\\w]+)$`),getAttributes:()=>({level:e}),startOfTextBlock:!0}))}};T4([he(Nfe)],Bg.prototype,"toggleHeading",1);Bg=T4([Ge({defaultOptions:{levels:[1,2,3,4,5,6],defaultLevel:1},staticKeys:["defaultLevel","levels"]})],Bg);var M4={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:Y4,function(){return function(n){function r(i){if(o[i])return o[i].exports;var s=o[i]={i,l:!1,exports:{}};return n[i].call(s.exports,s,s.exports,r),s.l=!0,s.exports}var o={};return r.m=n,r.c=o,r.d=function(i,s,a){r.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:a})},r.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return r.d(s,"a",s),s},r.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},r.p="",r(r.s=0)}([function(n,r,o){function i(){throw new TypeError("The given URL is not a string. Please verify your string|array.")}function s(c){typeof c!="string"&&i();for(var u=0,d=0,p=0,h=c.length,m=0;h--&&++m&&!(u&&-1<a.indexOf(c[m]));)c[m]==="."&&(++u,d=m);for(u=m,m=d;m--;)if(l.indexOf(c[m])!==-1){p=m+1;break}return 2>p?"":c.slice(p,u)}var a=["/",":","?","#"],l=[".","/","@"];n.exports=function(c){if(typeof c=="string")return s(c);if(Array.isArray(c)){var u=[],d,p=0;for(d=c.length;p<d;p++)u.push(s(c[p]));return u}i()}}])})})(M4);var Tfe=M4.exports;const Mfe=ga(Tfe);var Pfe=Object.defineProperty,jfe=Object.getOwnPropertyDescriptor,Jp=(e,t,n,r)=>{for(var o=r>1?void 0:r?jfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Pfe(t,n,o),o},Rfe=["com","de","net","org","uk","cn","ga","nl","cf","ml","tk","ru","br","gq","xyz","fr","eu","info","co","au","ca","it","in","ch","pl","es","online","us","top","be","jp","biz","se","at","dk","cz","za","me","ir","icu","shop","kr","site","mx","hu","io","cc","club","no","cyou"],eO="updateLink",Afe=/(?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)*(?:(?:\d(?!\.)|[a-z\u00A1-\uFFFF])(?:[\da-z\u00A1-\uFFFF][\w\u00A1-\uFFFF-]{0,62})?[\da-z\u00A1-\uFFFF]\.)+[a-z\u00A1-\uFFFF]{2,}(?::\d{2,5})?(?:[#/?]\S*)?/gi,_l=class extends Hp{constructor(){super(...arguments);_t(this,"_autoLinkRegexNonGlobal")}get name(){return"link"}createTags(){return[De.Link,De.ExcludeInputRules]}createMarkSpec(t,n){const r="data-link-auto",o=i=>{const{defaultTarget:s,supportedTargets:a}=this.options,l=s?[...a,s]:a;return i&&Lo(l,i)?{target:i}:void 0};return{inclusive:!1,excludes:"_",...n,attrs:{...t.defaults(),href:{},target:{default:this.options.defaultTarget},auto:{default:!1}},parseDOM:[{tag:"a[href]",getAttrs:i=>{if(!si(i))return!1;const s=i.getAttribute("href"),a=i.textContent,l=this.options.autoLink&&(i.hasAttribute(r)||s===a||(s==null?void 0:s.replace(`${this.options.defaultProtocol}//`,""))===a);return{...t.parse(i),href:s,auto:l,...o(i.getAttribute("target"))}}},...n.parseDOM??[]],toDOM:i=>{const{auto:s,target:a,...l}=ND(i.attrs,t),c=i.attrs.auto?{[r]:""}:{};return["a",{...t.dom(i),...l,rel:"noopener noreferrer nofollow",...c,...o(i.attrs.target)},0]}}}onCreate(){const{autoLinkRegex:t}=this.options;this._autoLinkRegexNonGlobal=new RegExp(`^${t.source}$`,t.flags.replace("g",""))}shortcut({tr:t}){let n="",{from:r,to:o,empty:i,$from:s}=t.selection,a=!1;const l=Hi(s,this.type);if(i){const c=l??CD(t);if(!c)return!1;({text:n,from:r,to:o}=c),a=!0}return r===o?!1:(a||(n=t.doc.textBetween(r,o)),this.options.onActivateLink(n),this.options.onShortcut({activeLink:l?{attrs:l.mark.attrs,from:l.from,to:l.to}:void 0,selectedText:n,from:r,to:o}),!0)}updateLink(t,n){return r=>{const{tr:o}=r;return!(Ml(o.selection)&&!KS(o.selection)||mee(o.selection)||Tg({trState:o,type:this.type}))&&!n?!1:(o.setMeta(this.name,{command:eO,attrs:t,range:n}),Iee({type:this.type,attrs:t,range:n})(r))}}selectLink(){return this.store.commands.selectMark.original(this.type)}removeLink(t){return n=>{const{tr:r}=n;return Tg({trState:r,type:this.type,...t})?jD({type:this.type,expand:!0,range:t})(n):!1}}createPasteRules(){return[{type:"mark",regexp:this.options.autoLinkRegex,markType:this.type,getAttributes:(t,n)=>({href:this.buildHref(Yd(t)),auto:!n}),transformMatch:t=>{const n=Yd(t);return!n||!this.isValidUrl(n)?!1:n}}]}createEventHandlers(){return{clickMark:(t,n)=>{const r=n.getMark(this.type);if(!r)return;const o=r.mark.attrs,i={...o,...r};if(this.options.onClick(t,i))return!0;if(!this.store.view.editable)return;let s=!1;if(this.options.openLinkOnClick){s=!0;const a=o.href;window.open(a,"_blank")}return this.options.selectTextOnClick&&(s=!0,this.store.commands.selectText(r)),s}}}createPlugin(){return{appendTransaction:(t,n,r)=>{if(t.filter(m=>!!m.getMeta(this.name)).forEach(m=>{const v=m.getMeta(this.name);if(v.command===eO){const{range:x,attrs:b}=v,{selection:w,doc:S}=r,k={range:x,selection:w,doc:S,attrs:b},{from:C,to:N}=x??w;this.options.onUpdateLink(S.textBetween(C,N),k)}}),!this.options.autoLink||ew(n)-ew(r)===1||!t.some(m=>m.docChanged))return;const a=nee(t,n),l=bee(a,[Tt,en]),{mapping:c}=a,{tr:u,doc:d}=r,{updateLink:p,removeLink:h}=this.store.chain(u);if(l.forEach(({prevFrom:m,prevTo:v,from:x,to:b})=>{const w=[],S=b-x===2,k=this.getLinkMarksInRange(n.doc,m,v,!0).filter(C=>C.mark.type===this.type).map(({from:C,to:N,text:_})=>({mappedFrom:c.map(C),mappedTo:c.map(N),text:_,from:C,to:N}));k.forEach(({mappedFrom:C,mappedTo:N,from:_,to:O},M)=>this.getLinkMarksInRange(d,C,N,!0).filter(P=>P.mark.type===this.type).forEach(P=>{const D=n.doc.textBetween(_,O,void 0," "),$=d.textBetween(P.from,P.to+1,void 0," ").trim(),U=this.isValidUrl(D);this.isValidUrl($)||(U&&(h({from:P.from,to:P.to}).tr(),k.splice(M,1)),!S&&x===b&&this.findAutoLinks($).map(G=>this.addLinkProperties({...G,from:C+G.start,to:C+G.end})).forEach(({attrs:G,range:j,text:T})=>{p(G,j).tr(),w.push({attrs:G,range:j,text:T})}))})),this.findTextBlocksInRange(d,{from:x,to:b}).forEach(({text:C,positionStart:N})=>{this.findAutoLinks(C).map(_=>this.addLinkProperties({..._,from:N+_.start+1,to:N+_.end+1})).filter(({range:_})=>{const O=x>=_.from&&x<=_.to,M=b>=_.from&&b<=_.to;return O||M||S}).filter(({range:_})=>this.getLinkMarksInRange(u.doc,_.from,_.to,!1).length===0).filter(({range:{from:_},text:O})=>!k.some(({text:M,mappedFrom:P})=>P===_&&M===O)).forEach(({attrs:_,text:O,range:M})=>{p(_,M).tr(),w.push({attrs:_,range:M,text:O})})}),window.requestAnimationFrame(()=>{w.forEach(({attrs:C,range:N,text:_})=>{const{doc:O,selection:M}=u;this.options.onUpdateLink(_,{attrs:C,doc:O,range:N,selection:M})})})}),u.steps.length!==0)return u}}}buildHref(t){return this.options.extractHref({url:t,defaultProtocol:this.options.defaultProtocol})}getLinkMarksInRange(t,n,r,o){const i=[];if(n===r){const s=Math.max(n-1,0),a=t.resolve(s),l=Hi(a,this.type);(l==null?void 0:l.mark.attrs.auto)===o&&i.push(l)}else t.nodesBetween(n,r,(s,a)=>{const c=(s.marks??[]).find(({type:u,attrs:d})=>u===this.type&&d.auto===o);c&&i.push({from:a,to:a+s.nodeSize,mark:c,text:s.textContent})});return i}findTextBlocksInRange(t,n){const r=[];return t.nodesBetween(n.from,n.to,(o,i)=>{!o.isTextblock||!o.type.allowsMarkType(this.type)||r.push({node:o,pos:i})}),r.map(o=>({text:t.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," "),positionStart:o.pos}))}addLinkProperties({from:t,to:n,href:r,...o}){return{...o,range:{from:t,to:n},attrs:{href:r,auto:!0}}}findAutoLinks(t){if(this.options.findAutoLinks)return this.options.findAutoLinks(t,this.options.defaultProtocol);const n=[];for(const r of Hv(t,this.options.autoLinkRegex)){const o=Yd(r);if(!o)continue;const i=this.buildHref(o);!this.isValidTLD(i)&&!i.startsWith("tel:")||n.push({text:o,href:i,start:r.index,end:r.index+o.length})}return n}isValidUrl(t){var n;return this.options.isValidUrl?this.options.isValidUrl(t,this.options.defaultProtocol):this.isValidTLD(this.buildHref(t))&&!!((n=this._autoLinkRegexNonGlobal)!=null&&n.test(t))}isValidTLD(t){const{autoLinkAllowedTLDs:n}=this.options;if(n.length===0)return!0;const r=Mfe(t);if(r==="")return!0;const o=pJ(r.split("."));return n.includes(o)}};Jp([Lr({shortcut:Z.InsertLink})],_l.prototype,"shortcut",1);Jp([he()],_l.prototype,"updateLink",1);Jp([he()],_l.prototype,"selectLink",1);Jp([he()],_l.prototype,"removeLink",1);_l=Jp([Ge({defaultOptions:{autoLink:!1,defaultProtocol:"",selectTextOnClick:!1,openLinkOnClick:!1,autoLinkRegex:Afe,autoLinkAllowedTLDs:Rfe,findAutoLinks:void 0,isValidUrl:void 0,defaultTarget:null,supportedTargets:[],extractHref:Ife},staticKeys:["autoLinkRegex"],handlerKeyOptions:{onClick:{earlyReturnValue:!0}},handlerKeys:["onActivateLink","onShortcut","onUpdateLink","onClick"],defaultPriority:et.Medium})],_l);function Ife({url:e,defaultProtocol:t}){const n=/^((?:https?|ftp)?:)\/\//.test(e);return!n&&e.includes("@")?`mailto:${e}`:n?e:`${t}//${e}`}var Dfe=Object.defineProperty,Lfe=Object.getOwnPropertyDescriptor,P4=(e,t,n,r)=>{for(var o=r>1?void 0:r?Lfe(t,n):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(r?s(t,n,o):s(o))||o);return r&&o&&Dfe(t,n,o),o},Vg=class extends io{get name(){return"hardBreak"}createTags(){return[De.InlineNode]}createNodeSpec(e,t){return{inline:!0,selectable:!1,atom:!0,leafText:()=>`
|
|
426
|
-
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=tee(Gd(LD),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};P4([he()],Vg.prototype,"insertHardBreak",1);Vg=P4([Ge({defaultPriority:et.Low})],Vg);const Ffe=()=>[new El({}),new ap,new lp,new cp({enableResizing:!1}),new sw({}),new Bg({levels:[1,2,3,4,5,6],defaultLevel:1}),new rp({}),new op,new _l({autoLink:!0}),new Vg].slice();function zfe(e){const{manager:t,state:n,setState:r}=Bce({extensions:Ffe,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function $fe({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,autoFocus:a}){const l=r&&Object.entries(r).some(([,p])=>p),[c,u]=g.useState(l),d=g.useMemo(()=>[xe("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[c]);return f.jsx("div",{autoFocus:a,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:xe("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:f.jsxs(Uce,{manager:n,initialContent:e,state:t,classNames:d,onChange:o,children:[f.jsx(Bfe,{hasOptions:l,options:r,debug:s,setShowToolbar:u}),f.jsx(nw,{})]})})}const Bfe=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,p,h,m,v,x,b,w,S,k,C,N,_,O,M,P,D,$,U,K,G,j,T,E,R;const o=xL(),i=Pce(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return f.jsxs("div",{children:[f.jsx("div",{className:"h-0",ref:a}),f.jsxs("div",{className:xe("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((d=e==null?void 0:e.block)==null?void 0:d.h4)||((p=e==null?void 0:e.block)==null?void 0:p.h5)||((h=e==null?void 0:e.block)==null?void 0:h.h6)||i.heading())&&f.jsxs($de,{children:[f.jsx(Bde,{asChild:!0,className:"pr-4",children:f.jsxs("button",{children:[i.heading({level:1})&&f.jsx(oE,{size:22}),i.heading({level:2})&&f.jsx(iE,{size:22}),i.heading({level:3})&&f.jsx(sE,{size:22}),i.heading({level:4})&&f.jsx(aE,{size:22}),i.heading({level:5})&&f.jsx(lE,{size:22}),i.heading({level:6})&&f.jsx(cE,{size:22}),!i.heading()&&"Normal"]})}),f.jsxs(N4,{container:a.current,children:[f.jsx(gs,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:f.jsx(oE,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:f.jsx(iE,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h3)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:f.jsx(sE,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h4)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:f.jsx(aE,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:f.jsx(lE,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:f.jsx(cE,{size:16})})]})]}),(((k=e==null?void 0:e.style)==null?void 0:k.bold)||i.bold())&&f.jsx(Gl,{icon:f.jsx(m9,{size:18}),stroke:3,isOption:(C=e==null?void 0:e.style)==null?void 0:C.bold,isActive:((N=e==null?void 0:e.style)==null?void 0:N.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((_=e==null?void 0:e.style)==null?void 0:_.lineThrough)||i.strike())&&f.jsx(Gl,{icon:f.jsx(L9,{size:18}),stroke:3,isOption:(O=e==null?void 0:e.style)==null?void 0:O.lineThrough,isActive:((M=e==null?void 0:e.style)==null?void 0:M.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((P=e==null?void 0:e.style)==null?void 0:P.italic)||i.italic())&&f.jsx(Gl,{icon:f.jsx(k9,{size:18}),stroke:3,isOption:(D=e==null?void 0:e.style)==null?void 0:D.italic,isActive:(($=e==null?void 0:e.style)==null?void 0:$.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((U=e==null?void 0:e.block)==null?void 0:U.ul)||i.bulletList())&&f.jsx(Gl,{icon:f.jsx(_9,{size:18}),stroke:3,isActive:((K=e==null?void 0:e.block)==null?void 0:K.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((G=e==null?void 0:e.block)==null?void 0:G.ol)||i.orderedList())&&f.jsx(Gl,{icon:f.jsx(E9,{size:18}),stroke:3,isActive:((j=e==null?void 0:e.block)==null?void 0:j.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((T=e==null?void 0:e.inline)==null?void 0:T.a)||i.link())&&f.jsx(Gl,{icon:f.jsx(C9,{size:18}),stroke:3,isActive:((E=e==null?void 0:e.inline)==null?void 0:E.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((R=e==null?void 0:e.inline)==null?void 0:R.img)||i.image())&&f.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[f.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:A=>{P2(A).then(I=>{o.insertImage({src:I.src,width:I.width,height:I.height,fileName:ue.createFilename(I.src,I.filename??null,{width:I.width,height:I.height,mimeType:I.mimeType},I.sha256)??void 0}).focus().run()})}}),f.jsx(S9,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&f.jsx("button",{onMouseDown:A=>A.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),f.jsx(Vfe,{})]})]})};function Vfe(){const e=xL(),[t,n]=g.useState(),r=jce().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?f.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[f.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),f.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:f.jsx(wp,{size:14})}),f.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:f.jsx(V9,{size:13})})]}):null}function Gl({stroke:e,isActive:t,onToggle:n,icon:r}){return f.jsx("button",{className:xe({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function Ufe({path:e,autoFocus:t}){const n="richtext",r=bp(),o=Ct(e),i=Je(e,n),s="data"in i?i.data:void 0,{state:a,manager:l}=zfe(s&&T7(s)),{patchPath:c,addDebouncedPatch:u}=yn(e);if(o.status==="error")return f.jsx(Rt,{path:e,error:o.error,type:n});if(i.status==="error")return f.jsx(qe,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return f.jsx(vn,{path:e,type:n});if(o.status==="loading")return f.jsx(nt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return f.jsx(nt,{path:e,type:n});if(o.data.type!==n)return f.jsx(pr,{path:e,expectedType:n,actualType:o.data.type});const d=o.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx($fe,{autoFocus:t,initialContent:a,options:d.options,manager:l,onChange:p=>{p.state.doc.eq(a.doc)||u(()=>{var h;return Wfe(c,((h=r==null?void 0:r.files)==null?void 0:h.directory)??"/public/val",p.state.doc.toJSON())},e)}})]})}function Wfe(e,t,n){const{blocks:r,files:o}=n?y7(n,t):{blocks:[],files:{}};return[{op:"replace",path:e,value:r},...Object.entries(o).flatMap(([i,{value:s,patchPaths:a}])=>a.map(l=>({op:"file",path:e,filePath:i,value:s,nestedFilePath:l})))]}function Hfe({path:e}){const t=Je(e,"richtext");if(t.status==="error")return f.jsx(qe,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return f.jsx(vn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});if(t.data===null)return f.jsx(lr,{path:e});const n=Kfe(t.data);return n.status==="error"?f.jsx(qe,{path:e,error:n.error,type:"richtext"}):f.jsx("div",{className:"truncate",children:n.value})}function Kfe(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function Sk({path:e}){const t=Ct(e),n=Je(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return f.jsx(lr,{path:e});if(r==="string")return f.jsx(hG,{path:e});if(r==="array")return f.jsx(Xfe,{path:e});if(r==="boolean")return f.jsx(vG,{path:e});if(r==="number")return f.jsx(xG,{path:e});if(r==="union")return f.jsx(fY,{path:e});if(r==="object")return f.jsx(aY,{path:e});if(r==="image")return f.jsx(xY,{path:e});if(r==="keyOf")return f.jsx(SY,{path:e});if(r==="date")return f.jsx(CY,{path:e});if(r==="literal")return f.jsx(EY,{path:e});if(r==="record")return f.jsx(NY,{path:e});if(r==="richtext")return f.jsx(Hfe,{path:e});if(r==="file")return f.jsx(vY,{path:e});{const o=r;return f.jsxs("div",{children:["Cannot preview: ",o]})}}function ar({path:e}){return f.jsx("div",{children:f.jsx(hu,{size:12,className:"animate-spin"})},e+"-loading")}function lr({path:e}){return f.jsx("div",{className:"text-text-quartenary",children:"null"},e+"-null")}function qfe({source:e,path:t,schema:n,onClick:r,onMove:o,onDelete:i}){const[s,a]=g.useState([]);g.useEffect(()=>{const u=[];let d=1;for(const p of e)u.push({path:p,id:d}),d++;a(u)},[e,t]);const l=UK(hx(AA),hx(IA),hx(gS,{coordinateGetter:fG})),c=g.useCallback(u=>{const{active:d,over:p}=u;if((d==null?void 0:d.id)!==(p==null?void 0:p.id)){const h=s.findIndex(v=>v.id===Number(d==null?void 0:d.id)),m=s.findIndex(v=>v.id===Number(p==null?void 0:p.id));a(v=>yS(v,h,m)),o(h,m)}},[s]);return f.jsx(Uq,{sensors:l,collisionDetection:HK,onDragEnd:c,children:f.jsx(nG,{items:s,strategy:eG,children:f.jsx("div",{className:"grid grid-cols-[min-content,min-content,1fr,min-content] gap-4",children:s.map(({path:u,id:d})=>f.jsx(Gfe,{id:d,schema:n,path:u,onClick:r,onDelete:p=>{i(p-1)}},d))})})})}const tO=170;function Gfe({id:e,path:t,schema:n,disabled:r,onClick:o,onDelete:i}){var x,b;const s=g.useRef(null),[a,l]=g.useState(!1);g.useEffect(()=>{s.current&&(s.current.getBoundingClientRect().height>=tO?l(!0):l(!1))},[e,t]);const{attributes:c,listeners:u,setNodeRef:d,transform:p,transition:h}=cG({id:e,disabled:r===!0}),{validationErrors:m}=Gi(),v={transform:$f.Transform.toString(p),transition:h};return f.jsxs("div",{"touch-action":"manipulation",ref:d,style:v,className:"grid items-start col-span-4 gap-2 grid-cols-subgrid disabled:opacity-55",children:[f.jsx("button",{...c,...u,className:xe("pt-2 my-1",{"opacity-30":r}),disabled:r,onClick:()=>{o(t)},children:f.jsx(w9,{})}),f.jsx("button",{className:"pt-2 my-1 font-serif text-accent",disabled:r,onClick:()=>{o(t)},children:Yfe(e)}),((x=n==null?void 0:n.item)==null?void 0:x.type)==="string"&&f.jsx(HA,{path:t}),((b=n==null?void 0:n.item)==null?void 0:b.type)!=="string"&&f.jsxs("button",{className:"relative grid p-4 overflow-hidden text-left border rounded border-border bg-card gap-y-2 grid-cols-subgrid cols-span-1",style:{maxHeight:tO},ref:s,disabled:r,onClick:()=>{o(t)},children:[f.jsx(Sk,{path:t}),a&&f.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),f.jsxs("button",{className:"flex items-center pt-4 gap-x-2",onClick:()=>{i(e)},children:[A2(t,m)?f.jsx(I2,{}):f.jsx("div",{className:"w-2 h-2"}),f.jsx(z9,{className:"w-4 h-4 mr-2"})]})]})}function Yfe(e){return"#"+e.toString()}function Jfe({path:e}){const t="array",{navigate:n}=fr(),r=Ct(e),o=Je(e,t),{addPatch:i,patchPath:s}=yn(e);if(r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(qe,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(r.status==="loading")return f.jsx(nt,{path:e,type:t});if(r.data.type!=="array")return f.jsx(pr,{path:e,expectedType:"array",actualType:r.data.type});const a=r.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(qfe,{path:e,onClick:l=>{n(l)},onDelete:async l=>{i([{op:"remove",path:s.concat(l.toString())}])},onMove:async(l,c)=>{i([{op:"move",from:s.concat(l.toString()),path:s.concat(c.toString())}])},schema:a,source:o.data||[]})]})}function Xfe({path:e}){const t=Je(e,"array");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{children:`${t.data.length} items`})}function dy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return f.jsx(HA,{path:e,autoFocus:n},e);if(t.type==="number")return f.jsx(yG,{path:e},e);if(t.type==="boolean")return f.jsx(mG,{path:e},e);if(t.type==="image")return f.jsx(yY,{path:e},e);if(t.type==="object")return f.jsx(sY,{path:e},e);if(t.type==="array")return f.jsx(Jfe,{path:e},e);if(t.type==="record")return f.jsx(_Y,{path:e},e);if(t.type==="union")return f.jsx(cY,{path:e},e);if(t.type==="keyOf")return f.jsx(bY,{path:e},e);if(t.type==="richtext")return f.jsx(Ufe,{path:e,autoFocus:n},e);if(t.type==="date")return f.jsx(kY,{path:e},e);if(t.type==="file")return f.jsx(gY,{path:e},e);if(t.type==="literal")return f.jsx(Rt,{path:e,error:"Literal fields are not editable"});{const r=t;return f.jsx(Rt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function Zfe({path:e}){const t=Ct(e),{path:n,schema:r}=C2(e),{navigate:o}=fr();if(t.status==="error")return f.jsx(Rt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return f.jsx(nt,{path:e,type:"module"});if(t.status==="not-found")return f.jsx(vn,{path:e,type:"module"});const i=t.data,s=N2(e),a=s.slice(0,-1),l=s[s.length-1],c=JG(e,n,r);return f.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[f.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[s.length>1&&f.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:a.map((u,d)=>d<a.length-1?f.jsxs(g.Fragment,{children:[f.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text}),f.jsx("span",{children:f.jsx(fv,{size:16})})]},d):f.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text},d))}),f.jsx("div",{children:f.jsxs("div",{className:"flex items-center justify-between h-6 gap-4 text-xl",children:[!c&&f.jsx("span",{children:l.text}),c&&f.jsxs("span",{children:["#",Number(l.text)+1]}),f.jsx(_2,{path:e,variant:"module"})]})})]}),f.jsx(dy,{path:e,schema:i},e)]})}function Qfe(){const e=t9();return f.jsxs(f.Fragment,{children:[f.jsx(epe,{}),f.jsx(Ua,{viewportId:"val-content-area",children:f.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?f.jsxs("div",{className:"p-8 mt-20 text-center text-text-error-primary bg-bg-error-primary",children:[f.jsx("p",{children:"Could not connect to the content service."}),f.jsx("p",{children:"Please try again later"})]}):f.jsx(tpe,{})})})]})}function epe(){const{navMenu:e,toolsMenu:t}=fy();return f.jsxs("div",{className:"flex items-center justify-between w-full h-16 px-4 border-b border-border-primary",children:[f.jsx("button",{className:xe({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:f.jsx(Ym,{size:16,className:xe("transform",{"rotate-180":!e.isOpen})})}),f.jsx("button",{className:xe({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:f.jsx(Ym,{size:16,className:xe("transform",{"rotate-180":t.isOpen})})})]})}function tpe(){const{currentSourcePath:e}=fr(),t=e;return f.jsx(Zfe,{path:t})}function npe(){const e=no();return f.jsx(kR,{open:!0,modal:!0,children:f.jsxs(Q1,{container:e,"aria-label":"Login required",children:[f.jsx(ER,{children:f.jsx(X1,{children:f.jsx("span",{children:"Log in required"})})}),f.jsx(_R,{children:"You need to log in to access Val."}),f.jsx(Ut,{asChild:!0,children:f.jsx("a",{href:ig("/api/val/authorize",{redirect_to:window.origin+ig("/val")}),children:"Log in"})})]})})}function rpe(){const{theme:e}=cv(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=fr();return g.useEffect(()=>{!t&&l&&(window.innerWidth<Uj?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),hP()==="login-required"?f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(npe,{})}):f.jsx(j4.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:i,setOpen:s}},children:f.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:xe("font-sans bg-bg-primary text-text-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&i,"xl:grid-cols-[320px,1fr]":r&&!i,"xl:grid-cols-[1fr,320px]":!r&&i}),...e?{"data-mode":e}:{},children:[f.jsx("div",{className:xe({hidden:!r,"w-[min(320px,100vw)] border-r overflow-x-hidden border-border-primary fixed top-0 left-0 xl:relative xl:left-auto z-[41]":r}),children:f.jsx(bH,{})}),f.jsx("div",{children:f.jsx(Qfe,{})}),f.jsx("div",{className:xe({hidden:!i,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":i}),children:f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(EK,{})})})]})})}const j4=ye.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function fy(){return g.useContext(j4)}const ope=({client:e})=>f.jsx(pP,{client:e,dispatchValEvents:!1,children:f.jsx(rpe,{})}),ipe=g.createContext(null),$x={didCatch:!1,error:null};class R4 extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=$x}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState($x)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&spe(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState($x)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(ipe.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function spe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const ape=({className:e})=>f.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[f.jsx("g",{filter:"url(#filter0_d_21_1677)",children:f.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),f.jsx("g",{filter:"url(#filter1_i_21_1677)",children:f.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),f.jsxs("defs",{children:[f.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),f.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function A4({error:e,resetErrorBoundary:t}){return console.error(e),f.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-bg-primary text-text-primary",children:f.jsx("div",{className:"w-full h-full p-10",children:f.jsxs("div",{className:"w-full h-full p-10 overflow-scroll bg-card text-primary",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[f.jsx(ape,{})," encountered an error"]}),f.jsx("button",{onClick:t,children:f.jsx(Mf,{})})]}),f.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),f.jsx("pre",{children:e.message}),e.stack&&f.jsx(ab,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:f.jsxs(If,{value:"error",children:[f.jsx(Df,{children:"Stack trace:"}),f.jsx(Lf,{className:"p-4 bg-bg-secondary",children:e.stack&&f.jsx("pre",{children:e.stack})})]})})]})})})}function lpe({root:e,children:t}){return Nr.createPortal(t,e)}const I4=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),f.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&f.jsx(lpe,{root:r,children:e})})},D4="/spa/index.css",cpe="val-app",upe="val-overlay";function L4(){return f.jsxs(f.Fragment,{children:[f.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),f.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),f.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function dpe(){const{client:e}=g.useMemo(()=>({client:tA("/api/val")}),[]);return f.jsxs(f.Fragment,{children:[f.jsx(L4,{}),f.jsxs(I4,{children:[f.jsx("link",{rel:"stylesheet",href:`/api/val/static${D4}`}),f.jsx(R4,{fallbackRender:A4,children:f.jsx(TP,{children:f.jsx(ope,{client:e})})})]})]})}function fpe(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const v=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),g.useEffect(()=>{if(t==="select"){let v;const x=()=>{const b=[];document.querySelectorAll("[data-val-path]").forEach(w=>{const S=w.getAttribute("data-val-path");if(!S)return;const k=w.getBoundingClientRect();b.push({top:k.top,left:k.left,width:k.width,height:k.height,joinedPaths:S})}),o(b),v=setTimeout(x,1e3)};return x(),()=>{clearTimeout(v)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const v=x=>{x.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=cv(),[u,d]=g.useState(null),p=bp(),h="val-menu-right-center";g.useEffect(()=>{try{const v=p&&localStorage.getItem("val-menu-drop-zone-"+((p==null?void 0:p.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(v)if(v==="val-menu-left-top"||v==="val-menu-left-center"||v==="val-menu-left-bottom"||v==="val-menu-center-top"||v==="val-menu-center-bottom"||v==="val-menu-right-top"||v==="val-menu-right-center"||v==="val-menu-right-bottom")d(v);else throw new Error("Invalid drop zone: "+v);else d(h)}catch(v){console.error("Error getting drop zone from local storage",v),d(h)}},[(p==null?void 0:p.project)||"unknown"]);const m=v=>{d(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((p==null?void 0:p.project)||"unknown"),v),localStorage.setItem("val-menu-drop-zone-default",v))}catch(x){console.error("Error setting drop zone to local storage",x)}};return f.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[f.jsx(ppe,{editMode:a,setMode:n,setEditMode:l}),r.map((v,x)=>f.jsx("div",{className:"absolute top-0 border border-bg-brand-primary z-[8998] hover:border-2 rounded",onClickCapture:b=>{b.stopPropagation(),n(null),l({joinedPaths:v.joinedPaths,clientY:b.clientY,clientX:b.clientX,boundingBox:v})},style:{display:"block",top:(v==null?void 0:v.top)+i.y,left:(v==null?void 0:v.left)+i.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:f.jsx("div",{className:"relative top-0 left-0 w-full",children:f.jsx("div",{className:"absolute top-[0px] right-[0px] truncate bg-bg-brand-primary text-text-brand-primary flex gap-2 px-2 rounded-bl hover:opacity-20 cursor-pointer",style:{fontSize:`${Math.min(v.height-2,10)}px`,maxHeight:`${Math.min(v.height-2,16)}px`,maxWidth:`${Math.min(v.width-2,300)}px`},children:ue.splitJoinedSourcePaths(v.joinedPaths).map(b=>{const[w,S]=ue.splitModuleFilePathAndModulePath(b),k=w.split("/").slice(1),C=S?ue.splitModulePath(S):[];return f.jsxs("span",{children:[k.length>0&&f.jsx("span",{children:"/"}),k.length>0&&k.map((N,_)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{children:ia(N)}),_<k.length-1&&f.jsx("span",{children:"/"})]},`${N}-${_}`)),C.length>0&&f.jsx("span",{children:"/"}),C.length>0&&C.map((N,_)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{children:pv(N)}),_<C.length-1&&f.jsx("span",{children:"/"})]},`${N}-${_}`))]},b)})})})},x)),a===null&&f.jsx(mpe,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function ppe({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:window.innerWidth,y:window.innerHeight}),[i,s]=g.useState(window.innerWidth),a=g.useRef(null);g.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:d,innerHeight:p}=window,{offsetWidth:h,offsetHeight:m}=a.current,v=m,x=h;let b=e.clientX,w=e.clientY;const S=80,k=d-(e.clientX+x);k<0&&(b=b+(k-S));const C=p-(e.clientY+v);C<0&&(w=w+(C-S)),o({x:b,y:w})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),g.useEffect(()=>{const u=()=>{s(window.innerWidth),i<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=g.useState(!1);return g.useEffect(()=>{if(l){const u=h=>{if(h instanceof MouseEvent)o(m=>({x:m.x+h.movementX,y:m.y+h.movementY}));else{const m=h.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},d=()=>{c(!1)},p=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",d),window.addEventListener("click",p),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),window.removeEventListener("click",p)}}},[l]),g.useEffect(()=>{const u=d=>{d.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),f.jsxs("div",{className:xe("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[f.jsx("div",{className:xe("fixed top-0 left-0",{hidden:e===null,"opacity-100 w-[100vw] h-[100svh]":e!==null}),onClick:u=>{u.preventDefault(),l||(t("select"),n(null))}}),f.jsxs("div",{className:xe("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-text-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":i<1024}),ref:a,style:{top:r.y,left:r.x},children:[f.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("form",{className:"flex flex-col items-start justify-start w-full gap-4 lg:justify-start",onSubmit:u=>{u.preventDefault(),u.stopPropagation(),t("select"),n(null)},children:[e&&ue.splitJoinedSourcePaths(e.joinedPaths).map(u=>f.jsxs(g.Fragment,{children:[f.jsx("div",{children:f.jsx(ES,{disabled:!1,path:u})}),f.jsx(hpe,{path:u})]},u)),f.jsx(Ut,{className:"self-end",type:"submit",children:"Done"})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}function hpe({path:e}){const t=Ct(e);return!("data"in t)||t.data===void 0?f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx(nt,{path:e})}):f.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:f.jsx(dy,{path:e,schema:t.data,autoFocus:!0})})}function nO({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",d=hP(),p=no(),{theme:h,setTheme:m}=cv(),v=S1(),[x,b]=g.useState(0),w=w1();g.useEffect(()=>{const C=()=>{window.innerWidth<400?b(-56):b(32)};return C(),window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[]);const{publishDisabled:S}=pu(),k=e==="val-menu-center-bottom"?"top":e==="val-menu-center-top"?"bottom":e==="val-menu-right-center"?"left":e==="val-menu-left-center"?"right":e==="val-menu-left-bottom"||e==="val-menu-right-bottom"?"top":e==="val-menu-right-top"||e==="val-menu-left-top"?"bottom":"top";return f.jsxs("div",{className:"p-4 right-16",children:[l&&f.jsx("div",{className:Ug(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx(Qy,{className:"animate-spin",size:16})})}),d==="login-required"&&f.jsx("div",{className:Ug(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx("a",{href:ig("/api/val/authorize",{redirect_to:window.location.href}),children:f.jsx(N9,{size:16})})})}),f.jsx(NR,{}),f.jsx(Pf,{isOpen:n&&!r&&!l&&d!=="login-required",children:f.jsxs("div",{className:xe("flex relative rounded bg-bg-primary border border-border-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(Yl,{label:"Pick content",active:i==="select",onClick:()=>s(C=>C==="select"?null:"select"),icon:f.jsx(I9,{size:16})}),f.jsx(Yl,{label:"Disable preview mode",disabled:r,icon:r?f.jsx(Qy,{size:16,className:"animate-spin"}):f.jsx(b9,{size:16}),onClick:()=>o(!1)}),f.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),f.jsxs(ca,{children:[f.jsx(Af,{className:xe("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsxs("div",{className:"relative",children:[w.length>0&&f.jsx("div",{className:"absolute -top-3 -right-3",children:f.jsxs("div",{className:"w-4 h-4 text-[9px] leading-4 text-center rounded-full bg-bg-brand-primary",children:[w.length>9&&f.jsx("span",{children:"9+"}),w.length<=9&&f.jsx("span",{children:w.length})]})}),f.jsx(k1,{size:16})]})}),f.jsxs(Ui,{container:p,align:"center",side:k,sideOffset:x,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[f.jsx("div",{className:"absolute sm:hidden top-4 right-4",children:f.jsx(B1,{children:f.jsx(Mf,{size:16})})}),!S&&f.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:f.jsx(rO,{})}),f.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px] overflow-scroll",children:f.jsx(rR,{loadingStatus:v})}),!S&&f.jsx("div",{className:"hidden py-4 sm:block",children:f.jsx(rO,{})})]})]}),f.jsx(Yl,{label:"Studio",icon:f.jsx(uE,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsxs(ca,{children:[f.jsx(Af,{className:xe("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsx(kP,{size:16})}),f.jsx(Ui,{container:p,className:"z-[9003]",children:f.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[f.jsx("span",{children:"Dock to top"}),f.jsx("button",{onClick:()=>{c("val-menu-center-top")},children:f.jsx(j9,{size:16})}),f.jsx("span",{children:"Dock to right"}),f.jsx("button",{onClick:()=>{c("val-menu-right-center")},children:f.jsx(P9,{size:16})}),f.jsx("span",{children:"Dock to left"}),f.jsx("button",{onClick:()=>{c("val-menu-left-center")},children:f.jsx(M9,{size:16})}),f.jsx("span",{children:"Dock to bottom"}),f.jsx("button",{onClick:()=>{c("val-menu-center-bottom")},children:f.jsx(T9,{size:16})}),f.jsx("span",{children:"Dark mode"}),f.jsx(W1,{checked:h==="dark",onCheckedChange:C=>{m(C?"dark":"light")}})]})})]})]})}),f.jsx(Pf,{isOpen:!(n&&!r)&&!l&&d!=="login-required",children:f.jsxs("div",{className:xe("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(Yl,{label:"Enable preview mode",disabled:r,icon:r?f.jsx(Qy,{size:16,className:"animate-spin"}):f.jsx(CP,{size:16}),onClick:()=>{o(!0)}}),f.jsx(Yl,{label:"Studio",icon:f.jsx(uE,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsx(Yl,{label:"Disable Val",icon:f.jsx(Mf,{size:16}),onClick:()=>a()})]})})]})}function rO(){const{publishDisabled:e,isPublishing:t,publish:n}=pu(),r=uv();return f.jsxs(Ut,{className:"mx-4 ",disabled:e,onClick:()=>{n()},children:[!t&&f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{children:r==="fs"?"Save":"Publish"}),f.jsx(k1,{size:16})]}),t&&f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{children:"Publishing"}),f.jsx(hu,{size:16,className:"animate-spin"})]})]})}function Yl({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return f.jsx("button",{disabled:n,className:xe("p-2 rounded-full disabled:bg-bg-disabled",{"bg-bg-brand-primary text-text-brand-primary":i==="primary","text-bg-brand-primary":!!r}),onClick:t,"aria-label":o,title:o,children:e})}function mpe(e){const[t,n]=g.useState(!1),{dropZone:r,setDropZone:o}=e,[i,s]=g.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),s(c)};return f.jsxs(f.Fragment,{children:[r&&f.jsx("div",{className:xe("z-[8999] cursor-grab",Ug(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:f.jsx(nO,{...e,dropZone:r})}),t&&r&&f.jsxs(f.Fragment,{children:[i&&i!==r&&f.jsx("div",{className:xe("z-[3]",Ug(i)),onDrop:a(i),onDragOver:l(i),children:f.jsx(nO,{ghost:!0,...e,dropZone:i})}),f.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[f.jsx(ds,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx("div",{}),f.jsx(ds,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function Ug(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const ds=({id:e,onDrop:t,onDragOver:n})=>f.jsx("div",{onDrop:t(e),onDragOver:n(e)});function gpe(){const e="/api/val",t=tA(e),[n,r]=g.useState(!1),[o,i]=g.useState(!1);return g.useEffect(()=>{const s=a=>{a instanceof CustomEvent?(a==null?void 0:a.detail.type)==="draftMode"&&typeof(a==null?void 0:a.detail.value)=="boolean"?r(a.detail.value):a.detail.type==="draftModeLoading"&&typeof a.detail.value=="boolean"?i(a.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",a.detail):console.error("Val: invalid event (val-overlay-spa)",a)};return window.addEventListener("val-overlay-spa",s),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",s)}},[]),f.jsxs(f.Fragment,{children:[f.jsx(L4,{}),f.jsxs(I4,{children:[f.jsx("style",{children:`
|
|
426
|
+
`,...t,attrs:e.defaults(),parseDOM:[{tag:"br",getAttrs:e.parse},...t.parseDOM??[]],toDOM:n=>["br",e.dom(n)]}}createKeymap(){const e=tee(Gd(LD),()=>(this.store.commands.insertHardBreak(),!0));return{"Mod-Enter":e,"Shift-Enter":e}}insertHardBreak(){return e=>{const{tr:t,dispatch:n}=e;return n==null||n(t.replaceSelectionWith(this.type.create()).scrollIntoView()),!0}}};P4([he()],Vg.prototype,"insertHardBreak",1);Vg=P4([Ge({defaultPriority:et.Low})],Vg);const Ffe=()=>[new El({}),new ap,new lp,new cp({enableResizing:!1}),new sw({}),new Bg({levels:[1,2,3,4,5,6],defaultLevel:1}),new rp({}),new op,new _l({autoLink:!0}),new Vg].slice();function zfe(e){const{manager:t,state:n,setState:r}=Bce({extensions:Ffe,content:e,selection:"start"});return{manager:t,state:n,setState:r}}function $fe({initialContent:e,state:t,manager:n,options:r,onChange:o,onFocus:i,debug:s,autoFocus:a}){const l=r&&Object.entries(r).some(([,p])=>p),[c,u]=g.useState(l),d=g.useMemo(()=>[xe("p-4 outline-none focus:outline-none appearance-none bg-bg-primary rounded-b-md")],[c]);return f.jsx("div",{autoFocus:a,onFocus:()=>{i&&i(!0)},onBlur:()=>{i&&i(!1)},className:xe("relative text-base m-1 val-rich-text-editor focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 border border-input rounded-md"),children:f.jsxs(Uce,{manager:n,initialContent:e,state:t,classNames:d,onChange:o,children:[f.jsx(Bfe,{hasOptions:l,options:r,debug:s,setShowToolbar:u}),f.jsx(nw,{})]})})}const Bfe=({options:e,hasOptions:t,debug:n,setShowToolbar:r})=>{var l,c,u,d,p,h,m,v,x,b,w,S,k,C,N,_,O,M,P,D,$,U,K,G,j,T,E,R;const o=xL(),i=Pce(),s=t||i.heading()||i.image()||i.link()||i.bulletList()||i.orderedList()||i.bold()||i.italic()||i.strike();g.useEffect(()=>{r(s)},[s]);const a=g.useRef(null);return f.jsxs("div",{children:[f.jsx("div",{className:"h-0",ref:a}),f.jsxs("div",{className:xe("sticky top-0 flex flex-col py-2 z-[40] divide-y rounded-md rounded-b-none border-b border-input bg-primary-foreground",{hidden:!s}),children:[f.jsx("div",{className:"flex items-center justify-between",children:f.jsxs("div",{className:"flex flex-row items-center justify-start px-4 py-1 gap-x-3",children:[(((l=e==null?void 0:e.block)==null?void 0:l.h1)||((c=e==null?void 0:e.block)==null?void 0:c.h2)||((u=e==null?void 0:e.block)==null?void 0:u.h3)||((d=e==null?void 0:e.block)==null?void 0:d.h4)||((p=e==null?void 0:e.block)==null?void 0:p.h5)||((h=e==null?void 0:e.block)==null?void 0:h.h6)||i.heading())&&f.jsxs($de,{children:[f.jsx(Bde,{asChild:!0,className:"pr-4",children:f.jsxs("button",{children:[i.heading({level:1})&&f.jsx(oE,{size:22}),i.heading({level:2})&&f.jsx(iE,{size:22}),i.heading({level:3})&&f.jsx(sE,{size:22}),i.heading({level:4})&&f.jsx(aE,{size:22}),i.heading({level:5})&&f.jsx(lE,{size:22}),i.heading({level:6})&&f.jsx(cE,{size:22}),!i.heading()&&"Normal"]})}),f.jsxs(N4,{container:a.current,children:[f.jsx(gs,{onClick:()=>{o.setBlockNodeType("paragraph").focus().run()},children:"Normal"}),((m=e==null?void 0:e.block)==null?void 0:m.h1)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:1}).focus().run()},children:f.jsx(oE,{size:16})}),((v=e==null?void 0:e.block)==null?void 0:v.h2)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:2}).focus().run()},children:f.jsx(iE,{size:16})}),((x=e==null?void 0:e.block)==null?void 0:x.h3)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:3}).focus().run()},children:f.jsx(sE,{size:16})}),((b=e==null?void 0:e.block)==null?void 0:b.h4)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:4}).focus().run()},children:f.jsx(aE,{size:16})}),((w=e==null?void 0:e.block)==null?void 0:w.h5)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:5}).focus().run()},children:f.jsx(lE,{size:16})}),((S=e==null?void 0:e.block)==null?void 0:S.h6)&&f.jsx(gs,{onClick:()=>{o.setBlockNodeType("heading",{level:6}).focus().run()},children:f.jsx(cE,{size:16})})]})]}),(((k=e==null?void 0:e.style)==null?void 0:k.bold)||i.bold())&&f.jsx(Gl,{icon:f.jsx(m9,{size:18}),stroke:3,isOption:(C=e==null?void 0:e.style)==null?void 0:C.bold,isActive:((N=e==null?void 0:e.style)==null?void 0:N.bold)||i.bold(),onToggle:()=>o.toggleBold().focus().run()}),(((_=e==null?void 0:e.style)==null?void 0:_.lineThrough)||i.strike())&&f.jsx(Gl,{icon:f.jsx(L9,{size:18}),stroke:3,isOption:(O=e==null?void 0:e.style)==null?void 0:O.lineThrough,isActive:((M=e==null?void 0:e.style)==null?void 0:M.lineThrough)||i.strike(),onToggle:()=>o.toggleStrike().focus().run()}),(((P=e==null?void 0:e.style)==null?void 0:P.italic)||i.italic())&&f.jsx(Gl,{icon:f.jsx(k9,{size:18}),stroke:3,isOption:(D=e==null?void 0:e.style)==null?void 0:D.italic,isActive:(($=e==null?void 0:e.style)==null?void 0:$.italic)||i.italic(),onToggle:()=>o.toggleItalic().focus().run()}),(((U=e==null?void 0:e.block)==null?void 0:U.ul)||i.bulletList())&&f.jsx(Gl,{icon:f.jsx(_9,{size:18}),stroke:3,isActive:((K=e==null?void 0:e.block)==null?void 0:K.ul)||i.bulletList(),onToggle:()=>o.toggleBulletList().focus().run()}),(((G=e==null?void 0:e.block)==null?void 0:G.ol)||i.orderedList())&&f.jsx(Gl,{icon:f.jsx(E9,{size:18}),stroke:3,isActive:((j=e==null?void 0:e.block)==null?void 0:j.ol)||i.orderedList(),onToggle:()=>o.toggleOrderedList().focus().run()}),(((T=e==null?void 0:e.inline)==null?void 0:T.a)||i.link())&&f.jsx(Gl,{icon:f.jsx(C9,{size:18}),stroke:3,isActive:((E=e==null?void 0:e.inline)==null?void 0:E.a)||i.link(),onToggle:()=>o.selectMark("link").updateLink({href:""}).focus().run()}),(((R=e==null?void 0:e.inline)==null?void 0:R.img)||i.image())&&f.jsxs("label",{className:"cursor-pointer",htmlFor:"val-toolbar-image-select",children:[f.jsx("input",{hidden:!0,id:"val-toolbar-image-select",accept:"image/*",type:"file",onChange:A=>{P2(A).then(I=>{o.insertImage({src:I.src,width:I.width,height:I.height,fileName:ue.createFilename(I.src,I.filename??null,{width:I.width,height:I.height,mimeType:I.mimeType},I.sha256)??void 0}).focus().run()})}}),f.jsx(S9,{size:18,className:`${i.image()&&"stroke-[3px]"}`})]}),n&&f.jsx("button",{onMouseDown:A=>A.preventDefault(),onClick:()=>o.insertHardBreak().run(),children:"Br"})]})}),f.jsx(Vfe,{})]})]})};function Vfe(){const e=xL(),[t,n]=g.useState(),r=jce().link();return g.useEffect(()=>{const i=typeof r=="object"&&"href"in r&&typeof r.href=="string"?r.href:void 0;n(i)},[r==null?void 0:r.href]),r!==void 0?f.jsxs("div",{className:"flex items-center justify-start px-4 pt-1 gap-x-2",children:[f.jsx("input",{className:"bg-transparent text-accent",onChange:i=>{n(i.target.value)},defaultValue:t,placeholder:"https://"}),f.jsx("button",{className:"p-2",title:"Update",disabled:t===void 0,onClick:()=>{t!==void 0&&e.selectMark("link").updateLink({href:t}).focus().run()},children:f.jsx(wp,{size:14})}),f.jsx("button",{className:"p-2",title:"Remove",onClick:()=>{e.removeLink().focus().run()},children:f.jsx(V9,{size:13})})]}):null}function Gl({stroke:e,isActive:t,onToggle:n,icon:r}){return f.jsx("button",{className:xe({"text-accent":t,"stroke-[2px]":t&&e===2,"stroke-[3px]":t&&e===3}),onClick:o=>{o.preventDefault(),n()},children:r})}function Ufe({path:e,autoFocus:t}){const n="richtext",r=bp(),o=Ct(e),i=Je(e,n),s="data"in i?i.data:void 0,{state:a,manager:l}=zfe(s&&T7(s)),{patchPath:c,addDebouncedPatch:u}=yn(e);if(o.status==="error")return f.jsx(Rt,{path:e,error:o.error,type:n});if(i.status==="error")return f.jsx(qe,{path:e,error:i.error,type:n});if(i.status=="not-found"||o.status==="not-found")return f.jsx(vn,{path:e,type:n});if(o.status==="loading")return f.jsx(nt,{path:e,type:n});if(!("data"in i)||i.data===void 0)return f.jsx(nt,{path:e,type:n});if(o.data.type!==n)return f.jsx(pr,{path:e,expectedType:n,actualType:o.data.type});const d=o.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx($fe,{autoFocus:t,initialContent:a,options:d.options,manager:l,onChange:p=>{p.state.doc.eq(a.doc)||u(()=>{var h;return Wfe(c,((h=r==null?void 0:r.files)==null?void 0:h.directory)??"/public/val",p.state.doc.toJSON())},e)}})]})}function Wfe(e,t,n){const{blocks:r,files:o}=n?y7(n,t):{blocks:[],files:{}};return[{op:"replace",path:e,value:r},...Object.entries(o).flatMap(([i,{value:s,patchPaths:a}])=>a.map(l=>({op:"file",path:e,filePath:i,value:s,nestedFilePath:l})))]}function Hfe({path:e}){const t=Je(e,"richtext");if(t.status==="error")return f.jsx(qe,{path:e,error:t.error,type:"richtext"});if(t.status=="not-found")return f.jsx(vn,{path:e,type:"richtext"});if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});if(t.data===null)return f.jsx(lr,{path:e});const n=Kfe(t.data);return n.status==="error"?f.jsx(qe,{path:e,error:n.error,type:"richtext"}):f.jsx("div",{className:"truncate",children:n.value})}function Kfe(e){let t;function n(o){if(t)return t;if(typeof o=="string")return o;if(typeof o=="object"&&o){if("children"in o&&Array.isArray(o.children))return o.children.map(n).join(" ");if("tag"in o&&typeof o.tag=="string")return""}return t="Invalid richtext node: "+JSON.stringify(o),JSON.stringify(o)}const r=e.map(n).join(" ");return t?{status:"error",error:t}:{status:"ok",value:r}}function Sk({path:e}){const t=Ct(e),n=Je(e,"data"in t&&t.data.type?t.data.type:void 0);if(!("data"in t)||t.data===void 0)return f.jsx(ar,{path:e});const r=t.data.type;if("data"in n&&n.data===null)return f.jsx(lr,{path:e});if(r==="string")return f.jsx(hG,{path:e});if(r==="array")return f.jsx(Xfe,{path:e});if(r==="boolean")return f.jsx(vG,{path:e});if(r==="number")return f.jsx(xG,{path:e});if(r==="union")return f.jsx(fY,{path:e});if(r==="object")return f.jsx(aY,{path:e});if(r==="image")return f.jsx(xY,{path:e});if(r==="keyOf")return f.jsx(SY,{path:e});if(r==="date")return f.jsx(CY,{path:e});if(r==="literal")return f.jsx(EY,{path:e});if(r==="record")return f.jsx(NY,{path:e});if(r==="richtext")return f.jsx(Hfe,{path:e});if(r==="file")return f.jsx(vY,{path:e});{const o=r;return f.jsxs("div",{children:["Cannot preview: ",o]})}}function ar({path:e}){return f.jsx("div",{children:f.jsx(hu,{size:12,className:"animate-spin"})},e+"-loading")}function lr({path:e}){return f.jsx("div",{className:"text-text-quartenary",children:"null"},e+"-null")}function qfe({source:e,path:t,schema:n,onClick:r,onMove:o,onDelete:i}){const[s,a]=g.useState([]);g.useEffect(()=>{const u=[];let d=1;for(const p of e)u.push({path:p,id:d}),d++;a(u)},[e,t]);const l=UK(hx(AA),hx(IA),hx(gS,{coordinateGetter:fG})),c=g.useCallback(u=>{const{active:d,over:p}=u;if((d==null?void 0:d.id)!==(p==null?void 0:p.id)){const h=s.findIndex(v=>v.id===Number(d==null?void 0:d.id)),m=s.findIndex(v=>v.id===Number(p==null?void 0:p.id));a(v=>yS(v,h,m)),o(h,m)}},[s]);return f.jsx(Uq,{sensors:l,collisionDetection:HK,onDragEnd:c,children:f.jsx(nG,{items:s,strategy:eG,children:f.jsx("div",{className:"grid grid-cols-[min-content,min-content,1fr,min-content] gap-4",children:s.map(({path:u,id:d})=>f.jsx(Gfe,{id:d,schema:n,path:u,onClick:r,onDelete:p=>{i(p-1)}},d))})})})}const tO=170;function Gfe({id:e,path:t,schema:n,disabled:r,onClick:o,onDelete:i}){var x,b;const s=g.useRef(null),[a,l]=g.useState(!1);g.useEffect(()=>{s.current&&(s.current.getBoundingClientRect().height>=tO?l(!0):l(!1))},[e,t]);const{attributes:c,listeners:u,setNodeRef:d,transform:p,transition:h}=cG({id:e,disabled:r===!0}),{validationErrors:m}=Gi(),v={transform:$f.Transform.toString(p),transition:h};return f.jsxs("div",{"touch-action":"manipulation",ref:d,style:v,className:"grid items-start col-span-4 gap-2 grid-cols-subgrid disabled:opacity-55",children:[f.jsx("button",{...c,...u,className:xe("pt-2 my-1",{"opacity-30":r}),disabled:r,onClick:()=>{o(t)},children:f.jsx(w9,{})}),f.jsx("button",{className:"pt-2 my-1 font-serif text-accent",disabled:r,onClick:()=>{o(t)},children:Yfe(e)}),((x=n==null?void 0:n.item)==null?void 0:x.type)==="string"&&f.jsx(HA,{path:t}),((b=n==null?void 0:n.item)==null?void 0:b.type)!=="string"&&f.jsxs("button",{className:"relative grid p-4 overflow-hidden text-left border rounded border-border bg-card gap-y-2 grid-cols-subgrid cols-span-1",style:{maxHeight:tO},ref:s,disabled:r,onClick:()=>{o(t)},children:[f.jsx(Sk,{path:t}),a&&f.jsx("div",{className:"absolute bottom-0 left-0 w-full bg-gradient-to-b via-50% from-transparent via-card/90 to-card",style:{height:40}})]}),f.jsxs("button",{className:"flex items-center pt-4 gap-x-2",onClick:()=>{i(e)},children:[A2(t,m)?f.jsx(I2,{}):f.jsx("div",{className:"w-2 h-2"}),f.jsx(z9,{className:"w-4 h-4 mr-2"})]})]})}function Yfe(e){return"#"+(e-1).toString()}function Jfe({path:e}){const t="array",{navigate:n}=fr(),r=Ct(e),o=Je(e,t),{addPatch:i,patchPath:s}=yn(e);if(r.status==="error")return f.jsx(Rt,{path:e,error:r.error,type:t});if(o.status==="error")return f.jsx(qe,{path:e,error:o.error,type:t});if(o.status=="not-found"||r.status==="not-found")return f.jsx(vn,{path:e,type:t});if(r.status==="loading")return f.jsx(nt,{path:e,type:t});if(r.data.type!=="array")return f.jsx(pr,{path:e,expectedType:"array",actualType:r.data.type});const a=r.data;return f.jsxs("div",{children:[f.jsx(Rr,{path:e}),f.jsx(qfe,{path:e,onClick:l=>{n(l)},onDelete:async l=>{i([{op:"remove",path:s.concat(l.toString())}])},onMove:async(l,c)=>{i([{op:"move",from:s.concat(l.toString()),path:s.concat(c.toString())}])},schema:a,source:o.data||[]})]})}function Xfe({path:e}){const t=Je(e,"array");return t.status==="error"?f.jsx(qe,{path:e,error:t.error,type:"array"}):!("data"in t)||t.data===void 0?f.jsx(ar,{path:e}):t.data===null?f.jsx(lr,{path:e}):f.jsx("div",{children:`${t.data.length} items`})}function dy({path:e,schema:t,autoFocus:n}){if(t.type==="string")return f.jsx(HA,{path:e,autoFocus:n},e);if(t.type==="number")return f.jsx(yG,{path:e},e);if(t.type==="boolean")return f.jsx(mG,{path:e},e);if(t.type==="image")return f.jsx(yY,{path:e},e);if(t.type==="object")return f.jsx(sY,{path:e},e);if(t.type==="array")return f.jsx(Jfe,{path:e},e);if(t.type==="record")return f.jsx(_Y,{path:e},e);if(t.type==="union")return f.jsx(cY,{path:e},e);if(t.type==="keyOf")return f.jsx(bY,{path:e},e);if(t.type==="richtext")return f.jsx(Ufe,{path:e,autoFocus:n},e);if(t.type==="date")return f.jsx(kY,{path:e},e);if(t.type==="file")return f.jsx(gY,{path:e},e);if(t.type==="literal")return f.jsx(Rt,{path:e,error:"Literal fields are not editable"});{const r=t;return f.jsx(Rt,{path:e,error:"Unexpected field schema: "+JSON.stringify(r)})}}function Zfe({path:e}){const t=Ct(e),{path:n,schema:r}=C2(e),{navigate:o}=fr();if(t.status==="error")return f.jsx(Rt,{path:e,error:t.error,type:"module"});if(t.status==="loading")return f.jsx(nt,{path:e,type:"module"});if(t.status==="not-found")return f.jsx(vn,{path:e,type:"module"});const i=t.data,s=N2(e),a=s.slice(0,-1),l=s[s.length-1],c=JG(e,n,r);return f.jsxs("div",{className:"flex flex-col gap-6 pt-4 pb-40",children:[f.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[s.length>1&&f.jsx("div",{className:"inline-flex items-center text-sm text-text-quartenary",children:a.map((u,d)=>d<a.length-1?f.jsxs(g.Fragment,{children:[f.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text}),f.jsx("span",{children:f.jsx(fv,{size:16})})]},d):f.jsx("button",{onClick:()=>{o(u.sourcePath)},children:u.text},d))}),f.jsx("div",{children:f.jsxs("div",{className:"flex items-center justify-between h-6 gap-4 text-xl",children:[!c&&f.jsx("span",{children:l.text}),c&&f.jsxs("span",{children:["#",Number(l.text)]}),f.jsx(_2,{path:e,variant:"module"})]})})]}),f.jsx(dy,{path:e,schema:i},e)]})}function Qfe(){const e=t9();return f.jsxs(f.Fragment,{children:[f.jsx(epe,{}),f.jsx(Ua,{viewportId:"val-content-area",children:f.jsx("div",{className:"max-h-[calc(100svh-64px)] max-w-[800px] px-4 mx-auto",children:e==="service-unavailable"?f.jsxs("div",{className:"p-8 mt-20 text-center text-text-error-primary bg-bg-error-primary",children:[f.jsx("p",{children:"Could not connect to the content service."}),f.jsx("p",{children:"Please try again later"})]}):f.jsx(tpe,{})})})]})}function epe(){const{navMenu:e,toolsMenu:t}=fy();return f.jsxs("div",{className:"flex items-center justify-between w-full h-16 px-4 border-b border-border-primary",children:[f.jsx("button",{className:xe({"ml-[calc(320px+0.5rem)] xl:ml-0":e.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>e.setOpen(!e.isOpen),children:f.jsx(Ym,{size:16,className:xe("transform",{"rotate-180":!e.isOpen})})}),f.jsx("button",{className:xe({"mr-[calc(320px+0.5rem)] xl:mr-0":t.isOpen,"hidden lg:inline":e.isOpen||t.isOpen}),onClick:()=>t.setOpen(!t.isOpen),children:f.jsx(Ym,{size:16,className:xe("transform",{"rotate-180":t.isOpen})})})]})}function tpe(){const{currentSourcePath:e}=fr(),t=e;return f.jsx(Zfe,{path:t})}function npe(){const e=no();return f.jsx(kR,{open:!0,modal:!0,children:f.jsxs(Q1,{container:e,"aria-label":"Login required",children:[f.jsx(ER,{children:f.jsx(X1,{children:f.jsx("span",{children:"Log in required"})})}),f.jsx(_R,{children:"You need to log in to access Val."}),f.jsx(Ut,{asChild:!0,children:f.jsx("a",{href:ig("/api/val/authorize",{redirect_to:window.origin+ig("/val")}),children:"Log in"})})]})})}function rpe(){const{theme:e}=cv(),[t,n]=g.useState(!1),[r,o]=g.useState(!1),[i,s]=g.useState(!1),{currentSourcePath:a,ready:l}=fr();return g.useEffect(()=>{!t&&l&&(window.innerWidth<Uj?(a||o(!0),n(!0)):(s(!0),o(!0),n(!0)))},[t,l,a]),hP()==="login-required"?f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(npe,{})}):f.jsx(j4.Provider,{value:{navMenu:{isOpen:r,setOpen:o},toolsMenu:{isOpen:i,setOpen:s}},children:f.jsxs("main",{style:{visibility:"hidden",minHeight:"100svh",width:"100vw"},id:"val-app-container",className:xe("font-sans bg-bg-primary text-text-primary grid grid-cols-1",{"xl:grid-cols-[320px,1fr,320px]":r&&i,"xl:grid-cols-[320px,1fr]":r&&!i,"xl:grid-cols-[1fr,320px]":!r&&i}),...e?{"data-mode":e}:{},children:[f.jsx("div",{className:xe({hidden:!r,"w-[min(320px,100vw)] border-r overflow-x-hidden border-border-primary fixed top-0 left-0 xl:relative xl:left-auto z-[41]":r}),children:f.jsx(bH,{})}),f.jsx("div",{children:f.jsx(Qfe,{})}),f.jsx("div",{className:xe({hidden:!i,"w-[min(320px,100vw)] border-l border-border-primary fixed top-0 right-0 xl:relative xl:right-auto z-[42]":i}),children:f.jsx("div",{className:"min-h-[100svh] bg-bg-primary",children:f.jsx(EK,{})})})]})})}const j4=ye.createContext(new Proxy({},{get(){throw new Error("LayoutContext not provided")}}));function fy(){return g.useContext(j4)}const ope=({client:e})=>f.jsx(pP,{client:e,dispatchValEvents:!1,children:f.jsx(rpe,{})}),ipe=g.createContext(null),$x={didCatch:!1,error:null};class R4 extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=$x}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s<o;s++)i[s]=arguments[s];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:i,reason:"imperative-api"}),this.setState($x)}}componentDidCatch(t,n){var r,o;(r=(o=this.props).onError)===null||r===void 0||r.call(o,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:o}=this.props;if(r&&n.error!==null&&spe(t.resetKeys,o)){var i,s;(i=(s=this.props).onReset)===null||i===void 0||i.call(s,{next:o,prev:t.resetKeys,reason:"keys"}),this.setState($x)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:o}=this.props,{didCatch:i,error:s}=this.state;let a=t;if(i){const l={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")a=n(l);else if(r)a=g.createElement(r,l);else if(o!==void 0)a=o;else throw s}return g.createElement(ipe.Provider,{value:{didCatch:i,error:s,resetErrorBoundary:this.resetErrorBoundary}},a)}}function spe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const ape=({className:e})=>f.jsxs("svg",{width:"58",height:"34",viewBox:"0 0 58 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[f.jsx("g",{filter:"url(#filter0_d_21_1677)",children:f.jsx("path",{d:"M5 5.36426C5 5.16309 5.16309 5 5.36426 5H17.6581C17.8593 5 18.0223 5.16309 18.0223 5.36426V28.4949C18.0223 28.696 17.8593 28.8591 17.6581 28.8591H5.36426C5.16309 28.8591 5 28.696 5 28.4949V5.36426Z",fill:"hsl(var(--accent))"})}),f.jsx("g",{filter:"url(#filter1_i_21_1677)",children:f.jsx("circle",{cx:"11.4656",cy:"23.7595",r:"2.18557",fill:"currentColor"})}),f.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M52.8588 23.839H48.7257H48.537H48.1128C47.6715 23.839 47.4508 23.5942 47.4508 23.1044V13.7293C47.4508 13.5784 47.3285 13.4561 47.1777 13.4561H45.8118C45.6609 13.4561 45.5386 13.5784 45.5386 13.7293V15.1836C45.5386 15.2844 45.4569 15.3661 45.3561 15.3661C45.2876 15.3661 45.225 15.3275 45.1924 15.2672C44.805 14.5503 44.283 14.02 43.6264 13.6765C42.9563 13.301 42.2045 13.1132 41.3709 13.1132C40.6028 13.1132 39.8755 13.252 39.189 13.5295C38.5026 13.8071 37.8979 14.2152 37.3748 14.7539C36.8682 15.2764 36.4678 15.9212 36.1736 16.6885C35.8794 17.4558 35.7323 18.3374 35.7323 19.3332V19.725C35.7323 20.7372 35.8794 21.627 36.1736 22.3942C36.4678 23.1615 36.8682 23.8146 37.3748 24.3533C37.8979 24.8757 38.5026 25.2757 39.189 25.5532C39.8755 25.8144 40.6191 25.945 41.42 25.945C42.1881 25.945 42.9154 25.7491 43.6019 25.3573C44.2751 24.982 44.8058 24.4119 45.1941 23.6471C45.2255 23.5852 45.2886 23.5452 45.358 23.5452H45.3917C45.4728 23.5452 45.5386 23.611 45.5386 23.6921C45.5386 23.7904 45.544 23.8856 45.5547 23.9777V25.1392C45.5547 25.3904 45.7584 25.5941 46.0096 25.5941H47.2261C47.2914 25.5995 47.3581 25.6022 47.4263 25.6022H48.537H48.7257H57.7268C57.8777 25.6022 58 25.4799 58 25.329V24.1122C58 23.9614 57.8777 23.839 57.7268 23.839H55.3174C55.1665 23.839 55.0442 23.7167 55.0442 23.5659V8.73368C55.0442 8.58279 54.9219 8.46048 54.771 8.46048H50.5054C50.3545 8.46048 50.2322 8.58279 50.2322 8.73368V9.95043C50.2322 10.1013 50.3545 10.2236 50.5054 10.2236H52.8588C53.0097 10.2236 53.132 10.3459 53.132 10.4968V23.5659C53.132 23.7167 53.0097 23.839 52.8588 23.839ZM41.6161 24.1329C42.1881 24.1329 42.7111 24.0268 43.1851 23.8146C43.6754 23.6023 44.0922 23.3003 44.4354 22.9085C44.7786 22.5167 45.0483 22.0514 45.2444 21.5127C45.4406 20.9576 45.5386 20.3454 45.5386 19.6761V19.3822C45.5386 18.7292 45.4406 18.1333 45.2444 17.5946C45.0483 17.0395 44.7705 16.5661 44.4109 16.1743C44.0677 15.7824 43.6509 15.4804 43.1606 15.2682C42.6866 15.0396 42.1718 14.9254 41.6161 14.9254C41.044 14.9254 40.521 15.0315 40.0471 15.2437C39.5731 15.4559 39.1563 15.758 38.7968 16.1498C38.4535 16.5252 38.1839 16.9905 37.9877 17.5456C37.7916 18.0843 37.6936 18.6802 37.6936 19.3332V19.725C37.6936 21.1127 38.0531 22.1983 38.7722 22.982C39.5077 23.7493 40.4557 24.1329 41.6161 24.1329ZM31.1115 25.4191C31.0732 25.5287 30.9698 25.6022 30.8536 25.6022H27.4661C27.35 25.6022 27.2465 25.5287 27.2082 25.4191L23.1578 13.8193C23.0958 13.6417 23.2276 13.4561 23.4157 13.4561H25.089C25.2068 13.4561 25.3114 13.5316 25.3484 13.6435L28.9666 24.581C28.9942 24.6643 29.0721 24.7206 29.1599 24.7206C29.2477 24.7206 29.3256 24.6643 29.3532 24.581L32.9714 13.6435C33.0084 13.5316 33.1129 13.4561 33.2308 13.4561H34.9041C35.0922 13.4561 35.224 13.6417 35.162 13.8193L31.1115 25.4191Z",fill:"currentColor"}),f.jsxs("defs",{children:[f.jsxs("filter",{id:"filter0_d_21_1677",x:"0.124722",y:"0.124722",width:"22.7729",height:"33.6097",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"2.43764"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"out"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_21_1677"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_21_1677",result:"shape"})]}),f.jsxs("filter",{id:"filter1_i_21_1677",x:"9.28003",y:"21.5739",width:"4.37112",height:"4.37112",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[f.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),f.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),f.jsx("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),f.jsx("feOffset",{}),f.jsx("feGaussianBlur",{stdDeviation:"0.546392"}),f.jsx("feComposite",{in2:"hardAlpha",operator:"arithmetic",k2:"-1",k3:"1"}),f.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.219608 0 0 0 0 0.803922 0 0 0 0 0.501961 0 0 0 0.3 0"}),f.jsx("feBlend",{mode:"normal",in2:"shape",result:"effect1_innerShadow_21_1677"})]})]})]});function A4({error:e,resetErrorBoundary:t}){return console.error(e),f.jsx("div",{className:"absolute top-0 left-0 flex items-center justify-center w-screen h-screen bg-bg-primary text-text-primary",children:f.jsx("div",{className:"w-full h-full p-10",children:f.jsxs("div",{className:"w-full h-full p-10 overflow-scroll bg-card text-primary",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-[0.5em] text-lg font-bold text-center py-2",children:[f.jsx(ape,{})," encountered an error"]}),f.jsx("button",{onClick:t,children:f.jsx(Mf,{})})]}),f.jsx("div",{className:"text-4xl font-normal ",children:"Message:"}),f.jsx("pre",{children:e.message}),e.stack&&f.jsx(ab,{type:"single",className:"font-serif",collapsible:!0,defaultValue:"error",children:f.jsxs(If,{value:"error",children:[f.jsx(Df,{children:"Stack trace:"}),f.jsx(Lf,{className:"p-4 bg-bg-secondary",children:e.stack&&f.jsx("pre",{children:e.stack})})]})})]})})})}function lpe({root:e,children:t}){return Nr.createPortal(t,e)}const I4=({children:e,style:t})=>{const n=g.useRef(null),[r,o]=g.useState(null);return g.useLayoutEffect(()=>{if(n.current)if(n.current.shadowRoot)o(n.current.shadowRoot);else{const i=n.current.attachShadow({mode:"open"});o(i)}},[]),f.jsx("div",{ref:n,style:t,id:"val-shadow-root",children:r&&f.jsx(lpe,{root:r,children:e})})},D4="/spa/index.css",cpe="val-app",upe="val-overlay";function L4(){return f.jsxs(f.Fragment,{children:[f.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),f.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"use-credentials"}),f.jsx("link",{href:"https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Space+Grotesk:wght@300..700&display=swap",rel:"stylesheet"})]})}function dpe(){const{client:e}=g.useMemo(()=>({client:tA("/api/val")}),[]);return f.jsxs(f.Fragment,{children:[f.jsx(L4,{}),f.jsxs(I4,{children:[f.jsx("link",{rel:"stylesheet",href:`/api/val/static${D4}`}),f.jsx(R4,{fallbackRender:A4,children:f.jsx(TP,{children:f.jsx(ope,{client:e})})})]})]})}function fpe(e){const[t,n]=g.useState(null),[r,o]=g.useState([]),[i,s]=g.useState({x:0,y:0});g.useEffect(()=>{const v=()=>{s({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",v,{passive:!1}),()=>{window.removeEventListener("scroll",v)}},[]),g.useEffect(()=>{if(t==="select"){let v;const x=()=>{const b=[];document.querySelectorAll("[data-val-path]").forEach(w=>{const S=w.getAttribute("data-val-path");if(!S)return;const k=w.getBoundingClientRect();b.push({top:k.top,left:k.left,width:k.width,height:k.height,joinedPaths:S})}),o(b),v=setTimeout(x,1e3)};return x(),()=>{clearTimeout(v)}}else o([])},[t,i]);const[a,l]=g.useState(null);g.useEffect(()=>{if(t==="select"&&a===null){const v=x=>{x.key==="Escape"&&n(null)};return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v)}}},[t,a]);const{theme:c}=cv(),[u,d]=g.useState(null),p=bp(),h="val-menu-right-center";g.useEffect(()=>{try{const v=p&&localStorage.getItem("val-menu-drop-zone-"+((p==null?void 0:p.project)||"unknown"))||localStorage.getItem("val-menu-drop-zone-default");if(v)if(v==="val-menu-left-top"||v==="val-menu-left-center"||v==="val-menu-left-bottom"||v==="val-menu-center-top"||v==="val-menu-center-bottom"||v==="val-menu-right-top"||v==="val-menu-right-center"||v==="val-menu-right-bottom")d(v);else throw new Error("Invalid drop zone: "+v);else d(h)}catch(v){console.error("Error getting drop zone from local storage",v),d(h)}},[(p==null?void 0:p.project)||"unknown"]);const m=v=>{d(v);try{v&&(localStorage.setItem("val-menu-drop-zone-"+((p==null?void 0:p.project)||"unknown"),v),localStorage.setItem("val-menu-drop-zone-default",v))}catch(x){console.error("Error setting drop zone to local storage",x)}};return f.jsxs("div",{...c?{"data-mode":c}:{},id:"val-overlay-container",children:[f.jsx(ppe,{editMode:a,setMode:n,setEditMode:l}),r.map((v,x)=>f.jsx("div",{className:"absolute top-0 border border-bg-brand-primary z-[8998] hover:border-2 rounded",onClickCapture:b=>{b.stopPropagation(),n(null),l({joinedPaths:v.joinedPaths,clientY:b.clientY,clientX:b.clientX,boundingBox:v})},style:{display:"block",top:(v==null?void 0:v.top)+i.y,left:(v==null?void 0:v.left)+i.x,width:v==null?void 0:v.width,height:v==null?void 0:v.height},children:f.jsx("div",{className:"relative top-0 left-0 w-full",children:f.jsx("div",{className:"absolute top-[0px] right-[0px] truncate bg-bg-brand-primary text-text-brand-primary flex gap-2 px-2 rounded-bl hover:opacity-20 cursor-pointer",style:{fontSize:`${Math.min(v.height-2,10)}px`,maxHeight:`${Math.min(v.height-2,16)}px`,maxWidth:`${Math.min(v.width-2,300)}px`},children:ue.splitJoinedSourcePaths(v.joinedPaths).map(b=>{const[w,S]=ue.splitModuleFilePathAndModulePath(b),k=w.split("/").slice(1),C=S?ue.splitModulePath(S):[];return f.jsxs("span",{children:[k.length>0&&f.jsx("span",{children:"/"}),k.length>0&&k.map((N,_)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{children:ia(N)}),_<k.length-1&&f.jsx("span",{children:"/"})]},`${N}-${_}`)),C.length>0&&f.jsx("span",{children:"/"}),C.length>0&&C.map((N,_)=>f.jsxs(g.Fragment,{children:[f.jsx("span",{children:pv(N)}),_<C.length-1&&f.jsx("span",{children:"/"})]},`${N}-${_}`))]},b)})})})},x)),a===null&&f.jsx(mpe,{...e,mode:t,setMode:n,loading:c===null,dropZone:u,setDropZone:m})]})}function ppe({editMode:e,setMode:t,setEditMode:n}){const[r,o]=g.useState({x:window.innerWidth,y:window.innerHeight}),[i,s]=g.useState(window.innerWidth),a=g.useRef(null);g.useEffect(()=>{const u=()=>{e?setTimeout(()=>{if(a.current){const{innerWidth:d,innerHeight:p}=window,{offsetWidth:h,offsetHeight:m}=a.current,v=m,x=h;let b=e.clientX,w=e.clientY;const S=80,k=d-(e.clientX+x);k<0&&(b=b+(k-S));const C=p-(e.clientY+v);C<0&&(w=w+(C-S)),o({x:b,y:w})}},100):o({x:window.innerWidth,y:window.innerHeight})};window.innerWidth<1024?o({x:16,y:16}):u()},[e]),g.useEffect(()=>{const u=()=>{s(window.innerWidth),i<1024&&o({x:16,y:16})};return u(),window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u)}},[]);const[l,c]=g.useState(!1);return g.useEffect(()=>{if(l){const u=h=>{if(h instanceof MouseEvent)o(m=>({x:m.x+h.movementX,y:m.y+h.movementY}));else{const m=h.touches[0];o(()=>({x:m.clientX,y:m.clientY}))}},d=()=>{c(!1)},p=()=>{c(!1)};return window.addEventListener("mousemove",u),window.addEventListener("mouseup",d),window.addEventListener("click",p),()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),window.removeEventListener("click",p)}}},[l]),g.useEffect(()=>{const u=d=>{d.key==="Escape"&&(t("select"),n(null))};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[]),f.jsxs("div",{className:xe("fixed top-0 left-0 z-[8998]",{hidden:e===null,"opacity-100 w-[200svw] h-[100svh]":e!==null}),children:[f.jsx("div",{className:xe("fixed top-0 left-0",{hidden:e===null,"opacity-100 w-[100vw] h-[100svh]":e!==null}),onClick:u=>{u.preventDefault(),l||(t("select"),n(null))}}),f.jsxs("div",{className:xe("absolute grid grid-cols-[32px,1fr,32px] rounded bg-bg-primary text-text-primary cursor-pointer",{"w-[calc(100vw-32px)] h-[calc(100svh-32px)]":i<1024}),ref:a,style:{top:r.y,left:r.x},children:[f.jsx("div",{className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("div",{className:"grid grid-rows-[32px,1fr,32px]",children:[f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}}),f.jsxs("form",{className:"flex flex-col items-start justify-start w-full gap-4 lg:justify-start",onSubmit:u=>{u.preventDefault(),u.stopPropagation(),t("select"),n(null)},children:[e&&ue.splitJoinedSourcePaths(e.joinedPaths).map(u=>f.jsxs(g.Fragment,{children:[f.jsx("div",{children:f.jsx(ES,{disabled:!1,path:u})}),f.jsx(hpe,{path:u})]},u)),f.jsx(Ut,{className:"self-end",type:"submit",children:"Done"})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]}),f.jsx("div",{ref:a,className:"cursor-grab",onMouseDown:()=>{c(!0)}})]})]})}function hpe({path:e}){const t=Ct(e);return!("data"in t)||t.data===void 0?f.jsx("div",{className:"flex flex-col gap-4",children:f.jsx(nt,{path:e})}):f.jsx("div",{className:"flex flex-col gap-4 max-w-[600px] w-full",children:f.jsx(dy,{path:e,schema:t.data,autoFocus:!0})})}function nO({dropZone:e,ghost:t,draftMode:n,draftModeLoading:r,setDraftMode:o,mode:i,setMode:s,disableOverlay:a,loading:l,setDropZone:c}){const u=e==="val-menu-right-center"||e==="val-menu-left-center"?"vertical":"horizontal",d=hP(),p=no(),{theme:h,setTheme:m}=cv(),v=S1(),[x,b]=g.useState(0),w=w1();g.useEffect(()=>{const C=()=>{window.innerWidth<400?b(-56):b(32)};return C(),window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[]);const{publishDisabled:S}=pu(),k=e==="val-menu-center-bottom"?"top":e==="val-menu-center-top"?"bottom":e==="val-menu-right-center"?"left":e==="val-menu-left-center"?"right":e==="val-menu-left-bottom"||e==="val-menu-right-bottom"?"top":e==="val-menu-right-top"||e==="val-menu-left-top"?"bottom":"top";return f.jsxs("div",{className:"p-4 right-16",children:[l&&f.jsx("div",{className:Ug(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx(Qy,{className:"animate-spin",size:16})})}),d==="login-required"&&f.jsx("div",{className:Ug(e)+" p-4",children:f.jsx("div",{className:"flex items-center justify-center p-2 text-white bg-black rounded backdrop-blur",children:f.jsx("a",{href:ig("/api/val/authorize",{redirect_to:window.location.href}),children:f.jsx(N9,{size:16})})})}),f.jsx(NR,{}),f.jsx(Pf,{isOpen:n&&!r&&!l&&d!=="login-required",children:f.jsxs("div",{className:xe("flex relative rounded bg-bg-primary border border-border-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(Yl,{label:"Pick content",active:i==="select",onClick:()=>s(C=>C==="select"?null:"select"),icon:f.jsx(I9,{size:16})}),f.jsx(Yl,{label:"Disable preview mode",disabled:r,icon:r?f.jsx(Qy,{size:16,className:"animate-spin"}):f.jsx(b9,{size:16}),onClick:()=>o(!1)}),f.jsx("div",{className:"pb-1 mt-1 border-t border-border-primary"}),f.jsxs(ca,{children:[f.jsx(Af,{className:xe("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsxs("div",{className:"relative",children:[w.length>0&&f.jsx("div",{className:"absolute -top-3 -right-3",children:f.jsxs("div",{className:"w-4 h-4 text-[9px] leading-4 text-center rounded-full bg-bg-brand-primary",children:[w.length>9&&f.jsx("span",{children:"9+"}),w.length<=9&&f.jsx("span",{children:w.length})]})}),f.jsx(k1,{size:16})]})}),f.jsxs(Ui,{container:p,align:"center",side:k,sideOffset:x,className:"z-[9000] relative max-w-[352px] w-screen rounded-none sm:rounded flex flex-col items-end",children:[f.jsx("div",{className:"absolute sm:hidden top-4 right-4",children:f.jsx(B1,{children:f.jsx(Mf,{size:16})})}),!S&&f.jsx("div",{className:"flex items-center justify-between gap-4 px-4 py-4 pt-8 sm:hidden",children:f.jsx(rO,{})}),f.jsx("div",{className:"sm:max-h-[min(400px,80svh)] max-h-[calc(100svh-96px-64px)] w-[320px] overflow-scroll",children:f.jsx(rR,{loadingStatus:v})}),!S&&f.jsx("div",{className:"hidden py-4 sm:block",children:f.jsx(rO,{})})]})]}),f.jsx(Yl,{label:"Studio",icon:f.jsx(uE,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsxs(ca,{children:[f.jsx(Af,{className:xe("p-2 rounded-full disabled:bg-bg-disabled"),children:f.jsx(kP,{size:16})}),f.jsx(Ui,{container:p,className:"z-[9003]",children:f.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[f.jsx("span",{children:"Dock to top"}),f.jsx("button",{onClick:()=>{c("val-menu-center-top")},children:f.jsx(j9,{size:16})}),f.jsx("span",{children:"Dock to right"}),f.jsx("button",{onClick:()=>{c("val-menu-right-center")},children:f.jsx(P9,{size:16})}),f.jsx("span",{children:"Dock to left"}),f.jsx("button",{onClick:()=>{c("val-menu-left-center")},children:f.jsx(M9,{size:16})}),f.jsx("span",{children:"Dock to bottom"}),f.jsx("button",{onClick:()=>{c("val-menu-center-bottom")},children:f.jsx(T9,{size:16})}),f.jsx("span",{children:"Dark mode"}),f.jsx(W1,{checked:h==="dark",onCheckedChange:C=>{m(C?"dark":"light")}})]})})]})]})}),f.jsx(Pf,{isOpen:!(n&&!r)&&!l&&d!=="login-required",children:f.jsxs("div",{className:xe("flex relative rounded bg-bg-primary text-text-primary gap-2",{"flex-col py-4 px-2":u==="vertical","flex-row px-4 py-2":u==="horizontal","opacity-70":t}),children:[f.jsx(Yl,{label:"Enable preview mode",disabled:r,icon:r?f.jsx(Qy,{size:16,className:"animate-spin"}):f.jsx(CP,{size:16}),onClick:()=>{o(!0)}}),f.jsx(Yl,{label:"Studio",icon:f.jsx(uE,{size:16}),onClick:()=>{window.location.href=window.origin+"/val/~"}}),f.jsx(Yl,{label:"Disable Val",icon:f.jsx(Mf,{size:16}),onClick:()=>a()})]})})]})}function rO(){const{publishDisabled:e,isPublishing:t,publish:n}=pu(),r=uv();return f.jsxs(Ut,{className:"mx-4 ",disabled:e,onClick:()=>{n()},children:[!t&&f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{children:r==="fs"?"Save":"Publish"}),f.jsx(k1,{size:16})]}),t&&f.jsxs("span",{className:"flex items-center gap-1",children:[f.jsx("span",{children:"Publishing"}),f.jsx(hu,{size:16,className:"animate-spin"})]})]})}function Yl({icon:e,onClick:t,disabled:n,active:r,label:o,variant:i}){return f.jsx("button",{disabled:n,className:xe("p-2 rounded-full disabled:bg-bg-disabled",{"bg-bg-brand-primary text-text-brand-primary":i==="primary","text-bg-brand-primary":!!r}),onClick:t,"aria-label":o,title:o,children:e})}function mpe(e){const[t,n]=g.useState(!1),{dropZone:r,setDropZone:o}=e,[i,s]=g.useState(null),a=c=>u=>{u.preventDefault(),o(c)},l=c=>u=>{u.preventDefault(),s(c)};return f.jsxs(f.Fragment,{children:[r&&f.jsx("div",{className:xe("z-[8999] cursor-grab",Ug(r)),draggable:!0,onDragStart:()=>{n(!0)},onDragEnd:()=>{n(!1)},children:f.jsx(nO,{...e,dropZone:r})}),t&&r&&f.jsxs(f.Fragment,{children:[i&&i!==r&&f.jsx("div",{className:xe("z-[3]",Ug(i)),onDrop:a(i),onDragOver:l(i),children:f.jsx(nO,{ghost:!0,...e,dropZone:i})}),f.jsxs("div",{className:"fixed top-0 left-0 grid w-screen h-screen grid-cols-3 grid-rows-3 z-[2]",children:[f.jsx(ds,{id:"val-menu-left-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-center-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-right-top",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-left-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx("div",{}),f.jsx(ds,{id:"val-menu-right-center",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-left-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-center-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l}),f.jsx(ds,{id:"val-menu-right-bottom",dropZone:r,dragOverDropZone:i,onDrop:a,onDragOver:l})]})]})]})}function Ug(e){let t="fixed transform";return e==="val-menu-left-top"?t+=" left-0 top-0":e==="val-menu-left-center"?t+=" left-0 top-1/2 -translate-y-1/2":e==="val-menu-left-bottom"?t+=" left-0 bottom-0":e==="val-menu-center-top"?t+=" left-1/2 -translate-x-1/2 top-0":e==="val-menu-center-bottom"?t+=" left-1/2 -translate-x-1/2 bottom-0":e==="val-menu-right-top"?t+=" right-0 top-0":e==="val-menu-right-center"?t+=" right-0 top-1/2 -translate-y-1/2":t+=" right-0 bottom-0",t}const ds=({id:e,onDrop:t,onDragOver:n})=>f.jsx("div",{onDrop:t(e),onDragOver:n(e)});function gpe(){const e="/api/val",t=tA(e),[n,r]=g.useState(!1),[o,i]=g.useState(!1);return g.useEffect(()=>{const s=a=>{a instanceof CustomEvent?(a==null?void 0:a.detail.type)==="draftMode"&&typeof(a==null?void 0:a.detail.value)=="boolean"?r(a.detail.value):a.detail.type==="draftModeLoading"&&typeof a.detail.value=="boolean"?i(a.detail.value):console.error("Val: invalid event detail (val-overlay-spa)",a.detail):console.error("Val: invalid event (val-overlay-spa)",a)};return window.addEventListener("val-overlay-spa",s),window.dispatchEvent(new CustomEvent("val-overlay-provider",{detail:{type:"spa-ready"}})),()=>{window.removeEventListener("val-overlay-spa",s)}},[]),f.jsxs(f.Fragment,{children:[f.jsx(L4,{}),f.jsxs(I4,{children:[f.jsx("style",{children:`
|
|
427
427
|
#val-overlay-container {
|
|
428
428
|
visibility: hidden;
|
|
429
429
|
}
|