arcy.js 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{arcy.chat.f698fce59921.js → arcy.chat.27fabef680f1.js} +1 -1
- package/dist/arcy.flow.46ba8a96f99e.js +3 -0
- package/dist/{arcy.legacy.061d3b544569.js → arcy.legacy.98a48482777b.js} +2 -2
- package/dist/arcy.loader.js +1 -1
- package/dist/{arcy.modern.d30bb13c138a.js → arcy.modern.2c3fe0b458df.js} +2 -2
- package/dist/arcy.picker.777b2d4d1127.js +95 -0
- package/dist/{chat-VOYR3S25.js → chat-NCTVDXR5.js} +0 -3
- package/dist/{chunk-GDGE3HLE.js → chunk-7S5DA67F.js} +2 -2
- package/dist/{chunk-NY3NXM2V.js → chunk-AW7DHYSA.js} +1 -1
- package/dist/{chunk-NIHUDSWK.js → chunk-QDCO2MRA.js} +1 -1
- package/dist/design-mode.cjs +1 -1
- package/dist/design-mode.d.ts +9 -1
- package/dist/design-mode.js +2 -2
- package/dist/{flow-M7W3H3C5.js → flow-FGTIZOXU.js} +62 -17
- package/dist/index.cjs +490 -95
- package/dist/index.d.ts +21 -6
- package/dist/index.js +16 -12
- package/dist/{picker-GPZ2GHB4.js → picker-6REZLJW3.js} +417 -69
- package/package.json +1 -1
- package/dist/arcy.flow.fef131718e42.js +0 -3
- package/dist/arcy.picker.b7e531503cf2.js +0 -59
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(function(){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
-
function I(t){if(t.parentElement!==null)return t.parentElement;let e=t.parentNode;return e!==null&&"host"in e?e.host:null}function nt(t,e){let n=e;for(;n!==null;){if(n===t)return true;n=I(n);}return false}var rt=100;function b(t,e=0){let n=[],r=t.querySelectorAll("*");for(let o=0;o<r.length;o+=1){let i=r[o];n.push(i),i.shadowRoot!==null&&e<rt&&n.push(...b(i.shadowRoot,e+1));}return n}function H(t,e,n=0){let r=Array.from(t.querySelectorAll(e)),o=t.querySelectorAll("*");for(let i=0;i<o.length;i+=1){let s=o[i];s.shadowRoot!==null&&n<rt&&r.push(...H(s.shadowRoot,e,n+1));}return r}var ot=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],x="[masked]";function W(t){return ot.some(e=>(e.lastIndex=0,e.test(t)))}var V=4096,Ct=100,At=64;function k(t){if(!t)return;let e=t.slice(0,V);if(t.length>V){let r=e.search(/\s\S*$/);e=r===-1?e.slice(0,V-Ct):e.slice(0,r);}let n=e.replace(/\s+/g," ").trim();if(n){for(let r of ot)n=n.replace(r,x);return n.slice(0,80)}}function it(t){return !(t.length===0||t.length>64||t.includes(":")||t.startsWith("radix-")||/^\d+$/.test(t)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))}var Lt=new Set(["button","input","select","textarea","label","summary"]),Mt=new Set(["button","link","menuitem","tab","option"]);function R(t){let e=t.tagName.toLowerCase();if(Lt.has(e)||e==="a"&&t.hasAttribute("href"))return true;let n=t.getAttribute("role");if(n!==null&&Mt.has(n))return true;let r=t.getAttribute("contenteditable");return r===""||r==="true"}var Nt=["data-testid","data-test","data-cy","id","name","aria-label"],Ot=["data-testid","data-test","data-cy"],Pt=64;function Dt(t){for(let e of Ot){let n=t.getAttribute(e);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>Pt)&&!W(r))return r}}var Ht=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function Vt(t){let e=I(t);for(;e!==null;){let n=e.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let o of Nt){let i=e.getAttribute(o);if(i===null||o==="id"&&!it(i))continue;let s=k(i);if(s!==void 0)return {tag:n,attr:o,value:s}}let r=e.getAttribute("role");if(r!==null&&Ht.has(r))return {tag:n,attr:"role",value:r};e=I(e);}}function Wt(t){let e=0,n=t.previousElementSibling;for(;n!==null;)n.tagName===t.tagName&&(e+=1),n=n.previousElementSibling;return e}function C(t){let e={tag:t.tagName.toLowerCase(),siblingIndex:Wt(t)},n=k(t.textContent);n!==void 0&&(e.text=n);let r=k(t.getAttribute("aria-label"));r!==void 0&&(e.ariaLabel=r);let o=k(t.getAttribute("placeholder"));o!==void 0&&(e.placeholder=o);let i=t.getAttribute("id");i!==null&&it(i)&&!W(i)&&(e.id=i);let s=t.getAttribute("role");if(s!==null){let u=s.trim();u!==""&&u.length<=At&&!W(u)&&(e.role=u);}let l=Dt(t);l!==void 0&&(e.testId=l);let a=Vt(t);return a!==void 0&&(e.ancestorTag=a.tag,e.ancestorAttr=a.attr,e.ancestorValue=a.value),e}function Kt(t){return t.getClientRects().length>0}var $t=50,Bt=40,Ut=10,jt=15,Gt=15,Xt=10,Jt=10,Yt=10,zt=5,qt=5,Zt=.6,Qt=.7,te={1:.3,2:.45,3:.6,4:.75,5:.9};function A(t){return t.split(x).join(" ").replace(/\s+/g," ").trim()}function ee(t,e){if(e===void 0)return 0;let n=A(t),r=A(e);return n===""||r===""?0:r===n?1:r.includes(n)||n.includes(r)?Zt:0}function T(t,e){return e===t?1:0}function K(t){return t.includes(x)&&A(t)===""}function ne(t,e,n){let r=0,o=0,i=(s,l)=>{r+=s,o+=s*l;};if(t.testId!==void 0&&i($t,T(t.testId,e.testId)),t.text!==void 0&&A(t.text)!==""&&i(n?Ut:Bt,ee(t.text,e.text)),t.ariaLabel!==void 0&&!K(t.ariaLabel)&&i(jt,T(t.ariaLabel,e.ariaLabel)),t.placeholder!==void 0&&!K(t.placeholder)&&i(Jt,T(t.placeholder,e.placeholder)),t.id!==void 0&&i(Gt,T(t.id,e.id)),t.role!==void 0&&i(zt,T(t.role,e.role)),i(Xt,e.tag===t.tag?1:0),i(qt,e.siblingIndex===t.siblingIndex?1:0),t.ancestorAttr!==void 0&&t.ancestorValue!==void 0&&!K(t.ancestorValue)){let s=0;e.ancestorAttr===t.ancestorAttr&&e.ancestorValue===t.ancestorValue&&(s=e.ancestorTag===t.ancestorTag?1:Qt),i(Yt,s);}return r===0?0:o/r}function re(t,e){if(t.selector===null)return null;try{return H(e,t.selector)}catch{return null}}function oe(t,e){let n=t.core.tag,r=[];for(let o of b(e))(o.tagName.toLowerCase()===n||R(o))&&r.push(o);return r}function st(t,e){if(e.length===0)return {status:"not_found",reason:"no_candidates",matchCount:0};let n=te[t.precision],r=false,o=[];for(let s of e){if(!Kt(s))continue;r=true;let l=ne(t.core,C(s),t.dynamicText);l>=n&&o.push({element:s,score:l});}if(o=o.filter((s,l)=>{let a=o[l+1];return a===void 0?true:!(nt(s.element,a.element)&&s.score<=a.score)}),o.length===0)return {status:"not_found",reason:r?"below_threshold":"not_visible",matchCount:0};let i=t.ordinal>=1?o[t.ordinal-1]:void 0;return i===void 0?{status:"not_found",reason:"ordinal_out_of_range",matchCount:o.length}:{status:"matched",element:i.element,score:i.score,matchCount:o.length}}function g(t,e){try{let n=re(t,e);if(n!==null&&n.length>0){let r=st(t,n);if(r.status==="matched"||r.reason==="ordinal_out_of_range")return r}return st(t,oe(t,e))}catch{return {status:"not_found",reason:"error",matchCount:0}}}var ie=40;function lt(t=document){try{let e=b(t),n=[];for(let r of e){if(n.length>=ie)break;R(r)&&n.push(C(r));}return n}catch{return []}}var $={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function y(t){return t?{getItem(e){try{return t.getItem(e)}catch{return null}},setItem(e,n){try{t.setItem(e,n);}catch{}},removeItem(e){try{t.removeItem(e);}catch{}}}:$}function at(){try{let t=globalThis.localStorage;return y(t)}catch{return $}}function ut(){try{let t=globalThis.sessionStorage;return y(t)}catch{return $}}function L(t,e){let n=t.getItem(e);if(!n)return null;try{let r=JSON.parse(n);return !r||typeof r!="object"||Array.isArray(r)?null:r}catch{return null}}function M(t,e,n){try{t.setItem(e,JSON.stringify(n));}catch{}}var se=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function B(t){let e=typeof globalThis<"u"?globalThis.crypto:void 0;if(e&&typeof e.randomUUID=="function")try{let o=e.randomUUID();if(se.test(o))return o}catch{}let n=new Uint8Array(16);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let o=0;o<n.length;o++)n[o]=Math.floor(Math.random()*256);n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let r="";for(let o=0;o<n.length;o++)r+=(n[o]??0).toString(16).padStart(2,"0");return `${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}var le=3,ae=["attribute","current_page","element","text_input","user_fills_input","current_time","user_idle","visitor","always_true","group"];function v(t){if(!t||typeof t!="object")return false;let e=t;return e.v===1&&!!e.core&&typeof e.core=="object"&&typeof e.core.tag=="string"&&(e.selector===null||typeof e.selector=="string")&&typeof e.ordinal=="number"&&typeof e.precision=="number"}function pt(t,e){if(e>le||!t||typeof t!="object")return null;let n=t,r=n.type;if(typeof r!="string"||!ae.includes(r))return null;switch(r){case "attribute":return typeof n.codeName!="string"||typeof n.operator!="string"?null:{type:"attribute",codeName:n.codeName,operator:n.operator,value:n.value};case "current_page":return !Array.isArray(n.matches)||!Array.isArray(n.doesNotMatch)?null:{type:"current_page",matches:n.matches.filter(o=>typeof o=="string"),doesNotMatch:n.doesNotMatch.filter(o=>typeof o=="string")};case "element":return !v(n.target)||typeof n.state!="string"?null:{type:"element",target:n.target,state:n.state};case "text_input":return !v(n.target)||typeof n.operator!="string"||typeof n.value!="string"?null:{type:"text_input",target:n.target,operator:n.operator,value:n.value};case "user_fills_input":return v(n.target)?{type:"user_fills_input",target:n.target}:null;case "current_time":{let o=n.from,i=n.to;return o!==null&&typeof o!="string"||i!==null&&typeof i!="string"?null:{type:"current_time",from:o??null,to:i??null}}case "user_idle":{let o=n.seconds;return typeof o!="number"||!Number.isFinite(o)||o<1||o>600?null:{type:"user_idle",seconds:o}}case "visitor":return n.state!=="first_visit"&&n.state!=="returning"?null:{type:"visitor",state:n.state};case "always_true":return {type:"always_true"};case "group":{if(!Array.isArray(n.children)||n.operator!=="and"&&n.operator!=="or")return null;let o=[];for(let i of n.children){let s=pt(i,e+1);s&&o.push(s);}return {type:"group",operator:n.operator,children:o}}default:return null}}function mt(t){if(!t||typeof t!="object")return null;let e=t;if(e.v!==1)return null;let n=pt(e.node,0);return n?{v:1,node:n}:null}function ct(t){let e=/^(\d{2}):(\d{2})$/.exec(t);if(!e)return null;let n=Number(e[1]),r=Number(e[2]);return n>23||r>59?null:n*60+r}function ue(t,e){if(t.from===null&&t.to===null)return true;let n=e.getHours()*60+e.getMinutes(),r=t.from!==null?ct(t.from):null,o=t.to!==null?ct(t.to):null;return t.from!==null&&r===null||t.to!==null&&o===null?false:r!==null&&o===null?n>=r:r===null&&o!==null?n<=o:r!==null&&o!==null?r<=o?n>=r&&n<=o:n>=r||n<=o:true}function U(t,e){let n=t.split("*").map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");try{return new RegExp(`^${n}$`).test(e)}catch{return false}}function ce(t,e){return t.doesNotMatch.some(n=>U(n,e))?false:t.matches.length===0?true:t.matches.some(n=>U(n,e))}function ht(t,e,n){if(e===void 0)return false;switch(t){case "is":return e===n;case "is_not":return e!==n;case "contains":return e.includes(n);case "does_not_contain":return !e.includes(n);case "starts_with":return e.startsWith(n);case "ends_with":return e.endsWith(n);case "is_empty":return e==="";case "is_not_empty":return e!=="";case "greater_than":case "less_than":{let r=Number(e),o=Number(n);return e.trim()===""||!Number.isFinite(r)||!Number.isFinite(o)?false:t==="greater_than"?r>o:r<o}case "matches_pattern":return U(n,e);default:return false}}function dt(t,e){try{if(t.getClientRects().length===0)return !1}catch{return false}try{let n=e.defaultView?.getComputedStyle(t);if(n&&n.visibility==="hidden")return !1}catch{}return true}function ft(t,e){try{let n=e.activeElement;for(;n;){if(n===t||t.contains(n))return !0;n=n.shadowRoot?.activeElement??null;}}catch{}return false}function de(t,e){let n=g(t.target,e.doc);switch(t.state){case "is_present":return n.status==="matched";case "is_not_present":return n.status==="not_found";case "is_disabled":case "is_not_disabled":{if(n.status!=="matched")return false;let r="disabled"in n.element&&n.element.disabled===true;return t.state==="is_disabled"?r:!r}case "is_clicked":return e.wasClicked(t.target);case "is_not_clicked":return !e.wasClicked(t.target);case "is_visible":return n.status==="matched"&&dt(n.element,e.doc);case "is_not_visible":return n.status!=="matched"||!dt(n.element,e.doc);case "is_checked":case "is_not_checked":{if(n.status!=="matched")return false;let r="checked"in n.element&&n.element.checked===true;return t.state==="is_checked"?r:!r}case "is_focused":return n.status==="matched"&&ft(n.element,e.doc);case "is_not_focused":return n.status!=="matched"||!ft(n.element,e.doc);default:return false}}function fe(t,e){let n=e.getTrait?.(t.codeName);switch(t.operator){case "has_any_value":return n!=null&&n!=="";case "is_empty":return n==null||n==="";}if(n===void 0)return false;let r=String(n),o=t.value===void 0?"":String(t.value);return ht(t.operator,r,o)}function N(t,e){switch(t.type){case "always_true":return true;case "current_time":return ue(t,e.now());case "current_page":return ce(t,e.href());case "element":return de(t,e);case "attribute":return fe(t,e);case "text_input":{let n=e.readInputValue(t.target);return ht(t.operator,n,t.value)}case "user_fills_input":{let n=e.readInputValue(t.target),r=e.initialInputValue(t.target);return n!==void 0&&n!==""&&n!==r}case "user_idle":{let n=e.idleSeconds?.();return n!==void 0&&n>=t.seconds}case "visitor":{let n=e.isFirstVisit?.();return n===void 0?false:t.state==="first_visit"?n:!n}case "group":return t.children.length===0?false:t.operator==="and"?t.children.every(n=>N(n,e)):t.children.some(n=>N(n,e));default:return false}}function j(t){return t.type==="current_time"||t.type==="user_idle"?true:t.type==="group"?t.children.some(j):false}function G(t){return t.type==="user_idle"?true:t.type==="group"?t.children.some(G):false}var pe="https://api.arcyai.com";var me="/api/v1/sdk/flows";function he(t){return t!==void 0?t:typeof fetch<"u"?fetch.bind(globalThis):null}function ge(t,e,n,r){return new Promise(o=>{let i=false,s=l=>{i||(i=true,o(l));};t.then(s,()=>s(r));try{n(()=>s(r),e);}catch{}})}function we(t){return !t||typeof t!="object"||Array.isArray(t)?null:O(t.flow)}function O(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return typeof e.cvid!="string"||!Array.isArray(e.steps)?null:t}function ye(t){return {"Content-Type":"application/json",Authorization:`Bearer ${t}`}}async function gt(t,e){let{apiBase:n=pe,sessionToken:r,sessionId:o,setTimeoutImpl:i=(u,p)=>setTimeout(u,p),timeoutMs:s=8e3}=e,l=he(e.fetchImpl);if(!l)return {ok:false,reason:"unusable"};let a=(async()=>{let u;try{u=await l(`${n}${me}/${encodeURIComponent(t)}/run`,{method:"POST",headers:ye(r),body:JSON.stringify(o?{sessionId:o}:{}),credentials:"omit"});}catch{return {ok:false,reason:"network"}}if(u.status===404)return {ok:false,reason:"not_found"};if(!u.ok)return {ok:false,reason:"rejected"};let p;try{p=await u.json();}catch{return {ok:false,reason:"unusable"}}let f=we(p);return f?{ok:true,flow:f}:{ok:false,reason:"unusable"}})();return ge(a,s,i,{ok:false,reason:"network"})}var ve="arcy.flow.";function Se(t){return typeof t.flowId=="string"&&t.flowId.length>0&&typeof t.currentStepCvid=="string"&&t.currentStepCvid.length>0&&typeof t.flowSessionId=="string"&&t.flowSessionId.length>0&&typeof t.startedAt=="number"}function wt(t,{store:e=at()}={}){let n=y(e),r=ve+t;return {read(){let o=L(n,r);return !o||!Se(o)?null:{flowId:o.flowId,currentStepCvid:o.currentStepCvid,flowSessionId:o.flowSessionId,startedAt:o.startedAt}},save(o){M(n,r,o);},clear(){n.removeItem(r);}}}var be="arcy.preview.";function Te(t){return typeof t.flowId=="string"&&t.flowId.length>0&&typeof t.currentStepCvid=="string"&&t.currentStepCvid.length>0&&typeof t.flowSessionId=="string"&&t.flowSessionId.length>0&&typeof t.startedAt=="number"&&t.flow!==void 0&&t.flow!==null}function X(t,{store:e=ut()}={}){let n=y(e),r=be+t;return {read(){let o=L(n,r);return !o||!Te(o)?null:o},save(o){M(n,r,o);},clear(){n.removeItem(r);}}}var Ee=250,_e=15e3,Fe=1e3,Ie=["pointerdown","pointermove","keydown","wheel","scroll","touchstart"],J=250,ke=3e3,xe=250,Y=()=>{},Re=()=>Promise.resolve({status:"wait"});function z(t,e){return t.steps.findIndex(n=>n.cvid===e)}function vt(t){return t?t.type==="element"?[t.target]:t.type==="group"?t.children.flatMap(e=>vt(e)):[]:[]}var q=class{constructor(e,n,r,o,i,s,l,a,u,p,f,w,h,D,S,d){this.flow=e;this.stepIndex=n;this.startedAt=r;this.flowSessionId=o;this.doc=i;this.win=s;this.runState=l;this.executor=a;this.getTrait=u;this.isFirstVisit=p;this.track=f;this.now=w;this.setTimeoutImpl=h;this.clearTimeoutImpl=D;this.setIntervalImpl=S;this.clearIntervalImpl=d;this.stopped=false;this.dwellTimer=null;this.observer=null;this.intervalHandle=null;this.throttleHandle=null;this.lastCheck=0;this.trueSince=new Map;this.clicked=new Set;this.initialValues=new Map;this.clickListener=null;this.lastActivityAt=0;this.activityListeners=[];this.inputPending=false;this.inputListeners=[];this.parsedTriggers=new Map;this.lastStopReason=null;this.onStatus=null;this.onFailure=null;this.onCancelFill=null;}resolveElement(e,n=0){return g(e,this.doc)}waitForElement(e){let n=()=>{let l=g(e,this.doc),a=l.status==="matched"&&l.element.isConnected;return {result:l,found:a}},r=n(),o=Math.max(0,this.flow.waitSeconds*1e3);if(r.found||o===0)return Promise.resolve(r.result);let i=this.stepIndex,s=this.now()+o;return new Promise(l=>{let a=()=>{let u=n();if(u.found||this.stopped||this.stepIndex!==i||this.now()>=s){l(u.result);return}this.setTimeoutImpl(a,J);};this.setTimeoutImpl(a,J);})}conditionContext(){return {doc:this.doc,now:()=>new Date(this.now()),href:()=>this.win.location?.href??"",getTrait:this.getTrait,idleSeconds:()=>Math.max(0,(this.now()-this.lastActivityAt)/1e3),isFirstVisit:this.isFirstVisit,wasClicked:e=>this.clicked.has(e),readInputValue:e=>{let n=g(e,this.doc);if(n.status!=="matched")return;let r=n.element;return typeof r.value=="string"?r.value:void 0},initialInputValue:e=>{if(!this.initialValues.has(e)){let n=g(e,this.doc),r=n.status==="matched"?n.element:null;this.initialValues.set(e,r&&typeof r.value=="string"?r.value:void 0);}return this.initialValues.get(e)}}}currentStep(){return this.flow.steps[this.stepIndex]}persist(){let e=this.currentStep();e&&this.runState.save({flowId:this.flow.cvid,currentStepCvid:e.cvid,flowSessionId:this.flowSessionId,startedAt:this.startedAt});}teardownWatch(){if(this.observer?.disconnect(),this.observer=null,this.intervalHandle!==null&&(this.clearIntervalImpl(this.intervalHandle),this.intervalHandle=null),this.throttleHandle!==null&&(this.clearTimeoutImpl(this.throttleHandle),this.throttleHandle=null),this.dwellTimer!==null&&(this.clearTimeoutImpl(this.dwellTimer),this.dwellTimer=null),this.clickListener){try{this.doc.removeEventListener("click",this.clickListener,!0);}catch{}this.clickListener=null;}for(let[e,n]of this.inputListeners)try{this.doc.removeEventListener(e,n,!0);}catch{}this.inputListeners=[];for(let[e,n]of this.activityListeners)try{this.doc.removeEventListener(e,n,!0);}catch{}this.activityListeners=[],this.inputPending=false,this.trueSince.clear(),this.clicked.clear(),this.initialValues.clear();}jumpTo(e){let n=z(this.flow,e);if(n===-1){this.finish("error",{reason:"step_not_found"});return}this.stopStep(),this.stepIndex=n,this.persist(),this.enterStep();}emitStatus(e){try{this.onStatus?.(e);}catch{}}dismiss(){this.stopped||this.finish("dismissed");}emit(e,n){try{this.track(e,{flowId:this.flow.cvid,flowSessionId:this.flowSessionId,stepCvid:this.currentStep()?.cvid},n);}catch{}}finish(e,n){this.lastStopReason=e;let r=e==="completed"?"flow_completed":e==="dismissed"?"flow_abandoned":"flow_error";this.emit(r,n);try{this.onCancelFill?.();}catch{}if(this.stopStep(),this.stopped=true,this.runState.clear(),e==="completed"&&this.emitStatus({name:this.flow.publicName??this.flow.name,step:this.flow.steps.length,total:this.flow.steps.length,phase:"done"}),this.emitStatus(null),e==="error")try{this.onFailure?.();}catch{}}stopStep(){this.teardownWatch();}fireTrigger(e){if(e.actionType==="dismiss_flow"){this.finish("dismissed");return}e.actionType==="go_to_step"&&e.targetStepCvid&&this.jumpTo(e.targetStepCvid);}parsedTrigger(e){return this.parsedTriggers.has(e.cvid)||this.parsedTriggers.set(e.cvid,mt(e.condition)),this.parsedTriggers.get(e.cvid)??null}checkTriggers(e,n){if(this.stopped||this.inputPending)return;let r=this.now();for(let o of [...e.triggers].sort((i,s)=>i.position-s.position)){let i=this.parsedTrigger(o);if(!i)continue;let s=N(i.node,n),l=o.cvid;if(!s){this.trueSince.delete(l);continue}let a=this.trueSince.get(l)??r;this.trueSince.has(l)||this.trueSince.set(l,a);let u=(o.waitSeconds??0)*1e3;if(r-a>=u){this.fireTrigger(o);return}}}scheduleCheck(e){if(this.stopped||this.throttleHandle!==null)return;let n=Math.max(0,Ee-(this.now()-this.lastCheck));this.throttleHandle=this.setTimeoutImpl(()=>{this.throttleHandle=null,this.lastCheck=this.now(),this.checkTriggers(e,this.conditionContext());},n);}startWatch(e){let n=e.triggers.some(o=>{let i=this.parsedTrigger(o);return i?j(i.node):false}),r=e.triggers.some(o=>{let i=this.parsedTrigger(o);return i?G(i.node):false});if(this.lastActivityAt=this.now(),typeof MutationObserver=="function")try{this.observer=new MutationObserver(()=>this.scheduleCheck(e)),this.observer.observe(this.doc.documentElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0});}catch{}if(n)try{this.intervalHandle=this.setIntervalImpl(()=>this.scheduleCheck(e),r?Fe:_e);}catch{}if(r)for(let o of Ie){let i=()=>{this.lastActivityAt=this.now();};try{this.doc.addEventListener(o,i,{capture:!0,passive:!0}),this.activityListeners.push([o,i]);}catch{}}this.clickListener=o=>{for(let i of e.triggers){let s=this.parsedTrigger(i),l=vt(s?.node);for(let a of l){let u=g(a,this.doc);u.status==="matched"&&o.target instanceof Node&&(u.element===o.target||u.element.contains(o.target))&&this.clicked.add(a);}}this.scheduleCheck(e);};try{this.doc.addEventListener("click",this.clickListener,!0);}catch{this.clickListener=null;}for(let o of ["input","change","focusin","focusout"]){let i=()=>this.scheduleCheck(e);try{this.doc.addEventListener(o,i,!0),this.inputListeners.push([o,i]);}catch{}}this.checkTriggers(e,this.conditionContext());}async runExecutor(e){let n=this.stepIndex;try{let r=await this.executor(e,{doc:this.doc,win:this.win,resolveElement:(o,i)=>this.resolveElement(o,i),waitForElement:o=>this.waitForElement(o),setInputPending:o=>{this.inputPending=o;}});if(this.stopped||this.stepIndex!==n)return;if(r.status==="advance"){if(this.emit("flow_step_completed"),e.isCompletion){this.finish("completed");return}let o=this.stepIndex+1;if(o>=this.flow.steps.length){this.finish("completed");return}this.stopStep(),this.stepIndex=o,this.persist(),this.enterStep();return}if(r.status==="navigated"){if(this.emit("flow_step_completed"),r.navigateTarget==="new_tab"){this.finish("completed");return}if(this.stopStep(),e.isCompletion){this.finish("completed");return}let o=this.stepIndex+1;if(o>=this.flow.steps.length){this.finish("completed");return}this.stepIndex=o,this.persist();return}if(r.status==="error"){this.finish("error",r.reason==="element_not_found"?{reason:r.reason,liveManifest:lt(this.doc)}:{reason:r.reason});return}}catch{}}enterStep(){let e=this.currentStep();if(!e||this.stopped){this.finish(e?"completed":"error",e?void 0:{reason:"missing_step"});return}this.persist(),this.emit("flow_step_entered"),this.emitStatus({name:this.flow.publicName??this.flow.name,step:this.stepIndex+1,total:this.flow.steps.length,phase:"running"});let n=()=>{this.stopped||(this.startWatch(e),this.runExecutor(e));};this.waitForPageReady(n);}waitForPageReady(e){let n=this.now()+ke,r=()=>{this.dwellTimer=this.setTimeoutImpl(()=>{this.dwellTimer=null,e();},xe);},o=()=>{if(!this.stopped){if(this.doc.readyState!=="loading"||this.now()>=n){r();return}this.dwellTimer=this.setTimeoutImpl(()=>{this.dwellTimer=null,o();},J);}};o();}begin(){this.enterStep();}stop(){if(!this.stopped){try{this.onCancelFill?.();}catch{}this.stopStep(),this.stopped=true;}}};function St(t){let{context:e,executor:n=Re,track:r=e.track??Y,now:o=()=>Date.now(),setTimeoutImpl:i=(d,c)=>setTimeout(d,c),clearTimeoutImpl:s=d=>clearTimeout(d),setIntervalImpl:l=(d,c)=>setInterval(d,c),clearIntervalImpl:a=d=>clearInterval(d)}=t,u=e.doc??document,p=e.win??window,f=wt(e.token),w={apiBase:e.apiBase,sessionToken:e.sessionToken,sessionId:e.sessionId},h=null;async function D(d){let c=await gt(d,w);return c.ok?c.flow:null}function S(d,c,m,F,et={}){h?.stop(),h=new q(d,c,m,F,u,p,et.runState??f,n,e.getTrait,e.isFirstVisit,et.track??r,o,i,s,l,a),h.onStatus=Rt=>e.onStatus?.(Rt),h.onFailure=()=>e.onFailure?.(),h.onCancelFill=()=>e.cancelFill?.(),h.begin();}return {async start(d){let c=await D(d);if(!c||c.steps.length===0)return;let m=B();try{r("flow_started",{flowId:c.cvid,flowSessionId:m});}catch{}S(c,0,o(),m);},async resume(){let d=f.read();if(!d)return false;let c=await D(d.flowId);if(!c||c.steps.length===0)return f.clear(),false;let m=z(c,d.currentStepCvid);return m===-1?(f.clear(),false):(S(c,m,d.startedAt,d.flowSessionId),true)},stop(){h?.dismiss(),h=null;},async startPreview(d){let c=O(d);if(!c||c.steps.length===0)return;let m=X(e.token);S(c,0,o(),B(),{runState:yt(m,d),track:Y});},async resumePreview(){let d=X(e.token),c=d.read();if(!c)return false;let m=O(c.flow);if(!m||m.steps.length===0)return d.clear(),false;let F=z(m,c.currentStepCvid);return F===-1?(d.clear(),false):(S(m,F,c.startedAt,c.flowSessionId,{runState:yt(d,c.flow),track:Y}),true)},destroy(){h?.stop(),h=null;}}}function yt(t,e){return {read:()=>null,save:n=>t.save({...n,flow:e}),clear:()=>t.clear()}}var Ce=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ae=/^\d{4}-\d{2}-\d{2}$/,Le=/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,Me=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/,Ne=/^\d{4}-\d{2}$/,Oe=/^\d{4}-W\d{2}$/,Pe=/^\+?[\d\s().-]{3,}$/;function De(t){let e=Date.parse(t);return Number.isFinite(e)}function He(t,e){if(e.min!==null){let n=Number(e.min);if(Number.isFinite(n)&&t<n)return "number_too_small"}if(e.max!==null){let n=Number(e.max);if(Number.isFinite(n)&&t>n)return "number_too_large"}return null}function Z(t){return /^\d:/.test(t)?`0${t}`:t}function E(t,e){return e.min!==null&&e.min.length>0&&t<e.min?"date_too_early":e.max!==null&&e.max.length>0&&t>e.max?"date_too_late":null}function bt(t,e){let n=e.kind==="password"?t:t.trim();if(n.length===0)return e.required?"required":null;if(e.maxLength!==null&&n.length>e.maxLength)return "too_long";switch(e.kind){case "number":case "range":{let r=Number(n);return Number.isFinite(r)?He(r,e):"invalid_number"}case "email":return Ce.test(n)?null:"invalid_email";case "url":try{let r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?null:"invalid_url"}catch{return "invalid_url"}case "tel":return Pe.test(n)?null:"invalid";case "date":return !Ae.test(n)||!De(n)?"invalid_date":E(n,e);case "datetime":return Me.test(n)?E(n,e):"invalid_date";case "month":return Ne.test(n)?E(n,e):"invalid_date";case "week":return Oe.test(n)?E(n,e):"invalid_date";case "time":return Le.test(n)?E(Z(n),{...e,min:e.min!==null?Z(e.min):null,max:e.max!==null?Z(e.max):null}):"invalid_time";case "select":case "radio":return (e.options??[]).some(o=>o.value===n)?null:"invalid_option";case "checkbox":return n==="true"||n==="false"?null:"invalid_option";default:{if(e.pattern)try{if(!new RegExp(`^(?:${e.pattern})$`).test(n))return "invalid"}catch{}return null}}}function Tt(t,e){if(!e||e.length===0)return t;let n=t.trim();if(e.some(i=>i.value===n))return n;let r=n.toLowerCase(),o=e.find(i=>i.label.trim().toLowerCase()===r);return o?o.value:t}var Q=24;function Ve(t,e,n){let r=e-Math.max(0,n);if(!(e>0)||r<=0)return 0;if(t.bottom>r){let o=t.bottom-r+Q,i=Math.max(0,t.top-Q);return Math.min(o,i)}return t.top<0?t.top-Q:0}function Ft(t,e,n){try{let r=n.getBottomOcclusion?.()??0,o=t.getBoundingClientRect(),i=e.doc.documentElement?.clientHeight||e.win.innerHeight||0,s=Ve(o,i,r);if(s===0)return;e.win.scrollBy({top:s,behavior:"smooth"});}catch{}}function tt(t,e){let r=e.defaultView?.PointerEvent,o=(()=>{try{return t.getBoundingClientRect()}catch{return null}})(),i={bubbles:true,cancelable:true,clientX:o?o.left+o.width/2:0,clientY:o?o.top+o.height/2:0},s=a=>{try{typeof r=="function"&&t.dispatchEvent(new r(a,{...i,pointerType:"mouse"}));}catch{}},l=a=>{try{t.dispatchEvent(new MouseEvent(a,i));}catch{}};s("pointerover"),s("pointerenter"),s("pointerdown"),l("mousedown");try{typeof t.focus=="function"&&t.focus();}catch{}s("pointerup"),l("mouseup"),l("click");}function We(t,e){let n=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:t instanceof HTMLInputElement?HTMLInputElement.prototype:t instanceof HTMLSelectElement?HTMLSelectElement.prototype:null;if(!n)return false;let o=Object.getOwnPropertyDescriptor(n,"value")?.set;if(!o)return false;try{return o.call(t,e),!0}catch{return false}}function P(t,e){let n=e.defaultView;try{t.dispatchEvent(new(n?.Event??Event)("input",{bubbles:!0}));}catch{}try{t.dispatchEvent(new(n?.Event??Event)("change",{bubbles:!0}));}catch{}}async function Ke(t,e,n){if(!v(t.target))return {status:"error",reason:"invalid_target"};let r=await e.waitForElement(t.target);if(r.status!=="matched"||!r.element.isConnected)return {status:"error",reason:"element_not_found"};Ft(r.element,e,n);try{tt(r.element,e.doc);}catch{return {status:"error",reason:"dispatch_failed"}}return {status:"advance"}}var $e=["text","number","email","date","url","tel"];function Et(t){return $e.includes(t)?t:null}var Be={text:"text",search:"text",number:"number",email:"email",url:"url",tel:"tel",password:"password",date:"date",time:"time","datetime-local":"datetime",month:"month",week:"week",checkbox:"checkbox",radio:"radio",range:"range"};function _(t,e){try{let n=t.getAttribute(e);return n===null||n===""?null:n}catch{return null}}function Ue(t){let e=[];for(let n=0;n<t.options.length;n+=1){let r=t.options[n];if(!r||r.disabled)continue;let o=(r.label||r.textContent||"").trim();r.value!==""&&e.push({value:r.value,label:o||r.value});}return e}function je(t,e){let n=t.getAttribute("name"),r=t.form??e,o=[];if(n)try{let i=`input[type="radio"][name="${CSS.escape(n)}"]`;r.querySelectorAll(i).forEach(s=>{s instanceof HTMLInputElement&&o.push(s);});}catch{}return o.length===0&&o.push(t),o.map(i=>({value:i.value,label:Ge(i)||i.value}))}function It(t){try{let e=t.labels;if(e&&e.length>0)return (e[0]?.textContent??"").trim()}catch{}try{let e=t.closest("label");if(e)return (e.textContent??"").trim()}catch{}return ""}function Ge(t){return It(t)}function _t(t,e,n){let r="custom",o=null,i=false,s=null,l=null,a=null,u=null,p=null;if(t instanceof HTMLSelectElement)r="select",o=Ue(t),i=t.required||!t.querySelector('option[value=""]');else if(t instanceof HTMLTextAreaElement)r="textarea",i=t.required,t.maxLength>0&&(u=t.maxLength);else if(t instanceof HTMLInputElement){let f=(_(t,"type")??"text").toLowerCase();r=Be[f]??"text",i=t.required,s=_(t,"min"),l=_(t,"max"),a=_(t,"step"),p=_(t,"pattern"),t.maxLength>0&&(u=t.maxLength),r==="radio"&&(o=je(t,n)),r==="checkbox"&&(o=[{value:"true",label:It(t)}]);}return e&&e!=="text"&&(r==="text"||r==="custom"||r==="textarea")&&(r=e),{kind:r,required:i,options:o,min:s,max:l,step:a,maxLength:u,pattern:p}}function Xe(t){if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLElement&&t.isContentEditable)return t;try{let e=t.querySelector('input:not([type="hidden"]), textarea, select, [contenteditable="true"], [contenteditable=""]');return e instanceof HTMLElement?e:null}catch{return null}}function Je(t,e){let r=e.defaultView?.KeyboardEvent;if(typeof r=="function")for(let o of ["keydown","keyup"])try{t.dispatchEvent(new r(o,{bubbles:!0,cancelable:!0}));}catch{}}function Ye(t,e,n,r){if(n==="checkbox"&&t instanceof HTMLInputElement){let i=e==="true";return t.checked!==i&&tt(t,r),t.checked!==i&&(t.checked=i,P(t,r)),true}if(n==="radio"&&t instanceof HTMLInputElement){let i=t.form??r,s=t.getAttribute("name"),l=null;if(s)try{let p=`input[type="radio"][name="${CSS.escape(s)}"]`;i.querySelectorAll(p).forEach(f=>{f instanceof HTMLInputElement&&f.value===e&&(l=f);});}catch{}let a=l??(t.value===e?t:null);if(!a)return false;tt(a,r);let u=a;return u.checked||(u.checked=true,P(u,r)),true}let o=Xe(t);if(!o)return false;if(o instanceof HTMLElement&&o.isContentEditable){try{o.focus();}catch{}try{o.textContent=e;}catch{return false}return P(o,r),true}try{o.focus();}catch{}return We(o,e)?(Je(o,r),P(o,r),true):false}async function ze(t,e,n){if(!v(t.target))return {status:"error",reason:"invalid_target"};if(!n.promptFill)return {status:"wait"};let r=await e.waitForElement(t.target);if(r.status!=="matched"||!r.element.isConnected)return {status:"error",reason:"element_not_found"};let o=_t(r.element,Et(t.fillInputType),e.doc),i=(t.fillDescription??"").trim()||t.label||"",s=null,l=null,a;for(;;){let f;e.setInputPending(true);try{f=await n.promptFill({...o,question:i,errorCode:s});}catch{return {status:"error",reason:"prompt_failed"}}finally{e.setInputPending(false);}if(f===null)return {status:"error",reason:"fill_cancelled"};let w=o.kind==="select"||o.kind==="radio"?Tt(f,o.options):o.kind==="password"?f:f.trim();if(s=bt(w,{...o,question:i,errorCode:null}),s===null){a=w;break}if(l!==null&&l===w)return {status:"error",reason:"fill_invalid"};l=w;}let u=await e.waitForElement(t.target);if(u.status!=="matched"||!u.element.isConnected)return {status:"error",reason:"element_not_found"};let p=_t(u.element,Et(t.fillInputType),e.doc);return p.kind!==o.kind?{status:"error",reason:"unfillable_target"}:(Ft(u.element,e,n),Ye(u.element,a,p.kind,e.doc)?{status:"advance"}:{status:"error",reason:"unfillable_target"})}function qe(t){if(t.startsWith("/")&&!t.startsWith("//"))return true;try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return false}}async function Ze(t,e){if(!t.navigateUrl||!t.navigateTarget)return {status:"error",reason:"invalid_navigate_step"};if(!qe(t.navigateUrl))return {status:"error",reason:"invalid_navigate_step"};try{t.navigateTarget==="new_tab"?e.win.open(t.navigateUrl,"_blank","noopener,noreferrer"):e.win.location.assign(t.navigateUrl);}catch{return {status:"error",reason:"navigate_failed"}}return {status:"navigated",navigateTarget:t.navigateTarget}}function kt(t={}){return async(e,n)=>{try{switch(e.type){case "click":return await Ke(e,n,t);case "fill":return await ze(e,n,t);case "navigate":return await Ze(e,n);default:return {status:"error",reason:"unknown_step_type"}}}catch{return {status:"error",reason:"executor_threw"}}}}var xt="__arcyFlow";function tn(t){try{let e=kt({promptFill:t.promptFill,getBottomOcclusion:t.getBottomOcclusion});return St({context:t,executor:e})}catch{return null}}var en={contract:2,mount:tn};if(typeof window<"u")try{window[xt]=en;}catch{}
|
|
3
|
-
})();
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
(function(){'use strict';/* arcy.js — https://arcyai.com */
|
|
2
|
-
var be="__arcyPicker";function Se(e){return {v:1,core:e,selector:null,selectorCandidates:[],ordinal:1,precision:3,dynamicText:false}}function D(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}function Te(e,t){let n=e;for(;n!==null;){if(n.matches(t))return n;n=D(n);}return null}function Ae(e,t){let n=t;for(;n!==null;){if(n===e)return true;n=D(n);}return false}var Ce=100;function F(e,t=0){let n=[],r=e.querySelectorAll("*");for(let i=0;i<r.length;i+=1){let o=r[i];n.push(o),o.shadowRoot!==null&&t<Ce&&n.push(...F(o.shadowRoot,t+1));}return n}function U(e,t,n=0){let r=Array.from(e.querySelectorAll(t)),i=e.querySelectorAll("*");for(let o=0;o<i.length;o+=1){let a=i[o];a.shadowRoot!==null&&n<Ce&&r.push(...U(a.shadowRoot,t,n+1));}return r}var Re=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],q="[masked]";function N(e){return Re.some(t=>(t.lastIndex=0,t.test(e)))}var re=4096,ft=100,dt=64;function j(e){if(!e)return;let t=e.slice(0,re);if(e.length>re){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,re-ft):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of Re)n=n.replace(r,q);return n.slice(0,80)}}function z(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var mt=new Set(["button","input","select","textarea","label","summary"]),pt=new Set(["button","link","menuitem","tab","option"]);function oe(e){let t=e.tagName.toLowerCase();if(mt.has(t)||t==="a"&&e.hasAttribute("href"))return true;let n=e.getAttribute("role");if(n!==null&&pt.has(n))return true;let r=e.getAttribute("contenteditable");return r===""||r==="true"}function ie(e){let t=e;for(;t!==null&&t!==t.ownerDocument.documentElement;){if(oe(t))return t;t=D(t);}return e}var gt=["data-testid","data-test","data-cy","id","name","aria-label"],ht=["data-testid","data-test","data-cy"],Et=64;function yt(e){for(let t of ht){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>Et)&&!N(r))return r}}var wt=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function bt(e){let t=D(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let i of gt){let o=t.getAttribute(i);if(o===null||i==="id"&&!z(o))continue;let a=j(o);if(a!==void 0)return {tag:n,attr:i,value:a}}let r=t.getAttribute("role");if(r!==null&&wt.has(r))return {tag:n,attr:"role",value:r};t=D(t);}}function St(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function Y(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:St(e)},n=j(e.textContent);n!==void 0&&(t.text=n);let r=j(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let i=j(e.getAttribute("placeholder"));i!==void 0&&(t.placeholder=i);let o=e.getAttribute("id");o!==null&&z(o)&&!N(o)&&(t.id=o);let a=e.getAttribute("role");if(a!==null){let u=a.trim();u!==""&&u.length<=dt&&!N(u)&&(t.role=u);}let s=yt(e);s!==void 0&&(t.testId=s);let l=bt(e);return l!==void 0&&(t.ancestorTag=l.tag,t.ancestorAttr=l.attr,t.ancestorValue=l.value),t}function Tt(e){return e.getClientRects().length>0}var At=50,Ct=40,Rt=10,vt=15,xt=15,_t=10,It=10,Nt=10,kt=5,Dt=5,Lt=.6,Mt=.7,Pt={1:.3,2:.45,3:.6,4:.75,5:.9};function K(e){return e.split(q).join(" ").replace(/\s+/g," ").trim()}function Ot(e,t){if(t===void 0)return 0;let n=K(e),r=K(t);return n===""||r===""?0:r===n?1:r.includes(n)||n.includes(r)?Lt:0}function $(e,t){return t===e?1:0}function se(e){return e.includes(q)&&K(e)===""}function Ft(e,t,n){let r=0,i=0,o=(a,s)=>{r+=a,i+=a*s;};if(e.testId!==void 0&&o(At,$(e.testId,t.testId)),e.text!==void 0&&K(e.text)!==""&&o(n?Rt:Ct,Ot(e.text,t.text)),e.ariaLabel!==void 0&&!se(e.ariaLabel)&&o(vt,$(e.ariaLabel,t.ariaLabel)),e.placeholder!==void 0&&!se(e.placeholder)&&o(It,$(e.placeholder,t.placeholder)),e.id!==void 0&&o(xt,$(e.id,t.id)),e.role!==void 0&&o(kt,$(e.role,t.role)),o(_t,t.tag===e.tag?1:0),o(Dt,t.siblingIndex===e.siblingIndex?1:0),e.ancestorAttr!==void 0&&e.ancestorValue!==void 0&&!se(e.ancestorValue)){let a=0;t.ancestorAttr===e.ancestorAttr&&t.ancestorValue===e.ancestorValue&&(a=t.ancestorTag===e.ancestorTag?1:Mt),o(Nt,a);}return r===0?0:i/r}function Ut(e,t){if(e.selector===null)return null;try{return U(t,e.selector)}catch{return null}}function $t(e,t){let n=e.core.tag,r=[];for(let i of F(t))(i.tagName.toLowerCase()===n||oe(i))&&r.push(i);return r}function ve(e,t){if(t.length===0)return {status:"not_found",reason:"no_candidates",matchCount:0};let n=Pt[e.precision],r=false,i=[];for(let a of t){if(!Tt(a))continue;r=true;let s=Ft(e.core,Y(a),e.dynamicText);s>=n&&i.push({element:a,score:s});}if(i=i.filter((a,s)=>{let l=i[s+1];return l===void 0?true:!(Ae(a.element,l.element)&&a.score<=l.score)}),i.length===0)return {status:"not_found",reason:r?"below_threshold":"not_visible",matchCount:0};let o=e.ordinal>=1?i[e.ordinal-1]:void 0;return o===void 0?{status:"not_found",reason:"ordinal_out_of_range",matchCount:i.length}:{status:"matched",element:o.element,score:o.score,matchCount:i.length}}function xe(e,t){try{let n=Ut(e,t);if(n!==null&&n.length>0){let r=ve(e,n);if(r.status==="matched"||r.reason==="ordinal_out_of_range")return r}return ve(e,$t(e,t))}catch{return {status:"not_found",reason:"error",matchCount:0}}}var Ht=1,Z=2,Bt=5,Wt=["data-testid","data-test","data-cy"],Xt=["name","for","aria-label"],Gt=new Set(["flex","grid","block","hidden","inline","contents","table","isolate","static","fixed","absolute","relative","sticky","visible","invisible","truncate","italic","uppercase","lowercase","capitalize","antialiased","container","border","rounded","shadow","ring","outline","transition","underline","grow","shrink","sr-only"]),Vt=/^-?(?:p|px|py|pt|pr|pb|pl|m|mx|my|mt|mr|mb|ml|gap|space|w|h|min-w|min-h|max-w|max-h|inset|top|right|bottom|left|z|text|font|leading|tracking|bg|border|rounded|shadow|opacity|flex|grid|col|row|order|basis|justify|items|content|self|place|overflow|object|aspect|size|translate|scale|rotate|duration|delay|ease|transition|ring|outline|fill|stroke|divide|decoration|cursor|select|list|align|whitespace|break|animate|blur|backdrop)-(.+)$/,jt=new Set(["xs","sm","md","lg","xl","full","auto","none","center","start","end","between","around","evenly","baseline","stretch","wrap","nowrap","reverse","col","row","bold","semibold","medium","normal","light","thin","black","white","transparent","current","scroll","clip","ellipsis","pointer","left","right","top","bottom","middle","justify","screen","fit","min","max","visible","hidden","dashed","dotted","solid","double","in","out","border","background","foreground","muted","primary","secondary","accent","destructive","card","popover","input"]);function qt(e){let t=e.startsWith("!")?e.slice(1):e;if(t.includes(":")||t.includes("[")||t.includes("]")||t.includes("/")||Gt.has(t))return true;let n=Vt.exec(t);if(n===null)return false;let r=n[1];return /\d/.test(r)?true:r.split("-").every(i=>jt.has(i))}var zt=["css-","sc-","jss-"];function Yt(e){for(let n of zt)if(e.startsWith(n))return true;let t=e.split(/[_-]/).pop()??"";return t.length>=5&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t)}function Kt(e){let t=F(e),n=new Map;for(let r of t){let i=r.classList;for(let o=0;o<i.length;o+=1){let a=i[o];n.set(a,(n.get(a)??0)+1);}}return {counts:n,total:t.length}}var Zt=10,Jt=.02;function Qt(e){return Math.max(Zt,Math.ceil(e*Jt))}var en=80;function ae(e,t){let n=e.getAttribute(t);return n===null||n.trim()===""||n.length>en||/[\n\r\t\f]/.test(n)||N(n)?null:n}function ce(e,t){return `[${e}="${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"]`}function _e(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);let t=e.replace(/[^a-zA-Z0-9_\u00A0-\uFFFF-]/g,n=>"\\"+n);return /^\d/.test(t)?t=`\\3${t[0]} ${t.slice(1)}`:/^-\d/.test(t)?t=`-\\3${t[1]} ${t.slice(2)}`:t==="-"&&(t="\\-"),t}function tn(e,t,n){let r;try{r=U(e,t);}catch{return null}return r.includes(n)?r.length:null}var nn="http://www.w3.org/1999/xhtml";function Ie(e){try{return rn(e)}catch{return {candidates:[],autoSelector:null}}}function rn(e){let t=e.ownerDocument,n=e.namespaceURI===null||e.namespaceURI===nn?e.tagName.toLowerCase():e.tagName,r=[];for(let c of Wt){let f=ae(e,c);f!==null&&r.push({selector:ce(c,f),tier:Ht});}let i=e.getAttribute("id");i!==null&&z(i)&&!N(i)&&r.push({selector:`#${_e(i)}`,tier:Z});for(let c of Xt){let f=ae(e,c);f!==null&&r.push({selector:ce(c,f),tier:Z});}let o=ae(e,"role");if(o!==null&&r.push({selector:`${n}${ce("role",o)}`,tier:Z}),e.classList.length>0){let{counts:c,total:f}=Kt(t),m=Qt(f),p=e.classList,g=new Set;for(let d=0;d<p.length;d+=1){let h=p[d];g.has(h)||(g.add(h),!(qt(h)||Yt(h)||N(h))&&((c.get(h)??0)>m||r.push({selector:`${n}.${_e(h)}`,tier:Bt})));}}let a=[];for(let c of r){let f=tn(t,c.selector,e);f!==null&&a.push({selector:c.selector,tier:c.tier,matchCount:f});}a.sort((c,f)=>c.tier-f.tier||c.matchCount-f.matchCount);let s=a.slice(0,5),l=s[0],u=l!==void 0&&l.tier<=Z&&l.matchCount===1?l.selector:null;return {candidates:s.map(c=>c.selector),autoSelector:u}}function x(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function on(e){try{let n=e.currentScript?.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let i=0;i<r.length;i++){let o=r[i].nonce;if(typeof o=="string"&&o.length>0)return o}return null}catch{return null}}var sn=typeof document<"u"?on(document):null;function cn(){return sn}function Ne(e){let t=cn();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var De="arcy-widget",k="data-arcy",ln="2147483000",un=[["position","fixed"],["inset","0"],["z-index",ln],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],fn=[["margin","0"],["padding","0"]],ke="data-arcy-style",H=new Map;function dn(e=De){let t=H.get(e);return t!==void 0&&t.host.isConnected}function Le(e={}){if(typeof document>"u")return null;let t=e.id??De,n=e.container;if(dn(t))return x("This ARCY surface is already on this page. Ignoring the second mount."),null;H.delete(t);let r=n??document.body??document.documentElement;if(!r)return x("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let i=document.querySelectorAll(`[${k}]`);for(let o=0;o<i.length;o+=1)if(i[o]?.id===t)return x("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let i=document.createElement("div");i.id=t,i.setAttribute(k,"");for(let[l,u]of un)i.style.setProperty(l,u,"important");for(let[l,u]of fn)i.style.setProperty(l,u);let o=i,a=!1;try{i.attachShadow&&(o=i.attachShadow({mode:"closed"}),a=!0);}catch{}r.appendChild(i),pn(i);let s={host:i,root:o,isolated:a,destroy(){try{i.parentNode&&i.parentNode.removeChild(i);}catch{}H.get(t)===s&&H.delete(t);}};return H.set(t,s),s}catch(i){return x(`The widget could not mount. ${String(i)}`),null}}var mn=["pointerdown","pointerup","pointercancel","mousedown","mouseup","click","dblclick","auxclick","contextmenu","touchstart","touchend","touchcancel","focusin","focusout","keydown","keyup","keypress","beforeinput","input","change","compositionstart","compositionupdate","compositionend","cut","copy","paste"];function pn(e){let t=n=>{try{n.stopPropagation();}catch{}};for(let n of mn)try{e.addEventListener(n,t);}catch{}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||gn(e.ownerDocument,e);});}catch{}}function gn(e,t){try{let n=e.activeElement;if(!n||n===t||t.contains(n)||n===e.body||n===e.documentElement)return;let r=n.blur;typeof r=="function"&&r.call(n);}catch{}}function Me(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${ke}]`);if(n)return n.textContent=`${n.textContent??""}
|
|
3
|
-
${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Ne(r),r.setAttribute(ke,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return x(`The widget could not apply its styles. ${String(n)}`),false}}var Be="[modern-screenshot]",_=typeof window<"u",hn=_&&"Worker"in window,fe=_?window.navigator?.userAgent:"",We=fe.includes("Chrome"),J=fe.includes("AppleWebKit")&&!We,de=fe.includes("Firefox"),En=e=>e&&"__CONTEXT__"in e,yn=e=>e.constructor.name==="CSSFontFaceRule",wn=e=>e.constructor.name==="CSSImportRule",bn=e=>e.constructor.name==="CSSLayerBlockRule",R=e=>e.nodeType===1,G=e=>typeof e.className=="object",Xe=e=>e.tagName==="image",Sn=e=>e.tagName==="use",B=e=>R(e)&&typeof e.style<"u"&&!G(e),Tn=e=>e.nodeType===8,An=e=>e.nodeType===3,M=e=>e.tagName==="IMG",Q=e=>e.tagName==="VIDEO",Cn=e=>e.tagName==="CANVAS",Rn=e=>e.tagName==="TEXTAREA",vn=e=>e.tagName==="INPUT",xn=e=>e.tagName==="STYLE",_n=e=>e.tagName==="SCRIPT",In=e=>e.tagName==="SELECT",Nn=e=>e.tagName==="SLOT",kn=e=>e.tagName==="IFRAME",Dn=(...e)=>console.warn(Be,...e);function Ln(e){let t=e?.createElement?.("canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}var le=e=>e.startsWith("data:");function Ge(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(_&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!_)return e;let n=ee().implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function ee(e){return (e&&R(e)?e?.ownerDocument:e)??window.document}var te="http://www.w3.org/2000/svg";function Mn(e,t,n){let r=ee(n).createElementNS(te,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}function Pn(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function On(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(new Error(`Failed read blob to ${t}`)),i.readAsDataURL(e);})}var Fn=e=>On(e,"dataUrl");function L(e,t){let n=ee(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function W(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:o,onWarn:a}=t??{},s=typeof e=="string"?L(e,ee(i)):e,l=null,u=null;function c(){n(s),l&&clearTimeout(l),u?.();}if(r&&(l=setTimeout(c,r)),Q(s)){let f=s.currentSrc||s.src;if(!f)return s.poster?W(s.poster,t).then(n):c();if(s.readyState>=2)return c();let m=c,p=g=>{a?.("Failed video load",f,g),o?.(g),c();};u=()=>{s.removeEventListener("loadeddata",m),s.removeEventListener("error",p);},s.addEventListener("loadeddata",m,{once:true}),s.addEventListener("error",p,{once:true});}else {let f=Xe(s)?s.href.baseVal:s.currentSrc||s.src;if(!f)return c();let m=async()=>{if(M(s)&&"decode"in s)try{await s.decode();}catch(g){a?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||f,g);}c();},p=g=>{a?.("Failed image load",s.dataset.originalSrc||f,g),c();};if(M(s)&&s.complete)return m();u=()=>{s.removeEventListener("load",m),s.removeEventListener("error",p);},s.addEventListener("load",m,{once:true}),s.addEventListener("error",p,{once:true});}})}async function Un(e,t){B(e)&&(M(e)||Q(e)?await W(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(r=>W(r,t)))));}var Ve=(function(){let t=0,n=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return ()=>(t+=1,`u${n()}${t}`)})();function je(e){return e?.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}var Pe=0;function $n(e){let t=`${Be}[#${Pe}]`;return Pe++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...n)=>e&&Dn(...n)}}function Hn(e){return {cache:e?"no-cache":"force-cache"}}async function qe(e,t){return En(e)?e:Bn(e,{...t,autoDestruct:true})}async function Bn(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},o=!!t?.debug,a=t?.features??true,s=e.ownerDocument??(_?window.document:void 0),l=e.ownerDocument?.defaultView??(_?window:void 0),u=new Map,c={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:Hn(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:false,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:false,...t,__CONTEXT__:true,log:$n(o),node:e,ownerDocument:s,ownerWindow:l,dpi:n===1?null:96*n,svgStyleElement:ze(s),svgDefsElement:s?.createElementNS(te,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:hn&&r&&i?i:0})].map(()=>{try{let p=new Worker(r);return p.onmessage=async g=>{let{url:d,result:h}=g.data;h?u.get(d)?.resolve?.(h):u.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));},p.onmessageerror=g=>{let{url:d}=g.data;u.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));},p}catch(p){return c.log.warn("Failed to new Worker",p),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Ln(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:u,drawImageCount:0,tasks:[],features:a,isEnable:p=>p==="restoreScrollPosition"?typeof a=="boolean"?false:a[p]??false:typeof a=="boolean"?a:a[p]??true,shadowRoots:[]};c.log.time("wait until load"),await Un(e,{timeout:c.timeout,onWarn:c.log.warn}),c.log.timeEnd("wait until load");let{width:f,height:m}=Wn(e,c);return c.width=f,c.height=m,c}function ze(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode(`
|
|
4
|
-
.______background-clip--text {
|
|
5
|
-
background-clip: text;
|
|
6
|
-
-webkit-background-clip: text;
|
|
7
|
-
}
|
|
8
|
-
`);return t.appendChild(n),t}function Wn(e,t){let{width:n,height:r}=t;if(R(e)&&(!n||!r)){let i=e.getBoundingClientRect();n=n||i.width||Number(e.getAttribute("width"))||0,r=r||i.height||Number(e.getAttribute("height"))||0;}return {width:n,height:r}}async function Xn(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:o}=t;n.time("image to canvas");let a=await W(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:l}=Gn(e.ownerDocument,t),u=()=>{try{l?.drawImage(a,0,0,s.width,s.height);}catch(c){t.log.warn("Failed to drawImage",c);}};if(u(),t.isEnable("fixSvgXmlDecode"))for(let c=0;c<i;c++)await new Promise(f=>{setTimeout(()=>{l?.clearRect(0,0,s.width,s.height),u(),f();},c+o);});return t.drawImageCount=0,n.timeEnd("image to canvas"),s}function Gn(e,t){let{width:n,height:r,scale:i,backgroundColor:o,maximumCanvasSize:a}=t,s=e.createElement("canvas");s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,a&&(s.width>a||s.height>a)&&(s.width>a&&s.height>a?s.width>s.height?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a):s.width>a?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a));let l=s.getContext("2d");return l&&o&&(l.fillStyle=o,l.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:l}}function Ye(e,t){if(e.ownerDocument)try{let o=e.toDataURL();if(o!=="data:,")return L(o,e.ownerDocument)}catch(o){t.log.warn("Failed to clone canvas",o);}let n=e.cloneNode(false),r=e.getContext("2d"),i=n.getContext("2d");try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(o){t.log.warn("Failed to clone canvas",o);}return n}function Vn(e,t){try{if(e?.contentDocument?.documentElement)return me(e.contentDocument.documentElement,t)}catch(n){t.log.warn("Failed to clone iframe",n);}return e.cloneNode(false)}function jn(e){let t=e.cloneNode(false);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager"),t}async function qn(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return L(e.poster,e.ownerDocument);let n=e.cloneNode(false);n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=true;if(await W(n,{onError:()=>i=false,onWarn:t.log.warn}),!i)return e.poster?L(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(a=>{n.addEventListener("seeked",a,{once:true});});let o=r.createElement("canvas");o.width=e.offsetWidth,o.height=e.offsetHeight;try{let a=o.getContext("2d");a&&a.drawImage(n,0,0,o.width,o.height);}catch(a){return t.log.warn("Failed to clone video",a),e.poster?L(e.poster,e.ownerDocument):n}return Ye(o,t)}return n}function zn(e,t){return Cn(e)?Ye(e,t):kn(e)?Vn(e,t):M(e)?jn(e):Q(e)?qn(e,t):e.cloneNode(false)}function Yn(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement("iframe"),t.id=`__SANDBOX__${Ve()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',e.sandbox=t);}catch(r){e.log.warn("Failed to getSandBox",r);}}return t}var Kn=["width","height","-webkit-text-fill-color"],Zn=["stroke","fill"];function Ke(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),o=G(e)&&i!=="svg",a=o?Zn.map(d=>[d,e.getAttribute(d)]).filter(([,d])=>d!==null):[],s=[o&&"svg",i,a.map((d,h)=>`${d}=${h}`).join(","),t].filter(Boolean).join(":");if(r.has(s))return r.get(s);let u=Yn(n)?.contentWindow;if(!u)return new Map;let c=u?.document,f,m;o?(f=c.createElementNS(te,"svg"),m=f.ownerDocument.createElementNS(f.namespaceURI,i),a.forEach(([d,h])=>{m.setAttributeNS(null,d,h);}),f.appendChild(m)):f=m=c.createElement(i),m.textContent=" ",c.body.appendChild(f);let p=u.getComputedStyle(m,t),g=new Map;for(let d=p.length,h=0;h<d;h++){let w=p.item(h);Kn.includes(w)||g.set(w,p.getPropertyValue(w));}return c.body.removeChild(f),r.set(s,g),g}function Ze(e,t,n){let r=new Map,i=[],o=new Map;if(n)for(let s of n)a(s);else for(let s=e.length,l=0;l<s;l++){let u=e.item(l);a(u);}for(let s=i.length,l=0;l<s;l++)o.get(i[l])?.forEach((u,c)=>r.set(c,u));function a(s){let l=e.getPropertyValue(s),u=e.getPropertyPriority(s),c=s.lastIndexOf("-"),f=c>-1?s.substring(0,c):void 0;if(f){let m=o.get(f);m||(m=new Map,o.set(f,m)),m.set(s,[l,u]);}t.get(s)===l&&!u||(f?i.push(f):r.set(s,[l,u]));}return r}function Jn(e,t,n,r){let{ownerWindow:i,includeStyleProperties:o,currentParentNodeStyle:a}=r,s=t.style,l=i.getComputedStyle(e),u=Ke(e,null,r);a?.forEach((f,m)=>{u.delete(m);});let c=Ze(l,u,o);c.delete("transition-property"),c.delete("all"),c.delete("d"),c.delete("content"),n&&(c.delete("position"),c.delete("margin-top"),c.delete("margin-right"),c.delete("margin-bottom"),c.delete("margin-left"),c.delete("margin-block-start"),c.delete("margin-block-end"),c.delete("margin-inline-start"),c.delete("margin-inline-end"),c.set("box-sizing",["border-box",""])),c.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text"),We&&(c.has("font-kerning")||c.set("font-kerning",["normal",""]),(c.get("overflow-x")?.[0]==="hidden"||c.get("overflow-y")?.[0]==="hidden")&&c.get("text-overflow")?.[0]==="ellipsis"&&e.scrollWidth===e.clientWidth&&c.set("text-overflow",["clip",""]));for(let f=s.length,m=0;m<f;m++)s.removeProperty(s.item(m));return c.forEach(([f,m],p)=>{s.setProperty(p,f,m);}),c}function Qn(e,t){(Rn(e)||vn(e)||In(e))&&t.setAttribute("value",e.value);}var er=["::before","::after"],tr=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function nr(e,t,n,r,i){let{ownerWindow:o,svgStyleElement:a,svgStyles:s,currentNodeStyle:l}=r;if(!a||!o)return;function u(c){let f=o.getComputedStyle(e,c),m=f.getPropertyValue("content");if(!m||m==="none")return;i?.(m),m=m.replace(/(')|(")|(counter\(.+\))/g,"");let p=[Ve()],g=Ke(e,c,r);l?.forEach((S,A)=>{g.delete(A);});let d=Ze(f,g,r.includeStyleProperties);d.delete("content"),d.delete("-webkit-locale"),d.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text");let h=[`content: '${m}';`];if(d.forEach(([S,A],C)=>{h.push(`${C}: ${S}${A?" !important":""};`);}),h.length===1)return;try{t.className=[t.className,...p].join(" ");}catch(S){r.log.warn("Failed to copyPseudoClass",S);return}let w=h.join(`
|
|
9
|
-
`),b=s.get(w);b||(b=[],s.set(w,b)),b.push(`.${p[0]}${c}`);}er.forEach(u),n&&tr.forEach(u);}var Oe=new Set(["symbol"]);async function Fe(e,t,n,r,i){if(R(n)&&(xn(n)||_n(n))||r.filter&&!r.filter(n))return;Oe.has(t.nodeName)||Oe.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let o=await me(n,r,false,i);r.isEnable("restoreScrollPosition")&&rr(e,o),t.appendChild(o);}async function Ue(e,t,n,r){let i=e.firstChild;R(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let o=i;o;o=o.nextSibling)if(!Tn(o))if(R(o)&&Nn(o)&&typeof o.assignedNodes=="function"){let a=o.assignedNodes();for(let s=0;s<a.length;s++)await Fe(e,t,a[s],n,r);}else await Fe(e,t,o,n,r);}function rr(e,t){if(!B(e)||!B(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,o=new DOMMatrix(i),{a,b:s,c:l,d:u}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-r,-n),o.a=a,o.b=s,o.c=l,o.d=u,t.style.transform=o.toString();}function or(e,t){let{backgroundColor:n,width:r,height:i,style:o}=t,a=e.style;if(n&&a.setProperty("background-color",n,"important"),r&&a.setProperty("width",`${r}px`,"important"),i&&a.setProperty("height",`${i}px`,"important"),o)for(let s in o)a[s]=o[s];}var ir=/^[\w-:]+$/;async function me(e,t,n=false,r){let{ownerDocument:i,ownerWindow:o,fontFamilies:a,onCloneEachNode:s}=t;if(i&&An(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&o&&R(e)&&(B(e)||G(e))){let u=await zn(e,t);if(t.isEnable("removeAbnormalAttributes")){let d=u.getAttributeNames();for(let h=d.length,w=0;w<h;w++){let b=d[w];ir.test(b)||u.removeAttribute(b);}}let c=t.currentNodeStyle=Jn(e,u,n,t);n&&or(u,t);let f=false;if(t.isEnable("copyScrollbar")){let d=[c.get("overflow-x")?.[0],c.get("overflow-y")?.[0]];f=d.includes("scroll")||(d.includes("auto")||d.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth);}let m=c.get("text-transform")?.[0],p=je(c.get("font-family")?.[0]),g=p?d=>{m==="uppercase"?d=d.toUpperCase():m==="lowercase"?d=d.toLowerCase():m==="capitalize"&&(d=d[0].toUpperCase()+d.substring(1)),p.forEach(h=>{let w=a.get(h);w||a.set(h,w=new Set),d.split("").forEach(b=>w.add(b));});}:void 0;return nr(e,u,f,t,g),Qn(e,u),Q(e)||await Ue(e,u,t,g),await s?.(u),u}let l=e.cloneNode(false);return await Ue(e,l,t),await s?.(l),l}function sr(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove();}catch(t){e.log.warn("Failed to destroyContext",t);}e.sandbox=void 0;}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[];}function ar(e){let{url:t,timeout:n,responseType:r,...i}=e,o=new AbortController,a=n?setTimeout(()=>o.abort(),n):void 0;return fetch(t,{signal:o.signal,...i}).then(s=>{if(!s.ok)throw new Error("Failed fetch, not 2xx response",{cause:s});switch(r){case "arrayBuffer":return s.arrayBuffer();case "dataUrl":return s.blob().then(Fn);default:return s.text()}}).finally(()=>clearTimeout(a))}function X(e,t){let{url:n,requestType:r="text",responseType:i="text",imageDom:o}=t,a=n,{timeout:s,acceptOfImage:l,requests:u,fetchFn:c,fetch:{requestInit:f,bypassingCache:m,placeholderImage:p},font:g,workers:d,fontFamilies:h}=e;r==="image"&&(J||de)&&e.drawImageCount++;let w=u.get(n);if(!w){m&&m instanceof RegExp&&m.test(a)&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let b=r.startsWith("font")&&g&&g.minify,S=new Set;b&&r.split(";")[1].split(",").forEach(I=>{h.has(I)&&h.get(I).forEach(V=>S.add(V));});let A=b&&S.size,C={url:a,timeout:s,responseType:A?"arrayBuffer":i,headers:r==="image"?{accept:l}:void 0,...f};w={type:r,resolve:void 0,reject:void 0,response:null},w.response=(async()=>{if(c&&r==="image"){let T=await c(n);if(T)return T}return !J&&n.startsWith("http")&&d.length?new Promise((T,I)=>{d[u.size&d.length-1].postMessage({rawUrl:n,...C}),w.resolve=T,w.reject=I;}):ar(C)})().catch(T=>{if(u.delete(n),r==="image"&&p)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",a),typeof p=="string"?p:p(o);throw T}),u.set(n,w);}return w.response}async function Je(e,t,n,r){if(!Qe(e))return e;for(let[i,o]of cr(e,t))try{let a=await X(n,{url:o,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(lr(i),`$1${a}$3`);}catch(a){n.log.warn("Failed to fetch css data url",i,a);}return e}function Qe(e){return /url\((['"]?)([^'"]+?)\1\)/.test(e)}var et=/url\((['"]?)([^'"]+?)\1\)/g;function cr(e,t){let n=[];return e.replace(et,(r,i,o)=>(n.push([o,Ge(o,t)]),r)),n.filter(([r])=>!le(r))}function lr(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}var ur=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function fr(e,t){return ur.map(n=>{let r=e.getPropertyValue(n);return !r||r==="none"?null:((J||de)&&t.drawImageCount++,Je(r,null,t,true).then(i=>{!i||r===i||e.setProperty(n,i,e.getPropertyPriority(n));}))}).filter(Boolean)}function dr(e,t){if(M(e)){let n=e.currentSrc||e.src;if(!le(n))return [X(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.srcset="",e.dataset.originalSrc=n,e.src=r||"");})];(J||de)&&t.drawImageCount++;}else if(G(e)&&!le(e.href.baseVal)){let n=e.href.baseVal;return [X(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.dataset.originalSrc=n,e.href.baseVal=r||"");})]}return []}function mr(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute("href")??e.getAttribute("xlink:href");if(!i)return [];let[o,a]=i.split("#");if(a){let s=`#${a}`,l=t.shadowRoots.reduce((u,c)=>u??c.querySelector(`svg ${s}`),n?.querySelector(`svg ${s}`));if(o&&e.setAttribute("href",s),r?.querySelector(s))return [];if(l)return r?.appendChild(l.cloneNode(true)),[];if(o)return [X(t,{url:o,responseType:"text"}).then(u=>{r?.insertAdjacentHTML("beforeend",u);})]}return []}function tt(e,t){let{tasks:n}=t;R(e)&&((M(e)||Xe(e))&&n.push(...dr(e,t)),Sn(e)&&n.push(...mr(e,t))),B(e)&&n.push(...fr(e.style,t)),e.childNodes.forEach(r=>{tt(r,t);});}async function pr(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:o,tasks:a,font:s}=t;if(!(!n||!r||!i.size))if(s&&s.cssText){let l=He(s.cssText,t);r.appendChild(n.createTextNode(`${l}
|
|
10
|
-
`));}else {let l=Array.from(n.styleSheets).filter(p=>{try{return "cssRules"in p&&!!p.cssRules.length}catch(g){return t.log.warn(`Error while reading CSS rules from ${p.href}`,g),false}}),u=n.implementation.createHTMLDocument(""),c=u.createElement("style");u.head.appendChild(c);let f=c.sheet;await Promise.all(l.flatMap(p=>Array.from(p.cssRules).map(async g=>{if(wn(g)){let d=g.href,h="";try{h=await X(t,{url:d,requestType:"text",responseType:"text"});}catch(b){t.log.warn(`Error fetch remote css import from ${d}`,b);}let w=h.replace(et,(b,S,A)=>b.replace(A,Ge(A,d)));for(let b of hr(w))try{f.insertRule(b,f.cssRules.length);}catch(S){t.log.warn("Error inserting rule from remote css import",{rule:b,error:S});}}}))),f.cssRules.length&&l.push(f);let m=[];l.forEach(p=>{ue(p.cssRules,m);}),m.filter(p=>yn(p)&&Qe(p.style.getPropertyValue("src"))&&je(p.style.getPropertyValue("font-family"))?.some(g=>i.has(g))).forEach(p=>{let g=p,d=o.get(g.cssText);d?r.appendChild(n.createTextNode(`${d}
|
|
11
|
-
`)):a.push(Je(g.cssText,g.parentStyleSheet?g.parentStyleSheet.href:null,t).then(h=>{h=He(h,t),o.set(g.cssText,h),r.appendChild(n.createTextNode(`${h}
|
|
12
|
-
`));}));});}}var gr=/(\/\*[\s\S]*?\*\/)/g,$e=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function hr(e){if(e==null)return [];let t=[],n=e.replace(gr,"");for(;;){let o=$e.exec(n);if(!o)break;t.push(o[0]);}n=n.replace($e,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let o=r.exec(n);if(o)i.lastIndex=r.lastIndex;else if(o=i.exec(n),o)r.lastIndex=i.lastIndex;else break;t.push(o[0]);}return t}var Er=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,yr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function He(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(yr,i=>{for(;;){let[o,,a]=Er.exec(i)||[];if(!a)return "";if(a===r)return `src: ${o};`}}):e}function ue(e,t=[]){for(let n of Array.from(e))bn(n)?t.push(...ue(n.cssRules)):"cssRules"in n?ue(n.cssRules,t):t.push(n);return t}var wr=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function br(e){return wr.test(e.innerHTML)}async function Sr(e,t){let n=await qe(e,t);if(R(n.node)&&G(n.node)&&!br(n.node))return n.node;let{ownerDocument:r,log:i,tasks:o,svgStyleElement:a,svgDefsElement:s,svgStyles:l,font:u,progress:c,autoDestruct:f,onCloneNode:m,onEmbedNode:p,onCreateForeignObjectSvg:g}=n;i.time("clone node");let d=await me(n.node,n,true);if(a&&r){let A="";l.forEach((C,T)=>{A+=`${C.join(`,
|
|
13
|
-
`)} {
|
|
14
|
-
${T}
|
|
15
|
-
}
|
|
16
|
-
`;}),a.appendChild(r.createTextNode(A));}i.timeEnd("clone node"),await m?.(d),u!==false&&R(d)&&(i.time("embed web font"),await pr(d,n),i.timeEnd("embed web font")),i.time("embed node"),tt(d,n);let h=o.length,w=0,b=async()=>{for(;;){let A=o.pop();if(!A)break;try{await A;}catch(C){n.log.warn("Failed to run task",C);}c?.(++w,h);}};c?.(w,h),await Promise.all([...Array.from({length:4})].map(b)),i.timeEnd("embed node"),await p?.(d);let S=Tr(d,n);return s&&S.insertBefore(s,S.children[0]),a&&S.insertBefore(a,S.children[0]),f&&sr(n),await g?.(S),S}function Tr(e,t){let{width:n,height:r}=t,i=Mn(n,r,e.ownerDocument),o=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(e),i.appendChild(o),i}async function nt(e,t){let n=await qe(e,t),r=await Sr(n),i=Pn(r,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=ze(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(te,"defs"),n.svgStyles.clear());let o=L(i,r.ownerDocument);return await Xn(o,n)}var rt=8e3;var Ar=.25,Cr=160,Rr=28,vr=1600,xr=1200,_r=2,Ir=26e5,Nr=36e5,kr=rt,Dr=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],it="[masked]",Lr="#f04e23";function pe(e){let t=e;for(let n of Dr)n.lastIndex=0,t=t.replace(n,it);return t}function ot(e){return Math.min(Math.max(e*Ar,Rr),Cr)}function Mr(e,t,n){let r=ot(e.width),i=ot(e.height),o=Math.max(0,e.left-r),a=Math.max(0,e.top-i),s=Math.min(t,e.left+e.width+r),l=Math.min(n,e.top+e.height+i),u=Math.min(s-o,vr),c=Math.min(l-a,xr);return s-o>u&&(o+=(s-o-u)/2),l-a>c&&(a+=(l-a-c)/2),{left:o,top:a,width:Math.max(0,u),height:Math.max(0,c)}}function Pr(e){if(e instanceof HTMLTextAreaElement)return true;if(!(e instanceof HTMLInputElement))return false;let t=e.type;return t!=="checkbox"&&t!=="radio"&&t!=="hidden"&&t!=="file"}function Or(e){return !(e instanceof Element&&e.hasAttribute(k))}function Fr(e){let t=e.ownerDocument??e,n=t.defaultView,r=t.createTreeWalker(e,(n?.NodeFilter??NodeFilter).SHOW_ELEMENT|(n?.NodeFilter??NodeFilter).SHOW_TEXT),i=[],o=r.currentNode;for(;o;){if(o.nodeType===3){let a=o.nodeValue;if(a&&a.trim()){let s=pe(a);s!==a&&(o.nodeValue=s);}}else if(o instanceof Element||o.tagName){let a=o;if(a.hasAttribute(k))i.push(a);else if(Pr(a)){let s=a instanceof HTMLInputElement&&a.type==="password",l=a.getAttribute("value")??a.value??"",u=s&&l?it:pe(l);a instanceof HTMLTextAreaElement?(a.textContent=u,a.value=u):(a.setAttribute("value",u),a.value=u);let c=a.getAttribute("placeholder");c&&a.setAttribute("placeholder",pe(c));}}o=r.nextNode();}for(let a of i)a.parentNode?.removeChild(a);}function Ur(e,t,n,r){e.save(),e.strokeStyle=Lr,e.lineWidth=2*r;let i=r;e.strokeRect((t.left-n.left)*r+i,(t.top-n.top)*r+i,t.width*r-i*2,t.height*r-i*2),e.restore();}function $r(e,t){let n=Math.min(e.devicePixelRatio||1,_r),r=t.width*t.height;return r<=0?1:Math.max(.5,Math.min(n,Math.sqrt(Ir/r)))}function Hr(e,t){let n=t.createElement("canvas");n.width=Math.max(1,Math.round(e.width/2)),n.height=Math.max(1,Math.round(e.height/2));let r=n.getContext("2d");return r?(r.drawImage(e,0,0,n.width,n.height),n):null}async function st(e){try{let t=e.ownerDocument,n=t.defaultView;if(!n||!t.documentElement||!e.isConnected)return null;let r=e.getBoundingClientRect(),i={left:r.left,top:r.top,width:r.width,height:r.height};if(i.width<=0||i.height<=0)return null;let o=Mr(i,n.innerWidth,n.innerHeight);if(o.width<=0||o.height<=0)return null;let a=$r(n,o),s=-(o.left+(n.scrollX||0)),l=-(o.top+(n.scrollY||0)),u=await nt(t.documentElement,{width:o.width,height:o.height,scale:a,backgroundColor:"#ffffff",timeout:kr,filter:Or,onCloneNode:m=>{Fr(m);},font:{preferredFormat:"woff2"},style:{transform:`translate(${s}px, ${l}px)`,transformOrigin:"top left",width:`${n.innerWidth}px`,minHeight:`${n.innerHeight}px`,margin:"0",overflow:"visible"}}),c=u.getContext("2d");if(!c)return null;Ur(c,i,o,a);let f=u.toDataURL("image/png");if(f.length>Nr){let m=Hr(u,t);if(!m)return null;f=m.toDataURL("image/png");}return f}catch{return null}}var Br="arcy-picker",v="arcy-picker-banner",ct="arcy-picker-highlight",Wr=`
|
|
17
|
-
.${v} {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
gap: 10px;
|
|
21
|
-
padding: 10px 14px;
|
|
22
|
-
border-radius: 999px;
|
|
23
|
-
background: #101828;
|
|
24
|
-
color: #ffffff;
|
|
25
|
-
font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
26
|
-
box-shadow: 0 8px 24px rgba(16, 24, 40, 0.28);
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
}
|
|
29
|
-
.${v}__title {
|
|
30
|
-
font-weight: 600;
|
|
31
|
-
margin-right: 2px;
|
|
32
|
-
}
|
|
33
|
-
.${v}__status {
|
|
34
|
-
max-width: 260px;
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
text-overflow: ellipsis;
|
|
37
|
-
color: #d0d5dd;
|
|
38
|
-
}
|
|
39
|
-
.${v} button {
|
|
40
|
-
appearance: none;
|
|
41
|
-
border: 1px solid rgba(255, 255, 255, 0.25);
|
|
42
|
-
border-radius: 999px;
|
|
43
|
-
background: transparent;
|
|
44
|
-
color: #ffffff;
|
|
45
|
-
font: inherit;
|
|
46
|
-
padding: 4px 12px;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
}
|
|
49
|
-
.${v} button:hover {
|
|
50
|
-
background: rgba(255, 255, 255, 0.1);
|
|
51
|
-
}
|
|
52
|
-
.${v} button.is-active {
|
|
53
|
-
background: #f04e23;
|
|
54
|
-
border-color: #f04e23;
|
|
55
|
-
}
|
|
56
|
-
.${ct} {
|
|
57
|
-
border-radius: 3px;
|
|
58
|
-
}
|
|
59
|
-
`;function at(e,t,n=[]){e.style.setProperty("position","absolute","important"),e.style.setProperty("pointer-events",t,"important");for(let[r,i]of n)e.style.setProperty(r,i,"important");}var Xr=[["box-sizing","border-box"],["border","2px solid #f04e23"],["background","rgba(240, 78, 35, 0.08)"]],Gr=[["left","50%"],["bottom","24px"]],Vr=[["transform","translateX(-50%)"]];function jr(e){let{text:t,tag:n}=e.core;return t?`Sent "${t}" to ARCY`:`Sent <${n}> to ARCY`}function lt(e){let t=Le({id:Br});if(!t)return null;let n=t.host.ownerDocument,r="pick",i=false,o=null,a=0;Me(t,Wr);let s=n.createElement("div");s.className=ct,at(s,"none");for(let[E,y]of Xr)s.style.setProperty(E,y);d();let l=n.createElement("div");l.className=v,at(l,"auto",Gr);for(let[E,y]of Vr)l.style.setProperty(E,y);let u=n.createElement("span");u.className=`${v}__title`,u.textContent="ARCY element picker";let c=n.createElement("button");c.type="button",c.textContent="Pick";let f=n.createElement("button");f.type="button",f.textContent="Browse";let m=n.createElement("span");m.className=`${v}__status`,m.textContent="Click the element you want this step to target.";let p=n.createElement("button");p.type="button",p.textContent="Exit",l.append(u,c,f,m,p),t.root.append(s,l);function g(E){r=E,c.classList.toggle("is-active",E==="pick"),f.classList.toggle("is-active",E==="browse"),m.textContent=E==="pick"?"Click the element you want this step to target.":"Browsing. Clicks work normally; switch back to pick.",E==="browse"&&d();}function d(){s.style.setProperty("display","none","important");}function h(E){try{let y=E.getBoundingClientRect();if(y.width===0&&y.height===0){d();return}s.style.setProperty("left",`${y.left}px`,"important"),s.style.setProperty("top",`${y.top}px`,"important"),s.style.setProperty("width",`${y.width}px`,"important"),s.style.setProperty("height",`${y.height}px`,"important"),s.style.setProperty("display","block","important");}catch{d();}}function w(E){return E instanceof Element&&Te(E,`[${k}]`)!==null}function b(E){if(typeof E.composedPath=="function"){let y=E.composedPath();if(y.length>0)return y[0]}return E.target}function S(){return t!==null&&t.host.isConnected?false:(ne(),true)}let A=E=>{try{if(S()||r!=="pick")return;let y=b(E);if(w(y)||!(y instanceof Element)){o=null,d();return}o=ie(y),h(o);}catch{}},C=()=>{try{if(S()||r!=="pick")return;o&&o.isConnected?h(o):d();}catch{}},T=E=>{try{if(S()||r!=="pick"||w(b(E)))return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();}catch{}},I=E=>{try{if(S()||r!=="pick")return;let y=b(E);if(w(y)||(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),!(y instanceof Element)))return;let P=ie(y),O=Se(Y(P)),Ee=Ie(P);O.selector=Ee.autoSelector,O.selectorCandidates=Ee.candidates,m.textContent=jr(O),o=P,h(P);let ye=0;try{ye=xe(O,n).matchCount;}catch{}if(e.onPick(O,ye),e.screenshotsEnabled===!1)return;let ut=++a;st(P).then(we=>{if(!(!we||i||ut!==a))try{e.onScreenshot?.(we);}catch{}});}catch(y){x(`The element picker could not read that element. ${String(y)}`);}};function V(E){if(!(E instanceof Element))return false;let y=E.tagName;return y==="INPUT"||y==="TEXTAREA"||y==="SELECT"?true:E.isContentEditable===true}let ge=E=>{try{if(S())return;let y=E;if(!y.altKey||y.code!=="KeyS"&&y.key.toLowerCase()!=="s"||V(b(y)))return;y.preventDefault(),g(r==="pick"?"browse":"pick");}catch{}};function ne(){if(!i){i=true;try{n.removeEventListener("pointerdown",T,!0),n.removeEventListener("mousedown",T,!0),n.removeEventListener("mouseup",T,!0),n.removeEventListener("auxclick",T,!0),n.removeEventListener("click",I,!0),n.removeEventListener("mousemove",A,!0),n.removeEventListener("keydown",ge,!0),n.defaultView?.removeEventListener("scroll",C,!0),n.defaultView?.removeEventListener("resize",C);}catch{}t?.destroy(),t=null;}}let he=E=>{try{E.preventDefault();}catch{}};return l.addEventListener("pointerdown",he),l.addEventListener("mousedown",he),c.addEventListener("click",()=>g("pick")),f.addEventListener("click",()=>g("browse")),p.addEventListener("click",()=>{ne();try{e.onExit();}catch{}}),n.addEventListener("pointerdown",T,true),n.addEventListener("mousedown",T,true),n.addEventListener("mouseup",T,true),n.addEventListener("auxclick",T,true),n.addEventListener("click",I,true),n.addEventListener("mousemove",A,true),n.addEventListener("keydown",ge,true),n.defaultView?.addEventListener("scroll",C,true),n.defaultView?.addEventListener("resize",C),g("pick"),{destroy:ne}}var zr={contract:2,mount:e=>{try{return lt(e)}catch{return null}}};if(typeof window<"u")try{window[be]=zr;}catch{}})();
|