@mindstudio-ai/browser-agent 0.1.61 → 0.1.62

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 (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var __MindStudioBrowserAgent=(()=>{var Nn=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var gs=Object.getOwnPropertyNames;var ys=Object.prototype.hasOwnProperty;var Ln=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var bs=(e,t)=>{for(var n in t)Nn(e,n,{get:t[n],enumerable:!0})},ws=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of gs(t))!ys.call(e,o)&&o!==n&&Nn(e,o,{get:()=>t[o],enumerable:!(r=hs(t,o))||r.enumerable});return e};var vs=e=>ws(Nn({},"__esModule",{value:!0}),e);var Af={};bs(Af,{executeSteps:()=>nn,getRefMap:()=>Xe,resolveElement:()=>Ne,takeSnapshot:()=>Ke,takeSnapshotSync:()=>Dn});var Rn="__ms";function Cs(){return{ws:{ws:null,clientId:null,reconnectDelay:1e3,closing:!1,busy:!1},cursor:{el:null,rippleEl:null,x:-100,y:-100,hasPosition:!1,hideTimer:null,executing:!1,targetElement:null,trackingFrame:null,settledResolve:null,visibilityState:"hidden",preSnapshotState:null},snapshot:{refCounter:0,refMap:new Map},networkIdle:{activeRequests:0},transport:{buffer:[],flushTimer:null,capturing:!1,captured:[],wsGetter:null},noteLayer:{host:null,overlay:null,cursorEl:null,notes:[],currentNote:null,pointerDown:!1,startX:0,startY:0,didDrag:!1,consumedByDeactivation:!1,dragPreview:null,movingNote:null,moveOffsetX:0,moveOffsetY:0},noteElement:{counter:0},notesMode:{active:!1,wasTouchActive:!1},messages:{handler:null},screenshot:{cameraEl:null,flashEl:null,capturing:!1},fonts:{initialized:!1,observer:null},zoom:{pipMode:!1,mobilePreview:!1},touch:{circleEl:null,active:!1,pressed:!1,dragging:!1,startX:0,startY:0,lastX:0,lastY:0,onMouseMove:null,onMouseDown:null,onMouseUp:null,onMouseLeave:null,onDragStart:null,momentumFrame:null,overscrollY:0,bouncing:!1,bounceTimer:null,scrollContainer:null,velocityX:0,velocityY:0,lastMoveTime:0},mirror:{recording:!1,stopFn:null}}}function E(){let e=window;return e[Rn]||(e[Rn]=Cs()),e[Rn]}var Gr="/__mindstudio_dev__/logs",Ss=2e3;function zr(e){E().transport.wsGetter=e}function Yr(){let e=E().transport;if(e.buffer.length===0)return;let t=e.buffer;e.buffer=[];let n=e.wsGetter?.();if(n&&n.readyState===WebSocket.OPEN)try{n.send(JSON.stringify({type:"log",entries:t}));return}catch{}try{let r=new XMLHttpRequest;r.open("POST",Gr,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t))}catch{}}function xs(){let e=E().transport;e.flushTimer||(e.flushTimer=setTimeout(()=>{e.flushTimer=null,Yr()},Ss))}function Is(){let e=E().transport;e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),Yr()}function pe(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),xs()}function Fn(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),Is()}function _n(){let e=E().transport;e.capturing=!0,e.captured=[]}function $n(){let e=E().transport;e.capturing=!1;let t=e.captured;return e.captured=[],t}function qr(){window.addEventListener("beforeunload",()=>{let e=E().transport;e.buffer.length>0&&navigator.sendBeacon&&navigator.sendBeacon(Gr,JSON.stringify(e.buffer))})}var Es={a:"link",button:"button",input:"textbox",textarea:"textbox",select:"combobox",option:"option",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",dialog:"dialog",details:"group",summary:"button",img:"img",ul:"list",ol:"list",li:"listitem",table:"table",tr:"row",th:"columnheader",td:"cell",form:"form",article:"article",section:"region",label:"label",fieldset:"group",legend:"legend",p:"paragraph",blockquote:"blockquote",pre:"code",code:"code",hr:"separator",progress:"progressbar"};function ye(e){let t=e.getAttribute("role");if(t)return t==="presentation"||t==="none"?null:t;let n=e.tagName.toLowerCase();if(n==="a")return e.hasAttribute("href")?"link":null;if(n==="section")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"region":null;if(n==="form")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"form":null;if(n==="img")return e.alt===""?null:"img";if(n==="input")switch(e.type){case"checkbox":return"checkbox";case"radio":return"radio";case"range":return"slider";case"submit":case"button":case"reset":return"button";case"hidden":return null;default:return"textbox"}return Es[n]??null}function jr(e){if(e.hasAttribute("onclick")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1")return!0;try{if(getComputedStyle(e).cursor==="pointer")return!0}catch{}return!1}function Se(e){let t=e.getAttribute("aria-label");if(t)return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let a=n.split(/\s+/).map(s=>{let c=document.getElementById(s);return c?We(c):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=As(e);if(a)return a}if(r==="img"){let a=e.alt;if(a)return a.trim()}if(r==="fieldset"){let a=e.querySelector("legend");if(a)return We(a)}let o=We(e);if(o)return o;let i=e.getAttribute("title");return i?i.trim():""}function We(e){if(!e.children.length)return(e.textContent||"").trim();let t=[];for(let n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE){let r=(n.textContent||"").trim();r&&t.push(r)}else if(n.nodeType===Node.ELEMENT_NODE){let r=n;if(Ms(r))continue;let o=ks(r),i=We(r);i&&(o&&t.length>0&&t.push(" "),t.push(i),o&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function As(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return We(n)}let t=e.closest("label");if(t){let n=t.cloneNode(!0),r=n.querySelector("input, textarea, select");r&&r.remove();let o=n.textContent?.trim();if(o)return o}return null}function ks(e){try{return!getComputedStyle(e).display.includes("inline")}catch{let t=e.tagName.toLowerCase();return["div","p","h1","h2","h3","h4","h5","h6","li","section","article","header","footer","nav","main","aside","blockquote","pre","form","fieldset","table","tr","br"].includes(t)}}function Ms(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||e.getAttribute("aria-hidden")==="true")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return!0}catch{}return!1}function On(e,t){try{let n=getComputedStyle(e,t).content;if(!n||n==="none"||n==="normal")return"";let r=n.match(/^["'](.*)["']$/);return r?r[1]:""}catch{return""}}function $t(){E().networkIdle.activeRequests++}function pt(){let e=E().networkIdle;e.activeRequests=Math.max(0,e.activeRequests-1)}function Zr(e=5e3,t=200){return new Promise((n,r)=>{let o=Date.now()+e,i=null;function a(){if(Date.now()>o){i&&clearTimeout(i),n();return}E().networkIdle.activeRequests===0?i||(i=setTimeout(()=>{E().networkIdle.activeRequests===0?n():(i=null,a())},t)):(i&&(clearTimeout(i),i=null),setTimeout(a,50))}a()})}function Xe(){return E().snapshot.refMap}async function Ke(){return await Zr(),Dn()}function Dn(){let e=E().snapshot;e.refCounter=0,e.refMap=new Map;let t=document.body;if(!t)return"(empty page)";let n=Xr(t);return Pn(n,0).trimEnd()}function he(e){let t=ye(e),n=Se(e),r=n.length>60?n.slice(0,57)+"...":n;if(t&&r)return`${t} "${r}"`;if(t)return t;if(r)return`"${r}"`;let o=e.tagName.toLowerCase();return e.id?`${o}#${e.id}`:o}function Xr(e){if(Ns(e))return[];let t=ye(e),n=!t&&jr(e),r=t||(n?"clickable":null),o="";if(r){o=Se(e);let u=On(e,"::before"),d=On(e,"::after");(u||d)&&(o=[u,o,d].filter(Boolean).join(" ")),o.length>80&&(o=o.slice(0,77)+"...")}let i=Ls(e),a=t==="button"||t==="link"||t==="textbox"||t==="combobox"||t==="checkbox"||t==="radio"||t==="slider"||t==="tab"||t==="menuitem"||n,s=r&&o&&!a,c=null;if(a||s){let u=E().snapshot;u.refCounter++,c=`e${u.refCounter}`,u.refMap.set(c,e)}let l=Ts(e);if(r){let u=l.length===0?"":Pn(l,0).trim();return[{tag:r,name:o,attrs:i,ref:c,children:u&&u===o?[]:l,element:e}]}if(l.length===0){let u=We(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return l}function Ts(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...Xr(n));return t}function Ns(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||t==="head"||e.getAttribute("aria-hidden")==="true"||e.id==="__mindstudio-browser-agent"||e.id==="__mindstudio-cursor"||e.id==="__mindstudio-cursor-ripple"||e.id==="__mindstudio-notes-host")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"&&n.position!=="static")return!0}catch{}return!1}function Ls(e){let t=[],n=e.tagName.toLowerCase();if((n==="dialog"&&e.open||n==="details"&&e.open)&&t.push("open"),e.disabled&&t.push("disabled"),n==="input"){let i=e;(i.type==="checkbox"||i.type==="radio")&&i.checked&&t.push("checked")}if(n==="input"){let i=e;i.type!=="checkbox"&&i.type!=="radio"&&i.type!=="hidden"&&i.type!=="submit"&&i.type!=="button"&&i.type!=="reset"&&(t.push(`value="${i.value}"`),i.placeholder&&t.push(`placeholder="${i.placeholder}"`))}if(n==="textarea"){let i=e;t.push(`value="${i.value}"`),i.placeholder&&t.push(`placeholder="${i.placeholder}"`)}if(n==="select"){let i=e,a=i.options[i.selectedIndex];a&&t.push(`value="${a.text}"`)}let r=n.match(/^h([1-6])$/);r&&t.push(`level=${r[1]}`);let o=e.getAttribute("aria-expanded");return o==="true"&&t.push("expanded"),o==="false"&&t.push("collapsed"),e.getAttribute("aria-selected")==="true"&&t.push("selected"),e.getAttribute("aria-pressed")==="true"&&t.push("pressed"),t}function Pn(e,t){let n="";for(let r of e)n+=Rs(r,t);return n}function Rs(e,t){let n=" ".repeat(t),r=[];e.tag&&r.push(e.tag),e.name&&r.push(`"${e.name}"`);for(let a of e.attrs)r.push(`[${a}]`);e.ref&&r.push(`[ref=${e.ref}]`);let o="";r.length>0&&(o+=`${n}${r.join(" ")}
1
+ "use strict";var __MindStudioBrowserAgent=(()=>{var Nn=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var gs=Object.getOwnPropertyNames;var ys=Object.prototype.hasOwnProperty;var Ln=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var bs=(e,t)=>{for(var n in t)Nn(e,n,{get:t[n],enumerable:!0})},ws=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of gs(t))!ys.call(e,o)&&o!==n&&Nn(e,o,{get:()=>t[o],enumerable:!(r=hs(t,o))||r.enumerable});return e};var vs=e=>ws(Nn({},"__esModule",{value:!0}),e);var Af={};bs(Af,{executeSteps:()=>nn,getRefMap:()=>Xe,resolveElement:()=>Ne,takeSnapshot:()=>Ke,takeSnapshotSync:()=>Dn});var Rn="__ms";function Cs(){return{ws:{ws:null,clientId:null,reconnectDelay:1e3,closing:!1,busy:!1},cursor:{el:null,rippleEl:null,x:-100,y:-100,hasPosition:!1,hideTimer:null,executing:!1,targetElement:null,trackingFrame:null,settledResolve:null,visibilityState:"hidden",preSnapshotState:null},snapshot:{refCounter:0,refMap:new Map},networkIdle:{activeRequests:0},transport:{buffer:[],flushTimer:null,capturing:!1,captured:[],wsGetter:null},noteLayer:{host:null,overlay:null,cursorEl:null,notes:[],currentNote:null,pointerDown:!1,startX:0,startY:0,didDrag:!1,consumedByDeactivation:!1,dragPreview:null,movingNote:null,moveOffsetX:0,moveOffsetY:0},noteElement:{counter:0},notesMode:{active:!1,wasTouchActive:!1},messages:{handler:null},screenshot:{cameraEl:null,flashEl:null,capturing:!1},fonts:{initialized:!1,observer:null},zoom:{pipMode:!1,mobilePreview:!1},touch:{circleEl:null,active:!1,pressed:!1,dragging:!1,startX:0,startY:0,lastX:0,lastY:0,onMouseMove:null,onMouseDown:null,onMouseUp:null,onMouseLeave:null,onDragStart:null,momentumFrame:null,overscrollY:0,bouncing:!1,bounceTimer:null,scrollContainer:null,velocityX:0,velocityY:0,lastMoveTime:0},mirror:{recording:!1,stopFn:null},browserStash:null}}function E(){let e=window;return e[Rn]||(e[Rn]=Cs()),e[Rn]}var Gr="/__mindstudio_dev__/logs",Ss=2e3;function zr(e){E().transport.wsGetter=e}function Yr(){let e=E().transport;if(e.buffer.length===0)return;let t=e.buffer;e.buffer=[];let n=e.wsGetter?.();if(n&&n.readyState===WebSocket.OPEN)try{n.send(JSON.stringify({type:"log",entries:t}));return}catch{}try{let r=new XMLHttpRequest;r.open("POST",Gr,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t))}catch{}}function xs(){let e=E().transport;e.flushTimer||(e.flushTimer=setTimeout(()=>{e.flushTimer=null,Yr()},Ss))}function Is(){let e=E().transport;e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),Yr()}function pe(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),xs()}function Fn(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),Is()}function _n(){let e=E().transport;e.capturing=!0,e.captured=[]}function $n(){let e=E().transport;e.capturing=!1;let t=e.captured;return e.captured=[],t}function qr(){window.addEventListener("beforeunload",()=>{let e=E().transport;e.buffer.length>0&&navigator.sendBeacon&&navigator.sendBeacon(Gr,JSON.stringify(e.buffer))})}var Es={a:"link",button:"button",input:"textbox",textarea:"textbox",select:"combobox",option:"option",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",dialog:"dialog",details:"group",summary:"button",img:"img",ul:"list",ol:"list",li:"listitem",table:"table",tr:"row",th:"columnheader",td:"cell",form:"form",article:"article",section:"region",label:"label",fieldset:"group",legend:"legend",p:"paragraph",blockquote:"blockquote",pre:"code",code:"code",hr:"separator",progress:"progressbar"};function ye(e){let t=e.getAttribute("role");if(t)return t==="presentation"||t==="none"?null:t;let n=e.tagName.toLowerCase();if(n==="a")return e.hasAttribute("href")?"link":null;if(n==="section")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"region":null;if(n==="form")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"form":null;if(n==="img")return e.alt===""?null:"img";if(n==="input")switch(e.type){case"checkbox":return"checkbox";case"radio":return"radio";case"range":return"slider";case"submit":case"button":case"reset":return"button";case"hidden":return null;default:return"textbox"}return Es[n]??null}function jr(e){if(e.hasAttribute("onclick")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1")return!0;try{if(getComputedStyle(e).cursor==="pointer")return!0}catch{}return!1}function Se(e){let t=e.getAttribute("aria-label");if(t)return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let a=n.split(/\s+/).map(s=>{let c=document.getElementById(s);return c?We(c):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=As(e);if(a)return a}if(r==="img"){let a=e.alt;if(a)return a.trim()}if(r==="fieldset"){let a=e.querySelector("legend");if(a)return We(a)}let o=We(e);if(o)return o;let i=e.getAttribute("title");return i?i.trim():""}function We(e){if(!e.children.length)return(e.textContent||"").trim();let t=[];for(let n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE){let r=(n.textContent||"").trim();r&&t.push(r)}else if(n.nodeType===Node.ELEMENT_NODE){let r=n;if(Ms(r))continue;let o=ks(r),i=We(r);i&&(o&&t.length>0&&t.push(" "),t.push(i),o&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function As(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return We(n)}let t=e.closest("label");if(t){let n=t.cloneNode(!0),r=n.querySelector("input, textarea, select");r&&r.remove();let o=n.textContent?.trim();if(o)return o}return null}function ks(e){try{return!getComputedStyle(e).display.includes("inline")}catch{let t=e.tagName.toLowerCase();return["div","p","h1","h2","h3","h4","h5","h6","li","section","article","header","footer","nav","main","aside","blockquote","pre","form","fieldset","table","tr","br"].includes(t)}}function Ms(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||e.getAttribute("aria-hidden")==="true")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return!0}catch{}return!1}function On(e,t){try{let n=getComputedStyle(e,t).content;if(!n||n==="none"||n==="normal")return"";let r=n.match(/^["'](.*)["']$/);return r?r[1]:""}catch{return""}}function $t(){E().networkIdle.activeRequests++}function pt(){let e=E().networkIdle;e.activeRequests=Math.max(0,e.activeRequests-1)}function Zr(e=5e3,t=200){return new Promise((n,r)=>{let o=Date.now()+e,i=null;function a(){if(Date.now()>o){i&&clearTimeout(i),n();return}E().networkIdle.activeRequests===0?i||(i=setTimeout(()=>{E().networkIdle.activeRequests===0?n():(i=null,a())},t)):(i&&(clearTimeout(i),i=null),setTimeout(a,50))}a()})}function Xe(){return E().snapshot.refMap}async function Ke(){return await Zr(),Dn()}function Dn(){let e=E().snapshot;e.refCounter=0,e.refMap=new Map;let t=document.body;if(!t)return"(empty page)";let n=Xr(t);return Pn(n,0).trimEnd()}function he(e){let t=ye(e),n=Se(e),r=n.length>60?n.slice(0,57)+"...":n;if(t&&r)return`${t} "${r}"`;if(t)return t;if(r)return`"${r}"`;let o=e.tagName.toLowerCase();return e.id?`${o}#${e.id}`:o}function Xr(e){if(Ns(e))return[];let t=ye(e),n=!t&&jr(e),r=t||(n?"clickable":null),o="";if(r){o=Se(e);let u=On(e,"::before"),d=On(e,"::after");(u||d)&&(o=[u,o,d].filter(Boolean).join(" ")),o.length>80&&(o=o.slice(0,77)+"...")}let i=Ls(e),a=t==="button"||t==="link"||t==="textbox"||t==="combobox"||t==="checkbox"||t==="radio"||t==="slider"||t==="tab"||t==="menuitem"||n,s=r&&o&&!a,c=null;if(a||s){let u=E().snapshot;u.refCounter++,c=`e${u.refCounter}`,u.refMap.set(c,e)}let l=Ts(e);if(r){let u=l.length===0?"":Pn(l,0).trim();return[{tag:r,name:o,attrs:i,ref:c,children:u&&u===o?[]:l,element:e}]}if(l.length===0){let u=We(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return l}function Ts(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...Xr(n));return t}function Ns(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||t==="head"||e.getAttribute("aria-hidden")==="true"||e.id==="__mindstudio-browser-agent"||e.id==="__mindstudio-cursor"||e.id==="__mindstudio-cursor-ripple"||e.id==="__mindstudio-notes-host")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"&&n.position!=="static")return!0}catch{}return!1}function Ls(e){let t=[],n=e.tagName.toLowerCase();if((n==="dialog"&&e.open||n==="details"&&e.open)&&t.push("open"),e.disabled&&t.push("disabled"),n==="input"){let i=e;(i.type==="checkbox"||i.type==="radio")&&i.checked&&t.push("checked")}if(n==="input"){let i=e;i.type!=="checkbox"&&i.type!=="radio"&&i.type!=="hidden"&&i.type!=="submit"&&i.type!=="button"&&i.type!=="reset"&&(t.push(`value="${i.value}"`),i.placeholder&&t.push(`placeholder="${i.placeholder}"`))}if(n==="textarea"){let i=e;t.push(`value="${i.value}"`),i.placeholder&&t.push(`placeholder="${i.placeholder}"`)}if(n==="select"){let i=e,a=i.options[i.selectedIndex];a&&t.push(`value="${a.text}"`)}let r=n.match(/^h([1-6])$/);r&&t.push(`level=${r[1]}`);let o=e.getAttribute("aria-expanded");return o==="true"&&t.push("expanded"),o==="false"&&t.push("collapsed"),e.getAttribute("aria-selected")==="true"&&t.push("selected"),e.getAttribute("aria-pressed")==="true"&&t.push("pressed"),t}function Pn(e,t){let n="";for(let r of e)n+=Rs(r,t);return n}function Rs(e,t){let n=" ".repeat(t),r=[];e.tag&&r.push(e.tag),e.name&&r.push(`"${e.name}"`);for(let a of e.attrs)r.push(`[${a}]`);e.ref&&r.push(`[ref=${e.ref}]`);let o="";r.length>0&&(o+=`${n}${r.join(" ")}
2
2
  `);let i=r.length>0?t+1:t;return o+=Pn(e.children,i),o}function Kr(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e instanceof Error)return e.stack||e.message||String(e);if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function ae(e){return new Promise(t=>setTimeout(t,e))}function Be(){let e=null,t=0;for(let n of document.querySelectorAll("*")){let r=n,o=getComputedStyle(r).overflowY;if(o!=="auto"&&o!=="scroll")continue;let i=r.scrollHeight-r.clientHeight;i<=20||i>t&&(t=i,e=r)}return e??document.documentElement}var Fs=["log","info","warn","error","debug"];function Jr(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of Fs){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),pe({type:"console",level:e,args:n.map(Kr),url:location.href})}}}}function Qr(){window.__ms_error_patched||(window.__ms_error_patched=!0,window.addEventListener("error",e=>{Fn({type:"error",message:e.message,stack:e.error&&e.error.stack||"",source:e.filename,line:e.lineno,column:e.colno,url:location.href})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason||{};Fn({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})}))}function eo(){if(!window.fetch||window.fetch.__ms_patched)return;let e=window.fetch;window.fetch=function(t,n){let r=(n?.method||"GET").toUpperCase(),o=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(o.includes("/__mindstudio_dev__/"))return e.apply(this,[t,n]);let i=Date.now();return $t(),e.apply(this,[t,n]).then(a=>{pt();let s={type:"network",method:r,url:o,status:a.status,statusText:a.statusText,duration:Date.now()-i,ok:a.ok};if(a.ok)pe(s);else try{a.clone().text().then(c=>{s.body=c.slice(0,1e3),pe(s)}).catch(()=>pe(s))}catch{pe(s)}return a},a=>{throw pt(),pe({type:"network",method:r,url:o,error:a.message||String(a),duration:Date.now()-i,ok:!1}),a})},window.fetch.__ms_patched=!0}function to(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);pe({type:"interaction",event:"click",target:he(t),text:n,url:location.href})},!0))}function no(){if(XMLHttpRequest.prototype.open.__ms_patched)return;let e=window.XMLHttpRequest,t=e.prototype.open,n=e.prototype.send;e.prototype.open=function(r,o,...i){return this.__ms_method=r.toUpperCase(),this.__ms_url=String(o),t.apply(this,[r,o,...i])},e.prototype.send=function(r){let o=this.__ms_method||"GET",i=this.__ms_url||"";if(i.includes("/__mindstudio_dev__/"))return n.apply(this,[r]);let a=Date.now();return $t(),this.addEventListener("loadend",function(){pt(),pe({type:"network",method:o,url:i,status:this.status,statusText:this.statusText,duration:Date.now()-a,ok:this.status>=200&&this.status<300,...this.status>=400?{body:(this.responseText||"").slice(0,1e3)}:{},via:"xhr"})},{once:!0}),n.apply(this,[r])},XMLHttpRequest.prototype.open.__ms_patched=!0}function Ne(e){let t=null;if(e.ref){let n=Xe(),r=n.get(e.ref);if(r&&r.isConnected)if(Te(r))t={element:r,matched:`${he(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${Wn(r)}). It may be inside a closed dialog or collapsed section.`);else{let o=[...n.entries()].filter(([,i])=>i.isConnected&&Te(i)).slice(0,10).map(([i,a])=>`${he(a)} [ref=${i}]`).join(", ");throw new Error(`Element [ref=${e.ref}] not found. `+(o?`Available refs: ${o}`:"No refs available \u2014 take a snapshot first."))}}if(!t&&(e.text||e.role&&e.text)){let n=e.text,r=e.role,o=ro(n,r);if(o.length===0){let i=ro(n,r,!0);if(i.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${Wn(i[0])}). Wait for it to become visible or check if a dialog/modal needs to be opened first.`);let a=r?`${r} "${n}"`:`"${n}"`,s=oo(r);throw new Error(`No element found matching ${a}. `+(s?`Visible ${r||"element"}s: ${s}`:"The page may still be loading \u2014 try a wait command first."))}if(o.length>1){let i=o.filter(io),a=i.length===1?i[0]:o[0];t={element:a,matched:he(a)}}else t={element:o[0],matched:he(o[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=_s(n);if(r.length===0){let o=oo(n);throw new Error(`No visible element with role "${n}" found. `+(o?`Visible ${n}s: ${o}`:"The page may still be loading \u2014 try a wait command first."))}t={element:r[0],matched:he(r[0])}}if(!t&&e.label){let n=e.label,r=$s(n);if(!r){let o=[...document.querySelectorAll("label")].filter(Te).map(i=>`"${(i.textContent||"").trim().slice(0,40)}"`).slice(0,8).join(", ");throw new Error(`No input found with label "${n}". `+(o?`Visible labels: ${o}`:"No labels found on the page."))}t={element:r,matched:`${he(r)} via label "${n}"`}}if(!t&&e.selector){let n=e.selector,r=document.querySelector(n);if(!r)throw new Error(`No element found for selector "${n}".`);if(!Te(r))throw new Error(`Found element for selector "${n}" but it is hidden (${Wn(r)}).`);t={element:r,matched:`${he(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function ro(e,t,n=!1){let r=[],o=e.toLowerCase();for(let i of document.querySelectorAll("*")){if(!n&&!Te(i)||n&&!i.isConnected||t&&ye(i)!==t)continue;if(Se(i).toLowerCase().includes(o)){r.push(i);continue}i.children.length||(i.textContent||"").trim().toLowerCase().includes(o)&&r.push(i)}return r}function _s(e){let t=[];for(let n of document.querySelectorAll("*"))Te(n)&&ye(n)===e&&t.push(n);return t}function $s(e){let t=e.toLowerCase();for(let n of document.querySelectorAll("label")){if(!(n.textContent||"").trim().toLowerCase().includes(t))continue;let o=n.getAttribute("for");if(o){let a=document.getElementById(o);if(a&&Te(a))return a}let i=n.querySelector("input, textarea, select");if(i&&Te(i))return i}return null}function Te(e){if(!e.isConnected)return!1;try{let t=getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden")return!1}catch{return!1}return!0}function io(e){if(e.matches('a, button, input, textarea, select, [role="button"], [role="link"], [tabindex]'))return!0;try{return getComputedStyle(e).cursor==="pointer"}catch{return!1}}function Wn(e){try{let t=getComputedStyle(e);if(t.display==="none")return"display: none";if(t.visibility==="hidden")return"visibility: hidden"}catch{}return e.getAttribute("aria-hidden")==="true"?'aria-hidden="true"':"hidden"}function oo(e){let t=[];for(let n of document.querySelectorAll("*"))if(Te(n)&&(e?ye(n)===e&&t.push(n):io(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${Se(n).slice(0,40)||he(n)}"`).join(", ")}function Bn(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r,button:0};e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1})),e.dispatchEvent(new MouseEvent("mousedown",o)),e instanceof HTMLElement&&e.focus(),e.dispatchEvent(new PointerEvent("pointerup",{...o,pointerId:1})),e.dispatchEvent(new MouseEvent("mouseup",o)),e.dispatchEvent(new MouseEvent("click",o))}var Os=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,Ds=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function lo(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),Bn(e),n.clear&&(ao(e,""),e.dispatchEvent(new Event("input",{bubbles:!0})));for(let r=0;r<t.length;r++){let o=t[r];e.dispatchEvent(new KeyboardEvent("keydown",{key:o,code:`Key${o.toUpperCase()}`,bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:o,code:`Key${o.toUpperCase()}`,bubbles:!0})),ao(e,e.value+o),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:o,code:`Key${o.toUpperCase()}`,bubbles:!0})),await ae(Ps(o,t.length))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function Ps(e,t){let n=Math.random()*50-25,r;if(e===" "?r=120+n:/[.,!?;:\-]/.test(e)?r=140+n:/[A-Z]/.test(e)?r=115+n:r=85+n,t<=20)return r;let o=Math.max(.1,20/t);return r*o}function ao(e,t){let n=e instanceof HTMLTextAreaElement?Ds:Os;n?n.call(e,t):e.value=t}async function co(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...Ne(e),elapsed:Date.now()-n}}catch{await ae(100)}let o=e.text?`"${e.text}"`:e.role?`role "${e.role}"`:e.selector?`selector "${e.selector}"`:"element";throw new Error(`Timed out waiting for ${o} after ${t}ms`)}var so=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function uo(e,t){if(!(e instanceof HTMLSelectElement))throw new Error("select command requires a <select> element");let n=t.toLowerCase(),r=null;for(let o of e.options)if(o.text.toLowerCase().includes(n)||o.value.toLowerCase()===n||o.label.toLowerCase().includes(n)){r=o;break}if(!r){let o=[...e.options].map(i=>`"${i.text}"`).join(", ");throw new Error(`No option matching "${t}" in select. Available options: ${o}`)}return so?so.call(e,r.value):e.value=r.value,e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new Event("input",{bubbles:!0})),r.text}async function fo(e){try{let n=!/\b(return|;|\{)\b/.test(e.trim())?`return (${e})`:e,o=new Function(n)();return o instanceof Promise?await o:o}catch(t){throw new Error(`evaluate failed: ${t instanceof Error?t.message:String(t)}`)}}var Bs=Object.defineProperty,fe=(e,t)=>()=>(e&&(t=e(e=0)),t),Ct=(e,t)=>{for(var n in t)Bs(e,n,{get:t[n],enumerable:!0})};function Hs(e){if(e===!0)return"soft";if(e===!1)return"disabled";if(typeof e=="string"){let t=e.toLowerCase().trim();if(t==="auto")return"auto";if(t==="full")return"full";if(t==="soft"||t==="disabled")return t}return"soft"}function Us(e="soft"){switch(A.session.__counterEpoch=(A.session.__counterEpoch||0)+1,e){case"auto":{A.session.styleMap=new Map,A.session.nodeMap=new Map;return}case"soft":{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap,A.computedStyle=new WeakMap,A.baseStyle=new ge(50),A.defaultStyle=new ge(30),A.image=new ge(100),A.background=new ge(100),A.resource=new ge(150),A.font=new Set;return}default:{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap;return}}}var ge,A,we=fe(()=>{ge=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let n=this.keys().next().value;n!==void 0&&this.delete(n)}return super.set(e,t)}},A={image:new ge(100),background:new ge(100),resource:new ge(150),defaultStyle:new ge(30),baseStyle:new ge(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function tr(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function Vs(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(i=>i.trim());return o.length!==6?`matrix(${r})`:(o[4]="0",o[5]="0",`matrix(${o.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let o=r.split(",").map(i=>i.trim());return o.length!==16?`matrix3d(${r})`:(o[12]="0",o[13]="0",`matrix3d(${o.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function Vt(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function Gs(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let n=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,n).href}catch{return e}}var zt=fe(()=>{});function zs(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,o=0;function i(a,s,c){if(o>=n)return;let l=Date.now();(r.get(s)||0)>l||(r.set(s,l+t),o++,a==="warn"&&console&&console.warn?console.warn(`${e} ${c}`):console&&console.error&&console.error(`${e} ${c}`))}return{warnOnce(a,s){i("warn",a,s)},errorOnce(a,s){i("error",a,s)},reset(){r.clear(),o=0}}}function Ys(e){return/^data:|^blob:|^about:blank$/i.test(e)}function qs(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=t.includes("{url}")?t.split("{url}")[0]:t,o=new URL(r||".",n),i=new URL(e,n);if(i.origin===o.origin)return!0;let a=i.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function js(e,t){if(!t||Ys(e)||qs(e,t))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(e,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!t}}function Zs(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",Vt(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${Vt(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function mo(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(e)})}function Xs(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function be(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,o=t.useProxy||"",i=t.errorTTL??8e3,a=t.headers||{},s=!!t.silent;if(/^data:/i.test(e))try{if(n==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,h="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],v=/;base64/i.test(h)?atob(y):decodeURIComponent(y),b=new Uint8Array([...v].map(S=>S.charCodeAt(0))),w=new Blob([b],{type:(h||"").split(";")[0]||""});return{ok:!0,data:w,status:200,url:e,fromCache:!1,mime:w.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let h=await fetch(e);if(!h.ok)return{ok:!1,data:null,status:h.status,url:e,fromCache:!1,reason:"http_error"};let y=await h.blob(),v=y.type||h.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await mo(y),status:h.status,url:e,fromCache:!1,mime:v}:n==="text"?{ok:!0,data:await y.text(),status:h.status,url:e,fromCache:!1,mime:v}:{ok:!0,data:y,status:h.status,url:e,fromCache:!1,mime:v}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let c=Xs(e,{as:n,timeout:r,useProxy:o,errorTTL:i}),l=gt.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&gt.delete(c);let u=Dt.get(c);if(u)return u;let d=js(e,o)?Zs(e,o):e,f=t.credentials;if(!f)try{let h=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,h);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let m=new AbortController,p=setTimeout(()=>m.abort("timeout"),r),g=(async()=>{try{let h=await fetch(d,{signal:m.signal,credentials:f,headers:a});if(!h.ok){let b={ok:!1,data:null,status:h.status,url:d,fromCache:!1,reason:"http_error"};if(i>0&&gt.set(c,{until:Date.now()+i,result:b}),!s){let w=`${h.status} ${h.statusText||""}`.trim();Vn.warnOnce(`http:${h.status}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${e}`)}return t.onError&&t.onError(b),b}if(n==="text")return{ok:!0,data:await h.text(),status:h.status,url:d,fromCache:!1};let y=await h.blob(),v=y.type||h.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await mo(y),status:h.status,url:d,fromCache:!1,mime:v}:{ok:!0,data:y,status:h.status,url:d,fromCache:!1,mime:v}}catch(h){let y=h&&typeof h=="object"&&"name"in h&&h.name==="AbortError"?String(h.message||"").includes("timeout")?"timeout":"abort":"network",v={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&i>0&&gt.set(c,{until:Date.now()+i,result:v}),!s){let b=`${y}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,w=y==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;Vn.errorOnce(b,w)}return t.onError&&t.onError(v),v}finally{clearTimeout(p),Dt.delete(c)}})();return Dt.set(c,g),g}var Vn,Dt,gt,nt=fe(()=>{zt(),Vn=zs("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Dt=new Map,gt=new Map});async function Do(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=tr(e);if(!n)return e;let r=Gs(n),o=Vt(r);if(A.background.has(o)){let i=A.background.get(o);return i?`url("${i}")`:"none"}try{let i=await be(o,{as:"dataURL",useProxy:t.useProxy});return i.ok?(A.background.set(o,i.data),`url("${i.data}")`):(A.background.set(o,null),"none")}catch{return A.background.set(o,null),"none"}}var Ks=fe(()=>{we(),zt(),nt()});function Js(e){if(e=String(e).toLowerCase(),rr.has(e)){let i={};return A.defaultStyle.set(e,i),i}if(A.defaultStyle.has(e))return A.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let n=document.createElement(e);n.style.all="initial",t.appendChild(n);let r=getComputedStyle(n),o={};for(let i of r){if(nr(i))continue;let a=r.getPropertyValue(i);o[i]=a}return t.removeChild(n),A.defaultStyle.set(e,o),o}function nr(e){let t=String(e).toLowerCase();return!!(Ho.has(t)||Bo.test(t)||Wo.test(t))}function Gn(e,t){if(t=String(t||"").toLowerCase(),rr.has(t))return"";let n=[],r=Js(t),o=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[i,a]of Object.entries(e)){if(nr(i)||o&&(i==="width"||i==="min-width"||i==="max-width"))continue;let s=r[i];a&&a!==s&&n.push(`${i}:${a}`)}return n.sort(),n.join(";")}function Qs(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(n=>t.add(n.tagName.toLowerCase())),Array.from(t))}function el(e){let t=new Map;for(let r of e){let o=A.defaultStyle.get(r);if(!o)continue;let i=Object.entries(o).map(([a,s])=>`${a}:${s};`).sort().join("");i&&(t.has(i)||t.set(i,[]),t.get(i).push(r))}let n="";for(let[r,o]of t.entries())n+=`${o.join(",")} { ${r} }
3
3
  `;return n}function tl(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let o of t)n.set(o,`c${r++}`);return n}function nl(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let r=0;r<window.frames.length;r++)try{if(window.frames[r]?.document===t)return window.frames[r]}catch{}}catch{}return typeof window<"u"?window:null}function Re(e,t=null){let n=()=>{let i={length:0,getPropertyValue:()=>"",item:()=>""};return i[Symbol.iterator]=function*(){},i};if(!(e instanceof Element)){let i=typeof window<"u"?window:null;if(i&&typeof i.getComputedStyle=="function")try{return i.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=A.computedStyle.get(e);r||(r=new Map,A.computedStyle.set(e,r));let o=r.get(t);if(!o){let i=nl(e),a=null;try{a=i&&typeof i.getComputedStyle=="function"?i.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}o=a||n(),r.set(t,o)}return o}function po(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function zn(e){let t=[],n=0,r=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("&&n++,i===")"&&n--,i===","&&n===0&&(t.push(e.slice(r,o).trim()),r=o+1)}return t.push(e.slice(r).trim()),t}var Po,rr,rl,Wo,Bo,Ho,Uo=fe(()=>{we(),Po=new Set(["meta","script","noscript","title","link","template"]),rr=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),rl=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"],Wo=/(?:^|-)(animation|transition)(?:-|$)/i,Bo=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Ho=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom"])});function et(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ol(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function Ue(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),n=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),r=/applewebkit/i.test(e),o=/mobile/i.test(e),i=!/safari/i.test(e),a=r&&o&&i,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),l=/ipad|iphone|ipod/.test(t)&&r;return n||a||s||c||l}function il(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var St=fe(()=>{});function X(e,t,n){let r=e&&typeof e=="object"&&(e.options||e);r&&r.debug&&(n!==void 0?console.warn("[snapdom]",t,n):console.warn("[snapdom]",t))}var Vo=fe(()=>{}),Ie=fe(()=>{Ks(),Uo(),St(),zt(),Vo()}),Go={};Ct(Go,{toCanvas:()=>Yt});function al(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function sl(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function ll(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function cl(e){let t=[],n="",r=0;for(let o=0;o<e.length;o++){let i=e[o];i==="("&&r++,i===")"&&(r=Math.max(0,r-1)),i===";"&&r===0?(t.push(n),n=""):n+=i}return n.trim()&&t.push(n),t.map(o=>o.trim()).filter(Boolean)}function ul(e){let t=[],n="",r=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===","&&r===0?(t.push(n.trim()),n=""):n+=a}n.trim()&&t.push(n.trim());let o=[];for(let i of t){if(/\binset\b/i.test(i))continue;let a=i.match(/-?\d+(?:\.\d+)?px/gi)||[],[s="0px",c="0px",l="0px"]=a,u=i.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";o.push(`drop-shadow(${s} ${c} ${l}${d?` ${u}`:""})`)}return o.join(" ")}function zo(e){let t=cl(e),n=null,r=null,o=null,i=[];for(let s of t){let c=s.indexOf(":");if(c<0)continue;let l=s.slice(0,c).trim().toLowerCase(),u=s.slice(c+1).trim();l==="box-shadow"?o=u:l==="filter"?n=u:l==="-webkit-filter"?r=u:i.push([l,u])}if(o){let s=ul(o);s&&(n=n?`${n} ${s}`:s,r=r?`${r} ${s}`:s)}let a=[...i];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([s,c])=>`${s}:${c}`).join(";")}function dl(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${zo(r)}}`)}function fl(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,dl(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${zo(r)}${n}`),e}function ml(e){if(!Ue()||!al(e))return e;try{let t=sl(e),n=fl(t);return ll(n)}catch{return e}}async function Yt(e,t){let{width:n,height:r,scale:o=1,dpr:i=1,meta:a={},backgroundColor:s}=t;e=ml(e);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=e,await c.decode();let l=c.naturalWidth,u=c.naturalHeight,d=Number.isFinite(a.w0)?a.w0:l,f=Number.isFinite(a.h0)?a.h0:u,m,p,g=Number.isFinite(n),h=Number.isFinite(r);if(g&&h)m=Math.max(1,n),p=Math.max(1,r);else if(g){let b=n/Math.max(1,d);m=n,p=f*b}else if(h){let b=r/Math.max(1,f);p=r,m=d*b}else m=l,p=u;m=m*o,p=p*o;let y=document.createElement("canvas");y.width=m*i,y.height=p*i,y.style.width=`${m}px`,y.style.height=`${p}px`;let v=y.getContext("2d");return i!==1&&v.scale(i,i),s&&(v.save(),v.fillStyle=s,v.fillRect(0,0,m,p),v.restore()),v.drawImage(c,0,0,m,p),y}var qt=fe(()=>{St()}),Pt={};Ct(Pt,{rasterize:()=>Yo});async function Yo(e,t){let n=await Yt(e,t),r=new Image;return r.src=n.toDataURL(`image/${t.format}`,t.quality),await r.decode(),r.style.width=`${n.width/t.dpr}px`,r.style.height=`${n.height/t.dpr}px`,r}var Wt=fe(()=>{qt()}),Yn={};Ct(Yn,{toImg:()=>ho,toSvg:()=>ho});async function ho(e,t){let{scale:n=1,width:r,height:o,meta:i={}}=t,a=Number.isFinite(r),s=Number.isFinite(o),c=Number.isFinite(n)&&n!==1||a||s;if(Ue()&&c)return await Yo(e,{...t,format:"png",quality:1,meta:i});let l=new Image;if(l.decoding="sync",l.loading="eager",l.src=e,await l.decode(),a&&s)l.style.width=`${r}px`,l.style.height=`${o}px`;else if(a){let u=Number.isFinite(i.w0)?i.w0:l.naturalWidth,d=Number.isFinite(i.h0)?i.h0:l.naturalHeight,f=r/Math.max(1,u);l.style.width=`${r}px`,l.style.height=`${Math.round(d*f)}px`}else if(s){let u=Number.isFinite(i.w0)?i.w0:l.naturalWidth,d=Number.isFinite(i.h0)?i.h0:l.naturalHeight,f=o/Math.max(1,d);l.style.height=`${o}px`,l.style.width=`${Math.round(u*f)}px`}else{let u=Math.round(l.naturalWidth*n),d=Math.round(l.naturalHeight*n);if(l.style.width=`${u}px`,l.style.height=`${d}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let f=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${d}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,l.src=e}catch(f){X(t,"SVG width/height patch in toImg failed",f)}}return l}var go=fe(()=>{Ie(),Wt()}),qo={};Ct(qo,{toBlob:()=>jo});async function jo(e,t){let n=t.type;if(n==="svg"){let o=decodeURIComponent(e.split(",")[1]);return new Blob([o],{type:"image/svg+xml"})}let r=await Yt(e,t);return new Promise(o=>r.toBlob(i=>o(i),`image/${n}`,t.quality))}var Zo=fe(()=>{qt()}),Xo={};Ct(Xo,{download:()=>pl});async function yo(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(r){if(r.name!=="AbortError")return!1}return!0}async function pl(e,t){let n=new Set(["png","jpeg","jpg","webp","svg"]),r=(t?.type||"").toLowerCase(),o=n.has(r)?r:"",i=(t?.format||o||"").toLowerCase(),a=i==="jpg"?"jpeg":i||"png",s=t?.filename||`snapdom.${a}`,c={...t||{},format:a,type:a};c.dpr=1;let l=ol();if(a==="svg"){let f=await jo(e,{...c,type:"svg"});if(l&&await yo(f,s))return;let m=URL.createObjectURL(f),p=document.createElement("a");p.href=m,p.download=s,document.body.appendChild(p),p.click(),URL.revokeObjectURL(m),p.remove();return}let u=await Yt(e,c);if(l){let f=`image/${a}`,m=await new Promise(p=>u.toBlob(p,f,t?.quality));if(m&&await yo(m,s))return}let d=document.createElement("a");d.href=u.toDataURL(`image/${a}`,t?.quality),d.download=s,document.body.appendChild(d),d.click(),d.remove()}var hl=fe(()=>{Zo(),qt(),St()});Ie();Ie();we();var bo=new WeakMap,wt=new Map,gl=2e3,qn=0;function yt(){qn++,wt.size>gl&&wt.clear()}var wo=!1;function yl(e=document.documentElement){if(!wo){wo=!0;try{new MutationObserver(()=>yt()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>yt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",yt),t.ready?.then(()=>yt()).catch(()=>{}))}catch{}}}function bl(e,t={}){let n={},r=e.getPropertyValue("visibility"),o=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(nr(f)||o&&(o instanceof RegExp&&o.test(f)||typeof o=="function"&&o(f)))continue;let m=e.getPropertyValue(f);(f==="background-image"||f==="content")&&m.includes("url(")&&!m.includes("data:")&&(m="none"),n[f]=m}let i=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let d of i)if(!n[d])try{let f=e.getPropertyValue(d);f&&(n[d]=f)}catch{}let a=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let d of a)if(!n[d])try{let f=e.getPropertyValue(d);f&&(n[d]=f)}catch{}if(t.embedFonts){let d=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let f of d)if(!n[f])try{let m=e.getPropertyValue(f);m&&(n[f]=m)}catch{}}r==="hidden"&&(n.opacity="0");try{(n["content-visibility"]||e.getPropertyValue("content-visibility"))==="hidden"&&(n.visibility="hidden")}catch{}let s=parseFloat(e.getPropertyValue("border-top-width")||0)||0,c=parseFloat(e.getPropertyValue("border-right-width")||0)||0,l=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(s===0&&c===0&&l===0&&u===0){let d=(e.getPropertyValue("border-image-source")||"").trim(),f=d&&d!=="none",m=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let p of m)delete n[p];f||(n.border="none")}return n}var vo=new WeakMap;function wl(e){let t=vo.get(e);return t||(t=Object.entries(e).sort((n,r)=>n[0]<r[0]?-1:n[0]>r[0]?1:0).map(([n,r])=>`${n}:${r}`).join(";"),vo.set(e,t),t)}function vl(e,t=null,n={}){let r=bo.get(e);if(r&&r.epoch===qn)return r.snapshot;let o=t||getComputedStyle(e),i=bl(o,n);return kl(e,o,i),bo.set(e,{epoch:qn,snapshot:i}),i}function Cl(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:wt,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:t||{}}:{session:A.session,persist:{snapshotKeyCache:wt,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:e||t||{}}}function Sl(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let o=e.style[r],i=n.getPropertyValue(o);i&&t.style.setProperty(o,i)}}async function He(e,t,n,r){if(e.tagName==="STYLE")return;let o=Cl(n,r),i=o.options&&o.options.cache||"auto";i!=="disabled"&&yl(document.documentElement),i==="disabled"&&!o.session.__bumpedForDisabled&&(yt(),wt.clear(),o.session.__bumpedForDisabled=!0);let{session:a,persist:s}=o;if(!a.styleCache.has(e)){let f=null;try{f=getComputedStyle(e)}catch{}a.styleCache.set(e,f||getComputedStyle(document.documentElement))}let c=a.styleCache.get(e);e.getAttribute?.("style")&&Sl(e,t,c);let l=vl(e,c,o.options),u=wl(l),d=s.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=Gn(l,f),s.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function xl(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Il(e){return e.backgroundImage&&e.backgroundImage!=="none"||e.backgroundColor&&e.backgroundColor!=="rgba(0, 0, 0, 0)"&&e.backgroundColor!=="transparent"||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||"visible")!=="visible"}function El(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Al(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let n=e.firstElementChild,r=e.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let o=e.scrollHeight;if(o===0)return!1;let i=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return o>i+a}function kl(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||!["div","section","article","main","aside","header","footer","nav"].includes(r))return;let o=parseFloat(t.height);if(Number.isFinite(o)&&e.scrollHeight>0&&Math.abs(o-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let i=t.display||"";if(i.includes("flex")||i.includes("grid")||xl(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||Il(t)||El(e))return;let s=t.overflowX||t.overflow||"visible",c=t.overflowY||t.overflow||"visible";if(s!=="visible"||c!=="visible")return;let l=t.clip;l&&l!=="auto"&&l!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||Al(e,t)&&(delete n.height,delete n["block-size"])}Uo();var Ko=["fill","stroke","color","background-color","stop-color"],Co=new Map;function Ml(e,t){let n=t+"::"+e.toLowerCase(),r=Co.get(n);if(r)return r;let o=document,i=t==="http://www.w3.org/2000/svg"?o.createElementNS(t,e):o.createElement(e),a=o.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(i),o.documentElement.appendChild(a);let s=getComputedStyle(i),c={};for(let l of Ko)c[l]=s.getPropertyValue(l)||"";return a.remove(),Co.set(n,c),c}function Tl(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let n=e.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let s=i[a];if(s&&typeof s.value=="string"&&s.value.includes("var(")){r=!0;break}}}let o=null;if(r)try{o=getComputedStyle(e)}catch{}if(r){let i=e.style;if(i&&i.length){let a=new Set;for(let s=0;s<i.length;s++){let c=i[s];if(a.has(c))continue;a.add(c);let l=i.getPropertyValue(c);if(!l||!l.includes("var("))continue;let u=o&&o.getPropertyValue(c);if(u)try{t.style.setProperty(c,u.trim(),i.getPropertyPriority(c))}catch{}}}}if(r&&e.attributes?.length){let i=e.attributes;for(let a=0;a<i.length;a++){let s=i[a];if(!s||typeof s.value!="string"||!s.value.includes("var("))continue;let c=s.name,l=o&&o.getPropertyValue(c);if(l)try{t.style.setProperty(c,l.trim())}catch{}}}if(!r){if(!o)try{o=getComputedStyle(e)}catch{o=null}if(!o)return;let i=e.namespaceURI||"html",a=Ml(e.tagName,i);for(let s of Ko){let c=o.getPropertyValue(s)||"",l=a[s]||"";if(c&&c!==l)try{t.style.setProperty(s,c.trim())}catch{}}}}Ie();Ie();we();nt();function Hn(e,t,n){return Promise.all(e.map(r=>new Promise(o=>{function i(){et(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,o):i()},{fast:n})}i()})))}function Nl(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Ll(e,t,n=!0){return e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let o=n?Nl(r):r;return`:where(${t} ${o})`}).join(", ")}function Rl(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${t}:is(${r.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${t} ${r.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,o,i)=>{let a=Ll(i,t,!0);return`${r}${o}${a}{`}),e):""}function Fl(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function _l(e){let t="";try{e.querySelectorAll("style").forEach(r=>{t+=(r.textContent||"")+`
4
4
  `});let n=e.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let o of r.cssRules)t+=o.cssText+`
@@ -116,7 +116,7 @@ ${g}
116
116
  overflow: visible;
117
117
  `,document.body.appendChild(o);let c=await(await Y(o,{embedFonts:!0})).toCanvas({width:n*Ee});c&&t.drawImage(c,0,0,n*Ee,r*Ee)}finally{o.style.cssText=a,e.shadowRoot?.insertBefore(o,i),i&&(i.style.display="")}}var nd=new Set(["__mindstudio-browser-agent","__mindstudio-cursor","__mindstudio-cursor-ripple","__mindstudio-notes-overlay","__mindstudio-notes-cursor"]),rd=["backgroundColor","backgroundImage","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxShadow"],zi=60,od=80;function yr(){let e=window.innerWidth,t=window.innerHeight,n=window.scrollY,r=document.documentElement.scrollHeight,o=[];o.push(`viewport: ${e} \xD7 ${t}`),o.push(`scroll: ${Math.round(n)} / ${r} (${n<10?"top":n+t>=r-10?"bottom":Math.round(n/(r-t)*100)+"%"})`),o.push("");let i=[],a=document.body;if(!a)return o.join(`
118
118
  `)+"(empty page)";Yi(a,i,e,t,n);let s=md(i);for(let u of s)if("count"in u){let d=u;o.push(`[${d.count} ${d.role}, each ~${d.avgWidth} \xD7 ${d.avgHeight}, first: "${d.firstName}", last: "${d.lastName}"]`),o.push("")}else cd(u,o,e,t,n);let c=fd(i);if(c.length>0){for(let u of c)o.push(`\xD7 ${u.a} overlaps ${u.b} by ${u.overlapPx}px ${u.axis}ly`);o.push("")}let l=i.filter(u=>{let d=u.rect;return d.right<0||d.left>e||d.bottom<-n||d.top>t+n});for(let u of l){let d=u.rect,f="";d.right<0?f=`left: ${Math.round(d.left)}px`:d.left>e?f=`left: ${Math.round(d.left)}px`:d.bottom<0?f=`top: ${Math.round(d.top)}px`:f=`top: ${Math.round(d.top)}px`,o.push(`\xD7 ${u.label} \u2014 off-viewport (${f})`)}return o.join(`
119
- `).trimEnd()}function Yi(e,t,n,r,o){if(id(e)||t.length>=od)return;let i=e.tagName.toLowerCase(),a=ye(e),s=qi(e),c=a!==null,l=i==="img"||i==="svg"||i==="canvas"||i==="video",u=i==="input"||i==="textarea"||i==="select",d=c||l||u;if(!d&&ad(e)&&(d=!0),d&&!s&&!l&&!u&&sd(a)&&(d=!1),d){let f=e.getBoundingClientRect();if(f.width>0&&f.height>0)try{let m=getComputedStyle(e),p=ld(e,a,i);t.push({label:p,rect:f,style:m,el:e,tag:i})}catch{}}for(let f of Array.from(e.children))Yi(f,t,n,r,o)}function id(e){if(nd.has(e.id))return!0;let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||t==="head"||e.getAttribute("aria-hidden")==="true")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return!0}catch{}return!1}function qi(e){for(let t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim())return!0;return!1}function ad(e){try{let t=getComputedStyle(e);for(let n of rd){let r=t[n];if(!(!r||r==="none"||r==="0px"||r==="rgba(0, 0, 0, 0)"||r==="transparent"))return!0}}catch{}return!1}function sd(e){return e==="navigation"||e==="main"||e==="banner"||e==="contentinfo"||e==="complementary"||e==="region"||e==="form"||e==="list"||e==="table"||e==="article"||e==="group"}function ld(e,t,n){let r=Se(e),o=r.length>zi?r.slice(0,zi-1)+"\u2026":r;if(t&&o)return`${t} "${o}"`;if(t)return t;if(o)return`${n} "${o}"`;if(e.id)return`${n}#${e.id}`;let i=e.className&&typeof e.className=="string"?e.className.split(/\s+/).find(a=>!a.startsWith("sc-")&&!a.startsWith("css-")&&a.length<30):null;return i?`${n}.${i}`:n}function cd(e,t,n,r,o){let{label:i,rect:a,style:s,el:c,tag:l}=e,u=Math.round(a.width),d=Math.round(a.height),f=Math.round(a.left),m=Math.round(a.top+o),p=[],g=qi(c)||l==="input"||l==="textarea";if(g){p.push(s.fontSize);let b=pd(s.fontFamily);b&&p.push(`"${b}"`);let w=s.fontWeight;w!=="400"&&w!=="normal"&&p.push(w),p.push(gr(s.color));let S=gr(s.backgroundColor);S&&S!=="transparent"&&p.push(`on ${S}`)}else if(!(l==="img"||l==="svg"||l==="canvas"||l==="video")){let b=gr(s.backgroundColor);b&&b!=="transparent"&&p.push(`bg: ${b}`)}let h=p.length>0?` \u2014 ${p.join(" ")}`:"";t.push(`${i}${h}`);let y=[];if(y.push(`${u} \xD7 ${d}`),y.push(`at (${f}, ${m})`),y.push(`${(u/n*100).toFixed(1)}% vw`),(l==="img"||l==="svg"||l==="canvas"||l==="video")&&u>0&&d>0){let b=hd(u,d);y.push(`aspect: ${b}`)}if(g){let b=ud(c,s);b&&(y.push(`${b.lines} line${b.lines!==1?"s":""}`),b.capacity!==null&&y.push(`(line-height: ${b.lineHeight}, capacity: ${b.capacity.toFixed(1)})`))}t.push(` ${y.join(", ")}`);let v=dd(c);v&&t.push(` ${v}`),t.push("")}function ud(e,t){let n=ji(e);if(!n||!n.textContent?.trim())return null;try{let r=document.createRange();r.selectNodeContents(n.parentElement||e);let o=r.getClientRects();if(o.length===0)return null;let i=o.length,a=t.lineHeight,s=parseFloat(a),c=null;return!isNaN(s)&&s>0&&(c=e.clientHeight/s),{lines:i,lineHeight:isNaN(s)?a:`${Math.round(s)}px`,capacity:c}}catch{return null}}function ji(e){for(let t of Array.from(e.childNodes)){if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim())return t;if(t.nodeType===Node.ELEMENT_NODE){let n=ji(t);if(n)return n}}return null}function dd(e){let t=e,n=t.scrollWidth,r=t.scrollHeight,o=t.clientWidth,i=t.clientHeight;if(n<=o&&r<=i)return null;let a=getComputedStyle(e),s=a.overflowX,c=a.overflowY,l=a.textOverflow,u=[];if(n>o){let d=Math.round((n-o)/n*100),f=l==="ellipsis"?"ellipsis":s==="hidden"?"hidden":"scroll";u.push(`container: ${o}px, content: ${n}px wide, overflow: ${f} (${d}% hidden)`)}if(r>i&&c!=="visible"){let d=Math.round((r-i)/r*100),f=c==="hidden"?"hidden":"scroll";u.push(`container: ${i}px, content: ${r}px tall, overflow: ${f} (${d}% hidden)`)}return u.length>0?u.join("; "):null}function fd(e){let t=[],n=new Map;for(let r of e){let o=r.el.parentElement,i=n.get(o)||[];i.push(r),n.set(o,i)}for(let r of n.values())if(!(r.length<2))for(let o=0;o<r.length;o++)for(let i=o+1;i<r.length;i++){let a=r[o].rect,s=r[i].rect,c=Math.min(a.bottom,s.bottom)-Math.max(a.top,s.top),l=Math.min(a.right,s.right)-Math.max(a.left,s.left);if(c>2&&l>2){let u=c<l?"vertical":"horizontal",d=Math.round(Math.min(c,l));t.push({a:r[o].label,b:r[i].label,overlapPx:d,axis:u})}}return t.slice(0,5)}function md(e){if(e.length===0)return[];let t=[],n=0;for(;n<e.length;){let r=e[n],o=r.el.parentElement,i=ye(r.el);if(i&&o){let a=n+1;for(;a<e.length&&e[a].el.parentElement===o&&ye(e[a].el)===i;)a++;let s=a-n;if(s>=4){let c=e.slice(n,a),l=Math.round(c.reduce((m,p)=>m+p.rect.width,0)/s),u=Math.round(c.reduce((m,p)=>m+p.rect.height,0)/s),d=Se(c[0].el),f=Se(c[s-1].el);t.push({count:s,role:i,avgWidth:l,avgHeight:u,firstName:d.length>40?d.slice(0,39)+"\u2026":d,lastName:f.length>40?f.slice(0,39)+"\u2026":f}),n=a;continue}}t.push(r),n++}return t}function gr(e){if(!e||e==="transparent"||e==="rgba(0, 0, 0, 0)")return"transparent";let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t)return e;let n=parseInt(t[1]),r=parseInt(t[2]),o=parseInt(t[3]),i=t[4]!==void 0?parseFloat(t[4]):1;return i<1?`rgba(${n},${r},${o},${i})`:"#"+[n,r,o].map(a=>a.toString(16).padStart(2,"0")).join("")}function pd(e){let t=e.split(",").map(o=>o.trim().replace(/^["']|["']$/g,"")),n=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","-apple-system","BlinkMacSystemFont"]);return t.find(o=>!n.has(o))||""}function hd(e,t){let n=gd(e,t),r=e/n,o=t/n;return r>20||o>20?`${(e/t).toFixed(2)}:1`:`${r}:${o}`}function gd(e,t){for(;t;)[e,t]=[t,e%t];return e}var yd=["backgroundColor","color","fontFamily","fontSize","fontWeight","fontStyle","lineHeight","letterSpacing","textAlign","textDecoration","textTransform","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","borderRadius","borderColor","borderWidth","borderStyle","boxShadow","opacity","width","height","display","flexDirection","justifyContent","alignItems","gap"];function bd(e,t){let n=t??yd;if(e.ref||e.text||e.role||e.label||e.selector){let{element:i,matched:a}=Ne(e);return{...Zi(i,e.ref,n),matched:a}}let r=Xe(),o=[];for(let[i,a]of r)a.isConnected&&o.push(Zi(a,i,n));return o}function Zi(e,t,n){let r=window.getComputedStyle(e),o={};t&&(o.ref=t),o.tag=e.tagName.toLowerCase();let i=e.textContent?.trim();i&&(o.text=i.length>60?i.slice(0,60)+"\u2026":i);for(let a of n){let s=r.getPropertyValue(a.replace(/([A-Z])/g,"-$1").toLowerCase());s&&(o[a]=s)}return o}var Xi=150,tn=100,At="__mindstudio_pending_nav",Ki=300,vr=1e4;function wd(e){try{let t=new URL(e,window.location.origin);return t.origin!==window.location.origin?!1:t.pathname===window.location.pathname&&t.search===window.location.search&&t.hash===window.location.hash}catch{return!1}}function Ji(e){try{let t=new URL(e,window.location.origin);return t.origin!==window.location.origin?!1:(wd(e)||(window.history.pushState(null,"",t.pathname+t.search+t.hash),window.dispatchEvent(new PopStateEvent("popstate"))),!0)}catch{return!1}}async function br(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,o=Date.now(),i=Be(),a=window.scrollY,s=window.scrollX,c=document.body.scrollTop,l=document.documentElement.scrollTop,u=document.body.scrollHeight,d=document.body.scrollWidth,f=i.scrollTop,m=i.scrollLeft;function p(){if(Date.now()>r){n();return}let g=window.scrollY,h=window.scrollX,y=document.body.scrollTop,v=document.documentElement.scrollTop,b=document.body.scrollHeight,w=document.body.scrollWidth,S=i.scrollTop,x=i.scrollLeft;(g!==a||h!==s||y!==c||v!==l||b!==u||w!==d||S!==f||x!==m)&&(a=g,s=h,c=y,l=v,u=b,d=w,f=S,m=x,o=Date.now()),Date.now()-o>=e?n():requestAnimationFrame(p)}requestAnimationFrame(p)})}var vd=350;async function wr(e){let t=Cd(e),n=t.map(a=>({el:a,top:a.scrollTop,left:a.scrollLeft})),r=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",e.scrollIntoView({block:"center",inline:"nearest",behavior:"instant"}),document.documentElement.style.scrollBehavior=r;let o=t.map(a=>({top:a.scrollTop,left:a.scrollLeft})),i=[];for(let a=0;a<t.length;a++)(n[a].top!==o[a].top||n[a].left!==o[a].left)&&i.push({el:t[a],fromTop:n[a].top,fromLeft:n[a].left,toTop:o[a].top,toLeft:o[a].left});if(i.length===0){await new Promise(a=>requestAnimationFrame(()=>a()));return}for(let a of i)a.el.scrollTop=a.fromTop,a.el.scrollLeft=a.fromLeft;await new Promise(a=>{let s=performance.now();function c(l){let u=l-s,d=Math.min(u/vd,1),f=1-Math.pow(1-d,3);for(let m of i)m.el.scrollTop=m.fromTop+(m.toTop-m.fromTop)*f,m.el.scrollLeft=m.fromLeft+(m.toLeft-m.fromLeft)*f;d<1?requestAnimationFrame(c):a()}requestAnimationFrame(c)})}function Cd(e){let t=[],n=e.parentElement;for(;n;){let r=getComputedStyle(n),o=r.overflowY,i=r.overflowX;(o==="auto"||o==="scroll"||i==="auto"||i==="scroll")&&t.push(n),n=n.parentElement}return t.push(document.scrollingElement||document.documentElement),t}async function nn(e,t){let n=Date.now(),r=[],o=[],i="",a=!1,s=new Set(["click","type","select"]),c=t.some(l=>s.has(l.command));c&&(It(!0),fr()),_n();try{for(let l=0;l<t.length;l++){let u=t[l],d=u.command;try{if(l>0&&await ae(Xi+Math.random()*tn-tn/2),d==="navigate"){let m=u.url;if(!m)throw new Error('navigate command requires a "url" field');if(Ji(m)){r.push({index:l,command:d,result:"ok"}),await ae(Ki);continue}let p=t.slice(l+1);if(p.length>0)try{sessionStorage.setItem(At,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:p,stepOffset:l+1}))}catch{}r.push({index:l,command:d,result:"ok"}),a=!0,window.location.href=m,await new Promise((g,h)=>{setTimeout(()=>h(new Error("Navigation did not complete within timeout")),vr)})}if(d==="reload"){let m=t.slice(l+1);if(m.length>0)try{sessionStorage.setItem(At,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:m,stepOffset:l+1}))}catch{}r.push({index:l,command:d,result:"ok"}),a=!0,window.location.reload(),await new Promise((p,g)=>{setTimeout(()=>g(new Error("Reload did not complete within timeout")),vr)})}let f=await ea(u);r.push({index:l,command:d,...f})}catch(f){r.push({index:l,command:d,error:f instanceof Error?f.message:String(f)});break}}try{i=await Ke()}catch{}}finally{o=$n(),c&&(It(!1),Qt())}return{id:e,steps:r,snapshot:i,logs:o,duration:Date.now()-n}}async function Qi(){let e=null;try{let i=sessionStorage.getItem(At);if(!i)return null;sessionStorage.removeItem(At),e=JSON.parse(i)}catch{return null}if(!e)return null;let t=[...e.completedSteps],n=[],r="",o=e.remainingSteps.some(i=>i.command==="click"||i.command==="type"||i.command==="select");o&&(It(!0),fr()),_n();try{for(let i=0;i<e.remainingSteps.length;i++){let a=e.remainingSteps[i],s=a.command,c=e.stepOffset+i;try{if(i>0&&await ae(Xi+Math.random()*tn-tn/2),s==="navigate"){let u=a.url;if(!u)throw new Error('navigate command requires a "url" field');if(Ji(u)){t.push({index:c,command:s,result:"ok"}),await ae(Ki);continue}let d=e.remainingSteps.slice(i+1);if(d.length>0)try{sessionStorage.setItem(At,JSON.stringify({id:e.id,startTime:e.startTime,completedSteps:t,remainingSteps:d,stepOffset:c+1}))}catch{}t.push({index:c,command:s,result:"ok"}),window.location.href=u,await new Promise((f,m)=>{setTimeout(()=>m(new Error("Navigation did not complete within timeout")),vr)})}let l=await ea(a);t.push({index:c,command:s,...l})}catch(l){t.push({index:c,command:s,error:l instanceof Error?l.message:String(l)});break}}try{r=await Ke()}catch{}}finally{n=$n(),o&&(It(!1),Qt())}return{id:e.id,steps:t,snapshot:r,logs:n,duration:Date.now()-e.startTime}}async function ea(e){switch(e.command){case"snapshot":return{result:await Ke()};case"click":{let{element:t,matched:n}=Ne(e);return await wr(t),await Jt(t),await Pi(),Bn(t),await br(),await ae(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=Ne(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await wr(t),await Jt(t),await lo(t,r,{clear:!!e.clear}),await br(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=Ne(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await wr(t),await Jt(t);let o=uo(t,r);return await br(),{result:`selected "${o}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await co(e);return{result:"ok",matched:t,elapsed:n}}case"styles":{let t=e.properties;return{result:bd(e,t)}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await fo(t)}}case"screenshotFullPage":{let t=Be();t.scrollTop=0,await ae(500);let n=yr(),{image:r,width:o,height:i}=await Et(),a=e.uploadUrl,s=e.uploadFields;if(a&&s){let c=atob(r),l=new Uint8Array(c.length);for(let m=0;m<c.length;m++)l[m]=c.charCodeAt(m);let u=new FormData;for(let[m,p]of Object.entries(s))u.append(m,p);u.append("file",new Blob([l],{type:"image/jpeg"}),"screenshot.jpg");let d=await fetch(a,{method:"POST",body:u});if(!d.ok)throw new Error(`Screenshot upload failed: ${d.status}`);let f=e._publicUrl;return{result:{width:o,height:i,uploaded:!0,styleMap:n,...f?{_publicUrl:f}:{}}}}return{result:{image:r,width:o,height:i,styleMap:n}}}case"screenshotViewport":{let t=yr(),{image:n,width:r,height:o}=await Et({viewportOnly:!0}),i=e.uploadUrl,a=e.uploadFields;if(i&&a){let s=atob(n),c=new Uint8Array(s.length);for(let f=0;f<s.length;f++)c[f]=s.charCodeAt(f);let l=new FormData;for(let[f,m]of Object.entries(a))l.append(f,m);l.append("file",new Blob([c],{type:"image/jpeg"}),"screenshot.jpg");let u=await fetch(i,{method:"POST",body:l});if(!u.ok)throw new Error(`Screenshot upload failed: ${u.status}`);let d=e._publicUrl;return{result:{width:r,height:o,uploaded:!0,styleMap:t,...d?{_publicUrl:d}:{}}}}return{result:{image:n,width:r,height:o,styleMap:t}}}case"reload":return location.reload(),{result:"ok"};default:throw new Error(`Unknown command: ${e.command}`)}}var Sd="/__mindstudio_dev__/ws",xd=1e3,Id=1e4;function na(){let e=E().ws;e.ws||(zr(on),window.addEventListener("beforeunload",()=>{e.closing=!0,e.ws&&e.ws.close()}),ra())}function on(){let{ws:e}=E().ws;return e&&e.readyState===WebSocket.OPEN?e:null}function Ed(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${Sd}`}function Ad(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function ra(){let e=E().ws;if(!e.closing){try{e.ws=new WebSocket(Ed())}catch{ta();return}e.ws.onopen=()=>{try{let t=(()=>{try{return sessionStorage.getItem("__ms_mirror")==="1"}catch{return!1}})();e.ws.send(JSON.stringify({type:"hello",mode:Ad(),url:location.href,viewport:{w:window.innerWidth,h:window.innerHeight},mirror:t}))}catch{e.ws?.close()}},e.ws.onmessage=t=>{let n;try{n=JSON.parse(t.data)}catch{return}switch(n.type){case"ack":e.clientId=n.clientId,e.reconnectDelay=xd,Md();break;case"command":kd(n.id,n.steps);break;case"broadcast":Td(n.action,n.payload);break}},e.ws.onclose=()=>{e.ws=null,e.clientId=null,e.closing||ta()},e.ws.onerror=()=>{}}}function ta(){let e=E().ws;e.closing||(setTimeout(()=>ra(),e.reconnectDelay),e.reconnectDelay=Math.min(e.reconnectDelay*2,Id))}async function kd(e,t){let n=E().ws;if(n.busy){rn({id:e,steps:[],snapshot:"",logs:[],duration:0,error:"Browser agent is busy"});return}n.busy=!0,Cr("command-started",{id:e,steps:t.map(r=>r.command)});try{let r=await nn(e,t);rn(r),Cr("command-completed",{id:e,success:!0})}catch{rn({id:e,steps:[],snapshot:"",logs:[],duration:0}),Cr("command-completed",{id:e,success:!1})}finally{E().ws.busy=!1}}function rn(e){try{let t=on();t&&t.send(JSON.stringify({type:"result",...e}))}catch{}}async function Md(){let e=await Qi();e&&rn(e)}function Cr(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function Td(e,t){e==="reload"&&(document.cookie="__ms_auth=; Max-Age=0; Path=/; Secure; SameSite=None",location.href="/")}var at="#DD2590",oa="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Nd=200,ia=`
119
+ `).trimEnd()}function Yi(e,t,n,r,o){if(id(e)||t.length>=od)return;let i=e.tagName.toLowerCase(),a=ye(e),s=qi(e),c=a!==null,l=i==="img"||i==="svg"||i==="canvas"||i==="video",u=i==="input"||i==="textarea"||i==="select",d=c||l||u;if(!d&&ad(e)&&(d=!0),d&&!s&&!l&&!u&&sd(a)&&(d=!1),d){let f=e.getBoundingClientRect();if(f.width>0&&f.height>0)try{let m=getComputedStyle(e),p=ld(e,a,i);t.push({label:p,rect:f,style:m,el:e,tag:i})}catch{}}for(let f of Array.from(e.children))Yi(f,t,n,r,o)}function id(e){if(nd.has(e.id))return!0;let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||t==="head"||e.getAttribute("aria-hidden")==="true")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return!0}catch{}return!1}function qi(e){for(let t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim())return!0;return!1}function ad(e){try{let t=getComputedStyle(e);for(let n of rd){let r=t[n];if(!(!r||r==="none"||r==="0px"||r==="rgba(0, 0, 0, 0)"||r==="transparent"))return!0}}catch{}return!1}function sd(e){return e==="navigation"||e==="main"||e==="banner"||e==="contentinfo"||e==="complementary"||e==="region"||e==="form"||e==="list"||e==="table"||e==="article"||e==="group"}function ld(e,t,n){let r=Se(e),o=r.length>zi?r.slice(0,zi-1)+"\u2026":r;if(t&&o)return`${t} "${o}"`;if(t)return t;if(o)return`${n} "${o}"`;if(e.id)return`${n}#${e.id}`;let i=e.className&&typeof e.className=="string"?e.className.split(/\s+/).find(a=>!a.startsWith("sc-")&&!a.startsWith("css-")&&a.length<30):null;return i?`${n}.${i}`:n}function cd(e,t,n,r,o){let{label:i,rect:a,style:s,el:c,tag:l}=e,u=Math.round(a.width),d=Math.round(a.height),f=Math.round(a.left),m=Math.round(a.top+o),p=[],g=qi(c)||l==="input"||l==="textarea";if(g){p.push(s.fontSize);let b=pd(s.fontFamily);b&&p.push(`"${b}"`);let w=s.fontWeight;w!=="400"&&w!=="normal"&&p.push(w),p.push(gr(s.color));let S=gr(s.backgroundColor);S&&S!=="transparent"&&p.push(`on ${S}`)}else if(!(l==="img"||l==="svg"||l==="canvas"||l==="video")){let b=gr(s.backgroundColor);b&&b!=="transparent"&&p.push(`bg: ${b}`)}let h=p.length>0?` \u2014 ${p.join(" ")}`:"";t.push(`${i}${h}`);let y=[];if(y.push(`${u} \xD7 ${d}`),y.push(`at (${f}, ${m})`),y.push(`${(u/n*100).toFixed(1)}% vw`),(l==="img"||l==="svg"||l==="canvas"||l==="video")&&u>0&&d>0){let b=hd(u,d);y.push(`aspect: ${b}`)}if(g){let b=ud(c,s);b&&(y.push(`${b.lines} line${b.lines!==1?"s":""}`),b.capacity!==null&&y.push(`(line-height: ${b.lineHeight}, capacity: ${b.capacity.toFixed(1)})`))}t.push(` ${y.join(", ")}`);let v=dd(c);v&&t.push(` ${v}`),t.push("")}function ud(e,t){let n=ji(e);if(!n||!n.textContent?.trim())return null;try{let r=document.createRange();r.selectNodeContents(n.parentElement||e);let o=r.getClientRects();if(o.length===0)return null;let i=o.length,a=t.lineHeight,s=parseFloat(a),c=null;return!isNaN(s)&&s>0&&(c=e.clientHeight/s),{lines:i,lineHeight:isNaN(s)?a:`${Math.round(s)}px`,capacity:c}}catch{return null}}function ji(e){for(let t of Array.from(e.childNodes)){if(t.nodeType===Node.TEXT_NODE&&(t.textContent||"").trim())return t;if(t.nodeType===Node.ELEMENT_NODE){let n=ji(t);if(n)return n}}return null}function dd(e){let t=e,n=t.scrollWidth,r=t.scrollHeight,o=t.clientWidth,i=t.clientHeight;if(n<=o&&r<=i)return null;let a=getComputedStyle(e),s=a.overflowX,c=a.overflowY,l=a.textOverflow,u=[];if(n>o){let d=Math.round((n-o)/n*100),f=l==="ellipsis"?"ellipsis":s==="hidden"?"hidden":"scroll";u.push(`container: ${o}px, content: ${n}px wide, overflow: ${f} (${d}% hidden)`)}if(r>i&&c!=="visible"){let d=Math.round((r-i)/r*100),f=c==="hidden"?"hidden":"scroll";u.push(`container: ${i}px, content: ${r}px tall, overflow: ${f} (${d}% hidden)`)}return u.length>0?u.join("; "):null}function fd(e){let t=[],n=new Map;for(let r of e){let o=r.el.parentElement,i=n.get(o)||[];i.push(r),n.set(o,i)}for(let r of n.values())if(!(r.length<2))for(let o=0;o<r.length;o++)for(let i=o+1;i<r.length;i++){let a=r[o].rect,s=r[i].rect,c=Math.min(a.bottom,s.bottom)-Math.max(a.top,s.top),l=Math.min(a.right,s.right)-Math.max(a.left,s.left);if(c>2&&l>2){let u=c<l?"vertical":"horizontal",d=Math.round(Math.min(c,l));t.push({a:r[o].label,b:r[i].label,overlapPx:d,axis:u})}}return t.slice(0,5)}function md(e){if(e.length===0)return[];let t=[],n=0;for(;n<e.length;){let r=e[n],o=r.el.parentElement,i=ye(r.el);if(i&&o){let a=n+1;for(;a<e.length&&e[a].el.parentElement===o&&ye(e[a].el)===i;)a++;let s=a-n;if(s>=4){let c=e.slice(n,a),l=Math.round(c.reduce((m,p)=>m+p.rect.width,0)/s),u=Math.round(c.reduce((m,p)=>m+p.rect.height,0)/s),d=Se(c[0].el),f=Se(c[s-1].el);t.push({count:s,role:i,avgWidth:l,avgHeight:u,firstName:d.length>40?d.slice(0,39)+"\u2026":d,lastName:f.length>40?f.slice(0,39)+"\u2026":f}),n=a;continue}}t.push(r),n++}return t}function gr(e){if(!e||e==="transparent"||e==="rgba(0, 0, 0, 0)")return"transparent";let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(!t)return e;let n=parseInt(t[1]),r=parseInt(t[2]),o=parseInt(t[3]),i=t[4]!==void 0?parseFloat(t[4]):1;return i<1?`rgba(${n},${r},${o},${i})`:"#"+[n,r,o].map(a=>a.toString(16).padStart(2,"0")).join("")}function pd(e){let t=e.split(",").map(o=>o.trim().replace(/^["']|["']$/g,"")),n=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","-apple-system","BlinkMacSystemFont"]);return t.find(o=>!n.has(o))||""}function hd(e,t){let n=gd(e,t),r=e/n,o=t/n;return r>20||o>20?`${(e/t).toFixed(2)}:1`:`${r}:${o}`}function gd(e,t){for(;t;)[e,t]=[t,e%t];return e}var yd=["backgroundColor","color","fontFamily","fontSize","fontWeight","fontStyle","lineHeight","letterSpacing","textAlign","textDecoration","textTransform","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","margin","marginTop","marginRight","marginBottom","marginLeft","borderRadius","borderColor","borderWidth","borderStyle","boxShadow","opacity","width","height","display","flexDirection","justifyContent","alignItems","gap"];function bd(e,t){let n=t??yd;if(e.ref||e.text||e.role||e.label||e.selector){let{element:i,matched:a}=Ne(e);return{...Zi(i,e.ref,n),matched:a}}let r=Xe(),o=[];for(let[i,a]of r)a.isConnected&&o.push(Zi(a,i,n));return o}function Zi(e,t,n){let r=window.getComputedStyle(e),o={};t&&(o.ref=t),o.tag=e.tagName.toLowerCase();let i=e.textContent?.trim();i&&(o.text=i.length>60?i.slice(0,60)+"\u2026":i);for(let a of n){let s=r.getPropertyValue(a.replace(/([A-Z])/g,"-$1").toLowerCase());s&&(o[a]=s)}return o}var Xi=150,tn=100,At="__mindstudio_pending_nav",Ki=300,vr=1e4;function wd(e){try{let t=new URL(e,window.location.origin);return t.origin!==window.location.origin?!1:t.pathname===window.location.pathname&&t.search===window.location.search&&t.hash===window.location.hash}catch{return!1}}function Ji(e){try{let t=new URL(e,window.location.origin);return t.origin!==window.location.origin?!1:(wd(e)||(window.history.pushState(null,"",t.pathname+t.search+t.hash),window.dispatchEvent(new PopStateEvent("popstate"))),!0)}catch{return!1}}async function br(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,o=Date.now(),i=Be(),a=window.scrollY,s=window.scrollX,c=document.body.scrollTop,l=document.documentElement.scrollTop,u=document.body.scrollHeight,d=document.body.scrollWidth,f=i.scrollTop,m=i.scrollLeft;function p(){if(Date.now()>r){n();return}let g=window.scrollY,h=window.scrollX,y=document.body.scrollTop,v=document.documentElement.scrollTop,b=document.body.scrollHeight,w=document.body.scrollWidth,S=i.scrollTop,x=i.scrollLeft;(g!==a||h!==s||y!==c||v!==l||b!==u||w!==d||S!==f||x!==m)&&(a=g,s=h,c=y,l=v,u=b,d=w,f=S,m=x,o=Date.now()),Date.now()-o>=e?n():requestAnimationFrame(p)}requestAnimationFrame(p)})}var vd=350;async function wr(e){let t=Cd(e),n=t.map(a=>({el:a,top:a.scrollTop,left:a.scrollLeft})),r=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",e.scrollIntoView({block:"center",inline:"nearest",behavior:"instant"}),document.documentElement.style.scrollBehavior=r;let o=t.map(a=>({top:a.scrollTop,left:a.scrollLeft})),i=[];for(let a=0;a<t.length;a++)(n[a].top!==o[a].top||n[a].left!==o[a].left)&&i.push({el:t[a],fromTop:n[a].top,fromLeft:n[a].left,toTop:o[a].top,toLeft:o[a].left});if(i.length===0){await new Promise(a=>requestAnimationFrame(()=>a()));return}for(let a of i)a.el.scrollTop=a.fromTop,a.el.scrollLeft=a.fromLeft;await new Promise(a=>{let s=performance.now();function c(l){let u=l-s,d=Math.min(u/vd,1),f=1-Math.pow(1-d,3);for(let m of i)m.el.scrollTop=m.fromTop+(m.toTop-m.fromTop)*f,m.el.scrollLeft=m.fromLeft+(m.toLeft-m.fromLeft)*f;d<1?requestAnimationFrame(c):a()}requestAnimationFrame(c)})}function Cd(e){let t=[],n=e.parentElement;for(;n;){let r=getComputedStyle(n),o=r.overflowY,i=r.overflowX;(o==="auto"||o==="scroll"||i==="auto"||i==="scroll")&&t.push(n),n=n.parentElement}return t.push(document.scrollingElement||document.documentElement),t}async function nn(e,t){let n=Date.now(),r=[],o=[],i="",a=!1,s=new Set(["click","type","select"]),c=t.some(l=>s.has(l.command));c&&(It(!0),fr()),_n();try{for(let l=0;l<t.length;l++){let u=t[l],d=u.command;try{if(l>0&&await ae(Xi+Math.random()*tn-tn/2),d==="navigate"){let m=u.url;if(!m)throw new Error('navigate command requires a "url" field');if(Ji(m)){r.push({index:l,command:d,result:"ok"}),await ae(Ki);continue}let p=t.slice(l+1);if(p.length>0)try{sessionStorage.setItem(At,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:p,stepOffset:l+1}))}catch{}r.push({index:l,command:d,result:"ok"}),a=!0,window.location.href=m,await new Promise((g,h)=>{setTimeout(()=>h(new Error("Navigation did not complete within timeout")),vr)})}if(d==="reload"){let m=t.slice(l+1);if(m.length>0)try{sessionStorage.setItem(At,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:m,stepOffset:l+1}))}catch{}r.push({index:l,command:d,result:"ok"}),a=!0,window.location.reload(),await new Promise((p,g)=>{setTimeout(()=>g(new Error("Reload did not complete within timeout")),vr)})}let f=await ea(u);r.push({index:l,command:d,...f})}catch(f){r.push({index:l,command:d,error:f instanceof Error?f.message:String(f)});break}}try{i=await Ke()}catch{}}finally{o=$n(),c&&(It(!1),Qt())}return{id:e,steps:r,snapshot:i,logs:o,duration:Date.now()-n}}async function Qi(){let e=null;try{let i=sessionStorage.getItem(At);if(!i)return null;sessionStorage.removeItem(At),e=JSON.parse(i)}catch{return null}if(!e)return null;let t=[...e.completedSteps],n=[],r="",o=e.remainingSteps.some(i=>i.command==="click"||i.command==="type"||i.command==="select");o&&(It(!0),fr()),_n();try{for(let i=0;i<e.remainingSteps.length;i++){let a=e.remainingSteps[i],s=a.command,c=e.stepOffset+i;try{if(i>0&&await ae(Xi+Math.random()*tn-tn/2),s==="navigate"){let u=a.url;if(!u)throw new Error('navigate command requires a "url" field');if(Ji(u)){t.push({index:c,command:s,result:"ok"}),await ae(Ki);continue}let d=e.remainingSteps.slice(i+1);if(d.length>0)try{sessionStorage.setItem(At,JSON.stringify({id:e.id,startTime:e.startTime,completedSteps:t,remainingSteps:d,stepOffset:c+1}))}catch{}t.push({index:c,command:s,result:"ok"}),window.location.href=u,await new Promise((f,m)=>{setTimeout(()=>m(new Error("Navigation did not complete within timeout")),vr)})}let l=await ea(a);t.push({index:c,command:s,...l})}catch(l){t.push({index:c,command:s,error:l instanceof Error?l.message:String(l)});break}}try{r=await Ke()}catch{}}finally{n=$n(),o&&(It(!1),Qt())}return{id:e.id,steps:t,snapshot:r,logs:n,duration:Date.now()-e.startTime}}async function ea(e){switch(e.command){case"snapshot":return{result:await Ke()};case"click":{let{element:t,matched:n}=Ne(e);return await wr(t),await Jt(t),await Pi(),Bn(t),await br(),await ae(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=Ne(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await wr(t),await Jt(t),await lo(t,r,{clear:!!e.clear}),await br(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=Ne(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await wr(t),await Jt(t);let o=uo(t,r);return await br(),{result:`selected "${o}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await co(e);return{result:"ok",matched:t,elapsed:n}}case"styles":{let t=e.properties;return{result:bd(e,t)}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await fo(t)}}case"stashState":{let t=E();if(!t.browserStash){let n=document.cookie.match(/(?:^|;\s*)__ms_auth=([^;]+)/);t.browserStash={cookie:n?n[1]:null,path:location.pathname+location.search}}return{result:{cookie:!!t.browserStash.cookie,path:t.browserStash.path}}}case"restoreState":{let t=E(),n=t.browserStash;return n?(document.cookie="__ms_auth=; Max-Age=0; Path=/; Secure; SameSite=None",n.cookie&&(document.cookie=`__ms_auth=${n.cookie}; Path=/; Secure; SameSite=None`),t.browserStash=null,{result:{restored:!0,path:n.path}}):{result:{restored:!1}}}case"screenshotFullPage":{let t=Be();t.scrollTop=0,await ae(500);let n=yr(),{image:r,width:o,height:i}=await Et(),a=e.uploadUrl,s=e.uploadFields;if(a&&s){let c=atob(r),l=new Uint8Array(c.length);for(let m=0;m<c.length;m++)l[m]=c.charCodeAt(m);let u=new FormData;for(let[m,p]of Object.entries(s))u.append(m,p);u.append("file",new Blob([l],{type:"image/jpeg"}),"screenshot.jpg");let d=await fetch(a,{method:"POST",body:u});if(!d.ok)throw new Error(`Screenshot upload failed: ${d.status}`);let f=e._publicUrl;return{result:{width:o,height:i,uploaded:!0,styleMap:n,...f?{_publicUrl:f}:{}}}}return{result:{image:r,width:o,height:i,styleMap:n}}}case"screenshotViewport":{let t=yr(),{image:n,width:r,height:o}=await Et({viewportOnly:!0}),i=e.uploadUrl,a=e.uploadFields;if(i&&a){let s=atob(n),c=new Uint8Array(s.length);for(let f=0;f<s.length;f++)c[f]=s.charCodeAt(f);let l=new FormData;for(let[f,m]of Object.entries(a))l.append(f,m);l.append("file",new Blob([c],{type:"image/jpeg"}),"screenshot.jpg");let u=await fetch(i,{method:"POST",body:l});if(!u.ok)throw new Error(`Screenshot upload failed: ${u.status}`);let d=e._publicUrl;return{result:{width:r,height:o,uploaded:!0,styleMap:t,...d?{_publicUrl:d}:{}}}}return{result:{image:n,width:r,height:o,styleMap:t}}}case"reload":return location.reload(),{result:"ok"};default:throw new Error(`Unknown command: ${e.command}`)}}var Sd="/__mindstudio_dev__/ws",xd=1e3,Id=1e4;function na(){let e=E().ws;e.ws||(zr(on),window.addEventListener("beforeunload",()=>{e.closing=!0,e.ws&&e.ws.close()}),ra())}function on(){let{ws:e}=E().ws;return e&&e.readyState===WebSocket.OPEN?e:null}function Ed(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${Sd}`}function Ad(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function ra(){let e=E().ws;if(!e.closing){try{e.ws=new WebSocket(Ed())}catch{ta();return}e.ws.onopen=()=>{try{let t=(()=>{try{return sessionStorage.getItem("__ms_mirror")==="1"}catch{return!1}})();e.ws.send(JSON.stringify({type:"hello",mode:Ad(),url:location.href,viewport:{w:window.innerWidth,h:window.innerHeight},mirror:t}))}catch{e.ws?.close()}},e.ws.onmessage=t=>{let n;try{n=JSON.parse(t.data)}catch{return}switch(n.type){case"ack":e.clientId=n.clientId,e.reconnectDelay=xd,Md();break;case"command":kd(n.id,n.steps);break;case"broadcast":Td(n.action,n.payload);break}},e.ws.onclose=()=>{e.ws=null,e.clientId=null,e.closing||ta()},e.ws.onerror=()=>{}}}function ta(){let e=E().ws;e.closing||(setTimeout(()=>ra(),e.reconnectDelay),e.reconnectDelay=Math.min(e.reconnectDelay*2,Id))}async function kd(e,t){let n=E().ws;if(n.busy){rn({id:e,steps:[],snapshot:"",logs:[],duration:0,error:"Browser agent is busy"});return}n.busy=!0,Cr("command-started",{id:e,steps:t.map(r=>r.command)});try{let r=await nn(e,t);rn(r),Cr("command-completed",{id:e,success:!0})}catch{rn({id:e,steps:[],snapshot:"",logs:[],duration:0}),Cr("command-completed",{id:e,success:!1})}finally{E().ws.busy=!1}}function rn(e){try{let t=on();t&&t.send(JSON.stringify({type:"result",...e}))}catch{}}async function Md(){let e=await Qi();e&&rn(e)}function Cr(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function Td(e,t){e==="reload"&&(document.cookie="__ms_auth=; Max-Age=0; Path=/; Secure; SameSite=None",location.href="/")}var at="#DD2590",oa="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Nd=200,ia=`
120
120
  display: block;
121
121
  box-sizing: border-box;
122
122
  width: ${Nd}px;
@@ -236,7 +236,7 @@ ${g}
236
236
  pointer-events: none;
237
237
  z-index: 2;
238
238
  }
239
- `,n.appendChild(r);let o=document.createElement("div");o.className="overlay";let i=document.createElement("div");i.className="cursor",i.innerHTML=_d,n.appendChild(o),n.appendChild(i),e.host=t,e.overlay=o,e.cursorEl=i,o.addEventListener("pointerdown",ha),o.addEventListener("pointermove",pa),document.addEventListener("pointermove",ga,{capture:!0}),document.addEventListener("pointerup",ya,{capture:!0}),document.addEventListener("pointercancel",ba,{capture:!0}),document.addEventListener("keydown",wa),document.body.appendChild(t)}function fa(){let e=E().noteLayer;document.removeEventListener("pointermove",ga,{capture:!0}),document.removeEventListener("pointerup",ya,{capture:!0}),document.removeEventListener("pointercancel",ba,{capture:!0}),document.removeEventListener("keydown",wa),e.overlay&&(e.overlay.removeEventListener("pointerdown",ha),e.overlay.removeEventListener("pointermove",pa),e.overlay=null),e.cursorEl&&(e.cursorEl=null),e.host&&(e.host.remove(),e.host=null),sn!==null&&(document.documentElement.style.overflow=sn,sn=null),e.notes=[],e.currentNote=null,lt()}function ma(){let e=E().noteLayer;e.cursorEl&&(e.cursorEl.style.display="none"),e.movingNote=null,e.consumedByDeactivation=!1,lt()}function pa(e){let t=E().noteLayer;if(!t.cursorEl||!t.overlay)return;t.cursorEl.style.left=`${e.clientX}px`,t.cursorEl.style.top=`${e.clientY}px`,va(e.target)?(t.cursorEl.style.display="none",t.overlay.style.cursor=""):(t.cursorEl.style.display="",t.overlay.style.cursor="none")}function ha(e){let t=E().noteLayer;if(!t.overlay)return;let n=e.target;if(n.dataset?.deleteBtn==="true"||n.closest("[data-delete-btn]")){let o=n.closest("[data-note-id]");if(o){let i=t.notes.find(a=>a.id===o.id);if(i){Ve(i),e.preventDefault(),e.stopPropagation();return}}}t.overlay.setPointerCapture(e.pointerId);let r=va(e.target);if(r){if(r.state==="editing")return;if(r.state==="selected"){let o=e.target;if(o.dataset?.bubble==="true"||o.closest("[data-bubble]")){an(r),t.currentNote=r,e.preventDefault();return}ua(r,e),e.preventDefault();return}t.currentNote&&t.currentNote!==r&&(st(t.currentNote)||Ve(t.currentNote)),ca(r),t.currentNote=r,ua(r,e),e.preventDefault();return}if(t.currentNote&&(t.currentNote.state==="editing"||t.currentNote.state==="selected")){st(t.currentNote)||Ve(t.currentNote),t.currentNote=null,t.consumedByDeactivation=!0,e.preventDefault();return}t.pointerDown=!0,t.startX=e.clientX,t.startY=e.clientY,t.didDrag=!1,t.consumedByDeactivation=!1,e.preventDefault()}function ga(e){let t=E().noteLayer;if(t.movingNote){let o=e.clientX-t.moveOffsetX,i=e.clientY-t.moveOffsetY;t.movingNote.x=o,t.movingNote.y=i,t.movingNote.element.style.left=`${o}px`,t.movingNote.element.style.top=`${i}px`;return}if(!t.pointerDown||!t.overlay)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.sqrt(n*n+r*r)>Fd&&(t.didDrag=!0,t.dragPreview||(t.dragPreview=document.createElement("div"),t.dragPreview.className="drag-preview",t.overlay.appendChild(t.dragPreview)),t.dragPreview.style.left=`${Math.min(t.startX,e.clientX)}px`,t.dragPreview.style.top=`${Math.min(t.startY,e.clientY)}px`,t.dragPreview.style.width=`${Math.abs(n)}px`,t.dragPreview.style.height=`${Math.abs(r)}px`)}function ya(e){let t=E().noteLayer;if(t.overlay)try{t.overlay.releasePointerCapture(e.pointerId)}catch{}if(t.movingNote){t.movingNote=null;return}if(t.consumedByDeactivation){t.consumedByDeactivation=!1,lt();return}if(!t.pointerDown||!t.overlay){lt();return}if(t.didDrag){t.dragPreview&&(t.dragPreview.remove(),t.dragPreview=null);let n=Math.min(t.startX,e.clientX),r=Math.min(t.startY,e.clientY),o=Math.abs(e.clientX-t.startX),i=Math.abs(e.clientY-t.startY);if(o>10&&i>10){let a=la(n,r,o,i);t.overlay.appendChild(a.element),t.notes.push(a),an(a),t.currentNote=a}}else{let n=sa(e.clientX,e.clientY);t.overlay.appendChild(n.element),t.notes.push(n),an(n),t.currentNote=n}lt()}function ba(){let e=E().noteLayer;e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null),e.movingNote=null,lt()}function wa(e){let t=E().noteLayer;if(t.currentNote){if(e.key==="Enter"&&!e.shiftKey&&t.currentNote.state==="editing"){st(t.currentNote)||Ve(t.currentNote),t.currentNote=null,e.preventDefault();return}if(e.key==="Escape"){t.currentNote.state==="editing"?(st(t.currentNote)||Ve(t.currentNote),t.currentNote=null):t.currentNote.state==="selected"&&(st(t.currentNote),t.currentNote=null),e.preventDefault();return}if(t.currentNote.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){Ve(t.currentNote),t.currentNote=null,e.preventDefault();return}t.currentNote.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&t.currentNote.bubble.textContent?.trim()===""&&(Ve(t.currentNote),t.currentNote=null,e.preventDefault())}}function ua(e,t){let n=E().noteLayer;n.movingNote=e,n.moveOffsetX=t.clientX-e.x,n.moveOffsetY=t.clientY-e.y}function va(e){let t=E().noteLayer;for(let n of t.notes)if(n.element.contains(e))return n;return null}function Ve(e){let t=E().noteLayer;e.element.remove(),t.notes=t.notes.filter(n=>n.id!==e.id),t.currentNote===e&&(t.currentNote=null)}function lt(){let e=E().noteLayer;e.pointerDown=!1,e.startX=0,e.startY=0,e.didDrag=!1,e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null)}function Ca(){let e=E().notesMode;e.active||(e.active=!0,E().touch.active&&(Xt(),e.wasTouchActive=!0),da())}function xr(){let e=E().notesMode;e.active&&(e.active=!1,fa(),e.wasTouchActive&&(e.wasTouchActive=!1,xt()))}async function Sa(){let{image:e}=await Et({viewportOnly:!0});return e}var Ir="mindstudio-browser-agent";function xa(){let e=E(),t=new URLSearchParams(window.location.search);e.zoom.pipMode=t.get("display-mode")==="pip",e.zoom.mobilePreview=t.get("preview")==="mobile"||window.innerWidth<768;try{let n=sessionStorage.getItem("__ms_pip");n==="1"?e.zoom.pipMode=!0:n==="0"&&(e.zoom.pipMode=!1);let r=sessionStorage.getItem("__ms_mobile");r==="1"?e.zoom.mobilePreview=!0:r==="0"&&(e.zoom.mobilePreview=!1)}catch{}e.messages.handler||(e.messages.handler=async n=>{if(n.source===window)return;let r=n.data;if(!(!r||typeof r.command!="string")&&r.channel===Ir)switch(r.command){case"notes-enter":Ca();break;case"notes-exit":xr();break;case"notes-cursor-hide":ma();break;case"notes-screenshot":{try{let o=await Sa();xr(),window.parent.postMessage({channel:Ir,command:"screenshot-result",image:o},"*")}catch(o){window.parent.postMessage({channel:Ir,command:"screenshot-result",error:o instanceof Error?o.message:"Screenshot failed"},"*")}break}case"cursor-show":en("visible");break;case"cursor-hide":en("hidden");break;case"cursor-auto":en(null);break;case"navigate":typeof r.url=="string"&&(window.history.pushState(null,"",r.url),window.dispatchEvent(new PopStateEvent("popstate")));break;case"display-mode-pip":e.zoom.pipMode=!0;try{sessionStorage.setItem("__ms_pip","1")}catch{}break;case"display-mode-full":e.zoom.pipMode=!1;try{sessionStorage.setItem("__ms_pip","0")}catch{}break;case"preview-mode-mobile":e.zoom.mobilePreview=!0;try{sessionStorage.setItem("__ms_mobile","1")}catch{}xt(),mr(!0);break;case"preview-mode-desktop":e.zoom.mobilePreview=!1;try{sessionStorage.setItem("__ms_mobile","0")}catch{}Xt(),mr(!1);break}},window.addEventListener("message",e.messages.handler))}var se;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(se||(se={}));function $d(e){return e.nodeType===e.ELEMENT_NODE}function qe(e){var t=e?.host;return t?.shadowRoot===e}function ze(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Od(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Er(e){try{var t=e.rules||e.cssRules;return t?Od(Array.from(t).map(Ar).join("")):null}catch{return null}}function Ar(e){var t=e.cssText;if(Dd(e))try{t=Er(e.styleSheet)||t}catch{}return t}function Dd(e){return"styleSheet"in e}var Aa=(function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var n;if(!t)return-1;var r=(n=this.getMeta(t))===null||n===void 0?void 0:n.id;return r??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var n=this,r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(function(o){return n.removeNodeFromMap(o)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,n){var r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)},e.prototype.replace=function(t,n){var r=this.getNode(t);if(r){var o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(n,o)}this.idNodeMap.set(t,n)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e})();function ka(){return new Aa}function Tt(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,o=e.value,i=e.maskInputFn,a=o||"";return(t[n.toLowerCase()]||t[r])&&(i?a=i(a):a="*".repeat(a.length)),a}var Ia="__rrweb_original__";function Pd(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var o=0;o<e.height;o+=n){var i=t.getImageData,a=Ia in i?i[Ia]:i,s=new Uint32Array(a.call(t,r,o,Math.min(n,e.width-r),Math.min(n,e.height-o)).data.buffer);if(s.some(function(c){return c!==0}))return!1}return!0}var Wd=1,Bd=new RegExp("[^a-z0-9-_:]"),Ye=-2;function kr(){return Wd++}function Hd(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return Bd.test(t)?"div":t}function Ud(e){return e.cssRules?Array.from(e.cssRules).map(function(t){return t.cssText||""}).join(""):""}function Vd(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ct,Ea,Gd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zd=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Yd=/^(data:)([^,]*),(.*)/i;function ln(e,t){return(e||"").replace(Gd,function(n,r,o,i,a,s){var c=o||a||s,l=r||i||"";if(!c)return n;if(!zd.test(c)||Yd.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(Vd(t)+c).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var f=0,m=d;f<m.length;f++){var p=m[f];p!=="."&&(p===".."?u.pop():u.push(p))}return"url(".concat(l).concat(u.join("/")).concat(l,")")})}var qd=/^[^ \t\n\r\u000c]+/,jd=/^[, \t\n\r\u000c]+/;function Zd(e,t){if(t.trim()==="")return t;var n=0;function r(l){var u,d=l.exec(t.substring(n));return d?(u=d[0],n+=u.length,u):""}for(var o=[];r(jd),!(n>=t.length);){var i=r(qd);if(i.slice(-1)===",")i=ut(e,i.substring(0,i.length-1)),o.push(i);else{var a="";i=ut(e,i);for(var s=!1;;){var c=t.charAt(n);if(c===""){o.push((i+a).trim());break}else if(s)c===")"&&(s=!1);else if(c===","){n+=1,o.push((i+a).trim());break}else c==="("&&(s=!0);a+=c,n+=1}}}return o.join(", ")}function ut(e,t){if(!t||t.trim()==="")return t;var n=e.createElement("a");return n.href=t,n.href}function Xd(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Mr(){var e=document.createElement("a");return e.href="",e.href}function Tr(e,t,n,r){return n==="src"||n==="href"&&r&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r&&r[0]!=="#"||n==="background"&&r&&(t==="table"||t==="td"||t==="th")?ut(e,r):n==="srcset"&&r?Zd(e,r):n==="style"&&r?ln(r,Mr()):t==="object"&&n==="data"&&r?ut(e,r):r}function Kd(e,t,n){if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return n?e.matches(n):!1}function Mt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Mt(e.parentNode,t,n):!1;for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return n?Mt(e.parentNode,t,n):!1}function Nr(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(r===null)return!1;if(typeof t=="string"){if(r.classList.contains(t)||r.closest(".".concat(t)))return!0}else if(Mt(r,t,!0))return!0;return!!(n&&(r.matches(n)||r.closest(n)))}function Jd(e,t,n){var r=e.contentWindow;if(r){var o=!1,i;try{i=r.document.readyState}catch{return}if(i!=="complete"){var a=setTimeout(function(){o||(t(),o=!0)},n);e.addEventListener("load",function(){clearTimeout(a),o=!0,t()});return}var s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function Qd(e,t,n){var r=!1,o;try{o=e.sheet}catch{return}if(!o){var i=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(i),r=!0,t()})}}function ef(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,i=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=l===void 0?{}:l,d=t.maskTextFn,f=t.maskInputFn,m=t.dataURLOptions,p=m===void 0?{}:m,g=t.inlineImages,h=t.recordCanvas,y=t.keepIframeSrcFn,v=t.newlyAddedElement,b=v===void 0?!1:v,w=tf(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:se.Document,childNodes:[],compatMode:e.compatMode}:{type:se.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:se.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return rf(e,{doc:n,blockClass:o,blockSelector:i,inlineStylesheet:c,maskInputOptions:u,maskInputFn:f,dataURLOptions:p,inlineImages:g,recordCanvas:h,keepIframeSrcFn:y,newlyAddedElement:b,rootId:w});case e.TEXT_NODE:return nf(e,{maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:w});case e.CDATA_SECTION_NODE:return{type:se.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:se.Comment,textContent:e.textContent||"",rootId:w};default:return!1}}function tf(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function nf(e,t){var n,r=t.maskTextClass,o=t.maskTextSelector,i=t.maskTextFn,a=t.rootId,s=e.parentNode&&e.parentNode.tagName,c=e.textContent,l=s==="STYLE"?!0:void 0,u=s==="SCRIPT"?!0:void 0;if(l&&c){try{e.nextSibling||e.previousSibling||!((n=e.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(c=Ud(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}c=ln(c,Mr())}return u&&(c="SCRIPT_PLACEHOLDER"),!l&&!u&&c&&Nr(e,r,o)&&(c=i?i(c):c.replace(/[\S]/g,"*")),{type:se.Text,textContent:c||"",isStyle:l,rootId:a}}function rf(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,i=t.inlineStylesheet,a=t.maskInputOptions,s=a===void 0?{}:a,c=t.maskInputFn,l=t.dataURLOptions,u=l===void 0?{}:l,d=t.inlineImages,f=t.recordCanvas,m=t.keepIframeSrcFn,p=t.newlyAddedElement,g=p===void 0?!1:p,h=t.rootId,y=Kd(e,r,o),v=Hd(e),b={},w=e.attributes.length,S=0;S<w;S++){var x=e.attributes[S];b[x.name]=Tr(n,v,x.name,x.value)}if(v==="link"&&i){var C=Array.from(n.styleSheets).find(function(_){return _.href===e.href}),I=null;C&&(I=Er(C)),I&&(delete b.rel,delete b.href,b._cssText=ln(I,C.href))}if(v==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var I=Er(e.sheet);I&&(b._cssText=ln(I,Mr()))}if(v==="input"||v==="textarea"||v==="select"){var M=e.value,$=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&M?b.value=Tt({type:b.type,tagName:v,value:M,maskInputOptions:s,maskInputFn:c}):$&&(b.checked=$)}if(v==="option"&&(e.selected&&!s.select?b.selected=!0:delete b.selected),v==="canvas"&&f){if(e.__context==="2d")Pd(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var D=e.toDataURL(u.type,u.quality),T=document.createElement("canvas");T.width=e.width,T.height=e.height;var k=T.toDataURL(u.type,u.quality);D!==k&&(b.rr_dataURL=D)}}if(v==="img"&&d){ct||(ct=n.createElement("canvas"),Ea=ct.getContext("2d"));var W=e,G=W.crossOrigin;W.crossOrigin="anonymous";var re=function(){try{ct.width=W.naturalWidth,ct.height=W.naturalHeight,Ea.drawImage(W,0,0),b.rr_dataURL=ct.toDataURL(u.type,u.quality)}catch(_){console.warn("Cannot inline img src=".concat(W.currentSrc,"! Error: ").concat(_))}G?b.crossOrigin=G:W.removeAttribute("crossorigin")};W.complete&&W.naturalWidth!==0?re():W.onload=re}if((v==="audio"||v==="video")&&(b.rr_mediaState=e.paused?"paused":"played",b.rr_mediaCurrentTime=e.currentTime),g||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),y){var N=e.getBoundingClientRect(),O=N.width,F=N.height;b={class:b.class,rr_width:"".concat(O,"px"),rr_height:"".concat(F,"px")}}return v==="iframe"&&!m(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src),{type:se.Element,tagName:v,attributes:b,childNodes:[],isSVG:Xd(e)||void 0,needBlock:y,rootId:h}}function K(e){return e===void 0?"":e.toLowerCase()}function of(e,t){if(t.comment&&e.type===se.Comment)return!0;if(e.type===se.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(K(e.attributes.name).match(/^msapplication-tile(image|color)$/)||K(e.attributes.name)==="application-name"||K(e.attributes.rel)==="icon"||K(e.attributes.rel)==="apple-touch-icon"||K(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&K(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(K(e.attributes.property).match(/^(og|twitter|fb):/)||K(e.attributes.name).match(/^(og|twitter):/)||K(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(K(e.attributes.name)==="robots"||K(e.attributes.name)==="googlebot"||K(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(K(e.attributes.name)==="author"||K(e.attributes.name)==="generator"||K(e.attributes.name)==="framework"||K(e.attributes.name)==="publisher"||K(e.attributes.name)==="progid"||K(e.attributes.property).match(/^article:/)||K(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(K(e.attributes.name)==="google-site-verification"||K(e.attributes.name)==="yandex-verification"||K(e.attributes.name)==="csrf-token"||K(e.attributes.name)==="p:domain_verify"||K(e.attributes.name)==="verify-v1"||K(e.attributes.name)==="verification"||K(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ge(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,i=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,c=t.skipChild,l=c===void 0?!1:c,u=t.inlineStylesheet,d=u===void 0?!0:u,f=t.maskInputOptions,m=f===void 0?{}:f,p=t.maskTextFn,g=t.maskInputFn,h=t.slimDOMOptions,y=t.dataURLOptions,v=y===void 0?{}:y,b=t.inlineImages,w=b===void 0?!1:b,S=t.recordCanvas,x=S===void 0?!1:S,C=t.onSerialize,I=t.onIframeLoad,M=t.iframeLoadTimeout,$=M===void 0?5e3:M,D=t.onStylesheetLoad,T=t.stylesheetLoadTimeout,k=T===void 0?5e3:T,W=t.keepIframeSrcFn,G=W===void 0?function(){return!1}:W,re=t.newlyAddedElement,N=re===void 0?!1:re,O=t.preserveWhiteSpace,F=O===void 0?!0:O,_=ef(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,dataURLOptions:v,inlineImages:w,recordCanvas:x,keepIframeSrcFn:G,newlyAddedElement:N});if(!_)return console.warn(e,"not serialized"),null;var z;r.hasNode(e)?z=r.getId(e):of(_,h)||!F&&_.type===se.Text&&!_.isStyle&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?z=Ye:z=kr();var B=Object.assign(_,{id:z});if(r.add(e,B),z===Ye)return null;C&&C(e);var q=!l;if(B.type===se.Element){q=q&&!B.needBlock,delete B.needBlock;var j=e.shadowRoot;j&&ze(j)&&(B.isShadowHost=!0)}if((B.type===se.Document||B.type===se.Element)&&q){h.headWhitespace&&B.type===se.Element&&B.tagName==="head"&&(F=!1);for(var ee={doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,slimDOMOptions:h,dataURLOptions:v,inlineImages:w,recordCanvas:x,preserveWhiteSpace:F,onSerialize:C,onIframeLoad:I,iframeLoadTimeout:$,onStylesheetLoad:D,stylesheetLoadTimeout:k,keepIframeSrcFn:G},L=0,J=Array.from(e.childNodes);L<J.length;L++){var Z=J[L],U=Ge(Z,ee);U&&B.childNodes.push(U)}if($d(e)&&e.shadowRoot)for(var ie=0,V=Array.from(e.shadowRoot.childNodes);ie<V.length;ie++){var Z=V[ie],U=Ge(Z,ee);U&&(ze(e.shadowRoot)&&(U.isShadow=!0),B.childNodes.push(U))}}return e.parentNode&&qe(e.parentNode)&&ze(e.parentNode)&&(B.isShadow=!0),B.type===se.Element&&B.tagName==="iframe"&&Jd(e,function(){var le=e.contentDocument;if(le&&I){var Pe=Ge(le,{doc:le,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,slimDOMOptions:h,dataURLOptions:v,inlineImages:w,recordCanvas:x,preserveWhiteSpace:F,onSerialize:C,onIframeLoad:I,iframeLoadTimeout:$,onStylesheetLoad:D,stylesheetLoadTimeout:k,keepIframeSrcFn:G});Pe&&I(e,Pe)}},$),B.type===se.Element&&B.tagName==="link"&&B.attributes.rel==="stylesheet"&&Qd(e,function(){if(D){var le=Ge(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,slimDOMOptions:h,dataURLOptions:v,inlineImages:w,recordCanvas:x,preserveWhiteSpace:F,onSerialize:C,onIframeLoad:I,iframeLoadTimeout:$,onStylesheetLoad:D,stylesheetLoadTimeout:k,keepIframeSrcFn:G});le&&D(e,le)}},k),B}function Ma(e,t){var n=t||{},r=n.mirror,o=r===void 0?new Aa:r,i=n.blockClass,a=i===void 0?"rr-block":i,s=n.blockSelector,c=s===void 0?null:s,l=n.maskTextClass,u=l===void 0?"rr-mask":l,d=n.maskTextSelector,f=d===void 0?null:d,m=n.inlineStylesheet,p=m===void 0?!0:m,g=n.inlineImages,h=g===void 0?!1:g,y=n.recordCanvas,v=y===void 0?!1:y,b=n.maskAllInputs,w=b===void 0?!1:b,S=n.maskTextFn,x=n.maskInputFn,C=n.slimDOM,I=C===void 0?!1:C,M=n.dataURLOptions,$=n.preserveWhiteSpace,D=n.onSerialize,T=n.onIframeLoad,k=n.iframeLoadTimeout,W=n.onStylesheetLoad,G=n.stylesheetLoadTimeout,re=n.keepIframeSrcFn,N=re===void 0?function(){return!1}:re,O=w===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:w===!1?{password:!0}:w,F=I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:I==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:I===!1?{}:I;return Ge(e,{doc:e,mirror:o,blockClass:a,blockSelector:c,maskTextClass:u,maskTextSelector:f,skipChild:!1,inlineStylesheet:p,maskInputOptions:O,maskTextFn:S,maskInputFn:x,slimDOMOptions:F,dataURLOptions:M,inlineImages:h,recordCanvas:v,preserveWhiteSpace:$,onSerialize:D,onIframeLoad:T,iframeLoadTimeout:k,onStylesheetLoad:W,stylesheetLoadTimeout:G,keepIframeSrcFn:N,newlyAddedElement:!1})}var af=/([^\\]):hover/,ep=new RegExp(af.source,"g");function ce(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var dt=`Please stop import mirror directly. Instead of that,\r
239
+ `,n.appendChild(r);let o=document.createElement("div");o.className="overlay";let i=document.createElement("div");i.className="cursor",i.innerHTML=_d,n.appendChild(o),n.appendChild(i),e.host=t,e.overlay=o,e.cursorEl=i,o.addEventListener("pointerdown",ha),o.addEventListener("pointermove",pa),document.addEventListener("pointermove",ga,{capture:!0}),document.addEventListener("pointerup",ya,{capture:!0}),document.addEventListener("pointercancel",ba,{capture:!0}),document.addEventListener("keydown",wa),document.body.appendChild(t)}function fa(){let e=E().noteLayer;document.removeEventListener("pointermove",ga,{capture:!0}),document.removeEventListener("pointerup",ya,{capture:!0}),document.removeEventListener("pointercancel",ba,{capture:!0}),document.removeEventListener("keydown",wa),e.overlay&&(e.overlay.removeEventListener("pointerdown",ha),e.overlay.removeEventListener("pointermove",pa),e.overlay=null),e.cursorEl&&(e.cursorEl=null),e.host&&(e.host.remove(),e.host=null),sn!==null&&(document.documentElement.style.overflow=sn,sn=null),e.notes=[],e.currentNote=null,lt()}function ma(){let e=E().noteLayer;e.cursorEl&&(e.cursorEl.style.display="none"),e.movingNote=null,e.consumedByDeactivation=!1,lt()}function pa(e){let t=E().noteLayer;if(!t.cursorEl||!t.overlay)return;t.cursorEl.style.left=`${e.clientX}px`,t.cursorEl.style.top=`${e.clientY}px`,va(e.target)?(t.cursorEl.style.display="none",t.overlay.style.cursor=""):(t.cursorEl.style.display="",t.overlay.style.cursor="none")}function ha(e){let t=E().noteLayer;if(!t.overlay)return;let n=e.target;if(n.dataset?.deleteBtn==="true"||n.closest("[data-delete-btn]")){let o=n.closest("[data-note-id]");if(o){let i=t.notes.find(a=>a.id===o.id);if(i){Ve(i),e.preventDefault(),e.stopPropagation();return}}}t.overlay.setPointerCapture(e.pointerId);let r=va(e.target);if(r){if(r.state==="editing")return;if(r.state==="selected"){let o=e.target;if(o.dataset?.bubble==="true"||o.closest("[data-bubble]")){an(r),t.currentNote=r,e.preventDefault();return}ua(r,e),e.preventDefault();return}t.currentNote&&t.currentNote!==r&&(st(t.currentNote)||Ve(t.currentNote)),ca(r),t.currentNote=r,ua(r,e),e.preventDefault();return}if(t.currentNote&&(t.currentNote.state==="editing"||t.currentNote.state==="selected")){st(t.currentNote)||Ve(t.currentNote),t.currentNote=null,t.consumedByDeactivation=!0,e.preventDefault();return}t.pointerDown=!0,t.startX=e.clientX,t.startY=e.clientY,t.didDrag=!1,t.consumedByDeactivation=!1,e.preventDefault()}function ga(e){let t=E().noteLayer;if(t.movingNote){let o=e.clientX-t.moveOffsetX,i=e.clientY-t.moveOffsetY;t.movingNote.x=o,t.movingNote.y=i,t.movingNote.element.style.left=`${o}px`,t.movingNote.element.style.top=`${i}px`;return}if(!t.pointerDown||!t.overlay)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.sqrt(n*n+r*r)>Fd&&(t.didDrag=!0,t.dragPreview||(t.dragPreview=document.createElement("div"),t.dragPreview.className="drag-preview",t.overlay.appendChild(t.dragPreview)),t.dragPreview.style.left=`${Math.min(t.startX,e.clientX)}px`,t.dragPreview.style.top=`${Math.min(t.startY,e.clientY)}px`,t.dragPreview.style.width=`${Math.abs(n)}px`,t.dragPreview.style.height=`${Math.abs(r)}px`)}function ya(e){let t=E().noteLayer;if(t.overlay)try{t.overlay.releasePointerCapture(e.pointerId)}catch{}if(t.movingNote){t.movingNote=null;return}if(t.consumedByDeactivation){t.consumedByDeactivation=!1,lt();return}if(!t.pointerDown||!t.overlay){lt();return}if(t.didDrag){t.dragPreview&&(t.dragPreview.remove(),t.dragPreview=null);let n=Math.min(t.startX,e.clientX),r=Math.min(t.startY,e.clientY),o=Math.abs(e.clientX-t.startX),i=Math.abs(e.clientY-t.startY);if(o>10&&i>10){let a=la(n,r,o,i);t.overlay.appendChild(a.element),t.notes.push(a),an(a),t.currentNote=a}}else{let n=sa(e.clientX,e.clientY);t.overlay.appendChild(n.element),t.notes.push(n),an(n),t.currentNote=n}lt()}function ba(){let e=E().noteLayer;e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null),e.movingNote=null,lt()}function wa(e){let t=E().noteLayer;if(t.currentNote){if(e.key==="Enter"&&!e.shiftKey&&t.currentNote.state==="editing"){st(t.currentNote)||Ve(t.currentNote),t.currentNote=null,e.preventDefault();return}if(e.key==="Escape"){t.currentNote.state==="editing"?(st(t.currentNote)||Ve(t.currentNote),t.currentNote=null):t.currentNote.state==="selected"&&(st(t.currentNote),t.currentNote=null),e.preventDefault();return}if(t.currentNote.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){Ve(t.currentNote),t.currentNote=null,e.preventDefault();return}t.currentNote.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&t.currentNote.bubble.textContent?.trim()===""&&(Ve(t.currentNote),t.currentNote=null,e.preventDefault())}}function ua(e,t){let n=E().noteLayer;n.movingNote=e,n.moveOffsetX=t.clientX-e.x,n.moveOffsetY=t.clientY-e.y}function va(e){let t=E().noteLayer;for(let n of t.notes)if(n.element.contains(e))return n;return null}function Ve(e){let t=E().noteLayer;e.element.remove(),t.notes=t.notes.filter(n=>n.id!==e.id),t.currentNote===e&&(t.currentNote=null)}function lt(){let e=E().noteLayer;e.pointerDown=!1,e.startX=0,e.startY=0,e.didDrag=!1,e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null)}function Ca(){let e=E().notesMode;e.active||(e.active=!0,E().touch.active&&(Xt(),e.wasTouchActive=!0),da())}function xr(){let e=E().notesMode;e.active&&(e.active=!1,fa(),e.wasTouchActive&&(e.wasTouchActive=!1,xt()))}async function Sa(){let{image:e}=await Et({viewportOnly:!0});return e}var Ir="mindstudio-browser-agent";function xa(){let e=E(),t=new URLSearchParams(window.location.search);e.zoom.pipMode=t.get("display-mode")==="pip",e.zoom.mobilePreview=t.get("preview")==="mobile"||window.innerWidth<768;try{let n=sessionStorage.getItem("__ms_pip");n==="1"?e.zoom.pipMode=!0:n==="0"&&(e.zoom.pipMode=!1);let r=sessionStorage.getItem("__ms_mobile");r==="1"?e.zoom.mobilePreview=!0:r==="0"&&(e.zoom.mobilePreview=!1)}catch{}e.messages.handler||(e.messages.handler=async n=>{if(n.source===window)return;let r=n.data;if(!(!r||typeof r.command!="string")&&r.channel===Ir)switch(r.command){case"notes-enter":Ca();break;case"notes-exit":xr();break;case"notes-cursor-hide":ma();break;case"notes-screenshot":{try{let o=await Sa();xr(),window.parent.postMessage({channel:Ir,command:"screenshot-result",image:o},"*")}catch(o){window.parent.postMessage({channel:Ir,command:"screenshot-result",error:o instanceof Error?o.message:"Screenshot failed"},"*")}break}case"cursor-show":en("visible");break;case"cursor-hide":en("hidden");break;case"cursor-auto":en(null);break;case"navigate":typeof r.url=="string"&&(window.history.pushState(null,"",r.url),window.dispatchEvent(new PopStateEvent("popstate")));break;case"display-mode-pip":e.zoom.pipMode=!0;try{sessionStorage.setItem("__ms_pip","1")}catch{}break;case"display-mode-full":e.zoom.pipMode=!1;try{sessionStorage.setItem("__ms_pip","0")}catch{}break;case"preview-mode-mobile":e.zoom.mobilePreview=!0;try{sessionStorage.setItem("__ms_mobile","1")}catch{}xt(),mr(!0);break;case"preview-mode-desktop":e.zoom.mobilePreview=!1;try{sessionStorage.setItem("__ms_mobile","0")}catch{}Xt(),mr(!1);break}},window.addEventListener("message",e.messages.handler))}var se;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(se||(se={}));function $d(e){return e.nodeType===e.ELEMENT_NODE}function qe(e){var t=e?.host;return t?.shadowRoot===e}function ze(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Od(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Er(e){try{var t=e.rules||e.cssRules;return t?Od(Array.from(t).map(Ar).join("")):null}catch{return null}}function Ar(e){var t=e.cssText;if(Dd(e))try{t=Er(e.styleSheet)||t}catch{}return t}function Dd(e){return"styleSheet"in e}var Aa=(function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var n;if(!t)return-1;var r=(n=this.getMeta(t))===null||n===void 0?void 0:n.id;return r??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var n=this,r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(function(o){return n.removeNodeFromMap(o)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,n){var r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)},e.prototype.replace=function(t,n){var r=this.getNode(t);if(r){var o=this.nodeMetaMap.get(r);o&&this.nodeMetaMap.set(n,o)}this.idNodeMap.set(t,n)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e})();function ka(){return new Aa}function Tt(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,o=e.value,i=e.maskInputFn,a=o||"";return(t[n.toLowerCase()]||t[r])&&(i?a=i(a):a="*".repeat(a.length)),a}var Ia="__rrweb_original__";function Pd(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var o=0;o<e.height;o+=n){var i=t.getImageData,a=Ia in i?i[Ia]:i,s=new Uint32Array(a.call(t,r,o,Math.min(n,e.width-r),Math.min(n,e.height-o)).data.buffer);if(s.some(function(c){return c!==0}))return!1}return!0}var Wd=1,Bd=new RegExp("[^a-z0-9-_:]"),Ye=-2;function kr(){return Wd++}function Hd(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return Bd.test(t)?"div":t}function Ud(e){return e.cssRules?Array.from(e.cssRules).map(function(t){return t.cssText||""}).join(""):""}function Vd(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var ct,Ea,Gd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zd=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Yd=/^(data:)([^,]*),(.*)/i;function ln(e,t){return(e||"").replace(Gd,function(n,r,o,i,a,s){var c=o||a||s,l=r||i||"";if(!c)return n;if(!zd.test(c)||Yd.test(c))return"url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return"url(".concat(l).concat(Vd(t)+c).concat(l,")");var u=t.split("/"),d=c.split("/");u.pop();for(var f=0,m=d;f<m.length;f++){var p=m[f];p!=="."&&(p===".."?u.pop():u.push(p))}return"url(".concat(l).concat(u.join("/")).concat(l,")")})}var qd=/^[^ \t\n\r\u000c]+/,jd=/^[, \t\n\r\u000c]+/;function Zd(e,t){if(t.trim()==="")return t;var n=0;function r(l){var u,d=l.exec(t.substring(n));return d?(u=d[0],n+=u.length,u):""}for(var o=[];r(jd),!(n>=t.length);){var i=r(qd);if(i.slice(-1)===",")i=ut(e,i.substring(0,i.length-1)),o.push(i);else{var a="";i=ut(e,i);for(var s=!1;;){var c=t.charAt(n);if(c===""){o.push((i+a).trim());break}else if(s)c===")"&&(s=!1);else if(c===","){n+=1,o.push((i+a).trim());break}else c==="("&&(s=!0);a+=c,n+=1}}}return o.join(", ")}function ut(e,t){if(!t||t.trim()==="")return t;var n=e.createElement("a");return n.href=t,n.href}function Xd(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Mr(){var e=document.createElement("a");return e.href="",e.href}function Tr(e,t,n,r){return n==="src"||n==="href"&&r&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r&&r[0]!=="#"||n==="background"&&r&&(t==="table"||t==="td"||t==="th")?ut(e,r):n==="srcset"&&r?Zd(e,r):n==="style"&&r?ln(r,Mr()):t==="object"&&n==="data"&&r?ut(e,r):r}function Kd(e,t,n){if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return n?e.matches(n):!1}function Mt(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Mt(e.parentNode,t,n):!1;for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return n?Mt(e.parentNode,t,n):!1}function Nr(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(r===null)return!1;if(typeof t=="string"){if(r.classList.contains(t)||r.closest(".".concat(t)))return!0}else if(Mt(r,t,!0))return!0;return!!(n&&(r.matches(n)||r.closest(n)))}function Jd(e,t,n){var r=e.contentWindow;if(r){var o=!1,i;try{i=r.document.readyState}catch{return}if(i!=="complete"){var a=setTimeout(function(){o||(t(),o=!0)},n);e.addEventListener("load",function(){clearTimeout(a),o=!0,t()});return}var s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function Qd(e,t,n){var r=!1,o;try{o=e.sheet}catch{return}if(!o){var i=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(i),r=!0,t()})}}function ef(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,i=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,c=t.inlineStylesheet,l=t.maskInputOptions,u=l===void 0?{}:l,d=t.maskTextFn,f=t.maskInputFn,m=t.dataURLOptions,p=m===void 0?{}:m,g=t.inlineImages,h=t.recordCanvas,y=t.keepIframeSrcFn,v=t.newlyAddedElement,b=v===void 0?!1:v,w=tf(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:se.Document,childNodes:[],compatMode:e.compatMode}:{type:se.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:se.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return rf(e,{doc:n,blockClass:o,blockSelector:i,inlineStylesheet:c,maskInputOptions:u,maskInputFn:f,dataURLOptions:p,inlineImages:g,recordCanvas:h,keepIframeSrcFn:y,newlyAddedElement:b,rootId:w});case e.TEXT_NODE:return nf(e,{maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:w});case e.CDATA_SECTION_NODE:return{type:se.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:se.Comment,textContent:e.textContent||"",rootId:w};default:return!1}}function tf(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function nf(e,t){var n,r=t.maskTextClass,o=t.maskTextSelector,i=t.maskTextFn,a=t.rootId,s=e.parentNode&&e.parentNode.tagName,c=e.textContent,l=s==="STYLE"?!0:void 0,u=s==="SCRIPT"?!0:void 0;if(l&&c){try{e.nextSibling||e.previousSibling||!((n=e.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(c=Ud(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}c=ln(c,Mr())}return u&&(c="SCRIPT_PLACEHOLDER"),!l&&!u&&c&&Nr(e,r,o)&&(c=i?i(c):c.replace(/[\S]/g,"*")),{type:se.Text,textContent:c||"",isStyle:l,rootId:a}}function rf(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,i=t.inlineStylesheet,a=t.maskInputOptions,s=a===void 0?{}:a,c=t.maskInputFn,l=t.dataURLOptions,u=l===void 0?{}:l,d=t.inlineImages,f=t.recordCanvas,m=t.keepIframeSrcFn,p=t.newlyAddedElement,g=p===void 0?!1:p,h=t.rootId,y=Kd(e,r,o),v=Hd(e),b={},w=e.attributes.length,S=0;S<w;S++){var x=e.attributes[S];b[x.name]=Tr(n,v,x.name,x.value)}if(v==="link"&&i){var C=Array.from(n.styleSheets).find(function(_){return _.href===e.href}),I=null;C&&(I=Er(C)),I&&(delete b.rel,delete b.href,b._cssText=ln(I,C.href))}if(v==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var I=Er(e.sheet);I&&(b._cssText=ln(I,Mr()))}if(v==="input"||v==="textarea"||v==="select"){var M=e.value,$=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&M?b.value=Tt({type:b.type,tagName:v,value:M,maskInputOptions:s,maskInputFn:c}):$&&(b.checked=$)}if(v==="option"&&(e.selected&&!s.select?b.selected=!0:delete b.selected),v==="canvas"&&f){if(e.__context==="2d")Pd(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){var D=e.toDataURL(u.type,u.quality),T=document.createElement("canvas");T.width=e.width,T.height=e.height;var k=T.toDataURL(u.type,u.quality);D!==k&&(b.rr_dataURL=D)}}if(v==="img"&&d){ct||(ct=n.createElement("canvas"),Ea=ct.getContext("2d"));var W=e,G=W.crossOrigin;W.crossOrigin="anonymous";var re=function(){try{ct.width=W.naturalWidth,ct.height=W.naturalHeight,Ea.drawImage(W,0,0),b.rr_dataURL=ct.toDataURL(u.type,u.quality)}catch(_){console.warn("Cannot inline img src=".concat(W.currentSrc,"! Error: ").concat(_))}G?b.crossOrigin=G:W.removeAttribute("crossorigin")};W.complete&&W.naturalWidth!==0?re():W.onload=re}if((v==="audio"||v==="video")&&(b.rr_mediaState=e.paused?"paused":"played",b.rr_mediaCurrentTime=e.currentTime),g||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),y){var N=e.getBoundingClientRect(),O=N.width,F=N.height;b={class:b.class,rr_width:"".concat(O,"px"),rr_height:"".concat(F,"px")}}return v==="iframe"&&!m(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src),{type:se.Element,tagName:v,attributes:b,childNodes:[],isSVG:Xd(e)||void 0,needBlock:y,rootId:h}}function K(e){return e===void 0?"":e.toLowerCase()}function of(e,t){if(t.comment&&e.type===se.Comment)return!0;if(e.type===se.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(K(e.attributes.name).match(/^msapplication-tile(image|color)$/)||K(e.attributes.name)==="application-name"||K(e.attributes.rel)==="icon"||K(e.attributes.rel)==="apple-touch-icon"||K(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&K(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(K(e.attributes.property).match(/^(og|twitter|fb):/)||K(e.attributes.name).match(/^(og|twitter):/)||K(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(K(e.attributes.name)==="robots"||K(e.attributes.name)==="googlebot"||K(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(K(e.attributes.name)==="author"||K(e.attributes.name)==="generator"||K(e.attributes.name)==="framework"||K(e.attributes.name)==="publisher"||K(e.attributes.name)==="progid"||K(e.attributes.property).match(/^article:/)||K(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(K(e.attributes.name)==="google-site-verification"||K(e.attributes.name)==="yandex-verification"||K(e.attributes.name)==="csrf-token"||K(e.attributes.name)==="p:domain_verify"||K(e.attributes.name)==="verify-v1"||K(e.attributes.name)==="verification"||K(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ge(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,i=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,c=t.skipChild,l=c===void 0?!1:c,u=t.inlineStylesheet,d=u===void 0?!0:u,f=t.maskInputOptions,m=f===void 0?{}:f,p=t.maskTextFn,g=t.maskInputFn,h=t.slimDOMOptions,y=t.dataURLOptions,v=y===void 0?{}:y,b=t.inlineImages,w=b===void 0?!1:b,S=t.recordCanvas,x=S===void 0?!1:S,C=t.onSerialize,I=t.onIframeLoad,M=t.iframeLoadTimeout,$=M===void 0?5e3:M,D=t.onStylesheetLoad,T=t.stylesheetLoadTimeout,k=T===void 0?5e3:T,W=t.keepIframeSrcFn,G=W===void 0?function(){return!1}:W,re=t.newlyAddedElement,N=re===void 0?!1:re,O=t.preserveWhiteSpace,F=O===void 0?!0:O,_=ef(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,dataURLOptions:v,inlineImages:w,recordCanvas:x,keepIframeSrcFn:G,newlyAddedElement:N});if(!_)return console.warn(e,"not serialized"),null;var z;r.hasNode(e)?z=r.getId(e):of(_,h)||!F&&_.type===se.Text&&!_.isStyle&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?z=Ye:z=kr();var B=Object.assign(_,{id:z});if(r.add(e,B),z===Ye)return null;C&&C(e);var q=!l;if(B.type===se.Element){q=q&&!B.needBlock,delete B.needBlock;var j=e.shadowRoot;j&&ze(j)&&(B.isShadowHost=!0)}if((B.type===se.Document||B.type===se.Element)&&q){h.headWhitespace&&B.type===se.Element&&B.tagName==="head"&&(F=!1);for(var ee={doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,slimDOMOptions:h,dataURLOptions:v,inlineImages:w,recordCanvas:x,preserveWhiteSpace:F,onSerialize:C,onIframeLoad:I,iframeLoadTimeout:$,onStylesheetLoad:D,stylesheetLoadTimeout:k,keepIframeSrcFn:G},L=0,J=Array.from(e.childNodes);L<J.length;L++){var Z=J[L],U=Ge(Z,ee);U&&B.childNodes.push(U)}if($d(e)&&e.shadowRoot)for(var ie=0,V=Array.from(e.shadowRoot.childNodes);ie<V.length;ie++){var Z=V[ie],U=Ge(Z,ee);U&&(ze(e.shadowRoot)&&(U.isShadow=!0),B.childNodes.push(U))}}return e.parentNode&&qe(e.parentNode)&&ze(e.parentNode)&&(B.isShadow=!0),B.type===se.Element&&B.tagName==="iframe"&&Jd(e,function(){var le=e.contentDocument;if(le&&I){var Pe=Ge(le,{doc:le,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,slimDOMOptions:h,dataURLOptions:v,inlineImages:w,recordCanvas:x,preserveWhiteSpace:F,onSerialize:C,onIframeLoad:I,iframeLoadTimeout:$,onStylesheetLoad:D,stylesheetLoadTimeout:k,keepIframeSrcFn:G});Pe&&I(e,Pe)}},$),B.type===se.Element&&B.tagName==="link"&&B.attributes.rel==="stylesheet"&&Qd(e,function(){if(D){var le=Ge(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:m,maskTextFn:p,maskInputFn:g,slimDOMOptions:h,dataURLOptions:v,inlineImages:w,recordCanvas:x,preserveWhiteSpace:F,onSerialize:C,onIframeLoad:I,iframeLoadTimeout:$,onStylesheetLoad:D,stylesheetLoadTimeout:k,keepIframeSrcFn:G});le&&D(e,le)}},k),B}function Ma(e,t){var n=t||{},r=n.mirror,o=r===void 0?new Aa:r,i=n.blockClass,a=i===void 0?"rr-block":i,s=n.blockSelector,c=s===void 0?null:s,l=n.maskTextClass,u=l===void 0?"rr-mask":l,d=n.maskTextSelector,f=d===void 0?null:d,m=n.inlineStylesheet,p=m===void 0?!0:m,g=n.inlineImages,h=g===void 0?!1:g,y=n.recordCanvas,v=y===void 0?!1:y,b=n.maskAllInputs,w=b===void 0?!1:b,S=n.maskTextFn,x=n.maskInputFn,C=n.slimDOM,I=C===void 0?!1:C,M=n.dataURLOptions,$=n.preserveWhiteSpace,D=n.onSerialize,T=n.onIframeLoad,k=n.iframeLoadTimeout,W=n.onStylesheetLoad,G=n.stylesheetLoadTimeout,re=n.keepIframeSrcFn,N=re===void 0?function(){return!1}:re,O=w===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:w===!1?{password:!0}:w,F=I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:I==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:I===!1?{}:I;return Ge(e,{doc:e,mirror:o,blockClass:a,blockSelector:c,maskTextClass:u,maskTextSelector:f,skipChild:!1,inlineStylesheet:p,maskInputOptions:O,maskTextFn:S,maskInputFn:x,slimDOMOptions:F,dataURLOptions:M,inlineImages:h,recordCanvas:v,preserveWhiteSpace:$,onSerialize:D,onIframeLoad:T,iframeLoadTimeout:k,onStylesheetLoad:W,stylesheetLoadTimeout:G,keepIframeSrcFn:N,newlyAddedElement:!1})}var af=/([^\\]):hover/,tp=new RegExp(af.source,"g");function ce(e,t,n=document){let r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var dt=`Please stop import mirror directly. Instead of that,\r
240
240
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
241
241
  or you can use record.mirror to access the mirror instance during recording.`,Ta={map:{},getId(){return console.error(dt),-1},getNode(){return console.error(dt),null},removeNodeFromMap(){console.error(dt)},has(){return console.error(dt),!1},reset(){console.error(dt)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Ta=new Proxy(Ta,{get(e,t,n){return t==="map"&&console.error(dt),Reflect.get(e,t,n)}}));function ft(e,t,n={}){let r=null,o=0;return function(...i){let a=Date.now();!o&&n.leading===!1&&(o=a);let s=t-(a-o),c=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),o=a,e.apply(c,i)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{o=n.leading===!1?0:Date.now(),r=null,e.apply(c,i)},s))}}function je(e,t,n,r,o=window){let i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(a){setTimeout(()=>{n.set.call(this,a)},0),i&&i.set&&i.set.call(this,a)}}),()=>je(e,t,i||{},!0)}function ve(e,t,n){try{if(!(t in e))return()=>{};let r=e[t],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}function un(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function dn(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function te(e,t,n,r){if(!e)return!1;let o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!o)return!1;if(typeof t=="string"){if(o.classList.contains(t)||r&&o.closest("."+t)!==null)return!0}else if(Mt(o,t,r))return!0;return!!(n&&(e.matches(n)||r&&o.closest(n)!==null))}function Na(e,t){return t.getId(e)!==-1}function fn(e,t){return t.getId(e)===Ye}function Lr(e,t){if(qe(e))return!1;let n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Lr(e.parentNode,t):!0:!0}function Rr(e){return!!e.changedTouches}function La(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let n=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function mn(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function pn(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function hn(e){return!!e?.shadowRoot}var cn=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var n;return(n=this.styleIDMap.get(t))!==null&&n!==void 0?n:-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};var H=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(H||{}),P=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(P||{}),gn=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(gn||{}),Fe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Fe||{});function Ra(e){return"__ln"in e}var Fr=class{constructor(){this.length=0,this.head=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=n?.next||null;return n}addNode(t){let n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&Ra(t.previousSibling)){let r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&Ra(t.nextSibling)&&t.nextSibling.__ln.previous){let r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;this.length++}removeNode(t){let n=t.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next&&(n.next.previous=n.previous)):(this.head=n.next,this.head&&(this.head.previous=null)),t.__ln&&delete t.__ln,this.length--)}},Fa=(e,t)=>`${e}@${t}`,yn=class{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;let t=[],n=new Fr,r=s=>{let c=s,l=Ye;for(;l===Ye;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},o=s=>{var c,l,u,d;let f=null;((l=(c=s.getRootNode)===null||c===void 0?void 0:c.call(s))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(f=s.getRootNode().host);let m=f;for(;((d=(u=m?.getRootNode)===null||u===void 0?void 0:u.call(m))===null||d===void 0?void 0:d.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&m.getRootNode().host;)m=m.getRootNode().host;let p=!this.doc.contains(s)&&(!m||!this.doc.contains(m));if(!s.parentNode||p)return;let g=qe(s.parentNode)?this.mirror.getId(f):this.mirror.getId(s.parentNode),h=r(s);if(g===-1||h===-1)return n.addNode(s);let y=Ge(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:v=>{mn(v,this.mirror)&&this.iframeManager.addIframe(v),pn(v,this.mirror)&&this.stylesheetManager.trackLinkElement(v),hn(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(v,b)=>{this.iframeManager.attachIframe(v,b),this.shadowDomManager.observeAttachShadow(v)},onStylesheetLoad:(v,b)=>{this.stylesheetManager.attachLinkElement(v,b)}});y&&t.push({parentId:g,nextId:h,node:y})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))_a(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||o(s);for(let s of Array.from(this.addedSet.values()))!$a(this.droppedSet,s)&&!_a(this.removes,s,this.mirror)||$a(this.movedSet,s)?o(s):this.droppedSet.add(s);let i=null;for(;n.length;){let s=null;if(i){let c=this.mirror.getId(i.value.parentNode),l=r(i.value);c!==-1&&l!==-1&&(s=i)}if(!s)for(let c=n.length-1;c>=0;c--){let l=n.get(c);if(l){let u=this.mirror.getId(l.value.parentNode);if(r(l.value)===-1)continue;if(u!==-1){s=l;break}else{let f=l.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let m=f.parentNode.host;if(this.mirror.getId(m)!==-1){s=l;break}}}}}if(!s){for(;n.head;)n.removeNode(n.head.value);break}i=s.previous,n.removeNode(s.value),o(s.value)}let a={texts:this.texts.map(s=>({id:this.mirror.getId(s.node),value:s.value})).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>({id:this.mirror.getId(s.node),attributes:s.attributes})).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!fn(t.target,this.mirror))switch(t.type){case"characterData":{let n=t.target.textContent;!te(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:Nr(t.target,this.maskTextClass,this.maskTextSelector)&&n?this.maskTextFn?this.maskTextFn(n):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{let n=t.target,r=t.target.getAttribute(t.attributeName);if(t.attributeName==="value"&&(r=Tt({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),te(t.target,this.blockClass,this.blockSelector,!1)||r===t.oldValue)return;let o=this.attributes.find(i=>i.node===t.target);if(n.tagName==="IFRAME"&&t.attributeName==="src"&&!this.keepIframeSrcFn(r))if(!n.contentDocument)t.attributeName="rr_src";else return;if(o||(o={node:t.target,attributes:{}},this.attributes.push(o)),t.attributeName==="style"){let i=this.doc.createElement("span");t.oldValue&&i.setAttribute("style",t.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});let a=o.attributes.style;for(let s of Array.from(n.style)){let c=n.style.getPropertyValue(s),l=n.style.getPropertyPriority(s);(c!==i.style.getPropertyValue(s)||l!==i.style.getPropertyPriority(s))&&(l===""?a[s]=c:a[s]=[c,l])}for(let s of Array.from(i.style))n.style.getPropertyValue(s)===""&&(a[s]=!1)}else o.attributes[t.attributeName]=Tr(this.doc,n.tagName,t.attributeName,r);break}case"childList":{if(te(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{let r=this.mirror.getId(n),o=qe(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);te(t.target,this.blockClass,this.blockSelector,!1)||fn(n,this.mirror)||!Na(n,this.mirror)||(this.addedSet.has(n)?(_r(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Lr(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Fa(r,o)]?_r(this.movedSet,n):this.removes.push({parentId:o,id:r,isShadow:qe(t.target)&&ze(t.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(t,n)=>{if(this.mirror.hasNode(t)){if(fn(t,this.mirror))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Fa(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);te(t,this.blockClass,this.blockSelector,!1)||t.childNodes.forEach(r=>this.genAdds(r))}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function _r(e,t){e.delete(t),t.childNodes.forEach(n=>_r(e,n))}function _a(e,t,n){return e.length===0?!1:Oa(e,t,n)}function Oa(e,t,n){let{parentNode:r}=t;if(!r)return!1;let o=n.getId(r);return e.some(i=>i.id===o)?!0:Oa(e,r,n)}function $a(e,t){return e.size===0?!1:Da(e,t)}function Da(e,t){let{parentNode:n}=t;return n?e.has(n)?!0:Da(e,n):!1}var De=[],Ba=typeof CSSGroupingRule<"u",Ha=typeof CSSMediaRule<"u",Ua=typeof CSSSupportsRule<"u",Va=typeof CSSConditionRule<"u";function Nt(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch{return e.target}}function $r(e,t){var n,r;let o=new yn;De.push(o),o.init(e);let i=window.MutationObserver||window.__rrMutationObserver,a=(r=(n=window?.Zone)===null||n===void 0?void 0:n.__symbol__)===null||r===void 0?void 0:r.call(n,"MutationObserver");a&&window[a]&&(i=window[a]);let s=new i(o.processMutations.bind(o));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function sf({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],s,c=ft(d=>{let f=Date.now()-s;e(a.map(m=>(m.timeOffset-=f,m)),d),a=[],s=null},i),l=ft(d=>{let f=Nt(d),{clientX:m,clientY:p}=Rr(d)?d.changedTouches[0]:d;s||(s=Date.now()),a.push({x:m,y:p,id:r.getId(f),timeOffset:Date.now()-s}),c(typeof DragEvent<"u"&&d instanceof DragEvent?P.Drag:d instanceof MouseEvent?P.MouseMove:P.TouchMove)},o,{trailing:!1}),u=[ce("mousemove",l,n),ce("touchmove",l,n),ce("drag",l,n)];return()=>{u.forEach(d=>d())}}function lf({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let a=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,s=[],c=l=>u=>{let d=Nt(u);if(te(d,r,o,!0))return;let f=Rr(u)?u.changedTouches[0]:u;if(!f)return;let m=n.getId(d),{clientX:p,clientY:g}=f;e({type:gn[l],id:m,x:p,y:g})};return Object.keys(gn).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let u=l.toLowerCase(),d=c(l);s.push(ce(u,d,t))}),()=>{s.forEach(l=>l())}}function Or({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){let a=ft(s=>{let c=Nt(s);if(!c||te(c,r,o,!0))return;let l=n.getId(c);if(c===t){let u=t.scrollingElement||t.documentElement;e({id:l,x:u.scrollLeft,y:u.scrollTop})}else e({id:l,x:c.scrollLeft,y:c.scrollTop})},i.scroll||100);return ce("scroll",a,t)}function cf({viewportResizeCb:e}){let t=-1,n=-1,r=ft(()=>{let o=un(),i=dn();(t!==o||n!==i)&&(e({width:Number(i),height:Number(o)}),t=o,n=i)},200);return ce("resize",r,window)}function Pa(e,t){let n=Object.assign({},e);return t||delete n.userTriggered,n}var uf=["INPUT","TEXTAREA","SELECT"],Wa=new WeakMap;function df({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:i,maskInputOptions:a,maskInputFn:s,sampling:c,userTriggeredOnInput:l}){function u(y){let v=Nt(y),b=y.isTrusted;if(v&&v.tagName==="OPTION"&&(v=v.parentElement),!v||!v.tagName||uf.indexOf(v.tagName)<0||te(v,r,o,!0))return;let w=v.type;if(v.classList.contains(i))return;let S=v.value,x=!1;w==="radio"||w==="checkbox"?x=v.checked:(a[v.tagName.toLowerCase()]||a[w])&&(S=Tt({maskInputOptions:a,tagName:v.tagName,type:w,value:S,maskInputFn:s})),d(v,Pa({text:S,isChecked:x,userTriggered:b},l));let C=v.name;w==="radio"&&C&&x&&t.querySelectorAll(`input[type="radio"][name="${C}"]`).forEach(I=>{I!==v&&d(I,Pa({text:I.value,isChecked:!x,userTriggered:!1},l))})}function d(y,v){let b=Wa.get(y);if(!b||b.text!==v.text||b.isChecked!==v.isChecked){Wa.set(y,v);let w=n.getId(y);e(Object.assign(Object.assign({},v),{id:w}))}}let m=(c.input==="last"?["change"]:["input","change"]).map(y=>ce(y,u,t)),p=t.defaultView;if(!p)return()=>{m.forEach(y=>y())};let g=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),h=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&m.push(...h.map(y=>je(y[0],y[1],{set(){u({target:this})}},!1,p))),()=>{m.forEach(y=>y())}}function bn(e){let t=[];function n(r,o){if(Ba&&r.parentRule instanceof CSSGroupingRule||Ha&&r.parentRule instanceof CSSMediaRule||Ua&&r.parentRule instanceof CSSSupportsRule||Va&&r.parentRule instanceof CSSConditionRule){let a=Array.from(r.parentRule.cssRules).indexOf(r);o.unshift(a)}else if(r.parentStyleSheet){let a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);o.unshift(a)}return o}return n(e,t)}function Oe(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function ff({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){let o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=function(u,d){let{id:f,styleId:m}=Oe(this,t,n.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,adds:[{rule:u,index:d}]}),o.apply(this,[u,d])};let i=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=function(u){let{id:d,styleId:f}=Oe(this,t,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,removes:[{index:u}]}),i.apply(this,[u])};let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=function(u){let{id:d,styleId:f}=Oe(this,t,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,replace:u}),a.apply(this,[u])});let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=function(u){let{id:d,styleId:f}=Oe(this,t,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,replaceSync:u}),s.apply(this,[u])});let c={};Ba?c.CSSGroupingRule=r.CSSGroupingRule:(Ha&&(c.CSSMediaRule=r.CSSMediaRule),Va&&(c.CSSConditionRule=r.CSSConditionRule),Ua&&(c.CSSSupportsRule=r.CSSSupportsRule));let l={};return Object.entries(c).forEach(([u,d])=>{l[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=function(f,m){let{id:p,styleId:g}=Oe(this.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||g&&g!==-1)&&e({id:p,styleId:g,adds:[{rule:f,index:[...bn(this),m||0]}]}),l[u].insertRule.apply(this,[f,m])},d.prototype.deleteRule=function(f){let{id:m,styleId:p}=Oe(this.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||p&&p!==-1)&&e({id:m,styleId:p,removes:[{index:[...bn(this),f]}]}),l[u].deleteRule.apply(this,[f])}}),()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([u,d])=>{d.prototype.insertRule=l[u].insertRule,d.prototype.deleteRule=l[u].deleteRule})}}function Dr({mirror:e,stylesheetManager:t},n){var r,o,i;let a=null;n.nodeName==="#document"?a=e.getId(n):a=e.getId(n.host);let s=n.nodeName==="#document"?(r=n.defaultView)===null||r===void 0?void 0:r.Document:(i=(o=n.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||i===void 0?void 0:i.ShadowRoot,c=Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!c?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return(l=c.get)===null||l===void 0?void 0:l.call(this)},set(l){var u;let d=(u=c.set)===null||u===void 0?void 0:u.call(this,l);if(a!==null&&a!==-1)try{t.adoptStyleSheets(l,a)}catch{}return d}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})})}function mf({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(s,c,l){var u;if(n.has(s))return i.apply(this,[s,c,l]);let{id:d,styleId:f}=Oe((u=this.parentRule)===null||u===void 0?void 0:u.parentStyleSheet,t,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,set:{property:s,value:c,priority:l},index:bn(this.parentRule)}),i.apply(this,[s,c,l])};let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(s){var c;if(n.has(s))return a.apply(this,[s]);let{id:l,styleId:u}=Oe((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,r.styleMirror);return(l&&l!==-1||u&&u!==-1)&&e({id:l,styleId:u,remove:{property:s},index:bn(this.parentRule)}),a.apply(this,[s])},()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=a}}function pf({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o}){let i=s=>ft(c=>{let l=Nt(c);if(!l||te(l,t,n,!0))return;let{currentTime:u,volume:d,muted:f,playbackRate:m}=l;e({type:s,id:r.getId(l),currentTime:u,volume:d,muted:f,playbackRate:m})},o.media||500),a=[ce("play",i(0)),ce("pause",i(1)),ce("seeked",i(2)),ce("volumechange",i(3)),ce("ratechange",i(4))];return()=>{a.forEach(s=>s())}}function hf({fontCb:e,doc:t}){let n=t.defaultView;if(!n)return()=>{};let r=[],o=new WeakMap,i=n.FontFace;n.FontFace=function(c,l,u){let d=new i(c,l,u);return o.set(d,{family:c,buffer:typeof l!="string",descriptors:u,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),d};let a=ve(t.fonts,"add",function(s){return function(c){return setTimeout(()=>{let l=o.get(c);l&&(e(l),o.delete(c))},0),s.apply(this,[c])}});return r.push(()=>{n.FontFace=i}),r.push(a),()=>{r.forEach(s=>s())}}function gf(e){let{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:i}=e,a=!0,s=()=>{let c=t.getSelection();if(!c||a&&c?.isCollapsed)return;a=c.isCollapsed||!1;let l=[],u=c.rangeCount||0;for(let d=0;d<u;d++){let f=c.getRangeAt(d),{startContainer:m,startOffset:p,endContainer:g,endOffset:h}=f;te(m,r,o,!0)||te(g,r,o,!0)||l.push({start:n.getId(m),startOffset:p,end:n.getId(g),endOffset:h})}i({ranges:l})};return s(),ce("selectionchange",s)}function yf(e,t){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:a,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:f,selectionCb:m}=e;e.mutationCb=(...p)=>{t.mutation&&t.mutation(...p),n(...p)},e.mousemoveCb=(...p)=>{t.mousemove&&t.mousemove(...p),r(...p)},e.mouseInteractionCb=(...p)=>{t.mouseInteraction&&t.mouseInteraction(...p),o(...p)},e.scrollCb=(...p)=>{t.scroll&&t.scroll(...p),i(...p)},e.viewportResizeCb=(...p)=>{t.viewportResize&&t.viewportResize(...p),a(...p)},e.inputCb=(...p)=>{t.input&&t.input(...p),s(...p)},e.mediaInteractionCb=(...p)=>{t.mediaInteaction&&t.mediaInteaction(...p),c(...p)},e.styleSheetRuleCb=(...p)=>{t.styleSheetRule&&t.styleSheetRule(...p),l(...p)},e.styleDeclarationCb=(...p)=>{t.styleDeclaration&&t.styleDeclaration(...p),u(...p)},e.canvasMutationCb=(...p)=>{t.canvasMutation&&t.canvasMutation(...p),d(...p)},e.fontCb=(...p)=>{t.font&&t.font(...p),f(...p)},e.selectionCb=(...p)=>{t.selection&&t.selection(...p),m(...p)}}function Ga(e,t={}){let n=e.doc.defaultView;if(!n)return()=>{};yf(e,t);let r=$r(e,e.doc),o=sf(e),i=lf(e),a=Or(e),s=cf(e),c=df(e),l=pf(e),u=ff(e,{win:n}),d=Dr(e,e.doc),f=mf(e,{win:n}),m=e.collectFonts?hf(e):()=>{},p=gf(e),g=[];for(let h of e.plugins)g.push(h.observer(h.callback,n,h.options));return()=>{De.forEach(h=>h.reset()),r.disconnect(),o(),i(),a(),s(),c(),l(),u(),d(),f(),m(),p(),g.forEach(h=>h())}}var Lt=class{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,o){let i=r||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),s=i.get(n);return s||(s=this.generateIdFn(),i.set(n,s),a.set(s,n)),s}getIds(t,n){let r=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return n.map(i=>this.getId(t,i,r,o))}getRemoteId(t,n,r){let o=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;let i=o.get(n);return i||-1}getRemoteIds(t,n){let r=this.getRemoteIdToIdMap(t);return n.map(o=>this.getRemoteId(t,o,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}};var wn=class{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Lt(kr),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Lt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(r=this.loadListener)===null||r===void 0||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){if(t.data.type==="rrweb"){if(!t.source)return;let r=this.crossOriginIframeMap.get(t.source);if(!r)return;let o=this.transformCrossOriginEvent(r,t.data.event);o&&this.wrappedEmit(o,t.data.isCheckout)}}transformCrossOriginEvent(t,n){var r;switch(n.type){case H.FullSnapshot:return this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t),{timestamp:n.timestamp,type:H.IncrementalSnapshot,data:{source:P.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case H.Meta:case H.Load:case H.DomContentLoaded:return!1;case H.Plugin:return n;case H.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case H.IncrementalSnapshot:switch(n.data.source){case P.Mutation:return n.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t)}),n.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),n.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),n.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),n;case P.Drag:case P.TouchMove:case P.MouseMove:return n.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),n;case P.ViewportResize:return!1;case P.MediaInteraction:case P.MouseInteraction:case P.Scroll:case P.CanvasMutation:case P.Input:return this.replaceIds(n.data,t,["id"]),n;case P.StyleSheetRule:case P.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case P.Font:return n;case P.Selection:return n.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),n;case P.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)===null||r===void 0||r.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),n}}}replace(t,n,r,o){for(let i of o)!Array.isArray(n[i])&&typeof n[i]!="number"||(Array.isArray(n[i])?n[i]=t.getIds(r,n[i]):n[i]=t.getId(r,n[i]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}};var vn=class{constructor(t){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror;let n=this;this.restorePatches.push(ve(Element.prototype,"attachShadow",function(r){return function(o){let i=r.call(this,o);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,this.ownerDocument),i}}))}addShadowRoot(t,n){ze(t)&&(this.shadowDoms.has(t)||(this.shadowDoms.add(t),$r(Object.assign(Object.assign({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t),Or(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),Dr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)},0)))}observeAttachShadow(t){if(t.contentWindow){let n=this;this.restorePatches.push(ve(t.contentWindow.HTMLElement.prototype,"attachShadow",function(r){return function(o){let i=r.call(this,o);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,t.contentDocument),i}}))}}reset(){this.restorePatches.forEach(t=>t()),this.shadowDoms=new WeakSet}};function za(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Ya(e,t,n,r){function o(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function s(u){try{l(r.next(u))}catch(d){a(d)}}function c(u){try{l(r.throw(u))}catch(d){a(d)}}function l(u){u.done?i(u.value):o(u.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}var mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bf=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Rt=0;Rt<mt.length;Rt++)bf[mt.charCodeAt(Rt)]=Rt;var Rt,qa=function(e){var t=new Uint8Array(e),n,r=t.length,o="";for(n=0;n<r;n+=3)o+=mt[t[n]>>2],o+=mt[(t[n]&3)<<4|t[n+1]>>4],o+=mt[(t[n+1]&15)<<2|t[n+2]>>6],o+=mt[t[n+2]&63];return r%3===2?o=o.substring(0,o.length-1)+"=":r%3===1&&(o=o.substring(0,o.length-2)+"=="),o};var ja=new Map;function wf(e,t){let n=ja.get(e);return n||(n=new Map,ja.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}var Pr=(e,t,n)=>{if(!e||!(Za(e,t)||typeof e=="object"))return;let r=e.constructor.name,o=wf(n,r),i=o.indexOf(e);return i===-1&&(i=o.length,o.push(e)),i};function Cn(e,t,n){if(e instanceof Array)return e.map(r=>Cn(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let r=e.constructor.name,o=qa(e);return{rr_type:r,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Cn(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let r=e.constructor.name,{src:o}=e;return{rr_type:r,src:o}}else if(e instanceof HTMLCanvasElement){let r="HTMLImageElement",o=e.toDataURL();return{rr_type:r,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Cn(e.data,t,n),e.width,e.height]};if(Za(e,t)||typeof e=="object"){let r=e.constructor.name,o=Pr(e,t,n);return{rr_type:r,index:o}}}}return e}var Sn=(e,t,n)=>[...e].map(r=>Cn(r,t,n)),Za=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function Xa(e,t,n,r){let o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of i)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let s=ve(t.CanvasRenderingContext2D.prototype,a,function(c){return function(...l){return te(this.canvas,n,r,!0)||setTimeout(()=>{let u=Sn([...l],t,this);e(this.canvas,{type:Fe["2D"],property:a,args:u})},0),c.apply(this,l)}});o.push(s)}catch{let c=je(t.CanvasRenderingContext2D.prototype,a,{set(l){e(this.canvas,{type:Fe["2D"],property:a,args:[l],setter:!0})}});o.push(c)}return()=>{o.forEach(a=>a())}}function Wr(e,t,n){let r=[];try{let o=ve(e.HTMLCanvasElement.prototype,"getContext",function(i){return function(a,...s){return te(this,t,n,!0)||"__context"in this||(this.__context=a),i.apply(this,[a,...s])}});r.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach(o=>o())}}function Ka(e,t,n,r,o,i,a){let s=[],c=Object.getOwnPropertyNames(e);for(let l of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let u=ve(e,l,function(d){return function(...f){let m=d.apply(this,f);if(Pr(m,a,this),!te(this.canvas,r,o,!0)){let p=Sn([...f],a,this),g={type:t,property:l,args:p};n(this.canvas,g)}return m}});s.push(u)}catch{let d=je(e,l,{set(f){n(this.canvas,{type:t,property:l,args:[f],setter:!0})}});s.push(d)}return s}function Ja(e,t,n,r,o){let i=[];return i.push(...Ka(t.WebGLRenderingContext.prototype,Fe.WebGL,e,n,r,o,t)),typeof t.WebGL2RenderingContext<"u"&&i.push(...Ka(t.WebGL2RenderingContext.prototype,Fe.WebGL2,e,n,r,o,t)),()=>{i.forEach(a=>a())}}var Br=null;try{Qa=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof Ln=="function"&&Ln("worker_threads"),Br=Qa.Worker}catch{}var Qa;function vf(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}function es(e,t,n){var r=t===void 0?null:t,o=n===void 0?!1:n,i=vf(e,o),a=i.indexOf(`
242
242
  `,10)+1,s=i.substring(a)+(r?"//# sourceMappingURL="+r:"");return function(l){return new Br(s,Object.assign({},l,{eval:!0}))}}function Cf(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,i=n.length;o<i;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function Sf(e,t,n){var r=t===void 0?null:t,o=n===void 0?!1:n,i=Cf(e,o),a=i.indexOf(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/browser-agent",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "Browser-side agent for MindStudio dev previews — captures logs, provides DOM snapshots, and enables remote interaction.",
5
5
  "main": "dist/index.js",
6
6
  "files": [