signetai 0.82.0 → 0.82.2

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.
Files changed (58) hide show
  1. package/dashboard/_app/immutable/chunks/{DTRTIsLb.js → -GB9BHh5.js} +1 -1
  2. package/dashboard/_app/immutable/chunks/{CnHEsWV3.js → 1Q68eYvu.js} +1 -1
  3. package/dashboard/_app/immutable/chunks/{Cc_gOqHV.js → 1wENB9Fv.js} +1 -1
  4. package/dashboard/_app/immutable/chunks/{oAB4kRgQ.js → 6or1KV6K.js} +1 -1
  5. package/dashboard/_app/immutable/chunks/{CiUfBdL1.js → 852TS80n.js} +1 -1
  6. package/dashboard/_app/immutable/chunks/{Ceqo3EoR.js → B-kccdvK.js} +2 -2
  7. package/dashboard/_app/immutable/chunks/{BUbSI_oP.js → BBKe1vca.js} +1 -1
  8. package/dashboard/_app/immutable/chunks/{CEoInRel.js → BChLYXWi.js} +1 -1
  9. package/dashboard/_app/immutable/chunks/{aFfrvvmo.js → BCteBoj0.js} +1 -1
  10. package/dashboard/_app/immutable/chunks/BDhqtJbW.js +1 -0
  11. package/dashboard/_app/immutable/chunks/{DgX8TKZr.js → BFuSQEak.js} +2 -2
  12. package/dashboard/_app/immutable/chunks/{CD0lxm09.js → BJdKlhKO.js} +1 -1
  13. package/dashboard/_app/immutable/chunks/{2fP-ncH_.js → BUS5nQyj.js} +1 -1
  14. package/dashboard/_app/immutable/chunks/{CwOLmthK.js → BWbT4F5H.js} +1 -1
  15. package/dashboard/_app/immutable/chunks/{ROvu7Gs0.js → Bkr-PEYs.js} +1 -1
  16. package/dashboard/_app/immutable/chunks/{BuNTDEKa.js → BvFycAhF.js} +1 -1
  17. package/dashboard/_app/immutable/chunks/{BnI4WXsN.js → BzRQnGPj.js} +1 -1
  18. package/dashboard/_app/immutable/chunks/{BqqSu535.js → C8n6MUA5.js} +1 -1
  19. package/dashboard/_app/immutable/chunks/{BAwTtBbw.js → CDMcm1RD.js} +1 -1
  20. package/dashboard/_app/immutable/chunks/{D4s3f2f1.js → CFGlMKB9.js} +1 -1
  21. package/dashboard/_app/immutable/chunks/{CPe4YXqt.js → CM3Ez5Zb.js} +1 -1
  22. package/dashboard/_app/immutable/chunks/{BdX1l6gL.js → CNH5O-MO.js} +1 -1
  23. package/dashboard/_app/immutable/chunks/{FL-YoeN8.js → CQjlljeJ.js} +3 -3
  24. package/dashboard/_app/immutable/chunks/{dGtB_DAh.js → Cbk0kQP5.js} +1 -1
  25. package/dashboard/_app/immutable/chunks/{CrobSJ71.js → CgytmeWL.js} +1 -1
  26. package/dashboard/_app/immutable/chunks/{V7Hfe6JO.js → Cr8sLgDL.js} +1 -1
  27. package/dashboard/_app/immutable/chunks/{DxV87o8C.js → CuvNi-av.js} +1 -1
  28. package/dashboard/_app/immutable/chunks/{BjsLiXh7.js → CwnhW_Rr.js} +1 -1
  29. package/dashboard/_app/immutable/chunks/{DEdxwOeX.js → D43mjuJx.js} +1 -1
  30. package/dashboard/_app/immutable/chunks/{P5ivX1lN.js → D9KlJ5Yg.js} +1 -1
  31. package/dashboard/_app/immutable/chunks/{CWtK7wBm.js → D9ZAYnCR.js} +1 -1
  32. package/dashboard/_app/immutable/chunks/{BzUDMZno.js → DHIs_HOM.js} +1 -1
  33. package/dashboard/_app/immutable/chunks/{BlLONMPI.js → DHvkPM9v.js} +1 -1
  34. package/dashboard/_app/immutable/chunks/{aMuFYuii.js → DK3Rbu4L.js} +1 -1
  35. package/dashboard/_app/immutable/chunks/{CcQEo2zx.js → DVe5pC9Y.js} +1 -1
  36. package/dashboard/_app/immutable/chunks/{CiTctn0M.js → FwPtkZZE.js} +1 -1
  37. package/dashboard/_app/immutable/chunks/{LVjcJtup.js → HOTJvN83.js} +1 -1
  38. package/dashboard/_app/immutable/chunks/{CaTq3hOd.js → NA4Ojz1i.js} +1 -1
  39. package/dashboard/_app/immutable/chunks/{GgjitmE2.js → awbRdlBM.js} +1 -1
  40. package/dashboard/_app/immutable/chunks/{DRWr_13h.js → hmTB_1dN.js} +1 -1
  41. package/dashboard/_app/immutable/chunks/{CB1YaXSX.js → jzXL31dT.js} +1 -1
  42. package/dashboard/_app/immutable/chunks/{iPAoLvYg.js → pgAhHv2c.js} +1 -1
  43. package/dashboard/_app/immutable/chunks/{Dhm8CqUW.js → rjiWOQwm.js} +1 -1
  44. package/dashboard/_app/immutable/chunks/{BB2BANcU.js → snoubzjY.js} +1 -1
  45. package/dashboard/_app/immutable/chunks/{DG8brTvb.js → xOiKZTGm.js} +1 -1
  46. package/dashboard/_app/immutable/chunks/{TgFjb73q.js → xcrNeRwl.js} +1 -1
  47. package/dashboard/_app/immutable/chunks/{DHB-X_rM.js → y2gm4xUz.js} +1 -1
  48. package/dashboard/_app/immutable/entry/{app.CywjCrUn.js → app.5FvbB9fS.js} +2 -2
  49. package/dashboard/_app/immutable/entry/start.DrmR0YWN.js +1 -0
  50. package/dashboard/_app/immutable/nodes/{1.CNdOVMx0.js → 1.BvVPeaUx.js} +1 -1
  51. package/dashboard/_app/immutable/nodes/2.BTg2Yidd.js +1 -0
  52. package/dashboard/_app/version.json +1 -1
  53. package/dashboard/index.html +6 -6
  54. package/dist/cli.js +797 -268
  55. package/package.json +1 -1
  56. package/dashboard/_app/immutable/chunks/CEhDnuq8.js +0 -1
  57. package/dashboard/_app/immutable/entry/start.Dv-UACGE.js +0 -1
  58. package/dashboard/_app/immutable/nodes/2.C3Wi-1Hh.js +0 -1
