@opengovsg/confetti 0.3.1 → 0.3.3

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.
@@ -1,8 +1,8 @@
1
1
  var e=Object.defineProperty,t=(e,t)=>()=>(e&&(t=e(e=0)),t),n=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})};function r(e){if(e===!0)return`soft`;if(e===!1)return`disabled`;if(typeof e==`string`){let t=e.toLowerCase().trim();if(t===`auto`)return`auto`;if(t===`full`)return`full`;if(t===`soft`||t===`disabled`)return t}return`soft`}function i(e=`soft`){switch(o.session.__counterEpoch=(o.session.__counterEpoch||0)+1,e){case`auto`:o.session.styleMap=new Map,o.session.nodeMap=new Map;return;case`soft`:o.session.styleMap=new Map,o.session.nodeMap=new Map,o.session.styleCache=new WeakMap;return;case`full`:return;case`disabled`:o.session.styleMap=new Map,o.session.nodeMap=new Map,o.session.styleCache=new WeakMap,o.computedStyle=new WeakMap,o.baseStyle=new a(50),o.defaultStyle=new a(30),o.image=new a(100),o.background=new a(100),o.resource=new a(150),o.font=new Set;return;default:o.session.styleMap=new Map,o.session.nodeMap=new Map,o.session.styleCache=new WeakMap;return}}var a,o,s=t(()=>{a=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let e=this.keys().next().value;e!==void 0&&this.delete(e)}return super.set(e,t)}},o={image:new a(100),background:new a(100),resource:new a(150),defaultStyle:new a(30),baseStyle:new a(50),computedStyle:new WeakMap,measureHints:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function c(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith(`#`)?null:n}function l(e){if(!e||e===`none`)return``;let t=e.replace(/translate[XY]?\([^)]*\)/g,``);return t=t.replace(/matrix\(([^)]+)\)/g,(e,t)=>{let n=t.split(`,`).map(e=>e.trim());return n.length===6?(n[4]=`0`,n[5]=`0`,`matrix(${n.join(`, `)})`):`matrix(${t})`}),t=t.replace(/matrix3d\(([^)]+)\)/g,(e,t)=>{let n=t.split(`,`).map(e=>e.trim());return n.length===16?(n[12]=`0`,n[13]=`0`,`matrix3d(${n.join(`, `)})`):`matrix3d(${t})`}),t.trim().replace(/\s{2,}/g,` `)}function u(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function d(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let n=t||typeof document<`u`&&(document.baseURI||document.location?.href)||`http://localhost/`;return new URL(e,n).href}catch{return e}}var f=t(()=>{});function p(e=`[snapDOM]`,{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function a(a,o,s){if(i>=n)return;let c=Date.now();(r.get(o)||0)>c||(r.set(o,c+t),i++,a===`warn`&&console&&console.warn?console.warn(`${e} ${s}`):console&&console.error&&console.error(`${e} ${s}`))}return{warnOnce(e,t){a(`warn`,e,t)},errorOnce(e,t){a(`error`,e,t)},reset(){r.clear(),i=0}}}function m(e){return/^data:|^blob:|^about:blank$/i.test(e)}function h(e,t){try{let n=typeof location<`u`&&location.href?location.href:`http://localhost/`,r=t.includes(`{url}`)?t.split(`{url}`)[0]:t,i=new URL(r||`.`,n),a=new URL(e,n);if(a.origin===i.origin)return!0;let o=a.searchParams;if(o&&(o.has(`url`)||o.has(`target`)))return!0}catch{}return!1}function g(e,t){if(!t||m(e)||h(e,t))return!1;try{let t=typeof location<`u`&&location.href?location.href:`http://localhost/`,n=new URL(e,t);return typeof location<`u`?n.origin!==location.origin:!0}catch{return!!t}}function _(e,t){return t?t.includes(`{url}`)?t.replace(`{urlRaw}`,u(e)).replace(`{url}`,encodeURIComponent(e)):/[?&]url=?$/.test(t)?`${t}${encodeURIComponent(e)}`:t.endsWith(`?`)?`${t}url=${encodeURIComponent(e)}`:t.endsWith(`/`)?`${t}${u(e)}`:`${t}${t.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`:e}function v(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||``)),r.onerror=()=>n(Error(`read_failed`)),r.readAsDataURL(e)})}function y(e,t){return[t.as||`blob`,t.timeout??3e3,t.useProxy||``,t.errorTTL??8e3,e].join(`|`)}async function b(e,t={}){let n=t.as??`blob`,r=t.timeout??3e3,i=t.useProxy||``,a=t.errorTTL??8e3,o=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[,t=``,r=``]=String(e).match(/^data:([^,]*),(.*)$/)||[],i=/;base64/i.test(t)?atob(r):decodeURIComponent(r),a=new Uint8Array([...i].map(e=>e.charCodeAt(0))),o=new Blob([a],{type:(t||``).split(`;`)[0]||``});return{ok:!0,data:o,status:200,url:e,fromCache:!1,mime:o.type||``}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:`special_url_error`}}if(/^blob:/i.test(e))try{let t=await fetch(e);if(!t.ok)return{ok:!1,data:null,status:t.status,url:e,fromCache:!1,reason:`http_error`};let r=await t.blob(),i=r.type||t.headers.get(`content-type`)||``;return n===`dataURL`?{ok:!0,data:await v(r),status:t.status,url:e,fromCache:!1,mime:i}:n===`text`?{ok:!0,data:await r.text(),status:t.status,url:e,fromCache:!1,mime:i}:{ok:!0,data:r,status:t.status,url:e,fromCache:!1,mime:i}}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 c=y(e,{as:n,timeout:r,useProxy:i,errorTTL:a}),l=C.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&C.delete(c);let u=S.get(c);if(u)return u;let d=g(e,i)?_(e,i):e,f=t.credentials;if(!f)try{let t=typeof location<`u`&&location.href?location.href:`http://localhost/`,n=new URL(e,t);f=typeof location<`u`&&n.origin===location.origin?`include`:`omit`}catch{f=`omit`}let p=new AbortController,m=setTimeout(()=>p.abort(`timeout`),r),h=(async()=>{try{let r=await fetch(d,{signal:p.signal,credentials:f,headers:o});if(!r.ok){let i={ok:!1,data:null,status:r.status,url:d,fromCache:!1,reason:`http_error`};if(a>0&&C.set(c,{until:Date.now()+a,result:i}),!s){let t=`${r.status} ${r.statusText||``}`.trim();x.warnOnce(`http:${r.status}:${n}:${new URL(e,location?.href??`http://localhost/`).origin}`,`HTTP error ${t} while fetching ${n} ${e}`)}return t.onError&&t.onError(i),i}if(n===`text`)return{ok:!0,data:await r.text(),status:r.status,url:d,fromCache:!1};let i=await r.blob(),l=i.type||r.headers.get(`content-type`)||``;return n===`dataURL`?{ok:!0,data:await v(i),status:r.status,url:d,fromCache:!1,mime:l}:{ok:!0,data:i,status:r.status,url:d,fromCache:!1,mime:l}}catch(i){let o=i&&typeof i==`object`&&`name`in i&&i.name===`AbortError`?String(i.message||``).includes(`timeout`)?`timeout`:`abort`:`network`,l={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:o};if(!/^blob:/i.test(e)&&a>0&&C.set(c,{until:Date.now()+a,result:l}),!s){let t=`${o}:${n}:${new URL(e,location?.href??`http://localhost/`).origin}`,i=o===`timeout`?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${e}`:o===`abort`?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;x.errorOnce(t,i)}return t.onError&&t.onError(l),l}finally{clearTimeout(m),S.delete(c)}})();return S.set(c,h),h}var x,S,C,w=t(()=>{f(),x=p(`[snapDOM]`,{ttlMs:3*6e4,maxEntries:10}),S=new Map,C=new Map});async function T(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()===`none`)return e;let n=c(e);if(!n)return e;let r=u(d(n));if(o.background.has(r)){let e=o.background.get(r);return e?`url("${e}")`:`none`}try{let e=await b(r,{as:`dataURL`,useProxy:t.useProxy});return e.ok?(o.background.set(r,e.data),`url("${e.data}")`):(o.background.set(r,null),`none`)}catch{return o.background.set(r,null),`none`}}var E=t(()=>{s(),f(),w()});function D(e){if(e=String(e).toLowerCase(),N.has(e)){let t={};return o.defaultStyle.set(e,t),t}if(o.defaultStyle.has(e))return o.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),i={};for(let e of r)O(e)||(i[e]=r.getPropertyValue(e));return t.removeChild(n),o.defaultStyle.set(e,i),i}function O(e){let t=String(e).toLowerCase();return!!(ae.has(t)||F.test(t)||P.test(t))}function k(e,t){if(t=String(t||``).toLowerCase(),N.has(t))return``;let n=[],r=D(t),i=(e.display||``).toLowerCase()===`inline`||new Set([`span`,`small`,`em`,`strong`,`b`,`i`,`u`,`s`,`code`,`cite`,`mark`,`sub`,`sup`]).has(t);for(let[t,a]of Object.entries(e)){if(O(t)||i&&(t===`width`||t===`min-width`||t===`max-width`))continue;let e=r[t];a&&a!==e&&n.push(`${t}:${a}`)}return n.sort(),n.join(`;`)}function A(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(e=>t.add(e.tagName.toLowerCase())),Array.from(t))}function ee(e){let t=new Map;for(let n of e){let e=o.defaultStyle.get(n);if(!e)continue;let r=Object.entries(e).map(([e,t])=>`${e}:${t};`).sort().join(``);r&&(t.has(r)||t.set(r,[]),t.get(r).push(n))}let n=``;for(let[e,r]of t.entries())n+=`${r.join(`,`)} { ${e} }
2
- `;return n}function j(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let e of t)n.set(e,`c${r++}`);return n}function te(e){try{let t=e?.ownerDocument;if(!t)return typeof window<`u`?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle==`function`)return n;if(typeof window<`u`&&window.frames)for(let e=0;e<window.frames.length;e++)try{if(window.frames[e]?.document===t)return window.frames[e]}catch{}}catch{}return typeof window<`u`?window:null}function M(e,t=null){let n=()=>{let e={length:0,getPropertyValue:()=>``,item:()=>``};return e[Symbol.iterator]=function*(){},e};if(!(e instanceof Element)){let r=typeof window<`u`?window:null;if(r&&typeof r.getComputedStyle==`function`)try{return r.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=o.computedStyle.get(e);r||(r=new Map,o.computedStyle.set(e,r));let i=r.get(t);if(!i){let a=te(e),o=null;try{o=a&&typeof a.getComputedStyle==`function`?a.getComputedStyle(e,t):null}catch{}if(!o&&typeof window<`u`&&typeof window.getComputedStyle==`function`)try{e.ownerDocument===document&&(o=window.getComputedStyle(e,t))}catch{}i=o||n(),r.set(t,i)}return i}function ne(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);for(let e of oe){let n=t[`border-${e}-style`];(n===`none`||n===`hidden`||t[`border-${e}-width`]===`0px`)&&(delete t[`border-${e}-style`],delete t[`border-${e}-width`],delete t[`border-${e}-color`])}return t}function re(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&n++,a===`)`&&n--,a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var ie,N,P,F,ae,oe,se=t(()=>{s(),ie=new Set([`meta`,`script`,`noscript`,`title`,`link`,`template`]),N=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`]),P=/(?:^|-)(animation|transition)(?:-|$)/i,F=/^(--.+|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,ae=new Set([`cursor`,`pointer-events`,`touch-action`,`user-select`,`print-color-adjust`,`speak`,`reading-flow`,`reading-order`,`anchor-name`,`anchor-scope`,`container-name`,`container-type`,`timeline-scope`,`zoom`]),oe=[`top`,`right`,`bottom`,`left`]});function I(e,{fast:t=!1}={}){if(t)return e();`requestIdleCallback`in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ce(){if(typeof navigator>`u`)return!1;if(navigator.userAgentData)return navigator.userAgentData.platform===`iOS`;let e=navigator.userAgent||``,t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function L(){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),i=/mobile/i.test(e),a=!/safari/i.test(e),o=r&&i&&a,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),l=/ipad|iphone|ipod/.test(t)&&r;return n||o||s||c||l}function le(){if(typeof navigator>`u`)return!1;let e=(navigator.userAgent||``).toLowerCase();return e.includes(`firefox`)||e.includes(`fxios`)}var R=t(()=>{});function z(e,t,n){let r=e&&typeof e==`object`&&(e.options||e);r&&r.debug&&(n===void 0?console.warn(`[snapdom]`,t):console.warn(`[snapdom]`,t,n))}var ue=t(()=>{}),B=t(()=>{E(),se(),R(),f(),ue()}),de={};n(de,{toCanvas:()=>xe});function fe(e){return typeof e==`string`&&/^data:image\/svg\+xml/i.test(e)}function pe(e){let t=e.indexOf(`,`);return t>=0?decodeURIComponent(e.slice(t+1)):``}function me(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function he(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&r++,a===`)`&&(r=Math.max(0,r-1)),a===`;`&&r===0?(t.push(n),n=``):n+=a}return n.trim()&&t.push(n),t.map(e=>e.trim()).filter(Boolean)}function ge(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&r++,a===`)`&&(r=Math.max(0,r-1)),a===`,`&&r===0?(t.push(n.trim()),n=``):n+=a}n.trim()&&t.push(n.trim());let i=[];for(let e of t){if(/\binset\b/i.test(e))continue;let[t=`0px`,n=`0px`,r=`0px`]=e.match(/-?\d+(?:\.\d+)?px/gi)||[],a=e.replace(/-?\d+(?:\.\d+)?px/gi,``).replace(/\binset\b/gi,``).trim().replace(/\s{2,}/g,` `),o=!!a&&a!==`,`;i.push(`drop-shadow(${t} ${n} ${r}${o?` ${a}`:``})`)}return i.join(` `)}function _e(e){let t=he(e),n=null,r=null,i=null,a=[];for(let e of t){let t=e.indexOf(`:`);if(t<0)continue;let o=e.slice(0,t).trim().toLowerCase(),s=e.slice(t+1).trim();o===`box-shadow`?i=s:o===`filter`?n=s:o===`-webkit-filter`?r=s:a.push([o,s])}if(i){let e=ge(i);e&&(n=n?`${n} ${e}`:e,r=r?`${r} ${e}`:e)}let o=[...a];return n&&o.push([`filter`,n]),r&&o.push([`-webkit-filter`,r]),o.map(([e,t])=>`${e}:${t}`).join(`;`)}function ve(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,n)=>`${t}{${_e(n)}}`)}function ye(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,ve(t))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,n)=>`style=${t}${_e(n)}${t}`),e}function be(e){if(!L()||!fe(e))return e;try{return me(ye(pe(e)))}catch{return e}}async function xe(e,t){let{width:n,height:r,scale:i=1,dpr:a=1,meta:o={},backgroundColor:s}=t;e=be(e);let c=new Image;if(c.loading=`eager`,c.decoding=`sync`,c.crossOrigin=`anonymous`,c.src=e,await c.decode(),L()){c.style.cssText=`position:fixed;left:-99999px;top:-99999px;pointer-events:none`,document.body.appendChild(c);try{await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))}finally{try{c.remove()}catch{}}}let l=c.naturalWidth,u=c.naturalHeight,d=Number.isFinite(o.w0)?o.w0:l,f=Number.isFinite(o.h0)?o.h0:u,p,m,h=Number.isFinite(n),g=Number.isFinite(r);if(h&&g)p=Math.max(1,n),m=Math.max(1,r);else if(h){let e=n/Math.max(1,d);p=n,m=f*e}else if(g){let e=r/Math.max(1,f);m=r,p=d*e}else p=l,m=u;p*=i,m*=i;let _=document.createElement(`canvas`);_.width=p*a,_.height=m*a,_.style.width=`${p}px`,_.style.height=`${m}px`;let v=_.getContext(`2d`);return a!==1&&v.scale(a,a),s&&(v.save(),v.fillStyle=s,v.fillRect(0,0,p,m),v.restore()),v.drawImage(c,0,0,p,m),_}var Se=t(()=>{R()}),Ce={};n(Ce,{rasterize:()=>we});async function we(e,t){let n=await xe(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}var Te=t(()=>{Se()}),Ee={};n(Ee,{toImg:()=>De,toSvg:()=>De});async function De(e,t){let{scale:n=1,width:r,height:i,meta:a={}}=t,o=Number.isFinite(r),s=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||o||s;if(L()&&c)return await we(e,{...t,format:`png`,quality:1,meta:a});let l=new Image;if(l.decoding=`sync`,l.loading=`eager`,l.src=e,await l.decode(),o&&s)l.style.width=`${r}px`,l.style.height=`${i}px`;else if(o){let e=Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.h0)?a.h0:l.naturalHeight,n=r/Math.max(1,e);l.style.width=`${r}px`,l.style.height=`${Math.round(t*n)}px`}else if(s){let e=Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.h0)?a.h0:l.naturalHeight,n=i/Math.max(1,t);l.style.height=`${i}px`,l.style.width=`${Math.round(e*n)}px`}else{let r=Math.round(l.naturalWidth*n),i=Math.round(l.naturalHeight*n);if(l.style.width=`${r}px`,l.style.height=`${i}px`,typeof e==`string`&&e.startsWith(`data:image/svg+xml`))try{let t=decodeURIComponent(e.split(`,`)[1]).replace(/width="[^"]*"/,`width="${r}"`).replace(/height="[^"]*"/,`height="${i}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,l.src=e}catch(e){z(t,`SVG width/height patch in toImg failed`,e)}}return l}var Oe=t(()=>{B(),Te()}),ke={};n(ke,{toBlob:()=>Ae});async function Ae(e,t){let n=t.type;if(n===`svg`){let t=decodeURIComponent(e.split(`,`)[1]);return new Blob([t],{type:`image/svg+xml`})}let r=await xe(e,t);return new Promise(e=>r.toBlob(t=>e(t),`image/${n}`,t.quality))}var je=t(()=>{Se()}),Me={};n(Me,{download:()=>Pe});async function Ne(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(e){if(e.name!==`AbortError`)return!1}return!0}async function Pe(e,t){let n=new Set([`png`,`jpeg`,`jpg`,`webp`,`svg`]),r=(t?.type||``).toLowerCase(),i=n.has(r)?r:``,a=(t?.format||i||``).toLowerCase(),o=a===`jpg`?`jpeg`:a||`png`,s=t?.filename||`snapdom.${o}`,c={...t||{},format:o,type:o};c.dpr=1;let l=ce();if(o===`svg`){let t=await Ae(e,{...c,type:`svg`});if(l&&await Ne(t,s))return;let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=s,document.body.appendChild(r),r.click(),URL.revokeObjectURL(n),r.remove();return}let u=await xe(e,c);if(l){let e=`image/${o}`,n=await new Promise(n=>u.toBlob(n,e,t?.quality));if(n&&await Ne(n,s))return}let d=document.createElement(`a`);d.href=u.toDataURL(`image/${o}`,t?.quality),d.download=s,document.body.appendChild(d),d.click(),d.remove()}var Fe=t(()=>{je(),Se(),R()});B(),B(),s();var Ie=new WeakMap,V=new Map,Le=2e3,Re=0;function ze(){Re++,V.size>Le&&V.clear()}var Be=!1;function Ve(e=document.documentElement){if(!Be){Be=!0;try{new MutationObserver(()=>ze()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>ze()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.(`loadingdone`,ze),e.ready?.then(()=>ze()).catch(()=>{}))}catch{}}}function He(e,t={}){let n={},r=e.getPropertyValue(`visibility`),i=t.excludeStyleProps;for(let t=0;t<e.length;t++){let r=e[t];if(O(r)||i&&(i instanceof RegExp&&i.test(r)||typeof i==`function`&&i(r)))continue;let a=e.getPropertyValue(r);(r===`background-image`||r===`content`)&&a.includes(`url(`)&&!a.includes(`data:`)&&(a=`none`),n[r]=a}for(let t of[`text-decoration-line`,`text-decoration-color`,`text-decoration-style`,`text-decoration-thickness`,`text-underline-offset`,`text-decoration-skip-ink`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}for(let t of[`-webkit-text-stroke`,`-webkit-text-stroke-width`,`-webkit-text-stroke-color`,`paint-order`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}if(t.embedFonts){for(let t of[`font-feature-settings`,`font-variation-settings`,`font-kerning`,`font-variant`,`font-variant-ligatures`,`font-optical-sizing`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}}r===`hidden`&&(n.opacity=`0`);try{(n[`content-visibility`]||e.getPropertyValue(`content-visibility`))===`hidden`&&(n.visibility=`hidden`)}catch{}let a=parseFloat(e.getPropertyValue(`border-top-width`)||0)||0,o=parseFloat(e.getPropertyValue(`border-right-width`)||0)||0,s=parseFloat(e.getPropertyValue(`border-bottom-width`)||0)||0,c=parseFloat(e.getPropertyValue(`border-left-width`)||0)||0;if(a===0&&o===0&&s===0&&c===0){let t=(e.getPropertyValue(`border-image-source`)||``).trim(),r=t&&t!==`none`;for(let e of`border.border-top.border-right.border-bottom.border-left.border-width.border-style.border-color.border-top-width.border-top-style.border-top-color.border-right-width.border-right-style.border-right-color.border-bottom-width.border-bottom-style.border-bottom-color.border-left-width.border-left-style.border-left-color.border-block.border-block-width.border-block-style.border-block-color.border-inline.border-inline-width.border-inline-style.border-inline-color`.split(`.`))delete n[e];r||(n.border=`none`)}return n}var Ue=new WeakMap;function We(e){let t=Ue.get(e);return t||(t=Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0).map(([e,t])=>`${e}:${t}`).join(`;`),Ue.set(e,t),t)}function Ge(e,t=null,n={}){let r=Ie.get(e);if(r&&r.epoch===Re)return r.snapshot;let i=t||getComputedStyle(e),a=He(i,n);return Qe(e,i,a),Ie.set(e,{epoch:Re,snapshot:a}),a}function Ke(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:V,defaultStyle:o.defaultStyle,baseStyle:o.baseStyle,image:o.image,resource:o.resource,background:o.background,font:o.font},options:t||{}}:{session:o.session,persist:{snapshotKeyCache:V,defaultStyle:o.defaultStyle,baseStyle:o.baseStyle,image:o.image,resource:o.resource,background:o.background,font:o.font},options:e||t||{}}}function qe(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],a=n.getPropertyValue(i);a&&t.style.setProperty(i,a)}}async function H(e,t,n,r){if(e.tagName===`STYLE`)return;let i=Ke(n,r),a=i.options&&i.options.cache||`auto`;a!==`disabled`&&Ve(document.documentElement),a===`disabled`&&!i.session.__bumpedForDisabled&&(ze(),V.clear(),i.session.__bumpedForDisabled=!0);let{session:o,persist:s}=i;if(!o.styleCache.has(e)){let t=null;try{t=getComputedStyle(e)}catch{}o.styleCache.set(e,t||getComputedStyle(document.documentElement))}let c=o.styleCache.get(e);e.getAttribute?.(`style`)&&qe(e,t,c);let l=Ge(e,c,i.options);if(Xe(e)){let e=c.getPropertyValue(`min-width`);(!e||e===`auto`||e===`0px`)&&(l[`min-width`]=`0px`)}let u=We(l),d=s.snapshotKeyCache.get(u);d||(d=k(l,e.tagName?.toLowerCase()||`div`),s.snapshotKeyCache.set(u,d)),o.styleMap.set(t,d)}function Je(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Ye(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 Xe(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||``;return n.includes(`flex`)||n.includes(`grid`)}function Ze(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 i=e.scrollHeight;return i===0?!1:i>(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Qe(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||![`div`,`section`,`article`,`main`,`aside`,`header`,`footer`,`nav`].includes(r))return;let i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!==`none`&&t.aspectRatio!==`auto`)return;let a=t.display||``;if(a.includes(`flex`)||a.includes(`grid`)||Je(e))return;let o=t.position;if(o===`absolute`||o===`fixed`||o===`sticky`||t.transform!==`none`||Ye(t)||Xe(e))return;let s=t.overflowX||t.overflow||`visible`,c=t.overflowY||t.overflow||`visible`;if(s!==`visible`||c!==`visible`)return;let l=t.clip;l&&l!==`auto`&&l!==`rect(auto, auto, auto, auto)`||t.visibility===`hidden`||t.opacity===`0`||Ze(e,t)&&(delete n.height,delete n[`block-size`])}se();var $e=[`fill`,`stroke`,`color`,`background-color`,`stop-color`],et=new Set([`symbol`,`defs`,`pattern`,`mask`,`clipPath`,`marker`,`linearGradient`,`radialGradient`,`filter`]);function tt(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI===`http://www.w3.org/2000/svg`&&et.has(t.localName))return!0;t=t.parentNode}return!1}var nt=new Map;function rt(e,t){let n=t+`::`+e.toLowerCase(),r=nt.get(n);if(r)return r;let i=document,a=t===`http://www.w3.org/2000/svg`?i.createElementNS(t,e):i.createElement(e),o=i.createElement(`div`);o.style.cssText=`position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;`,o.appendChild(a),i.documentElement.appendChild(o);let s=getComputedStyle(a),c={};for(let e of $e)c[e]=s.getPropertyValue(e)||``;return o.remove(),nt.set(n,c),c}function it(e,t){if(!(e instanceof Element)||!(t instanceof Element)||tt(e))return;let n=e.getAttribute?.(`style`),r=!!(n&&n.includes(`var(`));if(!r&&e.attributes?.length){let t=e.attributes;for(let e=0;e<t.length;e++){let n=t[e];if(n&&typeof n.value==`string`&&n.value.includes(`var(`)){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let n=e.style;if(n&&n.length){let e=new Set;for(let r=0;r<n.length;r++){let a=n[r];if(e.has(a))continue;e.add(a);let o=n.getPropertyValue(a);if(!o||!o.includes(`var(`))continue;let s=i&&i.getPropertyValue(a);if(s)try{t.style.setProperty(a,s.trim(),n.getPropertyPriority(a))}catch{}}}}if(r&&e.attributes?.length){let n=e.attributes;for(let e=0;e<n.length;e++){let r=n[e];if(!r||typeof r.value!=`string`||!r.value.includes(`var(`))continue;let a=r.name,o=i&&i.getPropertyValue(a);if(o)try{t.style.setProperty(a,o.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let n=e.namespaceURI||`html`,r=rt(e.tagName,n);for(let e of $e){let n=i.getPropertyValue(e)||``,a=r[e]||``;if(n&&n!==a)try{t.style.setProperty(e,n.trim())}catch{}}}}B(),B(),s(),w();function at(e,t,n){return Promise.all(e.map(e=>new Promise(r=>{function i(){I(n=>{!(n&&typeof n.timeRemaining==`function`)||n.timeRemaining()>0?t(e,r):i()},{fast:n})}i()})))}function ot(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function st(e,t,n=!0){return e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>e.startsWith(`:where(`)||e.startsWith(`@`)?e:`:where(${t} ${n?ot(e):e})`).join(`, `)}function ct(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(e,n)=>`:where(${t}:is(${n.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(e,n)=>`:where(:where(${n.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(e,n)=>`:where(${t} ${n.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(e,n,r,i)=>`${n}${r}${st(i,t,!0)}{`),e):``}function lt(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function ut(e){let t=``;try{e.querySelectorAll(`style`).forEach(e=>{t+=(e.textContent||``)+`
2
+ `;return n}function j(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let e of t)n.set(e,`c${r++}`);return n}function te(e){try{let t=e?.ownerDocument;if(!t)return typeof window<`u`?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle==`function`)return n;if(typeof window<`u`&&window.frames)for(let e=0;e<window.frames.length;e++)try{if(window.frames[e]?.document===t)return window.frames[e]}catch{}}catch{}return typeof window<`u`?window:null}function M(e,t=null){let n=()=>{let e={length:0,getPropertyValue:()=>``,item:()=>``};return e[Symbol.iterator]=function*(){},e};if(!(e instanceof Element)){let r=typeof window<`u`?window:null;if(r&&typeof r.getComputedStyle==`function`)try{return r.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=o.computedStyle.get(e);r||(r=new Map,o.computedStyle.set(e,r));let i=r.get(t);if(!i){let a=te(e),o=null;try{o=a&&typeof a.getComputedStyle==`function`?a.getComputedStyle(e,t):null}catch{}if(!o&&typeof window<`u`&&typeof window.getComputedStyle==`function`)try{e.ownerDocument===document&&(o=window.getComputedStyle(e,t))}catch{}i=o||n(),r.set(t,i)}return i}function ne(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);for(let e of oe){let n=t[`border-${e}-style`];(n===`none`||n===`hidden`||t[`border-${e}-width`]===`0px`)&&(delete t[`border-${e}-style`],delete t[`border-${e}-width`],delete t[`border-${e}-color`])}return t}function re(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&n++,a===`)`&&n--,a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var ie,N,P,F,ae,oe,se=t(()=>{s(),ie=new Set([`meta`,`script`,`noscript`,`title`,`link`,`template`]),N=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`]),P=/(?:^|-)(animation|transition)(?:-|$)/i,F=/^(--.+|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,ae=new Set([`cursor`,`pointer-events`,`touch-action`,`user-select`,`print-color-adjust`,`speak`,`reading-flow`,`reading-order`,`anchor-name`,`anchor-scope`,`container-name`,`container-type`,`timeline-scope`,`zoom`]),oe=[`top`,`right`,`bottom`,`left`]});function I(e,{fast:t=!1}={}){if(t)return e();`requestIdleCallback`in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ce(){if(typeof navigator>`u`)return!1;if(navigator.userAgentData)return navigator.userAgentData.platform===`iOS`;let e=navigator.userAgent||``,t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function L(){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),i=/mobile/i.test(e),a=!/safari/i.test(e),o=r&&i&&a,s=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),l=/ipad|iphone|ipod/.test(t)&&r;return n||o||s||c||l}function le(){if(typeof navigator>`u`)return!1;let e=(navigator.userAgent||``).toLowerCase();return e.includes(`firefox`)||e.includes(`fxios`)}var R=t(()=>{});function z(e,t,n){let r=e&&typeof e==`object`&&(e.options||e);r&&r.debug&&(n===void 0?console.warn(`[snapdom]`,t):console.warn(`[snapdom]`,t,n))}var ue=t(()=>{}),B=t(()=>{E(),se(),R(),f(),ue()}),de={};n(de,{toCanvas:()=>xe});function fe(e){return typeof e==`string`&&/^data:image\/svg\+xml/i.test(e)}function pe(e){let t=e.indexOf(`,`);return t>=0?decodeURIComponent(e.slice(t+1)):``}function me(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function he(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&r++,a===`)`&&(r=Math.max(0,r-1)),a===`;`&&r===0?(t.push(n),n=``):n+=a}return n.trim()&&t.push(n),t.map(e=>e.trim()).filter(Boolean)}function ge(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`&&r++,a===`)`&&(r=Math.max(0,r-1)),a===`,`&&r===0?(t.push(n.trim()),n=``):n+=a}n.trim()&&t.push(n.trim());let i=[];for(let e of t){if(/\binset\b/i.test(e))continue;let[t=`0px`,n=`0px`,r=`0px`]=e.match(/-?\d+(?:\.\d+)?px/gi)||[],a=e.replace(/-?\d+(?:\.\d+)?px/gi,``).replace(/\binset\b/gi,``).trim().replace(/\s{2,}/g,` `),o=!!a&&a!==`,`;i.push(`drop-shadow(${t} ${n} ${r}${o?` ${a}`:``})`)}return i.join(` `)}function _e(e){let t=he(e),n=null,r=null,i=null,a=[];for(let e of t){let t=e.indexOf(`:`);if(t<0)continue;let o=e.slice(0,t).trim().toLowerCase(),s=e.slice(t+1).trim();o===`box-shadow`?i=s:o===`filter`?n=s:o===`-webkit-filter`?r=s:a.push([o,s])}if(i){let e=ge(i);e&&(n=n?`${n} ${e}`:e,r=r?`${r} ${e}`:e)}let o=[...a];return n&&o.push([`filter`,n]),r&&o.push([`-webkit-filter`,r]),o.map(([e,t])=>`${e}:${t}`).join(`;`)}function ve(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,n)=>`${t}{${_e(n)}}`)}function ye(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,ve(t))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,n)=>`style=${t}${_e(n)}${t}`),e}function be(e){if(!L()||!fe(e))return e;try{return me(ye(pe(e)))}catch{return e}}async function xe(e,t){let{width:n,height:r,scale:i=1,dpr:a=1,meta:o={},backgroundColor:s}=t;e=be(e);let c=new Image;if(c.loading=`eager`,c.decoding=`sync`,c.crossOrigin=`anonymous`,c.src=e,await c.decode(),L()){c.style.cssText=`position:fixed;left:-99999px;top:-99999px;pointer-events:none`,document.body.appendChild(c);try{await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))}finally{try{c.remove()}catch{}}}let l=c.naturalWidth,u=c.naturalHeight,d=Number.isFinite(o.w0)?o.w0:l,f=Number.isFinite(o.h0)?o.h0:u,p,m,h=Number.isFinite(n),g=Number.isFinite(r);if(h&&g)p=Math.max(1,n),m=Math.max(1,r);else if(h){let e=n/Math.max(1,d);p=n,m=f*e}else if(g){let e=r/Math.max(1,f);m=r,p=d*e}else p=l,m=u;p*=i,m*=i;let _=document.createElement(`canvas`);_.width=p*a,_.height=m*a,_.style.width=`${p}px`,_.style.height=`${m}px`;let v=_.getContext(`2d`);return a!==1&&v.scale(a,a),s&&(v.save(),v.fillStyle=s,v.fillRect(0,0,p,m),v.restore()),v.drawImage(c,0,0,p,m),_}var Se=t(()=>{R()}),Ce={};n(Ce,{rasterize:()=>we});async function we(e,t){let n=await xe(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}var Te=t(()=>{Se()}),Ee={};n(Ee,{toImg:()=>De,toSvg:()=>De});async function De(e,t){let{scale:n=1,width:r,height:i,meta:a={}}=t,o=Number.isFinite(r),s=Number.isFinite(i),c=Number.isFinite(n)&&n!==1||o||s;if(L()&&c)return await we(e,{...t,format:`png`,quality:1,meta:a});let l=new Image;if(l.decoding=`sync`,l.loading=`eager`,l.src=e,await l.decode(),o&&s)l.style.width=`${r}px`,l.style.height=`${i}px`;else if(o){let e=Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.h0)?a.h0:l.naturalHeight,n=r/Math.max(1,e);l.style.width=`${r}px`,l.style.height=`${Math.round(t*n)}px`}else if(s){let e=Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.h0)?a.h0:l.naturalHeight,n=i/Math.max(1,t);l.style.height=`${i}px`,l.style.width=`${Math.round(e*n)}px`}else{let r=Math.round(l.naturalWidth*n),i=Math.round(l.naturalHeight*n);if(l.style.width=`${r}px`,l.style.height=`${i}px`,typeof e==`string`&&e.startsWith(`data:image/svg+xml`))try{let t=decodeURIComponent(e.split(`,`)[1]).replace(/width="[^"]*"/,`width="${r}"`).replace(/height="[^"]*"/,`height="${i}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`,l.src=e}catch(e){z(t,`SVG width/height patch in toImg failed`,e)}}return l}var Oe=t(()=>{B(),Te()}),ke={};n(ke,{toBlob:()=>Ae});async function Ae(e,t){let n=t.type;if(n===`svg`){let t=decodeURIComponent(e.split(`,`)[1]);return new Blob([t],{type:`image/svg+xml`})}let r=await xe(e,t);return new Promise(e=>r.toBlob(t=>e(t),`image/${n}`,t.quality))}var je=t(()=>{Se()}),Me={};n(Me,{download:()=>Pe});async function Ne(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(e){if(e.name!==`AbortError`)return!1}return!0}async function Pe(e,t){let n=new Set([`png`,`jpeg`,`jpg`,`webp`,`svg`]),r=(t?.type||``).toLowerCase(),i=n.has(r)?r:``,a=(t?.format||i||``).toLowerCase(),o=a===`jpg`?`jpeg`:a||`png`,s=t?.filename||`snapdom.${o}`,c={...t||{},format:o,type:o};c.dpr=1;let l=ce();if(o===`svg`){let t=await Ae(e,{...c,type:`svg`});if(l&&await Ne(t,s))return;let n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=s,document.body.appendChild(r),r.click(),URL.revokeObjectURL(n),r.remove();return}let u=await xe(e,c);if(l){let e=`image/${o}`,n=await new Promise(n=>u.toBlob(n,e,t?.quality));if(n&&await Ne(n,s))return}let d=document.createElement(`a`);d.href=u.toDataURL(`image/${o}`,t?.quality),d.download=s,document.body.appendChild(d),d.click(),d.remove()}var Fe=t(()=>{je(),Se(),R()});B(),B(),s();var Ie=new WeakMap,V=new Map,Le=2e3,Re=0;function ze(){Re++,V.size>Le&&V.clear()}var Be=!1;function Ve(e=document.documentElement){if(!Be){Be=!0;try{new MutationObserver(()=>ze()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>ze()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.(`loadingdone`,ze),e.ready?.then(()=>ze()).catch(()=>{}))}catch{}}}function He(e,t={}){let n={},r=e.getPropertyValue(`visibility`),i=t.excludeStyleProps;for(let t=0;t<e.length;t++){let r=e[t];if(O(r)||i&&(i instanceof RegExp&&i.test(r)||typeof i==`function`&&i(r)))continue;let a=e.getPropertyValue(r);(r===`background-image`||r===`content`)&&a.includes(`url(`)&&!a.includes(`data:`)&&(a=`none`),n[r]=a}for(let t of[`text-decoration-line`,`text-decoration-color`,`text-decoration-style`,`text-decoration-thickness`,`text-underline-offset`,`text-decoration-skip-ink`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}for(let t of[`-webkit-text-stroke`,`-webkit-text-stroke-width`,`-webkit-text-stroke-color`,`paint-order`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}if(t.embedFonts){for(let t of[`font-feature-settings`,`font-variation-settings`,`font-kerning`,`font-variant`,`font-variant-ligatures`,`font-optical-sizing`])if(!n[t])try{let r=e.getPropertyValue(t);r&&(n[t]=r)}catch{}}r===`hidden`&&(n.opacity=`0`);try{(n[`content-visibility`]||e.getPropertyValue(`content-visibility`))===`hidden`&&(n.visibility=`hidden`)}catch{}let a=parseFloat(e.getPropertyValue(`border-top-width`)||0)||0,o=parseFloat(e.getPropertyValue(`border-right-width`)||0)||0,s=parseFloat(e.getPropertyValue(`border-bottom-width`)||0)||0,c=parseFloat(e.getPropertyValue(`border-left-width`)||0)||0;if(a===0&&o===0&&s===0&&c===0){let t=(e.getPropertyValue(`border-image-source`)||``).trim(),r=t&&t!==`none`;for(let e of`border.border-top.border-right.border-bottom.border-left.border-width.border-style.border-color.border-top-width.border-top-style.border-top-color.border-right-width.border-right-style.border-right-color.border-bottom-width.border-bottom-style.border-bottom-color.border-left-width.border-left-style.border-left-color.border-block.border-block-width.border-block-style.border-block-color.border-inline.border-inline-width.border-inline-style.border-inline-color`.split(`.`))delete n[e];r||(n.border=`none`)}return n}var Ue=new WeakMap;function We(e){let t=Ue.get(e);return t||(t=Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0])).map(([e,t])=>`${e}:${t}`).join(`;`),Ue.set(e,t),t)}function Ge(e,t=null,n={}){let r=Ie.get(e);if(r&&r.epoch===Re)return r.snapshot;let i=t||getComputedStyle(e),a=He(i,n);return Qe(e,i,a),Ie.set(e,{epoch:Re,snapshot:a}),a}function Ke(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:V,defaultStyle:o.defaultStyle,baseStyle:o.baseStyle,image:o.image,resource:o.resource,background:o.background,font:o.font},options:t||{}}:{session:o.session,persist:{snapshotKeyCache:V,defaultStyle:o.defaultStyle,baseStyle:o.baseStyle,image:o.image,resource:o.resource,background:o.background,font:o.font},options:e||t||{}}}function qe(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],a=n.getPropertyValue(i);a&&t.style.setProperty(i,a)}}async function H(e,t,n,r){if(e.tagName===`STYLE`)return;let i=Ke(n,r),a=i.options&&i.options.cache||`auto`;a!==`disabled`&&Ve(document.documentElement),a===`disabled`&&!i.session.__bumpedForDisabled&&(ze(),V.clear(),i.session.__bumpedForDisabled=!0);let{session:o,persist:s}=i;if(!o.styleCache.has(e)){let t=null;try{t=getComputedStyle(e)}catch{}o.styleCache.set(e,t||getComputedStyle(document.documentElement))}let c=o.styleCache.get(e);e.getAttribute?.(`style`)&&qe(e,t,c);let l=Ge(e,c,i.options);if(Xe(e)){let e=c.getPropertyValue(`min-width`);(!e||e===`auto`||e===`0px`)&&(l[`min-width`]=`0px`)}let u=We(l),d=s.snapshotKeyCache.get(u);d||(d=k(l,e.tagName?.toLowerCase()||`div`),s.snapshotKeyCache.set(u,d)),o.styleMap.set(t,d)}function Je(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Ye(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 Xe(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||``;return n.includes(`flex`)||n.includes(`grid`)}function Ze(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 i=e.scrollHeight;return i===0?!1:i>(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}function Qe(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||![`div`,`section`,`article`,`main`,`aside`,`header`,`footer`,`nav`].includes(r))return;let i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!==`none`&&t.aspectRatio!==`auto`)return;let a=t.display||``;if(a.includes(`flex`)||a.includes(`grid`)||Je(e))return;let o=t.position;if(o===`absolute`||o===`fixed`||o===`sticky`||t.transform!==`none`||Ye(t)||Xe(e))return;let s=t.overflowX||t.overflow||`visible`,c=t.overflowY||t.overflow||`visible`;if(s!==`visible`||c!==`visible`)return;let l=t.clip;l&&l!==`auto`&&l!==`rect(auto, auto, auto, auto)`||t.visibility===`hidden`||t.opacity===`0`||Ze(e,t)&&(delete n.height,delete n[`block-size`])}se();var $e=[`fill`,`stroke`,`color`,`background-color`,`stop-color`],et=new Set([`symbol`,`defs`,`pattern`,`mask`,`clipPath`,`marker`,`linearGradient`,`radialGradient`,`filter`]);function tt(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI===`http://www.w3.org/2000/svg`&&et.has(t.localName))return!0;t=t.parentNode}return!1}var nt=new Map;function rt(e,t){let n=t+`::`+e.toLowerCase(),r=nt.get(n);if(r)return r;let i=document,a=t===`http://www.w3.org/2000/svg`?i.createElementNS(t,e):i.createElement(e),o=i.createElement(`div`);o.style.cssText=`position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;`,o.appendChild(a),i.documentElement.appendChild(o);let s=getComputedStyle(a),c={};for(let e of $e)c[e]=s.getPropertyValue(e)||``;return o.remove(),nt.set(n,c),c}function it(e,t){if(!(e instanceof Element)||!(t instanceof Element)||tt(e))return;let n=e.getAttribute?.(`style`),r=!!(n&&n.includes(`var(`));if(!r&&e.attributes?.length){let t=e.attributes;for(let e=0;e<t.length;e++){let n=t[e];if(n&&typeof n.value==`string`&&n.value.includes(`var(`)){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let n=e.style;if(n&&n.length){let e=new Set;for(let r=0;r<n.length;r++){let a=n[r];if(e.has(a))continue;e.add(a);let o=n.getPropertyValue(a);if(!o||!o.includes(`var(`))continue;let s=i&&i.getPropertyValue(a);if(s)try{t.style.setProperty(a,s.trim(),n.getPropertyPriority(a))}catch{}}}}if(r&&e.attributes?.length){let n=e.attributes;for(let e=0;e<n.length;e++){let r=n[e];if(!r||typeof r.value!=`string`||!r.value.includes(`var(`))continue;let a=r.name,o=i&&i.getPropertyValue(a);if(o)try{t.style.setProperty(a,o.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let n=e.namespaceURI||`html`,r=rt(e.tagName,n);for(let e of $e){let n=i.getPropertyValue(e)||``,a=r[e]||``;if(n&&n!==a)try{t.style.setProperty(e,n.trim())}catch{}}}}B(),B(),s(),w();function at(e,t,n){return Promise.all(e.map(e=>new Promise(r=>{function i(){I(n=>{!(n&&typeof n.timeRemaining==`function`)||n.timeRemaining()>0?t(e,r):i()},{fast:n})}i()})))}function ot(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function st(e,t,n=!0){return e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>e.startsWith(`:where(`)||e.startsWith(`@`)?e:`:where(${t} ${n?ot(e):e})`).join(`, `)}function ct(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(e,n)=>`:where(${t}:is(${n.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(e,n)=>`:where(:where(${n.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(e,n)=>`:where(${t} ${n.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(e,n,r,i)=>`${n}${r}${st(i,t,!0)}{`),e):``}function lt(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function ut(e){let t=``;try{e.querySelectorAll(`style`).forEach(e=>{t+=(e.textContent||``)+`
3
3
  `});let n=e.adoptedStyleSheets||[];for(let e of n)try{if(e&&e.cssRules)for(let n of e.cssRules)t+=n.cssText+`
