mobileboost-cli 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useRef as W,useEffect as Ne,useContext as $o,useLayoutEffect as fa,useState as pe,useMemo as sr,useCallback as yn}from"react";import _ from"@emotion/styled";import{useMutation as G,mutationOptions as he,useQueryClient as Nn,useQuery as Ke,queryOptions as Rt}from"@tanstack/react-query";import{useStore as ve,Store as ma}from"@tanstack/react-store";import{CircularProgress as To,Typography as H,Box as re,IconButton as O,Divider as tn,Dialog as lr,DialogTitle as Bo,DialogContent as cr,TextField as fe,DialogActions as ko,Button as ke,Tooltip as ft,FormControl as $t,InputLabel as nn,Select as rn,MenuItem as gt,ToggleButtonGroup as ha,ToggleButton as Kr,Snackbar as ga,Alert as ba,List as _o,FormHelperText as Sn,FormControlLabel as On,Checkbox as dr,RadioGroup as ya,Radio as va,ListItem as Ln,InputAdornment as xa,ListItemIcon as Yr,ListItemText as Jr,Collapse as Da,styled as wt,Chip as V,Paper as Fo}from"@mui/material";import{Stop as Lo,CameraAlt as Ea,PlayArrow as wa,FiberManualRecord as Ia,Layers as Ca,Animation as Na}from"@mui/icons-material";import Sa,{flushSync as Vo}from"react-dom";import{bindActionCreators as Xr,createStore as Oa,compose as Pa,applyMiddleware as Aa}from"redux";import{connect as Mo,Provider as Ra}from"react-redux";import Zr from"tiny-invariant";import Go from"@babel/runtime/helpers/esm/extends";import{L as I,w as Vn,D as Wo,h as $a,u as Ta,d as Ba,S as ka,c as _a,l as Fa,i as La,r as Va,A as Qr,B as Ma}from"./stores-03HL60eP.mjs";import{styled as Tt}from"@mui/material/styles";import Ga from"@mui/icons-material/Keyboard";import zo from"@mui/icons-material/SwipeVertical";import Wa from"@mui/icons-material/ZoomInMap";import za from"@mui/icons-material/Search";import Ha from"@mui/icons-material/Link";import Ua from"@mui/icons-material/SmartToy";import Ye from"@mui/icons-material/PlayArrow";import Je from"@mui/icons-material/FastForward";import Xe from"@mui/icons-material/Edit";import je from"@mui/icons-material/Delete";import{a as ae,g as ja,T as qa}from"./server.mjs";import{S as Ka,d as Ya,r as Ja,u as Xa,x as Za,b as Qa,l as es,a as ur}from"./device-CWFVkH1s.mjs";import{performTap as ts,performType as ns,performScroll as Ho,getPageSource as Pn,performDeepLink as rs,performZoom as os,performSwipe as is,ensureAppiumSession as as,getPlatform as ss,getDeviceSize as ls}from"./appium-client-Dxm_q6FS.mjs";import{V as pr,N as Uo,X as cs,H as ds,K as us,j as ps,Y as fs,_ as ms,z as hs,L as gs,q as bs}from"./hierarchy-helpers-BaGN7WBn.mjs";import{f as ys,u as vs,b as xs}from"./adb-client-DwefjXbe.mjs";import{m as Ds,u as Es}from"./ios-client-1xTZzFD8.mjs";import{s as ws,n as Is}from"./step-D2WQqd4J.mjs";import eo from"node:fs";import Ae from"node:path";import Cs from"node:crypto";import zt from"sharp";import{a as Ns,i as Ss,o as Os}from"./cache-CtBF0d8x.mjs";import{R as pt}from"./constants-Dh9o88yr.mjs";import{F as Ps,W as As,P as Rs,K as $s}from"./ai-client-waGeh-P8.mjs";import{readFile as Ts}from"node:fs/promises";import Re from"fs-extra";import{z as L}from"zod";import Bs from"dotenv";import{useForm as ks}from"@tanstack/react-form";import _s from"@mui/icons-material/Save";import Fs from"@mui/icons-material/Close";import Ls from"@mui/icons-material/KeyboardArrowUp";import Vs from"@mui/icons-material/KeyboardArrowDown";import Ms from"@mui/icons-material/CheckCircle";import Gs from"@mui/icons-material/Info";import jo from"@react-hook/mouse-position";import qo from"@mui/icons-material/Add";import Ws from"@mui/icons-material/Refresh";import zs from"@mui/icons-material/CreateNewFolder";import Hs from"@mui/icons-material/Folder";import Us from"@mui/icons-material/InsertDriveFile";import js from"@mui/icons-material/ExpandLess";import qs from"@mui/icons-material/ExpandMore";import Ks from"@mui/icons-material/Check";import Ys from"@mui/material/AlertTitle";import"@tanstack/history";import"@tanstack/router-core/ssr/client";import"@tanstack/router-core";import"node:async_hooks";import"@tanstack/router-core/ssr/server";import"../../index.mjs";import"node:http";import"node:stream";import"node:https";import"node:http2";import"node:url";import"seroval";import"@tanstack/react-router/ssr/server";import"@tanstack/react-router";import"webdriverio";import"xml2js";import"linkedom";import"node:child_process";import"node:util";var He=function(t){var n=t.top,r=t.right,o=t.bottom,i=t.left,a=r-i,l=o-n,u={top:n,right:r,bottom:o,left:i,width:a,height:l,x:i,y:n,center:{x:(r+i)/2,y:(o+n)/2}};return u},fr=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},to=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},Js=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},Mn={top:0,right:0,bottom:0,left:0},mr=function(t){var n=t.borderBox,r=t.margin,o=r===void 0?Mn:r,i=t.border,a=i===void 0?Mn:i,l=t.padding,u=l===void 0?Mn:l,c=He(fr(n,o)),f=He(to(n,a)),p=He(to(f,u));return{marginBox:c,borderBox:He(n),paddingBox:f,contentBox:p,margin:o,border:a,padding:u}},Ve=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var o=Number(n);return isNaN(o)&&(process.env.NODE_ENV!=="production"?Zr(!1,"Could not parse value [raw: "+t+", without suffix: "+n+"]"):Zr(!1)),o},Xs=function(){return{x:window.pageXOffset,y:window.pageYOffset}},vn=function(t,n){var r=t.borderBox,o=t.border,i=t.margin,a=t.padding,l=Js(r,n);return mr({borderBox:l,border:o,margin:i,padding:a})},xn=function(t,n){return n===void 0&&(n=Xs()),vn(t,n)},Ko=function(t,n){var r={top:Ve(n.marginTop),right:Ve(n.marginRight),bottom:Ve(n.marginBottom),left:Ve(n.marginLeft)},o={top:Ve(n.paddingTop),right:Ve(n.paddingRight),bottom:Ve(n.paddingBottom),left:Ve(n.paddingLeft)},i={top:Ve(n.borderTopWidth),right:Ve(n.borderRightWidth),bottom:Ve(n.borderBottomWidth),left:Ve(n.borderLeftWidth)};return mr({borderBox:t,margin:r,padding:o,border:i})},Yo=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Ko(n,r)},jt=function(t){var n=[],r=null,o=function(){for(var a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];n=l,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return o.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},o};const Zs=process.env.NODE_ENV==="production",Qs=/[ \t]{2,}/g,el=/^[ \t]*/gm,no=e=>e.replace(Qs," ").replace(el,"").trim(),tl=e=>no(`
1
+ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useRef as W,useEffect as Ne,useContext as Ro,useLayoutEffect as fa,useState as pe,useMemo as sr,useCallback as yn}from"react";import _ from"@emotion/styled";import{useMutation as G,mutationOptions as he,useQueryClient as Nn,useQuery as Ke,queryOptions as $t}from"@tanstack/react-query";import{useStore as ve,Store as ma}from"@tanstack/react-store";import{CircularProgress as To,Typography as H,Box as re,IconButton as O,Divider as tn,Dialog as lr,DialogTitle as Bo,DialogContent as cr,TextField as fe,DialogActions as ko,Button as ke,Tooltip as ft,FormControl as Rt,InputLabel as nn,Select as rn,MenuItem as gt,ToggleButtonGroup as ha,ToggleButton as Kr,Snackbar as ga,Alert as ba,List as _o,FormHelperText as Sn,FormControlLabel as On,Checkbox as dr,RadioGroup as ya,Radio as va,ListItem as Ln,InputAdornment as xa,ListItemIcon as Yr,ListItemText as Jr,Collapse as Da,styled as wt,Chip as V,Paper as Fo}from"@mui/material";import{Stop as Lo,CameraAlt as Ea,PlayArrow as wa,FiberManualRecord as Ia,Layers as Ca,Animation as Na}from"@mui/icons-material";import Sa,{flushSync as Vo}from"react-dom";import{bindActionCreators as Xr,createStore as Oa,compose as Pa,applyMiddleware as Aa}from"redux";import{connect as Mo,Provider as $a}from"react-redux";import Zr from"tiny-invariant";import Go from"@babel/runtime/helpers/esm/extends";import{L as I,w as Vn,D as Wo,h as Ra,u as Ta,d as Ba,S as ka,c as _a,l as Fa,i as La,r as Va,A as Qr,B as Ma}from"./stores-03HL60eP.mjs";import{styled as Tt}from"@mui/material/styles";import Ga from"@mui/icons-material/Keyboard";import zo from"@mui/icons-material/SwipeVertical";import Wa from"@mui/icons-material/ZoomInMap";import za from"@mui/icons-material/Search";import Ha from"@mui/icons-material/Link";import Ua from"@mui/icons-material/SmartToy";import Ye from"@mui/icons-material/PlayArrow";import Je from"@mui/icons-material/FastForward";import Xe from"@mui/icons-material/Edit";import je from"@mui/icons-material/Delete";import{a as ae,g as ja,T as qa}from"./server.mjs";import{S as Ka,d as Ya,r as Ja,u as Xa,x as Za,b as Qa,l as es,a as ur}from"./device-CWFVkH1s.mjs";import{performTap as ts,performType as ns,performScroll as Ho,getPageSource as Pn,performDeepLink as rs,performZoom as os,performSwipe as is,ensureAppiumSession as as,getPlatform as ss,getDeviceSize as ls}from"./appium-client-Dxm_q6FS.mjs";import{V as pr,N as Uo,X as cs,H as ds,K as us,j as ps,Y as fs,_ as ms,z as hs,L as gs,q as bs}from"./hierarchy-helpers-BaGN7WBn.mjs";import{f as ys,u as vs,b as xs}from"./adb-client-DwefjXbe.mjs";import{m as Ds,u as Es}from"./ios-client-1xTZzFD8.mjs";import{s as ws,n as Is}from"./step-D2WQqd4J.mjs";import eo from"node:fs";import Ae from"node:path";import Cs from"node:crypto";import zt from"sharp";import{a as Ns,i as Ss,o as Os}from"./cache-CtBF0d8x.mjs";import{R as pt}from"./constants-Dh9o88yr.mjs";import{F as Ps,W as As,P as $s,K as Rs}from"./ai-client-waGeh-P8.mjs";import{readFile as Ts}from"node:fs/promises";import $e from"fs-extra";import{z as L}from"zod";import Bs from"dotenv";import{useForm as ks}from"@tanstack/react-form";import _s from"@mui/icons-material/Save";import Fs from"@mui/icons-material/Close";import Ls from"@mui/icons-material/KeyboardArrowUp";import Vs from"@mui/icons-material/KeyboardArrowDown";import Ms from"@mui/icons-material/CheckCircle";import Gs from"@mui/icons-material/Info";import jo from"@react-hook/mouse-position";import qo from"@mui/icons-material/Add";import Ws from"@mui/icons-material/Refresh";import zs from"@mui/icons-material/CreateNewFolder";import Hs from"@mui/icons-material/Folder";import Us from"@mui/icons-material/InsertDriveFile";import js from"@mui/icons-material/ExpandLess";import qs from"@mui/icons-material/ExpandMore";import Ks from"@mui/icons-material/Check";import Ys from"@mui/material/AlertTitle";import"@tanstack/history";import"@tanstack/router-core/ssr/client";import"@tanstack/router-core";import"node:async_hooks";import"@tanstack/router-core/ssr/server";import"../../index.mjs";import"node:http";import"node:stream";import"node:https";import"node:http2";import"node:url";import"seroval";import"@tanstack/react-router/ssr/server";import"@tanstack/react-router";import"webdriverio";import"xml2js";import"linkedom";import"node:child_process";import"node:util";var He=function(t){var n=t.top,r=t.right,o=t.bottom,i=t.left,a=r-i,l=o-n,u={top:n,right:r,bottom:o,left:i,width:a,height:l,x:i,y:n,center:{x:(r+i)/2,y:(o+n)/2}};return u},fr=function(t,n){return{top:t.top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right}},to=function(t,n){return{top:t.top+n.top,left:t.left+n.left,bottom:t.bottom-n.bottom,right:t.right-n.right}},Js=function(t,n){return{top:t.top+n.y,left:t.left+n.x,bottom:t.bottom+n.y,right:t.right+n.x}},Mn={top:0,right:0,bottom:0,left:0},mr=function(t){var n=t.borderBox,r=t.margin,o=r===void 0?Mn:r,i=t.border,a=i===void 0?Mn:i,l=t.padding,u=l===void 0?Mn:l,c=He(fr(n,o)),f=He(to(n,a)),p=He(to(f,u));return{marginBox:c,borderBox:He(n),paddingBox:f,contentBox:p,margin:o,border:a,padding:u}},Ve=function(t){var n=t.slice(0,-2),r=t.slice(-2);if(r!=="px")return 0;var o=Number(n);return isNaN(o)&&(process.env.NODE_ENV!=="production"?Zr(!1,"Could not parse value [raw: "+t+", without suffix: "+n+"]"):Zr(!1)),o},Xs=function(){return{x:window.pageXOffset,y:window.pageYOffset}},vn=function(t,n){var r=t.borderBox,o=t.border,i=t.margin,a=t.padding,l=Js(r,n);return mr({borderBox:l,border:o,margin:i,padding:a})},xn=function(t,n){return n===void 0&&(n=Xs()),vn(t,n)},Ko=function(t,n){var r={top:Ve(n.marginTop),right:Ve(n.marginRight),bottom:Ve(n.marginBottom),left:Ve(n.marginLeft)},o={top:Ve(n.paddingTop),right:Ve(n.paddingRight),bottom:Ve(n.paddingBottom),left:Ve(n.paddingLeft)},i={top:Ve(n.borderTopWidth),right:Ve(n.borderRightWidth),bottom:Ve(n.borderBottomWidth),left:Ve(n.borderLeftWidth)};return mr({borderBox:t,margin:r,padding:o,border:i})},Yo=function(t){var n=t.getBoundingClientRect(),r=window.getComputedStyle(t);return Ko(n,r)},jt=function(t){var n=[],r=null,o=function(){for(var a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];n=l,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return o.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},o};const Zs=process.env.NODE_ENV==="production",Qs=/[ \t]{2,}/g,el=/^[ \t]*/gm,no=e=>e.replace(Qs," ").replace(el,"").trim(),tl=e=>no(`
2
2
  %c@hello-pangea/dnd
3
3
 
4
4
  %c${no(e)}
@@ -43,18 +43,18 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
43
43
  `:`
44
44
  The item has been dropped while not over a drop area.
45
45
  ${oo(e.source)}
46
- `},bn={dragHandleUsageInstructions:sl,onDragStart:ll,onDragUpdate:cl,onDragEnd:dl};function ul(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Qo(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ul(e[n],t[n]))return!1;return!0}function z(e,t){const n=pe(()=>({inputs:t,result:e()}))[0],r=W(!0),o=W(n),a=r.current||!!(t&&o.current.inputs&&Qo(t,o.current.inputs))?o.current:{inputs:t,result:e()};return Ne(()=>{r.current=!1,o.current=a},[a]),a.result}function S(e,t){return z(()=>e,t)}const De={x:0,y:0},we=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),_e=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),ht=(e,t)=>e.x===t.x&&e.y===t.y,Bt=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Dt=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},Kt=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),io=(e,t)=>Math.min(...t.map(n=>Kt(e,n))),ei=e=>t=>({x:e(t.x),y:e(t.y)});var pl=(e,t)=>{const n=He({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const on=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),ao=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],fl={top:0,right:0,bottom:0,left:0},ml=(e,t)=>t?on(e,t.scroll.diff.displacement):e,hl=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,gl=(e,t)=>t&&t.shouldClipSubject?pl(t.pageMarginBox,e):He(e);var Ot=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const o=ml(e.marginBox,r),i=hl(o,n,t),a=gl(i,r);return{page:e,withPlaceholder:t,active:a}},hr=(e,t)=>{e.frame||(process.env.NODE_ENV,h());const n=e.frame,r=_e(t,n.scroll.initial),o=Bt(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}},a=Ot({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}};function xe(e,t=Qo){let n=null;function r(...o){if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;const i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}const ti=xe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),ni=xe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),An=xe(e=>Object.values(e)),bl=xe(e=>Object.values(e));var It=xe((e,t)=>bl(t).filter(r=>e===r.descriptor.droppableId).sort((r,o)=>r.descriptor.index-o.descriptor.index));function gr(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function Rn(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var $n=xe((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),yl=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:o})=>{if(!n.isCombineEnabled||!gr(o))return null;function a(m){const g={type:"COMBINE",combine:{draggableId:m,droppableId:n.descriptor.id}};return{...o,at:g}}const l=o.displaced.all,u=l.length?l[0]:null;if(e)return u?a(u):null;const c=$n(t,r);if(!u){if(!c.length)return null;const m=c[c.length-1];return a(m.descriptor.id)}const f=c.findIndex(m=>m.descriptor.id===u);f===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find displaced item in set"):h());const p=f-1;if(p<0)return null;const d=c[p];return a(d.descriptor.id)},kt=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const ri={point:De,value:0},Yt={invisible:{},visible:{},all:[]},vl={displaced:Yt,displacedBy:ri,at:null};var Ge=(e,t)=>n=>e<=n&&n<=t,oi=e=>{const t=Ge(e.top,e.bottom),n=Ge(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const i=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(i&&a)return!0;const u=r.top<e.top&&r.bottom>e.bottom,c=r.left<e.left&&r.right>e.right;return u&&c?!0:u&&a||c&&i}},xl=e=>{const t=Ge(e.top,e.bottom),n=Ge(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const br={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},ii={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var Dl=e=>t=>{const n=Ge(t.top,t.bottom),r=Ge(t.left,t.right);return o=>e===br?n(o.top)&&n(o.bottom):r(o.left)&&r(o.right)};const El=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:De;return on(e,n)},wl=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,Il=(e,t,n)=>n(t)(e),yr=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:o})=>{const i=r?El(e,t):e;return wl(i,t,o)&&Il(i,n,o)},Cl=e=>yr({...e,isVisibleThroughFrameFn:oi}),ai=e=>yr({...e,isVisibleThroughFrameFn:xl}),Nl=e=>yr({...e,isVisibleThroughFrameFn:Dl(e.destination.axis)}),Sl=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:o}=t;if(r[e])return!1;const i=o[e];return i?i.shouldAnimate:!0};function Ol(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return He(fr(n,r))}function Jt({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:o,last:i}){return e.reduce(function(l,u){const c=Ol(u,n),f=u.descriptor.id;if(l.all.push(f),!Cl({target:c,destination:t,viewport:r,withDroppableDisplacement:!0}))return l.invisible[u.descriptor.id]=!0,l;const d=Sl(f,i,o),m={draggableId:f,shouldAnimate:d};return l.visible[f]=m,l},{all:[],visible:{},invisible:{}})}function Pl(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function so({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const o=Pl(e,{inHomeList:t});return{displaced:Yt,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function En({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:o,last:i,index:a,forceShouldAnimate:l}){const u=kt(e,n);if(a==null)return so({insideDestination:t,inHomeList:u,displacedBy:o,destination:n});const c=t.find(g=>g.descriptor.index===a);if(!c)return so({insideDestination:t,inHomeList:u,displacedBy:o,destination:n});const f=$n(e,t),p=t.indexOf(c),d=f.slice(p);return{displaced:Jt({afterDragging:d,destination:n,displacedBy:o,last:i,viewport:r.frame,forceShouldAnimate:l}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function bt(e,t){return!!t.effected[e]}var Al=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,l=n[i].descriptor.index;return bt(i,o)?e?l:l-1:e?l+1:l},Rl=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const o=r.index,i=e?o+1:o-1,a=n[0].descriptor.index,l=n[n.length-1].descriptor.index,u=t?l:l+1;return i<a||i>u?null:i},$l=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:o,insideDestination:i,previousImpact:a,viewport:l,afterCritical:u})=>{const c=a.at;if(c||(process.env.NODE_ENV!=="production"?h(!1,"Cannot move in direction without previous impact location"):h()),c.type==="REORDER"){const p=Rl({isMovingForward:e,isInHomeList:t,location:c.destination,insideDestination:i});return p==null?null:En({draggable:n,insideDestination:i,destination:o,viewport:l,last:a.displaced,displacedBy:a.displacedBy,index:p})}const f=Al({isMovingForward:e,destination:o,displaced:a.displaced,draggables:r,combine:c.combine,afterCritical:u});return f==null?null:En({draggable:n,insideDestination:i,destination:o,viewport:l,last:a.displaced,displacedBy:a.displacedBy,index:f})},Tl=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const o=!!(e.visible[n]||e.invisible[n]);return bt(n,t)?o?De:Bt(r.point):o?r.point:De},Bl=({afterCritical:e,impact:t,draggables:n})=>{const r=Rn(t);r||(process.env.NODE_ENV,h());const o=r.draggableId,i=n[o].page.borderBox.center,a=Tl({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return we(i,a)};const si=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,kl=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,vr=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,lo=({axis:e,moveRelativeTo:t,isMoving:n})=>Dt(e.line,t.marginBox[e.end]+si(e,n),vr(e,t.marginBox,n)),co=({axis:e,moveRelativeTo:t,isMoving:n})=>Dt(e.line,t.marginBox[e.start]-kl(e,n),vr(e,t.marginBox,n)),_l=({axis:e,moveInto:t,isMoving:n})=>Dt(e.line,t.contentBox[e.start]+si(e,n),vr(e,t.contentBox,n));var Fl=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o})=>{const i=It(r.descriptor.id,n),a=t.page,l=r.axis;if(!i.length)return _l({axis:l,moveInto:r.page,isMoving:a});const{displaced:u,displacedBy:c}=e,f=u.all[0];if(f){const d=n[f];if(bt(f,o))return co({axis:l,moveRelativeTo:d.page,isMoving:a});const m=vn(d.page,c.point);return co({axis:l,moveRelativeTo:m,isMoving:a})}const p=i[i.length-1];if(p.descriptor.id===t.descriptor.id)return a.borderBox.center;if(bt(p.descriptor.id,o)){const d=vn(p.page,Bt(o.displacedBy.point));return lo({axis:l,moveRelativeTo:d,isMoving:a})}return lo({axis:l,moveRelativeTo:p.page,isMoving:a})},er=(e,t)=>{const n=e.frame;return n?we(t,n.scroll.diff.displacement):t};const Ll=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:o})=>{const i=t.page.borderBox.center,a=e.at;return!n||!a?i:a.type==="REORDER"?Fl({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o}):Bl({impact:e,draggables:r,afterCritical:o})};var Tn=e=>{const t=Ll(e),n=e.droppable;return n?er(n,t):t},li=(e,t)=>{const n=_e(t,e.scroll.initial),r=Bt(n);return{frame:He({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function uo(e,t){return e.map(n=>t[n])}function Vl(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var Ml=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:o})=>{const i=li(t,we(t.scroll.current,o)),a=n.frame?hr(n,we(n.frame.scroll.current,o)):n,l=e.displaced,u=Jt({afterDragging:uo(l.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:l,forceShouldAnimate:!1}),c=Jt({afterDragging:uo(l.all,r),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:l,forceShouldAnimate:!1}),f={},p={},d=[l,u,c];return l.all.forEach(g=>{const y=Vl(g,d);if(y){p[g]=y;return}f[g]=!0}),{...e,displaced:{all:l.all,invisible:f,visible:p}}},Gl=(e,t)=>we(e.scroll.diff.displacement,t),xr=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=Gl(n,e),o=_e(r,t.page.borderBox.center);return we(t.client.borderBox.center,o)},ci=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=_e(n,e.page.borderBox.center),u={target:on(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:r};return i?Nl(u):ai(u)},Wl=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:l,afterCritical:u})=>{if(!n.isEnabled)return null;const c=It(n.descriptor.id,r),f=kt(t,n),p=yl({isMovingForward:e,draggable:t,destination:n,insideDestination:c,previousImpact:o})||$l({isMovingForward:e,isInHomeList:f,draggable:t,draggables:r,destination:n,insideDestination:c,previousImpact:o,viewport:i,afterCritical:u});if(!p)return null;const d=Tn({impact:p,draggable:t,droppable:n,draggables:r,afterCritical:u});if(ci({draggable:t,destination:n,newPageBorderBoxCenter:d,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:xr({pageBorderBoxCenter:d,draggable:t,viewport:i}),impact:p,scrollJumpRequest:null};const g=_e(d,a),y=Ml({impact:p,viewport:i,destination:n,draggables:r,maxScrollChange:g});return{clientSelection:l,impact:y,scrollJumpRequest:g}};const Pe=e=>{const t=e.subject.active;return t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get clipped area from droppable"):h()),t};var zl=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:o})=>{const i=n.subject.active;if(!i)return null;const a=n.axis,l=Ge(i[a.start],i[a.end]),u=An(r).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>oi(o.frame)(Pe(f))).filter(f=>{const p=Pe(f);return e?i[a.crossAxisEnd]<p[a.crossAxisEnd]:p[a.crossAxisStart]<i[a.crossAxisStart]}).filter(f=>{const p=Pe(f),d=Ge(p[a.start],p[a.end]);return l(p[a.start])||l(p[a.end])||d(i[a.start])||d(i[a.end])}).sort((f,p)=>{const d=Pe(f)[a.crossAxisStart],m=Pe(p)[a.crossAxisStart];return e?d-m:m-d}).filter((f,p,d)=>Pe(f)[a.crossAxisStart]===Pe(d[0])[a.crossAxisStart]);if(!u.length)return null;if(u.length===1)return u[0];const c=u.filter(f=>Ge(Pe(f)[a.start],Pe(f)[a.end])(t[a.line]));return c.length===1?c[0]:c.length>1?c.sort((f,p)=>Pe(f)[a.start]-Pe(p)[a.start])[0]:u.sort((f,p)=>{const d=io(t,ao(Pe(f))),m=io(t,ao(Pe(p)));return d!==m?d-m:Pe(f)[a.start]-Pe(p)[a.start]})[0]};const po=(e,t)=>{const n=e.page.borderBox.center;return bt(e.descriptor.id,t)?_e(n,t.displacedBy.point):n},Hl=(e,t)=>{const n=e.page.borderBox;return bt(e.descriptor.id,t)?on(n,Bt(t.displacedBy.point)):n};var Ul=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:o})=>r.filter(a=>ai({target:Hl(a,o),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((a,l)=>{const u=Kt(e,er(n,po(a,o))),c=Kt(e,er(n,po(l,o)));return u<c?-1:c<u?1:a.descriptor.index-l.descriptor.index})[0]||null,an=xe(function(t,n){const r=n[t.line];return{value:r,point:Dt(t.line,r)}});const jl=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return Dt(r.line,t[r.line]);const o=e.subject.page.contentBox[r.size],u=It(e.descriptor.id,n).reduce((c,f)=>c+f.client.marginBox[r.size],0)+t[r.line]-o;return u<=0?null:Dt(r.line,u)},di=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),ui=(e,t,n)=>{const r=e.frame;kt(t,e)&&(process.env.NODE_ENV!=="production"?h(!1,"Should not add placeholder space to home list"):h()),e.subject.withPlaceholder&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot add placeholder size to a subject when it already has one"):h());const o=an(e.axis,t.displaceBy).point,i=jl(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const f=Ot({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:f}}const l=i?we(r.scroll.max,i):r.scroll.max,u=di(r,l),c=Ot({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:u});return{...e,subject:c,frame:u}},ql=e=>{const t=e.subject.withPlaceholder;t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot remove placeholder form subject when there was none"):h());const n=e.frame;if(!n){const a=Ot({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:a}}const r=t.oldFrameMaxScroll;r||(process.env.NODE_ENV!=="production"?h(!1,"Expected droppable with frame to have old max frame scroll when removing placeholder"):h());const o=di(n,r),i=Ot({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}};var Kl=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:o,destination:i,viewport:a,afterCritical:l})=>{if(!t){if(n.length)return null;const p={displaced:Yt,displacedBy:ri,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},d=Tn({impact:p,draggable:r,droppable:i,draggables:o,afterCritical:l}),m=kt(r,i)?i:ui(i,r,o);return ci({draggable:r,destination:m,newPageBorderBoxCenter:d,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?p:null}const u=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],c=(()=>{const p=t.descriptor.index;return t.descriptor.id===r.descriptor.id||u?p:p+1})(),f=an(i.axis,r.displaceBy);return En({draggable:r,insideDestination:n,destination:i,viewport:a,displacedBy:f,last:Yt,index:c})},Yl=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:o,droppables:i,viewport:a,afterCritical:l})=>{const u=zl({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:a});if(!u)return null;const c=It(u.descriptor.id,o),f=Ul({pageBorderBoxCenter:t,viewport:a,destination:u,insideDestination:c,afterCritical:l}),p=Kl({previousPageBorderBoxCenter:t,destination:u,draggable:n,draggables:o,moveRelativeTo:f,insideDestination:c,viewport:a,afterCritical:l});if(!p)return null;const d=Tn({impact:p,draggable:n,droppable:u,draggables:o,afterCritical:l});return{clientSelection:xr({pageBorderBoxCenter:d,draggable:n,viewport:a}),impact:p,scrollJumpRequest:null}},Fe=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const Jl=(e,t)=>{const n=Fe(e);return n?t[n]:null};var Xl=({state:e,type:t})=>{const n=Jl(e.impact,e.dimensions.droppables),r=!!n,o=e.dimensions.droppables[e.critical.droppable.id],i=n||o,a=i.axis.direction,l=a==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||a==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(l&&!r)return null;const u=t==="MOVE_DOWN"||t==="MOVE_RIGHT",c=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:p,droppables:d}=e.dimensions;return l?Wl({isMovingForward:u,previousPageBorderBoxCenter:f,draggable:c,destination:i,draggables:p,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):Yl({isMovingForward:u,previousPageBorderBoxCenter:f,draggable:c,isOver:i,draggables:p,droppables:d,viewport:e.viewport,afterCritical:e.afterCritical})};function xt(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function pi(e){const t=Ge(e.top,e.bottom),n=Ge(e.left,e.right);return function(o){return t(o.y)&&n(o.x)}}function Zl(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Ql({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,o=n.map(i=>{const a=i.axis,l=Dt(i.axis.line,e.center[a.line],i.page.borderBox.center[a.crossAxisLine]);return{id:i.descriptor.id,distance:Kt(r,l)}}).sort((i,a)=>a.distance-i.distance);return o[0]?o[0].id:null}function ec({pageBorderBox:e,draggable:t,droppables:n}){const r=An(n).filter(o=>{if(!o.isEnabled)return!1;const i=o.subject.active;if(!i||!Zl(e,i))return!1;if(pi(i)(e.center))return!0;const a=o.axis,l=i.center[a.crossAxisLine],u=e[a.crossAxisStart],c=e[a.crossAxisEnd],f=Ge(i[a.crossAxisStart],i[a.crossAxisEnd]),p=f(u),d=f(c);return!p&&!d?!0:p?u<l:c>l});return r.length?r.length===1?r[0].descriptor.id:Ql({pageBorderBox:e,draggable:t,candidates:r}):null}const fi=(e,t)=>He(on(e,t));var tc=(e,t)=>{const n=e.frame;return n?fi(t,n.scroll.diff.value):t};function mi({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function nc({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var rc=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:o,viewport:i,afterCritical:a})=>{const l=n.axis,u=an(n.axis,t.displaceBy),c=u.value,f=e[l.start],p=e[l.end],m=$n(t,r).find(y=>{const x=y.descriptor.id,D=y.page.borderBox.center[l.line],E=bt(x,a),P=mi({displaced:o,id:x});return E?P?p<=D:f<D-c:P?p<=D+c:f<D})||null,g=nc({draggable:t,closest:m,inHomeList:kt(t,n)});return En({draggable:t,insideDestination:r,destination:n,viewport:i,last:o,displacedBy:u,index:g})};const oc=4;var ic=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:o,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const a=r.axis,l=an(r.axis,e.displaceBy),u=l.value,c=t[a.start],f=t[a.end],d=$n(e,o).find(g=>{const y=g.descriptor.id,x=g.page.borderBox,E=x[a.size]/oc,P=bt(y,i),N=mi({displaced:n.displaced,id:y});return P?N?f>x[a.start]+E&&f<x[a.end]-E:c>x[a.start]-u+E&&c<x[a.end]-u-E:N?f>x[a.start]+u+E&&f<x[a.end]+u-E:c>x[a.start]+E&&c<x[a.end]-E});return d?{displacedBy:l,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:d.descriptor.id,droppableId:r.descriptor.id}}}:null},hi=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:o,viewport:i,afterCritical:a})=>{const l=fi(t.page.borderBox,e),u=ec({pageBorderBox:l,draggable:t,droppables:r});if(!u)return vl;const c=r[u],f=It(c.descriptor.id,n),p=tc(c,l);return ic({pageBorderBoxWithDroppableScroll:p,draggable:t,previousImpact:o,destination:c,insideDestination:f,afterCritical:a})||rc({pageBorderBoxWithDroppableScroll:p,draggable:t,destination:c,insideDestination:f,last:o.displaced,viewport:i,afterCritical:a})},Dr=(e,t)=>({...e,[t.descriptor.id]:t});const ac=({previousImpact:e,impact:t,droppables:n})=>{const r=Fe(e),o=Fe(t);if(!r||r===o)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const a=ql(i);return Dr(n,a)};var sc=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:o})=>{const i=ac({previousImpact:r,impact:o,droppables:n}),a=Fe(o);if(!a)return i;const l=n[a];if(kt(e,l)||l.subject.withPlaceholder)return i;const u=ui(l,e,t);return Dr(i,u)},Ht=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:o,scrollJumpRequest:i})=>{const a=r||e.viewport,l=n||e.dimensions,u=t||e.current.client.selection,c=_e(u,e.initial.client.selection),f={offset:c,selection:u,borderBoxCenter:we(e.initial.client.borderBoxCenter,c)},p={selection:we(f.selection,a.scroll.current),borderBoxCenter:we(f.borderBoxCenter,a.scroll.current),offset:we(f.offset,a.scroll.diff.value)},d={client:f,page:p};if(e.phase==="COLLECTING")return{...e,dimensions:l,viewport:a,current:d};const m=l.draggables[e.critical.draggable.id],g=o||hi({pageOffset:p.offset,draggable:m,draggables:l.draggables,droppables:l.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),y=sc({draggable:m,impact:g,previousImpact:e.impact,draggables:l.draggables,droppables:l.droppables});return{...e,current:d,dimensions:{draggables:l.draggables,droppables:y},impact:g,viewport:a,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function lc(e,t){return e.map(n=>t[n])}var gi=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:o})=>{const i=e.displaced,a=lc(i.all,n),l=Jt({afterDragging:a,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:l}},bi=({impact:e,draggable:t,droppable:n,draggables:r,viewport:o,afterCritical:i})=>{const a=Tn({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return xr({pageBorderBoxCenter:a,draggable:t,viewport:o})},yi=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&(process.env.NODE_ENV,h());const r=e.impact,o=n||e.viewport,i=t||e.dimensions,{draggables:a,droppables:l}=i,u=a[e.critical.draggable.id],c=Fe(r);c||(process.env.NODE_ENV!=="production"?h(!1,"Must be over a destination in SNAP movement mode"):h());const f=l[c],p=gi({impact:r,viewport:o,destination:f,draggables:a}),d=bi({impact:p,draggable:u,droppable:f,draggables:a,viewport:o,afterCritical:e.afterCritical});return Ht({impact:p,clientSelection:d,state:e,dimensions:i,viewport:o})},cc=e=>({index:e.index,droppableId:e.droppableId}),vi=({draggable:e,home:t,draggables:n,viewport:r})=>{const o=an(t.axis,e.displaceBy),i=It(t.descriptor.id,n),a=i.indexOf(e);a===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Expected draggable to be inside home list"):h());const l=i.slice(a+1),u=l.reduce((d,m)=>(d[m.descriptor.id]=!0,d),{}),c={inVirtualList:t.descriptor.mode==="virtual",displacedBy:o,effected:u};return{impact:{displaced:Jt({afterDragging:l,destination:t,displacedBy:o,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:cc(e.descriptor)}},afterCritical:c}},dc=(e,t)=>({draggables:e.draggables,droppables:Dr(e.droppables,t)});const sn=e=>{process.env.NODE_ENV},ln=e=>{process.env.NODE_ENV};var uc=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=vn(e.client,t),o=xn(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:o}},pc=e=>{const t=e.frame;return t||(process.env.NODE_ENV!=="production"?h(!1,"Expected Droppable to have a frame"):h()),t},fc=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(o=>{const i=o.descriptor.droppableId,a=t[i],u=pc(a).scroll.diff.value,c=we(r,u);return uc({draggable:o,offset:c,initialWindowScroll:n.scroll.initial})})},mc=({state:e,published:t})=>{sn();const n=t.modified.map(D=>{const E=e.dimensions.droppables[D.droppableId];return hr(E,D.scroll)}),r={...e.dimensions.droppables,...ti(n)},o=ni(fc({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),i={...e.dimensions.draggables,...o};t.removals.forEach(D=>{delete i[D]});const a={droppables:r,draggables:i},l=Fe(e.impact),u=l?a.droppables[l]:null,c=a.draggables[e.critical.draggable.id],f=a.droppables[e.critical.droppable.id],{impact:p,afterCritical:d}=vi({draggable:c,home:f,draggables:i,viewport:e.viewport}),m=u&&u.isCombineEnabled?e.impact:p,g=hi({pageOffset:e.current.page.offset,draggable:a.draggables[e.critical.draggable.id],draggables:a.draggables,droppables:a.droppables,previousImpact:m,viewport:e.viewport,afterCritical:d});ln();const y={...e,phase:"DRAGGING",impact:g,onLiftImpact:p,dimensions:a,afterCritical:d,forceShouldAnimate:!1};return e.phase==="COLLECTING"?y:{...y,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const tr=e=>e.movementMode==="SNAP",Gn=(e,t,n)=>{const r=dc(e.dimensions,t);return!tr(e)||n?Ht({state:e,dimensions:r}):yi({state:e,dimensions:r})};function Wn(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const fo={phase:"IDLE",completed:null,shouldFlush:!1};var hc=(e=fo,t)=>{if(t.type==="FLUSH")return{...fo,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"INITIAL_PUBLISH must come after a IDLE phase"):h());const{critical:n,clientSelection:r,viewport:o,dimensions:i,movementMode:a}=t.payload,l=i.draggables[n.draggable.id],u=i.droppables[n.droppable.id],c={selection:r,borderBoxCenter:l.client.borderBox.center,offset:De},f={client:c,page:{selection:we(c.selection,o.scroll.initial),borderBoxCenter:we(c.selection,o.scroll.initial),offset:we(c.selection,o.scroll.diff.value)}},p=An(i.droppables).every(y=>!y.isFixedOnPage),{impact:d,afterCritical:m}=vi({draggable:l,home:u,draggables:i.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:a,dimensions:i,initial:f,current:f,isWindowScrollAllowed:p,impact:d,afterCritical:m,onLiftImpact:d,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`Collection cannot start from phase ${e.phase}`):h()),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Unexpected ${t.type} received in phase ${e.phase}`):h()),mc({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{client:n}=t.payload;return ht(n,e.current.client.selection)?e:Ht({state:e,clientSelection:n,impact:tr(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Wn(e);xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{id:n,newScroll:r}=t.payload,o=e.dimensions.droppables[n];if(!o)return e;const i=hr(o,r);return Gn(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`Attempting to move in an unsupported phase ${e.phase}`):h());const{id:n,isEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find Droppable[id: ${n}] to toggle its enabled state`):h()),o.isEnabled===r&&(process.env.NODE_ENV!=="production"?h(!1,`Trying to set droppable isEnabled to ${String(r)}
46
+ `},bn={dragHandleUsageInstructions:sl,onDragStart:ll,onDragUpdate:cl,onDragEnd:dl};function ul(e,t){return!!(e===t||Number.isNaN(e)&&Number.isNaN(t))}function Qo(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ul(e[n],t[n]))return!1;return!0}function z(e,t){const n=pe(()=>({inputs:t,result:e()}))[0],r=W(!0),o=W(n),a=r.current||!!(t&&o.current.inputs&&Qo(t,o.current.inputs))?o.current:{inputs:t,result:e()};return Ne(()=>{r.current=!1,o.current=a},[a]),a.result}function S(e,t){return z(()=>e,t)}const De={x:0,y:0},we=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),_e=(e,t)=>({x:e.x-t.x,y:e.y-t.y}),ht=(e,t)=>e.x===t.x&&e.y===t.y,Bt=e=>({x:e.x!==0?-e.x:0,y:e.y!==0?-e.y:0}),Dt=(e,t,n=0)=>e==="x"?{x:t,y:n}:{x:n,y:t},Kt=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),io=(e,t)=>Math.min(...t.map(n=>Kt(e,n))),ei=e=>t=>({x:e(t.x),y:e(t.y)});var pl=(e,t)=>{const n=He({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n};const on=(e,t)=>({top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}),ao=e=>[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}],fl={top:0,right:0,bottom:0,left:0},ml=(e,t)=>t?on(e,t.scroll.diff.displacement):e,hl=(e,t,n)=>n&&n.increasedBy?{...e,[t.end]:e[t.end]+n.increasedBy[t.line]}:e,gl=(e,t)=>t&&t.shouldClipSubject?pl(t.pageMarginBox,e):He(e);var Ot=({page:e,withPlaceholder:t,axis:n,frame:r})=>{const o=ml(e.marginBox,r),i=hl(o,n,t),a=gl(i,r);return{page:e,withPlaceholder:t,active:a}},hr=(e,t)=>{e.frame||(process.env.NODE_ENV,h());const n=e.frame,r=_e(t,n.scroll.initial),o=Bt(r),i={...n,scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:o},max:n.scroll.max}},a=Ot({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:i});return{...e,frame:i,subject:a}};function xe(e,t=Qo){let n=null;function r(...o){if(n&&n.lastThis===this&&t(o,n.lastArgs))return n.lastResult;const i=e.apply(this,o);return n={lastResult:i,lastArgs:o,lastThis:this},i}return r.clear=function(){n=null},r}const ti=xe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),ni=xe(e=>e.reduce((t,n)=>(t[n.descriptor.id]=n,t),{})),An=xe(e=>Object.values(e)),bl=xe(e=>Object.values(e));var It=xe((e,t)=>bl(t).filter(r=>e===r.descriptor.droppableId).sort((r,o)=>r.descriptor.index-o.descriptor.index));function gr(e){return e.at&&e.at.type==="REORDER"?e.at.destination:null}function $n(e){return e.at&&e.at.type==="COMBINE"?e.at.combine:null}var Rn=xe((e,t)=>t.filter(n=>n.descriptor.id!==e.descriptor.id)),yl=({isMovingForward:e,draggable:t,destination:n,insideDestination:r,previousImpact:o})=>{if(!n.isCombineEnabled||!gr(o))return null;function a(m){const g={type:"COMBINE",combine:{draggableId:m,droppableId:n.descriptor.id}};return{...o,at:g}}const l=o.displaced.all,u=l.length?l[0]:null;if(e)return u?a(u):null;const c=Rn(t,r);if(!u){if(!c.length)return null;const m=c[c.length-1];return a(m.descriptor.id)}const f=c.findIndex(m=>m.descriptor.id===u);f===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find displaced item in set"):h());const p=f-1;if(p<0)return null;const d=c[p];return a(d.descriptor.id)},kt=(e,t)=>e.descriptor.droppableId===t.descriptor.id;const ri={point:De,value:0},Yt={invisible:{},visible:{},all:[]},vl={displaced:Yt,displacedBy:ri,at:null};var Ge=(e,t)=>n=>e<=n&&n<=t,oi=e=>{const t=Ge(e.top,e.bottom),n=Ge(e.left,e.right);return r=>{if(t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right))return!0;const i=t(r.top)||t(r.bottom),a=n(r.left)||n(r.right);if(i&&a)return!0;const u=r.top<e.top&&r.bottom>e.bottom,c=r.left<e.left&&r.right>e.right;return u&&c?!0:u&&a||c&&i}},xl=e=>{const t=Ge(e.top,e.bottom),n=Ge(e.left,e.right);return r=>t(r.top)&&t(r.bottom)&&n(r.left)&&n(r.right)};const br={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},ii={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"};var Dl=e=>t=>{const n=Ge(t.top,t.bottom),r=Ge(t.left,t.right);return o=>e===br?n(o.top)&&n(o.bottom):r(o.left)&&r(o.right)};const El=(e,t)=>{const n=t.frame?t.frame.scroll.diff.displacement:De;return on(e,n)},wl=(e,t,n)=>t.subject.active?n(t.subject.active)(e):!1,Il=(e,t,n)=>n(t)(e),yr=({target:e,destination:t,viewport:n,withDroppableDisplacement:r,isVisibleThroughFrameFn:o})=>{const i=r?El(e,t):e;return wl(i,t,o)&&Il(i,n,o)},Cl=e=>yr({...e,isVisibleThroughFrameFn:oi}),ai=e=>yr({...e,isVisibleThroughFrameFn:xl}),Nl=e=>yr({...e,isVisibleThroughFrameFn:Dl(e.destination.axis)}),Sl=(e,t,n)=>{if(typeof n=="boolean")return n;if(!t)return!0;const{invisible:r,visible:o}=t;if(r[e])return!1;const i=o[e];return i?i.shouldAnimate:!0};function Ol(e,t){const n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return He(fr(n,r))}function Jt({afterDragging:e,destination:t,displacedBy:n,viewport:r,forceShouldAnimate:o,last:i}){return e.reduce(function(l,u){const c=Ol(u,n),f=u.descriptor.id;if(l.all.push(f),!Cl({target:c,destination:t,viewport:r,withDroppableDisplacement:!0}))return l.invisible[u.descriptor.id]=!0,l;const d=Sl(f,i,o),m={draggableId:f,shouldAnimate:d};return l.visible[f]=m,l},{all:[],visible:{},invisible:{}})}function Pl(e,t){if(!e.length)return 0;const n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}function so({insideDestination:e,inHomeList:t,displacedBy:n,destination:r}){const o=Pl(e,{inHomeList:t});return{displaced:Yt,displacedBy:n,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:o}}}}function En({draggable:e,insideDestination:t,destination:n,viewport:r,displacedBy:o,last:i,index:a,forceShouldAnimate:l}){const u=kt(e,n);if(a==null)return so({insideDestination:t,inHomeList:u,displacedBy:o,destination:n});const c=t.find(g=>g.descriptor.index===a);if(!c)return so({insideDestination:t,inHomeList:u,displacedBy:o,destination:n});const f=Rn(e,t),p=t.indexOf(c),d=f.slice(p);return{displaced:Jt({afterDragging:d,destination:n,displacedBy:o,last:i,viewport:r.frame,forceShouldAnimate:l}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:n.descriptor.id,index:a}}}}function bt(e,t){return!!t.effected[e]}var Al=({isMovingForward:e,destination:t,draggables:n,combine:r,afterCritical:o})=>{if(!t.isCombineEnabled)return null;const i=r.draggableId,l=n[i].descriptor.index;return bt(i,o)?e?l:l-1:e?l+1:l},$l=({isMovingForward:e,isInHomeList:t,insideDestination:n,location:r})=>{if(!n.length)return null;const o=r.index,i=e?o+1:o-1,a=n[0].descriptor.index,l=n[n.length-1].descriptor.index,u=t?l:l+1;return i<a||i>u?null:i},Rl=({isMovingForward:e,isInHomeList:t,draggable:n,draggables:r,destination:o,insideDestination:i,previousImpact:a,viewport:l,afterCritical:u})=>{const c=a.at;if(c||(process.env.NODE_ENV!=="production"?h(!1,"Cannot move in direction without previous impact location"):h()),c.type==="REORDER"){const p=$l({isMovingForward:e,isInHomeList:t,location:c.destination,insideDestination:i});return p==null?null:En({draggable:n,insideDestination:i,destination:o,viewport:l,last:a.displaced,displacedBy:a.displacedBy,index:p})}const f=Al({isMovingForward:e,destination:o,displaced:a.displaced,draggables:r,combine:c.combine,afterCritical:u});return f==null?null:En({draggable:n,insideDestination:i,destination:o,viewport:l,last:a.displaced,displacedBy:a.displacedBy,index:f})},Tl=({displaced:e,afterCritical:t,combineWith:n,displacedBy:r})=>{const o=!!(e.visible[n]||e.invisible[n]);return bt(n,t)?o?De:Bt(r.point):o?r.point:De},Bl=({afterCritical:e,impact:t,draggables:n})=>{const r=$n(t);r||(process.env.NODE_ENV,h());const o=r.draggableId,i=n[o].page.borderBox.center,a=Tl({displaced:t.displaced,afterCritical:e,combineWith:o,displacedBy:t.displacedBy});return we(i,a)};const si=(e,t)=>t.margin[e.start]+t.borderBox[e.size]/2,kl=(e,t)=>t.margin[e.end]+t.borderBox[e.size]/2,vr=(e,t,n)=>t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2,lo=({axis:e,moveRelativeTo:t,isMoving:n})=>Dt(e.line,t.marginBox[e.end]+si(e,n),vr(e,t.marginBox,n)),co=({axis:e,moveRelativeTo:t,isMoving:n})=>Dt(e.line,t.marginBox[e.start]-kl(e,n),vr(e,t.marginBox,n)),_l=({axis:e,moveInto:t,isMoving:n})=>Dt(e.line,t.contentBox[e.start]+si(e,n),vr(e,t.contentBox,n));var Fl=({impact:e,draggable:t,draggables:n,droppable:r,afterCritical:o})=>{const i=It(r.descriptor.id,n),a=t.page,l=r.axis;if(!i.length)return _l({axis:l,moveInto:r.page,isMoving:a});const{displaced:u,displacedBy:c}=e,f=u.all[0];if(f){const d=n[f];if(bt(f,o))return co({axis:l,moveRelativeTo:d.page,isMoving:a});const m=vn(d.page,c.point);return co({axis:l,moveRelativeTo:m,isMoving:a})}const p=i[i.length-1];if(p.descriptor.id===t.descriptor.id)return a.borderBox.center;if(bt(p.descriptor.id,o)){const d=vn(p.page,Bt(o.displacedBy.point));return lo({axis:l,moveRelativeTo:d,isMoving:a})}return lo({axis:l,moveRelativeTo:p.page,isMoving:a})},er=(e,t)=>{const n=e.frame;return n?we(t,n.scroll.diff.displacement):t};const Ll=({impact:e,draggable:t,droppable:n,draggables:r,afterCritical:o})=>{const i=t.page.borderBox.center,a=e.at;return!n||!a?i:a.type==="REORDER"?Fl({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:o}):Bl({impact:e,draggables:r,afterCritical:o})};var Tn=e=>{const t=Ll(e),n=e.droppable;return n?er(n,t):t},li=(e,t)=>{const n=_e(t,e.scroll.initial),r=Bt(n);return{frame:He({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function uo(e,t){return e.map(n=>t[n])}function Vl(e,t){for(let n=0;n<t.length;n++){const r=t[n].visible[e];if(r)return r}return null}var Ml=({impact:e,viewport:t,destination:n,draggables:r,maxScrollChange:o})=>{const i=li(t,we(t.scroll.current,o)),a=n.frame?hr(n,we(n.frame.scroll.current,o)):n,l=e.displaced,u=Jt({afterDragging:uo(l.all,r),destination:n,displacedBy:e.displacedBy,viewport:i.frame,last:l,forceShouldAnimate:!1}),c=Jt({afterDragging:uo(l.all,r),destination:a,displacedBy:e.displacedBy,viewport:t.frame,last:l,forceShouldAnimate:!1}),f={},p={},d=[l,u,c];return l.all.forEach(g=>{const y=Vl(g,d);if(y){p[g]=y;return}f[g]=!0}),{...e,displaced:{all:l.all,invisible:f,visible:p}}},Gl=(e,t)=>we(e.scroll.diff.displacement,t),xr=({pageBorderBoxCenter:e,draggable:t,viewport:n})=>{const r=Gl(n,e),o=_e(r,t.page.borderBox.center);return we(t.client.borderBox.center,o)},ci=({draggable:e,destination:t,newPageBorderBoxCenter:n,viewport:r,withDroppableDisplacement:o,onlyOnMainAxis:i=!1})=>{const a=_e(n,e.page.borderBox.center),u={target:on(e.page.borderBox,a),destination:t,withDroppableDisplacement:o,viewport:r};return i?Nl(u):ai(u)},Wl=({isMovingForward:e,draggable:t,destination:n,draggables:r,previousImpact:o,viewport:i,previousPageBorderBoxCenter:a,previousClientSelection:l,afterCritical:u})=>{if(!n.isEnabled)return null;const c=It(n.descriptor.id,r),f=kt(t,n),p=yl({isMovingForward:e,draggable:t,destination:n,insideDestination:c,previousImpact:o})||Rl({isMovingForward:e,isInHomeList:f,draggable:t,draggables:r,destination:n,insideDestination:c,previousImpact:o,viewport:i,afterCritical:u});if(!p)return null;const d=Tn({impact:p,draggable:t,droppable:n,draggables:r,afterCritical:u});if(ci({draggable:t,destination:n,newPageBorderBoxCenter:d,viewport:i.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:xr({pageBorderBoxCenter:d,draggable:t,viewport:i}),impact:p,scrollJumpRequest:null};const g=_e(d,a),y=Ml({impact:p,viewport:i,destination:n,draggables:r,maxScrollChange:g});return{clientSelection:l,impact:y,scrollJumpRequest:g}};const Pe=e=>{const t=e.subject.active;return t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get clipped area from droppable"):h()),t};var zl=({isMovingForward:e,pageBorderBoxCenter:t,source:n,droppables:r,viewport:o})=>{const i=n.subject.active;if(!i)return null;const a=n.axis,l=Ge(i[a.start],i[a.end]),u=An(r).filter(f=>f!==n).filter(f=>f.isEnabled).filter(f=>!!f.subject.active).filter(f=>oi(o.frame)(Pe(f))).filter(f=>{const p=Pe(f);return e?i[a.crossAxisEnd]<p[a.crossAxisEnd]:p[a.crossAxisStart]<i[a.crossAxisStart]}).filter(f=>{const p=Pe(f),d=Ge(p[a.start],p[a.end]);return l(p[a.start])||l(p[a.end])||d(i[a.start])||d(i[a.end])}).sort((f,p)=>{const d=Pe(f)[a.crossAxisStart],m=Pe(p)[a.crossAxisStart];return e?d-m:m-d}).filter((f,p,d)=>Pe(f)[a.crossAxisStart]===Pe(d[0])[a.crossAxisStart]);if(!u.length)return null;if(u.length===1)return u[0];const c=u.filter(f=>Ge(Pe(f)[a.start],Pe(f)[a.end])(t[a.line]));return c.length===1?c[0]:c.length>1?c.sort((f,p)=>Pe(f)[a.start]-Pe(p)[a.start])[0]:u.sort((f,p)=>{const d=io(t,ao(Pe(f))),m=io(t,ao(Pe(p)));return d!==m?d-m:Pe(f)[a.start]-Pe(p)[a.start]})[0]};const po=(e,t)=>{const n=e.page.borderBox.center;return bt(e.descriptor.id,t)?_e(n,t.displacedBy.point):n},Hl=(e,t)=>{const n=e.page.borderBox;return bt(e.descriptor.id,t)?on(n,Bt(t.displacedBy.point)):n};var Ul=({pageBorderBoxCenter:e,viewport:t,destination:n,insideDestination:r,afterCritical:o})=>r.filter(a=>ai({target:Hl(a,o),destination:n,viewport:t.frame,withDroppableDisplacement:!0})).sort((a,l)=>{const u=Kt(e,er(n,po(a,o))),c=Kt(e,er(n,po(l,o)));return u<c?-1:c<u?1:a.descriptor.index-l.descriptor.index})[0]||null,an=xe(function(t,n){const r=n[t.line];return{value:r,point:Dt(t.line,r)}});const jl=(e,t,n)=>{const r=e.axis;if(e.descriptor.mode==="virtual")return Dt(r.line,t[r.line]);const o=e.subject.page.contentBox[r.size],u=It(e.descriptor.id,n).reduce((c,f)=>c+f.client.marginBox[r.size],0)+t[r.line]-o;return u<=0?null:Dt(r.line,u)},di=(e,t)=>({...e,scroll:{...e.scroll,max:t}}),ui=(e,t,n)=>{const r=e.frame;kt(t,e)&&(process.env.NODE_ENV!=="production"?h(!1,"Should not add placeholder space to home list"):h()),e.subject.withPlaceholder&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot add placeholder size to a subject when it already has one"):h());const o=an(e.axis,t.displaceBy).point,i=jl(e,o,n),a={placeholderSize:o,increasedBy:i,oldFrameMaxScroll:e.frame?e.frame.scroll.max:null};if(!r){const f=Ot({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:e.frame});return{...e,subject:f}}const l=i?we(r.scroll.max,i):r.scroll.max,u=di(r,l),c=Ot({page:e.subject.page,withPlaceholder:a,axis:e.axis,frame:u});return{...e,subject:c,frame:u}},ql=e=>{const t=e.subject.withPlaceholder;t||(process.env.NODE_ENV!=="production"?h(!1,"Cannot remove placeholder form subject when there was none"):h());const n=e.frame;if(!n){const a=Ot({page:e.subject.page,axis:e.axis,frame:null,withPlaceholder:null});return{...e,subject:a}}const r=t.oldFrameMaxScroll;r||(process.env.NODE_ENV!=="production"?h(!1,"Expected droppable with frame to have old max frame scroll when removing placeholder"):h());const o=di(n,r),i=Ot({page:e.subject.page,axis:e.axis,frame:o,withPlaceholder:null});return{...e,subject:i,frame:o}};var Kl=({previousPageBorderBoxCenter:e,moveRelativeTo:t,insideDestination:n,draggable:r,draggables:o,destination:i,viewport:a,afterCritical:l})=>{if(!t){if(n.length)return null;const p={displaced:Yt,displacedBy:ri,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:0}}},d=Tn({impact:p,draggable:r,droppable:i,draggables:o,afterCritical:l}),m=kt(r,i)?i:ui(i,r,o);return ci({draggable:r,destination:m,newPageBorderBoxCenter:d,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?p:null}const u=e[i.axis.line]<=t.page.borderBox.center[i.axis.line],c=(()=>{const p=t.descriptor.index;return t.descriptor.id===r.descriptor.id||u?p:p+1})(),f=an(i.axis,r.displaceBy);return En({draggable:r,insideDestination:n,destination:i,viewport:a,displacedBy:f,last:Yt,index:c})},Yl=({isMovingForward:e,previousPageBorderBoxCenter:t,draggable:n,isOver:r,draggables:o,droppables:i,viewport:a,afterCritical:l})=>{const u=zl({isMovingForward:e,pageBorderBoxCenter:t,source:r,droppables:i,viewport:a});if(!u)return null;const c=It(u.descriptor.id,o),f=Ul({pageBorderBoxCenter:t,viewport:a,destination:u,insideDestination:c,afterCritical:l}),p=Kl({previousPageBorderBoxCenter:t,destination:u,draggable:n,draggables:o,moveRelativeTo:f,insideDestination:c,viewport:a,afterCritical:l});if(!p)return null;const d=Tn({impact:p,draggable:n,droppable:u,draggables:o,afterCritical:l});return{clientSelection:xr({pageBorderBoxCenter:d,draggable:n,viewport:a}),impact:p,scrollJumpRequest:null}},Fe=e=>{const t=e.at;return t?t.type==="REORDER"?t.destination.droppableId:t.combine.droppableId:null};const Jl=(e,t)=>{const n=Fe(e);return n?t[n]:null};var Xl=({state:e,type:t})=>{const n=Jl(e.impact,e.dimensions.droppables),r=!!n,o=e.dimensions.droppables[e.critical.droppable.id],i=n||o,a=i.axis.direction,l=a==="vertical"&&(t==="MOVE_UP"||t==="MOVE_DOWN")||a==="horizontal"&&(t==="MOVE_LEFT"||t==="MOVE_RIGHT");if(l&&!r)return null;const u=t==="MOVE_DOWN"||t==="MOVE_RIGHT",c=e.dimensions.draggables[e.critical.draggable.id],f=e.current.page.borderBoxCenter,{draggables:p,droppables:d}=e.dimensions;return l?Wl({isMovingForward:u,previousPageBorderBoxCenter:f,draggable:c,destination:i,draggables:p,viewport:e.viewport,previousClientSelection:e.current.client.selection,previousImpact:e.impact,afterCritical:e.afterCritical}):Yl({isMovingForward:u,previousPageBorderBoxCenter:f,draggable:c,isOver:i,draggables:p,droppables:d,viewport:e.viewport,afterCritical:e.afterCritical})};function xt(e){return e.phase==="DRAGGING"||e.phase==="COLLECTING"}function pi(e){const t=Ge(e.top,e.bottom),n=Ge(e.left,e.right);return function(o){return t(o.y)&&n(o.x)}}function Zl(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function Ql({pageBorderBox:e,draggable:t,candidates:n}){const r=t.page.borderBox.center,o=n.map(i=>{const a=i.axis,l=Dt(i.axis.line,e.center[a.line],i.page.borderBox.center[a.crossAxisLine]);return{id:i.descriptor.id,distance:Kt(r,l)}}).sort((i,a)=>a.distance-i.distance);return o[0]?o[0].id:null}function ec({pageBorderBox:e,draggable:t,droppables:n}){const r=An(n).filter(o=>{if(!o.isEnabled)return!1;const i=o.subject.active;if(!i||!Zl(e,i))return!1;if(pi(i)(e.center))return!0;const a=o.axis,l=i.center[a.crossAxisLine],u=e[a.crossAxisStart],c=e[a.crossAxisEnd],f=Ge(i[a.crossAxisStart],i[a.crossAxisEnd]),p=f(u),d=f(c);return!p&&!d?!0:p?u<l:c>l});return r.length?r.length===1?r[0].descriptor.id:Ql({pageBorderBox:e,draggable:t,candidates:r}):null}const fi=(e,t)=>He(on(e,t));var tc=(e,t)=>{const n=e.frame;return n?fi(t,n.scroll.diff.value):t};function mi({displaced:e,id:t}){return!!(e.visible[t]||e.invisible[t])}function nc({draggable:e,closest:t,inHomeList:n}){return t?n&&t.descriptor.index>e.descriptor.index?t.descriptor.index-1:t.descriptor.index:null}var rc=({pageBorderBoxWithDroppableScroll:e,draggable:t,destination:n,insideDestination:r,last:o,viewport:i,afterCritical:a})=>{const l=n.axis,u=an(n.axis,t.displaceBy),c=u.value,f=e[l.start],p=e[l.end],m=Rn(t,r).find(y=>{const x=y.descriptor.id,D=y.page.borderBox.center[l.line],E=bt(x,a),P=mi({displaced:o,id:x});return E?P?p<=D:f<D-c:P?p<=D+c:f<D})||null,g=nc({draggable:t,closest:m,inHomeList:kt(t,n)});return En({draggable:t,insideDestination:r,destination:n,viewport:i,last:o,displacedBy:u,index:g})};const oc=4;var ic=({draggable:e,pageBorderBoxWithDroppableScroll:t,previousImpact:n,destination:r,insideDestination:o,afterCritical:i})=>{if(!r.isCombineEnabled)return null;const a=r.axis,l=an(r.axis,e.displaceBy),u=l.value,c=t[a.start],f=t[a.end],d=Rn(e,o).find(g=>{const y=g.descriptor.id,x=g.page.borderBox,E=x[a.size]/oc,P=bt(y,i),N=mi({displaced:n.displaced,id:y});return P?N?f>x[a.start]+E&&f<x[a.end]-E:c>x[a.start]-u+E&&c<x[a.end]-u-E:N?f>x[a.start]+u+E&&f<x[a.end]+u-E:c>x[a.start]+E&&c<x[a.end]-E});return d?{displacedBy:l,displaced:n.displaced,at:{type:"COMBINE",combine:{draggableId:d.descriptor.id,droppableId:r.descriptor.id}}}:null},hi=({pageOffset:e,draggable:t,draggables:n,droppables:r,previousImpact:o,viewport:i,afterCritical:a})=>{const l=fi(t.page.borderBox,e),u=ec({pageBorderBox:l,draggable:t,droppables:r});if(!u)return vl;const c=r[u],f=It(c.descriptor.id,n),p=tc(c,l);return ic({pageBorderBoxWithDroppableScroll:p,draggable:t,previousImpact:o,destination:c,insideDestination:f,afterCritical:a})||rc({pageBorderBoxWithDroppableScroll:p,draggable:t,destination:c,insideDestination:f,last:o.displaced,viewport:i,afterCritical:a})},Dr=(e,t)=>({...e,[t.descriptor.id]:t});const ac=({previousImpact:e,impact:t,droppables:n})=>{const r=Fe(e),o=Fe(t);if(!r||r===o)return n;const i=n[r];if(!i.subject.withPlaceholder)return n;const a=ql(i);return Dr(n,a)};var sc=({draggable:e,draggables:t,droppables:n,previousImpact:r,impact:o})=>{const i=ac({previousImpact:r,impact:o,droppables:n}),a=Fe(o);if(!a)return i;const l=n[a];if(kt(e,l)||l.subject.withPlaceholder)return i;const u=ui(l,e,t);return Dr(i,u)},Ht=({state:e,clientSelection:t,dimensions:n,viewport:r,impact:o,scrollJumpRequest:i})=>{const a=r||e.viewport,l=n||e.dimensions,u=t||e.current.client.selection,c=_e(u,e.initial.client.selection),f={offset:c,selection:u,borderBoxCenter:we(e.initial.client.borderBoxCenter,c)},p={selection:we(f.selection,a.scroll.current),borderBoxCenter:we(f.borderBoxCenter,a.scroll.current),offset:we(f.offset,a.scroll.diff.value)},d={client:f,page:p};if(e.phase==="COLLECTING")return{...e,dimensions:l,viewport:a,current:d};const m=l.draggables[e.critical.draggable.id],g=o||hi({pageOffset:p.offset,draggable:m,draggables:l.draggables,droppables:l.droppables,previousImpact:e.impact,viewport:a,afterCritical:e.afterCritical}),y=sc({draggable:m,impact:g,previousImpact:e.impact,draggables:l.draggables,droppables:l.droppables});return{...e,current:d,dimensions:{draggables:l.draggables,droppables:y},impact:g,viewport:a,scrollJumpRequest:i||null,forceShouldAnimate:i?!1:null}};function lc(e,t){return e.map(n=>t[n])}var gi=({impact:e,viewport:t,draggables:n,destination:r,forceShouldAnimate:o})=>{const i=e.displaced,a=lc(i.all,n),l=Jt({afterDragging:a,destination:r,displacedBy:e.displacedBy,viewport:t.frame,forceShouldAnimate:o,last:i});return{...e,displaced:l}},bi=({impact:e,draggable:t,droppable:n,draggables:r,viewport:o,afterCritical:i})=>{const a=Tn({impact:e,draggable:t,draggables:r,droppable:n,afterCritical:i});return xr({pageBorderBoxCenter:a,draggable:t,viewport:o})},yi=({state:e,dimensions:t,viewport:n})=>{e.movementMode!=="SNAP"&&(process.env.NODE_ENV,h());const r=e.impact,o=n||e.viewport,i=t||e.dimensions,{draggables:a,droppables:l}=i,u=a[e.critical.draggable.id],c=Fe(r);c||(process.env.NODE_ENV!=="production"?h(!1,"Must be over a destination in SNAP movement mode"):h());const f=l[c],p=gi({impact:r,viewport:o,destination:f,draggables:a}),d=bi({impact:p,draggable:u,droppable:f,draggables:a,viewport:o,afterCritical:e.afterCritical});return Ht({impact:p,clientSelection:d,state:e,dimensions:i,viewport:o})},cc=e=>({index:e.index,droppableId:e.droppableId}),vi=({draggable:e,home:t,draggables:n,viewport:r})=>{const o=an(t.axis,e.displaceBy),i=It(t.descriptor.id,n),a=i.indexOf(e);a===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Expected draggable to be inside home list"):h());const l=i.slice(a+1),u=l.reduce((d,m)=>(d[m.descriptor.id]=!0,d),{}),c={inVirtualList:t.descriptor.mode==="virtual",displacedBy:o,effected:u};return{impact:{displaced:Jt({afterDragging:l,destination:t,displacedBy:o,last:null,viewport:r.frame,forceShouldAnimate:!1}),displacedBy:o,at:{type:"REORDER",destination:cc(e.descriptor)}},afterCritical:c}},dc=(e,t)=>({draggables:e.draggables,droppables:Dr(e.droppables,t)});const sn=e=>{process.env.NODE_ENV},ln=e=>{process.env.NODE_ENV};var uc=({draggable:e,offset:t,initialWindowScroll:n})=>{const r=vn(e.client,t),o=xn(r,n);return{...e,placeholder:{...e.placeholder,client:r},client:r,page:o}},pc=e=>{const t=e.frame;return t||(process.env.NODE_ENV!=="production"?h(!1,"Expected Droppable to have a frame"):h()),t},fc=({additions:e,updatedDroppables:t,viewport:n})=>{const r=n.scroll.diff.value;return e.map(o=>{const i=o.descriptor.droppableId,a=t[i],u=pc(a).scroll.diff.value,c=we(r,u);return uc({draggable:o,offset:c,initialWindowScroll:n.scroll.initial})})},mc=({state:e,published:t})=>{sn();const n=t.modified.map(D=>{const E=e.dimensions.droppables[D.droppableId];return hr(E,D.scroll)}),r={...e.dimensions.droppables,...ti(n)},o=ni(fc({additions:t.additions,updatedDroppables:r,viewport:e.viewport})),i={...e.dimensions.draggables,...o};t.removals.forEach(D=>{delete i[D]});const a={droppables:r,draggables:i},l=Fe(e.impact),u=l?a.droppables[l]:null,c=a.draggables[e.critical.draggable.id],f=a.droppables[e.critical.droppable.id],{impact:p,afterCritical:d}=vi({draggable:c,home:f,draggables:i,viewport:e.viewport}),m=u&&u.isCombineEnabled?e.impact:p,g=hi({pageOffset:e.current.page.offset,draggable:a.draggables[e.critical.draggable.id],draggables:a.draggables,droppables:a.droppables,previousImpact:m,viewport:e.viewport,afterCritical:d});ln();const y={...e,phase:"DRAGGING",impact:g,onLiftImpact:p,dimensions:a,afterCritical:d,forceShouldAnimate:!1};return e.phase==="COLLECTING"?y:{...y,phase:"DROP_PENDING",reason:e.reason,isWaiting:!1}};const tr=e=>e.movementMode==="SNAP",Gn=(e,t,n)=>{const r=dc(e.dimensions,t);return!tr(e)||n?Ht({state:e,dimensions:r}):yi({state:e,dimensions:r})};function Wn(e){return e.isDragging&&e.movementMode==="SNAP"?{...e,scrollJumpRequest:null}:e}const fo={phase:"IDLE",completed:null,shouldFlush:!1};var hc=(e=fo,t)=>{if(t.type==="FLUSH")return{...fo,shouldFlush:!0};if(t.type==="INITIAL_PUBLISH"){e.phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"INITIAL_PUBLISH must come after a IDLE phase"):h());const{critical:n,clientSelection:r,viewport:o,dimensions:i,movementMode:a}=t.payload,l=i.draggables[n.draggable.id],u=i.droppables[n.droppable.id],c={selection:r,borderBoxCenter:l.client.borderBox.center,offset:De},f={client:c,page:{selection:we(c.selection,o.scroll.initial),borderBoxCenter:we(c.selection,o.scroll.initial),offset:we(c.selection,o.scroll.diff.value)}},p=An(i.droppables).every(y=>!y.isFixedOnPage),{impact:d,afterCritical:m}=vi({draggable:l,home:u,draggables:i.draggables,viewport:o});return{phase:"DRAGGING",isDragging:!0,critical:n,movementMode:a,dimensions:i,initial:f,current:f,isWindowScrollAllowed:p,impact:d,afterCritical:m,onLiftImpact:d,viewport:o,scrollJumpRequest:null,forceShouldAnimate:null}}if(t.type==="COLLECTION_STARTING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"?e:(e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`Collection cannot start from phase ${e.phase}`):h()),{...e,phase:"COLLECTING"});if(t.type==="PUBLISH_WHILE_DRAGGING")return e.phase==="COLLECTING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Unexpected ${t.type} received in phase ${e.phase}`):h()),mc({state:e,published:t.payload});if(t.type==="MOVE"){if(e.phase==="DROP_PENDING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{client:n}=t.payload;return ht(n,e.current.client.selection)?e:Ht({state:e,clientSelection:n,impact:tr(e)?e.impact:null})}if(t.type==="UPDATE_DROPPABLE_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="COLLECTING")return Wn(e);xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`${t.type} not permitted in phase ${e.phase}`):h());const{id:n,newScroll:r}=t.payload,o=e.dimensions.droppables[n];if(!o)return e;const i=hr(o,r);return Gn(e,i,!1)}if(t.type==="UPDATE_DROPPABLE_IS_ENABLED"){if(e.phase==="DROP_PENDING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`Attempting to move in an unsupported phase ${e.phase}`):h());const{id:n,isEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find Droppable[id: ${n}] to toggle its enabled state`):h()),o.isEnabled===r&&(process.env.NODE_ENV!=="production"?h(!1,`Trying to set droppable isEnabled to ${String(r)}
47
47
  but it is already ${String(o.isEnabled)}`):h());const i={...o,isEnabled:r};return Gn(e,i,!0)}if(t.type==="UPDATE_DROPPABLE_IS_COMBINE_ENABLED"){if(e.phase==="DROP_PENDING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`Attempting to move in an unsupported phase ${e.phase}`):h());const{id:n,isCombineEnabled:r}=t.payload,o=e.dimensions.droppables[n];o||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find Droppable[id: ${n}] to toggle its isCombineEnabled state`):h()),o.isCombineEnabled===r&&(process.env.NODE_ENV!=="production"?h(!1,`Trying to set droppable isCombineEnabled to ${String(r)}
48
- but it is already ${String(o.isCombineEnabled)}`):h());const i={...o,isCombineEnabled:r};return Gn(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot move by window in phase ${e.phase}`):h()),e.isWindowScrollAllowed||(process.env.NODE_ENV!=="production"?h(!1,"Window scrolling is currently not supported for fixed lists"):h());const n=t.payload.newScroll;if(ht(e.viewport.scroll.current,n))return Wn(e);const r=li(e.viewport,n);return tr(e)?yi({state:e,viewport:r}):Ht({state:e,viewport:r})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!xt(e))return e;const n=t.payload.maxScroll;if(ht(n,e.viewport.scroll.max))return e;const r={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:r}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`${t.type} received while not in DRAGGING phase`):h());const n=Xl({state:e,type:t.type});return n?Ht({state:e,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const n=t.payload.reason;return e.phase!=="COLLECTING"&&(process.env.NODE_ENV!=="production"?h(!1,"Can only move into the DROP_PENDING phase from the COLLECTING phase"):h()),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:o}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Cannot animate drop from phase ${e.phase}`):h()),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:o,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function J(e,t){return e instanceof Object&&"type"in e&&e.type===t}const gc=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),bc=e=>({type:"LIFT",payload:e}),yc=e=>({type:"INITIAL_PUBLISH",payload:e}),vc=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),xc=()=>({type:"COLLECTION_STARTING",payload:null}),Dc=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),Ec=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),wc=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),xi=e=>({type:"MOVE",payload:e}),Ic=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),Cc=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),Nc=()=>({type:"MOVE_UP",payload:null}),Sc=()=>({type:"MOVE_DOWN",payload:null}),Oc=()=>({type:"MOVE_RIGHT",payload:null}),Pc=()=>({type:"MOVE_LEFT",payload:null}),Er=()=>({type:"FLUSH",payload:null}),Ac=e=>({type:"DROP_ANIMATE",payload:e}),wr=e=>({type:"DROP_COMPLETE",payload:e}),Di=e=>({type:"DROP",payload:e}),Rc=e=>({type:"DROP_PENDING",payload:e}),Ei=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});function $c(e){if(e.length<=1)return;const t=e.map(o=>o.descriptor.index),n={};for(let o=1;o<t.length;o++){const i=t[o],a=t[o-1];i!==a+1&&(n[i]=!0)}if(!Object.keys(n).length)return;const r=t.map(o=>!!n[o]?`[🔥${o}]`:`${o}`).join(", ");process.env.NODE_ENV!=="production"&&ie(`
48
+ but it is already ${String(o.isCombineEnabled)}`):h());const i={...o,isCombineEnabled:r};return Gn(e,i,!0)}if(t.type==="MOVE_BY_WINDOW_SCROLL"){if(e.phase==="DROP_PENDING"||e.phase==="DROP_ANIMATING")return e;xt(e)||(process.env.NODE_ENV!=="production"?h(!1,`Cannot move by window in phase ${e.phase}`):h()),e.isWindowScrollAllowed||(process.env.NODE_ENV!=="production"?h(!1,"Window scrolling is currently not supported for fixed lists"):h());const n=t.payload.newScroll;if(ht(e.viewport.scroll.current,n))return Wn(e);const r=li(e.viewport,n);return tr(e)?yi({state:e,viewport:r}):Ht({state:e,viewport:r})}if(t.type==="UPDATE_VIEWPORT_MAX_SCROLL"){if(!xt(e))return e;const n=t.payload.maxScroll;if(ht(n,e.viewport.scroll.max))return e;const r={...e.viewport,scroll:{...e.viewport.scroll,max:n}};return{...e,viewport:r}}if(t.type==="MOVE_UP"||t.type==="MOVE_DOWN"||t.type==="MOVE_LEFT"||t.type==="MOVE_RIGHT"){if(e.phase==="COLLECTING"||e.phase==="DROP_PENDING")return e;e.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,`${t.type} received while not in DRAGGING phase`):h());const n=Xl({state:e,type:t.type});return n?Ht({state:e,impact:n.impact,clientSelection:n.clientSelection,scrollJumpRequest:n.scrollJumpRequest}):e}if(t.type==="DROP_PENDING"){const n=t.payload.reason;return e.phase!=="COLLECTING"&&(process.env.NODE_ENV!=="production"?h(!1,"Can only move into the DROP_PENDING phase from the COLLECTING phase"):h()),{...e,phase:"DROP_PENDING",isWaiting:!0,reason:n}}if(t.type==="DROP_ANIMATE"){const{completed:n,dropDuration:r,newHomeClientOffset:o}=t.payload;return e.phase==="DRAGGING"||e.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Cannot animate drop from phase ${e.phase}`):h()),{phase:"DROP_ANIMATING",completed:n,dropDuration:r,newHomeClientOffset:o,dimensions:e.dimensions}}if(t.type==="DROP_COMPLETE"){const{completed:n}=t.payload;return{phase:"IDLE",completed:n,shouldFlush:!1}}return e};function J(e,t){return e instanceof Object&&"type"in e&&e.type===t}const gc=e=>({type:"BEFORE_INITIAL_CAPTURE",payload:e}),bc=e=>({type:"LIFT",payload:e}),yc=e=>({type:"INITIAL_PUBLISH",payload:e}),vc=e=>({type:"PUBLISH_WHILE_DRAGGING",payload:e}),xc=()=>({type:"COLLECTION_STARTING",payload:null}),Dc=e=>({type:"UPDATE_DROPPABLE_SCROLL",payload:e}),Ec=e=>({type:"UPDATE_DROPPABLE_IS_ENABLED",payload:e}),wc=e=>({type:"UPDATE_DROPPABLE_IS_COMBINE_ENABLED",payload:e}),xi=e=>({type:"MOVE",payload:e}),Ic=e=>({type:"MOVE_BY_WINDOW_SCROLL",payload:e}),Cc=e=>({type:"UPDATE_VIEWPORT_MAX_SCROLL",payload:e}),Nc=()=>({type:"MOVE_UP",payload:null}),Sc=()=>({type:"MOVE_DOWN",payload:null}),Oc=()=>({type:"MOVE_RIGHT",payload:null}),Pc=()=>({type:"MOVE_LEFT",payload:null}),Er=()=>({type:"FLUSH",payload:null}),Ac=e=>({type:"DROP_ANIMATE",payload:e}),wr=e=>({type:"DROP_COMPLETE",payload:e}),Di=e=>({type:"DROP",payload:e}),$c=e=>({type:"DROP_PENDING",payload:e}),Ei=()=>({type:"DROP_ANIMATION_FINISHED",payload:null});function Rc(e){if(e.length<=1)return;const t=e.map(o=>o.descriptor.index),n={};for(let o=1;o<t.length;o++){const i=t[o],a=t[o-1];i!==a+1&&(n[i]=!0)}if(!Object.keys(n).length)return;const r=t.map(o=>!!n[o]?`[🔥${o}]`:`${o}`).join(", ");process.env.NODE_ENV!=="production"&&ie(`
49
49
  Detected non-consecutive <Draggable /> indexes.
50
50
 
51
51
  (This can cause unexpected bugs)
52
52
 
53
53
  ${r}
54
- `)}function Tc(e,t){if(process.env.NODE_ENV!=="production"){const n=It(e.droppable.id,t.draggables);$c(n)}}var Bc=e=>({getState:t,dispatch:n})=>r=>o=>{if(!J(o,"LIFT")){r(o);return}const{id:i,clientSelection:a,movementMode:l}=o.payload,u=t();u.phase==="DROP_ANIMATING"&&n(wr({completed:u.completed})),t().phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Unexpected phase to start a drag"):h()),n(Er()),n(gc({draggableId:i,movementMode:l}));const f={draggableId:i,scrollOptions:{shouldPublishImmediately:l==="SNAP"}},{critical:p,dimensions:d,viewport:m}=e.startPublishing(f);Tc(p,d),n(yc({critical:p,dimensions:d,clientSelection:a,movementMode:l,viewport:m}))},kc=e=>()=>t=>n=>{J(n,"INITIAL_PUBLISH")&&e.dragging(),J(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(J(n,"FLUSH")||J(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const Ir={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Xt={opacity:{drop:0,combining:.7},scale:{drop:.75}},wi={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},vt=`${wi.outOfTheWay}s ${Ir.outOfTheWay}`,Ut={fluid:`opacity ${vt}`,snap:`transform ${vt}, opacity ${vt}`,drop:e=>{const t=`${e}s ${Ir.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${vt}`,placeholder:`height ${vt}, width ${vt}, margin ${vt}`},mo=e=>ht(e,De)?void 0:`translate(${e.x}px, ${e.y}px)`,nr={moveTo:mo,drop:(e,t)=>{const n=mo(e);if(n)return t?`${n} scale(${Xt.scale.drop})`:n}},{minDropTime:rr,maxDropTime:Ii}=wi,_c=Ii-rr,ho=1500,Fc=.6;var Lc=({current:e,destination:t,reason:n})=>{const r=Kt(e,t);if(r<=0)return rr;if(r>=ho)return Ii;const o=r/ho,i=rr+_c*o,a=n==="CANCEL"?i*Fc:i;return Number(a.toFixed(2))},Vc=({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:o})=>{const{draggables:i,droppables:a}=n,l=Fe(e),u=l?a[l]:null,c=a[t.descriptor.droppableId],f=bi({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:u||c,viewport:r});return _e(f,t.client.borderBox.center)},Mc=({draggables:e,reason:t,lastImpact:n,home:r,viewport:o,onLiftImpact:i})=>!n.at||t!=="DROP"?{impact:gi({draggables:e,impact:i,destination:r,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Yt},didDropInsideDroppable:!0};const Gc=({getState:e,dispatch:t})=>n=>r=>{if(!J(r,"DROP")){n(r);return}const o=e(),i=r.payload.reason;if(o.phase==="COLLECTING"){t(Rc({reason:i}));return}if(o.phase==="IDLE")return;o.phase==="DROP_PENDING"&&o.isWaiting&&(process.env.NODE_ENV!=="production"?h(!1,"A DROP action occurred while DROP_PENDING and still waiting"):h()),o.phase==="DRAGGING"||o.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Cannot drop in phase: ${o.phase}`):h());const l=o.critical,u=o.dimensions,c=u.draggables[o.critical.draggable.id],{impact:f,didDropInsideDroppable:p}=Mc({reason:i,lastImpact:o.impact,afterCritical:o.afterCritical,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),d=p?gr(f):null,m=p?Rn(f):null,g={index:l.draggable.index,droppableId:l.droppable.id},y={draggableId:c.descriptor.id,type:c.descriptor.type,source:g,reason:i,mode:o.movementMode,destination:d,combine:m},x=Vc({impact:f,draggable:c,dimensions:u,viewport:o.viewport,afterCritical:o.afterCritical}),D={critical:o.critical,afterCritical:o.afterCritical,result:y,impact:f};if(!(!ht(o.current.client.offset,x)||!!y.combine)){t(wr({completed:D}));return}const P=Lc({current:o.current.client.offset,destination:x,reason:i});t(Ac({newHomeClientOffset:x,dropDuration:P,completed:D}))};var Ci=()=>({x:window.pageXOffset,y:window.pageYOffset});function Wc(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function zc({onWindowScroll:e}){function t(){e(Ci())}const n=jt(t),r=Wc(n);let o=mt;function i(){return o!==mt}function a(){i()&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start scroll listener when already active"):h()),o=Me(window,[r])}function l(){i()||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop scroll listener when not active"):h()),n.cancel(),o(),o=mt}return{start:a,stop:l,isActive:i}}const Hc=e=>J(e,"DROP_COMPLETE")||J(e,"DROP_ANIMATE")||J(e,"FLUSH"),Uc=e=>{const t=zc({onWindowScroll:n=>{e.dispatch(Ic({newScroll:n}))}});return n=>r=>{!t.isActive()&&J(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&Hc(r)&&t.stop(),n(r)}};var jc=e=>{let t=!1,n=!1;const r=setTimeout(()=>{n=!0}),o=i=>{if(t){process.env.NODE_ENV!=="production"&&ie("Announcement already made. Not making a second announcement");return}if(n){process.env.NODE_ENV!=="production"&&ie(`
54
+ `)}function Tc(e,t){if(process.env.NODE_ENV!=="production"){const n=It(e.droppable.id,t.draggables);Rc(n)}}var Bc=e=>({getState:t,dispatch:n})=>r=>o=>{if(!J(o,"LIFT")){r(o);return}const{id:i,clientSelection:a,movementMode:l}=o.payload,u=t();u.phase==="DROP_ANIMATING"&&n(wr({completed:u.completed})),t().phase!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Unexpected phase to start a drag"):h()),n(Er()),n(gc({draggableId:i,movementMode:l}));const f={draggableId:i,scrollOptions:{shouldPublishImmediately:l==="SNAP"}},{critical:p,dimensions:d,viewport:m}=e.startPublishing(f);Tc(p,d),n(yc({critical:p,dimensions:d,clientSelection:a,movementMode:l,viewport:m}))},kc=e=>()=>t=>n=>{J(n,"INITIAL_PUBLISH")&&e.dragging(),J(n,"DROP_ANIMATE")&&e.dropping(n.payload.completed.result.reason),(J(n,"FLUSH")||J(n,"DROP_COMPLETE"))&&e.resting(),t(n)};const Ir={outOfTheWay:"cubic-bezier(0.2, 0, 0, 1)",drop:"cubic-bezier(.2,1,.1,1)"},Xt={opacity:{drop:0,combining:.7},scale:{drop:.75}},wi={outOfTheWay:.2,minDropTime:.33,maxDropTime:.55},vt=`${wi.outOfTheWay}s ${Ir.outOfTheWay}`,Ut={fluid:`opacity ${vt}`,snap:`transform ${vt}, opacity ${vt}`,drop:e=>{const t=`${e}s ${Ir.drop}`;return`transform ${t}, opacity ${t}`},outOfTheWay:`transform ${vt}`,placeholder:`height ${vt}, width ${vt}, margin ${vt}`},mo=e=>ht(e,De)?void 0:`translate(${e.x}px, ${e.y}px)`,nr={moveTo:mo,drop:(e,t)=>{const n=mo(e);if(n)return t?`${n} scale(${Xt.scale.drop})`:n}},{minDropTime:rr,maxDropTime:Ii}=wi,_c=Ii-rr,ho=1500,Fc=.6;var Lc=({current:e,destination:t,reason:n})=>{const r=Kt(e,t);if(r<=0)return rr;if(r>=ho)return Ii;const o=r/ho,i=rr+_c*o,a=n==="CANCEL"?i*Fc:i;return Number(a.toFixed(2))},Vc=({impact:e,draggable:t,dimensions:n,viewport:r,afterCritical:o})=>{const{draggables:i,droppables:a}=n,l=Fe(e),u=l?a[l]:null,c=a[t.descriptor.droppableId],f=bi({impact:e,draggable:t,draggables:i,afterCritical:o,droppable:u||c,viewport:r});return _e(f,t.client.borderBox.center)},Mc=({draggables:e,reason:t,lastImpact:n,home:r,viewport:o,onLiftImpact:i})=>!n.at||t!=="DROP"?{impact:gi({draggables:e,impact:i,destination:r,viewport:o,forceShouldAnimate:!0}),didDropInsideDroppable:!1}:n.at.type==="REORDER"?{impact:n,didDropInsideDroppable:!0}:{impact:{...n,displaced:Yt},didDropInsideDroppable:!0};const Gc=({getState:e,dispatch:t})=>n=>r=>{if(!J(r,"DROP")){n(r);return}const o=e(),i=r.payload.reason;if(o.phase==="COLLECTING"){t($c({reason:i}));return}if(o.phase==="IDLE")return;o.phase==="DROP_PENDING"&&o.isWaiting&&(process.env.NODE_ENV!=="production"?h(!1,"A DROP action occurred while DROP_PENDING and still waiting"):h()),o.phase==="DRAGGING"||o.phase==="DROP_PENDING"||(process.env.NODE_ENV!=="production"?h(!1,`Cannot drop in phase: ${o.phase}`):h());const l=o.critical,u=o.dimensions,c=u.draggables[o.critical.draggable.id],{impact:f,didDropInsideDroppable:p}=Mc({reason:i,lastImpact:o.impact,afterCritical:o.afterCritical,onLiftImpact:o.onLiftImpact,home:o.dimensions.droppables[o.critical.droppable.id],viewport:o.viewport,draggables:o.dimensions.draggables}),d=p?gr(f):null,m=p?$n(f):null,g={index:l.draggable.index,droppableId:l.droppable.id},y={draggableId:c.descriptor.id,type:c.descriptor.type,source:g,reason:i,mode:o.movementMode,destination:d,combine:m},x=Vc({impact:f,draggable:c,dimensions:u,viewport:o.viewport,afterCritical:o.afterCritical}),D={critical:o.critical,afterCritical:o.afterCritical,result:y,impact:f};if(!(!ht(o.current.client.offset,x)||!!y.combine)){t(wr({completed:D}));return}const P=Lc({current:o.current.client.offset,destination:x,reason:i});t(Ac({newHomeClientOffset:x,dropDuration:P,completed:D}))};var Ci=()=>({x:window.pageXOffset,y:window.pageYOffset});function Wc(e){return{eventName:"scroll",options:{passive:!0,capture:!1},fn:t=>{t.target!==window&&t.target!==window.document||e()}}}function zc({onWindowScroll:e}){function t(){e(Ci())}const n=jt(t),r=Wc(n);let o=mt;function i(){return o!==mt}function a(){i()&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start scroll listener when already active"):h()),o=Me(window,[r])}function l(){i()||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop scroll listener when not active"):h()),n.cancel(),o(),o=mt}return{start:a,stop:l,isActive:i}}const Hc=e=>J(e,"DROP_COMPLETE")||J(e,"DROP_ANIMATE")||J(e,"FLUSH"),Uc=e=>{const t=zc({onWindowScroll:n=>{e.dispatch(Ic({newScroll:n}))}});return n=>r=>{!t.isActive()&&J(r,"INITIAL_PUBLISH")&&t.start(),t.isActive()&&Hc(r)&&t.stop(),n(r)}};var jc=e=>{let t=!1,n=!1;const r=setTimeout(()=>{n=!0}),o=i=>{if(t){process.env.NODE_ENV!=="production"&&ie("Announcement already made. Not making a second announcement");return}if(n){process.env.NODE_ENV!=="production"&&ie(`
55
55
  Announcements cannot be made asynchronously.
56
56
  Default message has already been announced.
57
- `);return}t=!0,e(i),clearTimeout(r)};return o.wasCalled=()=>t,o},qc=()=>{const e=[],t=o=>{const i=e.findIndex(l=>l.timerId===o);i===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find timer"):h());const[a]=e.splice(i,1);a.callback()};return{add:o=>{const i=setTimeout(()=>t(i)),a={timerId:i,callback:o};e.push(a)},flush:()=>{if(!e.length)return;const o=[...e];e.length=0,o.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const Kc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,Yc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,Jc=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},Mt=(e,t)=>{sn(),t(),ln()},mn=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function zn(e,t,n,r){if(!e){n(r(t));return}const o=jc(n);e(t,{announce:o}),o.wasCalled()||n(r(t))}var Xc=(e,t)=>{const n=qc();let r=null;const o=(p,d)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeCapture as a drag start has already been published"):h()),Mt("onBeforeCapture",()=>{const m=e().onBeforeCapture;m&&m({draggableId:p,mode:d})})},i=(p,d)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeDragStart as a drag start has already been published"):h()),Mt("onBeforeDragStart",()=>{const m=e().onBeforeDragStart;m&&m(mn(p,d))})},a=(p,d)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeDragStart as a drag start has already been published"):h());const m=mn(p,d);r={mode:d,lastCritical:p,lastLocation:m.source,lastCombine:null},n.add(()=>{Mt("onDragStart",()=>zn(e().onDragStart,m,t,bn.onDragStart))})},l=(p,d)=>{const m=gr(d),g=Rn(d);r||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onDragMove when onDragStart has not been called"):h());const y=!Jc(p,r.lastCritical);y&&(r.lastCritical=p);const x=!Kc(r.lastLocation,m);x&&(r.lastLocation=m);const D=!Yc(r.lastCombine,g);if(D&&(r.lastCombine=g),!y&&!x&&!D)return;const E={...mn(p,r.mode),combine:g,destination:m};n.add(()=>{Mt("onDragUpdate",()=>zn(e().onDragUpdate,E,t,bn.onDragUpdate))})},u=()=>{r||(process.env.NODE_ENV!=="production"?h(!1,"Can only flush responders while dragging"):h()),n.flush()},c=p=>{r||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onDragEnd when there is no matching onDragStart"):h()),r=null,Mt("onDragEnd",()=>zn(e().onDragEnd,p,t,bn.onDragEnd))};return{beforeCapture:o,beforeStart:i,start:a,update:l,flush:u,drop:c,abort:()=>{if(!r)return;const p={...mn(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};c(p)}}},Zc=(e,t)=>{const n=Xc(e,t);return r=>o=>i=>{if(J(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(J(i,"INITIAL_PUBLISH")){const l=i.payload.critical;n.beforeStart(l,i.payload.movementMode),o(i),n.start(l,i.payload.movementMode);return}if(J(i,"DROP_COMPLETE")){const l=i.payload.completed.result;n.flush(),o(i),n.drop(l);return}if(o(i),J(i,"FLUSH")){n.abort();return}const a=r.getState();a.phase==="DRAGGING"&&n.update(a.critical,a.impact)}};const Qc=e=>t=>n=>{if(!J(n,"DROP_ANIMATION_FINISHED")){t(n);return}const r=e.getState();r.phase!=="DROP_ANIMATING"&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot finish a drop animating when no drop is occurring"):h()),e.dispatch(wr({completed:r.completed}))},ed=e=>{let t=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return o=>i=>{if((J(i,"FLUSH")||J(i,"DROP_COMPLETE")||J(i,"DROP_ANIMATION_FINISHED"))&&r(),o(i),!J(i,"DROP_ANIMATE"))return;const a={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Ei())}};n=requestAnimationFrame(()=>{n=null,t=Me(window,[a])})}};var td=e=>()=>t=>n=>{(J(n,"DROP_COMPLETE")||J(n,"FLUSH")||J(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},nd=e=>{let t=!1;return()=>n=>r=>{if(J(r,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),e.tryRestoreFocusRecorded();return}if(n(r),!!t){if(J(r,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(J(r,"DROP_COMPLETE")){t=!1;const o=r.payload.completed.result;o.combine&&e.tryShiftRecord(o.draggableId,o.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const rd=e=>J(e,"DROP_COMPLETE")||J(e,"DROP_ANIMATE")||J(e,"FLUSH");var od=e=>t=>n=>r=>{if(rd(r)){e.stop(),n(r);return}if(J(r,"INITIAL_PUBLISH")){n(r);const o=t.getState();o.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected phase to be DRAGGING after INITIAL_PUBLISH"):h()),e.start(o);return}n(r),e.scroll(t.getState())};const id=e=>t=>n=>{if(t(n),!J(n,"PUBLISH_WHILE_DRAGGING"))return;const r=e.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||e.dispatch(Di({reason:r.reason})))},ad=process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"@hello-pangea/dnd"}):Pa;var sd=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:r,announce:o,autoScroller:i})=>Oa(hc,ad(Aa(kc(n),td(e),Bc(e),Gc,Qc,ed,id,od(i),Uc,nd(t),Zc(r,o))));const Hn=()=>({additions:{},removals:{},modified:{}});function ld({registry:e,callbacks:t}){let n=Hn(),r=null;const o=()=>{r||(t.collectionStarting(),r=requestAnimationFrame(()=>{r=null,sn();const{additions:u,removals:c,modified:f}=n,p=Object.keys(u).map(g=>e.draggable.getById(g).getDimension(De)).sort((g,y)=>g.descriptor.index-y.descriptor.index),d=Object.keys(f).map(g=>{const x=e.droppable.getById(g).callbacks.getScrollWhileDragging();return{droppableId:g,scroll:x}}),m={additions:p,removals:Object.keys(c),modified:d};n=Hn(),ln(),t.publish(m)}))};return{add:u=>{const c=u.descriptor.id;n.additions[c]=u,n.modified[u.descriptor.droppableId]=!0,n.removals[c]&&delete n.removals[c],o()},remove:u=>{const c=u.descriptor;n.removals[c.id]=!0,n.modified[c.droppableId]=!0,n.additions[c.id]&&delete n.additions[c.id],o()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=Hn())}}}var Ni=({scrollHeight:e,scrollWidth:t,height:n,width:r})=>{const o=_e({x:t,y:e},{x:r,y:n});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},Si=()=>{const e=document.documentElement;return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find document.documentElement"):h()),e},Oi=()=>{const e=Si();return Ni({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},cd=()=>{const e=Ci(),t=Oi(),n=e.y,r=e.x,o=Si(),i=o.clientWidth,a=o.clientHeight,l=r+i,u=n+a;return{frame:He({top:n,left:r,right:l,bottom:u}),scroll:{initial:e,current:e,max:t,diff:{value:De,displacement:De}}}},dd=({critical:e,scrollOptions:t,registry:n})=>{sn();const r=cd(),o=r.scroll.current,i=e.droppable,a=n.droppable.getAllByType(i.type).map(f=>f.callbacks.getDimensionAndWatchScroll(o,t)),l=n.draggable.getAllByType(e.draggable.type).map(f=>f.getDimension(o)),u={draggables:ni(l),droppables:ti(a)};return ln(),{dimensions:u,critical:e,viewport:r}};function go(e,t,n){return n.descriptor.id===t.id||n.descriptor.type!==t.type?!1:e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual"?(process.env.NODE_ENV!=="production"&&ie(`
57
+ `);return}t=!0,e(i),clearTimeout(r)};return o.wasCalled=()=>t,o},qc=()=>{const e=[],t=o=>{const i=e.findIndex(l=>l.timerId===o);i===-1&&(process.env.NODE_ENV!=="production"?h(!1,"Could not find timer"):h());const[a]=e.splice(i,1);a.callback()};return{add:o=>{const i=setTimeout(()=>t(i)),a={timerId:i,callback:o};e.push(a)},flush:()=>{if(!e.length)return;const o=[...e];e.length=0,o.forEach(i=>{clearTimeout(i.timerId),i.callback()})}}};const Kc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.droppableId===t.droppableId&&e.index===t.index,Yc=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.draggableId===t.draggableId&&e.droppableId===t.droppableId,Jc=(e,t)=>{if(e===t)return!0;const n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r},Mt=(e,t)=>{sn(),t(),ln()},mn=(e,t)=>({draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t});function zn(e,t,n,r){if(!e){n(r(t));return}const o=jc(n);e(t,{announce:o}),o.wasCalled()||n(r(t))}var Xc=(e,t)=>{const n=qc();let r=null;const o=(p,d)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeCapture as a drag start has already been published"):h()),Mt("onBeforeCapture",()=>{const m=e().onBeforeCapture;m&&m({draggableId:p,mode:d})})},i=(p,d)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeDragStart as a drag start has already been published"):h()),Mt("onBeforeDragStart",()=>{const m=e().onBeforeDragStart;m&&m(mn(p,d))})},a=(p,d)=>{r&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onBeforeDragStart as a drag start has already been published"):h());const m=mn(p,d);r={mode:d,lastCritical:p,lastLocation:m.source,lastCombine:null},n.add(()=>{Mt("onDragStart",()=>zn(e().onDragStart,m,t,bn.onDragStart))})},l=(p,d)=>{const m=gr(d),g=$n(d);r||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onDragMove when onDragStart has not been called"):h());const y=!Jc(p,r.lastCritical);y&&(r.lastCritical=p);const x=!Kc(r.lastLocation,m);x&&(r.lastLocation=m);const D=!Yc(r.lastCombine,g);if(D&&(r.lastCombine=g),!y&&!x&&!D)return;const E={...mn(p,r.mode),combine:g,destination:m};n.add(()=>{Mt("onDragUpdate",()=>zn(e().onDragUpdate,E,t,bn.onDragUpdate))})},u=()=>{r||(process.env.NODE_ENV!=="production"?h(!1,"Can only flush responders while dragging"):h()),n.flush()},c=p=>{r||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fire onDragEnd when there is no matching onDragStart"):h()),r=null,Mt("onDragEnd",()=>zn(e().onDragEnd,p,t,bn.onDragEnd))};return{beforeCapture:o,beforeStart:i,start:a,update:l,flush:u,drop:c,abort:()=>{if(!r)return;const p={...mn(r.lastCritical,r.mode),combine:null,destination:null,reason:"CANCEL"};c(p)}}},Zc=(e,t)=>{const n=Xc(e,t);return r=>o=>i=>{if(J(i,"BEFORE_INITIAL_CAPTURE")){n.beforeCapture(i.payload.draggableId,i.payload.movementMode);return}if(J(i,"INITIAL_PUBLISH")){const l=i.payload.critical;n.beforeStart(l,i.payload.movementMode),o(i),n.start(l,i.payload.movementMode);return}if(J(i,"DROP_COMPLETE")){const l=i.payload.completed.result;n.flush(),o(i),n.drop(l);return}if(o(i),J(i,"FLUSH")){n.abort();return}const a=r.getState();a.phase==="DRAGGING"&&n.update(a.critical,a.impact)}};const Qc=e=>t=>n=>{if(!J(n,"DROP_ANIMATION_FINISHED")){t(n);return}const r=e.getState();r.phase!=="DROP_ANIMATING"&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot finish a drop animating when no drop is occurring"):h()),e.dispatch(wr({completed:r.completed}))},ed=e=>{let t=null,n=null;function r(){n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)}return o=>i=>{if((J(i,"FLUSH")||J(i,"DROP_COMPLETE")||J(i,"DROP_ANIMATION_FINISHED"))&&r(),o(i),!J(i,"DROP_ANIMATE"))return;const a={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){e.getState().phase==="DROP_ANIMATING"&&e.dispatch(Ei())}};n=requestAnimationFrame(()=>{n=null,t=Me(window,[a])})}};var td=e=>()=>t=>n=>{(J(n,"DROP_COMPLETE")||J(n,"FLUSH")||J(n,"DROP_ANIMATE"))&&e.stopPublishing(),t(n)},nd=e=>{let t=!1;return()=>n=>r=>{if(J(r,"INITIAL_PUBLISH")){t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),e.tryRestoreFocusRecorded();return}if(n(r),!!t){if(J(r,"FLUSH")){t=!1,e.tryRestoreFocusRecorded();return}if(J(r,"DROP_COMPLETE")){t=!1;const o=r.payload.completed.result;o.combine&&e.tryShiftRecord(o.draggableId,o.combine.draggableId),e.tryRestoreFocusRecorded()}}}};const rd=e=>J(e,"DROP_COMPLETE")||J(e,"DROP_ANIMATE")||J(e,"FLUSH");var od=e=>t=>n=>r=>{if(rd(r)){e.stop(),n(r);return}if(J(r,"INITIAL_PUBLISH")){n(r);const o=t.getState();o.phase!=="DRAGGING"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected phase to be DRAGGING after INITIAL_PUBLISH"):h()),e.start(o);return}n(r),e.scroll(t.getState())};const id=e=>t=>n=>{if(t(n),!J(n,"PUBLISH_WHILE_DRAGGING"))return;const r=e.getState();r.phase==="DROP_PENDING"&&(r.isWaiting||e.dispatch(Di({reason:r.reason})))},ad=process.env.NODE_ENV!=="production"&&typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({name:"@hello-pangea/dnd"}):Pa;var sd=({dimensionMarshal:e,focusMarshal:t,styleMarshal:n,getResponders:r,announce:o,autoScroller:i})=>Oa(hc,ad(Aa(kc(n),td(e),Bc(e),Gc,Qc,ed,id,od(i),Uc,nd(t),Zc(r,o))));const Hn=()=>({additions:{},removals:{},modified:{}});function ld({registry:e,callbacks:t}){let n=Hn(),r=null;const o=()=>{r||(t.collectionStarting(),r=requestAnimationFrame(()=>{r=null,sn();const{additions:u,removals:c,modified:f}=n,p=Object.keys(u).map(g=>e.draggable.getById(g).getDimension(De)).sort((g,y)=>g.descriptor.index-y.descriptor.index),d=Object.keys(f).map(g=>{const x=e.droppable.getById(g).callbacks.getScrollWhileDragging();return{droppableId:g,scroll:x}}),m={additions:p,removals:Object.keys(c),modified:d};n=Hn(),ln(),t.publish(m)}))};return{add:u=>{const c=u.descriptor.id;n.additions[c]=u,n.modified[u.descriptor.droppableId]=!0,n.removals[c]&&delete n.removals[c],o()},remove:u=>{const c=u.descriptor;n.removals[c.id]=!0,n.modified[c.droppableId]=!0,n.additions[c.id]&&delete n.additions[c.id],o()},stop:()=>{r&&(cancelAnimationFrame(r),r=null,n=Hn())}}}var Ni=({scrollHeight:e,scrollWidth:t,height:n,width:r})=>{const o=_e({x:t,y:e},{x:r,y:n});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},Si=()=>{const e=document.documentElement;return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find document.documentElement"):h()),e},Oi=()=>{const e=Si();return Ni({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},cd=()=>{const e=Ci(),t=Oi(),n=e.y,r=e.x,o=Si(),i=o.clientWidth,a=o.clientHeight,l=r+i,u=n+a;return{frame:He({top:n,left:r,right:l,bottom:u}),scroll:{initial:e,current:e,max:t,diff:{value:De,displacement:De}}}},dd=({critical:e,scrollOptions:t,registry:n})=>{sn();const r=cd(),o=r.scroll.current,i=e.droppable,a=n.droppable.getAllByType(i.type).map(f=>f.callbacks.getDimensionAndWatchScroll(o,t)),l=n.draggable.getAllByType(e.draggable.type).map(f=>f.getDimension(o)),u={draggables:ni(l),droppables:ti(a)};return ln(),{dimensions:u,critical:e,viewport:r}};function go(e,t,n){return n.descriptor.id===t.id||n.descriptor.type!==t.type?!1:e.droppable.getById(n.descriptor.droppableId).descriptor.mode!=="virtual"?(process.env.NODE_ENV!=="production"&&ie(`
58
58
  You are attempting to add or remove a Draggable [id: ${n.descriptor.id}]
59
59
  while a drag is occurring. This is only supported for virtual lists.
60
60
 
@@ -63,14 +63,14 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
63
63
  Detected distance range of 0 in the fluid auto scroller
64
64
  This is unexpected and would cause a divide by 0 issue.
65
65
  Not allowing an auto scroll
66
- `),0):(n-e)/r},Cr=1,bd=(e,t,n=()=>Zt)=>{const r=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return r.maxPixelScroll;if(e===t.startScrollingFrom)return Cr;const i=1-Ai({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),a=r.maxPixelScroll*r.ease(i);return Math.ceil(a)},yd=(e,t,n)=>{const r=n(),o=r.durationDampening.accelerateAt,i=r.durationDampening.stopDampeningAt,a=t,l=i,c=Date.now()-a;if(c>=i)return e;if(c<o)return Cr;const f=Ai({startOfRange:o,endOfRange:l,current:c}),p=e*r.ease(f);return Math.ceil(p)},bo=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:o})=>{const i=bd(e,t,o);return i===0?0:r?Math.max(yd(i,n,o),Cr):i},yo=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=gd(e,r,i);return t[r.end]<t[r.start]?bo({distanceToEdge:t[r.end],thresholds:a,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i}):-1*bo({distanceToEdge:t[r.start],thresholds:a,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i})},vd=({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,o=t.width>e.width;return!o&&!r?n:o&&r?null:{x:o?0:n.x,y:r?0:n.y}};const xd=ei(e=>e===0?0:e);var Ri=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},l=yo({container:t,distanceToEdges:a,dragStartTime:e,axis:br,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),u=yo({container:t,distanceToEdges:a,dragStartTime:e,axis:ii,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),c=xd({x:u,y:l});if(ht(c,De))return null;const f=vd({container:t,subject:n,proposedScroll:c});return f?ht(f,De)?null:f:null};const Dd=ei(e=>e===0?0:e>0?1:-1),Nr=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:r})=>{const o=we(t,r),i={x:e(o.x,n.x),y:e(o.y,n.y)};return ht(i,De)?null:i}})(),$i=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},o=Dd(n),i=Nr({max:r,current:t,change:o});return!i||o.x!==0&&i.x===0||o.y!==0&&i.y===0},Sr=(e,t)=>$i({current:e.scroll.current,max:e.scroll.max,change:t}),Ed=(e,t)=>{if(!Sr(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return Nr({current:r,max:n,change:t})},Or=(e,t)=>{const n=e.frame;return n?$i({current:n.scroll.current,max:n.scroll.max,change:t}):!1},wd=(e,t)=>{const n=e.frame;return!n||!Or(e,t)?null:Nr({current:n.scroll.current,max:n.scroll.max,change:t})};var Id=({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=Ri({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return a&&Sr(e,a)?a:null},Cd=({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=e.frame;if(!a)return null;const l=Ri({dragStartTime:r,container:a.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return l&&Or(e,l)?l:null},vo=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:o,getAutoScrollerOptions:i})=>{const a=e.current.page.borderBoxCenter,u=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const p=e.viewport,d=Id({dragStartTime:t,viewport:p,subject:u,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(d){r(d);return}}const c=hd({center:a,destination:Fe(e.impact),droppables:e.dimensions.droppables});if(!c)return;const f=Cd({dragStartTime:t,droppable:c,subject:u,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:i});f&&o(c.descriptor.id,f)},Nd=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>Zt})=>{const r=jt(e),o=jt(t);let i=null;const a=c=>{i||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fluid scroll if not dragging"):h());const{shouldUseTimeDampening:f,dragStartTime:p}=i;vo({state:c,scrollWindow:r,scrollDroppable:o,dragStartTime:p,shouldUseTimeDampening:f,getAutoScrollerOptions:n})};return{start:c=>{sn(),i&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start auto scrolling when already started"):h());const f=Date.now();let p=!1;const d=()=>{p=!0};vo({state:c,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:d,scrollDroppable:d,getAutoScrollerOptions:n}),i={dragStartTime:f,shouldUseTimeDampening:p},ln(),p&&a(c)},stop:()=>{i&&(r.cancel(),o.cancel(),i=null)},scroll:a}},Sd=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(l,u)=>{const c=we(l.current.client.selection,u);e({client:c})},o=(l,u)=>{if(!Or(l,u))return u;const c=wd(l,u);if(!c)return t(l.descriptor.id,u),null;const f=_e(u,c);return t(l.descriptor.id,f),_e(u,f)},i=(l,u,c)=>{if(!l||!Sr(u,c))return c;const f=Ed(u,c);if(!f)return n(c),null;const p=_e(c,f);return n(p),_e(c,p)};return l=>{const u=l.scrollJumpRequest;if(!u)return;const c=Fe(l.impact);c||(process.env.NODE_ENV!=="production"?h(!1,"Cannot perform a jump scroll when there is no destination"):h());const f=o(l.dimensions.droppables[c],u);if(!f)return;const p=l.viewport,d=i(l.isWindowScrollAllowed,p,f);d&&r(l,d)}},Od=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:r})=>{const o=Nd({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:r}),i=Sd({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:u=>{if(!(r().disabled||u.phase!=="DRAGGING")){if(u.movementMode==="FLUID"){o.scroll(u);return}u.scrollJumpRequest&&i(u)}},start:o.start,stop:o.stop}};const Pt="data-rfd",At=(()=>{const e=`${Pt}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),or=(()=>{const e=`${Pt}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),Pd=(()=>{const e=`${Pt}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),xo={contextId:`${Pt}-scroll-container-context-id`},Ad=e=>t=>`[${t}="${e}"]`,Gt=(e,t)=>e.map(n=>{const r=n.styles[t];return r?`${n.selector} { ${r} }`:""}).join(" "),Rd="pointer-events: none;";var $d=e=>{const t=Ad(e),n=(()=>{const l=`
66
+ `),0):(n-e)/r},Cr=1,bd=(e,t,n=()=>Zt)=>{const r=n();if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return r.maxPixelScroll;if(e===t.startScrollingFrom)return Cr;const i=1-Ai({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),a=r.maxPixelScroll*r.ease(i);return Math.ceil(a)},yd=(e,t,n)=>{const r=n(),o=r.durationDampening.accelerateAt,i=r.durationDampening.stopDampeningAt,a=t,l=i,c=Date.now()-a;if(c>=i)return e;if(c<o)return Cr;const f=Ai({startOfRange:o,endOfRange:l,current:c}),p=e*r.ease(f);return Math.ceil(p)},bo=({distanceToEdge:e,thresholds:t,dragStartTime:n,shouldUseTimeDampening:r,getAutoScrollerOptions:o})=>{const i=bd(e,t,o);return i===0?0:r?Math.max(yd(i,n,o),Cr):i},yo=({container:e,distanceToEdges:t,dragStartTime:n,axis:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=gd(e,r,i);return t[r.end]<t[r.start]?bo({distanceToEdge:t[r.end],thresholds:a,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i}):-1*bo({distanceToEdge:t[r.start],thresholds:a,dragStartTime:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i})},vd=({container:e,subject:t,proposedScroll:n})=>{const r=t.height>e.height,o=t.width>e.width;return!o&&!r?n:o&&r?null:{x:o?0:n.x,y:r?0:n.y}};const xd=ei(e=>e===0?0:e);var $i=({dragStartTime:e,container:t,subject:n,center:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a={top:r.y-t.top,right:t.right-r.x,bottom:t.bottom-r.y,left:r.x-t.left},l=yo({container:t,distanceToEdges:a,dragStartTime:e,axis:br,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),u=yo({container:t,distanceToEdges:a,dragStartTime:e,axis:ii,shouldUseTimeDampening:o,getAutoScrollerOptions:i}),c=xd({x:u,y:l});if(ht(c,De))return null;const f=vd({container:t,subject:n,proposedScroll:c});return f?ht(f,De)?null:f:null};const Dd=ei(e=>e===0?0:e>0?1:-1),Nr=(()=>{const e=(t,n)=>t<0?t:t>n?t-n:0;return({current:t,max:n,change:r})=>{const o=we(t,r),i={x:e(o.x,n.x),y:e(o.y,n.y)};return ht(i,De)?null:i}})(),Ri=({max:e,current:t,change:n})=>{const r={x:Math.max(t.x,e.x),y:Math.max(t.y,e.y)},o=Dd(n),i=Nr({max:r,current:t,change:o});return!i||o.x!==0&&i.x===0||o.y!==0&&i.y===0},Sr=(e,t)=>Ri({current:e.scroll.current,max:e.scroll.max,change:t}),Ed=(e,t)=>{if(!Sr(e,t))return null;const n=e.scroll.max,r=e.scroll.current;return Nr({current:r,max:n,change:t})},Or=(e,t)=>{const n=e.frame;return n?Ri({current:n.scroll.current,max:n.scroll.max,change:t}):!1},wd=(e,t)=>{const n=e.frame;return!n||!Or(e,t)?null:Nr({current:n.scroll.current,max:n.scroll.max,change:t})};var Id=({viewport:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=$i({dragStartTime:r,container:e.frame,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return a&&Sr(e,a)?a:null},Cd=({droppable:e,subject:t,center:n,dragStartTime:r,shouldUseTimeDampening:o,getAutoScrollerOptions:i})=>{const a=e.frame;if(!a)return null;const l=$i({dragStartTime:r,container:a.pageMarginBox,subject:t,center:n,shouldUseTimeDampening:o,getAutoScrollerOptions:i});return l&&Or(e,l)?l:null},vo=({state:e,dragStartTime:t,shouldUseTimeDampening:n,scrollWindow:r,scrollDroppable:o,getAutoScrollerOptions:i})=>{const a=e.current.page.borderBoxCenter,u=e.dimensions.draggables[e.critical.draggable.id].page.marginBox;if(e.isWindowScrollAllowed){const p=e.viewport,d=Id({dragStartTime:t,viewport:p,subject:u,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:i});if(d){r(d);return}}const c=hd({center:a,destination:Fe(e.impact),droppables:e.dimensions.droppables});if(!c)return;const f=Cd({dragStartTime:t,droppable:c,subject:u,center:a,shouldUseTimeDampening:n,getAutoScrollerOptions:i});f&&o(c.descriptor.id,f)},Nd=({scrollWindow:e,scrollDroppable:t,getAutoScrollerOptions:n=()=>Zt})=>{const r=jt(e),o=jt(t);let i=null;const a=c=>{i||(process.env.NODE_ENV!=="production"?h(!1,"Cannot fluid scroll if not dragging"):h());const{shouldUseTimeDampening:f,dragStartTime:p}=i;vo({state:c,scrollWindow:r,scrollDroppable:o,dragStartTime:p,shouldUseTimeDampening:f,getAutoScrollerOptions:n})};return{start:c=>{sn(),i&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot start auto scrolling when already started"):h());const f=Date.now();let p=!1;const d=()=>{p=!0};vo({state:c,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:d,scrollDroppable:d,getAutoScrollerOptions:n}),i={dragStartTime:f,shouldUseTimeDampening:p},ln(),p&&a(c)},stop:()=>{i&&(r.cancel(),o.cancel(),i=null)},scroll:a}},Sd=({move:e,scrollDroppable:t,scrollWindow:n})=>{const r=(l,u)=>{const c=we(l.current.client.selection,u);e({client:c})},o=(l,u)=>{if(!Or(l,u))return u;const c=wd(l,u);if(!c)return t(l.descriptor.id,u),null;const f=_e(u,c);return t(l.descriptor.id,f),_e(u,f)},i=(l,u,c)=>{if(!l||!Sr(u,c))return c;const f=Ed(u,c);if(!f)return n(c),null;const p=_e(c,f);return n(p),_e(c,p)};return l=>{const u=l.scrollJumpRequest;if(!u)return;const c=Fe(l.impact);c||(process.env.NODE_ENV!=="production"?h(!1,"Cannot perform a jump scroll when there is no destination"):h());const f=o(l.dimensions.droppables[c],u);if(!f)return;const p=l.viewport,d=i(l.isWindowScrollAllowed,p,f);d&&r(l,d)}},Od=({scrollDroppable:e,scrollWindow:t,move:n,getAutoScrollerOptions:r})=>{const o=Nd({scrollWindow:t,scrollDroppable:e,getAutoScrollerOptions:r}),i=Sd({move:n,scrollWindow:t,scrollDroppable:e});return{scroll:u=>{if(!(r().disabled||u.phase!=="DRAGGING")){if(u.movementMode==="FLUID"){o.scroll(u);return}u.scrollJumpRequest&&i(u)}},start:o.start,stop:o.stop}};const Pt="data-rfd",At=(()=>{const e=`${Pt}-drag-handle`;return{base:e,draggableId:`${e}-draggable-id`,contextId:`${e}-context-id`}})(),or=(()=>{const e=`${Pt}-draggable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),Pd=(()=>{const e=`${Pt}-droppable`;return{base:e,contextId:`${e}-context-id`,id:`${e}-id`}})(),xo={contextId:`${Pt}-scroll-container-context-id`},Ad=e=>t=>`[${t}="${e}"]`,Gt=(e,t)=>e.map(n=>{const r=n.styles[t];return r?`${n.selector} { ${r} }`:""}).join(" "),$d="pointer-events: none;";var Rd=e=>{const t=Ad(e),n=(()=>{const l=`
67
67
  cursor: -webkit-grab;
68
68
  cursor: grab;
69
69
  `;return{selector:t(At.contextId),styles:{always:`
70
70
  -webkit-touch-callout: none;
71
71
  -webkit-tap-highlight-color: rgba(0,0,0,0);
72
72
  touch-action: manipulation;
73
- `,resting:l,dragging:Rd,dropAnimating:l}}})(),r=(()=>{const l=`
73
+ `,resting:l,dragging:$d,dropAnimating:l}}})(),r=(()=>{const l=`
74
74
  transition: ${Ut.outOfTheWay};
75
75
  `;return{selector:t(or.contextId),styles:{dragging:l,dropAnimating:l,userCancel:l}}})(),o={selector:t(Pd.contextId),styles:{always:"overflow-anchor: none;"}},a=[r,n,o,{selector:"body",styles:{dragging:`
76
76
  cursor: grabbing;
@@ -80,7 +80,7 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
80
80
  -moz-user-select: none;
81
81
  -ms-user-select: none;
82
82
  overflow-anchor: none;
83
- `}}];return{always:Gt(a,"always"),resting:Gt(a,"resting"),dragging:Gt(a,"dragging"),dropAnimating:Gt(a,"dropAnimating"),userCancel:Gt(a,"userCancel")}};const Le=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?fa:Ne,Un=()=>{const e=document.querySelector("head");return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find the head to append a style to"):h()),e},Do=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function Td(e,t){const n=z(()=>$d(e),[e]),r=W(null),o=W(null),i=S(xe(p=>{const d=o.current;d||(process.env.NODE_ENV!=="production"?h(!1,"Cannot set dynamic style element if it is not set"):h()),d.textContent=p}),[]),a=S(p=>{const d=r.current;d||(process.env.NODE_ENV!=="production"?h(!1,"Cannot set dynamic style element if it is not set"):h()),d.textContent=p},[]);Le(()=>{!r.current&&!o.current||(process.env.NODE_ENV!=="production"?h(!1,"style elements already mounted"):h());const p=Do(t),d=Do(t);return r.current=p,o.current=d,p.setAttribute(`${Pt}-always`,e),d.setAttribute(`${Pt}-dynamic`,e),Un().appendChild(p),Un().appendChild(d),a(n.always),i(n.resting),()=>{const m=g=>{const y=g.current;y||(process.env.NODE_ENV!=="production"?h(!1,"Cannot unmount ref as it is not set"):h()),Un().removeChild(y),g.current=null};m(r),m(o)}},[t,a,i,n.always,n.resting,e]);const l=S(()=>i(n.dragging),[i,n.dragging]),u=S(p=>{if(p==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=S(()=>{o.current&&i(n.resting)},[i,n.resting]);return z(()=>({dragging:l,dropping:u,resting:c}),[l,u,c])}function Ti(e,t){return Array.from(e.querySelectorAll(t))}var Bi=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function cn(e){return e instanceof Bi(e).HTMLElement}function ki(e,t){const n=`[${At.contextId}="${e}"]`,r=Ti(document,n);if(!r.length)return process.env.NODE_ENV!=="production"&&ie(`Unable to find any drag handles in the context "${e}"`),null;const o=r.find(i=>i.getAttribute(At.draggableId)===t);return o?cn(o)?o:(process.env.NODE_ENV!=="production"&&ie("drag handle needs to be a HTMLElement"),null):(process.env.NODE_ENV!=="production"&&ie(`Unable to find drag handle with id "${t}" as no handle with a matching id was found`),null)}function Bd(e){const t=W({}),n=W(null),r=W(null),o=W(!1),i=S(function(d,m){const g={id:d,focus:m};return t.current[d]=g,function(){const x=t.current;x[d]!==g&&delete x[d]}},[]),a=S(function(d){const m=ki(e,d);m&&m!==document.activeElement&&m.focus()},[e]),l=S(function(d,m){n.current===d&&(n.current=m)},[]),u=S(function(){r.current||o.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const d=n.current;d&&a(d)}))},[a]),c=S(function(d){n.current=null;const m=document.activeElement;m&&m.getAttribute(At.draggableId)===d&&(n.current=d)},[]);return Le(()=>(o.current=!0,function(){o.current=!1;const d=r.current;d&&cancelAnimationFrame(d)}),[]),z(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:u,tryShiftRecord:l}),[i,c,u,l])}function kd(){const e={draggables:{},droppables:{}},t=[];function n(p){return t.push(p),function(){const m=t.indexOf(p);m!==-1&&t.splice(m,1)}}function r(p){t.length&&t.forEach(d=>d(p))}function o(p){return e.draggables[p]||null}function i(p){const d=o(p);return d||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find draggable entry with id [${p}]`):h()),d}const a={register:p=>{e.draggables[p.descriptor.id]=p,r({type:"ADDITION",value:p})},update:(p,d)=>{const m=e.draggables[d.descriptor.id];m&&m.uniqueId===p.uniqueId&&(delete e.draggables[d.descriptor.id],e.draggables[p.descriptor.id]=p)},unregister:p=>{const d=p.descriptor.id,m=o(d);m&&p.uniqueId===m.uniqueId&&(delete e.draggables[d],e.droppables[p.descriptor.droppableId]&&r({type:"REMOVAL",value:p}))},getById:i,findById:o,exists:p=>!!o(p),getAllByType:p=>Object.values(e.draggables).filter(d=>d.descriptor.type===p)};function l(p){return e.droppables[p]||null}function u(p){const d=l(p);return d||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find droppable entry with id [${p}]`):h()),d}const c={register:p=>{e.droppables[p.descriptor.id]=p},unregister:p=>{const d=l(p.descriptor.id);d&&p.uniqueId===d.uniqueId&&delete e.droppables[p.descriptor.id]},getById:u,findById:l,exists:p=>!!l(p),getAllByType:p=>Object.values(e.droppables).filter(d=>d.descriptor.type===p)};function f(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:c,subscribe:n,clean:f}}function _d(){const e=z(kd,[]);return Ne(()=>function(){e.clean()},[e]),e}var Pr=oe.createContext(null),Qt=()=>{const e=document.body;return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find document.body"):h()),e};const Fd={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Ld=e=>`rfd-announcement-${e}`;function Vd(e){const t=z(()=>Ld(e),[e]),n=W(null);return Ne(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Go(i.style,Fd),Qt().appendChild(i),function(){setTimeout(function(){const u=Qt();u.contains(i)&&u.removeChild(i),i===n.current&&(n.current=null)})}},[t]),S(o=>{const i=n.current;if(i){i.textContent=o;return}process.env.NODE_ENV!=="production"&&ie(`
83
+ `}}];return{always:Gt(a,"always"),resting:Gt(a,"resting"),dragging:Gt(a,"dragging"),dropAnimating:Gt(a,"dropAnimating"),userCancel:Gt(a,"userCancel")}};const Le=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?fa:Ne,Un=()=>{const e=document.querySelector("head");return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find the head to append a style to"):h()),e},Do=e=>{const t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};function Td(e,t){const n=z(()=>Rd(e),[e]),r=W(null),o=W(null),i=S(xe(p=>{const d=o.current;d||(process.env.NODE_ENV!=="production"?h(!1,"Cannot set dynamic style element if it is not set"):h()),d.textContent=p}),[]),a=S(p=>{const d=r.current;d||(process.env.NODE_ENV!=="production"?h(!1,"Cannot set dynamic style element if it is not set"):h()),d.textContent=p},[]);Le(()=>{!r.current&&!o.current||(process.env.NODE_ENV!=="production"?h(!1,"style elements already mounted"):h());const p=Do(t),d=Do(t);return r.current=p,o.current=d,p.setAttribute(`${Pt}-always`,e),d.setAttribute(`${Pt}-dynamic`,e),Un().appendChild(p),Un().appendChild(d),a(n.always),i(n.resting),()=>{const m=g=>{const y=g.current;y||(process.env.NODE_ENV!=="production"?h(!1,"Cannot unmount ref as it is not set"):h()),Un().removeChild(y),g.current=null};m(r),m(o)}},[t,a,i,n.always,n.resting,e]);const l=S(()=>i(n.dragging),[i,n.dragging]),u=S(p=>{if(p==="DROP"){i(n.dropAnimating);return}i(n.userCancel)},[i,n.dropAnimating,n.userCancel]),c=S(()=>{o.current&&i(n.resting)},[i,n.resting]);return z(()=>({dragging:l,dropping:u,resting:c}),[l,u,c])}function Ti(e,t){return Array.from(e.querySelectorAll(t))}var Bi=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView?e.ownerDocument.defaultView:window;function cn(e){return e instanceof Bi(e).HTMLElement}function ki(e,t){const n=`[${At.contextId}="${e}"]`,r=Ti(document,n);if(!r.length)return process.env.NODE_ENV!=="production"&&ie(`Unable to find any drag handles in the context "${e}"`),null;const o=r.find(i=>i.getAttribute(At.draggableId)===t);return o?cn(o)?o:(process.env.NODE_ENV!=="production"&&ie("drag handle needs to be a HTMLElement"),null):(process.env.NODE_ENV!=="production"&&ie(`Unable to find drag handle with id "${t}" as no handle with a matching id was found`),null)}function Bd(e){const t=W({}),n=W(null),r=W(null),o=W(!1),i=S(function(d,m){const g={id:d,focus:m};return t.current[d]=g,function(){const x=t.current;x[d]!==g&&delete x[d]}},[]),a=S(function(d){const m=ki(e,d);m&&m!==document.activeElement&&m.focus()},[e]),l=S(function(d,m){n.current===d&&(n.current=m)},[]),u=S(function(){r.current||o.current&&(r.current=requestAnimationFrame(()=>{r.current=null;const d=n.current;d&&a(d)}))},[a]),c=S(function(d){n.current=null;const m=document.activeElement;m&&m.getAttribute(At.draggableId)===d&&(n.current=d)},[]);return Le(()=>(o.current=!0,function(){o.current=!1;const d=r.current;d&&cancelAnimationFrame(d)}),[]),z(()=>({register:i,tryRecordFocus:c,tryRestoreFocusRecorded:u,tryShiftRecord:l}),[i,c,u,l])}function kd(){const e={draggables:{},droppables:{}},t=[];function n(p){return t.push(p),function(){const m=t.indexOf(p);m!==-1&&t.splice(m,1)}}function r(p){t.length&&t.forEach(d=>d(p))}function o(p){return e.draggables[p]||null}function i(p){const d=o(p);return d||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find draggable entry with id [${p}]`):h()),d}const a={register:p=>{e.draggables[p.descriptor.id]=p,r({type:"ADDITION",value:p})},update:(p,d)=>{const m=e.draggables[d.descriptor.id];m&&m.uniqueId===p.uniqueId&&(delete e.draggables[d.descriptor.id],e.draggables[p.descriptor.id]=p)},unregister:p=>{const d=p.descriptor.id,m=o(d);m&&p.uniqueId===m.uniqueId&&(delete e.draggables[d],e.droppables[p.descriptor.droppableId]&&r({type:"REMOVAL",value:p}))},getById:i,findById:o,exists:p=>!!o(p),getAllByType:p=>Object.values(e.draggables).filter(d=>d.descriptor.type===p)};function l(p){return e.droppables[p]||null}function u(p){const d=l(p);return d||(process.env.NODE_ENV!=="production"?h(!1,`Cannot find droppable entry with id [${p}]`):h()),d}const c={register:p=>{e.droppables[p.descriptor.id]=p},unregister:p=>{const d=l(p.descriptor.id);d&&p.uniqueId===d.uniqueId&&delete e.droppables[p.descriptor.id]},getById:u,findById:l,exists:p=>!!l(p),getAllByType:p=>Object.values(e.droppables).filter(d=>d.descriptor.type===p)};function f(){e.draggables={},e.droppables={},t.length=0}return{draggable:a,droppable:c,subscribe:n,clean:f}}function _d(){const e=z(kd,[]);return Ne(()=>function(){e.clean()},[e]),e}var Pr=oe.createContext(null),Qt=()=>{const e=document.body;return e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot find document.body"):h()),e};const Fd={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},Ld=e=>`rfd-announcement-${e}`;function Vd(e){const t=z(()=>Ld(e),[e]),n=W(null);return Ne(function(){const i=document.createElement("div");return n.current=i,i.id=t,i.setAttribute("aria-live","assertive"),i.setAttribute("aria-atomic","true"),Go(i.style,Fd),Qt().appendChild(i),function(){setTimeout(function(){const u=Qt();u.contains(i)&&u.removeChild(i),i===n.current&&(n.current=null)})}},[t]),S(o=>{const i=n.current;if(i){i.textContent=o;return}process.env.NODE_ENV!=="production"&&ie(`
84
84
  A screen reader message was trying to be announced but it was unable to do so.
85
85
  This can occur if you unmount your <DragDropContext /> in your onDragEnd.
86
86
  Consider calling provided.announce() before the unmount so that the instruction will
@@ -112,11 +112,11 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
112
112
  A html5 doctype does not have a publicId
113
113
 
114
114
  ${jn}
115
- `)};function Rr(e){process.env.NODE_ENV!=="production"&&e()}function dn(e,t){Rr(()=>{Ne(()=>{try{e()}catch(n){Qn(`
115
+ `)};function $r(e){process.env.NODE_ENV!=="production"&&e()}function dn(e,t){$r(()=>{Ne(()=>{try{e()}catch(n){Qn(`
116
116
  A setup problem was encountered.
117
117
 
118
118
  > ${n.message}
119
- `)}},t)})}function Kd(){dn(()=>{jd(zd.react,oe.version),qd(document)},[])}function $r(e){const t=W(e);return Ne(()=>{t.current=e}),t}function Yd(){let e=null;function t(){return!!e}function n(a){return a===e}function r(a){e&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot claim lock as it is already claimed"):h());const l={abandon:a};return e=l,l}function o(){e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot release lock when there is no lock"):h()),e=null}function i(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:n,claim:r,release:o,tryAbandon:i}}function en(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const Jd=9,Xd=13,Tr=27,_i=32,Zd=33,Qd=34,eu=35,tu=36,nu=37,ru=38,ou=39,iu=40,au={[Xd]:!0,[Jd]:!0};var Fi=e=>{au[e.keyCode]&&e.preventDefault()};const kn=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),Li=0,wo=5;function su(e,t){return Math.abs(t.x-e.x)>=wo||Math.abs(t.y-e.y)>=wo}const Io={type:"IDLE"};function lu({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:o=>{const{button:i,clientX:a,clientY:l}=o;if(i!==Li)return;const u={x:a,y:l},c=n();if(c.type==="DRAGGING"){o.preventDefault(),c.actions.move(u);return}c.type!=="PENDING"&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot be IDLE"):h());const f=c.point;if(!su(f,u))return;o.preventDefault();const p=c.actions.fluidLift(u);r({type:"DRAGGING",actions:p})}},{eventName:"mouseup",fn:o=>{const i=n();if(i.type!=="DRAGGING"){e();return}o.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{n().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(n().type==="PENDING"){e();return}if(o.keyCode===Tr){o.preventDefault(),e();return}Fi(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const i=n();if(i.type==="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Unexpected phase"):h()),i.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:kn,fn:e}]}function cu(e){const t=W(Io),n=W(mt),r=z(()=>({eventName:"mousedown",fn:function(p){if(p.defaultPrevented||p.button!==Li||p.ctrlKey||p.metaKey||p.shiftKey||p.altKey)return;const d=e.findClosestDraggableId(p);if(!d)return;const m=e.tryGetLock(d,a,{sourceEvent:p});if(!m)return;p.preventDefault();const g={x:p.clientX,y:p.clientY};n.current(),c(m,g)}}),[e]),o=z(()=>({eventName:"webkitmouseforcewillbegin",fn:f=>{if(f.defaultPrevented)return;const p=e.findClosestDraggableId(f);if(!p)return;const d=e.findOptionsForDraggable(p);d&&(d.shouldRespectForcePress||e.canGetLock(p)&&f.preventDefault())}}),[e]),i=S(function(){const p={passive:!1,capture:!0};n.current=Me(window,[o,r],p)},[o,r]),a=S(()=>{t.current.type!=="IDLE"&&(t.current=Io,n.current(),i())},[i]),l=S(()=>{const f=t.current;a(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[a]),u=S(function(){const p={capture:!0,passive:!1},d=lu({cancel:l,completed:a,getPhase:()=>t.current,setPhase:m=>{t.current=m}});n.current=Me(window,d,p)},[l,a]),c=S(function(p,d){t.current.type!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected to move from IDLE to PENDING drag"):h()),t.current={type:"PENDING",point:d,actions:p},u()},[u]);Le(function(){return i(),function(){n.current()}},[i])}function du(){}const uu={[Qd]:!0,[Zd]:!0,[tu]:!0,[eu]:!0};function pu(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===Tr){o.preventDefault(),n();return}if(o.keyCode===_i){o.preventDefault(),r();return}if(o.keyCode===iu){o.preventDefault(),e.moveDown();return}if(o.keyCode===ru){o.preventDefault(),e.moveUp();return}if(o.keyCode===ou){o.preventDefault(),e.moveRight();return}if(o.keyCode===nu){o.preventDefault(),e.moveLeft();return}if(uu[o.keyCode]){o.preventDefault();return}Fi(o)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:kn,fn:n}]}function fu(e){const t=W(du),n=z(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==_i)return;const a=e.findClosestDraggableId(i);if(!a)return;const l=e.tryGetLock(a,f,{sourceEvent:i});if(!l)return;i.preventDefault();let u=!0;const c=l.snapLift();t.current();function f(){u||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop capturing a keyboard drag when not capturing"):h()),u=!1,t.current(),r()}t.current=Me(window,pu(c,f),{capture:!0,passive:!1})}}),[e]),r=S(function(){const i={passive:!1,capture:!0};t.current=Me(window,[n],i)},[n]);Le(function(){return r(),function(){t.current()}},[r])}const qn={type:"IDLE"},mu=120,hu=.15;function gu({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===Tr&&n.preventDefault(),e()}},{eventName:kn,fn:e}]}function bu({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:i,clientY:a}=r.touches[0],l={x:i,y:a};r.preventDefault(),o.actions.move(l)}},{eventName:"touchend",fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}r.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const o=n();o.type==="IDLE"&&(process.env.NODE_ENV,h());const i=r.touches[0];if(!i||!(i.force>=hu))return;const l=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){l&&e();return}if(l){if(o.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:kn,fn:e}]}function yu(e){const t=W(qn),n=W(mt),r=S(function(){return t.current},[]),o=S(function(m){t.current=m},[]),i=z(()=>({eventName:"touchstart",fn:function(m){if(m.defaultPrevented)return;const g=e.findClosestDraggableId(m);if(!g)return;const y=e.tryGetLock(g,l,{sourceEvent:m});if(!y)return;const x=m.touches[0],{clientX:D,clientY:E}=x,P={x:D,y:E};n.current(),p(y,P)}}),[e]),a=S(function(){const m={capture:!0,passive:!1};n.current=Me(window,[i],m)},[i]),l=S(()=>{const d=t.current;d.type!=="IDLE"&&(d.type==="PENDING"&&clearTimeout(d.longPressTimerId),o(qn),n.current(),a())},[a,o]),u=S(()=>{const d=t.current;l(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[l]),c=S(function(){const m={capture:!0,passive:!1},g={cancel:u,completed:l,getPhase:r},y=Me(window,bu(g),m),x=Me(window,gu(g),m);n.current=function(){y(),x()}},[u,r,l]),f=S(function(){const m=r();m.type!=="PENDING"&&(process.env.NODE_ENV!=="production"?h(!1,`Cannot start dragging from phase ${m.type}`):h());const g=m.actions.fluidLift(m.point);o({type:"DRAGGING",actions:g,hasMoved:!1})},[r,o]),p=S(function(m,g){r().type!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected to move from IDLE to PENDING drag"):h());const y=setTimeout(f,mu);o({type:"PENDING",point:g,actions:m,longPressTimerId:y}),c()},[c,r,o,f]);Le(function(){return a(),function(){n.current();const g=r();g.type==="PENDING"&&(clearTimeout(g.longPressTimerId),o(qn))}},[r,a,o]),Le(function(){return Me(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function vu(e){Rr(()=>{const t=$r(e);dn(()=>{t.current.length!==e.length&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot change the amount of sensor hooks after mounting"):h(!1))})})}const xu=["input","button","textarea","select","option","optgroup","video","audio"];function Vi(e,t){if(t==null)return!1;if(xu.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:Vi(e,t.parentElement)}function Du(e,t){const n=t.target;return cn(n)?Vi(e,n):!1}var Eu=e=>He(e.getBoundingClientRect()).center;function wu(e){return e instanceof Bi(e).Element}const Iu=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function Mi(e,t){return e==null?null:e[Iu](t)?e:Mi(e.parentElement,t)}function Cu(e,t){return e.closest?e.closest(t):Mi(e,t)}function Nu(e){return`[${At.contextId}="${e}"]`}function Su(e,t){const n=t.target;if(!wu(n))return process.env.NODE_ENV!=="production"&&ie("event.target must be a Element"),null;const r=Nu(e),o=Cu(n,r);return o?cn(o)?o:(process.env.NODE_ENV!=="production"&&ie("drag handle must be a HTMLElement"),null):null}function Ou(e,t){const n=Su(e,t);return n?n.getAttribute(At.draggableId):null}function Pu(e,t){const n=`[${or.contextId}="${e}"]`,o=Ti(document,n).find(i=>i.getAttribute(or.id)===t);return o?cn(o)?o:(process.env.NODE_ENV!=="production"&&ie("Draggable element is not a HTMLElement"),null):null}function Au(e){e.preventDefault()}function hn({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return n()?e!==t?(r&&process.env.NODE_ENV!=="production"&&ie(`
119
+ `)}},t)})}function Kd(){dn(()=>{jd(zd.react,oe.version),qd(document)},[])}function Rr(e){const t=W(e);return Ne(()=>{t.current=e}),t}function Yd(){let e=null;function t(){return!!e}function n(a){return a===e}function r(a){e&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot claim lock as it is already claimed"):h());const l={abandon:a};return e=l,l}function o(){e||(process.env.NODE_ENV!=="production"?h(!1,"Cannot release lock when there is no lock"):h()),e=null}function i(){e&&(e.abandon(),o())}return{isClaimed:t,isActive:n,claim:r,release:o,tryAbandon:i}}function en(e){return e.phase==="IDLE"||e.phase==="DROP_ANIMATING"?!1:e.isDragging}const Jd=9,Xd=13,Tr=27,_i=32,Zd=33,Qd=34,eu=35,tu=36,nu=37,ru=38,ou=39,iu=40,au={[Xd]:!0,[Jd]:!0};var Fi=e=>{au[e.keyCode]&&e.preventDefault()};const kn=(()=>{const e="visibilitychange";return typeof document>"u"?e:[e,`ms${e}`,`webkit${e}`,`moz${e}`,`o${e}`].find(r=>`on${r}`in document)||e})(),Li=0,wo=5;function su(e,t){return Math.abs(t.x-e.x)>=wo||Math.abs(t.y-e.y)>=wo}const Io={type:"IDLE"};function lu({cancel:e,completed:t,getPhase:n,setPhase:r}){return[{eventName:"mousemove",fn:o=>{const{button:i,clientX:a,clientY:l}=o;if(i!==Li)return;const u={x:a,y:l},c=n();if(c.type==="DRAGGING"){o.preventDefault(),c.actions.move(u);return}c.type!=="PENDING"&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot be IDLE"):h());const f=c.point;if(!su(f,u))return;o.preventDefault();const p=c.actions.fluidLift(u);r({type:"DRAGGING",actions:p})}},{eventName:"mouseup",fn:o=>{const i=n();if(i.type!=="DRAGGING"){e();return}o.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"mousedown",fn:o=>{n().type==="DRAGGING"&&o.preventDefault(),e()}},{eventName:"keydown",fn:o=>{if(n().type==="PENDING"){e();return}if(o.keyCode===Tr){o.preventDefault(),e();return}Fi(o)}},{eventName:"resize",fn:e},{eventName:"scroll",options:{passive:!0,capture:!1},fn:()=>{n().type==="PENDING"&&e()}},{eventName:"webkitmouseforcedown",fn:o=>{const i=n();if(i.type==="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Unexpected phase"):h()),i.actions.shouldRespectForcePress()){e();return}o.preventDefault()}},{eventName:kn,fn:e}]}function cu(e){const t=W(Io),n=W(mt),r=z(()=>({eventName:"mousedown",fn:function(p){if(p.defaultPrevented||p.button!==Li||p.ctrlKey||p.metaKey||p.shiftKey||p.altKey)return;const d=e.findClosestDraggableId(p);if(!d)return;const m=e.tryGetLock(d,a,{sourceEvent:p});if(!m)return;p.preventDefault();const g={x:p.clientX,y:p.clientY};n.current(),c(m,g)}}),[e]),o=z(()=>({eventName:"webkitmouseforcewillbegin",fn:f=>{if(f.defaultPrevented)return;const p=e.findClosestDraggableId(f);if(!p)return;const d=e.findOptionsForDraggable(p);d&&(d.shouldRespectForcePress||e.canGetLock(p)&&f.preventDefault())}}),[e]),i=S(function(){const p={passive:!1,capture:!0};n.current=Me(window,[o,r],p)},[o,r]),a=S(()=>{t.current.type!=="IDLE"&&(t.current=Io,n.current(),i())},[i]),l=S(()=>{const f=t.current;a(),f.type==="DRAGGING"&&f.actions.cancel({shouldBlockNextClick:!0}),f.type==="PENDING"&&f.actions.abort()},[a]),u=S(function(){const p={capture:!0,passive:!1},d=lu({cancel:l,completed:a,getPhase:()=>t.current,setPhase:m=>{t.current=m}});n.current=Me(window,d,p)},[l,a]),c=S(function(p,d){t.current.type!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected to move from IDLE to PENDING drag"):h()),t.current={type:"PENDING",point:d,actions:p},u()},[u]);Le(function(){return i(),function(){n.current()}},[i])}function du(){}const uu={[Qd]:!0,[Zd]:!0,[tu]:!0,[eu]:!0};function pu(e,t){function n(){t(),e.cancel()}function r(){t(),e.drop()}return[{eventName:"keydown",fn:o=>{if(o.keyCode===Tr){o.preventDefault(),n();return}if(o.keyCode===_i){o.preventDefault(),r();return}if(o.keyCode===iu){o.preventDefault(),e.moveDown();return}if(o.keyCode===ru){o.preventDefault(),e.moveUp();return}if(o.keyCode===ou){o.preventDefault(),e.moveRight();return}if(o.keyCode===nu){o.preventDefault(),e.moveLeft();return}if(uu[o.keyCode]){o.preventDefault();return}Fi(o)}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:kn,fn:n}]}function fu(e){const t=W(du),n=z(()=>({eventName:"keydown",fn:function(i){if(i.defaultPrevented||i.keyCode!==_i)return;const a=e.findClosestDraggableId(i);if(!a)return;const l=e.tryGetLock(a,f,{sourceEvent:i});if(!l)return;i.preventDefault();let u=!0;const c=l.snapLift();t.current();function f(){u||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop capturing a keyboard drag when not capturing"):h()),u=!1,t.current(),r()}t.current=Me(window,pu(c,f),{capture:!0,passive:!1})}}),[e]),r=S(function(){const i={passive:!1,capture:!0};t.current=Me(window,[n],i)},[n]);Le(function(){return r(),function(){t.current()}},[r])}const qn={type:"IDLE"},mu=120,hu=.15;function gu({cancel:e,getPhase:t}){return[{eventName:"orientationchange",fn:e},{eventName:"resize",fn:e},{eventName:"contextmenu",fn:n=>{n.preventDefault()}},{eventName:"keydown",fn:n=>{if(t().type!=="DRAGGING"){e();return}n.keyCode===Tr&&n.preventDefault(),e()}},{eventName:kn,fn:e}]}function bu({cancel:e,completed:t,getPhase:n}){return[{eventName:"touchmove",options:{capture:!1},fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}o.hasMoved=!0;const{clientX:i,clientY:a}=r.touches[0],l={x:i,y:a};r.preventDefault(),o.actions.move(l)}},{eventName:"touchend",fn:r=>{const o=n();if(o.type!=="DRAGGING"){e();return}r.preventDefault(),o.actions.drop({shouldBlockNextClick:!0}),t()}},{eventName:"touchcancel",fn:r=>{if(n().type!=="DRAGGING"){e();return}r.preventDefault(),e()}},{eventName:"touchforcechange",fn:r=>{const o=n();o.type==="IDLE"&&(process.env.NODE_ENV,h());const i=r.touches[0];if(!i||!(i.force>=hu))return;const l=o.actions.shouldRespectForcePress();if(o.type==="PENDING"){l&&e();return}if(l){if(o.hasMoved){r.preventDefault();return}e();return}r.preventDefault()}},{eventName:kn,fn:e}]}function yu(e){const t=W(qn),n=W(mt),r=S(function(){return t.current},[]),o=S(function(m){t.current=m},[]),i=z(()=>({eventName:"touchstart",fn:function(m){if(m.defaultPrevented)return;const g=e.findClosestDraggableId(m);if(!g)return;const y=e.tryGetLock(g,l,{sourceEvent:m});if(!y)return;const x=m.touches[0],{clientX:D,clientY:E}=x,P={x:D,y:E};n.current(),p(y,P)}}),[e]),a=S(function(){const m={capture:!0,passive:!1};n.current=Me(window,[i],m)},[i]),l=S(()=>{const d=t.current;d.type!=="IDLE"&&(d.type==="PENDING"&&clearTimeout(d.longPressTimerId),o(qn),n.current(),a())},[a,o]),u=S(()=>{const d=t.current;l(),d.type==="DRAGGING"&&d.actions.cancel({shouldBlockNextClick:!0}),d.type==="PENDING"&&d.actions.abort()},[l]),c=S(function(){const m={capture:!0,passive:!1},g={cancel:u,completed:l,getPhase:r},y=Me(window,bu(g),m),x=Me(window,gu(g),m);n.current=function(){y(),x()}},[u,r,l]),f=S(function(){const m=r();m.type!=="PENDING"&&(process.env.NODE_ENV!=="production"?h(!1,`Cannot start dragging from phase ${m.type}`):h());const g=m.actions.fluidLift(m.point);o({type:"DRAGGING",actions:g,hasMoved:!1})},[r,o]),p=S(function(m,g){r().type!=="IDLE"&&(process.env.NODE_ENV!=="production"?h(!1,"Expected to move from IDLE to PENDING drag"):h());const y=setTimeout(f,mu);o({type:"PENDING",point:g,actions:m,longPressTimerId:y}),c()},[c,r,o,f]);Le(function(){return a(),function(){n.current();const g=r();g.type==="PENDING"&&(clearTimeout(g.longPressTimerId),o(qn))}},[r,a,o]),Le(function(){return Me(window,[{eventName:"touchmove",fn:()=>{},options:{capture:!1,passive:!1}}])},[])}function vu(e){$r(()=>{const t=Rr(e);dn(()=>{t.current.length!==e.length&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot change the amount of sensor hooks after mounting"):h(!1))})})}const xu=["input","button","textarea","select","option","optgroup","video","audio"];function Vi(e,t){if(t==null)return!1;if(xu.includes(t.tagName.toLowerCase()))return!0;const r=t.getAttribute("contenteditable");return r==="true"||r===""?!0:t===e?!1:Vi(e,t.parentElement)}function Du(e,t){const n=t.target;return cn(n)?Vi(e,n):!1}var Eu=e=>He(e.getBoundingClientRect()).center;function wu(e){return e instanceof Bi(e).Element}const Iu=(()=>{const e="matches";return typeof document>"u"?e:[e,"msMatchesSelector","webkitMatchesSelector"].find(r=>r in Element.prototype)||e})();function Mi(e,t){return e==null?null:e[Iu](t)?e:Mi(e.parentElement,t)}function Cu(e,t){return e.closest?e.closest(t):Mi(e,t)}function Nu(e){return`[${At.contextId}="${e}"]`}function Su(e,t){const n=t.target;if(!wu(n))return process.env.NODE_ENV!=="production"&&ie("event.target must be a Element"),null;const r=Nu(e),o=Cu(n,r);return o?cn(o)?o:(process.env.NODE_ENV!=="production"&&ie("drag handle must be a HTMLElement"),null):null}function Ou(e,t){const n=Su(e,t);return n?n.getAttribute(At.draggableId):null}function Pu(e,t){const n=`[${or.contextId}="${e}"]`,o=Ti(document,n).find(i=>i.getAttribute(or.id)===t);return o?cn(o)?o:(process.env.NODE_ENV!=="production"&&ie("Draggable element is not a HTMLElement"),null):null}function Au(e){e.preventDefault()}function hn({expected:e,phase:t,isLockActive:n,shouldWarn:r}){return n()?e!==t?(r&&process.env.NODE_ENV!=="production"&&ie(`
120
120
  Cannot perform action.
121
121
  The actions you used belong to an outdated phase
122
122
 
@@ -134,13 +134,13 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
134
134
 
135
135
  - Throw away your action handlers when forceStop() is called
136
136
  - Check actions.isActive() if you really need to
137
- `),!1)}function Gi({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return o?!(!o.options.isEnabled||!Pi(t.getState(),r)):(process.env.NODE_ENV!=="production"&&ie(`Unable to find draggable with id: ${r}`),!1)}function Ru({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:a}){if(!Gi({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const u=r.draggable.getById(o),c=Pu(t,u.descriptor.id);if(!c)return process.env.NODE_ENV!=="production"&&ie(`Unable to find draggable element with id: ${o}`),null;if(a&&!u.options.canDragInteractiveElements&&Du(c,a))return null;const f=e.claim(i||mt);let p="PRE_DRAG";function d(){return u.options.shouldRespectForcePress}function m(){return e.isActive(f)}function g($,A){hn({expected:$,phase:p,isLockActive:m,shouldWarn:!0})&&n.dispatch(A())}const y=g.bind(null,"DRAGGING");function x($){function A(){e.release(),p="COMPLETED"}p!=="PRE_DRAG"&&(A(),process.env.NODE_ENV!=="production"?h(!1,`Cannot lift in phase ${p}`):h()),n.dispatch(bc($.liftActionArgs)),p="DRAGGING";function q(Q,ge={shouldBlockNextClick:!1}){if($.cleanup(),ge.shouldBlockNextClick){const de=Me(window,[{eventName:"click",fn:Au,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(de)}A(),n.dispatch(Di({reason:Q}))}return{isActive:()=>hn({expected:"DRAGGING",phase:p,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:d,drop:Q=>q("DROP",Q),cancel:Q=>q("CANCEL",Q),...$.actions}}function D($){const A=jt(Q=>{y(()=>xi({client:Q}))});return{...x({liftActionArgs:{id:o,clientSelection:$,movementMode:"FLUID"},cleanup:()=>A.cancel(),actions:{move:A}}),move:A}}function E(){const $={moveUp:()=>y(Nc),moveRight:()=>y(Oc),moveDown:()=>y(Sc),moveLeft:()=>y(Pc)};return x({liftActionArgs:{id:o,clientSelection:Eu(c),movementMode:"SNAP"},cleanup:mt,actions:$})}function P(){hn({expected:"PRE_DRAG",phase:p,isLockActive:m,shouldWarn:!0})&&e.release()}return{isActive:()=>hn({expected:"PRE_DRAG",phase:p,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:d,fluidLift:D,snapLift:E,abort:P}}const $u=[cu,fu,yu];function Tu({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:o}){const i=[...o?$u:[],...r||[]],a=pe(()=>Yd())[0],l=S(function(x,D){en(x)&&!en(D)&&a.tryAbandon()},[a]);Le(function(){let x=t.getState();return t.subscribe(()=>{const E=t.getState();l(x,E),x=E})},[a,t,l]),Le(()=>a.tryAbandon,[a.tryAbandon]);const u=S(y=>Gi({lockAPI:a,registry:n,store:t,draggableId:y}),[a,n,t]),c=S((y,x,D)=>Ru({lockAPI:a,registry:n,contextId:e,store:t,draggableId:y,forceSensorStop:x||null,sourceEvent:D&&D.sourceEvent?D.sourceEvent:null}),[e,a,n,t]),f=S(y=>Ou(e,y),[e]),p=S(y=>{const x=n.draggable.findById(y);return x?x.options:null},[n.draggable]),d=S(function(){a.isClaimed()&&(a.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(Er()))},[a,t]),m=S(()=>a.isClaimed(),[a]),g=z(()=>({canGetLock:u,tryGetLock:c,findClosestDraggableId:f,findOptionsForDraggable:p,tryReleaseLock:d,isLockClaimed:m}),[u,c,f,p,d,m]);vu(i);for(let y=0;y<i.length;y++)i[y](g)}const Bu=e=>({onBeforeCapture:t=>{Vo(()=>{e.onBeforeCapture&&e.onBeforeCapture(t)})},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),ku=e=>({...Zt,...e.autoScrollerOptions,durationDampening:{...Zt.durationDampening,...e.autoScrollerOptions}});function Wt(e){return e.current||(process.env.NODE_ENV!=="production"?h(!1,"Could not find store from lazy ref"):h()),e.current}function _u(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:o,dragHandleUsageInstructions:i}=e,a=W(null);Kd();const l=$r(e),u=S(()=>Bu(l.current),[l]),c=S(()=>ku(l.current),[l]),f=Vd(t),p=Wd({contextId:t,text:i}),d=Td(t,o),m=S(de=>{Wt(a).dispatch(de)},[]),g=z(()=>Xr({publishWhileDragging:vc,updateDroppableScroll:Dc,updateDroppableIsEnabled:Ec,updateDroppableIsCombineEnabled:wc,collectionStarting:xc},m),[m]),y=_d(),x=z(()=>ud(y,g),[y,g]),D=z(()=>Od({scrollWindow:pd,scrollDroppable:x.scrollDroppable,getAutoScrollerOptions:c,...Xr({move:xi},m)}),[x.scrollDroppable,m,c]),E=Bd(t),P=z(()=>sd({announce:f,autoScroller:D,dimensionMarshal:x,focusMarshal:E,getResponders:u,styleMarshal:d}),[f,D,x,E,u,d]);process.env.NODE_ENV!=="production"&&a.current&&a.current!==P&&process.env.NODE_ENV!=="production"&&ie("unexpected store change"),a.current=P;const N=S(()=>{const de=Wt(a);de.getState().phase!=="IDLE"&&de.dispatch(Er())},[]),$=S(()=>{const de=Wt(a).getState();return de.phase==="DROP_ANIMATING"?!0:de.phase==="IDLE"?!1:de.isDragging},[]),A=z(()=>({isDragging:$,tryAbort:N}),[$,N]);n(A);const q=S(de=>Pi(Wt(a).getState(),de),[]),Q=S(()=>xt(Wt(a).getState()),[]),ge=z(()=>({marshal:x,focus:E,contextId:t,canLift:q,isMovementAllowed:Q,dragHandleUsageInstructionsId:p,registry:y}),[t,x,p,E,q,Q,y]);return Tu({contextId:t,store:P,registry:y,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),Ne(()=>N,[N]),oe.createElement(Bn.Provider,{value:ge},oe.createElement(Ra,{context:Pr,store:P},e.children))}function Fu(){return oe.useId()}function Wi(e){const t=Fu(),n=e.dragHandleUsageInstructions||bn.dragHandleUsageInstructions;return oe.createElement(al,null,r=>oe.createElement(_u,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const Co={dragging:5e3,dropAnimating:4500},Lu=(e,t)=>t?Ut.drop(t.duration):e?Ut.snap:Ut.fluid,Vu=(e,t)=>{if(e)return t?Xt.opacity.drop:Xt.opacity.combining},Mu=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function Gu(e){const n=e.dimension.client,{offset:r,combineWith:o,dropping:i}=e,a=!!o,l=Mu(e),u=!!i,c=u?nr.drop(r,a):nr.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:Lu(l,i),transform:c,opacity:Vu(a,u),zIndex:u?Co.dropAnimating:Co.dragging,pointerEvents:"none"}}function Wu(e){return{transform:nr.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function zu(e){return e.type==="DRAGGING"?Gu(e):Wu(e)}function Hu(e,t,n=De){const r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=Ko(o,r),a=xn(i,n),l={client:i,tagName:t.tagName.toLowerCase(),display:r.display},u={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:l,displaceBy:u,client:i,page:a}}function Uu(e){const t=Ar("draggable"),{descriptor:n,registry:r,getDraggableRef:o,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:l}=e,u=z(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:l}),[i,l,a]),c=S(m=>{const g=o();return g||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get dimension when no ref is set"):h()),Hu(n,g,m)},[n,o]),f=z(()=>({uniqueId:t,descriptor:n,options:u,getDimension:c}),[n,c,u,t]),p=W(f),d=W(!0);Le(()=>(r.draggable.register(p.current),()=>r.draggable.unregister(p.current)),[r.draggable]),Le(()=>{if(d.current){d.current=!1;return}const m=p.current;p.current=f,r.draggable.update(f,m)},[f,r.draggable])}var Br=oe.createContext(null);function zi(e){e&&cn(e)||(process.env.NODE_ENV!=="production"?h(!1,`
137
+ `),!1)}function Gi({lockAPI:e,store:t,registry:n,draggableId:r}){if(e.isClaimed())return!1;const o=n.draggable.findById(r);return o?!(!o.options.isEnabled||!Pi(t.getState(),r)):(process.env.NODE_ENV!=="production"&&ie(`Unable to find draggable with id: ${r}`),!1)}function $u({lockAPI:e,contextId:t,store:n,registry:r,draggableId:o,forceSensorStop:i,sourceEvent:a}){if(!Gi({lockAPI:e,store:n,registry:r,draggableId:o}))return null;const u=r.draggable.getById(o),c=Pu(t,u.descriptor.id);if(!c)return process.env.NODE_ENV!=="production"&&ie(`Unable to find draggable element with id: ${o}`),null;if(a&&!u.options.canDragInteractiveElements&&Du(c,a))return null;const f=e.claim(i||mt);let p="PRE_DRAG";function d(){return u.options.shouldRespectForcePress}function m(){return e.isActive(f)}function g(R,A){hn({expected:R,phase:p,isLockActive:m,shouldWarn:!0})&&n.dispatch(A())}const y=g.bind(null,"DRAGGING");function x(R){function A(){e.release(),p="COMPLETED"}p!=="PRE_DRAG"&&(A(),process.env.NODE_ENV!=="production"?h(!1,`Cannot lift in phase ${p}`):h()),n.dispatch(bc(R.liftActionArgs)),p="DRAGGING";function q(Q,ge={shouldBlockNextClick:!1}){if(R.cleanup(),ge.shouldBlockNextClick){const de=Me(window,[{eventName:"click",fn:Au,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(de)}A(),n.dispatch(Di({reason:Q}))}return{isActive:()=>hn({expected:"DRAGGING",phase:p,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:d,drop:Q=>q("DROP",Q),cancel:Q=>q("CANCEL",Q),...R.actions}}function D(R){const A=jt(Q=>{y(()=>xi({client:Q}))});return{...x({liftActionArgs:{id:o,clientSelection:R,movementMode:"FLUID"},cleanup:()=>A.cancel(),actions:{move:A}}),move:A}}function E(){const R={moveUp:()=>y(Nc),moveRight:()=>y(Oc),moveDown:()=>y(Sc),moveLeft:()=>y(Pc)};return x({liftActionArgs:{id:o,clientSelection:Eu(c),movementMode:"SNAP"},cleanup:mt,actions:R})}function P(){hn({expected:"PRE_DRAG",phase:p,isLockActive:m,shouldWarn:!0})&&e.release()}return{isActive:()=>hn({expected:"PRE_DRAG",phase:p,isLockActive:m,shouldWarn:!1}),shouldRespectForcePress:d,fluidLift:D,snapLift:E,abort:P}}const Ru=[cu,fu,yu];function Tu({contextId:e,store:t,registry:n,customSensors:r,enableDefaultSensors:o}){const i=[...o?Ru:[],...r||[]],a=pe(()=>Yd())[0],l=S(function(x,D){en(x)&&!en(D)&&a.tryAbandon()},[a]);Le(function(){let x=t.getState();return t.subscribe(()=>{const E=t.getState();l(x,E),x=E})},[a,t,l]),Le(()=>a.tryAbandon,[a.tryAbandon]);const u=S(y=>Gi({lockAPI:a,registry:n,store:t,draggableId:y}),[a,n,t]),c=S((y,x,D)=>$u({lockAPI:a,registry:n,contextId:e,store:t,draggableId:y,forceSensorStop:x||null,sourceEvent:D&&D.sourceEvent?D.sourceEvent:null}),[e,a,n,t]),f=S(y=>Ou(e,y),[e]),p=S(y=>{const x=n.draggable.findById(y);return x?x.options:null},[n.draggable]),d=S(function(){a.isClaimed()&&(a.tryAbandon(),t.getState().phase!=="IDLE"&&t.dispatch(Er()))},[a,t]),m=S(()=>a.isClaimed(),[a]),g=z(()=>({canGetLock:u,tryGetLock:c,findClosestDraggableId:f,findOptionsForDraggable:p,tryReleaseLock:d,isLockClaimed:m}),[u,c,f,p,d,m]);vu(i);for(let y=0;y<i.length;y++)i[y](g)}const Bu=e=>({onBeforeCapture:t=>{Vo(()=>{e.onBeforeCapture&&e.onBeforeCapture(t)})},onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragEnd:e.onDragEnd,onDragUpdate:e.onDragUpdate}),ku=e=>({...Zt,...e.autoScrollerOptions,durationDampening:{...Zt.durationDampening,...e.autoScrollerOptions}});function Wt(e){return e.current||(process.env.NODE_ENV!=="production"?h(!1,"Could not find store from lazy ref"):h()),e.current}function _u(e){const{contextId:t,setCallbacks:n,sensors:r,nonce:o,dragHandleUsageInstructions:i}=e,a=W(null);Kd();const l=Rr(e),u=S(()=>Bu(l.current),[l]),c=S(()=>ku(l.current),[l]),f=Vd(t),p=Wd({contextId:t,text:i}),d=Td(t,o),m=S(de=>{Wt(a).dispatch(de)},[]),g=z(()=>Xr({publishWhileDragging:vc,updateDroppableScroll:Dc,updateDroppableIsEnabled:Ec,updateDroppableIsCombineEnabled:wc,collectionStarting:xc},m),[m]),y=_d(),x=z(()=>ud(y,g),[y,g]),D=z(()=>Od({scrollWindow:pd,scrollDroppable:x.scrollDroppable,getAutoScrollerOptions:c,...Xr({move:xi},m)}),[x.scrollDroppable,m,c]),E=Bd(t),P=z(()=>sd({announce:f,autoScroller:D,dimensionMarshal:x,focusMarshal:E,getResponders:u,styleMarshal:d}),[f,D,x,E,u,d]);process.env.NODE_ENV!=="production"&&a.current&&a.current!==P&&process.env.NODE_ENV!=="production"&&ie("unexpected store change"),a.current=P;const N=S(()=>{const de=Wt(a);de.getState().phase!=="IDLE"&&de.dispatch(Er())},[]),R=S(()=>{const de=Wt(a).getState();return de.phase==="DROP_ANIMATING"?!0:de.phase==="IDLE"?!1:de.isDragging},[]),A=z(()=>({isDragging:R,tryAbort:N}),[R,N]);n(A);const q=S(de=>Pi(Wt(a).getState(),de),[]),Q=S(()=>xt(Wt(a).getState()),[]),ge=z(()=>({marshal:x,focus:E,contextId:t,canLift:q,isMovementAllowed:Q,dragHandleUsageInstructionsId:p,registry:y}),[t,x,p,E,q,Q,y]);return Tu({contextId:t,store:P,registry:y,customSensors:r||null,enableDefaultSensors:e.enableDefaultSensors!==!1}),Ne(()=>N,[N]),oe.createElement(Bn.Provider,{value:ge},oe.createElement($a,{context:Pr,store:P},e.children))}function Fu(){return oe.useId()}function Wi(e){const t=Fu(),n=e.dragHandleUsageInstructions||bn.dragHandleUsageInstructions;return oe.createElement(al,null,r=>oe.createElement(_u,{nonce:e.nonce,contextId:t,setCallbacks:r,dragHandleUsageInstructions:n,enableDefaultSensors:e.enableDefaultSensors,sensors:e.sensors,onBeforeCapture:e.onBeforeCapture,onBeforeDragStart:e.onBeforeDragStart,onDragStart:e.onDragStart,onDragUpdate:e.onDragUpdate,onDragEnd:e.onDragEnd,autoScrollerOptions:e.autoScrollerOptions},e.children))}const Co={dragging:5e3,dropAnimating:4500},Lu=(e,t)=>t?Ut.drop(t.duration):e?Ut.snap:Ut.fluid,Vu=(e,t)=>{if(e)return t?Xt.opacity.drop:Xt.opacity.combining},Mu=e=>e.forceShouldAnimate!=null?e.forceShouldAnimate:e.mode==="SNAP";function Gu(e){const n=e.dimension.client,{offset:r,combineWith:o,dropping:i}=e,a=!!o,l=Mu(e),u=!!i,c=u?nr.drop(r,a):nr.moveTo(r);return{position:"fixed",top:n.marginBox.top,left:n.marginBox.left,boxSizing:"border-box",width:n.borderBox.width,height:n.borderBox.height,transition:Lu(l,i),transform:c,opacity:Vu(a,u),zIndex:u?Co.dropAnimating:Co.dragging,pointerEvents:"none"}}function Wu(e){return{transform:nr.moveTo(e.offset),transition:e.shouldAnimateDisplacement?void 0:"none"}}function zu(e){return e.type==="DRAGGING"?Gu(e):Wu(e)}function Hu(e,t,n=De){const r=window.getComputedStyle(t),o=t.getBoundingClientRect(),i=Ko(o,r),a=xn(i,n),l={client:i,tagName:t.tagName.toLowerCase(),display:r.display},u={x:i.marginBox.width,y:i.marginBox.height};return{descriptor:e,placeholder:l,displaceBy:u,client:i,page:a}}function Uu(e){const t=Ar("draggable"),{descriptor:n,registry:r,getDraggableRef:o,canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:l}=e,u=z(()=>({canDragInteractiveElements:i,shouldRespectForcePress:a,isEnabled:l}),[i,l,a]),c=S(m=>{const g=o();return g||(process.env.NODE_ENV!=="production"?h(!1,"Cannot get dimension when no ref is set"):h()),Hu(n,g,m)},[n,o]),f=z(()=>({uniqueId:t,descriptor:n,options:u,getDimension:c}),[n,c,u,t]),p=W(f),d=W(!0);Le(()=>(r.draggable.register(p.current),()=>r.draggable.unregister(p.current)),[r.draggable]),Le(()=>{if(d.current){d.current=!1;return}const m=p.current;p.current=f,r.draggable.update(f,m)},[f,r.draggable])}var Br=oe.createContext(null);function zi(e){e&&cn(e)||(process.env.NODE_ENV!=="production"?h(!1,`
138
138
  provided.innerRef has not been provided with a HTMLElement.
139
139
 
140
140
  You can find a guide on using the innerRef callback functions at:
141
141
  https://github.com/hello-pangea/dnd/blob/main/docs/guides/using-inner-ref.md
142
142
  `):h())}function ju(e,t,n){dn(()=>{function r(i){return`Draggable[id: ${i}]: `}const o=e.draggableId;o||(process.env.NODE_ENV!=="production"?h(!1,"Draggable requires a draggableId"):h(!1)),typeof o!="string"&&(process.env.NODE_ENV!=="production"?h(!1,`Draggable requires a [string] draggableId.
143
- Provided: [type: ${typeof o}] (value: ${o})`):h(!1)),Number.isInteger(e.index)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} requires an integer index prop`):h(!1)),e.mapped.type!=="DRAGGING"&&(zi(n()),e.isEnabled&&(ki(t,o)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} Unable to find drag handle`):h(!1))))})}function qu(e){Rr(()=>{const t=W(e);dn(()=>{e!==t.current&&(process.env.NODE_ENV!=="production"?h(!1,"Draggable isClone prop value changed during component life"):h(!1))},[e])})}function wn(e){const t=$o(e);return t||(process.env.NODE_ENV!=="production"?h(!1,"Could not find required context"):h()),t}function Ku(e){e.preventDefault()}const Yu=e=>{const t=W(null),n=S((A=null)=>{t.current=A},[]),r=S(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:i,registry:a}=wn(Bn),{type:l,droppableId:u}=wn(Br),c=z(()=>({id:e.draggableId,index:e.index,type:l,droppableId:u}),[e.draggableId,e.index,l,u]),{children:f,draggableId:p,isEnabled:d,shouldRespectForcePress:m,canDragInteractiveElements:g,isClone:y,mapped:x,dropAnimationFinished:D}=e;if(ju(e,o,r),qu(y),!y){const A=z(()=>({descriptor:c,registry:a,getDraggableRef:r,canDragInteractiveElements:g,shouldRespectForcePress:m,isEnabled:d}),[c,a,r,g,m,d]);Uu(A)}const E=z(()=>d?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":p,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:Ku}:null,[o,i,p,d]),P=S(A=>{x.type==="DRAGGING"&&x.dropping&&A.propertyName==="transform"&&Vo(D)},[D,x]),N=z(()=>{const A=zu(x),q=x.type==="DRAGGING"&&x.dropping?P:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":p,style:A,onTransitionEnd:q},dragHandleProps:E}},[o,E,p,x,P,n]),$=z(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return oe.createElement(oe.Fragment,null,f(N,x.snapshot,$))};var Hi=(e,t)=>e===t,Ui=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const Ju=e=>e.combine?e.combine.draggableId:null,Xu=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function Zu(){const e=xe((o,i)=>({x:o,y:i})),t=xe((o,i,a=null,l=null,u=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!u,dropAnimation:u,mode:o,draggingOver:a,combineWith:l,combineTargetFor:null})),n=xe((o,i,a,l,u=null,c=null,f=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:u,combineWith:c,mode:i,offset:o,dimension:a,forceShouldAnimate:f,snapshot:t(i,l,u,c,null)}}));return(o,i)=>{if(en(o)){if(o.critical.draggable.id!==i.draggableId)return null;const a=o.current.client.offset,l=o.dimensions.draggables[i.draggableId],u=Fe(o.impact),c=Xu(o.impact),f=o.forceShouldAnimate;return n(e(a.x,a.y),o.movementMode,l,i.isClone,u,c,f)}if(o.phase==="DROP_ANIMATING"){const a=o.completed;if(a.result.draggableId!==i.draggableId)return null;const l=i.isClone,u=o.dimensions.draggables[i.draggableId],c=a.result,f=c.mode,p=Ui(c),d=Ju(c),g={duration:o.dropDuration,curve:Ir.drop,moveTo:o.newHomeClientOffset,opacity:d?Xt.opacity.drop:null,scale:d?Xt.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:u,dropping:g,draggingOver:p,combineWith:d,mode:f,forceShouldAnimate:null,snapshot:t(f,l,p,d,g)}}}return null}}function ji(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const Qu={mapped:{type:"SECONDARY",offset:De,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:ji(null)}};function ep(){const e=xe((a,l)=>({x:a,y:l})),t=xe(ji),n=xe((a,l=null,u)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:l,shouldAnimateDisplacement:u,snapshot:t(l)}})),r=a=>a?n(De,a,!0):null,o=(a,l,u,c)=>{const f=u.displaced.visible[a],p=!!(c.inVirtualList&&c.effected[a]),d=Rn(u),m=d&&d.draggableId===a?l:null;if(!f){if(!p)return r(m);if(u.displaced.invisible[a])return null;const x=Bt(c.displacedBy.point),D=e(x.x,x.y);return n(D,m,!0)}if(p)return r(m);const g=u.displacedBy.point,y=e(g.x,g.y);return n(y,m,f.shouldAnimate)};return(a,l)=>{if(en(a))return a.critical.draggable.id===l.draggableId?null:o(l.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){const u=a.completed;return u.result.draggableId===l.draggableId?null:o(l.draggableId,u.result.draggableId,u.impact,u.afterCritical)}return null}}const tp=()=>{const e=Zu(),t=ep();return(r,o)=>e(r,o)||t(r,o)||Qu},np={dropAnimationFinished:Ei},rp=Mo(tp,np,null,{context:Pr,areStatePropsEqual:Hi})(Yu);function qi(e){return wn(Br).isUsingCloneFor===e.draggableId&&!e.isClone?null:oe.createElement(rp,e)}function kr(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return oe.createElement(qi,Go({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const _r=e=>t=>e===t,op=_r("scroll"),ip=_r("auto"),ap=_r("visible"),No=(e,t)=>t(e.overflowX)||t(e.overflowY),sp=(e,t)=>t(e.overflowX)&&t(e.overflowY),Ki=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return No(n,op)||No(n,ip)},lp=()=>{if(process.env.NODE_ENV==="production")return!1;const e=Qt(),t=document.documentElement;if(t||(process.env.NODE_ENV,h()),!Ki(e))return!1;const n=window.getComputedStyle(t),r={overflowX:n.overflowX,overflowY:n.overflowY};return sp(r,ap)||process.env.NODE_ENV!=="production"&&ie(`
143
+ Provided: [type: ${typeof o}] (value: ${o})`):h(!1)),Number.isInteger(e.index)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} requires an integer index prop`):h(!1)),e.mapped.type!=="DRAGGING"&&(zi(n()),e.isEnabled&&(ki(t,o)||(process.env.NODE_ENV!=="production"?h(!1,`${r(o)} Unable to find drag handle`):h(!1))))})}function qu(e){$r(()=>{const t=W(e);dn(()=>{e!==t.current&&(process.env.NODE_ENV!=="production"?h(!1,"Draggable isClone prop value changed during component life"):h(!1))},[e])})}function wn(e){const t=Ro(e);return t||(process.env.NODE_ENV!=="production"?h(!1,"Could not find required context"):h()),t}function Ku(e){e.preventDefault()}const Yu=e=>{const t=W(null),n=S((A=null)=>{t.current=A},[]),r=S(()=>t.current,[]),{contextId:o,dragHandleUsageInstructionsId:i,registry:a}=wn(Bn),{type:l,droppableId:u}=wn(Br),c=z(()=>({id:e.draggableId,index:e.index,type:l,droppableId:u}),[e.draggableId,e.index,l,u]),{children:f,draggableId:p,isEnabled:d,shouldRespectForcePress:m,canDragInteractiveElements:g,isClone:y,mapped:x,dropAnimationFinished:D}=e;if(ju(e,o,r),qu(y),!y){const A=z(()=>({descriptor:c,registry:a,getDraggableRef:r,canDragInteractiveElements:g,shouldRespectForcePress:m,isEnabled:d}),[c,a,r,g,m,d]);Uu(A)}const E=z(()=>d?{tabIndex:0,role:"button","aria-describedby":i,"data-rfd-drag-handle-draggable-id":p,"data-rfd-drag-handle-context-id":o,draggable:!1,onDragStart:Ku}:null,[o,i,p,d]),P=S(A=>{x.type==="DRAGGING"&&x.dropping&&A.propertyName==="transform"&&Vo(D)},[D,x]),N=z(()=>{const A=zu(x),q=x.type==="DRAGGING"&&x.dropping?P:void 0;return{innerRef:n,draggableProps:{"data-rfd-draggable-context-id":o,"data-rfd-draggable-id":p,style:A,onTransitionEnd:q},dragHandleProps:E}},[o,E,p,x,P,n]),R=z(()=>({draggableId:c.id,type:c.type,source:{index:c.index,droppableId:c.droppableId}}),[c.droppableId,c.id,c.index,c.type]);return oe.createElement(oe.Fragment,null,f(N,x.snapshot,R))};var Hi=(e,t)=>e===t,Ui=e=>{const{combine:t,destination:n}=e;return n?n.droppableId:t?t.droppableId:null};const Ju=e=>e.combine?e.combine.draggableId:null,Xu=e=>e.at&&e.at.type==="COMBINE"?e.at.combine.draggableId:null;function Zu(){const e=xe((o,i)=>({x:o,y:i})),t=xe((o,i,a=null,l=null,u=null)=>({isDragging:!0,isClone:i,isDropAnimating:!!u,dropAnimation:u,mode:o,draggingOver:a,combineWith:l,combineTargetFor:null})),n=xe((o,i,a,l,u=null,c=null,f=null)=>({mapped:{type:"DRAGGING",dropping:null,draggingOver:u,combineWith:c,mode:i,offset:o,dimension:a,forceShouldAnimate:f,snapshot:t(i,l,u,c,null)}}));return(o,i)=>{if(en(o)){if(o.critical.draggable.id!==i.draggableId)return null;const a=o.current.client.offset,l=o.dimensions.draggables[i.draggableId],u=Fe(o.impact),c=Xu(o.impact),f=o.forceShouldAnimate;return n(e(a.x,a.y),o.movementMode,l,i.isClone,u,c,f)}if(o.phase==="DROP_ANIMATING"){const a=o.completed;if(a.result.draggableId!==i.draggableId)return null;const l=i.isClone,u=o.dimensions.draggables[i.draggableId],c=a.result,f=c.mode,p=Ui(c),d=Ju(c),g={duration:o.dropDuration,curve:Ir.drop,moveTo:o.newHomeClientOffset,opacity:d?Xt.opacity.drop:null,scale:d?Xt.scale.drop:null};return{mapped:{type:"DRAGGING",offset:o.newHomeClientOffset,dimension:u,dropping:g,draggingOver:p,combineWith:d,mode:f,forceShouldAnimate:null,snapshot:t(f,l,p,d,g)}}}return null}}function ji(e=null){return{isDragging:!1,isDropAnimating:!1,isClone:!1,dropAnimation:null,mode:null,draggingOver:null,combineTargetFor:e,combineWith:null}}const Qu={mapped:{type:"SECONDARY",offset:De,combineTargetFor:null,shouldAnimateDisplacement:!0,snapshot:ji(null)}};function ep(){const e=xe((a,l)=>({x:a,y:l})),t=xe(ji),n=xe((a,l=null,u)=>({mapped:{type:"SECONDARY",offset:a,combineTargetFor:l,shouldAnimateDisplacement:u,snapshot:t(l)}})),r=a=>a?n(De,a,!0):null,o=(a,l,u,c)=>{const f=u.displaced.visible[a],p=!!(c.inVirtualList&&c.effected[a]),d=$n(u),m=d&&d.draggableId===a?l:null;if(!f){if(!p)return r(m);if(u.displaced.invisible[a])return null;const x=Bt(c.displacedBy.point),D=e(x.x,x.y);return n(D,m,!0)}if(p)return r(m);const g=u.displacedBy.point,y=e(g.x,g.y);return n(y,m,f.shouldAnimate)};return(a,l)=>{if(en(a))return a.critical.draggable.id===l.draggableId?null:o(l.draggableId,a.critical.draggable.id,a.impact,a.afterCritical);if(a.phase==="DROP_ANIMATING"){const u=a.completed;return u.result.draggableId===l.draggableId?null:o(l.draggableId,u.result.draggableId,u.impact,u.afterCritical)}return null}}const tp=()=>{const e=Zu(),t=ep();return(r,o)=>e(r,o)||t(r,o)||Qu},np={dropAnimationFinished:Ei},rp=Mo(tp,np,null,{context:Pr,areStatePropsEqual:Hi})(Yu);function qi(e){return wn(Br).isUsingCloneFor===e.draggableId&&!e.isClone?null:oe.createElement(rp,e)}function kr(e){const t=typeof e.isDragDisabled=="boolean"?!e.isDragDisabled:!0,n=!!e.disableInteractiveElementBlocking,r=!!e.shouldRespectForcePress;return oe.createElement(qi,Go({},e,{isClone:!1,isEnabled:t,canDragInteractiveElements:n,shouldRespectForcePress:r}))}const _r=e=>t=>e===t,op=_r("scroll"),ip=_r("auto"),ap=_r("visible"),No=(e,t)=>t(e.overflowX)||t(e.overflowY),sp=(e,t)=>t(e.overflowX)&&t(e.overflowY),Ki=e=>{const t=window.getComputedStyle(e),n={overflowX:t.overflowX,overflowY:t.overflowY};return No(n,op)||No(n,ip)},lp=()=>{if(process.env.NODE_ENV==="production")return!1;const e=Qt(),t=document.documentElement;if(t||(process.env.NODE_ENV,h()),!Ki(e))return!1;const n=window.getComputedStyle(t),r={overflowX:n.overflowX,overflowY:n.overflowY};return sp(r,ap)||process.env.NODE_ENV!=="production"&&ie(`
144
144
  We have detected that your <body> element might be a scroll container.
145
145
  We have found no reliable way of detecting whether the <body> element is a scroll container.
146
146
  Under most circumstances a <body> scroll bar will be on the <html> element (document.documentElement)
@@ -155,13 +155,13 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
155
155
  Nested scroll containers are currently not supported.
156
156
 
157
157
  We hope to support nested scroll containers soon: https://github.com/atlassian/react-beautiful-dnd/issues/131
158
- `)},ir=e=>({x:e.scrollLeft,y:e.scrollTop});const Yi=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Yi(e.parentElement):!1;var dp=e=>{const t=Fr(e),n=Yi(e);return{closestScrollable:t,isFixedOnPage:n}},up=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:o,client:i,page:a,closest:l})=>{const u=(()=>{if(!l)return null;const{scrollSize:d,client:m}=l,g=Ni({scrollHeight:d.scrollHeight,scrollWidth:d.scrollWidth,height:m.paddingBox.height,width:m.paddingBox.width});return{pageMarginBox:l.page.marginBox,frameClient:m,scrollSize:d,shouldClipSubject:l.shouldClipSubject,scroll:{initial:l.scroll,current:l.scroll,max:g,diff:{value:De,displacement:De}}}})(),c=o==="vertical"?br:ii,f=Ot({page:a,withPlaceholder:null,axis:c,frame:u});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:c,isEnabled:t,client:i,page:a,frame:u,subject:f}};const pp=(e,t)=>{const n=Yo(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,u=fr({top:r,right:a,bottom:i,left:o},n.border);return mr({borderBox:u,margin:n.margin,border:n.border,padding:n.padding})};var fp=({ref:e,descriptor:t,env:n,windowScroll:r,direction:o,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:l})=>{const u=n.closestScrollable,c=pp(e,u),f=xn(c,r),p=(()=>{if(!u)return null;const m=Yo(u),g={scrollHeight:u.scrollHeight,scrollWidth:u.scrollWidth};return{client:m,page:xn(m,r),scroll:ir(u),scrollSize:g,shouldClipSubject:l}})();return up({descriptor:t,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:n.isFixedOnPage,direction:o,client:c,page:f,closest:p})};const mp={passive:!1},hp={passive:!0};var So=e=>e.shouldPublishImmediately?mp:hp;const gn=e=>e&&e.env.closestScrollable||null;function gp(e){const t=W(null),n=wn(Bn),r=Ar("droppable"),{registry:o,marshal:i}=n,a=$r(e),l=z(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),u=W(l),c=z(()=>xe((N,$)=>{t.current||(process.env.NODE_ENV!=="production"?h(!1,"Can only update scroll when dragging"):h());const A={x:N,y:$};i.updateDroppableScroll(l.id,A)}),[l.id,i]),f=S(()=>{const N=t.current;return!N||!N.env.closestScrollable?De:ir(N.env.closestScrollable)},[]),p=S(()=>{const N=f();c(N.x,N.y)},[f,c]),d=z(()=>jt(p),[p]),m=S(()=>{const N=t.current,$=gn(N);if(N&&$||(process.env.NODE_ENV!=="production"?h(!1,"Could not find scroll options while scrolling"):h()),N.scrollOptions.shouldPublishImmediately){p();return}d()},[d,p]),g=S((N,$)=>{t.current&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot collect a droppable while a drag is occurring"):h());const A=a.current,q=A.getDroppableRef();q||(process.env.NODE_ENV!=="production"?h(!1,"Cannot collect without a droppable ref"):h());const Q=dp(q),ge={ref:q,descriptor:l,env:Q,scrollOptions:$};t.current=ge;const de=fp({ref:q,descriptor:l,env:Q,windowScroll:N,direction:A.direction,isDropDisabled:A.isDropDisabled,isCombineEnabled:A.isCombineEnabled,shouldClipSubject:!A.ignoreContainerClipping}),w=Q.closestScrollable;return w&&(w.setAttribute(xo.contextId,n.contextId),w.addEventListener("scroll",m,So(ge.scrollOptions)),process.env.NODE_ENV!=="production"&&cp(w)),de},[n.contextId,l,m,a]),y=S(()=>{const N=t.current,$=gn(N);return N&&$||(process.env.NODE_ENV!=="production"?h(!1,"Can only recollect Droppable client for Droppables that have a scroll container"):h()),ir($)},[]),x=S(()=>{const N=t.current;N||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop drag when no active drag"):h());const $=gn(N);t.current=null,$&&(d.cancel(),$.removeAttribute(xo.contextId),$.removeEventListener("scroll",m,So(N.scrollOptions)))},[m,d]),D=S(N=>{const $=t.current;$||(process.env.NODE_ENV!=="production"?h(!1,"Cannot scroll when there is no drag"):h());const A=gn($);A||(process.env.NODE_ENV!=="production"?h(!1,"Cannot scroll a droppable with no closest scrollable"):h()),A.scrollTop+=N.y,A.scrollLeft+=N.x},[]),E=z(()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:y,dragStopped:x,scroll:D}),[x,g,y,D]),P=z(()=>({uniqueId:r,descriptor:l,callbacks:E}),[E,l,r]);Le(()=>(u.current=P.descriptor,o.droppable.register(P),()=>{t.current&&(process.env.NODE_ENV!=="production"&&ie("Unsupported: changing the droppableId or type of a Droppable during a drag"),x()),o.droppable.unregister(P)}),[E,l,x,P,i,o.droppable]),Le(()=>{t.current&&i.updateDroppableIsEnabled(u.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Le(()=>{t.current&&i.updateDroppableIsCombineEnabled(u.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function Kn(){}const Oo={width:0,height:0,margin:fl},bp=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?Oo:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},yp=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=bp({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Ut.placeholder:null}},vp=e=>{const t=W(null),n=S(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:o,onClose:i,contextId:a}=e,[l,u]=pe(e.animate==="open");Ne(()=>l?r!=="open"?(n(),u(!1),Kn):t.current?Kn:(t.current=setTimeout(()=>{t.current=null,u(!1)}),n):Kn,[r,l,n]);const c=S(p=>{p.propertyName==="height"&&(o(),r==="close"&&i())},[r,i,o]),f=yp({isAnimatingOpenOnMount:l,animate:e.animate,placeholder:e.placeholder});return oe.createElement(e.placeholder.tagName,{style:f,"data-rfd-placeholder-context-id":a,onTransitionEnd:c,ref:e.innerRef})};var xp=oe.memo(vp);function Yn(e){return typeof e=="boolean"}function Jn(e,t){t.forEach(n=>n(e))}const Dp=[function({props:t}){t.droppableId||(process.env.NODE_ENV!=="production"?h(!1,"A Droppable requires a droppableId prop"):h()),typeof t.droppableId!="string"&&(process.env.NODE_ENV!=="production"?h(!1,`A Droppable requires a [string] droppableId. Provided: [${typeof t.droppableId}]`):h())},function({props:t}){Yn(t.isDropDisabled)||(process.env.NODE_ENV!=="production"?h(!1,"isDropDisabled must be a boolean"):h()),Yn(t.isCombineEnabled)||(process.env.NODE_ENV!=="production"?h(!1,"isCombineEnabled must be a boolean"):h()),Yn(t.ignoreContainerClipping)||(process.env.NODE_ENV!=="production"?h(!1,"ignoreContainerClipping must be a boolean"):h())},function({getDroppableRef:t}){zi(t())}],Ep=[function({props:t,getPlaceholderRef:n}){!t.placeholder||n()||process.env.NODE_ENV!=="production"&&ie(`
158
+ `)},ir=e=>({x:e.scrollLeft,y:e.scrollTop});const Yi=e=>e?window.getComputedStyle(e).position==="fixed"?!0:Yi(e.parentElement):!1;var dp=e=>{const t=Fr(e),n=Yi(e);return{closestScrollable:t,isFixedOnPage:n}},up=({descriptor:e,isEnabled:t,isCombineEnabled:n,isFixedOnPage:r,direction:o,client:i,page:a,closest:l})=>{const u=(()=>{if(!l)return null;const{scrollSize:d,client:m}=l,g=Ni({scrollHeight:d.scrollHeight,scrollWidth:d.scrollWidth,height:m.paddingBox.height,width:m.paddingBox.width});return{pageMarginBox:l.page.marginBox,frameClient:m,scrollSize:d,shouldClipSubject:l.shouldClipSubject,scroll:{initial:l.scroll,current:l.scroll,max:g,diff:{value:De,displacement:De}}}})(),c=o==="vertical"?br:ii,f=Ot({page:a,withPlaceholder:null,axis:c,frame:u});return{descriptor:e,isCombineEnabled:n,isFixedOnPage:r,axis:c,isEnabled:t,client:i,page:a,frame:u,subject:f}};const pp=(e,t)=>{const n=Yo(e);if(!t||e!==t)return n;const r=n.paddingBox.top-t.scrollTop,o=n.paddingBox.left-t.scrollLeft,i=r+t.scrollHeight,a=o+t.scrollWidth,u=fr({top:r,right:a,bottom:i,left:o},n.border);return mr({borderBox:u,margin:n.margin,border:n.border,padding:n.padding})};var fp=({ref:e,descriptor:t,env:n,windowScroll:r,direction:o,isDropDisabled:i,isCombineEnabled:a,shouldClipSubject:l})=>{const u=n.closestScrollable,c=pp(e,u),f=xn(c,r),p=(()=>{if(!u)return null;const m=Yo(u),g={scrollHeight:u.scrollHeight,scrollWidth:u.scrollWidth};return{client:m,page:xn(m,r),scroll:ir(u),scrollSize:g,shouldClipSubject:l}})();return up({descriptor:t,isEnabled:!i,isCombineEnabled:a,isFixedOnPage:n.isFixedOnPage,direction:o,client:c,page:f,closest:p})};const mp={passive:!1},hp={passive:!0};var So=e=>e.shouldPublishImmediately?mp:hp;const gn=e=>e&&e.env.closestScrollable||null;function gp(e){const t=W(null),n=wn(Bn),r=Ar("droppable"),{registry:o,marshal:i}=n,a=Rr(e),l=z(()=>({id:e.droppableId,type:e.type,mode:e.mode}),[e.droppableId,e.mode,e.type]),u=W(l),c=z(()=>xe((N,R)=>{t.current||(process.env.NODE_ENV!=="production"?h(!1,"Can only update scroll when dragging"):h());const A={x:N,y:R};i.updateDroppableScroll(l.id,A)}),[l.id,i]),f=S(()=>{const N=t.current;return!N||!N.env.closestScrollable?De:ir(N.env.closestScrollable)},[]),p=S(()=>{const N=f();c(N.x,N.y)},[f,c]),d=z(()=>jt(p),[p]),m=S(()=>{const N=t.current,R=gn(N);if(N&&R||(process.env.NODE_ENV!=="production"?h(!1,"Could not find scroll options while scrolling"):h()),N.scrollOptions.shouldPublishImmediately){p();return}d()},[d,p]),g=S((N,R)=>{t.current&&(process.env.NODE_ENV!=="production"?h(!1,"Cannot collect a droppable while a drag is occurring"):h());const A=a.current,q=A.getDroppableRef();q||(process.env.NODE_ENV!=="production"?h(!1,"Cannot collect without a droppable ref"):h());const Q=dp(q),ge={ref:q,descriptor:l,env:Q,scrollOptions:R};t.current=ge;const de=fp({ref:q,descriptor:l,env:Q,windowScroll:N,direction:A.direction,isDropDisabled:A.isDropDisabled,isCombineEnabled:A.isCombineEnabled,shouldClipSubject:!A.ignoreContainerClipping}),w=Q.closestScrollable;return w&&(w.setAttribute(xo.contextId,n.contextId),w.addEventListener("scroll",m,So(ge.scrollOptions)),process.env.NODE_ENV!=="production"&&cp(w)),de},[n.contextId,l,m,a]),y=S(()=>{const N=t.current,R=gn(N);return N&&R||(process.env.NODE_ENV!=="production"?h(!1,"Can only recollect Droppable client for Droppables that have a scroll container"):h()),ir(R)},[]),x=S(()=>{const N=t.current;N||(process.env.NODE_ENV!=="production"?h(!1,"Cannot stop drag when no active drag"):h());const R=gn(N);t.current=null,R&&(d.cancel(),R.removeAttribute(xo.contextId),R.removeEventListener("scroll",m,So(N.scrollOptions)))},[m,d]),D=S(N=>{const R=t.current;R||(process.env.NODE_ENV!=="production"?h(!1,"Cannot scroll when there is no drag"):h());const A=gn(R);A||(process.env.NODE_ENV!=="production"?h(!1,"Cannot scroll a droppable with no closest scrollable"):h()),A.scrollTop+=N.y,A.scrollLeft+=N.x},[]),E=z(()=>({getDimensionAndWatchScroll:g,getScrollWhileDragging:y,dragStopped:x,scroll:D}),[x,g,y,D]),P=z(()=>({uniqueId:r,descriptor:l,callbacks:E}),[E,l,r]);Le(()=>(u.current=P.descriptor,o.droppable.register(P),()=>{t.current&&(process.env.NODE_ENV!=="production"&&ie("Unsupported: changing the droppableId or type of a Droppable during a drag"),x()),o.droppable.unregister(P)}),[E,l,x,P,i,o.droppable]),Le(()=>{t.current&&i.updateDroppableIsEnabled(u.current.id,!e.isDropDisabled)},[e.isDropDisabled,i]),Le(()=>{t.current&&i.updateDroppableIsCombineEnabled(u.current.id,e.isCombineEnabled)},[e.isCombineEnabled,i])}function Kn(){}const Oo={width:0,height:0,margin:fl},bp=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>e||n==="close"?Oo:{height:t.client.borderBox.height,width:t.client.borderBox.width,margin:t.client.margin},yp=({isAnimatingOpenOnMount:e,placeholder:t,animate:n})=>{const r=bp({isAnimatingOpenOnMount:e,placeholder:t,animate:n});return{display:t.display,boxSizing:"border-box",width:r.width,height:r.height,marginTop:r.margin.top,marginRight:r.margin.right,marginBottom:r.margin.bottom,marginLeft:r.margin.left,flexShrink:"0",flexGrow:"0",pointerEvents:"none",transition:n!=="none"?Ut.placeholder:null}},vp=e=>{const t=W(null),n=S(()=>{t.current&&(clearTimeout(t.current),t.current=null)},[]),{animate:r,onTransitionEnd:o,onClose:i,contextId:a}=e,[l,u]=pe(e.animate==="open");Ne(()=>l?r!=="open"?(n(),u(!1),Kn):t.current?Kn:(t.current=setTimeout(()=>{t.current=null,u(!1)}),n):Kn,[r,l,n]);const c=S(p=>{p.propertyName==="height"&&(o(),r==="close"&&i())},[r,i,o]),f=yp({isAnimatingOpenOnMount:l,animate:e.animate,placeholder:e.placeholder});return oe.createElement(e.placeholder.tagName,{style:f,"data-rfd-placeholder-context-id":a,onTransitionEnd:c,ref:e.innerRef})};var xp=oe.memo(vp);function Yn(e){return typeof e=="boolean"}function Jn(e,t){t.forEach(n=>n(e))}const Dp=[function({props:t}){t.droppableId||(process.env.NODE_ENV!=="production"?h(!1,"A Droppable requires a droppableId prop"):h()),typeof t.droppableId!="string"&&(process.env.NODE_ENV!=="production"?h(!1,`A Droppable requires a [string] droppableId. Provided: [${typeof t.droppableId}]`):h())},function({props:t}){Yn(t.isDropDisabled)||(process.env.NODE_ENV!=="production"?h(!1,"isDropDisabled must be a boolean"):h()),Yn(t.isCombineEnabled)||(process.env.NODE_ENV!=="production"?h(!1,"isCombineEnabled must be a boolean"):h()),Yn(t.ignoreContainerClipping)||(process.env.NODE_ENV!=="production"?h(!1,"ignoreContainerClipping must be a boolean"):h())},function({getDroppableRef:t}){zi(t())}],Ep=[function({props:t,getPlaceholderRef:n}){!t.placeholder||n()||process.env.NODE_ENV!=="production"&&ie(`
159
159
  Droppable setup issue [droppableId: "${t.droppableId}"]:
160
160
  DroppableProvided > placeholder could not be found.
161
161
 
162
162
  Please be sure to add the {provided.placeholder} React Node as a child of your Droppable.
163
163
  More information: https://github.com/hello-pangea/dnd/blob/main/docs/api/droppable.md
164
- `)}],wp=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?h(!1,"Must provide a clone render function (renderClone) for virtual lists"):h())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?h(!1,"Expected virtual list to not have a placeholder"):h())}];function Ip(e){dn(()=>{Jn(e,Dp),e.props.mode==="standard"&&Jn(e,Ep),e.props.mode==="virtual"&&Jn(e,wp)})}class Cp extends oe.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const Np=e=>{const t=$o(Bn);t||(process.env.NODE_ENV!=="production"?h(!1,"Could not find app context"):h());const{contextId:n,isMovementAllowed:r}=t,o=W(null),i=W(null),{children:a,droppableId:l,type:u,mode:c,direction:f,ignoreContainerClipping:p,isDropDisabled:d,isCombineEnabled:m,snapshot:g,useClone:y,updateViewportMaxScroll:x,getContainerForClone:D}=e,E=S(()=>o.current,[]),P=S((ee=null)=>{o.current=ee},[]),N=S(()=>i.current,[]),$=S((ee=null)=>{i.current=ee},[]);Ip({props:e,getDroppableRef:E,getPlaceholderRef:N});const A=S(()=>{r()&&x({maxScroll:Oi()})},[r,x]);gp({droppableId:l,type:u,mode:c,direction:f,isDropDisabled:d,isCombineEnabled:m,ignoreContainerClipping:p,getDroppableRef:E});const q=z(()=>oe.createElement(Cp,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:ee,data:Ie,animate:Se})=>oe.createElement(xp,{placeholder:Ie,onClose:ee,innerRef:$,animate:Se,contextId:n,onTransitionEnd:A})),[n,A,e.placeholder,e.shouldAnimatePlaceholder,$]),Q=z(()=>({innerRef:P,placeholder:q,droppableProps:{"data-rfd-droppable-id":l,"data-rfd-droppable-context-id":n}}),[n,l,q,P]),ge=y?y.dragging.draggableId:null,de=z(()=>({droppableId:l,type:u,isUsingCloneFor:ge}),[l,ge,u]);function w(){if(!y)return null;const{dragging:ee,render:Ie}=y,Se=oe.createElement(qi,{draggableId:ee.draggableId,index:ee.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Ct,F)=>Ie(Ct,F,ee));return Sa.createPortal(Se,D())}return oe.createElement(Br.Provider,{value:de},a(Q,g),w())};function Sp(){return document.body||(process.env.NODE_ENV!=="production"?h(!1,"document.body is not ready"):h()),document.body}const Po={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:Sp},Ji=e=>{let t={...e},n;for(n in Po)e[n]===void 0&&(t={...t,[n]:Po[n]});return t},Xn=(e,t)=>e===t.droppable.type,Ao=(e,t)=>t.draggables[e.draggable.id],Op=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=xe(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=xe((i,a,l,u,c,f)=>{const p=c.descriptor.id;if(c.descriptor.droppableId===i){const g=f?{render:f,dragging:n(c.descriptor)}:null,y={isDraggingOver:l,draggingOverWith:l?p:null,draggingFromThisWith:p,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:y,useClone:g}}if(!a)return t;if(!u)return e;const m={isDraggingOver:l,draggingOverWith:p,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:m,useClone:null}});return(i,a)=>{const l=Ji(a),u=l.droppableId,c=l.type,f=!l.isDropDisabled,p=l.renderClone;if(en(i)){const d=i.critical;if(!Xn(c,d))return t;const m=Ao(d,i.dimensions),g=Fe(i.impact)===u;return r(u,f,g,g,m,p)}if(i.phase==="DROP_ANIMATING"){const d=i.completed;if(!Xn(c,d.critical))return t;const m=Ao(d.critical,i.dimensions);return r(u,f,Ui(d.result)===u,Fe(d.impact)===u,m,p)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const d=i.completed;if(!Xn(c,d.critical))return t;const m=Fe(d.impact)===u,g=!!(d.impact.at&&d.impact.at.type==="COMBINE"),y=d.critical.droppable.id===u;return m?g?e:t:y?e:t}return t}},Pp={updateViewportMaxScroll:Cc},In=Mo(Op,Pp,(e,t,n)=>({...Ji(n),...e,...t}),{context:Pr,areStatePropsEqual:Hi})(Np),_n=_.div`
164
+ `)}],wp=[function({props:t}){t.renderClone||(process.env.NODE_ENV!=="production"?h(!1,"Must provide a clone render function (renderClone) for virtual lists"):h())},function({getPlaceholderRef:t}){t()&&(process.env.NODE_ENV!=="production"?h(!1,"Expected virtual list to not have a placeholder"):h())}];function Ip(e){dn(()=>{Jn(e,Dp),e.props.mode==="standard"&&Jn(e,Ep),e.props.mode==="virtual"&&Jn(e,wp)})}class Cp extends oe.PureComponent{constructor(...t){super(...t),this.state={isVisible:!!this.props.on,data:this.props.on,animate:this.props.shouldAnimate&&this.props.on?"open":"none"},this.onClose=()=>{this.state.animate==="close"&&this.setState({isVisible:!1})}}static getDerivedStateFromProps(t,n){return t.shouldAnimate?t.on?{isVisible:!0,data:t.on,animate:"open"}:n.isVisible?{isVisible:!0,data:n.data,animate:"close"}:{isVisible:!1,animate:"close",data:null}:{isVisible:!!t.on,data:t.on,animate:"none"}}render(){if(!this.state.isVisible)return null;const t={onClose:this.onClose,data:this.state.data,animate:this.state.animate};return this.props.children(t)}}const Np=e=>{const t=Ro(Bn);t||(process.env.NODE_ENV!=="production"?h(!1,"Could not find app context"):h());const{contextId:n,isMovementAllowed:r}=t,o=W(null),i=W(null),{children:a,droppableId:l,type:u,mode:c,direction:f,ignoreContainerClipping:p,isDropDisabled:d,isCombineEnabled:m,snapshot:g,useClone:y,updateViewportMaxScroll:x,getContainerForClone:D}=e,E=S(()=>o.current,[]),P=S((ee=null)=>{o.current=ee},[]),N=S(()=>i.current,[]),R=S((ee=null)=>{i.current=ee},[]);Ip({props:e,getDroppableRef:E,getPlaceholderRef:N});const A=S(()=>{r()&&x({maxScroll:Oi()})},[r,x]);gp({droppableId:l,type:u,mode:c,direction:f,isDropDisabled:d,isCombineEnabled:m,ignoreContainerClipping:p,getDroppableRef:E});const q=z(()=>oe.createElement(Cp,{on:e.placeholder,shouldAnimate:e.shouldAnimatePlaceholder},({onClose:ee,data:Ie,animate:Se})=>oe.createElement(xp,{placeholder:Ie,onClose:ee,innerRef:R,animate:Se,contextId:n,onTransitionEnd:A})),[n,A,e.placeholder,e.shouldAnimatePlaceholder,R]),Q=z(()=>({innerRef:P,placeholder:q,droppableProps:{"data-rfd-droppable-id":l,"data-rfd-droppable-context-id":n}}),[n,l,q,P]),ge=y?y.dragging.draggableId:null,de=z(()=>({droppableId:l,type:u,isUsingCloneFor:ge}),[l,ge,u]);function w(){if(!y)return null;const{dragging:ee,render:Ie}=y,Se=oe.createElement(qi,{draggableId:ee.draggableId,index:ee.source.index,isClone:!0,isEnabled:!0,shouldRespectForcePress:!1,canDragInteractiveElements:!0},(Ct,F)=>Ie(Ct,F,ee));return Sa.createPortal(Se,D())}return oe.createElement(Br.Provider,{value:de},a(Q,g),w())};function Sp(){return document.body||(process.env.NODE_ENV!=="production"?h(!1,"document.body is not ready"):h()),document.body}const Po={mode:"standard",type:"DEFAULT",direction:"vertical",isDropDisabled:!1,isCombineEnabled:!1,ignoreContainerClipping:!1,renderClone:null,getContainerForClone:Sp},Ji=e=>{let t={...e},n;for(n in Po)e[n]===void 0&&(t={...t,[n]:Po[n]});return t},Xn=(e,t)=>e===t.droppable.type,Ao=(e,t)=>t.draggables[e.draggable.id],Op=()=>{const e={placeholder:null,shouldAnimatePlaceholder:!0,snapshot:{isDraggingOver:!1,draggingOverWith:null,draggingFromThisWith:null,isUsingPlaceholder:!1},useClone:null},t={...e,shouldAnimatePlaceholder:!1},n=xe(i=>({draggableId:i.id,type:i.type,source:{index:i.index,droppableId:i.droppableId}})),r=xe((i,a,l,u,c,f)=>{const p=c.descriptor.id;if(c.descriptor.droppableId===i){const g=f?{render:f,dragging:n(c.descriptor)}:null,y={isDraggingOver:l,draggingOverWith:l?p:null,draggingFromThisWith:p,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!1,snapshot:y,useClone:g}}if(!a)return t;if(!u)return e;const m={isDraggingOver:l,draggingOverWith:p,draggingFromThisWith:null,isUsingPlaceholder:!0};return{placeholder:c.placeholder,shouldAnimatePlaceholder:!0,snapshot:m,useClone:null}});return(i,a)=>{const l=Ji(a),u=l.droppableId,c=l.type,f=!l.isDropDisabled,p=l.renderClone;if(en(i)){const d=i.critical;if(!Xn(c,d))return t;const m=Ao(d,i.dimensions),g=Fe(i.impact)===u;return r(u,f,g,g,m,p)}if(i.phase==="DROP_ANIMATING"){const d=i.completed;if(!Xn(c,d.critical))return t;const m=Ao(d.critical,i.dimensions);return r(u,f,Ui(d.result)===u,Fe(d.impact)===u,m,p)}if(i.phase==="IDLE"&&i.completed&&!i.shouldFlush){const d=i.completed;if(!Xn(c,d.critical))return t;const m=Fe(d.impact)===u,g=!!(d.impact.at&&d.impact.at.type==="COMBINE"),y=d.critical.droppable.id===u;return m?g?e:t:y?e:t}return t}},Pp={updateViewportMaxScroll:Cc},In=Mo(Op,Pp,(e,t,n)=>({...Ji(n),...e,...t}),{context:Pr,areStatePropsEqual:Hi})(Np),_n=_.div`
165
165
  /* Act as a flexible panel that can live inside grid/flex cells */
166
166
  display: flex;
167
167
  flex-direction: column;
@@ -174,7 +174,7 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
174
174
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
175
175
  background-color: #fff;
176
176
  padding: 1.5rem;
177
- `,Ze=Tt(Fo)(({theme:e,$hasOrigin:t})=>({display:"flex",alignItems:"flex-start",padding:e.spacing(2),marginBottom:e.spacing(1),gap:e.spacing(2),animation:"fadeIn 0.3s ease-in",borderLeft:t?`4px solid ${e.palette.info.main}`:void 0,backgroundColor:t?`${e.palette.info.light}22`:void 0,"@keyframes fadeIn":{from:{opacity:0,transform:"translateY(10px)"},to:{opacity:1,transform:"translateY(0)"}},position:"relative","&:hover .step-actions-overlay":{opacity:1,transform:"translateY(0)"}})),Qe=Tt(H)(({theme:e})=>({fontWeight:"bold",fontSize:"1.2em",color:e.palette.primary.main,minWidth:30})),et=Tt(re)({flexGrow:1}),at=({path:e})=>v(H,{variant:"caption",color:"info.main",sx:{display:"block",fontFamily:"monospace"},children:["from ",e]}),tt=Tt(H)(({statuscolor:e})=>({fontSize:"0.8em",marginTop:4,color:e||"#666",fontWeight:500})),nt=Tt(re)(({theme:e})=>({position:"absolute",top:-16,right:16,backgroundColor:e.palette.background.paper,boxShadow:e.shadows[3],border:`1px solid ${e.palette.divider}`,display:"flex",alignItems:"center",justifyContent:"center",gap:e.spacing(.5),opacity:0,transition:"all 0.2s ease-in-out",zIndex:10,borderRadius:16,padding:"4px 8px",transform:"translateY(5px)","&.visible":{opacity:1,transform:"translateY(0)"}})),Xi=Tt("img")(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:4,boxShadow:e.shadows[2],width:60,height:60,objectFit:"cover"})),Ap=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,children:[s(Qe,{children:t}),v(et,{children:[s(H,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:"📄 File Reference"}),s(H,{fontWeight:"bold",children:e.descriptionText||"Add steps from file"}),v(H,{variant:"body2",children:["Path: ",e.path]}),e.overrides&&Object.keys(e.overrides).length>0&&v(re,{sx:{mt:.5,display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:[s(H,{variant:"caption",color:"text.secondary",children:"Overrides:"}),Object.keys(e.overrides).map(a=>s(V,{size:"small",label:`${a}`},a))]}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),s(re,{sx:{mt:1,display:"flex",gap:1,alignItems:"center"},children:e.optional?s(V,{size:"small",label:"Optional"}):null})]}),v(nt,{className:"step-actions-overlay",children:[r&&s(O,{onClick:r,size:"small","aria-label":"Play",children:s(Ye,{})}),r&&s(O,{onClick:r,size:"small","aria-label":"Play from here",children:s(Je,{})}),o&&s(O,{onClick:o,size:"small","aria-label":"Edit",children:s(Xe,{})}),i&&s(O,{onClick:i,size:"small","aria-label":"Delete",children:s(je,{})})]})]}),Rp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),e.cropBase64&&s(Xi,{src:e.cropBase64,alt:"tap target"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Tap Interaction"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[e.optional?s(V,{size:"small",label:"Optional"}):null,e.useLlmOnly?s(V,{size:"small",label:"LLM Only"}):null,e.elementId?s(V,{size:"small",label:`Element ID: ${e.elementId}`}):null,typeof e.timeout=="number"?s(V,{size:"small",label:`Timeout: ${e.timeout} ms`}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),$p=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),e.cropBase64&&s(Xi,{src:e.cropBase64,alt:"assert target",sx:{border:2,borderColor:"warning.main"}}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Assert Element"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[e.optional?s(V,{size:"small",label:"Optional"}):null,e.useLlmOnly?s(V,{size:"small",label:"LLM Only"}):null,e.elementId?s(V,{size:"small",label:`Element ID: ${e.elementId}`}):null,typeof e.timeout=="number"?s(V,{size:"small",label:`Timeout: ${e.timeout} ms`}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Tp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Ga,{}),label:"Type",color:"primary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Type "${e.text}"`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[s(V,{size:"small",label:`Text: ${e.text}`}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Bp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(zo,{}),label:"Scroll",color:"secondary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Scroll ${e.direction}`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,children:[s(V,{label:`Direction: ${e.direction}`,size:"small"}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),kp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(zo,{}),label:"Swipe",color:"secondary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Swipe ${e.direction}`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,children:[s(V,{label:`Direction: ${e.direction}`,size:"small"}),typeof e.x=="number"&&typeof e.y=="number"?s(V,{label:`Start: ${e.x}, ${e.y}`,size:"small"}):null,typeof e.duration=="number"?s(V,{label:`Duration: ${e.duration}ms`,size:"small"}):null,e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),_p=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Wa,{}),label:"Zoom",color:"secondary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Zoom ${e.direction}`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,children:[s(V,{label:`Direction: ${e.direction}`,size:"small"}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Fp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(za,{}),label:"Scroll Until",color:"info",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Scroll Until Found"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,alignItems:"center",sx:{flexWrap:"wrap"},children:[e.text?s(V,{label:`Find: ${e.text}`,size:"small"}):null,e.elementId?s(V,{label:`Element ID: ${e.elementId}`,size:"small"}):null,s(V,{label:`Direction: ${e.direction}`,size:"small"}),s(V,{label:`Max Scrolls: ${e.maxScrolls}`,size:"small"}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Lp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Ha,{}),label:"Deeplink",color:"success",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Open Deep Link"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[s(V,{size:"small",label:`URL: ${e.url}`}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Vp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Ua,{}),label:"AI",color:"secondary"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"AI Instruction"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[s(V,{size:"small",label:`Instruction: ${e.instruction}`}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),se=e=>{const t="/_serverFn/"+e;return Object.assign(async(...n)=>(await ja(e))(...n),{url:t,functionId:e,[qa]:!0})},Mp=se("605c05774def700303f9889c0f8a28fed026e0b5c36a1563cff2835ee01d26b1"),Gp=ae({method:"POST"}).inputValidator(Ka).handler(Mp,async({data:e})=>(console.log(`Performing tap at ${e.x}, ${e.y}`),await ts(e),{success:!0})),Lr=he({mutationKey:["device","tap"],mutationFn:e=>Gp({data:e})}),Wp=se("07e23aa87e88d53c6c9e3d8e88de788d27d7b10930150bc4fd510d4447aaf3de"),zp=ae({method:"POST"}).inputValidator(Ya).handler(Wp,async({data:e})=>(console.log(`Performing type: "${e.text}"`),await ns(e),{success:!0})),Vr=he({mutationKey:["device","type"],mutationFn:e=>zp({data:e})}),Hp=se("5c526b678a7596f28beca76784df0ac58acd292627c5770c0c8029e38e4681ec"),Up=ae({method:"POST"}).inputValidator(Ja).handler(Hp,async({data:e})=>(console.log(`Performing scroll: ${e.direction}`),await Ho(e),{success:!0})),Mr=he({mutationKey:["device","scroll"],mutationFn:e=>Up({data:e})}),jp=se("2b4a002699960d578addbcf4dd83fedcec62444d7da4bf7c2359be991ed6207e"),qp=ae({method:"POST"}).inputValidator(es).handler(jp,async({data:e})=>(console.log(`Performing swipe: ${e.x1},${e.y1} -> ${e.x2},${e.y2}`),await is(e),{success:!0})),Gr=he({mutationKey:["device","swipe"],mutationFn:e=>qp({data:e})}),Kp=se("10b616f4aacf11bb275166e4ae03f441f1d7c9a68a670dfadb03b74e1d012900"),Yp=ae({method:"POST"}).inputValidator(Xa).handler(Kp,async({data:e})=>{console.log(`Performing scroll until: text="${e.text}", id="${e.elementId}", dir=${e.direction}`);for(let t=0;t<(e.maxScrolls??15);t++){console.log(`Scroll Until Loop: ${t+1}/${e.maxScrolls}`);const n=await Pn(),r=await pr(n);let o=r.hierarchy?.node?.[0];const i=r.hierarchy?.node;if(i){const l=i.find(u=>u.$&&u.$.package!=="com.android.systemui");l&&(o=l)}let a=!1;if(e.elementId&&Uo(o,e.elementId)&&(a=!0),!a&&e.text&&cs(o,e.text)&&(a=!0),a)return console.log("Target found!"),{success:!0,scrolls:t};t<(e.maxScrolls??15)-1&&(await Ho({direction:e.direction}),await new Promise(l=>setTimeout(l,1e3)))}return console.log("Target NOT found after max scrolls"),{success:!1}}),Jp=he({mutationKey:["device","scrollUntil"],mutationFn:e=>Yp({data:e})}),Xp=se("c23cd3196f54848abd64a8b8d4660d7826a70cf44169d7bf29fc82e74a2cf612"),Zp=ae({method:"POST"}).inputValidator(Qa).handler(Xp,async({data:e})=>(console.log(`Performing zoom: ${e.direction}`),await os(e),{success:!0})),Qp=he({mutationKey:["device","zoom"],mutationFn:e=>Zp({data:e})}),ef=se("566ee4344553ab6300f847f5de346e037f92d986cb824ba1c313346e62345fbe"),tf=ae({method:"POST"}).inputValidator(Za).handler(ef,async({data:e})=>(console.log(`Performing deep link: "${e.url}"`),await rs(e.url),{success:!0})),nf=he({mutationKey:["device","deepLink"],mutationFn:e=>tf({data:e})}),rf=se("eea1073a910f7f023004366aafcef05a8c47a3a1a4a09721f71a2efe311ee70f"),of=ae({method:"POST"}).handler(rf,async e=>{const{platform:t="android",deviceId:n}=ur.parse(e.data);return await as(t,n),{success:!0}}),af=he({mutationKey:["device","appium","start"],mutationFn:e=>of({data:e})}),sf=se("6dbdc2968dc27a948c345034d1e55082b86918953b61da020ea8dd5836c79db3"),lf=ae({method:"GET"}).handler(sf,async e=>{const{platform:t="android",deviceId:n}=ur.parse(e.data),{isAppiumConnected:r}=await import("./appium-client-Dxm_q6FS.mjs");return{connected:r(t,n)}}),cf=(e={})=>Rt({queryKey:["device","appium","status",e],queryFn:()=>lf({data:e}),refetchInterval:2e3}),df=se("c5aeaa72b9b3303af5d82ee2fa59e3e90ffef3c3f0fb32707cee49e78ff41066"),Zi=ae({method:"GET"}).handler(df,async e=>{const t=ur.parse(e.data),{platform:n="android",deviceId:r}=t,o=async()=>({success:!0,base64:`data:image/png;base64,${(await vs(r)).toString("base64")}`,format:"base64",platform:"android",deviceId:r}),i=async()=>({success:!0,base64:`data:image/jpeg;base64,${(await Es(r)).toString("base64")}`,format:"base64",platform:"ios",deviceId:r});try{return n==="android"?await o():await i()}catch(a){return console.error(`Screenshot failed for ${n} ${r||""}:`,a),{success:!1,error:a.message}}}),Qi=(e={})=>Rt({queryKey:["device","screenshot",e],queryFn:()=>Zi({data:e}),staleTime:0,gcTime:0}),uf=he({mutationKey:["device","screenshot_mutation"],mutationFn:e=>Zi({data:e})}),pf=se("1ed4d2aa14be99e8c5a81eefbece63cea629a89f75862c60f9ff19c4d4dc67c5"),ff=ae().handler(pf,async()=>{const e=await Pn(),t=ss(),n=ls(),r=t==="ios"?ps(e):fs(e),o=ms({elements:r,deviceDimensions:n,allowNonClickableItems:!0,ignoredElements:[]}),i=hs({items:o});return{...n,elements:i}}),mf=se("05faf0772038a170c70083fd8de4a8b77a40e4ec46e0bbf6878670f02621b5df"),hf=ae({method:"POST"}).inputValidator(Is).handler(mf,async({data:e})=>{console.log(`Getting element ID at ${e.x}, ${e.y}`);const t=await Pn(),n=(await pr(t))?.hierarchy?.node?.[0];if(!n)return console.log("No root node found in hierarchy"),{elementId:""};const r=gs(n,e.x,e.y);if(!r)return console.log("No element found at coordinates"),{elementId:""};if(r.$&&r.$["resource-id"]?.trim()){let o=r.$["resource-id"];const i=bs(n,r,o);return i>=0?(o=`${o}[${i}]`,console.log(`Found duplicate IDs, using indexed ID: ${o}`)):console.log("Found unique element ID:",o),{elementId:o}}return console.log("Element found but has no resource-id"),{elementId:""}}),ea=he({mutationKey:["device","hierarchy","getElementId"],mutationFn:e=>hf({data:e})}),gf=se("9bcbf5303827d2a25f347c2054b0121655a82322fa07108653f43246875348f7"),bf=ae({method:"POST"}).inputValidator(ws).handler(gf,async({data:e})=>{console.log(`Looking for element with ID: ${e.elementId}`);const t=await Pn(),n=(await pr(t))?.hierarchy?.node?.[0];if(!n)return{found:!1};let r=e.elementId,o=null;const i=e.elementId.match(/^(.+)\[(\d+)\]$/);i&&(r=i[1],o=parseInt(i[2]),console.log(`Parsed indexed ID: base="${r}", index=${o}`));let a=null;if(o!==null){const l=ds(n,r);o<l.length&&(a=l[o],console.log(`Found element at index ${o}`))}else a=Uo(n,e.elementId);if(a){const l=us(a);if(l)return console.log(`Found element at center: ${l.x}, ${l.y}`),{found:!0,x:l.x,y:l.y}}return console.log("Element not found or no bounds"),{found:!1}}),yf=he({mutationKey:["device","hierarchy","findElementById"],mutationFn:e=>bf({data:e})}),ta=({enabled:e})=>Rt({queryKey:["visibleElements"],queryFn:ff,enabled:e}),vf=se("9f335634267a450fc9f34b1ab33c55da00cb1efc709604b2e3114602020075a2"),xf=ae({method:"POST"}).handler(vf,async()=>(console.log("Disabling Android animations..."),await xs(),{success:!0})),Df=he({mutationKey:["device","adb","disableAnimations"],mutationFn:()=>xf()}),Ef=se("33557b2fcc5cedc5814d20bca9cd9cde2e45318755de1da4d613e8fa84ee38d1"),wf=ae({method:"GET"}).handler(Ef,async()=>{const[e,t]=await Promise.all([ys(),Ds()]);return[...e,...t]}),na=Rt({queryKey:["devices"],queryFn:()=>wf()}),ra="https://cache.mobileboost.io";function oa(){const e=Ae.join(process.cwd(),"mobileboost.config.json");if(!eo.existsSync(e))throw new Error("mobileboost.config.json not found");const t=eo.readFileSync(e,"utf-8");return JSON.parse(t)}function ia(e,t,n,r,o,i){const a=i?`${i.width}x${i.height}`:"",l=`${e}${t||""}${n}${r}${o||""}${a}`;return Cs.createHash("sha256").update(l).digest("hex")}function aa(e,t){return e.match(/([xy])=(\d+)/)?e.replace(/([xy])=(\d+)/g,(n,r,o)=>{const i=parseInt(o,10);let a;return t==="multiply"?a=Math.round(i*pt):a=Math.round(i/pt),`${r}=${a}`}):e.replace(/(^|;)(\d+);(\d+)(;|$)/,(n,r,o,i,a)=>{const l=parseInt(o,10),u=parseInt(i,10);let c,f;return t==="multiply"?(c=Math.round(l*pt),f=Math.round(u*pt)):(c=Math.round(l/pt),f=Math.round(u/pt)),`${r}${c};${f}${a}`})}const If=se("fcbe7e11d05240fa28a1dd79ec8c395f6c03682edbaeb19f469bd78d6399cdde"),Cf=ae({method:"POST"}).inputValidator(e=>Os.parse(e)).handler(If,async({data:e})=>{try{const t=oa().apiKey;if(!t)throw new Error("API Key missing");const n=ia(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=await Promise.all(e.executionData.map(async l=>{const u=Buffer.from(l.screenshot.replace(/^data:image\/\w+;base64,/,""),"base64"),c=(await zt(u).metadata()).width??1080,f=Math.round(c/pt),p=await zt(u).resize({width:f,withoutEnlargement:!0}).toBuffer(),d=l.commands.map(m=>aa(m,"divide"));return{screenshot:p.toString("base64"),commands:d}})),o=JSON.stringify(r),i=(o.length/(1024*1024)).toFixed(2);console.log(`[Cache Client] Populating cache with payload size: ~${i} MB (Hash: ${n})`);const a=await fetch(`${ra}/populate-cache?hash=${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:o});return a.ok?{success:!0}:(console.error("Failed to populate cache:",await a.text()),{success:!1})}catch(t){return console.error("Error populating cache:",t),{success:!1,error:String(t)}}}),Nf=se("7d2aacaab26ab11cdc66f03a4ed01b8b38186abf16ab1f9306801ea7769aaa2a"),Sf=ae({method:"POST"}).inputValidator(e=>Ns.parse(e)).handler(Nf,async({data:e})=>{try{const t=oa().apiKey;if(!t)throw new Error("API Key missing");const n=ia(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=Buffer.from(e.screenshot.replace(/^data:image\/\w+;base64,/,""),"base64"),o=(await zt(r).metadata()).width??1080,i=Math.round(o/pt),a=await zt(r).resize({width:i,withoutEnlargement:!0}).toBuffer(),l=await zt(a).metadata();console.log(l.width,l.height);const u=new FormData;u.append("hash",n);const c=new Blob([new Uint8Array(a)],{type:"image/png"}),f=(c.size/(1024*1024)).toFixed(2);console.log(`[Cache Client] Executing from cache with screenshot size: ${f} MB`),u.append("screenshot",c,"screenshot.png"),e.highest_used_index!==void 0&&e.highest_used_index!==null&&(console.log(`[Cache Client] Sending highest_used_index: ${e.highest_used_index} (Type: ${typeof e.highest_used_index})`),u.append("highest_used_index",String(e.highest_used_index)));const p=await fetch(`${ra}/execute-from-cache`,{method:"POST",body:u});if(!p.ok){const g=await p.text();return console.warn("Cache lookup failed:",g),{found:!1}}const d=await p.json(),m=Ss.safeParse(d);if(m.success){const g={...m.data};return g.found&&g.cacheCommands&&(g.cacheCommands=g.cacheCommands.map(y=>aa(y,"multiply"))),g}return console.error("Invalid cache response:",d),{found:!1}}catch(t){return console.error("Error executing from cache:",t),{found:!1,error:String(t)}}}),Of={mutationFn:e=>Sf({data:e})},Wr={mutationFn:e=>Cf({data:e})},Pf=se("5918013064f9b88efb265b30a770275d6c9d52bf42318f451bab8a47bc850917"),Af=ae({method:"POST"}).inputValidator(Ps).handler(Pf,async({data:e})=>await As(e)),Rf=he({mutationKey:["ai","executeAgentStep"],mutationFn:e=>Af({data:e})});async function un(){const e=Ae.join(process.cwd(),"mobileboost.config.json");let t="./tests";if(await Re.pathExists(e))try{const n=await Re.readJSON(e);n.testDir&&(t=n.testDir)}catch(n){console.error("Error reading config, using default testDir",n)}return Ae.resolve(process.cwd(),t)}async function Fn(e){const t=await un(),n=Ae.resolve(t,e);if(!n.startsWith(t))throw new Error("Invalid path: must be within test directory");return n}L.object({name:L.string(),type:L.enum(["file","directory"]),path:L.string()});const $f=se("00fb1fe03e9689cf8c179ba0d5cadc5eeaa6879def224ac38037d70a1a51300d"),Tf=ae({method:"GET"}).handler($f,async()=>{const e=await un();await Re.ensureDir(e);async function t(n){let r=[];const o=await Re.readdir(n,{withFileTypes:!0});for(const i of o){const a=Ae.join(n,i.name),l=Ae.relative(e,a);i.isDirectory()?(r.push({name:i.name,type:"directory",path:l}),r=r.concat(await t(a))):r.push({name:i.name,type:"file",path:l})}return r}return{files:await t(e)}}),Bf=L.record(L.string(),L.string()).optional().default({});L.object({testDir:L.string(),driver:L.string(),port:L.number(),apiKey:L.string(),variables:Bf});const kf=se("54b0d7153f4ee4f963b29e7c835e76cedaaf345527fdc912c49030ea79353b5e"),_f=ae({method:"GET"}).handler(kf,async()=>{let e={};const t=Ae.join(process.cwd(),"mobileboost.config.json"),n=Ae.join(process.cwd(),".env");if(await Re.pathExists(t))try{e={...(await Re.readJSON(t)).variables}}catch{}if(await Re.pathExists(n))try{const r=await Ts(n,"utf-8"),o=Bs.parse(r);e={...e,...o}}catch{}return e}),zr=Rt({queryKey:["files"],queryFn:()=>Tf()}),Ff=L.object({name:L.string(),type:L.enum(["file","directory"]),parentPath:L.string().optional()}),Lf=se("ac7bf7f1d727949cd28713a8f36bb77e7bd8fc0e48854ed8cb1ee93ce80fb6d0"),Vf=ae({method:"POST"}).inputValidator(Ff).handler(Lf,async({data:e})=>{const t=await un(),n=e.parentPath?Ae.join(t,e.parentPath):t;if(!Ae.resolve(n).startsWith(t))throw new Error("Invalid parent path");const r=Ae.join(n,e.name);if(e.type==="directory")await Re.ensureDir(r);else{if(await Re.pathExists(r))throw new Error("File already exists");await Re.writeJSON(r,[],{spaces:2})}return{success:!0}}),Mf=he({mutationKey:["createFile"],mutationFn:e=>Vf({data:e})}),Gf=L.object({path:L.string()}),Wf=se("b41e844ce533c224e7c720e69d821468deffcbf208fc008a7f5af83cb0596b15"),zf=ae({method:"POST"}).inputValidator(Gf).handler(Wf,async({data:e})=>{const t=await Fn(e.path);try{return{content:await Re.readJSON(t),path:e.path}}catch(n){throw console.error("Failed to read file",n),new Error("Failed to read file or invalid format")}}),Hr=he({mutationKey:["readFile"],mutationFn:e=>zf({data:e})}),Hf=L.object({path:L.string(),content:Ma}),Uf=se("1b2a0d276d9ce90b2a1d72134c1bf95b9f6b7b049a8f415e8f0da3e6fc5ce4ae"),jf=ae({method:"POST"}).inputValidator(L.unknown()).handler(Uf,async({data:e})=>{const t=Hf.parse(e),n=await Fn(t.path);return await Re.writeJSON(n,t.content,{spaces:2}),{success:!0}}),sa=Rt({queryKey:["variables"],queryFn:_f,refetchInterval:1e4}),qf=he({mutationKey:["saveFile"],mutationFn:e=>jf({data:e})}),Kf=L.object({oldPath:L.string(),newPath:L.string()}),Yf=se("098d52adf25ea567d43facba347871f887828c6ab804021bbfa0f2759209c0c6"),Jf=ae({method:"POST"}).inputValidator(Kf).handler(Yf,async({data:e})=>{const t=await Fn(e.oldPath),n=await un(),r=Ae.resolve(n,e.newPath);if(!r.startsWith(n))throw new Error("Invalid new path");return await Re.rename(t,r),{success:!0}}),Xf=he({mutationKey:["renameFile"],mutationFn:e=>Jf({data:e})}),Zf=L.object({sourcePath:L.string(),targetPath:L.string()}),Qf=se("efbbc22c41cf491631b07076417c9ec65d5ac71debfcc00b5a7e0d368772104f"),em=ae({method:"POST"}).inputValidator(Zf).handler(Qf,async({data:e})=>{const t=await Fn(e.sourcePath),n=await un(),r=Ae.resolve(n,e.targetPath);if(!r.startsWith(n))throw new Error("Invalid target path");await Re.ensureDir(r);const o=Ae.basename(t),i=Ae.join(r,o);return await Re.move(t,i,{overwrite:!1}),{success:!0}});he({mutationKey:["moveFile"],mutationFn:e=>em({data:e})});function tm(e){const t=e?.bounds||e?.attributes?.bounds,n=t?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0,r=e?.text??e?.attributes?.text??e?.name??void 0,o=e?.resourceId??e?.attributes?.["resource-id"]??void 0,i=e?.attributes?.["content-desc"]??e?.attributes?.["accessibility-text"]??e?.accessibilityText??void 0,a=e?.label??e?.attributes?.label??void 0,l=e?.accessibilityIdentifier??e?.attributes?.accessibilityIdentifier??void 0,u=e?.hint??e?.attributes?.hint??e?.value??e?.attributes?.value??void 0,c={...n?{bounds:n}:{},...r?{text:String(r)}:{},...o?{resourceId:String(o)}:{},...i?{contentDesc:String(i)}:{},...a?{accessibilityLabel:String(a)}:{},...l?{accessibilityIdentifier:String(l)}:{},...u?{hint:String(u)}:{}};return Object.keys(c).length>0?c:void 0}function nm(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const r=tm(n);r&&t.push(r)}return t}const rm=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g,Ur=e=>{if(!e)return[];const t=new Set;let n;const r=new RegExp(rm);for(;(n=r.exec(e))!==null;)n[1]&&t.add(n[1]);return Array.from(t)},Et=(e,t)=>{const n=t?.required??!1;return({value:r})=>{const o=String(r??"").trim();if(!o)return n?"This field is required":void 0;const i=Ur(o);if(i.length===0)return;const a=e(),l=i.filter(u=>!Object.prototype.hasOwnProperty.call(a,u));if(l.length>0)return`Undefined params: ${l.join(", ")}`}},jr=L.number().min(0,"Must be 0 or greater");L.string().min(1,"This field is required");const la=L.enum(["up","down"]),om=L.enum(["in","out"]),im=L.string().min(1,"URL is required").regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/.+$/,"Invalid deeplink format (e.g., myapp://screen)"),Ce=e=>e.length?e.map(t=>typeof t=="string"?t:t?.message).filter(Boolean).join(", "):null,am=({step:e,onSave:t,onCancel:n})=>{const r=yn(()=>({id:Date.now(),type:"tap",descriptionText:"",optional:!1,timeout:3e3,useLlmOnly:!1,text:"",elementId:"",maxScrolls:15,direction:"down",url:"",instruction:"",path:""}),[]),{data:o}=Ke(zr),{data:i}=Ke(sa),a=oe.useCallback(()=>({...I.state.test.params,...i??{}}),[i]),l=new Set((o?.files||[]).filter(c=>c.type==="file").map(c=>c.path)),u=ks({defaultValues:{...r(),...e},onSubmit:({value:c})=>{if(c&&(c.type==="tap"||c.type==="assert")&&("x"in c&&delete c.x,"y"in c&&delete c.y),c.type==="fileRef"){const p=(c.path||"").trim();if(!p||o&&!l.has(p)){alert("The specified file does not exist in your tests directory.");return}}let f;switch(c.type){case"tap":f=Va.parse(c);break;case"assert":f=La.parse(c);break;case"type":f=Fa.parse(c);break;case"scroll":f=_a.parse(c);break;case"scrollUntil":f=ka.parse(c);break;case"deeplink":f=Ba.parse(c);break;case"ai":f=Ta.parse(c);break;case"fileRef":f=$a.parse(c);break;default:f=Wo.parse(c)}if(!e)I.setState(p=>({...p,test:{...p.test,steps:[...p.test.steps,f]}}));else{const p=f.id;I.setState(d=>({...d,test:{...d.test,steps:d.test.steps.map(m=>m.id===p?f:m)}}))}t()}});return v(bm,{children:[s(H,{variant:"h6",gutterBottom:!0,children:e?"Edit Step":"Add New Step"}),s("form",{onSubmit:c=>{c.preventDefault(),c.stopPropagation(),u.handleSubmit()},children:v(ym,{children:[s(u.Field,{name:"type",validators:{onChange:Qr},children:c=>{const f=c.state.meta.errors.length>0;return v($t,{fullWidth:!0,error:f,children:[s(nn,{id:"step-type",children:"Step type"}),s(rn,{labelId:"step-type",id:"step-type",value:c.state.value,label:"Step type",onChange:p=>{const d=p.target.value,m=u.state.values.id;u.reset(),u.setFieldValue("id",m),u.setFieldValue("type",d)},onBlur:c.handleBlur,children:Qr.options.map(p=>s(gt,{value:p,children:p},p))}),f&&s(Sn,{children:Ce(c.state.meta.errors)})]})}}),s(tn,{sx:{mb:1}}),v(vm,{children:[s(Ue,{children:"General Settings"}),s(u.Field,{name:"descriptionText",validators:{onChange:Et(a,{required:!1})},children:c=>s(fe,{id:"description-text",label:"Description",value:c.state.value??"",onChange:f=>c.handleChange(f.target.value),onBlur:c.handleBlur,placeholder:"Enter a description (you can use {{key}})",helperText:Ce(c.state.meta.errors)??"Use {{key}} to insert a param value",error:c.state.meta.errors?.length>0})}),s(u.Field,{name:"optional",validators:{onChange:L.boolean().optional()},children:c=>s(On,{control:s(dr,{checked:c.state.value??!1,onChange:f=>c.handleChange(f.target.checked)}),label:"Optional"})})]}),s(u.Subscribe,{selector:c=>c.values.type,children:c=>{switch(c){case"tap":return s(cm,{form:u});case"assert":return s(dm,{form:u});case"type":return s(um,{form:u,getDefinedParams:a});case"scroll":return s(pm,{form:u});case"zoom":return s(fm,{form:u});case"scrollUntil":return s(mm,{form:u,getDefinedParams:a});case"deeplink":return s(hm,{form:u,getDefinedParams:a});case"ai":return s(gm,{form:u,getDefinedParams:a});case"fileRef":return s(sm,{form:u,getDefinedParams:a});default:return null}}}),v(xm,{children:[s(ke,{startIcon:s(_s,{}),variant:"contained",type:"submit",children:"Save"}),s(ke,{startIcon:s(Fs,{}),variant:"outlined",color:"error",onClick:n,children:"Cancel"})]})]})})]})},sm=({form:e,getDefinedParams:t})=>{const{data:n,isLoading:r}=Ke(zr),o=new Set((n?.files||[]).filter(i=>i.type==="file").map(i=>i.path));return v(st,{children:[s(Ue,{children:"File Reference"}),s(e.Field,{name:"path",validators:{onChange:({value:i})=>{const a=String(i??"").trim();if(!a)return"This field is required";if(Ur(a).length>0)return Et(t,{required:!0})({value:a});if(!r&&n&&!o.has(a))return"File not found in tests directory"}},children:i=>{const a=i.state.meta.errors?.length>0,l=a?Ce(i.state.meta.errors):r?"Checking files...":"Path is relative to your tests directory (supports {{key}})";return s(fe,{id:"file-path",label:"File path",placeholder:"e.g., test2.json or subfolder/flow.json (you can use {{key}})",value:i.state.value??"",onChange:u=>i.handleChange(u.target.value),onBlur:i.handleBlur,error:a,helperText:l,fullWidth:!0})}}),s(e.Subscribe,{selector:i=>({path:i.values.path,overrides:i.values.overrides}),children:({path:i,overrides:a})=>s(lm,{path:i,overrides:a,onChange:l=>e.setFieldValue("overrides",l),validPaths:o})})]})},lm=({path:e,overrides:t,onChange:n,validPaths:r})=>{const[o,i]=oe.useState(!1),[a,l]=oe.useState({}),u=G(Hr);oe.useEffect(()=>{let d=!1;return(async()=>{if(!e||!r.has(e)){l({});return}i(!0);try{const m=(await u.mutateAsync({path:e}))?.content;Array.isArray(m)?l({}):l(m&&typeof m=="object"?m.params||{}:{})}catch{l({})}finally{d||i(!1)}})(),()=>{d=!0}},[e]);const c=t||{},f=(d,m)=>{const g={...c};m?g[d]=m:delete g[d],n(g)},p=Object.keys(a);return e?v(re,{sx:{mt:2},children:[s(H,{variant:"subtitle2",children:"Param overrides"}),o?s(H,{variant:"caption",color:"text.secondary",children:"Loading referenced test…"}):p.length===0?s(H,{variant:"caption",color:"text.secondary",children:"Referenced test has no params"}):s(re,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:p.map(d=>v(re,{sx:{display:"grid",gridTemplateColumns:"160px 1fr",gap:1,alignItems:"center"},children:[s(fe,{size:"small",label:"Key",value:d,disabled:!0}),v(re,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[s(fe,{size:"small",label:"Default",value:a[d]??"",disabled:!0}),s(fe,{size:"small",label:"Override (optional)",value:c[d]??"",onChange:m=>f(d,m.target.value)})]})]},d))})]}):null},cm=({form:e})=>v(st,{children:[s(Ue,{children:"Tap Configuration"}),s(e.Field,{name:"timeout",validators:{onChange:jr},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:Ce(t.state.meta.errors)})}}),s(e.Field,{name:"elementId",validators:{onChange:L.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{id:"tap-element-id",label:"Element Identifier (elementId)",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Android: com.app:id/button | iOS: accessibilityIdentifier/name/label",error:n,helperText:Ce(t.state.meta.errors)??(I.state.selectedPlatform==="ios"?"Optional. iOS: prefer accessibilityIdentifier, otherwise name/label. Supports index like value[2].":"Optional. Android: resource-id (e.g., com.app:id/button). Supports index like id[2].")})}}),s(e.Field,{name:"useLlmOnly",validators:{onChange:L.boolean().optional()},children:t=>s(On,{control:s(dr,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),dm=({form:e})=>v(st,{children:[s(Ue,{children:"Assert Configuration"}),s(e.Field,{name:"timeout",validators:{onChange:jr},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:Ce(t.state.meta.errors)})}}),s(e.Field,{name:"elementId",validators:{onChange:L.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{id:"assert-element-id",label:"Resource ID (elementId)",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"e.g. com.app:id/label or com.app:id/label[1]",error:n,helperText:Ce(t.state.meta.errors)??"Optional. Android resource-id of the element to assert."})}}),s(e.Field,{name:"useLlmOnly",validators:{onChange:L.boolean().optional()},children:t=>s(On,{control:s(dr,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),um=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"Type Configuration"}),s(e.Field,{name:"text",validators:{onChange:Et(t,{required:!0})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"text",label:"Text to type",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Enter text to type (you can use {{key}})",multiline:!0,rows:3,error:r,helperText:Ce(n.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),pm=({form:e})=>v(st,{children:[s(Ue,{children:"Scroll Configuration"}),s(e.Field,{name:"direction",validators:{onChange:la},children:t=>{const n=t.state.meta.errors?.length>0;return v($t,{fullWidth:!0,error:n,children:[s(nn,{id:"scroll-direction",children:"Direction"}),v(rn,{labelId:"scroll-direction",id:"scroll-direction",value:t.state.value??"down",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[s(gt,{value:"up",children:"Up"}),s(gt,{value:"down",children:"Down"})]}),n&&s(Sn,{children:Ce(t.state.meta.errors)})]})}})]}),fm=({form:e})=>v(st,{children:[s(Ue,{children:"Zoom Configuration"}),s(e.Field,{name:"direction",validators:{onChange:om},children:t=>{const n=t.state.meta.errors?.length>0;return v($t,{fullWidth:!0,error:n,children:[s(nn,{id:"zoom-direction",children:"Direction"}),v(rn,{labelId:"zoom-direction",id:"zoom-direction",value:t.state.value??"in",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[s(gt,{value:"in",children:"In (spread)"}),s(gt,{value:"out",children:"Out (pinch)"})]}),n&&s(Sn,{children:Ce(t.state.meta.errors)})]})}})]}),mm=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"Scroll Until Configuration"}),s(e.Field,{name:"direction",validators:{onChange:la},children:n=>{const r=n.state.meta.errors?.length>0;return v($t,{fullWidth:!0,error:r,children:[s(nn,{id:"scroll-until-direction",children:"Direction"}),v(rn,{labelId:"scroll-until-direction",id:"scroll-until-direction",value:n.state.value??"down",label:"Direction",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,children:[s(gt,{value:"up",children:"Up"}),s(gt,{value:"down",children:"Down"})]}),r&&s(Sn,{children:Ce(n.state.meta.errors)})]})}}),s(e.Field,{name:"maxScrolls",validators:{onChange:jr},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{type:"number",id:"max-scrolls",label:"Max Scrolls",value:n.state.value??15,onChange:o=>n.handleChange(parseInt(o.target.value)||15),onBlur:n.handleBlur,placeholder:"Maximum scroll attempts",error:r,helperText:Ce(n.state.meta.errors)??"Maximum number of scroll attempts (default: 15)"})}}),s(Ue,{sx:{mt:1},children:"Stop Condition (at least one)"}),s(e.Field,{name:"text",validators:{onChange:Et(t,{required:!1})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"scroll-until-text",label:"Text to find",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Text content to scroll until visible (supports {{key}})",error:r,helperText:Ce(n.state.meta.errors)??"Scroll until this text (with params resolved) is visible on screen"})}}),s(e.Field,{name:"elementId",validators:{onChange:Et(t,{required:!1})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"scroll-until-element-id",label:"Element ID",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Element ID to scroll until visible (supports {{key}})",error:r,helperText:Ce(n.state.meta.errors)??"Scroll until element with this ID (after resolving params) is visible"})}})]}),hm=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"Deeplink Configuration"}),s(e.Field,{name:"url",validators:{onChange:({value:n})=>{const r=String(n??"").trim();if(!r)return"URL is required";if(Ur(r).length>0)return Et(t,{required:!0})({value:r});const o=im.safeParse(r);return o.success?void 0:o.error.issues[0]?.message||"Invalid URL"}},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"url",label:"URL",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Enter deeplink URL (you can use {{key}})",fullWidth:!0,error:r,helperText:Ce(n.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),gm=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"AI Configuration"}),s(e.Field,{name:"instruction",validators:{onChange:Et(t,{required:!0})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"instruction",label:"AI Instruction",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Enter instruction for AI to execute (you can use {{key}})",multiline:!0,rows:4,error:r,helperText:Ce(n.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),bm=wt(re)`
177
+ `,Ze=Tt(Fo)(({theme:e,$hasOrigin:t})=>({display:"flex",alignItems:"flex-start",padding:e.spacing(2),marginBottom:e.spacing(1),gap:e.spacing(2),animation:"fadeIn 0.3s ease-in",borderLeft:t?`4px solid ${e.palette.info.main}`:void 0,backgroundColor:t?`${e.palette.info.light}22`:void 0,"@keyframes fadeIn":{from:{opacity:0,transform:"translateY(10px)"},to:{opacity:1,transform:"translateY(0)"}},position:"relative","&:hover .step-actions-overlay":{opacity:1,transform:"translateY(0)"}})),Qe=Tt(H)(({theme:e})=>({fontWeight:"bold",fontSize:"1.2em",color:e.palette.primary.main,minWidth:30})),et=Tt(re)({flexGrow:1}),at=({path:e})=>v(H,{variant:"caption",color:"info.main",sx:{display:"block",fontFamily:"monospace"},children:["from ",e]}),tt=Tt(H)(({statuscolor:e})=>({fontSize:"0.8em",marginTop:4,color:e||"#666",fontWeight:500})),nt=Tt(re)(({theme:e})=>({position:"absolute",top:-16,right:16,backgroundColor:e.palette.background.paper,boxShadow:e.shadows[3],border:`1px solid ${e.palette.divider}`,display:"flex",alignItems:"center",justifyContent:"center",gap:e.spacing(.5),opacity:0,transition:"all 0.2s ease-in-out",zIndex:10,borderRadius:16,padding:"4px 8px",transform:"translateY(5px)","&.visible":{opacity:1,transform:"translateY(0)"}})),Xi=Tt("img")(({theme:e})=>({border:`1px solid ${e.palette.divider}`,borderRadius:4,boxShadow:e.shadows[2],width:60,height:60,objectFit:"cover"})),Ap=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,children:[s(Qe,{children:t}),v(et,{children:[s(H,{variant:"body2",color:"text.secondary",fontFamily:"monospace",children:"📄 File Reference"}),s(H,{fontWeight:"bold",children:e.descriptionText||"Add steps from file"}),v(H,{variant:"body2",children:["Path: ",e.path]}),e.overrides&&Object.keys(e.overrides).length>0&&v(re,{sx:{mt:.5,display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:[s(H,{variant:"caption",color:"text.secondary",children:"Overrides:"}),Object.keys(e.overrides).map(a=>s(V,{size:"small",label:`${a}`},a))]}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),s(re,{sx:{mt:1,display:"flex",gap:1,alignItems:"center"},children:e.optional?s(V,{size:"small",label:"Optional"}):null})]}),v(nt,{className:"step-actions-overlay",children:[r&&s(O,{onClick:r,size:"small","aria-label":"Play",children:s(Ye,{})}),r&&s(O,{onClick:r,size:"small","aria-label":"Play from here",children:s(Je,{})}),o&&s(O,{onClick:o,size:"small","aria-label":"Edit",children:s(Xe,{})}),i&&s(O,{onClick:i,size:"small","aria-label":"Delete",children:s(je,{})})]})]}),$p=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),e.cropBase64&&s(Xi,{src:e.cropBase64,alt:"tap target"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Tap Interaction"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[e.optional?s(V,{size:"small",label:"Optional"}):null,e.useLlmOnly?s(V,{size:"small",label:"LLM Only"}):null,e.elementId?s(V,{size:"small",label:`Element ID: ${e.elementId}`}):null,typeof e.timeout=="number"?s(V,{size:"small",label:`Timeout: ${e.timeout} ms`}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Rp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),e.cropBase64&&s(Xi,{src:e.cropBase64,alt:"assert target",sx:{border:2,borderColor:"warning.main"}}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Assert Element"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[e.optional?s(V,{size:"small",label:"Optional"}):null,e.useLlmOnly?s(V,{size:"small",label:"LLM Only"}):null,e.elementId?s(V,{size:"small",label:`Element ID: ${e.elementId}`}):null,typeof e.timeout=="number"?s(V,{size:"small",label:`Timeout: ${e.timeout} ms`}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Tp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Ga,{}),label:"Type",color:"primary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Type "${e.text}"`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[s(V,{size:"small",label:`Text: ${e.text}`}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Bp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(zo,{}),label:"Scroll",color:"secondary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Scroll ${e.direction}`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,children:[s(V,{label:`Direction: ${e.direction}`,size:"small"}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),kp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(zo,{}),label:"Swipe",color:"secondary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Swipe ${e.direction}`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,children:[s(V,{label:`Direction: ${e.direction}`,size:"small"}),typeof e.x=="number"&&typeof e.y=="number"?s(V,{label:`Start: ${e.x}, ${e.y}`,size:"small"}):null,typeof e.duration=="number"?s(V,{label:`Duration: ${e.duration}ms`,size:"small"}):null,e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),_p=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Wa,{}),label:"Zoom",color:"secondary",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||`Zoom ${e.direction}`}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,children:[s(V,{label:`Direction: ${e.direction}`,size:"small"}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Fp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(za,{}),label:"Scroll Until",color:"info",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Scroll Until Found"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{display:"flex",gap:1,mt:1,alignItems:"center",sx:{flexWrap:"wrap"},children:[e.text?s(V,{label:`Find: ${e.text}`,size:"small"}):null,e.elementId?s(V,{label:`Element ID: ${e.elementId}`,size:"small"}):null,s(V,{label:`Direction: ${e.direction}`,size:"small"}),s(V,{label:`Max Scrolls: ${e.maxScrolls}`,size:"small"}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Lp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Ha,{}),label:"Deeplink",color:"success",variant:"outlined"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"Open Deep Link"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[s(V,{size:"small",label:`URL: ${e.url}`}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),Vp=({step:e,stepNumber:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>v(Ze,{elevation:1,$hasOrigin:!!e.originRef,children:[s(Qe,{children:t}),s(V,{icon:s(Ua,{}),label:"AI",color:"secondary"}),v(et,{children:[e.originRef?.path&&s(at,{path:e.originRef?.path}),s(H,{fontWeight:"bold",children:e.descriptionText||"AI Instruction"}),e.status&&s(tt,{statuscolor:e.statusColor,children:e.status}),v(re,{sx:{mt:1,display:"flex",gap:1,flexWrap:"wrap"},children:[s(V,{size:"small",label:`Instruction: ${e.instruction}`}),e.optional?s(V,{size:"small",label:"Optional"}):null]})]}),v(nt,{className:"step-actions-overlay",children:[s(O,{size:"small",onClick:n,title:"Play this step",children:s(Ye,{})}),s(O,{size:"small",onClick:r,title:"Play from here",children:s(Je,{})}),s(O,{size:"small",onClick:o,title:"Edit",children:s(Xe,{})}),s(O,{size:"small",onClick:i,title:"Delete",children:s(je,{})})]})]}),se=e=>{const t="/_serverFn/"+e;return Object.assign(async(...n)=>(await ja(e))(...n),{url:t,functionId:e,[qa]:!0})},Mp=se("605c05774def700303f9889c0f8a28fed026e0b5c36a1563cff2835ee01d26b1"),Gp=ae({method:"POST"}).inputValidator(Ka).handler(Mp,async({data:e})=>(console.log(`Performing tap at ${e.x}, ${e.y}`),await ts(e),{success:!0})),Lr=he({mutationKey:["device","tap"],mutationFn:e=>Gp({data:e})}),Wp=se("07e23aa87e88d53c6c9e3d8e88de788d27d7b10930150bc4fd510d4447aaf3de"),zp=ae({method:"POST"}).inputValidator(Ya).handler(Wp,async({data:e})=>(console.log(`Performing type: "${e.text}"`),await ns(e),{success:!0})),Vr=he({mutationKey:["device","type"],mutationFn:e=>zp({data:e})}),Hp=se("5c526b678a7596f28beca76784df0ac58acd292627c5770c0c8029e38e4681ec"),Up=ae({method:"POST"}).inputValidator(Ja).handler(Hp,async({data:e})=>(console.log(`Performing scroll: ${e.direction}`),await Ho(e),{success:!0})),Mr=he({mutationKey:["device","scroll"],mutationFn:e=>Up({data:e})}),jp=se("2b4a002699960d578addbcf4dd83fedcec62444d7da4bf7c2359be991ed6207e"),qp=ae({method:"POST"}).inputValidator(es).handler(jp,async({data:e})=>(console.log(`Performing swipe: ${e.x1},${e.y1} -> ${e.x2},${e.y2}`),await is(e),{success:!0})),Gr=he({mutationKey:["device","swipe"],mutationFn:e=>qp({data:e})}),Kp=se("10b616f4aacf11bb275166e4ae03f441f1d7c9a68a670dfadb03b74e1d012900"),Yp=ae({method:"POST"}).inputValidator(Xa).handler(Kp,async({data:e})=>{console.log(`Performing scroll until: text="${e.text}", id="${e.elementId}", dir=${e.direction}`);for(let t=0;t<(e.maxScrolls??15);t++){console.log(`Scroll Until Loop: ${t+1}/${e.maxScrolls}`);const n=await Pn(),r=await pr(n);let o=r.hierarchy?.node?.[0];const i=r.hierarchy?.node;if(i){const l=i.find(u=>u.$&&u.$.package!=="com.android.systemui");l&&(o=l)}let a=!1;if(e.elementId&&Uo(o,e.elementId)&&(a=!0),!a&&e.text&&cs(o,e.text)&&(a=!0),a)return console.log("Target found!"),{success:!0,scrolls:t};t<(e.maxScrolls??15)-1&&(await Ho({direction:e.direction}),await new Promise(l=>setTimeout(l,1e3)))}return console.log("Target NOT found after max scrolls"),{success:!1}}),Jp=he({mutationKey:["device","scrollUntil"],mutationFn:e=>Yp({data:e})}),Xp=se("c23cd3196f54848abd64a8b8d4660d7826a70cf44169d7bf29fc82e74a2cf612"),Zp=ae({method:"POST"}).inputValidator(Qa).handler(Xp,async({data:e})=>(console.log(`Performing zoom: ${e.direction}`),await os(e),{success:!0})),Qp=he({mutationKey:["device","zoom"],mutationFn:e=>Zp({data:e})}),ef=se("566ee4344553ab6300f847f5de346e037f92d986cb824ba1c313346e62345fbe"),tf=ae({method:"POST"}).inputValidator(Za).handler(ef,async({data:e})=>(console.log(`Performing deep link: "${e.url}"`),await rs(e.url),{success:!0})),nf=he({mutationKey:["device","deepLink"],mutationFn:e=>tf({data:e})}),rf=se("eea1073a910f7f023004366aafcef05a8c47a3a1a4a09721f71a2efe311ee70f"),of=ae({method:"POST"}).handler(rf,async e=>{const{platform:t="android",deviceId:n}=ur.parse(e.data);return await as(t,n),{success:!0}}),af=he({mutationKey:["device","appium","start"],mutationFn:e=>of({data:e})}),sf=se("6dbdc2968dc27a948c345034d1e55082b86918953b61da020ea8dd5836c79db3"),lf=ae({method:"GET"}).handler(sf,async e=>{const{platform:t="android",deviceId:n}=ur.parse(e.data),{isAppiumConnected:r}=await import("./appium-client-Dxm_q6FS.mjs");return{connected:r(t,n)}}),cf=(e={})=>$t({queryKey:["device","appium","status",e],queryFn:()=>lf({data:e}),refetchInterval:2e3}),df=se("c5aeaa72b9b3303af5d82ee2fa59e3e90ffef3c3f0fb32707cee49e78ff41066"),Zi=ae({method:"GET"}).handler(df,async e=>{const t=ur.parse(e.data),{platform:n="android",deviceId:r}=t,o=async()=>({success:!0,base64:`data:image/png;base64,${(await vs(r)).toString("base64")}`,format:"base64",platform:"android",deviceId:r}),i=async()=>({success:!0,base64:`data:image/jpeg;base64,${(await Es(r)).toString("base64")}`,format:"base64",platform:"ios",deviceId:r});try{return n==="android"?await o():await i()}catch(a){return console.error(`Screenshot failed for ${n} ${r||""}:`,a),{success:!1,error:a.message}}}),Qi=(e={})=>$t({queryKey:["device","screenshot",e],queryFn:()=>Zi({data:e}),staleTime:0,gcTime:0}),uf=he({mutationKey:["device","screenshot_mutation"],mutationFn:e=>Zi({data:e})}),pf=se("1ed4d2aa14be99e8c5a81eefbece63cea629a89f75862c60f9ff19c4d4dc67c5"),ff=ae().handler(pf,async()=>{const e=await Pn(),t=ss(),n=ls(),r=t==="ios"?ps(e):fs(e),o=ms({elements:r,deviceDimensions:n,allowNonClickableItems:!0,ignoredElements:[]}),i=hs({items:o});return{...n,elements:i}}),mf=se("05faf0772038a170c70083fd8de4a8b77a40e4ec46e0bbf6878670f02621b5df"),hf=ae({method:"POST"}).inputValidator(Is).handler(mf,async({data:e})=>{console.log(`Getting element ID at ${e.x}, ${e.y}`);const t=await Pn(),n=(await pr(t))?.hierarchy?.node?.[0];if(!n)return console.log("No root node found in hierarchy"),{elementId:""};const r=gs(n,e.x,e.y);if(!r)return console.log("No element found at coordinates"),{elementId:""};if(r.$&&r.$["resource-id"]?.trim()){let o=r.$["resource-id"];const i=bs(n,r,o);return i>=0?(o=`${o}[${i}]`,console.log(`Found duplicate IDs, using indexed ID: ${o}`)):console.log("Found unique element ID:",o),{elementId:o}}return console.log("Element found but has no resource-id"),{elementId:""}}),ea=he({mutationKey:["device","hierarchy","getElementId"],mutationFn:e=>hf({data:e})}),gf=se("9bcbf5303827d2a25f347c2054b0121655a82322fa07108653f43246875348f7"),bf=ae({method:"POST"}).inputValidator(ws).handler(gf,async({data:e})=>{console.log(`Looking for element with ID: ${e.elementId}`);const t=await Pn(),n=(await pr(t))?.hierarchy?.node?.[0];if(!n)return{found:!1};let r=e.elementId,o=null;const i=e.elementId.match(/^(.+)\[(\d+)\]$/);i&&(r=i[1],o=parseInt(i[2]),console.log(`Parsed indexed ID: base="${r}", index=${o}`));let a=null;if(o!==null){const l=ds(n,r);o<l.length&&(a=l[o],console.log(`Found element at index ${o}`))}else a=Uo(n,e.elementId);if(a){const l=us(a);if(l)return console.log(`Found element at center: ${l.x}, ${l.y}`),{found:!0,x:l.x,y:l.y}}return console.log("Element not found or no bounds"),{found:!1}}),yf=he({mutationKey:["device","hierarchy","findElementById"],mutationFn:e=>bf({data:e})}),ta=({enabled:e})=>$t({queryKey:["visibleElements"],queryFn:ff,enabled:e}),vf=se("9f335634267a450fc9f34b1ab33c55da00cb1efc709604b2e3114602020075a2"),xf=ae({method:"POST"}).handler(vf,async()=>(console.log("Disabling Android animations..."),await xs(),{success:!0})),Df=he({mutationKey:["device","adb","disableAnimations"],mutationFn:()=>xf()}),Ef=se("33557b2fcc5cedc5814d20bca9cd9cde2e45318755de1da4d613e8fa84ee38d1"),wf=ae({method:"GET"}).handler(Ef,async()=>{const[e,t]=await Promise.all([ys(),Ds()]);return[...e,...t]}),na=$t({queryKey:["devices"],queryFn:()=>wf()}),ra="https://cache.mobileboost.io";function oa(){const e=Ae.join(process.cwd(),"mobileboost.config.json");if(!eo.existsSync(e))throw new Error("mobileboost.config.json not found");const t=eo.readFileSync(e,"utf-8");return JSON.parse(t)}function ia(e,t,n,r,o,i){const a=i?`${i.width}x${i.height}`:"",l=`${e}${t||""}${n}${r}${o||""}${a}`;return Cs.createHash("sha256").update(l).digest("hex")}function aa(e,t){return e.match(/([xy])=(\d+)/)?e.replace(/([xy])=(\d+)/g,(n,r,o)=>{const i=parseInt(o,10);let a;return t==="multiply"?a=Math.round(i*pt):a=Math.round(i/pt),`${r}=${a}`}):e.replace(/(^|;)(\d+);(\d+)(;|$)/,(n,r,o,i,a)=>{const l=parseInt(o,10),u=parseInt(i,10);let c,f;return t==="multiply"?(c=Math.round(l*pt),f=Math.round(u*pt)):(c=Math.round(l/pt),f=Math.round(u/pt)),`${r}${c};${f}${a}`})}const If=se("fcbe7e11d05240fa28a1dd79ec8c395f6c03682edbaeb19f469bd78d6399cdde"),Cf=ae({method:"POST"}).inputValidator(e=>Os.parse(e)).handler(If,async({data:e})=>{try{const t=oa().apiKey;if(!t)throw new Error("API Key missing");const n=ia(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=await Promise.all(e.executionData.map(async l=>{const u=Buffer.from(l.screenshot.replace(/^data:image\/\w+;base64,/,""),"base64"),c=(await zt(u).metadata()).width??1080,f=Math.round(c/pt),p=await zt(u).resize({width:f,withoutEnlargement:!0}).toBuffer(),d=l.commands.map(m=>aa(m,"divide"));return{screenshot:p.toString("base64"),commands:d}})),o=JSON.stringify(r),i=(o.length/(1024*1024)).toFixed(2);console.log(`[Cache Client] Populating cache with payload size: ~${i} MB (Hash: ${n})`);const a=await fetch(`${ra}/populate-cache?hash=${n}`,{method:"POST",headers:{"Content-Type":"application/json"},body:o});return a.ok?{success:!0}:(console.error("Failed to populate cache:",await a.text()),{success:!1})}catch(t){return console.error("Error populating cache:",t),{success:!1,error:String(t)}}}),Nf=se("7d2aacaab26ab11cdc66f03a4ed01b8b38186abf16ab1f9306801ea7769aaa2a"),Sf=ae({method:"POST"}).inputValidator(e=>Ns.parse(e)).handler(Nf,async({data:e})=>{try{const t=oa().apiKey;if(!t)throw new Error("API Key missing");const n=ia(t,e.filepath,e.stepNumber,e.stepDescription,e.platform,e.screenResolution),r=Buffer.from(e.screenshot.replace(/^data:image\/\w+;base64,/,""),"base64"),o=(await zt(r).metadata()).width??1080,i=Math.round(o/pt),a=await zt(r).resize({width:i,withoutEnlargement:!0}).toBuffer(),l=await zt(a).metadata();console.log(l.width,l.height);const u=new FormData;u.append("hash",n);const c=new Blob([new Uint8Array(a)],{type:"image/png"}),f=(c.size/(1024*1024)).toFixed(2);console.log(`[Cache Client] Executing from cache with screenshot size: ${f} MB`),u.append("screenshot",c,"screenshot.png"),e.highest_used_index!==void 0&&e.highest_used_index!==null&&(console.log(`[Cache Client] Sending highest_used_index: ${e.highest_used_index} (Type: ${typeof e.highest_used_index})`),u.append("highest_used_index",String(e.highest_used_index)));const p=await fetch(`${ra}/execute-from-cache`,{method:"POST",body:u});if(!p.ok){const g=await p.text();return console.warn("Cache lookup failed:",g),{found:!1}}const d=await p.json(),m=Ss.safeParse(d);if(m.success){const g={...m.data};return g.found&&g.cacheCommands&&(g.cacheCommands=g.cacheCommands.map(y=>aa(y,"multiply"))),g}return console.error("Invalid cache response:",d),{found:!1}}catch(t){return console.error("Error executing from cache:",t),{found:!1,error:String(t)}}}),Of={mutationFn:e=>Sf({data:e})},Wr={mutationFn:e=>Cf({data:e})},Pf=se("5918013064f9b88efb265b30a770275d6c9d52bf42318f451bab8a47bc850917"),Af=ae({method:"POST"}).inputValidator(Ps).handler(Pf,async({data:e})=>await As(e)),$f=he({mutationKey:["ai","executeAgentStep"],mutationFn:e=>Af({data:e})});async function un(){const e=Ae.join(process.cwd(),"mobileboost.config.json");let t="./tests";if(await $e.pathExists(e))try{const n=await $e.readJSON(e);n.testDir&&(t=n.testDir)}catch(n){console.error("Error reading config, using default testDir",n)}return Ae.resolve(process.cwd(),t)}async function Fn(e){const t=await un(),n=Ae.resolve(t,e);if(!n.startsWith(t))throw new Error("Invalid path: must be within test directory");return n}L.object({name:L.string(),type:L.enum(["file","directory"]),path:L.string()});const Rf=se("00fb1fe03e9689cf8c179ba0d5cadc5eeaa6879def224ac38037d70a1a51300d"),Tf=ae({method:"GET"}).handler(Rf,async()=>{const e=await un();await $e.ensureDir(e);async function t(n){let r=[];const o=await $e.readdir(n,{withFileTypes:!0});for(const i of o){const a=Ae.join(n,i.name),l=Ae.relative(e,a);i.isDirectory()?(r.push({name:i.name,type:"directory",path:l}),r=r.concat(await t(a))):r.push({name:i.name,type:"file",path:l})}return r}return{files:await t(e)}}),Bf=L.record(L.string(),L.string()).optional().default({});L.object({testDir:L.string(),driver:L.string(),port:L.number(),apiKey:L.string(),variables:Bf});const kf=se("54b0d7153f4ee4f963b29e7c835e76cedaaf345527fdc912c49030ea79353b5e"),_f=ae({method:"GET"}).handler(kf,async()=>{let e={};const t=Ae.join(process.cwd(),"mobileboost.config.json"),n=Ae.join(process.cwd(),".env");if(await $e.pathExists(t))try{e={...(await $e.readJSON(t)).variables}}catch{}if(await $e.pathExists(n))try{const r=await Ts(n,"utf-8"),o=Bs.parse(r);e={...e,...o}}catch{}return e}),zr=$t({queryKey:["files"],queryFn:()=>Tf()}),Ff=L.object({name:L.string(),type:L.enum(["file","directory"]),parentPath:L.string().optional()}),Lf=se("ac7bf7f1d727949cd28713a8f36bb77e7bd8fc0e48854ed8cb1ee93ce80fb6d0"),Vf=ae({method:"POST"}).inputValidator(Ff).handler(Lf,async({data:e})=>{const t=await un(),n=e.parentPath?Ae.join(t,e.parentPath):t;if(!Ae.resolve(n).startsWith(t))throw new Error("Invalid parent path");const r=Ae.join(n,e.name);if(e.type==="directory")await $e.ensureDir(r);else{if(await $e.pathExists(r))throw new Error("File already exists");await $e.writeJSON(r,[],{spaces:2})}return{success:!0}}),Mf=he({mutationKey:["createFile"],mutationFn:e=>Vf({data:e})}),Gf=L.object({path:L.string()}),Wf=se("b41e844ce533c224e7c720e69d821468deffcbf208fc008a7f5af83cb0596b15"),zf=ae({method:"POST"}).inputValidator(Gf).handler(Wf,async({data:e})=>{const t=await Fn(e.path);try{return{content:await $e.readJSON(t),path:e.path}}catch(n){throw console.error("Failed to read file",n),new Error("Failed to read file or invalid format")}}),Hr=he({mutationKey:["readFile"],mutationFn:e=>zf({data:e})}),Hf=L.object({path:L.string(),content:Ma}),Uf=se("1b2a0d276d9ce90b2a1d72134c1bf95b9f6b7b049a8f415e8f0da3e6fc5ce4ae"),jf=ae({method:"POST"}).inputValidator(L.unknown()).handler(Uf,async({data:e})=>{const t=Hf.parse(e),n=await Fn(t.path);return await $e.writeJSON(n,t.content,{spaces:2}),{success:!0}}),sa=$t({queryKey:["variables"],queryFn:_f,refetchInterval:1e4}),qf=he({mutationKey:["saveFile"],mutationFn:e=>jf({data:e})}),Kf=L.object({oldPath:L.string(),newPath:L.string()}),Yf=se("098d52adf25ea567d43facba347871f887828c6ab804021bbfa0f2759209c0c6"),Jf=ae({method:"POST"}).inputValidator(Kf).handler(Yf,async({data:e})=>{const t=await Fn(e.oldPath),n=await un(),r=Ae.resolve(n,e.newPath);if(!r.startsWith(n))throw new Error("Invalid new path");return await $e.rename(t,r),{success:!0}}),Xf=he({mutationKey:["renameFile"],mutationFn:e=>Jf({data:e})}),Zf=L.object({sourcePath:L.string(),targetPath:L.string()}),Qf=se("efbbc22c41cf491631b07076417c9ec65d5ac71debfcc00b5a7e0d368772104f"),em=ae({method:"POST"}).inputValidator(Zf).handler(Qf,async({data:e})=>{const t=await Fn(e.sourcePath),n=await un(),r=Ae.resolve(n,e.targetPath);if(!r.startsWith(n))throw new Error("Invalid target path");await $e.ensureDir(r);const o=Ae.basename(t),i=Ae.join(r,o);return await $e.move(t,i,{overwrite:!1}),{success:!0}});he({mutationKey:["moveFile"],mutationFn:e=>em({data:e})});function tm(e){const t=e?.bounds||e?.attributes?.bounds,n=t?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0,r=e?.text??e?.attributes?.text??e?.name??void 0,o=e?.resourceId??e?.attributes?.["resource-id"]??void 0,i=e?.attributes?.["content-desc"]??e?.attributes?.["accessibility-text"]??e?.accessibilityText??void 0,a=e?.label??e?.attributes?.label??void 0,l=e?.accessibilityIdentifier??e?.attributes?.accessibilityIdentifier??void 0,u=e?.hint??e?.attributes?.hint??e?.value??e?.attributes?.value??void 0,c={...n?{bounds:n}:{},...r?{text:String(r)}:{},...o?{resourceId:String(o)}:{},...i?{contentDesc:String(i)}:{},...a?{accessibilityLabel:String(a)}:{},...l?{accessibilityIdentifier:String(l)}:{},...u?{hint:String(u)}:{}};return Object.keys(c).length>0?c:void 0}function nm(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){const r=tm(n);r&&t.push(r)}return t}const rm=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g,Ur=e=>{if(!e)return[];const t=new Set;let n;const r=new RegExp(rm);for(;(n=r.exec(e))!==null;)n[1]&&t.add(n[1]);return Array.from(t)},Et=(e,t)=>{const n=t?.required??!1;return({value:r})=>{const o=String(r??"").trim();if(!o)return n?"This field is required":void 0;const i=Ur(o);if(i.length===0)return;const a=e(),l=i.filter(u=>!Object.prototype.hasOwnProperty.call(a,u));if(l.length>0)return`Undefined params: ${l.join(", ")}`}},jr=L.number().min(0,"Must be 0 or greater");L.string().min(1,"This field is required");const la=L.enum(["up","down"]),om=L.enum(["in","out"]),im=L.string().min(1,"URL is required").regex(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/.+$/,"Invalid deeplink format (e.g., myapp://screen)"),Ce=e=>e.length?e.map(t=>typeof t=="string"?t:t?.message).filter(Boolean).join(", "):null,am=({step:e,onSave:t,onCancel:n})=>{const r=yn(()=>({id:Date.now(),type:"tap",descriptionText:"",optional:!1,timeout:3e3,useLlmOnly:!1,text:"",elementId:"",maxScrolls:15,direction:"down",url:"",instruction:"",path:""}),[]),{data:o}=Ke(zr),{data:i}=Ke(sa),a=oe.useCallback(()=>({...I.state.test.params,...i??{}}),[i]),l=new Set((o?.files||[]).filter(c=>c.type==="file").map(c=>c.path)),u=ks({defaultValues:{...r(),...e},onSubmit:({value:c})=>{if(c&&(c.type==="tap"||c.type==="assert")&&("x"in c&&delete c.x,"y"in c&&delete c.y),c.type==="fileRef"){const p=(c.path||"").trim();if(!p||o&&!l.has(p)){alert("The specified file does not exist in your tests directory.");return}}let f;switch(c.type){case"tap":f=Va.parse(c);break;case"assert":f=La.parse(c);break;case"type":f=Fa.parse(c);break;case"scroll":f=_a.parse(c);break;case"scrollUntil":f=ka.parse(c);break;case"deeplink":f=Ba.parse(c);break;case"ai":f=Ta.parse(c);break;case"fileRef":f=Ra.parse(c);break;default:f=Wo.parse(c)}if(!e)I.setState(p=>({...p,test:{...p.test,steps:[...p.test.steps,f]}}));else{const p=f.id;I.setState(d=>({...d,test:{...d.test,steps:d.test.steps.map(m=>m.id===p?f:m)}}))}t()}});return v(bm,{children:[s(H,{variant:"h6",gutterBottom:!0,children:e?"Edit Step":"Add New Step"}),s("form",{onSubmit:c=>{c.preventDefault(),c.stopPropagation(),u.handleSubmit()},children:v(ym,{children:[s(u.Field,{name:"type",validators:{onChange:Qr},children:c=>{const f=c.state.meta.errors.length>0;return v(Rt,{fullWidth:!0,error:f,children:[s(nn,{id:"step-type",children:"Step type"}),s(rn,{labelId:"step-type",id:"step-type",value:c.state.value,label:"Step type",onChange:p=>{const d=p.target.value,m=u.state.values.id;u.reset(),u.setFieldValue("id",m),u.setFieldValue("type",d)},onBlur:c.handleBlur,children:Qr.options.map(p=>s(gt,{value:p,children:p},p))}),f&&s(Sn,{children:Ce(c.state.meta.errors)})]})}}),s(tn,{sx:{mb:1}}),v(vm,{children:[s(Ue,{children:"General Settings"}),s(u.Field,{name:"descriptionText",validators:{onChange:Et(a,{required:!1})},children:c=>s(fe,{id:"description-text",label:"Description",value:c.state.value??"",onChange:f=>c.handleChange(f.target.value),onBlur:c.handleBlur,placeholder:"Enter a description (you can use {{key}})",helperText:Ce(c.state.meta.errors)??"Use {{key}} to insert a param value",error:c.state.meta.errors?.length>0})}),s(u.Field,{name:"optional",validators:{onChange:L.boolean().optional()},children:c=>s(On,{control:s(dr,{checked:c.state.value??!1,onChange:f=>c.handleChange(f.target.checked)}),label:"Optional"})})]}),s(u.Subscribe,{selector:c=>c.values.type,children:c=>{switch(c){case"tap":return s(cm,{form:u});case"assert":return s(dm,{form:u});case"type":return s(um,{form:u,getDefinedParams:a});case"scroll":return s(pm,{form:u});case"zoom":return s(fm,{form:u});case"scrollUntil":return s(mm,{form:u,getDefinedParams:a});case"deeplink":return s(hm,{form:u,getDefinedParams:a});case"ai":return s(gm,{form:u,getDefinedParams:a});case"fileRef":return s(sm,{form:u,getDefinedParams:a});default:return null}}}),v(xm,{children:[s(ke,{startIcon:s(_s,{}),variant:"contained",type:"submit",children:"Save"}),s(ke,{startIcon:s(Fs,{}),variant:"outlined",color:"error",onClick:n,children:"Cancel"})]})]})})]})},sm=({form:e,getDefinedParams:t})=>{const{data:n,isLoading:r}=Ke(zr),o=new Set((n?.files||[]).filter(i=>i.type==="file").map(i=>i.path));return v(st,{children:[s(Ue,{children:"File Reference"}),s(e.Field,{name:"path",validators:{onChange:({value:i})=>{const a=String(i??"").trim();if(!a)return"This field is required";if(Ur(a).length>0)return Et(t,{required:!0})({value:a});if(!r&&n&&!o.has(a))return"File not found in tests directory"}},children:i=>{const a=i.state.meta.errors?.length>0,l=a?Ce(i.state.meta.errors):r?"Checking files...":"Path is relative to your tests directory (supports {{key}})";return s(fe,{id:"file-path",label:"File path",placeholder:"e.g., test2.json or subfolder/flow.json (you can use {{key}})",value:i.state.value??"",onChange:u=>i.handleChange(u.target.value),onBlur:i.handleBlur,error:a,helperText:l,fullWidth:!0})}}),s(e.Subscribe,{selector:i=>({path:i.values.path,overrides:i.values.overrides}),children:({path:i,overrides:a})=>s(lm,{path:i,overrides:a,onChange:l=>e.setFieldValue("overrides",l),validPaths:o})})]})},lm=({path:e,overrides:t,onChange:n,validPaths:r})=>{const[o,i]=oe.useState(!1),[a,l]=oe.useState({}),u=G(Hr);oe.useEffect(()=>{let d=!1;return(async()=>{if(!e||!r.has(e)){l({});return}i(!0);try{const m=(await u.mutateAsync({path:e}))?.content;Array.isArray(m)?l({}):l(m&&typeof m=="object"?m.params||{}:{})}catch{l({})}finally{d||i(!1)}})(),()=>{d=!0}},[e]);const c=t||{},f=(d,m)=>{const g={...c};m?g[d]=m:delete g[d],n(g)},p=Object.keys(a);return e?v(re,{sx:{mt:2},children:[s(H,{variant:"subtitle2",children:"Param overrides"}),o?s(H,{variant:"caption",color:"text.secondary",children:"Loading referenced test…"}):p.length===0?s(H,{variant:"caption",color:"text.secondary",children:"Referenced test has no params"}):s(re,{sx:{display:"flex",flexDirection:"column",gap:1,mt:1},children:p.map(d=>v(re,{sx:{display:"grid",gridTemplateColumns:"160px 1fr",gap:1,alignItems:"center"},children:[s(fe,{size:"small",label:"Key",value:d,disabled:!0}),v(re,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[s(fe,{size:"small",label:"Default",value:a[d]??"",disabled:!0}),s(fe,{size:"small",label:"Override (optional)",value:c[d]??"",onChange:m=>f(d,m.target.value)})]})]},d))})]}):null},cm=({form:e})=>v(st,{children:[s(Ue,{children:"Tap Configuration"}),s(e.Field,{name:"timeout",validators:{onChange:jr},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:Ce(t.state.meta.errors)})}}),s(e.Field,{name:"elementId",validators:{onChange:L.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{id:"tap-element-id",label:"Element Identifier (elementId)",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"Android: com.app:id/button | iOS: accessibilityIdentifier/name/label",error:n,helperText:Ce(t.state.meta.errors)??(I.state.selectedPlatform==="ios"?"Optional. iOS: prefer accessibilityIdentifier, otherwise name/label. Supports index like value[2].":"Optional. Android: resource-id (e.g., com.app:id/button). Supports index like id[2].")})}}),s(e.Field,{name:"useLlmOnly",validators:{onChange:L.boolean().optional()},children:t=>s(On,{control:s(dr,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),dm=({form:e})=>v(st,{children:[s(Ue,{children:"Assert Configuration"}),s(e.Field,{name:"timeout",validators:{onChange:jr},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{type:"number",id:"timeout",label:"Timeout (ms)",value:t.state.value??0,onChange:r=>t.handleChange(parseInt(r.target.value)||0),onBlur:t.handleBlur,placeholder:"Enter timeout",error:n,helperText:Ce(t.state.meta.errors)})}}),s(e.Field,{name:"elementId",validators:{onChange:L.string().optional()},children:t=>{const n=t.state.meta.errors?.length>0;return s(fe,{id:"assert-element-id",label:"Resource ID (elementId)",value:t.state.value??"",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,placeholder:"e.g. com.app:id/label or com.app:id/label[1]",error:n,helperText:Ce(t.state.meta.errors)??"Optional. Android resource-id of the element to assert."})}}),s(e.Field,{name:"useLlmOnly",validators:{onChange:L.boolean().optional()},children:t=>s(On,{control:s(dr,{checked:t.state.value??!1,onChange:n=>t.handleChange(n.target.checked)}),label:"Use LLM only"})})]}),um=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"Type Configuration"}),s(e.Field,{name:"text",validators:{onChange:Et(t,{required:!0})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"text",label:"Text to type",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Enter text to type (you can use {{key}})",multiline:!0,rows:3,error:r,helperText:Ce(n.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),pm=({form:e})=>v(st,{children:[s(Ue,{children:"Scroll Configuration"}),s(e.Field,{name:"direction",validators:{onChange:la},children:t=>{const n=t.state.meta.errors?.length>0;return v(Rt,{fullWidth:!0,error:n,children:[s(nn,{id:"scroll-direction",children:"Direction"}),v(rn,{labelId:"scroll-direction",id:"scroll-direction",value:t.state.value??"down",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[s(gt,{value:"up",children:"Up"}),s(gt,{value:"down",children:"Down"})]}),n&&s(Sn,{children:Ce(t.state.meta.errors)})]})}})]}),fm=({form:e})=>v(st,{children:[s(Ue,{children:"Zoom Configuration"}),s(e.Field,{name:"direction",validators:{onChange:om},children:t=>{const n=t.state.meta.errors?.length>0;return v(Rt,{fullWidth:!0,error:n,children:[s(nn,{id:"zoom-direction",children:"Direction"}),v(rn,{labelId:"zoom-direction",id:"zoom-direction",value:t.state.value??"in",label:"Direction",onChange:r=>t.handleChange(r.target.value),onBlur:t.handleBlur,children:[s(gt,{value:"in",children:"In (spread)"}),s(gt,{value:"out",children:"Out (pinch)"})]}),n&&s(Sn,{children:Ce(t.state.meta.errors)})]})}})]}),mm=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"Scroll Until Configuration"}),s(e.Field,{name:"direction",validators:{onChange:la},children:n=>{const r=n.state.meta.errors?.length>0;return v(Rt,{fullWidth:!0,error:r,children:[s(nn,{id:"scroll-until-direction",children:"Direction"}),v(rn,{labelId:"scroll-until-direction",id:"scroll-until-direction",value:n.state.value??"down",label:"Direction",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,children:[s(gt,{value:"up",children:"Up"}),s(gt,{value:"down",children:"Down"})]}),r&&s(Sn,{children:Ce(n.state.meta.errors)})]})}}),s(e.Field,{name:"maxScrolls",validators:{onChange:jr},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{type:"number",id:"max-scrolls",label:"Max Scrolls",value:n.state.value??15,onChange:o=>n.handleChange(parseInt(o.target.value)||15),onBlur:n.handleBlur,placeholder:"Maximum scroll attempts",error:r,helperText:Ce(n.state.meta.errors)??"Maximum number of scroll attempts (default: 15)"})}}),s(Ue,{sx:{mt:1},children:"Stop Condition (at least one)"}),s(e.Field,{name:"text",validators:{onChange:Et(t,{required:!1})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"scroll-until-text",label:"Text to find",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Text content to scroll until visible (supports {{key}})",error:r,helperText:Ce(n.state.meta.errors)??"Scroll until this text (with params resolved) is visible on screen"})}}),s(e.Field,{name:"elementId",validators:{onChange:Et(t,{required:!1})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"scroll-until-element-id",label:"Element ID",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Element ID to scroll until visible (supports {{key}})",error:r,helperText:Ce(n.state.meta.errors)??"Scroll until element with this ID (after resolving params) is visible"})}})]}),hm=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"Deeplink Configuration"}),s(e.Field,{name:"url",validators:{onChange:({value:n})=>{const r=String(n??"").trim();if(!r)return"URL is required";if(Ur(r).length>0)return Et(t,{required:!0})({value:r});const o=im.safeParse(r);return o.success?void 0:o.error.issues[0]?.message||"Invalid URL"}},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"url",label:"URL",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Enter deeplink URL (you can use {{key}})",fullWidth:!0,error:r,helperText:Ce(n.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),gm=({form:e,getDefinedParams:t})=>v(st,{children:[s(Ue,{children:"AI Configuration"}),s(e.Field,{name:"instruction",validators:{onChange:Et(t,{required:!0})},children:n=>{const r=n.state.meta.errors?.length>0;return s(fe,{id:"instruction",label:"AI Instruction",value:n.state.value??"",onChange:o=>n.handleChange(o.target.value),onBlur:n.handleBlur,placeholder:"Enter instruction for AI to execute (you can use {{key}})",multiline:!0,rows:4,error:r,helperText:Ce(n.state.meta.errors)??"Use {{key}} to insert a param value"})}})]}),bm=wt(re)`
178
178
  padding: 1.5rem;
179
179
  margin-bottom: 1.5rem;
180
180
  `,ym=wt(re)`
@@ -276,7 +276,7 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
276
276
  background: rgba(255,255,255,0.9);
277
277
  border-radius: 50%;
278
278
  padding: 2px;
279
- `,pn=new ma({open:!1,maintainDisplayed:!1});function Rm(){pn.setState(e=>({...e,open:!1}))}function qr(e,t){pn.setState({type:"success",title:t?.title??"Success",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function ar(e,t){pn.setState({type:"error",title:t?.title??"Error",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function $m(e,t){pn.setState({type:"info",title:t?.title,description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}const Tm=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g;function Bm(e,t){const n=new Set;return{value:e.replace(Tm,(r,o)=>Object.prototype.hasOwnProperty.call(t,o)?t[o]??"":(n.add(o),"")),missing:Array.from(n)}}function St(e,t){const n={...e},r={},o=i=>{const a=n[i];if(typeof a=="string"&&a.includes("{{")){const{value:l,missing:u}=Bm(a,t);n[i]=l,u.length&&(r[i]=u)}};return o("descriptionText"),o("text"),o("elementId"),o("url"),o("instruction"),o("path"),{step:n,missingMap:r}}const km=({step:e,index:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>{const a={stepNumber:t+1,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i};switch(e.type){case"tap":return s(Rp,{step:e,...a});case"assert":return s($p,{step:e,...a});case"type":return s(Tp,{step:e,...a});case"scroll":return s(Bp,{step:e,...a});case"swipe":return s(kp,{step:e,...a});case"zoom":return s(_p,{step:e,...a});case"scrollUntil":return s(Fp,{step:e,...a});case"deeplink":return s(Lp,{step:e,...a});case"ai":return s(Vp,{step:e,...a});case"fileRef":return s(Ap,{step:e,...a});default:return null}},_m=({onSave:e,canSave:t})=>{const[n,r]=pe(!1),[o,i]=pe(void 0),a=ve(I,b=>b.isRecording),l=ve(I,b=>b.test.steps),u=ve(I,b=>b.isPlaying),c=ve(I,b=>b.selectedPlatform),f=ve(I,b=>b.selectedDeviceId),{data:p=[]}=Ke(na),d=W(null),m=()=>{I.setState(b=>({...b,isRecording:!b.isRecording}))},g=G(Lr),y=G(Vr),x=G(Mr),D=G(Jp),E=G(nf),P=G(Qp),N=G(Gr);G(yf);const $=G(uf),A=G(Of),q=G(Wr),Q=G(Rf),ge=G(Hr),de=Nn(),w=(b,C,R)=>{I.setState(T=>({...T,test:{...T.test,steps:T.test.steps.map(M=>M.id===b?{...M,status:C,statusColor:R}:M)}}))},ee=b=>{I.setState(C=>({...C,currentStepId:b}))},{data:Ie}=Ke(sa),Se=b=>new Promise(C=>setTimeout(C,b)),Ct=async()=>{try{const b=await $.mutateAsync({platform:c,deviceId:f});if(!b.success||!b.base64)throw new Error(b.error||"Failed to capture screenshot");const C=(b.base64.length*.75/(1024*1024)).toFixed(2);return console.log(`[Editor] Captured screenshot: ~${C} MB (${b.base64.length} chars)`),b.base64}catch(b){throw console.error("Screenshot failed:",b),b}},F=b=>new Promise(C=>{const R=new Image;R.onload=()=>C({width:R.naturalWidth,height:R.naturalHeight}),R.src=b}),K=async(b,C,R,T,M=[],ue)=>{w(b,"Starting Smart Loop...","purple");try{let le=0;const Y=15;let te=[...M],B,ne=!1;const X=[];for(;le<Y;){if(d.current?.signal.aborted)throw new Error("Aborted");let U="",Z=[],me=!1;const Nt=2e3,dt=500,be=Math.floor(Nt/dt);for(let j=0;j<be;j++){if(d.current?.signal.aborted)throw new Error("Aborted");U=await Ct();try{const{width:ce,height:ye}=await F(U);console.log(`Checking cache (Attempt ${j+1}/${be}) with:`,{stepNumber:C,description:R,platform:c,resolution:{width:ce,height:ye},highest_used_index:B});const it=await A.mutateAsync({stepNumber:C,stepDescription:R,filepath:void 0,screenshot:U,platform:c,screenResolution:{width:ce,height:ye},highest_used_index:B});if(console.log("Cache result:",it),it.found&&it.cacheCommands){Z=it.cacheCommands,B=it.cacheIndex,me=!0,w(b,`Cache Hit! (${Z.length} cmds)`,"green");break}}catch(ce){console.warn("Cache check failed:",ce)}j<be-1&&(w(b,`Cache miss, retrying... (${j+1}/${be})`,"orange"),await Se(dt))}I.setState(j=>({...j,executionLog:[...j.executionLog,{stepId:b,stepNumber:C,screenshot:U,cacheHit:me,timestamp:Date.now()}]}));let Ee=[],Be=[];if(!me){ne=!0,w(b,"Cache Miss. Asking AI...","orange");let j;if(ue)try{const ze=await de.fetchQuery(ta({enabled:!0}));j=nm(ze.elements)}catch(ze){console.warn("Failed to fetch visible elements for uiHierarchy:",ze)}const ce=await Q.mutateAsync({base64_screenshot:U.replace(/^data:image\/\w+;base64,/,""),instruction:T,action_history:te,elementId:ue,uiHierarchy:j});Be=ce.appetizeCommands||[];const ye=ce.gptCommands?.findIndex(ze=>ze.startsWith("reasoning:"));if(ye!==-1){Ee=ce.gptCommands?.slice(ye)||[];const ze=Ee.filter(Vt=>Vt.startsWith("remember:"));ze?.length>0&&M.push(...ze),te=[...te,...Ee]}const it=ce.gptCommands||[];Z=[...Be]}X.push({screenshot:U,commands:Be.length>0?Be:Z});let Oe=!1,ut=!1;Z.length>0&&(console.log(`[Step ${b}] Executing commands:`,Z),me&&w(b,`Executing ${Z.length} cached commands...`,"blue"));for(const j of Z){if(d.current?.signal.aborted)throw new Error("Aborted");if(j.toLowerCase().includes("task complete:")){ut=!0;continue}if(j.toLowerCase().includes("error detected:"))throw new Error(`AI Reported Error: ${j}`);if(j.startsWith("remember:")&&M.push(j),j.match(/^t(ap|ab)On:/)){console.log(`Tap Match: ${j}`);let ce,ye;const it=j.match(/x=(\d+)/),ze=j.match(/y=(\d+)/);if(it&&ze)ce=parseInt(it[1],10),ye=parseInt(ze[1],10);else{const Vt=j.split(";");Vt.length>=3&&(ce=parseInt(Vt[1],10),ye=parseInt(Vt[2],10))}console.log(`Tap: ${ce},${ye}`),ce!==void 0&&ye!==void 0&&(w(b,`Exec: Tap ${ce},${ye}`,"blue"),await g.mutateAsync({x:ce,y:ye,platform:c,deviceId:f}),Oe=!0)}else if(j.startsWith("wait:")){const ce=j.match(/wait:\s*(\d+)/)?.[1];if(ce){const ye=parseInt(ce,10);w(b,`Exec: Wait ${ye}s`,"blue"),await Se(ye*1e3),Oe=!0}}else if(j.startsWith("scroll:")){const ce=j.match(/scroll:\s*(up|down)/i)?.[1];ce&&(w(b,`Scroll ${ce}`,"blue"),await x.mutateAsync({direction:ce.toLowerCase(),platform:c,deviceId:f}),Oe=!0)}}if(Oe&&(me&&te.push(...Z),await Se(100)),ut){if(w(b,"Task Completed.","green"),ne){w(b,"Populating Cache...","green");try{await q.mutateAsync({stepNumber:C,stepDescription:R,filepath:void 0,executionData:X,platform:c,screenResolution:await F(X[0].screenshot)}),console.log("Cache populated successfully")}catch(j){console.error("Failed to populate cache:",j)}}else console.log("Skipping cache population (all actions cached)"),w(b,"Task Completed (Cached)","green");return!0}le++}throw new Error("Smart Loop Timeout")}catch(le){throw le}},k=async(b,C,R,T=[])=>{if(R.aborted)return!1;ee(b.id),w(b.id,"Executing...","blue");const M={platform:c,deviceId:f},ue=Date.now();try{let le;const Y=()=>I.state.currentScreenshot||void 0;switch(b.type){case"tap":{let B=b.descriptionText;B||(b.elementId&&b.elementId.trim()?B=`tap the element with id "${b.elementId}"`:b.x!==void 0&&b.y!==void 0?B=`tap on the screen at x=${b.x} y=${b.y}`:B="tap on the screen"),await K(b.id,C,b.descriptionText||"tap",B,T,b.elementId);break}case"swipe":{const B=b,ne=typeof B.duration=="number"?B.duration:500;let X=1080,U=1920;try{const Be=await Ct(),Oe=await F(Be);X=Oe.width,U=Oe.height}catch(Be){console.warn("Falling back to default screen size for swipe computation",Be)}let Z;typeof B.x=="number"?Z=Math.round(B.x):Z=B.direction==="left"?Math.round(X*.8):Math.round(X*.2);let me;typeof B.y=="number"?me=Math.round(B.y):me=Math.round(U*.5);const Nt=Math.max(80,Math.round(X*.5));let dt=B.direction==="left"?Z-Nt:Z+Nt,be=me;const Ee=5;Z=Math.min(Math.max(Ee,Z),X-Ee),me=Math.min(Math.max(Ee,me),U-Ee),dt=Math.min(Math.max(Ee,dt),X-Ee),be=Math.min(Math.max(Ee,be),U-Ee),await N.mutateAsync({x1:Z,y1:me,x2:dt,y2:be,duration:ne,...M}),w(b.id,"Swipe Performed","green");break}case"assert":{let B=`Verify that: ${b.descriptionText}`;!b.descriptionText&&b.elementId&&(B=`Verify element with id ${b.elementId} exists`),await K(b.id,C,b.descriptionText||"assert",B,T,b.elementId),w(b.id,"Assertion Passed","green");break}case"ai":{const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.instruction?.length)throw new Error(`Missing params for placeholders -> instruction: ${X.instruction.join(", ")}`);await K(b.id,C,ne.instruction,ne.instruction,T);break}case"type":{le=Y();const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(Object.keys(X).length){const U=Object.entries(X).map(([Z,me])=>`${Z}: ${me.join(", ")}`).join("; ");throw new Error(`Missing params for placeholders -> ${U}`)}await y.mutateAsync({text:ne.text,...M}),w(b.id,"Typed","green");break}case"scroll":{le=Y(),await x.mutateAsync({direction:b.direction,...M}),w(b.id,"Scrolled","green");break}case"zoom":{le=Y(),await P.mutateAsync({direction:b.direction,...M}),w(b.id,"Zoomed","green");break}case"scrollUntil":{le=Y();const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.text?.length)throw new Error(`Missing params for placeholders -> text: ${X.text.join(", ")}`);w(b.id,"Scrolling until found...","blue");const U=await D.mutateAsync({text:ne.text,elementId:ne.elementId,direction:ne.direction,maxScrolls:ne.maxScrolls,...M});if(U.success)w(b.id,`Found after ${U.scrolls??0} scrolls`,"green");else throw new Error("Target not found after scrolling");break}case"deeplink":{le=Y();const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.url?.length)throw new Error(`Missing params for placeholders -> url: ${X.url.join(", ")}`);await E.mutateAsync({url:ne.url,...M}),w(b.id,"Opened deeplink","green");break}case"fileRef":{w(b.id,"Loading steps from file...","blue");const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.path?.length)throw new Error(`Missing params for placeholders -> path: ${X.path.join(", ")}`);const U=(await ge.mutateAsync({path:ne.path}))?.content;let Z=[],me={};if(Array.isArray(U))Z=U;else if(U&&Array.isArray(U.steps))Z=U.steps,me=U.params||{};else throw new Error("Referenced file must be an array or an object with steps");const Nt={...Ie,...I.state.test.params,...me,...b.overrides},dt=Wo.array().parse(Z).map((be,Ee)=>{const Be=typeof be.id=="number"?be.id:Date.now()+Ee,{step:Oe,missingMap:ut}=St(be,Nt);if(Oe.type==="type"&&ut.text?.length||Oe.type==="scrollUntil"&&ut.text?.length||Oe.type==="deeplink"&&ut.url?.length||Oe.type==="ai"&&ut.instruction?.length){const j=[];for(const[ce,ye]of Object.entries(ut))ye.length&&j.push(`${ce}: ${ye.join(", ")}`);throw new Error(`Referenced step has missing params -> ${j.join("; ")}`)}return{id:Be,...Oe,originRef:{refId:b.id,path:b.path,descriptionText:b.descriptionText,optional:b.optional,overrides:b.overrides}}});I.setState(be=>{const Ee=be.test.steps.findIndex(Oe=>Oe.id===b.id);if(Ee===-1)return be;const Be=[...be.test.steps];return Be.splice(Ee,1,...dt),{...be,test:{...be.test,steps:Be}}}),w(b.id,"Expanded steps from file","green");break}}await Se(100);const te=Date.now()-ue;return console.log(`[Step ${b.id}] Execution Finished. Total Duration: ${te}ms`),le&&I.setState(B=>({...B,executionLog:[...B.executionLog,{stepId:b.id,stepNumber:C,screenshot:le,cacheHit:!1,timestamp:Date.now()}]})),!0}catch(le){const Y=le instanceof Error?le.message:"Unknown error";return b.optional?(w(b.id,`Failed (optional): ${Y}`,"orange"),!0):(w(b.id,`Error: ${Y}`,"red"),!1)}},$e=()=>{I.setState(b=>{const C=b.test.steps,R=[],T=new Set,M=new Set;let ue=0;for(;ue<C.length;){const Y=C[ue];if(Y?.type==="fileRef"){const te=Y.path;if(M.has(te)){ue++;continue}T.add(Y.id),M.add(te),R.push(Y),ue++;continue}if(Y&&Y.originRef){const te=Y.originRef.refId,B=Y.originRef.path,ne=Y.originRef.descriptionText,X=Y.originRef.optional;let U=ue;for(;U<C.length&&C[U]?.originRef?.refId===te;)U++;if(T.has(te)||M.has(B)){ue=U;continue}const Z={id:te,type:"fileRef",path:B,descriptionText:ne,optional:X,overrides:Y?.originRef?.overrides};R.some(me=>me.id===Z.id)&&(Z.id=Date.now()),R.push(Z),T.add(Z.id),M.add(B),ue=U;continue}R.push(Y),ue++}const le=[];for(const Y of R){const te=le[le.length-1];te?.type==="fileRef"&&Y?.type==="fileRef"&&te.path===Y.path||le.push(Y)}return{...b,test:{...b.test,steps:le}}})},Te=async(b,C)=>{if(console.log("Running playback from index:",b),I.state.test.steps.length===0){alert("No steps to play!");return}d.current=new AbortController;const R=d.current.signal;I.setState(te=>({...te,isPlaying:!0})),I.setState(te=>({...te,test:{...te.test,steps:te.test.steps.map((B,ne)=>ne>=b?{...B,status:"",statusColor:""}:B)},executionLog:[]}));let T=b;const M=b+1,ue=[];let le=!1,Y;for(;!R.aborted;){const te=I.state.test.steps,B=C?M:te.length;if(T>=B)break;const ne=te[T],X=ne.type;if(!await k(ne,T+1,R,ue)&&!ne.optional){le=!0,Y=I.state.test.steps.find(U=>U.id===ne.id)?.status||"Execution failed";break}if(X==="fileRef"){if(C)break;continue}T++}await Se(500),$e(),ee(null),I.setState(te=>({...te,isPlaying:!1})),d.current=null,R.aborted||(le?ar(Y||"Playback failed",{title:"Execution Failed"}):qr("Playback finished successfully",{title:"Execution Completed"}))},qe=()=>Te(0,!1),_t=b=>{const C=l.findIndex(R=>R.id===b);C!==-1&&Te(C,!0)},yt=b=>{const C=l.findIndex(R=>R.id===b);C!==-1&&Te(C,!1)},lt=()=>{d.current?.abort(),$e(),I.setState(b=>({...b,isPlaying:!1})),ee(null),$m("Playback stopped",{title:"Stopped"})},rt=b=>{i(b),r(!1)},ot=()=>{r(!1),i(void 0)},We=()=>{r(!1),i(void 0)},fn=b=>{confirm("Delete this step?")&&I.setState(C=>({...C,test:{...C.test,steps:C.test.steps.filter(R=>R.id!==b)}}))},Ft=()=>{confirm("Are you sure you want to clear all steps?")&&I.setState(b=>({...b,test:{...b.test,steps:[]}}))},Lt=u||a,ct=n||!!o;return v(Fm,{$hasForm:ct,children:[v(Gm,{children:[s(fe,{variant:"standard",value:ve(I,b=>b.test.name),onChange:b=>{I.setState(C=>({...C,test:{...C.test,name:b.target.value}}))},placeholder:"Untitled",InputProps:{disableUnderline:!0,style:{fontSize:"1.5rem",fontWeight:500}},fullWidth:!0,sx:{mr:2}}),e&&s(ke,{variant:"contained",color:"primary",onClick:e,disabled:!t||u,sx:{flexShrink:0},children:"Save"})]}),s(tn,{}),v(Lm,{children:[s(ke,{variant:a?"contained":"outlined",color:a?"error":"primary",startIcon:a?s(Lo,{}):s(Ea,{}),onClick:m,children:a?"Stop Recording":"Record"}),u?s(ke,{variant:"contained",color:"error",onClick:lt,children:"Stop"}):s(ke,{variant:"contained",disabled:a||l.length===0,onClick:qe,startIcon:s(wa,{}),children:"Run from start"}),s(ke,{variant:"outlined",disabled:Lt||l.length===0,onClick:Ft,children:"Clear All"})]}),s(lr,{open:n||!!o,onClose:We,maxWidth:"md",fullWidth:!0,children:s(cr,{children:s(re,{pt:1,children:s(am,{step:o,onSave:ot,onCancel:We})})})}),v(Vm,{children:[l.length===0?s(Mm,{children:s(H,{color:"text.secondary",children:"No steps recorded yet. Enable recording and click on the device screen to add steps."})}):s(Wi,{onDragEnd:b=>{const{source:C,destination:R}=b;if(!R||C.index===R.index)return;const T=[...I.state.test.steps],[M]=T.splice(C.index,1);T.splice(R.index,0,M),I.setState(ue=>({...ue,test:{...ue.test,steps:T}}))},children:s(In,{droppableId:"steps-droppable",children:b=>v("div",{ref:b.innerRef,...b.droppableProps,children:[l.map((C,R)=>s(kr,{draggableId:String(C.id),index:R,children:(T,M)=>s("div",{ref:T.innerRef,...T.draggableProps,...T.dragHandleProps,style:{...T.draggableProps.style,opacity:M.isDragging?.9:1},children:s(km,{step:C,index:R,onPlay:()=>_t(C.id),onPlayFromHere:()=>yt(C.id),onEdit:()=>rt(C),onDelete:()=>fn(C.id)})})},C.id)),b.placeholder]})})}),!ct&&s(re,{mt:2,display:"flex",justifyContent:"center",children:s(ke,{variant:"contained",disabled:Lt,onClick:()=>r(!0),fullWidth:!0,children:"+ Add Step"})})]}),s(Dm,{})]})},Fm=_(_n)`
279
+ `,pn=new ma({open:!1,maintainDisplayed:!1});function $m(){pn.setState(e=>({...e,open:!1}))}function qr(e,t){pn.setState({type:"success",title:t?.title??"Success",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function ar(e,t){pn.setState({type:"error",title:t?.title??"Error",description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}function Rm(e,t){pn.setState({type:"info",title:t?.title,description:e,listContent:t?.listContent,open:!0,maintainDisplayed:t?.maintainDisplayed??!1})}const Tm=/\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g;function Bm(e,t){const n=new Set;return{value:e.replace(Tm,(r,o)=>Object.prototype.hasOwnProperty.call(t,o)?t[o]??"":(n.add(o),"")),missing:Array.from(n)}}function St(e,t){const n={...e},r={},o=i=>{const a=n[i];if(typeof a=="string"&&a.includes("{{")){const{value:l,missing:u}=Bm(a,t);n[i]=l,u.length&&(r[i]=u)}};return o("descriptionText"),o("text"),o("elementId"),o("url"),o("instruction"),o("path"),{step:n,missingMap:r}}const km=({step:e,index:t,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i})=>{const a={stepNumber:t+1,onPlay:n,onPlayFromHere:r,onEdit:o,onDelete:i};switch(e.type){case"tap":return s($p,{step:e,...a});case"assert":return s(Rp,{step:e,...a});case"type":return s(Tp,{step:e,...a});case"scroll":return s(Bp,{step:e,...a});case"swipe":return s(kp,{step:e,...a});case"zoom":return s(_p,{step:e,...a});case"scrollUntil":return s(Fp,{step:e,...a});case"deeplink":return s(Lp,{step:e,...a});case"ai":return s(Vp,{step:e,...a});case"fileRef":return s(Ap,{step:e,...a});default:return null}},_m=({onSave:e,canSave:t})=>{const[n,r]=pe(!1),[o,i]=pe(void 0),a=ve(I,b=>b.isRecording),l=ve(I,b=>b.test.steps),u=ve(I,b=>b.isPlaying),c=ve(I,b=>b.selectedPlatform),f=ve(I,b=>b.selectedDeviceId),{data:p=[]}=Ke(na),d=W(null),m=()=>{I.setState(b=>({...b,isRecording:!b.isRecording}))},g=G(Lr),y=G(Vr),x=G(Mr),D=G(Jp),E=G(nf),P=G(Qp),N=G(Gr);G(yf);const R=G(uf),A=G(Of),q=G(Wr),Q=G($f),ge=G(Hr),de=Nn(),w=(b,C,$)=>{I.setState(T=>({...T,test:{...T.test,steps:T.test.steps.map(M=>M.id===b?{...M,status:C,statusColor:$}:M)}}))},ee=b=>{I.setState(C=>({...C,currentStepId:b}))},{data:Ie}=Ke(sa),Se=b=>new Promise(C=>setTimeout(C,b)),Ct=async()=>{try{const b=await R.mutateAsync({platform:c,deviceId:f});if(!b.success||!b.base64)throw new Error(b.error||"Failed to capture screenshot");const C=(b.base64.length*.75/(1024*1024)).toFixed(2);return console.log(`[Editor] Captured screenshot: ~${C} MB (${b.base64.length} chars)`),b.base64}catch(b){throw console.error("Screenshot failed:",b),b}},F=b=>new Promise(C=>{const $=new Image;$.onload=()=>C({width:$.naturalWidth,height:$.naturalHeight}),$.src=b}),K=async(b,C,$,T,M=[],ue)=>{w(b,"Starting Smart Loop...","purple");try{let le=0;const Y=15;let te=[...M],B,ne=!1;const X=[];for(;le<Y;){if(d.current?.signal.aborted)throw new Error("Aborted");let U="",Z=[],me=!1;const Nt=2e3,dt=500,be=Math.floor(Nt/dt);for(let j=0;j<be;j++){if(d.current?.signal.aborted)throw new Error("Aborted");U=await Ct();try{const{width:ce,height:ye}=await F(U);console.log(`Checking cache (Attempt ${j+1}/${be}) with:`,{stepNumber:C,description:$,platform:c,resolution:{width:ce,height:ye},highest_used_index:B});const it=await A.mutateAsync({stepNumber:C,stepDescription:$,filepath:void 0,screenshot:U,platform:c,screenResolution:{width:ce,height:ye},highest_used_index:B});if(console.log("Cache result:",it),it.found&&it.cacheCommands){Z=it.cacheCommands,B=it.cacheIndex,me=!0,w(b,`Cache Hit! (${Z.length} cmds)`,"green");break}}catch(ce){console.warn("Cache check failed:",ce)}j<be-1&&(w(b,`Cache miss, retrying... (${j+1}/${be})`,"orange"),await Se(dt))}I.setState(j=>({...j,executionLog:[...j.executionLog,{stepId:b,stepNumber:C,screenshot:U,cacheHit:me,timestamp:Date.now()}]}));let Ee=[],Be=[];if(!me){ne=!0,w(b,"Cache Miss. Asking AI...","orange");let j;if(ue)try{const ze=await de.fetchQuery(ta({enabled:!0}));j=nm(ze.elements)}catch(ze){console.warn("Failed to fetch visible elements for uiHierarchy:",ze)}const ce=await Q.mutateAsync({base64_screenshot:U.replace(/^data:image\/\w+;base64,/,""),instruction:T,action_history:te,elementId:ue,uiHierarchy:j});Be=ce.appetizeCommands||[];const ye=ce.gptCommands?.findIndex(ze=>ze.startsWith("reasoning:"));if(ye!==-1){Ee=ce.gptCommands?.slice(ye)||[];const ze=Ee.filter(Vt=>Vt.startsWith("remember:"));ze?.length>0&&M.push(...ze),te=[...te,...Ee]}const it=ce.gptCommands||[];Z=[...Be]}X.push({screenshot:U,commands:Be.length>0?Be:Z});let Oe=!1,ut=!1;Z.length>0&&(console.log(`[Step ${b}] Executing commands:`,Z),me&&w(b,`Executing ${Z.length} cached commands...`,"blue"));for(const j of Z){if(d.current?.signal.aborted)throw new Error("Aborted");if(j.toLowerCase().includes("task complete:")){ut=!0;continue}if(j.toLowerCase().includes("error detected:"))throw new Error(`AI Reported Error: ${j}`);if(j.startsWith("remember:")&&M.push(j),j.match(/^t(ap|ab)On:/)){console.log(`Tap Match: ${j}`);let ce,ye;const it=j.match(/x=(\d+)/),ze=j.match(/y=(\d+)/);if(it&&ze)ce=parseInt(it[1],10),ye=parseInt(ze[1],10);else{const Vt=j.split(";");Vt.length>=3&&(ce=parseInt(Vt[1],10),ye=parseInt(Vt[2],10))}console.log(`Tap: ${ce},${ye}`),ce!==void 0&&ye!==void 0&&(w(b,`Exec: Tap ${ce},${ye}`,"blue"),await g.mutateAsync({x:ce,y:ye,platform:c,deviceId:f}),Oe=!0)}else if(j.startsWith("wait:")){const ce=j.match(/wait:\s*(\d+)/)?.[1];if(ce){const ye=parseInt(ce,10);w(b,`Exec: Wait ${ye}s`,"blue"),await Se(ye*1e3),Oe=!0}}else if(j.startsWith("scroll:")){const ce=j.match(/scroll:\s*(up|down)/i)?.[1];ce&&(w(b,`Scroll ${ce}`,"blue"),await x.mutateAsync({direction:ce.toLowerCase(),platform:c,deviceId:f}),Oe=!0)}}if(Oe&&(me&&te.push(...Z),await Se(100)),ut){if(w(b,"Task Completed.","green"),ne){w(b,"Populating Cache...","green");try{await q.mutateAsync({stepNumber:C,stepDescription:$,filepath:void 0,executionData:X,platform:c,screenResolution:await F(X[0].screenshot)}),console.log("Cache populated successfully")}catch(j){console.error("Failed to populate cache:",j)}}else console.log("Skipping cache population (all actions cached)"),w(b,"Task Completed (Cached)","green");return!0}le++}throw new Error("Smart Loop Timeout")}catch(le){throw le}},k=async(b,C,$,T=[])=>{if($.aborted)return!1;ee(b.id),w(b.id,"Executing...","blue");const M={platform:c,deviceId:f},ue=Date.now();try{let le;const Y=()=>I.state.currentScreenshot||void 0;switch(b.type){case"tap":{let B=b.descriptionText;B||(b.elementId&&b.elementId.trim()?B=`tap the element with id "${b.elementId}"`:b.x!==void 0&&b.y!==void 0?B=`tap on the screen at x=${b.x} y=${b.y}`:B="tap on the screen"),await K(b.id,C,b.descriptionText||"tap",B,T,b.elementId);break}case"swipe":{const B=b,ne=typeof B.duration=="number"?B.duration:500;let X=1080,U=1920;try{const Be=await Ct(),Oe=await F(Be);X=Oe.width,U=Oe.height}catch(Be){console.warn("Falling back to default screen size for swipe computation",Be)}let Z;typeof B.x=="number"?Z=Math.round(B.x):Z=B.direction==="left"?Math.round(X*.8):Math.round(X*.2);let me;typeof B.y=="number"?me=Math.round(B.y):me=Math.round(U*.5);const Nt=Math.max(80,Math.round(X*.5));let dt=B.direction==="left"?Z-Nt:Z+Nt,be=me;const Ee=5;Z=Math.min(Math.max(Ee,Z),X-Ee),me=Math.min(Math.max(Ee,me),U-Ee),dt=Math.min(Math.max(Ee,dt),X-Ee),be=Math.min(Math.max(Ee,be),U-Ee),await N.mutateAsync({x1:Z,y1:me,x2:dt,y2:be,duration:ne,...M}),w(b.id,"Swipe Performed","green");break}case"assert":{let B=`Verify that: ${b.descriptionText}`;!b.descriptionText&&b.elementId&&(B=`Verify element with id ${b.elementId} exists`),await K(b.id,C,b.descriptionText||"assert",B,T,b.elementId),w(b.id,"Assertion Passed","green");break}case"ai":{const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.instruction?.length)throw new Error(`Missing params for placeholders -> instruction: ${X.instruction.join(", ")}`);await K(b.id,C,ne.instruction,ne.instruction,T);break}case"type":{le=Y();const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(Object.keys(X).length){const U=Object.entries(X).map(([Z,me])=>`${Z}: ${me.join(", ")}`).join("; ");throw new Error(`Missing params for placeholders -> ${U}`)}await y.mutateAsync({text:ne.text,...M}),w(b.id,"Typed","green");break}case"scroll":{le=Y(),await x.mutateAsync({direction:b.direction,...M}),w(b.id,"Scrolled","green");break}case"zoom":{le=Y(),await P.mutateAsync({direction:b.direction,...M}),w(b.id,"Zoomed","green");break}case"scrollUntil":{le=Y();const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.text?.length)throw new Error(`Missing params for placeholders -> text: ${X.text.join(", ")}`);w(b.id,"Scrolling until found...","blue");const U=await D.mutateAsync({text:ne.text,elementId:ne.elementId,direction:ne.direction,maxScrolls:ne.maxScrolls,...M});if(U.success)w(b.id,`Found after ${U.scrolls??0} scrolls`,"green");else throw new Error("Target not found after scrolling");break}case"deeplink":{le=Y();const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.url?.length)throw new Error(`Missing params for placeholders -> url: ${X.url.join(", ")}`);await E.mutateAsync({url:ne.url,...M}),w(b.id,"Opened deeplink","green");break}case"fileRef":{w(b.id,"Loading steps from file...","blue");const B={...Ie,...I.state.test.params},{step:ne,missingMap:X}=St(b,B);if(X.path?.length)throw new Error(`Missing params for placeholders -> path: ${X.path.join(", ")}`);const U=(await ge.mutateAsync({path:ne.path}))?.content;let Z=[],me={};if(Array.isArray(U))Z=U;else if(U&&Array.isArray(U.steps))Z=U.steps,me=U.params||{};else throw new Error("Referenced file must be an array or an object with steps");const Nt={...Ie,...I.state.test.params,...me,...b.overrides},dt=Wo.array().parse(Z).map((be,Ee)=>{const Be=typeof be.id=="number"?be.id:Date.now()+Ee,{step:Oe,missingMap:ut}=St(be,Nt);if(Oe.type==="type"&&ut.text?.length||Oe.type==="scrollUntil"&&ut.text?.length||Oe.type==="deeplink"&&ut.url?.length||Oe.type==="ai"&&ut.instruction?.length){const j=[];for(const[ce,ye]of Object.entries(ut))ye.length&&j.push(`${ce}: ${ye.join(", ")}`);throw new Error(`Referenced step has missing params -> ${j.join("; ")}`)}return{id:Be,...Oe,originRef:{refId:b.id,path:b.path,descriptionText:b.descriptionText,optional:b.optional,overrides:b.overrides}}});I.setState(be=>{const Ee=be.test.steps.findIndex(Oe=>Oe.id===b.id);if(Ee===-1)return be;const Be=[...be.test.steps];return Be.splice(Ee,1,...dt),{...be,test:{...be.test,steps:Be}}}),w(b.id,"Expanded steps from file","green");break}}await Se(100);const te=Date.now()-ue;return console.log(`[Step ${b.id}] Execution Finished. Total Duration: ${te}ms`),le&&I.setState(B=>({...B,executionLog:[...B.executionLog,{stepId:b.id,stepNumber:C,screenshot:le,cacheHit:!1,timestamp:Date.now()}]})),!0}catch(le){const Y=le instanceof Error?le.message:"Unknown error";return b.optional?(w(b.id,`Failed (optional): ${Y}`,"orange"),!0):(w(b.id,`Error: ${Y}`,"red"),!1)}},Re=()=>{I.setState(b=>{const C=b.test.steps,$=[],T=new Set,M=new Set;let ue=0;for(;ue<C.length;){const Y=C[ue];if(Y?.type==="fileRef"){const te=Y.path;if(M.has(te)){ue++;continue}T.add(Y.id),M.add(te),$.push(Y),ue++;continue}if(Y&&Y.originRef){const te=Y.originRef.refId,B=Y.originRef.path,ne=Y.originRef.descriptionText,X=Y.originRef.optional;let U=ue;for(;U<C.length&&C[U]?.originRef?.refId===te;)U++;if(T.has(te)||M.has(B)){ue=U;continue}const Z={id:te,type:"fileRef",path:B,descriptionText:ne,optional:X,overrides:Y?.originRef?.overrides};$.some(me=>me.id===Z.id)&&(Z.id=Date.now()),$.push(Z),T.add(Z.id),M.add(B),ue=U;continue}$.push(Y),ue++}const le=[];for(const Y of $){const te=le[le.length-1];te?.type==="fileRef"&&Y?.type==="fileRef"&&te.path===Y.path||le.push(Y)}return{...b,test:{...b.test,steps:le}}})},Te=async(b,C)=>{if(console.log("Running playback from index:",b),I.state.test.steps.length===0){alert("No steps to play!");return}d.current=new AbortController;const $=d.current.signal;I.setState(te=>({...te,isPlaying:!0})),I.setState(te=>({...te,test:{...te.test,steps:te.test.steps.map((B,ne)=>ne>=b?{...B,status:"",statusColor:""}:B)},executionLog:[]}));let T=b;const M=b+1,ue=[];let le=!1,Y;for(;!$.aborted;){const te=I.state.test.steps,B=C?M:te.length;if(T>=B)break;const ne=te[T],X=ne.type;if(!await k(ne,T+1,$,ue)&&!ne.optional){le=!0,Y=I.state.test.steps.find(U=>U.id===ne.id)?.status||"Execution failed";break}if(X==="fileRef"){if(C)break;continue}T++}await Se(500),Re(),ee(null),I.setState(te=>({...te,isPlaying:!1})),d.current=null,$.aborted||(le?ar(Y||"Playback failed",{title:"Execution Failed"}):qr("Playback finished successfully",{title:"Execution Completed"}))},qe=()=>Te(0,!1),_t=b=>{const C=l.findIndex($=>$.id===b);C!==-1&&Te(C,!0)},yt=b=>{const C=l.findIndex($=>$.id===b);C!==-1&&Te(C,!1)},lt=()=>{d.current?.abort(),Re(),I.setState(b=>({...b,isPlaying:!1})),ee(null),Rm("Playback stopped",{title:"Stopped"})},rt=b=>{i(b),r(!1)},ot=()=>{r(!1),i(void 0)},We=()=>{r(!1),i(void 0)},fn=b=>{confirm("Delete this step?")&&I.setState(C=>({...C,test:{...C.test,steps:C.test.steps.filter($=>$.id!==b)}}))},Ft=()=>{confirm("Are you sure you want to clear all steps?")&&I.setState(b=>({...b,test:{...b.test,steps:[]}}))},Lt=u||a,ct=n||!!o;return v(Fm,{$hasForm:ct,children:[v(Gm,{children:[s(fe,{variant:"standard",value:ve(I,b=>b.test.name),onChange:b=>{I.setState(C=>({...C,test:{...C.test,name:b.target.value}}))},placeholder:"Untitled",InputProps:{disableUnderline:!0,style:{fontSize:"1.5rem",fontWeight:500}},fullWidth:!0,sx:{mr:2}}),e&&s(ke,{variant:"contained",color:"primary",onClick:e,disabled:!t||u,sx:{flexShrink:0},children:"Save"})]}),s(tn,{}),v(Lm,{children:[s(ke,{variant:a?"contained":"outlined",color:a?"error":"primary",startIcon:a?s(Lo,{}):s(Ea,{}),onClick:m,children:a?"Stop Recording":"Record"}),u?s(ke,{variant:"contained",color:"error",onClick:lt,children:"Stop"}):s(ke,{variant:"contained",disabled:a||l.length===0,onClick:qe,startIcon:s(wa,{}),children:"Run from start"}),s(ke,{variant:"outlined",disabled:Lt||l.length===0,onClick:Ft,children:"Clear All"})]}),s(lr,{open:n||!!o,onClose:We,maxWidth:"md",fullWidth:!0,children:s(cr,{children:s(re,{pt:1,children:s(am,{step:o,onSave:ot,onCancel:We})})})}),v(Vm,{children:[l.length===0?s(Mm,{children:s(H,{color:"text.secondary",children:"No steps recorded yet. Enable recording and click on the device screen to add steps."})}):s(Wi,{onDragEnd:b=>{const{source:C,destination:$}=b;if(!$||C.index===$.index)return;const T=[...I.state.test.steps],[M]=T.splice(C.index,1);T.splice($.index,0,M),I.setState(ue=>({...ue,test:{...ue.test,steps:T}}))},children:s(In,{droppableId:"steps-droppable",children:b=>v("div",{ref:b.innerRef,...b.droppableProps,children:[l.map((C,$)=>s(kr,{draggableId:String(C.id),index:$,children:(T,M)=>s("div",{ref:T.innerRef,...T.draggableProps,...T.dragHandleProps,style:{...T.draggableProps.style,opacity:M.isDragging?.9:1},children:s(km,{step:C,index:$,onPlay:()=>_t(C.id),onPlayFromHere:()=>yt(C.id),onEdit:()=>rt(C),onDelete:()=>fn(C.id)})})},C.id)),b.placeholder]})})}),!ct&&s(re,{mt:2,display:"flex",justifyContent:"center",children:s(ke,{variant:"contained",disabled:Lt,onClick:()=>r(!0),fullWidth:!0,children:"+ Add Step"})})]}),s(Dm,{})]})},Fm=_(_n)`
280
280
  display: grid;
281
281
  grid-template-areas:
282
282
  'header'
@@ -305,10 +305,10 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
305
305
  display: flex;
306
306
  justify-content: space-between;
307
307
  align-items: center;
308
- `,Wm=(e,t,n,r,o,i)=>o>=e&&o<=e+n&&i>=t&&i<=t+r,zm=({dimensions:e,elements:t,mouse:n})=>{if(t.length===0)return null;const r=t.filter(o=>{const i=o.bounds;if(i==null)return!1;const a=o.text??o.attributes?.text,l=o.resourceId??o.attributes?.["resource-id"],u=o.accessibilityText??o.attributes?.accessibilityText??o.attributes?.["accessibility-text"]??o.attributes?.["content-desc"],c=o.accessibilityIdentifier??o.attributes?.accessibilityIdentifier,f=o.name??o.attributes?.name,p=o.label??o.attributes?.label,d=o.value??o.attributes?.value;if(!a&&!l&&!u&&!c&&!f&&!p&&!d)return!1;const{x:m,y:g,width:y,height:x}=i,{x:D,y:E,elementWidth:P,elementHeight:N}=n;return D===null||E===null||P===null||N===null?!1:Wm(m/e.width,g/e.height,y/e.width,x/e.height,D/P,E/N)});return r.length===0?null:r.sort((o,i)=>{if(o.bounds==null&&i.bounds==null)return 0;if(o.bounds==null)return 1;if(i.bounds==null)return-1;const a=o.drawingOrderPath??o.indexPath??[],l=i.drawingOrderPath??i.indexPath??[];for(let u=0;u<Math.min(a.length,l.length);u++){const c=parseInt(a[u]),f=parseInt(l[u]);if(c!==f)return f-c}return a.length!==l.length?l.length-a.length:o.bounds.width*o.bounds.height-i.bounds.width*i.bounds.height})[0]},Ro=(e,t)=>`${Math.round(100*e/t)}%`,Hm=e=>{if(typeof e.x!="number"||typeof e.y!="number"||typeof e.elementWidth!="number"||typeof e.elementHeight!="number")return null;const t=Ro(e.x,e.elementWidth),n=Ro(e.y,e.elementHeight);return`${t}, ${n}`},Um=({open:e,handleClose:t,options:n,onAfterCopy:r})=>{const o=sr(()=>n?typeof n[0]=="string"?n.map(c=>({label:c,value:c})):n:[],[n]),[i,a]=pe(""),l=yn(()=>{a(""),t()},[t]),u=yn(async()=>{const c=i||(o[0]?.value??"");if(c){try{await navigator.clipboard.writeText(c),qr("Copied to clipboard")}catch{}r?.(),l()}},[i,o,r,l]);return v(lr,{open:e,onClose:l,maxWidth:"md",fullWidth:!0,children:[s(Bo,{children:"Select an attribute"}),s(cr,{children:s($t,{children:s(ya,{name:"attribute-options",children:o.map(c=>s(On,{value:c.value,control:s(va,{}),label:c.label,onChange:()=>a(c.value)},`${c.label}-${c.value}`))})})}),v(ko,{children:[s(ke,{color:"error",onClick:l,children:"Cancel"}),s(ke,{onClick:u,disabled:!i&&o.length===0,variant:"contained",children:"Copy"})]})]})},jm=se("f8084cb106c8126bb2deaeef7c98992d9ff9475ad3dc85c6ced04f08c3962b6e"),qm=ae({method:"POST"}).inputValidator(Rs).handler(jm,async({data:e})=>({description:await $s(e)})),ua=he({mutationKey:["ai","describe"],mutationFn:e=>qm({data:e})});function Km(e){return e.normalize("NFKC").replace(`
309
- `,"").replace(/['`´''‚‛′’]/g,"'").replace(/[""„‟″]/g,'"').replace(/[–—]/g,"-").replace(/[\u00A0\u2000-\u200A\u202F\u205F]/g," ").replace(/[\u200B-\u200F\uFEFF]/g,"").replace(/[\uE000-\uF8FF]|[\u{F0000}-\u{FFFFD}]|[\u{100000}-\u{10FFFD}]/gu,"").trim()}const Ym=()=>{const e=ve(I,w=>w.mode),t=ve(I,w=>w.isRecording),n=ve(I,w=>w.enableAnimations);Nn();const r=W(null),[o,i]=pe(!1),[a,l]=pe(!1),[u,c]=pe([]),{data:f=[]}=Ke(na),p=ve(I,w=>w.selectedDeviceId);ve(I,w=>w.selectedPlatform),Ne(()=>{if(!p&&f.length>0){const w=f[0];I.setState(ee=>({...ee,selectedDeviceId:w.id,selectedPlatform:w.platform}))}},[f,p]);const d=f.find(w=>w.id===p),{data:m,isError:g,isLoading:y}=Ke({...Qi({platform:d?.platform,deviceId:d?.id}),refetchInterval:250,enabled:!!d});Ne(()=>{const w=m?.base64;w&&I.setState(ee=>({...ee,currentScreenshot:w}))},[m]);const{data:x}=Ke({...cf({platform:d?.platform,deviceId:d?.id}),enabled:!!d,refetchInterval:1e3}),D=G(af),{data:E}=Ke({...ta({enabled:o&&!!d}),refetchInterval:o?1e3:!1});Ne(()=>{d?.id&&x?.connected===!1&&!D.isPending&&D.mutate({platform:d.platform,deviceId:d.id})},[d,x?.connected]);const P=m?.success??!1,N=x?.connected??!1,$=P&&N,A=m?.base64,q=G(Df);G(Lr),G(Vr),G(Mr),G(Gr),G(ea),G(ua),G(Wr);const Q=async()=>{const w=!n;I.setState(ee=>({...ee,enableAnimations:w})),w||await q.mutateAsync()},ge=()=>{I.setState(w=>({...w,isRecording:!w.isRecording}))},de=y?"Connecting...":g?"Error":$?"Connected":P&&!N?"Starting Appium...":"Disconnected";return v(th,{children:[v(nh,{children:[s(H,{variant:"h5",children:"Device"}),v(rh,{children:[s(ft,{title:t?"Stop Recording":"Start Recording",children:s(O,{onClick:ge,color:t?"error":"default",size:"small",children:t?s(Lo,{}):s(Ia,{})})}),s(ft,{title:o?"Disable UI Inspector":"Enable UI Inspector",children:s(O,{onClick:()=>i(!o),color:o?"primary":"default",size:"small",children:s(Ca,{})})}),s(ft,{title:n?"Disable Animations":"Enable Animations",children:s(O,{onClick:Q,color:n?"primary":"default",size:"small",children:s(Na,{})})})]})]}),s(tn,{}),v(oh,{children:[v(re,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[v($t,{size:"small",sx:{minWidth:150,flex:1},children:[s(nn,{children:"Device"}),s(rn,{value:p||"",label:"Device",onChange:w=>{const ee=w.target.value,Ie=f.find(Se=>Se.id===ee);I.setState(Se=>({...Se,selectedDeviceId:ee,selectedPlatform:Ie?.platform||"android"}))},children:f.map(w=>v(gt,{value:w.id,children:[w.name," (",w.platform,")"]},w.id))})]}),s(ih,{connected:$,children:de})]}),t&&v(ha,{color:"primary",exclusive:!0,value:e,onChange:(w,ee)=>{ee&&I.setState(Ie=>({...Ie,mode:ee}))},"aria-label":"Mode",size:"small",children:[s(Kr,{value:"interact",children:"Interact"}),s(Kr,{value:"assert",children:"Assert"})]})]}),s(ah,{children:A?v(ch,{children:[s(sh,{ref:r,src:A,alt:"Device Screen",draggable:!1,recording:t}),s(Qm,{imgRef:r,uiDisabled:o,platform:d?.platform||"android",deviceId:d?.id,src:A}),o&&E?.elements&&s(eh,{imgRef:r,deviceWidth:E.width,deviceHeight:E.height,elements:E.elements,onPickAttributes:w=>{c(w),l(!0)}})]}):s(lh,{children:f.length===0?s(H,{variant:"body2",color:"text.secondary",children:"No devices found."}):p?v(Cn,{children:[s(To,{}),s(H,{variant:"body2",color:"text.secondary",children:"Connecting to device..."})]}):s(H,{variant:"body2",color:"text.secondary",children:"Select a device."})})}),s(Um,{open:a,handleClose:()=>l(!1),options:u,onAfterCopy:()=>{i(!1)}})]})},Jm=50,Xm=10,Zm=250,Qm=({imgRef:e,uiDisabled:t,platform:n,deviceId:r,src:o})=>{const i=W(null);jo(i,{enterDelay:0,leaveDelay:0});const a=ve(I,F=>F.isRecording),l=ve(I,F=>F.mode),u=G(Lr),c=G(Vr),f=G(Mr),p=G(Gr),d=G(ea),m=Nn(),g=G(ua),y=G(Wr),x=W(null),D=W(""),E=W(null),P=()=>({platform:n||"android",deviceId:r}),N=(F,K)=>{const k=e.current;if(!k)return null;const $e=k.getBoundingClientRect(),Te=k.naturalWidth/$e.width,qe=k.naturalHeight/$e.height,_t=Math.round((F-$e.left)*Te),yt=Math.round((K-$e.top)*qe);return{x:_t,y:yt,rect:$e,img:k}},$=(F,K,k,$e=500)=>{try{const Te={id:Date.now(),type:"swipe",direction:F,x:K,y:k,duration:$e,descriptionText:void 0};I.setState(qe=>({...qe,test:{...qe.test,steps:[...qe.test.steps,Te]}}))}catch(Te){console.warn("Failed to record swipe step",Te)}},A=F=>{try{const K={id:Date.now(),type:"scroll",direction:F};I.setState(k=>({...k,test:{...k.test,steps:[...k.test.steps,K]}}))}catch(K){console.warn("Failed to record scroll step",K)}},q=()=>{if(!a)return;const F=D.current;if(!F)return;const K={id:Date.now(),type:"type",text:F};I.setState(k=>({...k,test:{...k.test,steps:[...k.test.steps,K]}})),D.current="",E.current&&(window.clearTimeout(E.current),E.current=null)},Q=W(0),ge=W(null),de=180,w=40,ee=F=>{if(t)return;const K=N(F.clientX,F.clientY);K&&(x.current={x:K.x,y:K.y,t:Date.now()},i.current?.focus())},Ie=async F=>{if(t)return;const K=x.current;x.current=null;const k=N(F.clientX,F.clientY);if(!K||!k)return;const $e=k.x-K.x,Te=k.y-K.y,qe=Math.hypot($e,Te),_t=Date.now()-K.t,yt=P();if(qe<=Xm&&_t<=Zm){const lt=o;if(await u.mutateAsync({x:k.x,y:k.y,...yt}),a&&k.img){const rt=k.img,ot=document.createElement("canvas"),We=100;ot.width=We,ot.height=We;const fn=ot.getContext("2d");let Ft;fn&&(fn.drawImage(rt,k.x-We/2,k.y-We/2,We,We,0,0,We,We),Ft=ot.toDataURL("image/jpeg",.8));let Lt="";try{Lt=(await d.mutateAsync({x:k.x,y:k.y}))?.elementId||""}catch{}const ct=Date.now();I.setState(b=>({...b,test:{...b.test,steps:[...b.test.steps,{id:ct,type:l==="assert"?"assert":"tap",x:k.x,y:k.y,cropBase64:Ft,elementId:Lt,descriptionText:"Generating description..."}]}})),(async()=>{let b=lt;if(l==="interact"&&(await new Promise(C=>setTimeout(C,2e3)),r))try{const C=await m.fetchQuery({...Qi({platform:n||"android",deviceId:r}),staleTime:0});C?.base64&&(b=C.base64)}catch(C){console.error("Failed to fetch post-action screenshot",C)}try{const C=await g.mutateAsync({fullImage:lt??"",croppedImage:Ft,targetImage:b??"",type:l==="assert"?"assert":"interaction"});I.setState(R=>({...R,test:{...R.test,steps:R.test.steps.map(T=>T.id===ct?{...T,descriptionText:C.description}:T)}}));try{const R=I.state.test.steps,T=R.findIndex(ue=>ue.id===ct),M=T!==-1?T+1:R.length;y.mutate({stepNumber:M,stepDescription:C.description,filepath:void 0,executionData:[{screenshot:lt,commands:l==="interact"?[`tapOn: x=${k.x} y=${k.y}`,"Task complete:"]:["Task complete:"]}],platform:n||"android",screenResolution:{width:rt.naturalWidth,height:rt.naturalHeight}})}catch(R){console.error("Error populating cache:",R)}}catch(C){console.error("Failed to describe interaction",C);const R=l==="assert"?"Assert Element":"Tap Interaction";I.setState(T=>({...T,test:{...T.test,steps:T.test.steps.map(M=>M.id===ct?{...M,descriptionText:R}:M)}}));try{const T=I.state.test.steps,M=T.findIndex(le=>le.id===ct),ue=M!==-1?M+1:T.length;y.mutate({stepNumber:ue,stepDescription:R,filepath:void 0,executionData:[{screenshot:lt,commands:l==="interact"?[`tapOn: x=${k.x} y=${k.y}`,"Task complete:"]:["Task complete:"]}],platform:n||"android",screenResolution:{width:rt.naturalWidth,height:rt.naturalHeight}})}catch(T){console.error("Error populating cache (fallback):",T)}}})()}return}if(qe>=Jm){const lt=Math.abs($e);if(Math.abs(Te)>=lt*1.5){const ot=Te>0?"up":"down";await f.mutateAsync({direction:ot,...yt}),a&&A(ot);return}await p.mutateAsync({x1:K.x,y1:K.y,x2:k.x,y2:k.y,duration:500,...yt});const rt=k.x-K.x>=0?"right":"left";a&&$(rt,K.x,K.y,500)}},Se=async F=>{t||(F.preventDefault(),Q.current+=F.deltaY,ge.current&&(window.clearTimeout(ge.current),ge.current=null),ge.current=window.setTimeout(async()=>{const K=Q.current;if(Q.current=0,Math.abs(K)<w)return;const k=K>0?"down":"up";await f.mutateAsync({direction:k,...P()}),a&&A(k)},de))},Ct=async F=>{if(!t){if(F.key.length===1||F.key===" "){await c.mutateAsync({text:F.key,...P()}),a&&(D.current+=F.key,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(q,400)),F.preventDefault();return}if(F.key==="Backspace"){q(),await c.mutateAsync({text:"",...P()}),F.preventDefault();return}if(F.key==="Enter"){await c.mutateAsync({text:`
308
+ `,Wm=(e,t,n,r,o,i)=>o>=e&&o<=e+n&&i>=t&&i<=t+r,zm=({dimensions:e,elements:t,mouse:n})=>{if(t.length===0)return null;const r=t.filter(o=>{const i=o.bounds;if(i==null)return!1;const a=o.text??o.attributes?.text,l=o.resourceId??o.attributes?.["resource-id"],u=o.accessibilityText??o.attributes?.accessibilityText??o.attributes?.["accessibility-text"]??o.attributes?.["content-desc"],c=o.accessibilityIdentifier??o.attributes?.accessibilityIdentifier,f=o.name??o.attributes?.name,p=o.label??o.attributes?.label,d=o.value??o.attributes?.value;if(!a&&!l&&!u&&!c&&!f&&!p&&!d)return!1;const{x:m,y:g,width:y,height:x}=i,{x:D,y:E,elementWidth:P,elementHeight:N}=n;return D===null||E===null||P===null||N===null?!1:Wm(m/e.width,g/e.height,y/e.width,x/e.height,D/P,E/N)});return r.length===0?null:r.sort((o,i)=>{if(o.bounds==null&&i.bounds==null)return 0;if(o.bounds==null)return 1;if(i.bounds==null)return-1;const a=o.drawingOrderPath??o.indexPath??[],l=i.drawingOrderPath??i.indexPath??[];for(let u=0;u<Math.min(a.length,l.length);u++){const c=parseInt(a[u]),f=parseInt(l[u]);if(c!==f)return f-c}return a.length!==l.length?l.length-a.length:o.bounds.width*o.bounds.height-i.bounds.width*i.bounds.height})[0]},$o=(e,t)=>`${Math.round(100*e/t)}%`,Hm=e=>{if(typeof e.x!="number"||typeof e.y!="number"||typeof e.elementWidth!="number"||typeof e.elementHeight!="number")return null;const t=$o(e.x,e.elementWidth),n=$o(e.y,e.elementHeight);return`${t}, ${n}`},Um=({open:e,handleClose:t,options:n,onAfterCopy:r})=>{const o=sr(()=>n?typeof n[0]=="string"?n.map(c=>({label:c,value:c})):n:[],[n]),[i,a]=pe(""),l=yn(()=>{a(""),t()},[t]),u=yn(async()=>{const c=i||(o[0]?.value??"");if(c){try{await navigator.clipboard.writeText(c),qr("Copied to clipboard")}catch{}r?.(),l()}},[i,o,r,l]);return v(lr,{open:e,onClose:l,maxWidth:"md",fullWidth:!0,children:[s(Bo,{children:"Select an attribute"}),s(cr,{children:s(Rt,{children:s(ya,{name:"attribute-options",children:o.map(c=>s(On,{value:c.value,control:s(va,{}),label:c.label,onChange:()=>a(c.value)},`${c.label}-${c.value}`))})})}),v(ko,{children:[s(ke,{color:"error",onClick:l,children:"Cancel"}),s(ke,{onClick:u,disabled:!i&&o.length===0,variant:"contained",children:"Copy"})]})]})},jm=se("f8084cb106c8126bb2deaeef7c98992d9ff9475ad3dc85c6ced04f08c3962b6e"),qm=ae({method:"POST"}).inputValidator($s).handler(jm,async({data:e})=>({description:await Rs(e)})),ua=he({mutationKey:["ai","describe"],mutationFn:e=>qm({data:e})});function Km(e){return e.normalize("NFKC").replace(`
309
+ `,"").replace(/['`´''‚‛′’]/g,"'").replace(/[""„‟″]/g,'"').replace(/[–—]/g,"-").replace(/[\u00A0\u2000-\u200A\u202F\u205F]/g," ").replace(/[\u200B-\u200F\uFEFF]/g,"").replace(/[\uE000-\uF8FF]|[\u{F0000}-\u{FFFFD}]|[\u{100000}-\u{10FFFD}]/gu,"").trim()}const Ym=()=>{const e=ve(I,w=>w.mode),t=ve(I,w=>w.isRecording),n=ve(I,w=>w.enableAnimations);Nn();const r=W(null),[o,i]=pe(!1),[a,l]=pe(!1),[u,c]=pe([]),{data:f=[]}=Ke(na),p=ve(I,w=>w.selectedDeviceId);ve(I,w=>w.selectedPlatform),Ne(()=>{if(!p&&f.length>0){const w=f[0];I.setState(ee=>({...ee,selectedDeviceId:w.id,selectedPlatform:w.platform}))}},[f,p]);const d=f.find(w=>w.id===p),{data:m,isError:g,isLoading:y}=Ke({...Qi({platform:d?.platform,deviceId:d?.id}),refetchInterval:250,enabled:!!d});Ne(()=>{const w=m?.base64;w&&I.setState(ee=>({...ee,currentScreenshot:w}))},[m]);const{data:x}=Ke({...cf({platform:d?.platform,deviceId:d?.id}),enabled:!!d,refetchInterval:1e3}),D=G(af),{data:E}=Ke({...ta({enabled:o&&!!d}),refetchInterval:o?1e3:!1});Ne(()=>{d?.id&&x?.connected===!1&&!D.isPending&&D.mutate({platform:d.platform,deviceId:d.id})},[d,x?.connected]);const P=m?.success??!1,N=x?.connected??!1,R=P&&N,A=m?.base64,q=G(Df);G(Lr),G(Vr),G(Mr),G(Gr),G(ea),G(ua),G(Wr);const Q=async()=>{const w=!n;I.setState(ee=>({...ee,enableAnimations:w})),w||await q.mutateAsync()},ge=()=>{I.setState(w=>({...w,isRecording:!w.isRecording}))},de=y?"Connecting...":g?"Error":R?"Connected":P&&!N?"Starting Appium...":"Disconnected";return v(th,{children:[v(nh,{children:[s(H,{variant:"h5",children:"Device"}),v(rh,{children:[s(ft,{title:t?"Stop Recording":"Start Recording",children:s(O,{onClick:ge,color:t?"error":"default",size:"small",children:t?s(Lo,{}):s(Ia,{})})}),s(ft,{title:o?"Disable UI Inspector":"Enable UI Inspector",children:s(O,{onClick:()=>i(!o),color:o?"primary":"default",size:"small",children:s(Ca,{})})}),s(ft,{title:n?"Disable Animations":"Enable Animations",children:s(O,{onClick:Q,color:n?"primary":"default",size:"small",children:s(Na,{})})})]})]}),s(tn,{}),v(oh,{children:[v(re,{display:"flex",alignItems:"center",gap:1,flexGrow:1,children:[v(Rt,{size:"small",sx:{minWidth:150,flex:1},children:[s(nn,{children:"Device"}),s(rn,{value:p||"",label:"Device",onChange:w=>{const ee=w.target.value,Ie=f.find(Se=>Se.id===ee);I.setState(Se=>({...Se,selectedDeviceId:ee,selectedPlatform:Ie?.platform||"android"}))},children:f.map(w=>v(gt,{value:w.id,children:[w.name," (",w.platform,")"]},w.id))})]}),s(ih,{connected:R,children:de})]}),t&&v(ha,{color:"primary",exclusive:!0,value:e,onChange:(w,ee)=>{ee&&I.setState(Ie=>({...Ie,mode:ee}))},"aria-label":"Mode",size:"small",children:[s(Kr,{value:"interact",children:"Interact"}),s(Kr,{value:"assert",children:"Assert"})]})]}),s(ah,{children:A?v(ch,{children:[s(sh,{ref:r,src:A,alt:"Device Screen",draggable:!1,recording:t}),s(Qm,{imgRef:r,uiDisabled:o,platform:d?.platform||"android",deviceId:d?.id,src:A}),o&&E?.elements&&s(eh,{imgRef:r,deviceWidth:E.width,deviceHeight:E.height,elements:E.elements,onPickAttributes:w=>{c(w),l(!0)}})]}):s(lh,{children:f.length===0?s(H,{variant:"body2",color:"text.secondary",children:"No devices found."}):p?v(Cn,{children:[s(To,{}),s(H,{variant:"body2",color:"text.secondary",children:"Connecting to device..."})]}):s(H,{variant:"body2",color:"text.secondary",children:"Select a device."})})}),s(Um,{open:a,handleClose:()=>l(!1),options:u,onAfterCopy:()=>{i(!1)}})]})},Jm=50,Xm=10,Zm=250,Qm=({imgRef:e,uiDisabled:t,platform:n,deviceId:r,src:o})=>{const i=W(null);jo(i,{enterDelay:0,leaveDelay:0});const a=ve(I,F=>F.isRecording),l=ve(I,F=>F.mode),u=G(Lr),c=G(Vr),f=G(Mr),p=G(Gr),d=G(ea),m=Nn(),g=G(ua),y=G(Wr),x=W(null),D=W(""),E=W(null),P=()=>({platform:n||"android",deviceId:r}),N=(F,K)=>{const k=e.current;if(!k)return null;const Re=k.getBoundingClientRect(),Te=k.naturalWidth/Re.width,qe=k.naturalHeight/Re.height,_t=Math.round((F-Re.left)*Te),yt=Math.round((K-Re.top)*qe);return{x:_t,y:yt,rect:Re,img:k}},R=(F,K,k,Re=500)=>{try{const Te={id:Date.now(),type:"swipe",direction:F,x:K,y:k,duration:Re,descriptionText:void 0};I.setState(qe=>({...qe,test:{...qe.test,steps:[...qe.test.steps,Te]}}))}catch(Te){console.warn("Failed to record swipe step",Te)}},A=F=>{try{const K={id:Date.now(),type:"scroll",direction:F};I.setState(k=>({...k,test:{...k.test,steps:[...k.test.steps,K]}}))}catch(K){console.warn("Failed to record scroll step",K)}},q=()=>{if(!a)return;const F=D.current;if(!F)return;const K={id:Date.now(),type:"type",text:F};I.setState(k=>({...k,test:{...k.test,steps:[...k.test.steps,K]}})),D.current="",E.current&&(window.clearTimeout(E.current),E.current=null)},Q=W(0),ge=W(null),de=180,w=40,ee=F=>{if(t)return;const K=N(F.clientX,F.clientY);K&&(x.current={x:K.x,y:K.y,t:Date.now()},i.current?.focus())},Ie=async F=>{if(t)return;const K=x.current;x.current=null;const k=N(F.clientX,F.clientY);if(!K||!k)return;const Re=k.x-K.x,Te=k.y-K.y,qe=Math.hypot(Re,Te),_t=Date.now()-K.t,yt=P();if(qe<=Xm&&_t<=Zm){const lt=o;if(await u.mutateAsync({x:k.x,y:k.y,...yt}),a&&k.img){const rt=k.img,ot=document.createElement("canvas"),We=100;ot.width=We,ot.height=We;const fn=ot.getContext("2d");let Ft;fn&&(fn.drawImage(rt,k.x-We/2,k.y-We/2,We,We,0,0,We,We),Ft=ot.toDataURL("image/jpeg",.8));let Lt="";try{Lt=(await d.mutateAsync({x:k.x,y:k.y}))?.elementId||""}catch{}const ct=Date.now();I.setState(b=>({...b,test:{...b.test,steps:[...b.test.steps,{id:ct,type:l==="assert"?"assert":"tap",x:k.x,y:k.y,cropBase64:Ft,elementId:Lt,descriptionText:"Generating description..."}]}})),(async()=>{let b=lt;if(l==="interact"&&(await new Promise(C=>setTimeout(C,2e3)),r))try{const C=await m.fetchQuery({...Qi({platform:n||"android",deviceId:r}),staleTime:0});C?.base64&&(b=C.base64)}catch(C){console.error("Failed to fetch post-action screenshot",C)}try{const C=await g.mutateAsync({fullImage:lt??"",croppedImage:Ft,targetImage:b??"",type:l==="assert"?"assert":"interaction"});I.setState($=>({...$,test:{...$.test,steps:$.test.steps.map(T=>T.id===ct?{...T,descriptionText:C.description}:T)}}));try{const $=I.state.test.steps,T=$.findIndex(ue=>ue.id===ct),M=T!==-1?T+1:$.length;y.mutate({stepNumber:M,stepDescription:C.description,filepath:void 0,executionData:[{screenshot:lt,commands:l==="interact"?[`tapOn: x=${k.x} y=${k.y}`,"Task complete:"]:["Task complete:"]}],platform:n||"android",screenResolution:{width:rt.naturalWidth,height:rt.naturalHeight}})}catch($){console.error("Error populating cache:",$)}}catch(C){console.error("Failed to describe interaction",C);const $=l==="assert"?"Assert Element":"Tap Interaction";I.setState(T=>({...T,test:{...T.test,steps:T.test.steps.map(M=>M.id===ct?{...M,descriptionText:$}:M)}}));try{const T=I.state.test.steps,M=T.findIndex(le=>le.id===ct),ue=M!==-1?M+1:T.length;y.mutate({stepNumber:ue,stepDescription:$,filepath:void 0,executionData:[{screenshot:lt,commands:l==="interact"?[`tapOn: x=${k.x} y=${k.y}`,"Task complete:"]:["Task complete:"]}],platform:n||"android",screenResolution:{width:rt.naturalWidth,height:rt.naturalHeight}})}catch(T){console.error("Error populating cache (fallback):",T)}}})()}return}if(qe>=Jm){const lt=Math.abs(Re);if(Math.abs(Te)>=lt*1.5){const ot=Te>0?"up":"down";await f.mutateAsync({direction:ot,...yt}),a&&A(ot);return}await p.mutateAsync({x1:K.x,y1:K.y,x2:k.x,y2:k.y,duration:500,...yt});const rt=k.x-K.x>=0?"right":"left";a&&R(rt,K.x,K.y,500)}},Se=async F=>{t||(F.preventDefault(),Q.current+=F.deltaY,ge.current&&(window.clearTimeout(ge.current),ge.current=null),ge.current=window.setTimeout(async()=>{const K=Q.current;if(Q.current=0,Math.abs(K)<w)return;const k=K>0?"down":"up";await f.mutateAsync({direction:k,...P()}),a&&A(k)},de))},Ct=async F=>{if(!t){if(F.key.length===1||F.key===" "){await c.mutateAsync({text:F.key,...P()}),a&&(D.current+=F.key,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(q,400)),F.preventDefault();return}if(F.key==="Backspace"){q(),await c.mutateAsync({text:"",...P()}),F.preventDefault();return}if(F.key==="Enter"){await c.mutateAsync({text:`
310
310
  `,...P()}),a&&(D.current+=`
311
- `,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(q,400)),F.preventDefault();return}}};return Ne(()=>()=>{q()},[]),s("div",{ref:i,tabIndex:0,onMouseDown:ee,onMouseUp:Ie,onWheel:Se,onKeyDown:Ct,style:{position:"absolute",inset:0,outline:"none"}})},eh=({imgRef:e,deviceWidth:t,deviceHeight:n,elements:r,onPickAttributes:o})=>{const[i,a]=pe(null),l=W(null),u=jo(l,{enterDelay:100,leaveDelay:100}),c=i!=null?r[i]:null,f=sr(()=>{const d=c,m=d?.text||d?.attributes?.text||"",g=d?.accessibilityText||d?.attributes?.accessibilityText||d?.attributes?.["accessibility-text"]||d?.attributes?.["content-desc"]||"",y=d?.resourceId||d?.attributes?.["resource-id"]||"",x=d?.accessibilityIdentifier||d?.attributes?.accessibilityIdentifier||"",D=d?.name||d?.attributes?.name||"",E=d?.label||d?.attributes?.label||"",P=d?.value||d?.attributes?.value||"";return x||D||E||m||g||y||P||Hm(u)||""},[c,u]);Ne(()=>{if(u)if(u.isOver){const d=zm({dimensions:{width:t,height:n},elements:r,mouse:u});if(d){let m=r.indexOf(d);if(m<0&&d.bounds){const g=d.bounds;m=r.findIndex(y=>y.bounds&&y.bounds.x===g.x&&y.bounds.y===g.y&&y.bounds.width===g.width&&y.bounds.height===g.height)}a(m>=0?m:null)}else a(null)}else a(null)},[u,t,n,r]);const p=u&&u.isOver&&typeof u.x=="number"&&typeof u.y=="number"&&typeof u.elementWidth=="number"&&typeof u.elementHeight=="number";return s(ft,{title:f,followCursor:!0,children:v(dh,{ref:l,onClick:()=>{const d=i!=null?r[i]:null;if(!d)return;const m=[],g=d.text??d.attributes?.text,y=d.accessibilityText??d.attributes?.["accessibility-text"]??d.attributes?.["content-desc"],x=d.resourceId??d.attributes?.["resource-id"],D=d.accessibilityIdentifier??d.attributes?.accessibilityIdentifier,E=d.name??d.attributes?.name,P=d.label??d.attributes?.label,N=($,A)=>{const q=typeof A=="string"?Km(A):"";q&&!m.some(Q=>Q.value===q)&&m.push({label:`${$}: "${q}"`,value:q})};N("accessibility-id",D),N("name",E),N("label",P),N("text",g),N("accessibility-text",y),N("resource-id",x),m.length>0&&o(m)},children:[p&&v(Cn,{children:[s(ph,{style:{left:`${u.x/u.elementWidth*100}%`}}),s(fh,{style:{top:`${u.y/u.elementHeight*100}%`}})]}),r.map((d,m)=>{if(!d.bounds)return null;const{x:g,y,width:x,height:D}=d.bounds,E=g/t*100,P=y/n*100,N=x/t*100,$=D/n*100,A=i===m;return s(uh,{style:{left:`${E}%`,top:`${P}%`,width:`${N}%`,height:`${$}%`},"data-hovered":A||void 0},m)})]})})},th=_(_n)`
311
+ `,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(q,400)),F.preventDefault();return}}};return Ne(()=>()=>{q()},[]),s("div",{ref:i,tabIndex:0,onMouseDown:ee,onMouseUp:Ie,onWheel:Se,onKeyDown:Ct,style:{position:"absolute",inset:0,outline:"none"}})},eh=({imgRef:e,deviceWidth:t,deviceHeight:n,elements:r,onPickAttributes:o})=>{const[i,a]=pe(null),l=W(null),u=jo(l,{enterDelay:100,leaveDelay:100}),c=i!=null?r[i]:null,f=sr(()=>{const d=c,m=d?.text||d?.attributes?.text||"",g=d?.accessibilityText||d?.attributes?.accessibilityText||d?.attributes?.["accessibility-text"]||d?.attributes?.["content-desc"]||"",y=d?.resourceId||d?.attributes?.["resource-id"]||"",x=d?.accessibilityIdentifier||d?.attributes?.accessibilityIdentifier||"",D=d?.name||d?.attributes?.name||"",E=d?.label||d?.attributes?.label||"",P=d?.value||d?.attributes?.value||"";return x||D||E||m||g||y||P||Hm(u)||""},[c,u]);Ne(()=>{if(u)if(u.isOver){const d=zm({dimensions:{width:t,height:n},elements:r,mouse:u});if(d){let m=r.indexOf(d);if(m<0&&d.bounds){const g=d.bounds;m=r.findIndex(y=>y.bounds&&y.bounds.x===g.x&&y.bounds.y===g.y&&y.bounds.width===g.width&&y.bounds.height===g.height)}a(m>=0?m:null)}else a(null)}else a(null)},[u,t,n,r]);const p=u&&u.isOver&&typeof u.x=="number"&&typeof u.y=="number"&&typeof u.elementWidth=="number"&&typeof u.elementHeight=="number";return s(ft,{title:f,followCursor:!0,children:v(dh,{ref:l,onClick:()=>{const d=i!=null?r[i]:null;if(!d)return;const m=[],g=d.text??d.attributes?.text,y=d.accessibilityText??d.attributes?.["accessibility-text"]??d.attributes?.["content-desc"],x=d.resourceId??d.attributes?.["resource-id"],D=d.accessibilityIdentifier??d.attributes?.accessibilityIdentifier,E=d.name??d.attributes?.name,P=d.label??d.attributes?.label,N=(R,A)=>{const q=typeof A=="string"?Km(A):"";q&&!m.some(Q=>Q.value===q)&&m.push({label:`${R}: "${q}"`,value:q})};N("accessibility-id",D),N("name",E),N("label",P),N("text",g),N("accessibility-text",y),N("resource-id",x),m.length>0&&o(m)},children:[p&&v(Cn,{children:[s(ph,{style:{left:`${u.x/u.elementWidth*100}%`}}),s(fh,{style:{top:`${u.y/u.elementHeight*100}%`}})]}),r.map((d,m)=>{if(!d.bounds)return null;const{x:g,y,width:x,height:D}=d.bounds,E=g/t*100,P=y/n*100,N=x/t*100,R=D/n*100,A=i===m;return s(uh,{style:{left:`${E}%`,top:`${P}%`,width:`${N}%`,height:`${R}%`},"data-hovered":A||void 0},m)})]})})},th=_(_n)`
312
312
  display: grid;
313
313
  grid-template-areas:
314
314
  'header'
@@ -443,7 +443,7 @@ import{jsxs as v,Fragment as Cn,jsx as s}from"react/jsx-runtime";import oe,{useR
443
443
  `,Ih=_.div`
444
444
  padding: 0.75rem;
445
445
  text-align: center;
446
- `;function Ch(){const e=ve(pn,n=>n),t=yn(()=>{Rm()},[]);return s(ga,{open:e.open,onClose:t,className:"absolute z-10",style:{maxWidth:"384px"},anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:e.maintainDisplayed?null:3e3,children:v(ba,{severity:e.type,onClose:t,children:[e.title!==void 0&&s(Ys,{sx:{...e.description==null&&e.listContent==null&&{marginBottom:0}},children:e.title}),e.description!==void 0&&e.description,e.listContent!==void 0&&e.listContent.length>0&&s("ul",{className:"mt-2 ml-2 list-disc list-inside",children:e.listContent.map((n,r)=>s("li",{children:n},r))})]})})}function tb(){const[e,t]=pe(),n=G(Hr),r=G(qf),o=Nn(),[i,a]=pe("");Ne(()=>{e?n.mutateAsync({path:e}).then(c=>{const f=c.content;let p=[],d={};Array.isArray(f)?(p=f,d={}):f&&Array.isArray(f.steps)&&(p=f.steps,d=f.params||{});const m=p.map((D,E)=>({...D,id:D.id||Date.now()+E})),g={name:c.path,steps:m,params:d};I.setState(D=>({...D,test:g}));const y=I.state.test,x={...y,steps:y.steps.map(D=>{const E={...D};for(const P of Object.keys(Vn))delete E[P];return E})};a(JSON.stringify(x))}).catch(c=>{c instanceof Error?c.message:String(c),ar("Failed to read file",{title:"Read Error"})}):a(JSON.stringify({name:"untitled",steps:[],params:{}}))},[e]);const l=ve(I,c=>c.test),u=(()=>{const c={...l,steps:l.steps.map(f=>{const p={...f};for(const d of Object.keys(Vn))delete p[d];return p})};return JSON.stringify(c)!==i})();return v(Cn,{children:[v(Nh,{children:[s(Sh,{children:s(gh,{onSelectFile:t,selectedFile:e})}),s(Oh,{children:s(vh,{disabled:!e})}),s(Ph,{children:s(_m,{onSave:async()=>{let c=e;const f=I.state.test,p=f.steps.map(m=>{const g={...m};for(const y of Object.keys(Vn))delete g[y];return g}),d={...f,steps:p};if(!c){const m=(f.name||"untitled").replace(/[^a-z0-9_\-\.]/gi,"_");c=m.endsWith(".json")?m:`${m}.json`}try{await r.mutateAsync({path:c,content:d}),a(JSON.stringify(d)),e||(t(c),o.invalidateQueries({queryKey:["files"]})),qr("File saved",{title:"Saved"})}catch(m){ar(m?.message?String(m.message):"Failed to save",{title:"Save Error"})}},canSave:u})}),s(Ah,{children:s(Ym,{})})]}),s(Ch,{})]})}const Nh=_.div`
446
+ `;function Ch(){const e=ve(pn,n=>n),t=yn(()=>{$m()},[]);return s(ga,{open:e.open,onClose:t,className:"absolute z-10",style:{maxWidth:"384px"},anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:e.maintainDisplayed?null:3e3,children:v(ba,{severity:e.type,onClose:t,children:[e.title!==void 0&&s(Ys,{sx:{...e.description==null&&e.listContent==null&&{marginBottom:0}},children:e.title}),e.description!==void 0&&e.description,e.listContent!==void 0&&e.listContent.length>0&&s("ul",{className:"mt-2 ml-2 list-disc list-inside",children:e.listContent.map((n,r)=>s("li",{children:n},r))})]})})}function tb(){const[e,t]=pe(),n=G(Hr),r=G(qf),o=Nn(),[i,a]=pe("");Ne(()=>{e?n.mutateAsync({path:e}).then(c=>{const f=c.content;let p=[],d={};Array.isArray(f)?(p=f,d={}):f&&Array.isArray(f.steps)&&(p=f.steps,d=f.params||{});const m=p.map((D,E)=>({...D,id:D.id||Date.now()+E})),g={name:c.path,steps:m,params:d};I.setState(D=>({...D,test:g}));const y=I.state.test,x={...y,steps:y.steps.map(D=>{const E={...D};for(const P of Object.keys(Vn))delete E[P];return E})};a(JSON.stringify(x))}).catch(c=>{c instanceof Error?c.message:String(c),ar("Failed to read file",{title:"Read Error"})}):a(JSON.stringify({name:"untitled",steps:[],params:{}}))},[e]);const l=ve(I,c=>c.test),u=(()=>{const c={...l,steps:l.steps.map(f=>{const p={...f};for(const d of Object.keys(Vn))delete p[d];return p})};return JSON.stringify(c)!==i})();return v(Cn,{children:[v(Nh,{children:[s(Sh,{children:s(gh,{onSelectFile:t,selectedFile:e})}),s(Oh,{children:s(vh,{disabled:!e})}),s(Ph,{children:s(_m,{onSave:async()=>{let c=e;const f=I.state.test,p=f.steps.map(m=>{const g={...m};for(const y of Object.keys(Vn))delete g[y];return g}),d={...f,steps:p};if(!c){const m=(f.name||"untitled").replace(/[^a-z0-9_\-\.]/gi,"_");c=m.endsWith(".json")?m:`${m}.json`}try{await r.mutateAsync({path:c,content:d}),a(JSON.stringify(d)),e||(t(c),o.invalidateQueries({queryKey:["files"]})),qr("File saved",{title:"Saved"})}catch(m){ar(m?.message?String(m.message):"Failed to save",{title:"Save Error"})}},canSave:u})}),s(Ah,{children:s(Ym,{})})]}),s(Ch,{})]})}const Nh=_.div`
447
447
  display: grid;
448
448
  grid-template-areas:
449
449
  'files editor simulator'