@mindstudio-ai/browser-agent 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -31
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var __MindStudioBrowserAgent=(()=>{var
|
|
2
|
-
`);let o=r.length>0?t+1:t;return i+=Mt(e.children,o),i}function fn(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 W(e){return new Promise(t=>setTimeout(t,e))}var Go=["log","info","warn","error","debug"];function mn(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of Go){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),V({type:"console",level:e,args:n.map(fn),url:location.href})}}}}function pn(){window.addEventListener("error",e=>{vt({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||{};vt({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})})}function hn(){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 Ve(),e.apply(this,[t,n]).then(a=>{Le();let c={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)V(c);else try{a.clone().text().then(l=>{c.body=l.slice(0,1e3),V(c)}).catch(()=>V(c))}catch{V(c)}return a},a=>{throw Le(),V({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function gn(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);V({type:"interaction",event:"click",target:Y(t),text:n,url:location.href})},!0))}function yn(){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 Ve(),this.addEventListener("loadend",function(){Le(),V({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"})}),n.apply(this,[r])},XMLHttpRequest.prototype.open.__ms_patched=!0}function te(e){let t=null;if(e.ref){let n=we(),r=n.get(e.ref);if(r&&r.isConnected)if(ee(r))t={element:r,matched:`${Y(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${At(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&ee(o)).slice(0,10).map(([o,a])=>`${Y(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=wn(n,r);if(i.length===0){let o=wn(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${At(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}"`,c=bn(r);throw new Error(`No element found matching ${a}. `+(c?`Visible ${r||"element"}s: ${c}`:"The page may still be loading \u2014 try a wait command first."))}if(i.length>1){let o=i.filter(xn),a=o.length===1?o[0]:i[0];t={element:a,matched:Y(a)}}else t={element:i[0],matched:Y(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=Ko(n);if(r.length===0){let i=bn(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:Y(r[0])}}if(!t&&e.label){let n=e.label,r=Jo(n);if(!r){let i=[...document.querySelectorAll("label")].filter(ee).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:`${Y(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(!ee(r))throw new Error(`Found element for selector "${n}" but it is hidden (${At(r)}).`);t={element:r,matched:`${Y(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function wn(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!ee(o)||n&&!o.isConnected||t&&ue(o)!==t)continue;if(ye(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function Ko(e){let t=[];for(let n of document.querySelectorAll("*"))ee(n)&&ue(n)===e&&t.push(n);return t}function Jo(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&&ee(a))return a}let o=n.querySelector("input, textarea, select");if(o&&ee(o))return o}return null}function ee(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 xn(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 At(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 bn(e){let t=[];for(let n of document.querySelectorAll("*"))if(ee(n)&&(e?ue(n)===e&&t.push(n):xn(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${ye(n).slice(0,40)||Y(n)}"`).join(", ")}function $t(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 Zo=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,Qo=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function En(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),$t(e),n.clear&&(vn(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})),vn(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 W(ei(i,t.length))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function ei(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 vn(e,t){let n=e instanceof HTMLTextAreaElement?Qo:Zo;n?n.call(e,t):e.value=t}async function Cn(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...te(e),elapsed:Date.now()-n}}catch{await W(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 Sn=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function kn(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 Sn?Sn.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 Mn(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 ni=Object.defineProperty,z=(e,t)=>()=>(e&&(t=e(e=0)),t),Fe=(e,t)=>{for(var n in t)ni(e,n,{get:t[n],enumerable:!0})};function ri(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(C.session.__counterEpoch=(C.session.__counterEpoch||0)+1,e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.baseStyle=new X(50),C.defaultStyle=new X(30),C.image=new X(100),C.background=new X(100),C.resource=new X(150),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var X,C,K=z(()=>{X=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)}},C={image:new X(100),background:new X(100),resource:new X(150),defaultStyle:new X(30),baseStyle:new X(50),computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function jt(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function ii(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 et(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function ai(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 nt=z(()=>{});function li(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(a,c,l){if(i>=n)return;let s=Date.now();(r.get(c)||0)>s||(r.set(c,s+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,c){o("warn",a,c)},errorOnce(a,c){o("error",a,c)},reset(){r.clear(),i=0}}}function si(e){return/^data:|^blob:|^about:blank$/i.test(e)}function ci(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 ui(e,t){if(!t||si(e)||ci(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 di(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",et(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}${et(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function An(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 fi(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function G(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,i=t.useProxy||"",o=t.errorTTL??8e3,a=t.headers||{},c=!!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[,m="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(m)?atob(y):decodeURIComponent(y),b=new Uint8Array([...x].map(E=>E.charCodeAt(0))),w=new Blob([b],{type:(m||"").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 m=await fetch(e);if(!m.ok)return{ok:!1,data:null,status:m.status,url:e,fromCache:!1,reason:"http_error"};let y=await m.blob(),x=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await An(y),status:m.status,url:e,fromCache:!1,mime:x}:n==="text"?{ok:!0,data:await y.text(),status:m.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:m.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 l=fi(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),s=Te.get(l);if(s&&s.until>Date.now())return{...s.result,fromCache:!0};s&&Te.delete(l);let u=Xe.get(l);if(u)return u;let d=ui(e,i)?di(e,i):e,f=t.credentials;if(!f)try{let m=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,m);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let p=new AbortController,g=setTimeout(()=>p.abort("timeout"),r),h=(async()=>{try{let m=await fetch(d,{signal:p.signal,credentials:f,headers:a});if(!m.ok){let b={ok:!1,data:null,status:m.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&Te.set(l,{until:Date.now()+o,result:b}),!c){let w=`${m.status} ${m.statusText||""}`.trim();Tt.warnOnce(`http:${m.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 m.text(),status:m.status,url:d,fromCache:!1};let y=await m.blob(),x=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await An(y),status:m.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:y,status:m.status,url:d,fromCache:!1,mime:x}}catch(m){let y=m&&typeof m=="object"&&"name"in m&&m.name==="AbortError"?String(m.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&&Te.set(l,{until:Date.now()+o,result:x}),!c){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`;Tt.errorOnce(b,w)}return t.onError&&t.onError(x),x}finally{clearTimeout(g),Xe.delete(l)}})();return Xe.set(l,h),h}var Tt,Xe,Te,ke=z(()=>{nt(),Tt=li("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Xe=new Map,Te=new Map});async function Jn(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=jt(e);if(!n)return e;let r=ai(n),i=et(r);if(C.background.has(i)){let o=C.background.get(i);return o?`url("${o}")`:"none"}try{let o=await G(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(C.background.set(i,o.data),`url("${o.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var mi=z(()=>{K(),nt(),ke()});function pi(e){if(e=String(e).toLowerCase(),Vt.has(e)){let o={};return C.defaultStyle.set(e,o),o}if(C.defaultStyle.has(e))return C.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(zt(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),C.defaultStyle.set(e,i),i}function zt(e){let t=String(e).toLowerCase();return!!(tr.has(t)||er.test(t)||Qn.test(t))}function Rt(e,t){if(t=String(t||"").toLowerCase(),Vt.has(t))return"";let n=[],r=pi(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(zt(o)||i&&(o==="width"||o==="min-width"||o==="max-width"))continue;let c=r[o];a&&a!==c&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function hi(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 gi(e){let t=new Map;for(let r of e){let i=C.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([a,c])=>`${a}:${c};`).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 yi(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 wi(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 oe(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=C.computedStyle.get(e);r||(r=new Map,C.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=wi(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 $n(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function _t(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 Zn,Vt,bi,Qn,er,tr,nr=z(()=>{K(),Zn=new Set(["meta","script","noscript","title","link","template"]),Vt=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"]),bi=["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"],Qn=/(?:^|-)(animation|transition)(?:-|$)/i,er=/^(--.+|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,tr=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"])});function Se(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function xi(){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 fe(){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,c=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),s=/ipad|iphone|ipod/.test(t)&&r;return n||a||c||l||s}function vi(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var De=z(()=>{});function P(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 rr=z(()=>{}),J=z(()=>{mi(),nr(),De(),nt(),rr()}),or={};Fe(or,{toCanvas:()=>rt});function Si(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function Ei(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function Ci(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function ki(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 Mi(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)||[],[c="0px",l="0px",s="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(${c} ${l} ${s}${d?` ${u}`:""})`)}return i.join(" ")}function ir(e){let t=ki(e),n=null,r=null,i=null,o=[];for(let c of t){let l=c.indexOf(":");if(l<0)continue;let s=c.slice(0,l).trim().toLowerCase(),u=c.slice(l+1).trim();s==="box-shadow"?i=u:s==="filter"?n=u:s==="-webkit-filter"?r=u:o.push([s,u])}if(i){let c=Mi(i);c&&(n=n?`${n} ${c}`:c,r=r?`${r} ${c}`:c)}let a=[...o];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([c,l])=>`${c}:${l}`).join(";")}function Ai(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${ir(r)}}`)}function $i(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,Ai(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${ir(r)}${n}`),e}function Li(e){if(!fe()||!Si(e))return e;try{let t=Ei(e),n=$i(t);return Ci(n)}catch{return e}}async function rt(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:c}=t;e=Li(e);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=e,await l.decode();let s=l.naturalWidth,u=l.naturalHeight,d=Number.isFinite(a.w0)?a.w0:s,f=Number.isFinite(a.h0)?a.h0:u,p,g,h=Number.isFinite(n),m=Number.isFinite(r);if(h&&m)p=Math.max(1,n),g=Math.max(1,r);else if(h){let b=n/Math.max(1,d);p=n,g=f*b}else if(m){let b=r/Math.max(1,f);g=r,p=d*b}else p=s,g=u;p=p*i,g=g*i;let y=document.createElement("canvas");y.width=p*o,y.height=g*o,y.style.width=`${p}px`,y.style.height=`${g}px`;let x=y.getContext("2d");return o!==1&&x.scale(o,o),c&&(x.save(),x.fillStyle=c,x.fillRect(0,0,p,g),x.restore()),x.drawImage(l,0,0,p,g),y}var ot=z(()=>{De()}),Ge={};Fe(Ge,{rasterize:()=>ar});async function ar(e,t){let n=await rt(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 Ke=z(()=>{ot()}),Pt={};Fe(Pt,{toImg:()=>Ln,toSvg:()=>Ln});async function Ln(e,t){let{scale:n=1,width:r,height:i,meta:o={}}=t,a=Number.isFinite(r),c=Number.isFinite(i),l=Number.isFinite(n)&&n!==1||a||c;if(fe()&&l)return await ar(e,{...t,format:"png",quality:1,meta:o});let s=new Image;if(s.decoding="sync",s.loading="eager",s.src=e,await s.decode(),a&&c)s.style.width=`${r}px`,s.style.height=`${i}px`;else if(a){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,f=r/Math.max(1,u);s.style.width=`${r}px`,s.style.height=`${Math.round(d*f)}px`}else if(c){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,f=i/Math.max(1,d);s.style.height=`${i}px`,s.style.width=`${Math.round(u*f)}px`}else{let u=Math.round(s.naturalWidth*n),d=Math.round(s.naturalHeight*n);if(s.style.width=`${u}px`,s.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)}`,s.src=e}catch(f){P(t,"SVG width/height patch in toImg failed",f)}}return s}var Nn=z(()=>{J(),Ke()}),lr={};Fe(lr,{toBlob:()=>sr});async function sr(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 rt(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var cr=z(()=>{ot()}),ur={};Fe(ur,{download:()=>Ni});async function Tn(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 Ni(e,t){let n=(t?.format||t?.type||"").toLowerCase(),r=n==="jpg"?"jpeg":n||"png",i=t?.filename||`snapdom.${r}`,o={...t||{},format:r,type:r};o.dpr=1;let a=xi();if(r==="svg"){let s=await sr(e,{...o,type:"svg"});if(a&&await Tn(s,i))return;let u=URL.createObjectURL(s),d=document.createElement("a");d.href=u,d.download=i,document.body.appendChild(d),d.click(),URL.revokeObjectURL(u),d.remove();return}let c=await rt(e,o);if(a){let s=`image/${r}`,u=await new Promise(d=>c.toBlob(d,s,t?.quality));if(u&&await Tn(u,i))return}let l=document.createElement("a");l.href=c.toDataURL(`image/${r}`,t?.quality),l.download=i,document.body.appendChild(l),l.click(),l.remove()}var Ti=z(()=>{cr(),ot(),De()});J();J();K();var Rn=new WeakMap,Ft=new Map,Dt=0;function Re(){Dt++}var _n=!1;function Ri(e=document.documentElement){if(!_n){_n=!0;try{new MutationObserver(()=>Re()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Re()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",Re),t.ready?.then(()=>Re()).catch(()=>{}))}catch{}}}function _i(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(zt(f)||i&&(i instanceof RegExp&&i.test(f)||typeof i=="function"&&i(f)))continue;let p=e.getPropertyValue(f);(f==="background-image"||f==="content")&&p.includes("url(")&&!p.includes("data:")&&(p="none"),n[f]=p}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 p=e.getPropertyValue(f);p&&(n[f]=p)}catch{}}r==="hidden"&&(n.opacity="0");let c=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,s=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(c===0&&l===0&&s===0&&u===0){let d=(e.getPropertyValue("border-image-source")||"").trim(),f=d&&d!=="none",p=["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 p)delete n[g];f||(n.border="none")}return n}var Pn=new WeakMap;function Pi(e){let t=Pn.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(";"),Pn.set(e,t),t)}function Fi(e,t=null,n={}){let r=Rn.get(e);if(r&&r.epoch===Dt)return r.snapshot;let i=t||getComputedStyle(e),o=_i(i,n);return Ui(e,i,o),Rn.set(e,{epoch:Dt,snapshot:o}),o}function Di(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Ft,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:Ft,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function Ii(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=Di(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&Ri(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Re(),Ft.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:c}=i;a.styleCache.has(e)||a.styleCache.set(e,getComputedStyle(e));let l=a.styleCache.get(e);e.getAttribute?.("style")&&Ii(e,t,l);let s=Fi(e,l,i.options),u=Pi(s),d=c.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=Rt(s,f),c.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function Oi(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Hi(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 Wi(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Bi(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 Ui(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")||Oi(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||Hi(t)||Wi(e))return;let c=t.overflowX||t.overflow||"visible",l=t.overflowY||t.overflow||"visible";if(c!=="visible"||l!=="visible")return;let s=t.clip;s&&s!=="auto"&&s!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||Bi(e,t)&&(delete n.height,delete n["block-size"])}nr();var dr=["fill","stroke","color","background-color","stop-color"],Fn=new Map;function qi(e,t){let n=t+"::"+e.toLowerCase(),r=Fn.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 c=getComputedStyle(o),l={};for(let s of dr)l[s]=c.getPropertyValue(s)||"";return a.remove(),Fn.set(n,l),l}function ji(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 c=o[a];if(c&&typeof c.value=="string"&&c.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)for(let a=0;a<o.length;a++){let c=o[a],l=o.getPropertyValue(c);if(!l||!l.includes("var("))continue;let s=i&&i.getPropertyValue(c);if(s)try{t.style.setProperty(c,s.trim(),o.getPropertyPriority(c))}catch{}}}if(r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(!c||typeof c.value!="string"||!c.value.includes("var("))continue;let l=c.name,s=i&&i.getPropertyValue(l);if(s)try{t.style.setProperty(l,s.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=qi(e.tagName,o);for(let c of dr){let l=i.getPropertyValue(c)||"",s=a[c]||"";if(l&&l!==s)try{t.style.setProperty(c,l.trim())}catch{}}}}J();J();K();ke();function Lt(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){Se(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function zi(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Vi(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?zi(r):r;return`:where(${t} ${i})`}).join(", ")}function Yi(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=Vi(o,t,!0);return`${r}${i}${a}{`}),e):""}function Xi(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Gi(e){let t="";try{e.querySelectorAll("style").forEach(r=>{t+=(r.textContent||"")+`
|
|
1
|
+
"use strict";var __MindStudioBrowserAgent=(()=>{var xt=Object.defineProperty;var Io=Object.getOwnPropertyDescriptor;var Oo=Object.getOwnPropertyNames;var Ho=Object.prototype.hasOwnProperty;var Wo=(e,t)=>{for(var n in t)xt(e,n,{get:t[n],enumerable:!0})},Bo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oo(t))!Ho.call(e,i)&&i!==n&&xt(e,i,{get:()=>t[i],enumerable:!(r=Io(t,i))||r.enumerable});return e};var Uo=e=>Bo(xt({},"__esModule",{value:!0}),e);var Ns={};Wo(Ns,{executeSteps:()=>pt,getRefMap:()=>Se,resolveElement:()=>oe,takeSnapshot:()=>Ee,takeSnapshotSync:()=>Mt});var vt="__ms";function qo(){return{ws:{ws:null,clientId:null,reconnectDelay:1e3,closing:!1,busy:!1},cursor:{el:null,rippleEl:null,x:0,y:0,visible:!1,hasPosition:!1,hideTimer:null,forcedState:null,executing:!1,targetElement:null,trackingFrame:null,settledResolve: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},fonts:{initialized:!1,observer:null},zoom:{pipMode:!1}}}function k(){let e=window;return e[vt]||(e[vt]=qo()),e[vt]}var an="/__mindstudio_dev__/logs",jo=2e3;function ln(e){k().transport.wsGetter=e}function sn(){let e=k().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",an,!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify(t))}catch{}}function Vo(){let e=k().transport;e.flushTimer||(e.flushTimer=setTimeout(()=>{e.flushTimer=null,sn()},jo))}function zo(){let e=k().transport;e.flushTimer&&(clearTimeout(e.flushTimer),e.flushTimer=null),sn()}function j(e){let t=k().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),Vo()}function St(e){let t=k().transport;t.buffer.push(e),t.capturing&&t.captured.push(e),zo()}function Et(){let e=k().transport;e.capturing=!0,e.captured=[]}function Ct(){let e=k().transport;e.capturing=!1;let t=e.captured;return e.captured=[],t}function cn(){window.addEventListener("beforeunload",()=>{let e=k().transport;e.buffer.length>0&&navigator.sendBeacon&&navigator.sendBeacon(an,JSON.stringify(e.buffer))})}var Yo={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 me(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 Yo[n]??null}function un(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 ve(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?pe(c):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=Xo(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 pe(a)}let i=pe(e);if(i)return i;let o=e.getAttribute("title");return o?o.trim():""}function pe(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(Ko(r))continue;let i=Go(r),o=pe(r);o&&(i&&t.length>0&&t.push(" "),t.push(o),i&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function Xo(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return pe(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 Go(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 Ko(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 kt(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 Ye(){k().networkIdle.activeRequests++}function Re(){let e=k().networkIdle;e.activeRequests=Math.max(0,e.activeRequests-1)}function dn(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}k().networkIdle.activeRequests===0?o||(o=setTimeout(()=>{k().networkIdle.activeRequests===0?n():(o=null,a())},t)):(o&&(clearTimeout(o),o=null),setTimeout(a,50))}a()})}function Se(){return k().snapshot.refMap}async function Ee(){return await dn(),Mt()}function Mt(){let e=k().snapshot;e.refCounter=0,e.refMap=new Map;let t=document.body;if(!t)return"(empty page)";let n=fn(t);return At(n,0).trimEnd()}function V(e){let t=me(e),n=ve(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 fn(e){if(Zo(e))return[];let t=me(e),n=!t&&un(e),r=t||(n?"clickable":null),i="";if(r){i=ve(e);let u=kt(e,"::before"),d=kt(e,"::after");(u||d)&&(i=[u,i,d].filter(Boolean).join(" ")),i.length>80&&(i=i.slice(0,77)+"...")}let o=Qo(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=k().snapshot;u.refCounter++,c=`e${u.refCounter}`,u.refMap.set(c,e)}let l=Jo(e);if(r){let u=l.length===0?"":At(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=pe(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return l}function Jo(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...fn(n));return t}function Zo(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 Qo(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 At(e,t){let n="";for(let r of e)n+=ei(r,t);return n}function ei(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+=At(e.children,o),i}function mn(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))}var ti=["log","info","warn","error","debug"];function pn(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of ti){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),j({type:"console",level:e,args:n.map(mn),url:location.href})}}}}function hn(){window.addEventListener("error",e=>{St({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||{};St({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})})}function gn(){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 Ye(),e.apply(this,[t,n]).then(a=>{Re();let s={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)j(s);else try{a.clone().text().then(c=>{s.body=c.slice(0,1e3),j(s)}).catch(()=>j(s))}catch{j(s)}return a},a=>{throw Re(),j({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function yn(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);j({type:"interaction",event:"click",target:V(t),text:n,url:location.href})},!0))}function wn(){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 Ye(),this.addEventListener("loadend",function(){Re(),j({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"})}),n.apply(this,[r])},XMLHttpRequest.prototype.open.__ms_patched=!0}function oe(e){let t=null;if(e.ref){let n=Se(),r=n.get(e.ref);if(r&&r.isConnected)if(re(r))t={element:r,matched:`${V(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${$t(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&re(o)).slice(0,10).map(([o,a])=>`${V(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=bn(n,r);if(i.length===0){let o=bn(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${$t(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=xn(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(vn),a=o.length===1?o[0]:i[0];t={element:a,matched:V(a)}}else t={element:i[0],matched:V(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=ni(n);if(r.length===0){let i=xn(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:V(r[0])}}if(!t&&e.label){let n=e.label,r=ri(n);if(!r){let i=[...document.querySelectorAll("label")].filter(re).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:`${V(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(!re(r))throw new Error(`Found element for selector "${n}" but it is hidden (${$t(r)}).`);t={element:r,matched:`${V(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function bn(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!re(o)||n&&!o.isConnected||t&&me(o)!==t)continue;if(ve(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function ni(e){let t=[];for(let n of document.querySelectorAll("*"))re(n)&&me(n)===e&&t.push(n);return t}function ri(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&&re(a))return a}let o=n.querySelector("input, textarea, select");if(o&&re(o))return o}return null}function re(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 vn(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 $t(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 xn(e){let t=[];for(let n of document.querySelectorAll("*"))if(re(n)&&(e?me(n)===e&&t.push(n):vn(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${ve(n).slice(0,40)||V(n)}"`).join(", ")}function Lt(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 oi=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,ii=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function Cn(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),Lt(e),n.clear&&(Sn(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})),Sn(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(ai(i,t.length))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function ai(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 Sn(e,t){let n=e instanceof HTMLTextAreaElement?ii:oi;n?n.call(e,t):e.value=t}async function kn(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...oe(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 En=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function Mn(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 En?En.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 An(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 si=Object.defineProperty,q=(e,t)=>()=>(e&&(t=e(e=0)),t),He=(e,t)=>{for(var n in t)si(e,n,{get:t[n],enumerable:!0})};function ci(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 ui(e="soft"){switch(C.session.__counterEpoch=(C.session.__counterEpoch||0)+1,e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.baseStyle=new z(50),C.defaultStyle=new z(30),C.image=new z(100),C.background=new z(100),C.resource=new z(150),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var z,C,G=q(()=>{z=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)}},C={image:new z(100),background:new z(100),resource:new z(150),defaultStyle:new z(30),baseStyle:new z(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function jt(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function di(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 tt(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function fi(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 rt=q(()=>{});function mi(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 pi(e){return/^data:|^blob:|^about:blank$/i.test(e)}function hi(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 gi(e,t){if(!t||pi(e)||hi(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}",tt(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}${tt(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function $n(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 wi(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function X(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:([^,]*),(.*)$/)||[],v=/;base64/i.test(p)?atob(y):decodeURIComponent(y),x=new Uint8Array([...v].map(S=>S.charCodeAt(0))),w=new Blob([x],{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(),v=y.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await $n(y),status:p.status,url:e,fromCache:!1,mime:v}:n==="text"?{ok:!0,data:await y.text(),status:p.status,url:e,fromCache:!1,mime:v}:{ok:!0,data:y,status:p.status,url:e,fromCache:!1,mime:v}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let c=wi(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),l=Pe.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&Pe.delete(c);let u=Ge.get(c);if(u)return u;let d=gi(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 x={ok:!1,data:null,status:p.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&Pe.set(c,{until:Date.now()+o,result:x}),!s){let w=`${p.status} ${p.statusText||""}`.trim();Rt.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(x),x}if(n==="text")return{ok:!0,data:await p.text(),status:p.status,url:d,fromCache:!1};let y=await p.blob(),v=y.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await $n(y),status:p.status,url:d,fromCache:!1,mime:v}:{ok:!0,data:y,status:p.status,url:d,fromCache:!1,mime:v}}catch(p){let y=p&&typeof p=="object"&&"name"in p&&p.name==="AbortError"?String(p.message||"").includes("timeout")?"timeout":"abort":"network",v={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&Pe.set(c,{until:Date.now()+o,result:v}),!s){let x=`${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`;Rt.errorOnce(x,w)}return t.onError&&t.onError(v),v}finally{clearTimeout(g),Ge.delete(c)}})();return Ge.set(c,h),h}var Rt,Ge,Pe,$e=q(()=>{rt(),Rt=mi("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Ge=new Map,Pe=new Map});async function Zn(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=jt(e);if(!n)return e;let r=fi(n),i=tt(r);if(C.background.has(i)){let o=C.background.get(i);return o?`url("${o}")`:"none"}try{let o=await X(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(C.background.set(i,o.data),`url("${o.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var bi=q(()=>{G(),rt(),$e()});function xi(e){if(e=String(e).toLowerCase(),zt.has(e)){let o={};return C.defaultStyle.set(e,o),o}if(C.defaultStyle.has(e))return C.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(Vt(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),C.defaultStyle.set(e,i),i}function Vt(e){let t=String(e).toLowerCase();return!!(nr.has(t)||tr.test(t)||er.test(t))}function _t(e,t){if(t=String(t||"").toLowerCase(),zt.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(Vt(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 vi(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 Si(e){let t=new Map;for(let r of e){let i=C.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 Ei(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 Ci(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 ae(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=C.computedStyle.get(e);r||(r=new Map,C.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=Ci(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 Ln(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function Pt(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 Qn,zt,ki,er,tr,nr,rr=q(()=>{G(),Qn=new Set(["meta","script","noscript","title","link","template"]),zt=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"]),ki=["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"],er=/(?:^|-)(animation|transition)(?:-|$)/i,tr=/^(--.+|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,nr=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 Me(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function Mi(){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 ge(){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 Ai(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var We=q(()=>{});function _(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 or=q(()=>{}),J=q(()=>{bi(),rr(),We(),rt(),or()}),ir={};He(ir,{toCanvas:()=>ot});function $i(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function Li(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function Ni(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function Ti(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 Ri(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 ar(e){let t=Ti(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=Ri(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 _i(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${ar(r)}}`)}function Pi(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,_i(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${ar(r)}${n}`),e}function Fi(e){if(!ge()||!$i(e))return e;try{let t=Li(e),n=Pi(t);return Ni(n)}catch{return e}}async function ot(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:s}=t;e=Fi(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 x=n/Math.max(1,d);m=n,g=f*x}else if(p){let x=r/Math.max(1,f);g=r,m=d*x}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 v=y.getContext("2d");return o!==1&&v.scale(o,o),s&&(v.save(),v.fillStyle=s,v.fillRect(0,0,m,g),v.restore()),v.drawImage(c,0,0,m,g),y}var it=q(()=>{We()}),Ke={};He(Ke,{rasterize:()=>lr});async function lr(e,t){let n=await ot(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 Je=q(()=>{it()}),Ft={};He(Ft,{toImg:()=>Nn,toSvg:()=>Nn});async function Nn(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(ge()&&c)return await lr(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){_(t,"SVG width/height patch in toImg failed",f)}}return l}var Tn=q(()=>{J(),Je()}),sr={};He(sr,{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 ot(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var ur=q(()=>{it()}),dr={};He(dr,{download:()=>Di});async function Rn(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 Di(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=Mi();if(a==="svg"){let f=await cr(e,{...c,type:"svg"});if(l&&await Rn(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 ot(e,c);if(l){let f=`image/${a}`,m=await new Promise(g=>u.toBlob(g,f,t?.quality));if(m&&await Rn(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 Ii=q(()=>{ur(),it(),We()});J();J();G();var _n=new WeakMap,Ie=new Map,Oi=2e3,Dt=0;function Fe(){Dt++,Ie.size>Oi&&Ie.clear()}var Pn=!1;function Hi(e=document.documentElement){if(!Pn){Pn=!0;try{new MutationObserver(()=>Fe()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Fe()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",Fe),t.ready?.then(()=>Fe()).catch(()=>{}))}catch{}}}function Wi(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(Vt(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 Fn=new WeakMap;function Bi(e){let t=Fn.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(";"),Fn.set(e,t),t)}function Ui(e,t=null,n={}){let r=_n.get(e);if(r&&r.epoch===Dt)return r.snapshot;let i=t||getComputedStyle(e),o=Wi(i,n);return Gi(e,i,o),_n.set(e,{epoch:Dt,snapshot:o}),o}function qi(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Ie,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:Ie,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function ji(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 he(e,t,n,r){if(e.tagName==="STYLE")return;let i=qi(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&Hi(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Fe(),Ie.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")&&ji(e,t,c);let l=Ui(e,c,i.options),u=Bi(l),d=s.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=_t(l,f),s.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function Vi(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function zi(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 Yi(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Xi(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 Gi(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")||Vi(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||zi(t)||Yi(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"||Xi(e,t)&&(delete n.height,delete n["block-size"])}rr();var fr=["fill","stroke","color","background-color","stop-color"],Dn=new Map;function Ki(e,t){let n=t+"::"+e.toLowerCase(),r=Dn.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 fr)c[l]=s.getPropertyValue(l)||"";return a.remove(),Dn.set(n,c),c}function Ji(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=Ki(e.tagName,o);for(let s of fr){let c=i.getPropertyValue(s)||"",l=a[s]||"";if(c&&c!==l)try{t.style.setProperty(s,c.trim())}catch{}}}}J();J();G();$e();function Nt(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){Me(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function Zi(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Qi(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?Zi(r):r;return`:where(${t} ${i})`}).join(", ")}function ea(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=Qi(o,t,!0);return`${r}${i}${a}{`}),e):""}function ta(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function na(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
|
|
6
|
-
`:""}function ta(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 na(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 ra(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let l=getComputedStyle(e);n=parseFloat(l.borderLeftWidth)||0,r=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(n+r))),c=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:c,rect:t}}function ne(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 ia(e,t,n){let r=await na(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=ra(e),c=n?.snap;if(!c&&typeof window<"u"&&window.snapdom&&(c=window.snapdom),!c||typeof c.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 l={...n,scale:1},s=oa(r,i,o),u;try{u=await c.toPng(r.documentElement,l)}finally{s()}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 aa(e){let{width:t,height:n}=ne(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,c=Math.round(t||r.width||0),l=Math.round(n||r.height||0),s=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),d=(e.type||"text").toLowerCase()==="checkbox",f=!!e.checked,p=!!e.indeterminate,g=Math.max(Math.min(s,u),12),h=document.createElement("div");h.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),h.style.cssText=`display:inline-block;width:${g}px;height:${g}px;vertical-align:middle;flex-shrink:0;line-height:0;`;let m=document.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("width",String(g)),m.setAttribute("height",String(g)),m.setAttribute("viewBox",`0 0 ${g} ${g}`),h.appendChild(m);function y(){let x="#0a6ed1";try{i&&(x=i.accentColor||i.color||x)}catch{}let b=2,w=b/2,E=g-b;if(m.innerHTML="",d){let S=document.createElementNS("http://www.w3.org/2000/svg","rect");if(S.setAttribute("x",String(w)),S.setAttribute("y",String(w)),S.setAttribute("width",String(E)),S.setAttribute("height",String(E)),S.setAttribute("rx","2"),S.setAttribute("ry","2"),S.setAttribute("fill",f?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(b)),m.appendChild(S),f){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",`M ${w+2} ${g/2} L ${g/2-1} ${g-w-2} L ${g-w-2} ${w+2}`),v.setAttribute("stroke","white"),v.setAttribute("stroke-width",String(Math.max(1.5,b))),v.setAttribute("fill","none"),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round"),m.appendChild(v)}else if(p){let v=document.createElementNS("http://www.w3.org/2000/svg","rect"),M=Math.max(6,E-4);v.setAttribute("x",String((g-M)/2)),v.setAttribute("y",String((g-b)/2)),v.setAttribute("width",String(M)),v.setAttribute("height",String(b)),v.setAttribute("fill",x),v.setAttribute("rx","1"),m.appendChild(v)}}else{let S=document.createElementNS("http://www.w3.org/2000/svg","circle");if(S.setAttribute("cx",String(g/2)),S.setAttribute("cy",String(g/2)),S.setAttribute("r",String((g-b)/2)),S.setAttribute("fill",f?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(b)),m.appendChild(S),f){let v=document.createElementNS("http://www.w3.org/2000/svg","circle"),M=Math.max(2,(g-b*2)*.35);v.setAttribute("cx",String(g/2)),v.setAttribute("cy",String(g/2)),v.setAttribute("r",String(M)),v.setAttribute("fill","white"),m.appendChild(v)}}h.style.setProperty("width",`${g}px`,"important"),h.style.setProperty("height",`${g}px`,"important"),h.style.setProperty("min-width",`${g}px`,"important"),h.style.setProperty("min-height",`${g}px`,"important")}return y(),{el:h,applyVisual:y}}var Ne=new X(80);async function _e(e){if(C.resource?.has(e))return C.resource.get(e);if(Ne.has(e))return Ne.get(e);let t=(async()=>{let n=await G(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.resource?.set(e,n.data),n.data})();Ne.set(e,t);try{let n=await t;return Ne.set(e,n),n}catch(n){throw Ne.delete(e),n}}var la=/\bblob:[^)"'\s]+/g;async function Dn(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(la)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await _e(r);n=n.split(r).join(i)}catch{}return n}function Ye(e){return typeof e=="string"&&e.startsWith("blob:")}function sa(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 ca(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function ua(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll("img"):[];for(let l of r)try{let s=l.getAttribute("src")||l.currentSrc||"";if(Ye(s)){let d=await _e(s);l.setAttribute("src",d)}let u=l.getAttribute("srcset");if(u&&u.includes("blob:")){let d=sa(u),f=!1;for(let p of d)if(Ye(p.url))try{p.url=await _e(p.url),f=!0}catch(g){P(n,"blobUrlToDataUrl for srcset item failed",g)}f&&l.setAttribute("srcset",ca(d))}}catch(s){P(n,"resolveBlobUrls for img failed",s)}let i=e.querySelectorAll?e.querySelectorAll("image"):[];for(let l of i)try{let s="http://www.w3.org/1999/xlink",u=l.getAttribute("href")||l.getAttributeNS?.(s,"href");if(Ye(u)){let d=await _e(u);l.setAttribute("href",d),l.removeAttributeNS?.(s,"href")}}catch(s){P(n,"resolveBlobUrls for SVG image href failed",s)}let o=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let l of o)try{let s=l.getAttribute("style");if(s&&s.includes("blob:")){let u=await Dn(s);l.setAttribute("style",u)}}catch(s){P(n,"replaceBlobUrls in inline style failed",s)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let s=l.textContent||"";s.includes("blob:")&&(l.textContent=await Dn(s))}catch(s){P(n,"replaceBlobUrls in style tag failed",s)}let c=["poster"];for(let l of c){let s=e.querySelectorAll?e.querySelectorAll(`[${l}^='blob:']`):[];for(let u of s)try{let d=u.getAttribute(l);Ye(d)&&u.setAttribute(l,await _e(d))}catch(d){P(n,`resolveBlobUrls for ${l} failed`,d)}}}De();async function Je(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")||Zn.has(u))return 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}=ne(e),p=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${p}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:p}=ne(e),g=f||e.getBoundingClientRect().width||0,h=p||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}=ne(e),p=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${p}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){P(t,"iframe same-origin probe failed",d)}if(u)try{return await ia(e,t,n)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(n.placeholders){let{width:d,height:f}=ne(e),p=document.createElement("div");return p.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,p,t,n),p}else{let{width:d,height:f}=ne(e),p=document.createElement("div");return p.style.cssText=`display:inline-block;width:${d}px;height:${f}px;visibility:hidden;`,Ee(e,p,t,n),p}}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 m=h.getContext("2d");m&&(m.drawImage(e,0,0),u=h.toDataURL("image/png"))}}}catch(g){P(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){P(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:f,height:p}=ne(e);return f>0&&(d.style.width=`${f}px`),p>0&&(d.style.height=`${p}px`),t.nodeMap.set(d,e),Ee(e,d,t,n),d}let a;try{if(a=e.cloneNode(!1),ji(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Ji(e,a);try{let{width:u,height:d}=ne(e),f=Math.round(u||0),p=Math.round(d||0);f&&(a.dataset.snapdomWidth=String(f)),p&&(a.dataset.snapdomHeight=String(p))}catch(u){P(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),f=y=>{let x=u.match(new RegExp(`${y}\\s*:\\s*([^;]+)`,"i")),b=x?x[1].trim():d.getPropertyValue(y);return/%|auto/i.test(String(b||""))},p=parseInt(a.dataset.snapdomWidth||"0",10),g=parseInt(a.dataset.snapdomHeight||"0",10),h=f("width")||!p,m=f("height")||!g;h&&p&&(a.style.width=`${p}px`),m&&g&&(a.style.height=`${g}px`),p&&(a.style.minWidth=`${p}px`),g&&(a.style.minHeight=`${g}px`)}catch(u){P(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let c=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=ne(e),f=u||e.getBoundingClientRect().width||0,p=d||e.getBoundingClientRect().height||0;f&&(a.style.width=`${f}px`),p&&(a.style.height=`${p}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&vi()){let{el:d,applyVisual:f}=aa(e);t.nodeMap.set(d,e),c=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 HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=e.value),Ee(e,a,t,n),c&&c(),e.shadowRoot){let u=function(b,w){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return w(null);Je(b,t,n).then(E=>{w(E||null)}).catch(()=>{w(null)})};try{let b=e.shadowRoot.querySelectorAll("slot");for(let w of b){let E=[];try{E=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{E=w.assignedNodes?.()||[]}for(let S of E)r.add(S)}}catch{}let d=Xi(t),f=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let p=Gi(e.shadowRoot),g=Yi(p,f),h=Zi(p),m=ea(e,h,f);Ki(a,m+g,d);let y=document.createDocumentFragment(),x=await Lt(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,m){Je(h,t,n).then(y=>{y&&ta(y),m(y||null)}).catch(()=>{m(null)})},d=e.assignedNodes?.({flatten:!0})||[],f=d.length>0?d:Array.from(e.childNodes),p=document.createDocumentFragment(),g=await Lt(Array.from(f),u,n.fast);return p.append(...g.filter(h=>!!h)),p}function l(u,d){if(r.has(u))return d(null);Je(u,t,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let s=await Lt(Array.from(e.childNodes),l,n.fast);if(a.append(...s.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}J();nt();K();var da=[/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],xe=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__||{}),It=[];function fa(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?It.push(n):typeof n=="string"?It.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function re(e){let t=typeof e=="string"?e:"",n=[...da,...It];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 ma(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var In=new Map;function pa(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 ha(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),c="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?c="rounded":/\bsharp\b/.test(o)?c="sharp":/\boutlined\b/.test(o)&&(c="outlined");let l=a===1,s=null;if(l&&(c==="outlined"&&xe.materialIconsFilled?s={url:xe.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&xe.materialIconsRound?s={url:xe.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&xe.materialIconsSharp&&(s={url:xe.materialIconsSharp,alias:"snapdom-mi-sharp"})),!s)return{familyForMeasure:r,familyForCanvas:r};if(!In.has(s.alias))try{let d=new FontFace(s.alias,`url(${s.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),In.set(s.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${s.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function ga(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function ya(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 wa(e,{family:t="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:a=""}={}){let c=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,s=pa(o),{familyForMeasure:u,familyForCanvas:d}=await ha(c,a,s);await ga(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 p=f.getBoundingClientRect(),g=Math.max(1,Math.ceil(p.width)),h=Math.max(1,Math.ceil(p.height));document.body.removeChild(f);let m=document.createElement("canvas");m.width=g*l,m.height=h*l;let y=m.getContext("2d");y.scale(l,l),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:m.toDataURL(),width:g,height:h}}async function ba(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 c=r[a],l=i[a]||null;try{let s=getComputedStyle(l||c),u=s.fontFamily||"Material Icons";if(!ma(u))continue;let d=(l||c).textContent.trim();if(!d)continue;let f=parseInt(s.fontSize,10)||24,p=s.fontWeight&&s.fontWeight!=="normal"?s.fontWeight:"normal",g=ya(s),h=s.fontVariationSettings&&s.fontVariationSettings!=="normal"?s.fontVariationSettings:"",m=(l||c).className||"",{dataUrl:y,width:x,height:b}=await wa(d,{family:u,weight:p,fontSize:f,color:g,variation:h,className:m});c.textContent="";let w=c.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(c).verticalAlign||"baseline",c.appendChild(w),o++}catch{}}return o}ke();async function xa(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 c=a.getBoundingClientRect(),l=Math.ceil(c.width),s=Math.ceil(c.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,l*o),u.height=Math.max(1,s*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:l,height:s}}var va=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),Sa=["katex","mathjax","mathml"];function it(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!va.has(n.toLowerCase()))return n}return""}function Ze(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 Qe(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function Ea(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function Ca(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=Ze(n[1]),o=Ze(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=Ze(t);return{min:r,max:r}}function ka(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Ma(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 Aa(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function $a(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)||Sa.some(a=>o.includes(a)))return!0;for(let a of t){let c=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),s=Aa(a);if(o.includes(c)||o.includes(l)||s&&o.includes(s))return!0}return!1}catch{return!1}}function La(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function On(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 Ot=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,tt=4;async function Na(e,t,n){if(!e)return e;let r=new Set;function i(c,l){try{return new URL(c,l||location.href).href}catch{return c}}async function o(c,l,s=0){if(s>tt)return console.warn(`[snapDOM] @import depth exceeded (${tt}) at ${l}`),c;let u="",d=0,f;for(;f=Ot.exec(c);){u+=c.slice(d,f.index),d=Ot.lastIndex;let p=(f[2]||f[4]||"").trim(),g=i(p,l);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let h="";try{let m=await G(g,{as:"text",useProxy:n,silent:!0});m.ok&&typeof m.data=="string"&&(h=m.data)}catch{}h?(h=On(h,g),h=await o(h,g,s+1),u+=`
|
|
5
|
+
`}catch{}}catch{}return t}function ra(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 oa(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 ia(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 aa(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 la(e,t,n){let r=[];for(let i of t){let o=aa(e,i);o&&r.push(`${i}: ${o};`)}return r.length?`${n}{${r.join("")}}
|
|
6
|
+
`:""}function sa(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 ca(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 ua(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 K(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 da(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 fa(e,t,n){let r=await ca(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=ua(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=da(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),he(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 ma(e){let{width:t,height:n}=K(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 v(){let x="#0a6ed1";try{i&&(x=i.accentColor||i.color||x)}catch{}let w=2,S=w/2,E=g-w;if(y.innerHTML="",d){let b=document.createElementNS("http://www.w3.org/2000/svg","rect");if(b.setAttribute("x",String(S)),b.setAttribute("y",String(S)),b.setAttribute("width",String(E)),b.setAttribute("height",String(E)),b.setAttribute("rx","2"),b.setAttribute("ry","2"),b.setAttribute("fill",f?x:"none"),b.setAttribute("stroke",x),b.setAttribute("stroke-width",String(w)),y.appendChild(b),f){let M=document.createElementNS("http://www.w3.org/2000/svg","path");M.setAttribute("d",`M ${S+2} ${g/2} L ${g/2-1} ${g-S-2} L ${g-S-2} ${S+2}`),M.setAttribute("stroke","white"),M.setAttribute("stroke-width",String(Math.max(1.5,w))),M.setAttribute("fill","none"),M.setAttribute("stroke-linecap","round"),M.setAttribute("stroke-linejoin","round"),y.appendChild(M)}else if(m){let M=document.createElementNS("http://www.w3.org/2000/svg","rect"),T=Math.max(6,E-4);M.setAttribute("x",String((g-T)/2)),M.setAttribute("y",String((g-w)/2)),M.setAttribute("width",String(T)),M.setAttribute("height",String(w)),M.setAttribute("fill",x),M.setAttribute("rx","1"),y.appendChild(M)}}else{let b=document.createElementNS("http://www.w3.org/2000/svg","circle");if(b.setAttribute("cx",String(g/2)),b.setAttribute("cy",String(g/2)),b.setAttribute("r",String((g-w)/2)),b.setAttribute("fill",f?x:"none"),b.setAttribute("stroke",x),b.setAttribute("stroke-width",String(w)),y.appendChild(b),f){let M=document.createElementNS("http://www.w3.org/2000/svg","circle"),T=Math.max(2,(g-w*2)*.35);M.setAttribute("cx",String(g/2)),M.setAttribute("cy",String(g/2)),M.setAttribute("r",String(T)),M.setAttribute("fill","white"),y.appendChild(M)}}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 v(),{el:p,applyVisual:v}}var _e=new z(80);async function De(e){if(C.resource?.has(e))return C.resource.get(e);if(_e.has(e))return _e.get(e);let t=(async()=>{let n=await X(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.resource?.set(e,n.data),n.data})();_e.set(e,t);try{let n=await t;return _e.set(e,n),n}catch(n){throw _e.delete(e),n}}var pa=/\bblob:[^)"'\s]+/g;async function In(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(pa)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await De(r);n=n.split(r).join(i)}catch{}return n}function Xe(e){return typeof e=="string"&&e.startsWith("blob:")}function ha(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 ga(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(Xe(l)){let d=await De(l);c.setAttribute("src",d)}let u=c.getAttribute("srcset");if(u&&u.includes("blob:")){let d=ha(u),f=!1;for(let m of d)if(Xe(m.url))try{m.url=await De(m.url),f=!0}catch(g){_(n,"blobUrlToDataUrl for srcset item failed",g)}f&&c.setAttribute("srcset",ga(d))}}catch(l){_(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(Xe(u)){let d=await De(u);c.setAttribute("href",d),c.removeAttributeNS?.(l,"href")}}catch(l){_(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 In(l);c.setAttribute("style",u)}}catch(l){_(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 In(l))}catch(l){_(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);Xe(d)&&u.setAttribute(c,await De(d))}catch(d){_(n,`resolveBlobUrls for ${c} failed`,d)}}}We();async function Ze(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")||Qn.has(u))return null;if(u==="foreignobject"&&e.parentElement?.closest?.("foreignObject"))return _(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}=K(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}=K(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}=K(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){_(t,"iframe same-origin probe failed",d)}if(u)try{return await fa(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}=K(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;`,he(e,m,t,n),m}else{let{width:d,height:f}=K(e),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${d}px;height:${f}px;visibility:hidden;`,he(e,m,t,n),m}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),he(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){_(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){_(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:f,height:m}=K(e);return f>0&&(d.style.width=`${f}px`),m>0&&(d.style.height=`${m}px`),t.nodeMap.set(d,e),he(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){_(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}=K(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),he(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(Ji(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){oa(e,a);try{let{width:u,height:d}=K(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){_(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),f=x=>{let w=u.match(new RegExp(`${x}\\s*:\\s*([^;]+)`,"i")),S=w?w[1].trim():d.getPropertyValue(x);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"),v=d.getPropertyValue("object-position");y&&y!=="fill"?(a.style.objectFit=y,v&&(a.style.objectPosition=v)):(m&&(a.style.minWidth=`${m}px`),g&&(a.style.minHeight=`${g}px`))}catch(u){_(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}=K(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")&&Ai()){let{el:d,applyVisual:f}=ma(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(he(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(x,w){if(x.nodeType===Node.ELEMENT_NODE&&x.tagName==="STYLE")return w(null);Ze(x,t,n).then(S=>{w(S||null)}).catch(()=>{w(null)})};try{let x=e.shadowRoot.querySelectorAll("slot");for(let w of x){let S=[];try{S=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{S=w.assignedNodes?.()||[]}for(let E of S)r.add(E)}}catch{}let d=ta(t),f=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let m=na(e.shadowRoot),g=ea(m,f),h=ia(m),p=la(e,h,f);ra(a,p+g,d);let y=document.createDocumentFragment(),v=await Nt(Array.from(e.shadowRoot.childNodes),u,n.fast);y.append(...v.filter(x=>!!x)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=function(h,p){Ze(h,t,n).then(y=>{y&&sa(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 Nt(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);Ze(u,t,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let l=await Nt(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}J();rt();G();var wa=[/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],Ce=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__||{}),It=[];function ba(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?It.push(n):typeof n=="string"?It.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function ie(e){let t=typeof e=="string"?e:"",n=[...wa,...It];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 On=new Map;function va(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 Sa(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"&&Ce.materialIconsFilled?l={url:Ce.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&Ce.materialIconsRound?l={url:Ce.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&Ce.materialIconsSharp&&(l={url:Ce.materialIconsSharp,alias:"snapdom-mi-sharp"})),!l)return{familyForMeasure:r,familyForCanvas:r};if(!On.has(l.alias))try{let d=new FontFace(l.alias,`url(${l.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),On.set(l.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${l.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function Ea(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function Ca(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 ka(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=va(o),{familyForMeasure:u,familyForCanvas:d}=await Sa(s,a,l);await Ea(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 Ma(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=Ca(l),h=l.fontVariationSettings&&l.fontVariationSettings!=="normal"?l.fontVariationSettings:"",p=(c||s).className||"",{dataUrl:y,width:v,height:x}=await ka(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(v/x*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(s).verticalAlign||"baseline",s.appendChild(w),o++}catch{}}return o}$e();async function Aa(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 mr=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),$a=["katex","mathjax","mathml"];function Yt(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!mr.has(n.toLowerCase()))return n}return""}function La(e){if(!e)return[];let t=[];for(let n of e.split(",")){let r=n.trim().replace(/^['"]+|['"]+$/g,"");r&&(mr.has(r.toLowerCase())||t.push(r))}return t}function Qe(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 et(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function Na(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function Ta(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=Qe(n[1]),o=Qe(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=Qe(t);return{min:r,max:r}}function Ra(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function _a(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 Pa(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function Fa(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)||$a.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=Pa(a);if(o.includes(s)||o.includes(c)||l&&o.includes(l))return!0}return!1}catch{return!1}}function Da(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function Hn(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 Ot=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,nt=4;async function Ia(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>nt)return console.warn(`[snapDOM] @import depth exceeded (${nt}) at ${c}`),s;let u="",d=0,f;for(;f=Ot.exec(s);){u+=s.slice(d,f.index),d=Ot.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 X(g,{as:"text",useProxy:n,silent:!0});p.ok&&typeof p.data=="string"&&(h=p.data)}catch{}h?(h=Hn(h,g),h=await o(h,g,l+1),u+=`
|
|
7
7
|
/* inlined: ${g} */
|
|
8
8
|
${h}
|
|
9
|
-
`):u+=f[0]}return u+=c.slice(d),u}let a=On(e,t||location.href);return a=await o(a,t||location.href,0),a}var fr=/url\((["']?)([^"')]+)\1\)/g,Ta=/@font-face[^{}]*\{[^}]*\}/g;function mr(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],c=l=>{if(!l.includes("?"))return parseInt(l,16);let s=parseInt(l.replace(/\?/g,"0"),16),u=parseInt(l.replace(/\?/g,"F"),16);return[s,u]};if(a){let l=c(o),s=c(a),u=Array.isArray(l)?l[0]:l,d=Array.isArray(s)?s[1]:s;t.push([Math.min(u,d),Math.max(u,d)])}else{let l=c(o);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function pr(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 Yt(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(fr)){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 hr(e,t,n=""){let r=e;for(let i of e.matchAll(fr)){let o=jt(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(!re(a)){if(C.resource?.has(a)){C.font?.add(a),r=r.replace(i[0],`url(${C.resource.get(a)})`);continue}if(!C.font?.has(a))try{let c=await G(a,{as:"dataURL",useProxy:n,silent:!0});if(c.ok&&typeof c.data=="string"){let l=c.data;C.resource?.set(a,l),C.font?.add(a),r=r.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function Ra(e){if(!e.length)return null;let t=(a,c)=>e.some(([l,s])=>!(s<a||l>c)),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 Hn(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=Ra(o);if(a&&r.has(a))return!0}return!1}}function _a(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]||"",c=it(a),l=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),s=(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(),p=Yt(f,location.href),g=p.length?p.map(m=>String(m).toLowerCase()).sort().join("|"):f.toLowerCase(),h=[String(c||"").toLowerCase(),l,s,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 Pa(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()}):"",c=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),l=r||"",s=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${c}::px=${l}::fd=${s}`}async function gr(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let o=(a,c)=>{try{return new URL(a,c||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let c=a.href?o(a.href,t):t;if(r.depth>=tt){console.warn(`[snapDOM] CSSOM import depth exceeded (${tt}) at ${c}`);continue}if(c&&r.visitedSheets.has(c)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${c}`);continue}c&&r.visitedSheets.add(c);let l={...r,depth:(r.depth||0)+1};await gr(a.styleSheet,c,n,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let c=(a.style.getPropertyValue("font-family")||"").trim(),l=it(c);if(!l||re(l))continue;let s=(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(),p=(a.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(l,u,s,d))continue;let g=mr(p);if(!pr(r.usedCodepoints,g))continue;let h={family:l,weightSpec:s,styleSpec:u,stretchSpec:d,unicodeRange:p,srcRaw:f,srcUrls:Yt(f,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(h,g))continue;if(/url\(/i.test(f)){let m=await hr(f,t||location.href,r.useProxy);await n(`@font-face{font-family:${l};src:${m};font-style:${u};font-weight:${s};font-stretch:${d};${p?`unicode-range:${p};`:""}}`)}else await n(`@font-face{font-family:${l};src:${f};font-style:${u};font-weight:${s};font-stretch:${d};${p?`unicode-range:${p};`:""}}`)}}}async function Fa({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 m of e){let[y,x,b,w]=String(m).split("__");if(!y)continue;let E=a.get(y)||[];E.push({w:parseInt(x,10),s:b,st:parseInt(w,10)}),a.set(y,E)}function c(m,y,x,b){if(!a.has(m))return!1;let w=a.get(m),E=Ca(x),S=ka(y),v=Ma(b),M=E.min!==E.max,N=E.min,O=L=>S.kind==="normal"&&L==="normal"||S.kind!=="normal"&&(L==="italic"||L==="oblique"),F=!1;for(let L of w){let $=M?L.w>=E.min&&L.w<=E.max:L.w===N,D=O(Qe(L.s)),B=L.st>=v.min&&L.st<=v.max;if($&&D&&B){F=!0;break}}if(F)return!0;if(!M)for(let L of w){let $=O(Qe(L.s)),D=L.st>=v.min&&L.st<=v.max;if(Math.abs(N-L.w)<=300&&$&&D)return!0}if(!M&&S.kind==="normal"&&w.some(L=>Qe(L.s)!=="normal"))for(let L of w){let $=Math.abs(N-L.w)<=300,D=L.st>=v.min&&L.st<=v.max;if($&&D)return!0}return!1}let l=Hn(n),s=Pa(e,n,r,i,o);if(C.resource?.has(s))return C.resource.get(s);let u=La(e),d=[],f=Ot;for(let m of document.querySelectorAll("style")){let y=m.textContent||"";for(let x of y.matchAll(f)){let b=(x[2]||x[4]||"").trim();!b||re(b)||document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||d.push(b)}}d.length&&await Promise.all(d.map(m=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${m}"]`))return y(null);let x=document.createElement("link");x.rel="stylesheet",x.href=m,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>y(x),x.onerror=()=>y(null),document.head.appendChild(x)})));let p="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(m=>!!m.href);for(let m of g)try{if(re(m.href))continue;let y="",x=!1;try{x=new URL(m.href,location.href).origin===location.origin}catch{}if(!x){let w=Array.isArray(o)?o:[];if(!$a(m.href,u,w))continue}if(x){let w=Array.from(document.styleSheets).find(E=>E.href===m.href);if(w)try{let E=w.cssRules||[];y=Array.from(E).map(S=>S.cssText).join("")}catch{}}if(!y){let w=await G(m.href,{as:"text",useProxy:i});if(w?.ok&&typeof w.data=="string"&&(y=w.data),re(m.href))continue}y=await Na(y,m.href,i);let b="";for(let w of y.match(Ta)||[]){let E=(w.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),S=it(E);if(!S||re(S))continue;let v=(w.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),M=(w.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),N=(w.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),O=(w.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),F=(w.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=Yt(F,m.href);if(!c(S,M,v,N))continue;let $=mr(O);if(!pr(t,$))continue;let D={family:S,weightSpec:v,styleSpec:M,stretchSpec:N,unicodeRange:O,srcRaw:F,srcUrls:L,href:m.href};if(n&&l(D,$))continue;let B=/url\(/i.test(F)?await hr(w,m.href,i):w;b+=B}b.trim()&&(p+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",m.href)}let h={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:c,simpleExcluder:n?Hn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let m of document.styleSheets)if(!(m.href&&g.some(y=>y.href===m.href)))try{let y=m.href||location.origin+"/";y&&h.visitedSheets.add(y),await gr(m,y,async x=>{p+=x},h)}catch{}try{for(let m of document.fonts||[]){if(!m||!m.family||m.status!=="loaded"||!m._snapdomSrc)continue;let y=String(m.family).replace(/^['"]+|['"]+$/g,"");if(re(y)||!a.has(y)||n?.families&&n.families.some(b=>String(b).toLowerCase()===y.toLowerCase()))continue;let x=m._snapdomSrc;if(!String(x).startsWith("data:")){if(C.resource?.has(m._snapdomSrc))x=C.resource.get(m._snapdomSrc),C.font?.add(m._snapdomSrc);else if(!C.font?.has(m._snapdomSrc))try{let b=await G(m._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(b.ok&&typeof b.data=="string")x=b.data,C.resource?.set(m._snapdomSrc,x),C.font?.add(m._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",m._snapdomSrc);continue}}p+=`@font-face{font-family:'${y}';src:url(${x});font-style:${m.style||"normal"};font-weight:${m.weight||"normal"};}`}}catch{}for(let m of r){if(!m||typeof m!="object")continue;let y=String(m.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||re(y)||!a.has(y)||n?.families&&n.families.some(v=>String(v).toLowerCase()===y.toLowerCase()))continue;let x=m.weight!=null?String(m.weight):"normal",b=m.style!=null?String(m.style):"normal",w=m.stretchPct!=null?`${m.stretchPct}%`:"100%",E=String(m.src||""),S=E;if(!S.startsWith("data:")){if(C.resource?.has(E))S=C.resource.get(E),C.font?.add(E);else if(!C.font?.has(E))try{let v=await G(E,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")S=v.data,C.resource?.set(E,S),C.font?.add(E);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",E);continue}}p+=`@font-face{font-family:'${y}';src:url(${S});font-style:${b};font-weight:${x};font-stretch:${w};}`}return p&&(p=_a(p),C.resource?.set(s,p)),p}function yr(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let c=it(a.fontFamily);if(!c)return;let l=(s,u,d)=>`${c}__${Ze(s)}__${Qe(u)}__${Ea(d)}`;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,c=getComputedStyle(a);r(c);let l=getComputedStyle(a,"::before");l&&l.content&&l.content!=="none"&&r(l);let s=getComputedStyle(a,"::after");s&&s.content&&s.content!=="none"&&r(s)}return t}function Da(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 c=getComputedStyle(o,a)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let l=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(l)for(let s of l)try{t.add(parseInt(s.slice(1),16))}catch{}}}}}return t}async function wr(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)))}K();function Ia(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function Oa(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Wn(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 Bn(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 Un(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,e));case"decimal-leading-zero":return(e<10?"0":"")+String(Math.max(0,e));case"lower-alpha":return Wn(e,!1);case"upper-alpha":return Wn(e,!0);case"lower-roman":return Bn(e,!1);case"upper-roman":return Bn(e,!0);default:return String(Math.max(0,e))}}function Ha(e){let t=()=>C?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,o=f=>f&&f.tagName==="LI",a=f=>{let p=0,g=f?.parentElement;if(!g)return 0;for(let h of g.children){if(h===f)break;h.tagName==="LI"&&p++}return p},c=f=>{let p=new Map;for(let[g,h]of f)p.set(g,h.slice());return p},l=(f,p,g)=>{let h=c(f),m;try{m=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(m&&m!=="none")for(let x of m.split(",")){let b=x.trim().split(/\s+/),w=b[0],E=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!w)continue;let S=p.get(w);if(S&&S.length){let v=S.slice();v.push(E),h.set(w,v)}else h.set(w,[E])}let y;try{y=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(y&&y!=="none")for(let x of y.split(",")){let b=x.trim().split(/\s+/),w=b[0],E=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!w)continue;let S=h.get(w)||[];S.length===0&&S.push(0),S[S.length-1]+=E,h.set(w,S)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let x=g.parentElement,b=1;if(x&&x.tagName==="OL"){let E=x.getAttribute("start"),S=Number.isFinite(Number(E))?Number(E):1,v=a(g),M=g.getAttribute("value");b=Number.isFinite(Number(M))?Number(M):S+v}else b=1+a(g);let w=h.get("list-item")||[];w.length===0&&w.push(0),w[w.length-1]=b,h.set("list-item",w)}}catch{}return h},s=(f,p,g)=>{let h=l(g,p,f);r.set(f,h);let m=h;for(let y of f.children)m=s(y,h,m);return h},u=new Map;s(i,u,u);function d(){let f=t();if(f!==n){n=f;let p=new Map;s(i,p,p)}}return{get(f,p){d();let g=r.get(f)?.get(p);return g&&g.length?g[g.length-1]:0},getStack(f,p){d();let g=r.get(f)?.get(p);return g?g.slice():[]}}}function Wa(e,t,n){if(!e||e==="none")return e;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=e.replace(r,(o,a,c)=>{let l=String(c).split(",").map(s=>s.trim());if(a==="counter"){let s=l[0]?.replace(/^["']|["']$/g,""),u=(l[1]||"decimal").toLowerCase(),d=n.get(t,s);return Un(d,u)}else{let s=l[0]?.replace(/^["']|["']$/g,""),u=l[1]?.replace(/^["']|["']$/g,"")??"",d=(l[2]||"decimal").toLowerCase(),f=n.getStack(t,s);return f.length?f.map(p=>Un(p,d)).join(u):""}});return Oa(i)}catch{return"- "}}ke();K();var ve=new WeakMap,qn=300;function Ba(e,t){let n=br(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=zn(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):zn(e)}function Ht(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function br(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 c=a.textContent?a.textContent.length:0;n+=`S${c}|`;let l=a.sheet,s=l?Ht(l):null;s&&(r+=s.length)}else{let c=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";n+=`L${c}|m:${l}|`;let s=a.sheet,u=s?Ht(s):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function jn(e,t,n){let r=Ht(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 c of t)if(a.includes(c))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let c=0;c<o.cssRules.length&&n.budget>0;c++){let l=o.cssRules[c],s=l&&l.cssText?l.cssText:"";n.budget--;for(let u of t)if(s.includes(u))return!0}if(n.budget<=0)return!1}return!1}function zn(e=document){let t=br(e),n=ve.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 c=i[a].textContent||"";for(let l of r)if(c.includes(l))return ve.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:qn};try{for(let c of o)if(jn(c,r,a))return ve.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),c={budget:qn};for(let l=0;l<a.length&&c.budget>0;l++){let s=a[l],u=null;if(s.tagName,u=s.sheet||null,u&&jn(u,r,c))return ve.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(ve.set(e,{fingerprint:t,result:!0}),!0):(ve.set(e,{fingerprint:t,result:!1}),!1)}var Ce=new WeakMap,Vn=-1;function Ua(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function qa(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):Ua(e)}function Wt(e,t){let n=e.parentElement,r=n?Ce.get(n):null;return r?{get(i,o){let a=t.get(i,o),c=r.get(o);return typeof c=="number"?Math.max(a,c):a},getStack(i,o){let a=t.getStack(i,o);if(!a.length)return a;let c=r.get(o);if(typeof c=="number"){let l=a.slice();return l[l.length-1]=Math.max(l[l.length-1],c),l}return a}}:t}function Bt(e,t,n){let r=new Map;function i(l){let s=[];if(!l||l==="none")return s;for(let u of String(l).split(",")){let d=u.trim().split(/\s+/),f=d[0],p=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;f&&s.push({name:f,num:p})}return s}let o=i(t?.counterReset),a=i(t?.counterIncrement);function c(l){if(r.has(l))return r.get(l).slice();let s=n.getStack(e,l);s=s.length?s.slice():[];let u=o.find(f=>f.name===l);if(u){let f=Number.isFinite(u.num)?u.num:0;s=s.length?[...s,f]:[f]}let d=a.find(f=>f.name===l);if(d){let f=Number.isFinite(d.num)?d.num:1;s.length===0&&(s=[0]),s[s.length-1]+=f}return r.set(l,s.slice()),s}return{get(l,s){let u=c(s);return u.length?u[u.length-1]:0},getStack(l,s){return c(s)},__incs:a}}function ja(e,t,n){let r;try{r=oe(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=Wt(e,n),a=Bt(e,r,o),c=Ia(i)?Wa(i,e,a):i;return{text:qa(c),incs:a.__incs||[]}}async function Ut(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!Ba(i,n))return;let o=C?.session?.__counterEpoch??0;if(Vn!==o&&(Ce=new WeakMap,n&&(n.__counterCtx=null),Vn=o),!n.__counterCtx)try{n.__counterCtx=Ha(e.ownerDocument||document)}catch(l){P(n,"buildCounterContext failed",l)}let a=n.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let s=oe(e,l);if(!s||s.content==="none"&&s.backgroundImage==="none"&&s.backgroundColor==="transparent"&&(s.borderStyle==="none"||parseFloat(s.borderWidth)===0)&&(!s.transform||s.transform==="none")&&s.display==="inline")continue;if(l==="::first-letter"){let _=oe(e);if(!(s.color!==_.color||s.fontSize!==_.fontSize||s.fontWeight!==_.fontWeight))continue;let T=Array.from(t.childNodes).find($e=>$e.nodeType===Node.TEXT_NODE&&$e.textContent?.trim().length>0);if(!T)continue;let H=T.textContent,I=H.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],ie=H.slice(I?.length||0);if(!I||/[\uD800-\uDFFF]/.test(I))continue;let Q=document.createElement("span");Q.textContent=I,Q.dataset.snapdomPseudo="::first-letter";let he=$n(s),ge=Rt(he,"span");n.styleMap.set(Q,ge);let ce=document.createTextNode(ie);t.replaceChild(ce,T),t.insertBefore(Q,ce);continue}let u=s.content??"",d=u===""||u==="none"||u==="normal",{text:f,incs:p}=ja(e,l,a),g=s.backgroundImage,h=s.backgroundColor,m=s.fontFamily,y=parseInt(s.fontSize)||32,x=parseInt(s.fontWeight)||!1,b=s.color||"#000",w=s.borderStyle,E=parseFloat(s.borderWidth),S=s.transform,v=re(m),M=!d&&f!=="",N=g&&g!=="none",O=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",F=w&&w!=="none"&&E>0,L=S&&S!=="none";if(!(M||N||O||F||L)){if(p&&p.length&&e.parentElement){let _=Ce.get(e.parentElement)||new Map;for(let{name:T}of p){if(!T)continue;let H=Wt(e,a),I=Bt(e,oe(e,l),H).get(e,T);_.set(T,I)}Ce.set(e.parentElement,_)}continue}let $=document.createElement("span");$.dataset.snapdomPseudo=l,$.style.pointerEvents="none";let D=$n(s),B=Rt(D,"span");if(n.styleMap.set($,B),v&&f&&f.length===1){let{dataUrl:_,width:T,height:H}=await xa(f,m,x,y,b),I=document.createElement("img");I.src=_,I.style=`height:${y}px;width:${T/H*y}px;object-fit:contain;`,$.appendChild(I),t.dataset.snapdomHasIcon="true"}else if(f&&f.startsWith("url(")){let _=jt(f);if(_?.trim())try{let T=await G(et(_),{as:"dataURL",useProxy:r.useProxy});if(T?.ok&&typeof T.data=="string"){let H=document.createElement("img");H.src=T.data,H.style=`width:${y}px;height:auto;object-fit:contain;`,$.appendChild(H)}}catch(T){console.error(`[snapdom] Error in pseudo ${l} for`,e,T)}}else!v&&M&&($.textContent=f);$.style.backgroundImage="none","maskImage"in $.style&&($.style.maskImage="none"),"webkitMaskImage"in $.style&&($.style.webkitMaskImage="none");try{$.style.backgroundRepeat=s.backgroundRepeat,$.style.backgroundSize=s.backgroundSize,s.backgroundPositionX&&s.backgroundPositionY?($.style.backgroundPositionX=s.backgroundPositionX,$.style.backgroundPositionY=s.backgroundPositionY):$.style.backgroundPosition=s.backgroundPosition,$.style.backgroundOrigin=s.backgroundOrigin,$.style.backgroundClip=s.backgroundClip,$.style.backgroundAttachment=s.backgroundAttachment,$.style.backgroundBlendMode=s.backgroundBlendMode}catch{}if(N)try{let _=_t(g),T=await Promise.all(_.map(Jn));$.style.backgroundImage=T.join(", ")}catch(_){console.warn(`[snapdom] Failed to inline background-image for ${l}`,_)}O&&($.style.backgroundColor=h);let We=$.childNodes.length>0||$.textContent?.trim()!==""||N||O||F||L;if(p&&p.length&&e.parentElement){let _=Ce.get(e.parentElement)||new Map,T=Wt(e,a),H=Bt(e,oe(e,l),T);for(let{name:I}of p){if(!I)continue;let ie=H.get(e,I);_.set(I,ie)}Ce.set(e.parentElement,_)}if(!We)continue;l==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore($,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild($))}catch(s){console.warn(`[snapdom] Failed to capture ${l} for`,e,s)}let c=Array.from(t.children).filter(l=>!l.dataset.snapdomPseudo);if(n.nodeMap)for(let l of c){let s=n.nodeMap.get(l);s instanceof Element&&await Ut(s,l,n,r)}else{let l=Array.from(e.children);for(let s=0;s<Math.min(l.length,c.length);s++)await Ut(l[s],c[s],n,r)}}function za(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"],c=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",s=w=>{if(!w||!w.getAttribute)return null;let E=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(l,"href"):null);if(E)return E;let S=w.attributes;if(!S)return null;for(let v=0;v<S.length;v++){let M=S[v];if(!M||!M.name)continue;if(M.name==="href")return M.value;let N=M.name.indexOf(":");if(N!==-1&&M.name.slice(N+1)==="href")return M.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(w=>w.id)),d=new Set,f=!1,p=(w,E=null)=>{if(!w)return;o.lastIndex=0;let S;for(;S=o.exec(w);){f=!0;let v=(S[1]||"").trim();v&&(u.has(v)||(d.add(v),E&&!E.has(v)&&E.add(v)))}},g=w=>{let E=w.querySelectorAll("use");for(let v of E){let M=s(v);if(!M||!M.startsWith("#"))continue;f=!0;let N=M.slice(1).trim();N&&!u.has(N)&&d.add(N)}let S=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 S){p(v.getAttribute("style")||"");for(let M of a)p(v.getAttribute(M))}};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 m=h.querySelector("defs")||null,y=w=>{if(!w||u.has(w))return null;let E=c(w),S=v=>{let M=r.querySelector(v);return M&&!e.contains(M)?M:null};return S(`svg defs > *#${E}`)||S(`svg > symbol#${E}`)||S(`*#${E}`)};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 E=y(w);if(!E){b.add(w);continue}m||(m=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(m));let S=E.cloneNode(!0);S.id||S.setAttribute("id",w),m.appendChild(S),b.add(w),u.add(w);let v=[S,...S.querySelectorAll("*")];for(let M of v){let N=s(M);if(N&&N.startsWith("#")){let F=N.slice(1).trim();F&&!u.has(F)&&!b.has(F)&&x.add(F)}let O=M.getAttribute?.("style")||"";O&&p(O,x);for(let F of a){let L=M.getAttribute?.(F);L&&p(L,x)}}}}K();function Va(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 c=a.currentNode,l=getComputedStyle(c),s=l.position;if(s!=="sticky"&&s!=="-webkit-sticky")continue;let u=Yn(l.top),d=Yn(l.bottom);if(u==null&&d==null)continue;let f=Ya(c,e),p=Xa(t,f,o);if(!p)continue;let g=c.getBoundingClientRect(),h=g.width,m=g.height,y=g.left-r.left;if(!(h>0&&m>0)||!Number.isFinite(y))continue;let x=u!=null?u+n:n+(i-m-d);if(!Number.isFinite(x))continue;let b=Number.parseInt(l.zIndex,10),w=Number.isFinite(b),E=w?Math.max(b,1)+1:2,S=w?b-1:0,v=p.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=`${m}px`,v.style.visibility="hidden",v.style.zIndex=String(S),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",p.parentElement?.insertBefore(v,p),p.style.position="absolute",p.style.left=`${y}px`,p.style.top=`${x}px`,p.style.bottom="auto",p.style.zIndex=String(E),p.style.pointerEvents="none"}}function Yn(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function Ya(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 Xa(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=Ga(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function Ga(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 Ka(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=n!=="none"&&parseFloat(r)>0,c=i==="none"||parseFloat(o)===0;a&&c&&(e.style.border=`${r} solid transparent`)}async function Ja(e,t={}){let n={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap,options:t},r,i="",o="";Ka(e);try{za(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await Je(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{await Ut(e,r,n,t)}catch(l){console.warn("inlinePseudoElements failed:",l)}await ua(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let s of l)o+=s.textContent||"",s.remove()}catch(l){P(n,"Failed to extract shadow CSS from style[data-sd]",l)}let a=yi(n.styleMap);i=Array.from(a.entries()).map(([l,s])=>`.${s}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,s]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",s.replace(/;/g,"; "));continue}let u=a.get(s);u&&l.classList.add(u);let d=l.style?.backgroundImage,f=l.dataset?.snapdomHasIcon;d&&d!=="none"&&(l.style.backgroundImage=d),f&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,s]of n.nodeMap.entries()){let u=s.scrollLeft,d=s.scrollTop;if((u||d)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let f=document.createElement("div");for(f.style.transform=`translate(${-u}px, ${-d}px)`,f.style.willChange="transform",f.style.display="inline-block",f.style.width="100%";l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}}let c=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Va(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||oe(e);n.styleCache.set(e,l);let s=ii(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=s||""}for(let[l,s]of n.nodeMap.entries())s.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}ke();var xr="http://www.w3.org/1999/xlink";function Za(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(xr,"href"):null)}function Qa(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,c=t||o||r||e.width||e.naturalWidth||100,l=n||a||i||e.height||e.naturalHeight||100;return{width:c,height:l}}async function el(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 c=a.src||"";if(!c)return;let l=await G(c,{as:"dataURL",useProxy:t.useProxy});if(l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")){a.src=l.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:s,height:u}=Qa(a),{fallbackURL:d}=t||{};if(d)try{let f=typeof d=="function"?await d({width:s,height:u,src:c,element:a}):d;if(f){let p=await G(f,{as:"dataURL",useProxy:t.useProxy});if(p?.ok&&typeof p.data=="string"){a.src=p.data,a.width||(a.width=s),a.height||(a.height=u);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${s}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:${s}px;height:${u}px;visibility:hidden;`,a.replaceWith(f)}};for(let a=0;a<n.length;a+=4){let c=n.slice(a,a+4).map(r);await Promise.allSettled(c)}let i=Array.from(e.querySelectorAll("image")),o=async a=>{let c=Za(a);if(!c||c.startsWith("data:")||c.startsWith("blob:"))return;let l=await G(c,{as:"dataURL",useProxy:t.useProxy});l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")&&(a.setAttribute("href",l.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(xr,"href"))};for(let a=0;a<i.length;a+=4){let c=i.slice(a,a+4).map(o);await Promise.allSettled(c)}}J();async function tl(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"],c=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[s,u]=i.shift();if(!u)continue;let d=n.get(s)||oe(s);n.has(s)||n.set(s,d);let f=(()=>{let h=d.getPropertyValue("border-image"),m=d.getPropertyValue("border-image-source");return h&&h!=="none"||m&&m!=="none"})();for(let h of c){let m=d.getPropertyValue(h);m&&u.style.setProperty(h,m)}for(let h of o){let m=d.getPropertyValue(h);if(h==="background-image"&&(!m||m==="none")){let b=d.getPropertyValue("background");b&&/url\s*\(/.test(b)&&(m=_t(b).find(w=>/url\s*\(/.test(w))||m)}if(!m||m==="none")continue;let y=_t(m),x=await Promise.all(y.map(b=>Jn(b,r)));x.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&u.style.setProperty(h,x.join(", "))}for(let h of a){let m=d.getPropertyValue(h);!m||m==="initial"||u.style.setProperty(h,m)}if(f)for(let h of l){let m=d.getPropertyValue(h);!m||m==="initial"||u.style.setProperty(h,m)}let p=s.shadowRoot?Array.from(s.shadowRoot.children).filter(h=>h.tagName!=="STYLE"):Array.from(s.children),g=Array.from(u.children).filter(h=>!(h.dataset?.snapdomPseudo||h.tagName==="STYLE"&&h.dataset?.sd));for(let h=0;h<Math.min(p.length,g.length);h++)i.push([p[h],g[h]])}}J();K();function nl(e){if(!e)return()=>{};let t=[];function n(r){let i=rl(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function rl(e){if(!e)return()=>{};let t=ol(e);if(t<=0)return()=>{};if(!ll(e))return()=>{};let n=getComputedStyle(e),r=Math.round(il(n)*t+al(n)),i=e.textContent??"",o=i;if(e.scrollHeight<=r+.5)return()=>{};let a=0,c=i.length,l=-1;for(;a<=c;){let s=a+c>>1;e.textContent=i.slice(0,s)+"\u2026",e.scrollHeight<=r+.5?(l=s,a=s+1):c=s-1}return e.textContent=(l>=0?i.slice(0,l):"")+"\u2026",()=>{e.textContent=o}}function ol(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 il(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 al(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ll(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Pe=[];function vr(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 sl(...e){let t=e.flat();for(let n of t){let r=vr(n);r&&(Pe.some(i=>i&&i.name&&r.name&&i.name===r.name)||Pe.push(r))}}function Sr(e){return(e&&Array.isArray(e.plugins)?e.plugins:Pe)||Pe}async function se(e,t,n){let r=n,i=Sr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,r);typeof c<"u"&&(r=c)}return r}async function cl(e,t,n){let r=[],i=Sr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,n);typeof c<"u"&&r.push(c)}return r}function ul(e){let t=[];if(Array.isArray(e))for(let n of e){let r=vr(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 Pe)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function dl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=ul(t)),e}J();function fl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){P(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){P(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){P(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){P(n,"stripRootShadows filter",o)}}function ml(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 pl(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 c=a.name;if(c.includes("@")){o.removeAttribute(c);continue}if(c.includes(":")){let l=c.split(":",1)[0];if(!r.has(l)){o.removeAttribute(c);continue}}if(n&&(c.startsWith("x-")||c.startsWith("v-")||c.startsWith(":")||c.startsWith("on:")||c.startsWith("bind:")||c.startsWith("let:")||c.startsWith("class:"))){o.removeAttribute(c);continue}}}}function hl(e,t={}){e&&(pl(e,t),ml(e))}function gl(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function yl(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function wl(e,t){if(!(e instanceof Element)||gl(e)||yl(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 bl(e,t,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let a=i.childElementCount>o.childElementCount,c=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,c),a&&wl(i,c)){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=c.overflowY||c.overflowBlock||"visible",d=c.overflowX||c.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(o.style.overflow="visible")}let l=Array.from(i.children),s=Array.from(o.children);for(let u=0;u<Math.min(l.length,s.length);u++)r(l[u],s[u])}r(e,t)}function xl(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function vl(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){P(t,"exclude selector match failed",r)}return!1}function Sl(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,c=Array.from(e.children);for(let p of c){if(vl(p,t)||!xl(p))continue;let g=p.getBoundingClientRect(),h=g.top-r.top,m=g.bottom-r.top;m<=h||(h<i&&(i=h),m>o&&(o=m),a=!0)}let l=a?Math.max(0,o-i):0,s=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return s+u+d+f+l}var A=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,El=/::-webkit-scrollbar(-[a-z]+)?\b/i;function qt(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+=qt(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=qt(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(El.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function Cl(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+=qt(i,t))}catch{}return n}function kl(e){let t=e.boxShadow||"";if(!t||t==="none")return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(c=>c.trim()),r=0,i=0,o=0,a=0;for(let c of n){let l=c.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(l.length<2)continue;let[s,u,d=0,f=0]=l,p=Math.abs(s)+d+f,g=Math.abs(u)+d+f;i=Math.max(i,p+Math.max(s,0)),a=Math.max(a,p+Math.max(-s,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 Ml(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 Al(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0);return{top:t,right:t,bottom:t,left:t}}function $l(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,c=!1;for(let l of n){c=!0;let s=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(h=>parseFloat(h))||[],[u=0,d=0,f=0]=s,p=Math.abs(u)+f,g=Math.abs(d)+f;i=Math.max(i,p+Math.max(u,0)),a=Math.max(a,p+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:c}}function Ll(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 o=Er(e);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let i=r.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let o=i[1].split(",").map(a=>parseFloat(a.trim()));if(o.length===6&&o.every(Number.isFinite)){let[a,c,l,s]=o,u=Math.sqrt(a*a+c*c)||0,d=0,f=0,p=0,g=0,h=0,m=0;u>0&&(d=a/u,f=c/u,p=d*l+f*s,g=l-d*p,h=s-f*p,m=Math.sqrt(g*g+h*h)||0,m>0?p=p/m:p=0);let y=u,x=0,b=p*m,w=m;try{t.style.transform=`matrix(${y}, ${x}, ${b}, ${w}, 0, 0)`}catch{}return{a:y,b:x,c:b,d:w}}}try{let o=String(r).trim();return t.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function Xn(e,t,n,r,i){let o=n.a,a=n.b,c=n.c,l=n.d,s=n.e||0,u=n.f||0;function d(y,x){let b=y-r,w=x-i,E=o*b+c*w,S=a*b+l*w;return E+=r+s,S+=i+u,[E,S]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],p=1/0,g=1/0,h=-1/0,m=-1/0;for(let[y,x]of f)y<p&&(p=y),x<g&&(g=x),y>h&&(h=y),x>m&&(m=x);return{minX:p,minY:g,maxX:h,maxY:m,width:h-p,height:m-g}}function Nl(e,t,n){let r=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],a=(c,l)=>{let s=c.toLowerCase();return s==="left"||s==="top"?0:s==="center"?l/2:s==="right"||s==="bottom"?l:s.endsWith("px")?parseFloat(s)||0:s.endsWith("%")?(parseFloat(s)||0)*l/100:/^-?\d+(\.\d+)?$/.test(s)&&parseFloat(s)||0};return{ox:a(i,t),oy:a(o,n)}}function Tl(e){let t={rotate:"0deg",scale:null,translate:null},n=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(n){let i=l=>{try{return typeof n.has=="function"&&!n.has(l)||typeof n.get!="function"?null:n.get(l)}catch{return null}},o=i("rotate");if(o)if(o.angle){let l=o.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.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 l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=i("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,s="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${s}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let c=i("translate");if(c){let l="x"in c&&"value"in c.x?c.x.value:Array.isArray(c)?c[0]?.value:0,s="y"in c&&"value"in c.y?c.y.value:Array.isArray(c)?c[1]?.value:0,u="x"in c&&c.x?.unit?c.x.unit:"px",d="y"in c&&c.y?.unit?c.y.unit:"px";t.translate=`${l}${u} ${s}${d}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.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 Nt=null;function Rl(){if(Nt)return Nt;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),Nt=e,e}function _l(e){let t=Rl(),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=Er(n);return t.removeChild(n),r}function Pl(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 Er(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 Cr(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,c,l,s="",u="",d,f,p=null;await se("beforeSnap",o),await se("beforeClone",o);let g=nl(o.element);try{({clone:a,classCSS:c,styleCache:l}=await Ja(o.element,o.options)),!r&&a&&(p=Ll(o.element,a)),!i&&a&&fl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:c,styleCache:l,...o},await se("afterClone",o),hl(o.clone),o.options?.excludeMode==="remove")try{bl(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await ba(o.clone,o.element)}catch{}await new Promise(b=>{Se(async()=>{await el(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{Se(async()=>{await tl(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),t.embedFonts&&await new Promise(b=>{Se(async()=>{let w=yr(o.element),E=Da(o.element);if(fe()){let S=new Set(Array.from(w).map(v=>String(v).split("__")[0]).filter(Boolean));await wr(S,1)}s=await Fa({required:w,usedCodepoints:E,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),b()},{fast:n})});let h=hi(o.clone).sort(),m=h.join(",");C.baseStyle.has(m)?u=C.baseStyle.get(m):await new Promise(b=>{Se(()=>{u=gi(h),C.baseStyle.set(m,u),b()},{fast:n})});let y=Cl(o.element?.ownerDocument||document);o={fontsCSS:s,baseCSS:u,scrollbarCSS:y,...o},await se("beforeRender",o),await new Promise(b=>{Se(()=>{let w=oe(o.element),E=o.element.getBoundingClientRect(),S=Math.max(1,A(o.element.offsetWidth||parseFloat(w.width)||E.width||1)),v=Math.max(1,A(o.element.offsetHeight||parseFloat(w.height)||E.height||1)),M=o.element.ownerDocument||document;if(o.element===M.body||o.element===M.documentElement){let U=Math.max(o.element.scrollHeight||0,M.documentElement?.scrollHeight||0,M.body?.scrollHeight||0),j=Math.max(o.element.scrollWidth||0,M.documentElement?.scrollWidth||0,M.body?.scrollWidth||0);U>0&&(v=Math.max(v,A(U))),j>0&&(S=Math.max(S,A(j)));try{let q=M.createElement("div");q.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+S+"px!important;overflow:visible!important;visibility:hidden!important;";let Ue=M.createElement("style");Ue.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,q.appendChild(Ue),q.appendChild(o.clone.cloneNode(!0)),M.body.appendChild(q);let qe=q.scrollHeight,je=q.scrollWidth;M.body.removeChild(q),qe>0&&(v=Math.max(v,A(qe))),je>0&&(S=Math.max(S,A(je)))}catch{}}if(o.options?.excludeMode==="remove"){let U=Sl(o.element,o.options);Number.isFinite(U)&&U>0&&(v=Math.max(1,Math.min(v,A(U+1))))}let N=(U,j=NaN)=>{let q=typeof U=="string"?parseFloat(U):U;return Number.isFinite(q)?q:j},O=N(o.options.width),F=N(o.options.height),L=S,$=v,D=Number.isFinite(O),B=Number.isFinite(F),We=v>0?S/v:1;D&&B?(L=Math.max(1,A(O)),$=Math.max(1,A(F))):D?(L=Math.max(1,A(O)),$=Math.max(1,A(L/(We||1)))):B?($=Math.max(1,A(F)),L=Math.max(1,A($*(We||1)))):(L=S,$=v);let _=0,T=0,H=S,I=v;if(!r&&p&&Number.isFinite(p.a)){let U={a:p.a,b:p.b||0,c:p.c||0,d:p.d||1,e:0,f:0},j=Xn(S,v,U,0,0);_=A(j.minX),T=A(j.minY),H=A(j.maxX),I=A(j.maxY)}else if(r&&Gn(o.element)){let U=w.transform&&w.transform!=="none"?w.transform:"",j=Tl(o.element),q=_l({baseTransform:U,rotate:j.rotate||"0deg",scale:j.scale,translate:j.translate}),{ox:Ue,oy:qe}=Nl(w,S,v),je=q.is2D?q:new DOMMatrix(q.toString()),ze=Xn(S,v,je,Ue,qe);_=A(ze.minX),T=A(ze.minY),H=A(ze.maxX),I=A(ze.maxY)}let ie=kl(w),Q=Ml(w),he=Al(w),ge=$l(w),ce=i?{top:A(ie.top+Q.top+he.top+ge.bleed.top),right:A(ie.right+Q.right+he.right+ge.bleed.right),bottom:A(ie.bottom+Q.bottom+he.bottom+ge.bleed.bottom),left:A(ie.left+Q.left+he.left+ge.bleed.left)}:{top:0,right:0,bottom:0,left:0};_=A(_-ce.left),T=A(T-ce.top),H=A(H+ce.right),I=A(I+ce.bottom);let $e=Math.max(1,A(H-_)),en=Math.max(1,A(I-T)),xo=D||B?A(L/S):1,vo=B||D?A($/v):1,So=Math.max(1,A($e*xo)),Eo=Math.max(1,A(en*vo)),tn="http://www.w3.org/2000/svg",Co=fe()&&Gn(o.element)?1:0,ae=A(Co+(r?0:1)),le=document.createElementNS(tn,"foreignObject"),ko=A(_),Mo=A(T);le.setAttribute("x",String(A(-(ko-ae)))),le.setAttribute("y",String(A(-(Mo-ae)))),le.setAttribute("width",String(A(S+ae*2))),le.setAttribute("height",String(A(v+ae*2))),le.style.overflow="visible";let nn=document.createElement("style");nn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,le.appendChild(nn);let Be=document.createElement("div");Be.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Be.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${A(S)}px;height:${A(v)}px`,Be.appendChild(o.clone),le.appendChild(Be);let Ao=new XMLSerializer().serializeToString(le),yt=A($e+ae*2),wt=A(en+ae*2),rn=D||B;t.meta={w0:S,h0:v,vbW:yt,vbH:wt,targetW:L,targetH:$};let $o=fe()&&rn?yt:A(So+ae*2),Lo=fe()&&rn?wt:A(Eo+ae*2),No=parseFloat(oe(M.documentElement)?.fontSize)||16;f=`<svg xmlns="${tn}" width="${$o}" height="${Lo}" viewBox="0 0 ${yt} ${wt}" font-size="${No}px">`+Ao+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,o={svgString:f,dataURL:d,...o},b()},{fast:n})}),await se("afterRender",o);let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),o.dataURL}function Gn(e){return Pl(e)}K();function Fl(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=ri(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}}De();rr();J();ke();K();function Dl(...e){return sl(...e),R}var R=Object.assign(Ol,{plugins:Dl}),kr=Symbol("snapdom.internal"),Il=Symbol("snapdom.internal.silent"),Kn=!1;async function Ol(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=Fl(t);if(dl(n,t&&t.plugins),fe()&&(n.embedFonts===!0||Wl(e))){if(n.embedFonts)try{let i=yr(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await wr(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await Hl(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&fa(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>R.toPng(r,i),toSvg:(r,i)=>R.toSvg(r,i)}),R.capture(e,n,kr)}R.capture=async(e,t,n)=>{if(n!==kr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Cr(e,t),i={img:async(h,m)=>{let{toImg:y}=await Promise.resolve().then(()=>(Nn(),Pt));return y(r,{...h,...m||{}})},svg:async(h,m)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Nn(),Pt));return y(r,{...h,...m||{}})},canvas:async(h,m)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(ot(),or));return y(r,{...h,...m||{}})},blob:async(h,m)=>{let{toBlob:y}=await Promise.resolve().then(()=>(cr(),lr));return y(r,{...h,...m||{}})},png:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Ke(),Ge));return y(r,{...h,...m||{},format:"png"})},jpeg:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Ke(),Ge));return y(r,{...h,...m||{},format:"jpeg"})},webp:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Ke(),Ge));return y(r,{...h,...m||{},format:"webp"})},download:async(h,m)=>{let{download:y}=await Promise.resolve().then(()=>(Ti(),ur));return y(r,{...h,...m||{}})}},o={};for(let h of["img","svg","canvas","blob","png","jpeg","webp"])o[h]=async m=>i[h](t,{...m||{},[Il]:!0});o.jpg=o.jpeg;let a={...t,export:{url:r},exports:o},c=await cl("defineExports",a),l=Object.assign({},...c.filter(h=>h&&typeof h=="object")),s={...i,...l};s.jpeg&&!s.jpg&&(s.jpg=(h,m)=>s.jpeg(h,m));function u(h,m){let y={...t,...m||{}};return(h==="jpeg"||h==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,f=Promise.resolve();async function p(h,m){let y=async()=>{let x=s[h];if(!x)throw new Error(`[snapdom] Unknown export type: ${h}`);let b=u(h,m),w={...t,export:{type:h,options:b,url:r}};await se("beforeExport",w);let E=await x(w,b);return await se("afterExport",w,E),d||(d=!0,await se("afterSnap",t)),E};return f=f.then(y)}let g={url:r,toRaw:()=>r,to:(h,m)=>p(h,m),toImg:h=>p("img",h),toSvg:h=>p("svg",h),toCanvas:h=>p("canvas",h),toBlob:h=>p("blob",h),toPng:h=>p("png",h),toJpg:h=>p("jpg",h),toWebp:h=>p("webp",h),download:h=>p("download",h)};for(let h of Object.keys(s)){let m="to"+h.charAt(0).toUpperCase()+h.slice(1);g[m]||(g[m]=y=>p(h,y))}return g};R.toRaw=(e,t)=>R(e,t).then(n=>n.toRaw());R.toImg=(e,t)=>R(e,t).then(n=>n.toImg());R.toSvg=(e,t)=>R(e,t).then(n=>n.toSvg());R.toCanvas=(e,t)=>R(e,t).then(n=>n.toCanvas());R.toBlob=(e,t)=>R(e,t).then(n=>n.toBlob());R.toPng=(e,t)=>R(e,{...t,format:"png"}).then(n=>n.toPng());R.toJpg=(e,t)=>R(e,{...t,format:"jpeg"}).then(n=>n.toJpg());R.toWebp=(e,t)=>R(e,{...t,format:"webp"}).then(n=>n.toWebp());R.download=(e,t)=>R(e,t).then(n=>n.download());async function Hl(e,t){if(Kn)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Cr(e,n)}catch(i){P(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){P(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(c){P(t,"safariWarmup img.decode failed",c)}let a=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-a<900;)await new Promise(c=>setTimeout(c,200));await new Promise(c=>requestAnimationFrame(c));try{let c=document.createElement("canvas");c.width=Math.max(1,o.naturalWidth||10),c.height=Math.max(1,o.naturalHeight||10);let l=c.getContext("2d");l&&l.drawImage(o,0,0)}catch{}await new Promise(c=>requestAnimationFrame(c));try{o.remove()}catch(c){P(t,"safariWarmup img.remove failed",c)}i()})()}),e.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){P(t,"safariWarmup canvas poke failed",o)}}),Kn=!0}function Wl(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 Mr(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 Ar(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 $r(){let e=document.querySelectorAll('link[rel~="stylesheet"]');for(let t of e)Mr(t)&&Ar(t)}function Bl(){let e=k().fonts;e.observer||(e.observer=new MutationObserver(t=>{for(let n of t)for(let r of n.addedNodes)r instanceof HTMLLinkElement&&Mr(r)&&Ar(r)}),e.observer.observe(document.documentElement,{childList:!0,subtree:!0}))}function Lr(){let e=k().fonts;e.initialized||(e.initialized=!0,$r(),Bl())}async function Nr(){$r();try{await document.fonts.ready}catch{}}var Ul=750,ql=400;var me=2,Rr=["#__mindstudio-cursor","#__mindstudio-cursor-ripple","#__mindstudio-notes-cursor","#__mindstudio-camera","#__mindstudio-flash"],jl="#DD2590",zl=`<svg width="44" height="44" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9
|
+
`):u+=f[0]}return u+=s.slice(d),u}let a=Hn(e,t||location.href);return a=await o(a,t||location.href,0),a}var pr=/url\((["']?)([^"')]+)\1\)/g,Oa=/@font-face[^{}]*\{[^}]*\}/g;function hr(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 gr(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 Xt(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(pr)){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 yr(e,t,n=""){let r=e;for(let i of e.matchAll(pr)){let o=jt(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(!ie(a)){if(C.resource?.has(a)){C.font?.add(a),r=r.replace(i[0],`url(${C.resource.get(a)})`);continue}if(!C.font?.has(a))try{let s=await X(a,{as:"dataURL",useProxy:n,silent:!0});if(s.ok&&typeof s.data=="string"){let c=s.data;C.resource?.set(a,c),C.font?.add(a),r=r.replace(i[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function Ha(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 Wn(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=Ha(o);if(a&&r.has(a))return!0}return!1}}function Wa(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=Yt(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=Xt(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 Ba(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 wr(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>=nt){console.warn(`[snapDOM] CSSOM import depth exceeded (${nt}) 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 wr(a.styleSheet,s,n,c);continue}if(a.type===CSSRule.FONT_FACE_RULE){let s=(a.style.getPropertyValue("font-family")||"").trim(),c=Yt(s);if(!c||ie(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=hr(m);if(!gr(r.usedCodepoints,g))continue;let h={family:c,weightSpec:l,styleSpec:u,stretchSpec:d,unicodeRange:m,srcRaw:f,srcUrls:Xt(f,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(h,g))continue;if(/url\(/i.test(f)){let p=await yr(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 Ua({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,v,x,w]=String(p).split("__");if(!y)continue;let S=a.get(y)||[];S.push({w:parseInt(v,10),s:x,st:parseInt(w,10)}),a.set(y,S)}function s(p,y,v,x){if(!a.has(p))return!1;let w=a.get(p),S=Ta(v),E=Ra(y),b=_a(x),M=S.min!==S.max,T=S.min,H=L=>E.kind==="normal"&&L==="normal"||E.kind!=="normal"&&(L==="italic"||L==="oblique"),F=!1;for(let L of w){let $=M?L.w>=S.min&&L.w<=S.max:L.w===T,W=H(et(L.s)),Y=L.st>=b.min&&L.st<=b.max;if($&&W&&Y){F=!0;break}}if(F)return!0;if(!M)for(let L of w){let $=H(et(L.s)),W=L.st>=b.min&&L.st<=b.max;if(Math.abs(T-L.w)<=300&&$&&W)return!0}if(!M&&E.kind==="normal"&&w.some(L=>et(L.s)!=="normal"))for(let L of w){let $=Math.abs(T-L.w)<=300,W=L.st>=b.min&&L.st<=b.max;if($&&W)return!0}return!1}let c=Wn(n),l=Ba(e,n,r,i,o);if(C.resource?.has(l))return C.resource.get(l);let u=Da(e),d=[],f=Ot;for(let p of document.querySelectorAll("style")){let y=p.textContent||"";for(let v of y.matchAll(f)){let x=(v[2]||v[4]||"").trim();!x||ie(x)||document.querySelector(`link[rel="stylesheet"][href="${x}"]`)||d.push(x)}}d.length&&await Promise.all(d.map(p=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${p}"]`))return y(null);let v=document.createElement("link");v.rel="stylesheet",v.href=p,v.setAttribute("data-snapdom","injected-import"),v.onload=()=>y(v),v.onerror=()=>y(null),document.head.appendChild(v)})));let m="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(p=>!!p.href);for(let p of g)try{if(ie(p.href))continue;let y="",v=!1;try{v=new URL(p.href,location.href).origin===location.origin}catch{}if(!v){let w=Array.isArray(o)?o:[];if(!Fa(p.href,u,w))continue}if(v){let w=Array.from(document.styleSheets).find(S=>S.href===p.href);if(w)try{let S=w.cssRules||[];y=Array.from(S).map(E=>E.cssText).join("")}catch{}}if(!y){let w=await X(p.href,{as:"text",useProxy:i});if(w?.ok&&typeof w.data=="string"&&(y=w.data),ie(p.href))continue}y=await Ia(y,p.href,i);let x="";for(let w of y.match(Oa)||[]){let S=(w.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),E=Yt(S);if(!E||ie(E))continue;let b=(w.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),M=(w.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),T=(w.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),H=(w.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),F=(w.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=Xt(F,p.href);if(!s(E,M,b,T))continue;let $=hr(H);if(!gr(t,$))continue;let W={family:E,weightSpec:b,styleSpec:M,stretchSpec:T,unicodeRange:H,srcRaw:F,srcUrls:L,href:p.href};if(n&&c(W,$))continue;let Y=/url\(/i.test(F)?await yr(w,p.href,i):w;x+=Y}x.trim()&&(m+=x)}catch{console.warn("[snapDOM] Failed to process stylesheet:",p.href)}let h={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:s,simpleExcluder:n?Wn(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 wr(p,y,async v=>{m+=v},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(ie(y)||!a.has(y)||n?.families&&n.families.some(x=>String(x).toLowerCase()===y.toLowerCase()))continue;let v=p._snapdomSrc;if(!String(v).startsWith("data:")){if(C.resource?.has(p._snapdomSrc))v=C.resource.get(p._snapdomSrc),C.font?.add(p._snapdomSrc);else if(!C.font?.has(p._snapdomSrc))try{let x=await X(p._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(x.ok&&typeof x.data=="string")v=x.data,C.resource?.set(p._snapdomSrc,v),C.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(${v});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||ie(y)||!a.has(y)||n?.families&&n.families.some(b=>String(b).toLowerCase()===y.toLowerCase()))continue;let v=p.weight!=null?String(p.weight):"normal",x=p.style!=null?String(p.style):"normal",w=p.stretchPct!=null?`${p.stretchPct}%`:"100%",S=String(p.src||""),E=S;if(!E.startsWith("data:")){if(C.resource?.has(S))E=C.resource.get(S),C.font?.add(S);else if(!C.font?.has(S))try{let b=await X(S,{as:"dataURL",useProxy:i,silent:!0});if(b.ok&&typeof b.data=="string")E=b.data,C.resource?.set(S,E),C.font?.add(S);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",S);continue}}m+=`@font-face{font-family:'${y}';src:url(${E});font-style:${x};font-weight:${v};font-stretch:${w};}`}return m&&(m=Wa(m),C.resource?.set(l,m)),m}function br(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let s=La(a.fontFamily);if(s.length)for(let c of s){let l=(u,d,f)=>`${c}__${Qe(u)}__${et(d)}__${Na(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 qa(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 xr(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)))}G();function ja(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function Va(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Bn(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 Un(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 qn(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 Bn(e,!1);case"upper-alpha":return Bn(e,!0);case"lower-roman":return Un(e,!1);case"upper-roman":return Un(e,!0);default:return String(e)}}function za(e){let t=()=>C?.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 x of p.split(",")){let w=x.trim().split(/\s+/),S=w[0],E=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!S)continue;let b=m.get(S);if(b&&b.length){let M=b.slice();M.push(E),h.set(S,M)}else h.set(S,[E])}let y;try{y=g.style?.counterSet||getComputedStyle(g).counterSet}catch{}if(y&&y!=="none")for(let x of y.split(",")){let w=x.trim().split(/\s+/),S=w[0],E=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!S)continue;let b=h.get(S)||[];b.length===0&&b.push(0),b[b.length-1]=E,h.set(S,b)}let v;try{v=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(v&&v!=="none")for(let x of v.split(",")){let w=x.trim().split(/\s+/),S=w[0],E=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!S)continue;let b=h.get(S)||[];b.length===0&&b.push(0),b[b.length-1]+=E,h.set(S,b)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let x=g.parentElement,w=1;if(x&&x.tagName==="OL"){let E=x.getAttribute("start"),b=Number.isFinite(Number(E))?Number(E):1,M=a(g),T=g.getAttribute("value");w=Number.isFinite(Number(T))?Number(T):b+M}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 v of f.children)p=l(v,h,p);let y=new Map;for(let[v,x]of g){let w=x.length,S=p.get(v);y.set(v,S&&S.length?S.slice(0,w):x.slice())}for(let[v,x]of p)!y.has(v)&&x.length&&!m.has(v)&&y.set(v,x.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 Ya(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 qn(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=>qn(m,d)).join(u):""}});return Va(i)}catch{return"- "}}$e();G();var ke=new WeakMap,jn=1e3;function Xa(e,t){let n=vr(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=zn(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):zn(e)}function Ht(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function vr(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?Ht(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?Ht(l):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Vn(e,t,n){let r=Ht(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 zn(e=document){let t=vr(e),n=ke.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 ke.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:jn};try{for(let s of o)if(Vn(s,r,a))return ke.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),s={budget:jn};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&&Vn(u,r,s))return ke.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(ke.set(e,{fingerprint:t,result:!0}),!0):(ke.set(e,{fingerprint:t,result:!1}),!1)}var Ae=new WeakMap,Yn=-1;function Ga(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Ka(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):Ga(e)}function Wt(e,t){let n=e.parentElement,r=n?Ae.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 Bt(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 Ja(e,t,n){let r;try{r=ae(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=Wt(e,n),a=Bt(e,r,o),s=ja(i)?Ya(i,e,a):i;return{text:Ka(s),incs:a.__incs||[]}}async function Ut(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!Xa(i,n))return;let o=C?.session?.__counterEpoch??0;if(Yn!==o&&(Ae=new WeakMap,n&&(n.__counterCtx=null),Yn=o),!n.__counterCtx)try{n.__counterCtx=za(e.ownerDocument||document)}catch(c){_(n,"buildCounterContext failed",c)}let a=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let l=ae(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 N=ae(e);if(!(l.color!==N.color||l.fontSize!==N.fontSize||l.fontWeight!==N.fontWeight||l.fontFamily!==N.fontFamily||l.fontStyle!==N.fontStyle||l.textTransform!==N.textTransform||l.float!==N.float||l.paddingTop!==N.paddingTop||l.paddingRight!==N.paddingRight||l.paddingBottom!==N.paddingBottom||l.paddingLeft!==N.paddingLeft||l.marginTop!==N.marginTop||l.marginRight!==N.marginRight||l.marginBottom!==N.marginBottom||l.marginLeft!==N.marginLeft))continue;let R=Array.from(t.childNodes).find(Te=>Te.nodeType===Node.TEXT_NODE&&Te.textContent?.trim().length>0);if(!R)continue;let I=R.textContent,D=I.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],le=I.slice(D?.length||0);if(!D||/[\uD800-\uDFFF]/.test(D))continue;let Q=document.createElement("span");Q.textContent=D,Q.dataset.snapdomPseudo="::first-letter";let be=Ln(l),xe=_t(be,"span");n.styleMap.set(Q,xe);let fe=document.createTextNode(le);t.replaceChild(fe,R),t.insertBefore(Q,fe);continue}let u=l.content??"",d=u===""||u==="none"||u==="normal",{text:f,incs:m}=Ja(e,c,a),g=l.backgroundImage,h=l.backgroundColor,p=l.fontFamily,y=parseInt(l.fontSize)||32,v=parseInt(l.fontWeight)||!1,x=l.color||"#000",w=l.borderStyle,S=parseFloat(l.borderWidth),E=l.transform,b=ie(p),M=!d&&f!=="",T=g&&g!=="none",H=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",F=w&&w!=="none"&&S>0,L=E&&E!=="none";if(!(M||T||H||F||L)){if(m&&m.length&&e.parentElement){let N=Ae.get(e.parentElement)||new Map;for(let{name:R}of m){if(!R)continue;let I=Wt(e,a),D=Bt(e,ae(e,c),I).get(e,R);N.set(R,D)}Ae.set(e.parentElement,N)}continue}let $=document.createElement("span");$.dataset.snapdomPseudo=c,$.style.pointerEvents="none";let W=Ln(l),Y=_t(W,"span");if(n.styleMap.set($,Y),b&&f&&f.length===1){let{dataUrl:N,width:R,height:I}=await Aa(f,p,v,y,x),D=document.createElement("img");D.src=N,D.style=`height:${y}px;width:${R/I*y}px;object-fit:contain;`,$.appendChild(D),t.dataset.snapdomHasIcon="true"}else if(f&&f.startsWith("url(")){let N=jt(f);if(N?.trim())try{let R=await X(tt(N),{as:"dataURL",useProxy:r.useProxy});if(R?.ok&&typeof R.data=="string"){let I=document.createElement("img");I.src=R.data,I.style=`width:${y}px;height:auto;object-fit:contain;`,$.appendChild(I)}}catch(R){console.error(`[snapdom] Error in pseudo ${c} for`,e,R)}}else!b&&M&&($.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(T)try{let N=Pt(g),R=await Promise.all(N.map(Zn));$.style.backgroundImage=R.join(", ")}catch(N){console.warn(`[snapdom] Failed to inline background-image for ${c}`,N)}H&&($.style.backgroundColor=h);let je=$.childNodes.length>0||$.textContent?.trim()!==""||T||H||F||L;if(m&&m.length&&e.parentElement){let N=Ae.get(e.parentElement)||new Map,R=Wt(e,a),I=Bt(e,ae(e,c),R);for(let{name:D}of m){if(!D)continue;let le=I.get(e,D);N.set(D,le)}Ae.set(e.parentElement,N)}if(!je)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 Ut(l,c,n,r)}else{let c=Array.from(e.children);for(let l=0;l<Math.min(c.length,s.length);l++)await Ut(c[l],s[l],n,r)}}function Za(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 E=w.attributes;if(!E)return null;for(let b=0;b<E.length;b++){let M=E[b];if(!M||!M.name)continue;if(M.name==="href")return M.value;let T=M.name.indexOf(":");if(T!==-1&&M.name.slice(T+1)==="href")return M.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 E;for(;E=o.exec(w);){f=!0;let b=(E[1]||"").trim();b&&(u.has(b)||(d.add(b),S&&!S.has(b)&&S.add(b)))}},g=w=>{let S=w.querySelectorAll("use");for(let b of S){let M=l(b);if(!M||!M.startsWith("#"))continue;f=!0;let T=M.slice(1).trim();T&&!u.has(T)&&d.add(T)}let E=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 b of E){m(b.getAttribute("style")||"");for(let M of a)m(b.getAttribute(M))}};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),E=b=>{let M=r.querySelector(b);return M&&!e.contains(M)?M:null};return E(`svg defs > *#${S}`)||E(`svg > symbol#${S}`)||E(`*#${S}`)};if(!d.size)return;let v=new Set(d),x=new Set;for(;v.size;){let w=v.values().next().value;if(v.delete(w),!w||u.has(w)||x.has(w))continue;let S=y(w);if(!S){x.add(w);continue}p||(p=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(p));let E=S.cloneNode(!0);E.id||E.setAttribute("id",w),p.appendChild(E),x.add(w),u.add(w);let b=[E,...E.querySelectorAll("*")];for(let M of b){let T=l(M);if(T&&T.startsWith("#")){let F=T.slice(1).trim();F&&!u.has(F)&&!x.has(F)&&v.add(F)}let H=M.getAttribute?.("style")||"";H&&m(H,v);for(let F of a){let L=M.getAttribute?.(F);L&&m(L,v)}}}}G();function Qa(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=Xn(c.top),d=Xn(c.bottom);if(u==null&&d==null)continue;let f=el(s,e),m=tl(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 v=u!=null?u+n:n+(i-p-d);if(!Number.isFinite(v))continue;let x=Number.parseInt(c.zIndex,10),w=Number.isFinite(x),S=w?Math.max(x,1)+1:2,E=w?x-1:0,b=m.cloneNode(!1);b.setAttribute(o,"1"),b.style.position="sticky",b.style.left=`${y}px`,b.style.top=`${v}px`,b.style.width=`${h}px`,b.style.height=`${p}px`,b.style.visibility="hidden",b.style.zIndex=String(E),b.style.overflow="hidden",b.style.background="transparent",b.style.boxShadow="none",b.style.filter="none",m.parentElement?.insertBefore(b,m),m.style.position="absolute",m.style.left=`${y}px`,m.style.top=`${v}px`,m.style.bottom="auto",m.style.zIndex=String(S),m.style.pointerEvents="none"}}function Xn(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function el(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 tl(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=nl(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function nl(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 rl(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 ol(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 il(e,t={}){let n={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap,options:t},r,i="",o="";rl(e);let a=ol(e);try{Za(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await Ze(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}finally{a()}try{await Ut(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){_(n,"Failed to extract shadow CSS from style[data-sd]",l)}let s=Ei(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,v=parseFloat(h.style.left)||0;h.style.top=`${y+f}px`,h.style.left=`${v+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(Qa(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||ae(e);n.styleCache.set(e,l);let u=di(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}}$e();var Sr="http://www.w3.org/1999/xlink";function al(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Sr,"href"):null)}function ll(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 sl(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 X(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}=ll(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 X(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=al(a);if(!s||s.startsWith("data:")||s.startsWith("blob:"))return;let c=await X(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(Sr,"href"))};for(let a=0;a<i.length;a+=4){let s=i.slice(a,a+4).map(o);await Promise.allSettled(s)}}J();async function cl(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)||ae(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 x=d.getPropertyValue("background");x&&/url\s*\(/.test(x)&&(p=Pt(x).filter(w=>/url\s*\(/.test(w)).join(", ")||p)}if(!p||p==="none")continue;let y=Pt(p),v=await Promise.all(y.map(x=>Zn(x,r)));v.some(x=>x&&x!=="none"&&!/^url\(undefined/.test(x))&&u.style.setProperty(h,v.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]])}}J();G();function ul(e){if(!e)return()=>{};let t=[];function n(r){let i=dl(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function dl(e){if(!e)return()=>{};let t=fl(e);if(t<=0)return()=>{};if(!hl(e))return()=>{};let n=getComputedStyle(e),r=Math.round(ml(n)*t+pl(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 fl(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 ml(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 pl(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function hl(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Oe=[];function Er(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 gl(...e){let t=e.flat();for(let n of t){let r=Er(n);r&&(Oe.some(i=>i&&i.name&&r.name&&i.name===r.name)||Oe.push(r))}}function Cr(e){return(e&&Array.isArray(e.plugins)?e.plugins:Oe)||Oe}async function de(e,t,n){let r=n,i=Cr(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=Cr(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 wl(e){let t=[];if(Array.isArray(e))for(let n of e){let r=Er(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 Oe)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function bl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=wl(t)),e}J();function xl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){_(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){_(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){_(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){_(n,"stripRootShadows filter",o)}}function vl(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 Sl(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 El(e,t={}){e&&(Sl(e,t),vl(e))}function Cl(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function kl(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Ml(e,t){if(!(e instanceof Element)||Cl(e)||kl(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 Al(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&&Ml(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 $l(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function Ll(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){_(t,"exclude selector match failed",r)}return!1}function Nl(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(Ll(m,t)||!$l(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,Tl=/::-webkit-scrollbar(-[a-z]+)?\b/i;function qt(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+=qt(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=qt(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(Tl.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function Rl(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+=qt(i,t))}catch{}return n}function _l(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 Pl(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 Fl(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 Dl(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 Il(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=kr(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 Gn(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,v){let x=y-r,w=v-i,S=o*x+s*w,E=a*x+c*w;return S+=r+l,E+=i+u,[S,E]}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,v]of f)y<m&&(m=y),v<g&&(g=v),y>h&&(h=y),v>p&&(p=v);return{minX:m,minY:g,maxX:h,maxY:p,width:h-m,height:p-g}}function Ol(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 Hl(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 Tt=null;function Wl(){if(Tt)return Tt;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),Tt=e,e}function Bl(e){let t=Wl(),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=kr(n);return t.removeChild(n),r}function Ul(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 kr(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 Mr(e,t){if(!e)throw new Error("Element cannot be null or undefined");ui(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 de("beforeSnap",o),await de("beforeClone",o);let g=ul(o.element);try{({clone:a,classCSS:s,styleCache:c}=await il(o.element,o.options)),!r&&a&&(m=Il(o.element,a)),!i&&a&&xl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:s,styleCache:c,...o},await de("afterClone",o),El(o.clone),o.options?.excludeMode==="remove")try{Al(o.element,o.clone,o.styleCache)}catch(x){console.warn("[snapdom] shrink pass failed:",x)}try{await Ma(o.clone,o.element)}catch{}await new Promise(x=>{Me(async()=>{await sl(o.clone,o.options),x()},{fast:n})}),await new Promise(x=>{Me(async()=>{await cl(o.element,o.clone,o.styleCache,o.options),x()},{fast:n})}),t.embedFonts&&await new Promise(x=>{Me(async()=>{let w=br(o.element),S=qa(o.element);if(ge()){let E=new Set(Array.from(w).map(b=>String(b).split("__")[0]).filter(Boolean));await xr(E,1)}l=await Ua({required:w,usedCodepoints:S,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),x()},{fast:n})});let h=vi(o.clone).sort(),p=h.join(",");C.baseStyle.has(p)?u=C.baseStyle.get(p):await new Promise(x=>{Me(()=>{u=Si(h),C.baseStyle.set(p,u),x()},{fast:n})});let y=Rl(o.element?.ownerDocument||document);o={fontsCSS:l,baseCSS:u,scrollbarCSS:y,...o},await de("beforeRender",o),await new Promise(x=>{Me(()=>{let w=ae(o.element),S=o.element.getBoundingClientRect(),E=Math.max(1,A(o.element.offsetWidth||parseFloat(w.width)||S.width||1)),b=Math.max(1,A(o.element.offsetHeight||parseFloat(w.height)||S.height||1)),M=o.element.ownerDocument||document;if(o.element===M.body||o.element===M.documentElement){let B=Math.max(o.element.scrollHeight||0,M.documentElement?.scrollHeight||0,M.body?.scrollHeight||0),U=Math.max(o.element.scrollWidth||0,M.documentElement?.scrollWidth||0,M.body?.scrollWidth||0);B>0&&(b=Math.max(b,A(B))),U>0&&(E=Math.max(E,A(U)));try{let ee=(o.scrollbarCSS||"").length+(o.baseCSS||"").length+(o.fontsCSS||"").length+(o.classCSS||"").length,te=C.measureHints.get(o.element);if(te&&te.cssLen===ee&&te.w0===E)te.csh>0&&(b=Math.max(b,A(te.csh))),te.csw>0&&(E=Math.max(E,A(te.csw)));else{let ne=M.createElement("div");ne.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+E+"px!important;overflow:visible!important;visibility:hidden!important;";let ze=M.createElement("style");ze.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,ne.appendChild(ze),ne.appendChild(o.clone.cloneNode(!0)),M.body.appendChild(ne);let ue=ne.scrollHeight,bt=ne.scrollWidth;M.body.removeChild(ne),C.measureHints.set(o.element,{cssLen:ee,w0:E,csh:ue,csw:bt}),ue>0&&(b=Math.max(b,A(ue))),bt>0&&(E=Math.max(E,A(bt)))}}catch{}}if(o.options?.excludeMode==="remove"){let B=Nl(o.element,o.options);Number.isFinite(B)&&B>0&&(b=Math.max(1,Math.min(b,A(B+1))))}let T=(B,U=NaN)=>{let ee=typeof B=="string"?parseFloat(B):B;return Number.isFinite(ee)?ee:U},H=T(o.options.width),F=T(o.options.height),L=E,$=b,W=Number.isFinite(H),Y=Number.isFinite(F),je=b>0?E/b:1;W&&Y?(L=Math.max(1,A(H)),$=Math.max(1,A(F))):W?(L=Math.max(1,A(H)),$=Math.max(1,A(L/(je||1)))):Y?($=Math.max(1,A(F)),L=Math.max(1,A($*(je||1)))):(L=E,$=b);let N=0,R=0,I=E,D=b;if(!r&&m&&Number.isFinite(m.a)){let B={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},U=Gn(E,b,B,0,0);N=A(U.minX),R=A(U.minY),I=A(U.maxX),D=A(U.maxY)}else if(r&&Kn(o.element)){let B=w.transform&&w.transform!=="none"?w.transform:"",U=Hl(o.element),ee=Bl({baseTransform:B,rotate:U.rotate||"0deg",scale:U.scale,translate:U.translate}),{ox:te,oy:ne}=Ol(w,E,b),ze=ee.is2D?ee:new DOMMatrix(ee.toString()),ue=Gn(E,b,ze,te,ne);N=A(ue.minX),R=A(ue.minY),I=A(ue.maxX),D=A(ue.maxY)}let le=_l(w),Q=Pl(w),be=Fl(w),xe=Dl(w),fe=i?{top:A(le.top+Q.top+be.top+xe.bleed.top),right:A(le.right+Q.right+be.right+xe.bleed.right),bottom:A(le.bottom+Q.bottom+be.bottom+xe.bleed.bottom),left:A(le.left+Q.left+be.left+xe.bleed.left)}:{top:0,right:0,bottom:0,left:0};N=A(N-fe.left),R=A(R-fe.top),I=A(I+fe.right),D=A(D+fe.bottom);let Te=Math.max(1,A(I-N)),tn=Math.max(1,A(D-R)),ko=W||Y?A(L/E):1,Mo=Y||W?A($/b):1,Ao=Math.max(1,A(Te*ko)),$o=Math.max(1,A(tn*Mo)),nn="http://www.w3.org/2000/svg",Lo=ge()&&Kn(o.element)?1:0,se=A(Lo+(r?0:1)),ce=document.createElementNS(nn,"foreignObject"),No=A(N),To=A(R);ce.setAttribute("x",String(A(-(No-se)))),ce.setAttribute("y",String(A(-(To-se)))),ce.setAttribute("width",String(A(E+se*2))),ce.setAttribute("height",String(A(b+se*2))),ce.style.overflow="visible";let rn=document.createElement("style"),Ro='svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject *{min-width:0;} foreignObject pre,foreignObject [style*="white-space"]{white-space:inherit;}';rn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+Ro+o.classCSS,ce.appendChild(rn);let Ve=document.createElement("div");Ve.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ve.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${A(E)}px;height:${A(b)}px`,Ve.appendChild(o.clone),ce.appendChild(Ve);let _o=new XMLSerializer().serializeToString(ce),yt=A(Te+se*2),wt=A(tn+se*2),on=W||Y;t.meta={w0:E,h0:b,vbW:yt,vbH:wt,targetW:L,targetH:$};let Po=ge()&&on?yt:A(Ao+se*2),Fo=ge()&&on?wt:A($o+se*2),Do=parseFloat(ae(M.documentElement)?.fontSize)||16;f=`<svg xmlns="${nn}" width="${Po}" height="${Fo}" viewBox="0 0 ${yt} ${wt}" font-size="${Do}px">`+_o+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,o={svgString:f,dataURL:d,...o},x()},{fast:n})}),await de("afterRender",o);let v=document.getElementById("snapdom-sandbox");return v&&v.style.position==="absolute"&&v.remove(),o.dataURL}function Kn(e){return Ul(e)}G();function ql(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=ci(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}}We();or();J();$e();G();function jl(...e){return gl(...e),P}var P=Object.assign(zl,{plugins:jl}),Ar=Symbol("snapdom.internal"),Vl=Symbol("snapdom.internal.silent"),Jn=!1;async function zl(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=ql(t);if(bl(n,t&&t.plugins),ge()&&(n.embedFonts===!0||Xl(e))){if(n.embedFonts)try{let i=br(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await xr(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await Yl(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&ba(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>P.toPng(r,i),toSvg:(r,i)=>P.toSvg(r,i)}),P.capture(e,n,Ar)}P.capture=async(e,t,n)=>{if(n!==Ar)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Mr(e,t),i={img:async(h,p)=>{let{toImg:y}=await Promise.resolve().then(()=>(Tn(),Ft));return y(r,{...h,...p||{}})},svg:async(h,p)=>{let{toSvg:y}=await Promise.resolve().then(()=>(Tn(),Ft));return y(r,{...h,...p||{}})},canvas:async(h,p)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(it(),ir));return y(r,{...h,...p||{}})},blob:async(h,p)=>{let{toBlob:y}=await Promise.resolve().then(()=>(ur(),sr));return y(r,{...h,...p||{}})},png:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Je(),Ke));return y(r,{...h,...p||{},format:"png"})},jpeg:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Je(),Ke));return y(r,{...h,...p||{},format:"jpeg"})},webp:async(h,p)=>{let{rasterize:y}=await Promise.resolve().then(()=>(Je(),Ke));return y(r,{...h,...p||{},format:"webp"})},download:async(h,p)=>{let{download:y}=await Promise.resolve().then(()=>(Ii(),dr));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||{},[Vl]:!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 v=l[h];if(!v)throw new Error(`[snapdom] Unknown export type: ${h}`);let x=u(h,p),w={...t,export:{type:h,options:x,url:r}};await de("beforeExport",w);let S=await v(w,x);return await de("afterExport",w,S),d||(d=!0,await de("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};P.toRaw=(e,t)=>P(e,t).then(n=>n.toRaw());P.toImg=(e,t)=>P(e,t).then(n=>n.toImg());P.toSvg=(e,t)=>P(e,t).then(n=>n.toSvg());P.toCanvas=(e,t)=>P(e,t).then(n=>n.toCanvas());P.toBlob=(e,t)=>P(e,t).then(n=>n.toBlob());P.toPng=(e,t)=>P(e,{...t,format:"png"}).then(n=>n.toPng());P.toJpg=(e,t)=>P(e,{...t,format:"jpeg"}).then(n=>n.toJpg());P.toWebp=(e,t)=>P(e,{...t,format:"webp"}).then(n=>n.toWebp());P.download=(e,t)=>P(e,t).then(n=>n.download());async function Yl(e,t){if(Jn)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Mr(e,n)}catch(i){_(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){_(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){_(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){_(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){_(t,"safariWarmup canvas poke failed",o)}}),Jn=!0}function Xl(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 $r(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 Lr(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 Nr(){let e=document.querySelectorAll('link[rel~="stylesheet"]');for(let t of e)$r(t)&&Lr(t)}function Gl(){let e=k().fonts;e.observer||(e.observer=new MutationObserver(t=>{for(let n of t)for(let r of n.addedNodes)r instanceof HTMLLinkElement&&$r(r)&&Lr(r)}),e.observer.observe(document.documentElement,{childList:!0,subtree:!0}))}function Tr(){let e=k().fonts;e.initialized||(e.initialized=!0,Nr(),Gl())}async function Rr(){Nr();try{await document.fonts.ready}catch{}}var _r=750,Kl=400,Jl=600,ye=2,Ir=["#__mindstudio-cursor","#__mindstudio-cursor-ripple","#__mindstudio-notes-cursor","#__mindstudio-camera","#__mindstudio-flash"],Zl="#DD2590",Ql=`<svg width="44" height="44" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10
10
|
<g filter="url(#filter0_d_2_302)">
|
|
11
11
|
<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"/>
|
|
12
12
|
<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"/>
|
|
@@ -23,13 +23,13 @@ ${h}
|
|
|
23
23
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2_302" result="shape"/>
|
|
24
24
|
</filter>
|
|
25
25
|
</defs>
|
|
26
|
-
</svg>`,
|
|
27
|
-
${
|
|
26
|
+
</svg>`,Gt="__mindstudio-camera",Or="__mindstudio-flash";function es(){if(document.getElementById(Gt))return;let e=k().screenshot,t=document.createElement("div");t.id=Gt,t.innerHTML=`
|
|
27
|
+
${Ql}
|
|
28
28
|
<div style="
|
|
29
29
|
position: absolute;
|
|
30
30
|
left: 48px;
|
|
31
31
|
top: 12px;
|
|
32
|
-
background: ${
|
|
32
|
+
background: ${Zl};
|
|
33
33
|
color: white;
|
|
34
34
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
35
35
|
font-size: 11px;
|
|
@@ -40,7 +40,7 @@ ${h}
|
|
|
40
40
|
white-space: nowrap;
|
|
41
41
|
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
42
42
|
">Remy</div>
|
|
43
|
-
`,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=
|
|
43
|
+
`,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=Or,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 ts(e,t){let{cameraEl:n}=k().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`,n.style.opacity="1")}function Pr(e,t){let{cameraEl:n}=k().screenshot;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}async function ns(){let{flashEl:e}=k().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 Fr(){let{cameraEl:e}=k().screenshot;e&&(e.style.opacity="0")}function rs(){let e=k().screenshot;document.getElementById(Gt)?.remove(),document.getElementById(Or)?.remove(),e.cameraEl=null,e.flashEl=null}function Dr(e,t){return new Promise(n=>{let r=window.scrollY,i=e-r;if(Math.abs(i)<1){n();return}let o=Math.abs(i),s=Math.max(t,o/2),c=performance.now();function l(u){let d=u-c,f=Math.min(d/s,1),m=f<.5?4*f*f*f:1-Math.pow(-2*f+2,3)/2;window.scrollTo(0,r+i*m),f<1?requestAnimationFrame(l):n()}requestAnimationFrame(l)})}async function Be(e){await Rr();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return os(t,n);let r=window.scrollY,i=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",es();try{let o=Math.random()<.5?t+30:-60,a=n*.3+Math.random()*n*.4;ts(o,a),await O(200);let s=t*.4+Math.random()*t*.15,c=n*.35+Math.random()*n*.15;Pr(s,c),await O(700);let l=()=>Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),u=0;for(;u<l();){let h=l()-n,p=Math.min(u,h);Math.abs(p-window.scrollY)>1&&(await Dr(p,Kl),Pr(s,c),await O(_r)),await ns(),u+=n}await Dr(0,Jl),await O(_r),Fr();let f=await(await P(document.body,{embedFonts:!0,exclude:Ir,excludeMode:"remove"})).toCanvas({width:t});if(!f)throw new Error("Screenshot capture produced no image data");let g=f.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!g)throw new Error("Canvas export produced no image data");return{image:g,width:f.width,height:f.height}}finally{Fr(),rs(),document.documentElement.style.scrollBehavior="auto",window.scrollTo(0,r),document.documentElement.style.scrollBehavior=i}}async function os(e,t){let r=await(await P(document.body,{embedFonts:!0,exclude:Ir,excludeMode:"remove"})).toCanvas({width:e,scale:ye});if(!r)throw new Error("SnapDOM viewport capture returned empty result");let i=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),o=document.createElement("canvas");o.width=e*ye,o.height=t*ye;let a=o.getContext("2d");if(!a)throw new Error("Failed to create canvas context");let s=window.scrollY/i*r.height,c=t/i*r.height;a.drawImage(r,0,s,r.width,c,0,0,e*ye,t*ye);let u=o.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!u)throw new Error("Canvas export produced no image data");return{image:u,width:e*ye,height:t*ye}}function Hr(){let e=k().zoom,t=new URLSearchParams(window.location.search);e.pipMode=t.get("display-mode")==="pip",window.addEventListener("message",n=>{!n.data||typeof n.data.command!="string"||(n.data.command==="display-mode-pip"?e.pipMode=!0:n.data.command==="display-mode-full"&&(e.pipMode=!1))})}var Wr="__mindstudio-cursor",is="__mindstudio-cursor-ripple",Br=.07,as=250,lt=300,ls=2e3,at=10,Ur=1,st="#DD2590",ss=`<svg width="40" height="41" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
44
44
|
<g filter="url(#filter0_d_4_78)">
|
|
45
45
|
<path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${st}"/>
|
|
46
46
|
<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="${st}"/>
|
|
@@ -57,8 +57,8 @@ ${h}
|
|
|
57
57
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_4_78" result="shape"/>
|
|
58
58
|
</filter>
|
|
59
59
|
</defs>
|
|
60
|
-
</svg>`,
|
|
61
|
-
${
|
|
60
|
+
</svg>`,cs="Remy";function qr(e,t,n){return e+(t-e)*n}function jr(){window.location.search.includes("mode=iframe")&&(Vr(),Hr())}function Vr(){if(document.getElementById(Wr))return;let e=k().cursor,t=document.createElement("div");t.id=Wr,t.innerHTML=`
|
|
61
|
+
${ss}
|
|
62
62
|
<div style="
|
|
63
63
|
position: absolute;
|
|
64
64
|
left: 33px;
|
|
@@ -74,14 +74,14 @@ ${h}
|
|
|
74
74
|
white-space: nowrap;
|
|
75
75
|
letter-spacing: 0.3px;
|
|
76
76
|
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
77
|
-
">${
|
|
78
|
-
`,t.style.cssText=["position: fixed","top: 0","left: 0","z-index: 2147483647","pointer-events: none","will-change: left, top, transform, opacity","opacity: 0"].join("; ");let n=document.createElement("div");n.id=Ql,n.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${st}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.documentElement.appendChild(n),document.documentElement.appendChild(t),e.el=t,e.rippleEl=n}function os(){k().cursor.trackingFrame===null&&Ur()}function Br(){let e=k().cursor;e.trackingFrame!==null&&(cancelAnimationFrame(e.trackingFrame),e.trackingFrame=null),e.targetElement=null}function Ur(){let e=k().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(at,Math.min(n,i-at)),c=Math.max(at,Math.min(r,o-at));if(e.x=Or(e.x,a,Dr),e.y=Or(e.y,c,Dr),e.el.style.transition="none",e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,Math.abs(e.x-a)<Ir&&Math.abs(e.y-c)<Ir&&(e.x=a,e.y=c,e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,e.settledResolve)){let l=e.settledResolve;e.settledResolve=null,l()}}else if(e.targetElement&&!e.targetElement.isConnected&&e.settledResolve){let t=e.settledResolve;e.settledResolve=null,t()}e.trackingFrame=requestAnimationFrame(Ur)}}async function ct(e){let t=k().cursor;if(t.el){if(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.targetElement=e,!t.visible){let n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2;if(!t.hasPosition){let 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.el.style.transition=`opacity ${lt}ms ease`,t.el.style.opacity="1",t.visible=!0,t.hasPosition=!0,await W(lt)}return os(),new Promise(n=>{t.settledResolve=n})}}async function qr(){let e=k().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 W(es),e.el&&(e.el.style.transform="scale(1) translateY(0)"),await W(100))}function Oe(e){k().cursor.executing=e}function Gt(){let e=k().cursor;e.hideTimer&&(clearTimeout(e.hideTimer),e.hideTimer=null)}function ut(){let e=k().cursor;e.el&&e.forcedState!=="visible"&&(e.targetElement=null,e.hideTimer&&clearTimeout(e.hideTimer),e.hideTimer=setTimeout(()=>{e.forcedState!=="visible"&&(e.el&&(e.el.style.transition=`opacity ${lt}ms ease`,e.el.style.opacity="0",e.visible=!1),Br(),e.hideTimer=null)},ts))}function dt(e){let t=k().cursor;t.executing||(t.forcedState=e,e==="visible"&&!t.el&&Wr(),t.el&&(e==="visible"?(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.el.style.transition=`opacity ${lt}ms ease`,t.el.style.opacity="1",t.visible=!0):e==="hidden"?(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.el.style.opacity="0",t.visible=!1,Br()):ut()))}var as=["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 ls(e,t){let n=t??as;if(e.ref||e.text||e.role||e.label||e.selector){let{element:o,matched:a}=te(e);return{...jr(o,e.ref,n),matched:a}}let r=we(),i=[];for(let[o,a]of r)a.isConnected&&i.push(jr(a,o,n));return i}function jr(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 c=r.getPropertyValue(a.replace(/([A-Z])/g,"-$1").toLowerCase());c&&(i[a]=c)}return i}var zr=150,mt=100,ft="__mindstudio_pending_nav";async function Kt(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,i=Date.now(),o=window.scrollY,a=window.scrollX,c=document.body.scrollTop,l=document.documentElement.scrollTop,s=document.body.scrollHeight,u=document.body.scrollWidth;function d(){if(Date.now()>r){n();return}let f=window.scrollY,p=window.scrollX,g=document.body.scrollTop,h=document.documentElement.scrollTop,m=document.body.scrollHeight,y=document.body.scrollWidth;(f!==o||p!==a||g!==c||h!==l||m!==s||y!==u)&&(o=f,a=p,c=g,l=h,s=m,u=y,i=Date.now()),Date.now()-i>=e?n():requestAnimationFrame(d)}requestAnimationFrame(d)})}var ss=350;async function Jt(e){let t=cs(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 c=performance.now();function l(s){let u=s-c,d=Math.min(u/ss,1),f=1-Math.pow(1-d,3);for(let p of o)p.el.scrollTop=p.fromTop+(p.toTop-p.fromTop)*f,p.el.scrollLeft=p.fromLeft+(p.toLeft-p.fromLeft)*f;d<1?requestAnimationFrame(l):a()}requestAnimationFrame(l)})}function cs(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 pt(e,t){let n=Date.now(),r=[],i=[],o="",a=!1,c=new Set(["click","type","select"]),l=t.some(s=>c.has(s.command));l&&(Oe(!0),Gt()),St();try{for(let s=0;s<t.length;s++){let u=t[s],d=u.command;try{if(s>0&&await W(zr+Math.random()*mt-mt/2),d==="navigate"){let p=u.url;if(!p)throw new Error('navigate command requires a "url" field');let g=t.slice(s+1);if(g.length>0)try{sessionStorage.setItem(ft,JSON.stringify({id:e,startTime:n,completedSteps:r,remainingSteps:g,stepOffset:s+1}))}catch{}r.push({index:s,command:d,result:"ok"}),a=!0,window.location.href=p,await new Promise(()=>{})}let f=await Yr(u);r.push({index:s,command:d,...f})}catch(f){r.push({index:s,command:d,error:f instanceof Error?f.message:String(f)});break}}i=Et();try{o=await be()}catch{}}finally{l&&(Oe(!1),ut())}return{id:e,steps:r,snapshot:o,logs:i,duration:Date.now()-n}}async function Vr(){let e=null;try{let o=sessionStorage.getItem(ft);if(!o)return null;sessionStorage.removeItem(ft),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&&(Oe(!0),Gt()),St();try{for(let o=0;o<e.remainingSteps.length;o++){let a=e.remainingSteps[o],c=a.command,l=e.stepOffset+o;try{if(o>0&&await W(zr+Math.random()*mt-mt/2),c==="navigate"){let u=a.url;if(!u)throw new Error('navigate command requires a "url" field');let d=e.remainingSteps.slice(o+1);if(d.length>0)try{sessionStorage.setItem(ft,JSON.stringify({id:e.id,startTime:e.startTime,completedSteps:t,remainingSteps:d,stepOffset:l+1}))}catch{}t.push({index:l,command:c,result:"ok"}),window.location.href=u,await new Promise(()=>{})}let s=await Yr(a);t.push({index:l,command:c,...s})}catch(s){t.push({index:l,command:c,error:s instanceof Error?s.message:String(s)});break}}n=Et();try{r=await be()}catch{}}finally{i&&(Oe(!1),ut())}return{id:e.id,steps:t,snapshot:r,logs:n,duration:Date.now()-e.startTime}}async function Yr(e){switch(e.command){case"snapshot":return{result:await be()};case"click":{let{element:t,matched:n}=te(e);return await Jt(t),await ct(t),await qr(),$t(t),await Kt(),await W(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=te(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await Jt(t),await ct(t),await En(t,r,{clear:!!e.clear}),await Kt(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=te(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await Jt(t),await ct(t);let i=kn(t,r);return await Kt(),{result:`selected "${i}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await Cn(e);return{result:"ok",matched:t,elapsed:n}}case"styles":{let t=e.properties;return{result:ls(e,t)}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await Mn(t)}}case"screenshotFullPage":{window.scrollTo({top:0,behavior:"instant"}),await W(500);let{image:t,width:n,height:r}=await Ie(),i=e.uploadUrl,o=e.uploadFields;if(i&&o){let a=atob(t),c=new Uint8Array(a.length);for(let d=0;d<a.length;d++)c[d]=a.charCodeAt(d);let l=new FormData;for(let[d,f]of Object.entries(o))l.append(d,f);l.append("file",new Blob([c],{type:"image/jpeg"}),"screenshot.jpg");let s=await fetch(i,{method:"POST",body:l});if(!s.ok)throw new Error(`Screenshot upload failed: ${s.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"screenshotViewport":{let{image:t,width:n,height:r}=await Ie({viewportOnly:!0}),i=e.uploadUrl,o=e.uploadFields;if(i&&o){let a=atob(t),c=new Uint8Array(a.length);for(let d=0;d<a.length;d++)c[d]=a.charCodeAt(d);let l=new FormData;for(let[d,f]of Object.entries(o))l.append(d,f);l.append("file",new Blob([c],{type:"image/jpeg"}),"screenshot.jpg");let s=await fetch(i,{method:"POST",body:l});if(!s.ok)throw new Error(`Screenshot upload failed: ${s.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 us="/__mindstudio_dev__/ws",ds=1e3,fs=1e4;function Gr(){let e=k().ws;e.ws||(an(Kr),window.addEventListener("beforeunload",()=>{e.closing=!0,e.ws&&e.ws.close()}),Jr())}function Kr(){let{ws:e}=k().ws;return e&&e.readyState===WebSocket.OPEN?e:null}function ms(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${us}`}function ps(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function Jr(){let e=k().ws;if(!e.closing){try{e.ws=new WebSocket(ms())}catch{Xr();return}e.ws.onopen=()=>{try{e.ws.send(JSON.stringify({type:"hello",mode:ps(),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=ds,gs();break;case"command":hs(n.id,n.steps);break;case"broadcast":ys(n.action,n.payload);break}},e.ws.onclose=()=>{e.ws=null,e.clientId=null,e.closing||Xr()},e.ws.onerror=()=>{}}}function Xr(){let e=k().ws;e.closing||(setTimeout(()=>Jr(),e.reconnectDelay),e.reconnectDelay=Math.min(e.reconnectDelay*2,fs))}async function hs(e,t){let n=k().ws;if(n.busy){ht({id:e,steps:[],snapshot:"",logs:[],duration:0,error:"Browser agent is busy"});return}n.busy=!0,Zt("command-started",{id:e,steps:t.map(r=>r.command)});try{let r=await pt(e,t);ht(r),Zt("command-completed",{id:e,success:!0})}catch{ht({id:e,steps:[],snapshot:"",logs:[],duration:0}),Zt("command-completed",{id:e,success:!1})}finally{k().ws.busy=!1}}function ht(e){try{let t=Kr();t&&t.send(JSON.stringify({type:"result",...e}))}catch{}}async function gs(){let e=await Vr();e&&ht(e)}function Zt(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function ys(e,t){e==="reload"&&location.reload()}var Z="#DD2590";var Zr="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",ws=200,Qr=`
|
|
79
|
-
width: ${
|
|
77
|
+
">${cs}</div>
|
|
78
|
+
`,t.style.cssText=["position: fixed","top: 0","left: 0","z-index: 2147483647","pointer-events: none","will-change: left, top, transform, opacity","opacity: 0"].join("; ");let n=document.createElement("div");n.id=is,n.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${st}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.documentElement.appendChild(n),document.documentElement.appendChild(t),e.el=t,e.rippleEl=n}function us(){k().cursor.trackingFrame===null&&Yr()}function zr(){let e=k().cursor;e.trackingFrame!==null&&(cancelAnimationFrame(e.trackingFrame),e.trackingFrame=null),e.targetElement=null}function Yr(){let e=k().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(at,Math.min(n,i-at)),s=Math.max(at,Math.min(r,o-at));if(e.x=qr(e.x,a,Br),e.y=qr(e.y,s,Br),e.el.style.transition="none",e.el.style.left=`${e.x}px`,e.el.style.top=`${e.y}px`,Math.abs(e.x-a)<Ur&&Math.abs(e.y-s)<Ur&&(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&&e.settledResolve){let t=e.settledResolve;e.settledResolve=null,t()}e.trackingFrame=requestAnimationFrame(Yr)}}async function ct(e){let t=k().cursor;if(t.el){if(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.targetElement=e,!t.visible){let n=e.getBoundingClientRect(),r=n.left+n.width/2,i=n.top+n.height/2;if(!t.hasPosition){let 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.el.style.transition=`opacity ${lt}ms ease`,t.el.style.opacity="1",t.visible=!0,t.hasPosition=!0,await O(lt)}return us(),new Promise(n=>{t.settledResolve=n})}}async function Xr(){let e=k().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(as),e.el&&(e.el.style.transform="scale(1) translateY(0)"),await O(100))}function Ue(e){k().cursor.executing=e}function Kt(){let e=k().cursor;e.hideTimer&&(clearTimeout(e.hideTimer),e.hideTimer=null)}function ut(){let e=k().cursor;e.el&&e.forcedState!=="visible"&&(e.targetElement=null,e.hideTimer&&clearTimeout(e.hideTimer),e.hideTimer=setTimeout(()=>{e.forcedState!=="visible"&&(e.el&&(e.el.style.transition=`opacity ${lt}ms ease`,e.el.style.opacity="0",e.visible=!1),zr(),e.hideTimer=null)},ls))}function dt(e){let t=k().cursor;t.executing||(t.forcedState=e,e==="visible"&&!t.el&&Vr(),t.el&&(e==="visible"?(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.el.style.transition=`opacity ${lt}ms ease`,t.el.style.opacity="1",t.visible=!0):e==="hidden"?(t.hideTimer&&(clearTimeout(t.hideTimer),t.hideTimer=null),t.el.style.opacity="0",t.visible=!1,zr()):ut()))}var fs=["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 ms(e,t){let n=t??fs;if(e.ref||e.text||e.role||e.label||e.selector){let{element:o,matched:a}=oe(e);return{...Gr(o,e.ref,n),matched:a}}let r=Se(),i=[];for(let[o,a]of r)a.isConnected&&i.push(Gr(a,o,n));return i}function Gr(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 Kr=150,mt=100,ft="__mindstudio_pending_nav";async function Jt(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,i=Date.now(),o=window.scrollY,a=window.scrollX,s=document.body.scrollTop,c=document.documentElement.scrollTop,l=document.body.scrollHeight,u=document.body.scrollWidth;function d(){if(Date.now()>r){n();return}let f=window.scrollY,m=window.scrollX,g=document.body.scrollTop,h=document.documentElement.scrollTop,p=document.body.scrollHeight,y=document.body.scrollWidth;(f!==o||m!==a||g!==s||h!==c||p!==l||y!==u)&&(o=f,a=m,s=g,c=h,l=p,u=y,i=Date.now()),Date.now()-i>=e?n():requestAnimationFrame(d)}requestAnimationFrame(d)})}var ps=350;async function Zt(e){let t=hs(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/ps,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 hs(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 pt(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&&(Ue(!0),Kt()),Et();try{for(let l=0;l<t.length;l++){let u=t[l],d=u.command;try{if(l>0&&await O(Kr+Math.random()*mt-mt/2),d==="navigate"){let m=u.url;if(!m)throw new Error('navigate command requires a "url" field');let g=t.slice(l+1);if(g.length>0)try{sessionStorage.setItem(ft,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(()=>{})}let f=await Zr(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}}i=Ct();try{o=await Ee()}catch{}}finally{c&&(Ue(!1),ut())}return{id:e,steps:r,snapshot:o,logs:i,duration:Date.now()-n}}async function Jr(){let e=null;try{let o=sessionStorage.getItem(ft);if(!o)return null;sessionStorage.removeItem(ft),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&&(Ue(!0),Kt()),Et();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(Kr+Math.random()*mt-mt/2),s==="navigate"){let u=a.url;if(!u)throw new Error('navigate command requires a "url" field');let d=e.remainingSteps.slice(o+1);if(d.length>0)try{sessionStorage.setItem(ft,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(()=>{})}let l=await Zr(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}}n=Ct();try{r=await Ee()}catch{}}finally{i&&(Ue(!1),ut())}return{id:e.id,steps:t,snapshot:r,logs:n,duration:Date.now()-e.startTime}}async function Zr(e){switch(e.command){case"snapshot":return{result:await Ee()};case"click":{let{element:t,matched:n}=oe(e);return await Zt(t),await ct(t),await Xr(),Lt(t),await Jt(),await O(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=oe(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await Zt(t),await ct(t),await Cn(t,r,{clear:!!e.clear}),await Jt(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=oe(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await Zt(t),await ct(t);let i=Mn(t,r);return await Jt(),{result:`selected "${i}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await kn(e);return{result:"ok",matched:t,elapsed:n}}case"styles":{let t=e.properties;return{result:ms(e,t)}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await An(t)}}case"screenshotFullPage":{window.scrollTo({top:0,behavior:"instant"}),await O(500);let{image:t,width:n,height:r}=await Be(),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"screenshotViewport":{let{image:t,width:n,height:r}=await Be({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 gs="/__mindstudio_dev__/ws",ys=1e3,ws=1e4;function eo(){let e=k().ws;e.ws||(ln(to),window.addEventListener("beforeunload",()=>{e.closing=!0,e.ws&&e.ws.close()}),no())}function to(){let{ws:e}=k().ws;return e&&e.readyState===WebSocket.OPEN?e:null}function bs(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${gs}`}function xs(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function no(){let e=k().ws;if(!e.closing){try{e.ws=new WebSocket(bs())}catch{Qr();return}e.ws.onopen=()=>{try{e.ws.send(JSON.stringify({type:"hello",mode:xs(),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=ys,Ss();break;case"command":vs(n.id,n.steps);break;case"broadcast":Es(n.action,n.payload);break}},e.ws.onclose=()=>{e.ws=null,e.clientId=null,e.closing||Qr()},e.ws.onerror=()=>{}}}function Qr(){let e=k().ws;e.closing||(setTimeout(()=>no(),e.reconnectDelay),e.reconnectDelay=Math.min(e.reconnectDelay*2,ws))}async function vs(e,t){let n=k().ws;if(n.busy){ht({id:e,steps:[],snapshot:"",logs:[],duration:0,error:"Browser agent is busy"});return}n.busy=!0,Qt("command-started",{id:e,steps:t.map(r=>r.command)});try{let r=await pt(e,t);ht(r),Qt("command-completed",{id:e,success:!0})}catch{ht({id:e,steps:[],snapshot:"",logs:[],duration:0}),Qt("command-completed",{id:e,success:!1})}finally{k().ws.busy=!1}}function ht(e){try{let t=to();t&&t.send(JSON.stringify({type:"result",...e}))}catch{}}async function Ss(){let e=await Jr();e&&ht(e)}function Qt(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function Es(e,t){e==="reload"&&location.reload()}var Z="#DD2590";var ro="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",Cs=200,oo=`
|
|
79
|
+
width: ${Cs}px;
|
|
80
80
|
background: ${Z};
|
|
81
81
|
border-radius: 19px 120px 120px;
|
|
82
82
|
font-weight: bold;
|
|
83
83
|
padding: 8px 18px 10px 18px;
|
|
84
|
-
font-family: ${
|
|
84
|
+
font-family: ${ro};
|
|
85
85
|
font-size: 14px;
|
|
86
86
|
line-height: 1.4;
|
|
87
87
|
color: white;
|
|
@@ -89,7 +89,7 @@ ${h}
|
|
|
89
89
|
overflow-wrap: break-word;
|
|
90
90
|
white-space: pre-wrap;
|
|
91
91
|
transition: box-shadow 0.15s;
|
|
92
|
-
`.trim(),
|
|
92
|
+
`.trim(),qe={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"},ks=`
|
|
93
93
|
position: absolute;
|
|
94
94
|
top: -8px;
|
|
95
95
|
right: -4px;
|
|
@@ -106,9 +106,9 @@ ${h}
|
|
|
106
106
|
pointer-events: auto;
|
|
107
107
|
display: none;
|
|
108
108
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
109
|
-
font-family: ${
|
|
109
|
+
font-family: ${ro};
|
|
110
110
|
font-weight: bold;
|
|
111
|
-
`.trim();function
|
|
111
|
+
`.trim();function io(){let e=document.createElement("div");return e.dataset.deleteBtn="true",e.innerHTML="\xD7",e.style.cssText=ks,e}function ao(e,t){let n=`note-${++k().noteElement.counter}`,r=document.createElement("div");r.id=n,r.dataset.noteId=n,r.style.cssText=`
|
|
112
112
|
position: absolute;
|
|
113
113
|
left: ${e}px;
|
|
114
114
|
top: ${t}px;
|
|
@@ -127,10 +127,10 @@ ${h}
|
|
|
127
127
|
pointer-events: none;
|
|
128
128
|
z-index: 2;
|
|
129
129
|
`;let o=document.createElement("div");o.style.cssText="position: relative;";let a=document.createElement("div");a.dataset.bubble="true",a.style.cssText=`
|
|
130
|
-
${
|
|
131
|
-
box-shadow: ${
|
|
130
|
+
${oo}
|
|
131
|
+
box-shadow: ${qe.inactive};
|
|
132
132
|
cursor: grab;
|
|
133
|
-
`;let
|
|
133
|
+
`;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 lo(e,t,n,r){let i=`note-${++k().noteElement.counter}`,o=document.createElement("div");o.id=i,o.dataset.noteId=i,o.style.cssText=`
|
|
134
134
|
position: absolute;
|
|
135
135
|
left: ${e}px;
|
|
136
136
|
top: ${t}px;
|
|
@@ -142,15 +142,15 @@ ${h}
|
|
|
142
142
|
border: 4px dashed ${Z};
|
|
143
143
|
border-radius: 12px;
|
|
144
144
|
pointer-events: none;
|
|
145
|
-
`;let
|
|
145
|
+
`;let s=document.createElement("div");s.style.cssText=`
|
|
146
146
|
position: absolute;
|
|
147
147
|
left: 0;
|
|
148
148
|
top: ${r+8}px;
|
|
149
|
-
`;let
|
|
150
|
-
${
|
|
151
|
-
box-shadow: ${
|
|
149
|
+
`;let c=document.createElement("div");c.dataset.bubble="true",c.style.cssText=`
|
|
150
|
+
${oo}
|
|
151
|
+
box-shadow: ${qe.inactive};
|
|
152
152
|
cursor: grab;
|
|
153
|
-
`;let
|
|
153
|
+
`;let l=io();return s.appendChild(c),s.appendChild(l),o.appendChild(a),o.appendChild(s),{id:i,type:"area",x:e,y:t,width:n,height:r,element:o,bubble:c,deleteBtn:l,state:"inactive"}}function so(e){e.state="selected",e.bubble.contentEditable="false",e.bubble.style.boxShadow=qe.selected,e.bubble.style.cursor="grab",e.deleteBtn.style.display="block"}function gt(e){e.state="editing",e.bubble.contentEditable="true",e.bubble.style.boxShadow=qe.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 Le(e){return e.bubble.textContent?.trim()||""?(e.state="inactive",e.bubble.contentEditable="false",e.bubble.style.boxShadow=qe.inactive,e.bubble.style.cursor="grab",e.deleteBtn.style.display="none",!0):!1}var Ms="__mindstudio-notes-overlay",As="__mindstudio-notes-cursor",$s=5,Ls=`<svg width="25" height="26" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
154
154
|
<g filter="url(#filter0_d_notes)">
|
|
155
155
|
<path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${Z}"/>
|
|
156
156
|
<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="${Z}"/>
|
|
@@ -167,23 +167,23 @@ ${h}
|
|
|
167
167
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
|
168
168
|
</filter>
|
|
169
169
|
</defs>
|
|
170
|
-
</svg>`;function
|
|
170
|
+
</svg>`;function uo(){let e=k().noteLayer;e.overlay||(e.overlay=document.createElement("div"),e.overlay.id=Ms,e.overlay.style.cssText=`
|
|
171
171
|
position: fixed;
|
|
172
172
|
inset: 0;
|
|
173
173
|
z-index: 2147483646;
|
|
174
174
|
cursor: none;
|
|
175
175
|
touch-action: none;
|
|
176
|
-
`,e.cursorEl=document.createElement("div"),e.cursorEl.id=
|
|
176
|
+
`,e.cursorEl=document.createElement("div"),e.cursorEl.id=As,e.cursorEl.innerHTML=Ls,e.cursorEl.style.cssText=`
|
|
177
177
|
position: fixed;
|
|
178
178
|
top: 0;
|
|
179
179
|
left: 0;
|
|
180
180
|
z-index: 2147483647;
|
|
181
181
|
pointer-events: none;
|
|
182
182
|
will-change: left, top;
|
|
183
|
-
`,e.overlay.addEventListener("pointerdown",
|
|
183
|
+
`,e.overlay.addEventListener("pointerdown",ho),e.overlay.addEventListener("pointermove",po),document.addEventListener("pointermove",go,{capture:!0}),document.addEventListener("pointerup",yo,{capture:!0}),document.addEventListener("pointercancel",wo,{capture:!0}),document.addEventListener("keydown",bo),document.body.appendChild(e.overlay),document.body.appendChild(e.cursorEl))}function fo(){let e=k().noteLayer;document.removeEventListener("pointermove",go,{capture:!0}),document.removeEventListener("pointerup",yo,{capture:!0}),document.removeEventListener("pointercancel",wo,{capture:!0}),document.removeEventListener("keydown",bo),e.overlay&&(e.overlay.removeEventListener("pointerdown",ho),e.overlay.removeEventListener("pointermove",po),e.overlay.remove(),e.overlay=null),e.cursorEl&&(e.cursorEl.remove(),e.cursorEl=null),e.notes=[],e.currentNote=null,Ne()}function mo(){let e=k().noteLayer;e.cursorEl&&(e.cursorEl.style.display="none"),e.movingNote=null,e.consumedByDeactivation=!1,Ne()}function po(e){let t=k().noteLayer;if(!t.cursorEl||!t.overlay)return;t.cursorEl.style.left=`${e.clientX}px`,t.cursorEl.style.top=`${e.clientY}px`,xo(e.target)?(t.cursorEl.style.display="none",t.overlay.style.cursor=""):(t.cursorEl.style.display="",t.overlay.style.cursor="none")}function ho(e){let t=k().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){we(o),e.preventDefault(),e.stopPropagation();return}}}t.overlay.setPointerCapture(e.pointerId);let r=xo(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]")){gt(r),t.currentNote=r,e.preventDefault();return}co(r,e),e.preventDefault();return}t.currentNote&&t.currentNote!==r&&(Le(t.currentNote)||we(t.currentNote)),so(r),t.currentNote=r,co(r,e),e.preventDefault();return}if(t.currentNote&&(t.currentNote.state==="editing"||t.currentNote.state==="selected")){Le(t.currentNote)||we(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 go(e){let t=k().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)>$s&&(t.didDrag=!0,t.dragPreview||(t.dragPreview=document.createElement("div"),t.dragPreview.style.cssText=`
|
|
184
184
|
position: fixed;
|
|
185
185
|
border: 4px dashed ${Z};
|
|
186
186
|
border-radius: 12px;
|
|
187
187
|
pointer-events: none;
|
|
188
188
|
z-index: 2;
|
|
189
|
-
`,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
|
|
189
|
+
`,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 yo(e){let t=k().noteLayer;if(t.overlay)try{t.overlay.releasePointerCapture(e.pointerId)}catch{}if(t.movingNote){t.movingNote=null;return}if(t.consumedByDeactivation){t.consumedByDeactivation=!1,Ne();return}if(!t.pointerDown||!t.overlay){Ne();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=lo(n,r,i,o);t.overlay.appendChild(a.element),t.notes.push(a),gt(a),t.currentNote=a}}else{let n=ao(e.clientX,e.clientY);t.overlay.appendChild(n.element),t.notes.push(n),gt(n),t.currentNote=n}Ne()}function wo(){let e=k().noteLayer;e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null),e.movingNote=null,Ne()}function bo(e){let t=k().noteLayer;if(t.currentNote){if(e.key==="Enter"&&!e.shiftKey&&t.currentNote.state==="editing"){Le(t.currentNote)||we(t.currentNote),t.currentNote=null,e.preventDefault();return}if(e.key==="Escape"){t.currentNote.state==="editing"?(Le(t.currentNote)||we(t.currentNote),t.currentNote=null):t.currentNote.state==="selected"&&(Le(t.currentNote),t.currentNote=null),e.preventDefault();return}if(t.currentNote.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){we(t.currentNote),t.currentNote=null,e.preventDefault();return}t.currentNote.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&t.currentNote.bubble.textContent?.trim()===""&&(we(t.currentNote),t.currentNote=null,e.preventDefault())}}function co(e,t){let n=k().noteLayer;n.movingNote=e,n.moveOffsetX=t.clientX-e.x,n.moveOffsetY=t.clientY-e.y}function xo(e){let t=k().noteLayer;for(let n of t.notes)if(n.element.contains(e))return n;return null}function we(e){let t=k().noteLayer;e.element.remove(),t.notes=t.notes.filter(n=>n.id!==e.id),t.currentNote===e&&(t.currentNote=null)}function Ne(){let e=k().noteLayer;e.pointerDown=!1,e.startX=0,e.startY=0,e.didDrag=!1,e.dragPreview&&(e.dragPreview.remove(),e.dragPreview=null)}function vo(){let e=k().notesMode;e.active||(e.active=!0,uo())}function So(){let e=k().notesMode;e.active&&(e.active=!1,fo())}async function Eo(){let{image:e}=await Be({viewportOnly:!0});return e}var en="mindstudio-browser-agent";function Co(){let e=k().messages;e.handler||(e.handler=async t=>{if(t.source===window)return;let n=t.data;if(!(!n||n.channel!==en))switch(n.command){case"notes-enter":vo();break;case"notes-exit":So();break;case"notes-cursor-hide":mo();break;case"cursor-show":dt("visible");break;case"cursor-hide":dt("hidden");break;case"cursor-auto":dt(null);break;case"notes-screenshot":{try{let r=await Eo();window.parent.postMessage({channel:en,command:"screenshot-result",image:r},"*")}catch(r){window.parent.postMessage({channel:en,command:"screenshot-result",error:r instanceof Error?r.message:"Screenshot failed"},"*")}break}}},window.addEventListener("message",e.handler))}window.__MINDSTUDIO_BROWSER_AGENT__||(window.__MINDSTUDIO_BROWSER_AGENT__=!0,cn(),pn(),hn(),gn(),wn(),yn(),eo(),jr(),Co(),Tr(),window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:"ready"},"*"));return Uo(Ns);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstudio-ai/browser-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
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": [
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"typescript": "^5.7.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@zumer/snapdom": "^2.
|
|
23
|
+
"@zumer/snapdom": "^2.6.0"
|
|
24
24
|
}
|
|
25
25
|
}
|