From 1e20911df0b3142f46f4df054e0b0f8a6a929a60 Mon Sep 17 00:00:00 2001 From: yafimski Date: Mon, 8 Jul 2024 14:25:21 +0300 Subject: [PATCH] Updates --- ...leryItem-D-sf48nQ.js => IngredientGalleryItem-BZCDq89T.js} | 2 +- assets/{index-CKkJiJIL.js => index-BdOK1l_j.js} | 4 ++-- index.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename assets/{IngredientGalleryItem-D-sf48nQ.js => IngredientGalleryItem-BZCDq89T.js} (94%) rename assets/{index-CKkJiJIL.js => index-BdOK1l_j.js} (95%) diff --git a/assets/IngredientGalleryItem-D-sf48nQ.js b/assets/IngredientGalleryItem-BZCDq89T.js similarity index 94% rename from assets/IngredientGalleryItem-D-sf48nQ.js rename to assets/IngredientGalleryItem-BZCDq89T.js index d9913df..6f7c069 100644 --- a/assets/IngredientGalleryItem-D-sf48nQ.js +++ b/assets/IngredientGalleryItem-BZCDq89T.js @@ -1 +1 @@ -import{u as a,a as u,j as r,h as m,F as x,f as g,s as o,b as f}from"./index-CKkJiJIL.js";function N({item:c}){const{itemName:e}=c,l=a(t=>t.groups.ingredientsGroups),s=a(t=>t.recipe.currentGroupName),n=u(),d=()=>{var t;if(!s)n(o("Ingredient group cannot be empty"));else{const p=(t=l.filter(i=>i.groupName===s)[0])==null?void 0:t.items.filter(i=>i.itemName===e)[0];n(p?o("Ingredient is already in the group!"):f({groupName:s,itemName:e}))}};return r.jsx("div",{className:"flex flex-row","data-testid":`${e}_gallery`,children:r.jsxs("div",{className:"relative flex flex-col print-rounded card-shadow w-cw aspect-videoReverse",children:[r.jsx("img",{src:`/assets/ingredients/${e.toLowerCase()}.webp`,alt:e,className:"print-rounded"}),r.jsx("div",{className:"absolute inset-0 flex center bg-white print-rounded bg-opacity-70 opacity-0 hover:opacity-100 hover:cursor-pointer transition-opacity",onClick:()=>d(),onKeyDown:m,children:r.jsx(x,{icon:g,className:"cursor-pointer text-4xl text-green-600"})}),r.jsx("p",{className:"flex flex-grow rounded-b-2xl center px-4 text-center text-fluidPrintTitle",children:e})]})})}export{N as default}; +import{u as a,a as u,j as r,h as m,F as x,f as g,s as o,b as f}from"./index-BdOK1l_j.js";function N({item:c}){const{itemName:e}=c,l=a(t=>t.groups.ingredientsGroups),s=a(t=>t.recipe.currentGroupName),n=u(),d=()=>{var t;if(!s)n(o("Ingredient group cannot be empty"));else{const p=(t=l.filter(i=>i.groupName===s)[0])==null?void 0:t.items.filter(i=>i.itemName===e)[0];n(p?o("Ingredient is already in the group!"):f({groupName:s,itemName:e}))}};return r.jsx("div",{className:"flex flex-row","data-testid":`${e}_gallery`,children:r.jsxs("div",{className:"relative flex flex-col print-rounded card-shadow w-cw aspect-videoReverse",children:[r.jsx("img",{src:`/assets/ingredients/${e.toLowerCase()}.webp`,alt:e,className:"print-rounded"}),r.jsx("div",{className:"absolute inset-0 flex center bg-white print-rounded bg-opacity-70 opacity-0 hover:opacity-100 hover:cursor-pointer transition-opacity",onClick:()=>d(),onKeyDown:m,children:r.jsx(x,{icon:g,className:"cursor-pointer text-4xl text-green-600"})}),r.jsx("p",{className:"flex flex-grow rounded-b-2xl center px-4 text-center text-fluidPrintTitle",children:e})]})})}export{N as default}; diff --git a/assets/index-CKkJiJIL.js b/assets/index-BdOK1l_j.js similarity index 95% rename from assets/index-CKkJiJIL.js rename to assets/index-BdOK1l_j.js index 142680c..a3f09fd 100644 --- a/assets/index-CKkJiJIL.js +++ b/assets/index-BdOK1l_j.js @@ -883,8 +883,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `+o:"")+` The above lifecycles should be removed. Learn more about this warning here: -https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=z2,t.componentWillReceiveProps=U2),typeof t.getSnapshotBeforeUpdate=="function"){if(typeof t.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=$2;var c=t.componentDidUpdate;t.componentDidUpdate=function(h,p,m){var v=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:m;c.call(this,h,p,v)}}return e}const xj=Object.freeze(Object.defineProperty({__proto__:null,polyfill:wj},Symbol.toStringTag,{value:"Module"})),bj=CT(xj);Object.defineProperty(fa,"__esModule",{value:!0});fa.bodyOpenClassName=fa.portalClassName=void 0;var Ox=Object.assign||function(e){for(var t=1;t{r(c=>(c+1)%to.length)},[]),l=O.useCallback(()=>{r(c=>c===0?to.length-1:c-1)},[]),s=O.useCallback(c=>{c.key==="ArrowRight"?o():c.key==="ArrowLeft"&&l()},[o,l]);return O.useEffect(()=>(e?document.addEventListener("keydown",s):document.removeEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}),[e,s]),Lx.setAppElement(document.getElementById("root")),x.jsx(Lx,{isOpen:e,onRequestClose:()=>t(),className:"modal-container",overlayClassName:"modal-overlay",shouldCloseOnOverlayClick:!0,children:x.jsxs("div",{className:"modal-content",children:[x.jsx("button",{type:"button",className:"close-modal-button",onClick:()=>t(),children:x.jsx(Ln,{icon:yd,className:"nav-icon"})}),x.jsx("span",{className:"modal-image-title",children:to[n]}),x.jsx("img",{src:`/assets/ingredients/${to[n].toLowerCase()}.webp`,alt:`${to[n]}`,className:"modal-image"}),x.jsxs("div",{className:"modal-nav-buttons",children:[x.jsx("button",{type:"button",className:"nav-button prev",onClick:l,children:x.jsx(Ln,{icon:PL,className:"nav-icon"})}),x.jsx("button",{type:"button",className:"nav-button next",onClick:o,children:x.jsx(Ln,{icon:TL,className:"nav-icon"})})]})]})})}const Mj=O.lazy(()=>NL(()=>import("./IngredientGalleryItem-D-sf48nQ.js"),[]));function jj(){const[e,t]=O.useState(!1),n=He(o=>o.recipe.possibleItems),r=n.length<5?"flex flex-row gap-x-8":"grid-autofill";return x.jsxs(x.Fragment,{children:[!e&&x.jsxs("div",{className:"modal-open-button",onClick:()=>t(!0),onKeyDown:Oi,children:["CLICK ME",x.jsx("br",{}),'to say "Wow"',x.jsx("br",{}),'and "Ooooh"']}),x.jsx(Lj,{isOpen:e,onClose:()=>t(!1)}),x.jsx("div",{className:"flex flex-row overflow-auto no-scrollbar justify-evenly",children:x.jsx("div",{className:`flex flex-row flex-wrap center gap-y-8 gap-x-4 ${r}`,children:n.map(o=>x.jsx(O.Suspense,{fallback:x.jsx("div",{className:"suspense-gallery-item","data-testid":`${o}_suspense`,children:""}),children:x.jsx(Mj,{item:{itemName:o,amount:0,unit:ml}})},`${o}_suspense`))})})]})}function Fj(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(o=>o(r))},t)}const Cd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kl(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Tg(e){return"nodeType"in e}function bn(e){var t,n;return e?kl(e)?e:Tg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Ig(e){const{Document:t}=bn(e);return e instanceof t}function vu(e){return kl(e)?!1:e instanceof bn(e).HTMLElement}function W2(e){return e instanceof bn(e).SVGElement}function Rl(e){return e?kl(e)?e.document:Tg(e)?Ig(e)?e:vu(e)||W2(e)?e.ownerDocument:document:document:document}const Ur=Cd?O.useLayoutEffect:O.useEffect;function Ed(e){const t=O.useRef(e);return Ur(()=>{t.current=e}),O.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=O.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function nu(e,t){t===void 0&&(t=[e]);const n=O.useRef(e);return Ur(()=>{n.current!==e&&(n.current=e)},t),n}function gu(e,t){const n=O.useRef();return O.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function $f(e){const t=Ed(e),n=O.useRef(null),r=O.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function Bf(e){const t=O.useRef();return O.useEffect(()=>{t.current=e},[e]),t.current}let Eh={};function Nd(e,t){return O.useMemo(()=>{if(t)return t;const n=Eh[e]==null?0:Eh[e]+1;return Eh[e]=n,e+"-"+n},[e,t])}function H2(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const c=Object.entries(s);for(const[f,h]of c){const p=l[f];p!=null&&(l[f]=p+e*h)}return l},{...t})}}const al=H2(1),Wf=H2(-1);function Uj(e){return"clientX"in e&&"clientY"in e}function kd(e){if(!e)return!1;const{KeyboardEvent:t}=bn(e.target);return t&&e instanceof t}function $j(e){if(!e)return!1;const{TouchEvent:t}=bn(e.target);return t&&e instanceof t}function Hf(e){if($j(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Uj(e)?{x:e.clientX,y:e.clientY}:null}const ki=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ki.Translate.toString(e),ki.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Mx="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bj(e){return e.matches(Mx)?e:e.querySelector(Mx)}const Wj={display:"none"};function Hj(e){let{id:t,value:n}=e;return Qe.createElement("div",{id:t,style:Wj},n)}function Gj(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Qe.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Kj(){const[e,t]=O.useState("");return{announce:O.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const G2=O.createContext(null);function Yj(e){const t=O.useContext(G2);O.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Vj(){const[e]=O.useState(()=>new Set),t=O.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[O.useCallback(r=>{let{type:o,event:l}=r;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,l)})},[e]),t]}const qj={draggable:` +https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=z2,t.componentWillReceiveProps=U2),typeof t.getSnapshotBeforeUpdate=="function"){if(typeof t.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=$2;var c=t.componentDidUpdate;t.componentDidUpdate=function(h,p,m){var v=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:m;c.call(this,h,p,v)}}return e}const xj=Object.freeze(Object.defineProperty({__proto__:null,polyfill:wj},Symbol.toStringTag,{value:"Module"})),bj=CT(xj);Object.defineProperty(fa,"__esModule",{value:!0});fa.bodyOpenClassName=fa.portalClassName=void 0;var Ox=Object.assign||function(e){for(var t=1;t{r(c=>(c+1)%to.length)},[]),l=O.useCallback(()=>{r(c=>c===0?to.length-1:c-1)},[]),s=O.useCallback(c=>{c.key==="ArrowRight"?o():c.key==="ArrowLeft"&&l()},[o,l]);return O.useEffect(()=>(e?document.addEventListener("keydown",s):document.removeEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}),[e,s]),Lx.setAppElement(document.getElementById("root")),x.jsx(Lx,{isOpen:e,onRequestClose:()=>t(),className:"modal-container",overlayClassName:"modal-overlay",shouldCloseOnOverlayClick:!0,children:x.jsxs("div",{className:"modal-content",children:[x.jsx("button",{type:"button",className:"close-modal-button",onClick:()=>t(),children:x.jsx(Ln,{icon:yd,className:"nav-icon"})}),x.jsx("span",{className:"modal-image-title",children:to[n]}),x.jsx("img",{src:`/assets/ingredients/${to[n].toLowerCase()}.webp`,alt:`${to[n]}`,className:"modal-image"}),x.jsxs("div",{className:"modal-nav-buttons",children:[x.jsx("button",{type:"button",className:"nav-button prev",onClick:l,children:x.jsx(Ln,{icon:PL,className:"nav-icon"})}),x.jsx("button",{type:"button",className:"nav-button next",onClick:o,children:x.jsx(Ln,{icon:TL,className:"nav-icon"})})]})]})})}const Mj=O.lazy(()=>NL(()=>import("./IngredientGalleryItem-BZCDq89T.js"),[]));function jj(){const[e,t]=O.useState(!1),n=He(o=>o.recipe.possibleItems),r=n.length<5?"flex flex-row gap-x-8":"grid-autofill";return x.jsxs(x.Fragment,{children:[!e&&x.jsxs("div",{className:"modal-open-button",onClick:()=>t(!0),onKeyDown:Oi,children:["CLICK ME",x.jsx("br",{}),'to say "Wow"',x.jsx("br",{}),'and "Ooooh"']}),x.jsx(Lj,{isOpen:e,onClose:()=>t(!1)}),x.jsx("div",{className:"flex flex-row overflow-auto no-scrollbar justify-evenly",children:x.jsx("div",{className:`flex flex-row flex-wrap center gap-y-8 gap-x-4 ${r}`,children:n.map(o=>x.jsx(O.Suspense,{fallback:x.jsx("div",{className:"suspense-gallery-item","data-testid":`${o}_suspense`,children:""}),children:x.jsx(Mj,{item:{itemName:o,amount:0,unit:ml}})},`${o}_suspense`))})})]})}function Fj(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(o=>o(r))},t)}const Cd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kl(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Tg(e){return"nodeType"in e}function bn(e){var t,n;return e?kl(e)?e:Tg(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Ig(e){const{Document:t}=bn(e);return e instanceof t}function vu(e){return kl(e)?!1:e instanceof bn(e).HTMLElement}function W2(e){return e instanceof bn(e).SVGElement}function Rl(e){return e?kl(e)?e.document:Tg(e)?Ig(e)?e:vu(e)||W2(e)?e.ownerDocument:document:document:document}const Ur=Cd?O.useLayoutEffect:O.useEffect;function Ed(e){const t=O.useRef(e);return Ur(()=>{t.current=e}),O.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o{e.current=setInterval(r,o)},[]),n=O.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function nu(e,t){t===void 0&&(t=[e]);const n=O.useRef(e);return Ur(()=>{n.current!==e&&(n.current=e)},t),n}function gu(e,t){const n=O.useRef();return O.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function $f(e){const t=Ed(e),n=O.useRef(null),r=O.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function Bf(e){const t=O.useRef();return O.useEffect(()=>{t.current=e},[e]),t.current}let Eh={};function Nd(e,t){return O.useMemo(()=>{if(t)return t;const n=Eh[e]==null?0:Eh[e]+1;return Eh[e]=n,e+"-"+n},[e,t])}function H2(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{const c=Object.entries(s);for(const[f,h]of c){const p=l[f];p!=null&&(l[f]=p+e*h)}return l},{...t})}}const al=H2(1),Wf=H2(-1);function Uj(e){return"clientX"in e&&"clientY"in e}function kd(e){if(!e)return!1;const{KeyboardEvent:t}=bn(e.target);return t&&e instanceof t}function $j(e){if(!e)return!1;const{TouchEvent:t}=bn(e.target);return t&&e instanceof t}function Hf(e){if($j(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Uj(e)?{x:e.clientX,y:e.clientY}:null}const ki=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[ki.Translate.toString(e),ki.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Mx="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Bj(e){return e.matches(Mx)?e:e.querySelector(Mx)}const Wj={display:"none"};function Hj(e){let{id:t,value:n}=e;return Qe.createElement("div",{id:t,style:Wj},n)}function Gj(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Qe.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Kj(){const[e,t]=O.useState("");return{announce:O.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const G2=O.createContext(null);function Yj(e){const t=O.useContext(G2);O.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Vj(){const[e]=O.useState(()=>new Set),t=O.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[O.useCallback(r=>{let{type:o,event:l}=r;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,l)})},[e]),t]}const qj={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},Xj={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Qj(e){let{announcements:t=Xj,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=qj}=e;const{announce:l,announcement:s}=Kj(),c=Nd("DndLiveRegion"),[f,h]=O.useState(!1);if(O.useEffect(()=>{h(!0)},[]),Yj(O.useMemo(()=>({onDragStart(m){let{active:v}=m;l(t.onDragStart({active:v}))},onDragMove(m){let{active:v,over:S}=m;t.onDragMove&&l(t.onDragMove({active:v,over:S}))},onDragOver(m){let{active:v,over:S}=m;l(t.onDragOver({active:v,over:S}))},onDragEnd(m){let{active:v,over:S}=m;l(t.onDragEnd({active:v,over:S}))},onDragCancel(m){let{active:v,over:S}=m;l(t.onDragCancel({active:v,over:S}))}}),[l,t])),!f)return null;const p=Qe.createElement(Qe.Fragment,null,Qe.createElement(Hj,{id:r,value:o.draggable}),Qe.createElement(Gj,{id:c,announcement:s}));return n?Zr.createPortal(p,n):p}var At;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(At||(At={}));function Gf(){}function Kf(e,t){return O.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function K2(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const $r=Object.freeze({x:0,y:0});function Y2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zj(e,t){const n=Hf(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function V2(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Jj(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ev(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function e6(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const q2=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ev(t),l=[];for(const s of r){const{id:c}=s,f=n.get(c);if(f){const h=ev(f),p=o.reduce((v,S,E)=>v+Y2(h[E],S),0),m=Number((p/4).toFixed(4));l.push({id:c,data:{droppableContainer:s,value:m}})}}return l.sort(V2)};function t6(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),s=o-r,c=l-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const l of r){const{id:s}=l,c=n.get(s);if(c){const f=t6(c,t);f>0&&o.push({id:s,data:{droppableContainer:l,value:f}})}}return o.sort(Jj)};function r6(e,t){const{top:n,left:r,bottom:o,right:l}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=l}const X2=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const o=[];for(const l of t){const{id:s}=l,c=n.get(s);if(c&&r6(r,c)){const h=ev(c).reduce((m,v)=>m+Y2(r,v),0),p=Number((h/4).toFixed(4));o.push({id:s,data:{droppableContainer:l,value:p}})}}return o.sort(V2)};function i6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Q2(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$r}function o6(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...n})}}const a6=o6(1);function Z2(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function l6(e,t,n){const r=Z2(t);if(!r)return e;const{scaleX:o,scaleY:l,x:s,y:c}=r,f=e.left-s-(1-o)*parseFloat(n),h=e.top-c-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,m=l?e.height/l:e.height;return{width:p,height:m,top:h,right:f+p,bottom:h+m,left:f}}const s6={ignoreTransform:!1};function Ol(e,t){t===void 0&&(t=s6);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:p}=bn(e).getComputedStyle(e);h&&(n=l6(n,h,p))}const{top:r,left:o,width:l,height:s,bottom:c,right:f}=n;return{top:r,left:o,width:l,height:s,bottom:c,right:f}}function jx(e){return Ol(e,{ignoreTransform:!0})}function u6(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function c6(e,t){return t===void 0&&(t=bn(e).getComputedStyle(e)),t.position==="fixed"}function f6(e,t){t===void 0&&(t=bn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const l=t[o];return typeof l=="string"?n.test(l):!1})}function Ag(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Ig(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!vu(o)||W2(o)||n.includes(o))return n;const l=bn(e).getComputedStyle(o);return o!==e&&f6(o,l)&&n.push(o),c6(o,l)?n:r(o.parentNode)}return e?r(e):n}function J2(e){const[t]=Ag(e,1);return t??null}function Nh(e){return!Cd||!e?null:kl(e)?e:Tg(e)?Ig(e)||e===Rl(e).scrollingElement?window:vu(e)?e:null:null}function eC(e){return kl(e)?e.scrollX:e.scrollLeft}function tC(e){return kl(e)?e.scrollY:e.scrollTop}function tv(e){return{x:eC(e),y:tC(e)}}var Wt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Wt||(Wt={}));function nC(e){return!Cd||!e?!1:e===document.scrollingElement}function rC(e){const t={x:0,y:0},n=nC(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:l,isBottom:s,isRight:c,maxScroll:r,minScroll:t}}const d6={x:.2,y:.2};function p6(e,t,n,r,o){let{top:l,left:s,right:c,bottom:f}=n;r===void 0&&(r=10),o===void 0&&(o=d6);const{isTop:h,isBottom:p,isLeft:m,isRight:v}=rC(e),S={x:0,y:0},E={x:0,y:0},N={height:t.height*o.y,width:t.width*o.x};return!h&&l<=t.top+N.height?(S.y=Wt.Backward,E.y=r*Math.abs((t.top+N.height-l)/N.height)):!p&&f>=t.bottom-N.height&&(S.y=Wt.Forward,E.y=r*Math.abs((t.bottom-N.height-f)/N.height)),!v&&c>=t.right-N.width?(S.x=Wt.Forward,E.x=r*Math.abs((t.right-N.width-c)/N.width)):!m&&s<=t.left+N.width&&(S.x=Wt.Backward,E.x=r*Math.abs((t.left+N.width-s)/N.width)),{direction:S,speed:E}}function h6(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:s}=window;return{top:0,left:0,right:l,bottom:s,width:l,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function iC(e){return e.reduce((t,n)=>al(t,tv(n)),$r)}function m6(e){return e.reduce((t,n)=>t+eC(n),0)}function v6(e){return e.reduce((t,n)=>t+tC(n),0)}function oC(e,t){if(t===void 0&&(t=Ol),!e)return;const{top:n,left:r,bottom:o,right:l}=t(e);J2(e)&&(o<=0||l<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const g6=[["x",["left","right"],m6],["y",["top","bottom"],v6]];class Dg{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ag(n),o=iC(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,s,c]of g6)for(const f of s)Object.defineProperty(this,f,{get:()=>{const h=c(r),p=o[l]-h;return this.rect[f]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Es{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function y6(e){const{EventTarget:t}=bn(e);return e instanceof t?e:Rl(e)}function kh(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var pr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(pr||(pr={}));function Fx(e){e.preventDefault()}function w6(e){e.stopPropagation()}var We;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(We||(We={}));const aC={start:[We.Space,We.Enter],cancel:[We.Esc],end:[We.Space,We.Enter]},x6=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case We.Right:return{...n,x:n.x+25};case We.Left:return{...n,x:n.x-25};case We.Down:return{...n,y:n.y+25};case We.Up:return{...n,y:n.y-25}}};class lC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Es(Rl(n)),this.windowListeners=new Es(bn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pr.Resize,this.handleCancel),this.windowListeners.add(pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&oC(r),n($r)}handleKeyDown(t){if(kd(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:l=aC,coordinateGetter:s=x6,scrollBehavior:c="smooth"}=o,{code:f}=t;if(l.end.includes(f)){this.handleEnd(t);return}if(l.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:h}=r.current,p=h?{x:h.left,y:h.top}:$r;this.referenceCoordinates||(this.referenceCoordinates=p);const m=s(t,{active:n,context:r.current,currentCoordinates:p});if(m){const v=Wf(m,p),S={x:0,y:0},{scrollableAncestors:E}=r.current;for(const N of E){const T=t.code,{isTop:_,isRight:b,isLeft:C,isBottom:I,maxScroll:M,minScroll:G}=rC(N),k=h6(N),B={x:Math.min(T===We.Right?k.right-k.width/2:k.right,Math.max(T===We.Right?k.left:k.left+k.width/2,m.x)),y:Math.min(T===We.Down?k.bottom-k.height/2:k.bottom,Math.max(T===We.Down?k.top:k.top+k.height/2,m.y))},U=T===We.Right&&!b||T===We.Left&&!C,K=T===We.Down&&!I||T===We.Up&&!_;if(U&&B.x!==m.x){const Z=N.scrollLeft+v.x,he=T===We.Right&&Z<=M.x||T===We.Left&&Z>=G.x;if(he&&!v.y){N.scrollTo({left:Z,behavior:c});return}he?S.x=N.scrollLeft-Z:S.x=T===We.Right?N.scrollLeft-M.x:N.scrollLeft-G.x,S.x&&N.scrollBy({left:-S.x,behavior:c});break}else if(K&&B.y!==m.y){const Z=N.scrollTop+v.y,he=T===We.Down&&Z<=M.y||T===We.Up&&Z>=G.y;if(he&&!v.x){N.scrollTo({top:Z,behavior:c});return}he?S.y=N.scrollTop-Z:S.y=T===We.Down?N.scrollTop-M.y:N.scrollTop-G.y,S.y&&N.scrollBy({top:-S.y,behavior:c});break}}this.handleMove(t,al(Wf(m,this.referenceCoordinates),S))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}lC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=aC,onActivation:o}=t,{active:l}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const c=l.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function zx(e){return!!(e&&"distance"in e)}function Ux(e){return!!(e&&"delay"in e)}class Lg{constructor(t,n,r){var o;r===void 0&&(r=y6(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:s}=l;this.props=t,this.events=n,this.document=Rl(s),this.documentListeners=new Es(this.document),this.listeners=new Es(r),this.windowListeners=new Es(bn(s)),this.initialCoordinates=(o=Hf(l))!=null?o:$r,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(pr.Resize,this.handleCancel),this.windowListeners.add(pr.DragStart,Fx),this.windowListeners.add(pr.VisibilityChange,this.handleCancel),this.windowListeners.add(pr.ContextMenu,Fx),this.documentListeners.add(pr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ux(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(zx(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(pr.Click,w6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:l}=this,{onMove:s,options:{activationConstraint:c}}=l;if(!o)return;const f=(n=Hf(t))!=null?n:$r,h=Wf(o,f);if(!r&&c){if(zx(c)){if(c.tolerance!=null&&kh(h,c.tolerance))return this.handleCancel();if(kh(h,c.distance))return this.handleStart()}return Ux(c)&&kh(h,c.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),s(f)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===We.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const b6={move:{name:"pointermove"},end:{name:"pointerup"}};class sC extends Lg{constructor(t){const{event:n}=t,r=Rl(n.target);super(t,b6,r)}}sC.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const S6={move:{name:"mousemove"},end:{name:"mouseup"}};var nv;(function(e){e[e.RightClick=2]="RightClick"})(nv||(nv={}));class Mg extends Lg{constructor(t){super(t,S6,Rl(t.event.target))}}Mg.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===nv.RightClick?!1:(r==null||r({event:n}),!0)}}];const Rh={move:{name:"touchmove"},end:{name:"touchend"}};class jg extends Lg{constructor(t){super(t,Rh)}static setup(){return window.addEventListener(Rh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rh.move.name,t)};function t(){}}}jg.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Ns;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ns||(Ns={}));var Yf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Yf||(Yf={}));function _6(e){let{acceleration:t,activator:n=Ns.Pointer,canScroll:r,draggingRect:o,enabled:l,interval:s=5,order:c=Yf.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:p,delta:m,threshold:v}=e;const S=E6({delta:m,disabled:!l}),[E,N]=zj(),T=O.useRef({x:0,y:0}),_=O.useRef({x:0,y:0}),b=O.useMemo(()=>{switch(n){case Ns.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Ns.DraggableRect:return o}},[n,o,f]),C=O.useRef(null),I=O.useCallback(()=>{const G=C.current;if(!G)return;const k=T.current.x*_.current.x,B=T.current.y*_.current.y;G.scrollBy(k,B)},[]),M=O.useMemo(()=>c===Yf.TreeOrder?[...h].reverse():h,[c,h]);O.useEffect(()=>{if(!l||!h.length||!b){N();return}for(const G of M){if((r==null?void 0:r(G))===!1)continue;const k=h.indexOf(G),B=p[k];if(!B)continue;const{direction:U,speed:K}=p6(G,B,b,t,v);for(const Z of["x","y"])S[Z][U[Z]]||(K[Z]=0,U[Z]=0);if(K.x>0||K.y>0){N(),C.current=G,E(I,s),T.current=K,_.current=U;return}}T.current={x:0,y:0},_.current={x:0,y:0},N()},[t,I,r,N,l,s,JSON.stringify(b),JSON.stringify(S),E,h,M,p,JSON.stringify(v)])}const C6={x:{[Wt.Backward]:!1,[Wt.Forward]:!1},y:{[Wt.Backward]:!1,[Wt.Forward]:!1}};function E6(e){let{delta:t,disabled:n}=e;const r=Bf(t);return gu(o=>{if(n||!r||!o)return C6;const l={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wt.Backward]:o.x[Wt.Backward]||l.x===-1,[Wt.Forward]:o.x[Wt.Forward]||l.x===1},y:{[Wt.Backward]:o.y[Wt.Backward]||l.y===-1,[Wt.Forward]:o.y[Wt.Forward]||l.y===1}}},[n,t,r])}function N6(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return gu(o=>{var l;return t===null?null:(l=r??o)!=null?l:null},[r,t])}function k6(e,t){return O.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,l=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...l]},[]),[e,t])}var ru;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ru||(ru={}));var rv;(function(e){e.Optimized="optimized"})(rv||(rv={}));const $x=new Map;function R6(e,t){let{dragging:n,dependencies:r,config:o}=t;const[l,s]=O.useState(null),{frequency:c,measure:f,strategy:h}=o,p=O.useRef(e),m=T(),v=nu(m),S=O.useCallback(function(_){_===void 0&&(_=[]),!v.current&&s(b=>b===null?_:b.concat(_.filter(C=>!b.includes(C))))},[v]),E=O.useRef(null),N=gu(_=>{if(m&&!n)return $x;if(!_||_===$x||p.current!==e||l!=null){const b=new Map;for(let C of e){if(!C)continue;if(l&&l.length>0&&!l.includes(C.id)&&C.rect.current){b.set(C.id,C.rect.current);continue}const I=C.node.current,M=I?new Dg(f(I),I):null;C.rect.current=M,M&&b.set(C.id,M)}return b}return _},[e,l,n,m,f]);return O.useEffect(()=>{p.current=e},[e]),O.useEffect(()=>{m||S()},[n,m]),O.useEffect(()=>{l&&l.length>0&&s(null)},[JSON.stringify(l)]),O.useEffect(()=>{m||typeof c!="number"||E.current!==null||(E.current=setTimeout(()=>{S(),E.current=null},c))},[c,m,S,...r]),{droppableRects:N,measureDroppableContainers:S,measuringScheduled:l!=null};function T(){switch(h){case ru.Always:return!1;case ru.BeforeDragging:return n;default:return!n}}}function Fg(e,t){return gu(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function O6(e,t){return Fg(e,t)}function P6(e){let{callback:t,disabled:n}=e;const r=Ed(t),o=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(r)},[r,n]);return O.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Rd(e){let{callback:t,disabled:n}=e;const r=Ed(t),o=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(r)},[n]);return O.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function T6(e){return new Dg(Ol(e),e)}function Bx(e,t,n){t===void 0&&(t=T6);const[r,o]=O.useReducer(c,null),l=P6({callback(f){if(e)for(const h of f){const{type:p,target:m}=h;if(p==="childList"&&m instanceof HTMLElement&&m.contains(e)){o();break}}}}),s=Rd({callback:o});return Ur(()=>{o(),e?(s==null||s.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),l==null||l.disconnect())},[e]),r;function c(f){if(!e)return null;if(e.isConnected===!1){var h;return(h=f??n)!=null?h:null}const p=t(e);return JSON.stringify(f)===JSON.stringify(p)?f:p}}function I6(e){const t=Fg(e);return Q2(e,t)}const Wx=[];function A6(e){const t=O.useRef(e),n=gu(r=>e?r&&r!==Wx&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ag(e):Wx,[e]);return O.useEffect(()=>{t.current=e},[e]),n}function D6(e){const[t,n]=O.useState(null),r=O.useRef(e),o=O.useCallback(l=>{const s=Nh(l.target);s&&n(c=>c?(c.set(s,tv(s)),new Map(c)):null)},[]);return O.useEffect(()=>{const l=r.current;if(e!==l){s(l);const c=e.map(f=>{const h=Nh(f);return h?(h.addEventListener("scroll",o,{passive:!0}),[h,tv(h)]):null}).filter(f=>f!=null);n(c.length?new Map(c):null),r.current=e}return()=>{s(e),s(l)};function s(c){c.forEach(f=>{const h=Nh(f);h==null||h.removeEventListener("scroll",o)})}},[o,e]),O.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,s)=>al(l,s),$r):iC(e):$r,[e,t])}function Hx(e,t){t===void 0&&(t=[]);const n=O.useRef(null);return O.useEffect(()=>{n.current=null},t),O.useEffect(()=>{const r=e!==$r;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Wf(e,n.current):$r}function L6(e){O.useEffect(()=>{if(!Cd)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function M6(e,t){return O.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:l}=r;return n[o]=s=>{l(s,t)},n},{}),[e,t])}function uC(e){return O.useMemo(()=>e?u6(e):null,[e])}const Oh=[];function j6(e,t){t===void 0&&(t=Ol);const[n]=e,r=uC(n?bn(n):null),[o,l]=O.useReducer(c,Oh),s=Rd({callback:l});return e.length>0&&o===Oh&&l(),Ur(()=>{e.length?e.forEach(f=>s==null?void 0:s.observe(f)):(s==null||s.disconnect(),l())},[e]),o;function c(){return e.length?e.map(f=>nC(f)?r:new Dg(t(f),f)):Oh}}function cC(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return vu(t)?t:e}function F6(e){let{measure:t}=e;const[n,r]=O.useState(null),o=O.useCallback(h=>{for(const{target:p}of h)if(vu(p)){r(m=>{const v=t(p);return m?{...m,width:v.width,height:v.height}:v});break}},[t]),l=Rd({callback:o}),s=O.useCallback(h=>{const p=cC(h);l==null||l.disconnect(),p&&(l==null||l.observe(p)),r(p?t(p):null)},[t,l]),[c,f]=$f(s);return O.useMemo(()=>({nodeRef:c,rect:n,setRef:f}),[n,c,f])}const z6=[{sensor:sC,options:{}},{sensor:lC,options:{}}],U6={current:{}},ef={draggable:{measure:jx},droppable:{measure:jx,strategy:ru.WhileDragging,frequency:rv.Optimized},dragOverlay:{measure:Ol}};class ks extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $6={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ks,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ef,measureDroppableContainers:Gf,windowRect:null,measuringScheduled:!1},fC={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gf,draggableNodes:new Map,over:null,measureDroppableContainers:Gf},yu=O.createContext(fC),dC=O.createContext($6);function B6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ks}}}function W6(e,t){switch(t.type){case At.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case At.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case At.DragEnd:case At.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case At.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new ks(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case At.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,l=e.droppable.containers.get(n);if(!l||r!==l.key)return e;const s=new ks(e.droppable.containers);return s.set(n,{...l,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case At.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new ks(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function H6(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=O.useContext(yu),l=Bf(r),s=Bf(n==null?void 0:n.id);return O.useEffect(()=>{if(!t&&!r&&l&&s!=null){if(!kd(l)||document.activeElement===l.target)return;const c=o.get(s);if(!c)return;const{activatorNode:f,node:h}=c;if(!f.current&&!h.current)return;requestAnimationFrame(()=>{for(const p of[f.current,h.current]){if(!p)continue;const m=Bj(p);if(m){m.focus();break}}})}},[r,t,o,s,l]),null}function pC(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,l)=>l({transform:o,...r}),n):n}function G6(e){return O.useMemo(()=>({draggable:{...ef.draggable,...e==null?void 0:e.draggable},droppable:{...ef.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ef.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function K6(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const l=O.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;Ur(()=>{if(!s&&!c||!t){l.current=!1;return}if(l.current||!r)return;const h=t==null?void 0:t.node.current;if(!h||h.isConnected===!1)return;const p=n(h),m=Q2(p,r);if(s||(m.x=0),c||(m.y=0),l.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const v=J2(h);v&&v.scrollBy({top:m.y,left:m.x})}},[t,s,c,r,n])}const Od=O.createContext({...$r,scaleX:1,scaleY:1});var Zi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Zi||(Zi={}));const hC=O.memo(function(t){var n,r,o,l;let{id:s,accessibility:c,autoScroll:f=!0,children:h,sensors:p=z6,collisionDetection:m=n6,measuring:v,modifiers:S,...E}=t;const N=O.useReducer(W6,void 0,B6),[T,_]=N,[b,C]=Vj(),[I,M]=O.useState(Zi.Uninitialized),G=I===Zi.Initialized,{draggable:{active:k,nodes:B,translate:U},droppable:{containers:K}}=T,Z=k?B.get(k):null,he=O.useRef({initial:null,translated:null}),be=O.useMemo(()=>{var dt;return k!=null?{id:k,data:(dt=Z==null?void 0:Z.data)!=null?dt:U6,rect:he}:null},[k,Z]),J=O.useRef(null),[oe,Ne]=O.useState(null),[F,z]=O.useState(null),te=nu(E,Object.values(E)),ne=Nd("DndDescribedBy",s),ae=O.useMemo(()=>K.getEnabled(),[K]),pe=G6(v),{droppableRects:Fe,measureDroppableContainers:Ve,measuringScheduled:qe}=R6(ae,{dragging:G,dependencies:[U.x,U.y],config:pe.droppable}),Me=N6(B,k),bt=O.useMemo(()=>F?Hf(F):null,[F]),Mt=Pl(),Gt=O6(Me,pe.draggable.measure);K6({activeNode:k?B.get(k):null,config:Mt.layoutShiftCompensation,initialRect:Gt,measure:pe.draggable.measure});const Ue=Bx(Me,pe.draggable.measure,Gt),Jn=Bx(Me?Me.parentElement:null),Ge=O.useRef({activatorEvent:null,active:null,activeNode:Me,collisionRect:null,collisions:null,droppableRects:Fe,draggableNodes:B,draggingNode:null,draggingNodeRect:null,droppableContainers:K,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),dn=K.getNodeFor((n=Ge.current.over)==null?void 0:n.id),st=F6({measure:pe.dragOverlay.measure}),Sn=(r=st.nodeRef.current)!=null?r:Me,en=G?(o=st.rect)!=null?o:Ue:null,_n=!!(st.nodeRef.current&&st.rect),Eo=I6(_n?null:Ue),No=uC(Sn?bn(Sn):null),tn=A6(G?dn??Me:null),jt=j6(tn),nn=pC(S,{transform:{x:U.x-Eo.x,y:U.y-Eo.y,scaleX:1,scaleY:1},activatorEvent:F,active:be,activeNodeRect:Ue,containerNodeRect:Jn,draggingNodeRect:en,over:Ge.current.over,overlayNodeRect:st.rect,scrollableAncestors:tn,scrollableAncestorRects:jt,windowRect:No}),Mn=bt?al(bt,U):null,ko=D6(tn),br=Hx(ko),er=Hx(ko,[Ue]),Ft=al(nn,br),rn=en?a6(en,nn):null,Cn=be&&rn?m({active:be,collisionRect:rn,droppableRects:Fe,droppableContainers:ae,pointerCoordinates:Mn}):null,Ti=e6(Cn,"id"),[St,ni]=O.useState(null),Ii=_n?nn:al(nn,er),Ai=i6(Ii,(l=St==null?void 0:St.rect)!=null?l:null,Ue),Di=O.useCallback((dt,zt)=>{let{sensor:Ut,options:tr}=zt;if(J.current==null)return;const A=B.get(J.current);if(!A)return;const j=dt.nativeEvent,W=new Ut({active:J.current,activeNode:A,event:j,options:tr,context:Ge,onStart(ee){const ge=J.current;if(ge==null)return;const ce=B.get(ge);if(!ce)return;const{onDragStart:ie}=te.current,ye={active:{id:ge,data:ce.data,rect:he}};Zr.unstable_batchedUpdates(()=>{ie==null||ie(ye),M(Zi.Initializing),_({type:At.DragStart,initialCoordinates:ee,active:ge}),b({type:"onDragStart",event:ye})})},onMove(ee){_({type:At.DragMove,coordinates:ee})},onEnd:X(At.DragEnd),onCancel:X(At.DragCancel)});Zr.unstable_batchedUpdates(()=>{Ne(W),z(dt.nativeEvent)});function X(ee){return async function(){const{active:ce,collisions:ie,over:ye,scrollAdjustedTranslate:Se}=Ge.current;let tt=null;if(ce&&Se){const{cancelDrop:nt}=te.current;tt={activatorEvent:j,active:ce,collisions:ie,delta:Se,over:ye},ee===At.DragEnd&&typeof nt=="function"&&await Promise.resolve(nt(tt))&&(ee=At.DragCancel)}J.current=null,Zr.unstable_batchedUpdates(()=>{_({type:ee}),M(Zi.Uninitialized),ni(null),Ne(null),z(null);const nt=ee===At.DragEnd?"onDragEnd":"onDragCancel";if(tt){const me=te.current[nt];me==null||me(tt),b({type:nt,event:tt})}})}}},[B]),Li=O.useCallback((dt,zt)=>(Ut,tr)=>{const A=Ut.nativeEvent,j=B.get(tr);if(J.current!==null||!j||A.dndKit||A.defaultPrevented)return;const W={active:j};dt(Ut,zt.options,W)===!0&&(A.dndKit={capturedBy:zt.sensor},J.current=tr,Di(Ut,zt))},[B,Di]),Sr=k6(p,Li);L6(p),Ur(()=>{Ue&&I===Zi.Initializing&&M(Zi.Initialized)},[Ue,I]),O.useEffect(()=>{const{onDragMove:dt}=te.current,{active:zt,activatorEvent:Ut,collisions:tr,over:A}=Ge.current;if(!zt||!Ut)return;const j={active:zt,activatorEvent:Ut,collisions:tr,delta:{x:Ft.x,y:Ft.y},over:A};Zr.unstable_batchedUpdates(()=>{dt==null||dt(j),b({type:"onDragMove",event:j})})},[Ft.x,Ft.y]),O.useEffect(()=>{const{active:dt,activatorEvent:zt,collisions:Ut,droppableContainers:tr,scrollAdjustedTranslate:A}=Ge.current;if(!dt||J.current==null||!zt||!A)return;const{onDragOver:j}=te.current,W=tr.get(Ti),X=W&&W.rect.current?{id:W.id,rect:W.rect.current,data:W.data,disabled:W.disabled}:null,ee={active:dt,activatorEvent:zt,collisions:Ut,delta:{x:A.x,y:A.y},over:X};Zr.unstable_batchedUpdates(()=>{ni(X),j==null||j(ee),b({type:"onDragOver",event:ee})})},[Ti]),Ur(()=>{Ge.current={activatorEvent:F,active:be,activeNode:Me,collisionRect:rn,collisions:Cn,droppableRects:Fe,draggableNodes:B,draggingNode:Sn,draggingNodeRect:en,droppableContainers:K,over:St,scrollableAncestors:tn,scrollAdjustedTranslate:Ft},he.current={initial:en,translated:rn}},[be,Me,Cn,rn,B,Sn,en,Fe,K,St,tn,Ft]),_6({...Mt,delta:U,draggingRect:rn,pointerCoordinates:Mn,scrollableAncestors:tn,scrollableAncestorRects:jt});const va=O.useMemo(()=>({active:be,activeNode:Me,activeNodeRect:Ue,activatorEvent:F,collisions:Cn,containerNodeRect:Jn,dragOverlay:st,draggableNodes:B,droppableContainers:K,droppableRects:Fe,over:St,measureDroppableContainers:Ve,scrollableAncestors:tn,scrollableAncestorRects:jt,measuringConfiguration:pe,measuringScheduled:qe,windowRect:No}),[be,Me,Ue,F,Cn,Jn,st,B,K,Fe,St,Ve,tn,jt,pe,qe,No]),Ro=O.useMemo(()=>({activatorEvent:F,activators:Sr,active:be,activeNodeRect:Ue,ariaDescribedById:{draggable:ne},dispatch:_,draggableNodes:B,over:St,measureDroppableContainers:Ve}),[F,Sr,be,Ue,_,ne,B,St,Ve]);return Qe.createElement(G2.Provider,{value:C},Qe.createElement(yu.Provider,{value:Ro},Qe.createElement(dC.Provider,{value:va},Qe.createElement(Od.Provider,{value:Ai},h)),Qe.createElement(H6,{disabled:(c==null?void 0:c.restoreFocus)===!1})),Qe.createElement(Qj,{...c,hiddenTextDescribedById:ne}));function Pl(){const dt=(oe==null?void 0:oe.autoScrollEnabled)===!1,zt=typeof f=="object"?f.enabled===!1:f===!1,Ut=G&&!dt&&!zt;return typeof f=="object"?{...f,enabled:Ut}:{enabled:Ut}}}),Y6=O.createContext(null),Gx="button",V6="Droppable";function q6(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const l=Nd(V6),{activators:s,activatorEvent:c,active:f,activeNodeRect:h,ariaDescribedById:p,draggableNodes:m,over:v}=O.useContext(yu),{role:S=Gx,roleDescription:E="draggable",tabIndex:N=0}=o??{},T=(f==null?void 0:f.id)===t,_=O.useContext(T?Od:Y6),[b,C]=$f(),[I,M]=$f(),G=M6(s,t),k=nu(n);Ur(()=>(m.set(t,{id:t,key:l,node:b,activatorNode:I,data:k}),()=>{const U=m.get(t);U&&U.key===l&&m.delete(t)}),[m,t]);const B=O.useMemo(()=>({role:S,tabIndex:N,"aria-disabled":r,"aria-pressed":T&&S===Gx?!0:void 0,"aria-roledescription":E,"aria-describedby":p.draggable}),[r,S,N,T,E,p.draggable]);return{active:f,activatorEvent:c,activeNodeRect:h,attributes:B,isDragging:T,listeners:r?void 0:G,node:b,over:v,setNodeRef:C,setActivatorNodeRef:M,transform:_}}function X6(){return O.useContext(dC)}const Q6="Droppable",Z6={timeout:25};function Pd(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const l=Nd(Q6),{active:s,dispatch:c,over:f,measureDroppableContainers:h}=O.useContext(yu),p=O.useRef({disabled:n}),m=O.useRef(!1),v=O.useRef(null),S=O.useRef(null),{disabled:E,updateMeasurementsFor:N,timeout:T}={...Z6,...o},_=nu(N??r),b=O.useCallback(()=>{if(!m.current){m.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{h(Array.isArray(_.current)?_.current:[_.current]),S.current=null},T)},[T]),C=Rd({callback:b,disabled:E||!s}),I=O.useCallback((B,U)=>{C&&(U&&(C.unobserve(U),m.current=!1),B&&C.observe(B))},[C]),[M,G]=$f(I),k=nu(t);return O.useEffect(()=>{!C||!M.current||(C.disconnect(),m.current=!1,C.observe(M.current))},[M,C]),Ur(()=>(c({type:At.RegisterDroppable,element:{id:r,key:l,disabled:n,node:M,rect:v,data:k}}),()=>c({type:At.UnregisterDroppable,key:l,id:r})),[r]),O.useEffect(()=>{n!==p.current.disabled&&(c({type:At.SetDroppableDisabled,id:r,key:l,disabled:n}),p.current.disabled=n)},[r,l,n,c]),{active:s,rect:v,isOver:(f==null?void 0:f.id)===r,node:M,over:f,setNodeRef:G}}function J6(e){let{animation:t,children:n}=e;const[r,o]=O.useState(null),[l,s]=O.useState(null),c=Bf(n);return!n&&!r&&c&&o(c),Ur(()=>{if(!l)return;const f=r==null?void 0:r.key,h=r==null?void 0:r.props.id;if(f==null||h==null){o(null);return}Promise.resolve(t(h,l)).then(()=>{o(null)})},[t,r,l]),Qe.createElement(Qe.Fragment,null,n,r?O.cloneElement(r,{ref:s}):null)}const eF={x:0,y:0,scaleX:1,scaleY:1};function tF(e){let{children:t}=e;return Qe.createElement(yu.Provider,{value:fC},Qe.createElement(Od.Provider,{value:eF},t))}const nF={position:"fixed",touchAction:"none"},rF=e=>kd(e)?"transform 250ms ease":void 0,iF=O.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:l,className:s,rect:c,style:f,transform:h,transition:p=rF}=e;if(!c)return null;const m=o?h:{...h,scaleX:1,scaleY:1},v={...nF,width:c.width,height:c.height,top:c.top,left:c.left,transform:ki.Transform.toString(m),transformOrigin:o&&r?Zj(r,c):void 0,transition:typeof p=="function"?p(r):p,...f};return Qe.createElement(n,{className:s,style:v,ref:t},l)}),oF=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:l,className:s}=e;if(l!=null&&l.active)for(const[c,f]of Object.entries(l.active))f!==void 0&&(o[c]=n.node.style.getPropertyValue(c),n.node.style.setProperty(c,f));if(l!=null&&l.dragOverlay)for(const[c,f]of Object.entries(l.dragOverlay))f!==void 0&&r.node.style.setProperty(c,f);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[f,h]of Object.entries(o))n.node.style.setProperty(f,h);s!=null&&s.active&&n.node.classList.remove(s.active)}},aF=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ki.Transform.toString(t)},{transform:ki.Transform.toString(n)}]},lF={duration:250,easing:"ease",keyframes:aF,sideEffects:oF({styles:{active:{opacity:"0"}}})};function sF(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return Ed((l,s)=>{if(t===null)return;const c=n.get(l);if(!c)return;const f=c.node.current;if(!f)return;const h=cC(s);if(!h)return;const{transform:p}=bn(s).getComputedStyle(s),m=Z2(p);if(!m)return;const v=typeof t=="function"?t:uF(t);return oC(f,o.draggable.measure),v({active:{id:l,data:c.data,node:f,rect:o.draggable.measure(f)},draggableNodes:n,dragOverlay:{node:s,rect:o.dragOverlay.measure(h)},droppableContainers:r,measuringConfiguration:o,transform:m})})}function uF(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...lF,...e};return l=>{let{active:s,dragOverlay:c,transform:f,...h}=l;if(!t)return;const p={x:c.rect.left-s.rect.left,y:c.rect.top-s.rect.top},m={scaleX:f.scaleX!==1?s.rect.width*f.scaleX/c.rect.width:1,scaleY:f.scaleY!==1?s.rect.height*f.scaleY/c.rect.height:1},v={x:f.x-p.x,y:f.y-p.y,...m},S=o({...h,active:s,dragOverlay:c,transform:{initial:f,final:v}}),[E]=S,N=S[S.length-1];if(JSON.stringify(E)===JSON.stringify(N))return;const T=r==null?void 0:r({active:s,dragOverlay:c,...h}),_=c.node.animate(S,{duration:t,easing:n,fill:"forwards"});return new Promise(b=>{_.onfinish=()=>{T==null||T(),b()}})}}let Kx=0;function cF(e){return O.useMemo(()=>{if(e!=null)return Kx++,Kx},[e])}const iv=Qe.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:l,modifiers:s,wrapperElement:c="div",className:f,zIndex:h=999}=e;const{activatorEvent:p,active:m,activeNodeRect:v,containerNodeRect:S,draggableNodes:E,droppableContainers:N,dragOverlay:T,over:_,measuringConfiguration:b,scrollableAncestors:C,scrollableAncestorRects:I,windowRect:M}=X6(),G=O.useContext(Od),k=cF(m==null?void 0:m.id),B=pC(s,{activatorEvent:p,active:m,activeNodeRect:v,containerNodeRect:S,draggingNodeRect:T.rect,over:_,overlayNodeRect:T.rect,scrollableAncestors:C,scrollableAncestorRects:I,transform:G,windowRect:M}),U=Fg(v),K=sF({config:r,draggableNodes:E,droppableContainers:N,measuringConfiguration:b}),Z=U?T.setRef:void 0;return Qe.createElement(tF,null,Qe.createElement(J6,{animation:K},m&&k?Qe.createElement(iF,{key:k,id:m.id,ref:Z,as:c,activatorEvent:p,adjustScale:t,className:f,transition:l,rect:U,style:{zIndex:h,...o},transform:B},n):null))});function mC(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const fF=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e;const o=r[0];return!t||!o?n:mC(n,t,o)},dF=e=>{let{transform:t,draggingNodeRect:n,windowRect:r}=e;return!n||!r?t:mC(t,n,r)};function vC(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fc(e){return e!==null&&e>=0}const pF=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const l=vC(t,r,n),s=t[o],c=l[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.height}},hF="Sortable",mF=Qe.createContext({activeIndex:-1,containerId:hF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pF,disabled:{draggable:!1,droppable:!1}}),vF=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return vC(n,r,o).indexOf(t)},gF=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:l,newIndex:s,previousItems:c,previousContainerId:f,transition:h}=e;return!h||!r||c!==l&&o===s?!1:n?!0:s!==o&&t===f},yF={duration:200,easing:"ease"},gC="transform",wF=ki.Transition.toString({property:gC,duration:0,easing:"linear"}),xF={roleDescription:"sortable"};function bF(e){let{disabled:t,index:n,node:r,rect:o}=e;const[l,s]=O.useState(null),c=O.useRef(n);return Ur(()=>{if(!t&&n!==c.current&&r.current){const f=o.current;if(f){const h=Ol(r.current,{ignoreTransform:!0}),p={x:f.left-h.left,y:f.top-h.top,scaleX:f.width/h.width,scaleY:f.height/h.height};(p.x||p.y)&&s(p)}}n!==c.current&&(c.current=n)},[t,n,r,o]),O.useEffect(()=>{l&&s(null)},[l]),l}function yC(e){let{animateLayoutChanges:t=gF,attributes:n,disabled:r,data:o,getNewIndex:l=vF,id:s,strategy:c,resizeObserverConfig:f,transition:h=yF}=e;const{items:p,containerId:m,activeIndex:v,disabled:S,disableTransforms:E,sortedRects:N,overIndex:T,useDragOverlay:_,strategy:b}=O.useContext(mF),C=SF(r,S),I=p.indexOf(s),M=O.useMemo(()=>({sortable:{containerId:m,index:I,items:p},...o}),[m,o,I,p]),G=O.useMemo(()=>p.slice(p.indexOf(s)),[p,s]),{rect:k,node:B,isOver:U,setNodeRef:K}=Pd({id:s,data:M,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:G,...f}}),{active:Z,activatorEvent:he,activeNodeRect:be,attributes:J,setNodeRef:oe,listeners:Ne,isDragging:F,over:z,setActivatorNodeRef:te,transform:ne}=q6({id:s,data:M,attributes:{...xF,...n},disabled:C.draggable}),ae=Fj(K,oe),pe=!!Z,Fe=pe&&!E&&Fc(v)&&Fc(T),Ve=!_&&F,qe=Ve&&Fe?ne:null,bt=Fe?qe??(c??b)({rects:N,activeNodeRect:be,activeIndex:v,overIndex:T,index:I}):null,Mt=Fc(v)&&Fc(T)?l({id:s,items:p,activeIndex:v,overIndex:T}):I,Gt=Z==null?void 0:Z.id,Ue=O.useRef({activeId:Gt,items:p,newIndex:Mt,containerId:m}),Jn=p!==Ue.current.items,Ge=t({active:Z,containerId:m,isDragging:F,isSorting:pe,id:s,index:I,items:p,newIndex:Ue.current.newIndex,previousItems:Ue.current.items,previousContainerId:Ue.current.containerId,transition:h,wasDragging:Ue.current.activeId!=null}),dn=bF({disabled:!Ge,index:I,node:B,rect:k});return O.useEffect(()=>{pe&&Ue.current.newIndex!==Mt&&(Ue.current.newIndex=Mt),m!==Ue.current.containerId&&(Ue.current.containerId=m),p!==Ue.current.items&&(Ue.current.items=p)},[pe,Mt,m,p]),O.useEffect(()=>{if(Gt===Ue.current.activeId)return;if(Gt&&!Ue.current.activeId){Ue.current.activeId=Gt;return}const Sn=setTimeout(()=>{Ue.current.activeId=Gt},50);return()=>clearTimeout(Sn)},[Gt]),{active:Z,activeIndex:v,attributes:J,data:M,rect:k,index:I,newIndex:Mt,items:p,isOver:U,isSorting:pe,isDragging:F,listeners:Ne,node:B,overIndex:T,over:z,setNodeRef:ae,setActivatorNodeRef:te,setDroppableNodeRef:K,setDraggableNodeRef:oe,transform:dn??bt,transition:st()};function st(){if(dn||Jn&&Ue.current.newIndex===I)return wF;if(!(Ve&&!kd(he)||!h)&&(pe||Ge))return ki.Transition.toString({...h,property:gC})}}function SF(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}We.Down,We.Right,We.Up,We.Left;function Td({groupName:e,item:t,allowRemove:n,onRemove:r}){const{attributes:o,listeners:l,setNodeRef:s,transform:c,transition:f}=yC({id:`${e}_${t.itemName}`,data:{type:"Ingredient",item:t,parentGroup:e}}),h={transition:f,transform:ki.Translate.toString(c)};return x.jsxs("div",{ref:s,className:"relative print-rounded aspect-square w-clamp card-shadow center",style:h,...l,...o,children:[x.jsx("img",{src:`/assets/ingredients/${t.itemName.toLowerCase()}.webp`,alt:t.itemName,"data-testid":`${e}_${t.itemName}_selected`,className:"print-rounded"}),n&&x.jsx("div",{className:"flex center rounded-2xl",children:x.jsx(Ln,{icon:yd,size:"sm",onClick:()=>r==null?void 0:r(),className:"absolute pointer-events-auto top-0 right-0 -m-2 cursor-pointer text-white bg-black bg-opacity-80 rounded-full px-1 py-1"})})]},`${e}_${t.itemName}`)}function _F({group:e,item:t}){const n=wn(),r=(o,l)=>{n(X_({groupName:o,itemName:l}))};return x.jsx("div",{children:x.jsx("div",{className:"mx-2 hover:cursor-grabbing hover:scale-105",children:x.jsx(Td,{groupName:e.groupName,item:t,allowRemove:!0,onRemove:()=>r(e.groupName,t.itemName)})})})}function CF({group:e}){const{setNodeRef:t}=Pd({id:e.groupName,data:{type:"Group",group:e}});return x.jsx(x.Fragment,{children:x.jsx("div",{ref:t,className:"flex flex-wrap justify-center gap-y-4 mb-12 center",children:e.items.map((n,r)=>x.jsx("div",{children:x.jsx(_F,{group:e,item:n})},`${n}${r.toString()}`))})})}function EF(){const e=wn();return He(n=>n.groups.ingredientsGroups).map((n,r)=>x.jsxs("div",{className:"flex flex-col center",children:[x.jsx("p",{onKeyDown:Oi,"data-testid":"chosen_group",onClick:()=>e(Y_(n.groupName)),className:"group-chip text-fluidSubtitle",children:n.groupName}),x.jsx(CF,{group:n})]},`${n.groupName}_${r}`))}function NF(){const e=wn(),t=He(f=>f.groups.ingredientsGroups),[n,r]=O.useState(null),o=f=>{var h;r((h=f.active.data.current)==null?void 0:h.item)},l=f=>{var E,N,T,_;console.log("@ END");const{active:h,over:p}=f;if(!p)return;const m=((E=h.data.current)==null?void 0:E.type)==="Ingredient",v=((N=p.data.current)==null?void 0:N.type)==="Group",S=(T=h.data.current)==null?void 0:T.parentGroup;if(m&&v&&S!==p.id){const b=h.id.split("_")[1];if(t.filter(I=>I.groupName===p.id)[0].items.findIndex(I=>I.itemName===b)>-1)return;e(X_({groupName:S,itemName:b})),e(Dm({groupName:p.id,itemName:b,item:(_=h.data.current)==null?void 0:_.item}))}r(null)},s=f=>{const h=X2(f);return h.length>0?h.sort((m,v)=>{const S=f.droppableRects.get(m.id),E=f.droppableRects.get(v.id);if(S&&E){const N=S.width*S.height;return E.width*E.height-N}return 0}):q2(f)},c=K2(Kf(Mg,{activationConstraint:{distance:5}}),Kf(jg,{activationConstraint:{distance:4}}));return x.jsxs(hC,{collisionDetection:s,modifiers:[fF],sensors:c,onDragEnd:l,onDragStart:o,children:[x.jsxs("div",{className:"relative px-4 pb-4 overflow-auto center text-center no-scrollbar overflow-x-hidden",children:[x.jsx("h2",{className:"mb-8 text-fluidSubtitle",children:"Selected ingredient groups"}),x.jsx(EF,{})]}),n&&x.jsx(iv,{children:x.jsx(Td,{groupName:`${n.itemName}_${Math.random().toString()}`,item:n,allowRemove:!1})})]})}function kF(){const e=He(t=>t.groups.ingredientsGroups);return x.jsxs("div",{"data-testid":"homepage",className:"max-h-screen flex flex-col",children:[x.jsx(sa,{page:"/quantities",isNext:!0}),x.jsx(_L,{}),x.jsxs("div",{className:"flex flex-grow md:p-2 lg:p-2 sm:gap-4 md:gap-4 lg:gap-8 mx-4",children:[x.jsx("div",{className:"main-gallery sm:w-2/3 md:w-4/5 lg:w-3/5",children:x.jsx(jj,{})}),x.jsx("div",{className:`main-gallery sm:w-1/3 w-2/5 ${e.length===0&&"required-element-border"}`,children:x.jsx(NF,{})})]})]})}function RF(){const e=wn(),t=He(r=>r.actions.availableItems),n=r=>{e(pg(r))};return t.map((r,o)=>x.jsx("div",{"data-item-name":r.itemName,className:"mb-1 pb-2 lg:pb-4 print-rounded opacity-100 hover:scale-105",onKeyDown:Oi,children:x.jsx(Td,{groupName:o.toString(),item:r,allowRemove:!1,onRemove:()=>n(r)})},`${r.itemName}_shelf_${o}`))}function wC({action:e}){const{attributes:t,listeners:n,setNodeRef:r,transform:o,transition:l}=yC({id:e.actionName,data:{type:"Action",action:e}}),s={transition:l,transform:ki.Translate.toString(o)},{actionName:c}=e;return x.jsx("div",{ref:r,style:s,...n,...t,children:x.jsxs("div",{className:"bg-white card-shadow print-rounded w-clamp",children:[x.jsx("img",{draggable:"false",src:`/assets/chefActions/${c.toLowerCase()}.webp`,alt:c,"data-testid":`${c}_action`,className:"print-rounded-img rounded-t-lg w-clamp"}),x.jsx("p",{className:"text-fluidPrint py-2",children:c})]},c)})}function OF(){return dL.map(e=>x.jsx("div",{className:"bg-white mx-2 aspect-videoThin hover:scale-105",children:x.jsx(wC,{action:e})},`${e.actionName}`))}function Yx({icon:e,onCaretClick:t}){return x.jsx("div",{className:"flex center max-h-short cursor-pointer hover:border-y-2 hover:border-black",onClick:()=>t(),onKeyDown:Oi,children:x.jsx(Ln,{icon:e,size:"lg"})})}function PF({instruction:e}){const t=O.useRef(null),n=wn(),[r,o]=O.useState(e.note),[l,s]=O.useState(null),c=v=>{r?n(Nc({id:e.id,note:v})):(s(null),n(Nc({id:e.id,note:""})))},f=()=>{s(null),o(""),n(Nc({id:e.id,note:""}))},h=v=>{o(v.target.value)},p=l===e.id;O.useEffect(()=>{p&&t.current&&t.current.focus()},[p]);const m=(v,S)=>{if(v.key==="Enter"){const{id:E,note:N}=S;n(Nc({id:E,note:N})),v.target.blur()}};return p||e.note?x.jsxs("div",{className:"flex justify-end items-center md:w-60 lg:w-96",children:[x.jsx("input",{type:"text",ref:t,className:"input-border w-full text-fluidSubtitle text-center md:-m-2 lg:-m-4 text-ellipsis whitespace-nowrap overflow-hidden sm:p-0 md:p-1",placeholder:"Add a note to this instruction",value:r,onChange:h,onBlur:v=>c(v.target.value),onKeyDown:v=>m(v,e)}),x.jsx(Ln,{icon:yd,size:"1x",className:"bg-white -ml-2 cursor-pointer",onClick:()=>f()})]}):x.jsx("button",{type:"button",className:"sexy-button md:px-1 lg:px-3 md:py-1 lg:py-2 -m-4 min-w-16 card-shadow border border-transparent bg-yellow-100 text-neutral-800 font-semibold rounded-lg text-xs hover:bg-white hover:border-2 hover:border-yellow-200",onClick:()=>s(e.id),children:x.jsx("span",{children:"Add Note"})})}function TF({instruction:e}){const t=wn(),[n,r]=O.useState(e.action.time),o=f=>{f.target.select()},l=f=>{Number.isNaN(f)?r(0):r(f)},s=()=>{n>0&&r(f=>f-1)},c=()=>{r(f=>f+1)};return O.useEffect(()=>{t(lL({instruction:e,time:n}))},[t,e,n]),x.jsxs("div",{className:"flex flex-row rounded-md mx-2",children:[x.jsx("button",{type:"button",onClick:s,children:x.jsx(Ln,{icon:e2,className:"num-input-icons"})}),x.jsx("input",{className:`sm:w-8 md:w-8 lg:w-16 p-0 md:mx-2 lg:mx-4 focus:outline-none text-center rounded-2xl sm:text-2xl md:text-3xl lg:text-4xl bg-transparent ${n===0&&"required-element-fill"}`,type:"number",id:"units-number-input",value:n,required:!0,onChange:f=>l(Number.parseFloat(f.target.value)),onFocus:o,onWheel:f=>f.target.blur()}),x.jsx("button",{type:"button",onClick:c,children:x.jsx(Ln,{icon:t2,className:"num-input-icons"})})]})}function IF({action:e}){const{actionName:t}=e;return x.jsxs("div",{className:"bg-white card-shadow print-rounded w-clamp",children:[x.jsx("img",{draggable:"false",src:`/assets/chefActions/${t.toLowerCase()}.webp`,alt:t,"data-testid":`${t}_action`,className:"print-rounded-img md:w-clampSmall lg:w-clamp"}),x.jsx("p",{className:"text-fluidCard py-2",children:t})]},t)}function AF({groupName:e,item:t,onRemoveItem:n}){const r=()=>{n(t)};return x.jsxs("div",{className:"relative print-rounded aspect-square print-image card-shadow center",children:[x.jsx("img",{draggable:"false",src:`/assets/ingredients/${t.itemName.toLowerCase()}.webp`,alt:t.itemName,"data-testid":`${e}_${t.itemName}_shelf`,className:"print-rounded print-image"}),x.jsx("div",{className:"flex center rounded-2xl",children:x.jsx(Ln,{icon:yd,size:"sm",onClick:r,className:"absolute pointer-events-auto top-0 right-0 -m-2 cursor-pointer text-white bg-black bg-opacity-80 rounded-full px-1 py-1"})})]},`${e}_${t.itemName}`)}function DF({instruction:e,refClick:t}){const[n,r]=O.useState(""),{setNodeRef:o}=Pd({id:e.id,data:{type:"Instruction",instruction:e}}),l=wn(),s=(E,N)=>{const T=N.items.filter(_=>!Ho.isEqual(_,E));l(H_({id:N.id,items:T})),l(pg(E))},c=E=>{l(aL(E)),l(cL(E.items))},f=(E,N)=>{l(iL({id:N.id,customItem:E.target.value})),E.target.blur()},h=E=>{r(E.target.value)},p=E=>{E.key===" "&&(E.preventDefault(),r(N=>`${N} `))},{id:m,action:v,items:S}=e;return x.jsxs("div",{ref:o,className:"z-50 flex flex-col mb-12 border-l-2 border-r-2 border-l-neutral-400 border-r-neutral-400 rounded-3xl lg:scale-90",children:[x.jsxs("div",{className:"flex items-center justify-between pl-6",children:[x.jsxs("div",{className:"flex justify-start w-full py-2",children:[x.jsxs("div",{draggable:"false",className:"flex center",onClick:()=>{t(e)},onKeyDown:Oi,children:[x.jsx(IF,{action:v}),x.jsx("span",{className:"md:text-xs text-fluidSubtitle ml-4",children:"THE"}),x.jsx("div",{className:"flex flex-row",children:x.jsx("div",{className:"center sm:w-36 md:w-44 lg:w-52 xl:w-56 flex flex-row flex-wrap",children:!n&&S.length>0?S.map(E=>x.jsx("div",{className:"px-2 py-2",children:x.jsx(AF,{groupName:m.toString(),item:E,onRemoveItem:N=>s(N,e)})},`${m}_${E.itemName}`)):x.jsxs("div",{className:"flex flex-col justify-between items-center sm:min-h-16 md:min-h-24",children:[x.jsx("span",{className:"text-fluidPrint",children:n?x.jsxs("b",{className:"text-neutral-400",children:["Drop Item ",x.jsx("br",{})," or"]}):x.jsxs("b",{children:["Drop Item ",x.jsx("br",{})," or"]})},m),x.jsx("input",{type:"text",className:"input-border sm:w-24 md:w-36 text-sm text-center text-ellipsis whitespace-nowrap overflow-hidden p-1",placeholder:"Custom text",value:n,onChange:E=>h(E),onKeyDown:p,onBlur:E=>f(E,e)})]})})})]}),v.time!==-1&&x.jsxs("div",{className:"flex center",children:[x.jsx("span",{className:"text-fluidSubtitle mx-2",children:"FOR"}),x.jsx(TF,{instruction:e}),x.jsx("span",{className:"text-fluidSubtitle md:ml-2 lg:ml-4",children:v.unit})]})]}),x.jsx("button",{type:"button",className:"px-4 md:ml-2 lg:ml-8 h-fit",onClick:()=>c(e),children:x.jsx(Ln,{icon:kL,size:"lg",color:"red",className:"cursor-pointer hover:text-black"})})]}),x.jsx("div",{className:"flex center sm:mt-4 md:mt-6",children:x.jsx(PF,{instruction:e})})]},`${m}_${v}`)}const LF=O.memo(({onRefClick:e})=>[...He(r=>r.actions.chefInstructions)].sort((r,o)=>r.id-o.id).map(r=>x.jsx("div",{"data-instruction":r.id,className:"pt-4",children:x.jsx(DF,{instruction:r,refClick:o=>e(o)})},r.id)));function MF({onInstructionClick:e}){const{setNodeRef:t}=Pd({id:"steps_container",data:{type:"Steps"}}),n=He(s=>s.actions.chefInstructions),r=O.useRef(null),o=O.useRef(n.length),l=O.useCallback(()=>{const s=r.current;if(n.length===0)return;const c=n[n.length-1],f=s==null?void 0:s.querySelector(`[data-instruction="${c.id}"]`);f&&f.scrollIntoView({behavior:"smooth",inline:"center"})},[n]);return O.useEffect(()=>{n.length!==o.current&&(l(),o.current=n.length)},[n,l]),x.jsxs("div",{ref:s=>{t(s),r.current=s},className:`flex flex-col bg-slate-50 w-full md:ml-4 lg:ml-8 mb-1 max-h-semi overflow-scroll no-scrollbar ${n.length===0?"justify-center items-center":"justify-start items-center pt-2"} lg:overflow-x-auto`,children:[n.length===0&&x.jsxs("h2",{className:"text-fluidSubtitle text-gray-600",children:["Drag an action ",x.jsx("b",{children:"[ top ]"})," to this area ",x.jsx("br",{}),"and start adding ingredients ",x.jsx("b",{children:"[left ]"})," to it!",x.jsx("br",{}),x.jsx("br",{}),"To add more steps just",x.jsx("br",{}),"drag another action.",x.jsx("br",{}),x.jsx("br",{}),x.jsx("b",{children:"Replace an action by dragging a new one over it!"})]}),x.jsx(LF,{onRefClick:s=>e(s)})]})}function jF(){const e=O.useRef(null),t=O.useRef(null),[n,r]=O.useState(!1),[o,l]=O.useState(0),[s,c]=O.useState(0),[f,h]=O.useState(null),[p,m]=O.useState(null),[v,S]=O.useState(null),E=wn(),N=He(U=>U.actions.chefInstructions);O.useEffect(()=>{if(v){const U=v.current,K=Z=>{U&&(Z.preventDefault(),Z.deltaY<0?U.scrollLeft-=20:U.scrollLeft+=20)};return U&&U.addEventListener("wheel",K,{passive:!1}),()=>{U&&U.removeEventListener("wheel",K)}}},[v]);const T=U=>{if(v!=null&&v.current){const Z=v.current.firstChild.offsetWidth*4;v.current.scrollBy({left:U==="left"?-Z:Z,behavior:"smooth"})}},_=(U,K)=>{U.current&&(S(U),U.current&&(r(!0),l(K.pageX-U.current.offsetLeft),c(U.current.scrollLeft)))},b=(U,K)=>{if(!(!n||!U.current)&&(S(U),K.preventDefault(),U.current)){const he=K.pageX-U.current.offsetLeft-o;U.current.scrollLeft=s-he}},C=U=>{const K=e.current;let Z=null;Z=K==null?void 0:K.querySelector(`[data-action-name="${U.action.actionName}"]`),Z&&Z.scrollIntoView({behavior:"smooth",inline:"center"})},I=U=>{E(oL({id:N.length>0?Math.max(...N.map(K=>K.id))+1:0,note:"",action:U,items:[]}))},M=U=>{var K,Z,he,be;((K=U.active.data.current)==null?void 0:K.type)==="Action"?h((Z=U.active.data.current)==null?void 0:Z.action):h(null),((he=U.active.data.current)==null?void 0:he.type)==="Ingredient"?m((be=U.active.data.current)==null?void 0:be.item):m(null)},G=U=>{var J,oe,Ne,F,z,te;const{active:K,over:Z}=U;if(!Z)return;const he=(J=K.data.current)==null?void 0:J.type,be=(oe=Z.data.current)==null?void 0:oe.type;if(he==="Action"&&be==="Steps")I((Ne=K.data.current)==null?void 0:Ne.action);else if(be==="Instruction"){const ne=(F=Z.data.current)==null?void 0:F.instruction;if(he==="Action"){const ae=(z=K.data.current)==null?void 0:z.action;E(sL({id:ne.id,action:ae}))}else if(he==="Ingredient"){const ae=(te=K.data.current)==null?void 0:te.item;ne.items.find(Fe=>Ho.isEqual(Fe,ae))||(E(H_({id:ne.id,items:[...ne.items,ae]})),E(pg(ae)))}}},k=U=>{const K=X2(U);return K.length>0?K.sort((he,be)=>{const J=U.droppableRects.get(he.id),oe=U.droppableRects.get(be.id);if(J&&oe){const Ne=J.width*J.height,F=oe.width*oe.height;return Ne-F}return 0}):q2(U)},B=K2(Kf(Mg,{activationConstraint:{distance:0}}),Kf(jg,{activationConstraint:{distance:10}}));return x.jsx(hC,{collisionDetection:k,modifiers:[dF],sensors:B,onDragEnd:G,onDragStart:M,children:x.jsxs("div",{className:"mt-16 max-h-5/6 w-11/12 input-gallery-border p-4",children:[x.jsx("h2",{className:"text-fluidSubtitle mb-2",children:"Plan the instructions and steps for this recipe!"}),x.jsxs("div",{className:"flex flex-row gap-2",children:[x.jsx(Yx,{icon:IL,onCaretClick:()=>T("left")}),x.jsx("div",{id:"actions-scrollbar",className:"flex w-full overflow-x-scroll py-4 pt-4 overflow-y-auto",ref:e,onMouseDown:U=>_(e,U),onMouseLeave:()=>r(!1),onMouseUp:()=>r(!1),onMouseMove:U=>b(e,U),children:x.jsx(OF,{})}),x.jsx(Yx,{icon:RL,onCaretClick:()=>T("right")}),f&&x.jsx(iv,{children:x.jsx(wC,{action:f})})]}),x.jsxs("div",{className:"flex w-full justify-between mt-8",children:[x.jsx("div",{ref:t,className:"flex flex-col min-w-fit sm:p-2 md:p-4 sm:mr-4 md:mr-2 max-h-half overflow-y-scroll scroll-normal",children:x.jsx("div",{className:"scroll-mirror",children:x.jsx(RF,{})})}),p&&x.jsx(iv,{children:x.jsx(Td,{groupName:Math.random().toString(),item:p,allowRemove:!1})}),x.jsx(MF,{onInstructionClick:U=>C(U)})]})]})})}function FF(){const e=He(l=>l.warning.warning),t=He(l=>l.groups.ingredientsGroups),n=He(l=>l.actions.chefInstructions);let r="/print";return(t.flatMap(l=>l.items).length>18||n.length>3)&&(r="/doublePrint"),x.jsxs("div",{"data-testid":"instructions",className:"min-h-screen flex flex-col",children:[x.jsx(sa,{page:r,isNext:!0}),x.jsx(sa,{page:"/quantities",isNext:!1}),x.jsx("div",{className:"flex h-screen justify-center text-center",children:x.jsx(jF,{})}),e&&x.jsx(hg,{})]})}function zF(){return He(t=>t.groups.ingredientsGroups).map(t=>x.jsxs("div",{className:"flex flex-row center md:gap-x-3 lg:gap-x-4 mb-2",children:[x.jsx("p",{className:"text-fluidSubtitle leading-none md:mr-2 lg:mr-4",children:t.groupName}),t.items.map(n=>x.jsxs("div",{className:"flex flex-col h-fit center md:rounded-md lg:rounded-lg",children:[x.jsx("img",{src:`/assets/ingredients/${n.itemName.toLowerCase()}.webp`,alt:n.itemName,className:"card-shadow md:w-tinyImage lg:w-miniImage md:rounded-md lg:rounded-lg"}),x.jsxs("div",{className:"py-2 h-fit",children:[x.jsx("p",{className:"text-fluidPrintTitle leading-tight px-2",children:n.itemName}),x.jsx("p",{className:"text-fluidPrintTitle leading-tight",children:x.jsxs("b",{children:[n.amount,"  ",n.unit]})})]})]},`${t.groupName}_${n.itemName}`))]},t.groupName))}function UF(){return He(t=>t.actions.chefInstructions).map((t,n)=>x.jsxs("div",{className:"flex flex-col md:mb-2 lg:mb-6 md:w-5/6 lg:w-3/5 ",children:[x.jsxs("div",{className:"relative flex flex-row gap-4 pointer-events-none items-center justify-start ",children:[x.jsxs("span",{className:"md:text-xs lg:text-sm min-w-12",children:["Step ",n+1]}),x.jsx("div",{children:x.jsxs("div",{className:"bg-white card-shadow print-rounded w-tinyImage mr-2",children:[x.jsx("img",{draggable:"false",src:`/assets/chefActions/${t.action.actionName.toLowerCase()}.webp`,alt:t.action.actionName,"data-testid":`${t.action.actionName}_action`,className:"print-rounded-img w-tinyImage"}),x.jsx("p",{className:"md:text-xs lg:text-sm py-0.5",children:t.action.actionName})]})}),x.jsx("span",{className:" md:text-xs lg:text-sm",children:"THE"}),t.customItem?x.jsx("b",{className:"md:text-xs lg:text-sm",children:t.customItem}):x.jsx("div",{className:"center justify-start md:w-44 lg:min-w-48 flex flex-row flex-wrap",children:t.items.map(r=>x.jsxs("div",{className:"flex center py-1 px-2",children:[x.jsx("img",{src:`/assets/ingredients/${r.itemName.toLowerCase()}.webp`,alt:r.itemName,className:"card-shadow md:w-10 lg:w-12 print-rounded-img"})," "]},`${t.id}_${r.itemName}`))}),t.action.time!==-1&&x.jsxs("span",{className:"-bggreen-300 md:text-xs lg:text-sm min-w-12 md:-ml-4",children:["FOR ",x.jsx("br",{}),t.action.time," ",t.action.unit]})]}),x.jsx("div",{className:"flex w-full left-0",children:x.jsx("span",{className:"md:text-xs lg:text-sm md:pt-0.5 lg:pt-1",children:t.note})})]},`${t.id}`))}function $F(){const e=He(r=>r.recipe.title);let t=0;const n=document.querySelector("#a4");return n&&(t=n.getBoundingClientRect().width/n.getBoundingClientRect().height),x.jsxs("div",{"data-testid":"resultpage",className:"relative min-h-screen flex flex-col",children:[x.jsx(J_,{}),x.jsx("span",{className:`absolute top-1/3 left-0 ml-12 font-bold ${t>.709&&t<.7095?"text-green-600":"text-red-600"}`,children:t}),x.jsx(sa,{page:"/instructions",isNext:!1}),x.jsx("div",{className:"flex flex-col center mt-28 mb-16",children:x.jsxs("div",{id:"a4",className:"relative flex flex-col a4ratio w-2/3 text-center input-border justify-between",children:[x.jsxs("div",{className:"flex flex-col h-fit justify-between items-center",children:[x.jsx("h1",{className:"text-fluidTitle font-shadowsLight md:mt-2 lg:mt-4",children:e}),x.jsx("hr",{className:"w-1/2 border-gray-200 md:mb-2 lg:mb-4"}),x.jsx("h2",{className:"text-fluidSubtitle mb-2",children:"Ingredients:"})]}),x.jsx("div",{className:"grid grid-rows-3 h-2/5",children:x.jsx(zF,{})}),x.jsx("div",{className:"h-fit justify-between items-center",children:x.jsx("h2",{className:"text-fluidSubtitle md:mt-2 lg:mt-8",children:"Steps:"})}),x.jsx("div",{className:"flex flex-col items-center justify-start h-3/5 md:mt-1 lg:mt-2",children:x.jsx(UF,{})}),x.jsx("div",{className:"flex flex-col bg-yellow-200 h-fit justify-between items-center pb-2",children:x.jsx("h2",{className:"text-fluidSubtitle",children:"Enjoy !"})})]})}),x.jsx("div",{className:"fixed bottom-0 right-0 go-to-button-arrow mb-0",children:x.jsx(G_,{})})]})}function Vx({identifier:e,units:t}){var c;const n=He(f=>f.groups.ingredientsGroups),r=wn(),o=e.split("_")[0],l=e.split("_")[1],s=(c=n.find(f=>f.groupName===l))==null?void 0:c.items.filter(f=>f.itemName===o)[0];return s&&x.jsx("div",{className:"text-fluidCard",children:t.map(f=>x.jsx("button",{className:`unit-card my-1 md: text-xs lg:text-xl ${s.unit===f?"unit-card-chosen":null}`,type:"button",onClick:()=>r(Q_({groupName:l,itemName:o,unit:f})),children:f},`${e}_${f}`))})}function BF({item:e,groupName:t}){const n=wn(),[r,o]=O.useState(e.amount),l=p=>{p>=0&&o(p)},s=()=>{r>0&&(n(is({groupName:t,itemName:e.itemName,amount:r-1})),o(p=>p-1))},c=()=>{n(is({groupName:t,itemName:e.itemName,amount:r+1})),o(p=>p+1)},f=p=>{Number.isNaN(p)?o(0):p>=0&&o(p),n(is({groupName:t,itemName:e.itemName,amount:p}))},h=p=>{p.key==="Enter"?(f(r),n(is({groupName:t,itemName:e.itemName,amount:r}))):p.key==="Backspace"&&p.target.value.length===1&&(o(0),n(is({groupName:t,itemName:e.itemName,amount:0})))};return x.jsxs("div",{className:"flex flex-row rounded-md sm:mx-2 md:mx-4 lg:mx-6",children:[x.jsx("button",{type:"button",className:"lg:mx-2",onClick:s,children:x.jsx(Ln,{icon:e2,className:"num-input-icons"})}),x.jsx("input",{className:`sm:w-10 md:w-12 lg:w-16 p-0 py-1 focus:outline-none text-center font-roboto rounded-xl ${r===0&&"required-element-fill"}`,type:"number",id:"units-number-input",value:r,required:!0,onChange:p=>l(Number.parseFloat(p.target.value)),onFocus:Qc,onBlur:p=>f(Number.parseFloat(p.target.value)),onKeyDown:h,onWheel:p=>p.target.blur()}),x.jsx("button",{type:"button",className:"lg:mx-2",onClick:c,children:x.jsx(Ln,{icon:t2,className:"num-input-icons"})})]})}function WF({groupName:e,item:t}){const{itemName:n,unit:r}=t;return x.jsx("div",{"data-testid":"ingredientFullItem",className:"flex center",children:x.jsxs("div",{className:"aspect-videoWide flex flex-row h-clampSmall rounded-2xl card-shadow",children:[x.jsx("img",{src:`/assets/ingredients/${n.toLowerCase()}.webp`,alt:n,className:"rounded-l-2xl"}),x.jsxs("div",{className:"flex flex-col center w-1/2 p-2 m-auto lg:gap-1",children:[x.jsx("p",{className:"text-fluidSubtitle",children:n}),x.jsx("hr",{className:"w-full border-gray-400 lg:my-2"}),x.jsx(BF,{item:t,groupName:e}),x.jsx("p",{className:`text-fluidSubtitle rounded-xl px-3 ${r===ml&&"required-element-fill"}`,children:r})]})]},`${e}_${n}`)})}function HF({groupName:e,items:t}){const n=wn(),r=(o,l)=>{n(Q_({groupName:e,itemName:o.itemName,unit:l}))};return x.jsxs("div",{className:"flex flex-col items-start mx-8",children:[x.jsx("p",{className:"group-chip-dead",children:e}),t.map(o=>x.jsxs("div",{className:"flex flex-row center mb-8",children:[x.jsx(WF,{groupName:e,item:o},`${e}_${o.itemName}_${o.amount}_${o.unit}}`),x.jsxs("div",{"data-testid":"unitsButtonsArray",className:"flex flex-col justify-start md:gap-y-2 sm:mx-6 md:mx-12 lg:mx-8",children:[x.jsx(Vx,{identifier:`${o.itemName}_${e}_common1`,units:kc.slice(0,kc.length/2)}),x.jsx(Vx,{identifier:`${o.itemName}_${e}_common2`,units:kc.slice(kc.length/2)})]}),x.jsx("form",{children:x.jsx("select",{className:`text-base md:w-20 lg:w-28 input-border rounded-md px-2 py-1 ${Zw.includes(o.unit)?"border-blue-500 border-1 bg-blue-300":null}`,value:o.unit,onChange:l=>r(o,l.target.value),children:Zw.map(l=>x.jsx("option",{value:l,children:l},l))})})]},`${e}_${o.itemName}}`))]})}function GF(){const e=He(t=>t.groups.ingredientsGroups);return x.jsx("div",{className:"flex flex-col justify-center",children:x.jsxs("div",{className:"flex flex-col h-5/6 w-fit input-gallery-border overflow-auto p-4 items-center",children:[x.jsx("h2",{className:"text-fluidSubtitle mb-4",children:"Select the Units and Quantities for each ingredient"}),e.map(t=>x.jsx("div",{className:"sm:mb-2 md:mb-4",children:x.jsx(HF,{groupName:t.groupName,items:t.items},t.groupName)},t.groupName))]})})}function KF(){const e=He(t=>t.warning.warning);return x.jsxs("div",{"data-testid":"quantities",className:"max-h-screen flex flex-col",children:[x.jsx(sa,{page:"/instructions",isNext:!0}),x.jsx(sa,{page:"/",isNext:!1}),x.jsx("div",{className:"flex h-screen justify-center text-center mt-8",children:x.jsx(GF,{})}),e&&x.jsx(hg,{})]})}const YF=[{path:"/",element:x.jsx(kF,{}),errorElement:x.jsx(Z4,{})},{path:"/quantities",element:x.jsx(KF,{})},{path:"/instructions",element:x.jsx(FF,{})},{path:"/print",element:x.jsx($F,{})},{path:"/doublePrint",element:x.jsx(SL,{})}],VF=LD({reducer:{recipe:gL,groups:wL,actions:fL,warning:tL}}),qF=j4(YF);Th.createRoot(document.getElementById("root")).render(x.jsx(Qe.StrictMode,{children:x.jsx(dI,{store:VF,children:x.jsx(K4,{router:qF})})}));export{Ln as F,wn as a,Dm as b,ZF as f,Oi as h,x as j,Dr as s,He as u}; + `},Xj={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Qj(e){let{announcements:t=Xj,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=qj}=e;const{announce:l,announcement:s}=Kj(),c=Nd("DndLiveRegion"),[f,h]=O.useState(!1);if(O.useEffect(()=>{h(!0)},[]),Yj(O.useMemo(()=>({onDragStart(m){let{active:v}=m;l(t.onDragStart({active:v}))},onDragMove(m){let{active:v,over:S}=m;t.onDragMove&&l(t.onDragMove({active:v,over:S}))},onDragOver(m){let{active:v,over:S}=m;l(t.onDragOver({active:v,over:S}))},onDragEnd(m){let{active:v,over:S}=m;l(t.onDragEnd({active:v,over:S}))},onDragCancel(m){let{active:v,over:S}=m;l(t.onDragCancel({active:v,over:S}))}}),[l,t])),!f)return null;const p=Qe.createElement(Qe.Fragment,null,Qe.createElement(Hj,{id:r,value:o.draggable}),Qe.createElement(Gj,{id:c,announcement:s}));return n?Zr.createPortal(p,n):p}var At;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(At||(At={}));function Gf(){}function Kf(e,t){return O.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function K2(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const $r=Object.freeze({x:0,y:0});function Y2(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zj(e,t){const n=Hf(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function V2(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Jj(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ev(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function e6(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}const q2=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ev(t),l=[];for(const s of r){const{id:c}=s,f=n.get(c);if(f){const h=ev(f),p=o.reduce((v,S,E)=>v+Y2(h[E],S),0),m=Number((p/4).toFixed(4));l.push({id:c,data:{droppableContainer:s,value:m}})}}return l.sort(V2)};function t6(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),s=o-r,c=l-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const l of r){const{id:s}=l,c=n.get(s);if(c){const f=t6(c,t);f>0&&o.push({id:s,data:{droppableContainer:l,value:f}})}}return o.sort(Jj)};function r6(e,t){const{top:n,left:r,bottom:o,right:l}=t;return n<=e.y&&e.y<=o&&r<=e.x&&e.x<=l}const X2=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const o=[];for(const l of t){const{id:s}=l,c=n.get(s);if(c&&r6(r,c)){const h=ev(c).reduce((m,v)=>m+Y2(r,v),0),p=Number((h/4).toFixed(4));o.push({id:s,data:{droppableContainer:l,value:p}})}}return o.sort(V2)};function i6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Q2(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:$r}function o6(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...n})}}const a6=o6(1);function Z2(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function l6(e,t,n){const r=Z2(t);if(!r)return e;const{scaleX:o,scaleY:l,x:s,y:c}=r,f=e.left-s-(1-o)*parseFloat(n),h=e.top-c-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,m=l?e.height/l:e.height;return{width:p,height:m,top:h,right:f+p,bottom:h+m,left:f}}const s6={ignoreTransform:!1};function Ol(e,t){t===void 0&&(t=s6);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:h,transformOrigin:p}=bn(e).getComputedStyle(e);h&&(n=l6(n,h,p))}const{top:r,left:o,width:l,height:s,bottom:c,right:f}=n;return{top:r,left:o,width:l,height:s,bottom:c,right:f}}function jx(e){return Ol(e,{ignoreTransform:!0})}function u6(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function c6(e,t){return t===void 0&&(t=bn(e).getComputedStyle(e)),t.position==="fixed"}function f6(e,t){t===void 0&&(t=bn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const l=t[o];return typeof l=="string"?n.test(l):!1})}function Ag(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(Ig(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!vu(o)||W2(o)||n.includes(o))return n;const l=bn(e).getComputedStyle(o);return o!==e&&f6(o,l)&&n.push(o),c6(o,l)?n:r(o.parentNode)}return e?r(e):n}function J2(e){const[t]=Ag(e,1);return t??null}function Nh(e){return!Cd||!e?null:kl(e)?e:Tg(e)?Ig(e)||e===Rl(e).scrollingElement?window:vu(e)?e:null:null}function eC(e){return kl(e)?e.scrollX:e.scrollLeft}function tC(e){return kl(e)?e.scrollY:e.scrollTop}function tv(e){return{x:eC(e),y:tC(e)}}var Wt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Wt||(Wt={}));function nC(e){return!Cd||!e?!1:e===document.scrollingElement}function rC(e){const t={x:0,y:0},n=nC(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,s=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:l,isBottom:s,isRight:c,maxScroll:r,minScroll:t}}const d6={x:.2,y:.2};function p6(e,t,n,r,o){let{top:l,left:s,right:c,bottom:f}=n;r===void 0&&(r=10),o===void 0&&(o=d6);const{isTop:h,isBottom:p,isLeft:m,isRight:v}=rC(e),S={x:0,y:0},E={x:0,y:0},N={height:t.height*o.y,width:t.width*o.x};return!h&&l<=t.top+N.height?(S.y=Wt.Backward,E.y=r*Math.abs((t.top+N.height-l)/N.height)):!p&&f>=t.bottom-N.height&&(S.y=Wt.Forward,E.y=r*Math.abs((t.bottom-N.height-f)/N.height)),!v&&c>=t.right-N.width?(S.x=Wt.Forward,E.x=r*Math.abs((t.right-N.width-c)/N.width)):!m&&s<=t.left+N.width&&(S.x=Wt.Backward,E.x=r*Math.abs((t.left+N.width-s)/N.width)),{direction:S,speed:E}}function h6(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:s}=window;return{top:0,left:0,right:l,bottom:s,width:l,height:s}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function iC(e){return e.reduce((t,n)=>al(t,tv(n)),$r)}function m6(e){return e.reduce((t,n)=>t+eC(n),0)}function v6(e){return e.reduce((t,n)=>t+tC(n),0)}function oC(e,t){if(t===void 0&&(t=Ol),!e)return;const{top:n,left:r,bottom:o,right:l}=t(e);J2(e)&&(o<=0||l<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const g6=[["x",["left","right"],m6],["y",["top","bottom"],v6]];class Dg{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ag(n),o=iC(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,s,c]of g6)for(const f of s)Object.defineProperty(this,f,{get:()=>{const h=c(r),p=o[l]-h;return this.rect[f]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Es{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function y6(e){const{EventTarget:t}=bn(e);return e instanceof t?e:Rl(e)}function kh(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var pr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(pr||(pr={}));function Fx(e){e.preventDefault()}function w6(e){e.stopPropagation()}var We;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(We||(We={}));const aC={start:[We.Space,We.Enter],cancel:[We.Esc],end:[We.Space,We.Enter]},x6=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case We.Right:return{...n,x:n.x+25};case We.Left:return{...n,x:n.x-25};case We.Down:return{...n,y:n.y+25};case We.Up:return{...n,y:n.y-25}}};class lC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Es(Rl(n)),this.windowListeners=new Es(bn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(pr.Resize,this.handleCancel),this.windowListeners.add(pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&oC(r),n($r)}handleKeyDown(t){if(kd(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:l=aC,coordinateGetter:s=x6,scrollBehavior:c="smooth"}=o,{code:f}=t;if(l.end.includes(f)){this.handleEnd(t);return}if(l.cancel.includes(f)){this.handleCancel(t);return}const{collisionRect:h}=r.current,p=h?{x:h.left,y:h.top}:$r;this.referenceCoordinates||(this.referenceCoordinates=p);const m=s(t,{active:n,context:r.current,currentCoordinates:p});if(m){const v=Wf(m,p),S={x:0,y:0},{scrollableAncestors:E}=r.current;for(const N of E){const T=t.code,{isTop:_,isRight:b,isLeft:C,isBottom:I,maxScroll:M,minScroll:G}=rC(N),k=h6(N),B={x:Math.min(T===We.Right?k.right-k.width/2:k.right,Math.max(T===We.Right?k.left:k.left+k.width/2,m.x)),y:Math.min(T===We.Down?k.bottom-k.height/2:k.bottom,Math.max(T===We.Down?k.top:k.top+k.height/2,m.y))},U=T===We.Right&&!b||T===We.Left&&!C,K=T===We.Down&&!I||T===We.Up&&!_;if(U&&B.x!==m.x){const Z=N.scrollLeft+v.x,he=T===We.Right&&Z<=M.x||T===We.Left&&Z>=G.x;if(he&&!v.y){N.scrollTo({left:Z,behavior:c});return}he?S.x=N.scrollLeft-Z:S.x=T===We.Right?N.scrollLeft-M.x:N.scrollLeft-G.x,S.x&&N.scrollBy({left:-S.x,behavior:c});break}else if(K&&B.y!==m.y){const Z=N.scrollTop+v.y,he=T===We.Down&&Z<=M.y||T===We.Up&&Z>=G.y;if(he&&!v.x){N.scrollTo({top:Z,behavior:c});return}he?S.y=N.scrollTop-Z:S.y=T===We.Down?N.scrollTop-M.y:N.scrollTop-G.y,S.y&&N.scrollBy({top:-S.y,behavior:c});break}}this.handleMove(t,al(Wf(m,this.referenceCoordinates),S))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}lC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=aC,onActivation:o}=t,{active:l}=n;const{code:s}=e.nativeEvent;if(r.start.includes(s)){const c=l.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function zx(e){return!!(e&&"distance"in e)}function Ux(e){return!!(e&&"delay"in e)}class Lg{constructor(t,n,r){var o;r===void 0&&(r=y6(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:s}=l;this.props=t,this.events=n,this.document=Rl(s),this.documentListeners=new Es(this.document),this.listeners=new Es(r),this.windowListeners=new Es(bn(s)),this.initialCoordinates=(o=Hf(l))!=null?o:$r,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(pr.Resize,this.handleCancel),this.windowListeners.add(pr.DragStart,Fx),this.windowListeners.add(pr.VisibilityChange,this.handleCancel),this.windowListeners.add(pr.ContextMenu,Fx),this.documentListeners.add(pr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ux(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}if(zx(n))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(pr.Click,w6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(pr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:l}=this,{onMove:s,options:{activationConstraint:c}}=l;if(!o)return;const f=(n=Hf(t))!=null?n:$r,h=Wf(o,f);if(!r&&c){if(zx(c)){if(c.tolerance!=null&&kh(h,c.tolerance))return this.handleCancel();if(kh(h,c.distance))return this.handleStart()}return Ux(c)&&kh(h,c.tolerance)?this.handleCancel():void 0}t.cancelable&&t.preventDefault(),s(f)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===We.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const b6={move:{name:"pointermove"},end:{name:"pointerup"}};class sC extends Lg{constructor(t){const{event:n}=t,r=Rl(n.target);super(t,b6,r)}}sC.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const S6={move:{name:"mousemove"},end:{name:"mouseup"}};var nv;(function(e){e[e.RightClick=2]="RightClick"})(nv||(nv={}));class Mg extends Lg{constructor(t){super(t,S6,Rl(t.event.target))}}Mg.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===nv.RightClick?!1:(r==null||r({event:n}),!0)}}];const Rh={move:{name:"touchmove"},end:{name:"touchend"}};class jg extends Lg{constructor(t){super(t,Rh)}static setup(){return window.addEventListener(Rh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Rh.move.name,t)};function t(){}}}jg.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var Ns;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ns||(Ns={}));var Yf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Yf||(Yf={}));function _6(e){let{acceleration:t,activator:n=Ns.Pointer,canScroll:r,draggingRect:o,enabled:l,interval:s=5,order:c=Yf.TreeOrder,pointerCoordinates:f,scrollableAncestors:h,scrollableAncestorRects:p,delta:m,threshold:v}=e;const S=E6({delta:m,disabled:!l}),[E,N]=zj(),T=O.useRef({x:0,y:0}),_=O.useRef({x:0,y:0}),b=O.useMemo(()=>{switch(n){case Ns.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Ns.DraggableRect:return o}},[n,o,f]),C=O.useRef(null),I=O.useCallback(()=>{const G=C.current;if(!G)return;const k=T.current.x*_.current.x,B=T.current.y*_.current.y;G.scrollBy(k,B)},[]),M=O.useMemo(()=>c===Yf.TreeOrder?[...h].reverse():h,[c,h]);O.useEffect(()=>{if(!l||!h.length||!b){N();return}for(const G of M){if((r==null?void 0:r(G))===!1)continue;const k=h.indexOf(G),B=p[k];if(!B)continue;const{direction:U,speed:K}=p6(G,B,b,t,v);for(const Z of["x","y"])S[Z][U[Z]]||(K[Z]=0,U[Z]=0);if(K.x>0||K.y>0){N(),C.current=G,E(I,s),T.current=K,_.current=U;return}}T.current={x:0,y:0},_.current={x:0,y:0},N()},[t,I,r,N,l,s,JSON.stringify(b),JSON.stringify(S),E,h,M,p,JSON.stringify(v)])}const C6={x:{[Wt.Backward]:!1,[Wt.Forward]:!1},y:{[Wt.Backward]:!1,[Wt.Forward]:!1}};function E6(e){let{delta:t,disabled:n}=e;const r=Bf(t);return gu(o=>{if(n||!r||!o)return C6;const l={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Wt.Backward]:o.x[Wt.Backward]||l.x===-1,[Wt.Forward]:o.x[Wt.Forward]||l.x===1},y:{[Wt.Backward]:o.y[Wt.Backward]||l.y===-1,[Wt.Forward]:o.y[Wt.Forward]||l.y===1}}},[n,t,r])}function N6(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return gu(o=>{var l;return t===null?null:(l=r??o)!=null?l:null},[r,t])}function k6(e,t){return O.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,l=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,r)}));return[...n,...l]},[]),[e,t])}var ru;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ru||(ru={}));var rv;(function(e){e.Optimized="optimized"})(rv||(rv={}));const $x=new Map;function R6(e,t){let{dragging:n,dependencies:r,config:o}=t;const[l,s]=O.useState(null),{frequency:c,measure:f,strategy:h}=o,p=O.useRef(e),m=T(),v=nu(m),S=O.useCallback(function(_){_===void 0&&(_=[]),!v.current&&s(b=>b===null?_:b.concat(_.filter(C=>!b.includes(C))))},[v]),E=O.useRef(null),N=gu(_=>{if(m&&!n)return $x;if(!_||_===$x||p.current!==e||l!=null){const b=new Map;for(let C of e){if(!C)continue;if(l&&l.length>0&&!l.includes(C.id)&&C.rect.current){b.set(C.id,C.rect.current);continue}const I=C.node.current,M=I?new Dg(f(I),I):null;C.rect.current=M,M&&b.set(C.id,M)}return b}return _},[e,l,n,m,f]);return O.useEffect(()=>{p.current=e},[e]),O.useEffect(()=>{m||S()},[n,m]),O.useEffect(()=>{l&&l.length>0&&s(null)},[JSON.stringify(l)]),O.useEffect(()=>{m||typeof c!="number"||E.current!==null||(E.current=setTimeout(()=>{S(),E.current=null},c))},[c,m,S,...r]),{droppableRects:N,measureDroppableContainers:S,measuringScheduled:l!=null};function T(){switch(h){case ru.Always:return!1;case ru.BeforeDragging:return n;default:return!n}}}function Fg(e,t){return gu(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function O6(e,t){return Fg(e,t)}function P6(e){let{callback:t,disabled:n}=e;const r=Ed(t),o=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(r)},[r,n]);return O.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Rd(e){let{callback:t,disabled:n}=e;const r=Ed(t),o=O.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(r)},[n]);return O.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function T6(e){return new Dg(Ol(e),e)}function Bx(e,t,n){t===void 0&&(t=T6);const[r,o]=O.useReducer(c,null),l=P6({callback(f){if(e)for(const h of f){const{type:p,target:m}=h;if(p==="childList"&&m instanceof HTMLElement&&m.contains(e)){o();break}}}}),s=Rd({callback:o});return Ur(()=>{o(),e?(s==null||s.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(s==null||s.disconnect(),l==null||l.disconnect())},[e]),r;function c(f){if(!e)return null;if(e.isConnected===!1){var h;return(h=f??n)!=null?h:null}const p=t(e);return JSON.stringify(f)===JSON.stringify(p)?f:p}}function I6(e){const t=Fg(e);return Q2(e,t)}const Wx=[];function A6(e){const t=O.useRef(e),n=gu(r=>e?r&&r!==Wx&&e&&t.current&&e.parentNode===t.current.parentNode?r:Ag(e):Wx,[e]);return O.useEffect(()=>{t.current=e},[e]),n}function D6(e){const[t,n]=O.useState(null),r=O.useRef(e),o=O.useCallback(l=>{const s=Nh(l.target);s&&n(c=>c?(c.set(s,tv(s)),new Map(c)):null)},[]);return O.useEffect(()=>{const l=r.current;if(e!==l){s(l);const c=e.map(f=>{const h=Nh(f);return h?(h.addEventListener("scroll",o,{passive:!0}),[h,tv(h)]):null}).filter(f=>f!=null);n(c.length?new Map(c):null),r.current=e}return()=>{s(e),s(l)};function s(c){c.forEach(f=>{const h=Nh(f);h==null||h.removeEventListener("scroll",o)})}},[o,e]),O.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,s)=>al(l,s),$r):iC(e):$r,[e,t])}function Hx(e,t){t===void 0&&(t=[]);const n=O.useRef(null);return O.useEffect(()=>{n.current=null},t),O.useEffect(()=>{const r=e!==$r;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Wf(e,n.current):$r}function L6(e){O.useEffect(()=>{if(!Cd)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function M6(e,t){return O.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:l}=r;return n[o]=s=>{l(s,t)},n},{}),[e,t])}function uC(e){return O.useMemo(()=>e?u6(e):null,[e])}const Oh=[];function j6(e,t){t===void 0&&(t=Ol);const[n]=e,r=uC(n?bn(n):null),[o,l]=O.useReducer(c,Oh),s=Rd({callback:l});return e.length>0&&o===Oh&&l(),Ur(()=>{e.length?e.forEach(f=>s==null?void 0:s.observe(f)):(s==null||s.disconnect(),l())},[e]),o;function c(){return e.length?e.map(f=>nC(f)?r:new Dg(t(f),f)):Oh}}function cC(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return vu(t)?t:e}function F6(e){let{measure:t}=e;const[n,r]=O.useState(null),o=O.useCallback(h=>{for(const{target:p}of h)if(vu(p)){r(m=>{const v=t(p);return m?{...m,width:v.width,height:v.height}:v});break}},[t]),l=Rd({callback:o}),s=O.useCallback(h=>{const p=cC(h);l==null||l.disconnect(),p&&(l==null||l.observe(p)),r(p?t(p):null)},[t,l]),[c,f]=$f(s);return O.useMemo(()=>({nodeRef:c,rect:n,setRef:f}),[n,c,f])}const z6=[{sensor:sC,options:{}},{sensor:lC,options:{}}],U6={current:{}},ef={draggable:{measure:jx},droppable:{measure:jx,strategy:ru.WhileDragging,frequency:rv.Optimized},dragOverlay:{measure:Ol}};class ks extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $6={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ks,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ef,measureDroppableContainers:Gf,windowRect:null,measuringScheduled:!1},fC={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gf,draggableNodes:new Map,over:null,measureDroppableContainers:Gf},yu=O.createContext(fC),dC=O.createContext($6);function B6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ks}}}function W6(e,t){switch(t.type){case At.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case At.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case At.DragEnd:case At.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case At.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new ks(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case At.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,l=e.droppable.containers.get(n);if(!l||r!==l.key)return e;const s=new ks(e.droppable.containers);return s.set(n,{...l,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case At.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new ks(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function H6(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=O.useContext(yu),l=Bf(r),s=Bf(n==null?void 0:n.id);return O.useEffect(()=>{if(!t&&!r&&l&&s!=null){if(!kd(l)||document.activeElement===l.target)return;const c=o.get(s);if(!c)return;const{activatorNode:f,node:h}=c;if(!f.current&&!h.current)return;requestAnimationFrame(()=>{for(const p of[f.current,h.current]){if(!p)continue;const m=Bj(p);if(m){m.focus();break}}})}},[r,t,o,s,l]),null}function pC(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,l)=>l({transform:o,...r}),n):n}function G6(e){return O.useMemo(()=>({draggable:{...ef.draggable,...e==null?void 0:e.draggable},droppable:{...ef.droppable,...e==null?void 0:e.droppable},dragOverlay:{...ef.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function K6(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const l=O.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;Ur(()=>{if(!s&&!c||!t){l.current=!1;return}if(l.current||!r)return;const h=t==null?void 0:t.node.current;if(!h||h.isConnected===!1)return;const p=n(h),m=Q2(p,r);if(s||(m.x=0),c||(m.y=0),l.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const v=J2(h);v&&v.scrollBy({top:m.y,left:m.x})}},[t,s,c,r,n])}const Od=O.createContext({...$r,scaleX:1,scaleY:1});var Zi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Zi||(Zi={}));const hC=O.memo(function(t){var n,r,o,l;let{id:s,accessibility:c,autoScroll:f=!0,children:h,sensors:p=z6,collisionDetection:m=n6,measuring:v,modifiers:S,...E}=t;const N=O.useReducer(W6,void 0,B6),[T,_]=N,[b,C]=Vj(),[I,M]=O.useState(Zi.Uninitialized),G=I===Zi.Initialized,{draggable:{active:k,nodes:B,translate:U},droppable:{containers:K}}=T,Z=k?B.get(k):null,he=O.useRef({initial:null,translated:null}),be=O.useMemo(()=>{var dt;return k!=null?{id:k,data:(dt=Z==null?void 0:Z.data)!=null?dt:U6,rect:he}:null},[k,Z]),J=O.useRef(null),[oe,Ne]=O.useState(null),[F,z]=O.useState(null),te=nu(E,Object.values(E)),ne=Nd("DndDescribedBy",s),ae=O.useMemo(()=>K.getEnabled(),[K]),pe=G6(v),{droppableRects:Fe,measureDroppableContainers:Ve,measuringScheduled:qe}=R6(ae,{dragging:G,dependencies:[U.x,U.y],config:pe.droppable}),Me=N6(B,k),bt=O.useMemo(()=>F?Hf(F):null,[F]),Mt=Pl(),Gt=O6(Me,pe.draggable.measure);K6({activeNode:k?B.get(k):null,config:Mt.layoutShiftCompensation,initialRect:Gt,measure:pe.draggable.measure});const Ue=Bx(Me,pe.draggable.measure,Gt),Jn=Bx(Me?Me.parentElement:null),Ge=O.useRef({activatorEvent:null,active:null,activeNode:Me,collisionRect:null,collisions:null,droppableRects:Fe,draggableNodes:B,draggingNode:null,draggingNodeRect:null,droppableContainers:K,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),dn=K.getNodeFor((n=Ge.current.over)==null?void 0:n.id),st=F6({measure:pe.dragOverlay.measure}),Sn=(r=st.nodeRef.current)!=null?r:Me,en=G?(o=st.rect)!=null?o:Ue:null,_n=!!(st.nodeRef.current&&st.rect),Eo=I6(_n?null:Ue),No=uC(Sn?bn(Sn):null),tn=A6(G?dn??Me:null),jt=j6(tn),nn=pC(S,{transform:{x:U.x-Eo.x,y:U.y-Eo.y,scaleX:1,scaleY:1},activatorEvent:F,active:be,activeNodeRect:Ue,containerNodeRect:Jn,draggingNodeRect:en,over:Ge.current.over,overlayNodeRect:st.rect,scrollableAncestors:tn,scrollableAncestorRects:jt,windowRect:No}),Mn=bt?al(bt,U):null,ko=D6(tn),br=Hx(ko),er=Hx(ko,[Ue]),Ft=al(nn,br),rn=en?a6(en,nn):null,Cn=be&&rn?m({active:be,collisionRect:rn,droppableRects:Fe,droppableContainers:ae,pointerCoordinates:Mn}):null,Ti=e6(Cn,"id"),[St,ni]=O.useState(null),Ii=_n?nn:al(nn,er),Ai=i6(Ii,(l=St==null?void 0:St.rect)!=null?l:null,Ue),Di=O.useCallback((dt,zt)=>{let{sensor:Ut,options:tr}=zt;if(J.current==null)return;const A=B.get(J.current);if(!A)return;const j=dt.nativeEvent,W=new Ut({active:J.current,activeNode:A,event:j,options:tr,context:Ge,onStart(ee){const ge=J.current;if(ge==null)return;const ce=B.get(ge);if(!ce)return;const{onDragStart:ie}=te.current,ye={active:{id:ge,data:ce.data,rect:he}};Zr.unstable_batchedUpdates(()=>{ie==null||ie(ye),M(Zi.Initializing),_({type:At.DragStart,initialCoordinates:ee,active:ge}),b({type:"onDragStart",event:ye})})},onMove(ee){_({type:At.DragMove,coordinates:ee})},onEnd:X(At.DragEnd),onCancel:X(At.DragCancel)});Zr.unstable_batchedUpdates(()=>{Ne(W),z(dt.nativeEvent)});function X(ee){return async function(){const{active:ce,collisions:ie,over:ye,scrollAdjustedTranslate:Se}=Ge.current;let tt=null;if(ce&&Se){const{cancelDrop:nt}=te.current;tt={activatorEvent:j,active:ce,collisions:ie,delta:Se,over:ye},ee===At.DragEnd&&typeof nt=="function"&&await Promise.resolve(nt(tt))&&(ee=At.DragCancel)}J.current=null,Zr.unstable_batchedUpdates(()=>{_({type:ee}),M(Zi.Uninitialized),ni(null),Ne(null),z(null);const nt=ee===At.DragEnd?"onDragEnd":"onDragCancel";if(tt){const me=te.current[nt];me==null||me(tt),b({type:nt,event:tt})}})}}},[B]),Li=O.useCallback((dt,zt)=>(Ut,tr)=>{const A=Ut.nativeEvent,j=B.get(tr);if(J.current!==null||!j||A.dndKit||A.defaultPrevented)return;const W={active:j};dt(Ut,zt.options,W)===!0&&(A.dndKit={capturedBy:zt.sensor},J.current=tr,Di(Ut,zt))},[B,Di]),Sr=k6(p,Li);L6(p),Ur(()=>{Ue&&I===Zi.Initializing&&M(Zi.Initialized)},[Ue,I]),O.useEffect(()=>{const{onDragMove:dt}=te.current,{active:zt,activatorEvent:Ut,collisions:tr,over:A}=Ge.current;if(!zt||!Ut)return;const j={active:zt,activatorEvent:Ut,collisions:tr,delta:{x:Ft.x,y:Ft.y},over:A};Zr.unstable_batchedUpdates(()=>{dt==null||dt(j),b({type:"onDragMove",event:j})})},[Ft.x,Ft.y]),O.useEffect(()=>{const{active:dt,activatorEvent:zt,collisions:Ut,droppableContainers:tr,scrollAdjustedTranslate:A}=Ge.current;if(!dt||J.current==null||!zt||!A)return;const{onDragOver:j}=te.current,W=tr.get(Ti),X=W&&W.rect.current?{id:W.id,rect:W.rect.current,data:W.data,disabled:W.disabled}:null,ee={active:dt,activatorEvent:zt,collisions:Ut,delta:{x:A.x,y:A.y},over:X};Zr.unstable_batchedUpdates(()=>{ni(X),j==null||j(ee),b({type:"onDragOver",event:ee})})},[Ti]),Ur(()=>{Ge.current={activatorEvent:F,active:be,activeNode:Me,collisionRect:rn,collisions:Cn,droppableRects:Fe,draggableNodes:B,draggingNode:Sn,draggingNodeRect:en,droppableContainers:K,over:St,scrollableAncestors:tn,scrollAdjustedTranslate:Ft},he.current={initial:en,translated:rn}},[be,Me,Cn,rn,B,Sn,en,Fe,K,St,tn,Ft]),_6({...Mt,delta:U,draggingRect:rn,pointerCoordinates:Mn,scrollableAncestors:tn,scrollableAncestorRects:jt});const va=O.useMemo(()=>({active:be,activeNode:Me,activeNodeRect:Ue,activatorEvent:F,collisions:Cn,containerNodeRect:Jn,dragOverlay:st,draggableNodes:B,droppableContainers:K,droppableRects:Fe,over:St,measureDroppableContainers:Ve,scrollableAncestors:tn,scrollableAncestorRects:jt,measuringConfiguration:pe,measuringScheduled:qe,windowRect:No}),[be,Me,Ue,F,Cn,Jn,st,B,K,Fe,St,Ve,tn,jt,pe,qe,No]),Ro=O.useMemo(()=>({activatorEvent:F,activators:Sr,active:be,activeNodeRect:Ue,ariaDescribedById:{draggable:ne},dispatch:_,draggableNodes:B,over:St,measureDroppableContainers:Ve}),[F,Sr,be,Ue,_,ne,B,St,Ve]);return Qe.createElement(G2.Provider,{value:C},Qe.createElement(yu.Provider,{value:Ro},Qe.createElement(dC.Provider,{value:va},Qe.createElement(Od.Provider,{value:Ai},h)),Qe.createElement(H6,{disabled:(c==null?void 0:c.restoreFocus)===!1})),Qe.createElement(Qj,{...c,hiddenTextDescribedById:ne}));function Pl(){const dt=(oe==null?void 0:oe.autoScrollEnabled)===!1,zt=typeof f=="object"?f.enabled===!1:f===!1,Ut=G&&!dt&&!zt;return typeof f=="object"?{...f,enabled:Ut}:{enabled:Ut}}}),Y6=O.createContext(null),Gx="button",V6="Droppable";function q6(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const l=Nd(V6),{activators:s,activatorEvent:c,active:f,activeNodeRect:h,ariaDescribedById:p,draggableNodes:m,over:v}=O.useContext(yu),{role:S=Gx,roleDescription:E="draggable",tabIndex:N=0}=o??{},T=(f==null?void 0:f.id)===t,_=O.useContext(T?Od:Y6),[b,C]=$f(),[I,M]=$f(),G=M6(s,t),k=nu(n);Ur(()=>(m.set(t,{id:t,key:l,node:b,activatorNode:I,data:k}),()=>{const U=m.get(t);U&&U.key===l&&m.delete(t)}),[m,t]);const B=O.useMemo(()=>({role:S,tabIndex:N,"aria-disabled":r,"aria-pressed":T&&S===Gx?!0:void 0,"aria-roledescription":E,"aria-describedby":p.draggable}),[r,S,N,T,E,p.draggable]);return{active:f,activatorEvent:c,activeNodeRect:h,attributes:B,isDragging:T,listeners:r?void 0:G,node:b,over:v,setNodeRef:C,setActivatorNodeRef:M,transform:_}}function X6(){return O.useContext(dC)}const Q6="Droppable",Z6={timeout:25};function Pd(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const l=Nd(Q6),{active:s,dispatch:c,over:f,measureDroppableContainers:h}=O.useContext(yu),p=O.useRef({disabled:n}),m=O.useRef(!1),v=O.useRef(null),S=O.useRef(null),{disabled:E,updateMeasurementsFor:N,timeout:T}={...Z6,...o},_=nu(N??r),b=O.useCallback(()=>{if(!m.current){m.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{h(Array.isArray(_.current)?_.current:[_.current]),S.current=null},T)},[T]),C=Rd({callback:b,disabled:E||!s}),I=O.useCallback((B,U)=>{C&&(U&&(C.unobserve(U),m.current=!1),B&&C.observe(B))},[C]),[M,G]=$f(I),k=nu(t);return O.useEffect(()=>{!C||!M.current||(C.disconnect(),m.current=!1,C.observe(M.current))},[M,C]),Ur(()=>(c({type:At.RegisterDroppable,element:{id:r,key:l,disabled:n,node:M,rect:v,data:k}}),()=>c({type:At.UnregisterDroppable,key:l,id:r})),[r]),O.useEffect(()=>{n!==p.current.disabled&&(c({type:At.SetDroppableDisabled,id:r,key:l,disabled:n}),p.current.disabled=n)},[r,l,n,c]),{active:s,rect:v,isOver:(f==null?void 0:f.id)===r,node:M,over:f,setNodeRef:G}}function J6(e){let{animation:t,children:n}=e;const[r,o]=O.useState(null),[l,s]=O.useState(null),c=Bf(n);return!n&&!r&&c&&o(c),Ur(()=>{if(!l)return;const f=r==null?void 0:r.key,h=r==null?void 0:r.props.id;if(f==null||h==null){o(null);return}Promise.resolve(t(h,l)).then(()=>{o(null)})},[t,r,l]),Qe.createElement(Qe.Fragment,null,n,r?O.cloneElement(r,{ref:s}):null)}const eF={x:0,y:0,scaleX:1,scaleY:1};function tF(e){let{children:t}=e;return Qe.createElement(yu.Provider,{value:fC},Qe.createElement(Od.Provider,{value:eF},t))}const nF={position:"fixed",touchAction:"none"},rF=e=>kd(e)?"transform 250ms ease":void 0,iF=O.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:l,className:s,rect:c,style:f,transform:h,transition:p=rF}=e;if(!c)return null;const m=o?h:{...h,scaleX:1,scaleY:1},v={...nF,width:c.width,height:c.height,top:c.top,left:c.left,transform:ki.Transform.toString(m),transformOrigin:o&&r?Zj(r,c):void 0,transition:typeof p=="function"?p(r):p,...f};return Qe.createElement(n,{className:s,style:v,ref:t},l)}),oF=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:l,className:s}=e;if(l!=null&&l.active)for(const[c,f]of Object.entries(l.active))f!==void 0&&(o[c]=n.node.style.getPropertyValue(c),n.node.style.setProperty(c,f));if(l!=null&&l.dragOverlay)for(const[c,f]of Object.entries(l.dragOverlay))f!==void 0&&r.node.style.setProperty(c,f);return s!=null&&s.active&&n.node.classList.add(s.active),s!=null&&s.dragOverlay&&r.node.classList.add(s.dragOverlay),function(){for(const[f,h]of Object.entries(o))n.node.style.setProperty(f,h);s!=null&&s.active&&n.node.classList.remove(s.active)}},aF=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ki.Transform.toString(t)},{transform:ki.Transform.toString(n)}]},lF={duration:250,easing:"ease",keyframes:aF,sideEffects:oF({styles:{active:{opacity:"0"}}})};function sF(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return Ed((l,s)=>{if(t===null)return;const c=n.get(l);if(!c)return;const f=c.node.current;if(!f)return;const h=cC(s);if(!h)return;const{transform:p}=bn(s).getComputedStyle(s),m=Z2(p);if(!m)return;const v=typeof t=="function"?t:uF(t);return oC(f,o.draggable.measure),v({active:{id:l,data:c.data,node:f,rect:o.draggable.measure(f)},draggableNodes:n,dragOverlay:{node:s,rect:o.dragOverlay.measure(h)},droppableContainers:r,measuringConfiguration:o,transform:m})})}function uF(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...lF,...e};return l=>{let{active:s,dragOverlay:c,transform:f,...h}=l;if(!t)return;const p={x:c.rect.left-s.rect.left,y:c.rect.top-s.rect.top},m={scaleX:f.scaleX!==1?s.rect.width*f.scaleX/c.rect.width:1,scaleY:f.scaleY!==1?s.rect.height*f.scaleY/c.rect.height:1},v={x:f.x-p.x,y:f.y-p.y,...m},S=o({...h,active:s,dragOverlay:c,transform:{initial:f,final:v}}),[E]=S,N=S[S.length-1];if(JSON.stringify(E)===JSON.stringify(N))return;const T=r==null?void 0:r({active:s,dragOverlay:c,...h}),_=c.node.animate(S,{duration:t,easing:n,fill:"forwards"});return new Promise(b=>{_.onfinish=()=>{T==null||T(),b()}})}}let Kx=0;function cF(e){return O.useMemo(()=>{if(e!=null)return Kx++,Kx},[e])}const iv=Qe.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:l,modifiers:s,wrapperElement:c="div",className:f,zIndex:h=999}=e;const{activatorEvent:p,active:m,activeNodeRect:v,containerNodeRect:S,draggableNodes:E,droppableContainers:N,dragOverlay:T,over:_,measuringConfiguration:b,scrollableAncestors:C,scrollableAncestorRects:I,windowRect:M}=X6(),G=O.useContext(Od),k=cF(m==null?void 0:m.id),B=pC(s,{activatorEvent:p,active:m,activeNodeRect:v,containerNodeRect:S,draggingNodeRect:T.rect,over:_,overlayNodeRect:T.rect,scrollableAncestors:C,scrollableAncestorRects:I,transform:G,windowRect:M}),U=Fg(v),K=sF({config:r,draggableNodes:E,droppableContainers:N,measuringConfiguration:b}),Z=U?T.setRef:void 0;return Qe.createElement(tF,null,Qe.createElement(J6,{animation:K},m&&k?Qe.createElement(iF,{key:k,id:m.id,ref:Z,as:c,activatorEvent:p,adjustScale:t,className:f,transition:l,rect:U,style:{zIndex:h,...o},transform:B},n):null))});function mC(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const fF=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e;const o=r[0];return!t||!o?n:mC(n,t,o)},dF=e=>{let{transform:t,draggingNodeRect:n,windowRect:r}=e;return!n||!r?t:mC(t,n,r)};function vC(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Fc(e){return e!==null&&e>=0}const pF=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const l=vC(t,r,n),s=t[o],c=l[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.height}},hF="Sortable",mF=Qe.createContext({activeIndex:-1,containerId:hF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:pF,disabled:{draggable:!1,droppable:!1}}),vF=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return vC(n,r,o).indexOf(t)},gF=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:l,newIndex:s,previousItems:c,previousContainerId:f,transition:h}=e;return!h||!r||c!==l&&o===s?!1:n?!0:s!==o&&t===f},yF={duration:200,easing:"ease"},gC="transform",wF=ki.Transition.toString({property:gC,duration:0,easing:"linear"}),xF={roleDescription:"sortable"};function bF(e){let{disabled:t,index:n,node:r,rect:o}=e;const[l,s]=O.useState(null),c=O.useRef(n);return Ur(()=>{if(!t&&n!==c.current&&r.current){const f=o.current;if(f){const h=Ol(r.current,{ignoreTransform:!0}),p={x:f.left-h.left,y:f.top-h.top,scaleX:f.width/h.width,scaleY:f.height/h.height};(p.x||p.y)&&s(p)}}n!==c.current&&(c.current=n)},[t,n,r,o]),O.useEffect(()=>{l&&s(null)},[l]),l}function yC(e){let{animateLayoutChanges:t=gF,attributes:n,disabled:r,data:o,getNewIndex:l=vF,id:s,strategy:c,resizeObserverConfig:f,transition:h=yF}=e;const{items:p,containerId:m,activeIndex:v,disabled:S,disableTransforms:E,sortedRects:N,overIndex:T,useDragOverlay:_,strategy:b}=O.useContext(mF),C=SF(r,S),I=p.indexOf(s),M=O.useMemo(()=>({sortable:{containerId:m,index:I,items:p},...o}),[m,o,I,p]),G=O.useMemo(()=>p.slice(p.indexOf(s)),[p,s]),{rect:k,node:B,isOver:U,setNodeRef:K}=Pd({id:s,data:M,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:G,...f}}),{active:Z,activatorEvent:he,activeNodeRect:be,attributes:J,setNodeRef:oe,listeners:Ne,isDragging:F,over:z,setActivatorNodeRef:te,transform:ne}=q6({id:s,data:M,attributes:{...xF,...n},disabled:C.draggable}),ae=Fj(K,oe),pe=!!Z,Fe=pe&&!E&&Fc(v)&&Fc(T),Ve=!_&&F,qe=Ve&&Fe?ne:null,bt=Fe?qe??(c??b)({rects:N,activeNodeRect:be,activeIndex:v,overIndex:T,index:I}):null,Mt=Fc(v)&&Fc(T)?l({id:s,items:p,activeIndex:v,overIndex:T}):I,Gt=Z==null?void 0:Z.id,Ue=O.useRef({activeId:Gt,items:p,newIndex:Mt,containerId:m}),Jn=p!==Ue.current.items,Ge=t({active:Z,containerId:m,isDragging:F,isSorting:pe,id:s,index:I,items:p,newIndex:Ue.current.newIndex,previousItems:Ue.current.items,previousContainerId:Ue.current.containerId,transition:h,wasDragging:Ue.current.activeId!=null}),dn=bF({disabled:!Ge,index:I,node:B,rect:k});return O.useEffect(()=>{pe&&Ue.current.newIndex!==Mt&&(Ue.current.newIndex=Mt),m!==Ue.current.containerId&&(Ue.current.containerId=m),p!==Ue.current.items&&(Ue.current.items=p)},[pe,Mt,m,p]),O.useEffect(()=>{if(Gt===Ue.current.activeId)return;if(Gt&&!Ue.current.activeId){Ue.current.activeId=Gt;return}const Sn=setTimeout(()=>{Ue.current.activeId=Gt},50);return()=>clearTimeout(Sn)},[Gt]),{active:Z,activeIndex:v,attributes:J,data:M,rect:k,index:I,newIndex:Mt,items:p,isOver:U,isSorting:pe,isDragging:F,listeners:Ne,node:B,overIndex:T,over:z,setNodeRef:ae,setActivatorNodeRef:te,setDroppableNodeRef:K,setDraggableNodeRef:oe,transform:dn??bt,transition:st()};function st(){if(dn||Jn&&Ue.current.newIndex===I)return wF;if(!(Ve&&!kd(he)||!h)&&(pe||Ge))return ki.Transition.toString({...h,property:gC})}}function SF(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}We.Down,We.Right,We.Up,We.Left;function Td({groupName:e,item:t,allowRemove:n,onRemove:r}){const{attributes:o,listeners:l,setNodeRef:s,transform:c,transition:f}=yC({id:`${e}_${t.itemName}`,data:{type:"Ingredient",item:t,parentGroup:e}}),h={transition:f,transform:ki.Translate.toString(c)};return x.jsxs("div",{ref:s,className:"relative print-rounded aspect-square w-clamp card-shadow center",style:h,...l,...o,children:[x.jsx("img",{src:`/assets/ingredients/${t.itemName.toLowerCase()}.webp`,alt:t.itemName,"data-testid":`${e}_${t.itemName}_selected`,className:"print-rounded"}),n&&x.jsx("div",{className:"flex center rounded-2xl",children:x.jsx(Ln,{icon:yd,size:"sm",onClick:()=>r==null?void 0:r(),className:"absolute pointer-events-auto top-0 right-0 -m-2 cursor-pointer text-white bg-black bg-opacity-80 rounded-full px-1 py-1"})})]},`${e}_${t.itemName}`)}function _F({group:e,item:t}){const n=wn(),r=(o,l)=>{n(X_({groupName:o,itemName:l}))};return x.jsx("div",{children:x.jsx("div",{className:"mx-2 hover:cursor-grabbing hover:scale-105",children:x.jsx(Td,{groupName:e.groupName,item:t,allowRemove:!0,onRemove:()=>r(e.groupName,t.itemName)})})})}function CF({group:e}){const{setNodeRef:t}=Pd({id:e.groupName,data:{type:"Group",group:e}});return x.jsx(x.Fragment,{children:x.jsx("div",{ref:t,className:"flex flex-wrap justify-center gap-y-4 mb-12 center",children:e.items.map((n,r)=>x.jsx("div",{children:x.jsx(_F,{group:e,item:n})},`${n}${r.toString()}`))})})}function EF(){const e=wn();return He(n=>n.groups.ingredientsGroups).map((n,r)=>x.jsxs("div",{className:"flex flex-col center",children:[x.jsx("p",{onKeyDown:Oi,"data-testid":"chosen_group",onClick:()=>e(Y_(n.groupName)),className:"group-chip text-fluidSubtitle",children:n.groupName}),x.jsx(CF,{group:n})]},`${n.groupName}_${r}`))}function NF(){const e=wn(),t=He(f=>f.groups.ingredientsGroups),[n,r]=O.useState(null),o=f=>{var h;r((h=f.active.data.current)==null?void 0:h.item)},l=f=>{var E,N,T,_;const{active:h,over:p}=f;if(!p)return;const m=((E=h.data.current)==null?void 0:E.type)==="Ingredient",v=((N=p.data.current)==null?void 0:N.type)==="Group",S=(T=h.data.current)==null?void 0:T.parentGroup;if(m&&v&&S!==p.id){const b=h.id.split("_")[1];if(t.filter(I=>I.groupName===p.id)[0].items.findIndex(I=>I.itemName===b)>-1)return;e(X_({groupName:S,itemName:b})),e(Dm({groupName:p.id,itemName:b,item:(_=h.data.current)==null?void 0:_.item}))}r(null)},s=f=>{const h=X2(f);return h.length>0?h.sort((m,v)=>{const S=f.droppableRects.get(m.id),E=f.droppableRects.get(v.id);if(S&&E){const N=S.width*S.height;return E.width*E.height-N}return 0}):q2(f)},c=K2(Kf(Mg,{activationConstraint:{distance:5}}),Kf(jg,{activationConstraint:{distance:4}}));return x.jsxs(hC,{collisionDetection:s,modifiers:[fF],sensors:c,onDragEnd:l,onDragStart:o,children:[x.jsxs("div",{className:"relative px-4 pb-4 overflow-auto center text-center no-scrollbar overflow-x-hidden",children:[x.jsx("h2",{className:"mb-8 text-fluidSubtitle",children:"Selected ingredient groups"}),x.jsx(EF,{})]}),n&&x.jsx(iv,{children:x.jsx(Td,{groupName:`${n.itemName}_${Math.random().toString()}`,item:n,allowRemove:!1})})]})}function kF(){const e=He(t=>t.groups.ingredientsGroups);return x.jsxs("div",{"data-testid":"homepage",className:"max-h-screen flex flex-col",children:[x.jsx(sa,{page:"/quantities",isNext:!0}),x.jsx(_L,{}),x.jsxs("div",{className:"flex flex-grow md:p-2 lg:p-2 sm:gap-4 md:gap-4 lg:gap-8 mx-4",children:[x.jsx("div",{className:"main-gallery sm:w-2/3 md:w-4/5 lg:w-3/5",children:x.jsx(jj,{})}),x.jsx("div",{className:`main-gallery sm:w-1/3 w-2/5 ${e.length===0&&"required-element-border"}`,children:x.jsx(NF,{})})]})]})}function RF(){const e=wn(),t=He(r=>r.actions.availableItems),n=r=>{e(pg(r))};return t.map((r,o)=>x.jsx("div",{"data-item-name":r.itemName,className:"mb-1 pb-2 lg:pb-4 print-rounded opacity-100 hover:scale-105",onKeyDown:Oi,children:x.jsx(Td,{groupName:o.toString(),item:r,allowRemove:!1,onRemove:()=>n(r)})},`${r.itemName}_shelf_${o}`))}function wC({action:e}){const{attributes:t,listeners:n,setNodeRef:r,transform:o,transition:l}=yC({id:e.actionName,data:{type:"Action",action:e}}),s={transition:l,transform:ki.Translate.toString(o)},{actionName:c}=e;return x.jsx("div",{ref:r,style:s,...n,...t,children:x.jsxs("div",{className:"bg-white card-shadow print-rounded w-clamp",children:[x.jsx("img",{draggable:"false",src:`/assets/chefActions/${c.toLowerCase()}.webp`,alt:c,"data-testid":`${c}_action`,className:"print-rounded-img rounded-t-lg w-clamp"}),x.jsx("p",{className:"text-fluidPrint py-2",children:c})]},c)})}function OF(){return dL.map(e=>x.jsx("div",{className:"bg-white mx-2 aspect-videoThin hover:scale-105",children:x.jsx(wC,{action:e})},`${e.actionName}`))}function Yx({icon:e,onCaretClick:t}){return x.jsx("div",{className:"flex center max-h-short cursor-pointer hover:border-y-2 hover:border-black",onClick:()=>t(),onKeyDown:Oi,children:x.jsx(Ln,{icon:e,size:"lg"})})}function PF({instruction:e}){const t=O.useRef(null),n=wn(),[r,o]=O.useState(e.note),[l,s]=O.useState(null),c=v=>{r?n(Nc({id:e.id,note:v})):(s(null),n(Nc({id:e.id,note:""})))},f=()=>{s(null),o(""),n(Nc({id:e.id,note:""}))},h=v=>{o(v.target.value)},p=l===e.id;O.useEffect(()=>{p&&t.current&&t.current.focus()},[p]);const m=(v,S)=>{if(v.key==="Enter"){const{id:E,note:N}=S;n(Nc({id:E,note:N})),v.target.blur()}};return p||e.note?x.jsxs("div",{className:"flex justify-end items-center md:w-60 lg:w-96",children:[x.jsx("input",{type:"text",ref:t,className:"input-border w-full text-fluidSubtitle text-center md:-m-2 lg:-m-4 text-ellipsis whitespace-nowrap overflow-hidden sm:p-0 md:p-1",placeholder:"Add a note to this instruction",value:r,onChange:h,onBlur:v=>c(v.target.value),onKeyDown:v=>m(v,e)}),x.jsx(Ln,{icon:yd,size:"1x",className:"bg-white -ml-2 cursor-pointer",onClick:()=>f()})]}):x.jsx("button",{type:"button",className:"sexy-button md:px-1 lg:px-3 md:py-1 lg:py-2 -m-4 min-w-16 card-shadow border border-transparent bg-yellow-100 text-neutral-800 font-semibold rounded-lg text-xs hover:bg-white hover:border-2 hover:border-yellow-200",onClick:()=>s(e.id),children:x.jsx("span",{children:"Add Note"})})}function TF({instruction:e}){const t=wn(),[n,r]=O.useState(e.action.time),o=f=>{f.target.select()},l=f=>{Number.isNaN(f)?r(0):r(f)},s=()=>{n>0&&r(f=>f-1)},c=()=>{r(f=>f+1)};return O.useEffect(()=>{t(lL({instruction:e,time:n}))},[t,e,n]),x.jsxs("div",{className:"flex flex-row rounded-md mx-2",children:[x.jsx("button",{type:"button",onClick:s,children:x.jsx(Ln,{icon:e2,className:"num-input-icons"})}),x.jsx("input",{className:`sm:w-8 md:w-8 lg:w-16 p-0 md:mx-2 lg:mx-4 focus:outline-none text-center rounded-2xl sm:text-2xl md:text-3xl lg:text-4xl bg-transparent ${n===0&&"required-element-fill"}`,type:"number",id:"units-number-input",value:n,required:!0,onChange:f=>l(Number.parseFloat(f.target.value)),onFocus:o,onWheel:f=>f.target.blur()}),x.jsx("button",{type:"button",onClick:c,children:x.jsx(Ln,{icon:t2,className:"num-input-icons"})})]})}function IF({action:e}){const{actionName:t}=e;return x.jsxs("div",{className:"bg-white card-shadow print-rounded w-clamp",children:[x.jsx("img",{draggable:"false",src:`/assets/chefActions/${t.toLowerCase()}.webp`,alt:t,"data-testid":`${t}_action`,className:"print-rounded-img md:w-clampSmall lg:w-clamp"}),x.jsx("p",{className:"text-fluidCard py-2",children:t})]},t)}function AF({groupName:e,item:t,onRemoveItem:n}){const r=()=>{n(t)};return x.jsxs("div",{className:"relative print-rounded aspect-square print-image card-shadow center",children:[x.jsx("img",{draggable:"false",src:`/assets/ingredients/${t.itemName.toLowerCase()}.webp`,alt:t.itemName,"data-testid":`${e}_${t.itemName}_shelf`,className:"print-rounded print-image"}),x.jsx("div",{className:"flex center rounded-2xl",children:x.jsx(Ln,{icon:yd,size:"sm",onClick:r,className:"absolute pointer-events-auto top-0 right-0 -m-2 cursor-pointer text-white bg-black bg-opacity-80 rounded-full px-1 py-1"})})]},`${e}_${t.itemName}`)}function DF({instruction:e,refClick:t}){const[n,r]=O.useState(""),{setNodeRef:o}=Pd({id:e.id,data:{type:"Instruction",instruction:e}}),l=wn(),s=(E,N)=>{const T=N.items.filter(_=>!Ho.isEqual(_,E));l(H_({id:N.id,items:T})),l(pg(E))},c=E=>{l(aL(E)),l(cL(E.items))},f=(E,N)=>{l(iL({id:N.id,customItem:E.target.value})),E.target.blur()},h=E=>{r(E.target.value)},p=E=>{E.key===" "&&(E.preventDefault(),r(N=>`${N} `))},{id:m,action:v,items:S}=e;return x.jsxs("div",{ref:o,className:"z-50 flex flex-col mb-12 border-l-2 border-r-2 border-l-neutral-400 border-r-neutral-400 rounded-3xl lg:scale-90",children:[x.jsxs("div",{className:"flex items-center justify-between pl-6",children:[x.jsxs("div",{className:"flex justify-start w-full py-2",children:[x.jsxs("div",{draggable:"false",className:"flex center",onClick:()=>{t(e)},onKeyDown:Oi,children:[x.jsx(IF,{action:v}),x.jsx("span",{className:"md:text-xs text-fluidSubtitle ml-4",children:"THE"}),x.jsx("div",{className:"flex flex-row",children:x.jsx("div",{className:"center sm:w-36 md:w-44 lg:w-52 xl:w-56 flex flex-row flex-wrap",children:!n&&S.length>0?S.map(E=>x.jsx("div",{className:"px-2 py-2",children:x.jsx(AF,{groupName:m.toString(),item:E,onRemoveItem:N=>s(N,e)})},`${m}_${E.itemName}`)):x.jsxs("div",{className:"flex flex-col justify-between items-center sm:min-h-16 md:min-h-24",children:[x.jsx("span",{className:"text-fluidPrint",children:n?x.jsxs("b",{className:"text-neutral-400",children:["Drop Item ",x.jsx("br",{})," or"]}):x.jsxs("b",{children:["Drop Item ",x.jsx("br",{})," or"]})},m),x.jsx("input",{type:"text",className:"input-border sm:w-24 md:w-36 text-sm text-center text-ellipsis whitespace-nowrap overflow-hidden p-1",placeholder:"Custom text",value:n,onChange:E=>h(E),onKeyDown:p,onBlur:E=>f(E,e)})]})})})]}),v.time!==-1&&x.jsxs("div",{className:"flex center",children:[x.jsx("span",{className:"text-fluidSubtitle mx-2",children:"FOR"}),x.jsx(TF,{instruction:e}),x.jsx("span",{className:"text-fluidSubtitle md:ml-2 lg:ml-4",children:v.unit})]})]}),x.jsx("button",{type:"button",className:"px-4 md:ml-2 lg:ml-8 h-fit",onClick:()=>c(e),children:x.jsx(Ln,{icon:kL,size:"lg",color:"red",className:"cursor-pointer hover:text-black"})})]}),x.jsx("div",{className:"flex center sm:mt-4 md:mt-6",children:x.jsx(PF,{instruction:e})})]},`${m}_${v}`)}const LF=O.memo(({onRefClick:e})=>[...He(r=>r.actions.chefInstructions)].sort((r,o)=>r.id-o.id).map(r=>x.jsx("div",{"data-instruction":r.id,className:"pt-4",children:x.jsx(DF,{instruction:r,refClick:o=>e(o)})},r.id)));function MF({onInstructionClick:e}){const{setNodeRef:t}=Pd({id:"steps_container",data:{type:"Steps"}}),n=He(s=>s.actions.chefInstructions),r=O.useRef(null),o=O.useRef(n.length),l=O.useCallback(()=>{const s=r.current;if(n.length===0)return;const c=n[n.length-1],f=s==null?void 0:s.querySelector(`[data-instruction="${c.id}"]`);f&&f.scrollIntoView({behavior:"smooth",inline:"center"})},[n]);return O.useEffect(()=>{n.length!==o.current&&(l(),o.current=n.length)},[n,l]),x.jsxs("div",{ref:s=>{t(s),r.current=s},className:`flex flex-col bg-slate-50 w-full md:ml-4 lg:ml-8 mb-1 max-h-semi overflow-scroll no-scrollbar ${n.length===0?"justify-center items-center":"justify-start items-center pt-2"} lg:overflow-x-auto`,children:[n.length===0&&x.jsxs("h2",{className:"text-fluidSubtitle text-gray-600",children:["Drag an action ",x.jsx("b",{children:"[ top ]"})," to this area ",x.jsx("br",{}),"and start adding ingredients ",x.jsx("b",{children:"[left ]"})," to it!",x.jsx("br",{}),x.jsx("br",{}),"To add more steps just",x.jsx("br",{}),"drag another action.",x.jsx("br",{}),x.jsx("br",{}),x.jsx("b",{children:"Replace an action by dragging a new one over it!"})]}),x.jsx(LF,{onRefClick:s=>e(s)})]})}function jF(){const e=O.useRef(null),t=O.useRef(null),[n,r]=O.useState(!1),[o,l]=O.useState(0),[s,c]=O.useState(0),[f,h]=O.useState(null),[p,m]=O.useState(null),[v,S]=O.useState(null),E=wn(),N=He(U=>U.actions.chefInstructions);O.useEffect(()=>{if(v){const U=v.current,K=Z=>{U&&(Z.preventDefault(),Z.deltaY<0?U.scrollLeft-=20:U.scrollLeft+=20)};return U&&U.addEventListener("wheel",K,{passive:!1}),()=>{U&&U.removeEventListener("wheel",K)}}},[v]);const T=U=>{if(v!=null&&v.current){const Z=v.current.firstChild.offsetWidth*4;v.current.scrollBy({left:U==="left"?-Z:Z,behavior:"smooth"})}},_=(U,K)=>{U.current&&(S(U),U.current&&(r(!0),l(K.pageX-U.current.offsetLeft),c(U.current.scrollLeft)))},b=(U,K)=>{if(!(!n||!U.current)&&(S(U),K.preventDefault(),U.current)){const he=K.pageX-U.current.offsetLeft-o;U.current.scrollLeft=s-he}},C=U=>{const K=e.current;let Z=null;Z=K==null?void 0:K.querySelector(`[data-action-name="${U.action.actionName}"]`),Z&&Z.scrollIntoView({behavior:"smooth",inline:"center"})},I=U=>{E(oL({id:N.length>0?Math.max(...N.map(K=>K.id))+1:0,note:"",action:U,items:[]}))},M=U=>{var K,Z,he,be;((K=U.active.data.current)==null?void 0:K.type)==="Action"?h((Z=U.active.data.current)==null?void 0:Z.action):h(null),((he=U.active.data.current)==null?void 0:he.type)==="Ingredient"?m((be=U.active.data.current)==null?void 0:be.item):m(null)},G=U=>{var J,oe,Ne,F,z,te;const{active:K,over:Z}=U;if(!Z)return;const he=(J=K.data.current)==null?void 0:J.type,be=(oe=Z.data.current)==null?void 0:oe.type;if(he==="Action"&&be==="Steps")I((Ne=K.data.current)==null?void 0:Ne.action);else if(be==="Instruction"){const ne=(F=Z.data.current)==null?void 0:F.instruction;if(he==="Action"){const ae=(z=K.data.current)==null?void 0:z.action;E(sL({id:ne.id,action:ae}))}else if(he==="Ingredient"){const ae=(te=K.data.current)==null?void 0:te.item;ne.items.find(Fe=>Ho.isEqual(Fe,ae))||(E(H_({id:ne.id,items:[...ne.items,ae]})),E(pg(ae)))}}},k=U=>{const K=X2(U);return K.length>0?K.sort((he,be)=>{const J=U.droppableRects.get(he.id),oe=U.droppableRects.get(be.id);if(J&&oe){const Ne=J.width*J.height,F=oe.width*oe.height;return Ne-F}return 0}):q2(U)},B=K2(Kf(Mg,{activationConstraint:{distance:0}}),Kf(jg,{activationConstraint:{distance:10}}));return x.jsx(hC,{collisionDetection:k,modifiers:[dF],sensors:B,onDragEnd:G,onDragStart:M,children:x.jsxs("div",{className:"mt-16 max-h-5/6 w-11/12 input-gallery-border p-4",children:[x.jsx("h2",{className:"text-fluidSubtitle mb-2",children:"Plan the instructions and steps for this recipe!"}),x.jsxs("div",{className:"flex flex-row gap-2",children:[x.jsx(Yx,{icon:IL,onCaretClick:()=>T("left")}),x.jsx("div",{id:"actions-scrollbar",className:"flex w-full overflow-x-scroll py-4 pt-4 overflow-y-auto",ref:e,onMouseDown:U=>_(e,U),onMouseLeave:()=>r(!1),onMouseUp:()=>r(!1),onMouseMove:U=>b(e,U),children:x.jsx(OF,{})}),x.jsx(Yx,{icon:RL,onCaretClick:()=>T("right")}),f&&x.jsx(iv,{children:x.jsx(wC,{action:f})})]}),x.jsxs("div",{className:"flex w-full justify-between mt-8",children:[x.jsx("div",{ref:t,className:"flex flex-col min-w-fit sm:p-2 md:p-4 sm:mr-4 md:mr-2 max-h-half overflow-y-scroll scroll-normal",children:x.jsx("div",{className:"scroll-mirror",children:x.jsx(RF,{})})}),p&&x.jsx(iv,{children:x.jsx(Td,{groupName:Math.random().toString(),item:p,allowRemove:!1})}),x.jsx(MF,{onInstructionClick:U=>C(U)})]})]})})}function FF(){const e=He(l=>l.warning.warning),t=He(l=>l.groups.ingredientsGroups),n=He(l=>l.actions.chefInstructions);let r="/print";return(t.flatMap(l=>l.items).length>18||n.length>3)&&(r="/doublePrint"),x.jsxs("div",{"data-testid":"instructions",className:"min-h-screen flex flex-col",children:[x.jsx(sa,{page:r,isNext:!0}),x.jsx(sa,{page:"/quantities",isNext:!1}),x.jsx("div",{className:"flex h-screen justify-center text-center",children:x.jsx(jF,{})}),e&&x.jsx(hg,{})]})}function zF(){return He(t=>t.groups.ingredientsGroups).map(t=>x.jsxs("div",{className:"flex flex-row center md:gap-x-3 lg:gap-x-4 mb-2",children:[x.jsx("p",{className:"text-fluidSubtitle leading-none md:mr-2 lg:mr-4",children:t.groupName}),t.items.map(n=>x.jsxs("div",{className:"flex flex-col h-fit center md:rounded-md lg:rounded-lg",children:[x.jsx("img",{src:`/assets/ingredients/${n.itemName.toLowerCase()}.webp`,alt:n.itemName,className:"card-shadow md:w-tinyImage lg:w-miniImage md:rounded-md lg:rounded-lg"}),x.jsxs("div",{className:"py-2 h-fit",children:[x.jsx("p",{className:"text-fluidPrintTitle leading-tight px-2",children:n.itemName}),x.jsx("p",{className:"text-fluidPrintTitle leading-tight",children:x.jsxs("b",{children:[n.amount,"  ",n.unit]})})]})]},`${t.groupName}_${n.itemName}`))]},t.groupName))}function UF(){return He(t=>t.actions.chefInstructions).map((t,n)=>x.jsxs("div",{className:"flex flex-col md:mb-2 lg:mb-6 md:w-5/6 lg:w-3/5 ",children:[x.jsxs("div",{className:"relative flex flex-row gap-4 pointer-events-none items-center justify-start ",children:[x.jsxs("span",{className:"md:text-xs lg:text-sm min-w-12",children:["Step ",n+1]}),x.jsx("div",{children:x.jsxs("div",{className:"bg-white card-shadow print-rounded w-tinyImage mr-2",children:[x.jsx("img",{draggable:"false",src:`/assets/chefActions/${t.action.actionName.toLowerCase()}.webp`,alt:t.action.actionName,"data-testid":`${t.action.actionName}_action`,className:"print-rounded-img w-tinyImage"}),x.jsx("p",{className:"md:text-xs lg:text-sm py-0.5",children:t.action.actionName})]})}),x.jsx("span",{className:" md:text-xs lg:text-sm",children:"THE"}),t.customItem?x.jsx("b",{className:"md:text-xs lg:text-sm",children:t.customItem}):x.jsx("div",{className:"center justify-start md:w-44 lg:min-w-48 flex flex-row flex-wrap",children:t.items.map(r=>x.jsxs("div",{className:"flex center py-1 px-2",children:[x.jsx("img",{src:`/assets/ingredients/${r.itemName.toLowerCase()}.webp`,alt:r.itemName,className:"card-shadow md:w-10 lg:w-12 print-rounded-img"})," "]},`${t.id}_${r.itemName}`))}),t.action.time!==-1&&x.jsxs("span",{className:"-bggreen-300 md:text-xs lg:text-sm min-w-12 md:-ml-4",children:["FOR ",x.jsx("br",{}),t.action.time," ",t.action.unit]})]}),x.jsx("div",{className:"flex w-full left-0",children:x.jsx("span",{className:"md:text-xs lg:text-sm md:pt-0.5 lg:pt-1",children:t.note})})]},`${t.id}`))}function $F(){const e=He(r=>r.recipe.title);let t=0;const n=document.querySelector("#a4");return n&&(t=n.getBoundingClientRect().width/n.getBoundingClientRect().height),x.jsxs("div",{"data-testid":"resultpage",className:"relative min-h-screen flex flex-col",children:[x.jsx(J_,{}),x.jsx("span",{className:`absolute top-1/3 left-0 ml-12 font-bold ${t>.709&&t<.7095?"text-green-600":"text-red-600"}`,children:t}),x.jsx(sa,{page:"/instructions",isNext:!1}),x.jsx("div",{className:"flex flex-col center mt-28 mb-16",children:x.jsxs("div",{id:"a4",className:"relative flex flex-col a4ratio w-2/3 text-center input-border justify-between",children:[x.jsxs("div",{className:"flex flex-col h-fit justify-between items-center",children:[x.jsx("h1",{className:"text-fluidTitle font-shadowsLight md:mt-2 lg:mt-4",children:e}),x.jsx("hr",{className:"w-1/2 border-gray-200 md:mb-2 lg:mb-4"}),x.jsx("h2",{className:"text-fluidSubtitle mb-2",children:"Ingredients:"})]}),x.jsx("div",{className:"grid grid-rows-3 h-2/5",children:x.jsx(zF,{})}),x.jsx("div",{className:"h-fit justify-between items-center",children:x.jsx("h2",{className:"text-fluidSubtitle md:mt-2 lg:mt-8",children:"Steps:"})}),x.jsx("div",{className:"flex flex-col items-center justify-start h-3/5 md:mt-1 lg:mt-2",children:x.jsx(UF,{})}),x.jsx("div",{className:"flex flex-col bg-yellow-200 h-fit justify-between items-center pb-2",children:x.jsx("h2",{className:"text-fluidSubtitle",children:"Enjoy !"})})]})}),x.jsx("div",{className:"fixed bottom-0 right-0 go-to-button-arrow mb-0",children:x.jsx(G_,{})})]})}function Vx({identifier:e,units:t}){var c;const n=He(f=>f.groups.ingredientsGroups),r=wn(),o=e.split("_")[0],l=e.split("_")[1],s=(c=n.find(f=>f.groupName===l))==null?void 0:c.items.filter(f=>f.itemName===o)[0];return s&&x.jsx("div",{className:"text-fluidCard",children:t.map(f=>x.jsx("button",{className:`unit-card my-1 md: text-xs lg:text-xl ${s.unit===f?"unit-card-chosen":null}`,type:"button",onClick:()=>r(Q_({groupName:l,itemName:o,unit:f})),children:f},`${e}_${f}`))})}function BF({item:e,groupName:t}){const n=wn(),[r,o]=O.useState(e.amount),l=p=>{p>=0&&o(p)},s=()=>{r>0&&(n(is({groupName:t,itemName:e.itemName,amount:r-1})),o(p=>p-1))},c=()=>{n(is({groupName:t,itemName:e.itemName,amount:r+1})),o(p=>p+1)},f=p=>{Number.isNaN(p)?o(0):p>=0&&o(p),n(is({groupName:t,itemName:e.itemName,amount:p}))},h=p=>{p.key==="Enter"?(f(r),n(is({groupName:t,itemName:e.itemName,amount:r}))):p.key==="Backspace"&&p.target.value.length===1&&(o(0),n(is({groupName:t,itemName:e.itemName,amount:0})))};return x.jsxs("div",{className:"flex flex-row rounded-md sm:mx-2 md:mx-4 lg:mx-6",children:[x.jsx("button",{type:"button",className:"lg:mx-2",onClick:s,children:x.jsx(Ln,{icon:e2,className:"num-input-icons"})}),x.jsx("input",{className:`sm:w-10 md:w-12 lg:w-16 p-0 py-1 focus:outline-none text-center font-roboto rounded-xl ${r===0&&"required-element-fill"}`,type:"number",id:"units-number-input",value:r,required:!0,onChange:p=>l(Number.parseFloat(p.target.value)),onFocus:Qc,onBlur:p=>f(Number.parseFloat(p.target.value)),onKeyDown:h,onWheel:p=>p.target.blur()}),x.jsx("button",{type:"button",className:"lg:mx-2",onClick:c,children:x.jsx(Ln,{icon:t2,className:"num-input-icons"})})]})}function WF({groupName:e,item:t}){const{itemName:n,unit:r}=t;return x.jsx("div",{"data-testid":"ingredientFullItem",className:"flex center",children:x.jsxs("div",{className:"aspect-videoWide flex flex-row h-clampSmall rounded-2xl card-shadow",children:[x.jsx("img",{src:`/assets/ingredients/${n.toLowerCase()}.webp`,alt:n,className:"rounded-l-2xl"}),x.jsxs("div",{className:"flex flex-col center w-1/2 p-2 m-auto lg:gap-1",children:[x.jsx("p",{className:"text-fluidSubtitle",children:n}),x.jsx("hr",{className:"w-full border-gray-400 lg:my-2"}),x.jsx(BF,{item:t,groupName:e}),x.jsx("p",{className:`text-fluidSubtitle rounded-xl px-3 ${r===ml&&"required-element-fill"}`,children:r})]})]},`${e}_${n}`)})}function HF({groupName:e,items:t}){const n=wn(),r=(o,l)=>{n(Q_({groupName:e,itemName:o.itemName,unit:l}))};return x.jsxs("div",{className:"flex flex-col items-start mx-8",children:[x.jsx("p",{className:"group-chip-dead",children:e}),t.map(o=>x.jsxs("div",{className:"flex flex-row center mb-8",children:[x.jsx(WF,{groupName:e,item:o},`${e}_${o.itemName}_${o.amount}_${o.unit}}`),x.jsxs("div",{"data-testid":"unitsButtonsArray",className:"flex flex-col justify-start md:gap-y-2 sm:mx-6 md:mx-12 lg:mx-8",children:[x.jsx(Vx,{identifier:`${o.itemName}_${e}_common1`,units:kc.slice(0,kc.length/2)}),x.jsx(Vx,{identifier:`${o.itemName}_${e}_common2`,units:kc.slice(kc.length/2)})]}),x.jsx("form",{children:x.jsx("select",{className:`text-base md:w-20 lg:w-28 input-border rounded-md px-2 py-1 ${Zw.includes(o.unit)?"border-blue-500 border-1 bg-blue-300":null}`,value:o.unit,onChange:l=>r(o,l.target.value),children:Zw.map(l=>x.jsx("option",{value:l,children:l},l))})})]},`${e}_${o.itemName}}`))]})}function GF(){const e=He(t=>t.groups.ingredientsGroups);return x.jsx("div",{className:"flex flex-col justify-center",children:x.jsxs("div",{className:"flex flex-col h-5/6 w-fit input-gallery-border overflow-auto p-4 items-center",children:[x.jsx("h2",{className:"text-fluidSubtitle mb-4",children:"Select the Units and Quantities for each ingredient"}),e.map(t=>x.jsx("div",{className:"sm:mb-2 md:mb-4",children:x.jsx(HF,{groupName:t.groupName,items:t.items},t.groupName)},t.groupName))]})})}function KF(){const e=He(t=>t.warning.warning);return x.jsxs("div",{"data-testid":"quantities",className:"max-h-screen flex flex-col",children:[x.jsx(sa,{page:"/instructions",isNext:!0}),x.jsx(sa,{page:"/",isNext:!1}),x.jsx("div",{className:"flex h-screen justify-center text-center mt-8",children:x.jsx(GF,{})}),e&&x.jsx(hg,{})]})}const YF=[{path:"/a4recipe/",element:x.jsx(kF,{}),errorElement:x.jsx(Z4,{})},{path:"/quantities",element:x.jsx(KF,{})},{path:"/instructions",element:x.jsx(FF,{})},{path:"/print",element:x.jsx($F,{})},{path:"/doublePrint",element:x.jsx(SL,{})}],VF=LD({reducer:{recipe:gL,groups:wL,actions:fL,warning:tL}}),qF=j4(YF);Th.createRoot(document.getElementById("root")).render(x.jsx(Qe.StrictMode,{children:x.jsx(dI,{store:VF,children:x.jsx(K4,{router:qF})})}));export{Ln as F,wn as a,Dm as b,ZF as f,Oi as h,x as j,Dr as s,He as u}; diff --git a/index.html b/index.html index 73ce0aa..bf6a89a 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ a4recipe - +