File "useMetadataColumns-1.0.13-00fd71bb.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/wp-data-access/assets/dist/useMetadataColumns-1.0.13-00fd71bb.js
File size: 63.52 KB
MIME-type: text/plain
Charset: utf-8

import{r as a,j as o,bc as Y,bf as Ee,d4 as Zn,l as F,dT as er,dU as tr,c8 as nr,d1 as rr,a6 as jt,cu as or,e as vt,C as Vt,bz as hn,cb as qt,a5 as sr}from"./main-1.0.13.js";import{u as Rt,D as st,B as k,av as ir,aG as lr,l as ar,h as cr,s as De,q as tt,d as ur,r as dr,p as fr,e as Jt,c as pn}from"./main-1.0.13-4cbe632d.js";import{u as hr}from"./useStoreTable-1.0.13-383948b4.js";import{B as U}from"./useScreenSize-1.0.13-fa31f819.js";import{A as Et}from"./AdminTheme-1.0.13-a1e60de2.js";import{f as pr,g as gr}from"./index.esm-1.0.13-cc102a96.js";import{a as vr,b as br,c as xr}from"./ActionsDml-1.0.13-147ce8d4.js";import{j as mr,g as yr,h as Cr}from"./index.esm-1.0.13-0afa0259.js";import{S as _e,F as Te,a as ue,T as ge,b as Qt}from"./TextField-1.0.13-7258d491.js";import{M as ce}from"./MenuItem-1.0.13-e7719456.js";import{e as wr,g as Sr,s as gn,_ as rt,u as jr,a as Rr,c as Er,b as Dr,I as Tr}from"./iconBase-1.0.13-98e06aa9.js";import{M as kr}from"./Menu-1.0.13-2a06ef00.js";import{c as bt}from"./index-1.0.13-93f67fc3.js";import{u as vn}from"./useTableUpdater-1.0.13-f903232c.js";import{c as Ar,d as Mr,S as Ir,a as Nr,b as Or}from"./Stepper-1.0.13-4e64ee4c.js";import{f as bn,C as Lr,S as Fr}from"./settings-1.0.13-650559d5.js";import{F as xn}from"./FormControlLabel-1.0.13-143a10df.js";import{C as Br}from"./Checkbox-1.0.13-3ec10fcc.js";import{L as Zt,A as mn}from"./Link-1.0.13-03de5435.js";import{A as yn,a as Cn}from"./AccordionSummary-1.0.13-0885ed32.js";function Pr(e){return wr("MuiStepContent",e)}Sr("MuiStepContent",["root","last","transition"]);const zr=["children","className","TransitionComponent","transitionDuration","TransitionProps"],_r=e=>{const{classes:t,last:n}=e;return Dr({root:["root",n&&"last"],transition:["transition"]},Pr,t)},Wr=gn("div",{name:"MuiStepContent",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.last&&t.last]}})(({ownerState:e,theme:t})=>rt({marginLeft:12,paddingLeft:8+12,paddingRight:8,borderLeft:t.vars?`1px solid ${t.vars.palette.StepContent.border}`:`1px solid ${t.palette.mode==="light"?t.palette.grey[400]:t.palette.grey[600]}`},e.last&&{borderLeft:"none"})),Ur=gn(bn,{name:"MuiStepContent",slot:"Transition",overridesResolver:(e,t)=>t.transition})({}),$r=a.forwardRef(function(t,n){const r=jr({props:t,name:"MuiStepContent"}),{children:s,className:i,TransitionComponent:l=bn,transitionDuration:c="auto",TransitionProps:u}=r,d=Rr(r,zr);a.useContext(Ar);const{active:h,last:f,expanded:v}=a.useContext(Mr),g=rt({},r,{last:f}),p=_r(g);let x=c;return c==="auto"&&!l.muiSupportAuto&&(x=void 0),o.jsx(Wr,rt({className:Er(p.root,i),ref:n,ownerState:g},d,{children:o.jsx(Ur,rt({as:l,in:h||v,className:p.transition,ownerState:g,timeout:x,unmountOnExit:!0},u,{children:s}))}))}),Yr=$r;function Xr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return a.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const dt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ae(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function It(e){return"nodeType"in e}function X(e){var t,n;return e?Ae(e)?e:It(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Nt(e){const{Document:t}=X(e);return e instanceof t}function Ke(e){return Ae(e)?!1:e instanceof X(e).HTMLElement}function wn(e){return e instanceof X(e).SVGElement}function Me(e){return e?Ae(e)?e.document:It(e)?Nt(e)?e:Ke(e)||wn(e)?e.ownerDocument:document:document:document}const ee=dt?a.useLayoutEffect:a.useEffect;function Ot(e){const t=a.useRef(e);return ee(()=>{t.current=e}),a.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function Hr(){const e=a.useRef(null),t=a.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=a.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ye(e,t){t===void 0&&(t=[e]);const n=a.useRef(e);return ee(()=>{n.current!==e&&(n.current=e)},t),n}function Ge(e,t){const n=a.useRef();return a.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function it(e){const t=Ot(e),n=a.useRef(null),r=a.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function Dt(e){const t=a.useRef();return a.useEffect(()=>{t.current=e},[e]),t.current}let xt={};function Ve(e,t){return a.useMemo(()=>{if(t)return t;const n=xt[e]==null?0:xt[e]+1;return xt[e]=n,e+"-"+n},[e,t])}function Sn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,l)=>{const c=Object.entries(l);for(const[u,d]of c){const h=i[u];h!=null&&(i[u]=h+e*d)}return i},{...t})}}const ke=Sn(1),lt=Sn(-1);function Kr(e){return"clientX"in e&&"clientY"in e}function Lt(e){if(!e)return!1;const{KeyboardEvent:t}=X(e.target);return t&&e instanceof t}function Gr(e){if(!e)return!1;const{TouchEvent:t}=X(e.target);return t&&e instanceof t}function Tt(e){if(Gr(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Kr(e)?{x:e.clientX,y:e.clientY}:null}const Xe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Xe.Translate.toString(e),Xe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),en="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Vr(e){return e.matches(en)?e:e.querySelector(en)}const qr={display:"none"};function Jr(e){let{id:t,value:n}=e;return Y.createElement("div",{id:t,style:qr},n)}function Qr(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Y.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function Zr(){const[e,t]=a.useState("");return{announce:a.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const jn=a.createContext(null);function eo(e){const t=a.useContext(jn);a.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function to(){const[e]=a.useState(()=>new Set),t=a.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[a.useCallback(r=>{let{type:s,event:i}=r;e.forEach(l=>{var c;return(c=l[s])==null?void 0:c.call(l,i)})},[e]),t]}const no={draggable:`
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `},ro={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 oo(e){let{announcements:t=ro,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=no}=e;const{announce:i,announcement:l}=Zr(),c=Ve("DndLiveRegion"),[u,d]=a.useState(!1);if(a.useEffect(()=>{d(!0)},[]),eo(a.useMemo(()=>({onDragStart(f){let{active:v}=f;i(t.onDragStart({active:v}))},onDragMove(f){let{active:v,over:g}=f;t.onDragMove&&i(t.onDragMove({active:v,over:g}))},onDragOver(f){let{active:v,over:g}=f;i(t.onDragOver({active:v,over:g}))},onDragEnd(f){let{active:v,over:g}=f;i(t.onDragEnd({active:v,over:g}))},onDragCancel(f){let{active:v,over:g}=f;i(t.onDragCancel({active:v,over:g}))}}),[i,t])),!u)return null;const h=Y.createElement(Y.Fragment,null,Y.createElement(Jr,{id:r,value:s.draggable}),Y.createElement(Qr,{id:c,announcement:l}));return n?Ee.createPortal(h,n):h}var P;(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"})(P||(P={}));function at(){}function mt(e,t){return a.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function so(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return a.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const te=Object.freeze({x:0,y:0});function io(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lo(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function ao(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function co(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function tn(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 uo=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=tn(t,t.left,t.top),i=[];for(const l of r){const{id:c}=l,u=n.get(c);if(u){const d=io(tn(u),s);i.push({id:c,data:{droppableContainer:l,value:d}})}}return i.sort(lo)};function fo(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=s-r,c=i-n;if(r<s&&n<i){const u=t.width*t.height,d=e.width*e.height,h=l*c,f=h/(u+d-h);return Number(f.toFixed(4))}return 0}const ho=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:l}=i,c=n.get(l);if(c){const u=fo(c,t);u>0&&s.push({id:l,data:{droppableContainer:i,value:u}})}}return s.sort(ao)};function po(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Rn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:te}function go(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((l,c)=>({...l,top:l.top+e*c.y,bottom:l.bottom+e*c.y,left:l.left+e*c.x,right:l.right+e*c.x}),{...n})}}const vo=go(1);function bo(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 xo(e,t,n){const r=bo(t);if(!r)return e;const{scaleX:s,scaleY:i,x:l,y:c}=r,u=e.left-l-(1-s)*parseFloat(n),d=e.top-c-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:h,height:f,top:d,right:u+h,bottom:d+f,left:u}}const mo={ignoreTransform:!1};function Ie(e,t){t===void 0&&(t=mo);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:h}=X(e).getComputedStyle(e);d&&(n=xo(n,d,h))}const{top:r,left:s,width:i,height:l,bottom:c,right:u}=n;return{top:r,left:s,width:i,height:l,bottom:c,right:u}}function nn(e){return Ie(e,{ignoreTransform:!0})}function yo(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Co(e,t){return t===void 0&&(t=X(e).getComputedStyle(e)),t.position==="fixed"}function wo(e,t){t===void 0&&(t=X(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function Ft(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(Nt(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ke(s)||wn(s)||n.includes(s))return n;const i=X(e).getComputedStyle(s);return s!==e&&wo(s,i)&&n.push(s),Co(s,i)?n:r(s.parentNode)}return e?r(e):n}function En(e){const[t]=Ft(e,1);return t??null}function yt(e){return!dt||!e?null:Ae(e)?e:It(e)?Nt(e)||e===Me(e).scrollingElement?window:Ke(e)?e:null:null}function Dn(e){return Ae(e)?e.scrollX:e.scrollLeft}function Tn(e){return Ae(e)?e.scrollY:e.scrollTop}function kt(e){return{x:Dn(e),y:Tn(e)}}var z;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(z||(z={}));function kn(e){return!dt||!e?!1:e===document.scrollingElement}function An(e){const t={x:0,y:0},n=kn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,l=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:l,isRight:c,maxScroll:r,minScroll:t}}const So={x:.2,y:.2};function jo(e,t,n,r,s){let{top:i,left:l,right:c,bottom:u}=n;r===void 0&&(r=10),s===void 0&&(s=So);const{isTop:d,isBottom:h,isLeft:f,isRight:v}=An(e),g={x:0,y:0},p={x:0,y:0},x={height:t.height*s.y,width:t.width*s.x};return!d&&i<=t.top+x.height?(g.y=z.Backward,p.y=r*Math.abs((t.top+x.height-i)/x.height)):!h&&u>=t.bottom-x.height&&(g.y=z.Forward,p.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!v&&c>=t.right-x.width?(g.x=z.Forward,p.x=r*Math.abs((t.right-x.width-c)/x.width)):!f&&l<=t.left+x.width&&(g.x=z.Backward,p.x=r*Math.abs((t.left+x.width-l)/x.width)),{direction:g,speed:p}}function Ro(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:l}=window;return{top:0,left:0,right:i,bottom:l,width:i,height:l}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Mn(e){return e.reduce((t,n)=>ke(t,kt(n)),te)}function Eo(e){return e.reduce((t,n)=>t+Dn(n),0)}function Do(e){return e.reduce((t,n)=>t+Tn(n),0)}function To(e,t){if(t===void 0&&(t=Ie),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);En(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ko=[["x",["left","right"],Eo],["y",["top","bottom"],Do]];class Bt{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=Ft(n),s=Mn(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,l,c]of ko)for(const u of l)Object.defineProperty(this,u,{get:()=>{const d=c(r),h=s[i]-d;return this.rect[u]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class We{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 s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function Ao(e){const{EventTarget:t}=X(e);return e instanceof t?e:Me(e)}function Ct(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 J;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(J||(J={}));function rn(e){e.preventDefault()}function Mo(e){e.stopPropagation()}var A;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(A||(A={}));const In={start:[A.Space,A.Enter],cancel:[A.Esc],end:[A.Space,A.Enter]},Io=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case A.Right:return{...n,x:n.x+25};case A.Left:return{...n,x:n.x-25};case A.Down:return{...n,y:n.y+25};case A.Up:return{...n,y:n.y-25}}};class Nn{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 We(Me(n)),this.windowListeners=new We(X(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(J.Resize,this.handleCancel),this.windowListeners.add(J.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(J.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&To(r),n(te)}handleKeyDown(t){if(Lt(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=In,coordinateGetter:l=Io,scrollBehavior:c="smooth"}=s,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:te;this.referenceCoordinates||(this.referenceCoordinates=h);const f=l(t,{active:n,context:r.current,currentCoordinates:h});if(f){const v=lt(f,h),g={x:0,y:0},{scrollableAncestors:p}=r.current;for(const x of p){const y=t.code,{isTop:S,isRight:R,isLeft:C,isBottom:D,maxScroll:m,minScroll:j}=An(x),E=Ro(x),w={x:Math.min(y===A.Right?E.right-E.width/2:E.right,Math.max(y===A.Right?E.left:E.left+E.width/2,f.x)),y:Math.min(y===A.Down?E.bottom-E.height/2:E.bottom,Math.max(y===A.Down?E.top:E.top+E.height/2,f.y))},O=y===A.Right&&!R||y===A.Left&&!C,B=y===A.Down&&!D||y===A.Up&&!S;if(O&&w.x!==f.x){const N=x.scrollLeft+v.x,b=y===A.Right&&N<=m.x||y===A.Left&&N>=j.x;if(b&&!v.y){x.scrollTo({left:N,behavior:c});return}b?g.x=x.scrollLeft-N:g.x=y===A.Right?x.scrollLeft-m.x:x.scrollLeft-j.x,g.x&&x.scrollBy({left:-g.x,behavior:c});break}else if(B&&w.y!==f.y){const N=x.scrollTop+v.y,b=y===A.Down&&N<=m.y||y===A.Up&&N>=j.y;if(b&&!v.x){x.scrollTo({top:N,behavior:c});return}b?g.y=x.scrollTop-N:g.y=y===A.Down?x.scrollTop-m.y:x.scrollTop-j.y,g.y&&x.scrollBy({top:-g.y,behavior:c});break}}this.handleMove(t,ke(lt(f,this.referenceCoordinates),g))}}}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()}}Nn.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=In,onActivation:s}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const c=i.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function on(e){return!!(e&&"distance"in e)}function sn(e){return!!(e&&"delay"in e)}class Pt{constructor(t,n,r){var s;r===void 0&&(r=Ao(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:l}=i;this.props=t,this.events=n,this.document=Me(l),this.documentListeners=new We(this.document),this.listeners=new We(r),this.windowListeners=new We(X(l)),this.initialCoordinates=(s=Tt(i))!=null?s:te,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),this.windowListeners.add(J.Resize,this.handleCancel),this.windowListeners.add(J.DragStart,rn),this.windowListeners.add(J.VisibilityChange,this.handleCancel),this.windowListeners.add(J.ContextMenu,rn),this.documentListeners.add(J.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(sn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(on(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)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(J.Click,Mo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(J.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:l,options:{activationConstraint:c}}=i;if(!s)return;const u=(n=Tt(t))!=null?n:te,d=lt(s,u);if(!r&&c){if(on(c)){if(c.tolerance!=null&&Ct(d,c.tolerance))return this.handleCancel();if(Ct(d,c.distance))return this.handleStart()}return sn(c)&&Ct(d,c.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),l(u)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===A.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const No={move:{name:"pointermove"},end:{name:"pointerup"}};class zt extends Pt{constructor(t){const{event:n}=t,r=Me(n.target);super(t,No,r)}}zt.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 Oo={move:{name:"mousemove"},end:{name:"mouseup"}};var At;(function(e){e[e.RightClick=2]="RightClick"})(At||(At={}));class On extends Pt{constructor(t){super(t,Oo,Me(t.event.target))}}On.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===At.RightClick?!1:(r==null||r({event:n}),!0)}}];const wt={move:{name:"touchmove"},end:{name:"touchend"}};class Ln extends Pt{constructor(t){super(t,wt)}static setup(){return window.addEventListener(wt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wt.move.name,t)};function t(){}}}Ln.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Ue;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ue||(Ue={}));var ct;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ct||(ct={}));function Lo(e){let{acceleration:t,activator:n=Ue.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:l=5,order:c=ct.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:h,delta:f,threshold:v}=e;const g=Bo({delta:f,disabled:!i}),[p,x]=Hr(),y=a.useRef({x:0,y:0}),S=a.useRef({x:0,y:0}),R=a.useMemo(()=>{switch(n){case Ue.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Ue.DraggableRect:return s}},[n,s,u]),C=a.useRef(null),D=a.useCallback(()=>{const j=C.current;if(!j)return;const E=y.current.x*S.current.x,w=y.current.y*S.current.y;j.scrollBy(E,w)},[]),m=a.useMemo(()=>c===ct.TreeOrder?[...d].reverse():d,[c,d]);a.useEffect(()=>{if(!i||!d.length||!R){x();return}for(const j of m){if((r==null?void 0:r(j))===!1)continue;const E=d.indexOf(j),w=h[E];if(!w)continue;const{direction:O,speed:B}=jo(j,w,R,t,v);for(const N of["x","y"])g[N][O[N]]||(B[N]=0,O[N]=0);if(B.x>0||B.y>0){x(),C.current=j,p(D,l),y.current=B,S.current=O;return}}y.current={x:0,y:0},S.current={x:0,y:0},x()},[t,D,r,x,i,l,JSON.stringify(R),JSON.stringify(g),p,d,m,h,JSON.stringify(v)])}const Fo={x:{[z.Backward]:!1,[z.Forward]:!1},y:{[z.Backward]:!1,[z.Forward]:!1}};function Bo(e){let{delta:t,disabled:n}=e;const r=Dt(t);return Ge(s=>{if(n||!r||!s)return Fo;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[z.Backward]:s.x[z.Backward]||i.x===-1,[z.Forward]:s.x[z.Forward]||i.x===1},y:{[z.Backward]:s.y[z.Backward]||i.y===-1,[z.Forward]:s.y[z.Forward]||i.y===1}}},[n,t,r])}function Po(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Ge(s=>{var i;return t===null?null:(i=r??s)!=null?i:null},[r,t])}function zo(e,t){return a.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,r)}));return[...n,...i]},[]),[e,t])}var He;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(He||(He={}));var Mt;(function(e){e.Optimized="optimized"})(Mt||(Mt={}));const ln=new Map;function _o(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,l]=a.useState(null),{frequency:c,measure:u,strategy:d}=s,h=a.useRef(e),f=y(),v=Ye(f),g=a.useCallback(function(S){S===void 0&&(S=[]),!v.current&&l(R=>R===null?S:R.concat(S.filter(C=>!R.includes(C))))},[v]),p=a.useRef(null),x=Ge(S=>{if(f&&!n)return ln;if(!S||S===ln||h.current!==e||i!=null){const R=new Map;for(let C of e){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){R.set(C.id,C.rect.current);continue}const D=C.node.current,m=D?new Bt(u(D),D):null;C.rect.current=m,m&&R.set(C.id,m)}return R}return S},[e,i,n,f,u]);return a.useEffect(()=>{h.current=e},[e]),a.useEffect(()=>{f||g()},[n,f]),a.useEffect(()=>{i&&i.length>0&&l(null)},[JSON.stringify(i)]),a.useEffect(()=>{f||typeof c!="number"||p.current!==null||(p.current=setTimeout(()=>{g(),p.current=null},c))},[c,f,g,...r]),{droppableRects:x,measureDroppableContainers:g,measuringScheduled:i!=null};function y(){switch(d){case He.Always:return!1;case He.BeforeDragging:return n;default:return!n}}}function Fn(e,t){return Ge(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function Wo(e,t){return Fn(e,t)}function Uo(e){let{callback:t,disabled:n}=e;const r=Ot(t),s=a.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return a.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function ft(e){let{callback:t,disabled:n}=e;const r=Ot(t),s=a.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return a.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function $o(e){return new Bt(Ie(e),e)}function an(e,t,n){t===void 0&&(t=$o);const[r,s]=a.useReducer(c,null),i=Uo({callback(u){if(e)for(const d of u){const{type:h,target:f}=d;if(h==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=ft({callback:s});return ee(()=>{s(),e?(l==null||l.observe(e),i==null||i.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),i==null||i.disconnect())},[e]),r;function c(u){if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const h=t(e);return JSON.stringify(u)===JSON.stringify(h)?u:h}}function Yo(e){const t=Fn(e);return Rn(e,t)}const cn=[];function Xo(e){const t=a.useRef(e),n=Ge(r=>e?r&&r!==cn&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ft(e):cn,[e]);return a.useEffect(()=>{t.current=e},[e]),n}function Ho(e){const[t,n]=a.useState(null),r=a.useRef(e),s=a.useCallback(i=>{const l=yt(i.target);l&&n(c=>c?(c.set(l,kt(l)),new Map(c)):null)},[]);return a.useEffect(()=>{const i=r.current;if(e!==i){l(i);const c=e.map(u=>{const d=yt(u);return d?(d.addEventListener("scroll",s,{passive:!0}),[d,kt(d)]):null}).filter(u=>u!=null);n(c.length?new Map(c):null),r.current=e}return()=>{l(e),l(i)};function l(c){c.forEach(u=>{const d=yt(u);d==null||d.removeEventListener("scroll",s)})}},[s,e]),a.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,l)=>ke(i,l),te):Mn(e):te,[e,t])}function un(e,t){t===void 0&&(t=[]);const n=a.useRef(null);return a.useEffect(()=>{n.current=null},t),a.useEffect(()=>{const r=e!==te;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?lt(e,n.current):te}function Ko(e){a.useEffect(()=>{if(!dt)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 Go(e,t){return a.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=l=>{i(l,t)},n},{}),[e,t])}function Bn(e){return a.useMemo(()=>e?yo(e):null,[e])}const St=[];function Vo(e,t){t===void 0&&(t=Ie);const[n]=e,r=Bn(n?X(n):null),[s,i]=a.useReducer(c,St),l=ft({callback:i});return e.length>0&&s===St&&i(),ee(()=>{e.length?e.forEach(u=>l==null?void 0:l.observe(u)):(l==null||l.disconnect(),i())},[e]),s;function c(){return e.length?e.map(u=>kn(u)?r:new Bt(t(u),u)):St}}function qo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ke(t)?t:e}function Jo(e){let{measure:t}=e;const[n,r]=a.useState(null),s=a.useCallback(d=>{for(const{target:h}of d)if(Ke(h)){r(f=>{const v=t(h);return f?{...f,width:v.width,height:v.height}:v});break}},[t]),i=ft({callback:s}),l=a.useCallback(d=>{const h=qo(d);i==null||i.disconnect(),h&&(i==null||i.observe(h)),r(h?t(h):null)},[t,i]),[c,u]=it(l);return a.useMemo(()=>({nodeRef:c,rect:n,setRef:u}),[n,c,u])}const Qo=[{sensor:zt,options:{}},{sensor:Nn,options:{}}],Zo={current:{}},ot={draggable:{measure:nn},droppable:{measure:nn,strategy:He.WhileDragging,frequency:Mt.Optimized},dragOverlay:{measure:Ie}};class $e 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 es={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new $e,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:at},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ot,measureDroppableContainers:at,windowRect:null,measuringScheduled:!1},ts={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:at,draggableNodes:new Map,over:null,measureDroppableContainers:at},ht=a.createContext(ts),Pn=a.createContext(es);function ns(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new $e}}}function rs(e,t){switch(t.type){case P.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case P.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case P.DragEnd:case P.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case P.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new $e(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case P.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new $e(e.droppable.containers);return l.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:l}}}case P.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new $e(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function os(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=a.useContext(ht),i=Dt(r),l=Dt(n==null?void 0:n.id);return a.useEffect(()=>{if(!t&&!r&&i&&l!=null){if(!Lt(i)||document.activeElement===i.target)return;const c=s.get(l);if(!c)return;const{activatorNode:u,node:d}=c;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[u.current,d.current]){if(!h)continue;const f=Vr(h);if(f){f.focus();break}}})}},[r,t,s,l,i]),null}function ss(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function is(e){return a.useMemo(()=>({draggable:{...ot.draggable,...e==null?void 0:e.draggable},droppable:{...ot.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ot.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 ls(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=a.useRef(!1),{x:l,y:c}=typeof s=="boolean"?{x:s,y:s}:s;ee(()=>{if(!l&&!c||!t){i.current=!1;return}if(i.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const h=n(d),f=Rn(h,r);if(l||(f.x=0),c||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const v=En(d);v&&v.scrollBy({top:f.y,left:f.x})}},[t,l,c,r,n])}const zn=a.createContext({...te,scaleX:1,scaleY:1});var ve;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ve||(ve={}));const as=a.memo(function(t){var n,r,s,i;let{id:l,accessibility:c,autoScroll:u=!0,children:d,sensors:h=Qo,collisionDetection:f=ho,measuring:v,modifiers:g,...p}=t;const x=a.useReducer(rs,void 0,ns),[y,S]=x,[R,C]=to(),[D,m]=a.useState(ve.Uninitialized),j=D===ve.Initialized,{draggable:{active:E,nodes:w,translate:O},droppable:{containers:B}}=y,N=E?w.get(E):null,b=a.useRef({initial:null,translated:null}),T=a.useMemo(()=>{var _;return E!=null?{id:E,data:(_=N==null?void 0:N.data)!=null?_:Zo,rect:b}:null},[E,N]),M=a.useRef(null),[L,G]=a.useState(null),[W,ne]=a.useState(null),se=Ye(p,Object.values(p)),be=Ve("DndDescribedBy",l),xe=a.useMemo(()=>B.getEnabled(),[B]),$=is(v),{droppableRects:ie,measureDroppableContainers:me,measuringScheduled:Ne}=_o(xe,{dragging:j,dependencies:[O.x,O.y],config:$.droppable}),V=Po(w,E),qe=a.useMemo(()=>W?Tt(W):null,[W]),de=Qn(),le=Wo(V,$.draggable.measure);ls({activeNode:E?w.get(E):null,config:de.layoutShiftCompensation,initialRect:le,measure:$.draggable.measure});const I=an(V,$.draggable.measure,le),Oe=an(V?V.parentElement:null),re=a.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:w,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ye=B.getNodeFor((n=re.current.over)==null?void 0:n.id),ae=Jo({measure:$.dragOverlay.measure}),Ce=(r=ae.nodeRef.current)!=null?r:V,we=j?(s=ae.rect)!=null?s:I:null,_t=!!(ae.nodeRef.current&&ae.rect),Wt=Yo(_t?null:I),pt=Bn(Ce?X(Ce):null),fe=Xo(j?ye??V:null),Je=Vo(fe),Qe=ss(g,{transform:{x:O.x-Wt.x,y:O.y-Wt.y,scaleX:1,scaleY:1},activatorEvent:W,active:T,activeNodeRect:I,containerNodeRect:Oe,draggingNodeRect:we,over:re.current.over,overlayNodeRect:ae.rect,scrollableAncestors:fe,scrollableAncestorRects:Je,windowRect:pt}),Ut=qe?ke(qe,O):null,$t=Ho(fe),Xn=un($t),Hn=un($t,[I]),Se=ke(Qe,Xn),je=we?vo(we,Qe):null,Le=T&&je?f({active:T,collisionRect:je,droppableRects:ie,droppableContainers:xe,pointerCoordinates:Ut}):null,Yt=co(Le,"id"),[he,Xt]=a.useState(null),Kn=_t?Qe:ke(Qe,Hn),Gn=po(Kn,(i=he==null?void 0:he.rect)!=null?i:null,I),Ht=a.useCallback((_,H)=>{let{sensor:K,options:pe}=H;if(M.current==null)return;const q=w.get(M.current);if(!q)return;const Q=_.nativeEvent,oe=new K({active:M.current,activeNode:q,event:Q,options:pe,context:re,onStart(Z){const Fe=M.current;if(Fe==null)return;const Be=w.get(Fe);if(!Be)return;const{onDragStart:Ze}=se.current,et={active:{id:Fe,data:Be.data,rect:b}};Ee.unstable_batchedUpdates(()=>{Ze==null||Ze(et),m(ve.Initializing),S({type:P.DragStart,initialCoordinates:Z,active:Fe}),R({type:"onDragStart",event:et})})},onMove(Z){S({type:P.DragMove,coordinates:Z})},onEnd:Re(P.DragEnd),onCancel:Re(P.DragCancel)});Ee.unstable_batchedUpdates(()=>{G(oe),ne(_.nativeEvent)});function Re(Z){return async function(){const{active:Be,collisions:Ze,over:et,scrollAdjustedTranslate:Gt}=re.current;let Pe=null;if(Be&&Gt){const{cancelDrop:ze}=se.current;Pe={activatorEvent:Q,active:Be,collisions:Ze,delta:Gt,over:et},Z===P.DragEnd&&typeof ze=="function"&&await Promise.resolve(ze(Pe))&&(Z=P.DragCancel)}M.current=null,Ee.unstable_batchedUpdates(()=>{S({type:Z}),m(ve.Uninitialized),Xt(null),G(null),ne(null);const ze=Z===P.DragEnd?"onDragEnd":"onDragCancel";if(Pe){const gt=se.current[ze];gt==null||gt(Pe),R({type:ze,event:Pe})}})}}},[w]),Vn=a.useCallback((_,H)=>(K,pe)=>{const q=K.nativeEvent,Q=w.get(pe);if(M.current!==null||!Q||q.dndKit||q.defaultPrevented)return;const oe={active:Q};_(K,H.options,oe)===!0&&(q.dndKit={capturedBy:H.sensor},M.current=pe,Ht(K,H))},[w,Ht]),Kt=zo(h,Vn);Ko(h),ee(()=>{I&&D===ve.Initializing&&m(ve.Initialized)},[I,D]),a.useEffect(()=>{const{onDragMove:_}=se.current,{active:H,activatorEvent:K,collisions:pe,over:q}=re.current;if(!H||!K)return;const Q={active:H,activatorEvent:K,collisions:pe,delta:{x:Se.x,y:Se.y},over:q};Ee.unstable_batchedUpdates(()=>{_==null||_(Q),R({type:"onDragMove",event:Q})})},[Se.x,Se.y]),a.useEffect(()=>{const{active:_,activatorEvent:H,collisions:K,droppableContainers:pe,scrollAdjustedTranslate:q}=re.current;if(!_||M.current==null||!H||!q)return;const{onDragOver:Q}=se.current,oe=pe.get(Yt),Re=oe&&oe.rect.current?{id:oe.id,rect:oe.rect.current,data:oe.data,disabled:oe.disabled}:null,Z={active:_,activatorEvent:H,collisions:K,delta:{x:q.x,y:q.y},over:Re};Ee.unstable_batchedUpdates(()=>{Xt(Re),Q==null||Q(Z),R({type:"onDragOver",event:Z})})},[Yt]),ee(()=>{re.current={activatorEvent:W,active:T,activeNode:V,collisionRect:je,collisions:Le,droppableRects:ie,draggableNodes:w,draggingNode:Ce,draggingNodeRect:we,droppableContainers:B,over:he,scrollableAncestors:fe,scrollAdjustedTranslate:Se},b.current={initial:we,translated:je}},[T,V,Le,je,w,Ce,we,ie,B,he,fe,Se]),Lo({...de,delta:O,draggingRect:je,pointerCoordinates:Ut,scrollableAncestors:fe,scrollableAncestorRects:Je});const qn=a.useMemo(()=>({active:T,activeNode:V,activeNodeRect:I,activatorEvent:W,collisions:Le,containerNodeRect:Oe,dragOverlay:ae,draggableNodes:w,droppableContainers:B,droppableRects:ie,over:he,measureDroppableContainers:me,scrollableAncestors:fe,scrollableAncestorRects:Je,measuringConfiguration:$,measuringScheduled:Ne,windowRect:pt}),[T,V,I,W,Le,Oe,ae,w,B,ie,he,me,fe,Je,$,Ne,pt]),Jn=a.useMemo(()=>({activatorEvent:W,activators:Kt,active:T,activeNodeRect:I,ariaDescribedById:{draggable:be},dispatch:S,draggableNodes:w,over:he,measureDroppableContainers:me}),[W,Kt,T,I,S,be,w,he,me]);return Y.createElement(jn.Provider,{value:C},Y.createElement(ht.Provider,{value:Jn},Y.createElement(Pn.Provider,{value:qn},Y.createElement(zn.Provider,{value:Gn},d)),Y.createElement(os,{disabled:(c==null?void 0:c.restoreFocus)===!1})),Y.createElement(oo,{...c,hiddenTextDescribedById:be}));function Qn(){const _=(L==null?void 0:L.autoScrollEnabled)===!1,H=typeof u=="object"?u.enabled===!1:u===!1,K=j&&!_&&!H;return typeof u=="object"?{...u,enabled:K}:{enabled:K}}}),cs=a.createContext(null),dn="button",us="Droppable";function _n(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=Ve(us),{activators:l,activatorEvent:c,active:u,activeNodeRect:d,ariaDescribedById:h,draggableNodes:f,over:v}=a.useContext(ht),{role:g=dn,roleDescription:p="draggable",tabIndex:x=0}=s??{},y=(u==null?void 0:u.id)===t,S=a.useContext(y?zn:cs),[R,C]=it(),[D,m]=it(),j=Go(l,t),E=Ye(n);ee(()=>(f.set(t,{id:t,key:i,node:R,activatorNode:D,data:E}),()=>{const O=f.get(t);O&&O.key===i&&f.delete(t)}),[f,t]);const w=a.useMemo(()=>({role:g,tabIndex:x,"aria-disabled":r,"aria-pressed":y&&g===dn?!0:void 0,"aria-roledescription":p,"aria-describedby":h.draggable}),[r,g,x,y,p,h.draggable]);return{active:u,activatorEvent:c,activeNodeRect:d,attributes:w,isDragging:y,listeners:r?void 0:j,node:R,over:v,setNodeRef:C,setActivatorNodeRef:m,transform:S}}function ds(){return a.useContext(Pn)}const fs="Droppable",hs={timeout:25};function ps(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=Ve(fs),{active:l,dispatch:c,over:u,measureDroppableContainers:d}=a.useContext(ht),h=a.useRef({disabled:n}),f=a.useRef(!1),v=a.useRef(null),g=a.useRef(null),{disabled:p,updateMeasurementsFor:x,timeout:y}={...hs,...s},S=Ye(x??r),R=a.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(S.current)?S.current:[S.current]),g.current=null},y)},[y]),C=ft({callback:R,disabled:p||!l}),D=a.useCallback((w,O)=>{C&&(O&&(C.unobserve(O),f.current=!1),w&&C.observe(w))},[C]),[m,j]=it(D),E=Ye(t);return a.useEffect(()=>{!C||!m.current||(C.disconnect(),f.current=!1,C.observe(m.current))},[m,C]),ee(()=>(c({type:P.RegisterDroppable,element:{id:r,key:i,disabled:n,node:m,rect:v,data:E}}),()=>c({type:P.UnregisterDroppable,key:i,id:r})),[r]),a.useEffect(()=>{n!==h.current.disabled&&(c({type:P.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)},[r,i,n,c]),{active:l,rect:v,isOver:(u==null?void 0:u.id)===r,node:m,over:u,setNodeRef:j}}function ut(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function gs(e,t){return e.reduce((n,r,s)=>{const i=t.get(r);return i&&(n[s]=i),n},Array(e.length))}function nt(e){return e!==null&&e>=0}function vs(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 bs(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Wn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const i=ut(t,r,n),l=t[s],c=i[s];return!c||!l?null:{x:c.left-l.left,y:c.top-l.top,scaleX:c.width/l.width,scaleY:c.height/l.height}},Un="Sortable",$n=Y.createContext({activeIndex:-1,containerId:Un,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Wn,disabled:{draggable:!1,droppable:!1}});function xs(e){let{children:t,id:n,items:r,strategy:s=Wn,disabled:i=!1}=e;const{active:l,dragOverlay:c,droppableRects:u,over:d,measureDroppableContainers:h}=ds(),f=Ve(Un,n),v=c.rect!==null,g=a.useMemo(()=>r.map(j=>typeof j=="object"&&"id"in j?j.id:j),[r]),p=l!=null,x=l?g.indexOf(l.id):-1,y=d?g.indexOf(d.id):-1,S=a.useRef(g),R=!vs(g,S.current),C=y!==-1&&x===-1||R,D=bs(i);ee(()=>{R&&p&&h(g)},[R,g,p,h]),a.useEffect(()=>{S.current=g},[g]);const m=a.useMemo(()=>({activeIndex:x,containerId:f,disabled:D,disableTransforms:C,items:g,overIndex:y,useDragOverlay:v,sortedRects:gs(g,u),strategy:s}),[x,f,D.draggable,D.droppable,C,g,y,u,v,s]);return Y.createElement($n.Provider,{value:m},t)}const ms=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return ut(n,r,s).indexOf(t)},ys=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:i,newIndex:l,previousItems:c,previousContainerId:u,transition:d}=e;return!d||!r||c!==i&&s===l?!1:n?!0:l!==s&&t===u},Cs={duration:200,easing:"ease"},Yn="transform",ws=Xe.Transition.toString({property:Yn,duration:0,easing:"linear"}),Ss={roleDescription:"sortable"};function js(e){let{disabled:t,index:n,node:r,rect:s}=e;const[i,l]=a.useState(null),c=a.useRef(n);return ee(()=>{if(!t&&n!==c.current&&r.current){const u=s.current;if(u){const d=Ie(r.current,{ignoreTransform:!0}),h={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(h.x||h.y)&&l(h)}}n!==c.current&&(c.current=n)},[t,n,r,s]),a.useEffect(()=>{i&&l(null)},[i]),i}function Rs(e){let{animateLayoutChanges:t=ys,attributes:n,disabled:r,data:s,getNewIndex:i=ms,id:l,strategy:c,resizeObserverConfig:u,transition:d=Cs}=e;const{items:h,containerId:f,activeIndex:v,disabled:g,disableTransforms:p,sortedRects:x,overIndex:y,useDragOverlay:S,strategy:R}=a.useContext($n),C=Es(r,g),D=h.indexOf(l),m=a.useMemo(()=>({sortable:{containerId:f,index:D,items:h},...s}),[f,s,D,h]),j=a.useMemo(()=>h.slice(h.indexOf(l)),[h,l]),{rect:E,node:w,isOver:O,setNodeRef:B}=ps({id:l,data:m,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...u}}),{active:N,activatorEvent:b,activeNodeRect:T,attributes:M,setNodeRef:L,listeners:G,isDragging:W,over:ne,setActivatorNodeRef:se,transform:be}=_n({id:l,data:m,attributes:{...Ss,...n},disabled:C.draggable}),xe=Xr(B,L),$=!!N,ie=$&&!p&&nt(v)&&nt(y),me=!S&&W,Ne=me&&ie?be:null,qe=ie?Ne??(c??R)({rects:x,activeNodeRect:T,activeIndex:v,overIndex:y,index:D}):null,de=nt(v)&&nt(y)?i({id:l,items:h,activeIndex:v,overIndex:y}):D,le=N==null?void 0:N.id,I=a.useRef({activeId:le,items:h,newIndex:de,containerId:f}),Oe=h!==I.current.items,re=t({active:N,containerId:f,isDragging:W,isSorting:$,id:l,index:D,items:h,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:d,wasDragging:I.current.activeId!=null}),ye=js({disabled:!re,index:D,node:w,rect:E});return a.useEffect(()=>{$&&I.current.newIndex!==de&&(I.current.newIndex=de),f!==I.current.containerId&&(I.current.containerId=f),h!==I.current.items&&(I.current.items=h)},[$,de,f,h]),a.useEffect(()=>{if(le===I.current.activeId)return;if(le&&!I.current.activeId){I.current.activeId=le;return}const Ce=setTimeout(()=>{I.current.activeId=le},50);return()=>clearTimeout(Ce)},[le]),{active:N,activeIndex:v,attributes:M,data:m,rect:E,index:D,newIndex:de,items:h,isOver:O,isSorting:$,isDragging:W,listeners:G,node:w,overIndex:y,over:ne,setNodeRef:xe,setActivatorNodeRef:se,setDroppableNodeRef:B,setDraggableNodeRef:L,transform:ye??qe,transition:ae()};function ae(){if(ye||Oe&&I.current.newIndex===D)return ws;if(!(me&&!Lt(b)||!d)&&($||re))return Xe.Transition.toString({...d,property:Yn})}}function Es(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}}A.Down,A.Right,A.Up,A.Left;const Ds=e=>{const{setNodeRef:t,transform:n,transition:r}=Rs({id:e.id}),s={transform:Xe.Transform.toString(n),transition:r};return o.jsx("div",{ref:t,style:s,children:e.children},e.id)},Ts=e=>{const t=Rt(n=>Zn(n,e));return F.debug("formStore",t),t},Zs=({appId:e,target:t})=>{F.debug(e,t);const n=hr(e),r=Rt(u=>er(u,e)),s=Ts(e),i=Rt(u=>tr(u,e));t===st.TABLE?n==null||n.columns:s==null||s.columns;const l=t===st.TABLE?r:i,c={label:"",type:nr.TEXT,expression:""};return a.useState(-1),a.useState(c),a.useState(!1),a.useEffect(()=>{},[e,l,t]),o.jsxs(k,{children:[o.jsx(k,{sx:{padding:"15px 15px 10px 5px",marginBottom:"5px",textAlign:"right"},children:o.jsx(U,{variant:"contained",startIcon:o.jsx(ir,{}),disabled:!0,onClick:()=>{},children:"Computed Field"})}),!1]})},ks=({id:e,enabled:t})=>{const{attributes:n,listeners:r,setNodeRef:s}=_n({id:e}),i={margin:"auto",marginRight:"12px",cursor:"move"};return t||(i.pointerEvents="none",i.opacity="0.4"),o.jsx("div",{ref:s,...r,...n,style:i,children:o.jsx(mr,{})})},ei=({checked:e,children:t,alignRight:n,disabled:r})=>{var i,l;const s={width:"13px",height:"13px",top:"unset",backgroundColor:(i=Et)==null?void 0:i.palette.background.paper};return n===!1?s.right="unset":s.left="unset",o.jsxs(k,{sx:{position:"relative",width:"24px",height:"24px","& svg":{position:"absolute",width:"24px",height:"24px",top:0,bottom:0,left:0,right:0},"& svg.off":s},children:[t,!e&&r!==!0&&o.jsx(lr,{className:"off",color:(l=Et)==null?void 0:l.palette.error.main})]})},fn=({column:e,columnIndex:t,lookupColumns:n,wizardLookup:r,addActions:s,enableAddAction:i,target:l,appId:c,onUpdate:u,onActions:d})=>{F.debug(e,t,n,r,s,i,l,c);const h=l===st.TABLE?rr(jt.getState(),c):or(jt.getState(),c),[f,v]=a.useState(t===null?"":r.dynamicConditions[t].lookupColumnName);F.debug("stateLookupColumnName",f);const[g,p]=a.useState(t===null?"":r.dynamicConditions[t].tableColumnName);F.debug("stateTableColumnName",g);const[x,y]=a.useState(null),S=!!x,R=m=>{y(m.currentTarget),m.stopPropagation()},C=()=>{y(null)},D=m=>{m.lookupColumnName!==""&&m.tableColumnName!==""&&u(m)};return o.jsxs(k,{sx:{display:"grid",gridTemplateColumns:s?"1fr auto 1fr auto":"1fr auto 1fr",alignItems:"center",gridGap:"5px"},children:[o.jsxs(_e,{MenuProps:{id:"pp-select-menu"},value:f,onChange:m=>{v(m.target.value),D({lookupColumnName:m.target.value,tableColumnName:g})},children:[o.jsx(ce,{value:""}),...n.map(m=>o.jsx(ce,{value:m,children:m}))]}),o.jsx("span",{children:"="}),o.jsxs(_e,{MenuProps:{id:"pp-select-menu"},value:g,onChange:m=>{p(m.target.value),D({lookupColumnName:f,tableColumnName:m.target.value})},children:[o.jsx(ce,{value:""}),...h.map(m=>m.columnName===e.columnName||m.computedField!==void 0?null:o.jsx(ce,{value:m.columnName,children:m.columnName}))]}),s&&o.jsxs(o.Fragment,{children:[o.jsx(Tr,{color:"primary",onClick:R,children:o.jsx(ar,{})}),o.jsxs(kr,{anchorEl:x,open:S,onClose:C,sx:{zIndex:9999999999},anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:[i&&o.jsxs(ce,{onClick:()=>{d("add"),C()},children:[o.jsx(yr,{}),o.jsx("span",{style:{marginLeft:"10px"},children:"Add column"})]}),o.jsxs(ce,{onClick:()=>{d("delete"),C()},children:[o.jsx(Cr,{}),o.jsx("span",{style:{marginLeft:"10px"},children:"Delete column"})]})]})]})]})},As=({column:e,appId:t,columnIndex:n,databases:r,defaultDatabase:s,wpDatabase:i,target:l,setLookup:c,enableWizard:u})=>{F.debug(e,t,n,r,s,i,l);const d=so(mt(zt),mt(On),mt(Ln)),h=vn(t),f=["Select database","Select lookup table","Select lookup column","Select lookup column values","Lookup conditions"],[v,g]=a.useState(0),[p,x]=a.useState(e.lookup!==void 0?{dbs:s,tbl:"",key:"",value:"",delimiter:"",defaultWhere:"",dynamicConditions:[],loadOnStartup:!1,...e.lookup}:{dbs:s,tbl:"",key:"",value:"",delimiter:"",defaultWhere:"",dynamicConditions:[],loadOnStartup:!1});F.debug("wizardLookup",p);const[y,S]=a.useState(p.dynamicConditions.length===0),[R,C]=a.useState(!1);F.debug("wizardError",R);const[D,m]=a.useState([]);F.debug("tables",D);const[j,E]=a.useState([]);F.debug("lookupColumns",j);const w=O=>{x({...p,...O})};return o.jsxs(o.Fragment,{children:[v!==f.length&&o.jsx(k,{sx:{textAlign:"right"},children:o.jsx(U,{variant:"outlined",startIcon:o.jsx(cr,{}),onClick:()=>{u(!1)},children:"Cancel"})}),o.jsx(Ir,{activeStep:v,orientation:"vertical",sx:{marginBottom:0},children:f.map((O,B)=>{var N;return F.debug(O,B),o.jsxs(Nr,{children:[o.jsx(Or,{children:O}),o.jsx(Yr,{children:o.jsxs(k,{sx:{marginTop:"20px",display:"grid",gridGap:"10px","& > :nth-of-type(2)":{display:"grid",gridTemplateColumns:"1fr 1fr",gridGap:"5px",justifyContent:"space-between"}},children:[B===0&&o.jsxs(o.Fragment,{children:[o.jsxs(_e,{MenuProps:{id:"pp-select-menu"},value:p==null?void 0:p.dbs,onChange:b=>{w({dbs:b.target.value})},children:[...r.map(b=>o.jsx(ce,{value:b,children:i===b?b+" (WordPress database)":b}))]}),o.jsxs(k,{children:[o.jsx(k,{}),o.jsx(U,{variant:"contained",endIcon:o.jsx(De,{}),onClick:()=>{vr(t,(p==null?void 0:p.dbs)??"",b=>{const T=b==null?void 0:b.data;F.debug("response data",T),m(T),T.includes(p==null?void 0:p.tbl)||w({tbl:T[0]})},b=>{F.error("error",b),vt(b??Vt.contactSupport,{variant:"error"})}),g(v+1)},children:"Next"})]})]}),B===1&&o.jsxs(o.Fragment,{children:[o.jsxs(_e,{MenuProps:{id:"pp-select-menu"},value:p==null?void 0:p.tbl,onChange:b=>{w({tbl:b.target.value})},children:[...D.map(b=>o.jsx(ce,{value:b,children:b}))]}),o.jsxs(k,{children:[o.jsx(U,{variant:"contained",startIcon:o.jsx(tt,{}),onClick:()=>{g(v-1)},children:"Previous"}),o.jsx(U,{variant:"contained",endIcon:o.jsx(De,{}),onClick:()=>{br(t,(p==null?void 0:p.dbs)??"",(p==null?void 0:p.tbl)??"",b=>{const T=b==null?void 0:b.data;F.debug("response data",T);const M=T.map(L=>L.column_name);if(p.value!==""){const L=p.value.split(",");M.map(G=>{L.includes(G)||L.push(G)}),E(L)}else E(M);M.includes(p.key)||w({key:T[0].column_name})},b=>{F.error("error",b),vt(b??Vt.contactSupport,{variant:"error"})}),g(v+1)},children:"Next"})]})]}),B===2&&o.jsxs(o.Fragment,{children:[o.jsxs(Te,{children:[o.jsxs(_e,{MenuProps:{id:"pp-select-menu"},value:p==null?void 0:p.key,onChange:b=>{w({key:b.target.value})},children:[...j.map(b=>o.jsx(ce,{value:b,children:b}))]}),o.jsx(ue,{children:"Column selected from lookup table."})]}),o.jsxs(k,{children:[o.jsx(U,{variant:"contained",startIcon:o.jsx(tt,{}),onClick:()=>{g(v-1)},children:"Previous"}),o.jsx(U,{variant:"contained",endIcon:o.jsx(De,{}),onClick:()=>{g(v+1)},children:"Next"})]})]}),B===3&&o.jsxs(o.Fragment,{children:[o.jsxs(k,{children:[o.jsxs(Te,{fullWidth:!0,children:[o.jsx(as,{autoScroll:!0,sensors:d,collisionDetection:uo,onDragEnd:b=>{const{active:T,over:M}=b;if((T==null?void 0:T.id)!==(M==null?void 0:M.id)){F.debug(T,M);const L=j.indexOf(T.id.toString()),G=j.indexOf(M.id.toString()),W=ut(j,L,G);F.debug(W),E(W);let ne=[];p.value!==""&&(ne=p.value.split(",")),F.debug(ne);const se=ne.indexOf(T.id.toString()),be=ne.indexOf(M.id.toString()),xe=ut(ne,se,be);F.debug(xe),w({value:xe.join()})}},children:o.jsx(xs,{items:j,children:o.jsxs(k,{sx:{width:"100%",margin:0,padding:0,"& > div:first-of-type > div":{borderTopLeftRadius:"4px",borderTopRightRadius:"4px"},"& > :last-of-type > div":{borderBottomLeftRadius:"4px",borderBottomRightRadius:"4px",borderBottom:"1px solid rgba(0, 0, 0, 0.23)"}},children:[...j.map(b=>o.jsx(Ds,{id:b,style:{borderRadius:"10px"},children:o.jsxs(k,{sx:{display:"grid",gridTemplateColumns:"1fr auto",alignItems:"center",padding:"12px 20px",borderTop:"1px solid rgba(0, 0, 0, 0.23)",borderLeft:"1px solid rgba(0, 0, 0, 0.23)",borderRight:"1px solid rgba(0, 0, 0, 0.23)"},children:[o.jsx(xn,{control:o.jsx(Br,{id:b,checked:p.value.split(",").includes(b),onChange:(T,M)=>{let L=[];if(p.value!==""&&(L=p.value.split(",")),M)L.push(b);else{const G=L.indexOf(b);G!==-1&&L.splice(G,1)}w({value:L.join()})}}),label:b}),o.jsx(ks,{id:b,enabled:!0})]})},b))]})})}),o.jsx(ue,{children:"Columns shown in lookup."}),R&&o.jsxs(ue,{sx:{color:(N=Et)==null?void 0:N.palette.error.main,display:"inline-grid",gridTemplateColumns:"auto auto",justifyContent:"start",alignItems:"center",gap:"5px","& svg":{fontSize:"20px"}},children:[o.jsx(ur,{}),o.jsx("span",{children:"Select at least one column."})]})]}),o.jsx(ge,{value:p==null?void 0:p.delimiter,onChange:b=>{w({delimiter:b.target.value})},fullWidth:!0,type:"text",placeholder:"Column delimiter",sx:{marginTop:"10px"}})]}),o.jsxs(k,{children:[o.jsx(U,{variant:"contained",startIcon:o.jsx(tt,{}),onClick:()=>{g(v-1)},children:"Previous"}),o.jsx(U,{variant:"contained",endIcon:o.jsx(De,{}),onClick:()=>{p.value===""?vt("Select at least one column",{variant:"error"}):g(v+1)},children:"Next"})]})]}),B===4&&o.jsxs(o.Fragment,{children:[o.jsxs(k,{sx:{display:"grid",gridGap:"20px"},children:[o.jsxs(Te,{fullWidth:!0,children:[o.jsx(Qt,{children:"Default where"}),o.jsx(ge,{value:p==null?void 0:p.defaultWhere,multiline:!0,fullWidth:!0,minRows:2,maxRows:4,variant:"outlined",onClick:b=>{b.stopPropagation()},onChange:b=>{w({defaultWhere:b.target.value})}}),o.jsx(ue,{children:"Enter a valid SQL where clause or leave empty."})]}),o.jsxs(k,{children:[o.jsx(Qt,{children:"Dynamic conditions"}),o.jsxs(k,{sx:{display:"grid",gridGap:"5px"},children:[...p.dynamicConditions.map((b,T)=>o.jsx(fn,{appId:t,column:e,columnIndex:T,lookupColumns:j,wizardLookup:p,addActions:!0,target:l,enableAddAction:p.dynamicConditions.length===T+1&&!y,onUpdate:M=>{const L=bt(p);L.dynamicConditions[n]={...M},w(L)},onActions:M=>{if(M==="add")S(!0);else if(M==="delete"){const L=bt(p);L.dynamicConditions.splice(T,1),w(L),S(L.dynamicConditions.length===0)}}})),y&&o.jsx(fn,{appId:t,column:e,columnIndex:null,lookupColumns:j,wizardLookup:p,addActions:p.dynamicConditions.length>0,target:l,enableAddAction:!1,onUpdate:b=>{const T=bt(p);T.dynamicConditions.push(b),w(T),S(!1)},onActions:b=>{b==="delete"&&S(!1)}})]}),o.jsx(Te,{children:o.jsx(ue,{children:"Rebuilds lookup when conditions change."})})]})]}),o.jsxs(k,{children:[o.jsx(U,{variant:"contained",startIcon:o.jsx(tt,{}),onClick:()=>{g(v-1)},children:"Previous"}),o.jsx(U,{variant:"contained",startIcon:o.jsx(dr,{}),onClick:()=>{p.value===""?C(!0):(c(n,p),C(!1),h(!0),g(v+1))},children:"Finish"})]})]})]})})]},O)})}),v===f.length&&o.jsxs(k,{sx:{marginTop:"20px"},children:["Lookup wizard successfully completed. Please save changes to enable.",o.jsx(U,{onClick:()=>{u(!1),g(v+1)},children:"Close wizard"})]})]})},Ms=({column:e,appId:t,columnIndex:n,databases:r,defaultDatabase:s,wpDatabase:i,target:l,setLookup:c})=>{var S,R;F.debug(e,t,n,r,s,i,l);const[u,d]=a.useState(!1),h=()=>{c(n,void 0),d(!1)},[f,v]=a.useState(!1);F.debug("wizardOn",f);const[g,p]=a.useState(!1),[x,y]=a.useState(!1);return o.jsxs(o.Fragment,{children:[e.lookup!==void 0&&!f?o.jsxs(k,{sx:{display:"grid",gridGap:"10px"},children:[o.jsx(ge,{fullWidth:!0,label:"Database",value:e.lookup.dbs,disabled:!0}),o.jsx(ge,{fullWidth:!0,label:"Table",value:e.lookup.tbl,disabled:!0}),o.jsx(ge,{fullWidth:!0,label:"Lookup column",value:e.lookup.key,disabled:!0}),o.jsx(ge,{fullWidth:!0,label:"Values shown in lookup",value:e.lookup.value.split(",").join(e.lookup.delimiter),disabled:!0}),o.jsx(ge,{fullWidth:!0,label:"Default where",value:e.lookup.defaultWhere,disabled:!0}),o.jsx(ge,{fullWidth:!0,multiline:!0,label:"Dynamic conditions",value:(R=(S=e.lookup)==null?void 0:S.dynamicConditions)==null?void 0:R.map(C=>C.lookupColumnName+" = "+C.tableColumnName).join(`
`),disabled:!0}),o.jsxs(k,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",alignItems:"center",gap:"10px"},children:[o.jsx(U,{variant:"contained",fullWidth:!0,startIcon:o.jsx(fr,{}),onClick:()=>{d(!0)},children:"Delete"}),o.jsx(U,{variant:"contained",fullWidth:!0,endIcon:o.jsx(De,{}),onClick:()=>{v(!0)},children:"Update"})]})]}):o.jsx(o.Fragment,{children:f?o.jsx(As,{column:e,appId:t,columnIndex:n,databases:r,defaultDatabase:s,wpDatabase:i,target:l,setLookup:c,enableWizard:v}):o.jsx(U,{variant:"contained",fullWidth:!0,endIcon:o.jsx(De,{}),onClick:()=>{v(!0)},children:"Start lookup wizard"})}),o.jsxs(ue,{component:"div",sx:{marginTop:"30px"},children:[o.jsx(k,{children:o.jsxs(Zt,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>p(!g),children:[o.jsx(Jt,{}),"What is a lookup?"]})}),g&&o.jsxs(k,{sx:{marginTop:"20px",marginBottom:"30px",display:"grid",gap:"20px"},children:[o.jsx(k,{children:"A lookup is a list of possible allowed values for a specific column. For a fixed number of values, this can be achieved using the enum data type."}),o.jsx(k,{children:"To create a lookup, start the lookup wizard and follow the instructions. A lookup must return a single unique column value."}),o.jsx(k,{children:"Lookups support single selections only. For multiple value selections, use the set data type."})]})]}),o.jsxs(ue,{component:"div",children:[o.jsx(k,{children:o.jsxs(Zt,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>y(!x),children:[o.jsx(Jt,{}),"Example"]})}),x&&o.jsxs(k,{sx:{marginTop:"20px",display:"grid"},children:[o.jsxs(k,{children:["Consider table ",o.jsx("strong",{children:"products"})," containing a product type column. Available product types are stored in a table ",o.jsx("strong",{children:"product_types"}),".",o.jsxs("pre",{children:["create table product_types",o.jsx("br",{}),"(product_type varchar(10) NOT NULL",o.jsx("br",{}),",product_info varchar(255) NOT NULL",o.jsx("br",{}),",...",o.jsx("br",{}),",PRIMARY KEY (product_type)",o.jsx("br",{}),")",o.jsx("br",{}),o.jsx("br",{}),"create table products",o.jsx("br",{}),"(product_id int NOT NULL",o.jsx("br",{}),",product_type varchar(10) NOT NULL",o.jsx("br",{}),",...",o.jsx("br",{}),",PRIMARY KEY (product_id)",o.jsx("br",{}),",FOREIGN KEY (product_type)",o.jsx("br",{})," REFERENCES product_types(product_type)",o.jsx("br",{}),")"]})]}),o.jsxs(k,{children:["Start the lookup wizard",o.jsxs("ol",{style:{padding:"0 40px"},children:[o.jsx("li",{children:"Select your database"}),o.jsxs("li",{children:["Select lookup table ",o.jsx("strong",{children:"`product_types`"})]}),o.jsxs("li",{children:["Select lookup column ",o.jsx("strong",{children:"`product_type`"})]}),o.jsxs("li",{children:["Select ",o.jsx("strong",{children:"`product_info`"})," (or other(s))"]}),o.jsx("li",{children:"Add lookup conditions (if applicable)"})]})]}),o.jsxs(k,{children:["Notes",o.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px"},children:[o.jsx("li",{children:"Step 4 allows you to add multiple lookup columns to the list. A column delimiter can be added between the selected columns. Columns added in step 4 are included in the search on the lookup table."}),o.jsxs("li",{children:["Additional lookup conditions are not necessary if you want to show all available lookup values. Use the ",o.jsx("strong",{children:"Default where"})," clause if you want to show a subset of the lookup values."]}),o.jsxs("li",{children:[o.jsx("strong",{children:"Dynamic conditions"})," can be used to make the list output depend on other form values. Use dynamic conditions to create cascading drop-down lists."]})]})]})]})]}),u&&o.jsx(Lr,{title:"Please confirm",message:"Are you sure you want to delete this lookup? This action cannot be undone once you click APPLY!",open:u,setOpen:d,onConfirm:()=>h()})]})},Is=e=>{const[t,n]=a.useState({databases:[],defaultDatabase:"",wpDatabase:""});return F.debug("databases",t),a.useEffect(()=>{hn(e)&&t.databases.length===0&&xr(e,r=>{const s=r==null?void 0:r.data;F.debug("response data",s);const i=[];let l="",c="";s.map(u=>{var d;F.debug(u),(u==null?void 0:u.dbs)!==void 0&&(i.push(u.dbs),((d=u==null?void 0:u.dbs_type)==null?void 0:d.toLocaleLowerCase())==="wp"&&(c=u.dbs,l=u.dbs))}),i.sort((u,d)=>u.localeCompare(d,void 0,{sensitivity:"base"})),n({databases:i,defaultDatabase:l,wpDatabase:c})},r=>{F.error("error",r)})},[e,t]),t},ti=({appId:e,columnIndex:t,tableColumn:n,columnMetaData:r,setLookup:s})=>{var u;const i=Is(e),l=vn(e),c=()=>typeof n.inlineEditing=="boolean";return!hn(e)||r===null||n.computedField!==void 0||t===void 0||qt(r==null?void 0:r.data_type)!=="string"&&qt(r==null?void 0:r.data_type)!=="number"||(r==null?void 0:r.data_type)==="enum"||(r==null?void 0:r.data_type)==="set"?null:o.jsxs(yn,{disableGutters:!0,children:[o.jsxs(Cn,{expandIcon:o.jsx(pn,{}),sx:{fontSize:"1rem","& .MuiAccordionSummary-content":{padding:"1rem",alignItems:"center"}},children:[o.jsx(pr,{}),o.jsx("span",{style:{paddingLeft:"0.5rem"},children:"Lookup"})]}),o.jsxs(mn,{sx:{marginTop:"10px"},children:[o.jsx(Ms,{appId:e,column:n,columnIndex:t,databases:i.databases,defaultDatabase:i.defaultDatabase,wpDatabase:i.wpDatabase,target:st.TABLE,setLookup:s}),c()&&n.lookup!==void 0&&o.jsx(k,{sx:{marginTop:"20px"},children:o.jsxs(Te,{children:[o.jsx(xn,{control:o.jsx(Fr,{checked:((u=n.lookup)==null?void 0:u.loadOnStartup)||r.is_nullable==="NO"&&n.inlineEditing===!0,disabled:r.is_nullable==="NO"&&n.inlineEditing,onChange:(d,h)=>{const f=n.lookup;f!==void 0&&(s(t,{...f,loadOnStartup:h}),l(!0)),d.stopPropagation()}}),label:"Load full lookup on startup",labelPlacement:"end"}),o.jsx(ue,{component:"div",sx:{"& ul":{margin:0,padding:"5px"}},children:o.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px"},children:[o.jsx("li",{children:"Loading small lookups into memory increases performance on startup"}),o.jsx("li",{children:"When disabled for large lookups, lookup values are cached"}),o.jsx("li",{children:"This feature is auto enabled when inline editing is enabled"}),o.jsx("li",{children:"Lookups are applied on save"}),o.jsx("li",{children:"A lookup change might require an app reload"})]})})]})})]})]})},ni=({columnMetaData:e})=>e===void 0?null:o.jsxs(yn,{disableGutters:!0,children:[o.jsxs(Cn,{expandIcon:o.jsx(pn,{}),sx:{fontSize:"1rem","& .MuiAccordionSummary-content":{padding:"1rem",alignItems:"center"}},children:[o.jsx(gr,{}),o.jsx("span",{style:{paddingLeft:"0.5rem"},children:"Column metadata"})]}),o.jsxs(mn,{sx:{display:"grid"},children:[o.jsxs(k,{sx:{marginTop:"1rem",display:"grid",gridTemplateColumns:"auto auto",gap:"10px",justifyContent:"left",alignItems:"center"},children:[o.jsx("div",{children:"Column name"}),o.jsx("div",{children:o.jsx("strong",{children:e.column_name})}),o.jsx("div",{children:"Data type"}),o.jsx("div",{children:o.jsx("strong",{children:e.column_type})}),o.jsx("div",{children:"Is nullable"}),o.jsx("div",{children:o.jsx("strong",{children:e.is_nullable})}),o.jsx("div",{children:"Default value"}),o.jsx("div",{children:o.jsx("strong",{children:e.column_default??"null"})}),e.extra!==""&&o.jsxs(o.Fragment,{children:[o.jsx("div",{}),o.jsx("div",{children:o.jsx("strong",{children:e.extra})})]})]}),o.jsx(Te,{children:o.jsx(ue,{children:"This is the how the column is stored in the database."})})]})]}),ri=(e,t)=>{t===void 0&&(t=sr(jt.getState(),e));const n=a.useMemo(()=>{var s,i;const r={};if(Array.isArray(t==null?void 0:t.columns)&&((s=t==null?void 0:t.columns)==null?void 0:s.length)>0)for(let l=0;l<t.columns.length;l++)r[t.columns[l].column_name]=t.columns[l];if(Array.isArray(t==null?void 0:t.relation_columns)&&((i=t==null?void 0:t.relation_columns)==null?void 0:i.length)>0)for(let l=0;l<t.relation_columns.length;l++)r["d."+t.relation_columns[l].column_name]=t.relation_columns[l];return r},[t]);return F.debug(n),n};export{as as D,ei as I,On as M,zt as P,ti as S,Ln as T,ni as a,ks as b,so as c,mt as d,uo as e,xs as f,Ds as g,Zs as h,Yr as i,ri as u};