@zumer/snapdom 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +122 -69
  2. package/dist/{modules/chunks/chunk-SSUBCN7X.js → plugins.mjs} +2 -2
  3. package/dist/preCache.mjs +10 -0
  4. package/dist/snapdom.js +6 -6
  5. package/dist/snapdom.mjs +6 -6
  6. package/package.json +5 -5
  7. package/dist/modules/chunks/chunk-3JLSSUO4.js +0 -7
  8. package/dist/modules/chunks/chunk-3PHM6WOF.js +0 -7
  9. package/dist/modules/chunks/chunk-3VYIPD3A.js +0 -7
  10. package/dist/modules/chunks/chunk-4E2QQYX5.js +0 -7
  11. package/dist/modules/chunks/chunk-4IERUYP4.js +0 -7
  12. package/dist/modules/chunks/chunk-4Z46XXMY.js +0 -10
  13. package/dist/modules/chunks/chunk-53XQJAU5.js +0 -7
  14. package/dist/modules/chunks/chunk-5ZWTRQ52.js +0 -10
  15. package/dist/modules/chunks/chunk-7427JF2H.js +0 -10
  16. package/dist/modules/chunks/chunk-ANSXOGKI.js +0 -7
  17. package/dist/modules/chunks/chunk-BF74J4A5.js +0 -8
  18. package/dist/modules/chunks/chunk-BUMT6T6O.js +0 -10
  19. package/dist/modules/chunks/chunk-CNTQFGEZ.js +0 -10
  20. package/dist/modules/chunks/chunk-CRBLWEX6.js +0 -10
  21. package/dist/modules/chunks/chunk-CS7DTJ7I.js +0 -7
  22. package/dist/modules/chunks/chunk-DTQFIIVX.js +0 -7
  23. package/dist/modules/chunks/chunk-EBDTZNMR.js +0 -7
  24. package/dist/modules/chunks/chunk-EVYDSB2B.js +0 -7
  25. package/dist/modules/chunks/chunk-EZMCZKDW.js +0 -7
  26. package/dist/modules/chunks/chunk-FQK3JDTN.js +0 -10
  27. package/dist/modules/chunks/chunk-FTKOXG2W.js +0 -7
  28. package/dist/modules/chunks/chunk-G4EP52KJ.js +0 -10
  29. package/dist/modules/chunks/chunk-GIYVHLCQ.js +0 -8
  30. package/dist/modules/chunks/chunk-GZX3IERM.js +0 -8
  31. package/dist/modules/chunks/chunk-LCE36WDF.js +0 -10
  32. package/dist/modules/chunks/chunk-MW6X4KTL.js +0 -7
  33. package/dist/modules/chunks/chunk-N2KKO64J.js +0 -10
  34. package/dist/modules/chunks/chunk-NM4NY5FQ.js +0 -7
  35. package/dist/modules/chunks/chunk-PZIG3IRP.js +0 -10
  36. package/dist/modules/chunks/chunk-Q2Z2CG2I.js +0 -7
  37. package/dist/modules/chunks/chunk-Q55H7S7M.js +0 -7
  38. package/dist/modules/chunks/chunk-QBJ6HQLA.js +0 -10
  39. package/dist/modules/chunks/chunk-RKOPBBFA.js +0 -10
  40. package/dist/modules/chunks/chunk-SMBRKOUP.js +0 -7
  41. package/dist/modules/chunks/chunk-T4JIPPZO.js +0 -7
  42. package/dist/modules/chunks/chunk-X6RBKLFD.js +0 -10
  43. package/dist/modules/chunks/chunk-Y7FY32AO.js +0 -7
  44. package/dist/modules/chunks/rasterize-34PCWURX.js +0 -7
  45. package/dist/modules/chunks/rasterize-JS5G2XHH.js +0 -7
  46. package/dist/modules/chunks/rasterize-WOXTJCMX.js +0 -7
  47. package/dist/modules/exporters/download.js +0 -7
  48. package/dist/modules/exporters/toBlob.js +0 -7
  49. package/dist/modules/exporters/toCanvas.js +0 -7
  50. package/dist/modules/exporters/toImg.js +0 -7
  51. package/dist/modules/exporters/toJpg.js +0 -7
  52. package/dist/modules/exporters/toPng.js +0 -7
  53. package/dist/modules/exporters/toSvg.js +0 -7
  54. package/dist/modules/exporters/toWebp.js +0 -7
  55. package/dist/modules/plugins.js +0 -7
  56. package/dist/modules/preCache.js +0 -7
  57. package/dist/modules/snapdom.js +0 -7
package/dist/snapdom.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  * SnapDOM
3
- * v2.0.2
3
+ * v2.1.0
4
4
  * Author: Juan Martin Muda
5
5
  * License: MIT
6
6
  */
