@zumer/snapdom 2.5.0 → 2.7.0
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 +8 -8
- package/dist/snapdom.mjs +8 -8
- package/package.json +4 -1
package/dist/snapdom.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* SnapDOM
|
|
3
|
-
* v2.
|
|
3
|
+
* v2.7.0
|
|
4
4
|
* Author: Juan Martin Muda
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
|
-
var
|
|
8
|
-
`;return n}function pe(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 _o(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 H(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=x.computedStyle.get(t);o||(o=new Map,x.computedStyle.set(t,o));let i=o.get(e);if(!i){let r=_o(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 Vt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function yt(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 zt,jt,Io,No,To,Po,he=V(()=>{Y();zt=new Set(["meta","script","noscript","title","link","template"]),jt=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"]),Io=["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"];No=/(?:^|-)(animation|transition)(?:-|$)/i,To=/^(--.+|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,Po=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function et(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function ge(){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 q(){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,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),a=/ipad|iphone|ipod/.test(e)&&o;return n||s||l||c||a}function He(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var bt=V(()=>{});function F(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 ye=V(()=>{});var G=V(()=>{De();he();bt();vt();ye()});var co={};At(co,{toCanvas:()=>mt});function Kr(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Qr(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Jr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Zr(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 ts(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)||[],[l="0px",c="0px",a="0px"]=s,u=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!u&&u!==",";i.push(`drop-shadow(${l} ${c} ${a}${f?` ${u}`:""})`)}return i.join(" ")}function ao(t){let e=Zr(t),n=null,o=null,i=null,r=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let a=l.slice(0,c).trim().toLowerCase(),u=l.slice(c+1).trim();a==="box-shadow"?i=u:a==="filter"?n=u:a==="-webkit-filter"?o=u:r.push([a,u])}if(i){let l=ts(i);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let s=[...r];return n&&s.push(["filter",n]),o&&s.push(["-webkit-filter",o]),s.map(([l,c])=>`${l}:${c}`).join(";")}function es(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${ao(o)}}`)}function ns(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,es(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${ao(o)}${n}`),t}function os(t){if(!q()||!Kr(t))return t;try{let e=Qr(t),n=ns(e);return Jr(n)}catch{return t}}async function mt(t,e){let{width:n,height:o,scale:i=1,dpr:r=1,meta:s={},backgroundColor:l}=e;t=os(t);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=t,await c.decode();let a=c.naturalWidth,u=c.naturalHeight,f=Number.isFinite(s.w0)?s.w0:a,m=Number.isFinite(s.h0)?s.h0:u,h,y,p=Number.isFinite(n),d=Number.isFinite(o);if(p&&d)h=Math.max(1,n),y=Math.max(1,o);else if(p){let w=n/Math.max(1,f);h=n,y=m*w}else if(d){let w=o/Math.max(1,m);y=o,h=f*w}else h=a,y=u;h=h*i,y=y*i;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let S=g.getContext("2d");return r!==1&&S.scale(r,r),l&&(S.save(),S.fillStyle=l,S.fillRect(0,0,h,y),S.restore()),S.drawImage(c,0,0,h,y),g}var It=V(()=>{bt()});var oe={};At(oe,{rasterize:()=>Re});async function Re(t,e){let n=await mt(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 Nt=V(()=>{It()});var Le={};At(Le,{toImg:()=>rs,toSvg:()=>rs});async function rs(t,e){let{scale:n=1,width:o,height:i,meta:r={}}=e,s=Number.isFinite(o),l=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||s||l;if(q()&&c)return await Re(t,{...e,format:"png",quality:1,meta:r});let a=new Image;if(a.decoding="sync",a.loading="eager",a.src=t,await a.decode(),s&&l)a.style.width=`${o}px`,a.style.height=`${i}px`;else if(s){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,f=Number.isFinite(r.h0)?r.h0:a.naturalHeight,m=o/Math.max(1,u);a.style.width=`${o}px`,a.style.height=`${Math.round(f*m)}px`}else if(l){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,f=Number.isFinite(r.h0)?r.h0:a.naturalHeight,m=i/Math.max(1,f);a.style.height=`${i}px`,a.style.width=`${Math.round(u*m)}px`}else{let u=Math.round(a.naturalWidth*n),f=Math.round(a.naturalHeight*n);if(a.style.width=`${u}px`,a.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,a.src=t}catch(m){F(e,"SVG width/height patch in toImg failed",m)}}return a}var Ie=V(()=>{G();Nt()});var lo={};At(lo,{toBlob:()=>Ne});async function Ne(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 mt(t,e);return new Promise(i=>o.toBlob(r=>i(r),`image/${n}`,e.quality))}var Te=V(()=>{It()});var fo={};At(fo,{download:()=>ss});async function uo(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 ss(t,e){let n=(e?.format||e?.type||"").toLowerCase(),o=n==="jpg"?"jpeg":n||"png",i=e?.filename||`snapdom.${o}`,r={...e||{},format:o,type:o};r.dpr=1;let s=ge();if(o==="svg"){let a=await Ne(t,{...r,type:"svg"});if(s&&await uo(a,i))return;let u=URL.createObjectURL(a),f=document.createElement("a");f.href=u,f.download=i,document.body.appendChild(f),f.click(),URL.revokeObjectURL(u),f.remove();return}let l=await mt(t,r);if(s){let a=`image/${o}`,u=await new Promise(f=>l.toBlob(f,a,e?.quality));if(u&&await uo(u,i))return}let c=document.createElement("a");c.href=l.toDataURL(`image/${o}`,e?.quality),c.download=i,document.body.appendChild(c),c.click(),c.remove()}var mo=V(()=>{Te();It();bt()});G();G();Y();var qe=new WeakMap,be=new Map,we=0;function Et(){we++}var ze=!1;function Wo(t=document.documentElement){if(!ze){ze=!0;try{new MutationObserver(()=>Et()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Et()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Et),e.ready?.then(()=>Et()).catch(()=>{}))}catch{}}}function Uo(t,e={}){let n={},o=t.getPropertyValue("visibility"),i=e.excludeStyleProps;for(let f=0;f<t.length;f++){let m=t[f];if(Mt(m)||i&&(i instanceof RegExp&&i.test(m)||typeof i=="function"&&i(m)))continue;let h=t.getPropertyValue(m);(m==="background-image"||m==="content")&&h.includes("url(")&&!h.includes("data:")&&(h="none"),n[m]=h}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 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 h=t.getPropertyValue(m);h&&(n[m]=h)}catch{}}o==="hidden"&&(n.opacity="0");let l=parseFloat(t.getPropertyValue("border-top-width")||0)||0,c=parseFloat(t.getPropertyValue("border-right-width")||0)||0,a=parseFloat(t.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(t.getPropertyValue("border-left-width")||0)||0;if(l===0&&c===0&&a===0&&u===0){let f=(t.getPropertyValue("border-image-source")||"").trim(),m=f&&f!=="none",h=["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 y of h)delete n[y];m||(n.border="none")}return n}var je=new WeakMap;function Oo(t){let e=je.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(";"),je.set(t,e),e)}function Bo(t,e=null,n={}){let o=qe.get(t);if(o&&o.epoch===we)return o.snapshot;let i=e||getComputedStyle(t),r=Uo(i,n);return Xo(t,i,r),qe.set(t,{epoch:we,snapshot:r}),r}function Do(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:be,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:e||{}}:{session:x.session,persist:{snapshotKeyCache:be,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:t||e||{}}}function Ho(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=Do(n,o),r=i.options&&i.options.cache||"auto";r!=="disabled"&&Wo(document.documentElement),r==="disabled"&&!i.session.__bumpedForDisabled&&(Et(),be.clear(),i.session.__bumpedForDisabled=!0);let{session:s,persist:l}=i;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let c=s.styleCache.get(t);t.getAttribute?.("style")&&Ho(t,e,c);let a=Bo(t,c,i.options),u=Oo(a),f=l.snapshotKeyCache.get(u);if(!f){let m=t.tagName?.toLowerCase()||"div";f=gt(a,m),l.snapshotKeyCache.set(u,f)}s.styleMap.set(e,f)}function qo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function zo(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 jo(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Vo(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 Xo(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 l=e.display||"";if(l.includes("flex")||l.includes("grid")||qo(t))return;let c=e.position;if(c==="absolute"||c==="fixed"||c==="sticky"||e.transform!=="none"||zo(e)||jo(t))return;let a=e.overflowX||e.overflow||"visible",u=e.overflowY||e.overflow||"visible";if(a!=="visible"||u!=="visible")return;let f=e.clip;f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Vo(t,e)&&(delete n.height,delete n["block-size"])}he();var Xe=["fill","stroke","color","background-color","stop-color"],Ve=new Map;function Yo(t,e){let n=e+"::"+t.toLowerCase(),o=Ve.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 l=getComputedStyle(r),c={};for(let a of Xe)c[a]=l.getPropertyValue(a)||"";return s.remove(),Ve.set(n,c),c}function Ye(t,e){if(!(t instanceof Element)||!(e instanceof Element))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 l=r[s];if(l&&typeof l.value=="string"&&l.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)for(let s=0;s<r.length;s++){let l=r[s],c=r.getPropertyValue(l);if(!c||!c.includes("var("))continue;let a=i&&i.getPropertyValue(l);if(a)try{e.style.setProperty(l,a.trim(),r.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let r=t.attributes;for(let s=0;s<r.length;s++){let l=r[s];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,a=i&&i.getPropertyValue(c);if(a)try{e.style.setProperty(c,a.trim())}catch{}}}if(!o){if(!i)try{i=getComputedStyle(t)}catch{i=null}if(!i)return;let r=t.namespaceURI||"html",s=Yo(t.tagName,r);for(let l of Xe){let c=i.getPropertyValue(l)||"",a=s[l]||"";if(c&&c!==a)try{e.style.setProperty(l,c.trim())}catch{}}}}G();G();Y();ft();function Yt(t,e,n){return Promise.all(t.map(o=>new Promise(i=>{function r(){et(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(o,i):r()},{fast:n})}r()})))}function Go(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Ko(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?Go(o):o;return`:where(${e} ${i})`}).join(", ")}function Ke(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=Ko(r,e,!0);return`${o}${i}${s}{`}),t):""}function Qe(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Je(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
|
|
10
|
-
`}catch{}}catch{}return e}function
|
|
11
|
-
`:""}function on(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 Jo(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 Zo(t){let e=t.getBoundingClientRect(),n=0,o=0,i=0,r=0;try{let c=getComputedStyle(t);n=parseFloat(c.borderLeftWidth)||0,o=parseFloat(c.borderRightWidth)||0,i=parseFloat(c.borderTopWidth)||0,r=parseFloat(c.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+o))),l=Math.max(0,Math.round(e.height-(i+r)));return{contentWidth:s,contentHeight:l,rect:e}}function Q(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 tr(t,e,n){let o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.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(o),()=>{try{o.remove()}catch{}}}async function rn(t,e,n){let o=await Jo(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:r,rect:s}=Zo(t),l=n?.snap;if(!l&&typeof window<"u"&&window.snapdom&&(l=window.snapdom),!l||typeof l.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let c={...n,scale:1},a=tr(o,i,r),u;try{u=await l.toPng(o.documentElement,c)}finally{a()}u.style.display="block",u.style.width=`${i}px`,u.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(u),f}function sn(t){let{width:e,height:n}=Q(t),o=t.getBoundingClientRect(),i;try{i=window.getComputedStyle(t)}catch{}let r=i?parseFloat(i.width):NaN,s=i?parseFloat(i.height):NaN,l=Math.round(e||o.width||0),c=Math.round(n||o.height||0),a=Number.isFinite(r)&&r>0?Math.round(r):Math.max(12,l||16),u=Number.isFinite(s)&&s>0?Math.round(s):Math.max(12,c||16),f=(t.type||"text").toLowerCase()==="checkbox",m=!!t.checked,h=!!t.indeterminate,p=Math.max(Math.min(a,u),12),d=document.createElement("div");d.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),d.style.cssText=`display:inline-block;width:${p}px;height:${p}px;vertical-align:middle;flex-shrink:0;line-height:0;`;let g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("width",String(p)),g.setAttribute("height",String(p)),g.setAttribute("viewBox",`0 0 ${p} ${p}`),d.appendChild(g);function S(){let w="#0a6ed1";try{i&&(w=i.accentColor||i.color||w)}catch{}let b=2,k=b/2,A=p-b;if(g.innerHTML="",f){let C=document.createElementNS("http://www.w3.org/2000/svg","rect");if(C.setAttribute("x",String(k)),C.setAttribute("y",String(k)),C.setAttribute("width",String(A)),C.setAttribute("height",String(A)),C.setAttribute("rx","2"),C.setAttribute("ry","2"),C.setAttribute("fill",m?w:"none"),C.setAttribute("stroke",w),C.setAttribute("stroke-width",String(b)),g.appendChild(C),m){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",`M ${k+2} ${p/2} L ${p/2-1} ${p-k-2} L ${p-k-2} ${k+2}`),v.setAttribute("stroke","white"),v.setAttribute("stroke-width",String(Math.max(1.5,b))),v.setAttribute("fill","none"),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round"),g.appendChild(v)}else if(h){let v=document.createElementNS("http://www.w3.org/2000/svg","rect"),$=Math.max(6,A-4);v.setAttribute("x",String((p-$)/2)),v.setAttribute("y",String((p-b)/2)),v.setAttribute("width",String($)),v.setAttribute("height",String(b)),v.setAttribute("fill",w),v.setAttribute("rx","1"),g.appendChild(v)}}else{let C=document.createElementNS("http://www.w3.org/2000/svg","circle");if(C.setAttribute("cx",String(p/2)),C.setAttribute("cy",String(p/2)),C.setAttribute("r",String((p-b)/2)),C.setAttribute("fill",m?w:"none"),C.setAttribute("stroke",w),C.setAttribute("stroke-width",String(b)),g.appendChild(C),m){let v=document.createElementNS("http://www.w3.org/2000/svg","circle"),$=Math.max(2,(p-b*2)*.35);v.setAttribute("cx",String(p/2)),v.setAttribute("cy",String(p/2)),v.setAttribute("r",String($)),v.setAttribute("fill","white"),g.appendChild(v)}}d.style.setProperty("width",`${p}px`,"important"),d.style.setProperty("height",`${p}px`,"important"),d.style.setProperty("min-width",`${p}px`,"important"),d.style.setProperty("min-height",`${p}px`,"important")}return S(),{el:d,applyVisual:S}}var Ft=new O(80);async function $t(t){if(x.resource?.has(t))return x.resource.get(t);if(Ft.has(t))return Ft.get(t);let e=(async()=>{let n=await U(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return x.resource?.set(t,n.data),n.data})();Ft.set(t,e);try{let n=await e;return Ft.set(t,n),n}catch(n){throw Ft.delete(t),n}}var er=/\bblob:[^)"'\s]+/g;async function Ge(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(er)||[]));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 Xt(t){return typeof t=="string"&&t.startsWith("blob:")}function nr(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 or(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function an(t,e=null){if(!t)return;let n=e,o=t.querySelectorAll?t.querySelectorAll("img"):[];for(let c of o)try{let u=c.getAttribute("src")||c.currentSrc||"";if(Xt(u)){let m=await $t(u);c.setAttribute("src",m)}let f=c.getAttribute("srcset");if(f&&f.includes("blob:")){let m=nr(f),h=!1;for(let y of m)if(Xt(y.url))try{y.url=await $t(y.url),h=!0}catch(p){F(n,"blobUrlToDataUrl for srcset item failed",p)}h&&c.setAttribute("srcset",or(m))}}catch(a){F(n,"resolveBlobUrls for img failed",a)}let i=t.querySelectorAll?t.querySelectorAll("image"):[];for(let c of i)try{let a="http://www.w3.org/1999/xlink",u=c.getAttribute("href")||c.getAttributeNS?.(a,"href");if(Xt(u)){let f=await $t(u);c.setAttribute("href",f),c.removeAttributeNS?.(a,"href")}}catch(a){F(n,"resolveBlobUrls for SVG image href failed",a)}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let c of r)try{let a=c.getAttribute("style");if(a&&a.includes("blob:")){let u=await Ge(a);c.setAttribute("style",u)}}catch(a){F(n,"replaceBlobUrls in inline style failed",a)}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let c of s)try{let a=c.textContent||"";a.includes("blob:")&&(c.textContent=await Ge(a))}catch(a){F(n,"replaceBlobUrls in style tag failed",a)}let l=["poster"];for(let c of l){let a=t.querySelectorAll?t.querySelectorAll(`[${c}^='blob:']`):[];for(let u of a)try{let f=u.getAttribute(c);Xt(f)&&u.setAttribute(c,await $t(f))}catch(f){F(n,`resolveBlobUrls for ${c} failed`,f)}}}bt();async function Rt(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 u=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||zt.has(u))return 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"){let u=document.createElement("div"),{width:f,height:m}=Q(t),h=f||t.getBoundingClientRect().width||0,y=m||t.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${h}px;height:${y}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if(t.matches?.(u)){if(n.excludeMode==="hide"){let f=document.createElement("div"),{width:m,height:h}=Q(t),y=m||t.getBoundingClientRect().width||0,p=h||t.getBoundingClientRect().height||0;return f.style.cssText=`display:inline-block;width:${y}px;height:${p}px;visibility:hidden;`,f}else if(n.excludeMode==="remove")return null}}catch(f){console.warn(`Invalid selector in exclude option: ${u}`,f)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let u=document.createElement("div"),{width:f,height:m}=Q(t),h=f||t.getBoundingClientRect().width||0,y=m||t.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${h}px;height:${y}px;visibility:hidden;`,u}else if(n.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(t.tagName==="IFRAME"){let u=!1;try{u=!!(t.contentDocument||t.contentWindow?.document)}catch(f){F(e,"iframe same-origin probe failed",f)}if(u)try{return await rn(t,e,n)}catch(f){console.warn("[SnapDOM] iframe rasterization failed, fallback:",f)}if(n.placeholders){let{width:f,height:m}=Q(t),h=document.createElement("div");return h.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,h,e,n),h}else{let{width:f,height:m}=Q(t),h=document.createElement("div");return h.style.cssText=`display:inline-block;width:${f}px;height:${m}px;visibility:hidden;`,it(t,h,e,n),h}}if(t.getAttribute("data-capture")==="placeholder"){let u=t.cloneNode(!1);e.nodeMap.set(u,t),it(t,u,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;",u.appendChild(f),u}if(t.tagName==="CANVAS"){let u="";try{let y=t.getContext("2d",{willReadFrequently:!0});try{y&&y.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),u=t.toDataURL("image/png"),!u||u==="data:,"){try{y&&y.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),u=t.toDataURL("image/png"),!u||u==="data:,"){let p=document.createElement("canvas");p.width=t.width,p.height=t.height;let d=p.getContext("2d");d&&(d.drawImage(t,0,0),u=p.toDataURL("image/png"))}}}catch(y){F(e,"Canvas toDataURL failed, using empty/fallback",y)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch(y){F(e,"img decoding/loading hints failed",y)}u&&(f.src=u),f.width=t.width,f.height=t.height;let{width:m,height:h}=Q(t);return m>0&&(f.style.width=`${m}px`),h>0&&(f.style.height=`${h}px`),e.nodeMap.set(f,t),it(t,f,e,n),f}let s;try{if(s=t.cloneNode(!1),Ye(t,s),e.nodeMap.set(s,t),t.tagName==="IMG"){tn(t,s);try{let{width:u,height:f}=Q(t),m=Math.round(u||0),h=Math.round(f||0);m&&(s.dataset.snapdomWidth=String(m)),h&&(s.dataset.snapdomHeight=String(h))}catch(u){F(e,"getUnscaledDimensions for IMG failed",u)}try{let u=t.getAttribute("style")||"",f=window.getComputedStyle(t),m=g=>{let S=u.match(new RegExp(`${g}\\s*:\\s*([^;]+)`,"i")),w=S?S[1].trim():f.getPropertyValue(g);return/%|auto/i.test(String(w||""))},h=parseInt(s.dataset.snapdomWidth||"0",10),y=parseInt(s.dataset.snapdomHeight||"0",10),p=m("width")||!h,d=m("height")||!y;p&&h&&(s.style.width=`${h}px`),d&&y&&(s.style.height=`${y}px`),h&&(s.style.minWidth=`${h}px`),y&&(s.style.minHeight=`${y}px`)}catch(u){F(e,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",t,u),u}let l=null;if(t instanceof HTMLTextAreaElement){let{width:u,height:f}=Q(t),m=u||t.getBoundingClientRect().width||0,h=f||t.getBoundingClientRect().height||0;m&&(s.style.width=`${m}px`),h&&(s.style.height=`${h}px`)}if(t instanceof HTMLInputElement){let u=(t.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&He()){let{el:m,applyVisual:h}=sn(t);e.nodeMap.set(m,t),l=h,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 HTMLSelectElement&&(i=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),it(t,s,e,n),l&&l(),t.shadowRoot){let g=function(w,b){if(w.nodeType===Node.ELEMENT_NODE&&w.tagName==="STYLE")return b(null);Rt(w,e,n).then(k=>{b(k||null)}).catch(()=>{b(null)})};try{let w=t.shadowRoot.querySelectorAll("slot");for(let b of w){let k=[];try{k=b.assignedNodes?.({flatten:!0})||b.assignedNodes?.()||[]}catch{k=b.assignedNodes?.()||[]}for(let A of k)o.add(A)}}catch{}let u=Qe(e),f=`[data-sd="${u}"]`;try{s.setAttribute("data-sd",u)}catch{}let m=Je(t.shadowRoot),h=Ke(m,f),y=en(m),p=nn(t,y,f);Ze(s,p+h,u);let d=document.createDocumentFragment(),S=await Yt(Array.from(t.shadowRoot.childNodes),g,n.fast);d.append(...S.filter(w=>!!w)),s.appendChild(d)}if(t.tagName==="SLOT"){let h=function(p,d){Rt(p,e,n).then(g=>{g&&on(g),d(g||null)}).catch(()=>{d(null)})},u=t.assignedNodes?.({flatten:!0})||[],f=u.length>0?u:Array.from(t.childNodes),m=document.createDocumentFragment(),y=await Yt(Array.from(f),h,n.fast);return m.append(...y.filter(p=>!!p)),m}function c(u,f){if(o.has(u))return f(null);Rt(u,e,n).then(m=>{f(m||null)}).catch(()=>{f(null)})}let a=await Yt(Array.from(t.childNodes),c,n.fast);if(s.append(...a.filter(u=>!!u)),i!==null&&s instanceof HTMLSelectElement){s.value=i;for(let u of s.options)u.value===i?u.setAttribute("selected",""):u.removeAttribute("selected")}return r!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=r),s}G();vt();Y();var rr=[/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],wt=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__||{}),Se=[];function ln(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Se.push(n):typeof n=="string"?Se.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function K(t){let e=typeof t=="string"?t:"",n=[...rr,...Se];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 sr(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var cn=new Map;function ir(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 ar(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 l=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?c="rounded":/\bsharp\b/.test(r)?c="sharp":/\boutlined\b/.test(r)&&(c="outlined");let a=l===1,u=null;if(a&&(c==="outlined"&&wt.materialIconsFilled?u={url:wt.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&wt.materialIconsRound?u={url:wt.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&wt.materialIconsSharp&&(u={url:wt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!u)return{familyForMeasure:o,familyForCanvas:o};if(!cn.has(u.alias))try{let m=new FontFace(u.alias,`url(${u.url})`,{style:"normal",weight:"400"});document.fonts.add(m),await m.load(),cn.set(u.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let f=`"${u.alias}"`;return{familyForMeasure:f,familyForCanvas:f}}async function cr(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function lr(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 ur(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:i="#000",variation:r="",className:s=""}={}){let l=String(e||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,a=ir(r),{familyForMeasure:u,familyForCanvas:f}=await ar(l,s,a);await cr(f.replace(/^["']+|["']+$/g,""),o);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=u,m.style.fontWeight=String(n||"normal"),m.style.fontSize=`${o}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 h=m.getBoundingClientRect(),y=Math.max(1,Math.ceil(h.width)),p=Math.max(1,Math.ceil(h.height));document.body.removeChild(m);let d=document.createElement("canvas");d.width=y*c,d.height=p*c;let g=d.getContext("2d");g.scale(c,c),g.font=`${n?`${n} `:""}${o}px ${f}`,g.textAlign="left",g.textBaseline="top",g.fillStyle=i;try{g.fontKerning="normal"}catch{}return g.fillText(t,0,0),{dataUrl:d.toDataURL(),width:y,height:p}}async function un(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim());if(o.length===0)return 0;let i=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(s=>s&&s.textContent&&s.textContent.trim()):[],r=0;for(let s=0;s<o.length;s++){let l=o[s],c=i[s]||null;try{let a=getComputedStyle(c||l),u=a.fontFamily||"Material Icons";if(!sr(u))continue;let f=(c||l).textContent.trim();if(!f)continue;let m=parseInt(a.fontSize,10)||24,h=a.fontWeight&&a.fontWeight!=="normal"?a.fontWeight:"normal",y=lr(a),p=a.fontVariationSettings&&a.fontVariationSettings!=="normal"?a.fontVariationSettings:"",d=(c||l).className||"",{dataUrl:g,width:S,height:w}=await ur(f,{family:u,weight:h,fontSize:m,color:y,variation:p,className:d});l.textContent="";let b=l.ownerDocument.createElement("img");b.src=g,b.alt=f,b.style.height=`${m}px`,b.style.width=`${Math.max(1,Math.round(S/w*m))}px`,b.style.objectFit="contain",b.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(b),r++}catch{}}return r}ft();async function mn(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 l=s.getBoundingClientRect(),c=Math.ceil(l.width),a=Math.ceil(l.height);document.body.removeChild(s);let u=document.createElement("canvas");u.width=Math.max(1,c*r),u.height=Math.max(1,a*r);let f=u.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:u.toDataURL(),width:c,height:a}}var fr=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),dr=["katex","mathjax","mathml"];function Jt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!fr.has(n.toLowerCase()))return n}return""}function Gt(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 Kt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function mr(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function pr(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=Gt(n[1]),r=Gt(n[2]);return{min:Math.min(i,r),max:Math.max(i,r)}}let o=Gt(e);return{min:o,max:o}}function hr(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function gr(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 yr(t){return!t||typeof t!="string"?"":t.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function br(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(c=>r.endsWith(c))||n.some(c=>r===c.toLowerCase()||r.endsWith("."+c.toLowerCase())))return!0;let l=(o.pathname+o.search).toLowerCase();if(/\bfont(s)?\b/.test(l)||/\.woff2?(\b|$)/.test(l)||dr.some(c=>l.includes(c)))return!0;for(let c of e){let a=c.toLowerCase().replace(/\s+/g,"+"),u=c.toLowerCase().replace(/\s+/g,"-"),f=yr(c);if(l.includes(a)||l.includes(u)||f&&l.includes(f))return!0}return!1}catch{return!1}}function wr(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function fn(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 xe=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Qt=4;async function Sr(t,e,n){if(!t)return t;let o=new Set;function i(l,c){try{return new URL(l,c||location.href).href}catch{return l}}async function r(l,c,a=0){if(a>Qt)return console.warn(`[snapDOM] @import depth exceeded (${Qt}) at ${c}`),l;let u="",f=0,m;for(;m=xe.exec(l);){u+=l.slice(f,m.index),f=xe.lastIndex;let h=(m[2]||m[4]||"").trim(),y=i(h,c);if(o.has(y)){console.warn(`[snapDOM] Skipping circular @import: ${y}`);continue}o.add(y);let p="";try{let d=await U(y,{as:"text",useProxy:n,silent:!0});d.ok&&typeof d.data=="string"&&(p=d.data)}catch{}p?(p=fn(p,y),p=await r(p,y,a+1),u+=`
|
|
7
|
+
var Fo=Object.defineProperty;var q=(t,e)=>()=>(t&&(e=t(t=0)),e);var Mt=(t,e)=>{for(var n in e)Fo(t,n,{get:e[n],enumerable:!0})};function Ue(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 jt(t="soft"){switch(x.session.__counterEpoch=(x.session.__counterEpoch||0)+1,t){case"auto":{x.session.styleMap=new Map,x.session.nodeMap=new Map;return}case"soft":{x.session.styleMap=new Map,x.session.nodeMap=new Map,x.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{x.session.styleMap=new Map,x.session.nodeMap=new Map,x.session.styleCache=new WeakMap,x.computedStyle=new WeakMap,x.baseStyle=new U(50),x.defaultStyle=new U(30),x.image=new U(100),x.background=new U(100),x.resource=new U(150),x.font=new Set;return}default:{x.session.styleMap=new Map,x.session.nodeMap=new Map,x.session.styleCache=new WeakMap;return}}}var U,x,X=q(()=>{U=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)}},x={image:new U(100),background:new U(100),resource:new U(150),defaultStyle:new U(30),baseStyle:new U(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function mt(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function ce(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==6?`matrix(${o})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==16?`matrix3d(${o})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function lt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function le(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 Ft=q(()=>{});function $o(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,s=0;function r(i,u,a){if(s>=n)return;let l=Date.now();(o.get(u)||0)>l||(o.set(u,l+e),s++,i==="warn"&&console&&console.warn?console.warn(`${t} ${a}`):console&&console.error&&console.error(`${t} ${a}`))}return{warnOnce(i,u){r("warn",i,u)},errorOnce(i,u){r("error",i,u)},reset(){o.clear(),s=0}}}function Ro(t){return/^data:|^blob:|^about:blank$/i.test(t)}function Lo(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(o||".",n),r=new URL(t,n);if(r.origin===s.origin)return!0;let i=r.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function No(t,e){if(!e||Ro(t)||Lo(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 To(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",lt(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}${lt(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function De(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 Io(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function O(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,s=e.useProxy||"",r=e.errorTTL??8e3,i=e.headers||{},u=!!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[,p="",g=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],S=/;base64/i.test(p)?atob(g):decodeURIComponent(g),b=new Uint8Array([...S].map(A=>A.charCodeAt(0))),C=new Blob([b],{type:(p||"").split(";")[0]||""});return{ok:!0,data:C,status:200,url:t,fromCache:!1,mime:C.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let p=await fetch(t);if(!p.ok)return{ok:!1,data:null,status:p.status,url:t,fromCache:!1,reason:"http_error"};let g=await p.blob(),w=g.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await De(g),status:p.status,url:t,fromCache:!1,mime:w}:n==="text"?{ok:!0,data:await g.text(),status:p.status,url:t,fromCache:!1,mime:w}:{ok:!0,data:g,status:p.status,url:t,fromCache:!1,mime:w}}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 a=Io(t,{as:n,timeout:o,useProxy:s,errorTTL:r}),l=qt.get(a);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&qt.delete(a);let c=ue.get(a);if(c)return c;let f=No(t,s)?To(t,s):t,d=e.credentials;if(!d)try{let p=typeof location<"u"&&location.href?location.href:"http://localhost/",g=new URL(t,p);d=typeof location<"u"&&g.origin===location.origin?"include":"omit"}catch{d="omit"}let h=new AbortController,y=setTimeout(()=>h.abort("timeout"),o),m=(async()=>{try{let p=await fetch(f,{signal:h.signal,credentials:d,headers:i});if(!p.ok){let S={ok:!1,data:null,status:p.status,url:f,fromCache:!1,reason:"http_error"};if(r>0&&qt.set(a,{until:Date.now()+r,result:S}),!u){let b=`${p.status} ${p.statusText||""}`.trim();Be.warnOnce(`http:${p.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${b} while fetching ${n} ${t}`)}return e.onError&&e.onError(S),S}if(n==="text")return{ok:!0,data:await p.text(),status:p.status,url:f,fromCache:!1};let g=await p.blob(),w=g.type||p.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await De(g),status:p.status,url:f,fromCache:!1,mime:w}:{ok:!0,data:g,status:p.status,url:f,fromCache:!1,mime:w}}catch(p){let g=p&&typeof p=="object"&&"name"in p&&p.name==="AbortError"?String(p.message||"").includes("timeout")?"timeout":"abort":"network",w={ok:!1,data:null,status:0,url:f,fromCache:!1,reason:g};if(!/^blob:/i.test(t)&&r>0&&qt.set(a,{until:Date.now()+r,result:w}),!u){let S=`${g}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,b=g==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:g==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Be.errorOnce(S,b)}return e.onError&&e.onError(w),w}finally{clearTimeout(y),ue.delete(a)}})();return ue.set(a,m),m}var Be,ue,qt,pt=q(()=>{Ft();Be=$o("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ue=new Map,qt=new Map});async function ht(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=mt(t);if(!o)return t;let s=le(o),r=lt(s);if(x.background.has(r)){let i=x.background.get(r);return i?`url("${i}")`:"none"}try{let i=await O(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(x.background.set(r,i.data),`url("${i.data}")`):(x.background.set(r,null),"none")}catch{return x.background.set(r,null),"none"}}var He=q(()=>{X();Ft();pt()});function fe(){for(let t of Po){let e=String(t).toLowerCase();zt.has(e)||Xt.has(e)||de(e)}}function de(t){if(t=String(t).toLowerCase(),Xt.has(t)){let r={};return x.defaultStyle.set(t,r),r}if(x.defaultStyle.has(t))return x.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),s={};for(let r of o){if($t(r))continue;let i=o.getPropertyValue(r);s[r]=i}return e.removeChild(n),x.defaultStyle.set(t,s),s}function $t(t){let e=String(t).toLowerCase();return!!(Oo.has(e)||Wo.test(e)||_o.test(e))}function bt(t,e){if(e=String(e||"").toLowerCase(),Xt.has(e))return"";let n=[],o=de(e),u=(t.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(e);for(let[a,l]of Object.entries(t)){if($t(a)||u&&(a==="width"||a==="min-width"||a==="max-width"))continue;let c=o[a];l&&l!==c&&n.push(`${a}:${l}`)}return n.sort(),n.join(";")}function me(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 pe(t){let e=new Map;for(let o of t){let s=x.defaultStyle.get(o);if(!s)continue;let r=Object.entries(s).map(([i,u])=>`${i}:${u};`).sort().join("");r&&(e.has(r)||e.set(r,[]),e.get(r).push(o))}let n="";for(let[o,s]of e.entries())n+=`${s.join(",")} { ${o} }
|
|
8
|
+
`;return n}function he(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let s of e)n.set(s,`c${o++}`);return n}function Uo(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 H(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=x.computedStyle.get(t);o||(o=new Map,x.computedStyle.set(t,o));let s=o.get(e);if(!s){let r=Uo(t),i=null;try{i=r&&typeof r.getComputedStyle=="function"?r.getComputedStyle(t,e):null}catch{}if(!i&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{t.ownerDocument===document&&(i=window.getComputedStyle(t,e))}catch{}s=i||n(),o.set(e,s)}return s}function Yt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function wt(t){let e=[],n=0,o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}var zt,Xt,Po,_o,Wo,Oo,ge=q(()=>{X();zt=new Set(["meta","script","noscript","title","link","template"]),Xt=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"]),Po=["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"];_o=/(?:^|-)(animation|transition)(?:-|$)/i,Wo=/^(--.+|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,Oo=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope","zoom"])});function ot(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function ye(){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 V(){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),s=/mobile/i.test(t),r=!/safari/i.test(t),i=o&&s&&r,u=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),a=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),l=/ipad|iphone|ipod/.test(e)&&o;return n||i||u||a||l}function Ve(){if(typeof navigator>"u")return!1;let t=(navigator.userAgent||"").toLowerCase();return t.includes("firefox")||t.includes("fxios")}var St=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 be=q(()=>{});var G=q(()=>{He();ge();St();Ft();be()});var fo={};Mt(fo,{toCanvas:()=>gt});function ti(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function ei(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function ni(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function oi(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let r=t[s];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(s=>s.trim()).filter(Boolean)}function ri(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&o++,i===")"&&(o=Math.max(0,o-1)),i===","&&o===0?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());let s=[];for(let r of e){if(/\binset\b/i.test(r))continue;let i=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[u="0px",a="0px",l="0px"]=i,c=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),f=!!c&&c!==",";s.push(`drop-shadow(${u} ${a} ${l}${f?` ${c}`:""})`)}return s.join(" ")}function uo(t){let e=oi(t),n=null,o=null,s=null,r=[];for(let u of e){let a=u.indexOf(":");if(a<0)continue;let l=u.slice(0,a).trim().toLowerCase(),c=u.slice(a+1).trim();l==="box-shadow"?s=c:l==="filter"?n=c:l==="-webkit-filter"?o=c:r.push([l,c])}if(s){let u=ri(s);u&&(n=n?`${n} ${u}`:u,o=o?`${o} ${u}`:u)}let i=[...r];return n&&i.push(["filter",n]),o&&i.push(["-webkit-filter",o]),i.map(([u,a])=>`${u}:${a}`).join(";")}function ii(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${uo(o)}}`)}function si(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,ii(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${uo(o)}${n}`),t}function ai(t){if(!V()||!ti(t))return t;try{let e=ei(t),n=si(e);return ni(n)}catch{return t}}async function gt(t,e){let{width:n,height:o,scale:s=1,dpr:r=1,meta:i={},backgroundColor:u}=e;t=ai(t);let a=new Image;a.loading="eager",a.decoding="sync",a.crossOrigin="anonymous",a.src=t,await a.decode();let l=a.naturalWidth,c=a.naturalHeight,f=Number.isFinite(i.w0)?i.w0:l,d=Number.isFinite(i.h0)?i.h0:c,h,y,m=Number.isFinite(n),p=Number.isFinite(o);if(m&&p)h=Math.max(1,n),y=Math.max(1,o);else if(m){let S=n/Math.max(1,f);h=n,y=d*S}else if(p){let S=o/Math.max(1,d);y=o,h=f*S}else h=l,y=c;h=h*s,y=y*s;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let w=g.getContext("2d");return r!==1&&w.scale(r,r),u&&(w.save(),w.fillStyle=u,w.fillRect(0,0,h,y),w.restore()),w.drawImage(a,0,0,h,y),g}var _t=q(()=>{St()});var re={};Mt(re,{rasterize:()=>Le});async function Le(t,e){let n=await gt(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 Wt=q(()=>{_t()});var Ne={};Mt(Ne,{toImg:()=>ci,toSvg:()=>ci});async function ci(t,e){let{scale:n=1,width:o,height:s,meta:r={}}=e,i=Number.isFinite(o),u=Number.isFinite(s),a=Number.isFinite(n)&&n!==1||i||u;if(V()&&a)return await Le(t,{...e,format:"png",quality:1,meta:r});let l=new Image;if(l.decoding="sync",l.loading="eager",l.src=t,await l.decode(),i&&u)l.style.width=`${o}px`,l.style.height=`${s}px`;else if(i){let c=Number.isFinite(r.w0)?r.w0:l.naturalWidth,f=Number.isFinite(r.h0)?r.h0:l.naturalHeight,d=o/Math.max(1,c);l.style.width=`${o}px`,l.style.height=`${Math.round(f*d)}px`}else if(u){let c=Number.isFinite(r.w0)?r.w0:l.naturalWidth,f=Number.isFinite(r.h0)?r.h0:l.naturalHeight,d=s/Math.max(1,f);l.style.height=`${s}px`,l.style.width=`${Math.round(c*d)}px`}else{let c=Math.round(l.naturalWidth*n),f=Math.round(l.naturalHeight*n);if(l.style.width=`${c}px`,l.style.height=`${f}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${c}"`).replace(/height="[^"]*"/,`height="${f}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,l.src=t}catch(d){R(e,"SVG width/height patch in toImg failed",d)}}return l}var Te=q(()=>{G();Wt()});var mo={};Mt(mo,{toBlob:()=>Ie});async function Ie(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await gt(t,e);return new Promise(s=>o.toBlob(r=>s(r),`image/${n}`,e.quality))}var Pe=q(()=>{_t()});var ho={};Mt(ho,{download:()=>li});async function po(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 li(t,e){let n=new Set(["png","jpeg","jpg","webp","svg"]),o=(e?.type||"").toLowerCase(),s=n.has(o)?o:"",r=(e?.format||s||"").toLowerCase(),i=r==="jpg"?"jpeg":r||"png",u=e?.filename||`snapdom.${i}`,a={...e||{},format:i,type:i};a.dpr=1;let l=ye();if(i==="svg"){let d=await Ie(t,{...a,type:"svg"});if(l&&await po(d,u))return;let h=URL.createObjectURL(d),y=document.createElement("a");y.href=h,y.download=u,document.body.appendChild(y),y.click(),URL.revokeObjectURL(h),y.remove();return}let c=await gt(t,a);if(l){let d=`image/${i}`,h=await new Promise(y=>c.toBlob(y,d,e?.quality));if(h&&await po(h,u))return}let f=document.createElement("a");f.href=c.toDataURL(`image/${i}`,e?.quality),f.download=u,document.body.appendChild(f),f.click(),f.remove()}var go=q(()=>{Pe();_t();St()});G();G();X();var je=new WeakMap,Lt=new Map,Bo=2e3,we=0;function Rt(){we++,Lt.size>Bo&&Lt.clear()}var qe=!1;function Do(t=document.documentElement){if(!qe){qe=!0;try{new MutationObserver(()=>Rt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Rt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Rt),e.ready?.then(()=>Rt()).catch(()=>{}))}catch{}}}function Ho(t,e={}){let n={},o=t.getPropertyValue("visibility"),s=e.excludeStyleProps;for(let f=0;f<t.length;f++){let d=t[f];if($t(d)||s&&(s instanceof RegExp&&s.test(d)||typeof s=="function"&&s(d)))continue;let h=t.getPropertyValue(d);(d==="background-image"||d==="content")&&h.includes("url(")&&!h.includes("data:")&&(h="none"),n[d]=h}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 i=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let f of i)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 h=t.getPropertyValue(d);h&&(n[d]=h)}catch{}}o==="hidden"&&(n.opacity="0");try{(n["content-visibility"]||t.getPropertyValue("content-visibility"))==="hidden"&&(n.visibility="hidden")}catch{}let u=parseFloat(t.getPropertyValue("border-top-width")||0)||0,a=parseFloat(t.getPropertyValue("border-right-width")||0)||0,l=parseFloat(t.getPropertyValue("border-bottom-width")||0)||0,c=parseFloat(t.getPropertyValue("border-left-width")||0)||0;if(u===0&&a===0&&l===0&&c===0){let f=(t.getPropertyValue("border-image-source")||"").trim(),d=f&&f!=="none",h=["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 y of h)delete n[y];d||(n.border="none")}return n}var ze=new WeakMap;function Vo(t){let e=ze.get(t);return e||(e=Object.entries(t).sort((o,s)=>o[0]<s[0]?-1:o[0]>s[0]?1:0).map(([o,s])=>`${o}:${s}`).join(";"),ze.set(t,e),e)}function jo(t,e=null,n={}){let o=je.get(t);if(o&&o.epoch===we)return o.snapshot;let s=e||getComputedStyle(t),r=Ho(s,n);return Qo(t,s,r),je.set(t,{epoch:we,snapshot:r}),r}function qo(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Lt,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:e||{}}:{session:x.session,persist:{snapshotKeyCache:Lt,defaultStyle:x.defaultStyle,baseStyle:x.baseStyle,image:x.image,resource:x.resource,background:x.background,font:x.font},options:t||e||{}}}function zo(t,e,n){if(!(!t.style||t.style.length===0))for(let o=0;o<t.style.length;o++){let s=t.style[o],r=n.getPropertyValue(s);r&&e.style.setProperty(s,r)}}async function rt(t,e,n,o){if(t.tagName==="STYLE")return;let s=qo(n,o),r=s.options&&s.options.cache||"auto";r!=="disabled"&&Do(document.documentElement),r==="disabled"&&!s.session.__bumpedForDisabled&&(Rt(),Lt.clear(),s.session.__bumpedForDisabled=!0);let{session:i,persist:u}=s;if(!i.styleCache.has(t)){let d=null;try{d=getComputedStyle(t)}catch{}i.styleCache.set(t,d||getComputedStyle(document.documentElement))}let a=i.styleCache.get(t);t.getAttribute?.("style")&&zo(t,e,a);let l=jo(t,a,s.options),c=Vo(l),f=u.snapshotKeyCache.get(c);if(!f){let d=t.tagName?.toLowerCase()||"div";f=bt(l,d),u.snapshotKeyCache.set(c,f)}i.styleMap.set(e,f)}function Xo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Yo(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 Go(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Ko(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 s=t.scrollHeight;if(s===0)return!1;let r=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return s>r+i}function Qo(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 u=e.display||"";if(u.includes("flex")||u.includes("grid")||Xo(t))return;let a=e.position;if(a==="absolute"||a==="fixed"||a==="sticky"||e.transform!=="none"||Yo(e)||Go(t))return;let l=e.overflowX||e.overflow||"visible",c=e.overflowY||e.overflow||"visible";if(l!=="visible"||c!=="visible")return;let f=e.clip;f&&f!=="auto"&&f!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Ko(t,e)&&(delete n.height,delete n["block-size"])}ge();var Ye=["fill","stroke","color","background-color","stop-color"],Xe=new Map;function Jo(t,e){let n=e+"::"+t.toLowerCase(),o=Xe.get(n);if(o)return o;let s=document,r=e==="http://www.w3.org/2000/svg"?s.createElementNS(e,t):s.createElement(t),i=s.createElement("div");i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(r),s.documentElement.appendChild(i);let u=getComputedStyle(r),a={};for(let l of Ye)a[l]=u.getPropertyValue(l)||"";return i.remove(),Xe.set(n,a),a}function Ge(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let u=r[i];if(u&&typeof u.value=="string"&&u.value.includes("var(")){o=!0;break}}}let s=null;if(o)try{s=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length){let i=new Set;for(let u=0;u<r.length;u++){let a=r[u];if(i.has(a))continue;i.add(a);let l=r.getPropertyValue(a);if(!l||!l.includes("var("))continue;let c=s&&s.getPropertyValue(a);if(c)try{e.style.setProperty(a,c.trim(),r.getPropertyPriority(a))}catch{}}}}if(o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let u=r[i];if(!u||typeof u.value!="string"||!u.value.includes("var("))continue;let a=u.name,l=s&&s.getPropertyValue(a);if(l)try{e.style.setProperty(a,l.trim())}catch{}}}if(!o){if(!s)try{s=getComputedStyle(t)}catch{s=null}if(!s)return;let r=t.namespaceURI||"html",i=Jo(t.tagName,r);for(let u of Ye){let a=s.getPropertyValue(u)||"",l=i[u]||"";if(a&&a!==l)try{e.style.setProperty(u,a.trim())}catch{}}}}G();G();X();pt();function Kt(t,e,n){return Promise.all(t.map(o=>new Promise(s=>{function r(){ot(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,s):r()},{fast:n})}r()})))}function Zo(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function tr(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let s=n?Zo(o):o;return`:where(${e} ${s})`}).join(", ")}function Qe(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,s,r)=>{let i=tr(r,e,!0);return`${o}${s}${i}{`}),t):""}function Je(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Ze(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 s of o.cssRules)e+=s.cssText+`
|
|
10
|
+
`}catch{}}catch{}return e}function tn(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 en(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 nn(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 er(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 on(t,e,n){let o=[];for(let s of e){let r=er(t,s);r&&o.push(`${s}: ${r};`)}return o.length?`${n}{${o.join("")}}
|
|
11
|
+
`:""}function rn(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 nr(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),s=0;for(;s<e&&(!o||!o.body&&!o.documentElement);)await new Promise(r=>setTimeout(r,0)),o=n(),s++;return o&&(o.body||o.documentElement)?o:null}function or(t){let e=t.getBoundingClientRect(),n=0,o=0,s=0,r=0;try{let a=getComputedStyle(t);n=parseFloat(a.borderLeftWidth)||0,o=parseFloat(a.borderRightWidth)||0,s=parseFloat(a.borderTopWidth)||0,r=parseFloat(a.borderBottomWidth)||0}catch{}let i=Math.max(0,Math.round(e.width-(n+o))),u=Math.max(0,Math.round(e.height-(s+r)));return{contentWidth:i,contentHeight:u,rect:e}}function K(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 s=parseFloat(o.width);!isNaN(s)&&s>0&&(e=s)}if(n===0){let s=parseFloat(o.height);!isNaN(s)&&s>0&&(n=s)}}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 rr(t,e,n){let o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.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(o),()=>{try{o.remove()}catch{}}}async function sn(t,e,n){let o=await nr(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:s,contentHeight:r,rect:i}=or(t),u=n?.snap;if(!u&&typeof window<"u"&&window.snapdom&&(u=window.snapdom),!u||typeof u.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 a={...n,scale:1},l=rr(o,s,r),c;try{c=await u.toPng(o.documentElement,a)}finally{l()}c.style.display="block",c.style.width=`${s}px`,c.style.height=`${r}px`;let f=document.createElement("div");return e.nodeMap.set(f,t),rt(t,f,e,n),f.style.overflow="hidden",f.style.display="block",f.style.width||(f.style.width=`${Math.round(i.width)}px`),f.style.height||(f.style.height=`${Math.round(i.height)}px`),f.appendChild(c),f}function an(t){let{width:e,height:n}=K(t),o=t.getBoundingClientRect(),s;try{s=window.getComputedStyle(t)}catch{}let r=s?parseFloat(s.width):NaN,i=s?parseFloat(s.height):NaN,u=Math.round(e||o.width||0),a=Math.round(n||o.height||0),l=Number.isFinite(r)&&r>0?Math.round(r):Math.max(12,u||16),c=Number.isFinite(i)&&i>0?Math.round(i):Math.max(12,a||16),f=(t.type||"text").toLowerCase()==="checkbox",d=!!t.checked,h=!!t.indeterminate,m=Math.max(Math.min(l,c),12),p="middle";try{s&&s.verticalAlign&&(p=s.verticalAlign)}catch{}let g=document.createElement("div");g.setAttribute("data-snapdom-input-replacement",t.type||"checkbox"),g.style.cssText=`display:inline-block;width:${m}px;height:${m}px;vertical-align:${p};flex-shrink:0;line-height:0;`;let w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.setAttribute("width",String(m)),w.setAttribute("height",String(m)),w.setAttribute("viewBox",`0 0 ${m} ${m}`),g.appendChild(w);function S(){let b="#0a6ed1";try{s&&(b=s.accentColor||s.color||b)}catch{}let C=2,A=C/2,k=m-C;if(w.innerHTML="",f){let v=document.createElementNS("http://www.w3.org/2000/svg","rect");if(v.setAttribute("x",String(A)),v.setAttribute("y",String(A)),v.setAttribute("width",String(k)),v.setAttribute("height",String(k)),v.setAttribute("rx","2"),v.setAttribute("ry","2"),v.setAttribute("fill",d?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(C)),w.appendChild(v),d){let M=document.createElementNS("http://www.w3.org/2000/svg","path");M.setAttribute("d",`M ${A+2} ${m/2} L ${m/2-1} ${m-A-2} L ${m-A-2} ${A+2}`),M.setAttribute("stroke","white"),M.setAttribute("stroke-width",String(Math.max(1.5,C))),M.setAttribute("fill","none"),M.setAttribute("stroke-linecap","round"),M.setAttribute("stroke-linejoin","round"),w.appendChild(M)}else if(h){let M=document.createElementNS("http://www.w3.org/2000/svg","rect"),N=Math.max(6,k-4);M.setAttribute("x",String((m-N)/2)),M.setAttribute("y",String((m-C)/2)),M.setAttribute("width",String(N)),M.setAttribute("height",String(C)),M.setAttribute("fill",b),M.setAttribute("rx","1"),w.appendChild(M)}}else{let v=document.createElementNS("http://www.w3.org/2000/svg","circle");if(v.setAttribute("cx",String(m/2)),v.setAttribute("cy",String(m/2)),v.setAttribute("r",String((m-C)/2)),v.setAttribute("fill",d?b:"none"),v.setAttribute("stroke",b),v.setAttribute("stroke-width",String(C)),w.appendChild(v),d){let M=document.createElementNS("http://www.w3.org/2000/svg","circle"),N=Math.max(2,(m-C*2)*.35);M.setAttribute("cx",String(m/2)),M.setAttribute("cy",String(m/2)),M.setAttribute("r",String(N)),M.setAttribute("fill","white"),w.appendChild(M)}}g.style.setProperty("width",`${m}px`,"important"),g.style.setProperty("height",`${m}px`,"important"),g.style.setProperty("min-width",`${m}px`,"important"),g.style.setProperty("min-height",`${m}px`,"important")}return S(),{el:g,applyVisual:S}}var Nt=new U(80);async function Tt(t){if(x.resource?.has(t))return x.resource.get(t);if(Nt.has(t))return Nt.get(t);let e=(async()=>{let n=await O(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return x.resource?.set(t,n.data),n.data})();Nt.set(t,e);try{let n=await e;return Nt.set(t,n),n}catch(n){throw Nt.delete(t),n}}var ir=/\bblob:[^)"'\s]+/g;async function Ke(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ir)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let s=await Tt(o);n=n.split(o).join(s)}catch{}return n}function Gt(t){return typeof t=="string"&&t.startsWith("blob:")}function sr(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 ar(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function cn(t,e=null){if(!t)return;let n=e,o=t.querySelectorAll?t.querySelectorAll("img"):[];for(let a of o)try{let c=a.getAttribute("src")||a.currentSrc||"";if(Gt(c)){let d=await Tt(c);a.setAttribute("src",d)}let f=a.getAttribute("srcset");if(f&&f.includes("blob:")){let d=sr(f),h=!1;for(let y of d)if(Gt(y.url))try{y.url=await Tt(y.url),h=!0}catch(m){R(n,"blobUrlToDataUrl for srcset item failed",m)}h&&a.setAttribute("srcset",ar(d))}}catch(l){R(n,"resolveBlobUrls for img failed",l)}let s=t.querySelectorAll?t.querySelectorAll("image"):[];for(let a of s)try{let l="http://www.w3.org/1999/xlink",c=a.getAttribute("href")||a.getAttributeNS?.(l,"href");if(Gt(c)){let f=await Tt(c);a.setAttribute("href",f),a.removeAttributeNS?.(l,"href")}}catch(l){R(n,"resolveBlobUrls for SVG image href failed",l)}let r=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let a of r)try{let l=a.getAttribute("style");if(l&&l.includes("blob:")){let c=await Ke(l);a.setAttribute("style",c)}}catch(l){R(n,"replaceBlobUrls in inline style failed",l)}let i=t.querySelectorAll?t.querySelectorAll("style"):[];for(let a of i)try{let l=a.textContent||"";l.includes("blob:")&&(a.textContent=await Ke(l))}catch(l){R(n,"replaceBlobUrls in style tag failed",l)}let u=["poster"];for(let a of u){let l=t.querySelectorAll?t.querySelectorAll(`[${a}^='blob:']`):[];for(let c of l)try{let f=c.getAttribute(a);Gt(f)&&c.setAttribute(a,await Tt(f))}catch(f){R(n,`resolveBlobUrls for ${a} failed`,f)}}}St();async function It(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,s=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")||zt.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"){let c=document.createElement("div"),{width:f,height:d}=K(t),h=f||t.getBoundingClientRect().width||0,y=d||t.getBoundingClientRect().height||0;return c.style.cssText=`display:inline-block;width:${h}px;height:${y}px;visibility:hidden;`,c}else 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"){let f=document.createElement("div"),{width:d,height:h}=K(t),y=d||t.getBoundingClientRect().width||0,m=h||t.getBoundingClientRect().height||0;return f.style.cssText=`display:inline-block;width:${y}px;height:${m}px;visibility:hidden;`,f}else 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"){let c=document.createElement("div"),{width:f,height:d}=K(t),h=f||t.getBoundingClientRect().width||0,y=d||t.getBoundingClientRect().height||0;return c.style.cssText=`display:inline-block;width:${h}px;height:${y}px;visibility:hidden;`,c}else 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 sn(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}=K(t),h=document.createElement("div");return h.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;`,rt(t,h,e,n),h}else{let{width:f,height:d}=K(t),h=document.createElement("div");return h.style.cssText=`display:inline-block;width:${f}px;height:${d}px;visibility:hidden;`,rt(t,h,e,n),h}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),rt(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 y=t.getContext("2d",{willReadFrequently:!0});try{y&&y.getImageData(0,0,1,1)}catch{}if(await new Promise(m=>requestAnimationFrame(m)),c=t.toDataURL("image/png"),!c||c==="data:,"){try{y&&y.getImageData(0,0,1,1)}catch{}if(await new Promise(m=>requestAnimationFrame(m)),c=t.toDataURL("image/png"),!c||c==="data:,"){let m=document.createElement("canvas");m.width=t.width,m.height=t.height;let p=m.getContext("2d");p&&(p.drawImage(t,0,0),c=m.toDataURL("image/png"))}}}catch(y){R(e,"Canvas toDataURL failed, using empty/fallback",y)}let f=document.createElement("img");try{f.decoding="sync",f.loading="eager"}catch(y){R(e,"img decoding/loading hints failed",y)}c&&(f.src=c),f.width=t.width,f.height=t.height;let{width:d,height:h}=K(t);return d>0&&(f.style.width=`${d}px`),h>0&&(f.style.height=`${h}px`),e.nodeMap.set(f,t),rt(t,f,e,n),f}if(t.tagName==="VIDEO"){let c="";try{let y=document.createElement("canvas");y.width=t.videoWidth||t.offsetWidth||320,y.height=t.videoHeight||t.offsetHeight||240;let m=y.getContext("2d");m&&(m.drawImage(t,0,0,y.width,y.height),c=y.toDataURL("image/png"),(!c||c==="data:,")&&(c=""))}catch(y){R(e,"Video frame capture failed, using poster fallback",y)}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:h}=K(t);return d>0&&(f.style.width=`${d}px`),h>0&&(f.style.height=`${h}px`),f.style.objectFit="contain",e.nodeMap.set(f,t),rt(t,f,e,n),f}let i;try{if(i=t.cloneNode(!1),i.attributes?.length)try{for(let c of i.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(c.value)&&i.setAttribute(c.name,c.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,""))}catch{}if(Ge(t,i),e.nodeMap.set(i,t),t.tagName==="IMG"){en(t,i);try{let{width:c,height:f}=K(t),d=Math.round(c||0),h=Math.round(f||0);d&&(i.dataset.snapdomWidth=String(d)),h&&(i.dataset.snapdomHeight=String(h))}catch(c){R(e,"getUnscaledDimensions for IMG failed",c)}try{let c=t.getAttribute("style")||"",f=window.getComputedStyle(t),d=S=>{let b=c.match(new RegExp(`${S}\\s*:\\s*([^;]+)`,"i")),C=b?b[1].trim():f.getPropertyValue(S);return/%|auto/i.test(String(C||""))},h=parseInt(i.dataset.snapdomWidth||"0",10),y=parseInt(i.dataset.snapdomHeight||"0",10),m=d("width")||!h,p=d("height")||!y;m&&h&&(i.style.width=`${h}px`),p&&y&&(i.style.height=`${y}px`);let g=f.getPropertyValue("object-fit"),w=f.getPropertyValue("object-position");g&&g!=="fill"?(i.style.objectFit=g,w&&(i.style.objectPosition=w)):(h&&(i.style.minWidth=`${h}px`),y&&(i.style.minHeight=`${y}px`))}catch(c){R(e,"IMG dimension freeze failed",c)}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}let u=null;if(t instanceof HTMLTextAreaElement){let{width:c,height:f}=K(t),d=c||t.getBoundingClientRect().width||0,h=f||t.getBoundingClientRect().height||0;d&&(i.style.width=`${d}px`),h&&(i.style.height=`${h}px`)}if(t instanceof HTMLInputElement){let c=(t.type||"text").toLowerCase();if((c==="checkbox"||c==="radio")&&Ve()){let{el:d,applyVisual:h}=an(t);e.nodeMap.set(d,t),u=h,i=d}else i.value=t.value,i.setAttribute("value",t.value),t.checked!==void 0&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.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);i.classList.add(d);let h=document.createElement("style");h.textContent=`.${d}::placeholder{color:${f}!important;opacity:${c.opacity||"1"}!important;}`,i.prepend(h)}}catch{}if(t instanceof HTMLSelectElement&&(s=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement){t.disabled&&i.setAttribute("disabled",""),t.required&&i.setAttribute("required",""),t.readOnly&&i.setAttribute("readonly","");let c=t;c.min!==void 0&&c.min!==""&&i.setAttribute("min",c.min),c.max!==void 0&&c.max!==""&&i.setAttribute("max",c.max),c.pattern!==void 0&&c.pattern!==""&&i.setAttribute("pattern",c.pattern);let f=t.getAttribute("aria-invalid");f!==null&&i.setAttribute("aria-invalid",f)}if(rt(t,i,e,n),u&&u(),t instanceof SVGElement){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 h=f.getPropertyValue(d);h&&i.style.setProperty(d,h)}}catch{}}if(t.shadowRoot){let g=function(S,b){if(S.nodeType===Node.ELEMENT_NODE&&S.tagName==="STYLE")return b(null);It(S,e,n).then(C=>{b(C||null)}).catch(()=>{b(null)})};try{let S=t.shadowRoot.querySelectorAll("slot");for(let b of S){let C=[];try{C=b.assignedNodes?.({flatten:!0})||b.assignedNodes?.()||[]}catch{C=b.assignedNodes?.()||[]}for(let A of C)o.add(A)}}catch{}let c=Je(e),f=`[data-sd="${c}"]`;try{i.setAttribute("data-sd",c)}catch{}let d=Ze(t.shadowRoot),h=Qe(d,f),y=nn(d),m=on(t,y,f);tn(i,m+h,c);let p=document.createDocumentFragment(),w=await Kt(Array.from(t.shadowRoot.childNodes),g,n.fast);p.append(...w.filter(S=>!!S)),i.appendChild(p)}if(t.tagName==="SLOT"){let h=function(m,p){It(m,e,n).then(g=>{g&&rn(g),p(g||null)}).catch(()=>{p(null)})},c=t.assignedNodes?.({flatten:!0})||[],f=c.length>0?c:Array.from(t.childNodes),d=document.createDocumentFragment(),y=await Kt(Array.from(f),h,n.fast);return d.append(...y.filter(m=>!!m)),d}function a(c,f){if(o.has(c))return f(null);It(c,e,n).then(d=>{f(d||null)}).catch(()=>{f(null)})}let l=await Kt(Array.from(t.childNodes),a,n.fast);if(i.append(...l.filter(c=>!!c)),s!==null&&i instanceof HTMLSelectElement){i.value=s;for(let c of i.options)c.value===s?c.setAttribute("selected",""):c.removeAttribute("selected")}return r!==null&&i instanceof HTMLTextAreaElement&&(i.textContent=r),i}G();Ft();X();var cr=[/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],xt=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__||{}),Se=[];function un(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Se.push(n):typeof n=="string"?Se.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function Q(t){let e=typeof t=="string"?t:"",n=[...cr,...Se];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 lr(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var ln=new Map;function ur(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,s;for(;s=o.exec(n);)e[s[1].toUpperCase()]=Number(s[2]);return e}async function fr(t,e,n){let o=String(t||""),s=o.toLowerCase(),r=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(s)&&!/\bsymbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};let u=n&&(n.FILL??n.fill),a="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?a="rounded":/\bsharp\b/.test(r)?a="sharp":/\boutlined\b/.test(r)&&(a="outlined");let l=u===1,c=null;if(l&&(a==="outlined"&&xt.materialIconsFilled?c={url:xt.materialIconsFilled,alias:"snapdom-mi-filled"}:a==="rounded"&&xt.materialIconsRound?c={url:xt.materialIconsRound,alias:"snapdom-mi-round"}:a==="sharp"&&xt.materialIconsSharp&&(c={url:xt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!c)return{familyForMeasure:o,familyForCanvas:o};if(!ln.has(c.alias))try{let d=new FontFace(c.alias,`url(${c.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),ln.set(c.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let f=`"${c.alias}"`;return{familyForMeasure:f,familyForCanvas:f}}async function dr(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function mr(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 pr(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:s="#000",variation:r="",className:i=""}={}){let u=String(e||"").replace(/^['"]+|['"]+$/g,""),a=window.devicePixelRatio||1,l=ur(r),{familyForMeasure:c,familyForCanvas:f}=await fr(u,i,l);await dr(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=s,document.body.appendChild(d);let h=d.getBoundingClientRect(),y=Math.max(1,Math.ceil(h.width)),m=Math.max(1,Math.ceil(h.height));document.body.removeChild(d);let p=document.createElement("canvas");p.width=y*a,p.height=m*a;let g=p.getContext("2d");g.scale(a,a),g.font=`${n?`${n} `:""}${o}px ${f}`,g.textAlign="left",g.textBaseline="top",g.fillStyle=s;try{g.fontKerning="normal"}catch{}return g.fillText(t,0,0),{dataUrl:p.toDataURL(),width:y,height:m}}async function fn(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim());if(o.length===0)return 0;let s=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim()):[],r=0;for(let i=0;i<o.length;i++){let u=o[i],a=s[i]||null;try{let l=getComputedStyle(a||u),c=l.fontFamily||"Material Icons";if(!lr(c))continue;let f=(a||u).textContent.trim();if(!f)continue;let d=parseInt(l.fontSize,10)||24,h=l.fontWeight&&l.fontWeight!=="normal"?l.fontWeight:"normal",y=mr(l),m=l.fontVariationSettings&&l.fontVariationSettings!=="normal"?l.fontVariationSettings:"",p=(a||u).className||"",{dataUrl:g,width:w,height:S}=await pr(f,{family:c,weight:h,fontSize:d,color:y,variation:m,className:p});u.textContent="";let b=u.ownerDocument.createElement("img");b.src=g,b.alt=f,b.style.height=`${d}px`,b.style.width=`${Math.max(1,Math.round(w/S*d))}px`,b.style.objectFit="contain",b.style.verticalAlign=getComputedStyle(u).verticalAlign||"baseline",u.appendChild(b),r++}catch{}}return r}pt();async function pn(t,e,n,o=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let i=document.createElement("span");i.textContent=t,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=n||"normal",i.style.fontSize=`${o}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);let u=i.getBoundingClientRect(),a=Math.ceil(u.width),l=Math.ceil(u.height);document.body.removeChild(i);let c=document.createElement("canvas");c.width=Math.max(1,a*r),c.height=Math.max(1,l*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=s,f.fillText(t,0,0),{dataUrl:c.toDataURL(),width:a,height:l}}var hn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),hr=["katex","mathjax","mathml"];function Ce(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!hn.has(n.toLowerCase()))return n}return""}function gr(t){if(!t)return[];let e=[];for(let n of t.split(",")){let o=n.trim().replace(/^['"]+|['"]+$/g,"");o&&(hn.has(o.toLowerCase())||e.push(o))}return e}function Qt(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 Jt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function yr(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function br(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let s=Qt(n[1]),r=Qt(n[2]);return{min:Math.min(s,r),max:Math.max(s,r)}}let o=Qt(e);return{min:o,max:o}}function wr(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Sr(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let r=parseFloat(n[1]),i=parseFloat(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),s=o?parseFloat(o[1]):100;return{min:s,max:s}}function xr(t){return!t||typeof t!="string"?"":t.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function Cr(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(a=>r.endsWith(a))||n.some(a=>r===a.toLowerCase()||r.endsWith("."+a.toLowerCase())))return!0;let u=(o.pathname+o.search).toLowerCase();if(/\bfont(s)?\b/.test(u)||/\.woff2?(\b|$)/.test(u)||hr.some(a=>u.includes(a)))return!0;for(let a of e){let l=a.toLowerCase().replace(/\s+/g,"+"),c=a.toLowerCase().replace(/\s+/g,"-"),f=xr(a);if(u.includes(l)||u.includes(c)||f&&u.includes(f))return!0}return!1}catch{return!1}}function kr(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function dn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,s)=>{let r=(s||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return n;let i=r;try{i=new URL(r,e||location.href).href}catch{}return`url("${i}")`})}var xe=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Zt=4;async function Ar(t,e,n){if(!t)return t;let o=new Set;function s(u,a){try{return new URL(u,a||location.href).href}catch{return u}}async function r(u,a,l=0){if(l>Zt)return console.warn(`[snapDOM] @import depth exceeded (${Zt}) at ${a}`),u;let c="",f=0,d;for(;d=xe.exec(u);){c+=u.slice(f,d.index),f=xe.lastIndex;let h=(d[2]||d[4]||"").trim(),y=s(h,a);if(o.has(y)){console.warn(`[snapDOM] Skipping circular @import: ${y}`);continue}o.add(y);let m="";try{let p=await O(y,{as:"text",useProxy:n,silent:!0});p.ok&&typeof p.data=="string"&&(m=p.data)}catch{}m?(m=dn(m,y),m=await r(m,y,l+1),c+=`
|
|
12
12
|
/* inlined: ${y} */
|
|
13
|
-
${
|
|
14
|
-
`):u+=m[0]}return u+=l.slice(f),u}let s=fn(t,e||location.href);return s=await r(s,e||location.href,0),s}var pn=/url\((["']?)([^"')]+)\1\)/g,xr=/@font-face[^{}]*\{[^}]*\}/g;function hn(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],l=c=>{if(!c.includes("?"))return parseInt(c,16);let a=parseInt(c.replace(/\?/g,"0"),16),u=parseInt(c.replace(/\?/g,"F"),16);return[a,u]};if(s){let c=l(r),a=l(s),u=Array.isArray(c)?c[0]:c,f=Array.isArray(a)?a[1]:a;e.push([Math.min(u,f),Math.max(u,f)])}else{let c=l(r);Array.isArray(c)?e.push([c[0],c[1]]):e.push([c,c])}}return e}function gn(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 Ce(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(pn)){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 yn(t,e,n=""){let o=t;for(let i of t.matchAll(pn)){let r=ut(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(!K(s)){if(x.resource?.has(s)){x.font?.add(s),o=o.replace(i[0],`url(${x.resource.get(s)})`);continue}if(!x.font?.has(s))try{let l=await U(s,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let c=l.data;x.resource?.set(s,c),x.font?.add(s),o=o.replace(i[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",s)}}}return o}function Cr(t){if(!t.length)return null;let e=(l,c)=>t.some(([a,u])=>!(u<l||a>c)),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 dn(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=Cr(r);if(s&&o.has(s))return!0}return!1}}function kr(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]||"",l=Jt(s),c=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),a=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),f=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(r.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),h=Ce(m,location.href),y=h.length?h.map(d=>String(d).toLowerCase()).sort().join("|"):m.toLowerCase(),p=[String(l||"").toLowerCase(),c,a,u,f.toLowerCase(),y].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 Ar(t,e,n,o,i){let r=Array.from(t||[]).sort().join("|"),s=e?JSON.stringify({families:(e.families||[]).map(u=>String(u).toLowerCase()).sort(),domains:(e.domains||[]).map(u=>String(u).toLowerCase()).sort(),subsets:(e.subsets||[]).map(u=>String(u).toLowerCase()).sort()}):"",l=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),c=o||"",a=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${r}::ex=${s}::lf=${l}::px=${c}::fd=${a}`}async function bn(t,e,n,o){let i;try{i=t.cssRules||[]}catch{return}let r=(s,l)=>{try{return new URL(s,l||location.href).href}catch{return s}};for(let s of i){if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){let l=s.href?r(s.href,e):e;if(o.depth>=Qt){console.warn(`[snapDOM] CSSOM import depth exceeded (${Qt}) at ${l}`);continue}if(l&&o.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&o.visitedSheets.add(l);let c={...o,depth:(o.depth||0)+1};await bn(s.styleSheet,l,n,c);continue}if(s.type===CSSRule.FONT_FACE_RULE){let l=(s.style.getPropertyValue("font-family")||"").trim(),c=Jt(l);if(!c||K(c))continue;let a=(s.style.getPropertyValue("font-weight")||"400").trim(),u=(s.style.getPropertyValue("font-style")||"normal").trim(),f=(s.style.getPropertyValue("font-stretch")||"100%").trim(),m=(s.style.getPropertyValue("src")||"").trim(),h=(s.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(c,u,a,f))continue;let y=hn(h);if(!gn(o.usedCodepoints,y))continue;let p={family:c,weightSpec:a,styleSpec:u,stretchSpec:f,unicodeRange:h,srcRaw:m,srcUrls:Ce(m,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(p,y))continue;if(/url\(/i.test(m)){let d=await yn(m,e||location.href,o.useProxy);await n(`@font-face{font-family:${c};src:${d};font-style:${u};font-weight:${a};font-stretch:${f};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${c};src:${m};font-style:${u};font-weight:${a};font-stretch:${f};${h?`unicode-range:${h};`:""}}`)}}}async function Zt({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 d of t){let[g,S,w,b]=String(d).split("__");if(!g)continue;let k=s.get(g)||[];k.push({w:parseInt(S,10),s:w,st:parseInt(b,10)}),s.set(g,k)}function l(d,g,S,w){if(!s.has(d))return!1;let b=s.get(d),k=pr(S),A=hr(g),C=gr(w),v=k.min!==k.max,$=k.min,_=R=>A.kind==="normal"&&R==="normal"||A.kind!=="normal"&&(R==="italic"||R==="oblique"),P=!1;for(let R of b){let N=v?R.w>=k.min&&R.w<=k.max:R.w===$,B=_(Kt(R.s)),E=R.st>=C.min&&R.st<=C.max;if(N&&B&&E){P=!0;break}}if(P)return!0;if(!v)for(let R of b){let N=_(Kt(R.s)),B=R.st>=C.min&&R.st<=C.max;if(Math.abs($-R.w)<=300&&N&&B)return!0}if(!v&&A.kind==="normal"&&b.some(N=>Kt(N.s)!=="normal"))for(let N of b){let B=Math.abs($-N.w)<=300,E=N.st>=C.min&&N.st<=C.max;if(B&&E)return!0}return!1}let c=dn(n),a=Ar(t,n,o,i,r);if(x.resource?.has(a))return x.resource.get(a);let u=wr(t),f=[],m=xe;for(let d of document.querySelectorAll("style")){let g=d.textContent||"";for(let S of g.matchAll(m)){let w=(S[2]||S[4]||"").trim();if(!w||K(w))continue;!!document.querySelector(`link[rel="stylesheet"][href="${w}"]`)||f.push(w)}}f.length&&await Promise.all(f.map(d=>new Promise(g=>{if(document.querySelector(`link[rel="stylesheet"][href="${d}"]`))return g(null);let S=document.createElement("link");S.rel="stylesheet",S.href=d,S.setAttribute("data-snapdom","injected-import"),S.onload=()=>g(S),S.onerror=()=>g(null),document.head.appendChild(S)})));let h="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(d=>!!d.href);for(let d of y)try{if(K(d.href))continue;let g="",S=!1;try{S=new URL(d.href,location.href).origin===location.origin}catch{}if(!S){let b=Array.isArray(r)?r:[];if(!br(d.href,u,b))continue}if(S){let b=Array.from(document.styleSheets).find(k=>k.href===d.href);if(b)try{let k=b.cssRules||[];g=Array.from(k).map(A=>A.cssText).join("")}catch{}}if(!g){let b=await U(d.href,{as:"text",useProxy:i});if(b?.ok&&typeof b.data=="string"&&(g=b.data),K(d.href))continue}g=await Sr(g,d.href,i);let w="";for(let b of g.match(xr)||[]){let k=(b.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),A=Jt(k);if(!A||K(A))continue;let C=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),$=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),_=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),P=(b.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),R=Ce(P,d.href);if(!l(A,v,C,$))continue;let N=hn(_);if(!gn(e,N))continue;let B={family:A,weightSpec:C,styleSpec:v,stretchSpec:$,unicodeRange:_,srcRaw:P,srcUrls:R,href:d.href};if(n&&c(B,N))continue;let E=/url\(/i.test(P)?await yn(b,d.href,i):b;w+=E}w.trim()&&(h+=w)}catch{console.warn("[snapDOM] Failed to process stylesheet:",d.href)}let p={requiredIndex:s,usedCodepoints:e,faceMatchesRequired:l,simpleExcluder:n?dn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let d of document.styleSheets)if(!(d.href&&y.some(g=>g.href===d.href)))try{let g=d.href||location.origin+"/";g&&p.visitedSheets.add(g),await bn(d,g,async S=>{h+=S},p)}catch{}try{for(let d of document.fonts||[]){if(!d||!d.family||d.status!=="loaded"||!d._snapdomSrc)continue;let g=String(d.family).replace(/^['"]+|['"]+$/g,"");if(K(g)||!s.has(g)||n?.families&&n.families.some(w=>String(w).toLowerCase()===g.toLowerCase()))continue;let S=d._snapdomSrc;if(!String(S).startsWith("data:")){if(x.resource?.has(d._snapdomSrc))S=x.resource.get(d._snapdomSrc),x.font?.add(d._snapdomSrc);else if(!x.font?.has(d._snapdomSrc))try{let w=await U(d._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(w.ok&&typeof w.data=="string")S=w.data,x.resource?.set(d._snapdomSrc,S),x.font?.add(d._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",d._snapdomSrc);continue}}h+=`@font-face{font-family:'${g}';src:url(${S});font-style:${d.style||"normal"};font-weight:${d.weight||"normal"};}`}}catch{}for(let d of o){if(!d||typeof d!="object")continue;let g=String(d.family||"").replace(/^['"]+|['"]+$/g,"");if(!g||K(g)||!s.has(g)||n?.families&&n.families.some(C=>String(C).toLowerCase()===g.toLowerCase()))continue;let S=d.weight!=null?String(d.weight):"normal",w=d.style!=null?String(d.style):"normal",b=d.stretchPct!=null?`${d.stretchPct}%`:"100%",k=String(d.src||""),A=k;if(!A.startsWith("data:")){if(x.resource?.has(k))A=x.resource.get(k),x.font?.add(k);else if(!x.font?.has(k))try{let C=await U(k,{as:"dataURL",useProxy:i,silent:!0});if(C.ok&&typeof C.data=="string")A=C.data,x.resource?.set(k,A),x.font?.add(k);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",k);continue}}h+=`@font-face{font-family:'${g}';src:url(${A});font-style:${w};font-weight:${S};font-stretch:${b};}`}return h&&(h=kr(h),x.resource?.set(a,h)),h}function St(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=s=>{let l=Jt(s.fontFamily);if(!l)return;let c=(a,u,f)=>`${l}__${Gt(a)}__${Kt(u)}__${mr(f)}`;e.add(c(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,l=getComputedStyle(s);o(l);let c=getComputedStyle(s,"::before");c&&c.content&&c.content!=="none"&&o(c);let a=getComputedStyle(s,"::after");a&&a.content&&a.content!=="none"&&o(a)}return e}function te(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 c=getComputedStyle(r,s)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let a=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(a)for(let u of a)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function xt(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)))}Y();function Cn(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function vr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function wn(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 Sn(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 xn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return wn(t,!1);case"upper-alpha":return wn(t,!0);case"lower-roman":return Sn(t,!1);case"upper-roman":return Sn(t,!0);default:return String(Math.max(0,t))}}function kn(t){let e=()=>x?.session?.__counterEpoch??0,n=e(),o=new WeakMap,i=t instanceof Document?t.documentElement:t,r=m=>m&&m.tagName==="LI",s=m=>{let h=0,y=m?.parentElement;if(!y)return 0;for(let p of y.children){if(p===m)break;p.tagName==="LI"&&h++}return h},l=m=>{let h=new Map;for(let[y,p]of m)h.set(y,p.slice());return h},c=(m,h,y)=>{let p=l(m),d;try{d=y.style?.counterReset||getComputedStyle(y).counterReset}catch{}if(d&&d!=="none")for(let S of d.split(",")){let w=S.trim().split(/\s+/),b=w[0],k=Number.isFinite(Number(w[1]))?Number(w[1]):0;if(!b)continue;let A=h.get(b);if(A&&A.length){let C=A.slice();C.push(k),p.set(b,C)}else p.set(b,[k])}let g;try{g=y.style?.counterIncrement||getComputedStyle(y).counterIncrement}catch{}if(g&&g!=="none")for(let S of g.split(",")){let w=S.trim().split(/\s+/),b=w[0],k=Number.isFinite(Number(w[1]))?Number(w[1]):1;if(!b)continue;let A=p.get(b)||[];A.length===0&&A.push(0),A[A.length-1]+=k,p.set(b,A)}try{if(getComputedStyle(y).display==="list-item"&&r(y)){let w=y.parentElement,b=1;if(w&&w.tagName==="OL"){let A=w.getAttribute("start"),C=Number.isFinite(Number(A))?Number(A):1,v=s(y),$=y.getAttribute("value");b=Number.isFinite(Number($))?Number($):C+v}else b=1+s(y);let k=p.get("list-item")||[];k.length===0&&k.push(0),k[k.length-1]=b,p.set("list-item",k)}}catch{}return p},a=(m,h,y)=>{let p=c(y,h,m);o.set(m,p);let d=p;for(let g of m.children)d=a(g,p,d);return p},u=new Map;a(i,u,u);function f(){let m=e();if(m!==n){n=m;let h=new Map;a(i,h,h)}}return{get(m,h){f();let y=o.get(m)?.get(h);return y&&y.length?y[y.length-1]:0},getStack(m,h){f();let y=o.get(m)?.get(h);return y?y.slice():[]}}}function An(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,i=t.replace(o,(r,s,l)=>{let c=String(l).split(",").map(a=>a.trim());if(s==="counter"){let a=c[0]?.replace(/^["']|["']$/g,""),u=(c[1]||"decimal").toLowerCase(),f=n.get(e,a);return xn(f,u)}else{let a=c[0]?.replace(/^["']|["']$/g,""),u=c[1]?.replace(/^["']|["']$/g,"")??"",f=(c[2]||"decimal").toLowerCase(),m=n.getStack(e,a);return m.length?m.map(y=>xn(y,f)).join(u):""}});return vr(i)}catch{return"- "}}ft();Y();var Ct=new WeakMap,vn=300;function Mr(t,e){let n=$n(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=En(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):En(t)}function ke(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function $n(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 l=s.textContent?s.textContent.length:0;n+=`S${l}|`;let c=s.sheet,a=c?ke(c):null;a&&(o+=a.length)}else{let l=s.getAttribute("href")||"",c=s.getAttribute("media")||"all";n+=`L${l}|m:${c}|`;let a=s.sheet,u=a?ke(a):null;u&&(o+=u.length)}}let i=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${o}`,n}function Mn(t,e,n){let o=ke(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 l of e)if(s.includes(l))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let l=0;l<r.cssRules.length&&n.budget>0;l++){let c=r.cssRules[l],a=c&&c.cssText?c.cssText:"";n.budget--;for(let u of e)if(a.includes(u))return!0}if(n.budget<=0)return!1}return!1}function En(t=document){let e=$n(t),n=Ct.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 l=i[s].textContent||"";for(let c of o)if(l.includes(c))return Ct.set(t,{fingerprint:e,result:!0}),!0}let r=t.adoptedStyleSheets;if(Array.isArray(r)&&r.length){let s={budget:vn};try{for(let l of r)if(Mn(l,o,s))return Ct.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let s=t.querySelectorAll('style,link[rel~="stylesheet"]'),l={budget:vn};for(let c=0;c<s.length&&l.budget>0;c++){let a=s[c],u=null;if(a.tagName,u=a.sheet||null,u&&Mn(u,o,l))return Ct.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(Ct.set(t,{fingerprint:e,result:!0}),!0):(Ct.set(t,{fingerprint:e,result:!1}),!1)}var kt=new WeakMap,Fn=-1;function Er(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Fr(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):Er(t)}function Ae(t,e){let n=t.parentElement,o=n?kt.get(n):null;return o?{get(i,r){let s=e.get(i,r),l=o.get(r);return typeof l=="number"?Math.max(s,l):s},getStack(i,r){let s=e.getStack(i,r);if(!s.length)return s;let l=o.get(r);if(typeof l=="number"){let c=s.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return s}}:e}function ve(t,e,n){let o=new Map;function i(c){let a=[];if(!c||c==="none")return a;for(let u of String(c).split(",")){let f=u.trim().split(/\s+/),m=f[0],h=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;m&&a.push({name:m,num:h})}return a}let r=i(e?.counterReset),s=i(e?.counterIncrement);function l(c){if(o.has(c))return o.get(c).slice();let a=n.getStack(t,c);a=a.length?a.slice():[];let u=r.find(m=>m.name===c);if(u){let m=Number.isFinite(u.num)?u.num:0;a=a.length?[...a,m]:[m]}let f=s.find(m=>m.name===c);if(f){let m=Number.isFinite(f.num)?f.num:1;a.length===0&&(a=[0]),a[a.length-1]+=m}return o.set(c,a.slice()),a}return{get(c,a){let u=l(a);return u.length?u[u.length-1]:0},getStack(c,a){return l(a)},__incs:s}}function $r(t,e,n){let o;try{o=H(t,e)}catch{}let i=o?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let r=Ae(t,n),s=ve(t,o,r),l=Cn(i)?An(i,t,s):i;return{text:Fr(l),incs:s.__incs||[]}}async function ee(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let i=t.ownerDocument||document;if(!Mr(i,n))return;let r=x?.session?.__counterEpoch??0;if(Fn!==r&&(kt=new WeakMap,n&&(n.__counterCtx=null),Fn=r),!n.__counterCtx)try{n.__counterCtx=kn(t.ownerDocument||document)}catch(c){F(n,"buildCounterContext failed",c)}let s=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let a=H(t,c);if(!a||a.content==="none"&&a.backgroundImage==="none"&&a.backgroundColor==="transparent"&&(a.borderStyle==="none"||parseFloat(a.borderWidth)===0)&&(!a.transform||a.transform==="none")&&a.display==="inline")continue;if(c==="::first-letter"){let I=H(t);if(!(a.color!==I.color||a.fontSize!==I.fontSize||a.fontWeight!==I.fontWeight))continue;let W=Array.from(e.childNodes).find(Wt=>Wt.nodeType===Node.TEXT_NODE&&Wt.textContent?.trim().length>0);if(!W)continue;let D=W.textContent,tt=D.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],pt=D.slice(tt?.length||0);if(!tt||/[\uD800-\uDFFF]/.test(tt))continue;let lt=document.createElement("span");lt.textContent=tt,lt.dataset.snapdomPseudo="::first-letter";let Pt=Vt(a),re=gt(Pt,"span");n.styleMap.set(lt,re);let _t=document.createTextNode(pt);e.replaceChild(_t,W),e.insertBefore(lt,_t);continue}let f=a.content??"",m=f===""||f==="none"||f==="normal",{text:h,incs:y}=$r(t,c,s),p=a.backgroundImage,d=a.backgroundColor,g=a.fontFamily,S=parseInt(a.fontSize)||32,w=parseInt(a.fontWeight)||!1,b=a.color||"#000",k=a.borderStyle,A=parseFloat(a.borderWidth),C=a.transform,v=K(g),$=!m&&h!=="",_=p&&p!=="none",P=d&&d!=="transparent"&&d!=="rgba(0, 0, 0, 0)",R=k&&k!=="none"&&A>0,N=C&&C!=="none";if(!($||_||P||R||N)){if(y&&y.length&&t.parentElement){let I=kt.get(t.parentElement)||new Map;for(let{name:T}of y){if(!T)continue;let W=Ae(t,s),Z=ve(t,H(t,c),W).get(t,T);I.set(T,Z)}kt.set(t.parentElement,I)}continue}let E=document.createElement("span");E.dataset.snapdomPseudo=c,E.style.pointerEvents="none";let at=Vt(a),Tt=gt(at,"span");if(n.styleMap.set(E,Tt),v&&h&&h.length===1){let{dataUrl:I,width:T,height:W}=await mn(h,g,w,S,b),D=document.createElement("img");D.src=I,D.style=`height:${S}px;width:${T/W*S}px;object-fit:contain;`,E.appendChild(D),e.dataset.snapdomHasIcon="true"}else if(h&&h.startsWith("url(")){let I=ut(h);if(I?.trim())try{let T=await U(st(I),{as:"dataURL",useProxy:o.useProxy});if(T?.ok&&typeof T.data=="string"){let W=document.createElement("img");W.src=T.data,W.style=`width:${S}px;height:auto;object-fit:contain;`,E.appendChild(W)}}catch(T){console.error(`[snapdom] Error in pseudo ${c} for`,t,T)}}else!v&&$&&(E.textContent=h);E.style.backgroundImage="none","maskImage"in E.style&&(E.style.maskImage="none"),"webkitMaskImage"in E.style&&(E.style.webkitMaskImage="none");try{E.style.backgroundRepeat=a.backgroundRepeat,E.style.backgroundSize=a.backgroundSize,a.backgroundPositionX&&a.backgroundPositionY?(E.style.backgroundPositionX=a.backgroundPositionX,E.style.backgroundPositionY=a.backgroundPositionY):E.style.backgroundPosition=a.backgroundPosition,E.style.backgroundOrigin=a.backgroundOrigin,E.style.backgroundClip=a.backgroundClip,E.style.backgroundAttachment=a.backgroundAttachment,E.style.backgroundBlendMode=a.backgroundBlendMode}catch{}if(_)try{let I=yt(p),T=await Promise.all(I.map(dt));E.style.backgroundImage=T.join(", ")}catch(I){console.warn(`[snapdom] Failed to inline background-image for ${c}`,I)}P&&(E.style.backgroundColor=d);let nt=E.childNodes.length>0||E.textContent?.trim()!==""||_||P||R||N;if(y&&y.length&&t.parentElement){let I=kt.get(t.parentElement)||new Map,T=Ae(t,s),W=ve(t,H(t,c),T);for(let{name:D}of y){if(!D)continue;let Z=W.get(t,D);I.set(D,Z)}kt.set(t.parentElement,I)}if(!nt)continue;c==="::before"?(e.dataset.snapdomHasBefore="1",e.insertBefore(E,e.firstChild)):(e.dataset.snapdomHasAfter="1",e.appendChild(E))}catch(a){console.warn(`[snapdom] Failed to capture ${c} for`,t,a)}let l=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);if(n.nodeMap)for(let c of l){let a=n.nodeMap.get(c);a instanceof Element&&await ee(a,c,n,o)}else{let c=Array.from(t.children);for(let a=0;a<Math.min(c.length,l.length);a++)await ee(c[a],l[a],n,o)}}function Rn(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"],l=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c="http://www.w3.org/1999/xlink",a=b=>{if(!b||!b.getAttribute)return null;let k=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(c,"href"):null);if(k)return k;let A=b.attributes;if(!A)return null;for(let C=0;C<A.length;C++){let v=A[C];if(!v||!v.name)continue;if(v.name==="href")return v.value;let $=v.name.indexOf(":");if($!==-1&&v.name.slice($+1)==="href")return v.value}return null},u=new Set(Array.from(t.querySelectorAll("[id]")).map(b=>b.id)),f=new Set,m=!1,h=(b,k=null)=>{if(!b)return;r.lastIndex=0;let A;for(;A=r.exec(b);){m=!0;let C=(A[1]||"").trim();C&&(u.has(C)||(f.add(C),k&&!k.has(C)&&k.add(C)))}},y=b=>{let k=b.querySelectorAll("use");for(let v of k){let $=a(v);if(!$||!$.startsWith("#"))continue;m=!0;let _=$.slice(1).trim();_&&!u.has(_)&&f.add(_)}let C=b.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){h(v.getAttribute("style")||"");for(let $ of s)h(v.getAttribute($))}};for(let b of i)y(b);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 d=p.querySelector("defs")||null,g=b=>{if(!b||u.has(b))return null;let k=l(b),A=C=>{let v=o.querySelector(C);return v&&!t.contains(v)?v:null};return A(`svg defs > *#${k}`)||A(`svg > symbol#${k}`)||A(`*#${k}`)};if(!f.size)return;let S=new Set(f),w=new Set;for(;S.size;){let b=S.values().next().value;if(S.delete(b),!b||u.has(b)||w.has(b))continue;let k=g(b);if(!k){w.add(b);continue}d||(d=n.createElementNS("http://www.w3.org/2000/svg","defs"),p.appendChild(d));let A=k.cloneNode(!0);A.id||A.setAttribute("id",b),d.appendChild(A),w.add(b),u.add(b);let C=[A,...A.querySelectorAll("*")];for(let v of C){let $=a(v);if($&&$.startsWith("#")){let P=$.slice(1).trim();P&&!u.has(P)&&!w.has(P)&&S.add(P)}let _=v.getAttribute?.("style")||"";_&&h(_,S);for(let P of s){let R=v.getAttribute?.(P);R&&h(R,S)}}}}Y();function In(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 l=s.currentNode,c=getComputedStyle(l),a=c.position;if(a!=="sticky"&&a!=="-webkit-sticky")continue;let u=Ln(c.top),f=Ln(c.bottom);if(u==null&&f==null)continue;let m=Rr(l,t),h=Lr(e,m,r);if(!h)continue;let y=l.getBoundingClientRect(),p=y.width,d=y.height,g=y.left-o.left;if(!(p>0&&d>0)||!Number.isFinite(g))continue;let S=u!=null?u+n:n+(i-d-f);if(!Number.isFinite(S))continue;let w=Number.parseInt(c.zIndex,10),b=Number.isFinite(w),k=b?Math.max(w,1)+1:2,A=b?w-1:0,C=h.cloneNode(!1);C.setAttribute(r,"1"),C.style.position="sticky",C.style.left=`${g}px`,C.style.top=`${S}px`,C.style.width=`${p}px`,C.style.height=`${d}px`,C.style.visibility="hidden",C.style.zIndex=String(A),C.style.overflow="hidden",C.style.background="transparent",C.style.boxShadow="none",C.style.filter="none",h.parentElement?.insertBefore(C,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${S}px`,h.style.bottom="auto",h.style.zIndex=String(k),h.style.pointerEvents="none"}}function Ln(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Rr(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 Lr(t,e,n){let o=t;for(let i=0;i<e.length;i++)if(o=Ir(o,n)[e[i]],!o)return null;return o instanceof HTMLElement?o:null}function Ir(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 Nn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,i=e.borderStyle,r=e.borderWidth,s=n!=="none"&&parseFloat(o)>0,l=i==="none"||parseFloat(r)===0;s&&l&&(t.style.border=`${o} solid transparent`)}async function Tn(t,e={}){let n={styleMap:x.session.styleMap,styleCache:x.session.styleCache,nodeMap:x.session.nodeMap,options:e},o,i="",r="";Nn(t);try{Rn(t)}catch(a){console.warn("inlineExternal defs or symbol failed:",a)}try{o=await Rt(t,n,e)}catch(a){throw console.warn("deepClone failed:",a),a}try{await ee(t,o,n,e)}catch(a){console.warn("inlinePseudoElements failed:",a)}await an(o,n);try{let a=o.querySelectorAll("style[data-sd]");for(let u of a)r+=u.textContent||"",u.remove()}catch(a){F(n,"Failed to extract shadow CSS from style[data-sd]",a)}let s=pe(n.styleMap);i=Array.from(s.entries()).map(([a,u])=>`.${u}{${a}}`).join(""),i=r+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[a,u]of n.styleMap.entries()){if(a.tagName==="STYLE")continue;if(a.getRootNode&&a.getRootNode()instanceof ShadowRoot){a.setAttribute("style",u.replace(/;/g,"; "));continue}let f=s.get(u);f&&a.classList.add(f);let m=a.style?.backgroundImage,h=a.dataset?.snapdomHasIcon;m&&m!=="none"&&(a.style.backgroundImage=m),h&&(a.style.verticalAlign="middle",a.style.display="inline")}for(let[a,u]of n.nodeMap.entries()){let f=u.scrollLeft,m=u.scrollTop;if((f||m)&&a instanceof HTMLElement){a.style.overflow="hidden",a.style.scrollbarWidth="none",a.style.msOverflowStyle="none";let y=document.createElement("div");for(y.style.transform=`translate(${-f}px, ${-m}px)`,y.style.willChange="transform",y.style.display="inline-block",y.style.width="100%";a.firstChild;)y.appendChild(a.firstChild);a.appendChild(y)}}let c=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(In(t,c),t===n.nodeMap.get(o)){let a=n.styleCache.get(t)||H(t);n.styleCache.set(t,a);let u=ae(a.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=u||""}for(let[a,u]of n.nodeMap.entries())u.tagName==="PRE"&&(a.style.marginTop="0",a.style.marginBlockStart="0");return{clone:o,classCSS:i,styleCache:n.styleCache}}ft();var Pn="http://www.w3.org/1999/xlink";function Nr(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(Pn,"href"):null)}function Tr(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,l=e||r||o||t.width||t.naturalWidth||100,c=n||s||i||t.height||t.naturalHeight||100;return{width:l,height:c}}async function _n(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async s=>{if(!s.getAttribute("src")){let m=s.currentSrc||s.src||"";m&&s.setAttribute("src",m)}s.removeAttribute("srcset"),s.removeAttribute("sizes");let l=s.src||"";if(!l)return;let c=await U(l,{as:"dataURL",useProxy:e.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){s.src=c.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:a,height:u}=Tr(s),{fallbackURL:f}=e||{};if(f)try{let m=typeof f=="function"?await f({width:a,height:u,src:l,element:s}):f;if(m){let h=await U(m,{as:"dataURL",useProxy:e.useProxy});if(h?.ok&&typeof h.data=="string"){s.src=h.data,s.width||(s.width=a),s.height||(s.height=u);return}}}catch{}if(e.placeholders!==!1){let m=document.createElement("div");m.style.cssText=[`width:${a}px`,`height:${u}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${u}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),m.textContent="img",s.replaceWith(m)}else{let m=document.createElement("div");m.style.cssText=`display:inline-block;width:${a}px;height:${u}px;visibility:hidden;`,s.replaceWith(m)}};for(let s=0;s<n.length;s+=4){let l=n.slice(s,s+4).map(o);await Promise.allSettled(l)}let i=Array.from(t.querySelectorAll("image")),r=async s=>{let l=Nr(s);if(!l||l.startsWith("data:")||l.startsWith("blob:"))return;let c=await U(l,{as:"dataURL",useProxy:e.useProxy});c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")&&(s.setAttribute("href",c.data),s.removeAttribute("xlink:href"),typeof s.removeAttributeNS=="function"&&s.removeAttributeNS(Pn,"href"))};for(let s=0;s<i.length;s+=4){let l=i.slice(s,s+4).map(r);await Promise.allSettled(l)}}G();async function ne(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","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[a,u]=i.shift();if(!u)continue;let f=n.get(a)||H(a);n.has(a)||n.set(a,f);let m=(()=>{let p=f.getPropertyValue("border-image"),d=f.getPropertyValue("border-image-source");return p&&p!=="none"||d&&d!=="none"})();for(let p of l){let d=f.getPropertyValue(p);d&&u.style.setProperty(p,d)}for(let p of r){let d=f.getPropertyValue(p);if(p==="background-image"&&(!d||d==="none")){let w=f.getPropertyValue("background");w&&/url\s*\(/.test(w)&&(d=yt(w).find(b=>/url\s*\(/.test(b))||d)}if(!d||d==="none")continue;let g=yt(d),S=await Promise.all(g.map(w=>dt(w,o)));S.some(w=>w&&w!=="none"&&!/^url\(undefined/.test(w))&&u.style.setProperty(p,S.join(", "))}for(let p of s){let d=f.getPropertyValue(p);!d||d==="initial"||u.style.setProperty(p,d)}if(m)for(let p of c){let d=f.getPropertyValue(p);!d||d==="initial"||u.style.setProperty(p,d)}let h=a.shadowRoot?Array.from(a.shadowRoot.children).filter(p=>p.tagName!=="STYLE"):Array.from(a.children),y=Array.from(u.children).filter(p=>!(p.dataset?.snapdomPseudo||p.tagName==="STYLE"&&p.dataset?.sd));for(let p=0;p<Math.min(h.length,y.length);p++)i.push([h[p],y[p]])}}G();Y();function Wn(t){if(!t)return()=>{};let e=[];function n(o){let i=Pr(o);i&&e.push(i);for(let r of o.children||[])n(r)}return n(t),()=>e.forEach(o=>o())}function Pr(t){if(!t)return()=>{};let e=_r(t);if(e<=0)return()=>{};if(!Or(t))return()=>{};let n=getComputedStyle(t),o=Math.round(Wr(n)*e+Ur(n)),i=t.textContent??"",r=i;if(t.scrollHeight<=o+.5)return()=>{};let s=0,l=i.length,c=-1;for(;s<=l;){let a=s+l>>1;t.textContent=i.slice(0,a)+"\u2026",t.scrollHeight<=o+.5?(c=a,s=a+1):l=a-1}return t.textContent=(c>=0?i.slice(0,c):"")+"\u2026",()=>{t.textContent=r}}function _r(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 Wr(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 Ur(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Or(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Lt=[];function Un(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 On(...t){let e=t.flat();for(let n of e){let o=Un(n);o&&(Lt.some(i=>i&&i.name&&o.name&&i.name===o.name)||Lt.push(o))}}function Bn(t){return(t&&Array.isArray(t.plugins)?t.plugins:Lt)||Lt}async function J(t,e,n){let o=n,i=Bn(e);for(let r of i){let s=r&&typeof r[t]=="function"?r[t]:null;if(!s)continue;let l=await s(e,o);typeof l<"u"&&(o=l)}return o}async function Dn(t,e,n){let o=[],i=Bn(e);for(let r of i){let s=r&&typeof r[t]=="function"?r[t]:null;if(!s)continue;let l=await s(e,n);typeof l<"u"&&o.push(l)}return o}function Br(t){let e=[];if(Array.isArray(t))for(let n of t){let o=Un(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 Lt)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function Hn(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=Br(e)),t}G();function qn(t,e,n={}){if(!t||!e||!e.style)return;let o=getComputedStyle(t);try{e.style.boxShadow="none"}catch(s){F(n,"stripRootShadows boxShadow",s)}try{e.style.textShadow="none"}catch(s){F(n,"stripRootShadows textShadow",s)}try{e.style.outline="none"}catch(s){F(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){F(n,"stripRootShadows filter",s)}}function Dr(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 Hr(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 l=s.name;if(l.includes("@")){r.removeAttribute(l);continue}if(l.includes(":")){let c=l.split(":",1)[0];if(!o.has(c)){r.removeAttribute(l);continue}}if(n&&(l.startsWith("x-")||l.startsWith("v-")||l.startsWith(":")||l.startsWith("on:")||l.startsWith("bind:")||l.startsWith("let:")||l.startsWith("class:"))){r.removeAttribute(l);continue}}}}function zn(t,e={}){t&&(Hr(t,e),Dr(t))}function qr(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function zr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function jr(t,e){if(!(t instanceof Element)||qr(t)||zr(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 jn(t,e,n=new Map){function o(i,r){if(!(i instanceof Element)||!(r instanceof Element))return;let s=i.childElementCount>r.childElementCount,l=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,l),s&&jr(i,l)){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 u=l.overflowY||l.overflowBlock||"visible",f=l.overflowX||l.overflowInline||"visible";(u!=="visible"||f!=="visible")&&(r.style.overflow="visible")}let c=Array.from(i.children),a=Array.from(r.children);for(let u=0;u<Math.min(c.length,a.length);u++)o(c[u],a[u])}o(t,e)}function Vr(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed")}function Xr(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){F(e,"exclude selector match failed",o)}return!1}function Vn(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),i=1/0,r=-1/0,s=!1,l=Array.from(t.children);for(let h of l){if(Xr(h,e)||!Vr(h))continue;let y=h.getBoundingClientRect(),p=y.top-o.top,d=y.bottom-o.top;d<=p||(p<i&&(i=p),d>r&&(r=d),s=!0)}let c=s?Math.max(0,r-i):0,a=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,m=parseFloat(n.paddingBottom)||0;return a+u+f+m+c}var M=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t,Yr=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Me(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+=Me(i.styleSheet.cssRules,e);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let r=Me(i.cssRules,e);r&&(n+=`@media ${i.conditionText}{${r}}`);continue}if(i.type===CSSRule.STYLE_RULE){let r=i.selectorText||"";if(Yr.test(r)){let s=i.cssText;s&&!e.has(s)&&(e.add(s),n+=s)}}}catch{}}return n}function Xn(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+=Me(i,e))}catch{}return n}function Yn(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),o=0,i=0,r=0,s=0;for(let l of n){let c=l.match(/-?\d+(\.\d+)?px/g)?.map(p=>parseFloat(p))||[];if(c.length<2)continue;let[a,u,f=0,m=0]=c,h=Math.abs(a)+f+m,y=Math.abs(u)+f+m;i=Math.max(i,h+Math.max(a,0)),s=Math.max(s,h+Math.max(-a,0)),r=Math.max(r,y+Math.max(u,0)),o=Math.max(o,y+Math.max(-u,0))}return{top:Math.ceil(o),right:Math.ceil(i),bottom:Math.ceil(r),left:Math.ceil(s)}}function Gn(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function Kn(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Qn(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,l=!1;for(let c of n){l=!0;let a=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(p=>parseFloat(p))||[],[u=0,f=0,m=0]=a,h=Math.abs(u)+m,y=Math.abs(f)+m;i=Math.max(i,h+Math.max(u,0)),s=Math.max(s,h+Math.max(-u,0)),r=Math.max(r,y+Math.max(f,0)),o=Math.max(o,y+Math.max(-f,0))}return{bleed:{top:M(o),right:M(i),bottom:M(r),left:M(s)},has:l}}function Jn(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")try{let r=oo(t);if(r.a===1&&r.b===0&&r.c===0&&r.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let i=o.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let r=i[1].split(",").map(s=>parseFloat(s.trim()));if(r.length===6&&r.every(Number.isFinite)){let[s,l,c,a]=r,u=Math.sqrt(s*s+l*l)||0,f=0,m=0,h=0,y=0,p=0,d=0;u>0&&(f=s/u,m=l/u,h=f*c+m*a,y=c-f*h,p=a-m*h,d=Math.sqrt(y*y+p*p)||0,d>0?h=h/d:h=0);let g=u,S=0,w=h*d,b=d;try{e.style.transform=`matrix(${g}, ${S}, ${w}, ${b}, 0, 0)`}catch{}return{a:g,b:S,c:w,d:b}}}try{let r=String(o).trim();return e.style.transform=r+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function Fe(t,e,n,o,i){let r=n.a,s=n.b,l=n.c,c=n.d,a=n.e||0,u=n.f||0;function f(g,S){let w=g-o,b=S-i,k=r*w+l*b,A=s*w+c*b;return k+=o+a,A+=i+u,[k,A]}let m=[f(0,0),f(t,0),f(0,e),f(t,e)],h=1/0,y=1/0,p=-1/0,d=-1/0;for(let[g,S]of m)g<h&&(h=g),S<y&&(y=S),g>p&&(p=g),S>d&&(d=S);return{minX:h,minY:y,maxX:p,maxY:d,width:p-h,height:d-y}}function Zn(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[i,r]=[o[0]||"0",o[1]||"0"],s=(l,c)=>{let a=l.toLowerCase();return a==="left"||a==="top"?0:a==="center"?c/2:a==="right"||a==="bottom"?c:a.endsWith("px")?parseFloat(a)||0:a.endsWith("%")?(parseFloat(a)||0)*c/100:/^-?\d+(\.\d+)?$/.test(a)&&parseFloat(a)||0};return{ox:s(i,e),oy:s(r,n)}}function to(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let i=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},r=i("rotate");if(r)if(r.angle){let c=r.angle;e.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.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 c=getComputedStyle(t);e.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let s=i("scale");if(s){let c="x"in s&&s.x?.value!=null?s.x.value:Array.isArray(s)?s[0]?.value:Number(s)||1,a="y"in s&&s.y?.value!=null?s.y.value:Array.isArray(s)?s[1]?.value:c;e.scale=`${c} ${a}`}else{let c=getComputedStyle(t);e.scale=c.scale&&c.scale!=="none"?c.scale:null}let l=i("translate");if(l){let c="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,a="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",f="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${c}${u} ${a}${f}`}else{let c=getComputedStyle(t);e.translate=c.translate&&c.translate!=="none"?c.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 Ee=null;function Gr(){if(Ee)return Ee;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),Ee=t,t}function eo(t){let e=Gr(),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=oo(n);return e.removeChild(n),o}function no(t){let e=getComputedStyle(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 oo(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}async function $e(t,e){if(!t)throw new Error("Element cannot be null or undefined");Ht(e.cache);let n=e.fast,o=e.outerTransforms!==!1,i=!!e.outerShadows,r={element:t,options:e,plugins:e.plugins},s,l,c,a="",u="",f,m,h=null;await J("beforeSnap",r),await J("beforeClone",r);let y=Wn(r.element);try{({clone:s,classCSS:l,styleCache:c}=await Tn(r.element,r.options)),!o&&s&&(h=Jn(r.element,s)),!i&&s&&qn(r.element,s,r.options)}finally{y()}if(r={clone:s,classCSS:l,styleCache:c,...r},await J("afterClone",r),zn(r.clone),r.options?.excludeMode==="remove")try{jn(r.element,r.clone,r.styleCache)}catch(w){console.warn("[snapdom] shrink pass failed:",w)}try{await un(r.clone,r.element)}catch{}await new Promise(w=>{et(async()=>{await _n(r.clone,r.options),w()},{fast:n})}),await new Promise(w=>{et(async()=>{await ne(r.element,r.clone,r.styleCache,r.options),w()},{fast:n})}),e.embedFonts&&await new Promise(w=>{et(async()=>{let b=St(r.element),k=te(r.element);if(q()){let A=new Set(Array.from(b).map(C=>String(C).split("__")[0]).filter(Boolean));await xt(A,1)}a=await Zt({required:b,usedCodepoints:k,preCached:!1,exclude:r.options.excludeFonts,useProxy:r.options.useProxy,fontStylesheetDomains:r.options.fontStylesheetDomains}),w()},{fast:n})});let p=de(r.clone).sort(),d=p.join(",");x.baseStyle.has(d)?u=x.baseStyle.get(d):await new Promise(w=>{et(()=>{u=me(p),x.baseStyle.set(d,u),w()},{fast:n})});let g=Xn(r.element?.ownerDocument||document);r={fontsCSS:a,baseCSS:u,scrollbarCSS:g,...r},await J("beforeRender",r),await new Promise(w=>{et(()=>{let b=H(r.element),k=r.element.getBoundingClientRect(),A=Math.max(1,M(r.element.offsetWidth||parseFloat(b.width)||k.width||1)),C=Math.max(1,M(r.element.offsetHeight||parseFloat(b.height)||k.height||1)),v=r.element.ownerDocument||document;if(r.element===v.body||r.element===v.documentElement){let j=Math.max(r.element.scrollHeight||0,v.documentElement?.scrollHeight||0,v.body?.scrollHeight||0),X=Math.max(r.element.scrollWidth||0,v.documentElement?.scrollWidth||0,v.body?.scrollWidth||0);j>0&&(C=Math.max(C,M(j))),X>0&&(A=Math.max(A,M(X)));try{let z=v.createElement("div");z.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+A+"px!important;overflow:visible!important;visibility:hidden!important;";let ht=v.createElement("style");ht.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,z.appendChild(ht),z.appendChild(r.clone.cloneNode(!0)),v.body.appendChild(z);let Ot=z.scrollHeight,Bt=z.scrollWidth;v.body.removeChild(z),Ot>0&&(C=Math.max(C,M(Ot))),Bt>0&&(A=Math.max(A,M(Bt)))}catch{}}if(r.options?.excludeMode==="remove"){let j=Vn(r.element,r.options);Number.isFinite(j)&&j>0&&(C=Math.max(1,Math.min(C,M(j+1))))}let _=(j,X=NaN)=>{let z=typeof j=="string"?parseFloat(j):j;return Number.isFinite(z)?z:X},P=_(r.options.width),R=_(r.options.height),N=A,B=C,E=Number.isFinite(P),at=Number.isFinite(R),Tt=C>0?A/C:1;E&&at?(N=Math.max(1,M(P)),B=Math.max(1,M(R))):E?(N=Math.max(1,M(P)),B=Math.max(1,M(N/(Tt||1)))):at?(B=Math.max(1,M(R)),N=Math.max(1,M(B*(Tt||1)))):(N=A,B=C);let ct=0,nt=0,I=A,T=C;if(!o&&h&&Number.isFinite(h.a)){let j={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},X=Fe(A,C,j,0,0);ct=M(X.minX),nt=M(X.minY),I=M(X.maxX),T=M(X.maxY)}else if(o&&ro(r.element)){let X=b.transform&&b.transform!=="none"?b.transform:"",z=to(r.element),ht=eo({baseTransform:X,rotate:z.rotate||"0deg",scale:z.scale,translate:z.translate}),{ox:Ot,oy:Bt}=Zn(b,A,C),Ao=ht.is2D?ht:new DOMMatrix(ht.toString()),Dt=Fe(A,C,Ao,Ot,Bt);ct=M(Dt.minX),nt=M(Dt.minY),I=M(Dt.maxX),T=M(Dt.maxY)}let W=Yn(b),D=Gn(b),Z=Kn(b),tt=Qn(b),pt=i?{top:M(W.top+D.top+Z.top+tt.bleed.top),right:M(W.right+D.right+Z.right+tt.bleed.right),bottom:M(W.bottom+D.bottom+Z.bottom+tt.bleed.bottom),left:M(W.left+D.left+Z.left+tt.bleed.left)}:{top:0,right:0,bottom:0,left:0};ct=M(ct-pt.left),nt=M(nt-pt.top),I=M(I+pt.right),T=M(T+pt.bottom);let lt=Math.max(1,M(I-ct)),Pt=Math.max(1,M(T-nt)),re=E||at?M(N/A):1,_t=at||E?M(B/C):1,Wt=Math.max(1,M(lt*re)),go=Math.max(1,M(Pt*_t)),Pe="http://www.w3.org/2000/svg",yo=q()&&ro(r.element)?1:0,ot=M(yo+(o?0:1)),rt=document.createElementNS(Pe,"foreignObject"),bo=M(ct),wo=M(nt);rt.setAttribute("x",String(M(-(bo-ot)))),rt.setAttribute("y",String(M(-(wo-ot)))),rt.setAttribute("width",String(M(A+ot*2))),rt.setAttribute("height",String(M(C+ot*2))),rt.style.overflow="visible";let _e=document.createElement("style");_e.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,rt.appendChild(_e);let Ut=document.createElement("div");Ut.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ut.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${M(A)}px;height:${M(C)}px`,Ut.appendChild(r.clone),rt.appendChild(Ut);let So=new XMLSerializer().serializeToString(rt),se=M(lt+ot*2),ie=M(Pt+ot*2),We=E||at;e.meta={w0:A,h0:C,vbW:se,vbH:ie,targetW:N,targetH:B};let xo=q()&&We?se:M(Wt+ot*2),Co=q()&&We?ie:M(go+ot*2),ko=parseFloat(H(v.documentElement)?.fontSize)||16;m=`<svg xmlns="${Pe}" width="${xo}" height="${Co}" viewBox="0 0 ${se} ${ie}" font-size="${ko}px">`+So+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,r={svgString:m,dataURL:f,...r},w()},{fast:n})}),await J("afterRender",r);let S=document.getElementById("snapdom-sandbox");return S&&S.style.position==="absolute"&&S.remove(),r.dataURL}function ro(t){return no(t)}Y();function so(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Ue(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}}bt();ye();G();ft();Y();async function io(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,i=e.cache??e.cacheOpt??"full";Ht(i);try{await document.fonts?.ready}catch{}try{ue()}catch{}x.session=x.session||{},x.session.styleCache||(x.session.styleCache=new WeakMap),x.image=x.image||new O(100),x.background=x.background||new O(100);try{await ne(t,void 0,x.session.styleCache,{useProxy:o})}catch{}let r=[],s=[];try{if(t&&t.nodeType===1){let c=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];s=[t,...c],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 l=[];for(let c of r){let a=c?.currentSrc||c?.src;if(a&&!x.image.has(a)){let u=Promise.resolve().then(async()=>{let f=await U(a,{as:"dataURL",useProxy:o});f?.ok&&typeof f.data=="string"&&x.image.set(a,f.data)}).catch(()=>{});l.push(u)}}for(let c of s){let a="";try{a=c?.style?.backgroundImage||"",(!a||a==="none")&&(a=H(c).backgroundImage)}catch{}if(a&&a!=="none"){let u=a.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let f of u){let m=Promise.resolve().then(()=>dt(f,{...e,useProxy:o})).catch(()=>{});l.push(m)}}}if(n)try{let c=St(t),a=te(t);if(typeof q=="function"?q():!!q){let f=new Set(Array.from(c).map(m=>String(m).split("__")[0]).filter(Boolean));await xt(f,3)}await Zt({required:c,usedCodepoints:a,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o,fontStylesheetDomains:e.fontStylesheetDomains})}catch{}await Promise.allSettled(l)}function is(...t){return On(...t),L}var L=Object.assign(cs,{plugins:is}),ho=Symbol("snapdom.internal"),as=Symbol("snapdom.internal.silent"),po=!1;async function cs(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=so(e);if(Hn(n,e&&e.plugins),q()&&(n.embedFonts===!0||us(t))){if(n.embedFonts)try{let i=St(t),r=new Set([...i].map(s=>String(s).split("__")[0]).filter(Boolean));await xt(r,1)}catch{}let o=n.safariWarmupAttempts??3;for(let i=0;i<o;i++)try{await ls(t,e)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&ln(n.iconFonts),n.snap||(n.snap={toPng:(o,i)=>L.toPng(o,i),toSvg:(o,i)=>L.toSvg(o,i)}),L.capture(t,n,ho)}L.capture=async(t,e,n)=>{if(n!==ho)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await $e(t,e),i={img:async(p,d)=>{let{toImg:g}=await Promise.resolve().then(()=>(Ie(),Le));return g(o,{...p,...d||{}})},svg:async(p,d)=>{let{toSvg:g}=await Promise.resolve().then(()=>(Ie(),Le));return g(o,{...p,...d||{}})},canvas:async(p,d)=>{let{toCanvas:g}=await Promise.resolve().then(()=>(It(),co));return g(o,{...p,...d||{}})},blob:async(p,d)=>{let{toBlob:g}=await Promise.resolve().then(()=>(Te(),lo));return g(o,{...p,...d||{}})},png:async(p,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Nt(),oe));return g(o,{...p,...d||{},format:"png"})},jpeg:async(p,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Nt(),oe));return g(o,{...p,...d||{},format:"jpeg"})},webp:async(p,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Nt(),oe));return g(o,{...p,...d||{},format:"webp"})},download:async(p,d)=>{let{download:g}=await Promise.resolve().then(()=>(mo(),fo));return g(o,{...p,...d||{}})}},r={};for(let p of["img","svg","canvas","blob","png","jpeg","webp"])r[p]=async d=>i[p](e,{...d||{},[as]:!0});r.jpg=r.jpeg;let s={...e,export:{url:o},exports:r},l=await Dn("defineExports",s),c=Object.assign({},...l.filter(p=>p&&typeof p=="object")),a={...i,...c};a.jpeg&&!a.jpg&&(a.jpg=(p,d)=>a.jpeg(p,d));function u(p,d){let g={...e,...d||{}};return(p==="jpeg"||p==="jpg")&&(g.backgroundColor==null||g.backgroundColor==="transparent")&&(g.backgroundColor="#ffffff"),g}let f=!1,m=Promise.resolve();async function h(p,d){let g=async()=>{let S=a[p];if(!S)throw new Error(`[snapdom] Unknown export type: ${p}`);let w=u(p,d),b={...e,export:{type:p,options:w,url:o}};await J("beforeExport",b);let k=await S(b,w);return await J("afterExport",b,k),f||(f=!0,await J("afterSnap",e)),k};return m=m.then(g)}let y={url:o,toRaw:()=>o,to:(p,d)=>h(p,d),toImg:p=>h("img",p),toSvg:p=>h("svg",p),toCanvas:p=>h("canvas",p),toBlob:p=>h("blob",p),toPng:p=>h("png",p),toJpg:p=>h("jpg",p),toWebp:p=>h("webp",p),download:p=>h("download",p)};for(let p of Object.keys(a)){let d="to"+p.charAt(0).toUpperCase()+p.slice(1);y[d]||(y[d]=g=>h(p,g))}return y};L.toRaw=(t,e)=>L(t,e).then(n=>n.toRaw());L.toImg=(t,e)=>L(t,e).then(n=>n.toImg());L.toSvg=(t,e)=>L(t,e).then(n=>n.toSvg());L.toCanvas=(t,e)=>L(t,e).then(n=>n.toCanvas());L.toBlob=(t,e)=>L(t,e).then(n=>n.toBlob());L.toPng=(t,e)=>L(t,{...e,format:"png"}).then(n=>n.toPng());L.toJpg=(t,e)=>L(t,{...e,format:"jpeg"}).then(n=>n.toJpg());L.toWebp=(t,e)=>L(t,{...e,format:"webp"}).then(n=>n.toWebp());L.download=(t,e)=>L(t,e).then(n=>n.download());async function ls(t,e){if(po)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await $e(t,n)}catch(i){F(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){F(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(l){F(e,"safariWarmup img.decode failed",l)}let s=performance.now();for(;!(r.complete&&r.naturalWidth>0)&&performance.now()-s<900;)await new Promise(l=>setTimeout(l,200));await new Promise(l=>requestAnimationFrame(l));try{let l=document.createElement("canvas");l.width=Math.max(1,r.naturalWidth||10),l.height=Math.max(1,r.naturalHeight||10);let c=l.getContext("2d");c&&c.drawImage(r,0,0)}catch{}await new Promise(l=>requestAnimationFrame(l));try{r.remove()}catch(l){F(e,"safariWarmup img.remove failed",l)}i()})()}),t.querySelectorAll("canvas").forEach(i=>{try{let r=i.getContext("2d",{willReadFrequently:!0});r&&r.getImageData(0,0,1,1)}catch(r){F(e,"safariWarmup canvas poke failed",r)}}),po=!0}function us(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}typeof window<"u"&&(window.snapdom=L,window.preCache=io);
|
|
13
|
+
${m}
|
|
14
|
+
`):c+=d[0]}return c+=u.slice(f),c}let i=dn(t,e||location.href);return i=await r(i,e||location.href,0),i}var gn=/url\((["']?)([^"')]+)\1\)/g,vr=/@font-face[^{}]*\{[^}]*\}/g;function yn(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let s=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!s)continue;let r=s[1],i=s[2],u=a=>{if(!a.includes("?"))return parseInt(a,16);let l=parseInt(a.replace(/\?/g,"0"),16),c=parseInt(a.replace(/\?/g,"F"),16);return[l,c]};if(i){let a=u(r),l=u(i),c=Array.isArray(a)?a[0]:a,f=Array.isArray(l)?l[1]:l;e.push([Math.min(c,f),Math.max(c,f)])}else{let a=u(r);Array.isArray(a)?e.push([a[0],a[1]]):e.push([a,a])}}return e}function bn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,s]of e)if(n>=o&&n<=s)return!0;return!1}function ke(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(gn)){let s=(o[2]||"").trim();if(!(!s||s.startsWith("data:"))){if(!/^https?:/i.test(s))try{s=new URL(s,e||location.href).href}catch{}n.push(s)}}return n}async function wn(t,e,n=""){let o=t;for(let s of t.matchAll(gn)){let r=mt(s[0]);if(!r)continue;let i=r;if(!i.startsWith("http")&&!i.startsWith("data:"))try{i=new URL(i,e||location.href).href}catch{}if(!Q(i)){if(x.resource?.has(i)){x.font?.add(i),o=o.replace(s[0],`url(${x.resource.get(i)})`);continue}if(!x.font?.has(i))try{let u=await O(i,{as:"dataURL",useProxy:n,silent:!0});if(u.ok&&typeof u.data=="string"){let a=u.data;x.resource?.set(i,a),x.font?.add(i),o=o.replace(s[0],`url(${a})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",i)}}}return o}function Er(t){if(!t.length)return null;let e=(u,a)=>t.some(([l,c])=>!(c<u||l>a)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),s=e(880,1023),r=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":r?"cyrillic":s?"greek":o?"latin-ext":n?"latin":null}function mn(t={}){let e=new Set((t.families||[]).map(s=>String(s).toLowerCase())),n=new Set((t.domains||[]).map(s=>String(s).toLowerCase())),o=new Set((t.subsets||[]).map(s=>String(s).toLowerCase()));return(s,r)=>{if(e.size&&e.has(s.family.toLowerCase()))return!0;if(n.size)for(let i of s.srcUrls)try{if(n.has(new URL(i).host.toLowerCase()))return!0}catch{}if(o.size){let i=Er(r);if(i&&o.has(i))return!0}return!1}}function Mr(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let r of t.match(e)||[]){let i=r.match(/font-family:\s*([^;]+);/i)?.[1]||"",u=Ce(i),a=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),l=(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(),h=ke(d,location.href),y=h.length?h.map(p=>String(p).toLowerCase()).sort().join("|"):d.toLowerCase(),m=[String(u||"").toLowerCase(),a,l,c,f.toLowerCase(),y].join("|");n.has(m)||(n.add(m),o.push(r))}if(o.length===0)return t;let s=0;return t.replace(e,()=>o[s++]||"")}function Fr(t,e,n,o,s){let r=Array.from(t||[]).sort().join("|"),i=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()}):"",u=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|"),a=o||"",l=(s||[]).map(c=>String(c).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${r}::ex=${i}::lf=${u}::px=${a}::fd=${l}`}async function Sn(t,e,n,o){let s;try{s=t.cssRules||[]}catch{return}let r=(i,u)=>{try{return new URL(i,u||location.href).href}catch{return i}};for(let i of s){if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){let u=i.href?r(i.href,e):e;if(o.depth>=Zt){console.warn(`[snapDOM] CSSOM import depth exceeded (${Zt}) at ${u}`);continue}if(u&&o.visitedSheets.has(u)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${u}`);continue}u&&o.visitedSheets.add(u);let a={...o,depth:(o.depth||0)+1};await Sn(i.styleSheet,u,n,a);continue}if(i.type===CSSRule.FONT_FACE_RULE){let u=(i.style.getPropertyValue("font-family")||"").trim(),a=Ce(u);if(!a||Q(a))continue;let l=(i.style.getPropertyValue("font-weight")||"400").trim(),c=(i.style.getPropertyValue("font-style")||"normal").trim(),f=(i.style.getPropertyValue("font-stretch")||"100%").trim(),d=(i.style.getPropertyValue("src")||"").trim(),h=(i.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(a,c,l,f))continue;let y=yn(h);if(!bn(o.usedCodepoints,y))continue;let m={family:a,weightSpec:l,styleSpec:c,stretchSpec:f,unicodeRange:h,srcRaw:d,srcUrls:ke(d,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(m,y))continue;if(/url\(/i.test(d)){let p=await wn(d,e||location.href,o.useProxy);await n(`@font-face{font-family:${a};src:${p};font-style:${c};font-weight:${l};font-stretch:${f};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${a};src:${d};font-style:${c};font-weight:${l};font-stretch:${f};${h?`unicode-range:${h};`:""}}`)}}}async function te({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:s="",fontStylesheetDomains:r=[]}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let i=new Map;for(let p of t){let[g,w,S,b]=String(p).split("__");if(!g)continue;let C=i.get(g)||[];C.push({w:parseInt(w,10),s:S,st:parseInt(b,10)}),i.set(g,C)}function u(p,g,w,S){if(!i.has(p))return!1;let b=i.get(p),C=br(w),A=wr(g),k=Sr(S),v=C.min!==C.max,M=C.min,N=L=>A.kind==="normal"&&L==="normal"||A.kind!=="normal"&&(L==="italic"||L==="oblique"),_=!1;for(let L of b){let I=v?L.w>=C.min&&L.w<=C.max:L.w===M,B=N(Jt(L.s)),F=L.st>=k.min&&L.st<=k.max;if(I&&B&&F){_=!0;break}}if(_)return!0;if(!v)for(let L of b){let I=N(Jt(L.s)),B=L.st>=k.min&&L.st<=k.max;if(Math.abs(M-L.w)<=300&&I&&B)return!0}if(!v&&A.kind==="normal"&&b.some(I=>Jt(I.s)!=="normal"))for(let I of b){let B=Math.abs(M-I.w)<=300,F=I.st>=k.min&&I.st<=k.max;if(B&&F)return!0}return!1}let a=mn(n),l=Fr(t,n,o,s,r);if(x.resource?.has(l))return x.resource.get(l);let c=kr(t),f=[],d=xe;for(let p of document.querySelectorAll("style")){let g=p.textContent||"";for(let w of g.matchAll(d)){let S=(w[2]||w[4]||"").trim();if(!S||Q(S))continue;!!document.querySelector(`link[rel="stylesheet"][href="${S}"]`)||f.push(S)}}f.length&&await Promise.all(f.map(p=>new Promise(g=>{if(document.querySelector(`link[rel="stylesheet"][href="${p}"]`))return g(null);let w=document.createElement("link");w.rel="stylesheet",w.href=p,w.setAttribute("data-snapdom","injected-import"),w.onload=()=>g(w),w.onerror=()=>g(null),document.head.appendChild(w)})));let h="",y=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(p=>!!p.href);for(let p of y)try{if(Q(p.href))continue;let g="",w=!1;try{w=new URL(p.href,location.href).origin===location.origin}catch{}if(!w){let b=Array.isArray(r)?r:[];if(!Cr(p.href,c,b))continue}if(w){let b=Array.from(document.styleSheets).find(C=>C.href===p.href);if(b)try{let C=b.cssRules||[];g=Array.from(C).map(A=>A.cssText).join("")}catch{}}if(!g){let b=await O(p.href,{as:"text",useProxy:s});if(b?.ok&&typeof b.data=="string"&&(g=b.data),Q(p.href))continue}g=await Ar(g,p.href,s);let S="";for(let b of g.match(vr)||[]){let C=(b.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),A=Ce(C);if(!A||Q(A))continue;let k=(b.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(b.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),M=(b.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),N=(b.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),_=(b.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),L=ke(_,p.href);if(!u(A,v,k,M))continue;let I=yn(N);if(!bn(e,I))continue;let B={family:A,weightSpec:k,styleSpec:v,stretchSpec:M,unicodeRange:N,srcRaw:_,srcUrls:L,href:p.href};if(n&&a(B,I))continue;let F=/url\(/i.test(_)?await wn(b,p.href,s):b;S+=F}S.trim()&&(h+=S)}catch{console.warn("[snapDOM] Failed to process stylesheet:",p.href)}let m={requiredIndex:i,usedCodepoints:e,faceMatchesRequired:u,simpleExcluder:n?mn(n):null,useProxy:s,visitedSheets:new Set,depth:0};for(let p of document.styleSheets)if(!(p.href&&y.some(g=>g.href===p.href)))try{let g=p.href||location.origin+"/";g&&m.visitedSheets.add(g),await Sn(p,g,async w=>{h+=w},m)}catch{}try{for(let p of document.fonts||[]){if(!p||!p.family||p.status!=="loaded"||!p._snapdomSrc)continue;let g=String(p.family).replace(/^['"]+|['"]+$/g,"");if(Q(g)||!i.has(g)||n?.families&&n.families.some(S=>String(S).toLowerCase()===g.toLowerCase()))continue;let w=p._snapdomSrc;if(!String(w).startsWith("data:")){if(x.resource?.has(p._snapdomSrc))w=x.resource.get(p._snapdomSrc),x.font?.add(p._snapdomSrc);else if(!x.font?.has(p._snapdomSrc))try{let S=await O(p._snapdomSrc,{as:"dataURL",useProxy:s,silent:!0});if(S.ok&&typeof S.data=="string")w=S.data,x.resource?.set(p._snapdomSrc,w),x.font?.add(p._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",p._snapdomSrc);continue}}h+=`@font-face{font-family:'${g}';src:url(${w});font-style:${p.style||"normal"};font-weight:${p.weight||"normal"};}`}}catch{}for(let p of o){if(!p||typeof p!="object")continue;let g=String(p.family||"").replace(/^['"]+|['"]+$/g,"");if(!g||Q(g)||!i.has(g)||n?.families&&n.families.some(k=>String(k).toLowerCase()===g.toLowerCase()))continue;let w=p.weight!=null?String(p.weight):"normal",S=p.style!=null?String(p.style):"normal",b=p.stretchPct!=null?`${p.stretchPct}%`:"100%",C=String(p.src||""),A=C;if(!A.startsWith("data:")){if(x.resource?.has(C))A=x.resource.get(C),x.font?.add(C);else if(!x.font?.has(C))try{let k=await O(C,{as:"dataURL",useProxy:s,silent:!0});if(k.ok&&typeof k.data=="string")A=k.data,x.resource?.set(C,A),x.font?.add(C);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",C);continue}}h+=`@font-face{font-family:'${g}';src:url(${A});font-style:${S};font-weight:${w};font-stretch:${b};}`}return h&&(h=Mr(h),x.resource?.set(l,h)),h}function Ct(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=i=>{let u=gr(i.fontFamily);if(u.length)for(let a of u){let l=(c,f,d)=>`${a}__${Qt(c)}__${Jt(f)}__${yr(d)}`;e.add(l(i.fontWeight,i.fontStyle,i.fontStretch))}};o(getComputedStyle(t));let s=getComputedStyle(t,"::before");s&&s.content&&s.content!=="none"&&o(s);let r=getComputedStyle(t,"::after");for(r&&r.content&&r.content!=="none"&&o(r);n.nextNode();){let i=n.currentNode,u=getComputedStyle(i);o(u);let a=getComputedStyle(i,"::before");a&&a.content&&a.content!=="none"&&o(a);let l=getComputedStyle(i,"::after");l&&l.content&&l.content!=="none"&&o(l)}return e}function ee(t){let e=new Set,n=s=>{if(s)for(let r of s)e.add(r.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let s=o.currentNode;if(s.nodeType===Node.TEXT_NODE)n(s.nodeValue||"");else if(s.nodeType===Node.ELEMENT_NODE){let r=s;for(let i of["::before","::after"]){let a=getComputedStyle(r,i)?.getPropertyValue("content");if(!(!a||a==="none"))if(/^"/.test(a)||/^'/.test(a))n(a.slice(1,-1));else{let l=a.match(/\\[0-9A-Fa-f]{1,6}/g);if(l)for(let c of l)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 o=()=>{let s=document.createElement("div");s.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 i=document.createElement("span");i.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",i.style.fontFamily=`"${r}"`,i.style.fontWeight="700",i.style.fontStyle="italic",i.style.fontSize="32px",i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.margin="0",i.style.padding="0",s.appendChild(i)}document.body.appendChild(s),s.offsetWidth,document.body.removeChild(s)};for(let s=0;s<Math.max(1,e);s++)o(),await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)))}X();function An(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function $r(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function xn(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 Cn(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)),s="";for(let[r,i]of n)for(;o>=r;)s+=i,o-=r;return e?s:s.toLowerCase()}function kn(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 xn(t,!1);case"upper-alpha":return xn(t,!0);case"lower-roman":return Cn(t,!1);case"upper-roman":return Cn(t,!0);default:return String(t)}}function vn(t){let e=()=>x?.session?.__counterEpoch??0,n=e(),o=new WeakMap,s=t instanceof Document?t.documentElement:t,r=d=>d&&d.tagName==="LI",i=d=>{let h=0,y=d?.parentElement;if(!y)return 0;for(let m of y.children){if(m===d)break;m.tagName==="LI"&&h++}return h},u=d=>{let h=new Map;for(let[y,m]of d)h.set(y,m.slice());return h},a=(d,h,y)=>{let m=u(d),p;try{p=y.style?.counterReset||getComputedStyle(y).counterReset}catch{}if(p&&p!=="none")for(let S of p.split(",")){let b=S.trim().split(/\s+/),C=b[0],A=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!C)continue;let k=h.get(C);if(k&&k.length){let v=k.slice();v.push(A),m.set(C,v)}else m.set(C,[A])}let g;try{g=y.style?.counterSet||getComputedStyle(y).counterSet}catch{}if(g&&g!=="none")for(let S of g.split(",")){let b=S.trim().split(/\s+/),C=b[0],A=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!C)continue;let k=m.get(C)||[];k.length===0&&k.push(0),k[k.length-1]=A,m.set(C,k)}let w;try{w=y.style?.counterIncrement||getComputedStyle(y).counterIncrement}catch{}if(w&&w!=="none")for(let S of w.split(",")){let b=S.trim().split(/\s+/),C=b[0],A=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!C)continue;let k=m.get(C)||[];k.length===0&&k.push(0),k[k.length-1]+=A,m.set(C,k)}try{if(getComputedStyle(y).display==="list-item"&&r(y)){let b=y.parentElement,C=1;if(b&&b.tagName==="OL"){let k=b.getAttribute("start"),v=Number.isFinite(Number(k))?Number(k):1,M=i(y),N=y.getAttribute("value");C=Number.isFinite(Number(N))?Number(N):v+M}else C=1+i(y);let A=m.get("list-item")||[];A.length===0&&A.push(0),A[A.length-1]=C,m.set("list-item",A)}}catch{}return m},l=(d,h,y)=>{let m=a(y,h,d);o.set(d,m);let p=m;for(let w of d.children)p=l(w,m,p);let g=new Map;for(let[w,S]of y){let b=S.length,C=p.get(w);g.set(w,C&&C.length?C.slice(0,b):S.slice())}for(let[w,S]of p)!g.has(w)&&S.length&&!h.has(w)&&g.set(w,S.slice(0,1));return g},c=new Map;l(s,c,c);function f(){let d=e();if(d!==n){n=d;let h=new Map;l(s,h,h)}}return{get(d,h){f();let y=o.get(d)?.get(h);return y&&y.length?y[y.length-1]:0},getStack(d,h){f();let y=o.get(d)?.get(h);return y?y.slice():[]}}}function En(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,s=t.replace(o,(r,i,u)=>{let a=String(u).split(",").map(l=>l.trim());if(i==="counter"){let l=a[0]?.replace(/^["']|["']$/g,""),c=(a[1]||"decimal").toLowerCase(),f=n.get(e,l);return kn(f,c)}else{let l=a[0]?.replace(/^["']|["']$/g,""),c=a[1]?.replace(/^["']|["']$/g,"")??"",f=(a[2]||"decimal").toLowerCase(),d=n.getStack(e,l);return d.length?d.map(y=>kn(y,f)).join(c):""}});return $r(s)}catch{return"- "}}pt();X();var At=new WeakMap,Mn=1e3;function Rr(t,e){let n=Ln(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=$n(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):$n(t)}function Ae(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Ln(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,o=0;for(let r=0;r<e.length;r++){let i=e[r];if(i.tagName==="STYLE"){let u=i.textContent?i.textContent.length:0;n+=`S${u}|`;let a=i.sheet,l=a?Ae(a):null;l&&(o+=l.length)}else{let u=i.getAttribute("href")||"",a=i.getAttribute("media")||"all";n+=`L${u}|m:${a}|`;let l=i.sheet,c=l?Ae(l):null;c&&(o+=c.length)}}let s=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(s)?s.length:0}|tr:${o}`,n}function Fn(t,e,n){let o=Ae(t);if(!o)return!1;for(let s=0;s<o.length;s++){if(n.budget<=0)return!1;let r=o[s],i=r&&r.cssText?r.cssText:"";n.budget--;for(let u of e)if(i.includes(u))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let u=0;u<r.cssRules.length&&n.budget>0;u++){let a=r.cssRules[u],l=a&&a.cssText?a.cssText:"";n.budget--;for(let c of e)if(l.includes(c))return!0}if(n.budget<=0)return!1}return!1}function $n(t=document){let e=Ln(t),n=At.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"],s=t.querySelectorAll("style");for(let i=0;i<s.length;i++){let u=s[i].textContent||"";for(let a of o)if(u.includes(a))return At.set(t,{fingerprint:e,result:!0}),!0}let r=t.adoptedStyleSheets;if(Array.isArray(r)&&r.length){let i={budget:Mn};try{for(let u of r)if(Fn(u,o,i))return At.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let i=t.querySelectorAll('style,link[rel~="stylesheet"]'),u={budget:Mn};for(let a=0;a<i.length&&u.budget>0;a++){let l=i[a],c=null;if(l.tagName,c=l.sheet||null,c&&Fn(c,o,u))return At.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(At.set(t,{fingerprint:e,result:!0}),!0):(At.set(t,{fingerprint:e,result:!1}),!1)}var vt=new WeakMap,Rn=-1;function Lr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function Nr(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):Lr(t)}function ve(t,e){let n=t.parentElement,o=n?vt.get(n):null;return o?{get(s,r){let i=e.get(s,r),u=o.get(r);return typeof u=="number"?Math.max(i,u):i},getStack(s,r){let i=e.getStack(s,r);if(!i.length)return i;let u=o.get(r);if(typeof u=="number"){let a=i.slice();return a[a.length-1]=Math.max(a[a.length-1],u),a}return i}}:e}function Ee(t,e,n){let o=new Map;function s(a){let l=[];if(!a||a==="none")return l;for(let c of String(a).split(",")){let f=c.trim().split(/\s+/),d=f[0],h=Number.isFinite(Number(f[1]))?Number(f[1]):void 0;d&&l.push({name:d,num:h})}return l}let r=s(e?.counterReset),i=s(e?.counterIncrement);function u(a){if(o.has(a))return o.get(a).slice();let l=n.getStack(t,a);l=l.length?l.slice():[];let c=r.find(d=>d.name===a);if(c){let d=Number.isFinite(c.num)?c.num:0;l=l.length?[...l,d]:[d]}let f=i.find(d=>d.name===a);if(f){let d=Number.isFinite(f.num)?f.num:1;l.length===0&&(l=[0]),l[l.length-1]+=d}return o.set(a,l.slice()),l}return{get(a,l){let c=u(l);return c.length?c[c.length-1]:0},getStack(a,l){return u(l)},__incs:i}}function Tr(t,e,n){let o;try{o=H(t,e)}catch{}let s=o?.content;if(!s||s==="none"||s==="normal")return{text:"",incs:[]};let r=ve(t,n),i=Ee(t,o,r),u=An(s)?En(s,t,i):s;return{text:Nr(u),incs:i.__incs||[]}}async function ne(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let s=t.ownerDocument||document;if(!Rr(s,n))return;let r=x?.session?.__counterEpoch??0;if(Rn!==r&&(vt=new WeakMap,n&&(n.__counterCtx=null),Rn=r),!n.__counterCtx)try{n.__counterCtx=vn(t.ownerDocument||document)}catch(a){R(n,"buildCounterContext failed",a)}let i=n.__counterCtx;for(let a of["::before","::after","::first-letter"])try{let l=H(t,a);if(!l||l.content==="none"&&l.backgroundImage==="none"&&l.backgroundColor==="transparent"&&(l.borderStyle==="none"||parseFloat(l.borderWidth)===0)&&(!l.transform||l.transform==="none")&&l.display==="inline")continue;if(a==="::first-letter"){let $=H(t);if(!(l.color!==$.color||l.fontSize!==$.fontSize||l.fontWeight!==$.fontWeight||l.fontFamily!==$.fontFamily||l.fontStyle!==$.fontStyle||l.textTransform!==$.textTransform||l.float!==$.float||l.paddingTop!==$.paddingTop||l.paddingRight!==$.paddingRight||l.paddingBottom!==$.paddingBottom||l.paddingLeft!==$.paddingLeft||l.marginTop!==$.marginTop||l.marginRight!==$.marginRight||l.marginBottom!==$.marginBottom||l.marginLeft!==$.marginLeft))continue;let W=Array.from(e.childNodes).find(Dt=>Dt.nodeType===Node.TEXT_NODE&&Dt.textContent?.trim().length>0);if(!W)continue;let D=W.textContent,tt=D.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],yt=D.slice(tt?.length||0);if(!tt||/[\uD800-\uDFFF]/.test(tt))continue;let dt=document.createElement("span");dt.textContent=tt,dt.dataset.snapdomPseudo="::first-letter";let Ut=Yt(l),ie=bt(Ut,"span");n.styleMap.set(dt,ie);let Bt=document.createTextNode(yt);e.replaceChild(Bt,W),e.insertBefore(dt,Bt);continue}let f=l.content??"",d=f===""||f==="none"||f==="normal",{text:h,incs:y}=Tr(t,a,i),m=l.backgroundImage,p=l.backgroundColor,g=l.fontFamily,w=parseInt(l.fontSize)||32,S=parseInt(l.fontWeight)||!1,b=l.color||"#000",C=l.borderStyle,A=parseFloat(l.borderWidth),k=l.transform,v=Q(g),M=!d&&h!=="",N=m&&m!=="none",_=p&&p!=="transparent"&&p!=="rgba(0, 0, 0, 0)",L=C&&C!=="none"&&A>0,I=k&&k!=="none";if(!(M||N||_||L||I)){if(y&&y.length&&t.parentElement){let $=vt.get(t.parentElement)||new Map;for(let{name:P}of y){if(!P)continue;let W=ve(t,i),Z=Ee(t,H(t,a),W).get(t,P);$.set(P,Z)}vt.set(t.parentElement,$)}continue}let F=document.createElement("span");F.dataset.snapdomPseudo=a,F.style.pointerEvents="none";let ut=Yt(l),Ot=bt(ut,"span");if(n.styleMap.set(F,Ot),v&&h&&h.length===1){let{dataUrl:$,width:P,height:W}=await pn(h,g,S,w,b),D=document.createElement("img");D.src=$,D.style=`height:${w}px;width:${P/W*w}px;object-fit:contain;`,F.appendChild(D),e.dataset.snapdomHasIcon="true"}else if(h&&h.startsWith("url(")){let $=mt(h);if($?.trim())try{let P=await O(lt($),{as:"dataURL",useProxy:o.useProxy});if(P?.ok&&typeof P.data=="string"){let W=document.createElement("img");W.src=P.data,W.style=`width:${w}px;height:auto;object-fit:contain;`,F.appendChild(W)}}catch(P){console.error(`[snapdom] Error in pseudo ${a} for`,t,P)}}else!v&&M&&(F.textContent=h);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=l.backgroundRepeat,F.style.backgroundSize=l.backgroundSize,l.backgroundPositionX&&l.backgroundPositionY?(F.style.backgroundPositionX=l.backgroundPositionX,F.style.backgroundPositionY=l.backgroundPositionY):F.style.backgroundPosition=l.backgroundPosition,F.style.backgroundOrigin=l.backgroundOrigin,F.style.backgroundClip=l.backgroundClip,F.style.backgroundAttachment=l.backgroundAttachment,F.style.backgroundBlendMode=l.backgroundBlendMode}catch{}if(N)try{let $=wt(m),P=await Promise.all($.map(ht));F.style.backgroundImage=P.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${a}`,$)}_&&(F.style.backgroundColor=p);let it=F.childNodes.length>0||F.textContent?.trim()!==""||N||_||L||I;if(y&&y.length&&t.parentElement){let $=vt.get(t.parentElement)||new Map,P=ve(t,i),W=Ee(t,H(t,a),P);for(let{name:D}of y){if(!D)continue;let Z=W.get(t,D);$.set(D,Z)}vt.set(t.parentElement,$)}if(!it)continue;a==="::before"?(e.dataset.snapdomHasBefore="1",e.insertBefore(F,e.firstChild)):(e.dataset.snapdomHasAfter="1",e.appendChild(F))}catch(l){console.warn(`[snapdom] Failed to capture ${a} for`,t,l)}let u=Array.from(e.children).filter(a=>!a.dataset.snapdomPseudo);if(n.nodeMap)for(let a of u){let l=n.nodeMap.get(a);l instanceof Element&&await ne(l,a,n,o)}else{let a=Array.from(t.children);for(let l=0;l<Math.min(a.length,u.length);l++)await ne(a[l],u[l],n,o)}}function Nn(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,s=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(s.length===0)return;let r=/url\(\s*#([^)]+)\)/g,i=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],u=b=>window.CSS&&CSS.escape?CSS.escape(b):b.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),a="http://www.w3.org/1999/xlink",l=b=>{if(!b||!b.getAttribute)return null;let C=b.getAttribute("href")||b.getAttribute("xlink:href")||(typeof b.getAttributeNS=="function"?b.getAttributeNS(a,"href"):null);if(C)return C;let A=b.attributes;if(!A)return null;for(let k=0;k<A.length;k++){let v=A[k];if(!v||!v.name)continue;if(v.name==="href")return v.value;let M=v.name.indexOf(":");if(M!==-1&&v.name.slice(M+1)==="href")return v.value}return null},c=new Set(Array.from(t.querySelectorAll("[id]")).map(b=>b.id)),f=new Set,d=!1,h=(b,C=null)=>{if(!b)return;r.lastIndex=0;let A;for(;A=r.exec(b);){d=!0;let k=(A[1]||"").trim();k&&(c.has(k)||(f.add(k),C&&!C.has(k)&&C.add(k)))}},y=b=>{let C=b.querySelectorAll("use");for(let v of C){let M=l(v);if(!M||!M.startsWith("#"))continue;d=!0;let N=M.slice(1).trim();N&&!c.has(N)&&f.add(N)}let k=b.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 k){h(v.getAttribute("style")||"");for(let M of i)h(v.getAttribute(M))}};for(let b of s)y(b);if(!d)return;let m=t.querySelector("svg.inline-defs-container");m||(m=n.createElementNS("http://www.w3.org/2000/svg","svg"),m.classList.add("inline-defs-container"),m.setAttribute("aria-hidden","true"),m.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(m,t.firstChild||null));let p=m.querySelector("defs")||null,g=b=>{if(!b||c.has(b))return null;let C=u(b),A=k=>{let v=o.querySelector(k);return v&&!t.contains(v)?v:null};return A(`svg defs > *#${C}`)||A(`svg > symbol#${C}`)||A(`*#${C}`)};if(!f.size)return;let w=new Set(f),S=new Set;for(;w.size;){let b=w.values().next().value;if(w.delete(b),!b||c.has(b)||S.has(b))continue;let C=g(b);if(!C){S.add(b);continue}p||(p=n.createElementNS("http://www.w3.org/2000/svg","defs"),m.appendChild(p));let A=C.cloneNode(!0);A.id||A.setAttribute("id",b),p.appendChild(A),S.add(b),c.add(b);let k=[A,...A.querySelectorAll("*")];for(let v of k){let M=l(v);if(M&&M.startsWith("#")){let _=M.slice(1).trim();_&&!c.has(_)&&!S.has(_)&&w.add(_)}let N=v.getAttribute?.("style")||"";N&&h(N,w);for(let _ of i){let L=v.getAttribute?.(_);L&&h(L,w)}}}}X();function In(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(),s=t.clientHeight,r="data-snap-ph",i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let u=i.currentNode,a=getComputedStyle(u),l=a.position;if(l!=="sticky"&&l!=="-webkit-sticky")continue;let c=Tn(a.top),f=Tn(a.bottom);if(c==null&&f==null)continue;let d=Ir(u,t),h=Pr(e,d,r);if(!h)continue;let y=u.getBoundingClientRect(),m=y.width,p=y.height,g=y.left-o.left;if(!(m>0&&p>0)||!Number.isFinite(g))continue;let w=c!=null?c+n:n+(s-p-f);if(!Number.isFinite(w))continue;let S=Number.parseInt(a.zIndex,10),b=Number.isFinite(S),C=b?Math.max(S,1)+1:2,A=b?S-1:0,k=h.cloneNode(!1);k.setAttribute(r,"1"),k.style.position="sticky",k.style.left=`${g}px`,k.style.top=`${w}px`,k.style.width=`${m}px`,k.style.height=`${p}px`,k.style.visibility="hidden",k.style.zIndex=String(A),k.style.overflow="hidden",k.style.background="transparent",k.style.boxShadow="none",k.style.filter="none",h.parentElement?.insertBefore(k,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${w}px`,h.style.bottom="auto",h.style.zIndex=String(C),h.style.pointerEvents="none"}}function Tn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Ir(t,e){let n=[];for(let o=t;o&&o!==e;){let s=o.parentElement;if(!s)break;n.push(Array.prototype.indexOf.call(s.children,o)),o=s}return n.reverse()}function Pr(t,e,n){let o=t;for(let s=0;s<e.length;s++)if(o=_r(o,n)[e[s]],!o)return null;return o instanceof HTMLElement?o:null}function _r(t,e){let n=[],o=t.children;for(let s=0;s<o.length;s++){let r=o[s];r.hasAttribute(e)||n.push(r)}return n}function Pn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,s=e.borderStyle,r=e.borderWidth,i=n!=="none"&&parseFloat(o)>0,u=s==="none"||parseFloat(r)===0;i&&u&&(t.style.border=`${o} solid transparent`)}function _n(t){let e=[];try{let n=t.querySelectorAll("*");for(let o of n){if(!(o instanceof HTMLElement))continue;let s=o.style.contentVisibility||"",r=getComputedStyle(o),i=r.contentVisibility||r.getPropertyValue("content-visibility")||"";(i==="auto"||i==="hidden")&&(e.push({el:o,original:s}),o.style.contentVisibility="visible")}if(t instanceof HTMLElement){let o=getComputedStyle(t),s=o.contentVisibility||o.getPropertyValue("content-visibility")||"";(s==="auto"||s==="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 Wn(t,e={}){let n={styleMap:x.session.styleMap,styleCache:x.session.styleCache,nodeMap:x.session.nodeMap,options:e},o,s="",r="";Pn(t);let i=_n(t);try{Nn(t)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{o=await It(t,n,e)}catch(c){throw console.warn("deepClone failed:",c),c}finally{i()}try{await ne(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await cn(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 u=he(n.styleMap);s=Array.from(u.entries()).map(([c,f])=>`.${f}{${c}}`).join(""),s=r+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+s;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=u.get(f);d&&c.classList.add(d);let h=c.style?.backgroundImage,y=c.dataset?.snapdomHasIcon;h&&h!=="none"&&(c.style.backgroundImage=h),y&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,f]of n.nodeMap.entries()){let d=f.scrollLeft,h=f.scrollTop;if((d||h)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";try{let p=c.querySelectorAll("*");for(let g of p){if(!(g instanceof HTMLElement))continue;let w=g.style.position;if(w==="fixed"||w==="absolute"){let S=parseFloat(g.style.top)||0,b=parseFloat(g.style.left)||0;g.style.top=`${S+h}px`,g.style.left=`${b+d}px`,w==="fixed"&&(g.style.position="absolute")}}}catch{}let m=document.createElement("div");for(m.style.transform=`translate(${-d}px, ${-h}px)`,m.style.willChange="transform",m.style.display="inline-block",m.style.width="100%";c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m)}}let l=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(In(t,l),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||H(t);n.styleCache.set(t,c);let f=ce(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:s,styleCache:n.styleCache}}pt();var On="http://www.w3.org/1999/xlink";function Wr(t){return t.getAttribute("href")||t.getAttribute("xlink:href")||(typeof t.getAttributeNS=="function"?t.getAttributeNS(On,"href"):null)}function Or(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,o=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,r=parseFloat(t.style?.width||"")||0,i=parseFloat(t.style?.height||"")||0,u=e||r||o||t.width||t.naturalWidth||100,a=n||i||s||t.height||t.naturalHeight||100;return{width:u,height:a}}async function Un(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async i=>{if(!i.getAttribute("src")){let d=i.currentSrc||i.src||"";d&&i.setAttribute("src",d)}i.removeAttribute("srcset"),i.removeAttribute("sizes");let u=i.src||"";if(!u)return;let a=await O(u,{as:"dataURL",useProxy:e.useProxy});if(a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")){i.src=a.data,i.width||(i.width=i.naturalWidth||100),i.height||(i.height=i.naturalHeight||100);return}let{width:l,height:c}=Or(i),{fallbackURL:f}=e||{};if(f)try{let d=typeof f=="function"?await f({width:l,height:c,src:u,element:i}):f;if(d){let h=await O(d,{as:"dataURL",useProxy:e.useProxy});if(h?.ok&&typeof h.data=="string"){i.src=h.data,i.width||(i.width=l),i.height||(i.height=c);return}}}catch{}if(e.placeholders!==!1){let d=document.createElement("div");d.style.cssText=[`width:${l}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),d.textContent="img",i.replaceWith(d)}else{let d=document.createElement("div");d.style.cssText=`display:inline-block;width:${l}px;height:${c}px;visibility:hidden;`,i.replaceWith(d)}};for(let i=0;i<n.length;i+=4){let u=n.slice(i,i+4).map(o);await Promise.allSettled(u)}let s=Array.from(t.querySelectorAll("image")),r=async i=>{let u=Wr(i);if(!u||u.startsWith("data:")||u.startsWith("blob:"))return;let a=await O(u,{as:"dataURL",useProxy:e.useProxy});a.ok&&typeof a.data=="string"&&a.data.startsWith("data:")&&(i.setAttribute("href",a.data),i.removeAttribute("xlink:href"),typeof i.removeAttributeNS=="function"&&i.removeAttributeNS(On,"href"))};for(let i=0;i<s.length;i+=4){let u=s.slice(i,i+4).map(r);await Promise.allSettled(u)}}G();async function oe(t,e,n,o={}){let s=[[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"],i=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],u=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],a=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;s.length;){let[l,c]=s.shift();if(!c)continue;let f=n.get(l)||H(l);n.has(l)||n.set(l,f);let d=(()=>{let m=f.getPropertyValue("border-image"),p=f.getPropertyValue("border-image-source");return m&&m!=="none"||p&&p!=="none"})();for(let m of u){let p=f.getPropertyValue(m);p&&c.style.setProperty(m,p)}for(let m of r){let p=f.getPropertyValue(m);if(m==="background-image"&&(!p||p==="none")){let S=f.getPropertyValue("background");S&&/url\s*\(/.test(S)&&(p=wt(S).filter(b=>/url\s*\(/.test(b)).join(", ")||p)}if(!p||p==="none")continue;let g=wt(p),w=await Promise.all(g.map(S=>ht(S,o)));w.some(S=>S&&S!=="none"&&!/^url\(undefined/.test(S))&&c.style.setProperty(m,w.join(", "))}for(let m of i){let p=f.getPropertyValue(m);!p||p==="initial"||c.style.setProperty(m,p)}if(d)for(let m of a){let p=f.getPropertyValue(m);!p||p==="initial"||c.style.setProperty(m,p)}let h=l.shadowRoot?Array.from(l.shadowRoot.children).filter(m=>m.tagName!=="STYLE"):Array.from(l.children),y=Array.from(c.children).filter(m=>!(m.dataset?.snapdomPseudo||m.tagName==="STYLE"&&m.dataset?.sd));for(let m=0;m<Math.min(h.length,y.length);m++)s.push([h[m],y[m]])}}G();X();function Bn(t){if(!t)return()=>{};let e=[];function n(o){let s=Ur(o);s&&e.push(s);for(let r of o.children||[])n(r)}return n(t),()=>e.forEach(o=>o())}function Ur(t){if(!t)return()=>{};let e=Br(t);if(e<=0)return()=>{};if(!Vr(t))return()=>{};let n=getComputedStyle(t),o=Math.round(Dr(n)*e+Hr(n)),s=t.textContent??"",r=s;if(t.scrollHeight<=o+.5)return()=>{};let i=0,u=s.length,a=-1;for(;i<=u;){let l=i+u>>1;t.textContent=s.slice(0,l)+"\u2026",t.scrollHeight<=o+.5?(a=l,i=l+1):u=l-1}return t.textContent=(a>=0?s.slice(0,a):"")+"\u2026",()=>{t.textContent=r}}function Br(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 Dr(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 Hr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Vr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Pt=[];function Dn(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 Hn(...t){let e=t.flat();for(let n of e){let o=Dn(n);o&&(Pt.some(s=>s&&s.name&&o.name&&s.name===o.name)||Pt.push(o))}}function Vn(t){return(t&&Array.isArray(t.plugins)?t.plugins:Pt)||Pt}async function J(t,e,n){let o=n,s=Vn(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let u=await i(e,o);typeof u<"u"&&(o=u)}return o}async function jn(t,e,n){let o=[],s=Vn(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let u=await i(e,n);typeof u<"u"&&o.push(u)}return o}function jr(t){let e=[];if(Array.isArray(t))for(let n of t){let o=Dn(n);if(!o||!o.name)continue;let s=e.findIndex(r=>r&&r.name===o.name);s>=0&&e.splice(s,1),e.push(o)}for(let n of Pt)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function qn(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=jr(e)),t}G();function zn(t,e,n={}){if(!t||!e||!e.style)return;let o=getComputedStyle(t);try{e.style.boxShadow="none"}catch(i){R(n,"stripRootShadows boxShadow",i)}try{e.style.textShadow="none"}catch(i){R(n,"stripRootShadows textShadow",i)}try{e.style.outline="none"}catch(i){R(n,"stripRootShadows outline",i)}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(i){R(n,"stripRootShadows filter",i)}}function qr(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 zr(t,e={}){let{stripFrameworkDirectives:n=!0}=e,o=new Set(["xml","xlink"]),s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let r=s.currentNode;for(let i of Array.from(r.attributes)){let u=i.name;if(u.includes("@")){r.removeAttribute(u);continue}if(u.includes(":")){let a=u.split(":",1)[0];if(!o.has(a)){r.removeAttribute(u);continue}}if(n&&(u.startsWith("x-")||u.startsWith("v-")||u.startsWith(":")||u.startsWith("on:")||u.startsWith("bind:")||u.startsWith("let:")||u.startsWith("class:"))){r.removeAttribute(u);continue}}}}function Xn(t,e={}){t&&(zr(t,e),qr(t))}function Xr(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function Yr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Gr(t,e){if(!(t instanceof Element)||Xr(t)||Yr(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 Yn(t,e,n=new Map){function o(s,r){if(!(s instanceof Element)||!(r instanceof Element))return;let i=s.childElementCount>r.childElementCount,u=n.get(s)||getComputedStyle(s);if(n.has(s)||n.set(s,u),i&&Gr(s,u)){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=u.overflowY||u.overflowBlock||"visible",f=u.overflowX||u.overflowInline||"visible";(c!=="visible"||f!=="visible")&&(r.style.overflow="visible")}let a=Array.from(s.children),l=Array.from(r.children);for(let c=0;c<Math.min(a.length,l.length);c++)o(a[c],l[c])}o(t,e)}function Kr(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed")}function Qr(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 Gn(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),s=1/0,r=-1/0,i=!1,u=Array.from(t.children);for(let h of u){if(Qr(h,e)||!Kr(h))continue;let y=h.getBoundingClientRect(),m=y.top-o.top,p=y.bottom-o.top;p<=m||(m<s&&(s=m),p>r&&(r=p),i=!0)}let a=i?Math.max(0,r-s):0,l=parseFloat(n.borderTopWidth)||0,c=parseFloat(n.borderBottomWidth)||0,f=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingBottom)||0;return l+c+f+d+a}var E=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t,Jr=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Me(t,e=new Set){let n="";if(!t)return n;for(let o=0;o<t.length;o++){let s=t[o];try{if(s.type===CSSRule.IMPORT_RULE&&s.styleSheet){n+=Me(s.styleSheet.cssRules,e);continue}if(s.type===CSSRule.MEDIA_RULE&&s.cssRules){let r=Me(s.cssRules,e);r&&(n+=`@media ${s.conditionText}{${r}}`);continue}if(s.type===CSSRule.STYLE_RULE){let r=s.selectorText||"";if(Jr.test(r)){let i=s.cssText;i&&!e.has(i)&&(e.add(i),n+=i)}}}catch{}}return n}function Kn(t){if(!t||!t.styleSheets)return"";let e=new Set,n="";for(let o of Array.from(t.styleSheets))try{let s=o.cssRules;s&&(n+=Me(s,e))}catch{}return n}function Qn(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(u=>u.trim()),o=0,s=0,r=0,i=0;for(let u of n){let a=u.match(/-?\d+(\.\d+)?px/g)?.map(m=>parseFloat(m))||[];if(a.length<2)continue;let[l,c,f=0,d=0]=a,h=Math.abs(l)+f+d,y=Math.abs(c)+f+d;s=Math.max(s,h+Math.max(l,0)),i=Math.max(i,h+Math.max(-l,0)),r=Math.max(r,y+Math.max(c,0)),o=Math.max(o,y+Math.max(-c,0))}return{top:Math.ceil(o),right:Math.ceil(s),bottom:Math.ceil(r),left:Math.ceil(i)}}function Jn(t){let e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function Zn(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 to(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,s=0,r=0,i=0,u=!1;for(let a of n){u=!0;let l=a.match(/-?\d+(?:\.\d+)?px/gi)?.map(m=>parseFloat(m))||[],[c=0,f=0,d=0]=l,h=Math.abs(c)+d,y=Math.abs(f)+d;s=Math.max(s,h+Math.max(c,0)),i=Math.max(i,h+Math.max(-c,0)),r=Math.max(r,y+Math.max(f,0)),o=Math.max(o,y+Math.max(-f,0))}return{bleed:{top:E(o),right:E(s),bottom:E(r),left:E(i)},has:u}}function eo(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")try{let u=so(t);if(u.a===1&&u.b===0&&u.c===0&&u.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}function s(u,a,l,c){let f=Math.sqrt(u*u+a*a)||0,d=0,h=0;if(f>0){let y=u/f,m=a/f;d=y*l+m*c;let p=l-y*d,g=c-m*d;h=Math.sqrt(p*p+g*g)||0,h>0?d=d/h:d=0}return{a:f,b:0,c:d*h,d:h}}let r=o.match(/^matrix\(\s*([^)]+)\)$/i);if(r){let u=r[1].split(",").map(a=>parseFloat(a.trim()));if(u.length===6&&u.every(Number.isFinite)){let[a,l,c,f]=u,d=s(a,l,c,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}let i=o.match(/^matrix3d\(\s*([^)]+)\)$/i);if(i){let u=i[1].split(",").map(a=>parseFloat(a.trim()));if(u.length===16&&u.every(Number.isFinite)){let a=u[0],l=u[1],c=u[4],f=u[5],d=s(a,l,c,f);try{e.style.transform=`matrix(${d.a}, ${d.b}, ${d.c}, ${d.d}, 0, 0)`}catch{}return d}}try{let u=new DOMMatrix(o),a=s(u.a,u.b,u.c,u.d);try{e.style.transform=`matrix(${a.a}, ${a.b}, ${a.c}, ${a.d}, 0, 0)`}catch{}return a}catch{return null}}function $e(t,e,n,o,s){let r=n.a,i=n.b,u=n.c,a=n.d,l=n.e||0,c=n.f||0;function f(g,w){let S=g-o,b=w-s,C=r*S+u*b,A=i*S+a*b;return C+=o+l,A+=s+c,[C,A]}let d=[f(0,0),f(t,0),f(0,e),f(t,e)],h=1/0,y=1/0,m=-1/0,p=-1/0;for(let[g,w]of d)g<h&&(h=g),w<y&&(y=w),g>m&&(m=g),w>p&&(p=w);return{minX:h,minY:y,maxX:m,maxY:p,width:m-h,height:p-y}}function no(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[s,r]=[o[0]||"0",o[1]||"0"],i=(u,a)=>{let l=u.toLowerCase();return l==="left"||l==="top"?0:l==="center"?a/2:l==="right"||l==="bottom"?a:l.endsWith("px")?parseFloat(l)||0:l.endsWith("%")?(parseFloat(l)||0)*a/100:/^-?\d+(\.\d+)?$/.test(l)&&parseFloat(l)||0};return{ox:i(s,e),oy:i(r,n)}}function oo(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let s=a=>{try{return typeof n.has=="function"&&!n.has(a)||typeof n.get!="function"?null:n.get(a)}catch{return null}},r=s("rotate");if(r)if(r.angle){let a=r.angle;e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.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 a=getComputedStyle(t);e.rotate=a.rotate&&a.rotate!=="none"?a.rotate:"0deg"}let i=s("scale");if(i){let a="x"in i&&i.x?.value!=null?i.x.value:Array.isArray(i)?i[0]?.value:Number(i)||1,l="y"in i&&i.y?.value!=null?i.y.value:Array.isArray(i)?i[1]?.value:a;e.scale=`${a} ${l}`}else{let a=getComputedStyle(t);e.scale=a.scale&&a.scale!=="none"?a.scale:null}let u=s("translate");if(u){let a="x"in u&&"value"in u.x?u.x.value:Array.isArray(u)?u[0]?.value:0,l="y"in u&&"value"in u.y?u.y.value:Array.isArray(u)?u[1]?.value:0,c="x"in u&&u.x?.unit?u.x.unit:"px",f="y"in u&&u.y?.unit?u.y.unit:"px";e.translate=`${a}${c} ${l}${f}`}else{let a=getComputedStyle(t);e.translate=a.translate&&a.translate!=="none"?a.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 Fe=null;function Zr(){if(Fe)return Fe;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),Fe=t,t}function ro(t){let e=Zr(),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=so(n);return e.removeChild(n),o}function io(t){let e=getComputedStyle(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 s=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",r=e.scale&&e.scale!=="none"&&e.scale!=="1",i=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(s||r||i)}function so(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}async function Re(t,e){if(!t)throw new Error("Element cannot be null or undefined");jt(e.cache);let n=e.fast,o=e.outerTransforms!==!1,s=!!e.outerShadows,r={element:t,options:e,plugins:e.plugins},i,u,a,l="",c="",f,d,h=null;await J("beforeSnap",r),await J("beforeClone",r);let y=Bn(r.element);try{({clone:i,classCSS:u,styleCache:a}=await Wn(r.element,r.options)),!o&&i&&(h=eo(r.element,i)),!s&&i&&zn(r.element,i,r.options)}finally{y()}if(r={clone:i,classCSS:u,styleCache:a,...r},await J("afterClone",r),Xn(r.clone),r.options?.excludeMode==="remove")try{Yn(r.element,r.clone,r.styleCache)}catch(S){console.warn("[snapdom] shrink pass failed:",S)}try{await fn(r.clone,r.element)}catch{}await new Promise(S=>{ot(async()=>{await Un(r.clone,r.options),S()},{fast:n})}),await new Promise(S=>{ot(async()=>{await oe(r.element,r.clone,r.styleCache,r.options),S()},{fast:n})}),e.embedFonts&&await new Promise(S=>{ot(async()=>{let b=Ct(r.element),C=ee(r.element);if(V()){let A=new Set(Array.from(b).map(k=>String(k).split("__")[0]).filter(Boolean));await kt(A,1)}l=await te({required:b,usedCodepoints:C,preCached:!1,exclude:r.options.excludeFonts,useProxy:r.options.useProxy,fontStylesheetDomains:r.options.fontStylesheetDomains}),S()},{fast:n})});let m=me(r.clone).sort(),p=m.join(",");x.baseStyle.has(p)?c=x.baseStyle.get(p):await new Promise(S=>{ot(()=>{c=pe(m),x.baseStyle.set(p,c),S()},{fast:n})});let g=Kn(r.element?.ownerDocument||document);r={fontsCSS:l,baseCSS:c,scrollbarCSS:g,...r},await J("beforeRender",r),await new Promise(S=>{ot(()=>{let b=H(r.element),C=r.element.getBoundingClientRect(),A=Math.max(1,E(r.element.offsetWidth||parseFloat(b.width)||C.width||1)),k=Math.max(1,E(r.element.offsetHeight||parseFloat(b.height)||C.height||1)),v=r.element.ownerDocument||document;if(r.element===v.body||r.element===v.documentElement){let j=Math.max(r.element.scrollHeight||0,v.documentElement?.scrollHeight||0,v.body?.scrollHeight||0),z=Math.max(r.element.scrollWidth||0,v.documentElement?.scrollWidth||0,v.body?.scrollWidth||0);j>0&&(k=Math.max(k,E(j))),z>0&&(A=Math.max(A,E(z)));try{let et=(r.scrollbarCSS||"").length+(r.baseCSS||"").length+(r.fontsCSS||"").length+(r.classCSS||"").length,Y=x.measureHints.get(r.element);if(Y&&Y.cssLen===et&&Y.w0===A)Y.csh>0&&(k=Math.max(k,E(Y.csh))),Y.csw>0&&(A=Math.max(A,E(Y.csw)));else{let nt=v.createElement("div");nt.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+A+"px!important;overflow:visible!important;visibility:hidden!important;";let Vt=v.createElement("style");Vt.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,nt.appendChild(Vt),nt.appendChild(r.clone.cloneNode(!0)),v.body.appendChild(nt);let Et=nt.scrollHeight,ct=nt.scrollWidth;v.body.removeChild(nt),x.measureHints.set(r.element,{cssLen:et,w0:A,csh:Et,csw:ct}),Et>0&&(k=Math.max(k,E(Et))),ct>0&&(A=Math.max(A,E(ct)))}}catch{}}if(r.options?.excludeMode==="remove"){let j=Gn(r.element,r.options);Number.isFinite(j)&&j>0&&(k=Math.max(1,Math.min(k,E(j+1))))}let N=(j,z=NaN)=>{let et=typeof j=="string"?parseFloat(j):j;return Number.isFinite(et)?et:z},_=N(r.options.width),L=N(r.options.height),I=A,B=k,F=Number.isFinite(_),ut=Number.isFinite(L),Ot=k>0?A/k:1;F&&ut?(I=Math.max(1,E(_)),B=Math.max(1,E(L))):F?(I=Math.max(1,E(_)),B=Math.max(1,E(I/(Ot||1)))):ut?(B=Math.max(1,E(L)),I=Math.max(1,E(B*(Ot||1)))):(I=A,B=k);let ft=0,it=0,$=A,P=k;if(!o&&h&&Number.isFinite(h.a)){let j={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},z=$e(A,k,j,0,0);ft=E(z.minX),it=E(z.minY),$=E(z.maxX),P=E(z.maxY)}else if(o&&ao(r.element)){let z=b.transform&&b.transform!=="none"?b.transform:"",et=oo(r.element),Y=ro({baseTransform:z,rotate:et.rotate||"0deg",scale:et.scale,translate:et.translate}),{ox:nt,oy:Vt}=no(b,A,k),Et=Y.is2D?Y:new DOMMatrix(Y.toString()),ct=$e(A,k,Et,nt,Vt);ft=E(ct.minX),it=E(ct.minY),$=E(ct.maxX),P=E(ct.maxY)}let W=Qn(b),D=Jn(b),Z=Zn(b),tt=to(b),yt=s?{top:E(W.top+D.top+Z.top+tt.bleed.top),right:E(W.right+D.right+Z.right+tt.bleed.right),bottom:E(W.bottom+D.bottom+Z.bottom+tt.bleed.bottom),left:E(W.left+D.left+Z.left+tt.bleed.left)}:{top:0,right:0,bottom:0,left:0};ft=E(ft-yt.left),it=E(it-yt.top),$=E($+yt.right),P=E(P+yt.bottom);let dt=Math.max(1,E($-ft)),Ut=Math.max(1,E(P-it)),ie=F||ut?E(I/A):1,Bt=ut||F?E(B/k):1,Dt=Math.max(1,E(dt*ie)),wo=Math.max(1,E(Ut*Bt)),_e="http://www.w3.org/2000/svg",So=V()&&ao(r.element)?1:0,st=E(So+(o?0:1)),at=document.createElementNS(_e,"foreignObject"),xo=E(ft),Co=E(it);at.setAttribute("x",String(E(-(xo-st)))),at.setAttribute("y",String(E(-(Co-st)))),at.setAttribute("width",String(E(A+st*2))),at.setAttribute("height",String(E(k+st*2))),at.style.overflow="visible";let We=document.createElement("style"),ko='svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject *{min-width:0;} foreignObject pre,foreignObject [style*="white-space"]{white-space:inherit;}';We.textContent=(r.scrollbarCSS||"")+r.baseCSS+r.fontsCSS+ko+r.classCSS,at.appendChild(We);let Ht=document.createElement("div");Ht.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),Ht.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${E(A)}px;height:${E(k)}px`,Ht.appendChild(r.clone),at.appendChild(Ht);let Ao=new XMLSerializer().serializeToString(at),se=E(dt+st*2),ae=E(Ut+st*2),Oe=F||ut;e.meta={w0:A,h0:k,vbW:se,vbH:ae,targetW:I,targetH:B};let vo=V()&&Oe?se:E(Dt+st*2),Eo=V()&&Oe?ae:E(wo+st*2),Mo=parseFloat(H(v.documentElement)?.fontSize)||16;d=`<svg xmlns="${_e}" width="${vo}" height="${Eo}" viewBox="0 0 ${se} ${ae}" font-size="${Mo}px">`+Ao+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(d)}`,r={svgString:d,dataURL:f,...r},S()},{fast:n})}),await J("afterRender",r);let w=document.getElementById("snapdom-sandbox");return w&&w.style.position==="absolute"&&w.remove(),r.dataURL}function ao(t){return io(t)}X();function co(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Ue(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}}St();be();G();pt();X();async function lo(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,s=e.cache??e.cacheOpt??"full";jt(s);try{await document.fonts?.ready}catch{}try{fe()}catch{}x.session=x.session||{},x.session.styleCache||(x.session.styleCache=new WeakMap),x.image=x.image||new U(100),x.background=x.background||new U(100);try{await oe(t,void 0,x.session.styleCache,{useProxy:o})}catch{}let r=[],i=[];try{if(t&&t.nodeType===1){let a=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];i=[t,...a],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]")),i=Array.from(t.querySelectorAll("*")))}catch{}let u=[];for(let a of r){let l=a?.currentSrc||a?.src;if(l&&!x.image.has(l)){let c=Promise.resolve().then(async()=>{let f=await O(l,{as:"dataURL",useProxy:o});f?.ok&&typeof f.data=="string"&&x.image.set(l,f.data)}).catch(()=>{});u.push(c)}}for(let a of i){let l="";try{l=a?.style?.backgroundImage||"",(!l||l==="none")&&(l=H(a).backgroundImage)}catch{}if(l&&l!=="none"){let c=l.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let f of c){let d=Promise.resolve().then(()=>ht(f,{...e,useProxy:o})).catch(()=>{});u.push(d)}}}if(n)try{let a=Ct(t),l=ee(t);if(typeof V=="function"?V():!!V){let f=new Set(Array.from(a).map(d=>String(d).split("__")[0]).filter(Boolean));await kt(f,3)}await te({required:a,usedCodepoints:l,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o,fontStylesheetDomains:e.fontStylesheetDomains})}catch{}await Promise.allSettled(u)}function ui(...t){return Hn(...t),T}var T=Object.assign(di,{plugins:ui}),bo=Symbol("snapdom.internal"),fi=Symbol("snapdom.internal.silent"),yo=!1;async function di(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=co(e);if(qn(n,e&&e.plugins),V()&&(n.embedFonts===!0||pi(t))){if(n.embedFonts)try{let s=Ct(t),r=new Set([...s].map(i=>String(i).split("__")[0]).filter(Boolean));await kt(r,1)}catch{}let o=n.safariWarmupAttempts??3;for(let s=0;s<o;s++)try{await mi(t,e)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&un(n.iconFonts),n.snap||(n.snap={toPng:(o,s)=>T.toPng(o,s),toSvg:(o,s)=>T.toSvg(o,s)}),T.capture(t,n,bo)}T.capture=async(t,e,n)=>{if(n!==bo)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Re(t,e),s={img:async(m,p)=>{let{toImg:g}=await Promise.resolve().then(()=>(Te(),Ne));return g(o,{...m,...p||{}})},svg:async(m,p)=>{let{toSvg:g}=await Promise.resolve().then(()=>(Te(),Ne));return g(o,{...m,...p||{}})},canvas:async(m,p)=>{let{toCanvas:g}=await Promise.resolve().then(()=>(_t(),fo));return g(o,{...m,...p||{}})},blob:async(m,p)=>{let{toBlob:g}=await Promise.resolve().then(()=>(Pe(),mo));return g(o,{...m,...p||{}})},png:async(m,p)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Wt(),re));return g(o,{...m,...p||{},format:"png"})},jpeg:async(m,p)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Wt(),re));return g(o,{...m,...p||{},format:"jpeg"})},webp:async(m,p)=>{let{rasterize:g}=await Promise.resolve().then(()=>(Wt(),re));return g(o,{...m,...p||{},format:"webp"})},download:async(m,p)=>{let{download:g}=await Promise.resolve().then(()=>(go(),ho));return g(o,{...m,...p||{}})}},r={};for(let m of["img","svg","canvas","blob","png","jpeg","webp"])r[m]=async p=>s[m](e,{...p||{},[fi]:!0});r.jpg=r.jpeg;let i={...e,export:{url:o},exports:r},u=await jn("defineExports",i),a=Object.assign({},...u.filter(m=>m&&typeof m=="object")),l={...s,...a};l.jpeg&&!l.jpg&&(l.jpg=(m,p)=>l.jpeg(m,p));function c(m,p){let g={...e,...p||{}};return(m==="jpeg"||m==="jpg")&&(g.backgroundColor==null||g.backgroundColor==="transparent")&&(g.backgroundColor="#ffffff"),g}let f=!1,d=Promise.resolve();async function h(m,p){let g=async()=>{let w=l[m];if(!w)throw new Error(`[snapdom] Unknown export type: ${m}`);let S=c(m,p),b={...e,export:{type:m,options:S,url:o}};await J("beforeExport",b);let C=await w(b,S);return await J("afterExport",b,C),f||(f=!0,await J("afterSnap",e)),C};return d=d.then(g)}let y={url:o,toRaw:()=>o,to:(m,p)=>h(m,p),toImg:m=>h("img",m),toSvg:m=>h("svg",m),toCanvas:m=>h("canvas",m),toBlob:m=>h("blob",m),toPng:m=>h("png",m),toJpg:m=>h("jpg",m),toWebp:m=>h("webp",m),download:m=>h("download",m)};for(let m of Object.keys(l)){let p="to"+m.charAt(0).toUpperCase()+m.slice(1);y[p]||(y[p]=g=>h(m,g))}return y};T.toRaw=(t,e)=>T(t,e).then(n=>n.toRaw());T.toImg=(t,e)=>T(t,e).then(n=>n.toImg());T.toSvg=(t,e)=>T(t,e).then(n=>n.toSvg());T.toCanvas=(t,e)=>T(t,e).then(n=>n.toCanvas());T.toBlob=(t,e)=>T(t,e).then(n=>n.toBlob());T.toPng=(t,e)=>T(t,{...e,format:"png"}).then(n=>n.toPng());T.toJpg=(t,e)=>T(t,{...e,format:"jpeg"}).then(n=>n.toJpg());T.toWebp=(t,e)=>T(t,{...e,format:"webp"}).then(n=>n.toWebp());T.download=(t,e)=>T(t,e).then(n=>n.download());async function mi(t,e){if(yo)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await Re(t,n)}catch(s){R(e,"safariWarmup pre-capture failed",s)}await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s))),o&&await new Promise(s=>{let r=new Image;try{r.decoding="sync",r.loading="eager"}catch(i){R(e,"safariWarmup img hints failed",i)}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(u){R(e,"safariWarmup img.decode failed",u)}let i=performance.now();for(;!(r.complete&&r.naturalWidth>0)&&performance.now()-i<900;)await new Promise(u=>setTimeout(u,200));await new Promise(u=>requestAnimationFrame(u));try{let u=document.createElement("canvas");u.width=Math.max(1,r.naturalWidth||10),u.height=Math.max(1,r.naturalHeight||10);let a=u.getContext("2d");a&&a.drawImage(r,0,0)}catch{}await new Promise(u=>requestAnimationFrame(u));try{r.remove()}catch(u){R(e,"safariWarmup img.remove failed",u)}s()})()}),t.querySelectorAll("canvas").forEach(s=>{try{let r=s.getContext("2d",{willReadFrequently:!0});r&&r.getImageData(0,0,1,1)}catch(r){R(e,"safariWarmup canvas poke failed",r)}}),yo=!0}function pi(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),s=o.backgroundImage&&o.backgroundImage!=="none",r=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(s||r||n.tagName==="CANVAS")return!0}return!1}typeof window<"u"&&(window.snapdom=T,window.preCache=lo);
|