@simpoobusiness/sdk 2.0.84 → 2.0.85
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/simpoo-sdk.js +1 -1
- package/dist/simpoo-sdk.js.map +1 -1
- package/package.json +1 -1
package/dist/simpoo-sdk.js
CHANGED
|
@@ -220,7 +220,7 @@ to {
|
|
|
220
220
|
animation: ${Dj} 2.5s cubic-bezier(0.35, 0.04, 0.63, 0.95) infinite;
|
|
221
221
|
`,_j.svg`
|
|
222
222
|
transform-origin: 50% 65%;
|
|
223
|
-
`;var Fj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});D.forwardRef((e,t)=>m.jsx(hi.span,{...e,ref:t,style:{...Fj,...e.style}})).displayName="VisuallyHidden";var zj=[" ","Enter","ArrowUp","ArrowDown"],$j=[" ","Enter"],Hj="Select",[Bj,Vj,Uj]=gi(Hj),[qj]=ai(Hj,[Uj,zl]),Wj=zl(),[Yj,Gj]=qj(Hj),[Kj,Qj]=qj(Hj),Zj=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:i,defaultValue:s,onValueChange:l,dir:u,name:c,autoComplete:d,disabled:f,required:p,form:h}=e,g=Wj(t),[y,v]=D.useState(null),[b,w]=D.useState(null),[x,C]=D.useState(!1),S=vi(u),[k,_]=ui({prop:r,defaultProp:o??!1,onChange:a,caller:Hj}),[E,j]=ui({prop:i,defaultProp:s,onChange:l,caller:Hj}),N=D.useRef(null),R=!y||(h||!!y.closest("form")),[O,P]=D.useState(new Set),T=Array.from(O).map(e=>e.props.value).join(";");return m.jsx(tu,{...g,children:m.jsxs(Yj,{required:p,scope:t,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:x,onValueNodeHasChildrenChange:C,contentId:Ui(),value:E,onValueChange:j,open:k,onOpenChange:_,dir:S,triggerPointerDownPosRef:N,disabled:f,children:[m.jsx(Bj.Provider,{scope:t,children:m.jsx(Kj,{scope:e.__scopeSelect,onNativeOptionAdd:D.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:D.useCallback(e=>{P(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:n})}),R?m.jsxs(LN,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:E,onChange:e=>j(e.target.value),disabled:f,form:h,children:[void 0===E?m.jsx("option",{value:""}):null,Array.from(O)]},T):null]})})};Zj.displayName=Hj;var Xj="SelectTrigger",Jj=D.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=Wj(n),i=Gj(Xj,n),s=i.disabled||r,l=oi(t,i.onTriggerChange),u=Vj(n),c=D.useRef("touch"),[d,f,p]=zN(e=>{const t=u().filter(e=>!e.disabled),n=t.find(e=>e.value===i.value),r=$N(t,e,n);void 0!==r&&i.onValueChange(r.value)}),h=e=>{s||(i.onOpenChange(!0),p()),e&&(i.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return m.jsx(nu,{asChild:!0,...a,children:m.jsx(hi.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":FN(i.value)?"":void 0,...o,ref:l,onClick:ti(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==c.current&&h(e)}),onPointerDown:ti(o.onPointerDown,e=>{c.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(h(e),e.preventDefault())}),onKeyDown:ti(o.onKeyDown,e=>{const t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),t&&" "===e.key||zj.includes(e.key)&&(h(),e.preventDefault())})})})});Jj.displayName=Xj;var eN="SelectValue",tN=D.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:i="",...s}=e,l=Gj(eN,n),{onValueNodeHasChildrenChange:u}=l,c=void 0!==a,d=oi(t,l.onValueNodeChange);return si(()=>{u(c)},[u,c]),m.jsx(hi.span,{...s,ref:d,style:{pointerEvents:"none"},children:FN(l.value)?m.jsx(m.Fragment,{children:i}):a})});tN.displayName=eN;var nN=D.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return m.jsx(hi.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});nN.displayName="SelectIcon";var rN=e=>m.jsx(au,{asChild:!0,...e});rN.displayName="SelectPortal";var oN="SelectContent",aN=D.forwardRef((e,t)=>{const n=Gj(oN,e.__scopeSelect),[r,o]=D.useState();if(si(()=>{o(new DocumentFragment)},[]),!n.open){const t=r;return t?sr.createPortal(m.jsx(sN,{scope:e.__scopeSelect,children:m.jsx(Bj.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),t):null}return m.jsx(cN,{...e,ref:t})});aN.displayName=oN;var iN=10,[sN,lN]=qj(oN),uN=ci("SelectContent.RemoveScroll"),cN=D.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:g,avoidCollisions:y,...v}=e,b=Gj(oN,n),[w,x]=D.useState(null),[C,S]=D.useState(null),k=oi(t,e=>x(e)),[_,E]=D.useState(null),[j,N]=D.useState(null),R=Vj(n),[O,P]=D.useState(!1),T=D.useRef(!1);D.useEffect(()=>{if(w)return Tu(w)},[w]),Oi();const M=D.useCallback(e=>{const[t,...n]=R().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const n of e){if(n===o)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==o)return}},[R,C]),I=D.useCallback(()=>M([_,w]),[M,_,w]);D.useEffect(()=>{O&&I()},[O,I]);const{onOpenChange:A,triggerPointerDownPosRef:L}=b;D.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||A(!1),document.removeEventListener("pointermove",t),L.current=null};return null!==L.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[w,A,L]),D.useEffect(()=>{const e=()=>A(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[A]);const[F,z]=zN(e=>{const t=R().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=$N(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),$=D.useCallback((e,t,n)=>{const r=!T.current&&!n;(void 0!==b.value&&b.value===t||r)&&(E(e),r&&(T.current=!0))},[b.value]),H=D.useCallback(()=>w?.focus(),[w]),B=D.useCallback((e,t,n)=>{const r=!T.current&&!n;(void 0!==b.value&&b.value===t||r)&&N(e)},[b.value]),V="popper"===r?fN:dN,U=V===fN?{side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:g,avoidCollisions:y}:{};return m.jsx(sN,{scope:n,content:w,viewport:C,onViewportChange:S,itemRefCallback:$,selectedItem:_,onItemLeave:H,itemTextRefCallback:B,focusSelectedItem:I,selectedItemText:j,position:r,isPositioned:O,searchRef:F,children:m.jsx(wc,{as:uN,allowPinchZoom:!0,children:m.jsx(Ii,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:ti(o,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:m.jsx(_i,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:m.jsx(V,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:e=>e.preventDefault(),...v,...U,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ti(v.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});cN.displayName="SelectContentImpl";var dN=D.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=Gj(oN,n),i=lN(oN,n),[s,l]=D.useState(null),[u,c]=D.useState(null),d=oi(t,e=>c(e)),f=Vj(n),p=D.useRef(!1),h=D.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=i,w=D.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&u&&g&&y&&v){const e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),o=v.getBoundingClientRect();if("rtl"!==a.dir){const r=o.left-t.left,a=n.left-r,i=e.left-a,l=e.width+i,u=Math.max(l,t.width),c=window.innerWidth-iN,d=Aj(a,[iN,Math.max(iN,c-u)]);s.style.minWidth=l+"px",s.style.left=d+"px"}else{const r=t.right-o.right,a=window.innerWidth-n.right-r,i=window.innerWidth-e.right-a,l=e.width+i,u=Math.max(l,t.width),c=window.innerWidth-iN,d=Aj(a,[iN,Math.max(iN,c-u)]);s.style.minWidth=l+"px",s.style.right=d+"px"}const i=f(),l=window.innerHeight-2*iN,c=g.scrollHeight,d=window.getComputedStyle(u),h=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),b=parseInt(d.borderBottomWidth,10),w=h+m+c+parseInt(d.paddingBottom,10)+b,x=Math.min(5*y.offsetHeight,w),C=window.getComputedStyle(g),S=parseInt(C.paddingTop,10),k=parseInt(C.paddingBottom,10),_=e.top+e.height/2-iN,E=l-_,j=y.offsetHeight/2,N=h+m+(y.offsetTop+j),R=w-N;if(N<=_){const e=i.length>0&&y===i[i.length-1].ref.current;s.style.bottom="0px";const t=u.clientHeight-g.offsetTop-g.offsetHeight,n=N+Math.max(E,j+(e?k:0)+t+b);s.style.height=n+"px"}else{const e=i.length>0&&y===i[0].ref.current;s.style.top="0px";const t=Math.max(_,h+g.offsetTop+(e?S:0)+j)+R;s.style.height=t+"px",g.scrollTop=N-_+g.offsetTop}s.style.margin=`${iN}px 0`,s.style.minHeight=x+"px",s.style.maxHeight=l+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,u,g,y,v,a.dir,r]);si(()=>w(),[w]);const[x,C]=D.useState();si(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const S=D.useCallback(e=>{e&&!0===h.current&&(w(),b?.(),h.current=!1)},[w,b]);return m.jsx(pN,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:m.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:m.jsx(hi.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});dN.displayName="SelectItemAlignedPosition";var fN=D.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=iN,...a}=e,i=Wj(n);return m.jsx(ru,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.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)"}})});fN.displayName="SelectPopperPosition";var[pN,hN]=qj(oN,{}),mN="SelectViewport",gN=D.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=lN(mN,n),i=hN(mN,n),s=oi(t,a.onViewportChange),l=D.useRef(0);return m.jsxs(m.Fragment,{children:[m.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}),m.jsx(Bj.Slot,{scope:n,children:m.jsx(hi.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ti(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=i;if(r?.current&&n){const e=Math.abs(l.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*iN,o=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),i=Math.max(o,a);if(i<r){const o=i+e,a=Math.min(r,o),s=o-a;n.style.height=a+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}l.current=t.scrollTop})})})]})});gN.displayName=mN;var yN="SelectGroup",[vN,bN]=qj(yN);D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ui();return m.jsx(vN,{scope:n,id:o,children:m.jsx(hi.div,{role:"group","aria-labelledby":o,...r,ref:t})})}).displayName=yN;var wN="SelectLabel",xN=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=bN(wN,n);return m.jsx(hi.div,{id:o.id,...r,ref:t})});xN.displayName=wN;var CN="SelectItem",[SN,kN]=qj(CN),_N=D.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...i}=e,s=Gj(CN,n),l=lN(CN,n),u=s.value===r,[c,d]=D.useState(a??""),[f,p]=D.useState(!1),h=oi(t,e=>l.itemRefCallback?.(e,r,o)),g=Ui(),y=D.useRef("touch"),v=()=>{o||(s.onValueChange(r),s.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 m.jsx(SN,{scope:n,value:r,disabled:o,textId:g,isSelected:u,onItemTextChange:D.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:m.jsx(Bj.ItemSlot,{scope:n,value:r,disabled:o,textValue:c,children:m.jsx(hi.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:h,onFocus:ti(i.onFocus,()=>p(!0)),onBlur:ti(i.onBlur,()=>p(!1)),onClick:ti(i.onClick,()=>{"mouse"!==y.current&&v()}),onPointerUp:ti(i.onPointerUp,()=>{"mouse"===y.current&&v()}),onPointerDown:ti(i.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:ti(i.onPointerMove,e=>{y.current=e.pointerType,o?l.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ti(i.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:ti(i.onKeyDown,e=>{""!==l.searchRef?.current&&" "===e.key||($j.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});_N.displayName=CN;var EN="SelectItemText",jN=D.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,i=Gj(EN,n),s=lN(EN,n),l=kN(EN,n),u=Qj(EN,n),[c,d]=D.useState(null),f=oi(t,e=>d(e),l.onItemTextChange,e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),p=c?.textContent,h=D.useMemo(()=>m.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=u;return si(()=>(g(h),()=>y(h)),[g,y,h]),m.jsxs(m.Fragment,{children:[m.jsx(hi.span,{id:l.textId,...a,ref:f}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?sr.createPortal(a.children,i.valueNode):null]})});jN.displayName=EN;var NN="SelectItemIndicator",RN=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return kN(NN,n).isSelected?m.jsx(hi.span,{"aria-hidden":!0,...r,ref:t}):null});RN.displayName=NN;var ON="SelectScrollUpButton",PN=D.forwardRef((e,t)=>{const n=lN(ON,e.__scopeSelect),r=hN(ON,e.__scopeSelect),[o,a]=D.useState(!1),i=oi(t,r.onScrollButtonChange);return si(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;a(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?m.jsx(MN,{...e,ref:i,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});PN.displayName=ON;var TN="SelectScrollDownButton",DN=D.forwardRef((e,t)=>{const n=lN(TN,e.__scopeSelect),r=hN(TN,e.__scopeSelect),[o,a]=D.useState(!1),i=oi(t,r.onScrollButtonChange);return si(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?m.jsx(MN,{...e,ref:i,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});DN.displayName=TN;var MN=D.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=lN("SelectScrollButton",n),i=D.useRef(null),s=Vj(n),l=D.useCallback(()=>{null!==i.current&&(window.clearInterval(i.current),i.current=null)},[]);return D.useEffect(()=>()=>l(),[l]),si(()=>{const e=s().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[s]),m.jsx(hi.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ti(o.onPointerDown,()=>{null===i.current&&(i.current=window.setInterval(r,50))}),onPointerMove:ti(o.onPointerMove,()=>{a.onItemLeave?.(),null===i.current&&(i.current=window.setInterval(r,50))}),onPointerLeave:ti(o.onPointerLeave,()=>{l()})})}),IN=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.jsx(hi.div,{"aria-hidden":!0,...r,ref:t})});IN.displayName="SelectSeparator";var AN="SelectArrow";D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Wj(n),a=Gj(AN,n),i=lN(AN,n);return a.open&&"popper"===i.position?m.jsx(ou,{...o,...r,ref:t}):null}).displayName=AN;var LN=D.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=D.useRef(null),a=oi(r,o),i=Lj(t);return D.useEffect(()=>{const e=o.current;if(!e)return;const n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,"value").set;if(i!==t&&r){const n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[i,t]),m.jsx(hi.select,{...n,style:{...Fj,...n.style},ref:a,defaultValue:t})});function FN(e){return""===e||void 0===e}function zN(e){const t=bi(e),n=D.useRef(""),r=D.useRef(0),o=D.useCallback(e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(o)},[t]),a=D.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function $N(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0]),o=r?t[0]:t,a=n?e.indexOf(n):-1;let i=(s=e,l=Math.max(a,0),s.map((e,t)=>s[(l+t)%s.length]));var s,l;1===o.length&&(i=i.filter(e=>e!==n));const u=i.find(e=>e.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}LN.displayName="SelectBubbleInput";var HN=Jj,BN=nN,VN=rN,UN=aN,qN=gN,WN=xN,YN=_N,GN=jN,KN=RN,QN=PN,ZN=DN,XN=IN;const JN=Zj,eR=tN,tR=D.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(HN,{ref:r,className:Ya("flex h-10 w-full items-center hover:border-[#BFD7FE] justify-between rounded-md border focus:border-primary border-neutral-200 bg-white px-3 py-2 text-sm ring-offset-white placeholder:text-neutral-500 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 ",e),...n,children:[t,m.jsx(BN,{asChild:!0,children:m.jsx(jf,{className:"h-4 w-4 opacity-50"})})]}));tR.displayName=HN.displayName;const nR=D.forwardRef(({className:e,...t},n)=>m.jsx(QN,{ref:n,className:Ya("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(Rf,{className:"h-4 w-4"})}));nR.displayName=QN.displayName;const rR=D.forwardRef(({className:e,...t},n)=>m.jsx(ZN,{ref:n,className:Ya("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(jf,{className:"h-4 w-4"})}));rR.displayName=ZN.displayName;const oR=D.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>{const{portalRef:a}=Pr();return m.jsx(VN,{container:a.current,children:m.jsxs(UN,{ref:o,className:Ya("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white text-neutral-950 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 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50","popper"===n&&"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,...r,children:[m.jsx(nR,{}),m.jsx(qN,{className:Ya("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),m.jsx(rR,{})]})})});oR.displayName=UN.displayName;D.forwardRef(({className:e,...t},n)=>m.jsx(WN,{ref:n,className:Ya("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=WN.displayName;const aR=D.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(YN,{ref:r,className:Ya("relative flex w-full select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-primary/20 cursor-pointer focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50",e),...n,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(KN,{children:m.jsx(Ef,{className:"h-4 w-4"})})}),m.jsx(GN,{children:t})]}));aR.displayName=YN.displayName;function iR({label:e,addonLabel:t,type:n,placeholder:r,selectPlaceholder:o,error:a,success:i,value:s,defaultValue:l,name:u,id:c,formik:d,onChange:f,inputRef:p,onBlur:h,required:g,disabled:y,loading:v,showError:b,selectOptions:w,disableSearch:x,searchSelectPlaceholder:C,showSelectSearch:S,onSelectValueChange:k,selectValue:_,showOutline:E=!0,cols:j,rows:N,labelClass:R,addonLabelClass:O,optional:P,info:T,addonInfo:M,icon:I,actionIcon:A,actionLabel:L,actionLabelInfo:F,actionLabelAction:z,className:$,textAreaOnChange:H,addOn:B,infoAlignment:V,addonInfoAlignment:U,inputContainerClass:q,showNegative:W,showPositive:Y,...G}){const[K,Q]=D.useState(n),[Z,X]=D.useState(!1),[J,ee]=D.useState(""),te=((e,t)=>{const n=e?.filter(e=>"string"==typeof e.label?e.label?.toLowerCase().includes(t.toLowerCase()):e.value?.toLowerCase().includes(t.toLowerCase())||e?.searchId?.toLowerCase().includes(t.toLowerCase()));return t?n:e})(w??[],J);return m.jsx(m.Fragment,{children:v?m.jsx(ei,{className:"w-full h-12"}):m.jsx("div",{className:"w-full",children:m.jsxs("div",{className:`flex flex-col ${e&&"gap-2.5"} relative `,children:[m.jsxs("div",{className:"flex justify-between gap-2 flex-wrap",children:[t&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",O),children:[t," ",g?m.jsx("span",{className:"text-[#E12D39]",children:t&&"*"}):P?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,M&&m.jsx(kb,{fieldName:t,align:U,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:M})})]}),e&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",R),children:[e," ",g?m.jsx("span",{className:"text-[#E12D39]",children:e&&"*"}):P?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,T&&m.jsx(kb,{fieldName:e,align:V,children:m.jsx("p",{className:"font-normal first-letter:uppercase w-full whitespace-pre-wrap",children:T})})]}),L&&m.jsxs("button",{onClick:z,className:"text-primary flex items-center gap-1 first-letter:uppercase text-sm font-bold",children:[A,L,F&&m.jsx(kb,{fieldName:e,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:F})})]})]}),m.jsxs("div",{className:Ya(`border overflow-hidden rounded-md text-sm border-[#E1E3EA] hover:border-primary_light font-normal text-grey-950 flex gap-2 items-center bg-white px-3 ${"text-area"!==n&&"h-12"} ${(a||b)&&"!border-danger"} ${i&&"!border-success"} ${Z&&E&&"!border-primary"}\n ${I&&"px-2"}\n ${B&&"px-0"}\n `,y?"cursor-not-allowed bg-gray-200":null,w?"px-0":null,q),children:[B&&m.jsx("span",{className:"bg-gray-200 text-[13px] font-semibold text-gray-700 h-full min-w-[38px] flex items-center justify-center shrink-0 rounded-l-md px-2 ",children:B}),I,w&&m.jsxs(JN,{onValueChange:k,defaultValue:_,value:_,children:[m.jsx(tR,{disabled:x,className:" min-w-max w-max h-full border-0 border-r rounded-none hover:border-neutral-200 focus:border-neutral-200 bg-[#F9F9F9] hover:border-b-neutral-200 disabled:opacity-100 ",children:m.jsx(eR,{className:" text-sm text-[#5E6278] placeholder:font-medium outline-none",placeholder:o})}),m.jsxs(oR,{className:"bg-white w-full relative",children:[S&&m.jsx("input",{value:J,onChange:e=>{ee(e.target.value.toString())},placeholder:C??"Search...",className:"h-10 border mb-2 text-sm px-4 outline-none w-full border-neutral-200 rounded bg-white sticky top-0 z-20"}),te?.map((e,t)=>m.jsx(aR,{className:"text-sm",value:e.value,children:e.label},e.value))]})]}),"text-area"===n?m.jsx("textarea",{cols:j,rows:N,onFocus:()=>X(!0),onBlur:e=>{X(!1)},placeholder:r,className:Ya(`placeholder:text-[#7E8299] hover:border-primary_light py-2 h-full placeholder:font-medium outline-none w-full rounded ${y?"bg-[#EEEFF2] cursor-not-allowed":null} ${Z&&E&&"!border-primary"} transition-all ease-in-out`,$),...G,value:s,name:u,onChange:H}):m.jsx("input",{onInput:e=>{const t=e.target;"number"===n&&(t.value=t.value.replace(/[^0-9.]/g,""),t.value=t.value.replace(/^\.|(\..*)\./g,"$1"),t.value.length>1&&t.value.startsWith("0")&&"."!==t.value[1]&&(t.value=t.value.replace(/^0+/,"")),""!==t.value&&"0"!==t.value||(t.value="0"))},type:"number"===K?"text":K,placeholder:r,className:Ya("placeholder:text-[#7E8299] h-full placeholder:font-medium outline-none w-full rounded disabled:cursor-not-allowed",w&&"number"===n?"pr-2":null,I||B?"pr-0":null,w&&"number"===n&&t&&"text-right pr-2",$,Y&&"0"!==s?.toString().trim()?"text-green-600 font-semibold":"",W&&s?.toString().trim().startsWith("-")?"text-red-600 font-semibold":""),onFocus:()=>X(!0),onBlur:e=>{d&&h&&d&&h(e),X(!1)},value:s||"",defaultValue:l,onChange:f,id:c,name:u,required:g,disabled:y,ref:p,...G}),"password"===n&&m.jsx("span",{className:"cursor-pointer",onClick:()=>{Q(e=>"password"===e?"text":"password")},children:"password"===K?Kv.eyeslash:Kv.eye})]}),a&&m.jsx("p",{className:"text-danger text-xs font-normal",children:a})]})})})}function sR({value:e,label:t,placeholder:n,uuid:r,name:o,displayValue:a,valueType:i,item_unit:s}){const{mutate:l,isPending:u}=Gx();J();const[c,d]=D.useState(!1),[f,p]=D.useState({item_uuid:r,[o]:e});tr();const[h,g]=D.useState("");return m.jsxs(Ak,{open:c,onOpenChange:d,children:[m.jsx(Lk,{className:"flex items-center",children:m.jsx("button",{className:"hover:text-primary duration-150 underline disabled:no-underline disabled:hover:text-inherit",children:h?"selling_price"===o?Jv(+h):eb(+h)+s:a})}),m.jsxs(Fk,{align:"center",className:"shadow-[0_1px_2px_0px_#E4E5E73D,_0_12px_24px_0_#868C981F] space-y-2 bg-white rounded-xl p-3 w-[280px] relative before:absolute before:w-3 before:h-1.5 before:bg-white before:left-1/2 before:-translate-x-1/2 before:rotate-45 data-[side=bottom]:before:top-0 data-[side=top]:before:bottom-0",children:[m.jsx(iR,{type:i,value:f[o],label:t,placeholder:n,onChange:e=>{p(t=>({...t,[o]:e.target.value}))}}),m.jsxs("div",{className:"flex justify-end gap-2.5",children:[m.jsx(Tk,{children:m.jsx(Mj,{label:"Dismiss",className:"bg-gray-300 text-dark text-sm hover:bg-gray-300/90 font-medium",disabled:u})}),m.jsx(Mj,{label:"Update",className:"text-sm font-medium",onClick:()=>{l({url:"/items/update_basic",payload:f},{onSuccess:()=>{g(f[o]),d(!1)},onError:()=>{g("")}})},loading:u})]})]})]})}D.forwardRef(({className:e,...t},n)=>m.jsx(XN,{ref:n,className:Ya("-mx-1 my-1 h-px bg-neutral-100 dark:bg-neutral-800",e),...t})).displayName=XN.displayName;var lR="Tabs",[uR]=ai(lR,[mu]),cR=mu(),[dR,fR]=uR(lR),pR=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:i="horizontal",dir:s,activationMode:l="automatic",...u}=e,c=vi(s),[d,f]=ui({prop:r,onChange:o,defaultProp:a??"",caller:lR});return m.jsx(dR,{scope:n,baseId:Ui(),value:d,onValueChange:f,orientation:i,dir:c,activationMode:l,children:m.jsx(hi.div,{dir:c,"data-orientation":i,...u,ref:t})})});pR.displayName=lR;var hR="TabsList",mR=D.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,a=fR(hR,n),i=cR(n);return m.jsx(ku,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:m.jsx(hi.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});mR.displayName=hR;var gR="TabsTrigger",yR=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=e,i=fR(gR,n),s=cR(n),l=wR(i.baseId,r),u=xR(i.baseId,r),c=r===i.value;return m.jsx(_u,{asChild:!0,...s,focusable:!o,active:c,children:m.jsx(hi.button,{type:"button",role:"tab","aria-selected":c,"aria-controls":u,"data-state":c?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...a,ref:t,onMouseDown:ti(e.onMouseDown,e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():i.onValueChange(r)}),onKeyDown:ti(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&i.onValueChange(r)}),onFocus:ti(e.onFocus,()=>{const e="manual"!==i.activationMode;c||o||!e||i.onValueChange(r)})})})});yR.displayName=gR;var vR="TabsContent",bR=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...i}=e,s=fR(vR,n),l=wR(s.baseId,r),u=xR(s.baseId,r),c=r===s.value,d=D.useRef(c);return D.useEffect(()=>{const e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),m.jsx(iu,{present:o||c,children:({present:n})=>m.jsx(hi.div,{"data-state":c?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!n,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:n&&a})})});function wR(e,t){return`${e}-trigger-${t}`}function xR(e,t){return`${e}-content-${t}`}bR.displayName=vR;var CR=mR,SR=yR,kR=bR;const _R=pR,ER=D.forwardRef(({className:e,...t},n)=>m.jsx(CR,{ref:n,className:Ya("inline-flex h-10 items-center justify-center rounded-md bg-neutral-100 p-1 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400",e),...t}));ER.displayName=CR.displayName;const jR=D.forwardRef(({className:e,...t},n)=>m.jsx(SR,{ref:n,className:Ya("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-neutral-950 data-[state=active]:shadow-sm dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300 dark:data-[state=active]:bg-neutral-950 dark:data-[state=active]:text-neutral-50",e),...t}));jR.displayName=SR.displayName;const NR=D.forwardRef(({className:e,...t},n)=>m.jsx(kR,{ref:n,className:Ya("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-offset-2 dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300",e),...t}));NR.displayName=kR.displayName;var RR,OR={};function PR(){if(RR)return OR;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}RR=1,Object.defineProperty(OR,"__esModule",{value:!0}),OR.Collapse=void 0;var t,n=(t=f())&&t.__esModule?t:{default:t};function r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function a(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,o=s(t);if(n){var a=s(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return i(t)}(this,r)}}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(s,e);var t=a(s);function s(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),l(i(n=t.call(this,e)),"timeout",void 0),l(i(n),"container",void 0),l(i(n),"content",void 0),l(i(n),"onResize",function(){if(clearTimeout(n.timeout),n.container&&n.content){var e=n.props,t=e.isOpened,r=e.checkTimeout,o=Math.floor(n.container.clientHeight),a=Math.floor(n.content.clientHeight),i=t&&Math.abs(a-o)<=1,s=!t&&Math.abs(o)<=1;i||s?n.onRest({isFullyOpened:i,isFullyClosed:s,isOpened:t,containerHeight:o,contentHeight:a}):(n.onWork({isFullyOpened:i,isFullyClosed:s,isOpened:t,containerHeight:o,contentHeight:a}),n.timeout=setTimeout(function(){return n.onResize()},r))}}),l(i(n),"onRest",function(e){var t=e.isFullyOpened,r=e.isFullyClosed,o=e.isOpened,a=e.containerHeight,i=e.contentHeight;if(n.container&&n.content){var s=o&&n.container.style.height==="".concat(i,"px"),l=!o&&"0px"===n.container.style.height;if(s||l){n.container.style.overflow=o?"initial":"hidden",n.container.style.height=o?"auto":"0px";var u=n.props.onRest;u&&u({isFullyOpened:t,isFullyClosed:r,isOpened:o,containerHeight:a,contentHeight:i})}}}),l(i(n),"onWork",function(e){var t=e.isFullyOpened,r=e.isFullyClosed,o=e.isOpened,a=e.containerHeight,i=e.contentHeight;if(n.container&&n.content){var s=o&&n.container.style.height==="".concat(i,"px"),l=!o&&"0px"===n.container.style.height;if(!s&&!l){n.container.style.overflow="hidden",n.container.style.height=o?"".concat(i,"px"):"0px";var u=n.props.onWork;u&&u({isFullyOpened:t,isFullyClosed:r,isOpened:o,containerHeight:a,contentHeight:i})}}}),l(i(n),"onRefContainer",function(e){n.container=e}),l(i(n),"onRefContent",function(e){n.content=e}),e.initialStyle?n.initialStyle=e.initialStyle:n.initialStyle=e.isOpened?{height:"auto",overflow:"initial"}:{height:"0px",overflow:"hidden"},n}return r(s,[{key:"componentDidMount",value:function(){this.onResize()}},{key:"shouldComponentUpdate",value:function(e){var t=this.props,n=t.theme,r=t.isOpened;return t.children!==e.children||r!==e.isOpened||Object.keys(n).some(function(t){return n[t]!==e.theme[t]})}},{key:"getSnapshotBeforeUpdate",value:function(){if(!this.container||!this.content)return null;if("auto"===this.container.style.height){var e=this.content.clientHeight;this.container.style.height="".concat(e,"px")}return null}},{key:"componentDidUpdate",value:function(){this.onResize()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.theme,r=e.children,o=e.isOpened;return n.default.createElement("div",{ref:this.onRefContainer,className:t.collapse,style:this.initialStyle,"aria-hidden":!o},n.default.createElement("div",{ref:this.onRefContent,className:t.content},r))}}]),s}(n.default.Component);return OR.Collapse=u,l(u,"defaultProps",{theme:{collapse:"ReactCollapse--collapse",content:"ReactCollapse--content"},initialStyle:void 0,onRest:void 0,onWork:void 0,checkTimeout:50}),OR}var TR,DR,MR,IR={};function AR(){if(TR)return IR;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}TR=1,Object.defineProperty(IR,"__esModule",{value:!0}),IR.UnmountClosed=void 0;var t,n=(t=f())&&t.__esModule?t:{default:t},r=PR(),o=["isOpened"],a=["isOpened"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function c(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function p(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,o=m(t);if(n){var a=m(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}(this,r)}}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(s,e);var t=p(s);function s(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),g(h(n=t.call(this,e)),"onWork",function(e){var t=e.isOpened,r=u(e,o);n.setState({isResting:!1,isOpened:t});var a=n.props.onWork;a&&a(l({isOpened:t},r))}),g(h(n),"onRest",function(e){var t=e.isOpened,r=u(e,a);n.setState({isResting:!0,isOpened:t,isInitialRender:!1});var o=n.props.onRest;o&&o(l({isOpened:t},r))}),g(h(n),"getInitialStyle",function(){var e=n.state,t=e.isOpened;return e.isInitialRender&&t?{height:"auto",overflow:"initial"}:{height:"0px",overflow:"hidden"}}),n.state={isResting:!0,isOpened:e.isOpened,isInitialRender:!0},n}return c(s,[{key:"componentDidUpdate",value:function(e){var t=this.props.isOpened;e.isOpened!==t&&this.setState({isResting:!1,isOpened:t,isInitialRender:!1})}},{key:"render",value:function(){var e=this.state,t=e.isResting,o=e.isOpened;return t&&!o?null:n.default.createElement(r.Collapse,i({},this.props,{initialStyle:this.getInitialStyle(),onWork:this.onWork,onRest:this.onRest}))}}]),s}(n.default.PureComponent);return IR.UnmountClosed=y,g(y,"defaultProps",{onWork:void 0,onRest:void 0}),IR}var LR=function(){if(MR)return DR;MR=1;var e=PR().Collapse,t=AR().UnmountClosed;return DR=t,t.Collapse=e,t.UnmountClosed=t,DR}(),FR="Switch",[zR]=ai(FR),[$R,HR]=zR(FR),BR=D.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l="on",onCheckedChange:u,form:c,...d}=e,[f,p]=D.useState(null),h=oi(t,e=>p(e)),g=D.useRef(!1),y=!f||(c||!!f.closest("form")),[v,b]=ui({prop:o,defaultProp:a??!1,onChange:u,caller:FR});return m.jsxs($R,{scope:n,checked:v,disabled:s,children:[m.jsx(hi.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":WR(v),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:h,onClick:ti(e.onClick,e=>{b(e=>!e),y&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),y&&m.jsx(qR,{control:f,bubbles:!g.current,name:r,value:l,checked:v,required:i,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});BR.displayName=FR;var VR="SwitchThumb",UR=D.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=HR(VR,n);return m.jsx(hi.span,{"data-state":WR(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});UR.displayName=VR;var qR=D.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},a)=>{const i=D.useRef(null),s=oi(i,a),l=Lj(n),u=Al(t);return D.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==n&&o){const t=new Event("click",{bubbles:r});o.call(e,n),e.dispatchEvent(t)}},[l,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function WR(e){return e?"checked":"unchecked"}qR.displayName="SwitchBubbleInput";var YR=BR,GR=UR;const KR=D.forwardRef(({className:e,loading:t,...n},r)=>m.jsx(m.Fragment,{children:t?m.jsx(ei,{className:"w-11 h-6"}):m.jsx(YR,{className:Ya("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-neutral-200 dark:focus-visible:ring-neutral-300 dark:focus-visible:ring-offset-neutral-950 dark:data-[state=checked]:bg-neutral-50 dark:data-[state=unchecked]:bg-neutral-800",e),...n,ref:r,children:m.jsx(GR,{className:Ya("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-neutral-950")})})}));function QR({children:e,sessionName:t,info:n,className:r,defaultOpen:o=!1}){const[a,i]=D.useState(o);return D.useEffect(()=>{i(o)},[o]),m.jsxs("div",{className:Ya("flex flex-col duration-300 ",a?"gap-5":"gap-0"),children:[m.jsxs("div",{className:"flex gap-2.5 items-center",children:[m.jsxs("h1",{className:Ya("text-dark font-medium text-sm flex gap-1 items-center first-letter:uppercase",r),children:[t,m.jsx(kb,{fieldName:t,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:n})})]}),m.jsx(KR,{checked:a,onClick:()=>i(!a)})]}),m.jsx(LR.Collapse,{isOpened:a,className:"pt-5",children:e})]})}function ZR(){const e=J(),{itemStoreData:t,editMode:n,fetchingItem:r,canBeDeletedFields:o}=ne(e=>e.items),[a,i]=D.useState(t.barcode??[""]);M.useEffect(()=>{n&&i(o?.barcode?.map(e=>e.barcode)??[])},[r]);const[s,l]=D.useState([]);D.useEffect(()=>{n&&e(Wt({field:"deletedBarcode",value:s}))},[s]);return D.useEffect(()=>{(1!==a.length||""!==a[0])&&e(Wt({field:"barcode",value:a}))},[a]),m.jsx(QR,{sessionName:"Barcode & SKU",info:"Enter the unique barcode or SKU (Stock Keeping Unit) for this item. This helps in tracking inventory, facilitating faster checkouts, and managing stock more efficiently.",defaultOpen:n&&a.length>=0&&""!==a[0]||n&&""!==t.sku,children:m.jsxs("div",{className:" grid grid-cols-2 gap-5",children:[m.jsxs("div",{className:"space-y-4",children:[a.map((e,t)=>m.jsxs("div",{className:"flex items-end gap-2.5",children:[m.jsx(iR,{type:"text",label:"Barcode",info:"Scan or manually enter the item's barcode. This allows for quick identification and tracking of the item during sales and inventory management.",placeholder:"Type barcode",value:e,onChange:e=>((e,t)=>{const n=[...a];n[e]=t,i(n)})(t,e.target.value)}),m.jsx("button",{className:" py-3",onClick:()=>(e=>{const t=a.filter((t,n)=>e!==n),n=a.filter((t,n)=>e===n),r=o?.barcode?.filter(e=>n.includes(e.barcode))||[];i(t),l([...s,...r.map(e=>e.id)])})(t),children:Kv.trash2})]},t)),m.jsx(Mj,{mode:"text",label:"Add another barcode",left_addon:Kv.plus_squared2,onClick:()=>{i(e=>[...e,""])},className:"font-medium text-sm"})]}),m.jsx(iR,{type:"text",label:"SKU",info:"Enter the unique Stock Keeping Unit (SKU) for this item. This code helps in identifying and tracking the item within your inventory system.",value:t.sku,placeholder:"Add SKU",onChange:t=>e(Wt({field:"sku",value:t.target.value}))})]})})}function XR(e,t){return e===t}function JR(e,t,n){var r=XR,o=D.useRef(e),a=D.useState({})[1],i=function(e,t,n,r){var o=this,a=D.useRef(null),i=D.useRef(0),s=D.useRef(0),l=D.useRef(null),u=D.useRef([]),c=D.useRef(),d=D.useRef(),f=D.useRef(e),p=D.useRef(!0),h=D.useRef(),m=D.useRef();f.current=e;var g="undefined"!=typeof window,y=!t&&0!==t&&g;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,b=!("trailing"in n)||!!n.trailing,w=!!n.flushOnExit&&b,x="maxWait"in n,C="debounceOnServer"in n&&!!n.debounceOnServer,S=x?Math.max(+n.maxWait||0,t):null,k=D.useMemo(function(){var e=function(e){var t=u.current,n=c.current;return u.current=c.current=null,i.current=e,s.current=s.current||e,d.current=f.current.apply(n,t)},n=function(e,t){y&&cancelAnimationFrame(l.current),l.current=y?requestAnimationFrame(e):setTimeout(e,t)},k=function(e){if(!p.current)return!1;var n=e-a.current;return!a.current||n>=t||n<0||x&&e-i.current>=S},_=function(t){return l.current=null,b&&u.current?e(t):(u.current=c.current=null,d.current)},E=function e(){var r=Date.now();if(v&&s.current===i.current&&j(),k(r))return _(r);if(p.current){var o=t-(r-a.current),l=x?Math.min(o,S-(r-i.current)):o;n(e,l)}},j=function(){r&&r({})},N=function(){if(g||C){var r,s=Date.now(),f=k(s);if(u.current=[].slice.call(arguments),c.current=o,a.current=s,w&&!h.current&&(h.current=function(){var e;"hidden"===(null==(e=global.document)?void 0:e.visibilityState)&&m.current.flush()},null==(r=global.document)||null==r.addEventListener||r.addEventListener("visibilitychange",h.current)),f){if(!l.current&&p.current)return i.current=a.current,n(E,t),v?e(a.current):d.current;if(x)return n(E,t),e(a.current)}return l.current||n(E,t),d.current}};return N.cancel=function(){var e=l.current;e&&(y?cancelAnimationFrame(l.current):clearTimeout(l.current)),i.current=0,u.current=a.current=c.current=l.current=null,e&&r&&r({})},N.isPending=function(){return!!l.current},N.flush=function(){return l.current?_(Date.now()):d.current},N},[v,x,t,S,b,w,y,g,C,r]);return m.current=k,D.useEffect(function(){return p.current=!0,function(){var e;w&&m.current.flush(),h.current&&(null==(e=global.document)||null==e.removeEventListener||e.removeEventListener("visibilitychange",h.current),h.current=null),p.current=!1}},[w]),k}(D.useCallback(function(e){o.current=e,a({})},[a]),t,n,a),s=D.useRef(e);return r(s.current,e)||(i(e),s.current=e),[o.current,i]}function eO({handleInputChange:e}){const t=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t})`,"gi");return e.split(n).map((e,n)=>e.toLowerCase()===t.toLowerCase()?m.jsx("span",{className:"text-orange",children:e},n):e)},{itemStoreData:n,editMode:r,fetchingItem:o}=ne(e=>e.items),[a,i]=D.useState(""),[s]=JR(a,1e3),[l,u]=D.useState(!1),[c,d]=D.useState(!1),f=D.useRef(null),{data:p,isFetching:h}=Yx(["search_item_names",s],`/inventory/item/search/business/${a}`,{enabled:s.length>=2}),g=h,y=p?.data.data,v=e=>{f.current&&!f.current.contains(e.target)&&u(!1)};return D.useEffect(()=>(document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}),[]),m.jsxs("div",{className:"relative",ref:f,children:[m.jsx(iR,{type:"text",required:!0,placeholder:"e.g cocacola",info:"Enter the name of the item as it will appear in inventory, sales, and reports. Make it clear and recognizable.",label:"Item name",labelClass:"text-dark font-bold",name:"name",value:n.name,onChange:t=>{e("name",t.target.value),i(t.target.value),u(!0)},loading:o,onFocus:()=>u(!0)}),l&&a.length>=2&&m.jsx("div",{className:"absolute left-0 right-0 shadow-2xl p-5 rounded-md bg-white flex flex-col gap-2 overflow-auto max-h-[calc(100vh-200px)] z-20",children:g?[1,2,3].map((e,t)=>m.jsxs("div",{className:"flex justify-between border-b py-3 px-2",children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(ei,{className:"w-11 h-11 rounded-2xl"}),m.jsxs("div",{className:"space-y-1 max-w-[265px]",children:[m.jsx(ei,{className:"w-[250px] h-5 rounded-md"}),m.jsx(ei,{className:"w-[200px] h-5 rounded-md"})]})]}),m.jsxs("div",{className:"gap-1 flex flex-col items-end",children:[m.jsx(ei,{className:"w-[100px] h-5 rounded-md "}),m.jsx(ei,{className:"w-[150px] h-5 rounded-md"})]})]},t)):y?.length>0?y.map((n,r)=>m.jsxs("div",{className:"border-b py-3 flex justify-between gap-5 cursor-pointer hover:bg-gray-50 px-2 rounded-md duration-150 ",onClick:()=>{e("name",n.name),u(!1)},children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx("div",{className:"w-11 h-11 rounded-2xl relative bg-gray-100 shrink-0",children:m.jsx("img",{src:n.images[0]?.image??"/assets/images/placeholder-image.svg",alt:"item image",className:"rounded-2xl object-cover w-full h-full",draggable:!1})}),m.jsxs("div",{className:"space-y-1 max-w-[265px]",children:[m.jsx("h1",{className:"text-dark text-sm font-semibold",children:t(n.name,a)}),m.jsxs("p",{className:"text-dark text-xs font-normal flex items-center gap-1",children:[m.jsx("span",{children:n.category[0]?.name})," |"," ",m.jsxs("span",{className:"text-primary",children:[n.quantity,n.item_unit]})]})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"text-right text-primary font-semibold text-sm",children:Jv(parseFloat(n.selling_price))}),m.jsx("p",{className:"text-success text-sm",children:n.itemcode})]})]},r)):m.jsx("p",{className:"text-dark text-center h-24 ",children:" No results found."})})]})}KR.displayName=YR.displayName;var tO="ScrollArea",[nO]=ai(tO),[rO,oO]=nO(tO),aO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:a=600,...i}=e,[s,l]=D.useState(null),[u,c]=D.useState(null),[d,f]=D.useState(null),[p,h]=D.useState(null),[g,y]=D.useState(null),[v,b]=D.useState(0),[w,x]=D.useState(0),[C,S]=D.useState(!1),[k,_]=D.useState(!1),E=oi(t,e=>l(e)),j=vi(o);return m.jsx(rO,{scope:n,type:r,dir:j,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:h,scrollbarXEnabled:C,onScrollbarXEnabledChange:S,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:k,onScrollbarYEnabledChange:_,onCornerWidthChange:b,onCornerHeightChange:x,children:m.jsx(hi.div,{dir:j,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});aO.displayName=tO;var iO="ScrollAreaViewport",sO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...a}=e,i=oO(iO,n),s=oi(t,D.useRef(null),i.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),m.jsx(hi.div,{"data-radix-scroll-area-viewport":"",...a,ref:s,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:m.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});sO.displayName=iO;var lO="ScrollAreaScrollbar",uO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oO(lO,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=o,s="horizontal"===e.orientation;return D.useEffect(()=>(s?a(!0):i(!0),()=>{s?a(!1):i(!1)}),[s,a,i]),"hover"===o.type?m.jsx(cO,{...r,ref:t,forceMount:n}):"scroll"===o.type?m.jsx(dO,{...r,ref:t,forceMount:n}):"auto"===o.type?m.jsx(fO,{...r,ref:t,forceMount:n}):"always"===o.type?m.jsx(pO,{...r,ref:t}):null});uO.displayName=lO;var cO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oO(lO,e.__scopeScrollArea),[a,i]=D.useState(!1);return D.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const n=()=>{window.clearTimeout(t),i(!0)},r=()=>{t=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",r)}}},[o.scrollArea,o.scrollHideDelay]),m.jsx(iu,{present:n||a,children:m.jsx(fO,{"data-state":a?"visible":"hidden",...r,ref:t})})}),dO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oO(lO,e.__scopeScrollArea),a="horizontal"===e.orientation,i=TO(()=>l("SCROLL_END"),100),[s,l]=function(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return D.useEffect(()=>{if("idle"===s){const e=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,o.scrollHideDelay,l]),D.useEffect(()=>{const e=o.viewport,t=a?"scrollLeft":"scrollTop";if(e){let n=e[t];const r=()=>{const r=e[t];n!==r&&(l("SCROLL"),i()),n=r};return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}},[o.viewport,a,l,i]),m.jsx(iu,{present:n||"hidden"!==s,children:m.jsx(pO,{"data-state":"hidden"===s?"hidden":"visible",...r,ref:t,onPointerEnter:ti(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ti(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),fO=D.forwardRef((e,t)=>{const n=oO(lO,e.__scopeScrollArea),{forceMount:r,...o}=e,[a,i]=D.useState(!1),s="horizontal"===e.orientation,l=TO(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;i(s?e:t)}},10);return DO(n.viewport,l),DO(n.content,l),m.jsx(iu,{present:r||a,children:m.jsx(pO,{"data-state":a?"visible":"hidden",...o,ref:t})})}),pO=D.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=oO(lO,e.__scopeScrollArea),a=D.useRef(null),i=D.useRef(0),[s,l]=D.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=EO(s.viewport,s.content),c={...r,sizes:s,onSizesChange:l,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>a.current=e,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:e=>i.current=e};function d(e,t){return function(e,t,n,r="ltr"){const o=jO(n),a=o/2,i=t||a,s=o-i,l=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-s,c=n.content-n.viewport,d="ltr"===r?[0,c]:[-1*c,0];return RO([l,u],d)(e)}(e,i.current,s,t)}return"horizontal"===n?m.jsx(hO,{...c,ref:t,onThumbPositionChange:()=>{if(o.viewport&&a.current){const e=NO(o.viewport.scrollLeft,s,o.dir);a.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=d(e,o.dir))}}):"vertical"===n?m.jsx(mO,{...c,ref:t,onThumbPositionChange:()=>{if(o.viewport&&a.current){const e=NO(o.viewport.scrollTop,s);a.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=d(e))}}):null}),hO=D.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,a=oO(lO,e.__scopeScrollArea),[i,s]=D.useState(),l=D.useRef(null),u=oi(t,l,a.onScrollbarXChange);return D.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),m.jsx(vO,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===a.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===a.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jO(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){const r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),OO(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:_O(i.paddingLeft),paddingEnd:_O(i.paddingRight)}})}})}),mO=D.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,a=oO(lO,e.__scopeScrollArea),[i,s]=D.useState(),l=D.useRef(null),u=oi(t,l,a.onScrollbarYChange);return D.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),m.jsx(vO,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jO(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){const r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),OO(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:_O(i.paddingTop),paddingEnd:_O(i.paddingBottom)}})}})}),[gO,yO]=nO(lO),vO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:c,onResize:d,...f}=e,p=oO(lO,n),[h,g]=D.useState(null),y=oi(t,e=>g(e)),v=D.useRef(null),b=D.useRef(""),w=p.viewport,x=r.content-r.viewport,C=bi(c),S=bi(l),k=TO(d,10);function _(e){if(v.current){const t=e.clientX-v.current.left,n=e.clientY-v.current.top;u({x:t,y:n})}}return D.useEffect(()=>{const e=e=>{const t=e.target,n=h?.contains(t);n&&C(e,x)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,h,x,C]),D.useEffect(S,[r,S]),DO(h,k),DO(p.content,k),m.jsx(gO,{scope:n,scrollbar:h,hasThumb:o,onThumbChange:bi(a),onThumbPointerUp:bi(i),onThumbPositionChange:S,onThumbPointerDown:bi(s),children:m.jsx(hi.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:ti(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=h.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),_(e)}}),onPointerMove:ti(e.onPointerMove,_),onPointerUp:ti(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),v.current=null})})})}),bO="ScrollAreaThumb",wO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yO(bO,e.__scopeScrollArea);return m.jsx(iu,{present:n||o.hasThumb,children:m.jsx(xO,{ref:t,...r})})}),xO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,a=oO(bO,n),i=yO(bO,n),{onThumbPositionChange:s}=i,l=oi(t,e=>i.onThumbChange(e)),u=D.useRef(void 0),c=TO(()=>{u.current&&(u.current(),u.current=void 0)},100);return D.useEffect(()=>{const e=a.viewport;if(e){const t=()=>{if(c(),!u.current){const t=PO(e,s);u.current=t,s()}};return s(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[a.viewport,c,s]),m.jsx(hi.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ti(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;i.onThumbPointerDown({x:n,y:r})}),onPointerUp:ti(e.onPointerUp,i.onThumbPointerUp)})});wO.displayName=bO;var CO="ScrollAreaCorner",SO=D.forwardRef((e,t)=>{const n=oO(CO,e.__scopeScrollArea),r=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&r?m.jsx(kO,{...e,ref:t}):null});SO.displayName=CO;var kO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=oO(CO,n),[a,i]=D.useState(0),[s,l]=D.useState(0),u=Boolean(a&&s);return DO(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),l(e)}),DO(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),i(e)}),u?m.jsx(hi.div,{...r,ref:t,style:{width:a,height:s,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...e.style}}):null});function _O(e){return e?parseInt(e,10):0}function EO(e,t){const n=e/t;return isNaN(n)?0:n}function jO(e){const t=EO(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function NO(e,t,n="ltr"){const r=jO(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-o,i=t.content-t.viewport,s=a-r,l=Aj(e,"ltr"===n?[0,i]:[-1*i,0]);return RO([0,i],[0,s])(l)}function RO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function OO(e,t){return e>0&&e<t}var PO=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const a={left:e.scrollLeft,top:e.scrollTop},i=n.left!==a.left,s=n.top!==a.top;(i||s)&&t(),n=a,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function TO(e,t){const n=bi(e),r=D.useRef(0);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),D.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function DO(e,t){const n=bi(t);si(()=>{let t=0;if(e){const r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var MO=aO,IO=sO,AO=SO;const LO=D.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(MO,{ref:r,className:Ya("relative overflow-hidden",e),...n,children:[m.jsx(IO,{className:"h-full w-full rounded-[inherit]",children:t}),m.jsx(FO,{}),m.jsx(AO,{})]}));LO.displayName=MO.displayName;const FO=D.forwardRef(({className:e,orientation:t="vertical",...n},r)=>m.jsx(uO,{ref:r,orientation:t,className:Ya("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:m.jsx(wO,{className:"relative flex-1 rounded-full bg-neutral-200 dark:bg-neutral-800"})}));FO.displayName=uO.displayName;var zO="Checkbox",[$O]=ai(zO),[HO,BO]=$O(zO);function VO(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:a,form:i,name:s,onCheckedChange:l,required:u,value:c="on",internal_do_not_use_render:d}=e,[f,p]=ui({prop:n,defaultProp:o??!1,onChange:l,caller:zO}),[h,g]=D.useState(null),[y,v]=D.useState(null),b=D.useRef(!1),w=!h||(!!i||!!h.closest("form")),x={checked:f,disabled:a,setChecked:p,control:h,setControl:g,name:s,form:i,value:c,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:!XO(o)&&o,isFormControl:w,bubbleInput:y,setBubbleInput:v};return m.jsx(HO,{scope:t,...x,children:ZO(d)?d(x):r})}var UO="CheckboxTrigger",qO=D.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:a,value:i,disabled:s,checked:l,required:u,setControl:c,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:h}=BO(UO,e),g=oi(o,c),y=D.useRef(l);return D.useEffect(()=>{const e=a?.form;if(e){const t=()=>d(y.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[a,d]),m.jsx(hi.button,{type:"button",role:"checkbox","aria-checked":XO(l)?"mixed":l,"aria-required":u,"data-state":JO(l),"data-disabled":s?"":void 0,disabled:s,value:i,...r,ref:g,onKeyDown:ti(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:ti(n,e=>{d(e=>!!XO(e)||!e),h&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});qO.displayName=UO;var WO=D.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l,onCheckedChange:u,form:c,...d}=e;return m.jsx(VO,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:s,required:i,onCheckedChange:u,name:r,form:c,value:l,internal_do_not_use_render:({isFormControl:e})=>m.jsxs(m.Fragment,{children:[m.jsx(qO,{...d,ref:t,__scopeCheckbox:n}),e&&m.jsx(QO,{__scopeCheckbox:n})]})})});WO.displayName=zO;var YO="CheckboxIndicator",GO=D.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=BO(YO,n);return m.jsx(iu,{present:r||XO(a.checked)||!0===a.checked,children:m.jsx(hi.span,{"data-state":JO(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});GO.displayName=YO;var KO="CheckboxBubbleInput",QO=D.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:i,required:s,disabled:l,name:u,value:c,form:d,bubbleInput:f,setBubbleInput:p}=BO(KO,e),h=oi(n,p),g=Lj(a),y=Al(r);D.useEffect(()=>{const e=f;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set,r=!o.current;if(g!==a&&n){const t=new Event("click",{bubbles:r});e.indeterminate=XO(a),n.call(e,!XO(a)&&a),e.dispatchEvent(t)}},[f,g,a,o]);const v=D.useRef(!XO(a)&&a);return m.jsx(hi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??v.current,required:s,disabled:l,name:u,value:c,form:d,...t,tabIndex:-1,ref:h,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function ZO(e){return"function"==typeof e}function XO(e){return"indeterminate"===e}function JO(e){return XO(e)?"indeterminate":e?"checked":"unchecked"}QO.displayName=KO;const eP=D.forwardRef(({className:e,...t},n)=>m.jsx(WO,{ref:n,className:Ya("peer h-5 w-5 shrink-0 border border-[#7E8299] ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary rounded-[7px] data-[state=checked]:text-neutral-50 dark:border-neutral-50 dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300 dark:data-[state=checked]:bg-neutral-50 data-[state=checked]:border-primary dark:data-[state=checked]:text-neutral-900 bg-white",e),...t,children:m.jsx(GO,{className:Ya("flex items-center justify-center text-current"),children:m.jsx(Ef,{className:"h-4 w-4"})})}));eP.displayName=WO.displayName;const tP=({returnSelectedManagers:e,label:t,labelClass:n,info:r,infoAlignment:o,required:a,optional:i,values:s,loading:l})=>{const[u,c]=D.useState(!1),[d,f]=D.useState({}),[p,h]=D.useState("");D.useEffect(()=>{if(s&&s.length>0){const e=s.reduce((e,t)=>(e[t.manager_uuid]=Number(t.quantity),e),{});f(e)}},[s?.length]);const{apiKey:g}=Pr(),{data:y,isLoading:v}=Yx(["item-managers",g],"/manager/get_unpaginated",{enabled:!!g}),b=y?.data?.data||[],w=D.useMemo(()=>{if(!p)return b;const e=p.toLowerCase();return b.filter(t=>(t.name||"").toLowerCase().includes(e))},[b,p]);D.useEffect(()=>{if(e){const t=Object.entries(d).map(([e,t])=>({manager_uuid:e,quantity:t}));e(t)}},[d]);const x=Object.keys(d).length;return m.jsx(m.Fragment,{children:l?m.jsx(ei,{className:"w-full h-[48px]"}):m.jsxs("div",{className:"w-full flex flex-col gap-2.5",children:[t&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",n),children:[m.jsx("span",{className:"first-letter:inherit",children:t})," ",a?m.jsx("span",{className:"text-[#E12D39]",children:t&&"*"}):i?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,r&&m.jsx(kb,{fieldName:t,align:o,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:r})})]}),m.jsxs(Ak,{modal:!0,open:u,onOpenChange:c,children:[m.jsx(Lk,{asChild:!0,children:m.jsxs($k,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between h-12 bg-white border-neutral-200 text-neutral-700 hover:bg-neutral-50",children:[x>0?`${x} Manager${1===x?"":"s"} Selected`:"Select Managers",m.jsx(Of,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Fk,{align:"end",className:"w-[450px] p-0 bg-white",side:"bottom",children:m.jsxs(ik,{shouldFilter:!1,children:[m.jsx(sk,{placeholder:"Search managers...",value:p,onValueChange:h}),m.jsxs(lk,{children:[m.jsx(uk,{children:"No manager found."}),m.jsx(ck,{children:v?m.jsx("div",{className:"flex flex-col gap-2 p-2",children:[1,2,3].map(e=>m.jsx(ei,{className:"h-10 w-full"},e))}):m.jsx(LO,{className:"h-72",children:w?.map(e=>{const t=(e=>e.uuid||"")(e),n=(e=>e.name||"Unknown Manager")(e),r=!!d[t],o=d[t]||0;return m.jsxs(dk,{value:t+n,onSelect:()=>{var e;(e=t)&&f(t=>{const n={...t};return n[e]?delete n[e]:n[e]=1,n})},className:Ya("flex items-center gap-3 p-2 cursor-pointer transition-colors aria-selected:bg-neutral-100",r&&"bg-blue-50 aria-selected:bg-blue-100"),children:[m.jsx("div",{className:"pointer-events-none flex items-center justify-center",children:m.jsx(eP,{checked:r,className:Ya(r?"bg-primary border-primary":"border-neutral-300")})}),m.jsx("div",{className:"flex-1 truncate font-medium text-neutral-700",children:n}),m.jsxs("div",{className:"flex items-center gap-2",onClick:e=>e.stopPropagation(),children:[m.jsx("span",{className:"text-xs text-neutral-400 font-medium",children:"Qty"}),m.jsx("input",{type:"number",min:"0",className:"w-20 h-8 rounded border border-neutral-300 px-2 text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"0",value:r?o:"",disabled:!r,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onChange:e=>{const n=parseFloat(e.target.value);((e,t)=>{e&&f(n=>({...n,[e]:t}))})(t,isNaN(n)?0:n)}})]})]},t)})})})]})]})})]})]})})};function nP({placeholder:e,searchPlaceholder:t,options:n=[],showMultiSelectValues:r=!0,values:o,onChange:a,className:i,showCheckMark:s=!0,label:l,labelClass:u,required:c,info:d,optional:f,actionLabel:p,actionLabelAction:h,actionLabelInfo:g,removeSelectedValue:y,removeTag:v,loading:b,showCount:w,error:x}){const[C,S]=D.useState(!1),[k,_]=D.useState(0),E=D.useRef(null);D.useEffect(()=>{const e=()=>{E.current&&_(E?.current?.offsetWidth)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[E]);const j=e=>{const t=o?.includes(e)?o?.filter(t=>t!==e):[...o||[],e];a&&a(t)};D.useEffect(()=>{y&&j(y)},[y]);const[N,R]=D.useState(null),O=e=>{R(t=>t===e?null:e)},P=e=>{for(let t of n){if(t.value===e)return t.label;if(t.subOptions){const n=t.subOptions.find(t=>t.value===e);if(n)return n.label}}return null};return m.jsx("div",{ref:E,children:b?m.jsx(ei,{className:"w-full h-[48px]"}):m.jsxs("div",{className:Ya("flex flex-col gap-2.5",i),children:[m.jsxs("div",{className:"flex justify-between gap-2 flex-wrap",children:[l&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",u),children:[l," ",c?m.jsx("span",{className:"text-[#E12D39]",children:l&&"*"}):f?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,d&&m.jsx(kb,{fieldName:l,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:d})})]}),p&&m.jsxs("button",{onClick:h,className:"text-primary flex items-center gap-1 first-letter:uppercase text-sm font-medium",children:[p,g&&m.jsx(kb,{fieldName:l,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:g})})]})]}),m.jsxs(Ak,{modal:!0,open:C,onOpenChange:S,children:[m.jsx(Lk,{asChild:!0,children:m.jsxs($k,{variant:"outline",role:"combobox","aria-expanded":C,className:Ya(`w-full h-[48px] justify-between border focus:border-primary border-neutral-200 bg-white hover:bg-white hover:border-[#BFD7FE] ${x&&"!border-danger"}`,r?"h-auto py-3":null,i),children:[m.jsx("div",{className:"flex gap-2 text-[#5E6278] justify-start first-letter:uppercase flex-wrap",children:o?.length&&r?o.map((e,t)=>m.jsxs("div",{onClick:()=>{v||j(e),O(e)},className:"px-2 py-1 text-black flex items-center justify-between rounded gap-2 border bg-slate-200 text-xs font-medium",children:[m.jsx("span",{className:"flex justify-start text-start flex-wrap gap-2 whitespace-normal",children:P(e)}),m.jsx("span",{className:"",children:m.jsx("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.44001 4.49978L7.83334 2.12644C7.96064 1.99737 8.03146 1.82301 8.03021 1.64173C8.02896 1.46044 7.95575 1.28708 7.82667 1.15978C7.6976 1.03247 7.52324 0.961657 7.34196 0.962907C7.16067 0.964157 6.98731 1.03737 6.86001 1.16644L4.50001 3.55978L2.14001 1.21311C2.0151 1.08894 1.84613 1.01925 1.67001 1.01925C1.49388 1.01925 1.32492 1.08894 1.20001 1.21311C1.13752 1.27509 1.08793 1.34882 1.05408 1.43006C1.02023 1.5113 1.00281 1.59844 1.00281 1.68644C1.00281 1.77445 1.02023 1.86159 1.05408 1.94283C1.08793 2.02407 1.13752 2.0978 1.20001 2.15978L3.56001 4.49978L1.16667 6.87311C1.03937 7.00218 0.968554 7.17654 0.969804 7.35782C0.971054 7.53911 1.04427 7.71247 1.17334 7.83978C1.30241 7.96708 1.47677 8.0379 1.65805 8.03665C1.83934 8.0354 2.0127 7.96218 2.14001 7.83311L4.50001 5.43978L6.86001 7.78644C6.98492 7.91061 7.15388 7.98031 7.33001 7.98031C7.50613 7.98031 7.6751 7.91061 7.80001 7.78644C7.86249 7.72447 7.91209 7.65073 7.94594 7.56949C7.97978 7.48826 7.99721 7.40112 7.99721 7.31311C7.99721 7.2251 7.97978 7.13797 7.94594 7.05673C7.91209 6.97549 7.86249 6.90175 7.80001 6.83978L5.44001 4.49978Z",fill:"black"})})})]},t)):!r&&w&&o.length>0?`${o.length} ${l} selected`:e??"Select..."}),m.jsx(Of,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Fk,{align:"start",style:{width:k},className:"w-[480px] p-0 bg-white rounded-xl border-gray-200",children:m.jsxs(ik,{children:[m.jsx(sk,{className:"placeholder:text-xs",placeholder:t??"Search..."}),m.jsx(uk,{children:"No result found."}),m.jsx(ck,{children:m.jsx(lk,{className:"",children:n?.map((e,t)=>m.jsxs("div",{children:[m.jsxs(dk,{value:"string"==typeof e.label?e.label:e.searchId,className:`first-letter:uppercase mb-1 focus:bg-primary_light w-full rounded-md focus:text-primary hover:text-primary font-semibold text-gray-700 text-sm cursor-pointer ${o?.includes(e.value)&&"bg-primary_light text-primary"}`,onSelect:()=>{j(e.value),e?.subOptions&&e?.subOptions?.length>0&&O(e.value)},children:[s&&m.jsx(Ef,{className:Ya("mr-2 h-4 w-4",o?.includes(e.value)?"opacity-100":"opacity-0")}),m.jsxs("p",{className:"flex justify-between w-full",children:[e.label,e?.subOptions&&e?.subOptions?.length>0&&m.jsx(jf,{className:"ml-2 h-5 w-5 font-bold shrink-0 opacity-50"})]})]}),N===e.value&&e?.subOptions&&e?.subOptions?.map((e,t)=>m.jsxs(dk,{value:"string"==typeof e.label?e.label:e.searchId,className:`first-letter:uppercase mb-1 focus:bg-primary_light w-full rounded-md focus:text-primary hover:text-primary font-semibold text-gray-700 text-sm cursor-pointer pl-6 ${o?.includes(e.value)&&"bg-primary_light text-primary"}`,onSelect:()=>{j(e.value)},children:[s&&m.jsx(Ef,{className:Ya("mr-2 h-4 w-4",o?.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},t))]},t))})})]})})]}),x&&m.jsx("p",{className:"text-danger text-xs font-normal",children:x})]})})}function rP({handleInputChange:e,setFileKey:t}){const{apiKey:n}=Pr(),{itemStoreData:r,editMode:o,fetchingItem:a}=ne(e=>e.items),[i,s]=D.useState([]),[l,u]=D.useState(!1),[c,d]=D.useState(!1),{data:f}=Yx(["categories",n],"/inventory_metas/categories",{enabled:!!n}),{data:p}=Yx(["itemunits",n],"/inventory_metas/units",{enabled:!!n}),h=f?.data?.data?.map(e=>({label:e.name,value:e.uuid,subOptions:e.subCategories.map(e=>({label:e.name,value:e.uuid}))}))||[],g=p?.data?.data?.map(e=>({label:e.name,value:e.uuid}))||[];D.useEffect(()=>{const t=r.itemunit_id||g.find(e=>"pieces"===e.label.toLowerCase())?.value;e("itemunit_id",t)},[p,r]);const y=M.useRef(!1);return M.useRef({set:!1,data:void 0}),m.jsxs("div",{className:"grid grid-cols-2 gap-x-[30px] gap-y-6",children:[m.jsx(eO,{handleInputChange:e}),m.jsx(iR,{type:"number",placeholder:"0.00",info:"Enter the cost price of a single unit of the item. This helps in calculating profit margins and inventory valuation.",label:`Unit cost price (${tb()})`,name:"cost_price",value:r.cost_price,labelClass:"text-dark font-bold first-letter:uppercase",onChange:t=>{y.current=!0,e("cost_price",t.target.value)},loading:a}),m.jsx("div",{className:"space-y-2.5",children:m.jsx(iR,{type:"number",selectOptions:g,onSelectValueChange:t=>e("itemunit_id",t),selectValue:r.itemunit_id||g.find(e=>"pieces"===e.label.toLowerCase())?.value,showSelectSearch:!0,placeholder:"0.00",addonInfo:"Select the measurement unit for this item (e.g., pieces, kg, liters). This ensures accurate stock tracking and transactions.",label:"Quantity",name:"item_quantity",value:r.item_quantity,onChange:t=>e("item_quantity",t.target.value),selectPlaceholder:"Item unit",labelClass:"text-dark font-bold first-letter:uppercase",addonLabel:"Item unit ",addonLabelClass:"text-dark font-bold first-letter:uppercase",info:"Enter the number of units available in stock for this item. This helps in managing inventory levels and ensuring you have enough stock to fulfill orders.",loading:a})}),m.jsx(iR,{type:"number",placeholder:"0.00",info:"Enter the selling price of a single unit of the item. This is the price at which the item will be sold to customers.",label:`Unit selling price (${tb()})`,name:"selling_price",value:r.selling_price,onChange:t=>e("selling_price",t.target.value),labelClass:"text-dark font-bold first-letter:uppercase",loading:a,required:!0}),m.jsx(iR,{type:"number",placeholder:"0.00",info:"Set the minimum stock quantity for this item. When the quantity drops below this level, you'll be alerted to reorder to prevent stockouts.",label:"Reorder level ",labelClass:"text-dark font-bold first-letter:uppercase",name:"reorder_level",value:r.reorder_level,onChange:t=>e("reorder_level",t.target.value),loading:a}),m.jsx(tP,{label:"Item Managers",labelClass:"text-dark font-bold first-letter:uppercase",info:"Select the managers for this item. This helps in managing inventory levels and ensuring you have enough stock to fulfill orders.",returnSelectedManagers:t=>{e("managers",t),console.log("returned managers",t)},values:r.managers,loading:a}),o&&m.jsx(nP,{label:"Category",info:"Select the category that best describes this item (e.g., electronics, clothing, food). Categorizing items helps in organizing inventory and simplifies product management.",options:h,placeholder:"Select category",labelClass:"text-dark font-bold text-sm",showSearch:!0,values:r.itemcategory_id,onChange:t=>e("itemcategory_id",t),loading:a})]})}function oP({itemTypeUUID:e,handleInputChange:t,setFileKey:n}){const r=J(),[o,a]=D.useState(!0),{itemStoreData:i,editMode:s}=ne(e=>e.items);return M.useEffect(()=>{r(Wt({field:"itemtype_id",value:e})),!s&&r(Yt())},[e]),m.jsxs("div",{className:"space-y-4",children:[s?null:m.jsxs("div",{className:Ya("bg-primary_light rounded-md px-4 py-3.5 flex justify-between items-center gap-[60px]",o?null:"hidden"),children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("span",{className:"shrink-0",children:Kv.info}),m.jsxs("div",{className:Ya("flex-grow space-y-1"),children:[m.jsx("h1",{className:"text-gray-800 font-semibold text-[15px]",children:"About product items"}),m.jsxs("p",{className:"text-[13px] text-gray-600",children:["Product items are tangible goods that can be quantified and are available in units. They can also have variations, such as different sizes, colors, or weights, ensuring flexible and comprehensive inventory management."," ",m.jsx("a",{href:"#",className:"text-primary",children:"Learn more"})]})]})]}),m.jsx("button",{onClick:()=>a(!1),children:Kv.close})]}),m.jsx(rP,{handleInputChange:t,setFileKey:n}),m.jsx(fS,{}),m.jsx(ZR,{})]})}function aP({handleInputChange:e,item_type_id:t,setFileKey:n}){const{apiKey:r}=Pr(),{editMode:o}=ne(e=>e.items),{data:a}=Yx(["itemtypes",r],"/inventory_metas/types",{enabled:!!r}),i=a?.data?.data||[],s=[{label:"Simple Product",value:"simple product",uuid:(e=>{const t=i?.filter(t=>t?.name?.match(e));let n="";return t?.map(e=>n=e.uuid),n})("products")}],[l,u]=D.useState(o?t:s[0].uuid);return D.useEffect(()=>{u(o?t:s[0].uuid)},[i]),0===i?.length?null:m.jsx(KC,{className:"flex-grow px-4 pt-0",children:i?.length>0&&l?m.jsxs(_R,{defaultValue:l,className:"space-y-4",children:[m.jsxs("div",{className:Ya("flex items-center gap-7 border-b py-4 sticky top-16 bg-white z-10",o?"-top-8 pointer-events-none":null,i?.length>0?null:"pointer-events-none"),children:[m.jsx("h1",{className:"text-gray-900 font-medium text-sm shrink-0",children:"Item type"}),m.jsx(ER,{className:"flex bg-transparent flex-grow justify-start p-0 gap-[30px] overflow-auto h-auto",children:s.map((e,t)=>m.jsxs(jR,{className:"data-[state=active]:bg-transparent text-gray-700 data-[state=active]:text-gray-900 data-[state=active]:shadow-none capitalize data-[state=active]:font-bold font-medium hover:text-gray-900 p-0 flex items-center gap-2 cursor-pointer",value:e.uuid,children:[m.jsx("div",{className:Ya("flex items-center justify-center rounded-full h-[26px] w-[26px] bg-gray-300 shrink-0 indicator"),children:m.jsx("span",{className:"bg-white w-3 h-3 rounded-full indicator--child"})}),e.label]},t))})]}),m.jsx(NR,{value:s[0].uuid,children:m.jsx(oP,{itemTypeUUID:s[0]?.uuid,handleInputChange:e,setFileKey:n})})]}):m.jsx("div",{children:m.jsx(ei,{className:"rounded-md w-full h-[500px] mt-8"})})})}function iP({isOpen:e,onClose:t,itemUUID:n,itemTypeUUID:r}){const o=tr(),a=J(),{itemStoreData:i}=ne(e=>e.items),{mutate:s,isPending:l}=Gx({enableToast:!0},!0),{mutate:u,isPending:c}=Gx(),{data:d,isFetching:f}=Yx(["single_item",n],`/items/get?item_uuid=${n}`,{enabled:e}),p=d?.data,h=p?.kits.map(e=>({item_uuid:e.kit_item.uuid,quantity:Number(e.quantity)})),g=p?.variation.map(e=>{const t=e.variation_values.map(e=>e.attribute_value.uuid),n=e.locationprices.filter(e=>!e.price_group.name.match("Retail"));return{attribute_value_id:t,selling_price:e.locationprices[0].selling_price,quantity:e.quantity,sku:e.sku,prices:n.map(e=>({price_uuid:e.price_group.uuid,price_amt:e.selling_price})),image:e.image,id:e.uuid}}),y=p?.item_group.map(e=>({group_name:e.group_name,group_quantity:e.quantity,group_selling_price:e.selling_price,group_barcode:e.barcode,group_image:null,group_uuid:e.group_uuid,prices:e.locationprices.filter((e,t)=>t>0).map(e=>({price_uuid:e.price_group.uuid,price_amt:e.selling_price}))})),v=p?.extras.map(e=>({item_uuid:e.extra?.uuid,quantity:e.quantity,selling_price:e.selling_price})),b=p?.material?.map(e=>({item_uuid:e.raw_material?.uuid,quantity:e.quantity,selling_price:e.selling_price})),w=p?.suppliers.map(e=>({supplier_id:e.uuid,supplier_price:e.supplier_price,supplier_batch_number:e.supplier_batch_number,supplier_quantity:e.supplier_quantity,supplier_expired_date:e.supplier_expired_date})),x={name:p?.name,item_uuid:n,itemtype_id:p?.item_type?.uuid,selling_price:p?.selling_price,cost_price:p?.cost_price,item_quantity:p?.quantity,reorder_level:p?.reorder_level,itemunit_id:p?.unit_resource?.uuid,available_in_cart:!0,description:p?.description,itemcategory_id:p?.category?.map(e=>e.uuid),barcode:p?.barcode?.map(e=>e.barcode),itembrand_id:p?.item_brand,returnable_days:p?.returnable_days||"",images:[],group:y,taxes:p?.item_tax?.uuid,sku:p?.sku,is_draft:!1,kit:h,item_tags:p?.item_tags.map(e=>e.uuid),suppliers:w,variations:g,has_extras:v,discount:p?.discount||"",discount_type:p?.discount_type?.toString()||"1",price_man:p?.duplicate_prices?.map(e=>"Retail"===e.priceGroup.name?{}:{price_uuid:e.priceGroup.uuid,selling_price:e.selling_price.toString()}),raw_materials:b,managers:p?.managers?.map(e=>({manager_uuid:e.manager.uuid,quantity:e.quantity}))},C={prices:p?.prices,barcode:p?.barcode,extras:p?.extras,materials:p?.material,suppliers:p?.suppliers,images:p?.images,item_group:p?.item_group,variations:p?.variation},[S,k]=D.useState([]);M.useEffect(()=>{a(Qt(f))},[f]);return M.useEffect(()=>(a(Gt(e)),p&&a(Kt(x)),p&&a(Zt(C)),!e&&a(Yt()),()=>{a(Gt(!1)),a(Yt())}),[e,p]),m.jsxs(GC,{isOpen:e,onClose:t,title:"Item Edit",className:"w-[1176px] pb-0",children:[m.jsx(aP,{handleInputChange:(e,t)=>{a(Wt({field:e,value:t}))},item_type_id:r,setFileKey:k}),m.jsxs("div",{className:"flex justify-between border-t py-5 bg-white sticky bottom-0",children:[m.jsx(Mj,{label:"Cancel",className:"h-12 bg-gray-400 text-gray-900 font-bold hover:bg-gray-400/90 w-[162px]",onClick:t,disabled:l||c}),m.jsxs("div",{className:"flex gap-2.5",children:[m.jsx(Mj,{label:"Revert to draft",className:"h-12 bg-gray-400 text-gray-900 font-bold hover:bg-gray-400/90 px-8",onClick:()=>{u({url:"/item/update",payload:{...i,is_draft:!0,images:S.map(e=>({...e.file&&{image:e.file},...e.id&&{id:e.id},featured:e.featured}))}},{onSuccess:()=>{a(Yt()),o.invalidateQueries({queryKey:["items"]}),o.invalidateQueries({queryKey:["single_item",n]}),t&&t()}})},loading:c,disabled:!p?.status}),m.jsx(Mj,{label:"Update Item",className:"h-12 w-[162px]",onClick:()=>{s({url:"/item/update",payload:{...i,is_draft:!1,images:S.map(e=>({...e.file&&{image:e.file},...e.id&&{id:e.id},featured:e.featured}))}},{onSuccess:()=>{a(Yt()),o.invalidateQueries({queryKey:["items"]}),o.invalidateQueries({queryKey:["single_item",n]}),t&&t()}})},loading:l})]})]})]})}const sP=[{accessorKey:"item_description",header:()=>m.jsxs("p",{children:[" ","Item description/ ",m.jsx("br",{})," Product code"," "]}),cell:({row:e})=>{const t=e.original;return m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsx("div",{className:"w-[50px] h-[50px] rounded-2xl relative bg-gray-100",children:m.jsx("img",{src:t.item_image,alt:"item image",className:"rounded-2xl object-cover w-full h-full",draggable:!1})}),m.jsxs("div",{className:"space-y-1 max-w-[265px]",children:[m.jsx(uP,{title:t.item_description,item_uuid:t.uuid,item_type_id:t.item_type_id,data:t.fullData}),m.jsxs("p",{className:"text-dark text-xs font-normal flex items-center gap-1",children:[m.jsx("span",{className:"uppercase whitespace-nowrap",children:t.itemcode}),t.sku||t.barcode.length>0?m.jsx(kb,{align:"center",fieldName:"All item codes",trigger:m.jsxs("button",{className:"rounded bg-primary_light px-[5px] flex items-center text-primary font-semibold text-[11px] h-[18px]",children:["+",(t.barcode?.length||0)+(t.sku?1:0)]}),children:m.jsxs("div",{className:"space-y-2",children:[t.sku?m.jsxs("div",{className:"",children:[m.jsx("p",{children:" SKU:"}),m.jsx("ul",{className:"list-disc pl-4",children:m.jsx("li",{children:t.sku})})]}):null,t.barcode.length>0?m.jsxs("div",{children:[m.jsx("p",{children:"Barcodes:"}),m.jsx("ul",{className:"list-disc pl-4 ",children:t.barcode.map((e,t)=>m.jsx("li",{children:e.barcode},t))})]}):null,m.jsxs("div",{className:"",children:[m.jsx("p",{children:" Itemcode:"}),m.jsx("ul",{className:"list-disc pl-4",children:m.jsx("li",{children:t.itemcode})})]})]})}):null,t.expired?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"|"}),"Expired",m.jsx("span",{className:"rounded bg-danger_light px-[5px] flex items-center text-danger font-semibold text-[11px] h-[18px]",children:t.expired})]}):null,t.expiring?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"|"}),"Expiring",m.jsx("span",{className:"rounded bg-warning-light px-[5px] flex items-center text-warning font-semibold text-[11px] h-[18px]",children:t.expiring})]}):null]})]})]})}},{accessorKey:"quantity",header:()=>m.jsx("p",{children:"quantity"}),cell:({row:e})=>{const t=e.original;return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:Ya("flex items-center",t.quantity<=0?"text-danger":Number(t.reorder_level)==t.quantity?"text-orange":null),children:m.jsx(sR,{label:"Edit item quantity",placeholder:"Enter quantity",uuid:t.uuid,name:"item_quantity",displayValue:eb(t.quantity)+t.unit,value:t.quantity,valueType:"number",item_unit:t.unit})}),t.all_quantity===t.quantity?null:m.jsx("p",{className:"text-gray-700",children:Intl.NumberFormat().format(t.all_quantity??0)+t.unit})]})}},{accessorKey:"type",cell:({row:e})=>{const t=e.original;return m.jsx("p",{className:"capitalize",children:t.type})}},{accessorKey:"selling_price",header:`Selling Price (${tb()})`,cell:({row:e})=>{const t=e.original;return m.jsx(sR,{label:`Edit selling price (${tb()})`,placeholder:"Enter selling price",uuid:t.uuid,name:"selling_price",displayValue:Jv(t.selling_price??0),value:t.selling_price??0,valueType:"number"})}},{accessorKey:"categories",header:"categories/Tags",cell:({row:e})=>{const t=e.original;return m.jsxs(m.Fragment,{children:[" ",m.jsxs("div",{className:"flex items-center gap-2 capitalize",children:[t.categories&&t.categories?.length>0?t.categories?.[0]?.name:"...",t.categories.length>1?m.jsx(kb,{align:"center",fieldName:"Categories",trigger:m.jsxs("button",{className:"rounded bg-primary_light px-[5px] flex items-center text-primary font-semibold text-[11px] h-[18px]",children:["+",t.categories.length-1]}),children:m.jsx("ul",{className:"list-disc pl-4",children:t.categories.map((e,t)=>m.jsx("li",{children:e.name},t))})}):null]}),m.jsxs("div",{className:"text-gray-700 flex items-center gap-2 capitalize",children:[t.tags?.[0],t.tags?.length>1?m.jsx(kb,{align:"center",fieldName:"Tags",trigger:m.jsxs("button",{className:"rounded bg-primary_light px-[5px] flex items-center text-primary font-semibold text-[11px] h-[18px] border-primary",children:["+",t.tags.length-1]}),children:m.jsx("ul",{className:"list-disc pl-4",children:t.tags.map((e,t)=>m.jsx("li",{children:e},t))})}):null]})]})}},{accessorKey:"status",cell:({row:e})=>{const t=e.getValue("status");return m.jsx(_b,{status:t})}},{id:"actions",header:"actions",cell:({row:e})=>{const t=e.original;return m.jsx(lP,{item_uuid:t.uuid,item_type_id:t.item_type_id,data:t.fullData})}}],lP=({item_uuid:e,item_type_id:t,data:n})=>{const[r,o]=D.useState(null),a=()=>{o(null)},[i,s]=D.useState(!1),[l,u]=D.useState(!1),[c,d]=D.useState(!1),[f,p]=D.useState(!1),[h,g]=D.useState(!1),[y,v]=D.useState(!1),[b,w]=D.useState(!1),x=[{label:"view",icon:Kv.eye_outline,action:()=>s(!0)},{label:"edit",icon:Kv.notepad_edit,action:()=>u(!0)},{label:"delete",icon:Kv.trash,action:()=>p(!0)}];return m.jsxs(m.Fragment,{children:[m.jsxs(Mf,{children:[m.jsx(If,{asChild:!0,children:m.jsxs("button",{className:"bg-gray-100 rounded-md h-[30px] w-[90px] flex items-center justify-between p-2.5 font-semibold text-[10px] text-gray-500 hover:border duration-200",children:["Action"," ",m.jsx("svg",{width:"11",height:"6",viewBox:"0 0 11 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.50855 5.49304C5.42081 5.49355 5.33383 5.47673 5.25261 5.44356C5.17138 5.41038 5.09751 5.3615 5.03521 5.29971L1.03521 1.29971C0.972726 1.23773 0.92313 1.164 0.889284 1.08276C0.855438 1.00152 0.838013 0.914383 0.838013 0.826375C0.838013 0.738367 0.855438 0.65123 0.889284 0.56999C0.92313 0.488751 0.972726 0.415017 1.03521 0.353041C1.16012 0.228874 1.32909 0.15918 1.50521 0.15918C1.68134 0.15918 1.8503 0.228874 1.97521 0.353041L5.50855 3.88637L9.03521 0.353041C9.16012 0.228874 9.32909 0.15918 9.50521 0.15918C9.68134 0.15918 9.8503 0.228874 9.97521 0.353041C10.0377 0.415017 10.0873 0.488751 10.1211 0.56999C10.155 0.65123 10.1724 0.738367 10.1724 0.826375C10.1724 0.914383 10.155 1.00152 10.1211 1.08276C10.0873 1.164 10.0377 1.23773 9.97521 1.29971L5.97521 5.29971C5.85104 5.42287 5.68344 5.4923 5.50855 5.49304Z",fill:"#202125"})})]})}),m.jsx(Af,{align:"end",className:"flex flex-col gap-2.5 rounded-xl border-gray-200",children:x.map((e,t)=>m.jsxs(Lf,{className:`capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-gray-700 text-sm cursor-pointer px-[15px] flex items-center gap-[5px] ${t===x.length-1&&"text-danger focus:text-danger"}`,onMouseOver:()=>(e=>{o(e)})(t),onMouseOut:a,onClick:e.action,children:[M.cloneElement(e.icon,{fill:r===t?"#1868DB":"#5E6278"})," ",e.label]},t))})]}),m.jsx(Wk,{isOpen:i,onClose:()=>s(!1),itemUUID:e}),l?m.jsx(iP,{itemUUID:e,itemTypeUUID:t,isOpen:l,onClose:()=>u(!1)}):null,m.jsx(Ij,{isOpen:f,onClose:()=>p(!1),uuids:[e],single:!0})]})},uP=({title:e,item_uuid:t,item_type_id:n,data:r})=>{const[o,a]=D.useState(!1),[i,s]=D.useState(!1),[l,u]=D.useState(!1);return m.jsxs(m.Fragment,{children:[m.jsx("button",{className:Ya("text-primary font-bold text-sm first-letter:uppercase truncate max-w-[265px] cursor-pointer",r.expired?"text-danger":""),title:e,onClick:()=>a(!0),children:e}),m.jsx(Wk,{isOpen:o,onClose:()=>a(!1),itemUUID:t})]})};function cP({loading:e,data:t,meta:n}){const r=t?.otherscount?.map(e=>{const n=e.name;return{type:n,value:t?.result_array?.[n]?.total_selling_price??0}}),o=[{type:t?.result_array?.Retail?.pricegroup??t?.default,value:t?.result_array?.Retail?.total_selling_price??0},...r||[]],a=t?.otherscount?.map(e=>{const n=e.name;return{type:n,value:t?.result_array?.[n]?.total_profit??0}}),i=[{type:t?.result_array?.Retail?.pricegroup??t?.default,value:t?.result_array?.Retail?.total_profit??0},...a||[]],[s,l]=D.useState({type:o?.[0].type,value:o?.[0].value}),[u,c]=D.useState({type:i?.[0].type,value:i?.[0].value});M.useEffect(()=>{l({type:o?.[0].type,value:o?.[0].value}),c({type:i?.[0].type,value:i?.[0].value})},[e]);const d=[{label:"Total No. of Unique Item",count:Intl.NumberFormat().format(n?.total??0),desc:`With ${t?.unit_count??0} unit(s)`,icon:m.jsx("div",{className:"shrink-0 rounded-lg \n \n bg-[#EFF5FF] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:Kv.cube})},{label:"Total Cost Price",count:Jv(t?.result_array?.Retail?.total_cost??0),desc:"Takes into Account FIFO & LIFO ",icon:m.jsx("div",{className:"shrink-0 rounded-lg bg-[#F9DFDD] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:M.cloneElement(Kv.price_tag,{fill:"#ED7400"})})},{label:"Total Selling Price",count:Jv(s.value),desc:m.jsxs("p",{className:"flex gap-2 items-center flex-wrap",children:["Showing ",s.type," price"," ",m.jsxs(Mf,{children:[m.jsx(If,{asChild:!0,children:m.jsxs("button",{className:"rounded-lg h-8 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 capitalize bg-[#F9F9F9]",children:["change",m.jsx("span",{className:"rotate-90",children:Kv.arrow})]})}),m.jsx(Af,{align:"start",className:"flex flex-col gap-2.5 rounded-xl border-gray-200 py-2.5 w-[210px]",children:o.map((e,t)=>m.jsx(Lf,{className:Ya("capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-sm cursor-pointer px-[15px] flex items-center gap-[5px] \n \n ",e.type===s.type?"bg-primary_light text-primary":null),onClick:()=>l(t=>({...t,value:e.value,type:e.type})),children:e.type},t))})]})]}),icon:m.jsx("div",{className:"shrink-0 rounded-lg bg-[#D8CDF4] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:M.cloneElement(Kv.price_tag,{fill:"#9747FF"})})},{label:"Profit to be made",count:Jv(u.value),desc:m.jsxs("p",{className:"flex gap-2 items-center flex-wrap",children:["Showing ",u.type," price"," ",m.jsxs(Mf,{children:[m.jsx(If,{asChild:!0,children:m.jsxs("button",{className:"rounded-lg h-8 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 capitalize bg-[#F9F9F9]",children:["change",m.jsx("span",{className:"rotate-90",children:Kv.arrow})]})}),m.jsx(Af,{align:"start",className:"flex flex-col gap-2.5 rounded-xl border-gray-200 py-2.5 w-[210px]",children:i.map((e,t)=>m.jsx(Lf,{className:Ya("capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-sm cursor-pointer px-[15px] flex items-center gap-[5px] \n \n ",e.type===u.type?"bg-primary_light text-primary":null),onClick:()=>c(t=>({...t,value:e.value,type:e.type})),children:e.type},t))})]})]}),icon:m.jsx("div",{className:"shrink-0 rounded-lg bg-[#C6E3D2] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:M.cloneElement(Kv.price_tag,{fill:"#378C5A"})})}],[f,p]=D.useState(!1);return m.jsxs(KC,{className:"bg-[#F6F8FA] p-2.5 flex flex-col",children:[m.jsxs("div",{className:"flex justify-between",children:[m.jsx("h1",{className:"capitalize text-dark font-semibold text-lg",children:"Items overview"}),m.jsxs("button",{className:"rounded-lg h-8 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 capitalize bg-white",onClick:()=>p(!f),children:[f?"Close":"Open"," ",m.jsx("span",{className:"rotate-90",children:Kv.arrow})]})]}),m.jsx(LR.Collapse,{isOpened:f,children:m.jsx("div",{className:"flex flex-wrap gap-2.5 mt-3",children:d.map((t,n)=>m.jsxs("div",{className:Ya("border rounded-xl border-[#E4E7EC] p-4 flex flex-col relative bg-right-bottom bg-no-repeat flex-auto",0===n?"bg-[#E4EEFA] bg-[url('/assets/images/ecstacy1.svg')]":1===n?"bg-[#FAEAE9] bg-[url('/assets/images/ecstacy2.svg')]":2===n?"bg-[#EEE9FA] bg-[url('/assets/images/ecstacy3.svg')]":3===n?"bg-[#EBF5EF] bg-[url('/assets/images/ecstacy4.svg')]":null),children:[m.jsxs("div",{className:"flex justify-between gap-1",children:[m.jsx("h1",{className:"text-dark text-sm font-medium",children:t.label}),m.jsx("div",{className:"shrink-0",children:t.icon})]}),m.jsxs("div",{className:"flex flex-col gap-1",children:[e?m.jsx(ei,{className:"w-28 h-6 rounded"}):m.jsx("h1",{className:Ya("text-dark font-bold text-[29px] truncate",n===d.length-1&&u.value<0?"text-danger":null),title:t.count,children:t.count}),m.jsx("div",{className:"text-gray-700 text-sm font-medium ",children:t.desc})]})]},n))})})]})}function dP({placeholder:e,className:t,inputClass:n,...r}){return m.jsxs("div",{className:Ya("h-12 border border-gray-300 rounded-md w-[320px] flex",t),children:[m.jsx("span",{className:"bg-gray-200 w-[38px] flex items-center justify-center shrink-0 rounded-l-md ",children:Kv.magnifier}),m.jsx("input",{type:"search",placeholder:e,className:"w-full px-3 text-dark text-sm font-medium bg-transparent outline-none rounded-r-md",...r})]})}function fP({placeholder:e,searchPlaceholder:t,options:n=[],showMultiSelectValues:r=!0,values:o,onChange:a,className:i,showCheckMark:s=!0,label:l,labelClass:u,required:c,info:d,optional:f,actionLabel:p,actionLabelAction:h,actionLabelInfo:g,removeSelectedValue:y,removeTag:v,loading:b,showCount:w,error:x,showError:C,onChangeSearch:S,searching:k,contentStyle:_,disabled:E,searchValue:j}){const[N,R]=D.useState(!1),[O,P]=D.useState(0),T=D.useRef(null);D.useEffect(()=>{const e=()=>{T.current&&P(T?.current?.offsetWidth)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const M=o?.filter(e=>""!==e),I=e=>{const t=M?.includes(e)?M?.filter(t=>t!==e):[...M||[],e];a&&a(t)};return D.useEffect(()=>{y&&I(y)},[y]),m.jsx(m.Fragment,{children:b?m.jsx(ei,{className:"w-full h-[48px]"}):m.jsxs("div",{className:Ya("flex flex-col gap-2.5",i),children:[m.jsxs("div",{className:"flex justify-between gap-2 flex-wrap",children:[l&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",u),children:[l," ",c?m.jsx("span",{className:"text-[#E12D39]",children:l&&"*"}):f?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,d&&m.jsx(kb,{fieldName:l,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:d})})]}),p&&m.jsxs("button",{onClick:h,className:"text-primary flex items-center gap-1 first-letter:uppercase text-sm font-medium",children:[p,g&&m.jsx(kb,{fieldName:p,children:m.jsx("p",{className:"font-normal first-letter:uppercase text-left",children:g})})]})]}),m.jsxs(Ak,{modal:!0,open:N,onOpenChange:R,children:[m.jsx(Lk,{disabled:E,asChild:!0,children:m.jsxs($k,{ref:T,variant:"outline",role:"combobox","aria-expanded":N,className:Ya(`w-full h-[48px] justify-between border focus:border-primary border-neutral-200 bg-white hover:bg-white hover:border-[#BFD7FE] ${(x||C)&&"!border-danger"}`,r?"h-auto py-3":null,i),children:[m.jsx("div",{className:"flex gap-2 text-[#5E6278] justify-start first-letter:uppercase flex-wrap",children:M?.length>0&&r?M?.map((e,t)=>m.jsxs("div",{onClick:()=>{!v&&I(e)},className:"px-2 py-1 text-black flex items-center justify-between rounded gap-2 border bg-slate-200 text-xs font-medium",children:[n?.[0].searchId?n?.find(t=>t.value===e)?.searchId:n?.find(t=>t.value===e)?.label,m.jsx("span",{className:"",children:m.jsx("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.44001 4.49978L7.83334 2.12644C7.96064 1.99737 8.03146 1.82301 8.03021 1.64173C8.02896 1.46044 7.95575 1.28708 7.82667 1.15978C7.6976 1.03247 7.52324 0.961657 7.34196 0.962907C7.16067 0.964157 6.98731 1.03737 6.86001 1.16644L4.50001 3.55978L2.14001 1.21311C2.0151 1.08894 1.84613 1.01925 1.67001 1.01925C1.49388 1.01925 1.32492 1.08894 1.20001 1.21311C1.13752 1.27509 1.08793 1.34882 1.05408 1.43006C1.02023 1.5113 1.00281 1.59844 1.00281 1.68644C1.00281 1.77445 1.02023 1.86159 1.05408 1.94283C1.08793 2.02407 1.13752 2.0978 1.20001 2.15978L3.56001 4.49978L1.16667 6.87311C1.03937 7.00218 0.968554 7.17654 0.969804 7.35782C0.971054 7.53911 1.04427 7.71247 1.17334 7.83978C1.30241 7.96708 1.47677 8.0379 1.65805 8.03665C1.83934 8.0354 2.0127 7.96218 2.14001 7.83311L4.50001 5.43978L6.86001 7.78644C6.98492 7.91061 7.15388 7.98031 7.33001 7.98031C7.50613 7.98031 7.6751 7.91061 7.80001 7.78644C7.86249 7.72447 7.91209 7.65073 7.94594 7.56949C7.97978 7.48826 7.99721 7.40112 7.99721 7.31311C7.99721 7.2251 7.97978 7.13797 7.94594 7.05673C7.91209 6.97549 7.86249 6.90175 7.80001 6.83978L5.44001 4.49978Z",fill:"black"})})})]},t)):!r&&w&&o.length>0?`${M.length} ${l} selected`:e??"Select..."}),m.jsx(Of,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Fk,{align:"start",style:{width:O},className:Ya("w-[480px] p-0 bg-white rounded-xl border-gray-200",_),children:m.jsx(LO,{children:m.jsxs(ik,{children:[m.jsx(sk,{onChangeCapture:S,className:"placeholder:text-xs",placeholder:t??"Search..."}),k?m.jsx("div",{className:"flex flex-col gap-2 p-2",children:[1,2,3].map((e,t)=>m.jsx(ei,{className:"h-9 rounded-md"},t))}):m.jsx(uk,{children:j?"No result found.":e}),m.jsx(ck,{children:m.jsx(lk,{className:"",children:n?.map(e=>m.jsxs(dk,{value:"string"==typeof e.label?e.label:e.searchId,className:`first-letter:uppercase mb-1 focus:bg-primary_light w-full rounded-md focus:text-primary hover:text-primary font-semibold text-gray-700 text-sm cursor-pointer ${o?.includes(e.value)&&"bg-primary_light text-primary"}`,onSelect:()=>{I(e.value)},children:[s&&m.jsx(Ef,{className:Ya("mr-2 h-4 w-4",o?.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},e.value))})})]})})})]})]})})}const pP=D.createContext({dragDropManager:void 0});function hP(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var mP="function"==typeof Symbol&&Symbol.observable||"@@observable",gP=function(){return Math.random().toString(36).substring(7).split("").join(".")},yP={INIT:"@@redux/INIT"+gP(),REPLACE:"@@redux/REPLACE"+gP()};function vP(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(hP(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(hP(1));return n(vP)(e,t)}if("function"!=typeof e)throw new Error(hP(2));var o=e,a=t,i=[],s=i,l=!1;function u(){s===i&&(s=i.slice())}function c(){if(l)throw new Error(hP(3));return a}function d(e){if("function"!=typeof e)throw new Error(hP(4));if(l)throw new Error(hP(5));var t=!0;return u(),s.push(e),function(){if(t){if(l)throw new Error(hP(6));t=!1,u();var n=s.indexOf(e);s.splice(n,1),i=null}}}function f(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(hP(7));if(void 0===e.type)throw new Error(hP(8));if(l)throw new Error(hP(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=i=s,n=0;n<t.length;n++){(0,t[n])()}return e}return f({type:yP.INIT}),(r={dispatch:f,subscribe:d,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(hP(10));o=e,f({type:yP.REPLACE})}})[mP]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(hP(11));function n(){e.next&&e.next(c())}return n(),{unsubscribe:t(n)}}})[mP]=function(){return this},e},r}function bP(e,t,...n){if("undefined"!=typeof process&&"production"===process.env.NODE_ENV&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let r=0;e=new Error(t.replace(/%s/g,function(){return n[r++]})),e.name="Invariant Violation"}throw e.framesToPop=1,e}}function wP(e){return"object"==typeof e}const xP="dnd-core/INIT_COORDS",CP="dnd-core/BEGIN_DRAG",SP="dnd-core/PUBLISH_DRAG_SOURCE",kP="dnd-core/HOVER",_P="dnd-core/DROP",EP="dnd-core/END_DRAG";function jP(e,t){return{type:xP,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const NP={type:xP,payload:{clientOffset:null,sourceClientOffset:null}};function RP(e){return function(t=[],n={publishSource:!0}){const{publishSource:r=!0,clientOffset:o,getSourceClientOffset:a}=n,i=e.getMonitor(),s=e.getRegistry();e.dispatch(jP(o)),function(e,t,n){bP(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){bP(n.getSource(e),"Expected sourceIds to be registered.")})}(t,i,s);const l=function(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}(t,i);if(null==l)return void e.dispatch(NP);let u=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");!function(e){bP("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(a),u=a(l)}e.dispatch(jP(o,u));const c=s.getSource(l).beginDrag(i,l);if(null==c)return;!function(e){bP(wP(e),"Item must be an object.")}(c),s.pinSource(l);const d=s.getSourceType(l);return{type:CP,payload:{itemType:d,item:c,sourceId:l,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!r}}}}function OP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){OP(e,t,n[t])})}return e}function TP(e){return function(t={}){const n=e.getMonitor(),r=e.getRegistry();!function(e){bP(e.isDragging(),"Cannot call drop while not dragging."),bP(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(n);const o=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(n);o.forEach((o,a)=>{const i=function(e,t,n,r){const o=n.getTarget(e);let a=o?o.drop(r,e):void 0;(function(e){bP(void 0===e||wP(e),"Drop result must either be an object or undefined.")})(a),void 0===a&&(a=0===t?{}:r.getDropResult());return a}(o,a,r,n),s={type:_P,payload:{dropResult:PP({},t,i)}};e.dispatch(s)})}}function DP(e){return function(){const t=e.getMonitor(),n=e.getRegistry();!function(e){bP(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const r=t.getSourceId();if(null!=r){n.getSource(r,!0).endDrag(t,r),n.unpinSource()}return{type:EP}}}function MP(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}function IP(e){return function(t,{clientOffset:n}={}){!function(e){bP(Array.isArray(e),"Expected targetIds to be an array.")}(t);const r=t.slice(0),o=e.getMonitor(),a=e.getRegistry();return function(e,t,n){for(let r=e.length-1;r>=0;r--){const o=e[r];MP(t.getTargetType(o),n)||e.splice(r,1)}}(r,a,o.getItemType()),function(e,t,n){bP(t.isDragging(),"Cannot call hover while not dragging."),bP(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const r=e[t];bP(e.lastIndexOf(r)===t,"Expected targetIds to be unique in the passed array.");bP(n.getTarget(r),"Expected targetIds to be registered.")}}(r,o,a),function(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}(r,o,a),{type:kP,payload:{targetIds:r,clientOffset:n||null}}}}function AP(e){return function(){if(e.getMonitor().isDragging())return{type:SP}}}class LP{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store;const n=function(e){return{beginDrag:RP(e),publishDragSource:AP(e),hover:IP(e),drop:TP(e),endDrag:DP(e)}}(this);return Object.keys(n).reduce((r,o)=>{const a=n[o];var i;return r[o]=(i=a,(...n)=>{const r=i.apply(e,n);void 0!==r&&t(r)}),r},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function FP(e,t){return{x:e.x-t.x,y:e.y-t.y}}const zP=[],$P=[];zP.__IS_NONE__=!0,$P.__IS_ALL__=!0;class HP{subscribeToStateChange(e,t={}){const{handlerIds:n}=t;bP("function"==typeof e,"listener must be a function."),bP(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let r=this.store.getState().stateId;return this.store.subscribe(()=>{const t=this.store.getState(),o=t.stateId;try{const a=o===r||o===r+1&&!function(e,t){return e!==zP&&(e===$P||void 0===t||(n=e,t.filter(e=>n.indexOf(e)>-1)).length>0);var n}(t.dirtyHandlerIds,n);a||e()}finally{r=o}})}subscribeToOffsetChange(e){bP("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{const n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return bP(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);if(bP(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;return MP(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);if(bP(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;return this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:n}=t;if(!this.isDragging())return!1;const r=this.registry.getTargetType(e),o=this.getItemType();if(o&&!MP(r,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const i=a.indexOf(e);return n?i===a.length-1:i>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return t&&n&&r?FP(function(e,t){return{x:e.x+t.x,y:e.y+t.y}}(t,r),n):null}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:n}=e;return t&&n?FP(t,n):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const BP="undefined"!=typeof global?global:self,VP=BP.MutationObserver||BP.WebKitMutationObserver;function UP(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const qP="function"==typeof VP?function(e){let t=1;const n=new VP(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:UP;class WP{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const YP=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=qP(this.flush),this.requestErrorThrow=UP(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},GP=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new WP(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(YP.registerPendingError);const KP="dnd-core/ADD_SOURCE",QP="dnd-core/ADD_TARGET",ZP="dnd-core/REMOVE_SOURCE",XP="dnd-core/REMOVE_TARGET";function JP(e,t){t&&Array.isArray(e)?e.forEach(e=>JP(e,!1)):bP("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var eT;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(eT||(eT={}));let tT=0;function nT(e){const t=(tT++).toString();switch(e){case eT.SOURCE:return`S${t}`;case eT.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function rT(e){switch(e[0]){case"S":return eT.SOURCE;case"T":return eT.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function oT(e,t){const n=e.entries();let r=!1;do{const{done:e,value:[,o]}=n.next();if(o===t)return!0;r=!!e}while(!r);return!1}class aT{addSource(e,t){JP(e),function(e){bP("function"==typeof e.canDrag,"Expected canDrag to be a function."),bP("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),bP("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const n=this.addHandler(eT.SOURCE,e,t);return this.store.dispatch(function(e){return{type:KP,payload:{sourceId:e}}}(n)),n}addTarget(e,t){JP(e,!0),function(e){bP("function"==typeof e.canDrop,"Expected canDrop to be a function."),bP("function"==typeof e.hover,"Expected hover to be a function."),bP("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const n=this.addHandler(eT.TARGET,e,t);return this.store.dispatch(function(e){return{type:QP,payload:{targetId:e}}}(n)),n}containsHandler(e){return oT(this.dragSources,e)||oT(this.dropTargets,e)}getSource(e,t=!1){bP(this.isSourceId(e),"Expected a valid source ID.");return t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return bP(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return bP(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return bP(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rT(e)===eT.SOURCE}isTargetId(e){return rT(e)===eT.TARGET}removeSource(e){var t;bP(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:ZP,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},YP.enqueueTask(GP.create(t))}removeTarget(e){bP(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:XP,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);bP(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){bP(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){const r=nT(e);return this.types.set(r,t),e===eT.SOURCE?this.dragSources.set(r,n):e===eT.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const iT=(e,t)=>e===t;function sT(e=zP,t){switch(t.type){case kP:break;case KP:case QP:case XP:case ZP:return zP;default:return $P}const{targetIds:n=[],prevTargetIds:r=[]}=t.payload,o=function(e,t){const n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);const o=[];return n.forEach((e,t)=>{1===e&&o.push(t)}),o}(n,r),a=o.length>0||!function(e,t,n=iT){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}(n,r);if(!a)return zP;const i=r[r.length-1],s=n[n.length-1];return i!==s&&(i&&o.push(i),s&&o.push(s)),o}function lT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uT={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function cT(e=uT,t){const{payload:n}=t;switch(t.type){case xP:case CP:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case kP:return r=e.clientOffset,o=n.clientOffset,!r&&!o||r&&o&&r.x===o.x&&r.y===o.y?e:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){lT(e,t,n[t])})}return e}({},e,{clientOffset:n.clientOffset});case EP:case _P:return uT;default:return e}var r,o}function dT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fT(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){dT(e,t,n[t])})}return e}const pT={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function hT(e=pT,t){const{payload:n}=t;switch(t.type){case CP:return fT({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case SP:return fT({},e,{isSourcePublic:!0});case kP:return fT({},e,{targetIds:n.targetIds});case XP:return-1===e.targetIds.indexOf(n.targetId)?e:fT({},e,{targetIds:(r=e.targetIds,o=n.targetId,r.filter(e=>e!==o))});case _P:return fT({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case EP:return fT({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var r,o}function mT(e=0,t){switch(t.type){case KP:case QP:return e+1;case ZP:case XP:return e-1;default:return e}}function gT(e=0){return e+1}function yT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vT(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){yT(e,t,n[t])})}return e}function bT(e={},t){return{dirtyHandlerIds:sT(e.dirtyHandlerIds,{type:t.type,payload:vT({},t.payload,{prevTargetIds:(n=e,r="dragOperation.targetIds",o=[],r.split(".").reduce((e,t)=>e&&e[t]?e[t]:o||null,n))})}),dragOffset:cT(e.dragOffset,t),refCount:mT(e.refCount,t),dragOperation:hT(e.dragOperation,t),stateId:gT(e.stateId)};var n,r,o}function wT(e,t=void 0,n={},r=!1){const o=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return vP(bT,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(r),a=new HP(o,new aT(o)),i=new LP(o,a),s=e(i,t,n);return i.receiveBackend(s),i}function xT(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}let CT=0;const ST=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var kT,_T,ET=D.memo(function(e){var{children:t}=e,n=xT(e,["children"]);const[r,o]=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}const t=function(e,t=jT(),n,r){const o=t;o[ST]||(o[ST]={dragDropManager:wT(e,t,n,r)});return o[ST]}(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}(n);return D.useEffect(()=>{if(o){const e=jT();return++CT,()=>{0===--CT&&(e[ST]=null)}}},[]),m.jsx(pP.Provider,{value:r,children:t})});function jT(){return"undefined"!=typeof global?global:window}var NT=(_T||(_T=1,kT=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!==o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;0!==o--;){var i=a[o];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}),kT),RT=n(NT);const OT="undefined"!=typeof window?D.useLayoutEffect:D.useEffect;function PT(e,t,n){const[r,o]=function(e,t,n){const[r,o]=D.useState(()=>t(e)),a=D.useCallback(()=>{const a=t(e);RT(r,a)||(o(a),n&&n())},[r,e,n]);return OT(a),[r,a]}(e,t,n);return OT(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(o,{handlerIds:[t]})},[e,o]),r}function TT(e,t,n){return PT(t,e||(()=>({})),()=>n.reconnect())}function DT(e,t){const n=[...t||[]];return null==t&&"function"!=typeof e&&n.push(e),D.useMemo(()=>"function"==typeof e?e():e,n)}function MT(e){return D.useMemo(()=>e.hooks.dragSource(),[e])}function IT(e){return D.useMemo(()=>e.hooks.dragPreview(),[e])}let AT=!1,LT=!1;class FT{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){bP(!AT,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return AT=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{AT=!1}}isDragging(){if(!this.sourceId)return!1;bP(!LT,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return LT=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{LT=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}let zT=!1;class $T{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;bP(!zT,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return zT=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{zT=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}function HT(e,t,n,r){let o;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let n=0;n<a.length;n++){const r=a[n];if(!s(r))return!1;const i=e[r],l=t[r];if(o=void 0,!1===o||void 0===o&&i!==l)return!1}return!0}function BT(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function VT(e){return(t=null,n=null)=>{if(!D.isValidElement(t)){const r=t;return e(r,n),r}const r=t;!function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(r);const o=n?t=>e(t,n):e;return function(e,t){const n=e.ref;return bP("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?D.cloneElement(e,{ref:e=>{qT(n,e),qT(t,e)}}):D.cloneElement(e,{ref:t})}(r,o)}}function UT(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const e=VT(r);t[n]=()=>e}}),t}function qT(e,t){"function"==typeof e?e(t):e.current=t}class WT{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(t?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!HT(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!HT(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=UT({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,BT(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,BT(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}class YT{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!HT(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=UT({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,BT(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function GT(){const{dragDropManager:e}=D.useContext(pP);return bP(null!=e,"Expected drag drop context"),e}class KT{beginDrag(){const e=this.spec,t=this.monitor;let n=null;return n="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=n?n:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const n=this.spec,r=this.monitor,{isDragging:o}=n;return o?o(r):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}}function QT(e,t,n){const r=GT(),o=function(e,t,n){const r=D.useMemo(()=>new KT(e,t,n),[t,n]);return D.useEffect(()=>{r.spec=e},[e]),r}(e,t,n),a=function(e){return D.useMemo(()=>{const t=e.type;return bP(null!=t,"spec.type must be defined"),t},[e])}(e);OT(function(){if(null!=a){const[e,i]=function(e,t,n){const r=n.getRegistry(),o=r.addSource(e,t);return[o,()=>r.removeSource(o)]}(a,o,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),i}},[r,t,n,o,a])}function ZT(e,t){const n=DT(e,t);bP(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=function(){const e=GT();return D.useMemo(()=>new FT(e),[e])}(),o=function(e,t){const n=GT(),r=D.useMemo(()=>new WT(n.getBackend()),[n]);return OT(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),OT(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}(n.options,n.previewOptions);return QT(n,r,o),[TT(n.collect,r,o),MT(o),IT(o)]}function XT(e){return D.useMemo(()=>e.hooks.dropTarget(),[e])}class JT{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function eD(e,t,n){const r=GT(),o=function(e,t){const n=D.useMemo(()=>new JT(e,t),[t]);return D.useEffect(()=>{n.spec=e},[e]),n}(e,t),a=function(e){const{accept:t}=e;return D.useMemo(()=>(bP(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);OT(function(){const[e,i]=function(e,t,n){const r=n.getRegistry(),o=r.addTarget(e,t);return[o,()=>r.removeTarget(o)]}(a,o,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),i},[r,t,o,n,a.map(e=>e.toString()).join("|")])}function tD(e,t){const n=DT(e,t),r=function(){const e=GT();return D.useMemo(()=>new $T(e),[e])}(),o=function(e){const t=GT(),n=D.useMemo(()=>new YT(t.getBackend()),[t]);return OT(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}(n.options);return eD(n,r,o),[TT(n.collect,r,o),XT(o)]}function nD(e){let t=null;return()=>(null==t&&(t=e()),t)}class rD{enter(e){const t=this.entered.length;return this.entered=function(e,t){const n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);const o=[];return n.forEach(e=>o.push(e)),o}(this.entered.filter(t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var n,r;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=e,n.filter(e=>e!==r)),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class oD{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})})}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach(n=>{const r=this.config.exposeProperties[n];null!=r&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const aD="__NATIVE_FILE__",iD="__NATIVE_URL__",sD="__NATIVE_TEXT__",lD="__NATIVE_HTML__";var uD=Object.freeze({__proto__:null,FILE:aD,HTML:lD,TEXT:sD,URL:iD});function cD(e,t,n){const r=t.reduce((t,n)=>t||e.getData(n),"");return null!=r?r:n}const dD={[aD]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[lD]:{exposeProperties:{html:(e,t)=>cD(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[iD]:{exposeProperties:{urls:(e,t)=>cD(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[sD]:{exposeProperties:{text:(e,t)=>cD(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function fD(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(dD).filter(e=>{const n=dD[e];return!!(null==n?void 0:n.matchesTypes)&&n.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}const pD=nD(()=>/firefox/i.test(navigator.userAgent)),hD=nD(()=>Boolean(window.safari));class mD{interpolate(e){const{xs:t,ys:n,c1s:r,c2s:o,c3s:a}=this;let i=t.length-1;if(e===t[i])return n[i];let s,l=0,u=a.length-1;for(;l<=u;){s=Math.floor(.5*(l+u));const r=t[s];if(r<e)l=s+1;else{if(!(r>e))return n[s];u=s-1}}i=Math.max(0,u);const c=e-t[i],d=c*c;return n[i]+r[i]*c+o[i]*d+a[i]*c*d}constructor(e,t){const{length:n}=e,r=[];for(let e=0;e<n;e++)r.push(e);r.sort((t,n)=>e[t]<e[n]?-1:1);const o=[],a=[];let i,s;for(let r=0;r<n-1;r++)i=e[r+1]-e[r],s=t[r+1]-t[r],o.push(i),a.push(s/i);const l=[a[0]];for(let e=0;e<o.length-1;e++){const t=a[e],n=a[e+1];if(t*n<=0)l.push(0);else{i=o[e];const r=o[e+1],a=i+r;l.push(3*a/((a+r)/t+(a+i)/n))}}l.push(a[a.length-1]);const u=[],c=[];let d;for(let e=0;e<l.length-1;e++){d=a[e];const t=l[e],n=1/o[e],r=t+l[e+1]-d-d;u.push((d-t-r)*n),c.push(r*n*n)}this.xs=e,this.ys=t,this.c1s=l,this.c2s=u,this.c3s=c}}function gD(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function yD(e){return{x:e.clientX,y:e.clientY}}function vD(e,t,n,r,o){const a=function(e){var t;return"IMG"===e.nodeName&&(pD()||!(null===(t=document.documentElement)||void 0===t?void 0:t.contains(e)))}(t),i=gD(a?e:t),s={x:n.x-i.x,y:n.y-i.y},{offsetWidth:l,offsetHeight:u}=e,{anchorX:c,anchorY:d}=r,{dragPreviewWidth:f,dragPreviewHeight:p}=function(e,t,n,r){let o=e?t.width:n,a=e?t.height:r;return hD()&&e&&(a/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:a}}(a,t,l,u),{offsetX:h,offsetY:m}=o,g=0===m||m;return{x:0===h||h?h:new mD([0,.5,1],[s.x,s.x/l*f,s.x+f-l]).interpolate(c),y:g?m:(()=>{let e=new mD([0,.5,1],[s.y,s.y/u*p,s.y+p-u]).interpolate(d);return hD()&&a&&(e+=(window.devicePixelRatio-1)*p),e})()}}class bD{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function wD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){wD(e,t,n[t])})}return e}class CD{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,n){return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,n){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);const r=t=>this.handleDragStart(t,e),o=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",r),t.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",r),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const n=t=>this.handleDragEnter(t,e),r=t=>this.handleDragOver(t,e),o=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",n),t.addEventListener("dragover",r),t.addEventListener("drop",o),()=>{t.removeEventListener("dragenter",n),t.removeEventListener("dragover",r),t.removeEventListener("drop",o)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return xD({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return xD({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(uD).some(t=>uD[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const n=dD[e];if(!n)throw new Error(`native type ${e} has no configuration`);const r=new oD(n);return r.loadDataTransfer(t),r}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;this.mouseMoveTimeoutTimer=setTimeout(()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){var e;if(this.currentDragSourceNode=null,this.rootElement)null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0);return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&gD(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const n=yD(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});const{dataTransfer:r}=e,o=fD(r);if(this.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),o=this.sourcePreviewNodes.get(e)||t;if(o){const{anchorX:e,anchorY:a,offsetX:i,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),l=vD(t,o,n,{anchorX:e,anchorY:a},{offsetX:i,offsetY:s});r.setDragImage(o,l.x,l.y)}}try{null==r||r.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(o)this.beginDragNativeItem(o);else{if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;(this.dragEnterTargetIds=[],this.isDraggingNativeItem())&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer));if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:n}=e,r=fD(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:yD(e)});t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=e=>{var t;(this.dragOverTargetIds=[],this.isDraggingNativeItem())&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=yD(e),this.scheduleHover(t);(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault();this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;(this.dropTargetIds=[],this.isDraggingNativeItem())?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):fD(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:yD(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new bD(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new rD(this.isNodeInDocument)}}const SD=function(e,t,n){return new CD(e,t,n)};var kD,_D,ED=Object.create,jD=Object.defineProperty,ND=Object.getOwnPropertyDescriptor,RD=Object.getOwnPropertyNames,OD=Object.getPrototypeOf,PD=Object.prototype.hasOwnProperty,TD=(e,t,n)=>(n=null!=e?ED(OD(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of RD(t))PD.call(e,o)||o===n||jD(e,o,{get:()=>t[o],enumerable:!(r=ND(t,o))||r.enumerable});return e})(jD(n,"default",{value:e,enumerable:!0}),e)),DD=(kD={"node_modules/classnames/index.js"(e,t){!function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var a=typeof o;if("string"===a||"number"===a)t.push(o);else if(Array.isArray(o)){if(o.length){var i=n.apply(null,o);i&&t.push(i)}}else if("object"===a){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){t.push(o.toString());continue}for(var s in o)e.call(o,s)&&o[s]&&t.push(s)}}}return t.join(" ")}void 0!==t&&t.exports?(n.default=n,t.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()}},function(){return _D||(0,kD[RD(kD)[0]])((_D={exports:{}}).exports,_D),_D.exports}),MD=TD(DD()),ID="object"==typeof global&&global&&global.Object===Object&&global,AD="object"==typeof self&&self&&self.Object===Object&&self,LD=ID||AD||Function("return this")(),FD=LD.Symbol,zD=Object.prototype,$D=zD.hasOwnProperty,HD=zD.toString,BD=FD?FD.toStringTag:void 0;var VD=function(e){var t=$D.call(e,BD),n=e[BD];try{e[BD]=void 0;var r=!0}catch(e){}var o=HD.call(e);return r&&(t?e[BD]=n:delete e[BD]),o},UD=Object.prototype.toString;var qD=function(e){return UD.call(e)},WD=FD?FD.toStringTag:void 0;var YD=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":WD&&WD in Object(e)?VD(e):qD(e)};var GD=function(e){return null!=e&&"object"==typeof e};var KD=function(e){return"symbol"==typeof e||GD(e)&&"[object Symbol]"==YD(e)};var QD=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o},ZD=Array.isArray,XD=FD?FD.prototype:void 0,JD=XD?XD.toString:void 0;var eM=function e(t){if("string"==typeof t)return t;if(ZD(t))return QD(t,e)+"";if(KD(t))return JD?JD.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var tM=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var nM,rM=function(e){if(!tM(e))return!1;var t=YD(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},oM=LD["__core-js_shared__"],aM=(nM=/[^.]+$/.exec(oM&&oM.keys&&oM.keys.IE_PROTO||""))?"Symbol(src)_1."+nM:"";var iM=function(e){return!!aM&&aM in e},sM=Function.prototype.toString;var lM=function(e){if(null!=e){try{return sM.call(e)}catch(e){}try{return e+""}catch(e){}}return""},uM=/^\[object .+?Constructor\]$/,cM=Function.prototype,dM=Object.prototype,fM=cM.toString,pM=dM.hasOwnProperty,hM=RegExp("^"+fM.call(pM).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var mM=function(e){return!(!tM(e)||iM(e))&&(rM(e)?hM:uM).test(lM(e))};var gM=function(e,t){return null==e?void 0:e[t]};var yM=function(e,t){var n=gM(e,t);return mM(n)?n:void 0},vM=yM(LD,"WeakMap");var bM=function(){};var wM=function(e,t,n,r){for(var o=e.length,a=n+(r?1:-1);r?a--:++a<o;)if(t(e[a],a,e))return a;return-1};var xM=function(e){return e!=e};var CM=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1};var SM=function(e,t,n){return t==t?CM(e,t,n):wM(e,xM,n)};var kM=function(e,t){return!!(null==e?0:e.length)&&SM(e,t,0)>-1},_M=/^(?:0|[1-9]\d*)$/;var EM=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&_M.test(e))&&e>-1&&e%1==0&&e<t};var jM=function(e,t){return e===t||e!=e&&t!=t};var NM=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var RM=function(e){return null!=e&&NM(e.length)&&!rM(e)},OM=Object.prototype;var PM=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||OM)};var TM=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var DM=function(e){return GD(e)&&"[object Arguments]"==YD(e)},MM=Object.prototype,IM=MM.hasOwnProperty,AM=MM.propertyIsEnumerable,LM=DM(function(){return arguments}())?DM:function(e){return GD(e)&&IM.call(e,"callee")&&!AM.call(e,"callee")},FM=LM;var zM=function(){return!1},$M="object"==typeof e&&e&&!e.nodeType&&e,HM=$M&&"object"==typeof module&&module&&!module.nodeType&&module,BM=HM&&HM.exports===$M?LD.Buffer:void 0,VM=(BM?BM.isBuffer:void 0)||zM,UM={};UM["[object Float32Array]"]=UM["[object Float64Array]"]=UM["[object Int8Array]"]=UM["[object Int16Array]"]=UM["[object Int32Array]"]=UM["[object Uint8Array]"]=UM["[object Uint8ClampedArray]"]=UM["[object Uint16Array]"]=UM["[object Uint32Array]"]=!0,UM["[object Arguments]"]=UM["[object Array]"]=UM["[object ArrayBuffer]"]=UM["[object Boolean]"]=UM["[object DataView]"]=UM["[object Date]"]=UM["[object Error]"]=UM["[object Function]"]=UM["[object Map]"]=UM["[object Number]"]=UM["[object Object]"]=UM["[object RegExp]"]=UM["[object Set]"]=UM["[object String]"]=UM["[object WeakMap]"]=!1;var qM=function(e){return GD(e)&&NM(e.length)&&!!UM[YD(e)]};var WM=function(e){return function(t){return e(t)}},YM="object"==typeof e&&e&&!e.nodeType&&e,GM=YM&&"object"==typeof module&&module&&!module.nodeType&&module,KM=GM&&GM.exports===YM&&ID.process,QM=function(){try{var e=GM&&GM.require&&GM.require("util").types;return e||KM&&KM.binding&&KM.binding("util")}catch(e){}}(),ZM=QM&&QM.isTypedArray,XM=ZM?WM(ZM):qM,JM=Object.prototype.hasOwnProperty;var eI=function(e,t){var n=ZD(e),r=!n&&FM(e),o=!n&&!r&&VM(e),a=!n&&!r&&!o&&XM(e),i=n||r||o||a,s=i?TM(e.length,String):[],l=s.length;for(var u in e)!t&&!JM.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||EM(u,l))||s.push(u);return s};var tI=function(e,t){return function(n){return e(t(n))}},nI=tI(Object.keys,Object),rI=Object.prototype.hasOwnProperty;var oI=function(e){if(!PM(e))return nI(e);var t=[];for(var n in Object(e))rI.call(e,n)&&"constructor"!=n&&t.push(n);return t};var aI=function(e){return RM(e)?eI(e):oI(e)},iI=yM(Object,"create");var sI=function(){this.__data__=iI?iI(null):{},this.size=0};var lI=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},uI=Object.prototype.hasOwnProperty;var cI=function(e){var t=this.__data__;if(iI){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return uI.call(t,e)?t[e]:void 0},dI=Object.prototype.hasOwnProperty;var fI=function(e){var t=this.__data__;return iI?void 0!==t[e]:dI.call(t,e)};var pI=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=iI&&void 0===t?"__lodash_hash_undefined__":t,this};function hI(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}hI.prototype.clear=sI,hI.prototype.delete=lI,hI.prototype.get=cI,hI.prototype.has=fI,hI.prototype.set=pI;var mI=hI;var gI=function(){this.__data__=[],this.size=0};var yI=function(e,t){for(var n=e.length;n--;)if(jM(e[n][0],t))return n;return-1},vI=Array.prototype.splice;var bI=function(e){var t=this.__data__,n=yI(t,e);return!(n<0)&&(n==t.length-1?t.pop():vI.call(t,n,1),--this.size,!0)};var wI=function(e){var t=this.__data__,n=yI(t,e);return n<0?void 0:t[n][1]};var xI=function(e){return yI(this.__data__,e)>-1};var CI=function(e,t){var n=this.__data__,r=yI(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function SI(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}SI.prototype.clear=gI,SI.prototype.delete=bI,SI.prototype.get=wI,SI.prototype.has=xI,SI.prototype.set=CI;var kI=SI,_I=yM(LD,"Map");var EI=function(){this.size=0,this.__data__={hash:new mI,map:new(_I||kI),string:new mI}};var jI=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var NI=function(e,t){var n=e.__data__;return jI(t)?n["string"==typeof t?"string":"hash"]:n.map};var RI=function(e){var t=NI(this,e).delete(e);return this.size-=t?1:0,t};var OI=function(e){return NI(this,e).get(e)};var PI=function(e){return NI(this,e).has(e)};var TI=function(e,t){var n=NI(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function DI(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}DI.prototype.clear=EI,DI.prototype.delete=RI,DI.prototype.get=OI,DI.prototype.has=PI,DI.prototype.set=TI;var MI=DI;var II=function(e){return null==e?"":eM(e)};var AI=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e};var LI=function(e){return function(t){return null==e?void 0:e[t]}};var FI=function(){this.__data__=new kI,this.size=0};var zI=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var $I=function(e){return this.__data__.get(e)};var HI=function(e){return this.__data__.has(e)};var BI=function(e,t){var n=this.__data__;if(n instanceof kI){var r=n.__data__;if(!_I||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new MI(r)}return n.set(e,t),this.size=n.size,this};function VI(e){var t=this.__data__=new kI(e);this.size=t.size}VI.prototype.clear=FI,VI.prototype.delete=zI,VI.prototype.get=$I,VI.prototype.has=HI,VI.prototype.set=BI;var UI=VI;var qI=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[o++]=i)}return a};var WI=function(){return[]},YI=Object.prototype.propertyIsEnumerable,GI=Object.getOwnPropertySymbols,KI=GI?function(e){return null==e?[]:(e=Object(e),qI(GI(e),function(t){return YI.call(e,t)}))}:WI;var QI=function(e,t,n){var r=t(e);return ZD(e)?r:AI(r,n(e))};var ZI=function(e){return QI(e,aI,KI)},XI=yM(LD,"DataView"),JI=yM(LD,"Promise"),eA=yM(LD,"Set"),tA="[object Map]",nA="[object Promise]",rA="[object Set]",oA="[object WeakMap]",aA="[object DataView]",iA=lM(XI),sA=lM(_I),lA=lM(JI),uA=lM(eA),cA=lM(vM),dA=YD;(XI&&dA(new XI(new ArrayBuffer(1)))!=aA||_I&&dA(new _I)!=tA||JI&&dA(JI.resolve())!=nA||eA&&dA(new eA)!=rA||vM&&dA(new vM)!=oA)&&(dA=function(e){var t=YD(e),n="[object Object]"==t?e.constructor:void 0,r=n?lM(n):"";if(r)switch(r){case iA:return aA;case sA:return tA;case lA:return nA;case uA:return rA;case cA:return oA}return t});var fA=dA,pA=LD.Uint8Array;var hA=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var mA=function(e){return this.__data__.has(e)};function gA(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new MI;++t<n;)this.add(e[t])}gA.prototype.add=gA.prototype.push=hA,gA.prototype.has=mA;var yA=gA;var vA=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};var bA=function(e,t){return e.has(t)};var wA=function(e,t,n,r,o,a){var i=1&n,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,p=2&n?new yA:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],m=t[d];if(r)var g=i?r(m,h,d,t,e,a):r(h,m,d,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!vA(t,function(e,t){if(!bA(p,t)&&(h===e||o(h,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(h!==m&&!o(h,m,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f};var xA=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n};var CA=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},SA=FD?FD.prototype:void 0,kA=SA?SA.valueOf:void 0;var _A=function(e,t,n,r,o,a,i){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new pA(e),new pA(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return jM(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=xA;case"[object Set]":var l=1&r;if(s||(s=CA),e.size!=t.size&&!l)return!1;var u=i.get(e);if(u)return u==t;r|=2,i.set(e,t);var c=wA(s(e),s(t),r,o,a,i);return i.delete(e),c;case"[object Symbol]":if(kA)return kA.call(e)==kA.call(t)}return!1},EA=Object.prototype.hasOwnProperty;var jA=function(e,t,n,r,o,a){var i=1&n,s=ZI(e),l=s.length;if(l!=ZI(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:EA.call(t,c)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var h=i;++u<l;){var m=e[c=s[u]],g=t[c];if(r)var y=i?r(g,m,c,t,e,a):r(m,g,c,e,t,a);if(!(void 0===y?m===g||o(m,g,n,r,a):y)){p=!1;break}h||(h="constructor"==c)}if(p&&!h){var v=e.constructor,b=t.constructor;v==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(e),a.delete(t),p},NA="[object Arguments]",RA="[object Array]",OA="[object Object]",PA=Object.prototype.hasOwnProperty;var TA=function(e,t,n,r,o,a){var i=ZD(e),s=ZD(t),l=i?RA:fA(e),u=s?RA:fA(t),c=(l=l==NA?OA:l)==OA,d=(u=u==NA?OA:u)==OA,f=l==u;if(f&&VM(e)){if(!VM(t))return!1;i=!0,c=!1}if(f&&!c)return a||(a=new UI),i||XM(e)?wA(e,t,n,r,o,a):_A(e,t,l,n,r,o,a);if(!(1&n)){var p=c&&PA.call(e,"__wrapped__"),h=d&&PA.call(t,"__wrapped__");if(p||h){var m=p?e.value():e,g=h?t.value():t;return a||(a=new UI),o(m,g,n,r,a)}}return!!f&&(a||(a=new UI),jA(e,t,n,r,o,a))};var DA=function e(t,n,r,o,a){return t===n||(null==t||null==n||!GD(t)&&!GD(n)?t!=t&&n!=n:TA(t,n,r,o,e,a))};var MA=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1},IA=LI({"&":"&","<":"<",">":">",'"':""","'":"'"}),AA=/[&<>"']/g,LA=RegExp(AA.source);var FA=function(e){return(e=II(e))&&LA.test(e)?e.replace(AA,IA):e},zA=/[\\^$.*+?()[\]{}|]/g,$A=RegExp(zA.source);var HA=function(e){return(e=II(e))&&$A.test(e)?e.replace(zA,"\\$&"):e};var BA=function(e,t){return DA(e,t)},VA=eA&&1/CA(new eA([,-0]))[1]==1/0?function(e){return new eA(e)}:bM,UA=VA;var qA=function(e,t,n){var r=-1,o=kM,a=e.length,i=!0,s=[],l=s;if(n)i=!1,o=MA;else if(a>=200){var u=t?null:UA(e);if(u)return CA(u);i=!1,o=bA,l=new yA}else l=t?[]:s;e:for(;++r<a;){var c=e[r],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var f=l.length;f--;)if(l[f]===d)continue e;t&&l.push(d),s.push(c)}else o(l,d,n)||(l!==s&&l.push(d),s.push(c))}return s};var WA=function(e){return e&&e.length?qA(e):[]},YA={ENTER:[10,13],TAB:9,BACKSPACE:8,UP_ARROW:38,DOWN_ARROW:40,SPACE:32},GA={ENTER:"Enter",TAB:"Tab",COMMA:",",SPACE:" ",SEMICOLON:";"},KA="Press enter to add new tag",QA="text",ZA={tags:"ReactTags__tags",tagInput:"ReactTags__tagInput",tagInputField:"ReactTags__tagInputField",selected:"ReactTags__selected",tag:"ReactTags__tag",remove:"ReactTags__remove",suggestions:"ReactTags__suggestions",activeSuggestion:"ReactTags__activeSuggestion",editTagInput:"ReactTags__editTagInput",editTagInputField:"ReactTags__editTagInputField",clearAll:"ReactTags__clearAll"},XA="inline",JA="top",eL="bottom",tL="Tag limit reached!";function nL(e){const{moveTag:t,readOnly:n,allowDragDrop:r}=e;return void 0!==t&&!n&&r}var rL=e=>{const{readOnly:t,removeComponent:n,onRemove:r,className:o,tag:a,index:i}=e,s=e=>{if(YA.ENTER.includes(e.keyCode)||e.keyCode===YA.SPACE)return e.preventDefault(),void e.stopPropagation();e.keyCode===YA.BACKSPACE&&r(e)};if(t)return m.jsx("span",{});const l=`Tag at index ${i} with value ${a.id} focussed. Press backspace to remove`;if(n){const e=n;return m.jsx(e,{"data-testid":"remove",onRemove:r,onKeyDown:s,className:o,"aria-label":l,tag:a,index:i})}return m.jsx("button",{"data-testid":"remove",onClick:r,onKeyDown:s,className:o,type:"button","aria-label":l,children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"12",width:"12",fill:"#fff",children:m.jsx("path",{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"})})})},oL="tag",aL=e=>{const t=D.useRef(null),{readOnly:n=!1,tag:r,classNames:o,index:a,moveTag:i,allowDragDrop:s=!0,labelField:l="text",tags:u}=e,[{isDragging:c},d]=ZT(()=>({type:oL,collect:e=>({isDragging:!!e.isDragging()}),item:e,canDrag:()=>nL({moveTag:i,readOnly:n,allowDragDrop:s})}),[u]),[,f]=tD(()=>({accept:oL,drop:t=>{const n=t.index,r=a;n!==r&&e?.moveTag?.(n,r)},canDrop:e=>function(e){const{readOnly:t,allowDragDrop:n}=e;return!t&&n}(e)}),[u]);d(f(t));const p=e.tag[l],{className:h=""}=r,g=c?0:1;return m.jsxs("span",{ref:t,className:(0,MD.default)("tag-wrapper",o.tag,h),style:{opacity:g,cursor:nL({moveTag:i,readOnly:n,allowDragDrop:s})?"move":"auto"},"data-testid":"tag",onClick:e.onTagClicked,onTouchStart:e.onTagClicked,children:[p,m.jsx(rL,{tag:e.tag,className:o.remove,removeComponent:e.removeComponent,onRemove:e.onDelete,readOnly:n,index:a})]})},iL=e=>m.jsx("button",{"aria-label":e["aria-label"],className:e.classNames.clearAll,onClick:e.onClick,children:"Clear all"}),sL=(e,t,n,r)=>"function"==typeof r?r(e):e.length>=t&&n,lL=D.memo(e=>{const t=D.createRef(),{labelField:n,minQueryLength:r,isFocused:o,classNames:a,selectedIndex:i,query:s}=e;D.useEffect(()=>{if(!t.current)return;const e=t.current.querySelector(`.${a.activeSuggestion}`);e&&((e,t)=>{const n=t.offsetHeight,r=e.offsetHeight,o=e.offsetTop-t.scrollTop;o+r>=n?t.scrollTop+=o-n+r:o<0&&(t.scrollTop+=o)})(e,t.current)},[i]);const l=(e,t)=>{const r=t.trim().replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),{[n]:o}=e;return{__html:o.replace(RegExp(r,"gi"),e=>`<mark>${FA(e)}</mark>`)}},u=(t,n)=>"function"==typeof e.renderSuggestion?e.renderSuggestion(t,n):m.jsx("span",{dangerouslySetInnerHTML:l(t,n)}),c=e.suggestions.map((t,n)=>m.jsx("li",{onMouseDown:e.handleClick.bind(null,n),onTouchStart:e.handleClick.bind(null,n),onMouseOver:e.handleHover.bind(null,n),className:n===e.selectedIndex?e.classNames.activeSuggestion:"",children:u(t,e.query)},n));return 0!==c.length&&sL(s,r||2,o,e.shouldRenderSuggestions)?m.jsx("div",{ref:t,className:a.suggestions,"data-testid":"suggestions",children:m.jsxs("ul",{children:[" ",c," "]})}):null},(e,t)=>{const{query:n,minQueryLength:r=2,isFocused:o,suggestions:a}=t;return!(e.isFocused!==o||!BA(e.suggestions,a)||sL(n,r,o,t.shouldRenderSuggestions)!==sL(e.query,e.minQueryLength??2,e.isFocused,e.shouldRenderSuggestions)||e.selectedIndex!==t.selectedIndex)}),uL=lL,cL=TD(DD()),dL=e=>{const{autofocus:t,autoFocus:n,readOnly:r,labelField:o,allowDeleteFromEmptyInput:a,allowAdditionFromPaste:i,allowDragDrop:s,minQueryLength:l,shouldRenderSuggestions:u,removeComponent:c,autocomplete:d,inline:f,maxTags:p,allowUnique:h,editable:g,placeholder:y,delimiters:v,separators:b,tags:w,inputFieldPosition:x,inputProps:C,classNames:S,maxLength:k,inputValue:_,clearAll:E,ariaAttrs:j}=e,[N,R]=D.useState(e.suggestions),[O,P]=D.useState(""),[T,M]=D.useState(!1),[I,A]=D.useState(-1),[L,F]=D.useState(!1),[z,$]=D.useState(""),[H,B]=D.useState(-1),[V,U]=D.useState(""),q=D.createRef(),W=D.useRef(null),Y=D.useRef(null);D.useEffect(()=>{v.length&&console.warn("[Deprecation] The delimiters prop is deprecated and will be removed in v7.x.x, please use separators instead. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/960")},[]),D.useEffect(()=>{void 0!==f&&console.warn("[Deprecation] The inline attribute is deprecated and will be removed in v7.x.x, please use inputFieldPosition instead.")},[f]),D.useEffect(()=>{void 0!==t&&console.warn("[Deprecated] autofocus prop will be removed in 7.x so please migrate to autoFocus prop."),(t||n&&!1!==t)&&!r&&Q()},[n,n,r]),D.useEffect(()=>{ee()},[O,e.suggestions]);const G=t=>{let n=e.suggestions.slice();if(h){const e=w.map(e=>e.id.trim().toLowerCase());n=n.filter(t=>!e.includes(t.id.toLowerCase()))}if(e.handleFilterSuggestions)return e.handleFilterSuggestions(t,n);const r=n.filter(e=>0===K(t,e)),o=n.filter(e=>K(t,e)>0);return r.concat(o)},K=(e,t)=>t[o].toLowerCase().indexOf(e.toLowerCase()),Q=()=>{P(""),W.current&&(W.current.value="",W.current.focus())},Z=(t,n)=>{n.preventDefault(),n.stopPropagation();const r=w.slice();0!==r.length&&(U(""),e?.handleDelete?.(t,n),X(t,r))},X=(e,t)=>{if(!q?.current)return;const n=q.current.querySelectorAll(".ReactTags__remove");let r="";0===e&&t.length>1?(r=`Tag at index ${e} with value ${t[e].id} deleted. Tag at index 0 with value ${t[1].id} focussed. Press backspace to remove`,n[0].focus()):e>0?(r=`Tag at index ${e} with value ${t[e].id} deleted. Tag at index ${e-1} with value ${t[e-1].id} focussed. Press backspace to remove`,n[e-1].focus()):(r=`Tag at index ${e} with value ${t[e].id} deleted. Input focussed. Press enter to add a new tag`,W.current?.focus()),$(r)},J=t=>{e.handleInputChange&&e.handleInputChange(t.target.value,t);const n=t.target.value.trim();P(n)},ee=()=>{const e=G(O);R(e),A(I>=e.length?e.length-1:I)},te=t=>{const n=t.target.value;e.handleInputFocus&&e.handleInputFocus(n,t),M(!0)},ne=t=>{const n=t.target.value;e.handleInputBlur&&(e.handleInputBlur(n,t),W.current&&(W.current.value="")),M(!1),B(-1)},re=e=>{if(!e.nativeEvent.isComposing){if("Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),A(-1),F(!1),R([]),B(-1)),(-1!==b.indexOf(e.key)||-1!==v.indexOf(e.keyCode))&&!e.shiftKey){e.keyCode===YA.TAB&&""===O||e.preventDefault();const t=L&&-1!==I?N[I]:{id:O.trim(),[o]:O.trim(),className:""};Object.keys(t)&&ie(t)}"Backspace"!==e.key||""!==O||!a&&x!==XA||Z(w.length-1,e),e.keyCode===YA.UP_ARROW&&(e.preventDefault(),A(I<=0?N.length-1:I-1),F(!0)),e.keyCode===YA.DOWN_ARROW&&(e.preventDefault(),F(!0),0===N.length?A(-1):A((I+1)%N.length))}},oe=()=>p&&w.length>=p,ae=t=>{if(!i)return;if(oe())return U(tL),void Q();U(""),t.preventDefault();const n=t.clipboardData||window.clipboardData,r=n.getData("text"),{maxLength:a=r.length}=e,s=Math.min(a,r.length),l=n.getData("text").substr(0,s);let u=v;b.length&&(u=[],b.forEach(e=>{const t=function(e){switch(e){case GA.ENTER:return[10,13];case GA.TAB:return 9;case GA.COMMA:return 188;case GA.SPACE:return 32;case GA.SEMICOLON:return 186;default:return 0}}(e);Array.isArray(t)?u=[...u,...t]:u.push(t)}));const c=function(e){const t=e.map(e=>{const t=e-48*Math.floor(e/48);return String.fromCharCode(96<=e?t:e)}).join(""),n=HA(t);return new RegExp(`[${n}]+`)}(u),d=l.split(c).map(e=>e.trim());WA(d).forEach(e=>ie({id:e.trim(),[o]:e.trim(),className:""}))},ie=t=>{if(!t.id||!t[o])return;if(-1===H){if(oe())return U(tL),void Q();U("")}const n=w.map(e=>e.id.toLowerCase());if(!(h&&n.indexOf(t.id.trim().toLowerCase())>=0)){if(d){const e=G(t[o]);console.warn("[Deprecation] The autocomplete prop will be removed in 7.x to simplify the integration and make it more intutive. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/949"),(1===d&&1===e.length||!0===d&&e.length)&&(t=e[0])}-1!==H&&e.onTagUpdate?e.onTagUpdate(H,t):e?.handleAddition?.(t),P(""),F(!1),A(-1),B(-1),Q()}},se=(t,n)=>{const r=w[t];e?.handleDrag?.(r,t,n)},le=(()=>{const t={...ZA,...e.classNames};return w.map((n,a)=>m.jsx(D.Fragment,{children:H===a?m.jsx("div",{className:t.editTagInput,children:m.jsx("input",{ref:e=>{Y.current=e},onFocus:te,value:O,onChange:J,onKeyDown:re,onBlur:ne,className:t.editTagInputField,onPaste:ae,"data-testid":"tag-edit"})}):m.jsx(aL,{index:a,tag:n,tags:w,labelField:o,onDelete:e=>Z(a,e),moveTag:s?se:void 0,removeComponent:c,onTagClicked:t=>((t,n,a)=>{r||(g&&(B(t),P(n[o]),Y.current?.focus()),e.handleTagClick?.(t,a))})(a,n,t),readOnly:r,classNames:t,allowDragDrop:s})},a))})(),ue={...ZA,...S},{name:ce,id:de}=e,fe=!1===f?eL:x,pe=r?null:m.jsxs("div",{className:ue.tagInput,children:[m.jsx("input",{...C,ref:e=>{W.current=e},className:ue.tagInputField,type:"text",placeholder:y,"aria-label":y,onFocus:te,onBlur:ne,onChange:J,onKeyDown:re,onPaste:ae,name:ce,id:de,maxLength:k,value:_,"data-automation":"input","data-testid":"input"}),m.jsx(uL,{query:O.trim(),suggestions:N,labelField:o,selectedIndex:I,handleClick:e=>{ie(N[e])},handleHover:e=>{A(e),F(!0)},minQueryLength:l,shouldRenderSuggestions:u,isFocused:T,classNames:ue,renderSuggestion:e.renderSuggestion}),E&&w.length>0&&m.jsx(iL,{"aria-label":j?.clearAllLabel,classNames:ue,onClick:()=>{e.onClearAll&&e.onClearAll(),U(""),Q()}}),V&&m.jsxs("div",{"data-testid":"error",className:"ReactTags__error",children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"24",width:"24",fill:"#e03131",children:m.jsx("path",{d:"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"})}),V]})]});return m.jsxs("div",{className:(0,cL.default)(ue.tags,"react-tags-wrapper"),ref:q,children:[m.jsx("p",{role:"alert",className:"sr-only",style:{position:"absolute",overflow:"hidden",clip:"rect(0 0 0 0)",margin:"-1px",padding:0,width:"1px",height:"1px",border:0},children:z}),fe===JA&&pe,m.jsxs("div",{className:ue.selected,children:[le,fe===XA&&pe]}),fe===eL&&pe]})},fL=e=>{const{placeholder:t=KA,labelField:n=QA,suggestions:r=[],delimiters:o=[],separators:a=(e.delimiters?.length?[]:[GA.ENTER,GA.TAB]),autofocus:i,autoFocus:s=!0,inline:l,inputFieldPosition:u="inline",allowDeleteFromEmptyInput:c=!1,allowAdditionFromPaste:d=!0,autocomplete:f=!1,readOnly:p=!1,allowUnique:h=!0,allowDragDrop:g=!0,tags:y=[],inputProps:v={},editable:b=!1,clearAll:w=!1,ariaAttrs:x={clearAllLabel:"clear all tags"},handleDelete:C,handleAddition:S,onTagUpdate:k,handleDrag:_,handleFilterSuggestions:E,handleTagClick:j,handleInputChange:N,handleInputFocus:R,handleInputBlur:O,minQueryLength:P,shouldRenderSuggestions:T,removeComponent:D,onClearAll:M,classNames:I,name:A,id:L,maxLength:F,inputValue:z,maxTags:$,renderSuggestion:H}=e;return m.jsx(dL,{placeholder:t,labelField:n,suggestions:r,delimiters:o,separators:a,autofocus:i,autoFocus:s,inline:l,inputFieldPosition:u,allowDeleteFromEmptyInput:c,allowAdditionFromPaste:d,autocomplete:f,readOnly:p,allowUnique:h,allowDragDrop:g,tags:y,inputProps:v,editable:b,clearAll:w,ariaAttrs:x,handleDelete:C,handleAddition:S,onTagUpdate:k,handleDrag:_,handleFilterSuggestions:E,handleTagClick:j,handleInputChange:N,handleInputFocus:R,handleInputBlur:O,minQueryLength:P,shouldRenderSuggestions:T,removeComponent:D,onClearAll:M,classNames:I,name:A,id:L,maxLength:F,inputValue:z,maxTags:$,renderSuggestion:H})},pL=({...e})=>m.jsx(ET,{backend:SD,children:m.jsx(fL,{...e})});
|
|
223
|
+
`;var Fj=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});D.forwardRef((e,t)=>m.jsx(hi.span,{...e,ref:t,style:{...Fj,...e.style}})).displayName="VisuallyHidden";var zj=[" ","Enter","ArrowUp","ArrowDown"],$j=[" ","Enter"],Hj="Select",[Bj,Vj,Uj]=gi(Hj),[qj]=ai(Hj,[Uj,zl]),Wj=zl(),[Yj,Gj]=qj(Hj),[Kj,Qj]=qj(Hj),Zj=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:i,defaultValue:s,onValueChange:l,dir:u,name:c,autoComplete:d,disabled:f,required:p,form:h}=e,g=Wj(t),[y,v]=D.useState(null),[b,w]=D.useState(null),[x,C]=D.useState(!1),S=vi(u),[k,_]=ui({prop:r,defaultProp:o??!1,onChange:a,caller:Hj}),[E,j]=ui({prop:i,defaultProp:s,onChange:l,caller:Hj}),N=D.useRef(null),R=!y||(h||!!y.closest("form")),[O,P]=D.useState(new Set),T=Array.from(O).map(e=>e.props.value).join(";");return m.jsx(tu,{...g,children:m.jsxs(Yj,{required:p,scope:t,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:x,onValueNodeHasChildrenChange:C,contentId:Ui(),value:E,onValueChange:j,open:k,onOpenChange:_,dir:S,triggerPointerDownPosRef:N,disabled:f,children:[m.jsx(Bj.Provider,{scope:t,children:m.jsx(Kj,{scope:e.__scopeSelect,onNativeOptionAdd:D.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:D.useCallback(e=>{P(t=>{const n=new Set(t);return n.delete(e),n})},[]),children:n})}),R?m.jsxs(LN,{"aria-hidden":!0,required:p,tabIndex:-1,name:c,autoComplete:d,value:E,onChange:e=>j(e.target.value),disabled:f,form:h,children:[void 0===E?m.jsx("option",{value:""}):null,Array.from(O)]},T):null]})})};Zj.displayName=Hj;var Xj="SelectTrigger",Jj=D.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=Wj(n),i=Gj(Xj,n),s=i.disabled||r,l=oi(t,i.onTriggerChange),u=Vj(n),c=D.useRef("touch"),[d,f,p]=zN(e=>{const t=u().filter(e=>!e.disabled),n=t.find(e=>e.value===i.value),r=$N(t,e,n);void 0!==r&&i.onValueChange(r.value)}),h=e=>{s||(i.onOpenChange(!0),p()),e&&(i.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return m.jsx(nu,{asChild:!0,...a,children:m.jsx(hi.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":FN(i.value)?"":void 0,...o,ref:l,onClick:ti(o.onClick,e=>{e.currentTarget.focus(),"mouse"!==c.current&&h(e)}),onPointerDown:ti(o.onPointerDown,e=>{c.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(h(e),e.preventDefault())}),onKeyDown:ti(o.onKeyDown,e=>{const t=""!==d.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),t&&" "===e.key||zj.includes(e.key)&&(h(),e.preventDefault())})})})});Jj.displayName=Xj;var eN="SelectValue",tN=D.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:i="",...s}=e,l=Gj(eN,n),{onValueNodeHasChildrenChange:u}=l,c=void 0!==a,d=oi(t,l.onValueNodeChange);return si(()=>{u(c)},[u,c]),m.jsx(hi.span,{...s,ref:d,style:{pointerEvents:"none"},children:FN(l.value)?m.jsx(m.Fragment,{children:i}):a})});tN.displayName=eN;var nN=D.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return m.jsx(hi.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});nN.displayName="SelectIcon";var rN=e=>m.jsx(au,{asChild:!0,...e});rN.displayName="SelectPortal";var oN="SelectContent",aN=D.forwardRef((e,t)=>{const n=Gj(oN,e.__scopeSelect),[r,o]=D.useState();if(si(()=>{o(new DocumentFragment)},[]),!n.open){const t=r;return t?sr.createPortal(m.jsx(sN,{scope:e.__scopeSelect,children:m.jsx(Bj.Slot,{scope:e.__scopeSelect,children:m.jsx("div",{children:e.children})})}),t):null}return m.jsx(cN,{...e,ref:t})});aN.displayName=oN;var iN=10,[sN,lN]=qj(oN),uN=ci("SelectContent.RemoveScroll"),cN=D.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:g,avoidCollisions:y,...v}=e,b=Gj(oN,n),[w,x]=D.useState(null),[C,S]=D.useState(null),k=oi(t,e=>x(e)),[_,E]=D.useState(null),[j,N]=D.useState(null),R=Vj(n),[O,P]=D.useState(!1),T=D.useRef(!1);D.useEffect(()=>{if(w)return Tu(w)},[w]),Oi();const M=D.useCallback(e=>{const[t,...n]=R().map(e=>e.ref.current),[r]=n.slice(-1),o=document.activeElement;for(const n of e){if(n===o)return;if(n?.scrollIntoView({block:"nearest"}),n===t&&C&&(C.scrollTop=0),n===r&&C&&(C.scrollTop=C.scrollHeight),n?.focus(),document.activeElement!==o)return}},[R,C]),I=D.useCallback(()=>M([_,w]),[M,_,w]);D.useEffect(()=>{O&&I()},[O,I]);const{onOpenChange:A,triggerPointerDownPosRef:L}=b;D.useEffect(()=>{if(w){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||A(!1),document.removeEventListener("pointermove",t),L.current=null};return null!==L.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[w,A,L]),D.useEffect(()=>{const e=()=>A(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[A]);const[F,z]=zN(e=>{const t=R().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=$N(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),$=D.useCallback((e,t,n)=>{const r=!T.current&&!n;(void 0!==b.value&&b.value===t||r)&&(E(e),r&&(T.current=!0))},[b.value]),H=D.useCallback(()=>w?.focus(),[w]),B=D.useCallback((e,t,n)=>{const r=!T.current&&!n;(void 0!==b.value&&b.value===t||r)&&N(e)},[b.value]),V="popper"===r?fN:dN,U=V===fN?{side:s,sideOffset:l,align:u,alignOffset:c,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:h,hideWhenDetached:g,avoidCollisions:y}:{};return m.jsx(sN,{scope:n,content:w,viewport:C,onViewportChange:S,itemRefCallback:$,selectedItem:_,onItemLeave:H,itemTextRefCallback:B,focusSelectedItem:I,selectedItemText:j,position:r,isPositioned:O,searchRef:F,children:m.jsx(wc,{as:uN,allowPinchZoom:!0,children:m.jsx(Ii,{asChild:!0,trapped:b.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:ti(o,e=>{b.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:m.jsx(_i,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:m.jsx(V,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:e=>e.preventDefault(),...v,...U,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ti(v.onKeyDown,e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||z(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=R().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});cN.displayName="SelectContentImpl";var dN=D.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=Gj(oN,n),i=lN(oN,n),[s,l]=D.useState(null),[u,c]=D.useState(null),d=oi(t,e=>c(e)),f=Vj(n),p=D.useRef(!1),h=D.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=i,w=D.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&u&&g&&y&&v){const e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),o=v.getBoundingClientRect();if("rtl"!==a.dir){const r=o.left-t.left,a=n.left-r,i=e.left-a,l=e.width+i,u=Math.max(l,t.width),c=window.innerWidth-iN,d=Aj(a,[iN,Math.max(iN,c-u)]);s.style.minWidth=l+"px",s.style.left=d+"px"}else{const r=t.right-o.right,a=window.innerWidth-n.right-r,i=window.innerWidth-e.right-a,l=e.width+i,u=Math.max(l,t.width),c=window.innerWidth-iN,d=Aj(a,[iN,Math.max(iN,c-u)]);s.style.minWidth=l+"px",s.style.right=d+"px"}const i=f(),l=window.innerHeight-2*iN,c=g.scrollHeight,d=window.getComputedStyle(u),h=parseInt(d.borderTopWidth,10),m=parseInt(d.paddingTop,10),b=parseInt(d.borderBottomWidth,10),w=h+m+c+parseInt(d.paddingBottom,10)+b,x=Math.min(5*y.offsetHeight,w),C=window.getComputedStyle(g),S=parseInt(C.paddingTop,10),k=parseInt(C.paddingBottom,10),_=e.top+e.height/2-iN,E=l-_,j=y.offsetHeight/2,N=h+m+(y.offsetTop+j),R=w-N;if(N<=_){const e=i.length>0&&y===i[i.length-1].ref.current;s.style.bottom="0px";const t=u.clientHeight-g.offsetTop-g.offsetHeight,n=N+Math.max(E,j+(e?k:0)+t+b);s.style.height=n+"px"}else{const e=i.length>0&&y===i[0].ref.current;s.style.top="0px";const t=Math.max(_,h+g.offsetTop+(e?S:0)+j)+R;s.style.height=t+"px",g.scrollTop=N-_+g.offsetTop}s.style.margin=`${iN}px 0`,s.style.minHeight=x+"px",s.style.maxHeight=l+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,u,g,y,v,a.dir,r]);si(()=>w(),[w]);const[x,C]=D.useState();si(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const S=D.useCallback(e=>{e&&!0===h.current&&(w(),b?.(),h.current=!1)},[w,b]);return m.jsx(pN,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:m.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:x},children:m.jsx(hi.div,{...o,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});dN.displayName="SelectItemAlignedPosition";var fN=D.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=iN,...a}=e,i=Wj(n);return m.jsx(ru,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.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)"}})});fN.displayName="SelectPopperPosition";var[pN,hN]=qj(oN,{}),mN="SelectViewport",gN=D.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=lN(mN,n),i=hN(mN,n),s=oi(t,a.onViewportChange),l=D.useRef(0);return m.jsxs(m.Fragment,{children:[m.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}),m.jsx(Bj.Slot,{scope:n,children:m.jsx(hi.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ti(o.onScroll,e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=i;if(r?.current&&n){const e=Math.abs(l.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*iN,o=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),i=Math.max(o,a);if(i<r){const o=i+e,a=Math.min(r,o),s=o-a;n.style.height=a+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}l.current=t.scrollTop})})})]})});gN.displayName=mN;var yN="SelectGroup",[vN,bN]=qj(yN);D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ui();return m.jsx(vN,{scope:n,id:o,children:m.jsx(hi.div,{role:"group","aria-labelledby":o,...r,ref:t})})}).displayName=yN;var wN="SelectLabel",xN=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=bN(wN,n);return m.jsx(hi.div,{id:o.id,...r,ref:t})});xN.displayName=wN;var CN="SelectItem",[SN,kN]=qj(CN),_N=D.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...i}=e,s=Gj(CN,n),l=lN(CN,n),u=s.value===r,[c,d]=D.useState(a??""),[f,p]=D.useState(!1),h=oi(t,e=>l.itemRefCallback?.(e,r,o)),g=Ui(),y=D.useRef("touch"),v=()=>{o||(s.onValueChange(r),s.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 m.jsx(SN,{scope:n,value:r,disabled:o,textId:g,isSelected:u,onItemTextChange:D.useCallback(e=>{d(t=>t||(e?.textContent??"").trim())},[]),children:m.jsx(Bj.ItemSlot,{scope:n,value:r,disabled:o,textValue:c,children:m.jsx(hi.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":u&&f,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:h,onFocus:ti(i.onFocus,()=>p(!0)),onBlur:ti(i.onBlur,()=>p(!1)),onClick:ti(i.onClick,()=>{"mouse"!==y.current&&v()}),onPointerUp:ti(i.onPointerUp,()=>{"mouse"===y.current&&v()}),onPointerDown:ti(i.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:ti(i.onPointerMove,e=>{y.current=e.pointerType,o?l.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ti(i.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:ti(i.onKeyDown,e=>{""!==l.searchRef?.current&&" "===e.key||($j.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});_N.displayName=CN;var EN="SelectItemText",jN=D.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,i=Gj(EN,n),s=lN(EN,n),l=kN(EN,n),u=Qj(EN,n),[c,d]=D.useState(null),f=oi(t,e=>d(e),l.onItemTextChange,e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),p=c?.textContent,h=D.useMemo(()=>m.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=u;return si(()=>(g(h),()=>y(h)),[g,y,h]),m.jsxs(m.Fragment,{children:[m.jsx(hi.span,{id:l.textId,...a,ref:f}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?sr.createPortal(a.children,i.valueNode):null]})});jN.displayName=EN;var NN="SelectItemIndicator",RN=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return kN(NN,n).isSelected?m.jsx(hi.span,{"aria-hidden":!0,...r,ref:t}):null});RN.displayName=NN;var ON="SelectScrollUpButton",PN=D.forwardRef((e,t)=>{const n=lN(ON,e.__scopeSelect),r=hN(ON,e.__scopeSelect),[o,a]=D.useState(!1),i=oi(t,r.onScrollButtonChange);return si(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollTop>0;a(e)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?m.jsx(MN,{...e,ref:i,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});PN.displayName=ON;var TN="SelectScrollDownButton",DN=D.forwardRef((e,t)=>{const n=lN(TN,e.__scopeSelect),r=hN(TN,e.__scopeSelect),[o,a]=D.useState(!1),i=oi(t,r.onScrollButtonChange);return si(()=>{if(n.viewport&&n.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)};const t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),o?m.jsx(MN,{...e,ref:i,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});DN.displayName=TN;var MN=D.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=lN("SelectScrollButton",n),i=D.useRef(null),s=Vj(n),l=D.useCallback(()=>{null!==i.current&&(window.clearInterval(i.current),i.current=null)},[]);return D.useEffect(()=>()=>l(),[l]),si(()=>{const e=s().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[s]),m.jsx(hi.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ti(o.onPointerDown,()=>{null===i.current&&(i.current=window.setInterval(r,50))}),onPointerMove:ti(o.onPointerMove,()=>{a.onItemLeave?.(),null===i.current&&(i.current=window.setInterval(r,50))}),onPointerLeave:ti(o.onPointerLeave,()=>{l()})})}),IN=D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return m.jsx(hi.div,{"aria-hidden":!0,...r,ref:t})});IN.displayName="SelectSeparator";var AN="SelectArrow";D.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Wj(n),a=Gj(AN,n),i=lN(AN,n);return a.open&&"popper"===i.position?m.jsx(ou,{...o,...r,ref:t}):null}).displayName=AN;var LN=D.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=D.useRef(null),a=oi(r,o),i=Lj(t);return D.useEffect(()=>{const e=o.current;if(!e)return;const n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,"value").set;if(i!==t&&r){const n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[i,t]),m.jsx(hi.select,{...n,style:{...Fj,...n.style},ref:a,defaultValue:t})});function FN(e){return""===e||void 0===e}function zN(e){const t=bi(e),n=D.useRef(""),r=D.useRef(0),o=D.useCallback(e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(o)},[t]),a=D.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function $N(e,t,n){const r=t.length>1&&Array.from(t).every(e=>e===t[0]),o=r?t[0]:t,a=n?e.indexOf(n):-1;let i=(s=e,l=Math.max(a,0),s.map((e,t)=>s[(l+t)%s.length]));var s,l;1===o.length&&(i=i.filter(e=>e!==n));const u=i.find(e=>e.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}LN.displayName="SelectBubbleInput";var HN=Jj,BN=nN,VN=rN,UN=aN,qN=gN,WN=xN,YN=_N,GN=jN,KN=RN,QN=PN,ZN=DN,XN=IN;const JN=Zj,eR=tN,tR=D.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(HN,{ref:r,className:Ya("flex h-10 w-full items-center hover:border-[#BFD7FE] justify-between rounded-md border focus:border-primary border-neutral-200 bg-white px-3 py-2 text-sm ring-offset-white placeholder:text-neutral-500 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 ",e),...n,children:[t,m.jsx(BN,{asChild:!0,children:m.jsx(jf,{className:"h-4 w-4 opacity-50"})})]}));tR.displayName=HN.displayName;const nR=D.forwardRef(({className:e,...t},n)=>m.jsx(QN,{ref:n,className:Ya("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(Rf,{className:"h-4 w-4"})}));nR.displayName=QN.displayName;const rR=D.forwardRef(({className:e,...t},n)=>m.jsx(ZN,{ref:n,className:Ya("flex cursor-default items-center justify-center py-1",e),...t,children:m.jsx(jf,{className:"h-4 w-4"})}));rR.displayName=ZN.displayName;const oR=D.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>{const{portalRef:a}=Pr();return m.jsx(VN,{container:a.current,children:m.jsxs(UN,{ref:o,className:Ya("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white text-neutral-950 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 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50","popper"===n&&"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,...r,children:[m.jsx(nR,{}),m.jsx(qN,{className:Ya("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),m.jsx(rR,{})]})})});oR.displayName=UN.displayName;D.forwardRef(({className:e,...t},n)=>m.jsx(WN,{ref:n,className:Ya("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=WN.displayName;const aR=D.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(YN,{ref:r,className:Ya("relative flex w-full select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-primary/20 cursor-pointer focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50",e),...n,children:[m.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:m.jsx(KN,{children:m.jsx(Ef,{className:"h-4 w-4"})})}),m.jsx(GN,{children:t})]}));aR.displayName=YN.displayName;function iR({label:e,addonLabel:t,type:n,placeholder:r,selectPlaceholder:o,error:a,success:i,value:s,defaultValue:l,name:u,id:c,formik:d,onChange:f,inputRef:p,onBlur:h,required:g,disabled:y,loading:v,showError:b,selectOptions:w,disableSearch:x,searchSelectPlaceholder:C,showSelectSearch:S,onSelectValueChange:k,selectValue:_,showOutline:E=!0,cols:j,rows:N,labelClass:R,addonLabelClass:O,optional:P,info:T,addonInfo:M,icon:I,actionIcon:A,actionLabel:L,actionLabelInfo:F,actionLabelAction:z,className:$,textAreaOnChange:H,addOn:B,infoAlignment:V,addonInfoAlignment:U,inputContainerClass:q,showNegative:W,showPositive:Y,...G}){const[K,Q]=D.useState(n),[Z,X]=D.useState(!1),[J,ee]=D.useState(""),te=((e,t)=>{const n=e?.filter(e=>"string"==typeof e.label?e.label?.toLowerCase().includes(t.toLowerCase()):e.value?.toLowerCase().includes(t.toLowerCase())||e?.searchId?.toLowerCase().includes(t.toLowerCase()));return t?n:e})(w??[],J);return m.jsx(m.Fragment,{children:v?m.jsx(ei,{className:"w-full h-12"}):m.jsx("div",{className:"w-full",children:m.jsxs("div",{className:`flex flex-col ${e&&"gap-2.5"} relative `,children:[m.jsxs("div",{className:"flex justify-between gap-2 flex-wrap",children:[t&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",O),children:[t," ",g?m.jsx("span",{className:"text-[#E12D39]",children:t&&"*"}):P?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,M&&m.jsx(kb,{fieldName:t,align:U,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:M})})]}),e&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",R),children:[e," ",g?m.jsx("span",{className:"text-[#E12D39]",children:e&&"*"}):P?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,T&&m.jsx(kb,{fieldName:e,align:V,children:m.jsx("p",{className:"font-normal first-letter:uppercase w-full whitespace-pre-wrap",children:T})})]}),L&&m.jsxs("button",{onClick:z,className:"text-primary flex items-center gap-1 first-letter:uppercase text-sm font-bold",children:[A,L,F&&m.jsx(kb,{fieldName:e,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:F})})]})]}),m.jsxs("div",{className:Ya(`border overflow-hidden rounded-md text-sm border-[#E1E3EA] hover:border-primary_light font-normal text-grey-950 flex gap-2 items-center bg-white px-3 ${"text-area"!==n&&"h-12"} ${(a||b)&&"!border-danger"} ${i&&"!border-success"} ${Z&&E&&"!border-primary"}\n ${I&&"px-2"}\n ${B&&"px-0"}\n `,y?"cursor-not-allowed bg-gray-200":null,w?"px-0":null,q),children:[B&&m.jsx("span",{className:"bg-gray-200 text-[13px] font-semibold text-gray-700 h-full min-w-[38px] flex items-center justify-center shrink-0 rounded-l-md px-2 ",children:B}),I,w&&m.jsxs(JN,{onValueChange:k,defaultValue:_,value:_,children:[m.jsx(tR,{disabled:x,className:" min-w-max w-max h-full border-0 border-r rounded-none hover:border-neutral-200 focus:border-neutral-200 bg-[#F9F9F9] hover:border-b-neutral-200 disabled:opacity-100 ",children:m.jsx(eR,{className:" text-sm text-[#5E6278] placeholder:font-medium outline-none",placeholder:o})}),m.jsxs(oR,{className:"bg-white w-full relative",children:[S&&m.jsx("input",{value:J,onChange:e=>{ee(e.target.value.toString())},placeholder:C??"Search...",className:"h-10 border mb-2 text-sm px-4 outline-none w-full border-neutral-200 rounded bg-white sticky top-0 z-20"}),te?.map((e,t)=>m.jsx(aR,{className:"text-sm",value:e.value,children:e.label},e.value))]})]}),"text-area"===n?m.jsx("textarea",{cols:j,rows:N,onFocus:()=>X(!0),onBlur:e=>{X(!1)},placeholder:r,className:Ya(`placeholder:text-[#7E8299] hover:border-primary_light py-2 h-full placeholder:font-medium outline-none w-full rounded ${y?"bg-[#EEEFF2] cursor-not-allowed":null} ${Z&&E&&"!border-primary"} transition-all ease-in-out`,$),...G,value:s,name:u,onChange:H}):m.jsx("input",{onInput:e=>{const t=e.target;"number"===n&&(t.value=t.value.replace(/[^0-9.]/g,""),t.value=t.value.replace(/^\.|(\..*)\./g,"$1"),t.value.length>1&&t.value.startsWith("0")&&"."!==t.value[1]&&(t.value=t.value.replace(/^0+/,"")),""!==t.value&&"0"!==t.value||(t.value="0"))},type:"number"===K?"text":K,placeholder:r,className:Ya("placeholder:text-[#7E8299] h-full placeholder:font-medium outline-none w-full rounded disabled:cursor-not-allowed",w&&"number"===n?"pr-2":null,I||B?"pr-0":null,w&&"number"===n&&t&&"text-right pr-2",$,Y&&"0"!==s?.toString().trim()?"text-green-600 font-semibold":"",W&&s?.toString().trim().startsWith("-")?"text-red-600 font-semibold":""),onFocus:()=>X(!0),onBlur:e=>{d&&h&&d&&h(e),X(!1)},value:s||"",defaultValue:l,onChange:f,id:c,name:u,required:g,disabled:y,ref:p,...G}),"password"===n&&m.jsx("span",{className:"cursor-pointer",onClick:()=>{Q(e=>"password"===e?"text":"password")},children:"password"===K?Kv.eyeslash:Kv.eye})]}),a&&m.jsx("p",{className:"text-danger text-xs font-normal",children:a})]})})})}function sR({value:e,label:t,placeholder:n,uuid:r,name:o,displayValue:a,valueType:i,item_unit:s}){const{mutate:l,isPending:u}=Gx();J();const[c,d]=D.useState(!1),[f,p]=D.useState({item_uuid:r,[o]:e});tr();const[h,g]=D.useState("");return m.jsxs(Ak,{open:c,onOpenChange:d,children:[m.jsx(Lk,{className:"flex items-center",children:m.jsx("button",{className:"hover:text-primary duration-150 underline disabled:no-underline disabled:hover:text-inherit",children:h?"selling_price"===o?Jv(+h):eb(+h)+s:a})}),m.jsxs(Fk,{align:"center",className:"shadow-[0_1px_2px_0px_#E4E5E73D,_0_12px_24px_0_#868C981F] space-y-2 bg-white rounded-xl p-3 w-[280px] relative before:absolute before:w-3 before:h-1.5 before:bg-white before:left-1/2 before:-translate-x-1/2 before:rotate-45 data-[side=bottom]:before:top-0 data-[side=top]:before:bottom-0",children:[m.jsx(iR,{type:i,value:f[o],label:t,placeholder:n,onChange:e=>{p(t=>({...t,[o]:e.target.value}))}}),m.jsxs("div",{className:"flex justify-end gap-2.5",children:[m.jsx(Tk,{children:m.jsx(Mj,{label:"Dismiss",className:"bg-gray-300 text-dark text-sm hover:bg-gray-300/90 font-medium",disabled:u})}),m.jsx(Mj,{label:"Update",className:"text-sm font-medium",onClick:()=>{l({url:"/items/update_basic",payload:f},{onSuccess:()=>{g(f[o]),d(!1)},onError:()=>{g("")}})},loading:u})]})]})]})}D.forwardRef(({className:e,...t},n)=>m.jsx(XN,{ref:n,className:Ya("-mx-1 my-1 h-px bg-neutral-100 dark:bg-neutral-800",e),...t})).displayName=XN.displayName;var lR="Tabs",[uR]=ai(lR,[mu]),cR=mu(),[dR,fR]=uR(lR),pR=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:i="horizontal",dir:s,activationMode:l="automatic",...u}=e,c=vi(s),[d,f]=ui({prop:r,onChange:o,defaultProp:a??"",caller:lR});return m.jsx(dR,{scope:n,baseId:Ui(),value:d,onValueChange:f,orientation:i,dir:c,activationMode:l,children:m.jsx(hi.div,{dir:c,"data-orientation":i,...u,ref:t})})});pR.displayName=lR;var hR="TabsList",mR=D.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,a=fR(hR,n),i=cR(n);return m.jsx(ku,{asChild:!0,...i,orientation:a.orientation,dir:a.dir,loop:r,children:m.jsx(hi.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});mR.displayName=hR;var gR="TabsTrigger",yR=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=e,i=fR(gR,n),s=cR(n),l=wR(i.baseId,r),u=xR(i.baseId,r),c=r===i.value;return m.jsx(_u,{asChild:!0,...s,focusable:!o,active:c,children:m.jsx(hi.button,{type:"button",role:"tab","aria-selected":c,"aria-controls":u,"data-state":c?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...a,ref:t,onMouseDown:ti(e.onMouseDown,e=>{o||0!==e.button||!1!==e.ctrlKey?e.preventDefault():i.onValueChange(r)}),onKeyDown:ti(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&i.onValueChange(r)}),onFocus:ti(e.onFocus,()=>{const e="manual"!==i.activationMode;c||o||!e||i.onValueChange(r)})})})});yR.displayName=gR;var vR="TabsContent",bR=D.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...i}=e,s=fR(vR,n),l=wR(s.baseId,r),u=xR(s.baseId,r),c=r===s.value,d=D.useRef(c);return D.useEffect(()=>{const e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),m.jsx(iu,{present:o||c,children:({present:n})=>m.jsx(hi.div,{"data-state":c?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!n,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:n&&a})})});function wR(e,t){return`${e}-trigger-${t}`}function xR(e,t){return`${e}-content-${t}`}bR.displayName=vR;var CR=mR,SR=yR,kR=bR;const _R=pR,ER=D.forwardRef(({className:e,...t},n)=>m.jsx(CR,{ref:n,className:Ya("inline-flex h-10 items-center justify-center rounded-md bg-neutral-100 p-1 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400",e),...t}));ER.displayName=CR.displayName;const jR=D.forwardRef(({className:e,...t},n)=>m.jsx(SR,{ref:n,className:Ya("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-neutral-950 data-[state=active]:shadow-sm dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300 dark:data-[state=active]:bg-neutral-950 dark:data-[state=active]:text-neutral-50",e),...t}));jR.displayName=SR.displayName;const NR=D.forwardRef(({className:e,...t},n)=>m.jsx(kR,{ref:n,className:Ya("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-offset-2 dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300",e),...t}));NR.displayName=kR.displayName;var RR,OR={};function PR(){if(RR)return OR;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}RR=1,Object.defineProperty(OR,"__esModule",{value:!0}),OR.Collapse=void 0;var t,n=(t=f())&&t.__esModule?t:{default:t};function r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function a(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,o=s(t);if(n){var a=s(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return i(t)}(this,r)}}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(s,e);var t=a(s);function s(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),l(i(n=t.call(this,e)),"timeout",void 0),l(i(n),"container",void 0),l(i(n),"content",void 0),l(i(n),"onResize",function(){if(clearTimeout(n.timeout),n.container&&n.content){var e=n.props,t=e.isOpened,r=e.checkTimeout,o=Math.floor(n.container.clientHeight),a=Math.floor(n.content.clientHeight),i=t&&Math.abs(a-o)<=1,s=!t&&Math.abs(o)<=1;i||s?n.onRest({isFullyOpened:i,isFullyClosed:s,isOpened:t,containerHeight:o,contentHeight:a}):(n.onWork({isFullyOpened:i,isFullyClosed:s,isOpened:t,containerHeight:o,contentHeight:a}),n.timeout=setTimeout(function(){return n.onResize()},r))}}),l(i(n),"onRest",function(e){var t=e.isFullyOpened,r=e.isFullyClosed,o=e.isOpened,a=e.containerHeight,i=e.contentHeight;if(n.container&&n.content){var s=o&&n.container.style.height==="".concat(i,"px"),l=!o&&"0px"===n.container.style.height;if(s||l){n.container.style.overflow=o?"initial":"hidden",n.container.style.height=o?"auto":"0px";var u=n.props.onRest;u&&u({isFullyOpened:t,isFullyClosed:r,isOpened:o,containerHeight:a,contentHeight:i})}}}),l(i(n),"onWork",function(e){var t=e.isFullyOpened,r=e.isFullyClosed,o=e.isOpened,a=e.containerHeight,i=e.contentHeight;if(n.container&&n.content){var s=o&&n.container.style.height==="".concat(i,"px"),l=!o&&"0px"===n.container.style.height;if(!s&&!l){n.container.style.overflow="hidden",n.container.style.height=o?"".concat(i,"px"):"0px";var u=n.props.onWork;u&&u({isFullyOpened:t,isFullyClosed:r,isOpened:o,containerHeight:a,contentHeight:i})}}}),l(i(n),"onRefContainer",function(e){n.container=e}),l(i(n),"onRefContent",function(e){n.content=e}),e.initialStyle?n.initialStyle=e.initialStyle:n.initialStyle=e.isOpened?{height:"auto",overflow:"initial"}:{height:"0px",overflow:"hidden"},n}return r(s,[{key:"componentDidMount",value:function(){this.onResize()}},{key:"shouldComponentUpdate",value:function(e){var t=this.props,n=t.theme,r=t.isOpened;return t.children!==e.children||r!==e.isOpened||Object.keys(n).some(function(t){return n[t]!==e.theme[t]})}},{key:"getSnapshotBeforeUpdate",value:function(){if(!this.container||!this.content)return null;if("auto"===this.container.style.height){var e=this.content.clientHeight;this.container.style.height="".concat(e,"px")}return null}},{key:"componentDidUpdate",value:function(){this.onResize()}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.theme,r=e.children,o=e.isOpened;return n.default.createElement("div",{ref:this.onRefContainer,className:t.collapse,style:this.initialStyle,"aria-hidden":!o},n.default.createElement("div",{ref:this.onRefContent,className:t.content},r))}}]),s}(n.default.Component);return OR.Collapse=u,l(u,"defaultProps",{theme:{collapse:"ReactCollapse--collapse",content:"ReactCollapse--content"},initialStyle:void 0,onRest:void 0,onWork:void 0,checkTimeout:50}),OR}var TR,DR,MR,IR={};function AR(){if(TR)return IR;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}TR=1,Object.defineProperty(IR,"__esModule",{value:!0}),IR.UnmountClosed=void 0;var t,n=(t=f())&&t.__esModule?t:{default:t},r=PR(),o=["isOpened"],a=["isOpened"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function c(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function p(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,o=m(t);if(n){var a=m(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}(this,r)}}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(s,e);var t=p(s);function s(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),g(h(n=t.call(this,e)),"onWork",function(e){var t=e.isOpened,r=u(e,o);n.setState({isResting:!1,isOpened:t});var a=n.props.onWork;a&&a(l({isOpened:t},r))}),g(h(n),"onRest",function(e){var t=e.isOpened,r=u(e,a);n.setState({isResting:!0,isOpened:t,isInitialRender:!1});var o=n.props.onRest;o&&o(l({isOpened:t},r))}),g(h(n),"getInitialStyle",function(){var e=n.state,t=e.isOpened;return e.isInitialRender&&t?{height:"auto",overflow:"initial"}:{height:"0px",overflow:"hidden"}}),n.state={isResting:!0,isOpened:e.isOpened,isInitialRender:!0},n}return c(s,[{key:"componentDidUpdate",value:function(e){var t=this.props.isOpened;e.isOpened!==t&&this.setState({isResting:!1,isOpened:t,isInitialRender:!1})}},{key:"render",value:function(){var e=this.state,t=e.isResting,o=e.isOpened;return t&&!o?null:n.default.createElement(r.Collapse,i({},this.props,{initialStyle:this.getInitialStyle(),onWork:this.onWork,onRest:this.onRest}))}}]),s}(n.default.PureComponent);return IR.UnmountClosed=y,g(y,"defaultProps",{onWork:void 0,onRest:void 0}),IR}var LR=function(){if(MR)return DR;MR=1;var e=PR().Collapse,t=AR().UnmountClosed;return DR=t,t.Collapse=e,t.UnmountClosed=t,DR}(),FR="Switch",[zR]=ai(FR),[$R,HR]=zR(FR),BR=D.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l="on",onCheckedChange:u,form:c,...d}=e,[f,p]=D.useState(null),h=oi(t,e=>p(e)),g=D.useRef(!1),y=!f||(c||!!f.closest("form")),[v,b]=ui({prop:o,defaultProp:a??!1,onChange:u,caller:FR});return m.jsxs($R,{scope:n,checked:v,disabled:s,children:[m.jsx(hi.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":WR(v),"data-disabled":s?"":void 0,disabled:s,value:l,...d,ref:h,onClick:ti(e.onClick,e=>{b(e=>!e),y&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),y&&m.jsx(qR,{control:f,bubbles:!g.current,name:r,value:l,checked:v,required:i,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});BR.displayName=FR;var VR="SwitchThumb",UR=D.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=HR(VR,n);return m.jsx(hi.span,{"data-state":WR(o.checked),"data-disabled":o.disabled?"":void 0,...r,ref:t})});UR.displayName=VR;var qR=D.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...o},a)=>{const i=D.useRef(null),s=oi(i,a),l=Lj(n),u=Al(t);return D.useEffect(()=>{const e=i.current;if(!e)return;const t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==n&&o){const t=new Event("click",{bubbles:r});o.call(e,n),e.dispatchEvent(t)}},[l,n,r]),m.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:s,style:{...o.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function WR(e){return e?"checked":"unchecked"}qR.displayName="SwitchBubbleInput";var YR=BR,GR=UR;const KR=D.forwardRef(({className:e,loading:t,...n},r)=>m.jsx(m.Fragment,{children:t?m.jsx(ei,{className:"w-11 h-6"}):m.jsx(YR,{className:Ya("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-950 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-neutral-200 dark:focus-visible:ring-neutral-300 dark:focus-visible:ring-offset-neutral-950 dark:data-[state=checked]:bg-neutral-50 dark:data-[state=unchecked]:bg-neutral-800",e),...n,ref:r,children:m.jsx(GR,{className:Ya("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-neutral-950")})})}));function QR({children:e,sessionName:t,info:n,className:r,defaultOpen:o=!1}){const[a,i]=D.useState(o);return D.useEffect(()=>{i(o)},[o]),m.jsxs("div",{className:Ya("flex flex-col duration-300 ",a?"gap-5":"gap-0"),children:[m.jsxs("div",{className:"flex gap-2.5 items-center",children:[m.jsxs("h1",{className:Ya("text-dark font-medium text-sm flex gap-1 items-center first-letter:uppercase",r),children:[t,m.jsx(kb,{fieldName:t,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:n})})]}),m.jsx(KR,{checked:a,onClick:()=>i(!a)})]}),m.jsx(LR.Collapse,{isOpened:a,className:"pt-5",children:e})]})}function ZR(){const e=J(),{itemStoreData:t,editMode:n,fetchingItem:r,canBeDeletedFields:o}=ne(e=>e.items),[a,i]=D.useState(t.barcode??[""]);M.useEffect(()=>{n&&i(o?.barcode?.map(e=>e.barcode)??[])},[r]);const[s,l]=D.useState([]);D.useEffect(()=>{n&&e(Wt({field:"deletedBarcode",value:s}))},[s]);return D.useEffect(()=>{(1!==a.length||""!==a[0])&&e(Wt({field:"barcode",value:a}))},[a]),m.jsx(QR,{sessionName:"Barcode & SKU",info:"Enter the unique barcode or SKU (Stock Keeping Unit) for this item. This helps in tracking inventory, facilitating faster checkouts, and managing stock more efficiently.",defaultOpen:n&&a.length>=0&&""!==a[0]||n&&""!==t.sku,children:m.jsxs("div",{className:" grid grid-cols-2 gap-5",children:[m.jsxs("div",{className:"space-y-4",children:[a.map((e,t)=>m.jsxs("div",{className:"flex items-end gap-2.5",children:[m.jsx(iR,{type:"text",label:"Barcode",info:"Scan or manually enter the item's barcode. This allows for quick identification and tracking of the item during sales and inventory management.",placeholder:"Type barcode",value:e,onChange:e=>((e,t)=>{const n=[...a];n[e]=t,i(n)})(t,e.target.value)}),m.jsx("button",{className:" py-3",onClick:()=>(e=>{const t=a.filter((t,n)=>e!==n),n=a.filter((t,n)=>e===n),r=o?.barcode?.filter(e=>n.includes(e.barcode))||[];i(t),l([...s,...r.map(e=>e.id)])})(t),children:Kv.trash2})]},t)),m.jsx(Mj,{mode:"text",label:"Add another barcode",left_addon:Kv.plus_squared2,onClick:()=>{i(e=>[...e,""])},className:"font-medium text-sm"})]}),m.jsx(iR,{type:"text",label:"SKU",info:"Enter the unique Stock Keeping Unit (SKU) for this item. This code helps in identifying and tracking the item within your inventory system.",value:t.sku,placeholder:"Add SKU",onChange:t=>e(Wt({field:"sku",value:t.target.value}))})]})})}function XR(e,t){return e===t}function JR(e,t,n){var r=XR,o=D.useRef(e),a=D.useState({})[1],i=function(e,t,n,r){var o=this,a=D.useRef(null),i=D.useRef(0),s=D.useRef(0),l=D.useRef(null),u=D.useRef([]),c=D.useRef(),d=D.useRef(),f=D.useRef(e),p=D.useRef(!0),h=D.useRef(),m=D.useRef();f.current=e;var g="undefined"!=typeof window,y=!t&&0!==t&&g;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,b=!("trailing"in n)||!!n.trailing,w=!!n.flushOnExit&&b,x="maxWait"in n,C="debounceOnServer"in n&&!!n.debounceOnServer,S=x?Math.max(+n.maxWait||0,t):null,k=D.useMemo(function(){var e=function(e){var t=u.current,n=c.current;return u.current=c.current=null,i.current=e,s.current=s.current||e,d.current=f.current.apply(n,t)},n=function(e,t){y&&cancelAnimationFrame(l.current),l.current=y?requestAnimationFrame(e):setTimeout(e,t)},k=function(e){if(!p.current)return!1;var n=e-a.current;return!a.current||n>=t||n<0||x&&e-i.current>=S},_=function(t){return l.current=null,b&&u.current?e(t):(u.current=c.current=null,d.current)},E=function e(){var r=Date.now();if(v&&s.current===i.current&&j(),k(r))return _(r);if(p.current){var o=t-(r-a.current),l=x?Math.min(o,S-(r-i.current)):o;n(e,l)}},j=function(){r&&r({})},N=function(){if(g||C){var r,s=Date.now(),f=k(s);if(u.current=[].slice.call(arguments),c.current=o,a.current=s,w&&!h.current&&(h.current=function(){var e;"hidden"===(null==(e=global.document)?void 0:e.visibilityState)&&m.current.flush()},null==(r=global.document)||null==r.addEventListener||r.addEventListener("visibilitychange",h.current)),f){if(!l.current&&p.current)return i.current=a.current,n(E,t),v?e(a.current):d.current;if(x)return n(E,t),e(a.current)}return l.current||n(E,t),d.current}};return N.cancel=function(){var e=l.current;e&&(y?cancelAnimationFrame(l.current):clearTimeout(l.current)),i.current=0,u.current=a.current=c.current=l.current=null,e&&r&&r({})},N.isPending=function(){return!!l.current},N.flush=function(){return l.current?_(Date.now()):d.current},N},[v,x,t,S,b,w,y,g,C,r]);return m.current=k,D.useEffect(function(){return p.current=!0,function(){var e;w&&m.current.flush(),h.current&&(null==(e=global.document)||null==e.removeEventListener||e.removeEventListener("visibilitychange",h.current),h.current=null),p.current=!1}},[w]),k}(D.useCallback(function(e){o.current=e,a({})},[a]),t,n,a),s=D.useRef(e);return r(s.current,e)||(i(e),s.current=e),[o.current,i]}function eO({handleInputChange:e}){const t=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t})`,"gi");return e.split(n).map((e,n)=>e.toLowerCase()===t.toLowerCase()?m.jsx("span",{className:"text-orange",children:e},n):e)},{itemStoreData:n,editMode:r,fetchingItem:o}=ne(e=>e.items),[a,i]=D.useState(""),[s]=JR(a,1e3),[l,u]=D.useState(!1),[c,d]=D.useState(!1),f=D.useRef(null),{data:p,isFetching:h}=Yx(["search_item_names",s],`/inventory/item/search/business/${a}`,{enabled:s.length>=2}),g=h,y=p?.data.data,v=e=>{f.current&&!f.current.contains(e.target)&&u(!1)};return D.useEffect(()=>(document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}),[]),m.jsxs("div",{className:"relative",ref:f,children:[m.jsx(iR,{type:"text",required:!0,placeholder:"e.g cocacola",info:"Enter the name of the item as it will appear in inventory, sales, and reports. Make it clear and recognizable.",label:"Item name",labelClass:"text-dark font-bold",name:"name",value:n.name,onChange:t=>{e("name",t.target.value),i(t.target.value),u(!0)},loading:o,onFocus:()=>u(!0)}),l&&a.length>=2&&m.jsx("div",{className:"absolute left-0 right-0 shadow-2xl p-5 rounded-md bg-white flex flex-col gap-2 overflow-auto max-h-[calc(100vh-200px)] z-20",children:g?[1,2,3].map((e,t)=>m.jsxs("div",{className:"flex justify-between border-b py-3 px-2",children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(ei,{className:"w-11 h-11 rounded-2xl"}),m.jsxs("div",{className:"space-y-1 max-w-[265px]",children:[m.jsx(ei,{className:"w-[250px] h-5 rounded-md"}),m.jsx(ei,{className:"w-[200px] h-5 rounded-md"})]})]}),m.jsxs("div",{className:"gap-1 flex flex-col items-end",children:[m.jsx(ei,{className:"w-[100px] h-5 rounded-md "}),m.jsx(ei,{className:"w-[150px] h-5 rounded-md"})]})]},t)):y?.length>0?y.map((n,r)=>m.jsxs("div",{className:"border-b py-3 flex justify-between gap-5 cursor-pointer hover:bg-gray-50 px-2 rounded-md duration-150 ",onClick:()=>{e("name",n.name),u(!1)},children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx("div",{className:"w-11 h-11 rounded-2xl relative bg-gray-100 shrink-0",children:m.jsx("img",{src:n.images[0]?.image??"/assets/images/placeholder-image.svg",alt:"item image",className:"rounded-2xl object-cover w-full h-full",draggable:!1})}),m.jsxs("div",{className:"space-y-1 max-w-[265px]",children:[m.jsx("h1",{className:"text-dark text-sm font-semibold",children:t(n.name,a)}),m.jsxs("p",{className:"text-dark text-xs font-normal flex items-center gap-1",children:[m.jsx("span",{children:n.category[0]?.name})," |"," ",m.jsxs("span",{className:"text-primary",children:[n.quantity,n.item_unit]})]})]})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"text-right text-primary font-semibold text-sm",children:Jv(parseFloat(n.selling_price))}),m.jsx("p",{className:"text-success text-sm",children:n.itemcode})]})]},r)):m.jsx("p",{className:"text-dark text-center h-24 ",children:" No results found."})})]})}KR.displayName=YR.displayName;var tO="ScrollArea",[nO]=ai(tO),[rO,oO]=nO(tO),aO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:a=600,...i}=e,[s,l]=D.useState(null),[u,c]=D.useState(null),[d,f]=D.useState(null),[p,h]=D.useState(null),[g,y]=D.useState(null),[v,b]=D.useState(0),[w,x]=D.useState(0),[C,S]=D.useState(!1),[k,_]=D.useState(!1),E=oi(t,e=>l(e)),j=vi(o);return m.jsx(rO,{scope:n,type:r,dir:j,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:c,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:h,scrollbarXEnabled:C,onScrollbarXEnabledChange:S,scrollbarY:g,onScrollbarYChange:y,scrollbarYEnabled:k,onScrollbarYEnabledChange:_,onCornerWidthChange:b,onCornerHeightChange:x,children:m.jsx(hi.div,{dir:j,...i,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":v+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});aO.displayName=tO;var iO="ScrollAreaViewport",sO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...a}=e,i=oO(iO,n),s=oi(t,D.useRef(null),i.onViewportChange);return m.jsxs(m.Fragment,{children:[m.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),m.jsx(hi.div,{"data-radix-scroll-area-viewport":"",...a,ref:s,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:m.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});sO.displayName=iO;var lO="ScrollAreaScrollbar",uO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oO(lO,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=o,s="horizontal"===e.orientation;return D.useEffect(()=>(s?a(!0):i(!0),()=>{s?a(!1):i(!1)}),[s,a,i]),"hover"===o.type?m.jsx(cO,{...r,ref:t,forceMount:n}):"scroll"===o.type?m.jsx(dO,{...r,ref:t,forceMount:n}):"auto"===o.type?m.jsx(fO,{...r,ref:t,forceMount:n}):"always"===o.type?m.jsx(pO,{...r,ref:t}):null});uO.displayName=lO;var cO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oO(lO,e.__scopeScrollArea),[a,i]=D.useState(!1);return D.useEffect(()=>{const e=o.scrollArea;let t=0;if(e){const n=()=>{window.clearTimeout(t),i(!0)},r=()=>{t=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return e.addEventListener("pointerenter",n),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",n),e.removeEventListener("pointerleave",r)}}},[o.scrollArea,o.scrollHideDelay]),m.jsx(iu,{present:n||a,children:m.jsx(fO,{"data-state":a?"visible":"hidden",...r,ref:t})})}),dO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=oO(lO,e.__scopeScrollArea),a="horizontal"===e.orientation,i=TO(()=>l("SCROLL_END"),100),[s,l]=function(e,t){return D.useReducer((e,n)=>t[e][n]??e,e)}("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return D.useEffect(()=>{if("idle"===s){const e=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,o.scrollHideDelay,l]),D.useEffect(()=>{const e=o.viewport,t=a?"scrollLeft":"scrollTop";if(e){let n=e[t];const r=()=>{const r=e[t];n!==r&&(l("SCROLL"),i()),n=r};return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}},[o.viewport,a,l,i]),m.jsx(iu,{present:n||"hidden"!==s,children:m.jsx(pO,{"data-state":"hidden"===s?"hidden":"visible",...r,ref:t,onPointerEnter:ti(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ti(e.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),fO=D.forwardRef((e,t)=>{const n=oO(lO,e.__scopeScrollArea),{forceMount:r,...o}=e,[a,i]=D.useState(!1),s="horizontal"===e.orientation,l=TO(()=>{if(n.viewport){const e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;i(s?e:t)}},10);return DO(n.viewport,l),DO(n.content,l),m.jsx(iu,{present:r||a,children:m.jsx(pO,{"data-state":a?"visible":"hidden",...o,ref:t})})}),pO=D.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=oO(lO,e.__scopeScrollArea),a=D.useRef(null),i=D.useRef(0),[s,l]=D.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=EO(s.viewport,s.content),c={...r,sizes:s,onSizesChange:l,hasThumb:Boolean(u>0&&u<1),onThumbChange:e=>a.current=e,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:e=>i.current=e};function d(e,t){return function(e,t,n,r="ltr"){const o=jO(n),a=o/2,i=t||a,s=o-i,l=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-s,c=n.content-n.viewport,d="ltr"===r?[0,c]:[-1*c,0];return RO([l,u],d)(e)}(e,i.current,s,t)}return"horizontal"===n?m.jsx(hO,{...c,ref:t,onThumbPositionChange:()=>{if(o.viewport&&a.current){const e=NO(o.viewport.scrollLeft,s,o.dir);a.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollLeft=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollLeft=d(e,o.dir))}}):"vertical"===n?m.jsx(mO,{...c,ref:t,onThumbPositionChange:()=>{if(o.viewport&&a.current){const e=NO(o.viewport.scrollTop,s);a.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{o.viewport&&(o.viewport.scrollTop=e)},onDragScroll:e=>{o.viewport&&(o.viewport.scrollTop=d(e))}}):null}),hO=D.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,a=oO(lO,e.__scopeScrollArea),[i,s]=D.useState(),l=D.useRef(null),u=oi(t,l,a.onScrollbarXChange);return D.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),m.jsx(vO,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:"rtl"===a.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===a.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":jO(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){const r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),OO(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:_O(i.paddingLeft),paddingEnd:_O(i.paddingRight)}})}})}),mO=D.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,a=oO(lO,e.__scopeScrollArea),[i,s]=D.useState(),l=D.useRef(null),u=oi(t,l,a.onScrollbarYChange);return D.useEffect(()=>{l.current&&s(getComputedStyle(l.current))},[l]),m.jsx(vO,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":jO(n)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){const r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),OO(r,n)&&t.preventDefault()}},onResize:()=>{l.current&&a.viewport&&i&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:_O(i.paddingTop),paddingEnd:_O(i.paddingBottom)}})}})}),[gO,yO]=nO(lO),vO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:c,onResize:d,...f}=e,p=oO(lO,n),[h,g]=D.useState(null),y=oi(t,e=>g(e)),v=D.useRef(null),b=D.useRef(""),w=p.viewport,x=r.content-r.viewport,C=bi(c),S=bi(l),k=TO(d,10);function _(e){if(v.current){const t=e.clientX-v.current.left,n=e.clientY-v.current.top;u({x:t,y:n})}}return D.useEffect(()=>{const e=e=>{const t=e.target,n=h?.contains(t);n&&C(e,x)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[w,h,x,C]),D.useEffect(S,[r,S]),DO(h,k),DO(p.content,k),m.jsx(gO,{scope:n,scrollbar:h,hasThumb:o,onThumbChange:bi(a),onThumbPointerUp:bi(i),onThumbPositionChange:S,onThumbPointerDown:bi(s),children:m.jsx(hi.div,{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:ti(e.onPointerDown,e=>{if(0===e.button){e.target.setPointerCapture(e.pointerId),v.current=h.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),_(e)}}),onPointerMove:ti(e.onPointerMove,_),onPointerUp:ti(e.onPointerUp,e=>{const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,p.viewport&&(p.viewport.style.scrollBehavior=""),v.current=null})})})}),bO="ScrollAreaThumb",wO=D.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yO(bO,e.__scopeScrollArea);return m.jsx(iu,{present:n||o.hasThumb,children:m.jsx(xO,{ref:t,...r})})}),xO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,a=oO(bO,n),i=yO(bO,n),{onThumbPositionChange:s}=i,l=oi(t,e=>i.onThumbChange(e)),u=D.useRef(void 0),c=TO(()=>{u.current&&(u.current(),u.current=void 0)},100);return D.useEffect(()=>{const e=a.viewport;if(e){const t=()=>{if(c(),!u.current){const t=PO(e,s);u.current=t,s()}};return s(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[a.viewport,c,s]),m.jsx(hi.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ti(e.onPointerDownCapture,e=>{const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;i.onThumbPointerDown({x:n,y:r})}),onPointerUp:ti(e.onPointerUp,i.onThumbPointerUp)})});wO.displayName=bO;var CO="ScrollAreaCorner",SO=D.forwardRef((e,t)=>{const n=oO(CO,e.__scopeScrollArea),r=Boolean(n.scrollbarX&&n.scrollbarY);return"scroll"!==n.type&&r?m.jsx(kO,{...e,ref:t}):null});SO.displayName=CO;var kO=D.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=oO(CO,n),[a,i]=D.useState(0),[s,l]=D.useState(0),u=Boolean(a&&s);return DO(o.scrollbarX,()=>{const e=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(e),l(e)}),DO(o.scrollbarY,()=>{const e=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(e),i(e)}),u?m.jsx(hi.div,{...r,ref:t,style:{width:a,height:s,position:"absolute",right:"ltr"===o.dir?0:void 0,left:"rtl"===o.dir?0:void 0,bottom:0,...e.style}}):null});function _O(e){return e?parseInt(e,10):0}function EO(e,t){const n=e/t;return isNaN(n)?0:n}function jO(e){const t=EO(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function NO(e,t,n="ltr"){const r=jO(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-o,i=t.content-t.viewport,s=a-r,l=Aj(e,"ltr"===n?[0,i]:[-1*i,0]);return RO([0,i],[0,s])(l)}function RO(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function OO(e,t){return e>0&&e<t}var PO=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const a={left:e.scrollLeft,top:e.scrollTop},i=n.left!==a.left,s=n.top!==a.top;(i||s)&&t(),n=a,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function TO(e,t){const n=bi(e),r=D.useRef(0);return D.useEffect(()=>()=>window.clearTimeout(r.current),[]),D.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function DO(e,t){const n=bi(t);si(()=>{let t=0;if(e){const r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var MO=aO,IO=sO,AO=SO;const LO=D.forwardRef(({className:e,children:t,...n},r)=>m.jsxs(MO,{ref:r,className:Ya("relative overflow-hidden",e),...n,children:[m.jsx(IO,{className:"h-full w-full rounded-[inherit]",children:t}),m.jsx(FO,{}),m.jsx(AO,{})]}));LO.displayName=MO.displayName;const FO=D.forwardRef(({className:e,orientation:t="vertical",...n},r)=>m.jsx(uO,{ref:r,orientation:t,className:Ya("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:m.jsx(wO,{className:"relative flex-1 rounded-full bg-neutral-200 dark:bg-neutral-800"})}));FO.displayName=uO.displayName;var zO="Checkbox",[$O]=ai(zO),[HO,BO]=$O(zO);function VO(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:o,disabled:a,form:i,name:s,onCheckedChange:l,required:u,value:c="on",internal_do_not_use_render:d}=e,[f,p]=ui({prop:n,defaultProp:o??!1,onChange:l,caller:zO}),[h,g]=D.useState(null),[y,v]=D.useState(null),b=D.useRef(!1),w=!h||(!!i||!!h.closest("form")),x={checked:f,disabled:a,setChecked:p,control:h,setControl:g,name:s,form:i,value:c,hasConsumerStoppedPropagationRef:b,required:u,defaultChecked:!XO(o)&&o,isFormControl:w,bubbleInput:y,setBubbleInput:v};return m.jsx(HO,{scope:t,...x,children:ZO(d)?d(x):r})}var UO="CheckboxTrigger",qO=D.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},o)=>{const{control:a,value:i,disabled:s,checked:l,required:u,setControl:c,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:h}=BO(UO,e),g=oi(o,c),y=D.useRef(l);return D.useEffect(()=>{const e=a?.form;if(e){const t=()=>d(y.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[a,d]),m.jsx(hi.button,{type:"button",role:"checkbox","aria-checked":XO(l)?"mixed":l,"aria-required":u,"data-state":JO(l),"data-disabled":s?"":void 0,disabled:s,value:i,...r,ref:g,onKeyDown:ti(t,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:ti(n,e=>{d(e=>!!XO(e)||!e),h&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});qO.displayName=UO;var WO=D.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:i,disabled:s,value:l,onCheckedChange:u,form:c,...d}=e;return m.jsx(VO,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:s,required:i,onCheckedChange:u,name:r,form:c,value:l,internal_do_not_use_render:({isFormControl:e})=>m.jsxs(m.Fragment,{children:[m.jsx(qO,{...d,ref:t,__scopeCheckbox:n}),e&&m.jsx(QO,{__scopeCheckbox:n})]})})});WO.displayName=zO;var YO="CheckboxIndicator",GO=D.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,a=BO(YO,n);return m.jsx(iu,{present:r||XO(a.checked)||!0===a.checked,children:m.jsx(hi.span,{"data-state":JO(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});GO.displayName=YO;var KO="CheckboxBubbleInput",QO=D.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:i,required:s,disabled:l,name:u,value:c,form:d,bubbleInput:f,setBubbleInput:p}=BO(KO,e),h=oi(n,p),g=Lj(a),y=Al(r);D.useEffect(()=>{const e=f;if(!e)return;const t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set,r=!o.current;if(g!==a&&n){const t=new Event("click",{bubbles:r});e.indeterminate=XO(a),n.call(e,!XO(a)&&a),e.dispatchEvent(t)}},[f,g,a,o]);const v=D.useRef(!XO(a)&&a);return m.jsx(hi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??v.current,required:s,disabled:l,name:u,value:c,form:d,...t,tabIndex:-1,ref:h,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function ZO(e){return"function"==typeof e}function XO(e){return"indeterminate"===e}function JO(e){return XO(e)?"indeterminate":e?"checked":"unchecked"}QO.displayName=KO;const eP=D.forwardRef(({className:e,...t},n)=>m.jsx(WO,{ref:n,className:Ya("peer h-5 w-5 shrink-0 border border-[#7E8299] ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary rounded-[7px] data-[state=checked]:text-neutral-50 dark:border-neutral-50 dark:ring-offset-neutral-950 dark:focus-visible:ring-neutral-300 dark:data-[state=checked]:bg-neutral-50 data-[state=checked]:border-primary dark:data-[state=checked]:text-neutral-900 bg-white",e),...t,children:m.jsx(GO,{className:Ya("flex items-center justify-center text-current"),children:m.jsx(Ef,{className:"h-4 w-4"})})}));eP.displayName=WO.displayName;const tP=({returnSelectedManagers:e,label:t,labelClass:n,info:r,infoAlignment:o,required:a,optional:i,values:s,loading:l})=>{const[u,c]=D.useState(!1),[d,f]=D.useState({}),[p,h]=D.useState("");D.useEffect(()=>{if(s&&s.length>0){const e=s.reduce((e,t)=>(e[t.manager_uuid]=Number(t.quantity),e),{});f(e)}},[s?.length]);const{apiKey:g}=Pr(),{data:y,isLoading:v}=Yx(["item-managers",g],"/manager/get_unpaginated",{enabled:!!g}),b=y?.data?.data||[],w=D.useMemo(()=>{if(!p)return b;const e=p.toLowerCase();return b.filter(t=>(t.name||"").toLowerCase().includes(e))},[b,p]);D.useEffect(()=>{if(e){const t=Object.entries(d).map(([e,t])=>({manager_uuid:e,quantity:t}));e(t)}},[d]);const x=Object.keys(d).length;return m.jsx(m.Fragment,{children:l?m.jsx(ei,{className:"w-full h-[48px]"}):m.jsxs("div",{className:"w-full flex flex-col gap-2.5",children:[t&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",n),children:[m.jsx("span",{className:"first-letter:inherit",children:t})," ",a?m.jsx("span",{className:"text-[#E12D39]",children:t&&"*"}):i?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,r&&m.jsx(kb,{fieldName:t,align:o,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:r})})]}),m.jsxs(Ak,{modal:!0,open:u,onOpenChange:c,children:[m.jsx(Lk,{asChild:!0,children:m.jsxs($k,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between h-12 bg-white border-neutral-200 text-neutral-700 hover:bg-neutral-50",children:[x>0?`${x} Manager${1===x?"":"s"} Selected`:"Select Managers",m.jsx(Of,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Fk,{align:"end",className:"w-[450px] p-0 bg-white",side:"bottom",children:m.jsxs(ik,{shouldFilter:!1,children:[m.jsx(sk,{placeholder:"Search managers...",value:p,onValueChange:h}),m.jsxs(lk,{children:[m.jsx(uk,{children:"No manager found."}),m.jsx(ck,{children:v?m.jsx("div",{className:"flex flex-col gap-2 p-2",children:[1,2,3].map(e=>m.jsx(ei,{className:"h-10 w-full"},e))}):m.jsx(LO,{className:"h-72",children:w?.map(e=>{const t=(e=>e.uuid||"")(e),n=(e=>e.name||"Unknown Manager")(e),r=!!d[t],o=d[t]||0;return m.jsxs(dk,{value:t+n,onSelect:()=>{var e;(e=t)&&f(t=>{const n={...t};return n[e]?delete n[e]:n[e]=1,n})},className:Ya("flex items-center gap-3 p-2 cursor-pointer transition-colors aria-selected:bg-neutral-100",r&&"bg-blue-50 aria-selected:bg-blue-100"),children:[m.jsx("div",{className:"pointer-events-none flex items-center justify-center",children:m.jsx(eP,{checked:r,className:Ya(r?"bg-primary border-primary":"border-neutral-300")})}),m.jsx("div",{className:"flex-1 truncate font-medium text-neutral-700",children:n}),m.jsxs("div",{className:"flex items-center gap-2",onClick:e=>e.stopPropagation(),children:[m.jsx("span",{className:"text-xs text-neutral-400 font-medium",children:"Qty"}),m.jsx("input",{type:"number",min:"0",className:"w-20 h-8 rounded border border-neutral-300 px-2 text-sm focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary",placeholder:"0",value:r?o:"",disabled:!r,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),onChange:e=>{const n=parseFloat(e.target.value);((e,t)=>{e&&f(n=>({...n,[e]:t}))})(t,isNaN(n)?0:n)}})]})]},t)})})})]})]})})]})]})})};function nP({placeholder:e,searchPlaceholder:t,options:n=[],showMultiSelectValues:r=!0,values:o,onChange:a,className:i,showCheckMark:s=!0,label:l,labelClass:u,required:c,info:d,optional:f,actionLabel:p,actionLabelAction:h,actionLabelInfo:g,removeSelectedValue:y,removeTag:v,loading:b,showCount:w,error:x}){const[C,S]=D.useState(!1),[k,_]=D.useState(0),E=D.useRef(null);D.useEffect(()=>{const e=()=>{E.current&&_(E?.current?.offsetWidth)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[E]);const j=e=>{const t=o?.includes(e)?o?.filter(t=>t!==e):[...o||[],e];a&&a(t)};D.useEffect(()=>{y&&j(y)},[y]);const[N,R]=D.useState(null),O=e=>{R(t=>t===e?null:e)},P=e=>{for(let t of n){if(t.value===e)return t.label;if(t.subOptions){const n=t.subOptions.find(t=>t.value===e);if(n)return n.label}}return null};return m.jsx("div",{ref:E,children:b?m.jsx(ei,{className:"w-full h-[48px]"}):m.jsxs("div",{className:Ya("flex flex-col gap-2.5",i),children:[m.jsxs("div",{className:"flex justify-between gap-2 flex-wrap",children:[l&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",u),children:[l," ",c?m.jsx("span",{className:"text-[#E12D39]",children:l&&"*"}):f?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,d&&m.jsx(kb,{fieldName:l,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:d})})]}),p&&m.jsxs("button",{onClick:h,className:"text-primary flex items-center gap-1 first-letter:uppercase text-sm font-medium",children:[p,g&&m.jsx(kb,{fieldName:l,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:g})})]})]}),m.jsxs(Ak,{modal:!0,open:C,onOpenChange:S,children:[m.jsx(Lk,{asChild:!0,children:m.jsxs($k,{variant:"outline",role:"combobox","aria-expanded":C,className:Ya(`w-full h-[48px] justify-between border focus:border-primary border-neutral-200 bg-white hover:bg-white hover:border-[#BFD7FE] ${x&&"!border-danger"}`,r?"h-auto py-3":null,i),children:[m.jsx("div",{className:"flex gap-2 text-[#5E6278] justify-start first-letter:uppercase flex-wrap",children:o?.length&&r?o.map((e,t)=>m.jsxs("div",{onClick:()=>{v||j(e),O(e)},className:"px-2 py-1 text-black flex items-center justify-between rounded gap-2 border bg-slate-200 text-xs font-medium",children:[m.jsx("span",{className:"flex justify-start text-start flex-wrap gap-2 whitespace-normal",children:P(e)}),m.jsx("span",{className:"",children:m.jsx("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.44001 4.49978L7.83334 2.12644C7.96064 1.99737 8.03146 1.82301 8.03021 1.64173C8.02896 1.46044 7.95575 1.28708 7.82667 1.15978C7.6976 1.03247 7.52324 0.961657 7.34196 0.962907C7.16067 0.964157 6.98731 1.03737 6.86001 1.16644L4.50001 3.55978L2.14001 1.21311C2.0151 1.08894 1.84613 1.01925 1.67001 1.01925C1.49388 1.01925 1.32492 1.08894 1.20001 1.21311C1.13752 1.27509 1.08793 1.34882 1.05408 1.43006C1.02023 1.5113 1.00281 1.59844 1.00281 1.68644C1.00281 1.77445 1.02023 1.86159 1.05408 1.94283C1.08793 2.02407 1.13752 2.0978 1.20001 2.15978L3.56001 4.49978L1.16667 6.87311C1.03937 7.00218 0.968554 7.17654 0.969804 7.35782C0.971054 7.53911 1.04427 7.71247 1.17334 7.83978C1.30241 7.96708 1.47677 8.0379 1.65805 8.03665C1.83934 8.0354 2.0127 7.96218 2.14001 7.83311L4.50001 5.43978L6.86001 7.78644C6.98492 7.91061 7.15388 7.98031 7.33001 7.98031C7.50613 7.98031 7.6751 7.91061 7.80001 7.78644C7.86249 7.72447 7.91209 7.65073 7.94594 7.56949C7.97978 7.48826 7.99721 7.40112 7.99721 7.31311C7.99721 7.2251 7.97978 7.13797 7.94594 7.05673C7.91209 6.97549 7.86249 6.90175 7.80001 6.83978L5.44001 4.49978Z",fill:"black"})})})]},t)):!r&&w&&o.length>0?`${o.length} ${l} selected`:e??"Select..."}),m.jsx(Of,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Fk,{align:"start",style:{width:k},className:"w-[480px] p-0 bg-white rounded-xl border-gray-200",children:m.jsxs(ik,{children:[m.jsx(sk,{className:"placeholder:text-xs",placeholder:t??"Search..."}),m.jsx(uk,{children:"No result found."}),m.jsx(ck,{children:m.jsx(lk,{className:"",children:n?.map((e,t)=>m.jsxs("div",{children:[m.jsxs(dk,{value:"string"==typeof e.label?e.label:e.searchId,className:`first-letter:uppercase mb-1 focus:bg-primary_light w-full rounded-md focus:text-primary hover:text-primary font-semibold text-gray-700 text-sm cursor-pointer ${o?.includes(e.value)&&"bg-primary_light text-primary"}`,onSelect:()=>{j(e.value),e?.subOptions&&e?.subOptions?.length>0&&O(e.value)},children:[s&&m.jsx(Ef,{className:Ya("mr-2 h-4 w-4",o?.includes(e.value)?"opacity-100":"opacity-0")}),m.jsxs("p",{className:"flex justify-between w-full",children:[e.label,e?.subOptions&&e?.subOptions?.length>0&&m.jsx(jf,{className:"ml-2 h-5 w-5 font-bold shrink-0 opacity-50"})]})]}),N===e.value&&e?.subOptions&&e?.subOptions?.map((e,t)=>m.jsxs(dk,{value:"string"==typeof e.label?e.label:e.searchId,className:`first-letter:uppercase mb-1 focus:bg-primary_light w-full rounded-md focus:text-primary hover:text-primary font-semibold text-gray-700 text-sm cursor-pointer pl-6 ${o?.includes(e.value)&&"bg-primary_light text-primary"}`,onSelect:()=>{j(e.value)},children:[s&&m.jsx(Ef,{className:Ya("mr-2 h-4 w-4",o?.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},t))]},t))})})]})})]}),x&&m.jsx("p",{className:"text-danger text-xs font-normal",children:x})]})})}function rP({handleInputChange:e,setFileKey:t}){const{apiKey:n}=Pr(),{itemStoreData:r,editMode:o,fetchingItem:a}=ne(e=>e.items),[i,s]=D.useState([]),[l,u]=D.useState(!1),[c,d]=D.useState(!1),{data:f}=Yx(["categories",n],"/inventory_metas/categories",{enabled:!!n}),{data:p}=Yx(["itemunits",n],"/inventory_metas/units",{enabled:!!n}),h=f?.data?.data?.map(e=>({label:e.name,value:e.uuid,subOptions:e.subCategories.map(e=>({label:e.name,value:e.uuid}))}))||[],g=p?.data?.data?.map(e=>({label:e.name,value:e.uuid}))||[];D.useEffect(()=>{const t=r.itemunit_id||g.find(e=>"pieces"===e.label.toLowerCase())?.value;e("itemunit_id",t)},[p,r]);const y=M.useRef(!1);return M.useRef({set:!1,data:void 0}),m.jsxs("div",{className:"grid grid-cols-2 gap-x-[30px] gap-y-6",children:[m.jsx(eO,{handleInputChange:e}),m.jsx(iR,{type:"number",placeholder:"0.00",info:"Enter the cost price of a single unit of the item. This helps in calculating profit margins and inventory valuation.",label:`Unit cost price (${tb()})`,name:"cost_price",value:r.cost_price,labelClass:"text-dark font-bold first-letter:uppercase",onChange:t=>{y.current=!0,e("cost_price",t.target.value)},loading:a}),m.jsx("div",{className:"space-y-2.5",children:m.jsx(iR,{type:"number",selectOptions:g,onSelectValueChange:t=>e("itemunit_id",t),selectValue:r.itemunit_id||g.find(e=>"pieces"===e.label.toLowerCase())?.value,showSelectSearch:!0,placeholder:"0.00",addonInfo:"Select the measurement unit for this item (e.g., pieces, kg, liters). This ensures accurate stock tracking and transactions.",label:"Quantity",name:"item_quantity",value:r.item_quantity,onChange:t=>e("item_quantity",t.target.value),selectPlaceholder:"Item unit",labelClass:"text-dark font-bold first-letter:uppercase",addonLabel:"Item unit ",addonLabelClass:"text-dark font-bold first-letter:uppercase",info:"Enter the number of units available in stock for this item. This helps in managing inventory levels and ensuring you have enough stock to fulfill orders.",loading:a})}),m.jsx(iR,{type:"number",placeholder:"0.00",info:"Enter the selling price of a single unit of the item. This is the price at which the item will be sold to customers.",label:`Unit selling price (${tb()})`,name:"selling_price",value:r.selling_price,onChange:t=>e("selling_price",t.target.value),labelClass:"text-dark font-bold first-letter:uppercase",loading:a,required:!0}),m.jsx(iR,{type:"number",placeholder:"0.00",info:"Set the minimum stock quantity for this item. When the quantity drops below this level, you'll be alerted to reorder to prevent stockouts.",label:"Reorder level ",labelClass:"text-dark font-bold first-letter:uppercase",name:"reorder_level",value:r.reorder_level,onChange:t=>e("reorder_level",t.target.value),loading:a}),m.jsx(tP,{label:"Item Managers",labelClass:"text-dark font-bold first-letter:uppercase",info:"Select the managers for this item. This helps in managing inventory levels and ensuring you have enough stock to fulfill orders.",returnSelectedManagers:t=>{e("managers",t),console.log("returned managers",t)},values:r.managers,loading:a}),o&&m.jsx(nP,{label:"Category",info:"Select the category that best describes this item (e.g., electronics, clothing, food). Categorizing items helps in organizing inventory and simplifies product management.",options:h,placeholder:"Select category",labelClass:"text-dark font-bold text-sm",showSearch:!0,values:r.itemcategory_id,onChange:t=>e("itemcategory_id",t),loading:a})]})}function oP({itemTypeUUID:e,handleInputChange:t,setFileKey:n}){const r=J(),[o,a]=D.useState(!0),{itemStoreData:i,editMode:s}=ne(e=>e.items);return M.useEffect(()=>{r(Wt({field:"itemtype_id",value:e})),!s&&r(Yt())},[e]),m.jsxs("div",{className:"space-y-4",children:[s?null:m.jsxs("div",{className:Ya("bg-primary_light rounded-md px-4 py-3.5 flex justify-between items-center gap-[60px]",o?null:"hidden"),children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("span",{className:"shrink-0",children:Kv.info}),m.jsxs("div",{className:Ya("flex-grow space-y-1"),children:[m.jsx("h1",{className:"text-gray-800 font-semibold text-[15px]",children:"About product items"}),m.jsxs("p",{className:"text-[13px] text-gray-600",children:["Product items are tangible goods that can be quantified and are available in units. They can also have variations, such as different sizes, colors, or weights, ensuring flexible and comprehensive inventory management."," ",m.jsx("a",{href:"#",className:"text-primary",children:"Learn more"})]})]})]}),m.jsx("button",{onClick:()=>a(!1),children:Kv.close})]}),m.jsx(rP,{handleInputChange:t,setFileKey:n}),m.jsx(fS,{}),m.jsx(ZR,{})]})}function aP({handleInputChange:e,item_type_id:t,setFileKey:n}){const{apiKey:r}=Pr(),{editMode:o}=ne(e=>e.items),{data:a}=Yx(["itemtypes",r],"/inventory_metas/types",{enabled:!!r}),i=a?.data?.data||[],s=[{label:"Simple Product",value:"simple product",uuid:(e=>{const t=i?.filter(t=>t?.name?.match(e));let n="";return t?.map(e=>n=e.uuid),n})("products")}],[l,u]=D.useState(o?t:s[0].uuid);return D.useEffect(()=>{u(o?t:s[0].uuid)},[i]),0===i?.length?null:m.jsx(KC,{className:"flex-grow px-4 pt-0",children:i?.length>0&&l?m.jsxs(_R,{defaultValue:l,className:"space-y-4",children:[m.jsxs("div",{className:Ya("flex items-center gap-7 border-b py-4 sticky top-16 bg-white z-10",o?"-top-8 pointer-events-none":null,i?.length>0?null:"pointer-events-none"),children:[m.jsx("h1",{className:"text-gray-900 font-medium text-sm shrink-0",children:"Item type"}),m.jsx(ER,{className:"flex bg-transparent flex-grow justify-start p-0 gap-[30px] overflow-auto h-auto",children:s.map((e,t)=>m.jsxs(jR,{className:"data-[state=active]:bg-transparent text-gray-700 data-[state=active]:text-gray-900 data-[state=active]:shadow-none capitalize data-[state=active]:font-bold font-medium hover:text-gray-900 p-0 flex items-center gap-2 cursor-pointer",value:e.uuid,children:[m.jsx("div",{className:Ya("flex items-center justify-center rounded-full h-[26px] w-[26px] bg-gray-300 shrink-0 indicator"),children:m.jsx("span",{className:"bg-white w-3 h-3 rounded-full indicator--child"})}),e.label]},t))})]}),m.jsx(NR,{value:s[0].uuid,children:m.jsx(oP,{itemTypeUUID:s[0]?.uuid,handleInputChange:e,setFileKey:n})})]}):m.jsx("div",{children:m.jsx(ei,{className:"rounded-md w-full h-[500px] mt-8"})})})}function iP({isOpen:e,onClose:t,itemUUID:n,itemTypeUUID:r}){const o=tr(),a=J(),{itemStoreData:i}=ne(e=>e.items),{mutate:s,isPending:l}=Gx({enableToast:!0},!0),{mutate:u,isPending:c}=Gx(),{data:d,isFetching:f}=Yx(["single_item",n],`/items/get?item_uuid=${n}`,{enabled:e}),p=d?.data,h=p?.kits.map(e=>({item_uuid:e.kit_item.uuid,quantity:Number(e.quantity)})),g=p?.variation.map(e=>{const t=e.variation_values.map(e=>e.attribute_value.uuid),n=e.locationprices.filter(e=>!e.price_group.name.match("Retail"));return{attribute_value_id:t,selling_price:e.locationprices[0].selling_price,quantity:e.quantity,sku:e.sku,prices:n.map(e=>({price_uuid:e.price_group.uuid,price_amt:e.selling_price})),image:e.image,id:e.uuid}}),y=p?.item_group.map(e=>({group_name:e.group_name,group_quantity:e.quantity,group_selling_price:e.selling_price,group_barcode:e.barcode,group_image:null,group_uuid:e.group_uuid,prices:e.locationprices.filter((e,t)=>t>0).map(e=>({price_uuid:e.price_group.uuid,price_amt:e.selling_price}))})),v=p?.extras.map(e=>({item_uuid:e.extra?.uuid,quantity:e.quantity,selling_price:e.selling_price})),b=p?.material?.map(e=>({item_uuid:e.raw_material?.uuid,quantity:e.quantity,selling_price:e.selling_price})),w=p?.suppliers.map(e=>({supplier_id:e.uuid,supplier_price:e.supplier_price,supplier_batch_number:e.supplier_batch_number,supplier_quantity:e.supplier_quantity,supplier_expired_date:e.supplier_expired_date})),x={name:p?.name,item_uuid:n,itemtype_id:p?.item_type?.uuid,selling_price:p?.selling_price,cost_price:p?.cost_price,item_quantity:p?.quantity,reorder_level:p?.reorder_level,itemunit_id:p?.unit_resource?.uuid,available_in_cart:!0,description:p?.description,itemcategory_id:p?.category?.map(e=>e.uuid),barcode:p?.barcode?.map(e=>e.barcode),itembrand_id:p?.item_brand,returnable_days:p?.returnable_days||"",images:[],group:y,taxes:p?.item_tax?.uuid,sku:p?.sku,is_draft:!1,kit:h,item_tags:p?.item_tags.map(e=>e.uuid),suppliers:w,variations:g,has_extras:v,discount:p?.discount||"",discount_type:p?.discount_type?.toString()||"1",price_man:p?.duplicate_prices?.map(e=>"Retail"===e.priceGroup.name?{}:{price_uuid:e.priceGroup.uuid,selling_price:e.selling_price.toString()}),raw_materials:b,managers:p?.managers?.map(e=>({manager_uuid:e.manager.uuid,quantity:e.quantity}))},C={prices:p?.prices,barcode:p?.barcode,extras:p?.extras,materials:p?.material,suppliers:p?.suppliers,images:p?.images,item_group:p?.item_group,variations:p?.variation},[S,k]=D.useState([]);M.useEffect(()=>{a(Qt(f))},[f]);return M.useEffect(()=>(a(Gt(e)),p&&a(Kt(x)),p&&a(Zt(C)),!e&&a(Yt()),()=>{a(Gt(!1)),a(Yt())}),[e,p]),m.jsxs(GC,{isOpen:e,onClose:t,title:"Item Edit",className:"w-[1176px] pb-0",children:[m.jsx(aP,{handleInputChange:(e,t)=>{a(Wt({field:e,value:t}))},item_type_id:r,setFileKey:k}),m.jsxs("div",{className:"flex justify-between border-t py-5 bg-white sticky bottom-0",children:[m.jsx(Mj,{label:"Cancel",className:"h-12 bg-gray-400 text-gray-900 font-bold hover:bg-gray-400/90 w-[162px]",onClick:t,disabled:l||c}),m.jsxs("div",{className:"flex gap-2.5",children:[m.jsx(Mj,{label:"Revert to draft",className:"h-12 bg-gray-400 text-gray-900 font-bold hover:bg-gray-400/90 px-8",onClick:()=>{u({url:"/items/update",payload:{...i,is_draft:!0,images:S.map(e=>({...e.file&&{image:e.file},...e.id&&{id:e.id},featured:e.featured}))}},{onSuccess:()=>{a(Yt()),o.invalidateQueries({queryKey:["items"]}),o.invalidateQueries({queryKey:["single_item",n]}),t&&t()}})},loading:c,disabled:!p?.status}),m.jsx(Mj,{label:"Update Item",className:"h-12 w-[162px]",onClick:()=>{s({url:"/items/update",payload:{...i,is_draft:!1,images:S.map(e=>({...e.file&&{image:e.file},...e.id&&{id:e.id},featured:e.featured}))}},{onSuccess:()=>{a(Yt()),o.invalidateQueries({queryKey:["items"]}),o.invalidateQueries({queryKey:["single_item",n]}),t&&t()}})},loading:l})]})]})]})}const sP=[{accessorKey:"item_description",header:()=>m.jsxs("p",{children:[" ","Item description/ ",m.jsx("br",{})," Product code"," "]}),cell:({row:e})=>{const t=e.original;return m.jsxs("div",{className:"flex items-center gap-5",children:[m.jsx("div",{className:"w-[50px] h-[50px] rounded-2xl relative bg-gray-100",children:m.jsx("img",{src:t.item_image,alt:"item image",className:"rounded-2xl object-cover w-full h-full",draggable:!1})}),m.jsxs("div",{className:"space-y-1 max-w-[265px]",children:[m.jsx(uP,{title:t.item_description,item_uuid:t.uuid,item_type_id:t.item_type_id,data:t.fullData}),m.jsxs("p",{className:"text-dark text-xs font-normal flex items-center gap-1",children:[m.jsx("span",{className:"uppercase whitespace-nowrap",children:t.itemcode}),t.sku||t.barcode.length>0?m.jsx(kb,{align:"center",fieldName:"All item codes",trigger:m.jsxs("button",{className:"rounded bg-primary_light px-[5px] flex items-center text-primary font-semibold text-[11px] h-[18px]",children:["+",(t.barcode?.length||0)+(t.sku?1:0)]}),children:m.jsxs("div",{className:"space-y-2",children:[t.sku?m.jsxs("div",{className:"",children:[m.jsx("p",{children:" SKU:"}),m.jsx("ul",{className:"list-disc pl-4",children:m.jsx("li",{children:t.sku})})]}):null,t.barcode.length>0?m.jsxs("div",{children:[m.jsx("p",{children:"Barcodes:"}),m.jsx("ul",{className:"list-disc pl-4 ",children:t.barcode.map((e,t)=>m.jsx("li",{children:e.barcode},t))})]}):null,m.jsxs("div",{className:"",children:[m.jsx("p",{children:" Itemcode:"}),m.jsx("ul",{className:"list-disc pl-4",children:m.jsx("li",{children:t.itemcode})})]})]})}):null,t.expired?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"|"}),"Expired",m.jsx("span",{className:"rounded bg-danger_light px-[5px] flex items-center text-danger font-semibold text-[11px] h-[18px]",children:t.expired})]}):null,t.expiring?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"|"}),"Expiring",m.jsx("span",{className:"rounded bg-warning-light px-[5px] flex items-center text-warning font-semibold text-[11px] h-[18px]",children:t.expiring})]}):null]})]})]})}},{accessorKey:"quantity",header:()=>m.jsx("p",{children:"quantity"}),cell:({row:e})=>{const t=e.original;return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:Ya("flex items-center",t.quantity<=0?"text-danger":Number(t.reorder_level)==t.quantity?"text-orange":null),children:m.jsx(sR,{label:"Edit item quantity",placeholder:"Enter quantity",uuid:t.uuid,name:"item_quantity",displayValue:eb(t.quantity)+t.unit,value:t.quantity,valueType:"number",item_unit:t.unit})}),t.all_quantity===t.quantity?null:m.jsx("p",{className:"text-gray-700",children:Intl.NumberFormat().format(t.all_quantity??0)+t.unit})]})}},{accessorKey:"type",cell:({row:e})=>{const t=e.original;return m.jsx("p",{className:"capitalize",children:t.type})}},{accessorKey:"selling_price",header:`Selling Price (${tb()})`,cell:({row:e})=>{const t=e.original;return m.jsx(sR,{label:`Edit selling price (${tb()})`,placeholder:"Enter selling price",uuid:t.uuid,name:"selling_price",displayValue:Jv(t.selling_price??0),value:t.selling_price??0,valueType:"number"})}},{accessorKey:"categories",header:"categories/Tags",cell:({row:e})=>{const t=e.original;return m.jsxs(m.Fragment,{children:[" ",m.jsxs("div",{className:"flex items-center gap-2 capitalize",children:[t.categories&&t.categories?.length>0?t.categories?.[0]?.name:"...",t.categories.length>1?m.jsx(kb,{align:"center",fieldName:"Categories",trigger:m.jsxs("button",{className:"rounded bg-primary_light px-[5px] flex items-center text-primary font-semibold text-[11px] h-[18px]",children:["+",t.categories.length-1]}),children:m.jsx("ul",{className:"list-disc pl-4",children:t.categories.map((e,t)=>m.jsx("li",{children:e.name},t))})}):null]}),m.jsxs("div",{className:"text-gray-700 flex items-center gap-2 capitalize",children:[t.tags?.[0],t.tags?.length>1?m.jsx(kb,{align:"center",fieldName:"Tags",trigger:m.jsxs("button",{className:"rounded bg-primary_light px-[5px] flex items-center text-primary font-semibold text-[11px] h-[18px] border-primary",children:["+",t.tags.length-1]}),children:m.jsx("ul",{className:"list-disc pl-4",children:t.tags.map((e,t)=>m.jsx("li",{children:e},t))})}):null]})]})}},{accessorKey:"status",cell:({row:e})=>{const t=e.getValue("status");return m.jsx(_b,{status:t})}},{id:"actions",header:"actions",cell:({row:e})=>{const t=e.original;return m.jsx(lP,{item_uuid:t.uuid,item_type_id:t.item_type_id,data:t.fullData})}}],lP=({item_uuid:e,item_type_id:t,data:n})=>{const[r,o]=D.useState(null),a=()=>{o(null)},[i,s]=D.useState(!1),[l,u]=D.useState(!1),[c,d]=D.useState(!1),[f,p]=D.useState(!1),[h,g]=D.useState(!1),[y,v]=D.useState(!1),[b,w]=D.useState(!1),x=[{label:"view",icon:Kv.eye_outline,action:()=>s(!0)},{label:"edit",icon:Kv.notepad_edit,action:()=>u(!0)},{label:"delete",icon:Kv.trash,action:()=>p(!0)}];return m.jsxs(m.Fragment,{children:[m.jsxs(Mf,{children:[m.jsx(If,{asChild:!0,children:m.jsxs("button",{className:"bg-gray-100 rounded-md h-[30px] w-[90px] flex items-center justify-between p-2.5 font-semibold text-[10px] text-gray-500 hover:border duration-200",children:["Action"," ",m.jsx("svg",{width:"11",height:"6",viewBox:"0 0 11 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.50855 5.49304C5.42081 5.49355 5.33383 5.47673 5.25261 5.44356C5.17138 5.41038 5.09751 5.3615 5.03521 5.29971L1.03521 1.29971C0.972726 1.23773 0.92313 1.164 0.889284 1.08276C0.855438 1.00152 0.838013 0.914383 0.838013 0.826375C0.838013 0.738367 0.855438 0.65123 0.889284 0.56999C0.92313 0.488751 0.972726 0.415017 1.03521 0.353041C1.16012 0.228874 1.32909 0.15918 1.50521 0.15918C1.68134 0.15918 1.8503 0.228874 1.97521 0.353041L5.50855 3.88637L9.03521 0.353041C9.16012 0.228874 9.32909 0.15918 9.50521 0.15918C9.68134 0.15918 9.8503 0.228874 9.97521 0.353041C10.0377 0.415017 10.0873 0.488751 10.1211 0.56999C10.155 0.65123 10.1724 0.738367 10.1724 0.826375C10.1724 0.914383 10.155 1.00152 10.1211 1.08276C10.0873 1.164 10.0377 1.23773 9.97521 1.29971L5.97521 5.29971C5.85104 5.42287 5.68344 5.4923 5.50855 5.49304Z",fill:"#202125"})})]})}),m.jsx(Af,{align:"end",className:"flex flex-col gap-2.5 rounded-xl border-gray-200",children:x.map((e,t)=>m.jsxs(Lf,{className:`capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-gray-700 text-sm cursor-pointer px-[15px] flex items-center gap-[5px] ${t===x.length-1&&"text-danger focus:text-danger"}`,onMouseOver:()=>(e=>{o(e)})(t),onMouseOut:a,onClick:e.action,children:[M.cloneElement(e.icon,{fill:r===t?"#1868DB":"#5E6278"})," ",e.label]},t))})]}),m.jsx(Wk,{isOpen:i,onClose:()=>s(!1),itemUUID:e}),l?m.jsx(iP,{itemUUID:e,itemTypeUUID:t,isOpen:l,onClose:()=>u(!1)}):null,m.jsx(Ij,{isOpen:f,onClose:()=>p(!1),uuids:[e],single:!0})]})},uP=({title:e,item_uuid:t,item_type_id:n,data:r})=>{const[o,a]=D.useState(!1),[i,s]=D.useState(!1),[l,u]=D.useState(!1);return m.jsxs(m.Fragment,{children:[m.jsx("button",{className:Ya("text-primary font-bold text-sm first-letter:uppercase truncate max-w-[265px] cursor-pointer",r.expired?"text-danger":""),title:e,onClick:()=>a(!0),children:e}),m.jsx(Wk,{isOpen:o,onClose:()=>a(!1),itemUUID:t})]})};function cP({loading:e,data:t,meta:n}){const r=t?.otherscount?.map(e=>{const n=e.name;return{type:n,value:t?.result_array?.[n]?.total_selling_price??0}}),o=[{type:t?.result_array?.Retail?.pricegroup??t?.default,value:t?.result_array?.Retail?.total_selling_price??0},...r||[]],a=t?.otherscount?.map(e=>{const n=e.name;return{type:n,value:t?.result_array?.[n]?.total_profit??0}}),i=[{type:t?.result_array?.Retail?.pricegroup??t?.default,value:t?.result_array?.Retail?.total_profit??0},...a||[]],[s,l]=D.useState({type:o?.[0].type,value:o?.[0].value}),[u,c]=D.useState({type:i?.[0].type,value:i?.[0].value});M.useEffect(()=>{l({type:o?.[0].type,value:o?.[0].value}),c({type:i?.[0].type,value:i?.[0].value})},[e]);const d=[{label:"Total No. of Unique Item",count:Intl.NumberFormat().format(n?.total??0),desc:`With ${t?.unit_count??0} unit(s)`,icon:m.jsx("div",{className:"shrink-0 rounded-lg \n \n bg-[#EFF5FF] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:Kv.cube})},{label:"Total Cost Price",count:Jv(t?.result_array?.Retail?.total_cost??0),desc:"Takes into Account FIFO & LIFO ",icon:m.jsx("div",{className:"shrink-0 rounded-lg bg-[#F9DFDD] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:M.cloneElement(Kv.price_tag,{fill:"#ED7400"})})},{label:"Total Selling Price",count:Jv(s.value),desc:m.jsxs("p",{className:"flex gap-2 items-center flex-wrap",children:["Showing ",s.type," price"," ",m.jsxs(Mf,{children:[m.jsx(If,{asChild:!0,children:m.jsxs("button",{className:"rounded-lg h-8 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 capitalize bg-[#F9F9F9]",children:["change",m.jsx("span",{className:"rotate-90",children:Kv.arrow})]})}),m.jsx(Af,{align:"start",className:"flex flex-col gap-2.5 rounded-xl border-gray-200 py-2.5 w-[210px]",children:o.map((e,t)=>m.jsx(Lf,{className:Ya("capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-sm cursor-pointer px-[15px] flex items-center gap-[5px] \n \n ",e.type===s.type?"bg-primary_light text-primary":null),onClick:()=>l(t=>({...t,value:e.value,type:e.type})),children:e.type},t))})]})]}),icon:m.jsx("div",{className:"shrink-0 rounded-lg bg-[#D8CDF4] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:M.cloneElement(Kv.price_tag,{fill:"#9747FF"})})},{label:"Profit to be made",count:Jv(u.value),desc:m.jsxs("p",{className:"flex gap-2 items-center flex-wrap",children:["Showing ",u.type," price"," ",m.jsxs(Mf,{children:[m.jsx(If,{asChild:!0,children:m.jsxs("button",{className:"rounded-lg h-8 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 capitalize bg-[#F9F9F9]",children:["change",m.jsx("span",{className:"rotate-90",children:Kv.arrow})]})}),m.jsx(Af,{align:"start",className:"flex flex-col gap-2.5 rounded-xl border-gray-200 py-2.5 w-[210px]",children:i.map((e,t)=>m.jsx(Lf,{className:Ya("capitalize focus:bg-primary_light rounded-md focus:text-primary font-semibold text-sm cursor-pointer px-[15px] flex items-center gap-[5px] \n \n ",e.type===u.type?"bg-primary_light text-primary":null),onClick:()=>c(t=>({...t,value:e.value,type:e.type})),children:e.type},t))})]})]}),icon:m.jsx("div",{className:"shrink-0 rounded-lg bg-[#C6E3D2] w-12 h-12 flex items-center justify-center border border-[#EDEEF1]",children:M.cloneElement(Kv.price_tag,{fill:"#378C5A"})})}],[f,p]=D.useState(!1);return m.jsxs(KC,{className:"bg-[#F6F8FA] p-2.5 flex flex-col",children:[m.jsxs("div",{className:"flex justify-between",children:[m.jsx("h1",{className:"capitalize text-dark font-semibold text-lg",children:"Items overview"}),m.jsxs("button",{className:"rounded-lg h-8 flex items-center justify-between p-3 font-semibold text-xs text-gray-600 outline-none border border-gray-300 gap-2.5 capitalize bg-white",onClick:()=>p(!f),children:[f?"Close":"Open"," ",m.jsx("span",{className:"rotate-90",children:Kv.arrow})]})]}),m.jsx(LR.Collapse,{isOpened:f,children:m.jsx("div",{className:"flex flex-wrap gap-2.5 mt-3",children:d.map((t,n)=>m.jsxs("div",{className:Ya("border rounded-xl border-[#E4E7EC] p-4 flex flex-col relative bg-right-bottom bg-no-repeat flex-auto",0===n?"bg-[#E4EEFA] bg-[url('/assets/images/ecstacy1.svg')]":1===n?"bg-[#FAEAE9] bg-[url('/assets/images/ecstacy2.svg')]":2===n?"bg-[#EEE9FA] bg-[url('/assets/images/ecstacy3.svg')]":3===n?"bg-[#EBF5EF] bg-[url('/assets/images/ecstacy4.svg')]":null),children:[m.jsxs("div",{className:"flex justify-between gap-1",children:[m.jsx("h1",{className:"text-dark text-sm font-medium",children:t.label}),m.jsx("div",{className:"shrink-0",children:t.icon})]}),m.jsxs("div",{className:"flex flex-col gap-1",children:[e?m.jsx(ei,{className:"w-28 h-6 rounded"}):m.jsx("h1",{className:Ya("text-dark font-bold text-[29px] truncate",n===d.length-1&&u.value<0?"text-danger":null),title:t.count,children:t.count}),m.jsx("div",{className:"text-gray-700 text-sm font-medium ",children:t.desc})]})]},n))})})]})}function dP({placeholder:e,className:t,inputClass:n,...r}){return m.jsxs("div",{className:Ya("h-12 border border-gray-300 rounded-md w-[320px] flex",t),children:[m.jsx("span",{className:"bg-gray-200 w-[38px] flex items-center justify-center shrink-0 rounded-l-md ",children:Kv.magnifier}),m.jsx("input",{type:"search",placeholder:e,className:"w-full px-3 text-dark text-sm font-medium bg-transparent outline-none rounded-r-md",...r})]})}function fP({placeholder:e,searchPlaceholder:t,options:n=[],showMultiSelectValues:r=!0,values:o,onChange:a,className:i,showCheckMark:s=!0,label:l,labelClass:u,required:c,info:d,optional:f,actionLabel:p,actionLabelAction:h,actionLabelInfo:g,removeSelectedValue:y,removeTag:v,loading:b,showCount:w,error:x,showError:C,onChangeSearch:S,searching:k,contentStyle:_,disabled:E,searchValue:j}){const[N,R]=D.useState(!1),[O,P]=D.useState(0),T=D.useRef(null);D.useEffect(()=>{const e=()=>{T.current&&P(T?.current?.offsetWidth)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const M=o?.filter(e=>""!==e),I=e=>{const t=M?.includes(e)?M?.filter(t=>t!==e):[...M||[],e];a&&a(t)};return D.useEffect(()=>{y&&I(y)},[y]),m.jsx(m.Fragment,{children:b?m.jsx(ei,{className:"w-full h-[48px]"}):m.jsxs("div",{className:Ya("flex flex-col gap-2.5",i),children:[m.jsxs("div",{className:"flex justify-between gap-2 flex-wrap",children:[l&&m.jsxs("label",{className:Ya("text-black flex items-center gap-1 first-letter:uppercase text-sm font-medium",u),children:[l," ",c?m.jsx("span",{className:"text-[#E12D39]",children:l&&"*"}):f?m.jsx("span",{className:"text-[#B5B5B5] font-normal",children:"(optional)"}):null,d&&m.jsx(kb,{fieldName:l,children:m.jsx("p",{className:"font-normal first-letter:uppercase",children:d})})]}),p&&m.jsxs("button",{onClick:h,className:"text-primary flex items-center gap-1 first-letter:uppercase text-sm font-medium",children:[p,g&&m.jsx(kb,{fieldName:p,children:m.jsx("p",{className:"font-normal first-letter:uppercase text-left",children:g})})]})]}),m.jsxs(Ak,{modal:!0,open:N,onOpenChange:R,children:[m.jsx(Lk,{disabled:E,asChild:!0,children:m.jsxs($k,{ref:T,variant:"outline",role:"combobox","aria-expanded":N,className:Ya(`w-full h-[48px] justify-between border focus:border-primary border-neutral-200 bg-white hover:bg-white hover:border-[#BFD7FE] ${(x||C)&&"!border-danger"}`,r?"h-auto py-3":null,i),children:[m.jsx("div",{className:"flex gap-2 text-[#5E6278] justify-start first-letter:uppercase flex-wrap",children:M?.length>0&&r?M?.map((e,t)=>m.jsxs("div",{onClick:()=>{!v&&I(e)},className:"px-2 py-1 text-black flex items-center justify-between rounded gap-2 border bg-slate-200 text-xs font-medium",children:[n?.[0].searchId?n?.find(t=>t.value===e)?.searchId:n?.find(t=>t.value===e)?.label,m.jsx("span",{className:"",children:m.jsx("svg",{width:"9",height:"9",viewBox:"0 0 9 9",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M5.44001 4.49978L7.83334 2.12644C7.96064 1.99737 8.03146 1.82301 8.03021 1.64173C8.02896 1.46044 7.95575 1.28708 7.82667 1.15978C7.6976 1.03247 7.52324 0.961657 7.34196 0.962907C7.16067 0.964157 6.98731 1.03737 6.86001 1.16644L4.50001 3.55978L2.14001 1.21311C2.0151 1.08894 1.84613 1.01925 1.67001 1.01925C1.49388 1.01925 1.32492 1.08894 1.20001 1.21311C1.13752 1.27509 1.08793 1.34882 1.05408 1.43006C1.02023 1.5113 1.00281 1.59844 1.00281 1.68644C1.00281 1.77445 1.02023 1.86159 1.05408 1.94283C1.08793 2.02407 1.13752 2.0978 1.20001 2.15978L3.56001 4.49978L1.16667 6.87311C1.03937 7.00218 0.968554 7.17654 0.969804 7.35782C0.971054 7.53911 1.04427 7.71247 1.17334 7.83978C1.30241 7.96708 1.47677 8.0379 1.65805 8.03665C1.83934 8.0354 2.0127 7.96218 2.14001 7.83311L4.50001 5.43978L6.86001 7.78644C6.98492 7.91061 7.15388 7.98031 7.33001 7.98031C7.50613 7.98031 7.6751 7.91061 7.80001 7.78644C7.86249 7.72447 7.91209 7.65073 7.94594 7.56949C7.97978 7.48826 7.99721 7.40112 7.99721 7.31311C7.99721 7.2251 7.97978 7.13797 7.94594 7.05673C7.91209 6.97549 7.86249 6.90175 7.80001 6.83978L5.44001 4.49978Z",fill:"black"})})})]},t)):!r&&w&&o.length>0?`${M.length} ${l} selected`:e??"Select..."}),m.jsx(Of,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),m.jsx(Fk,{align:"start",style:{width:O},className:Ya("w-[480px] p-0 bg-white rounded-xl border-gray-200",_),children:m.jsx(LO,{children:m.jsxs(ik,{children:[m.jsx(sk,{onChangeCapture:S,className:"placeholder:text-xs",placeholder:t??"Search..."}),k?m.jsx("div",{className:"flex flex-col gap-2 p-2",children:[1,2,3].map((e,t)=>m.jsx(ei,{className:"h-9 rounded-md"},t))}):m.jsx(uk,{children:j?"No result found.":e}),m.jsx(ck,{children:m.jsx(lk,{className:"",children:n?.map(e=>m.jsxs(dk,{value:"string"==typeof e.label?e.label:e.searchId,className:`first-letter:uppercase mb-1 focus:bg-primary_light w-full rounded-md focus:text-primary hover:text-primary font-semibold text-gray-700 text-sm cursor-pointer ${o?.includes(e.value)&&"bg-primary_light text-primary"}`,onSelect:()=>{I(e.value)},children:[s&&m.jsx(Ef,{className:Ya("mr-2 h-4 w-4",o?.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},e.value))})})]})})})]})]})})}const pP=D.createContext({dragDropManager:void 0});function hP(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var mP="function"==typeof Symbol&&Symbol.observable||"@@observable",gP=function(){return Math.random().toString(36).substring(7).split("").join(".")},yP={INIT:"@@redux/INIT"+gP(),REPLACE:"@@redux/REPLACE"+gP()};function vP(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(hP(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(hP(1));return n(vP)(e,t)}if("function"!=typeof e)throw new Error(hP(2));var o=e,a=t,i=[],s=i,l=!1;function u(){s===i&&(s=i.slice())}function c(){if(l)throw new Error(hP(3));return a}function d(e){if("function"!=typeof e)throw new Error(hP(4));if(l)throw new Error(hP(5));var t=!0;return u(),s.push(e),function(){if(t){if(l)throw new Error(hP(6));t=!1,u();var n=s.indexOf(e);s.splice(n,1),i=null}}}function f(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(hP(7));if(void 0===e.type)throw new Error(hP(8));if(l)throw new Error(hP(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=i=s,n=0;n<t.length;n++){(0,t[n])()}return e}return f({type:yP.INIT}),(r={dispatch:f,subscribe:d,getState:c,replaceReducer:function(e){if("function"!=typeof e)throw new Error(hP(10));o=e,f({type:yP.REPLACE})}})[mP]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(hP(11));function n(){e.next&&e.next(c())}return n(),{unsubscribe:t(n)}}})[mP]=function(){return this},e},r}function bP(e,t,...n){if("undefined"!=typeof process&&"production"===process.env.NODE_ENV&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let r=0;e=new Error(t.replace(/%s/g,function(){return n[r++]})),e.name="Invariant Violation"}throw e.framesToPop=1,e}}function wP(e){return"object"==typeof e}const xP="dnd-core/INIT_COORDS",CP="dnd-core/BEGIN_DRAG",SP="dnd-core/PUBLISH_DRAG_SOURCE",kP="dnd-core/HOVER",_P="dnd-core/DROP",EP="dnd-core/END_DRAG";function jP(e,t){return{type:xP,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const NP={type:xP,payload:{clientOffset:null,sourceClientOffset:null}};function RP(e){return function(t=[],n={publishSource:!0}){const{publishSource:r=!0,clientOffset:o,getSourceClientOffset:a}=n,i=e.getMonitor(),s=e.getRegistry();e.dispatch(jP(o)),function(e,t,n){bP(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(e){bP(n.getSource(e),"Expected sourceIds to be registered.")})}(t,i,s);const l=function(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}(t,i);if(null==l)return void e.dispatch(NP);let u=null;if(o){if(!a)throw new Error("getSourceClientOffset must be defined");!function(e){bP("function"==typeof e,"When clientOffset is provided, getSourceClientOffset must be a function.")}(a),u=a(l)}e.dispatch(jP(o,u));const c=s.getSource(l).beginDrag(i,l);if(null==c)return;!function(e){bP(wP(e),"Item must be an object.")}(c),s.pinSource(l);const d=s.getSourceType(l);return{type:CP,payload:{itemType:d,item:c,sourceId:l,clientOffset:o||null,sourceClientOffset:u||null,isSourcePublic:!!r}}}}function OP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function PP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){OP(e,t,n[t])})}return e}function TP(e){return function(t={}){const n=e.getMonitor(),r=e.getRegistry();!function(e){bP(e.isDragging(),"Cannot call drop while not dragging."),bP(!e.didDrop(),"Cannot call drop twice during one drag operation.")}(n);const o=function(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}(n);o.forEach((o,a)=>{const i=function(e,t,n,r){const o=n.getTarget(e);let a=o?o.drop(r,e):void 0;(function(e){bP(void 0===e||wP(e),"Drop result must either be an object or undefined.")})(a),void 0===a&&(a=0===t?{}:r.getDropResult());return a}(o,a,r,n),s={type:_P,payload:{dropResult:PP({},t,i)}};e.dispatch(s)})}}function DP(e){return function(){const t=e.getMonitor(),n=e.getRegistry();!function(e){bP(e.isDragging(),"Cannot call endDrag while not dragging.")}(t);const r=t.getSourceId();if(null!=r){n.getSource(r,!0).endDrag(t,r),n.unpinSource()}return{type:EP}}}function MP(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}function IP(e){return function(t,{clientOffset:n}={}){!function(e){bP(Array.isArray(e),"Expected targetIds to be an array.")}(t);const r=t.slice(0),o=e.getMonitor(),a=e.getRegistry();return function(e,t,n){for(let r=e.length-1;r>=0;r--){const o=e[r];MP(t.getTargetType(o),n)||e.splice(r,1)}}(r,a,o.getItemType()),function(e,t,n){bP(t.isDragging(),"Cannot call hover while not dragging."),bP(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){const r=e[t];bP(e.lastIndexOf(r)===t,"Expected targetIds to be unique in the passed array.");bP(n.getTarget(r),"Expected targetIds to be registered.")}}(r,o,a),function(e,t,n){e.forEach(function(e){n.getTarget(e).hover(t,e)})}(r,o,a),{type:kP,payload:{targetIds:r,clientOffset:n||null}}}}function AP(e){return function(){if(e.getMonitor().isDragging())return{type:SP}}}class LP{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:t}=this.store;const n=function(e){return{beginDrag:RP(e),publishDragSource:AP(e),hover:IP(e),drop:TP(e),endDrag:DP(e)}}(this);return Object.keys(n).reduce((r,o)=>{const a=n[o];var i;return r[o]=(i=a,(...n)=>{const r=i.apply(e,n);void 0!==r&&t(r)}),r},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{const e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function FP(e,t){return{x:e.x-t.x,y:e.y-t.y}}const zP=[],$P=[];zP.__IS_NONE__=!0,$P.__IS_ALL__=!0;class HP{subscribeToStateChange(e,t={}){const{handlerIds:n}=t;bP("function"==typeof e,"listener must be a function."),bP(void 0===n||Array.isArray(n),"handlerIds, when specified, must be an array of strings.");let r=this.store.getState().stateId;return this.store.subscribe(()=>{const t=this.store.getState(),o=t.stateId;try{const a=o===r||o===r+1&&!function(e,t){return e!==zP&&(e===$P||void 0===t||(n=e,t.filter(e=>n.indexOf(e)>-1)).length>0);var n}(t.dirtyHandlerIds,n);a||e()}finally{r=o}})}subscribeToOffsetChange(e){bP("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset;return this.store.subscribe(()=>{const n=this.store.getState().dragOffset;n!==t&&(t=n,e())})}canDragSource(e){if(!e)return!1;const t=this.registry.getSource(e);return bP(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const t=this.registry.getTarget(e);if(bP(t,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;return MP(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return Boolean(this.getItemType())}isDraggingSource(e){if(!e)return!1;const t=this.registry.getSource(e,!0);if(bP(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;return this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;const{shallow:n}=t;if(!this.isDragging())return!1;const r=this.registry.getTargetType(e),o=this.getItemType();if(o&&!MP(r,o))return!1;const a=this.getTargetIds();if(!a.length)return!1;const i=a.indexOf(e);return n?i===a.length-1:i>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return Boolean(this.store.getState().dragOperation.isSourcePublic)}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){const{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return t&&n&&r?FP(function(e,t){return{x:e.x+t.x,y:e.y+t.y}}(t,r),n):null}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){const{clientOffset:t,initialClientOffset:n}=e;return t&&n?FP(t,n):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}const BP="undefined"!=typeof global?global:self,VP=BP.MutationObserver||BP.WebKitMutationObserver;function UP(e){return function(){const t=setTimeout(r,0),n=setInterval(r,50);function r(){clearTimeout(t),clearInterval(n),e()}}}const qP="function"==typeof VP?function(e){let t=1;const n=new VP(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}:UP;class WP{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}const YP=new class{enqueueTask(e){const{queue:t,requestFlush:n}=this;t.length||(n(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,n=e.length-this.index;t<n;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=qP(this.flush),this.requestErrorThrow=UP(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},GP=new class{create(e){const t=this.freeTasks,n=t.length?t.pop():new WP(this.onError,e=>t[t.length]=e);return n.task=e,n}constructor(e){this.onError=e,this.freeTasks=[]}}(YP.registerPendingError);const KP="dnd-core/ADD_SOURCE",QP="dnd-core/ADD_TARGET",ZP="dnd-core/REMOVE_SOURCE",XP="dnd-core/REMOVE_TARGET";function JP(e,t){t&&Array.isArray(e)?e.forEach(e=>JP(e,!1)):bP("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var eT;!function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"}(eT||(eT={}));let tT=0;function nT(e){const t=(tT++).toString();switch(e){case eT.SOURCE:return`S${t}`;case eT.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function rT(e){switch(e[0]){case"S":return eT.SOURCE;case"T":return eT.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function oT(e,t){const n=e.entries();let r=!1;do{const{done:e,value:[,o]}=n.next();if(o===t)return!0;r=!!e}while(!r);return!1}class aT{addSource(e,t){JP(e),function(e){bP("function"==typeof e.canDrag,"Expected canDrag to be a function."),bP("function"==typeof e.beginDrag,"Expected beginDrag to be a function."),bP("function"==typeof e.endDrag,"Expected endDrag to be a function.")}(t);const n=this.addHandler(eT.SOURCE,e,t);return this.store.dispatch(function(e){return{type:KP,payload:{sourceId:e}}}(n)),n}addTarget(e,t){JP(e,!0),function(e){bP("function"==typeof e.canDrop,"Expected canDrop to be a function."),bP("function"==typeof e.hover,"Expected hover to be a function."),bP("function"==typeof e.drop,"Expected beginDrag to be a function.")}(t);const n=this.addHandler(eT.TARGET,e,t);return this.store.dispatch(function(e){return{type:QP,payload:{targetId:e}}}(n)),n}containsHandler(e){return oT(this.dragSources,e)||oT(this.dropTargets,e)}getSource(e,t=!1){bP(this.isSourceId(e),"Expected a valid source ID.");return t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return bP(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return bP(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return bP(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return rT(e)===eT.SOURCE}isTargetId(e){return rT(e)===eT.TARGET}removeSource(e){var t;bP(this.getSource(e),"Expected an existing source."),this.store.dispatch(function(e){return{type:ZP,payload:{sourceId:e}}}(e)),t=()=>{this.dragSources.delete(e),this.types.delete(e)},YP.enqueueTask(GP.create(t))}removeTarget(e){bP(this.getTarget(e),"Expected an existing target."),this.store.dispatch(function(e){return{type:XP,payload:{targetId:e}}}(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const t=this.getSource(e);bP(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){bP(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,n){const r=nT(e);return this.types.set(r,t),e===eT.SOURCE?this.dragSources.set(r,n):e===eT.TARGET&&this.dropTargets.set(r,n),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const iT=(e,t)=>e===t;function sT(e=zP,t){switch(t.type){case kP:break;case KP:case QP:case XP:case ZP:return zP;default:return $P}const{targetIds:n=[],prevTargetIds:r=[]}=t.payload,o=function(e,t){const n=new Map,r=e=>{n.set(e,n.has(e)?n.get(e)+1:1)};e.forEach(r),t.forEach(r);const o=[];return n.forEach((e,t)=>{1===e&&o.push(t)}),o}(n,r),a=o.length>0||!function(e,t,n=iT){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(!n(e[r],t[r]))return!1;return!0}(n,r);if(!a)return zP;const i=r[r.length-1],s=n[n.length-1];return i!==s&&(i&&o.push(i),s&&o.push(s)),o}function lT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const uT={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function cT(e=uT,t){const{payload:n}=t;switch(t.type){case xP:case CP:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case kP:return r=e.clientOffset,o=n.clientOffset,!r&&!o||r&&o&&r.x===o.x&&r.y===o.y?e:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){lT(e,t,n[t])})}return e}({},e,{clientOffset:n.clientOffset});case EP:case _P:return uT;default:return e}var r,o}function dT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fT(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){dT(e,t,n[t])})}return e}const pT={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function hT(e=pT,t){const{payload:n}=t;switch(t.type){case CP:return fT({},e,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case SP:return fT({},e,{isSourcePublic:!0});case kP:return fT({},e,{targetIds:n.targetIds});case XP:return-1===e.targetIds.indexOf(n.targetId)?e:fT({},e,{targetIds:(r=e.targetIds,o=n.targetId,r.filter(e=>e!==o))});case _P:return fT({},e,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case EP:return fT({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}var r,o}function mT(e=0,t){switch(t.type){case KP:case QP:return e+1;case ZP:case XP:return e-1;default:return e}}function gT(e=0){return e+1}function yT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vT(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){yT(e,t,n[t])})}return e}function bT(e={},t){return{dirtyHandlerIds:sT(e.dirtyHandlerIds,{type:t.type,payload:vT({},t.payload,{prevTargetIds:(n=e,r="dragOperation.targetIds",o=[],r.split(".").reduce((e,t)=>e&&e[t]?e[t]:o||null,n))})}),dragOffset:cT(e.dragOffset,t),refCount:mT(e.refCount,t),dragOperation:hT(e.dragOperation,t),stateId:gT(e.stateId)};var n,r,o}function wT(e,t=void 0,n={},r=!1){const o=function(e){const t="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__;return vP(bT,e&&t&&t({name:"dnd-core",instanceId:"dnd-core"}))}(r),a=new HP(o,new aT(o)),i=new LP(o,a),s=e(i,t,n);return i.receiveBackend(s),i}function xT(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}let CT=0;const ST=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var kT,_T,ET=D.memo(function(e){var{children:t}=e,n=xT(e,["children"]);const[r,o]=function(e){if("manager"in e){return[{dragDropManager:e.manager},!1]}const t=function(e,t=jT(),n,r){const o=t;o[ST]||(o[ST]={dragDropManager:wT(e,t,n,r)});return o[ST]}(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}(n);return D.useEffect(()=>{if(o){const e=jT();return++CT,()=>{0===--CT&&(e[ST]=null)}}},[]),m.jsx(pP.Provider,{value:r,children:t})});function jT(){return"undefined"!=typeof global?global:window}var NT=(_T||(_T=1,kT=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!==o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!==o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;0!==o--;){var i=a[o];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n}),kT),RT=n(NT);const OT="undefined"!=typeof window?D.useLayoutEffect:D.useEffect;function PT(e,t,n){const[r,o]=function(e,t,n){const[r,o]=D.useState(()=>t(e)),a=D.useCallback(()=>{const a=t(e);RT(r,a)||(o(a),n&&n())},[r,e,n]);return OT(a),[r,a]}(e,t,n);return OT(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(o,{handlerIds:[t]})},[e,o]),r}function TT(e,t,n){return PT(t,e||(()=>({})),()=>n.reconnect())}function DT(e,t){const n=[...t||[]];return null==t&&"function"!=typeof e&&n.push(e),D.useMemo(()=>"function"==typeof e?e():e,n)}function MT(e){return D.useMemo(()=>e.hooks.dragSource(),[e])}function IT(e){return D.useMemo(()=>e.hooks.dragPreview(),[e])}let AT=!1,LT=!1;class FT{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){bP(!AT,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return AT=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{AT=!1}}isDragging(){if(!this.sourceId)return!1;bP(!LT,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return LT=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{LT=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}let zT=!1;class $T{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;bP(!zT,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return zT=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{zT=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}function HT(e,t,n,r){let o;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const a=Object.keys(e),i=Object.keys(t);if(a.length!==i.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let n=0;n<a.length;n++){const r=a[n];if(!s(r))return!1;const i=e[r],l=t[r];if(o=void 0,!1===o||void 0===o&&i!==l)return!1}return!0}function BT(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function VT(e){return(t=null,n=null)=>{if(!D.isValidElement(t)){const r=t;return e(r,n),r}const r=t;!function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(r);const o=n?t=>e(t,n):e;return function(e,t){const n=e.ref;return bP("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?D.cloneElement(e,{ref:e=>{qT(n,e),qT(t,e)}}):D.cloneElement(e,{ref:t})}(r,o)}}function UT(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const e=VT(r);t[n]=()=>e}}),t}function qT(e,t){"function"==typeof e?e(t):e.current=t}class WT{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(t?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!HT(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!HT(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=UT({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,BT(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,BT(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}class YT{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!HT(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=UT({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,BT(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function GT(){const{dragDropManager:e}=D.useContext(pP);return bP(null!=e,"Expected drag drop context"),e}class KT{beginDrag(){const e=this.spec,t=this.monitor;let n=null;return n="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=n?n:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const n=this.spec,r=this.monitor,{isDragging:o}=n;return o?o(r):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,n=this.connector,{end:r}=e;r&&r(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}}function QT(e,t,n){const r=GT(),o=function(e,t,n){const r=D.useMemo(()=>new KT(e,t,n),[t,n]);return D.useEffect(()=>{r.spec=e},[e]),r}(e,t,n),a=function(e){return D.useMemo(()=>{const t=e.type;return bP(null!=t,"spec.type must be defined"),t},[e])}(e);OT(function(){if(null!=a){const[e,i]=function(e,t,n){const r=n.getRegistry(),o=r.addSource(e,t);return[o,()=>r.removeSource(o)]}(a,o,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),i}},[r,t,n,o,a])}function ZT(e,t){const n=DT(e,t);bP(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=function(){const e=GT();return D.useMemo(()=>new FT(e),[e])}(),o=function(e,t){const n=GT(),r=D.useMemo(()=>new WT(n.getBackend()),[n]);return OT(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),OT(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}(n.options,n.previewOptions);return QT(n,r,o),[TT(n.collect,r,o),MT(o),IT(o)]}function XT(e){return D.useMemo(()=>e.hooks.dropTarget(),[e])}class JT{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function eD(e,t,n){const r=GT(),o=function(e,t){const n=D.useMemo(()=>new JT(e,t),[t]);return D.useEffect(()=>{n.spec=e},[e]),n}(e,t),a=function(e){const{accept:t}=e;return D.useMemo(()=>(bP(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);OT(function(){const[e,i]=function(e,t,n){const r=n.getRegistry(),o=r.addTarget(e,t);return[o,()=>r.removeTarget(o)]}(a,o,r);return t.receiveHandlerId(e),n.receiveHandlerId(e),i},[r,t,o,n,a.map(e=>e.toString()).join("|")])}function tD(e,t){const n=DT(e,t),r=function(){const e=GT();return D.useMemo(()=>new $T(e),[e])}(),o=function(e){const t=GT(),n=D.useMemo(()=>new YT(t.getBackend()),[t]);return OT(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}(n.options);return eD(n,r,o),[TT(n.collect,r,o),XT(o)]}function nD(e){let t=null;return()=>(null==t&&(t=e()),t)}class rD{enter(e){const t=this.entered.length;return this.entered=function(e,t){const n=new Set,r=e=>n.add(e);e.forEach(r),t.forEach(r);const o=[];return n.forEach(e=>o.push(e)),o}(this.entered.filter(t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e))),[e]),0===t&&this.entered.length>0}leave(e){const t=this.entered.length;var n,r;return this.entered=(n=this.entered.filter(this.isNodeInDocument),r=e,n.filter(e=>e!==r)),t>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class oD{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})})}loadDataTransfer(e){if(e){const t={};Object.keys(this.config.exposeProperties).forEach(n=>{const r=this.config.exposeProperties[n];null!=r&&(t[n]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const aD="__NATIVE_FILE__",iD="__NATIVE_URL__",sD="__NATIVE_TEXT__",lD="__NATIVE_HTML__";var uD=Object.freeze({__proto__:null,FILE:aD,HTML:lD,TEXT:sD,URL:iD});function cD(e,t,n){const r=t.reduce((t,n)=>t||e.getData(n),"");return null!=r?r:n}const dD={[aD]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[lD]:{exposeProperties:{html:(e,t)=>cD(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[iD]:{exposeProperties:{urls:(e,t)=>cD(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[sD]:{exposeProperties:{text:(e,t)=>cD(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function fD(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(dD).filter(e=>{const n=dD[e];return!!(null==n?void 0:n.matchesTypes)&&n.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}const pD=nD(()=>/firefox/i.test(navigator.userAgent)),hD=nD(()=>Boolean(window.safari));class mD{interpolate(e){const{xs:t,ys:n,c1s:r,c2s:o,c3s:a}=this;let i=t.length-1;if(e===t[i])return n[i];let s,l=0,u=a.length-1;for(;l<=u;){s=Math.floor(.5*(l+u));const r=t[s];if(r<e)l=s+1;else{if(!(r>e))return n[s];u=s-1}}i=Math.max(0,u);const c=e-t[i],d=c*c;return n[i]+r[i]*c+o[i]*d+a[i]*c*d}constructor(e,t){const{length:n}=e,r=[];for(let e=0;e<n;e++)r.push(e);r.sort((t,n)=>e[t]<e[n]?-1:1);const o=[],a=[];let i,s;for(let r=0;r<n-1;r++)i=e[r+1]-e[r],s=t[r+1]-t[r],o.push(i),a.push(s/i);const l=[a[0]];for(let e=0;e<o.length-1;e++){const t=a[e],n=a[e+1];if(t*n<=0)l.push(0);else{i=o[e];const r=o[e+1],a=i+r;l.push(3*a/((a+r)/t+(a+i)/n))}}l.push(a[a.length-1]);const u=[],c=[];let d;for(let e=0;e<l.length-1;e++){d=a[e];const t=l[e],n=1/o[e],r=t+l[e+1]-d-d;u.push((d-t-r)*n),c.push(r*n*n)}this.xs=e,this.ys=t,this.c1s=l,this.c2s=u,this.c3s=c}}function gD(e){const t=1===e.nodeType?e:e.parentElement;if(!t)return null;const{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function yD(e){return{x:e.clientX,y:e.clientY}}function vD(e,t,n,r,o){const a=function(e){var t;return"IMG"===e.nodeName&&(pD()||!(null===(t=document.documentElement)||void 0===t?void 0:t.contains(e)))}(t),i=gD(a?e:t),s={x:n.x-i.x,y:n.y-i.y},{offsetWidth:l,offsetHeight:u}=e,{anchorX:c,anchorY:d}=r,{dragPreviewWidth:f,dragPreviewHeight:p}=function(e,t,n,r){let o=e?t.width:n,a=e?t.height:r;return hD()&&e&&(a/=window.devicePixelRatio,o/=window.devicePixelRatio),{dragPreviewWidth:o,dragPreviewHeight:a}}(a,t,l,u),{offsetX:h,offsetY:m}=o,g=0===m||m;return{x:0===h||h?h:new mD([0,.5,1],[s.x,s.x/l*f,s.x+f-l]).interpolate(c),y:g?m:(()=>{let e=new mD([0,.5,1],[s.y,s.y/u*p,s.y+p-u]).interpolate(d);return hD()&&a&&(e+=(window.devicePixelRatio-1)*p),e})()}}class bD{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null===(e=this.globalContext)||void 0===e?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null===(e=this.optionsArgs)||void 0===e?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function wD(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){wD(e,t,n[t])})}return e}class CD{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null===(e=this.dragStartSourceIds)||void 0===e?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null===(t=this.dragOverTargetIds)||void 0===t?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;var t;void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId&&(null===(t=this.window)||void 0===t||t.cancelAnimationFrame(this.asyncEndDragFrameId)))}connectDragPreview(e,t,n){return this.sourcePreviewNodeOptions.set(e,n),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,n){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,n);const r=t=>this.handleDragStart(t,e),o=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",r),t.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",r),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}connectDropTarget(e,t){const n=t=>this.handleDragEnter(t,e),r=t=>this.handleDragOver(t,e),o=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",n),t.addEventListener("dragover",r),t.addEventListener("drop",o),()=>{t.removeEventListener("dragenter",n),t.removeEventListener("dragover",r),t.removeEventListener("drop",o)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return xD({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId();return xD({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(uD).some(t=>uD[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){const n=dD[e];if(!n)throw new Error(`native type ${e} has no configuration`);const r=new oD(n);return r.loadDataTransfer(t),r}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;this.mouseMoveTimeoutTimer=setTimeout(()=>{var e;return null===(e=this.rootElement)||void 0===e?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){var e;if(this.currentDragSourceNode=null,this.rootElement)null===(e=this.window)||void 0===e||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0);return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,n){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{const t=this.sourceNodes.get(e);return t&&gD(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>Boolean(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{const e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;const{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;const n=yD(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:n});const{dataTransfer:r}=e,o=fD(r);if(this.monitor.isDragging()){if(r&&"function"==typeof r.setDragImage){const e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),o=this.sourcePreviewNodes.get(e)||t;if(o){const{anchorX:e,anchorY:a,offsetX:i,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),l=vD(t,o,n,{anchorX:e,anchorY:a},{offsetX:i,offsetY:s});r.setDragImage(o,l.x,l.y)}}try{null==r||r.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);const{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(o)this.beginDragNativeItem(o);else{if(r&&!r.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{var t;(this.dragEnterTargetIds=[],this.isDraggingNativeItem())&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer));if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;const{dataTransfer:n}=e,r=fD(n);r&&this.beginDragNativeItem(r,n)},this.handleTopDragEnter=e=>{const{dragEnterTargetIds:t}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:yD(e)});t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=e=>{var t;(this.dragOverTargetIds=[],this.isDraggingNativeItem())&&(null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer))},this.handleTopDragOver=e=>{const{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging())return e.preventDefault(),void(e.dataTransfer&&(e.dataTransfer.dropEffect="none"));this.altKeyPressed=e.altKey,this.lastClientOffset=yD(e),this.scheduleHover(t);(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault();this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{var t;(this.dropTargetIds=[],this.isDraggingNativeItem())?(e.preventDefault(),null===(t=this.currentNativeSource)||void 0===t||t.loadDataTransfer(e.dataTransfer)):fD(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{const{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:yD(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{const t=e.target;"function"==typeof t.dragDrop&&("INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop()))},this.options=new bD(t,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new rD(this.isNodeInDocument)}}const SD=function(e,t,n){return new CD(e,t,n)};var kD,_D,ED=Object.create,jD=Object.defineProperty,ND=Object.getOwnPropertyDescriptor,RD=Object.getOwnPropertyNames,OD=Object.getPrototypeOf,PD=Object.prototype.hasOwnProperty,TD=(e,t,n)=>(n=null!=e?ED(OD(e)):{},((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of RD(t))PD.call(e,o)||o===n||jD(e,o,{get:()=>t[o],enumerable:!(r=ND(t,o))||r.enumerable});return e})(jD(n,"default",{value:e,enumerable:!0}),e)),DD=(kD={"node_modules/classnames/index.js"(e,t){!function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var a=typeof o;if("string"===a||"number"===a)t.push(o);else if(Array.isArray(o)){if(o.length){var i=n.apply(null,o);i&&t.push(i)}}else if("object"===a){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){t.push(o.toString());continue}for(var s in o)e.call(o,s)&&o[s]&&t.push(s)}}}return t.join(" ")}void 0!==t&&t.exports?(n.default=n,t.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()}},function(){return _D||(0,kD[RD(kD)[0]])((_D={exports:{}}).exports,_D),_D.exports}),MD=TD(DD()),ID="object"==typeof global&&global&&global.Object===Object&&global,AD="object"==typeof self&&self&&self.Object===Object&&self,LD=ID||AD||Function("return this")(),FD=LD.Symbol,zD=Object.prototype,$D=zD.hasOwnProperty,HD=zD.toString,BD=FD?FD.toStringTag:void 0;var VD=function(e){var t=$D.call(e,BD),n=e[BD];try{e[BD]=void 0;var r=!0}catch(e){}var o=HD.call(e);return r&&(t?e[BD]=n:delete e[BD]),o},UD=Object.prototype.toString;var qD=function(e){return UD.call(e)},WD=FD?FD.toStringTag:void 0;var YD=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":WD&&WD in Object(e)?VD(e):qD(e)};var GD=function(e){return null!=e&&"object"==typeof e};var KD=function(e){return"symbol"==typeof e||GD(e)&&"[object Symbol]"==YD(e)};var QD=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o},ZD=Array.isArray,XD=FD?FD.prototype:void 0,JD=XD?XD.toString:void 0;var eM=function e(t){if("string"==typeof t)return t;if(ZD(t))return QD(t,e)+"";if(KD(t))return JD?JD.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n};var tM=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)};var nM,rM=function(e){if(!tM(e))return!1;var t=YD(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},oM=LD["__core-js_shared__"],aM=(nM=/[^.]+$/.exec(oM&&oM.keys&&oM.keys.IE_PROTO||""))?"Symbol(src)_1."+nM:"";var iM=function(e){return!!aM&&aM in e},sM=Function.prototype.toString;var lM=function(e){if(null!=e){try{return sM.call(e)}catch(e){}try{return e+""}catch(e){}}return""},uM=/^\[object .+?Constructor\]$/,cM=Function.prototype,dM=Object.prototype,fM=cM.toString,pM=dM.hasOwnProperty,hM=RegExp("^"+fM.call(pM).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var mM=function(e){return!(!tM(e)||iM(e))&&(rM(e)?hM:uM).test(lM(e))};var gM=function(e,t){return null==e?void 0:e[t]};var yM=function(e,t){var n=gM(e,t);return mM(n)?n:void 0},vM=yM(LD,"WeakMap");var bM=function(){};var wM=function(e,t,n,r){for(var o=e.length,a=n+(r?1:-1);r?a--:++a<o;)if(t(e[a],a,e))return a;return-1};var xM=function(e){return e!=e};var CM=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1};var SM=function(e,t,n){return t==t?CM(e,t,n):wM(e,xM,n)};var kM=function(e,t){return!!(null==e?0:e.length)&&SM(e,t,0)>-1},_M=/^(?:0|[1-9]\d*)$/;var EM=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&_M.test(e))&&e>-1&&e%1==0&&e<t};var jM=function(e,t){return e===t||e!=e&&t!=t};var NM=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991};var RM=function(e){return null!=e&&NM(e.length)&&!rM(e)},OM=Object.prototype;var PM=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||OM)};var TM=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r};var DM=function(e){return GD(e)&&"[object Arguments]"==YD(e)},MM=Object.prototype,IM=MM.hasOwnProperty,AM=MM.propertyIsEnumerable,LM=DM(function(){return arguments}())?DM:function(e){return GD(e)&&IM.call(e,"callee")&&!AM.call(e,"callee")},FM=LM;var zM=function(){return!1},$M="object"==typeof e&&e&&!e.nodeType&&e,HM=$M&&"object"==typeof module&&module&&!module.nodeType&&module,BM=HM&&HM.exports===$M?LD.Buffer:void 0,VM=(BM?BM.isBuffer:void 0)||zM,UM={};UM["[object Float32Array]"]=UM["[object Float64Array]"]=UM["[object Int8Array]"]=UM["[object Int16Array]"]=UM["[object Int32Array]"]=UM["[object Uint8Array]"]=UM["[object Uint8ClampedArray]"]=UM["[object Uint16Array]"]=UM["[object Uint32Array]"]=!0,UM["[object Arguments]"]=UM["[object Array]"]=UM["[object ArrayBuffer]"]=UM["[object Boolean]"]=UM["[object DataView]"]=UM["[object Date]"]=UM["[object Error]"]=UM["[object Function]"]=UM["[object Map]"]=UM["[object Number]"]=UM["[object Object]"]=UM["[object RegExp]"]=UM["[object Set]"]=UM["[object String]"]=UM["[object WeakMap]"]=!1;var qM=function(e){return GD(e)&&NM(e.length)&&!!UM[YD(e)]};var WM=function(e){return function(t){return e(t)}},YM="object"==typeof e&&e&&!e.nodeType&&e,GM=YM&&"object"==typeof module&&module&&!module.nodeType&&module,KM=GM&&GM.exports===YM&&ID.process,QM=function(){try{var e=GM&&GM.require&&GM.require("util").types;return e||KM&&KM.binding&&KM.binding("util")}catch(e){}}(),ZM=QM&&QM.isTypedArray,XM=ZM?WM(ZM):qM,JM=Object.prototype.hasOwnProperty;var eI=function(e,t){var n=ZD(e),r=!n&&FM(e),o=!n&&!r&&VM(e),a=!n&&!r&&!o&&XM(e),i=n||r||o||a,s=i?TM(e.length,String):[],l=s.length;for(var u in e)!t&&!JM.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||EM(u,l))||s.push(u);return s};var tI=function(e,t){return function(n){return e(t(n))}},nI=tI(Object.keys,Object),rI=Object.prototype.hasOwnProperty;var oI=function(e){if(!PM(e))return nI(e);var t=[];for(var n in Object(e))rI.call(e,n)&&"constructor"!=n&&t.push(n);return t};var aI=function(e){return RM(e)?eI(e):oI(e)},iI=yM(Object,"create");var sI=function(){this.__data__=iI?iI(null):{},this.size=0};var lI=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},uI=Object.prototype.hasOwnProperty;var cI=function(e){var t=this.__data__;if(iI){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return uI.call(t,e)?t[e]:void 0},dI=Object.prototype.hasOwnProperty;var fI=function(e){var t=this.__data__;return iI?void 0!==t[e]:dI.call(t,e)};var pI=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=iI&&void 0===t?"__lodash_hash_undefined__":t,this};function hI(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}hI.prototype.clear=sI,hI.prototype.delete=lI,hI.prototype.get=cI,hI.prototype.has=fI,hI.prototype.set=pI;var mI=hI;var gI=function(){this.__data__=[],this.size=0};var yI=function(e,t){for(var n=e.length;n--;)if(jM(e[n][0],t))return n;return-1},vI=Array.prototype.splice;var bI=function(e){var t=this.__data__,n=yI(t,e);return!(n<0)&&(n==t.length-1?t.pop():vI.call(t,n,1),--this.size,!0)};var wI=function(e){var t=this.__data__,n=yI(t,e);return n<0?void 0:t[n][1]};var xI=function(e){return yI(this.__data__,e)>-1};var CI=function(e,t){var n=this.__data__,r=yI(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function SI(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}SI.prototype.clear=gI,SI.prototype.delete=bI,SI.prototype.get=wI,SI.prototype.has=xI,SI.prototype.set=CI;var kI=SI,_I=yM(LD,"Map");var EI=function(){this.size=0,this.__data__={hash:new mI,map:new(_I||kI),string:new mI}};var jI=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var NI=function(e,t){var n=e.__data__;return jI(t)?n["string"==typeof t?"string":"hash"]:n.map};var RI=function(e){var t=NI(this,e).delete(e);return this.size-=t?1:0,t};var OI=function(e){return NI(this,e).get(e)};var PI=function(e){return NI(this,e).has(e)};var TI=function(e,t){var n=NI(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};function DI(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}DI.prototype.clear=EI,DI.prototype.delete=RI,DI.prototype.get=OI,DI.prototype.has=PI,DI.prototype.set=TI;var MI=DI;var II=function(e){return null==e?"":eM(e)};var AI=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e};var LI=function(e){return function(t){return null==e?void 0:e[t]}};var FI=function(){this.__data__=new kI,this.size=0};var zI=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var $I=function(e){return this.__data__.get(e)};var HI=function(e){return this.__data__.has(e)};var BI=function(e,t){var n=this.__data__;if(n instanceof kI){var r=n.__data__;if(!_I||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new MI(r)}return n.set(e,t),this.size=n.size,this};function VI(e){var t=this.__data__=new kI(e);this.size=t.size}VI.prototype.clear=FI,VI.prototype.delete=zI,VI.prototype.get=$I,VI.prototype.has=HI,VI.prototype.set=BI;var UI=VI;var qI=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,a=[];++n<r;){var i=e[n];t(i,n,e)&&(a[o++]=i)}return a};var WI=function(){return[]},YI=Object.prototype.propertyIsEnumerable,GI=Object.getOwnPropertySymbols,KI=GI?function(e){return null==e?[]:(e=Object(e),qI(GI(e),function(t){return YI.call(e,t)}))}:WI;var QI=function(e,t,n){var r=t(e);return ZD(e)?r:AI(r,n(e))};var ZI=function(e){return QI(e,aI,KI)},XI=yM(LD,"DataView"),JI=yM(LD,"Promise"),eA=yM(LD,"Set"),tA="[object Map]",nA="[object Promise]",rA="[object Set]",oA="[object WeakMap]",aA="[object DataView]",iA=lM(XI),sA=lM(_I),lA=lM(JI),uA=lM(eA),cA=lM(vM),dA=YD;(XI&&dA(new XI(new ArrayBuffer(1)))!=aA||_I&&dA(new _I)!=tA||JI&&dA(JI.resolve())!=nA||eA&&dA(new eA)!=rA||vM&&dA(new vM)!=oA)&&(dA=function(e){var t=YD(e),n="[object Object]"==t?e.constructor:void 0,r=n?lM(n):"";if(r)switch(r){case iA:return aA;case sA:return tA;case lA:return nA;case uA:return rA;case cA:return oA}return t});var fA=dA,pA=LD.Uint8Array;var hA=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var mA=function(e){return this.__data__.has(e)};function gA(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new MI;++t<n;)this.add(e[t])}gA.prototype.add=gA.prototype.push=hA,gA.prototype.has=mA;var yA=gA;var vA=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1};var bA=function(e,t){return e.has(t)};var wA=function(e,t,n,r,o,a){var i=1&n,s=e.length,l=t.length;if(s!=l&&!(i&&l>s))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,p=2&n?new yA:void 0;for(a.set(e,t),a.set(t,e);++d<s;){var h=e[d],m=t[d];if(r)var g=i?r(m,h,d,t,e,a):r(h,m,d,e,t,a);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!vA(t,function(e,t){if(!bA(p,t)&&(h===e||o(h,e,n,r,a)))return p.push(t)})){f=!1;break}}else if(h!==m&&!o(h,m,n,r,a)){f=!1;break}}return a.delete(e),a.delete(t),f};var xA=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n};var CA=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n},SA=FD?FD.prototype:void 0,kA=SA?SA.valueOf:void 0;var _A=function(e,t,n,r,o,a,i){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new pA(e),new pA(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return jM(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=xA;case"[object Set]":var l=1&r;if(s||(s=CA),e.size!=t.size&&!l)return!1;var u=i.get(e);if(u)return u==t;r|=2,i.set(e,t);var c=wA(s(e),s(t),r,o,a,i);return i.delete(e),c;case"[object Symbol]":if(kA)return kA.call(e)==kA.call(t)}return!1},EA=Object.prototype.hasOwnProperty;var jA=function(e,t,n,r,o,a){var i=1&n,s=ZI(e),l=s.length;if(l!=ZI(t).length&&!i)return!1;for(var u=l;u--;){var c=s[u];if(!(i?c in t:EA.call(t,c)))return!1}var d=a.get(e),f=a.get(t);if(d&&f)return d==t&&f==e;var p=!0;a.set(e,t),a.set(t,e);for(var h=i;++u<l;){var m=e[c=s[u]],g=t[c];if(r)var y=i?r(g,m,c,t,e,a):r(m,g,c,e,t,a);if(!(void 0===y?m===g||o(m,g,n,r,a):y)){p=!1;break}h||(h="constructor"==c)}if(p&&!h){var v=e.constructor,b=t.constructor;v==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof b&&b instanceof b||(p=!1)}return a.delete(e),a.delete(t),p},NA="[object Arguments]",RA="[object Array]",OA="[object Object]",PA=Object.prototype.hasOwnProperty;var TA=function(e,t,n,r,o,a){var i=ZD(e),s=ZD(t),l=i?RA:fA(e),u=s?RA:fA(t),c=(l=l==NA?OA:l)==OA,d=(u=u==NA?OA:u)==OA,f=l==u;if(f&&VM(e)){if(!VM(t))return!1;i=!0,c=!1}if(f&&!c)return a||(a=new UI),i||XM(e)?wA(e,t,n,r,o,a):_A(e,t,l,n,r,o,a);if(!(1&n)){var p=c&&PA.call(e,"__wrapped__"),h=d&&PA.call(t,"__wrapped__");if(p||h){var m=p?e.value():e,g=h?t.value():t;return a||(a=new UI),o(m,g,n,r,a)}}return!!f&&(a||(a=new UI),jA(e,t,n,r,o,a))};var DA=function e(t,n,r,o,a){return t===n||(null==t||null==n||!GD(t)&&!GD(n)?t!=t&&n!=n:TA(t,n,r,o,e,a))};var MA=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1},IA=LI({"&":"&","<":"<",">":">",'"':""","'":"'"}),AA=/[&<>"']/g,LA=RegExp(AA.source);var FA=function(e){return(e=II(e))&&LA.test(e)?e.replace(AA,IA):e},zA=/[\\^$.*+?()[\]{}|]/g,$A=RegExp(zA.source);var HA=function(e){return(e=II(e))&&$A.test(e)?e.replace(zA,"\\$&"):e};var BA=function(e,t){return DA(e,t)},VA=eA&&1/CA(new eA([,-0]))[1]==1/0?function(e){return new eA(e)}:bM,UA=VA;var qA=function(e,t,n){var r=-1,o=kM,a=e.length,i=!0,s=[],l=s;if(n)i=!1,o=MA;else if(a>=200){var u=t?null:UA(e);if(u)return CA(u);i=!1,o=bA,l=new yA}else l=t?[]:s;e:for(;++r<a;){var c=e[r],d=t?t(c):c;if(c=n||0!==c?c:0,i&&d==d){for(var f=l.length;f--;)if(l[f]===d)continue e;t&&l.push(d),s.push(c)}else o(l,d,n)||(l!==s&&l.push(d),s.push(c))}return s};var WA=function(e){return e&&e.length?qA(e):[]},YA={ENTER:[10,13],TAB:9,BACKSPACE:8,UP_ARROW:38,DOWN_ARROW:40,SPACE:32},GA={ENTER:"Enter",TAB:"Tab",COMMA:",",SPACE:" ",SEMICOLON:";"},KA="Press enter to add new tag",QA="text",ZA={tags:"ReactTags__tags",tagInput:"ReactTags__tagInput",tagInputField:"ReactTags__tagInputField",selected:"ReactTags__selected",tag:"ReactTags__tag",remove:"ReactTags__remove",suggestions:"ReactTags__suggestions",activeSuggestion:"ReactTags__activeSuggestion",editTagInput:"ReactTags__editTagInput",editTagInputField:"ReactTags__editTagInputField",clearAll:"ReactTags__clearAll"},XA="inline",JA="top",eL="bottom",tL="Tag limit reached!";function nL(e){const{moveTag:t,readOnly:n,allowDragDrop:r}=e;return void 0!==t&&!n&&r}var rL=e=>{const{readOnly:t,removeComponent:n,onRemove:r,className:o,tag:a,index:i}=e,s=e=>{if(YA.ENTER.includes(e.keyCode)||e.keyCode===YA.SPACE)return e.preventDefault(),void e.stopPropagation();e.keyCode===YA.BACKSPACE&&r(e)};if(t)return m.jsx("span",{});const l=`Tag at index ${i} with value ${a.id} focussed. Press backspace to remove`;if(n){const e=n;return m.jsx(e,{"data-testid":"remove",onRemove:r,onKeyDown:s,className:o,"aria-label":l,tag:a,index:i})}return m.jsx("button",{"data-testid":"remove",onClick:r,onKeyDown:s,className:o,type:"button","aria-label":l,children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"12",width:"12",fill:"#fff",children:m.jsx("path",{d:"M376.6 84.5c11.3-13.6 9.5-33.8-4.1-45.1s-33.8-9.5-45.1 4.1L192 206 56.6 43.5C45.3 29.9 25.1 28.1 11.5 39.4S-3.9 70.9 7.4 84.5L150.3 256 7.4 427.5c-11.3 13.6-9.5 33.8 4.1 45.1s33.8 9.5 45.1-4.1L192 306 327.4 468.5c11.3 13.6 31.5 15.4 45.1 4.1s15.4-31.5 4.1-45.1L233.7 256 376.6 84.5z"})})})},oL="tag",aL=e=>{const t=D.useRef(null),{readOnly:n=!1,tag:r,classNames:o,index:a,moveTag:i,allowDragDrop:s=!0,labelField:l="text",tags:u}=e,[{isDragging:c},d]=ZT(()=>({type:oL,collect:e=>({isDragging:!!e.isDragging()}),item:e,canDrag:()=>nL({moveTag:i,readOnly:n,allowDragDrop:s})}),[u]),[,f]=tD(()=>({accept:oL,drop:t=>{const n=t.index,r=a;n!==r&&e?.moveTag?.(n,r)},canDrop:e=>function(e){const{readOnly:t,allowDragDrop:n}=e;return!t&&n}(e)}),[u]);d(f(t));const p=e.tag[l],{className:h=""}=r,g=c?0:1;return m.jsxs("span",{ref:t,className:(0,MD.default)("tag-wrapper",o.tag,h),style:{opacity:g,cursor:nL({moveTag:i,readOnly:n,allowDragDrop:s})?"move":"auto"},"data-testid":"tag",onClick:e.onTagClicked,onTouchStart:e.onTagClicked,children:[p,m.jsx(rL,{tag:e.tag,className:o.remove,removeComponent:e.removeComponent,onRemove:e.onDelete,readOnly:n,index:a})]})},iL=e=>m.jsx("button",{"aria-label":e["aria-label"],className:e.classNames.clearAll,onClick:e.onClick,children:"Clear all"}),sL=(e,t,n,r)=>"function"==typeof r?r(e):e.length>=t&&n,lL=D.memo(e=>{const t=D.createRef(),{labelField:n,minQueryLength:r,isFocused:o,classNames:a,selectedIndex:i,query:s}=e;D.useEffect(()=>{if(!t.current)return;const e=t.current.querySelector(`.${a.activeSuggestion}`);e&&((e,t)=>{const n=t.offsetHeight,r=e.offsetHeight,o=e.offsetTop-t.scrollTop;o+r>=n?t.scrollTop+=o-n+r:o<0&&(t.scrollTop+=o)})(e,t.current)},[i]);const l=(e,t)=>{const r=t.trim().replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),{[n]:o}=e;return{__html:o.replace(RegExp(r,"gi"),e=>`<mark>${FA(e)}</mark>`)}},u=(t,n)=>"function"==typeof e.renderSuggestion?e.renderSuggestion(t,n):m.jsx("span",{dangerouslySetInnerHTML:l(t,n)}),c=e.suggestions.map((t,n)=>m.jsx("li",{onMouseDown:e.handleClick.bind(null,n),onTouchStart:e.handleClick.bind(null,n),onMouseOver:e.handleHover.bind(null,n),className:n===e.selectedIndex?e.classNames.activeSuggestion:"",children:u(t,e.query)},n));return 0!==c.length&&sL(s,r||2,o,e.shouldRenderSuggestions)?m.jsx("div",{ref:t,className:a.suggestions,"data-testid":"suggestions",children:m.jsxs("ul",{children:[" ",c," "]})}):null},(e,t)=>{const{query:n,minQueryLength:r=2,isFocused:o,suggestions:a}=t;return!(e.isFocused!==o||!BA(e.suggestions,a)||sL(n,r,o,t.shouldRenderSuggestions)!==sL(e.query,e.minQueryLength??2,e.isFocused,e.shouldRenderSuggestions)||e.selectedIndex!==t.selectedIndex)}),uL=lL,cL=TD(DD()),dL=e=>{const{autofocus:t,autoFocus:n,readOnly:r,labelField:o,allowDeleteFromEmptyInput:a,allowAdditionFromPaste:i,allowDragDrop:s,minQueryLength:l,shouldRenderSuggestions:u,removeComponent:c,autocomplete:d,inline:f,maxTags:p,allowUnique:h,editable:g,placeholder:y,delimiters:v,separators:b,tags:w,inputFieldPosition:x,inputProps:C,classNames:S,maxLength:k,inputValue:_,clearAll:E,ariaAttrs:j}=e,[N,R]=D.useState(e.suggestions),[O,P]=D.useState(""),[T,M]=D.useState(!1),[I,A]=D.useState(-1),[L,F]=D.useState(!1),[z,$]=D.useState(""),[H,B]=D.useState(-1),[V,U]=D.useState(""),q=D.createRef(),W=D.useRef(null),Y=D.useRef(null);D.useEffect(()=>{v.length&&console.warn("[Deprecation] The delimiters prop is deprecated and will be removed in v7.x.x, please use separators instead. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/960")},[]),D.useEffect(()=>{void 0!==f&&console.warn("[Deprecation] The inline attribute is deprecated and will be removed in v7.x.x, please use inputFieldPosition instead.")},[f]),D.useEffect(()=>{void 0!==t&&console.warn("[Deprecated] autofocus prop will be removed in 7.x so please migrate to autoFocus prop."),(t||n&&!1!==t)&&!r&&Q()},[n,n,r]),D.useEffect(()=>{ee()},[O,e.suggestions]);const G=t=>{let n=e.suggestions.slice();if(h){const e=w.map(e=>e.id.trim().toLowerCase());n=n.filter(t=>!e.includes(t.id.toLowerCase()))}if(e.handleFilterSuggestions)return e.handleFilterSuggestions(t,n);const r=n.filter(e=>0===K(t,e)),o=n.filter(e=>K(t,e)>0);return r.concat(o)},K=(e,t)=>t[o].toLowerCase().indexOf(e.toLowerCase()),Q=()=>{P(""),W.current&&(W.current.value="",W.current.focus())},Z=(t,n)=>{n.preventDefault(),n.stopPropagation();const r=w.slice();0!==r.length&&(U(""),e?.handleDelete?.(t,n),X(t,r))},X=(e,t)=>{if(!q?.current)return;const n=q.current.querySelectorAll(".ReactTags__remove");let r="";0===e&&t.length>1?(r=`Tag at index ${e} with value ${t[e].id} deleted. Tag at index 0 with value ${t[1].id} focussed. Press backspace to remove`,n[0].focus()):e>0?(r=`Tag at index ${e} with value ${t[e].id} deleted. Tag at index ${e-1} with value ${t[e-1].id} focussed. Press backspace to remove`,n[e-1].focus()):(r=`Tag at index ${e} with value ${t[e].id} deleted. Input focussed. Press enter to add a new tag`,W.current?.focus()),$(r)},J=t=>{e.handleInputChange&&e.handleInputChange(t.target.value,t);const n=t.target.value.trim();P(n)},ee=()=>{const e=G(O);R(e),A(I>=e.length?e.length-1:I)},te=t=>{const n=t.target.value;e.handleInputFocus&&e.handleInputFocus(n,t),M(!0)},ne=t=>{const n=t.target.value;e.handleInputBlur&&(e.handleInputBlur(n,t),W.current&&(W.current.value="")),M(!1),B(-1)},re=e=>{if(!e.nativeEvent.isComposing){if("Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),A(-1),F(!1),R([]),B(-1)),(-1!==b.indexOf(e.key)||-1!==v.indexOf(e.keyCode))&&!e.shiftKey){e.keyCode===YA.TAB&&""===O||e.preventDefault();const t=L&&-1!==I?N[I]:{id:O.trim(),[o]:O.trim(),className:""};Object.keys(t)&&ie(t)}"Backspace"!==e.key||""!==O||!a&&x!==XA||Z(w.length-1,e),e.keyCode===YA.UP_ARROW&&(e.preventDefault(),A(I<=0?N.length-1:I-1),F(!0)),e.keyCode===YA.DOWN_ARROW&&(e.preventDefault(),F(!0),0===N.length?A(-1):A((I+1)%N.length))}},oe=()=>p&&w.length>=p,ae=t=>{if(!i)return;if(oe())return U(tL),void Q();U(""),t.preventDefault();const n=t.clipboardData||window.clipboardData,r=n.getData("text"),{maxLength:a=r.length}=e,s=Math.min(a,r.length),l=n.getData("text").substr(0,s);let u=v;b.length&&(u=[],b.forEach(e=>{const t=function(e){switch(e){case GA.ENTER:return[10,13];case GA.TAB:return 9;case GA.COMMA:return 188;case GA.SPACE:return 32;case GA.SEMICOLON:return 186;default:return 0}}(e);Array.isArray(t)?u=[...u,...t]:u.push(t)}));const c=function(e){const t=e.map(e=>{const t=e-48*Math.floor(e/48);return String.fromCharCode(96<=e?t:e)}).join(""),n=HA(t);return new RegExp(`[${n}]+`)}(u),d=l.split(c).map(e=>e.trim());WA(d).forEach(e=>ie({id:e.trim(),[o]:e.trim(),className:""}))},ie=t=>{if(!t.id||!t[o])return;if(-1===H){if(oe())return U(tL),void Q();U("")}const n=w.map(e=>e.id.toLowerCase());if(!(h&&n.indexOf(t.id.trim().toLowerCase())>=0)){if(d){const e=G(t[o]);console.warn("[Deprecation] The autocomplete prop will be removed in 7.x to simplify the integration and make it more intutive. If you have any concerns regarding this, please share your thoughts in https://github.com/react-tags/react-tags/issues/949"),(1===d&&1===e.length||!0===d&&e.length)&&(t=e[0])}-1!==H&&e.onTagUpdate?e.onTagUpdate(H,t):e?.handleAddition?.(t),P(""),F(!1),A(-1),B(-1),Q()}},se=(t,n)=>{const r=w[t];e?.handleDrag?.(r,t,n)},le=(()=>{const t={...ZA,...e.classNames};return w.map((n,a)=>m.jsx(D.Fragment,{children:H===a?m.jsx("div",{className:t.editTagInput,children:m.jsx("input",{ref:e=>{Y.current=e},onFocus:te,value:O,onChange:J,onKeyDown:re,onBlur:ne,className:t.editTagInputField,onPaste:ae,"data-testid":"tag-edit"})}):m.jsx(aL,{index:a,tag:n,tags:w,labelField:o,onDelete:e=>Z(a,e),moveTag:s?se:void 0,removeComponent:c,onTagClicked:t=>((t,n,a)=>{r||(g&&(B(t),P(n[o]),Y.current?.focus()),e.handleTagClick?.(t,a))})(a,n,t),readOnly:r,classNames:t,allowDragDrop:s})},a))})(),ue={...ZA,...S},{name:ce,id:de}=e,fe=!1===f?eL:x,pe=r?null:m.jsxs("div",{className:ue.tagInput,children:[m.jsx("input",{...C,ref:e=>{W.current=e},className:ue.tagInputField,type:"text",placeholder:y,"aria-label":y,onFocus:te,onBlur:ne,onChange:J,onKeyDown:re,onPaste:ae,name:ce,id:de,maxLength:k,value:_,"data-automation":"input","data-testid":"input"}),m.jsx(uL,{query:O.trim(),suggestions:N,labelField:o,selectedIndex:I,handleClick:e=>{ie(N[e])},handleHover:e=>{A(e),F(!0)},minQueryLength:l,shouldRenderSuggestions:u,isFocused:T,classNames:ue,renderSuggestion:e.renderSuggestion}),E&&w.length>0&&m.jsx(iL,{"aria-label":j?.clearAllLabel,classNames:ue,onClick:()=>{e.onClearAll&&e.onClearAll(),U(""),Q()}}),V&&m.jsxs("div",{"data-testid":"error",className:"ReactTags__error",children:[m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",height:"24",width:"24",fill:"#e03131",children:m.jsx("path",{d:"M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"})}),V]})]});return m.jsxs("div",{className:(0,cL.default)(ue.tags,"react-tags-wrapper"),ref:q,children:[m.jsx("p",{role:"alert",className:"sr-only",style:{position:"absolute",overflow:"hidden",clip:"rect(0 0 0 0)",margin:"-1px",padding:0,width:"1px",height:"1px",border:0},children:z}),fe===JA&&pe,m.jsxs("div",{className:ue.selected,children:[le,fe===XA&&pe]}),fe===eL&&pe]})},fL=e=>{const{placeholder:t=KA,labelField:n=QA,suggestions:r=[],delimiters:o=[],separators:a=(e.delimiters?.length?[]:[GA.ENTER,GA.TAB]),autofocus:i,autoFocus:s=!0,inline:l,inputFieldPosition:u="inline",allowDeleteFromEmptyInput:c=!1,allowAdditionFromPaste:d=!0,autocomplete:f=!1,readOnly:p=!1,allowUnique:h=!0,allowDragDrop:g=!0,tags:y=[],inputProps:v={},editable:b=!1,clearAll:w=!1,ariaAttrs:x={clearAllLabel:"clear all tags"},handleDelete:C,handleAddition:S,onTagUpdate:k,handleDrag:_,handleFilterSuggestions:E,handleTagClick:j,handleInputChange:N,handleInputFocus:R,handleInputBlur:O,minQueryLength:P,shouldRenderSuggestions:T,removeComponent:D,onClearAll:M,classNames:I,name:A,id:L,maxLength:F,inputValue:z,maxTags:$,renderSuggestion:H}=e;return m.jsx(dL,{placeholder:t,labelField:n,suggestions:r,delimiters:o,separators:a,autofocus:i,autoFocus:s,inline:l,inputFieldPosition:u,allowDeleteFromEmptyInput:c,allowAdditionFromPaste:d,autocomplete:f,readOnly:p,allowUnique:h,allowDragDrop:g,tags:y,inputProps:v,editable:b,clearAll:w,ariaAttrs:x,handleDelete:C,handleAddition:S,onTagUpdate:k,handleDrag:_,handleFilterSuggestions:E,handleTagClick:j,handleInputChange:N,handleInputFocus:R,handleInputBlur:O,minQueryLength:P,shouldRenderSuggestions:T,removeComponent:D,onClearAll:M,classNames:I,name:A,id:L,maxLength:F,inputValue:z,maxTags:$,renderSuggestion:H})},pL=({...e})=>m.jsx(ET,{backend:SD,children:m.jsx(fL,{...e})});
|
|
224
224
|
/*! Bundled license information:
|
|
225
225
|
|
|
226
226
|
classnames/index.js:
|