7
- var ao=Object.defineProperty;var D=(t,e)=>()=>(t&&(e=t(t=0)),e);var kt=(t,e)=>{for(var n in e)ao(t,n,{get:e[n],enumerable:!0})};function _t(t="soft"){switch(S.session.__counterEpoch=(S.session.__counterEpoch||0)+1,t){case"auto":{S.session.styleMap=new Map,S.session.nodeMap=new Map;return}case"soft":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap,S.computedStyle=new WeakMap,S.baseStyle=new Map,S.defaultStyle=new Map,S.image=new Map,S.background=new Map,S.resource=new Map,S.font=new Set;return}default:{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}}}var S,H=D(()=>{S={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function it(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function se(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==6?`matrix(${o})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==16?`matrix3d(${o})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function J(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}var At=D(()=>{});function co(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,s=0;function r(i,l,c){if(s>=n)return;let a=Date.now();(o.get(l)||0)>a||(o.set(l,a+e),s++,i==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(i,l){r("warn",i,l)},errorOnce(i,l){r("error",i,l)},reset(){o.clear(),s=0}}}function lo(t){return/^data:|^blob:|^about:blank$/i.test(t)}function uo(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(o||".",n),r=new URL(t,n);if(r.origin===s.origin)return!0;let i=r.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function fo(t,e){if(!e||lo(t)||uo(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function mo(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",J(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}${J(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function Re(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function po(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function P(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,s=e.useProxy||"",r=e.errorTTL??8e3,i=e.headers||{},l=!!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[,d="",g=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(d)?atob(g):decodeURIComponent(g),w=new Uint8Array([...x].map(C=>C.charCodeAt(0))),k=new Blob([w],{type:(d||"").split(";")[0]||""});return{ok:!0,data:k,status:200,url:t,fromCache:!1,mime:k.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let d=await fetch(t);if(!d.ok)return{ok:!1,data:null,status:d.status,url:t,fromCache:!1,reason:"http_error"};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await g.text(),status:d.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:t,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=po(t,{as:n,timeout:o,useProxy:s,errorTTL:r}),a=Wt.get(c);if(a&&a.until>Date.now())return{...a.result,fromCache:!0};a&&Wt.delete(c);let u=ie.get(c);if(u)return u;let m=fo(t,s)?mo(t,s):t,p=e.credentials;if(!p)try{let d=typeof location<"u"&&location.href?location.href:"http://localhost/",g=new URL(t,d);p=typeof location<"u"&&g.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,y=setTimeout(()=>h.abort("timeout"),o),f=(async()=>{try{let d=await fetch(m,{signal:h.signal,credentials:p,headers:i});if(!d.ok){let x={ok:!1,data:null,status:d.status,url:m,fromCache:!1,reason:"http_error"};if(r>0&&Wt.set(c,{until:Date.now()+r,result:x}),!l){let w=`${d.status} ${d.statusText||""}`.trim();Ne.warnOnce(`http:${d.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${t}`)}return e.onError&&e.onError(x),x}if(n==="text")return{ok:!0,data:await d.text(),status:d.status,url:m,fromCache:!1};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:m,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:m,fromCache:!1,mime:b}}catch(d){let g=d&&typeof d=="object"&&"name"in d&&d.name==="AbortError"?String(d.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:m,fromCache:!1,reason:g};if(!/^blob:/i.test(t)&&r>0&&Wt.set(c,{until:Date.now()+r,result:b}),!l){let x=`${g}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,w=g==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:g==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Ne.errorOnce(x,w)}return e.onError&&e.onError(b),b}finally{clearTimeout(y),ie.delete(c)}})();return ie.set(c,f),f}var Ne,ie,Wt,at=D(()=>{At();Ne=co("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ie=new Map,Wt=new Map});async function ct(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=it(t);if(!o)return t;let s=J(o);if(S.background.has(s)){let r=S.background.get(s);return r?`url("${r}")`:"none"}try{let r=await P(s,{as:"dataURL",useProxy:e.useProxy});return r.ok?(S.background.set(s,r.data),`url("${r.data}")`):(S.background.set(s,null),"none")}catch{return S.background.set(s,null),"none"}}var Te=D(()=>{H();At();at()});function ae(){for(let t of ho){let e=String(t).toLowerCase();Ot.has(e)||gt.has(e)||ce(e)}}function ce(t){if(t=String(t).toLowerCase(),gt.has(t)){let r={};return S.defaultStyle.set(t,r),r}if(S.defaultStyle.has(t))return S.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),s={};for(let r of o){if(Pe(r))continue;let i=o.getPropertyValue(r);s[r]=i}return e.removeChild(n),S.defaultStyle.set(t,s),s}function Pe(t){let e=String(t).toLowerCase();return!!(wo.has(e)||yo.test(e)||go.test(e))}function yt(t,e){if(e=String(e||"").toLowerCase(),gt.has(e))return"";let n=[],o=ce(e);for(let[s,r]of Object.entries(t)){if(Pe(s))continue;let i=o[s];r&&r!==i&&n.push(`${s}:${r}`)}return n.sort(),n.join(";")}function le(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 ue(t){let e=new Map;for(let o of t){let s=S.defaultStyle.get(o);if(!s)continue;let r=Object.entries(s).map(([i,l])=>`${i}:${l};`).sort().join("");r&&(e.has(r)||e.set(r,[]),e.get(r).push(o))}let n="";for(let[o,s]of e.entries())n+=`${s.join(",")} { ${o} }
8
- `;return n}function fe(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let s of e)n.set(s,`c${o++}`);return n}function lt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=S.computedStyle.get(t);if(n||(n=new Map,S.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Ut(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function vt(t){let e=[],n=0,o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}var Ot,gt,ho,go,yo,wo,de=D(()=>{H();Ot=new Set(["meta","script","noscript","title","link","template"]),gt=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"]),ho=["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"];go=/(?:^|-)(animation|transition)(?:-|$)/i,yo=/^(--|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,wo=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function X(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function O(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),o=/applewebkit/i.test(t),s=/mobile/i.test(t),r=!/safari/i.test(t),i=o&&s&&r,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),a=/ipad|iphone|ipod/.test(e)&&o;return n||i||l||c||a}var Bt=D(()=>{});var Y=D(()=>{Te();de();Bt();At()});var ve={};kt(ve,{toCanvas:()=>ut});function $r(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Ir(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Lr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&o++,r===")"&&(o=Math.max(0,o-1)),r===";"&&o===0?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(s=>s.trim()).filter(Boolean)}function Rr(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&o++,i===")"&&(o=Math.max(0,o-1)),i===","&&o===0?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());let s=[];for(let r of e){if(/\binset\b/i.test(r))continue;let i=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",c="0px",a="0px"]=i,u=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),m=!!u&&u!==",";s.push(`drop-shadow(${l} ${c} ${a}${m?` ${u}`:""})`)}return s.join(" ")}function Kn(t){let e=Nr(t),n=null,o=null,s=null,r=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let a=l.slice(0,c).trim().toLowerCase(),u=l.slice(c+1).trim();a==="box-shadow"?s=u:a==="filter"?n=u:a==="-webkit-filter"?o=u:r.push([a,u])}if(s){let l=Rr(s);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let i=[...r];return n&&i.push(["filter",n]),o&&i.push(["-webkit-filter",o]),i.map(([l,c])=>`${l}:${c}`).join(";")}function Tr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Kn(o)}}`)}function Pr(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Tr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Kn(o)}${n}`),t}function _r(t){if(!O()||!$r(t))return t;try{let e=Ir(t),n=Pr(e);return Lr(n)}catch{return t}}async function ut(t,e){let{width:n,height:o,scale:s=1,dpr:r=1,meta:i={},backgroundColor:l}=e;t=_r(t);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=t,await c.decode();let a=c.naturalWidth,u=c.naturalHeight,m=Number.isFinite(i.w0)?i.w0:a,p=Number.isFinite(i.h0)?i.h0:u,h,y,f=Number.isFinite(n),d=Number.isFinite(o);if(f&&d)h=Math.max(1,n),y=Math.max(1,o);else if(f){let x=n/Math.max(1,m);h=n,y=p*x}else if(d){let x=o/Math.max(1,p);y=o,h=m*x}else h=a,y=u;h=h*s,y=y*s;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let b=g.getContext("2d");return r!==1&&b.scale(r,r),l&&(b.save(),b.fillStyle=l,b.fillRect(0,0,h,y),b.restore()),b.drawImage(c,0,0,h,y),g}var St=D(()=>{Bt()});var tt={};kt(tt,{rasterize:()=>Me});async function Me(t,e){let n=await ut(t,e),o=new Image;return o.src=n.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${n.width/e.dpr}px`,o.style.height=`${n.height/e.dpr}px`,o}var K=D(()=>{St()});var Lt={};kt(Lt,{toImg:()=>Wr,toSvg:()=>Wr});async function Wr(t,e){let{scale:n=1,width:o,height:s,meta:r={}}=e,i=Number.isFinite(o),l=Number.isFinite(s),c=Number.isFinite(n)&&n!==1||i||l;if(O()&&c)return await Me(t,{...e,format:"png",quality:1,meta:r});let a=new Image;if(a.decoding="sync",a.loading="eager",a.src=t,await a.decode(),i&&l)a.style.width=`${o}px`,a.style.height=`${s}px`;else if(i){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=o/Math.max(1,u);a.style.width=`${o}px`,a.style.height=`${Math.round(m*p)}px`}else if(l){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=s/Math.max(1,m);a.style.height=`${s}px`,a.style.width=`${Math.round(u*p)}px`}else{let u=Math.round(a.naturalWidth*n),m=Math.round(a.naturalHeight*n);if(a.style.width=`${u}px`,a.style.height=`${m}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${m}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,a.src=t}catch{}}return a}var Nt=D(()=>{Y();K()});var Fe={};kt(Fe,{toBlob:()=>Ee});async function Ee(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await ut(t,e);return new Promise(s=>o.toBlob(r=>s(r),`image/${n}`,e.quality))}var Jt=D(()=>{St()});var Gn={};kt(Gn,{download:()=>Or});async function Or(t,e){let n=(e?.format||e?.type||"").toLowerCase(),o=n==="jpg"?"jpeg":n||"png",s=e?.filename||`snapdom.${o}`,r={...e||{},format:o,type:o};if(r.dpr=1,o==="svg"){let c=await Ee(t,{...r,type:"svg"}),a=URL.createObjectURL(c),u=document.createElement("a");u.href=a,u.download=s,u.click(),URL.revokeObjectURL(a);return}let i=await ut(t,r),l=document.createElement("a");l.href=i.toDataURL(`image/${o}`,e?.quality),l.download=s,l.click()}var Qn=D(()=>{Jt();St()});Y();Y();H();var _e=new WeakMap,me=new Map,pe=0;function Mt(){pe++}var We=!1;function bo(t=document.documentElement){if(!We){We=!0;try{new MutationObserver(()=>Mt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Mt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Mt),e.ready?.then(()=>Mt()).catch(()=>{}))}catch{}}}function xo(t,e={}){let n={},o=t.getPropertyValue("visibility");for(let r=0;r<t.length;r++){let i=t[r],l=t.getPropertyValue(i);(i==="background-image"||i==="content")&&l.includes("url(")&&!l.includes("data:")&&(l="none"),n[i]=l}let s=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let r of s)if(!n[r])try{let i=t.getPropertyValue(r);i&&(n[r]=i)}catch{}if(e.embedFonts){let r=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let i of r)if(!n[i])try{let l=t.getPropertyValue(i);l&&(n[i]=l)}catch{}}return o==="hidden"&&(n.opacity="0"),n}var Oe=new WeakMap;function So(t){let e=Oe.get(t);return e||(e=Object.entries(t).sort((o,s)=>o[0]<s[0]?-1:o[0]>s[0]?1:0).map(([o,s])=>`${o}:${s}`).join(";"),Oe.set(t,e),e)}function Co(t,e=null,n={}){let o=_e.get(t);if(o&&o.epoch===pe)return o.snapshot;let s=e||getComputedStyle(t),r=xo(s,n);return Fo(t,s,r),_e.set(t,{epoch:pe,snapshot:r}),r}function ko(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:me,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:e||{}}:{session:S.session,persist:{snapshotKeyCache:me,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:t||e||{}}}async function Z(t,e,n,o){if(t.tagName==="STYLE")return;let s=ko(n,o),r=s.options&&s.options.cache||"auto";if(r!=="disabled"&&bo(document.documentElement),r==="disabled"&&!s.session.__bumpedForDisabled&&(Mt(),me.clear(),s.session.__bumpedForDisabled=!0),gt.has(t.tagName?.toLowerCase())){let p=t.getAttribute?.("style");p&&e.setAttribute("style",p)}let{session:i,persist:l}=s;i.styleCache.has(t)||i.styleCache.set(t,getComputedStyle(t));let c=i.styleCache.get(t),a=Co(t,c,s.options),u=So(a),m=l.snapshotKeyCache.get(u);if(!m){let p=t.tagName?.toLowerCase()||"div";m=yt(a,p),l.snapshotKeyCache.set(u,m)}i.styleMap.set(e,m)}function Ao(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function vo(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 Mo(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,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let s=t.scrollHeight;if(s===0)return!1;let r=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return s>r+i}function Fo(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||o!=="div"&&o!=="section"&&o!=="article"&&o!=="main"&&o!=="aside"&&o!=="header"&&o!=="footer"&&o!=="nav"&&o!=="ol"&&o!=="ul"&&o!=="li")return;let s=e.display||"";if(s.includes("flex")||s.includes("grid")||Ao(t))return;let r=e.position;if(r==="absolute"||r==="fixed"||r==="sticky"||e.transform!=="none"||vo(e)||Mo(t))return;let i=e.overflowX||e.overflow||"visible",l=e.overflowY||e.overflow||"visible";if(i!=="visible"||l!=="visible")return;let c=e.clip;c&&c!=="auto"&&c!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Eo(t,e)&&(delete n.height,delete n["block-size"])}de();var Be=["fill","stroke","color","background-color","stop-color"],Ue=new Map;function $o(t,e){let n=e+"::"+t.toLowerCase(),o=Ue.get(n);if(o)return o;let s=document,r=e==="http://www.w3.org/2000/svg"?s.createElementNS(e,t):s.createElement(t),i=s.createElement("div");i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(r),s.documentElement.appendChild(i);let l=getComputedStyle(r),c={};for(let a of Be)c[a]=l.getPropertyValue(a)||"";return i.remove(),Ue.set(n,c),c}function De(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(l&&typeof l.value=="string"&&l.value.includes("var(")){o=!0;break}}}let s=null;if(o)try{s=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length)for(let i=0;i<r.length;i++){let l=r[i],c=r.getPropertyValue(l);if(!c||!c.includes("var("))continue;let a=s&&s.getPropertyValue(l);if(a)try{e.style.setProperty(l,a.trim(),r.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,a=s&&s.getPropertyValue(c);if(a)try{e.style.setProperty(c,a.trim())}catch{}}}if(!o){if(!s)try{s=getComputedStyle(t)}catch{s=null}if(!s)return;let r=t.namespaceURI||"html",i=$o(t.tagName,r);for(let l of Be){let c=s.getPropertyValue(l)||"",a=i[l]||"";if(c&&c!==a)try{e.style.setProperty(l,c.trim())}catch{}}}}Y();H();at();function Ht(t,e,n){return Promise.all(t.map(o=>new Promise(s=>{function r(){X(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,s):r()},{fast:n})}r()})))}function Io(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Lo(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let s=n?Io(o):o;return`:where(${e} ${s})`}).join(", ")}function qe(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,s,r)=>{let i=Lo(r,e,!0);return`${o}${s}${i}{`}),t):""}function ze(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function je(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
7
+ var co=Object.defineProperty;var B=(t,e)=>()=>(t&&(e=t(t=0)),e);var kt=(t,e)=>{for(var n in e)co(t,n,{get:e[n],enumerable:!0})};function _t(t="soft"){switch(S.session.__counterEpoch=(S.session.__counterEpoch||0)+1,t){case"auto":{S.session.styleMap=new Map,S.session.nodeMap=new Map;return}case"soft":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap,S.computedStyle=new WeakMap,S.baseStyle=new Map,S.defaultStyle=new Map,S.image=new Map,S.background=new Map,S.resource=new Map,S.font=new Set;return}default:{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}}}var S,D=B(()=>{S={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function it(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function ie(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==6?`matrix(${o})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==16?`matrix3d(${o})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function Z(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}var At=B(()=>{});function lo(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,s=0;function r(i,l,c){if(s>=n)return;let a=Date.now();(o.get(l)||0)>a||(o.set(l,a+e),s++,i==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(i,l){r("warn",i,l)},errorOnce(i,l){r("error",i,l)},reset(){o.clear(),s=0}}}function uo(t){return/^data:|^blob:|^about:blank$/i.test(t)}function fo(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(o||".",n),r=new URL(t,n);if(r.origin===s.origin)return!0;let i=r.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function mo(t,e){if(!e||uo(t)||fo(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function po(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",Z(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}${Z(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function Re(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function ho(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function _(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,s=e.useProxy||"",r=e.errorTTL??8e3,i=e.headers||{},l=!!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[,d="",g=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(d)?atob(g):decodeURIComponent(g),w=new Uint8Array([...x].map(k=>k.charCodeAt(0))),C=new Blob([w],{type:(d||"").split(";")[0]||""});return{ok:!0,data:C,status:200,url:t,fromCache:!1,mime:C.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let d=await fetch(t);if(!d.ok)return{ok:!1,data:null,status:d.status,url:t,fromCache:!1,reason:"http_error"};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await g.text(),status:d.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:t,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=ho(t,{as:n,timeout:o,useProxy:s,errorTTL:r}),a=Wt.get(c);if(a&&a.until>Date.now())return{...a.result,fromCache:!0};a&&Wt.delete(c);let u=ae.get(c);if(u)return u;let m=mo(t,s)?po(t,s):t,p=e.credentials;if(!p)try{let d=typeof location<"u"&&location.href?location.href:"http://localhost/",g=new URL(t,d);p=typeof location<"u"&&g.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,y=setTimeout(()=>h.abort("timeout"),o),f=(async()=>{try{let d=await fetch(m,{signal:h.signal,credentials:p,headers:i});if(!d.ok){let x={ok:!1,data:null,status:d.status,url:m,fromCache:!1,reason:"http_error"};if(r>0&&Wt.set(c,{until:Date.now()+r,result:x}),!l){let w=`${d.status} ${d.statusText||""}`.trim();Le.warnOnce(`http:${d.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${t}`)}return e.onError&&e.onError(x),x}if(n==="text")return{ok:!0,data:await d.text(),status:d.status,url:m,fromCache:!1};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:m,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:m,fromCache:!1,mime:b}}catch(d){let g=d&&typeof d=="object"&&"name"in d&&d.name==="AbortError"?String(d.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:m,fromCache:!1,reason:g};if(!/^blob:/i.test(t)&&r>0&&Wt.set(c,{until:Date.now()+r,result:b}),!l){let x=`${g}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,w=g==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:g==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Le.errorOnce(x,w)}return e.onError&&e.onError(b),b}finally{clearTimeout(y),ae.delete(c)}})();return ae.set(c,f),f}var Le,ae,Wt,at=B(()=>{At();Le=lo("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ae=new Map,Wt=new Map});async function ct(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=it(t);if(!o)return t;let s=Z(o);if(S.background.has(s)){let r=S.background.get(s);return r?`url("${r}")`:"none"}try{let r=await _(s,{as:"dataURL",useProxy:e.useProxy});return r.ok?(S.background.set(s,r.data),`url("${r.data}")`):(S.background.set(s,null),"none")}catch{return S.background.set(s,null),"none"}}var Te=B(()=>{D();At();at()});function ce(){for(let t of go){let e=String(t).toLowerCase();Ot.has(e)||gt.has(e)||le(e)}}function le(t){if(t=String(t).toLowerCase(),gt.has(t)){let r={};return S.defaultStyle.set(t,r),r}if(S.defaultStyle.has(t))return S.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),s={};for(let r of o){if(Pe(r))continue;let i=o.getPropertyValue(r);s[r]=i}return e.removeChild(n),S.defaultStyle.set(t,s),s}function Pe(t){let e=String(t).toLowerCase();return!!(bo.has(e)||wo.test(e)||yo.test(e))}function yt(t,e){if(e=String(e||"").toLowerCase(),gt.has(e))return"";let n=[],o=le(e);for(let[s,r]of Object.entries(t)){if(Pe(s))continue;let i=o[s];r&&r!==i&&n.push(`${s}:${r}`)}return n.sort(),n.join(";")}function ue(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 fe(t){let e=new Map;for(let o of t){let s=S.defaultStyle.get(o);if(!s)continue;let r=Object.entries(s).map(([i,l])=>`${i}:${l};`).sort().join("");r&&(e.has(r)||e.set(r,[]),e.get(r).push(o))}let n="";for(let[o,s]of e.entries())n+=`${s.join(",")} { ${o} }
8
+ `;return n}function de(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let s of e)n.set(s,`c${o++}`);return n}function lt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=S.computedStyle.get(t);if(n||(n=new Map,S.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Ut(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function vt(t){let e=[],n=0,o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}var Ot,gt,go,yo,wo,bo,me=B(()=>{D();Ot=new Set(["meta","script","noscript","title","link","template"]),gt=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"]),go=["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"];yo=/(?:^|-)(animation|transition)(?:-|$)/i,wo=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,bo=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function X(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function U(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),o=/applewebkit/i.test(t),s=/mobile/i.test(t),r=!/safari/i.test(t),i=o&&s&&r,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),a=/ipad|iphone|ipod/.test(e)&&o;return n||i||l||c||a}var Bt=B(()=>{});var Y=B(()=>{Te();me();Bt();At()});var ve={};kt(ve,{toCanvas:()=>ut});function Ir(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Lr(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Rr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Tr(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&o++,r===")"&&(o=Math.max(0,o-1)),r===";"&&o===0?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(s=>s.trim()).filter(Boolean)}function Pr(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&o++,i===")"&&(o=Math.max(0,o-1)),i===","&&o===0?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());let s=[];for(let r of e){if(/\binset\b/i.test(r))continue;let i=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",c="0px",a="0px"]=i,u=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),m=!!u&&u!==",";s.push(`drop-shadow(${l} ${c} ${a}${m?` ${u}`:""})`)}return s.join(" ")}function Kn(t){let e=Tr(t),n=null,o=null,s=null,r=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let a=l.slice(0,c).trim().toLowerCase(),u=l.slice(c+1).trim();a==="box-shadow"?s=u:a==="filter"?n=u:a==="-webkit-filter"?o=u:r.push([a,u])}if(s){let l=Pr(s);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let i=[...r];return n&&i.push(["filter",n]),o&&i.push(["-webkit-filter",o]),i.map(([l,c])=>`${l}:${c}`).join(";")}function _r(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Kn(o)}}`)}function Wr(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,_r(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Kn(o)}${n}`),t}function Or(t){if(!U()||!Ir(t))return t;try{let e=Lr(t),n=Wr(e);return Rr(n)}catch{return t}}async function ut(t,e){let{width:n,height:o,scale:s=1,dpr:r=1,meta:i={},backgroundColor:l}=e;t=Or(t);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=t,await c.decode();let a=c.naturalWidth,u=c.naturalHeight,m=Number.isFinite(i.w0)?i.w0:a,p=Number.isFinite(i.h0)?i.h0:u,h,y,f=Number.isFinite(n),d=Number.isFinite(o);if(f&&d)h=Math.max(1,n),y=Math.max(1,o);else if(f){let x=n/Math.max(1,m);h=n,y=p*x}else if(d){let x=o/Math.max(1,p);y=o,h=m*x}else h=a,y=u;h=h*s,y=y*s;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let b=g.getContext("2d");return r!==1&&b.scale(r,r),l&&(b.save(),b.fillStyle=l,b.fillRect(0,0,h,y),b.restore()),b.drawImage(c,0,0,h,y),g}var St=B(()=>{Bt()});var et={};kt(et,{rasterize:()=>Me});async function Me(t,e){let n=await ut(t,e),o=new Image;return o.src=n.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${n.width/e.dpr}px`,o.style.height=`${n.height/e.dpr}px`,o}var K=B(()=>{St()});var Lt={};kt(Lt,{toImg:()=>Ur,toSvg:()=>Ur});async function Ur(t,e){let{scale:n=1,width:o,height:s,meta:r={}}=e,i=Number.isFinite(o),l=Number.isFinite(s),c=Number.isFinite(n)&&n!==1||i||l;if(U()&&c)return await Me(t,{...e,format:"png",quality:1,meta:r});let a=new Image;if(a.decoding="sync",a.loading="eager",a.src=t,await a.decode(),i&&l)a.style.width=`${o}px`,a.style.height=`${s}px`;else if(i){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=o/Math.max(1,u);a.style.width=`${o}px`,a.style.height=`${Math.round(m*p)}px`}else if(l){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=s/Math.max(1,m);a.style.height=`${s}px`,a.style.width=`${Math.round(u*p)}px`}else{let u=Math.round(a.naturalWidth*n),m=Math.round(a.naturalHeight*n);if(a.style.width=`${u}px`,a.style.height=`${m}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${m}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,a.src=t}catch{}}return a}var Rt=B(()=>{Y();K()});var Fe={};kt(Fe,{toBlob:()=>Ee});async function Ee(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await ut(t,e);return new Promise(s=>o.toBlob(r=>s(r),`image/${n}`,e.quality))}var Zt=B(()=>{St()});var Gn={};kt(Gn,{download:()=>Br});async function Br(t,e){let n=(e?.format||e?.type||"").toLowerCase(),o=n==="jpg"?"jpeg":n||"png",s=e?.filename||`snapdom.${o}`,r={...e||{},format:o,type:o};if(r.dpr=1,o==="svg"){let c=await Ee(t,{...r,type:"svg"}),a=URL.createObjectURL(c),u=document.createElement("a");u.href=a,u.download=s,u.click(),URL.revokeObjectURL(a);return}let i=await ut(t,r),l=document.createElement("a");l.href=i.toDataURL(`image/${o}`,e?.quality),l.download=s,l.click()}var Qn=B(()=>{Zt();St()});Y();Y();D();var _e=new WeakMap,pe=new Map,he=0;function Mt(){he++}var We=!1;function xo(t=document.documentElement){if(!We){We=!0;try{new MutationObserver(()=>Mt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Mt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Mt),e.ready?.then(()=>Mt()).catch(()=>{}))}catch{}}}function So(t,e={}){let n={},o=t.getPropertyValue("visibility");for(let r=0;r<t.length;r++){let i=t[r],l=t.getPropertyValue(i);(i==="background-image"||i==="content")&&l.includes("url(")&&!l.includes("data:")&&(l="none"),n[i]=l}let s=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let r of s)if(!n[r])try{let i=t.getPropertyValue(r);i&&(n[r]=i)}catch{}if(e.embedFonts){let r=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let i of r)if(!n[i])try{let l=t.getPropertyValue(i);l&&(n[i]=l)}catch{}}return o==="hidden"&&(n.opacity="0"),n}var Oe=new WeakMap;function Co(t){let e=Oe.get(t);return e||(e=Object.entries(t).sort((o,s)=>o[0]<s[0]?-1:o[0]>s[0]?1:0).map(([o,s])=>`${o}:${s}`).join(";"),Oe.set(t,e),e)}function ko(t,e=null,n={}){let o=_e.get(t);if(o&&o.epoch===he)return o.snapshot;let s=e||getComputedStyle(t),r=So(s,n);return $o(t,s,r),_e.set(t,{epoch:he,snapshot:r}),r}function Ao(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:pe,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:e||{}}:{session:S.session,persist:{snapshotKeyCache:pe,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:t||e||{}}}async function tt(t,e,n,o){if(t.tagName==="STYLE")return;let s=Ao(n,o),r=s.options&&s.options.cache||"auto";if(r!=="disabled"&&xo(document.documentElement),r==="disabled"&&!s.session.__bumpedForDisabled&&(Mt(),pe.clear(),s.session.__bumpedForDisabled=!0),gt.has(t.tagName?.toLowerCase())){let p=t.getAttribute?.("style");p&&e.setAttribute("style",p)}let{session:i,persist:l}=s;i.styleCache.has(t)||i.styleCache.set(t,getComputedStyle(t));let c=i.styleCache.get(t),a=ko(t,c,s.options),u=Co(a),m=l.snapshotKeyCache.get(u);if(!m){let p=t.tagName?.toLowerCase()||"div";m=yt(a,p),l.snapshotKeyCache.set(u,m)}i.styleMap.set(e,m)}function vo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Mo(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 Eo(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Fo(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let s=t.scrollHeight;if(s===0)return!1;let r=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return s>r+i}function $o(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||o!=="div"&&o!=="section"&&o!=="article"&&o!=="main"&&o!=="aside"&&o!=="header"&&o!=="footer"&&o!=="nav"&&o!=="ol"&&o!=="ul"&&o!=="li")return;let s=e.display||"";if(s.includes("flex")||s.includes("grid")||vo(t))return;let r=e.position;if(r==="absolute"||r==="fixed"||r==="sticky"||e.transform!=="none"||Mo(e)||Eo(t))return;let i=e.overflowX||e.overflow||"visible",l=e.overflowY||e.overflow||"visible";if(i!=="visible"||l!=="visible")return;let c=e.clip;c&&c!=="auto"&&c!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Fo(t,e)&&(delete n.height,delete n["block-size"])}me();var Be=["fill","stroke","color","background-color","stop-color"],Ue=new Map;function No(t,e){let n=e+"::"+t.toLowerCase(),o=Ue.get(n);if(o)return o;let s=document,r=e==="http://www.w3.org/2000/svg"?s.createElementNS(e,t):s.createElement(t),i=s.createElement("div");i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(r),s.documentElement.appendChild(i);let l=getComputedStyle(r),c={};for(let a of Be)c[a]=l.getPropertyValue(a)||"";return i.remove(),Ue.set(n,c),c}function De(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(l&&typeof l.value=="string"&&l.value.includes("var(")){o=!0;break}}}let s=null;if(o)try{s=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length)for(let i=0;i<r.length;i++){let l=r[i],c=r.getPropertyValue(l);if(!c||!c.includes("var("))continue;let a=s&&s.getPropertyValue(l);if(a)try{e.style.setProperty(l,a.trim(),r.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,a=s&&s.getPropertyValue(c);if(a)try{e.style.setProperty(c,a.trim())}catch{}}}if(!o){if(!s)try{s=getComputedStyle(t)}catch{s=null}if(!s)return;let r=t.namespaceURI||"html",i=No(t.tagName,r);for(let l of Be){let c=s.getPropertyValue(l)||"",a=i[l]||"";if(c&&c!==a)try{e.style.setProperty(l,c.trim())}catch{}}}}Y();D();at();function Ht(t,e,n){return Promise.all(t.map(o=>new Promise(s=>{function r(){X(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,s):r()},{fast:n})}r()})))}function Io(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Lo(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let s=n?Io(o):o;return`:where(${e} ${s})`}).join(", ")}function qe(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,s,r)=>{let i=Lo(r,e,!0);return`${o}${s}${i}{`}),t):""}function ze(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function je(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
9
9
  `});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let s of o.cssRules)e+=s.cssText+`
10
- `}catch{}}catch{}return e}function Ve(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function Xe(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 Ye(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function No(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function Ke(t,e,n){let o=[];for(let s of e){let r=No(t,s);r&&o.push(`${s}: ${r};`)}return o.length?`${n}{${o.join("")}}
11
- `:""}function Ge(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 Ro(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),s=0;for(;s<e&&(!o||!o.body&&!o.documentElement);)await new Promise(r=>setTimeout(r,0)),o=n(),s++;return o&&(o.body||o.documentElement)?o:null}function To(t){let e=t.getBoundingClientRect(),n=0,o=0,s=0,r=0;try{let c=getComputedStyle(t);n=parseFloat(c.borderLeftWidth)||0,o=parseFloat(c.borderRightWidth)||0,s=parseFloat(c.borderTopWidth)||0,r=parseFloat(c.borderBottomWidth)||0}catch{}let i=Math.max(0,Math.round(e.width-(n+o))),l=Math.max(0,Math.round(e.height-(s+r)));return{contentWidth:i,contentHeight:l,rect:e}}function Po(t,e,n){let o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(o),()=>{try{o.remove()}catch{}}}async function Qe(t,e,n){let o=await Ro(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:s,contentHeight:r,rect:i}=To(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let c={...n,scale:1},a=Po(o,s,r),u;try{u=await l.toPng(o.documentElement,c)}finally{a()}u.style.display="block",u.style.width=`${s}px`,u.style.height=`${r}px`;let m=document.createElement("div");return e.nodeMap.set(m,t),Z(t,m,e,n),m.style.overflow="hidden",m.style.display="block",m.style.width||(m.style.width=`${Math.round(i.width)}px`),m.style.height||(m.style.height=`${Math.round(i.height)}px`),m.appendChild(u),m}var Et=new Map;async function Ft(t){if(S.resource?.has(t))return S.resource.get(t);if(Et.has(t))return Et.get(t);let e=(async()=>{let n=await P(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return S.resource?.set(t,n.data),n.data})();Et.set(t,e);try{let n=await e;return Et.set(t,n),n}catch(n){throw Et.delete(t),n}}var _o=/\bblob:[^)"'\s]+/g;async function He(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(_o)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let s=await Ft(o);n=n.split(o).join(s)}catch{}return n}function Dt(t){return typeof t=="string"&&t.startsWith("blob:")}function Wo(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 Oo(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function Je(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let c=i.getAttribute("src")||i.currentSrc||"";if(Dt(c)){let u=await Ft(c);i.setAttribute("src",u)}let a=i.getAttribute("srcset");if(a&&a.includes("blob:")){let u=Wo(a),m=!1;for(let p of u)if(Dt(p.url))try{p.url=await Ft(p.url),m=!0}catch{}m&&i.setAttribute("srcset",Oo(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let l="http://www.w3.org/1999/xlink",c=i.getAttribute("href")||i.getAttributeNS?.(l,"href");if(Dt(c)){let a=await Ft(c);i.setAttribute("href",a),i.removeAttributeNS?.(l,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of o)try{let l=i.getAttribute("style");if(l&&l.includes("blob:")){let c=await He(l);i.setAttribute("style",c)}}catch{}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of s)try{let l=i.textContent||"";l.includes("blob:")&&(i.textContent=await He(l))}catch{}let r=["poster"];for(let i of r){let l=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let c of l)try{let a=c.getAttribute(i);Dt(a)&&c.setAttribute(i,await Ft(a))}catch{}}}async function $t(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,s=null,r=null;if(t.nodeType===Node.ELEMENT_NODE){let a=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ot.has(a))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let a=document.createElement("div"),u=t.getBoundingClientRect();return a.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,a}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let a of n.exclude)try{if(t.matches?.(a)){if(n.excludeMode==="hide"){let u=document.createElement("div"),m=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${m.width}px;height:${m.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${a}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let a=document.createElement("div"),u=t.getBoundingClientRect();return a.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,a}else if(n.filterMode==="remove")return null}}catch(a){console.warn("Error in filter function:",a)}if(t.tagName==="IFRAME"){let a=!1;try{a=!!(t.contentDocument||t.contentWindow?.document)}catch{a=!1}if(a)try{return await Qe(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,Z(t,u,e,n),u}else{let u=t.getBoundingClientRect(),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,Z(t,m,e,n),m}}if(t.getAttribute("data-capture")==="placeholder"){let a=t.cloneNode(!1);e.nodeMap.set(a,t),Z(t,a,e,n);let u=document.createElement("div");return u.textContent=t.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",a.appendChild(u),a}if(t.tagName==="CANVAS"){let a="";try{let m=t.getContext("2d",{willReadFrequently:!0});try{m&&m.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),a=t.toDataURL("image/png"),!a||a==="data:,"){try{m&&m.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),a=t.toDataURL("image/png"),!a||a==="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),a=p.toDataURL("image/png"))}}}catch{}let u=document.createElement("img");try{u.decoding="sync",u.loading="eager"}catch{}a&&(u.src=a),u.width=t.width,u.height=t.height;try{let m=getComputedStyle(t);m.width&&(u.style.width=m.width),m.height&&(u.style.height=m.height)}catch{}return e.nodeMap.set(u,t),Z(t,u,e,n),u}let i;try{if(i=t.cloneNode(!1),De(t,i),e.nodeMap.set(i,t),t.tagName==="IMG"){Xe(t,i);try{let a=t.getBoundingClientRect(),u=Math.round(a.width||0),m=Math.round(a.height||0);if(!u||!m){let p=window.getComputedStyle(t),h=parseFloat(p.width)||0,y=parseFloat(p.height)||0,f=parseInt(t.getAttribute("width")||"",10)||0,d=parseInt(t.getAttribute("height")||"",10)||0,g=t.width||t.naturalWidth||0,b=t.height||t.naturalHeight||0;u=Math.round(u||h||f||g||0),m=Math.round(m||y||d||b||0)}u&&(i.dataset.snapdomWidth=String(u)),m&&(i.dataset.snapdomHeight=String(m))}catch{}try{let a=t.getAttribute("style")||"",u=window.getComputedStyle(t),m=d=>{let g=a.match(new RegExp(`${d}\\s*:\\s*([^;]+)`,"i")),b=g?g[1].trim():u.getPropertyValue(d);return/%|auto/i.test(String(b||""))},p=parseInt(i.dataset.snapdomWidth||"0",10),h=parseInt(i.dataset.snapdomHeight||"0",10),y=m("width")||!p,f=m("height")||!h;y&&p&&(i.style.width=`${p}px`),f&&h&&(i.style.height=`${h}px`),p&&(i.style.minWidth=`${p}px`),h&&(i.style.minHeight=`${h}px`)}catch{}}}catch(a){throw console.error("[Snapdom] Failed to clone node:",t,a),a}if(t instanceof HTMLTextAreaElement){let a=t.getBoundingClientRect();i.style.width=`${a.width}px`,i.style.height=`${a.height}px`}if(t instanceof HTMLInputElement&&(i.value=t.value,i.setAttribute("value",t.value),t.checked!==void 0&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(s=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),Z(t,i,e,n),t.shadowRoot){let d=function(b,x){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return x(null);$t(b,e,n).then(w=>{x(w||null)}).catch(()=>{x(null)})};try{let b=t.shadowRoot.querySelectorAll("slot");for(let x of b){let w=[];try{w=x.assignedNodes?.({flatten:!0})||x.assignedNodes?.()||[]}catch{w=x.assignedNodes?.()||[]}for(let k of w)o.add(k)}}catch{}let a=ze(e),u=`[data-sd="${a}"]`;try{i.setAttribute("data-sd",a)}catch{}let m=je(t.shadowRoot),p=qe(m,u),h=Ye(m),y=Ke(t,h,u);Ve(i,y+p,a);let f=document.createDocumentFragment(),g=await Ht(Array.from(t.shadowRoot.childNodes),d,n.fast);f.append(...g.filter(b=>!!b)),i.appendChild(f)}if(t.tagName==="SLOT"){let p=function(y,f){$t(y,e,n).then(d=>{d&&Ge(d),f(d||null)}).catch(()=>{f(null)})},a=t.assignedNodes?.({flatten:!0})||[],u=a.length>0?a:Array.from(t.childNodes),m=document.createDocumentFragment(),h=await Ht(Array.from(u),p,n.fast);return m.append(...h.filter(y=>!!y)),m}function l(a,u){if(o.has(a))return u(null);$t(a,e,n).then(m=>{u(m||null)}).catch(()=>{u(null)})}let c=await Ht(Array.from(t.childNodes),l,n.fast);if(i.append(...c.filter(a=>!!a)),s!==null&&i instanceof HTMLSelectElement){i.value=s;for(let a of i.options)a.value===s?a.setAttribute("selected",""):a.removeAttribute("selected")}return r!==null&&i instanceof HTMLTextAreaElement&&(i.textContent=r),i}Y();At();H();var Uo=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],wt=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),he=[];function tn(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?he.push(n):typeof n=="string"?he.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function q(t){let e=typeof t=="string"?t:"",n=[...Uo,...he];for(let o of n)if(o instanceof RegExp&&o.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}function Bo(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var Ze=new Map;function Do(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,s;for(;s=o.exec(n);)e[s[1].toUpperCase()]=Number(s[2]);return e}async function Ho(t,e,n){let o=String(t||""),s=o.toLowerCase(),r=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(s)&&!/\bsymbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};let l=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?c="rounded":/\bsharp\b/.test(r)?c="sharp":/\boutlined\b/.test(r)&&(c="outlined");let a=l===1,u=null;if(a&&(c==="outlined"&&wt.materialIconsFilled?u={url:wt.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&wt.materialIconsRound?u={url:wt.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&wt.materialIconsSharp&&(u={url:wt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!u)return{familyForMeasure:o,familyForCanvas:o};if(!Ze.has(u.alias))try{let p=new FontFace(u.alias,`url(${u.url})`,{style:"normal",weight:"400"});document.fonts.add(p),await p.load(),Ze.set(u.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let m=`"${u.alias}"`;return{familyForMeasure:m,familyForCanvas:m}}async function qo(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function zo(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let o=t.color?.trim();return o&&o!=="inherit"?o:"#000"}async function jo(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:s="#000",variation:r="",className:i=""}={}){let l=String(e||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,a=Do(r),{familyForMeasure:u,familyForCanvas:m}=await Ho(l,i,a);await qo(m.replace(/^["']+|["']+$/g,""),o);let p=document.createElement("span");p.textContent=t,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=u,p.style.fontWeight=String(n||"normal"),p.style.fontSize=`${o}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=s,document.body.appendChild(p);let h=p.getBoundingClientRect(),y=Math.max(1,Math.ceil(h.width)),f=Math.max(1,Math.ceil(h.height));document.body.removeChild(p);let d=document.createElement("canvas");d.width=y*c,d.height=f*c;let g=d.getContext("2d");g.scale(c,c),g.font=`${n?`${n} `:""}${o}px ${m}`,g.textAlign="left",g.textBaseline="top",g.fillStyle=s;try{g.fontKerning="normal"}catch{}return g.fillText(t,0,0),{dataUrl:d.toDataURL(),width:y,height:f}}async function en(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim());if(o.length===0)return 0;let s=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim()):[],r=0;for(let i=0;i<o.length;i++){let l=o[i],c=s[i]||null;try{let a=getComputedStyle(c||l),u=a.fontFamily||"Material Icons";if(!Bo(u))continue;let m=(c||l).textContent.trim();if(!m)continue;let p=parseInt(a.fontSize,10)||24,h=a.fontWeight&&a.fontWeight!=="normal"?a.fontWeight:"normal",y=zo(a),f=a.fontVariationSettings&&a.fontVariationSettings!=="normal"?a.fontVariationSettings:"",d=(c||l).className||"",{dataUrl:g,width:b,height:x}=await jo(m,{family:u,weight:h,fontSize:p,color:y,variation:f,className:d});l.textContent="";let w=l.ownerDocument.createElement("img");w.src=g,w.alt=m,w.style.height=`${p}px`,w.style.width=`${Math.max(1,Math.round(b/x*p))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(w),r++}catch{}}return r}at();async function rn(t,e,n,o=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let i=document.createElement("span");i.textContent=t,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=n||"normal",i.style.fontSize=`${o}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);let l=i.getBoundingClientRect(),c=Math.ceil(l.width),a=Math.ceil(l.height);document.body.removeChild(i);let u=document.createElement("canvas");u.width=Math.max(1,c*r),u.height=Math.max(1,a*r);let m=u.getContext("2d");return m.scale(r,r),m.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,m.textAlign="left",m.textBaseline="top",m.fillStyle=s,m.fillText(t,0,0),{dataUrl:u.toDataURL(),width:c,height:a}}var Vo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Vt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Vo.has(n.toLowerCase()))return n}return""}function qt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function zt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Xo(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Yo(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let s=qt(n[1]),r=qt(n[2]);return{min:Math.min(s,r),max:Math.max(s,r)}}let o=qt(e);return{min:o,max:o}}function Ko(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Go(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let r=parseFloat(n[1]),i=parseFloat(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),s=o?parseFloat(o[1]):100;return{min:s,max:s}}function Qo(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let s=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>s.endsWith(l)))return!0;let i=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i))return!0;for(let l of e){let c=l.toLowerCase().replace(/\s+/g,"+"),a=l.toLowerCase().replace(/\s+/g,"-");if(i.includes(c)||i.includes(a))return!0}return!1}catch{return!1}}function Jo(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function nn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,s)=>{let r=(s||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return n;let i=r;try{i=new URL(r,e||location.href).href}catch{}return`url("${i}")`})}var ge=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,jt=4;async function Zo(t,e,n){if(!t)return t;let o=new Set;function s(l,c){try{return new URL(l,c||location.href).href}catch{return l}}async function r(l,c,a=0){if(a>jt)return console.warn(`[snapDOM] @import depth exceeded (${jt}) at ${c}`),l;let u="",m=0,p;for(;p=ge.exec(l);){u+=l.slice(m,p.index),m=ge.lastIndex;let h=(p[2]||p[4]||"").trim(),y=s(h,c);if(o.has(y)){console.warn(`[snapDOM] Skipping circular @import: ${y}`);continue}o.add(y);let f="";try{let d=await P(y,{as:"text",useProxy:n,silent:!0});d.ok&&typeof d.data=="string"&&(f=d.data)}catch{}f?(f=nn(f,y),f=await r(f,y,a+1),u+=`
10
+ `}catch{}}catch{}return e}function Ve(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function Xe(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 Ye(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function Ro(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function Ke(t,e,n){let o=[];for(let s of e){let r=Ro(t,s);r&&o.push(`${s}: ${r};`)}return o.length?`${n}{${o.join("")}}
11
+ `:""}function Ge(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 To(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),s=0;for(;s<e&&(!o||!o.body&&!o.documentElement);)await new Promise(r=>setTimeout(r,0)),o=n(),s++;return o&&(o.body||o.documentElement)?o:null}function Po(t){let e=t.getBoundingClientRect(),n=0,o=0,s=0,r=0;try{let c=getComputedStyle(t);n=parseFloat(c.borderLeftWidth)||0,o=parseFloat(c.borderRightWidth)||0,s=parseFloat(c.borderTopWidth)||0,r=parseFloat(c.borderBottomWidth)||0}catch{}let i=Math.max(0,Math.round(e.width-(n+o))),l=Math.max(0,Math.round(e.height-(s+r)));return{contentWidth:i,contentHeight:l,rect:e}}function $t(t){let e=0,n=0;if(t.offsetWidth>0&&(e=t.offsetWidth),t.offsetHeight>0&&(n=t.offsetHeight),e===0||n===0)try{let o=getComputedStyle(t);if(e===0){let s=parseFloat(o.width);!isNaN(s)&&s>0&&(e=s)}if(n===0){let s=parseFloat(o.height);!isNaN(s)&&s>0&&(n=s)}}catch{}if(e===0||n===0)try{if(e===0){let o=parseFloat(t.getAttribute("width"));!isNaN(o)&&o>0&&(e=o)}if(n===0){let o=parseFloat(t.getAttribute("height"));!isNaN(o)&&o>0&&(n=o)}}catch{}if((e===0||n===0)&&(t.naturalWidth||t.naturalHeight))try{e===0&&t.naturalWidth>0&&(e=t.naturalWidth),n===0&&t.naturalHeight>0&&(n=t.naturalHeight)}catch{}return{width:e,height:n}}function _o(t,e,n){let o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(o),()=>{try{o.remove()}catch{}}}async function Qe(t,e,n){let o=await To(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:s,contentHeight:r,rect:i}=Po(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let c={...n,scale:1},a=_o(o,s,r),u;try{u=await l.toPng(o.documentElement,c)}finally{a()}u.style.display="block",u.style.width=`${s}px`,u.style.height=`${r}px`;let m=document.createElement("div");return e.nodeMap.set(m,t),tt(t,m,e,n),m.style.overflow="hidden",m.style.display="block",m.style.width||(m.style.width=`${Math.round(i.width)}px`),m.style.height||(m.style.height=`${Math.round(i.height)}px`),m.appendChild(u),m}var Et=new Map;async function Ft(t){if(S.resource?.has(t))return S.resource.get(t);if(Et.has(t))return Et.get(t);let e=(async()=>{let n=await _(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return S.resource?.set(t,n.data),n.data})();Et.set(t,e);try{let n=await e;return Et.set(t,n),n}catch(n){throw Et.delete(t),n}}var Wo=/\bblob:[^)"'\s]+/g;async function He(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Wo)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let s=await Ft(o);n=n.split(o).join(s)}catch{}return n}function Dt(t){return typeof t=="string"&&t.startsWith("blob:")}function Oo(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 Uo(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function Je(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let c=i.getAttribute("src")||i.currentSrc||"";if(Dt(c)){let u=await Ft(c);i.setAttribute("src",u)}let a=i.getAttribute("srcset");if(a&&a.includes("blob:")){let u=Oo(a),m=!1;for(let p of u)if(Dt(p.url))try{p.url=await Ft(p.url),m=!0}catch{}m&&i.setAttribute("srcset",Uo(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let l="http://www.w3.org/1999/xlink",c=i.getAttribute("href")||i.getAttributeNS?.(l,"href");if(Dt(c)){let a=await Ft(c);i.setAttribute("href",a),i.removeAttributeNS?.(l,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of o)try{let l=i.getAttribute("style");if(l&&l.includes("blob:")){let c=await He(l);i.setAttribute("style",c)}}catch{}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of s)try{let l=i.textContent||"";l.includes("blob:")&&(i.textContent=await He(l))}catch{}let r=["poster"];for(let i of r){let l=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let c of l)try{let a=c.getAttribute(i);Dt(a)&&c.setAttribute(i,await Ft(a))}catch{}}}async function Nt(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,s=null,r=null;if(t.nodeType===Node.ELEMENT_NODE){let a=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ot.has(a))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let a=document.createElement("div"),u=t.getBoundingClientRect();return a.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,a}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let a of n.exclude)try{if(t.matches?.(a)){if(n.excludeMode==="hide"){let u=document.createElement("div"),m=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${m.width}px;height:${m.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${a}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let a=document.createElement("div"),u=t.getBoundingClientRect();return a.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,a}else if(n.filterMode==="remove")return null}}catch(a){console.warn("Error in filter function:",a)}if(t.tagName==="IFRAME"){let a=!1;try{a=!!(t.contentDocument||t.contentWindow?.document)}catch{a=!1}if(a)try{return await Qe(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let{width:u,height:m}=$t(t),p=document.createElement("div");return p.style.cssText=`width:${u}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;`,tt(t,p,e,n),p}else{let{width:u,height:m}=$t(t),p=document.createElement("div");return p.style.cssText=`display:inline-block;width:${u}px;height:${m}px;visibility:hidden;`,tt(t,p,e,n),p}}if(t.getAttribute("data-capture")==="placeholder"){let a=t.cloneNode(!1);e.nodeMap.set(a,t),tt(t,a,e,n);let u=document.createElement("div");return u.textContent=t.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",a.appendChild(u),a}if(t.tagName==="CANVAS"){let a="";try{let h=t.getContext("2d",{willReadFrequently:!0});try{h&&h.getImageData(0,0,1,1)}catch{}if(await new Promise(y=>requestAnimationFrame(y)),a=t.toDataURL("image/png"),!a||a==="data:,"){try{h&&h.getImageData(0,0,1,1)}catch{}if(await new Promise(y=>requestAnimationFrame(y)),a=t.toDataURL("image/png"),!a||a==="data:,"){let y=document.createElement("canvas");y.width=t.width,y.height=t.height;let f=y.getContext("2d");f&&(f.drawImage(t,0,0),a=y.toDataURL("image/png"))}}}catch{}let u=document.createElement("img");try{u.decoding="sync",u.loading="eager"}catch{}a&&(u.src=a),u.width=t.width,u.height=t.height;let{width:m,height:p}=$t(t);return m>0&&(u.style.width=`${m}px`),p>0&&(u.style.height=`${p}px`),e.nodeMap.set(u,t),tt(t,u,e,n),u}let i;try{if(i=t.cloneNode(!1),De(t,i),e.nodeMap.set(i,t),t.tagName==="IMG"){Xe(t,i);try{let{width:a,height:u}=$t(t),m=Math.round(a||0),p=Math.round(u||0);m&&(i.dataset.snapdomWidth=String(m)),p&&(i.dataset.snapdomHeight=String(p))}catch{}try{let a=t.getAttribute("style")||"",u=window.getComputedStyle(t),m=d=>{let g=a.match(new RegExp(`${d}\\s*:\\s*([^;]+)`,"i")),b=g?g[1].trim():u.getPropertyValue(d);return/%|auto/i.test(String(b||""))},p=parseInt(i.dataset.snapdomWidth||"0",10),h=parseInt(i.dataset.snapdomHeight||"0",10),y=m("width")||!p,f=m("height")||!h;y&&p&&(i.style.width=`${p}px`),f&&h&&(i.style.height=`${h}px`),p&&(i.style.minWidth=`${p}px`),h&&(i.style.minHeight=`${h}px`)}catch{}}}catch(a){throw console.error("[Snapdom] Failed to clone node:",t,a),a}if(t instanceof HTMLTextAreaElement){let a=t.getBoundingClientRect();i.style.width=`${a.width}px`,i.style.height=`${a.height}px`}if(t instanceof HTMLInputElement&&(i.value=t.value,i.setAttribute("value",t.value),t.checked!==void 0&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(s=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),tt(t,i,e,n),t.shadowRoot){let d=function(b,x){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return x(null);Nt(b,e,n).then(w=>{x(w||null)}).catch(()=>{x(null)})};try{let b=t.shadowRoot.querySelectorAll("slot");for(let x of b){let w=[];try{w=x.assignedNodes?.({flatten:!0})||x.assignedNodes?.()||[]}catch{w=x.assignedNodes?.()||[]}for(let C of w)o.add(C)}}catch{}let a=ze(e),u=`[data-sd="${a}"]`;try{i.setAttribute("data-sd",a)}catch{}let m=je(t.shadowRoot),p=qe(m,u),h=Ye(m),y=Ke(t,h,u);Ve(i,y+p,a);let f=document.createDocumentFragment(),g=await Ht(Array.from(t.shadowRoot.childNodes),d,n.fast);f.append(...g.filter(b=>!!b)),i.appendChild(f)}if(t.tagName==="SLOT"){let p=function(y,f){Nt(y,e,n).then(d=>{d&&Ge(d),f(d||null)}).catch(()=>{f(null)})},a=t.assignedNodes?.({flatten:!0})||[],u=a.length>0?a:Array.from(t.childNodes),m=document.createDocumentFragment(),h=await Ht(Array.from(u),p,n.fast);return m.append(...h.filter(y=>!!y)),m}function l(a,u){if(o.has(a))return u(null);Nt(a,e,n).then(m=>{u(m||null)}).catch(()=>{u(null)})}let c=await Ht(Array.from(t.childNodes),l,n.fast);if(i.append(...c.filter(a=>!!a)),s!==null&&i instanceof HTMLSelectElement){i.value=s;for(let a of i.options)a.value===s?a.setAttribute("selected",""):a.removeAttribute("selected")}return r!==null&&i instanceof HTMLTextAreaElement&&(i.textContent=r),i}Y();At();D();var Bo=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],wt=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),ge=[];function tn(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?ge.push(n):typeof n=="string"?ge.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function H(t){let e=typeof t=="string"?t:"",n=[...Bo,...ge];for(let o of n)if(o instanceof RegExp&&o.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}function Do(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var Ze=new Map;function Ho(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,s;for(;s=o.exec(n);)e[s[1].toUpperCase()]=Number(s[2]);return e}async function qo(t,e,n){let o=String(t||""),s=o.toLowerCase(),r=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(s)&&!/\bsymbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};let l=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?c="rounded":/\bsharp\b/.test(r)?c="sharp":/\boutlined\b/.test(r)&&(c="outlined");let a=l===1,u=null;if(a&&(c==="outlined"&&wt.materialIconsFilled?u={url:wt.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&wt.materialIconsRound?u={url:wt.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&wt.materialIconsSharp&&(u={url:wt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!u)return{familyForMeasure:o,familyForCanvas:o};if(!Ze.has(u.alias))try{let p=new FontFace(u.alias,`url(${u.url})`,{style:"normal",weight:"400"});document.fonts.add(p),await p.load(),Ze.set(u.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let m=`"${u.alias}"`;return{familyForMeasure:m,familyForCanvas:m}}async function zo(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function jo(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let o=t.color?.trim();return o&&o!=="inherit"?o:"#000"}async function Vo(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:s="#000",variation:r="",className:i=""}={}){let l=String(e||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,a=Ho(r),{familyForMeasure:u,familyForCanvas:m}=await qo(l,i,a);await zo(m.replace(/^["']+|["']+$/g,""),o);let p=document.createElement("span");p.textContent=t,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=u,p.style.fontWeight=String(n||"normal"),p.style.fontSize=`${o}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=s,document.body.appendChild(p);let h=p.getBoundingClientRect(),y=Math.max(1,Math.ceil(h.width)),f=Math.max(1,Math.ceil(h.height));document.body.removeChild(p);let d=document.createElement("canvas");d.width=y*c,d.height=f*c;let g=d.getContext("2d");g.scale(c,c),g.font=`${n?`${n} `:""}${o}px ${m}`,g.textAlign="left",g.textBaseline="top",g.fillStyle=s;try{g.fontKerning="normal"}catch{}return g.fillText(t,0,0),{dataUrl:d.toDataURL(),width:y,height:f}}async function en(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim());if(o.length===0)return 0;let s=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim()):[],r=0;for(let i=0;i<o.length;i++){let l=o[i],c=s[i]||null;try{let a=getComputedStyle(c||l),u=a.fontFamily||"Material Icons";if(!Do(u))continue;let m=(c||l).textContent.trim();if(!m)continue;let p=parseInt(a.fontSize,10)||24,h=a.fontWeight&&a.fontWeight!=="normal"?a.fontWeight:"normal",y=jo(a),f=a.fontVariationSettings&&a.fontVariationSettings!=="normal"?a.fontVariationSettings:"",d=(c||l).className||"",{dataUrl:g,width:b,height:x}=await Vo(m,{family:u,weight:h,fontSize:p,color:y,variation:f,className:d});l.textContent="";let w=l.ownerDocument.createElement("img");w.src=g,w.alt=m,w.style.height=`${p}px`,w.style.width=`${Math.max(1,Math.round(b/x*p))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(w),r++}catch{}}return r}at();async function rn(t,e,n,o=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let i=document.createElement("span");i.textContent=t,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=n||"normal",i.style.fontSize=`${o}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);let l=i.getBoundingClientRect(),c=Math.ceil(l.width),a=Math.ceil(l.height);document.body.removeChild(i);let u=document.createElement("canvas");u.width=Math.max(1,c*r),u.height=Math.max(1,a*r);let m=u.getContext("2d");return m.scale(r,r),m.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,m.textAlign="left",m.textBaseline="top",m.fillStyle=s,m.fillText(t,0,0),{dataUrl:u.toDataURL(),width:c,height:a}}var Xo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),Yo=["katex","mathjax","mathml"];function Vt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Xo.has(n.toLowerCase()))return n}return""}function qt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function zt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Ko(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Go(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let s=qt(n[1]),r=qt(n[2]);return{min:Math.min(s,r),max:Math.max(s,r)}}let o=qt(e);return{min:o,max:o}}function Qo(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Jo(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let r=parseFloat(n[1]),i=parseFloat(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),s=o?parseFloat(o[1]):100;return{min:s,max:s}}function Zo(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let s=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>s.endsWith(l)))return!0;let i=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i)||Yo.some(l=>i.includes(l)))return!0;for(let l of e){let c=l.toLowerCase().replace(/\s+/g,"+"),a=l.toLowerCase().replace(/\s+/g,"-");if(i.includes(c)||i.includes(a))return!0}return!1}catch{return!1}}function tr(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function nn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,s)=>{let r=(s||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return n;let i=r;try{i=new URL(r,e||location.href).href}catch{}return`url("${i}")`})}var ye=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,jt=4;async function er(t,e,n){if(!t)return t;let o=new Set;function s(l,c){try{return new URL(l,c||location.href).href}catch{return l}}async function r(l,c,a=0){if(a>jt)return console.warn(`[snapDOM] @import depth exceeded (${jt}) at ${c}`),l;let u="",m=0,p;for(;p=ye.exec(l);){u+=l.slice(m,p.index),m=ye.lastIndex;let h=(p[2]||p[4]||"").trim(),y=s(h,c);if(o.has(y)){console.warn(`[snapDOM] Skipping circular @import: ${y}`);continue}o.add(y);let f="";try{let d=await _(y,{as:"text",useProxy:n,silent:!0});d.ok&&typeof d.data=="string"&&(f=d.data)}catch{}f?(f=nn(f,y),f=await r(f,y,a+1),u+=`
12
12
  /* inlined: ${y} */
13
13
  ${f}
14
- `):u+=p[0]}return u+=l.slice(m),u}let i=nn(t,e||location.href);return i=await r(i,e||location.href,0),i}var sn=/url\((["']?)([^"')]+)\1\)/g,tr=/@font-face[^{}]*\{[^}]*\}/g;function an(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let s=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!s)continue;let r=s[1],i=s[2],l=c=>{if(!c.includes("?"))return parseInt(c,16);let a=parseInt(c.replace(/\?/g,"0"),16),u=parseInt(c.replace(/\?/g,"F"),16);return[a,u]};if(i){let c=l(r),a=l(i),u=Array.isArray(c)?c[0]:c,m=Array.isArray(a)?a[1]:a;e.push([Math.min(u,m),Math.max(u,m)])}else{let c=l(r);Array.isArray(c)?e.push([c[0],c[1]]):e.push([c,c])}}return e}function cn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,s]of e)if(n>=o&&n<=s)return!0;return!1}function ye(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(sn)){let s=(o[2]||"").trim();if(!(!s||s.startsWith("data:"))){if(!/^https?:/i.test(s))try{s=new URL(s,e||location.href).href}catch{}n.push(s)}}return n}async function ln(t,e,n=""){let o=t;for(let s of t.matchAll(sn)){let r=it(s[0]);if(!r)continue;let i=r;if(!i.startsWith("http")&&!i.startsWith("data:"))try{i=new URL(i,e||location.href).href}catch{}if(!q(i)){if(S.resource?.has(i)){S.font?.add(i),o=o.replace(s[0],`url(${S.resource.get(i)})`);continue}if(!S.font?.has(i))try{let l=await P(i,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let c=l.data;S.resource?.set(i,c),S.font?.add(i),o=o.replace(s[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",i)}}}return o}function er(t){if(!t.length)return null;let e=(l,c)=>t.some(([a,u])=>!(u<l||a>c)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),s=e(880,1023),r=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":r?"cyrillic":s?"greek":o?"latin-ext":n?"latin":null}function on(t={}){let e=new Set((t.families||[]).map(s=>String(s).toLowerCase())),n=new Set((t.domains||[]).map(s=>String(s).toLowerCase())),o=new Set((t.subsets||[]).map(s=>String(s).toLowerCase()));return(s,r)=>{if(e.size&&e.has(s.family.toLowerCase()))return!0;if(n.size)for(let i of s.srcUrls)try{if(n.has(new URL(i).host.toLowerCase()))return!0}catch{}if(o.size){let i=er(r);if(i&&o.has(i))return!0}return!1}}function nr(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let r of t.match(e)||[]){let i=r.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Vt(i),c=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),a=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),m=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),p=(r.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),h=ye(p,location.href),y=h.length?h.map(d=>String(d).toLowerCase()).sort().join("|"):p.toLowerCase(),f=[String(l||"").toLowerCase(),c,a,u,m.toLowerCase(),y].join("|");n.has(f)||(n.add(f),o.push(r))}if(o.length===0)return t;let s=0;return t.replace(e,()=>o[s++]||"")}function or(t,e,n,o){let s=Array.from(t||[]).sort().join("|"),r=e?JSON.stringify({families:(e.families||[]).map(c=>String(c).toLowerCase()).sort(),domains:(e.domains||[]).map(c=>String(c).toLowerCase()).sort(),subsets:(e.subsets||[]).map(c=>String(c).toLowerCase()).sort()}):"",i=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|");return`fonts-embed-css::req=${s}::ex=${r}::lf=${i}::px=${o||""}`}async function un(t,e,n,o){let s;try{s=t.cssRules||[]}catch{return}let r=(i,l)=>{try{return new URL(i,l||location.href).href}catch{return i}};for(let i of s){if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){let l=i.href?r(i.href,e):e;if(o.depth>=jt){console.warn(`[snapDOM] CSSOM import depth exceeded (${jt}) at ${l}`);continue}if(l&&o.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&o.visitedSheets.add(l);let c={...o,depth:(o.depth||0)+1};await un(i.styleSheet,l,n,c);continue}if(i.type===CSSRule.FONT_FACE_RULE){let l=(i.style.getPropertyValue("font-family")||"").trim(),c=Vt(l);if(!c||q(c))continue;let a=(i.style.getPropertyValue("font-weight")||"400").trim(),u=(i.style.getPropertyValue("font-style")||"normal").trim(),m=(i.style.getPropertyValue("font-stretch")||"100%").trim(),p=(i.style.getPropertyValue("src")||"").trim(),h=(i.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(c,u,a,m))continue;let y=an(h);if(!cn(o.usedCodepoints,y))continue;let f={family:c,weightSpec:a,styleSpec:u,stretchSpec:m,unicodeRange:h,srcRaw:p,srcUrls:ye(p,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(f,y))continue;if(/url\(/i.test(p)){let d=await ln(p,e||location.href,o.useProxy);await n(`@font-face{font-family:${c};src:${d};font-style:${u};font-weight:${a};font-stretch:${m};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${c};src:${p};font-style:${u};font-weight:${a};font-stretch:${m};${h?`unicode-range:${h};`:""}}`)}}}async function Xt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:s=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let r=new Map;for(let f of t){let[d,g,b,x]=String(f).split("__");if(!d)continue;let w=r.get(d)||[];w.push({w:parseInt(g,10),s:b,st:parseInt(x,10)}),r.set(d,w)}function i(f,d,g,b){if(!r.has(f))return!1;let x=r.get(f),w=Yo(g),k=Ko(d),C=Go(b),v=w.min!==w.max,E=w.min,$=M=>k.kind==="normal"&&M==="normal"||k.kind!=="normal"&&(M==="italic"||M==="oblique"),L=!1;for(let M of x){let I=v?M.w>=w.min&&M.w<=w.max:M.w===E,_=$(zt(M.s)),B=M.st>=C.min&&M.st<=C.max;if(I&&_&&B){L=!0;break}}if(L)return!0;if(!v)for(let M of x){let I=$(zt(M.s)),_=M.st>=C.min&&M.st<=C.max;if(Math.abs(E-M.w)<=300&&I&&_)return!0}if(!v&&k.kind==="normal"&&x.some(I=>zt(I.s)!=="normal"))for(let I of x){let _=Math.abs(E-I.w)<=300,B=I.st>=C.min&&I.st<=C.max;if(_&&B)return!0}return!1}let l=on(n),c=or(t,n,o,s);if(S.resource?.has(c))return S.resource.get(c);let a=Jo(t),u=[],m=ge;for(let f of document.querySelectorAll("style")){let d=f.textContent||"";for(let g of d.matchAll(m)){let b=(g[2]||g[4]||"").trim();if(!b||q(b))continue;!!document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||u.push(b)}}u.length&&await Promise.all(u.map(f=>new Promise(d=>{if(document.querySelector(`link[rel="stylesheet"][href="${f}"]`))return d(null);let g=document.createElement("link");g.rel="stylesheet",g.href=f,g.setAttribute("data-snapdom","injected-import"),g.onload=()=>d(g),g.onerror=()=>d(null),document.head.appendChild(g)})));let p="",h=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(f=>!!f.href);for(let f of h)try{if(q(f.href))continue;let d="",g=!1;try{g=new URL(f.href,location.href).origin===location.origin}catch{}if(!g&&!Qo(f.href,a))continue;if(g){let x=Array.from(document.styleSheets).find(w=>w.href===f.href);if(x)try{let w=x.cssRules||[];d=Array.from(w).map(k=>k.cssText).join("")}catch{}}if(!d&&(d=(await P(f.href,{as:"text",useProxy:s})).data,q(f.href)))continue;d=await Zo(d,f.href,s);let b="";for(let x of d.match(tr)||[]){let w=(x.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),k=Vt(w);if(!k||q(k))continue;let C=(x.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(x.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),E=(x.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),$=(x.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),L=(x.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),M=ye(L,f.href);if(!i(k,v,C,E))continue;let I=an($);if(!cn(e,I))continue;let _={family:k,weightSpec:C,styleSpec:v,stretchSpec:E,unicodeRange:$,srcRaw:L,srcUrls:M,href:f.href};if(n&&l(_,I))continue;let B=/url\(/i.test(L)?await ln(x,f.href,s):x;b+=B}b.trim()&&(p+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",f.href)}let y={requiredIndex:r,usedCodepoints:e,faceMatchesRequired:i,simpleExcluder:n?on(n):null,useProxy:s,visitedSheets:new Set,depth:0};for(let f of document.styleSheets)if(!(f.href&&h.some(d=>d.href===f.href)))try{let d=f.href||location.href;d&&y.visitedSheets.add(d),await un(f,d,async g=>{p+=g},y)}catch{}try{for(let f of document.fonts||[]){if(!f||!f.family||f.status!=="loaded"||!f._snapdomSrc)continue;let d=String(f.family).replace(/^['"]+|['"]+$/g,"");if(q(d)||!r.has(d)||n?.families&&n.families.some(b=>String(b).toLowerCase()===d.toLowerCase()))continue;let g=f._snapdomSrc;if(!String(g).startsWith("data:")){if(S.resource?.has(f._snapdomSrc))g=S.resource.get(f._snapdomSrc),S.font?.add(f._snapdomSrc);else if(!S.font?.has(f._snapdomSrc))try{let b=await P(f._snapdomSrc,{as:"dataURL",useProxy:s,silent:!0});if(b.ok&&typeof b.data=="string")g=b.data,S.resource?.set(f._snapdomSrc,g),S.font?.add(f._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",f._snapdomSrc);continue}}p+=`@font-face{font-family:'${d}';src:url(${g});font-style:${f.style||"normal"};font-weight:${f.weight||"normal"};}`}}catch{}for(let f of o){if(!f||typeof f!="object")continue;let d=String(f.family||"").replace(/^['"]+|['"]+$/g,"");if(!d||q(d)||!r.has(d)||n?.families&&n.families.some(C=>String(C).toLowerCase()===d.toLowerCase()))continue;let g=f.weight!=null?String(f.weight):"normal",b=f.style!=null?String(f.style):"normal",x=f.stretchPct!=null?`${f.stretchPct}%`:"100%",w=String(f.src||""),k=w;if(!k.startsWith("data:")){if(S.resource?.has(w))k=S.resource.get(w),S.font?.add(w);else if(!S.font?.has(w))try{let C=await P(w,{as:"dataURL",useProxy:s,silent:!0});if(C.ok&&typeof C.data=="string")k=C.data,S.resource?.set(w,k),S.font?.add(w);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",w);continue}}p+=`@font-face{font-family:'${d}';src:url(${k});font-style:${b};font-weight:${g};font-stretch:${x};}`}return p&&(p=nr(p),S.resource?.set(c,p)),p}function Yt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=i=>{let l=Vt(i.fontFamily);if(!l)return;let c=(a,u,m)=>`${l}__${qt(a)}__${zt(u)}__${Xo(m)}`;e.add(c(i.fontWeight,i.fontStyle,i.fontStretch))};o(getComputedStyle(t));let s=getComputedStyle(t,"::before");s&&s.content&&s.content!=="none"&&o(s);let r=getComputedStyle(t,"::after");for(r&&r.content&&r.content!=="none"&&o(r);n.nextNode();){let i=n.currentNode,l=getComputedStyle(i);o(l);let c=getComputedStyle(i,"::before");c&&c.content&&c.content!=="none"&&o(c);let a=getComputedStyle(i,"::after");a&&a.content&&a.content!=="none"&&o(a)}return e}function Kt(t){let e=new Set,n=s=>{if(s)for(let r of s)e.add(r.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let s=o.currentNode;if(s.nodeType===Node.TEXT_NODE)n(s.nodeValue||"");else if(s.nodeType===Node.ELEMENT_NODE){let r=s;for(let i of["::before","::after"]){let c=getComputedStyle(r,i)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let a=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(a)for(let u of a)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function Gt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let s=document.createElement("div");s.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let r of n){let i=document.createElement("span");i.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",i.style.fontFamily=`"${r}"`,i.style.fontWeight="700",i.style.fontStyle="italic",i.style.fontSize="32px",i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.margin="0",i.style.padding="0",s.appendChild(i)}document.body.appendChild(s),s.offsetWidth,document.body.removeChild(s)};for(let s=0;s<Math.max(1,e);s++)o(),await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)))}H();function pn(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function rr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function fn(t,e=!1){let n="",o=Math.max(1,t);for(;o>0;)o--,n=String.fromCharCode(97+o%26)+n,o=Math.floor(o/26);return e?n.toUpperCase():n}function dn(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],o=Math.max(1,Math.min(3999,t)),s="";for(let[r,i]of n)for(;o>=r;)s+=i,o-=r;return e?s:s.toLowerCase()}function mn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return fn(t,!1);case"upper-alpha":return fn(t,!0);case"lower-roman":return dn(t,!1);case"upper-roman":return dn(t,!0);default:return String(Math.max(0,t))}}function hn(t){let e=()=>S?.session?.__counterEpoch??0,n=e(),o=new WeakMap,s=t instanceof Document?t.documentElement:t,r=p=>p&&p.tagName==="LI",i=p=>{let h=0,y=p?.parentElement;if(!y)return 0;for(let f of y.children){if(f===p)break;f.tagName==="LI"&&h++}return h},l=p=>{let h=new Map;for(let[y,f]of p)h.set(y,f.slice());return h},c=(p,h,y)=>{let f=l(p),d;try{d=y.style?.counterReset||getComputedStyle(y).counterReset}catch{}if(d&&d!=="none")for(let b of d.split(",")){let x=b.trim().split(/\s+/),w=x[0],k=Number.isFinite(Number(x[1]))?Number(x[1]):0;if(!w)continue;let C=h.get(w);if(C&&C.length){let v=C.slice();v.push(k),f.set(w,v)}else f.set(w,[k])}let g;try{g=y.style?.counterIncrement||getComputedStyle(y).counterIncrement}catch{}if(g&&g!=="none")for(let b of g.split(",")){let x=b.trim().split(/\s+/),w=x[0],k=Number.isFinite(Number(x[1]))?Number(x[1]):1;if(!w)continue;let C=f.get(w)||[];C.length===0&&C.push(0),C[C.length-1]+=k,f.set(w,C)}try{if(getComputedStyle(y).display==="list-item"&&r(y)){let x=y.parentElement,w=1;if(x&&x.tagName==="OL"){let C=x.getAttribute("start"),v=Number.isFinite(Number(C))?Number(C):1,E=i(y),$=y.getAttribute("value");w=Number.isFinite(Number($))?Number($):v+E}else w=1+i(y);let k=f.get("list-item")||[];k.length===0&&k.push(0),k[k.length-1]=w,f.set("list-item",k)}}catch{}return f},a=(p,h,y)=>{let f=c(y,h,p);o.set(p,f);let d=f;for(let g of p.children)d=a(g,f,d);return f},u=new Map;a(s,u,u);function m(){let p=e();if(p!==n){n=p;let h=new Map;a(s,h,h)}}return{get(p,h){m();let y=o.get(p)?.get(h);return y&&y.length?y[y.length-1]:0},getStack(p,h){m();let y=o.get(p)?.get(h);return y?y.slice():[]}}}function gn(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,s=t.replace(o,(r,i,l)=>{let c=String(l).split(",").map(a=>a.trim());if(i==="counter"){let a=c[0]?.replace(/^["']|["']$/g,""),u=(c[1]||"decimal").toLowerCase(),m=n.get(e,a);return mn(m,u)}else{let a=c[0]?.replace(/^["']|["']$/g,""),u=c[1]?.replace(/^["']|["']$/g,"")??"",m=(c[2]||"decimal").toLowerCase(),p=n.getStack(e,a);return p.length?p.map(y=>mn(y,m)).join(u):""}});return rr(s)}catch{return"- "}}at();H();var bt=new WeakMap,yn=300;function sr(t,e){let n=Sn(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=bn(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):bn(t)}function we(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Sn(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,o=0;for(let r=0;r<e.length;r++){let i=e[r];if(i.tagName==="STYLE"){let l=i.textContent?i.textContent.length:0;n+=`S${l}|`;let c=i.sheet,a=c?we(c):null;a&&(o+=a.length)}else{let l=i.getAttribute("href")||"",c=i.getAttribute("media")||"all";n+=`L${l}|m:${c}|`;let a=i.sheet,u=a?we(a):null;u&&(o+=u.length)}}let s=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(s)?s.length:0}|tr:${o}`,n}function wn(t,e,n){let o=we(t);if(!o)return!1;for(let s=0;s<o.length;s++){if(n.budget<=0)return!1;let r=o[s],i=r&&r.cssText?r.cssText:"";n.budget--;for(let l of e)if(i.includes(l))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let l=0;l<r.cssRules.length&&n.budget>0;l++){let c=r.cssRules[l],a=c&&c.cssText?c.cssText:"";n.budget--;for(let u of e)if(a.includes(u))return!0}if(n.budget<=0)return!1}return!1}function bn(t=document){let e=Sn(t),n=bt.get(t);if(n&&n.fingerprint===e)return n.result;let o=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],s=t.querySelectorAll("style");for(let i=0;i<s.length;i++){let l=s[i].textContent||"";for(let c of o)if(l.includes(c))return bt.set(t,{fingerprint:e,result:!0}),!0}let r=t.adoptedStyleSheets;if(Array.isArray(r)&&r.length){let i={budget:yn};try{for(let l of r)if(wn(l,o,i))return bt.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let i=t.querySelectorAll('style,link[rel~="stylesheet"]'),l={budget:yn};for(let c=0;c<i.length&&l.budget>0;c++){let a=i[c],u=null;if(a.tagName,u=a.sheet||null,u&&wn(u,o,l))return bt.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(bt.set(t,{fingerprint:e,result:!0}),!0):(bt.set(t,{fingerprint:e,result:!1}),!1)}var xt=new WeakMap,xn=-1;function ir(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function ar(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):ir(t)}function be(t,e){let n=t.parentElement,o=n?xt.get(n):null;return o?{get(s,r){let i=e.get(s,r),l=o.get(r);return typeof l=="number"?Math.max(i,l):i},getStack(s,r){let i=e.getStack(s,r);if(!i.length)return i;let l=o.get(r);if(typeof l=="number"){let c=i.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return i}}:e}function xe(t,e,n){let o=new Map;function s(c){let a=[];if(!c||c==="none")return a;for(let u of String(c).split(",")){let m=u.trim().split(/\s+/),p=m[0],h=Number.isFinite(Number(m[1]))?Number(m[1]):void 0;p&&a.push({name:p,num:h})}return a}let r=s(e?.counterReset),i=s(e?.counterIncrement);function l(c){if(o.has(c))return o.get(c).slice();let a=n.getStack(t,c);a=a.length?a.slice():[];let u=r.find(p=>p.name===c);if(u){let p=Number.isFinite(u.num)?u.num:0;a=a.length?[...a,p]:[p]}let m=i.find(p=>p.name===c);if(m){let p=Number.isFinite(m.num)?m.num:1;a.length===0&&(a=[0]),a[a.length-1]+=p}return o.set(c,a.slice()),a}return{get(c,a){let u=l(a);return u.length?u[u.length-1]:0},getStack(c,a){return l(a)},__incs:i}}function cr(t,e,n){let o;try{o=getComputedStyle(t,e)}catch{}let s=o?.content;if(!s||s==="none"||s==="normal")return{text:"",incs:[]};let r=be(t,n),i=xe(t,o,r),l=pn(s)?gn(s,t,i):s;return{text:ar(l),incs:i.__incs||[]}}async function Se(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let s=t.ownerDocument||document;if(!sr(s,n))return;let r=S?.session?.__counterEpoch??0;if(xn!==r&&(xt=new WeakMap,n&&(n.__counterCtx=null),xn=r),!n.__counterCtx)try{n.__counterCtx=hn(t.ownerDocument||document)}catch{}let i=n.__counterCtx;for(let a of["::before","::after","::first-letter"])try{let u=lt(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 R=getComputedStyle(t);if(!(u.color!==R.color||u.fontSize!==R.fontSize||u.fontWeight!==R.fontWeight))continue;let W=Array.from(e.childNodes).find(ee=>ee.nodeType===Node.TEXT_NODE&&ee.textContent?.trim().length>0);if(!W)continue;let U=W.textContent,dt=U.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Zt=U.slice(dt?.length||0);if(!dt||/[\uD800-\uDFFF]/.test(dt))continue;let mt=document.createElement("span");mt.textContent=dt,mt.dataset.snapdomPseudo="::first-letter";let te=Ut(u),Rt=yt(te,"span");n.styleMap.set(mt,Rt);let Tt=document.createTextNode(Zt);e.replaceChild(Tt,W),e.insertBefore(mt,Tt);continue}let p=u.content??"",h=p===""||p==="none"||p==="normal",{text:y,incs:f}=cr(t,a,i),d=u.backgroundImage,g=u.backgroundColor,b=u.fontFamily,x=parseInt(u.fontSize)||32,w=parseInt(u.fontWeight)||!1,k=u.color||"#000",C=u.borderStyle,v=parseFloat(u.borderWidth),E=u.transform,$=q(b),L=!h&&y!=="",M=d&&d!=="none",I=g&&g!=="transparent"&&g!=="rgba(0, 0, 0, 0)",_=C&&C!=="none"&&v>0,B=E&&E!=="none";if(!(L||M||I||_||B)){if(f&&f.length&&t.parentElement){let R=xt.get(t.parentElement)||new Map;for(let{name:T}of f){if(!T)continue;let W=be(t,i),st=xe(t,getComputedStyle(t,a),W).get(t,T);R.set(T,st)}xt.set(t.parentElement,R)}continue}let F=document.createElement("span");F.dataset.snapdomPseudo=a,F.style.pointerEvents="none";let ot=Ut(u),rt=yt(ot,"span");if(n.styleMap.set(F,rt),$&&y&&y.length===1){let{dataUrl:R,width:T,height:W}=await rn(y,b,w,x,k),U=document.createElement("img");U.src=R,U.style=`height:${x}px;width:${T/W*x}px;object-fit:contain;`,F.appendChild(U),e.dataset.snapdomHasIcon="true"}else if(y&&y.startsWith("url(")){let R=it(y);if(R?.trim())try{let T=document.createElement("img"),W=await P(J(R),{as:"dataURL",useProxy:o.useProxy});T.src=W.data,T.style=`width:${x}px;height:auto;object-fit:contain;`,F.appendChild(T)}catch(T){console.error(`[snapdom] Error in pseudo ${a} for`,t,T)}}else!$&&L&&(F.textContent=y);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=u.backgroundRepeat,F.style.backgroundSize=u.backgroundSize,u.backgroundPositionX&&u.backgroundPositionY?(F.style.backgroundPositionX=u.backgroundPositionX,F.style.backgroundPositionY=u.backgroundPositionY):F.style.backgroundPosition=u.backgroundPosition,F.style.backgroundOrigin=u.backgroundOrigin,F.style.backgroundClip=u.backgroundClip,F.style.backgroundAttachment=u.backgroundAttachment,F.style.backgroundBlendMode=u.backgroundBlendMode}catch{}if(M)try{let R=vt(d),T=await Promise.all(R.map(ct));F.style.backgroundImage=T.join(", ")}catch(R){console.warn(`[snapdom] Failed to inline background-image for ${a}`,R)}I&&(F.style.backgroundColor=g);let ft=F.childNodes.length>0||F.textContent?.trim()!==""||M||I||_||B;if(f&&f.length&&t.parentElement){let R=xt.get(t.parentElement)||new Map,T=be(t,i),W=xe(t,getComputedStyle(t,a),T);for(let{name:U}of f){if(!U)continue;let st=W.get(t,U);R.set(U,st)}xt.set(t.parentElement,R)}if(!ft)continue;a==="::before"?e.insertBefore(F,e.firstChild):e.appendChild(F)}catch(u){console.warn(`[snapdom] Failed to capture ${a} for`,t,u)}let l=Array.from(t.children),c=Array.from(e.children).filter(a=>!a.dataset.snapdomPseudo);for(let a=0;a<Math.min(l.length,c.length);a++)await Se(l[a],c[a],n,o)}function Cn(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,s=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(s.length===0)return;let r=/url\(\s*#([^)]+)\)/g,i=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],l=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c="http://www.w3.org/1999/xlink",a=w=>{if(!w||!w.getAttribute)return null;let k=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(c,"href"):null);if(k)return k;let C=w.attributes;if(!C)return null;for(let v=0;v<C.length;v++){let E=C[v];if(!E||!E.name)continue;if(E.name==="href")return E.value;let $=E.name.indexOf(":");if($!==-1&&E.name.slice($+1)==="href")return E.value}return null},u=new Set(Array.from(t.querySelectorAll("[id]")).map(w=>w.id)),m=new Set,p=!1,h=(w,k=null)=>{if(!w)return;r.lastIndex=0;let C;for(;C=r.exec(w);){p=!0;let v=(C[1]||"").trim();v&&(u.has(v)||(m.add(v),k&&!k.has(v)&&k.add(v)))}},y=w=>{let k=w.querySelectorAll("use");for(let E of k){let $=a(E);if(!$||!$.startsWith("#"))continue;p=!0;let L=$.slice(1).trim();L&&!u.has(L)&&m.add(L)}let v=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let E of v){h(E.getAttribute("style")||"");for(let $ of i)h(E.getAttribute($))}};for(let w of s)y(w);if(!p)return;let f=t.querySelector("svg.inline-defs-container");f||(f=n.createElementNS("http://www.w3.org/2000/svg","svg"),f.classList.add("inline-defs-container"),f.setAttribute("aria-hidden","true"),f.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(f,t.firstChild||null));let d=f.querySelector("defs")||null,g=w=>{if(!w||u.has(w))return null;let k=l(w),C=v=>{let E=o.querySelector(v);return E&&!t.contains(E)?E:null};return C(`svg defs > *#${k}`)||C(`svg > symbol#${k}`)||C(`*#${k}`)};if(!m.size)return;let b=new Set(m),x=new Set;for(;b.size;){let w=b.values().next().value;if(b.delete(w),!w||u.has(w)||x.has(w))continue;let k=g(w);if(!k){x.add(w);continue}d||(d=n.createElementNS("http://www.w3.org/2000/svg","defs"),f.appendChild(d));let C=k.cloneNode(!0);C.id||C.setAttribute("id",w),d.appendChild(C),x.add(w),u.add(w);let v=[C,...C.querySelectorAll("*")];for(let E of v){let $=a(E);if($&&$.startsWith("#")){let M=$.slice(1).trim();M&&!u.has(M)&&!x.has(M)&&b.add(M)}let L=E.getAttribute?.("style")||"";L&&h(L,b);for(let M of i){let I=E.getAttribute?.(M);I&&h(I,b)}}}}H();function An(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let o=t.getBoundingClientRect(),s=t.clientHeight,r="data-snap-ph",i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let l=i.currentNode,c=getComputedStyle(l),a=c.position;if(a!=="sticky"&&a!=="-webkit-sticky")continue;let u=kn(c.top),m=kn(c.bottom);if(u==null&&m==null)continue;let p=lr(l,t),h=ur(e,p,r);if(!h)continue;let y=l.getBoundingClientRect(),f=y.width,d=y.height,g=y.left-o.left;if(!(f>0&&d>0)||!Number.isFinite(g))continue;let b=u!=null?u+n:n+(s-d-m);if(!Number.isFinite(b))continue;let x=Number.parseInt(c.zIndex,10),w=Number.isFinite(x),k=w?Math.max(x,1)+1:2,C=w?x-1:0,v=h.cloneNode(!1);v.setAttribute(r,"1"),v.style.position="sticky",v.style.left=`${g}px`,v.style.top=`${b}px`,v.style.width=`${f}px`,v.style.height=`${d}px`,v.style.visibility="hidden",v.style.zIndex=String(C),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",h.parentElement?.insertBefore(v,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${b}px`,h.style.bottom="auto",h.style.zIndex=String(k),h.style.pointerEvents="none"}}function kn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function lr(t,e){let n=[];for(let o=t;o&&o!==e;){let s=o.parentElement;if(!s)break;n.push(Array.prototype.indexOf.call(s.children,o)),o=s}return n.reverse()}function ur(t,e,n){let o=t;for(let s=0;s<e.length;s++)if(o=fr(o,n)[e[s]],!o)return null;return o instanceof HTMLElement?o:null}function fr(t,e){let n=[],o=t.children;for(let s=0;s<o.length;s++){let r=o[s];r.hasAttribute(e)||n.push(r)}return n}function vn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,s=e.borderStyle,r=e.borderWidth,i=n!=="none"&&parseFloat(o)>0,l=s==="none"||parseFloat(r)===0;i&&l&&(t.style.border=`${o} solid transparent`)}async function Mn(t,e={}){let n={styleMap:S.session.styleMap,styleCache:S.session.styleCache,nodeMap:S.session.nodeMap},o,s="",r="";vn(t);try{Cn(t)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{o=await $t(t,n,e,t)}catch(c){throw console.warn("deepClone failed:",c),c}try{await Se(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await Je(o);try{let c=o.querySelectorAll("style[data-sd]");for(let a of c)r+=a.textContent||"",a.remove()}catch{}let i=fe(n.styleMap);s=Array.from(i.entries()).map(([c,a])=>`.${a}{${c}}`).join(""),s=r+s;for(let[c,a]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",a.replace(/;/g,"; "));continue}let u=i.get(a);u&&c.classList.add(u);let m=c.style?.backgroundImage,p=c.dataset?.snapdomHasIcon;m&&m!=="none"&&(c.style.backgroundImage=m),p&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,a]of n.nodeMap.entries()){let u=a.scrollLeft,m=a.scrollTop;if((u||m)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";let h=document.createElement("div");for(h.style.transform=`translate(${-u}px, ${-m}px)`,h.style.willChange="transform",h.style.display="inline-block",h.style.width="100%";c.firstChild;)h.appendChild(c.firstChild);c.appendChild(h)}}let l=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(An(t,l),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,c);let a=se(c.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=a||""}for(let[c,a]of n.nodeMap.entries())a.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:o,classCSS:s,styleCache:n.styleCache}}at();function dr(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,o=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,r=parseFloat(t.style?.width||"")||0,i=parseFloat(t.style?.height||"")||0,l=e||r||o||t.width||t.naturalWidth||100,c=n||i||s||t.height||t.naturalHeight||100;return{width:l,height:c}}async function En(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async s=>{if(!s.getAttribute("src")){let u=s.currentSrc||s.src||"";u&&s.setAttribute("src",u)}s.removeAttribute("srcset"),s.removeAttribute("sizes");let r=s.src||"";if(!r)return;let i=await P(r,{as:"dataURL",useProxy:e.useProxy});if(i.ok&&typeof i.data=="string"&&i.data.startsWith("data:")){s.src=i.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:l,height:c}=dr(s),{fallbackURL:a}=e||{};if(a)try{let u=typeof a=="function"?await a({width:l,height:c,src:r,element:s}):a;if(u){let m=await P(u,{as:"dataURL",useProxy:e.useProxy});s.src=m.data,s.width||(s.width=l),s.height||(s.height=c);return}}catch{}if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${l}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",s.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${l}px;height:${c}px;visibility:hidden;`,s.replaceWith(u)}};for(let s=0;s<n.length;s+=4){let r=n.slice(s,s+4).map(o);await Promise.allSettled(r)}}Y();async function Qt(t,e,n,o={}){let s=[[t,e]],r=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],i=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;s.length;){let[a,u]=s.shift(),m=n.get(a)||lt(a);n.has(a)||n.set(a,m);let p=(()=>{let f=m.getPropertyValue("border-image"),d=m.getPropertyValue("border-image-source");return f&&f!=="none"||d&&d!=="none"})();for(let f of l){let d=m.getPropertyValue(f);d&&u.style.setProperty(f,d)}for(let f of r){let d=m.getPropertyValue(f);if(!d||d==="none")continue;let g=vt(d),b=await Promise.all(g.map(x=>ct(x,o)));b.some(x=>x&&x!=="none"&&!/^url\(undefined/.test(x))&&u.style.setProperty(f,b.join(", "))}for(let f of i){let d=m.getPropertyValue(f);!d||d==="initial"||u.style.setProperty(f,d)}if(p)for(let f of c){let d=m.getPropertyValue(f);!d||d==="initial"||u.style.setProperty(f,d)}let h=Array.from(a.children),y=Array.from(u.children).filter(f=>!(f.dataset&&f.dataset.snapdomPseudo));for(let f=0;f<Math.min(h.length,y.length);f++)s.push([h[f],y[f]])}}Y();H();function Fn(t){if(!t)return()=>{};let e=mr(t);if(e<=0)return()=>{};if(!gr(t))return()=>{};let n=getComputedStyle(t),o=Math.round(pr(n)*e+hr(n)),s=t.textContent??"",r=s;if(t.scrollHeight<=o+.5)return()=>{};let i=0,l=s.length,c=-1;for(;i<=l;){let a=i+l>>1;t.textContent=s.slice(0,a)+"\u2026",t.scrollHeight<=o+.5?(c=a,i=a+1):l=a-1}return t.textContent=(c>=0?s.slice(0,c):"")+"\u2026",()=>{t.textContent=r}}function mr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let o=parseInt(n,10);return Number.isFinite(o)&&o>0?o:0}function pr(t){let e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return!e||e==="normal"?Math.round(n*1.2):e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(n*1.2)}function hr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function gr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var It=[];function $n(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 In(...t){let e=t.flat();for(let n of e){let o=$n(n);o&&(It.some(s=>s&&s.name&&o.name&&s.name===o.name)||It.push(o))}}function Ln(t){return(t&&Array.isArray(t.plugins)?t.plugins:It)||It}async function j(t,e,n){let o=n,s=Ln(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let l=await i(e,o);typeof l<"u"&&(o=l)}return o}async function Nn(t,e,n){let o=[],s=Ln(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let l=await i(e,n);typeof l<"u"&&o.push(l)}return o}function yr(t){let e=[];if(Array.isArray(t))for(let n of t){let o=$n(n);if(!o||!o.name)continue;let s=e.findIndex(r=>r&&r.name===o.name);s>=0&&e.splice(s,1),e.push(o)}for(let n of It)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function Rn(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=yr(e)),t}function Tn(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let s=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=s.length?s:"none"}catch{}}function wr(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let o of n)o.remove()}function br(t,e={}){let{stripFrameworkDirectives:n=!0}=e,o=new Set(["xml","xlink"]),s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let r=s.currentNode;for(let i of Array.from(r.attributes)){let l=i.name;if(l.includes("@")){r.removeAttribute(l);continue}if(l.includes(":")){let c=l.split(":",1)[0];if(!o.has(c)){r.removeAttribute(l);continue}}if(n&&(l.startsWith("x-")||l.startsWith("v-")||l.startsWith(":")||l.startsWith("on:")||l.startsWith("bind:")||l.startsWith("let:")||l.startsWith("class:"))){r.removeAttribute(l);continue}}}}function Pn(t,e={}){t&&(br(t,e),wr(t))}function xr(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function Sr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Cr(t,e){if(!(t instanceof Element)||xr(t)||Sr(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let o=e.display||"";return!(o.includes("flex")||o.includes("grid")||o.startsWith("table")||e.transform&&e.transform!=="none")}function _n(t,e,n=new Map){function o(s,r){if(!(s instanceof Element)||!(r instanceof Element))return;let i=s.childElementCount>r.childElementCount,l=n.get(s)||getComputedStyle(s);if(n.has(s)||n.set(s,l),i&&Cr(s,l)){r.style.height||(r.style.height="auto"),r.style.width||(r.style.width="auto"),r.style.removeProperty("block-size"),r.style.removeProperty("inline-size"),r.style.minHeight||(r.style.minHeight="0"),r.style.minWidth||(r.style.minWidth="0"),r.style.maxHeight||(r.style.maxHeight="none"),r.style.maxWidth||(r.style.maxWidth="none");let u=l.overflowY||l.overflowBlock||"visible",m=l.overflowX||l.overflowInline||"visible";(u!=="visible"||m!=="visible")&&(r.style.overflow="visible")}let c=Array.from(s.children),a=Array.from(r.children);for(let u=0;u<Math.min(c.length,a.length);u++)o(c[u],a[u])}o(t,e)}function kr(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed"||e.position==="sticky"||(e.cssFloat||e.float||"none")!=="none"||e.transform&&e.transform!=="none")}function Ar(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{}return!1}function Wn(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),s=1/0,r=-1/0,i=!1,l=Array.from(t.children);for(let h of l){if(Ar(h,e)||!kr(h))continue;let y=h.getBoundingClientRect(),f=y.top-o.top,d=y.bottom-o.top;d<=f||(f<s&&(s=f),d>r&&(r=d),i=!0)}let c=i?Math.max(0,r-s):0,a=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,m=parseFloat(n.paddingTop)||0,p=parseFloat(n.paddingBottom)||0;return a+u+m+p+c}var A=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t;function On(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),o=0,s=0,r=0,i=0;for(let l of n){let c=l.match(/-?\d+(\.\d+)?px/g)?.map(f=>parseFloat(f))||[];if(c.length<2)continue;let[a,u,m=0,p=0]=c,h=Math.abs(a)+m+p,y=Math.abs(u)+m+p;s=Math.max(s,h+Math.max(a,0)),i=Math.max(i,h+Math.max(-a,0)),r=Math.max(r,y+Math.max(u,0)),o=Math.max(o,y+Math.max(-u,0))}return{top:Math.ceil(o),right:Math.ceil(s),bottom:Math.ceil(r),left:Math.ceil(i)}}function Un(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 Bn(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Dn(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],o=0,s=0,r=0,i=0,l=!1;for(let c of n){l=!0;let a=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(f=>parseFloat(f))||[],[u=0,m=0,p=0]=a,h=Math.abs(u)+p,y=Math.abs(m)+p;s=Math.max(s,h+Math.max(u,0)),i=Math.max(i,h+Math.max(-u,0)),r=Math.max(r,y+Math.max(m,0)),o=Math.max(o,y+Math.max(-m,0))}return{bleed:{top:A(o),right:A(s),bottom:A(r),left:A(i)},has:l}}function Hn(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let o=n.transform||"none";if(!o||o==="none")try{let r=Xn(t);if(r.a===1&&r.b===0&&r.c===0&&r.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let s=o.match(/^matrix\(\s*([^)]+)\)$/i);if(s){let r=s[1].split(",").map(i=>parseFloat(i.trim()));if(r.length===6&&r.every(Number.isFinite)){let[i,l,c,a]=r,u=Math.sqrt(i*i+l*l)||0,m=0,p=0,h=0,y=0,f=0,d=0;u>0&&(m=i/u,p=l/u,h=m*c+p*a,y=c-m*h,f=a-p*h,d=Math.sqrt(y*y+f*f)||0,d>0?h=h/d:h=0);let g=u,b=0,x=h*d,w=d;try{e.style.transform=`matrix(${g}, ${b}, ${x}, ${w}, 0, 0)`}catch{}return{a:g,b,c:x,d:w}}}try{let r=String(o).trim();return e.style.transform=r+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function ke(t,e,n,o,s){let r=n.a,i=n.b,l=n.c,c=n.d,a=n.e||0,u=n.f||0;function m(g,b){let x=g-o,w=b-s,k=r*x+l*w,C=i*x+c*w;return k+=o+a,C+=s+u,[k,C]}let p=[m(0,0),m(t,0),m(0,e),m(t,e)],h=1/0,y=1/0,f=-1/0,d=-1/0;for(let[g,b]of p)g<h&&(h=g),b<y&&(y=b),g>f&&(f=g),b>d&&(d=b);return{minX:h,minY:y,maxX:f,maxY:d,width:f-h,height:d-y}}function qn(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[s,r]=[o[0]||"0",o[1]||"0"],i=(l,c)=>{let a=l.toLowerCase();return a==="left"||a==="top"?0:a==="center"?c/2:a==="right"||a==="bottom"?c:a.endsWith("px")?parseFloat(a)||0:a.endsWith("%")?(parseFloat(a)||0)*c/100:/^-?\d+(\.\d+)?$/.test(a)&&parseFloat(a)||0};return{ox:i(s,e),oy:i(r,n)}}function zn(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let s=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},r=s("rotate");if(r)if(r.angle){let c=r.angle;e.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.unit}else r.unit?e.rotate=r.unit==="rad"?r.value*180/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{let c=getComputedStyle(t);e.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let i=s("scale");if(i){let c="x"in i&&i.x?.value!=null?i.x.value:Array.isArray(i)?i[0]?.value:Number(i)||1,a="y"in i&&i.y?.value!=null?i.y.value:Array.isArray(i)?i[1]?.value:c;e.scale=`${c} ${a}`}else{let c=getComputedStyle(t);e.scale=c.scale&&c.scale!=="none"?c.scale:null}let l=s("translate");if(l){let c="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,a="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",m="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${c}${u} ${a}${m}`}else{let c=getComputedStyle(t);e.translate=c.translate&&c.translate!=="none"?c.translate:null}return e}let o=getComputedStyle(t);return e.rotate=o.rotate&&o.rotate!=="none"?o.rotate:"0deg",e.scale=o.scale&&o.scale!=="none"?o.scale:null,e.translate=o.translate&&o.translate!=="none"?o.translate:null,e}var Ce=null;function vr(){if(Ce)return Ce;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),Ce=t,t}function jn(t){let e=vr(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let o=Xn(n);return e.removeChild(n),o}function Vn(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let s=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",r=e.scale&&e.scale!=="none"&&e.scale!=="1",i=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(s||r||i)}function Xn(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}async function Ae(t,e){if(!t)throw new Error("Element cannot be null or undefined");_t(e.cache);let n=e.fast,o=e.outerTransforms!==!1,s=!!e.outerShadows,r={element:t,options:e,plugins:e.plugins},i,l,c,a="",u="",m,p,h=null;await j("beforeSnap",r),await j("beforeClone",r);let y=Fn(r.element);try{({clone:i,classCSS:l,styleCache:c}=await Mn(r.element,r.options)),!o&&i&&(h=Hn(r.element,i)),!s&&i&&Tn(r.element,i)}finally{y()}if(r={clone:i,classCSS:l,styleCache:c,...r},await j("afterClone",r),Pn(r.clone),r.options?.excludeMode==="remove")try{_n(r.element,r.clone,r.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await en(r.clone,r.element)}catch{}await new Promise(b=>{X(async()=>{await En(r.clone,r.options),b()},{fast:n})}),await new Promise(b=>{X(async()=>{await Qt(r.element,r.clone,r.styleCache,r.options),b()},{fast:n})}),e.embedFonts&&await new Promise(b=>{X(async()=>{let x=Yt(r.element),w=Kt(r.element);if(O()){let k=new Set(Array.from(x).map(C=>String(C).split("__")[0]).filter(Boolean));await Gt(k,1)}a=await Xt({required:x,usedCodepoints:w,preCached:!1,exclude:r.options.excludeFonts,useProxy:r.options.useProxy}),b()},{fast:n})});let f=le(r.clone).sort(),d=f.join(",");S.baseStyle.has(d)?u=S.baseStyle.get(d):await new Promise(b=>{X(()=>{u=ue(f),S.baseStyle.set(d,u),b()},{fast:n})}),r={fontsCSS:a,baseCSS:u,...r},await j("beforeRender",r),await new Promise(b=>{X(()=>{let x=getComputedStyle(r.element),w=r.element.getBoundingClientRect(),k=Math.max(1,A(r.element.offsetWidth||parseFloat(x.width)||w.width||1)),C=Math.max(1,A(r.element.offsetHeight||parseFloat(x.height)||w.height||1));if(r.options?.excludeMode==="remove"){let z=Wn(r.element,r.options);Number.isFinite(z)&&z>0&&(C=Math.max(1,Math.min(C,A(z+1))))}let v=(z,V=NaN)=>{let ht=typeof z=="string"?parseFloat(z):z;return Number.isFinite(ht)?ht:V},E=v(r.options.width),$=v(r.options.height),L=k,M=C,I=Number.isFinite(E),_=Number.isFinite($),B=C>0?k/C:1;I&&_?(L=Math.max(1,A(E)),M=Math.max(1,A($))):I?(L=Math.max(1,A(E)),M=Math.max(1,A(L/(B||1)))):_?(M=Math.max(1,A($)),L=Math.max(1,A(M*(B||1)))):(L=k,M=C);let nt=0,F=0,ot=k,rt=C;if(!o&&h&&Number.isFinite(h.a)){let z={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},V=ke(k,C,z,0,0);nt=A(V.minX),F=A(V.minY),ot=A(V.maxX),rt=A(V.maxY)}else if(o&&Mr(r.element)){let V=x.transform&&x.transform!=="none"?x.transform:"",ht=zn(r.element),re=jn({baseTransform:V,rotate:ht.rotate||"0deg",scale:ht.scale,translate:ht.translate}),{ox:ro,oy:so}=qn(x,k,C),io=re.is2D?re:new DOMMatrix(re.toString()),Pt=ke(k,C,io,ro,so);nt=A(Pt.minX),F=A(Pt.minY),ot=A(Pt.maxX),rt=A(Pt.maxY)}let Ct=On(x),ft=Un(x),R=Bn(x),T=Dn(x),W=s?{top:A(Ct.top+ft.top+R.top+T.bleed.top),right:A(Ct.right+ft.right+R.right+T.bleed.right),bottom:A(Ct.bottom+ft.bottom+R.bottom+T.bleed.bottom),left:A(Ct.left+ft.left+R.left+T.bleed.left)}:{top:0,right:0,bottom:0,left:0};nt=A(nt-W.left),F=A(F-W.top),ot=A(ot+W.right),rt=A(rt+W.bottom);let U=Math.max(1,A(ot-nt)),st=Math.max(1,A(rt-F)),dt=I||_?A(L/k):1,Zt=_||I?A(M/C):1,mt=Math.max(1,A(U*dt)),te=Math.max(1,A(st*Zt)),Rt="http://www.w3.org/2000/svg",Tt=O()?1:0,G=A(Tt+(o?0:1)),Q=document.createElementNS(Rt,"foreignObject"),Zn=A(nt),to=A(F);Q.setAttribute("x",String(A(-(Zn-G)))),Q.setAttribute("y",String(A(-(to-G)))),Q.setAttribute("width",String(A(k+G*2))),Q.setAttribute("height",String(A(C+G*2))),Q.style.overflow="visible";let Ie=document.createElement("style");Ie.textContent=r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,Q.appendChild(Ie);let pt=document.createElement("div");pt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),pt.style.width=`${A(k)}px`,pt.style.height=`${A(C)}px`,pt.style.overflow="visible",pt.appendChild(r.clone),Q.appendChild(pt);let eo=new XMLSerializer().serializeToString(Q),ne=A(U+G*2),oe=A(st+G*2),Le=I||_;e.meta={w0:k,h0:C,vbW:ne,vbH:oe,targetW:L,targetH:M};let no=O()&&Le?ne:A(mt+G*2),oo=O()&&Le?oe:A(te+G*2);p=`<svg xmlns="${Rt}" width="${no}" height="${oo}" viewBox="0 0 ${ne} ${oe}">`+eo+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,r={svgString:p,dataURL:m,...r},b()},{fast:n})}),await j("afterRender",r);let g=document.getElementById("snapdom-sandbox");return g&&g.style.position==="absolute"&&g.remove(),r.dataURL}function Mr(t){return Vn(t)}function Er(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Yn(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=Er(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,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}}Bt();Y();at();H();async function Fr(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,s=e.cache??e.cacheOpt??"full";_t(s);try{await document.fonts?.ready}catch{}try{ae()}catch{}S.session=S.session||{},S.session.styleCache||(S.session.styleCache=new WeakMap),S.image=S.image||new Map,S.background=S.background||new Map;try{await Qt(t,void 0,S.session.styleCache,{useProxy:o})}catch{}let r=[],i=[];try{if(t&&t.nodeType===1){let c=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];i=[t,...c],r=[],t.tagName==="IMG"&&t.getAttribute("src")&&r.push(t),r.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(r=Array.from(t.querySelectorAll("img[src]")),i=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let c of r){let a=c?.currentSrc||c?.src;if(a&&!S.image.has(a)){let u=Promise.resolve().then(async()=>{let m=await P(a,{as:"dataURL",useProxy:o});m?.ok&&typeof m.data=="string"&&S.image.set(a,m.data)}).catch(()=>{});l.push(u)}}for(let c of i){let a="";try{a=c?.style?.backgroundImage||"",(!a||a==="none")&&(a=lt(c).backgroundImage)}catch{}if(a&&a!=="none"){let u=a.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let m of u){let p=Promise.resolve().then(()=>ct(m,{...e,useProxy:o})).catch(()=>{});l.push(p)}}}if(n)try{let c=Yt(t),a=Kt(t);if(typeof O=="function"?O():!!O){let m=new Set(Array.from(c).map(p=>String(p).split("__")[0]).filter(Boolean));await Gt(m,3)}await Xt({required:c,usedCodepoints:a,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o})}catch{}await Promise.allSettled(l)}function Ur(...t){return In(...t),N}var N=Object.assign(Br,{plugins:Ur}),Jn=Symbol("snapdom.internal"),et=Symbol("snapdom.internal.silent"),$e=!1;async function Br(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Yn(e);if(Rn(n,e&&e.plugins),O()&&(n.embedFonts===!0||Hr(t)))for(let o=0;o<3;o++)try{await Dr(t,e),$e=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&tn(n.iconFonts),n.snap||(n.snap={toPng:(o,s)=>N.toPng(o,s),toSvg:(o,s)=>N.toSvg(o,s)}),N.capture(t,n,Jn)}N.capture=async(t,e,n)=>{if(n!==Jn)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Ae(t,e),s={img:async(f,d)=>{let{toImg:g}=await Promise.resolve().then(()=>(Nt(),Lt));return g(o,{...f,...d||{}})},svg:async(f,d)=>{let{toSvg:g}=await Promise.resolve().then(()=>(Nt(),Lt));return g(o,{...f,...d||{}})},canvas:async(f,d)=>{let{toCanvas:g}=await Promise.resolve().then(()=>(St(),ve));return g(o,{...f,...d||{}})},blob:async(f,d)=>{let{toBlob:g}=await Promise.resolve().then(()=>(Jt(),Fe));return g(o,{...f,...d||{}})},png:async(f,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(K(),tt));return g(o,{...f,...d||{},format:"png"})},jpeg:async(f,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(K(),tt));return g(o,{...f,...d||{},format:"jpeg"})},webp:async(f,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(K(),tt));return g(o,{...f,...d||{},format:"webp"})},download:async(f,d)=>{let{download:g}=await Promise.resolve().then(()=>(Qn(),Gn));return g(o,{...f,...d||{}})}},i={...e,export:{url:o},exports:{svg:async f=>{let{toSvg:d}=await Promise.resolve().then(()=>(Nt(),Lt));return d(o,{...e,...f||{},[et]:!0})},canvas:async f=>{let{toCanvas:d}=await Promise.resolve().then(()=>(St(),ve));return d(o,{...e,...f||{},[et]:!0})},png:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),tt));return d(o,{...e,...f||{},format:"png",[et]:!0})},jpeg:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),tt));return d(o,{...e,...f||{},format:"jpeg",[et]:!0})},jpg:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),tt));return d(o,{...e,...f||{},format:"jpeg",[et]:!0})},webp:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),tt));return d(o,{...e,...f||{},format:"webp",[et]:!0})},blob:async f=>{let{toBlob:d}=await Promise.resolve().then(()=>(Jt(),Fe));return d(o,{...e,...f||{},[et]:!0})},img:async f=>{let{toImg:d}=await Promise.resolve().then(()=>(Nt(),Lt));return d(o,{...e,...f||{},[et]:!0})}}},l=await Nn("defineExports",i),c=Object.assign({},...l.filter(f=>f&&typeof f=="object")),a={...s,...c};a.jpeg&&!a.jpg&&(a.jpg=(f,d)=>a.jpeg(f,d));function u(f,d){let g={...e,...d||{}};return(f==="jpeg"||f==="jpg")&&(g.backgroundColor==null||g.backgroundColor==="transparent")&&(g.backgroundColor="#ffffff"),g}let m=!1,p=Promise.resolve();async function h(f,d){let g=async()=>{let b=a[f];if(!b)throw new Error(`[snapdom] Unknown export type: ${f}`);let x=u(f,d),w={...e,export:{type:f,options:x,url:o}};await j("beforeExport",w);let k=await b(w,x);return await j("afterExport",w,k),m||(m=!0,await j("afterSnap",e)),k};return p=p.then(g)}let y={url:o,toRaw:()=>o,to:(f,d)=>h(f,d),toImg:f=>h("img",f),toSvg:f=>h("svg",f),toCanvas:f=>h("canvas",f),toBlob:f=>h("blob",f),toPng:f=>h("png",f),toJpg:f=>h("jpg",f),toWebp:f=>h("webp",f),download:f=>h("download",f)};for(let f of Object.keys(a)){let d="to"+f.charAt(0).toUpperCase()+f.slice(1);y[d]||(y[d]=g=>h(f,g))}return y};N.toRaw=(t,e)=>N(t,e).then(n=>n.toRaw());N.toImg=(t,e)=>N(t,e).then(n=>n.toImg());N.toSvg=(t,e)=>N(t,e).then(n=>n.toSvg());N.toCanvas=(t,e)=>N(t,e).then(n=>n.toCanvas());N.toBlob=(t,e)=>N(t,e).then(n=>n.toBlob());N.toPng=(t,e)=>N(t,{...e,format:"png"}).then(n=>n.toPng());N.toJpg=(t,e)=>N(t,{...e,format:"jpeg"}).then(n=>n.toJpg());N.toWebp=(t,e)=>N(t,{...e,format:"webp"}).then(n=>n.toWebp());N.download=(t,e)=>N(t,e).then(n=>n.download());async function Dr(t,e){if($e)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await Ae(t,n)}catch{}await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s))),o&&await new Promise(s=>{let r=new Image;try{r.decoding="sync",r.loading="eager"}catch{}r.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",r.src=o,document.body.appendChild(r),(async()=>{try{typeof r.decode=="function"&&await r.decode()}catch{}let i=performance.now();for(;!(r.complete&&r.naturalWidth>0)&&performance.now()-i<900;)await new Promise(l=>setTimeout(l,200));await new Promise(l=>requestAnimationFrame(l));try{r.remove()}catch{}s()})()}),t.querySelectorAll("canvas").forEach(s=>{try{let r=s.getContext("2d",{willReadFrequently:!0});r&&r.getImageData(0,0,1,1)}catch{}}),$e=!0}function Hr(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),s=o.backgroundImage&&o.backgroundImage!=="none",r=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(s||r||n.tagName==="CANVAS")return!0}return!1}export{Fr as preCache,N as snapdom};
14
+ `):u+=p[0]}return u+=l.slice(m),u}let i=nn(t,e||location.href);return i=await r(i,e||location.href,0),i}var sn=/url\((["']?)([^"')]+)\1\)/g,nr=/@font-face[^{}]*\{[^}]*\}/g;function an(t){if(!t)return[];let e=[],n=t.split(",").map(o=>o.trim()).filter(Boolean);for(let o of n){let s=o.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!s)continue;let r=s[1],i=s[2],l=c=>{if(!c.includes("?"))return parseInt(c,16);let a=parseInt(c.replace(/\?/g,"0"),16),u=parseInt(c.replace(/\?/g,"F"),16);return[a,u]};if(i){let c=l(r),a=l(i),u=Array.isArray(c)?c[0]:c,m=Array.isArray(a)?a[1]:a;e.push([Math.min(u,m),Math.max(u,m)])}else{let c=l(r);Array.isArray(c)?e.push([c[0],c[1]]):e.push([c,c])}}return e}function cn(t,e){if(!e.length||!t||t.size===0)return!0;for(let n of t)for(let[o,s]of e)if(n>=o&&n<=s)return!0;return!1}function we(t,e){let n=[];if(!t)return n;for(let o of t.matchAll(sn)){let s=(o[2]||"").trim();if(!(!s||s.startsWith("data:"))){if(!/^https?:/i.test(s))try{s=new URL(s,e||location.href).href}catch{}n.push(s)}}return n}async function ln(t,e,n=""){let o=t;for(let s of t.matchAll(sn)){let r=it(s[0]);if(!r)continue;let i=r;if(!i.startsWith("http")&&!i.startsWith("data:"))try{i=new URL(i,e||location.href).href}catch{}if(!H(i)){if(S.resource?.has(i)){S.font?.add(i),o=o.replace(s[0],`url(${S.resource.get(i)})`);continue}if(!S.font?.has(i))try{let l=await _(i,{as:"dataURL",useProxy:n,silent:!0});if(l.ok&&typeof l.data=="string"){let c=l.data;S.resource?.set(i,c),S.font?.add(i),o=o.replace(s[0],`url(${c})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",i)}}}return o}function or(t){if(!t.length)return null;let e=(l,c)=>t.some(([a,u])=>!(u<l||a>c)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),s=e(880,1023),r=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":r?"cyrillic":s?"greek":o?"latin-ext":n?"latin":null}function on(t={}){let e=new Set((t.families||[]).map(s=>String(s).toLowerCase())),n=new Set((t.domains||[]).map(s=>String(s).toLowerCase())),o=new Set((t.subsets||[]).map(s=>String(s).toLowerCase()));return(s,r)=>{if(e.size&&e.has(s.family.toLowerCase()))return!0;if(n.size)for(let i of s.srcUrls)try{if(n.has(new URL(i).host.toLowerCase()))return!0}catch{}if(o.size){let i=or(r);if(i&&o.has(i))return!0}return!1}}function rr(t){if(!t)return t;let e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(let r of t.match(e)||[]){let i=r.match(/font-family:\s*([^;]+);/i)?.[1]||"",l=Vt(i),c=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),a=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),m=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),p=(r.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),h=we(p,location.href),y=h.length?h.map(d=>String(d).toLowerCase()).sort().join("|"):p.toLowerCase(),f=[String(l||"").toLowerCase(),c,a,u,m.toLowerCase(),y].join("|");n.has(f)||(n.add(f),o.push(r))}if(o.length===0)return t;let s=0;return t.replace(e,()=>o[s++]||"")}function sr(t,e,n,o){let s=Array.from(t||[]).sort().join("|"),r=e?JSON.stringify({families:(e.families||[]).map(c=>String(c).toLowerCase()).sort(),domains:(e.domains||[]).map(c=>String(c).toLowerCase()).sort(),subsets:(e.subsets||[]).map(c=>String(c).toLowerCase()).sort()}):"",i=(n||[]).map(c=>`${(c.family||"").toLowerCase()}::${c.weight||"normal"}::${c.style||"normal"}::${c.src||""}`).sort().join("|");return`fonts-embed-css::req=${s}::ex=${r}::lf=${i}::px=${o||""}`}async function un(t,e,n,o){let s;try{s=t.cssRules||[]}catch{return}let r=(i,l)=>{try{return new URL(i,l||location.href).href}catch{return i}};for(let i of s){if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){let l=i.href?r(i.href,e):e;if(o.depth>=jt){console.warn(`[snapDOM] CSSOM import depth exceeded (${jt}) at ${l}`);continue}if(l&&o.visitedSheets.has(l)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${l}`);continue}l&&o.visitedSheets.add(l);let c={...o,depth:(o.depth||0)+1};await un(i.styleSheet,l,n,c);continue}if(i.type===CSSRule.FONT_FACE_RULE){let l=(i.style.getPropertyValue("font-family")||"").trim(),c=Vt(l);if(!c||H(c))continue;let a=(i.style.getPropertyValue("font-weight")||"400").trim(),u=(i.style.getPropertyValue("font-style")||"normal").trim(),m=(i.style.getPropertyValue("font-stretch")||"100%").trim(),p=(i.style.getPropertyValue("src")||"").trim(),h=(i.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(c,u,a,m))continue;let y=an(h);if(!cn(o.usedCodepoints,y))continue;let f={family:c,weightSpec:a,styleSpec:u,stretchSpec:m,unicodeRange:h,srcRaw:p,srcUrls:we(p,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(f,y))continue;if(/url\(/i.test(p)){let d=await ln(p,e||location.href,o.useProxy);await n(`@font-face{font-family:${c};src:${d};font-style:${u};font-weight:${a};font-stretch:${m};${h?`unicode-range:${h};`:""}}`)}else await n(`@font-face{font-family:${c};src:${p};font-style:${u};font-weight:${a};font-stretch:${m};${h?`unicode-range:${h};`:""}}`)}}}async function Xt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:s=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let r=new Map;for(let f of t){let[d,g,b,x]=String(f).split("__");if(!d)continue;let w=r.get(d)||[];w.push({w:parseInt(g,10),s:b,st:parseInt(x,10)}),r.set(d,w)}function i(f,d,g,b){if(!r.has(f))return!1;let x=r.get(f),w=Go(g),C=Qo(d),k=Jo(b),v=w.min!==w.max,E=w.min,$=M=>C.kind==="normal"&&M==="normal"||C.kind!=="normal"&&(M==="italic"||M==="oblique"),N=!1;for(let M of x){let I=v?M.w>=w.min&&M.w<=w.max:M.w===E,W=$(zt(M.s)),q=M.st>=k.min&&M.st<=k.max;if(I&&W&&q){N=!0;break}}if(N)return!0;if(!v)for(let M of x){let I=$(zt(M.s)),W=M.st>=k.min&&M.st<=k.max;if(Math.abs(E-M.w)<=300&&I&&W)return!0}if(!v&&C.kind==="normal"&&x.some(I=>zt(I.s)!=="normal"))for(let I of x){let W=Math.abs(E-I.w)<=300,q=I.st>=k.min&&I.st<=k.max;if(W&&q)return!0}return!1}let l=on(n),c=sr(t,n,o,s);if(S.resource?.has(c))return S.resource.get(c);let a=tr(t),u=[],m=ye;for(let f of document.querySelectorAll("style")){let d=f.textContent||"";for(let g of d.matchAll(m)){let b=(g[2]||g[4]||"").trim();if(!b||H(b))continue;!!document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||u.push(b)}}u.length&&await Promise.all(u.map(f=>new Promise(d=>{if(document.querySelector(`link[rel="stylesheet"][href="${f}"]`))return d(null);let g=document.createElement("link");g.rel="stylesheet",g.href=f,g.setAttribute("data-snapdom","injected-import"),g.onload=()=>d(g),g.onerror=()=>d(null),document.head.appendChild(g)})));let p="",h=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(f=>!!f.href);for(let f of h)try{if(H(f.href))continue;let d="",g=!1;try{g=new URL(f.href,location.href).origin===location.origin}catch{}if(!g&&!Zo(f.href,a))continue;if(g){let x=Array.from(document.styleSheets).find(w=>w.href===f.href);if(x)try{let w=x.cssRules||[];d=Array.from(w).map(C=>C.cssText).join("")}catch{}}if(!d){let x=await _(f.href,{as:"text",useProxy:s});if(x?.ok&&typeof x.data=="string"&&(d=x.data),H(f.href))continue}d=await er(d,f.href,s);let b="";for(let x of d.match(nr)||[]){let w=(x.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),C=Vt(w);if(!C||H(C))continue;let k=(x.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(x.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),E=(x.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),$=(x.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),N=(x.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),M=we(N,f.href);if(!i(C,v,k,E))continue;let I=an($);if(!cn(e,I))continue;let W={family:C,weightSpec:k,styleSpec:v,stretchSpec:E,unicodeRange:$,srcRaw:N,srcUrls:M,href:f.href};if(n&&l(W,I))continue;let q=/url\(/i.test(N)?await ln(x,f.href,s):x;b+=q}b.trim()&&(p+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",f.href)}let y={requiredIndex:r,usedCodepoints:e,faceMatchesRequired:i,simpleExcluder:n?on(n):null,useProxy:s,visitedSheets:new Set,depth:0};for(let f of document.styleSheets)if(!(f.href&&h.some(d=>d.href===f.href)))try{let d=f.href||location.origin+"/";d&&y.visitedSheets.add(d),await un(f,d,async g=>{p+=g},y)}catch{}try{for(let f of document.fonts||[]){if(!f||!f.family||f.status!=="loaded"||!f._snapdomSrc)continue;let d=String(f.family).replace(/^['"]+|['"]+$/g,"");if(H(d)||!r.has(d)||n?.families&&n.families.some(b=>String(b).toLowerCase()===d.toLowerCase()))continue;let g=f._snapdomSrc;if(!String(g).startsWith("data:")){if(S.resource?.has(f._snapdomSrc))g=S.resource.get(f._snapdomSrc),S.font?.add(f._snapdomSrc);else if(!S.font?.has(f._snapdomSrc))try{let b=await _(f._snapdomSrc,{as:"dataURL",useProxy:s,silent:!0});if(b.ok&&typeof b.data=="string")g=b.data,S.resource?.set(f._snapdomSrc,g),S.font?.add(f._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",f._snapdomSrc);continue}}p+=`@font-face{font-family:'${d}';src:url(${g});font-style:${f.style||"normal"};font-weight:${f.weight||"normal"};}`}}catch{}for(let f of o){if(!f||typeof f!="object")continue;let d=String(f.family||"").replace(/^['"]+|['"]+$/g,"");if(!d||H(d)||!r.has(d)||n?.families&&n.families.some(k=>String(k).toLowerCase()===d.toLowerCase()))continue;let g=f.weight!=null?String(f.weight):"normal",b=f.style!=null?String(f.style):"normal",x=f.stretchPct!=null?`${f.stretchPct}%`:"100%",w=String(f.src||""),C=w;if(!C.startsWith("data:")){if(S.resource?.has(w))C=S.resource.get(w),S.font?.add(w);else if(!S.font?.has(w))try{let k=await _(w,{as:"dataURL",useProxy:s,silent:!0});if(k.ok&&typeof k.data=="string")C=k.data,S.resource?.set(w,C),S.font?.add(w);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",w);continue}}p+=`@font-face{font-family:'${d}';src:url(${C});font-style:${b};font-weight:${g};font-stretch:${x};}`}return p&&(p=rr(p),S.resource?.set(c,p)),p}function Yt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=i=>{let l=Vt(i.fontFamily);if(!l)return;let c=(a,u,m)=>`${l}__${qt(a)}__${zt(u)}__${Ko(m)}`;e.add(c(i.fontWeight,i.fontStyle,i.fontStretch))};o(getComputedStyle(t));let s=getComputedStyle(t,"::before");s&&s.content&&s.content!=="none"&&o(s);let r=getComputedStyle(t,"::after");for(r&&r.content&&r.content!=="none"&&o(r);n.nextNode();){let i=n.currentNode,l=getComputedStyle(i);o(l);let c=getComputedStyle(i,"::before");c&&c.content&&c.content!=="none"&&o(c);let a=getComputedStyle(i,"::after");a&&a.content&&a.content!=="none"&&o(a)}return e}function Kt(t){let e=new Set,n=s=>{if(s)for(let r of s)e.add(r.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let s=o.currentNode;if(s.nodeType===Node.TEXT_NODE)n(s.nodeValue||"");else if(s.nodeType===Node.ELEMENT_NODE){let r=s;for(let i of["::before","::after"]){let c=getComputedStyle(r,i)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let a=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(a)for(let u of a)try{e.add(parseInt(u.slice(1),16))}catch{}}}}}return e}async function Gt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let s=document.createElement("div");s.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let r of n){let i=document.createElement("span");i.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",i.style.fontFamily=`"${r}"`,i.style.fontWeight="700",i.style.fontStyle="italic",i.style.fontSize="32px",i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.margin="0",i.style.padding="0",s.appendChild(i)}document.body.appendChild(s),s.offsetWidth,document.body.removeChild(s)};for(let s=0;s<Math.max(1,e);s++)o(),await new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)))}D();function pn(t){return/\bcounter\s*\(|\bcounters\s*\(/.test(t||"")}function ir(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function fn(t,e=!1){let n="",o=Math.max(1,t);for(;o>0;)o--,n=String.fromCharCode(97+o%26)+n,o=Math.floor(o/26);return e?n.toUpperCase():n}function dn(t,e=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],o=Math.max(1,Math.min(3999,t)),s="";for(let[r,i]of n)for(;o>=r;)s+=i,o-=r;return e?s:s.toLowerCase()}function mn(t,e){switch((e||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return fn(t,!1);case"upper-alpha":return fn(t,!0);case"lower-roman":return dn(t,!1);case"upper-roman":return dn(t,!0);default:return String(Math.max(0,t))}}function hn(t){let e=()=>S?.session?.__counterEpoch??0,n=e(),o=new WeakMap,s=t instanceof Document?t.documentElement:t,r=p=>p&&p.tagName==="LI",i=p=>{let h=0,y=p?.parentElement;if(!y)return 0;for(let f of y.children){if(f===p)break;f.tagName==="LI"&&h++}return h},l=p=>{let h=new Map;for(let[y,f]of p)h.set(y,f.slice());return h},c=(p,h,y)=>{let f=l(p),d;try{d=y.style?.counterReset||getComputedStyle(y).counterReset}catch{}if(d&&d!=="none")for(let b of d.split(",")){let x=b.trim().split(/\s+/),w=x[0],C=Number.isFinite(Number(x[1]))?Number(x[1]):0;if(!w)continue;let k=h.get(w);if(k&&k.length){let v=k.slice();v.push(C),f.set(w,v)}else f.set(w,[C])}let g;try{g=y.style?.counterIncrement||getComputedStyle(y).counterIncrement}catch{}if(g&&g!=="none")for(let b of g.split(",")){let x=b.trim().split(/\s+/),w=x[0],C=Number.isFinite(Number(x[1]))?Number(x[1]):1;if(!w)continue;let k=f.get(w)||[];k.length===0&&k.push(0),k[k.length-1]+=C,f.set(w,k)}try{if(getComputedStyle(y).display==="list-item"&&r(y)){let x=y.parentElement,w=1;if(x&&x.tagName==="OL"){let k=x.getAttribute("start"),v=Number.isFinite(Number(k))?Number(k):1,E=i(y),$=y.getAttribute("value");w=Number.isFinite(Number($))?Number($):v+E}else w=1+i(y);let C=f.get("list-item")||[];C.length===0&&C.push(0),C[C.length-1]=w,f.set("list-item",C)}}catch{}return f},a=(p,h,y)=>{let f=c(y,h,p);o.set(p,f);let d=f;for(let g of p.children)d=a(g,f,d);return f},u=new Map;a(s,u,u);function m(){let p=e();if(p!==n){n=p;let h=new Map;a(s,h,h)}}return{get(p,h){m();let y=o.get(p)?.get(h);return y&&y.length?y[y.length-1]:0},getStack(p,h){m();let y=o.get(p)?.get(h);return y?y.slice():[]}}}function gn(t,e,n){if(!t||t==="none")return t;try{let o=/\b(counter|counters)\s*\(([^)]+)\)/g,s=t.replace(o,(r,i,l)=>{let c=String(l).split(",").map(a=>a.trim());if(i==="counter"){let a=c[0]?.replace(/^["']|["']$/g,""),u=(c[1]||"decimal").toLowerCase(),m=n.get(e,a);return mn(m,u)}else{let a=c[0]?.replace(/^["']|["']$/g,""),u=c[1]?.replace(/^["']|["']$/g,"")??"",m=(c[2]||"decimal").toLowerCase(),p=n.getStack(e,a);return p.length?p.map(y=>mn(y,m)).join(u):""}});return ir(s)}catch{return"- "}}at();D();var bt=new WeakMap,yn=300;function ar(t,e){let n=Sn(t);return e?(e.__pseudoPreflightFp!==n&&(e.__pseudoPreflight=bn(t),e.__pseudoPreflightFp=n),!!e.__pseudoPreflight):bn(t)}function be(t){try{return t&&t.cssRules?t.cssRules:null}catch{return null}}function Sn(t){let e=t.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${e.length}|`,o=0;for(let r=0;r<e.length;r++){let i=e[r];if(i.tagName==="STYLE"){let l=i.textContent?i.textContent.length:0;n+=`S${l}|`;let c=i.sheet,a=c?be(c):null;a&&(o+=a.length)}else{let l=i.getAttribute("href")||"",c=i.getAttribute("media")||"all";n+=`L${l}|m:${c}|`;let a=i.sheet,u=a?be(a):null;u&&(o+=u.length)}}let s=t.adoptedStyleSheets;return n+=`ass:${Array.isArray(s)?s.length:0}|tr:${o}`,n}function wn(t,e,n){let o=be(t);if(!o)return!1;for(let s=0;s<o.length;s++){if(n.budget<=0)return!1;let r=o[s],i=r&&r.cssText?r.cssText:"";n.budget--;for(let l of e)if(i.includes(l))return!0;if(r&&r.cssRules&&r.cssRules.length)for(let l=0;l<r.cssRules.length&&n.budget>0;l++){let c=r.cssRules[l],a=c&&c.cssText?c.cssText:"";n.budget--;for(let u of e)if(a.includes(u))return!0}if(n.budget<=0)return!1}return!1}function bn(t=document){let e=Sn(t),n=bt.get(t);if(n&&n.fingerprint===e)return n.result;let o=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],s=t.querySelectorAll("style");for(let i=0;i<s.length;i++){let l=s[i].textContent||"";for(let c of o)if(l.includes(c))return bt.set(t,{fingerprint:e,result:!0}),!0}let r=t.adoptedStyleSheets;if(Array.isArray(r)&&r.length){let i={budget:yn};try{for(let l of r)if(wn(l,o,i))return bt.set(t,{fingerprint:e,result:!0}),!0}catch{}}{let i=t.querySelectorAll('style,link[rel~="stylesheet"]'),l={budget:yn};for(let c=0;c<i.length&&l.budget>0;c++){let a=i[c],u=null;if(a.tagName,u=a.sheet||null,u&&wn(u,o,l))return bt.set(t,{fingerprint:e,result:!0}),!0}}return t.querySelector('[style*="counter("], [style*="counters("]')?(bt.set(t,{fingerprint:e,result:!0}),!0):(bt.set(t,{fingerprint:e,result:!1}),!1)}var xt=new WeakMap,xn=-1;function cr(t){return(t||"").replace(/"([^"]*)"/g,"$1")}function lr(t){if(!t)return"";let e=[],n=/"([^"]*)"/g,o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):cr(t)}function xe(t,e){let n=t.parentElement,o=n?xt.get(n):null;return o?{get(s,r){let i=e.get(s,r),l=o.get(r);return typeof l=="number"?Math.max(i,l):i},getStack(s,r){let i=e.getStack(s,r);if(!i.length)return i;let l=o.get(r);if(typeof l=="number"){let c=i.slice();return c[c.length-1]=Math.max(c[c.length-1],l),c}return i}}:e}function Se(t,e,n){let o=new Map;function s(c){let a=[];if(!c||c==="none")return a;for(let u of String(c).split(",")){let m=u.trim().split(/\s+/),p=m[0],h=Number.isFinite(Number(m[1]))?Number(m[1]):void 0;p&&a.push({name:p,num:h})}return a}let r=s(e?.counterReset),i=s(e?.counterIncrement);function l(c){if(o.has(c))return o.get(c).slice();let a=n.getStack(t,c);a=a.length?a.slice():[];let u=r.find(p=>p.name===c);if(u){let p=Number.isFinite(u.num)?u.num:0;a=a.length?[...a,p]:[p]}let m=i.find(p=>p.name===c);if(m){let p=Number.isFinite(m.num)?m.num:1;a.length===0&&(a=[0]),a[a.length-1]+=p}return o.set(c,a.slice()),a}return{get(c,a){let u=l(a);return u.length?u[u.length-1]:0},getStack(c,a){return l(a)},__incs:i}}function ur(t,e,n){let o;try{o=getComputedStyle(t,e)}catch{}let s=o?.content;if(!s||s==="none"||s==="normal")return{text:"",incs:[]};let r=xe(t,n),i=Se(t,o,r),l=pn(s)?gn(s,t,i):s;return{text:lr(l),incs:i.__incs||[]}}async function Qt(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;let s=t.ownerDocument||document;if(!ar(s,n))return;let r=S?.session?.__counterEpoch??0;if(xn!==r&&(xt=new WeakMap,n&&(n.__counterCtx=null),xn=r),!n.__counterCtx)try{n.__counterCtx=hn(t.ownerDocument||document)}catch{}let i=n.__counterCtx;for(let c of["::before","::after","::first-letter"])try{let a=lt(t,c);if(!a||a.content==="none"&&a.backgroundImage==="none"&&a.backgroundColor==="transparent"&&(a.borderStyle==="none"||parseFloat(a.borderWidth)===0)&&(!a.transform||a.transform==="none")&&a.display==="inline")continue;if(c==="::first-letter"){let R=getComputedStyle(t);if(!(a.color!==R.color||a.fontSize!==R.fontSize||a.fontWeight!==R.fontWeight))continue;let P=Array.from(e.childNodes).find(Tt=>Tt.nodeType===Node.TEXT_NODE&&Tt.textContent?.trim().length>0);if(!P)continue;let O=P.textContent,st=O.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],te=O.slice(st?.length||0);if(!st||/[\uD800-\uDFFF]/.test(st))continue;let mt=document.createElement("span");mt.textContent=st,mt.dataset.snapdomPseudo="::first-letter";let ee=Ut(a),ne=yt(ee,"span");n.styleMap.set(mt,ne);let Ct=document.createTextNode(te);e.replaceChild(Ct,P),e.insertBefore(mt,Ct);continue}let m=a.content??"",p=m===""||m==="none"||m==="normal",{text:h,incs:y}=ur(t,c,i),f=a.backgroundImage,d=a.backgroundColor,g=a.fontFamily,b=parseInt(a.fontSize)||32,x=parseInt(a.fontWeight)||!1,w=a.color||"#000",C=a.borderStyle,k=parseFloat(a.borderWidth),v=a.transform,E=H(g),$=!p&&h!=="",N=f&&f!=="none",M=d&&d!=="transparent"&&d!=="rgba(0, 0, 0, 0)",I=C&&C!=="none"&&k>0,W=v&&v!=="none";if(!($||N||M||I||W)){if(y&&y.length&&t.parentElement){let R=xt.get(t.parentElement)||new Map;for(let{name:T}of y){if(!T)continue;let P=xe(t,i),rt=Se(t,getComputedStyle(t,c),P).get(t,T);R.set(T,rt)}xt.set(t.parentElement,R)}continue}let F=document.createElement("span");F.dataset.snapdomPseudo=c,F.style.pointerEvents="none";let G=Ut(a),ot=yt(G,"span");if(n.styleMap.set(F,ot),E&&h&&h.length===1){let{dataUrl:R,width:T,height:P}=await rn(h,g,x,b,w),O=document.createElement("img");O.src=R,O.style=`height:${b}px;width:${T/P*b}px;object-fit:contain;`,F.appendChild(O),e.dataset.snapdomHasIcon="true"}else if(h&&h.startsWith("url(")){let R=it(h);if(R?.trim())try{let T=await _(Z(R),{as:"dataURL",useProxy:o.useProxy});if(T?.ok&&typeof T.data=="string"){let P=document.createElement("img");P.src=T.data,P.style=`width:${b}px;height:auto;object-fit:contain;`,F.appendChild(P)}}catch(T){console.error(`[snapdom] Error in pseudo ${c} for`,t,T)}}else!E&&$&&(F.textContent=h);F.style.backgroundImage="none","maskImage"in F.style&&(F.style.maskImage="none"),"webkitMaskImage"in F.style&&(F.style.webkitMaskImage="none");try{F.style.backgroundRepeat=a.backgroundRepeat,F.style.backgroundSize=a.backgroundSize,a.backgroundPositionX&&a.backgroundPositionY?(F.style.backgroundPositionX=a.backgroundPositionX,F.style.backgroundPositionY=a.backgroundPositionY):F.style.backgroundPosition=a.backgroundPosition,F.style.backgroundOrigin=a.backgroundOrigin,F.style.backgroundClip=a.backgroundClip,F.style.backgroundAttachment=a.backgroundAttachment,F.style.backgroundBlendMode=a.backgroundBlendMode}catch{}if(N)try{let R=vt(f),T=await Promise.all(R.map(ct));F.style.backgroundImage=T.join(", ")}catch(R){console.warn(`[snapdom] Failed to inline background-image for ${c}`,R)}M&&(F.style.backgroundColor=d);let dt=F.childNodes.length>0||F.textContent?.trim()!==""||N||M||I||W;if(y&&y.length&&t.parentElement){let R=xt.get(t.parentElement)||new Map,T=xe(t,i),P=Se(t,getComputedStyle(t,c),T);for(let{name:O}of y){if(!O)continue;let rt=P.get(t,O);R.set(O,rt)}xt.set(t.parentElement,R)}if(!dt)continue;c==="::before"?e.insertBefore(F,e.firstChild):e.appendChild(F)}catch(a){console.warn(`[snapdom] Failed to capture ${c} for`,t,a)}let l=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);if(n.nodeMap)for(let c of l){let a=n.nodeMap.get(c);a instanceof Element&&await Qt(a,c,n,o)}else{let c=Array.from(t.children);for(let a=0;a<Math.min(c.length,l.length);a++)await Qt(c[a],l[a],n,o)}}function Cn(t,e){if(!t||!(t instanceof Element))return;let n=t.ownerDocument||document,o=e||n,s=t instanceof SVGSVGElement?[t]:Array.from(t.querySelectorAll("svg"));if(s.length===0)return;let r=/url\(\s*#([^)]+)\)/g,i=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],l=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),c="http://www.w3.org/1999/xlink",a=w=>{if(!w||!w.getAttribute)return null;let C=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(c,"href"):null);if(C)return C;let k=w.attributes;if(!k)return null;for(let v=0;v<k.length;v++){let E=k[v];if(!E||!E.name)continue;if(E.name==="href")return E.value;let $=E.name.indexOf(":");if($!==-1&&E.name.slice($+1)==="href")return E.value}return null},u=new Set(Array.from(t.querySelectorAll("[id]")).map(w=>w.id)),m=new Set,p=!1,h=(w,C=null)=>{if(!w)return;r.lastIndex=0;let k;for(;k=r.exec(w);){p=!0;let v=(k[1]||"").trim();v&&(u.has(v)||(m.add(v),C&&!C.has(v)&&C.add(v)))}},y=w=>{let C=w.querySelectorAll("use");for(let E of C){let $=a(E);if(!$||!$.startsWith("#"))continue;p=!0;let N=$.slice(1).trim();N&&!u.has(N)&&m.add(N)}let v=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let E of v){h(E.getAttribute("style")||"");for(let $ of i)h(E.getAttribute($))}};for(let w of s)y(w);if(!p)return;let f=t.querySelector("svg.inline-defs-container");f||(f=n.createElementNS("http://www.w3.org/2000/svg","svg"),f.classList.add("inline-defs-container"),f.setAttribute("aria-hidden","true"),f.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),t.insertBefore(f,t.firstChild||null));let d=f.querySelector("defs")||null,g=w=>{if(!w||u.has(w))return null;let C=l(w),k=v=>{let E=o.querySelector(v);return E&&!t.contains(E)?E:null};return k(`svg defs > *#${C}`)||k(`svg > symbol#${C}`)||k(`*#${C}`)};if(!m.size)return;let b=new Set(m),x=new Set;for(;b.size;){let w=b.values().next().value;if(b.delete(w),!w||u.has(w)||x.has(w))continue;let C=g(w);if(!C){x.add(w);continue}d||(d=n.createElementNS("http://www.w3.org/2000/svg","defs"),f.appendChild(d));let k=C.cloneNode(!0);k.id||k.setAttribute("id",w),d.appendChild(k),x.add(w),u.add(w);let v=[k,...k.querySelectorAll("*")];for(let E of v){let $=a(E);if($&&$.startsWith("#")){let M=$.slice(1).trim();M&&!u.has(M)&&!x.has(M)&&b.add(M)}let N=E.getAttribute?.("style")||"";N&&h(N,b);for(let M of i){let I=E.getAttribute?.(M);I&&h(I,b)}}}}D();function An(t,e){if(!t||!e)return;let n=t.scrollTop||0;if(!n)return;getComputedStyle(e).position==="static"&&(e.style.position="relative");let o=t.getBoundingClientRect(),s=t.clientHeight,r="data-snap-ph",i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let l=i.currentNode,c=getComputedStyle(l),a=c.position;if(a!=="sticky"&&a!=="-webkit-sticky")continue;let u=kn(c.top),m=kn(c.bottom);if(u==null&&m==null)continue;let p=fr(l,t),h=dr(e,p,r);if(!h)continue;let y=l.getBoundingClientRect(),f=y.width,d=y.height,g=y.left-o.left;if(!(f>0&&d>0)||!Number.isFinite(g))continue;let b=u!=null?u+n:n+(s-d-m);if(!Number.isFinite(b))continue;let x=Number.parseInt(c.zIndex,10),w=Number.isFinite(x),C=w?Math.max(x,1)+1:2,k=w?x-1:0,v=h.cloneNode(!1);v.setAttribute(r,"1"),v.style.position="sticky",v.style.left=`${g}px`,v.style.top=`${b}px`,v.style.width=`${f}px`,v.style.height=`${d}px`,v.style.visibility="hidden",v.style.zIndex=String(k),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",h.parentElement?.insertBefore(v,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${b}px`,h.style.bottom="auto",h.style.zIndex=String(C),h.style.pointerEvents="none"}}function kn(t){if(!t||t==="auto")return null;let e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function fr(t,e){let n=[];for(let o=t;o&&o!==e;){let s=o.parentElement;if(!s)break;n.push(Array.prototype.indexOf.call(s.children,o)),o=s}return n.reverse()}function dr(t,e,n){let o=t;for(let s=0;s<e.length;s++)if(o=mr(o,n)[e[s]],!o)return null;return o instanceof HTMLElement?o:null}function mr(t,e){let n=[],o=t.children;for(let s=0;s<o.length;s++){let r=o[s];r.hasAttribute(e)||n.push(r)}return n}function vn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,s=e.borderStyle,r=e.borderWidth,i=n!=="none"&&parseFloat(o)>0,l=s==="none"||parseFloat(r)===0;i&&l&&(t.style.border=`${o} solid transparent`)}async function Mn(t,e={}){let n={styleMap:S.session.styleMap,styleCache:S.session.styleCache,nodeMap:S.session.nodeMap},o,s="",r="";vn(t);try{Cn(t)}catch(c){console.warn("inlineExternal defs or symbol failed:",c)}try{o=await Nt(t,n,e,t)}catch(c){throw console.warn("deepClone failed:",c),c}try{await Qt(t,o,n,e)}catch(c){console.warn("inlinePseudoElements failed:",c)}await Je(o);try{let c=o.querySelectorAll("style[data-sd]");for(let a of c)r+=a.textContent||"",a.remove()}catch{}let i=de(n.styleMap);s=Array.from(i.entries()).map(([c,a])=>`.${a}{${c}}`).join(""),s=r+s;for(let[c,a]of n.styleMap.entries()){if(c.tagName==="STYLE")continue;if(c.getRootNode&&c.getRootNode()instanceof ShadowRoot){c.setAttribute("style",a.replace(/;/g,"; "));continue}let u=i.get(a);u&&c.classList.add(u);let m=c.style?.backgroundImage,p=c.dataset?.snapdomHasIcon;m&&m!=="none"&&(c.style.backgroundImage=m),p&&(c.style.verticalAlign="middle",c.style.display="inline")}for(let[c,a]of n.nodeMap.entries()){let u=a.scrollLeft,m=a.scrollTop;if((u||m)&&c instanceof HTMLElement){c.style.overflow="hidden",c.style.scrollbarWidth="none",c.style.msOverflowStyle="none";let h=document.createElement("div");for(h.style.transform=`translate(${-u}px, ${-m}px)`,h.style.willChange="transform",h.style.display="inline-block",h.style.width="100%";c.firstChild;)h.appendChild(c.firstChild);c.appendChild(h)}}let l=o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o;if(An(t,l),t===n.nodeMap.get(o)){let c=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,c);let a=ie(c.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=a||""}for(let[c,a]of n.nodeMap.entries())a.tagName==="PRE"&&(c.style.marginTop="0",c.style.marginBlockStart="0");return{clone:o,classCSS:s,styleCache:n.styleCache}}at();function pr(t){let e=parseInt(t.dataset?.snapdomWidth||"",10)||0,n=parseInt(t.dataset?.snapdomHeight||"",10)||0,o=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,r=parseFloat(t.style?.width||"")||0,i=parseFloat(t.style?.height||"")||0,l=e||r||o||t.width||t.naturalWidth||100,c=n||i||s||t.height||t.naturalHeight||100;return{width:l,height:c}}async function En(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async s=>{if(!s.getAttribute("src")){let u=s.currentSrc||s.src||"";u&&s.setAttribute("src",u)}s.removeAttribute("srcset"),s.removeAttribute("sizes");let r=s.src||"";if(!r)return;let i=await _(r,{as:"dataURL",useProxy:e.useProxy});if(i.ok&&typeof i.data=="string"&&i.data.startsWith("data:")){s.src=i.data,s.width||(s.width=s.naturalWidth||100),s.height||(s.height=s.naturalHeight||100);return}let{width:l,height:c}=pr(s),{fallbackURL:a}=e||{};if(a)try{let u=typeof a=="function"?await a({width:l,height:c,src:r,element:s}):a;if(u){let m=await _(u,{as:"dataURL",useProxy:e.useProxy});if(m?.ok&&typeof m.data=="string"){s.src=m.data,s.width||(s.width=l),s.height||(s.height=c);return}}}catch{}if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${l}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",s.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${l}px;height:${c}px;visibility:hidden;`,s.replaceWith(u)}};for(let s=0;s<n.length;s+=4){let r=n.slice(s,s+4).map(o);await Promise.allSettled(r)}}Y();async function Jt(t,e,n,o={}){let s=[[t,e]],r=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],i=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],l=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],c=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;s.length;){let[a,u]=s.shift();if(!u)continue;let m=n.get(a)||lt(a);n.has(a)||n.set(a,m);let p=(()=>{let f=m.getPropertyValue("border-image"),d=m.getPropertyValue("border-image-source");return f&&f!=="none"||d&&d!=="none"})();for(let f of l){let d=m.getPropertyValue(f);d&&u.style.setProperty(f,d)}for(let f of r){let d=m.getPropertyValue(f);if(!d||d==="none")continue;let g=vt(d),b=await Promise.all(g.map(x=>ct(x,o)));b.some(x=>x&&x!=="none"&&!/^url\(undefined/.test(x))&&u.style.setProperty(f,b.join(", "))}for(let f of i){let d=m.getPropertyValue(f);!d||d==="initial"||u.style.setProperty(f,d)}if(p)for(let f of c){let d=m.getPropertyValue(f);!d||d==="initial"||u.style.setProperty(f,d)}let h=a.shadowRoot?Array.from(a.shadowRoot.children).filter(f=>f.tagName!=="STYLE"):Array.from(a.children),y=Array.from(u.children).filter(f=>!(f.dataset?.snapdomPseudo||f.tagName==="STYLE"&&f.dataset?.sd));for(let f=0;f<Math.min(h.length,y.length);f++)s.push([h[f],y[f]])}}Y();D();function Fn(t){if(!t)return()=>{};let e=hr(t);if(e<=0)return()=>{};if(!wr(t))return()=>{};let n=getComputedStyle(t),o=Math.round(gr(n)*e+yr(n)),s=t.textContent??"",r=s;if(t.scrollHeight<=o+.5)return()=>{};let i=0,l=s.length,c=-1;for(;i<=l;){let a=i+l>>1;t.textContent=s.slice(0,a)+"\u2026",t.scrollHeight<=o+.5?(c=a,i=a+1):l=a-1}return t.textContent=(c>=0?s.slice(0,c):"")+"\u2026",()=>{t.textContent=r}}function hr(t){let e=getComputedStyle(t),n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();let o=parseInt(n,10);return Number.isFinite(o)&&o>0?o:0}function gr(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 yr(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function wr(t){return t.childElementCount>0?!1:Array.from(t.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var It=[];function $n(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 Nn(...t){let e=t.flat();for(let n of e){let o=$n(n);o&&(It.some(s=>s&&s.name&&o.name&&s.name===o.name)||It.push(o))}}function In(t){return(t&&Array.isArray(t.plugins)?t.plugins:It)||It}async function j(t,e,n){let o=n,s=In(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let l=await i(e,o);typeof l<"u"&&(o=l)}return o}async function Ln(t,e,n){let o=[],s=In(e);for(let r of s){let i=r&&typeof r[t]=="function"?r[t]:null;if(!i)continue;let l=await i(e,n);typeof l<"u"&&o.push(l)}return o}function br(t){let e=[];if(Array.isArray(t))for(let n of t){let o=$n(n);if(!o||!o.name)continue;let s=e.findIndex(r=>r&&r.name===o.name);s>=0&&e.splice(s,1),e.push(o)}for(let n of It)n&&n.name&&!e.some(o=>o.name===n.name)&&e.push(n);return Object.freeze(e)}function Rn(t,e,n=!1){return!t||t.plugins&&!n||(t.plugins=br(e)),t}function Tn(t,e){if(!t||!e||!e.style)return;let n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}let s=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=s.length?s:"none"}catch{}}function xr(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];for(;e.nextNode();)n.push(e.currentNode);for(let o of n)o.remove()}function Sr(t,e={}){let{stripFrameworkDirectives:n=!0}=e,o=new Set(["xml","xlink"]),s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;s.nextNode();){let r=s.currentNode;for(let i of Array.from(r.attributes)){let l=i.name;if(l.includes("@")){r.removeAttribute(l);continue}if(l.includes(":")){let c=l.split(":",1)[0];if(!o.has(c)){r.removeAttribute(l);continue}}if(n&&(l.startsWith("x-")||l.startsWith("v-")||l.startsWith(":")||l.startsWith("on:")||l.startsWith("bind:")||l.startsWith("let:")||l.startsWith("class:"))){r.removeAttribute(l);continue}}}}function Pn(t,e={}){t&&(Sr(t,e),xr(t))}function Cr(t){try{let e=t.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(e)}catch{return!1}}function kr(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Ar(t,e){if(!(t instanceof Element)||Cr(t)||kr(t))return!1;let n=e.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let o=e.display||"";return!(o.includes("flex")||o.includes("grid")||o.startsWith("table")||e.transform&&e.transform!=="none")}function _n(t,e,n=new Map){function o(s,r){if(!(s instanceof Element)||!(r instanceof Element))return;let i=s.childElementCount>r.childElementCount,l=n.get(s)||getComputedStyle(s);if(n.has(s)||n.set(s,l),i&&Ar(s,l)){r.style.height||(r.style.height="auto"),r.style.width||(r.style.width="auto"),r.style.removeProperty("block-size"),r.style.removeProperty("inline-size"),r.style.minHeight||(r.style.minHeight="0"),r.style.minWidth||(r.style.minWidth="0"),r.style.maxHeight||(r.style.maxHeight="none"),r.style.maxWidth||(r.style.maxWidth="none");let u=l.overflowY||l.overflowBlock||"visible",m=l.overflowX||l.overflowInline||"visible";(u!=="visible"||m!=="visible")&&(r.style.overflow="visible")}let c=Array.from(s.children),a=Array.from(r.children);for(let u=0;u<Math.min(c.length,a.length);u++)o(c[u],a[u])}o(t,e)}function vr(t){let e=getComputedStyle(t);return!(e.display==="none"||e.position==="absolute"||e.position==="fixed"||e.position==="sticky"||(e.cssFloat||e.float||"none")!=="none"||e.transform&&e.transform!=="none")}function Mr(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{}return!1}function Wn(t,e){let n=getComputedStyle(t),o=t.getBoundingClientRect(),s=1/0,r=-1/0,i=!1,l=Array.from(t.children);for(let h of l){if(Mr(h,e)||!vr(h))continue;let y=h.getBoundingClientRect(),f=y.top-o.top,d=y.bottom-o.top;d<=f||(f<s&&(s=f),d>r&&(r=d),i=!0)}let c=i?Math.max(0,r-s):0,a=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,m=parseFloat(n.paddingTop)||0,p=parseFloat(n.paddingBottom)||0;return a+u+m+p+c}var A=(t,e=3)=>Number.isFinite(t)?Math.round(t*10**e)/10**e:t;function On(t){let e=t.boxShadow||"";if(!e||e==="none")return{top:0,right:0,bottom:0,left:0};let n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(l=>l.trim()),o=0,s=0,r=0,i=0;for(let l of n){let c=l.match(/-?\d+(\.\d+)?px/g)?.map(f=>parseFloat(f))||[];if(c.length<2)continue;let[a,u,m=0,p=0]=c,h=Math.abs(a)+m+p,y=Math.abs(u)+m+p;s=Math.max(s,h+Math.max(a,0)),i=Math.max(i,h+Math.max(-a,0)),r=Math.max(r,y+Math.max(u,0)),o=Math.max(o,y+Math.max(-u,0))}return{top:Math.ceil(o),right:Math.ceil(s),bottom:Math.ceil(r),left:Math.ceil(i)}}function Un(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 Bn(t){if((t.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}function Dn(t){let e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||e==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],o=0,s=0,r=0,i=0,l=!1;for(let c of n){l=!0;let a=c.match(/-?\d+(?:\.\d+)?px/gi)?.map(f=>parseFloat(f))||[],[u=0,m=0,p=0]=a,h=Math.abs(u)+p,y=Math.abs(m)+p;s=Math.max(s,h+Math.max(u,0)),i=Math.max(i,h+Math.max(-u,0)),r=Math.max(r,y+Math.max(m,0)),o=Math.max(o,y+Math.max(-m,0))}return{bleed:{top:A(o),right:A(s),bottom:A(r),left:A(i)},has:l}}function Hn(t,e){if(!t||!e||!e.style)return null;let n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}let o=n.transform||"none";if(!o||o==="none")try{let r=Xn(t);if(r.a===1&&r.b===0&&r.c===0&&r.d===1)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let s=o.match(/^matrix\(\s*([^)]+)\)$/i);if(s){let r=s[1].split(",").map(i=>parseFloat(i.trim()));if(r.length===6&&r.every(Number.isFinite)){let[i,l,c,a]=r,u=Math.sqrt(i*i+l*l)||0,m=0,p=0,h=0,y=0,f=0,d=0;u>0&&(m=i/u,p=l/u,h=m*c+p*a,y=c-m*h,f=a-p*h,d=Math.sqrt(y*y+f*f)||0,d>0?h=h/d:h=0);let g=u,b=0,x=h*d,w=d;try{e.style.transform=`matrix(${g}, ${b}, ${x}, ${w}, 0, 0)`}catch{}return{a:g,b,c:x,d:w}}}try{let r=String(o).trim();return e.style.transform=r+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function ke(t,e,n,o,s){let r=n.a,i=n.b,l=n.c,c=n.d,a=n.e||0,u=n.f||0;function m(g,b){let x=g-o,w=b-s,C=r*x+l*w,k=i*x+c*w;return C+=o+a,k+=s+u,[C,k]}let p=[m(0,0),m(t,0),m(0,e),m(t,e)],h=1/0,y=1/0,f=-1/0,d=-1/0;for(let[g,b]of p)g<h&&(h=g),b<y&&(y=b),g>f&&(f=g),b>d&&(d=b);return{minX:h,minY:y,maxX:f,maxY:d,width:f-h,height:d-y}}function qn(t,e,n){let o=(t.transformOrigin||"0 0").trim().split(/\s+/),[s,r]=[o[0]||"0",o[1]||"0"],i=(l,c)=>{let a=l.toLowerCase();return a==="left"||a==="top"?0:a==="center"?c/2:a==="right"||a==="bottom"?c:a.endsWith("px")?parseFloat(a)||0:a.endsWith("%")?(parseFloat(a)||0)*c/100:/^-?\d+(\.\d+)?$/.test(a)&&parseFloat(a)||0};return{ox:i(s,e),oy:i(r,n)}}function zn(t){let e={rotate:"0deg",scale:null,translate:null},n=typeof t.computedStyleMap=="function"?t.computedStyleMap():null;if(n){let s=c=>{try{return typeof n.has=="function"&&!n.has(c)||typeof n.get!="function"?null:n.get(c)}catch{return null}},r=s("rotate");if(r)if(r.angle){let c=r.angle;e.rotate=c.unit==="rad"?c.value*180/Math.PI+"deg":c.value+c.unit}else r.unit?e.rotate=r.unit==="rad"?r.value*180/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{let c=getComputedStyle(t);e.rotate=c.rotate&&c.rotate!=="none"?c.rotate:"0deg"}let i=s("scale");if(i){let c="x"in i&&i.x?.value!=null?i.x.value:Array.isArray(i)?i[0]?.value:Number(i)||1,a="y"in i&&i.y?.value!=null?i.y.value:Array.isArray(i)?i[1]?.value:c;e.scale=`${c} ${a}`}else{let c=getComputedStyle(t);e.scale=c.scale&&c.scale!=="none"?c.scale:null}let l=s("translate");if(l){let c="x"in l&&"value"in l.x?l.x.value:Array.isArray(l)?l[0]?.value:0,a="y"in l&&"value"in l.y?l.y.value:Array.isArray(l)?l[1]?.value:0,u="x"in l&&l.x?.unit?l.x.unit:"px",m="y"in l&&l.y?.unit?l.y.unit:"px";e.translate=`${c}${u} ${a}${m}`}else{let c=getComputedStyle(t);e.translate=c.translate&&c.translate!=="none"?c.translate:null}return e}let o=getComputedStyle(t);return e.rotate=o.rotate&&o.rotate!=="none"?o.rotate:"0deg",e.scale=o.scale&&o.scale!=="none"?o.scale:null,e.translate=o.translate&&o.translate!=="none"?o.translate:null,e}var Ce=null;function Er(){if(Ce)return Ce;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),Ce=t,t}function jn(t){let e=Er(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform),t.rotate&&(n.style.rotate=t.rotate),t.scale&&(n.style.scale=t.scale),t.translate&&(n.style.translate=t.translate),e.appendChild(n);let o=Xn(n);return e.removeChild(n),o}function Vn(t){let e=getComputedStyle(t),n=e.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let s=e.rotate&&e.rotate!=="none"&&e.rotate!=="0deg",r=e.scale&&e.scale!=="none"&&e.scale!=="1",i=e.translate&&e.translate!=="none"&&e.translate!=="0px 0px";return!!(s||r||i)}function Xn(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}async function Ae(t,e){if(!t)throw new Error("Element cannot be null or undefined");_t(e.cache);let n=e.fast,o=e.outerTransforms!==!1,s=!!e.outerShadows,r={element:t,options:e,plugins:e.plugins},i,l,c,a="",u="",m,p,h=null;await j("beforeSnap",r),await j("beforeClone",r);let y=Fn(r.element);try{({clone:i,classCSS:l,styleCache:c}=await Mn(r.element,r.options)),!o&&i&&(h=Hn(r.element,i)),!s&&i&&Tn(r.element,i)}finally{y()}if(r={clone:i,classCSS:l,styleCache:c,...r},await j("afterClone",r),Pn(r.clone),r.options?.excludeMode==="remove")try{_n(r.element,r.clone,r.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await en(r.clone,r.element)}catch{}await new Promise(b=>{X(async()=>{await En(r.clone,r.options),b()},{fast:n})}),await new Promise(b=>{X(async()=>{await Jt(r.element,r.clone,r.styleCache,r.options),b()},{fast:n})}),e.embedFonts&&await new Promise(b=>{X(async()=>{let x=Yt(r.element),w=Kt(r.element);if(U()){let C=new Set(Array.from(x).map(k=>String(k).split("__")[0]).filter(Boolean));await Gt(C,1)}a=await Xt({required:x,usedCodepoints:w,preCached:!1,exclude:r.options.excludeFonts,useProxy:r.options.useProxy}),b()},{fast:n})});let f=ue(r.clone).sort(),d=f.join(",");S.baseStyle.has(d)?u=S.baseStyle.get(d):await new Promise(b=>{X(()=>{u=fe(f),S.baseStyle.set(d,u),b()},{fast:n})}),r={fontsCSS:a,baseCSS:u,...r},await j("beforeRender",r),await new Promise(b=>{X(()=>{let x=getComputedStyle(r.element),w=r.element.getBoundingClientRect(),C=Math.max(1,A(r.element.offsetWidth||parseFloat(x.width)||w.width||1)),k=Math.max(1,A(r.element.offsetHeight||parseFloat(x.height)||w.height||1));if(r.options?.excludeMode==="remove"){let z=Wn(r.element,r.options);Number.isFinite(z)&&z>0&&(k=Math.max(1,Math.min(k,A(z+1))))}let v=(z,V=NaN)=>{let ht=typeof z=="string"?parseFloat(z):z;return Number.isFinite(ht)?ht:V},E=v(r.options.width),$=v(r.options.height),N=C,M=k,I=Number.isFinite(E),W=Number.isFinite($),q=k>0?C/k:1;I&&W?(N=Math.max(1,A(E)),M=Math.max(1,A($))):I?(N=Math.max(1,A(E)),M=Math.max(1,A(N/(q||1)))):W?(M=Math.max(1,A($)),N=Math.max(1,A(M*(q||1)))):(N=C,M=k);let F=0,G=0,ot=C,ft=k;if(!o&&h&&Number.isFinite(h.a)){let z={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},V=ke(C,k,z,0,0);F=A(V.minX),G=A(V.minY),ot=A(V.maxX),ft=A(V.maxY)}else if(o&&Fr(r.element)){let V=x.transform&&x.transform!=="none"?x.transform:"",ht=zn(r.element),se=jn({baseTransform:V,rotate:ht.rotate||"0deg",scale:ht.scale,translate:ht.translate}),{ox:so,oy:io}=qn(x,C,k),ao=se.is2D?se:new DOMMatrix(se.toString()),Pt=ke(C,k,ao,so,io);F=A(Pt.minX),G=A(Pt.minY),ot=A(Pt.maxX),ft=A(Pt.maxY)}let dt=On(x),R=Un(x),T=Bn(x),P=Dn(x),O=s?{top:A(dt.top+R.top+T.top+P.bleed.top),right:A(dt.right+R.right+T.right+P.bleed.right),bottom:A(dt.bottom+R.bottom+T.bottom+P.bleed.bottom),left:A(dt.left+R.left+T.left+P.bleed.left)}:{top:0,right:0,bottom:0,left:0};F=A(F-O.left),G=A(G-O.top),ot=A(ot+O.right),ft=A(ft+O.bottom);let rt=Math.max(1,A(ot-F)),st=Math.max(1,A(ft-G)),te=I||W?A(N/C):1,mt=W||I?A(M/k):1,ee=Math.max(1,A(rt*te)),ne=Math.max(1,A(st*mt)),Ct="http://www.w3.org/2000/svg",Tt=U()?1:0,Q=A(Tt+(o?0:1)),J=document.createElementNS(Ct,"foreignObject"),Zn=A(F),to=A(G);J.setAttribute("x",String(A(-(Zn-Q)))),J.setAttribute("y",String(A(-(to-Q)))),J.setAttribute("width",String(A(C+Q*2))),J.setAttribute("height",String(A(k+Q*2))),J.style.overflow="visible";let Ne=document.createElement("style");Ne.textContent=r.baseCSS+r.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r.classCSS,J.appendChild(Ne);let pt=document.createElement("div");pt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),pt.style.width=`${A(C)}px`,pt.style.height=`${A(k)}px`,pt.style.overflow="visible",pt.appendChild(r.clone),J.appendChild(pt);let eo=new XMLSerializer().serializeToString(J),oe=A(rt+Q*2),re=A(st+Q*2),Ie=I||W;e.meta={w0:C,h0:k,vbW:oe,vbH:re,targetW:N,targetH:M};let no=U()&&Ie?oe:A(ee+Q*2),oo=U()&&Ie?re:A(ne+Q*2),ro=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;p=`<svg xmlns="${Ct}" width="${no}" height="${oo}" viewBox="0 0 ${oe} ${re}" font-size="${ro}px">`+eo+"</svg>",m=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(p)}`,r={svgString:p,dataURL:m,...r},b()},{fast:n})}),await j("afterRender",r);let g=document.getElementById("snapdom-sandbox");return g&&g.style.position==="absolute"&&g.remove(),r.dataURL}function Fr(t){return Vn(t)}function $r(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Yn(t={}){let e=t.format??"png";e==="jpg"&&(e="jpeg");let n=$r(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,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}}Bt();Y();at();D();async function Nr(t=document,e={}){let{embedFonts:n=!0,useProxy:o=""}=e,s=e.cache??e.cacheOpt??"full";_t(s);try{await document.fonts?.ready}catch{}try{ce()}catch{}S.session=S.session||{},S.session.styleCache||(S.session.styleCache=new WeakMap),S.image=S.image||new Map,S.background=S.background||new Map;try{await Jt(t,void 0,S.session.styleCache,{useProxy:o})}catch{}let r=[],i=[];try{if(t&&t.nodeType===1){let c=t.querySelectorAll?Array.from(t.querySelectorAll("*")):[];i=[t,...c],r=[],t.tagName==="IMG"&&t.getAttribute("src")&&r.push(t),r.push(...Array.from(t.querySelectorAll?.("img[src]")||[]))}else t?.querySelectorAll&&(r=Array.from(t.querySelectorAll("img[src]")),i=Array.from(t.querySelectorAll("*")))}catch{}let l=[];for(let c of r){let a=c?.currentSrc||c?.src;if(a&&!S.image.has(a)){let u=Promise.resolve().then(async()=>{let m=await _(a,{as:"dataURL",useProxy:o});m?.ok&&typeof m.data=="string"&&S.image.set(a,m.data)}).catch(()=>{});l.push(u)}}for(let c of i){let a="";try{a=c?.style?.backgroundImage||"",(!a||a==="none")&&(a=lt(c).backgroundImage)}catch{}if(a&&a!=="none"){let u=a.match(/url\((?:[^()"']+|"(?:[^"]*)"|'(?:[^']*)')\)/gi)||[];for(let m of u){let p=Promise.resolve().then(()=>ct(m,{...e,useProxy:o})).catch(()=>{});l.push(p)}}}if(n)try{let c=Yt(t),a=Kt(t);if(typeof U=="function"?U():!!U){let m=new Set(Array.from(c).map(p=>String(p).split("__")[0]).filter(Boolean));await Gt(m,3)}await Xt({required:c,usedCodepoints:a,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??o})}catch{}await Promise.allSettled(l)}function Dr(...t){return Nn(...t),L}var L=Object.assign(Hr,{plugins:Dr}),Jn=Symbol("snapdom.internal"),nt=Symbol("snapdom.internal.silent"),$e=!1;async function Hr(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Yn(e);if(Rn(n,e&&e.plugins),U()&&(n.embedFonts===!0||zr(t)))for(let o=0;o<3;o++)try{await qr(t,e),$e=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&tn(n.iconFonts),n.snap||(n.snap={toPng:(o,s)=>L.toPng(o,s),toSvg:(o,s)=>L.toSvg(o,s)}),L.capture(t,n,Jn)}L.capture=async(t,e,n)=>{if(n!==Jn)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Ae(t,e),s={img:async(f,d)=>{let{toImg:g}=await Promise.resolve().then(()=>(Rt(),Lt));return g(o,{...f,...d||{}})},svg:async(f,d)=>{let{toSvg:g}=await Promise.resolve().then(()=>(Rt(),Lt));return g(o,{...f,...d||{}})},canvas:async(f,d)=>{let{toCanvas:g}=await Promise.resolve().then(()=>(St(),ve));return g(o,{...f,...d||{}})},blob:async(f,d)=>{let{toBlob:g}=await Promise.resolve().then(()=>(Zt(),Fe));return g(o,{...f,...d||{}})},png:async(f,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(K(),et));return g(o,{...f,...d||{},format:"png"})},jpeg:async(f,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(K(),et));return g(o,{...f,...d||{},format:"jpeg"})},webp:async(f,d)=>{let{rasterize:g}=await Promise.resolve().then(()=>(K(),et));return g(o,{...f,...d||{},format:"webp"})},download:async(f,d)=>{let{download:g}=await Promise.resolve().then(()=>(Qn(),Gn));return g(o,{...f,...d||{}})}},i={...e,export:{url:o},exports:{svg:async f=>{let{toSvg:d}=await Promise.resolve().then(()=>(Rt(),Lt));return d(o,{...e,...f||{},[nt]:!0})},canvas:async f=>{let{toCanvas:d}=await Promise.resolve().then(()=>(St(),ve));return d(o,{...e,...f||{},[nt]:!0})},png:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),et));return d(o,{...e,...f||{},format:"png",[nt]:!0})},jpeg:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),et));return d(o,{...e,...f||{},format:"jpeg",[nt]:!0})},jpg:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),et));return d(o,{...e,...f||{},format:"jpeg",[nt]:!0})},webp:async f=>{let{rasterize:d}=await Promise.resolve().then(()=>(K(),et));return d(o,{...e,...f||{},format:"webp",[nt]:!0})},blob:async f=>{let{toBlob:d}=await Promise.resolve().then(()=>(Zt(),Fe));return d(o,{...e,...f||{},[nt]:!0})},img:async f=>{let{toImg:d}=await Promise.resolve().then(()=>(Rt(),Lt));return d(o,{...e,...f||{},[nt]:!0})}}},l=await Ln("defineExports",i),c=Object.assign({},...l.filter(f=>f&&typeof f=="object")),a={...s,...c};a.jpeg&&!a.jpg&&(a.jpg=(f,d)=>a.jpeg(f,d));function u(f,d){let g={...e,...d||{}};return(f==="jpeg"||f==="jpg")&&(g.backgroundColor==null||g.backgroundColor==="transparent")&&(g.backgroundColor="#ffffff"),g}let m=!1,p=Promise.resolve();async function h(f,d){let g=async()=>{let b=a[f];if(!b)throw new Error(`[snapdom] Unknown export type: ${f}`);let x=u(f,d),w={...e,export:{type:f,options:x,url:o}};await j("beforeExport",w);let C=await b(w,x);return await j("afterExport",w,C),m||(m=!0,await j("afterSnap",e)),C};return p=p.then(g)}let y={url:o,toRaw:()=>o,to:(f,d)=>h(f,d),toImg:f=>h("img",f),toSvg:f=>h("svg",f),toCanvas:f=>h("canvas",f),toBlob:f=>h("blob",f),toPng:f=>h("png",f),toJpg:f=>h("jpg",f),toWebp:f=>h("webp",f),download:f=>h("download",f)};for(let f of Object.keys(a)){let d="to"+f.charAt(0).toUpperCase()+f.slice(1);y[d]||(y[d]=g=>h(f,g))}return y};L.toRaw=(t,e)=>L(t,e).then(n=>n.toRaw());L.toImg=(t,e)=>L(t,e).then(n=>n.toImg());L.toSvg=(t,e)=>L(t,e).then(n=>n.toSvg());L.toCanvas=(t,e)=>L(t,e).then(n=>n.toCanvas());L.toBlob=(t,e)=>L(t,e).then(n=>n.toBlob());L.toPng=(t,e)=>L(t,{...e,format:"png"}).then(n=>n.toPng());L.toJpg=(t,e)=>L(t,{...e,format:"jpeg"}).then(n=>n.toJpg());L.toWebp=(t,e)=>L(t,{...e,format:"webp"}).then(n=>n.toWebp());L.download=(t,e)=>L(t,e).then(n=>n.download());async function qr(t,e){if($e)return;let n={...e,fast:!0,embedFonts:!0,scale:.2},o;try{o=await Ae(t,n)}catch{}await new Promise(s=>requestAnimationFrame(()=>requestAnimationFrame(s))),o&&await new Promise(s=>{let r=new Image;try{r.decoding="sync",r.loading="eager"}catch{}r.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",r.src=o,document.body.appendChild(r),(async()=>{try{typeof r.decode=="function"&&await r.decode()}catch{}let i=performance.now();for(;!(r.complete&&r.naturalWidth>0)&&performance.now()-i<900;)await new Promise(l=>setTimeout(l,200));await new Promise(l=>requestAnimationFrame(l));try{r.remove()}catch{}s()})()}),t.querySelectorAll("canvas").forEach(s=>{try{let r=s.getContext("2d",{willReadFrequently:!0});r&&r.getImageData(0,0,1,1)}catch{}}),$e=!0}function zr(t){let e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){let n=e.currentNode,o=getComputedStyle(n),s=o.backgroundImage&&o.backgroundImage!=="none",r=o.maskImage&&o.maskImage!=="none"||o.webkitMaskImage&&o.webkitMaskImage!=="none";if(s||r||n.tagName==="CANVAS")return!0}return!1}export{Nr as preCache,L as snapdom};
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
1
  {
2
2
  "name": "@zumer/snapdom",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "snapDOM captures HTML elements to images with exceptional speed and accuracy.",
5
5
  "type": "module",
6
6
  "main": "./dist/snapdom.js",
7
- "module": "./dist/modules/snapdom.js",
7
+ "module": "./dist/snapdom.mjs",
8
8
  "types": "./types/snapdom.d.ts",
9
9
  "sideEffects": false,
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./types/snapdom.d.ts",
13
- "import": "./dist/modules/snapdom.js",
13
+ "import": "./dist/snapdom.mjs",
14
14
  "require": "./dist/snapdom.js",
15
15
  "default": "./dist/snapdom.mjs"
16
16
  },
17
17
  "./preCache": {
18
- "import": "./dist/modules/preCache.js"
18
+ "import": "./dist/preCache.mjs"
19
19
  },
20
20
  "./plugins": {
21
- "import": "./dist/modules/plugins.js"
21
+ "import": "./dist/plugins.mjs"
22
22
  }
23
23
  },
24
24
  "files": [