4
4
  `}catch{}}catch{}return t}function dt(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 ft(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 pt(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 mt(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let e=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(e)return e}catch{}return``}function ht(e,t,n){let r=[];for(let n of t){let t=mt(e,n);t&&r.push(`${n}: ${t};`)}return r.length?`${n}{${r.join(``)}}
5
5
  `:``}function gt(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute(`data-sd-slotted`,``),e.querySelectorAll&&e.querySelectorAll(`*`).forEach(e=>e.setAttribute(`data-sd-slotted`,``)))}async function _t(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(e=>setTimeout(e,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function vt(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,a=0;try{let t=getComputedStyle(e);n=parseFloat(t.borderLeftWidth)||0,r=parseFloat(t.borderRightWidth)||0,i=parseFloat(t.borderTopWidth)||0,a=parseFloat(t.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(t.width-(n+r))),contentHeight:Math.max(0,Math.round(t.height-(i+a))),rect:t}}function U(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let e=parseFloat(r.width);!isNaN(e)&&e>0&&(t=e)}if(n===0){let e=parseFloat(r.height);!isNaN(e)&&e>0&&(n=e)}}catch{}if(t===0||n===0)try{if(t===0){let n=parseFloat(e.getAttribute(`width`));!isNaN(n)&&n>0&&(t=n)}if(n===0){let t=parseFloat(e.getAttribute(`height`));!isNaN(t)&&t>0&&(n=t)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function yt(e,t,n){let r=e.defaultView,i=r?r.scrollX:0,a=r?r.scrollY:0,o=e.body?e.body.scrollLeft:0,s=e.body?e.body.scrollTop:0,c=e.documentElement?e.documentElement.scrollLeft:0,l=e.documentElement?e.documentElement.scrollTop:0,u=e.createElement(`style`);return u.setAttribute(`data-sd-iframe-pin`,``),u.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(u),()=>{try{u.remove()}catch{}try{r&&typeof r.scrollTo==`function`&&r.scrollTo(i,a),e.body&&(e.body.scrollLeft=o,e.body.scrollTop=s),e.documentElement&&(e.documentElement.scrollLeft=c,e.documentElement.scrollTop=l)}catch{}}}async function bt(e,t,n){let r=await _t(e,3);if(!r)throw Error(`iframe document not accessible/ready`);let{contentWidth:i,contentHeight:a,rect:o}=vt(e),s=n?.snap;if(!s&&typeof window<`u`&&window.snapdom&&(s=window.snapdom),!s||typeof s.toPng!=`function`)throw Error(`[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.`);let c={...n,scale:1},l=yt(r,i,a),u;try{u=await s.toPng(r.documentElement,c)}finally{l()}u.style.display=`block`,u.style.width=`${i}px`,u.style.height=`${a}px`;let d=document.createElement(`div`);return t.nodeMap.set(d,e),H(e,d,t,n),d.style.overflow=`hidden`,d.style.display=`block`,d.style.width||(d.style.width=`${Math.round(o.width)}px`),d.style.height||(d.style.height=`${Math.round(o.height)}px`),d.appendChild(u),d}function xt(e){let{width:t,height:n}=U(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let a=i?parseFloat(i.width):NaN,o=i?parseFloat(i.height):NaN,s=Math.round(t||r.width||0),c=Math.round(n||r.height||0),l=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,s||16),u=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),d=(e.type||`text`).toLowerCase()===`checkbox`,f=!!e.checked,p=!!e.indeterminate,m=Math.max(Math.min(l,u),12),h=`middle`;try{i&&i.verticalAlign&&(h=i.verticalAlign)}catch{}let g=document.createElement(`div`);g.setAttribute(`data-snapdom-input-replacement`,e.type||`checkbox`),g.style.cssText=`display:inline-block;width:${m}px;height:${m}px;vertical-align:${h};flex-shrink:0;line-height:0;`;let _=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);_.setAttribute(`width`,String(m)),_.setAttribute(`height`,String(m)),_.setAttribute(`viewBox`,`0 0 ${m} ${m}`),g.appendChild(_);function v(){let e=`#0a6ed1`;try{i&&(e=i.accentColor||i.color||e)}catch{}let t=m-2;if(_.innerHTML=``,d){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`);if(n.setAttribute(`x`,`1`),n.setAttribute(`y`,`1`),n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`rx`,`2`),n.setAttribute(`ry`,`2`),n.setAttribute(`fill`,f?e:`none`),n.setAttribute(`stroke`,e),n.setAttribute(`stroke-width`,`2`),_.appendChild(n),f){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);e.setAttribute(`d`,`M 3 ${m/2} L ${m/2-1} ${m-1-2} L ${m-1-2} 3`),e.setAttribute(`stroke`,`white`),e.setAttribute(`stroke-width`,`2`),e.setAttribute(`fill`,`none`),e.setAttribute(`stroke-linecap`,`round`),e.setAttribute(`stroke-linejoin`,`round`),_.appendChild(e)}else if(p){let n=document.createElementNS(`http://www.w3.org/2000/svg`,`rect`),r=Math.max(6,t-4);n.setAttribute(`x`,String((m-r)/2)),n.setAttribute(`y`,String((m-2)/2)),n.setAttribute(`width`,String(r)),n.setAttribute(`height`,`2`),n.setAttribute(`fill`,e),n.setAttribute(`rx`,`1`),_.appendChild(n)}}else{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`);if(t.setAttribute(`cx`,String(m/2)),t.setAttribute(`cy`,String(m/2)),t.setAttribute(`r`,String((m-2)/2)),t.setAttribute(`fill`,f?e:`none`),t.setAttribute(`stroke`,e),t.setAttribute(`stroke-width`,`2`),_.appendChild(t),f){let e=document.createElementNS(`http://www.w3.org/2000/svg`,`circle`),t=Math.max(2,(m-4)*.35);e.setAttribute(`cx`,String(m/2)),e.setAttribute(`cy`,String(m/2)),e.setAttribute(`r`,String(t)),e.setAttribute(`fill`,`white`),_.appendChild(e)}}g.style.setProperty(`width`,`${m}px`,`important`),g.style.setProperty(`height`,`${m}px`,`important`),g.style.setProperty(`min-width`,`${m}px`,`important`),g.style.setProperty(`min-height`,`${m}px`,`important`)}return v(),{el:g,applyVisual:v}}var St=new a(80);async function W(e){if(o.resource?.has(e))return o.resource.get(e);if(St.has(e))return St.get(e);let t=(async()=>{let t=await b(e,{as:`dataURL`,silent:!0});if(!t.ok||typeof t.data!=`string`)throw Error(`[snapDOM] Failed to read blob URL: ${e}`);return o.resource?.set(e,t.data),t.data})();St.set(e,t);try{let n=await t;return St.set(e,n),n}catch(t){throw St.delete(e),t}}var Ct=/\bblob:[^)"'\s]+/g;async function wt(e){if(!e||e.indexOf(`blob:`)===-1)return e;let t=Array.from(new Set(e.match(Ct)||[]));if(t.length===0)return e;let n=e;for(let e of t)try{let t=await W(e);n=n.split(e).join(t)}catch{}return n}function Tt(e){return typeof e==`string`&&e.startsWith(`blob:`)}function Et(e){return(e||``).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/^(\S+)(\s+.+)?$/);return t?{url:t[1],desc:t[2]||``}:null}).filter(Boolean)}function Dt(e){return e.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(`, `)}async function Ot(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll(`img`):[];for(let e of r)try{let t=e.getAttribute(`src`)||e.currentSrc||``;if(Tt(t)){let n=await W(t);e.setAttribute(`src`,n)}let r=e.getAttribute(`srcset`);if(r&&r.includes(`blob:`)){let t=Et(r),i=!1;for(let e of t)if(Tt(e.url))try{e.url=await W(e.url),i=!0}catch(e){z(n,`blobUrlToDataUrl for srcset item failed`,e)}i&&e.setAttribute(`srcset`,Dt(t))}}catch(e){z(n,`resolveBlobUrls for img failed`,e)}let i=e.querySelectorAll?e.querySelectorAll(`image`):[];for(let e of i)try{let t=`http://www.w3.org/1999/xlink`,n=e.getAttribute(`href`)||e.getAttributeNS?.(t,`href`);if(Tt(n)){let r=await W(n);e.setAttribute(`href`,r),e.removeAttributeNS?.(t,`href`)}}catch(e){z(n,`resolveBlobUrls for SVG image href failed`,e)}let a=e.querySelectorAll?e.querySelectorAll(`[style*='blob:']`):[];for(let e of a)try{let t=e.getAttribute(`style`);if(t&&t.includes(`blob:`)){let n=await wt(t);e.setAttribute(`style`,n)}}catch(e){z(n,`replaceBlobUrls in inline style failed`,e)}let o=e.querySelectorAll?e.querySelectorAll(`style`):[];for(let e of o)try{let t=e.textContent||``;t.includes(`blob:`)&&(e.textContent=await wt(t))}catch(e){z(n,`replaceBlobUrls in style tag failed`,e)}for(let t of[`poster`]){let r=e.querySelectorAll?e.querySelectorAll(`[${t}^='blob:']`):[];for(let e of r)try{let n=e.getAttribute(t);Tt(n)&&e.setAttribute(t,await W(n))}catch(e){z(n,`resolveBlobUrls for ${t} failed`,e)}}}R();async function kt(e,t,n){if(!e)throw Error(`Invalid node`);let r=new Set,i=null,a=null;if(e.nodeType===Node.ELEMENT_NODE){let n=(e.localName||e.tagName||``).toLowerCase();if(e.id===`snapdom-sandbox`||e.hasAttribute(`data-snapdom-sandbox`)||ie.has(n))return null;if(n===`foreignobject`&&e.parentElement?.closest?.(`foreignObject`))return z(t,`Nested <foreignObject> skipped (SVG spec limitation — not rendered by browsers)`),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 t=document.createElement(`div`),{width:n,height:r}=U(e),i=n||e.getBoundingClientRect().width||0,a=r||e.getBoundingClientRect().height||0;return t.style.cssText=`display:inline-block;width:${i}px;height:${a}px;visibility:hidden;`,t}else if(n.excludeMode===`remove`)return null}if(n.exclude&&Array.isArray(n.exclude))for(let t of n.exclude)try{if(e.matches?.(t)){if(n.excludeMode===`hide`){let t=document.createElement(`div`),{width:n,height:r}=U(e),i=n||e.getBoundingClientRect().width||0,a=r||e.getBoundingClientRect().height||0;return t.style.cssText=`display:inline-block;width:${i}px;height:${a}px;visibility:hidden;`,t}else if(n.excludeMode===`remove`)return null}}catch(e){console.warn(`Invalid selector in exclude option: ${t}`,e)}if(typeof n.filter==`function`)try{if(!n.filter(e)){if(n.filterMode===`hide`){let t=document.createElement(`div`),{width:n,height:r}=U(e),i=n||e.getBoundingClientRect().width||0,a=r||e.getBoundingClientRect().height||0;return t.style.cssText=`display:inline-block;width:${i}px;height:${a}px;visibility:hidden;`,t}else if(n.filterMode===`remove`)return null}}catch(e){console.warn(`Error in filter function:`,e)}if(e.tagName===`IFRAME`){let r=!1;try{r=!!(e.contentDocument||e.contentWindow?.document)}catch(e){z(t,`iframe same-origin probe failed`,e)}if(r)try{return await bt(e,t,n)}catch(e){console.warn(`[SnapDOM] iframe rasterization failed, fallback:`,e)}if(r||console.warn(`[snapdom] cross-origin <iframe> skipped (cannot access content). Use options.placeholders to show a placeholder instead.`,e),n.placeholders){let{width:r,height:i}=U(e),a=document.createElement(`div`);return a.style.cssText=`width:${r}px;height:${i}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;`,H(e,a,t,n),a}else{let{width:r,height:i}=U(e),a=document.createElement(`div`);return a.style.cssText=`display:inline-block;width:${r}px;height:${i}px;visibility:hidden;`,H(e,a,t,n),a}}if(e.getAttribute(`data-capture`)===`placeholder`){let r=e.cloneNode(!1);t.nodeMap.set(r,e),H(e,r,t,n);let i=document.createElement(`div`);return i.textContent=e.getAttribute(`data-placeholder-text`)||``,i.style.cssText=`color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;`,r.appendChild(i),r}if(e.tagName===`CANVAS`){let r=``;try{let t=e.getContext(`2d`,{willReadFrequently:!0});try{t&&t.getImageData(0,0,1,1)}catch{}if(await new Promise(e=>requestAnimationFrame(e)),r=e.toDataURL(`image/png`),!r||r===`data:,`){try{t&&t.getImageData(0,0,1,1)}catch{}if(await new Promise(e=>requestAnimationFrame(e)),r=e.toDataURL(`image/png`),!r||r===`data:,`){let t=document.createElement(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n&&(n.drawImage(e,0,0),r=t.toDataURL(`image/png`))}}}catch(e){z(t,`Canvas toDataURL failed, using empty/fallback`,e)}let i=document.createElement(`img`);try{i.decoding=`sync`,i.loading=`eager`}catch(e){z(t,`img decoding/loading hints failed`,e)}r&&(i.src=r),i.width=e.width,i.height=e.height;let{width:a,height:o}=U(e);return a>0&&(i.style.width=`${a}px`),o>0&&(i.style.height=`${o}px`),t.nodeMap.set(i,e),H(e,i,t,n),i}if(e.tagName===`VIDEO`){let r=``;try{let t=document.createElement(`canvas`);t.width=e.videoWidth||e.offsetWidth||320,t.height=e.videoHeight||e.offsetHeight||240;let n=t.getContext(`2d`);n&&(n.drawImage(e,0,0,t.width,t.height),r=t.toDataURL(`image/png`),(!r||r===`data:,`)&&(r=``))}catch(e){z(t,`Video frame capture failed, using poster fallback`,e)}let i=document.createElement(`img`);try{i.decoding=`sync`,i.loading=`eager`}catch{}r?i.src=r:e.poster&&(i.src=e.poster),i.width=e.videoWidth||e.offsetWidth||0,i.height=e.videoHeight||e.offsetHeight||0;let{width:a,height:o}=U(e);return a>0&&(i.style.width=`${a}px`),o>0&&(i.style.height=`${o}px`),i.style.objectFit=`contain`,t.nodeMap.set(i,e),H(e,i,t,n),i}let o;try{if(o=e.cloneNode(!1),o.attributes?.length)try{for(let e of o.attributes)/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/.test(e.value)&&o.setAttribute(e.name,e.value.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]/g,``))}catch{}if(it(e,o),t.nodeMap.set(o,e),e.tagName===`IMG`){ft(e,o);try{let{width:t,height:n}=U(e),r=Math.round(t||0),i=Math.round(n||0);r&&(o.dataset.snapdomWidth=String(r)),i&&(o.dataset.snapdomHeight=String(i))}catch(e){z(t,`getUnscaledDimensions for IMG failed`,e)}try{let t=e.getAttribute(`style`)||``,n=window.getComputedStyle(e),r=e=>{let r=t.match(RegExp(`${e}\\s*:\\s*([^;]+)`,`i`)),i=r?r[1].trim():n.getPropertyValue(e);return/%|auto/i.test(String(i||``))},i=parseInt(o.dataset.snapdomWidth||`0`,10),a=parseInt(o.dataset.snapdomHeight||`0`,10),s=r(`width`)||!i,c=r(`height`)||!a;s&&i&&(o.style.width=`${i}px`),c&&a&&(o.style.height=`${a}px`);let l=n.getPropertyValue(`object-fit`),u=n.getPropertyValue(`object-position`);l&&l!==`fill`?(o.style.objectFit=l,u&&(o.style.objectPosition=u)):(i&&(o.style.minWidth=`${i}px`),a&&(o.style.minHeight=`${a}px`))}catch(e){z(t,`IMG dimension freeze failed`,e)}}}catch(t){throw console.error(`[Snapdom] Failed to clone node:`,e,t),t}let s=null;if(e instanceof HTMLTextAreaElement){let{width:t,height:n}=U(e),r=t||e.getBoundingClientRect().width||0,i=n||e.getBoundingClientRect().height||0;r&&(o.style.width=`${r}px`),i&&(o.style.height=`${i}px`)}if(e instanceof HTMLInputElement){let n=(e.type||`text`).toLowerCase();if((n===`checkbox`||n===`radio`)&&le()){let{el:n,applyVisual:r}=xt(e);t.nodeMap.set(n,e),s=r,o=n}else o.value=e.value,o.setAttribute(`value`,e.value),e.checked!==void 0&&(o.checked=e.checked,e.checked&&o.setAttribute(`checked`,``),e.indeterminate&&(o.indeterminate=e.indeterminate))}if((e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&!e.value&&e.placeholder)try{let t=window.getComputedStyle(e,`::placeholder`),n=t&&t.color;if(n&&n!==`rgba(0, 0, 0, 0)`){let e=`snapdom-ph-`+(Math.random()*1e6|0);o.classList.add(e);let r=document.createElement(`style`);r.textContent=`.${e}::placeholder{color:${n}!important;opacity:${t.opacity||`1`}!important;}`,o.prepend(r)}}catch{}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(a=e.value),e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement){e.disabled&&o.setAttribute(`disabled`,``),e.required&&o.setAttribute(`required`,``),e.readOnly&&o.setAttribute(`readonly`,``);let t=e;t.min!==void 0&&t.min!==``&&o.setAttribute(`min`,t.min),t.max!==void 0&&t.max!==``&&o.setAttribute(`max`,t.max),t.pattern!==void 0&&t.pattern!==``&&o.setAttribute(`pattern`,t.pattern);let n=e.getAttribute(`aria-invalid`);n!==null&&o.setAttribute(`aria-invalid`,n)}if(tt(e)||H(e,o,t,n),s&&s(),e instanceof SVGElement&&!tt(e)){let t=[`fill`,`stroke`,`stroke-width`,`stroke-dasharray`,`stroke-dashoffset`,`stroke-linecap`,`stroke-linejoin`,`stroke-miterlimit`,`opacity`,`fill-opacity`,`stroke-opacity`,`fill-rule`,`clip-rule`,`marker`,`marker-start`,`marker-mid`,`marker-end`,`visibility`,`display`];try{let n=window.getComputedStyle(e);for(let e of t){let t=n.getPropertyValue(e);t&&o.style.setProperty(e,t)}}catch{}}if(e.shadowRoot){let i=function(e,r){if(e.nodeType===Node.ELEMENT_NODE&&e.tagName===`STYLE`)return r(null);kt(e,t,n).then(e=>{r(e||null)}).catch(()=>{r(null)})};try{let t=e.shadowRoot.querySelectorAll(`slot`);for(let e of t){let t=[];try{t=e.assignedNodes?.({flatten:!0})||e.assignedNodes?.()||[]}catch{t=e.assignedNodes?.()||[]}for(let e of t)r.add(e)}}catch{}let a=lt(t),s=`[data-sd="${a}"]`;try{o.setAttribute(`data-sd`,a)}catch{}let c=ut(e.shadowRoot),l=ct(c,s),u=ht(e,pt(c),s);dt(o,u+l,a);let d=document.createDocumentFragment(),f=await at(Array.from(e.shadowRoot.childNodes),i,n.fast);d.append(...f.filter(e=>!!e)),o.appendChild(d)}if(e.tagName===`SLOT`){let r=function(e,r){kt(e,t,n).then(e=>{e&&gt(e),r(e||null)}).catch(()=>{r(null)})},i=e.assignedNodes?.({flatten:!0})||[],a=i.length>0?i:Array.from(e.childNodes),o=document.createDocumentFragment(),s=await at(Array.from(a),r,n.fast);return o.append(...s.filter(e=>!!e)),o}function c(e,i){if(r.has(e))return i(null);kt(e,t,n).then(e=>{i(e||null)}).catch(()=>{i(null)})}let l=await at(Array.from(e.childNodes),c,n.fast);if(o.append(...l.filter(e=>!!e)),i!==null&&o instanceof HTMLSelectElement){o.value=i;for(let e of o.options)e.value===i?e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}return a!==null&&o instanceof HTMLTextAreaElement&&(o.textContent=a),o}B(),f(),s();var At=[/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],G=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__||{}),jt=[];function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Nt(e){let t=Array.isArray(e)?e:[e];for(let e of t)e instanceof RegExp?jt.push(e):typeof e==`string`?jt.push(new RegExp(Mt(e),`i`)):console.warn(`[snapdom] Ignored invalid iconFont value:`,e)}function K(e){let t=typeof e==`string`?e:``,n=[...At,...jt];for(let e of n)if(e instanceof RegExp&&e.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 Pt(e=``){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var Ft=new Map;function It(e=``){let t=Object.create(null),n=String(e||``),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function Lt(e,t,n){let r=String(e||``),i=r.toLowerCase(),a=String(t||``).toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i)||!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let o=n&&(n.FILL??n.fill),s=`outlined`;/\brounded\b/.test(a)||/\bround\b/.test(a)?s=`rounded`:/\bsharp\b/.test(a)?s=`sharp`:/\boutlined\b/.test(a)&&(s=`outlined`);let c=o===1,l=null;if(c&&(s===`outlined`&&G.materialIconsFilled?l={url:G.materialIconsFilled,alias:`snapdom-mi-filled`}:s===`rounded`&&G.materialIconsRound?l={url:G.materialIconsRound,alias:`snapdom-mi-round`}:s===`sharp`&&G.materialIconsSharp&&(l={url:G.materialIconsSharp,alias:`snapdom-mi-sharp`})),!l)return{familyForMeasure:r,familyForCanvas:r};if(!Ft.has(l.alias))try{let e=new FontFace(l.alias,`url(${l.url})`,{style:`normal`,weight:`400`});document.fonts.add(e),await e.load(),Ft.set(l.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${l.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function Rt(e=`Material Icons`,t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,``)}"`),document.fonts.ready])}catch{}}function zt(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 Bt(e,{family:t=`Material Icons`,weight:n=`normal`,fontSize:r=32,color:i=`#000`,variation:a=``,className:o=``}={}){let s=String(t||``).replace(/^['"]+|['"]+$/g,``),c=window.devicePixelRatio||1,{familyForMeasure:l,familyForCanvas:u}=await Lt(s,o,It(a));await Rt(u.replace(/^["']+|["']+$/g,``),r);let d=document.createElement(`span`);d.textContent=e,d.style.position=`absolute`,d.style.visibility=`hidden`,d.style.left=`-99999px`,d.style.whiteSpace=`nowrap`,d.style.fontFamily=l,d.style.fontWeight=String(n||`normal`),d.style.fontSize=`${r}px`,d.style.lineHeight=`1`,d.style.margin=`0`,d.style.padding=`0`,d.style.fontFeatureSettings=`'liga' 1`,d.style.fontVariantLigatures=`normal`,d.style.color=i,document.body.appendChild(d);let f=d.getBoundingClientRect(),p=Math.max(1,Math.ceil(f.width)),m=Math.max(1,Math.ceil(f.height));document.body.removeChild(d);let h=document.createElement(`canvas`);h.width=p*c,h.height=m*c;let g=h.getContext(`2d`);g.scale(c,c),g.font=`${n?`${n} `:``}${r}px ${u}`,g.textAlign=`left`,g.textBaseline=`top`,g.fillStyle=i;try{g.fontKerning=`normal`}catch{}return g.fillText(e,0,0),{dataUrl:h.toDataURL(),width:p,height:m}}async function Vt(e,t){if(!(e instanceof Element))return 0;let n=`.material-icons, [class*="material-symbols"]`,r=Array.from(e.querySelectorAll(n)).filter(e=>e&&e.textContent&&e.textContent.trim());if(r.length===0)return 0;let i=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(e=>e&&e.textContent&&e.textContent.trim()):[],a=0;for(let e=0;e<r.length;e++){let t=r[e],n=i[e]||null;try{let e=getComputedStyle(n||t),r=e.fontFamily||`Material Icons`;if(!Pt(r))continue;let i=(n||t).textContent.trim();if(!i)continue;let o=parseInt(e.fontSize,10)||24,{dataUrl:s,width:c,height:l}=await Bt(i,{family:r,weight:e.fontWeight&&e.fontWeight!==`normal`?e.fontWeight:`normal`,fontSize:o,color:zt(e),variation:e.fontVariationSettings&&e.fontVariationSettings!==`normal`?e.fontVariationSettings:``,className:(n||t).className||``});t.textContent=``;let u=t.ownerDocument.createElement(`img`);u.src=s,u.alt=i,u.style.height=`${o}px`,u.style.width=`${Math.max(1,Math.round(c/l*o))}px`,u.style.objectFit=`contain`,u.style.verticalAlign=getComputedStyle(t).verticalAlign||`baseline`,t.appendChild(u),a++}catch{}}return a}w();async function Ht(e,t,n,r=32,i=`#000`){t=t.replace(/^['"]+|['"]+$/g,``);let a=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let o=document.createElement(`span`);o.textContent=e,o.style.position=`absolute`,o.style.visibility=`hidden`,o.style.fontFamily=`"${t}"`,o.style.fontWeight=n||`normal`,o.style.fontSize=`${r}px`,o.style.lineHeight=`1`,o.style.whiteSpace=`nowrap`,o.style.padding=`0`,o.style.margin=`0`,document.body.appendChild(o);let s=o.getBoundingClientRect(),c=Math.ceil(s.width),l=Math.ceil(s.height);document.body.removeChild(o);let u=document.createElement(`canvas`);u.width=Math.max(1,c*a),u.height=Math.max(1,l*a);let d=u.getContext(`2d`);return d.scale(a,a),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign=`left`,d.textBaseline=`top`,d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:c,height:l}}var Ut=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`emoji`,`math`,`fangsong`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`]),Wt=[`katex`,`mathjax`,`mathml`];function Gt(e){if(!e)return``;for(let t of e.split(`,`)){let e=t.trim().replace(/^['"]+|['"]+$/g,``);if(e&&!Ut.has(e.toLowerCase()))return e}return``}function Kt(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim().replace(/^['"]+|['"]+$/g,``);e&&(Ut.has(e.toLowerCase())||t.push(e))}return t}function qt(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 Jt(e){let t=String(e??`normal`).trim().toLowerCase();return t.startsWith(`italic`)?`italic`:t.startsWith(`oblique`)?`oblique`:`normal`}function Yt(e){let t=String(e??`100%`).match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function Xt(e){let t=String(e||`400`).trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let e=qt(n[1]),t=qt(n[2]);return{min:Math.min(e,t),max:Math.max(e,t)}}let r=qt(t);return{min:r,max:r}}function Zt(e){let t=String(e||`normal`).trim().toLowerCase();return t===`italic`?{kind:`italic`}:t.startsWith(`oblique`)?{kind:`oblique`}:{kind:`normal`}}function Qt(e){let t=String(e||`100%`).trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let e=parseFloat(n[1]),t=parseFloat(n[2]);return{min:Math.min(e,t),max:Math.max(e,t)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function $t(e){return!e||typeof e!=`string`?``:e.replace(/\s+(variable|vf|v[0-9]+)$/i,``).trim().toLowerCase().replace(/\s+/g,`-`)}function en(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if([`fonts.googleapis.com`,`fonts.gstatic.com`,`use.typekit.net`,`p.typekit.net`,`kit.fontawesome.com`,`use.fontawesome.com`,`cdn.jsdelivr.net`,`unpkg.com`,`cdnjs.cloudflare.com`,`esm.sh`].some(e=>i.endsWith(e))||n.some(e=>i===e.toLowerCase()||i.endsWith(`.`+e.toLowerCase())))return!0;let a=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(a)||/\.woff2?(\b|$)/.test(a)||Wt.some(e=>a.includes(e)))return!0;for(let e of t){let t=e.toLowerCase().replace(/\s+/g,`+`),n=e.toLowerCase().replace(/\s+/g,`-`),r=$t(e);if(a.includes(t)||a.includes(n)||r&&a.includes(r))return!0}return!1}catch{return!1}}function tn(e){let t=new Set;for(let n of e||[]){let e=String(n).split(`__`)[0]?.trim();e&&t.add(e)}return t}function nn(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(e,n,r)=>{let i=(r||``).trim();if(!i||/^data:|^blob:|^https?:|^file:|^about:/i.test(i))return e;let a=i;try{a=new URL(i,t||location.href).href}catch{}return`url("${a}")`})}var rn=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,an=4;async function on(e,t,n){if(!e)return e;let r=new Set;function i(e,t){try{return new URL(e,t||location.href).href}catch{return e}}async function a(e,t,o=0){if(o>an)return console.warn(`[snapDOM] @import depth exceeded (${an}) at ${t}`),e;let s=``,c=0,l;for(;l=rn.exec(e);){s+=e.slice(c,l.index),c=rn.lastIndex;let u=i((l[2]||l[4]||``).trim(),t);if(r.has(u)){console.warn(`[snapDOM] Skipping circular @import: ${u}`);continue}r.add(u);let d=``;try{let e=await b(u,{as:`text`,useProxy:n,silent:!0});e.ok&&typeof e.data==`string`&&(d=e.data)}catch{}d?(d=nn(d,u),d=await a(d,u,o+1),s+=`
6
6
  /* inlined: ${u} */
7
7
  ${d}
8
- `):s+=l[0]}return s+=e.slice(c),s}let o=nn(e,t||location.href);return o=await a(o,t||location.href,0),o}var sn=/url\((["']?)([^"')]+)\1\)/g,cn=/@font-face[^{}]*\{[^}]*\}/g;function ln(e){if(!e)return[];let t=[],n=e.split(`,`).map(e=>e.trim()).filter(Boolean);for(let e of n){let n=e.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!n)continue;let r=n[1],i=n[2],a=e=>e.includes(`?`)?[parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]:parseInt(e,16);if(i){let e=a(r),n=a(i),o=Array.isArray(e)?e[0]:e,s=Array.isArray(n)?n[1]:n;t.push([Math.min(o,s),Math.max(o,s)])}else{let e=a(r);Array.isArray(e)?t.push([e[0],e[1]]):t.push([e,e])}}return t}function un(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[e,r]of t)if(n>=e&&n<=r)return!0;return!1}function dn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(sn)){let e=(r[2]||``).trim();if(!(!e||e.startsWith(`data:`))){if(!/^https?:/i.test(e))try{e=new URL(e,t||location.href).href}catch{}n.push(e)}}return n}async function fn(e,t,n=``){let r=e;for(let i of e.matchAll(sn)){let e=c(i[0]);if(!e)continue;let a=e;if(!a.startsWith(`http`)&&!a.startsWith(`data:`))try{a=new URL(a,t||location.href).href}catch{}if(!K(a)){if(o.resource?.has(a)){o.font?.add(a),r=r.replace(i[0],`url(${o.resource.get(a)})`);continue}if(!o.font?.has(a))try{let e=await b(a,{as:`dataURL`,useProxy:n,silent:!0});if(e.ok&&typeof e.data==`string`){let t=e.data;o.resource?.set(a,t),o.font?.add(a),r=r.replace(i[0],`url(${t})`)}}catch{console.warn(`[snapDOM] Failed to fetch font resource:`,a)}}}return r}function pn(e){if(!e.length)return null;let t=(t,n)=>e.some(([e,r])=>!(r<t||e>n)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),a=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?`vietnamese`:a?`cyrillic`:i?`greek`:r?`latin-ext`:n?`latin`:null}function mn(e={}){let t=new Set((e.families||[]).map(e=>String(e).toLowerCase())),n=new Set((e.domains||[]).map(e=>String(e).toLowerCase())),r=new Set((e.subsets||[]).map(e=>String(e).toLowerCase()));return(e,i)=>{if(t.size&&t.has(e.family.toLowerCase()))return!0;if(n.size)for(let t of e.srcUrls)try{if(n.has(new URL(t).host.toLowerCase()))return!0}catch{}if(r.size){let e=pn(i);if(e&&r.has(e))return!0}return!1}}function hn(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let i of e.match(t)||[]){let e=Gt(i.match(/font-family:\s*([^;]+);/i)?.[1]||``),t=(i.match(/font-weight:\s*([^;]+);/i)?.[1]||`400`).trim(),a=(i.match(/font-style:\s*([^;]+);/i)?.[1]||`normal`).trim(),o=(i.match(/font-stretch:\s*([^;]+);/i)?.[1]||`100%`).trim(),s=(i.match(/unicode-range:\s*([^;]+);/i)?.[1]||``).trim(),c=(i.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||``).trim(),l=dn(c,location.href),u=l.length?l.map(e=>String(e).toLowerCase()).sort().join(`|`):c.toLowerCase(),d=[String(e||``).toLowerCase(),t,a,o,s.toLowerCase(),u].join(`|`);n.has(d)||(n.add(d),r.push(i))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||``)}function gn(e,t,n,r,i){return`fonts-embed-css::req=${Array.from(e||[]).sort().join(`|`)}::ex=${t?JSON.stringify({families:(t.families||[]).map(e=>String(e).toLowerCase()).sort(),domains:(t.domains||[]).map(e=>String(e).toLowerCase()).sort(),subsets:(t.subsets||[]).map(e=>String(e).toLowerCase()).sort()}):``}::lf=${(n||[]).map(e=>`${(e.family||``).toLowerCase()}::${e.weight||`normal`}::${e.style||`normal`}::${e.src||``}`).sort().join(`|`)}::px=${r||``}::fd=${(i||[]).map(e=>String(e).toLowerCase()).sort().join(`|`)}`}async function _n(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let a=(e,t)=>{try{return new URL(e,t||location.href).href}catch{return e}};for(let e of i){if(e.type===CSSRule.IMPORT_RULE&&e.styleSheet){let i=e.href?a(e.href,t):t;if(r.depth>=an){console.warn(`[snapDOM] CSSOM import depth exceeded (${an}) at ${i}`);continue}if(i&&r.visitedSheets.has(i)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${i}`);continue}i&&r.visitedSheets.add(i);let o={...r,depth:(r.depth||0)+1};await _n(e.styleSheet,i,n,o);continue}if(e.type===CSSRule.FONT_FACE_RULE){let i=Gt((e.style.getPropertyValue(`font-family`)||``).trim());if(!i||K(i))continue;let a=(e.style.getPropertyValue(`font-weight`)||`400`).trim(),o=(e.style.getPropertyValue(`font-style`)||`normal`).trim(),s=(e.style.getPropertyValue(`font-stretch`)||`100%`).trim(),c=(e.style.getPropertyValue(`src`)||``).trim(),l=(e.style.getPropertyValue(`unicode-range`)||``).trim();if(!r.faceMatchesRequired(i,o,a,s))continue;let u=ln(l);if(!un(r.usedCodepoints,u))continue;let d={family:i,weightSpec:a,styleSpec:o,stretchSpec:s,unicodeRange:l,srcRaw:c,srcUrls:dn(c,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,u))continue;/url\(/i.test(c)?await n(`@font-face{font-family:${i};src:${await fn(c,t||location.href,r.useProxy)};font-style:${o};font-weight:${a};font-stretch:${s};${l?`unicode-range:${l};`:``}}`):await n(`@font-face{font-family:${i};src:${c};font-style:${o};font-weight:${a};font-stretch:${s};${l?`unicode-range:${l};`:``}}`)}}}async function vn({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i=``,fontStylesheetDomains:a=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let s=new Map;for(let t of e){let[e,n,r,i]=String(t).split(`__`);if(!e)continue;let a=s.get(e)||[];a.push({w:parseInt(n,10),s:r,st:parseInt(i,10)}),s.set(e,a)}function c(e,t,n,r){if(!s.has(e))return!1;let i=s.get(e),a=Xt(n),o=Zt(t),c=Qt(r),l=a.min!==a.max,u=a.min,d=e=>o.kind===`normal`&&e===`normal`||o.kind!==`normal`&&(e===`italic`||e===`oblique`),f=!1;for(let e of i){let t=l?e.w>=a.min&&e.w<=a.max:e.w===u,n=d(Jt(e.s)),r=e.st>=c.min&&e.st<=c.max;if(t&&n&&r){f=!0;break}}if(f)return!0;if(!l)for(let e of i){let t=d(Jt(e.s)),n=e.st>=c.min&&e.st<=c.max;if(Math.abs(u-e.w)<=300&&t&&n)return!0}if(!l&&o.kind===`normal`&&i.some(e=>Jt(e.s)!==`normal`))for(let e of i){let t=Math.abs(u-e.w)<=300,n=e.st>=c.min&&e.st<=c.max;if(t&&n)return!0}return!1}let l=mn(n),u=gn(e,n,r,i,a);if(o.resource?.has(u))return o.resource.get(u);let d=tn(e),f=[],p=rn;for(let e of document.querySelectorAll(`style`)){let t=e.textContent||``;for(let e of t.matchAll(p)){let t=(e[2]||e[4]||``).trim();!t||K(t)||document.querySelector(`link[rel="stylesheet"][href="${t}"]`)||f.push(t)}}f.length&&await Promise.all(f.map(e=>new Promise(t=>{if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return t(null);let n=document.createElement(`link`);n.rel=`stylesheet`,n.href=e,n.setAttribute(`data-snapdom`,`injected-import`),n.onload=()=>t(n),n.onerror=()=>t(null),document.head.appendChild(n)})));let m=``,h=Array.from(document.querySelectorAll(`link[rel="stylesheet"]`)).filter(e=>!!e.href);for(let e of h)try{if(K(e.href))continue;let r=``,o=!1;try{o=new URL(e.href,location.href).origin===location.origin}catch{}if(!o){let t=Array.isArray(a)?a:[];if(!en(e.href,d,t))continue}if(o){let t=Array.from(document.styleSheets).find(t=>t.href===e.href);if(t)try{let e=t.cssRules||[];r=Array.from(e).map(e=>e.cssText).join(``)}catch{}}if(!r){let t=await b(e.href,{as:`text`,useProxy:i});if(t?.ok&&typeof t.data==`string`&&(r=t.data),K(e.href))continue}r=await on(r,e.href,i);let s=``;for(let a of r.match(cn)||[]){let r=Gt((a.match(/font-family:\s*([^;]+);/i)?.[1]||``).trim());if(!r||K(r))continue;let o=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||`400`).trim(),u=(a.match(/font-style:\s*([^;]+);/i)?.[1]||`normal`).trim(),d=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||`100%`).trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||``).trim(),p=(a.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||``).trim(),m=dn(p,e.href);if(!c(r,u,o,d))continue;let h=ln(f);if(!un(t,h))continue;let g={family:r,weightSpec:o,styleSpec:u,stretchSpec:d,unicodeRange:f,srcRaw:p,srcUrls:m,href:e.href};if(n&&l(g,h))continue;let _=/url\(/i.test(p)?await fn(a,e.href,i):a;s+=_}s.trim()&&(m+=s)}catch{console.warn(`[snapDOM] Failed to process stylesheet:`,e.href)}let g={requiredIndex:s,usedCodepoints:t,faceMatchesRequired:c,simpleExcluder:n?mn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let e of document.styleSheets)if(!(e.href&&h.some(t=>t.href===e.href)))try{let t=e.href||location.origin+`/`;t&&g.visitedSheets.add(t),await _n(e,t,async e=>{m+=e},g)}catch{}try{for(let e of document.fonts||[]){if(!e||!e.family||e.status!==`loaded`||!e._snapdomSrc)continue;let t=String(e.family).replace(/^['"]+|['"]+$/g,``);if(K(t)||!s.has(t)||n?.families&&n.families.some(e=>String(e).toLowerCase()===t.toLowerCase()))continue;let r=e._snapdomSrc;if(!String(r).startsWith(`data:`)){if(o.resource?.has(e._snapdomSrc))r=o.resource.get(e._snapdomSrc),o.font?.add(e._snapdomSrc);else if(!o.font?.has(e._snapdomSrc))try{let t=await b(e._snapdomSrc,{as:`dataURL`,useProxy:i,silent:!0});if(t.ok&&typeof t.data==`string`)r=t.data,o.resource?.set(e._snapdomSrc,r),o.font?.add(e._snapdomSrc);else continue}catch{console.warn(`[snapDOM] Failed to fetch dynamic font src:`,e._snapdomSrc);continue}}m+=`@font-face{font-family:'${t}';src:url(${r});font-style:${e.style||`normal`};font-weight:${e.weight||`normal`};}`}}catch{}for(let e of r){if(!e||typeof e!=`object`)continue;let t=String(e.family||``).replace(/^['"]+|['"]+$/g,``);if(!t||K(t)||!s.has(t)||n?.families&&n.families.some(e=>String(e).toLowerCase()===t.toLowerCase()))continue;let r=e.weight==null?`normal`:String(e.weight),a=e.style==null?`normal`:String(e.style),c=e.stretchPct==null?`100%`:`${e.stretchPct}%`,l=String(e.src||``),u=l;if(!u.startsWith(`data:`)){if(o.resource?.has(l))u=o.resource.get(l),o.font?.add(l);else if(!o.font?.has(l))try{let e=await b(l,{as:`dataURL`,useProxy:i,silent:!0});if(e.ok&&typeof e.data==`string`)u=e.data,o.resource?.set(l,u),o.font?.add(l);else continue}catch{console.warn(`[snapDOM] Failed to fetch localFonts src:`,l);continue}}m+=`@font-face{font-family:'${t}';src:url(${u});font-style:${a};font-weight:${r};font-stretch:${c};}`}return m&&(m=hn(m),o.resource?.set(u,m)),m}function yn(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=e=>{let n=Kt(e.fontFamily);if(n.length)for(let r of n)t.add(((e,t,n)=>`${r}__${qt(e)}__${Jt(t)}__${Yt(n)}`)(e.fontWeight,e.fontStyle,e.fontStretch))};r(getComputedStyle(e));let i=getComputedStyle(e,`::before`);i&&i.content&&i.content!==`none`&&r(i);let a=getComputedStyle(e,`::after`);for(a&&a.content&&a.content!==`none`&&r(a);n.nextNode();){let e=n.currentNode;r(getComputedStyle(e));let t=getComputedStyle(e,`::before`);t&&t.content&&t.content!==`none`&&r(t);let i=getComputedStyle(e,`::after`);i&&i.content&&i.content!==`none`&&r(i)}return t}function bn(e){let t=new Set,n=e=>{if(e)for(let n of e)t.add(n.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let e=r.currentNode;if(e.nodeType===Node.TEXT_NODE)n(e.nodeValue||``);else if(e.nodeType===Node.ELEMENT_NODE){let r=e;for(let e of[`::before`,`::after`]){let i=getComputedStyle(r,e)?.getPropertyValue(`content`);if(!(!i||i===`none`))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let e=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(e)for(let n of e)try{t.add(parseInt(n.slice(1),16))}catch{}}}}}return t}async function xn(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let e=document.createElement(`div`);e.style.cssText=`position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;`;for(let t of n){let n=document.createElement(`span`);n.textContent=`AaBbGg1234ÁÉÍÓÚçñ—∞`,n.style.fontFamily=`"${t}"`,n.style.fontWeight=`700`,n.style.fontStyle=`italic`,n.style.fontSize=`32px`,n.style.lineHeight=`1`,n.style.whiteSpace=`nowrap`,n.style.margin=`0`,n.style.padding=`0`,e.appendChild(n)}document.body.appendChild(e),e.offsetWidth,document.body.removeChild(e)};for(let e=0;e<Math.max(1,t);e++)r(),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))}s();function Sn(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||``)}function Cn(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 wn(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)),i=``;for(let[e,t]of n)for(;r>=e;)i+=t,r-=e;return t?i:i.toLowerCase()}function Tn(e,t){switch((t||`decimal`).toLowerCase()){case`decimal`:return String(e);case`decimal-leading-zero`:{let t=Math.abs(e);return(e<0?`-`:``)+(t<10?`0`:``)+String(t)}case`lower-alpha`:return Cn(e,!1);case`upper-alpha`:return Cn(e,!0);case`lower-roman`:return wn(e,!1);case`upper-roman`:return wn(e,!0);default:return String(e)}}function En(e){let t=()=>o?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,a=e=>e&&e.tagName===`LI`,s=e=>{let t=0,n=e?.parentElement;if(!n)return 0;for(let r of n.children){if(r===e)break;r.tagName===`LI`&&t++}return t},c=e=>{let t=new Map;for(let[n,r]of e)t.set(n,r.slice());return t},l=(e,t,n)=>{let r=c(e),i;try{i=n.style?.counterReset||getComputedStyle(n).counterReset}catch{}if(i&&i!==`none`)for(let e of i.split(`,`)){let n=e.trim().split(/\s+/),i=n[0],a=Number.isFinite(Number(n[1]))?Number(n[1]):0;if(!i)continue;let o=t.get(i);if(o&&o.length){let e=o.slice();e.push(a),r.set(i,e)}else r.set(i,[a])}let o;try{o=n.style?.counterSet||getComputedStyle(n).counterSet}catch{}if(o&&o!==`none`)for(let e of o.split(`,`)){let t=e.trim().split(/\s+/),n=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):0;if(!n)continue;let a=r.get(n)||[];a.length===0&&a.push(0),a[a.length-1]=i,r.set(n,a)}let l;try{l=n.style?.counterIncrement||getComputedStyle(n).counterIncrement}catch{}if(l&&l!==`none`)for(let e of l.split(`,`)){let t=e.trim().split(/\s+/),n=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):1;if(!n)continue;let a=r.get(n)||[];a.length===0&&a.push(0),a[a.length-1]+=i,r.set(n,a)}try{if(getComputedStyle(n).display===`list-item`&&a(n)){let e=n.parentElement,t=1;if(e&&e.tagName===`OL`){let r=e.getAttribute(`start`),i=Number.isFinite(Number(r))?Number(r):1,a=s(n),o=n.getAttribute(`value`);t=Number.isFinite(Number(o))?Number(o):i+a}else t=1+s(n);let i=r.get(`list-item`)||[];i.length===0&&i.push(0),i[i.length-1]=t,r.set(`list-item`,i)}}catch{}return r},u=(e,t,n)=>{let i=l(n,t,e);r.set(e,i);let a=i;for(let t of e.children)a=u(t,i,a);let o=new Map;for(let[e,t]of n){let n=t.length,r=a.get(e);o.set(e,r&&r.length?r.slice(0,n):t.slice())}for(let[e,n]of a)!o.has(e)&&n.length&&!t.has(e)&&o.set(e,n.slice(0,1));return o},d=new Map;u(i,d,d);function f(){let e=t();if(e!==n){n=e;let t=new Map;u(i,t,t)}}return{get(e,t){f();let n=r.get(e)?.get(t);return n&&n.length?n[n.length-1]:0},getStack(e,t){f();let n=r.get(e)?.get(t);return n?n.slice():[]}}}function Dn(e,t,n){if(!e||e===`none`)return e;try{return e.replace(/\b(counter|counters)\s*\(([^)]+)\)/g,(e,r,i)=>{let a=String(i).split(`,`).map(e=>e.trim());if(r===`counter`){let e=a[0]?.replace(/^["']|["']$/g,``),r=(a[1]||`decimal`).toLowerCase();return Tn(n.get(t,e),r)}else{let e=a[0]?.replace(/^["']|["']$/g,``),r=a[1]?.replace(/^["']|["']$/g,``)??``,i=(a[2]||`decimal`).toLowerCase(),o=n.getStack(t,e);return o.length?o.map(e=>Tn(e,i)).join(r):``}})}catch{return`- `}}w(),s();var q=new WeakMap,On=1e3;function kn(e,t){let n=jn(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=Nn(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):Nn(e)}function An(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function jn(e){let t=e.querySelectorAll(`style,link[rel~="stylesheet"]`),n=`n:${t.length}|`,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i.tagName===`STYLE`){let e=i.textContent?i.textContent.length:0;n+=`S${e}|`;let t=i.sheet,a=t?An(t):null;a&&(r+=a.length)}else{let e=i.getAttribute(`href`)||``,t=i.getAttribute(`media`)||`all`;n+=`L${e}|m:${t}|`;let a=i.sheet,o=a?An(a):null;o&&(r+=o.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Mn(e,t,n){let r=An(e);if(!r)return!1;for(let e=0;e<r.length;e++){if(n.budget<=0)return!1;let i=r[e],a=i&&i.cssText?i.cssText:``;n.budget--;for(let e of t)if(a.includes(e))return!0;if(i&&i.cssRules&&i.cssRules.length)for(let e=0;e<i.cssRules.length&&n.budget>0;e++){let r=i.cssRules[e],a=r&&r.cssText?r.cssText:``;n.budget--;for(let e of t)if(a.includes(e))return!0}if(n.budget<=0)return!1}return!1}function Nn(e=document){let t=jn(e),n=q.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`],i=e.querySelectorAll(`style`);for(let n=0;n<i.length;n++){let a=i[n].textContent||``;for(let n of r)if(a.includes(n))return q.set(e,{fingerprint:t,result:!0}),!0}let a=e.adoptedStyleSheets;if(Array.isArray(a)&&a.length){let n={budget:On};try{for(let i of a)if(Mn(i,r,n))return q.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let n=e.querySelectorAll(`style,link[rel~="stylesheet"]`),i={budget:On};for(let a=0;a<n.length&&i.budget>0;a++){let o=n[a],s=null;if(o.tagName,s=o.sheet||null,s&&Mn(s,r,i))return q.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector(`[style*="counter("], [style*="counters("]`)?(q.set(e,{fingerprint:t,result:!0}),!0):(q.set(e,{fingerprint:t,result:!1}),!1)}var J=new WeakMap,Pn=-1;function Fn(e){if(!e)return``;let t=[],n=/"([^"]*)"/g,r=0,i;for(;i=n.exec(e);){let a=e.slice(r,i.index).trim();a&&t.push(a),t.push(i[1]),r=n.lastIndex}let a=e.slice(r).trim();return a&&t.push(a),t.join(``)}function In(e,t){let n=e.parentElement,r=n?J.get(n):null;return r?{get(e,n){let i=t.get(e,n),a=r.get(n);return typeof a==`number`?Math.max(i,a):i},getStack(e,n){let i=t.getStack(e,n);if(!i.length)return i;let a=r.get(n);if(typeof a==`number`){let e=i.slice();return e[e.length-1]=Math.max(e[e.length-1],a),e}return i}}:t}function Ln(e,t,n){let r=new Map;function i(e){let t=[];if(!e||e===`none`)return t;for(let n of String(e).split(`,`)){let e=n.trim().split(/\s+/),r=e[0],i=Number.isFinite(Number(e[1]))?Number(e[1]):void 0;r&&t.push({name:r,num:i})}return t}let a=i(t?.counterReset),o=i(t?.counterIncrement);function s(t){if(r.has(t))return r.get(t).slice();let i=n.getStack(e,t);i=i.length?i.slice():[];let s=a.find(e=>e.name===t);if(s){let e=Number.isFinite(s.num)?s.num:0;i=i.length?[...i,e]:[e]}let c=o.find(e=>e.name===t);if(c){let e=Number.isFinite(c.num)?c.num:1;i.length===0&&(i=[0]),i[i.length-1]+=e}return r.set(t,i.slice()),i}return{get(e,t){let n=s(t);return n.length?n[n.length-1]:0},getStack(e,t){return s(t)},__incs:o}}function Rn(e,t,n){let r;try{r=M(e,t)}catch{}let i=r?.content;if(!i||i===`none`||i===`normal`)return{text:``,incs:[]};let a=In(e,n),o=Ln(e,r,a);return{text:Fn(Sn(i)?Dn(i,e,o):i),incs:o.__incs||[]}}async function zn(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element)||!kn(e.ownerDocument||document,n))return;let i=o?.session?.__counterEpoch??0;if(Pn!==i&&(J=new WeakMap,n&&(n.__counterCtx=null),Pn=i),!n.__counterCtx)try{n.__counterCtx=En(e.ownerDocument||document)}catch(e){z(n,`buildCounterContext failed`,e)}let a=n.__counterCtx;for(let i of[`::before`,`::after`,`::first-letter`])try{let o=M(e,i);if(!o||o.content===`none`&&o.backgroundImage===`none`&&o.backgroundColor===`transparent`&&(o.borderStyle===`none`||parseFloat(o.borderWidth)===0)&&(!o.transform||o.transform===`none`)&&o.display===`inline`)continue;if(i===`::first-letter`){let r=M(e),i=(r?.display||``).toLowerCase();if(i.includes(`flex`)||i.includes(`grid`)||!(o.color!==r.color||o.fontSize!==r.fontSize||o.fontWeight!==r.fontWeight||o.fontFamily!==r.fontFamily||o.fontStyle!==r.fontStyle||o.textTransform!==r.textTransform||o.float!==r.float||o.paddingTop!==r.paddingTop||o.paddingRight!==r.paddingRight||o.paddingBottom!==r.paddingBottom||o.paddingLeft!==r.paddingLeft||o.marginTop!==r.marginTop||o.marginRight!==r.marginRight||o.marginBottom!==r.marginBottom||o.marginLeft!==r.marginLeft))continue;let a=Array.from(t.childNodes).find(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim().length>0);if(!a)continue;let s=a.textContent,c=s.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],l=s.slice(c?.length||0);if(!c||/[\uD800-\uDFFF]/.test(c))continue;let u=document.createElement(`span`);u.textContent=c,u.dataset.snapdomPseudo=`::first-letter`;let d=k(ne(o),`span`);n.styleMap.set(u,d);let f=document.createTextNode(l);t.replaceChild(f,a),t.insertBefore(u,f);continue}let s=o.content??``,l=s===``||s===`none`||s===`normal`,{text:d,incs:f}=Rn(e,i,a),p=o.backgroundImage,m=o.backgroundColor,h=o.fontFamily,g=parseInt(o.fontSize)||32,_=parseInt(o.fontWeight)||!1,v=o.color||`#000`,y=o.borderStyle,x=parseFloat(o.borderWidth),S=o.transform,C=K(h),w=!l&&d!==``,E=p&&p!==`none`,D=m&&m!==`transparent`&&m!==`rgba(0, 0, 0, 0)`,O=y&&y!==`none`&&x>0,A=S&&S!==`none`;if(!(w||E||D||O||A)){if(f&&f.length&&e.parentElement){let t=J.get(e.parentElement)||new Map;for(let{name:n}of f){if(!n)continue;let r=In(e,a),o=Ln(e,M(e,i),r).get(e,n);t.set(n,o)}J.set(e.parentElement,t)}continue}let ee=!1;if(w&&!C&&d.length>1&&!d.startsWith(`url(`)){let n=M(e),r=parseFloat(n.fontSize)||16,i=parseFloat(n.lineHeight);Number.isFinite(i)||(i=r*1.5),e.getBoundingClientRect().height<i*1.6&&(t.style.whiteSpace=`nowrap`,ee=!0)}let j=document.createElement(`span`);j.dataset.snapdomPseudo=i,j.style.pointerEvents=`none`,ee&&(j.style.whiteSpace=`nowrap`);let te=k(ne(o),`span`);if(n.styleMap.set(j,te),C&&d&&d.length===1){let{dataUrl:e,width:n,height:r}=await Ht(d,h,_,g,v),i=document.createElement(`img`);i.src=e,i.style=`height:${g}px;width:${n/r*g}px;object-fit:contain;`,j.appendChild(i),t.dataset.snapdomHasIcon=`true`}else if(d&&d.startsWith(`url(`)){let t=c(d);if(t?.trim())try{let e=await b(u(t),{as:`dataURL`,useProxy:r.useProxy});if(e?.ok&&typeof e.data==`string`){let t=document.createElement(`img`);t.src=e.data,t.style=`width:${g}px;height:auto;object-fit:contain;`,j.appendChild(t)}}catch(t){console.error(`[snapdom] Error in pseudo ${i} for`,e,t)}}else !C&&w&&(j.textContent=d);j.style.backgroundImage=`none`,`maskImage`in j.style&&(j.style.maskImage=`none`),`webkitMaskImage`in j.style&&(j.style.webkitMaskImage=`none`);try{j.style.backgroundRepeat=o.backgroundRepeat,j.style.backgroundSize=o.backgroundSize,o.backgroundPositionX&&o.backgroundPositionY?(j.style.backgroundPositionX=o.backgroundPositionX,j.style.backgroundPositionY=o.backgroundPositionY):j.style.backgroundPosition=o.backgroundPosition,j.style.backgroundOrigin=o.backgroundOrigin,j.style.backgroundClip=o.backgroundClip,j.style.backgroundAttachment=o.backgroundAttachment,j.style.backgroundBlendMode=o.backgroundBlendMode}catch{}if(E)try{let e=re(p),t=await Promise.all(e.map(T));j.style.backgroundImage=t.join(`, `)}catch(e){console.warn(`[snapdom] Failed to inline background-image for ${i}`,e)}D&&(j.style.backgroundColor=m);let ie=j.childNodes.length>0||j.textContent?.trim()!==``||E||D||O||A;if(f&&f.length&&e.parentElement){let t=J.get(e.parentElement)||new Map,n=In(e,a),r=Ln(e,M(e,i),n);for(let{name:n}of f){if(!n)continue;let i=r.get(e,n);t.set(n,i)}J.set(e.parentElement,t)}if(!ie)continue;i===`::before`?(t.dataset.snapdomHasBefore=`1`,t.insertBefore(j,t.firstChild)):(t.dataset.snapdomHasAfter=`1`,t.appendChild(j))}catch(t){console.warn(`[snapdom] Failed to capture ${i} for`,e,t)}let s=Array.from(t.children).filter(e=>!e.dataset.snapdomPseudo);if(n.nodeMap)for(let e of s){let t=n.nodeMap.get(e);t instanceof Element&&await zn(t,e,n,r)}else{let t=Array.from(e.children);for(let e=0;e<Math.min(t.length,s.length);e++)await zn(t[e],s[e],n,r)}}function Bn(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll(`svg`));if(i.length===0)return;let a=/url\(\s*#([^)]+)\)/g,o=[`fill`,`stroke`,`filter`,`clip-path`,`mask`,`marker`,`marker-start`,`marker-mid`,`marker-end`],s=e=>window.CSS&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`),c=e=>{if(!e||!e.getAttribute)return null;let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`):null);if(t)return t;let n=e.attributes;if(!n)return null;for(let e=0;e<n.length;e++){let t=n[e];if(!t||!t.name)continue;if(t.name===`href`)return t.value;let r=t.name.indexOf(`:`);if(r!==-1&&t.name.slice(r+1)===`href`)return t.value}return null},l=new Set(Array.from(e.querySelectorAll(`[id]`)).map(e=>e.id)),u=new Set,d=!1,f=(e,t=null)=>{if(!e)return;a.lastIndex=0;let n;for(;n=a.exec(e);){d=!0;let e=(n[1]||``).trim();e&&(l.has(e)||(u.add(e),t&&!t.has(e)&&t.add(e)))}},p=e=>{let t=e.querySelectorAll(`use`);for(let e of t){let t=c(e);if(!t||!t.startsWith(`#`))continue;d=!0;let n=t.slice(1).trim();n&&!l.has(n)&&u.add(n)}let n=e.querySelectorAll(`*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]`);for(let e of n){f(e.getAttribute(`style`)||``);for(let t of o)f(e.getAttribute(t))}};for(let e of i)p(e);if(!d)return;let m=e.querySelector(`svg.inline-defs-container`);m||(m=n.createElementNS(`http://www.w3.org/2000/svg`,`svg`),m.classList.add(`inline-defs-container`),m.setAttribute(`aria-hidden`,`true`),m.setAttribute(`style`,`position:absolute;width:0;height:0;overflow:hidden`),e.insertBefore(m,e.firstChild||null));let h=m.querySelector(`defs`)||null,g=t=>{if(!t||l.has(t))return null;let n=s(t),i=t=>{let n=r.querySelector(t);return n&&!e.contains(n)?n:null};return i(`svg defs > *#${n}`)||i(`svg > symbol#${n}`)||i(`*#${n}`)};if(!u.size)return;let _=new Set(u),v=new Set;for(;_.size;){let e=_.values().next().value;if(_.delete(e),!e||l.has(e)||v.has(e))continue;let t=g(e);if(!t){v.add(e);continue}h||(h=n.createElementNS(`http://www.w3.org/2000/svg`,`defs`),m.appendChild(h));let r=t.cloneNode(!0);r.id||r.setAttribute(`id`,e),h.appendChild(r),v.add(e),l.add(e);let i=[r,...r.querySelectorAll(`*`)];for(let e of i){let t=c(e);if(t&&t.startsWith(`#`)){let e=t.slice(1).trim();e&&!l.has(e)&&!v.has(e)&&_.add(e)}let n=e.getAttribute?.(`style`)||``;n&&f(n,_);for(let t of o){let n=e.getAttribute?.(t);n&&f(n,_)}}}}s();function Vn(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(),i=e.clientHeight,a=`data-snap-ph`,o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();){let s=o.currentNode,c=getComputedStyle(s),l=c.position;if(l!==`sticky`&&l!==`-webkit-sticky`)continue;let u=Hn(c.top),d=Hn(c.bottom);if(u==null&&d==null)continue;let f=Wn(t,Un(s,e),a);if(!f)continue;let p=s.getBoundingClientRect(),m=p.width,h=p.height,g=p.left-r.left;if(!(m>0&&h>0)||!Number.isFinite(g))continue;let _=u==null?n+(i-h-d):u+n;if(!Number.isFinite(_))continue;let v=Number.parseInt(c.zIndex,10),y=Number.isFinite(v),b=y?Math.max(v,1)+1:2,x=y?v-1:0,S=f.cloneNode(!1);S.setAttribute(a,`1`),S.style.position=`sticky`,S.style.left=`${g}px`,S.style.top=`${_}px`,S.style.width=`${m}px`,S.style.height=`${h}px`,S.style.visibility=`hidden`,S.style.zIndex=String(x),S.style.overflow=`hidden`,S.style.background=`transparent`,S.style.boxShadow=`none`,S.style.filter=`none`,f.parentElement?.insertBefore(S,f),f.style.position=`absolute`,f.style.left=`${g}px`,f.style.top=`${_}px`,f.style.bottom=`auto`,f.style.zIndex=String(b),f.style.pointerEvents=`none`}}function Hn(e){if(!e||e===`auto`)return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function Un(e,t){let n=[];for(let r=e;r&&r!==t;){let e=r.parentElement;if(!e)break;n.push(Array.prototype.indexOf.call(e.children,r)),r=e}return n.reverse()}function Wn(e,t,n){let r=e;for(let e=0;e<t.length;e++)if(r=Gn(r,n)[t[e]],!r)return null;return r instanceof HTMLElement?r:null}function Gn(e,t){let n=[],r=e.children;for(let e=0;e<r.length;e++){let i=r[e];i.hasAttribute(t)||n.push(i)}return n}function Kn(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,a=t.borderWidth;n!==`none`&&parseFloat(r)>0&&(i===`none`||parseFloat(a)===0)&&(e.style.border=`${r} solid transparent`)}function qn(e){let t=[];try{let n=e.querySelectorAll(`*`);for(let e of n){if(!(e instanceof HTMLElement))continue;let n=e.style.contentVisibility||``,r=getComputedStyle(e),i=r.contentVisibility||r.getPropertyValue(`content-visibility`)||``;(i===`auto`||i===`hidden`)&&(t.push({el:e,original:n}),e.style.contentVisibility=`visible`)}if(e instanceof HTMLElement){let n=getComputedStyle(e),r=n.contentVisibility||n.getPropertyValue(`content-visibility`)||``;(r===`auto`||r===`hidden`)&&(t.push({el:e,original:e.style.contentVisibility||``}),e.style.contentVisibility=`visible`)}}catch{}return()=>{for(let{el:e,original:n}of t)try{e.style.contentVisibility=n}catch{}}}async function Jn(e,t={}){let n={styleMap:o.session.styleMap,styleCache:o.session.styleCache,nodeMap:o.session.nodeMap,options:t},r,i=``,a=``;Kn(e);let s=qn(e);try{Bn(e)}catch(e){console.warn(`inlineExternal defs or symbol failed:`,e)}try{r=await kt(e,n,t)}catch(e){throw console.warn(`deepClone failed:`,e),e}finally{s()}try{await zn(e,r,n,t)}catch(e){console.warn(`inlinePseudoElements failed:`,e)}await Ot(r,n);try{let e=r.querySelectorAll(`style[data-sd]`);for(let t of e)a+=t.textContent||``,t.remove()}catch(e){z(n,`Failed to extract shadow CSS from style[data-sd]`,e)}let c=j(n.styleMap);i=Array.from(c.entries()).map(([e,t])=>`.${t}{${e}}`).join(``),i=a+`[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}`+i;for(let[e,t]of n.styleMap.entries()){if(e.tagName===`STYLE`)continue;if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){e.setAttribute(`style`,t.replace(/;/g,`; `));continue}let n=c.get(t);n&&e.classList.add(n);let r=e.style?.backgroundImage,i=e.dataset?.snapdomHasIcon;r&&r!==`none`&&(e.style.backgroundImage=r),i&&(e.style.verticalAlign=`middle`,e.style.display=`inline`)}for(let[e,t]of n.nodeMap.entries()){let n=t.scrollLeft,r=t.scrollTop;if((n||r)&&e instanceof HTMLElement){e.style.overflow=`hidden`,e.style.scrollbarWidth=`none`,e.style.msOverflowStyle=`none`;try{let t=e.querySelectorAll(`*`);for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.style.position;if(t===`fixed`||t===`absolute`){let i=parseFloat(e.style.top)||0,a=parseFloat(e.style.left)||0;e.style.top=`${i+r}px`,e.style.left=`${a+n}px`,t===`fixed`&&(e.style.position=`absolute`)}}}catch{}let t=document.createElement(`div`);for(t.style.transform=`translate(${-n}px, ${-r}px)`,t.style.willChange=`transform`,t.style.display=`inline-block`,t.style.width=`100%`;e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}}if(Vn(e,r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r),e===n.nodeMap.get(r)){let t=n.styleCache.get(e)||M(e);n.styleCache.set(e,t);let i=l(t.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=i||``}for(let[e,t]of n.nodeMap.entries())t.tagName===`PRE`&&(e.style.marginTop=`0`,e.style.marginBlockStart=`0`);return{clone:r,classCSS:i,styleCache:n.styleCache}}w();var Yn=`http://www.w3.org/1999/xlink`;function Xn(e){return e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(Yn,`href`):null)}function Zn(e){let t=parseInt(e.dataset?.snapdomWidth||``,10)||0,n=parseInt(e.dataset?.snapdomHeight||``,10)||0,r=parseInt(e.getAttribute(`width`)||``,10)||0,i=parseInt(e.getAttribute(`height`)||``,10)||0,a=parseFloat(e.style?.width||``)||0,o=parseFloat(e.style?.height||``)||0;return{width:t||a||r||e.width||e.naturalWidth||100,height:n||o||i||e.height||e.naturalHeight||100}}async function Qn(e,t={}){let n=Array.from(e.querySelectorAll(`img`)),r=async e=>{if(!e.getAttribute(`src`)){let t=e.currentSrc||e.src||``;t&&e.setAttribute(`src`,t)}e.removeAttribute(`srcset`),e.removeAttribute(`sizes`);let n=e.src||``;if(!n)return;let r=await b(n,{as:`dataURL`,useProxy:t.useProxy});if(r.ok&&typeof r.data==`string`&&r.data.startsWith(`data:`)){e.src=r.data,e.width||=e.naturalWidth||100,e.height||=e.naturalHeight||100;return}let{width:i,height:a}=Zn(e),{fallbackURL:o}=t||{};if(o)try{let r=typeof o==`function`?await o({width:i,height:a,src:n,element:e}):o;if(r){let n=await b(r,{as:`dataURL`,useProxy:t.useProxy});if(n?.ok&&typeof n.data==`string`){e.src=n.data,e.width||=i,e.height||=a;return}}}catch{}if(t.placeholders!==!1){let t=document.createElement(`div`);t.style.cssText=[`width:${i}px`,`height:${a}px`,`background:#ccc`,`display:inline-block`,`text-align:center`,`line-height:${a}px`,`color:#666`,`font-size:12px`,`overflow:hidden`].join(`;`),t.textContent=`img`,e.replaceWith(t)}else{let t=document.createElement(`div`);t.style.cssText=`display:inline-block;width:${i}px;height:${a}px;visibility:hidden;`,e.replaceWith(t)}};for(let e=0;e<n.length;e+=6){let t=n.slice(e,e+6).map(r);await Promise.allSettled(t)}let i=Array.from(e.querySelectorAll(`image`)),a=async e=>{let n=Xn(e);if(!n||n.startsWith(`data:`)||n.startsWith(`blob:`))return;let r=await b(n,{as:`dataURL`,useProxy:t.useProxy});r.ok&&typeof r.data==`string`&&r.data.startsWith(`data:`)&&(e.setAttribute(`href`,r.data),e.removeAttribute(`xlink:href`),typeof e.removeAttributeNS==`function`&&e.removeAttributeNS(Yn,`href`))};for(let e=0;e<i.length;e+=6){let t=i.slice(e,e+6).map(a);await Promise.allSettled(t)}}B();async function $n(e,t,n,r={}){let i=[[e,t]],a=[`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`],o=[`mask-position`,`mask-size`,`mask-repeat`,`mask-mode`,`mask-composite`,`-webkit-mask-position`,`-webkit-mask-size`,`-webkit-mask-repeat`,`-webkit-mask-composite`,`mask-origin`,`mask-clip`,`-webkit-mask-origin`,`-webkit-mask-clip`,`-webkit-mask-position-x`,`-webkit-mask-position-y`],s=[`background-position`,`background-position-x`,`background-position-y`,`background-size`,`background-repeat`,`background-origin`,`background-clip`,`background-attachment`,`background-blend-mode`],c=[`border-image-slice`,`border-image-width`,`border-image-outset`,`border-image-repeat`];for(;i.length;){let[e,t]=i.shift();if(!t)continue;let l=n.get(e)||M(e);n.has(e)||n.set(e,l);let u=(()=>{let e=l.getPropertyValue(`border-image`),t=l.getPropertyValue(`border-image-source`);return e&&e!==`none`||t&&t!==`none`})();for(let e of s){let n=l.getPropertyValue(e);n&&t.style.setProperty(e,n)}for(let e of a){let n=l.getPropertyValue(e);if(e===`background-image`&&(!n||n===`none`)){let e=l.getPropertyValue(`background`);e&&/url\s*\(/.test(e)&&(n=re(e).filter(e=>/url\s*\(/.test(e)).join(`, `)||n)}if(!n||n===`none`)continue;let i=re(n),a=await Promise.all(i.map(e=>T(e,r)));a.some(e=>e&&e!==`none`&&!/^url\(undefined/.test(e))&&t.style.setProperty(e,a.join(`, `))}for(let e of o){let n=l.getPropertyValue(e);!n||n===`initial`||t.style.setProperty(e,n)}if(u)for(let e of c){let n=l.getPropertyValue(e);!n||n===`initial`||t.style.setProperty(e,n)}let d=e.shadowRoot?Array.from(e.shadowRoot.children).filter(e=>e.tagName!==`STYLE`):Array.from(e.children),f=Array.from(t.children).filter(e=>!(e.dataset?.snapdomPseudo||e.tagName===`STYLE`&&e.dataset?.sd));for(let e=0;e<Math.min(d.length,f.length);e++)i.push([d[e],f[e]])}}B(),s();function er(e){if(!e)return()=>{};let t=[];function n(e){let r=tr(e);r&&t.push(r);for(let t of e.children||[])n(t)}return n(e),()=>t.forEach(e=>e())}function tr(e){if(!e)return()=>{};let t=nr(e);if(t<=0||!ar(e))return()=>{};let n=getComputedStyle(e),r=Math.round(rr(n)*t+ir(n)),i=e.textContent??``,a=i;if(e.scrollHeight<=r+.5)return()=>{};let o=0,s=i.length,c=-1;for(;o<=s;){let t=o+s>>1;e.textContent=i.slice(0,t)+`…`,e.scrollHeight<=r+.5?(c=t,o=t+1):s=t-1}return e.textContent=(c>=0?i.slice(0,c):``)+`…`,()=>{e.textContent=a}}function nr(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 rr(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 ir(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ar(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Y=[];function or(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 sr(...e){let t=e.flat();for(let e of t){let t=or(e);t&&(Y.some(e=>e&&e.name&&t.name&&e.name===t.name)||Y.push(t))}}function cr(e){return(e&&Array.isArray(e.plugins)?e.plugins:Y)||Y}async function X(e,t,n){let r=n,i=cr(t);for(let n of i){let i=n&&typeof n[e]==`function`?n[e]:null;if(!i)continue;let a=await i(t,r);typeof a<`u`&&(r=a)}return r}async function lr(e,t,n){let r=[],i=cr(t);for(let a of i){let i=a&&typeof a[e]==`function`?a[e]:null;if(!i)continue;let o=await i(t,n);typeof o<`u`&&r.push(o)}return r}function ur(e){let t=[];if(Array.isArray(e))for(let n of e){let e=or(n);if(!e||!e.name)continue;let r=t.findIndex(t=>t&&t.name===e.name);r>=0&&t.splice(r,1),t.push(e)}for(let e of Y)e&&e.name&&!t.some(t=>t.name===e.name)&&t.push(e);return Object.freeze(t)}function dr(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=ur(t)),e}function fr(){return Y.slice()}function Z(e){return!!(!e||e.startsWith(`data:`)||e.startsWith(`blob:`)||/^data:image\/(gif|png|svg)/.test(e)&&e.length<200)}function pr(e,t){return!e||!(e instanceof Element)?!1:e.querySelector(`picture`)?!0:t?!!e.querySelector(`img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]`):!1}function mr(e,t){let n=e.currentSrc||``;if(n&&!Z(n))return n;let r=t.querySelectorAll(`source[srcset]`),i=null;for(let e of r){let t=e.getAttribute(`srcset`);if(!t||Z(t))continue;let n=e.getAttribute(`media`);if(n)try{if(window.matchMedia(n).matches)return t.split(`,`)[0].trim().split(/\s+/)[0]}catch{}i||=t.split(`,`)[0].trim().split(/\s+/)[0]}return i}function hr(e){let t=[e.getAttribute(`data-src`),e.getAttribute(`data-lazy-src`),e.getAttribute(`data-original`),e.getAttribute(`data-hi-res-src`)];for(let e of t)if(e&&!Z(e))return e;let n=e.getAttribute(`data-srcset`)||e.getAttribute(`data-lazy-srcset`);if(n){let e=n.split(`,`)[0].trim().split(/\s+/)[0];if(e&&!Z(e))return e}return null}function gr(e={}){let t=e.pictureResolver&&typeof e.pictureResolver==`object`?e.pictureResolver:{};return{timeout:t.timeout??5e3,concurrency:t.concurrency??4,resolveLazySrc:t.resolveLazySrc!==!1,silent:t.silent??!1,useProxy:typeof e.useProxy==`string`?e.useProxy:``}}async function _r(e,t={}){if(!e||!(e instanceof Element)||t.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:r,resolveLazySrc:i,silent:a,useProxy:o}=gr(t);if(!pr(e,i))return null;let s=[],c=[];async function l(e){let t=new AbortController,r=setTimeout(()=>t.abort(),n);try{let n=await fetch(e,{credentials:`include`,signal:t.signal});if(!n.ok&&o){let r=o.includes(`{url}`)?o.replace(`{url}`,encodeURIComponent(e)):o.endsWith(`?`)?`${o}${encodeURIComponent(e)}`:`${o}${o.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`;n=await fetch(r,{signal:t.signal})}if(!n.ok)return null;let r=await n.blob();return await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)})}catch{return null}finally{clearTimeout(r)}}async function u(e){for(let t=0;t<e.length;t+=r){let n=e.slice(t,t+r);await Promise.allSettled(n.map(e=>e()))}}let d=e.querySelectorAll(`picture`);for(let e of d){let t=e.querySelector(`img`);if(!t||!Z(t.getAttribute(`src`)||``))continue;let n=mr(t,e);n&&c.push(async()=>{let r=await l(n);if(!r){a||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${n.slice(0,60)}`);return}let i=t.getAttribute(`src`),o=t.getAttribute(`srcset`),c=t.getAttribute(`sizes`),u=[];t.src=r,t.setAttribute(`src`,r),t.removeAttribute(`srcset`),t.removeAttribute(`sizes`);let d=e.querySelectorAll(`source`);for(let e of d)u.push({el:e,parent:e.parentElement,next:e.nextSibling}),e.remove();s.push(()=>{i===null?t.removeAttribute(`src`):t.setAttribute(`src`,i),o!==null&&t.setAttribute(`srcset`,o),c!==null&&t.setAttribute(`sizes`,c);for(let{el:e,parent:t,next:n}of u)t&&t.insertBefore(e,n)})})}if(i){let t=e.querySelectorAll(`img`);for(let e of t){if(e.closest(`picture`)&&Z(e.getAttribute(`src`)||``))continue;let t=e.getAttribute(`src`)||``,n=hr(e);n&&Z(t)&&c.push(async()=>{let t=await l(n);if(!t)return;let r=e.getAttribute(`src`);e.src=t,e.setAttribute(`src`,t),e.removeAttribute(`srcset`),e.removeAttribute(`sizes`),s.push(()=>{r===null?e.removeAttribute(`src`):e.setAttribute(`src`,r)})})}}return c.length===0?null:(await u(c),async function(){for(let e of s)try{e()}catch{}})}B();function vr(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow=`none`}catch(e){z(n,`stripRootShadows boxShadow`,e)}try{t.style.textShadow=`none`}catch(e){z(n,`stripRootShadows textShadow`,e)}try{t.style.outline=`none`}catch(e){z(n,`stripRootShadows outline`,e)}let i=(r.filter||``).replace(/\bblur\([^()]*\)\s*/gi,``).replace(/\bdrop-shadow\([^()]*\)\s*/gi,``).trim().replace(/\s+/g,` `);try{t.style.filter=i.length?i:`none`}catch(e){z(n,`stripRootShadows filter`,e)}}function yr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let e of n)e.remove()}function br(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set([`xml`,`xlink`]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let e=i.currentNode;for(let t of Array.from(e.attributes)){let i=t.name;if(i.includes(`@`)){e.removeAttribute(i);continue}if(i.includes(`:`)){let t=i.split(`:`,1)[0];if(!r.has(t)){e.removeAttribute(i);continue}}if(n&&(i.startsWith(`x-`)||i.startsWith(`v-`)||i.startsWith(`:`)||i.startsWith(`on:`)||i.startsWith(`bind:`)||i.startsWith(`let:`)||i.startsWith(`class:`))){e.removeAttribute(i);continue}}}}function xr(e,t={}){e&&(br(e,t),yr(e))}function Sr(e){try{let t=e.getAttribute?.(`style`)||``;return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function Cr(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function wr(e,t){if(!(e instanceof Element)||Sr(e)||Cr(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 Tr(e,t,n=new Map){function r(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.childElementCount>t.childElementCount,a=n.get(e)||getComputedStyle(e);if(n.has(e)||n.set(e,a),i&&wr(e,a)){t.style.height||(t.style.height=`auto`),t.style.width||(t.style.width=`auto`),t.style.removeProperty(`block-size`),t.style.removeProperty(`inline-size`),t.style.minHeight||(t.style.minHeight=`0`),t.style.minWidth||(t.style.minWidth=`0`),t.style.maxHeight||(t.style.maxHeight=`none`),t.style.maxWidth||(t.style.maxWidth=`none`);let e=a.overflowY||a.overflowBlock||`visible`,n=a.overflowX||a.overflowInline||`visible`;(e!==`visible`||n!==`visible`)&&(t.style.overflow=`visible`)}let o=Array.from(e.children),s=Array.from(t.children);for(let e=0;e<Math.min(o.length,s.length);e++)r(o[e],s[e])}r(e,t)}function Er(e){let t=getComputedStyle(e);return!(t.display===`none`||t.position===`absolute`||t.position===`fixed`)}function Dr(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(e){z(t,`exclude selector match failed`,e)}return!1}function Or(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,a=-1/0,o=!1,s=Array.from(e.children);for(let e of s){if(Dr(e,t)||!Er(e))continue;let n=e.getBoundingClientRect(),s=n.top-r.top,c=n.bottom-r.top;c<=s||(s<i&&(i=s),c>a&&(a=c),o=!0)}let c=o?Math.max(0,a-i):0,l=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return l+u+d+f+c}var Q=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,kr=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Ar(e,t=new Set){let n=``;if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Ar(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let e=Ar(i.cssRules,t);e&&(n+=`@media ${i.conditionText}{${e}}`);continue}if(i.type===CSSRule.STYLE_RULE){let e=i.selectorText||``;if(kr.test(e)){let e=i.cssText;e&&!t.has(e)&&(t.add(e),n+=e)}}}catch{}}return n}function jr(e){if(!e||!e.styleSheets)return``;let t=new Set,n=``;for(let r of Array.from(e.styleSheets))try{let e=r.cssRules;e&&(n+=Ar(e,t))}catch{}return n}function Mr(e){let t=e.boxShadow||``;if(!t||t===`none`)return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(e=>e.trim()),r=0,i=0,a=0,o=0;for(let e of n){let t=e.match(/-?\d+(\.\d+)?px/g)?.map(e=>parseFloat(e))||[];if(t.length<2)continue;let[n,s,c=0,l=0]=t,u=Math.abs(n)+c+l,d=Math.abs(s)+c+l;i=Math.max(i,u+Math.max(n,0)),o=Math.max(o,u+Math.max(-n,0)),a=Math.max(a,d+Math.max(s,0)),r=Math.max(r,d+Math.max(-s,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(a),left:Math.ceil(o)}}function Nr(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 Pr(e){if((e.outlineStyle||`none`)===`none`)return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||`0`)||0),n=parseFloat(e.outlineOffset||`0`)||0,r=t+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function Fr(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,i=0,a=0,o=0,s=!1;for(let e of n){s=!0;let[t=0,n=0,c=0]=e.match(/-?\d+(?:\.\d+)?px/gi)?.map(e=>parseFloat(e))||[],l=Math.abs(t)+c,u=Math.abs(n)+c;i=Math.max(i,l+Math.max(t,0)),o=Math.max(o,l+Math.max(-t,0)),a=Math.max(a,u+Math.max(n,0)),r=Math.max(r,u+Math.max(-n,0))}return{bleed:{top:Q(r),right:Q(i),bottom:Q(a),left:Q(o)},has:s}}function Ir(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||r===`none`)try{let n=Wr(e);if(n.a===1&&n.b===0&&n.c===0&&n.d===1)return t.style.transform=`none`,{a:1,b:0,c:0,d:1}}catch{}function i(e,t,n,r){let i=Math.sqrt(e*e+t*t)||0,a=0,o=0;if(i>0){let s=e/i,c=t/i;a=s*n+c*r;let l=n-s*a,u=r-c*a;o=Math.sqrt(l*l+u*u)||0,o>0?a/=o:a=0}return{a:i,b:0,c:a*o,d:o}}let a=r.match(/^matrix\(\s*([^)]+)\)$/i);if(a){let e=a[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length===6&&e.every(Number.isFinite)){let[n,r,a,o]=e,s=i(n,r,a,o);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}}let o=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(o){let e=o[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length===16&&e.every(Number.isFinite)){let n=e[0],r=e[1],a=e[4],o=e[5],s=i(n,r,a,o);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}}try{let e=new DOMMatrix(r),n=i(e.a,e.b,e.c,e.d);try{t.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, 0, 0)`}catch{}return n}catch{return null}}function Lr(e,t,n,r,i){let a=n.a,o=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(e,t){let n=e-r,d=t-i,f=a*n+s*d,p=o*n+c*d;return f+=r+l,p+=i+u,[f,p]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],p=1/0,m=1/0,h=-1/0,g=-1/0;for(let[e,t]of f)e<p&&(p=e),t<m&&(m=t),e>h&&(h=e),t>g&&(g=t);return{minX:p,minY:m,maxX:h,maxY:g,width:h-p,height:g-m}}function Rr(e,t,n){let r=(e.transformOrigin||`0 0`).trim().split(/\s+/),[i,a]=[r[0]||`0`,r[1]||`0`],o=(e,t)=>{let n=e.toLowerCase();return n===`left`||n===`top`?0:n===`center`?t/2:n===`right`||n===`bottom`?t:n.endsWith(`px`)?parseFloat(n)||0:n.endsWith(`%`)?(parseFloat(n)||0)*t/100:/^-?\d+(\.\d+)?$/.test(n)&&parseFloat(n)||0};return{ox:o(i,t),oy:o(a,n)}}function zr(e){let t={rotate:`0deg`,scale:null,translate:null},n=typeof e.computedStyleMap==`function`?e.computedStyleMap():null;if(n){let r=e=>{try{return typeof n.has==`function`&&!n.has(e)||typeof n.get!=`function`?null:n.get(e)}catch{return null}},i=r(`rotate`);if(i)if(i.angle){let e=i.angle;t.rotate=e.unit===`rad`?e.value*180/Math.PI+`deg`:e.value+e.unit}else i.unit?t.rotate=i.unit===`rad`?i.value*180/Math.PI+`deg`:i.value+i.unit:t.rotate=String(i);else{let n=getComputedStyle(e);t.rotate=n.rotate&&n.rotate!==`none`?n.rotate:`0deg`}let a=r(`scale`);if(a){let e=`x`in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1;t.scale=`${e} ${`y`in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:e}`}else{let n=getComputedStyle(e);t.scale=n.scale&&n.scale!==`none`?n.scale:null}let o=r(`translate`);if(o){let e=`x`in o&&`value`in o.x?o.x.value:Array.isArray(o)?o[0]?.value:0,n=`y`in o&&`value`in o.y?o.y.value:Array.isArray(o)?o[1]?.value:0;t.translate=`${e}${`x`in o&&o.x?.unit?o.x.unit:`px`} ${n}${`y`in o&&o.y?.unit?o.y.unit:`px`}`}else{let n=getComputedStyle(e);t.translate=n.translate&&n.translate!==`none`?n.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 Br=null;function Vr(){if(Br)return Br;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),Br=e,e}function Hr(e){let t=Vr(),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=Wr(n);return t.removeChild(n),r}function Ur(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`,i=t.scale&&t.scale!==`none`&&t.scale!==`1`,a=t.translate&&t.translate!==`none`&&t.translate!==`0px 0px`;return!!(r||i||a)}function Wr(e){let t=getComputedStyle(e).transform;if(!t||t===`none`)return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}function Gr(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(or(t)?.name===`picture-resolver`)return!0}return fr().some(e=>e?.name===`picture-resolver`)}async function Kr(e,t){if(!e)throw Error(`Element cannot be null or undefined`);i(t.cache);let n=t.fast,r=t.outerTransforms!==!1,a=!!t.outerShadows,s={element:e,options:t,plugins:t.plugins},c,l,u,d=``,f=``,p,m,h=null;await X(`beforeSnap`,s);let g=null;t.resolvePicturePlaceholders!==!1&&!Gr(t)&&(g=await _r(s.element,s.options)),await X(`beforeClone`,s);let _=er(s.element);try{({clone:c,classCSS:l,styleCache:u}=await Jn(s.element,s.options)),!r&&c&&(h=Ir(s.element,c)),!a&&c&&vr(s.element,c,s.options)}finally{_()}if(s={clone:c,classCSS:l,styleCache:u,...s},await X(`afterClone`,s),g&&await g(),xr(s.clone),s.options?.excludeMode===`remove`)try{Tr(s.element,s.clone,s.styleCache)}catch(e){console.warn(`[snapdom] shrink pass failed:`,e)}try{await Vt(s.clone,s.element)}catch{}await new Promise(e=>{I(async()=>{await Qn(s.clone,s.options),e()},{fast:n})}),await new Promise(e=>{I(async()=>{await $n(s.element,s.clone,s.styleCache,s.options),e()},{fast:n})}),t.embedFonts&&await new Promise(e=>{I(async()=>{let t=yn(s.element),n=bn(s.element);L()&&await xn(new Set(Array.from(t).map(e=>String(e).split(`__`)[0]).filter(Boolean)),1),d=await vn({required:t,usedCodepoints:n,preCached:!1,exclude:s.options.excludeFonts,useProxy:s.options.useProxy,fontStylesheetDomains:s.options.fontStylesheetDomains}),e()},{fast:n})});let v=A(s.clone).sort(),y=v.join(`,`);o.baseStyle.has(y)?f=o.baseStyle.get(y):await new Promise(e=>{I(()=>{f=ee(v),o.baseStyle.set(y,f),e()},{fast:n})});let b=jr(s.element?.ownerDocument||document);s={fontsCSS:d,baseCSS:f,scrollbarCSS:b,...s},await X(`beforeRender`,s),await new Promise(e=>{I(()=>{let n=M(s.element),i=s.element.getBoundingClientRect(),c=Math.max(1,Q(s.element.offsetWidth||parseFloat(n.width)||i.width||1)),l=Math.max(1,Q(s.element.offsetHeight||parseFloat(n.height)||i.height||1)),u=s.element.ownerDocument||document;if(s.element===u.body||s.element===u.documentElement){let e=Math.max(s.element.scrollHeight||0,u.documentElement?.scrollHeight||0,u.body?.scrollHeight||0),t=Math.max(s.element.scrollWidth||0,u.documentElement?.scrollWidth||0,u.body?.scrollWidth||0);e>0&&(l=Math.max(l,Q(e))),t>0&&(c=Math.max(c,Q(t)));try{let e=(s.scrollbarCSS||``).length+(s.baseCSS||``).length+(s.fontsCSS||``).length+(s.classCSS||``).length,t=o.measureHints.get(s.element);if(t&&t.cssLen===e&&t.w0===c)t.csh>0&&(l=Math.max(l,Q(t.csh))),t.csw>0&&(c=Math.max(c,Q(t.csw)));else{let t=u.createElement(`div`);t.style.cssText=`position:absolute!important;left:-9999px!important;top:0!important;width:`+c+`px!important;overflow:visible!important;visibility:hidden!important;`;let n=u.createElement(`style`);n.textContent=(s.scrollbarCSS||``)+s.baseCSS+s.fontsCSS+`svg{overflow:visible;} foreignObject{overflow:visible;}`+s.classCSS,t.appendChild(n),t.appendChild(s.clone.cloneNode(!0)),u.body.appendChild(t);let r=t.scrollHeight,i=t.scrollWidth;u.body.removeChild(t),o.measureHints.set(s.element,{cssLen:e,w0:c,csh:r,csw:i}),r>0&&(l=Math.max(l,Q(r))),i>0&&(c=Math.max(c,Q(i)))}}catch{}}if(s.options?.excludeMode===`remove`){let e=Or(s.element,s.options);Number.isFinite(e)&&e>0&&(l=Math.max(1,Math.min(l,Q(e+1))))}let d=(e,t=NaN)=>{let n=typeof e==`string`?parseFloat(e):e;return Number.isFinite(n)?n:t},f=d(s.options.width),g=d(s.options.height),_=c,v=l,y=Number.isFinite(f),b=Number.isFinite(g),x=l>0?c/l:1;y&&b?(_=Math.max(1,Q(f)),v=Math.max(1,Q(g))):y?(_=Math.max(1,Q(f)),v=Math.max(1,Q(_/(x||1)))):b?(v=Math.max(1,Q(g)),_=Math.max(1,Q(v*(x||1)))):(_=c,v=l);let S=0,C=0,w=c,T=l;if(!r&&h&&Number.isFinite(h.a)){let e={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},t=Lr(c,l,e,0,0);S=Q(t.minX),C=Q(t.minY),w=Q(t.maxX),T=Q(t.maxY)}else if(r&&qr(s.element)){let e=n.transform&&n.transform!==`none`?n.transform:``,t=zr(s.element),r=Hr({baseTransform:e,rotate:t.rotate||`0deg`,scale:t.scale,translate:t.translate}),{ox:i,oy:a}=Rr(n,c,l),o=r.is2D?r:new DOMMatrix(r.toString()),u=Lr(c,l,o,i,a);S=Q(u.minX),C=Q(u.minY),w=Q(u.maxX),T=Q(u.maxY)}let E=Mr(n),D=Nr(n),O=Pr(n),k=Fr(n),A=a?{top:Q(E.top+D.top+O.top+k.bleed.top),right:Q(E.right+D.right+O.right+k.bleed.right),bottom:Q(E.bottom+D.bottom+O.bottom+k.bleed.bottom),left:Q(E.left+D.left+O.left+k.bleed.left)}:{top:0,right:0,bottom:0,left:0};S=Q(S-A.left),C=Q(C-A.top),w=Q(w+A.right),T=Q(T+A.bottom);let ee=Math.max(1,Q(w-S)),j=Math.max(1,Q(T-C)),te=y||b?Q(_/c):1,ne=b||y?Q(v/l):1,re=Math.max(1,Q(ee*te)),ie=Math.max(1,Q(j*ne)),N=`http://www.w3.org/2000/svg`,P=Q((L()&&qr(s.element)?1:0)+(r?0:1)),F=document.createElementNS(N,`foreignObject`),ae=Q(S),oe=Q(C);F.setAttribute(`x`,String(Q(-(ae-P)))),F.setAttribute(`y`,String(Q(-(oe-P)))),F.setAttribute(`width`,String(Q(c+P*2))),F.setAttribute(`height`,String(Q(l+P*2))),F.style.overflow=`visible`;let se=document.createElement(`style`);se.textContent=(s.scrollbarCSS||``)+s.baseCSS+s.fontsCSS+`svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}`+s.classCSS,F.appendChild(se);let I=document.createElement(`div`);I.setAttribute(`xmlns`,`http://www.w3.org/1999/xhtml`),I.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${Q(c)}px;height:${Q(l)}px`,I.appendChild(s.clone),F.appendChild(I);let ce=new XMLSerializer().serializeToString(F),le=Q(ee+P*2),R=Q(j+P*2),z=y||b;t.meta={w0:c,h0:l,vbW:le,vbH:R,targetW:_,targetH:v},m=`<svg xmlns="${N}" width="${L()&&z?le:Q(re+P*2)}" height="${L()&&z?R:Q(ie+P*2)}" viewBox="0 0 ${le} ${R}" font-size="${parseFloat(M(u.documentElement)?.fontSize)||16}px">`+ce+`</svg>`,p=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,s={svgString:m,dataURL:p,...s},e()},{fast:n})}),await X(`afterRender`,s);let x=document.getElementById(`snapdom-sandbox`);return x&&x.style.position===`absolute`&&x.remove(),s.dataURL}function qr(e){return Ur(e)}s();function Jr(e={}){let t=e.format??`png`;t===`jpg`&&(t=`jpeg`);let n=r(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,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],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,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null,resolvePicturePlaceholders:e.resolvePicturePlaceholders!==!1,pictureResolver:e.pictureResolver&&typeof e.pictureResolver==`object`?e.pictureResolver:{}}}R(),ue(),B(),w(),s();function Yr(...e){return sr(...e),$}var $=Object.assign($r,{plugins:Yr}),Xr=Symbol(`snapdom.internal`),Zr=Symbol(`snapdom.internal.silent`),Qr=!1;async function $r(e,t){if(!e)throw Error(`Element cannot be null or undefined`);let n=Jr(t);if(dr(n,t&&t.plugins),L()&&(n.embedFonts===!0||ti(e))){if(n.embedFonts)try{let t=yn(e);await xn(new Set([...t].map(e=>String(e).split(`__`)[0]).filter(Boolean)),1)}catch{}let r=n.safariWarmupAttempts??3;for(let n=0;n<r;n++)try{await ei(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&Nt(n.iconFonts),n.snap||={toPng:(e,t)=>$.toPng(e,t),toSvg:(e,t)=>$.toSvg(e,t)},$.capture(e,n,Xr)}$.capture=async(e,t,n)=>{if(n!==Xr)throw Error(`[snapdom.capture] is internal. Use snapdom(...) instead.`);let r=await Kr(e,t),i={img:async(e,t)=>{let{toImg:n}=await Promise.resolve().then(()=>(Oe(),Ee));return n(r,{...e,...t||{}})},svg:async(e,t)=>{let{toSvg:n}=await Promise.resolve().then(()=>(Oe(),Ee));return n(r,{...e,...t||{}})},canvas:async(e,t)=>{let{toCanvas:n}=await Promise.resolve().then(()=>(Se(),de));return n(r,{...e,...t||{}})},blob:async(e,t)=>{let{toBlob:n}=await Promise.resolve().then(()=>(je(),ke));return n(r,{...e,...t||{}})},png:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Te(),Ce));return n(r,{...e,...t||{},format:`png`})},jpeg:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Te(),Ce));return n(r,{...e,...t||{},format:`jpeg`})},webp:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Te(),Ce));return n(r,{...e,...t||{},format:`webp`})},download:async(e,t)=>{let{download:n}=await Promise.resolve().then(()=>(Fe(),Me));return n(r,{...e,...t||{}})}},a={};for(let e of[`img`,`svg`,`canvas`,`blob`,`png`,`jpeg`,`webp`])a[e]=async n=>i[e](t,{...n||{},[Zr]:!0});a.jpg=a.jpeg;let o=await lr(`defineExports`,{...t,export:{url:r},exports:a}),s=Object.assign({},...o.filter(e=>e&&typeof e==`object`).reverse()),c={...i,...s};c.jpeg&&!c.jpg&&(c.jpg=(e,t)=>c.jpeg(e,t));function l(e,n){let r={...t,...n||{}};return(e===`jpeg`||e===`jpg`)&&(r.backgroundColor==null||r.backgroundColor===`transparent`)&&(r.backgroundColor=`#ffffff`),r}let u=!1,d=Promise.resolve();async function f(e,n){return d=d.then(async()=>{let i=c[e];if(!i)throw Error(`[snapdom] Unknown export type: ${e}`);let a=l(e,n),o={...t,export:{type:e,options:a,url:r}};await X(`beforeExport`,o);let s=await i(o,a);return await X(`afterExport`,o,s),u||(u=!0,await X(`afterSnap`,t)),s})}let p={url:r,toRaw:()=>r,to:(e,t)=>f(e,t),toImg:e=>f(`img`,e),toSvg:e=>f(`svg`,e),toCanvas:e=>f(`canvas`,e),toBlob:e=>f(`blob`,e),toPng:e=>f(`png`,e),toJpg:e=>f(`jpg`,e),toWebp:e=>f(`webp`,e),download:e=>f(`download`,e)};for(let e of Object.keys(c)){let t=`to`+e.charAt(0).toUpperCase()+e.slice(1);p[t]||(p[t]=t=>f(e,t))}return p},$.toRaw=(e,t)=>$(e,t).then(e=>e.toRaw()),$.toImg=(e,t)=>$(e,t).then(e=>e.toImg()),$.toSvg=(e,t)=>$(e,t).then(e=>e.toSvg()),$.toCanvas=(e,t)=>$(e,t).then(e=>e.toCanvas()),$.toBlob=(e,t)=>$(e,t).then(e=>e.toBlob()),$.toPng=(e,t)=>$(e,{...t,format:`png`}).then(e=>e.toPng()),$.toJpg=(e,t)=>$(e,{...t,format:`jpeg`}).then(e=>e.toJpg()),$.toWebp=(e,t)=>$(e,{...t,format:`webp`}).then(e=>e.toWebp()),$.download=(e,t)=>$(e,t).then(e=>e.download());async function ei(e,t){if(Qr)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Kr(e,n)}catch(e){z(t,`safariWarmup pre-capture failed`,e)}await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),r&&await new Promise(e=>{let n=new Image;try{n.decoding=`sync`,n.loading=`eager`}catch(e){z(t,`safariWarmup img hints failed`,e)}n.style.cssText=`position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;`,n.src=r,document.body.appendChild(n),(async()=>{try{typeof n.decode==`function`&&await n.decode()}catch(e){z(t,`safariWarmup img.decode failed`,e)}let r=performance.now();for(;!(n.complete&&n.naturalWidth>0)&&performance.now()-r<900;)await new Promise(e=>setTimeout(e,200));await new Promise(e=>requestAnimationFrame(e));try{let e=document.createElement(`canvas`);e.width=Math.max(1,n.naturalWidth||10),e.height=Math.max(1,n.naturalHeight||10);let t=e.getContext(`2d`);t&&t.drawImage(n,0,0)}catch{}await new Promise(e=>requestAnimationFrame(e));try{n.remove()}catch(e){z(t,`safariWarmup img.remove failed`,e)}e()})()}),e.querySelectorAll(`canvas`).forEach(e=>{try{let t=e.getContext(`2d`,{willReadFrequently:!0});t&&t.getImageData(0,0,1,1)}catch(e){z(t,`safariWarmup canvas poke failed`,e)}}),Qr=!0}function ti(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let e=t.currentNode,n=getComputedStyle(e),r=n.backgroundImage&&n.backgroundImage!==`none`,i=n.maskImage&&n.maskImage!==`none`||n.webkitMaskImage&&n.webkitMaskImage!==`none`;if(r||i||e.tagName===`CANVAS`)return!0}return!1}export{$ as snapdom};
8
+ `):s+=l[0]}return s+=e.slice(c),s}let o=nn(e,t||location.href);return o=await a(o,t||location.href,0),o}var sn=/url\((["']?)([^"')]+)\1\)/g,cn=/@font-face[^{}]*\{[^}]*\}/g;function ln(e){if(!e)return[];let t=[],n=e.split(`,`).map(e=>e.trim()).filter(Boolean);for(let e of n){let n=e.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!n)continue;let r=n[1],i=n[2],a=e=>e.includes(`?`)?[parseInt(e.replace(/\?/g,`0`),16),parseInt(e.replace(/\?/g,`F`),16)]:parseInt(e,16);if(i){let e=a(r),n=a(i),o=Array.isArray(e)?e[0]:e,s=Array.isArray(n)?n[1]:n;t.push([Math.min(o,s),Math.max(o,s)])}else{let e=a(r);Array.isArray(e)?t.push([e[0],e[1]]):t.push([e,e])}}return t}function un(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[e,r]of t)if(n>=e&&n<=r)return!0;return!1}function dn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(sn)){let e=(r[2]||``).trim();if(!(!e||e.startsWith(`data:`))){if(!/^https?:/i.test(e))try{e=new URL(e,t||location.href).href}catch{}n.push(e)}}return n}async function fn(e,t,n=``){let r=e;for(let i of e.matchAll(sn)){let e=c(i[0]);if(!e)continue;let a=e;if(!a.startsWith(`http`)&&!a.startsWith(`data:`))try{a=new URL(a,t||location.href).href}catch{}if(!K(a)){if(o.resource?.has(a)){o.font?.add(a),r=r.replace(i[0],`url(${o.resource.get(a)})`);continue}if(!o.font?.has(a))try{let e=await b(a,{as:`dataURL`,useProxy:n,silent:!0});if(e.ok&&typeof e.data==`string`){let t=e.data;o.resource?.set(a,t),o.font?.add(a),r=r.replace(i[0],`url(${t})`)}}catch{console.warn(`[snapDOM] Failed to fetch font resource:`,a)}}}return r}function pn(e){if(!e.length)return null;let t=(t,n)=>e.some(([e,r])=>!(r<t||e>n)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),a=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?`vietnamese`:a?`cyrillic`:i?`greek`:r?`latin-ext`:n?`latin`:null}function mn(e={}){let t=new Set((e.families||[]).map(e=>String(e).toLowerCase())),n=new Set((e.domains||[]).map(e=>String(e).toLowerCase())),r=new Set((e.subsets||[]).map(e=>String(e).toLowerCase()));return(e,i)=>{if(t.size&&t.has(e.family.toLowerCase()))return!0;if(n.size)for(let t of e.srcUrls)try{if(n.has(new URL(t).host.toLowerCase()))return!0}catch{}if(r.size){let e=pn(i);if(e&&r.has(e))return!0}return!1}}function hn(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let i of e.match(t)||[]){let e=Gt(i.match(/font-family:\s*([^;]+);/i)?.[1]||``),t=(i.match(/font-weight:\s*([^;]+);/i)?.[1]||`400`).trim(),a=(i.match(/font-style:\s*([^;]+);/i)?.[1]||`normal`).trim(),o=(i.match(/font-stretch:\s*([^;]+);/i)?.[1]||`100%`).trim(),s=(i.match(/unicode-range:\s*([^;]+);/i)?.[1]||``).trim(),c=(i.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||``).trim(),l=dn(c,location.href),u=l.length?l.map(e=>String(e).toLowerCase()).sort().join(`|`):c.toLowerCase(),d=[String(e||``).toLowerCase(),t,a,o,s.toLowerCase(),u].join(`|`);n.has(d)||(n.add(d),r.push(i))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||``)}function gn(e,t,n,r,i){return`fonts-embed-css::req=${Array.from(e||[]).sort().join(`|`)}::ex=${t?JSON.stringify({families:(t.families||[]).map(e=>String(e).toLowerCase()).sort(),domains:(t.domains||[]).map(e=>String(e).toLowerCase()).sort(),subsets:(t.subsets||[]).map(e=>String(e).toLowerCase()).sort()}):``}::lf=${(n||[]).map(e=>`${(e.family||``).toLowerCase()}::${e.weight||`normal`}::${e.style||`normal`}::${e.src||``}`).sort().join(`|`)}::px=${r||``}::fd=${(i||[]).map(e=>String(e).toLowerCase()).sort().join(`|`)}`}async function _n(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let a=(e,t)=>{try{return new URL(e,t||location.href).href}catch{return e}};for(let e of i){if(e.type===CSSRule.IMPORT_RULE&&e.styleSheet){let i=e.href?a(e.href,t):t;if(r.depth>=an){console.warn(`[snapDOM] CSSOM import depth exceeded (${an}) at ${i}`);continue}if(i&&r.visitedSheets.has(i)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${i}`);continue}i&&r.visitedSheets.add(i);let o={...r,depth:(r.depth||0)+1};await _n(e.styleSheet,i,n,o);continue}if(e.type===CSSRule.FONT_FACE_RULE){let i=Gt((e.style.getPropertyValue(`font-family`)||``).trim());if(!i||K(i))continue;let a=(e.style.getPropertyValue(`font-weight`)||`400`).trim(),o=(e.style.getPropertyValue(`font-style`)||`normal`).trim(),s=(e.style.getPropertyValue(`font-stretch`)||`100%`).trim(),c=(e.style.getPropertyValue(`src`)||``).trim(),l=(e.style.getPropertyValue(`unicode-range`)||``).trim();if(!r.faceMatchesRequired(i,o,a,s))continue;let u=ln(l);if(!un(r.usedCodepoints,u))continue;let d={family:i,weightSpec:a,styleSpec:o,stretchSpec:s,unicodeRange:l,srcRaw:c,srcUrls:dn(c,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(d,u))continue;/url\(/i.test(c)?await n(`@font-face{font-family:${i};src:${await fn(c,t||location.href,r.useProxy)};font-style:${o};font-weight:${a};font-stretch:${s};${l?`unicode-range:${l};`:``}}`):await n(`@font-face{font-family:${i};src:${c};font-style:${o};font-weight:${a};font-stretch:${s};${l?`unicode-range:${l};`:``}}`)}}}async function vn({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i=``,fontStylesheetDomains:a=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let s=new Map;for(let t of e){let[e,n,r,i]=String(t).split(`__`);if(!e)continue;let a=s.get(e)||[];a.push({w:parseInt(n,10),s:r,st:parseInt(i,10)}),s.set(e,a)}function c(e,t,n,r){if(!s.has(e))return!1;let i=s.get(e),a=Xt(n),o=Zt(t),c=Qt(r),l=a.min!==a.max,u=a.min,d=e=>o.kind===`normal`&&e===`normal`||o.kind!==`normal`&&(e===`italic`||e===`oblique`),f=!1;for(let e of i){let t=l?e.w>=a.min&&e.w<=a.max:e.w===u,n=d(Jt(e.s)),r=e.st>=c.min&&e.st<=c.max;if(t&&n&&r){f=!0;break}}if(f)return!0;if(!l)for(let e of i){let t=d(Jt(e.s)),n=e.st>=c.min&&e.st<=c.max;if(Math.abs(u-e.w)<=300&&t&&n)return!0}if(!l&&o.kind===`normal`&&i.some(e=>Jt(e.s)!==`normal`))for(let e of i){let t=Math.abs(u-e.w)<=300,n=e.st>=c.min&&e.st<=c.max;if(t&&n)return!0}return!1}let l=mn(n),u=gn(e,n,r,i,a);if(o.resource?.has(u))return o.resource.get(u);let d=tn(e),f=[],p=rn;for(let e of document.querySelectorAll(`style`)){let t=e.textContent||``;for(let e of t.matchAll(p)){let t=(e[2]||e[4]||``).trim();!t||K(t)||document.querySelector(`link[rel="stylesheet"][href="${t}"]`)||f.push(t)}}f.length&&await Promise.all(f.map(e=>new Promise(t=>{if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return t(null);let n=document.createElement(`link`);n.rel=`stylesheet`,n.href=e,n.setAttribute(`data-snapdom`,`injected-import`),n.onload=()=>t(n),n.onerror=()=>t(null),document.head.appendChild(n)})));let m=``,h=Array.from(document.querySelectorAll(`link[rel="stylesheet"]`)).filter(e=>!!e.href);for(let e of h)try{if(K(e.href))continue;let r=``,o=!1;try{o=new URL(e.href,location.href).origin===location.origin}catch{}if(!o){let t=Array.isArray(a)?a:[];if(!en(e.href,d,t))continue}if(o){let t=Array.from(document.styleSheets).find(t=>t.href===e.href);if(t)try{let e=t.cssRules||[];r=Array.from(e).map(e=>e.cssText).join(``)}catch{}}if(!r){let t=await b(e.href,{as:`text`,useProxy:i});if(t?.ok&&typeof t.data==`string`&&(r=t.data),K(e.href))continue}r=await on(r,e.href,i);let s=``;for(let a of r.match(cn)||[]){let r=Gt((a.match(/font-family:\s*([^;]+);/i)?.[1]||``).trim());if(!r||K(r))continue;let o=(a.match(/font-weight:\s*([^;]+);/i)?.[1]||`400`).trim(),u=(a.match(/font-style:\s*([^;]+);/i)?.[1]||`normal`).trim(),d=(a.match(/font-stretch:\s*([^;]+);/i)?.[1]||`100%`).trim(),f=(a.match(/unicode-range:\s*([^;]+);/i)?.[1]||``).trim(),p=(a.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||``).trim(),m=dn(p,e.href);if(!c(r,u,o,d))continue;let h=ln(f);if(!un(t,h))continue;let g={family:r,weightSpec:o,styleSpec:u,stretchSpec:d,unicodeRange:f,srcRaw:p,srcUrls:m,href:e.href};if(n&&l(g,h))continue;let _=/url\(/i.test(p)?await fn(a,e.href,i):a;s+=_}s.trim()&&(m+=s)}catch{console.warn(`[snapDOM] Failed to process stylesheet:`,e.href)}let g={requiredIndex:s,usedCodepoints:t,faceMatchesRequired:c,simpleExcluder:n?mn(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let e of document.styleSheets)if(!(e.href&&h.some(t=>t.href===e.href)))try{let t=e.href||location.origin+`/`;t&&g.visitedSheets.add(t),await _n(e,t,async e=>{m+=e},g)}catch{}try{for(let e of document.fonts||[]){if(!e||!e.family||e.status!==`loaded`||!e._snapdomSrc)continue;let t=String(e.family).replace(/^['"]+|['"]+$/g,``);if(K(t)||!s.has(t)||n?.families&&n.families.some(e=>String(e).toLowerCase()===t.toLowerCase()))continue;let r=e._snapdomSrc;if(!String(r).startsWith(`data:`)){if(o.resource?.has(e._snapdomSrc))r=o.resource.get(e._snapdomSrc),o.font?.add(e._snapdomSrc);else if(!o.font?.has(e._snapdomSrc))try{let t=await b(e._snapdomSrc,{as:`dataURL`,useProxy:i,silent:!0});if(t.ok&&typeof t.data==`string`)r=t.data,o.resource?.set(e._snapdomSrc,r),o.font?.add(e._snapdomSrc);else continue}catch{console.warn(`[snapDOM] Failed to fetch dynamic font src:`,e._snapdomSrc);continue}}m+=`@font-face{font-family:'${t}';src:url(${r});font-style:${e.style||`normal`};font-weight:${e.weight||`normal`};}`}}catch{}for(let e of r){if(!e||typeof e!=`object`)continue;let t=String(e.family||``).replace(/^['"]+|['"]+$/g,``);if(!t||K(t)||!s.has(t)||n?.families&&n.families.some(e=>String(e).toLowerCase()===t.toLowerCase()))continue;let r=e.weight==null?`normal`:String(e.weight),a=e.style==null?`normal`:String(e.style),c=e.stretchPct==null?`100%`:`${e.stretchPct}%`,l=String(e.src||``),u=l;if(!u.startsWith(`data:`)){if(o.resource?.has(l))u=o.resource.get(l),o.font?.add(l);else if(!o.font?.has(l))try{let e=await b(l,{as:`dataURL`,useProxy:i,silent:!0});if(e.ok&&typeof e.data==`string`)u=e.data,o.resource?.set(l,u),o.font?.add(l);else continue}catch{console.warn(`[snapDOM] Failed to fetch localFonts src:`,l);continue}}m+=`@font-face{font-family:'${t}';src:url(${u});font-style:${a};font-weight:${r};font-stretch:${c};}`}return m&&(m=hn(m),o.resource?.set(u,m)),m}function yn(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=e=>{let n=Kt(e.fontFamily);if(n.length)for(let r of n)t.add(((e,t,n)=>`${r}__${qt(e)}__${Jt(t)}__${Yt(n)}`)(e.fontWeight,e.fontStyle,e.fontStretch))};r(getComputedStyle(e));let i=getComputedStyle(e,`::before`);i&&i.content&&i.content!==`none`&&r(i);let a=getComputedStyle(e,`::after`);for(a&&a.content&&a.content!==`none`&&r(a);n.nextNode();){let e=n.currentNode;r(getComputedStyle(e));let t=getComputedStyle(e,`::before`);t&&t.content&&t.content!==`none`&&r(t);let i=getComputedStyle(e,`::after`);i&&i.content&&i.content!==`none`&&r(i)}return t}function bn(e){let t=new Set,n=e=>{if(e)for(let n of e)t.add(n.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let e=r.currentNode;if(e.nodeType===Node.TEXT_NODE)n(e.nodeValue||``);else if(e.nodeType===Node.ELEMENT_NODE){let r=e;for(let e of[`::before`,`::after`]){let i=getComputedStyle(r,e)?.getPropertyValue(`content`);if(!(!i||i===`none`))if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{let e=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(e)for(let n of e)try{t.add(parseInt(n.slice(1),16))}catch{}}}}}return t}async function xn(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let e=document.createElement(`div`);e.style.cssText=`position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;`;for(let t of n){let n=document.createElement(`span`);n.textContent=`AaBbGg1234ÁÉÍÓÚçñ—∞`,n.style.fontFamily=`"${t}"`,n.style.fontWeight=`700`,n.style.fontStyle=`italic`,n.style.fontSize=`32px`,n.style.lineHeight=`1`,n.style.whiteSpace=`nowrap`,n.style.margin=`0`,n.style.padding=`0`,e.appendChild(n)}document.body.appendChild(e),e.offsetWidth,document.body.removeChild(e)};for(let e=0;e<Math.max(1,t);e++)r(),await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e)))}s();function Sn(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||``)}function Cn(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 wn(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)),i=``;for(let[e,t]of n)for(;r>=e;)i+=t,r-=e;return t?i:i.toLowerCase()}function Tn(e,t){switch((t||`decimal`).toLowerCase()){case`decimal`:return String(e);case`decimal-leading-zero`:{let t=Math.abs(e);return(e<0?`-`:``)+(t<10?`0`:``)+String(t)}case`lower-alpha`:return Cn(e,!1);case`upper-alpha`:return Cn(e,!0);case`lower-roman`:return wn(e,!1);case`upper-roman`:return wn(e,!0);default:return String(e)}}function En(e){let t=()=>o?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,a=e=>e&&e.tagName===`LI`,s=e=>{let t=0,n=e?.parentElement;if(!n)return 0;for(let r of n.children){if(r===e)break;r.tagName===`LI`&&t++}return t},c=e=>{let t=new Map;for(let[n,r]of e)t.set(n,r.slice());return t},l=(e,t,n)=>{let r=c(e),i;try{i=n.style?.counterReset||getComputedStyle(n).counterReset}catch{}if(i&&i!==`none`)for(let e of i.split(`,`)){let n=e.trim().split(/\s+/),i=n[0],a=Number.isFinite(Number(n[1]))?Number(n[1]):0;if(!i)continue;let o=t.get(i);if(o&&o.length){let e=o.slice();e.push(a),r.set(i,e)}else r.set(i,[a])}let o;try{o=n.style?.counterSet||getComputedStyle(n).counterSet}catch{}if(o&&o!==`none`)for(let e of o.split(`,`)){let t=e.trim().split(/\s+/),n=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):0;if(!n)continue;let a=r.get(n)||[];a.length===0&&a.push(0),a[a.length-1]=i,r.set(n,a)}let l;try{l=n.style?.counterIncrement||getComputedStyle(n).counterIncrement}catch{}if(l&&l!==`none`)for(let e of l.split(`,`)){let t=e.trim().split(/\s+/),n=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):1;if(!n)continue;let a=r.get(n)||[];a.length===0&&a.push(0),a[a.length-1]+=i,r.set(n,a)}try{if(getComputedStyle(n).display===`list-item`&&a(n)){let e=n.parentElement,t=1;if(e&&e.tagName===`OL`){let r=e.getAttribute(`start`),i=Number.isFinite(Number(r))?Number(r):1,a=s(n),o=n.getAttribute(`value`);t=Number.isFinite(Number(o))?Number(o):i+a}else t=1+s(n);let i=r.get(`list-item`)||[];i.length===0&&i.push(0),i[i.length-1]=t,r.set(`list-item`,i)}}catch{}return r},u=(e,t,n)=>{let i=l(n,t,e);r.set(e,i);let a=i;for(let t of e.children)a=u(t,i,a);let o=new Map;for(let[e,t]of n){let n=t.length,r=a.get(e);o.set(e,r&&r.length?r.slice(0,n):t.slice())}for(let[e,n]of a)!o.has(e)&&n.length&&!t.has(e)&&o.set(e,n.slice(0,1));return o},d=new Map;u(i,d,d);function f(){let e=t();if(e!==n){n=e;let t=new Map;u(i,t,t)}}return{get(e,t){f();let n=r.get(e)?.get(t);return n&&n.length?n[n.length-1]:0},getStack(e,t){f();let n=r.get(e)?.get(t);return n?n.slice():[]}}}function Dn(e,t,n){if(!e||e===`none`)return e;try{return e.replace(/\b(counter|counters)\s*\(([^)]+)\)/g,(e,r,i)=>{let a=String(i).split(`,`).map(e=>e.trim());if(r===`counter`){let e=a[0]?.replace(/^["']|["']$/g,``),r=(a[1]||`decimal`).toLowerCase();return Tn(n.get(t,e),r)}else{let e=a[0]?.replace(/^["']|["']$/g,``),r=a[1]?.replace(/^["']|["']$/g,``)??``,i=(a[2]||`decimal`).toLowerCase(),o=n.getStack(t,e);return o.length?o.map(e=>Tn(e,i)).join(r):``}})}catch{return`- `}}w(),s();var q=new WeakMap,On=1e3;function kn(e,t){let n=jn(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=Nn(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):Nn(e)}function An(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function jn(e){let t=e.querySelectorAll(`style,link[rel~="stylesheet"]`),n=`n:${t.length}|`,r=0;for(let e=0;e<t.length;e++){let i=t[e];if(i.tagName===`STYLE`){let e=i.textContent?i.textContent.length:0;n+=`S${e}|`;let t=i.sheet,a=t?An(t):null;a&&(r+=a.length)}else{let e=i.getAttribute(`href`)||``,t=i.getAttribute(`media`)||`all`;n+=`L${e}|m:${t}|`;let a=i.sheet,o=a?An(a):null;o&&(r+=o.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Mn(e,t,n){let r=An(e);if(!r)return!1;for(let e=0;e<r.length;e++){if(n.budget<=0)return!1;let i=r[e],a=i&&i.cssText?i.cssText:``;n.budget--;for(let e of t)if(a.includes(e))return!0;if(i&&i.cssRules&&i.cssRules.length)for(let e=0;e<i.cssRules.length&&n.budget>0;e++){let r=i.cssRules[e],a=r&&r.cssText?r.cssText:``;n.budget--;for(let e of t)if(a.includes(e))return!0}if(n.budget<=0)return!1}return!1}function Nn(e=document){let t=jn(e),n=q.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`],i=e.querySelectorAll(`style`);for(let n=0;n<i.length;n++){let a=i[n].textContent||``;for(let n of r)if(a.includes(n))return q.set(e,{fingerprint:t,result:!0}),!0}let a=e.adoptedStyleSheets;if(Array.isArray(a)&&a.length){let n={budget:On};try{for(let i of a)if(Mn(i,r,n))return q.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let n=e.querySelectorAll(`style,link[rel~="stylesheet"]`),i={budget:On};for(let a=0;a<n.length&&i.budget>0;a++){let o=n[a],s=null;if(o.tagName,s=o.sheet||null,s&&Mn(s,r,i))return q.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector(`[style*="counter("], [style*="counters("]`)?(q.set(e,{fingerprint:t,result:!0}),!0):(q.set(e,{fingerprint:t,result:!1}),!1)}var J=new WeakMap,Pn=-1;function Fn(e){if(!e)return``;let t=[],n=/"([^"]*)"/g,r=0,i;for(;i=n.exec(e);){let a=e.slice(r,i.index).trim();a&&t.push(a),t.push(i[1]),r=n.lastIndex}let a=e.slice(r).trim();return a&&t.push(a),t.join(``)}function In(e,t){let n=e.parentElement,r=n?J.get(n):null;return r?{get(e,n){let i=t.get(e,n),a=r.get(n);return typeof a==`number`?Math.max(i,a):i},getStack(e,n){let i=t.getStack(e,n);if(!i.length)return i;let a=r.get(n);if(typeof a==`number`){let e=i.slice();return e[e.length-1]=Math.max(e[e.length-1],a),e}return i}}:t}function Ln(e,t,n){let r=new Map;function i(e){let t=[];if(!e||e===`none`)return t;for(let n of String(e).split(`,`)){let e=n.trim().split(/\s+/),r=e[0],i=Number.isFinite(Number(e[1]))?Number(e[1]):void 0;r&&t.push({name:r,num:i})}return t}let a=i(t?.counterReset),o=i(t?.counterIncrement);function s(t){if(r.has(t))return r.get(t).slice();let i=n.getStack(e,t);i=i.length?i.slice():[];let s=a.find(e=>e.name===t);if(s){let e=Number.isFinite(s.num)?s.num:0;i=i.length?[...i,e]:[e]}let c=o.find(e=>e.name===t);if(c){let e=Number.isFinite(c.num)?c.num:1;i.length===0&&(i=[0]),i[i.length-1]+=e}return r.set(t,i.slice()),i}return{get(e,t){let n=s(t);return n.length?n[n.length-1]:0},getStack(e,t){return s(t)},__incs:o}}function Rn(e,t,n){let r;try{r=M(e,t)}catch{}let i=r?.content;if(!i||i===`none`||i===`normal`)return{text:``,incs:[]};let a=In(e,n),o=Ln(e,r,a);return{text:Fn(Sn(i)?Dn(i,e,o):i),incs:o.__incs||[]}}async function zn(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element)||!kn(e.ownerDocument||document,n))return;let i=o?.session?.__counterEpoch??0;if(Pn!==i&&(J=new WeakMap,n&&(n.__counterCtx=null),Pn=i),!n.__counterCtx)try{n.__counterCtx=En(e.ownerDocument||document)}catch(e){z(n,`buildCounterContext failed`,e)}let a=n.__counterCtx;for(let i of[`::before`,`::after`,`::first-letter`])try{let o=M(e,i);if(!o||o.content===`none`&&o.backgroundImage===`none`&&o.backgroundColor===`transparent`&&(o.borderStyle===`none`||parseFloat(o.borderWidth)===0)&&(!o.transform||o.transform===`none`)&&o.display===`inline`)continue;if(i===`::first-letter`){let r=M(e),i=(r?.display||``).toLowerCase();if(i.includes(`flex`)||i.includes(`grid`)||!(o.color!==r.color||o.fontSize!==r.fontSize||o.fontWeight!==r.fontWeight||o.fontFamily!==r.fontFamily||o.fontStyle!==r.fontStyle||o.textTransform!==r.textTransform||o.float!==r.float||o.paddingTop!==r.paddingTop||o.paddingRight!==r.paddingRight||o.paddingBottom!==r.paddingBottom||o.paddingLeft!==r.paddingLeft||o.marginTop!==r.marginTop||o.marginRight!==r.marginRight||o.marginBottom!==r.marginBottom||o.marginLeft!==r.marginLeft))continue;let a=Array.from(t.childNodes).find(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim().length>0);if(!a)continue;let s=a.textContent,c=s.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],l=s.slice(c?.length||0);if(!c||/[\uD800-\uDFFF]/.test(c))continue;let u=document.createElement(`span`);u.textContent=c,u.dataset.snapdomPseudo=`::first-letter`;let d=k(ne(o),`span`);n.styleMap.set(u,d);let f=document.createTextNode(l);t.replaceChild(f,a),t.insertBefore(u,f);continue}let s=o.content??``,l=s===``||s===`none`||s===`normal`,{text:d,incs:f}=Rn(e,i,a),p=o.backgroundImage,m=o.backgroundColor,h=o.fontFamily,g=parseInt(o.fontSize)||32,_=parseInt(o.fontWeight)||!1,v=o.color||`#000`,y=o.borderStyle,x=parseFloat(o.borderWidth),S=o.transform,C=K(h),w=!l&&d!==``,E=p&&p!==`none`,D=m&&m!==`transparent`&&m!==`rgba(0, 0, 0, 0)`,O=y&&y!==`none`&&x>0,A=S&&S!==`none`;if(!(w||E||D||O||A)){if(f&&f.length&&e.parentElement){let t=J.get(e.parentElement)||new Map;for(let{name:n}of f){if(!n)continue;let r=In(e,a),o=Ln(e,M(e,i),r).get(e,n);t.set(n,o)}J.set(e.parentElement,t)}continue}let ee=!1;if(w&&!C&&d.length>1&&!d.startsWith(`url(`)){let n=M(e),r=parseFloat(n.fontSize)||16,i=parseFloat(n.lineHeight);Number.isFinite(i)||(i=r*1.5),e.getBoundingClientRect().height<i*1.6&&(t.style.whiteSpace=`nowrap`,ee=!0)}let j=document.createElement(`span`);j.dataset.snapdomPseudo=i,j.style.pointerEvents=`none`,ee&&(j.style.whiteSpace=`nowrap`);let te=k(ne(o),`span`);if(n.styleMap.set(j,te),C&&d&&d.length===1){let{dataUrl:e,width:n,height:r}=await Ht(d,h,_,g,v),i=document.createElement(`img`);i.src=e,i.style=`height:${g}px;width:${n/r*g}px;object-fit:contain;`,j.appendChild(i),t.dataset.snapdomHasIcon=`true`}else if(d&&d.startsWith(`url(`)){let t=c(d);if(t?.trim())try{let e=await b(u(t),{as:`dataURL`,useProxy:r.useProxy});if(e?.ok&&typeof e.data==`string`){let t=document.createElement(`img`);t.src=e.data,t.style=`width:${g}px;height:auto;object-fit:contain;`,j.appendChild(t)}}catch(t){console.error(`[snapdom] Error in pseudo ${i} for`,e,t)}}else !C&&w&&(j.textContent=d);j.style.backgroundImage=`none`,`maskImage`in j.style&&(j.style.maskImage=`none`),`webkitMaskImage`in j.style&&(j.style.webkitMaskImage=`none`);try{j.style.backgroundRepeat=o.backgroundRepeat,j.style.backgroundSize=o.backgroundSize,o.backgroundPositionX&&o.backgroundPositionY?(j.style.backgroundPositionX=o.backgroundPositionX,j.style.backgroundPositionY=o.backgroundPositionY):j.style.backgroundPosition=o.backgroundPosition,j.style.backgroundOrigin=o.backgroundOrigin,j.style.backgroundClip=o.backgroundClip,j.style.backgroundAttachment=o.backgroundAttachment,j.style.backgroundBlendMode=o.backgroundBlendMode}catch{}if(E)try{let e=re(p),t=await Promise.all(e.map(T));j.style.backgroundImage=t.join(`, `)}catch(e){console.warn(`[snapdom] Failed to inline background-image for ${i}`,e)}D&&(j.style.backgroundColor=m);let ie=j.childNodes.length>0||j.textContent?.trim()!==``||E||D||O||A;if(f&&f.length&&e.parentElement){let t=J.get(e.parentElement)||new Map,n=In(e,a),r=Ln(e,M(e,i),n);for(let{name:n}of f){if(!n)continue;let i=r.get(e,n);t.set(n,i)}J.set(e.parentElement,t)}if(!ie)continue;i===`::before`?(t.dataset.snapdomHasBefore=`1`,t.insertBefore(j,t.firstChild)):(t.dataset.snapdomHasAfter=`1`,t.appendChild(j))}catch(t){console.warn(`[snapdom] Failed to capture ${i} for`,e,t)}let s=Array.from(t.children).filter(e=>!e.dataset.snapdomPseudo);if(n.nodeMap)for(let e of s){let t=n.nodeMap.get(e);t instanceof Element&&await zn(t,e,n,r)}else{let t=Array.from(e.children);for(let e=0;e<Math.min(t.length,s.length);e++)await zn(t[e],s[e],n,r)}}function Bn(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll(`svg`));if(i.length===0)return;let a=/url\(\s*#([^)]+)\)/g,o=[`fill`,`stroke`,`filter`,`clip-path`,`mask`,`marker`,`marker-start`,`marker-mid`,`marker-end`],s=e=>window.CSS&&CSS.escape?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,`\\$&`),c=e=>{if(!e||!e.getAttribute)return null;let t=e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`):null);if(t)return t;let n=e.attributes;if(!n)return null;for(let e=0;e<n.length;e++){let t=n[e];if(!t||!t.name)continue;if(t.name===`href`)return t.value;let r=t.name.indexOf(`:`);if(r!==-1&&t.name.slice(r+1)===`href`)return t.value}return null},l=new Set(Array.from(e.querySelectorAll(`[id]`)).map(e=>e.id)),u=new Set,d=!1,f=(e,t=null)=>{if(!e)return;a.lastIndex=0;let n;for(;n=a.exec(e);){d=!0;let e=(n[1]||``).trim();e&&(l.has(e)||(u.add(e),t&&!t.has(e)&&t.add(e)))}},p=e=>{let t=e.querySelectorAll(`use`);for(let e of t){let t=c(e);if(!t||!t.startsWith(`#`))continue;d=!0;let n=t.slice(1).trim();n&&!l.has(n)&&u.add(n)}let n=e.querySelectorAll(`*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]`);for(let e of n){f(e.getAttribute(`style`)||``);for(let t of o)f(e.getAttribute(t))}};for(let e of i)p(e);if(!d)return;let m=e.querySelector(`svg.inline-defs-container`);m||(m=n.createElementNS(`http://www.w3.org/2000/svg`,`svg`),m.classList.add(`inline-defs-container`),m.setAttribute(`aria-hidden`,`true`),m.setAttribute(`style`,`position:absolute;width:0;height:0;overflow:hidden`),e.insertBefore(m,e.firstChild||null));let h=m.querySelector(`defs`)||null,g=t=>{if(!t||l.has(t))return null;let n=s(t),i=t=>{let n=r.querySelector(t);return n&&!e.contains(n)?n:null};return i(`svg defs > *#${n}`)||i(`svg > symbol#${n}`)||i(`*#${n}`)};if(!u.size)return;let _=new Set(u),v=new Set;for(;_.size;){let e=_.values().next().value;if(_.delete(e),!e||l.has(e)||v.has(e))continue;let t=g(e);if(!t){v.add(e);continue}h||(h=n.createElementNS(`http://www.w3.org/2000/svg`,`defs`),m.appendChild(h));let r=t.cloneNode(!0);r.id||r.setAttribute(`id`,e),h.appendChild(r),v.add(e),l.add(e);let i=[r,...r.querySelectorAll(`*`)];for(let e of i){let t=c(e);if(t&&t.startsWith(`#`)){let e=t.slice(1).trim();e&&!l.has(e)&&!v.has(e)&&_.add(e)}let n=e.getAttribute?.(`style`)||``;n&&f(n,_);for(let t of o){let n=e.getAttribute?.(t);n&&f(n,_)}}}}s();function Vn(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(),i=e.clientHeight,a=`data-snap-ph`,o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;o.nextNode();){let s=o.currentNode,c=getComputedStyle(s),l=c.position;if(l!==`sticky`&&l!==`-webkit-sticky`)continue;let u=Hn(c.top),d=Hn(c.bottom);if(u==null&&d==null)continue;let f=Wn(t,Un(s,e),a);if(!f)continue;let p=s.getBoundingClientRect(),m=p.width,h=p.height,g=p.left-r.left;if(!(m>0&&h>0)||!Number.isFinite(g))continue;let _=u==null?n+(i-h-d):u+n;if(!Number.isFinite(_))continue;let v=Number.parseInt(c.zIndex,10),y=Number.isFinite(v),b=y?Math.max(v,1)+1:2,x=y?v-1:0,S=f.cloneNode(!1);S.setAttribute(a,`1`),S.style.position=`sticky`,S.style.left=`${g}px`,S.style.top=`${_}px`,S.style.width=`${m}px`,S.style.height=`${h}px`,S.style.visibility=`hidden`,S.style.zIndex=String(x),S.style.overflow=`hidden`,S.style.background=`transparent`,S.style.boxShadow=`none`,S.style.filter=`none`,f.parentElement?.insertBefore(S,f),f.style.position=`absolute`,f.style.left=`${g}px`,f.style.top=`${_}px`,f.style.bottom=`auto`,f.style.zIndex=String(b),f.style.pointerEvents=`none`}}function Hn(e){if(!e||e===`auto`)return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function Un(e,t){let n=[];for(let r=e;r&&r!==t;){let e=r.parentElement;if(!e)break;n.push(Array.prototype.indexOf.call(e.children,r)),r=e}return n.reverse()}function Wn(e,t,n){let r=e;for(let e=0;e<t.length;e++)if(r=Gn(r,n)[t[e]],!r)return null;return r instanceof HTMLElement?r:null}function Gn(e,t){let n=[],r=e.children;for(let e=0;e<r.length;e++){let i=r[e];i.hasAttribute(t)||n.push(i)}return n}function Kn(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,a=t.borderWidth;n!==`none`&&parseFloat(r)>0&&(i===`none`||parseFloat(a)===0)&&(e.style.border=`${r} solid transparent`)}function qn(e){let t=[];try{let n=e.querySelectorAll(`*`);for(let e of n){if(!(e instanceof HTMLElement))continue;let n=e.style.contentVisibility||``,r=getComputedStyle(e),i=r.contentVisibility||r.getPropertyValue(`content-visibility`)||``;(i===`auto`||i===`hidden`)&&(t.push({el:e,original:n}),e.style.contentVisibility=`visible`)}if(e instanceof HTMLElement){let n=getComputedStyle(e),r=n.contentVisibility||n.getPropertyValue(`content-visibility`)||``;(r===`auto`||r===`hidden`)&&(t.push({el:e,original:e.style.contentVisibility||``}),e.style.contentVisibility=`visible`)}}catch{}return()=>{for(let{el:e,original:n}of t)try{e.style.contentVisibility=n}catch{}}}async function Jn(e,t={}){let n={styleMap:o.session.styleMap,styleCache:o.session.styleCache,nodeMap:o.session.nodeMap,options:t},r,i=``,a=``;Kn(e);let s=qn(e);try{Bn(e)}catch(e){console.warn(`inlineExternal defs or symbol failed:`,e)}try{r=await kt(e,n,t)}catch(e){throw console.warn(`deepClone failed:`,e),e}finally{s()}try{await zn(e,r,n,t)}catch(e){console.warn(`inlinePseudoElements failed:`,e)}await Ot(r,n);try{let e=r.querySelectorAll(`style[data-sd]`);for(let t of e)a+=t.textContent||``,t.remove()}catch(e){z(n,`Failed to extract shadow CSS from style[data-sd]`,e)}let c=j(n.styleMap);i=Array.from(c.entries()).map(([e,t])=>`.${t}{${e}}`).join(``),i=a+`[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}`+i;for(let[e,t]of n.styleMap.entries()){if(e.tagName===`STYLE`)continue;if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){e.setAttribute(`style`,t.replace(/;/g,`; `));continue}let n=c.get(t);n&&e.classList.add(n);let r=e.style?.backgroundImage,i=e.dataset?.snapdomHasIcon;r&&r!==`none`&&(e.style.backgroundImage=r),i&&(e.style.verticalAlign=`middle`,e.style.display=`inline`)}for(let[e,t]of n.nodeMap.entries()){let n=t.scrollLeft,r=t.scrollTop;if((n||r)&&e instanceof HTMLElement){e.style.overflow=`hidden`,e.style.scrollbarWidth=`none`,e.style.msOverflowStyle=`none`;try{let t=e.querySelectorAll(`*`);for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.style.position;if(t===`fixed`||t===`absolute`){let i=parseFloat(e.style.top)||0,a=parseFloat(e.style.left)||0;e.style.top=`${i+r}px`,e.style.left=`${a+n}px`,t===`fixed`&&(e.style.position=`absolute`)}}}catch{}let t=document.createElement(`div`);for(t.style.transform=`translate(${-n}px, ${-r}px)`,t.style.willChange=`transform`,t.style.display=`inline-block`,t.style.width=`100%`;e.firstChild;)t.appendChild(e.firstChild);e.appendChild(t)}}if(Vn(e,r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r),e===n.nodeMap.get(r)){let t=n.styleCache.get(e)||M(e);n.styleCache.set(e,t);let i=l(t.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=i||``}for(let[e,t]of n.nodeMap.entries())t.tagName===`PRE`&&(e.style.marginTop=`0`,e.style.marginBlockStart=`0`);return{clone:r,classCSS:i,styleCache:n.styleCache}}w();var Yn=`http://www.w3.org/1999/xlink`;function Xn(e){return e.getAttribute(`href`)||e.getAttribute(`xlink:href`)||(typeof e.getAttributeNS==`function`?e.getAttributeNS(Yn,`href`):null)}function Zn(e){let t=parseInt(e.dataset?.snapdomWidth||``,10)||0,n=parseInt(e.dataset?.snapdomHeight||``,10)||0,r=parseInt(e.getAttribute(`width`)||``,10)||0,i=parseInt(e.getAttribute(`height`)||``,10)||0,a=parseFloat(e.style?.width||``)||0,o=parseFloat(e.style?.height||``)||0;return{width:t||a||r||e.width||e.naturalWidth||100,height:n||o||i||e.height||e.naturalHeight||100}}async function Qn(e,t={}){let n=Array.from(e.querySelectorAll(`img`)),r=async e=>{if(!e.getAttribute(`src`)){let t=e.currentSrc||e.src||``;t&&e.setAttribute(`src`,t)}e.removeAttribute(`srcset`),e.removeAttribute(`sizes`);let n=e.src||``;if(!n)return;let r=await b(n,{as:`dataURL`,useProxy:t.useProxy});if(r.ok&&typeof r.data==`string`&&r.data.startsWith(`data:`)){e.src=r.data,e.width||=e.naturalWidth||100,e.height||=e.naturalHeight||100;return}let{width:i,height:a}=Zn(e),{fallbackURL:o}=t||{};if(o)try{let r=typeof o==`function`?await o({width:i,height:a,src:n,element:e}):o;if(r){let n=await b(r,{as:`dataURL`,useProxy:t.useProxy});if(n?.ok&&typeof n.data==`string`){e.src=n.data,e.width||=i,e.height||=a;return}}}catch{}if(t.placeholders!==!1){let t=document.createElement(`div`);t.style.cssText=[`width:${i}px`,`height:${a}px`,`background:#ccc`,`display:inline-block`,`text-align:center`,`line-height:${a}px`,`color:#666`,`font-size:12px`,`overflow:hidden`].join(`;`),t.textContent=`img`,e.replaceWith(t)}else{let t=document.createElement(`div`);t.style.cssText=`display:inline-block;width:${i}px;height:${a}px;visibility:hidden;`,e.replaceWith(t)}};for(let e=0;e<n.length;e+=6){let t=n.slice(e,e+6).map(r);await Promise.allSettled(t)}let i=Array.from(e.querySelectorAll(`image`)),a=async e=>{let n=Xn(e);if(!n||n.startsWith(`data:`)||n.startsWith(`blob:`))return;let r=await b(n,{as:`dataURL`,useProxy:t.useProxy});r.ok&&typeof r.data==`string`&&r.data.startsWith(`data:`)&&(e.setAttribute(`href`,r.data),e.removeAttribute(`xlink:href`),typeof e.removeAttributeNS==`function`&&e.removeAttributeNS(Yn,`href`))};for(let e=0;e<i.length;e+=6){let t=i.slice(e,e+6).map(a);await Promise.allSettled(t)}}B();async function $n(e,t,n,r={}){let i=[[e,t]],a=[`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`],o=[`mask-position`,`mask-size`,`mask-repeat`,`mask-mode`,`mask-composite`,`-webkit-mask-position`,`-webkit-mask-size`,`-webkit-mask-repeat`,`-webkit-mask-composite`,`mask-origin`,`mask-clip`,`-webkit-mask-origin`,`-webkit-mask-clip`,`-webkit-mask-position-x`,`-webkit-mask-position-y`],s=[`background-position`,`background-position-x`,`background-position-y`,`background-size`,`background-repeat`,`background-origin`,`background-clip`,`background-attachment`,`background-blend-mode`],c=[`border-image-slice`,`border-image-width`,`border-image-outset`,`border-image-repeat`];for(;i.length;){let[e,t]=i.shift();if(!t)continue;let l=n.get(e)||M(e);n.has(e)||n.set(e,l);let u=(()=>{let e=l.getPropertyValue(`border-image`),t=l.getPropertyValue(`border-image-source`);return e&&e!==`none`||t&&t!==`none`})();for(let e of s){let n=l.getPropertyValue(e);n&&t.style.setProperty(e,n)}for(let e of a){let n=l.getPropertyValue(e);if(e===`background-image`&&(!n||n===`none`)){let e=l.getPropertyValue(`background`);e&&/url\s*\(/.test(e)&&(n=re(e).filter(e=>/url\s*\(/.test(e)).join(`, `)||n)}if(!n||n===`none`)continue;let i=re(n),a=await Promise.all(i.map(e=>T(e,r)));a.some(e=>e&&e!==`none`&&!/^url\(undefined/.test(e))&&t.style.setProperty(e,a.join(`, `))}for(let e of o){let n=l.getPropertyValue(e);!n||n===`initial`||t.style.setProperty(e,n)}if(u)for(let e of c){let n=l.getPropertyValue(e);!n||n===`initial`||t.style.setProperty(e,n)}let d=e.shadowRoot?Array.from(e.shadowRoot.children).filter(e=>e.tagName!==`STYLE`):Array.from(e.children),f=Array.from(t.children).filter(e=>!(e.dataset?.snapdomPseudo||e.tagName===`STYLE`&&e.dataset?.sd));for(let e=0;e<Math.min(d.length,f.length);e++)i.push([d[e],f[e]])}}B(),s();function er(e){if(!e)return()=>{};let t=[];function n(e){let r=tr(e);r&&t.push(r);for(let t of e.children||[])n(t)}return n(e),()=>t.forEach(e=>e())}function tr(e){if(!e)return()=>{};let t=nr(e);if(t<=0||!ar(e))return()=>{};let n=getComputedStyle(e),r=Math.round(rr(n)*t+ir(n)),i=e.textContent??``,a=i;if(e.scrollHeight<=r+.5)return()=>{};let o=0,s=i.length,c=-1;for(;o<=s;){let t=o+s>>1;e.textContent=i.slice(0,t)+`…`,e.scrollHeight<=r+.5?(c=t,o=t+1):s=t-1}return e.textContent=(c>=0?i.slice(0,c):``)+`…`,()=>{e.textContent=a}}function nr(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 rr(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 ir(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function ar(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(e=>e.nodeType===Node.TEXT_NODE)}var Y=[];function or(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 sr(...e){let t=e.flat();for(let e of t){let t=or(e);t&&(Y.some(e=>e&&e.name&&t.name&&e.name===t.name)||Y.push(t))}}function cr(e){return(e&&Array.isArray(e.plugins)?e.plugins:Y)||Y}async function X(e,t,n){let r=n,i=cr(t);for(let n of i){let i=n&&typeof n[e]==`function`?n[e]:null;if(!i)continue;let a=await i(t,r);typeof a<`u`&&(r=a)}return r}async function lr(e,t,n){let r=[],i=cr(t);for(let a of i){let i=a&&typeof a[e]==`function`?a[e]:null;if(!i)continue;let o=await i(t,n);typeof o<`u`&&r.push(o)}return r}function ur(e){let t=[];if(Array.isArray(e))for(let n of e){let e=or(n);if(!e||!e.name)continue;let r=t.findIndex(t=>t&&t.name===e.name);r>=0&&t.splice(r,1),t.push(e)}for(let e of Y)e&&e.name&&!t.some(t=>t.name===e.name)&&t.push(e);return Object.freeze(t)}function dr(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=ur(t)),e}function fr(){return Y.slice()}function Z(e){return!!(!e||e.startsWith(`data:`)||e.startsWith(`blob:`)||/^data:image\/(gif|png|svg)/.test(e)&&e.length<200)}function pr(e,t){return!e||!(e instanceof Element)?!1:e.querySelector(`picture`)?!0:t?!!e.querySelector(`img[data-src], img[data-lazy-src], img[data-original], img[data-hi-res-src], img[data-srcset], img[data-lazy-srcset]`):!1}function mr(e,t){let n=e.currentSrc||``;if(n&&!Z(n))return n;let r=t.querySelectorAll(`source[srcset]`),i=null;for(let e of r){let t=e.getAttribute(`srcset`);if(!t||Z(t))continue;let n=e.getAttribute(`media`);if(n)try{if(window.matchMedia(n).matches)return t.split(`,`)[0].trim().split(/\s+/)[0]}catch{}i||=t.split(`,`)[0].trim().split(/\s+/)[0]}return i}function hr(e){let t=[e.getAttribute(`data-src`),e.getAttribute(`data-lazy-src`),e.getAttribute(`data-original`),e.getAttribute(`data-hi-res-src`)];for(let e of t)if(e&&!Z(e))return e;let n=e.getAttribute(`data-srcset`)||e.getAttribute(`data-lazy-srcset`);if(n){let e=n.split(`,`)[0].trim().split(/\s+/)[0];if(e&&!Z(e))return e}return null}function gr(e={}){let t=e.pictureResolver&&typeof e.pictureResolver==`object`?e.pictureResolver:{};return{timeout:t.timeout??5e3,concurrency:t.concurrency??4,resolveLazySrc:t.resolveLazySrc!==!1,silent:t.silent??!1,useProxy:typeof e.useProxy==`string`?e.useProxy:``}}async function _r(e,t={}){if(!e||!(e instanceof Element)||t.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:r,resolveLazySrc:i,silent:a,useProxy:o}=gr(t);if(!pr(e,i))return null;let s=[],c=[];async function l(e){let t=new AbortController,r=setTimeout(()=>t.abort(),n);try{let n=await fetch(e,{credentials:`include`,signal:t.signal});if(!n.ok&&o){let r=o.includes(`{url}`)?o.replace(`{url}`,encodeURIComponent(e)):o.endsWith(`?`)?`${o}${encodeURIComponent(e)}`:`${o}${o.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`;n=await fetch(r,{signal:t.signal})}if(!n.ok)return null;let r=await n.blob();return await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)})}catch{return null}finally{clearTimeout(r)}}async function u(e){for(let t=0;t<e.length;t+=r){let n=e.slice(t,t+r);await Promise.allSettled(n.map(e=>e()))}}let d=e.querySelectorAll(`picture`);for(let e of d){let t=e.querySelector(`img`);if(!t||!Z(t.getAttribute(`src`)||``))continue;let n=mr(t,e);n&&c.push(async()=>{let r=await l(n);if(!r){a||console.warn(`[snapdom:picture-resolver] Failed to fetch: ${n.slice(0,60)}`);return}let i=t.getAttribute(`src`),o=t.getAttribute(`srcset`),c=t.getAttribute(`sizes`),u=[];t.src=r,t.setAttribute(`src`,r),t.removeAttribute(`srcset`),t.removeAttribute(`sizes`);let d=e.querySelectorAll(`source`);for(let e of d)u.push({el:e,parent:e.parentElement,next:e.nextSibling}),e.remove();s.push(()=>{i===null?t.removeAttribute(`src`):t.setAttribute(`src`,i),o!==null&&t.setAttribute(`srcset`,o),c!==null&&t.setAttribute(`sizes`,c);for(let{el:e,parent:t,next:n}of u)t&&t.insertBefore(e,n)})})}if(i){let t=e.querySelectorAll(`img`);for(let e of t){if(e.closest(`picture`)&&Z(e.getAttribute(`src`)||``))continue;let t=e.getAttribute(`src`)||``,n=hr(e);n&&Z(t)&&c.push(async()=>{let t=await l(n);if(!t)return;let r=e.getAttribute(`src`);e.src=t,e.setAttribute(`src`,t),e.removeAttribute(`srcset`),e.removeAttribute(`sizes`),s.push(()=>{r===null?e.removeAttribute(`src`):e.setAttribute(`src`,r)})})}}return c.length===0?null:(await u(c),async function(){for(let e of s)try{e()}catch{}})}B();function vr(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow=`none`}catch(e){z(n,`stripRootShadows boxShadow`,e)}try{t.style.textShadow=`none`}catch(e){z(n,`stripRootShadows textShadow`,e)}try{t.style.outline=`none`}catch(e){z(n,`stripRootShadows outline`,e)}let i=(r.filter||``).replace(/\bblur\([^()]*\)\s*/gi,``).replace(/\bdrop-shadow\([^()]*\)\s*/gi,``).trim().replace(/\s+/g,` `);try{t.style.filter=i.length?i:`none`}catch(e){z(n,`stripRootShadows filter`,e)}}function yr(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let e of n)e.remove()}function br(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set([`xml`,`xlink`]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let e=i.currentNode;for(let t of Array.from(e.attributes)){let i=t.name;if(i.includes(`@`)){e.removeAttribute(i);continue}if(i.includes(`:`)){let t=i.split(`:`,1)[0];if(!r.has(t)){e.removeAttribute(i);continue}}if(n&&(i.startsWith(`x-`)||i.startsWith(`v-`)||i.startsWith(`:`)||i.startsWith(`on:`)||i.startsWith(`bind:`)||i.startsWith(`let:`)||i.startsWith(`class:`))){e.removeAttribute(i);continue}}}}function xr(e,t={}){e&&(br(e,t),yr(e))}function Sr(e){try{let t=e.getAttribute?.(`style`)||``;return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function Cr(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function wr(e,t){if(!(e instanceof Element)||Sr(e)||Cr(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 Tr(e,t,n=new Map){function r(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.childElementCount>t.childElementCount,a=n.get(e)||getComputedStyle(e);if(n.has(e)||n.set(e,a),i&&wr(e,a)){t.style.height||(t.style.height=`auto`),t.style.width||(t.style.width=`auto`),t.style.removeProperty(`block-size`),t.style.removeProperty(`inline-size`),t.style.minHeight||(t.style.minHeight=`0`),t.style.minWidth||(t.style.minWidth=`0`),t.style.maxHeight||(t.style.maxHeight=`none`),t.style.maxWidth||(t.style.maxWidth=`none`);let e=a.overflowY||a.overflowBlock||`visible`,n=a.overflowX||a.overflowInline||`visible`;(e!==`visible`||n!==`visible`)&&(t.style.overflow=`visible`)}let o=Array.from(e.children),s=Array.from(t.children);for(let e=0;e<Math.min(o.length,s.length);e++)r(o[e],s[e])}r(e,t)}function Er(e){let t=getComputedStyle(e);return!(t.display===`none`||t.position===`absolute`||t.position===`fixed`)}function Dr(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(e){z(t,`exclude selector match failed`,e)}return!1}function Or(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,a=-1/0,o=!1,s=Array.from(e.children);for(let e of s){if(Dr(e,t)||!Er(e))continue;let n=e.getBoundingClientRect(),s=n.top-r.top,c=n.bottom-r.top;c<=s||(s<i&&(i=s),c>a&&(a=c),o=!0)}let c=o?Math.max(0,a-i):0,l=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return l+u+d+f+c}var Q=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,kr=/::-webkit-scrollbar(-[a-z]+)?\b/i;function Ar(e,t=new Set){let n=``;if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=Ar(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let e=Ar(i.cssRules,t);e&&(n+=`@media ${i.conditionText}{${e}}`);continue}if(i.type===CSSRule.STYLE_RULE){let e=i.selectorText||``;if(kr.test(e)){let e=i.cssText;e&&!t.has(e)&&(t.add(e),n+=e)}}}catch{}}return n}function jr(e){if(!e||!e.styleSheets)return``;let t=new Set,n=``;for(let r of Array.from(e.styleSheets))try{let e=r.cssRules;e&&(n+=Ar(e,t))}catch{}return n}function Mr(e){let t=e.boxShadow||``;if(!t||t===`none`)return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(e=>e.trim()),r=0,i=0,a=0,o=0;for(let e of n){let t=e.match(/-?\d+(\.\d+)?px/g)?.map(e=>parseFloat(e))||[];if(t.length<2)continue;let[n,s,c=0,l=0]=t,u=Math.abs(n)+c+l,d=Math.abs(s)+c+l;i=Math.max(i,u+Math.max(n,0)),o=Math.max(o,u+Math.max(-n,0)),a=Math.max(a,d+Math.max(s,0)),r=Math.max(r,d+Math.max(-s,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(a),left:Math.ceil(o)}}function Nr(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 Pr(e){if((e.outlineStyle||`none`)===`none`)return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||`0`)||0),n=parseFloat(e.outlineOffset||`0`)||0,r=t+Math.max(0,Math.ceil(n));return{top:r,right:r,bottom:r,left:r}}function Fr(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,i=0,a=0,o=0,s=!1;for(let e of n){s=!0;let[t=0,n=0,c=0]=e.match(/-?\d+(?:\.\d+)?px/gi)?.map(e=>parseFloat(e))||[],l=Math.abs(t)+c,u=Math.abs(n)+c;i=Math.max(i,l+Math.max(t,0)),o=Math.max(o,l+Math.max(-t,0)),a=Math.max(a,u+Math.max(n,0)),r=Math.max(r,u+Math.max(-n,0))}return{bleed:{top:Q(r),right:Q(i),bottom:Q(a),left:Q(o)},has:s}}function Ir(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||r===`none`)try{let n=Wr(e);if(n.a===1&&n.b===0&&n.c===0&&n.d===1)return t.style.transform=`none`,{a:1,b:0,c:0,d:1}}catch{}function i(e,t,n,r){let i=Math.sqrt(e*e+t*t)||0,a=0,o=0;if(i>0){let s=e/i,c=t/i;a=s*n+c*r;let l=n-s*a,u=r-c*a;o=Math.sqrt(l*l+u*u)||0,o>0?a/=o:a=0}return{a:i,b:0,c:a*o,d:o}}let a=r.match(/^matrix\(\s*([^)]+)\)$/i);if(a){let e=a[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length===6&&e.every(Number.isFinite)){let[n,r,a,o]=e,s=i(n,r,a,o);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}}let o=r.match(/^matrix3d\(\s*([^)]+)\)$/i);if(o){let e=o[1].split(`,`).map(e=>parseFloat(e.trim()));if(e.length===16&&e.every(Number.isFinite)){let n=e[0],r=e[1],a=e[4],o=e[5],s=i(n,r,a,o);try{t.style.transform=`matrix(${s.a}, ${s.b}, ${s.c}, ${s.d}, 0, 0)`}catch{}return s}}try{let e=new DOMMatrix(r),n=i(e.a,e.b,e.c,e.d);try{t.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, 0, 0)`}catch{}return n}catch{return null}}function Lr(e,t,n,r,i){let a=n.a,o=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(e,t){let n=e-r,d=t-i,f=a*n+s*d,p=o*n+c*d;return f+=r+l,p+=i+u,[f,p]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],p=1/0,m=1/0,h=-1/0,g=-1/0;for(let[e,t]of f)e<p&&(p=e),t<m&&(m=t),e>h&&(h=e),t>g&&(g=t);return{minX:p,minY:m,maxX:h,maxY:g,width:h-p,height:g-m}}function Rr(e,t,n){let r=(e.transformOrigin||`0 0`).trim().split(/\s+/),[i,a]=[r[0]||`0`,r[1]||`0`],o=(e,t)=>{let n=e.toLowerCase();return n===`left`||n===`top`?0:n===`center`?t/2:n===`right`||n===`bottom`?t:n.endsWith(`px`)?parseFloat(n)||0:n.endsWith(`%`)?(parseFloat(n)||0)*t/100:/^-?\d+(\.\d+)?$/.test(n)&&parseFloat(n)||0};return{ox:o(i,t),oy:o(a,n)}}function zr(e){let t={rotate:`0deg`,scale:null,translate:null},n=typeof e.computedStyleMap==`function`?e.computedStyleMap():null;if(n){let r=e=>{try{return typeof n.has==`function`&&!n.has(e)||typeof n.get!=`function`?null:n.get(e)}catch{return null}},i=r(`rotate`);if(i)if(i.angle){let e=i.angle;t.rotate=e.unit===`rad`?e.value*180/Math.PI+`deg`:e.value+e.unit}else i.unit?t.rotate=i.unit===`rad`?i.value*180/Math.PI+`deg`:i.value+i.unit:t.rotate=String(i);else{let n=getComputedStyle(e);t.rotate=n.rotate&&n.rotate!==`none`?n.rotate:`0deg`}let a=r(`scale`);if(a){let e=`x`in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1;t.scale=`${e} ${`y`in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:e}`}else{let n=getComputedStyle(e);t.scale=n.scale&&n.scale!==`none`?n.scale:null}let o=r(`translate`);if(o){let e=`x`in o&&`value`in o.x?o.x.value:Array.isArray(o)?o[0]?.value:0,n=`y`in o&&`value`in o.y?o.y.value:Array.isArray(o)?o[1]?.value:0;t.translate=`${e}${`x`in o&&o.x?.unit?o.x.unit:`px`} ${n}${`y`in o&&o.y?.unit?o.y.unit:`px`}`}else{let n=getComputedStyle(e);t.translate=n.translate&&n.translate!==`none`?n.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 Br=null;function Vr(){if(Br)return Br;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),Br=e,e}function Hr(e){let t=Vr(),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=Wr(n);return t.removeChild(n),r}function Ur(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`,i=t.scale&&t.scale!==`none`&&t.scale!==`1`,a=t.translate&&t.translate!==`none`&&t.translate!==`0px 0px`;return!!(r||i||a)}function Wr(e){let t=getComputedStyle(e).transform;if(!t||t===`none`)return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}function Gr(e){if(Array.isArray(e.plugins)){for(let t of e.plugins)if(or(t)?.name===`picture-resolver`)return!0}return fr().some(e=>e?.name===`picture-resolver`)}async function Kr(e,t){if(!e)throw Error(`Element cannot be null or undefined`);i(t.cache);let n=t.fast,r=t.outerTransforms!==!1,a=!!t.outerShadows,s={element:e,options:t,plugins:t.plugins},c,l,u,d=``,f=``,p,m,h=null;await X(`beforeSnap`,s);let g=null;t.resolvePicturePlaceholders!==!1&&!Gr(t)&&(g=await _r(s.element,s.options)),await X(`beforeClone`,s);let _=er(s.element);try{({clone:c,classCSS:l,styleCache:u}=await Jn(s.element,s.options)),!r&&c&&(h=Ir(s.element,c)),!a&&c&&vr(s.element,c,s.options)}finally{_()}if(s={clone:c,classCSS:l,styleCache:u,...s},await X(`afterClone`,s),g&&await g(),xr(s.clone),s.options?.excludeMode===`remove`)try{Tr(s.element,s.clone,s.styleCache)}catch(e){console.warn(`[snapdom] shrink pass failed:`,e)}try{await Vt(s.clone,s.element)}catch{}await new Promise(e=>{I(async()=>{await Qn(s.clone,s.options),e()},{fast:n})}),await new Promise(e=>{I(async()=>{await $n(s.element,s.clone,s.styleCache,s.options),e()},{fast:n})}),t.embedFonts&&await new Promise(e=>{I(async()=>{let t=yn(s.element),n=bn(s.element);L()&&await xn(new Set(Array.from(t).map(e=>String(e).split(`__`)[0]).filter(Boolean)),1),d=await vn({required:t,usedCodepoints:n,preCached:!1,exclude:s.options.excludeFonts,useProxy:s.options.useProxy,fontStylesheetDomains:s.options.fontStylesheetDomains}),e()},{fast:n})});let v=A(s.clone).sort(),y=v.join(`,`);o.baseStyle.has(y)?f=o.baseStyle.get(y):await new Promise(e=>{I(()=>{f=ee(v),o.baseStyle.set(y,f),e()},{fast:n})});let b=jr(s.element?.ownerDocument||document);s={fontsCSS:d,baseCSS:f,scrollbarCSS:b,...s},await X(`beforeRender`,s),await new Promise(e=>{I(()=>{let n=M(s.element),i=s.element.getBoundingClientRect(),c=Math.max(1,Q(s.element.offsetWidth||parseFloat(n.width)||i.width||1)),l=Math.max(1,Q(s.element.offsetHeight||parseFloat(n.height)||i.height||1)),u=s.element.ownerDocument||document;if(s.element===u.body||s.element===u.documentElement){let e=Math.max(s.element.scrollHeight||0,u.documentElement?.scrollHeight||0,u.body?.scrollHeight||0),t=Math.max(s.element.scrollWidth||0,u.documentElement?.scrollWidth||0,u.body?.scrollWidth||0);e>0&&(l=Math.max(l,Q(e))),t>0&&(c=Math.max(c,Q(t)));try{let e=(s.scrollbarCSS||``).length+(s.baseCSS||``).length+(s.fontsCSS||``).length+(s.classCSS||``).length,t=o.measureHints.get(s.element);if(t&&t.cssLen===e&&t.w0===c)t.csh>0&&(l=Math.max(l,Q(t.csh))),t.csw>0&&(c=Math.max(c,Q(t.csw)));else{let t=u.createElement(`div`);t.style.cssText=`position:absolute!important;left:-9999px!important;top:0!important;width:`+c+`px!important;overflow:visible!important;visibility:hidden!important;`;let n=u.createElement(`style`);n.textContent=(s.scrollbarCSS||``)+s.baseCSS+s.fontsCSS+`svg{overflow:visible;} foreignObject{overflow:visible;}`+s.classCSS,t.appendChild(n),t.appendChild(s.clone.cloneNode(!0)),u.body.appendChild(t);let r=t.scrollHeight,i=t.scrollWidth;u.body.removeChild(t),o.measureHints.set(s.element,{cssLen:e,w0:c,csh:r,csw:i}),r>0&&(l=Math.max(l,Q(r))),i>0&&(c=Math.max(c,Q(i)))}}catch{}}if(s.options?.excludeMode===`remove`){let e=Or(s.element,s.options);Number.isFinite(e)&&e>0&&(l=Math.max(1,Math.min(l,Q(e+1))))}let d=(e,t=NaN)=>{let n=typeof e==`string`?parseFloat(e):e;return Number.isFinite(n)?n:t},f=d(s.options.width),g=d(s.options.height),_=c,v=l,y=Number.isFinite(f),b=Number.isFinite(g),x=l>0?c/l:1;y&&b?(_=Math.max(1,Q(f)),v=Math.max(1,Q(g))):y?(_=Math.max(1,Q(f)),v=Math.max(1,Q(_/(x||1)))):b?(v=Math.max(1,Q(g)),_=Math.max(1,Q(v*(x||1)))):(_=c,v=l);let S=0,C=0,w=c,T=l;if(!r&&h&&Number.isFinite(h.a)){let e={a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},t=Lr(c,l,e,0,0);S=Q(t.minX),C=Q(t.minY),w=Q(t.maxX),T=Q(t.maxY)}else if(r&&qr(s.element)){let e=n.transform&&n.transform!==`none`?n.transform:``,t=zr(s.element),r=Hr({baseTransform:e,rotate:t.rotate||`0deg`,scale:t.scale,translate:t.translate}),{ox:i,oy:a}=Rr(n,c,l),o=r.is2D?r:new DOMMatrix(r.toString()),u=Lr(c,l,o,i,a);S=Q(u.minX),C=Q(u.minY),w=Q(u.maxX),T=Q(u.maxY)}let E=Mr(n),D=Nr(n),O=Pr(n),k=Fr(n),A=a?{top:Q(E.top+D.top+O.top+k.bleed.top),right:Q(E.right+D.right+O.right+k.bleed.right),bottom:Q(E.bottom+D.bottom+O.bottom+k.bleed.bottom),left:Q(E.left+D.left+O.left+k.bleed.left)}:{top:0,right:0,bottom:0,left:0};S=Q(S-A.left),C=Q(C-A.top),w=Q(w+A.right),T=Q(T+A.bottom);let ee=Math.max(1,Q(w-S)),j=Math.max(1,Q(T-C)),te=y||b?Q(_/c):1,ne=b||y?Q(v/l):1,re=Math.max(1,Q(ee*te)),ie=Math.max(1,Q(j*ne)),N=`http://www.w3.org/2000/svg`,P=Q((L()&&qr(s.element)?1:0)+ +!r),F=document.createElementNS(N,`foreignObject`),ae=Q(S),oe=Q(C);F.setAttribute(`x`,String(Q(-(ae-P)))),F.setAttribute(`y`,String(Q(-(oe-P)))),F.setAttribute(`width`,String(Q(c+P*2))),F.setAttribute(`height`,String(Q(l+P*2))),F.style.overflow=`visible`;let se=document.createElement(`style`);se.textContent=(s.scrollbarCSS||``)+s.baseCSS+s.fontsCSS+`svg{overflow:visible;} foreignObject{overflow:visible;} foreignObject>div{-webkit-text-size-adjust:100%!important;text-size-adjust:100%!important;}`+s.classCSS,F.appendChild(se);let I=document.createElement(`div`);I.setAttribute(`xmlns`,`http://www.w3.org/1999/xhtml`),I.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${Q(c)}px;height:${Q(l)}px`,I.appendChild(s.clone),F.appendChild(I);let ce=new XMLSerializer().serializeToString(F),le=Q(ee+P*2),R=Q(j+P*2),z=y||b;t.meta={w0:c,h0:l,vbW:le,vbH:R,targetW:_,targetH:v},m=`<svg xmlns="${N}" width="${L()&&z?le:Q(re+P*2)}" height="${L()&&z?R:Q(ie+P*2)}" viewBox="0 0 ${le} ${R}" font-size="${parseFloat(M(u.documentElement)?.fontSize)||16}px">`+ce+`</svg>`,p=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(m)}`,s={svgString:m,dataURL:p,...s},e()},{fast:n})}),await X(`afterRender`,s);let x=document.getElementById(`snapdom-sandbox`);return x&&x.style.position===`absolute`&&x.remove(),s.dataURL}function qr(e){return Ur(e)}s();function Jr(e={}){let t=e.format??`png`;t===`jpg`&&(t=`jpeg`);let n=r(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,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],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,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null,resolvePicturePlaceholders:e.resolvePicturePlaceholders!==!1,pictureResolver:e.pictureResolver&&typeof e.pictureResolver==`object`?e.pictureResolver:{}}}R(),ue(),B(),w(),s();function Yr(...e){return sr(...e),$}var $=Object.assign($r,{plugins:Yr}),Xr=Symbol(`snapdom.internal`),Zr=Symbol(`snapdom.internal.silent`),Qr=!1;async function $r(e,t){if(!e)throw Error(`Element cannot be null or undefined`);let n=Jr(t);if(dr(n,t&&t.plugins),L()&&(n.embedFonts===!0||ti(e))){if(n.embedFonts)try{let t=yn(e);await xn(new Set([...t].map(e=>String(e).split(`__`)[0]).filter(Boolean)),1)}catch{}let r=n.safariWarmupAttempts??3;for(let n=0;n<r;n++)try{await ei(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&Nt(n.iconFonts),n.snap||={toPng:(e,t)=>$.toPng(e,t),toSvg:(e,t)=>$.toSvg(e,t)},$.capture(e,n,Xr)}$.capture=async(e,t,n)=>{if(n!==Xr)throw Error(`[snapdom.capture] is internal. Use snapdom(...) instead.`);let r=await Kr(e,t),i={img:async(e,t)=>{let{toImg:n}=await Promise.resolve().then(()=>(Oe(),Ee));return n(r,{...e,...t||{}})},svg:async(e,t)=>{let{toSvg:n}=await Promise.resolve().then(()=>(Oe(),Ee));return n(r,{...e,...t||{}})},canvas:async(e,t)=>{let{toCanvas:n}=await Promise.resolve().then(()=>(Se(),de));return n(r,{...e,...t||{}})},blob:async(e,t)=>{let{toBlob:n}=await Promise.resolve().then(()=>(je(),ke));return n(r,{...e,...t||{}})},png:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Te(),Ce));return n(r,{...e,...t||{},format:`png`})},jpeg:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Te(),Ce));return n(r,{...e,...t||{},format:`jpeg`})},webp:async(e,t)=>{let{rasterize:n}=await Promise.resolve().then(()=>(Te(),Ce));return n(r,{...e,...t||{},format:`webp`})},download:async(e,t)=>{let{download:n}=await Promise.resolve().then(()=>(Fe(),Me));return n(r,{...e,...t||{}})}},a={};for(let e of[`img`,`svg`,`canvas`,`blob`,`png`,`jpeg`,`webp`])a[e]=async n=>i[e](t,{...n||{},[Zr]:!0});a.jpg=a.jpeg;let o=await lr(`defineExports`,{...t,export:{url:r},exports:a}),s=Object.assign({},...o.filter(e=>e&&typeof e==`object`).reverse()),c={...i,...s};c.jpeg&&!c.jpg&&(c.jpg=(e,t)=>c.jpeg(e,t));function l(e,n){let r={...t,...n||{}};return(e===`jpeg`||e===`jpg`)&&(r.backgroundColor==null||r.backgroundColor===`transparent`)&&(r.backgroundColor=`#ffffff`),r}let u=!1,d=Promise.resolve();async function f(e,n){return d=d.then(async()=>{let i=c[e];if(!i)throw Error(`[snapdom] Unknown export type: ${e}`);let a=l(e,n),o={...t,export:{type:e,options:a,url:r}};await X(`beforeExport`,o);let s=await i(o,a);return await X(`afterExport`,o,s),u||(u=!0,await X(`afterSnap`,t)),s})}let p={url:r,toRaw:()=>r,to:(e,t)=>f(e,t),toImg:e=>f(`img`,e),toSvg:e=>f(`svg`,e),toCanvas:e=>f(`canvas`,e),toBlob:e=>f(`blob`,e),toPng:e=>f(`png`,e),toJpg:e=>f(`jpg`,e),toWebp:e=>f(`webp`,e),download:e=>f(`download`,e)};for(let e of Object.keys(c)){let t=`to`+e.charAt(0).toUpperCase()+e.slice(1);p[t]||(p[t]=t=>f(e,t))}return p},$.toRaw=(e,t)=>$(e,t).then(e=>e.toRaw()),$.toImg=(e,t)=>$(e,t).then(e=>e.toImg()),$.toSvg=(e,t)=>$(e,t).then(e=>e.toSvg()),$.toCanvas=(e,t)=>$(e,t).then(e=>e.toCanvas()),$.toBlob=(e,t)=>$(e,t).then(e=>e.toBlob()),$.toPng=(e,t)=>$(e,{...t,format:`png`}).then(e=>e.toPng()),$.toJpg=(e,t)=>$(e,{...t,format:`jpeg`}).then(e=>e.toJpg()),$.toWebp=(e,t)=>$(e,{...t,format:`webp`}).then(e=>e.toWebp()),$.download=(e,t)=>$(e,t).then(e=>e.download());async function ei(e,t){if(Qr)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await Kr(e,n)}catch(e){z(t,`safariWarmup pre-capture failed`,e)}await new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),r&&await new Promise(e=>{let n=new Image;try{n.decoding=`sync`,n.loading=`eager`}catch(e){z(t,`safariWarmup img hints failed`,e)}n.style.cssText=`position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;`,n.src=r,document.body.appendChild(n),(async()=>{try{typeof n.decode==`function`&&await n.decode()}catch(e){z(t,`safariWarmup img.decode failed`,e)}let r=performance.now();for(;!(n.complete&&n.naturalWidth>0)&&performance.now()-r<900;)await new Promise(e=>setTimeout(e,200));await new Promise(e=>requestAnimationFrame(e));try{let e=document.createElement(`canvas`);e.width=Math.max(1,n.naturalWidth||10),e.height=Math.max(1,n.naturalHeight||10);let t=e.getContext(`2d`);t&&t.drawImage(n,0,0)}catch{}await new Promise(e=>requestAnimationFrame(e));try{n.remove()}catch(e){z(t,`safariWarmup img.remove failed`,e)}e()})()}),e.querySelectorAll(`canvas`).forEach(e=>{try{let t=e.getContext(`2d`,{willReadFrequently:!0});t&&t.getImageData(0,0,1,1)}catch(e){z(t,`safariWarmup canvas poke failed`,e)}}),Qr=!0}function ti(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let e=t.currentNode,n=getComputedStyle(e),r=n.backgroundImage&&n.backgroundImage!==`none`,i=n.maskImage&&n.maskImage!==`none`||n.webkitMaskImage&&n.webkitMaskImage!==`none`;if(r||i||e.tagName===`CANVAS`)return!0}return!1}export{$ as snapdom};
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod/v4/mini";
2
2
 
3
- //#region ../validators/src/questions/routing.d.ts
4
-
3
+ //#region ../validators/dist/questions/routing.d.ts
5
4
  declare const binaryOperatorConditionSchema: z.ZodMiniObject<{
6
5
  type: z.ZodMiniLiteral<"binary-operator">;
7
6
  operator: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"equal">, z.ZodMiniLiteral<"not-equal">, z.ZodMiniLiteral<"greater">, z.ZodMiniLiteral<"greater-or-equal">, z.ZodMiniLiteral<"less">, z.ZodMiniLiteral<"less-or-equal">, z.ZodMiniLiteral<"contains">, z.ZodMiniLiteral<"not-contains">]>;
@@ -20,7 +19,7 @@ declare const binaryOperatorConditionSchema: z.ZodMiniObject<{
20
19
  }, z.core.$strip>;
21
20
  type BinaryOperatorCondition = z.infer<typeof binaryOperatorConditionSchema>;
22
21
  //#endregion
23
- //#region ../validators/src/questions/properties.d.ts
22
+ //#region ../validators/dist/questions/properties.d.ts
24
23
  declare const ratingQuestionPropertiesSchema: z.ZodMiniObject<{
25
24
  type: z.ZodMiniLiteral<"rating">;
26
25
  buttonLabel: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -78,7 +77,7 @@ declare const statementQuestionPropertiesSchema: z.ZodMiniObject<{
78
77
  }, z.core.$strip>;
79
78
  type StatementQuestionProperties = z.infer<typeof statementQuestionPropertiesSchema>;
80
79
  //#endregion
81
- //#region ../validators/src/questions/answers.d.ts
80
+ //#region ../validators/dist/questions/answers.d.ts
82
81
  declare const bugReportAnswerSchema: z.ZodMiniObject<{
83
82
  title: z.ZodMiniString<string>;
84
83
  description: z.ZodMiniOptional<z.ZodMiniString<string>>;
@@ -130,7 +129,7 @@ declare const multiSelectAnswerSchemaFactory: ({
130
129
  }) => z.ZodMiniArray<z.ZodMiniString<string>>;
131
130
  type MultiSelectAnswer = z.infer<ReturnType<typeof multiSelectAnswerSchemaFactory>>;
132
131
  //#endregion
133
- //#region ../validators/src/survey.d.ts
132
+ //#region ../validators/dist/survey.d.ts
134
133
  declare const publicGetSurveyOutputSchema: z.ZodMiniObject<{
135
134
  title: z.ZodMiniString<string>;
136
135
  description: z.ZodMiniNullable<z.ZodMiniString<string>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/confetti",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "sideEffects": false,
5
5
  "description": "Widgets for Confetti",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -30,7 +30,8 @@
30
30
  "files": [
31
31
  "./build/**/*.d.ts",
32
32
  "./build/**/*.js",
33
- "./build/**/*.css"
33
+ "./build/**/*.css",
34
+ "!./build/script/**"
34
35
  ],
35
36
  "browserslist": [
36
37
  "defaults",
@@ -54,15 +55,17 @@
54
55
  "devDependencies": {
55
56
  "@csstools/postcss-minify": "^3.0.0",
56
57
  "@rrweb/types": "2.0.0-alpha.20",
57
- "@types/react": "^19.2.14",
58
+ "@types/node": "24.10.8",
59
+ "@types/react": "^19.2.15",
60
+ "dotenv-cli": "^11.0.0",
58
61
  "esbuild": "^0.27.2",
59
62
  "eslint": "^9.39.2",
60
- "postcss": "^8.5.9",
63
+ "postcss": "^8.5.10",
61
64
  "postcss-cli": "^11.0.1",
62
65
  "postcss-preset-env": "^11.2.1",
63
66
  "prettier": "^3.7.4",
64
67
  "react-aria-components": "1.16.0",
65
- "tsdown": "0.19.0",
68
+ "tsdown": "0.22.1",
66
69
  "typescript": "^5.9.3",
67
70
  "@confetti/eslint-config": "0.0.0",
68
71
  "@confetti/tsconfig": "0.0.0",
@@ -72,11 +75,14 @@
72
75
  "prettier": "@confetti/prettier-config",
73
76
  "scripts": {
74
77
  "build:css": "postcss ./src/confetti.css -o ./build/confetti.css",
75
- "build": "tsdown && pnpm run build:css",
78
+ "build:package": "tsdown -F package && pnpm run build:css",
79
+ "build:script": "pnpm with-env tsdown -F script && mv ./build/script/stable.iife.js ./build/script/stable.js && pnpm run build:css && cp ./build/confetti.css ./build/script/stable.css",
80
+ "build": "pnpm run build:package && pnpm run build:script",
76
81
  "clean": "git clean -xdf .cache .turbo dist node_modules",
77
82
  "dev": "tsc",
78
83
  "format": "prettier --check . --ignore-path ../../.gitignore",
79
84
  "lint": "eslint",
80
- "typecheck": "tsc --noEmit --emitDeclarationOnly false"
85
+ "typecheck": "tsc --noEmit --emitDeclarationOnly false",
86
+ "with-env": "dotenv -e ../../.env --"
81
87
  }
82
88
  }