import{r as e}from"./automationDelaySettings-6abI1Bq-.js";function t(e,t){let n=Math.min(e,t),r=n+Math.random()*(Math.max(e,t)-n);return new Promise(e=>setTimeout(e,r))}var n=250,r=700,i=n,a=r,o=null;async function s(e,t){await u(e,t)}function c(e){o=e}function l(){return o?.()??!1}async function u(e,n){if(o){await g(e,n,o);return}await t(e,n)}async function d(){let t=await e();i=t.specFillMinMs,a=t.specFillMaxMs}async function f(){await u(i,a)}function p(e,t=.1){let n=e.getBoundingClientRect(),r=n.width*t,i=n.height*t,a=n.left+r,o=n.right-r,s=n.top+i,c=n.bottom-i;return{clientX:o>a?a+Math.random()*(o-a):n.left+n.width/2,clientY:c>s?s+Math.random()*(c-s):n.top+n.height/2}}var m=48;async function h(e,t){let n=t?.block??`center`,r=e.getBoundingClientRect(),i=r.top>=m&&r.left>=0&&r.bottom<=window.innerHeight-m&&r.right<=window.innerWidth,a=document.getElementById(`J_SubAppContainer`),o=!0;if(a){let e=a.getBoundingClientRect();o=r.top>=e.top+m&&r.bottom<=e.bottom-m}if((!i||!o)&&(e.scrollIntoView({block:n,inline:`nearest`,behavior:`smooth`}),await u(400,700),a)){let t=e.getBoundingClientRect(),n=a.getBoundingClientRect();t.bottom>n.bottom-m&&(a.scrollTop+=t.bottom-n.bottom+m),t.top<n.top+m&&(a.scrollTop-=n.top+m-t.top),await u(200,400)}}async function g(e,t,n,r=120){let i=Math.min(e,t),a=i+Math.random()*(Math.max(e,t)-i),o=Date.now()+a;for(;Date.now()<o;){if(n())return!1;let e=o-Date.now();await new Promise(t=>setTimeout(t,Math.min(r,e)))}return!n()}function _(e,t,n){let r={bubbles:!0,cancelable:!0,view:window,clientX:t,clientY:n,button:0};typeof PointerEvent<`u`&&e.dispatchEvent(new PointerEvent(`pointerdown`,{...r,pointerId:1,pointerType:`mouse`})),e.dispatchEvent(new MouseEvent(`mousedown`,r)),typeof PointerEvent<`u`&&e.dispatchEvent(new PointerEvent(`pointerup`,{...r,pointerId:1,pointerType:`mouse`})),e.dispatchEvent(new MouseEvent(`mouseup`,r)),e.dispatchEvent(new MouseEvent(`click`,r))}async function v(e){await h(e),await u(300,900);let{clientX:t,clientY:n}=p(e);_(e,t,n)}async function y(e,t,n=120,r){let i=r??o??void 0,a=Date.now()+t;for(;Date.now()<a;){if(i?.())return null;let t=e();if(t)return t;if(await u(n,n+80),i?.())return null}return null}async function b(e,t,n,r=150){let i=Date.now()+t;for(;Date.now()<i;){if(n?.())return!1;if(e())return!0;await u(r,r+80)}return e()}function x(e,t){let n=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`)?.set;r?r.call(e,t):e.value=t,e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}async function S(e,t){await h(e),await u(200,500),e.focus(),await u(100,300),x(e,t),await u(150,400)}async function C(e){await u(80,220);for(let t of[`keydown`,`keypress`,`keyup`])e.dispatchEvent(new KeyboardEvent(t,{key:`Enter`,code:`Enter`,keyCode:13,which:13,bubbles:!0,cancelable:!0}));await u(200,500)}export{g as a,t as c,h as d,x as f,b as h,s as i,p as l,y as m,C as n,l as o,c as p,S as r,f as s,v as t,d as u};