@@ -1 +1 @@
1
- import{p as n,s as d,c as h,f as c,a as i,n as l,b as m,d as f,r as v}from"./Ddm7yfuh.js";import{I as u}from"./FL-YoeN8.js";function g(t,a){n(a,!0);let e=v(a,["$$slots","$$events","$$legacy"]);const o=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];u(t,d({name:"trash-2"},()=>e,{get iconNode(){return o},children:(r,$)=>{var s=h(),p=c(s);i(p,()=>a.children??l),m(r,s)},$$slots:{default:!0}})),f()}export{g as T};
1
+ import{p as n,s as d,c as h,f as c,a as i,n as l,b as m,d as f,r as v}from"./Ddm7yfuh.js";import{I as u}from"./CQjlljeJ.js";function g(t,a){n(a,!0);let e=v(a,["$$slots","$$events","$$legacy"]);const o=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];u(t,d({name:"trash-2"},()=>e,{get iconNode(){return o},children:(r,$)=>{var s=h(),p=c(s);i(p,()=>a.children??l),m(r,s)},$$slots:{default:!0}})),f()}export{g as T};
@@ -1,4 +1,4 @@
1
- import{o as We,p as re,s as he,c as de,f as se,a as fe,n as ve,b as w,d as ie,r as we,i as c,j as J,t as _,k as s,y as ee,z as ae,D as ge,A as Te,h as t,l as N,v as m,m as Y,e as ft,Q as Ze,q as ze,aU as Ve,F as Je,B as xe,u as pe,O as U,P as Se,aa as et,N as Ee,ac as Ie,w as ke,I as Me,x as vt,K as wt,U as yt}from"./Ddm7yfuh.js";import{o as me,I as ye,aG as bt,bc as xt,bd as _t,H as Et}from"./FL-YoeN8.js";import{W as at,L as Tt}from"./CEoInRel.js";import{R as st}from"./Cc_gOqHV.js";import{P as qe}from"./CrobSJ71.js";import{P as kt}from"./CaTq3hOd.js";import{T as St}from"./DTRTIsLb.js";const k=We({entries:[],loading:!1,error:null,groups:[],activeGroup:null,draggingId:null,focusedId:null,widgetCacheVersion:0}),be=new Map,He=new Set;function Ct(){return k.entries.filter(n=>n.state==="tray")}function Nt(){const n=k.entries.filter(e=>e.state==="grid");if(k.activeGroup){const e=k.groups.find(r=>r.id===k.activeGroup);if(e)return n.filter(r=>e.items.includes(r.id))}return n}function It(){return k.entries.filter(n=>n.state==="dock")}const tt=12;function Qe(n,e,r){const a=r?.x??0,d=r?.y??0;function p(R,P,D,H){for(const A of n)if(R<A.x+A.w&&R+D>A.x&&P<A.y+A.h&&P+H>A.y)return!0;return!1}const o=Math.max(0,Math.min(tt-e.w,a)),y=Math.max(0,d);if(!p(o,y,e.w,e.h))return{x:o,y,w:e.w,h:e.h};for(let R=1;R<=20;R++)for(let P=-R;P<=R;P++)for(let D=-R;D<=R;D++){if(Math.abs(D)!==R&&Math.abs(P)!==R)continue;const H=Math.max(0,Math.min(tt-e.w,a+D)),A=Math.max(0,d+P);if(!p(H,A,e.w,e.h))return{x:H,y:A,w:e.w,h:e.h}}return{x:0,y:n.reduce((R,P)=>Math.max(R,P.y+P.h),0),w:e.w,h:e.h}}async function Oe(){k.loading=!0,k.error=null;try{const n=await fetch(`${me}/api/os/tray`);if(!n.ok)throw new Error(`HTTP ${n.status}`);const e=await n.json();k.entries=e.entries??[]}catch(n){k.error=n instanceof Error?n.message:String(n)}finally{k.loading=!1}}async function Ae(n,e,r){try{const a={state:e};r&&(a.gridPosition=r);const d=await fetch(`${me}/api/os/tray/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!d.ok)return!1;const p=await d.json();if(p.success&&p.entry){const o=k.entries.findIndex(y=>y.id===n);o>=0&&(k.entries[o]=p.entry)}return!0}catch{return!1}}async function nt(n,e){return Ae(n,"grid",e)}async function Xe(n,e){const r=k.entries.find(o=>o.id===n);if(!r)return!1;if(e)return Ae(n,"grid",e);const a=r.manifest?.defaultSize??{w:4,h:3},d=k.entries.flatMap(o=>o.id!==n&&o.state==="grid"&&o.gridPosition?[o.gridPosition]:[]),p=Qe(d,a);return Ae(n,"grid",p)}async function Mt(n){return Ae(n,"dock")}async function lt(n){return Ae(n,"tray")}const ct="signet-os-sidebar-groups";function At(){try{const n=localStorage.getItem(ct);n&&(k.groups=JSON.parse(n))}catch{k.groups=[]}}function Fe(){localStorage.setItem(ct,JSON.stringify(k.groups))}function Dt(n){const e={id:`group_${Date.now()}`,name:n,items:[]};return k.groups=[...k.groups,e],Fe(),e}function Lt(n){k.groups=k.groups.filter(e=>e.id!==n),k.activeGroup===n&&(k.activeGroup=null),Fe()}function Rt(n,e){k.groups=k.groups.map(r=>r.id===n?{...r,name:e}:r),Fe()}function Ht(n,e){k.groups=k.groups.map(r=>r.id!==n||r.items.includes(e)?r:{...r,items:[...r.items,e]}),Fe()}function Ue(n){k.activeGroup=n}let Pe=We(new Map),rt=0;function it(n,e,r){Pe.set(n,{action:e,data:r,_seq:++rt}),setTimeout(()=>{const a=Pe.get(n);a&&a._seq===rt&&Pe.delete(n)},500)}function Pt(n){return Pe.get(n)}function Ot(n){k.focusedId=n}function Le(){k.focusedId=null}async function $e(n){if(be.has(n))return be.get(n)??null;try{const e=await fetch(`${me}/api/os/widget/${encodeURIComponent(n)}`);if(!e.ok)return null;const r=await e.json();return r.html?(be.set(n,r.html),k.widgetCacheVersion++,r.html):null}catch{return null}}async function dt(n){if(!He.has(n)){He.add(n),k.widgetCacheVersion++;try{const r=await(await fetch(`${me}/api/os/widget/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverId:n,force:!1})})).json();r.status==="cached"&&r.html&&be.set(n,r.html)}catch{}finally{be.has(n)&&He.delete(n),k.widgetCacheVersion++}}}const Ke=new Map;function $t(n,e){Ke.set(n,e)}function Wt(n){Ke.delete(n)}function Re(n){return Ke.get(n)}const zt=We({current:null});function _e(n){zt.current=n}function Ye(n,e){re(e,!0);let r=we(e,["$$slots","$$events","$$legacy"]);const a=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];ye(n,he({name:"box"},()=>r,{get iconNode(){return a},children:(d,p)=>{var o=de(),y=se(o);fe(y,()=>e.children??ve),w(d,o)},$$slots:{default:!0}})),ie()}var Vt=N('<img class="auto-card-icon svelte-1y09vim" referrerpolicy="no-referrer"/>'),Ft=N('<div class="auto-card-icon-placeholder svelte-1y09vim"><!></div>'),jt=N('<button class="auto-card-tool-btn sig-switch svelte-1y09vim" disabled=""><!> <span class="truncate"> </span></button>'),Bt=N('<div class="auto-card-tools svelte-1y09vim"></div>'),Ut=N('<div class="auto-card-empty svelte-1y09vim"><span class="sig-label">No tools exposed</span></div>'),Gt=N('<div class="auto-card svelte-1y09vim"><div class="auto-card-header svelte-1y09vim"><!> <span class="auto-card-name svelte-1y09vim"> </span> <span class="sig-meta ml-auto"> </span></div> <!></div>');function qt(n,e){re(e,!0);var r=Gt(),a=c(r),d=c(a);{var p=O=>{var S=Vt();ee(()=>{ge(S,"src",e.icon),ge(S,"alt",e.name)}),w(O,S)},o=O=>{var S=Ft(),$=c(S);Ye($,{class:"size-4"}),s(S),w(O,S)};J(d,O=>{e.icon?O(p):O(o,-1)})}var y=_(d,2),G=c(y,!0);s(y);var R=_(y,2),P=c(R);s(R),s(a);var D=_(a,2);{var H=O=>{var S=Bt();Te(S,21,()=>e.autoCard.tools,$=>$.name,($,W)=>{var j=jt(),F=c(j);at(F,{class:"size-3 shrink-0 opacity-50"});var te=_(F,2),I=c(te,!0);s(te),s(j),ee(()=>{ge(j,"title",t(W).description||t(W).name),ae(I,t(W).name)}),w($,j)}),s(S),w(O,S)},A=O=>{var S=Ut();w(O,S)};J(D,O=>{e.autoCard.tools.length>0?O(H):O(A,-1)})}s(r),ee(()=>{ae(G,e.name),ae(P,`${e.autoCard.tools.length??""} tools`)}),w(n,r),ie()}const Xt='// Signet Page Agent bundle - PageController + lightweight cursor mask\n// Auto-generated from @page-agent/page-controller v1.6.0\n\n\n(function(){\n // Lightweight SimulatorMask - cursor + overlay, no ai-motion dependency\n var CSS_TEXT = \'.__pa_mask{position:fixed;inset:0;z-index:2147483641;cursor:wait;overflow:hidden;display:none;background:rgba(0,0,0,0.02)}.__pa_mask.__pa_vis{display:block}.__pa_cur{position:absolute;width:40px;height:40px;pointer-events:none;z-index:10000;transition:none}.__pa_cur_fill{position:absolute;width:100%;height:100%;background:url("data:image/svg+xml,%3csvg xmlns=\\\'http://www.w3.org/2000/svg\\\' viewBox=\\\'0 0 100 100\\\'%3e%3cpath d=\\\'M 15 42 L 15 36.99 Q 15 31.99 23.7 31.99 L 28.05 31.99 Q 32.41 31.99 32.41 21.99 L 32.41 17 Q 32.41 12 41.09 16.95 L 76.31 37.05 Q 85 42 76.31 46.95 L 41.09 67.05 Q 32.41 72 32.41 62.01 L 32.41 57.01 Q 32.41 52.01 23.7 52.01 L 19.35 52.01 Q 15 52.01 15 47.01 Z\\\' fill=\\\'%23ffffff\\\' stroke=\\\'%23333\\\' stroke-width=\\\'4\\\'/%3e%3c/svg%3e");background-size:100% 100%;transform-origin:center;transform:rotate(-135deg) scale(1.1);margin-left:-8px;margin-top:-14px}.__pa_cur_border{position:absolute;width:100%;height:100%;background:linear-gradient(45deg,rgb(57,182,255),rgb(189,69,251));mask-image:url("data:image/svg+xml,%3csvg xmlns=\\\'http://www.w3.org/2000/svg\\\' viewBox=\\\'0 0 100 100\\\' fill=\\\'none\\\'%3e%3cpath d=\\\'M 15 42 L 15 36.99 Q 15 31.99 23.7 31.99 L 28.05 31.99 Q 32.41 31.99 32.41 21.99 L 32.41 17 Q 32.41 12 41.09 16.95 L 76.31 37.05 Q 85 42 76.31 46.95 L 41.09 67.05 Q 32.41 72 32.41 62.01 L 32.41 57.01 Q 32.41 52.01 23.7 52.01 L 19.35 52.01 Q 15 52.01 15 47.01 Z\\\' stroke=\\\'%23000\\\' stroke-width=\\\'6\\\'/%3e%3c/svg%3e");mask-size:100% 100%;mask-repeat:no-repeat;transform-origin:center;transform:rotate(-135deg) scale(1.2);margin-left:-10px;margin-top:-18px}.__pa_ripple{position:absolute;width:100%;height:100%;pointer-events:none;margin-left:-50%;margin-top:-50%}.__pa_ripple::after{content:\\\'\\\';opacity:0;position:absolute;inset:0;border:3px solid rgba(57,182,255,1);border-radius:50%}.__pa_cur.__pa_click .__pa_ripple::after{animation:__pa_rip 300ms ease-out forwards}@keyframes __pa_rip{0%{transform:scale(0);opacity:1}100%{transform:scale(2);opacity:0}}\';\n \n try{\n var s=document.createElement(\'style\');\n s.appendChild(document.createTextNode(CSS_TEXT));\n document.head.appendChild(s);\n }catch(e){}\n\n function LiteMask(){\n this.shown=false;\n this.wrapper=document.createElement(\'div\');\n this.wrapper.className=\'__pa_mask\';\n this.wrapper.setAttribute(\'data-page-agent-ignore\',\'true\');\n \n this._cursor=document.createElement(\'div\');\n this._cursor.className=\'__pa_cur\';\n var ripple=document.createElement(\'div\');ripple.className=\'__pa_ripple\';this._cursor.appendChild(ripple);\n var fill=document.createElement(\'div\');fill.className=\'__pa_cur_fill\';this._cursor.appendChild(fill);\n var border=document.createElement(\'div\');border.className=\'__pa_cur_border\';this._cursor.appendChild(border);\n this.wrapper.appendChild(this._cursor);\n \n this._cx=0;this._cy=0;this._tx=0;this._ty=0;\n \n // Block interactions on mask\n [\'click\',\'mousedown\',\'mouseup\',\'mousemove\',\'wheel\',\'keydown\',\'keyup\'].forEach(function(evt){\n this.wrapper.addEventListener(evt,function(e){e.stopPropagation();e.preventDefault();});\n }.bind(this));\n \n document.body.appendChild(this.wrapper);\n this._animate();\n \n var self=this;\n window.addEventListener(\'PageAgent::MovePointerTo\',function(e){\n var d=e.detail;self._tx=d.x;self._ty=d.y;\n });\n window.addEventListener(\'PageAgent::ClickPointer\',function(){\n self._cursor.classList.remove(\'__pa_click\');\n void self._cursor.offsetHeight;\n self._cursor.classList.add(\'__pa_click\');\n });\n }\n \n LiteMask.prototype._animate=function(){\n var nx=this._cx+(this._tx-this._cx)*0.2;\n var ny=this._cy+(this._ty-this._cy)*0.2;\n if(Math.abs(nx-this._tx)>0){this._cx=Math.abs(nx-this._tx)<2?this._tx:nx;this._cursor.style.left=this._cx+\'px\';}\n if(Math.abs(ny-this._ty)>0){this._cy=Math.abs(ny-this._ty)<2?this._ty:ny;this._cursor.style.top=this._cy+\'px\';}\n requestAnimationFrame(this._animate.bind(this));\n };\n \n LiteMask.prototype.show=function(){\n if(this.shown)return;this.shown=true;\n this.wrapper.classList.add(\'__pa_vis\');\n this._cx=window.innerWidth/2;this._cy=window.innerHeight/2;\n this._tx=this._cx;this._ty=this._cy;\n this._cursor.style.left=this._cx+\'px\';this._cursor.style.top=this._cy+\'px\';\n };\n \n LiteMask.prototype.hide=function(){\n if(!this.shown)return;this.shown=false;\n this._cursor.classList.remove(\'__pa_click\');\n var w=this.wrapper;\n setTimeout(function(){w.classList.remove(\'__pa_vis\');},300);\n };\n \n LiteMask.prototype.dispose=function(){this.wrapper.remove();};\n \n window.__LiteMask=LiteMask;\n})();\n\n// --- PageController (modified: SimulatorMask replaced with LiteMask) ---\n(function(){\n(function(){var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});function isHTMLElement(el){return!!el&&el.nodeType===1}__name(isHTMLElement,"isHTMLElement");function isInputElement(el){return el?.nodeType===1&&el.tagName==="INPUT"}__name(isInputElement,"isInputElement");function isTextAreaElement(el){return el?.nodeType===1&&el.tagName==="TEXTAREA"}__name(isTextAreaElement,"isTextAreaElement");function isSelectElement(el){return el?.nodeType===1&&el.tagName==="SELECT"}__name(isSelectElement,"isSelectElement");function isAnchorElement(el){return el?.nodeType===1&&el.tagName==="A"}__name(isAnchorElement,"isAnchorElement");function getIframeOffset(element){const frame=element.ownerDocument.defaultView?.frameElement;if(!frame)return{x:0,y:0};const rect=frame.getBoundingClientRect();return{x:rect.left,y:rect.top}}__name(getIframeOffset,"getIframeOffset");function getNativeValueSetter(element){return Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element),"value").set}__name(getNativeValueSetter,"getNativeValueSetter");async function waitFor(seconds){await new Promise((resolve)=>setTimeout(resolve,seconds*1000))}__name(waitFor,"waitFor");async function movePointerToElement(element){const rect=element.getBoundingClientRect();const offset=getIframeOffset(element);const x=rect.left+rect.width/2+offset.x;const y=rect.top+rect.height/2+offset.y;window.dispatchEvent(new CustomEvent("PageAgent::MovePointerTo",{detail:{x,y}}));await waitFor(0.3)}__name(movePointerToElement,"movePointerToElement");function getElementByIndex(selectorMap,index){const interactiveNode=selectorMap.get(index);if(!interactiveNode){throw new Error(`No interactive element found at index ${index}`)}const element=interactiveNode.ref;if(!element){throw new Error(`Element at index ${index} does not have a reference`)}if(!isHTMLElement(element)){throw new Error(`Element at index ${index} is not an HTMLElement`)}return element}__name(getElementByIndex,"getElementByIndex");let lastClickedElement=null;function blurLastClickedElement(){if(lastClickedElement){lastClickedElement.blur();lastClickedElement.dispatchEvent(new MouseEvent("mouseout",{bubbles:true,cancelable:true}));lastClickedElement.dispatchEvent(new MouseEvent("mouseleave",{bubbles:false,cancelable:true}));lastClickedElement=null}}__name(blurLastClickedElement,"blurLastClickedElement");async function clickElement(element){blurLastClickedElement();lastClickedElement=element;await scrollIntoViewIfNeeded(element);const frame=element.ownerDocument.defaultView?.frameElement;if(frame)await scrollIntoViewIfNeeded(frame);await movePointerToElement(element);window.dispatchEvent(new CustomEvent("PageAgent::ClickPointer"));await waitFor(0.1);element.dispatchEvent(new MouseEvent("mouseenter",{bubbles:true,cancelable:true}));element.dispatchEvent(new MouseEvent("mouseover",{bubbles:true,cancelable:true}));element.dispatchEvent(new MouseEvent("mousedown",{bubbles:true,cancelable:true}));element.focus();element.dispatchEvent(new MouseEvent("mouseup",{bubbles:true,cancelable:true}));element.dispatchEvent(new MouseEvent("click",{bubbles:true,cancelable:true}));await waitFor(0.2)}__name(clickElement,"clickElement");async function inputTextElement(element,text){const isContentEditable=element.isContentEditable;if(!isInputElement(element)&&!isTextAreaElement(element)&&!isContentEditable){throw new Error("Element is not an input, textarea, or contenteditable")}await clickElement(element);if(isContentEditable){if(element.dispatchEvent(new InputEvent("beforeinput",{bubbles:true,cancelable:true,inputType:"deleteContent"}))){element.innerText="";element.dispatchEvent(new InputEvent("input",{bubbles:true,inputType:"deleteContent"}))}if(element.dispatchEvent(new InputEvent("beforeinput",{bubbles:true,cancelable:true,inputType:"insertText",data:text}))){element.innerText=text;element.dispatchEvent(new InputEvent("input",{bubbles:true,inputType:"insertText",data:text}))}const planASucceeded=element.innerText.trim()===text.trim();if(!planASucceeded){element.focus();const doc=element.ownerDocument;const selection=(doc.defaultView||window).getSelection();const range=doc.createRange();range.selectNodeContents(element);selection?.removeAllRanges();selection?.addRange(range);doc.execCommand("delete",false);doc.execCommand("insertText",false,text)}element.dispatchEvent(new Event("change",{bubbles:true}));element.blur()}else{getNativeValueSetter(element).call(element,text)}if(!isContentEditable){element.dispatchEvent(new Event("input",{bubbles:true}))}await waitFor(0.1);blurLastClickedElement()}__name(inputTextElement,"inputTextElement");async function selectOptionElement(selectElement,optionText){if(!isSelectElement(selectElement)){throw new Error("Element is not a select element")}const options=Array.from(selectElement.options);const option=options.find((opt)=>opt.textContent?.trim()===optionText.trim());if(!option){throw new Error(`Option with text "${optionText}" not found in select element`)}selectElement.value=option.value;selectElement.dispatchEvent(new Event("change",{bubbles:true}));await waitFor(0.1)}__name(selectOptionElement,"selectOptionElement");async function scrollIntoViewIfNeeded(element){const el=element;if(typeof el.scrollIntoViewIfNeeded==="function"){el.scrollIntoViewIfNeeded()}else{element.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})}}__name(scrollIntoViewIfNeeded,"scrollIntoViewIfNeeded");async function scrollVertically(down,scroll_amount,element){if(element){const targetElement=element;let currentElement=targetElement;let scrollSuccess=false;let scrolledElement=null;let scrollDelta=0;let attempts=0;const dy2=scroll_amount;while(currentElement&&attempts<10){const computedStyle=window.getComputedStyle(currentElement);const hasScrollableY=/(auto|scroll|overlay)/.test(computedStyle.overflowY);const canScrollVertically=currentElement.scrollHeight>currentElement.clientHeight;if(hasScrollableY&&canScrollVertically){const beforeScroll=currentElement.scrollTop;const maxScroll=currentElement.scrollHeight-currentElement.clientHeight;let scrollAmount=dy2/3;if(scrollAmount>0){scrollAmount=Math.min(scrollAmount,maxScroll-beforeScroll)}else{scrollAmount=Math.max(scrollAmount,-beforeScroll)}currentElement.scrollTop=beforeScroll+scrollAmount;const afterScroll=currentElement.scrollTop;const actualScrollDelta=afterScroll-beforeScroll;if(Math.abs(actualScrollDelta)>0.5){scrollSuccess=true;scrolledElement=currentElement;scrollDelta=actualScrollDelta;break}}if(currentElement===document.body||currentElement===document.documentElement){break}currentElement=currentElement.parentElement;attempts++}if(scrollSuccess){return`Scrolled container (${scrolledElement?.tagName}) by ${scrollDelta}px`}else{return`No scrollable container found for element (${targetElement.tagName})`}}const dy=scroll_amount;const bigEnough=__name((el2)=>el2.clientHeight>=window.innerHeight*0.5,"bigEnough");const canScroll=__name((el2)=>el2&&/(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowY)&&el2.scrollHeight>el2.clientHeight&&bigEnough(el2),"canScroll");let el=document.activeElement;while(el&&!canScroll(el)&&el!==document.body)el=el.parentElement;el=canScroll(el)?el:Array.from(document.querySelectorAll("*")).find(canScroll)||document.scrollingElement||document.documentElement;if(el===document.scrollingElement||el===document.documentElement||el===document.body){const scrollBefore=window.scrollY;const scrollMax=document.documentElement.scrollHeight-window.innerHeight;window.scrollBy(0,dy);const scrollAfter=window.scrollY;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dy>0?`⚠️ Already at the bottom of the page, cannot scroll down further.`:`⚠️ Already at the top of the page, cannot scroll up further.`}const reachedBottom=dy>0&&scrollAfter>=scrollMax-1;const reachedTop=dy<0&&scrollAfter<=1;if(reachedBottom)return`✅ Scrolled page by ${scrolled}px. Reached the bottom of the page.`;if(reachedTop)return`✅ Scrolled page by ${scrolled}px. Reached the top of the page.`;return`✅ Scrolled page by ${scrolled}px.`}else{const scrollBefore=el.scrollTop;const scrollMax=el.scrollHeight-el.clientHeight;el.scrollBy({top:dy,behavior:"smooth"});await waitFor(0.1);const scrollAfter=el.scrollTop;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dy>0?`⚠️ Already at the bottom of container (${el.tagName}), cannot scroll down further.`:`⚠️ Already at the top of container (${el.tagName}), cannot scroll up further.`}const reachedBottom=dy>0&&scrollAfter>=scrollMax-1;const reachedTop=dy<0&&scrollAfter<=1;if(reachedBottom)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the bottom.`;if(reachedTop)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the top.`;return`✅ Scrolled container (${el.tagName}) by ${scrolled}px.`}}__name(scrollVertically,"scrollVertically");async function scrollHorizontally(right,scroll_amount,element){if(element){const targetElement=element;let currentElement=targetElement;let scrollSuccess=false;let scrolledElement=null;let scrollDelta=0;let attempts=0;const dx2=right?scroll_amount:-scroll_amount;while(currentElement&&attempts<10){const computedStyle=window.getComputedStyle(currentElement);const hasScrollableX=/(auto|scroll|overlay)/.test(computedStyle.overflowX);const canScrollHorizontally=currentElement.scrollWidth>currentElement.clientWidth;if(hasScrollableX&&canScrollHorizontally){const beforeScroll=currentElement.scrollLeft;const maxScroll=currentElement.scrollWidth-currentElement.clientWidth;let scrollAmount=dx2/3;if(scrollAmount>0){scrollAmount=Math.min(scrollAmount,maxScroll-beforeScroll)}else{scrollAmount=Math.max(scrollAmount,-beforeScroll)}currentElement.scrollLeft=beforeScroll+scrollAmount;const afterScroll=currentElement.scrollLeft;const actualScrollDelta=afterScroll-beforeScroll;if(Math.abs(actualScrollDelta)>0.5){scrollSuccess=true;scrolledElement=currentElement;scrollDelta=actualScrollDelta;break}}if(currentElement===document.body||currentElement===document.documentElement){break}currentElement=currentElement.parentElement;attempts++}if(scrollSuccess){return`Scrolled container (${scrolledElement?.tagName}) horizontally by ${scrollDelta}px`}else{return`No horizontally scrollable container found for element (${targetElement.tagName})`}}const dx=right?scroll_amount:-scroll_amount;const bigEnough=__name((el2)=>el2.clientWidth>=window.innerWidth*0.5,"bigEnough");const canScroll=__name((el2)=>el2&&/(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowX)&&el2.scrollWidth>el2.clientWidth&&bigEnough(el2),"canScroll");let el=document.activeElement;while(el&&!canScroll(el)&&el!==document.body)el=el.parentElement;el=canScroll(el)?el:Array.from(document.querySelectorAll("*")).find(canScroll)||document.scrollingElement||document.documentElement;if(el===document.scrollingElement||el===document.documentElement||el===document.body){const scrollBefore=window.scrollX;const scrollMax=document.documentElement.scrollWidth-window.innerWidth;window.scrollBy(dx,0);const scrollAfter=window.scrollX;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dx>0?`⚠️ Already at the right edge of the page, cannot scroll right further.`:`⚠️ Already at the left edge of the page, cannot scroll left further.`}const reachedRight=dx>0&&scrollAfter>=scrollMax-1;const reachedLeft=dx<0&&scrollAfter<=1;if(reachedRight)return`✅ Scrolled page by ${scrolled}px. Reached the right edge of the page.`;if(reachedLeft)return`✅ Scrolled page by ${scrolled}px. Reached the left edge of the page.`;return`✅ Scrolled page horizontally by ${scrolled}px.`}else{const scrollBefore=el.scrollLeft;const scrollMax=el.scrollWidth-el.clientWidth;el.scrollBy({left:dx,behavior:"smooth"});await waitFor(0.1);const scrollAfter=el.scrollLeft;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dx>0?`⚠️ Already at the right edge of container (${el.tagName}), cannot scroll right further.`:`⚠️ Already at the left edge of container (${el.tagName}), cannot scroll left further.`}const reachedRight=dx>0&&scrollAfter>=scrollMax-1;const reachedLeft=dx<0&&scrollAfter<=1;if(reachedRight)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the right edge.`;if(reachedLeft)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the left edge.`;return`✅ Scrolled container (${el.tagName}) horizontally by ${scrolled}px.`}}__name(scrollHorizontally,"scrollHorizontally");const domTree=__name((args={doHighlightElements:true,focusHighlightIndex:-1,viewportExpansion:0,debugMode:false,interactiveBlacklist:[],interactiveWhitelist:[],highlightOpacity:0.1,highlightLabelOpacity:0.5})=>{const{interactiveBlacklist,interactiveWhitelist,highlightOpacity,highlightLabelOpacity}=args;const{doHighlightElements,focusHighlightIndex,viewportExpansion,debugMode}=args;let highlightIndex=0;const extraData=new WeakMap;function addExtraData(element,data){if(!element||element.nodeType!==Node.ELEMENT_NODE)return;extraData.set(element,{...extraData.get(element),...data})}__name(addExtraData,"addExtraData");const DOM_CACHE={boundingRects:new WeakMap,clientRects:new WeakMap,computedStyles:new WeakMap,clearCache:__name(()=>{DOM_CACHE.boundingRects=new WeakMap;DOM_CACHE.clientRects=new WeakMap;DOM_CACHE.computedStyles=new WeakMap},"clearCache")};function getCachedBoundingRect(element){if(!element)return null;if(DOM_CACHE.boundingRects.has(element)){return DOM_CACHE.boundingRects.get(element)}const rect=element.getBoundingClientRect();if(rect){DOM_CACHE.boundingRects.set(element,rect)}return rect}__name(getCachedBoundingRect,"getCachedBoundingRect");function getCachedComputedStyle(element){if(!element)return null;if(DOM_CACHE.computedStyles.has(element)){return DOM_CACHE.computedStyles.get(element)}const style=window.getComputedStyle(element);if(style){DOM_CACHE.computedStyles.set(element,style)}return style}__name(getCachedComputedStyle,"getCachedComputedStyle");function getCachedClientRects(element){if(!element)return null;if(DOM_CACHE.clientRects.has(element)){return DOM_CACHE.clientRects.get(element)}const rects=element.getClientRects();if(rects){DOM_CACHE.clientRects.set(element,rects)}return rects}__name(getCachedClientRects,"getCachedClientRects");const DOM_HASH_MAP={};const ID={current:0};const HIGHLIGHT_CONTAINER_ID="playwright-highlight-container";function highlightElement(element,index,parentIframe=null){if(!element)return index;const overlays=[];let label=null;let labelWidth=20;let labelHeight=16;let cleanupFn=null;try{let container=document.getElementById(HIGHLIGHT_CONTAINER_ID);if(!container){container=document.createElement("div");container.id=HIGHLIGHT_CONTAINER_ID;container.style.position="fixed";container.style.pointerEvents="none";container.style.top="0";container.style.left="0";container.style.width="100%";container.style.height="100%";container.style.zIndex="2147483640";container.style.backgroundColor="transparent";document.body.appendChild(container)}const rects=element.getClientRects();if(!rects||rects.length===0)return index;const colors=["#FF0000","#00FF00","#0000FF","#FFA500","#800080","#008080","#FF69B4","#4B0082","#FF4500","#2E8B57","#DC143C","#4682B4"];const colorIndex=index%colors.length;let baseColor=colors[colorIndex];const backgroundColor=baseColor+Math.floor(highlightOpacity*255).toString(16).padStart(2,"0");baseColor=baseColor+Math.floor(highlightLabelOpacity*255).toString(16).padStart(2,"0");let iframeOffset={x:0,y:0};if(parentIframe){const iframeRect=parentIframe.getBoundingClientRect();iframeOffset.x=iframeRect.left;iframeOffset.y=iframeRect.top}const fragment=document.createDocumentFragment();for(const rect of rects){if(rect.width===0||rect.height===0)continue;const overlay=document.createElement("div");overlay.style.position="fixed";overlay.style.border=`2px solid ${baseColor}`;overlay.style.backgroundColor=backgroundColor;overlay.style.pointerEvents="none";overlay.style.boxSizing="border-box";const top=rect.top+iframeOffset.y;const left=rect.left+iframeOffset.x;overlay.style.top=`${top}px`;overlay.style.left=`${left}px`;overlay.style.width=`${rect.width}px`;overlay.style.height=`${rect.height}px`;fragment.appendChild(overlay);overlays.push({element:overlay,initialRect:rect})}const firstRect=rects[0];label=document.createElement("div");label.className="playwright-highlight-label";label.style.position="fixed";label.style.background=baseColor;label.style.color="white";label.style.padding="1px 4px";label.style.borderRadius="4px";label.style.fontSize=`${Math.min(12,Math.max(8,firstRect.height/2))}px`;label.textContent=index.toString();labelWidth=label.offsetWidth>0?label.offsetWidth:labelWidth;labelHeight=label.offsetHeight>0?label.offsetHeight:labelHeight;const firstRectTop=firstRect.top+iframeOffset.y;const firstRectLeft=firstRect.left+iframeOffset.x;let labelTop=firstRectTop+2;let labelLeft=firstRectLeft+firstRect.width-labelWidth-2;if(firstRect.width<labelWidth+4||firstRect.height<labelHeight+4){labelTop=firstRectTop-labelHeight-2;labelLeft=firstRectLeft+firstRect.width-labelWidth;if(labelLeft<iframeOffset.x)labelLeft=firstRectLeft}labelTop=Math.max(0,Math.min(labelTop,window.innerHeight-labelHeight));labelLeft=Math.max(0,Math.min(labelLeft,window.innerWidth-labelWidth));label.style.top=`${labelTop}px`;label.style.left=`${labelLeft}px`;fragment.appendChild(label);const updatePositions=__name(()=>{const newRects=element.getClientRects();let newIframeOffset={x:0,y:0};if(parentIframe){const iframeRect=parentIframe.getBoundingClientRect();newIframeOffset.x=iframeRect.left;newIframeOffset.y=iframeRect.top}overlays.forEach((overlayData,i)=>{if(i<newRects.length){const newRect=newRects[i];const newTop=newRect.top+newIframeOffset.y;const newLeft=newRect.left+newIframeOffset.x;overlayData.element.style.top=`${newTop}px`;overlayData.element.style.left=`${newLeft}px`;overlayData.element.style.width=`${newRect.width}px`;overlayData.element.style.height=`${newRect.height}px`;overlayData.element.style.display=newRect.width===0||newRect.height===0?"none":"block"}else{overlayData.element.style.display="none"}});if(newRects.length<overlays.length){for(let i=newRects.length;i<overlays.length;i++){overlays[i].element.style.display="none"}}if(label&&newRects.length>0){const firstNewRect=newRects[0];const firstNewRectTop=firstNewRect.top+newIframeOffset.y;const firstNewRectLeft=firstNewRect.left+newIframeOffset.x;let newLabelTop=firstNewRectTop+2;let newLabelLeft=firstNewRectLeft+firstNewRect.width-labelWidth-2;if(firstNewRect.width<labelWidth+4||firstNewRect.height<labelHeight+4){newLabelTop=firstNewRectTop-labelHeight-2;newLabelLeft=firstNewRectLeft+firstNewRect.width-labelWidth;if(newLabelLeft<newIframeOffset.x)newLabelLeft=firstNewRectLeft}newLabelTop=Math.max(0,Math.min(newLabelTop,window.innerHeight-labelHeight));newLabelLeft=Math.max(0,Math.min(newLabelLeft,window.innerWidth-labelWidth));label.style.top=`${newLabelTop}px`;label.style.left=`${newLabelLeft}px`;label.style.display="block"}else if(label){label.style.display="none"}},"updatePositions");const throttleFunction=__name((func,delay)=>{let lastCall=0;return(...args2)=>{const now=performance.now();if(now-lastCall<delay)return;lastCall=now;return func(...args2)}},"throttleFunction");const throttledUpdatePositions=throttleFunction(updatePositions,16);window.addEventListener("scroll",throttledUpdatePositions,true);window.addEventListener("resize",throttledUpdatePositions);cleanupFn=__name(()=>{window.removeEventListener("scroll",throttledUpdatePositions,true);window.removeEventListener("resize",throttledUpdatePositions);overlays.forEach((overlay)=>overlay.element.remove());if(label)label.remove()},"cleanupFn");container.appendChild(fragment);return index+1}finally{if(cleanupFn){(window._highlightCleanupFunctions=window._highlightCleanupFunctions||[]).push(cleanupFn)}}}__name(highlightElement,"highlightElement");function isScrollableElement(element){if(!element||element.nodeType!==Node.ELEMENT_NODE){return null}const style=getCachedComputedStyle(element);if(!style)return null;const display=style.display;if(display==="inline"||display==="inline-block"){return null}const overflowX=style.overflowX;const overflowY=style.overflowY;const scrollableX=overflowX==="auto"||overflowX==="scroll";const scrollableY=overflowY==="auto"||overflowY==="scroll";if(!scrollableX&&!scrollableY){return null}const scrollWidth=element.scrollWidth-element.clientWidth;const scrollHeight=element.scrollHeight-element.clientHeight;const threshold=4;if(scrollWidth<threshold&&scrollHeight<threshold){return null}if(!scrollableY&&scrollWidth<threshold){return null}if(!scrollableX&&scrollHeight<threshold){return null}const distanceToTop=element.scrollTop;const distanceToLeft=element.scrollLeft;const distanceToRight=element.scrollWidth-element.clientWidth-element.scrollLeft;const distanceToBottom=element.scrollHeight-element.clientHeight-element.scrollTop;const scrollData={top:distanceToTop,right:distanceToRight,bottom:distanceToBottom,left:distanceToLeft};addExtraData(element,{scrollable:true,scrollData});return scrollData}__name(isScrollableElement,"isScrollableElement");function isTextNodeVisible(textNode){try{if(viewportExpansion===-1){const parentElement2=textNode.parentElement;if(!parentElement2)return false;try{return parentElement2.checkVisibility({checkOpacity:true,checkVisibilityCSS:true})}catch(e){const style=window.getComputedStyle(parentElement2);return style.display!=="none"&&style.visibility!=="hidden"&&style.opacity!=="0"}}const range=document.createRange();range.selectNodeContents(textNode);const rects=range.getClientRects();if(!rects||rects.length===0){return false}let isAnyRectVisible=false;let isAnyRectInViewport=false;for(const rect of rects){if(rect.width>0&&rect.height>0){isAnyRectVisible=true;if(!(rect.bottom<-viewportExpansion||rect.top>window.innerHeight+viewportExpansion||rect.right<-viewportExpansion||rect.left>window.innerWidth+viewportExpansion)){isAnyRectInViewport=true;break}}}if(!isAnyRectVisible||!isAnyRectInViewport){return false}const parentElement=textNode.parentElement;if(!parentElement)return false;try{return parentElement.checkVisibility({checkOpacity:true,checkVisibilityCSS:true})}catch(e){const style=window.getComputedStyle(parentElement);return style.display!=="none"&&style.visibility!=="hidden"&&style.opacity!=="0"}}catch(e){console.warn("Error checking text node visibility:",e);return false}}__name(isTextNodeVisible,"isTextNodeVisible");function isElementAccepted(element){if(!element||!element.tagName)return false;const alwaysAccept=new Set(["body","div","main","article","section","nav","header","footer"]);const tagName=element.tagName.toLowerCase();if(alwaysAccept.has(tagName))return true;const leafElementDenyList=new Set(["svg","script","style","link","meta","noscript","template"]);return!leafElementDenyList.has(tagName)}__name(isElementAccepted,"isElementAccepted");function isElementVisible(element){const style=getCachedComputedStyle(element);return element.offsetWidth>0&&element.offsetHeight>0&&style?.visibility!=="hidden"&&style?.display!=="none"}__name(isElementVisible,"isElementVisible");function isInteractiveElement(element){if(!element||element.nodeType!==Node.ELEMENT_NODE){return false}if(interactiveBlacklist.includes(element)){return false}if(interactiveWhitelist.includes(element)){return true}const tagName=element.tagName.toLowerCase();const style=getCachedComputedStyle(element);const interactiveCursors=new Set(["pointer","move","text","grab","grabbing","cell","copy","alias","all-scroll","col-resize","context-menu","crosshair","e-resize","ew-resize","help","n-resize","ne-resize","nesw-resize","ns-resize","nw-resize","nwse-resize","row-resize","s-resize","se-resize","sw-resize","vertical-text","w-resize","zoom-in","zoom-out"]);const nonInteractiveCursors=new Set(["not-allowed","no-drop","wait","progress","initial","inherit"]);function doesElementHaveInteractivePointer(element2){if(element2.tagName.toLowerCase()==="html")return false;if(style?.cursor&&interactiveCursors.has(style.cursor))return true;return false}__name(doesElementHaveInteractivePointer,"doesElementHaveInteractivePointer");let isInteractiveCursor=doesElementHaveInteractivePointer(element);if(isInteractiveCursor){return true}const interactiveElements=new Set(["a","button","input","select","textarea","details","summary","label","option","optgroup","fieldset","legend"]);const explicitDisableTags=new Set(["disabled","readonly"]);if(interactiveElements.has(tagName)){if(style?.cursor&&nonInteractiveCursors.has(style.cursor)){return false}for(const disableTag of explicitDisableTags){if(element.hasAttribute(disableTag)||element.getAttribute(disableTag)==="true"||element.getAttribute(disableTag)===""){return false}}if(element.disabled){return false}if(element.readOnly){return false}if(element.inert){return false}return true}const role=element.getAttribute("role");const ariaRole=element.getAttribute("aria-role");if(element.getAttribute("contenteditable")==="true"||element.isContentEditable){return true}if(element.classList&&(element.classList.contains("button")||element.classList.contains("dropdown-toggle")||element.getAttribute("data-index")||element.getAttribute("data-toggle")==="dropdown"||element.getAttribute("aria-haspopup")==="true")){return true}const interactiveRoles=new Set(["button","menu","menubar","menuitem","menuitemradio","menuitemcheckbox","radio","checkbox","tab","switch","slider","spinbutton","combobox","searchbox","textbox","listbox","option","scrollbar"]);const hasInteractiveRole=interactiveElements.has(tagName)||role&&interactiveRoles.has(role)||ariaRole&&interactiveRoles.has(ariaRole);if(hasInteractiveRole)return true;try{if(typeof getEventListeners==="function"){const listeners=getEventListeners(element);const mouseEvents=["click","mousedown","mouseup","dblclick"];for(const eventType of mouseEvents){if(listeners[eventType]&&listeners[eventType].length>0){return true}}}const getEventListenersForNode=element?.ownerDocument?.defaultView?.getEventListenersForNode||window.getEventListenersForNode;if(typeof getEventListenersForNode==="function"){const listeners=getEventListenersForNode(element);const interactionEvents=["click","mousedown","mouseup","keydown","keyup","submit","change","input","focus","blur"];for(const eventType of interactionEvents){for(const listener of listeners){if(listener.type===eventType){return true}}}}const commonMouseAttrs=["onclick","onmousedown","onmouseup","ondblclick"];for(const attr of commonMouseAttrs){if(element.hasAttribute(attr)||typeof element[attr]==="function"){return true}}}catch(e){}if(isScrollableElement(element)){return true}return false}__name(isInteractiveElement,"isInteractiveElement");function isTopElement(element){if(viewportExpansion===-1){return true}const rects=getCachedClientRects(element);if(!rects||rects.length===0){return false}let isAnyRectInViewport=false;for(const rect2 of rects){if(rect2.width>0&&rect2.height>0&&!(rect2.bottom<-viewportExpansion||rect2.top>window.innerHeight+viewportExpansion||rect2.right<-viewportExpansion||rect2.left>window.innerWidth+viewportExpansion)){isAnyRectInViewport=true;break}}if(!isAnyRectInViewport){return false}let doc=element.ownerDocument;if(doc!==window.document){return true}let rect=Array.from(rects).find((r)=>r.width>0&&r.height>0);if(!rect){return false}const shadowRoot=element.getRootNode();if(shadowRoot instanceof ShadowRoot){const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;try{const topEl=shadowRoot.elementFromPoint(centerX,centerY);if(!topEl)return false;let current=topEl;while(current&&current!==shadowRoot){if(current===element)return true;current=current.parentElement}return false}catch(e){return true}}const margin=5;const checkPoints=[{x:rect.left+rect.width/2,y:rect.top+rect.height/2},{x:rect.left+margin,y:rect.top+margin},{x:rect.right-margin,y:rect.bottom-margin}];return checkPoints.some(({x,y})=>{try{const topEl=document.elementFromPoint(x,y);if(!topEl)return false;let current=topEl;while(current&&current!==document.documentElement){if(current===element)return true;current=current.parentElement}return false}catch(e){return true}})}__name(isTopElement,"isTopElement");function isInExpandedViewport(element,viewportExpansion2){if(viewportExpansion2===-1){return true}const rects=element.getClientRects();if(!rects||rects.length===0){const boundingRect=getCachedBoundingRect(element);if(!boundingRect||boundingRect.width===0||boundingRect.height===0){return false}return!(boundingRect.bottom<-viewportExpansion2||boundingRect.top>window.innerHeight+viewportExpansion2||boundingRect.right<-viewportExpansion2||boundingRect.left>window.innerWidth+viewportExpansion2)}for(const rect of rects){if(rect.width===0||rect.height===0)continue;if(!(rect.bottom<-viewportExpansion2||rect.top>window.innerHeight+viewportExpansion2||rect.right<-viewportExpansion2||rect.left>window.innerWidth+viewportExpansion2)){return true}}return false}__name(isInExpandedViewport,"isInExpandedViewport");function isInteractiveCandidate(element){if(!element||element.nodeType!==Node.ELEMENT_NODE)return false;const tagName=element.tagName.toLowerCase();const interactiveElements=new Set(["a","button","input","select","textarea","details","summary","label"]);if(interactiveElements.has(tagName))return true;const hasQuickInteractiveAttr=element.hasAttribute("onclick")||element.hasAttribute("role")||element.hasAttribute("tabindex")||element.hasAttribute("aria-")||element.hasAttribute("data-action")||element.getAttribute("contenteditable")==="true";return hasQuickInteractiveAttr}__name(isInteractiveCandidate,"isInteractiveCandidate");const DISTINCT_INTERACTIVE_TAGS=new Set(["a","button","input","select","textarea","summary","details","label","option"]);const INTERACTIVE_ROLES=new Set(["button","link","menuitem","menuitemradio","menuitemcheckbox","radio","checkbox","tab","switch","slider","spinbutton","combobox","searchbox","textbox","listbox","option","scrollbar"]);function isHeuristicallyInteractive(element){if(!element||element.nodeType!==Node.ELEMENT_NODE)return false;if(!isElementVisible(element))return false;const hasInteractiveAttributes=element.hasAttribute("role")||element.hasAttribute("tabindex")||element.hasAttribute("onclick")||typeof element.onclick==="function";const hasInteractiveClass=/\\b(btn|clickable|menu|item|entry|link)\\b/i.test(element.className||"");const isInKnownContainer=Boolean(element.closest(\'button,a,[role="button"],.menu,.dropdown,.list,.toolbar\'));const hasVisibleChildren=[...element.children].some(isElementVisible);const isParentBody=element.parentElement&&element.parentElement.isSameNode(document.body);return(isInteractiveElement(element)||hasInteractiveAttributes||hasInteractiveClass)&&hasVisibleChildren&&isInKnownContainer&&!isParentBody}__name(isHeuristicallyInteractive,"isHeuristicallyInteractive");function isElementDistinctInteraction(element){if(!element||element.nodeType!==Node.ELEMENT_NODE){return false}const tagName=element.tagName.toLowerCase();const role=element.getAttribute("role");if(tagName==="iframe"){return true}if(DISTINCT_INTERACTIVE_TAGS.has(tagName)){return true}if(role&&INTERACTIVE_ROLES.has(role)){return true}if(element.isContentEditable||element.getAttribute("contenteditable")==="true"){return true}if(element.hasAttribute("data-testid")||element.hasAttribute("data-cy")||element.hasAttribute("data-test")){return true}if(element.hasAttribute("onclick")||typeof element.onclick==="function"){return true}try{const getEventListenersForNode=element?.ownerDocument?.defaultView?.getEventListenersForNode||window.getEventListenersForNode;if(typeof getEventListenersForNode==="function"){const listeners=getEventListenersForNode(element);const interactionEvents=["click","mousedown","mouseup","keydown","keyup","submit","change","input","focus","blur"];for(const eventType of interactionEvents){for(const listener of listeners){if(listener.type===eventType){return true}}}}const commonEventAttrs=["onmousedown","onmouseup","onkeydown","onkeyup","onsubmit","onchange","oninput","onfocus","onblur"];if(commonEventAttrs.some((attr)=>element.hasAttribute(attr))){return true}}catch(e){}if(isHeuristicallyInteractive(element)){return true}return false}__name(isElementDistinctInteraction,"isElementDistinctInteraction");function handleHighlighting(nodeData,node,parentIframe,isParentHighlighted){if(!nodeData.isInteractive)return false;let shouldHighlight=false;if(!isParentHighlighted){shouldHighlight=true}else{if(isElementDistinctInteraction(node)){shouldHighlight=true}else{shouldHighlight=false}}if(shouldHighlight){nodeData.isInViewport=isInExpandedViewport(node,viewportExpansion);if(nodeData.isInViewport||viewportExpansion===-1){nodeData.highlightIndex=highlightIndex++;if(doHighlightElements){if(focusHighlightIndex>=0){if(focusHighlightIndex===nodeData.highlightIndex){highlightElement(node,nodeData.highlightIndex,parentIframe)}}else{highlightElement(node,nodeData.highlightIndex,parentIframe)}return true}}}return false}__name(handleHighlighting,"handleHighlighting");function buildDomTree(node,parentIframe=null,isParentHighlighted=false){if(!node||node.id===HIGHLIGHT_CONTAINER_ID||node.nodeType!==Node.ELEMENT_NODE&&node.nodeType!==Node.TEXT_NODE){return null}if(!node||node.id===HIGHLIGHT_CONTAINER_ID){return null}if(node.dataset?.browserUseIgnore==="true"||node.dataset?.pageAgentIgnore==="true"){return null}if(node.getAttribute&&node.getAttribute("aria-hidden")==="true"){return null}if(node===document.body){const nodeData2={tagName:"body",attributes:{},xpath:"/body",children:[]};for(const child of node.childNodes){const domElement=buildDomTree(child,parentIframe,false);if(domElement)nodeData2.children.push(domElement)}const id2=`${ID.current++}`;DOM_HASH_MAP[id2]=nodeData2;return id2}if(node.nodeType!==Node.ELEMENT_NODE&&node.nodeType!==Node.TEXT_NODE){return null}if(node.nodeType===Node.TEXT_NODE){const textContent=node.textContent?.trim();if(!textContent){return null}const parentElement=node.parentElement;if(!parentElement||parentElement.tagName.toLowerCase()==="script"){return null}const id2=`${ID.current++}`;DOM_HASH_MAP[id2]={type:"TEXT_NODE",text:textContent,isVisible:isTextNodeVisible(node)};return id2}if(node.nodeType===Node.ELEMENT_NODE&&!isElementAccepted(node)){return null}if(viewportExpansion!==-1&&!node.shadowRoot){const rect=getCachedBoundingRect(node);const style=getCachedComputedStyle(node);const isFixedOrSticky=style&&(style.position==="fixed"||style.position==="sticky");const hasSize=node.offsetWidth>0||node.offsetHeight>0;if(!rect||!isFixedOrSticky&&!hasSize&&(rect.bottom<-viewportExpansion||rect.top>window.innerHeight+viewportExpansion||rect.right<-viewportExpansion||rect.left>window.innerWidth+viewportExpansion)){return null}}const nodeData={tagName:node.tagName.toLowerCase(),attributes:{},children:[]};if(isInteractiveCandidate(node)||node.tagName.toLowerCase()==="iframe"||node.tagName.toLowerCase()==="body"){const attributeNames=node.getAttributeNames?.()||[];for(const name of attributeNames){const value=node.getAttribute(name);nodeData.attributes[name]=value}if(node.tagName.toLowerCase()==="input"&&(node.type==="checkbox"||node.type==="radio")){nodeData.attributes.checked=node.checked?"true":"false"}}let nodeWasHighlighted=false;if(node.nodeType===Node.ELEMENT_NODE){nodeData.isVisible=isElementVisible(node);if(nodeData.isVisible){nodeData.isTopElement=isTopElement(node);const role=node.getAttribute("role");const isMenuContainer=role==="menu"||role==="menubar"||role==="listbox";if(nodeData.isTopElement||isMenuContainer){nodeData.isInteractive=isInteractiveElement(node);nodeWasHighlighted=handleHighlighting(nodeData,node,parentIframe,isParentHighlighted);nodeData.ref=node;if(nodeData.isInteractive&&Object.keys(nodeData.attributes).length===0){const attributeNames=node.getAttributeNames?.()||[];for(const name of attributeNames){const value=node.getAttribute(name);nodeData.attributes[name]=value}}}}}if(node.tagName){const tagName=node.tagName.toLowerCase();if(tagName==="iframe"){try{const iframeDoc=node.contentDocument||node.contentWindow?.document;if(iframeDoc){for(const child of iframeDoc.childNodes){const domElement=buildDomTree(child,node,false);if(domElement)nodeData.children.push(domElement)}}}catch(e){console.warn("Unable to access iframe:",e)}}else if(node.isContentEditable||node.getAttribute("contenteditable")==="true"||node.id==="tinymce"||node.classList.contains("mce-content-body")||tagName==="body"&&node.getAttribute("data-id")?.startsWith("mce_")){for(const child of node.childNodes){const domElement=buildDomTree(child,parentIframe,nodeWasHighlighted);if(domElement)nodeData.children.push(domElement)}}else{if(node.shadowRoot){nodeData.shadowRoot=true;for(const child of node.shadowRoot.childNodes){const domElement=buildDomTree(child,parentIframe,nodeWasHighlighted);if(domElement)nodeData.children.push(domElement)}}for(const child of node.childNodes){const passHighlightStatusToChild=nodeWasHighlighted||isParentHighlighted;const domElement=buildDomTree(child,parentIframe,passHighlightStatusToChild);if(domElement)nodeData.children.push(domElement)}}}if(nodeData.tagName==="a"&&nodeData.children.length===0&&!nodeData.attributes.href){const rect=getCachedBoundingRect(node);const hasSize=rect&&rect.width>0&&rect.height>0||node.offsetWidth>0||node.offsetHeight>0;if(!hasSize){return null}}nodeData.extra=extraData.get(node)||null;const id=`${ID.current++}`;DOM_HASH_MAP[id]=nodeData;return id}__name(buildDomTree,"buildDomTree");const rootId=buildDomTree(document.body);DOM_CACHE.clearCache();return{rootId,map:DOM_HASH_MAP}},"domTree");const DEFAULT_VIEWPORT_EXPANSION=-1;function resolveViewportExpansion(viewportExpansion){return viewportExpansion??DEFAULT_VIEWPORT_EXPANSION}__name(resolveViewportExpansion,"resolveViewportExpansion");const newElementsCache=new WeakMap;function getFlatTree(config){const viewportExpansion=resolveViewportExpansion(config.viewportExpansion);const interactiveBlacklist=[];for(const item of config.interactiveBlacklist||[]){if(typeof item==="function"){interactiveBlacklist.push(item())}else{interactiveBlacklist.push(item)}}const interactiveWhitelist=[];for(const item of config.interactiveWhitelist||[]){if(typeof item==="function"){interactiveWhitelist.push(item())}else{interactiveWhitelist.push(item)}}const elements=domTree({doHighlightElements:true,debugMode:true,focusHighlightIndex:-1,viewportExpansion,interactiveBlacklist,interactiveWhitelist,highlightOpacity:config.highlightOpacity??0,highlightLabelOpacity:config.highlightLabelOpacity??0.1});const currentUrl=window.location.href;for(const nodeId in elements.map){const node=elements.map[nodeId];if(node.isInteractive&&node.ref){const ref=node.ref;if(!newElementsCache.has(ref)){newElementsCache.set(ref,currentUrl);node.isNew=true}}}return elements}__name(getFlatTree,"getFlatTree");const globRegexCache=new Map;function globToRegex(pattern){let regex=globRegexCache.get(pattern);if(!regex){const escaped=pattern.replace(/[.+^${}()|[\\]\\\\]/g,"\\\\$&");regex=new RegExp(`^${escaped.replace(/\\*/g,".*")}$`);globRegexCache.set(pattern,regex)}return regex}__name(globToRegex,"globToRegex");function matchAttributes(attrs,patterns){const result2={};for(const pattern of patterns){if(pattern.includes("*")){const regex=globToRegex(pattern);for(const key of Object.keys(attrs)){if(regex.test(key)&&attrs[key].trim()){result2[key]=attrs[key].trim()}}}else{const value=attrs[pattern];if(value&&value.trim()){result2[pattern]=value.trim()}}}return result2}__name(matchAttributes,"matchAttributes");function flatTreeToString(flatTree,includeAttributes){const DEFAULT_INCLUDE_ATTRIBUTES=["title","type","checked","name","role","value","placeholder","data-date-format","alt","aria-label","aria-expanded","data-state","aria-checked","id","for","target","aria-haspopup","aria-controls","aria-owns","contenteditable"];const includeAttrs=[...includeAttributes||[],...DEFAULT_INCLUDE_ATTRIBUTES];const capTextLength=__name((text,maxLength)=>{if(text.length>maxLength){return text.substring(0,maxLength)+"..."}return text},"capTextLength");const buildTreeNode=__name((nodeId)=>{const node=flatTree.map[nodeId];if(!node)return null;if(node.type==="TEXT_NODE"){const textNode=node;return{type:"text",text:textNode.text,isVisible:textNode.isVisible,parent:null,children:[]}}else{const elementNode=node;const children=[];if(elementNode.children){for(const childId of elementNode.children){const child=buildTreeNode(childId);if(child){child.parent=null;children.push(child)}}}return{type:"element",tagName:elementNode.tagName,attributes:elementNode.attributes??{},isVisible:elementNode.isVisible??false,isInteractive:elementNode.isInteractive??false,isTopElement:elementNode.isTopElement??false,isNew:elementNode.isNew??false,highlightIndex:elementNode.highlightIndex,parent:null,children,extra:elementNode.extra??{}}}},"buildTreeNode");const setParentReferences=__name((node,parent=null)=>{node.parent=parent;for(const child of node.children){setParentReferences(child,node)}},"setParentReferences");const rootNode=buildTreeNode(flatTree.rootId);if(!rootNode)return"";setParentReferences(rootNode);const hasParentWithHighlightIndex=__name((node)=>{let current=node.parent;while(current){if(current.type==="element"&&current.highlightIndex!==undefined){return true}current=current.parent}return false},"hasParentWithHighlightIndex");const processNode=__name((node,depth,result22)=>{let nextDepth=depth;const depthStr="\\t".repeat(depth);if(node.type==="element"){if(node.highlightIndex!==undefined){nextDepth+=1;const text=getAllTextTillNextClickableElement(node);let attributesHtmlStr="";if(includeAttrs.length>0&&node.attributes){const attributesToInclude=matchAttributes(node.attributes,includeAttrs);const keys=Object.keys(attributesToInclude);if(keys.length>1){const keysToRemove=new Set;const seenValues={};for(const key of keys){const value=attributesToInclude[key];if(value.length>5){if(value in seenValues){keysToRemove.add(key)}else{seenValues[value]=key}}}for(const key of keysToRemove){delete attributesToInclude[key]}}if(attributesToInclude.role===node.tagName){delete attributesToInclude.role}const attrsToRemoveIfTextMatches=["aria-label","placeholder","title"];for(const attr of attrsToRemoveIfTextMatches){if(attributesToInclude[attr]&&attributesToInclude[attr].toLowerCase().trim()===text.toLowerCase().trim()){delete attributesToInclude[attr]}}if(Object.keys(attributesToInclude).length>0){attributesHtmlStr=Object.entries(attributesToInclude).map(([key,value])=>`${key}=${capTextLength(value,20)}`).join(" ")}}const highlightIndicator=node.isNew?`*[${node.highlightIndex}]`:`[${node.highlightIndex}]`;let line=`${depthStr}${highlightIndicator}<${node.tagName??""}`;if(attributesHtmlStr){line+=` ${attributesHtmlStr}`}if(node.extra){if(node.extra.scrollable){let scrollDataText="";if(node.extra.scrollData?.left)scrollDataText+=`left=${node.extra.scrollData.left}, `;if(node.extra.scrollData?.top)scrollDataText+=`top=${node.extra.scrollData.top}, `;if(node.extra.scrollData?.right)scrollDataText+=`right=${node.extra.scrollData.right}, `;if(node.extra.scrollData?.bottom)scrollDataText+=`bottom=${node.extra.scrollData.bottom}`;line+=` data-scrollable="${scrollDataText}"`}}if(text){const trimmedText=text.trim();if(!attributesHtmlStr){line+=" "}line+=`>${trimmedText}`}else if(!attributesHtmlStr){line+=" "}line+=" />";result22.push(line)}for(const child of node.children){processNode(child,nextDepth,result22)}}else if(node.type==="text"){if(hasParentWithHighlightIndex(node)){return}if(node.parent&&node.parent.type==="element"&&node.parent.isVisible&&node.parent.isTopElement){result22.push(`${depthStr}${node.text??""}`)}}},"processNode");const result2=[];processNode(rootNode,0,result2);return result2.join(`\n`)}__name(flatTreeToString,"flatTreeToString");const getAllTextTillNextClickableElement=__name((node,maxDepth=-1)=>{const textParts=[];const collectText=__name((currentNode,currentDepth)=>{if(maxDepth!==-1&&currentDepth>maxDepth){return}if(currentNode.type==="element"&&currentNode!==node&&currentNode.highlightIndex!==undefined){return}if(currentNode.type==="text"&&currentNode.text){textParts.push(currentNode.text)}else if(currentNode.type==="element"){for(const child of currentNode.children){collectText(child,currentDepth+1)}}},"collectText");collectText(node,0);return textParts.join(`\n`).trim()},"getAllTextTillNextClickableElement");function getSelectorMap(flatTree){const selectorMap=new Map;const keys=Object.keys(flatTree.map);for(const key of keys){const node=flatTree.map[key];if(node.isInteractive&&typeof node.highlightIndex==="number"){selectorMap.set(node.highlightIndex,node)}}return selectorMap}__name(getSelectorMap,"getSelectorMap");function getElementTextMap(simplifiedHTML){const lines=simplifiedHTML.split(`\n`).map((line)=>line.trim()).filter((line)=>line.length>0);const elementTextMap=new Map;for(const line of lines){const regex=/^\\[(\\d+)\\]<[^>]+>([^<]*)/;const match=regex.exec(line);if(match){const index=parseInt(match[1],10);elementTextMap.set(index,line)}}return elementTextMap}__name(getElementTextMap,"getElementTextMap");function cleanUpHighlights(){const cleanupFunctions=window._highlightCleanupFunctions||[];for(const cleanup of cleanupFunctions){if(typeof cleanup==="function"){cleanup()}}window._highlightCleanupFunctions=[]}__name(cleanUpHighlights,"cleanUpHighlights");window.addEventListener("popstate",()=>{cleanUpHighlights()});window.addEventListener("hashchange",()=>{cleanUpHighlights()});window.addEventListener("beforeunload",()=>{cleanUpHighlights()});const navigation=window.navigation;if(navigation&&typeof navigation.addEventListener==="function"){navigation.addEventListener("navigate",()=>{cleanUpHighlights()})}else{let currentUrl=window.location.href;setInterval(()=>{if(window.location.href!==currentUrl){currentUrl=window.location.href;cleanUpHighlights()}},500)}function getPageInfo(){const viewport_width=window.innerWidth;const viewport_height=window.innerHeight;const page_width=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth||0);const page_height=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight||0);const scroll_x=window.scrollX||window.pageXOffset||document.documentElement.scrollLeft||0;const scroll_y=window.scrollY||window.pageYOffset||document.documentElement.scrollTop||0;const pixels_below=Math.max(0,page_height-(window.innerHeight+scroll_y));const pixels_right=Math.max(0,page_width-(window.innerWidth+scroll_x));return{viewport_width,viewport_height,page_width,page_height,scroll_x,scroll_y,pixels_above:scroll_y,pixels_below,pages_above:viewport_height>0?scroll_y/viewport_height:0,pages_below:viewport_height>0?pixels_below/viewport_height:0,total_pages:viewport_height>0?page_height/viewport_height:0,current_page_position:scroll_y/Math.max(1,page_height-viewport_height),pixels_left:scroll_x,pixels_right}}__name(getPageInfo,"getPageInfo");function patchReact(pageController){const reactRootElements=document.querySelectorAll(\'[data-reactroot], [data-reactid], [data-react-checksum], #root, #app, [id^="root-"], [id^="app-"], #adex-wrapper, #adex-root\');for(const element of reactRootElements){element.setAttribute("data-page-agent-not-interactive","true")}}__name(patchReact,"patchReact");const _PageController=class _PageController extends EventTarget{config;flatTree=null;selectorMap=new Map;elementTextMap=new Map;simplifiedHTML="<EMPTY>";lastTimeUpdate=0;isIndexed=false;mask=null;maskReady=null;constructor(config={}){super();this.config=config;patchReact();if(config.enableMask)this.initMask()}initMask(){if(this.maskReady!==null)return;this.maskReady=(async()=>{var SimulatorMask = window.__LiteMask;this.mask=new SimulatorMask})()}async getCurrentUrl(){return window.location.href}async getLastUpdateTime(){return this.lastTimeUpdate}async getBrowserState(){const url=window.location.href;const title=document.title;const pi=getPageInfo();const viewportExpansion=resolveViewportExpansion(this.config.viewportExpansion);await this.updateTree();const content=this.simplifiedHTML;const titleLine=`Current Page: [${title}](${url})`;const pageInfoLine=`Page info: ${pi.viewport_width}x${pi.viewport_height}px viewport, ${pi.page_width}x${pi.page_height}px total page size, ${pi.pages_above.toFixed(1)} pages above, ${pi.pages_below.toFixed(1)} pages below, ${pi.total_pages.toFixed(1)} total pages, at ${(pi.current_page_position*100).toFixed(0)}% of page`;const elementsLabel=viewportExpansion===-1?"Interactive elements from top layer of the current page (full page):":"Interactive elements from top layer of the current page inside the viewport:";const hasContentAbove=pi.pixels_above>4;const scrollHintAbove=hasContentAbove&&viewportExpansion!==-1?`... ${pi.pixels_above} pixels above (${pi.pages_above.toFixed(1)} pages) - scroll to see more ...`:"[Start of page]";const header=`${titleLine}\n${pageInfoLine}\n\n${elementsLabel}\n\n${scrollHintAbove}`;const hasContentBelow=pi.pixels_below>4;const footer=hasContentBelow&&viewportExpansion!==-1?`... ${pi.pixels_below} pixels below (${pi.pages_below.toFixed(1)} pages) - scroll to see more ...`:"[End of page]";return{url,title,header,content,footer}}async updateTree(){this.dispatchEvent(new Event("beforeUpdate"));this.lastTimeUpdate=Date.now();if(this.mask){this.mask.wrapper.style.pointerEvents="none"}cleanUpHighlights();const blacklist=[...this.config.interactiveBlacklist||[],...document.querySelectorAll("[data-page-agent-not-interactive]").values()];this.flatTree=getFlatTree({...this.config,interactiveBlacklist:blacklist});this.simplifiedHTML=flatTreeToString(this.flatTree,this.config.includeAttributes);this.selectorMap.clear();this.selectorMap=getSelectorMap(this.flatTree);this.elementTextMap.clear();this.elementTextMap=getElementTextMap(this.simplifiedHTML);this.isIndexed=true;if(this.mask){this.mask.wrapper.style.pointerEvents="auto"}this.dispatchEvent(new Event("afterUpdate"));return this.simplifiedHTML}async cleanUpHighlights(){cleanUpHighlights()}assertIndexed(){if(!this.isIndexed){throw new Error("DOM tree not indexed yet. Can not perform actions on elements.")}}async clickElement(index){try{this.assertIndexed();const element=getElementByIndex(this.selectorMap,index);const elemText=this.elementTextMap.get(index);await clickElement(element);if(isAnchorElement(element)&&element.target==="_blank"){return{success:true,message:`✅ Clicked element (${elemText??index}). ⚠️ Link opened in a new tab.`}}return{success:true,message:`✅ Clicked element (${elemText??index}).`}}catch(error){return{success:false,message:`❌ Failed to click element: ${error}`}}}async inputText(index,text){try{this.assertIndexed();const element=getElementByIndex(this.selectorMap,index);const elemText=this.elementTextMap.get(index);await inputTextElement(element,text);return{success:true,message:`✅ Input text (${text}) into element (${elemText??index}).`}}catch(error){return{success:false,message:`❌ Failed to input text: ${error}`}}}async selectOption(index,optionText){try{this.assertIndexed();const element=getElementByIndex(this.selectorMap,index);const elemText=this.elementTextMap.get(index);await selectOptionElement(element,optionText);return{success:true,message:`✅ Selected option (${optionText}) in element (${elemText??index}).`}}catch(error){return{success:false,message:`❌ Failed to select option: ${error}`}}}async scroll(options){try{const{down,numPages,pixels,index}=options;this.assertIndexed();const scrollAmount=pixels??numPages*(down?1:-1)*window.innerHeight;const element=index!==undefined?getElementByIndex(this.selectorMap,index):null;const message=await scrollVertically(down,scrollAmount,element);return{success:true,message}}catch(error){return{success:false,message:`❌ Failed to scroll: ${error}`}}}async scrollHorizontally(options){try{const{right,pixels,index}=options;this.assertIndexed();const scrollAmount=pixels*(right?1:-1);const element=index!==undefined?getElementByIndex(this.selectorMap,index):null;const message=await scrollHorizontally(right,scrollAmount,element);return{success:true,message}}catch(error){return{success:false,message:`❌ Failed to scroll horizontally: ${error}`}}}async executeJavascript(script){try{const asyncFunction=eval(`(async () => { ${script} })`);const result=await asyncFunction();return{success:true,message:`✅ Executed JavaScript. Result: ${result}`}}catch(error){return{success:false,message:`❌ Error executing JavaScript: ${error}`}}}async showMask(){await this.maskReady;this.mask?.show()}async hideMask(){await this.maskReady;this.mask?.hide()}dispose(){cleanUpHighlights();this.flatTree=null;this.selectorMap.clear();this.elementTextMap.clear();this.simplifiedHTML="<EMPTY>";this.isIndexed=false;this.mask?.dispose();this.mask=null}};__name(_PageController,"PageController");let PageController=_PageController;window.__PageController=PageController})();\n})();\n\n// --- Signet Page Agent API ---\n(function(){\n var pc = new window.__PageController({ enableMask: false, highlightOpacity: 0, highlightLabelOpacity: 0 });\n \n window.signet = window.signet || {};\n window.signet.pageController = pc;\n \n window.signet.getDomState = async function(){\n try {\n var state = await pc.getBrowserState();\n return { success: true, state: state };\n } catch(e) {\n return { success: false, error: e.message || String(e) };\n }\n };\n \n window.signet.executeAction = async function(action){\n try {\n var result;\n switch(action.type){\n case \'click_element\':\n result = await pc.clickElement(action.index);\n break;\n case \'input_text\':\n result = await pc.inputText(action.index, action.text);\n break;\n case \'select_option\':\n result = await pc.selectOption(action.index, action.text);\n break;\n case \'scroll\':\n result = await pc.scroll({ down: action.direction === \'down\', numPages: action.amount || 1 });\n break;\n default:\n result = { success: false, message: \'Unknown action type: \' + action.type };\n }\n return result;\n } catch(e) {\n return { success: false, message: e.message || String(e) };\n }\n };\n \n window.signet.agentStart = async function(){\n pc.initMask();\n await pc.showMask();\n };\n \n window.signet.agentStop = async function(){\n await pc.hideMask();\n };\n})();',Yt=`
1
+ import{o as We,p as re,s as he,c as de,f as se,a as fe,n as ve,b as w,d as ie,r as we,i as c,j as J,t as _,k as s,y as ee,z as ae,D as ge,A as Te,h as t,l as N,v as m,m as Y,e as ft,Q as Ze,q as ze,aU as Ve,F as Je,B as xe,u as pe,O as U,P as Se,aa as et,N as Ee,ac as Ie,w as ke,I as Me,x as vt,K as wt,U as yt}from"./Ddm7yfuh.js";import{o as me,I as ye,aG as bt,bc as xt,bd as _t,H as Et}from"./CQjlljeJ.js";import{W as at,L as Tt}from"./BChLYXWi.js";import{R as st}from"./1wENB9Fv.js";import{P as qe}from"./CgytmeWL.js";import{P as kt}from"./NA4Ojz1i.js";import{T as St}from"./-GB9BHh5.js";const k=We({entries:[],loading:!1,error:null,groups:[],activeGroup:null,draggingId:null,focusedId:null,widgetCacheVersion:0}),be=new Map,He=new Set;function Ct(){return k.entries.filter(n=>n.state==="tray")}function Nt(){const n=k.entries.filter(e=>e.state==="grid");if(k.activeGroup){const e=k.groups.find(r=>r.id===k.activeGroup);if(e)return n.filter(r=>e.items.includes(r.id))}return n}function It(){return k.entries.filter(n=>n.state==="dock")}const tt=12;function Qe(n,e,r){const a=r?.x??0,d=r?.y??0;function p(R,P,D,H){for(const A of n)if(R<A.x+A.w&&R+D>A.x&&P<A.y+A.h&&P+H>A.y)return!0;return!1}const o=Math.max(0,Math.min(tt-e.w,a)),y=Math.max(0,d);if(!p(o,y,e.w,e.h))return{x:o,y,w:e.w,h:e.h};for(let R=1;R<=20;R++)for(let P=-R;P<=R;P++)for(let D=-R;D<=R;D++){if(Math.abs(D)!==R&&Math.abs(P)!==R)continue;const H=Math.max(0,Math.min(tt-e.w,a+D)),A=Math.max(0,d+P);if(!p(H,A,e.w,e.h))return{x:H,y:A,w:e.w,h:e.h}}return{x:0,y:n.reduce((R,P)=>Math.max(R,P.y+P.h),0),w:e.w,h:e.h}}async function Oe(){k.loading=!0,k.error=null;try{const n=await fetch(`${me}/api/os/tray`);if(!n.ok)throw new Error(`HTTP ${n.status}`);const e=await n.json();k.entries=e.entries??[]}catch(n){k.error=n instanceof Error?n.message:String(n)}finally{k.loading=!1}}async function Ae(n,e,r){try{const a={state:e};r&&(a.gridPosition=r);const d=await fetch(`${me}/api/os/tray/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!d.ok)return!1;const p=await d.json();if(p.success&&p.entry){const o=k.entries.findIndex(y=>y.id===n);o>=0&&(k.entries[o]=p.entry)}return!0}catch{return!1}}async function nt(n,e){return Ae(n,"grid",e)}async function Xe(n,e){const r=k.entries.find(o=>o.id===n);if(!r)return!1;if(e)return Ae(n,"grid",e);const a=r.manifest?.defaultSize??{w:4,h:3},d=k.entries.flatMap(o=>o.id!==n&&o.state==="grid"&&o.gridPosition?[o.gridPosition]:[]),p=Qe(d,a);return Ae(n,"grid",p)}async function Mt(n){return Ae(n,"dock")}async function lt(n){return Ae(n,"tray")}const ct="signet-os-sidebar-groups";function At(){try{const n=localStorage.getItem(ct);n&&(k.groups=JSON.parse(n))}catch{k.groups=[]}}function Fe(){localStorage.setItem(ct,JSON.stringify(k.groups))}function Dt(n){const e={id:`group_${Date.now()}`,name:n,items:[]};return k.groups=[...k.groups,e],Fe(),e}function Lt(n){k.groups=k.groups.filter(e=>e.id!==n),k.activeGroup===n&&(k.activeGroup=null),Fe()}function Rt(n,e){k.groups=k.groups.map(r=>r.id===n?{...r,name:e}:r),Fe()}function Ht(n,e){k.groups=k.groups.map(r=>r.id!==n||r.items.includes(e)?r:{...r,items:[...r.items,e]}),Fe()}function Ue(n){k.activeGroup=n}let Pe=We(new Map),rt=0;function it(n,e,r){Pe.set(n,{action:e,data:r,_seq:++rt}),setTimeout(()=>{const a=Pe.get(n);a&&a._seq===rt&&Pe.delete(n)},500)}function Pt(n){return Pe.get(n)}function Ot(n){k.focusedId=n}function Le(){k.focusedId=null}async function $e(n){if(be.has(n))return be.get(n)??null;try{const e=await fetch(`${me}/api/os/widget/${encodeURIComponent(n)}`);if(!e.ok)return null;const r=await e.json();return r.html?(be.set(n,r.html),k.widgetCacheVersion++,r.html):null}catch{return null}}async function dt(n){if(!He.has(n)){He.add(n),k.widgetCacheVersion++;try{const r=await(await fetch(`${me}/api/os/widget/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({serverId:n,force:!1})})).json();r.status==="cached"&&r.html&&be.set(n,r.html)}catch{}finally{be.has(n)&&He.delete(n),k.widgetCacheVersion++}}}const Ke=new Map;function $t(n,e){Ke.set(n,e)}function Wt(n){Ke.delete(n)}function Re(n){return Ke.get(n)}const zt=We({current:null});function _e(n){zt.current=n}function Ye(n,e){re(e,!0);let r=we(e,["$$slots","$$events","$$legacy"]);const a=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}],["path",{d:"m3.3 7 8.7 5 8.7-5"}],["path",{d:"M12 22V12"}]];ye(n,he({name:"box"},()=>r,{get iconNode(){return a},children:(d,p)=>{var o=de(),y=se(o);fe(y,()=>e.children??ve),w(d,o)},$$slots:{default:!0}})),ie()}var Vt=N('<img class="auto-card-icon svelte-1y09vim" referrerpolicy="no-referrer"/>'),Ft=N('<div class="auto-card-icon-placeholder svelte-1y09vim"><!></div>'),jt=N('<button class="auto-card-tool-btn sig-switch svelte-1y09vim" disabled=""><!> <span class="truncate"> </span></button>'),Bt=N('<div class="auto-card-tools svelte-1y09vim"></div>'),Ut=N('<div class="auto-card-empty svelte-1y09vim"><span class="sig-label">No tools exposed</span></div>'),Gt=N('<div class="auto-card svelte-1y09vim"><div class="auto-card-header svelte-1y09vim"><!> <span class="auto-card-name svelte-1y09vim"> </span> <span class="sig-meta ml-auto"> </span></div> <!></div>');function qt(n,e){re(e,!0);var r=Gt(),a=c(r),d=c(a);{var p=O=>{var S=Vt();ee(()=>{ge(S,"src",e.icon),ge(S,"alt",e.name)}),w(O,S)},o=O=>{var S=Ft(),$=c(S);Ye($,{class:"size-4"}),s(S),w(O,S)};J(d,O=>{e.icon?O(p):O(o,-1)})}var y=_(d,2),G=c(y,!0);s(y);var R=_(y,2),P=c(R);s(R),s(a);var D=_(a,2);{var H=O=>{var S=Bt();Te(S,21,()=>e.autoCard.tools,$=>$.name,($,W)=>{var j=jt(),F=c(j);at(F,{class:"size-3 shrink-0 opacity-50"});var te=_(F,2),I=c(te,!0);s(te),s(j),ee(()=>{ge(j,"title",t(W).description||t(W).name),ae(I,t(W).name)}),w($,j)}),s(S),w(O,S)},A=O=>{var S=Ut();w(O,S)};J(D,O=>{e.autoCard.tools.length>0?O(H):O(A,-1)})}s(r),ee(()=>{ae(G,e.name),ae(P,`${e.autoCard.tools.length??""} tools`)}),w(n,r),ie()}const Xt='// Signet Page Agent bundle - PageController + lightweight cursor mask\n// Auto-generated from @page-agent/page-controller v1.6.0\n\n\n(function(){\n // Lightweight SimulatorMask - cursor + overlay, no ai-motion dependency\n var CSS_TEXT = \'.__pa_mask{position:fixed;inset:0;z-index:2147483641;cursor:wait;overflow:hidden;display:none;background:rgba(0,0,0,0.02)}.__pa_mask.__pa_vis{display:block}.__pa_cur{position:absolute;width:40px;height:40px;pointer-events:none;z-index:10000;transition:none}.__pa_cur_fill{position:absolute;width:100%;height:100%;background:url("data:image/svg+xml,%3csvg xmlns=\\\'http://www.w3.org/2000/svg\\\' viewBox=\\\'0 0 100 100\\\'%3e%3cpath d=\\\'M 15 42 L 15 36.99 Q 15 31.99 23.7 31.99 L 28.05 31.99 Q 32.41 31.99 32.41 21.99 L 32.41 17 Q 32.41 12 41.09 16.95 L 76.31 37.05 Q 85 42 76.31 46.95 L 41.09 67.05 Q 32.41 72 32.41 62.01 L 32.41 57.01 Q 32.41 52.01 23.7 52.01 L 19.35 52.01 Q 15 52.01 15 47.01 Z\\\' fill=\\\'%23ffffff\\\' stroke=\\\'%23333\\\' stroke-width=\\\'4\\\'/%3e%3c/svg%3e");background-size:100% 100%;transform-origin:center;transform:rotate(-135deg) scale(1.1);margin-left:-8px;margin-top:-14px}.__pa_cur_border{position:absolute;width:100%;height:100%;background:linear-gradient(45deg,rgb(57,182,255),rgb(189,69,251));mask-image:url("data:image/svg+xml,%3csvg xmlns=\\\'http://www.w3.org/2000/svg\\\' viewBox=\\\'0 0 100 100\\\' fill=\\\'none\\\'%3e%3cpath d=\\\'M 15 42 L 15 36.99 Q 15 31.99 23.7 31.99 L 28.05 31.99 Q 32.41 31.99 32.41 21.99 L 32.41 17 Q 32.41 12 41.09 16.95 L 76.31 37.05 Q 85 42 76.31 46.95 L 41.09 67.05 Q 32.41 72 32.41 62.01 L 32.41 57.01 Q 32.41 52.01 23.7 52.01 L 19.35 52.01 Q 15 52.01 15 47.01 Z\\\' stroke=\\\'%23000\\\' stroke-width=\\\'6\\\'/%3e%3c/svg%3e");mask-size:100% 100%;mask-repeat:no-repeat;transform-origin:center;transform:rotate(-135deg) scale(1.2);margin-left:-10px;margin-top:-18px}.__pa_ripple{position:absolute;width:100%;height:100%;pointer-events:none;margin-left:-50%;margin-top:-50%}.__pa_ripple::after{content:\\\'\\\';opacity:0;position:absolute;inset:0;border:3px solid rgba(57,182,255,1);border-radius:50%}.__pa_cur.__pa_click .__pa_ripple::after{animation:__pa_rip 300ms ease-out forwards}@keyframes __pa_rip{0%{transform:scale(0);opacity:1}100%{transform:scale(2);opacity:0}}\';\n \n try{\n var s=document.createElement(\'style\');\n s.appendChild(document.createTextNode(CSS_TEXT));\n document.head.appendChild(s);\n }catch(e){}\n\n function LiteMask(){\n this.shown=false;\n this.wrapper=document.createElement(\'div\');\n this.wrapper.className=\'__pa_mask\';\n this.wrapper.setAttribute(\'data-page-agent-ignore\',\'true\');\n \n this._cursor=document.createElement(\'div\');\n this._cursor.className=\'__pa_cur\';\n var ripple=document.createElement(\'div\');ripple.className=\'__pa_ripple\';this._cursor.appendChild(ripple);\n var fill=document.createElement(\'div\');fill.className=\'__pa_cur_fill\';this._cursor.appendChild(fill);\n var border=document.createElement(\'div\');border.className=\'__pa_cur_border\';this._cursor.appendChild(border);\n this.wrapper.appendChild(this._cursor);\n \n this._cx=0;this._cy=0;this._tx=0;this._ty=0;\n \n // Block interactions on mask\n [\'click\',\'mousedown\',\'mouseup\',\'mousemove\',\'wheel\',\'keydown\',\'keyup\'].forEach(function(evt){\n this.wrapper.addEventListener(evt,function(e){e.stopPropagation();e.preventDefault();});\n }.bind(this));\n \n document.body.appendChild(this.wrapper);\n this._animate();\n \n var self=this;\n window.addEventListener(\'PageAgent::MovePointerTo\',function(e){\n var d=e.detail;self._tx=d.x;self._ty=d.y;\n });\n window.addEventListener(\'PageAgent::ClickPointer\',function(){\n self._cursor.classList.remove(\'__pa_click\');\n void self._cursor.offsetHeight;\n self._cursor.classList.add(\'__pa_click\');\n });\n }\n \n LiteMask.prototype._animate=function(){\n var nx=this._cx+(this._tx-this._cx)*0.2;\n var ny=this._cy+(this._ty-this._cy)*0.2;\n if(Math.abs(nx-this._tx)>0){this._cx=Math.abs(nx-this._tx)<2?this._tx:nx;this._cursor.style.left=this._cx+\'px\';}\n if(Math.abs(ny-this._ty)>0){this._cy=Math.abs(ny-this._ty)<2?this._ty:ny;this._cursor.style.top=this._cy+\'px\';}\n requestAnimationFrame(this._animate.bind(this));\n };\n \n LiteMask.prototype.show=function(){\n if(this.shown)return;this.shown=true;\n this.wrapper.classList.add(\'__pa_vis\');\n this._cx=window.innerWidth/2;this._cy=window.innerHeight/2;\n this._tx=this._cx;this._ty=this._cy;\n this._cursor.style.left=this._cx+\'px\';this._cursor.style.top=this._cy+\'px\';\n };\n \n LiteMask.prototype.hide=function(){\n if(!this.shown)return;this.shown=false;\n this._cursor.classList.remove(\'__pa_click\');\n var w=this.wrapper;\n setTimeout(function(){w.classList.remove(\'__pa_vis\');},300);\n };\n \n LiteMask.prototype.dispose=function(){this.wrapper.remove();};\n \n window.__LiteMask=LiteMask;\n})();\n\n// --- PageController (modified: SimulatorMask replaced with LiteMask) ---\n(function(){\n(function(){var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});function isHTMLElement(el){return!!el&&el.nodeType===1}__name(isHTMLElement,"isHTMLElement");function isInputElement(el){return el?.nodeType===1&&el.tagName==="INPUT"}__name(isInputElement,"isInputElement");function isTextAreaElement(el){return el?.nodeType===1&&el.tagName==="TEXTAREA"}__name(isTextAreaElement,"isTextAreaElement");function isSelectElement(el){return el?.nodeType===1&&el.tagName==="SELECT"}__name(isSelectElement,"isSelectElement");function isAnchorElement(el){return el?.nodeType===1&&el.tagName==="A"}__name(isAnchorElement,"isAnchorElement");function getIframeOffset(element){const frame=element.ownerDocument.defaultView?.frameElement;if(!frame)return{x:0,y:0};const rect=frame.getBoundingClientRect();return{x:rect.left,y:rect.top}}__name(getIframeOffset,"getIframeOffset");function getNativeValueSetter(element){return Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element),"value").set}__name(getNativeValueSetter,"getNativeValueSetter");async function waitFor(seconds){await new Promise((resolve)=>setTimeout(resolve,seconds*1000))}__name(waitFor,"waitFor");async function movePointerToElement(element){const rect=element.getBoundingClientRect();const offset=getIframeOffset(element);const x=rect.left+rect.width/2+offset.x;const y=rect.top+rect.height/2+offset.y;window.dispatchEvent(new CustomEvent("PageAgent::MovePointerTo",{detail:{x,y}}));await waitFor(0.3)}__name(movePointerToElement,"movePointerToElement");function getElementByIndex(selectorMap,index){const interactiveNode=selectorMap.get(index);if(!interactiveNode){throw new Error(`No interactive element found at index ${index}`)}const element=interactiveNode.ref;if(!element){throw new Error(`Element at index ${index} does not have a reference`)}if(!isHTMLElement(element)){throw new Error(`Element at index ${index} is not an HTMLElement`)}return element}__name(getElementByIndex,"getElementByIndex");let lastClickedElement=null;function blurLastClickedElement(){if(lastClickedElement){lastClickedElement.blur();lastClickedElement.dispatchEvent(new MouseEvent("mouseout",{bubbles:true,cancelable:true}));lastClickedElement.dispatchEvent(new MouseEvent("mouseleave",{bubbles:false,cancelable:true}));lastClickedElement=null}}__name(blurLastClickedElement,"blurLastClickedElement");async function clickElement(element){blurLastClickedElement();lastClickedElement=element;await scrollIntoViewIfNeeded(element);const frame=element.ownerDocument.defaultView?.frameElement;if(frame)await scrollIntoViewIfNeeded(frame);await movePointerToElement(element);window.dispatchEvent(new CustomEvent("PageAgent::ClickPointer"));await waitFor(0.1);element.dispatchEvent(new MouseEvent("mouseenter",{bubbles:true,cancelable:true}));element.dispatchEvent(new MouseEvent("mouseover",{bubbles:true,cancelable:true}));element.dispatchEvent(new MouseEvent("mousedown",{bubbles:true,cancelable:true}));element.focus();element.dispatchEvent(new MouseEvent("mouseup",{bubbles:true,cancelable:true}));element.dispatchEvent(new MouseEvent("click",{bubbles:true,cancelable:true}));await waitFor(0.2)}__name(clickElement,"clickElement");async function inputTextElement(element,text){const isContentEditable=element.isContentEditable;if(!isInputElement(element)&&!isTextAreaElement(element)&&!isContentEditable){throw new Error("Element is not an input, textarea, or contenteditable")}await clickElement(element);if(isContentEditable){if(element.dispatchEvent(new InputEvent("beforeinput",{bubbles:true,cancelable:true,inputType:"deleteContent"}))){element.innerText="";element.dispatchEvent(new InputEvent("input",{bubbles:true,inputType:"deleteContent"}))}if(element.dispatchEvent(new InputEvent("beforeinput",{bubbles:true,cancelable:true,inputType:"insertText",data:text}))){element.innerText=text;element.dispatchEvent(new InputEvent("input",{bubbles:true,inputType:"insertText",data:text}))}const planASucceeded=element.innerText.trim()===text.trim();if(!planASucceeded){element.focus();const doc=element.ownerDocument;const selection=(doc.defaultView||window).getSelection();const range=doc.createRange();range.selectNodeContents(element);selection?.removeAllRanges();selection?.addRange(range);doc.execCommand("delete",false);doc.execCommand("insertText",false,text)}element.dispatchEvent(new Event("change",{bubbles:true}));element.blur()}else{getNativeValueSetter(element).call(element,text)}if(!isContentEditable){element.dispatchEvent(new Event("input",{bubbles:true}))}await waitFor(0.1);blurLastClickedElement()}__name(inputTextElement,"inputTextElement");async function selectOptionElement(selectElement,optionText){if(!isSelectElement(selectElement)){throw new Error("Element is not a select element")}const options=Array.from(selectElement.options);const option=options.find((opt)=>opt.textContent?.trim()===optionText.trim());if(!option){throw new Error(`Option with text "${optionText}" not found in select element`)}selectElement.value=option.value;selectElement.dispatchEvent(new Event("change",{bubbles:true}));await waitFor(0.1)}__name(selectOptionElement,"selectOptionElement");async function scrollIntoViewIfNeeded(element){const el=element;if(typeof el.scrollIntoViewIfNeeded==="function"){el.scrollIntoViewIfNeeded()}else{element.scrollIntoView({behavior:"auto",block:"center",inline:"nearest"})}}__name(scrollIntoViewIfNeeded,"scrollIntoViewIfNeeded");async function scrollVertically(down,scroll_amount,element){if(element){const targetElement=element;let currentElement=targetElement;let scrollSuccess=false;let scrolledElement=null;let scrollDelta=0;let attempts=0;const dy2=scroll_amount;while(currentElement&&attempts<10){const computedStyle=window.getComputedStyle(currentElement);const hasScrollableY=/(auto|scroll|overlay)/.test(computedStyle.overflowY);const canScrollVertically=currentElement.scrollHeight>currentElement.clientHeight;if(hasScrollableY&&canScrollVertically){const beforeScroll=currentElement.scrollTop;const maxScroll=currentElement.scrollHeight-currentElement.clientHeight;let scrollAmount=dy2/3;if(scrollAmount>0){scrollAmount=Math.min(scrollAmount,maxScroll-beforeScroll)}else{scrollAmount=Math.max(scrollAmount,-beforeScroll)}currentElement.scrollTop=beforeScroll+scrollAmount;const afterScroll=currentElement.scrollTop;const actualScrollDelta=afterScroll-beforeScroll;if(Math.abs(actualScrollDelta)>0.5){scrollSuccess=true;scrolledElement=currentElement;scrollDelta=actualScrollDelta;break}}if(currentElement===document.body||currentElement===document.documentElement){break}currentElement=currentElement.parentElement;attempts++}if(scrollSuccess){return`Scrolled container (${scrolledElement?.tagName}) by ${scrollDelta}px`}else{return`No scrollable container found for element (${targetElement.tagName})`}}const dy=scroll_amount;const bigEnough=__name((el2)=>el2.clientHeight>=window.innerHeight*0.5,"bigEnough");const canScroll=__name((el2)=>el2&&/(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowY)&&el2.scrollHeight>el2.clientHeight&&bigEnough(el2),"canScroll");let el=document.activeElement;while(el&&!canScroll(el)&&el!==document.body)el=el.parentElement;el=canScroll(el)?el:Array.from(document.querySelectorAll("*")).find(canScroll)||document.scrollingElement||document.documentElement;if(el===document.scrollingElement||el===document.documentElement||el===document.body){const scrollBefore=window.scrollY;const scrollMax=document.documentElement.scrollHeight-window.innerHeight;window.scrollBy(0,dy);const scrollAfter=window.scrollY;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dy>0?`⚠️ Already at the bottom of the page, cannot scroll down further.`:`⚠️ Already at the top of the page, cannot scroll up further.`}const reachedBottom=dy>0&&scrollAfter>=scrollMax-1;const reachedTop=dy<0&&scrollAfter<=1;if(reachedBottom)return`✅ Scrolled page by ${scrolled}px. Reached the bottom of the page.`;if(reachedTop)return`✅ Scrolled page by ${scrolled}px. Reached the top of the page.`;return`✅ Scrolled page by ${scrolled}px.`}else{const scrollBefore=el.scrollTop;const scrollMax=el.scrollHeight-el.clientHeight;el.scrollBy({top:dy,behavior:"smooth"});await waitFor(0.1);const scrollAfter=el.scrollTop;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dy>0?`⚠️ Already at the bottom of container (${el.tagName}), cannot scroll down further.`:`⚠️ Already at the top of container (${el.tagName}), cannot scroll up further.`}const reachedBottom=dy>0&&scrollAfter>=scrollMax-1;const reachedTop=dy<0&&scrollAfter<=1;if(reachedBottom)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the bottom.`;if(reachedTop)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the top.`;return`✅ Scrolled container (${el.tagName}) by ${scrolled}px.`}}__name(scrollVertically,"scrollVertically");async function scrollHorizontally(right,scroll_amount,element){if(element){const targetElement=element;let currentElement=targetElement;let scrollSuccess=false;let scrolledElement=null;let scrollDelta=0;let attempts=0;const dx2=right?scroll_amount:-scroll_amount;while(currentElement&&attempts<10){const computedStyle=window.getComputedStyle(currentElement);const hasScrollableX=/(auto|scroll|overlay)/.test(computedStyle.overflowX);const canScrollHorizontally=currentElement.scrollWidth>currentElement.clientWidth;if(hasScrollableX&&canScrollHorizontally){const beforeScroll=currentElement.scrollLeft;const maxScroll=currentElement.scrollWidth-currentElement.clientWidth;let scrollAmount=dx2/3;if(scrollAmount>0){scrollAmount=Math.min(scrollAmount,maxScroll-beforeScroll)}else{scrollAmount=Math.max(scrollAmount,-beforeScroll)}currentElement.scrollLeft=beforeScroll+scrollAmount;const afterScroll=currentElement.scrollLeft;const actualScrollDelta=afterScroll-beforeScroll;if(Math.abs(actualScrollDelta)>0.5){scrollSuccess=true;scrolledElement=currentElement;scrollDelta=actualScrollDelta;break}}if(currentElement===document.body||currentElement===document.documentElement){break}currentElement=currentElement.parentElement;attempts++}if(scrollSuccess){return`Scrolled container (${scrolledElement?.tagName}) horizontally by ${scrollDelta}px`}else{return`No horizontally scrollable container found for element (${targetElement.tagName})`}}const dx=right?scroll_amount:-scroll_amount;const bigEnough=__name((el2)=>el2.clientWidth>=window.innerWidth*0.5,"bigEnough");const canScroll=__name((el2)=>el2&&/(auto|scroll|overlay)/.test(getComputedStyle(el2).overflowX)&&el2.scrollWidth>el2.clientWidth&&bigEnough(el2),"canScroll");let el=document.activeElement;while(el&&!canScroll(el)&&el!==document.body)el=el.parentElement;el=canScroll(el)?el:Array.from(document.querySelectorAll("*")).find(canScroll)||document.scrollingElement||document.documentElement;if(el===document.scrollingElement||el===document.documentElement||el===document.body){const scrollBefore=window.scrollX;const scrollMax=document.documentElement.scrollWidth-window.innerWidth;window.scrollBy(dx,0);const scrollAfter=window.scrollX;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dx>0?`⚠️ Already at the right edge of the page, cannot scroll right further.`:`⚠️ Already at the left edge of the page, cannot scroll left further.`}const reachedRight=dx>0&&scrollAfter>=scrollMax-1;const reachedLeft=dx<0&&scrollAfter<=1;if(reachedRight)return`✅ Scrolled page by ${scrolled}px. Reached the right edge of the page.`;if(reachedLeft)return`✅ Scrolled page by ${scrolled}px. Reached the left edge of the page.`;return`✅ Scrolled page horizontally by ${scrolled}px.`}else{const scrollBefore=el.scrollLeft;const scrollMax=el.scrollWidth-el.clientWidth;el.scrollBy({left:dx,behavior:"smooth"});await waitFor(0.1);const scrollAfter=el.scrollLeft;const scrolled=scrollAfter-scrollBefore;if(Math.abs(scrolled)<1){return dx>0?`⚠️ Already at the right edge of container (${el.tagName}), cannot scroll right further.`:`⚠️ Already at the left edge of container (${el.tagName}), cannot scroll left further.`}const reachedRight=dx>0&&scrollAfter>=scrollMax-1;const reachedLeft=dx<0&&scrollAfter<=1;if(reachedRight)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the right edge.`;if(reachedLeft)return`✅ Scrolled container (${el.tagName}) by ${scrolled}px. Reached the left edge.`;return`✅ Scrolled container (${el.tagName}) horizontally by ${scrolled}px.`}}__name(scrollHorizontally,"scrollHorizontally");const domTree=__name((args={doHighlightElements:true,focusHighlightIndex:-1,viewportExpansion:0,debugMode:false,interactiveBlacklist:[],interactiveWhitelist:[],highlightOpacity:0.1,highlightLabelOpacity:0.5})=>{const{interactiveBlacklist,interactiveWhitelist,highlightOpacity,highlightLabelOpacity}=args;const{doHighlightElements,focusHighlightIndex,viewportExpansion,debugMode}=args;let highlightIndex=0;const extraData=new WeakMap;function addExtraData(element,data){if(!element||element.nodeType!==Node.ELEMENT_NODE)return;extraData.set(element,{...extraData.get(element),...data})}__name(addExtraData,"addExtraData");const DOM_CACHE={boundingRects:new WeakMap,clientRects:new WeakMap,computedStyles:new WeakMap,clearCache:__name(()=>{DOM_CACHE.boundingRects=new WeakMap;DOM_CACHE.clientRects=new WeakMap;DOM_CACHE.computedStyles=new WeakMap},"clearCache")};function getCachedBoundingRect(element){if(!element)return null;if(DOM_CACHE.boundingRects.has(element)){return DOM_CACHE.boundingRects.get(element)}const rect=element.getBoundingClientRect();if(rect){DOM_CACHE.boundingRects.set(element,rect)}return rect}__name(getCachedBoundingRect,"getCachedBoundingRect");function getCachedComputedStyle(element){if(!element)return null;if(DOM_CACHE.computedStyles.has(element)){return DOM_CACHE.computedStyles.get(element)}const style=window.getComputedStyle(element);if(style){DOM_CACHE.computedStyles.set(element,style)}return style}__name(getCachedComputedStyle,"getCachedComputedStyle");function getCachedClientRects(element){if(!element)return null;if(DOM_CACHE.clientRects.has(element)){return DOM_CACHE.clientRects.get(element)}const rects=element.getClientRects();if(rects){DOM_CACHE.clientRects.set(element,rects)}return rects}__name(getCachedClientRects,"getCachedClientRects");const DOM_HASH_MAP={};const ID={current:0};const HIGHLIGHT_CONTAINER_ID="playwright-highlight-container";function highlightElement(element,index,parentIframe=null){if(!element)return index;const overlays=[];let label=null;let labelWidth=20;let labelHeight=16;let cleanupFn=null;try{let container=document.getElementById(HIGHLIGHT_CONTAINER_ID);if(!container){container=document.createElement("div");container.id=HIGHLIGHT_CONTAINER_ID;container.style.position="fixed";container.style.pointerEvents="none";container.style.top="0";container.style.left="0";container.style.width="100%";container.style.height="100%";container.style.zIndex="2147483640";container.style.backgroundColor="transparent";document.body.appendChild(container)}const rects=element.getClientRects();if(!rects||rects.length===0)return index;const colors=["#FF0000","#00FF00","#0000FF","#FFA500","#800080","#008080","#FF69B4","#4B0082","#FF4500","#2E8B57","#DC143C","#4682B4"];const colorIndex=index%colors.length;let baseColor=colors[colorIndex];const backgroundColor=baseColor+Math.floor(highlightOpacity*255).toString(16).padStart(2,"0");baseColor=baseColor+Math.floor(highlightLabelOpacity*255).toString(16).padStart(2,"0");let iframeOffset={x:0,y:0};if(parentIframe){const iframeRect=parentIframe.getBoundingClientRect();iframeOffset.x=iframeRect.left;iframeOffset.y=iframeRect.top}const fragment=document.createDocumentFragment();for(const rect of rects){if(rect.width===0||rect.height===0)continue;const overlay=document.createElement("div");overlay.style.position="fixed";overlay.style.border=`2px solid ${baseColor}`;overlay.style.backgroundColor=backgroundColor;overlay.style.pointerEvents="none";overlay.style.boxSizing="border-box";const top=rect.top+iframeOffset.y;const left=rect.left+iframeOffset.x;overlay.style.top=`${top}px`;overlay.style.left=`${left}px`;overlay.style.width=`${rect.width}px`;overlay.style.height=`${rect.height}px`;fragment.appendChild(overlay);overlays.push({element:overlay,initialRect:rect})}const firstRect=rects[0];label=document.createElement("div");label.className="playwright-highlight-label";label.style.position="fixed";label.style.background=baseColor;label.style.color="white";label.style.padding="1px 4px";label.style.borderRadius="4px";label.style.fontSize=`${Math.min(12,Math.max(8,firstRect.height/2))}px`;label.textContent=index.toString();labelWidth=label.offsetWidth>0?label.offsetWidth:labelWidth;labelHeight=label.offsetHeight>0?label.offsetHeight:labelHeight;const firstRectTop=firstRect.top+iframeOffset.y;const firstRectLeft=firstRect.left+iframeOffset.x;let labelTop=firstRectTop+2;let labelLeft=firstRectLeft+firstRect.width-labelWidth-2;if(firstRect.width<labelWidth+4||firstRect.height<labelHeight+4){labelTop=firstRectTop-labelHeight-2;labelLeft=firstRectLeft+firstRect.width-labelWidth;if(labelLeft<iframeOffset.x)labelLeft=firstRectLeft}labelTop=Math.max(0,Math.min(labelTop,window.innerHeight-labelHeight));labelLeft=Math.max(0,Math.min(labelLeft,window.innerWidth-labelWidth));label.style.top=`${labelTop}px`;label.style.left=`${labelLeft}px`;fragment.appendChild(label);const updatePositions=__name(()=>{const newRects=element.getClientRects();let newIframeOffset={x:0,y:0};if(parentIframe){const iframeRect=parentIframe.getBoundingClientRect();newIframeOffset.x=iframeRect.left;newIframeOffset.y=iframeRect.top}overlays.forEach((overlayData,i)=>{if(i<newRects.length){const newRect=newRects[i];const newTop=newRect.top+newIframeOffset.y;const newLeft=newRect.left+newIframeOffset.x;overlayData.element.style.top=`${newTop}px`;overlayData.element.style.left=`${newLeft}px`;overlayData.element.style.width=`${newRect.width}px`;overlayData.element.style.height=`${newRect.height}px`;overlayData.element.style.display=newRect.width===0||newRect.height===0?"none":"block"}else{overlayData.element.style.display="none"}});if(newRects.length<overlays.length){for(let i=newRects.length;i<overlays.length;i++){overlays[i].element.style.display="none"}}if(label&&newRects.length>0){const firstNewRect=newRects[0];const firstNewRectTop=firstNewRect.top+newIframeOffset.y;const firstNewRectLeft=firstNewRect.left+newIframeOffset.x;let newLabelTop=firstNewRectTop+2;let newLabelLeft=firstNewRectLeft+firstNewRect.width-labelWidth-2;if(firstNewRect.width<labelWidth+4||firstNewRect.height<labelHeight+4){newLabelTop=firstNewRectTop-labelHeight-2;newLabelLeft=firstNewRectLeft+firstNewRect.width-labelWidth;if(newLabelLeft<newIframeOffset.x)newLabelLeft=firstNewRectLeft}newLabelTop=Math.max(0,Math.min(newLabelTop,window.innerHeight-labelHeight));newLabelLeft=Math.max(0,Math.min(newLabelLeft,window.innerWidth-labelWidth));label.style.top=`${newLabelTop}px`;label.style.left=`${newLabelLeft}px`;label.style.display="block"}else if(label){label.style.display="none"}},"updatePositions");const throttleFunction=__name((func,delay)=>{let lastCall=0;return(...args2)=>{const now=performance.now();if(now-lastCall<delay)return;lastCall=now;return func(...args2)}},"throttleFunction");const throttledUpdatePositions=throttleFunction(updatePositions,16);window.addEventListener("scroll",throttledUpdatePositions,true);window.addEventListener("resize",throttledUpdatePositions);cleanupFn=__name(()=>{window.removeEventListener("scroll",throttledUpdatePositions,true);window.removeEventListener("resize",throttledUpdatePositions);overlays.forEach((overlay)=>overlay.element.remove());if(label)label.remove()},"cleanupFn");container.appendChild(fragment);return index+1}finally{if(cleanupFn){(window._highlightCleanupFunctions=window._highlightCleanupFunctions||[]).push(cleanupFn)}}}__name(highlightElement,"highlightElement");function isScrollableElement(element){if(!element||element.nodeType!==Node.ELEMENT_NODE){return null}const style=getCachedComputedStyle(element);if(!style)return null;const display=style.display;if(display==="inline"||display==="inline-block"){return null}const overflowX=style.overflowX;const overflowY=style.overflowY;const scrollableX=overflowX==="auto"||overflowX==="scroll";const scrollableY=overflowY==="auto"||overflowY==="scroll";if(!scrollableX&&!scrollableY){return null}const scrollWidth=element.scrollWidth-element.clientWidth;const scrollHeight=element.scrollHeight-element.clientHeight;const threshold=4;if(scrollWidth<threshold&&scrollHeight<threshold){return null}if(!scrollableY&&scrollWidth<threshold){return null}if(!scrollableX&&scrollHeight<threshold){return null}const distanceToTop=element.scrollTop;const distanceToLeft=element.scrollLeft;const distanceToRight=element.scrollWidth-element.clientWidth-element.scrollLeft;const distanceToBottom=element.scrollHeight-element.clientHeight-element.scrollTop;const scrollData={top:distanceToTop,right:distanceToRight,bottom:distanceToBottom,left:distanceToLeft};addExtraData(element,{scrollable:true,scrollData});return scrollData}__name(isScrollableElement,"isScrollableElement");function isTextNodeVisible(textNode){try{if(viewportExpansion===-1){const parentElement2=textNode.parentElement;if(!parentElement2)return false;try{return parentElement2.checkVisibility({checkOpacity:true,checkVisibilityCSS:true})}catch(e){const style=window.getComputedStyle(parentElement2);return style.display!=="none"&&style.visibility!=="hidden"&&style.opacity!=="0"}}const range=document.createRange();range.selectNodeContents(textNode);const rects=range.getClientRects();if(!rects||rects.length===0){return false}let isAnyRectVisible=false;let isAnyRectInViewport=false;for(const rect of rects){if(rect.width>0&&rect.height>0){isAnyRectVisible=true;if(!(rect.bottom<-viewportExpansion||rect.top>window.innerHeight+viewportExpansion||rect.right<-viewportExpansion||rect.left>window.innerWidth+viewportExpansion)){isAnyRectInViewport=true;break}}}if(!isAnyRectVisible||!isAnyRectInViewport){return false}const parentElement=textNode.parentElement;if(!parentElement)return false;try{return parentElement.checkVisibility({checkOpacity:true,checkVisibilityCSS:true})}catch(e){const style=window.getComputedStyle(parentElement);return style.display!=="none"&&style.visibility!=="hidden"&&style.opacity!=="0"}}catch(e){console.warn("Error checking text node visibility:",e);return false}}__name(isTextNodeVisible,"isTextNodeVisible");function isElementAccepted(element){if(!element||!element.tagName)return false;const alwaysAccept=new Set(["body","div","main","article","section","nav","header","footer"]);const tagName=element.tagName.toLowerCase();if(alwaysAccept.has(tagName))return true;const leafElementDenyList=new Set(["svg","script","style","link","meta","noscript","template"]);return!leafElementDenyList.has(tagName)}__name(isElementAccepted,"isElementAccepted");function isElementVisible(element){const style=getCachedComputedStyle(element);return element.offsetWidth>0&&element.offsetHeight>0&&style?.visibility!=="hidden"&&style?.display!=="none"}__name(isElementVisible,"isElementVisible");function isInteractiveElement(element){if(!element||element.nodeType!==Node.ELEMENT_NODE){return false}if(interactiveBlacklist.includes(element)){return false}if(interactiveWhitelist.includes(element)){return true}const tagName=element.tagName.toLowerCase();const style=getCachedComputedStyle(element);const interactiveCursors=new Set(["pointer","move","text","grab","grabbing","cell","copy","alias","all-scroll","col-resize","context-menu","crosshair","e-resize","ew-resize","help","n-resize","ne-resize","nesw-resize","ns-resize","nw-resize","nwse-resize","row-resize","s-resize","se-resize","sw-resize","vertical-text","w-resize","zoom-in","zoom-out"]);const nonInteractiveCursors=new Set(["not-allowed","no-drop","wait","progress","initial","inherit"]);function doesElementHaveInteractivePointer(element2){if(element2.tagName.toLowerCase()==="html")return false;if(style?.cursor&&interactiveCursors.has(style.cursor))return true;return false}__name(doesElementHaveInteractivePointer,"doesElementHaveInteractivePointer");let isInteractiveCursor=doesElementHaveInteractivePointer(element);if(isInteractiveCursor){return true}const interactiveElements=new Set(["a","button","input","select","textarea","details","summary","label","option","optgroup","fieldset","legend"]);const explicitDisableTags=new Set(["disabled","readonly"]);if(interactiveElements.has(tagName)){if(style?.cursor&&nonInteractiveCursors.has(style.cursor)){return false}for(const disableTag of explicitDisableTags){if(element.hasAttribute(disableTag)||element.getAttribute(disableTag)==="true"||element.getAttribute(disableTag)===""){return false}}if(element.disabled){return false}if(element.readOnly){return false}if(element.inert){return false}return true}const role=element.getAttribute("role");const ariaRole=element.getAttribute("aria-role");if(element.getAttribute("contenteditable")==="true"||element.isContentEditable){return true}if(element.classList&&(element.classList.contains("button")||element.classList.contains("dropdown-toggle")||element.getAttribute("data-index")||element.getAttribute("data-toggle")==="dropdown"||element.getAttribute("aria-haspopup")==="true")){return true}const interactiveRoles=new Set(["button","menu","menubar","menuitem","menuitemradio","menuitemcheckbox","radio","checkbox","tab","switch","slider","spinbutton","combobox","searchbox","textbox","listbox","option","scrollbar"]);const hasInteractiveRole=interactiveElements.has(tagName)||role&&interactiveRoles.has(role)||ariaRole&&interactiveRoles.has(ariaRole);if(hasInteractiveRole)return true;try{if(typeof getEventListeners==="function"){const listeners=getEventListeners(element);const mouseEvents=["click","mousedown","mouseup","dblclick"];for(const eventType of mouseEvents){if(listeners[eventType]&&listeners[eventType].length>0){return true}}}const getEventListenersForNode=element?.ownerDocument?.defaultView?.getEventListenersForNode||window.getEventListenersForNode;if(typeof getEventListenersForNode==="function"){const listeners=getEventListenersForNode(element);const interactionEvents=["click","mousedown","mouseup","keydown","keyup","submit","change","input","focus","blur"];for(const eventType of interactionEvents){for(const listener of listeners){if(listener.type===eventType){return true}}}}const commonMouseAttrs=["onclick","onmousedown","onmouseup","ondblclick"];for(const attr of commonMouseAttrs){if(element.hasAttribute(attr)||typeof element[attr]==="function"){return true}}}catch(e){}if(isScrollableElement(element)){return true}return false}__name(isInteractiveElement,"isInteractiveElement");function isTopElement(element){if(viewportExpansion===-1){return true}const rects=getCachedClientRects(element);if(!rects||rects.length===0){return false}let isAnyRectInViewport=false;for(const rect2 of rects){if(rect2.width>0&&rect2.height>0&&!(rect2.bottom<-viewportExpansion||rect2.top>window.innerHeight+viewportExpansion||rect2.right<-viewportExpansion||rect2.left>window.innerWidth+viewportExpansion)){isAnyRectInViewport=true;break}}if(!isAnyRectInViewport){return false}let doc=element.ownerDocument;if(doc!==window.document){return true}let rect=Array.from(rects).find((r)=>r.width>0&&r.height>0);if(!rect){return false}const shadowRoot=element.getRootNode();if(shadowRoot instanceof ShadowRoot){const centerX=rect.left+rect.width/2;const centerY=rect.top+rect.height/2;try{const topEl=shadowRoot.elementFromPoint(centerX,centerY);if(!topEl)return false;let current=topEl;while(current&&current!==shadowRoot){if(current===element)return true;current=current.parentElement}return false}catch(e){return true}}const margin=5;const checkPoints=[{x:rect.left+rect.width/2,y:rect.top+rect.height/2},{x:rect.left+margin,y:rect.top+margin},{x:rect.right-margin,y:rect.bottom-margin}];return checkPoints.some(({x,y})=>{try{const topEl=document.elementFromPoint(x,y);if(!topEl)return false;let current=topEl;while(current&&current!==document.documentElement){if(current===element)return true;current=current.parentElement}return false}catch(e){return true}})}__name(isTopElement,"isTopElement");function isInExpandedViewport(element,viewportExpansion2){if(viewportExpansion2===-1){return true}const rects=element.getClientRects();if(!rects||rects.length===0){const boundingRect=getCachedBoundingRect(element);if(!boundingRect||boundingRect.width===0||boundingRect.height===0){return false}return!(boundingRect.bottom<-viewportExpansion2||boundingRect.top>window.innerHeight+viewportExpansion2||boundingRect.right<-viewportExpansion2||boundingRect.left>window.innerWidth+viewportExpansion2)}for(const rect of rects){if(rect.width===0||rect.height===0)continue;if(!(rect.bottom<-viewportExpansion2||rect.top>window.innerHeight+viewportExpansion2||rect.right<-viewportExpansion2||rect.left>window.innerWidth+viewportExpansion2)){return true}}return false}__name(isInExpandedViewport,"isInExpandedViewport");function isInteractiveCandidate(element){if(!element||element.nodeType!==Node.ELEMENT_NODE)return false;const tagName=element.tagName.toLowerCase();const interactiveElements=new Set(["a","button","input","select","textarea","details","summary","label"]);if(interactiveElements.has(tagName))return true;const hasQuickInteractiveAttr=element.hasAttribute("onclick")||element.hasAttribute("role")||element.hasAttribute("tabindex")||element.hasAttribute("aria-")||element.hasAttribute("data-action")||element.getAttribute("contenteditable")==="true";return hasQuickInteractiveAttr}__name(isInteractiveCandidate,"isInteractiveCandidate");const DISTINCT_INTERACTIVE_TAGS=new Set(["a","button","input","select","textarea","summary","details","label","option"]);const INTERACTIVE_ROLES=new Set(["button","link","menuitem","menuitemradio","menuitemcheckbox","radio","checkbox","tab","switch","slider","spinbutton","combobox","searchbox","textbox","listbox","option","scrollbar"]);function isHeuristicallyInteractive(element){if(!element||element.nodeType!==Node.ELEMENT_NODE)return false;if(!isElementVisible(element))return false;const hasInteractiveAttributes=element.hasAttribute("role")||element.hasAttribute("tabindex")||element.hasAttribute("onclick")||typeof element.onclick==="function";const hasInteractiveClass=/\\b(btn|clickable|menu|item|entry|link)\\b/i.test(element.className||"");const isInKnownContainer=Boolean(element.closest(\'button,a,[role="button"],.menu,.dropdown,.list,.toolbar\'));const hasVisibleChildren=[...element.children].some(isElementVisible);const isParentBody=element.parentElement&&element.parentElement.isSameNode(document.body);return(isInteractiveElement(element)||hasInteractiveAttributes||hasInteractiveClass)&&hasVisibleChildren&&isInKnownContainer&&!isParentBody}__name(isHeuristicallyInteractive,"isHeuristicallyInteractive");function isElementDistinctInteraction(element){if(!element||element.nodeType!==Node.ELEMENT_NODE){return false}const tagName=element.tagName.toLowerCase();const role=element.getAttribute("role");if(tagName==="iframe"){return true}if(DISTINCT_INTERACTIVE_TAGS.has(tagName)){return true}if(role&&INTERACTIVE_ROLES.has(role)){return true}if(element.isContentEditable||element.getAttribute("contenteditable")==="true"){return true}if(element.hasAttribute("data-testid")||element.hasAttribute("data-cy")||element.hasAttribute("data-test")){return true}if(element.hasAttribute("onclick")||typeof element.onclick==="function"){return true}try{const getEventListenersForNode=element?.ownerDocument?.defaultView?.getEventListenersForNode||window.getEventListenersForNode;if(typeof getEventListenersForNode==="function"){const listeners=getEventListenersForNode(element);const interactionEvents=["click","mousedown","mouseup","keydown","keyup","submit","change","input","focus","blur"];for(const eventType of interactionEvents){for(const listener of listeners){if(listener.type===eventType){return true}}}}const commonEventAttrs=["onmousedown","onmouseup","onkeydown","onkeyup","onsubmit","onchange","oninput","onfocus","onblur"];if(commonEventAttrs.some((attr)=>element.hasAttribute(attr))){return true}}catch(e){}if(isHeuristicallyInteractive(element)){return true}return false}__name(isElementDistinctInteraction,"isElementDistinctInteraction");function handleHighlighting(nodeData,node,parentIframe,isParentHighlighted){if(!nodeData.isInteractive)return false;let shouldHighlight=false;if(!isParentHighlighted){shouldHighlight=true}else{if(isElementDistinctInteraction(node)){shouldHighlight=true}else{shouldHighlight=false}}if(shouldHighlight){nodeData.isInViewport=isInExpandedViewport(node,viewportExpansion);if(nodeData.isInViewport||viewportExpansion===-1){nodeData.highlightIndex=highlightIndex++;if(doHighlightElements){if(focusHighlightIndex>=0){if(focusHighlightIndex===nodeData.highlightIndex){highlightElement(node,nodeData.highlightIndex,parentIframe)}}else{highlightElement(node,nodeData.highlightIndex,parentIframe)}return true}}}return false}__name(handleHighlighting,"handleHighlighting");function buildDomTree(node,parentIframe=null,isParentHighlighted=false){if(!node||node.id===HIGHLIGHT_CONTAINER_ID||node.nodeType!==Node.ELEMENT_NODE&&node.nodeType!==Node.TEXT_NODE){return null}if(!node||node.id===HIGHLIGHT_CONTAINER_ID){return null}if(node.dataset?.browserUseIgnore==="true"||node.dataset?.pageAgentIgnore==="true"){return null}if(node.getAttribute&&node.getAttribute("aria-hidden")==="true"){return null}if(node===document.body){const nodeData2={tagName:"body",attributes:{},xpath:"/body",children:[]};for(const child of node.childNodes){const domElement=buildDomTree(child,parentIframe,false);if(domElement)nodeData2.children.push(domElement)}const id2=`${ID.current++}`;DOM_HASH_MAP[id2]=nodeData2;return id2}if(node.nodeType!==Node.ELEMENT_NODE&&node.nodeType!==Node.TEXT_NODE){return null}if(node.nodeType===Node.TEXT_NODE){const textContent=node.textContent?.trim();if(!textContent){return null}const parentElement=node.parentElement;if(!parentElement||parentElement.tagName.toLowerCase()==="script"){return null}const id2=`${ID.current++}`;DOM_HASH_MAP[id2]={type:"TEXT_NODE",text:textContent,isVisible:isTextNodeVisible(node)};return id2}if(node.nodeType===Node.ELEMENT_NODE&&!isElementAccepted(node)){return null}if(viewportExpansion!==-1&&!node.shadowRoot){const rect=getCachedBoundingRect(node);const style=getCachedComputedStyle(node);const isFixedOrSticky=style&&(style.position==="fixed"||style.position==="sticky");const hasSize=node.offsetWidth>0||node.offsetHeight>0;if(!rect||!isFixedOrSticky&&!hasSize&&(rect.bottom<-viewportExpansion||rect.top>window.innerHeight+viewportExpansion||rect.right<-viewportExpansion||rect.left>window.innerWidth+viewportExpansion)){return null}}const nodeData={tagName:node.tagName.toLowerCase(),attributes:{},children:[]};if(isInteractiveCandidate(node)||node.tagName.toLowerCase()==="iframe"||node.tagName.toLowerCase()==="body"){const attributeNames=node.getAttributeNames?.()||[];for(const name of attributeNames){const value=node.getAttribute(name);nodeData.attributes[name]=value}if(node.tagName.toLowerCase()==="input"&&(node.type==="checkbox"||node.type==="radio")){nodeData.attributes.checked=node.checked?"true":"false"}}let nodeWasHighlighted=false;if(node.nodeType===Node.ELEMENT_NODE){nodeData.isVisible=isElementVisible(node);if(nodeData.isVisible){nodeData.isTopElement=isTopElement(node);const role=node.getAttribute("role");const isMenuContainer=role==="menu"||role==="menubar"||role==="listbox";if(nodeData.isTopElement||isMenuContainer){nodeData.isInteractive=isInteractiveElement(node);nodeWasHighlighted=handleHighlighting(nodeData,node,parentIframe,isParentHighlighted);nodeData.ref=node;if(nodeData.isInteractive&&Object.keys(nodeData.attributes).length===0){const attributeNames=node.getAttributeNames?.()||[];for(const name of attributeNames){const value=node.getAttribute(name);nodeData.attributes[name]=value}}}}}if(node.tagName){const tagName=node.tagName.toLowerCase();if(tagName==="iframe"){try{const iframeDoc=node.contentDocument||node.contentWindow?.document;if(iframeDoc){for(const child of iframeDoc.childNodes){const domElement=buildDomTree(child,node,false);if(domElement)nodeData.children.push(domElement)}}}catch(e){console.warn("Unable to access iframe:",e)}}else if(node.isContentEditable||node.getAttribute("contenteditable")==="true"||node.id==="tinymce"||node.classList.contains("mce-content-body")||tagName==="body"&&node.getAttribute("data-id")?.startsWith("mce_")){for(const child of node.childNodes){const domElement=buildDomTree(child,parentIframe,nodeWasHighlighted);if(domElement)nodeData.children.push(domElement)}}else{if(node.shadowRoot){nodeData.shadowRoot=true;for(const child of node.shadowRoot.childNodes){const domElement=buildDomTree(child,parentIframe,nodeWasHighlighted);if(domElement)nodeData.children.push(domElement)}}for(const child of node.childNodes){const passHighlightStatusToChild=nodeWasHighlighted||isParentHighlighted;const domElement=buildDomTree(child,parentIframe,passHighlightStatusToChild);if(domElement)nodeData.children.push(domElement)}}}if(nodeData.tagName==="a"&&nodeData.children.length===0&&!nodeData.attributes.href){const rect=getCachedBoundingRect(node);const hasSize=rect&&rect.width>0&&rect.height>0||node.offsetWidth>0||node.offsetHeight>0;if(!hasSize){return null}}nodeData.extra=extraData.get(node)||null;const id=`${ID.current++}`;DOM_HASH_MAP[id]=nodeData;return id}__name(buildDomTree,"buildDomTree");const rootId=buildDomTree(document.body);DOM_CACHE.clearCache();return{rootId,map:DOM_HASH_MAP}},"domTree");const DEFAULT_VIEWPORT_EXPANSION=-1;function resolveViewportExpansion(viewportExpansion){return viewportExpansion??DEFAULT_VIEWPORT_EXPANSION}__name(resolveViewportExpansion,"resolveViewportExpansion");const newElementsCache=new WeakMap;function getFlatTree(config){const viewportExpansion=resolveViewportExpansion(config.viewportExpansion);const interactiveBlacklist=[];for(const item of config.interactiveBlacklist||[]){if(typeof item==="function"){interactiveBlacklist.push(item())}else{interactiveBlacklist.push(item)}}const interactiveWhitelist=[];for(const item of config.interactiveWhitelist||[]){if(typeof item==="function"){interactiveWhitelist.push(item())}else{interactiveWhitelist.push(item)}}const elements=domTree({doHighlightElements:true,debugMode:true,focusHighlightIndex:-1,viewportExpansion,interactiveBlacklist,interactiveWhitelist,highlightOpacity:config.highlightOpacity??0,highlightLabelOpacity:config.highlightLabelOpacity??0.1});const currentUrl=window.location.href;for(const nodeId in elements.map){const node=elements.map[nodeId];if(node.isInteractive&&node.ref){const ref=node.ref;if(!newElementsCache.has(ref)){newElementsCache.set(ref,currentUrl);node.isNew=true}}}return elements}__name(getFlatTree,"getFlatTree");const globRegexCache=new Map;function globToRegex(pattern){let regex=globRegexCache.get(pattern);if(!regex){const escaped=pattern.replace(/[.+^${}()|[\\]\\\\]/g,"\\\\$&");regex=new RegExp(`^${escaped.replace(/\\*/g,".*")}$`);globRegexCache.set(pattern,regex)}return regex}__name(globToRegex,"globToRegex");function matchAttributes(attrs,patterns){const result2={};for(const pattern of patterns){if(pattern.includes("*")){const regex=globToRegex(pattern);for(const key of Object.keys(attrs)){if(regex.test(key)&&attrs[key].trim()){result2[key]=attrs[key].trim()}}}else{const value=attrs[pattern];if(value&&value.trim()){result2[pattern]=value.trim()}}}return result2}__name(matchAttributes,"matchAttributes");function flatTreeToString(flatTree,includeAttributes){const DEFAULT_INCLUDE_ATTRIBUTES=["title","type","checked","name","role","value","placeholder","data-date-format","alt","aria-label","aria-expanded","data-state","aria-checked","id","for","target","aria-haspopup","aria-controls","aria-owns","contenteditable"];const includeAttrs=[...includeAttributes||[],...DEFAULT_INCLUDE_ATTRIBUTES];const capTextLength=__name((text,maxLength)=>{if(text.length>maxLength){return text.substring(0,maxLength)+"..."}return text},"capTextLength");const buildTreeNode=__name((nodeId)=>{const node=flatTree.map[nodeId];if(!node)return null;if(node.type==="TEXT_NODE"){const textNode=node;return{type:"text",text:textNode.text,isVisible:textNode.isVisible,parent:null,children:[]}}else{const elementNode=node;const children=[];if(elementNode.children){for(const childId of elementNode.children){const child=buildTreeNode(childId);if(child){child.parent=null;children.push(child)}}}return{type:"element",tagName:elementNode.tagName,attributes:elementNode.attributes??{},isVisible:elementNode.isVisible??false,isInteractive:elementNode.isInteractive??false,isTopElement:elementNode.isTopElement??false,isNew:elementNode.isNew??false,highlightIndex:elementNode.highlightIndex,parent:null,children,extra:elementNode.extra??{}}}},"buildTreeNode");const setParentReferences=__name((node,parent=null)=>{node.parent=parent;for(const child of node.children){setParentReferences(child,node)}},"setParentReferences");const rootNode=buildTreeNode(flatTree.rootId);if(!rootNode)return"";setParentReferences(rootNode);const hasParentWithHighlightIndex=__name((node)=>{let current=node.parent;while(current){if(current.type==="element"&&current.highlightIndex!==undefined){return true}current=current.parent}return false},"hasParentWithHighlightIndex");const processNode=__name((node,depth,result22)=>{let nextDepth=depth;const depthStr="\\t".repeat(depth);if(node.type==="element"){if(node.highlightIndex!==undefined){nextDepth+=1;const text=getAllTextTillNextClickableElement(node);let attributesHtmlStr="";if(includeAttrs.length>0&&node.attributes){const attributesToInclude=matchAttributes(node.attributes,includeAttrs);const keys=Object.keys(attributesToInclude);if(keys.length>1){const keysToRemove=new Set;const seenValues={};for(const key of keys){const value=attributesToInclude[key];if(value.length>5){if(value in seenValues){keysToRemove.add(key)}else{seenValues[value]=key}}}for(const key of keysToRemove){delete attributesToInclude[key]}}if(attributesToInclude.role===node.tagName){delete attributesToInclude.role}const attrsToRemoveIfTextMatches=["aria-label","placeholder","title"];for(const attr of attrsToRemoveIfTextMatches){if(attributesToInclude[attr]&&attributesToInclude[attr].toLowerCase().trim()===text.toLowerCase().trim()){delete attributesToInclude[attr]}}if(Object.keys(attributesToInclude).length>0){attributesHtmlStr=Object.entries(attributesToInclude).map(([key,value])=>`${key}=${capTextLength(value,20)}`).join(" ")}}const highlightIndicator=node.isNew?`*[${node.highlightIndex}]`:`[${node.highlightIndex}]`;let line=`${depthStr}${highlightIndicator}<${node.tagName??""}`;if(attributesHtmlStr){line+=` ${attributesHtmlStr}`}if(node.extra){if(node.extra.scrollable){let scrollDataText="";if(node.extra.scrollData?.left)scrollDataText+=`left=${node.extra.scrollData.left}, `;if(node.extra.scrollData?.top)scrollDataText+=`top=${node.extra.scrollData.top}, `;if(node.extra.scrollData?.right)scrollDataText+=`right=${node.extra.scrollData.right}, `;if(node.extra.scrollData?.bottom)scrollDataText+=`bottom=${node.extra.scrollData.bottom}`;line+=` data-scrollable="${scrollDataText}"`}}if(text){const trimmedText=text.trim();if(!attributesHtmlStr){line+=" "}line+=`>${trimmedText}`}else if(!attributesHtmlStr){line+=" "}line+=" />";result22.push(line)}for(const child of node.children){processNode(child,nextDepth,result22)}}else if(node.type==="text"){if(hasParentWithHighlightIndex(node)){return}if(node.parent&&node.parent.type==="element"&&node.parent.isVisible&&node.parent.isTopElement){result22.push(`${depthStr}${node.text??""}`)}}},"processNode");const result2=[];processNode(rootNode,0,result2);return result2.join(`\n`)}__name(flatTreeToString,"flatTreeToString");const getAllTextTillNextClickableElement=__name((node,maxDepth=-1)=>{const textParts=[];const collectText=__name((currentNode,currentDepth)=>{if(maxDepth!==-1&&currentDepth>maxDepth){return}if(currentNode.type==="element"&&currentNode!==node&&currentNode.highlightIndex!==undefined){return}if(currentNode.type==="text"&&currentNode.text){textParts.push(currentNode.text)}else if(currentNode.type==="element"){for(const child of currentNode.children){collectText(child,currentDepth+1)}}},"collectText");collectText(node,0);return textParts.join(`\n`).trim()},"getAllTextTillNextClickableElement");function getSelectorMap(flatTree){const selectorMap=new Map;const keys=Object.keys(flatTree.map);for(const key of keys){const node=flatTree.map[key];if(node.isInteractive&&typeof node.highlightIndex==="number"){selectorMap.set(node.highlightIndex,node)}}return selectorMap}__name(getSelectorMap,"getSelectorMap");function getElementTextMap(simplifiedHTML){const lines=simplifiedHTML.split(`\n`).map((line)=>line.trim()).filter((line)=>line.length>0);const elementTextMap=new Map;for(const line of lines){const regex=/^\\[(\\d+)\\]<[^>]+>([^<]*)/;const match=regex.exec(line);if(match){const index=parseInt(match[1],10);elementTextMap.set(index,line)}}return elementTextMap}__name(getElementTextMap,"getElementTextMap");function cleanUpHighlights(){const cleanupFunctions=window._highlightCleanupFunctions||[];for(const cleanup of cleanupFunctions){if(typeof cleanup==="function"){cleanup()}}window._highlightCleanupFunctions=[]}__name(cleanUpHighlights,"cleanUpHighlights");window.addEventListener("popstate",()=>{cleanUpHighlights()});window.addEventListener("hashchange",()=>{cleanUpHighlights()});window.addEventListener("beforeunload",()=>{cleanUpHighlights()});const navigation=window.navigation;if(navigation&&typeof navigation.addEventListener==="function"){navigation.addEventListener("navigate",()=>{cleanUpHighlights()})}else{let currentUrl=window.location.href;setInterval(()=>{if(window.location.href!==currentUrl){currentUrl=window.location.href;cleanUpHighlights()}},500)}function getPageInfo(){const viewport_width=window.innerWidth;const viewport_height=window.innerHeight;const page_width=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth||0);const page_height=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight||0);const scroll_x=window.scrollX||window.pageXOffset||document.documentElement.scrollLeft||0;const scroll_y=window.scrollY||window.pageYOffset||document.documentElement.scrollTop||0;const pixels_below=Math.max(0,page_height-(window.innerHeight+scroll_y));const pixels_right=Math.max(0,page_width-(window.innerWidth+scroll_x));return{viewport_width,viewport_height,page_width,page_height,scroll_x,scroll_y,pixels_above:scroll_y,pixels_below,pages_above:viewport_height>0?scroll_y/viewport_height:0,pages_below:viewport_height>0?pixels_below/viewport_height:0,total_pages:viewport_height>0?page_height/viewport_height:0,current_page_position:scroll_y/Math.max(1,page_height-viewport_height),pixels_left:scroll_x,pixels_right}}__name(getPageInfo,"getPageInfo");function patchReact(pageController){const reactRootElements=document.querySelectorAll(\'[data-reactroot], [data-reactid], [data-react-checksum], #root, #app, [id^="root-"], [id^="app-"], #adex-wrapper, #adex-root\');for(const element of reactRootElements){element.setAttribute("data-page-agent-not-interactive","true")}}__name(patchReact,"patchReact");const _PageController=class _PageController extends EventTarget{config;flatTree=null;selectorMap=new Map;elementTextMap=new Map;simplifiedHTML="<EMPTY>";lastTimeUpdate=0;isIndexed=false;mask=null;maskReady=null;constructor(config={}){super();this.config=config;patchReact();if(config.enableMask)this.initMask()}initMask(){if(this.maskReady!==null)return;this.maskReady=(async()=>{var SimulatorMask = window.__LiteMask;this.mask=new SimulatorMask})()}async getCurrentUrl(){return window.location.href}async getLastUpdateTime(){return this.lastTimeUpdate}async getBrowserState(){const url=window.location.href;const title=document.title;const pi=getPageInfo();const viewportExpansion=resolveViewportExpansion(this.config.viewportExpansion);await this.updateTree();const content=this.simplifiedHTML;const titleLine=`Current Page: [${title}](${url})`;const pageInfoLine=`Page info: ${pi.viewport_width}x${pi.viewport_height}px viewport, ${pi.page_width}x${pi.page_height}px total page size, ${pi.pages_above.toFixed(1)} pages above, ${pi.pages_below.toFixed(1)} pages below, ${pi.total_pages.toFixed(1)} total pages, at ${(pi.current_page_position*100).toFixed(0)}% of page`;const elementsLabel=viewportExpansion===-1?"Interactive elements from top layer of the current page (full page):":"Interactive elements from top layer of the current page inside the viewport:";const hasContentAbove=pi.pixels_above>4;const scrollHintAbove=hasContentAbove&&viewportExpansion!==-1?`... ${pi.pixels_above} pixels above (${pi.pages_above.toFixed(1)} pages) - scroll to see more ...`:"[Start of page]";const header=`${titleLine}\n${pageInfoLine}\n\n${elementsLabel}\n\n${scrollHintAbove}`;const hasContentBelow=pi.pixels_below>4;const footer=hasContentBelow&&viewportExpansion!==-1?`... ${pi.pixels_below} pixels below (${pi.pages_below.toFixed(1)} pages) - scroll to see more ...`:"[End of page]";return{url,title,header,content,footer}}async updateTree(){this.dispatchEvent(new Event("beforeUpdate"));this.lastTimeUpdate=Date.now();if(this.mask){this.mask.wrapper.style.pointerEvents="none"}cleanUpHighlights();const blacklist=[...this.config.interactiveBlacklist||[],...document.querySelectorAll("[data-page-agent-not-interactive]").values()];this.flatTree=getFlatTree({...this.config,interactiveBlacklist:blacklist});this.simplifiedHTML=flatTreeToString(this.flatTree,this.config.includeAttributes);this.selectorMap.clear();this.selectorMap=getSelectorMap(this.flatTree);this.elementTextMap.clear();this.elementTextMap=getElementTextMap(this.simplifiedHTML);this.isIndexed=true;if(this.mask){this.mask.wrapper.style.pointerEvents="auto"}this.dispatchEvent(new Event("afterUpdate"));return this.simplifiedHTML}async cleanUpHighlights(){cleanUpHighlights()}assertIndexed(){if(!this.isIndexed){throw new Error("DOM tree not indexed yet. Can not perform actions on elements.")}}async clickElement(index){try{this.assertIndexed();const element=getElementByIndex(this.selectorMap,index);const elemText=this.elementTextMap.get(index);await clickElement(element);if(isAnchorElement(element)&&element.target==="_blank"){return{success:true,message:`✅ Clicked element (${elemText??index}). ⚠️ Link opened in a new tab.`}}return{success:true,message:`✅ Clicked element (${elemText??index}).`}}catch(error){return{success:false,message:`❌ Failed to click element: ${error}`}}}async inputText(index,text){try{this.assertIndexed();const element=getElementByIndex(this.selectorMap,index);const elemText=this.elementTextMap.get(index);await inputTextElement(element,text);return{success:true,message:`✅ Input text (${text}) into element (${elemText??index}).`}}catch(error){return{success:false,message:`❌ Failed to input text: ${error}`}}}async selectOption(index,optionText){try{this.assertIndexed();const element=getElementByIndex(this.selectorMap,index);const elemText=this.elementTextMap.get(index);await selectOptionElement(element,optionText);return{success:true,message:`✅ Selected option (${optionText}) in element (${elemText??index}).`}}catch(error){return{success:false,message:`❌ Failed to select option: ${error}`}}}async scroll(options){try{const{down,numPages,pixels,index}=options;this.assertIndexed();const scrollAmount=pixels??numPages*(down?1:-1)*window.innerHeight;const element=index!==undefined?getElementByIndex(this.selectorMap,index):null;const message=await scrollVertically(down,scrollAmount,element);return{success:true,message}}catch(error){return{success:false,message:`❌ Failed to scroll: ${error}`}}}async scrollHorizontally(options){try{const{right,pixels,index}=options;this.assertIndexed();const scrollAmount=pixels*(right?1:-1);const element=index!==undefined?getElementByIndex(this.selectorMap,index):null;const message=await scrollHorizontally(right,scrollAmount,element);return{success:true,message}}catch(error){return{success:false,message:`❌ Failed to scroll horizontally: ${error}`}}}async executeJavascript(script){try{const asyncFunction=eval(`(async () => { ${script} })`);const result=await asyncFunction();return{success:true,message:`✅ Executed JavaScript. Result: ${result}`}}catch(error){return{success:false,message:`❌ Error executing JavaScript: ${error}`}}}async showMask(){await this.maskReady;this.mask?.show()}async hideMask(){await this.maskReady;this.mask?.hide()}dispose(){cleanUpHighlights();this.flatTree=null;this.selectorMap.clear();this.elementTextMap.clear();this.simplifiedHTML="<EMPTY>";this.isIndexed=false;this.mask?.dispose();this.mask=null}};__name(_PageController,"PageController");let PageController=_PageController;window.__PageController=PageController})();\n})();\n\n// --- Signet Page Agent API ---\n(function(){\n var pc = new window.__PageController({ enableMask: false, highlightOpacity: 0, highlightLabelOpacity: 0 });\n \n window.signet = window.signet || {};\n window.signet.pageController = pc;\n \n window.signet.getDomState = async function(){\n try {\n var state = await pc.getBrowserState();\n return { success: true, state: state };\n } catch(e) {\n return { success: false, error: e.message || String(e) };\n }\n };\n \n window.signet.executeAction = async function(action){\n try {\n var result;\n switch(action.type){\n case \'click_element\':\n result = await pc.clickElement(action.index);\n break;\n case \'input_text\':\n result = await pc.inputText(action.index, action.text);\n break;\n case \'select_option\':\n result = await pc.selectOption(action.index, action.text);\n break;\n case \'scroll\':\n result = await pc.scroll({ down: action.direction === \'down\', numPages: action.amount || 1 });\n break;\n default:\n result = { success: false, message: \'Unknown action type: \' + action.type };\n }\n return result;\n } catch(e) {\n return { success: false, message: e.message || String(e) };\n }\n };\n \n window.signet.agentStart = async function(){\n pc.initMask();\n await pc.showMask();\n };\n \n window.signet.agentStop = async function(){\n await pc.hideMask();\n };\n})();',Yt=`
2
2
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
3
3
  html { font-family: 'Geist Mono', 'IBM Plex Mono', monospace; font-size: 13px; line-height: 1.5; color: var(--sig-text); background: var(--sig-bg); -webkit-font-smoothing: antialiased; }
4
4
  body { margin: 0; padding: 8px; min-height: 100%; }
@@ -1 +1 @@
1
- import{p as n,s as d,c,f as h,a as i,n as f,b as l,d as m,r as u}from"./Ddm7yfuh.js";import{I as $}from"./FL-YoeN8.js";function g(e,s){n(s,!0);let t=u(s,["$$slots","$$events","$$legacy"]);const r=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];$(e,d({name:"refresh-cw"},()=>t,{get iconNode(){return r},children:(o,v)=>{var a=c(),p=h(a);i(p,()=>s.children??f),l(o,a)},$$slots:{default:!0}})),m()}export{g as R};
1
+ import{p as n,s as d,c,f as h,a as i,n as f,b as l,d as m,r as u}from"./Ddm7yfuh.js";import{I as $}from"./CQjlljeJ.js";function g(e,s){n(s,!0);let t=u(s,["$$slots","$$events","$$legacy"]);const r=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];$(e,d({name:"refresh-cw"},()=>t,{get iconNode(){return r},children:(o,v)=>{var a=c(),p=h(a);i(p,()=>s.children??f),l(o,a)},$$slots:{default:!0}})),m()}export{g as R};
@@ -1,4 +1,4 @@
1
- import{p as wt,e as $t,c as Fe,f as M,g as T,ah as Jt,s as Ht,h as e,b as r,d as kt,r as Lt,u as V,Q as Ot,v,w as x,x as m,y as b,z as p,t as o,j as E,i as c,k as d,N as Bt,m as ve,A as Ge,l as f,E as Ut,a as Qt,n as Xt,F as Yt,$ as Zt,K as at,ai as er,aj as tr}from"./Ddm7yfuh.js";import{P as rr}from"./anLJSqtR.js";import{T as ar}from"./DOaCXx_K.js";import{c as Wt,$ as sr,a0 as or,a1 as nr,a2 as ir,B as Me,a3 as lr,a4 as dr,a5 as cr,a6 as vr,W as l,a7 as Ft,a8 as ft,A as qt,a9 as ur,aa as gr,ab as fr,n as Dt,ac as pr,h as mr,i as xr,ad as Rt,ae as _r,R as hr}from"./FL-YoeN8.js";import{I as st}from"./aFfrvvmo.js";import{L as Be}from"./CiTctn0M.js";import{T as Et}from"./BjsLiXh7.js";import{c as Vt,S as Kt,a as Gt,b as pt}from"./CWtK7wBm.js";import{S as jt}from"./aMuFYuii.js";import{B as Te}from"./BqqSu535.js";import{b as br,P as yr,a as $r}from"./DEdxwOeX.js";import{C as wr,a as kr}from"./BlLONMPI.js";import{a as Mt,C as Nt}from"./D4s3f2f1.js";import{C as zt}from"./Dhm8CqUW.js";function Pr(Je,_){wt(_,!0);let D=$t(_,"ref",15,null),be=$t(_,"data-slot",3,"separator"),B=Lt(_,["$$slots","$$events","$$legacy","ref","class","data-slot"]);var X=Fe(),ee=M(X);{let ke=V(()=>Wt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:min-h-full data-[orientation=vertical]:w-px",_.class));T(ee,()=>Jt,(se,oe)=>{oe(se,Ht({get"data-slot"(){return be()},get class(){return e(ke)}},()=>B,{get ref(){return D()},set ref(Ae){D(Ae)}}))})}r(Je,X),kt()}var Sr=f("<!> <!>",1),Ir=f("<!> <!> <!>",1),Cr=f("<!> <!>",1),Tr=f('<div class="flex flex-col gap-1"><!> <!></div>'),Ar=f('Reason for change <span class="text-[var(--sig-accent)]">*</span>',1),Dr=f('<div class="flex flex-col gap-1"><!> <!></div> <div class="grid grid-cols-2 gap-3"><div class="flex flex-col gap-1"><!> <!></div> <div class="flex flex-col gap-1"><!> <!></div></div> <!> <div class="flex flex-col gap-1"><!> <!></div> <div class="flex items-center justify-between"><!> <!></div> <div class="flex flex-col gap-1"><!> <!></div>',1),Er=f('<span class="px-1.5 py-px border border-[var(--sig-border-strong)]"> </span>'),Mr=f(`This memory is <strong>pinned</strong>. Deleting it requires
1
+ import{p as wt,e as $t,c as Fe,f as M,g as T,ah as Jt,s as Ht,h as e,b as r,d as kt,r as Lt,u as V,Q as Ot,v,w as x,x as m,y as b,z as p,t as o,j as E,i as c,k as d,N as Bt,m as ve,A as Ge,l as f,E as Ut,a as Qt,n as Xt,F as Yt,$ as Zt,K as at,ai as er,aj as tr}from"./Ddm7yfuh.js";import{P as rr}from"./anLJSqtR.js";import{T as ar}from"./DOaCXx_K.js";import{c as Wt,$ as sr,a0 as or,a1 as nr,a2 as ir,B as Me,a3 as lr,a4 as dr,a5 as cr,a6 as vr,W as l,a7 as Ft,a8 as ft,A as qt,a9 as ur,aa as gr,ab as fr,n as Dt,ac as pr,h as mr,i as xr,ad as Rt,ae as _r,R as hr}from"./CQjlljeJ.js";import{I as st}from"./BCteBoj0.js";import{L as Be}from"./FwPtkZZE.js";import{T as Et}from"./CwnhW_Rr.js";import{c as Vt,S as Kt,a as Gt,b as pt}from"./D9ZAYnCR.js";import{S as jt}from"./DK3Rbu4L.js";import{B as Te}from"./C8n6MUA5.js";import{b as br,P as yr,a as $r}from"./D43mjuJx.js";import{C as wr,a as kr}from"./DHvkPM9v.js";import{a as Mt,C as Nt}from"./CFGlMKB9.js";import{C as zt}from"./rjiWOQwm.js";function Pr(Je,_){wt(_,!0);let D=$t(_,"ref",15,null),be=$t(_,"data-slot",3,"separator"),B=Lt(_,["$$slots","$$events","$$legacy","ref","class","data-slot"]);var X=Fe(),ee=M(X);{let ke=V(()=>Wt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:min-h-full data-[orientation=vertical]:w-px",_.class));T(ee,()=>Jt,(se,oe)=>{oe(se,Ht({get"data-slot"(){return be()},get class(){return e(ke)}},()=>B,{get ref(){return D()},set ref(Ae){D(Ae)}}))})}r(Je,X),kt()}var Sr=f("<!> <!>",1),Ir=f("<!> <!> <!>",1),Cr=f("<!> <!>",1),Tr=f('<div class="flex flex-col gap-1"><!> <!></div>'),Ar=f('Reason for change <span class="text-[var(--sig-accent)]">*</span>',1),Dr=f('<div class="flex flex-col gap-1"><!> <!></div> <div class="grid grid-cols-2 gap-3"><div class="flex flex-col gap-1"><!> <!></div> <div class="flex flex-col gap-1"><!> <!></div></div> <!> <div class="flex flex-col gap-1"><!> <!></div> <div class="flex items-center justify-between"><!> <!></div> <div class="flex flex-col gap-1"><!> <!></div>',1),Er=f('<span class="px-1.5 py-px border border-[var(--sig-border-strong)]"> </span>'),Mr=f(`This memory is <strong>pinned</strong>. Deleting it requires
2
2
  force, which removes it permanently from search results.`,1),Nr=f('<div class="flex items-center gap-2"><!> <!></div>'),zr=f('Reason for deletion <span class="text-[var(--sig-accent)]">*</span>',1),Fr=f(`<div class="flex flex-col gap-2 p-3 border border-[var(--sig-border-strong)]
3
3
  bg-[var(--sig-surface-raised)]"><p class="m-0 text-[var(--sig-text-bright)] text-[11px]
4
4
  leading-[1.5] whitespace-pre-wrap break-words"> </p> <div class="flex flex-wrap gap-1 text-[9px]
@@ -1 +1 @@
1
- import{p as n,e as o,E as d,i as c,a as f,n as p,k as m,F as v,b as h,d as u,r as _,l as b}from"./Ddm7yfuh.js";import{c as g}from"./FL-YoeN8.js";var C=b("<div><!></div>");function y(r,a){n(a,!0);let t=o(a,"ref",15,null),i=_(a,["$$slots","$$events","$$legacy","ref","class","children"]);var s=C();d(s,e=>({"data-slot":"card-title",class:e,...i}),[()=>g("leading-none font-semibold",a.class)]);var l=c(s);f(l,()=>a.children??p),m(s),v(s,e=>t(e),()=>t()),h(r,s),u()}export{y as C};
1
+ import{p as n,e as o,E as d,i as c,a as f,n as p,k as m,F as v,b as h,d as u,r as _,l as b}from"./Ddm7yfuh.js";import{c as g}from"./CQjlljeJ.js";var C=b("<div><!></div>");function y(r,a){n(a,!0);let t=o(a,"ref",15,null),i=_(a,["$$slots","$$events","$$legacy","ref","class","children"]);var s=C();d(s,e=>({"data-slot":"card-title",class:e,...i}),[()=>g("leading-none font-semibold",a.class)]);var l=c(s);f(l,()=>a.children??p),m(s),v(s,e=>t(e),()=>t()),h(r,s),u()}export{y as C};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CnHEsWV3.js","./Ddm7yfuh.js","../assets/vendor-ui.BHIBfuhK.css","./FL-YoeN8.js","./Cik1Y8bQ.js","./PPVm8Dsz.js","../assets/2.BqUJ-YIW.css","./CEoInRel.js","./Cc_gOqHV.js","./CrobSJ71.js","./CaTq3hOd.js","./DTRTIsLb.js","../assets/OsTab.DonahdAl.css","./DHB-X_rM.js","./aMuFYuii.js","./aFfrvvmo.js","./CiTctn0M.js","./BjsLiXh7.js","./CWtK7wBm.js","./2fP-ncH_.js","./LVjcJtup.js","./BqqSu535.js","./iPAoLvYg.js","./D4s3f2f1.js","./BnI4WXsN.js","./CPe4YXqt.js","../assets/CortexTasksPanel.C4153GOT.css","./BUbSI_oP.js","../assets/TroubleshooterPanel.Bj27xjMc.css"])))=>i.map(i=>d[i]);
2
- import{_ as T}from"./PPVm8Dsz.js";import{p as F,m as V,o as X,Q as C,h as u,v as y,i as n,t as E,w as P,x as A,b as s,k as d,j as z,d as B,u as R,l,T as I,y as L,z as O,c as q,f as N,g as S}from"./Ddm7yfuh.js";import M from"./DG8brTvb.js";import j from"./oAB4kRgQ.js";import{B as D}from"./FL-YoeN8.js";var G=l('<div class="unified-main svelte-1vrq4s9"><!></div>'),H=l('<div class="unified-main svelte-1vrq4s9"><div class="extra-body svelte-1vrq4s9"><!></div></div>'),Q=l('<div class="unified-memory svelte-1vrq4s9"><div class="tab-header svelte-1vrq4s9"><div class="tab-header-left svelte-1vrq4s9"><span class="tab-header-title svelte-1vrq4s9">ONTOLOGY</span> <span class="tab-header-sep svelte-1vrq4s9" aria-hidden="true"></span> <span class="tab-header-count svelte-1vrq4s9">CORTEX INDEX + CONSTELLATION</span></div> <div class="unified-actions svelte-1vrq4s9"><!> <!></div></div> <div class="unified-body svelte-1vrq4s9"><!></div></div>');function U(k,c){F(c,!0);const x=new Set(["cortex","constellation"]);function w(){if(typeof window>"u")return"cortex";const t=window.location.hash.replace("#","").split("/");return t[0]!=="cortex-memory"&&t[0]!=="ontology"?"cortex":t[1]&&x.has(t[1])?t[1]:"cortex"}let m=V(X(w()));C(()=>{if(typeof window>"u")return;const e=u(m)==="cortex"?"cortex-memory":"cortex-memory/constellation";window.location.hash!==`#${e}`&&window.history.replaceState(null,"",`#${e}`)}),C(()=>{if(typeof window>"u")return;const e=()=>{const t=w();t!==u(m)&&y(m,t,!0)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)});var g=Q(),h=n(g),p=E(n(h),2),v=n(p);{let e=R(()=>`tab-switch ${u(m)==="cortex"?"tab-switch-active":""}`);D(v,{variant:"outline",size:"sm",get class(){return u(e)},onclick:()=>y(m,"cortex"),children:(t,_)=>{P();var b=A("CORTEX");s(t,b)},$$slots:{default:!0}})}var i=E(v,2);{let e=R(()=>`tab-switch ${u(m)==="constellation"?"tab-switch-active":""}`);D(i,{variant:"outline",size:"sm",get class(){return u(e)},onclick:()=>y(m,"constellation"),children:(t,_)=>{P();var b=A("CONSTELLATION");s(t,b)},$$slots:{default:!0}})}d(p),d(h);var f=E(h,2),r=n(f);{var o=e=>{var t=G(),_=n(t);j(_,{get memories(){return c.memories},get agentId(){return c.agentId},embedded:!0}),d(t),s(e,t)},a=e=>{var t=H(),_=n(t),b=n(_);M(b,{get onopenglobalsimilar(){return c.onopenglobalsimilar},get agentId(){return c.agentId},embedded:!0}),d(_),d(t),s(e,t)};z(r,e=>{u(m)==="cortex"?e(o):e(a,-1)})}d(f),d(g),s(k,g),B()}var Y=l('<div class="cortex-content svelte-10uk01t"><!></div>'),J=l('<div class="cortex-error svelte-10uk01t"> </div>'),K=l('<div class="cortex-loading svelte-10uk01t">Loading apps...</div>'),W=l('<div class="cortex-content svelte-10uk01t"><!></div>'),Z=l('<div class="cortex-error svelte-10uk01t"> </div>'),$=l('<div class="cortex-loading svelte-10uk01t">Loading tasks...</div>'),ee=l('<div class="cortex-content svelte-10uk01t"><!></div>'),te=l('<div class="cortex-error svelte-10uk01t"> </div>'),ae=l('<div class="cortex-loading svelte-10uk01t">Loading troubleshooter...</div>'),re=l('<div class="cortex-content svelte-10uk01t"><!></div>'),oe=l('<div class="cortex-tab svelte-10uk01t"><!></div>');function le(k,c){var x=oe(),w=n(x);{var m=v=>{var i=Y(),f=n(i);U(f,{get memories(){return c.memories},get agentId(){return c.agentId},get onopenglobalsimilar(){return c.onopenglobalsimilar}}),d(i),s(v,i)},g=v=>{var i=W(),f=n(i);I(f,()=>T(()=>import("./CnHEsWV3.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),r=>{var o=K();s(r,o)},(r,o)=>{var a=q(),e=N(a);S(e,()=>u(o).default,(t,_)=>{_(t,{})}),s(r,a)},(r,o)=>{var a=J(),e=n(a);d(a),L(()=>O(e,`Failed to load: ${u(o)?.message??"unknown"??""}`)),s(r,a)}),d(i),s(v,i)},h=v=>{var i=ee(),f=n(i);I(f,()=>T(()=>import("./DHB-X_rM.js"),__vite__mapDeps([13,1,2,3,4,5,6,14,15,16,17,18,19,20,21,22,23,24,11,9,25,26]),import.meta.url),r=>{var o=$();s(r,o)},(r,o)=>{var a=q(),e=N(a);S(e,()=>u(o).default,(t,_)=>{_(t,{})}),s(r,a)},(r,o)=>{var a=Z(),e=n(a);d(a),L(()=>O(e,`Failed to load: ${u(o)?.message??"unknown"??""}`)),s(r,a)}),d(i),s(v,i)},p=v=>{var i=re(),f=n(i);I(f,()=>T(()=>import("./BUbSI_oP.js"),__vite__mapDeps([27,1,2,3,4,5,6,18,19,20,7,11,28]),import.meta.url),r=>{var o=ae();s(r,o)},(r,o)=>{var a=q(),e=N(a);S(e,()=>u(o).default,(t,_)=>{_(t,{})}),s(r,a)},(r,o)=>{var a=te(),e=n(a);d(a),L(()=>O(e,`Failed to load: ${u(o)?.message??"unknown"??""}`)),s(r,a)}),d(i),s(v,i)};z(w,v=>{c.activeTab==="cortex-memory"?v(m):c.activeTab==="cortex-apps"?v(g,1):c.activeTab==="cortex-tasks"?v(h,2):c.activeTab==="cortex-troubleshooter"&&v(p,3)})}d(x),s(k,x)}export{le as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./1Q68eYvu.js","./Ddm7yfuh.js","../assets/vendor-ui.BHIBfuhK.css","./CQjlljeJ.js","./Cik1Y8bQ.js","./PPVm8Dsz.js","../assets/2.BqUJ-YIW.css","./BChLYXWi.js","./1wENB9Fv.js","./CgytmeWL.js","./NA4Ojz1i.js","./-GB9BHh5.js","../assets/OsTab.DonahdAl.css","./y2gm4xUz.js","./DK3Rbu4L.js","./BCteBoj0.js","./FwPtkZZE.js","./CwnhW_Rr.js","./D9ZAYnCR.js","./BUS5nQyj.js","./HOTJvN83.js","./C8n6MUA5.js","./pgAhHv2c.js","./CFGlMKB9.js","./BzRQnGPj.js","./CM3Ez5Zb.js","../assets/CortexTasksPanel.C4153GOT.css","./BBKe1vca.js","../assets/TroubleshooterPanel.Bj27xjMc.css"])))=>i.map(i=>d[i]);
2
+ import{_ as T}from"./PPVm8Dsz.js";import{p as F,m as V,o as X,Q as C,h as u,v as y,i as n,t as E,w as P,x as A,b as s,k as d,j as z,d as B,u as R,l,T as I,y as L,z as O,c as q,f as N,g as S}from"./Ddm7yfuh.js";import M from"./xOiKZTGm.js";import j from"./6or1KV6K.js";import{B as D}from"./CQjlljeJ.js";var G=l('<div class="unified-main svelte-1vrq4s9"><!></div>'),H=l('<div class="unified-main svelte-1vrq4s9"><div class="extra-body svelte-1vrq4s9"><!></div></div>'),Q=l('<div class="unified-memory svelte-1vrq4s9"><div class="tab-header svelte-1vrq4s9"><div class="tab-header-left svelte-1vrq4s9"><span class="tab-header-title svelte-1vrq4s9">ONTOLOGY</span> <span class="tab-header-sep svelte-1vrq4s9" aria-hidden="true"></span> <span class="tab-header-count svelte-1vrq4s9">CORTEX INDEX + CONSTELLATION</span></div> <div class="unified-actions svelte-1vrq4s9"><!> <!></div></div> <div class="unified-body svelte-1vrq4s9"><!></div></div>');function U(k,c){F(c,!0);const x=new Set(["cortex","constellation"]);function w(){if(typeof window>"u")return"cortex";const t=window.location.hash.replace("#","").split("/");return t[0]!=="cortex-memory"&&t[0]!=="ontology"?"cortex":t[1]&&x.has(t[1])?t[1]:"cortex"}let m=V(X(w()));C(()=>{if(typeof window>"u")return;const e=u(m)==="cortex"?"cortex-memory":"cortex-memory/constellation";window.location.hash!==`#${e}`&&window.history.replaceState(null,"",`#${e}`)}),C(()=>{if(typeof window>"u")return;const e=()=>{const t=w();t!==u(m)&&y(m,t,!0)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)});var g=Q(),h=n(g),p=E(n(h),2),v=n(p);{let e=R(()=>`tab-switch ${u(m)==="cortex"?"tab-switch-active":""}`);D(v,{variant:"outline",size:"sm",get class(){return u(e)},onclick:()=>y(m,"cortex"),children:(t,_)=>{P();var b=A("CORTEX");s(t,b)},$$slots:{default:!0}})}var i=E(v,2);{let e=R(()=>`tab-switch ${u(m)==="constellation"?"tab-switch-active":""}`);D(i,{variant:"outline",size:"sm",get class(){return u(e)},onclick:()=>y(m,"constellation"),children:(t,_)=>{P();var b=A("CONSTELLATION");s(t,b)},$$slots:{default:!0}})}d(p),d(h);var f=E(h,2),r=n(f);{var o=e=>{var t=G(),_=n(t);j(_,{get memories(){return c.memories},get agentId(){return c.agentId},embedded:!0}),d(t),s(e,t)},a=e=>{var t=H(),_=n(t),b=n(_);M(b,{get onopenglobalsimilar(){return c.onopenglobalsimilar},get agentId(){return c.agentId},embedded:!0}),d(_),d(t),s(e,t)};z(r,e=>{u(m)==="cortex"?e(o):e(a,-1)})}d(f),d(g),s(k,g),B()}var Y=l('<div class="cortex-content svelte-10uk01t"><!></div>'),J=l('<div class="cortex-error svelte-10uk01t"> </div>'),K=l('<div class="cortex-loading svelte-10uk01t">Loading apps...</div>'),W=l('<div class="cortex-content svelte-10uk01t"><!></div>'),Z=l('<div class="cortex-error svelte-10uk01t"> </div>'),$=l('<div class="cortex-loading svelte-10uk01t">Loading tasks...</div>'),ee=l('<div class="cortex-content svelte-10uk01t"><!></div>'),te=l('<div class="cortex-error svelte-10uk01t"> </div>'),ae=l('<div class="cortex-loading svelte-10uk01t">Loading troubleshooter...</div>'),re=l('<div class="cortex-content svelte-10uk01t"><!></div>'),oe=l('<div class="cortex-tab svelte-10uk01t"><!></div>');function le(k,c){var x=oe(),w=n(x);{var m=v=>{var i=Y(),f=n(i);U(f,{get memories(){return c.memories},get agentId(){return c.agentId},get onopenglobalsimilar(){return c.onopenglobalsimilar}}),d(i),s(v,i)},g=v=>{var i=W(),f=n(i);I(f,()=>T(()=>import("./1Q68eYvu.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),r=>{var o=K();s(r,o)},(r,o)=>{var a=q(),e=N(a);S(e,()=>u(o).default,(t,_)=>{_(t,{})}),s(r,a)},(r,o)=>{var a=J(),e=n(a);d(a),L(()=>O(e,`Failed to load: ${u(o)?.message??"unknown"??""}`)),s(r,a)}),d(i),s(v,i)},h=v=>{var i=ee(),f=n(i);I(f,()=>T(()=>import("./y2gm4xUz.js"),__vite__mapDeps([13,1,2,3,4,5,6,14,15,16,17,18,19,20,21,22,23,24,11,9,25,26]),import.meta.url),r=>{var o=$();s(r,o)},(r,o)=>{var a=q(),e=N(a);S(e,()=>u(o).default,(t,_)=>{_(t,{})}),s(r,a)},(r,o)=>{var a=Z(),e=n(a);d(a),L(()=>O(e,`Failed to load: ${u(o)?.message??"unknown"??""}`)),s(r,a)}),d(i),s(v,i)},p=v=>{var i=re(),f=n(i);I(f,()=>T(()=>import("./BBKe1vca.js"),__vite__mapDeps([27,1,2,3,4,5,6,18,19,20,7,11,28]),import.meta.url),r=>{var o=ae();s(r,o)},(r,o)=>{var a=q(),e=N(a);S(e,()=>u(o).default,(t,_)=>{_(t,{})}),s(r,a)},(r,o)=>{var a=te(),e=n(a);d(a),L(()=>O(e,`Failed to load: ${u(o)?.message??"unknown"??""}`)),s(r,a)}),d(i),s(v,i)};z(w,v=>{c.activeTab==="cortex-memory"?v(m):c.activeTab==="cortex-apps"?v(g,1):c.activeTab==="cortex-tasks"?v(h,2):c.activeTab==="cortex-troubleshooter"&&v(p,3)})}d(x),s(k,x)}export{le as default};
@@ -1,4 +1,4 @@
1
- import{p as se,s as be,c as C,f as w,a as fe,n as ge,b as c,d as re,r as ke,o as pe,m as me,i as u,A as Y,g as R,h as s,t as y,k as p,j as A,w as ue,x as Z,y as z,z as H,u as ee,aa as Je,O as he,ab as Ke,a0 as We,K as Be,l as T,v as te,U as Fe,P as Ue}from"./Ddm7yfuh.js";import{I as ye,K as Ve,o as ae}from"./FL-YoeN8.js";import{S as Qe,a as Xe,b as Ye,c as Ze}from"./CWtK7wBm.js";import{W as et,L as ve}from"./CEoInRel.js";import{T as tt}from"./DTRTIsLb.js";function at(P,f){se(f,!0);let x=ke(f,["$$slots","$$events","$$legacy"]);const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}]];ye(P,be({name:"activity"},()=>x,{get iconNode(){return g},children:(h,O)=>{var _=C(),E=w(_);fe(E,()=>f.children??ge),c(h,_)},$$slots:{default:!0}})),re()}function st(P,f){se(f,!0);let x=ke(f,["$$slots","$$events","$$legacy"]);const g=[["path",{d:"M12 19h8"}],["path",{d:"m4 17 6-6-6-6"}]];ye(P,be({name:"terminal"},()=>x,{get iconNode(){return g},children:(h,O)=>{var _=C(),E=w(_);fe(E,()=>f.children??ge),c(h,_)},$$slots:{default:!0}})),re()}var rt=T('<span class="ts-panel-count svelte-c36e65"> </span>'),it=T("<!> <!>",1),nt=T('<div class="ts-control svelte-c36e65"><div class="ts-control-head svelte-c36e65"><div class="ts-control-title-wrap svelte-c36e65"><!> <span class="ts-control-title svelte-c36e65"> </span> <!></div> <!></div> <div class="ts-action-bar svelte-c36e65"><!> <button class="ts-run svelte-c36e65"><!></button></div></div>'),lt=T('<button class="ts-clear svelte-c36e65" title="Clear output"><!></button>'),ot=T('<div class="ts-empty svelte-c36e65">no output yet</div>'),ct=T('<div class="ts-line svelte-c36e65"></div>'),dt=T('<div class="ts-root svelte-c36e65"><div class="ts-controls svelte-c36e65"></div> <div class="ts-terminal-wrap svelte-c36e65"><div class="ts-terminal-head svelte-c36e65"><span class="ts-control-title svelte-c36e65">Terminal</span> <!></div> <div class="ts-term svelte-c36e65" role="log"><!></div></div></div>');function gt(P,f){se(f,!0);const x=[{id:"cli",title:"CLI",icon:st,color:"var(--sig-highlight)",commands:[{label:"Status",kind:"cli",key:"status"},{label:"Daemon Status",kind:"cli",key:"daemon-status"},{label:"Daemon Logs",kind:"cli",key:"daemon-logs"},{label:"Sync",kind:"cli",key:"sync"},{label:"Embed Audit",kind:"cli",key:"embed-audit"},{label:"Skill List",kind:"cli",key:"skill-list"},{label:"Secret List",kind:"cli",key:"secret-list"},{label:"Recall Test",kind:"cli",key:"recall-test"}]},{id:"status",title:"Status",icon:at,color:"var(--sig-highlight)",commands:[{label:"Health",kind:"api",method:"GET",path:"/health"},{label:"Diagnostics",kind:"api",method:"GET",path:"/api/diagnostics"},{label:"Pipeline",kind:"api",method:"GET",path:"/api/pipeline/status"},{label:"Predictor",kind:"api",method:"GET",path:"/api/predictor/status"},{label:"Git",kind:"api",method:"GET",path:"/api/git/status"},{label:"Embeddings",kind:"api",method:"GET",path:"/api/embeddings/health"}]},{id:"info",title:"Info",icon:Ve,color:"var(--sig-highlight)",commands:[{label:"Embed Gaps",kind:"api",method:"GET",path:"/api/repair/embedding-gaps"},{label:"Dedup Stats",kind:"api",method:"GET",path:"/api/repair/dedup-stats"},{label:"Cold Stats",kind:"api",method:"GET",path:"/api/repair/cold-stats"}]},{id:"repair",title:"Repair",icon:et,color:"var(--sig-highlight)",commands:[{label:"Check FTS",kind:"api",method:"POST",path:"/api/repair/check-fts"},{label:"Re-embed",kind:"api",method:"POST",path:"/api/repair/re-embed"},{label:"Resync Vec",kind:"api",method:"POST",path:"/api/repair/resync-vec"},{label:"Clean Orphans",kind:"api",method:"POST",path:"/api/repair/clean-orphans"},{label:"Deduplicate",kind:"api",method:"POST",path:"/api/repair/deduplicate"},{label:"Retention",kind:"api",method:"POST",path:"/api/repair/retention-sweep"},{label:"Requeue Dead",kind:"api",method:"POST",path:"/api/repair/requeue-dead"},{label:"Release Leases",kind:"api",method:"POST",path:"/api/repair/release-leases"},{label:"Backfill Skipped",kind:"api",method:"POST",path:"/api/repair/backfill-skipped"},{label:"Reclassify",kind:"api",method:"POST",path:"/api/repair/reclassify-entities"},{label:"Prune Chunks",kind:"api",method:"POST",path:"/api/repair/prune-chunk-groups"},{label:"Prune Singletons",kind:"api",method:"POST",path:"/api/repair/prune-singleton-entities"},{label:"Stop Daemon",kind:"cli",key:"daemon-stop"},{label:"Restart Daemon",kind:"cli",key:"daemon-restart"},{label:"Update Signet",kind:"cli",key:"update"}]}];let g=pe(Object.fromEntries(x.map(e=>[e.id,{lines:[],running:!1,selected:0}]))),h=me(pe([])),O=me(void 0);const _=Object.fromEntries(x.map(e=>[e.id,e]));function E(e){te(O,e,!0)}async function v(e){await Fe(),s(O)?.scrollTo({top:s(O).scrollHeight,behavior:"smooth"})}function o(e,t){const a=g[e];if(!a)return;a.lines=[...a.lines,t];const n=_[e]?.title??e;te(h,[...s(h),t?`[${n}] ${t}`:""],!0)}function xe(){te(h,[],!0);for(const e of x)g[e.id].lines=[]}async function _e(e,t){const a=g[e];if(!a||a.running||!t.key)return;a.running=!0,o(e,`\x1B[32m$\x1B[0m signet ${t.key.replace(/-/g," ")}`),await v();const n=new AbortController;let r=!1;try{const i=await fetch(`${ae}/api/troubleshoot/exec`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:t.key}),signal:n.signal});if(!i.ok){const D=await i.json().catch(()=>({error:"request failed"}));o(e,`\x1B[31merror:\x1B[0m ${D.error??i.statusText}`),a.running=!1,await v(e);return}const d=i.body?.getReader();if(!d){o(e,"\x1B[31merror:\x1B[0m no stream"),a.running=!1;return}t.key==="daemon-restart"&&(r=!0);const b=new TextDecoder;let $="";try{for(;;){const{done:D,value:B}=await d.read();if(D)break;$+=b.decode(B,{stream:!0});const N=$.split(`
1
+ import{p as se,s as be,c as C,f as w,a as fe,n as ge,b as c,d as re,r as ke,o as pe,m as me,i as u,A as Y,g as R,h as s,t as y,k as p,j as A,w as ue,x as Z,y as z,z as H,u as ee,aa as Je,O as he,ab as Ke,a0 as We,K as Be,l as T,v as te,U as Fe,P as Ue}from"./Ddm7yfuh.js";import{I as ye,K as Ve,o as ae}from"./CQjlljeJ.js";import{S as Qe,a as Xe,b as Ye,c as Ze}from"./D9ZAYnCR.js";import{W as et,L as ve}from"./BChLYXWi.js";import{T as tt}from"./-GB9BHh5.js";function at(P,f){se(f,!0);let x=ke(f,["$$slots","$$events","$$legacy"]);const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"}]];ye(P,be({name:"activity"},()=>x,{get iconNode(){return g},children:(h,O)=>{var _=C(),E=w(_);fe(E,()=>f.children??ge),c(h,_)},$$slots:{default:!0}})),re()}function st(P,f){se(f,!0);let x=ke(f,["$$slots","$$events","$$legacy"]);const g=[["path",{d:"M12 19h8"}],["path",{d:"m4 17 6-6-6-6"}]];ye(P,be({name:"terminal"},()=>x,{get iconNode(){return g},children:(h,O)=>{var _=C(),E=w(_);fe(E,()=>f.children??ge),c(h,_)},$$slots:{default:!0}})),re()}var rt=T('<span class="ts-panel-count svelte-c36e65"> </span>'),it=T("<!> <!>",1),nt=T('<div class="ts-control svelte-c36e65"><div class="ts-control-head svelte-c36e65"><div class="ts-control-title-wrap svelte-c36e65"><!> <span class="ts-control-title svelte-c36e65"> </span> <!></div> <!></div> <div class="ts-action-bar svelte-c36e65"><!> <button class="ts-run svelte-c36e65"><!></button></div></div>'),lt=T('<button class="ts-clear svelte-c36e65" title="Clear output"><!></button>'),ot=T('<div class="ts-empty svelte-c36e65">no output yet</div>'),ct=T('<div class="ts-line svelte-c36e65"></div>'),dt=T('<div class="ts-root svelte-c36e65"><div class="ts-controls svelte-c36e65"></div> <div class="ts-terminal-wrap svelte-c36e65"><div class="ts-terminal-head svelte-c36e65"><span class="ts-control-title svelte-c36e65">Terminal</span> <!></div> <div class="ts-term svelte-c36e65" role="log"><!></div></div></div>');function gt(P,f){se(f,!0);const x=[{id:"cli",title:"CLI",icon:st,color:"var(--sig-highlight)",commands:[{label:"Status",kind:"cli",key:"status"},{label:"Daemon Status",kind:"cli",key:"daemon-status"},{label:"Daemon Logs",kind:"cli",key:"daemon-logs"},{label:"Sync",kind:"cli",key:"sync"},{label:"Embed Audit",kind:"cli",key:"embed-audit"},{label:"Skill List",kind:"cli",key:"skill-list"},{label:"Secret List",kind:"cli",key:"secret-list"},{label:"Recall Test",kind:"cli",key:"recall-test"}]},{id:"status",title:"Status",icon:at,color:"var(--sig-highlight)",commands:[{label:"Health",kind:"api",method:"GET",path:"/health"},{label:"Diagnostics",kind:"api",method:"GET",path:"/api/diagnostics"},{label:"Pipeline",kind:"api",method:"GET",path:"/api/pipeline/status"},{label:"Predictor",kind:"api",method:"GET",path:"/api/predictor/status"},{label:"Git",kind:"api",method:"GET",path:"/api/git/status"},{label:"Embeddings",kind:"api",method:"GET",path:"/api/embeddings/health"}]},{id:"info",title:"Info",icon:Ve,color:"var(--sig-highlight)",commands:[{label:"Embed Gaps",kind:"api",method:"GET",path:"/api/repair/embedding-gaps"},{label:"Dedup Stats",kind:"api",method:"GET",path:"/api/repair/dedup-stats"},{label:"Cold Stats",kind:"api",method:"GET",path:"/api/repair/cold-stats"}]},{id:"repair",title:"Repair",icon:et,color:"var(--sig-highlight)",commands:[{label:"Check FTS",kind:"api",method:"POST",path:"/api/repair/check-fts"},{label:"Re-embed",kind:"api",method:"POST",path:"/api/repair/re-embed"},{label:"Resync Vec",kind:"api",method:"POST",path:"/api/repair/resync-vec"},{label:"Clean Orphans",kind:"api",method:"POST",path:"/api/repair/clean-orphans"},{label:"Deduplicate",kind:"api",method:"POST",path:"/api/repair/deduplicate"},{label:"Retention",kind:"api",method:"POST",path:"/api/repair/retention-sweep"},{label:"Requeue Dead",kind:"api",method:"POST",path:"/api/repair/requeue-dead"},{label:"Release Leases",kind:"api",method:"POST",path:"/api/repair/release-leases"},{label:"Backfill Skipped",kind:"api",method:"POST",path:"/api/repair/backfill-skipped"},{label:"Reclassify",kind:"api",method:"POST",path:"/api/repair/reclassify-entities"},{label:"Prune Chunks",kind:"api",method:"POST",path:"/api/repair/prune-chunk-groups"},{label:"Prune Singletons",kind:"api",method:"POST",path:"/api/repair/prune-singleton-entities"},{label:"Stop Daemon",kind:"cli",key:"daemon-stop"},{label:"Restart Daemon",kind:"cli",key:"daemon-restart"},{label:"Update Signet",kind:"cli",key:"update"}]}];let g=pe(Object.fromEntries(x.map(e=>[e.id,{lines:[],running:!1,selected:0}]))),h=me(pe([])),O=me(void 0);const _=Object.fromEntries(x.map(e=>[e.id,e]));function E(e){te(O,e,!0)}async function v(e){await Fe(),s(O)?.scrollTo({top:s(O).scrollHeight,behavior:"smooth"})}function o(e,t){const a=g[e];if(!a)return;a.lines=[...a.lines,t];const n=_[e]?.title??e;te(h,[...s(h),t?`[${n}] ${t}`:""],!0)}function xe(){te(h,[],!0);for(const e of x)g[e.id].lines=[]}async function _e(e,t){const a=g[e];if(!a||a.running||!t.key)return;a.running=!0,o(e,`\x1B[32m$\x1B[0m signet ${t.key.replace(/-/g," ")}`),await v();const n=new AbortController;let r=!1;try{const i=await fetch(`${ae}/api/troubleshoot/exec`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:t.key}),signal:n.signal});if(!i.ok){const D=await i.json().catch(()=>({error:"request failed"}));o(e,`\x1B[31merror:\x1B[0m ${D.error??i.statusText}`),a.running=!1,await v(e);return}const d=i.body?.getReader();if(!d){o(e,"\x1B[31merror:\x1B[0m no stream"),a.running=!1;return}t.key==="daemon-restart"&&(r=!0);const b=new TextDecoder;let $="";try{for(;;){const{done:D,value:B}=await d.read();if(D)break;$+=b.decode(B,{stream:!0});const N=$.split(`
2
2
 
3
3
  `);$=N.pop()??"";for(const F of N){const G=F.match(/^data:\s*(.+)$/m);if(G)try{const m=JSON.parse(G[1]);if(m.type==="started"&&(r=!0),m.type==="stdout"||m.type==="stderr"){const S=String(m.data).replace(/\n$/,"");if(S){for(const j of S.split(`
4
4
  `))o(e,m.type==="stderr"?`\x1B[33m${j}\x1B[0m`:j);await v(e)}}else m.type==="exit"?(o(e,m.code===0?"\x1B[32m✓ exit 0\x1B[0m":`\x1B[31m✗ exit ${m.code}\x1B[0m`),await v(e)):m.type==="error"&&(o(e,`\x1B[31merror:\x1B[0m ${m.message}`),await v(e))}catch{}}}}finally{d.releaseLock()}}catch(i){n.signal.aborted||(t.key==="daemon-stop"||t.key==="daemon-restart"?o(e,"\x1B[33mDaemon process ended\x1B[0m"):o(e,`\x1B[31merror:\x1B[0m ${i instanceof Error?i.message:"fetch failed"}`))}if(t.key==="daemon-restart"&&r){o(e,"\x1B[90mWaiting for daemon to restart...\x1B[0m"),await v();let i=!1;for(let d=0;d<15;d++){await new Promise(b=>setTimeout(b,1e3));try{if((await fetch(`${ae}/health`)).ok){i=!0;break}}catch{}}o(e,i?"\x1B[32m✓ Daemon restarted\x1B[0m":"\x1B[31m✗ Daemon did not restart within 15s\x1B[0m"),await v()}o(e,""),a.running=!1,await v()}async function $e(e,t){const a=g[e];if(!a||a.running||!t.path||!t.method)return;a.running=!0;const n=performance.now();o(e,`\x1B[32m$\x1B[0m ${t.method} ${t.path}`),await v();try{const r=await fetch(`${ae}${t.path}`,{method:t.method}),i=Math.round(performance.now()-n),b=(r.headers.get("content-type")??"").includes("json")?JSON.stringify(await r.json(),null,2):await r.text();o(e,r.ok?`\x1B[32m${r.status} OK\x1B[0m \x1B[90m${i}ms\x1B[0m`:`\x1B[31m${r.status} FAILED\x1B[0m \x1B[90m${i}ms\x1B[0m`);for(const $ of b.split(`
@@ -1 +1 @@
1
- import{p as d,s as p,c,f as l,a as h,n as i,b as m,d as $,r as u}from"./Ddm7yfuh.js";import{I as f}from"./FL-YoeN8.js";function _(t,a){d(a,!0);let o=u(a,["$$slots","$$events","$$legacy"]);const s=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"}]];f(t,p({name:"wrench"},()=>o,{get iconNode(){return s},children:(r,v)=>{var e=c(),n=l(e);h(n,()=>a.children??i),m(r,e)},$$slots:{default:!0}})),$()}function N(t,a){d(a,!0);let o=u(a,["$$slots","$$events","$$legacy"]);const s=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];f(t,p({name:"loader"},()=>o,{get iconNode(){return s},children:(r,v)=>{var e=c(),n=l(e);h(n,()=>a.children??i),m(r,e)},$$slots:{default:!0}})),$()}export{N as L,_ as W};
1
+ import{p as d,s as p,c,f as l,a as h,n as i,b as m,d as $,r as u}from"./Ddm7yfuh.js";import{I as f}from"./CQjlljeJ.js";function _(t,a){d(a,!0);let o=u(a,["$$slots","$$events","$$legacy"]);const s=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"}]];f(t,p({name:"wrench"},()=>o,{get iconNode(){return s},children:(r,v)=>{var e=c(),n=l(e);h(n,()=>a.children??i),m(r,e)},$$slots:{default:!0}})),$()}function N(t,a){d(a,!0);let o=u(a,["$$slots","$$events","$$legacy"]);const s=[["path",{d:"M12 2v4"}],["path",{d:"m16.2 7.8 2.9-2.9"}],["path",{d:"M18 12h4"}],["path",{d:"m16.2 16.2 2.9 2.9"}],["path",{d:"M12 18v4"}],["path",{d:"m4.9 19.1 2.9-2.9"}],["path",{d:"M2 12h4"}],["path",{d:"m4.9 4.9 2.9 2.9"}]];f(t,p({name:"loader"},()=>o,{get iconNode(){return s},children:(r,v)=>{var e=c(),n=l(e);h(n,()=>a.children??i),m(r,e)},$$slots:{default:!0}})),$()}export{N as L,_ as W};
@@ -1 +1 @@
1
- import{p as _,e as o,c as w,f as k,j as I,b as s,d as j,E as c,F as f,J as E,I as v,l as g,r as F}from"./Ddm7yfuh.js";import{c as b}from"./FL-YoeN8.js";var J=g("<input/>"),P=g("<input/>");function z(p,e){_(e,!0);let a=o(e,"ref",15,null),d=o(e,"value",15),m=o(e,"files",15),n=o(e,"data-slot",3,"input"),l=F(e,["$$slots","$$events","$$legacy","ref","value","type","files","class","data-slot"]);var u=w(),x=k(u);{var y=t=>{var i=J();c(i,r=>({"data-slot":n(),class:r,type:"file",...l}),[()=>b("selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e.class)],void 0,void 0,void 0,!0),f(i,r=>a(r),()=>a()),E(i,m),v(i,d),s(t,i)},h=t=>{var i=P();c(i,r=>({"data-slot":n(),class:r,type:e.type,...l}),[()=>b("border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e.class)],void 0,void 0,void 0,!0),f(i,r=>a(r),()=>a()),v(i,d),s(t,i)};I(x,t=>{e.type==="file"?t(y):t(h,-1)})}s(p,u),j()}export{z as I};
1
+ import{p as _,e as o,c as w,f as k,j as I,b as s,d as j,E as c,F as f,J as E,I as v,l as g,r as F}from"./Ddm7yfuh.js";import{c as b}from"./CQjlljeJ.js";var J=g("<input/>"),P=g("<input/>");function z(p,e){_(e,!0);let a=o(e,"ref",15,null),d=o(e,"value",15),m=o(e,"files",15),n=o(e,"data-slot",3,"input"),l=F(e,["$$slots","$$events","$$legacy","ref","value","type","files","class","data-slot"]);var u=w(),x=k(u);{var y=t=>{var i=J();c(i,r=>({"data-slot":n(),class:r,type:"file",...l}),[()=>b("selection:bg-primary dark:bg-input/30 selection:text-primary-foreground border-input ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 pt-1.5 text-sm font-medium shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e.class)],void 0,void 0,void 0,!0),f(i,r=>a(r),()=>a()),E(i,m),v(i,d),s(t,i)},h=t=>{var i=P();c(i,r=>({"data-slot":n(),class:r,type:e.type,...l}),[()=>b("border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e.class)],void 0,void 0,void 0,!0),f(i,r=>a(r),()=>a()),v(i,d),s(t,i)};I(x,t=>{e.type==="file"?t(y):t(h,-1)})}s(p,u),j()}export{z as I};
@@ -0,0 +1 @@
1
+ import{bj as Ae,q as Ge,m as A,h as U,v as P,U as re,bk as bt}from"./Ddm7yfuh.js";class Ue{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Pe{constructor(t,n){this.status=t,this.location=n}}class Te extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function kt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function Et(e){return e.split("%25").map(decodeURI).join("%25")}function St(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function Rt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(s,o){if(o==="get"||o==="getAll"||o==="has")return(c,...d)=>(n(c),s[o](c,...d));t();const l=Reflect.get(s,o);return typeof l=="function"?l.bind(s):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const s of i)Object.defineProperty(a,s,{get(){return t(),e[s]},enumerable:!0,configurable:!0});return a}function xt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function Lt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const At=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&H.delete(Ie(e)),At(e,t));const H=new Map;function Ut(e,t){const n=Ie(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&H.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=Lt(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function Pt(e,t,n){if(H.size>0){const r=Ie(e,n),a=H.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);H.delete(r)}}return window.fetch(t,n)}function Ie(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${xt(...a)}"]`}return r}const Tt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function It(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${$t(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return ve(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return ve(String.fromCharCode(...l.slice(2).split("-").map(v=>parseInt(v,16))));const d=Tt.exec(l),[,p,u,f,h]=d;return t.push({name:f,matcher:h,optional:!!p,rest:!!u,chained:u?c===1&&s[0]==="":!1}),u?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return ve(l)}).join("")}).join("")}/?$`),params:t}}function Ot(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function $t(e){return e.slice(1).split("/").filter(Ot)}function Ct(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(d=>d).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&l.chained&&(s=0),!d&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function ve(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function jt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,d]])=>{const{pattern:p,params:u}=It(o),f={id:o,exec:h=>{const v=p.exec(h);if(v)return Ct(v,u,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...c||[]].map(s),leaf:i(l)};return f.errors.length=f.layouts.length=Math.max(f.errors.length,f.layouts.length),f});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function Qe(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Me(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const x=globalThis.__sveltekit_1ohqggp?.base??"",Nt=globalThis.__sveltekit_1ohqggp?.assets??x??"",qt="1774688098097",Ze="sveltekit:snapshot",et="sveltekit:scroll",tt="sveltekit:states",Dt="sveltekit:pageurl",V="sveltekit:history",J="sveltekit:navigation",N={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Oe=location.origin;function nt(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function D(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const He={...N,"":N.hover};function rt(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function at(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=rt(e)}}function ke(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||pe(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===Oe&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function ae(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=D(o,"preload-code")),a===null&&(a=D(o,"preload-data")),t===null&&(t=D(o,"keepfocus")),n===null&&(n=D(o,"noscroll")),i===null&&(i=D(o,"reload")),s===null&&(s=D(o,"replacestate")),o=rt(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:He[r??"off"],preload_data:He[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function We(e){const t=Ae(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const ot={v:()=>{}};function Vt(){const{set:e,subscribe:t}=Ae(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Nt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==qt;return s&&(e(!0),ot.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function pe(e,t,n){return e.origin!==Oe||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function dn(e){}const st=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...st];const Bt=new Set([...st]);[...Bt];function Kt(e){return e.filter(t=>t!=null)}function $e(e){return e instanceof Ue||e instanceof Te?e.status:500}function Ft(e){return e instanceof Te?e.text:"Internal Error"}let b,Y,we;const Gt=Ge.toString().includes("$$")||/function \w+\(\) \{\}/.test(Ge.toString()),Je="a:";Gt?(b={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(Je)},Y={current:null},we={current:!1}):(b=new class{#e=A({});get data(){return U(this.#e)}set data(t){P(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){P(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){P(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){P(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){P(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){P(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){P(this.#s,t)}#i=A(new URL(Je));get url(){return U(this.#i)}set url(t){P(this.#i,t)}},Y=new class{#e=A(null);get current(){return U(this.#e)}set current(t){P(this.#e,t)}},we=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){P(this.#e,t)}},ot.v=()=>we.current=!0);function it(e){Object.assign(b,e)}const Ye={spanContext(){return Mt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Mt={traceId:"",spanId:"",traceFlags:0},Ht=new Set(["icon","shortcut icon","apple-touch-icon"]);let G=null;const j=Qe(et)??{},z=Qe(Ze)??{},C={url:We({}),page:We({}),navigating:Ae(null),updated:Vt()};function Ce(e){j[e]=q()}function Wt(e,t){let n=e+1;for(;j[n];)delete j[n],n+=1;for(n=t+1;z[n];)delete z[n],n+=1}function X(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function lt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Ee(){}let je,Se,oe,T,Re,w;const se=[],ie=[];let L=null;function le(){L?.fork?.then(e=>e?.discard()),L=null}const ne=new Map,ct=new Set,Jt=new Set,W=new Set;let m={branch:[],error:null,url:null,nav:null},ut=!1,ce=!1,ze=!0,Q=!1,M=!1,ft=!1,ee=!1,Ne,y,R,I;const ue=new Set;let ye;const fe=new Map;async function _n(e,t,n){globalThis.__sveltekit_1ohqggp?.data&&globalThis.__sveltekit_1ohqggp.data,document.URL!==location.href&&(location.href=location.href),w=e,await e.hooks.init?.(),je=jt(e),T=document.documentElement,Re=t,Se=e.nodes[0],oe=e.nodes[1],Se(),oe(),y=history.state?.[V],R=history.state?.[J],y||(y=R=Date.now(),history.replaceState({...history.state,[V]:y,[J]:R},""));const r=j[y];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await sn(Re,n)):(await B({type:"enter",url:nt(w.hash?un(new URL(location.href)):location.href),replace_state:!0}),a()),on()}async function Yt(e=!0,t=!0){if(await(ye||=Promise.resolve()),!ye)return;ye=null;const n=I={},r=await te(m.url,!0);if(le(),ee&&fe.forEach(({resource:a})=>{a.refresh?.()}),e){const a=b.state,i=r&&await Ve(r);if(!i||n!==I)return;if(i.type==="redirect")return pt(new URL(i.location,m.url).href,{replaceState:!0},1,n);t||(i.props.page.state=a),it(i.props.page),m={...i.state,nav:m.nav},xe(),Ne.$set(i.props)}else xe();await Promise.all([...fe.values()].map(({resource:a})=>a)).catch(Ee)}function xe(){se.length=0,ee=!1}function dt(e){ie.some(t=>t?.snapshot)&&(z[e]=ie.map(t=>t?.snapshot?.capture()))}function ht(e){z[e]?.forEach((t,n)=>{ie[n]?.snapshot?.restore(t)})}function Xe(){Ce(y),Me(et,j),dt(R),Me(Ze,z)}async function pt(e,t,n,r){let a;t.invalidateAll&&le(),await B({type:"goto",url:nt(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(ee=!0,a=[...fe.keys()]),t.invalidate&&t.invalidate.forEach(an)}}),t.invalidateAll&&re().then(re).then(()=>{fe.forEach(({resource:i},s)=>{a?.includes(s)&&i.refresh?.()})})}async function zt(e){if(e.id!==L?.id){le();const t={};ue.add(t),L={id:e.id,token:t,promise:Ve({...e,preload:t}).then(n=>(ue.delete(t),n.type==="loaded"&&n.state.error&&le(),n)),fork:null}}return L.promise}async function be(e){const t=(await te(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(n=>n[1]()))}async function gt(e,t,n){const r={params:m.params,route:{id:m.route?.id??null},url:new URL(location.href)};m={...e.state,nav:r};const a=document.querySelector("style[data-sveltekit]");if(a&&a.remove(),Object.assign(b,e.props.page),Ne=new w.root({target:t,props:{...e.props,stores:C,components:ie},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),ht(R),n){const i={from:null,to:{...r,scroll:j[y]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};W.forEach(s=>s(i))}ce=!0}async function de({url:e,params:t,branch:n,errors:r,status:a,error:i,route:s,form:o}){let l="never";if(x&&(e.pathname===x||e.pathname===x+"/"))l="always";else for(const h of n)h?.slash!==void 0&&(l=h.slash);e.pathname=kt(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:i,route:s},props:{constructors:Kt(n).map(h=>h.node.component),page:Fe(b)}};o!==void 0&&(c.props.form=o);let d={},p=!b,u=0;for(let h=0;h<Math.max(n.length,m.branch.length);h+=1){const v=n[h],_=m.branch[h];v?.data!==_?.data&&(p=!0),v&&(d={...d,...v.data},p&&(c.props[`data_${u}`]=d),u+=1)}return(!m.url||e.href!==m.url.href||m.error!==i||o!==void 0&&o!==b.form||p)&&(c.props.page={error:i,params:t,route:{id:s?.id??null},state:{},status:a,url:new URL(e),form:o??null,data:p?d:b.data}),c}async function qe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null,o=!0;const l={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},c=await e();if(c.universal?.load){let d=function(...u){for(const f of u){const{href:h}=new URL(f,n);l.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Ye,current:Ye},route:new Proxy(a,{get:(u,f)=>(o&&(l.route=!0),u[f])}),params:new Proxy(r,{get:(u,f)=>(o&&l.params.add(f),u[f])}),data:i?.data??null,url:Rt(n,()=>{o&&(l.url=!0)},u=>{o&&l.search_params.add(u)},w.hash),async fetch(u,f){u instanceof Request&&(f={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u?.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...f});const{resolved:h,promise:v}=_t(u,f,n);return o&&d(h.href),v},setHeaders:()=>{},depends:d,parent(){return o&&(l.parent=!0),t()},untrack(u){o=!1;try{return u()}finally{o=!0}}};s=await c.universal.load.call(null,p)??null}return{node:c,loader:e,server:i,universal:c.universal?.load?{type:"data",data:s,uses:l}:null,data:s??i?.data??null,slash:c.universal?.trailingSlash??i?.slash}}function _t(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=ce?Pt(r,a.href,t):Ut(r,t);return{resolved:a,promise:i}}function Xt(e,t,n,r,a,i){if(ee)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==m.params[s])return!0;for(const s of a.dependencies)if(se.some(o=>o(new URL(s))))return!0;return!1}function De(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Qt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Zt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:Fe(b),constructors:[]}}}async function Ve({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(L?.id===e)return ue.delete(L.token),L.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(_=>_?.().catch(()=>{})),c.forEach(_=>_?.[1]().catch(()=>{}));const d=m.url?e!==he(m.url):!1,p=m.route?a.id!==m.route.id:!1,u=Qt(m.url,n);let f=!1;const h=c.map(async(_,g)=>{if(!_)return;const E=m.branch[g];return _[1]===E?.loader&&!Xt(f,p,d,u,E.universal?.uses,r)?E:(f=!0,qe({loader:_[1],url:n,params:r,route:a,parent:async()=>{const O={};for(let $=0;$<g;$+=1)Object.assign(O,(await h[$])?.data);return O},server_data_node:De(_[0]?{type:"skip"}:null,_[0]?E?.server:void 0)}))});for(const _ of h)_.catch(()=>{});const v=[];for(let _=0;_<c.length;_+=1)if(c[_])try{v.push(await h[_])}catch(g){if(g instanceof Pe)return{type:"redirect",location:g.location};if(ue.has(i))return Zt({error:await Z(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let E=$e(g),S;if(g instanceof Ue)S=g.body;else{if(await C.updated.check())return await lt(),await X(n);S=await Z(g,{params:r,url:n,route:{id:a.id}})}const O=await en(_,v,s);return O?de({url:n,params:r,branch:v.slice(0,O.idx).concat(O.node),errors:s,status:E,error:S,route:a}):await vt(n,{id:a.id},S,E)}else v.push(void 0);return de({url:n,params:r,branch:v,errors:s,status:200,error:null,route:a,form:t?void 0:null})}async function en(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Be({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await qe({loader:Se,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:De(i)}),o={node:await oe(),loader:oe,universal:null,server:null,data:null};return de({url:n,params:a,branch:[s,o],status:e,error:t,errors:[],route:null})}catch(s){if(s instanceof Pe)return pt(new URL(s.location,location.href),{},0);throw s}}async function tn(e){const t=e.href;if(ne.has(t))return ne.get(t);let n;try{const r=(async()=>{let a=await w.hooks.reroute({url:new URL(e),fetch:async(i,s)=>_t(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);w.hash?i.hash=a:i.pathname=a,a=i}return a})();ne.set(t,r),n=await r}catch{ne.delete(t);return}return n}async function te(e,t){if(e&&!pe(e,x,w.hash)){const n=await tn(e);if(!n)return;const r=nn(n);for(const a of je){const i=a.exec(r);if(i)return{id:he(e),invalidating:t,route:a,params:St(i),url:e}}}}function nn(e){return Et(w.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function he(e){return(w.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function mt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ke(m,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return Q||ct.forEach(c=>c(l)),s?null:o}async function B({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Ee,block:d=Ee,event:p}){const u=I;I=l;const f=await te(t,!1),h=e==="enter"?Ke(m,f,t,e):mt({url:t,type:e,delta:n?.delta,intent:f,scroll:n?.scroll,event:p});if(!h){d(),I===l&&(I=u);return}const v=y,_=R;c(),Q=!0,ce&&h.navigation.type!=="enter"&&C.navigating.set(Y.current=h.navigation);let g=f&&await Ve(f);if(!g){if(pe(t,x,w.hash))return await X(t,i);g=await vt(t,{id:null},await Z(new Te(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=f?.url||t,I!==l)return h.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(o<20){await B({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),h.fulfil(void 0);return}g=await Be({status:500,error:await Z(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await C.updated.check()&&(await lt(),await X(t,i));if(xe(),Ce(v),dt(_),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const k=i?0:1,K={[V]:y+=k,[J]:R+=k,[tt]:s};(i?history.replaceState:history.pushState).call(history,K,"",t),i||Wt(y,R)}const E=f&&L?.id===f.id?L.fork:null;L=null,g.props.page.state=s;let S;if(ce){const k=(await Promise.all(Array.from(Jt,F=>F(h.navigation)))).filter(F=>typeof F=="function");if(k.length>0){let F=function(){k.forEach(_e=>{W.delete(_e)})};k.push(F),k.forEach(_e=>{W.add(_e)})}const K=h.navigation.to;m={...g.state,nav:{params:K.params,route:K.route,url:K.url}},g.props.page&&(g.props.page.url=t);const ge=E&&await E;ge?S=ge.commit():(G=null,Ne.$set(g.props),G&&Object.assign(g.props.page,G),it(g.props.page),S=bt?.()),ft=!0}else await gt(g,Re,!1);const{activeElement:O}=document;await S,await re(),await re();let $=null;if(ze){const k=n?n.scroll:a?q():null;k?scrollTo(k.x,k.y):($=t.hash&&document.getElementById(wt(t)))?$.scrollIntoView():scrollTo(0,0)}const yt=document.activeElement!==O&&document.activeElement!==document.body;!r&&!yt&&cn(t,!$),ze=!0,g.props.page&&(G&&Object.assign(g.props.page,G),Object.assign(b,g.props.page)),Q=!1,e==="popstate"&&ht(R),h.fulfil(void 0),h.navigation.to&&(h.navigation.to.scroll=q()),W.forEach(k=>k(h.navigation)),C.navigating.set(Y.current=null)}async function vt(e,t,n,r,a){return e.origin===Oe&&e.pathname===location.pathname&&!ut?await Be({status:r,error:n,url:e,route:t}):await X(e,a)}function rn(){let e,t={element:void 0,href:void 0},n;T.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,N.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],N.tap)}T.addEventListener("mousedown",r),T.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(be(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=at(o,T),d=c===t.element&&c?.href===t.href&&l>=n;if(!c||d)return;const{url:p,external:u,download:f}=ke(c,x,w.hash);if(u||f)return;const h=ae(c),v=p&&he(m.url)===he(p);if(!(h.reload||v))if(l<=h.preload_data){t={element:c,href:c.href},n=N.tap;const _=await te(p,!1);if(!_)return;zt(_)}else l<=h.preload_code&&(t={element:c,href:c.href},n=l,be(p))}function s(){a.disconnect();for(const o of T.querySelectorAll("a")){const{url:l,external:c,download:d}=ke(o,x,w.hash);if(c||d)continue;const p=ae(o);p.reload||(p.preload_code===N.viewport&&a.observe(o),p.preload_code===N.eager&&be(l))}}W.add(s),s()}function Z(e,t){if(e instanceof Ue)return e.body;const n=$e(e),r=Ft(e);return w.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function an(e){if(typeof e=="function")se.push(e);else{const{href:t}=new URL(e,location.href);se.push(n=>n.href===t)}}function mn(){return ee=!0,Yt()}function on(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Xe(),!Q){const r=Ke(m,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};ct.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Xe()}),navigator.connection?.saveData||rn(),T.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=at(t.composedPath()[0],T);if(!n)return;const{url:r,external:a,target:i,download:s}=ke(n,x,w.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=ae(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,d]=(w.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===me(location);if(a||o.reload&&(!p||!d)){mt({url:r,type:"link",event:t})?Q=!0:t.preventDefault();return}if(d!==void 0&&p){const[,u]=m.url.href.split("#");if(u===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const f=n.ownerDocument.getElementById(decodeURIComponent(d));f&&(f.scrollIntoView(),f.focus())}return}if(M=!0,Ce(y),e(r),!o.replace_state)return;M=!1}t.preventDefault(),await new Promise(u=>{requestAnimationFrame(()=>{setTimeout(u,0)}),setTimeout(u,100)}),await B({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),T.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(pe(s,x,!1))return;const o=t.target,l=ae(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),B({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Le){if(t.state?.[V]){const n=t.state[V];if(I={},n===y)return;const r=j[n],a=t.state[tt]??{},i=new URL(t.state[Dt]??location.href),s=t.state[J],o=m.url?me(location)===me(m.url):!1;if(s===R&&(ft||o)){a!==b.state&&(b.state=a),e(i),j[y]=q(),r&&scrollTo(r.x,r.y),y=n;return}const c=n-y;await B({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{y=n,R=s},block:()=>{history.go(-c)},nav_token:I,event:t})}else if(!M){const n=new URL(location.href);e(n),w.hash&&location.reload()}}}),addEventListener("hashchange",()=>{M&&(M=!1,history.replaceState({...history.state,[V]:++y,[J]:R},"",location.href))});for(const t of document.querySelectorAll("link"))Ht.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&C.navigating.set(Y.current=null)});function e(t){m.url=b.url=t,C.page.set(Fe(b)),C.page.notify()}}async function sn(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){ut=!0;const c=new URL(location.href);let d;({params:a={},route:i={id:null}}=await te(c,!1)||{}),d=je.find(({id:f})=>f===i.id);let p,u=!0;try{const f=r.map(async(v,_)=>{const g=o[_];return g?.uses&&(g.uses=ln(g.uses)),qe({loader:w.nodes[v],url:c,params:a,route:i,parent:async()=>{const E={};for(let S=0;S<_;S+=1)Object.assign(E,(await f[S]).data);return E},server_data_node:De(g)})}),h=await Promise.all(f);if(d){const v=d.layouts;for(let _=0;_<v.length;_++)v[_]||h.splice(_,0,void 0)}p=await de({url:c,params:a,branch:h,status:t,error:n,errors:d?.errors,form:l,route:d??null})}catch(f){if(f instanceof Pe){await X(new URL(f.location,location.href));return}p=await Be({status:$e(f),error:await Z(f,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",u=!1}p.props.page&&(p.props.page.state={}),await gt(p,e,u)}function ln(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Le=!1;function cn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=wt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=q();setTimeout(()=>{const o=history.state;Le=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),Le=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ke(e,t,n,r,a=null){let i,s;const o=new Promise((c,d)=>{i=c,s=d});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function Fe(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function un(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function wt(e){let t;if(w.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{_n as a,mn as i,dn as l,b as p,C as s};