@mindstudio-ai/browser-agent 0.1.46 → 0.1.48

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 +22 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";var __MindStudioBrowserAgent=(()=>{var $t=Object.defineProperty;var di=Object.getOwnPropertyDescriptor;var fi=Object.getOwnPropertyNames;var mi=Object.prototype.hasOwnProperty;var pi=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},hi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fi(t))!mi.call(e,i)&&i!==n&&$t(e,i,{get:()=>t[i],enumerable:!(r=di(t,i))||r.enumerable});return e};var gi=e=>hi($t({},"__esModule",{value:!0}),e);var gc={};pi(gc,{executeSteps:()=>St,getRefMap:()=>$e,resolveElement:()=>fe,takeSnapshot:()=>Le,takeSnapshotSync:()=>Pt});var Lt="__ms";function yi(){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:{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},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}}}function E(){let e=window;return e[Lt]||(e[Lt]=yi()),e[Lt]}var vn="/__mindstudio_dev__/logs",wi=2e3;function xn(e){E().transport.wsGetter=e}function Sn(){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",vn,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t))}catch{}}function bi(){let e=E().transport;e.flushTimer||(e.flushTimer=setTimeout(()=>{e.flushTimer=null,Sn()},wi))}function vi(){let e=E().transport;e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),Sn()}function Q(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),bi()}function Tt(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),vi()}function Nt(){let e=E().transport;e.capturing=!0,e.captured=[]}function Rt(){let e=E().transport;e.capturing=!1;let t=e.captured;return e.captured=[],t}function En(){window.addEventListener("beforeunload",()=>{let e=E().transport;e.buffer.length>0&&navigator.sendBeacon&&navigator.sendBeacon(vn,JSON.stringify(e.buffer))})}var xi={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 ve(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 xi[n]??null}function Cn(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 Ae(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?xe(c):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=Si(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 xe(a)}let i=xe(e);if(i)return i;let o=e.getAttribute("title");return o?o.trim():""}function xe(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(Ci(r))continue;let i=Ei(r),o=xe(r);o&&(i&&t.length>0&&t.push(" "),t.push(o),i&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function Si(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return xe(n)}let t=e.closest("label");if(t){let n=t.cloneNode(!0),r=n.querySelector("input, textarea, select");r&&r.remove();let i=n.textContent?.trim();if(i)return i}return null}function Ei(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 Ci(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 _t(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 et(){E().networkIdle.activeRequests++}function He(){let e=E().networkIdle;e.activeRequests=Math.max(0,e.activeRequests-1)}function Mn(e=5e3,t=200){return new Promise((n,r)=>{let i=Date.now()+e,o=null;function a(){if(Date.now()>i){o&&clearTimeout(o),n();return}E().networkIdle.activeRequests===0?o||(o=setTimeout(()=>{E().networkIdle.activeRequests===0?n():(o=null,a())},t)):(o&&(clearTimeout(o),o=null),setTimeout(a,50))}a()})}function $e(){return E().snapshot.refMap}async function Le(){return await Mn(),Pt()}function Pt(){let e=E().snapshot;e.refCounter=0,e.refMap=new Map;let t=document.body;if(!t)return"(empty page)";let n=kn(t);return Ft(n,0).trimEnd()}function ee(e){let t=ve(e),n=Ae(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 i=e.tagName.toLowerCase();return e.id?`${i}#${e.id}`:i}function kn(e){if(ki(e))return[];let t=ve(e),n=!t&&Cn(e),r=t||(n?"clickable":null),i="";if(r){i=Ae(e);let u=_t(e,"::before"),d=_t(e,"::after");(u||d)&&(i=[u,i,d].filter(Boolean).join(" ")),i.length>80&&(i=i.slice(0,77)+"...")}let o=Ai(e),a=t==="button"||t==="link"||t==="textbox"||t==="combobox"||t==="checkbox"||t==="radio"||t==="slider"||t==="tab"||t==="menuitem"||n,s=r&&i&&!a,c=null;if(a||s){let u=E().snapshot;u.refCounter++,c=`e${u.refCounter}`,u.refMap.set(c,e)}let l=Mi(e);if(r){let u=l.length===0?"":Ft(l,0).trim();return[{tag:r,name:i,attrs:o,ref:c,children:u&&u===i?[]:l,element:e}]}if(l.length===0){let u=xe(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return l}function Mi(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...kn(n));return t}function ki(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-overlay"||e.id==="__mindstudio-notes-cursor")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"&&n.position!=="static")return!0}catch{}return!1}function Ai(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 o=e;(o.type==="checkbox"||o.type==="radio")&&o.checked&&t.push("checked")}if(n==="input"){let o=e;o.type!=="checkbox"&&o.type!=="radio"&&o.type!=="hidden"&&o.type!=="submit"&&o.type!=="button"&&o.type!=="reset"&&(t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`))}if(n==="textarea"){let o=e;t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`)}if(n==="select"){let o=e,a=o.options[o.selectedIndex];a&&t.push(`value="${a.text}"`)}let r=n.match(/^h([1-6])$/);r&&t.push(`level=${r[1]}`);let i=e.getAttribute("aria-expanded");return i==="true"&&t.push("expanded"),i==="false"&&t.push("collapsed"),e.getAttribute("aria-selected")==="true"&&t.push("selected"),e.getAttribute("aria-pressed")==="true"&&t.push("pressed"),t}function Ft(e,t){let n="";for(let r of e)n+=$i(r,t);return n}function $i(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 i="";r.length>0&&(i+=`${n}${r.join(" ")}
2
- `);let o=r.length>0?t+1:t;return i+=Ft(e.children,o),i}function An(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 O(e){return new Promise(t=>setTimeout(t,e))}function Se(){let e=null,t=0;for(let n of document.querySelectorAll("*")){let r=n,i=getComputedStyle(r).overflowY;if(i!=="auto"&&i!=="scroll")continue;let o=r.scrollHeight-r.clientHeight;o<=20||o>t&&(t=o,e=r)}return e??document.documentElement}var Li=["log","info","warn","error","debug"];function $n(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of Li){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),Q({type:"console",level:e,args:n.map(An),url:location.href})}}}}function Ln(){window.__ms_error_patched||(window.__ms_error_patched=!0,window.addEventListener("error",e=>{Tt({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||{};Tt({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})}))}function Tn(){if(!window.fetch||window.fetch.__ms_patched)return;let e=window.fetch;window.fetch=function(t,n){let r=(n?.method||"GET").toUpperCase(),i=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(i.includes("/__mindstudio_dev__/"))return e.apply(this,[t,n]);let o=Date.now();return et(),e.apply(this,[t,n]).then(a=>{He();let s={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)Q(s);else try{a.clone().text().then(c=>{s.body=c.slice(0,1e3),Q(s)}).catch(()=>Q(s))}catch{Q(s)}return a},a=>{throw He(),Q({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function Nn(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);Q({type:"interaction",event:"click",target:ee(t),text:n,url:location.href})},!0))}function Rn(){if(XMLHttpRequest.prototype.open.__ms_patched)return;let e=window.XMLHttpRequest,t=e.prototype.open,n=e.prototype.send;e.prototype.open=function(r,i,...o){return this.__ms_method=r.toUpperCase(),this.__ms_url=String(i),t.apply(this,[r,i,...o])},e.prototype.send=function(r){let i=this.__ms_method||"GET",o=this.__ms_url||"";if(o.includes("/__mindstudio_dev__/"))return n.apply(this,[r]);let a=Date.now();return et(),this.addEventListener("loadend",function(){He(),Q({type:"network",method:i,url:o,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 fe(e){let t=null;if(e.ref){let n=$e(),r=n.get(e.ref);if(r&&r.isConnected)if(de(r))t={element:r,matched:`${ee(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${Dt(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&de(o)).slice(0,10).map(([o,a])=>`${ee(a)} [ref=${o}]`).join(", ");throw new Error(`Element [ref=${e.ref}] not found. `+(i?`Available refs: ${i}`:"No refs available \u2014 take a snapshot first."))}}if(!t&&(e.text||e.role&&e.text)){let n=e.text,r=e.role,i=_n(n,r);if(i.length===0){let o=_n(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${Dt(o[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=Pn(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(i.length>1){let o=i.filter(Fn),a=o.length===1?o[0]:i[0];t={element:a,matched:ee(a)}}else t={element:i[0],matched:ee(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=Ti(n);if(r.length===0){let i=Pn(n);throw new Error(`No visible element with role "${n}" found. `+(i?`Visible ${n}s: ${i}`:"The page may still be loading \u2014 try a wait command first."))}t={element:r[0],matched:ee(r[0])}}if(!t&&e.label){let n=e.label,r=Ni(n);if(!r){let i=[...document.querySelectorAll("label")].filter(de).map(o=>`"${(o.textContent||"").trim().slice(0,40)}"`).slice(0,8).join(", ");throw new Error(`No input found with label "${n}". `+(i?`Visible labels: ${i}`:"No labels found on the page."))}t={element:r,matched:`${ee(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(!de(r))throw new Error(`Found element for selector "${n}" but it is hidden (${Dt(r)}).`);t={element:r,matched:`${ee(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function _n(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!de(o)||n&&!o.isConnected||t&&ve(o)!==t)continue;if(Ae(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function Ti(e){let t=[];for(let n of document.querySelectorAll("*"))de(n)&&ve(n)===e&&t.push(n);return t}function Ni(e){let t=e.toLowerCase();for(let n of document.querySelectorAll("label")){if(!(n.textContent||"").trim().toLowerCase().includes(t))continue;let i=n.getAttribute("for");if(i){let a=document.getElementById(i);if(a&&de(a))return a}let o=n.querySelector("input, textarea, select");if(o&&de(o))return o}return null}function de(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 Fn(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 Dt(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 Pn(e){let t=[];for(let n of document.querySelectorAll("*"))if(de(n)&&(e?ve(n)===e&&t.push(n):Fn(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${Ae(n).slice(0,40)||ee(n)}"`).join(", ")}function It(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i={bubbles:!0,cancelable:!0,clientX:n,clientY:r,button:0};e.dispatchEvent(new PointerEvent("pointerdown",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mousedown",i)),e instanceof HTMLElement&&e.focus(),e.dispatchEvent(new PointerEvent("pointerup",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mouseup",i)),e.dispatchEvent(new MouseEvent("click",i))}var Ri=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,_i=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function Hn(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),It(e),n.clear&&(Dn(e,""),e.dispatchEvent(new Event("input",{bubbles:!0})));for(let r=0;r<t.length;r++){let i=t[r];e.dispatchEvent(new KeyboardEvent("keydown",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),Dn(e,e.value+i),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),await O(Pi(i,t.length))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function Pi(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 i=Math.max(.1,20/t);return r*i}function Dn(e,t){let n=e instanceof HTMLTextAreaElement?_i:Ri;n?n.call(e,t):e.value=t}async function On(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...fe(e),elapsed:Date.now()-n}}catch{await O(100)}let i=e.text?`"${e.text}"`:e.role?`role "${e.role}"`:e.selector?`selector "${e.selector}"`:"element";throw new Error(`Timed out waiting for ${i} after ${t}ms`)}var In=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function Bn(e,t){if(!(e instanceof HTMLSelectElement))throw new Error("select command requires a <select> element");let n=t.toLowerCase(),r=null;for(let i of e.options)if(i.text.toLowerCase().includes(n)||i.value.toLowerCase()===n||i.label.toLowerCase().includes(n)){r=i;break}if(!r){let i=[...e.options].map(o=>`"${o.text}"`).join(", ");throw new Error(`No option matching "${t}" in select. Available options: ${i}`)}return In?In.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 Wn(e){try{let n=!/\b(return|;|\{)\b/.test(e.trim())?`return (${e})`:e,i=new Function(n)();return i instanceof Promise?await i:i}catch(t){throw new Error(`evaluate failed: ${t instanceof Error?t.message:String(t)}`)}}var Di=Object.defineProperty,X=(e,t)=>()=>(e&&(t=e(e=0)),t),Ye=(e,t)=>{for(var n in t)Di(e,n,{get:t[n],enumerable:!0})};function Ii(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 Hi(e="soft"){switch(M.session.__counterEpoch=(M.session.__counterEpoch||0)+1,e){case"auto":{M.session.styleMap=new Map,M.session.nodeMap=new Map;return}case"soft":{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap,M.computedStyle=new WeakMap,M.baseStyle=new te(50),M.defaultStyle=new te(30),M.image=new te(100),M.background=new te(100),M.resource=new te(150),M.font=new Set;return}default:{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap;return}}}var te,M,re=X(()=>{te=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)}},M={image:new te(100),background:new te(100),resource:new te(150),defaultStyle:new te(30),baseStyle:new te(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function Zt(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function Oi(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function st(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function Bi(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 ut=X(()=>{});function Wi(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(a,s,c){if(i>=n)return;let l=Date.now();(r.get(s)||0)>l||(r.set(s,l+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${c}`):console&&console.error&&console.error(`${e} ${c}`))}return{warnOnce(a,s){o("warn",a,s)},errorOnce(a,s){o("error",a,s)},reset(){r.clear(),i=0}}}function Ui(e){return/^data:|^blob:|^about:blank$/i.test(e)}function qi(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=t.includes("{url}")?t.split("{url}")[0]:t,i=new URL(r||".",n),o=new URL(e,n);if(o.origin===i.origin)return!0;let a=o.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function ji(e,t){if(!t||Ui(e)||qi(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 Yi(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",st(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}${st(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function Un(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 Vi(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function ne(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,i=t.useProxy||"",o=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[,p="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(p)?atob(y):decodeURIComponent(y),b=new Uint8Array([...x].map(S=>S.charCodeAt(0))),w=new Blob([b],{type:(p||"").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 p=await fetch(e);if(!p.ok)return{ok:!1,data:null,status:p.status,url:e,fromCache:!1,reason:"http_error"};let y=await p.blob(),x=y.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Un(y),status:p.status,url:e,fromCache:!1,mime:x}:n==="text"?{ok:!0,data:await y.text(),status:p.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:p.status,url:e,fromCache:!1,mime:x}}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=Vi(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),l=Be.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&Be.delete(c);let u=nt.get(c);if(u)return u;let d=ji(e,i)?Yi(e,i):e,f=t.credentials;if(!f)try{let p=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,p);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let m=new AbortController,g=setTimeout(()=>m.abort("timeout"),r),h=(async()=>{try{let p=await fetch(d,{signal:m.signal,credentials:f,headers:a});if(!p.ok){let b={ok:!1,data:null,status:p.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&Be.set(c,{until:Date.now()+o,result:b}),!s){let w=`${p.status} ${p.statusText||""}`.trim();Bt.warnOnce(`http:${p.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 p.text(),status:p.status,url:d,fromCache:!1};let y=await p.blob(),x=y.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Un(y),status:p.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:y,status:p.status,url:d,fromCache:!1,mime:x}}catch(p){let y=p&&typeof p=="object"&&"name"in p&&p.name==="AbortError"?String(p.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&Be.set(c,{until:Date.now()+o,result:x}),!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`;Bt.errorOnce(b,w)}return t.onError&&t.onError(x),x}finally{clearTimeout(g),nt.delete(c)}})();return nt.set(c,h),h}var Bt,nt,Be,Pe=X(()=>{ut(),Bt=Wi("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),nt=new Map,Be=new Map});async function fr(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=Zt(e);if(!n)return e;let r=Bi(n),i=st(r);if(M.background.has(i)){let o=M.background.get(i);return o?`url("${o}")`:"none"}try{let o=await ne(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(M.background.set(i,o.data),`url("${o.data}")`):(M.background.set(i,null),"none")}catch{return M.background.set(i,null),"none"}}var zi=X(()=>{re(),ut(),Pe()});function Xi(e){if(e=String(e).toLowerCase(),en.has(e)){let o={};return M.defaultStyle.set(e,o),o}if(M.defaultStyle.has(e))return M.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),i={};for(let o of r){if(Qt(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),M.defaultStyle.set(e,i),i}function Qt(e){let t=String(e).toLowerCase();return!!(gr.has(t)||hr.test(t)||pr.test(t))}function Wt(e,t){if(t=String(t||"").toLowerCase(),en.has(t))return"";let n=[],r=Xi(t),i=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[o,a]of Object.entries(e)){if(Qt(o)||i&&(o==="width"||o==="min-width"||o==="max-width"))continue;let s=r[o];a&&a!==s&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function Gi(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 Ki(e){let t=new Map;for(let r of e){let i=M.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([a,s])=>`${a}:${s};`).sort().join("");o&&(t.has(o)||t.set(o,[]),t.get(o).push(r))}let n="";for(let[r,i]of t.entries())n+=`${i.join(",")} { ${r} }
3
- `;return n}function Ji(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of t)n.set(i,`c${r++}`);return n}function Zi(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 pe(e,t=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(e instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=M.computedStyle.get(e);r||(r=new Map,M.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=Zi(e),a=null;try{a=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}i=a||n(),r.set(t,i)}return i}function qn(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function Ut(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var mr,en,Qi,pr,hr,gr,yr=X(()=>{re(),mr=new Set(["meta","script","noscript","title","link","template"]),en=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"]),Qi=["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"],pr=/(?:^|-)(animation|transition)(?:-|$)/i,hr=/^(--.+|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,gr=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 Re(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ea(){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 Ce(){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),i=/mobile/i.test(e),o=!/safari/i.test(e),a=r&&i&&o,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 ta(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var Ve=X(()=>{});function F(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 wr=X(()=>{}),ie=X(()=>{zi(),yr(),Ve(),ut(),wr()}),br={};Ye(br,{toCanvas:()=>dt});function na(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function ra(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function oa(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function ia(e){let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(t.push(n),n=""):n+=o}return n.trim()&&t.push(n),t.map(i=>i.trim()).filter(Boolean)}function aa(e){let t=[],n="",r=0;for(let o=0;o<e.length;o++){let a=e[o];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 i=[];for(let o of t){if(/\binset\b/i.test(o))continue;let a=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[s="0px",c="0px",l="0px"]=a,u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";i.push(`drop-shadow(${s} ${c} ${l}${d?` ${u}`:""})`)}return i.join(" ")}function vr(e){let t=ia(e),n=null,r=null,i=null,o=[];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"?i=u:l==="filter"?n=u:l==="-webkit-filter"?r=u:o.push([l,u])}if(i){let s=aa(i);s&&(n=n?`${n} ${s}`:s,r=r?`${r} ${s}`:s)}let a=[...o];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([s,c])=>`${s}:${c}`).join(";")}function la(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${vr(r)}}`)}function sa(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,la(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${vr(r)}${n}`),e}function ca(e){if(!Ce()||!na(e))return e;try{let t=ra(e),n=sa(t);return oa(n)}catch{return e}}async function dt(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:s}=t;e=ca(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,g,h=Number.isFinite(n),p=Number.isFinite(r);if(h&&p)m=Math.max(1,n),g=Math.max(1,r);else if(h){let b=n/Math.max(1,d);m=n,g=f*b}else if(p){let b=r/Math.max(1,f);g=r,m=d*b}else m=l,g=u;m=m*i,g=g*i;let y=document.createElement("canvas");y.width=m*o,y.height=g*o,y.style.width=`${m}px`,y.style.height=`${g}px`;let x=y.getContext("2d");return o!==1&&x.scale(o,o),s&&(x.save(),x.fillStyle=s,x.fillRect(0,0,m,g),x.restore()),x.drawImage(c,0,0,m,g),y}var ft=X(()=>{Ve()}),rt={};Ye(rt,{rasterize:()=>xr});async function xr(e,t){let n=await dt(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 ot=X(()=>{ft()}),qt={};Ye(qt,{toImg:()=>jn,toSvg:()=>jn});async function jn(e,t){let{scale:n=1,width:r,height:i,meta:o={}}=t,a=Number.isFinite(r),s=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||a||s;if(Ce()&&c)return await xr(e,{...t,format:"png",quality:1,meta:o});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=`${i}px`;else if(a){let u=Number.isFinite(o.w0)?o.w0:l.naturalWidth,d=Number.isFinite(o.h0)?o.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(o.w0)?o.w0:l.naturalWidth,d=Number.isFinite(o.h0)?o.h0:l.naturalHeight,f=i/Math.max(1,d);l.style.height=`${i}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){F(t,"SVG width/height patch in toImg failed",f)}}return l}var Yn=X(()=>{ie(),ot()}),Sr={};Ye(Sr,{toBlob:()=>Er});async function Er(e,t){let n=t.type;if(n==="svg"){let i=decodeURIComponent(e.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await dt(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var Cr=X(()=>{ft()}),Mr={};Ye(Mr,{download:()=>ua});async function Vn(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 ua(e,t){let n=new Set(["png","jpeg","jpg","webp","svg"]),r=(t?.type||"").toLowerCase(),i=n.has(r)?r:"",o=(t?.format||i||"").toLowerCase(),a=o==="jpg"?"jpeg":o||"png",s=t?.filename||`snapdom.${a}`,c={...t||{},format:a,type:a};c.dpr=1;let l=ea();if(a==="svg"){let f=await Er(e,{...c,type:"svg"});if(l&&await Vn(f,s))return;let m=URL.createObjectURL(f),g=document.createElement("a");g.href=m,g.download=s,document.body.appendChild(g),g.click(),URL.revokeObjectURL(m),g.remove();return}let u=await dt(e,c);if(l){let f=`image/${a}`,m=await new Promise(g=>u.toBlob(g,f,t?.quality));if(m&&await Vn(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 da=X(()=>{Cr(),ft(),Ve()});ie();ie();re();var zn=new WeakMap,qe=new Map,fa=2e3,jt=0;function We(){jt++,qe.size>fa&&qe.clear()}var Xn=!1;function ma(e=document.documentElement){if(!Xn){Xn=!0;try{new MutationObserver(()=>We()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>We()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",We),t.ready?.then(()=>We()).catch(()=>{}))}catch{}}}function pa(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(Qt(f)||i&&(i instanceof RegExp&&i.test(f)||typeof i=="function"&&i(f)))continue;let m=e.getPropertyValue(f);(f==="background-image"||f==="content")&&m.includes("url(")&&!m.includes("data:")&&(m="none"),n[f]=m}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let d of o)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 g of m)delete n[g];f||(n.border="none")}return n}var Gn=new WeakMap;function ha(e){let t=Gn.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(";"),Gn.set(e,t),t)}function ga(e,t=null,n={}){let r=zn.get(e);if(r&&r.epoch===jt)return r.snapshot;let i=t||getComputedStyle(e),o=pa(i,n);return Ea(e,i,o),zn.set(e,{epoch:jt,snapshot:o}),o}function ya(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:qe,defaultStyle:M.defaultStyle,baseStyle:M.baseStyle,image:M.image,resource:M.resource,background:M.background,font:M.font},options:t||{}}:{session:M.session,persist:{snapshotKeyCache:qe,defaultStyle:M.defaultStyle,baseStyle:M.baseStyle,image:M.image,resource:M.resource,background:M.background,font:M.font},options:e||t||{}}}function wa(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],o=n.getPropertyValue(i);o&&t.style.setProperty(i,o)}}async function Ee(e,t,n,r){if(e.tagName==="STYLE")return;let i=ya(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&ma(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(We(),qe.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:s}=i;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")&&wa(e,t,c);let l=ga(e,c,i.options),u=ha(l),d=s.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=Wt(l,f),s.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function ba(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function va(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 xa(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Sa(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 i=e.scrollHeight;if(i===0)return!1;let o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return i>o+a}function Ea(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 i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid")||ba(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||va(t)||xa(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"||Sa(e,t)&&(delete n.height,delete n["block-size"])}yr();var kr=["fill","stroke","color","background-color","stop-color"],Kn=new Map;function Ca(e,t){let n=t+"::"+e.toLowerCase(),r=Kn.get(n);if(r)return r;let i=document,o=t==="http://www.w3.org/2000/svg"?i.createElementNS(t,e):i.createElement(e),a=i.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(o),i.documentElement.appendChild(a);let s=getComputedStyle(o),c={};for(let l of kr)c[l]=s.getPropertyValue(l)||"";return a.remove(),Kn.set(n,c),c}function Ma(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 o=e.attributes;for(let a=0;a<o.length;a++){let s=o[a];if(s&&typeof s.value=="string"&&s.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let o=e.style;if(o&&o.length){let a=new Set;for(let s=0;s<o.length;s++){let c=o[s];if(a.has(c))continue;a.add(c);let l=o.getPropertyValue(c);if(!l||!l.includes("var("))continue;let u=i&&i.getPropertyValue(c);if(u)try{t.style.setProperty(c,u.trim(),o.getPropertyPriority(c))}catch{}}}}if(r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let s=o[a];if(!s||typeof s.value!="string"||!s.value.includes("var("))continue;let c=s.name,l=i&&i.getPropertyValue(c);if(l)try{t.style.setProperty(c,l.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=Ca(e.tagName,o);for(let s of kr){let c=i.getPropertyValue(s)||"",l=a[s]||"";if(c&&c!==l)try{t.style.setProperty(s,c.trim())}catch{}}}}ie();ie();re();Pe();function Ht(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){Re(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function ka(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Aa(e,t,n=!0){return e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?ka(r):r;return`:where(${t} ${i})`}).join(", ")}function $a(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,i,o)=>{let a=Aa(o,t,!0);return`${r}${i}${a}{`}),e):""}function La(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Ta(e){let t="";try{e.querySelectorAll("style").forEach(r=>{t+=(r.textContent||"")+`
1
+ "use strict";var __MindStudioBrowserAgent=(()=>{var $t=Object.defineProperty;var di=Object.getOwnPropertyDescriptor;var fi=Object.getOwnPropertyNames;var mi=Object.prototype.hasOwnProperty;var pi=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},hi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fi(t))!mi.call(e,i)&&i!==n&&$t(e,i,{get:()=>t[i],enumerable:!(r=di(t,i))||r.enumerable});return e};var gi=e=>hi($t({},"__esModule",{value:!0}),e);var gc={};pi(gc,{executeSteps:()=>St,getRefMap:()=>$e,resolveElement:()=>fe,takeSnapshot:()=>Le,takeSnapshotSync:()=>Pt});var Lt="__ms";function yi(){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:{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},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}}}function E(){let e=window;return e[Lt]||(e[Lt]=yi()),e[Lt]}var xn="/__mindstudio_dev__/logs",wi=2e3;function Sn(e){E().transport.wsGetter=e}function En(){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",xn,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t))}catch{}}function bi(){let e=E().transport;e.flushTimer||(e.flushTimer=setTimeout(()=>{e.flushTimer=null,En()},wi))}function vi(){let e=E().transport;e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),En()}function Q(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),bi()}function Tt(e){let t=E().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),vi()}function Nt(){let e=E().transport;e.capturing=!0,e.captured=[]}function _t(){let e=E().transport;e.capturing=!1;let t=e.captured;return e.captured=[],t}function Cn(){window.addEventListener("beforeunload",()=>{let e=E().transport;e.buffer.length>0&&navigator.sendBeacon&&navigator.sendBeacon(xn,JSON.stringify(e.buffer))})}var xi={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 ve(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 xi[n]??null}function Mn(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 Ae(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?xe(c):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=Si(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 xe(a)}let i=xe(e);if(i)return i;let o=e.getAttribute("title");return o?o.trim():""}function xe(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(Ci(r))continue;let i=Ei(r),o=xe(r);o&&(i&&t.length>0&&t.push(" "),t.push(o),i&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function Si(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return xe(n)}let t=e.closest("label");if(t){let n=t.cloneNode(!0),r=n.querySelector("input, textarea, select");r&&r.remove();let i=n.textContent?.trim();if(i)return i}return null}function Ei(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 Ci(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 Rt(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 tt(){E().networkIdle.activeRequests++}function Oe(){let e=E().networkIdle;e.activeRequests=Math.max(0,e.activeRequests-1)}function kn(e=5e3,t=200){return new Promise((n,r)=>{let i=Date.now()+e,o=null;function a(){if(Date.now()>i){o&&clearTimeout(o),n();return}E().networkIdle.activeRequests===0?o||(o=setTimeout(()=>{E().networkIdle.activeRequests===0?n():(o=null,a())},t)):(o&&(clearTimeout(o),o=null),setTimeout(a,50))}a()})}function $e(){return E().snapshot.refMap}async function Le(){return await kn(),Pt()}function Pt(){let e=E().snapshot;e.refCounter=0,e.refMap=new Map;let t=document.body;if(!t)return"(empty page)";let n=An(t);return Ft(n,0).trimEnd()}function ee(e){let t=ve(e),n=Ae(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 i=e.tagName.toLowerCase();return e.id?`${i}#${e.id}`:i}function An(e){if(ki(e))return[];let t=ve(e),n=!t&&Mn(e),r=t||(n?"clickable":null),i="";if(r){i=Ae(e);let u=Rt(e,"::before"),d=Rt(e,"::after");(u||d)&&(i=[u,i,d].filter(Boolean).join(" ")),i.length>80&&(i=i.slice(0,77)+"...")}let o=Ai(e),a=t==="button"||t==="link"||t==="textbox"||t==="combobox"||t==="checkbox"||t==="radio"||t==="slider"||t==="tab"||t==="menuitem"||n,s=r&&i&&!a,c=null;if(a||s){let u=E().snapshot;u.refCounter++,c=`e${u.refCounter}`,u.refMap.set(c,e)}let l=Mi(e);if(r){let u=l.length===0?"":Ft(l,0).trim();return[{tag:r,name:i,attrs:o,ref:c,children:u&&u===i?[]:l,element:e}]}if(l.length===0){let u=xe(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return l}function Mi(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...An(n));return t}function ki(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-overlay"||e.id==="__mindstudio-notes-cursor")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"&&n.position!=="static")return!0}catch{}return!1}function Ai(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 o=e;(o.type==="checkbox"||o.type==="radio")&&o.checked&&t.push("checked")}if(n==="input"){let o=e;o.type!=="checkbox"&&o.type!=="radio"&&o.type!=="hidden"&&o.type!=="submit"&&o.type!=="button"&&o.type!=="reset"&&(t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`))}if(n==="textarea"){let o=e;t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`)}if(n==="select"){let o=e,a=o.options[o.selectedIndex];a&&t.push(`value="${a.text}"`)}let r=n.match(/^h([1-6])$/);r&&t.push(`level=${r[1]}`);let i=e.getAttribute("aria-expanded");return i==="true"&&t.push("expanded"),i==="false"&&t.push("collapsed"),e.getAttribute("aria-selected")==="true"&&t.push("selected"),e.getAttribute("aria-pressed")==="true"&&t.push("pressed"),t}function Ft(e,t){let n="";for(let r of e)n+=$i(r,t);return n}function $i(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 i="";r.length>0&&(i+=`${n}${r.join(" ")}
2
+ `);let o=r.length>0?t+1:t;return i+=Ft(e.children,o),i}function $n(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 H(e){return new Promise(t=>setTimeout(t,e))}function Se(){let e=null,t=0;for(let n of document.querySelectorAll("*")){let r=n,i=getComputedStyle(r).overflowY;if(i!=="auto"&&i!=="scroll")continue;let o=r.scrollHeight-r.clientHeight;o<=20||o>t&&(t=o,e=r)}return e??document.documentElement}var Li=["log","info","warn","error","debug"];function Ln(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of Li){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),Q({type:"console",level:e,args:n.map($n),url:location.href})}}}}function Tn(){window.__ms_error_patched||(window.__ms_error_patched=!0,window.addEventListener("error",e=>{Tt({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||{};Tt({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})}))}function Nn(){if(!window.fetch||window.fetch.__ms_patched)return;let e=window.fetch;window.fetch=function(t,n){let r=(n?.method||"GET").toUpperCase(),i=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(i.includes("/__mindstudio_dev__/"))return e.apply(this,[t,n]);let o=Date.now();return tt(),e.apply(this,[t,n]).then(a=>{Oe();let s={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)Q(s);else try{a.clone().text().then(c=>{s.body=c.slice(0,1e3),Q(s)}).catch(()=>Q(s))}catch{Q(s)}return a},a=>{throw Oe(),Q({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function _n(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);Q({type:"interaction",event:"click",target:ee(t),text:n,url:location.href})},!0))}function Rn(){if(XMLHttpRequest.prototype.open.__ms_patched)return;let e=window.XMLHttpRequest,t=e.prototype.open,n=e.prototype.send;e.prototype.open=function(r,i,...o){return this.__ms_method=r.toUpperCase(),this.__ms_url=String(i),t.apply(this,[r,i,...o])},e.prototype.send=function(r){let i=this.__ms_method||"GET",o=this.__ms_url||"";if(o.includes("/__mindstudio_dev__/"))return n.apply(this,[r]);let a=Date.now();return tt(),this.addEventListener("loadend",function(){Oe(),Q({type:"network",method:i,url:o,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 fe(e){let t=null;if(e.ref){let n=$e(),r=n.get(e.ref);if(r&&r.isConnected)if(de(r))t={element:r,matched:`${ee(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${It(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&de(o)).slice(0,10).map(([o,a])=>`${ee(a)} [ref=${o}]`).join(", ");throw new Error(`Element [ref=${e.ref}] not found. `+(i?`Available refs: ${i}`:"No refs available \u2014 take a snapshot first."))}}if(!t&&(e.text||e.role&&e.text)){let n=e.text,r=e.role,i=Pn(n,r);if(i.length===0){let o=Pn(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${It(o[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=Fn(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(i.length>1){let o=i.filter(In),a=o.length===1?o[0]:i[0];t={element:a,matched:ee(a)}}else t={element:i[0],matched:ee(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=Ti(n);if(r.length===0){let i=Fn(n);throw new Error(`No visible element with role "${n}" found. `+(i?`Visible ${n}s: ${i}`:"The page may still be loading \u2014 try a wait command first."))}t={element:r[0],matched:ee(r[0])}}if(!t&&e.label){let n=e.label,r=Ni(n);if(!r){let i=[...document.querySelectorAll("label")].filter(de).map(o=>`"${(o.textContent||"").trim().slice(0,40)}"`).slice(0,8).join(", ");throw new Error(`No input found with label "${n}". `+(i?`Visible labels: ${i}`:"No labels found on the page."))}t={element:r,matched:`${ee(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(!de(r))throw new Error(`Found element for selector "${n}" but it is hidden (${It(r)}).`);t={element:r,matched:`${ee(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function Pn(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!de(o)||n&&!o.isConnected||t&&ve(o)!==t)continue;if(Ae(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function Ti(e){let t=[];for(let n of document.querySelectorAll("*"))de(n)&&ve(n)===e&&t.push(n);return t}function Ni(e){let t=e.toLowerCase();for(let n of document.querySelectorAll("label")){if(!(n.textContent||"").trim().toLowerCase().includes(t))continue;let i=n.getAttribute("for");if(i){let a=document.getElementById(i);if(a&&de(a))return a}let o=n.querySelector("input, textarea, select");if(o&&de(o))return o}return null}function de(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 In(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 It(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 Fn(e){let t=[];for(let n of document.querySelectorAll("*"))if(de(n)&&(e?ve(n)===e&&t.push(n):In(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${Ae(n).slice(0,40)||ee(n)}"`).join(", ")}function Dt(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i={bubbles:!0,cancelable:!0,clientX:n,clientY:r,button:0};e.dispatchEvent(new PointerEvent("pointerdown",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mousedown",i)),e instanceof HTMLElement&&e.focus(),e.dispatchEvent(new PointerEvent("pointerup",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mouseup",i)),e.dispatchEvent(new MouseEvent("click",i))}var _i=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,Ri=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function Hn(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),Dt(e),n.clear&&(Dn(e,""),e.dispatchEvent(new Event("input",{bubbles:!0})));for(let r=0;r<t.length;r++){let i=t[r];e.dispatchEvent(new KeyboardEvent("keydown",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),Dn(e,e.value+i),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),await H(Pi(i,t.length))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function Pi(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 i=Math.max(.1,20/t);return r*i}function Dn(e,t){let n=e instanceof HTMLTextAreaElement?Ri:_i;n?n.call(e,t):e.value=t}async function Bn(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...fe(e),elapsed:Date.now()-n}}catch{await H(100)}let i=e.text?`"${e.text}"`:e.role?`role "${e.role}"`:e.selector?`selector "${e.selector}"`:"element";throw new Error(`Timed out waiting for ${i} after ${t}ms`)}var On=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function Wn(e,t){if(!(e instanceof HTMLSelectElement))throw new Error("select command requires a <select> element");let n=t.toLowerCase(),r=null;for(let i of e.options)if(i.text.toLowerCase().includes(n)||i.value.toLowerCase()===n||i.label.toLowerCase().includes(n)){r=i;break}if(!r){let i=[...e.options].map(o=>`"${o.text}"`).join(", ");throw new Error(`No option matching "${t}" in select. Available options: ${i}`)}return On?On.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 Un(e){try{let n=!/\b(return|;|\{)\b/.test(e.trim())?`return (${e})`:e,i=new Function(n)();return i instanceof Promise?await i:i}catch(t){throw new Error(`evaluate failed: ${t instanceof Error?t.message:String(t)}`)}}var Ii=Object.defineProperty,X=(e,t)=>()=>(e&&(t=e(e=0)),t),Ye=(e,t)=>{for(var n in t)Ii(e,n,{get:t[n],enumerable:!0})};function Di(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 Oi(e="soft"){switch(M.session.__counterEpoch=(M.session.__counterEpoch||0)+1,e){case"auto":{M.session.styleMap=new Map,M.session.nodeMap=new Map;return}case"soft":{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap,M.computedStyle=new WeakMap,M.baseStyle=new te(50),M.defaultStyle=new te(30),M.image=new te(100),M.background=new te(100),M.resource=new te(150),M.font=new Set;return}default:{M.session.styleMap=new Map,M.session.nodeMap=new Map,M.session.styleCache=new WeakMap;return}}}var te,M,re=X(()=>{te=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)}},M={image:new te(100),background:new te(100),resource:new te(150),defaultStyle:new te(30),baseStyle:new te(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function Zt(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function Hi(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function ct(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function Bi(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 dt=X(()=>{});function Wi(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(a,s,c){if(i>=n)return;let l=Date.now();(r.get(s)||0)>l||(r.set(s,l+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${c}`):console&&console.error&&console.error(`${e} ${c}`))}return{warnOnce(a,s){o("warn",a,s)},errorOnce(a,s){o("error",a,s)},reset(){r.clear(),i=0}}}function Ui(e){return/^data:|^blob:|^about:blank$/i.test(e)}function qi(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=t.includes("{url}")?t.split("{url}")[0]:t,i=new URL(r||".",n),o=new URL(e,n);if(o.origin===i.origin)return!0;let a=o.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function ji(e,t){if(!t||Ui(e)||qi(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 Yi(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",ct(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}${ct(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function qn(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 Vi(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function ne(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,i=t.useProxy||"",o=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[,p="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(p)?atob(y):decodeURIComponent(y),b=new Uint8Array([...x].map(S=>S.charCodeAt(0))),w=new Blob([b],{type:(p||"").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 p=await fetch(e);if(!p.ok)return{ok:!1,data:null,status:p.status,url:e,fromCache:!1,reason:"http_error"};let y=await p.blob(),x=y.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await qn(y),status:p.status,url:e,fromCache:!1,mime:x}:n==="text"?{ok:!0,data:await y.text(),status:p.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:p.status,url:e,fromCache:!1,mime:x}}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=Vi(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),l=Be.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&Be.delete(c);let u=rt.get(c);if(u)return u;let d=ji(e,i)?Yi(e,i):e,f=t.credentials;if(!f)try{let p=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,p);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let m=new AbortController,g=setTimeout(()=>m.abort("timeout"),r),h=(async()=>{try{let p=await fetch(d,{signal:m.signal,credentials:f,headers:a});if(!p.ok){let b={ok:!1,data:null,status:p.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&Be.set(c,{until:Date.now()+o,result:b}),!s){let w=`${p.status} ${p.statusText||""}`.trim();Bt.warnOnce(`http:${p.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 p.text(),status:p.status,url:d,fromCache:!1};let y=await p.blob(),x=y.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await qn(y),status:p.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:y,status:p.status,url:d,fromCache:!1,mime:x}}catch(p){let y=p&&typeof p=="object"&&"name"in p&&p.name==="AbortError"?String(p.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&Be.set(c,{until:Date.now()+o,result:x}),!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`;Bt.errorOnce(b,w)}return t.onError&&t.onError(x),x}finally{clearTimeout(g),rt.delete(c)}})();return rt.set(c,h),h}var Bt,rt,Be,Pe=X(()=>{dt(),Bt=Wi("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),rt=new Map,Be=new Map});async function mr(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=Zt(e);if(!n)return e;let r=Bi(n),i=ct(r);if(M.background.has(i)){let o=M.background.get(i);return o?`url("${o}")`:"none"}try{let o=await ne(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(M.background.set(i,o.data),`url("${o.data}")`):(M.background.set(i,null),"none")}catch{return M.background.set(i,null),"none"}}var zi=X(()=>{re(),dt(),Pe()});function Xi(e){if(e=String(e).toLowerCase(),en.has(e)){let o={};return M.defaultStyle.set(e,o),o}if(M.defaultStyle.has(e))return M.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),i={};for(let o of r){if(Qt(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),M.defaultStyle.set(e,i),i}function Qt(e){let t=String(e).toLowerCase();return!!(yr.has(t)||gr.test(t)||hr.test(t))}function Wt(e,t){if(t=String(t||"").toLowerCase(),en.has(t))return"";let n=[],r=Xi(t),i=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[o,a]of Object.entries(e)){if(Qt(o)||i&&(o==="width"||o==="min-width"||o==="max-width"))continue;let s=r[o];a&&a!==s&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function Gi(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 Ki(e){let t=new Map;for(let r of e){let i=M.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([a,s])=>`${a}:${s};`).sort().join("");o&&(t.has(o)||t.set(o,[]),t.get(o).push(r))}let n="";for(let[r,i]of t.entries())n+=`${i.join(",")} { ${r} }
3
+ `;return n}function Ji(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of t)n.set(i,`c${r++}`);return n}function Zi(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 pe(e,t=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(e instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=M.computedStyle.get(e);r||(r=new Map,M.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=Zi(e),a=null;try{a=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}i=a||n(),r.set(t,i)}return i}function jn(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function Ut(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var pr,en,Qi,hr,gr,yr,wr=X(()=>{re(),pr=new Set(["meta","script","noscript","title","link","template"]),en=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"]),Qi=["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"],hr=/(?:^|-)(animation|transition)(?:-|$)/i,gr=/^(--.+|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,yr=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 _e(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ea(){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 Ce(){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),i=/mobile/i.test(e),o=!/safari/i.test(e),a=r&&i&&o,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 ta(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var Ve=X(()=>{});function F(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 br=X(()=>{}),ie=X(()=>{zi(),wr(),Ve(),dt(),br()}),vr={};Ye(vr,{toCanvas:()=>ft});function na(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function ra(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function oa(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function ia(e){let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(t.push(n),n=""):n+=o}return n.trim()&&t.push(n),t.map(i=>i.trim()).filter(Boolean)}function aa(e){let t=[],n="",r=0;for(let o=0;o<e.length;o++){let a=e[o];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 i=[];for(let o of t){if(/\binset\b/i.test(o))continue;let a=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[s="0px",c="0px",l="0px"]=a,u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";i.push(`drop-shadow(${s} ${c} ${l}${d?` ${u}`:""})`)}return i.join(" ")}function xr(e){let t=ia(e),n=null,r=null,i=null,o=[];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"?i=u:l==="filter"?n=u:l==="-webkit-filter"?r=u:o.push([l,u])}if(i){let s=aa(i);s&&(n=n?`${n} ${s}`:s,r=r?`${r} ${s}`:s)}let a=[...o];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([s,c])=>`${s}:${c}`).join(";")}function la(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${xr(r)}}`)}function sa(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,la(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${xr(r)}${n}`),e}function ca(e){if(!Ce()||!na(e))return e;try{let t=ra(e),n=sa(t);return oa(n)}catch{return e}}async function ft(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:s}=t;e=ca(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,g,h=Number.isFinite(n),p=Number.isFinite(r);if(h&&p)m=Math.max(1,n),g=Math.max(1,r);else if(h){let b=n/Math.max(1,d);m=n,g=f*b}else if(p){let b=r/Math.max(1,f);g=r,m=d*b}else m=l,g=u;m=m*i,g=g*i;let y=document.createElement("canvas");y.width=m*o,y.height=g*o,y.style.width=`${m}px`,y.style.height=`${g}px`;let x=y.getContext("2d");return o!==1&&x.scale(o,o),s&&(x.save(),x.fillStyle=s,x.fillRect(0,0,m,g),x.restore()),x.drawImage(c,0,0,m,g),y}var mt=X(()=>{Ve()}),ot={};Ye(ot,{rasterize:()=>Sr});async function Sr(e,t){let n=await ft(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 it=X(()=>{mt()}),qt={};Ye(qt,{toImg:()=>Yn,toSvg:()=>Yn});async function Yn(e,t){let{scale:n=1,width:r,height:i,meta:o={}}=t,a=Number.isFinite(r),s=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||a||s;if(Ce()&&c)return await Sr(e,{...t,format:"png",quality:1,meta:o});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=`${i}px`;else if(a){let u=Number.isFinite(o.w0)?o.w0:l.naturalWidth,d=Number.isFinite(o.h0)?o.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(o.w0)?o.w0:l.naturalWidth,d=Number.isFinite(o.h0)?o.h0:l.naturalHeight,f=i/Math.max(1,d);l.style.height=`${i}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){F(t,"SVG width/height patch in toImg failed",f)}}return l}var Vn=X(()=>{ie(),it()}),Er={};Ye(Er,{toBlob:()=>Cr});async function Cr(e,t){let n=t.type;if(n==="svg"){let i=decodeURIComponent(e.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await ft(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var Mr=X(()=>{mt()}),kr={};Ye(kr,{download:()=>ua});async function zn(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 ua(e,t){let n=new Set(["png","jpeg","jpg","webp","svg"]),r=(t?.type||"").toLowerCase(),i=n.has(r)?r:"",o=(t?.format||i||"").toLowerCase(),a=o==="jpg"?"jpeg":o||"png",s=t?.filename||`snapdom.${a}`,c={...t||{},format:a,type:a};c.dpr=1;let l=ea();if(a==="svg"){let f=await Cr(e,{...c,type:"svg"});if(l&&await zn(f,s))return;let m=URL.createObjectURL(f),g=document.createElement("a");g.href=m,g.download=s,document.body.appendChild(g),g.click(),URL.revokeObjectURL(m),g.remove();return}let u=await ft(e,c);if(l){let f=`image/${a}`,m=await new Promise(g=>u.toBlob(g,f,t?.quality));if(m&&await zn(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 da=X(()=>{Mr(),mt(),Ve()});ie();ie();re();var Xn=new WeakMap,qe=new Map,fa=2e3,jt=0;function We(){jt++,qe.size>fa&&qe.clear()}var Gn=!1;function ma(e=document.documentElement){if(!Gn){Gn=!0;try{new MutationObserver(()=>We()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>We()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",We),t.ready?.then(()=>We()).catch(()=>{}))}catch{}}}function pa(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(Qt(f)||i&&(i instanceof RegExp&&i.test(f)||typeof i=="function"&&i(f)))continue;let m=e.getPropertyValue(f);(f==="background-image"||f==="content")&&m.includes("url(")&&!m.includes("data:")&&(m="none"),n[f]=m}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let d of o)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 g of m)delete n[g];f||(n.border="none")}return n}var Kn=new WeakMap;function ha(e){let t=Kn.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(";"),Kn.set(e,t),t)}function ga(e,t=null,n={}){let r=Xn.get(e);if(r&&r.epoch===jt)return r.snapshot;let i=t||getComputedStyle(e),o=pa(i,n);return Ea(e,i,o),Xn.set(e,{epoch:jt,snapshot:o}),o}function ya(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:qe,defaultStyle:M.defaultStyle,baseStyle:M.baseStyle,image:M.image,resource:M.resource,background:M.background,font:M.font},options:t||{}}:{session:M.session,persist:{snapshotKeyCache:qe,defaultStyle:M.defaultStyle,baseStyle:M.baseStyle,image:M.image,resource:M.resource,background:M.background,font:M.font},options:e||t||{}}}function wa(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],o=n.getPropertyValue(i);o&&t.style.setProperty(i,o)}}async function Ee(e,t,n,r){if(e.tagName==="STYLE")return;let i=ya(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&ma(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(We(),qe.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:s}=i;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")&&wa(e,t,c);let l=ga(e,c,i.options),u=ha(l),d=s.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=Wt(l,f),s.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function ba(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function va(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 xa(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Sa(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 i=e.scrollHeight;if(i===0)return!1;let o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return i>o+a}function Ea(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 i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid")||ba(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||va(t)||xa(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"||Sa(e,t)&&(delete n.height,delete n["block-size"])}wr();var Ar=["fill","stroke","color","background-color","stop-color"],Jn=new Map;function Ca(e,t){let n=t+"::"+e.toLowerCase(),r=Jn.get(n);if(r)return r;let i=document,o=t==="http://www.w3.org/2000/svg"?i.createElementNS(t,e):i.createElement(e),a=i.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(o),i.documentElement.appendChild(a);let s=getComputedStyle(o),c={};for(let l of Ar)c[l]=s.getPropertyValue(l)||"";return a.remove(),Jn.set(n,c),c}function Ma(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 o=e.attributes;for(let a=0;a<o.length;a++){let s=o[a];if(s&&typeof s.value=="string"&&s.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let o=e.style;if(o&&o.length){let a=new Set;for(let s=0;s<o.length;s++){let c=o[s];if(a.has(c))continue;a.add(c);let l=o.getPropertyValue(c);if(!l||!l.includes("var("))continue;let u=i&&i.getPropertyValue(c);if(u)try{t.style.setProperty(c,u.trim(),o.getPropertyPriority(c))}catch{}}}}if(r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let s=o[a];if(!s||typeof s.value!="string"||!s.value.includes("var("))continue;let c=s.name,l=i&&i.getPropertyValue(c);if(l)try{t.style.setProperty(c,l.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=Ca(e.tagName,o);for(let s of Ar){let c=i.getPropertyValue(s)||"",l=a[s]||"";if(c&&c!==l)try{t.style.setProperty(s,c.trim())}catch{}}}}ie();ie();re();Pe();function Ot(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){_e(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function ka(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Aa(e,t,n=!0){return e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?ka(r):r;return`:where(${t} ${i})`}).join(", ")}function $a(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,i,o)=>{let a=Aa(o,t,!0);return`${r}${i}${a}{`}),e):""}function La(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Ta(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 i of r.cssRules)t+=i.cssText+`
5
- `}catch{}}catch{}return t}function Na(e,t,n){if(!t)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=t,e.insertBefore(r,e.firstChild||null)}function Ra(e,t){try{let n=e.currentSrc||e.src||"";if(!n)return;t.setAttribute("src",n),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function _a(e){let t=new Set;if(!e)return t;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(e);)t.add(r[1]);return t}function Pa(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let n=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(n)return n}catch{}return""}function Fa(e,t,n){let r=[];for(let i of t){let o=Pa(e,i);o&&r.push(`${i}: ${o};`)}return r.length?`${n}{${r.join("")}}
6
- `:""}function Da(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted","")))}async function Ia(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function Ha(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let c=getComputedStyle(e);n=parseFloat(c.borderLeftWidth)||0,r=parseFloat(c.borderRightWidth)||0,i=parseFloat(c.borderTopWidth)||0,o=parseFloat(c.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(n+r))),s=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:s,rect:t}}function oe(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(t=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(t===0||n===0)try{if(t===0){let r=parseFloat(e.getAttribute("width"));!isNaN(r)&&r>0&&(t=r)}if(n===0){let r=parseFloat(e.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function Oa(e,t,n){let r=e.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Ba(e,t,n){let r=await Ia(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=Ha(e),s=n?.snap;if(!s&&typeof window<"u"&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let c={...n,scale:1},l=Oa(r,i,o),u;try{u=await s.toPng(r.documentElement,c)}finally{l()}u.style.display="block",u.style.width=`${i}px`,u.style.height=`${o}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),Ee(e,d,t,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}function Wa(e){let{width:t,height:n}=oe(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,s=Math.round(t||r.width||0),c=Math.round(n||r.height||0),l=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,s||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,c||16),d=(e.type||"text").toLowerCase()==="checkbox",f=!!e.checked,m=!!e.indeterminate,g=Math.max(Math.min(l,u),12),h="middle";try{i&&i.verticalAlign&&(h=i.verticalAlign)}catch{}let p=document.createElement("div");p.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),p.style.cssText=`display:inline-block;width:${g}px;height:${g}px;vertical-align:${h};flex-shrink:0;line-height:0;`;let y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width",String(g)),y.setAttribute("height",String(g)),y.setAttribute("viewBox",`0 0 ${g} ${g}`),p.appendChild(y);function x(){let b="#0a6ed1";try{i&&(b=i.accentColor||i.color||b)}catch{}let w=2,S=w/2,C=g-w;if(y.innerHTML="",d){let v=document.createElementNS("http://www.w3.org/2000/svg","rect");if(v.setAttribute("x",String(S)),v.setAttribute("y",String(S)),v.setAttribute("width",String(C)),v.setAttribute("height",String(C)),v.setAttribute("rx","2"),v.setAttribute("ry","2"),v.setAttribute("fill",f?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(w)),y.appendChild(v),f){let k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",`M ${S+2} ${g/2} L ${g/2-1} ${g-S-2} L ${g-S-2} ${S+2}`),k.setAttribute("stroke","white"),k.setAttribute("stroke-width",String(Math.max(1.5,w))),k.setAttribute("fill","none"),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),y.appendChild(k)}else if(m){let k=document.createElementNS("http://www.w3.org/2000/svg","rect"),N=Math.max(6,C-4);k.setAttribute("x",String((g-N)/2)),k.setAttribute("y",String((g-w)/2)),k.setAttribute("width",String(N)),k.setAttribute("height",String(w)),k.setAttribute("fill",b),k.setAttribute("rx","1"),y.appendChild(k)}}else{let v=document.createElementNS("http://www.w3.org/2000/svg","circle");if(v.setAttribute("cx",String(g/2)),v.setAttribute("cy",String(g/2)),v.setAttribute("r",String((g-w)/2)),v.setAttribute("fill",f?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(w)),y.appendChild(v),f){let k=document.createElementNS("http://www.w3.org/2000/svg","circle"),N=Math.max(2,(g-w*2)*.35);k.setAttribute("cx",String(g/2)),k.setAttribute("cy",String(g/2)),k.setAttribute("r",String(N)),k.setAttribute("fill","white"),y.appendChild(k)}}p.style.setProperty("width",`${g}px`,"important"),p.style.setProperty("height",`${g}px`,"important"),p.style.setProperty("min-width",`${g}px`,"important"),p.style.setProperty("min-height",`${g}px`,"important")}return x(),{el:p,applyVisual:x}}var Oe=new te(80);async function Ue(e){if(M.resource?.has(e))return M.resource.get(e);if(Oe.has(e))return Oe.get(e);let t=(async()=>{let n=await ne(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return M.resource?.set(e,n.data),n.data})();Oe.set(e,t);try{let n=await t;return Oe.set(e,n),n}catch(n){throw Oe.delete(e),n}}var Ua=/\bblob:[^)"'\s]+/g;async function Jn(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(Ua)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await Ue(r);n=n.split(r).join(i)}catch{}return n}function tt(e){return typeof e=="string"&&e.startsWith("blob:")}function qa(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let n=t.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function ja(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function Ya(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll("img"):[];for(let c of r)try{let l=c.getAttribute("src")||c.currentSrc||"";if(tt(l)){let d=await Ue(l);c.setAttribute("src",d)}let u=c.getAttribute("srcset");if(u&&u.includes("blob:")){let d=qa(u),f=!1;for(let m of d)if(tt(m.url))try{m.url=await Ue(m.url),f=!0}catch(g){F(n,"blobUrlToDataUrl for srcset item failed",g)}f&&c.setAttribute("srcset",ja(d))}}catch(l){F(n,"resolveBlobUrls for img failed",l)}let i=e.querySelectorAll?e.querySelectorAll("image"):[];for(let c of i)try{let l="http://www.w3.org/1999/xlink",u=c.getAttribute("href")||c.getAttributeNS?.(l,"href");if(tt(u)){let d=await Ue(u);c.setAttribute("href",d),c.removeAttributeNS?.(l,"href")}}catch(l){F(n,"resolveBlobUrls for SVG image href failed",l)}let o=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let c of o)try{let l=c.getAttribute("style");if(l&&l.includes("blob:")){let u=await Jn(l);c.setAttribute("style",u)}}catch(l){F(n,"replaceBlobUrls in inline style failed",l)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let c of a)try{let l=c.textContent||"";l.includes("blob:")&&(c.textContent=await Jn(l))}catch(l){F(n,"replaceBlobUrls in style tag failed",l)}let s=["poster"];for(let c of s){let l=e.querySelectorAll?e.querySelectorAll(`[${c}^='blob:']`):[];for(let u of l)try{let d=u.getAttribute(c);tt(d)&&u.setAttribute(c,await Ue(d))}catch(d){F(n,`resolveBlobUrls for ${c} failed`,d)}}}Ve();async function it(e,t,n){if(!e)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||mr.has(u))return null;if(u==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return F(t,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=oe(e),m=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${m}px;height:${g}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if(e.matches?.(u)){if(n.excludeMode==="hide"){let d=document.createElement("div"),{width:f,height:m}=oe(e),g=f||e.getBoundingClientRect().width||0,h=m||e.getBoundingClientRect().height||0;return d.style.cssText=`display:inline-block;width:${g}px;height:${h}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof n.filter=="function")try{if(!n.filter(e)){if(n.filterMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=oe(e),m=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${m}px;height:${g}px;visibility:hidden;`,u}else if(n.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(e.tagName==="IFRAME"){let u=!1;try{u=!!(e.contentDocument||e.contentWindow?.document)}catch(d){F(t,"iframe same-origin probe failed",d)}if(u)try{return await Ba(e,t,n)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(u||console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.",e),n.placeholders){let{width:d,height:f}=oe(e),m=document.createElement("div");return m.style.cssText=`width:${d}px;height:${f}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,Ee(e,m,t,n),m}else{let{width:d,height:f}=oe(e),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${d}px;height:${f}px;visibility:hidden;`,Ee(e,m,t,n),m}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),Ee(e,u,t,n);let d=document.createElement("div");return d.textContent=e.getAttribute("data-placeholder-text")||"",d.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(d),u}if(e.tagName==="CANVAS"){let u="";try{let g=e.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){let h=document.createElement("canvas");h.width=e.width,h.height=e.height;let p=h.getContext("2d");p&&(p.drawImage(e,0,0),u=h.toDataURL("image/png"))}}}catch(g){F(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){F(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:f,height:m}=oe(e);return f>0&&(d.style.width=`${f}px`),m>0&&(d.style.height=`${m}px`),t.nodeMap.set(d,e),Ee(e,d,t,n),d}if(e.tagName==="VIDEO"){let u="";try{let g=document.createElement("canvas");g.width=e.videoWidth||e.offsetWidth||320,g.height=e.videoHeight||e.offsetHeight||240;let h=g.getContext("2d");h&&(h.drawImage(e,0,0,g.width,g.height),u=g.toDataURL("image/png"),(!u||u==="data:,")&&(u=""))}catch(g){F(t,"Video frame capture failed, using poster fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch{}u?d.src=u:e.poster&&(d.src=e.poster),d.width=e.videoWidth||e.offsetWidth||0,d.height=e.videoHeight||e.offsetHeight||0;let{width:f,height:m}=oe(e);return f>0&&(d.style.width=`${f}px`),m>0&&(d.style.height=`${m}px`),d.style.objectFit="contain",t.nodeMap.set(d,e),Ee(e,d,t,n),d}let a;try{if(a=e.cloneNode(!1),a.attributes?.length)try{for(let u of a.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(u.value)&&a.setAttribute(u.name,u.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Ma(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Ra(e,a);try{let{width:u,height:d}=oe(e),f=Math.round(u||0),m=Math.round(d||0);f&&(a.dataset.snapdomWidth=String(f)),m&&(a.dataset.snapdomHeight=String(m))}catch(u){F(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),f=b=>{let w=u.match(new RegExp(`${b}\\s*:\\s*([^;]+)`,"i")),S=w?w[1].trim():d.getPropertyValue(b);return/%|auto/i.test(String(S||""))},m=parseInt(a.dataset.snapdomWidth||"0",10),g=parseInt(a.dataset.snapdomHeight||"0",10),h=f("width")||!m,p=f("height")||!g;h&&m&&(a.style.width=`${m}px`),p&&g&&(a.style.height=`${g}px`);let y=d.getPropertyValue("object-fit"),x=d.getPropertyValue("object-position");y&&y!=="fill"?(a.style.objectFit=y,x&&(a.style.objectPosition=x)):(m&&(a.style.minWidth=`${m}px`),g&&(a.style.minHeight=`${g}px`))}catch(u){F(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let s=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=oe(e),f=u||e.getBoundingClientRect().width||0,m=d||e.getBoundingClientRect().height||0;f&&(a.style.width=`${f}px`),m&&(a.style.height=`${m}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&ta()){let{el:d,applyVisual:f}=Wa(e);t.nodeMap.set(d,e),s=f,a=d}else a.value=e.value,a.setAttribute("value",e.value),e.checked!==void 0&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&!e.value&&e.placeholder)try{let u=window.getComputedStyle(e,"::placeholder"),d=u&&u.color;if(d&&d!=="rgba(0, 0, 0, 0)"){let f="snapdom-ph-"+(Math.random()*1e6|0);a.classList.add(f);let m=document.createElement("style");m.textContent=`.${f}::placeholder{color:${d}!important;opacity:${u.opacity||"1"}!important;}`,a.prepend(m)}}catch{}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=e.value),e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){e.disabled&&a.setAttribute("disabled",""),e.required&&a.setAttribute("required",""),e.readOnly&&a.setAttribute("readonly","");let u=e;u.min!==void 0&&u.min!==""&&a.setAttribute("min",u.min),u.max!==void 0&&u.max!==""&&a.setAttribute("max",u.max),u.pattern!==void 0&&u.pattern!==""&&a.setAttribute("pattern",u.pattern);let d=e.getAttribute("aria-invalid");d!==null&&a.setAttribute("aria-invalid",d)}if(Ee(e,a,t,n),s&&s(),e instanceof SVGElement){let u=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let d=window.getComputedStyle(e);for(let f of u){let m=d.getPropertyValue(f);m&&a.style.setProperty(f,m)}}catch{}}if(e.shadowRoot){let u=function(b,w){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return w(null);it(b,t,n).then(S=>{w(S||null)}).catch(()=>{w(null)})};try{let b=e.shadowRoot.querySelectorAll("slot");for(let w of b){let S=[];try{S=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{S=w.assignedNodes?.()||[]}for(let C of S)r.add(C)}}catch{}let d=La(t),f=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let m=Ta(e.shadowRoot),g=$a(m,f),h=_a(m),p=Fa(e,h,f);Na(a,p+g,d);let y=document.createDocumentFragment(),x=await Ht(Array.from(e.shadowRoot.childNodes),u,n.fast);y.append(...x.filter(b=>!!b)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=function(h,p){it(h,t,n).then(y=>{y&&Da(y),p(y||null)}).catch(()=>{p(null)})},d=e.assignedNodes?.({flatten:!0})||[],f=d.length>0?d:Array.from(e.childNodes),m=document.createDocumentFragment(),g=await Ht(Array.from(f),u,n.fast);return m.append(...g.filter(h=>!!h)),m}function c(u,d){if(r.has(u))return d(null);it(u,t,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let l=await Ht(Array.from(e.childNodes),c,n.fast);if(a.append(...l.filter(u=>!!u)),i!==null&&a instanceof HTMLSelectElement){a.value=i;for(let u of a.options)u.value===i?u.setAttribute("selected",""):u.removeAttribute("selected")}return o!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=o),a}ie();ut();re();var Va=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],Te=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),Yt=[];function za(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?Yt.push(n):typeof n=="string"?Yt.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function me(e){let t=typeof e=="string"?e:"",n=[...Va,...Yt];for(let r of n)if(r instanceof RegExp&&r.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function Xa(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var Zn=new Map;function Ga(e=""){let t=Object.create(null),n=String(e||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function Ka(e,t,n){let r=String(e||""),i=r.toLowerCase(),o=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let a=n&&(n.FILL??n.fill),s="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?s="rounded":/\bsharp\b/.test(o)?s="sharp":/\boutlined\b/.test(o)&&(s="outlined");let c=a===1,l=null;if(c&&(s==="outlined"&&Te.materialIconsFilled?l={url:Te.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&Te.materialIconsRound?l={url:Te.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&Te.materialIconsSharp&&(l={url:Te.materialIconsSharp,alias:"snapdom-mi-sharp"})),!l)return{familyForMeasure:r,familyForCanvas:r};if(!Zn.has(l.alias))try{let d=new FontFace(l.alias,`url(${l.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),Zn.set(l.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${l.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function Ja(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function Za(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&t.toLowerCase()!=="currentcolor")return t;let r=e.color?.trim();return r&&r!=="inherit"?r:"#000"}async function Qa(e,{family:t="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:a=""}={}){let s=String(t||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,l=Ga(o),{familyForMeasure:u,familyForCanvas:d}=await Ka(s,a,l);await Ja(d.replace(/^["']+|["']+$/g,""),r);let f=document.createElement("span");f.textContent=e,f.style.position="absolute",f.style.visibility="hidden",f.style.left="-99999px",f.style.whiteSpace="nowrap",f.style.fontFamily=u,f.style.fontWeight=String(n||"normal"),f.style.fontSize=`${r}px`,f.style.lineHeight="1",f.style.margin="0",f.style.padding="0",f.style.fontFeatureSettings="'liga' 1",f.style.fontVariantLigatures="normal",f.style.color=i,document.body.appendChild(f);let m=f.getBoundingClientRect(),g=Math.max(1,Math.ceil(m.width)),h=Math.max(1,Math.ceil(m.height));document.body.removeChild(f);let p=document.createElement("canvas");p.width=g*c,p.height=h*c;let y=p.getContext("2d");y.scale(c,c),y.font=`${n?`${n} `:""}${r}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:p.toDataURL(),width:g,height:h}}async function el(e,t){if(!(e instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(r.length===0)return 0;let i=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],o=0;for(let a=0;a<r.length;a++){let s=r[a],c=i[a]||null;try{let l=getComputedStyle(c||s),u=l.fontFamily||"Material Icons";if(!Xa(u))continue;let d=(c||s).textContent.trim();if(!d)continue;let f=parseInt(l.fontSize,10)||24,m=l.fontWeight&&l.fontWeight!=="normal"?l.fontWeight:"normal",g=Za(l),h=l.fontVariationSettings&&l.fontVariationSettings!=="normal"?l.fontVariationSettings:"",p=(c||s).className||"",{dataUrl:y,width:x,height:b}=await Qa(d,{family:u,weight:m,fontSize:f,color:g,variation:h,className:p});s.textContent="";let w=s.ownerDocument.createElement("img");w.src=y,w.alt=d,w.style.height=`${f}px`,w.style.width=`${Math.max(1,Math.round(x/b*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(s).verticalAlign||"baseline",s.appendChild(w),o++}catch{}}return o}Pe();async function tl(e,t,n,r=32,i="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${r}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let s=a.getBoundingClientRect(),c=Math.ceil(s.width),l=Math.ceil(s.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,c*o),u.height=Math.max(1,l*o);let d=u.getContext("2d");return d.scale(o,o),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:c,height:l}}var Ar=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),nl=["katex","mathjax","mathml"];function tn(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Ar.has(n.toLowerCase()))return n}return""}function rl(e){if(!e)return[];let t=[];for(let n of e.split(",")){let r=n.trim().replace(/^['"]+|['"]+$/g,"");r&&(Ar.has(r.toLowerCase())||t.push(r))}return t}function at(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function lt(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function ol(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function il(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=at(n[1]),o=at(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=at(t);return{min:r,max:r}}function al(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function ll(e){let t=String(e||"100%").trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function sl(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function cl(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>i.endsWith(a))||n.some(a=>i===a.toLowerCase()||i.endsWith("."+a.toLowerCase())))return!0;let o=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(o)||/\.woff2?(\b|$)/.test(o)||nl.some(a=>o.includes(a)))return!0;for(let a of t){let s=a.toLowerCase().replace(/\s+/g,"+"),c=a.toLowerCase().replace(/\s+/g,"-"),l=sl(a);if(o.includes(s)||o.includes(c)||l&&o.includes(l))return!0}return!1}catch{return!1}}function ul(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function Qn(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return n;let a=o;try{a=new URL(o,t||location.href).href}catch{}return`url("${a}")`})}var Vt=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,ct=4;async function dl(e,t,n){if(!e)return e;let r=new Set;function i(s,c){try{return new URL(s,c||location.href).href}catch{return s}}async function o(s,c,l=0){if(l>ct)return console.warn(`[snapDOM] @import depth exceeded (${ct}) at ${c}`),s;let u="",d=0,f;for(;f=Vt.exec(s);){u+=s.slice(d,f.index),d=Vt.lastIndex;let m=(f[2]||f[4]||"").trim(),g=i(m,c);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let h="";try{let p=await ne(g,{as:"text",useProxy:n,silent:!0});p.ok&&typeof p.data=="string"&&(h=p.data)}catch{}h?(h=Qn(h,g),h=await o(h,g,l+1),u+=`
5
+ `}catch{}}catch{}return t}function Na(e,t,n){if(!t)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=t,e.insertBefore(r,e.firstChild||null)}function _a(e,t){try{let n=e.currentSrc||e.src||"";if(!n)return;t.setAttribute("src",n),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function Ra(e){let t=new Set;if(!e)return t;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(e);)t.add(r[1]);return t}function Pa(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let n=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(n)return n}catch{}return""}function Fa(e,t,n){let r=[];for(let i of t){let o=Pa(e,i);o&&r.push(`${i}: ${o};`)}return r.length?`${n}{${r.join("")}}
6
+ `:""}function Ia(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted","")))}async function Da(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function Oa(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let c=getComputedStyle(e);n=parseFloat(c.borderLeftWidth)||0,r=parseFloat(c.borderRightWidth)||0,i=parseFloat(c.borderTopWidth)||0,o=parseFloat(c.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(n+r))),s=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:s,rect:t}}function oe(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(t=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(t===0||n===0)try{if(t===0){let r=parseFloat(e.getAttribute("width"));!isNaN(r)&&r>0&&(t=r)}if(n===0){let r=parseFloat(e.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function Ha(e,t,n){let r=e.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Ba(e,t,n){let r=await Da(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=Oa(e),s=n?.snap;if(!s&&typeof window<"u"&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let c={...n,scale:1},l=Ha(r,i,o),u;try{u=await s.toPng(r.documentElement,c)}finally{l()}u.style.display="block",u.style.width=`${i}px`,u.style.height=`${o}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),Ee(e,d,t,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}function Wa(e){let{width:t,height:n}=oe(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,s=Math.round(t||r.width||0),c=Math.round(n||r.height||0),l=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,s||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,c||16),d=(e.type||"text").toLowerCase()==="checkbox",f=!!e.checked,m=!!e.indeterminate,g=Math.max(Math.min(l,u),12),h="middle";try{i&&i.verticalAlign&&(h=i.verticalAlign)}catch{}let p=document.createElement("div");p.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),p.style.cssText=`display:inline-block;width:${g}px;height:${g}px;vertical-align:${h};flex-shrink:0;line-height:0;`;let y=document.createElementNS("http://www.w3.org/2000/svg","svg");y.setAttribute("width",String(g)),y.setAttribute("height",String(g)),y.setAttribute("viewBox",`0 0 ${g} ${g}`),p.appendChild(y);function x(){let b="#0a6ed1";try{i&&(b=i.accentColor||i.color||b)}catch{}let w=2,S=w/2,C=g-w;if(y.innerHTML="",d){let v=document.createElementNS("http://www.w3.org/2000/svg","rect");if(v.setAttribute("x",String(S)),v.setAttribute("y",String(S)),v.setAttribute("width",String(C)),v.setAttribute("height",String(C)),v.setAttribute("rx","2"),v.setAttribute("ry","2"),v.setAttribute("fill",f?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(w)),y.appendChild(v),f){let k=document.createElementNS("http://www.w3.org/2000/svg","path");k.setAttribute("d",`M ${S+2} ${g/2} L ${g/2-1} ${g-S-2} L ${g-S-2} ${S+2}`),k.setAttribute("stroke","white"),k.setAttribute("stroke-width",String(Math.max(1.5,w))),k.setAttribute("fill","none"),k.setAttribute("stroke-linecap","round"),k.setAttribute("stroke-linejoin","round"),y.appendChild(k)}else if(m){let k=document.createElementNS("http://www.w3.org/2000/svg","rect"),N=Math.max(6,C-4);k.setAttribute("x",String((g-N)/2)),k.setAttribute("y",String((g-w)/2)),k.setAttribute("width",String(N)),k.setAttribute("height",String(w)),k.setAttribute("fill",b),k.setAttribute("rx","1"),y.appendChild(k)}}else{let v=document.createElementNS("http://www.w3.org/2000/svg","circle");if(v.setAttribute("cx",String(g/2)),v.setAttribute("cy",String(g/2)),v.setAttribute("r",String((g-w)/2)),v.setAttribute("fill",f?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(w)),y.appendChild(v),f){let k=document.createElementNS("http://www.w3.org/2000/svg","circle"),N=Math.max(2,(g-w*2)*.35);k.setAttribute("cx",String(g/2)),k.setAttribute("cy",String(g/2)),k.setAttribute("r",String(N)),k.setAttribute("fill","white"),y.appendChild(k)}}p.style.setProperty("width",`${g}px`,"important"),p.style.setProperty("height",`${g}px`,"important"),p.style.setProperty("min-width",`${g}px`,"important"),p.style.setProperty("min-height",`${g}px`,"important")}return x(),{el:p,applyVisual:x}}var He=new te(80);async function Ue(e){if(M.resource?.has(e))return M.resource.get(e);if(He.has(e))return He.get(e);let t=(async()=>{let n=await ne(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return M.resource?.set(e,n.data),n.data})();He.set(e,t);try{let n=await t;return He.set(e,n),n}catch(n){throw He.delete(e),n}}var Ua=/\bblob:[^)"'\s]+/g;async function Zn(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(Ua)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await Ue(r);n=n.split(r).join(i)}catch{}return n}function nt(e){return typeof e=="string"&&e.startsWith("blob:")}function qa(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let n=t.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function ja(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function Ya(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll("img"):[];for(let c of r)try{let l=c.getAttribute("src")||c.currentSrc||"";if(nt(l)){let d=await Ue(l);c.setAttribute("src",d)}let u=c.getAttribute("srcset");if(u&&u.includes("blob:")){let d=qa(u),f=!1;for(let m of d)if(nt(m.url))try{m.url=await Ue(m.url),f=!0}catch(g){F(n,"blobUrlToDataUrl for srcset item failed",g)}f&&c.setAttribute("srcset",ja(d))}}catch(l){F(n,"resolveBlobUrls for img failed",l)}let i=e.querySelectorAll?e.querySelectorAll("image"):[];for(let c of i)try{let l="http://www.w3.org/1999/xlink",u=c.getAttribute("href")||c.getAttributeNS?.(l,"href");if(nt(u)){let d=await Ue(u);c.setAttribute("href",d),c.removeAttributeNS?.(l,"href")}}catch(l){F(n,"resolveBlobUrls for SVG image href failed",l)}let o=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let c of o)try{let l=c.getAttribute("style");if(l&&l.includes("blob:")){let u=await Zn(l);c.setAttribute("style",u)}}catch(l){F(n,"replaceBlobUrls in inline style failed",l)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let c of a)try{let l=c.textContent||"";l.includes("blob:")&&(c.textContent=await Zn(l))}catch(l){F(n,"replaceBlobUrls in style tag failed",l)}let s=["poster"];for(let c of s){let l=e.querySelectorAll?e.querySelectorAll(`[${c}^='blob:']`):[];for(let u of l)try{let d=u.getAttribute(c);nt(d)&&u.setAttribute(c,await Ue(d))}catch(d){F(n,`resolveBlobUrls for ${c} failed`,d)}}}Ve();async function at(e,t,n){if(!e)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||pr.has(u))return null;if(u==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return F(t,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=oe(e),m=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${m}px;height:${g}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if(e.matches?.(u)){if(n.excludeMode==="hide"){let d=document.createElement("div"),{width:f,height:m}=oe(e),g=f||e.getBoundingClientRect().width||0,h=m||e.getBoundingClientRect().height||0;return d.style.cssText=`display:inline-block;width:${g}px;height:${h}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof n.filter=="function")try{if(!n.filter(e)){if(n.filterMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=oe(e),m=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${m}px;height:${g}px;visibility:hidden;`,u}else if(n.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(e.tagName==="IFRAME"){let u=!1;try{u=!!(e.contentDocument||e.contentWindow?.document)}catch(d){F(t,"iframe same-origin probe failed",d)}if(u)try{return await Ba(e,t,n)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(u||console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.",e),n.placeholders){let{width:d,height:f}=oe(e),m=document.createElement("div");return m.style.cssText=`width:${d}px;height:${f}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,Ee(e,m,t,n),m}else{let{width:d,height:f}=oe(e),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${d}px;height:${f}px;visibility:hidden;`,Ee(e,m,t,n),m}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),Ee(e,u,t,n);let d=document.createElement("div");return d.textContent=e.getAttribute("data-placeholder-text")||"",d.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(d),u}if(e.tagName==="CANVAS"){let u="";try{let g=e.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){let h=document.createElement("canvas");h.width=e.width,h.height=e.height;let p=h.getContext("2d");p&&(p.drawImage(e,0,0),u=h.toDataURL("image/png"))}}}catch(g){F(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){F(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:f,height:m}=oe(e);return f>0&&(d.style.width=`${f}px`),m>0&&(d.style.height=`${m}px`),t.nodeMap.set(d,e),Ee(e,d,t,n),d}if(e.tagName==="VIDEO"){let u="";try{let g=document.createElement("canvas");g.width=e.videoWidth||e.offsetWidth||320,g.height=e.videoHeight||e.offsetHeight||240;let h=g.getContext("2d");h&&(h.drawImage(e,0,0,g.width,g.height),u=g.toDataURL("image/png"),(!u||u==="data:,")&&(u=""))}catch(g){F(t,"Video frame capture failed, using poster fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch{}u?d.src=u:e.poster&&(d.src=e.poster),d.width=e.videoWidth||e.offsetWidth||0,d.height=e.videoHeight||e.offsetHeight||0;let{width:f,height:m}=oe(e);return f>0&&(d.style.width=`${f}px`),m>0&&(d.style.height=`${m}px`),d.style.objectFit="contain",t.nodeMap.set(d,e),Ee(e,d,t,n),d}let a;try{if(a=e.cloneNode(!1),a.attributes?.length)try{for(let u of a.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(u.value)&&a.setAttribute(u.name,u.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Ma(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){_a(e,a);try{let{width:u,height:d}=oe(e),f=Math.round(u||0),m=Math.round(d||0);f&&(a.dataset.snapdomWidth=String(f)),m&&(a.dataset.snapdomHeight=String(m))}catch(u){F(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),f=b=>{let w=u.match(new RegExp(`${b}\\s*:\\s*([^;]+)`,"i")),S=w?w[1].trim():d.getPropertyValue(b);return/%|auto/i.test(String(S||""))},m=parseInt(a.dataset.snapdomWidth||"0",10),g=parseInt(a.dataset.snapdomHeight||"0",10),h=f("width")||!m,p=f("height")||!g;h&&m&&(a.style.width=`${m}px`),p&&g&&(a.style.height=`${g}px`);let y=d.getPropertyValue("object-fit"),x=d.getPropertyValue("object-position");y&&y!=="fill"?(a.style.objectFit=y,x&&(a.style.objectPosition=x)):(m&&(a.style.minWidth=`${m}px`),g&&(a.style.minHeight=`${g}px`))}catch(u){F(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let s=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=oe(e),f=u||e.getBoundingClientRect().width||0,m=d||e.getBoundingClientRect().height||0;f&&(a.style.width=`${f}px`),m&&(a.style.height=`${m}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&ta()){let{el:d,applyVisual:f}=Wa(e);t.nodeMap.set(d,e),s=f,a=d}else a.value=e.value,a.setAttribute("value",e.value),e.checked!==void 0&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&!e.value&&e.placeholder)try{let u=window.getComputedStyle(e,"::placeholder"),d=u&&u.color;if(d&&d!=="rgba(0, 0, 0, 0)"){let f="snapdom-ph-"+(Math.random()*1e6|0);a.classList.add(f);let m=document.createElement("style");m.textContent=`.${f}::placeholder{color:${d}!important;opacity:${u.opacity||"1"}!important;}`,a.prepend(m)}}catch{}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=e.value),e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){e.disabled&&a.setAttribute("disabled",""),e.required&&a.setAttribute("required",""),e.readOnly&&a.setAttribute("readonly","");let u=e;u.min!==void 0&&u.min!==""&&a.setAttribute("min",u.min),u.max!==void 0&&u.max!==""&&a.setAttribute("max",u.max),u.pattern!==void 0&&u.pattern!==""&&a.setAttribute("pattern",u.pattern);let d=e.getAttribute("aria-invalid");d!==null&&a.setAttribute("aria-invalid",d)}if(Ee(e,a,t,n),s&&s(),e instanceof SVGElement){let u=["fill","stroke","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","opacity","fill-opacity","stroke-opacity","fill-rule","clip-rule","marker","marker-start","marker-mid","marker-end","visibility","display"];try{let d=window.getComputedStyle(e);for(let f of u){let m=d.getPropertyValue(f);m&&a.style.setProperty(f,m)}}catch{}}if(e.shadowRoot){let u=function(b,w){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return w(null);at(b,t,n).then(S=>{w(S||null)}).catch(()=>{w(null)})};try{let b=e.shadowRoot.querySelectorAll("slot");for(let w of b){let S=[];try{S=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{S=w.assignedNodes?.()||[]}for(let C of S)r.add(C)}}catch{}let d=La(t),f=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let m=Ta(e.shadowRoot),g=$a(m,f),h=Ra(m),p=Fa(e,h,f);Na(a,p+g,d);let y=document.createDocumentFragment(),x=await Ot(Array.from(e.shadowRoot.childNodes),u,n.fast);y.append(...x.filter(b=>!!b)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=function(h,p){at(h,t,n).then(y=>{y&&Ia(y),p(y||null)}).catch(()=>{p(null)})},d=e.assignedNodes?.({flatten:!0})||[],f=d.length>0?d:Array.from(e.childNodes),m=document.createDocumentFragment(),g=await Ot(Array.from(f),u,n.fast);return m.append(...g.filter(h=>!!h)),m}function c(u,d){if(r.has(u))return d(null);at(u,t,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let l=await Ot(Array.from(e.childNodes),c,n.fast);if(a.append(...l.filter(u=>!!u)),i!==null&&a instanceof HTMLSelectElement){a.value=i;for(let u of a.options)u.value===i?u.setAttribute("selected",""):u.removeAttribute("selected")}return o!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=o),a}ie();dt();re();var Va=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],Te=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),Yt=[];function za(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?Yt.push(n):typeof n=="string"?Yt.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function me(e){let t=typeof e=="string"?e:"",n=[...Va,...Yt];for(let r of n)if(r instanceof RegExp&&r.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function Xa(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var Qn=new Map;function Ga(e=""){let t=Object.create(null),n=String(e||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function Ka(e,t,n){let r=String(e||""),i=r.toLowerCase(),o=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let a=n&&(n.FILL??n.fill),s="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?s="rounded":/\bsharp\b/.test(o)?s="sharp":/\boutlined\b/.test(o)&&(s="outlined");let c=a===1,l=null;if(c&&(s==="outlined"&&Te.materialIconsFilled?l={url:Te.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&Te.materialIconsRound?l={url:Te.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&Te.materialIconsSharp&&(l={url:Te.materialIconsSharp,alias:"snapdom-mi-sharp"})),!l)return{familyForMeasure:r,familyForCanvas:r};if(!Qn.has(l.alias))try{let d=new FontFace(l.alias,`url(${l.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),Qn.set(l.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${l.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function Ja(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function Za(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&t.toLowerCase()!=="currentcolor")return t;let r=e.color?.trim();return r&&r!=="inherit"?r:"#000"}async function Qa(e,{family:t="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:a=""}={}){let s=String(t||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,l=Ga(o),{familyForMeasure:u,familyForCanvas:d}=await Ka(s,a,l);await Ja(d.replace(/^["']+|["']+$/g,""),r);let f=document.createElement("span");f.textContent=e,f.style.position="absolute",f.style.visibility="hidden",f.style.left="-99999px",f.style.whiteSpace="nowrap",f.style.fontFamily=u,f.style.fontWeight=String(n||"normal"),f.style.fontSize=`${r}px`,f.style.lineHeight="1",f.style.margin="0",f.style.padding="0",f.style.fontFeatureSettings="'liga' 1",f.style.fontVariantLigatures="normal",f.style.color=i,document.body.appendChild(f);let m=f.getBoundingClientRect(),g=Math.max(1,Math.ceil(m.width)),h=Math.max(1,Math.ceil(m.height));document.body.removeChild(f);let p=document.createElement("canvas");p.width=g*c,p.height=h*c;let y=p.getContext("2d");y.scale(c,c),y.font=`${n?`${n} `:""}${r}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:p.toDataURL(),width:g,height:h}}async function el(e,t){if(!(e instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(r.length===0)return 0;let i=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],o=0;for(let a=0;a<r.length;a++){let s=r[a],c=i[a]||null;try{let l=getComputedStyle(c||s),u=l.fontFamily||"Material Icons";if(!Xa(u))continue;let d=(c||s).textContent.trim();if(!d)continue;let f=parseInt(l.fontSize,10)||24,m=l.fontWeight&&l.fontWeight!=="normal"?l.fontWeight:"normal",g=Za(l),h=l.fontVariationSettings&&l.fontVariationSettings!=="normal"?l.fontVariationSettings:"",p=(c||s).className||"",{dataUrl:y,width:x,height:b}=await Qa(d,{family:u,weight:m,fontSize:f,color:g,variation:h,className:p});s.textContent="";let w=s.ownerDocument.createElement("img");w.src=y,w.alt=d,w.style.height=`${f}px`,w.style.width=`${Math.max(1,Math.round(x/b*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(s).verticalAlign||"baseline",s.appendChild(w),o++}catch{}}return o}Pe();async function tl(e,t,n,r=32,i="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${r}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let s=a.getBoundingClientRect(),c=Math.ceil(s.width),l=Math.ceil(s.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,c*o),u.height=Math.max(1,l*o);let d=u.getContext("2d");return d.scale(o,o),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:c,height:l}}var $r=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),nl=["katex","mathjax","mathml"];function tn(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!$r.has(n.toLowerCase()))return n}return""}function rl(e){if(!e)return[];let t=[];for(let n of e.split(",")){let r=n.trim().replace(/^['"]+|['"]+$/g,"");r&&($r.has(r.toLowerCase())||t.push(r))}return t}function lt(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function st(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function ol(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function il(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=lt(n[1]),o=lt(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=lt(t);return{min:r,max:r}}function al(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function ll(e){let t=String(e||"100%").trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function sl(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function cl(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>i.endsWith(a))||n.some(a=>i===a.toLowerCase()||i.endsWith("."+a.toLowerCase())))return!0;let o=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(o)||/\.woff2?(\b|$)/.test(o)||nl.some(a=>o.includes(a)))return!0;for(let a of t){let s=a.toLowerCase().replace(/\s+/g,"+"),c=a.toLowerCase().replace(/\s+/g,"-"),l=sl(a);if(o.includes(s)||o.includes(c)||l&&o.includes(l))return!0}return!1}catch{return!1}}function ul(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function er(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return n;let a=o;try{a=new URL(o,t||location.href).href}catch{}return`url("${a}")`})}var Vt=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,ut=4;async function dl(e,t,n){if(!e)return e;let r=new Set;function i(s,c){try{return new URL(s,c||location.href).href}catch{return s}}async function o(s,c,l=0){if(l>ut)return console.warn(`[snapDOM] @import depth exceeded (${ut}) at ${c}`),s;let u="",d=0,f;for(;f=Vt.exec(s);){u+=s.slice(d,f.index),d=Vt.lastIndex;let m=(f[2]||f[4]||"").trim(),g=i(m,c);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let h="";try{let p=await ne(g,{as:"text",useProxy:n,silent:!0});p.ok&&typeof p.data=="string"&&(h=p.data)}catch{}h?(h=er(h,g),h=await o(h,g,l+1),u+=`
7
7
  /* inlined: ${g} */
8
8
  ${h}
9
- `):u+=f[0]}return u+=s.slice(d),u}let a=Qn(e,t||location.href);return a=await o(a,t||location.href,0),a}var $r=/url\((["']?)([^"')]+)\1\)/g,fl=/@font-face[^{}]*\{[^}]*\}/g;function Lr(e){if(!e)return[];let t=[],n=e.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let i=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],a=i[2],s=c=>{if(!c.includes("?"))return parseInt(c,16);let l=parseInt(c.replace(/\?/g,"0"),16),u=parseInt(c.replace(/\?/g,"F"),16);return[l,u]};if(a){let c=s(o),l=s(a),u=Array.isArray(c)?c[0]:c,d=Array.isArray(l)?l[1]:l;t.push([Math.min(u,d),Math.max(u,d)])}else{let c=s(o);Array.isArray(c)?t.push([c[0],c[1]]):t.push([c,c])}}return t}function Tr(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[r,i]of t)if(n>=r&&n<=i)return!0;return!1}function nn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll($r)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,t||location.href).href}catch{}n.push(i)}}return n}async function Nr(e,t,n=""){let r=e;for(let i of e.matchAll($r)){let o=Zt(i[0]);if(!o)continue;let a=o;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!me(a)){if(M.resource?.has(a)){M.font?.add(a),r=r.replace(i[0],`url(${M.resource.get(a)})`);continue}if(!M.font?.has(a))try{let s=await ne(a,{as:"dataURL",useProxy:n,silent:!0});if(s.ok&&typeof s.data=="string"){let c=s.data;M.resource?.set(a,c),M.font?.add(a),r=r.replace(i[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function ml(e){if(!e.length)return null;let t=(a,s)=>e.some(([c,l])=>!(l<a||c>s)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),o=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function er(e={}){let t=new Set((e.families||[]).map(i=>String(i).toLowerCase())),n=new Set((e.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((e.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(t.size&&t.has(i.family.toLowerCase()))return!0;if(n.size)for(let a of i.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(r.size){let a=ml(o);if(a&&r.has(a))return!0}return!1}}function pl(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of e.match(t)||[]){let a=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",s=tn(a),c=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),l=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),d=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),f=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),m=nn(f,location.href),g=m.length?m.map(p=>String(p).toLowerCase()).sort().join("|"):f.toLowerCase(),h=[String(s||"").toLowerCase(),c,l,u,d.toLowerCase(),g].join("|");n.has(h)||(n.add(h),r.push(o))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||"")}function hl(e,t,n,r,i){let o=Array.from(e||[]).sort().join("|"),a=t?JSON.stringify({families:(t.families||[]).map(u=>String(u).toLowerCase()).sort(),domains:(t.domains||[]).map(u=>String(u).toLowerCase()).sort(),subsets:(t.subsets||[]).map(u=>String(u).toLowerCase()).sort()}):"",s=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),c=r||"",l=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${c}::fd=${l}`}async function Rr(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let o=(a,s)=>{try{return new URL(a,s||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let s=a.href?o(a.href,t):t;if(r.depth>=ct){console.warn(`[snapDOM] CSSOM import depth exceeded (${ct}) at ${s}`);continue}if(s&&r.visitedSheets.has(s)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${s}`);continue}s&&r.visitedSheets.add(s);let c={...r,depth:(r.depth||0)+1};await Rr(a.styleSheet,s,n,c);continue}if(a.type===CSSRule.FONT_FACE_RULE){let s=(a.style.getPropertyValue("font-family")||"").trim(),c=tn(s);if(!c||me(c))continue;let l=(a.style.getPropertyValue("font-weight")||"400").trim(),u=(a.style.getPropertyValue("font-style")||"normal").trim(),d=(a.style.getPropertyValue("font-stretch")||"100%").trim(),f=(a.style.getPropertyValue("src")||"").trim(),m=(a.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(c,u,l,d))continue;let g=Lr(m);if(!Tr(r.usedCodepoints,g))continue;let h={family:c,weightSpec:l,styleSpec:u,stretchSpec:d,unicodeRange:m,srcRaw:f,srcUrls:nn(f,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(h,g))continue;if(/url\(/i.test(f)){let p=await Nr(f,t||location.href,r.useProxy);await n(`@font-face{font-family:${c};src:${p};font-style:${u};font-weight:${l};font-stretch:${d};${m?`unicode-range:${m};`:""}}`)}else await n(`@font-face{font-family:${c};src:${f};font-style:${u};font-weight:${l};font-stretch:${d};${m?`unicode-range:${m};`:""}}`)}}}async function gl({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let a=new Map;for(let p of e){let[y,x,b,w]=String(p).split("__");if(!y)continue;let S=a.get(y)||[];S.push({w:parseInt(x,10),s:b,st:parseInt(w,10)}),a.set(y,S)}function s(p,y,x,b){if(!a.has(p))return!1;let w=a.get(p),S=il(x),C=al(y),v=ll(b),k=S.min!==S.max,N=S.min,B=L=>C.kind==="normal"&&L==="normal"||C.kind!=="normal"&&(L==="italic"||L==="oblique"),I=!1;for(let L of w){let $=k?L.w>=S.min&&L.w<=S.max:L.w===N,H=B(lt(L.s)),U=L.st>=v.min&&L.st<=v.max;if($&&H&&U){I=!0;break}}if(I)return!0;if(!k)for(let L of w){let $=B(lt(L.s)),H=L.st>=v.min&&L.st<=v.max;if(Math.abs(N-L.w)<=300&&$&&H)return!0}if(!k&&C.kind==="normal"&&w.some(L=>lt(L.s)!=="normal"))for(let L of w){let $=Math.abs(N-L.w)<=300,H=L.st>=v.min&&L.st<=v.max;if($&&H)return!0}return!1}let c=er(n),l=hl(e,n,r,i,o);if(M.resource?.has(l))return M.resource.get(l);let u=ul(e),d=[],f=Vt;for(let p of document.querySelectorAll("style")){let y=p.textContent||"";for(let x of y.matchAll(f)){let b=(x[2]||x[4]||"").trim();!b||me(b)||document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||d.push(b)}}d.length&&await Promise.all(d.map(p=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${p}"]`))return y(null);let x=document.createElement("link");x.rel="stylesheet",x.href=p,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>y(x),x.onerror=()=>y(null),document.head.appendChild(x)})));let m="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(p=>!!p.href);for(let p of g)try{if(me(p.href))continue;let y="",x=!1;try{x=new URL(p.href,location.href).origin===location.origin}catch{}if(!x){let w=Array.isArray(o)?o:[];if(!cl(p.href,u,w))continue}if(x){let w=Array.from(document.styleSheets).find(S=>S.href===p.href);if(w)try{let S=w.cssRules||[];y=Array.from(S).map(C=>C.cssText).join("")}catch{}}if(!y){let w=await ne(p.href,{as:"text",useProxy:i});if(w?.ok&&typeof w.data=="string"&&(y=w.data),me(p.href))continue}y=await dl(y,p.href,i);let b="";for(let w of y.match(fl)||[]){let S=(w.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=tn(S);if(!C||me(C))continue;let v=(w.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),k=(w.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),N=(w.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),B=(w.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),I=(w.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=nn(I,p.href);if(!s(C,k,v,N))continue;let $=Lr(B);if(!Tr(t,$))continue;let H={family:C,weightSpec:v,styleSpec:k,stretchSpec:N,unicodeRange:B,srcRaw:I,srcUrls:L,href:p.href};if(n&&c(H,$))continue;let U=/url\(/i.test(I)?await Nr(w,p.href,i):w;b+=U}b.trim()&&(m+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",p.href)}let h={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:s,simpleExcluder:n?er(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let p of document.styleSheets)if(!(p.href&&g.some(y=>y.href===p.href)))try{let y=p.href||location.origin+"/";y&&h.visitedSheets.add(y),await Rr(p,y,async x=>{m+=x},h)}catch{}try{for(let p of document.fonts||[]){if(!p||!p.family||p.status!=="loaded"||!p._snapdomSrc)continue;let y=String(p.family).replace(/^['"]+|['"]+$/g,"");if(me(y)||!a.has(y)||n?.families&&n.families.some(b=>String(b).toLowerCase()===y.toLowerCase()))continue;let x=p._snapdomSrc;if(!String(x).startsWith("data:")){if(M.resource?.has(p._snapdomSrc))x=M.resource.get(p._snapdomSrc),M.font?.add(p._snapdomSrc);else if(!M.font?.has(p._snapdomSrc))try{let b=await ne(p._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(b.ok&&typeof b.data=="string")x=b.data,M.resource?.set(p._snapdomSrc,x),M.font?.add(p._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",p._snapdomSrc);continue}}m+=`@font-face{font-family:'${y}';src:url(${x});font-style:${p.style||"normal"};font-weight:${p.weight||"normal"};}`}}catch{}for(let p of r){if(!p||typeof p!="object")continue;let y=String(p.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||me(y)||!a.has(y)||n?.families&&n.families.some(v=>String(v).toLowerCase()===y.toLowerCase()))continue;let x=p.weight!=null?String(p.weight):"normal",b=p.style!=null?String(p.style):"normal",w=p.stretchPct!=null?`${p.stretchPct}%`:"100%",S=String(p.src||""),C=S;if(!C.startsWith("data:")){if(M.resource?.has(S))C=M.resource.get(S),M.font?.add(S);else if(!M.font?.has(S))try{let v=await ne(S,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")C=v.data,M.resource?.set(S,C),M.font?.add(S);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",S);continue}}m+=`@font-face{font-family:'${y}';src:url(${C});font-style:${b};font-weight:${x};font-stretch:${w};}`}return m&&(m=pl(m),M.resource?.set(l,m)),m}function _r(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let s=rl(a.fontFamily);if(s.length)for(let c of s){let l=(u,d,f)=>`${c}__${at(u)}__${lt(d)}__${ol(f)}`;t.add(l(a.fontWeight,a.fontStyle,a.fontStretch))}};r(getComputedStyle(e));let i=getComputedStyle(e,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(e,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let a=n.currentNode,s=getComputedStyle(a);r(s);let c=getComputedStyle(a,"::before");c&&c.content&&c.content!=="none"&&r(c);let l=getComputedStyle(a,"::after");l&&l.content&&l.content!=="none"&&r(l)}return t}function yl(e){let t=new Set,n=i=>{if(i)for(let o of i)t.add(o.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let i=r.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let o=i;for(let a of["::before","::after"]){let s=getComputedStyle(o,a)?.getPropertyValue("content");if(!(!s||s==="none"))if(/^"/.test(s)||/^'/.test(s))n(s.slice(1,-1));else{let c=s.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let l of c)try{t.add(parseInt(l.slice(1),16))}catch{}}}}}return t}async function Pr(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let i=document.createElement("div");i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let o of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${o}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",i.appendChild(a)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}re();function wl(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function bl(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function tr(e,t=!1){let n="",r=Math.max(1,e);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return t?n.toUpperCase():n}function nr(e,t=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,e)),i="";for(let[o,a]of n)for(;r>=o;)i+=a,r-=o;return t?i:i.toLowerCase()}function rr(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(e);case"decimal-leading-zero":{let n=Math.abs(e);return(e<0?"-":"")+(n<10?"0":"")+String(n)}case"lower-alpha":return tr(e,!1);case"upper-alpha":return tr(e,!0);case"lower-roman":return nr(e,!1);case"upper-roman":return nr(e,!0);default:return String(e)}}function vl(e){let t=()=>M?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,o=f=>f&&f.tagName==="LI",a=f=>{let m=0,g=f?.parentElement;if(!g)return 0;for(let h of g.children){if(h===f)break;h.tagName==="LI"&&m++}return m},s=f=>{let m=new Map;for(let[g,h]of f)m.set(g,h.slice());return m},c=(f,m,g)=>{let h=s(f),p;try{p=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(p&&p!=="none")for(let b of p.split(",")){let w=b.trim().split(/\s+/),S=w[0],C=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!S)continue;let v=m.get(S);if(v&&v.length){let k=v.slice();k.push(C),h.set(S,k)}else h.set(S,[C])}let y;try{y=g.style?.counterSet||getComputedStyle(g).counterSet}catch{}if(y&&y!=="none")for(let b of y.split(",")){let w=b.trim().split(/\s+/),S=w[0],C=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!S)continue;let v=h.get(S)||[];v.length===0&&v.push(0),v[v.length-1]=C,h.set(S,v)}let x;try{x=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(x&&x!=="none")for(let b of x.split(",")){let w=b.trim().split(/\s+/),S=w[0],C=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!S)continue;let v=h.get(S)||[];v.length===0&&v.push(0),v[v.length-1]+=C,h.set(S,v)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let b=g.parentElement,w=1;if(b&&b.tagName==="OL"){let C=b.getAttribute("start"),v=Number.isFinite(Number(C))?Number(C):1,k=a(g),N=g.getAttribute("value");w=Number.isFinite(Number(N))?Number(N):v+k}else w=1+a(g);let S=h.get("list-item")||[];S.length===0&&S.push(0),S[S.length-1]=w,h.set("list-item",S)}}catch{}return h},l=(f,m,g)=>{let h=c(g,m,f);r.set(f,h);let p=h;for(let x of f.children)p=l(x,h,p);let y=new Map;for(let[x,b]of g){let w=b.length,S=p.get(x);y.set(x,S&&S.length?S.slice(0,w):b.slice())}for(let[x,b]of p)!y.has(x)&&b.length&&!m.has(x)&&y.set(x,b.slice(0,1));return y},u=new Map;l(i,u,u);function d(){let f=t();if(f!==n){n=f;let m=new Map;l(i,m,m)}}return{get(f,m){d();let g=r.get(f)?.get(m);return g&&g.length?g[g.length-1]:0},getStack(f,m){d();let g=r.get(f)?.get(m);return g?g.slice():[]}}}function xl(e,t,n){if(!e||e==="none")return e;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=e.replace(r,(o,a,s)=>{let c=String(s).split(",").map(l=>l.trim());if(a==="counter"){let l=c[0]?.replace(/^["']|["']$/g,""),u=(c[1]||"decimal").toLowerCase(),d=n.get(t,l);return rr(d,u)}else{let l=c[0]?.replace(/^["']|["']$/g,""),u=c[1]?.replace(/^["']|["']$/g,"")??"",d=(c[2]||"decimal").toLowerCase(),f=n.getStack(t,l);return f.length?f.map(m=>rr(m,d)).join(u):""}});return bl(i)}catch{return"- "}}Pe();re();var Ne=new WeakMap,or=1e3;function Sl(e,t){let n=Fr(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=ar(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):ar(e)}function zt(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Fr(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${t.length}|`,r=0;for(let o=0;o<t.length;o++){let a=t[o];if(a.tagName==="STYLE"){let s=a.textContent?a.textContent.length:0;n+=`S${s}|`;let c=a.sheet,l=c?zt(c):null;l&&(r+=l.length)}else{let s=a.getAttribute("href")||"",c=a.getAttribute("media")||"all";n+=`L${s}|m:${c}|`;let l=a.sheet,u=l?zt(l):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function ir(e,t,n){let r=zt(e);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],a=o&&o.cssText?o.cssText:"";n.budget--;for(let s of t)if(a.includes(s))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let s=0;s<o.cssRules.length&&n.budget>0;s++){let c=o.cssRules[s],l=c&&c.cssText?c.cssText:"";n.budget--;for(let u of t)if(l.includes(u))return!0}if(n.budget<=0)return!1}return!1}function ar(e=document){let t=Fr(e),n=Ne.get(e);if(n&&n.fingerprint===t)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=e.querySelectorAll("style");for(let a=0;a<i.length;a++){let s=i[a].textContent||"";for(let c of r)if(s.includes(c))return Ne.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:or};try{for(let s of o)if(ir(s,r,a))return Ne.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),s={budget:or};for(let c=0;c<a.length&&s.budget>0;c++){let l=a[c],u=null;if(l.tagName,u=l.sheet||null,u&&ir(u,r,s))return Ne.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Ne.set(e,{fingerprint:t,result:!0}),!0):(Ne.set(e,{fingerprint:t,result:!1}),!1)}var _e=new WeakMap,lr=-1;function El(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Cl(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):El(e)}function Xt(e,t){let n=e.parentElement,r=n?_e.get(n):null;return r?{get(i,o){let a=t.get(i,o),s=r.get(o);return typeof s=="number"?Math.max(a,s):a},getStack(i,o){let a=t.getStack(i,o);if(!a.length)return a;let s=r.get(o);if(typeof s=="number"){let c=a.slice();return c[c.length-1]=Math.max(c[c.length-1],s),c}return a}}:t}function Gt(e,t,n){let r=new Map;function i(c){let l=[];if(!c||c==="none")return l;for(let u of String(c).split(",")){let d=u.trim().split(/\s+/),f=d[0],m=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;f&&l.push({name:f,num:m})}return l}let o=i(t?.counterReset),a=i(t?.counterIncrement);function s(c){if(r.has(c))return r.get(c).slice();let l=n.getStack(e,c);l=l.length?l.slice():[];let u=o.find(f=>f.name===c);if(u){let f=Number.isFinite(u.num)?u.num:0;l=l.length?[...l,f]:[f]}let d=a.find(f=>f.name===c);if(d){let f=Number.isFinite(d.num)?d.num:1;l.length===0&&(l=[0]),l[l.length-1]+=f}return r.set(c,l.slice()),l}return{get(c,l){let u=s(l);return u.length?u[u.length-1]:0},getStack(c,l){return s(l)},__incs:a}}function Ml(e,t,n){let r;try{r=pe(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=Xt(e,n),a=Gt(e,r,o),s=wl(i)?xl(i,e,a):i;return{text:Cl(s),incs:a.__incs||[]}}async function Kt(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!Sl(i,n))return;let o=M?.session?.__counterEpoch??0;if(lr!==o&&(_e=new WeakMap,n&&(n.__counterCtx=null),lr=o),!n.__counterCtx)try{n.__counterCtx=vl(e.ownerDocument||document)}catch(c){F(n,"buildCounterContext failed",c)}let a=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let l=pe(e,c);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(c==="::first-letter"){let T=pe(e);if(!(l.color!==T.color||l.fontSize!==T.fontSize||l.fontWeight!==T.fontWeight||l.fontFamily!==T.fontFamily||l.fontStyle!==T.fontStyle||l.textTransform!==T.textTransform||l.float!==T.float||l.paddingTop!==T.paddingTop||l.paddingRight!==T.paddingRight||l.paddingBottom!==T.paddingBottom||l.paddingLeft!==T.paddingLeft||l.marginTop!==T.marginTop||l.marginRight!==T.marginRight||l.marginBottom!==T.marginBottom||l.marginLeft!==T.marginLeft))continue;let R=Array.from(t.childNodes).find(J=>J.nodeType===Node.TEXT_NODE&&J.textContent?.trim().length>0);if(!R)continue;let P=R.textContent,_=P.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],K=P.slice(_?.length||0);if(!_||/[\uD800-\uDFFF]/.test(_))continue;let W=document.createElement("span");W.textContent=_,W.dataset.snapdomPseudo="::first-letter";let q=qn(l),j=Wt(q,"span");n.styleMap.set(W,j);let V=document.createTextNode(K);t.replaceChild(V,R),t.insertBefore(W,V);continue}let u=l.content??"",d=u===""||u==="none"||u==="normal",{text:f,incs:m}=Ml(e,c,a),g=l.backgroundImage,h=l.backgroundColor,p=l.fontFamily,y=parseInt(l.fontSize)||32,x=parseInt(l.fontWeight)||!1,b=l.color||"#000",w=l.borderStyle,S=parseFloat(l.borderWidth),C=l.transform,v=me(p),k=!d&&f!=="",N=g&&g!=="none",B=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",I=w&&w!=="none"&&S>0,L=C&&C!=="none";if(!(k||N||B||I||L)){if(m&&m.length&&e.parentElement){let T=_e.get(e.parentElement)||new Map;for(let{name:R}of m){if(!R)continue;let P=Xt(e,a),_=Gt(e,pe(e,c),P).get(e,R);T.set(R,_)}_e.set(e.parentElement,T)}continue}let $=document.createElement("span");$.dataset.snapdomPseudo=c,$.style.pointerEvents="none";let H=qn(l),U=Wt(H,"span");if(n.styleMap.set($,U),v&&f&&f.length===1){let{dataUrl:T,width:R,height:P}=await tl(f,p,x,y,b),_=document.createElement("img");_.src=T,_.style=`height:${y}px;width:${R/P*y}px;object-fit:contain;`,$.appendChild(_),t.dataset.snapdomHasIcon="true"}else if(f&&f.startsWith("url(")){let T=Zt(f);if(T?.trim())try{let R=await ne(st(T),{as:"dataURL",useProxy:r.useProxy});if(R?.ok&&typeof R.data=="string"){let P=document.createElement("img");P.src=R.data,P.style=`width:${y}px;height:auto;object-fit:contain;`,$.appendChild(P)}}catch(R){console.error(`[snapdom] Error in pseudo ${c} for`,e,R)}}else!v&&k&&($.textContent=f);$.style.backgroundImage="none","maskImage"in $.style&&($.style.maskImage="none"),"webkitMaskImage"in $.style&&($.style.webkitMaskImage="none");try{$.style.backgroundRepeat=l.backgroundRepeat,$.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?($.style.backgroundPositionX=l.backgroundPositionX,$.style.backgroundPositionY=l.backgroundPositionY):$.style.backgroundPosition=l.backgroundPosition,$.style.backgroundOrigin=l.backgroundOrigin,$.style.backgroundClip=l.backgroundClip,$.style.backgroundAttachment=l.backgroundAttachment,$.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(N)try{let T=Ut(g),R=await Promise.all(T.map(fr));$.style.backgroundImage=R.join(", ")}catch(T){console.warn(`[snapdom] Failed to inline background-image for ${c}`,T)}B&&($.style.backgroundColor=h);let G=$.childNodes.length>0||$.textContent?.trim()!==""||N||B||I||L;if(m&&m.length&&e.parentElement){let T=_e.get(e.parentElement)||new Map,R=Xt(e,a),P=Gt(e,pe(e,c),R);for(let{name:_}of m){if(!_)continue;let K=P.get(e,_);T.set(_,K)}_e.set(e.parentElement,T)}if(!G)continue;c==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore($,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild($))}catch(l){console.warn(`[snapdom] Failed to capture ${c} for`,e,l)}let s=Array.from(t.children).filter(c=>!c.dataset.snapdomPseudo);if(n.nodeMap)for(let c of s){let l=n.nodeMap.get(c);l instanceof Element&&await Kt(l,c,n,r)}else{let c=Array.from(e.children);for(let l=0;l<Math.min(c.length,s.length);l++)await Kt(c[l],s[l],n,r)}}function kl(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],s=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c="http://www.w3.org/1999/xlink",l=w=>{if(!w||!w.getAttribute)return null;let S=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(c,"href"):null);if(S)return S;let C=w.attributes;if(!C)return null;for(let v=0;v<C.length;v++){let k=C[v];if(!k||!k.name)continue;if(k.name==="href")return k.value;let N=k.name.indexOf(":");if(N!==-1&&k.name.slice(N+1)==="href")return k.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(w=>w.id)),d=new Set,f=!1,m=(w,S=null)=>{if(!w)return;o.lastIndex=0;let C;for(;C=o.exec(w);){f=!0;let v=(C[1]||"").trim();v&&(u.has(v)||(d.add(v),S&&!S.has(v)&&S.add(v)))}},g=w=>{let S=w.querySelectorAll("use");for(let v of S){let k=l(v);if(!k||!k.startsWith("#"))continue;f=!0;let N=k.slice(1).trim();N&&!u.has(N)&&d.add(N)}let C=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of C){m(v.getAttribute("style")||"");for(let k of a)m(v.getAttribute(k))}};for(let w of i)g(w);if(!f)return;let h=e.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(h,e.firstChild||null));let p=h.querySelector("defs")||null,y=w=>{if(!w||u.has(w))return null;let S=s(w),C=v=>{let k=r.querySelector(v);return k&&!e.contains(k)?k:null};return C(`svg defs > *#${S}`)||C(`svg > symbol#${S}`)||C(`*#${S}`)};if(!d.size)return;let x=new Set(d),b=new Set;for(;x.size;){let w=x.values().next().value;if(x.delete(w),!w||u.has(w)||b.has(w))continue;let S=y(w);if(!S){b.add(w);continue}p||(p=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(p));let C=S.cloneNode(!0);C.id||C.setAttribute("id",w),p.appendChild(C),b.add(w),u.add(w);let v=[C,...C.querySelectorAll("*")];for(let k of v){let N=l(k);if(N&&N.startsWith("#")){let I=N.slice(1).trim();I&&!u.has(I)&&!b.has(I)&&x.add(I)}let B=k.getAttribute?.("style")||"";B&&m(B,x);for(let I of a){let L=k.getAttribute?.(I);L&&m(L,x)}}}}re();function Al(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;getComputedStyle(t).position==="static"&&(t.style.position="relative");let r=e.getBoundingClientRect(),i=e.clientHeight,o="data-snap-ph",a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let s=a.currentNode,c=getComputedStyle(s),l=c.position;if(l!=="sticky"&&l!=="-webkit-sticky")continue;let u=sr(c.top),d=sr(c.bottom);if(u==null&&d==null)continue;let f=$l(s,e),m=Ll(t,f,o);if(!m)continue;let g=s.getBoundingClientRect(),h=g.width,p=g.height,y=g.left-r.left;if(!(h>0&&p>0)||!Number.isFinite(y))continue;let x=u!=null?u+n:n+(i-p-d);if(!Number.isFinite(x))continue;let b=Number.parseInt(c.zIndex,10),w=Number.isFinite(b),S=w?Math.max(b,1)+1:2,C=w?b-1:0,v=m.cloneNode(!1);v.setAttribute(o,"1"),v.style.position="sticky",v.style.left=`${y}px`,v.style.top=`${x}px`,v.style.width=`${h}px`,v.style.height=`${p}px`,v.style.visibility="hidden",v.style.zIndex=String(C),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",m.parentElement?.insertBefore(v,m),m.style.position="absolute",m.style.left=`${y}px`,m.style.top=`${x}px`,m.style.bottom="auto",m.style.zIndex=String(S),m.style.pointerEvents="none"}}function sr(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function $l(e,t){let n=[];for(let r=e;r&&r!==t;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function Ll(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=Tl(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function Tl(e,t){let n=[],r=e.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(t)||n.push(o)}return n}function Nl(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=n!=="none"&&parseFloat(r)>0,s=i==="none"||parseFloat(o)===0;a&&s&&(e.style.border=`${r} solid transparent`)}function Rl(e){let t=[];try{let n=e.querySelectorAll("*");for(let r of n){if(!(r instanceof HTMLElement))continue;let i=r.style.contentVisibility||"",o=getComputedStyle(r),a=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(a==="auto"||a==="hidden")&&(t.push({el:r,original:i}),r.style.contentVisibility="visible")}if(e instanceof HTMLElement){let r=getComputedStyle(e),i=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(t.push({el:e,original:e.style.contentVisibility||""}),e.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:n,original:r}of t)try{n.style.contentVisibility=r}catch{}}}async function _l(e,t={}){let n={styleMap:M.session.styleMap,styleCache:M.session.styleCache,nodeMap:M.session.nodeMap,options:t},r,i="",o="";Nl(e);let a=Rl(e);try{kl(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await it(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}finally{a()}try{await Kt(e,r,n,t)}catch(l){console.warn("inlinePseudoElements failed:",l)}await Ya(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let u of l)o+=u.textContent||"",u.remove()}catch(l){F(n,"Failed to extract shadow CSS from style[data-sd]",l)}let s=Ji(n.styleMap);i=Array.from(s.entries()).map(([l,u])=>`.${u}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,u]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",u.replace(/;/g,"; "));continue}let d=s.get(u);d&&l.classList.add(d);let f=l.style?.backgroundImage,m=l.dataset?.snapdomHasIcon;f&&f!=="none"&&(l.style.backgroundImage=f),m&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,u]of n.nodeMap.entries()){let d=u.scrollLeft,f=u.scrollTop;if((d||f)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";try{let g=l.querySelectorAll("*");for(let h of g){if(!(h instanceof HTMLElement))continue;let p=h.style.position;if(p==="fixed"||p==="absolute"){let y=parseFloat(h.style.top)||0,x=parseFloat(h.style.left)||0;h.style.top=`${y+f}px`,h.style.left=`${x+d}px`,p==="fixed"&&(h.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.transform=`translate(${-d}px, ${-f}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m)}}let c=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Al(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||pe(e);n.styleCache.set(e,l);let u=Oi(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=u||""}for(let[l,u]of n.nodeMap.entries())u.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}Pe();var Dr="http://www.w3.org/1999/xlink";function Pl(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Dr,"href"):null)}function Fl(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,n=parseInt(e.dataset?.snapdomHeight||"",10)||0,r=parseInt(e.getAttribute("width")||"",10)||0,i=parseInt(e.getAttribute("height")||"",10)||0,o=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,s=t||o||r||e.width||e.naturalWidth||100,c=n||a||i||e.height||e.naturalHeight||100;return{width:s,height:c}}async function Dl(e,t={}){let n=Array.from(e.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let f=a.currentSrc||a.src||"";f&&a.setAttribute("src",f)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let s=a.src||"";if(!s)return;let c=await ne(s,{as:"dataURL",useProxy:t.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){a.src=c.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:l,height:u}=Fl(a),{fallbackURL:d}=t||{};if(d)try{let f=typeof d=="function"?await d({width:l,height:u,src:s,element:a}):d;if(f){let m=await ne(f,{as:"dataURL",useProxy:t.useProxy});if(m?.ok&&typeof m.data=="string"){a.src=m.data,a.width||(a.width=l),a.height||(a.height=u);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${l}px`,`height:${u}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${u}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",a.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${l}px;height:${u}px;visibility:hidden;`,a.replaceWith(f)}};for(let a=0;a<n.length;a+=4){let s=n.slice(a,a+4).map(r);await Promise.allSettled(s)}let i=Array.from(e.querySelectorAll("image")),o=async a=>{let s=Pl(a);if(!s||s.startsWith("data:")||s.startsWith("blob:"))return;let c=await ne(s,{as:"dataURL",useProxy:t.useProxy});c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")&&(a.setAttribute("href",c.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Dr,"href"))};for(let a=0;a<i.length;a+=4){let s=i.slice(a,a+4).map(o);await Promise.allSettled(s)}}ie();async function Il(e,t,n,r={}){let i=[[e,t]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],s=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[l,u]=i.shift();if(!u)continue;let d=n.get(l)||pe(l);n.has(l)||n.set(l,d);let f=(()=>{let h=d.getPropertyValue("border-image"),p=d.getPropertyValue("border-image-source");return h&&h!=="none"||p&&p!=="none"})();for(let h of s){let p=d.getPropertyValue(h);p&&u.style.setProperty(h,p)}for(let h of o){let p=d.getPropertyValue(h);if(h==="background-image"&&(!p||p==="none")){let b=d.getPropertyValue("background");b&&/url\s*\(/.test(b)&&(p=Ut(b).filter(w=>/url\s*\(/.test(w)).join(", ")||p)}if(!p||p==="none")continue;let y=Ut(p),x=await Promise.all(y.map(b=>fr(b,r)));x.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&u.style.setProperty(h,x.join(", "))}for(let h of a){let p=d.getPropertyValue(h);!p||p==="initial"||u.style.setProperty(h,p)}if(f)for(let h of c){let p=d.getPropertyValue(h);!p||p==="initial"||u.style.setProperty(h,p)}let m=l.shadowRoot?Array.from(l.shadowRoot.children).filter(h=>h.tagName!=="STYLE"):Array.from(l.children),g=Array.from(u.children).filter(h=>!(h.dataset?.snapdomPseudo||h.tagName==="STYLE"&&h.dataset?.sd));for(let h=0;h<Math.min(m.length,g.length);h++)i.push([m[h],g[h]])}}ie();re();function Hl(e){if(!e)return()=>{};let t=[];function n(r){let i=Ol(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function Ol(e){if(!e)return()=>{};let t=Bl(e);if(t<=0)return()=>{};if(!ql(e))return()=>{};let n=getComputedStyle(e),r=Math.round(Wl(n)*t+Ul(n)),i=e.textContent??"",o=i;if(e.scrollHeight<=r+.5)return()=>{};let a=0,s=i.length,c=-1;for(;a<=s;){let l=a+s>>1;e.textContent=i.slice(0,l)+"\u2026",e.scrollHeight<=r+.5?(c=l,a=l+1):s=l-1}return e.textContent=(c>=0?i.slice(0,c):"")+"\u2026",()=>{e.textContent=o}}function Bl(e){let t=getComputedStyle(e),n=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function Wl(e){let t=(e.lineHeight||"").trim(),n=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(n*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith("%")?Math.round(parseFloat(t)/100*n):Math.round(n*1.2)}function Ul(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ql(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var je=[];function Ir(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return typeof t=="function"?t(n):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:n}=e;return typeof t=="function"?t(n):t}return typeof e=="function"?e():e}function jl(...e){let t=e.flat();for(let n of t){let r=Ir(n);r&&(je.some(i=>i&&i.name&&r.name&&i.name===r.name)||je.push(r))}}function Hr(e){return(e&&Array.isArray(e.plugins)?e.plugins:je)||je}async function we(e,t,n){let r=n,i=Hr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let s=await a(t,r);typeof s<"u"&&(r=s)}return r}async function Yl(e,t,n){let r=[],i=Hr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let s=await a(t,n);typeof s<"u"&&r.push(s)}return r}function Vl(e){let t=[];if(Array.isArray(e))for(let n of e){let r=Ir(n);if(!r||!r.name)continue;let i=t.findIndex(o=>o&&o.name===r.name);i>=0&&t.splice(i,1),t.push(r)}for(let n of je)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function zl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=Vl(t)),e}ie();function Xl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){F(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){F(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){F(n,"stripRootShadows outline",o)}let i=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=i.length?i:"none"}catch(o){F(n,"stripRootShadows filter",o)}}function Gl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let r of n)r.remove()}function Kl(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set(["xml","xlink"]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let a of Array.from(o.attributes)){let s=a.name;if(s.includes("@")){o.removeAttribute(s);continue}if(s.includes(":")){let c=s.split(":",1)[0];if(!r.has(c)){o.removeAttribute(s);continue}}if(n&&(s.startsWith("x-")||s.startsWith("v-")||s.startsWith(":")||s.startsWith("on:")||s.startsWith("bind:")||s.startsWith("let:")||s.startsWith("class:"))){o.removeAttribute(s);continue}}}}function Jl(e,t={}){e&&(Kl(e,t),Gl(e))}function Zl(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function Ql(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function es(e,t){if(!(e instanceof Element)||Zl(e)||Ql(e))return!1;let n=t.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=t.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||t.transform&&t.transform!=="none")}function ts(e,t,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let a=i.childElementCount>o.childElementCount,s=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,s),a&&es(i,s)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let u=s.overflowY||s.overflowBlock||"visible",d=s.overflowX||s.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(o.style.overflow="visible")}let c=Array.from(i.children),l=Array.from(o.children);for(let u=0;u<Math.min(c.length,l.length);u++)r(c[u],l[u])}r(e,t)}function ns(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function rs(e,t){if(!(e instanceof Element))return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return t.excludeMode==="remove"}catch(r){F(t,"exclude selector match failed",r)}return!1}function os(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,s=Array.from(e.children);for(let m of s){if(rs(m,t)||!ns(m))continue;let g=m.getBoundingClientRect(),h=g.top-r.top,p=g.bottom-r.top;p<=h||(h<i&&(i=h),p>o&&(o=p),a=!0)}let c=a?Math.max(0,o-i):0,l=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return l+u+d+f+c}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,is=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Jt(e,t=new Set){let n="";if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Jt(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=Jt(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(is.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function as(e){if(!e||!e.styleSheets)return"";let t=new Set,n="";for(let r of Array.from(e.styleSheets))try{let i=r.cssRules;i&&(n+=Jt(i,t))}catch{}return n}function ls(e){let t=e.boxShadow||"";if(!t||t==="none")return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(s=>s.trim()),r=0,i=0,o=0,a=0;for(let s of n){let c=s.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(c.length<2)continue;let[l,u,d=0,f=0]=c,m=Math.abs(l)+d+f,g=Math.abs(u)+d+f;i=Math.max(i,m+Math.max(l,0)),a=Math.max(a,m+Math.max(-l,0)),o=Math.max(o,g+Math.max(u,0)),r=Math.max(r,g+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(o),left:Math.ceil(a)}}function ss(e){let t=(e.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=t?Math.ceil(parseFloat(t[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function cs(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0),n=parseFloat(e.outlineOffset||"0")||0,r=t+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function us(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||t==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,a=0,s=!1;for(let c of n){s=!0;let l=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(h=>parseFloat(h))||[],[u=0,d=0,f=0]=l,m=Math.abs(u)+f,g=Math.abs(d)+f;i=Math.max(i,m+Math.max(u,0)),a=Math.max(a,m+Math.max(-u,0)),o=Math.max(o,g+Math.max(d,0)),r=Math.max(r,g+Math.max(-d,0))}return{bleed:{top:A(r),right:A(i),bottom:A(o),left:A(a)},has:s}}function ds(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let s=Or(e);if(s.a===1&&s.b===0&&s.c===0&&s.d===1)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}function i(s,c,l,u){let d=Math.sqrt(s*s+c*c)||0,f=0,m=0;if(d>0){let g=s/d,h=c/d;f=g*l+h*u;let p=l-g*f,y=u-h*f;m=Math.sqrt(p*p+y*y)||0,m>0?f=f/m:f=0}return{a:d,b:0,c:f*m,d:m}}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let s=o[1].split(",").map(c=>parseFloat(c.trim()));if(s.length===6&&s.every(Number.isFinite)){let[c,l,u,d]=s,f=i(c,l,u,d);try{t.style.transform=`matrix(${f.a}, ${f.b}, ${f.c}, ${f.d}, 0, 0)`}catch{}return f}}let a=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(a){let s=a[1].split(",").map(c=>parseFloat(c.trim()));if(s.length===16&&s.every(Number.isFinite)){let c=s[0],l=s[1],u=s[4],d=s[5],f=i(c,l,u,d);try{t.style.transform=`matrix(${f.a}, ${f.b}, ${f.c}, ${f.d}, 0, 0)`}catch{}return f}}try{let s=new DOMMatrix(r),c=i(s.a,s.b,s.c,s.d);try{t.style.transform=`matrix(${c.a}, ${c.b}, ${c.c}, ${c.d}, 0, 0)`}catch{}return c}catch{return null}}function cr(e,t,n,r,i){let o=n.a,a=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(y,x){let b=y-r,w=x-i,S=o*b+s*w,C=a*b+c*w;return S+=r+l,C+=i+u,[S,C]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],m=1/0,g=1/0,h=-1/0,p=-1/0;for(let[y,x]of f)y<m&&(m=y),x<g&&(g=x),y>h&&(h=y),x>p&&(p=x);return{minX:m,minY:g,maxX:h,maxY:p,width:h-m,height:p-g}}function fs(e,t,n){let r=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],a=(s,c)=>{let l=s.toLowerCase();return l==="left"||l==="top"?0:l==="center"?c/2:l==="right"||l==="bottom"?c:l.endsWith("px")?parseFloat(l)||0:l.endsWith("%")?(parseFloat(l)||0)*c/100:/^-?\d+(\.\d+)?$/.test(l)&&parseFloat(l)||0};return{ox:a(i,t),oy:a(o,n)}}function ms(e){let t={rotate:"0deg",scale:null,translate:null},n=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(n){let i=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},o=i("rotate");if(o)if(o.angle){let c=o.angle;t.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.unit}else o.unit?t.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:t.rotate=String(o);else{let c=getComputedStyle(e);t.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let a=i("scale");if(a){let c="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,l="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:c;t.scale=`${c} ${l}`}else{let c=getComputedStyle(e);t.scale=c.scale&&c.scale!=="none"?c.scale:null}let s=i("translate");if(s){let c="x"in s&&"value"in s.x?s.x.value:Array.isArray(s)?s[0]?.value:0,l="y"in s&&"value"in s.y?s.y.value:Array.isArray(s)?s[1]?.value:0,u="x"in s&&s.x?.unit?s.x.unit:"px",d="y"in s&&s.y?.unit?s.y.unit:"px";t.translate=`${c}${u} ${l}${d}`}else{let c=getComputedStyle(e);t.translate=c.translate&&c.translate!=="none"?c.translate:null}return t}let r=getComputedStyle(e);return t.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",t.scale=r.scale&&r.scale!=="none"?r.scale:null,t.translate=r.translate&&r.translate!=="none"?r.translate:null,t}var Ot=null;function ps(){if(Ot)return Ot;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),Ot=e,e}function hs(e){let t=ps(),n=document.createElement("div");n.style.transformOrigin="0 0",e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let r=Or(n);return t.removeChild(n),r}function gs(e){let t=getComputedStyle(e),n=t.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let r=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",i=t.scale&&t.scale!=="none"&&t.scale!=="1",o=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(r||i||o)}function Or(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}async function Br(e,t){if(!e)throw new Error("Element cannot be null or undefined");Hi(t.cache);let n=t.fast,r=t.outerTransforms!==!1,i=!!t.outerShadows,o={element:e,options:t,plugins:t.plugins},a,s,c,l="",u="",d,f,m=null;await we("beforeSnap",o),await we("beforeClone",o);let g=Hl(o.element);try{({clone:a,classCSS:s,styleCache:c}=await _l(o.element,o.options)),!r&&a&&(m=ds(o.element,a)),!i&&a&&Xl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:s,styleCache:c,...o},await we("afterClone",o),Jl(o.clone),o.options?.excludeMode==="remove")try{ts(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await el(o.clone,o.element)}catch{}await new Promise(b=>{Re(async()=>{await Dl(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{Re(async()=>{await Il(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),t.embedFonts&&await new Promise(b=>{Re(async()=>{let w=_r(o.element),S=yl(o.element);if(Ce()){let C=new Set(Array.from(w).map(v=>String(v).split("__")[0]).filter(Boolean));await Pr(C,1)}l=await gl({required:w,usedCodepoints:S,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),b()},{fast:n})});let h=Gi(o.clone).sort(),p=h.join(",");M.baseStyle.has(p)?u=M.baseStyle.get(p):await new Promise(b=>{Re(()=>{u=Ki(h),M.baseStyle.set(p,u),b()},{fast:n})});let y=as(o.element?.ownerDocument||document);o={fontsCSS:l,baseCSS:u,scrollbarCSS:y,...o},await we("beforeRender",o),await new Promise(b=>{Re(()=>{let w=pe(o.element),S=o.element.getBoundingClientRect(),C=Math.max(1,A(o.element.offsetWidth||parseFloat(w.width)||S.width||1)),v=Math.max(1,A(o.element.offsetHeight||parseFloat(w.height)||S.height||1)),k=o.element.ownerDocument||document;if(o.element===k.body||o.element===k.documentElement){let Y=Math.max(o.element.scrollHeight||0,k.documentElement?.scrollHeight||0,k.body?.scrollHeight||0),z=Math.max(o.element.scrollWidth||0,k.documentElement?.scrollWidth||0,k.body?.scrollWidth||0);Y>0&&(v=Math.max(v,A(Y))),z>0&&(C=Math.max(C,A(z)));try{let se=(o.scrollbarCSS||"").length+(o.baseCSS||"").length+(o.fontsCSS||"").length+(o.classCSS||"").length,ce=M.measureHints.get(o.element);if(ce&&ce.cssLen===se&&ce.w0===C)ce.csh>0&&(v=Math.max(v,A(ce.csh))),ce.csw>0&&(C=Math.max(C,A(ce.csw)));else{let ue=k.createElement("div");ue.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+C+"px!important;overflow:visible!important;visibility:hidden!important;";let Qe=k.createElement("style");Qe.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,ue.appendChild(Qe),ue.appendChild(o.clone.cloneNode(!0)),k.body.appendChild(ue);let ye=ue.scrollHeight,At=ue.scrollWidth;k.body.removeChild(ue),M.measureHints.set(o.element,{cssLen:se,w0:C,csh:ye,csw:At}),ye>0&&(v=Math.max(v,A(ye))),At>0&&(C=Math.max(C,A(At)))}}catch{}}if(o.options?.excludeMode==="remove"){let Y=os(o.element,o.options);Number.isFinite(Y)&&Y>0&&(v=Math.max(1,Math.min(v,A(Y+1))))}let N=(Y,z=NaN)=>{let se=typeof Y=="string"?parseFloat(Y):Y;return Number.isFinite(se)?se:z},B=N(o.options.width),I=N(o.options.height),L=C,$=v,H=Number.isFinite(B),U=Number.isFinite(I),G=v>0?C/v:1;H&&U?(L=Math.max(1,A(B)),$=Math.max(1,A(I))):H?(L=Math.max(1,A(B)),$=Math.max(1,A(L/(G||1)))):U?($=Math.max(1,A(I)),L=Math.max(1,A($*(G||1)))):(L=C,$=v);let T=0,R=0,P=C,_=v;if(!r&&m&&Number.isFinite(m.a)){let Y={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},z=cr(C,v,Y,0,0);T=A(z.minX),R=A(z.minY),P=A(z.maxX),_=A(z.maxY)}else if(r&&ur(o.element)){let Y=w.transform&&w.transform!=="none"?w.transform:"",z=ms(o.element),se=hs({baseTransform:Y,rotate:z.rotate||"0deg",scale:z.scale,translate:z.translate}),{ox:ce,oy:ue}=fs(w,C,v),Qe=se.is2D?se:new DOMMatrix(se.toString()),ye=cr(C,v,Qe,ce,ue);T=A(ye.minX),R=A(ye.minY),P=A(ye.maxX),_=A(ye.maxY)}let K=ls(w),W=ss(w),q=cs(w),j=us(w),V=i?{top:A(K.top+W.top+q.top+j.bleed.top),right:A(K.right+W.right+q.right+j.bleed.right),bottom:A(K.bottom+W.bottom+q.bottom+j.bleed.bottom),left:A(K.left+W.left+q.left+j.bleed.left)}:{top:0,right:0,bottom:0,left:0};T=A(T-V.left),R=A(R-V.top),P=A(P+V.right),_=A(_+V.bottom);let J=Math.max(1,A(P-T)),Z=Math.max(1,A(_-R)),le=H||U?A(L/C):1,Je=U||H?A($/v):1,ti=Math.max(1,A(J*le)),ni=Math.max(1,A(Z*Je)),yn="http://www.w3.org/2000/svg",ri=Ce()&&ur(o.element)?1:0,he=A(ri+(r?0:1)),ge=document.createElementNS(yn,"foreignObject"),oi=A(T),ii=A(R);ge.setAttribute("x",String(A(-(oi-he)))),ge.setAttribute("y",String(A(-(ii-he)))),ge.setAttribute("width",String(A(C+he*2))),ge.setAttribute("height",String(A(v+he*2))),ge.style.overflow="visible";let wn=document.createElement("style"),ai='svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject *{min-width:0;} foreignObject pre,foreignObject [style*="white-space"]{white-space:inherit;}';wn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+ai+o.classCSS,ge.appendChild(wn);let Ze=document.createElement("div");Ze.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ze.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${A(C)}px;height:${A(v)}px`,Ze.appendChild(o.clone),ge.appendChild(Ze);let li=new XMLSerializer().serializeToString(ge),Mt=A(J+he*2),kt=A(Z+he*2),bn=H||U;t.meta={w0:C,h0:v,vbW:Mt,vbH:kt,targetW:L,targetH:$};let si=Ce()&&bn?Mt:A(ti+he*2),ci=Ce()&&bn?kt:A(ni+he*2),ui=parseFloat(pe(k.documentElement)?.fontSize)||16;f=`<svg xmlns="${yn}" width="${si}" height="${ci}" viewBox="0 0 ${Mt} ${kt}" font-size="${ui}px">`+li+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,o={svgString:f,dataURL:d,...o},b()},{fast:n})}),await we("afterRender",o);let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),o.dataURL}function ur(e){return gs(e)}re();function ys(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=Ii(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null}}Ve();wr();ie();Pe();re();function ws(...e){return jl(...e),D}var D=Object.assign(vs,{plugins:ws}),Wr=Symbol("snapdom.internal"),bs=Symbol("snapdom.internal.silent"),dr=!1;async function vs(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=ys(t);if(zl(n,t&&t.plugins),Ce()&&(n.embedFonts===!0||Ss(e))){if(n.embedFonts)try{let i=_r(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await Pr(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await xs(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&za(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>D.toPng(r,i),toSvg:(r,i)=>D.toSvg(r,i)}),D.capture(e,n,Wr)}D.capture=async(e,t,n)=>{if(n!==Wr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Br(e,t),i={img:async(h,p)=>{let{toImg:y}=await Promise.resolve().then(()=>(Yn(),qt));return y(r,{...h,...p||{}})},svg:async(h,p)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Yn(),qt));return y(r,{...h,...p||{}})},canvas:async(h,p)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(ft(),br));return y(r,{...h,...p||{}})},blob:async(h,p)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Cr(),Sr));return y(r,{...h,...p||{}})},png:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ot(),rt));return y(r,{...h,...p||{},format:"png"})},jpeg:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ot(),rt));return y(r,{...h,...p||{},format:"jpeg"})},webp:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(ot(),rt));return y(r,{...h,...p||{},format:"webp"})},download:async(h,p)=>{let{download:y}=await Promise.resolve().then(()=>(da(),Mr));return y(r,{...h,...p||{}})}},o={};for(let h of["img","svg","canvas","blob","png","jpeg","webp"])o[h]=async p=>i[h](t,{...p||{},[bs]:!0});o.jpg=o.jpeg;let a={...t,export:{url:r},exports:o},s=await Yl("defineExports",a),c=Object.assign({},...s.filter(h=>h&&typeof h=="object")),l={...i,...c};l.jpeg&&!l.jpg&&(l.jpg=(h,p)=>l.jpeg(h,p));function u(h,p){let y={...t,...p||{}};return(h==="jpeg"||h==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,f=Promise.resolve();async function m(h,p){let y=async()=>{let x=l[h];if(!x)throw new Error(`[snapdom] Unknown export type: ${h}`);let b=u(h,p),w={...t,export:{type:h,options:b,url:r}};await we("beforeExport",w);let S=await x(w,b);return await we("afterExport",w,S),d||(d=!0,await we("afterSnap",t)),S};return f=f.then(y)}let g={url:r,toRaw:()=>r,to:(h,p)=>m(h,p),toImg:h=>m("img",h),toSvg:h=>m("svg",h),toCanvas:h=>m("canvas",h),toBlob:h=>m("blob",h),toPng:h=>m("png",h),toJpg:h=>m("jpg",h),toWebp:h=>m("webp",h),download:h=>m("download",h)};for(let h of Object.keys(l)){let p="to"+h.charAt(0).toUpperCase()+h.slice(1);g[p]||(g[p]=y=>m(h,y))}return g};D.toRaw=(e,t)=>D(e,t).then(n=>n.toRaw());D.toImg=(e,t)=>D(e,t).then(n=>n.toImg());D.toSvg=(e,t)=>D(e,t).then(n=>n.toSvg());D.toCanvas=(e,t)=>D(e,t).then(n=>n.toCanvas());D.toBlob=(e,t)=>D(e,t).then(n=>n.toBlob());D.toPng=(e,t)=>D(e,{...t,format:"png"}).then(n=>n.toPng());D.toJpg=(e,t)=>D(e,{...t,format:"jpeg"}).then(n=>n.toJpg());D.toWebp=(e,t)=>D(e,{...t,format:"webp"}).then(n=>n.toWebp());D.download=(e,t)=>D(e,t).then(n=>n.download());async function xs(e,t){if(dr)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Br(e,n)}catch(i){F(t,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),r&&await new Promise(i=>{let o=new Image;try{o.decoding="sync",o.loading="eager"}catch(a){F(t,"safariWarmup img hints failed",a)}o.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",o.src=r,document.body.appendChild(o),(async()=>{try{typeof o.decode=="function"&&await o.decode()}catch(s){F(t,"safariWarmup img.decode failed",s)}let a=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-a<900;)await new Promise(s=>setTimeout(s,200));await new Promise(s=>requestAnimationFrame(s));try{let s=document.createElement("canvas");s.width=Math.max(1,o.naturalWidth||10),s.height=Math.max(1,o.naturalHeight||10);let c=s.getContext("2d");c&&c.drawImage(o,0,0)}catch{}await new Promise(s=>requestAnimationFrame(s));try{o.remove()}catch(s){F(t,"safariWarmup img.remove failed",s)}i()})()}),e.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){F(t,"safariWarmup canvas poke failed",o)}}),dr=!0}function Ss(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let n=t.currentNode,r=getComputedStyle(n),i=r.backgroundImage&&r.backgroundImage!=="none",o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(i||o||n.tagName==="CANVAS")return!0}return!1}function Ur(e){if(e.dataset.fontProxied||!e.rel||!e.rel.includes("stylesheet"))return!1;let t=e.href||"";try{return new URL(t).origin!==window.location.origin}catch{return!1}}function qr(e){let t=`/__mindstudio_dev__/font-proxy?url=${encodeURIComponent(e.href)}`,n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.fontProxied="true",e.media&&(n.media=e.media),n.onload=()=>{e.remove()},n.onerror=()=>{n.remove()},e.parentNode?.insertBefore(n,e.nextSibling)}function jr(){let e=document.querySelectorAll('link[rel~="stylesheet"]');for(let t of e)Ur(t)&&qr(t)}function Es(){let e=E().fonts;e.observer||(e.observer=new MutationObserver(t=>{for(let n of t)for(let r of n.addedNodes)r instanceof HTMLLinkElement&&Ur(r)&&qr(r)}),e.observer.observe(document.documentElement,{childList:!0,subtree:!0}))}function Cs(e){try{let t=new URL(e,window.location.origin);return t.origin===window.location.origin?!1:!!(/\.(css|woff2?|ttf|otf|eot)(\?|$)/i.test(t.pathname)||t.pathname.includes("/css"))}catch{return!1}}function Ms(){if(window.fetch.__ms_font_proxied)return;let e=window.fetch;window.fetch=function(t,n){let r=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(Cs(r)){let i=`/__mindstudio_dev__/font-proxy?url=${encodeURIComponent(r)}`;return e.apply(this,[i,n])}return e.apply(this,[t,n])},window.fetch.__ms_font_proxied=!0}function Yr(){let e=E().fonts;e.initialized||(e.initialized=!0,Ms(),jr(),Es())}async function Vr(){jr();try{await document.fonts.ready}catch{}}var zr="__mindstudio-touch-circle",rn="__mindstudio-touch-style",Xr=44,Gr=5,Kr=.95,mt=.5,on=.45,Jr=600;function ks(){document.getElementById(zr)?.remove();let e=document.createElement("div");return e.id=zr,e.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none",`width: ${Xr}px`,`height: ${Xr}px`,"border-radius: 50%","background: rgba(255, 255, 255, 0.08)","border: 2px solid rgba(255, 255, 255, 0.85)","box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 0 0.5px rgba(0, 0, 0, 0.1)","backdrop-filter: blur(1px)","-webkit-backdrop-filter: blur(1.5px)","transform: translate(-50%, -50%) scale(1)","transition: transform 100ms ease, opacity 100ms ease, background 100ms ease","opacity: 0","will-change: left, top, transform, opacity"].join("; "),document.documentElement.appendChild(e),e}function As(e){e.style.transform="translate(-50%, -50%) scale(0.88)",e.style.background="rgba(255, 255, 255, 0.18)"}function Zr(e){e.style.transform="translate(-50%, -50%) scale(1)",e.style.background="rgba(255, 255, 255, 0.08)"}function Qr(){window.location.search.includes("mode=iframe")&&E().zoom.mobilePreview&&ln()}function ln(){let e=E().touch;if(e.active)return;e.active=!0,e.scrollContainer=Se(),Ns();let t=ks();e.circleEl=t,e.onMouseMove=n=>{let r=E();if(r.cursor.executing||r.screenshot.capturing){t.style.opacity="0";return}if(t.style.left=`${n.clientX}px`,t.style.top=`${n.clientY}px`,t.style.opacity="1",e.pressed){let i=Math.abs(n.clientX-e.startX),o=Math.abs(n.clientY-e.startY);if(!e.dragging&&(i>Gr||o>Gr)&&(e.dragging=!0),e.dragging){let a=e.scrollContainer||document.documentElement,s=performance.now(),c=s-e.lastMoveTime||16,l=e.lastX-n.clientX,u=e.lastY-n.clientY;e.bouncing&&Ts();let d=a.scrollTop;a.scrollTop+=u,a.scrollLeft+=l;let m=a.scrollTop-d,g=u-m;if(Math.abs(g)>.5){let h=on/(1+Math.abs(e.overscrollY)/200);e.overscrollY+=g*h,an()}else if(e.overscrollY!==0){let h=on/(1+Math.abs(e.overscrollY)/200);e.overscrollY+=g*h,(e.overscrollY>0&&u<0||e.overscrollY<0&&u>0)&&(e.overscrollY*=.7),an()}e.velocityX=.8*(l/c)+.2*e.velocityX,e.velocityY=.8*(u/c)+.2*e.velocityY,e.lastMoveTime=s,n.preventDefault()}e.lastX=n.clientX,e.lastY=n.clientY}},e.onMouseDown=n=>{E().cursor.executing||(pt(),e.pressed=!0,e.dragging=!1,e.startX=n.clientX,e.startY=n.clientY,e.lastX=n.clientX,e.lastY=n.clientY,e.velocityX=0,e.velocityY=0,e.lastMoveTime=performance.now(),As(t))},e.onMouseUp=()=>{let n=e.dragging;n&&document.addEventListener("click",$s,{capture:!0,once:!0}),e.pressed=!1,e.dragging=!1,Zr(t),n&&(e.overscrollY!==0&&ro(),(Math.abs(e.velocityX)>mt/16||Math.abs(e.velocityY)>mt/16)&&Ls())},e.onMouseLeave=()=>{e.pressed=!1,e.dragging=!1,pt(),t.style.opacity="0",Zr(t)},e.onDragStart=n=>n.preventDefault(),document.addEventListener("mousemove",e.onMouseMove),document.addEventListener("mousedown",e.onMouseDown),document.addEventListener("mouseup",e.onMouseUp),document.addEventListener("mouseleave",e.onMouseLeave),document.addEventListener("dragstart",e.onDragStart)}function eo(){let e=E().touch;e.active&&(e.active=!1,e.pressed=!1,e.dragging=!1,pt(),e.overscrollY!==0&&(e.overscrollY=0,document.body.style.transition="",document.body.style.transform=""),Rs(),e.circleEl&&(e.circleEl.remove(),e.circleEl=null),e.onMouseMove&&document.removeEventListener("mousemove",e.onMouseMove),e.onMouseDown&&document.removeEventListener("mousedown",e.onMouseDown),e.onMouseUp&&document.removeEventListener("mouseup",e.onMouseUp),e.onMouseLeave&&document.removeEventListener("mouseleave",e.onMouseLeave),e.onDragStart&&document.removeEventListener("dragstart",e.onDragStart),e.onMouseMove=null,e.onMouseDown=null,e.onMouseUp=null,e.onMouseLeave=null,e.onDragStart=null)}function to(){let{circleEl:e}=E().touch;e&&(e.style.opacity="0")}function no(){let e=E().touch;e.active&&e.circleEl&&(e.circleEl.style.opacity="1")}function $s(e){e.preventDefault(),e.stopPropagation()}function Ls(){pt();let e=E().touch,t=e.scrollContainer||document.documentElement,n=e.velocityX*16,r=e.velocityY*16;function i(){let o=E().touch;if(n*=Kr,r*=Kr,Math.abs(n)<mt&&Math.abs(r)<mt){o.momentumFrame=null,o.overscrollY!==0&&ro();return}let a=t.scrollTop;t.scrollTop+=r,t.scrollLeft+=n;let s=t.scrollTop-a,c=r-s;if(Math.abs(c)>.5){let l=on*.5/(1+Math.abs(o.overscrollY)/200);o.overscrollY+=c*l,an(),r*=.7}o.momentumFrame=requestAnimationFrame(i)}e.momentumFrame=requestAnimationFrame(i)}function pt(){let e=E().touch;e.momentumFrame!==null&&(cancelAnimationFrame(e.momentumFrame),e.momentumFrame=null)}function an(){let e=E().touch;document.body.style.transition="none",document.body.style.transform=`translateY(${-e.overscrollY}px)`}function ro(){let e=E().touch;e.bouncing=!0,e.overscrollY=0,document.body.style.transition=`transform ${Jr}ms cubic-bezier(0.2, 0.9, 0.3, 1)`,document.body.style.transform="",e.bounceTimer&&clearTimeout(e.bounceTimer),e.bounceTimer=setTimeout(()=>{let t=E().touch;t.bouncing=!1,t.bounceTimer=null,document.body.style.transition="",document.body.style.transform=""},Jr)}function Ts(){let e=E().touch;e.bouncing&&(e.bouncing=!1,e.bounceTimer&&(clearTimeout(e.bounceTimer),e.bounceTimer=null),document.body.style.transition="")}function Ns(){document.getElementById(rn)?.remove();let e=document.createElement("style");e.id=rn,e.textContent=`
9
+ `):u+=f[0]}return u+=s.slice(d),u}let a=er(e,t||location.href);return a=await o(a,t||location.href,0),a}var Lr=/url\((["']?)([^"')]+)\1\)/g,fl=/@font-face[^{}]*\{[^}]*\}/g;function Tr(e){if(!e)return[];let t=[],n=e.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let i=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],a=i[2],s=c=>{if(!c.includes("?"))return parseInt(c,16);let l=parseInt(c.replace(/\?/g,"0"),16),u=parseInt(c.replace(/\?/g,"F"),16);return[l,u]};if(a){let c=s(o),l=s(a),u=Array.isArray(c)?c[0]:c,d=Array.isArray(l)?l[1]:l;t.push([Math.min(u,d),Math.max(u,d)])}else{let c=s(o);Array.isArray(c)?t.push([c[0],c[1]]):t.push([c,c])}}return t}function Nr(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[r,i]of t)if(n>=r&&n<=i)return!0;return!1}function nn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(Lr)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,t||location.href).href}catch{}n.push(i)}}return n}async function _r(e,t,n=""){let r=e;for(let i of e.matchAll(Lr)){let o=Zt(i[0]);if(!o)continue;let a=o;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!me(a)){if(M.resource?.has(a)){M.font?.add(a),r=r.replace(i[0],`url(${M.resource.get(a)})`);continue}if(!M.font?.has(a))try{let s=await ne(a,{as:"dataURL",useProxy:n,silent:!0});if(s.ok&&typeof s.data=="string"){let c=s.data;M.resource?.set(a,c),M.font?.add(a),r=r.replace(i[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function ml(e){if(!e.length)return null;let t=(a,s)=>e.some(([c,l])=>!(l<a||c>s)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),o=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function tr(e={}){let t=new Set((e.families||[]).map(i=>String(i).toLowerCase())),n=new Set((e.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((e.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(t.size&&t.has(i.family.toLowerCase()))return!0;if(n.size)for(let a of i.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(r.size){let a=ml(o);if(a&&r.has(a))return!0}return!1}}function pl(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of e.match(t)||[]){let a=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",s=tn(a),c=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),l=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),d=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),f=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),m=nn(f,location.href),g=m.length?m.map(p=>String(p).toLowerCase()).sort().join("|"):f.toLowerCase(),h=[String(s||"").toLowerCase(),c,l,u,d.toLowerCase(),g].join("|");n.has(h)||(n.add(h),r.push(o))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||"")}function hl(e,t,n,r,i){let o=Array.from(e||[]).sort().join("|"),a=t?JSON.stringify({families:(t.families||[]).map(u=>String(u).toLowerCase()).sort(),domains:(t.domains||[]).map(u=>String(u).toLowerCase()).sort(),subsets:(t.subsets||[]).map(u=>String(u).toLowerCase()).sort()}):"",s=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),c=r||"",l=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${s}::px=${c}::fd=${l}`}async function Rr(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let o=(a,s)=>{try{return new URL(a,s||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let s=a.href?o(a.href,t):t;if(r.depth>=ut){console.warn(`[snapDOM] CSSOM import depth exceeded (${ut}) at ${s}`);continue}if(s&&r.visitedSheets.has(s)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${s}`);continue}s&&r.visitedSheets.add(s);let c={...r,depth:(r.depth||0)+1};await Rr(a.styleSheet,s,n,c);continue}if(a.type===CSSRule.FONT_FACE_RULE){let s=(a.style.getPropertyValue("font-family")||"").trim(),c=tn(s);if(!c||me(c))continue;let l=(a.style.getPropertyValue("font-weight")||"400").trim(),u=(a.style.getPropertyValue("font-style")||"normal").trim(),d=(a.style.getPropertyValue("font-stretch")||"100%").trim(),f=(a.style.getPropertyValue("src")||"").trim(),m=(a.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(c,u,l,d))continue;let g=Tr(m);if(!Nr(r.usedCodepoints,g))continue;let h={family:c,weightSpec:l,styleSpec:u,stretchSpec:d,unicodeRange:m,srcRaw:f,srcUrls:nn(f,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(h,g))continue;if(/url\(/i.test(f)){let p=await _r(f,t||location.href,r.useProxy);await n(`@font-face{font-family:${c};src:${p};font-style:${u};font-weight:${l};font-stretch:${d};${m?`unicode-range:${m};`:""}}`)}else await n(`@font-face{font-family:${c};src:${f};font-style:${u};font-weight:${l};font-stretch:${d};${m?`unicode-range:${m};`:""}}`)}}}async function gl({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let a=new Map;for(let p of e){let[y,x,b,w]=String(p).split("__");if(!y)continue;let S=a.get(y)||[];S.push({w:parseInt(x,10),s:b,st:parseInt(w,10)}),a.set(y,S)}function s(p,y,x,b){if(!a.has(p))return!1;let w=a.get(p),S=il(x),C=al(y),v=ll(b),k=S.min!==S.max,N=S.min,B=L=>C.kind==="normal"&&L==="normal"||C.kind!=="normal"&&(L==="italic"||L==="oblique"),D=!1;for(let L of w){let $=k?L.w>=S.min&&L.w<=S.max:L.w===N,O=B(st(L.s)),U=L.st>=v.min&&L.st<=v.max;if($&&O&&U){D=!0;break}}if(D)return!0;if(!k)for(let L of w){let $=B(st(L.s)),O=L.st>=v.min&&L.st<=v.max;if(Math.abs(N-L.w)<=300&&$&&O)return!0}if(!k&&C.kind==="normal"&&w.some(L=>st(L.s)!=="normal"))for(let L of w){let $=Math.abs(N-L.w)<=300,O=L.st>=v.min&&L.st<=v.max;if($&&O)return!0}return!1}let c=tr(n),l=hl(e,n,r,i,o);if(M.resource?.has(l))return M.resource.get(l);let u=ul(e),d=[],f=Vt;for(let p of document.querySelectorAll("style")){let y=p.textContent||"";for(let x of y.matchAll(f)){let b=(x[2]||x[4]||"").trim();!b||me(b)||document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||d.push(b)}}d.length&&await Promise.all(d.map(p=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${p}"]`))return y(null);let x=document.createElement("link");x.rel="stylesheet",x.href=p,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>y(x),x.onerror=()=>y(null),document.head.appendChild(x)})));let m="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(p=>!!p.href);for(let p of g)try{if(me(p.href))continue;let y="",x=!1;try{x=new URL(p.href,location.href).origin===location.origin}catch{}if(!x){let w=Array.isArray(o)?o:[];if(!cl(p.href,u,w))continue}if(x){let w=Array.from(document.styleSheets).find(S=>S.href===p.href);if(w)try{let S=w.cssRules||[];y=Array.from(S).map(C=>C.cssText).join("")}catch{}}if(!y){let w=await ne(p.href,{as:"text",useProxy:i});if(w?.ok&&typeof w.data=="string"&&(y=w.data),me(p.href))continue}y=await dl(y,p.href,i);let b="";for(let w of y.match(fl)||[]){let S=(w.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=tn(S);if(!C||me(C))continue;let v=(w.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),k=(w.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),N=(w.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),B=(w.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),D=(w.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=nn(D,p.href);if(!s(C,k,v,N))continue;let $=Tr(B);if(!Nr(t,$))continue;let O={family:C,weightSpec:v,styleSpec:k,stretchSpec:N,unicodeRange:B,srcRaw:D,srcUrls:L,href:p.href};if(n&&c(O,$))continue;let U=/url\(/i.test(D)?await _r(w,p.href,i):w;b+=U}b.trim()&&(m+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",p.href)}let h={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:s,simpleExcluder:n?tr(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let p of document.styleSheets)if(!(p.href&&g.some(y=>y.href===p.href)))try{let y=p.href||location.origin+"/";y&&h.visitedSheets.add(y),await Rr(p,y,async x=>{m+=x},h)}catch{}try{for(let p of document.fonts||[]){if(!p||!p.family||p.status!=="loaded"||!p._snapdomSrc)continue;let y=String(p.family).replace(/^['"]+|['"]+$/g,"");if(me(y)||!a.has(y)||n?.families&&n.families.some(b=>String(b).toLowerCase()===y.toLowerCase()))continue;let x=p._snapdomSrc;if(!String(x).startsWith("data:")){if(M.resource?.has(p._snapdomSrc))x=M.resource.get(p._snapdomSrc),M.font?.add(p._snapdomSrc);else if(!M.font?.has(p._snapdomSrc))try{let b=await ne(p._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(b.ok&&typeof b.data=="string")x=b.data,M.resource?.set(p._snapdomSrc,x),M.font?.add(p._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",p._snapdomSrc);continue}}m+=`@font-face{font-family:'${y}';src:url(${x});font-style:${p.style||"normal"};font-weight:${p.weight||"normal"};}`}}catch{}for(let p of r){if(!p||typeof p!="object")continue;let y=String(p.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||me(y)||!a.has(y)||n?.families&&n.families.some(v=>String(v).toLowerCase()===y.toLowerCase()))continue;let x=p.weight!=null?String(p.weight):"normal",b=p.style!=null?String(p.style):"normal",w=p.stretchPct!=null?`${p.stretchPct}%`:"100%",S=String(p.src||""),C=S;if(!C.startsWith("data:")){if(M.resource?.has(S))C=M.resource.get(S),M.font?.add(S);else if(!M.font?.has(S))try{let v=await ne(S,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")C=v.data,M.resource?.set(S,C),M.font?.add(S);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",S);continue}}m+=`@font-face{font-family:'${y}';src:url(${C});font-style:${b};font-weight:${x};font-stretch:${w};}`}return m&&(m=pl(m),M.resource?.set(l,m)),m}function Pr(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let s=rl(a.fontFamily);if(s.length)for(let c of s){let l=(u,d,f)=>`${c}__${lt(u)}__${st(d)}__${ol(f)}`;t.add(l(a.fontWeight,a.fontStyle,a.fontStretch))}};r(getComputedStyle(e));let i=getComputedStyle(e,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(e,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let a=n.currentNode,s=getComputedStyle(a);r(s);let c=getComputedStyle(a,"::before");c&&c.content&&c.content!=="none"&&r(c);let l=getComputedStyle(a,"::after");l&&l.content&&l.content!=="none"&&r(l)}return t}function yl(e){let t=new Set,n=i=>{if(i)for(let o of i)t.add(o.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let i=r.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let o=i;for(let a of["::before","::after"]){let s=getComputedStyle(o,a)?.getPropertyValue("content");if(!(!s||s==="none"))if(/^"/.test(s)||/^'/.test(s))n(s.slice(1,-1));else{let c=s.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let l of c)try{t.add(parseInt(l.slice(1),16))}catch{}}}}}return t}async function Fr(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let i=document.createElement("div");i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let o of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${o}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",i.appendChild(a)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}re();function wl(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function bl(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function nr(e,t=!1){let n="",r=Math.max(1,e);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return t?n.toUpperCase():n}function rr(e,t=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,e)),i="";for(let[o,a]of n)for(;r>=o;)i+=a,r-=o;return t?i:i.toLowerCase()}function or(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(e);case"decimal-leading-zero":{let n=Math.abs(e);return(e<0?"-":"")+(n<10?"0":"")+String(n)}case"lower-alpha":return nr(e,!1);case"upper-alpha":return nr(e,!0);case"lower-roman":return rr(e,!1);case"upper-roman":return rr(e,!0);default:return String(e)}}function vl(e){let t=()=>M?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,o=f=>f&&f.tagName==="LI",a=f=>{let m=0,g=f?.parentElement;if(!g)return 0;for(let h of g.children){if(h===f)break;h.tagName==="LI"&&m++}return m},s=f=>{let m=new Map;for(let[g,h]of f)m.set(g,h.slice());return m},c=(f,m,g)=>{let h=s(f),p;try{p=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(p&&p!=="none")for(let b of p.split(",")){let w=b.trim().split(/\s+/),S=w[0],C=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!S)continue;let v=m.get(S);if(v&&v.length){let k=v.slice();k.push(C),h.set(S,k)}else h.set(S,[C])}let y;try{y=g.style?.counterSet||getComputedStyle(g).counterSet}catch{}if(y&&y!=="none")for(let b of y.split(",")){let w=b.trim().split(/\s+/),S=w[0],C=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!S)continue;let v=h.get(S)||[];v.length===0&&v.push(0),v[v.length-1]=C,h.set(S,v)}let x;try{x=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(x&&x!=="none")for(let b of x.split(",")){let w=b.trim().split(/\s+/),S=w[0],C=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!S)continue;let v=h.get(S)||[];v.length===0&&v.push(0),v[v.length-1]+=C,h.set(S,v)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let b=g.parentElement,w=1;if(b&&b.tagName==="OL"){let C=b.getAttribute("start"),v=Number.isFinite(Number(C))?Number(C):1,k=a(g),N=g.getAttribute("value");w=Number.isFinite(Number(N))?Number(N):v+k}else w=1+a(g);let S=h.get("list-item")||[];S.length===0&&S.push(0),S[S.length-1]=w,h.set("list-item",S)}}catch{}return h},l=(f,m,g)=>{let h=c(g,m,f);r.set(f,h);let p=h;for(let x of f.children)p=l(x,h,p);let y=new Map;for(let[x,b]of g){let w=b.length,S=p.get(x);y.set(x,S&&S.length?S.slice(0,w):b.slice())}for(let[x,b]of p)!y.has(x)&&b.length&&!m.has(x)&&y.set(x,b.slice(0,1));return y},u=new Map;l(i,u,u);function d(){let f=t();if(f!==n){n=f;let m=new Map;l(i,m,m)}}return{get(f,m){d();let g=r.get(f)?.get(m);return g&&g.length?g[g.length-1]:0},getStack(f,m){d();let g=r.get(f)?.get(m);return g?g.slice():[]}}}function xl(e,t,n){if(!e||e==="none")return e;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=e.replace(r,(o,a,s)=>{let c=String(s).split(",").map(l=>l.trim());if(a==="counter"){let l=c[0]?.replace(/^["']|["']$/g,""),u=(c[1]||"decimal").toLowerCase(),d=n.get(t,l);return or(d,u)}else{let l=c[0]?.replace(/^["']|["']$/g,""),u=c[1]?.replace(/^["']|["']$/g,"")??"",d=(c[2]||"decimal").toLowerCase(),f=n.getStack(t,l);return f.length?f.map(m=>or(m,d)).join(u):""}});return bl(i)}catch{return"- "}}Pe();re();var Ne=new WeakMap,ir=1e3;function Sl(e,t){let n=Ir(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=lr(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):lr(e)}function zt(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Ir(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${t.length}|`,r=0;for(let o=0;o<t.length;o++){let a=t[o];if(a.tagName==="STYLE"){let s=a.textContent?a.textContent.length:0;n+=`S${s}|`;let c=a.sheet,l=c?zt(c):null;l&&(r+=l.length)}else{let s=a.getAttribute("href")||"",c=a.getAttribute("media")||"all";n+=`L${s}|m:${c}|`;let l=a.sheet,u=l?zt(l):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function ar(e,t,n){let r=zt(e);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],a=o&&o.cssText?o.cssText:"";n.budget--;for(let s of t)if(a.includes(s))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let s=0;s<o.cssRules.length&&n.budget>0;s++){let c=o.cssRules[s],l=c&&c.cssText?c.cssText:"";n.budget--;for(let u of t)if(l.includes(u))return!0}if(n.budget<=0)return!1}return!1}function lr(e=document){let t=Ir(e),n=Ne.get(e);if(n&&n.fingerprint===t)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=e.querySelectorAll("style");for(let a=0;a<i.length;a++){let s=i[a].textContent||"";for(let c of r)if(s.includes(c))return Ne.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:ir};try{for(let s of o)if(ar(s,r,a))return Ne.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),s={budget:ir};for(let c=0;c<a.length&&s.budget>0;c++){let l=a[c],u=null;if(l.tagName,u=l.sheet||null,u&&ar(u,r,s))return Ne.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Ne.set(e,{fingerprint:t,result:!0}),!0):(Ne.set(e,{fingerprint:t,result:!1}),!1)}var Re=new WeakMap,sr=-1;function El(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Cl(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):El(e)}function Xt(e,t){let n=e.parentElement,r=n?Re.get(n):null;return r?{get(i,o){let a=t.get(i,o),s=r.get(o);return typeof s=="number"?Math.max(a,s):a},getStack(i,o){let a=t.getStack(i,o);if(!a.length)return a;let s=r.get(o);if(typeof s=="number"){let c=a.slice();return c[c.length-1]=Math.max(c[c.length-1],s),c}return a}}:t}function Gt(e,t,n){let r=new Map;function i(c){let l=[];if(!c||c==="none")return l;for(let u of String(c).split(",")){let d=u.trim().split(/\s+/),f=d[0],m=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;f&&l.push({name:f,num:m})}return l}let o=i(t?.counterReset),a=i(t?.counterIncrement);function s(c){if(r.has(c))return r.get(c).slice();let l=n.getStack(e,c);l=l.length?l.slice():[];let u=o.find(f=>f.name===c);if(u){let f=Number.isFinite(u.num)?u.num:0;l=l.length?[...l,f]:[f]}let d=a.find(f=>f.name===c);if(d){let f=Number.isFinite(d.num)?d.num:1;l.length===0&&(l=[0]),l[l.length-1]+=f}return r.set(c,l.slice()),l}return{get(c,l){let u=s(l);return u.length?u[u.length-1]:0},getStack(c,l){return s(l)},__incs:a}}function Ml(e,t,n){let r;try{r=pe(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=Xt(e,n),a=Gt(e,r,o),s=wl(i)?xl(i,e,a):i;return{text:Cl(s),incs:a.__incs||[]}}async function Kt(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!Sl(i,n))return;let o=M?.session?.__counterEpoch??0;if(sr!==o&&(Re=new WeakMap,n&&(n.__counterCtx=null),sr=o),!n.__counterCtx)try{n.__counterCtx=vl(e.ownerDocument||document)}catch(c){F(n,"buildCounterContext failed",c)}let a=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let l=pe(e,c);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(c==="::first-letter"){let T=pe(e);if(!(l.color!==T.color||l.fontSize!==T.fontSize||l.fontWeight!==T.fontWeight||l.fontFamily!==T.fontFamily||l.fontStyle!==T.fontStyle||l.textTransform!==T.textTransform||l.float!==T.float||l.paddingTop!==T.paddingTop||l.paddingRight!==T.paddingRight||l.paddingBottom!==T.paddingBottom||l.paddingLeft!==T.paddingLeft||l.marginTop!==T.marginTop||l.marginRight!==T.marginRight||l.marginBottom!==T.marginBottom||l.marginLeft!==T.marginLeft))continue;let _=Array.from(t.childNodes).find(J=>J.nodeType===Node.TEXT_NODE&&J.textContent?.trim().length>0);if(!_)continue;let P=_.textContent,R=P.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],K=P.slice(R?.length||0);if(!R||/[\uD800-\uDFFF]/.test(R))continue;let W=document.createElement("span");W.textContent=R,W.dataset.snapdomPseudo="::first-letter";let q=jn(l),j=Wt(q,"span");n.styleMap.set(W,j);let V=document.createTextNode(K);t.replaceChild(V,_),t.insertBefore(W,V);continue}let u=l.content??"",d=u===""||u==="none"||u==="normal",{text:f,incs:m}=Ml(e,c,a),g=l.backgroundImage,h=l.backgroundColor,p=l.fontFamily,y=parseInt(l.fontSize)||32,x=parseInt(l.fontWeight)||!1,b=l.color||"#000",w=l.borderStyle,S=parseFloat(l.borderWidth),C=l.transform,v=me(p),k=!d&&f!=="",N=g&&g!=="none",B=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",D=w&&w!=="none"&&S>0,L=C&&C!=="none";if(!(k||N||B||D||L)){if(m&&m.length&&e.parentElement){let T=Re.get(e.parentElement)||new Map;for(let{name:_}of m){if(!_)continue;let P=Xt(e,a),R=Gt(e,pe(e,c),P).get(e,_);T.set(_,R)}Re.set(e.parentElement,T)}continue}let $=document.createElement("span");$.dataset.snapdomPseudo=c,$.style.pointerEvents="none";let O=jn(l),U=Wt(O,"span");if(n.styleMap.set($,U),v&&f&&f.length===1){let{dataUrl:T,width:_,height:P}=await tl(f,p,x,y,b),R=document.createElement("img");R.src=T,R.style=`height:${y}px;width:${_/P*y}px;object-fit:contain;`,$.appendChild(R),t.dataset.snapdomHasIcon="true"}else if(f&&f.startsWith("url(")){let T=Zt(f);if(T?.trim())try{let _=await ne(ct(T),{as:"dataURL",useProxy:r.useProxy});if(_?.ok&&typeof _.data=="string"){let P=document.createElement("img");P.src=_.data,P.style=`width:${y}px;height:auto;object-fit:contain;`,$.appendChild(P)}}catch(_){console.error(`[snapdom] Error in pseudo ${c} for`,e,_)}}else!v&&k&&($.textContent=f);$.style.backgroundImage="none","maskImage"in $.style&&($.style.maskImage="none"),"webkitMaskImage"in $.style&&($.style.webkitMaskImage="none");try{$.style.backgroundRepeat=l.backgroundRepeat,$.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?($.style.backgroundPositionX=l.backgroundPositionX,$.style.backgroundPositionY=l.backgroundPositionY):$.style.backgroundPosition=l.backgroundPosition,$.style.backgroundOrigin=l.backgroundOrigin,$.style.backgroundClip=l.backgroundClip,$.style.backgroundAttachment=l.backgroundAttachment,$.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(N)try{let T=Ut(g),_=await Promise.all(T.map(mr));$.style.backgroundImage=_.join(", ")}catch(T){console.warn(`[snapdom] Failed to inline background-image for ${c}`,T)}B&&($.style.backgroundColor=h);let G=$.childNodes.length>0||$.textContent?.trim()!==""||N||B||D||L;if(m&&m.length&&e.parentElement){let T=Re.get(e.parentElement)||new Map,_=Xt(e,a),P=Gt(e,pe(e,c),_);for(let{name:R}of m){if(!R)continue;let K=P.get(e,R);T.set(R,K)}Re.set(e.parentElement,T)}if(!G)continue;c==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore($,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild($))}catch(l){console.warn(`[snapdom] Failed to capture ${c} for`,e,l)}let s=Array.from(t.children).filter(c=>!c.dataset.snapdomPseudo);if(n.nodeMap)for(let c of s){let l=n.nodeMap.get(c);l instanceof Element&&await Kt(l,c,n,r)}else{let c=Array.from(e.children);for(let l=0;l<Math.min(c.length,s.length);l++)await Kt(c[l],s[l],n,r)}}function kl(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],s=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c="http://www.w3.org/1999/xlink",l=w=>{if(!w||!w.getAttribute)return null;let S=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(c,"href"):null);if(S)return S;let C=w.attributes;if(!C)return null;for(let v=0;v<C.length;v++){let k=C[v];if(!k||!k.name)continue;if(k.name==="href")return k.value;let N=k.name.indexOf(":");if(N!==-1&&k.name.slice(N+1)==="href")return k.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(w=>w.id)),d=new Set,f=!1,m=(w,S=null)=>{if(!w)return;o.lastIndex=0;let C;for(;C=o.exec(w);){f=!0;let v=(C[1]||"").trim();v&&(u.has(v)||(d.add(v),S&&!S.has(v)&&S.add(v)))}},g=w=>{let S=w.querySelectorAll("use");for(let v of S){let k=l(v);if(!k||!k.startsWith("#"))continue;f=!0;let N=k.slice(1).trim();N&&!u.has(N)&&d.add(N)}let C=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of C){m(v.getAttribute("style")||"");for(let k of a)m(v.getAttribute(k))}};for(let w of i)g(w);if(!f)return;let h=e.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(h,e.firstChild||null));let p=h.querySelector("defs")||null,y=w=>{if(!w||u.has(w))return null;let S=s(w),C=v=>{let k=r.querySelector(v);return k&&!e.contains(k)?k:null};return C(`svg defs > *#${S}`)||C(`svg > symbol#${S}`)||C(`*#${S}`)};if(!d.size)return;let x=new Set(d),b=new Set;for(;x.size;){let w=x.values().next().value;if(x.delete(w),!w||u.has(w)||b.has(w))continue;let S=y(w);if(!S){b.add(w);continue}p||(p=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(p));let C=S.cloneNode(!0);C.id||C.setAttribute("id",w),p.appendChild(C),b.add(w),u.add(w);let v=[C,...C.querySelectorAll("*")];for(let k of v){let N=l(k);if(N&&N.startsWith("#")){let D=N.slice(1).trim();D&&!u.has(D)&&!b.has(D)&&x.add(D)}let B=k.getAttribute?.("style")||"";B&&m(B,x);for(let D of a){let L=k.getAttribute?.(D);L&&m(L,x)}}}}re();function Al(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;getComputedStyle(t).position==="static"&&(t.style.position="relative");let r=e.getBoundingClientRect(),i=e.clientHeight,o="data-snap-ph",a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let s=a.currentNode,c=getComputedStyle(s),l=c.position;if(l!=="sticky"&&l!=="-webkit-sticky")continue;let u=cr(c.top),d=cr(c.bottom);if(u==null&&d==null)continue;let f=$l(s,e),m=Ll(t,f,o);if(!m)continue;let g=s.getBoundingClientRect(),h=g.width,p=g.height,y=g.left-r.left;if(!(h>0&&p>0)||!Number.isFinite(y))continue;let x=u!=null?u+n:n+(i-p-d);if(!Number.isFinite(x))continue;let b=Number.parseInt(c.zIndex,10),w=Number.isFinite(b),S=w?Math.max(b,1)+1:2,C=w?b-1:0,v=m.cloneNode(!1);v.setAttribute(o,"1"),v.style.position="sticky",v.style.left=`${y}px`,v.style.top=`${x}px`,v.style.width=`${h}px`,v.style.height=`${p}px`,v.style.visibility="hidden",v.style.zIndex=String(C),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",m.parentElement?.insertBefore(v,m),m.style.position="absolute",m.style.left=`${y}px`,m.style.top=`${x}px`,m.style.bottom="auto",m.style.zIndex=String(S),m.style.pointerEvents="none"}}function cr(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function $l(e,t){let n=[];for(let r=e;r&&r!==t;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function Ll(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=Tl(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function Tl(e,t){let n=[],r=e.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(t)||n.push(o)}return n}function Nl(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=n!=="none"&&parseFloat(r)>0,s=i==="none"||parseFloat(o)===0;a&&s&&(e.style.border=`${r} solid transparent`)}function _l(e){let t=[];try{let n=e.querySelectorAll("*");for(let r of n){if(!(r instanceof HTMLElement))continue;let i=r.style.contentVisibility||"",o=getComputedStyle(r),a=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(a==="auto"||a==="hidden")&&(t.push({el:r,original:i}),r.style.contentVisibility="visible")}if(e instanceof HTMLElement){let r=getComputedStyle(e),i=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(t.push({el:e,original:e.style.contentVisibility||""}),e.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:n,original:r}of t)try{n.style.contentVisibility=r}catch{}}}async function Rl(e,t={}){let n={styleMap:M.session.styleMap,styleCache:M.session.styleCache,nodeMap:M.session.nodeMap,options:t},r,i="",o="";Nl(e);let a=_l(e);try{kl(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await at(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}finally{a()}try{await Kt(e,r,n,t)}catch(l){console.warn("inlinePseudoElements failed:",l)}await Ya(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let u of l)o+=u.textContent||"",u.remove()}catch(l){F(n,"Failed to extract shadow CSS from style[data-sd]",l)}let s=Ji(n.styleMap);i=Array.from(s.entries()).map(([l,u])=>`.${u}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,u]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",u.replace(/;/g,"; "));continue}let d=s.get(u);d&&l.classList.add(d);let f=l.style?.backgroundImage,m=l.dataset?.snapdomHasIcon;f&&f!=="none"&&(l.style.backgroundImage=f),m&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,u]of n.nodeMap.entries()){let d=u.scrollLeft,f=u.scrollTop;if((d||f)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";try{let g=l.querySelectorAll("*");for(let h of g){if(!(h instanceof HTMLElement))continue;let p=h.style.position;if(p==="fixed"||p==="absolute"){let y=parseFloat(h.style.top)||0,x=parseFloat(h.style.left)||0;h.style.top=`${y+f}px`,h.style.left=`${x+d}px`,p==="fixed"&&(h.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.transform=`translate(${-d}px, ${-f}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m)}}let c=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Al(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||pe(e);n.styleCache.set(e,l);let u=Hi(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=u||""}for(let[l,u]of n.nodeMap.entries())u.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}Pe();var Dr="http://www.w3.org/1999/xlink";function Pl(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Dr,"href"):null)}function Fl(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,n=parseInt(e.dataset?.snapdomHeight||"",10)||0,r=parseInt(e.getAttribute("width")||"",10)||0,i=parseInt(e.getAttribute("height")||"",10)||0,o=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,s=t||o||r||e.width||e.naturalWidth||100,c=n||a||i||e.height||e.naturalHeight||100;return{width:s,height:c}}async function Il(e,t={}){let n=Array.from(e.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let f=a.currentSrc||a.src||"";f&&a.setAttribute("src",f)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let s=a.src||"";if(!s)return;let c=await ne(s,{as:"dataURL",useProxy:t.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){a.src=c.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:l,height:u}=Fl(a),{fallbackURL:d}=t||{};if(d)try{let f=typeof d=="function"?await d({width:l,height:u,src:s,element:a}):d;if(f){let m=await ne(f,{as:"dataURL",useProxy:t.useProxy});if(m?.ok&&typeof m.data=="string"){a.src=m.data,a.width||(a.width=l),a.height||(a.height=u);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${l}px`,`height:${u}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${u}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",a.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${l}px;height:${u}px;visibility:hidden;`,a.replaceWith(f)}};for(let a=0;a<n.length;a+=4){let s=n.slice(a,a+4).map(r);await Promise.allSettled(s)}let i=Array.from(e.querySelectorAll("image")),o=async a=>{let s=Pl(a);if(!s||s.startsWith("data:")||s.startsWith("blob:"))return;let c=await ne(s,{as:"dataURL",useProxy:t.useProxy});c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")&&(a.setAttribute("href",c.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Dr,"href"))};for(let a=0;a<i.length;a+=4){let s=i.slice(a,a+4).map(o);await Promise.allSettled(s)}}ie();async function Dl(e,t,n,r={}){let i=[[e,t]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],s=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[l,u]=i.shift();if(!u)continue;let d=n.get(l)||pe(l);n.has(l)||n.set(l,d);let f=(()=>{let h=d.getPropertyValue("border-image"),p=d.getPropertyValue("border-image-source");return h&&h!=="none"||p&&p!=="none"})();for(let h of s){let p=d.getPropertyValue(h);p&&u.style.setProperty(h,p)}for(let h of o){let p=d.getPropertyValue(h);if(h==="background-image"&&(!p||p==="none")){let b=d.getPropertyValue("background");b&&/url\s*\(/.test(b)&&(p=Ut(b).filter(w=>/url\s*\(/.test(w)).join(", ")||p)}if(!p||p==="none")continue;let y=Ut(p),x=await Promise.all(y.map(b=>mr(b,r)));x.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&u.style.setProperty(h,x.join(", "))}for(let h of a){let p=d.getPropertyValue(h);!p||p==="initial"||u.style.setProperty(h,p)}if(f)for(let h of c){let p=d.getPropertyValue(h);!p||p==="initial"||u.style.setProperty(h,p)}let m=l.shadowRoot?Array.from(l.shadowRoot.children).filter(h=>h.tagName!=="STYLE"):Array.from(l.children),g=Array.from(u.children).filter(h=>!(h.dataset?.snapdomPseudo||h.tagName==="STYLE"&&h.dataset?.sd));for(let h=0;h<Math.min(m.length,g.length);h++)i.push([m[h],g[h]])}}ie();re();function Ol(e){if(!e)return()=>{};let t=[];function n(r){let i=Hl(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function Hl(e){if(!e)return()=>{};let t=Bl(e);if(t<=0)return()=>{};if(!ql(e))return()=>{};let n=getComputedStyle(e),r=Math.round(Wl(n)*t+Ul(n)),i=e.textContent??"",o=i;if(e.scrollHeight<=r+.5)return()=>{};let a=0,s=i.length,c=-1;for(;a<=s;){let l=a+s>>1;e.textContent=i.slice(0,l)+"\u2026",e.scrollHeight<=r+.5?(c=l,a=l+1):s=l-1}return e.textContent=(c>=0?i.slice(0,c):"")+"\u2026",()=>{e.textContent=o}}function Bl(e){let t=getComputedStyle(e),n=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function Wl(e){let t=(e.lineHeight||"").trim(),n=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(n*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith("%")?Math.round(parseFloat(t)/100*n):Math.round(n*1.2)}function Ul(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ql(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var je=[];function Or(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return typeof t=="function"?t(n):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:n}=e;return typeof t=="function"?t(n):t}return typeof e=="function"?e():e}function jl(...e){let t=e.flat();for(let n of t){let r=Or(n);r&&(je.some(i=>i&&i.name&&r.name&&i.name===r.name)||je.push(r))}}function Hr(e){return(e&&Array.isArray(e.plugins)?e.plugins:je)||je}async function we(e,t,n){let r=n,i=Hr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let s=await a(t,r);typeof s<"u"&&(r=s)}return r}async function Yl(e,t,n){let r=[],i=Hr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let s=await a(t,n);typeof s<"u"&&r.push(s)}return r}function Vl(e){let t=[];if(Array.isArray(e))for(let n of e){let r=Or(n);if(!r||!r.name)continue;let i=t.findIndex(o=>o&&o.name===r.name);i>=0&&t.splice(i,1),t.push(r)}for(let n of je)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function zl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=Vl(t)),e}ie();function Xl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){F(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){F(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){F(n,"stripRootShadows outline",o)}let i=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=i.length?i:"none"}catch(o){F(n,"stripRootShadows filter",o)}}function Gl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let r of n)r.remove()}function Kl(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set(["xml","xlink"]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let a of Array.from(o.attributes)){let s=a.name;if(s.includes("@")){o.removeAttribute(s);continue}if(s.includes(":")){let c=s.split(":",1)[0];if(!r.has(c)){o.removeAttribute(s);continue}}if(n&&(s.startsWith("x-")||s.startsWith("v-")||s.startsWith(":")||s.startsWith("on:")||s.startsWith("bind:")||s.startsWith("let:")||s.startsWith("class:"))){o.removeAttribute(s);continue}}}}function Jl(e,t={}){e&&(Kl(e,t),Gl(e))}function Zl(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function Ql(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function es(e,t){if(!(e instanceof Element)||Zl(e)||Ql(e))return!1;let n=t.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=t.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||t.transform&&t.transform!=="none")}function ts(e,t,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let a=i.childElementCount>o.childElementCount,s=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,s),a&&es(i,s)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let u=s.overflowY||s.overflowBlock||"visible",d=s.overflowX||s.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(o.style.overflow="visible")}let c=Array.from(i.children),l=Array.from(o.children);for(let u=0;u<Math.min(c.length,l.length);u++)r(c[u],l[u])}r(e,t)}function ns(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function rs(e,t){if(!(e instanceof Element))return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return t.excludeMode==="remove"}catch(r){F(t,"exclude selector match failed",r)}return!1}function os(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,s=Array.from(e.children);for(let m of s){if(rs(m,t)||!ns(m))continue;let g=m.getBoundingClientRect(),h=g.top-r.top,p=g.bottom-r.top;p<=h||(h<i&&(i=h),p>o&&(o=p),a=!0)}let c=a?Math.max(0,o-i):0,l=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return l+u+d+f+c}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,is=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Jt(e,t=new Set){let n="";if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Jt(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=Jt(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(is.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function as(e){if(!e||!e.styleSheets)return"";let t=new Set,n="";for(let r of Array.from(e.styleSheets))try{let i=r.cssRules;i&&(n+=Jt(i,t))}catch{}return n}function ls(e){let t=e.boxShadow||"";if(!t||t==="none")return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(s=>s.trim()),r=0,i=0,o=0,a=0;for(let s of n){let c=s.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(c.length<2)continue;let[l,u,d=0,f=0]=c,m=Math.abs(l)+d+f,g=Math.abs(u)+d+f;i=Math.max(i,m+Math.max(l,0)),a=Math.max(a,m+Math.max(-l,0)),o=Math.max(o,g+Math.max(u,0)),r=Math.max(r,g+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(o),left:Math.ceil(a)}}function ss(e){let t=(e.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=t?Math.ceil(parseFloat(t[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function cs(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0),n=parseFloat(e.outlineOffset||"0")||0,r=t+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function us(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||t==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,a=0,s=!1;for(let c of n){s=!0;let l=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(h=>parseFloat(h))||[],[u=0,d=0,f=0]=l,m=Math.abs(u)+f,g=Math.abs(d)+f;i=Math.max(i,m+Math.max(u,0)),a=Math.max(a,m+Math.max(-u,0)),o=Math.max(o,g+Math.max(d,0)),r=Math.max(r,g+Math.max(-d,0))}return{bleed:{top:A(r),right:A(i),bottom:A(o),left:A(a)},has:s}}function ds(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let s=Br(e);if(s.a===1&&s.b===0&&s.c===0&&s.d===1)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}function i(s,c,l,u){let d=Math.sqrt(s*s+c*c)||0,f=0,m=0;if(d>0){let g=s/d,h=c/d;f=g*l+h*u;let p=l-g*f,y=u-h*f;m=Math.sqrt(p*p+y*y)||0,m>0?f=f/m:f=0}return{a:d,b:0,c:f*m,d:m}}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let s=o[1].split(",").map(c=>parseFloat(c.trim()));if(s.length===6&&s.every(Number.isFinite)){let[c,l,u,d]=s,f=i(c,l,u,d);try{t.style.transform=`matrix(${f.a}, ${f.b}, ${f.c}, ${f.d}, 0, 0)`}catch{}return f}}let a=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(a){let s=a[1].split(",").map(c=>parseFloat(c.trim()));if(s.length===16&&s.every(Number.isFinite)){let c=s[0],l=s[1],u=s[4],d=s[5],f=i(c,l,u,d);try{t.style.transform=`matrix(${f.a}, ${f.b}, ${f.c}, ${f.d}, 0, 0)`}catch{}return f}}try{let s=new DOMMatrix(r),c=i(s.a,s.b,s.c,s.d);try{t.style.transform=`matrix(${c.a}, ${c.b}, ${c.c}, ${c.d}, 0, 0)`}catch{}return c}catch{return null}}function ur(e,t,n,r,i){let o=n.a,a=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(y,x){let b=y-r,w=x-i,S=o*b+s*w,C=a*b+c*w;return S+=r+l,C+=i+u,[S,C]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],m=1/0,g=1/0,h=-1/0,p=-1/0;for(let[y,x]of f)y<m&&(m=y),x<g&&(g=x),y>h&&(h=y),x>p&&(p=x);return{minX:m,minY:g,maxX:h,maxY:p,width:h-m,height:p-g}}function fs(e,t,n){let r=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],a=(s,c)=>{let l=s.toLowerCase();return l==="left"||l==="top"?0:l==="center"?c/2:l==="right"||l==="bottom"?c:l.endsWith("px")?parseFloat(l)||0:l.endsWith("%")?(parseFloat(l)||0)*c/100:/^-?\d+(\.\d+)?$/.test(l)&&parseFloat(l)||0};return{ox:a(i,t),oy:a(o,n)}}function ms(e){let t={rotate:"0deg",scale:null,translate:null},n=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(n){let i=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},o=i("rotate");if(o)if(o.angle){let c=o.angle;t.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.unit}else o.unit?t.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:t.rotate=String(o);else{let c=getComputedStyle(e);t.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let a=i("scale");if(a){let c="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,l="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:c;t.scale=`${c} ${l}`}else{let c=getComputedStyle(e);t.scale=c.scale&&c.scale!=="none"?c.scale:null}let s=i("translate");if(s){let c="x"in s&&"value"in s.x?s.x.value:Array.isArray(s)?s[0]?.value:0,l="y"in s&&"value"in s.y?s.y.value:Array.isArray(s)?s[1]?.value:0,u="x"in s&&s.x?.unit?s.x.unit:"px",d="y"in s&&s.y?.unit?s.y.unit:"px";t.translate=`${c}${u} ${l}${d}`}else{let c=getComputedStyle(e);t.translate=c.translate&&c.translate!=="none"?c.translate:null}return t}let r=getComputedStyle(e);return t.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",t.scale=r.scale&&r.scale!=="none"?r.scale:null,t.translate=r.translate&&r.translate!=="none"?r.translate:null,t}var Ht=null;function ps(){if(Ht)return Ht;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),Ht=e,e}function hs(e){let t=ps(),n=document.createElement("div");n.style.transformOrigin="0 0",e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let r=Br(n);return t.removeChild(n),r}function gs(e){let t=getComputedStyle(e),n=t.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let r=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",i=t.scale&&t.scale!=="none"&&t.scale!=="1",o=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(r||i||o)}function Br(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}async function Wr(e,t){if(!e)throw new Error("Element cannot be null or undefined");Oi(t.cache);let n=t.fast,r=t.outerTransforms!==!1,i=!!t.outerShadows,o={element:e,options:t,plugins:t.plugins},a,s,c,l="",u="",d,f,m=null;await we("beforeSnap",o),await we("beforeClone",o);let g=Ol(o.element);try{({clone:a,classCSS:s,styleCache:c}=await Rl(o.element,o.options)),!r&&a&&(m=ds(o.element,a)),!i&&a&&Xl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:s,styleCache:c,...o},await we("afterClone",o),Jl(o.clone),o.options?.excludeMode==="remove")try{ts(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await el(o.clone,o.element)}catch{}await new Promise(b=>{_e(async()=>{await Il(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{_e(async()=>{await Dl(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),t.embedFonts&&await new Promise(b=>{_e(async()=>{let w=Pr(o.element),S=yl(o.element);if(Ce()){let C=new Set(Array.from(w).map(v=>String(v).split("__")[0]).filter(Boolean));await Fr(C,1)}l=await gl({required:w,usedCodepoints:S,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),b()},{fast:n})});let h=Gi(o.clone).sort(),p=h.join(",");M.baseStyle.has(p)?u=M.baseStyle.get(p):await new Promise(b=>{_e(()=>{u=Ki(h),M.baseStyle.set(p,u),b()},{fast:n})});let y=as(o.element?.ownerDocument||document);o={fontsCSS:l,baseCSS:u,scrollbarCSS:y,...o},await we("beforeRender",o),await new Promise(b=>{_e(()=>{let w=pe(o.element),S=o.element.getBoundingClientRect(),C=Math.max(1,A(o.element.offsetWidth||parseFloat(w.width)||S.width||1)),v=Math.max(1,A(o.element.offsetHeight||parseFloat(w.height)||S.height||1)),k=o.element.ownerDocument||document;if(o.element===k.body||o.element===k.documentElement){let Y=Math.max(o.element.scrollHeight||0,k.documentElement?.scrollHeight||0,k.body?.scrollHeight||0),z=Math.max(o.element.scrollWidth||0,k.documentElement?.scrollWidth||0,k.body?.scrollWidth||0);Y>0&&(v=Math.max(v,A(Y))),z>0&&(C=Math.max(C,A(z)));try{let se=(o.scrollbarCSS||"").length+(o.baseCSS||"").length+(o.fontsCSS||"").length+(o.classCSS||"").length,ce=M.measureHints.get(o.element);if(ce&&ce.cssLen===se&&ce.w0===C)ce.csh>0&&(v=Math.max(v,A(ce.csh))),ce.csw>0&&(C=Math.max(C,A(ce.csw)));else{let ue=k.createElement("div");ue.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+C+"px!important;overflow:visible!important;visibility:hidden!important;";let et=k.createElement("style");et.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,ue.appendChild(et),ue.appendChild(o.clone.cloneNode(!0)),k.body.appendChild(ue);let ye=ue.scrollHeight,At=ue.scrollWidth;k.body.removeChild(ue),M.measureHints.set(o.element,{cssLen:se,w0:C,csh:ye,csw:At}),ye>0&&(v=Math.max(v,A(ye))),At>0&&(C=Math.max(C,A(At)))}}catch{}}if(o.options?.excludeMode==="remove"){let Y=os(o.element,o.options);Number.isFinite(Y)&&Y>0&&(v=Math.max(1,Math.min(v,A(Y+1))))}let N=(Y,z=NaN)=>{let se=typeof Y=="string"?parseFloat(Y):Y;return Number.isFinite(se)?se:z},B=N(o.options.width),D=N(o.options.height),L=C,$=v,O=Number.isFinite(B),U=Number.isFinite(D),G=v>0?C/v:1;O&&U?(L=Math.max(1,A(B)),$=Math.max(1,A(D))):O?(L=Math.max(1,A(B)),$=Math.max(1,A(L/(G||1)))):U?($=Math.max(1,A(D)),L=Math.max(1,A($*(G||1)))):(L=C,$=v);let T=0,_=0,P=C,R=v;if(!r&&m&&Number.isFinite(m.a)){let Y={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},z=ur(C,v,Y,0,0);T=A(z.minX),_=A(z.minY),P=A(z.maxX),R=A(z.maxY)}else if(r&&dr(o.element)){let Y=w.transform&&w.transform!=="none"?w.transform:"",z=ms(o.element),se=hs({baseTransform:Y,rotate:z.rotate||"0deg",scale:z.scale,translate:z.translate}),{ox:ce,oy:ue}=fs(w,C,v),et=se.is2D?se:new DOMMatrix(se.toString()),ye=ur(C,v,et,ce,ue);T=A(ye.minX),_=A(ye.minY),P=A(ye.maxX),R=A(ye.maxY)}let K=ls(w),W=ss(w),q=cs(w),j=us(w),V=i?{top:A(K.top+W.top+q.top+j.bleed.top),right:A(K.right+W.right+q.right+j.bleed.right),bottom:A(K.bottom+W.bottom+q.bottom+j.bleed.bottom),left:A(K.left+W.left+q.left+j.bleed.left)}:{top:0,right:0,bottom:0,left:0};T=A(T-V.left),_=A(_-V.top),P=A(P+V.right),R=A(R+V.bottom);let J=Math.max(1,A(P-T)),Z=Math.max(1,A(R-_)),le=O||U?A(L/C):1,Ze=U||O?A($/v):1,ti=Math.max(1,A(J*le)),ni=Math.max(1,A(Z*Ze)),wn="http://www.w3.org/2000/svg",ri=Ce()&&dr(o.element)?1:0,he=A(ri+(r?0:1)),ge=document.createElementNS(wn,"foreignObject"),oi=A(T),ii=A(_);ge.setAttribute("x",String(A(-(oi-he)))),ge.setAttribute("y",String(A(-(ii-he)))),ge.setAttribute("width",String(A(C+he*2))),ge.setAttribute("height",String(A(v+he*2))),ge.style.overflow="visible";let bn=document.createElement("style"),ai='svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject *{min-width:0;} foreignObject pre,foreignObject [style*="white-space"]{white-space:inherit;}';bn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+ai+o.classCSS,ge.appendChild(bn);let Qe=document.createElement("div");Qe.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Qe.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${A(C)}px;height:${A(v)}px`,Qe.appendChild(o.clone),ge.appendChild(Qe);let li=new XMLSerializer().serializeToString(ge),Mt=A(J+he*2),kt=A(Z+he*2),vn=O||U;t.meta={w0:C,h0:v,vbW:Mt,vbH:kt,targetW:L,targetH:$};let si=Ce()&&vn?Mt:A(ti+he*2),ci=Ce()&&vn?kt:A(ni+he*2),ui=parseFloat(pe(k.documentElement)?.fontSize)||16;f=`<svg xmlns="${wn}" width="${si}" height="${ci}" viewBox="0 0 ${Mt} ${kt}" font-size="${ui}px">`+li+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,o={svgString:f,dataURL:d,...o},b()},{fast:n})}),await we("afterRender",o);let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),o.dataURL}function dr(e){return gs(e)}re();function ys(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=Di(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null}}Ve();br();ie();Pe();re();function ws(...e){return jl(...e),I}var I=Object.assign(vs,{plugins:ws}),Ur=Symbol("snapdom.internal"),bs=Symbol("snapdom.internal.silent"),fr=!1;async function vs(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=ys(t);if(zl(n,t&&t.plugins),Ce()&&(n.embedFonts===!0||Ss(e))){if(n.embedFonts)try{let i=Pr(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await Fr(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await xs(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&za(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>I.toPng(r,i),toSvg:(r,i)=>I.toSvg(r,i)}),I.capture(e,n,Ur)}I.capture=async(e,t,n)=>{if(n!==Ur)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Wr(e,t),i={img:async(h,p)=>{let{toImg:y}=await Promise.resolve().then(()=>(Vn(),qt));return y(r,{...h,...p||{}})},svg:async(h,p)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Vn(),qt));return y(r,{...h,...p||{}})},canvas:async(h,p)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(mt(),vr));return y(r,{...h,...p||{}})},blob:async(h,p)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Mr(),Er));return y(r,{...h,...p||{}})},png:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(it(),ot));return y(r,{...h,...p||{},format:"png"})},jpeg:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(it(),ot));return y(r,{...h,...p||{},format:"jpeg"})},webp:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(it(),ot));return y(r,{...h,...p||{},format:"webp"})},download:async(h,p)=>{let{download:y}=await Promise.resolve().then(()=>(da(),kr));return y(r,{...h,...p||{}})}},o={};for(let h of["img","svg","canvas","blob","png","jpeg","webp"])o[h]=async p=>i[h](t,{...p||{},[bs]:!0});o.jpg=o.jpeg;let a={...t,export:{url:r},exports:o},s=await Yl("defineExports",a),c=Object.assign({},...s.filter(h=>h&&typeof h=="object")),l={...i,...c};l.jpeg&&!l.jpg&&(l.jpg=(h,p)=>l.jpeg(h,p));function u(h,p){let y={...t,...p||{}};return(h==="jpeg"||h==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,f=Promise.resolve();async function m(h,p){let y=async()=>{let x=l[h];if(!x)throw new Error(`[snapdom] Unknown export type: ${h}`);let b=u(h,p),w={...t,export:{type:h,options:b,url:r}};await we("beforeExport",w);let S=await x(w,b);return await we("afterExport",w,S),d||(d=!0,await we("afterSnap",t)),S};return f=f.then(y)}let g={url:r,toRaw:()=>r,to:(h,p)=>m(h,p),toImg:h=>m("img",h),toSvg:h=>m("svg",h),toCanvas:h=>m("canvas",h),toBlob:h=>m("blob",h),toPng:h=>m("png",h),toJpg:h=>m("jpg",h),toWebp:h=>m("webp",h),download:h=>m("download",h)};for(let h of Object.keys(l)){let p="to"+h.charAt(0).toUpperCase()+h.slice(1);g[p]||(g[p]=y=>m(h,y))}return g};I.toRaw=(e,t)=>I(e,t).then(n=>n.toRaw());I.toImg=(e,t)=>I(e,t).then(n=>n.toImg());I.toSvg=(e,t)=>I(e,t).then(n=>n.toSvg());I.toCanvas=(e,t)=>I(e,t).then(n=>n.toCanvas());I.toBlob=(e,t)=>I(e,t).then(n=>n.toBlob());I.toPng=(e,t)=>I(e,{...t,format:"png"}).then(n=>n.toPng());I.toJpg=(e,t)=>I(e,{...t,format:"jpeg"}).then(n=>n.toJpg());I.toWebp=(e,t)=>I(e,{...t,format:"webp"}).then(n=>n.toWebp());I.download=(e,t)=>I(e,t).then(n=>n.download());async function xs(e,t){if(fr)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Wr(e,n)}catch(i){F(t,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),r&&await new Promise(i=>{let o=new Image;try{o.decoding="sync",o.loading="eager"}catch(a){F(t,"safariWarmup img hints failed",a)}o.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",o.src=r,document.body.appendChild(o),(async()=>{try{typeof o.decode=="function"&&await o.decode()}catch(s){F(t,"safariWarmup img.decode failed",s)}let a=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-a<900;)await new Promise(s=>setTimeout(s,200));await new Promise(s=>requestAnimationFrame(s));try{let s=document.createElement("canvas");s.width=Math.max(1,o.naturalWidth||10),s.height=Math.max(1,o.naturalHeight||10);let c=s.getContext("2d");c&&c.drawImage(o,0,0)}catch{}await new Promise(s=>requestAnimationFrame(s));try{o.remove()}catch(s){F(t,"safariWarmup img.remove failed",s)}i()})()}),e.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){F(t,"safariWarmup canvas poke failed",o)}}),fr=!0}function Ss(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let n=t.currentNode,r=getComputedStyle(n),i=r.backgroundImage&&r.backgroundImage!=="none",o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(i||o||n.tagName==="CANVAS")return!0}return!1}function qr(e){if(e.dataset.fontProxied||!e.rel||!e.rel.includes("stylesheet"))return!1;let t=e.href||"";try{return new URL(t).origin!==window.location.origin}catch{return!1}}function jr(e){let t=`/__mindstudio_dev__/font-proxy?url=${encodeURIComponent(e.href)}`,n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.fontProxied="true",e.media&&(n.media=e.media),n.onload=()=>{e.remove()},n.onerror=()=>{n.remove()},e.parentNode?.insertBefore(n,e.nextSibling)}function Yr(){let e=document.querySelectorAll('link[rel~="stylesheet"]');for(let t of e)qr(t)&&jr(t)}function Es(){let e=E().fonts;e.observer||(e.observer=new MutationObserver(t=>{for(let n of t)for(let r of n.addedNodes)r instanceof HTMLLinkElement&&qr(r)&&jr(r)}),e.observer.observe(document.documentElement,{childList:!0,subtree:!0}))}function Cs(e){try{let t=new URL(e,window.location.origin);return t.origin===window.location.origin?!1:!!(/\.(css|woff2?|ttf|otf|eot)(\?|$)/i.test(t.pathname)||t.pathname.includes("/css"))}catch{return!1}}function Ms(){if(window.fetch.__ms_font_proxied)return;let e=window.fetch;window.fetch=function(t,n){let r=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(Cs(r)){let i=`/__mindstudio_dev__/font-proxy?url=${encodeURIComponent(r)}`;return e.apply(this,[i,n])}return e.apply(this,[t,n])},window.fetch.__ms_font_proxied=!0}function Vr(){let e=E().fonts;e.initialized||(e.initialized=!0,Ms(),Yr(),Es())}async function zr(){Yr();try{await document.fonts.ready}catch{}}var Xr="__mindstudio-touch-circle",rn="__mindstudio-touch-style",Gr=44,Kr=5,Jr=.95,pt=.5,on=.45,Zr=600;function ks(){document.getElementById(Xr)?.remove();let e=document.createElement("div");return e.id=Xr,e.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none",`width: ${Gr}px`,`height: ${Gr}px`,"border-radius: 50%","background: rgba(255, 255, 255, 0.08)","border: 2px solid rgba(255, 255, 255, 0.85)","box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 0 0.5px rgba(0, 0, 0, 0.1)","backdrop-filter: blur(1px)","-webkit-backdrop-filter: blur(1.5px)","transform: translate(-50%, -50%) scale(1)","transition: transform 100ms ease, opacity 100ms ease, background 100ms ease","opacity: 0","will-change: left, top, transform, opacity"].join("; "),document.documentElement.appendChild(e),e}function As(e){e.style.transform="translate(-50%, -50%) scale(0.88)",e.style.background="rgba(255, 255, 255, 0.18)"}function Qr(e){e.style.transform="translate(-50%, -50%) scale(1)",e.style.background="rgba(255, 255, 255, 0.08)"}function eo(){window.location.search.includes("mode=iframe")&&E().zoom.mobilePreview&&ln()}function ln(){let e=E().touch;if(e.active)return;e.active=!0,e.scrollContainer=Se(),Ns();let t=ks();e.circleEl=t,e.onMouseMove=n=>{let r=E();if(r.cursor.executing||r.screenshot.capturing){t.style.opacity="0";return}if(t.style.left=`${n.clientX}px`,t.style.top=`${n.clientY}px`,t.style.opacity="1",e.pressed){let i=Math.abs(n.clientX-e.startX),o=Math.abs(n.clientY-e.startY);if(!e.dragging&&(i>Kr||o>Kr)&&(e.dragging=!0),e.dragging){let a=e.scrollContainer||document.documentElement,s=performance.now(),c=s-e.lastMoveTime||16,l=e.lastX-n.clientX,u=e.lastY-n.clientY;e.bouncing&&Ts();let d=a.scrollTop;a.scrollTop+=u,a.scrollLeft+=l;let m=a.scrollTop-d,g=u-m;if(Math.abs(g)>.5){let h=on/(1+Math.abs(e.overscrollY)/200);e.overscrollY+=g*h,an()}else if(e.overscrollY!==0){let h=on/(1+Math.abs(e.overscrollY)/200);e.overscrollY+=g*h,(e.overscrollY>0&&u<0||e.overscrollY<0&&u>0)&&(e.overscrollY*=.7),an()}e.velocityX=.8*(l/c)+.2*e.velocityX,e.velocityY=.8*(u/c)+.2*e.velocityY,e.lastMoveTime=s,n.preventDefault()}e.lastX=n.clientX,e.lastY=n.clientY}},e.onMouseDown=n=>{E().cursor.executing||(ht(),e.pressed=!0,e.dragging=!1,e.startX=n.clientX,e.startY=n.clientY,e.lastX=n.clientX,e.lastY=n.clientY,e.velocityX=0,e.velocityY=0,e.lastMoveTime=performance.now(),As(t))},e.onMouseUp=()=>{let n=e.dragging;n&&document.addEventListener("click",$s,{capture:!0,once:!0}),e.pressed=!1,e.dragging=!1,Qr(t),n&&(e.overscrollY!==0&&oo(),(Math.abs(e.velocityX)>pt/16||Math.abs(e.velocityY)>pt/16)&&Ls())},e.onMouseLeave=()=>{e.pressed=!1,e.dragging=!1,ht(),t.style.opacity="0",Qr(t)},e.onDragStart=n=>n.preventDefault(),document.addEventListener("mousemove",e.onMouseMove),document.addEventListener("mousedown",e.onMouseDown),document.addEventListener("mouseup",e.onMouseUp),document.addEventListener("mouseleave",e.onMouseLeave),document.addEventListener("dragstart",e.onDragStart)}function to(){let e=E().touch;e.active&&(e.active=!1,e.pressed=!1,e.dragging=!1,ht(),e.overscrollY!==0&&(e.overscrollY=0,document.body.style.transition="",document.body.style.transform=""),_s(),e.circleEl&&(e.circleEl.remove(),e.circleEl=null),e.onMouseMove&&document.removeEventListener("mousemove",e.onMouseMove),e.onMouseDown&&document.removeEventListener("mousedown",e.onMouseDown),e.onMouseUp&&document.removeEventListener("mouseup",e.onMouseUp),e.onMouseLeave&&document.removeEventListener("mouseleave",e.onMouseLeave),e.onDragStart&&document.removeEventListener("dragstart",e.onDragStart),e.onMouseMove=null,e.onMouseDown=null,e.onMouseUp=null,e.onMouseLeave=null,e.onDragStart=null)}function no(){let{circleEl:e}=E().touch;e&&(e.style.opacity="0")}function ro(){let e=E().touch;e.active&&e.circleEl&&(e.circleEl.style.opacity="1")}function $s(e){e.preventDefault(),e.stopPropagation()}function Ls(){ht();let e=E().touch,t=e.scrollContainer||document.documentElement,n=e.velocityX*16,r=e.velocityY*16;function i(){let o=E().touch;if(n*=Jr,r*=Jr,Math.abs(n)<pt&&Math.abs(r)<pt){o.momentumFrame=null,o.overscrollY!==0&&oo();return}let a=t.scrollTop;t.scrollTop+=r,t.scrollLeft+=n;let s=t.scrollTop-a,c=r-s;if(Math.abs(c)>.5){let l=on*.5/(1+Math.abs(o.overscrollY)/200);o.overscrollY+=c*l,an(),r*=.7}o.momentumFrame=requestAnimationFrame(i)}e.momentumFrame=requestAnimationFrame(i)}function ht(){let e=E().touch;e.momentumFrame!==null&&(cancelAnimationFrame(e.momentumFrame),e.momentumFrame=null)}function an(){let e=E().touch;document.body.style.transition="none",document.body.style.transform=`translateY(${-e.overscrollY}px)`}function oo(){let e=E().touch;e.bouncing=!0,e.overscrollY=0,document.body.style.transition=`transform ${Zr}ms cubic-bezier(0.2, 0.9, 0.3, 1)`,document.body.style.transform="",e.bounceTimer&&clearTimeout(e.bounceTimer),e.bounceTimer=setTimeout(()=>{let t=E().touch;t.bouncing=!1,t.bounceTimer=null,document.body.style.transition="",document.body.style.transform=""},Zr)}function Ts(){let e=E().touch;e.bouncing&&(e.bouncing=!1,e.bounceTimer&&(clearTimeout(e.bounceTimer),e.bounceTimer=null),document.body.style.transition="")}function Ns(){document.getElementById(rn)?.remove();let e=document.createElement("style");e.id=rn,e.textContent=`
10
10
  *, *::before, *::after {
11
11
  cursor: none !important;
12
12
  user-select: none !important;
13
13
  -webkit-user-select: none !important;
14
14
  -webkit-user-drag: none !important;
15
15
  }
16
- `,document.head.appendChild(e)}function Rs(){document.getElementById(rn)?.remove()}var oo="__mindstudio-cursor",_s="__mindstudio-cursor-ripple",io=.07,Ps=250,gt=300,Fs=2e3,ht=10,ao=1,so="Remy",Fe="#DD2590",sn=44,Ds=`<svg width="40" height="41" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
16
+ `,document.head.appendChild(e)}function _s(){document.getElementById(rn)?.remove()}var io="__mindstudio-cursor",Rs="__mindstudio-cursor-ripple",ao=.07,Ps=250,yt=300,Fs=2e3,gt=10,lo=1,co="Remy",Fe="#DD2590",sn=44,Is=`<svg width="40" height="41" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
17
17
  <g filter="url(#filter0_d_4_78)">
18
18
  <path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${Fe}"/>
19
19
  <path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${Fe}"/>
@@ -30,8 +30,8 @@ ${h}
30
30
  <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_4_78" result="shape"/>
31
31
  </filter>
32
32
  </defs>
33
- </svg>`,co=`
34
- ${Ds}
33
+ </svg>`,uo=`
34
+ ${Is}
35
35
  <div style="
36
36
  position: absolute;
37
37
  left: 33px;
@@ -47,8 +47,8 @@ ${h}
47
47
  white-space: nowrap;
48
48
  letter-spacing: 0.3px;
49
49
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
50
- ">${so}</div>
51
- `,uo=`
50
+ ">${co}</div>
51
+ `,fo=`
52
52
  <div style="
53
53
  width: ${sn}px;
54
54
  height: ${sn}px;
@@ -73,8 +73,8 @@ ${h}
73
73
  border-radius: 4px;
74
74
  white-space: nowrap;
75
75
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
76
- ">${so}</div>
77
- `;function lo(e,t,n){return e+(t-e)*n}function fo(){window.location.search.includes("mode=iframe")&&mo()}function mo(){if(document.getElementById(oo))return;let e=E().cursor,t=E().zoom.mobilePreview,n=document.createElement("div");n.id=oo,n.innerHTML=t?uo:co,n.style.cssText=["position: fixed","top: -100px","left: -100px","z-index: 2147483647","pointer-events: none","will-change: left, top, transform, opacity","opacity: 0"].join("; ");let r=document.createElement("div");r.id=_s,r.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${Fe}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.documentElement.appendChild(r),document.documentElement.appendChild(n),e.el=n,e.rippleEl=r}function Is(){E().cursor.trackingFrame===null&&ho()}function po(){let e=E().cursor;e.trackingFrame!==null&&(cancelAnimationFrame(e.trackingFrame),e.trackingFrame=null),e.targetElement=null}function ho(){let e=E().cursor;if(e.el){if(e.targetElement&&e.targetElement.isConnected){let t=e.targetElement.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i=window.innerWidth,o=window.innerHeight,a=Math.max(ht,Math.min(n,i-ht)),s=Math.max(ht,Math.min(r,o-ht));if(e.x=lo(e.x,a,io),e.y=lo(e.y,s,io),e.el.style.transition="none",e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,Math.abs(e.x-a)<ao&&Math.abs(e.y-s)<ao&&(e.x=a,e.y=s,e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,e.settledResolve)){let c=e.settledResolve;e.settledResolve=null,c()}}else if(e.targetElement&&!e.targetElement.isConnected){if(e.settledResolve){let t=e.settledResolve;e.settledResolve=null,t()}e.targetElement=null,e.trackingFrame=null;return}else if(!e.targetElement){e.trackingFrame=null;return}e.trackingFrame=requestAnimationFrame(ho)}}async function yt(e){let t=E().cursor;if(t.el){if(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.settledResolve){let n=t.settledResolve;t.settledResolve=null,n()}if(t.targetElement=e,!t.hasPosition){let n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2,o=Math.max(window.innerWidth,100),a=Math.max(window.innerHeight,100);Math.random()<.5?(t.x=o+20,t.y=i+(Math.random()-.5)*100):(t.x=r+(Math.random()-.5)*100,t.y=a+20),t.el.style.transition="none",t.el.style.left=`${t.x}px`,t.el.style.top=`${t.y}px`,t.el.style.opacity="0",t.el.offsetWidth,t.hasPosition=!0}return t.visibilityState==="fading-out"?be("visible"):yo(t.visibilityState)||(be("fading-in"),await O(gt),t.visibilityState==="fading-in"&&(t.visibilityState="visible")),Is(),new Promise(n=>{t.settledResolve=n})}}async function go(){let e=E().cursor;e.el&&(e.el.style.transform="scale(0.85) translateY(1px)",e.rippleEl&&(e.rippleEl.style.transition="none",e.rippleEl.style.left=`${e.x}px`,e.rippleEl.style.top=`${e.y}px`,e.rippleEl.style.width="0",e.rippleEl.style.height="0",e.rippleEl.style.opacity="0.35",e.rippleEl.offsetWidth,e.rippleEl.style.transition="width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out",e.rippleEl.style.width="40px",e.rippleEl.style.height="40px",e.rippleEl.style.opacity="0"),await O(Ps),e.el&&(e.el.style.transform="scale(1) translateY(0)"),await O(100))}function yo(e){return e==="visible"||e==="fading-in"||e==="fading-out"||e==="force-visible"}function be(e){let t=E().cursor;if(t.visibilityState=e,!!t.el)switch(e){case"hidden":case"force-hidden":case"snapshot-hidden":t.el.style.transition="none",t.el.style.opacity="0",t.rippleEl&&(t.rippleEl.style.opacity="0");break;case"fading-in":t.el.style.transition=`opacity ${gt}ms ease`,t.el.offsetWidth,t.el.style.opacity="1";break;case"visible":case"force-visible":t.el.style.opacity="1";break;case"fading-out":t.el.style.transition=`opacity ${gt}ms ease`,t.el.style.opacity="0";break}}function ze(){let e=E().cursor;e.hideTimer&&(clearTimeout(e.hideTimer),e.hideTimer=null)}function Xe(e){E().cursor.executing=e,e?to():no()}function cn(){ze()}function wt(){let e=E().cursor;e.el&&e.visibilityState!=="force-visible"&&(e.targetElement=null,ze(),e.hideTimer=setTimeout(()=>{e.visibilityState!=="force-visible"&&(be("fading-out"),e.hideTimer=setTimeout(()=>{e.visibilityState==="fading-out"&&(be("hidden"),po()),e.hideTimer=null},gt))},Fs))}function wo(){let e=E().cursor;e.visibilityState!=="snapshot-hidden"&&(ze(),e.preSnapshotState=e.visibilityState,be("snapshot-hidden"))}function bo(){let e=E().cursor,t=e.preSnapshotState;e.preSnapshotState=null,!(!e.el||!t||!yo(t))&&be(t==="fading-in"?"fading-in":"visible")}function un(e){let t=E().cursor;t.el&&(t.el.innerHTML=e?uo:co)}function bt(e){let t=E().cursor;t.executing||(e==="visible"&&!t.el&&mo(),t.el&&(e==="visible"?(ze(),t.hasPosition?be("force-visible"):t.visibilityState="force-visible"):e==="hidden"?(ze(),be("force-hidden"),po()):wt()))}var Hs=750,Os=400,Me=2,So=["#__mindstudio-cursor","#__mindstudio-cursor-ripple","#__mindstudio-notes-cursor","#__mindstudio-camera","#__mindstudio-flash","#__mindstudio-touch-circle"],Bs="#DD2590",Ws=`<svg width="44" height="44" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
76
+ ">${co}</div>
77
+ `;function so(e,t,n){return e+(t-e)*n}function mo(){window.location.search.includes("mode=iframe")&&po()}function po(){if(document.getElementById(io))return;let e=E().cursor,t=E().zoom.mobilePreview,n=document.createElement("div");n.id=io,n.innerHTML=t?fo:uo,n.style.cssText=["position: fixed","top: -100px","left: -100px","z-index: 2147483647","pointer-events: none","will-change: left, top, transform, opacity","opacity: 0"].join("; ");let r=document.createElement("div");r.id=Rs,r.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${Fe}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.documentElement.appendChild(r),document.documentElement.appendChild(n),e.el=n,e.rippleEl=r}function Ds(){E().cursor.trackingFrame===null&&go()}function ho(){let e=E().cursor;e.trackingFrame!==null&&(cancelAnimationFrame(e.trackingFrame),e.trackingFrame=null),e.targetElement=null}function go(){let e=E().cursor;if(e.el){if(e.targetElement&&e.targetElement.isConnected){let t=e.targetElement.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i=window.innerWidth,o=window.innerHeight,a=Math.max(gt,Math.min(n,i-gt)),s=Math.max(gt,Math.min(r,o-gt));if(e.x=so(e.x,a,ao),e.y=so(e.y,s,ao),e.el.style.transition="none",e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,Math.abs(e.x-a)<lo&&Math.abs(e.y-s)<lo&&(e.x=a,e.y=s,e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,e.settledResolve)){let c=e.settledResolve;e.settledResolve=null,c()}}else if(e.targetElement&&!e.targetElement.isConnected){if(e.settledResolve){let t=e.settledResolve;e.settledResolve=null,t()}e.targetElement=null,e.trackingFrame=null;return}else if(!e.targetElement){e.trackingFrame=null;return}e.trackingFrame=requestAnimationFrame(go)}}async function wt(e){let t=E().cursor;if(t.el){if(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.settledResolve){let n=t.settledResolve;t.settledResolve=null,n()}if(t.targetElement=e,!t.hasPosition){let n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2,o=Math.max(window.innerWidth,100),a=Math.max(window.innerHeight,100);Math.random()<.5?(t.x=o+20,t.y=i+(Math.random()-.5)*100):(t.x=r+(Math.random()-.5)*100,t.y=a+20),t.el.style.transition="none",t.el.style.left=`${t.x}px`,t.el.style.top=`${t.y}px`,t.el.style.opacity="0",t.el.offsetWidth,t.hasPosition=!0}return t.visibilityState==="fading-out"?be("visible"):wo(t.visibilityState)||(be("fading-in"),await H(yt),t.visibilityState==="fading-in"&&(t.visibilityState="visible")),Ds(),new Promise(n=>{t.settledResolve=n})}}async function yo(){let e=E().cursor;e.el&&(e.el.style.transform="scale(0.85) translateY(1px)",e.rippleEl&&(e.rippleEl.style.transition="none",e.rippleEl.style.left=`${e.x}px`,e.rippleEl.style.top=`${e.y}px`,e.rippleEl.style.width="0",e.rippleEl.style.height="0",e.rippleEl.style.opacity="0.35",e.rippleEl.offsetWidth,e.rippleEl.style.transition="width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out",e.rippleEl.style.width="40px",e.rippleEl.style.height="40px",e.rippleEl.style.opacity="0"),await H(Ps),e.el&&(e.el.style.transform="scale(1) translateY(0)"),await H(100))}function wo(e){return e==="visible"||e==="fading-in"||e==="fading-out"||e==="force-visible"}function be(e){let t=E().cursor;if(t.visibilityState=e,!!t.el)switch(e){case"hidden":case"force-hidden":case"snapshot-hidden":t.el.style.transition="none",t.el.style.opacity="0",t.rippleEl&&(t.rippleEl.style.opacity="0");break;case"fading-in":t.el.style.transition=`opacity ${yt}ms ease`,t.el.offsetWidth,t.el.style.opacity="1";break;case"visible":case"force-visible":t.el.style.opacity="1";break;case"fading-out":t.el.style.transition=`opacity ${yt}ms ease`,t.el.style.opacity="0";break}}function ze(){let e=E().cursor;e.hideTimer&&(clearTimeout(e.hideTimer),e.hideTimer=null)}function Xe(e){E().cursor.executing=e,e?no():ro()}function cn(){ze()}function bt(){let e=E().cursor;e.el&&e.visibilityState!=="force-visible"&&(e.targetElement=null,ze(),e.hideTimer=setTimeout(()=>{e.visibilityState!=="force-visible"&&(be("fading-out"),e.hideTimer=setTimeout(()=>{e.visibilityState==="fading-out"&&(be("hidden"),ho()),e.hideTimer=null},yt))},Fs))}function bo(){let e=E().cursor;e.visibilityState!=="snapshot-hidden"&&(ze(),e.preSnapshotState=e.visibilityState,be("snapshot-hidden"))}function vo(){let e=E().cursor,t=e.preSnapshotState;e.preSnapshotState=null,!(!e.el||!t||!wo(t))&&be(t==="fading-in"?"fading-in":"visible")}function un(e){let t=E().cursor;t.el&&(t.el.innerHTML=e?fo:uo)}function vt(e){let t=E().cursor;t.executing||(e==="visible"&&!t.el&&po(),t.el&&(e==="visible"?(ze(),t.hasPosition?be("force-visible"):t.visibilityState="force-visible"):e==="hidden"?(ze(),be("force-hidden"),ho()):bt()))}var Os=750,Hs=400,Me=2,Eo=["#__mindstudio-cursor","#__mindstudio-cursor-ripple","#__mindstudio-notes-cursor","#__mindstudio-camera","#__mindstudio-flash","#__mindstudio-touch-circle"],Bs="#DD2590",Ws=`<svg width="44" height="44" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
78
78
  <g filter="url(#filter0_d_2_302)">
79
79
  <path fill-rule="evenodd" clip-rule="evenodd" d="M6.5 21C4.57 21 3 19.43 3 17.5V10.5C3 8.57 4.57 7 6.5 7H7.5C7.966 7 8.387 6.49 8.605 6.053C9.239 4.786 10.028 4 12 4H16C17.972 4 18.761 4.786 19.395 6.053C19.613 6.49 20.034 7 20.5 7H21.5C23.43 7 25 8.57 25 10.5V17.5C25 19.43 23.43 21 21.5 21H6.5Z" fill="white"/>
80
80
  <path fill-rule="evenodd" clip-rule="evenodd" d="M14 18C11.238 18 9 15.762 9 13C9 10.238 11.238 8 14 8C16.762 8 19 10.238 19 13C19 15.762 16.762 18 14 18ZM21.5 8H20.5C19.5 8 18.816 7.132 18.5 6.5C18 5.5 17.5 5 16 5H14H12C10.5 5 10 5.5 9.5 6.5C9.184 7.132 8.5 8 7.5 8H6.5C5.119 8 4 9.119 4 10.5V17.5C4 18.881 5.119 20 6.5 20H21.5C22.881 20 24 18.881 24 17.5V10.5C24 9.119 22.881 8 21.5 8Z" fill="black"/>
@@ -108,7 +108,7 @@ ${h}
108
108
  white-space: nowrap;
109
109
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
110
110
  ">Remy</div>
111
- `,t.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none","opacity: 0","transition: opacity 300ms ease, left 600ms cubic-bezier(0.4, 0, 0, 1), top 600ms cubic-bezier(0.4, 0, 0, 1)","will-change: left, top, opacity"].join("; ");let n=document.createElement("div");n.id=fn,n.style.cssText=["position: fixed","top: 0","left: 0","width: 100vw","height: 100vh","background: white","opacity: 0","z-index: 2147483646","pointer-events: none","transition: opacity 600ms ease-out"].join("; "),document.documentElement.appendChild(n),document.documentElement.appendChild(t),e.cameraEl=t,e.flashEl=n}function qs(e,t){let{cameraEl:n}=E().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.opacity="1")}function xo(e,t){let{cameraEl:n}=E().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}async function js(){let{flashEl:e}=E().screenshot;e&&(e.style.transition="none",e.style.opacity="0.7",e.offsetWidth,e.style.transition="opacity 600ms ease-out",e.style.opacity="0",await O(600))}function Ys(){let{cameraEl:e}=E().screenshot;e&&(e.style.opacity="0")}function Vs(){let e=E().screenshot;document.getElementById(dn)?.remove(),document.getElementById(fn)?.remove(),e.cameraEl=null,e.flashEl=null}function zs(e,t,n){return new Promise(r=>{let i=e.scrollTop,o=t-i;if(Math.abs(o)<1){r();return}let a=Math.abs(o),c=Math.max(n,a/2),l=performance.now();function u(d){let f=d-l,m=Math.min(f/c,1),g=m<.5?4*m*m*m:1-Math.pow(-2*m+2,3)/2;e.scrollTop=i+o*g,m<1?requestAnimationFrame(u):r()}requestAnimationFrame(u)})}async function Ge(e){let t=E().screenshot;if(t.capturing)throw new Error("Screenshot already in progress");t.capturing=!0,wo();try{return await Xs(e)}finally{t.capturing=!1,bo()}}async function Xs(e){await Vr();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return await Ks(t,n);let r=Se(),i=r!==document.documentElement,o=r.scrollTop,a=r.style.scrollBehavior;r.style.scrollBehavior="auto",Us();try{let s=Math.random()<.5?t+30:-60,c=n*.3+Math.random()*n*.4;qs(s,c),await O(200);let l=t*.4+Math.random()*t*.15,u=n*.35+Math.random()*n*.15;xo(l,u),await O(700);let d=[],f=0,m=i?r.clientHeight:n,g=()=>i?r.scrollHeight:Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),h=50,p=g();for(;f<p&&d.length<h;){let k=d.length,N=g();if(N<=0){console.warn("[screenshot] skipping chunk \u2014 page height is 0");break}if(N-f<m*.05&&d.length>0)break;let I=N-m,L=Math.min(f,I);Math.abs(L-r.scrollTop)>1&&(await zs(r,L,Os),xo(l,u),await O(Hs)),js();let H=r.scrollTop,U=Math.min(m,N-H);if(U<=0){console.warn("[screenshot] skipping chunk \u2014 captureHeight is 0 (page may have shrunk)"),f+=m;continue}let G=i?r.getBoundingClientRect():null;try{let R=await(await D(document.body,{embedFonts:!0,exclude:So})).toCanvas({scale:1});if(R&&G){let P=R.width/t,_=R.width;if(k===0&&G.top>0){let J=Math.round(G.top*P),Z=document.createElement("canvas");Z.width=_,Z.height=J;let le=Z.getContext("2d");le&&(le.drawImage(R,0,0,_,J,0,0,_,J),d.push({y:0,canvas:Z}))}let K=Math.round(G.top*P),W=Math.round(U*P),q=document.createElement("canvas");q.width=_,q.height=W;let j=q.getContext("2d");j&&(j.drawImage(R,0,K,_,W,0,0,_,W),d.push({y:G.top+H,canvas:q}));let V=G.bottom;if(f+m>=p&&V<n){let J=Math.round(V*P),Z=R.height-J;if(Z>0){let le=document.createElement("canvas");le.width=_,le.height=Z;let Je=le.getContext("2d");Je&&(Je.drawImage(R,0,J,_,Z,0,0,_,Z),d.push({y:G.top+N,canvas:le}))}}}else if(R){let P=R.width/t,_=Math.round(H*P),K=Math.min(H+U,N),W=Math.round(K*P)-_,q=R.width,j=document.createElement("canvas");j.width=q,j.height=W;let V=j.getContext("2d");V&&(V.drawImage(R,0,_,q,W,0,0,q,W),d.push({y:H,canvas:j}))}}catch(T){console.error("[screenshot] snapdom capture failed for chunk",k,T)}f+=m}if(f<p&&console.warn(`[screenshot] page truncated \u2014 captured ${d.length} chunks but page is ${p}px tall`),d.length===0)throw new Error("Screenshot capture produced no image data");let y=d[0].canvas.width,x=0;for(let k of d)x+=k.canvas.height;let b=document.createElement("canvas");b.width=y,b.height=x;let w=b.getContext("2d");if(!w)throw new Error("Failed to create output canvas");let S=0;for(let k of d)w.drawImage(k.canvas,0,S),S+=k.canvas.height;let v=b.toDataURL("image/jpeg",1).replace(/^data:image\/jpeg;base64,/,"");if(!v)throw new Error("Canvas export produced no image data");return{image:v,width:b.width,height:b.height}}finally{Ys(),Vs(),r.style.scrollBehavior="auto",r.scrollTop=o,r.style.scrollBehavior=a}}function Gs(){let e=document.getElementById("__mindstudio-notes-overlay");if(!e)return null;let t=window.scrollX,n=window.scrollY,r=e.style.cssText;return e.style.position="absolute",e.style.inset="auto",e.style.left=`${t}px`,e.style.top=`${n}px`,e.style.width=`${window.innerWidth}px`,e.style.height=`${window.innerHeight}px`,()=>{e.style.cssText=r}}async function Ks(e,t){let n=Gs();try{let i=await(await D(document.body,{embedFonts:!0,exclude:So})).toCanvas({scale:Me});if(!i)throw new Error("SnapDOM viewport capture returned empty result");let o=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),a=document.createElement("canvas");a.width=e*Me,a.height=t*Me;let s=a.getContext("2d");if(!s)throw new Error("Failed to create canvas context");let c=window.scrollY/o*i.height,l=t/o*i.height;s.drawImage(i,0,c,i.width,l,0,0,e*Me,t*Me);let d=a.toDataURL("image/jpeg",1).replace(/^data:image\/jpeg;base64,/,"");if(!d)throw new Error("Canvas export produced no image data");return{image:d,width:e*Me,height:t*Me}}finally{n?.()}}var Js=["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 Zs(e,t){let n=t??Js;if(e.ref||e.text||e.role||e.label||e.selector){let{element:o,matched:a}=fe(e);return{...Eo(o,e.ref,n),matched:a}}let r=$e(),i=[];for(let[o,a]of r)a.isConnected&&i.push(Eo(a,o,n));return i}function Eo(e,t,n){let r=window.getComputedStyle(e),i={};t&&(i.ref=t),i.tag=e.tagName.toLowerCase();let o=e.textContent?.trim();o&&(i.text=o.length>60?o.slice(0,60)+"\u2026":o);for(let a of n){let s=r.getPropertyValue(a.replace(/([A-Z])/g,"-$1").toLowerCase());s&&(i[a]=s)}return i}var Co=150,xt=100,vt="__mindstudio_pending_nav",Mo=300,ko=1e4;function Qs(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 Ao(e){try{let t=new URL(e,window.location.origin);return t.origin!==window.location.origin?!1:(Qs(e)||(window.history.pushState(null,"",t.pathname+t.search+t.hash),window.dispatchEvent(new PopStateEvent("popstate"))),!0)}catch{return!1}}async function mn(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,i=Date.now(),o=Se(),a=window.scrollY,s=window.scrollX,c=document.body.scrollTop,l=document.documentElement.scrollTop,u=document.body.scrollHeight,d=document.body.scrollWidth,f=o.scrollTop,m=o.scrollLeft;function g(){if(Date.now()>r){n();return}let h=window.scrollY,p=window.scrollX,y=document.body.scrollTop,x=document.documentElement.scrollTop,b=document.body.scrollHeight,w=document.body.scrollWidth,S=o.scrollTop,C=o.scrollLeft;(h!==a||p!==s||y!==c||x!==l||b!==u||w!==d||S!==f||C!==m)&&(a=h,s=p,c=y,l=x,u=b,d=w,f=S,m=C,i=Date.now()),Date.now()-i>=e?n():requestAnimationFrame(g)}requestAnimationFrame(g)})}var ec=350;async function pn(e){let t=tc(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 i=t.map(a=>({top:a.scrollTop,left:a.scrollLeft})),o=[];for(let a=0;a<t.length;a++)(n[a].top!==i[a].top||n[a].left!==i[a].left)&&o.push({el:t[a],fromTop:n[a].top,fromLeft:n[a].left,toTop:i[a].top,toLeft:i[a].left});if(o.length===0){await new Promise(a=>requestAnimationFrame(()=>a()));return}for(let a of o)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/ec,1),f=1-Math.pow(1-d,3);for(let m of o)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 tc(e){let t=[],n=e.parentElement;for(;n;){let r=getComputedStyle(n),i=r.overflowY,o=r.overflowX;(i==="auto"||i==="scroll"||o==="auto"||o==="scroll")&&t.push(n),n=n.parentElement}return t.push(document.scrollingElement||document.documentElement),t}async function St(e,t){let n=Date.now(),r=[],i=[],o="",a=!1,s=new Set(["click","type","select"]),c=t.some(l=>s.has(l.command));c&&(Xe(!0),cn()),Nt();try{for(let l=0;l<t.length;l++){let u=t[l],d=u.command;try{if(l>0&&await O(Co+Math.random()*xt-xt/2),d==="navigate"){let m=u.url;if(!m)throw new Error('navigate command requires a "url" field');if(Ao(m)){r.push({index:l,command:d,result:"ok"}),await O(Mo);continue}let g=t.slice(l+1);if(g.length>0)try{sessionStorage.setItem(vt,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:g,stepOffset:l+1}))}catch{}r.push({index:l,command:d,result:"ok"}),a=!0,window.location.href=m,await new Promise((h,p)=>{setTimeout(()=>p(new Error("Navigation did not complete within timeout")),ko)})}let f=await Lo(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{o=await Le()}catch{}}finally{i=Rt(),c&&(Xe(!1),wt())}return{id:e,steps:r,snapshot:o,logs:i,duration:Date.now()-n}}async function $o(){let e=null;try{let o=sessionStorage.getItem(vt);if(!o)return null;sessionStorage.removeItem(vt),e=JSON.parse(o)}catch{return null}if(!e)return null;let t=[...e.completedSteps],n=[],r="",i=e.remainingSteps.some(o=>o.command==="click"||o.command==="type"||o.command==="select");i&&(Xe(!0),cn()),Nt();try{for(let o=0;o<e.remainingSteps.length;o++){let a=e.remainingSteps[o],s=a.command,c=e.stepOffset+o;try{if(o>0&&await O(Co+Math.random()*xt-xt/2),s==="navigate"){let u=a.url;if(!u)throw new Error('navigate command requires a "url" field');if(Ao(u)){t.push({index:c,command:s,result:"ok"}),await O(Mo);continue}let d=e.remainingSteps.slice(o+1);if(d.length>0)try{sessionStorage.setItem(vt,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")),ko)})}let l=await Lo(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 Le()}catch{}}finally{n=Rt(),i&&(Xe(!1),wt())}return{id:e.id,steps:t,snapshot:r,logs:n,duration:Date.now()-e.startTime}}async function Lo(e){switch(e.command){case"snapshot":return{result:await Le()};case"click":{let{element:t,matched:n}=fe(e);return await pn(t),await yt(t),await go(),It(t),await mn(),await O(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=fe(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await pn(t),await yt(t),await Hn(t,r,{clear:!!e.clear}),await mn(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=fe(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await pn(t),await yt(t);let i=Bn(t,r);return await mn(),{result:`selected "${i}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await On(e);return{result:"ok",matched:t,elapsed:n}}case"styles":{let t=e.properties;return{result:Zs(e,t)}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await Wn(t)}}case"screenshotFullPage":{let t=Se();t.scrollTop=0,await O(500);let{image:n,width:r,height:i}=await Ge(),o=e.uploadUrl,a=e.uploadFields;if(o&&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(o,{method:"POST",body:l});if(!u.ok)throw new Error(`Screenshot upload failed: ${u.status}`);let d=e._publicUrl;return{result:{width:r,height:i,uploaded:!0,...d?{_publicUrl:d}:{}}}}return{result:{image:n,width:r,height:i}}}case"screenshotViewport":{let{image:t,width:n,height:r}=await Ge({viewportOnly:!0}),i=e.uploadUrl,o=e.uploadFields;if(i&&o){let a=atob(t),s=new Uint8Array(a.length);for(let d=0;d<a.length;d++)s[d]=a.charCodeAt(d);let c=new FormData;for(let[d,f]of Object.entries(o))c.append(d,f);c.append("file",new Blob([s],{type:"image/jpeg"}),"screenshot.jpg");let l=await fetch(i,{method:"POST",body:c});if(!l.ok)throw new Error(`Screenshot upload failed: ${l.status}`);let u=e._publicUrl;return{result:{width:n,height:r,uploaded:!0,...u?{_publicUrl:u}:{}}}}return{result:{image:t,width:n,height:r}}}case"reload":return location.reload(),{result:"ok"};default:throw new Error(`Unknown command: ${e.command}`)}}var nc="/__mindstudio_dev__/ws",rc=1e3,oc=1e4;function No(){let e=E().ws;e.ws||(xn(Ro),window.addEventListener("beforeunload",()=>{e.closing=!0,e.ws&&e.ws.close()}),_o())}function Ro(){let{ws:e}=E().ws;return e&&e.readyState===WebSocket.OPEN?e:null}function ic(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${nc}`}function ac(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function _o(){let e=E().ws;if(!e.closing){try{e.ws=new WebSocket(ic())}catch{To();return}e.ws.onopen=()=>{try{e.ws.send(JSON.stringify({type:"hello",mode:ac(),url:location.href,viewport:{w:window.innerWidth,h:window.innerHeight}}))}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=rc,sc();break;case"command":lc(n.id,n.steps);break;case"broadcast":cc(n.action,n.payload);break}},e.ws.onclose=()=>{e.ws=null,e.clientId=null,e.closing||To()},e.ws.onerror=()=>{}}}function To(){let e=E().ws;e.closing||(setTimeout(()=>_o(),e.reconnectDelay),e.reconnectDelay=Math.min(e.reconnectDelay*2,oc))}async function lc(e,t){let n=E().ws;if(n.busy){Et({id:e,steps:[],snapshot:"",logs:[],duration:0,error:"Browser agent is busy"});return}n.busy=!0,hn("command-started",{id:e,steps:t.map(r=>r.command)});try{let r=await St(e,t);Et(r),hn("command-completed",{id:e,success:!0})}catch{Et({id:e,steps:[],snapshot:"",logs:[],duration:0}),hn("command-completed",{id:e,success:!1})}finally{E().ws.busy=!1}}function Et(e){try{let t=Ro();t&&t.send(JSON.stringify({type:"result",...e}))}catch{}}async function sc(){let e=await $o();e&&Et(e)}function hn(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function cc(e,t){e==="reload"&&location.reload()}var Po="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",uc=200,Fo=`
111
+ `,t.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none","opacity: 0","transition: opacity 300ms ease, left 600ms cubic-bezier(0.4, 0, 0, 1), top 600ms cubic-bezier(0.4, 0, 0, 1)","will-change: left, top, opacity"].join("; ");let n=document.createElement("div");n.id=fn,n.style.cssText=["position: fixed","top: 0","left: 0","width: 100vw","height: 100vh","background: white","opacity: 0","z-index: 2147483646","pointer-events: none","transition: opacity 600ms ease-out"].join("; "),document.documentElement.appendChild(n),document.documentElement.appendChild(t),e.cameraEl=t,e.flashEl=n}function qs(e,t){let{cameraEl:n}=E().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.opacity="1")}function So(e,t){let{cameraEl:n}=E().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}async function js(){let{flashEl:e}=E().screenshot;e&&(e.style.transition="none",e.style.opacity="0.7",e.offsetWidth,e.style.transition="opacity 600ms ease-out",e.style.opacity="0",await H(600))}function Ys(){let{cameraEl:e}=E().screenshot;e&&(e.style.opacity="0")}function Vs(){let e=E().screenshot;document.getElementById(dn)?.remove(),document.getElementById(fn)?.remove(),e.cameraEl=null,e.flashEl=null}function zs(e,t,n){return new Promise(r=>{let i=e.scrollTop,o=t-i;if(Math.abs(o)<1){r();return}let a=Math.abs(o),c=Math.max(n,a/2),l=performance.now();function u(d){let f=d-l,m=Math.min(f/c,1),g=m<.5?4*m*m*m:1-Math.pow(-2*m+2,3)/2;e.scrollTop=i+o*g,m<1?requestAnimationFrame(u):r()}requestAnimationFrame(u)})}async function Ge(e){let t=E().screenshot;if(t.capturing)throw new Error("Screenshot already in progress");t.capturing=!0,bo();try{return await Xs(e)}finally{t.capturing=!1,vo()}}async function Xs(e){await zr();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return await Ks(t,n);let r=Se(),i=r!==document.documentElement,o=r.scrollTop,a=r.style.scrollBehavior;r.style.scrollBehavior="auto",Us();try{let s=Math.random()<.5?t+30:-60,c=n*.3+Math.random()*n*.4;qs(s,c),await H(200);let l=t*.4+Math.random()*t*.15,u=n*.35+Math.random()*n*.15;So(l,u),await H(700);let d=[],f=0,m=i?r.clientHeight:n,g=()=>i?r.scrollHeight:Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),h=50,p=g();for(;f<p&&d.length<h;){let k=d.length,N=g();if(N<=0){console.warn("[screenshot] skipping chunk \u2014 page height is 0");break}if(N-f<m*.05&&d.length>0)break;let D=N-m,L=Math.min(f,D);Math.abs(L-r.scrollTop)>1&&(await zs(r,L,Hs),So(l,u),await H(Os)),js();let O=r.scrollTop,U=Math.min(m,N-O);if(U<=0){console.warn("[screenshot] skipping chunk \u2014 captureHeight is 0 (page may have shrunk)"),f+=m;continue}let G=i?r.getBoundingClientRect():null;try{let _=await(await I(document.body,{embedFonts:!0,exclude:Eo})).toCanvas({width:t+1});if(_&&G){let P=_.width/t,R=_.width;if(k===0&&G.top>0){let J=Math.round(G.top*P),Z=document.createElement("canvas");Z.width=R,Z.height=J;let le=Z.getContext("2d");le&&(le.drawImage(_,0,0,R,J,0,0,R,J),d.push({y:0,canvas:Z}))}let K=Math.round(G.top*P),W=Math.round(U*P),q=document.createElement("canvas");q.width=R,q.height=W;let j=q.getContext("2d");j&&(j.drawImage(_,0,K,R,W,0,0,R,W),d.push({y:G.top+O,canvas:q}));let V=G.bottom;if(f+m>=p&&V<n){let J=Math.round(V*P),Z=_.height-J;if(Z>0){let le=document.createElement("canvas");le.width=R,le.height=Z;let Ze=le.getContext("2d");Ze&&(Ze.drawImage(_,0,J,R,Z,0,0,R,Z),d.push({y:G.top+N,canvas:le}))}}}else if(_){let P=_.width/t,R=Math.round(O*P),K=Math.min(O+U,N),W=Math.round(K*P)-R,q=_.width,j=document.createElement("canvas");j.width=q,j.height=W;let V=j.getContext("2d");V&&(V.drawImage(_,0,R,q,W,0,0,q,W),d.push({y:O,canvas:j}))}}catch(T){console.error("[screenshot] snapdom capture failed for chunk",k,T)}f+=m}if(f<p&&console.warn(`[screenshot] page truncated \u2014 captured ${d.length} chunks but page is ${p}px tall`),d.length===0)throw new Error("Screenshot capture produced no image data");let y=d[0].canvas.width,x=0;for(let k of d)x+=k.canvas.height;let b=document.createElement("canvas");b.width=y,b.height=x;let w=b.getContext("2d");if(!w)throw new Error("Failed to create output canvas");let S=0;for(let k of d)w.drawImage(k.canvas,0,S),S+=k.canvas.height;let v=b.toDataURL("image/jpeg",1).replace(/^data:image\/jpeg;base64,/,"");if(!v)throw new Error("Canvas export produced no image data");return{image:v,width:b.width,height:b.height}}finally{Ys(),Vs(),r.style.scrollBehavior="auto",r.scrollTop=o,r.style.scrollBehavior=a}}function Gs(){let e=document.getElementById("__mindstudio-notes-overlay");if(!e)return null;let t=window.scrollX,n=window.scrollY,r=e.style.cssText;return e.style.position="absolute",e.style.inset="auto",e.style.left=`${t}px`,e.style.top=`${n}px`,e.style.width=`${window.innerWidth}px`,e.style.height=`${window.innerHeight}px`,()=>{e.style.cssText=r}}async function Ks(e,t){let n=Gs();try{let i=await(await I(document.body,{embedFonts:!0,exclude:Eo})).toCanvas({width:(e+1)*Me});if(!i)throw new Error("SnapDOM viewport capture returned empty result");let o=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),a=document.createElement("canvas");a.width=e*Me,a.height=t*Me;let s=a.getContext("2d");if(!s)throw new Error("Failed to create canvas context");let c=window.scrollY/o*i.height,l=t/o*i.height;s.drawImage(i,0,c,i.width,l,0,0,e*Me,t*Me);let d=a.toDataURL("image/jpeg",1).replace(/^data:image\/jpeg;base64,/,"");if(!d)throw new Error("Canvas export produced no image data");return{image:d,width:e*Me,height:t*Me}}finally{n?.()}}var Js=["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 Zs(e,t){let n=t??Js;if(e.ref||e.text||e.role||e.label||e.selector){let{element:o,matched:a}=fe(e);return{...Co(o,e.ref,n),matched:a}}let r=$e(),i=[];for(let[o,a]of r)a.isConnected&&i.push(Co(a,o,n));return i}function Co(e,t,n){let r=window.getComputedStyle(e),i={};t&&(i.ref=t),i.tag=e.tagName.toLowerCase();let o=e.textContent?.trim();o&&(i.text=o.length>60?o.slice(0,60)+"\u2026":o);for(let a of n){let s=r.getPropertyValue(a.replace(/([A-Z])/g,"-$1").toLowerCase());s&&(i[a]=s)}return i}var Mo=150,xt=100,Ke="__mindstudio_pending_nav",ko=300,hn=1e4;function Qs(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 Ao(e){try{let t=new URL(e,window.location.origin);return t.origin!==window.location.origin?!1:(Qs(e)||(window.history.pushState(null,"",t.pathname+t.search+t.hash),window.dispatchEvent(new PopStateEvent("popstate"))),!0)}catch{return!1}}async function mn(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,i=Date.now(),o=Se(),a=window.scrollY,s=window.scrollX,c=document.body.scrollTop,l=document.documentElement.scrollTop,u=document.body.scrollHeight,d=document.body.scrollWidth,f=o.scrollTop,m=o.scrollLeft;function g(){if(Date.now()>r){n();return}let h=window.scrollY,p=window.scrollX,y=document.body.scrollTop,x=document.documentElement.scrollTop,b=document.body.scrollHeight,w=document.body.scrollWidth,S=o.scrollTop,C=o.scrollLeft;(h!==a||p!==s||y!==c||x!==l||b!==u||w!==d||S!==f||C!==m)&&(a=h,s=p,c=y,l=x,u=b,d=w,f=S,m=C,i=Date.now()),Date.now()-i>=e?n():requestAnimationFrame(g)}requestAnimationFrame(g)})}var ec=350;async function pn(e){let t=tc(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 i=t.map(a=>({top:a.scrollTop,left:a.scrollLeft})),o=[];for(let a=0;a<t.length;a++)(n[a].top!==i[a].top||n[a].left!==i[a].left)&&o.push({el:t[a],fromTop:n[a].top,fromLeft:n[a].left,toTop:i[a].top,toLeft:i[a].left});if(o.length===0){await new Promise(a=>requestAnimationFrame(()=>a()));return}for(let a of o)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/ec,1),f=1-Math.pow(1-d,3);for(let m of o)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 tc(e){let t=[],n=e.parentElement;for(;n;){let r=getComputedStyle(n),i=r.overflowY,o=r.overflowX;(i==="auto"||i==="scroll"||o==="auto"||o==="scroll")&&t.push(n),n=n.parentElement}return t.push(document.scrollingElement||document.documentElement),t}async function St(e,t){let n=Date.now(),r=[],i=[],o="",a=!1,s=new Set(["click","type","select"]),c=t.some(l=>s.has(l.command));c&&(Xe(!0),cn()),Nt();try{for(let l=0;l<t.length;l++){let u=t[l],d=u.command;try{if(l>0&&await H(Mo+Math.random()*xt-xt/2),d==="navigate"){let m=u.url;if(!m)throw new Error('navigate command requires a "url" field');if(Ao(m)){r.push({index:l,command:d,result:"ok"}),await H(ko);continue}let g=t.slice(l+1);if(g.length>0)try{sessionStorage.setItem(Ke,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:g,stepOffset:l+1}))}catch{}r.push({index:l,command:d,result:"ok"}),a=!0,window.location.href=m,await new Promise((h,p)=>{setTimeout(()=>p(new Error("Navigation did not complete within timeout")),hn)})}if(d==="reload"){let m=t.slice(l+1);if(m.length>0)try{sessionStorage.setItem(Ke,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((g,h)=>{setTimeout(()=>h(new Error("Reload did not complete within timeout")),hn)})}let f=await Lo(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{o=await Le()}catch{}}finally{i=_t(),c&&(Xe(!1),bt())}return{id:e,steps:r,snapshot:o,logs:i,duration:Date.now()-n}}async function $o(){let e=null;try{let o=sessionStorage.getItem(Ke);if(!o)return null;sessionStorage.removeItem(Ke),e=JSON.parse(o)}catch{return null}if(!e)return null;let t=[...e.completedSteps],n=[],r="",i=e.remainingSteps.some(o=>o.command==="click"||o.command==="type"||o.command==="select");i&&(Xe(!0),cn()),Nt();try{for(let o=0;o<e.remainingSteps.length;o++){let a=e.remainingSteps[o],s=a.command,c=e.stepOffset+o;try{if(o>0&&await H(Mo+Math.random()*xt-xt/2),s==="navigate"){let u=a.url;if(!u)throw new Error('navigate command requires a "url" field');if(Ao(u)){t.push({index:c,command:s,result:"ok"}),await H(ko);continue}let d=e.remainingSteps.slice(o+1);if(d.length>0)try{sessionStorage.setItem(Ke,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")),hn)})}let l=await Lo(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 Le()}catch{}}finally{n=_t(),i&&(Xe(!1),bt())}return{id:e.id,steps:t,snapshot:r,logs:n,duration:Date.now()-e.startTime}}async function Lo(e){switch(e.command){case"snapshot":return{result:await Le()};case"click":{let{element:t,matched:n}=fe(e);return await pn(t),await wt(t),await yo(),Dt(t),await mn(),await H(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=fe(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await pn(t),await wt(t),await Hn(t,r,{clear:!!e.clear}),await mn(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=fe(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await pn(t),await wt(t);let i=Wn(t,r);return await mn(),{result:`selected "${i}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await Bn(e);return{result:"ok",matched:t,elapsed:n}}case"styles":{let t=e.properties;return{result:Zs(e,t)}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await Un(t)}}case"screenshotFullPage":{let t=Se();t.scrollTop=0,await H(500);let{image:n,width:r,height:i}=await Ge(),o=e.uploadUrl,a=e.uploadFields;if(o&&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(o,{method:"POST",body:l});if(!u.ok)throw new Error(`Screenshot upload failed: ${u.status}`);let d=e._publicUrl;return{result:{width:r,height:i,uploaded:!0,...d?{_publicUrl:d}:{}}}}return{result:{image:n,width:r,height:i}}}case"screenshotViewport":{let{image:t,width:n,height:r}=await Ge({viewportOnly:!0}),i=e.uploadUrl,o=e.uploadFields;if(i&&o){let a=atob(t),s=new Uint8Array(a.length);for(let d=0;d<a.length;d++)s[d]=a.charCodeAt(d);let c=new FormData;for(let[d,f]of Object.entries(o))c.append(d,f);c.append("file",new Blob([s],{type:"image/jpeg"}),"screenshot.jpg");let l=await fetch(i,{method:"POST",body:c});if(!l.ok)throw new Error(`Screenshot upload failed: ${l.status}`);let u=e._publicUrl;return{result:{width:n,height:r,uploaded:!0,...u?{_publicUrl:u}:{}}}}return{result:{image:t,width:n,height:r}}}case"reload":return location.reload(),{result:"ok"};default:throw new Error(`Unknown command: ${e.command}`)}}var nc="/__mindstudio_dev__/ws",rc=1e3,oc=1e4;function No(){let e=E().ws;e.ws||(Sn(_o),window.addEventListener("beforeunload",()=>{e.closing=!0,e.ws&&e.ws.close()}),Ro())}function _o(){let{ws:e}=E().ws;return e&&e.readyState===WebSocket.OPEN?e:null}function ic(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${nc}`}function ac(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function Ro(){let e=E().ws;if(!e.closing){try{e.ws=new WebSocket(ic())}catch{To();return}e.ws.onopen=()=>{try{e.ws.send(JSON.stringify({type:"hello",mode:ac(),url:location.href,viewport:{w:window.innerWidth,h:window.innerHeight}}))}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=rc,sc();break;case"command":lc(n.id,n.steps);break;case"broadcast":cc(n.action,n.payload);break}},e.ws.onclose=()=>{e.ws=null,e.clientId=null,e.closing||To()},e.ws.onerror=()=>{}}}function To(){let e=E().ws;e.closing||(setTimeout(()=>Ro(),e.reconnectDelay),e.reconnectDelay=Math.min(e.reconnectDelay*2,oc))}async function lc(e,t){let n=E().ws;if(n.busy){Et({id:e,steps:[],snapshot:"",logs:[],duration:0,error:"Browser agent is busy"});return}n.busy=!0,gn("command-started",{id:e,steps:t.map(r=>r.command)});try{let r=await St(e,t);Et(r),gn("command-completed",{id:e,success:!0})}catch{Et({id:e,steps:[],snapshot:"",logs:[],duration:0}),gn("command-completed",{id:e,success:!1})}finally{E().ws.busy=!1}}function Et(e){try{let t=_o();t&&t.send(JSON.stringify({type:"result",...e}))}catch{}}async function sc(){let e=await $o();e&&Et(e)}function gn(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function cc(e,t){e==="reload"&&location.reload()}var Po="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",uc=200,Fo=`
112
112
  all: initial !important;
113
113
  display: block !important;
114
114
  box-sizing: border-box !important;
@@ -127,7 +127,7 @@ ${h}
127
127
  transition: box-shadow 0.15s;
128
128
  opacity: 1 !important;
129
129
  -webkit-text-fill-color: white !important;
130
- `.trim(),Ke={inactive:"0 2px 6px rgba(0, 0, 0, 0.15)",selected:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px",editing:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px"},dc=`
130
+ `.trim(),Je={inactive:"0 2px 6px rgba(0, 0, 0, 0.15)",selected:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px",editing:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px"},dc=`
131
131
  all: initial !important;
132
132
  position: absolute !important;
133
133
  top: -8px;
@@ -148,7 +148,7 @@ ${h}
148
148
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
149
149
  font-family: ${Po};
150
150
  font-weight: bold !important;
151
- `.trim();function Do(){let e=document.createElement("div");return e.dataset.deleteBtn="true",e.innerHTML="\xD7",e.style.cssText=dc,e}function Io(e,t){let n=`note-${++E().noteElement.counter}`,r=document.createElement("div");r.id=n,r.dataset.noteId=n,r.style.cssText=`
151
+ `.trim();function Io(){let e=document.createElement("div");return e.dataset.deleteBtn="true",e.innerHTML="\xD7",e.style.cssText=dc,e}function Do(e,t){let n=`note-${++E().noteElement.counter}`,r=document.createElement("div");r.id=n,r.dataset.noteId=n,r.style.cssText=`
152
152
  position: absolute;
153
153
  left: ${e}px;
154
154
  top: ${t}px;
@@ -168,9 +168,9 @@ ${h}
168
168
  z-index: 2;
169
169
  `;let o=document.createElement("div");o.style.cssText="position: relative;";let a=document.createElement("div");a.dataset.bubble="true",a.style.cssText=`
170
170
  ${Fo}
171
- box-shadow: ${Ke.inactive};
171
+ box-shadow: ${Je.inactive};
172
172
  cursor: grab;
173
- `;let s=Do();return o.appendChild(a),o.appendChild(s),r.appendChild(i),r.appendChild(o),{id:n,type:"pin",x:e,y:t,element:r,bubble:a,deleteBtn:s,state:"inactive"}}function Ho(e,t,n,r){let i=`note-${++E().noteElement.counter}`,o=document.createElement("div");o.id=i,o.dataset.noteId=i,o.style.cssText=`
173
+ `;let s=Io();return o.appendChild(a),o.appendChild(s),r.appendChild(i),r.appendChild(o),{id:n,type:"pin",x:e,y:t,element:r,bubble:a,deleteBtn:s,state:"inactive"}}function Oo(e,t,n,r){let i=`note-${++E().noteElement.counter}`,o=document.createElement("div");o.id=i,o.dataset.noteId=i,o.style.cssText=`
174
174
  position: absolute;
175
175
  left: ${e}px;
176
176
  top: ${t}px;
@@ -188,9 +188,9 @@ ${h}
188
188
  ${l?`bottom: ${r+8}px`:`top: ${r+8}px`};
189
189
  `;let d=document.createElement("div");d.dataset.bubble="true",d.style.cssText=`
190
190
  ${Fo}
191
- box-shadow: ${Ke.inactive};
191
+ box-shadow: ${Je.inactive};
192
192
  cursor: grab;
193
- `;let f=Do();return u.appendChild(d),u.appendChild(f),o.appendChild(a),o.appendChild(u),{id:i,type:"area",x:e,y:t,width:n,height:r,element:o,bubble:d,deleteBtn:f,state:"inactive"}}function Oo(e){e.state="selected",e.bubble.contentEditable="false",e.bubble.style.boxShadow=Ke.selected,e.bubble.style.cursor="grab",e.deleteBtn.style.display="block"}function Ct(e){e.state="editing",e.bubble.contentEditable="true",e.bubble.style.boxShadow=Ke.editing,e.bubble.style.cursor="text",e.deleteBtn.style.display="block",e.bubble.focus();let t=window.getSelection();t&&(t.selectAllChildren(e.bubble),t.collapseToEnd())}function De(e){return e.bubble.textContent?.trim()||""?(e.state="inactive",e.bubble.contentEditable="false",e.bubble.style.boxShadow=Ke.inactive,e.bubble.style.cursor="grab",e.deleteBtn.style.display="none",!0):!1}var ae="#DD2590",fc="__mindstudio-notes-overlay",mc="__mindstudio-notes-cursor",pc=5,hc=`<svg width="25" height="26" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
193
+ `;let f=Io();return u.appendChild(d),u.appendChild(f),o.appendChild(a),o.appendChild(u),{id:i,type:"area",x:e,y:t,width:n,height:r,element:o,bubble:d,deleteBtn:f,state:"inactive"}}function Ho(e){e.state="selected",e.bubble.contentEditable="false",e.bubble.style.boxShadow=Je.selected,e.bubble.style.cursor="grab",e.deleteBtn.style.display="block"}function Ct(e){e.state="editing",e.bubble.contentEditable="true",e.bubble.style.boxShadow=Je.editing,e.bubble.style.cursor="text",e.deleteBtn.style.display="block",e.bubble.focus();let t=window.getSelection();t&&(t.selectAllChildren(e.bubble),t.collapseToEnd())}function Ie(e){return e.bubble.textContent?.trim()||""?(e.state="inactive",e.bubble.contentEditable="false",e.bubble.style.boxShadow=Je.inactive,e.bubble.style.cursor="grab",e.deleteBtn.style.display="none",!0):!1}var ae="#DD2590",fc="__mindstudio-notes-overlay",mc="__mindstudio-notes-cursor",pc=5,hc=`<svg width="25" height="26" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
194
194
  <g filter="url(#filter0_d_notes)">
195
195
  <path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${ae}"/>
196
196
  <path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${ae}"/>
@@ -222,10 +222,10 @@ ${h}
222
222
  z-index: 2147483647;
223
223
  pointer-events: none;
224
224
  will-change: left, top;
225
- `,e.overlay.addEventListener("pointerdown",Yo),e.overlay.addEventListener("pointermove",jo),document.addEventListener("pointermove",Vo,{capture:!0}),document.addEventListener("pointerup",zo,{capture:!0}),document.addEventListener("pointercancel",Xo,{capture:!0}),document.addEventListener("keydown",Go),document.body.appendChild(e.overlay),document.body.appendChild(e.cursorEl))}function Uo(){let e=E().noteLayer;document.removeEventListener("pointermove",Vo,{capture:!0}),document.removeEventListener("pointerup",zo,{capture:!0}),document.removeEventListener("pointercancel",Xo,{capture:!0}),document.removeEventListener("keydown",Go),e.overlay&&(e.overlay.removeEventListener("pointerdown",Yo),e.overlay.removeEventListener("pointermove",jo),e.overlay.remove(),e.overlay=null),e.cursorEl&&(e.cursorEl.remove(),e.cursorEl=null),e.notes=[],e.currentNote=null,Ie()}function qo(){let e=E().noteLayer;e.cursorEl&&(e.cursorEl.style.display="none"),e.movingNote=null,e.consumedByDeactivation=!1,Ie()}function jo(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`,Ko(e.target)?(t.cursorEl.style.display="none",t.overlay.style.cursor=""):(t.cursorEl.style.display="",t.overlay.style.cursor="none")}function Yo(e){let t=E().noteLayer;if(!t.overlay)return;let n=e.target;if(n.dataset?.deleteBtn==="true"||n.closest("[data-delete-btn]")){let i=n.closest("[data-note-id]");if(i){let o=t.notes.find(a=>a.id===i.id);if(o){ke(o),e.preventDefault(),e.stopPropagation();return}}}t.overlay.setPointerCapture(e.pointerId);let r=Ko(e.target);if(r){if(r.state==="editing")return;if(r.state==="selected"){let i=e.target;if(i.dataset?.bubble==="true"||i.closest("[data-bubble]")){Ct(r),t.currentNote=r,e.preventDefault();return}Bo(r,e),e.preventDefault();return}t.currentNote&&t.currentNote!==r&&(De(t.currentNote)||ke(t.currentNote)),Oo(r),t.currentNote=r,Bo(r,e),e.preventDefault();return}if(t.currentNote&&(t.currentNote.state==="editing"||t.currentNote.state==="selected")){De(t.currentNote)||ke(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 Vo(e){let t=E().noteLayer;if(t.movingNote){let i=e.clientX-t.moveOffsetX,o=e.clientY-t.moveOffsetY;t.movingNote.x=i,t.movingNote.y=o,t.movingNote.element.style.left=`${i}px`,t.movingNote.element.style.top=`${o}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)>pc&&(t.didDrag=!0,t.dragPreview||(t.dragPreview=document.createElement("div"),t.dragPreview.style.cssText=`
225
+ `,e.overlay.addEventListener("pointerdown",Yo),e.overlay.addEventListener("pointermove",jo),document.addEventListener("pointermove",Vo,{capture:!0}),document.addEventListener("pointerup",zo,{capture:!0}),document.addEventListener("pointercancel",Xo,{capture:!0}),document.addEventListener("keydown",Go),document.body.appendChild(e.overlay),document.body.appendChild(e.cursorEl))}function Uo(){let e=E().noteLayer;document.removeEventListener("pointermove",Vo,{capture:!0}),document.removeEventListener("pointerup",zo,{capture:!0}),document.removeEventListener("pointercancel",Xo,{capture:!0}),document.removeEventListener("keydown",Go),e.overlay&&(e.overlay.removeEventListener("pointerdown",Yo),e.overlay.removeEventListener("pointermove",jo),e.overlay.remove(),e.overlay=null),e.cursorEl&&(e.cursorEl.remove(),e.cursorEl=null),e.notes=[],e.currentNote=null,De()}function qo(){let e=E().noteLayer;e.cursorEl&&(e.cursorEl.style.display="none"),e.movingNote=null,e.consumedByDeactivation=!1,De()}function jo(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`,Ko(e.target)?(t.cursorEl.style.display="none",t.overlay.style.cursor=""):(t.cursorEl.style.display="",t.overlay.style.cursor="none")}function Yo(e){let t=E().noteLayer;if(!t.overlay)return;let n=e.target;if(n.dataset?.deleteBtn==="true"||n.closest("[data-delete-btn]")){let i=n.closest("[data-note-id]");if(i){let o=t.notes.find(a=>a.id===i.id);if(o){ke(o),e.preventDefault(),e.stopPropagation();return}}}t.overlay.setPointerCapture(e.pointerId);let r=Ko(e.target);if(r){if(r.state==="editing")return;if(r.state==="selected"){let i=e.target;if(i.dataset?.bubble==="true"||i.closest("[data-bubble]")){Ct(r),t.currentNote=r,e.preventDefault();return}Bo(r,e),e.preventDefault();return}t.currentNote&&t.currentNote!==r&&(Ie(t.currentNote)||ke(t.currentNote)),Ho(r),t.currentNote=r,Bo(r,e),e.preventDefault();return}if(t.currentNote&&(t.currentNote.state==="editing"||t.currentNote.state==="selected")){Ie(t.currentNote)||ke(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 Vo(e){let t=E().noteLayer;if(t.movingNote){let i=e.clientX-t.moveOffsetX,o=e.clientY-t.moveOffsetY;t.movingNote.x=i,t.movingNote.y=o,t.movingNote.element.style.left=`${i}px`,t.movingNote.element.style.top=`${o}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)>pc&&(t.didDrag=!0,t.dragPreview||(t.dragPreview=document.createElement("div"),t.dragPreview.style.cssText=`
226
226
  position: fixed;
227
227
  border: 4px dashed ${ae};
228
228
  border-radius: 12px;
229
229
  pointer-events: none;
230
230
  z-index: 2;
231
- `,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 zo(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,Ie();return}if(!t.pointerDown||!t.overlay){Ie();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),i=Math.abs(e.clientX-t.startX),o=Math.abs(e.clientY-t.startY);if(i>10&&o>10){let a=Ho(n,r,i,o);t.overlay.appendChild(a.element),t.notes.push(a),Ct(a),t.currentNote=a}}else{let n=Io(e.clientX,e.clientY);t.overlay.appendChild(n.element),t.notes.push(n),Ct(n),t.currentNote=n}Ie()}function Xo(){let e=E().noteLayer;e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null),e.movingNote=null,Ie()}function Go(e){let t=E().noteLayer;if(t.currentNote){if(e.key==="Enter"&&!e.shiftKey&&t.currentNote.state==="editing"){De(t.currentNote)||ke(t.currentNote),t.currentNote=null,e.preventDefault();return}if(e.key==="Escape"){t.currentNote.state==="editing"?(De(t.currentNote)||ke(t.currentNote),t.currentNote=null):t.currentNote.state==="selected"&&(De(t.currentNote),t.currentNote=null),e.preventDefault();return}if(t.currentNote.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){ke(t.currentNote),t.currentNote=null,e.preventDefault();return}t.currentNote.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&t.currentNote.bubble.textContent?.trim()===""&&(ke(t.currentNote),t.currentNote=null,e.preventDefault())}}function Bo(e,t){let n=E().noteLayer;n.movingNote=e,n.moveOffsetX=t.clientX-e.x,n.moveOffsetY=t.clientY-e.y}function Ko(e){let t=E().noteLayer;for(let n of t.notes)if(n.element.contains(e))return n;return null}function ke(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 Ie(){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 Jo(){let e=E().notesMode;e.active||(e.active=!0,Wo())}function Zo(){let e=E().notesMode;e.active&&(e.active=!1,Uo())}async function Qo(){let{image:e}=await Ge({viewportOnly:!0});return e}var gn="mindstudio-browser-agent";function ei(){let e=E(),t=new URLSearchParams(window.location.search);e.zoom.pipMode=t.get("display-mode")==="pip",e.zoom.mobilePreview=t.get("preview")==="mobile",!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===gn)switch(r.command){case"notes-enter":Jo();break;case"notes-exit":Zo();break;case"notes-cursor-hide":qo();break;case"notes-screenshot":{try{let i=await Qo();window.parent.postMessage({channel:gn,command:"screenshot-result",image:i},"*")}catch(i){window.parent.postMessage({channel:gn,command:"screenshot-result",error:i instanceof Error?i.message:"Screenshot failed"},"*")}break}case"cursor-show":bt("visible");break;case"cursor-hide":bt("hidden");break;case"cursor-auto":bt(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;break;case"display-mode-full":e.zoom.pipMode=!1;break;case"preview-mode-mobile":e.zoom.mobilePreview=!0,ln(),un(!0);break;case"preview-mode-desktop":e.zoom.mobilePreview=!1,eo(),un(!1);break}},window.addEventListener("message",e.messages.handler))}window.__MINDSTUDIO_BROWSER_AGENT__||(window.__MINDSTUDIO_BROWSER_AGENT__=!0,En(),$n(),Ln(),Tn(),Rn(),Nn(),No(),ei(),fo(),Qr(),Yr(),window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:"ready"},"*"));return gi(gc);})();
231
+ `,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 zo(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,De();return}if(!t.pointerDown||!t.overlay){De();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),i=Math.abs(e.clientX-t.startX),o=Math.abs(e.clientY-t.startY);if(i>10&&o>10){let a=Oo(n,r,i,o);t.overlay.appendChild(a.element),t.notes.push(a),Ct(a),t.currentNote=a}}else{let n=Do(e.clientX,e.clientY);t.overlay.appendChild(n.element),t.notes.push(n),Ct(n),t.currentNote=n}De()}function Xo(){let e=E().noteLayer;e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null),e.movingNote=null,De()}function Go(e){let t=E().noteLayer;if(t.currentNote){if(e.key==="Enter"&&!e.shiftKey&&t.currentNote.state==="editing"){Ie(t.currentNote)||ke(t.currentNote),t.currentNote=null,e.preventDefault();return}if(e.key==="Escape"){t.currentNote.state==="editing"?(Ie(t.currentNote)||ke(t.currentNote),t.currentNote=null):t.currentNote.state==="selected"&&(Ie(t.currentNote),t.currentNote=null),e.preventDefault();return}if(t.currentNote.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){ke(t.currentNote),t.currentNote=null,e.preventDefault();return}t.currentNote.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&t.currentNote.bubble.textContent?.trim()===""&&(ke(t.currentNote),t.currentNote=null,e.preventDefault())}}function Bo(e,t){let n=E().noteLayer;n.movingNote=e,n.moveOffsetX=t.clientX-e.x,n.moveOffsetY=t.clientY-e.y}function Ko(e){let t=E().noteLayer;for(let n of t.notes)if(n.element.contains(e))return n;return null}function ke(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 De(){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 Jo(){let e=E().notesMode;e.active||(e.active=!0,Wo())}function Zo(){let e=E().notesMode;e.active&&(e.active=!1,Uo())}async function Qo(){let{image:e}=await Ge({viewportOnly:!0});return e}var yn="mindstudio-browser-agent";function ei(){let e=E(),t=new URLSearchParams(window.location.search);e.zoom.pipMode=t.get("display-mode")==="pip",e.zoom.mobilePreview=t.get("preview")==="mobile";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===yn)switch(r.command){case"notes-enter":Jo();break;case"notes-exit":Zo();break;case"notes-cursor-hide":qo();break;case"notes-screenshot":{try{let i=await Qo();window.parent.postMessage({channel:yn,command:"screenshot-result",image:i},"*")}catch(i){window.parent.postMessage({channel:yn,command:"screenshot-result",error:i instanceof Error?i.message:"Screenshot failed"},"*")}break}case"cursor-show":vt("visible");break;case"cursor-hide":vt("hidden");break;case"cursor-auto":vt(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{}ln(),un(!0);break;case"preview-mode-desktop":e.zoom.mobilePreview=!1;try{sessionStorage.setItem("__ms_mobile","0")}catch{}to(),un(!1);break}},window.addEventListener("message",e.messages.handler))}window.__MINDSTUDIO_BROWSER_AGENT__||(window.__MINDSTUDIO_BROWSER_AGENT__=!0,Cn(),Ln(),Tn(),Nn(),Rn(),_n(),No(),ei(),mo(),eo(),Vr(),window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:"ready"},"*"));return gi(gc);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstudio-ai/browser-agent",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
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": [