Skip to content

armgit / fx0

Public Imported from GitHub
0

A lightweight design agent built with libfx. Describe a page and an agent writes it as one HTML file.

TypeScript

Vendor the fast-html-to-image fork from fast-snap

Esteban Suarezfea0cf863ad3
diff --git a/lib/vendor/fast-html-to-image.ts b/lib/vendor/fast-html-to-image.ts
new file mode 100644
index 0000000..22b98e7
--- /dev/null
+++ b/lib/vendor/fast-html-to-image.ts
@@ -0,0 +1,26 @@
+// Generated by scripts/vendor-fast-html-to-image.mjs from fast-snap e896bbe. Do not edit.
+// fast-html-to-image (patched fork), browser IIFE exposing the global FastHtmlToImage.
+//
+// MIT License
+//
+// Copyright (c) 2025 Aiden Bai
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+export const FAST_HTML_TO_IMAGE = "var FastHtmlToImage=(()=>{var Ke=Object.defineProperty;var rl=Object.getOwnPropertyDescriptor;var ll=Object.getOwnPropertyNames;var nl=Object.prototype.hasOwnProperty;var ol=(e,t)=>{for(var r in t)Ke(e,r,{get:t[r],enumerable:!0})},il=(e,t,r,l)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(let n of ll(t))!nl.call(e,n)&&n!==r&&Ke(e,n,{get:()=>t[n],enumerable:!(l=rl(t,n))||l.enumerable});return e};var al=e=>il(Ke({},\"__esModule\",{value:!0}),e);var Ui={};ol(Ui,{captureNode:()=>ye,captureRegion:()=>Wi,enableIframeBridge:()=>Fi,lastCaptureTimings:()=>Y,prewarm:()=>Ii});var X=\"http://www.w3.org/2000/svg\",br=\"http://www.w3.org/1999/xhtml\",wr=\"http://www.w3.org/1999/xlink\",sl=new Set([\"matrix(0, 0, 0, 1, 0, 0)\",\"matrix(0, 0, 0, 0, 0, 0)\",\"scaleX(0)\",\"scale(0)\",\"scaleY(0)\"]),ul=new Set([\"absolute\",\"fixed\"]),cl=new Set([\"relative\",\"absolute\",\"fixed\",\"sticky\"]),xr=new Set([\"width\",\"height\",\"font-size\",\"inline-size\",\"block-size\",\"transform-origin\",\"perspective-origin\",\"box-sizing\",\"border-top-width\",\"border-right-width\",\"border-bottom-width\",\"border-left-width\"]),kr=new Set([\"border-top-width\",\"border-right-width\",\"border-bottom-width\",\"border-left-width\"]),$t=[\"width\",\"height\",\"inline-size\",\"block-size\"],dl=new Set([\"table\",\"thead\",\"tbody\",\"tfoot\",\"tr\",\"td\",\"th\",\"colgroup\",\"col\"]),Pt=new Set([\"table\",\"td\",\"th\"]),Ar=new Set([\"defs\",\"symbol\",\"pattern\",\"mask\",\"clipPath\",\"marker\",\"linearGradient\",\"radialGradient\",\"filter\"]),fl=[\"fill\",\"fill-opacity\",\"fill-rule\",\"stroke\",\"stroke-opacity\",\"stroke-width\",\"stroke-linecap\",\"stroke-linejoin\",\"stroke-miterlimit\",\"stroke-dasharray\",\"stroke-dashoffset\",\"color\",\"opacity\"],ht=[\"border-top-color\",\"border-right-color\",\"border-bottom-color\",\"border-left-color\",\"border-block-start-color\",\"border-block-end-color\",\"border-inline-start-color\",\"border-inline-end-color\",\"text-decoration-color\",\"text-emphasis-color\",\"outline-color\",\"column-rule-color\",\"-webkit-text-fill-color\",\"-webkit-text-stroke-color\"],pl=[\"fill\",\"stroke\",\"filter\",\"clip-path\",\"mask\",\"mask-image\",\"marker-start\",\"marker-mid\",\"marker-end\"],hl=new Set([\"color\",\"content\",\"direction\",\"unicode-bidi\",\"white-space\",\"text-combine-upright\"]),ml=[\"font\",\"color\",\"background\",\"margin\",\"padding\",\"border\",\"float\",\"vertical-align\",\"line-height\",\"letter-spacing\",\"word-spacing\",\"text-transform\",\"text-decoration\",\"text-shadow\",\"box-shadow\",\"opacity\",\"-webkit-text\",\"initial-letter\"],vr=[\"-webkit-text-stroke-color\",\"-webkit-text-stroke-width\",\"-webkit-text-fill-color\"],gl=new Set([\"offset\",\"computedOffset\",\"easing\",\"composite\"]),yl=\"display.position.top.right.bottom.left.float.clear.box-sizing.width.height.inline-size.block-size.min-width.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.overflow-x.overflow-y.vertical-align.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.outline-color.outline-style.outline-width.outline-offset.color.background-color.transform.transform-origin.rotate.scale.perspective.perspective-origin.object-fit.object-position.appearance.color-scheme.content.font-family.font-size.font-weight.font-style.line-height.white-space.white-space-collapse.text-wrap-mode.text-align.text-transform.text-decoration-line.text-decoration-color.text-decoration-style.text-decoration-thickness.direction.unicode-bidi.writing-mode.text-orientation.list-style-type.border-spacing.table-layout.content-visibility\".split(\".\"),Nt=[\"width\",\"height\",\"inline-size\",\"block-size\",\"top\",\"right\",\"bottom\",\"left\",\"margin-top\",\"margin-right\",\"margin-bottom\",\"margin-left\",\"padding-top\",\"padding-right\",\"padding-bottom\",\"padding-left\",\"transform\",\"transform-origin\",\"perspective-origin\",\"grid-template-columns\",\"grid-template-rows\"],et=[\"top\",\"right\",\"bottom\",\"left\"],Re=new Set([\"background-color\",\"background-image\",\"background-position-x\",\"background-position-y\",\"background-size\",\"background-repeat\",\"background-attachment\",\"background-origin\",\"background-clip\",\"border-top-color\",\"border-right-color\",\"border-bottom-color\",\"border-left-color\",\"border-top-style\",\"border-right-style\",\"border-bottom-style\",\"border-left-style\",\"border-top-left-radius\",\"border-top-right-radius\",\"border-bottom-right-radius\",\"border-bottom-left-radius\",\"padding-top\",\"padding-right\",\"padding-bottom\",\"padding-left\"]),Ee=new Set([...et,\"transform\",\"margin-top\",\"margin-right\",\"margin-bottom\",\"margin-left\",\"padding-top\",\"padding-right\",\"padding-bottom\",\"padding-left\"]),bl=/%|calc\\(|var\\(|min\\(|max\\(|clamp\\(/,wl=/[\"'\\\\]|url\\(|var\\(|\\/\\*|[\\u0000-\\u0008\\u000b\\u000e-\\u001f]/i,Rt=/^(0|-?\\d*\\.?\\d+(px|em|rem|ch|ex|pt|pc|cm|mm|in|vw|vh|vmin|vmax))( (0|-?\\d*\\.?\\d+(px|em|rem|ch|ex|pt|pc|cm|mm|in|vw|vh|vmin|vmax)))*$/,Bt=new Set([\"input\",\"select\",\"textarea\",\"button\",\"option\",\"optgroup\",\"progress\",\"meter\",\"details\",\"summary\",\"dialog\",\"video\",\"audio\"]),xl=\"class.lang.dir.hidden.href.type.contenteditable.slot.part.width.height.align.valign.bgcolor.background.border.color.face.size.nowrap.cellspacing.cellpadding.hspace.vspace.char.charoff.frame.rules.start.value.reversed.colspan.rowspan.span.clear\".split(\".\"),kl=/\\[\\s*(?:[\\w-]+\\|)?([\\w-]+)/g,Al=new Set([\"cursor\",\"pointer-events\",\"touch-action\",\"user-select\",\"-webkit-user-select\",\"-webkit-user-drag\",\"-webkit-tap-highlight-color\",\"will-change\",\"caret-color\",\"-webkit-locale\",\"speak\",\"page\",\"app-region\",\"d\"]),vl=new Set([\"script\",\"style\",\"link\",\"meta\",\"noscript\",\"template\",\"title\",\"base\",\"head\",\"slot\"]),Sl=new Set([\"img\",\"video\",\"canvas\",\"iframe\",\"textarea\"]),El=new Set([\"img\",\"video\",\"canvas\",\"iframe\",\"embed\",\"object\",\"input\",\"select\",\"textarea\",\"audio\",\"progress\",\"meter\",\"svg\"]),Cl=new Set([\"serif\",\"sans-serif\",\"monospace\",\"cursive\",\"fantasy\",\"system-ui\",\"ui-serif\",\"ui-sans-serif\",\"ui-monospace\",\"ui-rounded\",\"emoji\",\"math\",\"fangsong\"]),Ml=new Set(\"color.-webkit-text-fill-color.-webkit-text-stroke-color.direction.visibility.line-height.letter-spacing.word-spacing.white-space.white-space-collapse.word-break.overflow-wrap.text-align.text-align-last.text-indent.text-transform.text-shadow.text-rendering.text-wrap.text-wrap-mode.text-wrap-style.tab-size.hyphens.quotes.border-collapse.border-spacing.caption-side.empty-cells.color-scheme.accent-color.writing-mode.text-orientation.paint-order.image-rendering.color-interpolation.fill.fill-opacity.fill-rule.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width\".split(\".\")),Be=(e,t)=>({a:e.a*t.a+e.c*t.b,b:e.b*t.a+e.d*t.b,c:e.a*t.c+e.c*t.d,d:e.b*t.c+e.d*t.d}),Tt={deg:Math.PI/180,grad:Math.PI/200,rad:1,turn:2*Math.PI},$l=e=>{for(let t in Tt){if(!e.endsWith(t))continue;let r=Number.parseFloat(e.slice(0,-t.length));return Number.isFinite(r)?r*Tt[t]:null}return null},Pl=e=>{if(e.length===0)return[0,0,1];if(e.length===1)return e[0]===\"x\"?[1,0,0]:e[0]===\"y\"?[0,1,0]:e[0]===\"z\"?[0,0,1]:null;if(e.length!==3)return null;let t=e.map(r=>Number.parseFloat(r));return t.some(r=>!Number.isFinite(r))?null:[t[0],t[1],t[2]]},Nl=e=>{if(!e||e===\"none\")return null;let t=e.trim().split(/\\s+/),r=$l(t[t.length-1]);if(r===null)return null;let l=Pl(t.slice(0,-1));if(!l)return null;let n=Math.hypot(l[0],l[1],l[2]);if(n===0)return null;let[o,i,a]=l.map(d=>d/n),s=Math.cos(r),c=Math.sin(r),u=1-s;return{a:s+o*o*u,b:i*o*u+a*c,c:o*i*u-a*c,d:s+i*i*u}},Rl=e=>{if(!e||e===\"none\")return null;let t=e.trim().split(/\\s+/).map(r=>Number.parseFloat(r));return t.length<1||t.length>3||t.some(r=>!Number.isFinite(r))?null:{a:t[0],b:0,c:0,d:t.length>=2?t[1]:t[0]}},Bl=(e,t)=>e.slice(t+1,e.lastIndexOf(\")\")).split(\",\").map(r=>Number.parseFloat(r)),Tl=e=>{if(!e||e===\"none\")return null;let t=e.indexOf(\"(\");if(t===-1||!e.endsWith(\")\"))return null;let r=e.slice(0,t).trim(),l=Bl(e,t);if(l.some(n=>!Number.isFinite(n)))return null;if(r===\"matrix\"&&l.length===6){let[n,o,i,a]=l;return{a:n,b:o,c:i,d:a}}return r===\"matrix3d\"&&l.length===16?{a:l[0],b:l[1],c:l[4],d:l[5]}:null},Dl={a:1,b:0,c:0,d:1},tt=e=>{let t=Tl(e.transform)??Dl,r=Rl(e.scale);r&&(t=Be(r,t));let l=Nl(e.rotate);return l&&(t=Be(l,t)),t},R=e=>{if(e===void 0)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},Sr=e=>{let t=e.match(/-?\\d+(?:\\.\\d+)?px/g);return t?t.map(r=>Number.parseFloat(r)):[]},mt=e=>{if(!e||e===\"none\")return 0;let t=0,r=/([a-z-]+)\\(([^()]*(?:\\([^()]*\\)[^()]*)*)\\)/g,l=r.exec(e);for(;l;){let[,n,o]=l;if(n===\"blur\")t=Math.max(t,R(o)*3);else if(n===\"drop-shadow\"){let[i=0,a=0,s=0]=Sr(o);t=Math.max(t,Math.max(Math.abs(i),Math.abs(a))+s*1.5)}l=r.exec(e)}return t},Ll=e=>{let t=e.a*e.d-e.b*e.c;return t===0?null:{a:e.d/t,b:-e.b/t,c:-e.c/t,d:e.a/t}},Er=e=>Math.abs(e.a-1)<1e-4&&Math.abs(e.b)<1e-4&&Math.abs(e.c)<1e-4&&Math.abs(e.d-1)<1e-4,Vl=(e,t,r,l)=>{let n=1/0,o=1/0,i=-1/0,a=-1/0;e.forEach((f,m)=>{let b=t[m],p=r.get(f)?.styles[\"backdrop-filter\"]??\"\",y=Math.ceil(mt(p));n=Math.min(n,b.left-l.left-y),o=Math.min(o,b.top-l.top-y),i=Math.max(i,b.right-l.left+y),a=Math.max(a,b.bottom-l.top+y)});let s=Math.max(0,Math.floor(n)),c=Math.max(0,Math.floor(o)),u=Math.min(Math.ceil(l.width),Math.ceil(i)),d=Math.min(Math.ceil(l.height),Math.ceil(a));return{x:s,y:c,width:Math.max(1,u-s),height:Math.max(1,d-c)}},Wl=(e,t)=>{let r=[];for(let[l,n]of e){if(l===t)continue;let o=n.styles[\"backdrop-filter\"];o&&o!==\"none\"&&r.push(l)}return r},Il={a:1,b:0,c:0,d:1},Fl=(e,t,r)=>{let l=Il,n=e;for(;n;){let o=r.get(n);if(o&&(l=Be(tt({transform:o.styles.transform,rotate:o.styles.rotate,scale:o.styles.scale}),l)),n===t)break;n=n.parentElement}return l},Ul=(e,t,r,l,n,o,i)=>{let{underlayCanvas:a,ownerDocument:s,pixelRatio:c,backgroundColor:u,underlayOffsetLeftPx:d,underlayOffsetTopPx:f}=e,m=l+2*o,b=n+2*o,p=s.createElement(\"canvas\");p.width=Math.max(1,Math.round(m*c)),p.height=Math.max(1,Math.round(b*c));let y=p.getContext(\"2d\");if(!y)return null;u&&(y.fillStyle=u,y.fillRect(0,0,p.width,p.height)),y.drawImage(a,(t-d-o)*c,(r-f-o)*c,p.width,p.height,0,0,p.width,p.height);let k=s.createElement(\"canvas\");k.width=Math.max(1,Math.round(l*c)),k.height=Math.max(1,Math.round(n*c));let A=k.getContext(\"2d\");return A?(A.scale(c,c),A.filter=i,A.drawImage(p,-o,-o,m,b),k):null},Ol=(e,t,r,l,n,o,i)=>{let{ownerDocument:a,pixelRatio:s}=e,c=a.createElement(\"canvas\");c.width=Math.max(1,Math.round(n*s)),c.height=Math.max(1,Math.round(o*s));let u=c.getContext(\"2d\");return u?(u.scale(s,s),u.translate(n/2,o/2),u.transform(i.a,i.b,i.c,i.d,0,0),u.drawImage(t,-r/2,-l/2,r,l),c):null},zl=(e,t,r,l,n,o,i,a)=>{let s=e.underlayCanvas.getContext(\"2d\");s&&(s.save(),s.setTransform(e.pixelRatio,0,0,e.pixelRatio,0,0),s.translate(r-e.underlayOffsetLeftPx,l-e.underlayOffsetTopPx),s.transform(i.a,i.b,i.c,i.d,0,0),s.translate(-n/2,-o/2),s.drawImage(t,0,0,n,o),a&&a!==\"rgba(0, 0, 0, 0)\"&&a!==\"transparent\"&&(s.fillStyle=a,s.fillRect(0,0,n,o)),s.restore())},Kl=e=>{let t=new Map,r=e.rootElement.getBoundingClientRect();for(let l of e.backdropFilterElements){let n=e.snapshotByElement.get(l),o=n?.styles[\"backdrop-filter\"];if(!o||o===\"none\")continue;let i=l.getBoundingClientRect(),a=Math.round(i.width),s=Math.round(i.height);if(a<=0||s<=0)continue;let c=Fl(l,e.rootElement,e.snapshotByElement),u=Ul(e,i.left-r.left,i.top-r.top,a,s,Math.ceil(mt(o)),o);if(!u)continue;let d=u,f=a,m=s;if(!Er(c)){let b=Ll(c);if(!b)continue;let p=l instanceof HTMLElement?l.offsetWidth:0,y=l instanceof HTMLElement?l.offsetHeight:0;if(p<=0||y<=0)continue;let k=Ol(e,u,a,s,p,y,b);if(!k)continue;d=k,f=p,m=y}zl(e,d,i.left-r.left+i.width/2,i.top-r.top+i.height/2,f,m,c,n?.styles[\"background-color\"]);try{t.set(l,d.toDataURL())}catch{continue}}return t},be=e=>e.type===CSSRule.STYLE_RULE,rt=e=>\"cssRules\"in e,Cr=e=>e.type===CSSRule.IMPORT_RULE,we=(e,t)=>{try{return new URL(e,t??void 0).href}catch{return e}},oe=(e,t,r)=>{let l=(n,o)=>{for(let i of n){if(t(i,o))return!0;if(Cr(i))try{let a=i.styleSheet;if(a&&l(a.cssRules,a.href??o))return!0}catch{if(r(we(i.href,o)))return!0}else if(rt(i)&&l(i.cssRules,o))return!0}return!1};for(let n of[...e.styleSheets,...e.adoptedStyleSheets])try{if(l(n.cssRules,n.href??e.baseURI))return}catch{if(r(n.href??null))return}},Dt=new WeakMap,Ne=e=>{let t=e;for(;t!==null;){if(t.nodeType===Node.ELEMENT_NODE&&t.hasAttribute(\"data-fhti-epoch-ignored\"))return!0;t=t.parentNode}return!1},je=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;let t=e.localName;return t===\"style\"||t===\"link\"},jl=e=>{let t=e.target;for(;t!==null;){if(je(t))return!0;t=t.parentNode}if(e.type===\"childList\"){for(let r of e.addedNodes)if(je(r))return!0;for(let r of e.removedNodes)if(je(r))return!0}return!1},Hl=e=>{if(e.type===\"childList\"){for(let t of e.addedNodes)if(!Ne(t))return!0;for(let t of e.removedNodes)if(!Ne(t))return!0;return!1}return!Ne(e.target)},ql=e=>{let t={epoch:0,styleEpoch:0,attributeGeneration:0},r=new WeakMap,l=()=>{t.epoch++},n=c=>{c.target instanceof Node&&Ne(c.target)||t.epoch++},o=c=>{c.some(Hl)&&t.epoch++,c.some(jl)&&t.styleEpoch++;let u=!1;for(let d of c)d.type!==\"attributes\"||d.target.nodeType!==Node.ELEMENT_NODE||(u||=(t.attributeGeneration++,!0),r.set(d.target,t.attributeGeneration))},i=new MutationObserver(o);i.observe(e.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let a={capture:!0,passive:!0};for(let c of[\"scroll\",\"input\",\"change\",\"load\",\"error\",\"toggle\"])e.addEventListener(c,n,a);let s=e.defaultView;if(s)for(let c of[\"resize\",\"hashchange\",\"popstate\"])s.addEventListener(c,l,a);return e.fonts.addEventListener(\"loadingdone\",l),{readEpochs:()=>(o(i.takeRecords()),t),attributeGenerationByElement:r}},Mr=e=>{let t=Dt.get(e);return t===void 0&&(t=ql(e),Dt.set(e,t)),t},gt=e=>Mr(e).readEpochs(),xe=e=>gt(e).epoch,Lt=e=>gt(e).styleEpoch,_l=e=>gt(e).attributeGeneration,Yl=e=>Mr(e).attributeGenerationByElement,$r=new WeakMap,me=new WeakMap,Gl=e=>{let t=me.get(e);if(!t)return!1;let r=xe(e.ownerDocument);return t.epoch===r&&t.captureCount>=1&&t.unpromotableEpoch!==r},Ql=e=>{let t=xe(e.ownerDocument),r=me.get(e);if(r&&r.epoch===t){r.captureCount++;return}me.set(e,{epoch:t,captureCount:1,unpromotableEpoch:r?.unpromotableEpoch??-1})},Xl=e=>{let t=xe(e.ownerDocument),r=me.get(e);if(r){r.unpromotableEpoch=t;return}me.set(e,{epoch:t,captureCount:0,unpromotableEpoch:t})},Zl=/:(?:hover|active|focus|target)/,Pr=e=>{if(e.filterNode||e.resolveIframeContent||e.prunedElements)return null;let t=e.clip;return`${e.scale}|${e.pixelRatio}|${e.backgroundColor??\"\"}|${e.embedFonts}|${e.bleed}|${e.timeoutMs}|`+(t?`${t.x},${t.y},${t.width},${t.height}`:\"\")},Te=e=>{let t=0;return oe(e,()=>(t++,!1),()=>!1),t},Jl=e=>{let t=!1;return oe(e,r=>be(r)&&Zl.test(r.selectorText)?(t=!0,!0):!1,()=>(t=!0,!0)),t},Nr=e=>typeof e.getAnimations!=\"function\"||e.getAnimations().length>0,en=e=>e.localName===\"input\"||e.localName===\"textarea\"||e.localName===\"select\",tn=(e,t,r,l)=>{let n=e.ownerDocument,o=n.defaultView;if(!o||n.fonts.status!==\"loaded\"||Nr(n)||e.querySelector(\"canvas,video,iframe,object,embed,animate,animateTransform,animateMotion,set\")||Jl(n))return;let i=[],a=[],s=[],c=[],u=[],d=[];for(let[f,m]of r){if(f.shadowRoot)return;i.push(f),a.push(m.scrollLeft),s.push(m.scrollTop),en(f)&&(c.push(f),u.push(f.value),d.push(f instanceof HTMLInputElement?f.checked||f.indeterminate:!1))}$r.set(e,{...l,optionsKey:t,documentEpoch:xe(n),cssRuleCount:Te(n),activeElement:n.activeElement,windowScrollX:o.scrollX,windowScrollY:o.scrollY,viewportWidthPx:o.innerWidth,viewportHeightPx:o.innerHeight,devicePixelRatio:o.devicePixelRatio,scrollElements:i,scrollLefts:a,scrollTops:s,formElements:c,formValues:u,formCheckedStates:d})},Rr=(e,t)=>{let r=$r.get(e);if(!r||r.optionsKey!==t)return null;let l=e.ownerDocument,n=l.defaultView;if(!n||xe(l)!==r.documentEpoch||l.activeElement!==r.activeElement||l.fonts.status!==\"loaded\"||n.scrollX!==r.windowScrollX||n.scrollY!==r.windowScrollY||n.innerWidth!==r.viewportWidthPx||n.innerHeight!==r.viewportHeightPx||n.devicePixelRatio!==r.devicePixelRatio||Nr(l)||Te(l)!==r.cssRuleCount)return null;let{scrollElements:o,scrollLefts:i,scrollTops:a}=r;for(let d=0;d<o.length;d++){let f=o[d];if(f.scrollLeft!==i[d]||f.scrollTop!==a[d])return null}let{formElements:s,formValues:c,formCheckedStates:u}=r;for(let d=0;d<s.length;d++){let f=s[d],m=f instanceof HTMLInputElement?f.checked||f.indeterminate:!1;if(f.value!==c[d]||m!==u[d])return null}return r},rn=(e,t,r)=>{let l=e*.2,n=t*(2/13),o=(t-n)/2,i=e-2*l,a=`<svg xmlns='${X}' width='${e}' height='${t}'><rect width='${e}' height='${t}' rx='2' fill='${r}'/><rect x='${l}' y='${o}' width='${i}' height='${n}' rx='${Math.min(2,n/2)}' fill='#ffffff'/></svg>`;return`appearance:none;-webkit-appearance:none;border:none;background-color:transparent;background-image:url(\"data:image/svg+xml,${encodeURIComponent(a)}\");background-repeat:no-repeat;background-position:center;background-size:100% 100%;`},H=e=>e.nodeType===Node.ELEMENT_NODE,W=(e,t)=>e.localName===t&&e.namespaceURI===\"http://www.w3.org/1999/xhtml\",ke=(e,t=!0)=>{let r=e.shadowRoot;if(r===null&&!t)return e.childNodes;let l=r?r.childNodes:e.childNodes,n=!1;for(let i=0;i<l.length;i+=1){let a=l[i];if(H(a)&&a.localName===\"slot\"){n=!0;break}}if(!n)return l;let o=[];for(let i of l)if(H(i)&&W(i,\"slot\")){if(i.ownerDocument.defaultView?.getComputedStyle(i)?.display===\"none\")continue;let a=i.assignedNodes({flatten:!0});a.length>0?o.push(...a):o.push(...i.childNodes)}else o.push(i);return o},ln=RegExp(\"[\\\\u0000-\\\\u0008\\\\u000B\\\\u000C\\\\u000E-\\\\u001F\\\\uFFFE\\\\uFFFF]|[\\\\uD800-\\\\uDBFF](?![\\\\uDC00-\\\\uDFFF])|(?<![\\\\uD800-\\\\uDBFF])[\\\\uDC00-\\\\uDFFF]\",\"g\"),nn=/[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\uFFFE\\uFFFF]/,on=/[\\uD800-\\uDFFF]/,Z=e=>!nn.test(e)&&e.isWellFormed()?e:e.replace(ln,t=>on.test(t)?\"\\uFFFD\":\"\"),He=/^[A-Za-z_][A-Za-z0-9_.-]*$/,an=e=>e.namespaceURI===null?e.name!==\"xmlns\"&&He.test(e.name):(e.prefix===null||He.test(e.prefix))&&He.test(e.localName),Vt=e=>{for(let t of[...e.attributes]){if(!an(t)){e.removeAttributeNode(t);continue}let r=Z(t.value);r!==t.value&&(t.value=r)}},Br=e=>{for(let t of e.querySelectorAll(\"script\"))t.remove();Vt(e);for(let t of e.querySelectorAll(\"*\"))Vt(t)},sn=(e,t,r)=>{let l=[];for(let n of e.split(\",\")){let[o,i]=n.trim().split(/\\s+/);if(!o)continue;let a=1;i?.endsWith(\"x\")?a=Number.parseFloat(i):i?.endsWith(\"w\")&&(a=t>0?Number.parseFloat(i)/t:1),!(!Number.isFinite(a)||a<=0)&&l.push({url:o,density:a})}return l.length===0?null:(l.sort((n,o)=>n.density-o.density),(l.find(n=>n.density>=r)??l[l.length-1]).url)},re=e=>e!==void 0&&e!==\"none\",un=e=>cl.has(e.position??\"\")||re(e.transform)||re(e.filter)||re(e[\"backdrop-filter\"])||re(e.perspective),Wt=e=>(e.scrollLeft!==0||e.scrollTop!==0)&&(e.styles[\"overflow-x\"]!==void 0&&e.styles[\"overflow-x\"]!==\"visible\"||e.styles[\"overflow-y\"]!==void 0&&e.styles[\"overflow-y\"]!==\"visible\"),cn=(e,t)=>{let r=t.snapshotByElement.get(e);if(r)for(let[l,n]of t.snapshotByElement){if(l===e||n.styles.position!==\"fixed\")continue;let o=t.cloneByElement.get(l);if(!o||!o.parentNode)continue;let i=l.getBoundingClientRect(),a=null,s=null,c=n.parentElement;for(;c&&c!==e;){let f=t.snapshotByElement.get(c);if(!f)break;if(Wt(f)||un(f.styles)){a=c,s=f;break}c=f.parentElement}let u,d;if(a&&s){let f=a.getBoundingClientRect(),m=s.styles;if(u=i.left-f.left-R(m[\"border-left-width\"]),d=i.top-f.top-R(m[\"border-top-width\"]),Wt(s)){let b=a.ownerDocument.defaultView?.getComputedStyle(a);u+=s.scrollLeft-R(b?.getPropertyValue(\"padding-left\")),d+=s.scrollTop-R(b?.getPropertyValue(\"padding-top\"))}}else{let f=e.getBoundingClientRect(),m=(r.styles.position??\"static\")!==\"static\";u=i.left-f.left-(m?R(r.styles[\"border-left-width\"]):0),d=i.top-f.top-(m?R(r.styles[\"border-top-width\"]):0)}o.setAttribute(\"style\",`${o.getAttribute(\"style\")??\"\"}position:absolute;top:${d}px;left:${u}px;right:auto;bottom:auto;margin:0;`)}},dn=(e,t)=>{let r=t.snapshotByElement.get(e);if(!r)return;let l=e.getBoundingClientRect(),n=r.styles,o=e.ownerDocument.defaultView?.getComputedStyle(e),i=l.left+R(n[\"border-left-width\"])+R(o?.getPropertyValue(\"padding-left\")),a=l.top+R(n[\"border-top-width\"])+R(o?.getPropertyValue(\"padding-top\")),s=(u,d)=>{let f=t.cloneByElement.get(u);if(!f||!f.parentNode)return;let m=u.getBoundingClientRect(),b=t.ownerDocument.createElement(\"div\"),p=[\"top\",\"right\",\"bottom\",\"left\"].map(M=>`border-${M}-width:${d.styles[`border-${M}-width`]??\"0px\"};border-${M}-style:${d.styles[`border-${M}-style`]??\"none\"};border-${M}-color:${d.styles[`border-${M}-color`]??\"currentcolor\"};`).join(\"\");b.setAttribute(\"style\",`visibility:hidden;box-sizing:border-box;display:${d.styles.display??\"block\"};${p}width:${m.width}px;height:${m.height}px;margin:${d.styles[\"margin-top\"]??\"0px\"} ${d.styles[\"margin-right\"]??\"0px\"} ${d.styles[\"margin-bottom\"]??\"0px\"} ${d.styles[\"margin-left\"]??\"0px\"};`),f.parentNode.insertBefore(b,f);let y=m.left-i+r.scrollLeft,k=m.top-a+r.scrollTop,A=u.closest(\"table\"),x=!!A&&u.ownerDocument.defaultView?.getComputedStyle(A).borderCollapse===\"collapse\",w=x?R(d.styles[\"border-top-width\"])/2:0,g=x?R(d.styles[\"border-bottom-width\"])/2:0,E=d.styles[\"box-sizing\"]===\"border-box\"?0:R(d.styles[\"padding-top\"])+R(d.styles[\"padding-bottom\"]),B=x?`height:${m.height-w-g-E}px;border-top-width:0px;border-bottom-width:0px;`:\"\";f.setAttribute(\"style\",`${f.getAttribute(\"style\")??\"\"}position:absolute;top:${k+w}px;left:${y}px;right:auto;bottom:auto;margin:0;${B}`)},c=u=>{for(let d of ke(u)){if(!H(d))continue;let f=t.snapshotByElement.get(d);if(f&&!(f.scrollLeft!==0||f.scrollTop!==0)){if(f.styles.position===\"sticky\"){s(d,f);continue}c(d)}}};c(e)},fn=(e,t,r,l)=>{let n=l.createElement(\"div\");for(n.setAttribute(\"style\",`all:unset;display:inherit;flex-direction:inherit;flex-wrap:inherit;row-gap:inherit;column-gap:inherit;align-items:inherit;align-content:inherit;justify-content:inherit;justify-items:inherit;grid-template-columns:inherit;grid-template-rows:inherit;grid-template-areas:inherit;grid-auto-flow:inherit;grid-auto-columns:inherit;grid-auto-rows:inherit;transform:translate(${-t}px,${-r}px);will-change:transform;contain:layout;`);e.firstChild;)n.appendChild(e.firstChild);e.appendChild(n)},It=e=>re(e[\"background-image\"])||e[\"background-color\"]!==void 0&&e[\"background-color\"]!==\"transparent\"&&e[\"background-color\"]!==\"rgba(0, 0, 0, 0)\",Ft=e=>e!==void 0&&e.endsWith(\"px\")&&Number.parseFloat(e)||0,pn=(e,t)=>{let r=t.styles[\"background-image\"],l=t.styles[\"background-attachment\"];if(!re(r)||l===void 0)return;let n=Ce(r),o=Ce(l);if(n.length!==o.length)return;let i=o.some((d,f)=>n[f]!==\"none\"&&d===\"local\"),a=o.some((d,f)=>n[f]!==\"none\"&&d!==\"local\");if(!i||a)return;let s=Ce(t.styles[\"background-position-x\"]??\"0%\"),c=Ce(t.styles[\"background-position-y\"]??\"0%\");if(s.length!==n.length||c.length!==n.length)return;let u=(d,f)=>d.map((m,b)=>n[b]===\"none\"?m:`calc(${m} - ${f}px)`).join(\", \");e.style.setProperty(\"background-position-x\",u(s,t.scrollLeft),\"important\"),e.style.setProperty(\"background-position-y\",u(c,t.scrollTop),\"important\")},hn=(e,t,r,l,n)=>{let o=t.ownerDocument,i=o.body,a=i?l.snapshotByElement.get(i):void 0;if(!a||It(r.styles)||!It(a.styles))return;let s=a.styles,c=s[\"background-image\"]??\"none\",u=t.getBoundingClientRect(),d=re(c)&&c.includes(\"gradient(\")&&!c.includes(\"url(\"),f=d?`${u.width}px ${u.height}px`:s[\"background-size\"]??\"auto\",m=o.createElement(\"div\");m.setAttribute(\"style\",`position:absolute;z-index:-1;left:0px;top:0px;width:${n.width}px;height:${n.height}px;pointer-events:none;background-color:${s[\"background-color\"]??\"transparent\"};background-image:${c};background-repeat:${s[\"background-repeat\"]??\"repeat\"};background-size:${f};background-position-x:${Ft(s[\"background-position-x\"])-n.x}px;background-position-y:${Ft(s[\"background-position-y\"])-n.y}px;`),e.insertBefore(m,e.firstChild);let b=l.cloneByElement.get(i);b&&b.style.setProperty(\"background\",\"none\",\"important\")},mn=(e,t)=>{let r=t.ownerDocument.createElement(\"div\"),l=e.ownerDocument.defaultView.getComputedStyle(e),n=\"display:inline-block;overflow:hidden;white-space:pre-wrap;box-sizing:content-box;\";for(let o of[\"top\",\"right\",\"bottom\",\"left\"])n+=`border-${o}-width:${l.getPropertyValue(`border-${o}-width`)};border-${o}-style:${l.getPropertyValue(`border-${o}-style`)};border-${o}-color:${l.getPropertyValue(`border-${o}-color`)};padding-${o}:${l.getPropertyValue(`padding-${o}`)};`;return r.setAttribute(\"style\",n),r},Ce=e=>{let t=[],r=0,l=\"\";for(let n of e)n===\"(\"?r++:n===\")\"&&r--,n===\",\"&&r===0?(t.push(l.trim()),l=\"\"):l+=n;return t.push(l.trim()),t},lt=/^[A-Za-z_][A-Za-z0-9_.-]*$/,Tr=new Set([\"class\",\"style\",\"srcset\",\"sizes\",\"loading\",\"slot\"]),gn=new Set([\"input\",\"select\",\"option\",\"textarea\"]),Me=new Map,yn=e=>{if(!e.hasAttributes())return!0;let t=e.attributes.length;if(t>2)return!1;let r=+!!e.hasAttribute(\"class\");return e.hasAttribute(\"style\")&&(r+=1),r===t},Ut=new Map,bn=e=>{let t=Ut.get(e);return t===void 0&&(t=lt.test(e),Ut.set(e,t)),t},Dr=e=>e.namespaceURI===null?e.name!==\"xmlns\"&&bn(e.name):(e.prefix===null||lt.test(e.prefix))&&lt.test(e.localName),wn=e=>{let t=e.attributes;for(let r=t.length-1;r>=0;r--){let l=t[r];if(Tr.has(l.name)||!Dr(l)){e.removeAttributeNode(l);continue}let n=Z(l.value);n!==l.value&&(l.value=n)}},Ot=(e,t)=>{let r=e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.prefix===null?t.createElement(e.localName):t.createElementNS(e.namespaceURI,e.prefix===null?e.localName:`${e.prefix}:${e.localName}`),l=e.attributes;for(let n=0;n<l.length;n++){let o=l[n];Tr.has(o.name)||!Dr(o)||r.setAttributeNS(o.namespaceURI,o.name,Z(o.value))}return r},xn=e=>e.namespaceURI===\"http://www.w3.org/2000/svg\"&&Ar.has(e.localName),kn=e=>{for(let t of fl)e.hasAttribute(t)&&e.removeAttribute(t)},An=e=>{let t=e.cloneNode(!1);if(!H(t))return null;let r=e.currentSrc||e.src;if(!r&&e.srcset){let l=sn(e.srcset,e.offsetWidth,e.ownerDocument.defaultView?.devicePixelRatio??1);l&&(r=we(l,e.baseURI))}return r&&t.setAttribute(\"src\",r),t},vn=(e,t)=>{let r=t.createElement(\"img\");r.setAttribute(\"width\",String(e.width)),r.setAttribute(\"height\",String(e.height));try{r.setAttribute(\"src\",e.toDataURL())}catch{r.setAttribute(\"src\",\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\")}return r},Sn=(e,t,r)=>{let l=t.createElement(\"img\"),n=\"\";if(e.videoWidth>0&&e.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){let o=t.createElement(\"canvas\");o.width=e.videoWidth,o.height=e.videoHeight;let i=o.getContext(\"2d\");if(i)try{i.drawImage(e,0,0),n=o.toDataURL()}catch{n=\"\"}l.setAttribute(\"width\",String(e.videoWidth)),l.setAttribute(\"height\",String(e.videoHeight)),o.width=0,o.height=0}return n||=e.poster||\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\",l.setAttribute(\"src\",n),l.setAttribute(\"style\",`object-fit:${r[\"object-fit\"]??\"contain\"};object-position:${r[\"object-position\"]??\"50% 50%\"};`),l},En=(e,t,r)=>{if(W(e,\"input\")){if(t.setAttribute(\"value\",e.value),e.checked?t.setAttribute(\"checked\",\"\"):t.removeAttribute(\"checked\"),e.type===\"checkbox\"&&e.indeterminate){let l=r[\"accent-color\"];t.setAttribute(\"style\",rn(R(r.width),R(r.height),l&&l!==\"auto\"?l:\"rgb(0, 117, 255)\"))}}else W(e,\"option\")&&(e.selected?t.setAttribute(\"selected\",\"\"):t.removeAttribute(\"selected\"))},Cn=(e,t)=>(e===void 0||e===\"visible\")&&(t===void 0||t===\"visible\"),Mn=(e,t)=>{let r=t.ownerDocument.createElement(\"div\"),l=t.iframeContentByElement.get(e);if(l){let n=l.canvasBackgroundColor?`background:${l.canvasBackgroundColor};`:\"\";r.setAttribute(\"style\",`overflow:hidden;${n}`);let o=t.ownerDocument.createElement(\"img\");o.setAttribute(\"src\",l.pngDataUrl),o.setAttribute(\"style\",`display:block;width:${l.widthPx}px;height:${l.heightPx}px;`),r.appendChild(o)}else r.setAttribute(\"style\",\"background:#d9d9d9;\");return r},pe=(e,t,r,l)=>{if(H(t)){let n=Lr(t,r,l);n&&e.appendChild(n)}else t.nodeType===Node.TEXT_NODE&&e.appendChild(r.ownerDocument.createTextNode(Z(t.textContent??\"\")))},$n=(e,t)=>e.ownerDocument.compatMode===\"BackCompat\"&&[\"block\",\"list-item\",\"table-cell\",\"table-caption\",\"flow-root\",\"inline-block\"].includes(t.snapshotByElement.get(e)?.styles.display??\"\"),Pn=(e,t,r)=>{let l=[],n=!1,o=!1,i=()=>{if(l.length>0)if(n&&!o){let a=r.ownerDocument.createElement(\"span\");a.setAttribute(\"style\",\"display:block;line-height:0\"),e.appendChild(a);for(let s of l)pe(a,s,r,!1)}else for(let a of l)pe(e,a,r,!1);l=[],n=!1,o=!1};for(let a=t.firstChild;a!==null;a=a.nextSibling)if(H(a)){let s=r.snapshotByElement.get(a)?.styles.display;s===void 0||s===\"none\"?l.push(a):s.startsWith(\"inline\")?(n||=W(a,\"img\"),o||=!W(a,\"img\"),l.push(a)):(i(),pe(e,a,r,!1))}else a.nodeType===Node.TEXT_NODE&&(l.push(a),o||=!/^\\s*$/.test(a.textContent??\"\"));i()},Lr=(e,t,r=!1)=>{if(xn(e)){let p=e.cloneNode(!0);return H(p)?(Br(p),p):null}let l=t.snapshotByElement.get(e);if(!l)return null;let n=e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.prefix===null,o=n?e.localName:\"\",i,a=!0,s=!1;if(o===\"iframe\"&&W(e,\"iframe\"))i=Mn(e,t),a=!1;else if(o===\"canvas\"&&W(e,\"canvas\"))i=vn(e,t.ownerDocument),a=!1;else if(o===\"video\"&&W(e,\"video\"))i=Sn(e,t.ownerDocument,l.styles),a=!1;else if(o===\"img\"&&W(e,\"img\"))i=An(e),i&&wn(i),a=!1;else if(o===\"textarea\")i=l.scrollTop!==0||l.scrollLeft!==0?mn(e,t):Ot(e,t.ownerDocument),a=!1;else if(n&&!gn.has(o)&&yn(e)){let p=t.classNameByElement.get(e)??\"\",y=t.inlineCarryTextByElement.get(e)??\"\";if(p===\"\"&&y===\"\")i=t.ownerDocument.createElement(e.localName);else{let k=`${e.localName}|${p}|${y}`,A=Me.get(k);A===void 0&&(A=t.ownerDocument.createElement(e.localName),p!==\"\"&&A.setAttribute(\"class\",p),y!==\"\"&&A.setAttribute(\"style\",y),Me.size>=4096&&Me.clear(),Me.set(k,A));let x=A.cloneNode(!1);i=H(x)?x:null,s=!0}}else i=Ot(e,t.ownerDocument);if(!i)return null;t.prunedElements?.has(e)&&(a=!1),(o===\"input\"||o===\"option\")&&En(e,i,l.styles);let c=s?void 0:t.inlineCarryTextByElement.get(e);if(c!==void 0){let p=i.getAttribute(\"style\");i.setAttribute(\"style\",p?c+p:c)}let u=s?void 0:t.classNameByElement.get(e);if(u&&(n?i.className=u:(i.setAttribute(\"class\",u),e.namespaceURI===\"http://www.w3.org/2000/svg\"&&kn(i))),o===\"textarea\"&&W(e,\"textarea\")&&(i.textContent=Z(e.value)),t.cloneByElement.set(e,i),a){let p=r||!!e.shadowRoot,y=e.firstChild;if(!p&&y!==null&&y===e.lastChild&&y.nodeType===Node.TEXT_NODE)i.textContent=Z(y.textContent??\"\");else if(p)for(let k of ke(e,p))pe(i,k,t,p);else if($n(e,t))Pn(i,e,t);else for(let k=e.firstChild;k!==null;k=k.nextSibling)pe(i,k,t,!1)}let d=t.viewportScroll&&e===e.ownerDocument.documentElement?t.viewportScroll:null,f=d?d.x:l.scrollLeft,m=d?d.y:l.scrollTop,b=(f!==0||m!==0)&&(d!==null||!Cn(l.styles[\"overflow-x\"],l.styles[\"overflow-y\"]));return b&&(fn(i,f,m,t.ownerDocument),dn(e,t)),d?hn(i,e,l,t,d):b&&pn(i,l),i},Nn=(e,t)=>{let r=Lr(e,t);return r&&cn(e,t),r},se=e=>{let t=new Map;return{get:r=>t.get(r),set:(r,l)=>{if(!t.has(r)&&t.size>=e){let n=t.keys().next().value;n!==void 0&&t.delete(n)}t.set(r,l)},delete:r=>{t.delete(r)}}},zt=new Map,ge=e=>{let t=zt.get(e);if(t!==void 0)return t;let r=e.startsWith(\"--\")||e.includes(\"animation\")||e.includes(\"transition\")||e.startsWith(\"view-timeline\")||e.startsWith(\"scroll-timeline\")||Al.has(e);return zt.set(e,r),r},Rn=new Set([\"width\",\"height\",\"inline-size\",\"block-size\",\"min-width\",\"min-height\",\"max-width\",\"max-height\",\"min-inline-size\",\"min-block-size\",\"max-inline-size\",\"max-block-size\",\"margin-top\",\"margin-right\",\"margin-bottom\",\"margin-left\",\"margin-block-start\",\"margin-block-end\",\"margin-inline-start\",\"margin-inline-end\",\"padding-top\",\"padding-right\",\"padding-bottom\",\"padding-left\",\"padding-block-start\",\"padding-block-end\",\"padding-inline-start\",\"padding-inline-end\",\"top\",\"right\",\"bottom\",\"left\",\"inset-block-start\",\"inset-block-end\",\"inset-inline-start\",\"inset-inline-end\"]),ae=(e,t)=>{if(!Rn.has(e)||t===void 0||!t.endsWith(\"px\"))return t;let r=Number.parseFloat(t);if(!Number.isFinite(r)||r===0)return t;let l=32*10**(Math.floor(Math.log10(Math.abs(r)))-5);if(!(l<.5))return t;let n=r*64,o=Math.round(n);return o!==n&&Math.abs(n-o)<=l?`${o/64}px`:t},qe=[],Q=(e,t,r=!1)=>{let l={};if(t)for(let n of t){let o=ae(n,e.getPropertyValue(n));o!==\"\"&&(l[n]=o)}else if(r){if(!qe.length)for(let n=0;n<e.length;n++){let o=e.item(n);ge(o)||qe.push(o)}for(let n of qe)l[n]=ae(n,e.getPropertyValue(n))}else for(let n=0;n<e.length;n++){let o=e.item(n);ge(o)||(l[o]=ae(o,e.getPropertyValue(o)))}for(let n of vr){if(l[n]!==void 0)continue;let o=ae(n,e.getPropertyValue(n));o&&(l[n]=o)}return l},Kt=new Map,Vr=(e,t)=>{let r=Kt.get(t);if(r===void 0){r=[];for(let n=0;n<e.length;n++){let o=e.item(n);ge(o)||t(o)&&r.push(o)}Kt.set(t,r)}let l={};for(let n of r)l[n]=e.getPropertyValue(n);for(let n of vr){if(l[n]!==void 0||!t(n))continue;let o=e.getPropertyValue(n);o&&(l[n]=o)}return l},jt=se(256),Bn=(e,t,r)=>{let l=e.namespaceURI===\"http://www.w3.org/2000/svg\"?\"svg|\":\"\",n=W(e,\"input\")?`|${e.type}`:\"\";return`${l}${e.localName}${n}|${t??\"\"}|${r??\"\"}`},Tn=e=>{let t=null,r=()=>{if(!t){let l=e.createElement(\"iframe\");l.setAttribute(\"style\",\"position:absolute;left:-9999px;top:0;visibility:hidden;width:64px;height:64px;border:0;\"),l.setAttribute(\"aria-hidden\",\"true\"),l.setAttribute(\"data-fhti-epoch-ignored\",\"\"),(e.body??e.documentElement).appendChild(l),t=l}return t.contentDocument};return{getBaseline:(l,n,o)=>{let i=o[\"font-size\"],a=o.appearance===\"auto\"?o[\"color-scheme\"]:void 0,s=a&&a!==\"normal\"?a:\"\",c=Bn(l,n,s?`${i??\"\"}|color-scheme:${s}`:i),u=jt.get(c);if(u)return u;let d=r(),f=d?.body,m=d?.defaultView;if(!d||!f||!m)return{};let b,p;if(l.namespaceURI===\"http://www.w3.org/2000/svg\"){let A=d.createElementNS(X,\"svg\");b=d.createElementNS(X,l.localName),A.appendChild(b),p=A}else b=d.createElement(l.localName),W(l,\"input\")&&b.setAttribute(\"type\",l.type),b.textContent=\" \",p=b;(i||s)&&b.setAttribute(\"style\",`${i?`font-size:${i};`:\"\"}${s?`color-scheme:${s};`:\"\"}`),f.appendChild(p);let y=[];for(let A in o)y.push(A);let k=Q(m.getComputedStyle(b,n??void 0),y);return s&&(k[\"color-scheme\"]=\"normal\"),p.remove(),jt.set(c,k),k},dispose:()=>{t?.remove(),t=null}}},yt=e=>Ml.has(e)||e.startsWith(\"font\")||e.startsWith(\"text-emphasis\")||e.startsWith(\"list-style\")||e.startsWith(\"-webkit-text\"),Ht=new Set(ht.filter(e=>e.includes(\"border\"))),bt=({styles:e,baseline:t,parentStyles:r,parentEmittedStyles:l})=>{let n={},o=e.appearance===\"auto\";for(let s in e){let c=e[s];if(c!==void 0){if(c!==t[s]){n[s]=c;continue}xr.has(s)&&!(o&&kr.has(s))&&(n[s]=c)}}let i=e.color,a=o&&e[\"color-scheme\"]!==t[\"color-scheme\"];for(let s of ht){let c=e[s];if(c===void 0)continue;let u=o&&Ht.has(s)&&c===t[s];(a&&Ht.has(s)?u:c===i||u)?delete n[s]:n[s]=c}if(l&&r)for(let s in l){if(s in n||!yt(s))continue;let c=e[s];c!==void 0&&c!==r[s]&&(n[s]=c)}return n},Wr=(e,t,r,l)=>{let n=t.appearance===\"auto\";for(let o of l){let i=t[o];if(i===void 0){delete e[o];continue}if(i!==r[o]){e[o]=i;continue}xr.has(o)&&!(n&&kr.has(o))?e[o]=i:delete e[o]}},Dn=e=>e.every(t=>!yt(t)&&!ht.includes(t)&&t!==\"appearance\"&&t!==\"color\"&&t!==\"font-size\"),Ie=(e,t)=>{e[\"transform-origin\"]!==void 0&&(t.transform??\"none\")===\"none\"&&(t.rotate??\"none\")===\"none\"&&(t.scale??\"none\")===\"none\"&&delete e[\"transform-origin\"],e[\"perspective-origin\"]!==void 0&&(t.perspective??\"none\")===\"none\"&&delete e[\"perspective-origin\"],t[\"writing-mode\"]===\"horizontal-tb\"&&(e[\"inline-size\"]!==void 0&&e[\"inline-size\"]===e.width&&delete e[\"inline-size\"],e[\"block-size\"]!==void 0&&e[\"block-size\"]===e.height&&delete e[\"block-size\"])},Ir=e=>e.startsWith(\"font\")||hl.has(e),Ln=e=>Ir(e)||e===\"line-height\",Vn=(e,t)=>{if(!e)return null;let r=null;for(let l in e){if(!Ir(l)&&l!==\"line-height\")continue;let n=e[l];n!==void 0&&n!==(l===\"content\"?\"normal\":t[l])&&(r??={},r[l]=n)}return r},Fe=(e,t,r,l,n)=>{if(!l&&t.display===\"inline\")for(let a of $t)delete e[a];if(n!==null&&dl.has(n)){let a=e.width??t.width,s=n===\"table\"&&(t.float??\"none\")!==\"none\",c=Pt.has(n)&&(t[\"writing-mode\"]??\"horizontal-tb\")!==\"horizontal-tb\"&&t.height!==void 0&&t.height!==\"auto\";for(let f of $t)s&&f===\"width\"||n===\"tr\"&&f===\"height\"||delete e[f];c&&(e.height=t.height);let u=t[\"min-width\"],d=u!==void 0&&u!==\"auto\"&&u!==\"0px\";Pt.has(n)&&a&&!d&&(e[\"min-width\"]=a)}if(((t[\"column-count\"]??\"auto\")!==\"auto\"||(t[\"column-width\"]??\"auto\")!==\"auto\")&&e.height!==void 0&&!(parseFloat(t[\"min-height\"])>0)){let a=e.height;e[\"min-height\"]=a,delete e.height,e[\"block-size\"]===a&&delete e[\"block-size\"]}let o=r!==null&&r.includes(\"flex\"),i=r!==null&&r.includes(\"grid\");o&&(e[\"flex-grow\"]=\"0\",e[\"flex-shrink\"]=\"0\",e[\"flex-basis\"]=\"auto\"),(o||i)&&t[\"min-width\"]===\"auto\"&&(e[\"min-width\"]=\"0px\")},Wn=(e,t)=>{if(e[\"margin-top\"]=\"0px\",e[\"margin-right\"]=\"0px\",e[\"margin-bottom\"]=\"0px\",e[\"margin-left\"]=\"0px\",e.right=\"auto\",e.bottom=\"auto\",delete e[\"margin-block-start\"],delete e[\"margin-block-end\"],delete e[\"margin-inline-start\"],delete e[\"margin-inline-end\"],delete e[\"inset-block-start\"],delete e[\"inset-block-end\"],delete e[\"inset-inline-start\"],delete e[\"inset-inline-end\"],t.contentOffsetLeftPx!==0||t.contentOffsetTopPx!==0)e.position=\"relative\",e.left=`${t.contentOffsetLeftPx}px`,e.top=`${t.contentOffsetTopPx}px`;else{e.top=\"auto\",e.left=\"auto\";let l=e.position;(l===\"fixed\"||l===\"absolute\"||l===\"sticky\")&&(e.position=\"relative\")}let r=t.rootLinearTransform;if(r){let{a:l,b:n,c:o,d:i}=r;e.transform=`matrix(${l}, ${n}, ${o}, ${i}, 0, 0)`,e[\"transform-origin\"]=\"0px 0px\"}else e.transform&&=\"none\";e.rotate&&=\"none\",e.scale&&=\"none\",e.translate&&=\"none\",e.float&&=\"none\",e.clear&&=\"none\",e[\"box-sizing\"]=\"border-box\",e.width=`${t.layoutWidthPx}px`,e.height=`${t.layoutHeightPx}px`,delete e[\"inline-size\"],delete e[\"block-size\"]},In=/\\/\\*[\\s\\S]*?\\*\\//g,Fn=e=>{let t=e.replace(In,\"\"),r=[],l=0;for(;l<t.length;){let n=t.indexOf(\"@font-face\",l);if(n===-1)break;let o=t.indexOf(\"{\",n);if(o===-1)break;let i=t.indexOf(\"}\",o);if(i===-1)break;r.push(`@font-face{${t.slice(o+1,i)}}`),l=i+1}return r},Fr=3e3,Ur=async(e,t)=>{let r=new AbortController,l=setTimeout(()=>r.abort(),t),n=setTimeout(()=>r.abort(),Math.min(t,Fr));try{let o=await fetch(e,{mode:\"cors\",cache:\"force-cache\",signal:r.signal});return clearTimeout(n),o.ok?await o.text():null}catch{return null}finally{clearTimeout(l),clearTimeout(n)}},Or=e=>e.type===CSSRule.FONT_FACE_RULE,wt=e=>e?e.split(\",\").map(t=>t.trim().replace(/^[\"']|[\"']$/g,\"\").toLowerCase()).filter(t=>t.length>0&&!Cl.has(t)):[],zr=e=>{let t=e.trim().toLowerCase();return t===\"\"||t===\"auto\"||t===\"normal\"?\"normal\":t===\"italic\"?\"italic\":t===\"oblique\"||t.startsWith(\"oblique \")?\"oblique\":null},Un={normal:400,bold:700},qt=e=>{let t=Un[e];if(t!==void 0)return t;let r=Number(e);return Number.isFinite(r)&&r>=1&&r<=1e3?r:null},Kr=e=>{let t=e.trim().toLowerCase();if(t===\"\"||t===\"auto\")return{minWeight:400,maxWeight:400};let r=t.split(/\\s+/);if(r.length>2)return null;let l=qt(r[0]);if(l===null)return null;if(r.length===1)return{minWeight:l,maxWeight:l};let n=qt(r[1]);return n===null?null:{minWeight:Math.min(l,n),maxWeight:Math.max(l,n)}},On=/url\\(\\s*(?:\"((?:\\\\.|[^\"\\\\])*)\"|'((?:\\\\.|[^'\\\\])*)'|([^'\"()\\s][^()]*?))\\s*\\)/g,zn=e=>e.replace(/\\\\(.)/g,\"$1\"),Kn=e=>e.replace(/([\"\\\\])/g,\"\\\\$1\"),jn=e=>{let t=e[3];return t===void 0?zn(e[1]??e[2]??\"\"):t},xt=async(e,t)=>{let r=[...e.matchAll(On)];if(r.length===0)return e;let l=await Promise.all(r.map(i=>t(jn(i)))),n=\"\",o=0;return r.forEach((i,a)=>{let s=i.index??0;n+=`${e.slice(o,s)}url(\"${Kn(l[a]??\"\")}\")`,o=s+i[0].length}),n+=e.slice(o),n},Hn={normal:[\"normal\",\"oblique\",\"italic\"],italic:[\"italic\",\"oblique\",\"normal\"],oblique:[\"oblique\",\"italic\",\"normal\"]},_e=(e,t)=>t>=e.minWeight&&t<=e.maxWeight?0:t<e.minWeight?e.minWeight-t:t-e.maxWeight,_t=(e,t)=>e.minWeight>t,qn=(e,t,r)=>{let l=e.filter(u=>_e(t[u],r)===0);if(l.length>0)return l;let n=e.filter(u=>!_t(t[u],r)),o=e.filter(u=>_t(t[u],r)),i=u=>{let d=1/0;for(let f of u)d=Math.min(d,_e(t[f],r));return u.filter(f=>_e(t[f],r)===d)},a=r>500,s=a?o:n,c=a?n:o;if(r>=400&&r<=500){let u=o.filter(d=>t[d].minWeight<=500);return u.length>0?i(u):n.length>0?i(n):i(o)}return s.length>0?i(s):i(c)},_n=(e,t)=>{let r=new Set,l=e.map((n,o)=>o);for(let n of t){let o=[];for(let i of Hn[n.styleKeyword])if(o=l.filter(a=>e[a].styleKeyword===i),o.length>0)break;if(o.length!==0)for(let i of qn(o,e,n.weight))r.add(i)}return r},Yn=e=>{if(typeof e.toBase64==\"function\")return e.toBase64();let t=\"\";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)},nt=async e=>{let t=new Uint8Array(await e.arrayBuffer());return`data:${e.type||\"application/octet-stream\"};base64,${Yn(t)}`},Gn=async(e,t)=>{let r=new AbortController,l=setTimeout(()=>r.abort(),t),n=setTimeout(()=>r.abort(),Math.min(t,Fr));try{let o=await fetch(e,{mode:\"cors\",cache:\"force-cache\",signal:r.signal});return clearTimeout(n),o.ok?await nt(await o.blob()):null}catch{return null}finally{clearTimeout(l),clearTimeout(n)}},Yt=se(150),Ye=new Map,jr=0,Qn=()=>jr,le=(e,t)=>{let r=Yt.get(e);if(r!==void 0)return Promise.resolve(r);let l=`${t}:${e}`,n=Ye.get(l);if(n)return n;let o=Gn(e,t).then(i=>(Ye.delete(l),i!==null&&(jr++,Yt.set(e,i)),i));return Ye.set(l,o),o},Xn=/font-family\\s*:\\s*([^;}]+)/i,Zn=/font-weight\\s*:\\s*([^;}]+)/i,Jn=/font-style\\s*:\\s*([^;}]+)/i,eo=/font-stretch\\s*:\\s*([^;}]+)/i,to=/unicode-range\\s*:\\s*([^;}]+)/i,ro=/font-variation-settings\\s*:/i,lo=e=>{let t=e.trim().toLowerCase();return t===\"\"||t===\"normal\"||t===\"auto\"},no=e=>{let t={ruleSources:[],inaccessibleSheetUrls:[]};return oe(e,(r,l)=>(Or(r)&&t.ruleSources.push({rule:r,baseUrl:l}),!1),r=>(r&&t.inaccessibleSheetUrls.push(r),!1)),t},oo=(e,t,r)=>xt(e,async l=>l.startsWith(\"data:\")?l:await le(we(l,t),r)??l),Hr=(e,t,r,l,n,o,i,a)=>{let s=Kr(l),c=zr(n);return{familyName:e,fontFaceCssText:t,baseUrl:r,weightRange:s,styleKeyword:c,unicodeRangeKey:i.trim().toLowerCase().replace(/\\s+/g,\"\"),isPrunable:s!==null&&c!==null&&lo(o)&&!a}},io=async(e,t,r)=>{let l=await Ur(e,r);if(!l)return[];let n=[];for(let o of Fn(l)){let[i]=wt(Xn.exec(o)?.[1]);!i||!t.has(i)||/url\\(|local\\(/.test(o)&&n.push(Hr(i,o,e,Zn.exec(o)?.[1]??\"\",Jn.exec(o)?.[1]??\"\",eo.exec(o)?.[1]??\"\",to.exec(o)?.[1]??\"\",ro.test(o)))}return n},ao=e=>{let t=new Set;for(let r of e)for(let l of[r.baseStyles,r.beforeStyles,r.afterStyles,r.firstLetterStyles,r.markerStyles])if(l)for(let n of wt(l[\"font-family\"]))t.add(n);return t},so=e=>{let t=new Set([400,700]),r=new Set([\"normal\",\"italic\"]);for(let n of e)for(let o of[n.baseStyles,n.beforeStyles,n.afterStyles,n.firstLetterStyles,n.markerStyles]){if(!o)continue;let i=o[\"font-weight\"];if(i!==void 0){let s=Kr(i);if(s===null||s.minWeight!==s.maxWeight)return null;t.add(s.minWeight)}let a=o[\"font-style\"];if(a!==void 0){let s=zr(a);if(s===null)return null;r.add(s)}}let l=[];for(let n of t)for(let o of r)l.push({weight:n,styleKeyword:o});return l},uo=(e,t)=>{if(t===null)return e;let r=new Set;for(let o of e)o.isPrunable||r.add(o.familyName);let l=new Map;e.forEach((o,i)=>{if(r.has(o.familyName))return;let a=`${o.familyName}\\0${o.unicodeRangeKey}`,s=l.get(a);s===void 0?l.set(a,[i]):s.push(i)});let n=new Set;for(let o of l.values()){let i=o.map(a=>{let s=e[a];return{minWeight:s.weightRange?.minWeight??400,maxWeight:s.weightRange?.maxWeight??400,styleKeyword:s.styleKeyword??\"normal\"}});for(let a of _n(i,t))n.add(o[a])}return e.filter((o,i)=>r.has(o.familyName)||n.has(i))},co=async(e,t,r,l=null)=>{if(e.size===0)return\"\";let{ruleSources:n,inaccessibleSheetUrls:o}=no(t),i=[];for(let{rule:c,baseUrl:u}of n){let[d]=wt(c.style.getPropertyValue(\"font-family\"));if(!d||!e.has(d))continue;let f=c.cssText;/url\\(|local\\(/.test(f)&&i.push(Hr(d,f,u,c.style.getPropertyValue(\"font-weight\"),c.style.getPropertyValue(\"font-style\"),c.style.getPropertyValue(\"font-stretch\"),c.style.getPropertyValue(\"unicode-range\"),c.style.getPropertyValue(\"font-variation-settings\")!==\"\"))}let a=await Promise.all(o.map(c=>io(c,e,r))),s=uo(i.concat(...a),l);return(await Promise.all(s.map(c=>oo(c.fontFaceCssText,c.baseUrl,r)))).filter(c=>c.length>0).join(`\n`)},kt=e=>{let t=e.defaultView,r=e.documentElement;return!t||!r?null:[t.getComputedStyle(r).backgroundColor,e.body?t.getComputedStyle(e.body).backgroundColor:\"\"].find(l=>l&&l!==\"rgba(0, 0, 0, 0)\")??null},qr=e=>typeof e==\"object\"&&!!e,fo=e=>{if(!qr(e))return null;let{type:t,requestId:r,pixelRatio:l}=e;return t!==\"fast-html-to-image:iframe-capture-request\"||typeof r!=\"string\"||r.length===0||typeof l!=\"number\"||!Number.isFinite(l)||l<=0?null:{type:t,requestId:r,pixelRatio:l}},po=e=>{if(!qr(e))return null;let{type:t,requestId:r,pngDataUrl:l,widthPx:n,heightPx:o,backgroundColor:i}=e;return t!==\"fast-html-to-image:iframe-capture-response\"||typeof r!=\"string\"||r.length===0||typeof l!=\"string\"||!l.startsWith(\"data:image/\")||typeof n!=\"number\"||!Number.isFinite(n)||n<=0||typeof o!=\"number\"||!Number.isFinite(o)||o<=0||i!==null&&typeof i!=\"string\"?null:{type:t,requestId:r,pngDataUrl:l,widthPx:n,heightPx:o,backgroundColor:i}},ho=(e,t)=>{let r=e.contentWindow;if(!r)return Promise.resolve(null);let l=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;return new Promise(n=>{let o=c=>{window.clearTimeout(a),window.removeEventListener(\"message\",i),n(c)},i=c=>{if(c.source!==r)return;let u=po(c.data);!u||u.requestId!==l||o({pngDataUrl:u.pngDataUrl,widthPx:u.widthPx,heightPx:u.heightPx,canvasBackgroundColor:u.backgroundColor})},a=window.setTimeout(()=>o(null),2e3);window.addEventListener(\"message\",i);let s={type:\"fast-html-to-image:iframe-capture-request\",requestId:l,pixelRatio:t};r.postMessage(s,\"*\")})},mo=e=>{let t=!1,r=l=>{let n=fo(l.data),o=l.source;!n||!o||t||(t=!0,e(n.pixelRatio).then(i=>{o.postMessage({type:\"fast-html-to-image:iframe-capture-response\",requestId:n.requestId,pngDataUrl:i.pngDataUrl,widthPx:i.widthPx,heightPx:i.heightPx,backgroundColor:kt(document)},{targetOrigin:\"*\"})}).catch(()=>{}).finally(()=>{t=!1}))};return window.addEventListener(\"message\",r),()=>window.removeEventListener(\"message\",r)},Ge=e=>e.length>0&&!e.startsWith(\"data:\")&&!e.startsWith(\"#\")&&!e.startsWith(\"about:\"),ot=(e,t)=>{let r=e.matches(t)?[e]:[];return r.push(...e.querySelectorAll(t)),r},go=e=>{let t=new Map;for(let n of ot(e,\"img\")){let o=n.getAttribute(\"src\");o&&o.length>=1024&&o.startsWith(\"data:\")&&(t.get(o)??t.set(o,[]).get(o)).push(n)}let r=\"\",l=0;for(let[n,o]of t){if(o.length<2)continue;let i=`fhti-img-${++l}`;r+=`img.${i}{content:url(\"${n.replace(/[\\\\\"]/g,a=>`\\\\${a}`)}\")}\n`;for(let a of o)a.classList.add(i),a.setAttribute(\"src\",\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\")}return r},yo=async(e,t,r)=>{let l=[];for(let n of ot(e,\"img\")){let o=n.getAttribute(\"src\");!o||!Ge(o)||l.push(le(o,r).then(i=>{n.setAttribute(\"src\",i??\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\")}))}for(let n of ot(e,\"image\")){let o=n.getAttribute(\"href\")??n.getAttributeNS(\"http://www.w3.org/1999/xlink\",\"href\");!o||!Ge(o)||l.push(le(o,r).then(i=>{let a=i??\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\";n.setAttribute(\"href\",a),n.hasAttributeNS(\"http://www.w3.org/1999/xlink\",\"href\")&&n.setAttributeNS(wr,\"xlink:href\",a)}))}for(let n of t)for(let o of[n.baseStyles,n.beforeStyles,n.afterStyles,n.firstLetterStyles,n.markerStyles])if(o)for(let i in o){let a=o[i];a===void 0||!a.includes(\"url(\")||(n.cachedBlocks=null,l.push(xt(a,async s=>Ge(s)?await le(s,r)??\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=\":s).then(s=>{o[i]=s})))}await Promise.allSettled(l)},Gt=/url\\(\\s*[\"']?#([^\"')\\s]+)[\"']?\\s*\\)/g,bo=e=>e.getAttribute(\"href\")??e.getAttributeNS(\"http://www.w3.org/1999/xlink\",\"href\"),Qt=(e,t)=>{e.id&&t.add(e.id);for(let r of e.querySelectorAll(\"[id]\"))t.add(r.id)},wo=(e,t)=>{let r=e.matches(t)?[e]:[];return r.push(...e.querySelectorAll(t)),r},xo=async({clone:e,rules:t,sourceDocument:r,timeoutMs:l})=>{let n=new Set;Qt(e,n);let o=new Set,i=[],a=new Map,s=(p,y)=>{n.has(p)||o.has(p)||(o.add(p),i.push({fragmentId:p,lookupDocuments:y}))},c=(p,y,k)=>{for(let x of wo(p,\"use\")){let w=bo(x);if(w){if(w.startsWith(\"#\"))s(w.slice(1),y);else if(k&&w.includes(\"#\")){let[g,E]=w.split(\"#\");if(!E)continue;let B=we(g,r.baseURI),M=a.get(B)??[];M.push({fragmentId:E,useElement:x}),a.set(B,M)}}}let A=x=>{if(x.namespaceURI===\"http://www.w3.org/2000/svg\"){for(let w of x.attributes)if(w.value.includes(\"url(\"))for(let g of w.value.matchAll(Gt))s(g[1],y)}};A(p);for(let x of p.querySelectorAll(\"*\"))A(x)},u=null,d=()=>{if(u)return u;let p=e.ownerDocument,y=p.createElementNS(X,\"svg\");return y.setAttribute(\"aria-hidden\",\"true\"),y.setAttribute(\"style\",\"position:absolute;width:0;height:0;overflow:hidden;\"),u=p.createElementNS(X,\"defs\"),y.appendChild(u),e.appendChild(y),u},f=()=>{for(;i.length>0;){let p=i.pop();if(!p)break;if(n.has(p.fragmentId))continue;let y=null;for(let A of p.lookupDocuments){let x=A.getElementById(p.fragmentId);if(x&&x.namespaceURI===\"http://www.w3.org/2000/svg\"){y=x;break}}if(!y)continue;let k=y.cloneNode(!0);H(k)&&(Br(k),d().appendChild(k),Qt(k,n),c(k,p.lookupDocuments,!1))}};c(e,[r],!0);for(let p of t){let y=[p.baseStyles,p.beforeStyles,p.afterStyles,p.firstLetterStyles];for(let k of y)if(k)for(let A of pl){let x=k[A];if(!(x===void 0||!x.includes(\"url(\")))for(let w of x.matchAll(Gt))s(w[1],[r])}}f();let m=[...a],b=await Promise.all(m.map(([p])=>Ur(p,l)));for(let p=0;p<m.length;p++){let y=m[p][1],k=b[p];if(k===null)continue;let A=new DOMParser().parseFromString(k,\"image/svg+xml\");if(!A.querySelector(\"parsererror\")){for(let{fragmentId:x,useElement:w}of y)s(x,[A,r]),w.setAttribute(\"href\",`#${x}`),w.hasAttributeNS(\"http://www.w3.org/1999/xlink\",\"href\")&&w.setAttributeNS(wr,\"xlink:href\",`#${x}`);f()}}},ne=e=>e.namespaceURI===br,ko=new Set([\"block\",\"list-item\",\"flex\",\"grid\",\"table\"]),At=e=>{let t=e.position;return t!==\"absolute\"&&t!==\"fixed\"&&(e.float===void 0||e.float===\"none\")},Ao=(e,t)=>{if(ne(e)&&e.style.paddingBottom!==\"\"){let r=e.ownerDocument.defaultView?.getComputedStyle(e);return R(r?.getPropertyValue(\"padding-bottom\"))}return R(t[\"padding-bottom\"])},vo=(e,t)=>{let r=t.display;return r!==\"block\"&&r!==\"list-item\"||!At(t)||t[\"overflow-x\"]!==\"visible\"||t[\"overflow-y\"]!==\"visible\"||R(t[\"border-bottom-width\"])!==0?!1:Ao(e,t)===0},So=e=>At(e)&&e.display!==void 0&&ko.has(e.display),Eo=(e,t,r)=>{let l=new Map,n=new Set,o=a=>{let s=ke(a);for(let c=s.length-1;c>=0;c--){let u=s[c];if(u.nodeType===Node.COMMENT_NODE)continue;if(u.nodeType===Node.TEXT_NODE){if(/\\S/.test(u.textContent??\"\"))return null;continue}if(!H(u))continue;let d=t.get(u);if(d&&d.styles.display!==\"none\"&&At(d.styles))return u}return null},i=a=>{let s=l.get(a);if(s!==void 0)return s;l.set(a,0);let c=t.get(a);if(!c||!vo(a,c.styles)||c.scrollTop!==0||c.scrollLeft!==0)return 0;let u=o(a);if(!u)return 0;let d=t.get(u);if(!d||!So(d.styles))return 0;let f=Math.max(R(d.styles[\"margin-bottom\"]),i(u));if(f<=0)return 0;let m=a.getBoundingClientRect().bottom,b=u.getBoundingClientRect().bottom;return Math.abs(m-b)>.6?0:(l.set(a,f),f)};for(let[a,s]of t){if(a===e)continue;let c=s.styles.display;if(c!==\"block\"&&c!==\"list-item\"||a.firstElementChild===null&&!a.shadowRoot)continue;let u=i(a);if(u<=0||u<=R(s.styles[\"margin-bottom\"]))continue;let d=r.get(a);d&&(r.set(a,{...d,\"margin-bottom\":`${u}px`}),n.add(a))}return n},De=e=>{if(e.parentElement)return e.parentElement;let t=e.parentNode;return t instanceof ShadowRoot?t.host:null},Xt=(e,t,r)=>({layoutWidthPx:e,layoutHeightPx:t,outputWidthPx:e+2*r,outputHeightPx:t+2*r,contentOffsetLeftPx:r,contentOffsetTopPx:r,rootLinearTransform:null}),Co=({rootElement:e,rootStyles:t,defaultView:r,layoutWidthPx:l,layoutHeightPx:n,bleedPx:o})=>{if(!ne(e))return Xt(l,n,o);let i=tt({transform:t.transform,rotate:t.rotate,scale:t.scale}),a=De(e);for(;a;){let A=r.getComputedStyle(a);i=Be(tt({transform:A.getPropertyValue(\"transform\"),rotate:A.getPropertyValue(\"rotate\"),scale:A.getPropertyValue(\"scale\")}),i),a=De(a)}if(Er(i))return Xt(l,n,o);let{a:s,b:c,c:u,d}=i,f=[0,s*l,u*n,s*l+u*n],m=[0,c*l,d*n,c*l+d*n],b=Math.floor(Math.min(...f)),p=Math.floor(Math.min(...m)),y=Math.ceil(Math.max(...f)),k=Math.ceil(Math.max(...m));return{layoutWidthPx:l,layoutHeightPx:n,outputWidthPx:Math.max(1,y-b)+2*o,outputHeightPx:Math.max(1,k-p)+2*o,contentOffsetLeftPx:-b+o,contentOffsetTopPx:-p+o,rootLinearTransform:i}},Mo=[137,80,78,71,13,10,26,10],fe=null,$o=()=>{if(fe!==null)return fe;fe=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;fe[e]=t}return fe},Po=(e,t,r)=>{let l=$o(),n=4294967295;for(let o=t;o<r;o++)n=l[(n^e[o])&255]^n>>>8;return(n^4294967295)>>>0},Qe=(e,t)=>{let r=new Uint8Array(12+t.length),l=new DataView(r.buffer);l.setUint32(0,t.length);for(let n=0;n<4;n++)r[4+n]=e.charCodeAt(n);return r.set(t,8),l.setUint32(8+t.length,Po(r,4,8+t.length)),r},No=(e,t,r)=>{let l=t*4,n=new Uint8Array((l+1)*r),o=0;for(let i=0;i<r;i++)o++,n.set(e.subarray(i*l,(i+1)*l),o),o+=l;return n},Ro=(e,t,r)=>{let l=new Uint8Array((t*3+1)*r),n=0,o=0;for(let i=0;i<r;i++){l[o++]=0;for(let a=0;a<t;a++){if(e[n+3]!==255)return null;l[o]=e[n],l[o+1]=e[n+1],l[o+2]=e[n+2],n+=4,o+=3}}return l},Bo=async e=>{let t=new CompressionStream(\"deflate\"),r=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await r.arrayBuffer())},To=async e=>{let t=e.getContext(\"2d\");if(t===null)throw Error(\"Could not acquire a 2d canvas context\");let{width:r,height:l}=e,n=t.getImageData(0,0,r,l),o=Ro(n.data,r,l),i=await Bo(o??No(n.data,r,l)),a=new Uint8Array(13),s=new DataView(a.buffer);return s.setUint32(0,r),s.setUint32(4,l),a[8]=8,a[9]=o===null?6:2,new Blob([new Uint8Array(Mo),Qe(\"IHDR\",a),Qe(\"IDAT\",i),Qe(\"IEND\",new Uint8Array)],{type:\"image/png\"})},Le=()=>typeof CSS<\"u\"&&CSS.supports(\"-webkit-hyphenate-limit-after\",\"1\"),_r=(e,t,r)=>{let l=e.toDataURL(t,r);if(!l.startsWith(`data:${t};base64,`))throw Error(`canvas could not encode ${t}`);let n=atob(l.slice(l.indexOf(\",\")+1)),o=new Uint8Array(n.length);for(let i=0;i<n.length;i++)o[i]=n.charCodeAt(i);return new Blob([o],{type:t})},Zt=async e=>_r(e,\"image/png\"),Do=e=>Le()&&typeof CompressionStream<\"u\"?To(e).catch(()=>Zt(e)):Zt(e),Lo=async(e,t)=>_r(e,\"image/jpeg\",t),Vo={\"%\":\"%25\",\"#\":\"%23\",\"\\r\":\"%0D\",\"\\n\":\"%0A\",\"\t\":\"%09\"},Wo=e=>`data:image/svg+xml;charset=utf-8,${e.replace(/[%#\\r\\n\\t]/g,t=>Vo[t])}`,Io=()=>typeof CSS<\"u\"&&CSS.supports(\"-webkit-app-region\",\"none\"),it=async(e,t)=>{if(!t)return e;t.throwIfAborted();let r,l=new Promise((n,o)=>{let i=()=>o(t.reason);t.addEventListener(\"abort\",i,{once:!0}),r=()=>t.removeEventListener(\"abort\",i)});try{return await Promise.race([e,l])}finally{r?.()}},Fo=async e=>{for(let t=0;t<e;t++)await new Promise(r=>{let l,n=requestAnimationFrame(()=>{clearTimeout(l),r()});l=setTimeout(()=>{cancelAnimationFrame(n),r()},100)})},Y={snapshotMs:0,iframesMs:0,backdropMs:0,buildMs:0,inlineMs:0,serializeMs:0,decodeMs:0,rasterMs:0,encodeMs:0},Jt=se(2),Xe=se(2),er=null,at=!1,tr=()=>at?null:(er??=document.createElement(\"canvas\"),at=!0,er),rr=()=>{at=!1},st=(e,t,r,l,n=null)=>{let o=Wo(e),i=e.includes(\"data:image\")||e.includes(\"background-clip:text\"),a=()=>{let b=Xe.get(o);if(b)return b;let p=(async()=>{let y=performance.now(),k=new Image;return k.decoding=\"sync\",k.src=o,await k.decode(),!Io()&&i&&await Fo(2),Y.decodeMs=performance.now()-y,k})();return Xe.set(o,p),p.catch(()=>{Xe.delete(o)}),p},s=n?Math.max(1,Math.ceil(n.width)):t,c=n?Math.max(1,Math.ceil(n.height)):r,u=async(b,p)=>{let y=await it(a(),l.abortSignal),k=performance.now(),A=l.scale*l.pixelRatio,x=Math.ceil(s*A),w=Math.ceil(c*A),g=Math.min(1,16384/Math.max(1,x),16384/Math.max(1,w)),E=Math.max(1,Math.floor(x*g)),B=Math.max(1,Math.floor(w*g)),M=b.getContext(\"2d\",Le()?{willReadFrequently:!0}:void 0);if(!M)throw Error(\"Could not acquire a 2d canvas context\");b.width!==E||b.height!==B?(b.width=E,b.height=B):(M.setTransform(1,0,0,1,0,0),M.clearRect(0,0,E,B));let P=l.backgroundColor??p;return P&&(M.fillStyle=P,M.fillRect(0,0,E,B)),M.scale(A*g,A*g),n&&M.translate(-n.x,-n.y),M.drawImage(y,0,0,t,r),Y.rasterMs=performance.now()-k,b},d=()=>u(document.createElement(\"canvas\")),f=()=>{let b=n?`${n.x},${n.y},${n.width},${n.height}`:\"\",p=`${l.scale}|${l.pixelRatio}|${l.backgroundColor??\"\"}|${t}|${r}|${b}`,y=Jt.get(e),k=y?.get(p);if(k)return k;let A=tr(),x=u(A??document.createElement(\"canvas\")).then(async g=>{let E=performance.now(),B=await Do(g);return Y.encodeMs=performance.now()-E,B}).finally(()=>{A!==null&&rr()});y===void 0&&(y=new Map,Jt.set(e,y));let w=y;return w.set(p,x),x.catch(()=>{w.delete(p)}),x},m=async(b=.92)=>{let p=tr();try{let y=await u(p??document.createElement(\"canvas\"),\"#ffffff\"),k=performance.now(),A=await Lo(y,b);return Y.encodeMs=performance.now()-k,A}finally{p!==null&&rr()}};return{width:s,height:c,toSvgDataUrl:()=>Promise.resolve(o),toCanvas:d,toBlob:f,toJpegBlob:m,toPngDataUrl:async()=>nt(await f()),toJpegDataUrl:async b=>nt(await m(b))}},Uo=({clone:e,cssText:t,width:r,height:l,clip:n,ownerDocument:o})=>{let i=o.createElementNS(X,\"svg\");i.setAttribute(\"width\",String(n?n.width:r)),i.setAttribute(\"height\",String(n?n.height:l)),i.setAttribute(\"viewBox\",n?`${n.x} ${n.y} ${n.width} ${n.height}`:`0 0 ${r} ${l}`);let a=o.createElementNS(X,\"style\");a.textContent=`*{scrollbar-width:none}\n*::-webkit-scrollbar{display:none}\nforeignObject>div{-webkit-text-size-adjust:100%!important}\n${t}`;let s=o.createElementNS(X,\"foreignObject\");s.setAttribute(\"width\",String(r)),s.setAttribute(\"height\",String(l));let c=o.createElementNS(br,\"div\");return c.setAttribute(\"style\",`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${r}px;height:${l}px;`),c.appendChild(e),s.appendChild(c),i.appendChild(a),i.appendChild(s),Z(new XMLSerializer().serializeToString(i))},ut=e=>e.length>0&&!e.startsWith(\"data:\")&&!e.startsWith(\"#\")&&!e.startsWith(\"about:\"),lr=(e,t,r)=>{e.includes(\"url(\")&&xt(e,l=>{if(!l.startsWith(\"data:\")){let n=we(l,t);ut(n)&&le(n,r)}return Promise.resolve(l)})},Oo=(e,t)=>{for(let r of e.querySelectorAll(\"img\")){let l=r.getAttribute(\"src\");l&&ut(l)&&le(l,t)}for(let r of e.querySelectorAll(\"image\")){let l=r.getAttribute(\"href\")??r.getAttributeNS(\"http://www.w3.org/1999/xlink\",\"href\");l&&ut(l)&&le(l,t)}for(let r of e.querySelectorAll('[style*=\"url(\"]'))lr(r.getAttribute(\"style\")??\"\",null,t);oe(e.ownerDocument,(r,l)=>((Or(r)||be(r))&&lr(r.cssText,l,t),!1),()=>!1)},zo=(e,t,r)=>Re.has(e)&&t!==\"\"&&r===\"\"&&!t.includes(\"url(\")&&!t.includes(\"var(\"),Ko=(e,t,r)=>{let l=e.getPropertyValue(\"backdrop-filter\")!==\"\"||e.getPropertyValue(\"-webkit-backdrop-filter\")!==\"\",n=\"\",o=\"\",i=\"\";for(let a=0;a<e.length;a++){let s=e.item(a);if(t.has(s))continue;let c=e.getPropertyValue(s),u=e.getPropertyPriority(s),d=`|${s}:${c}!${u}`;i+=d,!l&&zo(s,c,u)?(n+=`${s}:${c};`,o+=`|~${s}`):o+=d}return r?.includes(\"var(\")&&(o+=`|style=${r}`,i+=`|style=${r}`),{carryText:Z(n),descriptorWithCarry:o,descriptorPlain:i,registryFeed:null}},Yr=[\"margin-top\",\"margin-left\"],nr=new WeakMap;function jo(e){let t=[],r=l=>{for(let n of l)if(n.selectorText!==void 0){let o=n.style;[\"margin\",\"margin-top\",\"margin-left\",\"margin-block-start\",\"margin-inline-start\"].some(i=>/\\bauto\\b/.test(o.getPropertyValue(i)))&&t.push(n.selectorText)}else n.cssRules&&r(n.cssRules)};for(let l of e.styleSheets)try{r(l.cssRules)}catch{}return t}function Ho(e,t,r){let l=nr.get(r);if(l===void 0&&(l=jo(e.ownerDocument),nr.set(r,l)),!l.some(o=>{try{return e.matches(o)}catch{return!1}}))return[];let n=[];for(let o of Yr){if(t.getPropertyValue(o)!==\"0px\")continue;let i=e.getBoundingClientRect(),a=e.getAttribute(\"style\");e.style.setProperty(o,\"0px\",\"important\");let s=e.getBoundingClientRect();a===null?e.removeAttribute(\"style\"):e.setAttribute(\"style\",a),(Math.abs(s.top-i.top)>.5||Math.abs(s.left-i.left)>.5)&&n.push(o)}return n}function qo(e,t,r){if(typeof e.computedStyleMap!=\"function\")return Ho(e,t,r);let l=e.computedStyleMap();return Yr.filter(n=>t.getPropertyValue(n)===\"0px\"&&String(l.get(n))===\"auto\")}function _o(e,t,r,l){let n=l.getComputedStyle(e);if(n.display===\"none\")return null;let o=null;if(t!==null&&(r.get(t)?.styles.display??\"\").includes(\"grid\")&&(n.getPropertyValue(\"margin-top\")===\"0px\"||n.getPropertyValue(\"margin-left\")===\"0px\")&&e.getClientRects().length>0)for(let i of qo(e,n,r))(o??={})[i]=\"auto\";if(/flex/.test(n.display)&&n.flexWrap.startsWith(\"wrap\")&&n.flexDirection.startsWith(\"row\")){let i=[...e.children].filter(a=>{let s=l.getComputedStyle(a),c=a.getBoundingClientRect();return s.display!==\"none\"&&s.position!==\"absolute\"&&s.position!==\"fixed\"&&c.width>0&&c.height>0});if(i.length>1){let a=i[0].getBoundingClientRect().top;i.every(s=>Math.abs(s.getBoundingClientRect().top-a)<.5)&&((o??={})[\"flex-wrap\"]=\"nowrap\")}}return o}var Yo=null,or=new Map,ct=e=>{let t=or.get(e);if(t!==void 0)return t;let r=Yo??=document.createElement(\"span\").style;r.setProperty(e,\"initial\");let l=r.length>1?Array.from({length:r.length},(n,o)=>r.item(o)):[e];return r.cssText=\"\",or.set(e,l),l},Go=null,$e=new Map,Qo=e=>{let t=`${e.propertyName}:${e.propertyValue}`,r=$e.get(t);if(r!==void 0)return r.length===0||r[0].isImportant===e.isImportant?r:r.map(o=>({...o,isImportant:e.isImportant}));let l=Go??=document.createElement(\"span\").style;l.cssText=t;let n=[];for(let o=0;o<l.length;o++){let i=l.item(o);n.push({propertyName:i,propertyValue:l.getPropertyValue(i),isImportant:e.isImportant})}return l.cssText=\"\",$e.size>=4096&&$e.clear(),$e.set(t,n),n},Xo=(e,t)=>{let r=!1,l=[];for(let s of e){let c=s.propertyName;(c===\"backdrop-filter\"||c===\"-webkit-backdrop-filter\")&&(r=!0);for(let u of ct(c))l.push([u,s.propertyValue])}let n=\"\",o=\"\",i=\"\",a=(s,c)=>{let u=s.isImportant?\"important\":\"\",d=`|${s.propertyName}:${s.propertyValue}!${u}`;i+=d,c?(n+=`${s.propertyName}:${s.propertyValue};`,o+=`|~${s.propertyName}`):o+=d};for(let s of e){let c=ct(s.propertyName),u=!0,d=!0;for(let m of c)t.has(m)||(u=!1),Re.has(m)||(d=!1);if(u)continue;let f=!s.isImportant&&!r;if(c.length>1&&!d){for(let m of Qo(s))t.has(m.propertyName)||a(m,f&&Re.has(m.propertyName));continue}a(s,f&&d)}return{carryText:n,descriptorWithCarry:o,descriptorPlain:i,registryFeed:l}},Gr=e=>{if(wl.test(e))return null;let t=[],r=e.length,l=0;for(;l<=r;){let n=e.indexOf(\";\",l);n===-1&&(n=r);let o=e.slice(l,n);l=n+1;let i=o.indexOf(\":\");if(i===-1){if(o.trim()!==\"\")return null;continue}let a=o.slice(0,i).trim().toLowerCase();if(a===\"\"||a.startsWith(\"--\"))return null;let s=o.slice(i+1).trim(),c=!1;s.includes(\"!\")&&/!\\s*important$/i.test(s)&&(c=!0,s=s.slice(0,s.lastIndexOf(\"!\")).trim()),s!==\"\"&&t.push({propertyName:a,propertyValue:s,isImportant:c})}return t},Zo=(e,t,r)=>{let l=e.localName,n=e.attributes,o=t===null||e.shadowRoot!==null;for(let i=0;i<n.length;i++){let a=n[i],s=a.name;s!==\"style\"&&(!o&&!t.has(s)||(l+=`|${s}=${a.value}`))}return l+r},Jo=e=>\"style\"in e&&e.style instanceof CSSStyleDeclaration,ei=e=>{let t=new Set,r=[],l=(i,a)=>{let s=`${i}|${a}`;t.has(s)||(t.add(s),r.push([i,a]))},n=new Set,o=i=>{let a=i.getAttribute(\"style\");if(a===null||n.has(a))return;n.add(a);let s=Gr(a);if(s!==null){for(let u of s)for(let d of ct(u.propertyName))l(d,u.propertyValue);return}if(!Jo(i))return;let c=i.style;for(let u=0;u<c.length;u++){let d=c.item(u);l(d,c.getPropertyValue(d))}};o(e);for(let i of e.querySelectorAll(\"[style]\"))o(i);return r},Qr=e=>El.has(e.localName),ti=e=>sl.has(e.transform??\"\")&&ul.has(e.position??\"\"),ri=new Set([\"top\",\"right\",\"bottom\",\"left\"]),li=new Set([\"width\",\"height\"]),ni=e=>{let t=e.includes(\"display\"),r=e.includes(\"position\");return e.map(l=>l===\"inline-size\"?1:l===\"block-size\"?2:l===\"transform-origin\"?3:l===\"perspective-origin\"?4:!t&&(l===\"grid-template-columns\"||l===\"grid-template-rows\")?5:!r&&ri.has(l)?6:!t&&li.has(l)?7:0)},vt=(e,t,r,l,n=null,o=!1)=>{for(let i=0;i<r.length;i++){if(n!==null&&n[i])continue;let a=l[i];if(a!==0){if(a===1){if(e[\"writing-mode\"]===\"horizontal-tb\"){e[\"inline-size\"]=e.width;continue}}else if(a===2){if(e[\"writing-mode\"]===\"horizontal-tb\"){e[\"block-size\"]=e.height;continue}}else if(a===3){if(e.transform===\"none\")continue}else if(a===4){if((e.perspective??\"none\")===\"none\")continue}else if(a===6){if((e.position??\"static\")===\"static\")continue}else if(a===7){if(o&&e.display===\"inline\")continue;let d=r[i],f=d===\"width\"?t.width:t.height,m=f===\"\"?void 0:ae(d,f);e[d]!==m&&(e[d]=m);continue}else if(!(e.display??\"\").includes(\"grid\"))continue}let s=r[i],c=ae(s,t.getPropertyValue(s)),u=c===\"\"?void 0:c;e[s]!==u&&(e[s]=u)}},oi=e=>{let t=0,r={definesBeforeAfter:!1,definesFirstLetter:!1,definesMarker:!1},l=()=>(r.definesBeforeAfter=!0,r.definesFirstLetter=!0,r.definesMarker=!0,!0);return oe(e,n=>{if(t++,t>1e3)return l();if(be(n)){let o=n.selectorText;(o.includes(\":before\")||o.includes(\":after\"))&&(r.definesBeforeAfter=!0),o.includes(\":first-letter\")&&(r.definesFirstLetter=!0),o.includes(\":marker\")&&(r.definesMarker=!0)}return r.definesBeforeAfter&&r.definesFirstLetter&&r.definesMarker},l),r},ir=(e,t,r,l)=>{let n=r.getComputedStyle(e,t),o=n.getPropertyValue(\"content\");if(o===\"\"||o===\"none\"||o===\"normal\")return null;let i=Q(n,l);return i.content=o,i},ar=(e,t,r,l,n,o,i)=>{if(!o)return null;let a=r.getComputedStyle(e,t),s=Object.create(o);return vt(s,a,l,n,i,!0),s},sr=(e,t,r,l,n,o,i,a)=>{let s=r.getComputedStyle(e,t),c=s.getPropertyValue(\"content\");if(c===\"\"||c===\"none\"||c===\"normal\")return null;if(!i){let d=Q(s,l);return d.content=c,d}let u=Object.create(i);return vt(u,s,n,o,a,!0),u.content=c,u},ii=(e,t)=>e.firstChild?Vr(t.getComputedStyle(e,\"::first-letter\"),Zr):null,ai=(e,t)=>{let r=t.getComputedStyle(e,\"::marker\"),l=Vr(r,Ln),n=r.getPropertyValue(\"content\");return n&&(l.content=n),l},si=e=>e instanceof CSSKeyframesRule,ui=e=>\"containerName\"in e||\"start\"in e,ci=/::?(?:before|after|first-letter|first-line|marker|selection|placeholder|backdrop|root|-webkit-[a-z-]+)\\b/g,di=/[[+~:]/,fi=e=>!di.test(e.replace(ci,\"\")),Xr=e=>{let t=[],r={counterCss:\"\",placeholder:!1,fileButton:!1,firstLine:!1,sliderThumb:!1,thumbRules:[]};return oe(e,l=>{if(l.type===CSSRule.COUNTER_STYLE_RULE||l.type===CSSRule.FONT_FEATURE_VALUES_RULE)return t.push(l.cssText),!1;if(be(l)){let n=l.selectorText;if(n.includes(\"::placeholder\")&&(r.placeholder=!0),n.includes(\"::file-selector-button\")&&(r.fileButton=!0),n.includes(\"::first-line\")&&(r.firstLine=!0),n.includes(\"::-webkit-slider-thumb\")){r.sliderThumb=!0;let o=[];for(let i of Ve(n)){let a=i.indexOf(\"::-webkit-slider-thumb\");a!==-1&&o.push(i.slice(0,a).trim())}o.length>0&&r.thumbRules.push({bases:o,style:l.style})}}return!1},()=>!1),r.counterCss=t.join(`\n`),r},pi=[\"font-family\",\"font-size\",\"font-style\",\"font-variant\",\"font-variant-caps\",\"font-weight\",\"font-stretch\",\"font-feature-settings\",\"font-variation-settings\",\"font-kerning\",\"font-optical-sizing\",\"font-synthesis\",\"line-height\",\"color\",\"background-color\",\"background-image\",\"letter-spacing\",\"word-spacing\",\"text-decoration-line\",\"text-decoration-color\",\"text-decoration-style\",\"text-decoration-thickness\",\"text-transform\",\"text-shadow\",\"text-emphasis-color\",\"-webkit-text-fill-color\",\"-webkit-text-stroke-color\",\"-webkit-text-stroke-width\"],hi=(e,t,r)=>{let l=null,n=(o,i)=>(l??={})[o]=i;if(r.placeholder&&(W(e,\"input\")||W(e,\"textarea\"))&&n(\"::placeholder\",Q(t.getComputedStyle(e,\"::placeholder\"),null)),r.fileButton&&W(e,\"input\")&&e.type===\"file\"&&n(\"::file-selector-button\",Q(t.getComputedStyle(e,\"::file-selector-button\"),null)),r.firstLine&&n(\"::first-line\",Q(t.getComputedStyle(e,\"::first-line\"),pi)),r.sliderThumb&&W(e,\"input\")&&e.type===\"range\"){let o=null;for(let i of r.thumbRules)i.bases.some(a=>{try{return e.matches(a===\"\"?\"*\":a)}catch{return!1}})&&(o=Object.assign(o??{},Q(i.style,null)));o!==null&&n(\"::-webkit-slider-thumb\",o)}return l},mi=(e,t,r,l)=>{let n=bt({styles:r,baseline:e.getBaseline(t,l,r),parentStyles:null,parentEmittedStyles:null});return Fe(n,r,null,!1,null),Ie(n,r),n},gi=(e,t,r,l)=>{if(!r)return null;let n=null;for(let o in r){let i=r[o],a;if(o===\"::-webkit-slider-thumb\")a=i;else if(o===\"::first-line\"){a={};for(let s in i)i[s]!==l[s]&&(a[s]=i[s])}else a=mi(e,t,i,o);Object.keys(a).length>0&&((n??={})[o]=a)}return n},ur=(e,t)=>{let r=\"\";for(let l in t){let n=G(t[l]);n&&(r+=`\n.${e}${l}{${n}}`)}return r},Pe=null,cr=new Map,yi=e=>{let t=cr.get(e);if(t!==void 0)return t;Pe??=document.createElement(\"span\").style,Pe.setProperty(e,\"initial\");let r=Pe.length>1;return Pe.cssText=\"\",cr.set(e,r),r},bi=e=>e===\"cssFloat\"?\"float\":e===\"cssOffset\"?\"offset\":e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),wi=(e,t)=>{let r=new Set,l=new Set(xl),n=h=>{if(h.includes(\"#\")&&l.add(\"id\"),h.includes(\"[\"))for(let S of h.matchAll(kl))l.add(S[1].toLowerCase())},o=[],i=!0,a=!0,s=!0,c=!1,u=new Set,d=new Set,f=new Map,m=(h,S)=>{let C=S!==void 0&&!S.includes(\":\")?S:null;if(!d.has(h)){d.add(h),c&&(i=!1),f.set(h,C===null?null:[C]);return}let $=f.get(h);if($==null){f.set(h,null);return}C===null?f.set(h,null):$.push(C)},b=h=>d.has(h)&&f.get(h)===null,p=(h,S,C)=>{if(h===\"position\"){if(S!==\"static\")for(let T of et)m(T,C);return}if(h===\"transition-property\"){for(let T of Ee)(S.includes(\"all\")||S.includes(T))&&m(T,C);return}if(h===\"transform\"){if(b(\"transform\"))return;bl.test(S)&&m(\"transform\",C);return}if(Ee.has(h)){if(b(h))return;Rt.test(S)||m(h,C);return}let $=[\"margin-\",\"padding-\",\"inset\"].find(T=>h.startsWith(T));if($!==void 0&&!Rt.test(S)){let T=$===\"inset\"?\"\":$;for(let q of Ee)(T===\"\"?et.includes(q):q.startsWith(T))&&m(q,C)}},y=h=>{r.has(h)||(r.add(h),!ge(h)&&o.push(h))},k=h=>{if(ge(h)){h.startsWith(\"--\")&&(i=!1);return}yt(h)||yi(h)?i=!1:u.has(h)||(c&&(i=!1),u.add(h),d.add(h),f.set(h,null)),y(h)},A=(h,S)=>{a&&h===\"content\"&&(S.includes(\"attr(\")||S.includes(\"counter\"))&&(a=!1),p(h,S),s&&(h===\"backdrop-filter\"||h===\"-webkit-backdrop-filter\")&&(s=!1),y(h)},x=(h,S)=>{for(let C=0;C<h.length;C++){let $=h.item(C);if(a&&$===\"content\"){let T=h.getPropertyValue(\"content\");(T.includes(\"attr(\")||T.includes(\"counter\"))&&(a=!1)}p($,h.getPropertyValue($),S),s&&($===\"backdrop-filter\"||$===\"-webkit-backdrop-filter\"||S!==void 0&&Re.has($)&&h.getPropertyPriority($)===\"important\")&&(s=!1),y($)}},w=h=>{if(be(h))i&&!fi(h.selectorText)&&(i=!1),n(h.selectorText),x(h.style,h.selectorText);else if(si(h))for(let S of h.cssRules){if(!(S instanceof CSSKeyframeRule))continue;let C=S.style;for(let $=0;$<C.length;$++)k(C.item($))}else rt(h)&&ui(h)&&(i=!1)},g=()=>{if(typeof e.getAnimations==\"function\")for(let h of e.getAnimations()){let S=h.effect;if(!(S instanceof KeyframeEffect)){i=!1;continue}for(let C of S.getKeyframes())for(let $ in C)gl.has($)||k(bi($))}};for(let h of yl)y(h);let E=!1;if(oe(e,h=>(w(h),!1),()=>(E=!0,!0)),E)return null;if(g(),t!==null)for(let[h,S]of t)A(h,S);c=!0;let B=[...Nt.filter(h=>r.has(h)&&(!Ee.has(h)||d.has(h))),...[...u].filter(h=>!Nt.includes(h))],M=h=>{x(h)},P=h=>{for(let S of h)if(w(S),Cr(S)){let C=S.styleSheet;C&&P(C.cssRules)}else rt(S)&&P(S.cssRules)};return{propertyNames:o,styleRelevantAttributeNames:l,perElementPropertyNames:B,getUnstableSelectorList:h=>f.get(h)??null,isStyleMemoSafe:()=>i,isPseudoContentMemoSafe:()=>a,addInlineStyleProps:M,addParsedInlineDeclaration:A,addShadowRootStyleProps:h=>{for(let S of[...h.styleSheets,...h.adoptedStyleSheets])try{P(S.cssRules)}catch{return!1}return!0},isInlineCarrySafe:()=>s}},xi=e=>e.namespaceURI===\"http://www.w3.org/2000/svg\"&&Ar.has(e.localName),Ze=new WeakMap,Je=new WeakMap,ki=e=>typeof e.getAnimations!=\"function\"||e.getAnimations().length>0,Ai=(e,t,r,l)=>{let n=new Map,o=new Map,i=oi(e.ownerDocument),a=Xr(e.ownerDocument),s=`${Te(e.ownerDocument)}|${Lt(e.ownerDocument)}`,c=Je.get(e.ownerDocument),u=c!==void 0&&c.sheetSignature===s,d=u?c.dedupedFeed:ei(e),f=wi(e.ownerDocument,d);if(f)for(let v=e.parentElement;v!==null;v=v.parentElement)ne(v)&&v.style.length>0&&f.addInlineStyleProps(v.style);let m=f?.perElementPropertyNames??[],b=new Set(m),p=m.join(\",\"),y=u&&c.laneSignature===p?c.scanByText:new Map,k=new Map,A=ni(m),x=m.map(v=>{let D=f?.getUnstableSelectorList(v)??null;return D!==null&&D.length>0?D.join(\",\"):null}),w=x.some(v=>v!==null),g=v=>{if(!w)return null;let D=null;for(let L=0;L<x.length;L++){let V=x[L];if(V===null)continue;let K=!0;try{K=v.matches(V)}catch{K=!0}K||(D??=Array(x.length).fill(!1),D[L]=!0)}return D},E=e.ownerDocument.activeElement,B=f?.propertyNames.length??0,M=f!==null&&f.isStyleMemoSafe()&&!ki(e.ownerDocument)?`${Te(e.ownerDocument)}|${Lt(e.ownerDocument)}|${t.innerWidth}x${t.innerHeight}x${t.devicePixelRatio}|${B}|${m.join(\",\")}`:null,P=M===null?void 0:Ze.get(e.ownerDocument),h=P!==void 0&&P.signature===M,S=h?P.memoKeysByParentKey:new Map,C=h?P.memoizedStylesByKey:new Map,$=h?P.variantEmittedStyles:new Map,T=h?P.memoKeyByElement:new WeakMap,q=h?P.attributeGeneration:-1,ue=h?Yl(e.ownerDocument):null,N=M===null?-1:_l(e.ownerDocument),I=h?P.nextMemoKey:0,O=(v,D,L,V)=>{if(vl.has(v.localName)||xi(v)||r&&!r(v))return;f&&v.shadowRoot&&(f.addShadowRootStyleProps(v.shadowRoot)||(f=null));let K=ne(v)&&!L&&!Bt.has(v.localName),U=null,ee=v.getAttribute(\"style\");if(ee!==null&&ne(v)&&(U=y.get(ee)??k.get(ee)??null,U===null)){let F=Gr(ee);if(F!==null){if(U=Xo(F,b),f&&U.registryFeed!==null)for(let[Se,te]of U.registryFeed)f.addParsedInlineDeclaration(Se,te);y.set(ee,U)}else f&&f.addInlineStyleProps(v.style),U=Ko(v.style,b,ee),k.set(ee,U)}let Ae=_o(v,D,n,t),ie=f&&v.namespaceURI!==\"http://www.w3.org/2000/svg\"&&!Bt.has(v.localName)?f.propertyNames:null,j=-1,ve=\"\";if(ie&&f?.isStyleMemoSafe()&&K&&V!==-1&&Ae===null){U!==null&&f.isInlineCarrySafe()&&(ve=U.carryText,ve!==\"\"&&o.set(v,ve));let F=ue!==null&&(ue.get(v)??0)<=q?T.get(v):void 0;if(F!==void 0&&F.parentMemoKey===V)j=F.memoKey;else{let Se=Zo(v,f?.styleRelevantAttributeNames??null,U===null?\"\":ve===\"\"?U.descriptorPlain:U.descriptorWithCarry),te=S.get(V);te===void 0&&(te=new Map,S.set(V,te));let Mt=te.get(Se);Mt===void 0?(j=I++,te.set(Se,j)):j=Mt,T.set(v,{memoKey:j,parentMemoKey:V})}}let Ue=v===E,z=j!==-1&&!Ue?C.get(j):void 0,Oe=t.getComputedStyle(v),_;if(z)_=Object.create(z.styles),vt(_,Oe,m,A,z.laneSkipMask,!Qr(v));else{if(D!==null&&Oe.getPropertyValue(\"display\")===\"none\")return;_=Q(Oe,ie,!0)}if((_.display===\"none\"||ti(_))&&D!==null)return;if(Ae!==null)for(let F in Ae)_[F]=Ae[F];let el=i.definesBeforeAfter||L,tl=(i.definesMarker||L)&&(_.display??\"\").includes(\"list-item\"),ce=null,de=null;el&&(z&&f?.isPseudoContentMemoSafe()?(ce=ar(v,\"::before\",t,m,A,z.beforeStyles,z.laneSkipMask),de=ar(v,\"::after\",t,m,A,z.afterStyles,z.laneSkipMask)):z?(ce=sr(v,\"::before\",t,ie,m,A,z.beforeStyles,z.laneSkipMask),de=sr(v,\"::after\",t,ie,m,A,z.afterStyles,z.laneSkipMask)):(ce=ir(v,\"::before\",t,ie),de=ir(v,\"::after\",t,ie))),j!==-1&&!z&&!Ue&&C.set(j,{styles:_,beforeStyles:ce,afterStyles:de,laneSkipMask:g(v)});let St=_[\"overflow-x\"],Et=_[\"overflow-y\"],Ct=v.localName===\"html\"||v.localName===\"body\"||St!==void 0&&St!==\"visible\"||Et!==void 0&&Et!==\"visible\";if(n.set(v,{styles:_,beforeStyles:ce,afterStyles:de,firstLetterStyles:i.definesFirstLetter?ii(v,t):null,markerStyles:tl?ai(v,t):null,pseudoStyles:hi(v,t,a),parentElement:D,scrollLeft:Ct?v.scrollLeft:0,scrollTop:Ct?v.scrollTop:0,memoKey:Ue?-1:j}),Sl.has(v.localName)||l?.has(v))return;let ze=L||!!v.shadowRoot;if(!ze){for(let F=v.firstElementChild;F!==null;F=F.nextElementSibling)O(F,v,!1,j);return}for(let F of ke(v,ze))H(F)&&O(F,v,ze,j)};O(e,null,!1,0);let J=M!==null&&f!==null&&f.isStyleMemoSafe()&&f.propertyNames.length===B&&C.size<=8192;if(J?Ze.set(e.ownerDocument,{signature:M,memoKeysByParentKey:S,memoizedStylesByKey:C,variantEmittedStyles:$,memoKeyByElement:T,attributeGeneration:N,nextMemoKey:I}):Ze.delete(e.ownerDocument),f!==null&&y.size<=8192){let v=u&&c.scanByText===y&&c.feedScanCount===y.size?c.dedupedFeed:null;if(v===null){let D=new Set,L=[];for(let V of y.values())if(V.registryFeed!==null)for(let K of V.registryFeed){let U=`${K[0]}|${K[1]}`;D.has(U)||(D.add(U),L.push(K))}v=L}Je.set(e.ownerDocument,{sheetSignature:s,laneSignature:p,scanByText:y,dedupedFeed:v,feedScanCount:y.size})}else Je.delete(e.ownerDocument);return{snapshotByElement:n,perElementPropertyNames:m,persistedVariantEmittedStyles:J?$:null,inlineCarryTextByElement:o}},dr=se(8),G=e=>{let t=\"\";for(let r in e)t+=`${r}:${e[r]};`;return t},vi=()=>{let e=new Map,t=[];return{rules:t,register:(r,l,n,o,i,a)=>{let s={base:G(r),before:l?G(l):\"\",after:n?G(n):\"\",firstLetter:o?G(o):\"\",marker:i?G(i):\"\"},c=a?ur(\"\",a):\"\",u=`${s.base}|before:${s.before}|after:${s.after}|first-letter:${s.firstLetter}|marker:${s.marker}|extra:${c}`,d=e.get(u);if(d)return d;let f=`rgs-${t.length+1}`;return e.set(u,f),t.push({className:f,signature:u,baseStyles:r,beforeStyles:l,afterStyles:n,firstLetterStyles:o,markerStyles:i,extraStyles:a??null,cachedBlocks:s}),f},toCssText:()=>{let r=`${Qn()}`;for(let u of t)r+=`\\0${u.signature}`;let l=dr.get(r);if(l!==void 0)return l;let n=new Map;for(let u of t){let d=u.baseStyles;for(let f in d){let m=`${f}:${d[f]};`,b=n.get(m);b===void 0?n.set(m,[u.className]):b.push(u.className)}}let o=new Map;for(let[u,d]of n){if(d.length<2)continue;let f=d.join(\",.\");o.set(f,(o.get(f)??\"\")+u)}let i=new Map,a=new Map,s=\"\";for(let[u,d]of o)s+=`.${u}{${d}}\n`;for(let u of t){let d=u.baseStyles,f=\"\";for(let x in d){let w=`${x}:${d[x]};`,g=n.get(w);g!==void 0&&g.length>=2||(f+=w)}let m=`.${u.className}{${f}}`,b=u.cachedBlocks,p=b?.before??(u.beforeStyles?G(u.beforeStyles):\"\"),y=b?.after??(u.afterStyles?G(u.afterStyles):\"\"),k=b?.firstLetter??(u.firstLetterStyles?G(u.firstLetterStyles):\"\"),A=b?.marker??(u.markerStyles?G(u.markerStyles):\"\");if(p){let x=i.get(p);x===void 0?i.set(p,[u.className]):x.push(u.className)}if(y){let x=a.get(y);x===void 0?a.set(y,[u.className]):x.push(u.className)}k&&(m+=`\n.${u.className}::first-letter{${k}}`),A&&(m+=`\n.${u.className}::marker{${A}}`),u.extraStyles&&(m+=ur(u.className,u.extraStyles)),s+=`${m}\n`}for(let[u,d]of i)s+=`.${d.join(\"::before,.\")}::before{${u}}\n`;for(let[u,d]of a)s+=`.${d.join(\"::after,.\")}::after{${u}}\n`;let c=s.slice(0,-1);return dr.set(r,c),c}}},Ve=e=>{let t=[],r=0,l=0;for(let n=0;n<e.length;n+=1){let o=e[n];o===\"(\"?r+=1:o===\")\"?--r:o===\",\"&&r===0&&(t.push(e.slice(l,n)),l=n+1)}return t.push(e.slice(l)),t},fr={\"background-size\":\"100% 100%\",\"background-position\":\"0% 0%\",\"background-repeat\":\"no-repeat\",\"background-origin\":\"border-box\",\"background-clip\":\"border-box\",\"background-attachment\":\"scroll\",\"background-blend-mode\":\"normal\"},pr={\"background-size\":\"auto\",\"background-position\":\"0% 0%\",\"background-repeat\":\"repeat\",\"background-origin\":\"padding-box\",\"background-clip\":\"border-box\",\"background-attachment\":\"scroll\",\"background-blend-mode\":\"normal\"},Si=(e,t,r)=>{delete e[\"backdrop-filter\"];let l=t[\"background-image\"]??\"none\",n=l===\"none\"?[]:Ve(l).map(s=>s.trim()),o=t[\"background-color\"],i=!!o&&o!==\"rgba(0, 0, 0, 0)\"&&o!==\"transparent\",a=[...n];i&&a.push(`linear-gradient(${o}, ${o})`),a.push(`url(\"${r}\")`),e[\"background-image\"]=a.join(\", \"),e[\"background-color\"]=\"transparent\";for(let s in pr){let c=pr[s],u=t[s],d=u?Ve(u).map(m=>m.trim()):[c],f=n.map((m,b)=>d[b%d.length]??c);i&&f.push(s===\"background-clip\"?d[d.length-1]??c:fr[s]),f.push(fr[s]),e[s]=f.join(\", \")}},Ei=e=>{if(e.includes(\"inset\"))return 0;let[t=0,r=0,l=0,n=0]=Sr(e),o=l*1.5;return Math.max(0,o+n-t,o+n+t,o+n-r,o+n+r)},Ci=e=>{if(!e||e===\"none\")return 0;let t=0;for(let r of Ve(e))t=Math.max(t,Ei(r));return t},Mi=e=>{let t=e[\"outline-style\"];if(!t||t===\"none\")return 0;let r=R(e[\"outline-width\"]);return r<=0?0:Math.max(0,r+R(e[\"outline-offset\"]))},dt=e=>Math.ceil(Math.max(Ci(e[\"box-shadow\"]),Mi(e),mt(e.filter))),$i=e=>e!==\"inline\"&&e!==\"contents\"&&!e.startsWith(\"table\")&&!e.startsWith(\"ruby\")&&!e.startsWith(\"inline-table\"),Pi=(e,t)=>{let r=t.getComputedStyle(e),l=dt({\"box-shadow\":r.getPropertyValue(\"box-shadow\"),filter:r.getPropertyValue(\"filter\"),\"outline-style\":r.getPropertyValue(\"outline-style\"),\"outline-width\":r.getPropertyValue(\"outline-width\"),\"outline-offset\":r.getPropertyValue(\"outline-offset\")}),n=dt({\"box-shadow\":r.getPropertyValue(\"text-shadow\")});return Math.max(l,n)},Ni=(e,t,r)=>{let l=new Set,n=e.ownerDocument.defaultView;if(!n)return l;let o=t.x-32,i=t.y-32,a=t.x+t.width+32,s=t.y+t.height+32,c=t.x-r,u=t.y-r,d=t.x+t.width+r,f=t.y+t.height+r,m=b=>{let p=b.getBoundingClientRect(),y=p.left<a&&p.right>o&&p.top<s&&p.bottom>i,k=p.left<d&&p.right>c&&p.top<f&&p.bottom>u,A=!y&&k?Pi(b,n):0,x={left:p.left-A,top:p.top-A,right:p.right+A,bottom:p.bottom+A},w=!1;for(let g of ke(b))if(H(g)){w=!0;let E=m(g);E.left<x.left&&(x.left=E.left),E.top<x.top&&(x.top=E.top),E.right>x.right&&(x.right=E.right),E.bottom>x.bottom&&(x.bottom=E.bottom)}else g.nodeType===Node.TEXT_NODE&&g.textContent!==\"\"&&(w=!0);return w&&!(x.left<a&&x.right>o&&x.top<s&&x.bottom>i)&&b!==e&&$i(n.getComputedStyle(b).getPropertyValue(\"display\"))&&l.add(b),x};return m(e),l},Ri=e=>{let t=e.ownerDocument.defaultView;if(!t)return\"\";let r=De(e);for(;r;){let l=t.getComputedStyle(r).backgroundColor;if(l&&l!==\"rgba(0, 0, 0, 0)\"&&l!==\"transparent\")return l;r=De(r)}return\"\"},Bi=e=>{let t=new Image;return t.src=e,t.decode().then(()=>({widthPx:t.naturalWidth,heightPx:t.naturalHeight})).catch(()=>null)},Zr=e=>ml.some(t=>e.startsWith(t)),Ti=e=>{if(!e.firstLetterStyles)return null;let t=null;for(let r in e.firstLetterStyles){if(!Zr(r))continue;let l=e.firstLetterStyles[r];l===void 0||l===e.styles[r]||(t??={},t[r]=l)}return t},ft=(e,t,r,l)=>{if(!r)return null;let n=bt({styles:r,baseline:e.getBaseline(t,l,r),parentStyles:null,parentEmittedStyles:null});return Fe(n,r,null,!1,null),Ie(n,r),n.content=r.content??\"none\",n},hr=se(2),Jr=(e,t,r)=>{let l=Object.getPrototypeOf(t);for(let n=0;n<r.length;n++){let o=r[n];if(!Object.hasOwn(t,o))continue;let i=t[o];l!==null&&l[o]===i||(e+=`\u001f${n}:${i??\"\"}`)}return e},mr=(e,t,r)=>t===null?`${e}\u001f\\0`:(e+=`\u001f${t.content??\"\"}`,Jr(e,t,r)),gr=(e,t,r)=>{let l=t??\"\";return l=Jr(l,e.styles,r),l=mr(l,e.beforeStyles,r),mr(l,e.afterStyles,r)},yr=(e,t,r,l,n,o)=>{if(!l)return null;if(!e||e.content!==(l.content??\"none\"))return ft(t,r,l,n);let i={...e};return Wr(i,l,t.getBaseline(r,n,l),o),Fe(i,l,null,!1,null),Ie(i,l),i.content=l.content??\"none\",i},Di=(e,t,r,l,n,o,i,a,s)=>{let c=new Map,u=new Map,d=Dn(t),f=new Map,m=new Map,b=(w,g)=>{if(g.memoKey===-1)return r.getBaseline(w,null,g.styles);let E=m.get(g.memoKey);return E===void 0&&(E=r.getBaseline(w,null,g.styles),m.set(g.memoKey,E)),E},p=new Map,y=s??new Map;for(let[w,g]of e){let E=g.parentElement?e.get(g.parentElement):void 0,B=d&&g.memoKey!==-1&&w!==n&&!i?.has(w)&&!a.has(w)&&!g.pseudoStyles,M;if(B){let C=gr(g,E?.styles.display??null,t);if(p.set(w,C),M=y.get(g.memoKey),M===void 0)M=new Map,y.set(g.memoKey,M);else{let $=M.get(C);if($!==void 0){u.set(w,$);continue}}}let P=d&&g.memoKey!==-1?f.get(g.memoKey):void 0,h;if(P?(h={...P},Wr(h,g.styles,b(w,g),t)):(h=bt({styles:g.styles,baseline:b(w,g),parentStyles:E?.styles??null,parentEmittedStyles:g.parentElement?u.get(g.parentElement)??null:null}),d&&g.memoKey!==-1&&f.set(g.memoKey,{...h})),Fe(h,g.styles,E?.styles.display??null,Qr(w),w.localName),Ie(h,g.styles),W(w,\"iframe\")){let C=g.styles.display??\"inline\";h.display=C===\"inline\"?\"inline-block\":C}h[\"content-visibility\"]===\"auto\"&&(h[\"content-visibility\"]=\"visible\"),w===n&&Wn(h,o),i?.has(w)&&(h.visibility=\"hidden\",delete h[\"backdrop-filter\"]);let S=a.get(w);S&&Si(h,g.styles,S),u.set(w,h),M&&M.set(p.get(w)??\"\",h)}let k=Eo(n,e,u),A=new Map,x=new Map;for(let[w,g]of e){let E=u.get(w);if(!E)continue;let B=d&&g.memoKey!==-1&&w!==n&&g.firstLetterStyles===null&&g.markerStyles===null&&!g.pseudoStyles&&!k.has(w)&&!i?.has(w)&&!a.has(w),M=(g.parentElement?e.get(g.parentElement):void 0)?.styles.display??null,P,h=\"\";if(B)if(h=p.get(w)??gr(g,M,t),P=x.get(g.memoKey),P===void 0)P=new Map,x.set(g.memoKey,P);else{let q=P.get(h);if(q!==void 0){c.set(w,q);continue}}let S=d&&g.memoKey!==-1?A.get(g.memoKey):void 0,C,$;S?(C=yr(S.beforeDiff,r,w,g.beforeStyles,\"::before\",t),$=yr(S.afterDiff,r,w,g.afterStyles,\"::after\",t)):(C=ft(r,w,g.beforeStyles,\"::before\"),$=ft(r,w,g.afterStyles,\"::after\"),d&&g.memoKey!==-1&&A.set(g.memoKey,{beforeDiff:C?{...C}:null,afterDiff:$?{...$}:null}));let T=l.register(E,C,$,Ti(g),Vn(g.markerStyles,g.styles),gi(r,w,g.pseudoStyles,g.styles));c.set(w,T),P&&P.set(h,T)}return c},pt=new Set,he=new WeakMap,Li=async(e,t)=>{if(t.resolveIframeContent)try{let r=await t.resolveIframeContent(e);if(r){let l=await Bi(r);if(l)return{pngDataUrl:r,widthPx:l.widthPx,heightPx:l.heightPx,canvasBackgroundColor:null}}}catch{}return ho(e,t.pixelRatio)},Vi=async(e,t)=>{let r=new Map,l=[];for(let o of e.keys()){if(!W(o,\"iframe\"))continue;let i=o.contentDocument,a=i?.documentElement;if(!i||!a||!i.defaultView){l.push(o);continue}if(!pt.has(i))try{let s=i.defaultView,c={x:s.scrollX,y:s.scrollY,width:a.clientWidth,height:a.clientHeight},u;he.set(a,c);try{u=await ye(a,{scale:1,pixelRatio:t.pixelRatio,embedFonts:t.embedFonts,timeoutMs:t.timeoutMs,abortSignal:t.abortSignal,clip:c.width>0&&c.height>0?{x:0,y:0,width:c.width,height:c.height}:void 0})}finally{he.delete(a)}r.set(o,{pngDataUrl:await u.toPngDataUrl(),widthPx:u.width,heightPx:u.height,canvasBackgroundColor:kt(i)})}catch(s){if(t.abortSignal?.aborted)throw s}}let n=await Promise.all(l.map(o=>Li(o,t)));for(let o=0;o<l.length;o+=1){let i=n[o];i&&r.set(l[o],i)}return r},We=async(e,t,r)=>{let l=e.ownerDocument,n=l.defaultView;if(!n)throw Error(\"captureNode requires an element attached to a window\");if(!e.isConnected)throw Error(\"captureNode requires an element attached to a document\");t.abortSignal?.throwIfAborted(),pt.add(l);try{l.fonts.status!==\"loaded\"&&await it(l.fonts.ready,t.abortSignal);let o=!r.skipBackdropFilterBaking&&r.suppressedBackdropElements===null?Pr(t):null;if(o!==null){let N=Rr(e,o);if(N)return t.backgroundColor=N.resolvedBackgroundColor,st(N.svgMarkup,N.widthPx,N.heightPx,t,N.clipRect)}let i=e.getBoundingClientRect(),a=e===l.documentElement?Math.max(i.height,e.scrollHeight):i.height,s=Math.ceil(i.right)-Math.floor(i.left),c=Math.ceil(i.top+a)-Math.floor(i.top),u=ne(e)?e.offsetWidth:0,d=ne(e)?Math.max(e.offsetHeight,Math.round(a)):0,f=Math.max(1,u>0?u:s),m=Math.max(1,d>0?d:c);Oo(e,t.timeoutMs);let b=performance.now(),{snapshotByElement:p,perElementPropertyNames:y,persistedVariantEmittedStyles:k,inlineCarryTextByElement:A}=r.presnapshottedTree??Ai(e,n,t.filterNode,t.prunedElements);Y.snapshotMs=performance.now()-b;let x=p.get(e);if(!x)throw Error(\"captureNode target was excluded by filterNode or is not capturable\");let w=t.bleed===\"auto\"?dt(x.styles):Math.max(0,Math.ceil(t.bleed)),g=Co({rootElement:e,rootStyles:x.styles,defaultView:n,layoutWidthPx:f,layoutHeightPx:m,bleedPx:w});if(!g.rootLinearTransform){let N=i.left-Math.floor(i.left),I=i.top-Math.floor(i.top);g={...g,layoutWidthPx:i.width>0?i.width:g.layoutWidthPx,layoutHeightPx:a>0?a:g.layoutHeightPx,outputWidthPx:Math.max(1,s)+2*w,outputHeightPx:Math.max(1,c)+2*w,contentOffsetLeftPx:w+N,contentOffsetTopPx:w+I}}let E=t.clip?{x:t.clip.x+g.contentOffsetLeftPx,y:t.clip.y+g.contentOffsetTopPx,width:t.clip.width,height:t.clip.height}:null;if(t.backgroundColor===void 0){let N=x.styles[\"background-color\"];(!N||N===\"rgba(0, 0, 0, 0)\"||N===\"transparent\"||g.rootLinearTransform||w>0)&&(t.backgroundColor=Ri(e)||void 0)}let B=performance.now(),M=await Vi(p,t);Y.iframesMs=performance.now()-B,t.abortSignal?.throwIfAborted();let P=new Map,h=performance.now();if(!r.skipBackdropFilterBaking){let N=Wl(p,e);if(N.length>0){let I=N.map(L=>L.getBoundingClientRect()),O=g.rootLinearTransform?void 0:Vl(N,I,p,i),J=await We(e,{...t,scale:1,bleed:0,clip:O},{suppressedBackdropElements:new Set(N),skipBackdropFilterBaking:!0,presnapshottedTree:{snapshotByElement:p,perElementPropertyNames:y,persistedVariantEmittedStyles:k,inlineCarryTextByElement:A}}),v=`${t.pixelRatio}|${t.backgroundColor??\"\"}|${O?.x??0},${O?.y??0}|`+N.map((L,V)=>`${I[V].x},${I[V].y},${I[V].width},${I[V].height},${p.get(L)?.styles[\"backdrop-filter\"]??\"\"}`).join(\";\")+`|${await J.toSvgDataUrl()}`,D=hr.get(v);D&&D.length===N.length?N.forEach((L,V)=>{let K=D[V];K&&P.set(L,K)}):(P=Kl({underlayCanvas:await J.toCanvas(),ownerDocument:l,rootElement:e,backdropFilterElements:N,snapshotByElement:p,pixelRatio:t.pixelRatio,backgroundColor:t.backgroundColor,underlayOffsetLeftPx:O?.x??0,underlayOffsetTopPx:O?.y??0}),hr.set(v,N.map(L=>P.get(L)??\"\")))}}Y.backdropMs=performance.now()-h,t.abortSignal?.throwIfAborted();let S=Tn(l),C;try{let N=performance.now(),I=vi(),O=Nn(e,{ownerDocument:l,classNameByElement:Di(p,y,S,I,e,g,r.suppressedBackdropElements,P,k),snapshotByElement:p,cloneByElement:new Map,iframeContentByElement:M,viewportScroll:he.get(e)??null,prunedElements:t.prunedElements,inlineCarryTextByElement:A});if(!O)throw Error(\"captureNode could not clone the target element\");Y.buildMs=performance.now()-N;let J=performance.now(),[,v]=await it(Promise.all([(async()=>{await xo({clone:O,rules:I.rules,sourceDocument:l,timeoutMs:t.timeoutMs}),await yo(O,I.rules,t.timeoutMs)})(),t.embedFonts?co(ao(I.rules),l,t.timeoutMs,so(I.rules)):Promise.resolve(\"\")]),t.abortSignal);Y.inlineMs=performance.now()-J;let D=performance.now();C=Uo({clone:O,cssText:`${v}\n${Xr(l).counterCss}\n${I.toCssText()}\n${go(O)}`,width:Math.max(g.outputWidthPx,he.get(e)?.width??0),height:Math.max(g.outputHeightPx,he.get(e)?.height??0),clip:Le()?null:E,ownerDocument:l}),Y.serializeMs=performance.now()-D}finally{S.dispose()}let $=!!E&&Le(),T=E&&!$?E.width:g.outputWidthPx,q=E&&!$?E.height:g.outputHeightPx,ue=E&&!$?null:E;return o!==null&&tn(e,o,p,{svgMarkup:C,widthPx:T,heightPx:q,clipRect:ue,resolvedBackgroundColor:t.backgroundColor,contentOffsetLeftPx:g.contentOffsetLeftPx,contentOffsetTopPx:g.contentOffsetTopPx}),st(C,T,q,t,ue)}finally{pt.delete(l)}},ye=async(e,t={})=>{let r=e.ownerDocument.defaultView;if(!r)throw Error(\"captureNode requires an element attached to a window\");return We(e,{scale:t.scale??1,pixelRatio:t.pixelRatio??r.devicePixelRatio,backgroundColor:t.backgroundColor,embedFonts:t.embedFonts??!0,bleed:t.bleed??0,clip:t.clip,prunedElements:void 0,filterNode:t.filterNode,resolveIframeContent:t.resolveIframeContent,timeoutMs:t.timeoutMs??8e3,abortSignal:t.abortSignal},{suppressedBackdropElements:null,skipBackdropFilterBaking:!1})},Wi=async(e,t={})=>{let r=t.root??document.documentElement,l=r.ownerDocument.defaultView;if(!l)throw Error(\"captureRegion requires an element attached to a window\");let n=r.getBoundingClientRect(),o=t.cullMarginPx??256,i=o>=0?Ni(r,e,o):void 0,a={scale:t.scale??1,pixelRatio:t.pixelRatio??l.devicePixelRatio,backgroundColor:t.backgroundColor??kt(r.ownerDocument)??void 0,embedFonts:t.embedFonts??!0,bleed:0,clip:{x:e.x-n.left,y:e.y-n.top,width:e.width,height:e.height},prunedElements:i,filterNode:t.filterNode,resolveIframeContent:t.resolveIframeContent,timeoutMs:t.timeoutMs??8e3,abortSignal:t.abortSignal},s={...a,clip:void 0,prunedElements:void 0},c=Pr(s);if(c!==null&&a.clip){let u=a.clip,d=()=>{let m=Rr(r,c);return!m||m.clipRect!==null?null:st(m.svgMarkup,m.widthPx,m.heightPx,{...s,backgroundColor:m.resolvedBackgroundColor},{x:u.x+m.contentOffsetLeftPx,y:u.y+m.contentOffsetTopPx,width:u.width,height:u.height})},f=d();if(f)return f;if(Gl(r)){await We(r,s,{suppressedBackdropElements:null,skipBackdropFilterBaking:!1});let m=d();if(m)return m;Xl(r)}}return Ql(r),We(r,a,{suppressedBackdropElements:null,skipBackdropFilterBaking:!1})},Ii=async(e=document)=>{if(e instanceof Element){try{await(await ye(e)).toBlob()}catch{}return}let t=e.body??e.documentElement;if(!t)return;let r=e.createElement(\"div\");r.style.cssText=\"position:absolute;left:-99999px;top:0;width:16px;height:16px;background:#fff;\",r.textContent=\"prewarm\",t.appendChild(r);try{await(await ye(r)).toBlob()}catch{return}finally{r.remove()}},Fi=()=>mo(async e=>{let t=await ye(document.documentElement,{scale:1,pixelRatio:e});return{pngDataUrl:await t.toPngDataUrl(),widthPx:t.width,heightPx:t.height}});return al(Ui);})();"
diff --git a/scripts/vendor-fast-html-to-image.mjs b/scripts/vendor-fast-html-to-image.mjs
new file mode 100644
index 0000000..dc6eb3e
--- /dev/null
+++ b/scripts/vendor-fast-html-to-image.mjs
@@ -0,0 +1,28 @@
+// Regenerates lib/vendor/fast-html-to-image.ts from a vercel-labs/fast-snap checkout, whose
+// vendor/fast-html-to-image/ holds the patched fork (MIT):
+// node scripts/vendor-fast-html-to-image.mjs ../fast-snap
+// The bundle is inlined into a <script> in every design preview, so it must not
+// contain text that would end that script or open a comment there.
+import { execFileSync } from 'node:child_process'
+import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'
+import { join, resolve } from 'node:path'
+
+const snap = resolve(process.argv[2] ?? '../fast-snap')
+const fork = join(snap, 'vendor/fast-html-to-image')
+const bundle = execFileSync(join(snap, 'node_modules/.bin/esbuild'), [
+ join(fork, 'src/index.js'), '--bundle', '--minify', '--format=iife', '--global-name=FastHtmlToImage', '--log-level=warning',
+], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 }).trim()
+if (/<\/script|<!--/i.test(bundle)) throw new Error('bundle contains text that would break an inline <script>')
+const commit = execFileSync('git', ['-C', snap, 'rev-parse', '--short', 'HEAD'], { encoding: 'utf8' }).trim()
+const license = readFileSync(join(fork, 'LICENSE'), 'utf8').trim().split('\n').map((line) => `// ${line}`.trimEnd()).join('\n')
+
+const out = new URL('../lib/vendor/fast-html-to-image.ts', import.meta.url)
+mkdirSync(new URL('./', out), { recursive: true })
+writeFileSync(out, `// Generated by scripts/vendor-fast-html-to-image.mjs from fast-snap ${commit}. Do not edit.
+// fast-html-to-image (patched fork), browser IIFE exposing the global FastHtmlToImage.
+//
+${license}
+
+export const FAST_HTML_TO_IMAGE = ${JSON.stringify(bundle)}
+`)
+console.log(`wrote lib/vendor/fast-html-to-image.ts (${bundle.length} bytes, fast-snap ${commit})`)