@zumer/snapdom 2.12.8 → 2.12.9
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/plugins.mjs +1 -1
- package/dist/preCache.mjs +3 -3
- package/dist/snapdom.js +5 -5
- package/dist/snapdom.mjs +7 -7
- package/package.json +1 -1
package/dist/snapdom.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* SnapDOM
|
|
3
|
-
* v2.12.
|
|
3
|
+
* v2.12.9
|
|
4
4
|
* Author: Juan Martin Muda
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
|
-
var Dr=Object.defineProperty;var q=(t,e)=>()=>(t&&(e=t(t=0)),e);var Rt=(t,e)=>{for(var n in e)Dr(t,n,{get:e[n],enumerable:!0})};function Xe(t){if(t===!0)return"soft";if(t===!1)return"disabled";if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="auto")return"auto";if(e==="full")return"full";if(e==="soft"||e==="disabled")return e}return"soft"}function Xt(t="soft"){switch(A.session.__counterEpoch=(A.session.__counterEpoch||0)+1,t){case"auto":{A.session.styleMap=new Map,A.session.nodeMap=new Map;return}case"soft":{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap,A.computedStyle=new WeakMap,A.measureHints=new WeakMap,A.baseStyle=new D(50),A.defaultStyle=new D(30),A.image=new D(100),A.background=new D(100),A.resource=new D(150),A.font=new Set;return}default:{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap;return}}}var D,A,j=q(()=>{D=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let r=this.keys().next().value;r!==void 0&&this.delete(r)}return super.set(e,n)}},A={image:new D(100),background:new D(100),resource:new D(150),defaultStyle:new D(30),baseStyle:new D(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function pt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function he(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.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(", ")})`)}),e=e.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(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function ft(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ge(t,e){if(!t||/^(data|blob|about|#)/i.test(t.trim()))return t;try{let n=e||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(t,n).href}catch{return t}}var Lt=q(()=>{});function Hr(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(s,a,l){if(i>=n)return;let u=Date.now();(r.get(a)||0)>u||(r.set(a,u+e),i++,s==="warn"&&console&&console.warn?console.warn(`${t} ${l}`):console&&console.error&&console.error(`${t} ${l}`))}return{warnOnce(s,a){o("warn",s,a)},errorOnce(s,a){o("error",s,a)},reset(){r.clear(),i=0}}}function zr(t){return/^data:|^blob:|^about:blank$/i.test(t)}function Vr(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,i=new URL(r||".",n),o=new URL(t,n);if(o.origin===i.origin)return!0;let s=o.searchParams;if(s&&(s.has("url")||s.has("target")))return!0}catch{}return!1}function qr(t,e){if(!e||zr(t)||Vr(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(t,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function jr(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",ft(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${ft(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function Ye(t){return new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(t)})}function Xr(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function B(t,e={}){let n=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",o=e.errorTTL??8e3,s=e.headers||{},a=!!e.silent;if(/^data:/i.test(t))try{if(n==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,y="",h=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],S=/;base64/i.test(y)?atob(h):decodeURIComponent(h),w=new Uint8Array([...S].map(k=>k.charCodeAt(0))),x=new Blob([w],{type:(y||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:t,fromCache:!1,mime:x.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let y=await fetch(t);if(!y.ok)return{ok:!1,data:null,status:y.status,url:t,fromCache:!1,reason:"http_error"};let h=await y.blob(),b=h.type||y.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Ye(h),status:y.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await h.text(),status:y.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:h,status:y.status,url:t,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let l=Xr(t,{as:n,timeout:r,useProxy:i,errorTTL:o}),u=Gt.get(l);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&Gt.delete(l);let c=ye.get(l);if(c)return c;let f=qr(t,i)?jr(t,i):t,m=e.credentials;if(!m)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",h=new URL(t,y);m=typeof location<"u"&&h.origin===location.origin?"include":"omit"}catch{m="omit"}let d=new AbortController,g=setTimeout(()=>d.abort("timeout"),r),p=(async()=>{try{let y=await fetch(f,{signal:d.signal,credentials:m,headers:s});if(!y.ok){let S={ok:!1,data:null,status:y.status,url:f,fromCache:!1,reason:"http_error"};if(o>0&&Gt.set(l,{until:Date.now()+o,result:S}),!a){let w=`${y.status} ${y.statusText||""}`.trim();Ge.warnOnce(`http:${y.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${t}`)}return e.onError&&e.onError(S),S}if(n==="text")return{ok:!0,data:await y.text(),status:y.status,url:f,fromCache:!1};let h=await y.blob(),b=h.type||y.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Ye(h),status:y.status,url:f,fromCache:!1,mime:b}:{ok:!0,data:h,status:y.status,url:f,fromCache:!1,mime:b}}catch(y){let h=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:h};if(!/^blob:/i.test(t)&&o>0&&Gt.set(l,{until:Date.now()+o,result:b}),!a){let S=`${h}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,w=h==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:h==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Ge.errorOnce(S,w)}return e.onError&&e.onError(b),b}finally{clearTimeout(g),ye.delete(l)}})();return ye.set(l,p),p}var Ge,ye,Gt,ht=q(()=>{Lt();Ge=Hr("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ye=new Map,Gt=new Map});async function gt(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=pt(t);if(!r)return t;let i=ge(r),o=ft(i),s=(e.useProxy||"")+"|"+o;if(A.background.has(s)){let a=A.background.get(s);return a?`url("${a}")`:"none"}try{let a=await B(o,{as:"dataURL",useProxy:e.useProxy});return a.ok?(A.background.set(s,a.data),`url("${a.data}")`):(A.background.set(s,null),"none")}catch{return A.background.set(s,null),"none"}}var Ke=q(()=>{j();Lt();ht()});function be(){for(let t of Gr){let e=String(t).toLowerCase();Yt.has(e)||Kt.has(e)||we(e)}}function we(t){if(t=String(t).toLowerCase(),Kt.has(t)){let o={};return A.defaultStyle.set(t,o),o}if(A.defaultStyle.has(t))return A.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let r=getComputedStyle(n),i={};for(let o of r){if(Tt(o))continue;let s=r.getPropertyValue(o);i[o]=s}return e.removeChild(n),A.defaultStyle.set(t,i),i}function Tt(t){let e=String(t).toLowerCase();return!!(Qr.has(e)||Kr.test(e)||Yr.test(e))}function wt(t,e){if(e=String(e||"").toLowerCase(),Kt.has(e))return"";let n=[],r=we(e),o=(t.display||"").toLowerCase()==="inline",s=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),a=new Set(["table","thead","tbody","tfoot","tr","td","th"]),l=o||s.has(e)||a.has(e),u=c=>c==="width"||c==="min-width"||c==="max-width"||c==="inline-size"||c==="min-inline-size"||c==="max-inline-size";for(let[c,f]of Object.entries(t)){if(Tt(c)||l&&u(c))continue;let m=r[c];f&&f!==m&&n.push(`${c}:${f}`)}return n.sort(),n.join(";")}function Se(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function xe(t){let e=new Map;for(let r of t){let i=A.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([s,a])=>`${s}:${a};`).sort().join("");o&&(e.has(o)||e.set(o,[]),e.get(o).push(r))}let n="";for(let[r,i]of e.entries())n+=`${i.join(",")} { ${r} }
|
|
8
|
-
`;return n}function Ce(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of e)n.set(i,`c${r++}`);return n}function Jr(t){try{let e=t?.ownerDocument;if(!e)return typeof window<"u"?window:null;let n=e.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===e)return window.frames[r]}catch{}}catch{}return typeof window<"u"?window:null}function _(t,e=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(t instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(t,e)||n()}catch{return n()}return n()}let r=A.computedStyle.get(t);r||(r=new Map,A.computedStyle.set(t,r));let i=r.get(e);if(!i){let o=Jr(t),s=null;try{s=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(t,e):null}catch{}if(!s&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(s=window.getComputedStyle(t,e))}catch{}i=s||n(),r.set(e,i)}return i}function Qt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);for(let n of Zr){let r=e[`border-${n}-style`],i=e[`border-${n}-width`];(r==="none"||r==="hidden"||i==="0px")&&(delete e[`border-${n}-style`],delete e[`border-${n}-width`],delete e[`border-${n}-color`])}return e}function St(t){let e=[],n=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e}var Yt,Kt,Gr,Yr,Kr,Qr,Zr,Jt=q(()=>{j();Yt=new Set(["meta","script","noscript","title","link","template"]),Kt=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"]),Gr=["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"];Yr=/(?:^|-)(animation|transition)(?:-|$)/i,Kr=/^(--.+|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,Qr=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"]);Zr=["top","right","bottom","left"]});function ot(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function Ae(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let t=navigator.userAgent||"",e=/iPhone|iPad|iPod/.test(t),n=navigator.maxTouchPoints>2&&/Macintosh/.test(t);return e||n}function H(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),r=/applewebkit/i.test(t),i=/mobile/i.test(t),o=!/safari/i.test(t),s=r&&i&&o,a=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),u=/ipad|iphone|ipod/.test(e)&&r;return n||s||a||l||u}function Qe(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var xt=q(()=>{});function R(t,e,n){let r=t&&typeof t=="object"&&(t.options||t);r&&r.debug&&(n!==void 0?console.warn("[snapdom]",e,n):console.warn("[snapdom]",e))}var ke=q(()=>{});var J=q(()=>{Ke();Jt();xt();Lt();ke()});var Er={};Rt(Er,{toCanvas:()=>bt});function Ai(t){if(!Cr(t))return t;try{let e=Ar(t),n=e.match(/<svg\b[^>]*>/i);if(!n)return t;let r=n[0],i=parseFloat((r.match(/\bwidth="([\d.]+)/i)||[])[1]),o=parseFloat((r.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(i)||!Number.isFinite(o)||i<=0||o<=0)return t;let s=Math.min(1,Mt/i,Mt/o,Math.sqrt(xr/(i*o)));if(s>=1)return t;let a=Math.max(1,Math.floor(i*s)),l=Math.max(1,Math.floor(o*s));console.warn(`[snapDOM] Capture ${Math.round(i)}\xD7${Math.round(o)}px exceeds the browser image-decode limit (${Mt}px/side); downscaling to ${a}\xD7${l}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`);let u=e.replace(r,r.replace(/(\bwidth=")[\d.]+/i,`$1${a}`).replace(/(\bheight=")[\d.]+/i,`$1${l}`));return kr(u)}catch{return t}}function Cr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Ar(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function kr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function ki(t){let e=[],n="",r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(e.push(n),n=""):n+=o}return n.trim()&&e.push(n),e.map(i=>i.trim()).filter(Boolean)}function vi(t){let e=[],n="",r=0;for(let o=0;o<t.length;o++){let s=t[o];s==="("&&r++,s===")"&&(r=Math.max(0,r-1)),s===","&&r===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let i=[];for(let o of e){if(/\binset\b/i.test(o))continue;let s=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[a="0px",l="0px",u="0px"]=s,c=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!c&&c!==",";i.push(`drop-shadow(${a} ${l} ${u}${f?` ${c}`:""})`)}return i.join(" ")}function vr(t){let e=ki(t),n=null,r=null,i=null,o=[];for(let a of e){let l=a.indexOf(":");if(l<0)continue;let u=a.slice(0,l).trim().toLowerCase(),c=a.slice(l+1).trim();u==="box-shadow"?i=c:u==="filter"?n=c:u==="-webkit-filter"?r=c:o.push([u,c])}if(i){let a=vi(i);a&&(n=n?`${n} ${a}`:a,r=r?`${r} ${a}`:a)}let s=[...o];return n&&s.push(["filter",n]),r&&s.push(["-webkit-filter",r]),s.map(([a,l])=>`${a}:${l}`).join(";")}function Ei(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,r)=>`${n}{${vr(r)}}`)}function Mi(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Ei(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,r)=>`style=${n}${vr(r)}${n}`),t}function Fi(t){if(!H()||!Cr(t))return t;try{let e=Ar(t),n=Mi(e);return kr(n)}catch{return t}}async function bt(t,e){let{width:n,height:r,scale:i=1,dpr:o=1,meta:s={},backgroundColor:a}=e;t=Fi(t),t=Ai(t);let l=new Image;if(l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode(),H()){l.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(l);try{await new Promise(k=>requestAnimationFrame(()=>requestAnimationFrame(k)))}finally{try{l.remove()}catch{}}}let u=l.naturalWidth,c=l.naturalHeight,f=Number.isFinite(s.w0)?s.w0:u,m=Number.isFinite(s.h0)?s.h0:c,d,g,p=Number.isFinite(n),y=Number.isFinite(r);if(p&&y)d=Math.max(1,n),g=Math.max(1,r);else if(p){let k=n/Math.max(1,f);d=n,g=m*k}else if(y){let k=r/Math.max(1,m);g=r,d=f*k}else d=u,g=c;d=d*i,g=g*i;let h=d*o,b=g*o,S=Math.max(h/Mt,b/Mt,Math.sqrt(h*b/xr));S>1&&(console.warn(`[snapDOM] Output ${Math.round(h)}\xD7${Math.round(b)}px exceeds the browser canvas limit (${Mt}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),d/=S,g/=S);let w=document.createElement("canvas");w.width=d*o,w.height=g*o,w.style.width=`${d}px`,w.style.height=`${g}px`;let x=w.getContext("2d");return o!==1&&x.scale(o,o),a&&(x.save(),x.fillStyle=a,x.fillRect(0,0,d,g),x.restore()),x.drawImage(l,0,0,d,g),w}var Mt,xr,Ut=q(()=>{xt();Mt=16384,xr=16384*16384});var ue={};Rt(ue,{rasterize:()=>Ue});async function Ue(t,e){let n=await bt(t,e),r=new Image;return r.src=n.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=`${n.width/e.dpr}px`,r.style.height=`${n.height/e.dpr}px`,r}var Bt=q(()=>{Ut()});var Be={};Rt(Be,{toImg:()=>$i,toSvg:()=>$i});async function $i(t,e){let{scale:n=1,width:r,height:i,meta:o={}}=e,s=Number.isFinite(r),a=Number.isFinite(i),l=Number.isFinite(n)&&n!==1||s||a;if(H()&&l)return await Ue(t,{...e,format:"png",quality:1,meta:o});let u=new Image;if(u.decoding="sync",u.loading="eager",u.src=t,await u.decode(),s&&a)u.style.width=`${r}px`,u.style.height=`${i}px`;else if(s){let c=Number.isFinite(o.w0)?o.w0:u.naturalWidth,f=Number.isFinite(o.h0)?o.h0:u.naturalHeight,m=r/Math.max(1,c);u.style.width=`${r}px`,u.style.height=`${Math.round(f*m)}px`}else if(a){let c=Number.isFinite(o.w0)?o.w0:u.naturalWidth,f=Number.isFinite(o.h0)?o.h0:u.naturalHeight,m=i/Math.max(1,f);u.style.height=`${i}px`,u.style.width=`${Math.round(c*m)}px`}else{let c=Math.round(u.naturalWidth*n),f=Math.round(u.naturalHeight*n);if(u.style.width=`${c}px`,u.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let d=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${c}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,u.src=t}catch(m){R(e,"SVG width/height patch in toImg failed",m)}}return u}var De=q(()=>{J();Bt()});var Mr={};Rt(Mr,{toBlob:()=>He});async function He(t,e){let n=e.type;if(n==="svg"){let i=decodeURIComponent(t.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await bt(t,e);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,e.quality))}var ze=q(()=>{Ut()});var $r={};Rt($r,{download:()=>Ri});async function Fr(t,e){let n=new File([t],e,{type:t.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:e})}catch(r){if(r.name!=="AbortError")return!1}return!0}async function Ri(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),r=(e?.type||"").toLowerCase(),i=n.has(r)?r:"",o=(e?.format||i||"").toLowerCase(),s=o==="jpg"?"jpeg":o||"png",a=e?.filename||`snapdom.${s}`,l={...e||{},format:s,type:s};l.dpr=1;let u=Ae();if(s==="svg"){let m=await He(t,{...l,type:"svg"});if(u&&await Fr(m,a))return;let d=URL.createObjectURL(m),g=document.createElement("a");g.href=d,g.download=a,document.body.appendChild(g),g.click(),URL.revokeObjectURL(d),g.remove();return}let c=await bt(t,l);if(u){let m=`image/${s}`,d=await new Promise(g=>c.toBlob(g,m,e?.quality));if(d&&await Fr(d,a))return}let f=document.createElement("a");f.href=c.toDataURL(`image/${s}`,e?.quality),f.download=a,document.body.appendChild(f),f.click(),f.remove()}var Rr=q(()=>{ze();Ut();xt()});J();J();j();var Je=new WeakMap,Nt=new Map,to=2e3,ve=0;function Pt(){ve++,Nt.size>to&&Nt.clear()}var Ze=!1;function eo(t=document.documentElement){if(!Ze){Ze=!0;try{new MutationObserver(()=>Pt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Pt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Pt),e.ready?.then(()=>Pt()).catch(()=>{}))}catch{}}}function no(t,e={}){let n={},r=t.getPropertyValue("visibility"),i=e.excludeStyleProps;for(let f=0;f<t.length;f++){let m=t[f];if(Tt(m)||i&&(i instanceof RegExp&&i.test(m)||typeof i=="function"&&i(m)))continue;let d=t.getPropertyValue(m);(m==="background-image"||m==="content")&&d.includes("url(")&&!d.includes("data:")&&(d="none"),n[m]=d}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let f of o)if(!n[f])try{let m=t.getPropertyValue(f);m&&(n[f]=m)}catch{}let s=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let f of s)if(!n[f])try{let m=t.getPropertyValue(f);m&&(n[f]=m)}catch{}if(e.embedFonts){let f=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let m of f)if(!n[m])try{let d=t.getPropertyValue(m);d&&(n[m]=d)}catch{}}r==="hidden"&&(n.opacity="0");try{(n["content-visibility"]||t.getPropertyValue("content-visibility"))==="hidden"&&(n.visibility="hidden")}catch{}let a=parseFloat(t.getPropertyValue("border-top-width")||0)||0,l=parseFloat(t.getPropertyValue("border-right-width")||0)||0,u=parseFloat(t.getPropertyValue("border-bottom-width")||0)||0,c=parseFloat(t.getPropertyValue("border-left-width")||0)||0;if(a===0&&l===0&&u===0&&c===0){let f=(t.getPropertyValue("border-image-source")||"").trim(),m=f&&f!=="none",d=["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 d)delete n[g];m||(n.border="none")}return n}var tn=new WeakMap;function ro(t){let e=tn.get(t);return e||(e=Object.entries(t).sort((r,i)=>r[0]<i[0]?-1:r[0]>i[0]?1:0).map(([r,i])=>`${r}:${i}`).join(";"),tn.set(t,e),e)}function oo(t,e=null,n={}){let r=Je.get(t),i=!!(n&&n.embedFonts),o=n&&n.excludeStyleProps||null;if(r&&r.epoch===ve&&r.embedFonts===i&&r.excludeStyleProps===o)return r.snapshot;let s=e||getComputedStyle(t),a=no(s,n);return uo(t,s,a),Je.set(t,{epoch:ve,snapshot:a,embedFonts:i,excludeStyleProps:o}),a}function io(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Nt,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:e||{}}:{session:A.session,persist:{snapshotKeyCache:Nt,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:t||e||{}}}function so(t,e,n){if(!(!t.style||t.style.length===0))for(let r=0;r<t.style.length;r++){let i=t.style[r],o=n.getPropertyValue(i);o&&e.style.setProperty(i,o)}}async function it(t,e,n,r){if(t.tagName==="STYLE")return;let i=io(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&eo(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Pt(),Nt.clear(),i.session.__bumpedForDisabled=!0);let{session:s,persist:a}=i;if(!s.styleCache.has(t)){let m=null;try{m=getComputedStyle(t)}catch{}s.styleCache.set(t,m||getComputedStyle(document.documentElement))}let l=s.styleCache.get(t);t.getAttribute?.("style")&&so(t,e,l);let u=oo(t,l,i.options);if(en(t)){let m=l.getPropertyValue("min-width");(!m||m==="auto"||m==="0px")&&(u["min-width"]="0px")}let c=ro(u),f=a.snapshotKeyCache.get(c);if(!f){let m=t.tagName?.toLowerCase()||"div";f=wt(u,m),a.snapshotKeyCache.set(c,f)}s.styleMap.set(e,f)}function ao(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function co(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function en(t){let e=t.parentElement;if(!e)return!1;let n=_(e).display||"";return n.includes("flex")||n.includes("grid")}function lo(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,r=t.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let i=t.scrollHeight;if(i===0)return!1;let o=parseFloat(e.paddingTop)||0,s=parseFloat(e.paddingBottom)||0;return i>o+s}function uo(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let r=t.tagName&&t.tagName.toLowerCase();if(!r||!["div","section","article","main","aside","header","footer","nav"].includes(r))return;let o=parseFloat(e.height);if(Number.isFinite(o)&&t.scrollHeight>0&&Math.abs(o-t.scrollHeight)>2||e.aspectRatio&&e.aspectRatio!=="none"&&e.aspectRatio!=="auto")return;let a=e.display||"";if(a.includes("flex")||a.includes("grid")||ao(t))return;let l=e.position;if(l==="absolute"||l==="fixed"||l==="sticky"||e.transform!=="none"||co(e)||en(t))return;let u=e.overflowX||e.overflow||"visible",c=e.overflowY||e.overflow||"visible";if(u!=="visible"||c!=="visible")return;let f=e.clip;f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||lo(t,e)&&(delete n.height,delete n["block-size"])}Jt();var rn=["fill","stroke","color","background-color","stop-color"],fo=new Set(["symbol","defs","pattern","mask","clipPath","marker","linearGradient","radialGradient","filter"]);function Zt(t){let e=t;for(;e&&e.nodeType===1;){if(e.namespaceURI==="http://www.w3.org/2000/svg"&&fo.has(e.localName))return!0;e=e.parentNode}return!1}var nn=new Map;function mo(t,e){let n=e+"::"+t.toLowerCase(),r=nn.get(n);if(r)return r;let i=document,o=e==="http://www.w3.org/2000/svg"?i.createElementNS(e,t):i.createElement(t),s=i.createElement("div");s.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",s.appendChild(o),i.documentElement.appendChild(s);let a=getComputedStyle(o),l={};for(let u of rn)l[u]=a.getPropertyValue(u)||"";return s.remove(),nn.set(n,l),l}function on(t,e){if(!(t instanceof Element)||!(e instanceof Element)||Zt(t))return;let n=t.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&t.attributes?.length){let o=t.attributes;for(let s=0;s<o.length;s++){let a=o[s];if(a&&typeof a.value=="string"&&a.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(t)}catch{}if(r){let o=t.style;if(o&&o.length){let s=new Set;for(let a=0;a<o.length;a++){let l=o[a];if(s.has(l))continue;s.add(l);let u=o.getPropertyValue(l);if(!u||!u.includes("var("))continue;let c=i&&i.getPropertyValue(l);if(c)try{e.style.setProperty(l,c.trim(),o.getPropertyPriority(l))}catch{}}}}if(r&&t.attributes?.length){let o=t.attributes;for(let s=0;s<o.length;s++){let a=o[s];if(!a||typeof a.value!="string"||!a.value.includes("var("))continue;let l=a.name,u=i&&i.getPropertyValue(l);if(u)try{e.style.setProperty(l,u.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(t)}catch{i=null}if(!i)return;let o=t.namespaceURI||"html",s=mo(t.tagName,o);for(let a of rn){let l=i.getPropertyValue(a)||"",u=s[a]||"";if(l&&l!==u)try{e.style.setProperty(a,l.trim())}catch{}}}}J();J();j();ht();function ee(t,e,n){return Promise.all(t.map(r=>new Promise(i=>{function o(){ot(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(r,i):o()},{fast:n})}o()})))}function po(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function ho(t,e,n=!0){return t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?po(r):r;return`:where(${e} ${i})`}).join(", ")}function an(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${e}:is(${r.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${e} ${r.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,i,o)=>{let s=ho(o,e,!0);return`${r}${i}${s}{`}),t):""}function cn(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function ln(t){let e="";try{t.querySelectorAll("style").forEach(r=>{e+=(r.textContent||"")+`
|
|
9
|
-
`});let n=t.adoptedStyleSheets||[];for(let
|
|
10
|
-
`}catch{}}catch{}return e}function un(t,e,n){if(!e)return;let
|
|
11
|
-
`:""}function pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function yo(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<e&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function bo(t){let e=t.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let l=getComputedStyle(t);n=parseFloat(l.borderLeftWidth)||0,r=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+r))),a=Math.max(0,Math.round(e.height-(i+o)));return{contentWidth:s,contentHeight:a,rect:e}}function st(t){let e=0,n=0;if(t.offsetWidth>0&&(e=t.offsetWidth),t.offsetHeight>0&&(n=t.offsetHeight),e===0||n===0)try{let r=getComputedStyle(t);if(e===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(e=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(e===0||n===0)try{if(e===0){let r=parseFloat(t.getAttribute("width"));!isNaN(r)&&r>0&&(e=r)}if(n===0){let r=parseFloat(t.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((e===0||n===0)&&(t.naturalWidth||t.naturalHeight))try{e===0&&t.naturalWidth>0&&(e=t.naturalWidth),n===0&&t.naturalHeight>0&&(n=t.naturalHeight)}catch{}return{width:e,height:n}}function wo(t,e,n){let r=t.defaultView,i=r?r.scrollX:0,o=r?r.scrollY:0,s=t.body?t.body.scrollLeft:0,a=t.body?t.body.scrollTop:0,l=t.documentElement?t.documentElement.scrollLeft:0,u=t.documentElement?t.documentElement.scrollTop:0,c=t.createElement("style");return c.setAttribute("data-sd-iframe-pin",""),c.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(c),()=>{try{c.remove()}catch{}try{r&&typeof r.scrollTo=="function"&&r.scrollTo(i,o),t.body&&(t.body.scrollLeft=s,t.body.scrollTop=a),t.documentElement&&(t.documentElement.scrollLeft=l,t.documentElement.scrollTop=u)}catch{}}}async function hn(t,e,n){let r=await yo(t,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:s}=bo(t),a=n?.snap;if(!a&&typeof window<"u"&&window.snapdom&&(a=window.snapdom),!a||typeof a.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},u=wo(r,i,o),c;try{c=await a.toPng(r.documentElement,l)}finally{u()}c.style.display="block",c.style.width=`${i}px`,c.style.height=`${o}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),it(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(c),f}function gn(t){let{width:e,height:n}=st(t),r=t.getBoundingClientRect(),i;try{i=window.getComputedStyle(t)}catch{}let o=i?parseFloat(i.width):NaN,s=i?parseFloat(i.height):NaN,a=Math.round(e||r.width||0),l=Math.round(n||r.height||0),u=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,a||16),c=Number.isFinite(s)&&s>0?Math.round(s):Math.max(12,l||16),f=(t.type||"text").toLowerCase()==="checkbox",m=!!t.checked,d=!!t.indeterminate,p=Math.max(Math.min(u,c),12),y="middle";try{i&&i.verticalAlign&&(y=i.verticalAlign)}catch{}let h=document.createElement("div");h.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),h.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:${y};flex-shrink:0;line-height:0;`;let b=document.createElementNS("http://www.w3.org/2000/svg","svg");b.setAttribute("width",String(p)),b.setAttribute("height",String(p)),b.setAttribute("viewBox",`0 0 ${p} ${p}`),h.appendChild(b);function S(){let w="#0a6ed1";try{i&&(w=i.accentColor||i.color||w)}catch{}let x=2,k=x/2,C=p-x;if(b.innerHTML="",f){let v=document.createElementNS("http://www.w3.org/2000/svg","rect");if(v.setAttribute("x",String(k)),v.setAttribute("y",String(k)),v.setAttribute("width",String(C)),v.setAttribute("height",String(C)),v.setAttribute("rx","2"),v.setAttribute("ry","2"),v.setAttribute("fill",m?w:"none"),v.setAttribute("stroke",w),v.setAttribute("stroke-width",String(x)),b.appendChild(v),m){let E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d",`M ${k+2} ${p/2} L ${p/2-1} ${p-k-2} L ${p-k-2} ${k+2}`),E.setAttribute("stroke","white"),E.setAttribute("stroke-width",String(Math.max(1.5,x))),E.setAttribute("fill","none"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round"),b.appendChild(E)}else if(d){let E=document.createElementNS("http://www.w3.org/2000/svg","rect"),P=Math.max(6,C-4);E.setAttribute("x",String((p-P)/2)),E.setAttribute("y",String((p-x)/2)),E.setAttribute("width",String(P)),E.setAttribute("height",String(x)),E.setAttribute("fill",w),E.setAttribute("rx","1"),b.appendChild(E)}}else{let v=document.createElementNS("http://www.w3.org/2000/svg","circle");if(v.setAttribute("cx",String(p/2)),v.setAttribute("cy",String(p/2)),v.setAttribute("r",String((p-x)/2)),v.setAttribute("fill",m?w:"none"),v.setAttribute("stroke",w),v.setAttribute("stroke-width",String(x)),b.appendChild(v),m){let E=document.createElementNS("http://www.w3.org/2000/svg","circle"),P=Math.max(2,(p-x*2)*.35);E.setAttribute("cx",String(p/2)),E.setAttribute("cy",String(p/2)),E.setAttribute("r",String(P)),E.setAttribute("fill","white"),b.appendChild(E)}}h.style.setProperty("width",`${p}px`,"important"),h.style.setProperty("height",`${p}px`,"important"),h.style.setProperty("min-width",`${p}px`,"important"),h.style.setProperty("min-height",`${p}px`,"important")}return S(),{el:h,applyVisual:S}}var It=new D(80);async function _t(t){if(A.resource?.has(t))return A.resource.get(t);if(It.has(t))return It.get(t);let e=(async()=>{let n=await B(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return A.resource?.set(t,n.data),n.data})();It.set(t,e);try{let n=await e;return It.set(t,n),n}catch(n){throw It.delete(t),n}}var So=/\bblob:[^)"'\s]+/g;async function sn(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(So)||[]));if(e.length===0)return t;let n=t;for(let r of e)try{let i=await _t(r);n=n.split(r).join(i)}catch{}return n}function te(t){return typeof t=="string"&&t.startsWith("blob:")}function xo(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function Co(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function yn(t,e=null){if(!t)return;let n=e,r=t.querySelectorAll?t.querySelectorAll("img"):[];for(let l of r)try{let c=l.getAttribute("src")||l.currentSrc||"";if(te(c)){let m=await _t(c);l.setAttribute("src",m)}let f=l.getAttribute("srcset");if(f&&f.includes("blob:")){let m=xo(f),d=!1;for(let g of m)if(te(g.url))try{g.url=await _t(g.url),d=!0}catch(p){R(n,"blobUrlToDataUrl for srcset item failed",p)}d&&l.setAttribute("srcset",Co(m))}}catch(u){R(n,"resolveBlobUrls for img failed",u)}let i=t.querySelectorAll?t.querySelectorAll("image"):[];for(let l of i)try{let u="http://www.w3.org/1999/xlink",c=l.getAttribute("href")||l.getAttributeNS?.(u,"href");if(te(c)){let f=await _t(c);l.setAttribute("href",f),l.removeAttributeNS?.(u,"href")}}catch(u){R(n,"resolveBlobUrls for SVG image href failed",u)}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let l of o)try{let u=l.getAttribute("style");if(u&&u.includes("blob:")){let c=await sn(u);l.setAttribute("style",c)}}catch(u){R(n,"replaceBlobUrls in inline style failed",u)}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let l of s)try{let u=l.textContent||"";u.includes("blob:")&&(l.textContent=await sn(u))}catch(u){R(n,"replaceBlobUrls in style tag failed",u)}let a=["poster"];for(let l of a){let u=t.querySelectorAll?t.querySelectorAll(`[${l}^='blob:']`):[];for(let c of u)try{let f=c.getAttribute(l);te(f)&&c.setAttribute(l,await _t(f))}catch(f){R(n,`resolveBlobUrls for ${l} failed`,f)}}}xt();function Ee(t){let{width:e,height:n}=st(t),r=e,i=n;if(!r||!i){let s=t.getBoundingClientRect();r=r||s.width||0,i=i||s.height||0}let o=document.createElement("div");return o.style.cssText=`display:inline-block;width:${r}px;height:${i}px;visibility:hidden;`,o}async function Wt(t,e,n){if(!t)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Yt.has(c))return null;if(c==="foreignobject"&&t.parentElement?.closest?.("foreignObject"))return R(e,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide")return Ee(t);if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide")return Ee(t);if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${c}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide")return Ee(t);if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch(f){R(e,"iframe same-origin probe failed",f)}if(c)try{return await hn(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(c||console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.",t),n.placeholders){let{width:f,height:m}=st(t),d=document.createElement("div");return d.style.cssText=`width:${f}px;height:${m}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;`,it(t,d,e,n),d}else{let{width:f,height:m}=st(t),d=document.createElement("div");return d.style.cssText=`display:inline-block;width:${f}px;height:${m}px;visibility:hidden;`,it(t,d,e,n),d}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),it(t,c,e,n);let f=document.createElement("div");return f.textContent=t.getAttribute("data-placeholder-text")||"",f.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(f),c}if(t.tagName==="CANVAS"){let c="";try{let g=t.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),c=t.toDataURL("image/png"),!c||c==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),c=t.toDataURL("image/png"),!c||c==="data:,"){let p=document.createElement("canvas");p.width=t.width,p.height=t.height;let y=p.getContext("2d");y&&(y.drawImage(t,0,0),c=p.toDataURL("image/png"))}}}catch(g){R(e,"Canvas toDataURL failed, using empty/fallback",g)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch(g){R(e,"img decoding/loading hints failed",g)}c&&(f.src=c),f.width=t.width,f.height=t.height;let{width:m,height:d}=st(t);return m>0&&(f.style.width=`${m}px`),d>0&&(f.style.height=`${d}px`),e.nodeMap.set(f,t),it(t,f,e,n),f}if(t.tagName==="VIDEO"){let c="";try{let g=document.createElement("canvas");g.width=t.videoWidth||t.offsetWidth||320,g.height=t.videoHeight||t.offsetHeight||240;let p=g.getContext("2d");p&&(p.drawImage(t,0,0,g.width,g.height),c=g.toDataURL("image/png"),(!c||c==="data:,")&&(c=""))}catch(g){R(e,"Video frame capture failed, using poster fallback",g)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch{}c?f.src=c:t.poster&&(f.src=t.poster),f.width=t.videoWidth||t.offsetWidth||0,f.height=t.videoHeight||t.offsetHeight||0;let{width:m,height:d}=st(t);return m>0&&(f.style.width=`${m}px`),d>0&&(f.style.height=`${d}px`),f.style.objectFit="contain",e.nodeMap.set(f,t),it(t,f,e,n),f}let s;try{if(s=t.cloneNode(!1),s.attributes?.length)try{for(let c of s.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(c.value)&&s.setAttribute(c.name,c.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(on(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){fn(t,s);try{let{width:c,height:f}=st(t),m=Math.round(c||0),d=Math.round(f||0);m&&(s.dataset.snapdomWidth=String(m)),d&&(s.dataset.snapdomHeight=String(d))}catch(c){R(e,"getUnscaledDimensions for IMG failed",c)}try{let c=t.getAttribute("style")||"",f=window.getComputedStyle(t),m=S=>{let w=c.match(new RegExp(`${S}\\s*:\\s*([^;]+)`,"i")),x=w?w[1].trim():f.getPropertyValue(S);return/%|auto/i.test(String(x||""))},d=parseInt(s.dataset.snapdomWidth||"0",10),g=parseInt(s.dataset.snapdomHeight||"0",10),p=m("width")||!d,y=m("height")||!g;p&&d&&(s.style.width=`${d}px`),y&&g&&(s.style.height=`${g}px`);let h=f.getPropertyValue("object-fit"),b=f.getPropertyValue("object-position");h&&h!=="fill"?(s.style.objectFit=h,b&&(s.style.objectPosition=b)):(d&&(s.style.minWidth=`${d}px`),g&&(s.style.minHeight=`${g}px`))}catch(c){R(e,"IMG dimension freeze failed",c)}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}let a=null;if(t instanceof HTMLTextAreaElement){let{width:c,height:f}=st(t),m=c||t.getBoundingClientRect().width||0,d=f||t.getBoundingClientRect().height||0;m&&(s.style.width=`${m}px`),d&&(s.style.height=`${d}px`)}if(t instanceof HTMLInputElement){let c=(t.type||"text").toLowerCase();if((c==="checkbox"||c==="radio")&&Qe()){let{el:m,applyVisual:d}=gn(t);e.nodeMap.set(m,t),a=d,s=m}else s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))}if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&!t.value&&t.placeholder)try{let c=window.getComputedStyle(t,"::placeholder"),f=c&&c.color;if(f&&f!=="rgba(0, 0, 0, 0)"){let m="snapdom-ph-"+(Math.random()*1e6|0);s.classList.add(m);let d=document.createElement("style");d.textContent=`.${m}::placeholder{color:${f}!important;opacity:${c.opacity||"1"}!important;-webkit-text-fill-color:${f}!important;}`,s.prepend(d)}}catch{}if(t instanceof HTMLSelectElement&&(i=t.value),t instanceof HTMLTextAreaElement&&(o=t.value),t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){t.disabled&&s.setAttribute("disabled",""),t.required&&s.setAttribute("required",""),t.readOnly&&s.setAttribute("readonly","");let c=t;c.min!==void 0&&c.min!==""&&s.setAttribute("min",c.min),c.max!==void 0&&c.max!==""&&s.setAttribute("max",c.max),c.pattern!==void 0&&c.pattern!==""&&s.setAttribute("pattern",c.pattern);let f=t.getAttribute("aria-invalid");f!==null&&s.setAttribute("aria-invalid",f)}if(Zt(t)||it(t,s,e,n),a&&a(),t instanceof SVGElement&&!Zt(t)){let c=["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 f=window.getComputedStyle(t);for(let m of c){let d=f.getPropertyValue(m);d&&s.style.setProperty(m,d)}}catch{}}if(t.shadowRoot){let h=function(S,w){if(S.nodeType===Node.ELEMENT_NODE&&S.tagName==="STYLE")return w(null);Wt(S,e,n).then(x=>{w(x||null)}).catch(()=>{w(null)})};try{let S=t.shadowRoot.querySelectorAll("slot");for(let w of S){let x=[];try{x=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{x=w.assignedNodes?.()||[]}for(let k of x)r.add(k)}}catch{}let c=cn(e),f=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let m=ln(t.shadowRoot),d=an(m,f),g=dn(m),p=mn(t,g,f);un(s,p+d,c);let y=document.createDocumentFragment(),b=await ee(Array.from(t.shadowRoot.childNodes),h,n.fast);y.append(...b.filter(S=>!!S)),s.appendChild(y)}if(t.tagName==="SLOT"){let d=function(p,y){Wt(p,e,n).then(h=>{h&&pn(h),y(h||null)}).catch(()=>{y(null)})},c=t.assignedNodes?.({flatten:!0})||[],f=c.length>0?c:Array.from(t.childNodes),m=document.createDocumentFragment(),g=await ee(Array.from(f),d,n.fast);return m.append(...g.filter(p=>!!p)),m}function l(c,f){if(r.has(c))return f(null);Wt(c,e,n).then(m=>{f(m||null)}).catch(()=>{f(null)})}let u=await ee(Array.from(t.childNodes),l,n.fast);if(s.append(...u.filter(c=>!!c)),i!==null&&s instanceof HTMLSelectElement){s.value=i;for(let c of s.options)c.value===i?c.setAttribute("selected",""):c.removeAttribute("selected")}return o!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=o),s}J();Lt();j();j();var Ao=[/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],Ct=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__||{}),Me=[];function ko(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wn(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Me.push(n):typeof n=="string"?Me.push(new RegExp(ko(n),"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function Z(t){let e=typeof t=="string"?t:"",n=[...Ao,...Me];for(let r of n)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}function vo(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var bn=new Map;function Eo(t=""){let e=Object.create(null),n=String(t||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)e[i[1].toUpperCase()]=Number(i[2]);return e}async function Mo(t,e,n){let r=String(t||""),i=r.toLowerCase(),o=String(e||"").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),l="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?l="rounded":/\bsharp\b/.test(o)?l="sharp":/\boutlined\b/.test(o)&&(l="outlined");let u=a===1,c=null;if(u&&(l==="outlined"&&Ct.materialIconsFilled?c={url:Ct.materialIconsFilled,alias:"snapdom-mi-filled"}:l==="rounded"&&Ct.materialIconsRound?c={url:Ct.materialIconsRound,alias:"snapdom-mi-round"}:l==="sharp"&&Ct.materialIconsSharp&&(c={url:Ct.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:r,familyForCanvas:r};if(!bn.has(c.alias))try{let m=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(m),await m.load(),bn.set(c.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let f=`"${c.alias}"`;return{familyForMeasure:f,familyForCanvas:f}}async function Fo(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function $o(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let r=t.color?.trim();return r&&r!=="inherit"?r:"#000"}async function Ro(t,{family:e="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:s=""}={}){let a=String(e||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,u=Eo(o),{familyForMeasure:c,familyForCanvas:f}=await Mo(a,s,u);await Fo(f.replace(/^["']+|["']+$/g,""),r);let m=document.createElement("span");m.textContent=t,m.style.position="absolute",m.style.visibility="hidden",m.style.left="-99999px",m.style.whiteSpace="nowrap",m.style.fontFamily=c,m.style.fontWeight=String(n||"normal"),m.style.fontSize=`${r}px`,m.style.lineHeight="1",m.style.margin="0",m.style.padding="0",m.style.fontFeatureSettings="'liga' 1",m.style.fontVariantLigatures="normal",m.style.color=i,document.body.appendChild(m);let d=m.getBoundingClientRect(),g=Math.max(1,Math.ceil(d.width)),p=Math.max(1,Math.ceil(d.height));document.body.removeChild(m);let y=document.createElement("canvas");y.width=g*l,y.height=p*l;let h=y.getContext("2d");h.scale(l,l),h.font=`${n?`${n} `:""}${r}px ${f}`,h.textAlign="left",h.textBaseline="top",h.fillStyle=i;try{h.fontKerning="normal"}catch{}return h.fillText(t,0,0),{dataUrl:y.toDataURL(),width:g,height:p}}async function Sn(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(r.length===0)return 0;let i=A.session.nodeMap,o=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],s=0;for(let a=0;a<r.length;a++){let l=r[a],u=i&&i.get(l)||o[a]||null;try{let c=getComputedStyle(u||l),f=c.fontFamily||"Material Icons";if(!vo(f))continue;let m=(u||l).textContent.trim();if(!m)continue;let d=parseInt(c.fontSize,10)||24,g=c.fontWeight&&c.fontWeight!=="normal"?c.fontWeight:"normal",p=$o(c),y=c.fontVariationSettings&&c.fontVariationSettings!=="normal"?c.fontVariationSettings:"",h=(u||l).className||"",{dataUrl:b,width:S,height:w}=await Ro(m,{family:f,weight:g,fontSize:d,color:p,variation:y,className:h});l.textContent="";let x=l.ownerDocument.createElement("img");x.src=b,x.alt=m,x.style.height=`${d}px`,x.style.width=`${Math.max(1,Math.round(S/w*d))}px`,x.style.objectFit="contain",x.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(x),s++}catch{}}return s}ht();async function An(t,e,n,r=32,i="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${r}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let a=s.getBoundingClientRect(),l=Math.ceil(a.width),u=Math.ceil(a.height);document.body.removeChild(s);let c=document.createElement("canvas");c.width=Math.max(1,l*o),c.height=Math.max(1,u*o);let f=c.getContext("2d");return f.scale(o,o),f.font=n?`${n} ${r}px "${e}"`:`${r}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=i,f.fillText(t,0,0),{dataUrl:c.toDataURL(),width:l,height:u}}var kn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),Lo=["katex","mathjax","mathml"];function $e(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!kn.has(n.toLowerCase()))return n}return""}function To(t){if(!t)return[];let e=[];for(let n of t.split(",")){let r=n.trim().replace(/^['"]+|['"]+$/g,"");r&&(kn.has(r.toLowerCase())||e.push(r))}return e}function ne(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function re(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Po(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function No(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=ne(n[1]),o=ne(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=ne(e);return{min:r,max:r}}function Io(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function _o(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(o,s),max:Math.max(o,s)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function Wo(t){return!t||typeof t!="string"?"":t.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function Oo(t,e,n=[]){if(!t)return!1;try{let r=new URL(t,location.href);if(r.origin===location.origin)return!0;let o=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(l=>o.endsWith(l))||n.some(l=>o===l.toLowerCase()||o.endsWith("."+l.toLowerCase())))return!0;let a=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a)||Lo.some(l=>a.includes(l)))return!0;for(let l of e){let u=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-"),f=Wo(l);if(a.includes(u)||a.includes(c)||f&&a.includes(f))return!0}return!1}catch{return!1}}function Uo(t){let e=new Set;for(let n of t||[]){let r=String(n).split("__")[0]?.trim();r&&e.add(r)}return e}function xn(t,e){return t&&t.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 s=o;try{s=new URL(o,e||location.href).href}catch{}return`url("${s}")`})}var Fe=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,oe=4;async function Bo(t,e,n){if(!t)return t;let r=new Set;function i(a,l){try{return new URL(a,l||location.href).href}catch{return a}}async function o(a,l,u=0){if(u>oe)return console.warn(`[snapDOM] @import depth exceeded (${oe}) at ${l}`),a;let c="",f=0,m;for(;m=Fe.exec(a);){c+=a.slice(f,m.index),f=Fe.lastIndex;let d=(m[2]||m[4]||"").trim(),g=i(d,l);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let p="";try{let y=await B(g,{as:"text",useProxy:n,silent:!0});y.ok&&typeof y.data=="string"&&(p=y.data)}catch{}p?(p=xn(p,g),p=await o(p,g,u+1),c+=`
|
|
7
|
+
var Ho=Object.defineProperty;var q=(t,e)=>()=>(t&&(e=t(t=0)),e);var Rt=(t,e)=>{for(var n in e)Ho(t,n,{get:e[n],enumerable:!0})};function Xe(t){if(t===!0)return"soft";if(t===!1)return"disabled";if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="auto")return"auto";if(e==="full")return"full";if(e==="soft"||e==="disabled")return e}return"soft"}function Xt(t="soft"){switch(A.session.__counterEpoch=(A.session.__counterEpoch||0)+1,t){case"auto":{A.session.styleMap=new Map,A.session.nodeMap=new Map;return}case"soft":{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap,A.computedStyle=new WeakMap,A.measureHints=new WeakMap,A.baseStyle=new D(50),A.defaultStyle=new D(30),A.image=new D(100),A.background=new D(100),A.resource=new D(150),A.font=new Set;return}default:{A.session.styleMap=new Map,A.session.nodeMap=new Map,A.session.styleCache=new WeakMap;return}}}var D,A,j=q(()=>{D=class extends Map{constructor(e=100,...n){super(...n),this._maxSize=e}set(e,n){if(this.size>=this._maxSize&&!this.has(e)){let o=this.keys().next().value;o!==void 0&&this.delete(o)}return super.set(e,n)}},A={image:new D(100),background:new D(100),resource:new D(150),defaultStyle:new D(30),baseStyle:new D(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function pt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function he(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let i=o.split(",").map(r=>r.trim());return i.length!==6?`matrix(${o})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let i=o.split(",").map(r=>r.trim());return i.length!==16?`matrix3d(${o})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function ft(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ge(t,e){if(!t||/^(data|blob|about|#)/i.test(t.trim()))return t;try{let n=e||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(t,n).href}catch{return t}}var Lt=q(()=>{});function zo(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,i=0;function r(s,a,l){if(i>=n)return;let u=Date.now();(o.get(a)||0)>u||(o.set(a,u+e),i++,s==="warn"&&console&&console.warn?console.warn(`${t} ${l}`):console&&console.error&&console.error(`${t} ${l}`))}return{warnOnce(s,a){r("warn",s,a)},errorOnce(s,a){r("error",s,a)},reset(){o.clear(),i=0}}}function Vo(t){return/^data:|^blob:|^about:blank$/i.test(t)}function qo(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,i=new URL(o||".",n),r=new URL(t,n);if(r.origin===i.origin)return!0;let s=r.searchParams;if(s&&(s.has("url")||s.has("target")))return!0}catch{}return!1}function jo(t,e){if(!e||Vo(t)||qo(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function Xo(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",ft(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${ft(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function Ye(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function Go(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function B(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,i=e.useProxy||"",r=e.errorTTL??8e3,s=e.headers||{},a=!!e.silent;if(/^data:/i.test(t))try{if(n==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,y="",h=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],S=/;base64/i.test(y)?atob(h):decodeURIComponent(h),w=new Uint8Array([...S].map(v=>v.charCodeAt(0))),x=new Blob([w],{type:(y||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:t,fromCache:!1,mime:x.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let y=await fetch(t);if(!y.ok)return{ok:!1,data:null,status:y.status,url:t,fromCache:!1,reason:"http_error"};let h=await y.blob(),b=h.type||y.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Ye(h),status:y.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await h.text(),status:y.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:h,status:y.status,url:t,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let l=Go(t,{as:n,timeout:o,useProxy:i,errorTTL:r}),u=Gt.get(l);if(u&&u.until>Date.now())return{...u.result,fromCache:!0};u&&Gt.delete(l);let c=ye.get(l);if(c)return c;let f=jo(t,i)?Xo(t,i):t,d=e.credentials;if(!d)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",h=new URL(t,y);d=typeof location<"u"&&h.origin===location.origin?"include":"omit"}catch{d="omit"}let m=new AbortController,g=setTimeout(()=>m.abort("timeout"),o),p=(async()=>{try{let y=await fetch(f,{signal:m.signal,credentials:d,headers:s});if(!y.ok){let S={ok:!1,data:null,status:y.status,url:f,fromCache:!1,reason:"http_error"};if(r>0&&Gt.set(l,{until:Date.now()+r,result:S}),!a){let w=`${y.status} ${y.statusText||""}`.trim();Ge.warnOnce(`http:${y.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${t}`)}return e.onError&&e.onError(S),S}if(n==="text")return{ok:!0,data:await y.text(),status:y.status,url:f,fromCache:!1};let h=await y.blob(),b=h.type||y.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Ye(h),status:y.status,url:f,fromCache:!1,mime:b}:{ok:!0,data:h,status:y.status,url:f,fromCache:!1,mime:b}}catch(y){let h=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:h};if(!/^blob:/i.test(t)&&r>0&&Gt.set(l,{until:Date.now()+r,result:b}),!a){let S=`${h}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,w=h==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:h==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Ge.errorOnce(S,w)}return e.onError&&e.onError(b),b}finally{clearTimeout(g),ye.delete(l)}})();return ye.set(l,p),p}var Ge,ye,Gt,ht=q(()=>{Lt();Ge=zo("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ye=new Map,Gt=new Map});async function gt(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=pt(t);if(!o)return t;let i=ge(o),r=ft(i),s=(e.useProxy||"")+"|"+r;if(A.background.has(s)){let a=A.background.get(s);return a?`url("${a}")`:"none"}try{let a=await B(r,{as:"dataURL",useProxy:e.useProxy});return a.ok?(A.background.set(s,a.data),`url("${a.data}")`):(A.background.set(s,null),"none")}catch{return A.background.set(s,null),"none"}}var Ke=q(()=>{j();Lt();ht()});function be(){for(let t of Yo){let e=String(t).toLowerCase();Yt.has(e)||Kt.has(e)||we(e)}}function we(t){if(t=String(t).toLowerCase(),Kt.has(t)){let r={};return A.defaultStyle.set(t,r),r}if(A.defaultStyle.has(t))return A.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),i={};for(let r of o){if(Tt(r))continue;let s=o.getPropertyValue(r);i[r]=s}return e.removeChild(n),A.defaultStyle.set(t,i),i}function Tt(t){let e=String(t).toLowerCase();return!!(Jo.has(e)||Qo.test(e)||Ko.test(e))}function wt(t,e){if(e=String(e||"").toLowerCase(),Kt.has(e))return"";let n=[],o=we(e),r=(t.display||"").toLowerCase()==="inline",s=new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]),a=new Set(["table","thead","tbody","tfoot","tr","td","th"]),c=!new Set(["img","video","canvas","svg","iframe","embed","object","input","textarea","select"]).has(e)&&(r||s.has(e)||a.has(e)),f=d=>d==="width"||d==="min-width"||d==="max-width"||d==="inline-size"||d==="min-inline-size"||d==="max-inline-size";for(let[d,m]of Object.entries(t)){if(Tt(d)||c&&f(d))continue;let g=o[d];m&&m!==g&&n.push(`${d}:${m}`)}if(c&&!r){let d=t.width;d&&d!=="auto"&&d!==o.width&&n.push(`min-width:${d}`)}return n.sort(),n.join(";")}function Se(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function xe(t){let e=new Map;for(let o of t){let i=A.defaultStyle.get(o);if(!i)continue;let r=Object.entries(i).map(([s,a])=>`${s}:${a};`).sort().join("");r&&(e.has(r)||e.set(r,[]),e.get(r).push(o))}let n="";for(let[o,i]of e.entries())n+=`${i.join(",")} { ${o} }
|
|
8
|
+
`;return n}function Ce(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let i of e)n.set(i,`c${o++}`);return n}function Zo(t){try{let e=t?.ownerDocument;if(!e)return typeof window<"u"?window:null;let n=e.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let o=0;o<window.frames.length;o++)try{if(window.frames[o]?.document===e)return window.frames[o]}catch{}}catch{}return typeof window<"u"?window:null}function _(t,e=null){let n=()=>{let r={length:0,getPropertyValue:()=>"",item:()=>""};return r[Symbol.iterator]=function*(){},r};if(!(t instanceof Element)){let r=typeof window<"u"?window:null;if(r&&typeof r.getComputedStyle=="function")try{return r.getComputedStyle(t,e)||n()}catch{return n()}return n()}let o=A.computedStyle.get(t);o||(o=new Map,A.computedStyle.set(t,o));let i=o.get(e);if(!i){let r=Zo(t),s=null;try{s=r&&typeof r.getComputedStyle=="function"?r.getComputedStyle(t,e):null}catch{}if(!s&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(s=window.getComputedStyle(t,e))}catch{}i=s||n(),o.set(e,i)}return i}function Qt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);for(let n of tr){let o=e[`border-${n}-style`],i=e[`border-${n}-width`];(o==="none"||o==="hidden"||i==="0px")&&(delete e[`border-${n}-style`],delete e[`border-${n}-width`],delete e[`border-${n}-color`])}return e}function St(t){let e=[],n=0,o=0;for(let i=0;i<t.length;i++){let r=t[i];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,i).trim()),o=i+1)}return e.push(t.slice(o).trim()),e}var Yt,Kt,Yo,Ko,Qo,Jo,tr,Jt=q(()=>{j();Yt=new Set(["meta","script","noscript","title","link","template"]),Kt=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"]),Yo=["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"];Ko=/(?:^|-)(animation|transition)(?:-|$)/i,Qo=/^(--.+|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,Jo=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"]);tr=["top","right","bottom","left"]});function rt(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function Ae(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let t=navigator.userAgent||"",e=/iPhone|iPad|iPod/.test(t),n=navigator.maxTouchPoints>2&&/Macintosh/.test(t);return e||n}function H(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),o=/applewebkit/i.test(t),i=/mobile/i.test(t),r=!/safari/i.test(t),s=o&&i&&r,a=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),u=/ipad|iphone|ipod/.test(e)&&o;return n||s||a||l||u}function Qe(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var xt=q(()=>{});function R(t,e,n){let o=t&&typeof t=="object"&&(t.options||t);o&&o.debug&&(n!==void 0?console.warn("[snapdom]",e,n):console.warn("[snapdom]",e))}var ve=q(()=>{});var J=q(()=>{Ke();Jt();xt();Lt();ve()});var Mo={};Rt(Mo,{toCanvas:()=>bt});function Ai(t){if(!Ao(t))return t;try{let e=vo(t),n=e.match(/<svg\b[^>]*>/i);if(!n)return t;let o=n[0],i=parseFloat((o.match(/\bwidth="([\d.]+)/i)||[])[1]),r=parseFloat((o.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0)return t;let s=Math.min(1,Mt/i,Mt/r,Math.sqrt(Co/(i*r)));if(s>=1)return t;let a=Math.max(1,Math.floor(i*s)),l=Math.max(1,Math.floor(r*s));console.warn(`[snapDOM] Capture ${Math.round(i)}\xD7${Math.round(r)}px exceeds the browser image-decode limit (${Mt}px/side); downscaling to ${a}\xD7${l}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`);let u=e.replace(o,o.replace(/(\bwidth=")[\d.]+/i,`$1${a}`).replace(/(\bheight=")[\d.]+/i,`$1${l}`));return ko(u)}catch{return t}}function Ao(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function vo(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function ko(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function vi(t){let e=[],n="",o=0;for(let i=0;i<t.length;i++){let r=t[i];r==="("&&o++,r===")"&&(o=Math.max(0,o-1)),r===";"&&o===0?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(i=>i.trim()).filter(Boolean)}function ki(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let s=t[r];s==="("&&o++,s===")"&&(o=Math.max(0,o-1)),s===","&&o===0?(e.push(n.trim()),n=""):n+=s}n.trim()&&e.push(n.trim());let i=[];for(let r of e){if(/\binset\b/i.test(r))continue;let s=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[a="0px",l="0px",u="0px"]=s,c=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!c&&c!==",";i.push(`drop-shadow(${a} ${l} ${u}${f?` ${c}`:""})`)}return i.join(" ")}function Eo(t){let e=vi(t),n=null,o=null,i=null,r=[];for(let a of e){let l=a.indexOf(":");if(l<0)continue;let u=a.slice(0,l).trim().toLowerCase(),c=a.slice(l+1).trim();u==="box-shadow"?i=c:u==="filter"?n=c:u==="-webkit-filter"?o=c:r.push([u,c])}if(i){let a=ki(i);a&&(n=n?`${n} ${a}`:a,o=o?`${o} ${a}`:a)}let s=[...r];return n&&s.push(["filter",n]),o&&s.push(["-webkit-filter",o]),s.map(([a,l])=>`${a}:${l}`).join(";")}function Ei(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Eo(o)}}`)}function Mi(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Ei(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Eo(o)}${n}`),t}function Fi(t){if(!H()||!Ao(t))return t;try{let e=vo(t),n=Mi(e);return ko(n)}catch{return t}}async function bt(t,e){let{width:n,height:o,scale:i=1,dpr:r=1,meta:s={},backgroundColor:a}=e;t=Fi(t),t=Ai(t);let l=new Image;if(l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=t,await l.decode(),H()){l.style.cssText="position:fixed;left:-99999px;top:-99999px;pointer-events:none",document.body.appendChild(l);try{await new Promise(v=>requestAnimationFrame(()=>requestAnimationFrame(v)))}finally{try{l.remove()}catch{}}}let u=l.naturalWidth,c=l.naturalHeight,f=Number.isFinite(s.w0)?s.w0:u,d=Number.isFinite(s.h0)?s.h0:c,m,g,p=Number.isFinite(n),y=Number.isFinite(o);if(p&&y)m=Math.max(1,n),g=Math.max(1,o);else if(p){let v=n/Math.max(1,f);m=n,g=d*v}else if(y){let v=o/Math.max(1,d);g=o,m=f*v}else m=u,g=c;m=m*i,g=g*i;let h=m*r,b=g*r,S=Math.max(h/Mt,b/Mt,Math.sqrt(h*b/Co));S>1&&(console.warn(`[snapDOM] Output ${Math.round(h)}\xD7${Math.round(b)}px exceeds the browser canvas limit (${Mt}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),m/=S,g/=S);let w=document.createElement("canvas");w.width=m*r,w.height=g*r,w.style.width=`${m}px`,w.style.height=`${g}px`;let x=w.getContext("2d");return r!==1&&x.scale(r,r),a&&(x.save(),x.fillStyle=a,x.fillRect(0,0,m,g),x.restore()),x.drawImage(l,0,0,m,g),w}var Mt,Co,Ut=q(()=>{xt();Mt=16384,Co=16384*16384});var ue={};Rt(ue,{rasterize:()=>Ue});async function Ue(t,e){let n=await bt(t,e),o=new Image;return o.src=n.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${n.width/e.dpr}px`,o.style.height=`${n.height/e.dpr}px`,o}var Bt=q(()=>{Ut()});var Be={};Rt(Be,{toImg:()=>$i,toSvg:()=>$i});async function $i(t,e){let{scale:n=1,width:o,height:i,meta:r={}}=e,s=Number.isFinite(o),a=Number.isFinite(i),l=Number.isFinite(n)&&n!==1||s||a;if(H()&&l)return await Ue(t,{...e,format:"png",quality:1,meta:r});let u=new Image;if(u.decoding="sync",u.loading="eager",u.src=t,await u.decode(),s&&a)u.style.width=`${o}px`,u.style.height=`${i}px`;else if(s){let c=Number.isFinite(r.w0)?r.w0:u.naturalWidth,f=Number.isFinite(r.h0)?r.h0:u.naturalHeight,d=o/Math.max(1,c);u.style.width=`${o}px`,u.style.height=`${Math.round(f*d)}px`}else if(a){let c=Number.isFinite(r.w0)?r.w0:u.naturalWidth,f=Number.isFinite(r.h0)?r.h0:u.naturalHeight,d=i/Math.max(1,f);u.style.height=`${i}px`,u.style.width=`${Math.round(c*d)}px`}else{let c=Math.round(u.naturalWidth*n),f=Math.round(u.naturalHeight*n);if(u.style.width=`${c}px`,u.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let m=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${c}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,u.src=t}catch(d){R(e,"SVG width/height patch in toImg failed",d)}}return u}var De=q(()=>{J();Bt()});var Fo={};Rt(Fo,{toBlob:()=>He});async function He(t,e){let n=e.type;if(n==="svg"){let i=decodeURIComponent(t.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let o=await bt(t,e);return new Promise(i=>o.toBlob(r=>i(r),`image/${n}`,e.quality))}var ze=q(()=>{Ut()});var Ro={};Rt(Ro,{download:()=>Ri});async function $o(t,e){let n=new File([t],e,{type:t.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:e})}catch(o){if(o.name!=="AbortError")return!1}return!0}async function Ri(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),o=(e?.type||"").toLowerCase(),i=n.has(o)?o:"",r=(e?.format||i||"").toLowerCase(),s=r==="jpg"?"jpeg":r||"png",a=e?.filename||`snapdom.${s}`,l={...e||{},format:s,type:s};l.dpr=1;let u=Ae();if(s==="svg"){let d=await He(t,{...l,type:"svg"});if(u&&await $o(d,a))return;let m=URL.createObjectURL(d),g=document.createElement("a");g.href=m,g.download=a,document.body.appendChild(g),g.click(),URL.revokeObjectURL(m),g.remove();return}let c=await bt(t,l);if(u){let d=`image/${s}`,m=await new Promise(g=>c.toBlob(g,d,e?.quality));if(m&&await $o(m,a))return}let f=document.createElement("a");f.href=c.toDataURL(`image/${s}`,e?.quality),f.download=a,document.body.appendChild(f),f.click(),f.remove()}var Lo=q(()=>{ze();Ut();xt()});J();J();j();var Je=new WeakMap,Nt=new Map,er=2e3,ke=0;function Pt(){ke++,Nt.size>er&&Nt.clear()}var Ze=!1;function nr(t=document.documentElement){if(!Ze){Ze=!0;try{new MutationObserver(()=>Pt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Pt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Pt),e.ready?.then(()=>Pt()).catch(()=>{}))}catch{}}}function or(t,e={}){let n={},o=t.getPropertyValue("visibility"),i=e.excludeStyleProps;for(let f=0;f<t.length;f++){let d=t[f];if(Tt(d)||i&&(i instanceof RegExp&&i.test(d)||typeof i=="function"&&i(d)))continue;let m=t.getPropertyValue(d);(d==="background-image"||d==="content")&&m.includes("url(")&&!m.includes("data:")&&(m="none"),n[d]=m}let r=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let f of r)if(!n[f])try{let d=t.getPropertyValue(f);d&&(n[f]=d)}catch{}let s=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let f of s)if(!n[f])try{let d=t.getPropertyValue(f);d&&(n[f]=d)}catch{}if(e.embedFonts){let f=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let d of f)if(!n[d])try{let m=t.getPropertyValue(d);m&&(n[d]=m)}catch{}}o==="hidden"&&(n.opacity="0");try{(n["content-visibility"]||t.getPropertyValue("content-visibility"))==="hidden"&&(n.visibility="hidden")}catch{}let a=parseFloat(t.getPropertyValue("border-top-width")||0)||0,l=parseFloat(t.getPropertyValue("border-right-width")||0)||0,u=parseFloat(t.getPropertyValue("border-bottom-width")||0)||0,c=parseFloat(t.getPropertyValue("border-left-width")||0)||0;if(a===0&&l===0&&u===0&&c===0){let f=(t.getPropertyValue("border-image-source")||"").trim(),d=f&&f!=="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];d||(n.border="none")}return n}var tn=new WeakMap;function rr(t){let e=tn.get(t);return e||(e=Object.entries(t).sort((o,i)=>o[0]<i[0]?-1:o[0]>i[0]?1:0).map(([o,i])=>`${o}:${i}`).join(";"),tn.set(t,e),e)}function ir(t,e=null,n={}){let o=Je.get(t),i=!!(n&&n.embedFonts),r=n&&n.excludeStyleProps||null;if(o&&o.epoch===ke&&o.embedFonts===i&&o.excludeStyleProps===r)return o.snapshot;let s=e||getComputedStyle(t),a=or(s,n);return fr(t,s,a),Je.set(t,{epoch:ke,snapshot:a,embedFonts:i,excludeStyleProps:r}),a}function sr(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Nt,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:e||{}}:{session:A.session,persist:{snapshotKeyCache:Nt,defaultStyle:A.defaultStyle,baseStyle:A.baseStyle,image:A.image,resource:A.resource,background:A.background,font:A.font},options:t||e||{}}}function ar(t,e,n){if(!(!t.style||t.style.length===0))for(let o=0;o<t.style.length;o++){let i=t.style[o],r=n.getPropertyValue(i);r&&e.style.setProperty(i,r)}}async function it(t,e,n,o){if(t.tagName==="STYLE")return;let i=sr(n,o),r=i.options&&i.options.cache||"auto";r!=="disabled"&&nr(document.documentElement),r==="disabled"&&!i.session.__bumpedForDisabled&&(Pt(),Nt.clear(),i.session.__bumpedForDisabled=!0);let{session:s,persist:a}=i;if(!s.styleCache.has(t)){let d=null;try{d=getComputedStyle(t)}catch{}s.styleCache.set(t,d||getComputedStyle(document.documentElement))}let l=s.styleCache.get(t);t.getAttribute?.("style")&&ar(t,e,l);let u=ir(t,l,i.options);if(en(t)){let d=l.getPropertyValue("min-width");(!d||d==="auto"||d==="0px")&&(u["min-width"]="0px")}let c=rr(u),f=a.snapshotKeyCache.get(c);if(!f){let d=t.tagName?.toLowerCase()||"div";f=wt(u,d),a.snapshotKeyCache.set(c,f)}s.styleMap.set(e,f)}function cr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function lr(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function en(t){let e=t.parentElement;if(!e)return!1;let n=_(e).display||"";return n.includes("flex")||n.includes("grid")}function ur(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let i=t.scrollHeight;if(i===0)return!1;let r=parseFloat(e.paddingTop)||0,s=parseFloat(e.paddingBottom)||0;return i>r+s}function fr(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||!["div","section","article","main","aside","header","footer","nav"].includes(o))return;let r=parseFloat(e.height);if(Number.isFinite(r)&&t.scrollHeight>0&&Math.abs(r-t.scrollHeight)>2||e.aspectRatio&&e.aspectRatio!=="none"&&e.aspectRatio!=="auto")return;let a=e.display||"";if(a.includes("flex")||a.includes("grid")||cr(t))return;let l=e.position;if(l==="absolute"||l==="fixed"||l==="sticky"||e.transform!=="none"||lr(e)||en(t))return;let u=e.overflowX||e.overflow||"visible",c=e.overflowY||e.overflow||"visible";if(u!=="visible"||c!=="visible")return;let f=e.clip;f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||ur(t,e)&&(delete n.height,delete n["block-size"])}Jt();var on=["fill","stroke","color","background-color","stop-color"],dr=new Set(["symbol","defs","pattern","mask","clipPath","marker","linearGradient","radialGradient","filter"]);function Zt(t){let e=t;for(;e&&e.nodeType===1;){if(e.namespaceURI==="http://www.w3.org/2000/svg"&&dr.has(e.localName))return!0;e=e.parentNode}return!1}var nn=new Map;function mr(t,e){let n=e+"::"+t.toLowerCase(),o=nn.get(n);if(o)return o;let i=document,r=e==="http://www.w3.org/2000/svg"?i.createElementNS(e,t):i.createElement(t),s=i.createElement("div");s.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",s.appendChild(r),i.documentElement.appendChild(s);let a=getComputedStyle(r),l={};for(let u of on)l[u]=a.getPropertyValue(u)||"";return s.remove(),nn.set(n,l),l}function rn(t,e){if(!(t instanceof Element)||!(e instanceof Element)||Zt(t))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let s=0;s<r.length;s++){let a=r[s];if(a&&typeof a.value=="string"&&a.value.includes("var(")){o=!0;break}}}let i=null;if(o)try{i=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length){let s=new Set;for(let a=0;a<r.length;a++){let l=r[a];if(s.has(l))continue;s.add(l);let u=r.getPropertyValue(l);if(!u||!u.includes("var("))continue;let c=i&&i.getPropertyValue(l);if(c)try{e.style.setProperty(l,c.trim(),r.getPropertyPriority(l))}catch{}}}}if(o&&t.attributes?.length){let r=t.attributes;for(let s=0;s<r.length;s++){let a=r[s];if(!a||typeof a.value!="string"||!a.value.includes("var("))continue;let l=a.name,u=i&&i.getPropertyValue(l);if(u)try{e.style.setProperty(l,u.trim())}catch{}}}if(!o){if(!i)try{i=getComputedStyle(t)}catch{i=null}if(!i)return;let r=t.namespaceURI||"html",s=mr(t.tagName,r);for(let a of on){let l=i.getPropertyValue(a)||"",u=s[a]||"";if(l&&l!==u)try{e.style.setProperty(a,l.trim())}catch{}}}}J();J();j();ht();function ee(t,e,n){return Promise.all(t.map(o=>new Promise(i=>{function r(){rt(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(o,i):r()},{fast:n})}r()})))}function pr(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function hr(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let i=n?pr(o):o;return`:where(${e} ${i})`}).join(", ")}function an(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,i,r)=>{let s=hr(r,e,!0);return`${o}${i}${s}{`}),t):""}function cn(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function ln(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
|
|
9
|
+
`});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let i of o.cssRules)e+=i.cssText+`
|
|
10
|
+
`}catch{}}catch{}return e}function un(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function fn(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function dn(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function gr(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function mn(t,e,n){let o=[];for(let i of e){let r=gr(t,i);r&&o.push(`${i}: ${r};`)}return o.length?`${n}{${o.join("")}}
|
|
11
|
+
`:""}function pn(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function yr(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),i=0;for(;i<e&&(!o||!o.body&&!o.documentElement);)await new Promise(r=>setTimeout(r,0)),o=n(),i++;return o&&(o.body||o.documentElement)?o:null}function br(t){let e=t.getBoundingClientRect(),n=0,o=0,i=0,r=0;try{let l=getComputedStyle(t);n=parseFloat(l.borderLeftWidth)||0,o=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,r=parseFloat(l.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+o))),a=Math.max(0,Math.round(e.height-(i+r)));return{contentWidth:s,contentHeight:a,rect:e}}function st(t){let e=0,n=0;if(t.offsetWidth>0&&(e=t.offsetWidth),t.offsetHeight>0&&(n=t.offsetHeight),e===0||n===0)try{let o=getComputedStyle(t);if(e===0){let i=parseFloat(o.width);!isNaN(i)&&i>0&&(e=i)}if(n===0){let i=parseFloat(o.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(e===0||n===0)try{if(e===0){let o=parseFloat(t.getAttribute("width"));!isNaN(o)&&o>0&&(e=o)}if(n===0){let o=parseFloat(t.getAttribute("height"));!isNaN(o)&&o>0&&(n=o)}}catch{}if((e===0||n===0)&&(t.naturalWidth||t.naturalHeight))try{e===0&&t.naturalWidth>0&&(e=t.naturalWidth),n===0&&t.naturalHeight>0&&(n=t.naturalHeight)}catch{}return{width:e,height:n}}function wr(t,e,n){let o=t.defaultView,i=o?o.scrollX:0,r=o?o.scrollY:0,s=t.body?t.body.scrollLeft:0,a=t.body?t.body.scrollTop:0,l=t.documentElement?t.documentElement.scrollLeft:0,u=t.documentElement?t.documentElement.scrollTop:0,c=t.createElement("style");return c.setAttribute("data-sd-iframe-pin",""),c.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(c),()=>{try{c.remove()}catch{}try{o&&typeof o.scrollTo=="function"&&o.scrollTo(i,r),t.body&&(t.body.scrollLeft=s,t.body.scrollTop=a),t.documentElement&&(t.documentElement.scrollLeft=l,t.documentElement.scrollTop=u)}catch{}}}async function hn(t,e,n){let o=await yr(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:r,rect:s}=br(t),a=n?.snap;if(!a&&typeof window<"u"&&window.snapdom&&(a=window.snapdom),!a||typeof a.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},u=wr(o,i,r),c;try{c=await a.toPng(o.documentElement,l)}finally{u()}c.style.display="block",c.style.width=`${i}px`,c.style.height=`${r}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),it(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(s.width)}px`),f.style.height||(f.style.height=`${Math.round(s.height)}px`),f.appendChild(c),f}function gn(t){let{width:e,height:n}=st(t),o=t.getBoundingClientRect(),i;try{i=window.getComputedStyle(t)}catch{}let r=i?parseFloat(i.width):NaN,s=i?parseFloat(i.height):NaN,a=Math.round(e||o.width||0),l=Math.round(n||o.height||0),u=Number.isFinite(r)&&r>0?Math.round(r):Math.max(12,a||16),c=Number.isFinite(s)&&s>0?Math.round(s):Math.max(12,l||16),f=(t.type||"text").toLowerCase()==="checkbox",d=!!t.checked,m=!!t.indeterminate,p=Math.max(Math.min(u,c),12),y="middle";try{i&&i.verticalAlign&&(y=i.verticalAlign)}catch{}let h=document.createElement("div");h.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),h.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:${y};flex-shrink:0;line-height:0;`;let b=document.createElementNS("http://www.w3.org/2000/svg","svg");b.setAttribute("width",String(p)),b.setAttribute("height",String(p)),b.setAttribute("viewBox",`0 0 ${p} ${p}`),h.appendChild(b);function S(){let w="#0a6ed1";try{i&&(w=i.accentColor||i.color||w)}catch{}let x=2,v=x/2,C=p-x;if(b.innerHTML="",f){let k=document.createElementNS("http://www.w3.org/2000/svg","rect");if(k.setAttribute("x",String(v)),k.setAttribute("y",String(v)),k.setAttribute("width",String(C)),k.setAttribute("height",String(C)),k.setAttribute("rx","2"),k.setAttribute("ry","2"),k.setAttribute("fill",d?w:"none"),k.setAttribute("stroke",w),k.setAttribute("stroke-width",String(x)),b.appendChild(k),d){let E=document.createElementNS("http://www.w3.org/2000/svg","path");E.setAttribute("d",`M ${v+2} ${p/2} L ${p/2-1} ${p-v-2} L ${p-v-2} ${v+2}`),E.setAttribute("stroke","white"),E.setAttribute("stroke-width",String(Math.max(1.5,x))),E.setAttribute("fill","none"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round"),b.appendChild(E)}else if(m){let E=document.createElementNS("http://www.w3.org/2000/svg","rect"),P=Math.max(6,C-4);E.setAttribute("x",String((p-P)/2)),E.setAttribute("y",String((p-x)/2)),E.setAttribute("width",String(P)),E.setAttribute("height",String(x)),E.setAttribute("fill",w),E.setAttribute("rx","1"),b.appendChild(E)}}else{let k=document.createElementNS("http://www.w3.org/2000/svg","circle");if(k.setAttribute("cx",String(p/2)),k.setAttribute("cy",String(p/2)),k.setAttribute("r",String((p-x)/2)),k.setAttribute("fill",d?w:"none"),k.setAttribute("stroke",w),k.setAttribute("stroke-width",String(x)),b.appendChild(k),d){let E=document.createElementNS("http://www.w3.org/2000/svg","circle"),P=Math.max(2,(p-x*2)*.35);E.setAttribute("cx",String(p/2)),E.setAttribute("cy",String(p/2)),E.setAttribute("r",String(P)),E.setAttribute("fill","white"),b.appendChild(E)}}h.style.setProperty("width",`${p}px`,"important"),h.style.setProperty("height",`${p}px`,"important"),h.style.setProperty("min-width",`${p}px`,"important"),h.style.setProperty("min-height",`${p}px`,"important")}return S(),{el:h,applyVisual:S}}var It=new D(80);async function _t(t){if(A.resource?.has(t))return A.resource.get(t);if(It.has(t))return It.get(t);let e=(async()=>{let n=await B(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return A.resource?.set(t,n.data),n.data})();It.set(t,e);try{let n=await e;return It.set(t,n),n}catch(n){throw It.delete(t),n}}var Sr=/\bblob:[^)"'\s]+/g;async function sn(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Sr)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let i=await _t(o);n=n.split(o).join(i)}catch{}return n}function te(t){return typeof t=="string"&&t.startsWith("blob:")}function xr(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function Cr(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function yn(t,e=null){if(!t)return;let n=e,o=t.querySelectorAll?t.querySelectorAll("img"):[];for(let l of o)try{let c=l.getAttribute("src")||l.currentSrc||"";if(te(c)){let d=await _t(c);l.setAttribute("src",d)}let f=l.getAttribute("srcset");if(f&&f.includes("blob:")){let d=xr(f),m=!1;for(let g of d)if(te(g.url))try{g.url=await _t(g.url),m=!0}catch(p){R(n,"blobUrlToDataUrl for srcset item failed",p)}m&&l.setAttribute("srcset",Cr(d))}}catch(u){R(n,"resolveBlobUrls for img failed",u)}let i=t.querySelectorAll?t.querySelectorAll("image"):[];for(let l of i)try{let u="http://www.w3.org/1999/xlink",c=l.getAttribute("href")||l.getAttributeNS?.(u,"href");if(te(c)){let f=await _t(c);l.setAttribute("href",f),l.removeAttributeNS?.(u,"href")}}catch(u){R(n,"resolveBlobUrls for SVG image href failed",u)}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let l of r)try{let u=l.getAttribute("style");if(u&&u.includes("blob:")){let c=await sn(u);l.setAttribute("style",c)}}catch(u){R(n,"replaceBlobUrls in inline style failed",u)}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let l of s)try{let u=l.textContent||"";u.includes("blob:")&&(l.textContent=await sn(u))}catch(u){R(n,"replaceBlobUrls in style tag failed",u)}let a=["poster"];for(let l of a){let u=t.querySelectorAll?t.querySelectorAll(`[${l}^='blob:']`):[];for(let c of u)try{let f=c.getAttribute(l);te(f)&&c.setAttribute(l,await _t(f))}catch(f){R(n,`resolveBlobUrls for ${l} failed`,f)}}}xt();function Ee(t){let{width:e,height:n}=st(t),o=e,i=n;if(!o||!i){let s=t.getBoundingClientRect();o=o||s.width||0,i=i||s.height||0}let r=document.createElement("div");return r.style.cssText=`display:inline-block;width:${o}px;height:${i}px;visibility:hidden;`,r}async function Wt(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,i=null,r=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Yt.has(c))return null;if(c==="foreignobject"&&t.parentElement?.closest?.("foreignObject"))return R(e,"Nested <foreignObject> skipped (SVG spec limitation \u2014 not rendered by browsers)"),null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide")return Ee(t);if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){if(n.excludeMode==="hide")return Ee(t);if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${c}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide")return Ee(t);if(n.filterMode==="remove")return null}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch(f){R(e,"iframe same-origin probe failed",f)}if(c)try{return await hn(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(c||console.warn("[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.",t),n.placeholders){let{width:f,height:d}=st(t),m=document.createElement("div");return m.style.cssText=`width:${f}px;height:${d}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;`,it(t,m,e,n),m}else{let{width:f,height:d}=st(t),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${f}px;height:${d}px;visibility:hidden;`,it(t,m,e,n),m}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),it(t,c,e,n);let f=document.createElement("div");return f.textContent=t.getAttribute("data-placeholder-text")||"",f.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(f),c}if(t.tagName==="CANVAS"){let c="";try{let g=t.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),c=t.toDataURL("image/png"),!c||c==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),c=t.toDataURL("image/png"),!c||c==="data:,"){let p=document.createElement("canvas");p.width=t.width,p.height=t.height;let y=p.getContext("2d");y&&(y.drawImage(t,0,0),c=p.toDataURL("image/png"))}}}catch(g){R(e,"Canvas toDataURL failed, using empty/fallback",g)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch(g){R(e,"img decoding/loading hints failed",g)}c&&(f.src=c),f.width=t.width,f.height=t.height;let{width:d,height:m}=st(t);return d>0&&(f.style.width=`${d}px`),m>0&&(f.style.height=`${m}px`),e.nodeMap.set(f,t),it(t,f,e,n),f}if(t.tagName==="VIDEO"){let c="";try{let g=document.createElement("canvas");g.width=t.videoWidth||t.offsetWidth||320,g.height=t.videoHeight||t.offsetHeight||240;let p=g.getContext("2d");p&&(p.drawImage(t,0,0,g.width,g.height),c=g.toDataURL("image/png"),(!c||c==="data:,")&&(c=""))}catch(g){R(e,"Video frame capture failed, using poster fallback",g)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch{}c?f.src=c:t.poster&&(f.src=t.poster),f.width=t.videoWidth||t.offsetWidth||0,f.height=t.videoHeight||t.offsetHeight||0;let{width:d,height:m}=st(t);return d>0&&(f.style.width=`${d}px`),m>0&&(f.style.height=`${m}px`),f.style.objectFit="contain",e.nodeMap.set(f,t),it(t,f,e,n),f}let s;try{if(s=t.cloneNode(!1),s.attributes?.length)try{for(let c of s.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(c.value)&&s.setAttribute(c.name,c.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(rn(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){fn(t,s);try{let{width:c,height:f}=st(t),d=Math.round(c||0),m=Math.round(f||0);d&&(s.dataset.snapdomWidth=String(d)),m&&(s.dataset.snapdomHeight=String(m))}catch(c){R(e,"getUnscaledDimensions for IMG failed",c)}try{let c=t.getAttribute("style")||"",f=window.getComputedStyle(t),d=S=>{let w=c.match(new RegExp(`${S}\\s*:\\s*([^;]+)`,"i")),x=w?w[1].trim():f.getPropertyValue(S);return/%|auto/i.test(String(x||""))},m=parseInt(s.dataset.snapdomWidth||"0",10),g=parseInt(s.dataset.snapdomHeight||"0",10),p=d("width")||!m,y=d("height")||!g;p&&m&&(s.style.width=`${m}px`),y&&g&&(s.style.height=`${g}px`);let h=f.getPropertyValue("object-fit"),b=f.getPropertyValue("object-position");h&&h!=="fill"?(s.style.objectFit=h,b&&(s.style.objectPosition=b)):(m&&(s.style.minWidth=`${m}px`),g&&(s.style.minHeight=`${g}px`))}catch(c){R(e,"IMG dimension freeze failed",c)}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}let a=null;if(t instanceof HTMLTextAreaElement){let{width:c,height:f}=st(t),d=c||t.getBoundingClientRect().width||0,m=f||t.getBoundingClientRect().height||0;d&&(s.style.width=`${d}px`),m&&(s.style.height=`${m}px`)}if(t instanceof HTMLInputElement){let c=(t.type||"text").toLowerCase();if((c==="checkbox"||c==="radio")&&Qe()){let{el:d,applyVisual:m}=gn(t);e.nodeMap.set(d,t),a=m,s=d}else s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))}if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&!t.value&&t.placeholder)try{let c=window.getComputedStyle(t,"::placeholder"),f=c&&c.color;if(f&&f!=="rgba(0, 0, 0, 0)"){let d="snapdom-ph-"+(Math.random()*1e6|0);s.classList.add(d);let m=document.createElement("style");m.textContent=`.${d}::placeholder{color:${f}!important;opacity:${c.opacity||"1"}!important;-webkit-text-fill-color:${f}!important;}`,s.prepend(m)}}catch{}if(t instanceof HTMLSelectElement&&(i=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){t.disabled&&s.setAttribute("disabled",""),t.required&&s.setAttribute("required",""),t.readOnly&&s.setAttribute("readonly","");let c=t;c.min!==void 0&&c.min!==""&&s.setAttribute("min",c.min),c.max!==void 0&&c.max!==""&&s.setAttribute("max",c.max),c.pattern!==void 0&&c.pattern!==""&&s.setAttribute("pattern",c.pattern);let f=t.getAttribute("aria-invalid");f!==null&&s.setAttribute("aria-invalid",f)}if(Zt(t)||it(t,s,e,n),a&&a(),t instanceof SVGElement&&!Zt(t)){let c=["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 f=window.getComputedStyle(t);for(let d of c){let m=f.getPropertyValue(d);m&&s.style.setProperty(d,m)}}catch{}}if(t.shadowRoot){let h=function(S,w){if(S.nodeType===Node.ELEMENT_NODE&&S.tagName==="STYLE")return w(null);Wt(S,e,n).then(x=>{w(x||null)}).catch(()=>{w(null)})};try{let S=t.shadowRoot.querySelectorAll("slot");for(let w of S){let x=[];try{x=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{x=w.assignedNodes?.()||[]}for(let v of x)o.add(v)}}catch{}let c=cn(e),f=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let d=ln(t.shadowRoot),m=an(d,f),g=dn(d),p=mn(t,g,f);un(s,p+m,c);let y=document.createDocumentFragment(),b=await ee(Array.from(t.shadowRoot.childNodes),h,n.fast);y.append(...b.filter(S=>!!S)),s.appendChild(y)}if(t.tagName==="SLOT"){let m=function(p,y){Wt(p,e,n).then(h=>{h&&pn(h),y(h||null)}).catch(()=>{y(null)})},c=t.assignedNodes?.({flatten:!0})||[],f=c.length>0?c:Array.from(t.childNodes),d=document.createDocumentFragment(),g=await ee(Array.from(f),m,n.fast);return d.append(...g.filter(p=>!!p)),d}function l(c,f){if(o.has(c))return f(null);Wt(c,e,n).then(d=>{f(d||null)}).catch(()=>{f(null)})}let u=await ee(Array.from(t.childNodes),l,n.fast);if(s.append(...u.filter(c=>!!c)),i!==null&&s instanceof HTMLSelectElement){s.value=i;for(let c of s.options)c.value===i?c.setAttribute("selected",""):c.removeAttribute("selected")}return r!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=r),s}J();Lt();j();j();var Ar=[/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],Ct=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__||{}),Me=[];function vr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wn(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Me.push(n):typeof n=="string"?Me.push(new RegExp(vr(n),"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function Z(t){let e=typeof t=="string"?t:"",n=[...Ar,...Me];for(let o of n)if(o instanceof RegExp&&o.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}function kr(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var bn=new Map;function Er(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=o.exec(n);)e[i[1].toUpperCase()]=Number(i[2]);return e}async function Mr(t,e,n){let o=String(t||""),i=o.toLowerCase(),r=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:o,familyForCanvas:o};let a=n&&(n.FILL??n.fill),l="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?l="rounded":/\bsharp\b/.test(r)?l="sharp":/\boutlined\b/.test(r)&&(l="outlined");let u=a===1,c=null;if(u&&(l==="outlined"&&Ct.materialIconsFilled?c={url:Ct.materialIconsFilled,alias:"snapdom-mi-filled"}:l==="rounded"&&Ct.materialIconsRound?c={url:Ct.materialIconsRound,alias:"snapdom-mi-round"}:l==="sharp"&&Ct.materialIconsSharp&&(c={url:Ct.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:o,familyForCanvas:o};if(!bn.has(c.alias))try{let d=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),bn.set(c.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let f=`"${c.alias}"`;return{familyForMeasure:f,familyForCanvas:f}}async function Fr(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function $r(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let o=t.color?.trim();return o&&o!=="inherit"?o:"#000"}async function Rr(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:i="#000",variation:r="",className:s=""}={}){let a=String(e||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,u=Er(r),{familyForMeasure:c,familyForCanvas:f}=await Mr(a,s,u);await Fr(f.replace(/^["']+|["']+$/g,""),o);let d=document.createElement("span");d.textContent=t,d.style.position="absolute",d.style.visibility="hidden",d.style.left="-99999px",d.style.whiteSpace="nowrap",d.style.fontFamily=c,d.style.fontWeight=String(n||"normal"),d.style.fontSize=`${o}px`,d.style.lineHeight="1",d.style.margin="0",d.style.padding="0",d.style.fontFeatureSettings="'liga' 1",d.style.fontVariantLigatures="normal",d.style.color=i,document.body.appendChild(d);let m=d.getBoundingClientRect(),g=Math.max(1,Math.ceil(m.width)),p=Math.max(1,Math.ceil(m.height));document.body.removeChild(d);let y=document.createElement("canvas");y.width=g*l,y.height=p*l;let h=y.getContext("2d");h.scale(l,l),h.font=`${n?`${n} `:""}${o}px ${f}`,h.textAlign="left",h.textBaseline="top",h.fillStyle=i;try{h.fontKerning="normal"}catch{}return h.fillText(t,0,0),{dataUrl:y.toDataURL(),width:g,height:p}}async function Sn(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(o.length===0)return 0;let i=A.session.nodeMap,r=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],s=0;for(let a=0;a<o.length;a++){let l=o[a],u=i&&i.get(l)||r[a]||null;try{let c=getComputedStyle(u||l),f=c.fontFamily||"Material Icons";if(!kr(f))continue;let d=(u||l).textContent.trim();if(!d)continue;let m=parseInt(c.fontSize,10)||24,g=c.fontWeight&&c.fontWeight!=="normal"?c.fontWeight:"normal",p=$r(c),y=c.fontVariationSettings&&c.fontVariationSettings!=="normal"?c.fontVariationSettings:"",h=(u||l).className||"",{dataUrl:b,width:S,height:w}=await Rr(d,{family:f,weight:g,fontSize:m,color:p,variation:y,className:h});l.textContent="";let x=l.ownerDocument.createElement("img");x.src=b,x.alt=d,x.style.height=`${m}px`,x.style.width=`${Math.max(1,Math.round(S/w*m))}px`,x.style.objectFit="contain",x.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(x),s++}catch{}}return s}ht();async function An(t,e,n,o=32,i="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${o}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let a=s.getBoundingClientRect(),l=Math.ceil(a.width),u=Math.ceil(a.height);document.body.removeChild(s);let c=document.createElement("canvas");c.width=Math.max(1,l*r),c.height=Math.max(1,u*r);let f=c.getContext("2d");return f.scale(r,r),f.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,f.textAlign="left",f.textBaseline="top",f.fillStyle=i,f.fillText(t,0,0),{dataUrl:c.toDataURL(),width:l,height:u}}var vn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),Lr=["katex","mathjax","mathml"];function $e(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!vn.has(n.toLowerCase()))return n}return""}function Tr(t){if(!t)return[];let e=[];for(let n of t.split(",")){let o=n.trim().replace(/^['"]+|['"]+$/g,"");o&&(vn.has(o.toLowerCase())||e.push(o))}return e}function ne(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function oe(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Pr(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Nr(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=ne(n[1]),r=ne(n[2]);return{min:Math.min(i,r),max:Math.max(i,r)}}let o=ne(e);return{min:o,max:o}}function Ir(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function _r(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let r=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(r,s),max:Math.max(r,s)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),i=o?parseFloat(o[1]):100;return{min:i,max:i}}function Wr(t){return!t||typeof t!="string"?"":t.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function Or(t,e,n=[]){if(!t)return!1;try{let o=new URL(t,location.href);if(o.origin===location.origin)return!0;let r=o.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(l=>r.endsWith(l))||n.some(l=>r===l.toLowerCase()||r.endsWith("."+l.toLowerCase())))return!0;let a=(o.pathname+o.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a)||Lr.some(l=>a.includes(l)))return!0;for(let l of e){let u=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-"),f=Wr(l);if(a.includes(u)||a.includes(c)||f&&a.includes(f))return!0}return!1}catch{return!1}}function Ur(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function xn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,i)=>{let r=(i||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return n;let s=r;try{s=new URL(r,e||location.href).href}catch{}return`url("${s}")`})}var Fe=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,re=4;async function Br(t,e,n){if(!t)return t;let o=new Set;function i(a,l){try{return new URL(a,l||location.href).href}catch{return a}}async function r(a,l,u=0){if(u>re)return console.warn(`[snapDOM] @import depth exceeded (${re}) at ${l}`),a;let c="",f=0,d;for(;d=Fe.exec(a);){c+=a.slice(f,d.index),f=Fe.lastIndex;let m=(d[2]||d[4]||"").trim(),g=i(m,l);if(o.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}o.add(g);let p="";try{let y=await B(g,{as:"text",useProxy:n,silent:!0});y.ok&&typeof y.data=="string"&&(p=y.data)}catch{}p?(p=xn(p,g),p=await r(p,g,u+1),c+=`
|
|
12
12
|
/* inlined: ${g} */
|
|
13
13
|
${p}
|
|
14
|
-
`):c+=m[0]}return c+=a.slice(f),c}let s=xn(t,e||location.href);return s=await o(s,e||location.href,0),s}var vn=/url\((["']?)([^"')]+)\1\)/g,Do=/@font-face[^{}]*\{[^}]*\}/g;function En(t){if(!t)return[];let e=[],n=t.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],s=i[2],a=l=>{if(!l.includes("?"))return parseInt(l,16);let u=parseInt(l.replace(/\?/g,"0"),16),c=parseInt(l.replace(/\?/g,"F"),16);return[u,c]};if(s){let l=a(o),u=a(s),c=Array.isArray(l)?l[0]:l,f=Array.isArray(u)?u[1]:u;e.push([Math.min(c,f),Math.max(c,f)])}else{let l=a(o);Array.isArray(l)?e.push([l[0],l[1]]):e.push([l,l])}}return e}function Mn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[r,i]of e)if(n>=r&&n<=i)return!0;return!1}function Re(t,e){let n=[];if(!t)return n;for(let r of t.matchAll(vn)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,e||location.href).href}catch{}n.push(i)}}return n}async function Fn(t,e,n=""){let r=t;for(let i of t.matchAll(vn)){let o=pt(i[0]);if(!o)continue;let s=o;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!Z(s)){if(A.resource?.has(s)){A.font?.add(s),r=r.replace(i[0],`url(${A.resource.get(s)})`);continue}if(!A.font?.has(s))try{let a=await B(s,{as:"dataURL",useProxy:n,silent:!0});if(a.ok&&typeof a.data=="string"){let l=a.data;A.resource?.set(s,l),A.font?.add(s),r=r.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return r}function Ho(t){if(!t.length)return null;let e=(a,l)=>t.some(([u,c])=>!(c<a||u>l)),n=e(0,255)||e(305,305),r=e(256,591)||e(7680,7935),i=e(880,1023),o=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function Cn(t={}){let e=new Set((t.families||[]).map(i=>String(i).toLowerCase())),n=new Set((t.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((t.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(e.size&&e.has(i.family.toLowerCase()))return!0;if(n.size)for(let s of i.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(r.size){let s=Ho(o);if(s&&r.has(s))return!0}return!1}}function zo(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of t.match(e)||[]){let s=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",a=$e(s),l=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),u=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),c=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),d=Re(m,location.href),g=d.length?d.map(y=>String(y).toLowerCase()).sort().join("|"):m.toLowerCase(),p=[String(a||"").toLowerCase(),l,u,c,f.toLowerCase(),g].join("|");n.has(p)||(n.add(p),r.push(o))}if(r.length===0)return t;let i=0;return t.replace(e,()=>r[i++]||"")}function Vo(t,e,n,r,i){let o=Array.from(t||[]).sort().join("|"),s=e?JSON.stringify({families:(e.families||[]).map(c=>String(c).toLowerCase()).sort(),domains:(e.domains||[]).map(c=>String(c).toLowerCase()).sort(),subsets:(e.subsets||[]).map(c=>String(c).toLowerCase()).sort()}):"",a=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|"),l=r||"",u=(i||[]).map(c=>String(c).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${s}::lf=${a}::px=${l}::fd=${u}`}async function $n(t,e,n,r){let i;try{i=t.cssRules||[]}catch{return}let o=(s,a)=>{try{return new URL(s,a||location.href).href}catch{return s}};for(let s of i){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let a=s.href?o(s.href,e):e;if(r.depth>=oe){console.warn(`[snapDOM] CSSOM import depth exceeded (${oe}) at ${a}`);continue}if(a&&r.visitedSheets.has(a)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${a}`);continue}a&&r.visitedSheets.add(a);let l={...r,depth:(r.depth||0)+1};await $n(s.styleSheet,a,n,l);continue}if(s.type===CSSRule.FONT_FACE_RULE){let a=(s.style.getPropertyValue("font-family")||"").trim(),l=$e(a);if(!l||Z(l))continue;let u=(s.style.getPropertyValue("font-weight")||"400").trim(),c=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),d=(s.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(l,c,u,f))continue;let g=En(d);if(!Mn(r.usedCodepoints,g))continue;let p={family:l,weightSpec:u,styleSpec:c,stretchSpec:f,unicodeRange:d,srcRaw:m,srcUrls:Re(m,e||location.href),href:e||location.href};if(r.simpleExcluder&&r.simpleExcluder(p,g))continue;if(/url\(/i.test(m)){let y=await Fn(m,e||location.href,r.useProxy);await n(`@font-face{font-family:${l};src:${y};font-style:${c};font-weight:${u};font-stretch:${f};${d?`unicode-range:${d};`:""}}`)}else await n(`@font-face{font-family:${l};src:${m};font-style:${c};font-weight:${u};font-stretch:${f};${d?`unicode-range:${d};`:""}}`)}}}async function ie({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let s=new Map;for(let h of t){let[b,S,w,x]=String(h).split("__");if(!b)continue;let k=b.toLowerCase(),C=s.get(k)||[];C.push({w:parseInt(S,10),s:w,st:parseInt(x,10)}),s.set(k,C)}function a(h,b,S,w){let x=String(h).toLowerCase();if(!s.has(x))return!1;let k=s.get(x),C=No(S),v=Io(b),E=_o(w),P=C.min!==C.max,W=C.min,z=L=>v.kind==="normal"&&L==="normal"||v.kind!=="normal"&&(L==="italic"||L==="oblique"),Y=!1;for(let L of k){let I=P?L.w>=C.min&&L.w<=C.max:L.w===W,F=z(re(L.s)),X=L.st>=E.min&&L.st<=E.max;if(I&&F&&X){Y=!0;break}}if(Y)return!0;if(!P)for(let L of k){let I=z(re(L.s)),F=L.st>=E.min&&L.st<=E.max;if(Math.abs(W-L.w)<=300&&I&&F)return!0}if(!P&&v.kind==="normal"&&k.some(I=>re(I.s)!=="normal"))for(let I of k){let F=Math.abs(W-I.w)<=300,X=I.st>=E.min&&I.st<=E.max;if(F&&X)return!0}return!1}let l=Cn(n),u=Vo(t,n,r,i,o);if(A.resource?.has(u))return A.resource.get(u);let c=Uo(t),f=[],m=Fe;for(let h of document.querySelectorAll("style")){let b=h.textContent||"";for(let S of b.matchAll(m)){let w=(S[2]||S[4]||"").trim();if(!w||Z(w))continue;!!document.querySelector(`link[rel="stylesheet"][href="${w}"]`)||f.push(w)}}let d=[];f.length&&await Promise.all(f.map(h=>new Promise(b=>{if(document.querySelector(`link[rel="stylesheet"][href="${h}"]`))return b(null);let S=document.createElement("link");S.rel="stylesheet",S.href=h,S.setAttribute("data-snapdom","injected-import"),S.onload=()=>b(S),S.onerror=()=>b(null),document.head.appendChild(S),d.push(S)})));let g="",p=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(h=>!!h.href);for(let h of d)try{h.remove()}catch{}for(let h of p)try{if(Z(h.href))continue;let b="",S=!1;try{S=new URL(h.href,location.href).origin===location.origin}catch{}if(!S){let x=Array.isArray(o)?o:[];if(!Oo(h.href,c,x))continue}if(S){let x=Array.from(document.styleSheets).find(k=>k.href===h.href);if(x)try{let k=x.cssRules||[];b=Array.from(k).map(C=>C.cssText).join("")}catch{}}if(!b){let x=await B(h.href,{as:"text",useProxy:i});if(x?.ok&&typeof x.data=="string"&&(b=x.data),Z(h.href))continue}b=await Bo(b,h.href,i);let w="";for(let x of b.match(Do)||[]){let k=(x.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=$e(k);if(!C||Z(C))continue;let v=(x.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),E=(x.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(x.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(x.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),z=(x.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),Y=Re(z,h.href);if(!a(C,E,v,P))continue;let L=En(W);if(!Mn(e,L))continue;let I={family:C,weightSpec:v,styleSpec:E,stretchSpec:P,unicodeRange:W,srcRaw:z,srcUrls:Y,href:h.href};if(n&&l(I,L))continue;let F=/url\(/i.test(z)?await Fn(x,h.href,i):x;w+=F}w.trim()&&(g+=w)}catch{console.warn("[snapDOM] Failed to process stylesheet:",h.href)}let y={requiredIndex:s,usedCodepoints:e,faceMatchesRequired:a,simpleExcluder:n?Cn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let h of document.styleSheets)if(!(h.href&&p.some(b=>b.href===h.href)))try{let b=h.href||location.origin+"/";b&&y.visitedSheets.add(b),await $n(h,b,async S=>{g+=S},y)}catch{}try{for(let h of document.fonts||[]){if(!h||!h.family||h.status!=="loaded"||!h._snapdomSrc)continue;let b=String(h.family).replace(/^['"]+|['"]+$/g,"");if(Z(b)||!s.has(b.toLowerCase())||n?.families&&n.families.some(w=>String(w).toLowerCase()===b.toLowerCase()))continue;let S=h._snapdomSrc;if(!String(S).startsWith("data:")){if(A.resource?.has(h._snapdomSrc))S=A.resource.get(h._snapdomSrc),A.font?.add(h._snapdomSrc);else if(!A.font?.has(h._snapdomSrc))try{let w=await B(h._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(w.ok&&typeof w.data=="string")S=w.data,A.resource?.set(h._snapdomSrc,S),A.font?.add(h._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",h._snapdomSrc);continue}}g+=`@font-face{font-family:'${b}';src:url(${S});font-style:${h.style||"normal"};font-weight:${h.weight||"normal"};}`}}catch{}for(let h of r){if(!h||typeof h!="object")continue;let b=String(h.family||"").replace(/^['"]+|['"]+$/g,"");if(!b||Z(b)||!s.has(b.toLowerCase())||n?.families&&n.families.some(v=>String(v).toLowerCase()===b.toLowerCase()))continue;let S=h.weight!=null?String(h.weight):"normal",w=h.style!=null?String(h.style):"normal",x=h.stretchPct!=null?`${h.stretchPct}%`:"100%",k=String(h.src||""),C=k;if(!C.startsWith("data:")){if(A.resource?.has(k))C=A.resource.get(k),A.font?.add(k);else if(!A.font?.has(k))try{let v=await B(k,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")C=v.data,A.resource?.set(k,C),A.font?.add(k);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",k);continue}}g+=`@font-face{font-family:'${b}';src:url(${C});font-style:${w};font-weight:${S};font-stretch:${x};}`}return g&&(g=zo(g),A.resource?.set(u,g)),g}function At(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),r=s=>{let a=To(s.fontFamily);if(a.length)for(let l of a){let u=(c,f,m)=>`${l}__${ne(c)}__${re(f)}__${Po(m)}`;e.add(u(s.fontWeight,s.fontStyle,s.fontStretch))}};r(getComputedStyle(t));let i=getComputedStyle(t,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(t,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let s=n.currentNode,a=getComputedStyle(s);r(a);let l=getComputedStyle(s,"::before");l&&l.content&&l.content!=="none"&&r(l);let u=getComputedStyle(s,"::after");u&&u.content&&u.content!=="none"&&r(u)}return e}function se(t){let e=new Set,n=i=>{if(i)for(let o of i)e.add(o.codePointAt(0))},r=document.createTreeWalker(t,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 s of["::before","::after"]){let l=getComputedStyle(o,s)?.getPropertyValue("content");if(!(!l||l==="none"))if(/^"/.test(l)||/^'/.test(l))n(l.slice(1,-1));else{let u=l.match(/\\[0-9A-Fa-f]{1,6}/g);if(u)for(let c of u)try{e.add(parseInt(c.slice(1),16))}catch{}}}}}return e}async function kt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).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 s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${o}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",i.appendChild(s)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,e);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}j();function Pn(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Rn(t,e=!1){let n="",r=Math.max(1,t);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return e?n.toUpperCase():n}function Ln(t,e=!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,t)),i="";for(let[o,s]of n)for(;r>=o;)i+=s,r-=o;return e?i:i.toLowerCase()}function Tn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(t);case"decimal-leading-zero":{let n=Math.abs(t);return(t<0?"-":"")+(n<10?"0":"")+String(n)}case"lower-alpha":return Rn(t,!1);case"upper-alpha":return Rn(t,!0);case"lower-roman":return Ln(t,!1);case"upper-roman":return Ln(t,!0);default:return String(t)}}function Nn(t){let e=()=>A?.session?.__counterEpoch??0,n=e(),r=new WeakMap,i=t instanceof Document?t.documentElement:t,o=m=>m&&m.tagName==="LI",s=m=>{let d=0,g=m?.parentElement;if(!g)return 0;for(let p of g.children){if(p===m)break;p.tagName==="LI"&&d++}return d},a=m=>{let d=new Map;for(let[g,p]of m)d.set(g,p.slice());return d},l=(m,d,g)=>{let p=a(m),y;try{y=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(y&&y!=="none")for(let S of y.split(",")){let w=S.trim().split(/\s+/),x=w[0],k=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!x)continue;let C=d.get(x);if(C&&C.length){let v=C.slice();v.push(k),p.set(x,v)}else p.set(x,[k])}let h;try{h=g.style?.counterSet||getComputedStyle(g).counterSet}catch{}if(h&&h!=="none")for(let S of h.split(",")){let w=S.trim().split(/\s+/),x=w[0],k=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!x)continue;let C=p.get(x)||[];C.length===0&&C.push(0),C[C.length-1]=k,p.set(x,C)}let b;try{b=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(b&&b!=="none")for(let S of b.split(",")){let w=S.trim().split(/\s+/),x=w[0],k=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!x)continue;let C=p.get(x)||[];C.length===0&&C.push(0),C[C.length-1]+=k,p.set(x,C)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let w=g.parentElement,x=1;if(w&&w.tagName==="OL"){let C=w.getAttribute("start"),v=Number.isFinite(Number(C))?Number(C):1,E=s(g),P=g.getAttribute("value");x=Number.isFinite(Number(P))?Number(P):v+E}else x=1+s(g);let k=p.get("list-item")||[];k.length===0&&k.push(0),k[k.length-1]=x,p.set("list-item",k)}}catch{}return p},u=(m,d,g)=>{let p=l(g,d,m);r.set(m,p);let y=p;for(let b of m.children)y=u(b,p,y);let h=new Map;for(let[b,S]of g){let w=S.length,x=y.get(b);h.set(b,x&&x.length?x.slice(0,w):S.slice())}for(let[b,S]of y)!h.has(b)&&S.length&&!d.has(b)&&h.set(b,S.slice(0,1));return h},c=new Map;u(i,c,c);function f(){let m=e();if(m!==n){n=m;let d=new Map;u(i,d,d)}}return{get(m,d){f();let g=r.get(m)?.get(d);return g&&g.length?g[g.length-1]:0},getStack(m,d){f();let g=r.get(m)?.get(d);return g?g.slice():[]}}}function In(t,e,n){if(!t||t==="none")return t;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g;return t.replace(r,(i,o,s)=>{let a=String(s).split(",").map(l=>l.trim());if(o==="counter"){let l=a[0]?.replace(/^["']|["']$/g,""),u=(a[1]||"decimal").toLowerCase(),c=n.get(e,l);return Tn(c,u)}else{let l=a[0]?.replace(/^["']|["']$/g,""),u=a[1]?.replace(/^["']|["']$/g,"")??"",c=(a[2]||"decimal").toLowerCase(),f=n.getStack(e,l);return f.length?f.map(d=>Tn(d,c)).join(u):""}})}catch{return"- "}}ht();j();var vt=new WeakMap,_n=1e3;function qo(t,e){let n=Dn(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=On(t,n),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):On(t,n)}function Le(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Dn(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,r=0;for(let o=0;o<e.length;o++){let s=e[o];if(s.tagName==="STYLE"){let a=s.textContent?s.textContent.length:0;n+=`S${a}|`;let l=s.sheet,u=l?Le(l):null;u&&(r+=u.length)}else{let a=s.getAttribute("href")||"",l=s.getAttribute("media")||"all";n+=`L${a}|m:${l}|`;let u=s.sheet,c=u?Le(u):null;c&&(r+=c.length)}}let i=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Wn(t,e,n){let r=Le(t);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],s=o&&o.cssText?o.cssText:"";n.budget--;for(let a of e)if(s.includes(a))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let a=0;a<o.cssRules.length&&n.budget>0;a++){let l=o.cssRules[a],u=l&&l.cssText?l.cssText:"";n.budget--;for(let c of e)if(u.includes(c))return!0}if(n.budget<=0)return!1}return!1}function On(t=document,e=Dn(t)){let n=vt.get(t);if(n&&n.fingerprint===e)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=t.querySelectorAll("style");for(let s=0;s<i.length;s++){let a=i[s].textContent||"";for(let l of r)if(a.includes(l))return vt.set(t,{fingerprint:e,result:!0}),!0}let o=t.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let s={budget:_n};try{for(let a of o)if(Wn(a,r,s))return vt.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let s=t.querySelectorAll('style,link[rel~="stylesheet"]'),a={budget:_n};for(let l=0;l<s.length&&a.budget>0;l++){let u=s[l],c=null;if(u.tagName,c=u.sheet||null,c&&Wn(c,r,a))return vt.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(vt.set(t,{fingerprint:e,result:!0}),!0):(vt.set(t,{fingerprint:e,result:!1}),!1)}var Et=new WeakMap;function Un(t){for(let e of["Top","Right","Bottom","Left"]){let n=parseFloat(t[`border${e}Width`])||0,r=t[`border${e}Style`];if(n>0&&r&&r!=="none"&&r!=="hidden")return!0}return!1}var Bn=-1;function jo(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,r=0,i;for(;i=n.exec(t);){let s=t.slice(r,i.index).trim();s&&e.push(s),e.push(i[1]),r=n.lastIndex}let o=t.slice(r).trim();return o&&e.push(o),e.join("")}function Te(t,e){let n=t.parentElement,r=n?Et.get(n):null;return r?{get(i,o){let s=e.get(i,o),a=r.get(o);return typeof a=="number"?Math.max(s,a):s},getStack(i,o){let s=e.getStack(i,o);if(!s.length)return s;let a=r.get(o);if(typeof a=="number"){let l=s.slice();return l[l.length-1]=Math.max(l[l.length-1],a),l}return s}}:e}function Pe(t,e,n){let r=new Map;function i(u){let c=[];if(!u||u==="none")return c;for(let f of String(u).split(",")){let m=f.trim().split(/\s+/),d=m[0],g=Number.isFinite(Number(m[1]))?Number(m[1]):void 0;d&&c.push({name:d,num:g})}return c}let o=i(e?.counterReset),s=i(e?.counterSet),a=i(e?.counterIncrement);function l(u){if(r.has(u))return r.get(u).slice();let c=n.getStack(t,u);c=c.length?c.slice():[];let f=o.find(g=>g.name===u);if(f){let g=Number.isFinite(f.num)?f.num:0;c=c.length?[...c,g]:[g]}let m=s.find(g=>g.name===u);if(m){let g=Number.isFinite(m.num)?m.num:0;c.length===0&&(c=[0]),c[c.length-1]=g}let d=a.find(g=>g.name===u);if(d){let g=Number.isFinite(d.num)?d.num:1;c.length===0&&(c=[0]),c[c.length-1]+=g}return r.set(u,c.slice()),c}return{get(u,c){let f=l(c);return f.length?f[f.length-1]:0},getStack(u,c){return l(c)},__incs:a}}function Xo(t,e,n){let r;try{r=_(t,e)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=Te(t,n),s=Pe(t,r,o),a=Pn(i)?In(i,t,s):i;return{text:jo(a),incs:s.__incs||[]}}async function ae(t,e,n,r){if(!(t instanceof Element)||!(e instanceof Element))return;let i=t.ownerDocument||document;if(!qo(i,n))return;let o=A?.session?.__counterEpoch??0;if(Bn!==o&&(Et=new WeakMap,n&&(n.__counterCtx=null),Bn=o),!n.__counterCtx)try{n.__counterCtx=Nn(t.ownerDocument||document)}catch(l){R(n,"buildCounterContext failed",l)}let s=n.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let u=_(t,l);if(!u||u.content==="none"&&u.backgroundImage==="none"&&u.backgroundColor==="transparent"&&!Un(u)&&(!u.transform||u.transform==="none")&&u.display==="inline")continue;if(l==="::first-letter"){let $=_(t),T=($?.display||"").toLowerCase();if(T.includes("flex")||T.includes("grid")||!(u.color!==$.color||u.fontSize!==$.fontSize||u.fontWeight!==$.fontWeight||u.fontFamily!==$.fontFamily||u.fontStyle!==$.fontStyle||u.textTransform!==$.textTransform||u.float!==$.float||u.paddingTop!==$.paddingTop||u.paddingRight!==$.paddingRight||u.paddingBottom!==$.paddingBottom||u.paddingLeft!==$.paddingLeft||u.marginTop!==$.marginTop||u.marginRight!==$.marginRight||u.marginBottom!==$.marginBottom||u.marginLeft!==$.marginLeft))continue;let U=Array.from(e.childNodes).find(Vt=>Vt.nodeType===Node.TEXT_NODE&&Vt.textContent?.trim().length>0);if(!U)continue;let K=U.textContent,et=K.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Ht=K.slice(et?.length||0);if(!et||/[\uD800-\uDFFF]/.test(et))continue;let mt=document.createElement("span");mt.textContent=et,mt.dataset.snapdomPseudo="::first-letter";let fe=Qt(u),de=wt(fe,"span");n.styleMap.set(mt,de);let zt=document.createTextNode(Ht);e.replaceChild(zt,U),e.insertBefore(mt,zt);continue}let f=u.content??"",m=f===""||f==="none"||f==="normal",{text:d,incs:g}=Xo(t,l,s),p=u.backgroundImage,y=u.backgroundColor,h=u.fontFamily,b=parseInt(u.fontSize)||32,S=parseInt(u.fontWeight)||!1,w=u.color||"#000",x=u.transform,k=Z(h),C=!m&&d!=="",v=p&&p!=="none",E=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",P=Un(u),W=x&&x!=="none",Y=f!=="none"&&f!=="normal"&&((parseFloat(u.width)||0)>0||(parseFloat(u.height)||0)>0);if(!(C||v||E||P||W||Y)){if(g&&g.length&&t.parentElement){let $=Et.get(t.parentElement)||new Map;for(let{name:T}of g){if(!T)continue;let O=Te(t,s),K=Pe(t,_(t,l),O).get(t,T);$.set(T,K)}Et.set(t.parentElement,$)}continue}let I=!1;if(C&&!k&&d.length>1&&!d.startsWith("url(")){let $=_(t),T=parseFloat($.fontSize)||16,O=parseFloat($.lineHeight);Number.isFinite(O)||(O=T*1.5),t.getBoundingClientRect().height<O*1.6&&(e.style.whiteSpace="nowrap",I=!0)}let F=document.createElement("span");F.dataset.snapdomPseudo=l,F.style.pointerEvents="none",I&&(F.style.whiteSpace="nowrap");let X=Qt(u),Dt=wt(X,"span");if(n.styleMap.set(F,Dt),k&&d&&d.length===1){let{dataUrl:$,width:T,height:O}=await An(d,h,S,b,w),U=document.createElement("img");U.src=$,U.style=`height:${b}px;width:${T/O*b}px;object-fit:contain;`,F.appendChild(U),e.dataset.snapdomHasIcon="true"}else if(d&&d.startsWith("url(")){let $=pt(d);if($?.trim())try{let T=await B(ft($),{as:"dataURL",useProxy:r.useProxy});if(T?.ok&&typeof T.data=="string"){let O=document.createElement("img");O.src=T.data,O.style=`width:${b}px;height:auto;object-fit:contain;`,F.appendChild(O)}}catch(T){console.error(`[snapdom] Error in pseudo ${l} for`,t,T)}}else!k&&C&&(F.textContent=d);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=u.backgroundRepeat,F.style.backgroundSize=u.backgroundSize,u.backgroundPositionX&&u.backgroundPositionY?(F.style.backgroundPositionX=u.backgroundPositionX,F.style.backgroundPositionY=u.backgroundPositionY):F.style.backgroundPosition=u.backgroundPosition,F.style.backgroundOrigin=u.backgroundOrigin,F.style.backgroundClip=u.backgroundClip,F.style.backgroundAttachment=u.backgroundAttachment,F.style.backgroundBlendMode=u.backgroundBlendMode}catch{}if(v)try{let $=St(p),T=await Promise.all($.map(gt));F.style.backgroundImage=T.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${l}`,$)}E&&(F.style.backgroundColor=y);let at=F.childNodes.length>0||F.textContent?.trim()!==""||v||E||P||W||Y;if(g&&g.length&&t.parentElement){let $=Et.get(t.parentElement)||new Map,T=Te(t,s),O=Pe(t,_(t,l),T);for(let{name:U}of g){if(!U)continue;let K=O.get(t,U);$.set(U,K)}Et.set(t.parentElement,$)}if(!at)continue;l==="::before"?(e.dataset.snapdomHasBefore="1",e.insertBefore(F,e.firstChild)):(e.dataset.snapdomHasAfter="1",e.appendChild(F))}catch(u){console.warn(`[snapdom] Failed to capture ${l} for`,t,u)}let a=Array.from(e.children).filter(l=>!l.dataset.snapdomPseudo);if(n.nodeMap)for(let l of a){let u=n.nodeMap.get(l);u instanceof Element&&await ae(u,l,n,r)}else{let l=Array.from(t.children);for(let u=0;u<Math.min(l.length,a.length);u++)await ae(l[u],a[u],n,r)}}function Hn(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,r=e||n,i=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,s=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],a=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",u=w=>{if(!w||!w.getAttribute)return null;let x=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(l,"href"):null);if(x)return x;let k=w.attributes;if(!k)return null;for(let C=0;C<k.length;C++){let v=k[C];if(!v||!v.name)continue;if(v.name==="href")return v.value;let E=v.name.indexOf(":");if(E!==-1&&v.name.slice(E+1)==="href")return v.value}return null},c=new Set(Array.from(t.querySelectorAll("[id]")).map(w=>w.id)),f=new Set,m=!1,d=(w,x=null)=>{if(!w)return;o.lastIndex=0;let k;for(;k=o.exec(w);){m=!0;let C=(k[1]||"").trim();C&&(c.has(C)||(f.add(C),x&&!x.has(C)&&x.add(C)))}},g=w=>{let x=w.querySelectorAll("use");for(let v of x){let E=u(v);if(!E||!E.startsWith("#"))continue;m=!0;let P=E.slice(1).trim();P&&!c.has(P)&&f.add(P)}let C=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of C){d(v.getAttribute("style")||"");for(let E of s)d(v.getAttribute(E))}};for(let w of i)g(w);if(!m)return;let p=t.querySelector("svg.inline-defs-container");p||(p=n.createElementNS("http://www.w3.org/2000/svg","svg"),p.classList.add("inline-defs-container"),p.setAttribute("aria-hidden","true"),p.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(p,t.firstChild||null));let y=p.querySelector("defs")||null,h=w=>{if(!w||c.has(w))return null;let x=a(w),k=C=>{let v=r.querySelector(C);return v&&!t.contains(v)?v:null};return k(`svg defs > *#${x}`)||k(`svg > symbol#${x}`)||k(`*#${x}`)};if(!f.size)return;let b=new Set(f),S=new Set;for(;b.size;){let w=b.values().next().value;if(b.delete(w),!w||c.has(w)||S.has(w))continue;let x=h(w);if(!x){S.add(w);continue}y||(y=n.createElementNS("http://www.w3.org/2000/svg","defs"),p.appendChild(y));let k=x.cloneNode(!0);k.id||k.setAttribute("id",w),y.appendChild(k),S.add(w),c.add(w);let C=[k,...k.querySelectorAll("*")];for(let v of C){let E=u(v);if(E&&E.startsWith("#")){let W=E.slice(1).trim();W&&!c.has(W)&&!S.has(W)&&b.add(W)}let P=v.getAttribute?.("style")||"";P&&d(P,b);for(let W of s){let z=v.getAttribute?.(W);z&&d(z,b)}}}}j();function Vn(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let r=t.getBoundingClientRect(),i=t.clientHeight,o="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let a=s.currentNode,l=getComputedStyle(a),u=l.position;if(u!=="sticky"&&u!=="-webkit-sticky")continue;let c=zn(l.top),f=zn(l.bottom);if(c==null&&f==null)continue;let m=Go(a,t),d=Yo(e,m,o);if(!d)continue;let g=a.getBoundingClientRect(),p=g.width,y=g.height,h=g.left-r.left;if(!(p>0&&y>0)||!Number.isFinite(h))continue;let b=c!=null?c+n:n+(i-y-f);if(!Number.isFinite(b))continue;let S=Number.parseInt(l.zIndex,10),w=Number.isFinite(S),x=w?Math.max(S,1)+1:2,k=w?S-1:0,C=d.cloneNode(!1);C.setAttribute(o,"1"),C.style.position="sticky",C.style.left=`${h}px`,C.style.top=`${b}px`,C.style.width=`${p}px`,C.style.height=`${y}px`,C.style.visibility="hidden",C.style.zIndex=String(k),C.style.overflow="hidden",C.style.background="transparent",C.style.boxShadow="none",C.style.filter="none",d.parentElement?.insertBefore(C,d),d.style.position="absolute",d.style.left=`${h}px`,d.style.top=`${b}px`,d.style.bottom="auto",d.style.zIndex=String(x),d.style.pointerEvents="none"}}function zn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Go(t,e){let n=[];for(let r=t;r&&r!==e;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function Yo(t,e,n){let r=t;for(let i=0;i<e.length;i++)if(r=Ko(r,n)[e[i]],!r)return null;return r instanceof HTMLElement?r:null}function Ko(t,e){let n=[],r=t.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(e)||n.push(o)}return n}function qn(t){let e=getComputedStyle(t),n=e.outlineStyle,r=e.outlineWidth,i=e.borderStyle,o=e.borderWidth,s=n!=="none"&&parseFloat(r)>0,a=i==="none"||parseFloat(o)===0;s&&a&&(t.style.border=`${r} solid transparent`)}function jn(t){let e=[];try{let n=t.querySelectorAll("*");for(let r of n){if(!(r instanceof HTMLElement))continue;let i=r.style.contentVisibility||"",o=getComputedStyle(r),s=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(s==="auto"||s==="hidden")&&(e.push({el:r,original:i}),r.style.contentVisibility="visible")}if(t instanceof HTMLElement){let r=getComputedStyle(t),i=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(e.push({el:t,original:t.style.contentVisibility||""}),t.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:n,original:r}of e)try{n.style.contentVisibility=r}catch{}}}async function Xn(t,e={}){let n={styleMap:A.session.styleMap,styleCache:A.session.styleCache,nodeMap:A.session.nodeMap,options:e},r,i="",o="";qn(t);let s=jn(t);try{r=await Wt(t,n,e)}catch(c){throw console.warn("deepClone failed:",c),c}finally{s()}try{Hn(r)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{await ae(t,r,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await yn(r,n);try{let c=r.querySelectorAll("style[data-sd]");for(let f of c)o+=f.textContent||"",f.remove()}catch(c){R(n,"Failed to extract shadow CSS from style[data-sd]",c)}let a=Ce(n.styleMap);i=Array.from(a.entries()).map(([c,f])=>`.${f}{${c}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[c,f]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",f.replace(/;/g,"; "));continue}let m=a.get(f);m&&c.classList.add(m);let d=c.style?.backgroundImage,g=c.dataset?.snapdomHasIcon;d&&d!=="none"&&(c.style.backgroundImage=d),g&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,f]of n.nodeMap.entries()){let m=f.scrollLeft,d=f.scrollTop;if((m||d)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";try{let y=c.querySelectorAll("*");for(let h of y){if(!(h instanceof HTMLElement))continue;let b=h.style.position;if(b==="fixed"||b==="absolute"){let S=parseFloat(h.style.top)||0,w=parseFloat(h.style.left)||0;h.style.top=`${S+d}px`,h.style.left=`${w+m}px`,b==="fixed"&&(h.style.position="absolute")}}}catch{}let p=document.createElement("div");for(p.style.all="unset",p.style.transform=`translate(${-m}px, ${-d}px)`,p.style.willChange="transform",p.style.display="inline-block",p.style.width="100%";c.firstChild;)p.appendChild(c.firstChild);c.appendChild(p)}}let u=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Vn(t,u),t===n.nodeMap.get(r)){let c=n.styleCache.get(t)||_(t);n.styleCache.set(t,c);let f=he(c.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=f||""}for(let[c,f]of n.nodeMap.entries())f.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}ht();var Gn="http://www.w3.org/1999/xlink";function Qo(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(Gn,"href"):null)}function Jo(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,r=parseInt(t.getAttribute("width")||"",10)||0,i=parseInt(t.getAttribute("height")||"",10)||0,o=parseFloat(t.style?.width||"")||0,s=parseFloat(t.style?.height||"")||0,a=e||o||r||t.width||t.naturalWidth||100,l=n||s||i||t.height||t.naturalHeight||100;return{width:a,height:l}}async function Yn(t,e={}){let n=Array.from(t.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let d=a.currentSrc||a.src||"";d&&a.setAttribute("src",d)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let l=a.src||"";if(!l)return;let u=await B(l,{as:"dataURL",useProxy:e.useProxy});if(u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")){a.src=u.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:c,height:f}=Jo(a),{fallbackURL:m}=e||{};if(m)try{let d=typeof m=="function"?await m({width:c,height:f,src:l,element:a}):m;if(d){let g=await B(d,{as:"dataURL",useProxy:e.useProxy});if(g?.ok&&typeof g.data=="string"){a.src=g.data,a.width||(a.width=c),a.height||(a.height=f);return}}}catch{}if(e.placeholders!==!1){let d=document.createElement("div");d.style.cssText=[`width:${c}px`,`height:${f}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${f}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),d.textContent="img",a.replaceWith(d)}else{let d=document.createElement("div");d.style.cssText=`display:inline-block;width:${c}px;height:${f}px;visibility:hidden;`,a.replaceWith(d)}},i=6;for(let a=0;a<n.length;a+=i){let l=n.slice(a,a+i).map(r);await Promise.allSettled(l)}let o=Array.from(t.querySelectorAll("image")),s=async a=>{let l=Qo(a);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let u=await B(l,{as:"dataURL",useProxy:e.useProxy});u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")&&(a.setAttribute("href",u.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Gn,"href"))};for(let a=0;a<o.length;a+=i){let l=o.slice(a,a+i).map(s);await Promise.allSettled(l)}}J();async function ce(t,e,n,r={}){let i=[[t,e]],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"],s=["mask-position","mask-size","mask-repeat","mask-mode","mask-composite","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","-webkit-mask-composite","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],a=["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[u,c]=i.shift();if(!c)continue;let f=n.get(u)||_(u);n.has(u)||n.set(u,f);let m=(()=>{let b=f.getPropertyValue("border-image"),S=f.getPropertyValue("border-image-source");return b&&b!=="none"||S&&S!=="none"})(),d=f.getPropertyValue("background-image"),g=f.getPropertyValue("background-color");if(d&&d!=="none"||g&&g!=="rgba(0, 0, 0, 0)"&&g!=="transparent"||/url\s*\(|gradient\s*\(/i.test(f.getPropertyValue("background")||""))for(let b of a){let S=f.getPropertyValue(b);S&&c.style.setProperty(b,S)}for(let b of o){let S=f.getPropertyValue(b);if(b==="background-image"&&(!S||S==="none")){let k=f.getPropertyValue("background");k&&/url\s*\(/.test(k)&&(S=St(k).filter(C=>/url\s*\(/.test(C)).join(", ")||S)}if(!S||S==="none")continue;let w=St(S),x=await Promise.all(w.map(k=>gt(k,r)));x.some(k=>k&&k!=="none"&&!/^url\(undefined/.test(k))&&c.style.setProperty(b,x.join(", "))}for(let b of s){let S=f.getPropertyValue(b);!S||S==="initial"||c.style.setProperty(b,S)}if(m)for(let b of l){let S=f.getPropertyValue(b);!S||S==="initial"||c.style.setProperty(b,S)}let y=u.shadowRoot?Array.from(u.shadowRoot.children).filter(b=>b.tagName!=="STYLE"):Array.from(u.children),h=Array.from(c.children).filter(b=>!(b.dataset?.snapdomPseudo||b.tagName==="STYLE"&&b.dataset?.sd));for(let b=0;b<Math.min(y.length,h.length);b++)i.push([y[b],h[b]])}}J();j();function Kn(t){if(!t)return()=>{};let e=[];function n(r){let i=Zo(r);i&&e.push(i);for(let o of r.children||[])n(o)}return n(t),()=>e.forEach(r=>r())}function Zo(t){if(!t)return()=>{};let e=ti(t);if(e<=0)return()=>{};if(!ri(t))return()=>{};let n=getComputedStyle(t),r=Math.round(ei(n)*e+ni(n)),i=t.textContent??"",o=i;if(t.scrollHeight<=r+.5)return()=>{};let s=0,a=i.length,l=-1;for(;s<=a;){let u=s+a>>1;t.textContent=i.slice(0,u)+"\u2026",t.scrollHeight<=r+.5?(l=u,s=u+1):a=u-1}return t.textContent=(l>=0?i.slice(0,l):"")+"\u2026",()=>{t.textContent=o}}function ti(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function ei(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function ni(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function ri(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Ot=[];function le(t){if(!t)return null;if(Array.isArray(t)){let[e,n]=t;return typeof e=="function"?e(n):e}if(typeof t=="object"&&"plugin"in t){let{plugin:e,options:n}=t;return typeof e=="function"?e(n):e}return typeof t=="function"?t():t}function Qn(...t){let e=t.flat();for(let n of e){let r=le(n);r&&(Ot.some(i=>i&&i.name&&r.name&&i.name===r.name)||Ot.push(r))}}function Jn(t){return t&&Array.isArray(t.plugins)?t.plugins:Ot}async function tt(t,e,n){let r=n,i=Jn(e);for(let o of i){let s=o&&typeof o[t]=="function"?o[t]:null;if(!s)continue;let a=await s(e,r);typeof a<"u"&&(r=a)}return r}async function Zn(t,e,n){let r=[],i=Jn(e);for(let o of i){let s=o&&typeof o[t]=="function"?o[t]:null;if(!s)continue;let a=await s(e,n);typeof a<"u"&&r.push(a)}return r}function oi(t){let e=[];if(Array.isArray(t))for(let n of t){let r=le(n);if(!r||!r.name)continue;let i=e.findIndex(o=>o&&o.name===r.name);i>=0&&e.splice(i,1),e.push(r)}for(let n of Ot)n&&n.name&&!e.some(r=>r.name===n.name)&&e.push(n);return Object.freeze(e)}function tr(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=oi(e)),t}function er(){return Ot.slice()}function yt(t){return!!(!t||t.startsWith("data:")||t.startsWith("blob:")||/^data:image\/(gif|png|svg)/.test(t)&&t.length<200)}function ii(t,e){return!t||!(t instanceof Element)?!1:t.querySelector("picture")?!0:e?!!t.querySelector("img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]"):!1}function si(t,e){let n=t.currentSrc||"";if(n&&!yt(n))return n;let r=e.querySelectorAll("source[srcset]"),i=null;for(let o of r){let s=o.getAttribute("srcset");if(!s||yt(s))continue;let a=o.getAttribute("media");if(a)try{if(window.matchMedia(a).matches)return s.split(",")[0].trim().split(/\s+/)[0]}catch{}i||(i=s.split(",")[0].trim().split(/\s+/)[0])}return i}function ai(t){let e=[t.getAttribute("data-src"),t.getAttribute("data-lazy-src"),t.getAttribute("data-original"),t.getAttribute("data-hi-res-src")];for(let r of e)if(r&&!yt(r))return r;let n=t.getAttribute("data-srcset")||t.getAttribute("data-lazy-srcset");if(n){let r=n.split(",")[0].trim().split(/\s+/)[0];if(r&&!yt(r))return r}return null}function ci(t={}){let e=t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{};return{timeout:e.timeout??5e3,concurrency:e.concurrency??4,resolveLazySrc:e.resolveLazySrc!==!1,silent:e.silent??!1,useProxy:typeof t.useProxy=="string"?t.useProxy:""}}async function nr(t,e={}){if(!t||!(t instanceof Element)||e.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:r,resolveLazySrc:i,silent:o,useProxy:s}=ci(e);if(!ii(t,i))return null;let a=[],l=[];async function u(m){let d=new AbortController,g=setTimeout(()=>d.abort(),n);try{let p=await fetch(m,{credentials:"include",signal:d.signal});if(!p.ok&&s){let h=s.includes("{url}")?s.replace("{url}",encodeURIComponent(m)):s.endsWith("?")?`${s}${encodeURIComponent(m)}`:`${s}${s.includes("?")?"&":"?"}url=${encodeURIComponent(m)}`;p=await fetch(h,{signal:d.signal})}if(!p.ok)return null;let y=await p.blob();return await new Promise((h,b)=>{let S=new FileReader;S.onload=()=>h(S.result),S.onerror=b,S.readAsDataURL(y)})}catch{return null}finally{clearTimeout(g)}}async function c(m){for(let d=0;d<m.length;d+=r){let g=m.slice(d,d+r);await Promise.allSettled(g.map(p=>p()))}}let f=t.querySelectorAll("picture");for(let m of f){let d=m.querySelector("img");if(!d)continue;let g=d.getAttribute("src")||"";if(!yt(g))continue;let p=si(d,m);p&&l.push(async()=>{let y=await u(p);if(!y){o||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${p.slice(0,60)}`);return}let h=d.getAttribute("src"),b=d.getAttribute("srcset"),S=d.getAttribute("sizes"),w=[];d.src=y,d.setAttribute("src",y),d.removeAttribute("srcset"),d.removeAttribute("sizes");let x=m.querySelectorAll("source");for(let k of x)w.push({el:k,parent:k.parentElement,next:k.nextSibling}),k.remove();a.push(()=>{h!==null?d.setAttribute("src",h):d.removeAttribute("src"),b!==null&&d.setAttribute("srcset",b),S!==null&&d.setAttribute("sizes",S);for(let{el:k,parent:C,next:v}of w)C&&C.insertBefore(k,v)})})}if(i){let m=t.querySelectorAll("img");for(let d of m){if(d.closest("picture")&&yt(d.getAttribute("src")||""))continue;let g=d.getAttribute("src")||"",p=ai(d);p&&yt(g)&&l.push(async()=>{let y=await u(p);if(!y)return;let h=d.getAttribute("src");d.src=y,d.setAttribute("src",y),d.removeAttribute("srcset"),d.removeAttribute("sizes"),a.push(()=>{h!==null?d.setAttribute("src",h):d.removeAttribute("src")})})}}return l.length===0?null:(await c(l),async function(){for(let d of a)try{d()}catch{}})}J();function ir(t,e,n={}){if(!t||!e||!e.style)return;let r=getComputedStyle(t);try{e.style.boxShadow="none"}catch(s){R(n,"stripRootShadows boxShadow",s)}try{e.style.textShadow="none"}catch(s){R(n,"stripRootShadows textShadow",s)}try{e.style.outline="none"}catch(s){R(n,"stripRootShadows outline",s)}let o=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch(s){R(n,"stripRootShadows filter",s)}}function rr(t){let e=t.display||"";if(e.includes("flex")||e.includes("grid")||e.startsWith("table")||e==="inline-block"||e==="flow-root"||t.position==="absolute"||t.position==="fixed"||t.float&&t.float!=="none")return!0;let n=t.overflowX||t.overflow||"visible",r=t.overflowY||t.overflow||"visible";return!!(n!=="visible"||r!=="visible"||t.contain&&/\b(layout|content|paint|strict)\b/.test(t.contain))}function li(t,e){let n=Array.from(t.childNodes),r=e==="top"?n:n.reverse();for(let i of r){if(i.nodeType===Node.TEXT_NODE){if(/\S/.test(i.textContent||""))return null;continue}if(i.nodeType!==Node.ELEMENT_NODE)continue;let o=getComputedStyle(i),s=String(o.display||"");if(!(s==="none"||s==="contents")&&!(o.position==="absolute"||o.position==="fixed"))return o.float&&o.float!=="none"||s.startsWith("inline")?null:i}return null}function sr(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);if(!rr(n))for(let r of["top","bottom"]){let i=r==="top"?"Top":"Bottom";if((parseFloat(n[`border${i}Width`])||0)>0||(parseFloat(n[`padding${i}`])||0)>0)continue;let o=t,s=e;for(;o&&s;){let a=li(o,r);if(!a)break;let l=Array.from(o.children).indexOf(a),u=l>=0?s.children[l]:null,c=getComputedStyle(a),f=parseFloat(c[`margin${i}`])||0;if(u&&u.style&&f>0&&(u.style[`margin${i}`]="0px"),rr(c)||(parseFloat(c[`border${i}Width`])||0)>0||(parseFloat(c[`padding${i}`])||0)>0)break;o=a,s=u}}}function ui(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let r of n)r.remove()}function fi(t,e={}){let{stripFrameworkDirectives:n=!0}=e,r=new Set(["xml","xlink"]),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let s of Array.from(o.attributes)){let a=s.name;if(a.includes("@")){o.removeAttribute(a);continue}if(a.includes(":")){let l=a.split(":",1)[0];if(!r.has(l)){o.removeAttribute(a);continue}}if(n&&(a.startsWith("x-")||a.startsWith("v-")||a.startsWith(":")||a.startsWith("on:")||a.startsWith("bind:")||a.startsWith("let:")||a.startsWith("class:"))){o.removeAttribute(a);continue}}}}var or=/[\x00-\x08\x0B\x0C\x0E-\x1F]/g;function di(t){if(!t)return;let e=i=>{if(i.nodeType===Node.ELEMENT_NODE){if(i.attributes)for(let o of Array.from(i.attributes)){let s=o.value.replace(or,"");if(s!==o.value)try{i.setAttribute(o.name,s)}catch{}}}else if(i.nodeType===Node.TEXT_NODE||i.nodeType===Node.CDATA_SECTION_NODE){let o=i.data.replace(or,"");o!==i.data&&(i.data=o)}};e(t);let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),r;for(;r=n.nextNode();)e(r)}function ar(t,e={}){t&&(fi(t,e),ui(t),di(t))}function mi(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function pi(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function hi(t,e){if(!(t instanceof Element)||mi(t)||pi(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=e.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||e.transform&&e.transform!=="none")}function cr(t,e,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let s=i.childElementCount>o.childElementCount,a=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,a),s&&hi(i,a)){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 c=a.overflowY||a.overflowBlock||"visible",f=a.overflowX||a.overflowInline||"visible";(c!=="visible"||f!=="visible")&&(o.style.overflow="visible")}let l=Array.from(i.children),u=Array.from(o.children);for(let c=0;c<Math.min(l.length,u.length);c++)r(l[c],u[c])}r(t,e)}function gi(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed")}function yi(t,e){if(!(t instanceof Element))return!1;if(t.getAttribute("data-capture")==="exclude"&&e?.excludeMode==="remove")return!0;if(Array.isArray(e?.exclude))for(let n of e.exclude)try{if(t.matches(n))return e.excludeMode==="remove"}catch(r){R(e,"exclude selector match failed",r)}return!1}function lr(t,e){let n=getComputedStyle(t),r=t.getBoundingClientRect(),i=1/0,o=-1/0,s=!1,a=Array.from(t.children);for(let d of a){if(yi(d,e)||!gi(d))continue;let g=d.getBoundingClientRect(),p=g.top-r.top,y=g.bottom-r.top;y<=p||(p<i&&(i=p),y>o&&(o=y),s=!0)}let l=s?Math.max(0,o-i):0,u=parseFloat(n.borderTopWidth)||0,c=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,m=parseFloat(n.paddingBottom)||0;return u+c+f+m+l}var M=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t,bi=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Ne(t,e=new Set){let n="";if(!t)return n;for(let r=0;r<t.length;r++){let i=t[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Ne(i.styleSheet.cssRules,e);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=Ne(i.cssRules,e);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(bi.test(o)){let s=i.cssText;s&&!e.has(s)&&(e.add(s),n+=s)}}}catch{}}return n}function ur(t){if(!t||!t.styleSheets)return"";let e=new Set,n="";for(let r of Array.from(t.styleSheets))try{let i=r.cssRules;i&&(n+=Ne(i,e))}catch{}return n}Jt();function fr(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=[],r="",i=0;for(let u=0;u<e.length;u++){let c=e[u];c==="("?i++:c===")"&&(i=Math.max(0,i-1)),c===","&&i===0?(n.push(r),r=""):r+=c}r.trim()&&n.push(r);let o=0,s=0,a=0,l=0;for(let u of n){if(/\binset\b/i.test(u))continue;let c=u.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(c.length<2)continue;let[f,m,d=0,g=0]=c,p=Math.abs(f)+d+g,y=Math.abs(m)+d+g;s=Math.max(s,p+Math.max(f,0)),l=Math.max(l,p+Math.max(-f,0)),a=Math.max(a,y+Math.max(m,0)),o=Math.max(o,y+Math.max(-m,0))}return{top:Math.ceil(o),right:Math.ceil(s),bottom:Math.ceil(a),left:Math.ceil(l)}}function dr(t){let e=t.filter&&t.filter!=="none"?t.filter:t.webkitFilter||"",n=/blur\(\s*([0-9.]+)px\s*\)/gi,r=0,i;for(;i=n.exec(e);)r+=parseFloat(i[1])||0;let o=Math.ceil(r);return{top:o,right:o,bottom:o,left:o}}function mr(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0),n=parseFloat(t.outlineOffset||"0")||0,r=e+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function pr(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,s=0,a=!1;for(let l of n){a=!0;let u=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(p=>parseFloat(p))||[],[c=0,f=0,m=0]=u,d=Math.abs(c)+m,g=Math.abs(f)+m;i=Math.max(i,d+Math.max(c,0)),s=Math.max(s,d+Math.max(-c,0)),o=Math.max(o,g+Math.max(f,0)),r=Math.max(r,g+Math.max(-f,0))}return{bleed:{top:M(r),right:M(i),bottom:M(o),left:M(s)},has:a}}function hr(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none"){let a=null;try{a=We(t).scale}catch{}try{e.style.transform="none"}catch{}if(!a)return{a:1,b:0,c:0,d:1};let l=a.trim().split(/\s+/).map(parseFloat),u=Number.isFinite(l[0])?l[0]:1,c=Number.isFinite(l[1])?l[1]:u;return{a:u,b:0,c:0,d:c}}function i(a,l,u,c){let f=Math.sqrt(a*a+l*l)||0,m=0,d=0;if(f>0){let g=a/f,p=l/f;m=g*u+p*c;let y=u-g*m,h=c-p*m;d=Math.sqrt(y*y+h*h)||0,d>0?m=m/d:m=0}return{a:f,b:0,c:m*d,d}}let o=r.match(/^matrix\(\s*([^)]+)\)$/i);if(o){let a=o[1].split(",").map(l=>parseFloat(l.trim()));if(a.length===6&&a.every(Number.isFinite)){let[l,u,c,f]=a,m=i(l,u,c,f);try{e.style.transform=`matrix(${m.a}, ${m.b}, ${m.c}, ${m.d}, 0, 0)`}catch{}return m}}let s=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(s){let a=s[1].split(",").map(l=>parseFloat(l.trim()));if(a.length===16&&a.every(Number.isFinite)){let l=a[0],u=a[1],c=a[4],f=a[5],m=i(l,u,c,f);try{e.style.transform=`matrix(${m.a}, ${m.b}, ${m.c}, ${m.d}, 0, 0)`}catch{}return m}}try{let a=new DOMMatrix(r),l=i(a.a,a.b,a.c,a.d);try{e.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, 0, 0)`}catch{}return l}catch{return null}}function _e(t,e,n,r,i){let o=n.a,s=n.b,a=n.c,l=n.d,u=n.e||0,c=n.f||0;function f(h,b){let S=h-r,w=b-i,x=o*S+a*w,k=s*S+l*w;return x+=r+u,k+=i+c,[x,k]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],d=1/0,g=1/0,p=-1/0,y=-1/0;for(let[h,b]of m)h<d&&(d=h),b<g&&(g=b),h>p&&(p=h),b>y&&(y=b);return{minX:d,minY:g,maxX:p,maxY:y,width:p-d,height:y-g}}function gr(t,e,n){let r=(t.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],s=(a,l)=>{let u=a.toLowerCase();return u==="left"||u==="top"?0:u==="center"?l/2:u==="right"||u==="bottom"?l:u.endsWith("px")?parseFloat(u)||0:u.endsWith("%")?(parseFloat(u)||0)*l/100:/^-?\d+(\.\d+)?$/.test(u)&&parseFloat(u)||0};return{ox:s(i,e),oy:s(o,n)}}function We(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.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;e.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else o.unit?e.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:e.rotate=String(o);else{let l=getComputedStyle(t);e.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let s=i("scale");if(s){let l="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,u="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:l;e.scale=`${l} ${u}`}else{let l=getComputedStyle(t);e.scale=l.scale&&l.scale!=="none"?l.scale:null}let a=i("translate");if(a){let l="x"in a&&"value"in a.x?a.x.value:Array.isArray(a)?a[0]?.value:0,u="y"in a&&"value"in a.y?a.y.value:Array.isArray(a)?a[1]?.value:0,c="x"in a&&a.x?.unit?a.x.unit:"px",f="y"in a&&a.y?.unit?a.y.unit:"px";e.translate=`${l}${c} ${u}${f}`}else{let l=getComputedStyle(t);e.translate=l.translate&&l.translate!=="none"?l.translate:null}return e}let r=getComputedStyle(t);return e.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",e.scale=r.scale&&r.scale!=="none"?r.scale:null,e.translate=r.translate&&r.translate!=="none"?r.translate:null,e}var Ie=null;function wi(){if(Ie)return Ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),Ie=t,t}function yr(t){let e=wi(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let r=Si(n);return e.removeChild(n),r}function br(t){let e=_(t),n=e.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 i=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",o=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(i||o||s)}function Si(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xi(t){if(Array.isArray(t.plugins)){for(let e of t.plugins)if(le(e)?.name==="picture-resolver")return!0}return er().some(e=>e?.name==="picture-resolver")}async function Oe(t,e){if(!t)throw new Error("Element cannot be null or undefined");Xt(e.cache);let n=e.fast,r=e.outerTransforms!==!1,i=!!e.outerShadows,o={element:t,options:e,plugins:e.plugins},s,a,l,u="",c="",f,m,d=null;await tt("beforeSnap",o);let g=null;e.resolvePicturePlaceholders!==!1&&!xi(e)&&(g=await nr(o.element,o.options)),await tt("beforeClone",o);let p=Kn(o.element);try{({clone:s,classCSS:a,styleCache:l}=await Xn(o.element,o.options)),!r&&s&&(d=hr(o.element,s)),!i&&s&&ir(o.element,s,o.options),s&&sr(o.element,s)}finally{p()}if(o={clone:s,classCSS:a,styleCache:l,...o},await tt("afterClone",o),g&&await g(),ar(o.clone),o.options?.excludeMode==="remove")try{cr(o.element,o.clone,o.styleCache)}catch(w){console.warn("[snapdom] shrink pass failed:",w)}try{await Sn(o.clone,o.element)}catch{}await new Promise(w=>{ot(async()=>{await Yn(o.clone,o.options),w()},{fast:n})}),await new Promise(w=>{ot(async()=>{await ce(o.element,o.clone,o.styleCache,o.options),w()},{fast:n})}),e.embedFonts&&await new Promise(w=>{ot(async()=>{let x=At(o.element),k=se(o.element);if(H()){let C=new Set(Array.from(x).map(v=>String(v).split("__")[0]).filter(Boolean));await kt(C,1)}u=await ie({required:x,usedCodepoints:k,preCached:!1,exclude:o.options.excludeFonts,localFonts:o.options.localFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),w()},{fast:n})});let y=Se(o.clone).sort(),h=y.join(",");A.baseStyle.has(h)?c=A.baseStyle.get(h):await new Promise(w=>{ot(()=>{c=xe(y),A.baseStyle.set(h,c),w()},{fast:n})});let b=ur(o.element?.ownerDocument||document);o={fontsCSS:u,baseCSS:c,scrollbarCSS:b,...o},await tt("beforeRender",o),await new Promise(w=>{ot(()=>{let x=_(o.element),k=o.element.getBoundingClientRect(),C=Math.max(1,M(o.element.offsetWidth||parseFloat(x.width)||k.width||1)),v=Math.max(1,M(o.element.offsetHeight||parseFloat(x.height)||k.height||1)),E=o.element.ownerDocument||document;if(o.element===E.body||o.element===E.documentElement){let V=Math.max(o.element.scrollHeight||0,E.documentElement?.scrollHeight||0,E.body?.scrollHeight||0),G=Math.max(o.element.scrollWidth||0,E.documentElement?.scrollWidth||0,E.body?.scrollWidth||0);V>0&&(v=Math.max(v,M(V))),G>0&&(C=Math.max(C,M(G)));try{let nt=(o.scrollbarCSS||"").length+(o.baseCSS||"").length+(o.fontsCSS||"").length+(o.classCSS||"").length,Q=A.measureHints.get(o.element);if(Q&&Q.cssLen===nt&&Q.w0===C)Q.csh>0&&(v=Math.max(v,M(Q.csh))),Q.csw>0&&(C=Math.max(C,M(Q.csw)));else{let rt=E.createElement("div");rt.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+C+"px!important;overflow:visible!important;visibility:hidden!important;";let jt=E.createElement("style");jt.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,rt.appendChild(jt),rt.appendChild(o.clone.cloneNode(!0)),E.body.appendChild(rt);let $t=rt.scrollHeight,ut=rt.scrollWidth;E.body.removeChild(rt),A.measureHints.set(o.element,{cssLen:nt,w0:C,csh:$t,csw:ut}),$t>0&&(v=Math.max(v,M($t))),ut>0&&(C=Math.max(C,M(ut)))}}catch{}}if(o.options?.excludeMode==="remove"){let V=lr(o.element,o.options);Number.isFinite(V)&&V>0&&(v=Math.max(1,Math.min(v,M(V+1))))}let W=(V,G=NaN)=>{let nt=typeof V=="string"?parseFloat(V):V;return Number.isFinite(nt)?nt:G},z=W(o.options.width),Y=W(o.options.height),L=C,I=v,F=Number.isFinite(z),X=Number.isFinite(Y),Dt=v>0?C/v:1;F&&X?(L=Math.max(1,M(z)),I=Math.max(1,M(Y))):F?(L=Math.max(1,M(z)),I=Math.max(1,M(L/(Dt||1)))):X?(I=Math.max(1,M(Y)),L=Math.max(1,M(I*(Dt||1)))):(L=C,I=v);let dt=0,at=0,$=C,T=v;if(!r&&d&&Number.isFinite(d.a)){let V={a:d.a,b:d.b||0,c:d.c||0,d:d.d||1,e:0,f:0},G=_e(C,v,V,0,0);dt=M(G.minX),at=M(G.minY),$=M(G.maxX),T=M(G.maxY)}else if(r&&wr(o.element)){let G=x.transform&&x.transform!=="none"?x.transform:"",nt=We(o.element),Q=yr({baseTransform:G,rotate:nt.rotate||"0deg",scale:nt.scale,translate:nt.translate}),{ox:rt,oy:jt}=gr(x,C,v),$t=Q.is2D?Q:new DOMMatrix(Q.toString()),ut=_e(C,v,$t,rt,jt);dt=M(ut.minX),at=M(ut.minY),$=M(ut.maxX),T=M(ut.maxY)}let O=fr(x),U=dr(x),K=mr(x),Ft=pr(x),et=i?{top:M(O.top+U.top+K.top+Ft.bleed.top),right:M(O.right+U.right+K.right+Ft.bleed.right),bottom:M(O.bottom+U.bottom+K.bottom+Ft.bleed.bottom),left:M(O.left+U.left+K.left+Ft.bleed.left)}:{top:0,right:0,bottom:0,left:0};dt=M(dt-et.left),at=M(at-et.top),$=M($+et.right),T=M(T+et.bottom);let Ht=Math.max(1,M($-dt)),mt=Math.max(1,M(T-at)),fe=F||X?M(L/C):1,de=X||F?M(I/v):1,zt=Math.max(1,M(Ht*fe)),Vt=Math.max(1,M(mt*de)),Ve="http://www.w3.org/2000/svg",Pr=H()&&wr(o.element)?1:0,ct=M(Pr+(r?0:1)),lt=document.createElementNS(Ve,"foreignObject"),Nr=M(dt),Ir=M(at);lt.setAttribute("x",String(M(-(Nr-ct)))),lt.setAttribute("y",String(M(-(Ir-ct)))),lt.setAttribute("width",String(M(C+ct*2))),lt.setAttribute("height",String(M(v+ct*2))),lt.style.overflow="visible";let qe=document.createElement("style"),_r="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";qe.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+_r+o.classCSS,lt.appendChild(qe);let qt=document.createElement("div");qt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),qt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${M(C)}px;height:${M(v)}px`,qt.appendChild(o.clone),lt.appendChild(qt);let Wr=new XMLSerializer().serializeToString(lt),me=M(Ht+ct*2),pe=M(mt+ct*2),je=F||X;e.meta={w0:C,h0:v,vbW:me,vbH:pe,targetW:L,targetH:I};let Or=H()&&je?me:M(zt+ct*2),Ur=H()&&je?pe:M(Vt+ct*2),Br=parseFloat(_(E.documentElement)?.fontSize)||16;m=`<svg xmlns="${Ve}" width="${Or}" height="${Ur}" viewBox="0 0 ${me} ${pe}" font-size="${Br}px">`+Wr+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,o={svgString:m,dataURL:f,...o},w()},{fast:n})}),await tt("afterRender",o);let S=document.getElementById("snapdom-sandbox");return S&&S.style.position==="absolute"&&S.remove(),o.dataURL}function wr(t){return br(t)}j();function Sr(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Xe(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(t.safariWarmupAttempts??3)|0)),excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1,pictureResolver:t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{}}}xt();ke();J();ht();j();async function Ci(t=document,e={}){let{embedFonts:n=!0,useProxy:r=""}=e,i=e.cache??e.cacheOpt??"full";Xt(i);try{await document.fonts?.ready}catch{}try{be()}catch{}A.session=A.session||{},A.session.styleCache||(A.session.styleCache=new WeakMap),A.image=A.image||new D(100),A.background=A.background||new D(100);try{await ce(t,void 0,A.session.styleCache,{useProxy:r})}catch{}let o=[],s=[];try{if(t&&t.nodeType===1){let l=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];s=[t,...l],o=[],t.tagName==="IMG"&&t.getAttribute("src")&&o.push(t),o.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(o=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let a=[];for(let l of o){let u=l?.currentSrc||l?.src;if(u&&!A.image.has(u)){let c=Promise.resolve().then(async()=>{let f=await B(u,{as:"dataURL",useProxy:r});f?.ok&&typeof f.data=="string"&&A.image.set(u,f.data)}).catch(()=>{});a.push(c)}}for(let l of s){let u="";try{u=l?.style?.backgroundImage||"",(!u||u==="none")&&(u=_(l).backgroundImage)}catch{}if(u&&u!=="none"){let c=u.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let f of c){let m=Promise.resolve().then(()=>gt(f,{...e,useProxy:r})).catch(()=>{});a.push(m)}}}if(n)try{let l=At(t),u=se(t);if(typeof H=="function"?H():!!H){let f=new Set(Array.from(l).map(m=>String(m).split("__")[0]).filter(Boolean));await kt(f,3)}await ie({required:l,usedCodepoints:u,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r,fontStylesheetDomains:e.fontStylesheetDomains})}catch{}await Promise.allSettled(a)}function Li(...t){return Qn(...t),N}var N=Object.assign(Pi,{plugins:Li}),Tr=Symbol("snapdom.internal"),Ti=Symbol("snapdom.internal.silent"),Lr=!1;async function Pi(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Sr(e);if(tr(n,e&&e.plugins),H()&&(n.embedFonts===!0||Ii(t))){if(n.embedFonts)try{let i=At(t),o=new Set([...i].map(s=>String(s).split("__")[0]).filter(Boolean));await kt(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await Ni(t,e)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&wn(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>N.toPng(r,i),toSvg:(r,i)=>N.toSvg(r,i)}),N.capture(t,n,Tr)}N.capture=async(t,e,n)=>{if(n!==Tr)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await Oe(t,e),i={img:async(p,y)=>{let{toImg:h}=await Promise.resolve().then(()=>(De(),Be));return h(r,{...p,...y||{}})},svg:async(p,y)=>{let{toSvg:h}=await Promise.resolve().then(()=>(De(),Be));return h(r,{...p,...y||{}})},canvas:async(p,y)=>{let{toCanvas:h}=await Promise.resolve().then(()=>(Ut(),Er));return h(r,{...p,...y||{}})},blob:async(p,y)=>{let{toBlob:h}=await Promise.resolve().then(()=>(ze(),Mr));return h(r,{...p,...y||{}})},png:async(p,y)=>{let{rasterize:h}=await Promise.resolve().then(()=>(Bt(),ue));return h(r,{...p,...y||{},format:"png"})},jpeg:async(p,y)=>{let{rasterize:h}=await Promise.resolve().then(()=>(Bt(),ue));return h(r,{...p,...y||{},format:"jpeg"})},webp:async(p,y)=>{let{rasterize:h}=await Promise.resolve().then(()=>(Bt(),ue));return h(r,{...p,...y||{},format:"webp"})},download:async(p,y)=>{let{download:h}=await Promise.resolve().then(()=>(Rr(),$r));return h(r,{...p,...y||{}})}},o={};for(let p of["img","svg","canvas","blob","png","jpeg","webp"])o[p]=async y=>i[p](e,{...y||{},[Ti]:!0});o.jpg=o.jpeg;let s={...e,export:{url:r},exports:o},a=await Zn("defineExports",s),l=Object.assign({},...a.filter(p=>p&&typeof p=="object").reverse()),u={...i,...l};u.jpeg&&!u.jpg&&(u.jpg=(p,y)=>u.jpeg(p,y));function c(p,y){let h={...e,...y||{}},b=w=>w==="jpeg"||w==="jpg"||w==="webp";return[p,h.format,h.type].map(w=>typeof w=="string"?w.toLowerCase():"").find(b)&&(h.backgroundColor==null||h.backgroundColor==="transparent")&&(h.backgroundColor="#ffffff"),h}let f=!1,m=Promise.resolve();async function d(p,y){let h=async()=>{let b=u[p];if(!b)throw new Error(`[snapdom] Unknown export type: ${p}`);let S=c(p,y),w={...e,export:{type:p,options:S,url:r}};await tt("beforeExport",w);let x=await b(w,S);return await tt("afterExport",w,x),f||(f=!0,await tt("afterSnap",e)),x};return m=m.then(h)}let g={url:r,toRaw:()=>r,to:(p,y)=>d(p,y),toImg:p=>d("img",p),toSvg:p=>d("svg",p),toCanvas:p=>d("canvas",p),toBlob:p=>d("blob",p),toPng:p=>d("png",p),toJpg:p=>d("jpg",p),toWebp:p=>d("webp",p),download:p=>d("download",p)};for(let p of Object.keys(u)){let y="to"+p.charAt(0).toUpperCase()+p.slice(1);g[y]||(g[y]=h=>d(p,h))}return g};N.toRaw=(t,e)=>N(t,e).then(n=>n.toRaw());N.toImg=(t,e)=>N(t,e).then(n=>n.toImg());N.toSvg=(t,e)=>N(t,e).then(n=>n.toSvg());N.toCanvas=(t,e)=>N(t,e).then(n=>n.toCanvas());N.toBlob=(t,e)=>N(t,e).then(n=>n.toBlob());N.toPng=(t,e)=>N(t,{...e,format:"png"}).then(n=>n.toPng());N.toJpg=(t,e)=>N(t,{...e,format:"jpeg"}).then(n=>n.toJpg());N.toWebp=(t,e)=>N(t,{...e,format:"webp"}).then(n=>n.toWebp());N.download=(t,e)=>N(t,e).then(n=>n.download());async function Ni(t,e){if(Lr)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Oe(t,n)}catch(i){R(e,"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(s){R(e,"safariWarmup img hints failed",s)}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(a){R(e,"safariWarmup img.decode failed",a)}let s=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-s<900;)await new Promise(a=>setTimeout(a,200));await new Promise(a=>requestAnimationFrame(a));try{let a=document.createElement("canvas");a.width=Math.max(1,o.naturalWidth||10),a.height=Math.max(1,o.naturalHeight||10);let l=a.getContext("2d");l&&l.drawImage(o,0,0)}catch{}await new Promise(a=>requestAnimationFrame(a));try{o.remove()}catch(a){R(e,"safariWarmup img.remove failed",a)}i()})()}),t.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){R(e,"safariWarmup canvas poke failed",o)}}),Lr=!0}function Ii(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.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}export{Ci as preCache,N as snapdom};
|
|
14
|
+
`):c+=d[0]}return c+=a.slice(f),c}let s=xn(t,e||location.href);return s=await r(s,e||location.href,0),s}var kn=/url\((["']?)([^"')]+)\1\)/g,Dr=/@font-face[^{}]*\{[^}]*\}/g;function En(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let i=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let r=i[1],s=i[2],a=l=>{if(!l.includes("?"))return parseInt(l,16);let u=parseInt(l.replace(/\?/g,"0"),16),c=parseInt(l.replace(/\?/g,"F"),16);return[u,c]};if(s){let l=a(r),u=a(s),c=Array.isArray(l)?l[0]:l,f=Array.isArray(u)?u[1]:u;e.push([Math.min(c,f),Math.max(c,f)])}else{let l=a(r);Array.isArray(l)?e.push([l[0],l[1]]):e.push([l,l])}}return e}function Mn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,i]of e)if(n>=o&&n<=i)return!0;return!1}function Re(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(kn)){let i=(o[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,e||location.href).href}catch{}n.push(i)}}return n}async function Fn(t,e,n=""){let o=t;for(let i of t.matchAll(kn)){let r=pt(i[0]);if(!r)continue;let s=r;if(!s.startsWith("http")&&!s.startsWith("data:"))try{s=new URL(s,e||location.href).href}catch{}if(!Z(s)){if(A.resource?.has(s)){A.font?.add(s),o=o.replace(i[0],`url(${A.resource.get(s)})`);continue}if(!A.font?.has(s))try{let a=await B(s,{as:"dataURL",useProxy:n,silent:!0});if(a.ok&&typeof a.data=="string"){let l=a.data;A.resource?.set(s,l),A.font?.add(s),o=o.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return o}function Hr(t){if(!t.length)return null;let e=(a,l)=>t.some(([u,c])=>!(c<a||u>l)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),i=e(880,1023),r=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":r?"cyrillic":i?"greek":o?"latin-ext":n?"latin":null}function Cn(t={}){let e=new Set((t.families||[]).map(i=>String(i).toLowerCase())),n=new Set((t.domains||[]).map(i=>String(i).toLowerCase())),o=new Set((t.subsets||[]).map(i=>String(i).toLowerCase()));return(i,r)=>{if(e.size&&e.has(i.family.toLowerCase()))return!0;if(n.size)for(let s of i.srcUrls)try{if(n.has(new URL(s).host.toLowerCase()))return!0}catch{}if(o.size){let s=Hr(r);if(s&&o.has(s))return!0}return!1}}function zr(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let r of t.match(e)||[]){let s=r.match(/font-family:\s*([^;]+);/i)?.[1]||"",a=$e(s),l=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),u=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),c=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),d=(r.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),m=Re(d,location.href),g=m.length?m.map(y=>String(y).toLowerCase()).sort().join("|"):d.toLowerCase(),p=[String(a||"").toLowerCase(),l,u,c,f.toLowerCase(),g].join("|");n.has(p)||(n.add(p),o.push(r))}if(o.length===0)return t;let i=0;return t.replace(e,()=>o[i++]||"")}function Vr(t,e,n,o,i){let r=Array.from(t||[]).sort().join("|"),s=e?JSON.stringify({families:(e.families||[]).map(c=>String(c).toLowerCase()).sort(),domains:(e.domains||[]).map(c=>String(c).toLowerCase()).sort(),subsets:(e.subsets||[]).map(c=>String(c).toLowerCase()).sort()}):"",a=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|"),l=o||"",u=(i||[]).map(c=>String(c).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${r}::ex=${s}::lf=${a}::px=${l}::fd=${u}`}async function $n(t,e,n,o){let i;try{i=t.cssRules||[]}catch{return}let r=(s,a)=>{try{return new URL(s,a||location.href).href}catch{return s}};for(let s of i){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let a=s.href?r(s.href,e):e;if(o.depth>=re){console.warn(`[snapDOM] CSSOM import depth exceeded (${re}) at ${a}`);continue}if(a&&o.visitedSheets.has(a)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${a}`);continue}a&&o.visitedSheets.add(a);let l={...o,depth:(o.depth||0)+1};await $n(s.styleSheet,a,n,l);continue}if(s.type===CSSRule.FONT_FACE_RULE){let a=(s.style.getPropertyValue("font-family")||"").trim(),l=$e(a);if(!l||Z(l))continue;let u=(s.style.getPropertyValue("font-weight")||"400").trim(),c=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),d=(s.style.getPropertyValue("src")||"").trim(),m=(s.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(l,c,u,f))continue;let g=En(m);if(!Mn(o.usedCodepoints,g))continue;let p={family:l,weightSpec:u,styleSpec:c,stretchSpec:f,unicodeRange:m,srcRaw:d,srcUrls:Re(d,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(p,g))continue;if(/url\(/i.test(d)){let y=await Fn(d,e||location.href,o.useProxy);await n(`@font-face{font-family:${l};src:${y};font-style:${c};font-weight:${u};font-stretch:${f};${m?`unicode-range:${m};`:""}}`)}else await n(`@font-face{font-family:${l};src:${d};font-style:${c};font-weight:${u};font-stretch:${f};${m?`unicode-range:${m};`:""}}`)}}}async function ie({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:i="",fontStylesheetDomains:r=[]}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let s=new Map;for(let h of t){let[b,S,w,x]=String(h).split("__");if(!b)continue;let v=b.toLowerCase(),C=s.get(v)||[];C.push({w:parseInt(S,10),s:w,st:parseInt(x,10)}),s.set(v,C)}function a(h,b,S,w){let x=String(h).toLowerCase();if(!s.has(x))return!1;let v=s.get(x),C=Nr(S),k=Ir(b),E=_r(w),P=C.min!==C.max,W=C.min,z=L=>k.kind==="normal"&&L==="normal"||k.kind!=="normal"&&(L==="italic"||L==="oblique"),Y=!1;for(let L of v){let I=P?L.w>=C.min&&L.w<=C.max:L.w===W,F=z(oe(L.s)),X=L.st>=E.min&&L.st<=E.max;if(I&&F&&X){Y=!0;break}}if(Y)return!0;if(!P)for(let L of v){let I=z(oe(L.s)),F=L.st>=E.min&&L.st<=E.max;if(Math.abs(W-L.w)<=300&&I&&F)return!0}if(!P&&k.kind==="normal"&&v.some(I=>oe(I.s)!=="normal"))for(let I of v){let F=Math.abs(W-I.w)<=300,X=I.st>=E.min&&I.st<=E.max;if(F&&X)return!0}return!1}let l=Cn(n),u=Vr(t,n,o,i,r);if(A.resource?.has(u))return A.resource.get(u);let c=Ur(t),f=[],d=Fe;for(let h of document.querySelectorAll("style")){let b=h.textContent||"";for(let S of b.matchAll(d)){let w=(S[2]||S[4]||"").trim();if(!w||Z(w))continue;!!document.querySelector(`link[rel="stylesheet"][href="${w}"]`)||f.push(w)}}let m=[];f.length&&await Promise.all(f.map(h=>new Promise(b=>{if(document.querySelector(`link[rel="stylesheet"][href="${h}"]`))return b(null);let S=document.createElement("link");S.rel="stylesheet",S.href=h,S.setAttribute("data-snapdom","injected-import"),S.onload=()=>b(S),S.onerror=()=>b(null),document.head.appendChild(S),m.push(S)})));let g="",p=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(h=>!!h.href);for(let h of m)try{h.remove()}catch{}for(let h of p)try{if(Z(h.href))continue;let b="",S=!1;try{S=new URL(h.href,location.href).origin===location.origin}catch{}if(!S){let x=Array.isArray(r)?r:[];if(!Or(h.href,c,x))continue}if(S){let x=Array.from(document.styleSheets).find(v=>v.href===h.href);if(x)try{let v=x.cssRules||[];b=Array.from(v).map(C=>C.cssText).join("")}catch{}}if(!b){let x=await B(h.href,{as:"text",useProxy:i});if(x?.ok&&typeof x.data=="string"&&(b=x.data),Z(h.href))continue}b=await Br(b,h.href,i);let w="";for(let x of b.match(Dr)||[]){let v=(x.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=$e(v);if(!C||Z(C))continue;let k=(x.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),E=(x.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),P=(x.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(x.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),z=(x.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),Y=Re(z,h.href);if(!a(C,E,k,P))continue;let L=En(W);if(!Mn(e,L))continue;let I={family:C,weightSpec:k,styleSpec:E,stretchSpec:P,unicodeRange:W,srcRaw:z,srcUrls:Y,href:h.href};if(n&&l(I,L))continue;let F=/url\(/i.test(z)?await Fn(x,h.href,i):x;w+=F}w.trim()&&(g+=w)}catch{console.warn("[snapDOM] Failed to process stylesheet:",h.href)}let y={requiredIndex:s,usedCodepoints:e,faceMatchesRequired:a,simpleExcluder:n?Cn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let h of document.styleSheets)if(!(h.href&&p.some(b=>b.href===h.href)))try{let b=h.href||location.origin+"/";b&&y.visitedSheets.add(b),await $n(h,b,async S=>{g+=S},y)}catch{}try{for(let h of document.fonts||[]){if(!h||!h.family||h.status!=="loaded"||!h._snapdomSrc)continue;let b=String(h.family).replace(/^['"]+|['"]+$/g,"");if(Z(b)||!s.has(b.toLowerCase())||n?.families&&n.families.some(w=>String(w).toLowerCase()===b.toLowerCase()))continue;let S=h._snapdomSrc;if(!String(S).startsWith("data:")){if(A.resource?.has(h._snapdomSrc))S=A.resource.get(h._snapdomSrc),A.font?.add(h._snapdomSrc);else if(!A.font?.has(h._snapdomSrc))try{let w=await B(h._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(w.ok&&typeof w.data=="string")S=w.data,A.resource?.set(h._snapdomSrc,S),A.font?.add(h._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",h._snapdomSrc);continue}}g+=`@font-face{font-family:'${b}';src:url(${S});font-style:${h.style||"normal"};font-weight:${h.weight||"normal"};}`}}catch{}for(let h of o){if(!h||typeof h!="object")continue;let b=String(h.family||"").replace(/^['"]+|['"]+$/g,"");if(!b||Z(b)||!s.has(b.toLowerCase())||n?.families&&n.families.some(k=>String(k).toLowerCase()===b.toLowerCase()))continue;let S=h.weight!=null?String(h.weight):"normal",w=h.style!=null?String(h.style):"normal",x=h.stretchPct!=null?`${h.stretchPct}%`:"100%",v=String(h.src||""),C=v;if(!C.startsWith("data:")){if(A.resource?.has(v))C=A.resource.get(v),A.font?.add(v);else if(!A.font?.has(v))try{let k=await B(v,{as:"dataURL",useProxy:i,silent:!0});if(k.ok&&typeof k.data=="string")C=k.data,A.resource?.set(v,C),A.font?.add(v);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",v);continue}}g+=`@font-face{font-family:'${b}';src:url(${C});font-style:${w};font-weight:${S};font-stretch:${x};}`}return g&&(g=zr(g),A.resource?.set(u,g)),g}function At(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=s=>{let a=Tr(s.fontFamily);if(a.length)for(let l of a){let u=(c,f,d)=>`${l}__${ne(c)}__${oe(f)}__${Pr(d)}`;e.add(u(s.fontWeight,s.fontStyle,s.fontStretch))}};o(getComputedStyle(t));let i=getComputedStyle(t,"::before");i&&i.content&&i.content!=="none"&&o(i);let r=getComputedStyle(t,"::after");for(r&&r.content&&r.content!=="none"&&o(r);n.nextNode();){let s=n.currentNode,a=getComputedStyle(s);o(a);let l=getComputedStyle(s,"::before");l&&l.content&&l.content!=="none"&&o(l);let u=getComputedStyle(s,"::after");u&&u.content&&u.content!=="none"&&o(u)}return e}function se(t){let e=new Set,n=i=>{if(i)for(let r of i)e.add(r.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let i=o.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let r=i;for(let s of["::before","::after"]){let l=getComputedStyle(r,s)?.getPropertyValue("content");if(!(!l||l==="none"))if(/^"/.test(l)||/^'/.test(l))n(l.slice(1,-1));else{let u=l.match(/\\[0-9A-Fa-f]{1,6}/g);if(u)for(let c of u)try{e.add(parseInt(c.slice(1),16))}catch{}}}}}return e}async function vt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{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 r of n){let s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${r}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",i.appendChild(s)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,e);i++)o(),await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)))}j();function Pn(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function Rn(t,e=!1){let n="",o=Math.max(1,t);for(;o>0;)o--,n=String.fromCharCode(97+o%26)+n,o=Math.floor(o/26);return e?n.toUpperCase():n}function Ln(t,e=!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"]],o=Math.max(1,Math.min(3999,t)),i="";for(let[r,s]of n)for(;o>=r;)i+=s,o-=r;return e?i:i.toLowerCase()}function Tn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(t);case"decimal-leading-zero":{let n=Math.abs(t);return(t<0?"-":"")+(n<10?"0":"")+String(n)}case"lower-alpha":return Rn(t,!1);case"upper-alpha":return Rn(t,!0);case"lower-roman":return Ln(t,!1);case"upper-roman":return Ln(t,!0);default:return String(t)}}function Nn(t){let e=()=>A?.session?.__counterEpoch??0,n=e(),o=new WeakMap,i=t instanceof Document?t.documentElement:t,r=d=>d&&d.tagName==="LI",s=d=>{let m=0,g=d?.parentElement;if(!g)return 0;for(let p of g.children){if(p===d)break;p.tagName==="LI"&&m++}return m},a=d=>{let m=new Map;for(let[g,p]of d)m.set(g,p.slice());return m},l=(d,m,g)=>{let p=a(d),y;try{y=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(y&&y!=="none")for(let S of y.split(",")){let w=S.trim().split(/\s+/),x=w[0],v=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!x)continue;let C=m.get(x);if(C&&C.length){let k=C.slice();k.push(v),p.set(x,k)}else p.set(x,[v])}let h;try{h=g.style?.counterSet||getComputedStyle(g).counterSet}catch{}if(h&&h!=="none")for(let S of h.split(",")){let w=S.trim().split(/\s+/),x=w[0],v=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!x)continue;let C=p.get(x)||[];C.length===0&&C.push(0),C[C.length-1]=v,p.set(x,C)}let b;try{b=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(b&&b!=="none")for(let S of b.split(",")){let w=S.trim().split(/\s+/),x=w[0],v=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!x)continue;let C=p.get(x)||[];C.length===0&&C.push(0),C[C.length-1]+=v,p.set(x,C)}try{if(getComputedStyle(g).display==="list-item"&&r(g)){let w=g.parentElement,x=1;if(w&&w.tagName==="OL"){let C=w.getAttribute("start"),k=Number.isFinite(Number(C))?Number(C):1,E=s(g),P=g.getAttribute("value");x=Number.isFinite(Number(P))?Number(P):k+E}else x=1+s(g);let v=p.get("list-item")||[];v.length===0&&v.push(0),v[v.length-1]=x,p.set("list-item",v)}}catch{}return p},u=(d,m,g)=>{let p=l(g,m,d);o.set(d,p);let y=p;for(let b of d.children)y=u(b,p,y);let h=new Map;for(let[b,S]of g){let w=S.length,x=y.get(b);h.set(b,x&&x.length?x.slice(0,w):S.slice())}for(let[b,S]of y)!h.has(b)&&S.length&&!m.has(b)&&h.set(b,S.slice(0,1));return h},c=new Map;u(i,c,c);function f(){let d=e();if(d!==n){n=d;let m=new Map;u(i,m,m)}}return{get(d,m){f();let g=o.get(d)?.get(m);return g&&g.length?g[g.length-1]:0},getStack(d,m){f();let g=o.get(d)?.get(m);return g?g.slice():[]}}}function In(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g;return t.replace(o,(i,r,s)=>{let a=String(s).split(",").map(l=>l.trim());if(r==="counter"){let l=a[0]?.replace(/^["']|["']$/g,""),u=(a[1]||"decimal").toLowerCase(),c=n.get(e,l);return Tn(c,u)}else{let l=a[0]?.replace(/^["']|["']$/g,""),u=a[1]?.replace(/^["']|["']$/g,"")??"",c=(a[2]||"decimal").toLowerCase(),f=n.getStack(e,l);return f.length?f.map(m=>Tn(m,c)).join(u):""}})}catch{return"- "}}ht();j();var kt=new WeakMap,_n=1e3;function qr(t,e){let n=Dn(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=On(t,n),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):On(t,n)}function Le(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Dn(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,o=0;for(let r=0;r<e.length;r++){let s=e[r];if(s.tagName==="STYLE"){let a=s.textContent?s.textContent.length:0;n+=`S${a}|`;let l=s.sheet,u=l?Le(l):null;u&&(o+=u.length)}else{let a=s.getAttribute("href")||"",l=s.getAttribute("media")||"all";n+=`L${a}|m:${l}|`;let u=s.sheet,c=u?Le(u):null;c&&(o+=c.length)}}let i=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${o}`,n}function Wn(t,e,n){let o=Le(t);if(!o)return!1;for(let i=0;i<o.length;i++){if(n.budget<=0)return!1;let r=o[i],s=r&&r.cssText?r.cssText:"";n.budget--;for(let a of e)if(s.includes(a))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let a=0;a<r.cssRules.length&&n.budget>0;a++){let l=r.cssRules[a],u=l&&l.cssText?l.cssText:"";n.budget--;for(let c of e)if(u.includes(c))return!0}if(n.budget<=0)return!1}return!1}function On(t=document,e=Dn(t)){let n=kt.get(t);if(n&&n.fingerprint===e)return n.result;let o=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=t.querySelectorAll("style");for(let s=0;s<i.length;s++){let a=i[s].textContent||"";for(let l of o)if(a.includes(l))return kt.set(t,{fingerprint:e,result:!0}),!0}let r=t.adoptedStyleSheets;if(Array.isArray(r)&&r.length){let s={budget:_n};try{for(let a of r)if(Wn(a,o,s))return kt.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let s=t.querySelectorAll('style,link[rel~="stylesheet"]'),a={budget:_n};for(let l=0;l<s.length&&a.budget>0;l++){let u=s[l],c=null;if(u.tagName,c=u.sheet||null,c&&Wn(c,o,a))return kt.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(kt.set(t,{fingerprint:e,result:!0}),!0):(kt.set(t,{fingerprint:e,result:!1}),!1)}var Et=new WeakMap;function Un(t){for(let e of["Top","Right","Bottom","Left"]){let n=parseFloat(t[`border${e}Width`])||0,o=t[`border${e}Style`];if(n>0&&o&&o!=="none"&&o!=="hidden")return!0}return!1}var Bn=-1;function jr(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o=0,i;for(;i=n.exec(t);){let s=t.slice(o,i.index).trim();s&&e.push(s),e.push(i[1]),o=n.lastIndex}let r=t.slice(o).trim();return r&&e.push(r),e.join("")}function Te(t,e){let n=t.parentElement,o=n?Et.get(n):null;return o?{get(i,r){let s=e.get(i,r),a=o.get(r);return typeof a=="number"?Math.max(s,a):s},getStack(i,r){let s=e.getStack(i,r);if(!s.length)return s;let a=o.get(r);if(typeof a=="number"){let l=s.slice();return l[l.length-1]=Math.max(l[l.length-1],a),l}return s}}:e}function Pe(t,e,n){let o=new Map;function i(u){let c=[];if(!u||u==="none")return c;for(let f of String(u).split(",")){let d=f.trim().split(/\s+/),m=d[0],g=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;m&&c.push({name:m,num:g})}return c}let r=i(e?.counterReset),s=i(e?.counterSet),a=i(e?.counterIncrement);function l(u){if(o.has(u))return o.get(u).slice();let c=n.getStack(t,u);c=c.length?c.slice():[];let f=r.find(g=>g.name===u);if(f){let g=Number.isFinite(f.num)?f.num:0;c=c.length?[...c,g]:[g]}let d=s.find(g=>g.name===u);if(d){let g=Number.isFinite(d.num)?d.num:0;c.length===0&&(c=[0]),c[c.length-1]=g}let m=a.find(g=>g.name===u);if(m){let g=Number.isFinite(m.num)?m.num:1;c.length===0&&(c=[0]),c[c.length-1]+=g}return o.set(u,c.slice()),c}return{get(u,c){let f=l(c);return f.length?f[f.length-1]:0},getStack(u,c){return l(c)},__incs:a}}function Xr(t,e,n){let o;try{o=_(t,e)}catch{}let i=o?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let r=Te(t,n),s=Pe(t,o,r),a=Pn(i)?In(i,t,s):i;return{text:jr(a),incs:s.__incs||[]}}async function ae(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let i=t.ownerDocument||document;if(!qr(i,n))return;let r=A?.session?.__counterEpoch??0;if(Bn!==r&&(Et=new WeakMap,n&&(n.__counterCtx=null),Bn=r),!n.__counterCtx)try{n.__counterCtx=Nn(t.ownerDocument||document)}catch(l){R(n,"buildCounterContext failed",l)}let s=n.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let u=_(t,l);if(!u||u.content==="none"&&u.backgroundImage==="none"&&u.backgroundColor==="transparent"&&!Un(u)&&(!u.transform||u.transform==="none")&&u.display==="inline")continue;if(l==="::first-letter"){let $=_(t),T=($?.display||"").toLowerCase();if(T.includes("flex")||T.includes("grid")||!(u.color!==$.color||u.fontSize!==$.fontSize||u.fontWeight!==$.fontWeight||u.fontFamily!==$.fontFamily||u.fontStyle!==$.fontStyle||u.textTransform!==$.textTransform||u.float!==$.float||u.paddingTop!==$.paddingTop||u.paddingRight!==$.paddingRight||u.paddingBottom!==$.paddingBottom||u.paddingLeft!==$.paddingLeft||u.marginTop!==$.marginTop||u.marginRight!==$.marginRight||u.marginBottom!==$.marginBottom||u.marginLeft!==$.marginLeft))continue;let U=Array.from(e.childNodes).find(Vt=>Vt.nodeType===Node.TEXT_NODE&&Vt.textContent?.trim().length>0);if(!U)continue;let K=U.textContent,et=K.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Ht=K.slice(et?.length||0);if(!et||/[\uD800-\uDFFF]/.test(et))continue;let mt=document.createElement("span");mt.textContent=et,mt.dataset.snapdomPseudo="::first-letter";let fe=Qt(u),de=wt(fe,"span");n.styleMap.set(mt,de);let zt=document.createTextNode(Ht);e.replaceChild(zt,U),e.insertBefore(mt,zt);continue}let f=u.content??"",d=f===""||f==="none"||f==="normal",{text:m,incs:g}=Xr(t,l,s),p=u.backgroundImage,y=u.backgroundColor,h=u.fontFamily,b=parseInt(u.fontSize)||32,S=parseInt(u.fontWeight)||!1,w=u.color||"#000",x=u.transform,v=Z(h),C=!d&&m!=="",k=p&&p!=="none",E=y&&y!=="transparent"&&y!=="rgba(0, 0, 0, 0)",P=Un(u),W=x&&x!=="none",Y=f!=="none"&&f!=="normal"&&((parseFloat(u.width)||0)>0||(parseFloat(u.height)||0)>0);if(!(C||k||E||P||W||Y)){if(g&&g.length&&t.parentElement){let $=Et.get(t.parentElement)||new Map;for(let{name:T}of g){if(!T)continue;let O=Te(t,s),K=Pe(t,_(t,l),O).get(t,T);$.set(T,K)}Et.set(t.parentElement,$)}continue}let I=!1;if(C&&!v&&m.length>1&&!m.startsWith("url(")){let $=_(t),T=parseFloat($.fontSize)||16,O=parseFloat($.lineHeight);Number.isFinite(O)||(O=T*1.5),t.getBoundingClientRect().height<O*1.6&&(e.style.whiteSpace="nowrap",I=!0)}let F=document.createElement("span");F.dataset.snapdomPseudo=l,F.style.pointerEvents="none",I&&(F.style.whiteSpace="nowrap");let X=Qt(u),Dt=wt(X,"span");if(n.styleMap.set(F,Dt),v&&m&&m.length===1){let{dataUrl:$,width:T,height:O}=await An(m,h,S,b,w),U=document.createElement("img");U.src=$,U.style=`height:${b}px;width:${T/O*b}px;object-fit:contain;`,F.appendChild(U),e.dataset.snapdomHasIcon="true"}else if(m&&m.startsWith("url(")){let $=pt(m);if($?.trim())try{let T=await B(ft($),{as:"dataURL",useProxy:o.useProxy});if(T?.ok&&typeof T.data=="string"){let O=document.createElement("img");O.src=T.data,O.style=`width:${b}px;height:auto;object-fit:contain;`,F.appendChild(O)}}catch(T){console.error(`[snapdom] Error in pseudo ${l} for`,t,T)}}else!v&&C&&(F.textContent=m);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=u.backgroundRepeat,F.style.backgroundSize=u.backgroundSize,u.backgroundPositionX&&u.backgroundPositionY?(F.style.backgroundPositionX=u.backgroundPositionX,F.style.backgroundPositionY=u.backgroundPositionY):F.style.backgroundPosition=u.backgroundPosition,F.style.backgroundOrigin=u.backgroundOrigin,F.style.backgroundClip=u.backgroundClip,F.style.backgroundAttachment=u.backgroundAttachment,F.style.backgroundBlendMode=u.backgroundBlendMode}catch{}if(k)try{let $=St(p),T=await Promise.all($.map(gt));F.style.backgroundImage=T.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${l}`,$)}E&&(F.style.backgroundColor=y);let at=F.childNodes.length>0||F.textContent?.trim()!==""||k||E||P||W||Y;if(g&&g.length&&t.parentElement){let $=Et.get(t.parentElement)||new Map,T=Te(t,s),O=Pe(t,_(t,l),T);for(let{name:U}of g){if(!U)continue;let K=O.get(t,U);$.set(U,K)}Et.set(t.parentElement,$)}if(!at)continue;l==="::before"?(e.dataset.snapdomHasBefore="1",e.insertBefore(F,e.firstChild)):(e.dataset.snapdomHasAfter="1",e.appendChild(F))}catch(u){console.warn(`[snapdom] Failed to capture ${l} for`,t,u)}let a=Array.from(e.children).filter(l=>!l.dataset.snapdomPseudo);if(n.nodeMap)for(let l of a){let u=n.nodeMap.get(l);u instanceof Element&&await ae(u,l,n,o)}else{let l=Array.from(t.children);for(let u=0;u<Math.min(l.length,a.length);u++)await ae(l[u],a[u],n,o)}}function Hn(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,i=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(i.length===0)return;let r=/url\(\s*#([^)]+)\)/g,s=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],a=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",u=w=>{if(!w||!w.getAttribute)return null;let x=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(l,"href"):null);if(x)return x;let v=w.attributes;if(!v)return null;for(let C=0;C<v.length;C++){let k=v[C];if(!k||!k.name)continue;if(k.name==="href")return k.value;let E=k.name.indexOf(":");if(E!==-1&&k.name.slice(E+1)==="href")return k.value}return null},c=new Set(Array.from(t.querySelectorAll("[id]")).map(w=>w.id)),f=new Set,d=!1,m=(w,x=null)=>{if(!w)return;r.lastIndex=0;let v;for(;v=r.exec(w);){d=!0;let C=(v[1]||"").trim();C&&(c.has(C)||(f.add(C),x&&!x.has(C)&&x.add(C)))}},g=w=>{let x=w.querySelectorAll("use");for(let k of x){let E=u(k);if(!E||!E.startsWith("#"))continue;d=!0;let P=E.slice(1).trim();P&&!c.has(P)&&f.add(P)}let C=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let k of C){m(k.getAttribute("style")||"");for(let E of s)m(k.getAttribute(E))}};for(let w of i)g(w);if(!d)return;let p=t.querySelector("svg.inline-defs-container");p||(p=n.createElementNS("http://www.w3.org/2000/svg","svg"),p.classList.add("inline-defs-container"),p.setAttribute("aria-hidden","true"),p.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(p,t.firstChild||null));let y=p.querySelector("defs")||null,h=w=>{if(!w||c.has(w))return null;let x=a(w),v=C=>{let k=o.querySelector(C);return k&&!t.contains(k)?k:null};return v(`svg defs > *#${x}`)||v(`svg > symbol#${x}`)||v(`*#${x}`)};if(!f.size)return;let b=new Set(f),S=new Set;for(;b.size;){let w=b.values().next().value;if(b.delete(w),!w||c.has(w)||S.has(w))continue;let x=h(w);if(!x){S.add(w);continue}y||(y=n.createElementNS("http://www.w3.org/2000/svg","defs"),p.appendChild(y));let v=x.cloneNode(!0);v.id||v.setAttribute("id",w),y.appendChild(v),S.add(w),c.add(w);let C=[v,...v.querySelectorAll("*")];for(let k of C){let E=u(k);if(E&&E.startsWith("#")){let W=E.slice(1).trim();W&&!c.has(W)&&!S.has(W)&&b.add(W)}let P=k.getAttribute?.("style")||"";P&&m(P,b);for(let W of s){let z=k.getAttribute?.(W);z&&m(z,b)}}}}j();function Vn(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let o=t.getBoundingClientRect(),i=t.clientHeight,r="data-snap-ph",s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let a=s.currentNode,l=getComputedStyle(a),u=l.position;if(u!=="sticky"&&u!=="-webkit-sticky")continue;let c=zn(l.top),f=zn(l.bottom);if(c==null&&f==null)continue;let d=Gr(a,t),m=Yr(e,d,r);if(!m)continue;let g=a.getBoundingClientRect(),p=g.width,y=g.height,h=g.left-o.left;if(!(p>0&&y>0)||!Number.isFinite(h))continue;let b=c!=null?c+n:n+(i-y-f);if(!Number.isFinite(b))continue;let S=Number.parseInt(l.zIndex,10),w=Number.isFinite(S),x=w?Math.max(S,1)+1:2,v=w?S-1:0,C=m.cloneNode(!1);C.setAttribute(r,"1"),C.style.position="sticky",C.style.left=`${h}px`,C.style.top=`${b}px`,C.style.width=`${p}px`,C.style.height=`${y}px`,C.style.visibility="hidden",C.style.zIndex=String(v),C.style.overflow="hidden",C.style.background="transparent",C.style.boxShadow="none",C.style.filter="none",m.parentElement?.insertBefore(C,m),m.style.position="absolute",m.style.left=`${h}px`,m.style.top=`${b}px`,m.style.bottom="auto",m.style.zIndex=String(x),m.style.pointerEvents="none"}}function zn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Gr(t,e){let n=[];for(let o=t;o&&o!==e;){let i=o.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,o)),o=i}return n.reverse()}function Yr(t,e,n){let o=t;for(let i=0;i<e.length;i++)if(o=Kr(o,n)[e[i]],!o)return null;return o instanceof HTMLElement?o:null}function Kr(t,e){let n=[],o=t.children;for(let i=0;i<o.length;i++){let r=o[i];r.hasAttribute(e)||n.push(r)}return n}function qn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,i=e.borderStyle,r=e.borderWidth,s=n!=="none"&&parseFloat(o)>0,a=i==="none"||parseFloat(r)===0;s&&a&&(t.style.border=`${o} solid transparent`)}function jn(t){let e=[];try{let n=t.querySelectorAll("*");for(let o of n){if(!(o instanceof HTMLElement))continue;let i=o.style.contentVisibility||"",r=getComputedStyle(o),s=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(s==="auto"||s==="hidden")&&(e.push({el:o,original:i}),o.style.contentVisibility="visible")}if(t instanceof HTMLElement){let o=getComputedStyle(t),i=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(e.push({el:t,original:t.style.contentVisibility||""}),t.style.contentVisibility="visible")}}catch{}return()=>{for(let{el:n,original:o}of e)try{n.style.contentVisibility=o}catch{}}}async function Xn(t,e={}){let n={styleMap:A.session.styleMap,styleCache:A.session.styleCache,nodeMap:A.session.nodeMap,options:e},o,i="",r="";qn(t);let s=jn(t);try{o=await Wt(t,n,e)}catch(c){throw console.warn("deepClone failed:",c),c}finally{s()}try{Hn(o)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{await ae(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await yn(o,n);try{let c=o.querySelectorAll("style[data-sd]");for(let f of c)r+=f.textContent||"",f.remove()}catch(c){R(n,"Failed to extract shadow CSS from style[data-sd]",c)}let a=Ce(n.styleMap);i=Array.from(a.entries()).map(([c,f])=>`.${f}{${c}}`).join(""),i=r+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[c,f]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",f.replace(/;/g,"; "));continue}let d=a.get(f);d&&c.classList.add(d);let m=c.style?.backgroundImage,g=c.dataset?.snapdomHasIcon;m&&m!=="none"&&(c.style.backgroundImage=m),g&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,f]of n.nodeMap.entries()){let d=f.scrollLeft,m=f.scrollTop;if((d||m)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";try{let y=c.querySelectorAll("*");for(let h of y){if(!(h instanceof HTMLElement))continue;let b=h.style.position;if(b==="fixed"||b==="absolute"){let S=parseFloat(h.style.top)||0,w=parseFloat(h.style.left)||0;h.style.top=`${S+m}px`,h.style.left=`${w+d}px`,b==="fixed"&&(h.style.position="absolute")}}}catch{}let p=document.createElement("div");for(p.style.all="unset",p.style.transform=`translate(${-d}px, ${-m}px)`,p.style.willChange="transform",p.style.display="inline-block",p.style.width="100%";c.firstChild;)p.appendChild(c.firstChild);c.appendChild(p)}}let u=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(Vn(t,u),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||_(t);n.styleCache.set(t,c);let f=he(c.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=f||""}for(let[c,f]of n.nodeMap.entries())f.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:o,classCSS:i,styleCache:n.styleCache}}ht();var Gn="http://www.w3.org/1999/xlink";function Qr(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(Gn,"href"):null)}function Jr(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,o=parseInt(t.getAttribute("width")||"",10)||0,i=parseInt(t.getAttribute("height")||"",10)||0,r=parseFloat(t.style?.width||"")||0,s=parseFloat(t.style?.height||"")||0,a=e||r||o||t.width||t.naturalWidth||100,l=n||s||i||t.height||t.naturalHeight||100;return{width:a,height:l}}async function Yn(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async a=>{if(!a.getAttribute("src")){let m=a.currentSrc||a.src||"";m&&a.setAttribute("src",m)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let l=a.src||"";if(!l)return;let u=await B(l,{as:"dataURL",useProxy:e.useProxy});if(u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")){a.src=u.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:c,height:f}=Jr(a),{fallbackURL:d}=e||{};if(d)try{let m=typeof d=="function"?await d({width:c,height:f,src:l,element:a}):d;if(m){let g=await B(m,{as:"dataURL",useProxy:e.useProxy});if(g?.ok&&typeof g.data=="string"){a.src=g.data,a.width||(a.width=c),a.height||(a.height=f);return}}}catch{}if(e.placeholders!==!1){let m=document.createElement("div");m.style.cssText=[`width:${c}px`,`height:${f}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${f}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),m.textContent="img",a.replaceWith(m)}else{let m=document.createElement("div");m.style.cssText=`display:inline-block;width:${c}px;height:${f}px;visibility:hidden;`,a.replaceWith(m)}},i=6;for(let a=0;a<n.length;a+=i){let l=n.slice(a,a+i).map(o);await Promise.allSettled(l)}let r=Array.from(t.querySelectorAll("image")),s=async a=>{let l=Qr(a);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let u=await B(l,{as:"dataURL",useProxy:e.useProxy});u.ok&&typeof u.data=="string"&&u.data.startsWith("data:")&&(a.setAttribute("href",u.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Gn,"href"))};for(let a=0;a<r.length;a+=i){let l=r.slice(a,a+i).map(s);await Promise.allSettled(l)}}J();async function ce(t,e,n,o={}){let i=[[t,e]],r=["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"],s=["mask-position","mask-size","mask-repeat","mask-mode","mask-composite","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","-webkit-mask-composite","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],a=["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[u,c]=i.shift();if(!c)continue;let f=n.get(u)||_(u);n.has(u)||n.set(u,f);let d=(()=>{let b=f.getPropertyValue("border-image"),S=f.getPropertyValue("border-image-source");return b&&b!=="none"||S&&S!=="none"})(),m=f.getPropertyValue("background-image"),g=f.getPropertyValue("background-color");if(m&&m!=="none"||g&&g!=="rgba(0, 0, 0, 0)"&&g!=="transparent"||/url\s*\(|gradient\s*\(/i.test(f.getPropertyValue("background")||""))for(let b of a){let S=f.getPropertyValue(b);S&&c.style.setProperty(b,S)}for(let b of r){let S=f.getPropertyValue(b);if(b==="background-image"&&(!S||S==="none")){let v=f.getPropertyValue("background");v&&/url\s*\(/.test(v)&&(S=St(v).filter(C=>/url\s*\(/.test(C)).join(", ")||S)}if(!S||S==="none")continue;let w=St(S),x=await Promise.all(w.map(v=>gt(v,o)));x.some(v=>v&&v!=="none"&&!/^url\(undefined/.test(v))&&c.style.setProperty(b,x.join(", "))}for(let b of s){let S=f.getPropertyValue(b);!S||S==="initial"||c.style.setProperty(b,S)}if(d)for(let b of l){let S=f.getPropertyValue(b);!S||S==="initial"||c.style.setProperty(b,S)}let y=u.shadowRoot?Array.from(u.shadowRoot.children).filter(b=>b.tagName!=="STYLE"):Array.from(u.children),h=Array.from(c.children).filter(b=>!(b.dataset?.snapdomPseudo||b.tagName==="STYLE"&&b.dataset?.sd));for(let b=0;b<Math.min(y.length,h.length);b++)i.push([y[b],h[b]])}}J();j();function Kn(t){if(!t)return()=>{};let e=[];function n(o){let i=Zr(o);i&&e.push(i);for(let r of o.children||[])n(r)}return n(t),()=>e.forEach(o=>o())}function Zr(t){if(!t)return()=>{};let e=ti(t);if(e<=0)return()=>{};if(!oi(t))return()=>{};let n=getComputedStyle(t),o=Math.round(ei(n)*e+ni(n)),i=t.textContent??"",r=i;if(t.scrollHeight<=o+.5)return()=>{};let s=0,a=i.length,l=-1;for(;s<=a;){let u=s+a>>1;t.textContent=i.slice(0,u)+"\u2026",t.scrollHeight<=o+.5?(l=u,s=u+1):a=u-1}return t.textContent=(l>=0?i.slice(0,l):"")+"\u2026",()=>{t.textContent=r}}function ti(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let o=parseInt(n,10);return Number.isFinite(o)&&o>0?o:0}function ei(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function ni(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function oi(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Ot=[];function le(t){if(!t)return null;if(Array.isArray(t)){let[e,n]=t;return typeof e=="function"?e(n):e}if(typeof t=="object"&&"plugin"in t){let{plugin:e,options:n}=t;return typeof e=="function"?e(n):e}return typeof t=="function"?t():t}function Qn(...t){let e=t.flat();for(let n of e){let o=le(n);o&&(Ot.some(i=>i&&i.name&&o.name&&i.name===o.name)||Ot.push(o))}}function Jn(t){return t&&Array.isArray(t.plugins)?t.plugins:Ot}async function tt(t,e,n){let o=n,i=Jn(e);for(let r of i){let s=r&&typeof r[t]=="function"?r[t]:null;if(!s)continue;let a=await s(e,o);typeof a<"u"&&(o=a)}return o}async function Zn(t,e,n){let o=[],i=Jn(e);for(let r of i){let s=r&&typeof r[t]=="function"?r[t]:null;if(!s)continue;let a=await s(e,n);typeof a<"u"&&o.push(a)}return o}function ri(t){let e=[];if(Array.isArray(t))for(let n of t){let o=le(n);if(!o||!o.name)continue;let i=e.findIndex(r=>r&&r.name===o.name);i>=0&&e.splice(i,1),e.push(o)}for(let n of Ot)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function to(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=ri(e)),t}function eo(){return Ot.slice()}function yt(t){return!!(!t||t.startsWith("data:")||t.startsWith("blob:")||/^data:image\/(gif|png|svg)/.test(t)&&t.length<200)}function ii(t,e){return!t||!(t instanceof Element)?!1:t.querySelector("picture")?!0:e?!!t.querySelector("img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]"):!1}function si(t,e){let n=t.currentSrc||"";if(n&&!yt(n))return n;let o=e.querySelectorAll("source[srcset]"),i=null;for(let r of o){let s=r.getAttribute("srcset");if(!s||yt(s))continue;let a=r.getAttribute("media");if(a)try{if(window.matchMedia(a).matches)return s.split(",")[0].trim().split(/\s+/)[0]}catch{}i||(i=s.split(",")[0].trim().split(/\s+/)[0])}return i}function ai(t){let e=[t.getAttribute("data-src"),t.getAttribute("data-lazy-src"),t.getAttribute("data-original"),t.getAttribute("data-hi-res-src")];for(let o of e)if(o&&!yt(o))return o;let n=t.getAttribute("data-srcset")||t.getAttribute("data-lazy-srcset");if(n){let o=n.split(",")[0].trim().split(/\s+/)[0];if(o&&!yt(o))return o}return null}function ci(t={}){let e=t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{};return{timeout:e.timeout??5e3,concurrency:e.concurrency??4,resolveLazySrc:e.resolveLazySrc!==!1,silent:e.silent??!1,useProxy:typeof t.useProxy=="string"?t.useProxy:""}}async function no(t,e={}){if(!t||!(t instanceof Element)||e.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:o,resolveLazySrc:i,silent:r,useProxy:s}=ci(e);if(!ii(t,i))return null;let a=[],l=[];async function u(d){let m=new AbortController,g=setTimeout(()=>m.abort(),n);try{let p=await fetch(d,{credentials:"include",signal:m.signal});if(!p.ok&&s){let h=s.includes("{url}")?s.replace("{url}",encodeURIComponent(d)):s.endsWith("?")?`${s}${encodeURIComponent(d)}`:`${s}${s.includes("?")?"&":"?"}url=${encodeURIComponent(d)}`;p=await fetch(h,{signal:m.signal})}if(!p.ok)return null;let y=await p.blob();return await new Promise((h,b)=>{let S=new FileReader;S.onload=()=>h(S.result),S.onerror=b,S.readAsDataURL(y)})}catch{return null}finally{clearTimeout(g)}}async function c(d){for(let m=0;m<d.length;m+=o){let g=d.slice(m,m+o);await Promise.allSettled(g.map(p=>p()))}}let f=t.querySelectorAll("picture");for(let d of f){let m=d.querySelector("img");if(!m)continue;let g=m.getAttribute("src")||"";if(!yt(g))continue;let p=si(m,d);p&&l.push(async()=>{let y=await u(p);if(!y){r||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${p.slice(0,60)}`);return}let h=m.getAttribute("src"),b=m.getAttribute("srcset"),S=m.getAttribute("sizes"),w=[];m.src=y,m.setAttribute("src",y),m.removeAttribute("srcset"),m.removeAttribute("sizes");let x=d.querySelectorAll("source");for(let v of x)w.push({el:v,parent:v.parentElement,next:v.nextSibling}),v.remove();a.push(()=>{h!==null?m.setAttribute("src",h):m.removeAttribute("src"),b!==null&&m.setAttribute("srcset",b),S!==null&&m.setAttribute("sizes",S);for(let{el:v,parent:C,next:k}of w)C&&C.insertBefore(v,k)})})}if(i){let d=t.querySelectorAll("img");for(let m of d){if(m.closest("picture")&&yt(m.getAttribute("src")||""))continue;let g=m.getAttribute("src")||"",p=ai(m);p&&yt(g)&&l.push(async()=>{let y=await u(p);if(!y)return;let h=m.getAttribute("src");m.src=y,m.setAttribute("src",y),m.removeAttribute("srcset"),m.removeAttribute("sizes"),a.push(()=>{h!==null?m.setAttribute("src",h):m.removeAttribute("src")})})}}return l.length===0?null:(await c(l),async function(){for(let m of a)try{m()}catch{}})}J();function io(t,e,n={}){if(!t||!e||!e.style)return;let o=getComputedStyle(t);try{e.style.boxShadow="none"}catch(s){R(n,"stripRootShadows boxShadow",s)}try{e.style.textShadow="none"}catch(s){R(n,"stripRootShadows textShadow",s)}try{e.style.outline="none"}catch(s){R(n,"stripRootShadows outline",s)}let r=(o.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=r.length?r:"none"}catch(s){R(n,"stripRootShadows filter",s)}}function oo(t){let e=t.display||"";if(e.includes("flex")||e.includes("grid")||e.startsWith("table")||e==="inline-block"||e==="flow-root"||t.position==="absolute"||t.position==="fixed"||t.float&&t.float!=="none")return!0;let n=t.overflowX||t.overflow||"visible",o=t.overflowY||t.overflow||"visible";return!!(n!=="visible"||o!=="visible"||t.contain&&/\b(layout|content|paint|strict)\b/.test(t.contain))}function li(t,e){let n=Array.from(t.childNodes),o=e==="top"?n:n.reverse();for(let i of o){if(i.nodeType===Node.TEXT_NODE){if(/\S/.test(i.textContent||""))return null;continue}if(i.nodeType!==Node.ELEMENT_NODE)continue;let r=getComputedStyle(i),s=String(r.display||"");if(!(s==="none"||s==="contents")&&!(r.position==="absolute"||r.position==="fixed"))return r.float&&r.float!=="none"||s.startsWith("inline")?null:i}return null}function so(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);if(!oo(n))for(let o of["top","bottom"]){let i=o==="top"?"Top":"Bottom";if((parseFloat(n[`border${i}Width`])||0)>0||(parseFloat(n[`padding${i}`])||0)>0)continue;let r=t,s=e;for(;r&&s;){let a=li(r,o);if(!a)break;let l=Array.from(r.children).indexOf(a),u=l>=0?s.children[l]:null,c=getComputedStyle(a),f=parseFloat(c[`margin${i}`])||0;if(u&&u.style&&f>0&&(u.style[`margin${i}`]="0px"),oo(c)||(parseFloat(c[`border${i}Width`])||0)>0||(parseFloat(c[`padding${i}`])||0)>0)break;r=a,s=u}}}function ui(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let o of n)o.remove()}function fi(t,e={}){let{stripFrameworkDirectives:n=!0}=e,o=new Set(["xml","xlink"]),i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let r=i.currentNode;for(let s of Array.from(r.attributes)){let a=s.name;if(a.includes("@")){r.removeAttribute(a);continue}if(a.includes(":")){let l=a.split(":",1)[0];if(!o.has(l)){r.removeAttribute(a);continue}}if(n&&(a.startsWith("x-")||a.startsWith("v-")||a.startsWith(":")||a.startsWith("on:")||a.startsWith("bind:")||a.startsWith("let:")||a.startsWith("class:"))){r.removeAttribute(a);continue}}}}var ro=/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g;function di(t){if(!t)return;let e=i=>{if(i.nodeType===Node.ELEMENT_NODE){if(i.attributes)for(let r of Array.from(i.attributes)){let s=r.value.replace(ro,"");if(s!==r.value)try{i.setAttribute(r.name,s)}catch{}}}else if(i.nodeType===Node.TEXT_NODE||i.nodeType===Node.CDATA_SECTION_NODE){let r=i.data.replace(ro,"");r!==i.data&&(i.data=r)}};e(t);let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT),o;for(;o=n.nextNode();)e(o)}function ao(t,e={}){t&&(fi(t,e),ui(t),di(t))}function mi(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function pi(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function hi(t,e){if(!(t instanceof Element)||mi(t)||pi(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let o=e.display||"";return!(o.includes("flex")||o.includes("grid")||o.startsWith("table")||e.transform&&e.transform!=="none")}function co(t,e,n=new Map){function o(i,r){if(!(i instanceof Element)||!(r instanceof Element))return;let s=i.childElementCount>r.childElementCount,a=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,a),s&&hi(i,a)){r.style.height||(r.style.height="auto"),r.style.width||(r.style.width="auto"),r.style.removeProperty("block-size"),r.style.removeProperty("inline-size"),r.style.minHeight||(r.style.minHeight="0"),r.style.minWidth||(r.style.minWidth="0"),r.style.maxHeight||(r.style.maxHeight="none"),r.style.maxWidth||(r.style.maxWidth="none");let c=a.overflowY||a.overflowBlock||"visible",f=a.overflowX||a.overflowInline||"visible";(c!=="visible"||f!=="visible")&&(r.style.overflow="visible")}let l=Array.from(i.children),u=Array.from(r.children);for(let c=0;c<Math.min(l.length,u.length);c++)o(l[c],u[c])}o(t,e)}function gi(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed")}function yi(t,e){if(!(t instanceof Element))return!1;if(t.getAttribute("data-capture")==="exclude"&&e?.excludeMode==="remove")return!0;if(Array.isArray(e?.exclude))for(let n of e.exclude)try{if(t.matches(n))return e.excludeMode==="remove"}catch(o){R(e,"exclude selector match failed",o)}return!1}function lo(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),i=1/0,r=-1/0,s=!1,a=Array.from(t.children);for(let m of a){if(yi(m,e)||!gi(m))continue;let g=m.getBoundingClientRect(),p=g.top-o.top,y=g.bottom-o.top;y<=p||(p<i&&(i=p),y>r&&(r=y),s=!0)}let l=s?Math.max(0,r-i):0,u=parseFloat(n.borderTopWidth)||0,c=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingBottom)||0;return u+c+f+d+l}var M=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t,bi=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Ne(t,e=new Set){let n="";if(!t)return n;for(let o=0;o<t.length;o++){let i=t[o];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Ne(i.styleSheet.cssRules,e);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let r=Ne(i.cssRules,e);r&&(n+=`@media ${i.conditionText}{${r}}`);continue}if(i.type===CSSRule.STYLE_RULE){let r=i.selectorText||"";if(bi.test(r)){let s=i.cssText;s&&!e.has(s)&&(e.add(s),n+=s)}}}catch{}}return n}function uo(t){if(!t||!t.styleSheets)return"";let e=new Set,n="";for(let o of Array.from(t.styleSheets))try{let i=o.cssRules;i&&(n+=Ne(i,e))}catch{}return n}Jt();function fo(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=[],o="",i=0;for(let u=0;u<e.length;u++){let c=e[u];c==="("?i++:c===")"&&(i=Math.max(0,i-1)),c===","&&i===0?(n.push(o),o=""):o+=c}o.trim()&&n.push(o);let r=0,s=0,a=0,l=0;for(let u of n){if(/\binset\b/i.test(u))continue;let c=u.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(c.length<2)continue;let[f,d,m=0,g=0]=c,p=Math.abs(f)+m+g,y=Math.abs(d)+m+g;s=Math.max(s,p+Math.max(f,0)),l=Math.max(l,p+Math.max(-f,0)),a=Math.max(a,y+Math.max(d,0)),r=Math.max(r,y+Math.max(-d,0))}return{top:Math.ceil(r),right:Math.ceil(s),bottom:Math.ceil(a),left:Math.ceil(l)}}function mo(t){let e=t.filter&&t.filter!=="none"?t.filter:t.webkitFilter||"",n=/blur\(\s*([0-9.]+)px\s*\)/gi,o=0,i;for(;i=n.exec(e);)o+=parseFloat(i[1])||0;let r=Math.ceil(o);return{top:r,right:r,bottom:r,left:r}}function po(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0),n=parseFloat(t.outlineOffset||"0")||0,o=e+Math.max(0,Math.ceil(n));return{top:o,right:o,bottom:o,left:o}}function ho(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],o=0,i=0,r=0,s=0,a=!1;for(let l of n){a=!0;let u=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(p=>parseFloat(p))||[],[c=0,f=0,d=0]=u,m=Math.abs(c)+d,g=Math.abs(f)+d;i=Math.max(i,m+Math.max(c,0)),s=Math.max(s,m+Math.max(-c,0)),r=Math.max(r,g+Math.max(f,0)),o=Math.max(o,g+Math.max(-f,0))}return{bleed:{top:M(o),right:M(i),bottom:M(r),left:M(s)},has:a}}function go(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let o=n.transform||"none";if(!o||o==="none"){let a=null;try{a=We(t).scale}catch{}try{e.style.transform="none"}catch{}if(!a)return{a:1,b:0,c:0,d:1};let l=a.trim().split(/\s+/).map(parseFloat),u=Number.isFinite(l[0])?l[0]:1,c=Number.isFinite(l[1])?l[1]:u;return{a:u,b:0,c:0,d:c}}function i(a,l,u,c){let f=Math.sqrt(a*a+l*l)||0,d=0,m=0;if(f>0){let g=a/f,p=l/f;d=g*u+p*c;let y=u-g*d,h=c-p*d;m=Math.sqrt(y*y+h*h)||0,m>0?d=d/m:d=0}return{a:f,b:0,c:d*m,d:m}}let r=o.match(/^matrix\(\s*([^)]+)\)$/i);if(r){let a=r[1].split(",").map(l=>parseFloat(l.trim()));if(a.length===6&&a.every(Number.isFinite)){let[l,u,c,f]=a,d=i(l,u,c,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}let s=o.match(/^matrix3d\(\s*([^)]+)\)$/i);if(s){let a=s[1].split(",").map(l=>parseFloat(l.trim()));if(a.length===16&&a.every(Number.isFinite)){let l=a[0],u=a[1],c=a[4],f=a[5],d=i(l,u,c,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}try{let a=new DOMMatrix(o),l=i(a.a,a.b,a.c,a.d);try{e.style.transform=`matrix(${l.a}, ${l.b}, ${l.c}, ${l.d}, 0, 0)`}catch{}return l}catch{return null}}function _e(t,e,n,o,i){let r=n.a,s=n.b,a=n.c,l=n.d,u=n.e||0,c=n.f||0;function f(h,b){let S=h-o,w=b-i,x=r*S+a*w,v=s*S+l*w;return x+=o+u,v+=i+c,[x,v]}let d=[f(0,0),f(t,0),f(0,e),f(t,e)],m=1/0,g=1/0,p=-1/0,y=-1/0;for(let[h,b]of d)h<m&&(m=h),b<g&&(g=b),h>p&&(p=h),b>y&&(y=b);return{minX:m,minY:g,maxX:p,maxY:y,width:p-m,height:y-g}}function yo(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[i,r]=[o[0]||"0",o[1]||"0"],s=(a,l)=>{let u=a.toLowerCase();return u==="left"||u==="top"?0:u==="center"?l/2:u==="right"||u==="bottom"?l:u.endsWith("px")?parseFloat(u)||0:u.endsWith("%")?(parseFloat(u)||0)*l/100:/^-?\d+(\.\d+)?$/.test(u)&&parseFloat(u)||0};return{ox:s(i,e),oy:s(r,n)}}function We(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.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}},r=i("rotate");if(r)if(r.angle){let l=r.angle;e.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else r.unit?e.rotate=r.unit==="rad"?r.value*180/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{let l=getComputedStyle(t);e.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let s=i("scale");if(s){let l="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,u="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:l;e.scale=`${l} ${u}`}else{let l=getComputedStyle(t);e.scale=l.scale&&l.scale!=="none"?l.scale:null}let a=i("translate");if(a){let l="x"in a&&"value"in a.x?a.x.value:Array.isArray(a)?a[0]?.value:0,u="y"in a&&"value"in a.y?a.y.value:Array.isArray(a)?a[1]?.value:0,c="x"in a&&a.x?.unit?a.x.unit:"px",f="y"in a&&a.y?.unit?a.y.unit:"px";e.translate=`${l}${c} ${u}${f}`}else{let l=getComputedStyle(t);e.translate=l.translate&&l.translate!=="none"?l.translate:null}return e}let o=getComputedStyle(t);return e.rotate=o.rotate&&o.rotate!=="none"?o.rotate:"0deg",e.scale=o.scale&&o.scale!=="none"?o.scale:null,e.translate=o.translate&&o.translate!=="none"?o.translate:null,e}var Ie=null;function wi(){if(Ie)return Ie;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),Ie=t,t}function bo(t){let e=wi(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let o=Si(n);return e.removeChild(n),o}function wo(t){let e=_(t),n=e.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 i=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",r=e.scale&&e.scale!=="none"&&e.scale!=="1",s=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(i||r||s)}function Si(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function xi(t){if(Array.isArray(t.plugins)){for(let e of t.plugins)if(le(e)?.name==="picture-resolver")return!0}return eo().some(e=>e?.name==="picture-resolver")}async function Oe(t,e){if(!t)throw new Error("Element cannot be null or undefined");Xt(e.cache);let n=e.fast,o=e.outerTransforms!==!1,i=!!e.outerShadows,r={element:t,options:e,plugins:e.plugins},s,a,l,u="",c="",f,d,m=null;await tt("beforeSnap",r);let g=null;e.resolvePicturePlaceholders!==!1&&!xi(e)&&(g=await no(r.element,r.options)),await tt("beforeClone",r);let p=Kn(r.element);try{({clone:s,classCSS:a,styleCache:l}=await Xn(r.element,r.options)),!o&&s&&(m=go(r.element,s)),!i&&s&&io(r.element,s,r.options),s&&so(r.element,s)}finally{p()}if(r={clone:s,classCSS:a,styleCache:l,...r},await tt("afterClone",r),g&&await g(),ao(r.clone),r.options?.excludeMode==="remove")try{co(r.element,r.clone,r.styleCache)}catch(w){console.warn("[snapdom] shrink pass failed:",w)}try{await Sn(r.clone,r.element)}catch{}await new Promise(w=>{rt(async()=>{await Yn(r.clone,r.options),w()},{fast:n})}),await new Promise(w=>{rt(async()=>{await ce(r.element,r.clone,r.styleCache,r.options),w()},{fast:n})}),e.embedFonts&&await new Promise(w=>{rt(async()=>{let x=At(r.element),v=se(r.element);if(H()){let C=new Set(Array.from(x).map(k=>String(k).split("__")[0]).filter(Boolean));await vt(C,1)}u=await ie({required:x,usedCodepoints:v,preCached:!1,exclude:r.options.excludeFonts,localFonts:r.options.localFonts,useProxy:r.options.useProxy,fontStylesheetDomains:r.options.fontStylesheetDomains}),w()},{fast:n})});let y=Se(r.clone).sort(),h=y.join(",");A.baseStyle.has(h)?c=A.baseStyle.get(h):await new Promise(w=>{rt(()=>{c=xe(y),A.baseStyle.set(h,c),w()},{fast:n})});let b=uo(r.element?.ownerDocument||document);r={fontsCSS:u,baseCSS:c,scrollbarCSS:b,...r},await tt("beforeRender",r),await new Promise(w=>{rt(()=>{let x=_(r.element),v=r.element.getBoundingClientRect(),C=Math.max(1,M(r.element.offsetWidth||parseFloat(x.width)||v.width||1)),k=Math.max(1,M(r.element.offsetHeight||parseFloat(x.height)||v.height||1)),E=r.element.ownerDocument||document;if(r.element===E.body||r.element===E.documentElement){let V=Math.max(r.element.scrollHeight||0,E.documentElement?.scrollHeight||0,E.body?.scrollHeight||0),G=Math.max(r.element.scrollWidth||0,E.documentElement?.scrollWidth||0,E.body?.scrollWidth||0);V>0&&(k=Math.max(k,M(V))),G>0&&(C=Math.max(C,M(G)));try{let nt=(r.scrollbarCSS||"").length+(r.baseCSS||"").length+(r.fontsCSS||"").length+(r.classCSS||"").length,Q=A.measureHints.get(r.element);if(Q&&Q.cssLen===nt&&Q.w0===C)Q.csh>0&&(k=Math.max(k,M(Q.csh))),Q.csw>0&&(C=Math.max(C,M(Q.csw)));else{let ot=E.createElement("div");ot.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+C+"px!important;overflow:visible!important;visibility:hidden!important;";let jt=E.createElement("style");jt.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,ot.appendChild(jt),ot.appendChild(r.clone.cloneNode(!0)),E.body.appendChild(ot);let $t=ot.scrollHeight,ut=ot.scrollWidth;E.body.removeChild(ot),A.measureHints.set(r.element,{cssLen:nt,w0:C,csh:$t,csw:ut}),$t>0&&(k=Math.max(k,M($t))),ut>0&&(C=Math.max(C,M(ut)))}}catch{}}if(r.options?.excludeMode==="remove"){let V=lo(r.element,r.options);Number.isFinite(V)&&V>0&&(k=Math.max(1,Math.min(k,M(V+1))))}let W=(V,G=NaN)=>{let nt=typeof V=="string"?parseFloat(V):V;return Number.isFinite(nt)?nt:G},z=W(r.options.width),Y=W(r.options.height),L=C,I=k,F=Number.isFinite(z),X=Number.isFinite(Y),Dt=k>0?C/k:1;F&&X?(L=Math.max(1,M(z)),I=Math.max(1,M(Y))):F?(L=Math.max(1,M(z)),I=Math.max(1,M(L/(Dt||1)))):X?(I=Math.max(1,M(Y)),L=Math.max(1,M(I*(Dt||1)))):(L=C,I=k);let dt=0,at=0,$=C,T=k;if(!o&&m&&Number.isFinite(m.a)){let V={a:m.a,b:m.b||0,c:m.c||0,d:m.d||1,e:0,f:0},G=_e(C,k,V,0,0);dt=M(G.minX),at=M(G.minY),$=M(G.maxX),T=M(G.maxY)}else if(o&&So(r.element)){let G=x.transform&&x.transform!=="none"?x.transform:"",nt=We(r.element),Q=bo({baseTransform:G,rotate:nt.rotate||"0deg",scale:nt.scale,translate:nt.translate}),{ox:ot,oy:jt}=yo(x,C,k),$t=Q.is2D?Q:new DOMMatrix(Q.toString()),ut=_e(C,k,$t,ot,jt);dt=M(ut.minX),at=M(ut.minY),$=M(ut.maxX),T=M(ut.maxY)}let O=fo(x),U=mo(x),K=po(x),Ft=ho(x),et=i?{top:M(O.top+U.top+K.top+Ft.bleed.top),right:M(O.right+U.right+K.right+Ft.bleed.right),bottom:M(O.bottom+U.bottom+K.bottom+Ft.bleed.bottom),left:M(O.left+U.left+K.left+Ft.bleed.left)}:{top:0,right:0,bottom:0,left:0};dt=M(dt-et.left),at=M(at-et.top),$=M($+et.right),T=M(T+et.bottom);let Ht=Math.max(1,M($-dt)),mt=Math.max(1,M(T-at)),fe=F||X?M(L/C):1,de=X||F?M(I/k):1,zt=Math.max(1,M(Ht*fe)),Vt=Math.max(1,M(mt*de)),Ve="http://www.w3.org/2000/svg",No=H()&&So(r.element)?1:0,ct=M(No+(o?0:1)),lt=document.createElementNS(Ve,"foreignObject"),Io=M(dt),_o=M(at);lt.setAttribute("x",String(M(-(Io-ct)))),lt.setAttribute("y",String(M(-(_o-ct)))),lt.setAttribute("width",String(M(C+ct*2))),lt.setAttribute("height",String(M(k+ct*2))),lt.style.overflow="visible";let qe=document.createElement("style"),Wo="svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}";qe.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+Wo+r.classCSS,lt.appendChild(qe);let qt=document.createElement("div");qt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),qt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${M(C)}px;height:${M(k)}px`,qt.appendChild(r.clone),lt.appendChild(qt);let Oo=new XMLSerializer().serializeToString(lt),me=M(Ht+ct*2),pe=M(mt+ct*2),je=F||X;e.meta={w0:C,h0:k,vbW:me,vbH:pe,targetW:L,targetH:I};let Uo=H()&&je?me:M(zt+ct*2),Bo=H()&&je?pe:M(Vt+ct*2),Do=parseFloat(_(E.documentElement)?.fontSize)||16;d=`<svg xmlns="${Ve}" width="${Uo}" height="${Bo}" viewBox="0 0 ${me} ${pe}" font-size="${Do}px">`+Oo+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,r={svgString:d,dataURL:f,...r},w()},{fast:n})}),await tt("afterRender",r);let S=document.getElementById("snapdom-sandbox");return S&&S.style.position==="absolute"&&S.remove(),r.dataURL}function So(t){return wo(t)}j();function xo(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Xe(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:t.placeholders!==!1,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(t.fontStylesheetDomains)?t.fontStylesheetDomains:[],fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",outerTransforms:t.outerTransforms??!0,outerShadows:t.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(t.safariWarmupAttempts??3)|0)),excludeStyleProps:t.excludeStyleProps??null,resolvePicturePlaceholders:t.resolvePicturePlaceholders!==!1,pictureResolver:t.pictureResolver&&typeof t.pictureResolver=="object"?t.pictureResolver:{}}}xt();ve();J();ht();j();async function Ci(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,i=e.cache??e.cacheOpt??"full";Xt(i);try{await document.fonts?.ready}catch{}try{be()}catch{}A.session=A.session||{},A.session.styleCache||(A.session.styleCache=new WeakMap),A.image=A.image||new D(100),A.background=A.background||new D(100);try{await ce(t,void 0,A.session.styleCache,{useProxy:o})}catch{}let r=[],s=[];try{if(t&&t.nodeType===1){let l=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];s=[t,...l],r=[],t.tagName==="IMG"&&t.getAttribute("src")&&r.push(t),r.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(r=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let a=[];for(let l of r){let u=l?.currentSrc||l?.src;if(u&&!A.image.has(u)){let c=Promise.resolve().then(async()=>{let f=await B(u,{as:"dataURL",useProxy:o});f?.ok&&typeof f.data=="string"&&A.image.set(u,f.data)}).catch(()=>{});a.push(c)}}for(let l of s){let u="";try{u=l?.style?.backgroundImage||"",(!u||u==="none")&&(u=_(l).backgroundImage)}catch{}if(u&&u!=="none"){let c=u.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let f of c){let d=Promise.resolve().then(()=>gt(f,{...e,useProxy:o})).catch(()=>{});a.push(d)}}}if(n)try{let l=At(t),u=se(t);if(typeof H=="function"?H():!!H){let f=new Set(Array.from(l).map(d=>String(d).split("__")[0]).filter(Boolean));await vt(f,3)}await ie({required:l,usedCodepoints:u,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o,fontStylesheetDomains:e.fontStylesheetDomains})}catch{}await Promise.allSettled(a)}function Li(...t){return Qn(...t),N}var N=Object.assign(Pi,{plugins:Li}),Po=Symbol("snapdom.internal"),Ti=Symbol("snapdom.internal.silent"),To=!1;async function Pi(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=xo(e);if(to(n,e&&e.plugins),H()&&(n.embedFonts===!0||Ii(t))){if(n.embedFonts)try{let i=At(t),r=new Set([...i].map(s=>String(s).split("__")[0]).filter(Boolean));await vt(r,1)}catch{}let o=n.safariWarmupAttempts??3;for(let i=0;i<o;i++)try{await Ni(t,e)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&wn(n.iconFonts),n.snap||(n.snap={toPng:(o,i)=>N.toPng(o,i),toSvg:(o,i)=>N.toSvg(o,i)}),N.capture(t,n,Po)}N.capture=async(t,e,n)=>{if(n!==Po)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Oe(t,e),i={img:async(p,y)=>{let{toImg:h}=await Promise.resolve().then(()=>(De(),Be));return h(o,{...p,...y||{}})},svg:async(p,y)=>{let{toSvg:h}=await Promise.resolve().then(()=>(De(),Be));return h(o,{...p,...y||{}})},canvas:async(p,y)=>{let{toCanvas:h}=await Promise.resolve().then(()=>(Ut(),Mo));return h(o,{...p,...y||{}})},blob:async(p,y)=>{let{toBlob:h}=await Promise.resolve().then(()=>(ze(),Fo));return h(o,{...p,...y||{}})},png:async(p,y)=>{let{rasterize:h}=await Promise.resolve().then(()=>(Bt(),ue));return h(o,{...p,...y||{},format:"png"})},jpeg:async(p,y)=>{let{rasterize:h}=await Promise.resolve().then(()=>(Bt(),ue));return h(o,{...p,...y||{},format:"jpeg"})},webp:async(p,y)=>{let{rasterize:h}=await Promise.resolve().then(()=>(Bt(),ue));return h(o,{...p,...y||{},format:"webp"})},download:async(p,y)=>{let{download:h}=await Promise.resolve().then(()=>(Lo(),Ro));return h(o,{...p,...y||{}})}},r={};for(let p of["img","svg","canvas","blob","png","jpeg","webp"])r[p]=async y=>i[p](e,{...y||{},[Ti]:!0});r.jpg=r.jpeg;let s={...e,export:{url:o},exports:r},a=await Zn("defineExports",s),l=Object.assign({},...a.filter(p=>p&&typeof p=="object").reverse()),u={...i,...l};u.jpeg&&!u.jpg&&(u.jpg=(p,y)=>u.jpeg(p,y));function c(p,y){let h={...e,...y||{}},b=w=>w==="jpeg"||w==="jpg"||w==="webp";return[p,h.format,h.type].map(w=>typeof w=="string"?w.toLowerCase():"").find(b)&&(h.backgroundColor==null||h.backgroundColor==="transparent")&&(h.backgroundColor="#ffffff"),h}let f=!1,d=Promise.resolve();async function m(p,y){let h=async()=>{let b=u[p];if(!b)throw new Error(`[snapdom] Unknown export type: ${p}`);let S=c(p,y),w={...e,export:{type:p,options:S,url:o}};await tt("beforeExport",w);let x=await b(w,S);return await tt("afterExport",w,x),f||(f=!0,await tt("afterSnap",e)),x};return d=d.then(h)}let g={url:o,toRaw:()=>o,to:(p,y)=>m(p,y),toImg:p=>m("img",p),toSvg:p=>m("svg",p),toCanvas:p=>m("canvas",p),toBlob:p=>m("blob",p),toPng:p=>m("png",p),toJpg:p=>m("jpg",p),toWebp:p=>m("webp",p),download:p=>m("download",p)};for(let p of Object.keys(u)){let y="to"+p.charAt(0).toUpperCase()+p.slice(1);g[y]||(g[y]=h=>m(p,h))}return g};N.toRaw=(t,e)=>N(t,e).then(n=>n.toRaw());N.toImg=(t,e)=>N(t,e).then(n=>n.toImg());N.toSvg=(t,e)=>N(t,e).then(n=>n.toSvg());N.toCanvas=(t,e)=>N(t,e).then(n=>n.toCanvas());N.toBlob=(t,e)=>N(t,e).then(n=>n.toBlob());N.toPng=(t,e)=>N(t,{...e,format:"png"}).then(n=>n.toPng());N.toJpg=(t,e)=>N(t,{...e,format:"jpeg"}).then(n=>n.toJpg());N.toWebp=(t,e)=>N(t,{...e,format:"webp"}).then(n=>n.toWebp());N.download=(t,e)=>N(t,e).then(n=>n.download());async function Ni(t,e){if(To)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await Oe(t,n)}catch(i){R(e,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),o&&await new Promise(i=>{let r=new Image;try{r.decoding="sync",r.loading="eager"}catch(s){R(e,"safariWarmup img hints failed",s)}r.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",r.src=o,document.body.appendChild(r),(async()=>{try{typeof r.decode=="function"&&await r.decode()}catch(a){R(e,"safariWarmup img.decode failed",a)}let s=performance.now();for(;!(r.complete&&r.naturalWidth>0)&&performance.now()-s<900;)await new Promise(a=>setTimeout(a,200));await new Promise(a=>requestAnimationFrame(a));try{let a=document.createElement("canvas");a.width=Math.max(1,r.naturalWidth||10),a.height=Math.max(1,r.naturalHeight||10);let l=a.getContext("2d");l&&l.drawImage(r,0,0)}catch{}await new Promise(a=>requestAnimationFrame(a));try{r.remove()}catch(a){R(e,"safariWarmup img.remove failed",a)}i()})()}),t.querySelectorAll("canvas").forEach(i=>{try{let r=i.getContext("2d",{willReadFrequently:!0});r&&r.getImageData(0,0,1,1)}catch(r){R(e,"safariWarmup canvas poke failed",r)}}),To=!0}function Ii(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),i=o.backgroundImage&&o.backgroundImage!=="none",r=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(i||r||n.tagName==="CANVAS")return!0}return!1}export{Ci as preCache,N as snapdom};
|