chatlab-cli 0.0.0 → 0.1.0

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