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