@zumer/snapdom 1.9.10 → 1.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -480,6 +480,7 @@ For detailed contribution guidelines, please see [CONTRIBUTING](https://github.c
480
480
  <!-- CONTRIBUTORS:START -->
481
481
  <p>
482
482
  <a href="https://github.com/tinchox5" title="tinchox5"><img src="https://avatars.githubusercontent.com/u/11557901?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="tinchox5"/></a>
483
+ <a href="https://github.com/Jarvis2018" title="Jarvis2018"><img src="https://avatars.githubusercontent.com/u/36788851?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="Jarvis2018"/></a>
483
484
  <a href="https://github.com/tarwin" title="tarwin"><img src="https://avatars.githubusercontent.com/u/646149?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="tarwin"/></a>
484
485
  <a href="https://github.com/17biubiu" title="17biubiu"><img src="https://avatars.githubusercontent.com/u/13295895?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="17biubiu"/></a>
485
486
  <a href="https://github.com/av01d" title="av01d"><img src="https://avatars.githubusercontent.com/u/6247646?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="av01d"/></a>
@@ -492,6 +493,7 @@ For detailed contribution guidelines, please see [CONTRIBUTING](https://github.c
492
493
  <a href="https://github.com/simon1uo" title="simon1uo"><img src="https://avatars.githubusercontent.com/u/60037549?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="simon1uo"/></a>
493
494
  <a href="https://github.com/titoBouzout" title="titoBouzout"><img src="https://avatars.githubusercontent.com/u/64156?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="titoBouzout"/></a>
494
495
  <a href="https://github.com/jhbae200" title="jhbae200"><img src="https://avatars.githubusercontent.com/u/20170610?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="jhbae200"/></a>
496
+ <a href="https://github.com/xiaobai-web715" title="xiaobai-web715"><img src="https://avatars.githubusercontent.com/u/81091224?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="xiaobai-web715"/></a>
495
497
  <a href="https://github.com/miusuncle" title="miusuncle"><img src="https://avatars.githubusercontent.com/u/7549857?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="miusuncle"/></a>
496
498
  <a href="https://github.com/rbbydotdev" title="rbbydotdev"><img src="https://avatars.githubusercontent.com/u/101137670?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="rbbydotdev"/></a>
497
499
  <a href="https://github.com/zhanghaotian2018" title="zhanghaotian2018"><img src="https://avatars.githubusercontent.com/u/169218899?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="zhanghaotian2018"/></a>
package/dist/snapdom.js CHANGED
@@ -721,22 +721,14 @@
721
721
  return Promise.all(childList.map((child) => {
722
722
  return new Promise((resolve) => {
723
723
  function deal() {
724
- idle(
725
- (deadline) => {
726
- if (deadline instanceof IdleDeadline) {
727
- if (deadline.timeRemaining()) {
728
- callback(child, resolve);
729
- } else {
730
- deal();
731
- }
732
- } else {
733
- callback(child, resolve);
734
- }
735
- },
736
- {
737
- fast
724
+ idle((deadline) => {
725
+ const hasIdleBudget = deadline && typeof deadline.timeRemaining === "function" ? deadline.timeRemaining() > 0 : true;
726
+ if (hasIdleBudget) {
727
+ callback(child, resolve);
728
+ } else {
729
+ deal();
738
730
  }
739
- );
731
+ }, { fast });
740
732
  }
741
733
  deal();
742
734
  });
@@ -1843,7 +1835,7 @@
1843
1835
  }
1844
1836
  return used;
1845
1837
  }
1846
- function ensureFontsReady(families, warmupRepetitions = 1) {
1838
+ function ensureFontsReady(families, warmupRepetitions = 2) {
1847
1839
  return __async(this, null, function* () {
1848
1840
  try {
1849
1841
  yield document.fonts.ready;
@@ -2488,7 +2480,7 @@
2488
2480
  const families = new Set(
2489
2481
  Array.from(required).map((k) => String(k).split("__")[0]).filter(Boolean)
2490
2482
  );
2491
- yield ensureFontsReady(families, 2);
2483
+ yield ensureFontsReady(families, 5);
2492
2484
  }
2493
2485
  fontsCSS = yield embedCustomFonts({
2494
2486
  required,
@@ -1,5 +1,5 @@
1
- (()=>{var Fe=Object.defineProperty,Le=Object.defineProperties;var Re=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable;var ae=(t,e,n)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,V=(t,e)=>{for(var n in e||(e={}))Te.call(e,n)&&ae(t,n,e[n]);if(re)for(var n of re(e))Ne.call(e,n)&&ae(t,n,e[n]);return t},J=(t,e)=>Le(t,Re(e));var $=(t,e,n)=>new Promise((o,r)=>{var a=i=>{try{c(n.next(i))}catch(f){r(f)}},s=i=>{try{c(n.throw(i))}catch(f){r(f)}},c=i=>i.done?o(i.value):Promise.resolve(i.value).then(a,s);c((n=n.apply(t,e)).next())});var m={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 Mt(t="soft"){switch(t){case"auto":{m.session.styleMap=new Map,m.session.nodeMap=new Map;return}case"soft":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap,m.computedStyle=new WeakMap,m.baseStyle=new Map,m.defaultStyle=new Map,m.image=new Map,m.background=new Map,m.resource=new Map,m.font=new Set;return}default:{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}}}function ut(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Bt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(a=>a.trim());return r.length!==6?`matrix(${o})`:(r[4]="0",r[5]="0",`matrix(${r.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(a=>a.trim());return r.length!==16?`matrix3d(${o})`:(r[12]="0",r[13]="0",`matrix3d(${r.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function xt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch(e){return t}}function Ie(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function a(s,c,i){if(r>=n)return;let f=Date.now();(o.get(c)||0)>f||(o.set(c,f+e),r++,s==="warn"&&console&&console.warn?console.warn(`${t} ${i}`):console&&console.error&&console.error(`${t} ${i}`))}return{warnOnce(s,c){a("warn",s,c)},errorOnce(s,c){a("error",s,c)},reset(){o.clear(),r=0}}}var se=Ie("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Dt=new Map,vt=new Map;function Pe(t){return/^data:|^blob:|^about:blank$/.test(t)}function _e(t,e){if(!e||Pe(t))return!1;try{let n=typeof location!="undefined"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location!="undefined"?o.origin!==location.origin:!0}catch(n){return!!e}}function Ue(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{url}",encodeURIComponent(t));let n=e.endsWith("?")?"":e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function We(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 Oe(t,e){var n,o;return[e.as||"blob",(n=e.timeout)!=null?n:3e3,e.useProxy||"",(o=e.errorTTL)!=null?o:8e3,t].join("|")}function z(n){return $(this,arguments,function*(t,e={}){var b,F,U;let o=(b=e.as)!=null?b:"blob",r=(F=e.timeout)!=null?F:3e3,a=e.useProxy||"",s=(U=e.errorTTL)!=null?U:8e3,c=e.headers||{},i=!!e.silent,f=Oe(t,{as:o,timeout:r,useProxy:a,errorTTL:s}),l=vt.get(f);if(l&&l.until>Date.now())return J(V({},l.result),{fromCache:!0});l&&vt.delete(f);let d=Dt.get(f);if(d)return d;let S=_e(t,a)?Ue(t,a):t,x=e.credentials;if(!x)try{let T=typeof location!="undefined"&&location.href?location.href:"http://localhost/",E=new URL(t,T);x=typeof location!="undefined"&&E.origin===location.origin?"include":"omit"}catch(T){x="omit"}let M=new AbortController,u=setTimeout(()=>M.abort("timeout"),r),g=$(null,null,function*(){var T,E;try{let k=yield fetch(S,{signal:M.signal,credentials:x,headers:c});if(!k.ok){let I={ok:!1,data:null,status:k.status,url:S,fromCache:!1,reason:"http_error"};if(vt.set(f,{until:Date.now()+s,result:I}),!i){let q=`${k.status} ${k.statusText||""}`.trim();se.warnOnce(`http:${k.status}:${o}:${new URL(t,(T=location==null?void 0:location.href)!=null?T:"http://localhost/").origin}`,`HTTP error ${q} while fetching ${o} ${t}`)}return e.onError&&e.onError(I),I}if(o==="text")return{ok:!0,data:yield k.text(),status:k.status,url:S,fromCache:!1};let _=yield k.blob(),N=_.type||k.headers.get("content-type")||"";return o==="dataURL"?{ok:!0,data:yield We(_),status:k.status,url:S,fromCache:!1,mime:N}:{ok:!0,data:_,status:k.status,url:S,fromCache:!1,mime:N}}catch(k){let _=k&&typeof k=="object"&&"name"in k&&k.name==="AbortError"?String(k.message||"").includes("timeout")?"timeout":"abort":"network",N={ok:!1,data:null,status:0,url:S,fromCache:!1,reason:_};if(vt.set(f,{until:Date.now()+s,result:N}),!i){let I=`${_}:${o}:${new URL(t,(E=location==null?void 0:location.href)!=null?E:"http://localhost/").origin}`,q=_==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:_==="abort"?`Request aborted while fetching ${o} ${t}`:`Network/CORS issue while fetching ${o} ${t}. A proxy may be required`;se.errorOnce(I,q)}return e.onError&&e.onError(N),N}finally{clearTimeout(u),Dt.delete(f)}});return Dt.set(f,g),g})}function dt(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}function ht(n){return $(this,arguments,function*(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=ut(t);if(!r)return t;let a=xt(r);if(m.background.has(a)){let s=m.background.get(a);return s?`url("${s}")`:"none"}try{let s=yield z(a,{as:"dataURL",useProxy:e.useProxy});return s.ok?(m.background.set(a,s.data),`url("${s.data}")`):(m.background.set(a,null),"none")}catch(s){return m.background.set(a,null),"none"}})}var Ft=new Set(["meta","script","noscript","title","link","template"]),wt=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"]),Be=["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"];function qt(){for(let t of Be){let e=String(t).toLowerCase();Ft.has(e)||wt.has(e)||jt(e)}}function jt(t){if(t=String(t).toLowerCase(),wt.has(t)){let a={};return m.defaultStyle.set(t,a),a}if(m.defaultStyle.has(t))return m.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),r={};for(let a of o){if(ie(a))continue;let s=o.getPropertyValue(a);r[a]=s}return e.removeChild(n),m.defaultStyle.set(t,r),r}var De=/(?:^|-)(animation|transition)(?:-|$)/i,qe=/^(--|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,je=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 ie(t){let e=String(t).toLowerCase();return!!(je.has(e)||qe.test(e)||De.test(e))}function bt(t,e){if(e=String(e||"").toLowerCase(),wt.has(e))return"";let n=[],o=jt(e);for(let[r,a]of Object.entries(t)){if(ie(r))continue;let s=o[r];a&&a!==s&&n.push(`${r}:${a}`)}return n.sort(),n.join(";")}function Ht(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 zt(t){let e=new Map;for(let o of t){let r=m.defaultStyle.get(o);if(!r)continue;let a=Object.entries(r).map(([s,c])=>`${s}:${c};`).sort().join("");a&&(e.has(a)||e.set(a,[]),e.get(a).push(o))}let n="";for(let[o,r]of e.entries())n+=`${r.join(",")} { ${o} }
2
- `;return n}function Vt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let r of e)n.set(r,`c${o++}`);return n}function mt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=m.computedStyle.get(t);if(n||(n=new Map,m.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Xt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch(n){return e}return e}function Lt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function pt(t){let e=[],n=0,o=0;for(let r=0;r<t.length;r++){let a=t[r];a==="("&&n++,a===")"&&n--,a===","&&n===0&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function st(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function it(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var ce=new WeakMap,Kt=new Map,Gt=0;function Ct(){Gt++}var le=!1;function He(t=document.documentElement){var e,n;if(!le){le=!0;try{new MutationObserver(()=>Ct()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch(o){}try{new MutationObserver(()=>Ct()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch(o){}try{let o=document.fonts;o&&((e=o.addEventListener)==null||e.call(o,"loadingdone",Ct),(n=o.ready)==null||n.then(()=>Ct()).catch(()=>{}))}catch(o){}}}function ze(t){let e={},n=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let r=t[o],a=t.getPropertyValue(r);(r==="background-image"||r==="content")&&a.includes("url(")&&!a.includes("data:")&&(a="none"),e[r]=a}return n==="hidden"&&(e.opacity="0"),e}var fe=new WeakMap;function Ve(t){let e=fe.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]<r[0]?-1:o[0]>r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),fe.set(t,e),e)}function Xe(t,e=null){let n=ce.get(t);if(n&&n.epoch===Gt)return n.snapshot;let o=e||getComputedStyle(t),r=ze(o);return ce.set(t,{epoch:Gt,snapshot:r}),r}function Ke(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Kt,defaultStyle:m.defaultStyle,baseStyle:m.baseStyle,image:m.image,resource:m.resource,background:m.background,font:m.font},options:e||{}}:{session:m.session,persist:{snapshotKeyCache:Kt,defaultStyle:m.defaultStyle,baseStyle:m.baseStyle,image:m.image,resource:m.resource,background:m.background,font:m.font},options:t||e||{}}}function gt(t,e,n,o){return $(this,null,function*(){var S,x,M;if(t.tagName==="STYLE")return;let r=Ke(n,o),a=r.options&&r.options.cache||"auto";if(a!=="disabled"&&He(document.documentElement),a==="disabled"&&!r.session.__bumpedForDisabled&&(Ct(),Kt.clear(),r.session.__bumpedForDisabled=!0),wt.has((S=t.tagName)==null?void 0:S.toLowerCase())){let u=(x=t.getAttribute)==null?void 0:x.call(t,"style");u&&e.setAttribute("style",u)}let{session:s,persist:c}=r;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let i=s.styleCache.get(t),f=Xe(t,i),l=Ve(f),d=c.snapshotKeyCache.get(l);if(!d){let u=((M=t.tagName)==null?void 0:M.toLowerCase())||"div";d=bt(f,u),c.snapshotKeyCache.set(l,d)}s.styleMap.set(e,d)})}function Yt(t,e,n){return Promise.all(t.map(o=>new Promise(r=>{function a(){st(s=>{s instanceof IdleDeadline?s.timeRemaining()?e(o,r):a():e(o,r)},{fast:n})}a()})))}function Ge(t){return t=t.trim(),!t||/\:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Ye(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let r=n?Ge(o):o;return`:where(${e} ${r})`}).join(", ")}function Je(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,r,a)=>{let s=Ye(a,e,!0);return`${o}${r}${s}{`}),t):""}function Ze(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Qe(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
1
+ (()=>{var Fe=Object.defineProperty,Le=Object.defineProperties;var Re=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable;var ae=(t,e,n)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,V=(t,e)=>{for(var n in e||(e={}))Te.call(e,n)&&ae(t,n,e[n]);if(re)for(var n of re(e))Ne.call(e,n)&&ae(t,n,e[n]);return t},J=(t,e)=>Le(t,Re(e));var $=(t,e,n)=>new Promise((o,r)=>{var a=i=>{try{c(n.next(i))}catch(f){r(f)}},s=i=>{try{c(n.throw(i))}catch(f){r(f)}},c=i=>i.done?o(i.value):Promise.resolve(i.value).then(a,s);c((n=n.apply(t,e)).next())});var m={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 Mt(t="soft"){switch(t){case"auto":{m.session.styleMap=new Map,m.session.nodeMap=new Map;return}case"soft":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap,m.computedStyle=new WeakMap,m.baseStyle=new Map,m.defaultStyle=new Map,m.image=new Map,m.background=new Map,m.resource=new Map,m.font=new Set;return}default:{m.session.styleMap=new Map,m.session.nodeMap=new Map,m.session.styleCache=new WeakMap;return}}}function ut(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function Ot(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(a=>a.trim());return r.length!==6?`matrix(${o})`:(r[4]="0",r[5]="0",`matrix(${r.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(a=>a.trim());return r.length!==16?`matrix3d(${o})`:(r[12]="0",r[13]="0",`matrix3d(${r.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function xt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch(e){return t}}function Ie(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function a(s,c,i){if(r>=n)return;let f=Date.now();(o.get(c)||0)>f||(o.set(c,f+e),r++,s==="warn"&&console&&console.warn?console.warn(`${t} ${i}`):console&&console.error&&console.error(`${t} ${i}`))}return{warnOnce(s,c){a("warn",s,c)},errorOnce(s,c){a("error",s,c)},reset(){o.clear(),r=0}}}var se=Ie("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Dt=new Map,vt=new Map;function Pe(t){return/^data:|^blob:|^about:blank$/.test(t)}function _e(t,e){if(!e||Pe(t))return!1;try{let n=typeof location!="undefined"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location!="undefined"?o.origin!==location.origin:!0}catch(n){return!!e}}function Ue(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{url}",encodeURIComponent(t));let n=e.endsWith("?")?"":e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function We(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 Be(t,e){var n,o;return[e.as||"blob",(n=e.timeout)!=null?n:3e3,e.useProxy||"",(o=e.errorTTL)!=null?o:8e3,t].join("|")}function z(n){return $(this,arguments,function*(t,e={}){var b,F,U;let o=(b=e.as)!=null?b:"blob",r=(F=e.timeout)!=null?F:3e3,a=e.useProxy||"",s=(U=e.errorTTL)!=null?U:8e3,c=e.headers||{},i=!!e.silent,f=Be(t,{as:o,timeout:r,useProxy:a,errorTTL:s}),l=vt.get(f);if(l&&l.until>Date.now())return J(V({},l.result),{fromCache:!0});l&&vt.delete(f);let d=Dt.get(f);if(d)return d;let S=_e(t,a)?Ue(t,a):t,x=e.credentials;if(!x)try{let T=typeof location!="undefined"&&location.href?location.href:"http://localhost/",E=new URL(t,T);x=typeof location!="undefined"&&E.origin===location.origin?"include":"omit"}catch(T){x="omit"}let M=new AbortController,u=setTimeout(()=>M.abort("timeout"),r),g=$(null,null,function*(){var T,E;try{let k=yield fetch(S,{signal:M.signal,credentials:x,headers:c});if(!k.ok){let I={ok:!1,data:null,status:k.status,url:S,fromCache:!1,reason:"http_error"};if(vt.set(f,{until:Date.now()+s,result:I}),!i){let q=`${k.status} ${k.statusText||""}`.trim();se.warnOnce(`http:${k.status}:${o}:${new URL(t,(T=location==null?void 0:location.href)!=null?T:"http://localhost/").origin}`,`HTTP error ${q} while fetching ${o} ${t}`)}return e.onError&&e.onError(I),I}if(o==="text")return{ok:!0,data:yield k.text(),status:k.status,url:S,fromCache:!1};let _=yield k.blob(),N=_.type||k.headers.get("content-type")||"";return o==="dataURL"?{ok:!0,data:yield We(_),status:k.status,url:S,fromCache:!1,mime:N}:{ok:!0,data:_,status:k.status,url:S,fromCache:!1,mime:N}}catch(k){let _=k&&typeof k=="object"&&"name"in k&&k.name==="AbortError"?String(k.message||"").includes("timeout")?"timeout":"abort":"network",N={ok:!1,data:null,status:0,url:S,fromCache:!1,reason:_};if(vt.set(f,{until:Date.now()+s,result:N}),!i){let I=`${_}:${o}:${new URL(t,(E=location==null?void 0:location.href)!=null?E:"http://localhost/").origin}`,q=_==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:_==="abort"?`Request aborted while fetching ${o} ${t}`:`Network/CORS issue while fetching ${o} ${t}. A proxy may be required`;se.errorOnce(I,q)}return e.onError&&e.onError(N),N}finally{clearTimeout(u),Dt.delete(f)}});return Dt.set(f,g),g})}function dt(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}function ht(n){return $(this,arguments,function*(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let r=ut(t);if(!r)return t;let a=xt(r);if(m.background.has(a)){let s=m.background.get(a);return s?`url("${s}")`:"none"}try{let s=yield z(a,{as:"dataURL",useProxy:e.useProxy});return s.ok?(m.background.set(a,s.data),`url("${s.data}")`):(m.background.set(a,null),"none")}catch(s){return m.background.set(a,null),"none"}})}var Ft=new Set(["meta","script","noscript","title","link","template"]),wt=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"]),Oe=["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"];function qt(){for(let t of Oe){let e=String(t).toLowerCase();Ft.has(e)||wt.has(e)||jt(e)}}function jt(t){if(t=String(t).toLowerCase(),wt.has(t)){let a={};return m.defaultStyle.set(t,a),a}if(m.defaultStyle.has(t))return m.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),r={};for(let a of o){if(ie(a))continue;let s=o.getPropertyValue(a);r[a]=s}return e.removeChild(n),m.defaultStyle.set(t,r),r}var De=/(?:^|-)(animation|transition)(?:-|$)/i,qe=/^(--|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,je=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 ie(t){let e=String(t).toLowerCase();return!!(je.has(e)||qe.test(e)||De.test(e))}function bt(t,e){if(e=String(e||"").toLowerCase(),wt.has(e))return"";let n=[],o=jt(e);for(let[r,a]of Object.entries(t)){if(ie(r))continue;let s=o[r];a&&a!==s&&n.push(`${r}:${a}`)}return n.sort(),n.join(";")}function Ht(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 zt(t){let e=new Map;for(let o of t){let r=m.defaultStyle.get(o);if(!r)continue;let a=Object.entries(r).map(([s,c])=>`${s}:${c};`).sort().join("");a&&(e.has(a)||e.set(a,[]),e.get(a).push(o))}let n="";for(let[o,r]of e.entries())n+=`${r.join(",")} { ${o} }
2
+ `;return n}function Vt(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let r of e)n.set(r,`c${o++}`);return n}function mt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=m.computedStyle.get(t);if(n||(n=new Map,m.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Xt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch(n){return e}return e}function Lt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function pt(t){let e=[],n=0,o=0;for(let r=0;r<t.length;r++){let a=t[r];a==="("&&n++,a===")"&&n--,a===","&&n===0&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function st(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function it(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var ce=new WeakMap,Kt=new Map,Gt=0;function Ct(){Gt++}var le=!1;function He(t=document.documentElement){var e,n;if(!le){le=!0;try{new MutationObserver(()=>Ct()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch(o){}try{new MutationObserver(()=>Ct()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch(o){}try{let o=document.fonts;o&&((e=o.addEventListener)==null||e.call(o,"loadingdone",Ct),(n=o.ready)==null||n.then(()=>Ct()).catch(()=>{}))}catch(o){}}}function ze(t){let e={},n=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let r=t[o],a=t.getPropertyValue(r);(r==="background-image"||r==="content")&&a.includes("url(")&&!a.includes("data:")&&(a="none"),e[r]=a}return n==="hidden"&&(e.opacity="0"),e}var fe=new WeakMap;function Ve(t){let e=fe.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]<r[0]?-1:o[0]>r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),fe.set(t,e),e)}function Xe(t,e=null){let n=ce.get(t);if(n&&n.epoch===Gt)return n.snapshot;let o=e||getComputedStyle(t),r=ze(o);return ce.set(t,{epoch:Gt,snapshot:r}),r}function Ke(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Kt,defaultStyle:m.defaultStyle,baseStyle:m.baseStyle,image:m.image,resource:m.resource,background:m.background,font:m.font},options:e||{}}:{session:m.session,persist:{snapshotKeyCache:Kt,defaultStyle:m.defaultStyle,baseStyle:m.baseStyle,image:m.image,resource:m.resource,background:m.background,font:m.font},options:t||e||{}}}function gt(t,e,n,o){return $(this,null,function*(){var S,x,M;if(t.tagName==="STYLE")return;let r=Ke(n,o),a=r.options&&r.options.cache||"auto";if(a!=="disabled"&&He(document.documentElement),a==="disabled"&&!r.session.__bumpedForDisabled&&(Ct(),Kt.clear(),r.session.__bumpedForDisabled=!0),wt.has((S=t.tagName)==null?void 0:S.toLowerCase())){let u=(x=t.getAttribute)==null?void 0:x.call(t,"style");u&&e.setAttribute("style",u)}let{session:s,persist:c}=r;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let i=s.styleCache.get(t),f=Xe(t,i),l=Ve(f),d=c.snapshotKeyCache.get(l);if(!d){let u=((M=t.tagName)==null?void 0:M.toLowerCase())||"div";d=bt(f,u),c.snapshotKeyCache.set(l,d)}s.styleMap.set(e,d)})}function Yt(t,e,n){return Promise.all(t.map(o=>new Promise(r=>{function a(){st(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(o,r):a()},{fast:n})}a()})))}function Ge(t){return t=t.trim(),!t||/\:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Ye(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let r=n?Ge(o):o;return`:where(${e} ${r})`}).join(", ")}function Je(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,r,a)=>{let s=Ye(a,e,!0);return`${o}${r}${s}{`}),t):""}function Ze(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function Qe(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
3
3
  `});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let r of o.cssRules)e+=r.cssText+`
4
4
  `}catch(r){}}catch(n){}return e}function tn(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function en(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch(n){}}function nn(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function on(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch(n){}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch(n){}return""}function rn(t,e,n){let o=[];for(let r of e){let a=on(t,r);a&&o.push(`${r}: ${a};`)}return o.length?`${n}{${o.join("")}}
5
- `:""}function an(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}function sn(t,e=3){return $(this,null,function*(){let n=()=>{var a;try{return t.contentDocument||((a=t.contentWindow)==null?void 0:a.document)||null}catch(s){return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)yield new Promise(a=>setTimeout(a,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null})}function cn(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,o=parseFloat(i.borderRightWidth)||0,r=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch(i){}let s=Math.max(0,Math.round(e.width-(n+o))),c=Math.max(0,Math.round(e.height-(r+a)));return{contentWidth:s,contentHeight:c,rect:e}}function ln(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(r){}}}function fn(t,e,n){return $(this,null,function*(){let o=yield sn(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:a,rect:s}=cn(t),c=n==null?void 0:n.snap;if(!c||typeof c.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i=J(V({},n),{scale:1}),f=ln(o,r,a),l;try{l=yield c.toPng(o.documentElement,i)}finally{f()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${a}px`;let d=document.createElement("div");return e.nodeMap.set(d,t),gt(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(s.width)}px`),d.style.height||(d.style.height=`${Math.round(s.height)}px`),d.appendChild(l),d})}function kt(t,e,n){return $(this,null,function*(){var f,l,d,S,x,M;if(!t)throw new Error("Invalid node");let o=new Set,r=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let u=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ft.has(u))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){let u=document.createElement("div"),g=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${g.width}px;height:${g.height}px;visibility:hidden;`,u}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if((f=t.matches)!=null&&f.call(t,u)){let g=document.createElement("div"),b=t.getBoundingClientRect();return g.style.cssText=`display:inline-block;width:${b.width}px;height:${b.height}px;visibility:hidden;`,g}}catch(g){console.warn(`Invalid selector in exclude option: ${u}`,g)}if(typeof n.filter=="function")try{if(!n.filter(t)){let u=document.createElement("div"),g=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${g.width}px;height:${g.height}px;visibility:hidden;`,u}}catch(u){console.warn("Error in filter function:",u)}if(t.tagName==="IFRAME"){let u=!1;try{u=!!(t.contentDocument||(l=t.contentWindow)!=null&&l.document)}catch(g){u=!1}if(u)try{return yield fn(t,e,n)}catch(g){console.warn("[SnapDOM] iframe rasterization failed, fallback:",g)}if(n.placeholders){let g=document.createElement("div");return g.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;`,gt(t,g,e,n),g}else{let g=t.getBoundingClientRect(),b=document.createElement("div");return b.style.cssText=`display:inline-block;width:${g.width}px;height:${g.height}px;visibility:hidden;`,gt(t,b,e,n),b}}if(t.getAttribute("data-capture")==="placeholder"){let u=t.cloneNode(!1);e.nodeMap.set(u,t),gt(t,u,e,n);let g=document.createElement("div");return g.textContent=t.getAttribute("data-placeholder-text")||"",g.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(g),u}if(t.tagName==="CANVAS"){let u=t.toDataURL(),g=document.createElement("img");return g.src=u,g.width=t.width,g.height=t.height,e.nodeMap.set(g,t),gt(t,g,e,n),g}let s;try{if(s=t.cloneNode(!1),e.nodeMap.set(s,t),t.tagName==="IMG"){en(t,s);try{let u=t.getBoundingClientRect(),g=Math.round(u.width||0),b=Math.round(u.height||0);if(!g||!b){let F=window.getComputedStyle(t),U=parseFloat(F.width)||0,T=parseFloat(F.height)||0,E=parseInt(t.getAttribute("width")||"",10)||0,k=parseInt(t.getAttribute("height")||"",10)||0,_=t.width||t.naturalWidth||0,N=t.height||t.naturalHeight||0;g=Math.round(g||U||E||_||0),b=Math.round(b||T||k||N||0)}g&&(s.dataset.snapdomWidth=String(g)),b&&(s.dataset.snapdomHeight=String(b))}catch(u){}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",t,u),u}if(t instanceof HTMLTextAreaElement){let u=t.getBoundingClientRect();s.style.width=`${u.width}px`,s.style.height=`${u.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),gt(t,s,e,n),t.shadowRoot){let k=function(N,I){if(N.nodeType===Node.ELEMENT_NODE&&N.tagName==="STYLE")return I(null);kt(N,e,n).then(q=>{I(q||null)}).catch(q=>{I(null)})};try{let N=t.shadowRoot.querySelectorAll("slot");for(let I of N){let q=[];try{q=((d=I.assignedNodes)==null?void 0:d.call(I,{flatten:!0}))||((S=I.assignedNodes)==null?void 0:S.call(I))||[]}catch(K){q=((x=I.assignedNodes)==null?void 0:x.call(I))||[]}for(let K of q)o.add(K)}}catch(N){}let u=Ze(e),g=`[data-sd="${u}"]`;try{s.setAttribute("data-sd",u)}catch(N){}let b=Qe(t.shadowRoot),F=Je(b,g),U=nn(b),T=rn(t,U,g);tn(s,T+F,u);let E=document.createDocumentFragment(),_=yield Yt(Array.from(t.shadowRoot.childNodes),k,n.fast);E.append(..._.filter(N=>!!N)),s.appendChild(E)}if(t.tagName==="SLOT"){let F=function(T,E){kt(T,e,n).then(k=>{k&&an(k),E(k||null)}).catch(k=>{E(null)})},u=((M=t.assignedNodes)==null?void 0:M.call(t,{flatten:!0}))||[],g=u.length>0?u:Array.from(t.childNodes),b=document.createDocumentFragment(),U=yield Yt(Array.from(g),F,n.fast);return b.append(...U.filter(T=>!!T)),b}function c(u,g){if(o.has(u))return g(null);kt(u,e,n).then(b=>{g(b||null)}).catch(b=>{g(null)})}let i=yield Yt(Array.from(t.childNodes),c,n.fast);if(s.append(...i.filter(u=>!!u)),r!==null&&s instanceof HTMLSelectElement){s.value=r;for(let u of s.options)u.value===r?u.setAttribute("selected",""):u.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s})}var un=[/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],Jt=[];function ue(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Jt.push(n):typeof n=="string"?Jt.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function tt(t){let e=typeof t=="string"?t:"",n=[...un,...Jt];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 de(t,e,n,o=32,r="#000"){return $(this,null,function*(){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;yield document.fonts.ready;let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${o}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let c=s.getBoundingClientRect(),i=Math.ceil(c.width),f=Math.ceil(c.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=i*a,l.height=f*a;let d=l.getContext("2d");return d.scale(a,a),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(t,0,0),{dataUrl:l.toDataURL(),width:i,height:f}})}var dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Rt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!dn.has(n.toLowerCase()))return n}return""}function Tt(t){let e=String(t!=null?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!=null?t:"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function hn(t){let e=String(t!=null?t:"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function mn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=Tt(n[1]),a=Tt(n[2]);return{min:Math.min(r,a),max:Math.max(r,a)}}let o=Tt(e);return{min:o,max:o}}function pn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function gn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function yn(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(c=>r.endsWith(c)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let c of e){let i=c.toLowerCase().replace(/\s+/g,"+"),f=c.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(f))return!0}return!1}catch(n){return!1}}function wn(t){var n;let e=new Set;for(let o of t||[]){let r=(n=String(o).split("__")[0])==null?void 0:n.trim();r&&e.add(r)}return e}function Nt(){return $(this,arguments,function*({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){var N,I,q,K,ot,rt,ct,Z,j,G,et,Et,St,H,X,Y,Q,at;t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let h of t){let[w,p,C,y]=String(h).split("__");if(!w)continue;let A=a.get(w)||[];A.push({w:parseInt(p,10),s:C,st:parseInt(y,10)}),a.set(w,A)}let s=/@import\s+url\(["']?([^"')]+)["']?\)/g,c=/url\((["']?)([^"')]+)\1\)/g,i=/@font-face[^{}]*\{[^}]*\}/g;function f(h,w,p,C){if(!a.has(h))return!1;let y=a.get(h),A=mn(p),v=pn(w),L=gn(C),R=A.min!==A.max,W=A.min,P=B=>v.kind==="normal"&&B==="normal"||v.kind!=="normal"&&(B==="italic"||B==="oblique"),O=!1;for(let B of y){let nt=R?B.w>=A.min&&B.w<=A.max:B.w===W,ft=P(Zt(B.s)),yt=B.st>=L.min&&B.st<=L.max;if(nt&&ft&&yt){O=!0;break}}if(O)return!0;if(!R)for(let B of y){let nt=P(Zt(B.s)),ft=B.st>=L.min&&B.st<=L.max;if(Math.abs(W-B.w)<=300&&nt&&ft)return!0}return!1}function l(h){if(!h)return[];let w=[],p=h.split(",").map(C=>C.trim()).filter(Boolean);for(let C of p){let y=C.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!y)continue;let A=y[1],v=y[2],L=R=>{if(!R.includes("?"))return parseInt(R,16);let W=parseInt(R.replace(/\?/g,"0"),16),P=parseInt(R.replace(/\?/g,"F"),16);return[W,P]};if(v){let R=L(A),W=L(v),P=Array.isArray(R)?R[0]:R,O=Array.isArray(W)?W[1]:W;w.push([Math.min(P,O),Math.max(P,O)])}else{let R=L(A);Array.isArray(R)?w.push([R[0],R[1]]):w.push([R,R])}}return w}function d(h,w){if(!w.length||!h||h.size===0)return!0;for(let p of h)for(let[C,y]of w)if(p>=C&&p<=y)return!0;return!1}function S(h,w){let p=[];if(!h)return p;for(let C of h.matchAll(c)){let y=(C[2]||"").trim();if(!(!y||y.startsWith("data:"))){if(!/^https?:/i.test(y))try{y=new URL(y,w||location.href).href}catch(A){}p.push(y)}}return p}function x(h,w){return $(this,null,function*(){var C,y,A,v,L;let p=h;for(let R of h.matchAll(c)){let W=ut(R[0]);if(!W)continue;let P=W;if(!P.startsWith("http")&&!P.startsWith("data:"))try{P=new URL(P,w||location.href).href}catch(O){}if(!tt(P)){if((C=m.resource)!=null&&C.has(P)){(y=m.font)==null||y.add(P),p=p.replace(R[0],`url(${m.resource.get(P)})`);continue}if(!((A=m.font)!=null&&A.has(P)))try{let O=yield z(P,{as:"dataURL",useProxy:r,silent:!0});if(O.ok&&typeof O.data=="string"){let B=O.data;(v=m.resource)==null||v.set(P,B),(L=m.font)==null||L.add(P),p=p.replace(R[0],`url(${B})`)}}catch(O){console.warn("[snapDOM] Failed to fetch font resource:",P)}}}return p})}function M(h){if(!h.length)return null;let w=(L,R)=>h.some(([W,P])=>!(P<L||W>R)),p=w(0,255)||w(305,305),C=w(256,591)||w(7680,7935),y=w(880,1023),A=w(1024,1279);return w(7840,7929)||w(258,259)||w(416,417)||w(431,432)?"vietnamese":A?"cyrillic":y?"greek":C?"latin-ext":p?"latin":null}function u(h={}){let w=new Set((h.families||[]).map(y=>String(y).toLowerCase())),p=new Set((h.domains||[]).map(y=>String(y).toLowerCase())),C=new Set((h.subsets||[]).map(y=>String(y).toLowerCase()));return(y,A)=>{if(w.size&&w.has(y.family.toLowerCase()))return!0;if(p.size)for(let v of y.srcUrls)try{if(p.has(new URL(v).host.toLowerCase()))return!0}catch(L){}if(C.size){let v=M(A);if(v&&C.has(v))return!0}return!1}}let g=u(n);function b(h){var A,v,L,R,W,P;if(!h)return h;let w=/@font-face[^{}]*\{[^}]*\}/gi,p=new Set,C=[];for(let O of h.match(w)||[]){let B=((A=O.match(/font-family:\s*([^;]+);/i))==null?void 0:A[1])||"",nt=Rt(B),ft=(((v=O.match(/font-weight:\s*([^;]+);/i))==null?void 0:v[1])||"400").trim(),yt=(((L=O.match(/font-style:\s*([^;]+);/i))==null?void 0:L[1])||"normal").trim(),$e=(((R=O.match(/font-stretch:\s*([^;]+);/i))==null?void 0:R[1])||"100%").trim(),Ee=(((W=O.match(/unicode-range:\s*([^;]+);/i))==null?void 0:W[1])||"").trim(),ee=(((P=O.match(/src\s*:\s*([^;]+);/i))==null?void 0:P[1])||"").trim(),ne=S(ee,location.href),Me=ne.length?ne.map(ve=>String(ve).toLowerCase()).sort().join("|"):ee.toLowerCase(),oe=[String(nt||"").toLowerCase(),ft,yt,$e,Ee.toLowerCase(),Me].join("|");p.has(oe)||(p.add(oe),C.push(O))}if(C.length===0)return h;let y=0;return h.replace(w,()=>C[y++]||"")}function F(){let h=Array.from(t||[]).sort().join("|"),w=n?JSON.stringify({families:(n.families||[]).map(y=>String(y).toLowerCase()).sort(),domains:(n.domains||[]).map(y=>String(y).toLowerCase()).sort(),subsets:(n.subsets||[]).map(y=>String(y).toLowerCase()).sort()}):"",p=(o||[]).map(y=>`${(y.family||"").toLowerCase()}::${y.weight||"normal"}::${y.style||"normal"}::${y.src||""}`).sort().join("|");return`fonts-embed-css::req=${h}::ex=${w}::lf=${p}::px=${r||""}`}let U=F();if((N=m.resource)!=null&&N.has(U))return m.resource.get(U);let T=wn(t),E=[];for(let h of document.querySelectorAll("style")){let w=h.textContent||"";for(let p of w.matchAll(s)){let C=p[1];if(!C||tt(C))continue;!!document.querySelector(`link[rel="stylesheet"][href="${C}"]`)||E.push(C)}}E.length&&(yield Promise.all(E.map(h=>new Promise(w=>{if(document.querySelector(`link[rel="stylesheet"][href="${h}"]`))return w(null);let p=document.createElement("link");p.rel="stylesheet",p.href=h,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>w(p),p.onerror=()=>w(null),document.head.appendChild(p)}))));let k="",_=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(h=>!!h.href);for(let h of _)try{if(tt(h.href))continue;let w="",p=!1;try{p=new URL(h.href,location.href).origin===location.origin}catch(y){}if(!p&&!yn(h.href,T))continue;if(p){let y=Array.from(document.styleSheets).find(A=>A.href===h.href);if(y)try{let A=y.cssRules||[];w=Array.from(A).map(v=>v.cssText).join("")}catch(A){}}if(!w&&(w=(yield z(h.href,{as:"text",useProxy:r})).data,tt(h.href)))continue;let C="";for(let y of w.match(i)||[]){let A=(((I=y.match(/font-family:\s*([^;]+);/i))==null?void 0:I[1])||"").trim(),v=Rt(A);if(!v||tt(v))continue;let L=(((q=y.match(/font-weight:\s*([^;]+);/i))==null?void 0:q[1])||"400").trim(),R=(((K=y.match(/font-style:\s*([^;]+);/i))==null?void 0:K[1])||"normal").trim(),W=(((ot=y.match(/font-stretch:\s*([^;]+);/i))==null?void 0:ot[1])||"100%").trim(),P=(((rt=y.match(/unicode-range:\s*([^;]+);/i))==null?void 0:rt[1])||"").trim(),O=(((ct=y.match(/src\s*:\s*([^;]+);/i))==null?void 0:ct[1])||"").trim(),B=S(O,h.href);if(!f(v,R,L,W))continue;let nt=l(P);if(!d(e,nt))continue;let ft={family:v,weightSpec:L,styleSpec:R,stretchSpec:W,unicodeRange:P,srcRaw:O,srcUrls:B,href:h.href};if(n&&g(ft,nt))continue;let yt=/url\(/i.test(O)?yield x(y,h.href):y;C+=yt+""}C.trim()&&(k+=C+"")}catch(w){console.warn("[snapdom] Failed to process stylesheet:",h.href)}for(let h of document.styleSheets)try{if(h.href&&_.some(p=>p.href===h.href))continue;let w=h.cssRules||[];for(let p of w){if(p.type!==CSSRule.FONT_FACE_RULE)continue;let C=(p.style.getPropertyValue("font-family")||"").trim(),y=Rt(C);if(!y||tt(y))continue;let A=(p.style.getPropertyValue("font-weight")||"400").trim(),v=(p.style.getPropertyValue("font-style")||"normal").trim(),L=(p.style.getPropertyValue("font-stretch")||"100%").trim(),R=(p.style.getPropertyValue("src")||"").trim(),W=(p.style.getPropertyValue("unicode-range")||"").trim(),P=S(R,h.href||location.href);if(!f(y,v,A,L))continue;let O=l(W);if(!d(e,O))continue;let B={family:y,weightSpec:A,styleSpec:v,stretchSpec:L,unicodeRange:W,srcRaw:R,srcUrls:P,href:h.href||location.href};if(!(n&&g(B,O)))if(/url\(/i.test(R)){let nt=yield x(R,h.href||location.href);k+=`@font-face{font-family:${y};src:${nt};font-style:${v};font-weight:${A};font-stretch:${L};${W?`unicode-range:${W};`:""}}`}else k+=`@font-face{font-family:${y};src:${R};font-style:${v};font-weight:${A};font-stretch:${L};${W?`unicode-range:${W};`:""}}`}}catch(w){}try{for(let h of document.fonts||[]){if(!h||!h.family||h.status!=="loaded"||!h._snapdomSrc)continue;let w=String(h.family).replace(/^['"]+|['"]+$/g,"");if(tt(w)||!a.has(w)||n!=null&&n.families&&n.families.some(C=>String(C).toLowerCase()===w.toLowerCase()))continue;let p=h._snapdomSrc;if(!String(p).startsWith("data:")){if((Z=m.resource)!=null&&Z.has(h._snapdomSrc))p=m.resource.get(h._snapdomSrc),(j=m.font)==null||j.add(h._snapdomSrc);else if(!((G=m.font)!=null&&G.has(h._snapdomSrc)))try{let C=yield z(h._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(C.ok&&typeof C.data=="string")p=C.data,(et=m.resource)==null||et.set(h._snapdomSrc,p),(Et=m.font)==null||Et.add(h._snapdomSrc);else continue}catch(C){console.warn("[snapdom] Failed to fetch dynamic font src:",h._snapdomSrc);continue}}k+=`@font-face{font-family:'${w}';src:url(${p});font-style:${h.style||"normal"};font-weight:${h.weight||"normal"};}`}}catch(h){}for(let h of o){if(!h||typeof h!="object")continue;let w=String(h.family||"").replace(/^['"]+|['"]+$/g,"");if(!w||tt(w)||!a.has(w)||n!=null&&n.families&&n.families.some(L=>String(L).toLowerCase()===w.toLowerCase()))continue;let p=h.weight!=null?String(h.weight):"normal",C=h.style!=null?String(h.style):"normal",y=h.stretchPct!=null?`${h.stretchPct}%`:"100%",A=String(h.src||""),v=A;if(!v.startsWith("data:")){if((St=m.resource)!=null&&St.has(A))v=m.resource.get(A),(H=m.font)==null||H.add(A);else if(!((X=m.font)!=null&&X.has(A)))try{let L=yield z(A,{as:"dataURL",useProxy:r,silent:!0});if(L.ok&&typeof L.data=="string")v=L.data,(Y=m.resource)==null||Y.set(A,v),(Q=m.font)==null||Q.add(A);else continue}catch(L){console.warn("[snapdom] Failed to fetch localFonts src:",A);continue}}k+=`@font-face{font-family:'${w}';src:url(${v});font-style:${C};font-weight:${p};font-stretch:${y};}`}return k&&(k=b(k),(at=m.resource)==null||at.set(U,k)),k})}function It(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=s=>{let c=Rt(s.fontFamily);if(!c)return;let i=(f,l,d)=>`${c}__${Tt(f)}__${Zt(l)}__${hn(d)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&o(a);n.nextNode();){let s=n.currentNode,c=getComputedStyle(s);o(c);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&o(i);let f=getComputedStyle(s,"::after");f&&f.content&&f.content!=="none"&&o(f)}return e}function Pt(t){let e=new Set,n=r=>{if(r)for(let a of r)e.add(a.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let a=r;for(let s of["::before","::after"]){let c=getComputedStyle(a,s),i=c==null?void 0:c.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let f=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(f)for(let l of f)try{e.add(parseInt(l.slice(1),16))}catch(d){}}}}}return e}function _t(t,e=1){return $(this,null,function*(){try{yield document.fonts.ready}catch(r){}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position: absolute !important;left: -9999px !important;top: 0 !important;opacity: 0 !important;pointer-events: none !important;contain: layout size style;";for(let a of n){let s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${a}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",r.appendChild(s)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),yield new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))})}function Qt(t,e,n,o){return $(this,null,function*(){var s;if(!(t instanceof Element)||!(e instanceof Element))return;for(let c of["::before","::after","::first-letter"])try{let i=mt(t,c);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(c==="::first-letter"){let H=getComputedStyle(t);if(!(i.color!==H.color||i.fontSize!==H.fontSize||i.fontWeight!==H.fontWeight))continue;let Y=Array.from(e.childNodes).find(v=>{var L;return v.nodeType===Node.TEXT_NODE&&((L=v.textContent)==null?void 0:L.trim().length)>0});if(!Y)continue;let Q=Y.textContent,at=Q.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),h=at==null?void 0:at[0],w=Q.slice((h==null?void 0:h.length)||0);if(!h||/[\uD800-\uDFFF]/.test(h))continue;let p=document.createElement("span");p.textContent=h,p.dataset.snapdomPseudo="::first-letter";let C=Lt(i),y=bt(C,"span");n.styleMap.set(p,y);let A=document.createTextNode(w);e.replaceChild(A,Y),e.insertBefore(p,A);continue}let l=i.content,d=/counter\s*\(|counters\s*\(/.test(l)?"- ":Xt(l),S=i.backgroundImage,x=i.backgroundColor,M=i.fontFamily,u=parseInt(i.fontSize)||32,g=parseInt(i.fontWeight)||!1,b=i.color||"#000",F=i.display,U=parseFloat(i.width),T=parseFloat(i.height),E=i.borderStyle,k=parseFloat(i.borderWidth),_=i.transform,N=tt(M),I=l!=="none"&&d!=="",q=S&&S!=="none",K=x&&x!=="transparent"&&x!=="rgba(0, 0, 0, 0)",ot=F!=="inline"&&(U>0||T>0),rt=E&&E!=="none"&&k>0,ct=_&&_!=="none";if(!(I||q||K||ot||rt||ct))continue;let j=document.createElement("span");j.dataset.snapdomPseudo=c,j.style.verticalAlign="middle";let G=Lt(i),et=bt(G,"span");if(n.styleMap.set(j,et),N&&d.length===1){let{dataUrl:H,width:X,height:Y}=yield de(d,M,g,u,b),Q=document.createElement("img");Q.src=H,Q.style=`height:${u}px;width:${X/Y*u}px;object-fit:contain;`,j.appendChild(Q),e.dataset.snapdomHasIcon="true"}else if(d.startsWith("url(")){let H=ut(d);if(H!=null&&H.trim())try{let X=document.createElement("img"),Y=yield z(xt(H),{as:"dataURL",useProxy:o.useProxy});X.src=Y.data,X.style=`width:${u}px;height:auto;object-fit:contain;`,j.appendChild(X)}catch(X){console.error(`[snapdom] Error in pseudo ${c} for`,t,X)}}else!N&&I&&(j.textContent=d);if(q)try{let H=pt(S),X=yield Promise.all(H.map(ht));j.style.backgroundImage=X.join(", ")}catch(H){console.warn(`[snapdom] Failed to inline background-image for ${c}`,H)}if(K&&(j.style.backgroundColor=x),!(j.childNodes.length>0||((s=j.textContent)==null?void 0:s.trim())!==""||q||K||ot||rt||ct))continue;c==="::before"?e.insertBefore(j,e.firstChild):e.appendChild(j)}catch(i){console.warn(`[snapdom] Failed to capture ${c} for`,t,i)}let r=Array.from(t.children),a=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);for(let c=0;c<Math.min(r.length,a.length);c++)yield Qt(r[c],a[c],n,o)})}function he(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(c=>{let i=c.getAttribute("xlink:href")||c.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(c=>c.tagName.toLowerCase()==="symbol"),r=n.filter(c=>c.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(c=>{s.add(c.id)}),e.forEach(c=>{if(s.has(c))return;let i=o.find(f=>f.id===c);if(i){a.appendChild(i.cloneNode(!0)),s.add(c);return}for(let f of r){let l=f.querySelector(`#${CSS.escape(c)}`);if(l){let d=a.querySelector("defs");d||(d=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(d)),d.appendChild(l.cloneNode(!0)),s.add(c);break}}})}function pe(n){return $(this,arguments,function*(t,e={}){var i,f;let o={styleMap:m.session.styleMap,styleCache:m.session.styleCache,nodeMap:m.session.nodeMap},r,a="",s="";bn(t);try{he(t)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=yield kt(t,o,e,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{yield Qt(t,r,o,e)}catch(l){console.warn("inlinePseudoElements failed:",l)}yield kn(r);try{let l=r.querySelectorAll("style[data-sd]");for(let d of l)s+=d.textContent||"",d.remove()}catch(l){}let c=Vt(o.styleMap);a=Array.from(c.entries()).map(([l,d])=>`.${d}{${l}}`).join(""),a=s+a;for(let[l,d]of o.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",d.replace(/;/g,"; "));continue}let S=c.get(d);S&&l.classList.add(S);let x=(i=l.style)==null?void 0:i.backgroundImage,M=(f=l.dataset)==null?void 0:f.snapdomHasIcon;x&&x!=="none"&&(l.style.backgroundImage=x),M&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,d]of o.nodeMap.entries()){let S=d.scrollLeft,x=d.scrollTop;if((S||x)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let u=document.createElement("div");for(u.style.transform=`translate(${-S}px, ${-x}px)`,u.style.willChange="transform",u.style.display="inline-block",u.style.width="100%";l.firstChild;)u.appendChild(l.firstChild);l.appendChild(u)}}if(t===o.nodeMap.get(r)){let l=o.styleCache.get(t)||window.getComputedStyle(t);o.styleCache.set(t,l);let d=Bt(l.transform);r.style.margin="0",r.style.position="static",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.zIndex="auto",r.style.float="none",r.style.clear="none",r.style.transform=d||""}for(let[l,d]of o.nodeMap.entries())d.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:a,styleCache:o.styleCache}})}function bn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(o)>0,c=r==="none"||parseFloat(a)===0;s&&c&&(t.style.border=`${o} solid transparent`)}var At=new Map;function $t(t){return $(this,null,function*(){var n;if((n=m.resource)!=null&&n.has(t))return m.resource.get(t);if(At.has(t))return At.get(t);let e=$(null,null,function*(){var r;let o=yield z(t,{as:"dataURL",silent:!0});if(!o.ok||typeof o.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return(r=m.resource)==null||r.set(t,o.data),o.data});At.set(t,e);try{let o=yield e;return At.set(t,o),o}catch(o){throw At.delete(t),o}})}var Sn=/\bblob:[^)"'\s]+/g;function me(t){return $(this,null,function*(){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Sn)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=yield $t(o);n=n.split(o).join(r)}catch(r){}return n})}function Ut(t){return typeof t=="string"&&t.startsWith("blob:")}function xn(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 Cn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}function kn(t){return $(this,null,function*(){var s,c;if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let l=i.getAttribute("src")||i.currentSrc||"";if(Ut(l)){let S=yield $t(l);i.setAttribute("src",S)}let d=i.getAttribute("srcset");if(d&&d.includes("blob:")){let S=xn(d),x=!1;for(let M of S)if(Ut(M.url))try{M.url=yield $t(M.url),x=!0}catch(u){}x&&i.setAttribute("srcset",Cn(S))}}catch(f){}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let f="http://www.w3.org/1999/xlink",l=i.getAttribute("href")||((s=i.getAttributeNS)==null?void 0:s.call(i,f,"href"));if(Ut(l)){let d=yield $t(l);i.setAttribute("href",d),(c=i.removeAttributeNS)==null||c.call(i,f,"href")}}catch(f){}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of o)try{let f=i.getAttribute("style");if(f&&f.includes("blob:")){let l=yield me(f);i.setAttribute("style",l)}}catch(f){}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of r)try{let f=i.textContent||"";f.includes("blob:")&&(i.textContent=yield me(f))}catch(f){}let a=["poster"];for(let i of a){let f=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let l of f)try{let d=l.getAttribute(i);Ut(d)&&l.setAttribute(i,yield $t(d))}catch(d){}}})}function ge(n){return $(this,arguments,function*(t,e={}){let o=Array.from(t.querySelectorAll("img")),r=a=>$(null,null,function*(){var d,S,x,M;if(!a.getAttribute("src")){let u=a.currentSrc||a.src||"";u&&a.setAttribute("src",u)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let s=a.src||"";if(!s)return;let c=yield z(s,{as:"dataURL",useProxy:e.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){a.src=c.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{defaultImageUrl:i}=e||{};if(i)try{let u=parseInt(((d=a.dataset)==null?void 0:d.snapdomWidth)||"",10)||0,g=parseInt(((S=a.dataset)==null?void 0:S.snapdomHeight)||"",10)||0,b=parseInt(a.getAttribute("width")||"",10)||0,F=parseInt(a.getAttribute("height")||"",10)||0,U=parseFloat(((x=a.style)==null?void 0:x.width)||"")||0,T=parseFloat(((M=a.style)==null?void 0:M.height)||"")||0,E=u||U||b||a.width||void 0,k=g||T||F||a.height||void 0,_=typeof i=="function"?yield i({width:E,height:k,src:s,element:a}):i;if(_){let N=yield z(_,{as:"dataURL",useProxy:e.useProxy});a.src=N.data,!a.width&&E&&(a.width=E),!a.height&&k&&(a.height=k),a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}}catch(u){}let f=a.width||a.naturalWidth||100,l=a.height||a.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${f}px`,`height:${l}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${l}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",a.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${f}px;height:${l}px;visibility:hidden;`,a.replaceWith(u)}});for(let a=0;a<o.length;a+=4){let s=o.slice(a,a+4).map(r);yield Promise.allSettled(s)}})}function Wt(r,a,s){return $(this,arguments,function*(t,e,n,o={}){let c=[[t,e]],i=["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"],f=["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=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;c.length;){let[d,S]=c.shift(),x=n.get(d)||mt(d);n.has(d)||n.set(d,x);let M=(()=>{let b=x.getPropertyValue("border-image"),F=x.getPropertyValue("border-image-source");return b&&b!=="none"||F&&F!=="none"})();for(let b of i){let F=x.getPropertyValue(b);if(!F||F==="none")continue;let U=pt(F),T=yield Promise.all(U.map(E=>ht(E,o)));T.some(E=>E&&E!=="none"&&!/^url\(undefined/.test(E))&&S.style.setProperty(b,T.join(", "))}for(let b of f){let F=x.getPropertyValue(b);!F||F==="initial"||S.style.setProperty(b,F)}if(M)for(let b of l){let F=x.getPropertyValue(b);!F||F==="initial"||S.style.setProperty(b,F)}let u=Array.from(d.children),g=Array.from(S.children);for(let b=0;b<Math.min(u.length,g.length);b++)c.push([u[b],g[b]])}})}function we(t,e){return $(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,o,r,a,s="",c="",i,f;({clone:o,classCSS:r,styleCache:a}=yield pe(t,e)),yield new Promise(x=>{st(()=>$(null,null,function*(){yield ge(o,e),x()}),{fast:n})}),yield new Promise(x=>{st(()=>$(null,null,function*(){yield Wt(t,o,a,e),x()}),{fast:n})}),e.embedFonts&&(yield new Promise(x=>{st(()=>$(null,null,function*(){let M=It(t),u=Pt(t);if(it){let g=new Set(Array.from(M).map(b=>String(b).split("__")[0]).filter(Boolean));yield _t(g,2)}s=yield Nt({required:M,usedCodepoints:u,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),x()}),{fast:n})}));let l=Ht(o).sort(),d=l.join(",");m.baseStyle.has(d)?c=m.baseStyle.get(d):yield new Promise(x=>{st(()=>{c=zt(l),m.baseStyle.set(d,c),x()},{fast:n})}),yield new Promise(x=>{st(()=>{var Y,Q,at,h,w;let M=An(t),u=M.width,g=M.height,b=Number.isFinite(e.width),F=Number.isFinite(e.height),U=(Y=e.scale)!=null?Y:1,T=typeof U=="number"&&U!==1;if(!T){let p=M.width/M.height;b&&F?(u=e.width,g=e.height):b?(u=e.width,g=u/p):F&&(g=e.height,u=g*p)}u=Math.max(1,Math.ceil(u)),g=Math.max(1,Math.ceil(g));let E=getComputedStyle(t),k=E.transform&&E.transform!=="none"?E.transform:"",_=Mn(t),N,I,q,K,ot=0,rt=0;if(vn(t)){let p=Rn({baseTransform:k,rotate:_.rotate||"0deg",scale:_.scale,translate:_.translate}),C=(at=(Q=p.e)!=null?Q:p.m41)!=null?at:0,y=(w=(h=p.f)!=null?h:p.m42)!=null?w:0;ot=-C,rt=-y;let A=p.is2D?ye(p):ye(new DOMMatrix(p.toString())),v=En(u,g,A);N=Math.max(1,Math.ceil(v.width)),I=Math.max(1,Math.ceil(v.height)),q=-v.minX,K=-v.minY}else{let p=t.getBoundingClientRect(),C=Fn(p,{top:0,right:0,bottom:0,left:0});N=Math.max(1,C.width),I=Math.max(1,C.height),q=-(C.x-Math.floor(p.left)),K=-(C.y-Math.floor(p.top))}let ct="http://www.w3.org/2000/svg",Z=document.createElementNS(ct,"foreignObject");Z.setAttribute("width","100%"),Z.setAttribute("height","100%"),Z.setAttribute("x",String(q)),Z.setAttribute("y",String(K)),Z.style.overflow="visible";let j=document.createElement("style");j.textContent=c+s+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,Z.appendChild(j);let G=document.createElement("div");G.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),G.style.width=`${u}px`,G.style.height=`${g}px`,G.style.overflow="visible",G.style.transformOrigin="0 0";let et=[];if((ot||rt)&&et.push(`translate(${ot}px, ${rt}px)`),!T&&(b||F)){let p=M.width?u/M.width:1,C=M.height?g/M.height:1;et.push(`scale(${p}, ${C})`)}else T&&et.push(`scale(${U})`);et.length&&(G.style.transform=et.join(" ")),o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),o.style.transformOrigin="0 0",o.style.position="static",o.style.left="0",o.style.top="0",k&&(o.style.transform=k),o.style.rotate=_.rotate||"0deg",o.style.scale=_.scale||"1",o.style.translate=_.translate||"0 0",G.appendChild(o),Z.appendChild(G);let St=new XMLSerializer().serializeToString(Z);f=`<svg xmlns="${ct}" width="${N}" height="${I}" viewBox="0 0 ${N} ${I}">`+St+"</svg>",i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,x()},{fast:n})});let S=document.getElementById("snapdom-sandbox");return S&&S.style.position==="absolute"&&S.remove(),i})}function An(t){let e=getComputedStyle(t),n=a=>parseFloat(a)||0,o=n(e.width),r=n(e.height);return e.boxSizing==="content-box"&&(o+=n(e.paddingLeft)+n(e.paddingRight)+n(e.borderLeftWidth)+n(e.borderRightWidth),r+=n(e.paddingTop)+n(e.paddingBottom)+n(e.borderTopWidth)+n(e.borderBottomWidth)),{width:o,height:r}}function $n(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch(n){return new WebKitCSSMatrix(e)}}function ye(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function En(t,e,n){let r=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(f=>({x:n.a*f.x+n.c*f.y,y:n.b*f.x+n.d*f.y})),a=Math.min(...r.map(f=>f.x)),s=Math.max(...r.map(f=>f.x)),c=Math.min(...r.map(f=>f.y)),i=Math.max(...r.map(f=>f.y));return{minX:a,minY:c,width:s-a,height:i-c}}function Mn(t){var r,a,s,c,i,f,l,d,S,x,M,u,g,b;let e={rotate:"0deg",scale:null,translate:null},n=(r=t.computedStyleMap)==null?void 0:r.call(t);if(n){let F=n.get("rotate");if(F){let E=(a=F.angle)!=null?a:F;E&&"unit"in E?e.rotate=E.unit==="rad"?E.value*180/Math.PI+"deg":E.value+E.unit:e.rotate=String(F)}let U=n.get("scale");if(U&&U.length){let E=(c=(s=U[0])==null?void 0:s.value)!=null?c:1,k=(f=(i=U[1])==null?void 0:i.value)!=null?f:E;e.scale=`${E} ${k}`}let T=n.get("translate");if(T&&T.length){let E=(d=(l=T[0])==null?void 0:l.value)!=null?d:0,k=(x=(S=T[1])==null?void 0:S.value)!=null?x:0,_=(u=(M=T[0])==null?void 0:M.unit)!=null?u:"px",N=(b=(g=T[1])==null?void 0:g.unit)!=null?b:"px";e.translate=`${E}${_} ${k}${N}`}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}function vn(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function Fn(t,e){let n=Math.floor(t.left-e.left),o=Math.floor(t.top-e.top),r=Math.ceil(t.width+e.left+e.right),a=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:o,width:r,height:a}}var te=null;function Ln(){if(te)return te;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),te=t,t}function Rn(t){let e=Ln(),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=$n(n);return e.removeChild(n),o}function Tn(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function be(t={}){var o,r,a,s,c,i,f,l,d,S,x,M,u,g,b,F;let e=(o=t.format)!=null?o:"png",n=Tn(t.cache);return{debug:(r=t.debug)!=null?r:!1,fast:(a=t.fast)!=null?a:!0,scale:(s=t.scale)!=null?s:1,exclude:(c=t.exclude)!=null?c:[],filter:(i=t.filter)!=null?i:null,placeholders:t.placeholders!==!1,embedFonts:(f=t.embedFonts)!=null?f:!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:(l=t.excludeFonts)!=null?l:void 0,defaultImageUrl:(d=t.defaultImageUrl)!=null?d:void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:(S=t.width)!=null?S:null,height:(x=t.height)!=null?x:null,format:e,type:(M=t.type)!=null?M:"svg",quality:(u=t.quality)!=null?u:.92,dpr:(g=t.dpr)!=null?g:window.devicePixelRatio||1,backgroundColor:(b=t.backgroundColor)!=null?b:["jpg","jpeg","webp"].includes(e)?"#ffffff":null,filename:(F=t.filename)!=null?F:"snapDOM"}}function Se(t,e){return $(this,null,function*(){let n=new Image;return n.src=t,yield n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n})}function lt(t,e){return $(this,null,function*(){let{scale:n,dpr:o}=e,r=it(),a=new Image;a.crossOrigin="anonymous",a.loading="eager",a.decoding="sync",a.src=t;let s=null;r&&(s=document.createElement("div"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none;contain:size layout style;",document.body.appendChild(s),s.appendChild(a)),yield a.decode(),r&&(yield new Promise(d=>setTimeout(d,100)));let c=a.naturalWidth*n,i=a.naturalHeight*n,f=document.createElement("canvas");f.width=Math.ceil(c*o),f.height=Math.ceil(i*o),f.style.width=`${c}px`,f.style.height=`${i}px`;let l=f.getContext("2d");if(o!==1&&l.scale(o,o),l.drawImage(a,0,0,c,i),s&&s.parentNode)try{s.parentNode.removeChild(s)}catch(d){}return f})}function Ot(t,e){return $(this,null,function*(){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let o=yield lt(t,e),r=e.backgroundColor?dt(o,e.backgroundColor):o;return new Promise(a=>r.toBlob(s=>a(s),`image/${n}`,e.quality))})}function xe(t,e){return $(this,null,function*(){let n=yield lt(t,e),o=e.backgroundColor?dt(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),yield r.decode(),r.style.width=`${o.width/e.dpr}px`,r.style.height=`${o.height/e.dpr}px`,r})}function Ce(t,e){return $(this,null,function*(){if(e.format==="svg"){let a=yield Ot(t,J(V({},e),{type:"svg"})),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.filename,c.click(),URL.revokeObjectURL(s);return}let n=yield lt(t,e),o=e.backgroundColor?dt(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()})}var ke=Symbol("snapdom.internal");function D(t,e){return $(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");let n=be(e);return n.iconFonts&&n.iconFonts.length>0&&ue(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>D.toPng(o,r),toImg:(o,r)=>D.toImg(o,r)}),D.capture(t,n,ke)})}D.capture=(t,e,n)=>$(null,null,function*(){if(n!==ke)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=yield we(t,e),r=s=>V(V({},e),s||{}),a=s=>c=>{let i=r(J(V({},c||{}),{format:s})),f=s==="jpeg"||s==="jpg",l=i.backgroundColor==null||i.backgroundColor==="transparent";return f&&l&&(i.backgroundColor="#ffffff"),xe(o,i)};return{url:o,toRaw:()=>o,toImg:s=>Se(o,r(s)),toCanvas:s=>lt(o,r(s)),toBlob:s=>Ot(o,r(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ce(o,r(s))}});D.toRaw=(t,e)=>D(t,e).then(n=>n.toRaw());D.toImg=(t,e)=>D(t,e).then(n=>n.toImg());D.toCanvas=(t,e)=>D(t,e).then(n=>n.toCanvas());D.toBlob=(t,e)=>D(t,e).then(n=>n.toBlob());D.toPng=(t,e)=>D(t,J(V({},e),{format:"png"})).then(n=>n.toPng());D.toJpg=(t,e)=>D(t,J(V({},e),{format:"jpeg"})).then(n=>n.toJpg());D.toWebp=(t,e)=>D(t,J(V({},e),{format:"webp"})).then(n=>n.toWebp());D.download=(t,e)=>D(t,e).then(n=>n.download());function Ae(){return $(this,arguments,function*(t=document,e={}){var i;let{embedFonts:n=!0,cacheOpt:o="full",useProxy:r=""}=e;Mt(o);try{yield document.fonts.ready}catch(f){}qt(),m.session=m.session||{},m.session.styleCache||(m.session.styleCache=new WeakMap);try{yield Wt(t,void 0,m.session.styleCache,{useProxy:r})}catch(f){}let a=[],s=[];try{t!=null&&t.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch(f){}let c=[];for(let f of a){let l=f==null?void 0:f.src;if(l&&!m.image.has(l)){let d=Promise.resolve().then(()=>z(l,{as:"dataURL",useProxy:r})).then(S=>{m.image.set(l,S)}).catch(()=>{});c.push(d)}}for(let f of s){let l="";try{l=mt(f).backgroundImage}catch(d){}if(l&&l!=="none"){let d=pt(l);for(let S of d)if(S.startsWith("url(")){let x=Promise.resolve().then(()=>ht(S,J(V({},e),{useProxy:r}))).catch(()=>{});c.push(x)}}}if(n)try{let f=It(t),l=Pt(t);if(typeof it=="function"?it():it){let d=new Set(Array.from(f).map(S=>String(S).split("__")[0]).filter(Boolean));yield _t(d,2)}yield Nt({required:f,usedCodepoints:l,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:(i=e.useProxy)!=null?i:r})}catch(f){}yield Promise.allSettled(c)})}typeof window!="undefined"&&(window.snapdom=D,window.preCache=Ae);})();
5
+ `:""}function an(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}function sn(t,e=3){return $(this,null,function*(){let n=()=>{var a;try{return t.contentDocument||((a=t.contentWindow)==null?void 0:a.document)||null}catch(s){return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)yield new Promise(a=>setTimeout(a,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null})}function cn(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,a=0;try{let i=getComputedStyle(t);n=parseFloat(i.borderLeftWidth)||0,o=parseFloat(i.borderRightWidth)||0,r=parseFloat(i.borderTopWidth)||0,a=parseFloat(i.borderBottomWidth)||0}catch(i){}let s=Math.max(0,Math.round(e.width-(n+o))),c=Math.max(0,Math.round(e.height-(r+a)));return{contentWidth:s,contentHeight:c,rect:e}}function ln(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(r){}}}function fn(t,e,n){return $(this,null,function*(){let o=yield sn(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:a,rect:s}=cn(t),c=n==null?void 0:n.snap;if(!c||typeof c.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let i=J(V({},n),{scale:1}),f=ln(o,r,a),l;try{l=yield c.toPng(o.documentElement,i)}finally{f()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${a}px`;let d=document.createElement("div");return e.nodeMap.set(d,t),gt(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(s.width)}px`),d.style.height||(d.style.height=`${Math.round(s.height)}px`),d.appendChild(l),d})}function kt(t,e,n){return $(this,null,function*(){var f,l,d,S,x,M;if(!t)throw new Error("Invalid node");let o=new Set,r=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){let u=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ft.has(u))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){let u=document.createElement("div"),g=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${g.width}px;height:${g.height}px;visibility:hidden;`,u}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if((f=t.matches)!=null&&f.call(t,u)){let g=document.createElement("div"),b=t.getBoundingClientRect();return g.style.cssText=`display:inline-block;width:${b.width}px;height:${b.height}px;visibility:hidden;`,g}}catch(g){console.warn(`Invalid selector in exclude option: ${u}`,g)}if(typeof n.filter=="function")try{if(!n.filter(t)){let u=document.createElement("div"),g=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${g.width}px;height:${g.height}px;visibility:hidden;`,u}}catch(u){console.warn("Error in filter function:",u)}if(t.tagName==="IFRAME"){let u=!1;try{u=!!(t.contentDocument||(l=t.contentWindow)!=null&&l.document)}catch(g){u=!1}if(u)try{return yield fn(t,e,n)}catch(g){console.warn("[SnapDOM] iframe rasterization failed, fallback:",g)}if(n.placeholders){let g=document.createElement("div");return g.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;`,gt(t,g,e,n),g}else{let g=t.getBoundingClientRect(),b=document.createElement("div");return b.style.cssText=`display:inline-block;width:${g.width}px;height:${g.height}px;visibility:hidden;`,gt(t,b,e,n),b}}if(t.getAttribute("data-capture")==="placeholder"){let u=t.cloneNode(!1);e.nodeMap.set(u,t),gt(t,u,e,n);let g=document.createElement("div");return g.textContent=t.getAttribute("data-placeholder-text")||"",g.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(g),u}if(t.tagName==="CANVAS"){let u=t.toDataURL(),g=document.createElement("img");return g.src=u,g.width=t.width,g.height=t.height,e.nodeMap.set(g,t),gt(t,g,e,n),g}let s;try{if(s=t.cloneNode(!1),e.nodeMap.set(s,t),t.tagName==="IMG"){en(t,s);try{let u=t.getBoundingClientRect(),g=Math.round(u.width||0),b=Math.round(u.height||0);if(!g||!b){let F=window.getComputedStyle(t),U=parseFloat(F.width)||0,T=parseFloat(F.height)||0,E=parseInt(t.getAttribute("width")||"",10)||0,k=parseInt(t.getAttribute("height")||"",10)||0,_=t.width||t.naturalWidth||0,N=t.height||t.naturalHeight||0;g=Math.round(g||U||E||_||0),b=Math.round(b||T||k||N||0)}g&&(s.dataset.snapdomWidth=String(g)),b&&(s.dataset.snapdomHeight=String(b))}catch(u){}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",t,u),u}if(t instanceof HTMLTextAreaElement){let u=t.getBoundingClientRect();s.style.width=`${u.width}px`,s.style.height=`${u.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),gt(t,s,e,n),t.shadowRoot){let k=function(N,I){if(N.nodeType===Node.ELEMENT_NODE&&N.tagName==="STYLE")return I(null);kt(N,e,n).then(q=>{I(q||null)}).catch(q=>{I(null)})};try{let N=t.shadowRoot.querySelectorAll("slot");for(let I of N){let q=[];try{q=((d=I.assignedNodes)==null?void 0:d.call(I,{flatten:!0}))||((S=I.assignedNodes)==null?void 0:S.call(I))||[]}catch(K){q=((x=I.assignedNodes)==null?void 0:x.call(I))||[]}for(let K of q)o.add(K)}}catch(N){}let u=Ze(e),g=`[data-sd="${u}"]`;try{s.setAttribute("data-sd",u)}catch(N){}let b=Qe(t.shadowRoot),F=Je(b,g),U=nn(b),T=rn(t,U,g);tn(s,T+F,u);let E=document.createDocumentFragment(),_=yield Yt(Array.from(t.shadowRoot.childNodes),k,n.fast);E.append(..._.filter(N=>!!N)),s.appendChild(E)}if(t.tagName==="SLOT"){let F=function(T,E){kt(T,e,n).then(k=>{k&&an(k),E(k||null)}).catch(k=>{E(null)})},u=((M=t.assignedNodes)==null?void 0:M.call(t,{flatten:!0}))||[],g=u.length>0?u:Array.from(t.childNodes),b=document.createDocumentFragment(),U=yield Yt(Array.from(g),F,n.fast);return b.append(...U.filter(T=>!!T)),b}function c(u,g){if(o.has(u))return g(null);kt(u,e,n).then(b=>{g(b||null)}).catch(b=>{g(null)})}let i=yield Yt(Array.from(t.childNodes),c,n.fast);if(s.append(...i.filter(u=>!!u)),r!==null&&s instanceof HTMLSelectElement){s.value=r;for(let u of s.options)u.value===r?u.setAttribute("selected",""):u.removeAttribute("selected")}return a!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=a),s})}var un=[/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],Jt=[];function ue(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?Jt.push(n):typeof n=="string"?Jt.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function tt(t){let e=typeof t=="string"?t:"",n=[...un,...Jt];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 de(t,e,n,o=32,r="#000"){return $(this,null,function*(){e=e.replace(/^['"]+|['"]+$/g,"");let a=window.devicePixelRatio||1;yield document.fonts.ready;let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${o}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let c=s.getBoundingClientRect(),i=Math.ceil(c.width),f=Math.ceil(c.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=i*a,l.height=f*a;let d=l.getContext("2d");return d.scale(a,a),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(t,0,0),{dataUrl:l.toDataURL(),width:i,height:f}})}var dn=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Rt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!dn.has(n.toLowerCase()))return n}return""}function Tt(t){let e=String(t!=null?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!=null?t:"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function hn(t){let e=String(t!=null?t:"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function mn(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=Tt(n[1]),a=Tt(n[2]);return{min:Math.min(r,a),max:Math.max(r,a)}}let o=Tt(e);return{min:o,max:o}}function pn(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function gn(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let a=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(a,s),max:Math.max(a,s)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function yn(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(c=>r.endsWith(c)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let c of e){let i=c.toLowerCase().replace(/\s+/g,"+"),f=c.toLowerCase().replace(/\s+/g,"-");if(s.includes(i)||s.includes(f))return!0}return!1}catch(n){return!1}}function wn(t){var n;let e=new Set;for(let o of t||[]){let r=(n=String(o).split("__")[0])==null?void 0:n.trim();r&&e.add(r)}return e}function Nt(){return $(this,arguments,function*({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){var N,I,q,K,ot,rt,ct,Z,j,G,et,Et,St,H,X,Y,Q,at;t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let a=new Map;for(let h of t){let[w,p,C,y]=String(h).split("__");if(!w)continue;let A=a.get(w)||[];A.push({w:parseInt(p,10),s:C,st:parseInt(y,10)}),a.set(w,A)}let s=/@import\s+url\(["']?([^"')]+)["']?\)/g,c=/url\((["']?)([^"')]+)\1\)/g,i=/@font-face[^{}]*\{[^}]*\}/g;function f(h,w,p,C){if(!a.has(h))return!1;let y=a.get(h),A=mn(p),v=pn(w),L=gn(C),R=A.min!==A.max,W=A.min,P=O=>v.kind==="normal"&&O==="normal"||v.kind!=="normal"&&(O==="italic"||O==="oblique"),B=!1;for(let O of y){let nt=R?O.w>=A.min&&O.w<=A.max:O.w===W,ft=P(Zt(O.s)),yt=O.st>=L.min&&O.st<=L.max;if(nt&&ft&&yt){B=!0;break}}if(B)return!0;if(!R)for(let O of y){let nt=P(Zt(O.s)),ft=O.st>=L.min&&O.st<=L.max;if(Math.abs(W-O.w)<=300&&nt&&ft)return!0}return!1}function l(h){if(!h)return[];let w=[],p=h.split(",").map(C=>C.trim()).filter(Boolean);for(let C of p){let y=C.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!y)continue;let A=y[1],v=y[2],L=R=>{if(!R.includes("?"))return parseInt(R,16);let W=parseInt(R.replace(/\?/g,"0"),16),P=parseInt(R.replace(/\?/g,"F"),16);return[W,P]};if(v){let R=L(A),W=L(v),P=Array.isArray(R)?R[0]:R,B=Array.isArray(W)?W[1]:W;w.push([Math.min(P,B),Math.max(P,B)])}else{let R=L(A);Array.isArray(R)?w.push([R[0],R[1]]):w.push([R,R])}}return w}function d(h,w){if(!w.length||!h||h.size===0)return!0;for(let p of h)for(let[C,y]of w)if(p>=C&&p<=y)return!0;return!1}function S(h,w){let p=[];if(!h)return p;for(let C of h.matchAll(c)){let y=(C[2]||"").trim();if(!(!y||y.startsWith("data:"))){if(!/^https?:/i.test(y))try{y=new URL(y,w||location.href).href}catch(A){}p.push(y)}}return p}function x(h,w){return $(this,null,function*(){var C,y,A,v,L;let p=h;for(let R of h.matchAll(c)){let W=ut(R[0]);if(!W)continue;let P=W;if(!P.startsWith("http")&&!P.startsWith("data:"))try{P=new URL(P,w||location.href).href}catch(B){}if(!tt(P)){if((C=m.resource)!=null&&C.has(P)){(y=m.font)==null||y.add(P),p=p.replace(R[0],`url(${m.resource.get(P)})`);continue}if(!((A=m.font)!=null&&A.has(P)))try{let B=yield z(P,{as:"dataURL",useProxy:r,silent:!0});if(B.ok&&typeof B.data=="string"){let O=B.data;(v=m.resource)==null||v.set(P,O),(L=m.font)==null||L.add(P),p=p.replace(R[0],`url(${O})`)}}catch(B){console.warn("[snapDOM] Failed to fetch font resource:",P)}}}return p})}function M(h){if(!h.length)return null;let w=(L,R)=>h.some(([W,P])=>!(P<L||W>R)),p=w(0,255)||w(305,305),C=w(256,591)||w(7680,7935),y=w(880,1023),A=w(1024,1279);return w(7840,7929)||w(258,259)||w(416,417)||w(431,432)?"vietnamese":A?"cyrillic":y?"greek":C?"latin-ext":p?"latin":null}function u(h={}){let w=new Set((h.families||[]).map(y=>String(y).toLowerCase())),p=new Set((h.domains||[]).map(y=>String(y).toLowerCase())),C=new Set((h.subsets||[]).map(y=>String(y).toLowerCase()));return(y,A)=>{if(w.size&&w.has(y.family.toLowerCase()))return!0;if(p.size)for(let v of y.srcUrls)try{if(p.has(new URL(v).host.toLowerCase()))return!0}catch(L){}if(C.size){let v=M(A);if(v&&C.has(v))return!0}return!1}}let g=u(n);function b(h){var A,v,L,R,W,P;if(!h)return h;let w=/@font-face[^{}]*\{[^}]*\}/gi,p=new Set,C=[];for(let B of h.match(w)||[]){let O=((A=B.match(/font-family:\s*([^;]+);/i))==null?void 0:A[1])||"",nt=Rt(O),ft=(((v=B.match(/font-weight:\s*([^;]+);/i))==null?void 0:v[1])||"400").trim(),yt=(((L=B.match(/font-style:\s*([^;]+);/i))==null?void 0:L[1])||"normal").trim(),$e=(((R=B.match(/font-stretch:\s*([^;]+);/i))==null?void 0:R[1])||"100%").trim(),Ee=(((W=B.match(/unicode-range:\s*([^;]+);/i))==null?void 0:W[1])||"").trim(),ee=(((P=B.match(/src\s*:\s*([^;]+);/i))==null?void 0:P[1])||"").trim(),ne=S(ee,location.href),Me=ne.length?ne.map(ve=>String(ve).toLowerCase()).sort().join("|"):ee.toLowerCase(),oe=[String(nt||"").toLowerCase(),ft,yt,$e,Ee.toLowerCase(),Me].join("|");p.has(oe)||(p.add(oe),C.push(B))}if(C.length===0)return h;let y=0;return h.replace(w,()=>C[y++]||"")}function F(){let h=Array.from(t||[]).sort().join("|"),w=n?JSON.stringify({families:(n.families||[]).map(y=>String(y).toLowerCase()).sort(),domains:(n.domains||[]).map(y=>String(y).toLowerCase()).sort(),subsets:(n.subsets||[]).map(y=>String(y).toLowerCase()).sort()}):"",p=(o||[]).map(y=>`${(y.family||"").toLowerCase()}::${y.weight||"normal"}::${y.style||"normal"}::${y.src||""}`).sort().join("|");return`fonts-embed-css::req=${h}::ex=${w}::lf=${p}::px=${r||""}`}let U=F();if((N=m.resource)!=null&&N.has(U))return m.resource.get(U);let T=wn(t),E=[];for(let h of document.querySelectorAll("style")){let w=h.textContent||"";for(let p of w.matchAll(s)){let C=p[1];if(!C||tt(C))continue;!!document.querySelector(`link[rel="stylesheet"][href="${C}"]`)||E.push(C)}}E.length&&(yield Promise.all(E.map(h=>new Promise(w=>{if(document.querySelector(`link[rel="stylesheet"][href="${h}"]`))return w(null);let p=document.createElement("link");p.rel="stylesheet",p.href=h,p.setAttribute("data-snapdom","injected-import"),p.onload=()=>w(p),p.onerror=()=>w(null),document.head.appendChild(p)}))));let k="",_=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(h=>!!h.href);for(let h of _)try{if(tt(h.href))continue;let w="",p=!1;try{p=new URL(h.href,location.href).origin===location.origin}catch(y){}if(!p&&!yn(h.href,T))continue;if(p){let y=Array.from(document.styleSheets).find(A=>A.href===h.href);if(y)try{let A=y.cssRules||[];w=Array.from(A).map(v=>v.cssText).join("")}catch(A){}}if(!w&&(w=(yield z(h.href,{as:"text",useProxy:r})).data,tt(h.href)))continue;let C="";for(let y of w.match(i)||[]){let A=(((I=y.match(/font-family:\s*([^;]+);/i))==null?void 0:I[1])||"").trim(),v=Rt(A);if(!v||tt(v))continue;let L=(((q=y.match(/font-weight:\s*([^;]+);/i))==null?void 0:q[1])||"400").trim(),R=(((K=y.match(/font-style:\s*([^;]+);/i))==null?void 0:K[1])||"normal").trim(),W=(((ot=y.match(/font-stretch:\s*([^;]+);/i))==null?void 0:ot[1])||"100%").trim(),P=(((rt=y.match(/unicode-range:\s*([^;]+);/i))==null?void 0:rt[1])||"").trim(),B=(((ct=y.match(/src\s*:\s*([^;]+);/i))==null?void 0:ct[1])||"").trim(),O=S(B,h.href);if(!f(v,R,L,W))continue;let nt=l(P);if(!d(e,nt))continue;let ft={family:v,weightSpec:L,styleSpec:R,stretchSpec:W,unicodeRange:P,srcRaw:B,srcUrls:O,href:h.href};if(n&&g(ft,nt))continue;let yt=/url\(/i.test(B)?yield x(y,h.href):y;C+=yt+""}C.trim()&&(k+=C+"")}catch(w){console.warn("[snapdom] Failed to process stylesheet:",h.href)}for(let h of document.styleSheets)try{if(h.href&&_.some(p=>p.href===h.href))continue;let w=h.cssRules||[];for(let p of w){if(p.type!==CSSRule.FONT_FACE_RULE)continue;let C=(p.style.getPropertyValue("font-family")||"").trim(),y=Rt(C);if(!y||tt(y))continue;let A=(p.style.getPropertyValue("font-weight")||"400").trim(),v=(p.style.getPropertyValue("font-style")||"normal").trim(),L=(p.style.getPropertyValue("font-stretch")||"100%").trim(),R=(p.style.getPropertyValue("src")||"").trim(),W=(p.style.getPropertyValue("unicode-range")||"").trim(),P=S(R,h.href||location.href);if(!f(y,v,A,L))continue;let B=l(W);if(!d(e,B))continue;let O={family:y,weightSpec:A,styleSpec:v,stretchSpec:L,unicodeRange:W,srcRaw:R,srcUrls:P,href:h.href||location.href};if(!(n&&g(O,B)))if(/url\(/i.test(R)){let nt=yield x(R,h.href||location.href);k+=`@font-face{font-family:${y};src:${nt};font-style:${v};font-weight:${A};font-stretch:${L};${W?`unicode-range:${W};`:""}}`}else k+=`@font-face{font-family:${y};src:${R};font-style:${v};font-weight:${A};font-stretch:${L};${W?`unicode-range:${W};`:""}}`}}catch(w){}try{for(let h of document.fonts||[]){if(!h||!h.family||h.status!=="loaded"||!h._snapdomSrc)continue;let w=String(h.family).replace(/^['"]+|['"]+$/g,"");if(tt(w)||!a.has(w)||n!=null&&n.families&&n.families.some(C=>String(C).toLowerCase()===w.toLowerCase()))continue;let p=h._snapdomSrc;if(!String(p).startsWith("data:")){if((Z=m.resource)!=null&&Z.has(h._snapdomSrc))p=m.resource.get(h._snapdomSrc),(j=m.font)==null||j.add(h._snapdomSrc);else if(!((G=m.font)!=null&&G.has(h._snapdomSrc)))try{let C=yield z(h._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(C.ok&&typeof C.data=="string")p=C.data,(et=m.resource)==null||et.set(h._snapdomSrc,p),(Et=m.font)==null||Et.add(h._snapdomSrc);else continue}catch(C){console.warn("[snapdom] Failed to fetch dynamic font src:",h._snapdomSrc);continue}}k+=`@font-face{font-family:'${w}';src:url(${p});font-style:${h.style||"normal"};font-weight:${h.weight||"normal"};}`}}catch(h){}for(let h of o){if(!h||typeof h!="object")continue;let w=String(h.family||"").replace(/^['"]+|['"]+$/g,"");if(!w||tt(w)||!a.has(w)||n!=null&&n.families&&n.families.some(L=>String(L).toLowerCase()===w.toLowerCase()))continue;let p=h.weight!=null?String(h.weight):"normal",C=h.style!=null?String(h.style):"normal",y=h.stretchPct!=null?`${h.stretchPct}%`:"100%",A=String(h.src||""),v=A;if(!v.startsWith("data:")){if((St=m.resource)!=null&&St.has(A))v=m.resource.get(A),(H=m.font)==null||H.add(A);else if(!((X=m.font)!=null&&X.has(A)))try{let L=yield z(A,{as:"dataURL",useProxy:r,silent:!0});if(L.ok&&typeof L.data=="string")v=L.data,(Y=m.resource)==null||Y.set(A,v),(Q=m.font)==null||Q.add(A);else continue}catch(L){console.warn("[snapdom] Failed to fetch localFonts src:",A);continue}}k+=`@font-face{font-family:'${w}';src:url(${v});font-style:${C};font-weight:${p};font-stretch:${y};}`}return k&&(k=b(k),(at=m.resource)==null||at.set(U,k)),k})}function It(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=s=>{let c=Rt(s.fontFamily);if(!c)return;let i=(f,l,d)=>`${c}__${Tt(f)}__${Zt(l)}__${hn(d)}`;e.add(i(s.fontWeight,s.fontStyle,s.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let a=getComputedStyle(t,"::after");for(a&&a.content&&a.content!=="none"&&o(a);n.nextNode();){let s=n.currentNode,c=getComputedStyle(s);o(c);let i=getComputedStyle(s,"::before");i&&i.content&&i.content!=="none"&&o(i);let f=getComputedStyle(s,"::after");f&&f.content&&f.content!=="none"&&o(f)}return e}function Pt(t){let e=new Set,n=r=>{if(r)for(let a of r)e.add(a.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let a=r;for(let s of["::before","::after"]){let c=getComputedStyle(a,s),i=c==null?void 0:c.getPropertyValue("content");if(!(!i||i==="none"))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let f=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(f)for(let l of f)try{e.add(parseInt(l.slice(1),16))}catch(d){}}}}}return e}function _t(t,e=2){return $(this,null,function*(){try{yield document.fonts.ready}catch(r){}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position: absolute !important;left: -9999px !important;top: 0 !important;opacity: 0 !important;pointer-events: none !important;contain: layout size style;";for(let a of n){let s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${a}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",r.appendChild(s)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),yield new Promise(a=>requestAnimationFrame(()=>requestAnimationFrame(a)))})}function Qt(t,e,n,o){return $(this,null,function*(){var s;if(!(t instanceof Element)||!(e instanceof Element))return;for(let c of["::before","::after","::first-letter"])try{let i=mt(t,c);if(!i||typeof i[Symbol.iterator]!="function"||i.content==="none"&&i.backgroundImage==="none"&&i.backgroundColor==="transparent"&&(i.borderStyle==="none"||parseFloat(i.borderWidth)===0)&&(!i.transform||i.transform==="none")&&i.display==="inline")continue;if(c==="::first-letter"){let H=getComputedStyle(t);if(!(i.color!==H.color||i.fontSize!==H.fontSize||i.fontWeight!==H.fontWeight))continue;let Y=Array.from(e.childNodes).find(v=>{var L;return v.nodeType===Node.TEXT_NODE&&((L=v.textContent)==null?void 0:L.trim().length)>0});if(!Y)continue;let Q=Y.textContent,at=Q.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),h=at==null?void 0:at[0],w=Q.slice((h==null?void 0:h.length)||0);if(!h||/[\uD800-\uDFFF]/.test(h))continue;let p=document.createElement("span");p.textContent=h,p.dataset.snapdomPseudo="::first-letter";let C=Lt(i),y=bt(C,"span");n.styleMap.set(p,y);let A=document.createTextNode(w);e.replaceChild(A,Y),e.insertBefore(p,A);continue}let l=i.content,d=/counter\s*\(|counters\s*\(/.test(l)?"- ":Xt(l),S=i.backgroundImage,x=i.backgroundColor,M=i.fontFamily,u=parseInt(i.fontSize)||32,g=parseInt(i.fontWeight)||!1,b=i.color||"#000",F=i.display,U=parseFloat(i.width),T=parseFloat(i.height),E=i.borderStyle,k=parseFloat(i.borderWidth),_=i.transform,N=tt(M),I=l!=="none"&&d!=="",q=S&&S!=="none",K=x&&x!=="transparent"&&x!=="rgba(0, 0, 0, 0)",ot=F!=="inline"&&(U>0||T>0),rt=E&&E!=="none"&&k>0,ct=_&&_!=="none";if(!(I||q||K||ot||rt||ct))continue;let j=document.createElement("span");j.dataset.snapdomPseudo=c,j.style.verticalAlign="middle";let G=Lt(i),et=bt(G,"span");if(n.styleMap.set(j,et),N&&d.length===1){let{dataUrl:H,width:X,height:Y}=yield de(d,M,g,u,b),Q=document.createElement("img");Q.src=H,Q.style=`height:${u}px;width:${X/Y*u}px;object-fit:contain;`,j.appendChild(Q),e.dataset.snapdomHasIcon="true"}else if(d.startsWith("url(")){let H=ut(d);if(H!=null&&H.trim())try{let X=document.createElement("img"),Y=yield z(xt(H),{as:"dataURL",useProxy:o.useProxy});X.src=Y.data,X.style=`width:${u}px;height:auto;object-fit:contain;`,j.appendChild(X)}catch(X){console.error(`[snapdom] Error in pseudo ${c} for`,t,X)}}else!N&&I&&(j.textContent=d);if(q)try{let H=pt(S),X=yield Promise.all(H.map(ht));j.style.backgroundImage=X.join(", ")}catch(H){console.warn(`[snapdom] Failed to inline background-image for ${c}`,H)}if(K&&(j.style.backgroundColor=x),!(j.childNodes.length>0||((s=j.textContent)==null?void 0:s.trim())!==""||q||K||ot||rt||ct))continue;c==="::before"?e.insertBefore(j,e.firstChild):e.appendChild(j)}catch(i){console.warn(`[snapdom] Failed to capture ${c} for`,t,i)}let r=Array.from(t.children),a=Array.from(e.children).filter(c=>!c.dataset.snapdomPseudo);for(let c=0;c<Math.min(r.length,a.length);c++)yield Qt(r[c],a[c],n,o)})}function he(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(c=>{let i=c.getAttribute("xlink:href")||c.getAttribute("href");i&&i.startsWith("#")&&e.add(i.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(c=>c.tagName.toLowerCase()==="symbol"),r=n.filter(c=>c.tagName.toLowerCase()==="defs"),a=t.querySelector("svg.inline-defs-container");a||(a=document.createElementNS("http://www.w3.org/2000/svg","svg"),a.setAttribute("aria-hidden","true"),a.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),a.classList.add("inline-defs-container"),t.insertBefore(a,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(c=>{s.add(c.id)}),e.forEach(c=>{if(s.has(c))return;let i=o.find(f=>f.id===c);if(i){a.appendChild(i.cloneNode(!0)),s.add(c);return}for(let f of r){let l=f.querySelector(`#${CSS.escape(c)}`);if(l){let d=a.querySelector("defs");d||(d=document.createElementNS("http://www.w3.org/2000/svg","defs"),a.appendChild(d)),d.appendChild(l.cloneNode(!0)),s.add(c);break}}})}function pe(n){return $(this,arguments,function*(t,e={}){var i,f;let o={styleMap:m.session.styleMap,styleCache:m.session.styleCache,nodeMap:m.session.nodeMap},r,a="",s="";bn(t);try{he(t)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=yield kt(t,o,e,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{yield Qt(t,r,o,e)}catch(l){console.warn("inlinePseudoElements failed:",l)}yield kn(r);try{let l=r.querySelectorAll("style[data-sd]");for(let d of l)s+=d.textContent||"",d.remove()}catch(l){}let c=Vt(o.styleMap);a=Array.from(c.entries()).map(([l,d])=>`.${d}{${l}}`).join(""),a=s+a;for(let[l,d]of o.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",d.replace(/;/g,"; "));continue}let S=c.get(d);S&&l.classList.add(S);let x=(i=l.style)==null?void 0:i.backgroundImage,M=(f=l.dataset)==null?void 0:f.snapdomHasIcon;x&&x!=="none"&&(l.style.backgroundImage=x),M&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,d]of o.nodeMap.entries()){let S=d.scrollLeft,x=d.scrollTop;if((S||x)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let u=document.createElement("div");for(u.style.transform=`translate(${-S}px, ${-x}px)`,u.style.willChange="transform",u.style.display="inline-block",u.style.width="100%";l.firstChild;)u.appendChild(l.firstChild);l.appendChild(u)}}if(t===o.nodeMap.get(r)){let l=o.styleCache.get(t)||window.getComputedStyle(t);o.styleCache.set(t,l);let d=Ot(l.transform);r.style.margin="0",r.style.position="static",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.zIndex="auto",r.style.float="none",r.style.clear="none",r.style.transform=d||""}for(let[l,d]of o.nodeMap.entries())d.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:a,styleCache:o.styleCache}})}function bn(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,a=e.borderWidth,s=n!=="none"&&parseFloat(o)>0,c=r==="none"||parseFloat(a)===0;s&&c&&(t.style.border=`${o} solid transparent`)}var At=new Map;function $t(t){return $(this,null,function*(){var n;if((n=m.resource)!=null&&n.has(t))return m.resource.get(t);if(At.has(t))return At.get(t);let e=$(null,null,function*(){var r;let o=yield z(t,{as:"dataURL",silent:!0});if(!o.ok||typeof o.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return(r=m.resource)==null||r.set(t,o.data),o.data});At.set(t,e);try{let o=yield e;return At.set(t,o),o}catch(o){throw At.delete(t),o}})}var Sn=/\bblob:[^)"'\s]+/g;function me(t){return $(this,null,function*(){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Sn)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=yield $t(o);n=n.split(o).join(r)}catch(r){}return n})}function Ut(t){return typeof t=="string"&&t.startsWith("blob:")}function xn(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 Cn(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}function kn(t){return $(this,null,function*(){var s,c;if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let l=i.getAttribute("src")||i.currentSrc||"";if(Ut(l)){let S=yield $t(l);i.setAttribute("src",S)}let d=i.getAttribute("srcset");if(d&&d.includes("blob:")){let S=xn(d),x=!1;for(let M of S)if(Ut(M.url))try{M.url=yield $t(M.url),x=!0}catch(u){}x&&i.setAttribute("srcset",Cn(S))}}catch(f){}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let f="http://www.w3.org/1999/xlink",l=i.getAttribute("href")||((s=i.getAttributeNS)==null?void 0:s.call(i,f,"href"));if(Ut(l)){let d=yield $t(l);i.setAttribute("href",d),(c=i.removeAttributeNS)==null||c.call(i,f,"href")}}catch(f){}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of o)try{let f=i.getAttribute("style");if(f&&f.includes("blob:")){let l=yield me(f);i.setAttribute("style",l)}}catch(f){}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of r)try{let f=i.textContent||"";f.includes("blob:")&&(i.textContent=yield me(f))}catch(f){}let a=["poster"];for(let i of a){let f=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let l of f)try{let d=l.getAttribute(i);Ut(d)&&l.setAttribute(i,yield $t(d))}catch(d){}}})}function ge(n){return $(this,arguments,function*(t,e={}){let o=Array.from(t.querySelectorAll("img")),r=a=>$(null,null,function*(){var d,S,x,M;if(!a.getAttribute("src")){let u=a.currentSrc||a.src||"";u&&a.setAttribute("src",u)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let s=a.src||"";if(!s)return;let c=yield z(s,{as:"dataURL",useProxy:e.useProxy});if(c.ok&&typeof c.data=="string"&&c.data.startsWith("data:")){a.src=c.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{defaultImageUrl:i}=e||{};if(i)try{let u=parseInt(((d=a.dataset)==null?void 0:d.snapdomWidth)||"",10)||0,g=parseInt(((S=a.dataset)==null?void 0:S.snapdomHeight)||"",10)||0,b=parseInt(a.getAttribute("width")||"",10)||0,F=parseInt(a.getAttribute("height")||"",10)||0,U=parseFloat(((x=a.style)==null?void 0:x.width)||"")||0,T=parseFloat(((M=a.style)==null?void 0:M.height)||"")||0,E=u||U||b||a.width||void 0,k=g||T||F||a.height||void 0,_=typeof i=="function"?yield i({width:E,height:k,src:s,element:a}):i;if(_){let N=yield z(_,{as:"dataURL",useProxy:e.useProxy});a.src=N.data,!a.width&&E&&(a.width=E),!a.height&&k&&(a.height=k),a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}}catch(u){}let f=a.width||a.naturalWidth||100,l=a.height||a.naturalHeight||100;if(e.placeholders!==!1){let u=document.createElement("div");u.style.cssText=[`width:${f}px`,`height:${l}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${l}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),u.textContent="img",a.replaceWith(u)}else{let u=document.createElement("div");u.style.cssText=`display:inline-block;width:${f}px;height:${l}px;visibility:hidden;`,a.replaceWith(u)}});for(let a=0;a<o.length;a+=4){let s=o.slice(a,a+4).map(r);yield Promise.allSettled(s)}})}function Wt(r,a,s){return $(this,arguments,function*(t,e,n,o={}){let c=[[t,e]],i=["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"],f=["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=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;c.length;){let[d,S]=c.shift(),x=n.get(d)||mt(d);n.has(d)||n.set(d,x);let M=(()=>{let b=x.getPropertyValue("border-image"),F=x.getPropertyValue("border-image-source");return b&&b!=="none"||F&&F!=="none"})();for(let b of i){let F=x.getPropertyValue(b);if(!F||F==="none")continue;let U=pt(F),T=yield Promise.all(U.map(E=>ht(E,o)));T.some(E=>E&&E!=="none"&&!/^url\(undefined/.test(E))&&S.style.setProperty(b,T.join(", "))}for(let b of f){let F=x.getPropertyValue(b);!F||F==="initial"||S.style.setProperty(b,F)}if(M)for(let b of l){let F=x.getPropertyValue(b);!F||F==="initial"||S.style.setProperty(b,F)}let u=Array.from(d.children),g=Array.from(S.children);for(let b=0;b<Math.min(u.length,g.length);b++)c.push([u[b],g[b]])}})}function we(t,e){return $(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");Mt(e.cache);let n=e.fast,o,r,a,s="",c="",i,f;({clone:o,classCSS:r,styleCache:a}=yield pe(t,e)),yield new Promise(x=>{st(()=>$(null,null,function*(){yield ge(o,e),x()}),{fast:n})}),yield new Promise(x=>{st(()=>$(null,null,function*(){yield Wt(t,o,a,e),x()}),{fast:n})}),e.embedFonts&&(yield new Promise(x=>{st(()=>$(null,null,function*(){let M=It(t),u=Pt(t);if(it){let g=new Set(Array.from(M).map(b=>String(b).split("__")[0]).filter(Boolean));yield _t(g,5)}s=yield Nt({required:M,usedCodepoints:u,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),x()}),{fast:n})}));let l=Ht(o).sort(),d=l.join(",");m.baseStyle.has(d)?c=m.baseStyle.get(d):yield new Promise(x=>{st(()=>{c=zt(l),m.baseStyle.set(d,c),x()},{fast:n})}),yield new Promise(x=>{st(()=>{var Y,Q,at,h,w;let M=An(t),u=M.width,g=M.height,b=Number.isFinite(e.width),F=Number.isFinite(e.height),U=(Y=e.scale)!=null?Y:1,T=typeof U=="number"&&U!==1;if(!T){let p=M.width/M.height;b&&F?(u=e.width,g=e.height):b?(u=e.width,g=u/p):F&&(g=e.height,u=g*p)}u=Math.max(1,Math.ceil(u)),g=Math.max(1,Math.ceil(g));let E=getComputedStyle(t),k=E.transform&&E.transform!=="none"?E.transform:"",_=Mn(t),N,I,q,K,ot=0,rt=0;if(vn(t)){let p=Rn({baseTransform:k,rotate:_.rotate||"0deg",scale:_.scale,translate:_.translate}),C=(at=(Q=p.e)!=null?Q:p.m41)!=null?at:0,y=(w=(h=p.f)!=null?h:p.m42)!=null?w:0;ot=-C,rt=-y;let A=p.is2D?ye(p):ye(new DOMMatrix(p.toString())),v=En(u,g,A);N=Math.max(1,Math.ceil(v.width)),I=Math.max(1,Math.ceil(v.height)),q=-v.minX,K=-v.minY}else{let p=t.getBoundingClientRect(),C=Fn(p,{top:0,right:0,bottom:0,left:0});N=Math.max(1,C.width),I=Math.max(1,C.height),q=-(C.x-Math.floor(p.left)),K=-(C.y-Math.floor(p.top))}let ct="http://www.w3.org/2000/svg",Z=document.createElementNS(ct,"foreignObject");Z.setAttribute("width","100%"),Z.setAttribute("height","100%"),Z.setAttribute("x",String(q)),Z.setAttribute("y",String(K)),Z.style.overflow="visible";let j=document.createElement("style");j.textContent=c+s+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,Z.appendChild(j);let G=document.createElement("div");G.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),G.style.width=`${u}px`,G.style.height=`${g}px`,G.style.overflow="visible",G.style.transformOrigin="0 0";let et=[];if((ot||rt)&&et.push(`translate(${ot}px, ${rt}px)`),!T&&(b||F)){let p=M.width?u/M.width:1,C=M.height?g/M.height:1;et.push(`scale(${p}, ${C})`)}else T&&et.push(`scale(${U})`);et.length&&(G.style.transform=et.join(" ")),o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),o.style.transformOrigin="0 0",o.style.position="static",o.style.left="0",o.style.top="0",k&&(o.style.transform=k),o.style.rotate=_.rotate||"0deg",o.style.scale=_.scale||"1",o.style.translate=_.translate||"0 0",G.appendChild(o),Z.appendChild(G);let St=new XMLSerializer().serializeToString(Z);f=`<svg xmlns="${ct}" width="${N}" height="${I}" viewBox="0 0 ${N} ${I}">`+St+"</svg>",i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,x()},{fast:n})});let S=document.getElementById("snapdom-sandbox");return S&&S.style.position==="absolute"&&S.remove(),i})}function An(t){let e=getComputedStyle(t),n=a=>parseFloat(a)||0,o=n(e.width),r=n(e.height);return e.boxSizing==="content-box"&&(o+=n(e.paddingLeft)+n(e.paddingRight)+n(e.borderLeftWidth)+n(e.borderRightWidth),r+=n(e.paddingTop)+n(e.paddingBottom)+n(e.borderTopWidth)+n(e.borderBottomWidth)),{width:o,height:r}}function $n(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch(n){return new WebKitCSSMatrix(e)}}function ye(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function En(t,e,n){let r=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(f=>({x:n.a*f.x+n.c*f.y,y:n.b*f.x+n.d*f.y})),a=Math.min(...r.map(f=>f.x)),s=Math.max(...r.map(f=>f.x)),c=Math.min(...r.map(f=>f.y)),i=Math.max(...r.map(f=>f.y));return{minX:a,minY:c,width:s-a,height:i-c}}function Mn(t){var r,a,s,c,i,f,l,d,S,x,M,u,g,b;let e={rotate:"0deg",scale:null,translate:null},n=(r=t.computedStyleMap)==null?void 0:r.call(t);if(n){let F=n.get("rotate");if(F){let E=(a=F.angle)!=null?a:F;E&&"unit"in E?e.rotate=E.unit==="rad"?E.value*180/Math.PI+"deg":E.value+E.unit:e.rotate=String(F)}let U=n.get("scale");if(U&&U.length){let E=(c=(s=U[0])==null?void 0:s.value)!=null?c:1,k=(f=(i=U[1])==null?void 0:i.value)!=null?f:E;e.scale=`${E} ${k}`}let T=n.get("translate");if(T&&T.length){let E=(d=(l=T[0])==null?void 0:l.value)!=null?d:0,k=(x=(S=T[1])==null?void 0:S.value)!=null?x:0,_=(u=(M=T[0])==null?void 0:M.unit)!=null?u:"px",N=(b=(g=T[1])==null?void 0:g.unit)!=null?b:"px";e.translate=`${E}${_} ${k}${N}`}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}function vn(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function Fn(t,e){let n=Math.floor(t.left-e.left),o=Math.floor(t.top-e.top),r=Math.ceil(t.width+e.left+e.right),a=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:o,width:r,height:a}}var te=null;function Ln(){if(te)return te;let t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),te=t,t}function Rn(t){let e=Ln(),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=$n(n);return e.removeChild(n),o}function Tn(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function be(t={}){var o,r,a,s,c,i,f,l,d,S,x,M,u,g,b,F;let e=(o=t.format)!=null?o:"png",n=Tn(t.cache);return{debug:(r=t.debug)!=null?r:!1,fast:(a=t.fast)!=null?a:!0,scale:(s=t.scale)!=null?s:1,exclude:(c=t.exclude)!=null?c:[],filter:(i=t.filter)!=null?i:null,placeholders:t.placeholders!==!1,embedFonts:(f=t.embedFonts)!=null?f:!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:(l=t.excludeFonts)!=null?l:void 0,defaultImageUrl:(d=t.defaultImageUrl)!=null?d:void 0,cache:n,useProxy:typeof t.useProxy=="string"?t.useProxy:"",width:(S=t.width)!=null?S:null,height:(x=t.height)!=null?x:null,format:e,type:(M=t.type)!=null?M:"svg",quality:(u=t.quality)!=null?u:.92,dpr:(g=t.dpr)!=null?g:window.devicePixelRatio||1,backgroundColor:(b=t.backgroundColor)!=null?b:["jpg","jpeg","webp"].includes(e)?"#ffffff":null,filename:(F=t.filename)!=null?F:"snapDOM"}}function Se(t,e){return $(this,null,function*(){let n=new Image;return n.src=t,yield n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n})}function lt(t,e){return $(this,null,function*(){let{scale:n,dpr:o}=e,r=it(),a=new Image;a.crossOrigin="anonymous",a.loading="eager",a.decoding="sync",a.src=t;let s=null;r&&(s=document.createElement("div"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none;contain:size layout style;",document.body.appendChild(s),s.appendChild(a)),yield a.decode(),r&&(yield new Promise(d=>setTimeout(d,100)));let c=a.naturalWidth*n,i=a.naturalHeight*n,f=document.createElement("canvas");f.width=Math.ceil(c*o),f.height=Math.ceil(i*o),f.style.width=`${c}px`,f.style.height=`${i}px`;let l=f.getContext("2d");if(o!==1&&l.scale(o,o),l.drawImage(a,0,0,c,i),s&&s.parentNode)try{s.parentNode.removeChild(s)}catch(d){}return f})}function Bt(t,e){return $(this,null,function*(){let n=e.type;if(n==="svg"){let a=decodeURIComponent(t.split(",")[1]);return new Blob([a],{type:"image/svg+xml"})}let o=yield lt(t,e),r=e.backgroundColor?dt(o,e.backgroundColor):o;return new Promise(a=>r.toBlob(s=>a(s),`image/${n}`,e.quality))})}function xe(t,e){return $(this,null,function*(){let n=yield lt(t,e),o=e.backgroundColor?dt(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),yield r.decode(),r.style.width=`${o.width/e.dpr}px`,r.style.height=`${o.height/e.dpr}px`,r})}function Ce(t,e){return $(this,null,function*(){if(e.format==="svg"){let a=yield Bt(t,J(V({},e),{type:"svg"})),s=URL.createObjectURL(a),c=document.createElement("a");c.href=s,c.download=e.filename,c.click(),URL.revokeObjectURL(s);return}let n=yield lt(t,e),o=e.backgroundColor?dt(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()})}var ke=Symbol("snapdom.internal");function D(t,e){return $(this,null,function*(){if(!t)throw new Error("Element cannot be null or undefined");let n=be(e);return n.iconFonts&&n.iconFonts.length>0&&ue(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>D.toPng(o,r),toImg:(o,r)=>D.toImg(o,r)}),D.capture(t,n,ke)})}D.capture=(t,e,n)=>$(null,null,function*(){if(n!==ke)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=yield we(t,e),r=s=>V(V({},e),s||{}),a=s=>c=>{let i=r(J(V({},c||{}),{format:s})),f=s==="jpeg"||s==="jpg",l=i.backgroundColor==null||i.backgroundColor==="transparent";return f&&l&&(i.backgroundColor="#ffffff"),xe(o,i)};return{url:o,toRaw:()=>o,toImg:s=>Se(o,r(s)),toCanvas:s=>lt(o,r(s)),toBlob:s=>Bt(o,r(s)),toPng:a("png"),toJpg:a("jpeg"),toWebp:a("webp"),download:s=>Ce(o,r(s))}});D.toRaw=(t,e)=>D(t,e).then(n=>n.toRaw());D.toImg=(t,e)=>D(t,e).then(n=>n.toImg());D.toCanvas=(t,e)=>D(t,e).then(n=>n.toCanvas());D.toBlob=(t,e)=>D(t,e).then(n=>n.toBlob());D.toPng=(t,e)=>D(t,J(V({},e),{format:"png"})).then(n=>n.toPng());D.toJpg=(t,e)=>D(t,J(V({},e),{format:"jpeg"})).then(n=>n.toJpg());D.toWebp=(t,e)=>D(t,J(V({},e),{format:"webp"})).then(n=>n.toWebp());D.download=(t,e)=>D(t,e).then(n=>n.download());function Ae(){return $(this,arguments,function*(t=document,e={}){var i;let{embedFonts:n=!0,cacheOpt:o="full",useProxy:r=""}=e;Mt(o);try{yield document.fonts.ready}catch(f){}qt(),m.session=m.session||{},m.session.styleCache||(m.session.styleCache=new WeakMap);try{yield Wt(t,void 0,m.session.styleCache,{useProxy:r})}catch(f){}let a=[],s=[];try{t!=null&&t.querySelectorAll&&(a=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch(f){}let c=[];for(let f of a){let l=f==null?void 0:f.src;if(l&&!m.image.has(l)){let d=Promise.resolve().then(()=>z(l,{as:"dataURL",useProxy:r})).then(S=>{m.image.set(l,S)}).catch(()=>{});c.push(d)}}for(let f of s){let l="";try{l=mt(f).backgroundImage}catch(d){}if(l&&l!=="none"){let d=pt(l);for(let S of d)if(S.startsWith("url(")){let x=Promise.resolve().then(()=>ht(S,J(V({},e),{useProxy:r}))).catch(()=>{});c.push(x)}}}if(n)try{let f=It(t),l=Pt(t);if(typeof it=="function"?it():it){let d=new Set(Array.from(f).map(S=>String(S).split("__")[0]).filter(Boolean));yield _t(d,2)}yield Nt({required:f,usedCodepoints:l,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:(i=e.useProxy)!=null?i:r})}catch(f){}yield Promise.allSettled(c)})}typeof window!="undefined"&&(window.snapdom=D,window.preCache=Ae);})();
@@ -1,5 +1,5 @@
1
- var h={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 lt(t="soft"){switch(t){case"auto":{h.session.styleMap=new Map,h.session.nodeMap=new Map;return}case"soft":{h.session.styleMap=new Map,h.session.nodeMap=new Map,h.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{h.session.styleMap=new Map,h.session.nodeMap=new Map,h.session.styleCache=new WeakMap,h.computedStyle=new WeakMap,h.baseStyle=new Map,h.defaultStyle=new Map,h.image=new Map,h.background=new Map,h.resource=new Map,h.font=new Set;return}default:{h.session.styleMap=new Map,h.session.nodeMap=new Map,h.session.styleCache=new WeakMap;return}}}function G(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function kt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(i=>i.trim());return r.length!==6?`matrix(${o})`:(r[4]="0",r[5]="0",`matrix(${r.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(i=>i.trim());return r.length!==16?`matrix3d(${o})`:(r[12]="0",r[13]="0",`matrix3d(${r.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function rt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ae(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function i(s,a,f){if(r>=n)return;let c=Date.now();(o.get(a)||0)>c||(o.set(a,c+e),r++,s==="warn"&&console&&console.warn?console.warn(`${t} ${f}`):console&&console.error&&console.error(`${t} ${f}`))}return{warnOnce(s,a){i("warn",s,a)},errorOnce(s,a){i("error",s,a)},reset(){o.clear(),r=0}}}var Bt=ae("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),At=new Map,ft=new Map;function ie(t){return/^data:|^blob:|^about:blank$/.test(t)}function ce(t,e){if(!e||ie(t))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 le(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{url}",encodeURIComponent(t));let n=e.endsWith("?")?"":e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function fe(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 ue(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function B(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",i=e.errorTTL??8e3,s=e.headers||{},a=!!e.silent,f=ue(t,{as:n,timeout:o,useProxy:r,errorTTL:i}),c=ft.get(f);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&ft.delete(f);let l=At.get(f);if(l)return l;let d=ce(t,r)?le(t,r):t,x=e.credentials;if(!x)try{let w=typeof location<"u"&&location.href?location.href:"http://localhost/",F=new URL(t,w);x=typeof location<"u"&&F.origin===location.origin?"include":"omit"}catch{x="omit"}let R=new AbortController,C=setTimeout(()=>R.abort("timeout"),o),k=(async()=>{try{let w=await fetch(d,{signal:R.signal,credentials:x,headers:s});if(!w.ok){let T={ok:!1,data:null,status:w.status,url:d,fromCache:!1,reason:"http_error"};if(ft.set(f,{until:Date.now()+i,result:T}),!a){let _=`${w.status} ${w.statusText||""}`.trim();Bt.warnOnce(`http:${w.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${_} while fetching ${n} ${t}`)}return e.onError&&e.onError(T),T}if(n==="text")return{ok:!0,data:await w.text(),status:w.status,url:d,fromCache:!1};let F=await w.blob(),M=F.type||w.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await fe(F),status:w.status,url:d,fromCache:!1,mime:M}:{ok:!0,data:F,status:w.status,url:d,fromCache:!1,mime:M}}catch(w){let F=w&&typeof w=="object"&&"name"in w&&w.name==="AbortError"?String(w.message||"").includes("timeout")?"timeout":"abort":"network",M={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:F};if(ft.set(f,{until:Date.now()+i,result:M}),!a){let T=`${F}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,_=F==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:F==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Bt.errorOnce(T,_)}return e.onError&&e.onError(M),M}finally{clearTimeout(C),At.delete(f)}})();return At.set(f,k),k}function Y(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}async function J(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=G(t);if(!o)return t;let r=rt(o);if(h.background.has(r)){let i=h.background.get(r);return i?`url("${i}")`:"none"}try{let i=await B(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(h.background.set(r,i.data),`url("${i.data}")`):(h.background.set(r,null),"none")}catch{return h.background.set(r,null),"none"}}var ut=new Set(["meta","script","noscript","title","link","template"]),nt=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"]),de=["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"];function $t(){for(let t of de){let e=String(t).toLowerCase();ut.has(e)||nt.has(e)||Et(e)}}function Et(t){if(t=String(t).toLowerCase(),nt.has(t)){let i={};return h.defaultStyle.set(t,i),i}if(h.defaultStyle.has(t))return h.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),r={};for(let i of o){if(Dt(i))continue;let s=o.getPropertyValue(i);r[i]=s}return e.removeChild(n),h.defaultStyle.set(t,r),r}var he=/(?:^|-)(animation|transition)(?:-|$)/i,me=/^(--|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,pe=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 Dt(t){let e=String(t).toLowerCase();return!!(pe.has(e)||me.test(e)||he.test(e))}function ot(t,e){if(e=String(e||"").toLowerCase(),nt.has(e))return"";let n=[],o=Et(e);for(let[r,i]of Object.entries(t)){if(Dt(r))continue;let s=o[r];i&&i!==s&&n.push(`${r}:${i}`)}return n.sort(),n.join(";")}function Mt(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 vt(t){let e=new Map;for(let o of t){let r=h.defaultStyle.get(o);if(!r)continue;let i=Object.entries(r).map(([s,a])=>`${s}:${a};`).sort().join("");i&&(e.has(i)||e.set(i,[]),e.get(i).push(o))}let n="";for(let[o,r]of e.entries())n+=`${r.join(",")} { ${o} }
2
- `;return n}function Ft(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let r of e)n.set(r,`c${o++}`);return n}function Z(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=h.computedStyle.get(t);if(n||(n=new Map,h.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Lt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch{return e}return e}function dt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function Q(t){let e=[],n=0,o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&n++,i===")"&&n--,i===","&&n===0&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function V(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function X(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var qt=new WeakMap,Rt=new Map,Tt=0;function st(){Tt++}var jt=!1;function ge(t=document.documentElement){if(!jt){jt=!0;try{new MutationObserver(()=>st()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>st()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",st),e.ready?.then(()=>st()).catch(()=>{}))}catch{}}}function ye(t){let e={},n=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let r=t[o],i=t.getPropertyValue(r);(r==="background-image"||r==="content")&&i.includes("url(")&&!i.includes("data:")&&(i="none"),e[r]=i}return n==="hidden"&&(e.opacity="0"),e}var Ht=new WeakMap;function we(t){let e=Ht.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]<r[0]?-1:o[0]>r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),Ht.set(t,e),e)}function be(t,e=null){let n=qt.get(t);if(n&&n.epoch===Tt)return n.snapshot;let o=e||getComputedStyle(t),r=ye(o);return qt.set(t,{epoch:Tt,snapshot:r}),r}function Se(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Rt,defaultStyle:h.defaultStyle,baseStyle:h.baseStyle,image:h.image,resource:h.resource,background:h.background,font:h.font},options:e||{}}:{session:h.session,persist:{snapshotKeyCache:Rt,defaultStyle:h.defaultStyle,baseStyle:h.baseStyle,image:h.image,resource:h.resource,background:h.background,font:h.font},options:t||e||{}}}async function tt(t,e,n,o){if(t.tagName==="STYLE")return;let r=Se(n,o),i=r.options&&r.options.cache||"auto";if(i!=="disabled"&&ge(document.documentElement),i==="disabled"&&!r.session.__bumpedForDisabled&&(st(),Rt.clear(),r.session.__bumpedForDisabled=!0),nt.has(t.tagName?.toLowerCase())){let x=t.getAttribute?.("style");x&&e.setAttribute("style",x)}let{session:s,persist:a}=r;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let f=s.styleCache.get(t),c=be(t,f),l=we(c),d=a.snapshotKeyCache.get(l);if(!d){let x=t.tagName?.toLowerCase()||"div";d=ot(c,x),a.snapshotKeyCache.set(l,d)}s.styleMap.set(e,d)}function Nt(t,e,n){return Promise.all(t.map(o=>new Promise(r=>{function i(){V(s=>{s instanceof IdleDeadline?s.timeRemaining()?e(o,r):i():e(o,r)},{fast:n})}i()})))}function xe(t){return t=t.trim(),!t||/\:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Ce(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let r=n?xe(o):o;return`:where(${e} ${r})`}).join(", ")}function ke(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,r,i)=>{let s=Ce(i,e,!0);return`${o}${r}${s}{`}),t):""}function Ae(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function $e(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
1
+ var h={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 lt(t="soft"){switch(t){case"auto":{h.session.styleMap=new Map,h.session.nodeMap=new Map;return}case"soft":{h.session.styleMap=new Map,h.session.nodeMap=new Map,h.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{h.session.styleMap=new Map,h.session.nodeMap=new Map,h.session.styleCache=new WeakMap,h.computedStyle=new WeakMap,h.baseStyle=new Map,h.defaultStyle=new Map,h.image=new Map,h.background=new Map,h.resource=new Map,h.font=new Set;return}default:{h.session.styleMap=new Map,h.session.nodeMap=new Map,h.session.styleCache=new WeakMap;return}}}function G(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function kt(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(i=>i.trim());return r.length!==6?`matrix(${o})`:(r[4]="0",r[5]="0",`matrix(${r.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let r=o.split(",").map(i=>i.trim());return r.length!==16?`matrix3d(${o})`:(r[12]="0",r[13]="0",`matrix3d(${r.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function rt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ae(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,r=0;function i(s,a,f){if(r>=n)return;let c=Date.now();(o.get(a)||0)>c||(o.set(a,c+e),r++,s==="warn"&&console&&console.warn?console.warn(`${t} ${f}`):console&&console.error&&console.error(`${t} ${f}`))}return{warnOnce(s,a){i("warn",s,a)},errorOnce(s,a){i("error",s,a)},reset(){o.clear(),r=0}}}var Ot=ae("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),At=new Map,ft=new Map;function ie(t){return/^data:|^blob:|^about:blank$/.test(t)}function ce(t,e){if(!e||ie(t))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 le(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{url}",encodeURIComponent(t));let n=e.endsWith("?")?"":e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function fe(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 ue(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function O(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",i=e.errorTTL??8e3,s=e.headers||{},a=!!e.silent,f=ue(t,{as:n,timeout:o,useProxy:r,errorTTL:i}),c=ft.get(f);if(c&&c.until>Date.now())return{...c.result,fromCache:!0};c&&ft.delete(f);let l=At.get(f);if(l)return l;let d=ce(t,r)?le(t,r):t,x=e.credentials;if(!x)try{let w=typeof location<"u"&&location.href?location.href:"http://localhost/",F=new URL(t,w);x=typeof location<"u"&&F.origin===location.origin?"include":"omit"}catch{x="omit"}let R=new AbortController,C=setTimeout(()=>R.abort("timeout"),o),k=(async()=>{try{let w=await fetch(d,{signal:R.signal,credentials:x,headers:s});if(!w.ok){let T={ok:!1,data:null,status:w.status,url:d,fromCache:!1,reason:"http_error"};if(ft.set(f,{until:Date.now()+i,result:T}),!a){let _=`${w.status} ${w.statusText||""}`.trim();Ot.warnOnce(`http:${w.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${_} while fetching ${n} ${t}`)}return e.onError&&e.onError(T),T}if(n==="text")return{ok:!0,data:await w.text(),status:w.status,url:d,fromCache:!1};let F=await w.blob(),M=F.type||w.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await fe(F),status:w.status,url:d,fromCache:!1,mime:M}:{ok:!0,data:F,status:w.status,url:d,fromCache:!1,mime:M}}catch(w){let F=w&&typeof w=="object"&&"name"in w&&w.name==="AbortError"?String(w.message||"").includes("timeout")?"timeout":"abort":"network",M={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:F};if(ft.set(f,{until:Date.now()+i,result:M}),!a){let T=`${F}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,_=F==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:F==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Ot.errorOnce(T,_)}return e.onError&&e.onError(M),M}finally{clearTimeout(C),At.delete(f)}})();return At.set(f,k),k}function Y(t,e){if(!e||!t.width||!t.height)return t;let n=document.createElement("canvas");n.width=t.width,n.height=t.height;let o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}async function J(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=G(t);if(!o)return t;let r=rt(o);if(h.background.has(r)){let i=h.background.get(r);return i?`url("${i}")`:"none"}try{let i=await O(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(h.background.set(r,i.data),`url("${i.data}")`):(h.background.set(r,null),"none")}catch{return h.background.set(r,null),"none"}}var ut=new Set(["meta","script","noscript","title","link","template"]),nt=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"]),de=["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"];function $t(){for(let t of de){let e=String(t).toLowerCase();ut.has(e)||nt.has(e)||Et(e)}}function Et(t){if(t=String(t).toLowerCase(),nt.has(t)){let i={};return h.defaultStyle.set(t,i),i}if(h.defaultStyle.has(t))return h.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),r={};for(let i of o){if(Dt(i))continue;let s=o.getPropertyValue(i);r[i]=s}return e.removeChild(n),h.defaultStyle.set(t,r),r}var he=/(?:^|-)(animation|transition)(?:-|$)/i,me=/^(--|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,pe=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 Dt(t){let e=String(t).toLowerCase();return!!(pe.has(e)||me.test(e)||he.test(e))}function ot(t,e){if(e=String(e||"").toLowerCase(),nt.has(e))return"";let n=[],o=Et(e);for(let[r,i]of Object.entries(t)){if(Dt(r))continue;let s=o[r];i&&i!==s&&n.push(`${r}:${i}`)}return n.sort(),n.join(";")}function Mt(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 vt(t){let e=new Map;for(let o of t){let r=h.defaultStyle.get(o);if(!r)continue;let i=Object.entries(r).map(([s,a])=>`${s}:${a};`).sort().join("");i&&(e.has(i)||e.set(i,[]),e.get(i).push(o))}let n="";for(let[o,r]of e.entries())n+=`${r.join(",")} { ${o} }
2
+ `;return n}function Ft(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let r of e)n.set(r,`c${o++}`);return n}function Z(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=h.computedStyle.get(t);if(n||(n=new Map,h.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Lt(t){let e=t.replace(/^['"]|['"]$/g,"");if(e.startsWith("\\"))try{return String.fromCharCode(parseInt(e.replace("\\",""),16))}catch{return e}return e}function dt(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function Q(t){let e=[],n=0,o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&n++,i===")"&&n--,i===","&&n===0&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function V(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function X(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var qt=new WeakMap,Rt=new Map,Tt=0;function st(){Tt++}var jt=!1;function ge(t=document.documentElement){if(!jt){jt=!0;try{new MutationObserver(()=>st()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>st()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",st),e.ready?.then(()=>st()).catch(()=>{}))}catch{}}}function ye(t){let e={},n=t.getPropertyValue("visibility");for(let o=0;o<t.length;o++){let r=t[o],i=t.getPropertyValue(r);(r==="background-image"||r==="content")&&i.includes("url(")&&!i.includes("data:")&&(i="none"),e[r]=i}return n==="hidden"&&(e.opacity="0"),e}var Ht=new WeakMap;function we(t){let e=Ht.get(t);return e||(e=Object.entries(t).sort((o,r)=>o[0]<r[0]?-1:o[0]>r[0]?1:0).map(([o,r])=>`${o}:${r}`).join(";"),Ht.set(t,e),e)}function be(t,e=null){let n=qt.get(t);if(n&&n.epoch===Tt)return n.snapshot;let o=e||getComputedStyle(t),r=ye(o);return qt.set(t,{epoch:Tt,snapshot:r}),r}function Se(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Rt,defaultStyle:h.defaultStyle,baseStyle:h.baseStyle,image:h.image,resource:h.resource,background:h.background,font:h.font},options:e||{}}:{session:h.session,persist:{snapshotKeyCache:Rt,defaultStyle:h.defaultStyle,baseStyle:h.baseStyle,image:h.image,resource:h.resource,background:h.background,font:h.font},options:t||e||{}}}async function tt(t,e,n,o){if(t.tagName==="STYLE")return;let r=Se(n,o),i=r.options&&r.options.cache||"auto";if(i!=="disabled"&&ge(document.documentElement),i==="disabled"&&!r.session.__bumpedForDisabled&&(st(),Rt.clear(),r.session.__bumpedForDisabled=!0),nt.has(t.tagName?.toLowerCase())){let x=t.getAttribute?.("style");x&&e.setAttribute("style",x)}let{session:s,persist:a}=r;s.styleCache.has(t)||s.styleCache.set(t,getComputedStyle(t));let f=s.styleCache.get(t),c=be(t,f),l=we(c),d=a.snapshotKeyCache.get(l);if(!d){let x=t.tagName?.toLowerCase()||"div";d=ot(c,x),a.snapshotKeyCache.set(l,d)}s.styleMap.set(e,d)}function Nt(t,e,n){return Promise.all(t.map(o=>new Promise(r=>{function i(){V(s=>{(s&&typeof s.timeRemaining=="function"?s.timeRemaining()>0:!0)?e(o,r):i()},{fast:n})}i()})))}function xe(t){return t=t.trim(),!t||/\:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function Ce(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let r=n?xe(o):o;return`:where(${e} ${r})`}).join(", ")}function ke(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,r,i)=>{let s=Ce(i,e,!0);return`${o}${r}${s}{`}),t):""}function Ae(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function $e(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
3
3
  `});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let r of o.cssRules)e+=r.cssText+`
4
4
  `}catch{}}catch{}return e}function Ee(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 Me(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 ve(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 Fe(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 Le(t,e,n){let o=[];for(let r of e){let i=Fe(t,r);i&&o.push(`${r}: ${i};`)}return o.length?`${n}{${o.join("")}}
5
- `:""}function Re(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 Te(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)await new Promise(i=>setTimeout(i,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}function Ne(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,i=0;try{let f=getComputedStyle(t);n=parseFloat(f.borderLeftWidth)||0,o=parseFloat(f.borderRightWidth)||0,r=parseFloat(f.borderTopWidth)||0,i=parseFloat(f.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+o))),a=Math.max(0,Math.round(e.height-(r+i)));return{contentWidth:s,contentHeight:a,rect:e}}function Ie(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 Pe(t,e,n){let o=await Te(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:i,rect:s}=Ne(t),a=n?.snap;if(!a||typeof a.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let f={...n,scale:1},c=Ie(o,r,i),l;try{l=await a.toPng(o.documentElement,f)}finally{c()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${i}px`;let d=document.createElement("div");return e.nodeMap.set(d,t),tt(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(s.width)}px`),d.style.height||(d.style.height=`${Math.round(s.height)}px`),d.appendChild(l),d}async function at(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,r=null,i=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||ut.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){let c=document.createElement("div"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,c}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){let l=document.createElement("div"),d=t.getBoundingClientRect();return l.style.cssText=`display:inline-block;width:${d.width}px;height:${d.height}px;visibility:hidden;`,l}}catch(l){console.warn(`Invalid selector in exclude option: ${c}`,l)}if(typeof n.filter=="function")try{if(!n.filter(t)){let c=document.createElement("div"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,c}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Pe(t,e,n)}catch(l){console.warn("[SnapDOM] iframe rasterization failed, fallback:",l)}if(n.placeholders){let l=document.createElement("div");return l.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;`,tt(t,l,e,n),l}else{let l=t.getBoundingClientRect(),d=document.createElement("div");return d.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,tt(t,d,e,n),d}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),tt(t,c,e,n);let l=document.createElement("div");return l.textContent=t.getAttribute("data-placeholder-text")||"",l.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(l),c}if(t.tagName==="CANVAS"){let c=t.toDataURL(),l=document.createElement("img");return l.src=c,l.width=t.width,l.height=t.height,e.nodeMap.set(l,t),tt(t,l,e,n),l}let s;try{if(s=t.cloneNode(!1),e.nodeMap.set(s,t),t.tagName==="IMG"){Me(t,s);try{let c=t.getBoundingClientRect(),l=Math.round(c.width||0),d=Math.round(c.height||0);if(!l||!d){let x=window.getComputedStyle(t),R=parseFloat(x.width)||0,C=parseFloat(x.height)||0,k=parseInt(t.getAttribute("width")||"",10)||0,w=parseInt(t.getAttribute("height")||"",10)||0,F=t.width||t.naturalWidth||0,M=t.height||t.naturalHeight||0;l=Math.round(l||R||k||F||0),d=Math.round(d||C||w||M||0)}l&&(s.dataset.snapdomWidth=String(l)),d&&(s.dataset.snapdomHeight=String(d))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(i=t.value),tt(t,s,e,n),t.shadowRoot){let w=function(M,T){if(M.nodeType===Node.ELEMENT_NODE&&M.tagName==="STYLE")return T(null);at(M,e,n).then(_=>{T(_||null)}).catch(_=>{T(null)})};try{let M=t.shadowRoot.querySelectorAll("slot");for(let T of M){let _=[];try{_=T.assignedNodes?.({flatten:!0})||T.assignedNodes?.()||[]}catch{_=T.assignedNodes?.()||[]}for(let q of _)o.add(q)}}catch{}let c=Ae(e),l=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let d=$e(t.shadowRoot),x=ke(d,l),R=ve(d),C=Le(t,R,l);Ee(s,C+x,c);let k=document.createDocumentFragment(),F=await Nt(Array.from(t.shadowRoot.childNodes),w,n.fast);k.append(...F.filter(M=>!!M)),s.appendChild(k)}if(t.tagName==="SLOT"){let x=function(C,k){at(C,e,n).then(w=>{w&&Re(w),k(w||null)}).catch(w=>{k(null)})},c=t.assignedNodes?.({flatten:!0})||[],l=c.length>0?c:Array.from(t.childNodes),d=document.createDocumentFragment(),R=await Nt(Array.from(l),x,n.fast);return d.append(...R.filter(C=>!!C)),d}function a(c,l){if(o.has(c))return l(null);at(c,e,n).then(d=>{l(d||null)}).catch(d=>{l(null)})}let f=await Nt(Array.from(t.childNodes),a,n.fast);if(s.append(...f.filter(c=>!!c)),r!==null&&s instanceof HTMLSelectElement){s.value=r;for(let c of s.options)c.value===r?c.setAttribute("selected",""):c.removeAttribute("selected")}return i!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=i),s}var _e=[/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],It=[];function zt(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?It.push(n):typeof n=="string"?It.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function H(t){let e=typeof t=="string"?t:"",n=[..._e,...It];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))}async function Vt(t,e,n,o=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let i=window.devicePixelRatio||1;await document.fonts.ready;let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${o}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let a=s.getBoundingClientRect(),f=Math.ceil(a.width),c=Math.ceil(a.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=f*i,l.height=c*i;let d=l.getContext("2d");return d.scale(i,i),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(t,0,0),{dataUrl:l.toDataURL(),width:f,height:c}}var Ue=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function ht(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Ue.has(n.toLowerCase()))return n}return""}function mt(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 Pt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function We(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Oe(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=mt(n[1]),i=mt(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=mt(e);return{min:o,max:o}}function Be(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function De(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let i=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(i,s),max:Math.max(i,s)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function qe(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(a=>r.endsWith(a)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let a of e){let f=a.toLowerCase().replace(/\s+/g,"+"),c=a.toLowerCase().replace(/\s+/g,"-");if(s.includes(f)||s.includes(c))return!0}return!1}catch{return!1}}function je(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}async function pt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let i=new Map;for(let u of t){let[p,g,b,m]=String(u).split("__");if(!p)continue;let y=i.get(p)||[];y.push({w:parseInt(g,10),s:b,st:parseInt(m,10)}),i.set(p,y)}let s=/@import\s+url\(["']?([^"')]+)["']?\)/g,a=/url\((["']?)([^"')]+)\1\)/g,f=/@font-face[^{}]*\{[^}]*\}/g;function c(u,p,g,b){if(!i.has(u))return!1;let m=i.get(u),y=Oe(g),A=Be(p),S=De(b),E=y.min!==y.max,v=y.min,N=$=>A.kind==="normal"&&$==="normal"||A.kind!=="normal"&&($==="italic"||$==="oblique"),W=!1;for(let $ of m){let I=E?$.w>=y.min&&$.w<=y.max:$.w===v,O=N(Pt($.s)),L=$.st>=S.min&&$.st<=S.max;if(I&&O&&L){W=!0;break}}if(W)return!0;if(!E)for(let $ of m){let I=N(Pt($.s)),O=$.st>=S.min&&$.st<=S.max;if(Math.abs(v-$.w)<=300&&I&&O)return!0}return!1}function l(u){if(!u)return[];let p=[],g=u.split(",").map(b=>b.trim()).filter(Boolean);for(let b of g){let m=b.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!m)continue;let y=m[1],A=m[2],S=E=>{if(!E.includes("?"))return parseInt(E,16);let v=parseInt(E.replace(/\?/g,"0"),16),N=parseInt(E.replace(/\?/g,"F"),16);return[v,N]};if(A){let E=S(y),v=S(A),N=Array.isArray(E)?E[0]:E,W=Array.isArray(v)?v[1]:v;p.push([Math.min(N,W),Math.max(N,W)])}else{let E=S(y);Array.isArray(E)?p.push([E[0],E[1]]):p.push([E,E])}}return p}function d(u,p){if(!p.length||!u||u.size===0)return!0;for(let g of u)for(let[b,m]of p)if(g>=b&&g<=m)return!0;return!1}function x(u,p){let g=[];if(!u)return g;for(let b of u.matchAll(a)){let m=(b[2]||"").trim();if(!(!m||m.startsWith("data:"))){if(!/^https?:/i.test(m))try{m=new URL(m,p||location.href).href}catch{}g.push(m)}}return g}async function R(u,p){let g=u;for(let b of u.matchAll(a)){let m=G(b[0]);if(!m)continue;let y=m;if(!y.startsWith("http")&&!y.startsWith("data:"))try{y=new URL(y,p||location.href).href}catch{}if(!H(y)){if(h.resource?.has(y)){h.font?.add(y),g=g.replace(b[0],`url(${h.resource.get(y)})`);continue}if(!h.font?.has(y))try{let A=await B(y,{as:"dataURL",useProxy:r,silent:!0});if(A.ok&&typeof A.data=="string"){let S=A.data;h.resource?.set(y,S),h.font?.add(y),g=g.replace(b[0],`url(${S})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",y)}}}return g}function C(u){if(!u.length)return null;let p=(S,E)=>u.some(([v,N])=>!(N<S||v>E)),g=p(0,255)||p(305,305),b=p(256,591)||p(7680,7935),m=p(880,1023),y=p(1024,1279);return p(7840,7929)||p(258,259)||p(416,417)||p(431,432)?"vietnamese":y?"cyrillic":m?"greek":b?"latin-ext":g?"latin":null}function k(u={}){let p=new Set((u.families||[]).map(m=>String(m).toLowerCase())),g=new Set((u.domains||[]).map(m=>String(m).toLowerCase())),b=new Set((u.subsets||[]).map(m=>String(m).toLowerCase()));return(m,y)=>{if(p.size&&p.has(m.family.toLowerCase()))return!0;if(g.size)for(let A of m.srcUrls)try{if(g.has(new URL(A).host.toLowerCase()))return!0}catch{}if(b.size){let A=C(y);if(A&&b.has(A))return!0}return!1}}let w=k(n);function F(u){if(!u)return u;let p=/@font-face[^{}]*\{[^}]*\}/gi,g=new Set,b=[];for(let y of u.match(p)||[]){let A=y.match(/font-family:\s*([^;]+);/i)?.[1]||"",S=ht(A),E=(y.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(y.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),N=(y.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(y.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),$=(y.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),I=x($,location.href),O=I.length?I.map(j=>String(j).toLowerCase()).sort().join("|"):$.toLowerCase(),L=[String(S||"").toLowerCase(),E,v,N,W.toLowerCase(),O].join("|");g.has(L)||(g.add(L),b.push(y))}if(b.length===0)return u;let m=0;return u.replace(p,()=>b[m++]||"")}function M(){let u=Array.from(t||[]).sort().join("|"),p=n?JSON.stringify({families:(n.families||[]).map(m=>String(m).toLowerCase()).sort(),domains:(n.domains||[]).map(m=>String(m).toLowerCase()).sort(),subsets:(n.subsets||[]).map(m=>String(m).toLowerCase()).sort()}):"",g=(o||[]).map(m=>`${(m.family||"").toLowerCase()}::${m.weight||"normal"}::${m.style||"normal"}::${m.src||""}`).sort().join("|");return`fonts-embed-css::req=${u}::ex=${p}::lf=${g}::px=${r||""}`}let T=M();if(h.resource?.has(T))return h.resource.get(T);let _=je(t),q=[];for(let u of document.querySelectorAll("style")){let p=u.textContent||"";for(let g of p.matchAll(s)){let b=g[1];if(!b||H(b))continue;!!document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||q.push(b)}}q.length&&await Promise.all(q.map(u=>new Promise(p=>{if(document.querySelector(`link[rel="stylesheet"][href="${u}"]`))return p(null);let g=document.createElement("link");g.rel="stylesheet",g.href=u,g.setAttribute("data-snapdom","injected-import"),g.onload=()=>p(g),g.onerror=()=>p(null),document.head.appendChild(g)})));let U="",D=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(u=>!!u.href);for(let u of D)try{if(H(u.href))continue;let p="",g=!1;try{g=new URL(u.href,location.href).origin===location.origin}catch{}if(!g&&!qe(u.href,_))continue;if(g){let m=Array.from(document.styleSheets).find(y=>y.href===u.href);if(m)try{let y=m.cssRules||[];p=Array.from(y).map(A=>A.cssText).join("")}catch{}}if(!p&&(p=(await B(u.href,{as:"text",useProxy:r})).data,H(u.href)))continue;let b="";for(let m of p.match(f)||[]){let y=(m.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),A=ht(y);if(!A||H(A))continue;let S=(m.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),E=(m.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),v=(m.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),N=(m.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),W=(m.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=x(W,u.href);if(!c(A,E,S,v))continue;let I=l(N);if(!d(e,I))continue;let O={family:A,weightSpec:S,styleSpec:E,stretchSpec:v,unicodeRange:N,srcRaw:W,srcUrls:$,href:u.href};if(n&&w(O,I))continue;let L=/url\(/i.test(W)?await R(m,u.href):m;b+=L+""}b.trim()&&(U+=b+"")}catch{console.warn("[snapdom] Failed to process stylesheet:",u.href)}for(let u of document.styleSheets)try{if(u.href&&D.some(g=>g.href===u.href))continue;let p=u.cssRules||[];for(let g of p){if(g.type!==CSSRule.FONT_FACE_RULE)continue;let b=(g.style.getPropertyValue("font-family")||"").trim(),m=ht(b);if(!m||H(m))continue;let y=(g.style.getPropertyValue("font-weight")||"400").trim(),A=(g.style.getPropertyValue("font-style")||"normal").trim(),S=(g.style.getPropertyValue("font-stretch")||"100%").trim(),E=(g.style.getPropertyValue("src")||"").trim(),v=(g.style.getPropertyValue("unicode-range")||"").trim(),N=x(E,u.href||location.href);if(!c(m,A,y,S))continue;let W=l(v);if(!d(e,W))continue;let $={family:m,weightSpec:y,styleSpec:A,stretchSpec:S,unicodeRange:v,srcRaw:E,srcUrls:N,href:u.href||location.href};if(!(n&&w($,W)))if(/url\(/i.test(E)){let I=await R(E,u.href||location.href);U+=`@font-face{font-family:${m};src:${I};font-style:${A};font-weight:${y};font-stretch:${S};${v?`unicode-range:${v};`:""}}`}else U+=`@font-face{font-family:${m};src:${E};font-style:${A};font-weight:${y};font-stretch:${S};${v?`unicode-range:${v};`:""}}`}}catch{}try{for(let u of document.fonts||[]){if(!u||!u.family||u.status!=="loaded"||!u._snapdomSrc)continue;let p=String(u.family).replace(/^['"]+|['"]+$/g,"");if(H(p)||!i.has(p)||n?.families&&n.families.some(b=>String(b).toLowerCase()===p.toLowerCase()))continue;let g=u._snapdomSrc;if(!String(g).startsWith("data:")){if(h.resource?.has(u._snapdomSrc))g=h.resource.get(u._snapdomSrc),h.font?.add(u._snapdomSrc);else if(!h.font?.has(u._snapdomSrc))try{let b=await B(u._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(b.ok&&typeof b.data=="string")g=b.data,h.resource?.set(u._snapdomSrc,g),h.font?.add(u._snapdomSrc);else continue}catch{console.warn("[snapdom] Failed to fetch dynamic font src:",u._snapdomSrc);continue}}U+=`@font-face{font-family:'${p}';src:url(${g});font-style:${u.style||"normal"};font-weight:${u.weight||"normal"};}`}}catch{}for(let u of o){if(!u||typeof u!="object")continue;let p=String(u.family||"").replace(/^['"]+|['"]+$/g,"");if(!p||H(p)||!i.has(p)||n?.families&&n.families.some(S=>String(S).toLowerCase()===p.toLowerCase()))continue;let g=u.weight!=null?String(u.weight):"normal",b=u.style!=null?String(u.style):"normal",m=u.stretchPct!=null?`${u.stretchPct}%`:"100%",y=String(u.src||""),A=y;if(!A.startsWith("data:")){if(h.resource?.has(y))A=h.resource.get(y),h.font?.add(y);else if(!h.font?.has(y))try{let S=await B(y,{as:"dataURL",useProxy:r,silent:!0});if(S.ok&&typeof S.data=="string")A=S.data,h.resource?.set(y,A),h.font?.add(y);else continue}catch{console.warn("[snapdom] Failed to fetch localFonts src:",y);continue}}U+=`@font-face{font-family:'${p}';src:url(${A});font-style:${b};font-weight:${g};font-stretch:${m};}`}return U&&(U=F(U),h.resource?.set(T,U)),U}function gt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=s=>{let a=ht(s.fontFamily);if(!a)return;let f=(c,l,d)=>`${a}__${mt(c)}__${Pt(l)}__${We(d)}`;e.add(f(s.fontWeight,s.fontStyle,s.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let i=getComputedStyle(t,"::after");for(i&&i.content&&i.content!=="none"&&o(i);n.nextNode();){let s=n.currentNode,a=getComputedStyle(s);o(a);let f=getComputedStyle(s,"::before");f&&f.content&&f.content!=="none"&&o(f);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&o(c)}return e}function yt(t){let e=new Set,n=r=>{if(r)for(let i of r)e.add(i.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let i=r;for(let s of["::before","::after"]){let f=getComputedStyle(i,s)?.getPropertyValue("content");if(!(!f||f==="none"))if(/^"/.test(f)||/^'/.test(f))n(f.slice(1,-1));else{let c=f.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let l of c)try{e.add(parseInt(l.slice(1),16))}catch{}}}}}return e}async function wt(t,e=1){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position: absolute !important;left: -9999px !important;top: 0 !important;opacity: 0 !important;pointer-events: none !important;contain: layout size style;";for(let i of n){let s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${i}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",r.appendChild(s)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i)))}async function _t(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;for(let s of["::before","::after","::first-letter"])try{let a=Z(t,s);if(!a||typeof a[Symbol.iterator]!="function"||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(s==="::first-letter"){let $=getComputedStyle(t);if(!(a.color!==$.color||a.fontSize!==$.fontSize||a.fontWeight!==$.fontWeight))continue;let O=Array.from(e.childNodes).find(Ot=>Ot.nodeType===Node.TEXT_NODE&&Ot.textContent?.trim().length>0);if(!O)continue;let L=O.textContent,et=L.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Ct=L.slice(et?.length||0);if(!et||/[\uD800-\uDFFF]/.test(et))continue;let z=document.createElement("span");z.textContent=et,z.dataset.snapdomPseudo="::first-letter";let re=dt(a),se=ot(re,"span");n.styleMap.set(z,se);let Wt=document.createTextNode(Ct);e.replaceChild(Wt,O),e.insertBefore(z,Wt);continue}let c=a.content,l=/counter\s*\(|counters\s*\(/.test(c)?"- ":Lt(c),d=a.backgroundImage,x=a.backgroundColor,R=a.fontFamily,C=parseInt(a.fontSize)||32,k=parseInt(a.fontWeight)||!1,w=a.color||"#000",F=a.display,M=parseFloat(a.width),T=parseFloat(a.height),_=a.borderStyle,q=parseFloat(a.borderWidth),U=a.transform,D=H(R),u=c!=="none"&&l!=="",p=d&&d!=="none",g=x&&x!=="transparent"&&x!=="rgba(0, 0, 0, 0)",b=F!=="inline"&&(M>0||T>0),m=_&&_!=="none"&&q>0,y=U&&U!=="none";if(!(u||p||g||b||m||y))continue;let S=document.createElement("span");S.dataset.snapdomPseudo=s,S.style.verticalAlign="middle";let E=dt(a),v=ot(E,"span");if(n.styleMap.set(S,v),D&&l.length===1){let{dataUrl:$,width:I,height:O}=await Vt(l,R,k,C,w),L=document.createElement("img");L.src=$,L.style=`height:${C}px;width:${I/O*C}px;object-fit:contain;`,S.appendChild(L),e.dataset.snapdomHasIcon="true"}else if(l.startsWith("url(")){let $=G(l);if($?.trim())try{let I=document.createElement("img"),O=await B(rt($),{as:"dataURL",useProxy:o.useProxy});I.src=O.data,I.style=`width:${C}px;height:auto;object-fit:contain;`,S.appendChild(I)}catch(I){console.error(`[snapdom] Error in pseudo ${s} for`,t,I)}}else!D&&u&&(S.textContent=l);if(p)try{let $=Q(d),I=await Promise.all($.map(J));S.style.backgroundImage=I.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${s}`,$)}if(g&&(S.style.backgroundColor=x),!(S.childNodes.length>0||S.textContent?.trim()!==""||p||g||b||m||y))continue;s==="::before"?e.insertBefore(S,e.firstChild):e.appendChild(S)}catch(a){console.warn(`[snapdom] Failed to capture ${s} for`,t,a)}let r=Array.from(t.children),i=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(r.length,i.length);s++)await _t(r[s],i[s],n,o)}function Xt(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(a=>{let f=a.getAttribute("xlink:href")||a.getAttribute("href");f&&f.startsWith("#")&&e.add(f.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(a=>a.tagName.toLowerCase()==="symbol"),r=n.filter(a=>a.tagName.toLowerCase()==="defs"),i=t.querySelector("svg.inline-defs-container");i||(i=document.createElementNS("http://www.w3.org/2000/svg","svg"),i.setAttribute("aria-hidden","true"),i.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),i.classList.add("inline-defs-container"),t.insertBefore(i,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(a=>{s.add(a.id)}),e.forEach(a=>{if(s.has(a))return;let f=o.find(c=>c.id===a);if(f){i.appendChild(f.cloneNode(!0)),s.add(a);return}for(let c of r){let l=c.querySelector(`#${CSS.escape(a)}`);if(l){let d=i.querySelector("defs");d||(d=document.createElementNS("http://www.w3.org/2000/svg","defs"),i.appendChild(d)),d.appendChild(l.cloneNode(!0)),s.add(a);break}}})}async function Gt(t,e={}){let n={styleMap:h.session.styleMap,styleCache:h.session.styleCache,nodeMap:h.session.nodeMap},o,r="",i="";He(t);try{Xt(t)}catch(a){console.warn("inlineExternal defs or symbol failed:",a)}try{o=await at(t,n,e,t)}catch(a){throw console.warn("deepClone failed:",a),a}try{await _t(t,o,n,e)}catch(a){console.warn("inlinePseudoElements failed:",a)}await Ke(o);try{let a=o.querySelectorAll("style[data-sd]");for(let f of a)i+=f.textContent||"",f.remove()}catch{}let s=Ft(n.styleMap);r=Array.from(s.entries()).map(([a,f])=>`.${f}{${a}}`).join(""),r=i+r;for(let[a,f]of n.styleMap.entries()){if(a.tagName==="STYLE")continue;if(a.getRootNode&&a.getRootNode()instanceof ShadowRoot){a.setAttribute("style",f.replace(/;/g,"; "));continue}let c=s.get(f);c&&a.classList.add(c);let l=a.style?.backgroundImage,d=a.dataset?.snapdomHasIcon;l&&l!=="none"&&(a.style.backgroundImage=l),d&&(a.style.verticalAlign="middle",a.style.display="inline")}for(let[a,f]of n.nodeMap.entries()){let c=f.scrollLeft,l=f.scrollTop;if((c||l)&&a instanceof HTMLElement){a.style.overflow="hidden",a.style.scrollbarWidth="none",a.style.msOverflowStyle="none";let x=document.createElement("div");for(x.style.transform=`translate(${-c}px, ${-l}px)`,x.style.willChange="transform",x.style.display="inline-block",x.style.width="100%";a.firstChild;)x.appendChild(a.firstChild);a.appendChild(x)}}if(t===n.nodeMap.get(o)){let a=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,a);let f=kt(a.transform);o.style.margin="0",o.style.position="static",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.zIndex="auto",o.style.float="none",o.style.clear="none",o.style.transform=f||""}for(let[a,f]of n.nodeMap.entries())f.tagName==="PRE"&&(a.style.marginTop="0",a.style.marginBlockStart="0");return{clone:o,classCSS:r,styleCache:n.styleCache}}function He(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,i=e.borderWidth,s=n!=="none"&&parseFloat(o)>0,a=r==="none"||parseFloat(i)===0;s&&a&&(t.style.border=`${o} solid transparent`)}var it=new Map;async function ct(t){if(h.resource?.has(t))return h.resource.get(t);if(it.has(t))return it.get(t);let e=(async()=>{let n=await B(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return h.resource?.set(t,n.data),n.data})();it.set(t,e);try{let n=await e;return it.set(t,n),n}catch(n){throw it.delete(t),n}}var ze=/\bblob:[^)"'\s]+/g;async function Kt(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ze)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=await ct(o);n=n.split(o).join(r)}catch{}return n}function bt(t){return typeof t=="string"&&t.startsWith("blob:")}function Ve(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 Xe(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function Ke(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let f=s.getAttribute("src")||s.currentSrc||"";if(bt(f)){let l=await ct(f);s.setAttribute("src",l)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let l=Ve(c),d=!1;for(let x of l)if(bt(x.url))try{x.url=await ct(x.url),d=!0}catch{}d&&s.setAttribute("srcset",Xe(l))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let a="http://www.w3.org/1999/xlink",f=s.getAttribute("href")||s.getAttributeNS?.(a,"href");if(bt(f)){let c=await ct(f);s.setAttribute("href",c),s.removeAttributeNS?.(a,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of o)try{let a=s.getAttribute("style");if(a&&a.includes("blob:")){let f=await Kt(a);s.setAttribute("style",f)}}catch{}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of r)try{let a=s.textContent||"";a.includes("blob:")&&(s.textContent=await Kt(a))}catch{}let i=["poster"];for(let s of i){let a=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let f of a)try{let c=f.getAttribute(s);bt(c)&&f.setAttribute(s,await ct(c))}catch{}}}async function Yt(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async r=>{if(!r.getAttribute("src")){let l=r.currentSrc||r.src||"";l&&r.setAttribute("src",l)}r.removeAttribute("srcset"),r.removeAttribute("sizes");let i=r.src||"";if(!i)return;let s=await B(i,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){r.src=s.data,r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}let{defaultImageUrl:a}=e||{};if(a)try{let l=parseInt(r.dataset?.snapdomWidth||"",10)||0,d=parseInt(r.dataset?.snapdomHeight||"",10)||0,x=parseInt(r.getAttribute("width")||"",10)||0,R=parseInt(r.getAttribute("height")||"",10)||0,C=parseFloat(r.style?.width||"")||0,k=parseFloat(r.style?.height||"")||0,w=l||C||x||r.width||void 0,F=d||k||R||r.height||void 0,M=typeof a=="function"?await a({width:w,height:F,src:i,element:r}):a;if(M){let T=await B(M,{as:"dataURL",useProxy:e.useProxy});r.src=T.data,!r.width&&w&&(r.width=w),!r.height&&F&&(r.height=F),r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}}catch{}let f=r.width||r.naturalWidth||100,c=r.height||r.naturalHeight||100;if(e.placeholders!==!1){let l=document.createElement("div");l.style.cssText=[`width:${f}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),l.textContent="img",r.replaceWith(l)}else{let l=document.createElement("div");l.style.cssText=`display:inline-block;width:${f}px;height:${c}px;visibility:hidden;`,r.replaceWith(l)}};for(let r=0;r<n.length;r+=4){let i=n.slice(r,r+4).map(o);await Promise.allSettled(i)}}async function St(t,e,n,o={}){let r=[[t,e]],i=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],s=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],a=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){let[f,c]=r.shift(),l=n.get(f)||Z(f);n.has(f)||n.set(f,l);let d=(()=>{let C=l.getPropertyValue("border-image"),k=l.getPropertyValue("border-image-source");return C&&C!=="none"||k&&k!=="none"})();for(let C of i){let k=l.getPropertyValue(C);if(!k||k==="none")continue;let w=Q(k),F=await Promise.all(w.map(M=>J(M,o)));F.some(M=>M&&M!=="none"&&!/^url\(undefined/.test(M))&&c.style.setProperty(C,F.join(", "))}for(let C of s){let k=l.getPropertyValue(C);!k||k==="initial"||c.style.setProperty(C,k)}if(d)for(let C of a){let k=l.getPropertyValue(C);!k||k==="initial"||c.style.setProperty(C,k)}let x=Array.from(f.children),R=Array.from(c.children);for(let C=0;C<Math.min(x.length,R.length);C++)r.push([x[C],R[C]])}}async function Zt(t,e){if(!t)throw new Error("Element cannot be null or undefined");lt(e.cache);let n=e.fast,o,r,i,s="",a="",f,c;({clone:o,classCSS:r,styleCache:i}=await Gt(t,e)),await new Promise(R=>{V(async()=>{await Yt(o,e),R()},{fast:n})}),await new Promise(R=>{V(async()=>{await St(t,o,i,e),R()},{fast:n})}),e.embedFonts&&await new Promise(R=>{V(async()=>{let C=gt(t),k=yt(t);if(X){let w=new Set(Array.from(C).map(F=>String(F).split("__")[0]).filter(Boolean));await wt(w,2)}s=await pt({required:C,usedCodepoints:k,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),R()},{fast:n})});let l=Mt(o).sort(),d=l.join(",");h.baseStyle.has(d)?a=h.baseStyle.get(d):await new Promise(R=>{V(()=>{a=vt(l),h.baseStyle.set(d,a),R()},{fast:n})}),await new Promise(R=>{V(()=>{let C=Ge(t),k=C.width,w=C.height,F=Number.isFinite(e.width),M=Number.isFinite(e.height),T=e.scale??1,_=typeof T=="number"&&T!==1;if(!_){let L=C.width/C.height;F&&M?(k=e.width,w=e.height):F?(k=e.width,w=k/L):M&&(w=e.height,k=w*L)}k=Math.max(1,Math.ceil(k)),w=Math.max(1,Math.ceil(w));let q=getComputedStyle(t),U=q.transform&&q.transform!=="none"?q.transform:"",D=Ze(t),u,p,g,b,m=0,y=0;if(Qe(t)){let L=nn({baseTransform:U,rotate:D.rotate||"0deg",scale:D.scale,translate:D.translate}),j=L.e??L.m41??0,et=L.f??L.m42??0;m=-j,y=-et;let Ct=L.is2D?Jt(L):Jt(new DOMMatrix(L.toString())),z=Je(k,w,Ct);u=Math.max(1,Math.ceil(z.width)),p=Math.max(1,Math.ceil(z.height)),g=-z.minX,b=-z.minY}else{let L=t.getBoundingClientRect(),j=tn(L,{top:0,right:0,bottom:0,left:0});u=Math.max(1,j.width),p=Math.max(1,j.height),g=-(j.x-Math.floor(L.left)),b=-(j.y-Math.floor(L.top))}let A="http://www.w3.org/2000/svg",S=document.createElementNS(A,"foreignObject");S.setAttribute("width","100%"),S.setAttribute("height","100%"),S.setAttribute("x",String(g)),S.setAttribute("y",String(b)),S.style.overflow="visible";let E=document.createElement("style");E.textContent=a+s+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,S.appendChild(E);let v=document.createElement("div");v.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),v.style.width=`${k}px`,v.style.height=`${w}px`,v.style.overflow="visible",v.style.transformOrigin="0 0";let N=[];if((m||y)&&N.push(`translate(${m}px, ${y}px)`),!_&&(F||M)){let L=C.width?k/C.width:1,j=C.height?w/C.height:1;N.push(`scale(${L}, ${j})`)}else _&&N.push(`scale(${T})`);N.length&&(v.style.transform=N.join(" ")),o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),o.style.transformOrigin="0 0",o.style.position="static",o.style.left="0",o.style.top="0",U&&(o.style.transform=U),o.style.rotate=D.rotate||"0deg",o.style.scale=D.scale||"1",o.style.translate=D.translate||"0 0",v.appendChild(o),S.appendChild(v);let $=new XMLSerializer().serializeToString(S);c=`<svg xmlns="${A}" width="${u}" height="${p}" viewBox="0 0 ${u} ${p}">`+$+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,R()},{fast:n})});let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),f}function Ge(t){let e=getComputedStyle(t),n=i=>parseFloat(i)||0,o=n(e.width),r=n(e.height);return e.boxSizing==="content-box"&&(o+=n(e.paddingLeft)+n(e.paddingRight)+n(e.borderLeftWidth)+n(e.borderRightWidth),r+=n(e.paddingTop)+n(e.paddingBottom)+n(e.borderTopWidth)+n(e.borderBottomWidth)),{width:o,height:r}}function Ye(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function Jt(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function Je(t,e,n){let r=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(c=>({x:n.a*c.x+n.c*c.y,y:n.b*c.x+n.d*c.y})),i=Math.min(...r.map(c=>c.x)),s=Math.max(...r.map(c=>c.x)),a=Math.min(...r.map(c=>c.y)),f=Math.max(...r.map(c=>c.y));return{minX:i,minY:a,width:s-i,height:f-a}}function Ze(t){let e={rotate:"0deg",scale:null,translate:null},n=t.computedStyleMap?.();if(n){let r=n.get("rotate");if(r){let a=r.angle??r;a&&"unit"in a?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(r)}let i=n.get("scale");if(i&&i.length){let a=i[0]?.value??1,f=i[1]?.value??a;e.scale=`${a} ${f}`}let s=n.get("translate");if(s&&s.length){let a=s[0]?.value??0,f=s[1]?.value??0,c=s[0]?.unit??"px",l=s[1]?.unit??"px";e.translate=`${a}${c} ${f}${l}`}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}function Qe(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function tn(t,e){let n=Math.floor(t.left-e.left),o=Math.floor(t.top-e.top),r=Math.ceil(t.width+e.left+e.right),i=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:o,width:r,height:i}}var Ut=null;function en(){if(Ut)return Ut;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),Ut=t,t}function nn(t){let e=en(),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=Ye(n);return e.removeChild(n),o}function on(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Qt(t={}){let e=t.format??"png",n=on(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],filter:t.filter??null,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,defaultImageUrl:t.defaultImageUrl??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??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM"}}async function te(t,e){let n=new Image;return n.src=t,await n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n}async function K(t,e){let{scale:n,dpr:o}=e,r=X(),i=new Image;i.crossOrigin="anonymous",i.loading="eager",i.decoding="sync",i.src=t;let s=null;r&&(s=document.createElement("div"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none;contain:size layout style;",document.body.appendChild(s),s.appendChild(i)),await i.decode(),r&&await new Promise(d=>setTimeout(d,100));let a=i.naturalWidth*n,f=i.naturalHeight*n,c=document.createElement("canvas");c.width=Math.ceil(a*o),c.height=Math.ceil(f*o),c.style.width=`${a}px`,c.style.height=`${f}px`;let l=c.getContext("2d");if(o!==1&&l.scale(o,o),l.drawImage(i,0,0,a,f),s&&s.parentNode)try{s.parentNode.removeChild(s)}catch{}return c}async function xt(t,e){let n=e.type;if(n==="svg"){let i=decodeURIComponent(t.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let o=await K(t,e),r=e.backgroundColor?Y(o,e.backgroundColor):o;return new Promise(i=>r.toBlob(s=>i(s),`image/${n}`,e.quality))}async function ee(t,e){let n=await K(t,e),o=e.backgroundColor?Y(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=`${o.width/e.dpr}px`,r.style.height=`${o.height/e.dpr}px`,r}async function ne(t,e){if(e.format==="svg"){let i=await xt(t,{...e,type:"svg"}),s=URL.createObjectURL(i),a=document.createElement("a");a.href=s,a.download=e.filename,a.click(),URL.revokeObjectURL(s);return}let n=await K(t,e),o=e.backgroundColor?Y(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}var oe=Symbol("snapdom.internal");async function P(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Qt(e);return n.iconFonts&&n.iconFonts.length>0&&zt(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>P.toPng(o,r),toImg:(o,r)=>P.toImg(o,r)}),P.capture(t,n,oe)}P.capture=async(t,e,n)=>{if(n!==oe)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Zt(t,e),r=s=>({...e,...s||{}}),i=s=>a=>{let f=r({...a||{},format:s}),c=s==="jpeg"||s==="jpg",l=f.backgroundColor==null||f.backgroundColor==="transparent";return c&&l&&(f.backgroundColor="#ffffff"),ee(o,f)};return{url:o,toRaw:()=>o,toImg:s=>te(o,r(s)),toCanvas:s=>K(o,r(s)),toBlob:s=>xt(o,r(s)),toPng:i("png"),toJpg:i("jpeg"),toWebp:i("webp"),download:s=>ne(o,r(s))}};P.toRaw=(t,e)=>P(t,e).then(n=>n.toRaw());P.toImg=(t,e)=>P(t,e).then(n=>n.toImg());P.toCanvas=(t,e)=>P(t,e).then(n=>n.toCanvas());P.toBlob=(t,e)=>P(t,e).then(n=>n.toBlob());P.toPng=(t,e)=>P(t,{...e,format:"png"}).then(n=>n.toPng());P.toJpg=(t,e)=>P(t,{...e,format:"jpeg"}).then(n=>n.toJpg());P.toWebp=(t,e)=>P(t,{...e,format:"webp"}).then(n=>n.toWebp());P.download=(t,e)=>P(t,e).then(n=>n.download());async function rn(t=document,e={}){let{embedFonts:n=!0,cacheOpt:o="full",useProxy:r=""}=e;lt(o);try{await document.fonts.ready}catch{}$t(),h.session=h.session||{},h.session.styleCache||(h.session.styleCache=new WeakMap);try{await St(t,void 0,h.session.styleCache,{useProxy:r})}catch{}let i=[],s=[];try{t?.querySelectorAll&&(i=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let a=[];for(let f of i){let c=f?.src;if(c&&!h.image.has(c)){let l=Promise.resolve().then(()=>B(c,{as:"dataURL",useProxy:r})).then(d=>{h.image.set(c,d)}).catch(()=>{});a.push(l)}}for(let f of s){let c="";try{c=Z(f).backgroundImage}catch{}if(c&&c!=="none"){let l=Q(c);for(let d of l)if(d.startsWith("url(")){let x=Promise.resolve().then(()=>J(d,{...e,useProxy:r})).catch(()=>{});a.push(x)}}}if(n)try{let f=gt(t),c=yt(t);if(typeof X=="function"?X():X){let l=new Set(Array.from(f).map(d=>String(d).split("__")[0]).filter(Boolean));await wt(l,2)}await pt({required:f,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(a)}export{rn as preCache,P as snapdom};
5
+ `:""}function Re(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 Te(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)await new Promise(i=>setTimeout(i,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}function Ne(t){let e=t.getBoundingClientRect(),n=0,o=0,r=0,i=0;try{let f=getComputedStyle(t);n=parseFloat(f.borderLeftWidth)||0,o=parseFloat(f.borderRightWidth)||0,r=parseFloat(f.borderTopWidth)||0,i=parseFloat(f.borderBottomWidth)||0}catch{}let s=Math.max(0,Math.round(e.width-(n+o))),a=Math.max(0,Math.round(e.height-(r+i)));return{contentWidth:s,contentHeight:a,rect:e}}function Ie(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 Pe(t,e,n){let o=await Te(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:r,contentHeight:i,rect:s}=Ne(t),a=n?.snap;if(!a||typeof a.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let f={...n,scale:1},c=Ie(o,r,i),l;try{l=await a.toPng(o.documentElement,f)}finally{c()}l.style.display="block",l.style.width=`${r}px`,l.style.height=`${i}px`;let d=document.createElement("div");return e.nodeMap.set(d,t),tt(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(s.width)}px`),d.style.height||(d.style.height=`${Math.round(s.height)}px`),d.appendChild(l),d}async function at(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,r=null,i=null;if(t.nodeType===Node.ELEMENT_NODE){let c=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||ut.has(c))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){let c=document.createElement("div"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,c}if(n.exclude&&Array.isArray(n.exclude))for(let c of n.exclude)try{if(t.matches?.(c)){let l=document.createElement("div"),d=t.getBoundingClientRect();return l.style.cssText=`display:inline-block;width:${d.width}px;height:${d.height}px;visibility:hidden;`,l}}catch(l){console.warn(`Invalid selector in exclude option: ${c}`,l)}if(typeof n.filter=="function")try{if(!n.filter(t)){let c=document.createElement("div"),l=t.getBoundingClientRect();return c.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,c}}catch(c){console.warn("Error in filter function:",c)}if(t.tagName==="IFRAME"){let c=!1;try{c=!!(t.contentDocument||t.contentWindow?.document)}catch{c=!1}if(c)try{return await Pe(t,e,n)}catch(l){console.warn("[SnapDOM] iframe rasterization failed, fallback:",l)}if(n.placeholders){let l=document.createElement("div");return l.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;`,tt(t,l,e,n),l}else{let l=t.getBoundingClientRect(),d=document.createElement("div");return d.style.cssText=`display:inline-block;width:${l.width}px;height:${l.height}px;visibility:hidden;`,tt(t,d,e,n),d}}if(t.getAttribute("data-capture")==="placeholder"){let c=t.cloneNode(!1);e.nodeMap.set(c,t),tt(t,c,e,n);let l=document.createElement("div");return l.textContent=t.getAttribute("data-placeholder-text")||"",l.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",c.appendChild(l),c}if(t.tagName==="CANVAS"){let c=t.toDataURL(),l=document.createElement("img");return l.src=c,l.width=t.width,l.height=t.height,e.nodeMap.set(l,t),tt(t,l,e,n),l}let s;try{if(s=t.cloneNode(!1),e.nodeMap.set(s,t),t.tagName==="IMG"){Me(t,s);try{let c=t.getBoundingClientRect(),l=Math.round(c.width||0),d=Math.round(c.height||0);if(!l||!d){let x=window.getComputedStyle(t),R=parseFloat(x.width)||0,C=parseFloat(x.height)||0,k=parseInt(t.getAttribute("width")||"",10)||0,w=parseInt(t.getAttribute("height")||"",10)||0,F=t.width||t.naturalWidth||0,M=t.height||t.naturalHeight||0;l=Math.round(l||R||k||F||0),d=Math.round(d||C||w||M||0)}l&&(s.dataset.snapdomWidth=String(l)),d&&(s.dataset.snapdomHeight=String(d))}catch{}}}catch(c){throw console.error("[Snapdom] Failed to clone node:",t,c),c}if(t instanceof HTMLTextAreaElement){let c=t.getBoundingClientRect();s.style.width=`${c.width}px`,s.style.height=`${c.height}px`}if(t instanceof HTMLInputElement&&(s.value=t.value,s.setAttribute("value",t.value),t.checked!==void 0&&(s.checked=t.checked,t.checked&&s.setAttribute("checked",""),t.indeterminate&&(s.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(i=t.value),tt(t,s,e,n),t.shadowRoot){let w=function(M,T){if(M.nodeType===Node.ELEMENT_NODE&&M.tagName==="STYLE")return T(null);at(M,e,n).then(_=>{T(_||null)}).catch(_=>{T(null)})};try{let M=t.shadowRoot.querySelectorAll("slot");for(let T of M){let _=[];try{_=T.assignedNodes?.({flatten:!0})||T.assignedNodes?.()||[]}catch{_=T.assignedNodes?.()||[]}for(let q of _)o.add(q)}}catch{}let c=Ae(e),l=`[data-sd="${c}"]`;try{s.setAttribute("data-sd",c)}catch{}let d=$e(t.shadowRoot),x=ke(d,l),R=ve(d),C=Le(t,R,l);Ee(s,C+x,c);let k=document.createDocumentFragment(),F=await Nt(Array.from(t.shadowRoot.childNodes),w,n.fast);k.append(...F.filter(M=>!!M)),s.appendChild(k)}if(t.tagName==="SLOT"){let x=function(C,k){at(C,e,n).then(w=>{w&&Re(w),k(w||null)}).catch(w=>{k(null)})},c=t.assignedNodes?.({flatten:!0})||[],l=c.length>0?c:Array.from(t.childNodes),d=document.createDocumentFragment(),R=await Nt(Array.from(l),x,n.fast);return d.append(...R.filter(C=>!!C)),d}function a(c,l){if(o.has(c))return l(null);at(c,e,n).then(d=>{l(d||null)}).catch(d=>{l(null)})}let f=await Nt(Array.from(t.childNodes),a,n.fast);if(s.append(...f.filter(c=>!!c)),r!==null&&s instanceof HTMLSelectElement){s.value=r;for(let c of s.options)c.value===r?c.setAttribute("selected",""):c.removeAttribute("selected")}return i!==null&&s instanceof HTMLTextAreaElement&&(s.textContent=i),s}var _e=[/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],It=[];function zt(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?It.push(n):typeof n=="string"?It.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function H(t){let e=typeof t=="string"?t:"",n=[..._e,...It];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))}async function Vt(t,e,n,o=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let i=window.devicePixelRatio||1;await document.fonts.ready;let s=document.createElement("span");s.textContent=t,s.style.position="absolute",s.style.visibility="hidden",s.style.fontFamily=`"${e}"`,s.style.fontWeight=n||"normal",s.style.fontSize=`${o}px`,s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.padding="0",s.style.margin="0",document.body.appendChild(s);let a=s.getBoundingClientRect(),f=Math.ceil(a.width),c=Math.ceil(a.height);document.body.removeChild(s);let l=document.createElement("canvas");l.width=f*i,l.height=c*i;let d=l.getContext("2d");return d.scale(i,i),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(t,0,0),{dataUrl:l.toDataURL(),width:f,height:c}}var Ue=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function ht(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Ue.has(n.toLowerCase()))return n}return""}function mt(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 Pt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function We(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Be(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let r=mt(n[1]),i=mt(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=mt(e);return{min:o,max:o}}function Oe(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function De(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let i=parseFloat(n[1]),s=parseFloat(n[2]);return{min:Math.min(i,s),max:Math.max(i,s)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}function qe(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let r=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(a=>r.endsWith(a)))return!0;let s=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(s)||/\.woff2?(\b|$)/.test(s))return!0;for(let a of e){let f=a.toLowerCase().replace(/\s+/g,"+"),c=a.toLowerCase().replace(/\s+/g,"-");if(s.includes(f)||s.includes(c))return!0}return!1}catch{return!1}}function je(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}async function pt({required:t,usedCodepoints:e,exclude:n=void 0,localFonts:o=[],useProxy:r=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);let i=new Map;for(let u of t){let[p,g,b,m]=String(u).split("__");if(!p)continue;let y=i.get(p)||[];y.push({w:parseInt(g,10),s:b,st:parseInt(m,10)}),i.set(p,y)}let s=/@import\s+url\(["']?([^"')]+)["']?\)/g,a=/url\((["']?)([^"')]+)\1\)/g,f=/@font-face[^{}]*\{[^}]*\}/g;function c(u,p,g,b){if(!i.has(u))return!1;let m=i.get(u),y=Be(g),A=Oe(p),S=De(b),E=y.min!==y.max,v=y.min,N=$=>A.kind==="normal"&&$==="normal"||A.kind!=="normal"&&($==="italic"||$==="oblique"),W=!1;for(let $ of m){let I=E?$.w>=y.min&&$.w<=y.max:$.w===v,B=N(Pt($.s)),L=$.st>=S.min&&$.st<=S.max;if(I&&B&&L){W=!0;break}}if(W)return!0;if(!E)for(let $ of m){let I=N(Pt($.s)),B=$.st>=S.min&&$.st<=S.max;if(Math.abs(v-$.w)<=300&&I&&B)return!0}return!1}function l(u){if(!u)return[];let p=[],g=u.split(",").map(b=>b.trim()).filter(Boolean);for(let b of g){let m=b.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!m)continue;let y=m[1],A=m[2],S=E=>{if(!E.includes("?"))return parseInt(E,16);let v=parseInt(E.replace(/\?/g,"0"),16),N=parseInt(E.replace(/\?/g,"F"),16);return[v,N]};if(A){let E=S(y),v=S(A),N=Array.isArray(E)?E[0]:E,W=Array.isArray(v)?v[1]:v;p.push([Math.min(N,W),Math.max(N,W)])}else{let E=S(y);Array.isArray(E)?p.push([E[0],E[1]]):p.push([E,E])}}return p}function d(u,p){if(!p.length||!u||u.size===0)return!0;for(let g of u)for(let[b,m]of p)if(g>=b&&g<=m)return!0;return!1}function x(u,p){let g=[];if(!u)return g;for(let b of u.matchAll(a)){let m=(b[2]||"").trim();if(!(!m||m.startsWith("data:"))){if(!/^https?:/i.test(m))try{m=new URL(m,p||location.href).href}catch{}g.push(m)}}return g}async function R(u,p){let g=u;for(let b of u.matchAll(a)){let m=G(b[0]);if(!m)continue;let y=m;if(!y.startsWith("http")&&!y.startsWith("data:"))try{y=new URL(y,p||location.href).href}catch{}if(!H(y)){if(h.resource?.has(y)){h.font?.add(y),g=g.replace(b[0],`url(${h.resource.get(y)})`);continue}if(!h.font?.has(y))try{let A=await O(y,{as:"dataURL",useProxy:r,silent:!0});if(A.ok&&typeof A.data=="string"){let S=A.data;h.resource?.set(y,S),h.font?.add(y),g=g.replace(b[0],`url(${S})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",y)}}}return g}function C(u){if(!u.length)return null;let p=(S,E)=>u.some(([v,N])=>!(N<S||v>E)),g=p(0,255)||p(305,305),b=p(256,591)||p(7680,7935),m=p(880,1023),y=p(1024,1279);return p(7840,7929)||p(258,259)||p(416,417)||p(431,432)?"vietnamese":y?"cyrillic":m?"greek":b?"latin-ext":g?"latin":null}function k(u={}){let p=new Set((u.families||[]).map(m=>String(m).toLowerCase())),g=new Set((u.domains||[]).map(m=>String(m).toLowerCase())),b=new Set((u.subsets||[]).map(m=>String(m).toLowerCase()));return(m,y)=>{if(p.size&&p.has(m.family.toLowerCase()))return!0;if(g.size)for(let A of m.srcUrls)try{if(g.has(new URL(A).host.toLowerCase()))return!0}catch{}if(b.size){let A=C(y);if(A&&b.has(A))return!0}return!1}}let w=k(n);function F(u){if(!u)return u;let p=/@font-face[^{}]*\{[^}]*\}/gi,g=new Set,b=[];for(let y of u.match(p)||[]){let A=y.match(/font-family:\s*([^;]+);/i)?.[1]||"",S=ht(A),E=(y.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),v=(y.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),N=(y.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(y.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),$=(y.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),I=x($,location.href),B=I.length?I.map(j=>String(j).toLowerCase()).sort().join("|"):$.toLowerCase(),L=[String(S||"").toLowerCase(),E,v,N,W.toLowerCase(),B].join("|");g.has(L)||(g.add(L),b.push(y))}if(b.length===0)return u;let m=0;return u.replace(p,()=>b[m++]||"")}function M(){let u=Array.from(t||[]).sort().join("|"),p=n?JSON.stringify({families:(n.families||[]).map(m=>String(m).toLowerCase()).sort(),domains:(n.domains||[]).map(m=>String(m).toLowerCase()).sort(),subsets:(n.subsets||[]).map(m=>String(m).toLowerCase()).sort()}):"",g=(o||[]).map(m=>`${(m.family||"").toLowerCase()}::${m.weight||"normal"}::${m.style||"normal"}::${m.src||""}`).sort().join("|");return`fonts-embed-css::req=${u}::ex=${p}::lf=${g}::px=${r||""}`}let T=M();if(h.resource?.has(T))return h.resource.get(T);let _=je(t),q=[];for(let u of document.querySelectorAll("style")){let p=u.textContent||"";for(let g of p.matchAll(s)){let b=g[1];if(!b||H(b))continue;!!document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||q.push(b)}}q.length&&await Promise.all(q.map(u=>new Promise(p=>{if(document.querySelector(`link[rel="stylesheet"][href="${u}"]`))return p(null);let g=document.createElement("link");g.rel="stylesheet",g.href=u,g.setAttribute("data-snapdom","injected-import"),g.onload=()=>p(g),g.onerror=()=>p(null),document.head.appendChild(g)})));let U="",D=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(u=>!!u.href);for(let u of D)try{if(H(u.href))continue;let p="",g=!1;try{g=new URL(u.href,location.href).origin===location.origin}catch{}if(!g&&!qe(u.href,_))continue;if(g){let m=Array.from(document.styleSheets).find(y=>y.href===u.href);if(m)try{let y=m.cssRules||[];p=Array.from(y).map(A=>A.cssText).join("")}catch{}}if(!p&&(p=(await O(u.href,{as:"text",useProxy:r})).data,H(u.href)))continue;let b="";for(let m of p.match(f)||[]){let y=(m.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),A=ht(y);if(!A||H(A))continue;let S=(m.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),E=(m.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),v=(m.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),N=(m.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),W=(m.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),$=x(W,u.href);if(!c(A,E,S,v))continue;let I=l(N);if(!d(e,I))continue;let B={family:A,weightSpec:S,styleSpec:E,stretchSpec:v,unicodeRange:N,srcRaw:W,srcUrls:$,href:u.href};if(n&&w(B,I))continue;let L=/url\(/i.test(W)?await R(m,u.href):m;b+=L+""}b.trim()&&(U+=b+"")}catch{console.warn("[snapdom] Failed to process stylesheet:",u.href)}for(let u of document.styleSheets)try{if(u.href&&D.some(g=>g.href===u.href))continue;let p=u.cssRules||[];for(let g of p){if(g.type!==CSSRule.FONT_FACE_RULE)continue;let b=(g.style.getPropertyValue("font-family")||"").trim(),m=ht(b);if(!m||H(m))continue;let y=(g.style.getPropertyValue("font-weight")||"400").trim(),A=(g.style.getPropertyValue("font-style")||"normal").trim(),S=(g.style.getPropertyValue("font-stretch")||"100%").trim(),E=(g.style.getPropertyValue("src")||"").trim(),v=(g.style.getPropertyValue("unicode-range")||"").trim(),N=x(E,u.href||location.href);if(!c(m,A,y,S))continue;let W=l(v);if(!d(e,W))continue;let $={family:m,weightSpec:y,styleSpec:A,stretchSpec:S,unicodeRange:v,srcRaw:E,srcUrls:N,href:u.href||location.href};if(!(n&&w($,W)))if(/url\(/i.test(E)){let I=await R(E,u.href||location.href);U+=`@font-face{font-family:${m};src:${I};font-style:${A};font-weight:${y};font-stretch:${S};${v?`unicode-range:${v};`:""}}`}else U+=`@font-face{font-family:${m};src:${E};font-style:${A};font-weight:${y};font-stretch:${S};${v?`unicode-range:${v};`:""}}`}}catch{}try{for(let u of document.fonts||[]){if(!u||!u.family||u.status!=="loaded"||!u._snapdomSrc)continue;let p=String(u.family).replace(/^['"]+|['"]+$/g,"");if(H(p)||!i.has(p)||n?.families&&n.families.some(b=>String(b).toLowerCase()===p.toLowerCase()))continue;let g=u._snapdomSrc;if(!String(g).startsWith("data:")){if(h.resource?.has(u._snapdomSrc))g=h.resource.get(u._snapdomSrc),h.font?.add(u._snapdomSrc);else if(!h.font?.has(u._snapdomSrc))try{let b=await O(u._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(b.ok&&typeof b.data=="string")g=b.data,h.resource?.set(u._snapdomSrc,g),h.font?.add(u._snapdomSrc);else continue}catch{console.warn("[snapdom] Failed to fetch dynamic font src:",u._snapdomSrc);continue}}U+=`@font-face{font-family:'${p}';src:url(${g});font-style:${u.style||"normal"};font-weight:${u.weight||"normal"};}`}}catch{}for(let u of o){if(!u||typeof u!="object")continue;let p=String(u.family||"").replace(/^['"]+|['"]+$/g,"");if(!p||H(p)||!i.has(p)||n?.families&&n.families.some(S=>String(S).toLowerCase()===p.toLowerCase()))continue;let g=u.weight!=null?String(u.weight):"normal",b=u.style!=null?String(u.style):"normal",m=u.stretchPct!=null?`${u.stretchPct}%`:"100%",y=String(u.src||""),A=y;if(!A.startsWith("data:")){if(h.resource?.has(y))A=h.resource.get(y),h.font?.add(y);else if(!h.font?.has(y))try{let S=await O(y,{as:"dataURL",useProxy:r,silent:!0});if(S.ok&&typeof S.data=="string")A=S.data,h.resource?.set(y,A),h.font?.add(y);else continue}catch{console.warn("[snapdom] Failed to fetch localFonts src:",y);continue}}U+=`@font-face{font-family:'${p}';src:url(${A});font-style:${b};font-weight:${g};font-stretch:${m};}`}return U&&(U=F(U),h.resource?.set(T,U)),U}function gt(t){let e=new Set;if(!t)return e;let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=s=>{let a=ht(s.fontFamily);if(!a)return;let f=(c,l,d)=>`${a}__${mt(c)}__${Pt(l)}__${We(d)}`;e.add(f(s.fontWeight,s.fontStyle,s.fontStretch))};o(getComputedStyle(t));let r=getComputedStyle(t,"::before");r&&r.content&&r.content!=="none"&&o(r);let i=getComputedStyle(t,"::after");for(i&&i.content&&i.content!=="none"&&o(i);n.nextNode();){let s=n.currentNode,a=getComputedStyle(s);o(a);let f=getComputedStyle(s,"::before");f&&f.content&&f.content!=="none"&&o(f);let c=getComputedStyle(s,"::after");c&&c.content&&c.content!=="none"&&o(c)}return e}function yt(t){let e=new Set,n=r=>{if(r)for(let i of r)e.add(i.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){let r=o.currentNode;if(r.nodeType===Node.TEXT_NODE)n(r.nodeValue||"");else if(r.nodeType===Node.ELEMENT_NODE){let i=r;for(let s of["::before","::after"]){let f=getComputedStyle(i,s)?.getPropertyValue("content");if(!(!f||f==="none"))if(/^"/.test(f)||/^'/.test(f))n(f.slice(1,-1));else{let c=f.match(/\\[0-9A-Fa-f]{1,6}/g);if(c)for(let l of c)try{e.add(parseInt(l.slice(1),16))}catch{}}}}}return e}async function wt(t,e=2){try{await document.fonts.ready}catch{}let n=Array.from(t||[]).filter(Boolean);if(n.length===0)return;let o=()=>{let r=document.createElement("div");r.style.cssText="position: absolute !important;left: -9999px !important;top: 0 !important;opacity: 0 !important;pointer-events: none !important;contain: layout size style;";for(let i of n){let s=document.createElement("span");s.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",s.style.fontFamily=`"${i}"`,s.style.fontWeight="700",s.style.fontStyle="italic",s.style.fontSize="32px",s.style.lineHeight="1",s.style.whiteSpace="nowrap",s.style.margin="0",s.style.padding="0",r.appendChild(s)}document.body.appendChild(r),r.offsetWidth,document.body.removeChild(r)};for(let r=0;r<Math.max(1,e);r++)o(),await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i)))}async function _t(t,e,n,o){if(!(t instanceof Element)||!(e instanceof Element))return;for(let s of["::before","::after","::first-letter"])try{let a=Z(t,s);if(!a||typeof a[Symbol.iterator]!="function"||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(s==="::first-letter"){let $=getComputedStyle(t);if(!(a.color!==$.color||a.fontSize!==$.fontSize||a.fontWeight!==$.fontWeight))continue;let B=Array.from(e.childNodes).find(Bt=>Bt.nodeType===Node.TEXT_NODE&&Bt.textContent?.trim().length>0);if(!B)continue;let L=B.textContent,et=L.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],Ct=L.slice(et?.length||0);if(!et||/[\uD800-\uDFFF]/.test(et))continue;let z=document.createElement("span");z.textContent=et,z.dataset.snapdomPseudo="::first-letter";let re=dt(a),se=ot(re,"span");n.styleMap.set(z,se);let Wt=document.createTextNode(Ct);e.replaceChild(Wt,B),e.insertBefore(z,Wt);continue}let c=a.content,l=/counter\s*\(|counters\s*\(/.test(c)?"- ":Lt(c),d=a.backgroundImage,x=a.backgroundColor,R=a.fontFamily,C=parseInt(a.fontSize)||32,k=parseInt(a.fontWeight)||!1,w=a.color||"#000",F=a.display,M=parseFloat(a.width),T=parseFloat(a.height),_=a.borderStyle,q=parseFloat(a.borderWidth),U=a.transform,D=H(R),u=c!=="none"&&l!=="",p=d&&d!=="none",g=x&&x!=="transparent"&&x!=="rgba(0, 0, 0, 0)",b=F!=="inline"&&(M>0||T>0),m=_&&_!=="none"&&q>0,y=U&&U!=="none";if(!(u||p||g||b||m||y))continue;let S=document.createElement("span");S.dataset.snapdomPseudo=s,S.style.verticalAlign="middle";let E=dt(a),v=ot(E,"span");if(n.styleMap.set(S,v),D&&l.length===1){let{dataUrl:$,width:I,height:B}=await Vt(l,R,k,C,w),L=document.createElement("img");L.src=$,L.style=`height:${C}px;width:${I/B*C}px;object-fit:contain;`,S.appendChild(L),e.dataset.snapdomHasIcon="true"}else if(l.startsWith("url(")){let $=G(l);if($?.trim())try{let I=document.createElement("img"),B=await O(rt($),{as:"dataURL",useProxy:o.useProxy});I.src=B.data,I.style=`width:${C}px;height:auto;object-fit:contain;`,S.appendChild(I)}catch(I){console.error(`[snapdom] Error in pseudo ${s} for`,t,I)}}else!D&&u&&(S.textContent=l);if(p)try{let $=Q(d),I=await Promise.all($.map(J));S.style.backgroundImage=I.join(", ")}catch($){console.warn(`[snapdom] Failed to inline background-image for ${s}`,$)}if(g&&(S.style.backgroundColor=x),!(S.childNodes.length>0||S.textContent?.trim()!==""||p||g||b||m||y))continue;s==="::before"?e.insertBefore(S,e.firstChild):e.appendChild(S)}catch(a){console.warn(`[snapdom] Failed to capture ${s} for`,t,a)}let r=Array.from(t.children),i=Array.from(e.children).filter(s=>!s.dataset.snapdomPseudo);for(let s=0;s<Math.min(r.length,i.length);s++)await _t(r[s],i[s],n,o)}function Xt(t){if(!t)return;let e=new Set;if(t.querySelectorAll("use").forEach(a=>{let f=a.getAttribute("xlink:href")||a.getAttribute("href");f&&f.startsWith("#")&&e.add(f.slice(1))}),!e.size)return;let n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(a=>a.tagName.toLowerCase()==="symbol"),r=n.filter(a=>a.tagName.toLowerCase()==="defs"),i=t.querySelector("svg.inline-defs-container");i||(i=document.createElementNS("http://www.w3.org/2000/svg","svg"),i.setAttribute("aria-hidden","true"),i.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),i.classList.add("inline-defs-container"),t.insertBefore(i,t.firstChild));let s=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(a=>{s.add(a.id)}),e.forEach(a=>{if(s.has(a))return;let f=o.find(c=>c.id===a);if(f){i.appendChild(f.cloneNode(!0)),s.add(a);return}for(let c of r){let l=c.querySelector(`#${CSS.escape(a)}`);if(l){let d=i.querySelector("defs");d||(d=document.createElementNS("http://www.w3.org/2000/svg","defs"),i.appendChild(d)),d.appendChild(l.cloneNode(!0)),s.add(a);break}}})}async function Gt(t,e={}){let n={styleMap:h.session.styleMap,styleCache:h.session.styleCache,nodeMap:h.session.nodeMap},o,r="",i="";He(t);try{Xt(t)}catch(a){console.warn("inlineExternal defs or symbol failed:",a)}try{o=await at(t,n,e,t)}catch(a){throw console.warn("deepClone failed:",a),a}try{await _t(t,o,n,e)}catch(a){console.warn("inlinePseudoElements failed:",a)}await Ke(o);try{let a=o.querySelectorAll("style[data-sd]");for(let f of a)i+=f.textContent||"",f.remove()}catch{}let s=Ft(n.styleMap);r=Array.from(s.entries()).map(([a,f])=>`.${f}{${a}}`).join(""),r=i+r;for(let[a,f]of n.styleMap.entries()){if(a.tagName==="STYLE")continue;if(a.getRootNode&&a.getRootNode()instanceof ShadowRoot){a.setAttribute("style",f.replace(/;/g,"; "));continue}let c=s.get(f);c&&a.classList.add(c);let l=a.style?.backgroundImage,d=a.dataset?.snapdomHasIcon;l&&l!=="none"&&(a.style.backgroundImage=l),d&&(a.style.verticalAlign="middle",a.style.display="inline")}for(let[a,f]of n.nodeMap.entries()){let c=f.scrollLeft,l=f.scrollTop;if((c||l)&&a instanceof HTMLElement){a.style.overflow="hidden",a.style.scrollbarWidth="none",a.style.msOverflowStyle="none";let x=document.createElement("div");for(x.style.transform=`translate(${-c}px, ${-l}px)`,x.style.willChange="transform",x.style.display="inline-block",x.style.width="100%";a.firstChild;)x.appendChild(a.firstChild);a.appendChild(x)}}if(t===n.nodeMap.get(o)){let a=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,a);let f=kt(a.transform);o.style.margin="0",o.style.position="static",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.zIndex="auto",o.style.float="none",o.style.clear="none",o.style.transform=f||""}for(let[a,f]of n.nodeMap.entries())f.tagName==="PRE"&&(a.style.marginTop="0",a.style.marginBlockStart="0");return{clone:o,classCSS:r,styleCache:n.styleCache}}function He(t){let e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,i=e.borderWidth,s=n!=="none"&&parseFloat(o)>0,a=r==="none"||parseFloat(i)===0;s&&a&&(t.style.border=`${o} solid transparent`)}var it=new Map;async function ct(t){if(h.resource?.has(t))return h.resource.get(t);if(it.has(t))return it.get(t);let e=(async()=>{let n=await O(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return h.resource?.set(t,n.data),n.data})();it.set(t,e);try{let n=await e;return it.set(t,n),n}catch(n){throw it.delete(t),n}}var ze=/\bblob:[^)"'\s]+/g;async function Kt(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(ze)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let r=await ct(o);n=n.split(o).join(r)}catch{}return n}function bt(t){return typeof t=="string"&&t.startsWith("blob:")}function Ve(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 Xe(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function Ke(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let s of e)try{let f=s.getAttribute("src")||s.currentSrc||"";if(bt(f)){let l=await ct(f);s.setAttribute("src",l)}let c=s.getAttribute("srcset");if(c&&c.includes("blob:")){let l=Ve(c),d=!1;for(let x of l)if(bt(x.url))try{x.url=await ct(x.url),d=!0}catch{}d&&s.setAttribute("srcset",Xe(l))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let s of n)try{let a="http://www.w3.org/1999/xlink",f=s.getAttribute("href")||s.getAttributeNS?.(a,"href");if(bt(f)){let c=await ct(f);s.setAttribute("href",c),s.removeAttributeNS?.(a,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let s of o)try{let a=s.getAttribute("style");if(a&&a.includes("blob:")){let f=await Kt(a);s.setAttribute("style",f)}}catch{}let r=t.querySelectorAll?t.querySelectorAll("style"):[];for(let s of r)try{let a=s.textContent||"";a.includes("blob:")&&(s.textContent=await Kt(a))}catch{}let i=["poster"];for(let s of i){let a=t.querySelectorAll?t.querySelectorAll(`[${s}^='blob:']`):[];for(let f of a)try{let c=f.getAttribute(s);bt(c)&&f.setAttribute(s,await ct(c))}catch{}}}async function Yt(t,e={}){let n=Array.from(t.querySelectorAll("img")),o=async r=>{if(!r.getAttribute("src")){let l=r.currentSrc||r.src||"";l&&r.setAttribute("src",l)}r.removeAttribute("srcset"),r.removeAttribute("sizes");let i=r.src||"";if(!i)return;let s=await O(i,{as:"dataURL",useProxy:e.useProxy});if(s.ok&&typeof s.data=="string"&&s.data.startsWith("data:")){r.src=s.data,r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}let{defaultImageUrl:a}=e||{};if(a)try{let l=parseInt(r.dataset?.snapdomWidth||"",10)||0,d=parseInt(r.dataset?.snapdomHeight||"",10)||0,x=parseInt(r.getAttribute("width")||"",10)||0,R=parseInt(r.getAttribute("height")||"",10)||0,C=parseFloat(r.style?.width||"")||0,k=parseFloat(r.style?.height||"")||0,w=l||C||x||r.width||void 0,F=d||k||R||r.height||void 0,M=typeof a=="function"?await a({width:w,height:F,src:i,element:r}):a;if(M){let T=await O(M,{as:"dataURL",useProxy:e.useProxy});r.src=T.data,!r.width&&w&&(r.width=w),!r.height&&F&&(r.height=F),r.width||(r.width=r.naturalWidth||100),r.height||(r.height=r.naturalHeight||100);return}}catch{}let f=r.width||r.naturalWidth||100,c=r.height||r.naturalHeight||100;if(e.placeholders!==!1){let l=document.createElement("div");l.style.cssText=[`width:${f}px`,`height:${c}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${c}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),l.textContent="img",r.replaceWith(l)}else{let l=document.createElement("div");l.style.cssText=`display:inline-block;width:${f}px;height:${c}px;visibility:hidden;`,r.replaceWith(l)}};for(let r=0;r<n.length;r+=4){let i=n.slice(r,r+4).map(o);await Promise.allSettled(i)}}async function St(t,e,n,o={}){let r=[[t,e]],i=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],s=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],a=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){let[f,c]=r.shift(),l=n.get(f)||Z(f);n.has(f)||n.set(f,l);let d=(()=>{let C=l.getPropertyValue("border-image"),k=l.getPropertyValue("border-image-source");return C&&C!=="none"||k&&k!=="none"})();for(let C of i){let k=l.getPropertyValue(C);if(!k||k==="none")continue;let w=Q(k),F=await Promise.all(w.map(M=>J(M,o)));F.some(M=>M&&M!=="none"&&!/^url\(undefined/.test(M))&&c.style.setProperty(C,F.join(", "))}for(let C of s){let k=l.getPropertyValue(C);!k||k==="initial"||c.style.setProperty(C,k)}if(d)for(let C of a){let k=l.getPropertyValue(C);!k||k==="initial"||c.style.setProperty(C,k)}let x=Array.from(f.children),R=Array.from(c.children);for(let C=0;C<Math.min(x.length,R.length);C++)r.push([x[C],R[C]])}}async function Zt(t,e){if(!t)throw new Error("Element cannot be null or undefined");lt(e.cache);let n=e.fast,o,r,i,s="",a="",f,c;({clone:o,classCSS:r,styleCache:i}=await Gt(t,e)),await new Promise(R=>{V(async()=>{await Yt(o,e),R()},{fast:n})}),await new Promise(R=>{V(async()=>{await St(t,o,i,e),R()},{fast:n})}),e.embedFonts&&await new Promise(R=>{V(async()=>{let C=gt(t),k=yt(t);if(X){let w=new Set(Array.from(C).map(F=>String(F).split("__")[0]).filter(Boolean));await wt(w,5)}s=await pt({required:C,usedCodepoints:k,preCached:!1,exclude:e.excludeFonts,useProxy:e.useProxy}),R()},{fast:n})});let l=Mt(o).sort(),d=l.join(",");h.baseStyle.has(d)?a=h.baseStyle.get(d):await new Promise(R=>{V(()=>{a=vt(l),h.baseStyle.set(d,a),R()},{fast:n})}),await new Promise(R=>{V(()=>{let C=Ge(t),k=C.width,w=C.height,F=Number.isFinite(e.width),M=Number.isFinite(e.height),T=e.scale??1,_=typeof T=="number"&&T!==1;if(!_){let L=C.width/C.height;F&&M?(k=e.width,w=e.height):F?(k=e.width,w=k/L):M&&(w=e.height,k=w*L)}k=Math.max(1,Math.ceil(k)),w=Math.max(1,Math.ceil(w));let q=getComputedStyle(t),U=q.transform&&q.transform!=="none"?q.transform:"",D=Ze(t),u,p,g,b,m=0,y=0;if(Qe(t)){let L=nn({baseTransform:U,rotate:D.rotate||"0deg",scale:D.scale,translate:D.translate}),j=L.e??L.m41??0,et=L.f??L.m42??0;m=-j,y=-et;let Ct=L.is2D?Jt(L):Jt(new DOMMatrix(L.toString())),z=Je(k,w,Ct);u=Math.max(1,Math.ceil(z.width)),p=Math.max(1,Math.ceil(z.height)),g=-z.minX,b=-z.minY}else{let L=t.getBoundingClientRect(),j=tn(L,{top:0,right:0,bottom:0,left:0});u=Math.max(1,j.width),p=Math.max(1,j.height),g=-(j.x-Math.floor(L.left)),b=-(j.y-Math.floor(L.top))}let A="http://www.w3.org/2000/svg",S=document.createElementNS(A,"foreignObject");S.setAttribute("width","100%"),S.setAttribute("height","100%"),S.setAttribute("x",String(g)),S.setAttribute("y",String(b)),S.style.overflow="visible";let E=document.createElement("style");E.textContent=a+s+"svg{overflow:visible;} foreignObject{overflow:visible;}"+r,S.appendChild(E);let v=document.createElement("div");v.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),v.style.width=`${k}px`,v.style.height=`${w}px`,v.style.overflow="visible",v.style.transformOrigin="0 0";let N=[];if((m||y)&&N.push(`translate(${m}px, ${y}px)`),!_&&(F||M)){let L=C.width?k/C.width:1,j=C.height?w/C.height:1;N.push(`scale(${L}, ${j})`)}else _&&N.push(`scale(${T})`);N.length&&(v.style.transform=N.join(" ")),o.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),o.style.transformOrigin="0 0",o.style.position="static",o.style.left="0",o.style.top="0",U&&(o.style.transform=U),o.style.rotate=D.rotate||"0deg",o.style.scale=D.scale||"1",o.style.translate=D.translate||"0 0",v.appendChild(o),S.appendChild(v);let $=new XMLSerializer().serializeToString(S);c=`<svg xmlns="${A}" width="${u}" height="${p}" viewBox="0 0 ${u} ${p}">`+$+"</svg>",f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(c)}`,R()},{fast:n})});let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),f}function Ge(t){let e=getComputedStyle(t),n=i=>parseFloat(i)||0,o=n(e.width),r=n(e.height);return e.boxSizing==="content-box"&&(o+=n(e.paddingLeft)+n(e.paddingRight)+n(e.borderLeftWidth)+n(e.borderRightWidth),r+=n(e.paddingTop)+n(e.paddingBottom)+n(e.borderTopWidth)+n(e.borderBottomWidth)),{width:o,height:r}}function Ye(t){let e=getComputedStyle(t).transform;if(!e||e==="none")return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}function Jt(t){return new DOMMatrix([t.a,t.b,t.c,t.d,0,0])}function Je(t,e,n){let r=[{x:0,y:0},{x:t,y:0},{x:0,y:e},{x:t,y:e}].map(c=>({x:n.a*c.x+n.c*c.y,y:n.b*c.x+n.d*c.y})),i=Math.min(...r.map(c=>c.x)),s=Math.max(...r.map(c=>c.x)),a=Math.min(...r.map(c=>c.y)),f=Math.max(...r.map(c=>c.y));return{minX:i,minY:a,width:s-i,height:f-a}}function Ze(t){let e={rotate:"0deg",scale:null,translate:null},n=t.computedStyleMap?.();if(n){let r=n.get("rotate");if(r){let a=r.angle??r;a&&"unit"in a?e.rotate=a.unit==="rad"?a.value*180/Math.PI+"deg":a.value+a.unit:e.rotate=String(r)}let i=n.get("scale");if(i&&i.length){let a=i[0]?.value??1,f=i[1]?.value??a;e.scale=`${a} ${f}`}let s=n.get("translate");if(s&&s.length){let a=s[0]?.value??0,f=s[1]?.value??0,c=s[0]?.unit??"px",l=s[1]?.unit??"px";e.translate=`${a}${c} ${f}${l}`}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}function Qe(t){let e=getComputedStyle(t).transform||"none";return!(e==="none"||e==="matrix(1, 0, 0, 1, 0, 0)"||/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,/i.test(e))}function tn(t,e){let n=Math.floor(t.left-e.left),o=Math.floor(t.top-e.top),r=Math.ceil(t.width+e.left+e.right),i=Math.ceil(t.height+e.top+e.bottom);return{x:n,y:o,width:r,height:i}}var Ut=null;function en(){if(Ut)return Ut;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),Ut=t,t}function nn(t){let e=en(),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=Ye(n);return e.removeChild(n),o}function on(t){if(typeof t=="string"){let e=t.toLowerCase().trim();if(e==="disabled"||e==="full"||e==="auto"||e==="soft")return e}return"soft"}function Qt(t={}){let e=t.format??"png",n=on(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],filter:t.filter??null,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,defaultImageUrl:t.defaultImageUrl??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??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM"}}async function te(t,e){let n=new Image;return n.src=t,await n.decode(),e.scale!==1&&(n.style.width=`${n.naturalWidth*e.scale}px`,n.style.height=`${n.naturalHeight*e.scale}px`),n}async function K(t,e){let{scale:n,dpr:o}=e,r=X(),i=new Image;i.crossOrigin="anonymous",i.loading="eager",i.decoding="sync",i.src=t;let s=null;r&&(s=document.createElement("div"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none;contain:size layout style;",document.body.appendChild(s),s.appendChild(i)),await i.decode(),r&&await new Promise(d=>setTimeout(d,100));let a=i.naturalWidth*n,f=i.naturalHeight*n,c=document.createElement("canvas");c.width=Math.ceil(a*o),c.height=Math.ceil(f*o),c.style.width=`${a}px`,c.style.height=`${f}px`;let l=c.getContext("2d");if(o!==1&&l.scale(o,o),l.drawImage(i,0,0,a,f),s&&s.parentNode)try{s.parentNode.removeChild(s)}catch{}return c}async function xt(t,e){let n=e.type;if(n==="svg"){let i=decodeURIComponent(t.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let o=await K(t,e),r=e.backgroundColor?Y(o,e.backgroundColor):o;return new Promise(i=>r.toBlob(s=>i(s),`image/${n}`,e.quality))}async function ee(t,e){let n=await K(t,e),o=e.backgroundColor?Y(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=`${o.width/e.dpr}px`,r.style.height=`${o.height/e.dpr}px`,r}async function ne(t,e){if(e.format==="svg"){let i=await xt(t,{...e,type:"svg"}),s=URL.createObjectURL(i),a=document.createElement("a");a.href=s,a.download=e.filename,a.click(),URL.revokeObjectURL(s);return}let n=await K(t,e),o=e.backgroundColor?Y(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}var oe=Symbol("snapdom.internal");async function P(t,e){if(!t)throw new Error("Element cannot be null or undefined");let n=Qt(e);return n.iconFonts&&n.iconFonts.length>0&&zt(n.iconFonts),n.snap||(n.snap={toPng:(o,r)=>P.toPng(o,r),toImg:(o,r)=>P.toImg(o,r)}),P.capture(t,n,oe)}P.capture=async(t,e,n)=>{if(n!==oe)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let o=await Zt(t,e),r=s=>({...e,...s||{}}),i=s=>a=>{let f=r({...a||{},format:s}),c=s==="jpeg"||s==="jpg",l=f.backgroundColor==null||f.backgroundColor==="transparent";return c&&l&&(f.backgroundColor="#ffffff"),ee(o,f)};return{url:o,toRaw:()=>o,toImg:s=>te(o,r(s)),toCanvas:s=>K(o,r(s)),toBlob:s=>xt(o,r(s)),toPng:i("png"),toJpg:i("jpeg"),toWebp:i("webp"),download:s=>ne(o,r(s))}};P.toRaw=(t,e)=>P(t,e).then(n=>n.toRaw());P.toImg=(t,e)=>P(t,e).then(n=>n.toImg());P.toCanvas=(t,e)=>P(t,e).then(n=>n.toCanvas());P.toBlob=(t,e)=>P(t,e).then(n=>n.toBlob());P.toPng=(t,e)=>P(t,{...e,format:"png"}).then(n=>n.toPng());P.toJpg=(t,e)=>P(t,{...e,format:"jpeg"}).then(n=>n.toJpg());P.toWebp=(t,e)=>P(t,{...e,format:"webp"}).then(n=>n.toWebp());P.download=(t,e)=>P(t,e).then(n=>n.download());async function rn(t=document,e={}){let{embedFonts:n=!0,cacheOpt:o="full",useProxy:r=""}=e;lt(o);try{await document.fonts.ready}catch{}$t(),h.session=h.session||{},h.session.styleCache||(h.session.styleCache=new WeakMap);try{await St(t,void 0,h.session.styleCache,{useProxy:r})}catch{}let i=[],s=[];try{t?.querySelectorAll&&(i=Array.from(t.querySelectorAll("img[src]")),s=Array.from(t.querySelectorAll("*")))}catch{}let a=[];for(let f of i){let c=f?.src;if(c&&!h.image.has(c)){let l=Promise.resolve().then(()=>O(c,{as:"dataURL",useProxy:r})).then(d=>{h.image.set(c,d)}).catch(()=>{});a.push(l)}}for(let f of s){let c="";try{c=Z(f).backgroundImage}catch{}if(c&&c!=="none"){let l=Q(c);for(let d of l)if(d.startsWith("url(")){let x=Promise.resolve().then(()=>J(d,{...e,useProxy:r})).catch(()=>{});a.push(x)}}}if(n)try{let f=gt(t),c=yt(t);if(typeof X=="function"?X():X){let l=new Set(Array.from(f).map(d=>String(d).split("__")[0]).filter(Boolean));await wt(l,2)}await pt({required:f,usedCodepoints:c,exclude:e.excludeFonts,localFonts:e.localFonts,useProxy:e.useProxy??r})}catch{}await Promise.allSettled(a)}export{rn as preCache,P as snapdom};
package/dist/snapdom.mjs CHANGED
@@ -670,22 +670,14 @@ function idleCallback(childList, callback, fast) {
670
670
  return Promise.all(childList.map((child) => {
671
671
  return new Promise((resolve) => {
672
672
  function deal() {
673
- idle(
674
- (deadline) => {
675
- if (deadline instanceof IdleDeadline) {
676
- if (deadline.timeRemaining()) {
677
- callback(child, resolve);
678
- } else {
679
- deal();
680
- }
681
- } else {
682
- callback(child, resolve);
683
- }
684
- },
685
- {
686
- fast
673
+ idle((deadline) => {
674
+ const hasIdleBudget = deadline && typeof deadline.timeRemaining === "function" ? deadline.timeRemaining() > 0 : true;
675
+ if (hasIdleBudget) {
676
+ callback(child, resolve);
677
+ } else {
678
+ deal();
687
679
  }
688
- );
680
+ }, { fast });
689
681
  }
690
682
  deal();
691
683
  });
@@ -1774,7 +1766,7 @@ function collectUsedCodepoints(root) {
1774
1766
  }
1775
1767
  return used;
1776
1768
  }
1777
- async function ensureFontsReady(families, warmupRepetitions = 1) {
1769
+ async function ensureFontsReady(families, warmupRepetitions = 2) {
1778
1770
  try {
1779
1771
  await document.fonts.ready;
1780
1772
  } catch {
@@ -2393,7 +2385,7 @@ async function captureDOM(element, options) {
2393
2385
  const families = new Set(
2394
2386
  Array.from(required).map((k) => String(k).split("__")[0]).filter(Boolean)
2395
2387
  );
2396
- await ensureFontsReady(families, 2);
2388
+ await ensureFontsReady(families, 5);
2397
2389
  }
2398
2390
  fontsCSS = await embedCustomFonts({
2399
2391
  required,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zumer/snapdom",
3
- "version": "1.9.10",
3
+ "version": "1.9.11",
4
4
  "description": "snapDOM captures HTML elements to images with exceptional speed and accuracy.",
5
5
  "main": "dist/snapdom.js",
6
6
  "module": "dist/snapdom.mjs",