var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},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(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.measureHints=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.compress=new a(50),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),compress:new a(50),computedStyle:new WeakMap,measureHints:new WeakMap,burstAdvice:new WeakMap,warnedReconcile:!1,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,t=1){let n=e.match(/^\s*-?(?:webkit-)?image-set\(([\s\S]*)\)\s*$/i);if(!n)return null;let r=[];for(let e of n[1].split(`,`)){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)continue;let n=e.match(/type\(\s*["']([^"']+)["']\s*\)/i);if(n&&!p.test(n[1].trim()))continue;let i=e.match(/(\d+(?:\.\d+)?)\s*(x|dpi|dppx)/i),a=1;if(i){let e=parseFloat(i[1]);a=/dpi/i.test(i[2])?e/96:e}r.push({url:t[2].trim(),dppx:a})}return r.length?(r.sort((e,t)=>e.dppx-t.dppx),(r.find(e=>e.dppx>=t)||r[r.length-1]).url):null}function u(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 d(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function f(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 p,m=t(()=>{p=/^image\/(jpeg|jpg|png|gif|webp|avif|apng|svg\+xml|bmp|x-icon|vnd\.microsoft\.icon)\s*(;|$)/i});function h(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 g(e){return/^data:|^blob:|^about:blank$/i.test(e)}function _(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 v(e,t){if(!t||g(e)||_(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 y(e,t){return t?t.includes(`{url}`)?t.replace(`{urlRaw}`,d(e)).replace(`{url}`,encodeURIComponent(e)):/[?&]url=?$/.test(t)?`${t}${encodeURIComponent(e)}`:t.endsWith(`?`)?`${t}url=${encodeURIComponent(e)}`:t.endsWith(`/`)?`${t}${d(e)}`:`${t}${t.includes(`?`)?`&`:`?`}url=${encodeURIComponent(e)}`:e}function b(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 x(e,t){return[t.as||`blob`,t.timeout??3e3,t.useProxy||``,t.errorTTL??8e3,e].join(`|`)}async function S(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 b(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=x(e,{as:n,timeout:r,useProxy:i,errorTTL:a}),l=T.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&T.delete(c);let u=w.get(c);if(u)return u;let d=v(e,i)?y(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&&T.set(c,{until:Date.now()+a,result:i}),!s){let t=`${r.status} ${r.statusText||``}`.trim();C.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 b(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&&T.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`;C.errorOnce(t,i)}return t.onError&&t.onError(l),l}finally{clearTimeout(m),w.delete(c)}})();return w.set(c,h),h}var C,w,T,E=t(()=>{m(),C=h(`[snapDOM]`,{ttlMs:3*6e4,maxEntries:10}),w=new Map,T=new Map});async function D(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()===`none`)return e;let n=l(e,typeof devicePixelRatio<`u`&&devicePixelRatio||1)??c(e);if(!n)return e;let r=d(f(n)),i=(t.useProxy||``)+`|`+r;if(o.background.has(i)){let e=o.background.get(i);return e?`url("${e}")`:`none`}try{let e=await S(r,{as:`dataURL`,useProxy:t.useProxy});return e.ok?(o.background.set(i,e.data),`url("${e.data}")`):(o.background.set(i,null),`none`)}catch{return o.background.set(i,null),`none`}}var O=t(()=>{s(),m(),E()});function k(e){if(e=String(e).toLowerCase(),ie.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)A(e)||(i[e]=r.getPropertyValue(e));return t.removeChild(n),o.defaultStyle.set(e,i),i}function A(e){let t=z.get(e);if(t===void 0){let n=String(e).toLowerCase();t=R.has(n)||L.test(n)||ae.test(n),z.set(e,t)}return t}function j(e,t){return!ce.has(e)&&(t===`inline`||oe.has(e)||se.has(e))}function M(e,t,n=!0,r=!1){if(t=String(t||``).toLowerCase(),ie.has(t))return``;let i=[],a=k(t),o=(e.display||``).toLowerCase(),s=o===`inline`,c=j(t,o),l=e[`text-wrap-mode`]||e[`white-space`]||``,u=c&&n&&!s&&(l===`nowrap`||l===`pre`),d=c&&n&&!u,f=!1;for(let t in e){if(A(t))continue;let n=e[t];if(d){if(le.has(t))continue;if(ue.has(t)){n&&n!==a[t]&&(i.push(`${t}:${n}`),n!==`auto`&&(f=!0));continue}}if(n&&n!==a[t]){if(!u&&(t===`width`||t===`inline-size`)&&n.endsWith(`px`)&&n.includes(`.`)){let e=parseFloat(n);if(Number.isFinite(e)){i.push(`${t}:${Math.ceil(e*16)/16}px`);continue}}i.push(`${t}:${n}`)}}if(d&&!s&&!r&&!f){let t=e.width;t&&t!==`auto`&&t!==a.width&&i.push(`min-width:${t}`)}return i.sort(),i.join(`;`)}function N(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 P(e){let t=new Map;for(let n of e){let e=k(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} } `;return n}function ee(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 F(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{let e={length:0,getPropertyValue:()=>``,item:()=>``};return e[Symbol.iterator]=function*(){},e};if(e?.nodeType!==1){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=F(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 te(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);for(let e of de){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 ne(e){let t=[],n=0,r=0;for(let i=0;i{s(),re=new Set([`meta`,`script`,`noscript`,`title`,`link`,`template`]),ie=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`]),ae=/(?:^|-)(animation|transition)(?:-|$)/i,L=/^(--.+|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,R=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`,`stroke-color`]),z=new Map,oe=new Set([`span`,`small`,`em`,`strong`,`b`,`i`,`u`,`s`,`code`,`cite`,`mark`,`sub`,`sup`]),se=new Set([`table`,`thead`,`tbody`,`tfoot`,`tr`,`td`,`th`]),ce=new Set([`img`,`video`,`canvas`,`svg`,`iframe`,`embed`,`object`,`input`,`textarea`,`select`]),le=new Set([`width`,`max-width`,`inline-size`,`max-inline-size`]),ue=new Set([`min-width`,`min-inline-size`]),de=[`top`,`right`,`bottom`,`left`]});function fe(e,{fast:t=!1}={}){if(t)return e();`requestIdleCallback`in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function pe(){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 V(){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 me(){if(typeof navigator>`u`)return!1;let e=(navigator.userAgent||``).toLowerCase();return e.includes(`firefox`)||e.includes(`fxios`)}var H=t(()=>{});function U(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 he=t(()=>{}),W=t(()=>{O(),B(),H(),m(),he()}),ge={};n(ge,{decodeSvgFromDataURL:()=>ye,encodeSvgToDataURL:()=>xe,fixSafariShadows:()=>Ae,toCanvas:()=>Me});function _e(e){try{let t=e.match(/]*>/i);if(!t)return e;let n=t[0],r=parseFloat((n.match(/\bwidth="([\d.]+)/i)||[])[1]),i=parseFloat((n.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(r)||!Number.isFinite(i)||r<=0||i<=0)return e;let a=Math.min(1,G/r,G/i,Math.sqrt(Ne/(r*i)));if(a>=1)return e;let o=Math.max(1,Math.floor(r*a)),s=Math.max(1,Math.floor(i*a));return console.warn(`[snapDOM] Capture ${Math.round(r)}\xD7${Math.round(i)}px exceeds the browser image-decode limit (${G}px/side); downscaling to ${o}\xD7${s}px. Lower \`scale\` or set \`width\`/\`height\` to control output size.`),e.replace(n,n.replace(/(\bwidth=")[\d.]+/i,`$1${o}`).replace(/(\bheight=")[\d.]+/i,`$1${s}`))}catch{return e}}function ve(e){return typeof e==`string`&&/^data:image\/svg\+xml/i.test(e)}function ye(e){let t=e.indexOf(`,`);return t>=0?decodeURIComponent(e.slice(t+1)):``}function be(e){let t=e.indexOf(`,`);if(t<0)return``;let n=e.slice(t+1,t+1201).replace(/%[0-9A-Fa-f]?$/,``);try{return decodeURIComponent(n)}catch{return``}}function xe(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function Se(e){let t=[],n=``,r=0;for(let i=0;ie.trim()).filter(Boolean)}function Ce(e){let t=[],n=``,r=0;for(let i=0;i`${e}:${t}`).join(`;`)}function Te(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,n)=>`${t}{${we(n)}}`)}function Ee(e){return e=e.replace(/]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,Te(t))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,n)=>`style=${t}${we(n)}${t}`),e}function De(){return Pe||(Pe=(async()=>{try{let e=new Image;e.decoding=`sync`,e.src=`data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%2220%22%3E%3CforeignObject%20width%3D%228%22%20height%3D%2220%22%3E%3Cdiv%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%20style%3D%22width%3A4px%3Bheight%3A4px%3Bmargin-top%3A8px%3Bbackground%3A%23000%3Bbox-shadow%3A0%208px%200%200%20%23000%22%3E%3C%2Fdiv%3E%3C%2FforeignObject%3E%3C%2Fsvg%3E`,await e.decode();let t=document.createElement(`canvas`);t.width=8,t.height=20;let n=t.getContext(`2d`,{willReadFrequently:!0});n.drawImage(e,0,0);let r=n.getImageData(2,18,1,1).data[3]>128,i=n.getImageData(2,2,1,1).data[3]>128;return{native:r||i,flippedY:i&&!r}}catch{return{native:!1,flippedY:!1}}})(),Pe)}function Oe(e){let t=[],n=0,r=0;for(let i=0;i{let t=0,n=0,r=``,i=0;for(;iSe(e).map(e=>{let n=e.indexOf(`:`);if(n<0)return e;let r=e.slice(0,n).trim().toLowerCase();return r===`text-shadow`||t&&r===`box-shadow`?`${r}:${Oe(e.slice(n+1))}`:e}).join(`;`);return e=e.replace(/]*>([\s\S]*?)<\/style>/gi,(e,t)=>e.replace(t,t.replace(/([^{}]+)\{([^}]*)\}/g,(e,t,r)=>`${t}{${n(r)}}`))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(e,t,r)=>`style=${t}${n(r)}${t}`),e}async function Ae(e){if(!/(?:box-shadow|text-shadow)\s*:[^;"}]*px/i.test(e))return{svg:e,naturalOnly:!1};let{native:t,flippedY:n}=await De();try{let r=e;return t||(r=Ee(r)),n&&(r=ke(r,t)),{svg:r,naturalOnly:!0}}catch{return{svg:e,naturalOnly:!0}}}async function je(e,t){e.setAttribute(`data-snapdom-internal`,``),e.style.cssText=`position:fixed;left:-99999px;top:-99999px;pointer-events:none`,document.body.appendChild(e);try{let n=document.createElement(`canvas`);n.width=16,n.height=16;let r=()=>new Promise(e=>{requestAnimationFrame(e),setTimeout(e,50)}),i=n.getContext(`2d`,{willReadFrequently:!0});if(!i){await r(),await r();return}let a=performance.now()+(t?600:150);for(;;){i.clearRect(0,0,16,16);try{i.drawImage(e,0,0,16,16)}catch{return}let t=i.getImageData(0,0,16,16).data,n=!1;for(let e=3;e0){n=!0;break}if(n||performance.now()>a)return;await r()}}finally{try{e.remove()}catch{}}}async function Me(e,t){let{width:n,height:r,scale:i=1,dpr:a=1,meta:o={},backgroundColor:s}=t,c=e,l=!1,u=!1;if(ve(e)){let t=(be(e).match(/]*>/i)||[])[0]||``,n=parseFloat((t.match(/\bwidth="([\d.]+)/i)||[])[1]),r=parseFloat((t.match(/\bheight="([\d.]+)/i)||[])[1]),i=Number.isFinite(n)&&Number.isFinite(r)&&n>0&&r>0&&Math.min(1,G/n,G/r,Math.sqrt(Ne/(n*r)))<1;if(i||V())try{let t=ye(e);if(V()){let e=await Ae(t);t=e.svg,l=e.naturalOnly,u=/@font-face|data:image\//i.test(t)}i&&(t=_e(t)),c=xe(t)}catch{c=e}}let d=new Image;d.loading=`eager`,d.decoding=`sync`,d.crossOrigin=`anonymous`,d.src=c,await d.decode(),V()&&await je(d,u);let f=d.naturalWidth,p=d.naturalHeight,m=Number.isFinite(o.vbW)?o.vbW:Number.isFinite(o.w0)?o.w0:f,h=Number.isFinite(o.vbH)?o.vbH:Number.isFinite(o.h0)?o.h0:p,g,_,v=Number.isFinite(n),y=Number.isFinite(r);if(v&&y)g=Math.max(1,n),_=Math.max(1,r);else if(v){let e=n/Math.max(1,m);g=n,_=h*e}else if(y){let e=r/Math.max(1,h);_=r,g=m*e}else g=f,_=p;g*=i,_*=i;let b=g*a,x=_*a,S=Math.max(b/G,x/G,Math.sqrt(b*x/Ne));S>1&&(console.warn(`[snapDOM] Output ${Math.round(b)}\xD7${Math.round(x)}px exceeds the browser canvas limit (${G}px/side); downscaling. Lower \`scale\`/\`dpr\` or set \`width\`/\`height\`.`),g/=S,_/=S);let C=document.createElement(`canvas`);C.width=g*a,C.height=_*a,C.style.width=`${g}px`,C.style.height=`${_}px`;let w=C.getContext(`2d`);if(a!==1&&w.scale(a,a),s&&(w.save(),w.fillStyle=s,w.fillRect(0,0,g,_),w.restore()),l&&(Math.round(g*a)!==f||Math.round(_*a)!==p)){let e=document.createElement(`canvas`);e.width=f,e.height=p,e.getContext(`2d`).drawImage(d,0,0),w.drawImage(e,0,0,g,_)}else w.drawImage(d,0,0,g,_);return C}var G,Ne,Pe,Fe=t(()=>{H(),G=16384,Ne=16384*16384,Pe=null}),Ie={};n(Ie,{rasterize:()=>Le});async function Le(e,t){let n=await Me(e,t),r=await new Promise(e=>{let r=()=>e(n.toDataURL(`image/${t.format}`,t.quality));try{n.toBlob(t=>{if(!t)return r();let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.onerror=r,n.readAsDataURL(t)},`image/${t.format}`,t.quality)}catch{r()}}),i=new Image;return i.src=r,await i.decode(),i.style.width=`${n.width/t.dpr}px`,i.style.height=`${n.height/t.dpr}px`,i}var Re=t(()=>{Fe()}),ze={};n(ze,{toImg:()=>Be,toSvg:()=>Be});async function Be(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(V()&&c)try{let{svg:t}=await Ae(ye(e)),c=(t.match(/]*>/i)||[])[0]||``,l=parseFloat((c.match(/\bwidth="([\d.]+)/i)||[])[1]),u=parseFloat((c.match(/\bheight="([\d.]+)/i)||[])[1]);if(!Number.isFinite(l)||!Number.isFinite(u))throw Error(`svg without dimensions`);let d=Number.isFinite(a.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:l,f=Number.isFinite(a.vbH)?a.vbH:Number.isFinite(a.h0)?a.h0:u,p,m;o&&s?(p=r,m=i):o?(p=r,m=Math.round(r/Math.max(1,d)*f)):s?(m=i,p=Math.round(i/Math.max(1,f)*d)):(p=Math.round(l*n),m=Math.round(u*n));let h=t.replace(/width="[^"]*"/,`width="${p}"`).replace(/height="[^"]*"/,`height="${m}"`),g=new Image;return g.decoding=`sync`,g.loading=`eager`,g.src=xe(h),await g.decode(),g.style.width=`${p}px`,g.style.height=`${m}px`,g}catch(n){return U(t,`safari vector toImg failed, falling back to PNG`,n),Le(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.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.vbH)?a.vbH: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.vbW)?a.vbW:Number.isFinite(a.w0)?a.w0:l.naturalWidth,t=Number.isFinite(a.vbH)?a.vbH: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){U(t,`SVG width/height patch in toImg failed`,e)}}return l}var Ve=t(()=>{W(),Re(),Fe()}),He={};n(He,{toBlob:()=>Ue});async function Ue(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 Me(e,t);return new Promise(e=>r.toBlob(t=>e(t),`image/${n}`,t.quality))}var We=t(()=>{Fe()}),Ge={};n(Ge,{download:()=>qe});async function Ke(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 qe(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=pe();if(o===`svg`){let t=await Ue(e,{...c,type:`svg`});if(l&&await Ke(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 Me(e,c);if(l){let e=`image/${o}`,n=await new Promise(n=>u.toBlob(n,e,t?.quality));if(n&&await Ke(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 Je=t(()=>{We(),Fe(),H()});W(),W(),s();var Ye=new WeakMap,Xe=new Map,Ze=2e3,Qe=0;function $e(){Qe++,Xe.size>Ze&&Xe.clear()}var et=`[data-snapdom-sandbox],[data-snapdom-internal],[data-snapdom]`;function tt(e){let t=e&&(e.nodeType===1?e:e.parentElement);return!!(t&&t.closest&&t.closest(et))}function nt(e){for(let t of e)if(!tt(t.target)){if(t.type===`childList`){let e=!0;for(let n of t.addedNodes)if(!tt(n)){e=!1;break}if(e){for(let n of t.removedNodes)if(!tt(n)){e=!1;break}}if(e)continue}return!0}return!1}var rt=!1;function it(e=document.documentElement){if(rt)return;rt=!0;let t=e=>{nt(e)&&$e()};try{new MutationObserver(t).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(t).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.(`loadingdone`,$e),e.ready?.then(()=>$e()).catch(()=>{}))}catch{}}var at=[`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`];function ot(e){let t=Ye.get(e);if(t&&t.epoch===Qe){let e=t.snapshot&&t.snapshot.__needsBgInline;if(e!==void 0)return e}return!0}function st(e,t={}){let n={},r=e.getPropertyValue(`visibility`),i=t.excludeStyleProps;for(let t=0;te[0]t[0])).map(([e,t])=>`${e}:${t}`).join(`;`),lt.set(e,t),t)}function dt(e,t=null,n={}){let r=Ye.get(e),i=!!(n&&n.embedFonts),a=n&&n.excludeStyleProps||null;if(r&&r.epoch===Qe&&r.embedFonts===i&&r.excludeStyleProps===a)return r.snapshot;let o=t||getComputedStyle(e),s=st(o,n);return vt(e,o,s),Ye.set(e,{epoch:Qe,snapshot:s,embedFonts:i,excludeStyleProps:a}),s}function ft(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:Xe,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:Xe,defaultStyle:o.defaultStyle,baseStyle:o.baseStyle,image:o.image,resource:o.resource,background:o.background,font:o.font},options:e||t||{}}}function pt(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||`visible`)!==`visible`}function gt(e){let t=e.parentElement;if(!t)return!1;let n=I(t).display||``;return n.includes(`flex`)||n.includes(`grid`)}function _t(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType===3&&/\S/.test(t.nodeValue))return!0;let t=e.firstElementChild,n=e.lastElementChild;if(t&&t.tagName===`BR`||n&&n.tagName===`BR`)return!0;for(let t=e.firstElementChild;t;t=t.nextElementSibling){let e=I(t);if(e.display===`none`)continue;let n=e.position;if(n!==`absolute`&&n!==`fixed`)return!0}return!1}function vt(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`)||mt(e))return;let o=t.position;if(o===`absolute`||o===`fixed`||o===`sticky`||t.transform!==`none`||ht(t)||gt(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`||_t(e)&&(delete n.height,delete n[`block-size`])}B();var yt=[`fill`,`stroke`,`color`,`background-color`,`stop-color`],bt=new Set([`symbol`,`defs`,`pattern`,`marker`,`linearGradient`,`radialGradient`,`filter`]);function xt(e){let t=e;for(;t&&t.nodeType===1;){if(t.namespaceURI===`http://www.w3.org/2000/svg`){if(t.localName===`mask`||t.localName===`clipPath`)return!1;if(bt.has(t.localName))return!0}t=t.parentNode}return!1}var St=new Map;function Ct(e,t){let n=t+`::`+e.toLowerCase(),r=St.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.setAttribute(`data-snapdom-internal`,``),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 yt)c[e]=s.getPropertyValue(e)||``;return o.remove(),St.set(n,c),c}function wt(e,t){if(e?.nodeType!==1||t?.nodeType!==1||xt(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;ee.d-t.d);let i=window.devicePixelRatio||1;return(r.find(e=>e.d>=i)||r[r.length-1]).url}function kt(e,t){let n=e.currentSrc||``;if(n&&!q(n))return n;let r=t.querySelectorAll(`source[srcset]`),i=null;for(let t of r){let n=t.getAttribute(`srcset`);if(!n||q(n))continue;let r=t.getAttribute(`type`);if(r&&!Dt.test(r.trim()))continue;let a=t.getAttribute(`media`);if(a)try{if(window.matchMedia(a).matches)return Ot(n,e)}catch{}i||(i=Ot(n,e))}return i}function At(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&&!q(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&&!q(e))return e}return null}function jt(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 Mt(e,t={}){if(!e||e?.nodeType!==1||t.resolvePicturePlaceholders===!1)return null;let{timeout:n,concurrency:r,resolveLazySrc:i,silent:a,useProxy:o}=jt(t);if(!Et(e,i))return null;let s=[],c=[];async function l(e){let t=await S(e,{as:`dataURL`,timeout:n,useProxy:o,silent:!0});return t.ok?t.data:null}async function u(e){for(let t=0;te()))}}let d=Array.from(e.querySelectorAll(`picture`));e.matches?.(`picture`)&&d.unshift(e);for(let e of d){let t=e.querySelector(`img`);if(!t||!q(t.getAttribute(`src`)||``))continue;let n=kt(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=Array.from(e.querySelectorAll(`img`));e.localName===`img`&&t.unshift(e);for(let e of t){if(e.closest(`picture`)&&q(e.getAttribute(`src`)||``))continue;let t=e.getAttribute(`src`)||``,n=At(e);n&&q(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{}})}function Nt(e,t,n){return n?Promise.all(e.map(e=>new Promise(n=>t(e,n)))):Promise.all(e.map(e=>new Promise(r=>{function i(){fe(n=>{!(n&&typeof n.timeRemaining==`function`)||n.timeRemaining()>0?t(e,r):i()},{fast:n})}i()})))}function Pt(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Ft(e,t,n=!0){return e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>e.startsWith(`:where(`)||e.startsWith(`@`)?e:`:where(${t} ${n?Pt(e):e})`).join(`, `)}function It(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}${Ft(i,t,!0)}{`),e):``}function Lt(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Rt(e){let t=``;try{e.querySelectorAll(`style`).forEach(e=>{t+=(e.textContent||``)+` `});let n=e.adoptedStyleSheets||[];for(let e of n)try{if(e&&e.cssRules)for(let n of e.cssRules)t+=n.cssText+` `}catch{}}catch{}return t}function zt(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 Bt(e,t){try{let n=null,r=I(e).content;if(r&&r.includes(`url(`)){let e=r.match(/url\(["']?([^"')]+)["']?\)/);e&&(n=e[1])}let i=e.closest?.(`picture`),a=n||(i?kt(e,i):e.currentSrc)||e.src||Ot(e.getAttribute(`srcset`),e)||``;if(!a)return;t.setAttribute(`src`,a),t.removeAttribute(`srcset`),t.removeAttribute(`sizes`),t.loading=`eager`,t.decoding=`sync`}catch{}}function Vt(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 Ht(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 Ut(e,t,n){let r=[];for(let n of t){let t=Ht(e,n);t&&r.push(`${n}: ${t};`)}return r.length?`${n}{${r.join(``)}} `:``}function Wt(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 Gt(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;isetTimeout(e,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function Kt(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 J(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 qt(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=0,d=0,f=0,p=0;try{let t=r&&e.body?r.getComputedStyle(e.body):null;t&&(u=(parseFloat(t.marginTop)||0)+(parseFloat(t.paddingTop)||0),d=(parseFloat(t.marginRight)||0)+(parseFloat(t.paddingRight)||0),f=(parseFloat(t.marginBottom)||0)+(parseFloat(t.paddingBottom)||0),p=(parseFloat(t.marginLeft)||0)+(parseFloat(t.paddingLeft)||0))}catch{}try{e.documentElement.setAttribute(`data-sd-pinned`,``)}catch{}let m=e.createElement(`style`);return m.setAttribute(`data-sd-iframe-pin`,``),m.textContent=`html {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;}body {margin: 0 !important;padding: ${u}px ${d}px ${f}px ${p}px !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(m),()=>{try{m.remove()}catch{}try{e.documentElement.removeAttribute(`data-sd-pinned`)}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 Jt(e,t,n){let r=await Gt(e,3);if(!r)throw Error(`iframe document not accessible/ready`);let{contentWidth:i,contentHeight:a,rect:s}=Kt(e),c=n?.snap;if(!c&&typeof window<`u`&&window.snapdom&&(c=window.snapdom),!c||typeof c.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 l={...n,scale:1,clip:null},u=qt(r,i,a),d=o.session.nodeMap,f=o.session.styleMap,p=o.session.styleCache,m;try{m=await c.toPng(r.documentElement,l)}finally{u(),o.session.nodeMap=d,o.session.styleMap=f,o.session.styleCache=p}m.style.display=`block`,m.style.width=`${i}px`,m.style.height=`${a}px`;let h=document.createElement(`div`);return t.nodeMap.set(h,e),K(e,h,t,n),h.style.overflow=`hidden`,h.style.display=`block`,h.style.width||(h.style.width=`${Math.round(s.width)}px`),h.style.height||(h.style.height=`${Math.round(s.height)}px`),h.appendChild(m),h}function Yt(e){let{width:t,height:n}=J(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 Xt=new a(80);async function Zt(e){if(o.resource?.has(e))return o.resource.get(e);if(Xt.has(e))return Xt.get(e);let t=(async()=>{let t=await S(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})();Xt.set(e,t);try{let n=await t;return Xt.set(e,n),n}catch(t){throw Xt.delete(e),t}}var Qt=/\bblob:[^)"'\s]+/g;async function $t(e){if(!e||e.indexOf(`blob:`)===-1)return e;let t=Array.from(new Set(e.match(Qt)||[]));if(t.length===0)return e;let n=e;for(let e of t)try{let t=await Zt(e);n=n.split(e).join(t)}catch{}return n}function en(e){return typeof e==`string`&&e.startsWith(`blob:`)}function tn(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 nn(e){return e.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(`, `)}function rn(e,t){let n=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&n.unshift(e),n}async function an(e,t=null){if(!e)return;let n=t,r=rn(e,`img`);for(let e of r)try{let t=e.getAttribute(`src`)||e.currentSrc||``;if(en(t)){let n=await Zt(t);e.setAttribute(`src`,n)}let r=e.getAttribute(`srcset`);if(r&&r.includes(`blob:`)){let t=tn(r),i=!1;for(let e of t)if(en(e.url))try{e.url=await Zt(e.url),i=!0}catch(e){U(n,`blobUrlToDataUrl for srcset item failed`,e)}i&&e.setAttribute(`srcset`,nn(t))}}catch(e){U(n,`resolveBlobUrls for img failed`,e)}let i=rn(e,`image`);for(let e of i)try{let t=`http://www.w3.org/1999/xlink`,n=e.getAttribute(`href`)||e.getAttributeNS?.(t,`href`);if(en(n)){let r=await Zt(n);e.setAttribute(`href`,r),e.removeAttributeNS?.(t,`href`)}}catch(e){U(n,`resolveBlobUrls for SVG image href failed`,e)}let a=rn(e,`[style*='blob:']`);for(let e of a)try{let t=e.getAttribute(`style`);if(t&&t.includes(`blob:`)){let n=await $t(t);e.setAttribute(`style`,n)}}catch(e){U(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 $t(t))}catch(e){U(n,`replaceBlobUrls in style tag failed`,e)}for(let t of[`poster`]){let r=rn(e,`[${t}^='blob:']`);for(let e of r)try{let n=e.getAttribute(t);en(n)&&e.setAttribute(t,await Zt(n))}catch(e){U(n,`resolveBlobUrls for ${t} failed`,e)}}}H();var on=new Map,sn=new Set([`IFRAME`]);function cn(e,t){on.set(String(e).toUpperCase(),t)}function ln(e){let{width:t,height:n}=J(e),r=t,i=n;if(!r||!i){let t=e.getBoundingClientRect();r=r||t.width||0,i=i||t.height||0}let a=document.createElement(`div`);return a.style.cssText=`display:inline-block;width:${r}px;height:${i}px;visibility:hidden;`,a}var un=200,dn=new Set([`img`,`canvas`,`video`,`iframe`,`object`,`embed`]);function fn(e,t){return e.right>=t.left-un&&e.left<=t.right+un&&e.bottom>=t.top-un&&e.top<=t.bottom+un}function pn(e,t){if(e===t.root)return!1;let n;try{n=e.getBoundingClientRect()}catch{return!1}if(n.width===0&&n.height===0)return!1;let r=I(e);if(r.display===`inline`&&!dn.has((e.localName||``).toLowerCase()))return!1;let i=t.rect,a=e.scrollWidth||0,o=e.scrollHeight||0,s={left:r.direction===`rtl`?Math.min(n.left,n.right-a):n.left,top:n.top,right:Math.max(n.right,n.left+a),bottom:Math.max(n.bottom,n.top+o)},c=r.writingMode||``;if((c.startsWith(`vertical`)||c.startsWith(`sideways`))&&(s.top=Math.min(n.top,n.bottom-o),s.left=Math.min(s.left,n.right-a)),fn(s,i))return!1;let l=(e.ownerDocument||document).createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;l.nextNode();){let e=l.currentNode.getBoundingClientRect();if((e.width>0||e.height>0)&&fn(e,i))return!1}return!0}function mn(e,t,n){let r=e.cloneNode(!1);e.tagName===`IMG`&&(r.removeAttribute(`src`),r.removeAttribute(`srcset`),r.removeAttribute(`sizes`)),K(e,r,t,n);let{width:i,height:a}=J(e);return i>0&&(r.style.width=`${i}px`,r.style.minWidth=`${i}px`,r.style.maxWidth=`${i}px`),a>0&&(r.style.height=`${a}px`,r.style.minHeight=`${a}px`,r.style.maxHeight=`${a}px`),r.style.visibility=`hidden`,r.style.overflow=`hidden`,r.style.boxSizing=`border-box`,r}async function hn(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`)||re.has(n))return null;if(n===`foreignobject`&&e.parentElement?.closest?.(`foreignObject`))return U(t,`Nested skipped (SVG spec limitation — not rendered by browsers)`),null;if(n===`source`&&e.parentElement?.localName===`picture`)return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute(`data-capture`)===`exclude`){if(n.excludeMode===`hide`)return ln(e);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`)return ln(e);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`)return ln(e);if(n.filterMode===`remove`)return null}}catch(e){console.warn(`Error in filter function:`,e)}if(t.clip&&pn(e,t.clip))return mn(e,t,n);if(n.__resolveNodeHooks)for(let r of n.__resolveNodeHooks){let i;try{i=await r(e,n)}catch(e){U(t,`resolveNode plugin hook failed`,e)}if(i===null)return null;if(i instanceof Node)return i.nodeType===Node.ELEMENT_NODE&&(t.nodeMap.set(i,e),K(e,i,t,n)),i}{let r=sn.has(e.tagName)&&on.get(e.tagName);if(r){let i=await r(e,t,n);if(i!==void 0)return i}}if(e.getAttribute(`data-capture`)===`placeholder`){let r=e.cloneNode(!1);t.nodeMap.set(r,e),K(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}{let r=!sn.has(e.tagName)&&on.get(e.tagName);if(r){let i=await r(e,t,n);if(i!==void 0)return 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(wt(e,o),t.nodeMap.set(o,e),e.tagName===`IMG`){Bt(e,o);try{let{width:t,height:n}=J(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){U(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){U(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}=J(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`)&&me()){let{el:n,applyVisual:r}=Yt(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;-webkit-text-fill-color:${n}!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(xt(e)||K(e,o,t,n),s&&s(),e instanceof SVGElement&&!xt(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);hn(e,t,n).then(e=>{r(e||null)}).catch(()=>{r(null)})};var c=i;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 l=Rt(e.shadowRoot),u=It(l,s),d=Ut(e,Vt(l),s);zt(o,d+u,a);let f=document.createDocumentFragment(),p=await Nt(Array.from(e.shadowRoot.childNodes),i,n.fast);f.append(...p.filter(e=>!!e)),o.appendChild(f)}if(e.tagName===`SLOT`){let r=function(e,r){hn(e,t,n).then(e=>{e&&Wt(e),r(e||null)}).catch(()=>{r(null)})};var c=r;let i=e.assignedNodes?.({flatten:!0})||[],a=i.length>0?i:Array.from(e.childNodes),o=document.createDocumentFragment(),s=await Nt(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);hn(e,t,n).then(e=>{i(e||null)}).catch(()=>{i(null)})}let l=await Nt(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}async function gn(e,t,n){let r=!1;try{r=!!(e.contentDocument||e.contentWindow?.document)}catch(e){U(t,`iframe same-origin probe failed`,e)}if(r)try{return await Jt(e,t,n)}catch(e){console.warn(`[SnapDOM] iframe rasterization failed, fallback:`,e)}if(r||console.warn(`[snapdom] cross-origin